From e9f237f39dfc7d712771d0e073b96b584b856773 Mon Sep 17 00:00:00 2001 From: ElrikUnderlake Date: Fri, 10 Mar 2023 20:49:16 -0600 Subject: [PATCH 1/9] chore(accessibility): add all aria-labels --- invokeai/frontend/web/public/locales/en.json | 20 ++++++++++++++++++- .../web/src/common/components/IAISlider.tsx | 5 ++++- .../components/ImageUploaderIconButton.tsx | 4 +++- .../ImageMetadataViewer.tsx | 9 +++++++-- .../components/NextPrevImageButtons.tsx | 6 ++++-- .../features/lightbox/components/Lightbox.tsx | 3 ++- .../components/ReactPanZoomButtons.tsx | 16 ++++++++------- .../features/system/components/Console.tsx | 6 ++++-- .../components/ModelManager/ModelListItem.tsx | 2 +- .../ui/components/FloatingGalleryButton.tsx | 4 +++- .../FloatingParametersPanelButtons.tsx | 4 +++- 11 files changed, 59 insertions(+), 20 deletions(-) diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json index 3b6faf8497..5d6eb56e3e 100644 --- a/invokeai/frontend/web/public/locales/en.json +++ b/invokeai/frontend/web/public/locales/en.json @@ -1,7 +1,25 @@ { "accessibility": { "modelSelect": "Model Select", - "invokeProgressBar": "Invoke progress bar" + "invokeProgressBar": "Invoke progress bar", + "reset": "Reset", + "uploadImage": "Upload Image", + "previousImage": "Previous Image", + "nextImage": "Next Image", + "useThisParameter": "Use this parameter", + "copyMetadataJson": "Copy metadata JSON", + "exitViewer": "ExitViewer", + "zoomIn": "Zoom In", + "zoomOut": "Zoom Out", + "rotateCounterClockwise": "Rotate Counter-Clockwise", + "rotateClockwise": "Rotate Clockwise", + "flipHorizontally": "Flip Horizontally", + "flipVertically": "Flip Vertically", + "modifyConfig": "Modify Config", + "toggleAutoscroll": "Toggle autoscroll", + "toggleLogViewer": "Toggle Log Viewer", + "showGallery": "Show Gallery", + "showOptionsPanel": "Show Options Panel" }, "common": { "hotkeysLabel": "Hotkeys", diff --git a/invokeai/frontend/web/src/common/components/IAISlider.tsx b/invokeai/frontend/web/src/common/components/IAISlider.tsx index 1acc64db23..af67d997d9 100644 --- a/invokeai/frontend/web/src/common/components/IAISlider.tsx +++ b/invokeai/frontend/web/src/common/components/IAISlider.tsx @@ -26,6 +26,7 @@ import { import { clamp } from 'lodash'; import { FocusEvent, useEffect, useMemo, useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { BiReset } from 'react-icons/bi'; import IAIIconButton, { IAIIconButtonProps } from './IAIIconButton'; @@ -96,6 +97,8 @@ export default function IAISlider(props: IAIFullSliderProps) { ...rest } = props; + const { t } = useTranslation(); + const [localInputValue, setLocalInputValue] = useState< string | number | undefined >(String(value)); @@ -234,7 +237,7 @@ export default function IAISlider(props: IAIFullSliderProps) { {withReset && ( } onClick={handleResetDisable} diff --git a/invokeai/frontend/web/src/common/components/ImageUploaderIconButton.tsx b/invokeai/frontend/web/src/common/components/ImageUploaderIconButton.tsx index d3c7e4f7b4..169651cbc8 100644 --- a/invokeai/frontend/web/src/common/components/ImageUploaderIconButton.tsx +++ b/invokeai/frontend/web/src/common/components/ImageUploaderIconButton.tsx @@ -1,14 +1,16 @@ import { ImageUploaderTriggerContext } from 'app/contexts/ImageUploaderTriggerContext'; import { useContext } from 'react'; +import { useTranslation } from 'react-i18next'; import { FaUpload } from 'react-icons/fa'; import IAIIconButton from './IAIIconButton'; const ImageUploaderIconButton = () => { + const { t } = useTranslation(); const openImageUploader = useContext(ImageUploaderTriggerContext); return ( } onClick={openImageUploader || undefined} diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx index 192b832454..ce10e255c1 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageMetaDataViewer/ImageMetadataViewer.tsx @@ -42,6 +42,7 @@ import { import { setShouldShowImageDetails } from 'features/ui/store/uiSlice'; import { memo } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; +import { useTranslation } from 'react-i18next'; import { FaCopy } from 'react-icons/fa'; import { IoArrowUndoCircleOutline } from 'react-icons/io5'; import { APP_METADATA_HEIGHT } from 'theme/util/constants'; @@ -66,12 +67,14 @@ const MetadataItem = ({ labelPosition, withCopy = false, }: MetadataItemProps) => { + const { t } = useTranslation(); + return ( {onClick && ( } size="xs" variant="ghost" @@ -162,6 +165,8 @@ const ImageMetadataViewer = memo( width, } = metadata; + const { t } = useTranslation(); + const metadataJSON = JSON.stringify(image.metadata, null, 2); return ( @@ -422,7 +427,7 @@ const ImageMetadataViewer = memo( } size="xs" variant="ghost" diff --git a/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx b/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx index 0cf41cb057..2da7579fd9 100644 --- a/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/NextPrevImageButtons.tsx @@ -3,6 +3,7 @@ import { createSelector } from '@reduxjs/toolkit'; import { useAppDispatch, useAppSelector } from 'app/storeHooks'; import { isEqual } from 'lodash'; import { useState } from 'react'; +import { useTranslation } from 'react-i18next'; import { FaAngleLeft, FaAngleRight } from 'react-icons/fa'; import { gallerySelector } from '../store/gallerySelectors'; import { @@ -51,6 +52,7 @@ export const nextPrevImageButtonsSelector = createSelector( const NextPrevImageButtons = () => { const dispatch = useAppDispatch(); + const { t } = useTranslation(); const { isOnFirstImage, isOnLastImage } = useAppSelector( nextPrevImageButtonsSelector @@ -95,7 +97,7 @@ const NextPrevImageButtons = () => { > {shouldShowNextPrevButtons && !isOnFirstImage && ( } variant="unstyled" onClick={handleClickPrevButton} @@ -114,7 +116,7 @@ const NextPrevImageButtons = () => { > {shouldShowNextPrevButtons && !isOnLastImage && ( } variant="unstyled" onClick={handleClickNextButton} diff --git a/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx b/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx index 79b2655583..5f792901aa 100644 --- a/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx +++ b/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx @@ -38,6 +38,7 @@ export const lightboxSelector = createSelector( export default function Lightbox() { const dispatch = useAppDispatch(); + const { t } = useTranslation(); const isLightBoxOpen = useAppSelector( (state: RootState) => state.lightbox.isLightboxOpen ); @@ -96,7 +97,7 @@ export default function Lightbox() { > } - aria-label="Exit Viewer" + aria-label={t('accessibility.exitViewer')} onClick={() => { dispatch(setIsLightboxOpen(false)); }} diff --git a/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomButtons.tsx b/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomButtons.tsx index fffe609ab7..ee9be65cc1 100644 --- a/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomButtons.tsx +++ b/invokeai/frontend/web/src/features/lightbox/components/ReactPanZoomButtons.tsx @@ -1,5 +1,6 @@ import { ButtonGroup } from '@chakra-ui/react'; import IAIIconButton from 'common/components/IAIIconButton'; +import { useTranslation } from 'react-i18next'; import { BiReset, BiRotateLeft, @@ -26,12 +27,13 @@ const ReactPanZoomButtons = ({ reset, }: ReactPanZoomButtonsProps) => { const { zoomIn, zoomOut, resetTransform } = useTransformContext(); + const { t } = useTranslation(); return ( } - aria-label="Zoom In" + aria-label={t('accessibility.zoomIn')} tooltip="Zoom In" onClick={() => zoomIn()} fontSize={20} @@ -39,7 +41,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Zoom Out" + aria-label={t('accessibility.zoomOut')} tooltip="Zoom Out" onClick={() => zoomOut()} fontSize={20} @@ -47,7 +49,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Rotate Counter-Clockwise" + aria-label={t('accessibility.rotateCounterClockwise')} tooltip="Rotate Counter-Clockwise" onClick={rotateCounterClockwise} fontSize={20} @@ -55,7 +57,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Rotate Clockwise" + aria-label={t('accessibility.rotateClockwise')} tooltip="Rotate Clockwise" onClick={rotateClockwise} fontSize={20} @@ -63,7 +65,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Flip Horizontally" + aria-label={t('accessibility.flipHorizontally')} tooltip="Flip Horizontally" onClick={flipHorizontally} fontSize={20} @@ -71,7 +73,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Flip Vertically" + aria-label={t('accessibility.flipVertically')} tooltip="Flip Vertically" onClick={flipVertically} fontSize={20} @@ -79,7 +81,7 @@ const ReactPanZoomButtons = ({ } - aria-label="Reset" + aria-label={t('accessibility.reset')} tooltip="Reset" onClick={() => { resetTransform(); diff --git a/invokeai/frontend/web/src/features/system/components/Console.tsx b/invokeai/frontend/web/src/features/system/components/Console.tsx index 562b339c59..226c96ea13 100644 --- a/invokeai/frontend/web/src/features/system/components/Console.tsx +++ b/invokeai/frontend/web/src/features/system/components/Console.tsx @@ -11,6 +11,7 @@ import { isEqual } from 'lodash'; import { Resizable } from 're-resizable'; import { useLayoutEffect, useRef, useState } from 'react'; import { useHotkeys } from 'react-hotkeys-hook'; +import { useTranslation } from 'react-i18next'; import { FaAngleDoubleDown, FaCode, FaMinus } from 'react-icons/fa'; import { systemSelector } from '../store/systemSelectors'; @@ -46,6 +47,7 @@ const consoleSelector = createSelector( */ const Console = () => { const dispatch = useAppDispatch(); + const { t } = useTranslation(); const log = useAppSelector(logSelector); const { shouldShowLogViewer, hasError, wasErrorSeen } = useAppSelector(consoleSelector); @@ -156,7 +158,7 @@ const Console = () => { > } onClick={() => setShouldAutoscroll(!shouldAutoscroll)} isChecked={shouldAutoscroll} @@ -175,7 +177,7 @@ const Console = () => { > : } onClick={handleClickLogViewerToggle} sx={{ diff --git a/invokeai/frontend/web/src/features/system/components/ModelManager/ModelListItem.tsx b/invokeai/frontend/web/src/features/system/components/ModelManager/ModelListItem.tsx index 9b2b6d29f4..6b9e4d1cfd 100644 --- a/invokeai/frontend/web/src/features/system/components/ModelManager/ModelListItem.tsx +++ b/invokeai/frontend/web/src/features/system/components/ModelManager/ModelListItem.tsx @@ -94,7 +94,7 @@ export default function ModelListItem(props: ModelListItemProps) { icon={} size="sm" onClick={openModelHandler} - aria-label="Modify Config" + aria-label={t('accessibility.modifyConfig')} isDisabled={status === 'active' || isProcessing || !isConnected} /> { + const { t } = useTranslation(); const dispatch = useAppDispatch(); const { shouldShowGalleryButton, shouldPinGallery } = useAppSelector(floatingSelector); @@ -21,7 +23,7 @@ const FloatingGalleryButton = () => { { const dispatch = useAppDispatch(); + const { t } = useTranslation(); const { shouldShowParametersPanelButton, shouldShowProcessButtons, @@ -95,7 +97,7 @@ const FloatingParametersPanelButtons = () => { From 28709961e9c38c37e58903bac49dba838b4cd6bf Mon Sep 17 00:00:00 2001 From: ElrikUnderlake Date: Fri, 10 Mar 2023 20:53:42 -0600 Subject: [PATCH 2/9] add import --- .../frontend/web/src/features/lightbox/components/Lightbox.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx b/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx index 5f792901aa..ebf7ac303a 100644 --- a/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx +++ b/invokeai/frontend/web/src/features/lightbox/components/Lightbox.tsx @@ -12,6 +12,7 @@ import { setIsLightboxOpen } from 'features/lightbox/store/lightboxSlice'; import { uiSelector } from 'features/ui/store/uiSelectors'; import { isEqual } from 'lodash'; import { useHotkeys } from 'react-hotkeys-hook'; +import { useTranslation } from 'react-i18next'; import { BiExit } from 'react-icons/bi'; import { TransformWrapper } from 'react-zoom-pan-pinch'; import useImageTransform from '../hooks/useImageTransform'; From d586a82a53c13a3d28a6c8442ade3654aa7a7b25 Mon Sep 17 00:00:00 2001 From: ElrikUnderlake Date: Fri, 10 Mar 2023 20:54:59 -0600 Subject: [PATCH 3/9] yarn build --- .../frontend/web/dist/assets/App-2afdb3c5.js | 188 ------------------ .../frontend/web/dist/assets/App-5c94d6ff.js | 188 ++++++++++++++++++ ...3dd.js => ThemeLocaleProvider-2a8c2f39.js} | 2 +- .../{index-61f10aa8.js => index-c5a5b67c.js} | 2 +- ...lbar-7e342734.js => scrollbar-af26543e.js} | 2 +- invokeai/frontend/web/dist/index.html | 2 +- invokeai/frontend/web/dist/locales/en.json | 20 +- invokeai/frontend/web/stats.html | 2 +- 8 files changed, 212 insertions(+), 194 deletions(-) delete mode 100644 invokeai/frontend/web/dist/assets/App-2afdb3c5.js create mode 100644 invokeai/frontend/web/dist/assets/App-5c94d6ff.js rename invokeai/frontend/web/dist/assets/{ThemeLocaleProvider-20e303dd.js => ThemeLocaleProvider-2a8c2f39.js} (99%) rename invokeai/frontend/web/dist/assets/{index-61f10aa8.js => index-c5a5b67c.js} (99%) rename invokeai/frontend/web/dist/assets/{scrollbar-7e342734.js => scrollbar-af26543e.js} (99%) diff --git a/invokeai/frontend/web/dist/assets/App-2afdb3c5.js b/invokeai/frontend/web/dist/assets/App-2afdb3c5.js deleted file mode 100644 index 1e07c56671..0000000000 --- a/invokeai/frontend/web/dist/assets/App-2afdb3c5.js +++ /dev/null @@ -1,188 +0,0 @@ -import{r as x,f as he,j as l,u as RS,c as re,a as Ae,b as Pe,w as is,d as fn,o as At,S as Qf,e as pi,g as Ye,h as Dr,k as Zi,i as yc,_ as Ql,l as NS,m as FS,R as ke,n as zv,p as LS,q as Kd,s as Ji,t as j1,v as E1,x as BS,y as HS,z as te,A as P1,B as I1,C as bc,D as os,F as B,E as Z,T as Ce,G as WS,H as Hl,I as Zl,J as Qd,K as Zd,L as Jd,U as VS,M as M1,N as T1,O as US,P as _1,Q as D1,V as $S,W as O1,X as A1,Y as Bi,Z as jn,$ as z1,a0 as as,a1 as GS,a2 as qS,a3 as R1,a4 as on,a5 as YS,a6 as vl,a7 as Sc,a8 as XS,a9 as Rv,aa as Fi,ab as KS,ac as QS,ad as Da,ae as gl,af as ZS,ag as JS,ah as eC,ai as tC,aj as nC,ak as N1,al as F1,am as ef,an as tf,ao as L1,ap as nf,aq as rf,ar as Nv,as as B1,at as H1,au as W1,av as Wl,aw as Vl,ax as rC,ay as of,az as V1,aA as iC,aB as dd,aC as Fv,aD as U1,aE as $1,aF as af,aG as Hi,aH as oC,aI as aC,aJ as Lv,aK as Bv,aL as sC,aM as lC,aN as cC,aO as G1,aP as q1,aQ as uC,aR as dC,aS as Hv,aT as fC,aU as Wv,aV as hC,aW as pC,aX as mC,aY as vC,aZ as gC,a_ as xC,a$ as yC,b0 as bC,b1 as Vv,b2 as Ul,b3 as SC,b4 as CC,b5 as qa,b6 as Jl,b7 as Y1,b8 as ec,b9 as wC,ba as kC,bb as xr,bc as X1,bd as Zf,be as ss,bf as jC,bg as EC,bh as PC,bi as Sr,bj as K1,bk as IC,bl as MC,bm as Q1,bn as TC,bo as _C,bp as DC,bq as OC,br as AC,bs as zC,bt as RC,bu as NC,bv as FC,bw as Uv,bx as LC,by as BC,bz as HC,bA as WC,bB as VC,bC as UC,bD as fd,bE as Na,bF as xl,bG as $v,bH as hd,bI as pd,bJ as yl,bK as Gv,bL as sf,bM as $C,bN as GC,bO as qC,bP as YC,bQ as XC,bR as KC,bS as QC,bT as bl,bU as md,bV as Sl,bW as nr,bX as ZC,bY as JC,bZ as Z1,b_ as tc,b$ as Jf,c0 as J1,c1 as e2,c2 as t2,c3 as e3,c4 as n2,c5 as r2,c6 as i2,c7 as o2,c8 as a2,c9 as Wo,ca as Vo,cb as s2,cc as l2,cd as c2,ce as u2,cf as d2,cg as t3,ch as n3,ci as qv,cj as Cl,ck as r3,cl as Yv,cm as Xv,cn as Kv,co as Qv,cp as vd,cq as f2,cr as i3,cs as ls,ct as Zv,cu as o3,cv as a3,cw as s3,cx as Wi,cy as h2,cz as Jv,cA as l3,cB as c3,cC as u3,cD as d3,cE as f3,cF as h3,cG as p3,cH as m3,cI as v3,cJ as g3,cK as x3,cL as y3}from"./index-61f10aa8.js";import{I as Jt,u as b3,c as S3,a as Et,b as Ut,A as ia,m as Wr,d as Uo,e as eo,P as eh,f as C3,C as w3,g as O,h as Y,n as p2}from"./scrollbar-7e342734.js";function th(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s=0)&&(n[i]=e[i]);return n}var nc="NOT_FOUND";function k3(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:nc},put:function(r,i){t={key:r,value:i}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function j3(e,t){var n=[];function r(u){var f=n.findIndex(function(p){return t(u,p.key)});if(f>-1){var h=n[f];return f>0&&(n.splice(f,1),n.unshift(h)),h.value}return nc}function i(u,f){r(u)===nc&&(n.unshift({key:u,value:f}),n.length>e&&n.pop())}function s(){return n}function c(){n=[]}return{get:r,put:i,getEntries:s,clear:c}}var E3=function(t,n){return t===n};function P3(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,s=0;s1?t-1:0),r=1;rperformance.now():()=>Date.now(),v2=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(O3()),m2);function A3(e){let t=[],n=[],r=0,i=!1,s=!1;const c=new WeakSet,u={schedule:(f,h=!1,p=!1)=>{const g=p&&i,y=g?t:n;return h&&c.add(f),y.indexOf(f)===-1&&(y.push(f),g&&i&&(r=t.length)),f},cancel:f=>{const h=n.indexOf(f);h!==-1&&n.splice(h,1),c.delete(f)},process:f=>{if(i){s=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let h=0;h(e[t]=A3(()=>Ya=!0),e),{}),R3=cs.reduce((e,t)=>{const n=Cc[t];return e[t]=(r,i=!1,s=!1)=>(Ya||L3(),n.schedule(r,i,s)),e},{}),N3=cs.reduce((e,t)=>(e[t]=Cc[t].cancel,e),{});cs.reduce((e,t)=>(e[t]=()=>Cc[t].process($o),e),{});const F3=e=>Cc[e].process($o),g2=e=>{Ya=!1,$o.delta=lf?m2:Math.max(Math.min(e-$o.timestamp,z3),1),$o.timestamp=e,cf=!0,cs.forEach(F3),cf=!1,Ya&&(lf=!1,v2(g2))},L3=()=>{Ya=!0,lf=!0,cf||v2(g2)},eg=()=>$o;function nh(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:i={}}=e,s=x.Children.toArray(e.path),c=he((u,f)=>l.jsx(Jt,{ref:f,viewBox:t,...i,...u,children:s.length?s:l.jsx("path",{fill:"currentColor",d:n})}));return c.displayName=r,c}function us(e){const{theme:t}=RS(),n=b3();return x.useMemo(()=>S3(t.direction,{...n,...e}),[e,t.direction,n])}var B3=Object.defineProperty,H3=(e,t,n)=>t in e?B3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rt=(e,t,n)=>(H3(e,typeof t!="symbol"?t+"":t,n),n);function tg(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var W3=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function ng(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function rg(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var uf=typeof window<"u"?x.useLayoutEffect:x.useEffect,rc=e=>e,V3=class{constructor(){Rt(this,"descendants",new Map),Rt(this,"register",e=>{if(e!=null)return W3(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Rt(this,"unregister",e=>{this.descendants.delete(e);const t=tg(Array.from(this.descendants.keys()));this.assignIndex(t)}),Rt(this,"destroy",()=>{this.descendants.clear()}),Rt(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Rt(this,"count",()=>this.descendants.size),Rt(this,"enabledCount",()=>this.enabledValues().length),Rt(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Rt(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Rt(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Rt(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Rt(this,"first",()=>this.item(0)),Rt(this,"firstEnabled",()=>this.enabledItem(0)),Rt(this,"last",()=>this.item(this.descendants.size-1)),Rt(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Rt(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Rt(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Rt(this,"next",(e,t=!0)=>{const n=ng(e,this.count(),t);return this.item(n)}),Rt(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),i=ng(r,this.enabledCount(),t);return this.enabledItem(i)}),Rt(this,"prev",(e,t=!0)=>{const n=rg(e,this.count()-1,t);return this.item(n)}),Rt(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),i=rg(r,this.enabledCount()-1,t);return this.enabledItem(i)}),Rt(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=tg(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const i={node:e,index:-1,...t};this.descendants.set(e,i),this.assignIndex(r)})}};function U3(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function ct(...e){return t=>{e.forEach(n=>{U3(n,t)})}}function $3(...e){return x.useMemo(()=>ct(...e),e)}function G3(){const e=x.useRef(new V3);return uf(()=>()=>e.current.destroy()),e.current}var[q3,x2]=Et({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function Y3(e){const t=x2(),[n,r]=x.useState(-1),i=x.useRef(null);uf(()=>()=>{i.current&&t.unregister(i.current)},[]),uf(()=>{if(!i.current)return;const c=Number(i.current.dataset.index);n!=c&&!Number.isNaN(c)&&r(c)});const s=rc(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(i.current),register:ct(s,i)}}function rh(){return[rc(q3),()=>rc(x2()),()=>G3(),i=>Y3(i)]}var[X3,wc]=Et({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[K3,ih]=Et({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[Q3,_F,Z3,J3]=rh(),zo=he(function(t,n){const{getButtonProps:r}=ih(),i=r(t,n),c={display:"flex",alignItems:"center",width:"100%",outline:0,...wc().button};return l.jsx(re.button,{...i,className:Ae("chakra-accordion__button",t.className),__css:c})});zo.displayName="AccordionButton";function oh(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:i=(y,S)=>y!==S}=e,s=Ut(r),c=Ut(i),[u,f]=x.useState(n),h=t!==void 0,p=h?t:u,g=Ut(y=>{const C=typeof y=="function"?y(p):y;c(p,C)&&(h||f(C),s(C))},[h,s,p,c]);return[p,g]}function ew(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:i,allowToggle:s,...c}=e;rw(e),iw(e);const u=Z3(),[f,h]=x.useState(-1);x.useEffect(()=>()=>{h(-1)},[]);const[p,g]=oh({value:r,defaultValue(){return i?n??[]:n??-1},onChange:t});return{index:p,setIndex:g,htmlProps:c,getAccordionItemProps:S=>{let C=!1;return S!==null&&(C=Array.isArray(p)?p.includes(S):p===S),{isOpen:C,onChange:k=>{if(S!==null)if(i&&Array.isArray(p)){const j=k?p.concat(S):p.filter(M=>M!==S);g(j)}else k?g(S):s&&g(-1)}}},focusedIndex:f,setFocusedIndex:h,descendants:u}}var[tw,ah]=Et({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function nw(e){const{isDisabled:t,isFocusable:n,id:r,...i}=e,{getAccordionItemProps:s,setFocusedIndex:c}=ah(),u=x.useRef(null),f=x.useId(),h=r??f,p=`accordion-button-${h}`,g=`accordion-panel-${h}`;ow(e);const{register:y,index:S,descendants:C}=J3({disabled:t&&!n}),{isOpen:w,onChange:k}=s(S===-1?null:S);aw({isOpen:w,isDisabled:t});const j=()=>{k==null||k(!0)},M=()=>{k==null||k(!1)},P=x.useCallback(()=>{k==null||k(!w),c(S)},[S,c,w,k]),I=x.useCallback(z=>{const F={ArrowDown:()=>{const L=C.nextEnabled(S);L==null||L.node.focus()},ArrowUp:()=>{const L=C.prevEnabled(S);L==null||L.node.focus()},Home:()=>{const L=C.firstEnabled();L==null||L.node.focus()},End:()=>{const L=C.lastEnabled();L==null||L.node.focus()}}[z.key];F&&(z.preventDefault(),F(z))},[C,S]),T=x.useCallback(()=>{c(S)},[c,S]),D=x.useCallback(function(V={},F=null){return{...V,type:"button",ref:ct(y,u,F),id:p,disabled:!!t,"aria-expanded":!!w,"aria-controls":g,onClick:Pe(V.onClick,P),onFocus:Pe(V.onFocus,T),onKeyDown:Pe(V.onKeyDown,I)}},[p,t,w,P,T,I,g,y]),_=x.useCallback(function(V={},F=null){return{...V,ref:F,role:"region",id:g,"aria-labelledby":p,hidden:!w}},[p,w,g]);return{isOpen:w,isDisabled:t,isFocusable:n,onOpen:j,onClose:M,getButtonProps:D,getPanelProps:_,htmlProps:i}}function rw(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;is({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function iw(e){is({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function ow(e){is({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. - `})}function aw(e){is({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Ro(e){const{isOpen:t,isDisabled:n}=ih(),{reduceMotion:r}=ah(),i=Ae("chakra-accordion__icon",e.className),s=wc(),c={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return l.jsx(Jt,{viewBox:"0 0 24 24","aria-hidden":!0,className:i,__css:c,...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Ro.displayName="AccordionIcon";var No=he(function(t,n){const{children:r,className:i}=t,{htmlProps:s,...c}=nw(t),f={...wc().container,overflowAnchor:"none"},h=x.useMemo(()=>c,[c]);return l.jsx(K3,{value:h,children:l.jsx(re.div,{ref:n,...s,className:Ae("chakra-accordion__item",i),__css:f,children:typeof r=="function"?r({isExpanded:!!c.isOpen,isDisabled:!!c.isDisabled}):r})})});No.displayName="AccordionItem";var Fo={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Vi={enter:{duration:.2,ease:Fo.easeOut},exit:{duration:.1,ease:Fo.easeIn}},Or={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},sw=e=>e!=null&&parseInt(e.toString(),10)>0,ig={exit:{height:{duration:.2,ease:Fo.ease},opacity:{duration:.3,ease:Fo.ease}},enter:{height:{duration:.3,ease:Fo.ease},opacity:{duration:.4,ease:Fo.ease}}},lw={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{...e&&{opacity:sw(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:Or.exit(ig.exit,i)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:Or.enter(ig.enter,i)}}},y2=x.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:i=!0,startingHeight:s=0,endingHeight:c="auto",style:u,className:f,transition:h,transitionEnd:p,...g}=e,[y,S]=x.useState(!1);x.useEffect(()=>{const M=setTimeout(()=>{S(!0)});return()=>clearTimeout(M)},[]),is({condition:Boolean(s>0&&r),message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const C=parseFloat(s.toString())>0,w={startingHeight:s,endingHeight:c,animateOpacity:i,transition:y?h:{enter:{duration:0}},transitionEnd:{enter:p==null?void 0:p.enter,exit:r?p==null?void 0:p.exit:{...p==null?void 0:p.exit,display:C?"block":"none"}}},k=r?n:!0,j=n||r?"enter":"exit";return l.jsx(ia,{initial:!1,custom:w,children:k&&l.jsx(Wr.div,{ref:t,...g,className:Ae("chakra-collapse",f),style:{overflow:"hidden",display:"block",...u},custom:w,variants:lw,initial:r?"exit":!1,animate:j,exit:"exit"})})});y2.displayName="Collapse";var cw={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:Or.enter(Vi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:Or.exit(Vi.exit,n),transitionEnd:t==null?void 0:t.exit}}},b2={initial:"exit",animate:"enter",exit:"exit",variants:cw},uw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:i,className:s,transition:c,transitionEnd:u,delay:f,...h}=t,p=i||r?"enter":"exit",g=r?i&&r:!0,y={transition:c,transitionEnd:u,delay:f};return l.jsx(ia,{custom:y,children:g&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-fade",s),custom:y,...b2,animate:p,...h})})});uw.displayName="Fade";var dw={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:Or.exit(Vi.exit,i)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:Or.enter(Vi.enter,n),transitionEnd:e==null?void 0:e.enter}}},S2={initial:"exit",animate:"enter",exit:"exit",variants:dw},fw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:i,reverse:s=!0,initialScale:c=.95,className:u,transition:f,transitionEnd:h,delay:p,...g}=t,y=r?i&&r:!0,S=i||r?"enter":"exit",C={initialScale:c,reverse:s,transition:f,transitionEnd:h,delay:p};return l.jsx(ia,{custom:C,children:y&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-offset-slide",u),...S2,animate:S,custom:C,...g})})});fw.displayName="ScaleFade";var hw={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:Or.exit(Vi.exit,i),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:Or.enter(Vi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:i,delay:s})=>{var c;const u={x:t,y:e};return{opacity:0,transition:(c=n==null?void 0:n.exit)!=null?c:Or.exit(Vi.exit,s),...i?{...u,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...u,...r==null?void 0:r.exit}}}}},df={initial:"initial",animate:"enter",exit:"exit",variants:hw},pw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:i,reverse:s=!0,className:c,offsetX:u=0,offsetY:f=8,transition:h,transitionEnd:p,delay:g,...y}=t,S=r?i&&r:!0,C=i||r?"enter":"exit",w={offsetX:u,offsetY:f,reverse:s,transition:h,transitionEnd:p,delay:g};return l.jsx(ia,{custom:w,children:S&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-offset-slide",c),custom:w,...df,animate:C,...y})})});pw.displayName="SlideFade";var Lo=he(function(t,n){const{className:r,motionProps:i,...s}=t,{reduceMotion:c}=ah(),{getPanelProps:u,isOpen:f}=ih(),h=u(s,n),p=Ae("chakra-accordion__panel",r),g=wc();c||delete h.hidden;const y=l.jsx(re.div,{...h,__css:g.panel,className:p});return c?y:l.jsx(y2,{in:f,...i,children:y})});Lo.displayName="AccordionPanel";var sh=he(function({children:t,reduceMotion:n,...r},i){const s=fn("Accordion",r),c=At(r),{htmlProps:u,descendants:f,...h}=ew(c),p=x.useMemo(()=>({...h,reduceMotion:!!n}),[h,n]);return l.jsx(Q3,{value:f,children:l.jsx(tw,{value:p,children:l.jsx(X3,{value:s,children:l.jsx(re.div,{ref:i,...u,className:Ae("chakra-accordion",r.className),__css:s.root,children:t})})})})});sh.displayName="Accordion";var ff=he(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:s,...c}=t;return l.jsx("img",{width:r,height:i,ref:n,alt:s,...c})});ff.displayName="NativeImage";function mw(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:s,crossOrigin:c,sizes:u,ignoreFallback:f}=e,[h,p]=x.useState("pending");x.useEffect(()=>{p(n?"loading":"pending")},[n]);const g=x.useRef(),y=x.useCallback(()=>{if(!n)return;S();const C=new Image;C.src=n,c&&(C.crossOrigin=c),r&&(C.srcset=r),u&&(C.sizes=u),t&&(C.loading=t),C.onload=w=>{S(),p("loaded"),i==null||i(w)},C.onerror=w=>{S(),p("failed"),s==null||s(w)},g.current=C},[n,c,r,u,i,s,t]),S=()=>{g.current&&(g.current.onload=null,g.current.onerror=null,g.current=null)};return Uo(()=>{if(!f)return h==="loading"&&y(),()=>{S()}},[h,y,f]),f?"loaded":h}var vw=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function gw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var ds=he(function(t,n){const{fallbackSrc:r,fallback:i,src:s,srcSet:c,align:u,fit:f,loading:h,ignoreFallback:p,crossOrigin:g,fallbackStrategy:y="beforeLoadOrError",referrerPolicy:S,...C}=t,w=r!==void 0||i!==void 0,k=h!=null||p||!w,j=mw({...t,ignoreFallback:k}),M=vw(j,y),P={ref:n,objectFit:f,objectPosition:u,...k?C:gw(C,["onError","onLoad"])};return M?i||l.jsx(re.img,{as:ff,className:"chakra-image__placeholder",src:r,...P}):l.jsx(re.img,{as:ff,src:s,srcSet:c,crossOrigin:g,loading:h,referrerPolicy:S,className:"chakra-image",...P})});ds.displayName="Image";function lh(e){return x.Children.toArray(e).filter(t=>x.isValidElement(t))}var[xw,yw]=Et({strict:!1,name:"ButtonGroupContext"}),bw={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},Sw={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},en=he(function(t,n){const{size:r,colorScheme:i,variant:s,className:c,spacing:u="0.5rem",isAttached:f,isDisabled:h,orientation:p="horizontal",...g}=t,y=Ae("chakra-button__group",c),S=x.useMemo(()=>({size:r,colorScheme:i,variant:s,isDisabled:h}),[r,i,s,h]);let C={display:"inline-flex",...f?bw[p]:Sw[p](u)};const w=p==="vertical";return l.jsx(xw,{value:S,children:l.jsx(re.div,{ref:n,role:"group",__css:C,className:y,"data-attached":f?"":void 0,"data-orientation":p,flexDir:w?"column":void 0,...g})})});en.displayName="ButtonGroup";function Cw(e){const[t,n]=x.useState(!e);return{ref:x.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function hf(e){const{children:t,className:n,...r}=e,i=x.isValidElement(t)?x.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ae("chakra-button__icon",n);return l.jsx(re.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:i})}hf.displayName="ButtonIcon";function ic(e){const{label:t,placement:n,spacing:r="0.5rem",children:i=l.jsx(Qf,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:c,...u}=e,f=Ae("chakra-button__spinner",s),h=n==="start"?"marginEnd":"marginStart",p=x.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[h]:t?r:0,fontSize:"1em",lineHeight:"normal",...c}),[c,t,h,r]);return l.jsx(re.div,{className:f,...u,__css:p,children:i})}ic.displayName="ButtonSpinner";var to=he((e,t)=>{const n=yw(),r=pi("Button",{...n,...e}),{isDisabled:i=n==null?void 0:n.isDisabled,isLoading:s,isActive:c,children:u,leftIcon:f,rightIcon:h,loadingText:p,iconSpacing:g="0.5rem",type:y,spinner:S,spinnerPlacement:C="start",className:w,as:k,...j}=At(e),M=x.useMemo(()=>{const D={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:D}}},[r,n]),{ref:P,type:I}=Cw(k),T={rightIcon:h,leftIcon:f,iconSpacing:g,children:u};return l.jsxs(re.button,{ref:$3(t,P),as:k,type:y??I,"data-active":Ye(c),"data-loading":Ye(s),__css:M,className:Ae("chakra-button",w),...j,disabled:i||s,children:[s&&C==="start"&&l.jsx(ic,{className:"chakra-button__spinner--start",label:p,placement:"start",spacing:g,children:S}),s?p||l.jsx(re.span,{opacity:0,children:l.jsx(og,{...T})}):l.jsx(og,{...T}),s&&C==="end"&&l.jsx(ic,{className:"chakra-button__spinner--end",label:p,placement:"end",spacing:g,children:S})]})});to.displayName="Button";function og(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:i}=e;return l.jsxs(l.Fragment,{children:[t&&l.jsx(hf,{marginEnd:i,children:t}),r,n&&l.jsx(hf,{marginStart:i,children:n})]})}var ci=he((e,t)=>{const{icon:n,children:r,isRound:i,"aria-label":s,...c}=e,u=n||r,f=x.isValidElement(u)?x.cloneElement(u,{"aria-hidden":!0,focusable:!1}):null;return l.jsx(to,{padding:"0",borderRadius:i?"full":void 0,ref:t,"aria-label":s,...c,children:f})});ci.displayName="IconButton";var[DF,ww]=Et({name:"CheckboxGroupContext",strict:!1});function kw(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:l.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function jw(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:l.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function Ew(e){const{isIndeterminate:t,isChecked:n,...r}=e,i=t?jw:kw;return n||t?l.jsx(re.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:l.jsx(i,{...r})}):null}var[Pw,C2]=Et({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Iw,no]=Et({strict:!1,name:"FormControlContext"});function Mw(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:i,isReadOnly:s,...c}=e,u=x.useId(),f=t||`field-${u}`,h=`${f}-label`,p=`${f}-feedback`,g=`${f}-helptext`,[y,S]=x.useState(!1),[C,w]=x.useState(!1),[k,j]=x.useState(!1),M=x.useCallback((_={},z=null)=>({id:g,..._,ref:ct(z,V=>{V&&w(!0)})}),[g]),P=x.useCallback((_={},z=null)=>{var V,F;return{..._,ref:z,"data-focus":Ye(k),"data-disabled":Ye(i),"data-invalid":Ye(r),"data-readonly":Ye(s),id:(V=_.id)!=null?V:h,htmlFor:(F=_.htmlFor)!=null?F:f}},[f,i,k,r,s,h]),I=x.useCallback((_={},z=null)=>({id:p,..._,ref:ct(z,V=>{V&&S(!0)}),"aria-live":"polite"}),[p]),T=x.useCallback((_={},z=null)=>({..._,...c,ref:z,role:"group"}),[c]),D=x.useCallback((_={},z=null)=>({..._,ref:z,role:"presentation","aria-hidden":!0,children:_.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!i,isFocused:!!k,onFocus:()=>j(!0),onBlur:()=>j(!1),hasFeedbackText:y,setHasFeedbackText:S,hasHelpText:C,setHasHelpText:w,id:f,labelId:h,feedbackId:p,helpTextId:g,htmlProps:c,getHelpTextProps:M,getErrorMessageProps:I,getRootProps:T,getLabelProps:P,getRequiredIndicatorProps:D}}var rt=he(function(t,n){const r=fn("Form",t),i=At(t),{getRootProps:s,htmlProps:c,...u}=Mw(i),f=Ae("chakra-form-control",t.className);return l.jsx(Iw,{value:u,children:l.jsx(Pw,{value:r,children:l.jsx(re.div,{...s({},n),className:f,__css:r.container})})})});rt.displayName="FormControl";var wt=he(function(t,n){const r=no(),i=C2(),s=Ae("chakra-form__helper-text",t.className);return l.jsx(re.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:i.helperText,className:s})});wt.displayName="FormHelperText";var[Tw,_w]=Et({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),kt=he((e,t)=>{const n=fn("FormError",e),r=At(e),i=no();return i!=null&&i.isInvalid?l.jsx(Tw,{value:n,children:l.jsx(re.div,{...i==null?void 0:i.getErrorMessageProps(r,t),className:Ae("chakra-form__error-message",e.className),__css:{display:"flex",alignItems:"center",...n.text}})}):null});kt.displayName="FormErrorMessage";var Dw=he((e,t)=>{const n=_w(),r=no();if(!(r!=null&&r.isInvalid))return null;const i=Ae("chakra-form__error-icon",e.className);return l.jsx(Jt,{ref:t,"aria-hidden":!0,...e,__css:n.icon,className:i,children:l.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})});Dw.displayName="FormErrorIcon";var st=he(function(t,n){var r;const i=pi("FormLabel",t),s=At(t),{className:c,children:u,requiredIndicator:f=l.jsx(w2,{}),optionalIndicator:h=null,...p}=s,g=no(),y=(r=g==null?void 0:g.getLabelProps(p,n))!=null?r:{ref:n,...p};return l.jsxs(re.label,{...y,className:Ae("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...i},children:[u,g!=null&&g.isRequired?f:h]})});st.displayName="FormLabel";var w2=he(function(t,n){const r=no(),i=C2();if(!(r!=null&&r.isRequired))return null;const s=Ae("chakra-form__required-indicator",t.className);return l.jsx(re.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:i.requiredIndicator,className:s})});w2.displayName="RequiredIndicator";function ch(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:i,...s}=uh(e);return{...s,disabled:t,readOnly:r,required:i,"aria-invalid":Dr(n),"aria-required":Dr(i),"aria-readonly":Dr(r)}}function uh(e){var t,n,r;const i=no(),{id:s,disabled:c,readOnly:u,required:f,isRequired:h,isInvalid:p,isReadOnly:g,isDisabled:y,onFocus:S,onBlur:C,...w}=e,k=e["aria-describedby"]?[e["aria-describedby"]]:[];return i!=null&&i.hasFeedbackText&&(i!=null&&i.isInvalid)&&k.push(i.feedbackId),i!=null&&i.hasHelpText&&k.push(i.helpTextId),{...w,"aria-describedby":k.join(" ")||void 0,id:s??(i==null?void 0:i.id),isDisabled:(t=c??y)!=null?t:i==null?void 0:i.isDisabled,isReadOnly:(n=u??g)!=null?n:i==null?void 0:i.isReadOnly,isRequired:(r=f??h)!=null?r:i==null?void 0:i.isRequired,isInvalid:p??(i==null?void 0:i.isInvalid),onFocus:Pe(i==null?void 0:i.onFocus,S),onBlur:Pe(i==null?void 0:i.onBlur,C)}}var dh={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},k2=re("span",{baseStyle:dh});k2.displayName="VisuallyHidden";var Ow=re("input",{baseStyle:dh});Ow.displayName="VisuallyHiddenInput";var ag=!1,fs=null,Yi=!1,pf=!1,mf=new Set;function fh(e,t){mf.forEach(n=>n(e,t))}var Aw=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function zw(e){return!(e.metaKey||!Aw&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function sg(e){Yi=!0,zw(e)&&(fs="keyboard",fh("keyboard",e))}function jo(e){if(fs="pointer",e.type==="mousedown"||e.type==="pointerdown"){Yi=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;fh("pointer",e)}}function Rw(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Nw(e){Rw(e)&&(Yi=!0,fs="virtual")}function Fw(e){e.target===window||e.target===document||(!Yi&&!pf&&(fs="virtual",fh("virtual",e)),Yi=!1,pf=!1)}function Lw(){Yi=!1,pf=!0}function lg(){return fs!=="pointer"}function Bw(){if(typeof window>"u"||ag)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Yi=!0,e.apply(this,n)},document.addEventListener("keydown",sg,!0),document.addEventListener("keyup",sg,!0),document.addEventListener("click",Nw,!0),window.addEventListener("focus",Fw,!0),window.addEventListener("blur",Lw,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",jo,!0),document.addEventListener("pointermove",jo,!0),document.addEventListener("pointerup",jo,!0)):(document.addEventListener("mousedown",jo,!0),document.addEventListener("mousemove",jo,!0),document.addEventListener("mouseup",jo,!0)),ag=!0}function j2(e){Bw(),e(lg());const t=()=>e(lg());return mf.add(t),()=>{mf.delete(t)}}function Hw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function E2(e={}){const t=uh(e),{isDisabled:n,isReadOnly:r,isRequired:i,isInvalid:s,id:c,onBlur:u,onFocus:f,"aria-describedby":h}=t,{defaultChecked:p,isChecked:g,isFocusable:y,onChange:S,isIndeterminate:C,name:w,value:k,tabIndex:j=void 0,"aria-label":M,"aria-labelledby":P,"aria-invalid":I,...T}=e,D=Hw(T,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),_=Ut(S),z=Ut(u),V=Ut(f),[F,L]=x.useState(!1),[X,$]=x.useState(!1),[Q,ie]=x.useState(!1),[oe,U]=x.useState(!1);x.useEffect(()=>j2(L),[]);const K=x.useRef(null),[ne,ce]=x.useState(!0),[Re,ze]=x.useState(!!p),Me=g!==void 0,J=Me?g:Re,ue=x.useCallback(ge=>{if(r||n){ge.preventDefault();return}Me||ze(J?ge.target.checked:C?!0:ge.target.checked),_==null||_(ge)},[r,n,J,Me,C,_]);Uo(()=>{K.current&&(K.current.indeterminate=Boolean(C))},[C]),eo(()=>{n&&$(!1)},[n,$]),Uo(()=>{const ge=K.current;ge!=null&&ge.form&&(ge.form.onreset=()=>{ze(!!p)})},[]);const Ie=n&&!y,Be=x.useCallback(ge=>{ge.key===" "&&U(!0)},[U]),Ne=x.useCallback(ge=>{ge.key===" "&&U(!1)},[U]);Uo(()=>{if(!K.current)return;K.current.checked!==J&&ze(K.current.checked)},[K.current]);const Ge=x.useCallback((ge={},Te=null)=>{const et=Ve=>{X&&Ve.preventDefault(),U(!0)};return{...ge,ref:Te,"data-active":Ye(oe),"data-hover":Ye(Q),"data-checked":Ye(J),"data-focus":Ye(X),"data-focus-visible":Ye(X&&F),"data-indeterminate":Ye(C),"data-disabled":Ye(n),"data-invalid":Ye(s),"data-readonly":Ye(r),"aria-hidden":!0,onMouseDown:Pe(ge.onMouseDown,et),onMouseUp:Pe(ge.onMouseUp,()=>U(!1)),onMouseEnter:Pe(ge.onMouseEnter,()=>ie(!0)),onMouseLeave:Pe(ge.onMouseLeave,()=>ie(!1))}},[oe,J,n,X,F,Q,C,s,r]),Qe=x.useCallback((ge={},Te=null)=>({...D,...ge,ref:ct(Te,et=>{et&&ce(et.tagName==="LABEL")}),onClick:Pe(ge.onClick,()=>{var et;ne||((et=K.current)==null||et.click(),requestAnimationFrame(()=>{var Ve;(Ve=K.current)==null||Ve.focus()}))}),"data-disabled":Ye(n),"data-checked":Ye(J),"data-invalid":Ye(s)}),[D,n,J,s,ne]),ve=x.useCallback((ge={},Te=null)=>({...ge,ref:ct(K,Te),type:"checkbox",name:w,value:k,id:c,tabIndex:j,onChange:Pe(ge.onChange,ue),onBlur:Pe(ge.onBlur,z,()=>$(!1)),onFocus:Pe(ge.onFocus,V,()=>$(!0)),onKeyDown:Pe(ge.onKeyDown,Be),onKeyUp:Pe(ge.onKeyUp,Ne),required:i,checked:J,disabled:Ie,readOnly:r,"aria-label":M,"aria-labelledby":P,"aria-invalid":I?Boolean(I):s,"aria-describedby":h,"aria-disabled":n,style:dh}),[w,k,c,ue,z,V,Be,Ne,i,J,Ie,r,M,P,I,s,h,n,j]),_e=x.useCallback((ge={},Te=null)=>({...ge,ref:Te,onMouseDown:Pe(ge.onMouseDown,cg),onTouchStart:Pe(ge.onTouchStart,cg),"data-disabled":Ye(n),"data-checked":Ye(J),"data-invalid":Ye(s)}),[J,n,s]);return{state:{isInvalid:s,isFocused:X,isChecked:J,isActive:oe,isHovered:Q,isIndeterminate:C,isDisabled:n,isReadOnly:r,isRequired:i},getRootProps:Qe,getCheckboxProps:Ge,getInputProps:ve,getLabelProps:_e,htmlProps:D}}function cg(e){e.preventDefault(),e.stopPropagation()}var Ww={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},Vw={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Uw=Zi({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),$w=Zi({from:{opacity:0},to:{opacity:1}}),Gw=Zi({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),P2=he(function(t,n){const r=ww(),i={...r,...t},s=fn("Checkbox",i),c=At(t),{spacing:u="0.5rem",className:f,children:h,iconColor:p,iconSize:g,icon:y=l.jsx(Ew,{}),isChecked:S,isDisabled:C=r==null?void 0:r.isDisabled,onChange:w,inputProps:k,...j}=c;let M=S;r!=null&&r.value&&c.value&&(M=r.value.includes(c.value));let P=w;r!=null&&r.onChange&&c.value&&(P=yc(r.onChange,w));const{state:I,getInputProps:T,getCheckboxProps:D,getLabelProps:_,getRootProps:z}=E2({...j,isDisabled:C,isChecked:M,onChange:P}),V=x.useMemo(()=>({animation:I.isIndeterminate?`${$w} 20ms linear, ${Gw} 200ms linear`:`${Uw} 200ms linear`,fontSize:g,color:p,...s.icon}),[p,g,,I.isIndeterminate,s.icon]),F=x.cloneElement(y,{__css:V,isIndeterminate:I.isIndeterminate,isChecked:I.isChecked});return l.jsxs(re.label,{__css:{...Vw,...s.container},className:Ae("chakra-checkbox",f),...z(),children:[l.jsx("input",{className:"chakra-checkbox__input",...T(k,n)}),l.jsx(re.span,{__css:{...Ww,...s.control},className:"chakra-checkbox__control",...D(),children:F}),h&&l.jsx(re.span,{className:"chakra-checkbox__label",..._(),__css:{marginStart:u,...s.label},children:h})]})});P2.displayName="Checkbox";function qw(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function hh(e,t){let n=qw(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function vf(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function ug(e,t,n){return(e-t)*100/(n-t)}function Yw(e,t,n){return(n-t)*e+t}function dg(e,t,n){const r=Math.round((e-t)/n)*n+t,i=vf(n);return hh(r,i)}function $l(e,t,n){return e==null?e:(n{var F;return r==null?"":(F=gd(r,s,n))!=null?F:""}),y=typeof i<"u",S=y?i:p,C=I2(ni(S),s),w=n??C,k=x.useCallback(F=>{F!==S&&(y||g(F.toString()),h==null||h(F.toString(),ni(F)))},[h,y,S]),j=x.useCallback(F=>{let L=F;return f&&(L=$l(L,c,u)),hh(L,w)},[w,f,u,c]),M=x.useCallback((F=s)=>{let L;S===""?L=ni(F):L=ni(S)+F,L=j(L),k(L)},[j,s,k,S]),P=x.useCallback((F=s)=>{let L;S===""?L=ni(-F):L=ni(S)-F,L=j(L),k(L)},[j,s,k,S]),I=x.useCallback(()=>{var F;let L;r==null?L="":L=(F=gd(r,s,n))!=null?F:c,k(L)},[r,n,s,k,c]),T=x.useCallback(F=>{var L;const X=(L=gd(F,s,w))!=null?L:c;k(X)},[w,s,k,c]),D=ni(S);return{isOutOfRange:D>u||D{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,i,r),()=>{s.removeEventListener(t,i,r)}},[t,e,r,i,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,i,r)}}function Kw(e){return"current"in e}var M2=()=>typeof window<"u";function Qw(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var Zw=e=>M2()&&e.test(navigator.vendor),Jw=e=>M2()&&e.test(Qw()),e5=()=>Jw(/mac|iphone|ipad|ipod/i),t5=()=>e5()&&Zw(/apple/i);function n5(e){const{ref:t,elements:n,enabled:r}=e,i=()=>{var s,c;return(c=(s=t.current)==null?void 0:s.ownerDocument)!=null?c:document};Ui(i,"pointerdown",s=>{if(!t5()||!r)return;const c=s.target,f=(n??[t]).some(h=>{const p=Kw(h)?h.current:h;return(p==null?void 0:p.contains(c))||p===c});i().activeElement!==c&&f&&(s.preventDefault(),c.focus())})}var lt={},r5={get exports(){return lt},set exports(e){lt=e}},i5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",o5=i5,a5=o5;function T2(){}function _2(){}_2.resetWarningCache=T2;var s5=function(){function e(r,i,s,c,u,f){if(f!==a5){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:_2,resetWarningCache:T2};return n.PropTypes=n,n};r5.exports=s5();var gf="data-focus-lock",D2="data-focus-lock-disabled",l5="data-no-focus-lock",c5="data-autofocus-inside",u5="data-no-autofocus";function d5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function f5(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}function O2(e,t){return f5(t||null,function(n){return e.forEach(function(r){return d5(r,n)})})}var xd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},vr=function(){return vr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r0&&s[s.length-1])&&(h[0]===6||h[0]===2)){n=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]0)&&!(i=r.next()).done;)s.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return s}function xf(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r=0}).sort(j5)},E5=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],xh=E5.join(","),P5="".concat(xh,", [data-focus-guard]"),Q2=function(e,t){return wr((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?P5:xh)?[r]:[],Q2(r))},[])},I5=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?kc([e.contentDocument.body],t):[e]},kc=function(e,t){return e.reduce(function(n,r){var i,s=Q2(r,t),c=(i=[]).concat.apply(i,s.map(function(u){return I5(u,t)}));return n.concat(c,r.parentNode?wr(r.parentNode.querySelectorAll(xh)).filter(function(u){return u===r}):[])},[])},M5=function(e){var t=e.querySelectorAll("[".concat(c5,"]"));return wr(t).map(function(n){return kc([n])}).reduce(function(n,r){return n.concat(r)},[])},yh=function(e,t){return wr(e).filter(function(n){return $2(t,n)}).filter(function(n){return C5(n)})},hg=function(e,t){return t===void 0&&(t=new Map),wr(e).filter(function(n){return G2(t,n)})},yf=function(e,t,n){return K2(yh(kc(e,n),t),!0,n)},pg=function(e,t){return K2(yh(kc(e),t),!1)},T5=function(e,t){return yh(M5(e),t)},Go=function(e,t){return e.shadowRoot?Go(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:wr(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var i=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return i?Go(i,t):!1}return Go(n,t)})},_5=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(i),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(c,u){return!t.has(u)})},Z2=function(e){return e.parentNode?Z2(e.parentNode):e},bh=function(e){var t=oc(e);return t.filter(Boolean).reduce(function(n,r){var i=r.getAttribute(gf);return n.push.apply(n,i?_5(wr(Z2(r).querySelectorAll("[".concat(gf,'="').concat(i,'"]:not([').concat(D2,'="disabled"])')))):[r]),n},[])},D5=function(e){try{return e()}catch{return}},Xa=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Xa(t.shadowRoot):t instanceof HTMLIFrameElement&&D5(function(){return t.contentWindow.document})?Xa(t.contentWindow.document):t}},O5=function(e,t){return e===t},A5=function(e,t){return Boolean(wr(e.querySelectorAll("iframe")).some(function(n){return O5(n,t)}))},J2=function(e,t){return t===void 0&&(t=Xa(W2(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:bh(e).some(function(n){return Go(n,t)||A5(n,t)})},z5=function(e){e===void 0&&(e=document);var t=Xa(e);return t?wr(e.querySelectorAll("[".concat(l5,"]"))).some(function(n){return Go(n,t)}):!1},R5=function(e,t){return t.filter(X2).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},Sh=function(e,t){return X2(e)&&e.name?R5(e,t):e},N5=function(e){var t=new Set;return e.forEach(function(n){return t.add(Sh(n,e))}),e.filter(function(n){return t.has(n)})},mg=function(e){return e[0]&&e.length>1?Sh(e[0],e):e[0]},vg=function(e,t){return e.length>1?e.indexOf(Sh(e[t],e)):t},ex="NEW_FOCUS",F5=function(e,t,n,r){var i=e.length,s=e[0],c=e[i-1],u=gh(n);if(!(n&&e.indexOf(n)>=0)){var f=n!==void 0?t.indexOf(n):-1,h=r?t.indexOf(r):f,p=r?e.indexOf(r):-1,g=f-h,y=t.indexOf(s),S=t.indexOf(c),C=N5(t),w=n!==void 0?C.indexOf(n):-1,k=w-(r?C.indexOf(r):f),j=vg(e,0),M=vg(e,i-1);if(f===-1||p===-1)return ex;if(!g&&p>=0)return p;if(f<=y&&u&&Math.abs(g)>1)return M;if(f>=S&&u&&Math.abs(g)>1)return j;if(g&&Math.abs(k)>1)return p;if(f<=y)return M;if(f>S)return j;if(g)return Math.abs(g)>1?p:(i+p+g)%i}},L5=function(e){return function(t){var n,r=(n=q2(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},B5=function(e,t,n){var r=e.map(function(s){var c=s.node;return c}),i=hg(r.filter(L5(n)));return i&&i.length?mg(i):mg(hg(t))},bf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&bf(e.parentNode.host||e.parentNode,t),t},yd=function(e,t){for(var n=bf(e),r=bf(t),i=0;i=0)return s}return!1},tx=function(e,t,n){var r=oc(e),i=oc(t),s=r[0],c=!1;return i.filter(Boolean).forEach(function(u){c=yd(c||u,u)||c,n.filter(Boolean).forEach(function(f){var h=yd(s,f);h&&(!c||Go(h,c)?c=h:c=yd(h,c))})}),c},H5=function(e,t){return e.reduce(function(n,r){return n.concat(T5(r,t))},[])},W5=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter(k5)},V5=function(e,t){var n=Xa(oc(e).length>0?document:W2(e).ownerDocument),r=bh(e).filter(ac),i=tx(n||e,e,r),s=new Map,c=pg(r,s),u=yf(r,s).filter(function(S){var C=S.node;return ac(C)});if(!(!u[0]&&(u=c,!u[0]))){var f=pg([i],s).map(function(S){var C=S.node;return C}),h=W5(f,u),p=h.map(function(S){var C=S.node;return C}),g=F5(p,f,n,t);if(g===ex){var y=B5(c,p,H5(r,s));if(y)return{node:y};console.warn("focus-lock: cannot find any node to move focus into");return}return g===void 0?g:h[g]}},U5=function(e){var t=bh(e).filter(ac),n=tx(e,e,t),r=new Map,i=yf([n],r,!0),s=yf(t,r).filter(function(c){var u=c.node;return ac(u)}).map(function(c){var u=c.node;return u});return i.map(function(c){var u=c.node,f=c.index;return{node:u,index:f,lockItem:s.indexOf(u)>=0,guard:gh(u)}})},$5=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},bd=0,Sd=!1,nx=function(e,t,n){n===void 0&&(n={});var r=V5(e,t);if(!Sd&&r){if(bd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Sd=!0,setTimeout(function(){Sd=!1},1);return}bd++,$5(r.node,n.focusOptions),bd--}};function rx(e){var t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var G5=function(){return document&&document.activeElement===document.body},q5=function(){return G5()||z5()},qo=null,Bo=null,Yo=null,Ka=!1,Y5=function(){return!0},X5=function(t){return(qo.whiteList||Y5)(t)},K5=function(t,n){Yo={observerNode:t,portaledElement:n}},Q5=function(t){return Yo&&Yo.portaledElement===t};function gg(e,t,n,r){var i=null,s=e;do{var c=r[s];if(c.guard)c.node.dataset.focusAutoGuard&&(i=c);else if(c.lockItem){if(s!==e)return;i=null}else break}while((s+=n)!==t);i&&(i.node.tabIndex=0)}var Z5=function(t){return t&&"current"in t?t.current:t},J5=function(t){return t?Boolean(Ka):Ka==="meanwhile"},e6=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},t6=function(t,n){return n.some(function(r){return e6(t,r,r)})},sc=function(){var t=!1;if(qo){var n=qo,r=n.observed,i=n.persistentFocus,s=n.autoFocus,c=n.shards,u=n.crossFrame,f=n.focusOptions,h=r||Yo&&Yo.portaledElement,p=document&&document.activeElement;if(h){var g=[h].concat(c.map(Z5).filter(Boolean));if((!p||X5(p))&&(i||J5(u)||!q5()||!Bo&&s)&&(h&&!(J2(g)||p&&t6(p,g)||Q5(p))&&(document&&!Bo&&p&&!s?(p.blur&&p.blur(),document.body.focus()):(t=nx(g,Bo,{focusOptions:f}),Yo={})),Ka=!1,Bo=document&&document.activeElement),document){var y=document&&document.activeElement,S=U5(g),C=S.map(function(w){var k=w.node;return k}).indexOf(y);C>-1&&(S.filter(function(w){var k=w.guard,j=w.node;return k&&j.dataset.focusAutoGuard}).forEach(function(w){var k=w.node;return k.removeAttribute("tabIndex")}),gg(C,S.length,1,S),gg(C,-1,-1,S))}}}return t},ix=function(t){sc()&&t&&(t.stopPropagation(),t.preventDefault())},Ch=function(){return rx(sc)},n6=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||K5(r,n)},r6=function(){return null},ox=function(){Ka="just",setTimeout(function(){Ka="meanwhile"},0)},i6=function(){document.addEventListener("focusin",ix),document.addEventListener("focusout",Ch),window.addEventListener("blur",ox)},o6=function(){document.removeEventListener("focusin",ix),document.removeEventListener("focusout",Ch),window.removeEventListener("blur",ox)};function a6(e){return e.filter(function(t){var n=t.disabled;return!n})}function s6(e){var t=e.slice(-1)[0];t&&!qo&&i6();var n=qo,r=n&&t&&t.id===n.id;qo=t,n&&!r&&(n.onDeactivation(),e.filter(function(i){var s=i.id;return s===n.id}).length||n.returnFocus(!t)),t?(Bo=null,(!r||n.observed!==t.observed)&&t.onActivation(),sc(),rx(sc)):(o6(),Bo=null)}L2.assignSyncMedium(n6);B2.assignMedium(Ch);p5.assignMedium(function(e){return e({moveFocusInside:nx,focusInside:J2})});const l6=g5(a6,s6)(r6);var ax=x.forwardRef(function(t,n){return x.createElement(H2,Ql({sideCar:l6,ref:n},t))}),sx=H2.propTypes||{};sx.sideCar;th(sx,["sideCar"]);ax.propTypes={};const xg=ax;function lx(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function cx(e){var t;if(!lx(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function c6(e){var t,n;return(n=(t=ux(e))==null?void 0:t.defaultView)!=null?n:window}function ux(e){return lx(e)?e.ownerDocument:document}function u6(e){return ux(e).activeElement}var dx=e=>e.hasAttribute("tabindex"),d6=e=>dx(e)&&e.tabIndex===-1;function f6(e){return Boolean(e.getAttribute("disabled"))===!0||Boolean(e.getAttribute("aria-disabled"))===!0}function fx(e){return e.parentElement&&fx(e.parentElement)?!0:e.hidden}function h6(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function hx(e){if(!cx(e)||fx(e)||f6(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():h6(e)?!0:dx(e)}function p6(e){return e?cx(e)&&hx(e)&&!d6(e):!1}var m6=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],v6=m6.join(),g6=e=>e.offsetWidth>0&&e.offsetHeight>0;function px(e){const t=Array.from(e.querySelectorAll(v6));return t.unshift(e),t.filter(n=>hx(n)&&g6(n))}var yg,x6=(yg=xg.default)!=null?yg:xg,mx=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:i,children:s,isDisabled:c,autoFocus:u,persistentFocus:f,lockFocusAcrossFrames:h}=e,p=x.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&px(r.current).length===0&&requestAnimationFrame(()=>{var C;(C=r.current)==null||C.focus()})},[t,r]),g=x.useCallback(()=>{var S;(S=n==null?void 0:n.current)==null||S.focus()},[n]),y=i&&!n;return l.jsx(x6,{crossFrame:h,persistentFocus:f,autoFocus:u,disabled:c,onActivation:p,onDeactivation:g,returnFocus:y,children:s})};mx.displayName="FocusLock";var y6=D3?x.useLayoutEffect:x.useEffect;function Sf(e,t=[]){const n=x.useRef(e);return y6(()=>{n.current=e}),x.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function b6(e,t,n,r){const i=Sf(t);return x.useEffect(()=>{var s;const c=(s=zv(n))!=null?s:document;if(t)return c.addEventListener(e,i,r),()=>{c.removeEventListener(e,i,r)}},[e,n,r,i,t]),()=>{var s;((s=zv(n))!=null?s:document).removeEventListener(e,i,r)}}function S6(e,t){const n=x.useId();return x.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function C6(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function ui(e={}){const{onClose:t,onOpen:n,isOpen:r,id:i}=e,s=Sf(n),c=Sf(t),[u,f]=x.useState(e.defaultIsOpen||!1),[h,p]=C6(r,u),g=S6(i,"disclosure"),y=x.useCallback(()=>{h||f(!1),c==null||c()},[h,c]),S=x.useCallback(()=>{h||f(!0),s==null||s()},[h,s]),C=x.useCallback(()=>{(p?y:S)()},[p,S,y]);return{isOpen:!!p,onOpen:S,onClose:y,onToggle:C,isControlled:h,getButtonProps:(w={})=>({...w,"aria-expanded":p,"aria-controls":g,onClick:LS(w.onClick,C)}),getDisclosureProps:(w={})=>({...w,hidden:!p,id:g})}}var wh=he(function(t,n){const{htmlSize:r,...i}=t,s=fn("Input",i),c=At(i),u=ch(c),f=Ae("chakra-input",t.className);return l.jsx(re.input,{size:r,...u,__css:s.field,ref:n,className:f})});wh.displayName="Input";wh.id="Input";var[w6,vx]=Et({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),kh=he(function(t,n){const r=fn("List",t),{children:i,styleType:s="none",stylePosition:c,spacing:u,...f}=At(t),h=lh(i),g=u?{["& > *:not(style) ~ *:not(style)"]:{mt:u}}:{};return l.jsx(w6,{value:r,children:l.jsx(re.ul,{ref:n,listStyleType:s,listStylePosition:c,role:"list",__css:{...r.container,...g},...f,children:h})})});kh.displayName="List";var k6=he((e,t)=>{const{as:n,...r}=e;return l.jsx(kh,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});k6.displayName="OrderedList";var gx=he(function(t,n){const{as:r,...i}=t;return l.jsx(kh,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...i})});gx.displayName="UnorderedList";var Fa=he(function(t,n){const r=vx();return l.jsx(re.li,{ref:n,...t,__css:r.item})});Fa.displayName="ListItem";var j6=he(function(t,n){const r=vx();return l.jsx(Jt,{ref:n,role:"presentation",...t,__css:r.icon})});j6.displayName="ListIcon";var $n=he(function(t,n){const{templateAreas:r,gap:i,rowGap:s,columnGap:c,column:u,row:f,autoFlow:h,autoRows:p,templateRows:g,autoColumns:y,templateColumns:S,...C}=t,w={display:"grid",gridTemplateAreas:r,gridGap:i,gridRowGap:s,gridColumnGap:c,gridAutoColumns:y,gridColumn:u,gridRow:f,gridAutoFlow:h,gridAutoRows:p,gridTemplateRows:g,gridTemplateColumns:S};return l.jsx(re.div,{ref:n,__css:w,...C})});$n.displayName="Grid";function xx(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Kd(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var jc=re("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});jc.displayName="Spacer";var yx=e=>l.jsx(re.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});yx.displayName="StackItem";var Cf="& > *:not(style) ~ *:not(style)";function E6(e){const{spacing:t,direction:n}=e,r={column:{marginTop:t,marginEnd:0,marginBottom:0,marginStart:0},row:{marginTop:0,marginEnd:0,marginBottom:0,marginStart:t},"column-reverse":{marginTop:0,marginEnd:0,marginBottom:t,marginStart:0},"row-reverse":{marginTop:0,marginEnd:t,marginBottom:0,marginStart:0}};return{flexDirection:n,[Cf]:xx(n,i=>r[i])}}function P6(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":xx(n,i=>r[i])}}var jh=he((e,t)=>{const{isInline:n,direction:r,align:i,justify:s,spacing:c="0.5rem",wrap:u,children:f,divider:h,className:p,shouldWrapChildren:g,...y}=e,S=n?"row":r??"column",C=x.useMemo(()=>E6({direction:S,spacing:c}),[S,c]),w=x.useMemo(()=>P6({spacing:c,direction:S}),[c,S]),k=!!h,j=!g&&!k,M=x.useMemo(()=>{const I=lh(f);return j?I:I.map((T,D)=>{const _=typeof T.key<"u"?T.key:D,z=D+1===I.length,F=g?l.jsx(yx,{children:T},_):T;if(!k)return F;const L=x.cloneElement(h,{__css:w}),X=z?null:L;return l.jsxs(x.Fragment,{children:[F,X]},_)})},[h,w,k,j,g,f]),P=Ae("chakra-stack",p);return l.jsx(re.div,{ref:t,display:"flex",alignItems:i,justifyContent:s,flexDirection:C.flexDirection,flexWrap:u,className:P,__css:k?{}:{[Cf]:C[Cf]},...y,children:M})});jh.displayName="Stack";var Le=he((e,t)=>l.jsx(jh,{align:"center",...e,direction:"column",ref:t}));Le.displayName="VStack";var sa=he((e,t)=>l.jsx(jh,{align:"center",...e,direction:"row",ref:t}));sa.displayName="HStack";var Vn=he(function(t,n){const r=pi("Heading",t),{className:i,...s}=At(t);return l.jsx(re.h2,{ref:n,className:Ae("chakra-heading",t.className),...s,__css:r})});Vn.displayName="Heading";var We=re("div");We.displayName="Box";var bx=he(function(t,n){const{size:r,centerContent:i=!0,...s}=t,c=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return l.jsx(We,{ref:n,boxSize:r,__css:{...c,flexShrink:0,flexGrow:0},...s})});bx.displayName="Square";var I6=he(function(t,n){const{size:r,...i}=t;return l.jsx(bx,{size:r,ref:n,borderRadius:"9999px",...i})});I6.displayName="Circle";var $i=he(function(t,n){const r=pi("Link",t),{className:i,isExternal:s,...c}=At(t);return l.jsx(re.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ae("chakra-link",i),...c,__css:r})});$i.displayName="Link";var Sx=he(function(t,n){const r=pi("Badge",t),{className:i,...s}=At(t);return l.jsx(re.span,{ref:n,className:Ae("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Sx.displayName="Badge";var Cx=re("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});Cx.displayName="Center";var M6={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};he(function(t,n){const{axis:r="both",...i}=t;return l.jsx(re.div,{ref:n,__css:M6[r],...i,position:"absolute"})});var wx=he(function(t,n){const{borderLeftWidth:r,borderBottomWidth:i,borderTopWidth:s,borderRightWidth:c,borderWidth:u,borderStyle:f,borderColor:h,...p}=pi("Divider",t),{className:g,orientation:y="horizontal",__css:S,...C}=At(t),w={vertical:{borderLeftWidth:r||c||u||"1px",height:"100%"},horizontal:{borderBottomWidth:i||s||u||"1px",width:"100%"}};return l.jsx(re.hr,{ref:n,"aria-orientation":y,...C,__css:{...p,border:"0",borderColor:h,borderStyle:f,...w[y],...S},className:Ae("chakra-divider",g)})});wx.displayName="Divider";function T6(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function _6(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,i]=x.useState([]),s=x.useRef(),c=()=>{s.current&&(clearTimeout(s.current),s.current=null)},u=()=>{c(),s.current=setTimeout(()=>{i([]),s.current=null},t)};x.useEffect(()=>c,[]);function f(h){return p=>{if(p.key==="Backspace"){const g=[...r];g.pop(),i(g);return}if(T6(p)){const g=r.concat(p.key);n(p)&&(p.preventDefault(),p.stopPropagation()),i(g),h(g.join("")),u()}}}return f}function D6(e,t,n,r){if(t==null)return r;if(!r)return e.find(c=>n(c).toLowerCase().startsWith(t.toLowerCase()));const i=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(i.length>0){let s;return i.includes(r)?(s=i.indexOf(r)+1,s===i.length&&(s=0),i[s]):(s=e.indexOf(i[0]),e[s])}return r}function O6(){const e=x.useRef(new Map),t=e.current,n=x.useCallback((i,s,c,u)=>{e.current.set(c,{type:s,el:i,options:u}),i.addEventListener(s,c,u)},[]),r=x.useCallback((i,s,c,u)=>{i.removeEventListener(s,c,u),e.current.delete(c)},[]);return x.useEffect(()=>()=>{t.forEach((i,s)=>{r(i.el,i.type,s,i.options)})},[r,t]),{add:n,remove:r}}function Cd(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function kx(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:i=!0,clickOnSpace:s=!0,onMouseDown:c,onMouseUp:u,onClick:f,onKeyDown:h,onKeyUp:p,tabIndex:g,onMouseOver:y,onMouseLeave:S,...C}=e,[w,k]=x.useState(!0),[j,M]=x.useState(!1),P=O6(),I=U=>{U&&U.tagName!=="BUTTON"&&k(!1)},T=w?g:g||0,D=n&&!r,_=x.useCallback(U=>{if(n){U.stopPropagation(),U.preventDefault();return}U.currentTarget.focus(),f==null||f(U)},[n,f]),z=x.useCallback(U=>{j&&Cd(U)&&(U.preventDefault(),U.stopPropagation(),M(!1),P.remove(document,"keyup",z,!1))},[j,P]),V=x.useCallback(U=>{if(h==null||h(U),n||U.defaultPrevented||U.metaKey||!Cd(U.nativeEvent)||w)return;const K=i&&U.key==="Enter";s&&U.key===" "&&(U.preventDefault(),M(!0)),K&&(U.preventDefault(),U.currentTarget.click()),P.add(document,"keyup",z,!1)},[n,w,h,i,s,P,z]),F=x.useCallback(U=>{if(p==null||p(U),n||U.defaultPrevented||U.metaKey||!Cd(U.nativeEvent)||w)return;s&&U.key===" "&&(U.preventDefault(),M(!1),U.currentTarget.click())},[s,w,n,p]),L=x.useCallback(U=>{U.button===0&&(M(!1),P.remove(document,"mouseup",L,!1))},[P]),X=x.useCallback(U=>{if(U.button!==0)return;if(n){U.stopPropagation(),U.preventDefault();return}w||M(!0),U.currentTarget.focus({preventScroll:!0}),P.add(document,"mouseup",L,!1),c==null||c(U)},[n,w,c,P,L]),$=x.useCallback(U=>{U.button===0&&(w||M(!1),u==null||u(U))},[u,w]),Q=x.useCallback(U=>{if(n){U.preventDefault();return}y==null||y(U)},[n,y]),ie=x.useCallback(U=>{j&&(U.preventDefault(),M(!1)),S==null||S(U)},[j,S]),oe=ct(t,I);return w?{...C,ref:oe,type:"button","aria-disabled":D?void 0:n,disabled:D,onClick:_,onMouseDown:c,onMouseUp:u,onKeyUp:p,onKeyDown:h,onMouseOver:y,onMouseLeave:S}:{...C,ref:oe,role:"button","data-active":Ye(j),"aria-disabled":n?"true":void 0,tabIndex:D?void 0:T,onClick:_,onMouseDown:X,onMouseUp:$,onKeyUp:F,onKeyDown:V,onMouseOver:Q,onMouseLeave:ie}}function A6(e){const t=e.current;if(!t)return!1;const n=u6(t);return!n||t.contains(n)?!1:!!p6(n)}function jx(e,t){const{shouldFocus:n,visible:r,focusRef:i}=t,s=n&&!r;eo(()=>{if(!s||A6(e))return;const c=(i==null?void 0:i.current)||e.current;c&&requestAnimationFrame(()=>{c.focus()})},[s,e,i])}var z6={preventScroll:!0,shouldFocus:!1};function R6(e,t=z6){const{focusRef:n,preventScroll:r,shouldFocus:i,visible:s}=t,c=N6(e)?e.current:e,u=i&&s,f=x.useRef(u),h=x.useRef(s);Uo(()=>{!h.current&&s&&(f.current=u),h.current=s},[s,u]);const p=x.useCallback(()=>{if(!(!s||!c||!f.current)&&(f.current=!1,!c.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var g;(g=n.current)==null||g.focus({preventScroll:r})});else{const g=px(c);g.length>0&&requestAnimationFrame(()=>{g[0].focus({preventScroll:r})})}},[s,r,c,n]);eo(()=>{p()},[p]),Ui(c,"transitionend",p)}function N6(e){return"current"in e}var Eo=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Vt={arrowShadowColor:Eo("--popper-arrow-shadow-color"),arrowSize:Eo("--popper-arrow-size","8px"),arrowSizeHalf:Eo("--popper-arrow-size-half"),arrowBg:Eo("--popper-arrow-bg"),transformOrigin:Eo("--popper-transform-origin"),arrowOffset:Eo("--popper-arrow-offset")};function F6(e){if(e.includes("top"))return"1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 1px 0 var(--popper-arrow-shadow-color)"}var L6={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},B6=e=>L6[e],bg={scroll:!0,resize:!0};function H6(e){let t;return typeof e=="object"?t={enabled:!0,options:{...bg,...e}}:t={enabled:e,options:bg},t}var W6={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},V6={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{Sg(e)},effect:({state:e})=>()=>{Sg(e)}},Sg=e=>{e.elements.popper.style.setProperty(Vt.transformOrigin.var,B6(e.placement))},U6={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{$6(e)}},$6=e=>{var t;if(!e.placement)return;const n=G6(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Vt.arrowSize.varRef,height:Vt.arrowSize.varRef,zIndex:-1});const r={[Vt.arrowSizeHalf.var]:`calc(${Vt.arrowSize.varRef} / 2)`,[Vt.arrowOffset.var]:`calc(${Vt.arrowSizeHalf.varRef} * -1)`};for(const i in r)e.elements.arrow.style.setProperty(i,r[i])}},G6=e=>{if(e.startsWith("top"))return{property:"bottom",value:Vt.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Vt.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Vt.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Vt.arrowOffset.varRef}},q6={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{Cg(e)},effect:({state:e})=>()=>{Cg(e)}},Cg=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=F6(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Vt.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},Y6={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},X6={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function K6(e,t="ltr"){var n,r;const i=((n=Y6[e])==null?void 0:n[t])||e;return t==="ltr"?i:(r=X6[e])!=null?r:i}var Pn="top",Gn="bottom",qn="right",In="left",Eh="auto",hs=[Pn,Gn,qn,In],Xo="start",Qa="end",Q6="clippingParents",Ex="viewport",Oa="popper",Z6="reference",wg=hs.reduce(function(e,t){return e.concat([t+"-"+Xo,t+"-"+Qa])},[]),Px=[].concat(hs,[Eh]).reduce(function(e,t){return e.concat([t,t+"-"+Xo,t+"-"+Qa])},[]),J6="beforeRead",ek="read",tk="afterRead",nk="beforeMain",rk="main",ik="afterMain",ok="beforeWrite",ak="write",sk="afterWrite",lk=[J6,ek,tk,nk,rk,ik,ok,ak,sk];function Cr(e){return e?(e.nodeName||"").toLowerCase():null}function Yn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Xi(e){var t=Yn(e).Element;return e instanceof t||e instanceof Element}function Un(e){var t=Yn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ph(e){if(typeof ShadowRoot>"u")return!1;var t=Yn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function ck(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},s=t.elements[n];!Un(s)||!Cr(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(c){var u=i[c];u===!1?s.removeAttribute(c):s.setAttribute(c,u===!0?"":u)}))})}function uk(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var i=t.elements[r],s=t.attributes[r]||{},c=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),u=c.reduce(function(f,h){return f[h]="",f},{});!Un(i)||!Cr(i)||(Object.assign(i.style,u),Object.keys(s).forEach(function(f){i.removeAttribute(f)}))})}}const dk={name:"applyStyles",enabled:!0,phase:"write",fn:ck,effect:uk,requires:["computeStyles"]};function yr(e){return e.split("-")[0]}var Gi=Math.max,lc=Math.min,Ko=Math.round;function wf(){var e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Ix(){return!/^((?!chrome|android).)*safari/i.test(wf())}function Qo(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,s=1;t&&Un(e)&&(i=e.offsetWidth>0&&Ko(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Ko(r.height)/e.offsetHeight||1);var c=Xi(e)?Yn(e):window,u=c.visualViewport,f=!Ix()&&n,h=(r.left+(f&&u?u.offsetLeft:0))/i,p=(r.top+(f&&u?u.offsetTop:0))/s,g=r.width/i,y=r.height/s;return{width:g,height:y,top:p,right:h+g,bottom:p+y,left:h,x:h,y:p}}function Ih(e){var t=Qo(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Mx(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ph(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Ar(e){return Yn(e).getComputedStyle(e)}function fk(e){return["table","td","th"].indexOf(Cr(e))>=0}function mi(e){return((Xi(e)?e.ownerDocument:e.document)||window.document).documentElement}function Ec(e){return Cr(e)==="html"?e:e.assignedSlot||e.parentNode||(Ph(e)?e.host:null)||mi(e)}function kg(e){return!Un(e)||Ar(e).position==="fixed"?null:e.offsetParent}function hk(e){var t=/firefox/i.test(wf()),n=/Trident/i.test(wf());if(n&&Un(e)){var r=Ar(e);if(r.position==="fixed")return null}var i=Ec(e);for(Ph(i)&&(i=i.host);Un(i)&&["html","body"].indexOf(Cr(i))<0;){var s=Ar(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function ps(e){for(var t=Yn(e),n=kg(e);n&&fk(n)&&Ar(n).position==="static";)n=kg(n);return n&&(Cr(n)==="html"||Cr(n)==="body"&&Ar(n).position==="static")?t:n||hk(e)||t}function Mh(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Ha(e,t,n){return Gi(e,lc(t,n))}function pk(e,t,n){var r=Ha(e,t,n);return r>n?n:r}function Tx(){return{top:0,right:0,bottom:0,left:0}}function _x(e){return Object.assign({},Tx(),e)}function Dx(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var mk=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,_x(typeof t!="number"?t:Dx(t,hs))};function vk(e){var t,n=e.state,r=e.name,i=e.options,s=n.elements.arrow,c=n.modifiersData.popperOffsets,u=yr(n.placement),f=Mh(u),h=[In,qn].indexOf(u)>=0,p=h?"height":"width";if(!(!s||!c)){var g=mk(i.padding,n),y=Ih(s),S=f==="y"?Pn:In,C=f==="y"?Gn:qn,w=n.rects.reference[p]+n.rects.reference[f]-c[f]-n.rects.popper[p],k=c[f]-n.rects.reference[f],j=ps(s),M=j?f==="y"?j.clientHeight||0:j.clientWidth||0:0,P=w/2-k/2,I=g[S],T=M-y[p]-g[C],D=M/2-y[p]/2+P,_=Ha(I,D,T),z=f;n.modifiersData[r]=(t={},t[z]=_,t.centerOffset=_-D,t)}}function gk(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||Mx(t.elements.popper,i)&&(t.elements.arrow=i))}const xk={name:"arrow",enabled:!0,phase:"main",fn:vk,effect:gk,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Zo(e){return e.split("-")[1]}var yk={top:"auto",right:"auto",bottom:"auto",left:"auto"};function bk(e){var t=e.x,n=e.y,r=window,i=r.devicePixelRatio||1;return{x:Ko(t*i)/i||0,y:Ko(n*i)/i||0}}function jg(e){var t,n=e.popper,r=e.popperRect,i=e.placement,s=e.variation,c=e.offsets,u=e.position,f=e.gpuAcceleration,h=e.adaptive,p=e.roundOffsets,g=e.isFixed,y=c.x,S=y===void 0?0:y,C=c.y,w=C===void 0?0:C,k=typeof p=="function"?p({x:S,y:w}):{x:S,y:w};S=k.x,w=k.y;var j=c.hasOwnProperty("x"),M=c.hasOwnProperty("y"),P=In,I=Pn,T=window;if(h){var D=ps(n),_="clientHeight",z="clientWidth";if(D===Yn(n)&&(D=mi(n),Ar(D).position!=="static"&&u==="absolute"&&(_="scrollHeight",z="scrollWidth")),D=D,i===Pn||(i===In||i===qn)&&s===Qa){I=Gn;var V=g&&D===T&&T.visualViewport?T.visualViewport.height:D[_];w-=V-r.height,w*=f?1:-1}if(i===In||(i===Pn||i===Gn)&&s===Qa){P=qn;var F=g&&D===T&&T.visualViewport?T.visualViewport.width:D[z];S-=F-r.width,S*=f?1:-1}}var L=Object.assign({position:u},h&&yk),X=p===!0?bk({x:S,y:w}):{x:S,y:w};if(S=X.x,w=X.y,f){var $;return Object.assign({},L,($={},$[I]=M?"0":"",$[P]=j?"0":"",$.transform=(T.devicePixelRatio||1)<=1?"translate("+S+"px, "+w+"px)":"translate3d("+S+"px, "+w+"px, 0)",$))}return Object.assign({},L,(t={},t[I]=M?w+"px":"",t[P]=j?S+"px":"",t.transform="",t))}function Sk(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,c=s===void 0?!0:s,u=n.roundOffsets,f=u===void 0?!0:u,h={placement:yr(t.placement),variation:Zo(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,jg(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:c,roundOffsets:f})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,jg(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Ck={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Sk,data:{}};var wl={passive:!0};function wk(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,s=i===void 0?!0:i,c=r.resize,u=c===void 0?!0:c,f=Yn(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&h.forEach(function(p){p.addEventListener("scroll",n.update,wl)}),u&&f.addEventListener("resize",n.update,wl),function(){s&&h.forEach(function(p){p.removeEventListener("scroll",n.update,wl)}),u&&f.removeEventListener("resize",n.update,wl)}}const kk={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:wk,data:{}};var jk={left:"right",right:"left",bottom:"top",top:"bottom"};function Gl(e){return e.replace(/left|right|bottom|top/g,function(t){return jk[t]})}var Ek={start:"end",end:"start"};function Eg(e){return e.replace(/start|end/g,function(t){return Ek[t]})}function Th(e){var t=Yn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function _h(e){return Qo(mi(e)).left+Th(e).scrollLeft}function Pk(e,t){var n=Yn(e),r=mi(e),i=n.visualViewport,s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(i){s=i.width,c=i.height;var h=Ix();(h||!h&&t==="fixed")&&(u=i.offsetLeft,f=i.offsetTop)}return{width:s,height:c,x:u+_h(e),y:f}}function Ik(e){var t,n=mi(e),r=Th(e),i=(t=e.ownerDocument)==null?void 0:t.body,s=Gi(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),c=Gi(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),u=-r.scrollLeft+_h(e),f=-r.scrollTop;return Ar(i||n).direction==="rtl"&&(u+=Gi(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:c,x:u,y:f}}function Dh(e){var t=Ar(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Ox(e){return["html","body","#document"].indexOf(Cr(e))>=0?e.ownerDocument.body:Un(e)&&Dh(e)?e:Ox(Ec(e))}function Wa(e,t){var n;t===void 0&&(t=[]);var r=Ox(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),s=Yn(r),c=i?[s].concat(s.visualViewport||[],Dh(r)?r:[]):r,u=t.concat(c);return i?u:u.concat(Wa(Ec(c)))}function kf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Mk(e,t){var n=Qo(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function Pg(e,t,n){return t===Ex?kf(Pk(e,n)):Xi(t)?Mk(t,n):kf(Ik(mi(e)))}function Tk(e){var t=Wa(Ec(e)),n=["absolute","fixed"].indexOf(Ar(e).position)>=0,r=n&&Un(e)?ps(e):e;return Xi(r)?t.filter(function(i){return Xi(i)&&Mx(i,r)&&Cr(i)!=="body"}):[]}function _k(e,t,n,r){var i=t==="clippingParents"?Tk(e):[].concat(t),s=[].concat(i,[n]),c=s[0],u=s.reduce(function(f,h){var p=Pg(e,h,r);return f.top=Gi(p.top,f.top),f.right=lc(p.right,f.right),f.bottom=lc(p.bottom,f.bottom),f.left=Gi(p.left,f.left),f},Pg(e,c,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function Ax(e){var t=e.reference,n=e.element,r=e.placement,i=r?yr(r):null,s=r?Zo(r):null,c=t.x+t.width/2-n.width/2,u=t.y+t.height/2-n.height/2,f;switch(i){case Pn:f={x:c,y:t.y-n.height};break;case Gn:f={x:c,y:t.y+t.height};break;case qn:f={x:t.x+t.width,y:u};break;case In:f={x:t.x-n.width,y:u};break;default:f={x:t.x,y:t.y}}var h=i?Mh(i):null;if(h!=null){var p=h==="y"?"height":"width";switch(s){case Xo:f[h]=f[h]-(t[p]/2-n[p]/2);break;case Qa:f[h]=f[h]+(t[p]/2-n[p]/2);break}}return f}function Za(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,s=n.strategy,c=s===void 0?e.strategy:s,u=n.boundary,f=u===void 0?Q6:u,h=n.rootBoundary,p=h===void 0?Ex:h,g=n.elementContext,y=g===void 0?Oa:g,S=n.altBoundary,C=S===void 0?!1:S,w=n.padding,k=w===void 0?0:w,j=_x(typeof k!="number"?k:Dx(k,hs)),M=y===Oa?Z6:Oa,P=e.rects.popper,I=e.elements[C?M:y],T=_k(Xi(I)?I:I.contextElement||mi(e.elements.popper),f,p,c),D=Qo(e.elements.reference),_=Ax({reference:D,element:P,strategy:"absolute",placement:i}),z=kf(Object.assign({},P,_)),V=y===Oa?z:D,F={top:T.top-V.top+j.top,bottom:V.bottom-T.bottom+j.bottom,left:T.left-V.left+j.left,right:V.right-T.right+j.right},L=e.modifiersData.offset;if(y===Oa&&L){var X=L[i];Object.keys(F).forEach(function($){var Q=[qn,Gn].indexOf($)>=0?1:-1,ie=[Pn,Gn].indexOf($)>=0?"y":"x";F[$]+=X[ie]*Q})}return F}function Dk(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,s=n.rootBoundary,c=n.padding,u=n.flipVariations,f=n.allowedAutoPlacements,h=f===void 0?Px:f,p=Zo(r),g=p?u?wg:wg.filter(function(C){return Zo(C)===p}):hs,y=g.filter(function(C){return h.indexOf(C)>=0});y.length===0&&(y=g);var S=y.reduce(function(C,w){return C[w]=Za(e,{placement:w,boundary:i,rootBoundary:s,padding:c})[yr(w)],C},{});return Object.keys(S).sort(function(C,w){return S[C]-S[w]})}function Ok(e){if(yr(e)===Eh)return[];var t=Gl(e);return[Eg(e),t,Eg(t)]}function Ak(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,c=n.altAxis,u=c===void 0?!0:c,f=n.fallbackPlacements,h=n.padding,p=n.boundary,g=n.rootBoundary,y=n.altBoundary,S=n.flipVariations,C=S===void 0?!0:S,w=n.allowedAutoPlacements,k=t.options.placement,j=yr(k),M=j===k,P=f||(M||!C?[Gl(k)]:Ok(k)),I=[k].concat(P).reduce(function(J,ue){return J.concat(yr(ue)===Eh?Dk(t,{placement:ue,boundary:p,rootBoundary:g,padding:h,flipVariations:C,allowedAutoPlacements:w}):ue)},[]),T=t.rects.reference,D=t.rects.popper,_=new Map,z=!0,V=I[0],F=0;F=0,ie=Q?"width":"height",oe=Za(t,{placement:L,boundary:p,rootBoundary:g,altBoundary:y,padding:h}),U=Q?$?qn:In:$?Gn:Pn;T[ie]>D[ie]&&(U=Gl(U));var K=Gl(U),ne=[];if(s&&ne.push(oe[X]<=0),u&&ne.push(oe[U]<=0,oe[K]<=0),ne.every(function(J){return J})){V=L,z=!1;break}_.set(L,ne)}if(z)for(var ce=C?3:1,Re=function(ue){var Ie=I.find(function(Be){var Ne=_.get(Be);if(Ne)return Ne.slice(0,ue).every(function(Ge){return Ge})});if(Ie)return V=Ie,"break"},ze=ce;ze>0;ze--){var Me=Re(ze);if(Me==="break")break}t.placement!==V&&(t.modifiersData[r]._skip=!0,t.placement=V,t.reset=!0)}}const zk={name:"flip",enabled:!0,phase:"main",fn:Ak,requiresIfExists:["offset"],data:{_skip:!1}};function Ig(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Mg(e){return[Pn,qn,Gn,In].some(function(t){return e[t]>=0})}function Rk(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,s=t.modifiersData.preventOverflow,c=Za(t,{elementContext:"reference"}),u=Za(t,{altBoundary:!0}),f=Ig(c,r),h=Ig(u,i,s),p=Mg(f),g=Mg(h);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:h,isReferenceHidden:p,hasPopperEscaped:g},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":g})}const Nk={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Rk};function Fk(e,t,n){var r=yr(e),i=[In,Pn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,c=s[0],u=s[1];return c=c||0,u=(u||0)*i,[In,qn].indexOf(r)>=0?{x:u,y:c}:{x:c,y:u}}function Lk(e){var t=e.state,n=e.options,r=e.name,i=n.offset,s=i===void 0?[0,0]:i,c=Px.reduce(function(p,g){return p[g]=Fk(g,t.rects,s),p},{}),u=c[t.placement],f=u.x,h=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=h),t.modifiersData[r]=c}const Bk={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Lk};function Hk(e){var t=e.state,n=e.name;t.modifiersData[n]=Ax({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Wk={name:"popperOffsets",enabled:!0,phase:"read",fn:Hk,data:{}};function Vk(e){return e==="x"?"y":"x"}function Uk(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,s=i===void 0?!0:i,c=n.altAxis,u=c===void 0?!1:c,f=n.boundary,h=n.rootBoundary,p=n.altBoundary,g=n.padding,y=n.tether,S=y===void 0?!0:y,C=n.tetherOffset,w=C===void 0?0:C,k=Za(t,{boundary:f,rootBoundary:h,padding:g,altBoundary:p}),j=yr(t.placement),M=Zo(t.placement),P=!M,I=Mh(j),T=Vk(I),D=t.modifiersData.popperOffsets,_=t.rects.reference,z=t.rects.popper,V=typeof w=="function"?w(Object.assign({},t.rects,{placement:t.placement})):w,F=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,X={x:0,y:0};if(D){if(s){var $,Q=I==="y"?Pn:In,ie=I==="y"?Gn:qn,oe=I==="y"?"height":"width",U=D[I],K=U+k[Q],ne=U-k[ie],ce=S?-z[oe]/2:0,Re=M===Xo?_[oe]:z[oe],ze=M===Xo?-z[oe]:-_[oe],Me=t.elements.arrow,J=S&&Me?Ih(Me):{width:0,height:0},ue=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Tx(),Ie=ue[Q],Be=ue[ie],Ne=Ha(0,_[oe],J[oe]),Ge=P?_[oe]/2-ce-Ne-Ie-F.mainAxis:Re-Ne-Ie-F.mainAxis,Qe=P?-_[oe]/2+ce+Ne+Be+F.mainAxis:ze+Ne+Be+F.mainAxis,ve=t.elements.arrow&&ps(t.elements.arrow),_e=ve?I==="y"?ve.clientTop||0:ve.clientLeft||0:0,qe=($=L==null?void 0:L[I])!=null?$:0,ge=U+Ge-qe-_e,Te=U+Qe-qe,et=Ha(S?lc(K,ge):K,U,S?Gi(ne,Te):ne);D[I]=et,X[I]=et-U}if(u){var Ve,vt=I==="x"?Pn:In,Nt=I==="x"?Gn:qn,N=D[T],de=T==="y"?"height":"width",xe=N+k[vt],je=N-k[Nt],q=[Pn,In].indexOf(j)!==-1,se=(Ve=L==null?void 0:L[T])!=null?Ve:0,Fe=q?xe:N-_[de]-z[de]-se+F.altAxis,Ze=q?N+_[de]+z[de]-se-F.altAxis:je,ee=S&&q?pk(Fe,N,Ze):Ha(S?Fe:xe,N,S?Ze:je);D[T]=ee,X[T]=ee-N}t.modifiersData[r]=X}}const $k={name:"preventOverflow",enabled:!0,phase:"main",fn:Uk,requiresIfExists:["offset"]};function Gk(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function qk(e){return e===Yn(e)||!Un(e)?Th(e):Gk(e)}function Yk(e){var t=e.getBoundingClientRect(),n=Ko(t.width)/e.offsetWidth||1,r=Ko(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Xk(e,t,n){n===void 0&&(n=!1);var r=Un(t),i=Un(t)&&Yk(t),s=mi(t),c=Qo(e,i,n),u={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(r||!r&&!n)&&((Cr(t)!=="body"||Dh(s))&&(u=qk(t)),Un(t)?(f=Qo(t,!0),f.x+=t.clientLeft,f.y+=t.clientTop):s&&(f.x=_h(s))),{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function Kk(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function i(s){n.add(s.name);var c=[].concat(s.requires||[],s.requiresIfExists||[]);c.forEach(function(u){if(!n.has(u)){var f=t.get(u);f&&i(f)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||i(s)}),r}function Qk(e){var t=Kk(e);return lk.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function Zk(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Jk(e){var t=e.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Tg={placement:"bottom",modifiers:[],strategy:"absolute"};function _g(){for(var e=arguments.length,t=new Array(e),n=0;n{}),P=x.useCallback(()=>{var F;!t||!C.current||!w.current||((F=M.current)==null||F.call(M),k.current=nj(C.current,w.current,{placement:j,modifiers:[q6,U6,V6,{...W6,enabled:!!y},{name:"eventListeners",...H6(c)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:u??[0,f]}},{name:"flip",enabled:!!h,options:{padding:8}},{name:"preventOverflow",enabled:!!g,options:{boundary:p}},...n??[]],strategy:i}),k.current.forceUpdate(),M.current=k.current.destroy)},[j,t,n,y,c,s,u,f,h,g,p,i]);x.useEffect(()=>()=>{var F;!C.current&&!w.current&&((F=k.current)==null||F.destroy(),k.current=null)},[]);const I=x.useCallback(F=>{C.current=F,P()},[P]),T=x.useCallback((F={},L=null)=>({...F,ref:ct(I,L)}),[I]),D=x.useCallback(F=>{w.current=F,P()},[P]),_=x.useCallback((F={},L=null)=>({...F,ref:ct(D,L),style:{...F.style,position:i,minWidth:y?void 0:"max-content",inset:"0 auto auto 0"}}),[i,D,y]),z=x.useCallback((F={},L=null)=>{const{size:X,shadowColor:$,bg:Q,style:ie,...oe}=F;return{...oe,ref:L,"data-popper-arrow":"",style:rj(F)}},[]),V=x.useCallback((F={},L=null)=>({...F,ref:L,"data-popper-arrow-inner":""}),[]);return{update(){var F;(F=k.current)==null||F.update()},forceUpdate(){var F;(F=k.current)==null||F.forceUpdate()},transformOrigin:Vt.transformOrigin.varRef,referenceRef:I,popperRef:D,getPopperProps:_,getArrowProps:z,getArrowInnerProps:V,getReferenceProps:T}}function rj(e){const{size:t,shadowColor:n,bg:r,style:i}=e,s={...i,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Ah(e={}){const{onClose:t,onOpen:n,isOpen:r,id:i}=e,s=Ut(n),c=Ut(t),[u,f]=x.useState(e.defaultIsOpen||!1),h=r!==void 0?r:u,p=r!==void 0,g=x.useId(),y=i??`disclosure-${g}`,S=x.useCallback(()=>{p||f(!1),c==null||c()},[p,c]),C=x.useCallback(()=>{p||f(!0),s==null||s()},[p,s]),w=x.useCallback(()=>{h?S():C()},[h,C,S]);function k(M={}){return{...M,"aria-expanded":h,"aria-controls":y,onClick(P){var I;(I=M.onClick)==null||I.call(M,P),w()}}}function j(M={}){return{...M,hidden:!h,id:y}}return{isOpen:h,onOpen:C,onClose:S,onToggle:w,isControlled:p,getButtonProps:k,getDisclosureProps:j}}function ij(e){const{ref:t,handler:n,enabled:r=!0}=e,i=Ut(n),c=x.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;x.useEffect(()=>{if(!r)return;const u=g=>{wd(g,t)&&(c.isPointerDown=!0)},f=g=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&wd(g,t)&&(c.isPointerDown=!1,i(g))},h=g=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&wd(g,t)&&(c.isPointerDown=!1,i(g))},p=zx(t.current);return p.addEventListener("mousedown",u,!0),p.addEventListener("mouseup",f,!0),p.addEventListener("touchstart",u,!0),p.addEventListener("touchend",h,!0),()=>{p.removeEventListener("mousedown",u,!0),p.removeEventListener("mouseup",f,!0),p.removeEventListener("touchstart",u,!0),p.removeEventListener("touchend",h,!0)}},[n,t,i,c,r])}function wd(e,t){var n;const r=e.target;return e.button>0||r&&!zx(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function zx(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Rx(e){const{isOpen:t,ref:n}=e,[r,i]=x.useState(t),[s,c]=x.useState(!1);return x.useEffect(()=>{s||(i(t),c(!0))},[t,s,r]),Ui(()=>n.current,"animationend",()=>{i(t)}),{present:!(t?!1:!r),onComplete(){var f;const h=c6(n.current),p=new h.CustomEvent("animationend",{bubbles:!0});(f=n.current)==null||f.dispatchEvent(p)}}}function zh(e){const{wasSelected:t,enabled:n,isSelected:r,mode:i="unmount"}=e;return!!(!n||r||i==="keepMounted"&&t)}var[oj,aj,sj,lj]=rh(),[cj,ms]=Et({strict:!1,name:"MenuContext"});function uj(e,...t){const n=x.useId(),r=e||n;return x.useMemo(()=>t.map(i=>`${i}-${r}`),[r,t])}function Nx(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Dg(e){return Nx(e).activeElement===e}function dj(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:i,autoSelect:s=!0,isLazy:c,isOpen:u,defaultIsOpen:f,onClose:h,onOpen:p,placement:g="bottom-start",lazyBehavior:y="unmount",direction:S,computePositionOnMount:C=!1,...w}=e,k=x.useRef(null),j=x.useRef(null),M=sj(),P=x.useCallback(()=>{requestAnimationFrame(()=>{var Me;(Me=k.current)==null||Me.focus({preventScroll:!1})})},[]),I=x.useCallback(()=>{const Me=setTimeout(()=>{var J;if(i)(J=i.current)==null||J.focus();else{const ue=M.firstEnabled();ue&&$(ue.index)}});K.current.add(Me)},[M,i]),T=x.useCallback(()=>{const Me=setTimeout(()=>{const J=M.lastEnabled();J&&$(J.index)});K.current.add(Me)},[M]),D=x.useCallback(()=>{p==null||p(),s?I():P()},[s,I,P,p]),{isOpen:_,onOpen:z,onClose:V,onToggle:F}=Ah({isOpen:u,defaultIsOpen:f,onClose:h,onOpen:D});ij({enabled:_&&r,ref:k,handler:Me=>{var J;(J=j.current)!=null&&J.contains(Me.target)||V()}});const L=Oh({...w,enabled:_||C,placement:g,direction:S}),[X,$]=x.useState(-1);eo(()=>{_||$(-1)},[_]),jx(k,{focusRef:j,visible:_,shouldFocus:!0});const Q=Rx({isOpen:_,ref:k}),[ie,oe]=uj(t,"menu-button","menu-list"),U=x.useCallback(()=>{z(),P()},[z,P]),K=x.useRef(new Set([]));xj(()=>{K.current.forEach(Me=>clearTimeout(Me)),K.current.clear()});const ne=x.useCallback(()=>{z(),I()},[I,z]),ce=x.useCallback(()=>{z(),T()},[z,T]),Re=x.useCallback(()=>{var Me,J;const ue=Nx(k.current),Ie=(Me=k.current)==null?void 0:Me.contains(ue.activeElement);if(!(_&&!Ie))return;const Ne=(J=M.item(X))==null?void 0:J.node;Ne==null||Ne.focus()},[_,X,M]),ze=x.useRef(null);return{openAndFocusMenu:U,openAndFocusFirstItem:ne,openAndFocusLastItem:ce,onTransitionEnd:Re,unstable__animationState:Q,descendants:M,popper:L,buttonId:ie,menuId:oe,forceUpdate:L.forceUpdate,orientation:"vertical",isOpen:_,onToggle:F,onOpen:z,onClose:V,menuRef:k,buttonRef:j,focusedIndex:X,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:$,isLazy:c,lazyBehavior:y,initialFocusRef:i,rafId:ze}}function fj(e={},t=null){const n=ms(),{onToggle:r,popper:i,openAndFocusFirstItem:s,openAndFocusLastItem:c}=n,u=x.useCallback(f=>{const h=f.key,g={Enter:s,ArrowDown:s,ArrowUp:c}[h];g&&(f.preventDefault(),f.stopPropagation(),g(f))},[s,c]);return{...e,ref:ct(n.buttonRef,t,i.referenceRef),id:n.buttonId,"data-active":Ye(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:Pe(e.onClick,r),onKeyDown:Pe(e.onKeyDown,u)}}function jf(e){var t;return vj(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function hj(e={},t=null){const n=ms();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:i,menuRef:s,isOpen:c,onClose:u,menuId:f,isLazy:h,lazyBehavior:p,unstable__animationState:g}=n,y=aj(),S=_6({preventDefault:j=>j.key!==" "&&jf(j.target)}),C=x.useCallback(j=>{const M=j.key,I={Tab:D=>D.preventDefault(),Escape:u,ArrowDown:()=>{const D=y.nextEnabled(r);D&&i(D.index)},ArrowUp:()=>{const D=y.prevEnabled(r);D&&i(D.index)}}[M];if(I){j.preventDefault(),I(j);return}const T=S(D=>{const _=D6(y.values(),D,z=>{var V,F;return(F=(V=z==null?void 0:z.node)==null?void 0:V.textContent)!=null?F:""},y.item(r));if(_){const z=y.indexOf(_.node);i(z)}});jf(j.target)&&T(j)},[y,r,S,u,i]),w=x.useRef(!1);c&&(w.current=!0);const k=zh({wasSelected:w.current,enabled:h,mode:p,isSelected:g.present});return{...e,ref:ct(s,t),children:k?e.children:null,tabIndex:-1,role:"menu",id:f,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Pe(e.onKeyDown,C)}}function pj(e={}){const{popper:t,isOpen:n}=ms();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function mj(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onClick:s,onFocus:c,isDisabled:u,isFocusable:f,closeOnSelect:h,type:p,...g}=e,y=ms(),{setFocusedIndex:S,focusedIndex:C,closeOnSelect:w,onClose:k,menuRef:j,isOpen:M,menuId:P,rafId:I}=y,T=x.useRef(null),D=`${P}-menuitem-${x.useId()}`,{index:_,register:z}=lj({disabled:u&&!f}),V=x.useCallback(U=>{n==null||n(U),!u&&S(_)},[S,_,u,n]),F=x.useCallback(U=>{r==null||r(U),T.current&&!Dg(T.current)&&V(U)},[V,r]),L=x.useCallback(U=>{i==null||i(U),!u&&S(-1)},[S,u,i]),X=x.useCallback(U=>{s==null||s(U),jf(U.currentTarget)&&(h??w)&&k()},[k,s,w,h]),$=x.useCallback(U=>{c==null||c(U),S(_)},[S,c,_]),Q=_===C,ie=u&&!f;eo(()=>{M&&(Q&&!ie&&T.current?(I.current&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{var U;(U=T.current)==null||U.focus(),I.current=null})):j.current&&!Dg(j.current)&&j.current.focus())},[Q,ie,j,M]);const oe=kx({onClick:X,onFocus:$,onMouseEnter:V,onMouseMove:F,onMouseLeave:L,ref:ct(z,T,t),isDisabled:u,isFocusable:f});return{...g,...oe,type:p??oe.type,id:D,role:"menuitem",tabIndex:Q?0:-1}}function vj(e){var t;if(!gj(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function gj(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function xj(e,t=[]){return x.useEffect(()=>()=>e(),t)}var[yj,Pc]=Et({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Rh=e=>{const{children:t}=e,n=fn("Menu",e),r=At(e),{direction:i}=Ji(),{descendants:s,...c}=dj({...r,direction:i}),u=x.useMemo(()=>c,[c]),{isOpen:f,onClose:h,forceUpdate:p}=u;return l.jsx(oj,{value:s,children:l.jsx(cj,{value:u,children:l.jsx(yj,{value:n,children:j1(t,{isOpen:f,onClose:h,forceUpdate:p})})})})};Rh.displayName="Menu";var Fx=he((e,t)=>{const n=Pc();return l.jsx(re.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});Fx.displayName="MenuCommand";var bj=he((e,t)=>{const{type:n,...r}=e,i=Pc(),s=r.as||n?n??void 0:"button",c=x.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...i.item}),[i.item]);return l.jsx(re.button,{ref:t,type:s,...r,__css:c})}),Lx=e=>{const{className:t,children:n,...r}=e,i=x.Children.only(n),s=x.isValidElement(i)?x.cloneElement(i,{focusable:"false","aria-hidden":!0,className:Ae("chakra-menu__icon",i.props.className)}):null,c=Ae("chakra-menu__icon-wrapper",t);return l.jsx(re.span,{className:c,...r,__css:{flexShrink:0},children:s})};Lx.displayName="MenuIcon";var pr=he((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:i,commandSpacing:s="0.75rem",children:c,...u}=e,f=mj(u,t),p=n||i?l.jsx("span",{style:{pointerEvents:"none",flex:1},children:c}):c;return l.jsxs(bj,{...f,className:Ae("chakra-menu__menuitem",f.className),children:[n&&l.jsx(Lx,{fontSize:"0.8em",marginEnd:r,children:n}),p,i&&l.jsx(Fx,{marginStart:s,children:i})]})});pr.displayName="MenuItem";var Sj={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},Cj=re(Wr.div),Nh=he(function(t,n){var r,i;const{rootProps:s,motionProps:c,...u}=t,{isOpen:f,onTransitionEnd:h,unstable__animationState:p}=ms(),g=hj(u,n),y=pj(s),S=Pc();return l.jsx(re.div,{...y,__css:{zIndex:(i=t.zIndex)!=null?i:(r=S.list)==null?void 0:r.zIndex},children:l.jsx(Cj,{variants:Sj,initial:!1,animate:f?"enter":"exit",__css:{outline:0,...S.list},...c,className:Ae("chakra-menu__menu-list",g.className),...g,onUpdate:h,onAnimationComplete:yc(p.onComplete,g.onAnimationComplete)})})});Nh.displayName="MenuList";var wj=he((e,t)=>{const n=Pc();return l.jsx(re.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Fh=he((e,t)=>{const{children:n,as:r,...i}=e,s=fj(i,t),c=r||wj;return l.jsx(c,{...s,className:Ae("chakra-menu__menu-button",e.className),children:l.jsx(re.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Fh.displayName="MenuButton";var kj={slideInBottom:{...df,custom:{offsetY:16,reverse:!0}},slideInRight:{...df,custom:{offsetX:16,reverse:!0}},scale:{...S2,custom:{initialScale:.95,reverse:!0}},none:{}},jj=re(Wr.section),Ej=e=>kj[e||"none"],Bx=x.forwardRef((e,t)=>{const{preset:n,motionProps:r=Ej(n),...i}=e;return l.jsx(jj,{ref:t,...r,...i})});Bx.displayName="ModalTransition";var Pj=Object.defineProperty,Ij=(e,t,n)=>t in e?Pj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mj=(e,t,n)=>(Ij(e,typeof t!="symbol"?t+"":t,n),n),Tj=class{constructor(){Mj(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},Ef=new Tj;function Hx(e,t){const[n,r]=x.useState(0);return x.useEffect(()=>{const i=e.current;if(i){if(t){const s=Ef.add(i);r(s)}return()=>{Ef.remove(i),r(0)}}},[t,e]),n}var _j=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Po=new WeakMap,kl=new WeakMap,jl={},kd=0,Wx=function(e){return e&&(e.host||Wx(e.parentNode))},Dj=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Wx(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return Boolean(n)})},Oj=function(e,t,n,r){var i=Dj(t,Array.isArray(e)?e:[e]);jl[n]||(jl[n]=new WeakMap);var s=jl[n],c=[],u=new Set,f=new Set(i),h=function(g){!g||u.has(g)||(u.add(g),h(g.parentNode))};i.forEach(h);var p=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))p(y);else{var S=y.getAttribute(r),C=S!==null&&S!=="false",w=(Po.get(y)||0)+1,k=(s.get(y)||0)+1;Po.set(y,w),s.set(y,k),c.push(y),w===1&&C&&kl.set(y,!0),k===1&&y.setAttribute(n,"true"),C||y.setAttribute(r,"true")}})};return p(t),u.clear(),kd++,function(){c.forEach(function(g){var y=Po.get(g)-1,S=s.get(g)-1;Po.set(g,y),s.set(g,S),y||(kl.has(g)||g.removeAttribute(r),kl.delete(g)),S||g.removeAttribute(n)}),kd--,kd||(Po=new WeakMap,Po=new WeakMap,kl=new WeakMap,jl={})}},Aj=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||_j(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Oj(r,i,n,"aria-hidden")):function(){return null}};function zj(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:i=!0,closeOnEsc:s=!0,useInert:c=!0,onOverlayClick:u,onEsc:f}=e,h=x.useRef(null),p=x.useRef(null),[g,y,S]=Nj(r,"chakra-modal","chakra-modal--header","chakra-modal--body");Rj(h,t&&c),Hx(h,t);const C=x.useRef(null),w=x.useCallback(z=>{C.current=z.target},[]),k=x.useCallback(z=>{z.key==="Escape"&&(z.stopPropagation(),s&&(n==null||n()),f==null||f())},[s,n,f]),[j,M]=x.useState(!1),[P,I]=x.useState(!1),T=x.useCallback((z={},V=null)=>({role:"dialog",...z,ref:ct(V,h),id:g,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?y:void 0,"aria-describedby":P?S:void 0,onClick:Pe(z.onClick,F=>F.stopPropagation())}),[S,P,g,y,j]),D=x.useCallback(z=>{z.stopPropagation(),C.current===z.target&&Ef.isTopModal(h.current)&&(i&&(n==null||n()),u==null||u())},[n,i,u]),_=x.useCallback((z={},V=null)=>({...z,ref:ct(V,p),onClick:Pe(z.onClick,D),onKeyDown:Pe(z.onKeyDown,k),onMouseDown:Pe(z.onMouseDown,w)}),[k,w,D]);return{isOpen:t,onClose:n,headerId:y,bodyId:S,setBodyMounted:I,setHeaderMounted:M,dialogRef:h,overlayRef:p,getDialogProps:T,getDialogContainerProps:_}}function Rj(e,t){const n=e.current;x.useEffect(()=>{if(!(!e.current||!t))return Aj(e.current)},[t,e,n])}function Nj(e,...t){const n=x.useId(),r=e||n;return x.useMemo(()=>t.map(i=>`${i}-${r}`),[r,t])}var[Fj,la]=Et({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Lj,Ki]=Et({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),di=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:i,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:p,preserveScrollBarGap:g,motionPreset:y,lockFocusAcrossFrames:S,onCloseComplete:C}=t,w=fn("Modal",t),j={...zj(t),autoFocus:i,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:p,preserveScrollBarGap:g,motionPreset:y,lockFocusAcrossFrames:S};return l.jsx(Lj,{value:j,children:l.jsx(Fj,{value:w,children:l.jsx(ia,{onExitComplete:C,children:j.isOpen&&l.jsx(eh,{...n,children:r})})})})};di.displayName="Modal";var ql="right-scroll-bar-position",Yl="width-before-scroll-bar",Bj="with-scroll-bars-hidden",Hj="--removed-body-scroll-bar-size",Vx=N2(),jd=function(){},Ic=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:jd,onWheelCapture:jd,onTouchMoveCapture:jd}),i=r[0],s=r[1],c=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,y=e.sideCar,S=e.noIsolation,C=e.inert,w=e.allowPinchZoom,k=e.as,j=k===void 0?"div":k,M=A2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),P=y,I=O2([n,t]),T=vr(vr({},M),i);return x.createElement(x.Fragment,null,p&&x.createElement(P,{sideCar:Vx,removeScrollBar:h,shards:g,noIsolation:S,inert:C,setCallbacks:s,allowPinchZoom:!!w,lockRef:n}),c?x.cloneElement(x.Children.only(u),vr(vr({},T),{ref:I})):x.createElement(j,vr({},T,{className:f,ref:I}),u))});Ic.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ic.classNames={fullWidth:Yl,zeroRight:ql};var Og,Wj=function(){if(Og)return Og;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Vj(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Wj();return t&&e.setAttribute("nonce",t),e}function Uj(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $j(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Gj=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Vj())&&(Uj(t,n),$j(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},qj=function(){var e=Gj();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ux=function(){var e=qj(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},Yj={left:0,top:0,right:0,gap:0},Ed=function(e){return parseInt(e||"",10)||0},Xj=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Ed(n),Ed(r),Ed(i)]},Kj=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Yj;var t=Xj(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Qj=Ux(),Zj=function(e,t,n,r){var i=e.left,s=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),` - .`.concat(Bj,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(u,"px ").concat(r,`; - } - body { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(c,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(u,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(ql,` { - right: `).concat(u,"px ").concat(r,`; - } - - .`).concat(Yl,` { - margin-right: `).concat(u,"px ").concat(r,`; - } - - .`).concat(ql," .").concat(ql,` { - right: 0 `).concat(r,`; - } - - .`).concat(Yl," .").concat(Yl,` { - margin-right: 0 `).concat(r,`; - } - - body { - `).concat(Hj,": ").concat(u,`px; - } -`)},Jj=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r,s=x.useMemo(function(){return Kj(i)},[i]);return x.createElement(Qj,{styles:Zj(s,!t,i,n?"":"!important")})},Pf=!1;if(typeof window<"u")try{var El=Object.defineProperty({},"passive",{get:function(){return Pf=!0,!0}});window.addEventListener("test",El,El),window.removeEventListener("test",El,El)}catch{Pf=!1}var Io=Pf?{passive:!1}:!1,eE=function(e){return e.tagName==="TEXTAREA"},$x=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!eE(e)&&n[t]==="visible")},tE=function(e){return $x(e,"overflowY")},nE=function(e){return $x(e,"overflowX")},Ag=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=Gx(e,n);if(r){var i=qx(e,n),s=i[1],c=i[2];if(s>c)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},rE=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},iE=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Gx=function(e,t){return e==="v"?tE(t):nE(t)},qx=function(e,t){return e==="v"?rE(t):iE(t)},oE=function(e,t){return e==="h"&&t==="rtl"?-1:1},aE=function(e,t,n,r,i){var s=oE(e,window.getComputedStyle(t).direction),c=s*r,u=n.target,f=t.contains(u),h=!1,p=c>0,g=0,y=0;do{var S=qx(e,u),C=S[0],w=S[1],k=S[2],j=w-k-s*C;(C||j)&&Gx(e,u)&&(g+=j,y+=C),u=u.parentNode}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(p&&(i&&g===0||!i&&c>g)||!p&&(i&&y===0||!i&&-c>y))&&(h=!0),h},Pl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},zg=function(e){return[e.deltaX,e.deltaY]},Rg=function(e){return e&&"current"in e?e.current:e},sE=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lE=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},cE=0,Mo=[];function uE(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),i=x.useState(cE++)[0],s=x.useState(function(){return Ux()})[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=xf([e.lockRef.current],(e.shards||[]).map(Rg),!0).filter(Boolean);return w.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var u=x.useCallback(function(w,k){if("touches"in w&&w.touches.length===2)return!c.current.allowPinchZoom;var j=Pl(w),M=n.current,P="deltaX"in w?w.deltaX:M[0]-j[0],I="deltaY"in w?w.deltaY:M[1]-j[1],T,D=w.target,_=Math.abs(P)>Math.abs(I)?"h":"v";if("touches"in w&&_==="h"&&D.type==="range")return!1;var z=Ag(_,D);if(!z)return!0;if(z?T=_:(T=_==="v"?"h":"v",z=Ag(_,D)),!z)return!1;if(!r.current&&"changedTouches"in w&&(P||I)&&(r.current=T),!T)return!0;var V=r.current||T;return aE(V,k,w,V==="h"?P:I,!0)},[]),f=x.useCallback(function(w){var k=w;if(!(!Mo.length||Mo[Mo.length-1]!==s)){var j="deltaY"in k?zg(k):Pl(k),M=t.current.filter(function(T){return T.name===k.type&&T.target===k.target&&sE(T.delta,j)})[0];if(M&&M.should){k.cancelable&&k.preventDefault();return}if(!M){var P=(c.current.shards||[]).map(Rg).filter(Boolean).filter(function(T){return T.contains(k.target)}),I=P.length>0?u(k,P[0]):!c.current.noIsolation;I&&k.cancelable&&k.preventDefault()}}},[]),h=x.useCallback(function(w,k,j,M){var P={name:w,delta:k,target:j,should:M};t.current.push(P),setTimeout(function(){t.current=t.current.filter(function(I){return I!==P})},1)},[]),p=x.useCallback(function(w){n.current=Pl(w),r.current=void 0},[]),g=x.useCallback(function(w){h(w.type,zg(w),w.target,u(w,e.lockRef.current))},[]),y=x.useCallback(function(w){h(w.type,Pl(w),w.target,u(w,e.lockRef.current))},[]);x.useEffect(function(){return Mo.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,Io),document.addEventListener("touchmove",f,Io),document.addEventListener("touchstart",p,Io),function(){Mo=Mo.filter(function(w){return w!==s}),document.removeEventListener("wheel",f,Io),document.removeEventListener("touchmove",f,Io),document.removeEventListener("touchstart",p,Io)}},[]);var S=e.removeScrollBar,C=e.inert;return x.createElement(x.Fragment,null,C?x.createElement(s,{styles:lE(i)}):null,S?x.createElement(Jj,{gapMode:"margin"}):null)}const dE=h5(Vx,uE);var Yx=x.forwardRef(function(e,t){return x.createElement(Ic,vr({},e,{ref:t,sideCar:dE}))});Yx.classNames=Ic.classNames;const fE=Yx;function hE(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:i,blockScrollOnMount:s,allowPinchZoom:c,finalFocusRef:u,returnFocusOnClose:f,preserveScrollBarGap:h,lockFocusAcrossFrames:p,isOpen:g}=Ki(),[y,S]=C3();x.useEffect(()=>{!y&&S&&setTimeout(S)},[y,S]);const C=Hx(r,g);return l.jsx(mx,{autoFocus:t,isDisabled:!n,initialFocusRef:i,finalFocusRef:u,restoreFocus:f,contentRef:r,lockFocusAcrossFrames:p,children:l.jsx(fE,{removeScrollBar:!h,allowPinchZoom:c,enabled:C===1&&s,forwardProps:!0,children:e.children})})}var fi=he((e,t)=>{const{className:n,children:r,containerProps:i,motionProps:s,...c}=e,{getDialogProps:u,getDialogContainerProps:f}=Ki(),h=u(c,t),p=f(i),g=Ae("chakra-modal__content",n),y=la(),S={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...y.dialog},C={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...y.dialogContainer},{motionPreset:w}=Ki();return l.jsx(hE,{children:l.jsx(re.div,{...p,className:"chakra-modal__content-container",tabIndex:-1,__css:C,children:l.jsx(Bx,{preset:w,motionProps:s,className:g,...h,__css:S,children:r})})})});fi.displayName="ModalContent";function Xx(e){const{leastDestructiveRef:t,...n}=e;return l.jsx(di,{...n,initialFocusRef:t})}var Kx=he((e,t)=>l.jsx(fi,{ref:t,role:"alertdialog",...e})),zr=he((e,t)=>{const{className:n,...r}=e,i=Ae("chakra-modal__footer",n),c={display:"flex",alignItems:"center",justifyContent:"flex-end",...la().footer};return l.jsx(re.footer,{ref:t,...r,__css:c,className:i})});zr.displayName="ModalFooter";var Rr=he((e,t)=>{const{className:n,...r}=e,{headerId:i,setHeaderMounted:s}=Ki();x.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__header",n),f={flex:0,...la().header};return l.jsx(re.header,{ref:t,className:c,id:i,...r,__css:f})});Rr.displayName="ModalHeader";var pE=re(Wr.div),Nr=he((e,t)=>{const{className:n,transition:r,motionProps:i,...s}=e,c=Ae("chakra-modal__overlay",n),f={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...la().overlay},{motionPreset:h}=Ki(),g=i||(h==="none"?{}:b2);return l.jsx(pE,{...g,__css:f,ref:t,className:c,...s})});Nr.displayName="ModalOverlay";var Fr=he((e,t)=>{const{className:n,...r}=e,{bodyId:i,setBodyMounted:s}=Ki();x.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__body",n),u=la();return l.jsx(re.div,{ref:t,className:c,id:i,...r,__css:u.body})});Fr.displayName="ModalBody";var ca=he((e,t)=>{const{onClick:n,className:r,...i}=e,{onClose:s}=Ki(),c=Ae("chakra-modal__close-btn",r),u=la();return l.jsx(w3,{ref:t,__css:u.closeButton,className:c,onClick:Pe(n,f=>{f.stopPropagation(),s()}),...i})});ca.displayName="ModalCloseButton";var mE=e=>l.jsx(Jt,{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),vE=e=>l.jsx(Jt,{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function Ng(e,t,n,r){x.useEffect(()=>{var i;if(!e.current||!r)return;const s=(i=e.current.ownerDocument.defaultView)!=null?i:window,c=Array.isArray(t)?t:[t],u=new s.MutationObserver(f=>{for(const h of f)h.type==="attributes"&&h.attributeName&&c.includes(h.attributeName)&&n(h)});return u.observe(e.current,{attributes:!0,attributeFilter:c}),()=>u.disconnect()})}function gE(e,t){const n=Ut(e);x.useEffect(()=>{let r=null;const i=()=>n();return t!==null&&(r=window.setInterval(i,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var xE=50,Fg=300;function yE(e,t){const[n,r]=x.useState(!1),[i,s]=x.useState(null),[c,u]=x.useState(!0),f=x.useRef(null),h=()=>clearTimeout(f.current);gE(()=>{i==="increment"&&e(),i==="decrement"&&t()},n?xE:null);const p=x.useCallback(()=>{c&&e(),f.current=setTimeout(()=>{u(!1),r(!0),s("increment")},Fg)},[e,c]),g=x.useCallback(()=>{c&&t(),f.current=setTimeout(()=>{u(!1),r(!0),s("decrement")},Fg)},[t,c]),y=x.useCallback(()=>{u(!0),r(!1),h()},[]);return x.useEffect(()=>()=>h(),[]),{up:p,down:g,stop:y,isSpinning:n}}var bE=/^[Ee0-9+\-.]$/;function SE(e){return bE.test(e)}function CE(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function wE(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:i=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:c=1,isReadOnly:u,isDisabled:f,isRequired:h,isInvalid:p,pattern:g="[0-9]*(.[0-9]+)?",inputMode:y="decimal",allowMouseWheel:S,id:C,onChange:w,precision:k,name:j,"aria-describedby":M,"aria-label":P,"aria-labelledby":I,onFocus:T,onBlur:D,onInvalid:_,getAriaValueText:z,isValidCharacter:V,format:F,parse:L,...X}=e,$=Ut(T),Q=Ut(D),ie=Ut(_),oe=Ut(V??SE),U=Ut(z),K=Xw(e),{update:ne,increment:ce,decrement:Re}=K,[ze,Me]=x.useState(!1),J=!(u||f),ue=x.useRef(null),Ie=x.useRef(null),Be=x.useRef(null),Ne=x.useRef(null),Ge=x.useCallback(ee=>ee.split("").filter(oe).join(""),[oe]),Qe=x.useCallback(ee=>{var He;return(He=L==null?void 0:L(ee))!=null?He:ee},[L]),ve=x.useCallback(ee=>{var He;return((He=F==null?void 0:F(ee))!=null?He:ee).toString()},[F]);eo(()=>{(K.valueAsNumber>s||K.valueAsNumber{if(!ue.current)return;if(ue.current.value!=K.value){const He=Qe(ue.current.value);K.setValue(Ge(He))}},[Qe,Ge]);const _e=x.useCallback((ee=c)=>{J&&ce(ee)},[ce,J,c]),qe=x.useCallback((ee=c)=>{J&&Re(ee)},[Re,J,c]),ge=yE(_e,qe);Ng(Be,"disabled",ge.stop,ge.isSpinning),Ng(Ne,"disabled",ge.stop,ge.isSpinning);const Te=x.useCallback(ee=>{if(ee.nativeEvent.isComposing)return;const nt=Qe(ee.currentTarget.value);ne(Ge(nt)),Ie.current={start:ee.currentTarget.selectionStart,end:ee.currentTarget.selectionEnd}},[ne,Ge,Qe]),et=x.useCallback(ee=>{var He,nt,Ft;$==null||$(ee),Ie.current&&(ee.target.selectionStart=(nt=Ie.current.start)!=null?nt:(He=ee.currentTarget.value)==null?void 0:He.length,ee.currentTarget.selectionEnd=(Ft=Ie.current.end)!=null?Ft:ee.currentTarget.selectionStart)},[$]),Ve=x.useCallback(ee=>{if(ee.nativeEvent.isComposing)return;CE(ee,oe)||ee.preventDefault();const He=vt(ee)*c,nt=ee.key,pe={ArrowUp:()=>_e(He),ArrowDown:()=>qe(He),Home:()=>ne(i),End:()=>ne(s)}[nt];pe&&(ee.preventDefault(),pe(ee))},[oe,c,_e,qe,ne,i,s]),vt=ee=>{let He=1;return(ee.metaKey||ee.ctrlKey)&&(He=.1),ee.shiftKey&&(He=10),He},Nt=x.useMemo(()=>{const ee=U==null?void 0:U(K.value);if(ee!=null)return ee;const He=K.value.toString();return He||void 0},[K.value,U]),N=x.useCallback(()=>{let ee=K.value;if(K.value==="")return;/^[eE]/.test(K.value.toString())?K.setValue(""):(K.valueAsNumbers&&(ee=s),K.cast(ee))},[K,s,i]),de=x.useCallback(()=>{Me(!1),n&&N()},[n,Me,N]),xe=x.useCallback(()=>{t&&requestAnimationFrame(()=>{var ee;(ee=ue.current)==null||ee.focus()})},[t]),je=x.useCallback(ee=>{ee.preventDefault(),ge.up(),xe()},[xe,ge]),q=x.useCallback(ee=>{ee.preventDefault(),ge.down(),xe()},[xe,ge]);Ui(()=>ue.current,"wheel",ee=>{var He,nt;const pe=((nt=(He=ue.current)==null?void 0:He.ownerDocument)!=null?nt:document).activeElement===ue.current;if(!S||!pe)return;ee.preventDefault();const De=vt(ee)*c,hn=Math.sign(ee.deltaY);hn===-1?_e(De):hn===1&&qe(De)},{passive:!1});const se=x.useCallback((ee={},He=null)=>{const nt=f||r&&K.isAtMax;return{...ee,ref:ct(He,Be),role:"button",tabIndex:-1,onPointerDown:Pe(ee.onPointerDown,Ft=>{Ft.button!==0||nt||je(Ft)}),onPointerLeave:Pe(ee.onPointerLeave,ge.stop),onPointerUp:Pe(ee.onPointerUp,ge.stop),disabled:nt,"aria-disabled":Dr(nt)}},[K.isAtMax,r,je,ge.stop,f]),Fe=x.useCallback((ee={},He=null)=>{const nt=f||r&&K.isAtMin;return{...ee,ref:ct(He,Ne),role:"button",tabIndex:-1,onPointerDown:Pe(ee.onPointerDown,Ft=>{Ft.button!==0||nt||q(Ft)}),onPointerLeave:Pe(ee.onPointerLeave,ge.stop),onPointerUp:Pe(ee.onPointerUp,ge.stop),disabled:nt,"aria-disabled":Dr(nt)}},[K.isAtMin,r,q,ge.stop,f]),Ze=x.useCallback((ee={},He=null)=>{var nt,Ft,pe,De;return{name:j,inputMode:y,type:"text",pattern:g,"aria-labelledby":I,"aria-label":P,"aria-describedby":M,id:C,disabled:f,...ee,readOnly:(nt=ee.readOnly)!=null?nt:u,"aria-readonly":(Ft=ee.readOnly)!=null?Ft:u,"aria-required":(pe=ee.required)!=null?pe:h,required:(De=ee.required)!=null?De:h,ref:ct(ue,He),value:ve(K.value),role:"spinbutton","aria-valuemin":i,"aria-valuemax":s,"aria-valuenow":Number.isNaN(K.valueAsNumber)?void 0:K.valueAsNumber,"aria-invalid":Dr(p??K.isOutOfRange),"aria-valuetext":Nt,autoComplete:"off",autoCorrect:"off",onChange:Pe(ee.onChange,Te),onKeyDown:Pe(ee.onKeyDown,Ve),onFocus:Pe(ee.onFocus,et,()=>Me(!0)),onBlur:Pe(ee.onBlur,Q,de)}},[j,y,g,I,P,ve,M,C,f,h,u,p,K.value,K.valueAsNumber,K.isOutOfRange,i,s,Nt,Te,Ve,et,Q,de]);return{value:ve(K.value),valueAsNumber:K.valueAsNumber,isFocused:ze,isDisabled:f,isReadOnly:u,getIncrementButtonProps:se,getDecrementButtonProps:Fe,getInputProps:Ze,htmlProps:X}}var[kE,Mc]=Et({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[jE,Lh]=Et({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Bh=he(function(t,n){const r=fn("NumberInput",t),i=At(t),s=uh(i),{htmlProps:c,...u}=wE(s),f=x.useMemo(()=>u,[u]);return l.jsx(jE,{value:f,children:l.jsx(kE,{value:r,children:l.jsx(re.div,{...c,ref:n,className:Ae("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Bh.displayName="NumberInput";var Hh=he(function(t,n){const r=Mc();return l.jsx(re.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});Hh.displayName="NumberInputStepper";var Wh=he(function(t,n){const{getInputProps:r}=Lh(),i=r(t,n),s=Mc();return l.jsx(re.input,{...i,className:Ae("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Wh.displayName="NumberInputField";var Qx=re("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Vh=he(function(t,n){var r;const i=Mc(),{getDecrementButtonProps:s}=Lh(),c=s(t,n);return l.jsx(Qx,{...c,__css:i.stepper,children:(r=t.children)!=null?r:l.jsx(mE,{})})});Vh.displayName="NumberDecrementStepper";var Uh=he(function(t,n){var r;const{getIncrementButtonProps:i}=Lh(),s=i(t,n),c=Mc();return l.jsx(Qx,{...s,__css:c.stepper,children:(r=t.children)!=null?r:l.jsx(vE,{})})});Uh.displayName="NumberIncrementStepper";var[EE,vs]=Et({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[PE,$h]=Et({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Gh(e){const t=x.Children.only(e.children),{getTriggerProps:n}=vs();return x.cloneElement(t,n(t.props,t.ref))}Gh.displayName="PopoverTrigger";var To={click:"click",hover:"hover"};function IE(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:i,returnFocusOnClose:s=!0,autoFocus:c=!0,arrowSize:u,arrowShadowColor:f,trigger:h=To.click,openDelay:p=200,closeDelay:g=200,isLazy:y,lazyBehavior:S="unmount",computePositionOnMount:C,...w}=e,{isOpen:k,onClose:j,onOpen:M,onToggle:P}=Ah(e),I=x.useRef(null),T=x.useRef(null),D=x.useRef(null),_=x.useRef(!1),z=x.useRef(!1);k&&(z.current=!0);const[V,F]=x.useState(!1),[L,X]=x.useState(!1),$=x.useId(),Q=i??$,[ie,oe,U,K]=["popover-trigger","popover-content","popover-header","popover-body"].map(Te=>`${Te}-${Q}`),{referenceRef:ne,getArrowProps:ce,getPopperProps:Re,getArrowInnerProps:ze,forceUpdate:Me}=Oh({...w,enabled:k||!!C}),J=Rx({isOpen:k,ref:D});n5({enabled:k,ref:T}),jx(D,{focusRef:T,visible:k,shouldFocus:s&&h===To.click}),R6(D,{focusRef:r,visible:k,shouldFocus:c&&h===To.click});const ue=zh({wasSelected:z.current,enabled:y,mode:S,isSelected:J.present}),Ie=x.useCallback((Te={},et=null)=>{const Ve={...Te,style:{...Te.style,transformOrigin:Vt.transformOrigin.varRef,[Vt.arrowSize.var]:u?`${u}px`:void 0,[Vt.arrowShadowColor.var]:f},ref:ct(D,et),children:ue?Te.children:null,id:oe,tabIndex:-1,role:"dialog",onKeyDown:Pe(Te.onKeyDown,vt=>{n&&vt.key==="Escape"&&j()}),onBlur:Pe(Te.onBlur,vt=>{const Nt=Lg(vt),N=Pd(D.current,Nt),de=Pd(T.current,Nt);k&&t&&(!N&&!de)&&j()}),"aria-labelledby":V?U:void 0,"aria-describedby":L?K:void 0};return h===To.hover&&(Ve.role="tooltip",Ve.onMouseEnter=Pe(Te.onMouseEnter,()=>{_.current=!0}),Ve.onMouseLeave=Pe(Te.onMouseLeave,vt=>{vt.nativeEvent.relatedTarget!==null&&(_.current=!1,setTimeout(()=>j(),g))})),Ve},[ue,oe,V,U,L,K,h,n,j,k,t,g,f,u]),Be=x.useCallback((Te={},et=null)=>Re({...Te,style:{visibility:k?"visible":"hidden",...Te.style}},et),[k,Re]),Ne=x.useCallback((Te,et=null)=>({...Te,ref:ct(et,I,ne)}),[I,ne]),Ge=x.useRef(),Qe=x.useRef(),ve=x.useCallback(Te=>{I.current==null&&ne(Te)},[ne]),_e=x.useCallback((Te={},et=null)=>{const Ve={...Te,ref:ct(T,et,ve),id:ie,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":oe};return h===To.click&&(Ve.onClick=Pe(Te.onClick,P)),h===To.hover&&(Ve.onFocus=Pe(Te.onFocus,()=>{Ge.current===void 0&&M()}),Ve.onBlur=Pe(Te.onBlur,vt=>{const Nt=Lg(vt),N=!Pd(D.current,Nt);k&&t&&N&&j()}),Ve.onKeyDown=Pe(Te.onKeyDown,vt=>{vt.key==="Escape"&&j()}),Ve.onMouseEnter=Pe(Te.onMouseEnter,()=>{_.current=!0,Ge.current=window.setTimeout(()=>M(),p)}),Ve.onMouseLeave=Pe(Te.onMouseLeave,()=>{_.current=!1,Ge.current&&(clearTimeout(Ge.current),Ge.current=void 0),Qe.current=window.setTimeout(()=>{_.current===!1&&j()},g)})),Ve},[ie,k,oe,h,ve,P,M,t,j,p,g]);x.useEffect(()=>()=>{Ge.current&&clearTimeout(Ge.current),Qe.current&&clearTimeout(Qe.current)},[]);const qe=x.useCallback((Te={},et=null)=>({...Te,id:U,ref:ct(et,Ve=>{F(!!Ve)})}),[U]),ge=x.useCallback((Te={},et=null)=>({...Te,id:K,ref:ct(et,Ve=>{X(!!Ve)})}),[K]);return{forceUpdate:Me,isOpen:k,onAnimationComplete:J.onComplete,onClose:j,getAnchorProps:Ne,getArrowProps:ce,getArrowInnerProps:ze,getPopoverPositionerProps:Be,getPopoverProps:Ie,getTriggerProps:_e,getHeaderProps:qe,getBodyProps:ge}}function Pd(e,t){return e===t||(e==null?void 0:e.contains(t))}function Lg(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function qh(e){const t=fn("Popover",e),{children:n,...r}=At(e),i=Ji(),s=IE({...r,direction:i.direction});return l.jsx(EE,{value:s,children:l.jsx(PE,{value:t,children:j1(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}qh.displayName="Popover";function Yh(e){var t;const{bg:n,bgColor:r,backgroundColor:i,shadow:s,boxShadow:c}=e,{getArrowProps:u,getArrowInnerProps:f}=vs(),h=$h(),p=(t=n??r)!=null?t:i,g=s??c;return l.jsx(re.div,{...u(),className:"chakra-popover__arrow-positioner",children:l.jsx(re.div,{className:Ae("chakra-popover__arrow",e.className),...f(e),__css:{"--popper-arrow-bg":p?`colors.${p}, ${p}`:void 0,"--popper-arrow-shadow":g?`shadows.${g}, ${g}`:void 0,...h.arrow}})})}Yh.displayName="PopoverArrow";var Zx=he(function(t,n){const{getBodyProps:r}=vs(),i=$h();return l.jsx(re.div,{...r(t,n),className:Ae("chakra-popover__body",t.className),__css:i.body})});Zx.displayName="PopoverBody";function ME(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var TE={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},_E=re(Wr.section),Jx=he(function(t,n){const{variants:r=TE,...i}=t,{isOpen:s}=vs();return l.jsx(_E,{ref:n,variants:ME(r),initial:!1,animate:s?"enter":"exit",...i})});Jx.displayName="PopoverTransition";var Xh=he(function(t,n){const{rootProps:r,motionProps:i,...s}=t,{getPopoverProps:c,getPopoverPositionerProps:u,onAnimationComplete:f}=vs(),h=$h(),p={position:"relative",display:"flex",flexDirection:"column",...h.content};return l.jsx(re.div,{...u(r),__css:h.popper,className:"chakra-popover__popper",children:l.jsx(Jx,{...i,...c(s,n),onAnimationComplete:yc(f,s.onAnimationComplete),className:Ae("chakra-popover__content",t.className),__css:p})})});Xh.displayName="PopoverContent";function DE(e,t,n){return(e-t)*100/(n-t)}Zi({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});Zi({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var OE=Zi({"0%":{left:"-40%"},"100%":{left:"100%"}}),AE=Zi({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function zE(e){const{value:t=0,min:n,max:r,valueText:i,getValueText:s,isIndeterminate:c,role:u="progressbar"}=e,f=DE(t,n,r);return{bind:{"data-indeterminate":c?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":c?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,f):i})(),role:u},percent:f,value:t}}var[RE,NE]=Et({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),FE=he((e,t)=>{const{min:n,max:r,value:i,isIndeterminate:s,role:c,...u}=e,f=zE({value:i,min:n,max:r,isIndeterminate:s,role:c}),p={height:"100%",...NE().filledTrack};return l.jsx(re.div,{ref:t,style:{width:`${f.percent}%`,...u.style},...f.bind,...u,__css:p})}),ey=he((e,t)=>{var n;const{value:r,min:i=0,max:s=100,hasStripe:c,isAnimated:u,children:f,borderRadius:h,isIndeterminate:p,"aria-label":g,"aria-labelledby":y,"aria-valuetext":S,title:C,role:w,...k}=At(e),j=fn("Progress",e),M=h??((n=j.track)==null?void 0:n.borderRadius),P={animation:`${AE} 1s linear infinite`},D={...!p&&c&&u&&P,...p&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${OE} 1s ease infinite normal none running`}},_={overflow:"hidden",position:"relative",...j.track};return l.jsx(re.div,{ref:t,borderRadius:M,__css:_,...k,children:l.jsxs(RE,{value:j,children:[l.jsx(FE,{"aria-label":g,"aria-labelledby":y,"aria-valuetext":S,min:i,max:s,value:r,isIndeterminate:p,css:D,borderRadius:M,title:C,role:w}),f]})})});ey.displayName="Progress";function LE(e){return e&&Kd(e)&&Kd(e.target)}function BE(e={}){const{onChange:t,value:n,defaultValue:r,name:i,isDisabled:s,isFocusable:c,isNative:u,...f}=e,[h,p]=x.useState(r||""),g=typeof n<"u",y=g?n:h,S=x.useRef(null),C=x.useCallback(()=>{const T=S.current;if(!T)return;let D="input:not(:disabled):checked";const _=T.querySelector(D);if(_){_.focus();return}D="input:not(:disabled)";const z=T.querySelector(D);z==null||z.focus()},[]),k=`radio-${x.useId()}`,j=i||k,M=x.useCallback(T=>{const D=LE(T)?T.target.value:T;g||p(D),t==null||t(String(D))},[t,g]),P=x.useCallback((T={},D=null)=>({...T,ref:ct(D,S),role:"radiogroup"}),[]),I=x.useCallback((T={},D=null)=>({...T,ref:D,name:j,[u?"checked":"isChecked"]:y!=null?T.value===y:void 0,onChange(z){M(z)},"data-radiogroup":!0}),[u,j,M,y]);return{getRootProps:P,getRadioProps:I,name:j,ref:S,focus:C,setValue:p,value:y,onChange:M,isDisabled:s,isFocusable:c,htmlProps:f}}var[HE,ty]=Et({name:"RadioGroupContext",strict:!1}),Ja=he((e,t)=>{const{colorScheme:n,size:r,variant:i,children:s,className:c,isDisabled:u,isFocusable:f,...h}=e,{value:p,onChange:g,getRootProps:y,name:S,htmlProps:C}=BE(h),w=x.useMemo(()=>({name:S,size:r,onChange:g,colorScheme:n,value:p,variant:i,isDisabled:u,isFocusable:f}),[S,r,g,n,p,i,u,f]);return l.jsx(HE,{value:w,children:l.jsx(re.div,{...y(C,t),className:Ae("chakra-radio-group",c),children:s})})});Ja.displayName="RadioGroup";var WE={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function VE(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:i,isReadOnly:s,isRequired:c,onChange:u,isInvalid:f,name:h,value:p,id:g,"data-radiogroup":y,"aria-describedby":S,...C}=e,w=`radio-${x.useId()}`,k=no(),M=!!ty()||!!y;let I=!!k&&!M?k.id:w;I=g??I;const T=i??(k==null?void 0:k.isDisabled),D=s??(k==null?void 0:k.isReadOnly),_=c??(k==null?void 0:k.isRequired),z=f??(k==null?void 0:k.isInvalid),[V,F]=x.useState(!1),[L,X]=x.useState(!1),[$,Q]=x.useState(!1),[ie,oe]=x.useState(!1),[U,K]=x.useState(Boolean(t)),ne=typeof n<"u",ce=ne?n:U;x.useEffect(()=>j2(F),[]);const Re=x.useCallback(ve=>{if(D||T){ve.preventDefault();return}ne||K(ve.target.checked),u==null||u(ve)},[ne,T,D,u]),ze=x.useCallback(ve=>{ve.key===" "&&oe(!0)},[oe]),Me=x.useCallback(ve=>{ve.key===" "&&oe(!1)},[oe]),J=x.useCallback((ve={},_e=null)=>({...ve,ref:_e,"data-active":Ye(ie),"data-hover":Ye($),"data-disabled":Ye(T),"data-invalid":Ye(z),"data-checked":Ye(ce),"data-focus":Ye(L),"data-focus-visible":Ye(L&&V),"data-readonly":Ye(D),"aria-hidden":!0,onMouseDown:Pe(ve.onMouseDown,()=>oe(!0)),onMouseUp:Pe(ve.onMouseUp,()=>oe(!1)),onMouseEnter:Pe(ve.onMouseEnter,()=>Q(!0)),onMouseLeave:Pe(ve.onMouseLeave,()=>Q(!1))}),[ie,$,T,z,ce,L,D,V]),{onFocus:ue,onBlur:Ie}=k??{},Be=x.useCallback((ve={},_e=null)=>{const qe=T&&!r;return{...ve,id:I,ref:_e,type:"radio",name:h,value:p,onChange:Pe(ve.onChange,Re),onBlur:Pe(Ie,ve.onBlur,()=>X(!1)),onFocus:Pe(ue,ve.onFocus,()=>X(!0)),onKeyDown:Pe(ve.onKeyDown,ze),onKeyUp:Pe(ve.onKeyUp,Me),checked:ce,disabled:qe,readOnly:D,required:_,"aria-invalid":Dr(z),"aria-disabled":Dr(qe),"aria-required":Dr(_),"data-readonly":Ye(D),"aria-describedby":S,style:WE}},[T,r,I,h,p,Re,Ie,ue,ze,Me,ce,D,_,z,S]);return{state:{isInvalid:z,isFocused:L,isChecked:ce,isActive:ie,isHovered:$,isDisabled:T,isReadOnly:D,isRequired:_},getCheckboxProps:J,getInputProps:Be,getLabelProps:(ve={},_e=null)=>({...ve,ref:_e,onMouseDown:Pe(ve.onMouseDown,Bg),onTouchStart:Pe(ve.onTouchStart,Bg),"data-disabled":Ye(T),"data-checked":Ye(ce),"data-invalid":Ye(z)}),getRootProps:(ve,_e=null)=>({...ve,ref:_e,"data-disabled":Ye(T),"data-checked":Ye(ce),"data-invalid":Ye(z)}),htmlProps:C}}function Bg(e){e.preventDefault(),e.stopPropagation()}function UE(e,t){const n={},r={};for(const[i,s]of Object.entries(e))t.includes(i)?n[i]=s:r[i]=s;return[n,r]}var vn=he((e,t)=>{var n;const r=ty(),{onChange:i,value:s}=e,c=fn("Radio",{...r,...e}),u=At(e),{spacing:f="0.5rem",children:h,isDisabled:p=r==null?void 0:r.isDisabled,isFocusable:g=r==null?void 0:r.isFocusable,inputProps:y,...S}=u;let C=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(C=r.value===s);let w=i;r!=null&&r.onChange&&s!=null&&(w=yc(r.onChange,i));const k=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:j,getCheckboxProps:M,getLabelProps:P,getRootProps:I,htmlProps:T}=VE({...S,isChecked:C,isFocusable:g,isDisabled:p,onChange:w,name:k}),[D,_]=UE(T,E1),z=M(_),V=j(y,t),F=P(),L=Object.assign({},D,I()),X={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...c.container},$={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...c.control},Q={userSelect:"none",marginStart:f,...c.label};return l.jsxs(re.label,{className:"chakra-radio",...L,__css:X,children:[l.jsx("input",{className:"chakra-radio__input",...V}),l.jsx(re.span,{className:"chakra-radio__control",...z,__css:$}),h&&l.jsx(re.span,{className:"chakra-radio__label",...F,__css:Q,children:h})]})});vn.displayName="Radio";var ny=he(function(t,n){const{children:r,placeholder:i,className:s,...c}=t;return l.jsxs(re.select,{...c,ref:n,className:Ae("chakra-select",s),children:[i&&l.jsx("option",{value:"",children:i}),r]})});ny.displayName="SelectField";function $E(e,t){const n={},r={};for(const[i,s]of Object.entries(e))t.includes(i)?n[i]=s:r[i]=s;return[n,r]}var ry=he((e,t)=>{var n;const r=fn("Select",e),{rootProps:i,placeholder:s,icon:c,color:u,height:f,h,minH:p,minHeight:g,iconColor:y,iconSize:S,...C}=At(e),[w,k]=$E(C,E1),j=ch(k),M={width:"100%",height:"fit-content",position:"relative",color:u},P={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return l.jsxs(re.div,{className:"chakra-select__wrapper",__css:M,...w,...i,children:[l.jsx(ny,{ref:t,height:h??f,minH:p??g,placeholder:s,...j,__css:P,children:e.children}),l.jsx(iy,{"data-disabled":Ye(j.disabled),...(y||u)&&{color:y||u},__css:r.icon,...S&&{fontSize:S},children:c})]})});ry.displayName="Select";var GE=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),qE=re("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),iy=e=>{const{children:t=l.jsx(GE,{}),...n}=e,r=x.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(qE,{...n,className:"chakra-select__icon-wrapper",children:x.isValidElement(t)?r:null})};iy.displayName="SelectIcon";var _o=e=>e?"":void 0,Id=e=>e?!0:void 0,gs=(...e)=>e.filter(Boolean).join(" ");function Md(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function Il(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var Xl={width:0,height:0},Ml=e=>e||Xl;function YE(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:i}=e,s=w=>{var k;const j=(k=r[w])!=null?k:Xl;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Il({orientation:t,vertical:{bottom:`calc(${n[w]}% - ${j.height/2}px)`},horizontal:{left:`calc(${n[w]}% - ${j.width/2}px)`}})}},c=t==="vertical"?r.reduce((w,k)=>Ml(w).height>Ml(k).height?w:k,Xl):r.reduce((w,k)=>Ml(w).width>Ml(k).width?w:k,Xl),u={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Il({orientation:t,vertical:c?{paddingLeft:c.width/2,paddingRight:c.width/2}:{},horizontal:c?{paddingTop:c.height/2,paddingBottom:c.height/2}:{}})},f={position:"absolute",...Il({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},h=n.length===1,p=[0,i?100-n[0]:n[0]],g=h?p:n;let y=g[0];!h&&i&&(y=100-y);const S=Math.abs(g[g.length-1]-g[0]),C={...f,...Il({orientation:t,vertical:i?{height:`${S}%`,top:`${y}%`}:{height:`${S}%`,bottom:`${y}%`},horizontal:i?{width:`${S}%`,right:`${y}%`}:{width:`${S}%`,left:`${y}%`}})};return{trackStyle:f,innerTrackStyle:C,rootStyle:u,getThumbStyle:s}}function XE(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function KE(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function QE(e){const t=JE(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function oy(e){return!!e.touches}function ZE(e){return oy(e)&&e.touches.length>1}function JE(e){var t;return(t=e.view)!=null?t:window}function e7(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function t7(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function ay(e,t="page"){return oy(e)?e7(e,t):t7(e,t)}function n7(e){return t=>{const n=QE(t);(!n||n&&t.button===0)&&e(t)}}function r7(e,t=!1){function n(i){e(i,{point:ay(i)})}return t?n7(n):n}function Kl(e,t,n,r){return KE(e,t,r7(n,t==="pointerdown"),r)}var i7=Object.defineProperty,o7=(e,t,n)=>t in e?i7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tr=(e,t,n)=>(o7(e,typeof t!="symbol"?t+"":t,n),n),a7=class{constructor(e,t,n){tr(this,"history",[]),tr(this,"startEvent",null),tr(this,"lastEvent",null),tr(this,"lastEventInfo",null),tr(this,"handlers",{}),tr(this,"removeListeners",()=>{}),tr(this,"threshold",3),tr(this,"win"),tr(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const u=Td(this.lastEventInfo,this.history),f=this.startEvent!==null,h=u7(u.offset,{x:0,y:0})>=this.threshold;if(!f&&!h)return;const{timestamp:p}=eg();this.history.push({...u.point,timestamp:p});const{onStart:g,onMove:y}=this.handlers;f||(g==null||g(this.lastEvent,u),this.startEvent=this.lastEvent),y==null||y(this.lastEvent,u)}),tr(this,"onPointerMove",(u,f)=>{this.lastEvent=u,this.lastEventInfo=f,R3.update(this.updatePoint,!0)}),tr(this,"onPointerUp",(u,f)=>{const h=Td(f,this.history),{onEnd:p,onSessionEnd:g}=this.handlers;g==null||g(u,h),this.end(),!(!p||!this.startEvent)&&(p==null||p(u,h))});var r;if(this.win=(r=e.view)!=null?r:window,ZE(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const i={point:ay(e)},{timestamp:s}=eg();this.history=[{...i.point,timestamp:s}];const{onSessionStart:c}=t;c==null||c(e,Td(i,this.history)),this.removeListeners=c7(Kl(this.win,"pointermove",this.onPointerMove),Kl(this.win,"pointerup",this.onPointerUp),Kl(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),N3.update(this.updatePoint)}};function Hg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Td(e,t){return{point:e.point,delta:Hg(e.point,t[t.length-1]),offset:Hg(e.point,t[0]),velocity:l7(t,.1)}}var s7=e=>e*1e3;function l7(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=e[e.length-1];for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>s7(t)));)n--;if(!r)return{x:0,y:0};const s=(i.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const c={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function c7(...e){return t=>e.reduce((n,r)=>r(n),t)}function _d(e,t){return Math.abs(e-t)}function Wg(e){return"x"in e&&"y"in e}function u7(e,t){if(typeof e=="number"&&typeof t=="number")return _d(e,t);if(Wg(e)&&Wg(t)){const n=_d(e.x,t.x),r=_d(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function sy(e){const t=x.useRef(null);return t.current=e,t}function d7(e,t){const{onPan:n,onPanStart:r,onPanEnd:i,onPanSessionStart:s,onPanSessionEnd:c,threshold:u}=t,f=Boolean(n||r||i||s||c),h=x.useRef(null),p=sy({onSessionStart:s,onSessionEnd:c,onStart:r,onMove:n,onEnd(g,y){h.current=null,i==null||i(g,y)}});x.useEffect(()=>{var g;(g=h.current)==null||g.updateHandlers(p.current)}),x.useEffect(()=>{const g=e.current;if(!g||!f)return;function y(S){h.current=new a7(S,p.current,u)}return Kl(g,"pointerdown",y)},[e,f,p,u]),x.useEffect(()=>()=>{var g;(g=h.current)==null||g.end(),h.current=null},[])}function f7(e,t){var n;if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const r=(n=e.ownerDocument.defaultView)!=null?n:window,i=new r.ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const[c]=s;let u,f;if("borderBoxSize"in c){const h=c.borderBoxSize,p=Array.isArray(h)?h[0]:h;u=p.inlineSize,f=p.blockSize}else u=e.offsetWidth,f=e.offsetHeight;t({width:u,height:f})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}var h7=Boolean(globalThis==null?void 0:globalThis.document)?x.useLayoutEffect:x.useEffect;function p7(e,t){var n,r;if(!e||!e.parentElement)return;const i=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new i.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function m7({getNodes:e,observeMutation:t=!0}){const[n,r]=x.useState([]),[i,s]=x.useState(0);return h7(()=>{const c=e(),u=c.map((f,h)=>f7(f,p=>{r(g=>[...g.slice(0,h),p,...g.slice(h+1)])}));if(t){const f=c[0];u.push(p7(f,()=>{s(h=>h+1)}))}return()=>{u.forEach(f=>{f==null||f()})}},[i]),n}function v7(e){return typeof e=="object"&&e!==null&&"current"in e}function g7(e){const[t]=m7({observeMutation:!1,getNodes(){return[v7(e)?e.current:e]}});return t}function x7(e){var t;const{min:n=0,max:r=100,onChange:i,value:s,defaultValue:c,isReversed:u,direction:f="ltr",orientation:h="horizontal",id:p,isDisabled:g,isReadOnly:y,onChangeStart:S,onChangeEnd:C,step:w=1,getAriaValueText:k,"aria-valuetext":j,"aria-label":M,"aria-labelledby":P,name:I,focusThumbOnChange:T=!0,...D}=e,_=Ut(S),z=Ut(C),V=Ut(k),F=XE({isReversed:u,direction:f,orientation:h}),[L,X]=oh({value:s,defaultValue:c??b7(n,r),onChange:i}),[$,Q]=x.useState(!1),[ie,oe]=x.useState(!1),U=!(g||y),K=(r-n)/10,ne=w||(r-n)/100,ce=$l(L,n,r),Re=r-ce+n,Me=ug(F?Re:ce,n,r),J=h==="vertical",ue=sy({min:n,max:r,step:w,isDisabled:g,value:ce,isInteractive:U,isReversed:F,isVertical:J,eventSource:null,focusThumbOnChange:T,orientation:h}),Ie=x.useRef(null),Be=x.useRef(null),Ne=x.useRef(null),Ge=x.useId(),Qe=p??Ge,[ve,_e]=[`slider-thumb-${Qe}`,`slider-track-${Qe}`],qe=x.useCallback(pe=>{var De,hn;if(!Ie.current)return;const $t=ue.current;$t.eventSource="pointer";const pn=Ie.current.getBoundingClientRect(),{clientX:ir,clientY:yi}=(hn=(De=pe.touches)==null?void 0:De[0])!=null?hn:pe,da=J?pn.bottom-yi:ir-pn.left,Kc=J?pn.height:pn.width;let fa=da/Kc;F&&(fa=1-fa);let bi=Yw(fa,$t.min,$t.max);return $t.step&&(bi=parseFloat(dg(bi,$t.min,$t.step))),bi=$l(bi,$t.min,$t.max),bi},[J,F,ue]),ge=x.useCallback(pe=>{const De=ue.current;De.isInteractive&&(pe=parseFloat(dg(pe,De.min,ne)),pe=$l(pe,De.min,De.max),X(pe))},[ne,X,ue]),Te=x.useMemo(()=>({stepUp(pe=ne){const De=F?ce-pe:ce+pe;ge(De)},stepDown(pe=ne){const De=F?ce+pe:ce-pe;ge(De)},reset(){ge(c||0)},stepTo(pe){ge(pe)}}),[ge,F,ce,ne,c]),et=x.useCallback(pe=>{const De=ue.current,$t={ArrowRight:()=>Te.stepUp(),ArrowUp:()=>Te.stepUp(),ArrowLeft:()=>Te.stepDown(),ArrowDown:()=>Te.stepDown(),PageUp:()=>Te.stepUp(K),PageDown:()=>Te.stepDown(K),Home:()=>ge(De.min),End:()=>ge(De.max)}[pe.key];$t&&(pe.preventDefault(),pe.stopPropagation(),$t(pe),De.eventSource="keyboard")},[Te,ge,K,ue]),Ve=(t=V==null?void 0:V(ce))!=null?t:j,vt=g7(Be),{getThumbStyle:Nt,rootStyle:N,trackStyle:de,innerTrackStyle:xe}=x.useMemo(()=>{const pe=ue.current,De=vt??{width:0,height:0};return YE({isReversed:F,orientation:pe.orientation,thumbRects:[De],thumbPercents:[Me]})},[F,vt,Me,ue]),je=x.useCallback(()=>{ue.current.focusThumbOnChange&&setTimeout(()=>{var De;return(De=Be.current)==null?void 0:De.focus()})},[ue]);eo(()=>{const pe=ue.current;je(),pe.eventSource==="keyboard"&&(z==null||z(pe.value))},[ce,z]);function q(pe){const De=qe(pe);De!=null&&De!==ue.current.value&&X(De)}d7(Ne,{onPanSessionStart(pe){const De=ue.current;De.isInteractive&&(Q(!0),je(),q(pe),_==null||_(De.value))},onPanSessionEnd(){const pe=ue.current;pe.isInteractive&&(Q(!1),z==null||z(pe.value))},onPan(pe){ue.current.isInteractive&&q(pe)}});const se=x.useCallback((pe={},De=null)=>({...pe,...D,ref:ct(De,Ne),tabIndex:-1,"aria-disabled":Id(g),"data-focused":_o(ie),style:{...pe.style,...N}}),[D,g,ie,N]),Fe=x.useCallback((pe={},De=null)=>({...pe,ref:ct(De,Ie),id:_e,"data-disabled":_o(g),style:{...pe.style,...de}}),[g,_e,de]),Ze=x.useCallback((pe={},De=null)=>({...pe,ref:De,style:{...pe.style,...xe}}),[xe]),ee=x.useCallback((pe={},De=null)=>({...pe,ref:ct(De,Be),role:"slider",tabIndex:U?0:void 0,id:ve,"data-active":_o($),"aria-valuetext":Ve,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":ce,"aria-orientation":h,"aria-disabled":Id(g),"aria-readonly":Id(y),"aria-label":M,"aria-labelledby":M?void 0:P,style:{...pe.style,...Nt(0)},onKeyDown:Md(pe.onKeyDown,et),onFocus:Md(pe.onFocus,()=>oe(!0)),onBlur:Md(pe.onBlur,()=>oe(!1))}),[U,ve,$,Ve,n,r,ce,h,g,y,M,P,Nt,et]),He=x.useCallback((pe,De=null)=>{const hn=!(pe.valuer),$t=ce>=pe.value,pn=ug(pe.value,n,r),ir={position:"absolute",pointerEvents:"none",...y7({orientation:h,vertical:{bottom:F?`${100-pn}%`:`${pn}%`},horizontal:{left:F?`${100-pn}%`:`${pn}%`}})};return{...pe,ref:De,role:"presentation","aria-hidden":!0,"data-disabled":_o(g),"data-invalid":_o(!hn),"data-highlighted":_o($t),style:{...pe.style,...ir}}},[g,F,r,n,h,ce]),nt=x.useCallback((pe={},De=null)=>({...pe,ref:De,type:"hidden",value:ce,name:I}),[I,ce]);return{state:{value:ce,isFocused:ie,isDragging:$},actions:Te,getRootProps:se,getTrackProps:Fe,getInnerTrackProps:Ze,getThumbProps:ee,getMarkerProps:He,getInputProps:nt}}function y7(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function b7(e,t){return t"}),[C7,_c]=Et({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),ly=he((e,t)=>{const n={orientation:"horizontal",...e},r=fn("Slider",n),i=At(n),{direction:s}=Ji();i.direction=s;const{getInputProps:c,getRootProps:u,...f}=x7(i),h=u(),p=c({},t);return l.jsx(S7,{value:f,children:l.jsx(C7,{value:r,children:l.jsxs(re.div,{...h,className:gs("chakra-slider",n.className),__css:r.container,children:[n.children,l.jsx("input",{...p})]})})})});ly.displayName="Slider";var cy=he((e,t)=>{const{getThumbProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__thumb",e.className),__css:r.thumb})});cy.displayName="SliderThumb";var uy=he((e,t)=>{const{getTrackProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__track",e.className),__css:r.track})});uy.displayName="SliderTrack";var dy=he((e,t)=>{const{getInnerTrackProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__filled-track",e.className),__css:r.filledTrack})});dy.displayName="SliderFilledTrack";var If=he((e,t)=>{const{getMarkerProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__marker",e.className),__css:r.mark})});If.displayName="SliderMark";var fy=he(function(t,n){const r=fn("Switch",t),{spacing:i="0.5rem",children:s,...c}=At(t),{state:u,getInputProps:f,getCheckboxProps:h,getRootProps:p,getLabelProps:g}=E2(c),y=x.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),S=x.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),C=x.useMemo(()=>({userSelect:"none",marginStart:i,...r.label}),[i,r.label]);return l.jsxs(re.label,{...p(),className:Ae("chakra-switch",t.className),__css:y,children:[l.jsx("input",{className:"chakra-switch__input",...f({},n)}),l.jsx(re.span,{...h(),className:"chakra-switch__track",__css:S,children:l.jsx(re.span,{__css:r.thumb,className:"chakra-switch__thumb","data-checked":Ye(u.isChecked),"data-hover":Ye(u.isHovered)})}),s&&l.jsx(re.span,{className:"chakra-switch__label",...g(),__css:C,children:s})]})});fy.displayName="Switch";var[w7,k7,j7,E7]=rh();function P7(e){var t;const{defaultIndex:n,onChange:r,index:i,isManual:s,isLazy:c,lazyBehavior:u="unmount",orientation:f="horizontal",direction:h="ltr",...p}=e,[g,y]=x.useState(n??0),[S,C]=oh({defaultValue:n??0,value:i,onChange:r});x.useEffect(()=>{i!=null&&y(i)},[i]);const w=j7(),k=x.useId();return{id:`tabs-${(t=e.id)!=null?t:k}`,selectedIndex:S,focusedIndex:g,setSelectedIndex:C,setFocusedIndex:y,isManual:s,isLazy:c,lazyBehavior:u,orientation:f,descendants:w,direction:h,htmlProps:p}}var[I7,Dc]=Et({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function M7(e){const{focusedIndex:t,orientation:n,direction:r}=Dc(),i=k7(),s=x.useCallback(c=>{const u=()=>{var M;const P=i.nextEnabled(t);P&&((M=P.node)==null||M.focus())},f=()=>{var M;const P=i.prevEnabled(t);P&&((M=P.node)==null||M.focus())},h=()=>{var M;const P=i.firstEnabled();P&&((M=P.node)==null||M.focus())},p=()=>{var M;const P=i.lastEnabled();P&&((M=P.node)==null||M.focus())},g=n==="horizontal",y=n==="vertical",S=c.key,C=r==="ltr"?"ArrowLeft":"ArrowRight",w=r==="ltr"?"ArrowRight":"ArrowLeft",j={[C]:()=>g&&f(),[w]:()=>g&&u(),ArrowDown:()=>y&&u(),ArrowUp:()=>y&&f(),Home:h,End:p}[S];j&&(c.preventDefault(),j(c))},[i,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:Pe(e.onKeyDown,s)}}function T7(e){const{isDisabled:t,isFocusable:n,...r}=e,{setSelectedIndex:i,isManual:s,id:c,setFocusedIndex:u,selectedIndex:f}=Dc(),{index:h,register:p}=E7({disabled:t&&!n}),g=h===f,y=()=>{i(h)},S=()=>{u(h),!s&&!(t&&n)&&i(h)},C=kx({...r,ref:ct(p,e.ref),isDisabled:t,isFocusable:n,onClick:Pe(e.onClick,y)}),w="button";return{...C,id:hy(c,h),role:"tab",tabIndex:g?0:-1,type:w,"aria-selected":g,"aria-controls":py(c,h),onFocus:t?void 0:Pe(e.onFocus,S)}}var[_7,D7]=Et({});function O7(e){const t=Dc(),{id:n,selectedIndex:r}=t,s=lh(e.children).map((c,u)=>x.createElement(_7,{key:u,value:{isSelected:u===r,id:py(n,u),tabId:hy(n,u),selectedIndex:r}},c));return{...e,children:s}}function A7(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:i}=Dc(),{isSelected:s,id:c,tabId:u}=D7(),f=x.useRef(!1);s&&(f.current=!0);const h=zh({wasSelected:f.current,isSelected:s,enabled:r,mode:i});return{tabIndex:0,...n,children:h?t:null,role:"tabpanel","aria-labelledby":u,hidden:!s,id:c}}function hy(e,t){return`${e}--tab-${t}`}function py(e,t){return`${e}--tabpanel-${t}`}var[z7,Oc]=Et({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),my=he(function(t,n){const r=fn("Tabs",t),{children:i,className:s,...c}=At(t),{htmlProps:u,descendants:f,...h}=P7(c),p=x.useMemo(()=>h,[h]),{isFitted:g,...y}=u;return l.jsx(w7,{value:f,children:l.jsx(I7,{value:p,children:l.jsx(z7,{value:r,children:l.jsx(re.div,{className:Ae("chakra-tabs",s),ref:n,...y,__css:r.root,children:i})})})})});my.displayName="Tabs";var vy=he(function(t,n){const r=M7({...t,ref:n}),s={display:"flex",...Oc().tablist};return l.jsx(re.div,{...r,className:Ae("chakra-tabs__tablist",t.className),__css:s})});vy.displayName="TabList";var gy=he(function(t,n){const r=A7({...t,ref:n}),i=Oc();return l.jsx(re.div,{outline:"0",...r,className:Ae("chakra-tabs__tab-panel",t.className),__css:i.tabpanel})});gy.displayName="TabPanel";var xy=he(function(t,n){const r=O7(t),i=Oc();return l.jsx(re.div,{...r,width:"100%",ref:n,className:Ae("chakra-tabs__tab-panels",t.className),__css:i.tabpanels})});xy.displayName="TabPanels";var yy=he(function(t,n){const r=Oc(),i=T7({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return l.jsx(re.button,{...i,className:Ae("chakra-tabs__tab",t.className),__css:s})});yy.displayName="Tab";function R7(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var N7=["h","minH","height","minHeight"],Kh=he((e,t)=>{const n=pi("Textarea",e),{className:r,rows:i,...s}=At(e),c=ch(s),u=i?R7(n,N7):n;return l.jsx(re.textarea,{ref:t,rows:i,...c,className:Ae("chakra-textarea",r),__css:u})});Kh.displayName="Textarea";var F7={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},cc=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Mf=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function L7(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:i,closeOnScroll:s,closeOnPointerDown:c=i,closeOnEsc:u=!0,onOpen:f,onClose:h,placement:p,id:g,isOpen:y,defaultIsOpen:S,arrowSize:C=10,arrowShadowColor:w,arrowPadding:k,modifiers:j,isDisabled:M,gutter:P,offset:I,direction:T,...D}=e,{isOpen:_,onOpen:z,onClose:V}=Ah({isOpen:y,defaultIsOpen:S,onOpen:f,onClose:h}),{referenceRef:F,getPopperProps:L,getArrowInnerProps:X,getArrowProps:$}=Oh({enabled:_,placement:p,arrowPadding:k,modifiers:j,gutter:P,offset:I,direction:T}),Q=x.useId(),oe=`tooltip-${g??Q}`,U=x.useRef(null),K=x.useRef(),ne=x.useCallback(()=>{K.current&&(clearTimeout(K.current),K.current=void 0)},[]),ce=x.useRef(),Re=x.useCallback(()=>{ce.current&&(clearTimeout(ce.current),ce.current=void 0)},[]),ze=x.useCallback(()=>{Re(),V()},[V,Re]),Me=B7(U,ze),J=x.useCallback(()=>{if(!M&&!K.current){Me();const _e=Mf(U);K.current=_e.setTimeout(z,t)}},[Me,M,z,t]),ue=x.useCallback(()=>{ne();const _e=Mf(U);ce.current=_e.setTimeout(ze,n)},[n,ze,ne]),Ie=x.useCallback(()=>{_&&r&&ue()},[r,ue,_]),Be=x.useCallback(()=>{_&&c&&ue()},[c,ue,_]),Ne=x.useCallback(_e=>{_&&_e.key==="Escape"&&ue()},[_,ue]);Ui(()=>cc(U),"keydown",u?Ne:void 0),Ui(()=>cc(U),"scroll",()=>{_&&s&&ze()}),x.useEffect(()=>{M&&(ne(),_&&V())},[M,_,V,ne]),x.useEffect(()=>()=>{ne(),Re()},[ne,Re]),Ui(()=>U.current,"pointerleave",ue);const Ge=x.useCallback((_e={},qe=null)=>({..._e,ref:ct(U,qe,F),onPointerEnter:Pe(_e.onPointerEnter,Te=>{Te.pointerType!=="touch"&&J()}),onClick:Pe(_e.onClick,Ie),onPointerDown:Pe(_e.onPointerDown,Be),onFocus:Pe(_e.onFocus,J),onBlur:Pe(_e.onBlur,ue),"aria-describedby":_?oe:void 0}),[J,ue,Be,_,oe,Ie,F]),Qe=x.useCallback((_e={},qe=null)=>L({..._e,style:{..._e.style,[Vt.arrowSize.var]:C?`${C}px`:void 0,[Vt.arrowShadowColor.var]:w}},qe),[L,C,w]),ve=x.useCallback((_e={},qe=null)=>{const ge={..._e.style,position:"relative",transformOrigin:Vt.transformOrigin.varRef};return{ref:qe,...D,..._e,id:oe,role:"tooltip",style:ge}},[D,oe]);return{isOpen:_,show:J,hide:ue,getTriggerProps:Ge,getTooltipProps:ve,getTooltipPositionerProps:Qe,getArrowProps:$,getArrowInnerProps:X}}var Dd="chakra-ui:close-tooltip";function B7(e,t){return x.useEffect(()=>{const n=cc(e);return n.addEventListener(Dd,t),()=>n.removeEventListener(Dd,t)},[t,e]),()=>{const n=cc(e),r=Mf(e);n.dispatchEvent(new r.CustomEvent(Dd))}}function H7(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function W7(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var V7=re(Wr.div),Yt=he((e,t)=>{var n,r;const i=pi("Tooltip",e),s=At(e),c=Ji(),{children:u,label:f,shouldWrapChildren:h,"aria-label":p,hasArrow:g,bg:y,portalProps:S,background:C,backgroundColor:w,bgColor:k,motionProps:j,...M}=s,P=(r=(n=C??w)!=null?n:y)!=null?r:k;if(P){i.bg=P;const L=BS(c,"colors",P);i[Vt.arrowBg.var]=L}const I=L7({...M,direction:c.direction}),T=typeof u=="string"||h;let D;if(T)D=l.jsx(re.span,{display:"inline-block",tabIndex:0,...I.getTriggerProps(),children:u});else{const L=x.Children.only(u);D=x.cloneElement(L,I.getTriggerProps(L.props,L.ref))}const _=!!p,z=I.getTooltipProps({},t),V=_?H7(z,["role","id"]):z,F=W7(z,["role","id"]);return f?l.jsxs(l.Fragment,{children:[D,l.jsx(ia,{children:I.isOpen&&l.jsx(eh,{...S,children:l.jsx(re.div,{...I.getTooltipPositionerProps(),__css:{zIndex:i.zIndex,pointerEvents:"none"},children:l.jsxs(V7,{variants:F7,initial:"exit",animate:"enter",exit:"exit",...j,...V,__css:i,children:[f,_&&l.jsx(re.span,{srOnly:!0,...F,children:p}),g&&l.jsx(re.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:l.jsx(re.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:i.bg}})})]})})})})]}):l.jsx(l.Fragment,{children:u})});Yt.displayName="Tooltip";const Qh=x.createContext(null);let Vg;const Zh=()=>({setOpenUploader:e=>{e&&(Vg=e)},openUploader:Vg}),Bt=be(e=>e.ui,e=>HS[e.activeTab],{memoizeOptions:{equalityCheck:te.isEqual}}),U7=be(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:te.isEqual}}),ro=be(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:te.isEqual}}),Ug=e=>async(t,n)=>{const{imageFile:r}=e,i=n(),s=Bt(i),c=new FormData;c.append("file",r,r.name),c.append("data",JSON.stringify({kind:"init"}));const f=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:c})).json(),h={uuid:P1(),category:"user",...f};t(I1({image:h,category:"user"})),s==="unifiedCanvas"?t(bc(h)):s==="img2img"&&t(os(h))},Jh=e=>{const{children:t}=e;return l.jsx(B,{sx:{width:"100%",height:"100%",bg:"base.850"},children:t})};function $7(){const{t:e}=Z();return l.jsx(Jh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.nodes")}),l.jsx(Le,{maxW:"50rem",gap:4,children:l.jsx(Ce,{children:e("common.nodesDesc")})})]})})}const G7=()=>{const{t:e}=Z();return l.jsx(Jh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.postProcessing")}),l.jsxs(Le,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.postProcessDesc1")}),l.jsx(Ce,{children:e("common.postProcessDesc2")}),l.jsx(Ce,{children:e("common.postProcessDesc3")})]})]})})};function q7(){const{t:e}=Z();return l.jsx(Jh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.training")}),l.jsxs(Le,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.trainingDesc1")}),l.jsx(Ce,{children:e("common.trainingDesc2")})]})]})})}function Y7(e){const{i18n:t}=Z(),n=localStorage.getItem("i18nextLng");ke.useEffect(()=>{e()},[e]),ke.useEffect(()=>{t.on("languageChanged",()=>{e()})},[e,t,n])}const le=he((e,t)=>{const{tooltip:n="",tooltipProps:r,isChecked:i,...s}=e;return l.jsx(Yt,{label:n,hasArrow:!0,...r,...r!=null&&r.placement?{placement:r.placement}:{placement:"top"},children:l.jsx(ci,{ref:t,"aria-checked":i!==void 0?i:void 0,...s})})}),Je=he((e,t)=>{const{children:n,tooltip:r="",tooltipProps:i,isChecked:s,...c}=e;return l.jsx(Yt,{label:r,...i,children:l.jsx(to,{ref:t,"aria-checked":s,...c,children:n})})}),rr=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:i=!0,...s}=e;return l.jsxs(qh,{isLazy:i,...s,children:[l.jsx(Gh,{children:t}),l.jsxs(Xh,{children:[r&&l.jsx(Yh,{}),n]})]})},Ac=be(e=>e.lightbox,e=>e,{memoizeOptions:{equalityCheck:te.isEqual}}),Mn=e=>{const{label:t,isDisabled:n,validValues:r,tooltip:i,tooltipProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,onClick:u=>{u.stopPropagation(),u.nativeEvent.stopImmediatePropagation(),u.nativeEvent.stopPropagation(),u.nativeEvent.cancelBubble=!0},children:[t&&l.jsx(st,{children:t}),l.jsx(Yt,{label:i,...s,children:l.jsx(ry,{...c,children:r.map(u=>typeof u=="string"||typeof u=="number"?l.jsx("option",{value:u,children:u},u):l.jsx("option",{value:u.value,children:u.key},u.value))})})]})};function X7(){const e=O(i=>i.postprocessing.facetoolType),t=Y(),{t:n}=Z(),r=i=>t(Hl(i.target.value));return l.jsx(Mn,{label:n("parameters.type"),validValues:WS.concat(),value:e,onChange:r})}var by={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},$g=ke.createContext&&ke.createContext(by),si=globalThis&&globalThis.__assign||function(){return si=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{K(i)},[i]);const ne=x.useMemo(()=>L!=null&&L.max?L.max:c,[c,L==null?void 0:L.max]),ce=J=>{f(J)},Re=J=>{J.target.value===""&&(J.target.value=String(s));const ue=te.clamp(y?Math.floor(Number(J.target.value)):Number(U),s,ne);f(ue)},ze=J=>{K(J)},Me=()=>{M&&M()};return l.jsxs(rt,{sx:j?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},...D,children:[l.jsx(st,{..._,mb:-1,children:r}),l.jsxs(sa,{w:"100%",gap:2,alignItems:"center",children:[l.jsxs(ly,{"aria-label":r,value:i,min:s,max:c,step:u,onChange:ce,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:I,...oe,children:[p&&l.jsxs(l.Fragment,{children:[l.jsx(If,{value:s,insetInlineStart:0,sx:{insetInlineStart:"unset !important"},...z,children:s}),l.jsx(If,{value:c,insetInlineEnd:0,sx:{insetInlineStart:"unset !important"},...z,children:c})]}),l.jsx(uy,{...V,children:l.jsx(dy,{})}),l.jsx(Yt,{hasArrow:!0,placement:"top",isOpen:t,label:`${i}${h}`,hidden:k,...Q,children:l.jsx(cy,{...F})})]}),g&&l.jsxs(Bh,{min:s,max:ne,step:u,value:U,onChange:ze,onBlur:Re,isDisabled:T,...L,children:[l.jsx(Wh,{readOnly:C,minWidth:S,...X}),l.jsxs(Hh,{...$,children:[l.jsx(Uh,{onClick:()=>f(Number(U))}),l.jsx(Vh,{onClick:()=>f(Number(U))})]})]}),w&&l.jsx(le,{size:"sm","aria-label":"Reset",tooltip:"Reset",icon:l.jsx(ep,{}),onClick:Me,isDisabled:P,...ie})]})]})}function r8(){const e=O(i=>i.system.isGFPGANAvailable),t=O(i=>i.postprocessing.facetoolStrength),{t:n}=Z(),r=Y();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.strength"),step:.05,min:0,max:1,onChange:i=>r(Zl(i)),handleReset:()=>r(Zl(.75)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}function i8(){const e=O(i=>i.system.isGFPGANAvailable),t=O(i=>i.postprocessing.codeformerFidelity),{t:n}=Z(),r=Y();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.codeformerFidelity"),step:.05,min:0,max:1,onChange:i=>r(Qd(i)),handleReset:()=>r(Qd(1)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}const tp=()=>{const e=O(t=>t.postprocessing.facetoolType);return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(X7,{}),l.jsx(r8,{}),e==="codeformer"&&l.jsx(i8,{})]})};function o8(){const e=O(i=>i.system.isESRGANAvailable),t=O(i=>i.postprocessing.upscalingDenoising),{t:n}=Z(),r=Y();return l.jsx(ut,{label:n("parameters.denoisingStrength"),value:t,min:0,max:1,step:.01,onChange:i=>{r(Zd(i))},handleReset:()=>r(Zd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function a8(){const e=O(i=>i.system.isESRGANAvailable),t=O(i=>i.postprocessing.upscalingStrength),{t:n}=Z(),r=Y();return l.jsx(ut,{label:`${n("parameters.upscale")} ${n("parameters.strength")}`,value:t,min:0,max:1,step:.05,onChange:i=>r(Jd(i)),handleReset:()=>r(Jd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function s8(){const e=O(s=>s.system.isESRGANAvailable),t=O(s=>s.postprocessing.upscalingLevel),{t:n}=Z(),r=Y(),i=s=>r(M1(Number(s.target.value)));return l.jsx(Mn,{isDisabled:!e,label:n("parameters.scale"),value:t,onChange:i,validValues:VS})}const np=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(s8,{}),l.jsx(o8,{}),l.jsx(a8,{})]}),rp=e=>e.postprocessing,Pt=e=>e.system,l8=e=>e.system.toastQueue,wy=be(Pt,e=>{const{model_list:t}=e,n=te.reduce(t,(r,i,s)=>(i.status==="active"&&(r=s),r),"");return{...t[n],name:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),c8=be(Pt,e=>{const{model_list:t}=e;return te.pickBy(t,(r,i)=>{if(r.format==="diffusers")return{name:i,...r}})},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function Tf(){return Tf=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var g8=function(t,n,r){r===void 0&&(r=!1);var i=n.alt,s=n.meta,c=n.mod,u=n.shift,f=n.ctrl,h=n.keys,p=t.key,g=t.code,y=t.ctrlKey,S=t.metaKey,C=t.shiftKey,w=t.altKey,k=ii(g),j=p.toLowerCase();if(!r){if(i===!w&&j!=="alt"||u===!C&&j!=="shift")return!1;if(c){if(!S&&!y)return!1}else if(s===!S&&j!=="meta"||f===!y&&j!=="ctrl")return!1}return h&&h.length===1&&(h.includes(j)||h.includes(k))?!0:h?f8(h):!h},x8=x.createContext(void 0),y8=function(){return x.useContext(x8)};function Iy(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&Iy(e[r],t[r])},!0):e===t}var b8=x.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),S8=function(){return x.useContext(b8)};function C8(e){var t=x.useRef(void 0);return Iy(t.current,e)||(t.current=e),t.current}var Gg=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},w8=typeof window<"u"?x.useLayoutEffect:x.useEffect;function fe(e,t,n,r){var i=x.useRef(null),s=x.useRef(!1),c=n instanceof Array?r instanceof Array?void 0:r:n,u=n instanceof Array?n:r instanceof Array?r:void 0,f=x.useCallback(t,u??[]),h=x.useRef(f);u?h.current=f:h.current=t;var p=C8(c),g=S8(),y=g.enabledScopes,S=y8();return w8(function(){if(!((p==null?void 0:p.enabled)===!1||!v8(y,p==null?void 0:p.scopes))){var C=function(M,P){var I;if(P===void 0&&(P=!1),!(m8(M)&&!Py(M,p==null?void 0:p.enableOnFormTags))){if(i.current!==null&&document.activeElement!==i.current&&!i.current.contains(document.activeElement)){Gg(M);return}(I=M.target)!=null&&I.isContentEditable&&!(p!=null&&p.enableOnContentEditable)||Od(e,p==null?void 0:p.splitKey).forEach(function(T){var D,_=Ad(T,p==null?void 0:p.combinationKey);if(g8(M,_,p==null?void 0:p.ignoreModifiers)||(D=_.keys)!=null&&D.includes("*")){if(P&&s.current)return;if(h8(M,_,p==null?void 0:p.preventDefault),!p8(M,_,p==null?void 0:p.enabled)){Gg(M);return}h.current(M,_),P||(s.current=!0)}})}},w=function(M){M.key!==void 0&&(jy(ii(M.code)),((p==null?void 0:p.keydown)===void 0&&(p==null?void 0:p.keyup)!==!0||p!=null&&p.keydown)&&C(M))},k=function(M){M.key!==void 0&&(Ey(ii(M.code)),s.current=!1,p!=null&&p.keyup&&C(M,!0))};return(i.current||(c==null?void 0:c.document)||document).addEventListener("keyup",k),(i.current||(c==null?void 0:c.document)||document).addEventListener("keydown",w),S&&Od(e,p==null?void 0:p.splitKey).forEach(function(j){return S.addHotkey(Ad(j,p==null?void 0:p.combinationKey))}),function(){(i.current||(c==null?void 0:c.document)||document).removeEventListener("keyup",k),(i.current||(c==null?void 0:c.document)||document).removeEventListener("keydown",w),S&&Od(e,p==null?void 0:p.splitKey).forEach(function(j){return S.removeHotkey(Ad(j,p==null?void 0:p.combinationKey))})}}},[e,p,y]),i}function k8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"}}]})(e)}function j8(e){return me({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"}}]})(e)}function E8(e){return me({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"}}]})(e)}function P8(e){return me({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"}}]})(e)}function I8(e){return me({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"}}]})(e)}function M8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"}}]})(e)}function T8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"}}]})(e)}function My(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"}}]})(e)}function _8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"}}]})(e)}function D8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z"}}]})(e)}function zc(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}}]})(e)}function Ty(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}}]})(e)}function Jo(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"}}]})(e)}function _y(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500 224h-30.364C455.724 130.325 381.675 56.276 288 42.364V12c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v30.364C130.325 56.276 56.276 130.325 42.364 224H12c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h30.364C56.276 381.675 130.325 455.724 224 469.636V500c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-30.364C381.675 455.724 455.724 381.675 469.636 288H500c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12zM288 404.634V364c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40.634C165.826 392.232 119.783 346.243 107.366 288H148c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-40.634C119.768 165.826 165.757 119.783 224 107.366V148c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-40.634C346.174 119.768 392.217 165.757 404.634 224H364c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40.634C392.232 346.174 346.243 392.217 288 404.634zM288 256c0 17.673-14.327 32-32 32s-32-14.327-32-32c0-17.673 14.327-32 32-32s32 14.327 32 32z"}}]})(e)}function O8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"}}]})(e)}function ip(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Dy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"}}]})(e)}function A8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 344v112a23.94 23.94 0 0 1-24 24H312c-21.39 0-32.09-25.9-17-41l36.2-36.2L224 295.6 116.77 402.9 153 439c15.09 15.1 4.39 41-17 41H24a23.94 23.94 0 0 1-24-24V344c0-21.4 25.89-32.1 41-17l36.19 36.2L184.46 256 77.18 148.7 41 185c-15.1 15.1-41 4.4-41-17V56a23.94 23.94 0 0 1 24-24h112c21.39 0 32.09 25.9 17 41l-36.2 36.2L224 216.4l107.23-107.3L295 73c-15.09-15.1-4.39-41 17-41h112a23.94 23.94 0 0 1 24 24v112c0 21.4-25.89 32.1-41 17l-36.19-36.2L263.54 256l107.28 107.3L407 327.1c15.1-15.2 41-4.5 41 16.9z"}}]})(e)}function z8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"}}]})(e)}function Oy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M50.75 333.25c-12 12-18.75 28.28-18.75 45.26V424L0 480l32 32 56-32h45.49c16.97 0 33.25-6.74 45.25-18.74l126.64-126.62-128-128L50.75 333.25zM483.88 28.12c-37.47-37.5-98.28-37.5-135.75 0l-77.09 77.09-13.1-13.1c-9.44-9.44-24.65-9.31-33.94 0l-40.97 40.97c-9.37 9.37-9.37 24.57 0 33.94l161.94 161.94c9.44 9.44 24.65 9.31 33.94 0L419.88 288c9.37-9.37 9.37-24.57 0-33.94l-13.1-13.1 77.09-77.09c37.51-37.48 37.51-98.26.01-135.75z"}}]})(e)}function R8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"}}]})(e)}function N8(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"}}]})(e)}function Ay(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M512 320s-64 92.65-64 128c0 35.35 28.66 64 64 64s64-28.65 64-64-64-128-64-128zm-9.37-102.94L294.94 9.37C288.69 3.12 280.5 0 272.31 0s-16.38 3.12-22.62 9.37l-81.58 81.58L81.93 4.76c-6.25-6.25-16.38-6.25-22.62 0L36.69 27.38c-6.24 6.25-6.24 16.38 0 22.62l86.19 86.18-94.76 94.76c-37.49 37.48-37.49 98.26 0 135.75l117.19 117.19c18.74 18.74 43.31 28.12 67.87 28.12 24.57 0 49.13-9.37 67.87-28.12l221.57-221.57c12.5-12.5 12.5-32.75.01-45.25zm-116.22 70.97H65.93c1.36-3.84 3.57-7.98 7.43-11.83l13.15-13.15 81.61-81.61 58.6 58.6c12.49 12.49 32.75 12.49 45.24 0s12.49-32.75 0-45.24l-58.6-58.6 58.95-58.95 162.44 162.44-48.34 48.34z"}}]})(e)}function F8(e){return me({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zM94.6 168.9l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.2 1 8.9 8.6 4.3 13.2l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L152 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.6-4.7-1.9-12.3 4.3-13.3zM248 432c-60.6 0-134.5-38.3-143.8-93.3-2-11.8 9.3-21.5 20.7-17.9C155.1 330.5 200 336 248 336s92.9-5.5 123.1-15.2c11.5-3.7 22.6 6.1 20.7 17.9-9.3 55-83.2 93.3-143.8 93.3zm157.7-249.9l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L344 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.5-4.6-1.9-12.2 4.3-13.2l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.3.9 9 8.5 4.4 13.1z"}}]})(e)}function L8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"}}]})(e)}function B8(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h480c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM128 180v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H172c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z"}}]})(e)}function H8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z"}}]})(e)}function zy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M12.41 148.02l232.94 105.67c6.8 3.09 14.49 3.09 21.29 0l232.94-105.67c16.55-7.51 16.55-32.52 0-40.03L266.65 2.31a25.607 25.607 0 0 0-21.29 0L12.41 107.98c-16.55 7.51-16.55 32.53 0 40.04zm487.18 88.28l-58.09-26.33-161.64 73.27c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.51 209.97l-58.1 26.33c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 276.3c16.55-7.5 16.55-32.5 0-40zm0 127.8l-57.87-26.23-161.86 73.37c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.29 337.87 12.41 364.1c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 404.1c16.55-7.5 16.55-32.5 0-40z"}}]})(e)}function W8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320.67 64c-442.6 0-357.57 384-158.46 384 39.9 0 77.47-20.69 101.42-55.86l25.73-37.79c15.66-22.99 46.97-22.99 62.63 0l25.73 37.79C401.66 427.31 439.23 448 479.13 448c189.86 0 290.63-384-158.46-384zM184 308.36c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05zm272 0c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05z"}}]})(e)}function V8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function Ry(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M167.02 309.34c-40.12 2.58-76.53 17.86-97.19 72.3-2.35 6.21-8 9.98-14.59 9.98-11.11 0-45.46-27.67-55.25-34.35C0 439.62 37.93 512 128 512c75.86 0 128-43.77 128-120.19 0-3.11-.65-6.08-.97-9.13l-88.01-73.34zM457.89 0c-15.16 0-29.37 6.71-40.21 16.45C213.27 199.05 192 203.34 192 257.09c0 13.7 3.25 26.76 8.73 38.7l63.82 53.18c7.21 1.8 14.64 3.03 22.39 3.03 62.11 0 98.11-45.47 211.16-256.46 7.38-14.35 13.9-29.85 13.9-45.99C512 20.64 486 0 457.89 0z"}}]})(e)}function U8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"}}]})(e)}function $8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function xs(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function G8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z"}}]})(e)}function q8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"}}]})(e)}function Y8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"}}]})(e)}function op(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"}}]})(e)}function X8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"}}]})(e)}function K8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z"}}]})(e)}function Q8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 320c-22.608 0-43.387 7.819-59.79 20.895l-102.486-64.054a96.551 96.551 0 0 0 0-41.683l102.486-64.054C308.613 184.181 329.392 192 352 192c53.019 0 96-42.981 96-96S405.019 0 352 0s-96 42.981-96 96c0 7.158.79 14.13 2.276 20.841L155.79 180.895C139.387 167.819 118.608 160 96 160c-53.019 0-96 42.981-96 96s42.981 96 96 96c22.608 0 43.387-7.819 59.79-20.895l102.486 64.054A96.301 96.301 0 0 0 256 416c0 53.019 42.981 96 96 96s96-42.981 96-96-42.981-96-96-96z"}}]})(e)}function qg(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"}}]})(e)}function ap(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"}}]})(e)}function Z8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"}}]})(e)}function io(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}function J8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z"}}]})(e)}function Rc(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function e9(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"}}]})(e)}function sp(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"}}]})(e)}const tt=e=>e.canvas,zt=be([tt,Bt,Pt],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),Ny=e=>e.canvas.layerState.objects.find(T1),Vr=e=>e.gallery,t9=be([Vr,Ac,zt,Bt],(e,t,n,r)=>{const{categories:i,currentCategory:s,currentImageUuid:c,shouldPinGallery:u,shouldShowGallery:f,galleryImageMinimumWidth:h,galleryImageObjectFit:p,shouldHoldGalleryOpen:g,shouldAutoSwitchToNewImages:y,galleryWidth:S,shouldUseSingleGalleryColumn:C}=e,{isLightboxOpen:w}=t;return{currentImageUuid:c,shouldPinGallery:u,shouldShowGallery:f,galleryImageMinimumWidth:h,galleryImageObjectFit:p,galleryGridTemplateColumns:C?"auto":`repeat(auto-fill, minmax(${h}px, auto))`,activeTabName:r,shouldHoldGalleryOpen:g,shouldAutoSwitchToNewImages:y,images:i[s].images,areMoreImagesAvailable:i[s].areMoreImagesAvailable,currentCategory:s,galleryWidth:S,isLightboxOpen:w,isStaging:n,shouldEnableResize:!(w||r==="unifiedCanvas"&&u),shouldUseSingleGalleryColumn:C}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),n9=be([Vr,Pt,Ac,Bt],(e,t,n,r)=>({mayDeleteImage:t.isConnected&&!t.isProcessing,galleryImageObjectFit:e.galleryImageObjectFit,galleryImageMinimumWidth:e.galleryImageMinimumWidth,shouldUseSingleGalleryColumn:e.shouldUseSingleGalleryColumn,activeTabName:r,isLightboxOpen:n.isLightboxOpen}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),En=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:i,formLabelProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,width:r,display:"flex",gap:4,alignItems:"center",justifyContent:"space-between",...i,children:[l.jsx(st,{my:1,...s,children:t}),l.jsx(fy,{...c})]})},r9=be(Pt,e=>{const{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}=e;return{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),uc=he(({image:e,children:t},n)=>{const{isOpen:r,onOpen:i,onClose:s}=ui(),c=Y(),{shouldConfirmOnDelete:u,isConnected:f,isProcessing:h}=O(r9),p=x.useRef(null),g=C=>{C.stopPropagation(),u?i():y()},y=()=>{f&&!h&&e&&c(US(e)),s()};fe("delete",()=>{u?i():y()},[e,u,f,h]);const S=C=>c(_1(!C.target.checked));return l.jsxs(l.Fragment,{children:[x.cloneElement(t,{onClick:e?g:void 0,ref:n}),l.jsx(Xx,{isOpen:r,leastDestructiveRef:p,onClose:s,children:l.jsx(Nr,{children:l.jsxs(Kx,{children:[l.jsx(Rr,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),l.jsx(Fr,{children:l.jsxs(B,{direction:"column",gap:5,children:[l.jsx(Ce,{children:"Are you sure? Deleted images will be sent to the Bin. You can restore from there if you wish to."}),l.jsx(En,{label:"Don't ask me again",isChecked:!u,onChange:S})]})}),l.jsxs(zr,{children:[l.jsx(Je,{ref:p,onClick:s,children:"Cancel"}),l.jsx(Je,{colorScheme:"error",onClick:y,ml:3,children:"Delete"})]})]})})})]})});uc.displayName="DeleteImageModal";const lp=()=>{const e=Y();return t=>{const n=typeof t=="string"?t:D1(t),[r,i]=$S(n);e(O1(r)),e(A1(i))}},i9=be([Pt,Vr,rp,ro,Ac,Bt],(e,t,n,r,i,s)=>{const{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h}=e,{upscalingLevel:p,facetoolStrength:g}=n,{isLightboxOpen:y}=i,{shouldShowImageDetails:S}=r,{intermediateImage:C,currentImage:w}=t;return{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h,upscalingLevel:p,facetoolStrength:g,shouldDisableToolbarButtons:Boolean(C)||!w,currentImage:w,shouldShowImageDetails:S,activeTabName:s,isLightboxOpen:y}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Fy=e=>{var L,X,$,Q,ie,oe,U,K;const t=Y(),{isProcessing:n,isConnected:r,isGFPGANAvailable:i,isESRGANAvailable:s,upscalingLevel:c,facetoolStrength:u,shouldDisableToolbarButtons:f,shouldShowImageDetails:h,currentImage:p,isLightboxOpen:g,activeTabName:y}=O(i9),S=us(),{t:C}=Z(),w=lp(),k=()=>{p&&(g&&t(Bi(!1)),t(os(p)),t(jn("img2img")))},j=async()=>{if(!p)return;const ne=await fetch(p.url).then(Re=>Re.blob()),ce=[new ClipboardItem({[ne.type]:ne})];await navigator.clipboard.write(ce),S({title:C("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})},M=()=>{navigator.clipboard.writeText(p?window.location.toString()+p.url:"").then(()=>{S({title:C("toast.imageLinkCopied"),status:"success",duration:2500,isClosable:!0})})};fe("shift+i",()=>{p?(k(),S({title:C("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.imageNotLoaded"),description:C("toast.imageNotLoadedDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const P=()=>{var ne,ce;p&&(p.metadata&&t(z1(p.metadata)),((ne=p.metadata)==null?void 0:ne.image.type)==="img2img"?t(jn("img2img")):((ce=p.metadata)==null?void 0:ce.image.type)==="txt2img"&&t(jn("txt2img")))};fe("a",()=>{var ne,ce;["txt2img","img2img"].includes((ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)==null?void 0:ce.type)?(P(),S({title:C("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.parametersNotSet"),description:C("toast.parametersNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const I=()=>{p!=null&&p.metadata&&t(as(p.metadata.image.seed))};fe("s",()=>{var ne,ce;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.seed?(I(),S({title:C("toast.seedSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.seedNotSet"),description:C("toast.seedNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const T=x.useCallback(()=>{var ne,ce,Re,ze;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.prompt&&w((ze=(Re=p==null?void 0:p.metadata)==null?void 0:Re.image)==null?void 0:ze.prompt)},[(X=(L=p==null?void 0:p.metadata)==null?void 0:L.image)==null?void 0:X.prompt,w]);fe("p",()=>{var ne,ce;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.prompt?(T(),S({title:C("toast.promptSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.promptNotSet"),description:C("toast.promptNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const D=()=>{p&&t(GS(p))};fe("Shift+U",()=>{s&&!f&&r&&!n&&c?D():S({title:C("toast.upscalingFailed"),status:"error",duration:2500,isClosable:!0})},[p,s,f,r,n,c]);const _=()=>{p&&t(qS(p))};fe("Shift+R",()=>{i&&!f&&r&&!n&&u?_():S({title:C("toast.faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})},[p,i,f,r,n,u]);const z=()=>t(R1(!h)),V=()=>{p&&(g&&t(Bi(!1)),t(bc(p)),t(on(!0)),y!=="unifiedCanvas"&&t(jn("unifiedCanvas")),S({title:C("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))};fe("i",()=>{p?z():S({title:C("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[p,h]);const F=()=>{t(Bi(!g))};return l.jsxs(B,{sx:{justifyContent:"center",alignItems:"center",columnGap:"0.5em"},...e,children:[l.jsxs(en,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":`${C("parameters.sendTo")}...`,icon:l.jsx(Q8,{})}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:2,w:52},children:[l.jsx(Je,{size:"sm",onClick:k,leftIcon:l.jsx(qg,{}),children:C("parameters.sendToImg2Img")}),l.jsx(Je,{size:"sm",onClick:V,leftIcon:l.jsx(qg,{}),children:C("parameters.sendToUnifiedCanvas")}),l.jsx(Je,{size:"sm",onClick:j,leftIcon:l.jsx(Jo,{}),children:C("parameters.copyImage")}),l.jsx(Je,{size:"sm",onClick:M,leftIcon:l.jsx(Jo,{}),children:C("parameters.copyImageToLink")}),l.jsx($i,{download:!0,href:p==null?void 0:p.url,children:l.jsx(Je,{leftIcon:l.jsx(ip,{}),size:"sm",w:"100%",children:C("parameters.downloadImage")})})]})}),l.jsx(le,{icon:l.jsx(z8,{}),tooltip:g?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,"aria-label":g?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,isChecked:g,onClick:F})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{icon:l.jsx(G8,{}),tooltip:`${C("parameters.usePrompt")} (P)`,"aria-label":`${C("parameters.usePrompt")} (P)`,isDisabled:!((Q=($=p==null?void 0:p.metadata)==null?void 0:$.image)!=null&&Q.prompt),onClick:T}),l.jsx(le,{icon:l.jsx(K8,{}),tooltip:`${C("parameters.useSeed")} (S)`,"aria-label":`${C("parameters.useSeed")} (S)`,isDisabled:!((oe=(ie=p==null?void 0:p.metadata)==null?void 0:ie.image)!=null&&oe.seed),onClick:I}),l.jsx(le,{icon:l.jsx(_8,{}),tooltip:`${C("parameters.useAll")} (A)`,"aria-label":`${C("parameters.useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes((K=(U=p==null?void 0:p.metadata)==null?void 0:U.image)==null?void 0:K.type),onClick:P})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{icon:l.jsx(F8,{}),"aria-label":C("parameters.restoreFaces")}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:4},children:[l.jsx(tp,{}),l.jsx(Je,{isDisabled:!i||!p||!(r&&!n)||!u,onClick:_,children:C("parameters.restoreFaces")})]})}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{icon:l.jsx(A8,{}),"aria-label":C("parameters.upscale")}),children:l.jsxs(B,{sx:{flexDirection:"column",gap:4},children:[l.jsx(np,{}),l.jsx(Je,{isDisabled:!s||!p||!(r&&!n)||!c,onClick:D,children:C("parameters.upscaleImage")})]})})]}),l.jsx(en,{isAttached:!0,children:l.jsx(le,{icon:l.jsx(Ty,{}),tooltip:`${C("parameters.info")} (I)`,"aria-label":`${C("parameters.info")} (I)`,isChecked:h,onClick:z})}),l.jsx(uc,{image:p,children:l.jsx(le,{icon:l.jsx(io,{}),tooltip:`${C("parameters.deleteImage")} (Del)`,"aria-label":`${C("parameters.deleteImage")} (Del)`,isDisabled:!p||!r||n,colorScheme:"error"})})]})};var o9=globalThis&&globalThis.__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 s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Wt=globalThis&&globalThis.__assign||function(){return Wt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"u"?void 0:Number(r),maxHeight:typeof i>"u"?void 0:Number(i),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof c>"u"?void 0:Number(c)}},f9=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Zg="__resizable_base__",Ly=function(e){l9(t,e);function t(n){var r=e.call(this,n)||this;return r.ratio=1,r.resizable=null,r.parentLeft=0,r.parentTop=0,r.resizableLeft=0,r.resizableRight=0,r.resizableTop=0,r.resizableBottom=0,r.targetLeft=0,r.targetTop=0,r.appendBase=function(){if(!r.resizable||!r.window)return null;var i=r.parentNode;if(!i)return null;var s=r.window.document.createElement("div");return s.style.width="100%",s.style.height="100%",s.style.position="absolute",s.style.transform="scale(0, 0)",s.style.left="0",s.style.flex="0 0 100%",s.classList?s.classList.add(Zg):s.className+=Zg,i.appendChild(s),s},r.removeBase=function(i){var s=r.parentNode;s&&s.removeChild(i)},r.ref=function(i){i&&(r.resizable=i)},r.state={isResizing:!1,width:typeof(r.propsSize&&r.propsSize.width)>"u"?"auto":r.propsSize&&r.propsSize.width,height:typeof(r.propsSize&&r.propsSize.height)>"u"?"auto":r.propsSize&&r.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},r.onResizeStart=r.onResizeStart.bind(r),r.onMouseMove=r.onMouseMove.bind(r),r.onMouseUp=r.onMouseUp.bind(r),r}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||c9},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,s=this.resizable.offsetHeight,c=this.resizable.style.position;c!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:i,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=c}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,i=function(u){if(typeof n.state[u]>"u"||n.state[u]==="auto")return"auto";if(n.propsSize&&n.propsSize[u]&&n.propsSize[u].toString().endsWith("%")){if(n.state[u].toString().endsWith("%"))return n.state[u].toString();var f=n.getParentSize(),h=Number(n.state[u].toString().replace("px","")),p=h/f[u]*100;return p+"%"}return zd(n.state[u])},s=r&&typeof r.width<"u"&&!this.state.isResizing?zd(r.width):i("width"),c=r&&typeof r.height<"u"&&!this.state.isResizing?zd(r.height):i("height");return{width:s,height:c}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,i=this.parentNode.style.flexWrap;i!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=i),this.removeBase(n),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var i=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof i>"u"||i==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var i=this.props.boundsByDirection,s=this.state.direction,c=i&&Do("left",s),u=i&&Do("top",s),f,h;if(this.props.bounds==="parent"){var p=this.parentNode;p&&(f=c?this.resizableRight-this.parentLeft:p.offsetWidth+(this.parentLeft-this.resizableLeft),h=u?this.resizableBottom-this.parentTop:p.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(f=c?this.resizableRight:this.window.innerWidth-this.resizableLeft,h=u?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(f=c?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),h=u?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return f&&Number.isFinite(f)&&(n=n&&n"u"?10:s.width,g=typeof i.width>"u"||i.width<0?n:i.width,y=typeof s.height>"u"?10:s.height,S=typeof i.height>"u"||i.height<0?r:i.height,C=f||0,w=h||0;if(u){var k=(y-C)*this.ratio+w,j=(S-C)*this.ratio+w,M=(p-w)/this.ratio+C,P=(g-w)/this.ratio+C,I=Math.max(p,k),T=Math.min(g,j),D=Math.max(y,M),_=Math.min(S,P);n=_l(n,I,T),r=_l(r,D,_)}else n=_l(n,p,g),r=_l(r,y,S);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var s=this.resizable.getBoundingClientRect(),c=s.left,u=s.top,f=s.right,h=s.bottom;this.resizableLeft=c,this.resizableRight=f,this.resizableTop=u,this.resizableBottom=h}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var i=0,s=0;if(n.nativeEvent&&u9(n.nativeEvent)?(i=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Dl(n.nativeEvent)&&(i=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var c=this.props.onResizeStart(n,r,this.resizable);if(c===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var u,f=this.window.getComputedStyle(this.resizable);if(f.flexBasis!=="auto"){var h=this.parentNode;if(h){var p=this.window.getComputedStyle(h).flexDirection;this.flexDir=p.startsWith("row")?"row":"column",u=f.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var g={original:{x:i,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:mr(mr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:u};this.setState(g)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Dl(n))try{n.preventDefault(),n.stopPropagation()}catch{}var i=this.props,s=i.maxWidth,c=i.maxHeight,u=i.minWidth,f=i.minHeight,h=Dl(n)?n.touches[0].clientX:n.clientX,p=Dl(n)?n.touches[0].clientY:n.clientY,g=this.state,y=g.direction,S=g.original,C=g.width,w=g.height,k=this.getParentSize(),j=d9(k,this.window.innerWidth,this.window.innerHeight,s,c,u,f);s=j.maxWidth,c=j.maxHeight,u=j.minWidth,f=j.minHeight;var M=this.calculateNewSizeFromDirection(h,p),P=M.newHeight,I=M.newWidth,T=this.calculateNewMaxFromBoundary(s,c);this.props.snap&&this.props.snap.x&&(I=Qg(I,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(P=Qg(P,this.props.snap.y,this.props.snapGap));var D=this.calculateNewSizeFromAspectRatio(I,P,{width:T.maxWidth,height:T.maxHeight},{width:u,height:f});if(I=D.newWidth,P=D.newHeight,this.props.grid){var _=Kg(I,this.props.grid[0]),z=Kg(P,this.props.grid[1]),V=this.props.snapGap||0;I=V===0||Math.abs(_-I)<=V?_:I,P=V===0||Math.abs(z-P)<=V?z:P}var F={width:I-S.width,height:P-S.height};if(C&&typeof C=="string"){if(C.endsWith("%")){var L=I/k.width*100;I=L+"%"}else if(C.endsWith("vw")){var X=I/this.window.innerWidth*100;I=X+"vw"}else if(C.endsWith("vh")){var $=I/this.window.innerHeight*100;I=$+"vh"}}if(w&&typeof w=="string"){if(w.endsWith("%")){var L=P/k.height*100;P=L+"%"}else if(w.endsWith("vw")){var X=P/this.window.innerWidth*100;P=X+"vw"}else if(w.endsWith("vh")){var $=P/this.window.innerHeight*100;P=$+"vh"}}var Q={width:this.createSizeForCssProperty(I,"width"),height:this.createSizeForCssProperty(P,"height")};this.flexDir==="row"?Q.flexBasis=Q.width:this.flexDir==="column"&&(Q.flexBasis=Q.height),YS.flushSync(function(){r.setState(Q)}),this.props.onResize&&this.props.onResize(n,y,this.resizable,F)}},t.prototype.onMouseUp=function(n){var r=this.state,i=r.isResizing,s=r.direction,c=r.original;if(!(!i||!this.resizable)){var u={width:this.size.width-c.width,height:this.size.height-c.height};this.props.onResizeStop&&this.props.onResizeStop(n,s,this.resizable,u),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:mr(mr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){this.setState({width:n.width,height:n.height})},t.prototype.renderResizer=function(){var n=this,r=this.props,i=r.enable,s=r.handleStyles,c=r.handleClasses,u=r.handleWrapperStyle,f=r.handleWrapperClass,h=r.handleComponent;if(!i)return null;var p=Object.keys(i).map(function(g){return i[g]!==!1?x.createElement(s9,{key:g,direction:g,onResizeStart:n.onResizeStart,replaceStyles:s&&s[g],className:c&&c[g]},h&&h[g]?h[g]:null):null});return x.createElement("div",{className:f,style:u},p)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(c,u){return f9.indexOf(u)!==-1||(c[u]=n.props[u]),c},{}),i=mr(mr(mr({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return x.createElement(s,mr({ref:this.ref,style:i,className:this.props.className},r),this.state.isResizing&&x.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(x.PureComponent);const pt=e=>{const{label:t,...n}=e;return l.jsx(P2,{colorScheme:"accent",...n,children:t})};function By(e){return me({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function Hy(e){return me({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}function h9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M16.5 9c-.42 0-.83.04-1.24.11L1.01 3 1 10l9 2-9 2 .01 7 8.07-3.46C9.59 21.19 12.71 24 16.5 24c4.14 0 7.5-3.36 7.5-7.5S20.64 9 16.5 9zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5z"}},{tag:"path",attr:{d:"M18.27 14.03l-1.77 1.76-1.77-1.76-.7.7 1.76 1.77-1.76 1.77.7.7 1.77-1.76 1.77 1.76.7-.7-1.76-1.77 1.76-1.77z"}}]})(e)}function p9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}}]})(e)}function m9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}}]})(e)}function v9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}}]})(e)}function g9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function x9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 2v11h3v9l7-12h-4l4-8z"}}]})(e)}function Jg(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}}]})(e)}function y9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function b9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.02 10v9H5V5h9V3H5.02c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2zM17 10l.94-2.06L20 7l-2.06-.94L17 4l-.94 2.06L14 7l2.06.94zm-3.75.75L12 8l-1.25 2.75L8 12l2.75 1.25L12 16l1.25-2.75L16 12z"}}]})(e)}function cp(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function S9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}}]})(e)}function C9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 10l5 5 5-5z"}}]})(e)}function w9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 14l5-5 5 5z"}}]})(e)}function k9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}function j9(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function E9(e,t){e.classList?e.classList.add(t):j9(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function e0(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function P9(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=e0(e.className,t):e.setAttribute("class",e0(e.className&&e.className.baseVal||"",t))}const t0={disabled:!1},Wy=ke.createContext(null);var Vy=function(t){return t.scrollTop},La="unmounted",Ai="exited",zi="entering",Ao="entered",_f="exiting",Ur=function(e){vh(t,e);function t(r,i){var s;s=e.call(this,r,i)||this;var c=i,u=c&&!c.isMounting?r.enter:r.appear,f;return s.appearStatus=null,r.in?u?(f=Ai,s.appearStatus=zi):f=Ao:r.unmountOnExit||r.mountOnEnter?f=La:f=Ai,s.state={status:f},s.nextCallback=null,s}t.getDerivedStateFromProps=function(i,s){var c=i.in;return c&&s.status===La?{status:Ai}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(i){var s=null;if(i!==this.props){var c=this.state.status;this.props.in?c!==zi&&c!==Ao&&(s=zi):(c===zi||c===Ao)&&(s=_f)}this.updateStatus(!1,s)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var i=this.props.timeout,s,c,u;return s=c=u=i,i!=null&&typeof i!="number"&&(s=i.exit,c=i.enter,u=i.appear!==void 0?i.appear:c),{exit:s,enter:c,appear:u}},n.updateStatus=function(i,s){if(i===void 0&&(i=!1),s!==null)if(this.cancelNextCallback(),s===zi){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:vl.findDOMNode(this);c&&Vy(c)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ai&&this.setState({status:La})},n.performEnter=function(i){var s=this,c=this.props.enter,u=this.context?this.context.isMounting:i,f=this.props.nodeRef?[u]:[vl.findDOMNode(this),u],h=f[0],p=f[1],g=this.getTimeouts(),y=u?g.appear:g.enter;if(!i&&!c||t0.disabled){this.safeSetState({status:Ao},function(){s.props.onEntered(h)});return}this.props.onEnter(h,p),this.safeSetState({status:zi},function(){s.props.onEntering(h,p),s.onTransitionEnd(y,function(){s.safeSetState({status:Ao},function(){s.props.onEntered(h,p)})})})},n.performExit=function(){var i=this,s=this.props.exit,c=this.getTimeouts(),u=this.props.nodeRef?void 0:vl.findDOMNode(this);if(!s||t0.disabled){this.safeSetState({status:Ai},function(){i.props.onExited(u)});return}this.props.onExit(u),this.safeSetState({status:_f},function(){i.props.onExiting(u),i.onTransitionEnd(c.exit,function(){i.safeSetState({status:Ai},function(){i.props.onExited(u)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(i,s){s=this.setNextCallback(s),this.setState(i,s)},n.setNextCallback=function(i){var s=this,c=!0;return this.nextCallback=function(u){c&&(c=!1,s.nextCallback=null,i(u))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},n.onTransitionEnd=function(i,s){this.setNextCallback(s);var c=this.props.nodeRef?this.props.nodeRef.current:vl.findDOMNode(this),u=i==null&&!this.props.addEndListener;if(!c||u){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var f=this.props.nodeRef?[this.nextCallback]:[c,this.nextCallback],h=f[0],p=f[1];this.props.addEndListener(h,p)}i!=null&&setTimeout(this.nextCallback,i)},n.render=function(){var i=this.state.status;if(i===La)return null;var s=this.props,c=s.children;s.in,s.mountOnEnter,s.unmountOnExit,s.appear,s.enter,s.exit,s.timeout,s.addEndListener,s.onEnter,s.onEntering,s.onEntered,s.onExit,s.onExiting,s.onExited,s.nodeRef;var u=th(s,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return ke.createElement(Wy.Provider,{value:null},typeof c=="function"?c(i,u):ke.cloneElement(ke.Children.only(c),u))},t}(ke.Component);Ur.contextType=Wy;Ur.propTypes={};function Oo(){}Ur.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Oo,onEntering:Oo,onEntered:Oo,onExit:Oo,onExiting:Oo,onExited:Oo};Ur.UNMOUNTED=La;Ur.EXITED=Ai;Ur.ENTERING=zi;Ur.ENTERED=Ao;Ur.EXITING=_f;const I9=Ur;var M9=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return E9(t,r)})},Rd=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return P9(t,r)})},up=function(e){vh(t,e);function t(){for(var r,i=arguments.length,s=new Array(i),c=0;ce.image.uuid===t.image.uuid&&e.isSelected===t.isSelected,$y=x.memo(e=>{const t=Y(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:i,mayDeleteImage:s,shouldUseSingleGalleryColumn:c}=O(n9),{image:u,isSelected:f}=e,{url:h,thumbnail:p,uuid:g,metadata:y}=u,[S,C]=x.useState(!1),w=us(),{direction:k}=Ji(),{t:j}=Z(),M=lp(),P=()=>C(!0),I=()=>C(!1),T=()=>{var Q,ie,oe,U;(ie=(Q=u.metadata)==null?void 0:Q.image)!=null&&ie.prompt&&M((U=(oe=u.metadata)==null?void 0:oe.image)==null?void 0:U.prompt),w({title:j("toast.promptSet"),status:"success",duration:2500,isClosable:!0})},D=()=>{u.metadata&&t(as(u.metadata.image.seed)),w({title:j("toast.seedSet"),status:"success",duration:2500,isClosable:!0})},_=()=>{t(os(u)),n!=="img2img"&&t(jn("img2img")),w({title:j("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},z=()=>{t(bc(u)),t(Sc()),n!=="unifiedCanvas"&&t(jn("unifiedCanvas")),w({title:j("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},V=()=>{y&&t(z1(y)),w({title:j("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})},F=async()=>{var Q;if((Q=y==null?void 0:y.image)!=null&&Q.init_image_path&&(await fetch(y.image.init_image_path)).ok){t(jn("img2img")),t(XS(y)),w({title:j("toast.initialImageSet"),status:"success",duration:2500,isClosable:!0});return}w({title:j("toast.initialImageNotSet"),description:j("toast.initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},L=()=>t(Rv(u)),X=Q=>{Q.dataTransfer.setData("invokeai/imageUuid",g),Q.dataTransfer.effectAllowed="move"},$=()=>{t(Rv(u)),t(Bi(!0))};return l.jsx(T9,{menuProps:{size:"sm",isLazy:!0},renderMenu:()=>{var Q,ie,oe,U,K,ne,ce,Re;return l.jsxs(Nh,{children:[l.jsx(pr,{onClickCapture:$,children:j("parameters.openInViewer")}),l.jsx(pr,{onClickCapture:T,isDisabled:((ie=(Q=u==null?void 0:u.metadata)==null?void 0:Q.image)==null?void 0:ie.prompt)===void 0,children:j("parameters.usePrompt")}),l.jsx(pr,{onClickCapture:D,isDisabled:((U=(oe=u==null?void 0:u.metadata)==null?void 0:oe.image)==null?void 0:U.seed)===void 0,children:j("parameters.useSeed")}),l.jsx(pr,{onClickCapture:V,isDisabled:!["txt2img","img2img"].includes((ne=(K=u==null?void 0:u.metadata)==null?void 0:K.image)==null?void 0:ne.type),children:j("parameters.useAll")}),l.jsx(pr,{onClickCapture:F,isDisabled:((Re=(ce=u==null?void 0:u.metadata)==null?void 0:ce.image)==null?void 0:Re.type)!=="img2img",children:j("parameters.useInitImg")}),l.jsx(pr,{onClickCapture:_,children:j("parameters.sendToImg2Img")}),l.jsx(pr,{onClickCapture:z,children:j("parameters.sendToUnifiedCanvas")}),l.jsx(pr,{"data-warning":!0,children:l.jsx(uc,{image:u,children:l.jsx("p",{children:j("parameters.deleteImage")})})})]})},children:Q=>l.jsxs(We,{position:"relative",onMouseOver:P,onMouseOut:I,userSelect:"none",draggable:!0,onDragStart:X,ref:Q,sx:{padding:2,display:"flex",justifyContent:"center",transition:"transform 0.2s ease-out",_hover:{cursor:"pointer",zIndex:2},_before:{content:'""',display:"block",paddingBottom:"100%"}},children:[l.jsx(ds,{objectFit:c?"contain":r,rounded:"md",src:p||h,loading:"lazy",sx:{position:"absolute",width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",top:"50%",transform:"translate(-50%,-50%)",...k==="rtl"?{insetInlineEnd:"50%"}:{insetInlineStart:"50%"}}}),l.jsx(B,{onClick:L,sx:{position:"absolute",top:"0",insetInlineStart:"0",width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},children:f&&l.jsx(Jt,{as:zc,sx:{width:"50%",height:"50%",fill:"ok.500"}})}),S&&i>=64&&l.jsx(We,{sx:{position:"absolute",top:1,insetInlineEnd:1},children:l.jsx(uc,{image:u,children:l.jsx(le,{"aria-label":j("parameters.deleteImage"),icon:l.jsx(Z8,{}),size:"xs",fontSize:14,isDisabled:!s})})})]},g)})},_9);$y.displayName="HoverableImage";const D9="0px",dp="calc(70px + 1rem)",O9=4,fp=1.5,A9=`calc(100vw - ${D9})`,z9=`calc(100vh - ${fp*4}px)`,R9=`calc(100vh - ${dp})`,n0=`calc(100vh - (${dp} + 6rem))`,N9=`calc(100vh - (${dp} + 4.4rem))`,Al="22.5rem";const F9=re(Ly,{shouldForwardProp:e=>!["sx"].includes(e)}),zl=320,r0=40,L9={txt2img:{galleryMinWidth:200,galleryMaxWidth:500},img2img:{galleryMinWidth:200,galleryMaxWidth:500},unifiedCanvas:{galleryMinWidth:200,galleryMaxWidth:200},nodes:{galleryMinWidth:200,galleryMaxWidth:500},postprocess:{galleryMinWidth:200,galleryMaxWidth:500},training:{galleryMinWidth:200,galleryMaxWidth:500}},i0=400;function Gy(){const e=Y(),{direction:t}=Ji(),{t:n}=Z(),{images:r,currentCategory:i,currentImageUuid:s,shouldPinGallery:c,shouldShowGallery:u,galleryImageMinimumWidth:f,galleryGridTemplateColumns:h,activeTabName:p,galleryImageObjectFit:g,shouldHoldGalleryOpen:y,shouldAutoSwitchToNewImages:S,areMoreImagesAvailable:C,galleryWidth:w,isLightboxOpen:k,isStaging:j,shouldEnableResize:M,shouldUseSingleGalleryColumn:P}=O(t9),{galleryMinWidth:I,galleryMaxWidth:T}=k?{galleryMinWidth:i0,galleryMaxWidth:i0}:L9[p],[D,_]=x.useState(w>=zl),[z,V]=x.useState(!1),[F,L]=x.useState(0),X=x.useRef(null),$=x.useRef(null),Q=x.useRef(null);x.useEffect(()=>{_(w>=zl)},[w]);const ie=()=>{!c&&e(Fi(!0)),e(tC(!c)),e(on(!0))},oe=()=>{u?K():U()},U=()=>{e(Fi(!0)),c&&e(on(!0))},K=x.useCallback(()=>{e(Fi(!1)),e(KS(!1)),setTimeout(()=>c&&e(on(!0)),400)},[e,c]),ne=()=>{e(nC(i))},ce=J=>{e(Da(J))},Re=()=>{y||(Q.current=window.setTimeout(()=>K(),500))},ze=()=>{Q.current&&window.clearTimeout(Q.current)};fe("g",()=>{oe()},[u,c]),fe("left",()=>{e(N1())},{enabled:!j||p!=="unifiedCanvas"},[j]),fe("right",()=>{e(F1())},{enabled:!j||p!=="unifiedCanvas"},[j]),fe("shift+g",()=>{ie()},[c]),fe("esc",()=>{e(Fi(!1))},{enabled:()=>!c,preventDefault:!0},[c]);const Me=32;return fe("shift+up",()=>{if(f<256){const J=te.clamp(f+Me,32,256);e(Da(J))}},[f]),fe("shift+down",()=>{if(f>32){const J=te.clamp(f-Me,32,256);e(Da(J))}},[f]),x.useEffect(()=>{function J(ue){!c&&X.current&&!X.current.contains(ue.target)&&K()}return document.addEventListener("mousedown",J),()=>{document.removeEventListener("mousedown",J)}},[K,c]),l.jsx(Uy,{nodeRef:X,in:u||y,unmountOnExit:!0,timeout:200,classNames:`${t}-image-gallery-css-transition`,children:l.jsxs(We,{className:`${t}-image-gallery-css-transition`,sx:c?{zIndex:1,insetInlineEnd:0}:{zIndex:100,position:"fixed",height:"100vh",top:0,insetInlineEnd:0},ref:X,onMouseLeave:c?void 0:Re,onMouseEnter:c?void 0:ze,onMouseOver:c?void 0:ze,children:[l.jsxs(F9,{sx:{padding:4,display:"flex",flexDirection:"column",rowGap:4,borderRadius:c?"base":0,borderInlineStartWidth:5,bg:"base.850",borderColor:"base.700"},minWidth:I,maxWidth:c?T:window.innerWidth,"data-pinned":c,handleStyles:t==="rtl"?{right:{width:"15px"}}:{left:{width:"15px"}},enable:t==="rtl"?{right:M}:{left:M},size:{width:w,height:c?"100%":"100vh"},onResizeStart:(J,ue,Ie)=>{L(Ie.clientHeight),Ie.style.height=`${Ie.clientHeight}px`,c&&(Ie.style.position="fixed",Ie.style.insetInlineEnd="1rem",V(!0))},onResizeStop:(J,ue,Ie,Be)=>{const Ne=c?te.clamp(Number(w)+Be.width,I,Number(T)):Number(w)+Be.width;e(QS(Ne)),Ie.removeAttribute("data-resize-alert"),c&&(console.log("unpin"),Ie.style.position="relative",Ie.style.removeProperty("inset-inline-end"),Ie.style.setProperty("height",c?"100%":"100vh"),V(!1),e(on(!0)))},onResize:(J,ue,Ie,Be)=>{const Ne=te.clamp(Number(w)+Be.width,I,Number(c?T:.95*window.innerWidth));Ne>=zl&&!D?_(!0):NeNe-r0&&e(Da(Ne-r0)),c&&(Ne>=T?Ie.setAttribute("data-resize-alert","true"):Ie.removeAttribute("data-resize-alert")),Ie.style.height=`${F}px`},children:[l.jsxs(B,{alignItems:"center",gap:2,justifyContent:"space-between",children:[l.jsx(en,{size:"sm",isAttached:!0,w:"max-content",justifyContent:"stretch",children:D?l.jsxs(l.Fragment,{children:[l.jsx(Je,{size:"sm",isChecked:i==="result",onClick:()=>e(gl("result")),flexGrow:1,children:n("gallery.generations")}),l.jsx(Je,{size:"sm",isChecked:i==="user",onClick:()=>e(gl("user")),flexGrow:1,children:n("gallery.uploads")})]}):l.jsxs(l.Fragment,{children:[l.jsx(le,{"aria-label":n("gallery.showGenerations"),tooltip:n("gallery.showGenerations"),isChecked:i==="result",icon:l.jsx(L8,{}),onClick:()=>e(gl("result"))}),l.jsx(le,{"aria-label":n("gallery.showUploads"),tooltip:n("gallery.showUploads"),isChecked:i==="user",icon:l.jsx(e9,{}),onClick:()=>e(gl("user"))})]})}),l.jsxs(B,{gap:2,children:[l.jsx(rr,{triggerComponent:l.jsx(le,{size:"sm","aria-label":n("gallery.gallerySettings"),icon:l.jsx(sp,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(ut,{value:f,onChange:ce,min:32,max:256,hideTooltip:!0,label:n("gallery.galleryImageSize"),withReset:!0,handleReset:()=>e(Da(64))}),l.jsx(pt,{label:n("gallery.maintainAspectRatio"),isChecked:g==="contain",onChange:()=>e(ZS(g==="contain"?"cover":"contain"))}),l.jsx(pt,{label:n("gallery.autoSwitchNewImages"),isChecked:S,onChange:J=>e(JS(J.target.checked))}),l.jsx(pt,{label:n("gallery.singleColumnLayout"),isChecked:P,onChange:J=>e(eC(J.target.checked))})]})}),l.jsx(le,{size:"sm","aria-label":n("gallery.pinGallery"),tooltip:`${n("gallery.pinGallery")} (Shift+G)`,onClick:ie,icon:c?l.jsx(By,{}):l.jsx(Hy,{})})]})]}),l.jsx(B,{direction:"column",gap:2,h:c?n0:"100vh",maxH:c?n0:"100vh",overflowY:"scroll",ref:$,sx:{...p2},children:r.length||C?l.jsxs(l.Fragment,{children:[l.jsx($n,{gap:2,style:{gridTemplateColumns:h},children:r.map(J=>{const{uuid:ue}=J,Ie=s===ue;return l.jsx($y,{image:J,isSelected:Ie},ue)})}),l.jsx(Je,{onClick:ne,isDisabled:!C,flexShrink:0,children:n(C?"gallery.loadMore":"gallery.allImagesLoaded")})]}):l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,padding:8,h:"100%",w:"100%",color:"base.500"},children:[l.jsx(Jt,{as:cp,sx:{w:16,h:16}}),l.jsx("p",{children:n("gallery.noImagesInGallery")})]})})]}),z&&l.jsx(We,{style:{width:`${w}px`,height:"100%"}})]})})}var B9=nh({displayName:"EditIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),qy=nh({displayName:"ExternalLinkIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),l.jsx("path",{d:"M15 3h6v6"}),l.jsx("path",{d:"M10 14L21 3"})]})}),H9=nh({displayName:"DeleteIcon",path:l.jsx("g",{fill:"currentColor",children:l.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});function W9(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const xt=({label:e,value:t,onClick:n,isLink:r,labelPosition:i,withCopy:s=!1})=>l.jsxs(B,{gap:2,children:[n&&l.jsx(Yt,{label:`Recall ${e}`,children:l.jsx(ci,{"aria-label":"Use this parameter",icon:l.jsx(W9,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&l.jsx(Yt,{label:`Copy ${e}`,children:l.jsx(ci,{"aria-label":`Copy ${e}`,icon:l.jsx(Jo,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),l.jsxs(B,{direction:i?"column":"row",children:[l.jsxs(Ce,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?l.jsxs($i,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",l.jsx(qy,{mx:"2px"})]}):l.jsx(Ce,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}),V9=(e,t)=>e.image.uuid===t.image.uuid,hp=x.memo(({image:e,styleClass:t})=>{var F,L;const n=Y(),r=lp();fe("esc",()=>{n(R1(!1))});const i=((F=e==null?void 0:e.metadata)==null?void 0:F.image)||{},s=e==null?void 0:e.dreamPrompt,{cfg_scale:c,fit:u,height:f,hires_fix:h,init_image_path:p,mask_image_path:g,orig_path:y,perlin:S,postprocessing:C,prompt:w,sampler:k,seamless:j,seed:M,steps:P,strength:I,threshold:T,type:D,variations:_,width:z}=i,V=JSON.stringify(e.metadata,null,2);return l.jsx(We,{className:t,sx:{position:"absolute",top:"0",width:"100%",borderRadius:"base",padding:4,overflow:"scroll",maxHeight:N9,height:"100%",zIndex:"10",backdropFilter:"blur(10px)",bg:"blackAlpha.600"},children:l.jsxs(B,{gap:1,direction:"column",width:"100%",children:[l.jsxs(B,{gap:2,children:[l.jsx(Ce,{fontWeight:"semibold",children:"File:"}),l.jsxs($i,{href:e.url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.url.length>64?e.url.substring(0,64).concat("..."):e.url,l.jsx(qy,{mx:"2px"})]})]}),Object.keys(i).length>0?l.jsxs(l.Fragment,{children:[D&&l.jsx(xt,{label:"Generation type",value:D}),((L=e.metadata)==null?void 0:L.model_weights)&&l.jsx(xt,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(D)&&l.jsx(xt,{label:"Original image",value:y}),w&&l.jsx(xt,{label:"Prompt",labelPosition:"top",value:typeof w=="string"?w:D1(w),onClick:()=>r(w)}),M!==void 0&&l.jsx(xt,{label:"Seed",value:M,onClick:()=>n(as(M))}),T!==void 0&&l.jsx(xt,{label:"Noise Threshold",value:T,onClick:()=>n(ef(T))}),S!==void 0&&l.jsx(xt,{label:"Perlin Noise",value:S,onClick:()=>n(tf(S))}),k&&l.jsx(xt,{label:"Sampler",value:k,onClick:()=>n(L1(k))}),P&&l.jsx(xt,{label:"Steps",value:P,onClick:()=>n(nf(P))}),c!==void 0&&l.jsx(xt,{label:"CFG scale",value:c,onClick:()=>n(rf(c))}),_&&_.length>0&&l.jsx(xt,{label:"Seed-weight pairs",value:Nv(_),onClick:()=>n(B1(Nv(_)))}),j&&l.jsx(xt,{label:"Seamless",value:j,onClick:()=>n(H1(j))}),h&&l.jsx(xt,{label:"High Resolution Optimization",value:h,onClick:()=>n(W1(h))}),z&&l.jsx(xt,{label:"Width",value:z,onClick:()=>n(Wl(z))}),f&&l.jsx(xt,{label:"Height",value:f,onClick:()=>n(Vl(f))}),p&&l.jsx(xt,{label:"Initial image",value:p,isLink:!0,onClick:()=>n(os(p))}),g&&l.jsx(xt,{label:"Mask image",value:g,isLink:!0,onClick:()=>n(rC(g))}),D==="img2img"&&I&&l.jsx(xt,{label:"Image to image strength",value:I,onClick:()=>n(of(I))}),u&&l.jsx(xt,{label:"Image to image fit",value:u,onClick:()=>n(V1(u))}),C&&C.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Vn,{size:"sm",children:"Postprocessing"}),C.map((X,$)=>{if(X.type==="esrgan"){const{scale:Q,strength:ie,denoise_str:oe}=X;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${$+1}: Upscale (ESRGAN)`}),l.jsx(xt,{label:"Scale",value:Q,onClick:()=>n(M1(Q))}),l.jsx(xt,{label:"Strength",value:ie,onClick:()=>n(Jd(ie))}),oe!==void 0&&l.jsx(xt,{label:"Denoising strength",value:oe,onClick:()=>n(Zd(oe))})]},$)}else if(X.type==="gfpgan"){const{strength:Q}=X;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${$+1}: Face restoration (GFPGAN)`}),l.jsx(xt,{label:"Strength",value:Q,onClick:()=>{n(Zl(Q)),n(Hl("gfpgan"))}})]},$)}else if(X.type==="codeformer"){const{strength:Q,fidelity:ie}=X;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${$+1}: Face restoration (Codeformer)`}),l.jsx(xt,{label:"Strength",value:Q,onClick:()=>{n(Zl(Q)),n(Hl("codeformer"))}}),ie&&l.jsx(xt,{label:"Fidelity",value:ie,onClick:()=>{n(Qd(ie)),n(Hl("codeformer"))}})]},$)}})]}),s&&l.jsx(xt,{withCopy:!0,label:"Dream Prompt",value:s}),l.jsxs(B,{gap:2,direction:"column",children:[l.jsxs(B,{gap:2,children:[l.jsx(Yt,{label:"Copy metadata JSON",children:l.jsx(ci,{"aria-label":"Copy metadata JSON",icon:l.jsx(Jo,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(V)})}),l.jsx(Ce,{fontWeight:"semibold",children:"Metadata JSON:"})]}),l.jsx(We,{sx:{mt:0,mr:2,mb:4,ml:2,padding:4,borderRadius:"base",overflowX:"scroll",wordBreak:"break-all",bg:"whiteAlpha.100"},children:l.jsx("pre",{children:V})})]})]}):l.jsx(Cx,{width:"100%",pt:10,children:l.jsx(Ce,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})})},V9);hp.displayName="ImageMetadataViewer";const o0={height:"100%",width:"15%",alignItems:"center",pointerEvents:"auto"},a0={color:"base.100"},U9=be(Vr,e=>{const{currentImage:t}=e,n=e.categories[t?t.category:"result"].images,r=n.findIndex(s=>{var c;return s.uuid===((c=e==null?void 0:e.currentImage)==null?void 0:c.uuid)}),i=n.length;return{isOnFirstImage:r===0,isOnLastImage:!isNaN(r)&&r===i-1}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Yy=()=>{const e=Y(),{isOnFirstImage:t,isOnLastImage:n}=O(U9),[r,i]=x.useState(!1),s=()=>{i(!0)},c=()=>{i(!1)},u=()=>{e(N1())},f=()=>{e(F1())};return l.jsxs(B,{sx:{justifyContent:"space-between",zIndex:1,height:"100%",width:"100%",pointerEvents:"none"},children:[l.jsx($n,{sx:{...o0,justifyContent:"flex-start"},onMouseOver:s,onMouseOut:c,children:r&&!t&&l.jsx(ci,{"aria-label":"Previous image",icon:l.jsx(P8,{size:64}),variant:"unstyled",onClick:u,boxSize:16,sx:a0})}),l.jsx($n,{sx:{...o0,justifyContent:"flex-end"},onMouseOver:s,onMouseOut:c,children:r&&!n&&l.jsx(ci,{"aria-label":"Next image",icon:l.jsx(I8,{size:64}),variant:"unstyled",onClick:f,boxSize:16,sx:a0})})]})};var Wn=function(e,t){return Number(e.toFixed(t))},$9=function(e,t){return typeof e=="number"?e:t},Tt=function(e,t,n){n&&typeof n=="function"&&n(e,t)},G9=function(e){return-Math.cos(e*Math.PI)/2+.5},q9=function(e){return e},Y9=function(e){return e*e},X9=function(e){return e*(2-e)},K9=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},Q9=function(e){return e*e*e},Z9=function(e){return--e*e*e+1},J9=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},eP=function(e){return e*e*e*e},tP=function(e){return 1- --e*e*e*e},nP=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},rP=function(e){return e*e*e*e*e},iP=function(e){return 1+--e*e*e*e*e},oP=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},Xy={easeOut:G9,linear:q9,easeInQuad:Y9,easeOutQuad:X9,easeInOutQuad:K9,easeInCubic:Q9,easeOutCubic:Z9,easeInOutCubic:J9,easeInQuart:eP,easeOutQuart:tP,easeInOutQuart:nP,easeInQuint:rP,easeOutQuint:iP,easeInOutQuint:oP},Ky=function(e){typeof e=="number"&&cancelAnimationFrame(e)},gr=function(e){e.mounted&&(Ky(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function Qy(e,t,n,r){if(e.mounted){var i=new Date().getTime(),s=1;gr(e),e.animation=function(){if(!e.mounted)return Ky(e.animation);var c=new Date().getTime()-i,u=c/n,f=Xy[t],h=f(u);c>=n?(r(s),e.animation=null):e.animation&&(r(h),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function aP(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function vi(e,t,n,r){var i=aP(t);if(!(!e.mounted||!i)){var s=e.setTransformState,c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,p=t.scale-u,g=t.positionX-f,y=t.positionY-h;n===0?s(t.scale,t.positionX,t.positionY):Qy(e,r,n,function(S){var C=u+p*S,w=f+g*S,k=h+y*S;s(C,w,k)})}}function sP(e,t,n){var r=e.offsetWidth,i=e.offsetHeight,s=t.offsetWidth,c=t.offsetHeight,u=s*n,f=c*n,h=r-u,p=i-f;return{wrapperWidth:r,wrapperHeight:i,newContentWidth:u,newDiffWidth:h,newContentHeight:f,newDiffHeight:p}}var lP=function(e,t,n,r,i,s,c){var u=e>t?n*(c?1:.5):0,f=r>i?s*(c?1:.5):0,h=e-t-u,p=u,g=r-i-f,y=f;return{minPositionX:h,maxPositionX:p,minPositionY:g,maxPositionY:y}},pp=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,i=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var s=sP(n,r,t),c=s.wrapperWidth,u=s.wrapperHeight,f=s.newContentWidth,h=s.newDiffWidth,p=s.newContentHeight,g=s.newDiffHeight,y=lP(c,f,h,u,p,g,Boolean(i));return y},Df=function(e,t,n,r){return r?en?Wn(n,2):Wn(e,2):Wn(e,2)},ea=function(e,t){var n=pp(e,t);return e.bounds=n,n};function Nc(e,t,n,r,i,s,c){var u=n.minPositionX,f=n.minPositionY,h=n.maxPositionX,p=n.maxPositionY,g=0,y=0;c&&(g=i,y=s);var S=Df(e,u-g,h+g,r),C=Df(t,f-y,p+y,r);return{x:S,y:C}}function Fc(e,t,n,r,i,s){var c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,p=r-u;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:f,y:h};var g=f-t*p,y=h-n*p,S=Nc(g,y,i,s,0,0,null);return S}function ys(e,t,n,r,i){var s=i?r:0,c=t-s;return!Number.isNaN(n)&&e>=n?n:!Number.isNaN(t)&&e<=c?c:e}var s0=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,i=e.wrapperComponent,s=t.target,c=i==null?void 0:i.contains(s),u=r&&s&&c;if(!u)return!1;var f=Lc(s,n);return!f},l0=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,i=r.panning.disabled,s=t&&n&&!i;return!!s},cP=function(e,t){var n=e.transformState,r=n.positionX,i=n.positionY;e.isPanning=!0;var s=t.clientX,c=t.clientY;e.startCoords={x:s-r,y:c-i}},uP=function(e,t){var n=t.touches,r=e.transformState,i=r.positionX,s=r.positionY;e.isPanning=!0;var c=n.length===1;if(c){var u=n[0].clientX,f=n[0].clientY;e.startCoords={x:u-i,y:f-s}}};function dP(e){var t=e.transformState,n=t.positionX,r=t.positionY,i=t.scale,s=e.setup,c=s.disabled,u=s.limitToBounds,f=s.centerZoomedOut,h=e.wrapperComponent;if(!(c||!h||!e.bounds)){var p=e.bounds,g=p.maxPositionX,y=p.minPositionX,S=p.maxPositionY,C=p.minPositionY,w=n>g||nS||rg?h.offsetWidth:e.setup.minPositionX||0,M=r>S?h.offsetHeight:e.setup.minPositionY||0,P=Fc(e,j,M,i,e.bounds,u||f),I=P.x,T=P.y;return{scale:i,positionX:w?I:n,positionY:k?T:r}}}function fP(e,t,n,r,i){var s=e.setup.limitToBounds,c=e.wrapperComponent,u=e.bounds,f=e.transformState,h=f.scale,p=f.positionX,g=f.positionY;if(!(c===null||u===null||t===p&&n===g)){var y=Nc(t,n,u,s,r,i,c),S=y.x,C=y.y;e.setTransformState(h,S,C)}}var hP=function(e,t,n){var r=e.startCoords,i=e.transformState,s=e.setup.panning,c=s.lockAxisX,u=s.lockAxisY,f=i.positionX,h=i.positionY;if(!r)return{x:f,y:h};var p=t-r.x,g=n-r.y,y=c?f:p,S=u?h:g;return{x:y,y:S}},dc=function(e,t){var n=e.setup,r=e.transformState,i=r.scale,s=n.minScale,c=n.disablePadding;return t>0&&i>=s&&!c?t:0},pP=function(e){var t=e.mounted,n=e.setup,r=n.disabled,i=n.velocityAnimation,s=e.transformState.scale,c=i.disabled,u=!c||s>1||!r||t;return!!u},mP=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,i=e.setup,s=i.disabled,c=i.velocityAnimation,u=e.transformState.scale,f=c.disabled,h=!f||u>1||!s||t;return!(!h||!n||!r)};function vP(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,i=n.animationTime,s=n.sensitivity;return r?i*t*s:i}function c0(e,t,n,r,i,s,c,u,f,h){if(i){if(t>c&&n>c){var p=c+(e-c)*h;return p>f?f:ps?s:p}}return r?t:Df(e,s,c,i)}function gP(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function xP(e,t){var n=pP(e);if(n){var r=e.lastMousePosition,i=e.velocityTime,s=e.setup,c=e.wrapperComponent,u=s.velocityAnimation.equalToMove,f=Date.now();if(r&&i&&c){var h=gP(c,u),p=t.x-r.x,g=t.y-r.y,y=p/h,S=g/h,C=f-i,w=p*p+g*g,k=Math.sqrt(w)/C;e.velocity={velocityX:y,velocityY:S,total:k}}e.lastMousePosition=t,e.velocityTime=f}}function yP(e){var t=e.velocity,n=e.bounds,r=e.setup,i=e.wrapperComponent,s=mP(e);if(!(!s||!t||!n||!i)){var c=t.velocityX,u=t.velocityY,f=t.total,h=n.maxPositionX,p=n.minPositionX,g=n.maxPositionY,y=n.minPositionY,S=r.limitToBounds,C=r.alignmentAnimation,w=r.zoomAnimation,k=r.panning,j=k.lockAxisY,M=k.lockAxisX,P=w.animationType,I=C.sizeX,T=C.sizeY,D=C.velocityAlignmentTime,_=D,z=vP(e,f),V=Math.max(z,_),F=dc(e,I),L=dc(e,T),X=F*i.offsetWidth/100,$=L*i.offsetHeight/100,Q=h+X,ie=p-X,oe=g+$,U=y-$,K=e.transformState,ne=new Date().getTime();Qy(e,P,V,function(ce){var Re=e.transformState,ze=Re.scale,Me=Re.positionX,J=Re.positionY,ue=new Date().getTime()-ne,Ie=ue/_,Be=Xy[C.animationType],Ne=1-Be(Math.min(1,Ie)),Ge=1-ce,Qe=Me+c*Ge,ve=J+u*Ge,_e=c0(Qe,K.positionX,Me,M,S,p,h,ie,Q,Ne),qe=c0(ve,K.positionY,J,j,S,y,g,U,oe,Ne);(Me!==Qe||J!==ve)&&e.setTransformState(ze,_e,qe)})}}function u0(e,t){var n=e.transformState.scale;gr(e),ea(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?uP(e,t):cP(e,t)}function Zy(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,i=n.alignmentAnimation,s=i.disabled,c=i.sizeX,u=i.sizeY,f=i.animationTime,h=i.animationType,p=s||t.1&&g;y?yP(e):Zy(e)}}function mp(e,t,n,r){var i=e.setup,s=i.minScale,c=i.maxScale,u=i.limitToBounds,f=ys(Wn(t,2),s,c,0,!1),h=ea(e,f),p=Fc(e,n,r,f,h,u),g=p.x,y=p.y;return{scale:f,positionX:g,positionY:y}}function Jy(e,t,n){var r=e.transformState.scale,i=e.wrapperComponent,s=e.setup,c=s.minScale,u=s.limitToBounds,f=s.zoomAnimation,h=f.disabled,p=f.animationTime,g=f.animationType,y=h||r>=c;if((r>=1||u)&&Zy(e),!(y||!i||!e.mounted)){var S=t||i.offsetWidth/2,C=n||i.offsetHeight/2,w=mp(e,c,S,C);w&&vi(e,w,p,g)}}var li=function(){return li=Object.assign||function(t){for(var n,r=1,i=arguments.length;rc||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY):!1},RP=function(e,t){var n=e.setup.pinch,r=n.disabled,i=n.excluded,s=e.isInitialized,c=t.target,u=s&&!r&&c;if(!u)return!1;var f=Lc(c,i);return!f},NP=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,i=n&&!t&&r;return!!i},FP=function(e,t,n){var r=n.getBoundingClientRect(),i=e.touches,s=Wn(i[0].clientX-r.left,5),c=Wn(i[0].clientY-r.top,5),u=Wn(i[1].clientX-r.left,5),f=Wn(i[1].clientY-r.top,5);return{x:(s+u)/2/t,y:(c+f)/2/t}},a4=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},LP=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,i=e.setup,s=i.maxScale,c=i.minScale,u=i.zoomAnimation,f=i.disablePadding,h=u.size,p=u.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var g=t/r,y=g*n;return ys(Wn(y,2),c,s,h,!p&&!f)},BP=160,HP=100,WP=function(e,t){var n=e.props,r=n.onWheelStart,i=n.onZoomStart;e.wheelStopEventTimer||(gr(e),Tt(dt(e),t,r),Tt(dt(e),t,i))},VP=function(e,t){var n=e.props,r=n.onWheel,i=n.onZoom,s=e.contentComponent,c=e.setup,u=e.transformState,f=u.scale,h=c.limitToBounds,p=c.centerZoomedOut,g=c.zoomAnimation,y=c.wheel,S=c.disablePadding,C=g.size,w=g.disabled,k=y.step;if(!s)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var j=OP(t,null),M=AP(e,j,k,!t.ctrlKey);if(f!==M){var P=ea(e,M),I=o4(t,s,f),T=w||C===0||p||S,D=h&&T,_=Fc(e,I.x,I.y,M,P,D),z=_.x,V=_.y;e.previousWheelEvent=t,e.setTransformState(M,z,V),Tt(dt(e),t,r),Tt(dt(e),t,i)}},UP=function(e,t){var n=e.props,r=n.onWheelStop,i=n.onZoomStop;Of(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(Jy(e,t.x,t.y),e.wheelAnimationTimer=null)},HP);var s=zP(e,t);s&&(Of(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Tt(dt(e),t,r),Tt(dt(e),t,i))},BP))},$P=function(e,t){var n=a4(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,gr(e)},GP=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,i=e.transformState.scale,s=e.setup,c=s.limitToBounds,u=s.centerZoomedOut,f=s.zoomAnimation,h=f.disabled,p=f.size;if(!(r===null||!n)){var g=FP(t,i,n);if(!(!Number.isFinite(g.x)||!Number.isFinite(g.y))){var y=a4(t),S=LP(e,y);if(S!==i){var C=ea(e,S),w=h||p===0||u,k=c&&w,j=Fc(e,g.x,g.y,S,C,k),M=j.x,P=j.y;e.pinchMidpoint=g,e.lastDistance=y,e.setTransformState(S,M,P)}}}},qP=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,Jy(e,t==null?void 0:t.x,t==null?void 0:t.y)},s4=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;Of(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Tt(dt(e),t,n)},r)},YP=function(e,t){var n=e.props,r=n.onZoomStart,i=n.onZoom,s=e.setup.doubleClick,c=s.animationTime,u=s.animationType;Tt(dt(e),t,r),r4(e,c,u,function(){return Tt(dt(e),t,i)}),s4(e,t)};function XP(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,i=e.transformState,s=e.contentComponent,c=i.scale,u=e.props,f=u.onZoomStart,h=u.onZoom,p=n.doubleClick,g=p.disabled,y=p.mode,S=p.step,C=p.animationTime,w=p.animationType;if(!g&&!r){if(y==="reset")return YP(e,t);if(!s)return console.error("No ContentComponent found");var k=y==="zoomOut"?-1:1,j=t4(e,k,S);if(c!==j){Tt(dt(e),t,f);var M=o4(t,s,c),P=mp(e,j,M.x,M.y);if(!P)return console.error("Error during zoom event. New transformation state was not calculated.");Tt(dt(e),t,h),vi(e,P,C,w),s4(e,t)}}}var KP=function(e,t){var n=e.isInitialized,r=e.setup,i=e.wrapperComponent,s=r.doubleClick,c=s.disabled,u=s.excluded,f=t.target,h=i==null?void 0:i.contains(f),p=n&&f&&h&&!c;if(!p)return!1;var g=Lc(f,u);return!g},QP=function(){function e(t){var n=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(r){ea(n,n.transformState.scale),n.setup=h0(r)},this.initializeWindowEvents=function(){var r,i=Fd(),s=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,c=s==null?void 0:s.defaultView;c==null||c.addEventListener("mousedown",n.onPanningStart,i),c==null||c.addEventListener("mousemove",n.onPanning,i),c==null||c.addEventListener("mouseup",n.onPanningStop,i),s==null||s.addEventListener("mouseleave",n.clearPanning,i),c==null||c.addEventListener("keyup",n.setKeyUnPressed,i),c==null||c.addEventListener("keydown",n.setKeyPressed,i)},this.cleanupWindowEvents=function(){var r,i,s=Fd(),c=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,u=c==null?void 0:c.defaultView;u==null||u.removeEventListener("mousedown",n.onPanningStart,s),u==null||u.removeEventListener("mousemove",n.onPanning,s),u==null||u.removeEventListener("mouseup",n.onPanningStop,s),c==null||c.removeEventListener("mouseleave",n.clearPanning,s),u==null||u.removeEventListener("keyup",n.setKeyUnPressed,s),u==null||u.removeEventListener("keydown",n.setKeyPressed,s),document.removeEventListener("mouseleave",n.clearPanning,s),gr(n),(i=n.observer)===null||i===void 0||i.disconnect()},this.handleInitializeWrapperEvents=function(r){var i=Fd();r.addEventListener("wheel",n.onWheelZoom,i),r.addEventListener("dblclick",n.onDoubleClick,i),r.addEventListener("touchstart",n.onTouchPanningStart,i),r.addEventListener("touchmove",n.onTouchPanning,i),r.addEventListener("touchend",n.onTouchPanningStop,i)},this.handleInitialize=function(r){var i=n.setup.centerOnInit;n.applyTransformation(),i&&(n.setCenter(),n.observer=new ResizeObserver(function(){var s;n.setCenter(),(s=n.observer)===null||s===void 0||s.disconnect()}),n.observer.observe(r))},this.onWheelZoom=function(r){var i=n.setup.disabled;if(!i){var s=_P(n,r);if(s){var c=n.isPressingKeys(n.setup.wheel.activationKeys);c&&(WP(n,r),VP(n,r),UP(n,r))}}},this.onPanningStart=function(r){var i=n.setup.disabled,s=n.props.onPanningStart;if(!i){var c=s0(n,r);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),gr(n),u0(n,r),Tt(dt(n),r,s))}}},this.onPanning=function(r){var i=n.setup.disabled,s=n.props.onPanning;if(!i){var c=l0(n);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),d0(n,r.clientX,r.clientY),Tt(dt(n),r,s))}}},this.onPanningStop=function(r){var i=n.props.onPanningStop;n.isPanning&&(bP(n),Tt(dt(n),r,i))},this.onPinchStart=function(r){var i=n.setup.disabled,s=n.props,c=s.onPinchingStart,u=s.onZoomStart;if(!i){var f=RP(n,r);f&&($P(n,r),gr(n),Tt(dt(n),r,c),Tt(dt(n),r,u))}},this.onPinch=function(r){var i=n.setup.disabled,s=n.props,c=s.onPinching,u=s.onZoom;if(!i){var f=NP(n);f&&(r.preventDefault(),r.stopPropagation(),GP(n,r),Tt(dt(n),r,c),Tt(dt(n),r,u))}},this.onPinchStop=function(r){var i=n.props,s=i.onPinchingStop,c=i.onZoomStop;n.pinchStartScale&&(qP(n),Tt(dt(n),r,s),Tt(dt(n),r,c))},this.onTouchPanningStart=function(r){var i=n.setup.disabled,s=n.props.onPanningStart;if(!i){var c=s0(n,r);if(c){var u=n.lastTouch&&+new Date-n.lastTouch<200;if(u&&r.touches.length===1)n.onDoubleClick(r);else{n.lastTouch=+new Date,gr(n);var f=r.touches,h=f.length===1,p=f.length===2;h&&(gr(n),u0(n,r),Tt(dt(n),r,s)),p&&n.onPinchStart(r)}}}},this.onTouchPanning=function(r){var i=n.setup.disabled,s=n.props.onPanning;if(n.isPanning&&r.touches.length===1){if(i)return;var c=l0(n);if(!c)return;r.preventDefault(),r.stopPropagation();var u=r.touches[0];d0(n,u.clientX,u.clientY),Tt(dt(n),r,s)}else r.touches.length>1&&n.onPinch(r)},this.onTouchPanningStop=function(r){n.onPanningStop(r),n.onPinchStop(r)},this.onDoubleClick=function(r){var i=n.setup.disabled;if(!i){var s=KP(n,r);s&&XP(n,r)}},this.clearPanning=function(r){n.isPanning&&n.onPanningStop(r)},this.setKeyPressed=function(r){n.pressedKeys[r.key]=!0},this.setKeyUnPressed=function(r){n.pressedKeys[r.key]=!1},this.isPressingKeys=function(r){return r.length?Boolean(r.find(function(i){return n.pressedKeys[i]})):!0},this.setTransformState=function(r,i,s){var c=n.props.onTransformed;if(!Number.isNaN(r)&&!Number.isNaN(i)&&!Number.isNaN(s)){r!==n.transformState.scale&&(n.transformState.previousScale=n.transformState.scale,n.transformState.scale=r),n.transformState.positionX=i,n.transformState.positionY=s;var u=dt(n);n.onChangeCallbacks.forEach(function(f){return f(u)}),Tt(u,{scale:r,positionX:i,positionY:s},c),n.applyTransformation()}else console.error("Detected NaN set state values")},this.setCenter=function(){if(n.wrapperComponent&&n.contentComponent){var r=i4(n.transformState.scale,n.wrapperComponent,n.contentComponent);n.setTransformState(r.scale,r.positionX,r.positionY)}},this.handleTransformStyles=function(r,i,s){return n.props.customTransform?n.props.customTransform(r,i,s):MP(r,i,s)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var r=n.transformState,i=r.scale,s=r.positionX,c=r.positionY,u=n.handleTransformStyles(s,c,i);n.contentComponent.style.transform=u}},this.getContext=function(){return dt(n)},this.onChange=function(r){return n.onChangeCallbacks.has(r)||n.onChangeCallbacks.add(r),function(){n.onChangeCallbacks.delete(r)}},this.init=function(r,i){n.cleanupWindowEvents(),n.wrapperComponent=r,n.contentComponent=i,ea(n,n.transformState.scale),n.handleInitializeWrapperEvents(r),n.handleInitialize(i),n.initializeWindowEvents(),n.isInitialized=!0,Tt(dt(n),void 0,n.props.onInit)},this.props=t,this.setup=h0(this.props),this.transformState=e4(this.props)}return e}(),Bc=ke.createContext(null),ZP=function(e,t){return typeof e=="function"?e(t):e},JP=ke.forwardRef(function(e,t){var n=x.useState(0),r=n[1],i=e.children,s=x.useRef(new QP(e)).current,c=ZP(e.children,dt(s)),u=x.useCallback(function(){typeof i=="function"&&r(function(f){return f+1})},[i]);return x.useImperativeHandle(t,function(){return dt(s)},[s]),x.useEffect(function(){s.update(e)},[s,e]),x.useEffect(function(){return s.onChange(u)},[s,e,u]),ke.createElement(Bc.Provider,{value:s},c)});function eI(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var tI=`.transform-component-module_wrapper__7HFJe { - position: relative; - width: -moz-fit-content; - width: fit-content; - height: -moz-fit-content; - height: fit-content; - overflow: hidden; - -webkit-touch-callout: none; /* iOS Safari */ - -webkit-user-select: none; /* Safari */ - -khtml-user-select: none; /* Konqueror HTML */ - -moz-user-select: none; /* Firefox */ - -ms-user-select: none; /* Internet Explorer/Edge */ - user-select: none; - margin: 0; - padding: 0; -} -.transform-component-module_content__uCDPE { - display: flex; - flex-wrap: wrap; - width: -moz-fit-content; - width: fit-content; - height: -moz-fit-content; - height: fit-content; - margin: 0; - padding: 0; - transform-origin: 0% 0%; -} -.transform-component-module_content__uCDPE img { - pointer-events: none; -} -`,p0={wrapper:"transform-component-module_wrapper__7HFJe",content:"transform-component-module_content__uCDPE"};eI(tI);var nI=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,i=e.contentClass,s=i===void 0?"":i,c=e.wrapperStyle,u=e.contentStyle,f=e.wrapperProps,h=f===void 0?{}:f,p=e.contentProps,g=p===void 0?{}:p,y=x.useContext(Bc).init,S=x.useRef(null),C=x.useRef(null);return x.useEffect(function(){var w=S.current,k=C.current;w!==null&&k!==null&&y&&y(w,k)},[]),ke.createElement("div",li({},h,{ref:S,className:"react-transform-wrapper ".concat(p0.wrapper," ").concat(r),style:c}),ke.createElement("div",li({},g,{ref:C,className:"react-transform-component ".concat(p0.content," ").concat(s),style:u}),t))},l4=function(){var e=x.useContext(Bc),t=x.useState(dt(e||{})),n=t[0],r=t[1];if(!e)throw new Error("Transform context mus be placed inside TransformWrapper");return x.useEffect(function(){e.onChange(function(i){r(i)})},[e]),n};ke.forwardRef(function(e,t){var n=x.useRef(null),r=x.useContext(Bc);return x.useEffect(function(){return r.onChange(function(i){if(n.current){var s=0,c=0;n.current.style.transform=r.handleTransformStyles(s,c,1/i.state.scale)}})},[r]),ke.createElement("div",li({},e,{ref:TP([n,t])}))});const rI=()=>{const[e,t]=x.useState(0),[n,r]=x.useState(1),[i,s]=x.useState(1);return{rotation:e,scaleX:n,scaleY:i,flipHorizontally:()=>{r(n*-1)},flipVertically:()=>{s(i*-1)},rotateCounterClockwise:()=>{t(e===-270?0:e-90)},rotateClockwise:()=>{t(e===270?0:e+90)},reset:()=>{t(0),r(1),s(1)}}},iI=({flipHorizontally:e,flipVertically:t,rotateCounterClockwise:n,rotateClockwise:r,reset:i})=>{const{zoomIn:s,zoomOut:c,resetTransform:u}=l4();return l.jsxs(en,{isAttached:!0,orientation:"vertical",children:[l.jsx(le,{icon:l.jsx(t8,{}),"aria-label":"Zoom In",tooltip:"Zoom In",onClick:()=>s(),fontSize:20}),l.jsx(le,{icon:l.jsx(n8,{}),"aria-label":"Zoom Out",tooltip:"Zoom Out",onClick:()=>c(),fontSize:20}),l.jsx(le,{icon:l.jsx(J7,{}),"aria-label":"Rotate Counter-Clockwise",tooltip:"Rotate Counter-Clockwise",onClick:n,fontSize:20}),l.jsx(le,{icon:l.jsx(e8,{}),"aria-label":"Rotate Clockwise",tooltip:"Rotate Clockwise",onClick:r,fontSize:20}),l.jsx(le,{icon:l.jsx(Jg,{}),"aria-label":"Flip Horizontally",tooltip:"Flip Horizontally",onClick:e,fontSize:20}),l.jsx(le,{icon:l.jsx(Jg,{style:{transform:"rotate(90deg)"}}),"aria-label":"Flip Vertically",tooltip:"Flip Vertically",onClick:t,fontSize:20}),l.jsx(le,{icon:l.jsx(ep,{}),"aria-label":"Reset",tooltip:"Reset",onClick:()=>{u(),i()},fontSize:20})]})};function oI({image:e,alt:t,ref:n,styleClass:r,rotation:i,scaleX:s,scaleY:c}){const{centerView:u}=l4();return l.jsx(nI,{wrapperStyle:{width:"100%",height:"100%"},children:l.jsx("img",{style:{transform:`rotate(${i}deg) scaleX(${s}) scaleY(${c})`,width:"100%"},src:e,alt:t,ref:n,className:r||"",onLoad:()=>u(1,0,"easeOut")})})}const aI=be([Vr,ro],(e,t)=>{const{currentImage:n}=e,{shouldShowImageDetails:r}=t;return{viewerImageToDisplay:n,shouldShowImageDetails:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function sI(){const e=Y(),t=O(y=>y.lightbox.isLightboxOpen),{rotation:n,scaleX:r,scaleY:i,flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:h}=rI(),{viewerImageToDisplay:p,shouldShowImageDetails:g}=O(aI);return fe("Esc",()=>{t&&e(Bi(!1))},[t]),l.jsx(JP,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:l.jsxs(We,{sx:{width:"100%",height:"100%",overflow:"hidden",position:"absolute",insetInlineStart:0,top:0,zIndex:30,animation:"popIn 0.3s ease-in",bg:"base.800"},children:[l.jsxs(B,{sx:{flexDir:"column",position:"absolute",top:4,insetInlineStart:4,gap:4,zIndex:3},children:[l.jsx(le,{icon:l.jsx(Z7,{}),"aria-label":"Exit Viewer",onClick:()=>{e(Bi(!1))},fontSize:20}),l.jsx(iI,{flipHorizontally:s,flipVertically:c,rotateCounterClockwise:u,rotateClockwise:f,reset:h})]}),l.jsxs(B,{children:[l.jsxs($n,{sx:{overflow:"hidden",gridTemplateColumns:"auto max-content",placeItems:"center",width:"100vw",height:"100vh",bg:"base.850"},children:[p&&l.jsxs(l.Fragment,{children:[l.jsx(oI,{rotation:n,scaleX:r,scaleY:i,image:p.url,styleClass:"lightbox-image"}),g&&l.jsx(hp,{image:p})]}),!g&&l.jsx(We,{sx:{position:"absolute",top:0,insetInlineStart:0,w:`calc(100vw - ${8*2*4}px)`,h:"100vh",mx:8,pointerEvents:"none"},children:l.jsx(Yy,{})}),l.jsx(We,{sx:{position:"absolute",top:4},children:l.jsx(Fy,{})})]}),l.jsx(Gy,{})]})]})})}function lI(e){const{menuType:t="icon",iconTooltip:n,buttonText:r,isLazy:i=!0,menuItems:s,menuProps:c,menuButtonProps:u,menuListProps:f,menuItemProps:h}=e,p=()=>{const g=[];return s.forEach((y,S)=>{g.push(l.jsx(pr,{onClick:y.onClick,fontSize:"sm",...h,children:y.item},S))}),g};return l.jsx(Rh,{...c,isLazy:i,children:({isOpen:g})=>l.jsxs(l.Fragment,{children:[l.jsx(Fh,{as:t==="icon"?ci:to,tooltip:n,"aria-label":n,icon:g?l.jsx(w9,{}):l.jsx(C9,{}),paddingX:0,paddingY:t==="regular"?2:0,...u,children:t==="regular"&&r}),l.jsx(Nh,{zIndex:15,padding:0,...f,children:p()})]})})}const cI=be(Pt,e=>({isProcessing:e.isProcessing,isConnected:e.isConnected,isCancelable:e.isCancelable,currentIteration:e.currentIteration,totalIterations:e.totalIterations,cancelType:e.cancelOptions.cancelType,cancelAfter:e.cancelOptions.cancelAfter}),{memoizeOptions:{resultEqualityCheck:te.isEqual}});function vp(e){const t=Y(),{btnGroupWidth:n="auto",...r}=e,{isProcessing:i,isConnected:s,isCancelable:c,currentIteration:u,totalIterations:f,cancelType:h,cancelAfter:p}=O(cI),g=x.useCallback(()=>{t(iC()),t(dd(null))},[t]),{t:y}=Z(),S=p!==null;fe("shift+x",()=>{(s||i)&&c&&g()},[s,i,c]),x.useEffect(()=>{p!==null&&pt(Fv("immediate"))},{item:y("parameters.cancel.schedule"),onClick:()=>t(Fv("scheduled"))}];return l.jsxs(en,{isAttached:!0,width:n,children:[h==="immediate"?l.jsx(le,{icon:l.jsx(k9,{}),tooltip:y("parameters.cancel.immediate"),"aria-label":y("parameters.cancel.immediate"),isDisabled:!s||!i||!c,onClick:g,colorScheme:"error",...r}):l.jsx(le,{icon:S?l.jsx(ic,{}):l.jsx(h9,{}),tooltip:y(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),"aria-label":y(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),isDisabled:!s||!i||!c||u===f,onClick:()=>{t(S?dd(null):dd(u))},colorScheme:"error",...r}),l.jsx(lI,{menuItems:C,iconTooltip:y("parameters.cancel.setType"),menuButtonProps:{colorScheme:"error",minWidth:5}})]})}const gp=e=>e.generation;be(gp,({shouldRandomizeSeed:e,shouldGenerateVariations:t})=>e||t,{memoizeOptions:{resultEqualityCheck:te.isEqual}});const c4=be([gp,Pt,Ny,Bt],(e,t,n,r)=>{const{prompt:i,shouldGenerateVariations:s,seedWeights:c,initialImage:u,seed:f}=e,{isProcessing:h,isConnected:p}=t;let g=!0;const y=[];return(!i||Boolean(i.match(/^[\s\r\n]+$/)))&&(g=!1,y.push("Missing prompt")),r==="img2img"&&!u&&(g=!1,y.push("No initial image selected")),h&&(g=!1,y.push("System Busy")),p||(g=!1,y.push("System Disconnected")),s&&(!(U1(c)||c==="")||f===-1)&&(g=!1,y.push("Seed-Weights badly formatted.")),{isReady:g,reasonsWhyNotReady:y}},{memoizeOptions:{equalityCheck:te.isEqual,resultEqualityCheck:te.isEqual}});function xp(e){const{iconButton:t=!1,...n}=e,r=Y(),{isReady:i}=O(c4),s=O(Bt),c=()=>{r(af(s))},{t:u}=Z();return fe(["ctrl+enter","meta+enter"],()=>{r($1()),r(af(s))},{enabled:()=>i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[i,s]),l.jsx(We,{style:{flexGrow:4},children:t?l.jsx(le,{"aria-label":u("parameters.invoke"),type:"submit",icon:l.jsx($8,{}),isDisabled:!i,onClick:c,flexGrow:1,w:"100%",tooltip:u("parameters.invoke"),tooltipProps:{placement:"bottom"},colorScheme:"accent",...n}):l.jsx(Je,{"aria-label":u("parameters.invoke"),type:"submit",isDisabled:!i,onClick:c,flexGrow:1,w:"100%",colorScheme:"accent",fontWeight:700,...n,children:"Invoke"})})}const Ld={borderStartStartRadius:0,borderEndStartRadius:0},yp=be([Vr,ro,Bt],(e,t,n)=>{const{shouldPinParametersPanel:r,shouldShowParametersPanel:i,shouldHoldParametersPanelOpen:s,shouldUseCanvasBetaLayout:c}=t,{shouldShowGallery:u,shouldPinGallery:f,shouldHoldGalleryOpen:h}=e,p=c&&n==="unifiedCanvas",g=!p&&!(i||s&&!r)&&["txt2img","img2img","unifiedCanvas"].includes(n),y=!(u||h&&!f)&&["txt2img","img2img","unifiedCanvas"].includes(n);return{shouldPinParametersPanel:r,shouldShowProcessButtons:!p&&(!r||!i),shouldShowParametersPanelButton:g,shouldShowParametersPanel:i,shouldShowGallery:u,shouldPinGallery:f,shouldShowGalleryButton:y}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),uI=()=>{const e=Y(),{shouldShowParametersPanelButton:t,shouldShowProcessButtons:n,shouldPinParametersPanel:r}=O(yp),i=()=>{e(Hi(!0)),r&&setTimeout(()=>e(on(!0)),400)};return t?l.jsxs(B,{pos:"absolute",transform:"translate(0, -50%)",zIndex:20,minW:8,top:"50%",insetInlineStart:"4.5rem",direction:"column",gap:2,children:[l.jsx(le,{tooltip:"Show Options Panel (O)",tooltipProps:{placement:"top"},"aria-label":"Show Options Panel",onClick:i,sx:Ld,children:l.jsx(ap,{})}),n&&l.jsxs(l.Fragment,{children:[l.jsx(xp,{iconButton:!0,sx:Ld}),l.jsx(vp,{sx:Ld})]})]}):null},dI=be(Vr,e=>({resultImages:e.categories.result.images,userImages:e.categories.user.images})),fI=()=>{const{resultImages:e,userImages:t}=O(dI);return n=>{const r=e.find(s=>s.uuid===n);if(r)return r;const i=t.find(s=>s.uuid===n);if(i)return i}},hI=be([ro,Ac,Bt],(e,t,n)=>{const{shouldPinParametersPanel:r}=e,{isLightboxOpen:i}=t;return{shouldPinParametersPanel:r,isLightboxOpen:i,activeTabName:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),bp=e=>{const t=Y(),{optionsPanel:n,children:r,...i}=e,{activeTabName:s,isLightboxOpen:c}=O(hI),u=fI(),f=h=>{const p=h.dataTransfer.getData("invokeai/imageUuid"),g=u(p);g&&(s==="img2img"?t(os(g)):s==="unifiedCanvas"&&t(bc(g)))};return l.jsx(We,{...i,pos:"relative",w:"100%",h:"100%",children:l.jsxs(B,{gap:4,h:"100%",children:[n,l.jsx(We,{pos:"relative",w:"100%",h:"100%",onDrop:f,children:r}),!c&&l.jsx(Gy,{})]})})},pI=e=>{const{styleClass:t}=e,n=x.useContext(Qh),r=()=>{n&&n()};return l.jsx(B,{sx:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},className:t,children:l.jsxs(B,{onClick:r,sx:{display:"flex",flexDirection:"column",rowGap:8,p:8,borderRadius:"base",alignItems:"center",justifyContent:"center",textAlign:"center",cursor:"pointer",color:"base.600",bg:"base.800",_hover:{bg:"base.700"}},children:[l.jsx(Jt,{as:Rc,boxSize:24}),l.jsx(Vn,{size:"md",children:"Click or Drag and Drop"})]})})},mI=be([Vr,ro],(e,t)=>{const{currentImage:n,intermediateImage:r}=e,{shouldShowImageDetails:i}=t;return{imageToDisplay:r||n,isIntermediate:Boolean(r),shouldShowImageDetails:i}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function vI(){const{shouldShowImageDetails:e,imageToDisplay:t,isIntermediate:n}=O(mI);return l.jsxs(B,{sx:{position:"relative",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:[t&&l.jsx(ds,{src:t.url,sx:{objectFit:"contain",maxWidth:"100%",maxHeight:"100%",height:"auto",position:"absolute",imageRendering:n?"pixelated":"initial",borderRadius:"base"},...n&&{width:t.width,height:t.height}}),!e&&l.jsx(Yy,{}),e&&t&&l.jsx(hp,{image:t,styleClass:"current-image-metadata"})]})}const gI=be([Vr],e=>{const{currentImage:t,intermediateImage:n}=e;return{hasAnImageToDisplay:t||n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),u4=()=>{const{hasAnImageToDisplay:e}=O(gI);return l.jsx(B,{sx:{flexDirection:"column",height:"100%",width:"100%",rowGap:4,borderRadius:"base"},children:e?l.jsxs(l.Fragment,{children:[l.jsx(Fy,{}),l.jsx(vI,{})]}):l.jsx(B,{sx:{alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:l.jsx(Jt,{as:S9,sx:{boxSize:24,color:"base.500"}})})})},xI=()=>{const e=x.useContext(Qh);return l.jsx(le,{"aria-label":"Upload Image",tooltip:"Upload Image",icon:l.jsx(Rc,{}),onClick:e||void 0})};function yI(){const e=O(s=>s.generation.initialImage),{t}=Z(),n=Y(),r=us(),i=()=>{r({title:t("toast.parametersFailed"),description:t("toast.parametersFailedDesc"),status:"error",isClosable:!0}),n(oC())};return l.jsxs(l.Fragment,{children:[l.jsxs(B,{sx:{alignItems:"center",justifyContent:"center",w:"100%",gap:4},children:[l.jsx(Ce,{sx:{fontSize:"lg"},variant:"subtext",children:t("parameters.initialImage")}),l.jsx(xI,{})]}),e&&l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:l.jsx(ds,{sx:{fit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"base",objectFit:"contain",position:"absolute"},src:typeof e=="string"?e:e.url,onError:i})})]})}const m0={flexDirection:"column",height:"100%",width:"100%",gap:4,padding:4},bI=()=>{const t=O(n=>n.generation.initialImage)?l.jsx(B,{flexDirection:"column",gap:4,w:"100%",h:"100%",children:l.jsx(yI,{})}):l.jsx(pI,{});return l.jsxs($n,{sx:{w:"100%",h:"100%",gridTemplateColumns:"1fr 1fr",borderRadius:"base",bg:"base.850"},children:[l.jsx(B,{sx:{...m0,paddingInlineEnd:2},children:t}),l.jsx(B,{sx:{...m0,paddingInlineStart:2},children:l.jsx(u4,{})})]})};var dn=(e=>(e[e.PROMPT=0]="PROMPT",e[e.GALLERY=1]="GALLERY",e[e.OTHER=2]="OTHER",e[e.SEED=3]="SEED",e[e.VARIATIONS=4]="VARIATIONS",e[e.UPSCALE=5]="UPSCALE",e[e.FACE_CORRECTION=6]="FACE_CORRECTION",e[e.IMAGE_TO_IMAGE=7]="IMAGE_TO_IMAGE",e[e.BOUNDING_BOX=8]="BOUNDING_BOX",e[e.SEAM_CORRECTION=9]="SEAM_CORRECTION",e[e.INFILL_AND_SCALING=10]="INFILL_AND_SCALING",e))(dn||{});const SI=()=>{const{t:e}=Z();return x.useMemo(()=>({[0]:{text:e("tooltip.feature.prompt"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[1]:{text:e("tooltip.feature.gallery"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[2]:{text:e("tooltip.feature.other"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[3]:{text:e("tooltip.feature.seed"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[4]:{text:e("tooltip.feature.variations"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[5]:{text:e("tooltip.feature.upscale"),href:"link/to/docs/feature1.html",guideImage:"asset/path.gif"},[6]:{text:e("tooltip.feature.faceCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[7]:{text:e("tooltip.feature.imageToImage"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[8]:{text:e("tooltip.feature.boundingBox"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[9]:{text:e("tooltip.feature.seamCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[10]:{text:e("tooltip.feature.infillAndScaling"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"}}),[e])},CI=e=>SI()[e];function d4(){const e=O(i=>i.system.isGFPGANAvailable),t=O(i=>i.postprocessing.shouldRunFacetool),n=Y(),r=i=>n(aC(i.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}const f4=()=>{const e=Y(),t=O(i=>i.generation.seamless),n=i=>e(H1(i.target.checked)),{t:r}=Z();return l.jsx(En,{label:r("parameters.seamlessTiling"),fontSize:"md",isChecked:t,onChange:n})},wI=()=>l.jsx(Le,{gap:2,alignItems:"stretch",children:l.jsx(f4,{})});function Sp(){const e=O(s=>s.generation.horizontalSymmetrySteps),t=O(s=>s.generation.verticalSymmetrySteps),n=O(s=>s.generation.steps),r=Y(),{t:i}=Z();return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:i("parameters.hSymmetryStep"),value:e,onChange:s=>r(Lv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Lv(0))}),l.jsx(ut,{label:i("parameters.vSymmetryStep"),value:t,onChange:s=>r(Bv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Bv(0))})]})}function Cp(){const e=O(n=>n.generation.shouldUseSymmetry),t=Y();return l.jsx(En,{isChecked:e,onChange:n=>t(sC(n.target.checked))})}function kI(){const e=Y(),t=O(r=>r.generation.perlin),{t:n}=Z();return l.jsx(ut,{label:n("parameters.perlinNoise"),min:0,max:1,step:.05,onChange:r=>e(tf(r)),handleReset:()=>e(tf(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}function jI(){const e=Y(),{t}=Z(),n=O(i=>i.generation.shouldRandomizeSeed),r=i=>e(lC(i.target.checked));return l.jsx(En,{label:t("parameters.randomizeSeed"),isChecked:n,onChange:r})}const v0=/^-?(0\.)?\.?$/,Lr=e=>{const{label:t,isDisabled:n=!1,showStepper:r=!0,isInvalid:i,value:s,onChange:c,min:u,max:f,isInteger:h=!0,formControlProps:p,formLabelProps:g,numberInputFieldProps:y,numberInputStepperProps:S,tooltipProps:C,...w}=e,[k,j]=x.useState(String(s));x.useEffect(()=>{!k.match(v0)&&s!==Number(k)&&j(String(s))},[s,k]);const M=I=>{j(I),I.match(v0)||c(h?Math.floor(Number(I)):Number(I))},P=I=>{const T=te.clamp(h?Math.floor(Number(I.target.value)):Number(I.target.value),u,f);j(String(T)),c(T)};return l.jsx(Yt,{...C,children:l.jsxs(rt,{isDisabled:n,isInvalid:i,...p,children:[t&&l.jsx(st,{...g,children:t}),l.jsxs(Bh,{value:k,min:u,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:M,onBlur:P,...w,children:[l.jsx(Wh,{...y}),r&&l.jsxs(Hh,{children:[l.jsx(Uh,{...S}),l.jsx(Vh,{...S})]})]})]})})};function EI(){const e=Y(),t=O(i=>i.generation.shouldRandomizeSeed),{t:n}=Z(),r=()=>e(as(cC(q1,G1)));return l.jsx(to,{size:"sm",isDisabled:t,onClick:r,padding:"0 1.5rem",children:l.jsx("p",{children:n("parameters.shuffle")})})}function PI(){const e=O(c=>c.generation.seed),t=O(c=>c.generation.shouldRandomizeSeed),n=O(c=>c.generation.shouldGenerateVariations),{t:r}=Z(),i=Y(),s=c=>i(as(c));return l.jsxs(sa,{gap:2,children:[l.jsx(Lr,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:q1,max:G1,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e,formControlProps:{display:"flex",alignItems:"center",gap:3}}),l.jsx(EI,{})]})}function II(){const e=Y(),t=O(r=>r.generation.threshold),{t:n}=Z();return l.jsx(ut,{label:n("parameters.noiseThreshold"),min:0,max:20,step:.1,onChange:r=>e(ef(r)),handleReset:()=>e(ef(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const wp=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(jI,{}),l.jsx(PI,{}),l.jsx(II,{}),l.jsx(kI,{})]});function h4(){const e=O(i=>i.system.isESRGANAvailable),t=O(i=>i.postprocessing.shouldRunESRGAN),n=Y(),r=i=>n(uC(i.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}function kp(){const e=O(r=>r.generation.shouldGenerateVariations),t=Y(),n=r=>t(dC(r.target.checked));return l.jsx(En,{isChecked:e,width:"auto",onChange:n})}function mt(e){const{label:t="",isDisabled:n=!1,isInvalid:r,formControlProps:i,...s}=e;return l.jsxs(rt,{isInvalid:r,isDisabled:n,...i,children:[t!==""&&l.jsx(st,{children:t}),l.jsx(wh,{...s})]})}function MI(){const e=O(s=>s.generation.seedWeights),t=O(s=>s.generation.shouldGenerateVariations),{t:n}=Z(),r=Y(),i=s=>r(B1(s.target.value));return l.jsx(mt,{label:n("parameters.seedWeights"),value:e,isInvalid:t&&!(U1(e)||e===""),isDisabled:!t,onChange:i})}function TI(){const e=O(i=>i.generation.variationAmount),t=O(i=>i.generation.shouldGenerateVariations),{t:n}=Z(),r=Y();return l.jsx(ut,{label:n("parameters.variationAmount"),value:e,step:.01,min:0,max:1,isSliderDisabled:!t,isInputDisabled:!t,isResetDisabled:!t,onChange:i=>r(Hv(i)),handleReset:()=>r(Hv(.1)),withInput:!0,withReset:!0,withSliderMarks:!0})}const jp=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(TI,{}),l.jsx(MI,{})]});function g0(){const e=Y(),t=O(s=>s.generation.cfgScale),n=O(s=>s.ui.shouldUseSliders),{t:r}=Z(),i=s=>e(rf(s));return n?l.jsx(ut,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:30,onChange:i,handleReset:()=>e(rf(7.5)),value:t,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0}):l.jsx(Lr,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:200,onChange:i,value:t,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})}function x0(){const e=O(s=>s.generation.height),t=O(s=>s.ui.shouldUseSliders),n=O(Bt),r=Y(),{t:i}=Z();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:i("parameters.height"),value:e,min:64,step:64,max:2048,onChange:s=>r(Vl(s)),handleReset:()=>r(Vl(512)),withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:i("parameters.height"),value:e,flexGrow:1,onChange:s=>r(Vl(Number(s.target.value))),validValues:fC})}function y0(){const e=O(s=>s.generation.iterations),t=O(s=>s.ui.shouldUseSliders),n=Y(),{t:r}=Z(),i=s=>n(Wv(s));return t?l.jsx(ut,{label:r("parameters.images"),step:1,min:1,max:16,onChange:i,handleReset:()=>n(Wv(1)),value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Lr,{label:r("parameters.images"),step:1,min:1,max:9999,onChange:i,value:e,numberInputFieldProps:{textAlign:"center"}})}function b0(){const e=O(s=>s.generation.sampler),t=O(wy),n=Y(),{t:r}=Z(),i=s=>n(L1(s.target.value));return l.jsx(Mn,{label:r("parameters.sampler"),value:e,onChange:i,validValues:t.format==="diffusers"?hC:pC,minWidth:36})}function S0(){const e=Y(),t=O(c=>c.generation.steps),n=O(c=>c.ui.shouldUseSliders),{t:r}=Z(),i=c=>{e(nf(c))},s=()=>{e($1())};return n?l.jsx(ut,{label:r("parameters.steps"),min:1,step:1,onChange:i,handleReset:()=>e(nf(20)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Lr,{label:r("parameters.steps"),min:1,max:9999,step:1,onChange:i,value:t,numberInputFieldProps:{textAlign:"center"},onBlur:s})}function C0(){const e=O(s=>s.generation.width),t=O(s=>s.ui.shouldUseSliders),n=O(Bt),{t:r}=Z(),i=Y();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,min:64,step:64,max:2048,onChange:s=>i(Wl(s)),handleReset:()=>i(Wl(512)),withInput:!0,withReset:!0,withSliderMarks:!0,inputReadOnly:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,flexGrow:1,onChange:s=>i(Wl(Number(s.target.value))),validValues:mC})}function Ep(){return O(t=>t.ui.shouldUseSliders)?l.jsxs(Le,{gap:2,children:[l.jsx(y0,{}),l.jsx(S0,{}),l.jsx(g0,{}),l.jsx(C0,{}),l.jsx(x0,{}),l.jsx(b0,{})]}):l.jsxs(B,{rowGap:2,flexDirection:"column",children:[l.jsxs(B,{columnGap:1,children:[l.jsx(y0,{}),l.jsx(S0,{}),l.jsx(g0,{})]}),l.jsxs(B,{columnGap:1,children:[l.jsx(C0,{}),l.jsx(x0,{}),l.jsx(b0,{})]})]})}const _I=be(Pt,e=>e.shouldDisplayGuides),DI=({children:e,feature:t})=>{const n=O(_I),{text:r}=CI(t);return n?l.jsxs(qh,{trigger:"hover",children:[l.jsx(Gh,{children:l.jsx(We,{children:e})}),l.jsxs(Xh,{maxWidth:"400px",onClick:i=>i.preventDefault(),cursor:"initial",children:[l.jsx(Yh,{}),l.jsx(Zx,{children:r})]})]}):null},OI=he(({feature:e,icon:t=p9},n)=>l.jsx(DI,{feature:e,children:l.jsx(We,{ref:n,children:l.jsx(Jt,{marginBottom:"-.15rem",as:t})})}));function AI(e){const{header:t,feature:n,content:r,additionalHeaderComponents:i}=e;return l.jsxs(No,{children:[l.jsx(zo,{children:l.jsxs(B,{width:"100%",gap:2,align:"center",children:[l.jsx(We,{flexGrow:1,textAlign:"start",children:t}),i,n&&l.jsx(OI,{feature:n}),l.jsx(Ro,{})]})}),l.jsx(Lo,{children:r})]})}const Pp=e=>{const{accordionInfo:t}=e,n=O(c=>c.system.openAccordions),r=Y(),i=c=>r(vC(c)),s=()=>{const c=[];return t&&Object.keys(t).forEach(u=>{const{header:f,feature:h,content:p,additionalHeaderComponents:g}=t[u];c.push(l.jsx(AI,{header:f,feature:h,content:p,additionalHeaderComponents:g},u))}),c};return l.jsx(sh,{defaultIndex:n,allowMultiple:!0,reduceMotion:!0,onChange:i,children:s()})},zI=be(rp,({shouldLoopback:e})=>e),RI=()=>{const e=Y(),t=O(zI),{t:n}=Z();return l.jsx(le,{"aria-label":n("parameters.toggleLoopback"),tooltip:n("parameters.toggleLoopback"),isChecked:t,icon:l.jsx(q8,{}),onClick:()=>{e(gC(!t))}})},Ip=()=>{const e=O(Bt);return l.jsxs(B,{gap:2,children:[l.jsx(xp,{}),e==="img2img"&&l.jsx(RI,{}),l.jsx(vp,{})]})},Mp=()=>{const e=O(r=>r.generation.negativePrompt),t=Y(),{t:n}=Z();return l.jsx(rt,{children:l.jsx(Kh,{id:"negativePrompt",name:"negativePrompt",value:e,onChange:r=>t(A1(r.target.value)),placeholder:n("parameters.negativePrompts"),_focusVisible:{borderColor:"error.600"},fontSize:"sm"})})},NI=be([e=>e.generation,Bt],(e,t)=>({prompt:e.prompt,activeTabName:t}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Tp=()=>{const e=Y(),{prompt:t,activeTabName:n}=O(NI),{isReady:r}=O(c4),i=x.useRef(null),{t:s}=Z(),c=f=>{e(O1(f.target.value))};fe("alt+a",()=>{var f;(f=i.current)==null||f.focus()},[]);const u=f=>{f.key==="Enter"&&f.shiftKey===!1&&r&&(f.preventDefault(),e(af(n)))};return l.jsx(We,{children:l.jsx(rt,{isInvalid:t.length===0||Boolean(t.match(/^[\s\r\n]+$/)),children:l.jsx(Kh,{id:"prompt",name:"prompt",placeholder:s("parameters.promptPlaceholder"),value:t,onChange:c,onKeyDown:u,resize:"vertical",ref:i,minH:40})})})},FI=""+new URL("logo-13003d72.png",import.meta.url).href,p4=()=>{const e=O(t=>t.system.app_version);return l.jsxs(B,{alignItems:"center",gap:3,ps:1,children:[l.jsx(ds,{src:FI,alt:"invoke-ai-logo",w:"32px",h:"32px"}),l.jsxs(Ce,{fontSize:"xl",children:["invoke ",l.jsx("strong",{children:"ai"})]}),l.jsx(Ce,{sx:{fontWeight:300,marginTop:1},variant:"subtext",children:e})]})};const LI=be(ro,e=>{const{shouldShowParametersPanel:t,shouldHoldParametersPanelOpen:n,shouldPinParametersPanel:r,parametersPanelScrollPosition:i}=e;return{shouldShowParametersPanel:t,shouldHoldParametersPanelOpen:n,shouldPinParametersPanel:r,parametersPanelScrollPosition:i}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),_p=e=>{const t=Y(),{direction:n}=Ji(),{shouldShowParametersPanel:r,shouldHoldParametersPanelOpen:i,shouldPinParametersPanel:s}=O(LI),c=x.useRef(null),u=x.useRef(null),f=x.useRef(null),{children:h}=e,{t:p}=Z();fe("o",()=>{t(Hi(!r)),s&&setTimeout(()=>t(on(!0)),400)},[r,s]),fe("esc",()=>{t(Hi(!1))},{enabled:()=>!s,preventDefault:!0},[s]),fe("shift+o",()=>{C(),t(on(!0))},[s]);const g=x.useCallback(()=>{s||(t(xC(u.current?u.current.scrollTop:0)),t(Hi(!1)),t(yC(!1)))},[t,s]),y=()=>{f.current=window.setTimeout(()=>g(),500)},S=()=>{f.current&&window.clearTimeout(f.current)},C=()=>{t(bC(!s)),t(on(!0))};return x.useEffect(()=>{function w(k){c.current&&!c.current.contains(k.target)&&g()}return document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[g]),l.jsx(Uy,{nodeRef:c,in:r||i&&!s,unmountOnExit:!0,timeout:200,classNames:`${n}-parameters-panel-transition`,children:l.jsx(We,{className:`${n}-parameters-panel-transition`,tabIndex:1,ref:c,onMouseEnter:s?void 0:S,onMouseOver:s?void 0:S,sx:{borderInlineEndWidth:s?0:5,borderInlineEndStyle:"solid",bg:"base.900",borderColor:"base.700",height:R9,width:Al,maxWidth:Al,flexShrink:0,position:"relative",overflowY:"scroll",overflowX:"hidden",...p2,...!s&&{zIndex:20,position:"fixed",top:0,insetInlineStart:0,width:`calc(${Al} + 2rem)`,maxWidth:`calc(${Al} + 2rem)`,height:"100%"}},children:l.jsx(We,{sx:{margin:!s&&4},children:l.jsxs(B,{ref:u,onMouseLeave:w=>{w.target!==u.current?S():!s&&y()},sx:{display:"flex",flexDirection:"column",rowGap:2,height:"100%"},children:[l.jsx(Yt,{label:p("common.pinOptionsPanel"),children:l.jsx(We,{onClick:C,sx:{position:"absolute",cursor:"pointer",padding:2,top:4,insetInlineEnd:4,zIndex:20,...s&&{top:0,insetInlineEnd:0}},children:l.jsx(Jt,{sx:{opacity:.2},as:s?By:Hy})})}),!s&&l.jsx(We,{sx:{pt:fp,pb:2},children:l.jsx(p4,{})}),h]})})})})};function BI(){const e=Y(),t=O(i=>i.generation.shouldFitToWidthHeight),n=i=>e(V1(i.target.checked)),{t:r}=Z();return l.jsx(En,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function m4(e){const{t}=Z(),{label:n=`${t("parameters.strength")}`}=e,r=O(u=>u.generation.img2imgStrength),i=Y(),s=u=>i(of(u)),c=()=>{i(of(.75))};return l.jsx(ut,{label:n,step:.01,min:.01,max:1,onChange:s,value:r,isInteger:!1,withInput:!0,withSliderMarks:!0,inputWidth:22,withReset:!0,handleReset:c})}function HI(){const{t:e}=Z();return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(m4,{label:e("parameters.img2imgStrength")}),l.jsx(BI,{})]})}function WI(){const{t:e}=Z(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(Ep,{})},imageToImage:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(HI,{})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(wp,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(jp,{}),additionalHeaderComponents:l.jsx(kp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:dn.FACE_CORRECTION,content:l.jsx(tp,{}),additionalHeaderComponents:l.jsx(d4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:dn.UPSCALE,content:l.jsx(np,{}),additionalHeaderComponents:l.jsx(h4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(Sp,{}),additionalHeaderComponents:l.jsx(Cp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:dn.OTHER,content:l.jsx(wI,{})}};return l.jsxs(_p,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Tp,{}),l.jsx(Mp,{})]}),l.jsx(Ip,{}),l.jsx(Pp,{accordionInfo:t})]})}function VI(){return l.jsx(bp,{optionsPanel:l.jsx(WI,{}),children:l.jsx(bI,{})})}const UI=()=>l.jsx(We,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsx(B,{sx:{p:4,width:"100%",height:"100%"},children:l.jsx(u4,{})})}),$I=be([rp],({hiresFix:e,hiresStrength:t})=>({hiresFix:e,hiresStrength:t}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),GI=()=>{const{hiresFix:e,hiresStrength:t}=O($I),n=Y(),{t:r}=Z(),i=c=>{n(Vv(c))},s=()=>{n(Vv(.75))};return l.jsx(ut,{label:r("parameters.hiresStrength"),step:.01,min:.01,max:.99,onChange:i,value:t,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})},qI=()=>{const e=Y(),t=O(i=>i.postprocessing.hiresFix),{t:n}=Z(),r=i=>e(W1(i.target.checked));return l.jsx(En,{label:n("parameters.hiresOptim"),fontSize:"md",isChecked:t,onChange:r})},YI=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(f4,{}),l.jsx(qI,{}),l.jsx(GI,{})]});function XI(){const{t:e}=Z(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(Ep,{})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(wp,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(jp,{}),additionalHeaderComponents:l.jsx(kp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:dn.FACE_CORRECTION,content:l.jsx(tp,{}),additionalHeaderComponents:l.jsx(d4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:dn.UPSCALE,content:l.jsx(np,{}),additionalHeaderComponents:l.jsx(h4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(Sp,{}),additionalHeaderComponents:l.jsx(Cp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:dn.OTHER,content:l.jsx(YI,{})}};return l.jsxs(_p,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Tp,{}),l.jsx(Mp,{})]}),l.jsx(Ip,{}),l.jsx(Pp,{accordionInfo:t})]})}function KI(){return l.jsx(bp,{optionsPanel:l.jsx(XI,{}),children:l.jsx(UI,{})})}var Af={},QI={get exports(){return Af},set exports(e){Af=e}};/** - * @license React - * react-reconciler.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 ZI=function(t){var n={},r=x,i=Ul,s=Object.assign;function c(o){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;dA||v[E]!==b[A]){var W=` -`+v[E].replace(" at new "," at ");return o.displayName&&W.includes("")&&(W=W.replace("",o.displayName)),W}while(1<=E&&0<=A);break}}}finally{eu=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?ha(o):""}var Ub=Object.prototype.hasOwnProperty,nu=[],uo=-1;function Gr(o){return{current:o}}function bt(o){0>uo||(o.current=nu[uo],nu[uo]=null,uo--)}function gt(o,a){uo++,nu[uo]=o.current,o.current=a}var qr={},an=Gr(qr),xn=Gr(!1),Si=qr;function fo(o,a){var d=o.type.contextTypes;if(!d)return qr;var m=o.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===a)return m.__reactInternalMemoizedMaskedChildContext;var v={},b;for(b in d)v[b]=a[b];return m&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=v),v}function yn(o){return o=o.childContextTypes,o!=null}function js(){bt(xn),bt(an)}function Jp(o,a,d){if(an.current!==qr)throw Error(c(168));gt(an,a),gt(xn,d)}function em(o,a,d){var m=o.stateNode;if(a=a.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var v in m)if(!(v in a))throw Error(c(108,z(o)||"Unknown",v));return s({},d,m)}function Es(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||qr,Si=an.current,gt(an,o),gt(xn,xn.current),!0}function tm(o,a,d){var m=o.stateNode;if(!m)throw Error(c(169));d?(o=em(o,a,Si),m.__reactInternalMemoizedMergedChildContext=o,bt(xn),bt(an),gt(an,o)):bt(xn),gt(xn,d)}var Xn=Math.clz32?Math.clz32:qb,$b=Math.log,Gb=Math.LN2;function qb(o){return o>>>=0,o===0?32:31-($b(o)/Gb|0)|0}var Ps=64,Is=4194304;function pa(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Ms(o,a){var d=o.pendingLanes;if(d===0)return 0;var m=0,v=o.suspendedLanes,b=o.pingedLanes,E=d&268435455;if(E!==0){var A=E&~v;A!==0?m=pa(A):(b&=E,b!==0&&(m=pa(b)))}else E=d&~v,E!==0?m=pa(E):b!==0&&(m=pa(b));if(m===0)return 0;if(a!==0&&a!==m&&!(a&v)&&(v=m&-m,b=a&-a,v>=b||v===16&&(b&4194240)!==0))return a;if(m&4&&(m|=d&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=m;0d;d++)a.push(o);return a}function ma(o,a,d){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-Xn(a),o[a]=d}function Kb(o,a){var d=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var m=o.eventTimes;for(o=o.expirationTimes;0>=E,v-=E,Er=1<<32-Xn(a)+v|d<ot?(Zt=$e,$e=null):Zt=$e.sibling;var at=ye(H,$e,G[ot],Se);if(at===null){$e===null&&($e=Zt);break}o&&$e&&at.alternate===null&&a(H,$e),R=b(at,R,ot),Xe===null?Oe=at:Xe.sibling=at,Xe=at,$e=Zt}if(ot===G.length)return d(H,$e),It&&wi(H,ot),Oe;if($e===null){for(;otot?(Zt=$e,$e=null):Zt=$e.sibling;var ti=ye(H,$e,at.value,Se);if(ti===null){$e===null&&($e=Zt);break}o&&$e&&ti.alternate===null&&a(H,$e),R=b(ti,R,ot),Xe===null?Oe=ti:Xe.sibling=ti,Xe=ti,$e=Zt}if(at.done)return d(H,$e),It&&wi(H,ot),Oe;if($e===null){for(;!at.done;ot++,at=G.next())at=Ue(H,at.value,Se),at!==null&&(R=b(at,R,ot),Xe===null?Oe=at:Xe.sibling=at,Xe=at);return It&&wi(H,ot),Oe}for($e=m(H,$e);!at.done;ot++,at=G.next())at=St($e,H,ot,at.value,Se),at!==null&&(o&&at.alternate!==null&&$e.delete(at.key===null?ot:at.key),R=b(at,R,ot),Xe===null?Oe=at:Xe.sibling=at,Xe=at);return o&&$e.forEach(function(zS){return a(H,zS)}),It&&wi(H,ot),Oe}function _r(H,R,G,Se){if(typeof G=="object"&&G!==null&&G.type===p&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case f:e:{for(var Oe=G.key,Xe=R;Xe!==null;){if(Xe.key===Oe){if(Oe=G.type,Oe===p){if(Xe.tag===7){d(H,Xe.sibling),R=v(Xe,G.props.children),R.return=H,H=R;break e}}else if(Xe.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===P&&bm(Oe)===Xe.type){d(H,Xe.sibling),R=v(Xe,G.props),R.ref=ga(H,Xe,G),R.return=H,H=R;break e}d(H,Xe);break}else a(H,Xe);Xe=Xe.sibling}G.type===p?(R=Ti(G.props.children,H.mode,Se,G.key),R.return=H,H=R):(Se=hl(G.type,G.key,G.props,null,H.mode,Se),Se.ref=ga(H,R,G),Se.return=H,H=Se)}return E(H);case h:e:{for(Xe=G.key;R!==null;){if(R.key===Xe)if(R.tag===4&&R.stateNode.containerInfo===G.containerInfo&&R.stateNode.implementation===G.implementation){d(H,R.sibling),R=v(R,G.children||[]),R.return=H,H=R;break e}else{d(H,R);break}else a(H,R);R=R.sibling}R=ud(G,H.mode,Se),R.return=H,H=R}return E(H);case P:return Xe=G._init,_r(H,R,Xe(G._payload),Se)}if(ie(G))return ft(H,R,G,Se);if(D(G))return wn(H,R,G,Se);Hs(H,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,R!==null&&R.tag===6?(d(H,R.sibling),R=v(R,G),R.return=H,H=R):(d(H,R),R=cd(G,H.mode,Se),R.return=H,H=R),E(H)):d(H,R)}return _r}var xo=Sm(!0),Cm=Sm(!1),xa={},Nn=Gr(xa),ya=Gr(xa),yo=Gr(xa);function lr(o){if(o===xa)throw Error(c(174));return o}function wu(o,a){gt(yo,a),gt(ya,o),gt(Nn,xa),o=U(a),bt(Nn),gt(Nn,o)}function bo(){bt(Nn),bt(ya),bt(yo)}function wm(o){var a=lr(yo.current),d=lr(Nn.current);a=K(d,o.type,a),d!==a&&(gt(ya,o),gt(Nn,a))}function ku(o){ya.current===o&&(bt(Nn),bt(ya))}var _t=Gr(0);function Ws(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Zp(d)||Zc(d)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ju=[];function Eu(){for(var o=0;od?d:4,o(!0);var m=Pu.transition;Pu.transition={};try{o(!1),a()}finally{it=d,Pu.transition=m}}function Hm(){return Fn().memoizedState}function lS(o,a,d){var m=Zr(o);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Wm(o))Vm(a,d);else if(d=fm(o,a,d,m),d!==null){var v=un();Ln(d,o,m,v),Um(d,a,m)}}function cS(o,a,d){var m=Zr(o),v={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Wm(o))Vm(a,v);else{var b=o.alternate;if(o.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var E=a.lastRenderedState,A=b(E,d);if(v.hasEagerState=!0,v.eagerState=A,Kn(A,E)){var W=a.interleaved;W===null?(v.next=v,yu(a)):(v.next=W.next,W.next=v),a.interleaved=v;return}}catch{}finally{}d=fm(o,a,v,m),d!==null&&(v=un(),Ln(d,o,m,v),Um(d,a,m))}}function Wm(o){var a=o.alternate;return o===Dt||a!==null&&a===Dt}function Vm(o,a){ba=Us=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function Um(o,a,d){if(d&4194240){var m=a.lanes;m&=o.pendingLanes,d|=m,a.lanes=d,ou(o,d)}}var qs={readContext:Rn,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useInsertionEffect:sn,useLayoutEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useMutableSource:sn,useSyncExternalStore:sn,useId:sn,unstable_isNewReconciler:!1},uS={readContext:Rn,useCallback:function(o,a){return cr().memoizedState=[o,a===void 0?null:a],o},useContext:Rn,useEffect:Om,useImperativeHandle:function(o,a,d){return d=d!=null?d.concat([o]):null,$s(4194308,4,Rm.bind(null,a,o),d)},useLayoutEffect:function(o,a){return $s(4194308,4,o,a)},useInsertionEffect:function(o,a){return $s(4,2,o,a)},useMemo:function(o,a){var d=cr();return a=a===void 0?null:a,o=o(),d.memoizedState=[o,a],o},useReducer:function(o,a,d){var m=cr();return a=d!==void 0?d(a):a,m.memoizedState=m.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},m.queue=o,o=o.dispatch=lS.bind(null,Dt,o),[m.memoizedState,o]},useRef:function(o){var a=cr();return o={current:o},a.memoizedState=o},useState:_m,useDebugValue:Au,useDeferredValue:function(o){return cr().memoizedState=o},useTransition:function(){var o=_m(!1),a=o[0];return o=sS.bind(null,o[1]),cr().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,d){var m=Dt,v=cr();if(It){if(d===void 0)throw Error(c(407));d=d()}else{if(d=a(),Qt===null)throw Error(c(349));ji&30||Em(m,a,d)}v.memoizedState=d;var b={value:d,getSnapshot:a};return v.queue=b,Om(Im.bind(null,m,b,o),[o]),m.flags|=2048,wa(9,Pm.bind(null,m,b,d,a),void 0,null),d},useId:function(){var o=cr(),a=Qt.identifierPrefix;if(It){var d=Pr,m=Er;d=(m&~(1<<32-Xn(m)-1)).toString(32)+d,a=":"+a+"R"+d,d=Sa++,0td&&(a.flags|=128,m=!0,Ea(v,!1),a.lanes=4194304)}else{if(!m)if(o=Ws(b),o!==null){if(a.flags|=128,m=!0,o=o.updateQueue,o!==null&&(a.updateQueue=o,a.flags|=4),Ea(v,!0),v.tail===null&&v.tailMode==="hidden"&&!b.alternate&&!It)return ln(a),null}else 2*Xt()-v.renderingStartTime>td&&d!==1073741824&&(a.flags|=128,m=!0,Ea(v,!1),a.lanes=4194304);v.isBackwards?(b.sibling=a.child,a.child=b):(o=v.last,o!==null?o.sibling=b:a.child=b,v.last=b)}return v.tail!==null?(a=v.tail,v.rendering=a,v.tail=a.sibling,v.renderingStartTime=Xt(),a.sibling=null,o=_t.current,gt(_t,m?o&1|2:o&1),a):(ln(a),null);case 22:case 23:return ad(),d=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==d&&(a.flags|=8192),d&&a.mode&1?_n&1073741824&&(ln(a),ve&&a.subtreeFlags&6&&(a.flags|=8192)):ln(a),null;case 24:return null;case 25:return null}throw Error(c(156,a.tag))}function xS(o,a){switch(du(a),a.tag){case 1:return yn(a.type)&&js(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return bo(),bt(xn),bt(an),Eu(),o=a.flags,o&65536&&!(o&128)?(a.flags=o&-65537|128,a):null;case 5:return ku(a),null;case 13:if(bt(_t),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(c(340));mo()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return bt(_t),null;case 4:return bo(),null;case 10:return gu(a.type._context),null;case 22:case 23:return ad(),null;case 24:return null;default:return null}}var Zs=!1,cn=!1,yS=typeof WeakSet=="function"?WeakSet:Set,we=null;function Co(o,a){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){Mt(o,a,m)}else d.current=null}function Vu(o,a,d){try{d()}catch(m){Mt(o,a,m)}}var cv=!1;function bS(o,a){for(ne(o.containerInfo),we=a;we!==null;)if(o=we,a=o.child,(o.subtreeFlags&1028)!==0&&a!==null)a.return=o,we=a;else for(;we!==null;){o=we;try{var d=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var m=d.memoizedProps,v=d.memoizedState,b=o.stateNode,E=b.getSnapshotBeforeUpdate(o.elementType===o.type?m:Zn(o.type,m),v);b.__reactInternalSnapshotBeforeUpdate=E}break;case 3:ve&&bi(o.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(A){Mt(o,o.return,A)}if(a=o.sibling,a!==null){a.return=o.return,we=a;break}we=o.return}return d=cv,cv=!1,d}function Pa(o,a,d){var m=a.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&o)===o){var b=v.destroy;v.destroy=void 0,b!==void 0&&Vu(a,d,b)}v=v.next}while(v!==m)}}function Js(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&o)===o){var m=d.create;d.destroy=m()}d=d.next}while(d!==a)}}function Uu(o){var a=o.ref;if(a!==null){var d=o.stateNode;switch(o.tag){case 5:o=oe(d);break;default:o=d}typeof a=="function"?a(o):a.current=o}}function uv(o){var a=o.alternate;a!==null&&(o.alternate=null,uv(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&Ve(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function dv(o){return o.tag===5||o.tag===3||o.tag===4}function fv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||dv(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function $u(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?hn(d,o,a):He(d,o);else if(m!==4&&(o=o.child,o!==null))for($u(o,a,d),o=o.sibling;o!==null;)$u(o,a,d),o=o.sibling}function Gu(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?De(d,o,a):ee(d,o);else if(m!==4&&(o=o.child,o!==null))for(Gu(o,a,d),o=o.sibling;o!==null;)Gu(o,a,d),o=o.sibling}var tn=null,Jn=!1;function dr(o,a,d){for(d=d.child;d!==null;)qu(o,a,d),d=d.sibling}function qu(o,a,d){if(or&&typeof or.onCommitFiberUnmount=="function")try{or.onCommitFiberUnmount(Ts,d)}catch{}switch(d.tag){case 5:cn||Co(d,a);case 6:if(ve){var m=tn,v=Jn;tn=null,dr(o,a,d),tn=m,Jn=v,tn!==null&&(Jn?pn(tn,d.stateNode):$t(tn,d.stateNode))}else dr(o,a,d);break;case 18:ve&&tn!==null&&(Jn?Bb(tn,d.stateNode):Lb(tn,d.stateNode));break;case 4:ve?(m=tn,v=Jn,tn=d.stateNode.containerInfo,Jn=!0,dr(o,a,d),tn=m,Jn=v):(_e&&(m=d.stateNode.containerInfo,v=Yp(m),Qc(m,v)),dr(o,a,d));break;case 0:case 11:case 14:case 15:if(!cn&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var b=v,E=b.destroy;b=b.tag,E!==void 0&&(b&2||b&4)&&Vu(d,a,E),v=v.next}while(v!==m)}dr(o,a,d);break;case 1:if(!cn&&(Co(d,a),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(A){Mt(d,a,A)}dr(o,a,d);break;case 21:dr(o,a,d);break;case 22:d.mode&1?(cn=(m=cn)||d.memoizedState!==null,dr(o,a,d),cn=m):dr(o,a,d);break;default:dr(o,a,d)}}function hv(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new yS),a.forEach(function(m){var v=MS.bind(null,o,m);d.has(m)||(d.add(m),m.then(v,v))})}}function er(o,a){var d=a.deletions;if(d!==null)for(var m=0;m";case tl:return":has("+(Ku(o)||"")+")";case nl:return'[role="'+o.value+'"]';case il:return'"'+o.value+'"';case rl:return'[data-testname="'+o.value+'"]';default:throw Error(c(365))}}function yv(o,a){var d=[];o=[o,0];for(var m=0;mv&&(v=E),m&=~b}if(m=v,m=Xt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*CS(m/1960))-m,10o?16:o,Qr===null)var m=!1;else{if(o=Qr,Qr=null,cl=0,Ke&6)throw Error(c(331));var v=Ke;for(Ke|=4,we=o.current;we!==null;){var b=we,E=b.child;if(we.flags&16){var A=b.deletions;if(A!==null){for(var W=0;WXt()-ed?Pi(o,0):Ju|=d),Cn(o,a)}function Iv(o,a){a===0&&(o.mode&1?(a=Is,Is<<=1,!(Is&130023424)&&(Is=4194304)):a=1);var d=un();o=sr(o,a),o!==null&&(ma(o,a,d),Cn(o,d))}function IS(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),Iv(o,d)}function MS(o,a){var d=0;switch(o.tag){case 13:var m=o.stateNode,v=o.memoizedState;v!==null&&(d=v.retryLane);break;case 19:m=o.stateNode;break;default:throw Error(c(314))}m!==null&&m.delete(a),Iv(o,d)}var Mv;Mv=function(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps||xn.current)bn=!0;else{if(!(o.lanes&d)&&!(a.flags&128))return bn=!1,vS(o,a,d);bn=!!(o.flags&131072)}else bn=!1,It&&a.flags&1048576&&am(a,Os,a.index);switch(a.lanes=0,a.tag){case 2:var m=a.type;Xs(o,a),o=a.pendingProps;var v=fo(a,an.current);go(a,d),v=Mu(null,a,m,o,v,d);var b=Tu();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,yn(m)?(b=!0,Es(a)):b=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,bu(a),v.updater=Bs,a.stateNode=v,v._reactInternals=a,Cu(a,m,o,d),a=Fu(null,a,m,!0,b,d)):(a.tag=0,It&&b&&uu(a),mn(null,a,v,d),a=a.child),a;case 16:m=a.elementType;e:{switch(Xs(o,a),o=a.pendingProps,v=m._init,m=v(m._payload),a.type=m,v=a.tag=_S(m),o=Zn(m,o),v){case 0:a=Nu(null,a,m,o,d);break e;case 1:a=tv(null,a,m,o,d);break e;case 11:a=Km(null,a,m,o,d);break e;case 14:a=Qm(null,a,m,Zn(m.type,o),d);break e}throw Error(c(306,m,""))}return a;case 0:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Nu(o,a,m,v,d);case 1:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),tv(o,a,m,v,d);case 3:e:{if(nv(a),o===null)throw Error(c(387));m=a.pendingProps,b=a.memoizedState,v=b.element,hm(o,a),Ls(a,m,null,d);var E=a.memoizedState;if(m=E.element,qe&&b.isDehydrated)if(b={element:m,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){v=So(Error(c(423)),a),a=rv(o,a,m,d,v);break e}else if(m!==v){v=So(Error(c(424)),a),a=rv(o,a,m,d,v);break e}else for(qe&&(zn=_b(a.stateNode.containerInfo),Tn=a,It=!0,Qn=null,va=!1),d=Cm(a,null,m,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(mo(),m===v){a=Mr(o,a,d);break e}mn(o,a,m,d)}a=a.child}return a;case 5:return wm(a),o===null&&hu(a),m=a.type,v=a.pendingProps,b=o!==null?o.memoizedProps:null,E=v.children,ue(m,v)?E=null:b!==null&&ue(m,b)&&(a.flags|=32),ev(o,a),mn(o,a,E,d),a.child;case 6:return o===null&&hu(a),null;case 13:return iv(o,a,d);case 4:return wu(a,a.stateNode.containerInfo),m=a.pendingProps,o===null?a.child=xo(a,null,m,d):mn(o,a,m,d),a.child;case 11:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Km(o,a,m,v,d);case 7:return mn(o,a,a.pendingProps,d),a.child;case 8:return mn(o,a,a.pendingProps.children,d),a.child;case 12:return mn(o,a,a.pendingProps.children,d),a.child;case 10:e:{if(m=a.type._context,v=a.pendingProps,b=a.memoizedProps,E=v.value,dm(a,m,E),b!==null)if(Kn(b.value,E)){if(b.children===v.children&&!xn.current){a=Mr(o,a,d);break e}}else for(b=a.child,b!==null&&(b.return=a);b!==null;){var A=b.dependencies;if(A!==null){E=b.child;for(var W=A.firstContext;W!==null;){if(W.context===m){if(b.tag===1){W=Ir(-1,d&-d),W.tag=2;var ae=b.updateQueue;if(ae!==null){ae=ae.shared;var Ee=ae.pending;Ee===null?W.next=W:(W.next=Ee.next,Ee.next=W),ae.pending=W}}b.lanes|=d,W=b.alternate,W!==null&&(W.lanes|=d),xu(b.return,d,a),A.lanes|=d;break}W=W.next}}else if(b.tag===10)E=b.type===a.type?null:b.child;else if(b.tag===18){if(E=b.return,E===null)throw Error(c(341));E.lanes|=d,A=E.alternate,A!==null&&(A.lanes|=d),xu(E,d,a),E=b.sibling}else E=b.child;if(E!==null)E.return=b;else for(E=b;E!==null;){if(E===a){E=null;break}if(b=E.sibling,b!==null){b.return=E.return,E=b;break}E=E.return}b=E}mn(o,a,v.children,d),a=a.child}return a;case 9:return v=a.type,m=a.pendingProps.children,go(a,d),v=Rn(v),m=m(v),a.flags|=1,mn(o,a,m,d),a.child;case 14:return m=a.type,v=Zn(m,a.pendingProps),v=Zn(m.type,v),Qm(o,a,m,v,d);case 15:return Zm(o,a,a.type,a.pendingProps,d);case 17:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Xs(o,a),a.tag=1,yn(m)?(o=!0,Es(a)):o=!1,go(a,d),xm(a,m,v),Cu(a,m,v,d),Fu(null,a,m,!0,o,d);case 19:return av(o,a,d);case 22:return Jm(o,a,d)}throw Error(c(156,a.tag))};function Tv(o,a){return au(o,a)}function TS(o,a,d,m){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bn(o,a,d,m){return new TS(o,a,d,m)}function ld(o){return o=o.prototype,!(!o||!o.isReactComponent)}function _S(o){if(typeof o=="function")return ld(o)?1:0;if(o!=null){if(o=o.$$typeof,o===w)return 11;if(o===M)return 14}return 2}function ei(o,a){var d=o.alternate;return d===null?(d=Bn(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function hl(o,a,d,m,v,b){var E=2;if(m=o,typeof o=="function")ld(o)&&(E=1);else if(typeof o=="string")E=5;else e:switch(o){case p:return Ti(d.children,v,b,a);case g:E=8,v|=8;break;case y:return o=Bn(12,d,a,v|2),o.elementType=y,o.lanes=b,o;case k:return o=Bn(13,d,a,v),o.elementType=k,o.lanes=b,o;case j:return o=Bn(19,d,a,v),o.elementType=j,o.lanes=b,o;case I:return pl(d,v,b,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case S:E=10;break e;case C:E=9;break e;case w:E=11;break e;case M:E=14;break e;case P:E=16,m=null;break e}throw Error(c(130,o==null?o:typeof o,""))}return a=Bn(E,d,a,v),a.elementType=o,a.type=m,a.lanes=b,a}function Ti(o,a,d,m){return o=Bn(7,o,m,a),o.lanes=d,o}function pl(o,a,d,m){return o=Bn(22,o,m,a),o.elementType=I,o.lanes=d,o.stateNode={isHidden:!1},o}function cd(o,a,d){return o=Bn(6,o,null,a),o.lanes=d,o}function ud(o,a,d){return a=Bn(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function DS(o,a,d,m,v){this.tag=a,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ge,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=iu(0),this.expirationTimes=iu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=iu(0),this.identifierPrefix=m,this.onRecoverableError=v,qe&&(this.mutableSourceEagerHydrationData=null)}function _v(o,a,d,m,v,b,E,A,W){return o=new DS(o,a,d,A,W),a===1?(a=1,b===!0&&(a|=8)):a=0,b=Bn(3,null,null,a),o.current=b,b.stateNode=o,b.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},bu(b),o}function Dv(o){if(!o)return qr;o=o._reactInternals;e:{if(V(o)!==o||o.tag!==1)throw Error(c(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(yn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(c(171))}if(o.tag===1){var d=o.type;if(yn(d))return em(o,d,a)}return a}function Ov(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(c(188)):(o=Object.keys(o).join(","),Error(c(268,o)));return o=X(a),o===null?null:o.stateNode}function Av(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d=ae&&b>=Ue&&v<=Ee&&E<=ye){o.splice(a,1);break}else if(m!==ae||d.width!==W.width||yeE){if(!(b!==Ue||d.height!==W.height||Eev)){ae>m&&(W.width+=ae-m,W.x=m),Eeb&&(W.height+=Ue-b,W.y=b),yed&&(d=E)),E ")+` - -No matching component was found for: - `)+o.join(" > ")}return null},n.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return oe(o.child.stateNode);default:return o.child.stateNode}},n.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:OS,findFiberByHostInstance:o.findFiberByHostInstance||AS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)o=!0;else{try{Ts=a.inject(o),or=a}catch{}o=!!a.checkDCE}}return o},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(o,a,d,m){if(!N)throw Error(c(363));o=Qu(o,a);var v=Ze(o,d,m).disconnect;return{disconnect:function(){v()}}},n.registerMutableSourceForHydration=function(o,a){var d=a._getVersion;d=d(a._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[a,d]:o.mutableSourceEagerHydrationData.push(a,d)},n.runWithPriority=function(o,a){var d=it;try{return it=o,a()}finally{it=d}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(o,a,d,m){var v=a.current,b=un(),E=Zr(v);return d=Dv(d),a.context===null?a.context=d:a.pendingContext=d,a=Ir(b,E),a.payload={element:o},m=m===void 0?null:m,m!==null&&(a.callback=m),o=Xr(v,a,E),o!==null&&(Ln(o,v,E,b),Fs(o,v,E)),E},n};(function(e){e.exports=ZI})(QI);const JI=SC(Af);var fc={},eM={get exports(){return fc},set exports(e){fc=e}},oo={};/** - * @license React - * react-reconciler-constants.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. - */oo.ConcurrentRoot=1;oo.ContinuousEventPriority=4;oo.DefaultEventPriority=16;oo.DiscreteEventPriority=1;oo.IdleEventPriority=536870912;oo.LegacyRoot=0;(function(e){e.exports=oo})(eM);const w0={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let k0=!1,j0=!1;const Dp=".react-konva-event",tM=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. -Position of a node will be changed during drag&drop, so you should update state of the react app as well. -Consider to add onDragMove or onDragEnd events. -For more info see: https://github.com/konvajs/react-konva/issues/256 -`,nM=`ReactKonva: You are using "zIndex" attribute for a Konva node. -react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. -For more info see: https://github.com/konvajs/react-konva/issues/194 -`,rM={};function Hc(e,t,n=rM){if(!k0&&"zIndex"in t&&(console.warn(nM),k0=!0),!j0&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(tM),j0=!0)}for(var s in n)if(!w0[s]){var c=s.slice(0,2)==="on",u=n[s]!==t[s];if(c&&u){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),e.off(f,n[s])}var h=!t.hasOwnProperty(s);h&&e.setAttr(s,void 0)}var p=t._useStrictMode,g={},y=!1;const S={};for(var s in t)if(!w0[s]){var c=s.slice(0,2)==="on",C=n[s]!==t[s];if(c&&C){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),t[s]&&(S[f]=t[s])}!c&&(t[s]!==n[s]||p&&t[s]!==e.getAttr(s))&&(y=!0,g[s]=t[s])}y&&(e.setAttrs(g),gi(e));for(var f in S)e.on(f+Dp,S[f])}function gi(e){if(!CC.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const v4={},iM={};qa.Node.prototype._applyProps=Hc;function oM(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),gi(e)}function aM(e,t,n){let r=qa[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=qa.Group);const i={},s={};for(var c in t){var u=c.slice(0,2)==="on";u?s[c]=t[c]:i[c]=t[c]}const f=new r(i);return Hc(f,s),f}function sM(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function lM(e,t,n){return!1}function cM(e){return e}function uM(){return null}function dM(){return null}function fM(e,t,n,r){return iM}function hM(){}function pM(e){}function mM(e,t){return!1}function vM(){return v4}function gM(){return v4}const xM=setTimeout,yM=clearTimeout,bM=-1;function SM(e,t){return!1}const CM=!1,wM=!0,kM=!0;function jM(e,t){t.parent===e?t.moveToTop():e.add(t),gi(e)}function EM(e,t){t.parent===e?t.moveToTop():e.add(t),gi(e)}function g4(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),gi(e)}function PM(e,t,n){g4(e,t,n)}function IM(e,t){t.destroy(),t.off(Dp),gi(e)}function MM(e,t){t.destroy(),t.off(Dp),gi(e)}function TM(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function _M(e,t,n){}function DM(e,t,n,r,i){Hc(e,i,r)}function OM(e){e.hide(),gi(e)}function AM(e){}function zM(e,t){(t.visible==null||t.visible)&&e.show()}function RM(e,t){}function NM(e){}function FM(){}const LM=()=>fc.DefaultEventPriority,BM=Object.freeze(Object.defineProperty({__proto__:null,appendChild:jM,appendChildToContainer:EM,appendInitialChild:oM,cancelTimeout:yM,clearContainer:NM,commitMount:_M,commitTextUpdate:TM,commitUpdate:DM,createInstance:aM,createTextInstance:sM,detachDeletedInstance:FM,finalizeInitialChildren:lM,getChildHostContext:gM,getCurrentEventPriority:LM,getPublicInstance:cM,getRootHostContext:vM,hideInstance:OM,hideTextInstance:AM,idlePriority:Ul.unstable_IdlePriority,insertBefore:g4,insertInContainerBefore:PM,isPrimaryRenderer:CM,noTimeout:bM,now:Ul.unstable_now,prepareForCommit:uM,preparePortalMount:dM,prepareUpdate:fM,removeChild:IM,removeChildFromContainer:MM,resetAfterCommit:hM,resetTextContent:pM,run:Ul.unstable_runWithPriority,scheduleTimeout:xM,shouldDeprioritizeSubtree:mM,shouldSetTextContent:SM,supportsMutation:kM,unhideInstance:zM,unhideTextInstance:RM,warnsIfNotActing:wM},Symbol.toStringTag,{value:"Module"}));var HM=Object.defineProperty,WM=Object.defineProperties,VM=Object.getOwnPropertyDescriptors,E0=Object.getOwnPropertySymbols,UM=Object.prototype.hasOwnProperty,$M=Object.prototype.propertyIsEnumerable,P0=(e,t,n)=>t in e?HM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I0=(e,t)=>{for(var n in t||(t={}))UM.call(t,n)&&P0(e,n,t[n]);if(E0)for(var n of E0(t))$M.call(t,n)&&P0(e,n,t[n]);return e},GM=(e,t)=>WM(e,VM(t));function x4(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const i=x4(r,t,n);if(i)return i;r=t?null:r.sibling}}function y4(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Op=y4(x.createContext(null));class b4 extends x.Component{render(){return x.createElement(Op.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:qM,ReactCurrentDispatcher:YM}=x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function XM(){const e=x.useContext(Op);if(!e)throw new Error("its-fine: useFiber must be called within a !");const t=x.useId();return x.useMemo(()=>{var r;return(r=qM.current)!=null?r:x4(e,!1,i=>{let s=i.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}})},[e,t])}function KM(){var e,t;const n=XM(),[r]=x.useState(()=>new Map);r.clear();let i=n;for(;i;){const s=(e=i.type)==null?void 0:e._context;s&&s!==Op&&!r.has(s)&&r.set(s,(t=YM.current)==null?void 0:t.readContext(y4(s))),i=i.return}return x.useMemo(()=>Array.from(r.keys()).reduce((s,c)=>u=>x.createElement(s,null,x.createElement(c.Provider,GM(I0({},u),{value:r.get(c)}))),s=>x.createElement(b4,I0({},s))),[r])}function QM(e){const t=ke.useRef();return ke.useLayoutEffect(()=>{t.current=e}),t.current}const ZM=e=>{const t=ke.useRef(),n=ke.useRef(),r=ke.useRef(),i=QM(e),s=KM(),c=u=>{const{forwardedRef:f}=e;f&&(typeof f=="function"?f(u):f.current=u)};return ke.useLayoutEffect(()=>(n.current=new qa.Stage({width:e.width,height:e.height,container:t.current}),c(n.current),r.current=Ba.createContainer(n.current,fc.LegacyRoot,!1,null),Ba.updateContainer(ke.createElement(s,{},e.children),r.current),()=>{qa.isBrowser&&(c(null),Ba.updateContainer(null,r.current,null),n.current.destroy())}),[]),ke.useLayoutEffect(()=>{c(n.current),Hc(n.current,e,i),Ba.updateContainer(ke.createElement(s,{},e.children),r.current,null)}),ke.createElement("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},za="Layer",Br="Group",Hr="Rect",_i="Circle",hc="Line",S4="Image",JM="Transformer",Ba=JI(BM);Ba.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:ke.version,rendererPackageName:"react-konva"});const eT=ke.forwardRef((e,t)=>ke.createElement(b4,{},ke.createElement(ZM,{...e,forwardedRef:t}))),tT=be([tt,zt],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),nT=()=>{const e=Y(),{tool:t,isStaging:n,isMovingBoundingBox:r}=O(tT);return{handleDragStart:x.useCallback(()=>{(t==="move"||n)&&!r&&e(Jl(!0))},[e,r,n,t]),handleDragMove:x.useCallback(i=>{if(!((t==="move"||n)&&!r))return;const s={x:i.target.x(),y:i.target.y()};e(Y1(s))},[e,r,n,t]),handleDragEnd:x.useCallback(()=>{(t==="move"||n)&&!r&&e(Jl(!1))},[e,r,n,t])}},rT=be([tt,Bt,zt],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:i,shouldShowBoundingBox:s,tool:c,isMaskEnabled:u,shouldSnapToGrid:f}=e;return{activeTabName:t,isCursorOnCanvas:Boolean(r),shouldLockBoundingBox:i,shouldShowBoundingBox:s,tool:c,isStaging:n,isMaskEnabled:u,shouldSnapToGrid:f}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),iT=()=>{const e=Y(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:i,isMaskEnabled:s,shouldSnapToGrid:c}=O(rT),u=x.useRef(null),f=X1(),h=()=>e(Zf());fe(["shift+c"],()=>{h()},{enabled:()=>!i,preventDefault:!0},[]);const p=()=>e(ss(!s));fe(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[s]),fe(["n"],()=>{e(ec(!c))},{enabled:!0,preventDefault:!0},[c]),fe("esc",()=>{e(wC())},{enabled:()=>!0,preventDefault:!0}),fe("shift+h",()=>{e(kC(!n))},{enabled:()=>!i,preventDefault:!0},[t,n]),fe(["space"],g=>{g.repeat||(f==null||f.container().focus(),r!=="move"&&(u.current=r,e(xr("move"))),r==="move"&&u.current&&u.current!=="move"&&(e(xr(u.current)),u.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,u])},Ap=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},C4=()=>{const e=Y(),t=Sr(),n=X1();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const i=jC.pixelRatio,[s,c,u,f]=t.getContext().getImageData(r.x*i,r.y*i,1,1).data;e(EC({r:s,g:c,b:u,a:f}))},commitColorUnderCursor:()=>{e(PC())}}},oT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),aT=e=>{const t=Y(),{tool:n,isStaging:r}=O(oT),{commitColorUnderCursor:i}=C4();return x.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Jl(!0));return}if(n==="colorPicker"){i();return}const c=Ap(e.current);c&&(s.evt.preventDefault(),t(K1(!0)),t(IC([c.x,c.y])))},[e,n,r,t,i])},sT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r,isDrawing:i}=t;return{tool:r,isDrawing:i,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),lT=(e,t,n)=>{const r=Y(),{isDrawing:i,tool:s,isStaging:c}=O(sT),{updateColorUnderCursor:u}=C4();return x.useCallback(()=>{if(!e.current)return;const f=Ap(e.current);if(f){if(r(MC(f)),n.current=f,s==="colorPicker"){u();return}!i||s==="move"||c||(t.current=!0,r(Q1([f.x,f.y])))}},[t,r,i,c,n,e,s,u])},cT=()=>{const e=Y();return x.useCallback(()=>{e(TC())},[e])},uT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r,isDrawing:i}=t;return{tool:r,isDrawing:i,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),dT=(e,t)=>{const n=Y(),{tool:r,isDrawing:i,isStaging:s}=O(uT);return x.useCallback(()=>{if(r==="move"||s){n(Jl(!1));return}if(!t.current&&i&&e.current){const c=Ap(e.current);if(!c)return;n(Q1([c.x,c.y]))}else t.current=!1;n(K1(!1))},[t,n,i,s,e,r])},fT=be([tt],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),hT=e=>{const t=Y(),{isMoveStageKeyHeld:n,stageScale:r}=O(fT);return x.useCallback(i=>{if(!e.current||n)return;i.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const c={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let u=i.evt.deltaY;i.evt.ctrlKey&&(u=-u);const f=te.clamp(r*_C**u,DC,OC),h={x:s.x-c.x*f,y:s.y-c.y*f};t(AC(f)),t(Y1(h))},[e,n,r,t])},pT=be(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:i,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c,stageDimensions:r,stageScale:i}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),mT=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:i,stageScale:s}=O(pT);return l.jsxs(Br,{children:[l.jsx(Hr,{offsetX:r.x/s,offsetY:r.y/s,height:i.height/s,width:i.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),l.jsx(Hr,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},vT=be([tt],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),gT={dark:"rgba(255, 255, 255, 0.2)",green:"rgba(255, 255, 255, 0.2)",light:"rgba(0, 0, 0, 0.2)",ocean:"rgba(136, 148, 184, 0.2)"},xT=()=>{const e=O(u=>u.ui.currentTheme),{stageScale:t,stageCoordinates:n,stageDimensions:r}=O(vT),[i,s]=x.useState([]),c=x.useCallback(u=>u/t,[t]);return x.useLayoutEffect(()=>{const u=gT[e],{width:f,height:h}=r,{x:p,y:g}=n,y={x1:0,y1:0,x2:f,y2:h,offset:{x:c(p),y:c(g)}},S={x:Math.ceil(c(p)/64)*64,y:Math.ceil(c(g)/64)*64},C={x1:-S.x,y1:-S.y,x2:c(f)-S.x+64,y2:c(h)-S.y+64},k={x1:Math.min(y.x1,C.x1),y1:Math.min(y.y1,C.y1),x2:Math.max(y.x2,C.x2),y2:Math.max(y.y2,C.y2)},j=k.x2-k.x1,M=k.y2-k.y1,P=Math.round(j/64)+1,I=Math.round(M/64)+1,T=te.range(0,P).map(_=>l.jsx(hc,{x:k.x1+_*64,y:k.y1,points:[0,0,0,M],stroke:u,strokeWidth:1},`x_${_}`)),D=te.range(0,I).map(_=>l.jsx(hc,{x:k.x1,y:k.y1+_*64,points:[0,0,j,0],stroke:u,strokeWidth:1},`y_${_}`));s(T.concat(D))},[t,n,r,e,c]),l.jsx(Br,{children:i})},yT=be([e=>e.gallery],e=>e.intermediateImage?e.intermediateImage:null,{memoizeOptions:{resultEqualityCheck:te.isEqual}}),bT=e=>{const{...t}=e,n=O(yT),[r,i]=x.useState(null);if(x.useEffect(()=>{if(!n)return;const h=new Image;h.onload=()=>{i(h)},h.src=n.url},[n]),!(n!=null&&n.boundingBox))return null;const{boundingBox:{x:s,y:c,width:u,height:f}}=n;return r?l.jsx(S4,{x:s,y:c,width:u,height:f,image:r,listening:!1,...t}):null},qi=e=>{const{r:t,g:n,b:r,a:i}=e;return`rgba(${t}, ${n}, ${r}, ${i})`},ST=be(tt,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:i}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:i,maskColorString:qi(t)}}),M0=e=>`data:image/svg+xml;utf8, - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`.replaceAll("black",e),CT=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:i,stageScale:s}=O(ST),[c,u]=x.useState(null),[f,h]=x.useState(0),p=x.useRef(null),g=x.useCallback(()=>{h(f+1),setTimeout(g,500)},[f]);return x.useEffect(()=>{if(c)return;const y=new Image;y.onload=()=>{u(y)},y.src=M0(n)},[c,n]),x.useEffect(()=>{c&&(c.src=M0(n))},[c,n]),x.useEffect(()=>{const y=setInterval(()=>h(S=>(S+1)%5),50);return()=>clearInterval(y)},[]),!c||!te.isNumber(r.x)||!te.isNumber(r.y)||!te.isNumber(s)||!te.isNumber(i.width)||!te.isNumber(i.height)?null:l.jsx(Hr,{ref:p,offsetX:r.x/s,offsetY:r.y/s,height:i.height/s,width:i.width/s,fillPatternImage:c,fillPatternOffsetY:te.isNumber(f)?f:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},wT=be([tt],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),kT=e=>{const{...t}=e,{objects:n}=O(wT);return l.jsx(Br,{listening:!1,...t,children:n.filter(zC).map((r,i)=>l.jsx(hc,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},i))})};var Di=x,jT=function(t,n,r){const i=Di.useRef("loading"),s=Di.useRef(),[c,u]=Di.useState(0),f=Di.useRef(),h=Di.useRef(),p=Di.useRef();return(f.current!==t||h.current!==n||p.current!==r)&&(i.current="loading",s.current=void 0,f.current=t,h.current=n,p.current=r),Di.useLayoutEffect(function(){if(!t)return;var g=document.createElement("img");function y(){i.current="loaded",s.current=g,u(Math.random())}function S(){i.current="failed",s.current=void 0,u(Math.random())}return g.addEventListener("load",y),g.addEventListener("error",S),n&&(g.crossOrigin=n),r&&(g.referrerpolicy=r),g.src=t,function(){g.removeEventListener("load",y),g.removeEventListener("error",S)}},[t,n,r]),[s.current,i.current]};const w4=e=>{const{url:t,x:n,y:r}=e,[i]=jT(t);return l.jsx(S4,{x:n,y:r,image:i,listening:!1})},ET=be([tt],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),PT=()=>{const{objects:e}=O(ET);return e?l.jsx(Br,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(T1(t))return l.jsx(w4,{x:t.x,y:t.y,url:t.image.url},n);if(RC(t)){const r=l.jsx(hc,{points:t.points,stroke:t.color?qi(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?l.jsx(Br,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(NC(t))return l.jsx(Hr,{x:t.x,y:t.y,width:t.width,height:t.height,fill:qi(t.color)},n);if(FC(t))return l.jsx(Hr,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},IT=be([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingImage:r,shouldShowStagingOutline:i,boundingBoxCoordinates:{x:s,y:c},boundingBoxDimensions:{width:u,height:f}}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:r,shouldShowStagingOutline:i,x:s,y:c,width:u,height:f}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),MT=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:i,x:s,y:c,width:u,height:f}=O(IT);return l.jsxs(Br,{...t,children:[r&&n&&l.jsx(w4,{url:n.image.url,x:s,y:c}),i&&l.jsxs(Br,{children:[l.jsx(Hr,{x:s,y:c,width:u,height:f,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),l.jsx(Hr,{x:s,y:c,width:u,height:f,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},TT=be([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:i}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:i,shouldShowStagingOutline:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),_T=()=>{const e=Y(),{isOnFirstImage:t,isOnLastImage:n,currentStagingAreaImage:r,shouldShowStagingImage:i}=O(TT),{t:s}=Z(),c=x.useCallback(()=>{e(Uv(!0))},[e]),u=x.useCallback(()=>{e(Uv(!1))},[e]);fe(["left"],()=>{f()},{enabled:()=>!0,preventDefault:!0}),fe(["right"],()=>{h()},{enabled:()=>!0,preventDefault:!0}),fe(["enter"],()=>{p()},{enabled:()=>!0,preventDefault:!0});const f=()=>e(LC()),h=()=>e(BC()),p=()=>e(HC());return r?l.jsx(B,{pos:"absolute",bottom:4,w:"100%",align:"center",justify:"center",filter:"drop-shadow(0 0.5rem 1rem rgba(0,0,0))",onMouseOver:c,onMouseOut:u,children:l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:l.jsx(M8,{}),onClick:f,colorScheme:"accent",isDisabled:t}),l.jsx(le,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:l.jsx(T8,{}),onClick:h,colorScheme:"accent",isDisabled:n}),l.jsx(le,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:l.jsx(zc,{}),onClick:p,colorScheme:"accent"}),l.jsx(le,{tooltip:s("unifiedCanvas.showHide"),"aria-label":s("unifiedCanvas.showHide"),"data-alert":!i,icon:i?l.jsx(N8,{}):l.jsx(R8,{}),onClick:()=>e(WC(!i)),colorScheme:"accent"}),l.jsx(le,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),icon:l.jsx(op,{}),onClick:()=>e(VC(r.image.url)),colorScheme:"accent"}),l.jsx(le,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),onClick:()=>e(UC()),colorScheme:"error",fontSize:20})]})}):null},Ho=e=>Math.round(e*100)/100,DT=be([tt],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Ho(n)}, ${Ho(r)})`}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function OT(){const{cursorCoordinatesString:e}=O(DT),{t}=Z();return l.jsx(We,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const zf="var(--invokeai-colors-warning-500)",AT=be([tt],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:i},boundingBoxDimensions:{width:s,height:c},scaledBoundingBoxDimensions:{width:u,height:f},boundingBoxCoordinates:{x:h,y:p},stageScale:g,shouldShowCanvasDebugInfo:y,layer:S,boundingBoxScaleMethod:C,shouldPreserveMaskedArea:w}=e;let k="inherit";return(C==="none"&&(s<512||c<512)||C==="manual"&&u*f<512*512)&&(k=zf),{activeLayerColor:S==="mask"?zf:"inherit",activeLayerString:S.charAt(0).toUpperCase()+S.slice(1),boundingBoxColor:k,boundingBoxCoordinatesString:`(${Ho(h)}, ${Ho(p)})`,boundingBoxDimensionsString:`${s}×${c}`,scaledBoundingBoxDimensionsString:`${u}×${f}`,canvasCoordinatesString:`${Ho(r)}×${Ho(i)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(g*100),shouldShowCanvasDebugInfo:y,shouldShowBoundingBox:C!=="auto",shouldShowScaledBoundingBox:C!=="none",shouldPreserveMaskedArea:w}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),zT=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:i,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:c,canvasCoordinatesString:u,canvasDimensionsString:f,canvasScaleString:h,shouldShowCanvasDebugInfo:p,shouldShowBoundingBox:g,shouldPreserveMaskedArea:y}=O(AT),{t:S}=Z();return l.jsxs(B,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"blackAlpha.500"},children:[l.jsx(We,{style:{color:e},children:`${S("unifiedCanvas.activeLayer")}: ${t}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasScale")}: ${h}%`}),y&&l.jsx(We,{style:{color:zf},children:"Preserve Masked Area: On"}),g&&l.jsx(We,{style:{color:n},children:`${S("unifiedCanvas.boundingBox")}: ${i}`}),c&&l.jsx(We,{style:{color:n},children:`${S("unifiedCanvas.scaledBoundingBox")}: ${s}`}),p&&l.jsxs(l.Fragment,{children:[l.jsx(We,{children:`${S("unifiedCanvas.boundingBoxPosition")}: ${r}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasDimensions")}: ${f}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasPosition")}: ${u}`}),l.jsx(OT,{})]})]})},RT=be(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageScale:r,isDrawing:i,isTransformingBoundingBox:s,isMovingBoundingBox:c,tool:u,shouldSnapToGrid:f}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,isDrawing:i,isMovingBoundingBox:c,isTransformingBoundingBox:s,stageScale:r,shouldSnapToGrid:f,tool:u,hitStrokeWidth:20/r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),NT=e=>{const{...t}=e,n=Y(),{boundingBoxCoordinates:r,boundingBoxDimensions:i,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:u,stageScale:f,shouldSnapToGrid:h,tool:p,hitStrokeWidth:g}=O(RT),y=x.useRef(null),S=x.useRef(null),[C,w]=x.useState(!1);x.useEffect(()=>{var X;!y.current||!S.current||(y.current.nodes([S.current]),(X=y.current.getLayer())==null||X.batchDraw())},[]);const k=64*f,j=x.useCallback(X=>{if(!h){n(fd({x:Math.floor(X.target.x()),y:Math.floor(X.target.y())}));return}const $=X.target.x(),Q=X.target.y(),ie=$v($,64),oe=$v(Q,64);X.target.x(ie),X.target.y(oe),n(fd({x:ie,y:oe}))},[n,h]),M=x.useCallback(()=>{if(!S.current)return;const X=S.current,$=X.scaleX(),Q=X.scaleY(),ie=Math.round(X.width()*$),oe=Math.round(X.height()*Q),U=Math.round(X.x()),K=Math.round(X.y());n(Na({width:ie,height:oe})),n(fd({x:h?xl(U,64):U,y:h?xl(K,64):K})),X.scaleX(1),X.scaleY(1)},[n,h]),P=x.useCallback((X,$,Q)=>{const ie=X.x%k,oe=X.y%k;return{x:xl($.x,k)+ie,y:xl($.y,k)+oe}},[k]),I=()=>{n(hd(!0))},T=()=>{n(hd(!1)),n(pd(!1)),n(yl(!1)),w(!1)},D=()=>{n(pd(!0))},_=()=>{n(hd(!1)),n(pd(!1)),n(yl(!1)),w(!1)},z=()=>{w(!0)},V=()=>{!u&&!c&&w(!1)},F=()=>{n(yl(!0))},L=()=>{n(yl(!1))};return l.jsxs(Br,{...t,children:[l.jsx(Hr,{height:i.height,width:i.width,x:r.x,y:r.y,onMouseEnter:F,onMouseOver:F,onMouseLeave:L,onMouseOut:L}),l.jsx(Hr,{draggable:!0,fillEnabled:!1,height:i.height,hitStrokeWidth:g,listening:!s&&p==="move",onDragStart:D,onDragEnd:_,onDragMove:j,onMouseDown:D,onMouseOut:V,onMouseOver:z,onMouseEnter:z,onMouseUp:_,onTransform:M,onTransformEnd:T,ref:S,stroke:C?"rgba(255,255,255,0.7)":"white",strokeWidth:(C?8:1)/f,width:i.width,x:r.x,y:r.y}),l.jsx(JM,{anchorCornerRadius:3,anchorDragBoundFunc:P,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:p==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&p==="move",onDragStart:D,onDragEnd:_,onMouseDown:I,onMouseUp:T,onTransformEnd:T,ref:y,rotateEnabled:!1})]})},FT=be(tt,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:i,brushColor:s,tool:c,layer:u,shouldShowBrush:f,isMovingBoundingBox:h,isTransformingBoundingBox:p,stageScale:g,stageDimensions:y,boundingBoxCoordinates:S,boundingBoxDimensions:C,shouldRestrictStrokesToBox:w}=e,k=w?{clipX:S.x,clipY:S.y,clipWidth:C.width,clipHeight:C.height}:{};return{cursorPosition:t,brushX:t?t.x:y.width/2,brushY:t?t.y:y.height/2,radius:n/2,colorPickerOuterRadius:Gv/g,colorPickerInnerRadius:(Gv-sf+1)/g,maskColorString:qi({...i,a:.5}),brushColorString:qi(s),colorPickerColorString:qi(r),tool:c,layer:u,shouldShowBrush:f,shouldDrawBrushPreview:!(h||p||!t)&&f,strokeWidth:1.5/g,dotRadius:1.5/g,clip:k}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),LT=e=>{const{...t}=e,{brushX:n,brushY:r,radius:i,maskColorString:s,tool:c,layer:u,shouldDrawBrushPreview:f,dotRadius:h,strokeWidth:p,brushColorString:g,colorPickerColorString:y,colorPickerInnerRadius:S,colorPickerOuterRadius:C,clip:w}=O(FT);return f?l.jsxs(Br,{listening:!1,...w,...t,children:[c==="colorPicker"?l.jsxs(l.Fragment,{children:[l.jsx(_i,{x:n,y:r,radius:C,stroke:g,strokeWidth:sf,strokeScaleEnabled:!1}),l.jsx(_i,{x:n,y:r,radius:S,stroke:y,strokeWidth:sf,strokeScaleEnabled:!1})]}):l.jsxs(l.Fragment,{children:[l.jsx(_i,{x:n,y:r,radius:i,fill:u==="mask"?s:g,globalCompositeOperation:c==="eraser"?"destination-out":"source-out"}),l.jsx(_i,{x:n,y:r,radius:i,stroke:"rgba(255,255,255,0.4)",strokeWidth:p*2,strokeEnabled:!0,listening:!1}),l.jsx(_i,{x:n,y:r,radius:i,stroke:"rgba(0,0,0,1)",strokeWidth:p,strokeEnabled:!0,listening:!1})]}),l.jsx(_i,{x:n,y:r,radius:h*2,fill:"rgba(255,255,255,0.4)",listening:!1}),l.jsx(_i,{x:n,y:r,radius:h,fill:"rgba(0,0,0,1)",listening:!1})]}):null},BT=be([tt,zt],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:i,isTransformingBoundingBox:s,isMouseOverBoundingBox:c,isMovingBoundingBox:u,stageDimensions:f,stageCoordinates:h,tool:p,isMovingStage:g,shouldShowIntermediates:y,shouldShowGrid:S,shouldRestrictStrokesToBox:C}=e;let w="none";return p==="move"||t?g?w="grabbing":w="grab":s?w=void 0:C&&!c&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||u,shouldShowBoundingBox:i,shouldShowGrid:S,stageCoordinates:h,stageCursor:w,stageDimensions:f,stageScale:r,tool:p,isStaging:t,shouldShowIntermediates:y}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),HT=re(eT,{shouldForwardProp:e=>!["sx"].includes(e)}),k4=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:i,stageCursor:s,stageDimensions:c,stageScale:u,tool:f,isStaging:h,shouldShowIntermediates:p}=O(BT);iT();const g=x.useRef(null),y=x.useRef(null),S=x.useCallback(V=>{GC(V),g.current=V},[]),C=x.useCallback(V=>{$C(V),y.current=V},[]),w=x.useRef({x:0,y:0}),k=x.useRef(!1),j=hT(g),M=aT(g),P=dT(g,k),I=lT(g,k,w),T=cT(),{handleDragStart:D,handleDragMove:_,handleDragEnd:z}=nT();return l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:l.jsxs(We,{sx:{position:"relative"},children:[l.jsxs(HT,{tabIndex:-1,ref:S,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:i.x,y:i.y,width:c.width,height:c.height,scale:{x:u,y:u},onTouchStart:M,onTouchMove:I,onTouchEnd:P,onMouseDown:M,onMouseLeave:T,onMouseMove:I,onMouseUp:P,onDragStart:D,onDragMove:_,onDragEnd:z,onContextMenu:V=>V.evt.preventDefault(),onWheel:j,draggable:(f==="move"||h)&&!t,children:[l.jsx(za,{id:"grid",visible:r,children:l.jsx(xT,{})}),l.jsx(za,{id:"base",ref:C,listening:!1,imageSmoothingEnabled:!1,children:l.jsx(PT,{})}),l.jsxs(za,{id:"mask",visible:e,listening:!1,children:[l.jsx(kT,{visible:!0,listening:!1}),l.jsx(CT,{listening:!1})]}),l.jsx(za,{children:l.jsx(mT,{})}),l.jsxs(za,{id:"preview",imageSmoothingEnabled:!1,children:[!h&&l.jsx(LT,{visible:f!=="move",listening:!1}),l.jsx(MT,{visible:h}),p&&l.jsx(bT,{}),l.jsx(NT,{visible:n&&!h})]})]}),l.jsx(zT,{}),l.jsx(_T,{})]})})},WT=be(tt,Ny,Bt,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:i}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:i}}),j4=()=>{const e=Y(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:i}=O(WT),s=x.useRef(null);return x.useLayoutEffect(()=>{window.setTimeout(()=>{if(!s.current)return;const{clientWidth:c,clientHeight:u}=s.current;e(qC({width:c,height:u})),e(i?YC():Sc()),e(on(!1))},0)},[e,r,t,n,i]),l.jsx(B,{ref:s,sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:l.jsx(Qf,{thickness:"2px",speed:"1s",size:"xl"})})},VT=be([tt,Bt,Pt],(e,t,n)=>{const{futureLayerStates:r}=e;return{canRedo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function E4(){const e=Y(),{canRedo:t,activeTabName:n}=O(VT),{t:r}=Z(),i=()=>{e(XC())};return fe(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{i()},{enabled:()=>t,preventDefault:!0},[n,t]),l.jsx(le,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:l.jsx(Y8,{}),onClick:i,isDisabled:!t})}const UT=be([tt,Bt,Pt],(e,t,n)=>{const{pastLayerStates:r}=e;return{canUndo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function P4(){const e=Y(),{t}=Z(),{canUndo:n,activeTabName:r}=O(UT),i=()=>{e(KC())};return fe(["meta+z","ctrl+z"],()=>{i()},{enabled:()=>n,preventDefault:!0},[r,n]),l.jsx(le,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:l.jsx(J8,{}),onClick:i,isDisabled:!n})}const $T=(e,t,n)=>{const r=document.createElement("img");r.addEventListener("load",()=>{const i=document.createElement("canvas");i.width=t,i.height=n;const s=i.getContext("2d");s&&(s.drawImage(r,0,0),i.toBlob(c=>{c&&navigator.clipboard.write([new ClipboardItem({[c.type]:c})])}),i.remove(),r.remove())}),r.src=e},GT=e=>{const t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t),t.remove()},qT=(e,t,n,r)=>{const i=e.scale(),s=e.getClientRect({relativeTo:e.getParent()});e.scale({x:1/t,y:1/t});const{x:c,y:u,width:f,height:h}=e.getClientRect(),p=r?{x:r.x+n.x,y:r.y+n.y,width:r.width,height:r.height}:{x:c,y:u,width:f,height:h},g=e.toDataURL(p);return e.scale(i),{dataURL:g,boundingBox:{x:s.x,y:s.y,width:f,height:h}}},YT={cropVisible:!1,cropToBoundingBox:!1,shouldSaveToGallery:!1,shouldDownload:!1,shouldCopy:!1,shouldSetAsInitialImage:!0},ai=(e=YT)=>async(t,n)=>{const{cropVisible:r,cropToBoundingBox:i,shouldSaveToGallery:s,shouldDownload:c,shouldCopy:u,shouldSetAsInitialImage:f}=e;t(QC("Exporting Image")),t(bl(!1));const h=n(),{stageScale:p,boundingBoxCoordinates:g,boundingBoxDimensions:y,stageCoordinates:S}=h.canvas,C=Sr();if(!C){t(md(!1)),t(bl(!0));return}const{dataURL:w,boundingBox:k}=qT(C,p,S,i?{...g,...y}:void 0);if(!w){t(md(!1)),t(bl(!0));return}const j=new FormData;j.append("data",JSON.stringify({dataURL:w,filename:"merged_canvas.png",kind:s?"result":"temp",cropVisible:r}));const P=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:j})).json(),{url:I,width:T,height:D}=P,_={uuid:P1(),category:s?"result":"user",...P};c&&(GT(I),t(Sl({title:nr.t("toast.downloadImageStarted"),status:"success",duration:2500,isClosable:!0}))),u&&($T(I,T,D),t(Sl({title:nr.t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0}))),s&&(t(I1({image:_,category:"result"})),t(Sl({title:nr.t("toast.imageSavedToGallery"),status:"success",duration:2500,isClosable:!0}))),f&&(t(ZC({kind:"image",layer:"base",...k,image:_})),t(Sl({title:nr.t("toast.canvasMerged"),status:"success",duration:2500,isClosable:!0}))),t(md(!1)),t(JC(nr.t("common.statusConnected"))),t(bl(!0))};function XT(){const e=O(zt),t=Sr(),n=O(u=>u.system.isProcessing),r=O(u=>u.canvas.shouldCropToBoundingBoxOnSave),i=Y(),{t:s}=Z();fe(["meta+c","ctrl+c"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{i(ai({cropVisible:!r,cropToBoundingBox:r,shouldCopy:!0}))};return l.jsx(le,{"aria-label":`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Jo,{}),onClick:c,isDisabled:e})}function KT(){const e=Y(),{t}=Z(),n=Sr(),r=O(zt),i=O(u=>u.system.isProcessing),s=O(u=>u.canvas.shouldCropToBoundingBoxOnSave);fe(["shift+d"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n,i]);const c=()=>{e(ai({cropVisible:!s,cropToBoundingBox:s,shouldDownload:!0}))};return l.jsx(le,{"aria-label":`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(ip,{}),onClick:c,isDisabled:r})}function QT(){const e=O(zt),{openUploader:t}=Zh(),{t:n}=Z();return l.jsx(le,{"aria-label":n("common.upload"),tooltip:n("common.upload"),icon:l.jsx(Rc,{}),onClick:t,isDisabled:e})}const ZT=be([tt,zt],(e,t)=>{const{layer:n,isMaskEnabled:r}=e;return{layer:n,isMaskEnabled:r,isStaging:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function JT(){const e=Y(),{t}=Z(),{layer:n,isMaskEnabled:r,isStaging:i}=O(ZT),s=()=>{e(tc(n==="mask"?"base":"mask"))};fe(["q"],()=>{s()},{enabled:()=>!i,preventDefault:!0},[n]);const c=u=>{const f=u.target.value;e(tc(f)),f==="mask"&&!r&&e(ss(!0))};return l.jsx(Mn,{tooltip:`${t("unifiedCanvas.layer")} (Q)`,"aria-label":`${t("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:n,validValues:Z1,onChange:c,isDisabled:i})}function e_(){const e=Y(),{t}=Z(),n=Sr(),r=O(zt),i=O(c=>c.system.isProcessing);fe(["shift+m"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n,i]);const s=()=>{e(ai({cropVisible:!1,shouldSetAsInitialImage:!0}))};return l.jsx(le,{"aria-label":`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(zy,{}),onClick:s,isDisabled:r})}function t_(){const e=O(s=>s.canvas.tool),t=O(zt),n=Y(),{t:r}=Z();fe(["v"],()=>{i()},{enabled:()=>!t,preventDefault:!0},[]);const i=()=>n(xr("move"));return l.jsx(le,{"aria-label":`${r("unifiedCanvas.move")} (V)`,tooltip:`${r("unifiedCanvas.move")} (V)`,icon:l.jsx(My,{}),isChecked:e==="move"||t,onClick:i})}function n_(){const e=O(i=>i.ui.shouldPinParametersPanel),t=Y(),{t:n}=Z(),r=()=>{t(Hi(!0)),e&&setTimeout(()=>t(on(!0)),400)};return l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsx(le,{tooltip:`${n("parameters.showOptionsPanel")} (O)`,tooltipProps:{placement:"top"},"aria-label":n("parameters.showOptionsPanel"),onClick:r,children:l.jsx(ap,{})}),l.jsx(B,{children:l.jsx(xp,{iconButton:!0})}),l.jsx(B,{children:l.jsx(vp,{width:"100%",height:"40px",btnGroupWidth:"100%"})})]})}function r_(){const e=Y(),{t}=Z(),n=O(zt),r=()=>{e(Jf()),e(Sc())};return l.jsx(le,{"aria-label":t("unifiedCanvas.clearCanvas"),tooltip:t("unifiedCanvas.clearCanvas"),icon:l.jsx(io,{}),onClick:r,isDisabled:n,colorScheme:"error"})}function I4(e,t,n=250){const[r,i]=x.useState(0);return x.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),i(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>i(s=>s+1)}function i_(){const e=Sr(),t=Y(),{t:n}=Z();fe(["r"],()=>{i()},{enabled:()=>!0,preventDefault:!0},[e]);const r=I4(()=>i(!1),()=>i(!0)),i=(s=!1)=>{const c=Sr();if(!c)return;const u=c.getClientRect({skipTransform:!0});t(J1({contentRect:u,shouldScaleTo1:s}))};return l.jsx(le,{"aria-label":`${n("unifiedCanvas.resetView")} (R)`,tooltip:`${n("unifiedCanvas.resetView")} (R)`,icon:l.jsx(_y,{}),onClick:r})}function o_(){const e=O(zt),t=Sr(),n=O(u=>u.system.isProcessing),r=O(u=>u.canvas.shouldCropToBoundingBoxOnSave),i=Y(),{t:s}=Z();fe(["shift+s"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{i(ai({cropVisible:!r,cropToBoundingBox:r,shouldSaveToGallery:!0}))};return l.jsx(le,{"aria-label":`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(op,{}),onClick:c,isDisabled:e})}const a_=be([tt,zt,Pt],(e,t,n)=>{const{isProcessing:r}=n,{tool:i}=e;return{tool:i,isStaging:t,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),s_=()=>{const e=Y(),{t}=Z(),{tool:n,isStaging:r}=O(a_);fe(["b"],()=>{i()},{enabled:()=>!r,preventDefault:!0},[]),fe(["e"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n]),fe(["c"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n]),fe(["shift+f"],()=>{u()},{enabled:()=>!r,preventDefault:!0}),fe(["delete","backspace"],()=>{f()},{enabled:()=>!r,preventDefault:!0});const i=()=>e(xr("brush")),s=()=>e(xr("eraser")),c=()=>e(xr("colorPicker")),u=()=>e(e2()),f=()=>e(t2());return l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsxs(en,{children:[l.jsx(le,{"aria-label":`${t("unifiedCanvas.brush")} (B)`,tooltip:`${t("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ry,{}),isChecked:n==="brush"&&!r,onClick:i,isDisabled:r}),l.jsx(le,{"aria-label":`${t("unifiedCanvas.eraser")} (E)`,tooltip:`${t("unifiedCanvas.eraser")} (B)`,icon:l.jsx(Dy,{}),isChecked:n==="eraser"&&!r,isDisabled:r,onClick:s})]}),l.jsxs(en,{children:[l.jsx(le,{"aria-label":`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Ay,{}),isDisabled:r,onClick:u}),l.jsx(le,{"aria-label":`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),isDisabled:r,onClick:f})]}),l.jsx(le,{"aria-label":`${t("unifiedCanvas.colorPicker")} (C)`,tooltip:`${t("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Oy,{}),isChecked:n==="colorPicker"&&!r,isDisabled:r,onClick:c,width:"max-content"})]})},Wc=he((e,t)=>{const{acceptButtonText:n="Accept",acceptCallback:r,cancelButtonText:i="Cancel",cancelCallback:s,children:c,title:u,triggerComponent:f}=e,{isOpen:h,onOpen:p,onClose:g}=ui(),y=x.useRef(null),S=()=>{r(),g()},C=()=>{s&&s(),g()};return l.jsxs(l.Fragment,{children:[x.cloneElement(f,{onClick:p,ref:t}),l.jsx(Xx,{isOpen:h,leastDestructiveRef:y,onClose:g,children:l.jsx(Nr,{children:l.jsxs(Kx,{children:[l.jsx(Rr,{fontSize:"lg",fontWeight:"bold",children:u}),l.jsx(Fr,{children:c}),l.jsxs(zr,{children:[l.jsx(Je,{ref:y,onClick:C,children:i}),l.jsx(Je,{colorScheme:"error",onClick:S,ml:3,children:n})]})]})})})]})}),M4=()=>{const e=O(zt),t=Y(),{t:n}=Z(),r=()=>{t(e3()),t(Jf()),t(n2())};return l.jsxs(Wc,{title:n("unifiedCanvas.emptyTempImageFolder"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.emptyFolder"),triggerComponent:l.jsx(Je,{leftIcon:l.jsx(io,{}),size:"sm",isDisabled:e,children:n("unifiedCanvas.emptyTempImageFolder")}),children:[l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderConfirm")})]})},T4=()=>{const e=O(zt),t=Y(),{t:n}=Z();return l.jsxs(Wc,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(n2()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:l.jsx(Je,{size:"sm",leftIcon:l.jsx(io,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},l_=be([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:i}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:i}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),c_=()=>{const e=Y(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldShowCanvasDebugInfo:i,shouldShowIntermediates:s}=O(l_);return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{tooltip:t("unifiedCanvas.canvasSettings"),tooltipProps:{placement:"bottom"},"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(sp,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:s,onChange:c=>e(r2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:c=>e(i2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:c=>e(o2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:i,onChange:c=>e(a2(c.target.checked))}),l.jsx(T4,{}),l.jsx(M4,{})]})})},u_=()=>{const e=O(t=>t.ui.shouldShowParametersPanel);return l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(JT,{}),l.jsx(s_,{}),l.jsxs(B,{gap:2,children:[l.jsx(t_,{}),l.jsx(i_,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(e_,{}),l.jsx(o_,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(XT,{}),l.jsx(KT,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(P4,{}),l.jsx(E4,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(QT,{}),l.jsx(r_,{})]}),l.jsx(c_,{}),!e&&l.jsx(n_,{})]})};function d_(){const e=Y(),t=O(i=>i.canvas.brushSize),{t:n}=Z(),r=O(zt);return fe(["BracketLeft"],()=>{e(Wo(Math.max(t-5,5)))},{enabled:()=>!r,preventDefault:!0},[t]),fe(["BracketRight"],()=>{e(Wo(Math.min(t+5,500)))},{enabled:()=>!r,preventDefault:!0},[t]),l.jsx(ut,{label:n("unifiedCanvas.brushSize"),value:t,withInput:!0,onChange:i=>e(Wo(i)),sliderNumberInputProps:{max:500},inputReadOnly:!1,isCompact:!0})}function Vc(){return(Vc=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}function Rf(e){var t=x.useRef(e),n=x.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var ta=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:k.buttons>0)&&i.current?s(T0(i.current,k,u.current)):w(!1)},C=function(){return w(!1)};function w(k){var j=f.current,M=Nf(i.current),P=k?M.addEventListener:M.removeEventListener;P(j?"touchmove":"mousemove",S),P(j?"touchend":"mouseup",C)}return[function(k){var j=k.nativeEvent,M=i.current;if(M&&(_0(j),!function(I,T){return T&&!Ua(I)}(j,f.current)&&M)){if(Ua(j)){f.current=!0;var P=j.changedTouches||[];P.length&&(u.current=P[0].identifier)}M.focus(),s(T0(M,j,u.current)),w(!0)}},function(k){var j=k.which||k.keyCode;j<37||j>40||(k.preventDefault(),c({left:j===39?.05:j===37?-.05:0,top:j===40?.05:j===38?-.05:0}))},w]},[c,s]),p=h[0],g=h[1],y=h[2];return x.useEffect(function(){return y},[y]),ke.createElement("div",Vc({},r,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:g,tabIndex:0,role:"slider"}))}),Uc=function(e){return e.filter(Boolean).join(" ")},Rp=function(e){var t=e.color,n=e.left,r=e.top,i=r===void 0?.5:r,s=Uc(["react-colorful__pointer",e.className]);return ke.createElement("div",{className:s,style:{top:100*i+"%",left:100*n+"%"}},ke.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},gn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},D4=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:gn(e.h),s:gn(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:gn(i/2),a:gn(r,2)}},Ff=function(e){var t=D4(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Bd=function(e){var t=D4(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},f_=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),c=r*(1-n),u=r*(1-(t-s)*n),f=r*(1-(1-t+s)*n),h=s%6;return{r:gn(255*[r,u,c,c,f,r][h]),g:gn(255*[f,r,r,u,c,c][h]),b:gn(255*[c,c,f,r,r,u][h]),a:gn(i,2)}},h_=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,s=Math.max(t,n,r),c=s-Math.min(t,n,r),u=c?s===t?(n-r)/c:s===n?2+(r-t)/c:4+(t-n)/c:0;return{h:gn(60*(u<0?u+6:u)),s:gn(s?c/s*100:0),v:gn(s/255*100),a:i}},p_=ke.memo(function(e){var t=e.hue,n=e.onChange,r=Uc(["react-colorful__hue",e.className]);return ke.createElement("div",{className:r},ke.createElement(zp,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:ta(t+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":gn(t),"aria-valuemax":"360","aria-valuemin":"0"},ke.createElement(Rp,{className:"react-colorful__hue-pointer",left:t/360,color:Ff({h:t,s:100,v:100,a:1})})))}),m_=ke.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Ff({h:t.h,s:100,v:100,a:1})};return ke.createElement("div",{className:"react-colorful__saturation",style:r},ke.createElement(zp,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:ta(t.s+100*i.left,0,100),v:ta(t.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+gn(t.s)+"%, Brightness "+gn(t.v)+"%"},ke.createElement(Rp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Ff(t)})))}),O4=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function v_(e,t,n){var r=Rf(n),i=x.useState(function(){return e.toHsva(t)}),s=i[0],c=i[1],u=x.useRef({color:t,hsva:s});x.useEffect(function(){if(!e.equal(t,u.current.color)){var h=e.toHsva(t);u.current={hsva:h,color:t},c(h)}},[t,e]),x.useEffect(function(){var h;O4(s,u.current.hsva)||e.equal(h=e.fromHsva(s),u.current.color)||(u.current={hsva:s,color:h},r(h))},[s,e,r]);var f=x.useCallback(function(h){c(function(p){return Object.assign({},p,h)})},[]);return[s,f]}var g_=typeof window<"u"?x.useLayoutEffect:x.useEffect,x_=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},D0=new Map,y_=function(e){g_(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!D0.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,D0.set(t,n);var r=x_();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},b_=function(e){var t=e.className,n=e.hsva,r=e.onChange,i={backgroundImage:"linear-gradient(90deg, "+Bd(Object.assign({},n,{a:0}))+", "+Bd(Object.assign({},n,{a:1}))+")"},s=Uc(["react-colorful__alpha",t]),c=gn(100*n.a);return ke.createElement("div",{className:s},ke.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),ke.createElement(zp,{onMove:function(u){r({a:u.left})},onKey:function(u){r({a:ta(n.a+u.left)})},"aria-label":"Alpha","aria-valuetext":c+"%","aria-valuenow":c,"aria-valuemin":"0","aria-valuemax":"100"},ke.createElement(Rp,{className:"react-colorful__alpha-pointer",left:n.a,color:Bd(n)})))},S_=function(e){var t=e.className,n=e.colorModel,r=e.color,i=r===void 0?n.defaultColor:r,s=e.onChange,c=_4(e,["className","colorModel","color","onChange"]),u=x.useRef(null);y_(u);var f=v_(n,i,s),h=f[0],p=f[1],g=Uc(["react-colorful",t]);return ke.createElement("div",Vc({},c,{ref:u,className:g}),ke.createElement(m_,{hsva:h,onChange:p}),ke.createElement(p_,{hue:h.h,onChange:p}),ke.createElement(b_,{hsva:h,onChange:p,className:"react-colorful__last-control"}))},C_={defaultColor:{r:0,g:0,b:0,a:1},toHsva:h_,fromHsva:f_,equal:O4},w_=function(e){return ke.createElement(S_,Vc({},e,{colorModel:C_}))};const k_=re(w_,{baseStyle:{paddingInline:4},shouldForwardProp:e=>!["pickerColor"].includes(e)}),Hd={width:6,height:6,borderColor:"base.100"},pc=e=>{const{styleClass:t="",...n}=e;return l.jsx(k_,{sx:{".react-colorful__hue-pointer":Hd,".react-colorful__saturation-pointer":Hd,".react-colorful__alpha-pointer":Hd},className:t,...n})},j_=be([tt,zt],(e,t)=>{const{brushColor:n,maskColor:r,layer:i}=e;return{brushColor:n,maskColor:r,layer:i,isStaging:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function E_(){const e=Y(),{brushColor:t,maskColor:n,layer:r,isStaging:i}=O(j_),s=()=>{if(r==="base")return`rgba(${t.r},${t.g},${t.b},${t.a})`;if(r==="mask")return`rgba(${n.r},${n.g},${n.b},${n.a})`};return fe(["shift+BracketLeft"],()=>{e(Vo({...t,a:te.clamp(t.a-.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[t]),fe(["shift+BracketRight"],()=>{e(Vo({...t,a:te.clamp(t.a+.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[t]),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(We,{sx:{width:7,height:7,minWidth:7,minHeight:7,borderRadius:"full",bg:s(),cursor:"pointer"}}),children:l.jsxs(B,{minWidth:60,direction:"column",gap:4,width:"100%",children:[r==="base"&&l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:t,onChange:c=>e(Vo(c))}),r==="mask"&&l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:c=>e(s2(c))})]})})}function A4(){return l.jsxs(B,{columnGap:4,alignItems:"center",children:[l.jsx(d_,{}),l.jsx(E_,{})]})}function P_(){const e=Y(),t=O(r=>r.canvas.shouldRestrictStrokesToBox),{t:n}=Z();return l.jsx(pt,{label:n("unifiedCanvas.betaLimitToBox"),isChecked:t,onChange:r=>e(l2(r.target.checked))})}function I_(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(A4,{}),l.jsx(P_,{})]})}function M_(){const e=Y(),{t}=Z(),n=()=>e(Zf());return l.jsx(Je,{size:"sm",leftIcon:l.jsx(io,{}),onClick:n,tooltip:`${t("unifiedCanvas.clearMask")} (Shift+C)`,children:t("unifiedCanvas.betaClear")})}function T_(){const e=O(i=>i.canvas.isMaskEnabled),t=Y(),{t:n}=Z(),r=()=>t(ss(!e));return l.jsx(pt,{label:`${n("unifiedCanvas.enableMask")} (H)`,isChecked:e,onChange:r})}function __(){const e=Y(),{t}=Z(),n=O(r=>r.canvas.shouldPreserveMaskedArea);return l.jsx(pt,{label:t("unifiedCanvas.betaPreserveMasked"),isChecked:n,onChange:r=>e(c2(r.target.checked))})}function D_(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(A4,{}),l.jsx(T_,{}),l.jsx(__,{}),l.jsx(M_,{})]})}function O_(){const e=O(r=>r.canvas.shouldDarkenOutsideBoundingBox),t=Y(),{t:n}=Z();return l.jsx(pt,{label:n("unifiedCanvas.betaDarkenOutside"),isChecked:e,onChange:r=>t(u2(r.target.checked))})}function A_(){const e=O(r=>r.canvas.shouldShowGrid),t=Y(),{t:n}=Z();return l.jsx(pt,{label:n("unifiedCanvas.showGrid"),isChecked:e,onChange:r=>t(d2(r.target.checked))})}function z_(){const e=O(i=>i.canvas.shouldSnapToGrid),t=Y(),{t:n}=Z(),r=i=>t(ec(i.target.checked));return l.jsx(pt,{label:`${n("unifiedCanvas.snapToGrid")} (N)`,isChecked:e,onChange:r})}function R_(){return l.jsxs(B,{alignItems:"center",gap:4,children:[l.jsx(A_,{}),l.jsx(z_,{}),l.jsx(O_,{})]})}const N_=be([tt],e=>{const{tool:t,layer:n}=e;return{tool:t,layer:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function F_(){const{tool:e,layer:t}=O(N_);return l.jsxs(B,{height:8,minHeight:8,maxHeight:8,alignItems:"center",children:[t=="base"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(I_,{}),t=="mask"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(D_,{}),e=="move"&&l.jsx(R_,{})]})}const L_=be([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),B_=()=>{const e=Y(),{doesCanvasNeedScaling:t}=O(L_);return x.useLayoutEffect(()=>{e(on(!0));const n=te.debounce(()=>{e(on(!0))},250);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(We,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsxs(B,{flexDirection:"row",width:"100%",height:"100%",columnGap:4,padding:4,children:[l.jsx(u_,{}),l.jsxs(B,{width:"100%",height:"100%",flexDirection:"column",rowGap:4,children:[l.jsx(F_,{}),t?l.jsx(j4,{}):l.jsx(k4,{})]})]})})},H_=be([tt,zt],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:i,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:qi(n),isMaskEnabled:i,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),W_=()=>{const e=Y(),{t}=Z(),{layer:n,maskColor:r,isMaskEnabled:i,shouldPreserveMaskedArea:s,isStaging:c}=O(H_);fe(["q"],()=>{u()},{enabled:()=>!c,preventDefault:!0},[n]),fe(["shift+c"],()=>{f()},{enabled:()=>!c,preventDefault:!0},[]),fe(["h"],()=>{h()},{enabled:()=>!c,preventDefault:!0},[i]);const u=()=>{e(tc(n==="mask"?"base":"mask"))},f=()=>e(Zf()),h=()=>e(ss(!i));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(en,{children:l.jsx(le,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:l.jsx(W8,{}),isChecked:n==="mask",isDisabled:c})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:i,onChange:h}),l.jsx(pt,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:p=>e(c2(p.target.checked))}),l.jsx(pc,{sx:{paddingTop:2,paddingBottom:2},pickerColor:r,onChange:p=>e(s2(p))}),l.jsxs(Je,{size:"sm",leftIcon:l.jsx(io,{}),onClick:f,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},V_=be([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:i,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:i,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),U_=()=>{const e=Y(),{t}=Z(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:i,shouldShowCanvasDebugInfo:s,shouldShowGrid:c,shouldShowIntermediates:u,shouldSnapToGrid:f,shouldRestrictStrokesToBox:h}=O(V_);fe(["n"],()=>{e(ec(!f))},{enabled:!0,preventDefault:!0},[f]);const p=g=>e(ec(g.target.checked));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(sp,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:u,onChange:g=>e(r2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showGrid"),isChecked:c,onChange:g=>e(d2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.snapToGrid"),isChecked:f,onChange:p}),l.jsx(pt,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:i,onChange:g=>e(u2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(i2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(o2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:h,onChange:g=>e(l2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(a2(g.target.checked))}),l.jsx(T4,{}),l.jsx(M4,{})]})})},$_=be([tt,zt,Pt],(e,t,n)=>{const{isProcessing:r}=n,{tool:i,brushColor:s,brushSize:c}=e;return{tool:i,isStaging:t,isProcessing:r,brushColor:s,brushSize:c}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),G_=()=>{const e=Y(),{tool:t,brushColor:n,brushSize:r,isStaging:i}=O($_),{t:s}=Z();fe(["b"],()=>{c()},{enabled:()=>!i,preventDefault:!0},[]),fe(["e"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[t]),fe(["c"],()=>{f()},{enabled:()=>!i,preventDefault:!0},[t]),fe(["shift+f"],()=>{h()},{enabled:()=>!i,preventDefault:!0}),fe(["delete","backspace"],()=>{p()},{enabled:()=>!i,preventDefault:!0}),fe(["BracketLeft"],()=>{e(Wo(Math.max(r-5,5)))},{enabled:()=>!i,preventDefault:!0},[r]),fe(["BracketRight"],()=>{e(Wo(Math.min(r+5,500)))},{enabled:()=>!i,preventDefault:!0},[r]),fe(["shift+BracketLeft"],()=>{e(Vo({...n,a:te.clamp(n.a-.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[n]),fe(["shift+BracketRight"],()=>{e(Vo({...n,a:te.clamp(n.a+.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[n]);const c=()=>e(xr("brush")),u=()=>e(xr("eraser")),f=()=>e(xr("colorPicker")),h=()=>e(e2()),p=()=>e(t2());return l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ry,{}),isChecked:t==="brush"&&!i,onClick:c,isDisabled:i}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:l.jsx(Dy,{}),isChecked:t==="eraser"&&!i,isDisabled:i,onClick:u}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Ay,{}),isDisabled:i,onClick:h}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),isDisabled:i,onClick:p}),l.jsx(le,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Oy,{}),isChecked:t==="colorPicker"&&!i,isDisabled:i,onClick:f}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:l.jsx(ap,{})}),children:l.jsxs(B,{minWidth:60,direction:"column",gap:4,width:"100%",children:[l.jsx(B,{gap:4,justifyContent:"space-between",children:l.jsx(ut,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:g=>e(Wo(g)),sliderNumberInputProps:{max:500},inputReadOnly:!1})}),l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:g=>e(Vo(g))})]})})]})},q_=be([Pt,tt,zt],(e,t,n)=>{const{isProcessing:r}=e,{tool:i,shouldCropToBoundingBoxOnSave:s,layer:c,isMaskEnabled:u}=t;return{isProcessing:r,isStaging:n,isMaskEnabled:u,tool:i,layer:c,shouldCropToBoundingBoxOnSave:s}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Y_=()=>{const e=Y(),{isProcessing:t,isStaging:n,isMaskEnabled:r,layer:i,tool:s,shouldCropToBoundingBoxOnSave:c}=O(q_),u=Sr(),{t:f}=Z(),{openUploader:h}=Zh();fe(["v"],()=>{p()},{enabled:()=>!n,preventDefault:!0},[]),fe(["r"],()=>{y()},{enabled:()=>!0,preventDefault:!0},[u]),fe(["shift+m"],()=>{C()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["shift+s"],()=>{w()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["meta+c","ctrl+c"],()=>{k()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["shift+d"],()=>{j()},{enabled:()=>!n,preventDefault:!0},[u,t]);const p=()=>e(xr("move")),g=I4(()=>y(!1),()=>y(!0)),y=(P=!1)=>{const I=Sr();if(!I)return;const T=I.getClientRect({skipTransform:!0});e(J1({contentRect:T,shouldScaleTo1:P}))},S=()=>{e(Jf()),e(Sc())},C=()=>{e(ai({cropVisible:!1,shouldSetAsInitialImage:!0}))},w=()=>{e(ai({cropVisible:!c,cropToBoundingBox:c,shouldSaveToGallery:!0}))},k=()=>{e(ai({cropVisible:!c,cropToBoundingBox:c,shouldCopy:!0}))},j=()=>{e(ai({cropVisible:!c,cropToBoundingBox:c,shouldDownload:!0}))},M=P=>{const I=P.target.value;e(tc(I)),I==="mask"&&!r&&e(ss(!0))};return l.jsxs(B,{sx:{alignItems:"center",gap:2},children:[l.jsx(Mn,{tooltip:`${f("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:i,validValues:Z1,onChange:M,isDisabled:n}),l.jsx(W_,{}),l.jsx(G_,{}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${f("unifiedCanvas.move")} (V)`,tooltip:`${f("unifiedCanvas.move")} (V)`,icon:l.jsx(My,{}),isChecked:s==="move"||n,onClick:p}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.resetView")} (R)`,tooltip:`${f("unifiedCanvas.resetView")} (R)`,icon:l.jsx(_y,{}),onClick:g})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(zy,{}),onClick:C,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(op,{}),onClick:w,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Jo,{}),onClick:k,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(ip,{}),onClick:j,isDisabled:n})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(P4,{}),l.jsx(E4,{})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(le,{"aria-label":`${f("common.upload")}`,tooltip:`${f("common.upload")}`,icon:l.jsx(Rc,{}),onClick:h,isDisabled:n}),l.jsx(le,{"aria-label":`${f("unifiedCanvas.clearCanvas")}`,tooltip:`${f("unifiedCanvas.clearCanvas")}`,icon:l.jsx(io,{}),onClick:S,colorScheme:"error",isDisabled:n})]}),l.jsx(en,{isAttached:!0,children:l.jsx(U_,{})})]})},X_=be([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),K_=()=>{const e=Y(),{doesCanvasNeedScaling:t}=O(X_);return x.useLayoutEffect(()=>{e(on(!0));const n=te.debounce(()=>{e(on(!0))},250);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(We,{sx:{width:"100%",height:"100%",padding:4,borderRadius:"base",bg:"base.850"},children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",gap:4,width:"100%",height:"100%"},children:[l.jsx(Y_,{}),l.jsx(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:t?l.jsx(j4,{}):l.jsx(k4,{})})]})})},Q_=be(tt,e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Z_=()=>{const e=Y(),{boundingBoxDimensions:t}=O(Q_),{t:n}=Z(),r=u=>{e(Na({...t,width:Math.floor(u)}))},i=u=>{e(Na({...t,height:Math.floor(u)}))},s=()=>{e(Na({...t,width:Math.floor(512)}))},c=()=>{e(Na({...t,height:Math.floor(512)}))};return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:n("parameters.width"),min:64,max:1024,step:64,value:t.width,onChange:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:s}),l.jsx(ut,{label:n("parameters.height"),min:64,max:1024,step:64,value:t.height,onChange:i,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:c})]})},J_=be([gp,Pt,tt],(e,t,n)=>{const{tileSize:r,infillMethod:i}=e,{infill_methods:s}=t,{boundingBoxScaleMethod:c,scaledBoundingBoxDimensions:u}=n;return{boundingBoxScale:c,scaledBoundingBoxDimensions:u,tileSize:r,infillMethod:i,availableInfillMethods:s,isManual:c==="manual"}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),eD=()=>{const e=Y(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:i,isManual:s,scaledBoundingBoxDimensions:c}=O(J_),{t:u}=Z(),f=S=>{e(Cl({...c,width:Math.floor(S)}))},h=S=>{e(Cl({...c,height:Math.floor(S)}))},p=()=>{e(Cl({...c,width:Math.floor(512)}))},g=()=>{e(Cl({...c,height:Math.floor(512)}))},y=S=>{e(r3(S.target.value))};return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(Mn,{label:u("parameters.scaleBeforeProcessing"),validValues:t3,value:i,onChange:y}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledWidth"),min:64,max:1024,step:64,value:c.width,onChange:f,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:p}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledHeight"),min:64,max:1024,step:64,value:c.height,onChange:h,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:g}),l.jsx(Mn,{label:u("parameters.infillMethod"),value:n,validValues:r,onChange:S=>e(n3(S.target.value))}),l.jsx(ut,{isInputDisabled:n!=="tile",isResetDisabled:n!=="tile",isSliderDisabled:n!=="tile",label:u("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:S=>{e(qv(S))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(qv(32))}})]})};function tD(){const e=Y(),t=O(r=>r.generation.seamBlur),{t:n}=Z();return l.jsx(ut,{label:n("parameters.seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(Yv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Yv(16))}})}function nD(){const e=Y(),{t}=Z(),n=O(r=>r.generation.seamSize);return l.jsx(ut,{label:t("parameters.seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(Xv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(Xv(96))})}function rD(){const{t:e}=Z(),t=O(r=>r.generation.seamSteps),n=Y();return l.jsx(ut,{label:e("parameters.seamSteps"),min:1,max:100,sliderNumberInputProps:{max:999},value:t,onChange:r=>{n(Kv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(Kv(30))}})}function iD(){const e=Y(),{t}=Z(),n=O(r=>r.generation.seamStrength);return l.jsx(ut,{label:t("parameters.seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(Qv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Qv(.7))}})}const oD=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(nD,{}),l.jsx(tD,{}),l.jsx(iD,{}),l.jsx(rD,{})]});function aD(){const{t:e}=Z(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(Ep,{})},unifiedCanvasImg2Img:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(m4,{label:e("parameters.img2imgStrength")})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(wp,{})},boundingBox:{header:`${e("parameters.boundingBoxHeader")}`,feature:dn.BOUNDING_BOX,content:l.jsx(Z_,{})},seamCorrection:{header:`${e("parameters.seamCorrectionHeader")}`,feature:dn.SEAM_CORRECTION,content:l.jsx(oD,{})},infillAndScaling:{header:`${e("parameters.infillScalingHeader")}`,feature:dn.INFILL_AND_SCALING,content:l.jsx(eD,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(jp,{}),additionalHeaderComponents:l.jsx(kp,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(Sp,{}),additionalHeaderComponents:l.jsx(Cp,{})}};return l.jsxs(_p,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Tp,{}),l.jsx(Mp,{})]}),l.jsx(Ip,{}),l.jsx(Pp,{accordionInfo:t})]})}function sD(){const e=O(t=>t.ui.shouldUseCanvasBetaLayout);return l.jsx(bp,{optionsPanel:l.jsx(aD,{}),children:e?l.jsx(B_,{}):l.jsx(K_,{})})}const Dn={txt2img:{title:l.jsx(Jt,{as:v9,boxSize:6}),workarea:l.jsx(KI,{}),tooltip:"Text To Image"},img2img:{title:l.jsx(Jt,{as:cp,boxSize:6}),workarea:l.jsx(VI,{}),tooltip:"Image To Image"},unifiedCanvas:{title:l.jsx(Jt,{as:y9,boxSize:6}),workarea:l.jsx(sD,{}),tooltip:"Unified Canvas"},nodes:{title:l.jsx(Jt,{as:g9,boxSize:6}),workarea:l.jsx($7,{}),tooltip:"Nodes"},postprocess:{title:l.jsx(Jt,{as:b9,boxSize:6}),workarea:l.jsx(G7,{}),tooltip:"Post Processing"},training:{title:l.jsx(Jt,{as:x9,boxSize:6}),workarea:l.jsx(q7,{}),tooltip:"Training"}};function lD(){Dn.txt2img.tooltip=nr.t("common.text2img"),Dn.img2img.tooltip=nr.t("common.img2img"),Dn.unifiedCanvas.tooltip=nr.t("common.unifiedCanvas"),Dn.nodes.tooltip=nr.t("common.nodes"),Dn.postprocess.tooltip=nr.t("common.postProcessing"),Dn.training.tooltip=nr.t("common.training")}function cD(){const e=O(U7),t=O(h=>h.lightbox.isLightboxOpen),{shouldShowGallery:n,shouldShowParametersPanel:r,shouldPinGallery:i,shouldPinParametersPanel:s}=O(yp);Y7(lD);const c=Y();fe("1",()=>{c(jn(0))}),fe("2",()=>{c(jn(1))}),fe("3",()=>{c(jn(2))}),fe("4",()=>{c(jn(3))}),fe("5",()=>{c(jn(4))}),fe("6",()=>{c(jn(5))}),fe("z",()=>{c(Bi(!t))},[t]),fe("f",()=>{n||r?(c(Hi(!1)),c(Fi(!1))):(c(Hi(!0)),c(Fi(!0))),(i||s)&&setTimeout(()=>c(on(!0)),400)},[n,r]);const u=()=>{const h=[];return Object.keys(Dn).forEach(p=>{h.push(l.jsx(Yt,{hasArrow:!0,label:Dn[p].tooltip,placement:"end",children:l.jsxs(yy,{children:[l.jsx(k2,{children:Dn[p].tooltip}),Dn[p].title]})},p))}),h},f=()=>{const h=[];return Object.keys(Dn).forEach(p=>{h.push(l.jsx(gy,{children:Dn[p].workarea},p))}),h};return l.jsxs(my,{isLazy:!0,defaultIndex:e,index:e,onChange:h=>{c(jn(h))},children:[l.jsx(vy,{children:u()}),l.jsx(xy,{children:t?l.jsx(sI,{}):f()})]})}var uD=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function bs(e,t){var n=dD(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function dD(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),i=uD.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var fD=[".DS_Store","Thumbs.db"];function hD(e){return oa(this,void 0,void 0,function(){return aa(this,function(t){return mc(e)&&pD(e.dataTransfer)?[2,xD(e.dataTransfer,e.type)]:mD(e)?[2,vD(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,gD(e)]:[2,[]]})})}function pD(e){return mc(e)}function mD(e){return mc(e)&&mc(e.target)}function mc(e){return typeof e=="object"&&e!==null}function vD(e){return Lf(e.target.files).map(function(t){return bs(t)})}function gD(e){return oa(this,void 0,void 0,function(){var t;return aa(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return bs(r)})]}})})}function xD(e,t){return oa(this,void 0,void 0,function(){var n,r;return aa(this,function(i){switch(i.label){case 0:return e.items?(n=Lf(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(yD))]):[3,2];case 1:return r=i.sent(),[2,O0(z4(r))];case 2:return[2,O0(Lf(e.files).map(function(s){return bs(s)}))]}})})}function O0(e){return e.filter(function(t){return fD.indexOf(t.name)===-1})}function Lf(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,F0(n)];if(e.sizen)return[!1,F0(n)]}return[!0,null]}function Ni(e){return e!=null}function zD(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,s=e.multiple,c=e.maxFiles,u=e.validator;return!s&&t.length>1||s&&c>=1&&t.length>c?!1:t.every(function(f){var h=L4(f,n),p=es(h,1),g=p[0],y=B4(f,r,i),S=es(y,1),C=S[0],w=u?u(f):null;return g&&C&&!w})}function vc(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Nl(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function B0(e){e.preventDefault()}function RD(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function ND(e){return e.indexOf("Edge/")!==-1}function FD(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return RD(e)||ND(e)}function hr(){for(var e=arguments.length,t=new Array(e),n=0;n1?i-1:0),c=1;ce.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tO(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s=0)&&(n[i]=e[i]);return n}var Np=x.forwardRef(function(e,t){var n=e.children,r=gc(e,UD),i=$4(r),s=i.open,c=gc(i,$D);return x.useImperativeHandle(t,function(){return{open:s}},[s]),ke.createElement(x.Fragment,null,n(Ot(Ot({},c),{},{open:s})))});Np.displayName="Dropzone";var U4={disabled:!1,getFilesFromEvent:hD,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Np.defaultProps=U4;Np.propTypes={children:lt.func,accept:lt.objectOf(lt.arrayOf(lt.string)),multiple:lt.bool,preventDropOnDocument:lt.bool,noClick:lt.bool,noKeyboard:lt.bool,noDrag:lt.bool,noDragEventsBubbling:lt.bool,minSize:lt.number,maxSize:lt.number,maxFiles:lt.number,disabled:lt.bool,getFilesFromEvent:lt.func,onFileDialogCancel:lt.func,onFileDialogOpen:lt.func,useFsAccessApi:lt.bool,autoFocus:lt.bool,onDragEnter:lt.func,onDragLeave:lt.func,onDragOver:lt.func,onDrop:lt.func,onDropAccepted:lt.func,onDropRejected:lt.func,onError:lt.func,validator:lt.func};var Vf={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function $4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Ot(Ot({},U4),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,s=t.maxSize,c=t.minSize,u=t.multiple,f=t.maxFiles,h=t.onDragEnter,p=t.onDragLeave,g=t.onDragOver,y=t.onDrop,S=t.onDropAccepted,C=t.onDropRejected,w=t.onFileDialogCancel,k=t.onFileDialogOpen,j=t.useFsAccessApi,M=t.autoFocus,P=t.preventDropOnDocument,I=t.noClick,T=t.noKeyboard,D=t.noDrag,_=t.noDragEventsBubbling,z=t.onError,V=t.validator,F=x.useMemo(function(){return HD(n)},[n]),L=x.useMemo(function(){return BD(n)},[n]),X=x.useMemo(function(){return typeof k=="function"?k:W0},[k]),$=x.useMemo(function(){return typeof w=="function"?w:W0},[w]),Q=x.useRef(null),ie=x.useRef(null),oe=x.useReducer(nO,Vf),U=Wd(oe,2),K=U[0],ne=U[1],ce=K.isFocused,Re=K.isFileDialogActive,ze=x.useRef(typeof window<"u"&&window.isSecureContext&&j&&LD()),Me=function(){!ze.current&&Re&&setTimeout(function(){if(ie.current){var se=ie.current.files;se.length||(ne({type:"closeDialog"}),$())}},300)};x.useEffect(function(){return window.addEventListener("focus",Me,!1),function(){window.removeEventListener("focus",Me,!1)}},[ie,Re,$,ze]);var J=x.useRef([]),ue=function(se){Q.current&&Q.current.contains(se.target)||(se.preventDefault(),J.current=[])};x.useEffect(function(){return P&&(document.addEventListener("dragover",B0,!1),document.addEventListener("drop",ue,!1)),function(){P&&(document.removeEventListener("dragover",B0),document.removeEventListener("drop",ue))}},[Q,P]),x.useEffect(function(){return!r&&M&&Q.current&&Q.current.focus(),function(){}},[Q,M,r]);var Ie=x.useCallback(function(q){z?z(q):console.error(q)},[z]),Be=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q),J.current=[].concat(YD(J.current),[q.target]),Nl(q)&&Promise.resolve(i(q)).then(function(se){if(!(vc(q)&&!_)){var Fe=se.length,Ze=Fe>0&&zD({files:se,accept:F,minSize:c,maxSize:s,multiple:u,maxFiles:f,validator:V}),ee=Fe>0&&!Ze;ne({isDragAccept:Ze,isDragReject:ee,isDragActive:!0,type:"setDraggedFiles"}),h&&h(q)}}).catch(function(se){return Ie(se)})},[i,h,Ie,_,F,c,s,u,f,V]),Ne=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var se=Nl(q);if(se&&q.dataTransfer)try{q.dataTransfer.dropEffect="copy"}catch{}return se&&g&&g(q),!1},[g,_]),Ge=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var se=J.current.filter(function(Ze){return Q.current&&Q.current.contains(Ze)}),Fe=se.indexOf(q.target);Fe!==-1&&se.splice(Fe,1),J.current=se,!(se.length>0)&&(ne({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Nl(q)&&p&&p(q))},[Q,p,_]),Qe=x.useCallback(function(q,se){var Fe=[],Ze=[];q.forEach(function(ee){var He=L4(ee,F),nt=Wd(He,2),Ft=nt[0],pe=nt[1],De=B4(ee,c,s),hn=Wd(De,2),$t=hn[0],pn=hn[1],ir=V?V(ee):null;if(Ft&&$t&&!ir)Fe.push(ee);else{var yi=[pe,pn];ir&&(yi=yi.concat(ir)),Ze.push({file:ee,errors:yi.filter(function(da){return da})})}}),(!u&&Fe.length>1||u&&f>=1&&Fe.length>f)&&(Fe.forEach(function(ee){Ze.push({file:ee,errors:[AD]})}),Fe.splice(0)),ne({acceptedFiles:Fe,fileRejections:Ze,type:"setFiles"}),y&&y(Fe,Ze,se),Ze.length>0&&C&&C(Ze,se),Fe.length>0&&S&&S(Fe,se)},[ne,u,F,c,s,f,y,S,C,V]),ve=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q),J.current=[],Nl(q)&&Promise.resolve(i(q)).then(function(se){vc(q)&&!_||Qe(se,q)}).catch(function(se){return Ie(se)}),ne({type:"reset"})},[i,Qe,Ie,_]),_e=x.useCallback(function(){if(ze.current){ne({type:"openDialog"}),X();var q={multiple:u,types:L};window.showOpenFilePicker(q).then(function(se){return i(se)}).then(function(se){Qe(se,null),ne({type:"closeDialog"})}).catch(function(se){WD(se)?($(se),ne({type:"closeDialog"})):VD(se)?(ze.current=!1,ie.current?(ie.current.value=null,ie.current.click()):Ie(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):Ie(se)});return}ie.current&&(ne({type:"openDialog"}),X(),ie.current.value=null,ie.current.click())},[ne,X,$,j,Qe,Ie,L,u]),qe=x.useCallback(function(q){!Q.current||!Q.current.isEqualNode(q.target)||(q.key===" "||q.key==="Enter"||q.keyCode===32||q.keyCode===13)&&(q.preventDefault(),_e())},[Q,_e]),ge=x.useCallback(function(){ne({type:"focus"})},[]),Te=x.useCallback(function(){ne({type:"blur"})},[]),et=x.useCallback(function(){I||(FD()?setTimeout(_e,0):_e())},[I,_e]),Ve=function(se){return r?null:se},vt=function(se){return T?null:Ve(se)},Nt=function(se){return D?null:Ve(se)},N=function(se){_&&se.stopPropagation()},de=x.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=q.refKey,Fe=se===void 0?"ref":se,Ze=q.role,ee=q.onKeyDown,He=q.onFocus,nt=q.onBlur,Ft=q.onClick,pe=q.onDragEnter,De=q.onDragOver,hn=q.onDragLeave,$t=q.onDrop,pn=gc(q,GD);return Ot(Ot(Wf({onKeyDown:vt(hr(ee,qe)),onFocus:vt(hr(He,ge)),onBlur:vt(hr(nt,Te)),onClick:Ve(hr(Ft,et)),onDragEnter:Nt(hr(pe,Be)),onDragOver:Nt(hr(De,Ne)),onDragLeave:Nt(hr(hn,Ge)),onDrop:Nt(hr($t,ve)),role:typeof Ze=="string"&&Ze!==""?Ze:"presentation"},Fe,Q),!r&&!T?{tabIndex:0}:{}),pn)}},[Q,qe,ge,Te,et,Be,Ne,Ge,ve,T,D,r]),xe=x.useCallback(function(q){q.stopPropagation()},[]),je=x.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},se=q.refKey,Fe=se===void 0?"ref":se,Ze=q.onChange,ee=q.onClick,He=gc(q,qD),nt=Wf({accept:F,multiple:u,type:"file",style:{display:"none"},onChange:Ve(hr(Ze,ve)),onClick:Ve(hr(ee,xe)),tabIndex:-1},Fe,ie);return Ot(Ot({},nt),He)}},[ie,n,u,ve,r]);return Ot(Ot({},K),{},{isFocused:ce&&!r,getRootProps:de,getInputProps:je,rootRef:Q,inputRef:ie,open:Ve(_e)})}function nO(e,t){switch(t.type){case"focus":return Ot(Ot({},e),{},{isFocused:!0});case"blur":return Ot(Ot({},e),{},{isFocused:!1});case"openDialog":return Ot(Ot({},Vf),{},{isFileDialogActive:!0});case"closeDialog":return Ot(Ot({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Ot(Ot({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Ot(Ot({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return Ot({},Vf);default:return e}}function W0(){}const rO=e=>{const{isDragAccept:t,isDragReject:n,overlaySecondaryText:r,setIsHandlingUpload:i}=e;return fe("esc",()=>{i(!1)}),l.jsx(We,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:l.jsx(B,{sx:{opacity:.4,width:"100%",height:"100%",flexDirection:"column",rowGap:4,alignItems:"center",justifyContent:"center",bg:"base.900",boxShadow:`inset 0 0 20rem 1rem var(--invokeai-colors-${t?"accent":"error"}-500)`},children:t?l.jsxs(Vn,{size:"lg",children:["Upload Image",r]}):l.jsxs(l.Fragment,{children:[l.jsx(Vn,{size:"lg",children:"Invalid Upload"}),l.jsx(Vn,{size:"md",children:"Must be single JPEG or PNG image"})]})})})},iO=e=>{const{children:t}=e,n=Y(),r=O(Bt),i=us({}),{t:s}=Z(),[c,u]=x.useState(!1),{setOpenUploader:f}=Zh(),h=x.useCallback(P=>{u(!0);const I=P.errors.reduce((T,D)=>`${T} -${D.message}`,"");i({title:s("toast.uploadFailed"),description:I,status:"error",isClosable:!0})},[s,i]),p=x.useCallback(async P=>{n(Ug({imageFile:P}))},[n]),g=x.useCallback((P,I)=>{I.forEach(T=>{h(T)}),P.forEach(T=>{p(T)})},[p,h]),{getRootProps:y,getInputProps:S,isDragAccept:C,isDragReject:w,isDragActive:k,open:j}=$4({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:g,onDragOver:()=>u(!0),maxFiles:1});f(j),x.useEffect(()=>{const P=I=>{var z;const T=(z=I.clipboardData)==null?void 0:z.items;if(!T)return;const D=[];for(const V of T)V.kind==="file"&&["image/png","image/jpg"].includes(V.type)&&D.push(V);if(!D.length)return;if(I.stopImmediatePropagation(),D.length>1){i({description:s("toast.uploadFailedMultipleImagesDesc"),status:"error",isClosable:!0});return}const _=D[0].getAsFile();if(!_){i({description:s("toast.uploadFailedUnableToLoadDesc"),status:"error",isClosable:!0});return}n(Ug({imageFile:_}))};return document.addEventListener("paste",P),()=>{document.removeEventListener("paste",P)}},[s,n,i,r]);const M=["img2img","unifiedCanvas"].includes(r)?` to ${Dn[r].tooltip}`:"";return l.jsx(Qh.Provider,{value:j,children:l.jsxs(We,{...y({style:{}}),onKeyDown:P=>{P.key},children:[l.jsx("input",{...S()}),t,k&&c&&l.jsx(rO,{isDragAccept:C,isDragReject:w,overlaySecondaryText:M,setIsHandlingUpload:u})]})})},oO=be(Pt,e=>e.log,{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),aO=be(Pt,e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),sO=()=>{const e=Y(),t=O(oO),{shouldShowLogViewer:n,hasError:r,wasErrorSeen:i}=O(aO),[s,c]=x.useState(!0),u=x.useRef(null);x.useLayoutEffect(()=>{u.current!==null&&s&&(u.current.scrollTop=u.current.scrollHeight)},[s,t,n]);const f=()=>{e(f2()),e(vd(!n))};fe("`",()=>{e(vd(!n))},[n]),fe("esc",()=>{e(vd(!1))});const h=()=>{u.current&&s&&u.current.scrollTop{const{timestamp:y,message:S,level:C}=p,w=C==="info"?"base":C;return l.jsxs(B,{sx:{gap:2,color:`${w}.300`},children:[l.jsxs(Ce,{fontWeight:"600",children:[y,":"]}),l.jsx(Ce,{wordBreak:"break-all",children:S})]},g)})})}),n&&l.jsx(Yt,{hasArrow:!0,label:s?"Autoscroll On":"Autoscroll Off",children:l.jsx(le,{size:"sm","aria-label":"Toggle autoscroll",icon:l.jsx(E8,{}),onClick:()=>c(!s),isChecked:s,sx:{position:"fixed",insetInlineStart:2,bottom:12,zIndex:"10000"}})}),l.jsx(Yt,{hasArrow:!0,label:n?"Hide Console":"Show Console",children:l.jsx(le,{size:"sm","aria-label":"Toggle Log Viewer",icon:n?l.jsx(V8,{}):l.jsx(Ty,{}),onClick:f,sx:{position:"fixed",insetInlineStart:2,bottom:2,zIndex:"10000"},colorScheme:r||!i?"error":"base"})})]})},lO=be(Pt,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),cO=()=>{const{t:e}=Z(),{isProcessing:t,currentStep:n,totalSteps:r,currentStatusHasSteps:i}=O(lO),s=n?Math.round(n*100/r):0;return l.jsx(ey,{value:s,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:t&&!i,height:fp,zIndex:99})};function uO(e){const{title:t,hotkey:n,description:r}=e;return l.jsxs($n,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs($n,{children:[l.jsx(Ce,{fontWeight:600,children:t}),r&&l.jsx(Ce,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),l.jsx(We,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function dO({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ui(),{t:i}=Z(),s=[{title:i("hotkeys.invoke.title"),desc:i("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:i("hotkeys.cancel.title"),desc:i("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:i("hotkeys.focusPrompt.title"),desc:i("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:i("hotkeys.toggleOptions.title"),desc:i("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:i("hotkeys.pinOptions.title"),desc:i("hotkeys.pinOptions.desc"),hotkey:"Shift+O"},{title:i("hotkeys.toggleViewer.title"),desc:i("hotkeys.toggleViewer.desc"),hotkey:"Z"},{title:i("hotkeys.toggleGallery.title"),desc:i("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:i("hotkeys.maximizeWorkSpace.title"),desc:i("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:i("hotkeys.changeTabs.title"),desc:i("hotkeys.changeTabs.desc"),hotkey:"1-5"},{title:i("hotkeys.consoleToggle.title"),desc:i("hotkeys.consoleToggle.desc"),hotkey:"`"}],c=[{title:i("hotkeys.setPrompt.title"),desc:i("hotkeys.setPrompt.desc"),hotkey:"P"},{title:i("hotkeys.setSeed.title"),desc:i("hotkeys.setSeed.desc"),hotkey:"S"},{title:i("hotkeys.setParameters.title"),desc:i("hotkeys.setParameters.desc"),hotkey:"A"},{title:i("hotkeys.restoreFaces.title"),desc:i("hotkeys.restoreFaces.desc"),hotkey:"Shift+R"},{title:i("hotkeys.upscale.title"),desc:i("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:i("hotkeys.showInfo.title"),desc:i("hotkeys.showInfo.desc"),hotkey:"I"},{title:i("hotkeys.sendToImageToImage.title"),desc:i("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:i("hotkeys.deleteImage.title"),desc:i("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:i("hotkeys.closePanels.title"),desc:i("hotkeys.closePanels.desc"),hotkey:"Esc"}],u=[{title:i("hotkeys.previousImage.title"),desc:i("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:i("hotkeys.nextImage.title"),desc:i("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:i("hotkeys.toggleGalleryPin.title"),desc:i("hotkeys.toggleGalleryPin.desc"),hotkey:"Shift+G"},{title:i("hotkeys.increaseGalleryThumbSize.title"),desc:i("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:i("hotkeys.decreaseGalleryThumbSize.title"),desc:i("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],f=[{title:i("hotkeys.selectBrush.title"),desc:i("hotkeys.selectBrush.desc"),hotkey:"B"},{title:i("hotkeys.selectEraser.title"),desc:i("hotkeys.selectEraser.desc"),hotkey:"E"},{title:i("hotkeys.decreaseBrushSize.title"),desc:i("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:i("hotkeys.increaseBrushSize.title"),desc:i("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:i("hotkeys.decreaseBrushOpacity.title"),desc:i("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:i("hotkeys.increaseBrushOpacity.title"),desc:i("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:i("hotkeys.moveTool.title"),desc:i("hotkeys.moveTool.desc"),hotkey:"V"},{title:i("hotkeys.fillBoundingBox.title"),desc:i("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:i("hotkeys.eraseBoundingBox.title"),desc:i("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:i("hotkeys.colorPicker.title"),desc:i("hotkeys.colorPicker.desc"),hotkey:"C"},{title:i("hotkeys.toggleSnap.title"),desc:i("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:i("hotkeys.quickToggleMove.title"),desc:i("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:i("hotkeys.toggleLayer.title"),desc:i("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:i("hotkeys.clearMask.title"),desc:i("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:i("hotkeys.hideMask.title"),desc:i("hotkeys.hideMask.desc"),hotkey:"H"},{title:i("hotkeys.showHideBoundingBox.title"),desc:i("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:i("hotkeys.mergeVisible.title"),desc:i("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:i("hotkeys.saveToGallery.title"),desc:i("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:i("hotkeys.copyToClipboard.title"),desc:i("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:i("hotkeys.downloadImage.title"),desc:i("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:i("hotkeys.undoStroke.title"),desc:i("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:i("hotkeys.redoStroke.title"),desc:i("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:i("hotkeys.resetView.title"),desc:i("hotkeys.resetView.desc"),hotkey:"R"},{title:i("hotkeys.previousStagingImage.title"),desc:i("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:i("hotkeys.nextStagingImage.title"),desc:i("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:i("hotkeys.acceptStagingImage.title"),desc:i("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],h=p=>l.jsx(B,{flexDir:"column",gap:4,children:p.map((g,y)=>l.jsxs(B,{flexDir:"column",px:2,gap:4,children:[l.jsx(uO,{title:g.title,description:g.desc,hotkey:g.hotkey}),y-1}function qO(e,t){var n=this.__data__,r=$c(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function $r(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=ez}var tz="[object Arguments]",nz="[object Array]",rz="[object Boolean]",iz="[object Date]",oz="[object Error]",az="[object Function]",sz="[object Map]",lz="[object Number]",cz="[object Object]",uz="[object RegExp]",dz="[object Set]",fz="[object String]",hz="[object WeakMap]",pz="[object ArrayBuffer]",mz="[object DataView]",vz="[object Float32Array]",gz="[object Float64Array]",xz="[object Int8Array]",yz="[object Int16Array]",bz="[object Int32Array]",Sz="[object Uint8Array]",Cz="[object Uint8ClampedArray]",wz="[object Uint16Array]",kz="[object Uint32Array]",Ct={};Ct[vz]=Ct[gz]=Ct[xz]=Ct[yz]=Ct[bz]=Ct[Sz]=Ct[Cz]=Ct[wz]=Ct[kz]=!0;Ct[tz]=Ct[nz]=Ct[pz]=Ct[rz]=Ct[mz]=Ct[iz]=Ct[oz]=Ct[az]=Ct[sz]=Ct[lz]=Ct[cz]=Ct[uz]=Ct[dz]=Ct[fz]=Ct[hz]=!1;function jz(e){return so(e)&&rb(e.length)&&!!Ct[ao(e)]}function Lp(e){return function(t){return e(t)}}var ib=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$a=ib&&typeof module=="object"&&module&&!module.nodeType&&module,Ez=$a&&$a.exports===ib,Ud=Ez&&G4.process,Pz=function(){try{var e=$a&&$a.require&&$a.require("util").types;return e||Ud&&Ud.binding&&Ud.binding("util")}catch{}}();const na=Pz;var Z0=na&&na.isTypedArray,Iz=Z0?Lp(Z0):jz;const Mz=Iz;var Tz=Object.prototype,_z=Tz.hasOwnProperty;function ob(e,t){var n=Cs(e),r=!n&&$A(e),i=!n&&!r&&nb(e),s=!n&&!r&&!i&&Mz(e),c=n||r||i||s,u=c?BA(e.length,String):[],f=u.length;for(var h in e)(t||_z.call(e,h))&&!(c&&(h=="length"||i&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||JA(h,f)))&&u.push(h);return u}var Dz=Object.prototype;function Bp(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Dz;return e===n}var Oz=Y4(Object.keys,Object);const Az=Oz;var zz=Object.prototype,Rz=zz.hasOwnProperty;function Nz(e){if(!Bp(e))return Az(e);var t=[];for(var n in Object(e))Rz.call(e,n)&&n!="constructor"&&t.push(n);return t}function ab(e){return e!=null&&rb(e.length)&&!Q4(e)}function Hp(e){return ab(e)?ob(e):Nz(e)}function Fz(e,t){return e&&qc(t,Hp(t),e)}function Lz(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Bz=Object.prototype,Hz=Bz.hasOwnProperty;function Wz(e){if(!Ss(e))return Lz(e);var t=Bp(e),n=[];for(var r in e)r=="constructor"&&(t||!Hz.call(e,r))||n.push(r);return n}function Wp(e){return ab(e)?ob(e,!0):Wz(e)}function Vz(e,t){return e&&qc(t,Wp(t),e)}var sb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,J0=sb&&typeof module=="object"&&module&&!module.nodeType&&module,Uz=J0&&J0.exports===sb,e1=Uz?kr.Buffer:void 0,t1=e1?e1.allocUnsafe:void 0;function $z(e,t){if(t)return e.slice();var n=e.length,r=t1?t1(n):new e.constructor(n);return e.copy(r),r}function lb(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n=0)&&(n[i]=e[i]);return n}function g1(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var x1=function(t){return Array.isArray(t)&&t.length===0},kn=function(t){return typeof t=="function"},Yc=function(t){return t!==null&&typeof t=="object"},VN=function(t){return String(Math.floor(Number(t)))===t},$d=function(t){return Object.prototype.toString.call(t)==="[object String]"},yb=function(t){return x.Children.count(t)===0},Gd=function(t){return Yc(t)&&kn(t.then)};function rn(e,t,n,r){r===void 0&&(r=0);for(var i=xb(t);e&&r=0?[]:{}}}return(s===0?e:i)[c[s]]===n?e:(n===void 0?delete i[c[s]]:i[c[s]]=n,s===0&&n===void 0&&delete r[c[s]],r)}function bb(e,t,n,r){n===void 0&&(n=new WeakMap),r===void 0&&(r={});for(var i=0,s=Object.keys(e);i0?de.map(function(je){return z(je,rn(N,je))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(xe).then(function(je){return je.reduce(function(q,se,Fe){return se==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||se&&(q=br(q,de[Fe],se)),q},{})})},[z]),F=x.useCallback(function(N){return Promise.all([V(N),y.validationSchema?_(N):{},y.validate?D(N):{}]).then(function(de){var xe=de[0],je=de[1],q=de[2],se=$f.all([xe,je,q],{arrayMerge:XN});return se})},[y.validate,y.validationSchema,V,D,_]),L=Hn(function(N){return N===void 0&&(N=I.values),T({type:"SET_ISVALIDATING",payload:!0}),F(N).then(function(de){return j.current&&(T({type:"SET_ISVALIDATING",payload:!1}),T({type:"SET_ERRORS",payload:de})),de})});x.useEffect(function(){c&&j.current===!0&&ri(S.current,y.initialValues)&&L(S.current)},[c,L]);var X=x.useCallback(function(N){var de=N&&N.values?N.values:S.current,xe=N&&N.errors?N.errors:C.current?C.current:y.initialErrors||{},je=N&&N.touched?N.touched:w.current?w.current:y.initialTouched||{},q=N&&N.status?N.status:k.current?k.current:y.initialStatus;S.current=de,C.current=xe,w.current=je,k.current=q;var se=function(){T({type:"RESET_FORM",payload:{isSubmitting:!!N&&!!N.isSubmitting,errors:xe,touched:je,status:q,values:de,isValidating:!!N&&!!N.isValidating,submitCount:N&&N.submitCount&&typeof N.submitCount=="number"?N.submitCount:0}})};if(y.onReset){var Fe=y.onReset(I.values,ve);Gd(Fe)?Fe.then(se):se()}else se()},[y.initialErrors,y.initialStatus,y.initialTouched]);x.useEffect(function(){j.current===!0&&!ri(S.current,y.initialValues)&&(h&&(S.current=y.initialValues,X()),c&&L(S.current))},[h,y.initialValues,X,c,L]),x.useEffect(function(){h&&j.current===!0&&!ri(C.current,y.initialErrors)&&(C.current=y.initialErrors||Oi,T({type:"SET_ERRORS",payload:y.initialErrors||Oi}))},[h,y.initialErrors]),x.useEffect(function(){h&&j.current===!0&&!ri(w.current,y.initialTouched)&&(w.current=y.initialTouched||Fl,T({type:"SET_TOUCHED",payload:y.initialTouched||Fl}))},[h,y.initialTouched]),x.useEffect(function(){h&&j.current===!0&&!ri(k.current,y.initialStatus)&&(k.current=y.initialStatus,T({type:"SET_STATUS",payload:y.initialStatus}))},[h,y.initialStatus,y.initialTouched]);var $=Hn(function(N){if(M.current[N]&&kn(M.current[N].validate)){var de=rn(I.values,N),xe=M.current[N].validate(de);return Gd(xe)?(T({type:"SET_ISVALIDATING",payload:!0}),xe.then(function(je){return je}).then(function(je){T({type:"SET_FIELD_ERROR",payload:{field:N,value:je}}),T({type:"SET_ISVALIDATING",payload:!1})})):(T({type:"SET_FIELD_ERROR",payload:{field:N,value:xe}}),Promise.resolve(xe))}else if(y.validationSchema)return T({type:"SET_ISVALIDATING",payload:!0}),_(I.values,N).then(function(je){return je}).then(function(je){T({type:"SET_FIELD_ERROR",payload:{field:N,value:je[N]}}),T({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),Q=x.useCallback(function(N,de){var xe=de.validate;M.current[N]={validate:xe}},[]),ie=x.useCallback(function(N){delete M.current[N]},[]),oe=Hn(function(N,de){T({type:"SET_TOUCHED",payload:N});var xe=de===void 0?i:de;return xe?L(I.values):Promise.resolve()}),U=x.useCallback(function(N){T({type:"SET_ERRORS",payload:N})},[]),K=Hn(function(N,de){var xe=kn(N)?N(I.values):N;T({type:"SET_VALUES",payload:xe});var je=de===void 0?n:de;return je?L(xe):Promise.resolve()}),ne=x.useCallback(function(N,de){T({type:"SET_FIELD_ERROR",payload:{field:N,value:de}})},[]),ce=Hn(function(N,de,xe){T({type:"SET_FIELD_VALUE",payload:{field:N,value:de}});var je=xe===void 0?n:xe;return je?L(br(I.values,N,de)):Promise.resolve()}),Re=x.useCallback(function(N,de){var xe=de,je=N,q;if(!$d(N)){N.persist&&N.persist();var se=N.target?N.target:N.currentTarget,Fe=se.type,Ze=se.name,ee=se.id,He=se.value,nt=se.checked,Ft=se.outerHTML,pe=se.options,De=se.multiple;xe=de||Ze||ee,je=/number|range/.test(Fe)?(q=parseFloat(He),isNaN(q)?"":q):/checkbox/.test(Fe)?QN(rn(I.values,xe),nt,He):pe&&De?KN(pe):He}xe&&ce(xe,je)},[ce,I.values]),ze=Hn(function(N){if($d(N))return function(de){return Re(de,N)};Re(N)}),Me=Hn(function(N,de,xe){de===void 0&&(de=!0),T({type:"SET_FIELD_TOUCHED",payload:{field:N,value:de}});var je=xe===void 0?i:xe;return je?L(I.values):Promise.resolve()}),J=x.useCallback(function(N,de){N.persist&&N.persist();var xe=N.target,je=xe.name,q=xe.id,se=xe.outerHTML,Fe=de||je||q;Me(Fe,!0)},[Me]),ue=Hn(function(N){if($d(N))return function(de){return J(de,N)};J(N)}),Ie=x.useCallback(function(N){kn(N)?T({type:"SET_FORMIK_STATE",payload:N}):T({type:"SET_FORMIK_STATE",payload:function(){return N}})},[]),Be=x.useCallback(function(N){T({type:"SET_STATUS",payload:N})},[]),Ne=x.useCallback(function(N){T({type:"SET_ISSUBMITTING",payload:N})},[]),Ge=Hn(function(){return T({type:"SUBMIT_ATTEMPT"}),L().then(function(N){var de=N instanceof Error,xe=!de&&Object.keys(N).length===0;if(xe){var je;try{if(je=_e(),je===void 0)return}catch(q){throw q}return Promise.resolve(je).then(function(q){return j.current&&T({type:"SUBMIT_SUCCESS"}),q}).catch(function(q){if(j.current)throw T({type:"SUBMIT_FAILURE"}),q})}else if(j.current&&(T({type:"SUBMIT_FAILURE"}),de))throw N})}),Qe=Hn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),Ge().catch(function(de){console.warn("Warning: An unhandled error was caught from submitForm()",de)})}),ve={resetForm:X,validateForm:L,validateField:$,setErrors:U,setFieldError:ne,setFieldTouched:Me,setFieldValue:ce,setStatus:Be,setSubmitting:Ne,setTouched:oe,setValues:K,setFormikState:Ie,submitForm:Ge},_e=Hn(function(){return p(I.values,ve)}),qe=Hn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),X()}),ge=x.useCallback(function(N){return{value:rn(I.values,N),error:rn(I.errors,N),touched:!!rn(I.touched,N),initialValue:rn(S.current,N),initialTouched:!!rn(w.current,N),initialError:rn(C.current,N)}},[I.errors,I.touched,I.values]),Te=x.useCallback(function(N){return{setValue:function(xe,je){return ce(N,xe,je)},setTouched:function(xe,je){return Me(N,xe,je)},setError:function(xe){return ne(N,xe)}}},[ce,Me,ne]),et=x.useCallback(function(N){var de=Yc(N),xe=de?N.name:N,je=rn(I.values,xe),q={name:xe,value:je,onChange:ze,onBlur:ue};if(de){var se=N.type,Fe=N.value,Ze=N.as,ee=N.multiple;se==="checkbox"?Fe===void 0?q.checked=!!je:(q.checked=!!(Array.isArray(je)&&~je.indexOf(Fe)),q.value=Fe):se==="radio"?(q.checked=je===Fe,q.value=Fe):Ze==="select"&&ee&&(q.value=q.value||[],q.multiple=!0)}return q},[ue,ze,I.values]),Ve=x.useMemo(function(){return!ri(S.current,I.values)},[S.current,I.values]),vt=x.useMemo(function(){return typeof u<"u"?Ve?I.errors&&Object.keys(I.errors).length===0:u!==!1&&kn(u)?u(y):u:I.errors&&Object.keys(I.errors).length===0},[u,Ve,I.errors,y]),Nt=ht({},I,{initialValues:S.current,initialErrors:C.current,initialTouched:w.current,initialStatus:k.current,handleBlur:ue,handleChange:ze,handleReset:qe,handleSubmit:Qe,resetForm:X,setErrors:U,setFormikState:Ie,setFieldTouched:Me,setFieldValue:ce,setFieldError:ne,setStatus:Be,setSubmitting:Ne,setTouched:oe,setValues:K,submitForm:Ge,validateForm:L,validateField:$,isValid:vt,dirty:Ve,unregisterField:ie,registerField:Q,getFieldProps:et,getFieldMeta:ge,getFieldHelpers:Te,validateOnBlur:i,validateOnChange:n,validateOnMount:c});return Nt}function ws(e){var t=GN(e),n=e.component,r=e.children,i=e.render,s=e.innerRef;return x.useImperativeHandle(s,function(){return t}),x.createElement(UN,{value:t},n?x.createElement(n,t):i?i(t):r?kn(r)?r(t):yb(r)?null:x.Children.only(r):null)}function qN(e){var t={};if(e.inner){if(e.inner.length===0)return br(t,e.path,e.message);for(var i=e.inner,n=Array.isArray(i),r=0,i=n?i:i[Symbol.iterator]();;){var s;if(n){if(r>=i.length)break;s=i[r++]}else{if(r=i.next(),r.done)break;s=r.value}var c=s;rn(t,c.path)||(t=br(t,c.path,c.message))}}return t}function YN(e,t,n,r){n===void 0&&(n=!1),r===void 0&&(r={});var i=Kf(e);return t[n?"validateSync":"validate"](i,{abortEarly:!1,context:r})}function Kf(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);Array.isArray(e[r])===!0?t[r]=e[r].map(function(i){return Array.isArray(i)===!0||G0(i)?Kf(i):i!==""?i:void 0}):G0(e[r])?t[r]=Kf(e[r]):t[r]=e[r]!==""?e[r]:void 0}return t}function XN(e,t,n){var r=e.slice();return t.forEach(function(s,c){if(typeof r[c]>"u"){var u=n.clone!==!1,f=u&&n.isMergeableObject(s);r[c]=f?$f(Array.isArray(s)?[]:{},s,n):s}else n.isMergeableObject(s)?r[c]=$f(e[c],s,n):e.indexOf(s)===-1&&r.push(s)}),r}function KN(e){return Array.from(e).filter(function(t){return t.selected}).map(function(t){return t.value})}function QN(e,t,n){if(typeof e=="boolean")return Boolean(t);var r=[],i=!1,s=-1;if(Array.isArray(e))r=e,s=e.indexOf(n),i=s>=0;else if(!n||n=="true"||n=="false")return Boolean(t);return t&&n&&!i?r.concat(n):i?r.slice(0,s).concat(r.slice(s+1)):r}var ZN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?x.useLayoutEffect:x.useEffect;function Hn(e){var t=x.useRef(e);return ZN(function(){t.current=e}),x.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;ir?i:r},0);return Array.from(ht({},t,{length:n+1}))}else return[]},rF=function(e){WN(t,e);function t(r){var i;return i=e.call(this,r)||this,i.updateArrayField=function(s,c,u){var f=i.props,h=f.name,p=f.formik.setFormikState;p(function(g){var y=typeof u=="function"?u:s,S=typeof c=="function"?c:s,C=br(g.values,h,s(rn(g.values,h))),w=u?y(rn(g.errors,h)):void 0,k=c?S(rn(g.touched,h)):void 0;return x1(w)&&(w=void 0),x1(k)&&(k=void 0),ht({},g,{values:C,errors:u?br(g.errors,h,w):g.errors,touched:c?br(g.touched,h,k):g.touched})})},i.push=function(s){return i.updateArrayField(function(c){return[].concat(ra(c),[HN(s)])},!1,!1)},i.handlePush=function(s){return function(){return i.push(s)}},i.swap=function(s,c){return i.updateArrayField(function(u){return tF(u,s,c)},!0,!0)},i.handleSwap=function(s,c){return function(){return i.swap(s,c)}},i.move=function(s,c){return i.updateArrayField(function(u){return eF(u,s,c)},!0,!0)},i.handleMove=function(s,c){return function(){return i.move(s,c)}},i.insert=function(s,c){return i.updateArrayField(function(u){return qd(u,s,c)},function(u){return qd(u,s,null)},function(u){return qd(u,s,null)})},i.handleInsert=function(s,c){return function(){return i.insert(s,c)}},i.replace=function(s,c){return i.updateArrayField(function(u){return nF(u,s,c)},!1,!1)},i.handleReplace=function(s,c){return function(){return i.replace(s,c)}},i.unshift=function(s){var c=-1;return i.updateArrayField(function(u){var f=u?[s].concat(u):[s];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f}),c},i.handleUnshift=function(s){return function(){return i.unshift(s)}},i.handleRemove=function(s){return function(){return i.remove(s)}},i.handlePop=function(){return function(){return i.pop()}},i.remove=i.remove.bind(g1(i)),i.pop=i.pop.bind(g1(i)),i}var n=t.prototype;return n.componentDidUpdate=function(i){this.props.validateOnChange&&this.props.formik.validateOnChange&&!ri(rn(i.formik.values,i.name),rn(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},n.remove=function(i){var s;return this.updateArrayField(function(c){var u=c?ra(c):[];return s||(s=u[i]),kn(u.splice)&&u.splice(i,1),u},!0,!0),s},n.pop=function(){var i;return this.updateArrayField(function(s){var c=s;return i||(i=c&&c.pop&&c.pop()),c},!0,!0),i},n.render=function(){var i={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},s=this.props,c=s.component,u=s.render,f=s.children,h=s.name,p=s.formik,g=Li(p,["validate","validationSchema"]),y=ht({},i,{form:g,name:h});return c?x.createElement(c,y):u?u(y):f?typeof f=="function"?f(y):yb(f)?null:x.Children.only(f):null},t}(x.Component);rF.defaultProps={validateOnChange:!0};function iF(e){const{model:t}=e,r=O(C=>C.system.model_list)[t],i=Y(),{t:s}=Z(),c=O(C=>C.system.isProcessing),u=O(C=>C.system.isConnected),[f,h]=x.useState("same"),[p,g]=x.useState("");x.useEffect(()=>{h("same")},[t]);const y=()=>{h("same")},S=()=>{i(i3({model_name:t,save_location:f,custom_location:f==="custom"&&p!==""?p:null}))};return l.jsxs(Wc,{title:`${s("modelManager.convert")} ${t}`,acceptCallback:S,cancelCallback:y,acceptButtonText:`${s("modelManager.convert")}`,triggerComponent:l.jsxs(Je,{size:"sm","aria-label":s("modelManager.convertToDiffusers"),isDisabled:r.status==="active"||c||!u,className:" modal-close-btn",marginInlineEnd:8,children:["🧨 ",s("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[l.jsxs(B,{flexDirection:"column",rowGap:4,children:[l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText1")}),l.jsxs(gx,{children:[l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText2")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText3")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText4")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText5")})]}),l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText6")})]}),l.jsxs(B,{flexDir:"column",gap:4,children:[l.jsxs(B,{marginTop:4,flexDir:"column",gap:2,children:[l.jsx(Ce,{fontWeight:"600",children:s("modelManager.convertToDiffusersSaveLocation")}),l.jsx(Ja,{value:f,onChange:C=>h(C),children:l.jsxs(B,{gap:4,children:[l.jsx(vn,{value:"same",children:l.jsx(Yt,{label:"Save converted model in the same folder",children:s("modelManager.sameFolder")})}),l.jsx(vn,{value:"root",children:l.jsx(Yt,{label:"Save converted model in the InvokeAI root folder",children:s("modelManager.invokeRoot")})}),l.jsx(vn,{value:"custom",children:l.jsx(Yt,{label:"Save converted model in a custom folder",children:s("modelManager.custom")})})]})})]}),f==="custom"&&l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.customSaveLocation")}),l.jsx(mt,{value:p,onChange:C=>{C.target.value!==""&&g(C.target.value)},width:"full"})]})]})]})}const oF=be([Pt],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),y1=64,b1=2048;function aF(){const{openModel:e,model_list:t}=O(oF),n=O(f=>f.system.isProcessing),r=Y(),{t:i}=Z(),[s,c]=x.useState({name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,default:!1,format:"ckpt"});x.useEffect(()=>{var f,h,p,g,y,S,C;if(e){const w=te.pickBy(t,(k,j)=>te.isEqual(j,e));c({name:e,description:(f=w[e])==null?void 0:f.description,config:(h=w[e])==null?void 0:h.config,weights:(p=w[e])==null?void 0:p.weights,vae:(g=w[e])==null?void 0:g.vae,width:(y=w[e])==null?void 0:y.width,height:(S=w[e])==null?void 0:S.height,default:(C=w[e])==null?void 0:C.default,format:"ckpt"})}},[t,e]);const u=f=>{r(ls({...f,width:Number(f.width),height:Number(f.height)}))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsxs(B,{alignItems:"center",gap:4,justifyContent:"space-between",children:[l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e}),l.jsx(iF,{model:e})]}),l.jsx(B,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(ws,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:p})=>l.jsx("form",{onSubmit:f,children:l.jsxs(Le,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:i("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&p.description?l.jsx(kt,{children:h.description}):l.jsx(wt,{margin:0,children:i("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.config&&p.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:i("modelManager.config")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"full"}),h.config&&p.config?l.jsx(kt,{children:h.config}):l.jsx(wt,{margin:0,children:i("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.weights&&p.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:i("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"full"}),h.weights&&p.weights?l.jsx(kt,{children:h.weights}):l.jsx(wt,{margin:0,children:i("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.vae&&p.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:i("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"full"}),h.vae&&p.vae?l.jsx(kt,{children:h.vae}):l.jsx(wt,{margin:0,children:i("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(sa,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!h.width&&p.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:i("modelManager.width")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:g,form:y})=>l.jsx(Lr,{id:"width",name:"width",min:y1,max:b1,step:64,value:y.values.width,onChange:S=>y.setFieldValue(g.name,Number(S))})}),h.width&&p.width?l.jsx(kt,{children:h.width}):l.jsx(wt,{margin:0,children:i("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.height&&p.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:i("modelManager.height")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:g,form:y})=>l.jsx(Lr,{id:"height",name:"height",min:y1,max:b1,step:64,value:y.values.height,onChange:S=>y.setFieldValue(g.name,Number(S))})}),h.height&&p.height?l.jsx(kt,{children:h.height}):l.jsx(wt,{margin:0,children:i("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:i("modelManager.updateModel")})]})})})})]}):l.jsx(B,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:500,children:"Pick A Model To Edit"})})}const sF=be([Pt],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}});function lF(){const{openModel:e,model_list:t}=O(sF),n=O(f=>f.system.isProcessing),r=Y(),{t:i}=Z(),[s,c]=x.useState({name:"",description:"",repo_id:"",path:"",vae:{repo_id:"",path:""},default:!1,format:"diffusers"});x.useEffect(()=>{var f,h,p,g,y,S,C,w,k,j,M,P,I,T,D,_;if(e){const z=te.pickBy(t,(V,F)=>te.isEqual(F,e));c({name:e,description:(f=z[e])==null?void 0:f.description,path:(h=z[e])!=null&&h.path&&((p=z[e])==null?void 0:p.path)!=="None"?(g=z[e])==null?void 0:g.path:"",repo_id:(y=z[e])!=null&&y.repo_id&&((S=z[e])==null?void 0:S.repo_id)!=="None"?(C=z[e])==null?void 0:C.repo_id:"",vae:{repo_id:(k=(w=z[e])==null?void 0:w.vae)!=null&&k.repo_id?(M=(j=z[e])==null?void 0:j.vae)==null?void 0:M.repo_id:"",path:(I=(P=z[e])==null?void 0:P.vae)!=null&&I.path?(D=(T=z[e])==null?void 0:T.vae)==null?void 0:D.path:""},default:(_=z[e])==null?void 0:_.default,format:"diffusers"})}},[t,e]);const u=f=>{const h=f;f.path===""&&delete h.path,f.repo_id===""&&delete h.repo_id,f.vae.path===""&&delete h.vae.path,f.vae.repo_id===""&&delete h.vae.repo_id,r(ls(f))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsx(B,{alignItems:"center",children:l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e})}),l.jsx(B,{flexDirection:"column",overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(ws,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:p})=>{var g,y,S,C,w,k,j,M,P,I;return l.jsx("form",{onSubmit:f,children:l.jsxs(Le,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:i("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&p.description?l.jsx(kt,{children:h.description}):l.jsx(wt,{margin:0,children:i("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.path&&p.path,isRequired:!0,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:i("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"full"}),h.path&&p.path?l.jsx(kt,{children:h.path}):l.jsx(wt,{margin:0,children:i("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.repo_id&&p.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:i("modelManager.repo_id")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"full"}),h.repo_id&&p.repo_id?l.jsx(kt,{children:h.repo_id}):l.jsx(wt,{margin:0,children:i("modelManager.repoIDValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((g=h.vae)!=null&&g.path)&&((y=p.vae)==null?void 0:y.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:i("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"full"}),(S=h.vae)!=null&&S.path&&((C=p.vae)!=null&&C.path)?l.jsx(kt,{children:(w=h.vae)==null?void 0:w.path}):l.jsx(wt,{margin:0,children:i("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((k=h.vae)!=null&&k.repo_id)&&((j=p.vae)==null?void 0:j.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:i("modelManager.vaeRepoID")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"full"}),(M=h.vae)!=null&&M.repo_id&&((P=p.vae)!=null&&P.repo_id)?l.jsx(kt,{children:(I=h.vae)==null?void 0:I.repo_id}):l.jsx(wt,{margin:0,children:i("modelManager.vaeRepoIDValidationMsg")})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:i("modelManager.updateModel")})]})})}})})]}):l.jsx(B,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:"500",children:"Pick A Model To Edit"})})}const Cb=be([Pt],e=>{const{model_list:t}=e,n=[];return te.forEach(t,r=>{n.push(r.weights)}),n});function S1({model:e,modelsToAdd:t,setModelsToAdd:n}){const{t:r}=Z(),i=O(Cb),s=c=>{t.includes(c.target.value)?n(te.remove(t,u=>u!==c.target.value)):n([...t,c.target.value])};return l.jsx(Le,{children:l.jsxs(B,{flexDirection:"column",gap:2,backgroundColor:t.includes(e.name)?"accent.650":"base.800",paddingX:4,paddingY:2,borderRadius:4,children:[l.jsxs(B,{gap:4,children:[l.jsx(pt,{value:e.name,label:l.jsx(Ce,{fontWeight:500,children:e.name}),isChecked:t.includes(e.name),isDisabled:i.includes(e.location),onChange:s}),i.includes(e.location)&&l.jsx(Sx,{colorScheme:"accent",children:r("modelManager.modelExists")})]}),l.jsx(Ce,{fontStyle:"italic",variant:"subtext",children:e.location})]})})}function cF(){const e=Y(),{t}=Z(),n=O(P=>P.system.searchFolder),r=O(P=>P.system.foundModels),i=O(Cb),s=O(P=>P.ui.shouldShowExistingModelsInSearch),c=O(P=>P.system.isProcessing),[u,f]=ke.useState([]),[h,p]=ke.useState("v1"),[g,y]=ke.useState(""),S=()=>{e(a3(null)),e(s3(null)),f([])},C=P=>{e(Zv(P.checkpointFolder))},w=()=>{f([]),r&&r.forEach(P=>{i.includes(P.location)||f(I=>[...I,P.name])})},k=()=>{f([])},j=()=>{const P=r==null?void 0:r.filter(T=>u.includes(T.name)),I={v1:"configs/stable-diffusion/v1-inference.yaml",v2_base:"configs/stable-diffusion/v2-inference-v.yaml",v2_768:"configs/stable-diffusion/v2-inference-v.yaml",inpainting:"configs/stable-diffusion/v1-inpainting-inference.yaml",custom:g};P==null||P.forEach(T=>{const D={name:T.name,description:"",config:I[h],weights:T.location,vae:"",width:512,height:512,default:!1,format:"ckpt"};e(ls(D))}),f([])},M=()=>{const P=[],I=[];return r&&r.forEach((T,D)=>{i.includes(T.location)?I.push(l.jsx(S1,{model:T,modelsToAdd:u,setModelsToAdd:f},D)):P.push(l.jsx(S1,{model:T,modelsToAdd:u,setModelsToAdd:f},D))}),l.jsxs(l.Fragment,{children:[P,s&&I]})};return l.jsxs(l.Fragment,{children:[n?l.jsxs(B,{sx:{padding:4,gap:2,position:"relative",borderRadius:"base",alignItems:"center",w:"full",bg:"base.900"},children:[l.jsxs(B,{sx:{flexDir:"column",gap:2},children:[l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},variant:"subtext",children:t("modelManager.checkpointFolder")}),l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},children:n})]}),l.jsx(jc,{}),l.jsx(le,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:l.jsx(ep,{}),fontSize:18,disabled:c,onClick:()=>e(Zv(n))}),l.jsx(le,{"aria-label":t("modelManager.clearCheckpointFolder"),icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),onClick:S})]}):l.jsx(ws,{initialValues:{checkpointFolder:""},onSubmit:P=>{C(P)},children:({handleSubmit:P})=>l.jsx("form",{onSubmit:P,children:l.jsxs(sa,{columnGap:2,alignItems:"flex-end",width:"100%",children:[l.jsx(rt,{isRequired:!0,width:"lg",children:l.jsx(jt,{as:mt,id:"checkpointFolder",name:"checkpointFolder",type:"text",size:"md",label:t("modelManager.checkpointFolder")})}),l.jsx(Je,{leftIcon:l.jsx(X8,{}),"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),type:"submit",disabled:c,paddingX:10,children:t("modelManager.findModels")})]})})}),r&&l.jsxs(B,{flexDirection:"column",rowGap:4,width:"full",children:[l.jsxs(B,{justifyContent:"space-between",alignItems:"center",children:[l.jsxs("p",{children:[t("modelManager.modelsFound"),": ",r.length]}),l.jsxs("p",{children:[t("modelManager.selected"),": ",u.length]})]}),l.jsxs(B,{columnGap:2,justifyContent:"space-between",children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Je,{isDisabled:u.length===r.length,onClick:w,children:t("modelManager.selectAll")}),l.jsx(Je,{isDisabled:u.length===0,onClick:k,children:t("modelManager.deselectAll")}),l.jsx(pt,{label:t("modelManager.showExisting"),isChecked:s,onChange:()=>e(o3(!s))})]}),l.jsx(Je,{isDisabled:u.length===0,onClick:j,colorScheme:"accent",children:t("modelManager.addSelected")})]}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:[l.jsxs(B,{gap:4,children:[l.jsx(Ce,{fontWeight:500,variant:"subtext",children:t("modelManager.pickModelType")}),l.jsx(Ja,{value:h,onChange:P=>p(P),defaultValue:"v1",name:"model_type",children:l.jsxs(B,{gap:4,children:[l.jsx(vn,{value:"v1",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v1")})}),l.jsx(vn,{value:"v2_base",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_base")})}),l.jsx(vn,{value:"v2_768",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_768")})}),l.jsx(vn,{value:"inpainting",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.inpainting")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.customConfig")})})]})})]}),h==="custom"&&l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:t("modelManager.pathToCustomConfig")}),l.jsx(mt,{value:g,onChange:P=>{P.target.value!==""&&y(P.target.value)},width:"full"})]})]}),l.jsx(B,{flexDirection:"column",maxHeight:72,overflowY:"scroll",borderRadius:"sm",paddingInlineEnd:4,gap:2,children:r.length>0?M():l.jsx(Ce,{fontWeight:"500",padding:2,borderRadius:"sm",textAlign:"center",variant:"subtext",children:t("modelManager.noModelsFound")})})]})]})}const C1=64,w1=2048;function uF(){const e=Y(),{t}=Z(),n=O(h=>h.system.isProcessing);function r(h){return/\s/.test(h)}function i(h){let p;return r(h)&&(p=t("modelManager.cannotUseSpaces")),p}const s={name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,format:"ckpt",default:!1},c=h=>{e(ls(h)),e(Wi(null))},[u,f]=ke.useState(!1);return l.jsxs(Le,{gap:2,alignItems:"flex-start",children:[l.jsx(le,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wi(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(Cy,{})}),l.jsx(cF,{}),l.jsx(pt,{label:t("modelManager.addManually"),isChecked:u,onChange:()=>f(!u)}),u&&l.jsx(ws,{initialValues:s,onSubmit:c,children:({handleSubmit:h,errors:p,touched:g})=>l.jsx("form",{onSubmit:h,children:l.jsxs(Le,{rowGap:2,children:[l.jsx(Ce,{fontSize:20,fontWeight:"bold",alignSelf:"start",children:t("modelManager.manual")}),l.jsxs(rt,{isInvalid:!!p.name&&g.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:i,width:"2xl"}),p.name&&g.name?l.jsx(kt,{children:p.name}):l.jsx(wt,{margin:0,children:t("modelManager.nameValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.description&&g.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"2xl"}),p.description&&g.description?l.jsx(kt,{children:p.description}):l.jsx(wt,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.config&&g.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.config")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"2xl"}),p.config&&g.config?l.jsx(kt,{children:p.config}):l.jsx(wt,{margin:0,children:t("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.weights&&g.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"2xl"}),p.weights&&g.weights?l.jsx(kt,{children:p.weights}):l.jsx(wt,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.vae&&g.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"2xl"}),p.vae&&g.vae?l.jsx(kt,{children:p.vae}):l.jsx(wt,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(sa,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!p.width&&g.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:t("modelManager.width")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:y,form:S})=>l.jsx(Lr,{id:"width",name:"width",min:C1,max:w1,step:64,width:"90%",value:S.values.width,onChange:C=>S.setFieldValue(y.name,Number(C))})}),p.width&&g.width?l.jsx(kt,{children:p.width}):l.jsx(wt,{margin:0,children:t("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.height&&g.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:t("modelManager.height")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:y,form:S})=>l.jsx(Lr,{id:"height",name:"height",min:C1,max:w1,width:"90%",step:64,value:S.values.height,onChange:C=>S.setFieldValue(y.name,Number(C))})}),p.height&&g.height?l.jsx(kt,{children:p.height}):l.jsx(wt,{margin:0,children:t("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelManager.addModel")})]})})})]})}function Ll({children:e}){return l.jsx(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:e})}function dF(){const e=Y(),{t}=Z(),n=O(u=>u.system.isProcessing);function r(u){return/\s/.test(u)}function i(u){let f;return r(u)&&(f=t("modelManager.cannotUseSpaces")),f}const s={name:"",description:"",repo_id:"",path:"",format:"diffusers",default:!1,vae:{repo_id:"",path:""}},c=u=>{const f=u;u.path===""&&delete f.path,u.repo_id===""&&delete f.repo_id,u.vae.path===""&&delete f.vae.path,u.vae.repo_id===""&&delete f.vae.repo_id,e(ls(f)),e(Wi(null))};return l.jsxs(B,{children:[l.jsx(le,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wi(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(Cy,{})}),l.jsx(ws,{initialValues:s,onSubmit:c,children:({handleSubmit:u,errors:f,touched:h})=>{var p,g,y,S,C,w,k,j,M,P;return l.jsx("form",{onSubmit:u,children:l.jsxs(Le,{rowGap:2,children:[l.jsx(Ll,{children:l.jsxs(rt,{isInvalid:!!f.name&&h.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:i,width:"2xl",isRequired:!0}),f.name&&h.name?l.jsx(kt,{children:f.name}):l.jsx(wt,{margin:0,children:t("modelManager.nameValidationMsg")})]})]})}),l.jsx(Ll,{children:l.jsxs(rt,{isInvalid:!!f.description&&h.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"2xl",isRequired:!0}),f.description&&h.description?l.jsx(kt,{children:f.description}):l.jsx(wt,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]})}),l.jsxs(Ll,{children:[l.jsx(Ce,{fontWeight:"bold",fontSize:"sm",children:t("modelManager.formMessageDiffusersModelLocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersModelLocationDesc")}),l.jsxs(rt,{isInvalid:!!f.path&&h.path,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"2xl"}),f.path&&h.path?l.jsx(kt,{children:f.path}):l.jsx(wt,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!f.repo_id&&h.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:t("modelManager.repo_id")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"2xl"}),f.repo_id&&h.repo_id?l.jsx(kt,{children:f.repo_id}):l.jsx(wt,{margin:0,children:t("modelManager.repoIDValidationMsg")})]})]})]}),l.jsxs(Ll,{children:[l.jsx(Ce,{fontWeight:"bold",children:t("modelManager.formMessageDiffusersVAELocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersVAELocationDesc")}),l.jsxs(rt,{isInvalid:!!((p=f.vae)!=null&&p.path)&&((g=h.vae)==null?void 0:g.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"2xl"}),(y=f.vae)!=null&&y.path&&((S=h.vae)!=null&&S.path)?l.jsx(kt,{children:(C=f.vae)==null?void 0:C.path}):l.jsx(wt,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((w=f.vae)!=null&&w.repo_id)&&((k=h.vae)==null?void 0:k.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:t("modelManager.vaeRepoID")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"2xl"}),(j=f.vae)!=null&&j.repo_id&&((M=h.vae)!=null&&M.repo_id)?l.jsx(kt,{children:(P=f.vae)==null?void 0:P.repo_id}):l.jsx(wt,{margin:0,children:t("modelManager.vaeRepoIDValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",isLoading:n,children:t("modelManager.addModel")})]})})}})]})}function k1({text:e,onClick:t}){return l.jsx(B,{position:"relative",width:"50%",height:40,justifyContent:"center",alignItems:"center",onClick:t,as:to,children:l.jsx(Ce,{fontWeight:"bold",children:e})})}function fF(){const{isOpen:e,onOpen:t,onClose:n}=ui(),r=O(u=>u.ui.addNewModelUIOption),i=Y(),{t:s}=Z(),c=()=>{n(),i(Wi(null))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{"aria-label":s("modelManager.addNewModel"),tooltip:s("modelManager.addNewModel"),onClick:t,size:"sm",children:l.jsxs(B,{columnGap:2,alignItems:"center",children:[l.jsx(xs,{}),s("modelManager.addNew")]})}),l.jsxs(di,{isOpen:e,onClose:c,size:"3xl",closeOnOverlayClick:!1,children:[l.jsx(Nr,{}),l.jsxs(fi,{margin:"auto",paddingInlineEnd:4,children:[l.jsx(Rr,{children:s("modelManager.addNewModel")}),l.jsx(ca,{}),l.jsxs(Fr,{children:[r==null&&l.jsxs(B,{columnGap:4,children:[l.jsx(k1,{text:s("modelManager.addCheckpointModel"),onClick:()=>i(Wi("ckpt"))}),l.jsx(k1,{text:s("modelManager.addDiffuserModel"),onClick:()=>i(Wi("diffusers"))})]}),r=="ckpt"&&l.jsx(uF,{}),r=="diffusers"&&l.jsx(dF,{})]}),l.jsx(zr,{})]})]})]})}function Bl(e){const{isProcessing:t,isConnected:n}=O(S=>S.system),r=O(S=>S.system.openModel),{t:i}=Z(),s=Y(),{name:c,status:u,description:f}=e,h=()=>{s(h2(c))},p=()=>{s(Jv(c))},g=()=>{s(l3(c)),s(Jv(null))},y=()=>{switch(u){case"active":return"ok.500";case"cached":return"warning.500";case"not loaded":return"inherit"}};return l.jsxs(B,{alignItems:"center",p:2,borderRadius:"base",sx:c===r?{bg:"accent.750",_hover:{bg:"accent.750"}}:{_hover:{bg:"base.750"}},children:[l.jsx(We,{onClick:p,cursor:"pointer",children:l.jsx(Yt,{label:f,hasArrow:!0,placement:"bottom",children:l.jsx(Ce,{fontWeight:"600",children:c})})}),l.jsx(jc,{onClick:p,cursor:"pointer"}),l.jsxs(B,{gap:2,alignItems:"center",children:[l.jsx(Ce,{color:y(),children:u}),l.jsx(to,{size:"sm",onClick:h,isDisabled:u==="active"||t||!n,children:i("modelManager.load")}),l.jsx(le,{icon:l.jsx(B9,{}),size:"sm",onClick:p,"aria-label":"Modify Config",isDisabled:u==="active"||t||!n}),l.jsx(Wc,{title:i("modelManager.deleteModel"),acceptCallback:g,acceptButtonText:i("modelManager.delete"),triggerComponent:l.jsx(le,{icon:l.jsx(H9,{}),size:"sm","aria-label":i("modelManager.deleteConfig"),isDisabled:u==="active"||t||!n,colorScheme:"error"}),children:l.jsxs(B,{rowGap:4,flexDirection:"column",children:[l.jsx("p",{style:{fontWeight:"bold"},children:i("modelManager.deleteMsg1")}),l.jsx("p",{children:i("modelManager.deleteMsg2")})]})})]})]})}function hF(){const e=Y(),{isOpen:t,onOpen:n,onClose:r}=ui(),i=O(c8),{t:s}=Z(),[c,u]=x.useState(Object.keys(i)[0]),[f,h]=x.useState(Object.keys(i)[1]),[p,g]=x.useState("none"),[y,S]=x.useState(""),[C,w]=x.useState(.5),[k,j]=x.useState("weighted_sum"),[M,P]=x.useState("root"),[I,T]=x.useState(""),[D,_]=x.useState(!1),z=Object.keys(i).filter($=>$!==f&&$!==p),V=Object.keys(i).filter($=>$!==c&&$!==p),F=[{key:s("modelManager.none"),value:"none"},...Object.keys(i).filter($=>$!==c&&$!==f).map($=>({key:$,value:$}))],L=O($=>$.system.isProcessing),X=()=>{let $=[c,f,p];$=$.filter(ie=>ie!=="none");const Q={models_to_merge:$,merged_model_name:y!==""?y:$.join("-"),alpha:C,interp:k,model_merge_save_path:M==="root"?null:I,force:D};e(c3(Q))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{onClick:n,size:"sm",children:l.jsx(B,{columnGap:2,alignItems:"center",children:s("modelManager.mergeModels")})}),l.jsxs(di,{isOpen:t,onClose:r,size:"4xl",closeOnOverlayClick:!1,children:[l.jsx(Nr,{}),l.jsxs(fi,{fontFamily:"Inter",margin:"auto",paddingInlineEnd:4,children:[l.jsx(Rr,{children:s("modelManager.mergeModels")}),l.jsx(ca,{}),l.jsx(Fr,{children:l.jsxs(B,{flexDirection:"column",rowGap:4,children:[l.jsxs(B,{sx:{flexDirection:"column",marginBottom:4,padding:4,borderRadius:"base",rowGap:1,bg:"base.900"},children:[l.jsx(Ce,{children:s("modelManager.modelMergeHeaderHelp1")}),l.jsx(Ce,{fontSize:"sm",variant:"subtext",children:s("modelManager.modelMergeHeaderHelp2")})]}),l.jsxs(B,{columnGap:4,children:[l.jsx(Mn,{label:s("modelManager.modelOne"),validValues:z,onChange:$=>u($.target.value)}),l.jsx(Mn,{label:s("modelManager.modelTwo"),validValues:V,onChange:$=>h($.target.value)}),l.jsx(Mn,{label:s("modelManager.modelThree"),validValues:F,onChange:$=>{$.target.value!=="none"?(g($.target.value),j("add_difference")):(g("none"),j("weighted_sum"))}})]}),l.jsx(mt,{label:s("modelManager.mergedModelName"),value:y,onChange:$=>S($.target.value)}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(ut,{label:s("modelManager.alpha"),min:.01,max:.99,step:.01,value:C,onChange:$=>w($),withInput:!0,withReset:!0,handleReset:()=>w(.5),withSliderMarks:!0}),l.jsx(Ce,{variant:"subtext",fontSize:"sm",children:s("modelManager.modelMergeAlphaHelp")})]}),l.jsxs(B,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(Ce,{fontWeight:500,fontSize:"sm",variant:"subtext",children:s("modelManager.interpolationType")}),l.jsx(Ja,{value:k,onChange:$=>j($),children:l.jsx(B,{columnGap:4,children:p==="none"?l.jsxs(l.Fragment,{children:[l.jsx(vn,{value:"weighted_sum",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.weightedSum")})}),l.jsx(vn,{value:"sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.sigmoid")})}),l.jsx(vn,{value:"inv_sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.inverseSigmoid")})})]}):l.jsx(vn,{value:"add_difference",children:l.jsx(Yt,{label:s("modelManager.modelMergeInterpAddDifferenceHelp"),children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.addDifference")})})})})})]}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsxs(B,{columnGap:4,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.mergedModelSaveLocation")}),l.jsx(Ja,{value:M,onChange:$=>P($),children:l.jsxs(B,{columnGap:4,children:[l.jsx(vn,{value:"root",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.invokeAIFolder")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.custom")})})]})})]}),M==="custom"&&l.jsx(mt,{label:s("modelManager.mergedModelCustomSaveLocation"),value:I,onChange:$=>T($.target.value)})]}),l.jsx(pt,{label:s("modelManager.ignoreMismatch"),isChecked:D,onChange:$=>_($.target.checked),fontWeight:"500"}),l.jsx(Je,{onClick:X,isLoading:L,isDisabled:M==="custom"&&I==="",children:s("modelManager.merge")})]})}),l.jsx(zr,{})]})]})]})}const pF=be(Pt,e=>te.map(e.model_list,(n,r)=>({name:r,...n})),{memoizeOptions:{resultEqualityCheck:te.isEqual}});function Yd({label:e,isActive:t,onClick:n}){return l.jsx(Je,{onClick:n,isActive:t,sx:{_active:{bg:"accent.750"}},size:"sm",children:e})}const mF=()=>{const e=O(pF),[t,n]=ke.useState(!1);ke.useEffect(()=>{const y=setTimeout(()=>{n(!0)},200);return()=>clearTimeout(y)},[]);const[r,i]=x.useState(""),[s,c]=x.useState("all"),[u,f]=x.useTransition(),{t:h}=Z(),p=y=>{f(()=>{i(y.target.value)})},g=x.useMemo(()=>{const y=[],S=[],C=[],w=[];return e.forEach((k,j)=>{k.name.toLowerCase().includes(r.toLowerCase())&&(C.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j)),k.format===s&&w.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j))),k.format!=="diffusers"?y.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j)):S.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j))}),r!==""?s==="all"?l.jsx(We,{marginTop:4,children:C}):l.jsx(We,{marginTop:4,children:w}):l.jsxs(B,{flexDirection:"column",rowGap:6,children:[s==="all"&&l.jsxs(l.Fragment,{children:[l.jsxs(We,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,my:4,mx:0,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.checkpointModels")}),y]}),l.jsxs(We,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,mb:4,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.diffusersModels")}),S]})]}),s==="ckpt"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:y}),s==="diffusers"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:S})]})},[e,r,h,s]);return l.jsxs(B,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:[l.jsxs(B,{justifyContent:"space-between",alignItems:"center",gap:2,children:[l.jsx(Vn,{size:"md",children:h("modelManager.availableModels")}),l.jsx(jc,{}),l.jsx(fF,{}),l.jsx(hF,{})]}),l.jsx(mt,{onChange:p,label:h("modelManager.search")}),l.jsxs(B,{flexDirection:"column",gap:1,maxHeight:window.innerHeight-240,overflow:"scroll",paddingInlineEnd:4,children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Yd,{label:h("modelManager.allModels"),onClick:()=>c("all"),isActive:s==="all"}),l.jsx(Yd,{label:h("modelManager.checkpointModels"),onClick:()=>c("ckpt"),isActive:s==="ckpt"}),l.jsx(Yd,{label:h("modelManager.diffusersModels"),onClick:()=>c("diffusers"),isActive:s==="diffusers"})]}),t?g:l.jsx(B,{width:"100%",minHeight:96,justifyContent:"center",alignItems:"center",children:l.jsx(Qf,{})})]})]})};function vF({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ui(),i=O(u=>u.system.model_list),s=O(u=>u.system.openModel),{t:c}=Z();return l.jsxs(l.Fragment,{children:[x.cloneElement(e,{onClick:n}),l.jsxs(di,{isOpen:t,onClose:r,size:"full",children:[l.jsx(Nr,{}),l.jsxs(fi,{children:[l.jsx(ca,{}),l.jsx(Rr,{children:c("modelManager.modelManager")}),l.jsx(Fr,{children:l.jsxs(B,{width:"100%",columnGap:8,children:[l.jsx(mF,{}),s&&i[s].format==="diffusers"?l.jsx(lF,{}):l.jsx(aF,{})]})}),l.jsx(zr,{})]})]})]})}const gF=be([Pt],e=>{const{isProcessing:t,model_list:n}=e;return{models:te.map(n,(i,s)=>s),isProcessing:t}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),xF=()=>{const e=Y(),{t}=Z(),{models:n,isProcessing:r}=O(gF),i=O(wy),s=c=>{e(h2(c.target.value))};return l.jsx(B,{style:{paddingInlineStart:1.5},children:l.jsx(Mn,{style:{fontSize:"sm"},"aria-label":t("accessibility.modelSelect"),tooltip:i.description,isDisabled:r,value:i.name,validValues:n,onChange:s})})},yF=be([Pt,ro],(e,t)=>{const{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:i,model_list:s,saveIntermediatesInterval:c,enableImageDebugging:u}=e,{shouldUseCanvasBetaLayout:f,shouldUseSliders:h}=t;return{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:i,models:te.map(s,(p,g)=>g),saveIntermediatesInterval:c,enableImageDebugging:u,shouldUseCanvasBetaLayout:f,shouldUseSliders:h}},{memoizeOptions:{resultEqualityCheck:te.isEqual}}),Xd={flexDirection:"column",gap:2,p:4,bg:"base.900"},bF=({children:e})=>{const t=Y(),{t:n}=Z(),r=O(P=>P.generation.steps),{isOpen:i,onOpen:s,onClose:c}=ui(),{isOpen:u,onOpen:f,onClose:h}=ui(),{shouldDisplayInProgressType:p,shouldConfirmOnDelete:g,shouldDisplayGuides:y,saveIntermediatesInterval:S,enableImageDebugging:C,shouldUseCanvasBetaLayout:w,shouldUseSliders:k}=O(yF),j=()=>{v3.purge().then(()=>{c(),f()})},M=P=>{P>r&&(P=r),P<1&&(P=1),t(g3(P))};return l.jsxs(l.Fragment,{children:[x.cloneElement(e,{onClick:s}),l.jsxs(di,{isOpen:i,onClose:c,size:"xl",children:[l.jsx(Nr,{}),l.jsxs(fi,{paddingInlineEnd:4,children:[l.jsx(Rr,{children:n("common.settingsLabel")}),l.jsx(ca,{}),l.jsx(Fr,{children:l.jsxs($n,{gap:4,children:[l.jsxs(B,{sx:Xd,children:[l.jsx(Mn,{label:n("settings.displayInProgress"),validValues:u3,value:p,onChange:P=>t(d3(P.target.value))}),p==="full-res"&&l.jsx(Lr,{label:n("settings.saveSteps"),min:1,max:r,step:1,onChange:M,value:S,width:"auto",textAlign:"center"}),l.jsx(En,{label:n("settings.confirmOnDelete"),isChecked:g,onChange:P=>t(_1(P.target.checked))}),l.jsx(En,{label:n("settings.displayHelpIcons"),isChecked:y,onChange:P=>t(f3(P.target.checked))}),l.jsx(En,{label:n("settings.useCanvasBeta"),isChecked:w,onChange:P=>t(h3(P.target.checked))}),l.jsx(En,{label:n("settings.useSlidersForAll"),isChecked:k,onChange:P=>t(p3(P.target.checked))})]}),l.jsxs(B,{sx:Xd,children:[l.jsx(Vn,{size:"sm",style:{fontWeight:"bold"},children:"Developer"}),l.jsx(En,{label:n("settings.enableImageDebugging"),isChecked:C,onChange:P=>t(m3(P.target.checked))})]}),l.jsxs(B,{sx:Xd,children:[l.jsx(Vn,{size:"sm",children:n("settings.resetWebUI")}),l.jsx(Je,{colorScheme:"error",onClick:j,children:n("settings.resetWebUI")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc1")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc2")})]})]})}),l.jsx(zr,{children:l.jsx(Je,{onClick:c,children:n("common.close")})})]})]}),l.jsxs(di,{closeOnOverlayClick:!1,isOpen:u,onClose:h,isCentered:!0,children:[l.jsx(Nr,{backdropFilter:"blur(40px)"}),l.jsxs(fi,{children:[l.jsx(Rr,{}),l.jsx(Fr,{children:l.jsx(B,{justifyContent:"center",children:l.jsx(Ce,{fontSize:"lg",children:l.jsx(Ce,{children:n("settings.resetComplete")})})})}),l.jsx(zr,{})]})]})]})},SF=be(Pt,e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:te.isEqual}}),CF=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:i,hasError:s,wasErrorSeen:c}=O(SF),u=Y(),{t:f}=Z();let h;e&&!s?h="ok":h="error";let p=i;t&&(h="working"),p&&t&&r>1&&(p=`${f(p)} (${n}/${r})`);const g=s&&!c?"Click to clear, check logs for details":void 0,y=s&&!c?"pointer":"initial",S=()=>{(s||!c)&&u(f2())};return l.jsx(Yt,{label:g,children:l.jsx(Ce,{cursor:y,onClick:S,sx:{fontSize:"xs",fontWeight:"600",color:`${h}.400`},children:f(p)})})};function wF(){const{t:e}=Z(),t=Y(),n=O(c=>c.ui.currentTheme),r={dark:e("common.darkTheme"),light:e("common.lightTheme"),green:e("common.greenTheme"),ocean:e("common.oceanTheme")},i=c=>{t(x3(c))},s=()=>{const c=[];return Object.keys(r).forEach(u=>{c.push(l.jsx(Je,{sx:{width:24},isChecked:n===u,leftIcon:n===u?l.jsx(zc,{}):void 0,size:"sm",onClick:()=>i(u),children:r[u]},u))}),c};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":e("common.themeLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(U8,{})}),children:l.jsx(Le,{align:"stretch",children:s()})})}function kF(){const{t:e,i18n:t}=Z(),n={ar:e("common.langArabic",{lng:"ar"}),nl:e("common.langDutch",{lng:"nl"}),en:e("common.langEnglish",{lng:"en"}),fr:e("common.langFrench",{lng:"fr"}),de:e("common.langGerman",{lng:"de"}),he:e("common.langHebrew",{lng:"he"}),it:e("common.langItalian",{lng:"it"}),ja:e("common.langJapanese",{lng:"ja"}),ko:e("common.langKorean",{lng:"ko"}),pl:e("common.langPolish",{lng:"pl"}),pt_BR:e("common.langBrPortuguese",{lng:"pt_BR"}),pt:e("common.langPortuguese",{lng:"pt"}),ru:e("common.langRussian",{lng:"ru"}),zh_CN:e("common.langSimplifiedChinese",{lng:"zh_CN"}),es:e("common.langSpanish",{lng:"es"}),uk:e("common.langUkranian",{lng:"ua"})},r=()=>{const i=[];return Object.keys(n).forEach(s=>{i.push(l.jsx(Je,{isChecked:localStorage.getItem("i18nextLng")===s,leftIcon:localStorage.getItem("i18nextLng")===s?l.jsx(zc,{}):void 0,onClick:()=>t.changeLanguage(s),"aria-label":n[s],size:"sm",minWidth:"200px",children:n[s]},s))}),i};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(le,{"aria-label":e("common.languagePickerLabel"),tooltip:e("common.languagePickerLabel"),icon:l.jsx(H8,{}),size:"sm",variant:"link","data-variant":"link",fontSize:26}),children:l.jsx(Le,{children:r()})})}const jF=()=>{const{t:e}=Z();return l.jsxs($n,{gridTemplateColumns:"auto max-content",children:[l.jsx(p4,{}),l.jsxs(B,{alignItems:"center",gap:2,children:[l.jsx(CF,{}),l.jsx(xF,{}),l.jsx(vF,{children:l.jsx(le,{"aria-label":e("modelManager.modelManager"),tooltip:e("modelManager.modelManager"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(O8,{})})}),l.jsx(dO,{children:l.jsx(le,{"aria-label":e("common.hotkeysLabel"),tooltip:e("common.hotkeysLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(B8,{})})}),l.jsx(wF,{}),l.jsx(kF,{}),l.jsx(le,{"aria-label":e("common.reportBugLabel"),tooltip:e("common.reportBugLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx($i,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",children:l.jsx(D8,{})})}),l.jsx(le,{"aria-label":e("common.githubLabel"),tooltip:e("common.githubLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx($i,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",children:l.jsx(j8,{})})}),l.jsx(le,{"aria-label":e("common.discordLabel"),tooltip:e("common.discordLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx($i,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",children:l.jsx(k8,{})})}),l.jsx(bF,{children:l.jsx(le,{"aria-label":e("common.settingsLabel"),tooltip:e("common.settingsLabel"),variant:"link","data-variant":"link",fontSize:22,size:"sm",icon:l.jsx(m9,{})})})]})]})};function EF(){async function e(n=""){return await fetch(n,{method:"GET",cache:"no-cache"})}const t=()=>{const n=document.location;e(n+"/flaskwebgui-keep-server-alive").then(i=>i)};(!{}.NODE_ENV||{}.NODE_ENV==="production")&&document.addEventListener("DOMContentLoaded",()=>{t(),setInterval(t,3e3)})}const PF=()=>{const e=Y(),t=O(l8),n=us();x.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(y3())},[e,n,t])},IF=()=>{const e=Y(),{shouldShowGalleryButton:t,shouldPinGallery:n}=O(yp),r=()=>{e(Fi(!0)),n&&e(on(!0))};return t?l.jsx(le,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":"Show Gallery",onClick:r,sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",zIndex:31,p:0,insetInlineEnd:0,px:3,h:48,w:8,borderStartEndRadius:0,borderEndEndRadius:0},children:l.jsx(cp,{})}):null};EF();const OF=()=>(PF(),l.jsxs($n,{w:"100vw",h:"100vh",children:[l.jsxs(iO,{children:[l.jsx(cO,{}),l.jsxs($n,{gap:4,p:O9,gridAutoRows:"min-content auto",w:A9,h:z9,children:[l.jsx(jF,{}),l.jsx(cD,{})]}),l.jsx(We,{children:l.jsx(sO,{})})]}),l.jsx(uI,{}),l.jsx(IF,{})]}));export{OF as default}; diff --git a/invokeai/frontend/web/dist/assets/App-5c94d6ff.js b/invokeai/frontend/web/dist/assets/App-5c94d6ff.js new file mode 100644 index 0000000000..9c61a45dc0 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/App-5c94d6ff.js @@ -0,0 +1,188 @@ +import{r as x,f as he,j as l,u as RS,c as re,a as Ae,b as Ie,w as is,d as fn,o as At,S as Qf,e as pi,g as Ye,h as Dr,k as Zi,i as yc,_ as Ql,l as NS,m as FS,R as ke,n as zv,p as LS,q as Kd,s as Ji,t as j1,v as E1,x as BS,y as HS,z as ee,A as P1,B as I1,C as bc,D as os,F as B,E as Y,T as Ce,G as WS,H as Hl,I as Zl,J as Qd,K as Zd,L as Jd,U as VS,M as M1,N as T1,O as US,P as _1,Q as D1,V as $S,W as O1,X as A1,Y as Bi,Z as jn,$ as z1,a0 as as,a1 as GS,a2 as qS,a3 as R1,a4 as on,a5 as YS,a6 as vl,a7 as Sc,a8 as XS,a9 as Rv,aa as Fi,ab as KS,ac as QS,ad as Da,ae as gl,af as ZS,ag as JS,ah as eC,ai as tC,aj as nC,ak as N1,al as F1,am as ef,an as tf,ao as L1,ap as nf,aq as rf,ar as Nv,as as B1,at as H1,au as W1,av as Wl,aw as Vl,ax as rC,ay as of,az as V1,aA as iC,aB as dd,aC as Fv,aD as U1,aE as $1,aF as af,aG as Hi,aH as oC,aI as aC,aJ as Lv,aK as Bv,aL as sC,aM as lC,aN as cC,aO as G1,aP as q1,aQ as uC,aR as dC,aS as Hv,aT as fC,aU as Wv,aV as hC,aW as pC,aX as mC,aY as vC,aZ as gC,a_ as xC,a$ as yC,b0 as bC,b1 as Vv,b2 as Ul,b3 as SC,b4 as CC,b5 as qa,b6 as Jl,b7 as Y1,b8 as ec,b9 as wC,ba as kC,bb as xr,bc as X1,bd as Zf,be as ss,bf as jC,bg as EC,bh as PC,bi as Sr,bj as K1,bk as IC,bl as MC,bm as Q1,bn as TC,bo as _C,bp as DC,bq as OC,br as AC,bs as zC,bt as RC,bu as NC,bv as FC,bw as Uv,bx as LC,by as BC,bz as HC,bA as WC,bB as VC,bC as UC,bD as fd,bE as Na,bF as xl,bG as $v,bH as hd,bI as pd,bJ as yl,bK as Gv,bL as sf,bM as $C,bN as GC,bO as qC,bP as YC,bQ as XC,bR as KC,bS as QC,bT as bl,bU as md,bV as Sl,bW as nr,bX as ZC,bY as JC,bZ as Z1,b_ as tc,b$ as Jf,c0 as J1,c1 as e2,c2 as t2,c3 as e3,c4 as n2,c5 as r2,c6 as i2,c7 as o2,c8 as a2,c9 as Wo,ca as Vo,cb as s2,cc as l2,cd as c2,ce as u2,cf as d2,cg as t3,ch as n3,ci as qv,cj as Cl,ck as r3,cl as Yv,cm as Xv,cn as Kv,co as Qv,cp as vd,cq as f2,cr as i3,cs as ls,ct as Zv,cu as o3,cv as a3,cw as s3,cx as Wi,cy as h2,cz as Jv,cA as l3,cB as c3,cC as u3,cD as d3,cE as f3,cF as h3,cG as p3,cH as m3,cI as v3,cJ as g3,cK as x3,cL as y3}from"./index-c5a5b67c.js";import{I as Jt,u as b3,c as S3,a as Et,b as Ut,A as ia,m as Wr,d as Uo,e as eo,P as eh,f as C3,C as w3,g as O,h as X,n as p2}from"./scrollbar-af26543e.js";function th(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s=0)&&(n[i]=e[i]);return n}var nc="NOT_FOUND";function k3(e){var t;return{get:function(r){return t&&e(t.key,r)?t.value:nc},put:function(r,i){t={key:r,value:i}},getEntries:function(){return t?[t]:[]},clear:function(){t=void 0}}}function j3(e,t){var n=[];function r(u){var f=n.findIndex(function(p){return t(u,p.key)});if(f>-1){var h=n[f];return f>0&&(n.splice(f,1),n.unshift(h)),h.value}return nc}function i(u,f){r(u)===nc&&(n.unshift({key:u,value:f}),n.length>e&&n.pop())}function s(){return n}function c(){n=[]}return{get:r,put:i,getEntries:s,clear:c}}var E3=function(t,n){return t===n};function P3(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,s=0;s1?t-1:0),r=1;rperformance.now():()=>Date.now(),v2=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(O3()),m2);function A3(e){let t=[],n=[],r=0,i=!1,s=!1;const c=new WeakSet,u={schedule:(f,h=!1,p=!1)=>{const g=p&&i,y=g?t:n;return h&&c.add(f),y.indexOf(f)===-1&&(y.push(f),g&&i&&(r=t.length)),f},cancel:f=>{const h=n.indexOf(f);h!==-1&&n.splice(h,1),c.delete(f)},process:f=>{if(i){s=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let h=0;h(e[t]=A3(()=>Ya=!0),e),{}),R3=cs.reduce((e,t)=>{const n=Cc[t];return e[t]=(r,i=!1,s=!1)=>(Ya||L3(),n.schedule(r,i,s)),e},{}),N3=cs.reduce((e,t)=>(e[t]=Cc[t].cancel,e),{});cs.reduce((e,t)=>(e[t]=()=>Cc[t].process($o),e),{});const F3=e=>Cc[e].process($o),g2=e=>{Ya=!1,$o.delta=lf?m2:Math.max(Math.min(e-$o.timestamp,z3),1),$o.timestamp=e,cf=!0,cs.forEach(F3),cf=!1,Ya&&(lf=!1,v2(g2))},L3=()=>{Ya=!0,lf=!0,cf||v2(g2)},eg=()=>$o;function nh(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:i={}}=e,s=x.Children.toArray(e.path),c=he((u,f)=>l.jsx(Jt,{ref:f,viewBox:t,...i,...u,children:s.length?s:l.jsx("path",{fill:"currentColor",d:n})}));return c.displayName=r,c}function us(e){const{theme:t}=RS(),n=b3();return x.useMemo(()=>S3(t.direction,{...n,...e}),[e,t.direction,n])}var B3=Object.defineProperty,H3=(e,t,n)=>t in e?B3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rt=(e,t,n)=>(H3(e,typeof t!="symbol"?t+"":t,n),n);function tg(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var W3=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function ng(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function rg(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var uf=typeof window<"u"?x.useLayoutEffect:x.useEffect,rc=e=>e,V3=class{constructor(){Rt(this,"descendants",new Map),Rt(this,"register",e=>{if(e!=null)return W3(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Rt(this,"unregister",e=>{this.descendants.delete(e);const t=tg(Array.from(this.descendants.keys()));this.assignIndex(t)}),Rt(this,"destroy",()=>{this.descendants.clear()}),Rt(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Rt(this,"count",()=>this.descendants.size),Rt(this,"enabledCount",()=>this.enabledValues().length),Rt(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Rt(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Rt(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Rt(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Rt(this,"first",()=>this.item(0)),Rt(this,"firstEnabled",()=>this.enabledItem(0)),Rt(this,"last",()=>this.item(this.descendants.size-1)),Rt(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Rt(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Rt(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Rt(this,"next",(e,t=!0)=>{const n=ng(e,this.count(),t);return this.item(n)}),Rt(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),i=ng(r,this.enabledCount(),t);return this.enabledItem(i)}),Rt(this,"prev",(e,t=!0)=>{const n=rg(e,this.count()-1,t);return this.item(n)}),Rt(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),i=rg(r,this.enabledCount()-1,t);return this.enabledItem(i)}),Rt(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=tg(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const i={node:e,index:-1,...t};this.descendants.set(e,i),this.assignIndex(r)})}};function U3(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function ct(...e){return t=>{e.forEach(n=>{U3(n,t)})}}function $3(...e){return x.useMemo(()=>ct(...e),e)}function G3(){const e=x.useRef(new V3);return uf(()=>()=>e.current.destroy()),e.current}var[q3,x2]=Et({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function Y3(e){const t=x2(),[n,r]=x.useState(-1),i=x.useRef(null);uf(()=>()=>{i.current&&t.unregister(i.current)},[]),uf(()=>{if(!i.current)return;const c=Number(i.current.dataset.index);n!=c&&!Number.isNaN(c)&&r(c)});const s=rc(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(i.current),register:ct(s,i)}}function rh(){return[rc(q3),()=>rc(x2()),()=>G3(),i=>Y3(i)]}var[X3,wc]=Et({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[K3,ih]=Et({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[Q3,_F,Z3,J3]=rh(),zo=he(function(t,n){const{getButtonProps:r}=ih(),i=r(t,n),c={display:"flex",alignItems:"center",width:"100%",outline:0,...wc().button};return l.jsx(re.button,{...i,className:Ae("chakra-accordion__button",t.className),__css:c})});zo.displayName="AccordionButton";function oh(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:i=(y,S)=>y!==S}=e,s=Ut(r),c=Ut(i),[u,f]=x.useState(n),h=t!==void 0,p=h?t:u,g=Ut(y=>{const C=typeof y=="function"?y(p):y;c(p,C)&&(h||f(C),s(C))},[h,s,p,c]);return[p,g]}function ew(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:i,allowToggle:s,...c}=e;rw(e),iw(e);const u=Z3(),[f,h]=x.useState(-1);x.useEffect(()=>()=>{h(-1)},[]);const[p,g]=oh({value:r,defaultValue(){return i?n??[]:n??-1},onChange:t});return{index:p,setIndex:g,htmlProps:c,getAccordionItemProps:S=>{let C=!1;return S!==null&&(C=Array.isArray(p)?p.includes(S):p===S),{isOpen:C,onChange:k=>{if(S!==null)if(i&&Array.isArray(p)){const j=k?p.concat(S):p.filter(M=>M!==S);g(j)}else k?g(S):s&&g(-1)}}},focusedIndex:f,setFocusedIndex:h,descendants:u}}var[tw,ah]=Et({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function nw(e){const{isDisabled:t,isFocusable:n,id:r,...i}=e,{getAccordionItemProps:s,setFocusedIndex:c}=ah(),u=x.useRef(null),f=x.useId(),h=r??f,p=`accordion-button-${h}`,g=`accordion-panel-${h}`;ow(e);const{register:y,index:S,descendants:C}=J3({disabled:t&&!n}),{isOpen:w,onChange:k}=s(S===-1?null:S);aw({isOpen:w,isDisabled:t});const j=()=>{k==null||k(!0)},M=()=>{k==null||k(!1)},P=x.useCallback(()=>{k==null||k(!w),c(S)},[S,c,w,k]),I=x.useCallback(z=>{const F={ArrowDown:()=>{const L=C.nextEnabled(S);L==null||L.node.focus()},ArrowUp:()=>{const L=C.prevEnabled(S);L==null||L.node.focus()},Home:()=>{const L=C.firstEnabled();L==null||L.node.focus()},End:()=>{const L=C.lastEnabled();L==null||L.node.focus()}}[z.key];F&&(z.preventDefault(),F(z))},[C,S]),T=x.useCallback(()=>{c(S)},[c,S]),D=x.useCallback(function(V={},F=null){return{...V,type:"button",ref:ct(y,u,F),id:p,disabled:!!t,"aria-expanded":!!w,"aria-controls":g,onClick:Ie(V.onClick,P),onFocus:Ie(V.onFocus,T),onKeyDown:Ie(V.onKeyDown,I)}},[p,t,w,P,T,I,g,y]),_=x.useCallback(function(V={},F=null){return{...V,ref:F,role:"region",id:g,"aria-labelledby":p,hidden:!w}},[p,w,g]);return{isOpen:w,isDisabled:t,isFocusable:n,onOpen:j,onClose:M,getButtonProps:D,getPanelProps:_,htmlProps:i}}function rw(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;is({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function iw(e){is({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function ow(e){is({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. + `})}function aw(e){is({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Ro(e){const{isOpen:t,isDisabled:n}=ih(),{reduceMotion:r}=ah(),i=Ae("chakra-accordion__icon",e.className),s=wc(),c={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return l.jsx(Jt,{viewBox:"0 0 24 24","aria-hidden":!0,className:i,__css:c,...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Ro.displayName="AccordionIcon";var No=he(function(t,n){const{children:r,className:i}=t,{htmlProps:s,...c}=nw(t),f={...wc().container,overflowAnchor:"none"},h=x.useMemo(()=>c,[c]);return l.jsx(K3,{value:h,children:l.jsx(re.div,{ref:n,...s,className:Ae("chakra-accordion__item",i),__css:f,children:typeof r=="function"?r({isExpanded:!!c.isOpen,isDisabled:!!c.isDisabled}):r})})});No.displayName="AccordionItem";var Fo={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Vi={enter:{duration:.2,ease:Fo.easeOut},exit:{duration:.1,ease:Fo.easeIn}},Or={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},sw=e=>e!=null&&parseInt(e.toString(),10)>0,ig={exit:{height:{duration:.2,ease:Fo.ease},opacity:{duration:.3,ease:Fo.ease}},enter:{height:{duration:.3,ease:Fo.ease},opacity:{duration:.4,ease:Fo.ease}}},lw={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{...e&&{opacity:sw(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:Or.exit(ig.exit,i)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:Or.enter(ig.enter,i)}}},y2=x.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:i=!0,startingHeight:s=0,endingHeight:c="auto",style:u,className:f,transition:h,transitionEnd:p,...g}=e,[y,S]=x.useState(!1);x.useEffect(()=>{const M=setTimeout(()=>{S(!0)});return()=>clearTimeout(M)},[]),is({condition:Boolean(s>0&&r),message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const C=parseFloat(s.toString())>0,w={startingHeight:s,endingHeight:c,animateOpacity:i,transition:y?h:{enter:{duration:0}},transitionEnd:{enter:p==null?void 0:p.enter,exit:r?p==null?void 0:p.exit:{...p==null?void 0:p.exit,display:C?"block":"none"}}},k=r?n:!0,j=n||r?"enter":"exit";return l.jsx(ia,{initial:!1,custom:w,children:k&&l.jsx(Wr.div,{ref:t,...g,className:Ae("chakra-collapse",f),style:{overflow:"hidden",display:"block",...u},custom:w,variants:lw,initial:r?"exit":!1,animate:j,exit:"exit"})})});y2.displayName="Collapse";var cw={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:Or.enter(Vi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:Or.exit(Vi.exit,n),transitionEnd:t==null?void 0:t.exit}}},b2={initial:"exit",animate:"enter",exit:"exit",variants:cw},uw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:i,className:s,transition:c,transitionEnd:u,delay:f,...h}=t,p=i||r?"enter":"exit",g=r?i&&r:!0,y={transition:c,transitionEnd:u,delay:f};return l.jsx(ia,{custom:y,children:g&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-fade",s),custom:y,...b2,animate:p,...h})})});uw.displayName="Fade";var dw={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:Or.exit(Vi.exit,i)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:Or.enter(Vi.enter,n),transitionEnd:e==null?void 0:e.enter}}},S2={initial:"exit",animate:"enter",exit:"exit",variants:dw},fw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:i,reverse:s=!0,initialScale:c=.95,className:u,transition:f,transitionEnd:h,delay:p,...g}=t,y=r?i&&r:!0,S=i||r?"enter":"exit",C={initialScale:c,reverse:s,transition:f,transitionEnd:h,delay:p};return l.jsx(ia,{custom:C,children:y&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-offset-slide",u),...S2,animate:S,custom:C,...g})})});fw.displayName="ScaleFade";var hw={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:i})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:Or.exit(Vi.exit,i),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:Or.enter(Vi.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:i,delay:s})=>{var c;const u={x:t,y:e};return{opacity:0,transition:(c=n==null?void 0:n.exit)!=null?c:Or.exit(Vi.exit,s),...i?{...u,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...u,...r==null?void 0:r.exit}}}}},df={initial:"initial",animate:"enter",exit:"exit",variants:hw},pw=x.forwardRef(function(t,n){const{unmountOnExit:r,in:i,reverse:s=!0,className:c,offsetX:u=0,offsetY:f=8,transition:h,transitionEnd:p,delay:g,...y}=t,S=r?i&&r:!0,C=i||r?"enter":"exit",w={offsetX:u,offsetY:f,reverse:s,transition:h,transitionEnd:p,delay:g};return l.jsx(ia,{custom:w,children:S&&l.jsx(Wr.div,{ref:n,className:Ae("chakra-offset-slide",c),custom:w,...df,animate:C,...y})})});pw.displayName="SlideFade";var Lo=he(function(t,n){const{className:r,motionProps:i,...s}=t,{reduceMotion:c}=ah(),{getPanelProps:u,isOpen:f}=ih(),h=u(s,n),p=Ae("chakra-accordion__panel",r),g=wc();c||delete h.hidden;const y=l.jsx(re.div,{...h,__css:g.panel,className:p});return c?y:l.jsx(y2,{in:f,...i,children:y})});Lo.displayName="AccordionPanel";var sh=he(function({children:t,reduceMotion:n,...r},i){const s=fn("Accordion",r),c=At(r),{htmlProps:u,descendants:f,...h}=ew(c),p=x.useMemo(()=>({...h,reduceMotion:!!n}),[h,n]);return l.jsx(Q3,{value:f,children:l.jsx(tw,{value:p,children:l.jsx(X3,{value:s,children:l.jsx(re.div,{ref:i,...u,className:Ae("chakra-accordion",r.className),__css:s.root,children:t})})})})});sh.displayName="Accordion";var ff=he(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:s,...c}=t;return l.jsx("img",{width:r,height:i,ref:n,alt:s,...c})});ff.displayName="NativeImage";function mw(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:s,crossOrigin:c,sizes:u,ignoreFallback:f}=e,[h,p]=x.useState("pending");x.useEffect(()=>{p(n?"loading":"pending")},[n]);const g=x.useRef(),y=x.useCallback(()=>{if(!n)return;S();const C=new Image;C.src=n,c&&(C.crossOrigin=c),r&&(C.srcset=r),u&&(C.sizes=u),t&&(C.loading=t),C.onload=w=>{S(),p("loaded"),i==null||i(w)},C.onerror=w=>{S(),p("failed"),s==null||s(w)},g.current=C},[n,c,r,u,i,s,t]),S=()=>{g.current&&(g.current.onload=null,g.current.onerror=null,g.current=null)};return Uo(()=>{if(!f)return h==="loading"&&y(),()=>{S()}},[h,y,f]),f?"loaded":h}var vw=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function gw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var ds=he(function(t,n){const{fallbackSrc:r,fallback:i,src:s,srcSet:c,align:u,fit:f,loading:h,ignoreFallback:p,crossOrigin:g,fallbackStrategy:y="beforeLoadOrError",referrerPolicy:S,...C}=t,w=r!==void 0||i!==void 0,k=h!=null||p||!w,j=mw({...t,ignoreFallback:k}),M=vw(j,y),P={ref:n,objectFit:f,objectPosition:u,...k?C:gw(C,["onError","onLoad"])};return M?i||l.jsx(re.img,{as:ff,className:"chakra-image__placeholder",src:r,...P}):l.jsx(re.img,{as:ff,src:s,srcSet:c,crossOrigin:g,loading:h,referrerPolicy:S,className:"chakra-image",...P})});ds.displayName="Image";function lh(e){return x.Children.toArray(e).filter(t=>x.isValidElement(t))}var[xw,yw]=Et({strict:!1,name:"ButtonGroupContext"}),bw={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},Sw={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},en=he(function(t,n){const{size:r,colorScheme:i,variant:s,className:c,spacing:u="0.5rem",isAttached:f,isDisabled:h,orientation:p="horizontal",...g}=t,y=Ae("chakra-button__group",c),S=x.useMemo(()=>({size:r,colorScheme:i,variant:s,isDisabled:h}),[r,i,s,h]);let C={display:"inline-flex",...f?bw[p]:Sw[p](u)};const w=p==="vertical";return l.jsx(xw,{value:S,children:l.jsx(re.div,{ref:n,role:"group",__css:C,className:y,"data-attached":f?"":void 0,"data-orientation":p,flexDir:w?"column":void 0,...g})})});en.displayName="ButtonGroup";function Cw(e){const[t,n]=x.useState(!e);return{ref:x.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function hf(e){const{children:t,className:n,...r}=e,i=x.isValidElement(t)?x.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=Ae("chakra-button__icon",n);return l.jsx(re.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:i})}hf.displayName="ButtonIcon";function ic(e){const{label:t,placement:n,spacing:r="0.5rem",children:i=l.jsx(Qf,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:c,...u}=e,f=Ae("chakra-button__spinner",s),h=n==="start"?"marginEnd":"marginStart",p=x.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[h]:t?r:0,fontSize:"1em",lineHeight:"normal",...c}),[c,t,h,r]);return l.jsx(re.div,{className:f,...u,__css:p,children:i})}ic.displayName="ButtonSpinner";var to=he((e,t)=>{const n=yw(),r=pi("Button",{...n,...e}),{isDisabled:i=n==null?void 0:n.isDisabled,isLoading:s,isActive:c,children:u,leftIcon:f,rightIcon:h,loadingText:p,iconSpacing:g="0.5rem",type:y,spinner:S,spinnerPlacement:C="start",className:w,as:k,...j}=At(e),M=x.useMemo(()=>{const D={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:D}}},[r,n]),{ref:P,type:I}=Cw(k),T={rightIcon:h,leftIcon:f,iconSpacing:g,children:u};return l.jsxs(re.button,{ref:$3(t,P),as:k,type:y??I,"data-active":Ye(c),"data-loading":Ye(s),__css:M,className:Ae("chakra-button",w),...j,disabled:i||s,children:[s&&C==="start"&&l.jsx(ic,{className:"chakra-button__spinner--start",label:p,placement:"start",spacing:g,children:S}),s?p||l.jsx(re.span,{opacity:0,children:l.jsx(og,{...T})}):l.jsx(og,{...T}),s&&C==="end"&&l.jsx(ic,{className:"chakra-button__spinner--end",label:p,placement:"end",spacing:g,children:S})]})});to.displayName="Button";function og(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:i}=e;return l.jsxs(l.Fragment,{children:[t&&l.jsx(hf,{marginEnd:i,children:t}),r,n&&l.jsx(hf,{marginStart:i,children:n})]})}var ci=he((e,t)=>{const{icon:n,children:r,isRound:i,"aria-label":s,...c}=e,u=n||r,f=x.isValidElement(u)?x.cloneElement(u,{"aria-hidden":!0,focusable:!1}):null;return l.jsx(to,{padding:"0",borderRadius:i?"full":void 0,ref:t,"aria-label":s,...c,children:f})});ci.displayName="IconButton";var[DF,ww]=Et({name:"CheckboxGroupContext",strict:!1});function kw(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:l.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function jw(e){return l.jsx(re.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:l.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function Ew(e){const{isIndeterminate:t,isChecked:n,...r}=e,i=t?jw:kw;return n||t?l.jsx(re.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:l.jsx(i,{...r})}):null}var[Pw,C2]=Et({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Iw,no]=Et({strict:!1,name:"FormControlContext"});function Mw(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:i,isReadOnly:s,...c}=e,u=x.useId(),f=t||`field-${u}`,h=`${f}-label`,p=`${f}-feedback`,g=`${f}-helptext`,[y,S]=x.useState(!1),[C,w]=x.useState(!1),[k,j]=x.useState(!1),M=x.useCallback((_={},z=null)=>({id:g,..._,ref:ct(z,V=>{V&&w(!0)})}),[g]),P=x.useCallback((_={},z=null)=>{var V,F;return{..._,ref:z,"data-focus":Ye(k),"data-disabled":Ye(i),"data-invalid":Ye(r),"data-readonly":Ye(s),id:(V=_.id)!=null?V:h,htmlFor:(F=_.htmlFor)!=null?F:f}},[f,i,k,r,s,h]),I=x.useCallback((_={},z=null)=>({id:p,..._,ref:ct(z,V=>{V&&S(!0)}),"aria-live":"polite"}),[p]),T=x.useCallback((_={},z=null)=>({..._,...c,ref:z,role:"group"}),[c]),D=x.useCallback((_={},z=null)=>({..._,ref:z,role:"presentation","aria-hidden":!0,children:_.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!i,isFocused:!!k,onFocus:()=>j(!0),onBlur:()=>j(!1),hasFeedbackText:y,setHasFeedbackText:S,hasHelpText:C,setHasHelpText:w,id:f,labelId:h,feedbackId:p,helpTextId:g,htmlProps:c,getHelpTextProps:M,getErrorMessageProps:I,getRootProps:T,getLabelProps:P,getRequiredIndicatorProps:D}}var rt=he(function(t,n){const r=fn("Form",t),i=At(t),{getRootProps:s,htmlProps:c,...u}=Mw(i),f=Ae("chakra-form-control",t.className);return l.jsx(Iw,{value:u,children:l.jsx(Pw,{value:r,children:l.jsx(re.div,{...s({},n),className:f,__css:r.container})})})});rt.displayName="FormControl";var wt=he(function(t,n){const r=no(),i=C2(),s=Ae("chakra-form__helper-text",t.className);return l.jsx(re.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:i.helperText,className:s})});wt.displayName="FormHelperText";var[Tw,_w]=Et({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),kt=he((e,t)=>{const n=fn("FormError",e),r=At(e),i=no();return i!=null&&i.isInvalid?l.jsx(Tw,{value:n,children:l.jsx(re.div,{...i==null?void 0:i.getErrorMessageProps(r,t),className:Ae("chakra-form__error-message",e.className),__css:{display:"flex",alignItems:"center",...n.text}})}):null});kt.displayName="FormErrorMessage";var Dw=he((e,t)=>{const n=_w(),r=no();if(!(r!=null&&r.isInvalid))return null;const i=Ae("chakra-form__error-icon",e.className);return l.jsx(Jt,{ref:t,"aria-hidden":!0,...e,__css:n.icon,className:i,children:l.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})});Dw.displayName="FormErrorIcon";var st=he(function(t,n){var r;const i=pi("FormLabel",t),s=At(t),{className:c,children:u,requiredIndicator:f=l.jsx(w2,{}),optionalIndicator:h=null,...p}=s,g=no(),y=(r=g==null?void 0:g.getLabelProps(p,n))!=null?r:{ref:n,...p};return l.jsxs(re.label,{...y,className:Ae("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...i},children:[u,g!=null&&g.isRequired?f:h]})});st.displayName="FormLabel";var w2=he(function(t,n){const r=no(),i=C2();if(!(r!=null&&r.isRequired))return null;const s=Ae("chakra-form__required-indicator",t.className);return l.jsx(re.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:i.requiredIndicator,className:s})});w2.displayName="RequiredIndicator";function ch(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:i,...s}=uh(e);return{...s,disabled:t,readOnly:r,required:i,"aria-invalid":Dr(n),"aria-required":Dr(i),"aria-readonly":Dr(r)}}function uh(e){var t,n,r;const i=no(),{id:s,disabled:c,readOnly:u,required:f,isRequired:h,isInvalid:p,isReadOnly:g,isDisabled:y,onFocus:S,onBlur:C,...w}=e,k=e["aria-describedby"]?[e["aria-describedby"]]:[];return i!=null&&i.hasFeedbackText&&(i!=null&&i.isInvalid)&&k.push(i.feedbackId),i!=null&&i.hasHelpText&&k.push(i.helpTextId),{...w,"aria-describedby":k.join(" ")||void 0,id:s??(i==null?void 0:i.id),isDisabled:(t=c??y)!=null?t:i==null?void 0:i.isDisabled,isReadOnly:(n=u??g)!=null?n:i==null?void 0:i.isReadOnly,isRequired:(r=f??h)!=null?r:i==null?void 0:i.isRequired,isInvalid:p??(i==null?void 0:i.isInvalid),onFocus:Ie(i==null?void 0:i.onFocus,S),onBlur:Ie(i==null?void 0:i.onBlur,C)}}var dh={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},k2=re("span",{baseStyle:dh});k2.displayName="VisuallyHidden";var Ow=re("input",{baseStyle:dh});Ow.displayName="VisuallyHiddenInput";var ag=!1,fs=null,Yi=!1,pf=!1,mf=new Set;function fh(e,t){mf.forEach(n=>n(e,t))}var Aw=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function zw(e){return!(e.metaKey||!Aw&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function sg(e){Yi=!0,zw(e)&&(fs="keyboard",fh("keyboard",e))}function jo(e){if(fs="pointer",e.type==="mousedown"||e.type==="pointerdown"){Yi=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;fh("pointer",e)}}function Rw(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function Nw(e){Rw(e)&&(Yi=!0,fs="virtual")}function Fw(e){e.target===window||e.target===document||(!Yi&&!pf&&(fs="virtual",fh("virtual",e)),Yi=!1,pf=!1)}function Lw(){Yi=!1,pf=!0}function lg(){return fs!=="pointer"}function Bw(){if(typeof window>"u"||ag)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Yi=!0,e.apply(this,n)},document.addEventListener("keydown",sg,!0),document.addEventListener("keyup",sg,!0),document.addEventListener("click",Nw,!0),window.addEventListener("focus",Fw,!0),window.addEventListener("blur",Lw,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",jo,!0),document.addEventListener("pointermove",jo,!0),document.addEventListener("pointerup",jo,!0)):(document.addEventListener("mousedown",jo,!0),document.addEventListener("mousemove",jo,!0),document.addEventListener("mouseup",jo,!0)),ag=!0}function j2(e){Bw(),e(lg());const t=()=>e(lg());return mf.add(t),()=>{mf.delete(t)}}function Hw(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function E2(e={}){const t=uh(e),{isDisabled:n,isReadOnly:r,isRequired:i,isInvalid:s,id:c,onBlur:u,onFocus:f,"aria-describedby":h}=t,{defaultChecked:p,isChecked:g,isFocusable:y,onChange:S,isIndeterminate:C,name:w,value:k,tabIndex:j=void 0,"aria-label":M,"aria-labelledby":P,"aria-invalid":I,...T}=e,D=Hw(T,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),_=Ut(S),z=Ut(u),V=Ut(f),[F,L]=x.useState(!1),[Q,$]=x.useState(!1),[Z,te]=x.useState(!1),[ie,U]=x.useState(!1);x.useEffect(()=>j2(L),[]);const K=x.useRef(null),[ne,ce]=x.useState(!0),[Re,ze]=x.useState(!!p),Me=g!==void 0,oe=Me?g:Re,ae=x.useCallback(ge=>{if(r||n){ge.preventDefault();return}Me||ze(oe?ge.target.checked:C?!0:ge.target.checked),_==null||_(ge)},[r,n,oe,Me,C,_]);Uo(()=>{K.current&&(K.current.indeterminate=Boolean(C))},[C]),eo(()=>{n&&$(!1)},[n,$]),Uo(()=>{const ge=K.current;ge!=null&&ge.form&&(ge.form.onreset=()=>{ze(!!p)})},[]);const je=n&&!y,Be=x.useCallback(ge=>{ge.key===" "&&U(!0)},[U]),Ne=x.useCallback(ge=>{ge.key===" "&&U(!1)},[U]);Uo(()=>{if(!K.current)return;K.current.checked!==oe&&ze(K.current.checked)},[K.current]);const Ge=x.useCallback((ge={},Te=null)=>{const et=Ve=>{Q&&Ve.preventDefault(),U(!0)};return{...ge,ref:Te,"data-active":Ye(ie),"data-hover":Ye(Z),"data-checked":Ye(oe),"data-focus":Ye(Q),"data-focus-visible":Ye(Q&&F),"data-indeterminate":Ye(C),"data-disabled":Ye(n),"data-invalid":Ye(s),"data-readonly":Ye(r),"aria-hidden":!0,onMouseDown:Ie(ge.onMouseDown,et),onMouseUp:Ie(ge.onMouseUp,()=>U(!1)),onMouseEnter:Ie(ge.onMouseEnter,()=>te(!0)),onMouseLeave:Ie(ge.onMouseLeave,()=>te(!1))}},[ie,oe,n,Q,F,Z,C,s,r]),Qe=x.useCallback((ge={},Te=null)=>({...D,...ge,ref:ct(Te,et=>{et&&ce(et.tagName==="LABEL")}),onClick:Ie(ge.onClick,()=>{var et;ne||((et=K.current)==null||et.click(),requestAnimationFrame(()=>{var Ve;(Ve=K.current)==null||Ve.focus()}))}),"data-disabled":Ye(n),"data-checked":Ye(oe),"data-invalid":Ye(s)}),[D,n,oe,s,ne]),ve=x.useCallback((ge={},Te=null)=>({...ge,ref:ct(K,Te),type:"checkbox",name:w,value:k,id:c,tabIndex:j,onChange:Ie(ge.onChange,ae),onBlur:Ie(ge.onBlur,z,()=>$(!1)),onFocus:Ie(ge.onFocus,V,()=>$(!0)),onKeyDown:Ie(ge.onKeyDown,Be),onKeyUp:Ie(ge.onKeyUp,Ne),required:i,checked:oe,disabled:je,readOnly:r,"aria-label":M,"aria-labelledby":P,"aria-invalid":I?Boolean(I):s,"aria-describedby":h,"aria-disabled":n,style:dh}),[w,k,c,ae,z,V,Be,Ne,i,oe,je,r,M,P,I,s,h,n,j]),_e=x.useCallback((ge={},Te=null)=>({...ge,ref:Te,onMouseDown:Ie(ge.onMouseDown,cg),onTouchStart:Ie(ge.onTouchStart,cg),"data-disabled":Ye(n),"data-checked":Ye(oe),"data-invalid":Ye(s)}),[oe,n,s]);return{state:{isInvalid:s,isFocused:Q,isChecked:oe,isActive:ie,isHovered:Z,isIndeterminate:C,isDisabled:n,isReadOnly:r,isRequired:i},getRootProps:Qe,getCheckboxProps:Ge,getInputProps:ve,getLabelProps:_e,htmlProps:D}}function cg(e){e.preventDefault(),e.stopPropagation()}var Ww={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},Vw={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},Uw=Zi({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),$w=Zi({from:{opacity:0},to:{opacity:1}}),Gw=Zi({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),P2=he(function(t,n){const r=ww(),i={...r,...t},s=fn("Checkbox",i),c=At(t),{spacing:u="0.5rem",className:f,children:h,iconColor:p,iconSize:g,icon:y=l.jsx(Ew,{}),isChecked:S,isDisabled:C=r==null?void 0:r.isDisabled,onChange:w,inputProps:k,...j}=c;let M=S;r!=null&&r.value&&c.value&&(M=r.value.includes(c.value));let P=w;r!=null&&r.onChange&&c.value&&(P=yc(r.onChange,w));const{state:I,getInputProps:T,getCheckboxProps:D,getLabelProps:_,getRootProps:z}=E2({...j,isDisabled:C,isChecked:M,onChange:P}),V=x.useMemo(()=>({animation:I.isIndeterminate?`${$w} 20ms linear, ${Gw} 200ms linear`:`${Uw} 200ms linear`,fontSize:g,color:p,...s.icon}),[p,g,,I.isIndeterminate,s.icon]),F=x.cloneElement(y,{__css:V,isIndeterminate:I.isIndeterminate,isChecked:I.isChecked});return l.jsxs(re.label,{__css:{...Vw,...s.container},className:Ae("chakra-checkbox",f),...z(),children:[l.jsx("input",{className:"chakra-checkbox__input",...T(k,n)}),l.jsx(re.span,{__css:{...Ww,...s.control},className:"chakra-checkbox__control",...D(),children:F}),h&&l.jsx(re.span,{className:"chakra-checkbox__label",..._(),__css:{marginStart:u,...s.label},children:h})]})});P2.displayName="Checkbox";function qw(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function hh(e,t){let n=qw(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function vf(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function ug(e,t,n){return(e-t)*100/(n-t)}function Yw(e,t,n){return(n-t)*e+t}function dg(e,t,n){const r=Math.round((e-t)/n)*n+t,i=vf(n);return hh(r,i)}function $l(e,t,n){return e==null?e:(n{var F;return r==null?"":(F=gd(r,s,n))!=null?F:""}),y=typeof i<"u",S=y?i:p,C=I2(ni(S),s),w=n??C,k=x.useCallback(F=>{F!==S&&(y||g(F.toString()),h==null||h(F.toString(),ni(F)))},[h,y,S]),j=x.useCallback(F=>{let L=F;return f&&(L=$l(L,c,u)),hh(L,w)},[w,f,u,c]),M=x.useCallback((F=s)=>{let L;S===""?L=ni(F):L=ni(S)+F,L=j(L),k(L)},[j,s,k,S]),P=x.useCallback((F=s)=>{let L;S===""?L=ni(-F):L=ni(S)-F,L=j(L),k(L)},[j,s,k,S]),I=x.useCallback(()=>{var F;let L;r==null?L="":L=(F=gd(r,s,n))!=null?F:c,k(L)},[r,n,s,k,c]),T=x.useCallback(F=>{var L;const Q=(L=gd(F,s,w))!=null?L:c;k(Q)},[w,s,k,c]),D=ni(S);return{isOutOfRange:D>u||D{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,i,r),()=>{s.removeEventListener(t,i,r)}},[t,e,r,i,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,i,r)}}function Kw(e){return"current"in e}var M2=()=>typeof window<"u";function Qw(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var Zw=e=>M2()&&e.test(navigator.vendor),Jw=e=>M2()&&e.test(Qw()),e5=()=>Jw(/mac|iphone|ipad|ipod/i),t5=()=>e5()&&Zw(/apple/i);function n5(e){const{ref:t,elements:n,enabled:r}=e,i=()=>{var s,c;return(c=(s=t.current)==null?void 0:s.ownerDocument)!=null?c:document};Ui(i,"pointerdown",s=>{if(!t5()||!r)return;const c=s.target,f=(n??[t]).some(h=>{const p=Kw(h)?h.current:h;return(p==null?void 0:p.contains(c))||p===c});i().activeElement!==c&&f&&(s.preventDefault(),c.focus())})}var lt={},r5={get exports(){return lt},set exports(e){lt=e}},i5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",o5=i5,a5=o5;function T2(){}function _2(){}_2.resetWarningCache=T2;var s5=function(){function e(r,i,s,c,u,f){if(f!==a5){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:_2,resetWarningCache:T2};return n.PropTypes=n,n};r5.exports=s5();var gf="data-focus-lock",D2="data-focus-lock-disabled",l5="data-no-focus-lock",c5="data-autofocus-inside",u5="data-no-autofocus";function d5(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function f5(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}function O2(e,t){return f5(t||null,function(n){return e.forEach(function(r){return d5(r,n)})})}var xd={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},vr=function(){return vr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r0&&s[s.length-1])&&(h[0]===6||h[0]===2)){n=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]0)&&!(i=r.next()).done;)s.push(i.value)}catch(u){c={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(c)throw c.error}}return s}function xf(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r=0}).sort(j5)},E5=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],xh=E5.join(","),P5="".concat(xh,", [data-focus-guard]"),Q2=function(e,t){return wr((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?P5:xh)?[r]:[],Q2(r))},[])},I5=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?kc([e.contentDocument.body],t):[e]},kc=function(e,t){return e.reduce(function(n,r){var i,s=Q2(r,t),c=(i=[]).concat.apply(i,s.map(function(u){return I5(u,t)}));return n.concat(c,r.parentNode?wr(r.parentNode.querySelectorAll(xh)).filter(function(u){return u===r}):[])},[])},M5=function(e){var t=e.querySelectorAll("[".concat(c5,"]"));return wr(t).map(function(n){return kc([n])}).reduce(function(n,r){return n.concat(r)},[])},yh=function(e,t){return wr(e).filter(function(n){return $2(t,n)}).filter(function(n){return C5(n)})},hg=function(e,t){return t===void 0&&(t=new Map),wr(e).filter(function(n){return G2(t,n)})},yf=function(e,t,n){return K2(yh(kc(e,n),t),!0,n)},pg=function(e,t){return K2(yh(kc(e),t),!1)},T5=function(e,t){return yh(M5(e),t)},Go=function(e,t){return e.shadowRoot?Go(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:wr(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var i=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return i?Go(i,t):!1}return Go(n,t)})},_5=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(i),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(c,u){return!t.has(u)})},Z2=function(e){return e.parentNode?Z2(e.parentNode):e},bh=function(e){var t=oc(e);return t.filter(Boolean).reduce(function(n,r){var i=r.getAttribute(gf);return n.push.apply(n,i?_5(wr(Z2(r).querySelectorAll("[".concat(gf,'="').concat(i,'"]:not([').concat(D2,'="disabled"])')))):[r]),n},[])},D5=function(e){try{return e()}catch{return}},Xa=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Xa(t.shadowRoot):t instanceof HTMLIFrameElement&&D5(function(){return t.contentWindow.document})?Xa(t.contentWindow.document):t}},O5=function(e,t){return e===t},A5=function(e,t){return Boolean(wr(e.querySelectorAll("iframe")).some(function(n){return O5(n,t)}))},J2=function(e,t){return t===void 0&&(t=Xa(W2(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:bh(e).some(function(n){return Go(n,t)||A5(n,t)})},z5=function(e){e===void 0&&(e=document);var t=Xa(e);return t?wr(e.querySelectorAll("[".concat(l5,"]"))).some(function(n){return Go(n,t)}):!1},R5=function(e,t){return t.filter(X2).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},Sh=function(e,t){return X2(e)&&e.name?R5(e,t):e},N5=function(e){var t=new Set;return e.forEach(function(n){return t.add(Sh(n,e))}),e.filter(function(n){return t.has(n)})},mg=function(e){return e[0]&&e.length>1?Sh(e[0],e):e[0]},vg=function(e,t){return e.length>1?e.indexOf(Sh(e[t],e)):t},ex="NEW_FOCUS",F5=function(e,t,n,r){var i=e.length,s=e[0],c=e[i-1],u=gh(n);if(!(n&&e.indexOf(n)>=0)){var f=n!==void 0?t.indexOf(n):-1,h=r?t.indexOf(r):f,p=r?e.indexOf(r):-1,g=f-h,y=t.indexOf(s),S=t.indexOf(c),C=N5(t),w=n!==void 0?C.indexOf(n):-1,k=w-(r?C.indexOf(r):f),j=vg(e,0),M=vg(e,i-1);if(f===-1||p===-1)return ex;if(!g&&p>=0)return p;if(f<=y&&u&&Math.abs(g)>1)return M;if(f>=S&&u&&Math.abs(g)>1)return j;if(g&&Math.abs(k)>1)return p;if(f<=y)return M;if(f>S)return j;if(g)return Math.abs(g)>1?p:(i+p+g)%i}},L5=function(e){return function(t){var n,r=(n=q2(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},B5=function(e,t,n){var r=e.map(function(s){var c=s.node;return c}),i=hg(r.filter(L5(n)));return i&&i.length?mg(i):mg(hg(t))},bf=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&bf(e.parentNode.host||e.parentNode,t),t},yd=function(e,t){for(var n=bf(e),r=bf(t),i=0;i=0)return s}return!1},tx=function(e,t,n){var r=oc(e),i=oc(t),s=r[0],c=!1;return i.filter(Boolean).forEach(function(u){c=yd(c||u,u)||c,n.filter(Boolean).forEach(function(f){var h=yd(s,f);h&&(!c||Go(h,c)?c=h:c=yd(h,c))})}),c},H5=function(e,t){return e.reduce(function(n,r){return n.concat(T5(r,t))},[])},W5=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter(k5)},V5=function(e,t){var n=Xa(oc(e).length>0?document:W2(e).ownerDocument),r=bh(e).filter(ac),i=tx(n||e,e,r),s=new Map,c=pg(r,s),u=yf(r,s).filter(function(S){var C=S.node;return ac(C)});if(!(!u[0]&&(u=c,!u[0]))){var f=pg([i],s).map(function(S){var C=S.node;return C}),h=W5(f,u),p=h.map(function(S){var C=S.node;return C}),g=F5(p,f,n,t);if(g===ex){var y=B5(c,p,H5(r,s));if(y)return{node:y};console.warn("focus-lock: cannot find any node to move focus into");return}return g===void 0?g:h[g]}},U5=function(e){var t=bh(e).filter(ac),n=tx(e,e,t),r=new Map,i=yf([n],r,!0),s=yf(t,r).filter(function(c){var u=c.node;return ac(u)}).map(function(c){var u=c.node;return u});return i.map(function(c){var u=c.node,f=c.index;return{node:u,index:f,lockItem:s.indexOf(u)>=0,guard:gh(u)}})},$5=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},bd=0,Sd=!1,nx=function(e,t,n){n===void 0&&(n={});var r=V5(e,t);if(!Sd&&r){if(bd>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Sd=!0,setTimeout(function(){Sd=!1},1);return}bd++,$5(r.node,n.focusOptions),bd--}};function rx(e){var t=window,n=t.setImmediate;typeof n<"u"?n(e):setTimeout(e,1)}var G5=function(){return document&&document.activeElement===document.body},q5=function(){return G5()||z5()},qo=null,Bo=null,Yo=null,Ka=!1,Y5=function(){return!0},X5=function(t){return(qo.whiteList||Y5)(t)},K5=function(t,n){Yo={observerNode:t,portaledElement:n}},Q5=function(t){return Yo&&Yo.portaledElement===t};function gg(e,t,n,r){var i=null,s=e;do{var c=r[s];if(c.guard)c.node.dataset.focusAutoGuard&&(i=c);else if(c.lockItem){if(s!==e)return;i=null}else break}while((s+=n)!==t);i&&(i.node.tabIndex=0)}var Z5=function(t){return t&&"current"in t?t.current:t},J5=function(t){return t?Boolean(Ka):Ka==="meanwhile"},e6=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},t6=function(t,n){return n.some(function(r){return e6(t,r,r)})},sc=function(){var t=!1;if(qo){var n=qo,r=n.observed,i=n.persistentFocus,s=n.autoFocus,c=n.shards,u=n.crossFrame,f=n.focusOptions,h=r||Yo&&Yo.portaledElement,p=document&&document.activeElement;if(h){var g=[h].concat(c.map(Z5).filter(Boolean));if((!p||X5(p))&&(i||J5(u)||!q5()||!Bo&&s)&&(h&&!(J2(g)||p&&t6(p,g)||Q5(p))&&(document&&!Bo&&p&&!s?(p.blur&&p.blur(),document.body.focus()):(t=nx(g,Bo,{focusOptions:f}),Yo={})),Ka=!1,Bo=document&&document.activeElement),document){var y=document&&document.activeElement,S=U5(g),C=S.map(function(w){var k=w.node;return k}).indexOf(y);C>-1&&(S.filter(function(w){var k=w.guard,j=w.node;return k&&j.dataset.focusAutoGuard}).forEach(function(w){var k=w.node;return k.removeAttribute("tabIndex")}),gg(C,S.length,1,S),gg(C,-1,-1,S))}}}return t},ix=function(t){sc()&&t&&(t.stopPropagation(),t.preventDefault())},Ch=function(){return rx(sc)},n6=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||K5(r,n)},r6=function(){return null},ox=function(){Ka="just",setTimeout(function(){Ka="meanwhile"},0)},i6=function(){document.addEventListener("focusin",ix),document.addEventListener("focusout",Ch),window.addEventListener("blur",ox)},o6=function(){document.removeEventListener("focusin",ix),document.removeEventListener("focusout",Ch),window.removeEventListener("blur",ox)};function a6(e){return e.filter(function(t){var n=t.disabled;return!n})}function s6(e){var t=e.slice(-1)[0];t&&!qo&&i6();var n=qo,r=n&&t&&t.id===n.id;qo=t,n&&!r&&(n.onDeactivation(),e.filter(function(i){var s=i.id;return s===n.id}).length||n.returnFocus(!t)),t?(Bo=null,(!r||n.observed!==t.observed)&&t.onActivation(),sc(),rx(sc)):(o6(),Bo=null)}L2.assignSyncMedium(n6);B2.assignMedium(Ch);p5.assignMedium(function(e){return e({moveFocusInside:nx,focusInside:J2})});const l6=g5(a6,s6)(r6);var ax=x.forwardRef(function(t,n){return x.createElement(H2,Ql({sideCar:l6,ref:n},t))}),sx=H2.propTypes||{};sx.sideCar;th(sx,["sideCar"]);ax.propTypes={};const xg=ax;function lx(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function cx(e){var t;if(!lx(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function c6(e){var t,n;return(n=(t=ux(e))==null?void 0:t.defaultView)!=null?n:window}function ux(e){return lx(e)?e.ownerDocument:document}function u6(e){return ux(e).activeElement}var dx=e=>e.hasAttribute("tabindex"),d6=e=>dx(e)&&e.tabIndex===-1;function f6(e){return Boolean(e.getAttribute("disabled"))===!0||Boolean(e.getAttribute("aria-disabled"))===!0}function fx(e){return e.parentElement&&fx(e.parentElement)?!0:e.hidden}function h6(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function hx(e){if(!cx(e)||fx(e)||f6(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():h6(e)?!0:dx(e)}function p6(e){return e?cx(e)&&hx(e)&&!d6(e):!1}var m6=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],v6=m6.join(),g6=e=>e.offsetWidth>0&&e.offsetHeight>0;function px(e){const t=Array.from(e.querySelectorAll(v6));return t.unshift(e),t.filter(n=>hx(n)&&g6(n))}var yg,x6=(yg=xg.default)!=null?yg:xg,mx=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:i,children:s,isDisabled:c,autoFocus:u,persistentFocus:f,lockFocusAcrossFrames:h}=e,p=x.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&px(r.current).length===0&&requestAnimationFrame(()=>{var C;(C=r.current)==null||C.focus()})},[t,r]),g=x.useCallback(()=>{var S;(S=n==null?void 0:n.current)==null||S.focus()},[n]),y=i&&!n;return l.jsx(x6,{crossFrame:h,persistentFocus:f,autoFocus:u,disabled:c,onActivation:p,onDeactivation:g,returnFocus:y,children:s})};mx.displayName="FocusLock";var y6=D3?x.useLayoutEffect:x.useEffect;function Sf(e,t=[]){const n=x.useRef(e);return y6(()=>{n.current=e}),x.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function b6(e,t,n,r){const i=Sf(t);return x.useEffect(()=>{var s;const c=(s=zv(n))!=null?s:document;if(t)return c.addEventListener(e,i,r),()=>{c.removeEventListener(e,i,r)}},[e,n,r,i,t]),()=>{var s;((s=zv(n))!=null?s:document).removeEventListener(e,i,r)}}function S6(e,t){const n=x.useId();return x.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function C6(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function ui(e={}){const{onClose:t,onOpen:n,isOpen:r,id:i}=e,s=Sf(n),c=Sf(t),[u,f]=x.useState(e.defaultIsOpen||!1),[h,p]=C6(r,u),g=S6(i,"disclosure"),y=x.useCallback(()=>{h||f(!1),c==null||c()},[h,c]),S=x.useCallback(()=>{h||f(!0),s==null||s()},[h,s]),C=x.useCallback(()=>{(p?y:S)()},[p,S,y]);return{isOpen:!!p,onOpen:S,onClose:y,onToggle:C,isControlled:h,getButtonProps:(w={})=>({...w,"aria-expanded":p,"aria-controls":g,onClick:LS(w.onClick,C)}),getDisclosureProps:(w={})=>({...w,hidden:!p,id:g})}}var wh=he(function(t,n){const{htmlSize:r,...i}=t,s=fn("Input",i),c=At(i),u=ch(c),f=Ae("chakra-input",t.className);return l.jsx(re.input,{size:r,...u,__css:s.field,ref:n,className:f})});wh.displayName="Input";wh.id="Input";var[w6,vx]=Et({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),kh=he(function(t,n){const r=fn("List",t),{children:i,styleType:s="none",stylePosition:c,spacing:u,...f}=At(t),h=lh(i),g=u?{["& > *:not(style) ~ *:not(style)"]:{mt:u}}:{};return l.jsx(w6,{value:r,children:l.jsx(re.ul,{ref:n,listStyleType:s,listStylePosition:c,role:"list",__css:{...r.container,...g},...f,children:h})})});kh.displayName="List";var k6=he((e,t)=>{const{as:n,...r}=e;return l.jsx(kh,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});k6.displayName="OrderedList";var gx=he(function(t,n){const{as:r,...i}=t;return l.jsx(kh,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...i})});gx.displayName="UnorderedList";var Fa=he(function(t,n){const r=vx();return l.jsx(re.li,{ref:n,...t,__css:r.item})});Fa.displayName="ListItem";var j6=he(function(t,n){const r=vx();return l.jsx(Jt,{ref:n,role:"presentation",...t,__css:r.icon})});j6.displayName="ListIcon";var $n=he(function(t,n){const{templateAreas:r,gap:i,rowGap:s,columnGap:c,column:u,row:f,autoFlow:h,autoRows:p,templateRows:g,autoColumns:y,templateColumns:S,...C}=t,w={display:"grid",gridTemplateAreas:r,gridGap:i,gridRowGap:s,gridColumnGap:c,gridAutoColumns:y,gridColumn:u,gridRow:f,gridAutoFlow:h,gridAutoRows:p,gridTemplateRows:g,gridTemplateColumns:S};return l.jsx(re.div,{ref:n,__css:w,...C})});$n.displayName="Grid";function xx(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Kd(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var jc=re("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});jc.displayName="Spacer";var yx=e=>l.jsx(re.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});yx.displayName="StackItem";var Cf="& > *:not(style) ~ *:not(style)";function E6(e){const{spacing:t,direction:n}=e,r={column:{marginTop:t,marginEnd:0,marginBottom:0,marginStart:0},row:{marginTop:0,marginEnd:0,marginBottom:0,marginStart:t},"column-reverse":{marginTop:0,marginEnd:0,marginBottom:t,marginStart:0},"row-reverse":{marginTop:0,marginEnd:t,marginBottom:0,marginStart:0}};return{flexDirection:n,[Cf]:xx(n,i=>r[i])}}function P6(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":xx(n,i=>r[i])}}var jh=he((e,t)=>{const{isInline:n,direction:r,align:i,justify:s,spacing:c="0.5rem",wrap:u,children:f,divider:h,className:p,shouldWrapChildren:g,...y}=e,S=n?"row":r??"column",C=x.useMemo(()=>E6({direction:S,spacing:c}),[S,c]),w=x.useMemo(()=>P6({spacing:c,direction:S}),[c,S]),k=!!h,j=!g&&!k,M=x.useMemo(()=>{const I=lh(f);return j?I:I.map((T,D)=>{const _=typeof T.key<"u"?T.key:D,z=D+1===I.length,F=g?l.jsx(yx,{children:T},_):T;if(!k)return F;const L=x.cloneElement(h,{__css:w}),Q=z?null:L;return l.jsxs(x.Fragment,{children:[F,Q]},_)})},[h,w,k,j,g,f]),P=Ae("chakra-stack",p);return l.jsx(re.div,{ref:t,display:"flex",alignItems:i,justifyContent:s,flexDirection:C.flexDirection,flexWrap:u,className:P,__css:k?{}:{[Cf]:C[Cf]},...y,children:M})});jh.displayName="Stack";var Le=he((e,t)=>l.jsx(jh,{align:"center",...e,direction:"column",ref:t}));Le.displayName="VStack";var sa=he((e,t)=>l.jsx(jh,{align:"center",...e,direction:"row",ref:t}));sa.displayName="HStack";var Vn=he(function(t,n){const r=pi("Heading",t),{className:i,...s}=At(t);return l.jsx(re.h2,{ref:n,className:Ae("chakra-heading",t.className),...s,__css:r})});Vn.displayName="Heading";var We=re("div");We.displayName="Box";var bx=he(function(t,n){const{size:r,centerContent:i=!0,...s}=t,c=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return l.jsx(We,{ref:n,boxSize:r,__css:{...c,flexShrink:0,flexGrow:0},...s})});bx.displayName="Square";var I6=he(function(t,n){const{size:r,...i}=t;return l.jsx(bx,{size:r,ref:n,borderRadius:"9999px",...i})});I6.displayName="Circle";var $i=he(function(t,n){const r=pi("Link",t),{className:i,isExternal:s,...c}=At(t);return l.jsx(re.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:Ae("chakra-link",i),...c,__css:r})});$i.displayName="Link";var Sx=he(function(t,n){const r=pi("Badge",t),{className:i,...s}=At(t);return l.jsx(re.span,{ref:n,className:Ae("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Sx.displayName="Badge";var Cx=re("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center"}});Cx.displayName="Center";var M6={horizontal:{insetStart:"50%",transform:"translateX(-50%)"},vertical:{top:"50%",transform:"translateY(-50%)"},both:{insetStart:"50%",top:"50%",transform:"translate(-50%, -50%)"}};he(function(t,n){const{axis:r="both",...i}=t;return l.jsx(re.div,{ref:n,__css:M6[r],...i,position:"absolute"})});var wx=he(function(t,n){const{borderLeftWidth:r,borderBottomWidth:i,borderTopWidth:s,borderRightWidth:c,borderWidth:u,borderStyle:f,borderColor:h,...p}=pi("Divider",t),{className:g,orientation:y="horizontal",__css:S,...C}=At(t),w={vertical:{borderLeftWidth:r||c||u||"1px",height:"100%"},horizontal:{borderBottomWidth:i||s||u||"1px",width:"100%"}};return l.jsx(re.hr,{ref:n,"aria-orientation":y,...C,__css:{...p,border:"0",borderColor:h,borderStyle:f,...w[y],...S},className:Ae("chakra-divider",g)})});wx.displayName="Divider";function T6(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function _6(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,i]=x.useState([]),s=x.useRef(),c=()=>{s.current&&(clearTimeout(s.current),s.current=null)},u=()=>{c(),s.current=setTimeout(()=>{i([]),s.current=null},t)};x.useEffect(()=>c,[]);function f(h){return p=>{if(p.key==="Backspace"){const g=[...r];g.pop(),i(g);return}if(T6(p)){const g=r.concat(p.key);n(p)&&(p.preventDefault(),p.stopPropagation()),i(g),h(g.join("")),u()}}}return f}function D6(e,t,n,r){if(t==null)return r;if(!r)return e.find(c=>n(c).toLowerCase().startsWith(t.toLowerCase()));const i=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(i.length>0){let s;return i.includes(r)?(s=i.indexOf(r)+1,s===i.length&&(s=0),i[s]):(s=e.indexOf(i[0]),e[s])}return r}function O6(){const e=x.useRef(new Map),t=e.current,n=x.useCallback((i,s,c,u)=>{e.current.set(c,{type:s,el:i,options:u}),i.addEventListener(s,c,u)},[]),r=x.useCallback((i,s,c,u)=>{i.removeEventListener(s,c,u),e.current.delete(c)},[]);return x.useEffect(()=>()=>{t.forEach((i,s)=>{r(i.el,i.type,s,i.options)})},[r,t]),{add:n,remove:r}}function Cd(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function kx(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:i=!0,clickOnSpace:s=!0,onMouseDown:c,onMouseUp:u,onClick:f,onKeyDown:h,onKeyUp:p,tabIndex:g,onMouseOver:y,onMouseLeave:S,...C}=e,[w,k]=x.useState(!0),[j,M]=x.useState(!1),P=O6(),I=U=>{U&&U.tagName!=="BUTTON"&&k(!1)},T=w?g:g||0,D=n&&!r,_=x.useCallback(U=>{if(n){U.stopPropagation(),U.preventDefault();return}U.currentTarget.focus(),f==null||f(U)},[n,f]),z=x.useCallback(U=>{j&&Cd(U)&&(U.preventDefault(),U.stopPropagation(),M(!1),P.remove(document,"keyup",z,!1))},[j,P]),V=x.useCallback(U=>{if(h==null||h(U),n||U.defaultPrevented||U.metaKey||!Cd(U.nativeEvent)||w)return;const K=i&&U.key==="Enter";s&&U.key===" "&&(U.preventDefault(),M(!0)),K&&(U.preventDefault(),U.currentTarget.click()),P.add(document,"keyup",z,!1)},[n,w,h,i,s,P,z]),F=x.useCallback(U=>{if(p==null||p(U),n||U.defaultPrevented||U.metaKey||!Cd(U.nativeEvent)||w)return;s&&U.key===" "&&(U.preventDefault(),M(!1),U.currentTarget.click())},[s,w,n,p]),L=x.useCallback(U=>{U.button===0&&(M(!1),P.remove(document,"mouseup",L,!1))},[P]),Q=x.useCallback(U=>{if(U.button!==0)return;if(n){U.stopPropagation(),U.preventDefault();return}w||M(!0),U.currentTarget.focus({preventScroll:!0}),P.add(document,"mouseup",L,!1),c==null||c(U)},[n,w,c,P,L]),$=x.useCallback(U=>{U.button===0&&(w||M(!1),u==null||u(U))},[u,w]),Z=x.useCallback(U=>{if(n){U.preventDefault();return}y==null||y(U)},[n,y]),te=x.useCallback(U=>{j&&(U.preventDefault(),M(!1)),S==null||S(U)},[j,S]),ie=ct(t,I);return w?{...C,ref:ie,type:"button","aria-disabled":D?void 0:n,disabled:D,onClick:_,onMouseDown:c,onMouseUp:u,onKeyUp:p,onKeyDown:h,onMouseOver:y,onMouseLeave:S}:{...C,ref:ie,role:"button","data-active":Ye(j),"aria-disabled":n?"true":void 0,tabIndex:D?void 0:T,onClick:_,onMouseDown:Q,onMouseUp:$,onKeyUp:F,onKeyDown:V,onMouseOver:Z,onMouseLeave:te}}function A6(e){const t=e.current;if(!t)return!1;const n=u6(t);return!n||t.contains(n)?!1:!!p6(n)}function jx(e,t){const{shouldFocus:n,visible:r,focusRef:i}=t,s=n&&!r;eo(()=>{if(!s||A6(e))return;const c=(i==null?void 0:i.current)||e.current;c&&requestAnimationFrame(()=>{c.focus()})},[s,e,i])}var z6={preventScroll:!0,shouldFocus:!1};function R6(e,t=z6){const{focusRef:n,preventScroll:r,shouldFocus:i,visible:s}=t,c=N6(e)?e.current:e,u=i&&s,f=x.useRef(u),h=x.useRef(s);Uo(()=>{!h.current&&s&&(f.current=u),h.current=s},[s,u]);const p=x.useCallback(()=>{if(!(!s||!c||!f.current)&&(f.current=!1,!c.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var g;(g=n.current)==null||g.focus({preventScroll:r})});else{const g=px(c);g.length>0&&requestAnimationFrame(()=>{g[0].focus({preventScroll:r})})}},[s,r,c,n]);eo(()=>{p()},[p]),Ui(c,"transitionend",p)}function N6(e){return"current"in e}var Eo=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),Vt={arrowShadowColor:Eo("--popper-arrow-shadow-color"),arrowSize:Eo("--popper-arrow-size","8px"),arrowSizeHalf:Eo("--popper-arrow-size-half"),arrowBg:Eo("--popper-arrow-bg"),transformOrigin:Eo("--popper-transform-origin"),arrowOffset:Eo("--popper-arrow-offset")};function F6(e){if(e.includes("top"))return"1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 1px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 1px 0 var(--popper-arrow-shadow-color)"}var L6={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},B6=e=>L6[e],bg={scroll:!0,resize:!0};function H6(e){let t;return typeof e=="object"?t={enabled:!0,options:{...bg,...e}}:t={enabled:e,options:bg},t}var W6={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},V6={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{Sg(e)},effect:({state:e})=>()=>{Sg(e)}},Sg=e=>{e.elements.popper.style.setProperty(Vt.transformOrigin.var,B6(e.placement))},U6={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{$6(e)}},$6=e=>{var t;if(!e.placement)return;const n=G6(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:Vt.arrowSize.varRef,height:Vt.arrowSize.varRef,zIndex:-1});const r={[Vt.arrowSizeHalf.var]:`calc(${Vt.arrowSize.varRef} / 2)`,[Vt.arrowOffset.var]:`calc(${Vt.arrowSizeHalf.varRef} * -1)`};for(const i in r)e.elements.arrow.style.setProperty(i,r[i])}},G6=e=>{if(e.startsWith("top"))return{property:"bottom",value:Vt.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:Vt.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:Vt.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:Vt.arrowOffset.varRef}},q6={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{Cg(e)},effect:({state:e})=>()=>{Cg(e)}},Cg=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=F6(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:Vt.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},Y6={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},X6={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function K6(e,t="ltr"){var n,r;const i=((n=Y6[e])==null?void 0:n[t])||e;return t==="ltr"?i:(r=X6[e])!=null?r:i}var Pn="top",Gn="bottom",qn="right",In="left",Eh="auto",hs=[Pn,Gn,qn,In],Xo="start",Qa="end",Q6="clippingParents",Ex="viewport",Oa="popper",Z6="reference",wg=hs.reduce(function(e,t){return e.concat([t+"-"+Xo,t+"-"+Qa])},[]),Px=[].concat(hs,[Eh]).reduce(function(e,t){return e.concat([t,t+"-"+Xo,t+"-"+Qa])},[]),J6="beforeRead",ek="read",tk="afterRead",nk="beforeMain",rk="main",ik="afterMain",ok="beforeWrite",ak="write",sk="afterWrite",lk=[J6,ek,tk,nk,rk,ik,ok,ak,sk];function Cr(e){return e?(e.nodeName||"").toLowerCase():null}function Yn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Xi(e){var t=Yn(e).Element;return e instanceof t||e instanceof Element}function Un(e){var t=Yn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Ph(e){if(typeof ShadowRoot>"u")return!1;var t=Yn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function ck(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},i=t.attributes[n]||{},s=t.elements[n];!Un(s)||!Cr(s)||(Object.assign(s.style,r),Object.keys(i).forEach(function(c){var u=i[c];u===!1?s.removeAttribute(c):s.setAttribute(c,u===!0?"":u)}))})}function uk(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var i=t.elements[r],s=t.attributes[r]||{},c=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),u=c.reduce(function(f,h){return f[h]="",f},{});!Un(i)||!Cr(i)||(Object.assign(i.style,u),Object.keys(s).forEach(function(f){i.removeAttribute(f)}))})}}const dk={name:"applyStyles",enabled:!0,phase:"write",fn:ck,effect:uk,requires:["computeStyles"]};function yr(e){return e.split("-")[0]}var Gi=Math.max,lc=Math.min,Ko=Math.round;function wf(){var e=navigator.userAgentData;return e!=null&&e.brands?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Ix(){return!/^((?!chrome|android).)*safari/i.test(wf())}function Qo(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,s=1;t&&Un(e)&&(i=e.offsetWidth>0&&Ko(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Ko(r.height)/e.offsetHeight||1);var c=Xi(e)?Yn(e):window,u=c.visualViewport,f=!Ix()&&n,h=(r.left+(f&&u?u.offsetLeft:0))/i,p=(r.top+(f&&u?u.offsetTop:0))/s,g=r.width/i,y=r.height/s;return{width:g,height:y,top:p,right:h+g,bottom:p+y,left:h,x:h,y:p}}function Ih(e){var t=Qo(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Mx(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Ph(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Ar(e){return Yn(e).getComputedStyle(e)}function fk(e){return["table","td","th"].indexOf(Cr(e))>=0}function mi(e){return((Xi(e)?e.ownerDocument:e.document)||window.document).documentElement}function Ec(e){return Cr(e)==="html"?e:e.assignedSlot||e.parentNode||(Ph(e)?e.host:null)||mi(e)}function kg(e){return!Un(e)||Ar(e).position==="fixed"?null:e.offsetParent}function hk(e){var t=/firefox/i.test(wf()),n=/Trident/i.test(wf());if(n&&Un(e)){var r=Ar(e);if(r.position==="fixed")return null}var i=Ec(e);for(Ph(i)&&(i=i.host);Un(i)&&["html","body"].indexOf(Cr(i))<0;){var s=Ar(i);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return i;i=i.parentNode}return null}function ps(e){for(var t=Yn(e),n=kg(e);n&&fk(n)&&Ar(n).position==="static";)n=kg(n);return n&&(Cr(n)==="html"||Cr(n)==="body"&&Ar(n).position==="static")?t:n||hk(e)||t}function Mh(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Ha(e,t,n){return Gi(e,lc(t,n))}function pk(e,t,n){var r=Ha(e,t,n);return r>n?n:r}function Tx(){return{top:0,right:0,bottom:0,left:0}}function _x(e){return Object.assign({},Tx(),e)}function Dx(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var mk=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,_x(typeof t!="number"?t:Dx(t,hs))};function vk(e){var t,n=e.state,r=e.name,i=e.options,s=n.elements.arrow,c=n.modifiersData.popperOffsets,u=yr(n.placement),f=Mh(u),h=[In,qn].indexOf(u)>=0,p=h?"height":"width";if(!(!s||!c)){var g=mk(i.padding,n),y=Ih(s),S=f==="y"?Pn:In,C=f==="y"?Gn:qn,w=n.rects.reference[p]+n.rects.reference[f]-c[f]-n.rects.popper[p],k=c[f]-n.rects.reference[f],j=ps(s),M=j?f==="y"?j.clientHeight||0:j.clientWidth||0:0,P=w/2-k/2,I=g[S],T=M-y[p]-g[C],D=M/2-y[p]/2+P,_=Ha(I,D,T),z=f;n.modifiersData[r]=(t={},t[z]=_,t.centerOffset=_-D,t)}}function gk(e){var t=e.state,n=e.options,r=n.element,i=r===void 0?"[data-popper-arrow]":r;i!=null&&(typeof i=="string"&&(i=t.elements.popper.querySelector(i),!i)||Mx(t.elements.popper,i)&&(t.elements.arrow=i))}const xk={name:"arrow",enabled:!0,phase:"main",fn:vk,effect:gk,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Zo(e){return e.split("-")[1]}var yk={top:"auto",right:"auto",bottom:"auto",left:"auto"};function bk(e){var t=e.x,n=e.y,r=window,i=r.devicePixelRatio||1;return{x:Ko(t*i)/i||0,y:Ko(n*i)/i||0}}function jg(e){var t,n=e.popper,r=e.popperRect,i=e.placement,s=e.variation,c=e.offsets,u=e.position,f=e.gpuAcceleration,h=e.adaptive,p=e.roundOffsets,g=e.isFixed,y=c.x,S=y===void 0?0:y,C=c.y,w=C===void 0?0:C,k=typeof p=="function"?p({x:S,y:w}):{x:S,y:w};S=k.x,w=k.y;var j=c.hasOwnProperty("x"),M=c.hasOwnProperty("y"),P=In,I=Pn,T=window;if(h){var D=ps(n),_="clientHeight",z="clientWidth";if(D===Yn(n)&&(D=mi(n),Ar(D).position!=="static"&&u==="absolute"&&(_="scrollHeight",z="scrollWidth")),D=D,i===Pn||(i===In||i===qn)&&s===Qa){I=Gn;var V=g&&D===T&&T.visualViewport?T.visualViewport.height:D[_];w-=V-r.height,w*=f?1:-1}if(i===In||(i===Pn||i===Gn)&&s===Qa){P=qn;var F=g&&D===T&&T.visualViewport?T.visualViewport.width:D[z];S-=F-r.width,S*=f?1:-1}}var L=Object.assign({position:u},h&&yk),Q=p===!0?bk({x:S,y:w}):{x:S,y:w};if(S=Q.x,w=Q.y,f){var $;return Object.assign({},L,($={},$[I]=M?"0":"",$[P]=j?"0":"",$.transform=(T.devicePixelRatio||1)<=1?"translate("+S+"px, "+w+"px)":"translate3d("+S+"px, "+w+"px, 0)",$))}return Object.assign({},L,(t={},t[I]=M?w+"px":"",t[P]=j?S+"px":"",t.transform="",t))}function Sk(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0?!0:r,s=n.adaptive,c=s===void 0?!0:s,u=n.roundOffsets,f=u===void 0?!0:u,h={placement:yr(t.placement),variation:Zo(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,jg(Object.assign({},h,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:c,roundOffsets:f})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,jg(Object.assign({},h,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const Ck={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Sk,data:{}};var wl={passive:!0};function wk(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,s=i===void 0?!0:i,c=r.resize,u=c===void 0?!0:c,f=Yn(t.elements.popper),h=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&h.forEach(function(p){p.addEventListener("scroll",n.update,wl)}),u&&f.addEventListener("resize",n.update,wl),function(){s&&h.forEach(function(p){p.removeEventListener("scroll",n.update,wl)}),u&&f.removeEventListener("resize",n.update,wl)}}const kk={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:wk,data:{}};var jk={left:"right",right:"left",bottom:"top",top:"bottom"};function Gl(e){return e.replace(/left|right|bottom|top/g,function(t){return jk[t]})}var Ek={start:"end",end:"start"};function Eg(e){return e.replace(/start|end/g,function(t){return Ek[t]})}function Th(e){var t=Yn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function _h(e){return Qo(mi(e)).left+Th(e).scrollLeft}function Pk(e,t){var n=Yn(e),r=mi(e),i=n.visualViewport,s=r.clientWidth,c=r.clientHeight,u=0,f=0;if(i){s=i.width,c=i.height;var h=Ix();(h||!h&&t==="fixed")&&(u=i.offsetLeft,f=i.offsetTop)}return{width:s,height:c,x:u+_h(e),y:f}}function Ik(e){var t,n=mi(e),r=Th(e),i=(t=e.ownerDocument)==null?void 0:t.body,s=Gi(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),c=Gi(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),u=-r.scrollLeft+_h(e),f=-r.scrollTop;return Ar(i||n).direction==="rtl"&&(u+=Gi(n.clientWidth,i?i.clientWidth:0)-s),{width:s,height:c,x:u,y:f}}function Dh(e){var t=Ar(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function Ox(e){return["html","body","#document"].indexOf(Cr(e))>=0?e.ownerDocument.body:Un(e)&&Dh(e)?e:Ox(Ec(e))}function Wa(e,t){var n;t===void 0&&(t=[]);var r=Ox(e),i=r===((n=e.ownerDocument)==null?void 0:n.body),s=Yn(r),c=i?[s].concat(s.visualViewport||[],Dh(r)?r:[]):r,u=t.concat(c);return i?u:u.concat(Wa(Ec(c)))}function kf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Mk(e,t){var n=Qo(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function Pg(e,t,n){return t===Ex?kf(Pk(e,n)):Xi(t)?Mk(t,n):kf(Ik(mi(e)))}function Tk(e){var t=Wa(Ec(e)),n=["absolute","fixed"].indexOf(Ar(e).position)>=0,r=n&&Un(e)?ps(e):e;return Xi(r)?t.filter(function(i){return Xi(i)&&Mx(i,r)&&Cr(i)!=="body"}):[]}function _k(e,t,n,r){var i=t==="clippingParents"?Tk(e):[].concat(t),s=[].concat(i,[n]),c=s[0],u=s.reduce(function(f,h){var p=Pg(e,h,r);return f.top=Gi(p.top,f.top),f.right=lc(p.right,f.right),f.bottom=lc(p.bottom,f.bottom),f.left=Gi(p.left,f.left),f},Pg(e,c,r));return u.width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u}function Ax(e){var t=e.reference,n=e.element,r=e.placement,i=r?yr(r):null,s=r?Zo(r):null,c=t.x+t.width/2-n.width/2,u=t.y+t.height/2-n.height/2,f;switch(i){case Pn:f={x:c,y:t.y-n.height};break;case Gn:f={x:c,y:t.y+t.height};break;case qn:f={x:t.x+t.width,y:u};break;case In:f={x:t.x-n.width,y:u};break;default:f={x:t.x,y:t.y}}var h=i?Mh(i):null;if(h!=null){var p=h==="y"?"height":"width";switch(s){case Xo:f[h]=f[h]-(t[p]/2-n[p]/2);break;case Qa:f[h]=f[h]+(t[p]/2-n[p]/2);break}}return f}function Za(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,s=n.strategy,c=s===void 0?e.strategy:s,u=n.boundary,f=u===void 0?Q6:u,h=n.rootBoundary,p=h===void 0?Ex:h,g=n.elementContext,y=g===void 0?Oa:g,S=n.altBoundary,C=S===void 0?!1:S,w=n.padding,k=w===void 0?0:w,j=_x(typeof k!="number"?k:Dx(k,hs)),M=y===Oa?Z6:Oa,P=e.rects.popper,I=e.elements[C?M:y],T=_k(Xi(I)?I:I.contextElement||mi(e.elements.popper),f,p,c),D=Qo(e.elements.reference),_=Ax({reference:D,element:P,strategy:"absolute",placement:i}),z=kf(Object.assign({},P,_)),V=y===Oa?z:D,F={top:T.top-V.top+j.top,bottom:V.bottom-T.bottom+j.bottom,left:T.left-V.left+j.left,right:V.right-T.right+j.right},L=e.modifiersData.offset;if(y===Oa&&L){var Q=L[i];Object.keys(F).forEach(function($){var Z=[qn,Gn].indexOf($)>=0?1:-1,te=[Pn,Gn].indexOf($)>=0?"y":"x";F[$]+=Q[te]*Z})}return F}function Dk(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,s=n.rootBoundary,c=n.padding,u=n.flipVariations,f=n.allowedAutoPlacements,h=f===void 0?Px:f,p=Zo(r),g=p?u?wg:wg.filter(function(C){return Zo(C)===p}):hs,y=g.filter(function(C){return h.indexOf(C)>=0});y.length===0&&(y=g);var S=y.reduce(function(C,w){return C[w]=Za(e,{placement:w,boundary:i,rootBoundary:s,padding:c})[yr(w)],C},{});return Object.keys(S).sort(function(C,w){return S[C]-S[w]})}function Ok(e){if(yr(e)===Eh)return[];var t=Gl(e);return[Eg(e),t,Eg(t)]}function Ak(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,s=i===void 0?!0:i,c=n.altAxis,u=c===void 0?!0:c,f=n.fallbackPlacements,h=n.padding,p=n.boundary,g=n.rootBoundary,y=n.altBoundary,S=n.flipVariations,C=S===void 0?!0:S,w=n.allowedAutoPlacements,k=t.options.placement,j=yr(k),M=j===k,P=f||(M||!C?[Gl(k)]:Ok(k)),I=[k].concat(P).reduce(function(oe,ae){return oe.concat(yr(ae)===Eh?Dk(t,{placement:ae,boundary:p,rootBoundary:g,padding:h,flipVariations:C,allowedAutoPlacements:w}):ae)},[]),T=t.rects.reference,D=t.rects.popper,_=new Map,z=!0,V=I[0],F=0;F=0,te=Z?"width":"height",ie=Za(t,{placement:L,boundary:p,rootBoundary:g,altBoundary:y,padding:h}),U=Z?$?qn:In:$?Gn:Pn;T[te]>D[te]&&(U=Gl(U));var K=Gl(U),ne=[];if(s&&ne.push(ie[Q]<=0),u&&ne.push(ie[U]<=0,ie[K]<=0),ne.every(function(oe){return oe})){V=L,z=!1;break}_.set(L,ne)}if(z)for(var ce=C?3:1,Re=function(ae){var je=I.find(function(Be){var Ne=_.get(Be);if(Ne)return Ne.slice(0,ae).every(function(Ge){return Ge})});if(je)return V=je,"break"},ze=ce;ze>0;ze--){var Me=Re(ze);if(Me==="break")break}t.placement!==V&&(t.modifiersData[r]._skip=!0,t.placement=V,t.reset=!0)}}const zk={name:"flip",enabled:!0,phase:"main",fn:Ak,requiresIfExists:["offset"],data:{_skip:!1}};function Ig(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Mg(e){return[Pn,qn,Gn,In].some(function(t){return e[t]>=0})}function Rk(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,s=t.modifiersData.preventOverflow,c=Za(t,{elementContext:"reference"}),u=Za(t,{altBoundary:!0}),f=Ig(c,r),h=Ig(u,i,s),p=Mg(f),g=Mg(h);t.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:h,isReferenceHidden:p,hasPopperEscaped:g},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":g})}const Nk={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Rk};function Fk(e,t,n){var r=yr(e),i=[In,Pn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,c=s[0],u=s[1];return c=c||0,u=(u||0)*i,[In,qn].indexOf(r)>=0?{x:u,y:c}:{x:c,y:u}}function Lk(e){var t=e.state,n=e.options,r=e.name,i=n.offset,s=i===void 0?[0,0]:i,c=Px.reduce(function(p,g){return p[g]=Fk(g,t.rects,s),p},{}),u=c[t.placement],f=u.x,h=u.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=f,t.modifiersData.popperOffsets.y+=h),t.modifiersData[r]=c}const Bk={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Lk};function Hk(e){var t=e.state,n=e.name;t.modifiersData[n]=Ax({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const Wk={name:"popperOffsets",enabled:!0,phase:"read",fn:Hk,data:{}};function Vk(e){return e==="x"?"y":"x"}function Uk(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,s=i===void 0?!0:i,c=n.altAxis,u=c===void 0?!1:c,f=n.boundary,h=n.rootBoundary,p=n.altBoundary,g=n.padding,y=n.tether,S=y===void 0?!0:y,C=n.tetherOffset,w=C===void 0?0:C,k=Za(t,{boundary:f,rootBoundary:h,padding:g,altBoundary:p}),j=yr(t.placement),M=Zo(t.placement),P=!M,I=Mh(j),T=Vk(I),D=t.modifiersData.popperOffsets,_=t.rects.reference,z=t.rects.popper,V=typeof w=="function"?w(Object.assign({},t.rects,{placement:t.placement})):w,F=typeof V=="number"?{mainAxis:V,altAxis:V}:Object.assign({mainAxis:0,altAxis:0},V),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Q={x:0,y:0};if(D){if(s){var $,Z=I==="y"?Pn:In,te=I==="y"?Gn:qn,ie=I==="y"?"height":"width",U=D[I],K=U+k[Z],ne=U-k[te],ce=S?-z[ie]/2:0,Re=M===Xo?_[ie]:z[ie],ze=M===Xo?-z[ie]:-_[ie],Me=t.elements.arrow,oe=S&&Me?Ih(Me):{width:0,height:0},ae=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Tx(),je=ae[Z],Be=ae[te],Ne=Ha(0,_[ie],oe[ie]),Ge=P?_[ie]/2-ce-Ne-je-F.mainAxis:Re-Ne-je-F.mainAxis,Qe=P?-_[ie]/2+ce+Ne+Be+F.mainAxis:ze+Ne+Be+F.mainAxis,ve=t.elements.arrow&&ps(t.elements.arrow),_e=ve?I==="y"?ve.clientTop||0:ve.clientLeft||0:0,qe=($=L==null?void 0:L[I])!=null?$:0,ge=U+Ge-qe-_e,Te=U+Qe-qe,et=Ha(S?lc(K,ge):K,U,S?Gi(ne,Te):ne);D[I]=et,Q[I]=et-U}if(u){var Ve,vt=I==="x"?Pn:In,Nt=I==="x"?Gn:qn,N=D[T],de=T==="y"?"height":"width",xe=N+k[vt],Ee=N-k[Nt],q=[Pn,In].indexOf(j)!==-1,le=(Ve=L==null?void 0:L[T])!=null?Ve:0,Fe=q?xe:N-_[de]-z[de]-le+F.altAxis,Ze=q?N+_[de]+z[de]-le-F.altAxis:Ee,J=S&&q?pk(Fe,N,Ze):Ha(S?Fe:xe,N,S?Ze:Ee);D[T]=J,Q[T]=J-N}t.modifiersData[r]=Q}}const $k={name:"preventOverflow",enabled:!0,phase:"main",fn:Uk,requiresIfExists:["offset"]};function Gk(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function qk(e){return e===Yn(e)||!Un(e)?Th(e):Gk(e)}function Yk(e){var t=e.getBoundingClientRect(),n=Ko(t.width)/e.offsetWidth||1,r=Ko(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Xk(e,t,n){n===void 0&&(n=!1);var r=Un(t),i=Un(t)&&Yk(t),s=mi(t),c=Qo(e,i,n),u={scrollLeft:0,scrollTop:0},f={x:0,y:0};return(r||!r&&!n)&&((Cr(t)!=="body"||Dh(s))&&(u=qk(t)),Un(t)?(f=Qo(t,!0),f.x+=t.clientLeft,f.y+=t.clientTop):s&&(f.x=_h(s))),{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function Kk(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function i(s){n.add(s.name);var c=[].concat(s.requires||[],s.requiresIfExists||[]);c.forEach(function(u){if(!n.has(u)){var f=t.get(u);f&&i(f)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||i(s)}),r}function Qk(e){var t=Kk(e);return lk.reduce(function(n,r){return n.concat(t.filter(function(i){return i.phase===r}))},[])}function Zk(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function Jk(e){var t=e.reduce(function(n,r){var i=n[r.name];return n[r.name]=i?Object.assign({},i,r,{options:Object.assign({},i.options,r.options),data:Object.assign({},i.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Tg={placement:"bottom",modifiers:[],strategy:"absolute"};function _g(){for(var e=arguments.length,t=new Array(e),n=0;n{}),P=x.useCallback(()=>{var F;!t||!C.current||!w.current||((F=M.current)==null||F.call(M),k.current=nj(C.current,w.current,{placement:j,modifiers:[q6,U6,V6,{...W6,enabled:!!y},{name:"eventListeners",...H6(c)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:u??[0,f]}},{name:"flip",enabled:!!h,options:{padding:8}},{name:"preventOverflow",enabled:!!g,options:{boundary:p}},...n??[]],strategy:i}),k.current.forceUpdate(),M.current=k.current.destroy)},[j,t,n,y,c,s,u,f,h,g,p,i]);x.useEffect(()=>()=>{var F;!C.current&&!w.current&&((F=k.current)==null||F.destroy(),k.current=null)},[]);const I=x.useCallback(F=>{C.current=F,P()},[P]),T=x.useCallback((F={},L=null)=>({...F,ref:ct(I,L)}),[I]),D=x.useCallback(F=>{w.current=F,P()},[P]),_=x.useCallback((F={},L=null)=>({...F,ref:ct(D,L),style:{...F.style,position:i,minWidth:y?void 0:"max-content",inset:"0 auto auto 0"}}),[i,D,y]),z=x.useCallback((F={},L=null)=>{const{size:Q,shadowColor:$,bg:Z,style:te,...ie}=F;return{...ie,ref:L,"data-popper-arrow":"",style:rj(F)}},[]),V=x.useCallback((F={},L=null)=>({...F,ref:L,"data-popper-arrow-inner":""}),[]);return{update(){var F;(F=k.current)==null||F.update()},forceUpdate(){var F;(F=k.current)==null||F.forceUpdate()},transformOrigin:Vt.transformOrigin.varRef,referenceRef:I,popperRef:D,getPopperProps:_,getArrowProps:z,getArrowInnerProps:V,getReferenceProps:T}}function rj(e){const{size:t,shadowColor:n,bg:r,style:i}=e,s={...i,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function Ah(e={}){const{onClose:t,onOpen:n,isOpen:r,id:i}=e,s=Ut(n),c=Ut(t),[u,f]=x.useState(e.defaultIsOpen||!1),h=r!==void 0?r:u,p=r!==void 0,g=x.useId(),y=i??`disclosure-${g}`,S=x.useCallback(()=>{p||f(!1),c==null||c()},[p,c]),C=x.useCallback(()=>{p||f(!0),s==null||s()},[p,s]),w=x.useCallback(()=>{h?S():C()},[h,C,S]);function k(M={}){return{...M,"aria-expanded":h,"aria-controls":y,onClick(P){var I;(I=M.onClick)==null||I.call(M,P),w()}}}function j(M={}){return{...M,hidden:!h,id:y}}return{isOpen:h,onOpen:C,onClose:S,onToggle:w,isControlled:p,getButtonProps:k,getDisclosureProps:j}}function ij(e){const{ref:t,handler:n,enabled:r=!0}=e,i=Ut(n),c=x.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;x.useEffect(()=>{if(!r)return;const u=g=>{wd(g,t)&&(c.isPointerDown=!0)},f=g=>{if(c.ignoreEmulatedMouseEvents){c.ignoreEmulatedMouseEvents=!1;return}c.isPointerDown&&n&&wd(g,t)&&(c.isPointerDown=!1,i(g))},h=g=>{c.ignoreEmulatedMouseEvents=!0,n&&c.isPointerDown&&wd(g,t)&&(c.isPointerDown=!1,i(g))},p=zx(t.current);return p.addEventListener("mousedown",u,!0),p.addEventListener("mouseup",f,!0),p.addEventListener("touchstart",u,!0),p.addEventListener("touchend",h,!0),()=>{p.removeEventListener("mousedown",u,!0),p.removeEventListener("mouseup",f,!0),p.removeEventListener("touchstart",u,!0),p.removeEventListener("touchend",h,!0)}},[n,t,i,c,r])}function wd(e,t){var n;const r=e.target;return e.button>0||r&&!zx(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function zx(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Rx(e){const{isOpen:t,ref:n}=e,[r,i]=x.useState(t),[s,c]=x.useState(!1);return x.useEffect(()=>{s||(i(t),c(!0))},[t,s,r]),Ui(()=>n.current,"animationend",()=>{i(t)}),{present:!(t?!1:!r),onComplete(){var f;const h=c6(n.current),p=new h.CustomEvent("animationend",{bubbles:!0});(f=n.current)==null||f.dispatchEvent(p)}}}function zh(e){const{wasSelected:t,enabled:n,isSelected:r,mode:i="unmount"}=e;return!!(!n||r||i==="keepMounted"&&t)}var[oj,aj,sj,lj]=rh(),[cj,ms]=Et({strict:!1,name:"MenuContext"});function uj(e,...t){const n=x.useId(),r=e||n;return x.useMemo(()=>t.map(i=>`${i}-${r}`),[r,t])}function Nx(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Dg(e){return Nx(e).activeElement===e}function dj(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:i,autoSelect:s=!0,isLazy:c,isOpen:u,defaultIsOpen:f,onClose:h,onOpen:p,placement:g="bottom-start",lazyBehavior:y="unmount",direction:S,computePositionOnMount:C=!1,...w}=e,k=x.useRef(null),j=x.useRef(null),M=sj(),P=x.useCallback(()=>{requestAnimationFrame(()=>{var Me;(Me=k.current)==null||Me.focus({preventScroll:!1})})},[]),I=x.useCallback(()=>{const Me=setTimeout(()=>{var oe;if(i)(oe=i.current)==null||oe.focus();else{const ae=M.firstEnabled();ae&&$(ae.index)}});K.current.add(Me)},[M,i]),T=x.useCallback(()=>{const Me=setTimeout(()=>{const oe=M.lastEnabled();oe&&$(oe.index)});K.current.add(Me)},[M]),D=x.useCallback(()=>{p==null||p(),s?I():P()},[s,I,P,p]),{isOpen:_,onOpen:z,onClose:V,onToggle:F}=Ah({isOpen:u,defaultIsOpen:f,onClose:h,onOpen:D});ij({enabled:_&&r,ref:k,handler:Me=>{var oe;(oe=j.current)!=null&&oe.contains(Me.target)||V()}});const L=Oh({...w,enabled:_||C,placement:g,direction:S}),[Q,$]=x.useState(-1);eo(()=>{_||$(-1)},[_]),jx(k,{focusRef:j,visible:_,shouldFocus:!0});const Z=Rx({isOpen:_,ref:k}),[te,ie]=uj(t,"menu-button","menu-list"),U=x.useCallback(()=>{z(),P()},[z,P]),K=x.useRef(new Set([]));xj(()=>{K.current.forEach(Me=>clearTimeout(Me)),K.current.clear()});const ne=x.useCallback(()=>{z(),I()},[I,z]),ce=x.useCallback(()=>{z(),T()},[z,T]),Re=x.useCallback(()=>{var Me,oe;const ae=Nx(k.current),je=(Me=k.current)==null?void 0:Me.contains(ae.activeElement);if(!(_&&!je))return;const Ne=(oe=M.item(Q))==null?void 0:oe.node;Ne==null||Ne.focus()},[_,Q,M]),ze=x.useRef(null);return{openAndFocusMenu:U,openAndFocusFirstItem:ne,openAndFocusLastItem:ce,onTransitionEnd:Re,unstable__animationState:Z,descendants:M,popper:L,buttonId:te,menuId:ie,forceUpdate:L.forceUpdate,orientation:"vertical",isOpen:_,onToggle:F,onOpen:z,onClose:V,menuRef:k,buttonRef:j,focusedIndex:Q,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:$,isLazy:c,lazyBehavior:y,initialFocusRef:i,rafId:ze}}function fj(e={},t=null){const n=ms(),{onToggle:r,popper:i,openAndFocusFirstItem:s,openAndFocusLastItem:c}=n,u=x.useCallback(f=>{const h=f.key,g={Enter:s,ArrowDown:s,ArrowUp:c}[h];g&&(f.preventDefault(),f.stopPropagation(),g(f))},[s,c]);return{...e,ref:ct(n.buttonRef,t,i.referenceRef),id:n.buttonId,"data-active":Ye(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:Ie(e.onClick,r),onKeyDown:Ie(e.onKeyDown,u)}}function jf(e){var t;return vj(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function hj(e={},t=null){const n=ms();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:i,menuRef:s,isOpen:c,onClose:u,menuId:f,isLazy:h,lazyBehavior:p,unstable__animationState:g}=n,y=aj(),S=_6({preventDefault:j=>j.key!==" "&&jf(j.target)}),C=x.useCallback(j=>{const M=j.key,I={Tab:D=>D.preventDefault(),Escape:u,ArrowDown:()=>{const D=y.nextEnabled(r);D&&i(D.index)},ArrowUp:()=>{const D=y.prevEnabled(r);D&&i(D.index)}}[M];if(I){j.preventDefault(),I(j);return}const T=S(D=>{const _=D6(y.values(),D,z=>{var V,F;return(F=(V=z==null?void 0:z.node)==null?void 0:V.textContent)!=null?F:""},y.item(r));if(_){const z=y.indexOf(_.node);i(z)}});jf(j.target)&&T(j)},[y,r,S,u,i]),w=x.useRef(!1);c&&(w.current=!0);const k=zh({wasSelected:w.current,enabled:h,mode:p,isSelected:g.present});return{...e,ref:ct(s,t),children:k?e.children:null,tabIndex:-1,role:"menu",id:f,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:Ie(e.onKeyDown,C)}}function pj(e={}){const{popper:t,isOpen:n}=ms();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function mj(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onClick:s,onFocus:c,isDisabled:u,isFocusable:f,closeOnSelect:h,type:p,...g}=e,y=ms(),{setFocusedIndex:S,focusedIndex:C,closeOnSelect:w,onClose:k,menuRef:j,isOpen:M,menuId:P,rafId:I}=y,T=x.useRef(null),D=`${P}-menuitem-${x.useId()}`,{index:_,register:z}=lj({disabled:u&&!f}),V=x.useCallback(U=>{n==null||n(U),!u&&S(_)},[S,_,u,n]),F=x.useCallback(U=>{r==null||r(U),T.current&&!Dg(T.current)&&V(U)},[V,r]),L=x.useCallback(U=>{i==null||i(U),!u&&S(-1)},[S,u,i]),Q=x.useCallback(U=>{s==null||s(U),jf(U.currentTarget)&&(h??w)&&k()},[k,s,w,h]),$=x.useCallback(U=>{c==null||c(U),S(_)},[S,c,_]),Z=_===C,te=u&&!f;eo(()=>{M&&(Z&&!te&&T.current?(I.current&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{var U;(U=T.current)==null||U.focus(),I.current=null})):j.current&&!Dg(j.current)&&j.current.focus())},[Z,te,j,M]);const ie=kx({onClick:Q,onFocus:$,onMouseEnter:V,onMouseMove:F,onMouseLeave:L,ref:ct(z,T,t),isDisabled:u,isFocusable:f});return{...g,...ie,type:p??ie.type,id:D,role:"menuitem",tabIndex:Z?0:-1}}function vj(e){var t;if(!gj(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function gj(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function xj(e,t=[]){return x.useEffect(()=>()=>e(),t)}var[yj,Pc]=Et({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Rh=e=>{const{children:t}=e,n=fn("Menu",e),r=At(e),{direction:i}=Ji(),{descendants:s,...c}=dj({...r,direction:i}),u=x.useMemo(()=>c,[c]),{isOpen:f,onClose:h,forceUpdate:p}=u;return l.jsx(oj,{value:s,children:l.jsx(cj,{value:u,children:l.jsx(yj,{value:n,children:j1(t,{isOpen:f,onClose:h,forceUpdate:p})})})})};Rh.displayName="Menu";var Fx=he((e,t)=>{const n=Pc();return l.jsx(re.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});Fx.displayName="MenuCommand";var bj=he((e,t)=>{const{type:n,...r}=e,i=Pc(),s=r.as||n?n??void 0:"button",c=x.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...i.item}),[i.item]);return l.jsx(re.button,{ref:t,type:s,...r,__css:c})}),Lx=e=>{const{className:t,children:n,...r}=e,i=x.Children.only(n),s=x.isValidElement(i)?x.cloneElement(i,{focusable:"false","aria-hidden":!0,className:Ae("chakra-menu__icon",i.props.className)}):null,c=Ae("chakra-menu__icon-wrapper",t);return l.jsx(re.span,{className:c,...r,__css:{flexShrink:0},children:s})};Lx.displayName="MenuIcon";var pr=he((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:i,commandSpacing:s="0.75rem",children:c,...u}=e,f=mj(u,t),p=n||i?l.jsx("span",{style:{pointerEvents:"none",flex:1},children:c}):c;return l.jsxs(bj,{...f,className:Ae("chakra-menu__menuitem",f.className),children:[n&&l.jsx(Lx,{fontSize:"0.8em",marginEnd:r,children:n}),p,i&&l.jsx(Fx,{marginStart:s,children:i})]})});pr.displayName="MenuItem";var Sj={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},Cj=re(Wr.div),Nh=he(function(t,n){var r,i;const{rootProps:s,motionProps:c,...u}=t,{isOpen:f,onTransitionEnd:h,unstable__animationState:p}=ms(),g=hj(u,n),y=pj(s),S=Pc();return l.jsx(re.div,{...y,__css:{zIndex:(i=t.zIndex)!=null?i:(r=S.list)==null?void 0:r.zIndex},children:l.jsx(Cj,{variants:Sj,initial:!1,animate:f?"enter":"exit",__css:{outline:0,...S.list},...c,className:Ae("chakra-menu__menu-list",g.className),...g,onUpdate:h,onAnimationComplete:yc(p.onComplete,g.onAnimationComplete)})})});Nh.displayName="MenuList";var wj=he((e,t)=>{const n=Pc();return l.jsx(re.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),Fh=he((e,t)=>{const{children:n,as:r,...i}=e,s=fj(i,t),c=r||wj;return l.jsx(c,{...s,className:Ae("chakra-menu__menu-button",e.className),children:l.jsx(re.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});Fh.displayName="MenuButton";var kj={slideInBottom:{...df,custom:{offsetY:16,reverse:!0}},slideInRight:{...df,custom:{offsetX:16,reverse:!0}},scale:{...S2,custom:{initialScale:.95,reverse:!0}},none:{}},jj=re(Wr.section),Ej=e=>kj[e||"none"],Bx=x.forwardRef((e,t)=>{const{preset:n,motionProps:r=Ej(n),...i}=e;return l.jsx(jj,{ref:t,...r,...i})});Bx.displayName="ModalTransition";var Pj=Object.defineProperty,Ij=(e,t,n)=>t in e?Pj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mj=(e,t,n)=>(Ij(e,typeof t!="symbol"?t+"":t,n),n),Tj=class{constructor(){Mj(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},Ef=new Tj;function Hx(e,t){const[n,r]=x.useState(0);return x.useEffect(()=>{const i=e.current;if(i){if(t){const s=Ef.add(i);r(s)}return()=>{Ef.remove(i),r(0)}}},[t,e]),n}var _j=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Po=new WeakMap,kl=new WeakMap,jl={},kd=0,Wx=function(e){return e&&(e.host||Wx(e.parentNode))},Dj=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Wx(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return Boolean(n)})},Oj=function(e,t,n,r){var i=Dj(t,Array.isArray(e)?e:[e]);jl[n]||(jl[n]=new WeakMap);var s=jl[n],c=[],u=new Set,f=new Set(i),h=function(g){!g||u.has(g)||(u.add(g),h(g.parentNode))};i.forEach(h);var p=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))p(y);else{var S=y.getAttribute(r),C=S!==null&&S!=="false",w=(Po.get(y)||0)+1,k=(s.get(y)||0)+1;Po.set(y,w),s.set(y,k),c.push(y),w===1&&C&&kl.set(y,!0),k===1&&y.setAttribute(n,"true"),C||y.setAttribute(r,"true")}})};return p(t),u.clear(),kd++,function(){c.forEach(function(g){var y=Po.get(g)-1,S=s.get(g)-1;Po.set(g,y),s.set(g,S),y||(kl.has(g)||g.removeAttribute(r),kl.delete(g)),S||g.removeAttribute(n)}),kd--,kd||(Po=new WeakMap,Po=new WeakMap,kl=new WeakMap,jl={})}},Aj=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||_j(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Oj(r,i,n,"aria-hidden")):function(){return null}};function zj(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:i=!0,closeOnEsc:s=!0,useInert:c=!0,onOverlayClick:u,onEsc:f}=e,h=x.useRef(null),p=x.useRef(null),[g,y,S]=Nj(r,"chakra-modal","chakra-modal--header","chakra-modal--body");Rj(h,t&&c),Hx(h,t);const C=x.useRef(null),w=x.useCallback(z=>{C.current=z.target},[]),k=x.useCallback(z=>{z.key==="Escape"&&(z.stopPropagation(),s&&(n==null||n()),f==null||f())},[s,n,f]),[j,M]=x.useState(!1),[P,I]=x.useState(!1),T=x.useCallback((z={},V=null)=>({role:"dialog",...z,ref:ct(V,h),id:g,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?y:void 0,"aria-describedby":P?S:void 0,onClick:Ie(z.onClick,F=>F.stopPropagation())}),[S,P,g,y,j]),D=x.useCallback(z=>{z.stopPropagation(),C.current===z.target&&Ef.isTopModal(h.current)&&(i&&(n==null||n()),u==null||u())},[n,i,u]),_=x.useCallback((z={},V=null)=>({...z,ref:ct(V,p),onClick:Ie(z.onClick,D),onKeyDown:Ie(z.onKeyDown,k),onMouseDown:Ie(z.onMouseDown,w)}),[k,w,D]);return{isOpen:t,onClose:n,headerId:y,bodyId:S,setBodyMounted:I,setHeaderMounted:M,dialogRef:h,overlayRef:p,getDialogProps:T,getDialogContainerProps:_}}function Rj(e,t){const n=e.current;x.useEffect(()=>{if(!(!e.current||!t))return Aj(e.current)},[t,e,n])}function Nj(e,...t){const n=x.useId(),r=e||n;return x.useMemo(()=>t.map(i=>`${i}-${r}`),[r,t])}var[Fj,la]=Et({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[Lj,Ki]=Et({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),di=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:i,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:p,preserveScrollBarGap:g,motionPreset:y,lockFocusAcrossFrames:S,onCloseComplete:C}=t,w=fn("Modal",t),j={...zj(t),autoFocus:i,trapFocus:s,initialFocusRef:c,finalFocusRef:u,returnFocusOnClose:f,blockScrollOnMount:h,allowPinchZoom:p,preserveScrollBarGap:g,motionPreset:y,lockFocusAcrossFrames:S};return l.jsx(Lj,{value:j,children:l.jsx(Fj,{value:w,children:l.jsx(ia,{onExitComplete:C,children:j.isOpen&&l.jsx(eh,{...n,children:r})})})})};di.displayName="Modal";var ql="right-scroll-bar-position",Yl="width-before-scroll-bar",Bj="with-scroll-bars-hidden",Hj="--removed-body-scroll-bar-size",Vx=N2(),jd=function(){},Ic=x.forwardRef(function(e,t){var n=x.useRef(null),r=x.useState({onScrollCapture:jd,onWheelCapture:jd,onTouchMoveCapture:jd}),i=r[0],s=r[1],c=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,y=e.sideCar,S=e.noIsolation,C=e.inert,w=e.allowPinchZoom,k=e.as,j=k===void 0?"div":k,M=A2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),P=y,I=O2([n,t]),T=vr(vr({},M),i);return x.createElement(x.Fragment,null,p&&x.createElement(P,{sideCar:Vx,removeScrollBar:h,shards:g,noIsolation:S,inert:C,setCallbacks:s,allowPinchZoom:!!w,lockRef:n}),c?x.cloneElement(x.Children.only(u),vr(vr({},T),{ref:I})):x.createElement(j,vr({},T,{className:f,ref:I}),u))});Ic.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ic.classNames={fullWidth:Yl,zeroRight:ql};var Og,Wj=function(){if(Og)return Og;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Vj(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Wj();return t&&e.setAttribute("nonce",t),e}function Uj(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $j(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Gj=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Vj())&&(Uj(t,n),$j(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},qj=function(){var e=Gj();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ux=function(){var e=qj(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},Yj={left:0,top:0,right:0,gap:0},Ed=function(e){return parseInt(e||"",10)||0},Xj=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Ed(n),Ed(r),Ed(i)]},Kj=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Yj;var t=Xj(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Qj=Ux(),Zj=function(e,t,n,r){var i=e.left,s=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),` + .`.concat(Bj,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(u,"px ").concat(r,`; + } + body { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(i,`px; + padding-top: `).concat(s,`px; + padding-right: `).concat(c,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(u,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(ql,` { + right: `).concat(u,"px ").concat(r,`; + } + + .`).concat(Yl,` { + margin-right: `).concat(u,"px ").concat(r,`; + } + + .`).concat(ql," .").concat(ql,` { + right: 0 `).concat(r,`; + } + + .`).concat(Yl," .").concat(Yl,` { + margin-right: 0 `).concat(r,`; + } + + body { + `).concat(Hj,": ").concat(u,`px; + } +`)},Jj=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r,s=x.useMemo(function(){return Kj(i)},[i]);return x.createElement(Qj,{styles:Zj(s,!t,i,n?"":"!important")})},Pf=!1;if(typeof window<"u")try{var El=Object.defineProperty({},"passive",{get:function(){return Pf=!0,!0}});window.addEventListener("test",El,El),window.removeEventListener("test",El,El)}catch{Pf=!1}var Io=Pf?{passive:!1}:!1,eE=function(e){return e.tagName==="TEXTAREA"},$x=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!eE(e)&&n[t]==="visible")},tE=function(e){return $x(e,"overflowY")},nE=function(e){return $x(e,"overflowX")},Ag=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=Gx(e,n);if(r){var i=qx(e,n),s=i[1],c=i[2];if(s>c)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},rE=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},iE=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Gx=function(e,t){return e==="v"?tE(t):nE(t)},qx=function(e,t){return e==="v"?rE(t):iE(t)},oE=function(e,t){return e==="h"&&t==="rtl"?-1:1},aE=function(e,t,n,r,i){var s=oE(e,window.getComputedStyle(t).direction),c=s*r,u=n.target,f=t.contains(u),h=!1,p=c>0,g=0,y=0;do{var S=qx(e,u),C=S[0],w=S[1],k=S[2],j=w-k-s*C;(C||j)&&Gx(e,u)&&(g+=j,y+=C),u=u.parentNode}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(p&&(i&&g===0||!i&&c>g)||!p&&(i&&y===0||!i&&-c>y))&&(h=!0),h},Pl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},zg=function(e){return[e.deltaX,e.deltaY]},Rg=function(e){return e&&"current"in e?e.current:e},sE=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lE=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},cE=0,Mo=[];function uE(e){var t=x.useRef([]),n=x.useRef([0,0]),r=x.useRef(),i=x.useState(cE++)[0],s=x.useState(function(){return Ux()})[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=xf([e.lockRef.current],(e.shards||[]).map(Rg),!0).filter(Boolean);return w.forEach(function(k){return k.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var u=x.useCallback(function(w,k){if("touches"in w&&w.touches.length===2)return!c.current.allowPinchZoom;var j=Pl(w),M=n.current,P="deltaX"in w?w.deltaX:M[0]-j[0],I="deltaY"in w?w.deltaY:M[1]-j[1],T,D=w.target,_=Math.abs(P)>Math.abs(I)?"h":"v";if("touches"in w&&_==="h"&&D.type==="range")return!1;var z=Ag(_,D);if(!z)return!0;if(z?T=_:(T=_==="v"?"h":"v",z=Ag(_,D)),!z)return!1;if(!r.current&&"changedTouches"in w&&(P||I)&&(r.current=T),!T)return!0;var V=r.current||T;return aE(V,k,w,V==="h"?P:I,!0)},[]),f=x.useCallback(function(w){var k=w;if(!(!Mo.length||Mo[Mo.length-1]!==s)){var j="deltaY"in k?zg(k):Pl(k),M=t.current.filter(function(T){return T.name===k.type&&T.target===k.target&&sE(T.delta,j)})[0];if(M&&M.should){k.cancelable&&k.preventDefault();return}if(!M){var P=(c.current.shards||[]).map(Rg).filter(Boolean).filter(function(T){return T.contains(k.target)}),I=P.length>0?u(k,P[0]):!c.current.noIsolation;I&&k.cancelable&&k.preventDefault()}}},[]),h=x.useCallback(function(w,k,j,M){var P={name:w,delta:k,target:j,should:M};t.current.push(P),setTimeout(function(){t.current=t.current.filter(function(I){return I!==P})},1)},[]),p=x.useCallback(function(w){n.current=Pl(w),r.current=void 0},[]),g=x.useCallback(function(w){h(w.type,zg(w),w.target,u(w,e.lockRef.current))},[]),y=x.useCallback(function(w){h(w.type,Pl(w),w.target,u(w,e.lockRef.current))},[]);x.useEffect(function(){return Mo.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,Io),document.addEventListener("touchmove",f,Io),document.addEventListener("touchstart",p,Io),function(){Mo=Mo.filter(function(w){return w!==s}),document.removeEventListener("wheel",f,Io),document.removeEventListener("touchmove",f,Io),document.removeEventListener("touchstart",p,Io)}},[]);var S=e.removeScrollBar,C=e.inert;return x.createElement(x.Fragment,null,C?x.createElement(s,{styles:lE(i)}):null,S?x.createElement(Jj,{gapMode:"margin"}):null)}const dE=h5(Vx,uE);var Yx=x.forwardRef(function(e,t){return x.createElement(Ic,vr({},e,{ref:t,sideCar:dE}))});Yx.classNames=Ic.classNames;const fE=Yx;function hE(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:i,blockScrollOnMount:s,allowPinchZoom:c,finalFocusRef:u,returnFocusOnClose:f,preserveScrollBarGap:h,lockFocusAcrossFrames:p,isOpen:g}=Ki(),[y,S]=C3();x.useEffect(()=>{!y&&S&&setTimeout(S)},[y,S]);const C=Hx(r,g);return l.jsx(mx,{autoFocus:t,isDisabled:!n,initialFocusRef:i,finalFocusRef:u,restoreFocus:f,contentRef:r,lockFocusAcrossFrames:p,children:l.jsx(fE,{removeScrollBar:!h,allowPinchZoom:c,enabled:C===1&&s,forwardProps:!0,children:e.children})})}var fi=he((e,t)=>{const{className:n,children:r,containerProps:i,motionProps:s,...c}=e,{getDialogProps:u,getDialogContainerProps:f}=Ki(),h=u(c,t),p=f(i),g=Ae("chakra-modal__content",n),y=la(),S={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...y.dialog},C={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...y.dialogContainer},{motionPreset:w}=Ki();return l.jsx(hE,{children:l.jsx(re.div,{...p,className:"chakra-modal__content-container",tabIndex:-1,__css:C,children:l.jsx(Bx,{preset:w,motionProps:s,className:g,...h,__css:S,children:r})})})});fi.displayName="ModalContent";function Xx(e){const{leastDestructiveRef:t,...n}=e;return l.jsx(di,{...n,initialFocusRef:t})}var Kx=he((e,t)=>l.jsx(fi,{ref:t,role:"alertdialog",...e})),zr=he((e,t)=>{const{className:n,...r}=e,i=Ae("chakra-modal__footer",n),c={display:"flex",alignItems:"center",justifyContent:"flex-end",...la().footer};return l.jsx(re.footer,{ref:t,...r,__css:c,className:i})});zr.displayName="ModalFooter";var Rr=he((e,t)=>{const{className:n,...r}=e,{headerId:i,setHeaderMounted:s}=Ki();x.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__header",n),f={flex:0,...la().header};return l.jsx(re.header,{ref:t,className:c,id:i,...r,__css:f})});Rr.displayName="ModalHeader";var pE=re(Wr.div),Nr=he((e,t)=>{const{className:n,transition:r,motionProps:i,...s}=e,c=Ae("chakra-modal__overlay",n),f={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...la().overlay},{motionPreset:h}=Ki(),g=i||(h==="none"?{}:b2);return l.jsx(pE,{...g,__css:f,ref:t,className:c,...s})});Nr.displayName="ModalOverlay";var Fr=he((e,t)=>{const{className:n,...r}=e,{bodyId:i,setBodyMounted:s}=Ki();x.useEffect(()=>(s(!0),()=>s(!1)),[s]);const c=Ae("chakra-modal__body",n),u=la();return l.jsx(re.div,{ref:t,className:c,id:i,...r,__css:u.body})});Fr.displayName="ModalBody";var ca=he((e,t)=>{const{onClick:n,className:r,...i}=e,{onClose:s}=Ki(),c=Ae("chakra-modal__close-btn",r),u=la();return l.jsx(w3,{ref:t,__css:u.closeButton,className:c,onClick:Ie(n,f=>{f.stopPropagation(),s()}),...i})});ca.displayName="ModalCloseButton";var mE=e=>l.jsx(Jt,{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),vE=e=>l.jsx(Jt,{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function Ng(e,t,n,r){x.useEffect(()=>{var i;if(!e.current||!r)return;const s=(i=e.current.ownerDocument.defaultView)!=null?i:window,c=Array.isArray(t)?t:[t],u=new s.MutationObserver(f=>{for(const h of f)h.type==="attributes"&&h.attributeName&&c.includes(h.attributeName)&&n(h)});return u.observe(e.current,{attributes:!0,attributeFilter:c}),()=>u.disconnect()})}function gE(e,t){const n=Ut(e);x.useEffect(()=>{let r=null;const i=()=>n();return t!==null&&(r=window.setInterval(i,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var xE=50,Fg=300;function yE(e,t){const[n,r]=x.useState(!1),[i,s]=x.useState(null),[c,u]=x.useState(!0),f=x.useRef(null),h=()=>clearTimeout(f.current);gE(()=>{i==="increment"&&e(),i==="decrement"&&t()},n?xE:null);const p=x.useCallback(()=>{c&&e(),f.current=setTimeout(()=>{u(!1),r(!0),s("increment")},Fg)},[e,c]),g=x.useCallback(()=>{c&&t(),f.current=setTimeout(()=>{u(!1),r(!0),s("decrement")},Fg)},[t,c]),y=x.useCallback(()=>{u(!0),r(!1),h()},[]);return x.useEffect(()=>()=>h(),[]),{up:p,down:g,stop:y,isSpinning:n}}var bE=/^[Ee0-9+\-.]$/;function SE(e){return bE.test(e)}function CE(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function wE(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:i=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:c=1,isReadOnly:u,isDisabled:f,isRequired:h,isInvalid:p,pattern:g="[0-9]*(.[0-9]+)?",inputMode:y="decimal",allowMouseWheel:S,id:C,onChange:w,precision:k,name:j,"aria-describedby":M,"aria-label":P,"aria-labelledby":I,onFocus:T,onBlur:D,onInvalid:_,getAriaValueText:z,isValidCharacter:V,format:F,parse:L,...Q}=e,$=Ut(T),Z=Ut(D),te=Ut(_),ie=Ut(V??SE),U=Ut(z),K=Xw(e),{update:ne,increment:ce,decrement:Re}=K,[ze,Me]=x.useState(!1),oe=!(u||f),ae=x.useRef(null),je=x.useRef(null),Be=x.useRef(null),Ne=x.useRef(null),Ge=x.useCallback(J=>J.split("").filter(ie).join(""),[ie]),Qe=x.useCallback(J=>{var He;return(He=L==null?void 0:L(J))!=null?He:J},[L]),ve=x.useCallback(J=>{var He;return((He=F==null?void 0:F(J))!=null?He:J).toString()},[F]);eo(()=>{(K.valueAsNumber>s||K.valueAsNumber{if(!ae.current)return;if(ae.current.value!=K.value){const He=Qe(ae.current.value);K.setValue(Ge(He))}},[Qe,Ge]);const _e=x.useCallback((J=c)=>{oe&&ce(J)},[ce,oe,c]),qe=x.useCallback((J=c)=>{oe&&Re(J)},[Re,oe,c]),ge=yE(_e,qe);Ng(Be,"disabled",ge.stop,ge.isSpinning),Ng(Ne,"disabled",ge.stop,ge.isSpinning);const Te=x.useCallback(J=>{if(J.nativeEvent.isComposing)return;const nt=Qe(J.currentTarget.value);ne(Ge(nt)),je.current={start:J.currentTarget.selectionStart,end:J.currentTarget.selectionEnd}},[ne,Ge,Qe]),et=x.useCallback(J=>{var He,nt,Ft;$==null||$(J),je.current&&(J.target.selectionStart=(nt=je.current.start)!=null?nt:(He=J.currentTarget.value)==null?void 0:He.length,J.currentTarget.selectionEnd=(Ft=je.current.end)!=null?Ft:J.currentTarget.selectionStart)},[$]),Ve=x.useCallback(J=>{if(J.nativeEvent.isComposing)return;CE(J,ie)||J.preventDefault();const He=vt(J)*c,nt=J.key,pe={ArrowUp:()=>_e(He),ArrowDown:()=>qe(He),Home:()=>ne(i),End:()=>ne(s)}[nt];pe&&(J.preventDefault(),pe(J))},[ie,c,_e,qe,ne,i,s]),vt=J=>{let He=1;return(J.metaKey||J.ctrlKey)&&(He=.1),J.shiftKey&&(He=10),He},Nt=x.useMemo(()=>{const J=U==null?void 0:U(K.value);if(J!=null)return J;const He=K.value.toString();return He||void 0},[K.value,U]),N=x.useCallback(()=>{let J=K.value;if(K.value==="")return;/^[eE]/.test(K.value.toString())?K.setValue(""):(K.valueAsNumbers&&(J=s),K.cast(J))},[K,s,i]),de=x.useCallback(()=>{Me(!1),n&&N()},[n,Me,N]),xe=x.useCallback(()=>{t&&requestAnimationFrame(()=>{var J;(J=ae.current)==null||J.focus()})},[t]),Ee=x.useCallback(J=>{J.preventDefault(),ge.up(),xe()},[xe,ge]),q=x.useCallback(J=>{J.preventDefault(),ge.down(),xe()},[xe,ge]);Ui(()=>ae.current,"wheel",J=>{var He,nt;const pe=((nt=(He=ae.current)==null?void 0:He.ownerDocument)!=null?nt:document).activeElement===ae.current;if(!S||!pe)return;J.preventDefault();const De=vt(J)*c,hn=Math.sign(J.deltaY);hn===-1?_e(De):hn===1&&qe(De)},{passive:!1});const le=x.useCallback((J={},He=null)=>{const nt=f||r&&K.isAtMax;return{...J,ref:ct(He,Be),role:"button",tabIndex:-1,onPointerDown:Ie(J.onPointerDown,Ft=>{Ft.button!==0||nt||Ee(Ft)}),onPointerLeave:Ie(J.onPointerLeave,ge.stop),onPointerUp:Ie(J.onPointerUp,ge.stop),disabled:nt,"aria-disabled":Dr(nt)}},[K.isAtMax,r,Ee,ge.stop,f]),Fe=x.useCallback((J={},He=null)=>{const nt=f||r&&K.isAtMin;return{...J,ref:ct(He,Ne),role:"button",tabIndex:-1,onPointerDown:Ie(J.onPointerDown,Ft=>{Ft.button!==0||nt||q(Ft)}),onPointerLeave:Ie(J.onPointerLeave,ge.stop),onPointerUp:Ie(J.onPointerUp,ge.stop),disabled:nt,"aria-disabled":Dr(nt)}},[K.isAtMin,r,q,ge.stop,f]),Ze=x.useCallback((J={},He=null)=>{var nt,Ft,pe,De;return{name:j,inputMode:y,type:"text",pattern:g,"aria-labelledby":I,"aria-label":P,"aria-describedby":M,id:C,disabled:f,...J,readOnly:(nt=J.readOnly)!=null?nt:u,"aria-readonly":(Ft=J.readOnly)!=null?Ft:u,"aria-required":(pe=J.required)!=null?pe:h,required:(De=J.required)!=null?De:h,ref:ct(ae,He),value:ve(K.value),role:"spinbutton","aria-valuemin":i,"aria-valuemax":s,"aria-valuenow":Number.isNaN(K.valueAsNumber)?void 0:K.valueAsNumber,"aria-invalid":Dr(p??K.isOutOfRange),"aria-valuetext":Nt,autoComplete:"off",autoCorrect:"off",onChange:Ie(J.onChange,Te),onKeyDown:Ie(J.onKeyDown,Ve),onFocus:Ie(J.onFocus,et,()=>Me(!0)),onBlur:Ie(J.onBlur,Z,de)}},[j,y,g,I,P,ve,M,C,f,h,u,p,K.value,K.valueAsNumber,K.isOutOfRange,i,s,Nt,Te,Ve,et,Z,de]);return{value:ve(K.value),valueAsNumber:K.valueAsNumber,isFocused:ze,isDisabled:f,isReadOnly:u,getIncrementButtonProps:le,getDecrementButtonProps:Fe,getInputProps:Ze,htmlProps:Q}}var[kE,Mc]=Et({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[jE,Lh]=Et({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Bh=he(function(t,n){const r=fn("NumberInput",t),i=At(t),s=uh(i),{htmlProps:c,...u}=wE(s),f=x.useMemo(()=>u,[u]);return l.jsx(jE,{value:f,children:l.jsx(kE,{value:r,children:l.jsx(re.div,{...c,ref:n,className:Ae("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Bh.displayName="NumberInput";var Hh=he(function(t,n){const r=Mc();return l.jsx(re.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});Hh.displayName="NumberInputStepper";var Wh=he(function(t,n){const{getInputProps:r}=Lh(),i=r(t,n),s=Mc();return l.jsx(re.input,{...i,className:Ae("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});Wh.displayName="NumberInputField";var Qx=re("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),Vh=he(function(t,n){var r;const i=Mc(),{getDecrementButtonProps:s}=Lh(),c=s(t,n);return l.jsx(Qx,{...c,__css:i.stepper,children:(r=t.children)!=null?r:l.jsx(mE,{})})});Vh.displayName="NumberDecrementStepper";var Uh=he(function(t,n){var r;const{getIncrementButtonProps:i}=Lh(),s=i(t,n),c=Mc();return l.jsx(Qx,{...s,__css:c.stepper,children:(r=t.children)!=null?r:l.jsx(vE,{})})});Uh.displayName="NumberIncrementStepper";var[EE,vs]=Et({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[PE,$h]=Et({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Gh(e){const t=x.Children.only(e.children),{getTriggerProps:n}=vs();return x.cloneElement(t,n(t.props,t.ref))}Gh.displayName="PopoverTrigger";var To={click:"click",hover:"hover"};function IE(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:i,returnFocusOnClose:s=!0,autoFocus:c=!0,arrowSize:u,arrowShadowColor:f,trigger:h=To.click,openDelay:p=200,closeDelay:g=200,isLazy:y,lazyBehavior:S="unmount",computePositionOnMount:C,...w}=e,{isOpen:k,onClose:j,onOpen:M,onToggle:P}=Ah(e),I=x.useRef(null),T=x.useRef(null),D=x.useRef(null),_=x.useRef(!1),z=x.useRef(!1);k&&(z.current=!0);const[V,F]=x.useState(!1),[L,Q]=x.useState(!1),$=x.useId(),Z=i??$,[te,ie,U,K]=["popover-trigger","popover-content","popover-header","popover-body"].map(Te=>`${Te}-${Z}`),{referenceRef:ne,getArrowProps:ce,getPopperProps:Re,getArrowInnerProps:ze,forceUpdate:Me}=Oh({...w,enabled:k||!!C}),oe=Rx({isOpen:k,ref:D});n5({enabled:k,ref:T}),jx(D,{focusRef:T,visible:k,shouldFocus:s&&h===To.click}),R6(D,{focusRef:r,visible:k,shouldFocus:c&&h===To.click});const ae=zh({wasSelected:z.current,enabled:y,mode:S,isSelected:oe.present}),je=x.useCallback((Te={},et=null)=>{const Ve={...Te,style:{...Te.style,transformOrigin:Vt.transformOrigin.varRef,[Vt.arrowSize.var]:u?`${u}px`:void 0,[Vt.arrowShadowColor.var]:f},ref:ct(D,et),children:ae?Te.children:null,id:ie,tabIndex:-1,role:"dialog",onKeyDown:Ie(Te.onKeyDown,vt=>{n&&vt.key==="Escape"&&j()}),onBlur:Ie(Te.onBlur,vt=>{const Nt=Lg(vt),N=Pd(D.current,Nt),de=Pd(T.current,Nt);k&&t&&(!N&&!de)&&j()}),"aria-labelledby":V?U:void 0,"aria-describedby":L?K:void 0};return h===To.hover&&(Ve.role="tooltip",Ve.onMouseEnter=Ie(Te.onMouseEnter,()=>{_.current=!0}),Ve.onMouseLeave=Ie(Te.onMouseLeave,vt=>{vt.nativeEvent.relatedTarget!==null&&(_.current=!1,setTimeout(()=>j(),g))})),Ve},[ae,ie,V,U,L,K,h,n,j,k,t,g,f,u]),Be=x.useCallback((Te={},et=null)=>Re({...Te,style:{visibility:k?"visible":"hidden",...Te.style}},et),[k,Re]),Ne=x.useCallback((Te,et=null)=>({...Te,ref:ct(et,I,ne)}),[I,ne]),Ge=x.useRef(),Qe=x.useRef(),ve=x.useCallback(Te=>{I.current==null&&ne(Te)},[ne]),_e=x.useCallback((Te={},et=null)=>{const Ve={...Te,ref:ct(T,et,ve),id:te,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":ie};return h===To.click&&(Ve.onClick=Ie(Te.onClick,P)),h===To.hover&&(Ve.onFocus=Ie(Te.onFocus,()=>{Ge.current===void 0&&M()}),Ve.onBlur=Ie(Te.onBlur,vt=>{const Nt=Lg(vt),N=!Pd(D.current,Nt);k&&t&&N&&j()}),Ve.onKeyDown=Ie(Te.onKeyDown,vt=>{vt.key==="Escape"&&j()}),Ve.onMouseEnter=Ie(Te.onMouseEnter,()=>{_.current=!0,Ge.current=window.setTimeout(()=>M(),p)}),Ve.onMouseLeave=Ie(Te.onMouseLeave,()=>{_.current=!1,Ge.current&&(clearTimeout(Ge.current),Ge.current=void 0),Qe.current=window.setTimeout(()=>{_.current===!1&&j()},g)})),Ve},[te,k,ie,h,ve,P,M,t,j,p,g]);x.useEffect(()=>()=>{Ge.current&&clearTimeout(Ge.current),Qe.current&&clearTimeout(Qe.current)},[]);const qe=x.useCallback((Te={},et=null)=>({...Te,id:U,ref:ct(et,Ve=>{F(!!Ve)})}),[U]),ge=x.useCallback((Te={},et=null)=>({...Te,id:K,ref:ct(et,Ve=>{Q(!!Ve)})}),[K]);return{forceUpdate:Me,isOpen:k,onAnimationComplete:oe.onComplete,onClose:j,getAnchorProps:Ne,getArrowProps:ce,getArrowInnerProps:ze,getPopoverPositionerProps:Be,getPopoverProps:je,getTriggerProps:_e,getHeaderProps:qe,getBodyProps:ge}}function Pd(e,t){return e===t||(e==null?void 0:e.contains(t))}function Lg(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function qh(e){const t=fn("Popover",e),{children:n,...r}=At(e),i=Ji(),s=IE({...r,direction:i.direction});return l.jsx(EE,{value:s,children:l.jsx(PE,{value:t,children:j1(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}qh.displayName="Popover";function Yh(e){var t;const{bg:n,bgColor:r,backgroundColor:i,shadow:s,boxShadow:c}=e,{getArrowProps:u,getArrowInnerProps:f}=vs(),h=$h(),p=(t=n??r)!=null?t:i,g=s??c;return l.jsx(re.div,{...u(),className:"chakra-popover__arrow-positioner",children:l.jsx(re.div,{className:Ae("chakra-popover__arrow",e.className),...f(e),__css:{"--popper-arrow-bg":p?`colors.${p}, ${p}`:void 0,"--popper-arrow-shadow":g?`shadows.${g}, ${g}`:void 0,...h.arrow}})})}Yh.displayName="PopoverArrow";var Zx=he(function(t,n){const{getBodyProps:r}=vs(),i=$h();return l.jsx(re.div,{...r(t,n),className:Ae("chakra-popover__body",t.className),__css:i.body})});Zx.displayName="PopoverBody";function ME(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var TE={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},_E=re(Wr.section),Jx=he(function(t,n){const{variants:r=TE,...i}=t,{isOpen:s}=vs();return l.jsx(_E,{ref:n,variants:ME(r),initial:!1,animate:s?"enter":"exit",...i})});Jx.displayName="PopoverTransition";var Xh=he(function(t,n){const{rootProps:r,motionProps:i,...s}=t,{getPopoverProps:c,getPopoverPositionerProps:u,onAnimationComplete:f}=vs(),h=$h(),p={position:"relative",display:"flex",flexDirection:"column",...h.content};return l.jsx(re.div,{...u(r),__css:h.popper,className:"chakra-popover__popper",children:l.jsx(Jx,{...i,...c(s,n),onAnimationComplete:yc(f,s.onAnimationComplete),className:Ae("chakra-popover__content",t.className),__css:p})})});Xh.displayName="PopoverContent";function DE(e,t,n){return(e-t)*100/(n-t)}Zi({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}});Zi({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}});var OE=Zi({"0%":{left:"-40%"},"100%":{left:"100%"}}),AE=Zi({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function zE(e){const{value:t=0,min:n,max:r,valueText:i,getValueText:s,isIndeterminate:c,role:u="progressbar"}=e,f=DE(t,n,r);return{bind:{"data-indeterminate":c?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":c?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,f):i})(),role:u},percent:f,value:t}}var[RE,NE]=Et({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),FE=he((e,t)=>{const{min:n,max:r,value:i,isIndeterminate:s,role:c,...u}=e,f=zE({value:i,min:n,max:r,isIndeterminate:s,role:c}),p={height:"100%",...NE().filledTrack};return l.jsx(re.div,{ref:t,style:{width:`${f.percent}%`,...u.style},...f.bind,...u,__css:p})}),ey=he((e,t)=>{var n;const{value:r,min:i=0,max:s=100,hasStripe:c,isAnimated:u,children:f,borderRadius:h,isIndeterminate:p,"aria-label":g,"aria-labelledby":y,"aria-valuetext":S,title:C,role:w,...k}=At(e),j=fn("Progress",e),M=h??((n=j.track)==null?void 0:n.borderRadius),P={animation:`${AE} 1s linear infinite`},D={...!p&&c&&u&&P,...p&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${OE} 1s ease infinite normal none running`}},_={overflow:"hidden",position:"relative",...j.track};return l.jsx(re.div,{ref:t,borderRadius:M,__css:_,...k,children:l.jsxs(RE,{value:j,children:[l.jsx(FE,{"aria-label":g,"aria-labelledby":y,"aria-valuetext":S,min:i,max:s,value:r,isIndeterminate:p,css:D,borderRadius:M,title:C,role:w}),f]})})});ey.displayName="Progress";function LE(e){return e&&Kd(e)&&Kd(e.target)}function BE(e={}){const{onChange:t,value:n,defaultValue:r,name:i,isDisabled:s,isFocusable:c,isNative:u,...f}=e,[h,p]=x.useState(r||""),g=typeof n<"u",y=g?n:h,S=x.useRef(null),C=x.useCallback(()=>{const T=S.current;if(!T)return;let D="input:not(:disabled):checked";const _=T.querySelector(D);if(_){_.focus();return}D="input:not(:disabled)";const z=T.querySelector(D);z==null||z.focus()},[]),k=`radio-${x.useId()}`,j=i||k,M=x.useCallback(T=>{const D=LE(T)?T.target.value:T;g||p(D),t==null||t(String(D))},[t,g]),P=x.useCallback((T={},D=null)=>({...T,ref:ct(D,S),role:"radiogroup"}),[]),I=x.useCallback((T={},D=null)=>({...T,ref:D,name:j,[u?"checked":"isChecked"]:y!=null?T.value===y:void 0,onChange(z){M(z)},"data-radiogroup":!0}),[u,j,M,y]);return{getRootProps:P,getRadioProps:I,name:j,ref:S,focus:C,setValue:p,value:y,onChange:M,isDisabled:s,isFocusable:c,htmlProps:f}}var[HE,ty]=Et({name:"RadioGroupContext",strict:!1}),Ja=he((e,t)=>{const{colorScheme:n,size:r,variant:i,children:s,className:c,isDisabled:u,isFocusable:f,...h}=e,{value:p,onChange:g,getRootProps:y,name:S,htmlProps:C}=BE(h),w=x.useMemo(()=>({name:S,size:r,onChange:g,colorScheme:n,value:p,variant:i,isDisabled:u,isFocusable:f}),[S,r,g,n,p,i,u,f]);return l.jsx(HE,{value:w,children:l.jsx(re.div,{...y(C,t),className:Ae("chakra-radio-group",c),children:s})})});Ja.displayName="RadioGroup";var WE={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function VE(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:i,isReadOnly:s,isRequired:c,onChange:u,isInvalid:f,name:h,value:p,id:g,"data-radiogroup":y,"aria-describedby":S,...C}=e,w=`radio-${x.useId()}`,k=no(),M=!!ty()||!!y;let I=!!k&&!M?k.id:w;I=g??I;const T=i??(k==null?void 0:k.isDisabled),D=s??(k==null?void 0:k.isReadOnly),_=c??(k==null?void 0:k.isRequired),z=f??(k==null?void 0:k.isInvalid),[V,F]=x.useState(!1),[L,Q]=x.useState(!1),[$,Z]=x.useState(!1),[te,ie]=x.useState(!1),[U,K]=x.useState(Boolean(t)),ne=typeof n<"u",ce=ne?n:U;x.useEffect(()=>j2(F),[]);const Re=x.useCallback(ve=>{if(D||T){ve.preventDefault();return}ne||K(ve.target.checked),u==null||u(ve)},[ne,T,D,u]),ze=x.useCallback(ve=>{ve.key===" "&&ie(!0)},[ie]),Me=x.useCallback(ve=>{ve.key===" "&&ie(!1)},[ie]),oe=x.useCallback((ve={},_e=null)=>({...ve,ref:_e,"data-active":Ye(te),"data-hover":Ye($),"data-disabled":Ye(T),"data-invalid":Ye(z),"data-checked":Ye(ce),"data-focus":Ye(L),"data-focus-visible":Ye(L&&V),"data-readonly":Ye(D),"aria-hidden":!0,onMouseDown:Ie(ve.onMouseDown,()=>ie(!0)),onMouseUp:Ie(ve.onMouseUp,()=>ie(!1)),onMouseEnter:Ie(ve.onMouseEnter,()=>Z(!0)),onMouseLeave:Ie(ve.onMouseLeave,()=>Z(!1))}),[te,$,T,z,ce,L,D,V]),{onFocus:ae,onBlur:je}=k??{},Be=x.useCallback((ve={},_e=null)=>{const qe=T&&!r;return{...ve,id:I,ref:_e,type:"radio",name:h,value:p,onChange:Ie(ve.onChange,Re),onBlur:Ie(je,ve.onBlur,()=>Q(!1)),onFocus:Ie(ae,ve.onFocus,()=>Q(!0)),onKeyDown:Ie(ve.onKeyDown,ze),onKeyUp:Ie(ve.onKeyUp,Me),checked:ce,disabled:qe,readOnly:D,required:_,"aria-invalid":Dr(z),"aria-disabled":Dr(qe),"aria-required":Dr(_),"data-readonly":Ye(D),"aria-describedby":S,style:WE}},[T,r,I,h,p,Re,je,ae,ze,Me,ce,D,_,z,S]);return{state:{isInvalid:z,isFocused:L,isChecked:ce,isActive:te,isHovered:$,isDisabled:T,isReadOnly:D,isRequired:_},getCheckboxProps:oe,getInputProps:Be,getLabelProps:(ve={},_e=null)=>({...ve,ref:_e,onMouseDown:Ie(ve.onMouseDown,Bg),onTouchStart:Ie(ve.onTouchStart,Bg),"data-disabled":Ye(T),"data-checked":Ye(ce),"data-invalid":Ye(z)}),getRootProps:(ve,_e=null)=>({...ve,ref:_e,"data-disabled":Ye(T),"data-checked":Ye(ce),"data-invalid":Ye(z)}),htmlProps:C}}function Bg(e){e.preventDefault(),e.stopPropagation()}function UE(e,t){const n={},r={};for(const[i,s]of Object.entries(e))t.includes(i)?n[i]=s:r[i]=s;return[n,r]}var vn=he((e,t)=>{var n;const r=ty(),{onChange:i,value:s}=e,c=fn("Radio",{...r,...e}),u=At(e),{spacing:f="0.5rem",children:h,isDisabled:p=r==null?void 0:r.isDisabled,isFocusable:g=r==null?void 0:r.isFocusable,inputProps:y,...S}=u;let C=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(C=r.value===s);let w=i;r!=null&&r.onChange&&s!=null&&(w=yc(r.onChange,i));const k=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:j,getCheckboxProps:M,getLabelProps:P,getRootProps:I,htmlProps:T}=VE({...S,isChecked:C,isFocusable:g,isDisabled:p,onChange:w,name:k}),[D,_]=UE(T,E1),z=M(_),V=j(y,t),F=P(),L=Object.assign({},D,I()),Q={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...c.container},$={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...c.control},Z={userSelect:"none",marginStart:f,...c.label};return l.jsxs(re.label,{className:"chakra-radio",...L,__css:Q,children:[l.jsx("input",{className:"chakra-radio__input",...V}),l.jsx(re.span,{className:"chakra-radio__control",...z,__css:$}),h&&l.jsx(re.span,{className:"chakra-radio__label",...F,__css:Z,children:h})]})});vn.displayName="Radio";var ny=he(function(t,n){const{children:r,placeholder:i,className:s,...c}=t;return l.jsxs(re.select,{...c,ref:n,className:Ae("chakra-select",s),children:[i&&l.jsx("option",{value:"",children:i}),r]})});ny.displayName="SelectField";function $E(e,t){const n={},r={};for(const[i,s]of Object.entries(e))t.includes(i)?n[i]=s:r[i]=s;return[n,r]}var ry=he((e,t)=>{var n;const r=fn("Select",e),{rootProps:i,placeholder:s,icon:c,color:u,height:f,h,minH:p,minHeight:g,iconColor:y,iconSize:S,...C}=At(e),[w,k]=$E(C,E1),j=ch(k),M={width:"100%",height:"fit-content",position:"relative",color:u},P={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return l.jsxs(re.div,{className:"chakra-select__wrapper",__css:M,...w,...i,children:[l.jsx(ny,{ref:t,height:h??f,minH:p??g,placeholder:s,...j,__css:P,children:e.children}),l.jsx(iy,{"data-disabled":Ye(j.disabled),...(y||u)&&{color:y||u},__css:r.icon,...S&&{fontSize:S},children:c})]})});ry.displayName="Select";var GE=e=>l.jsx("svg",{viewBox:"0 0 24 24",...e,children:l.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),qE=re("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),iy=e=>{const{children:t=l.jsx(GE,{}),...n}=e,r=x.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return l.jsx(qE,{...n,className:"chakra-select__icon-wrapper",children:x.isValidElement(t)?r:null})};iy.displayName="SelectIcon";var _o=e=>e?"":void 0,Id=e=>e?!0:void 0,gs=(...e)=>e.filter(Boolean).join(" ");function Md(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function Il(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var Xl={width:0,height:0},Ml=e=>e||Xl;function YE(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:i}=e,s=w=>{var k;const j=(k=r[w])!=null?k:Xl;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",...Il({orientation:t,vertical:{bottom:`calc(${n[w]}% - ${j.height/2}px)`},horizontal:{left:`calc(${n[w]}% - ${j.width/2}px)`}})}},c=t==="vertical"?r.reduce((w,k)=>Ml(w).height>Ml(k).height?w:k,Xl):r.reduce((w,k)=>Ml(w).width>Ml(k).width?w:k,Xl),u={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,...Il({orientation:t,vertical:c?{paddingLeft:c.width/2,paddingRight:c.width/2}:{},horizontal:c?{paddingTop:c.height/2,paddingBottom:c.height/2}:{}})},f={position:"absolute",...Il({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},h=n.length===1,p=[0,i?100-n[0]:n[0]],g=h?p:n;let y=g[0];!h&&i&&(y=100-y);const S=Math.abs(g[g.length-1]-g[0]),C={...f,...Il({orientation:t,vertical:i?{height:`${S}%`,top:`${y}%`}:{height:`${S}%`,bottom:`${y}%`},horizontal:i?{width:`${S}%`,right:`${y}%`}:{width:`${S}%`,left:`${y}%`}})};return{trackStyle:f,innerTrackStyle:C,rootStyle:u,getThumbStyle:s}}function XE(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function KE(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function QE(e){const t=JE(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function oy(e){return!!e.touches}function ZE(e){return oy(e)&&e.touches.length>1}function JE(e){var t;return(t=e.view)!=null?t:window}function e7(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function t7(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function ay(e,t="page"){return oy(e)?e7(e,t):t7(e,t)}function n7(e){return t=>{const n=QE(t);(!n||n&&t.button===0)&&e(t)}}function r7(e,t=!1){function n(i){e(i,{point:ay(i)})}return t?n7(n):n}function Kl(e,t,n,r){return KE(e,t,r7(n,t==="pointerdown"),r)}var i7=Object.defineProperty,o7=(e,t,n)=>t in e?i7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tr=(e,t,n)=>(o7(e,typeof t!="symbol"?t+"":t,n),n),a7=class{constructor(e,t,n){tr(this,"history",[]),tr(this,"startEvent",null),tr(this,"lastEvent",null),tr(this,"lastEventInfo",null),tr(this,"handlers",{}),tr(this,"removeListeners",()=>{}),tr(this,"threshold",3),tr(this,"win"),tr(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const u=Td(this.lastEventInfo,this.history),f=this.startEvent!==null,h=u7(u.offset,{x:0,y:0})>=this.threshold;if(!f&&!h)return;const{timestamp:p}=eg();this.history.push({...u.point,timestamp:p});const{onStart:g,onMove:y}=this.handlers;f||(g==null||g(this.lastEvent,u),this.startEvent=this.lastEvent),y==null||y(this.lastEvent,u)}),tr(this,"onPointerMove",(u,f)=>{this.lastEvent=u,this.lastEventInfo=f,R3.update(this.updatePoint,!0)}),tr(this,"onPointerUp",(u,f)=>{const h=Td(f,this.history),{onEnd:p,onSessionEnd:g}=this.handlers;g==null||g(u,h),this.end(),!(!p||!this.startEvent)&&(p==null||p(u,h))});var r;if(this.win=(r=e.view)!=null?r:window,ZE(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const i={point:ay(e)},{timestamp:s}=eg();this.history=[{...i.point,timestamp:s}];const{onSessionStart:c}=t;c==null||c(e,Td(i,this.history)),this.removeListeners=c7(Kl(this.win,"pointermove",this.onPointerMove),Kl(this.win,"pointerup",this.onPointerUp),Kl(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),N3.update(this.updatePoint)}};function Hg(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Td(e,t){return{point:e.point,delta:Hg(e.point,t[t.length-1]),offset:Hg(e.point,t[0]),velocity:l7(t,.1)}}var s7=e=>e*1e3;function l7(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=e[e.length-1];for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>s7(t)));)n--;if(!r)return{x:0,y:0};const s=(i.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const c={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function c7(...e){return t=>e.reduce((n,r)=>r(n),t)}function _d(e,t){return Math.abs(e-t)}function Wg(e){return"x"in e&&"y"in e}function u7(e,t){if(typeof e=="number"&&typeof t=="number")return _d(e,t);if(Wg(e)&&Wg(t)){const n=_d(e.x,t.x),r=_d(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function sy(e){const t=x.useRef(null);return t.current=e,t}function d7(e,t){const{onPan:n,onPanStart:r,onPanEnd:i,onPanSessionStart:s,onPanSessionEnd:c,threshold:u}=t,f=Boolean(n||r||i||s||c),h=x.useRef(null),p=sy({onSessionStart:s,onSessionEnd:c,onStart:r,onMove:n,onEnd(g,y){h.current=null,i==null||i(g,y)}});x.useEffect(()=>{var g;(g=h.current)==null||g.updateHandlers(p.current)}),x.useEffect(()=>{const g=e.current;if(!g||!f)return;function y(S){h.current=new a7(S,p.current,u)}return Kl(g,"pointerdown",y)},[e,f,p,u]),x.useEffect(()=>()=>{var g;(g=h.current)==null||g.end(),h.current=null},[])}function f7(e,t){var n;if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const r=(n=e.ownerDocument.defaultView)!=null?n:window,i=new r.ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const[c]=s;let u,f;if("borderBoxSize"in c){const h=c.borderBoxSize,p=Array.isArray(h)?h[0]:h;u=p.inlineSize,f=p.blockSize}else u=e.offsetWidth,f=e.offsetHeight;t({width:u,height:f})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}var h7=Boolean(globalThis==null?void 0:globalThis.document)?x.useLayoutEffect:x.useEffect;function p7(e,t){var n,r;if(!e||!e.parentElement)return;const i=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new i.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function m7({getNodes:e,observeMutation:t=!0}){const[n,r]=x.useState([]),[i,s]=x.useState(0);return h7(()=>{const c=e(),u=c.map((f,h)=>f7(f,p=>{r(g=>[...g.slice(0,h),p,...g.slice(h+1)])}));if(t){const f=c[0];u.push(p7(f,()=>{s(h=>h+1)}))}return()=>{u.forEach(f=>{f==null||f()})}},[i]),n}function v7(e){return typeof e=="object"&&e!==null&&"current"in e}function g7(e){const[t]=m7({observeMutation:!1,getNodes(){return[v7(e)?e.current:e]}});return t}function x7(e){var t;const{min:n=0,max:r=100,onChange:i,value:s,defaultValue:c,isReversed:u,direction:f="ltr",orientation:h="horizontal",id:p,isDisabled:g,isReadOnly:y,onChangeStart:S,onChangeEnd:C,step:w=1,getAriaValueText:k,"aria-valuetext":j,"aria-label":M,"aria-labelledby":P,name:I,focusThumbOnChange:T=!0,...D}=e,_=Ut(S),z=Ut(C),V=Ut(k),F=XE({isReversed:u,direction:f,orientation:h}),[L,Q]=oh({value:s,defaultValue:c??b7(n,r),onChange:i}),[$,Z]=x.useState(!1),[te,ie]=x.useState(!1),U=!(g||y),K=(r-n)/10,ne=w||(r-n)/100,ce=$l(L,n,r),Re=r-ce+n,Me=ug(F?Re:ce,n,r),oe=h==="vertical",ae=sy({min:n,max:r,step:w,isDisabled:g,value:ce,isInteractive:U,isReversed:F,isVertical:oe,eventSource:null,focusThumbOnChange:T,orientation:h}),je=x.useRef(null),Be=x.useRef(null),Ne=x.useRef(null),Ge=x.useId(),Qe=p??Ge,[ve,_e]=[`slider-thumb-${Qe}`,`slider-track-${Qe}`],qe=x.useCallback(pe=>{var De,hn;if(!je.current)return;const $t=ae.current;$t.eventSource="pointer";const pn=je.current.getBoundingClientRect(),{clientX:ir,clientY:yi}=(hn=(De=pe.touches)==null?void 0:De[0])!=null?hn:pe,da=oe?pn.bottom-yi:ir-pn.left,Kc=oe?pn.height:pn.width;let fa=da/Kc;F&&(fa=1-fa);let bi=Yw(fa,$t.min,$t.max);return $t.step&&(bi=parseFloat(dg(bi,$t.min,$t.step))),bi=$l(bi,$t.min,$t.max),bi},[oe,F,ae]),ge=x.useCallback(pe=>{const De=ae.current;De.isInteractive&&(pe=parseFloat(dg(pe,De.min,ne)),pe=$l(pe,De.min,De.max),Q(pe))},[ne,Q,ae]),Te=x.useMemo(()=>({stepUp(pe=ne){const De=F?ce-pe:ce+pe;ge(De)},stepDown(pe=ne){const De=F?ce+pe:ce-pe;ge(De)},reset(){ge(c||0)},stepTo(pe){ge(pe)}}),[ge,F,ce,ne,c]),et=x.useCallback(pe=>{const De=ae.current,$t={ArrowRight:()=>Te.stepUp(),ArrowUp:()=>Te.stepUp(),ArrowLeft:()=>Te.stepDown(),ArrowDown:()=>Te.stepDown(),PageUp:()=>Te.stepUp(K),PageDown:()=>Te.stepDown(K),Home:()=>ge(De.min),End:()=>ge(De.max)}[pe.key];$t&&(pe.preventDefault(),pe.stopPropagation(),$t(pe),De.eventSource="keyboard")},[Te,ge,K,ae]),Ve=(t=V==null?void 0:V(ce))!=null?t:j,vt=g7(Be),{getThumbStyle:Nt,rootStyle:N,trackStyle:de,innerTrackStyle:xe}=x.useMemo(()=>{const pe=ae.current,De=vt??{width:0,height:0};return YE({isReversed:F,orientation:pe.orientation,thumbRects:[De],thumbPercents:[Me]})},[F,vt,Me,ae]),Ee=x.useCallback(()=>{ae.current.focusThumbOnChange&&setTimeout(()=>{var De;return(De=Be.current)==null?void 0:De.focus()})},[ae]);eo(()=>{const pe=ae.current;Ee(),pe.eventSource==="keyboard"&&(z==null||z(pe.value))},[ce,z]);function q(pe){const De=qe(pe);De!=null&&De!==ae.current.value&&Q(De)}d7(Ne,{onPanSessionStart(pe){const De=ae.current;De.isInteractive&&(Z(!0),Ee(),q(pe),_==null||_(De.value))},onPanSessionEnd(){const pe=ae.current;pe.isInteractive&&(Z(!1),z==null||z(pe.value))},onPan(pe){ae.current.isInteractive&&q(pe)}});const le=x.useCallback((pe={},De=null)=>({...pe,...D,ref:ct(De,Ne),tabIndex:-1,"aria-disabled":Id(g),"data-focused":_o(te),style:{...pe.style,...N}}),[D,g,te,N]),Fe=x.useCallback((pe={},De=null)=>({...pe,ref:ct(De,je),id:_e,"data-disabled":_o(g),style:{...pe.style,...de}}),[g,_e,de]),Ze=x.useCallback((pe={},De=null)=>({...pe,ref:De,style:{...pe.style,...xe}}),[xe]),J=x.useCallback((pe={},De=null)=>({...pe,ref:ct(De,Be),role:"slider",tabIndex:U?0:void 0,id:ve,"data-active":_o($),"aria-valuetext":Ve,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":ce,"aria-orientation":h,"aria-disabled":Id(g),"aria-readonly":Id(y),"aria-label":M,"aria-labelledby":M?void 0:P,style:{...pe.style,...Nt(0)},onKeyDown:Md(pe.onKeyDown,et),onFocus:Md(pe.onFocus,()=>ie(!0)),onBlur:Md(pe.onBlur,()=>ie(!1))}),[U,ve,$,Ve,n,r,ce,h,g,y,M,P,Nt,et]),He=x.useCallback((pe,De=null)=>{const hn=!(pe.valuer),$t=ce>=pe.value,pn=ug(pe.value,n,r),ir={position:"absolute",pointerEvents:"none",...y7({orientation:h,vertical:{bottom:F?`${100-pn}%`:`${pn}%`},horizontal:{left:F?`${100-pn}%`:`${pn}%`}})};return{...pe,ref:De,role:"presentation","aria-hidden":!0,"data-disabled":_o(g),"data-invalid":_o(!hn),"data-highlighted":_o($t),style:{...pe.style,...ir}}},[g,F,r,n,h,ce]),nt=x.useCallback((pe={},De=null)=>({...pe,ref:De,type:"hidden",value:ce,name:I}),[I,ce]);return{state:{value:ce,isFocused:te,isDragging:$},actions:Te,getRootProps:le,getTrackProps:Fe,getInnerTrackProps:Ze,getThumbProps:J,getMarkerProps:He,getInputProps:nt}}function y7(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function b7(e,t){return t"}),[C7,_c]=Et({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),ly=he((e,t)=>{const n={orientation:"horizontal",...e},r=fn("Slider",n),i=At(n),{direction:s}=Ji();i.direction=s;const{getInputProps:c,getRootProps:u,...f}=x7(i),h=u(),p=c({},t);return l.jsx(S7,{value:f,children:l.jsx(C7,{value:r,children:l.jsxs(re.div,{...h,className:gs("chakra-slider",n.className),__css:r.container,children:[n.children,l.jsx("input",{...p})]})})})});ly.displayName="Slider";var cy=he((e,t)=>{const{getThumbProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__thumb",e.className),__css:r.thumb})});cy.displayName="SliderThumb";var uy=he((e,t)=>{const{getTrackProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__track",e.className),__css:r.track})});uy.displayName="SliderTrack";var dy=he((e,t)=>{const{getInnerTrackProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__filled-track",e.className),__css:r.filledTrack})});dy.displayName="SliderFilledTrack";var If=he((e,t)=>{const{getMarkerProps:n}=Tc(),r=_c(),i=n(e,t);return l.jsx(re.div,{...i,className:gs("chakra-slider__marker",e.className),__css:r.mark})});If.displayName="SliderMark";var fy=he(function(t,n){const r=fn("Switch",t),{spacing:i="0.5rem",children:s,...c}=At(t),{state:u,getInputProps:f,getCheckboxProps:h,getRootProps:p,getLabelProps:g}=E2(c),y=x.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),S=x.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),C=x.useMemo(()=>({userSelect:"none",marginStart:i,...r.label}),[i,r.label]);return l.jsxs(re.label,{...p(),className:Ae("chakra-switch",t.className),__css:y,children:[l.jsx("input",{className:"chakra-switch__input",...f({},n)}),l.jsx(re.span,{...h(),className:"chakra-switch__track",__css:S,children:l.jsx(re.span,{__css:r.thumb,className:"chakra-switch__thumb","data-checked":Ye(u.isChecked),"data-hover":Ye(u.isHovered)})}),s&&l.jsx(re.span,{className:"chakra-switch__label",...g(),__css:C,children:s})]})});fy.displayName="Switch";var[w7,k7,j7,E7]=rh();function P7(e){var t;const{defaultIndex:n,onChange:r,index:i,isManual:s,isLazy:c,lazyBehavior:u="unmount",orientation:f="horizontal",direction:h="ltr",...p}=e,[g,y]=x.useState(n??0),[S,C]=oh({defaultValue:n??0,value:i,onChange:r});x.useEffect(()=>{i!=null&&y(i)},[i]);const w=j7(),k=x.useId();return{id:`tabs-${(t=e.id)!=null?t:k}`,selectedIndex:S,focusedIndex:g,setSelectedIndex:C,setFocusedIndex:y,isManual:s,isLazy:c,lazyBehavior:u,orientation:f,descendants:w,direction:h,htmlProps:p}}var[I7,Dc]=Et({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function M7(e){const{focusedIndex:t,orientation:n,direction:r}=Dc(),i=k7(),s=x.useCallback(c=>{const u=()=>{var M;const P=i.nextEnabled(t);P&&((M=P.node)==null||M.focus())},f=()=>{var M;const P=i.prevEnabled(t);P&&((M=P.node)==null||M.focus())},h=()=>{var M;const P=i.firstEnabled();P&&((M=P.node)==null||M.focus())},p=()=>{var M;const P=i.lastEnabled();P&&((M=P.node)==null||M.focus())},g=n==="horizontal",y=n==="vertical",S=c.key,C=r==="ltr"?"ArrowLeft":"ArrowRight",w=r==="ltr"?"ArrowRight":"ArrowLeft",j={[C]:()=>g&&f(),[w]:()=>g&&u(),ArrowDown:()=>y&&u(),ArrowUp:()=>y&&f(),Home:h,End:p}[S];j&&(c.preventDefault(),j(c))},[i,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:Ie(e.onKeyDown,s)}}function T7(e){const{isDisabled:t,isFocusable:n,...r}=e,{setSelectedIndex:i,isManual:s,id:c,setFocusedIndex:u,selectedIndex:f}=Dc(),{index:h,register:p}=E7({disabled:t&&!n}),g=h===f,y=()=>{i(h)},S=()=>{u(h),!s&&!(t&&n)&&i(h)},C=kx({...r,ref:ct(p,e.ref),isDisabled:t,isFocusable:n,onClick:Ie(e.onClick,y)}),w="button";return{...C,id:hy(c,h),role:"tab",tabIndex:g?0:-1,type:w,"aria-selected":g,"aria-controls":py(c,h),onFocus:t?void 0:Ie(e.onFocus,S)}}var[_7,D7]=Et({});function O7(e){const t=Dc(),{id:n,selectedIndex:r}=t,s=lh(e.children).map((c,u)=>x.createElement(_7,{key:u,value:{isSelected:u===r,id:py(n,u),tabId:hy(n,u),selectedIndex:r}},c));return{...e,children:s}}function A7(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:i}=Dc(),{isSelected:s,id:c,tabId:u}=D7(),f=x.useRef(!1);s&&(f.current=!0);const h=zh({wasSelected:f.current,isSelected:s,enabled:r,mode:i});return{tabIndex:0,...n,children:h?t:null,role:"tabpanel","aria-labelledby":u,hidden:!s,id:c}}function hy(e,t){return`${e}--tab-${t}`}function py(e,t){return`${e}--tabpanel-${t}`}var[z7,Oc]=Et({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),my=he(function(t,n){const r=fn("Tabs",t),{children:i,className:s,...c}=At(t),{htmlProps:u,descendants:f,...h}=P7(c),p=x.useMemo(()=>h,[h]),{isFitted:g,...y}=u;return l.jsx(w7,{value:f,children:l.jsx(I7,{value:p,children:l.jsx(z7,{value:r,children:l.jsx(re.div,{className:Ae("chakra-tabs",s),ref:n,...y,__css:r.root,children:i})})})})});my.displayName="Tabs";var vy=he(function(t,n){const r=M7({...t,ref:n}),s={display:"flex",...Oc().tablist};return l.jsx(re.div,{...r,className:Ae("chakra-tabs__tablist",t.className),__css:s})});vy.displayName="TabList";var gy=he(function(t,n){const r=A7({...t,ref:n}),i=Oc();return l.jsx(re.div,{outline:"0",...r,className:Ae("chakra-tabs__tab-panel",t.className),__css:i.tabpanel})});gy.displayName="TabPanel";var xy=he(function(t,n){const r=O7(t),i=Oc();return l.jsx(re.div,{...r,width:"100%",ref:n,className:Ae("chakra-tabs__tab-panels",t.className),__css:i.tabpanels})});xy.displayName="TabPanels";var yy=he(function(t,n){const r=Oc(),i=T7({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return l.jsx(re.button,{...i,className:Ae("chakra-tabs__tab",t.className),__css:s})});yy.displayName="Tab";function R7(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var N7=["h","minH","height","minHeight"],Kh=he((e,t)=>{const n=pi("Textarea",e),{className:r,rows:i,...s}=At(e),c=ch(s),u=i?R7(n,N7):n;return l.jsx(re.textarea,{ref:t,rows:i,...c,className:Ae("chakra-textarea",r),__css:u})});Kh.displayName="Textarea";var F7={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},cc=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},Mf=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function L7(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:i,closeOnScroll:s,closeOnPointerDown:c=i,closeOnEsc:u=!0,onOpen:f,onClose:h,placement:p,id:g,isOpen:y,defaultIsOpen:S,arrowSize:C=10,arrowShadowColor:w,arrowPadding:k,modifiers:j,isDisabled:M,gutter:P,offset:I,direction:T,...D}=e,{isOpen:_,onOpen:z,onClose:V}=Ah({isOpen:y,defaultIsOpen:S,onOpen:f,onClose:h}),{referenceRef:F,getPopperProps:L,getArrowInnerProps:Q,getArrowProps:$}=Oh({enabled:_,placement:p,arrowPadding:k,modifiers:j,gutter:P,offset:I,direction:T}),Z=x.useId(),ie=`tooltip-${g??Z}`,U=x.useRef(null),K=x.useRef(),ne=x.useCallback(()=>{K.current&&(clearTimeout(K.current),K.current=void 0)},[]),ce=x.useRef(),Re=x.useCallback(()=>{ce.current&&(clearTimeout(ce.current),ce.current=void 0)},[]),ze=x.useCallback(()=>{Re(),V()},[V,Re]),Me=B7(U,ze),oe=x.useCallback(()=>{if(!M&&!K.current){Me();const _e=Mf(U);K.current=_e.setTimeout(z,t)}},[Me,M,z,t]),ae=x.useCallback(()=>{ne();const _e=Mf(U);ce.current=_e.setTimeout(ze,n)},[n,ze,ne]),je=x.useCallback(()=>{_&&r&&ae()},[r,ae,_]),Be=x.useCallback(()=>{_&&c&&ae()},[c,ae,_]),Ne=x.useCallback(_e=>{_&&_e.key==="Escape"&&ae()},[_,ae]);Ui(()=>cc(U),"keydown",u?Ne:void 0),Ui(()=>cc(U),"scroll",()=>{_&&s&&ze()}),x.useEffect(()=>{M&&(ne(),_&&V())},[M,_,V,ne]),x.useEffect(()=>()=>{ne(),Re()},[ne,Re]),Ui(()=>U.current,"pointerleave",ae);const Ge=x.useCallback((_e={},qe=null)=>({..._e,ref:ct(U,qe,F),onPointerEnter:Ie(_e.onPointerEnter,Te=>{Te.pointerType!=="touch"&&oe()}),onClick:Ie(_e.onClick,je),onPointerDown:Ie(_e.onPointerDown,Be),onFocus:Ie(_e.onFocus,oe),onBlur:Ie(_e.onBlur,ae),"aria-describedby":_?ie:void 0}),[oe,ae,Be,_,ie,je,F]),Qe=x.useCallback((_e={},qe=null)=>L({..._e,style:{..._e.style,[Vt.arrowSize.var]:C?`${C}px`:void 0,[Vt.arrowShadowColor.var]:w}},qe),[L,C,w]),ve=x.useCallback((_e={},qe=null)=>{const ge={..._e.style,position:"relative",transformOrigin:Vt.transformOrigin.varRef};return{ref:qe,...D,..._e,id:ie,role:"tooltip",style:ge}},[D,ie]);return{isOpen:_,show:oe,hide:ae,getTriggerProps:Ge,getTooltipProps:ve,getTooltipPositionerProps:Qe,getArrowProps:$,getArrowInnerProps:Q}}var Dd="chakra-ui:close-tooltip";function B7(e,t){return x.useEffect(()=>{const n=cc(e);return n.addEventListener(Dd,t),()=>n.removeEventListener(Dd,t)},[t,e]),()=>{const n=cc(e),r=Mf(e);n.dispatchEvent(new r.CustomEvent(Dd))}}function H7(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function W7(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var V7=re(Wr.div),Yt=he((e,t)=>{var n,r;const i=pi("Tooltip",e),s=At(e),c=Ji(),{children:u,label:f,shouldWrapChildren:h,"aria-label":p,hasArrow:g,bg:y,portalProps:S,background:C,backgroundColor:w,bgColor:k,motionProps:j,...M}=s,P=(r=(n=C??w)!=null?n:y)!=null?r:k;if(P){i.bg=P;const L=BS(c,"colors",P);i[Vt.arrowBg.var]=L}const I=L7({...M,direction:c.direction}),T=typeof u=="string"||h;let D;if(T)D=l.jsx(re.span,{display:"inline-block",tabIndex:0,...I.getTriggerProps(),children:u});else{const L=x.Children.only(u);D=x.cloneElement(L,I.getTriggerProps(L.props,L.ref))}const _=!!p,z=I.getTooltipProps({},t),V=_?H7(z,["role","id"]):z,F=W7(z,["role","id"]);return f?l.jsxs(l.Fragment,{children:[D,l.jsx(ia,{children:I.isOpen&&l.jsx(eh,{...S,children:l.jsx(re.div,{...I.getTooltipPositionerProps(),__css:{zIndex:i.zIndex,pointerEvents:"none"},children:l.jsxs(V7,{variants:F7,initial:"exit",animate:"enter",exit:"exit",...j,...V,__css:i,children:[f,_&&l.jsx(re.span,{srOnly:!0,...F,children:p}),g&&l.jsx(re.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:l.jsx(re.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:i.bg}})})]})})})})]}):l.jsx(l.Fragment,{children:u})});Yt.displayName="Tooltip";const Qh=x.createContext(null);let Vg;const Zh=()=>({setOpenUploader:e=>{e&&(Vg=e)},openUploader:Vg}),Bt=be(e=>e.ui,e=>HS[e.activeTab],{memoizeOptions:{equalityCheck:ee.isEqual}}),U7=be(e=>e.ui,e=>e.activeTab,{memoizeOptions:{equalityCheck:ee.isEqual}}),ro=be(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:ee.isEqual}}),Ug=e=>async(t,n)=>{const{imageFile:r}=e,i=n(),s=Bt(i),c=new FormData;c.append("file",r,r.name),c.append("data",JSON.stringify({kind:"init"}));const f=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:c})).json(),h={uuid:P1(),category:"user",...f};t(I1({image:h,category:"user"})),s==="unifiedCanvas"?t(bc(h)):s==="img2img"&&t(os(h))},Jh=e=>{const{children:t}=e;return l.jsx(B,{sx:{width:"100%",height:"100%",bg:"base.850"},children:t})};function $7(){const{t:e}=Y();return l.jsx(Jh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.nodes")}),l.jsx(Le,{maxW:"50rem",gap:4,children:l.jsx(Ce,{children:e("common.nodesDesc")})})]})})}const G7=()=>{const{t:e}=Y();return l.jsx(Jh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.postProcessing")}),l.jsxs(Le,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.postProcessDesc1")}),l.jsx(Ce,{children:e("common.postProcessDesc2")}),l.jsx(Ce,{children:e("common.postProcessDesc3")})]})]})})};function q7(){const{t:e}=Y();return l.jsx(Jh,{children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",w:"100%",h:"100%",gap:4,textAlign:"center"},children:[l.jsx(Vn,{children:e("common.training")}),l.jsxs(Le,{maxW:"50rem",gap:4,children:[l.jsx(Ce,{children:e("common.trainingDesc1")}),l.jsx(Ce,{children:e("common.trainingDesc2")})]})]})})}function Y7(e){const{i18n:t}=Y(),n=localStorage.getItem("i18nextLng");ke.useEffect(()=>{e()},[e]),ke.useEffect(()=>{t.on("languageChanged",()=>{e()})},[e,t,n])}const ue=he((e,t)=>{const{tooltip:n="",tooltipProps:r,isChecked:i,...s}=e;return l.jsx(Yt,{label:n,hasArrow:!0,...r,...r!=null&&r.placement?{placement:r.placement}:{placement:"top"},children:l.jsx(ci,{ref:t,"aria-checked":i!==void 0?i:void 0,...s})})}),Je=he((e,t)=>{const{children:n,tooltip:r="",tooltipProps:i,isChecked:s,...c}=e;return l.jsx(Yt,{label:r,...i,children:l.jsx(to,{ref:t,"aria-checked":s,...c,children:n})})}),rr=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:i=!0,...s}=e;return l.jsxs(qh,{isLazy:i,...s,children:[l.jsx(Gh,{children:t}),l.jsxs(Xh,{children:[r&&l.jsx(Yh,{}),n]})]})},Ac=be(e=>e.lightbox,e=>e,{memoizeOptions:{equalityCheck:ee.isEqual}}),Mn=e=>{const{label:t,isDisabled:n,validValues:r,tooltip:i,tooltipProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,onClick:u=>{u.stopPropagation(),u.nativeEvent.stopImmediatePropagation(),u.nativeEvent.stopPropagation(),u.nativeEvent.cancelBubble=!0},children:[t&&l.jsx(st,{children:t}),l.jsx(Yt,{label:i,...s,children:l.jsx(ry,{...c,children:r.map(u=>typeof u=="string"||typeof u=="number"?l.jsx("option",{value:u,children:u},u):l.jsx("option",{value:u.value,children:u.key},u.value))})})]})};function X7(){const e=O(i=>i.postprocessing.facetoolType),t=X(),{t:n}=Y(),r=i=>t(Hl(i.target.value));return l.jsx(Mn,{label:n("parameters.type"),validValues:WS.concat(),value:e,onChange:r})}var by={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},$g=ke.createContext&&ke.createContext(by),si=globalThis&&globalThis.__assign||function(){return si=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{ne(i)},[i]);const ce=x.useMemo(()=>L!=null&&L.max?L.max:c,[c,L==null?void 0:L.max]),Re=ae=>{f(ae)},ze=ae=>{ae.target.value===""&&(ae.target.value=String(s));const je=ee.clamp(y?Math.floor(Number(ae.target.value)):Number(K),s,ce);f(je)},Me=ae=>{ne(ae)},oe=()=>{M&&M()};return l.jsxs(rt,{sx:j?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},...D,children:[l.jsx(st,{..._,mb:-1,children:r}),l.jsxs(sa,{w:"100%",gap:2,alignItems:"center",children:[l.jsxs(ly,{"aria-label":r,value:i,min:s,max:c,step:u,onChange:Re,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),focusThumbOnChange:!1,isDisabled:I,...ie,children:[p&&l.jsxs(l.Fragment,{children:[l.jsx(If,{value:s,insetInlineStart:0,sx:{insetInlineStart:"unset !important"},...z,children:s}),l.jsx(If,{value:c,insetInlineEnd:0,sx:{insetInlineStart:"unset !important"},...z,children:c})]}),l.jsx(uy,{...V,children:l.jsx(dy,{})}),l.jsx(Yt,{hasArrow:!0,placement:"top",isOpen:t,label:`${i}${h}`,hidden:k,...Z,children:l.jsx(cy,{...F})})]}),g&&l.jsxs(Bh,{min:s,max:ce,step:u,value:K,onChange:Me,onBlur:ze,isDisabled:T,...L,children:[l.jsx(Wh,{readOnly:C,minWidth:S,...Q}),l.jsxs(Hh,{...$,children:[l.jsx(Uh,{onClick:()=>f(Number(K))}),l.jsx(Vh,{onClick:()=>f(Number(K))})]})]}),w&&l.jsx(ue,{size:"sm","aria-label":U("accessibility.reset"),tooltip:"Reset",icon:l.jsx(ep,{}),onClick:oe,isDisabled:P,...te})]})]})}function r8(){const e=O(i=>i.system.isGFPGANAvailable),t=O(i=>i.postprocessing.facetoolStrength),{t:n}=Y(),r=X();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.strength"),step:.05,min:0,max:1,onChange:i=>r(Zl(i)),handleReset:()=>r(Zl(.75)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}function i8(){const e=O(i=>i.system.isGFPGANAvailable),t=O(i=>i.postprocessing.codeformerFidelity),{t:n}=Y(),r=X();return l.jsx(ut,{isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e,label:n("parameters.codeformerFidelity"),step:.05,min:0,max:1,onChange:i=>r(Qd(i)),handleReset:()=>r(Qd(1)),value:t,withReset:!0,withSliderMarks:!0,withInput:!0})}const tp=()=>{const e=O(t=>t.postprocessing.facetoolType);return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(X7,{}),l.jsx(r8,{}),e==="codeformer"&&l.jsx(i8,{})]})};function o8(){const e=O(i=>i.system.isESRGANAvailable),t=O(i=>i.postprocessing.upscalingDenoising),{t:n}=Y(),r=X();return l.jsx(ut,{label:n("parameters.denoisingStrength"),value:t,min:0,max:1,step:.01,onChange:i=>{r(Zd(i))},handleReset:()=>r(Zd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function a8(){const e=O(i=>i.system.isESRGANAvailable),t=O(i=>i.postprocessing.upscalingStrength),{t:n}=Y(),r=X();return l.jsx(ut,{label:`${n("parameters.upscale")} ${n("parameters.strength")}`,value:t,min:0,max:1,step:.05,onChange:i=>r(Jd(i)),handleReset:()=>r(Jd(.75)),withSliderMarks:!0,withInput:!0,withReset:!0,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})}function s8(){const e=O(s=>s.system.isESRGANAvailable),t=O(s=>s.postprocessing.upscalingLevel),{t:n}=Y(),r=X(),i=s=>r(M1(Number(s.target.value)));return l.jsx(Mn,{isDisabled:!e,label:n("parameters.scale"),value:t,onChange:i,validValues:VS})}const np=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(s8,{}),l.jsx(o8,{}),l.jsx(a8,{})]}),rp=e=>e.postprocessing,Pt=e=>e.system,l8=e=>e.system.toastQueue,wy=be(Pt,e=>{const{model_list:t}=e,n=ee.reduce(t,(r,i,s)=>(i.status==="active"&&(r=s),r),"");return{...t[n],name:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),c8=be(Pt,e=>{const{model_list:t}=e;return ee.pickBy(t,(r,i)=>{if(r.format==="diffusers")return{name:i,...r}})},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Tf(){return Tf=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var g8=function(t,n,r){r===void 0&&(r=!1);var i=n.alt,s=n.meta,c=n.mod,u=n.shift,f=n.ctrl,h=n.keys,p=t.key,g=t.code,y=t.ctrlKey,S=t.metaKey,C=t.shiftKey,w=t.altKey,k=ii(g),j=p.toLowerCase();if(!r){if(i===!w&&j!=="alt"||u===!C&&j!=="shift")return!1;if(c){if(!S&&!y)return!1}else if(s===!S&&j!=="meta"||f===!y&&j!=="ctrl")return!1}return h&&h.length===1&&(h.includes(j)||h.includes(k))?!0:h?f8(h):!h},x8=x.createContext(void 0),y8=function(){return x.useContext(x8)};function Iy(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&Iy(e[r],t[r])},!0):e===t}var b8=x.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),S8=function(){return x.useContext(b8)};function C8(e){var t=x.useRef(void 0);return Iy(t.current,e)||(t.current=e),t.current}var Gg=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},w8=typeof window<"u"?x.useLayoutEffect:x.useEffect;function fe(e,t,n,r){var i=x.useRef(null),s=x.useRef(!1),c=n instanceof Array?r instanceof Array?void 0:r:n,u=n instanceof Array?n:r instanceof Array?r:void 0,f=x.useCallback(t,u??[]),h=x.useRef(f);u?h.current=f:h.current=t;var p=C8(c),g=S8(),y=g.enabledScopes,S=y8();return w8(function(){if(!((p==null?void 0:p.enabled)===!1||!v8(y,p==null?void 0:p.scopes))){var C=function(M,P){var I;if(P===void 0&&(P=!1),!(m8(M)&&!Py(M,p==null?void 0:p.enableOnFormTags))){if(i.current!==null&&document.activeElement!==i.current&&!i.current.contains(document.activeElement)){Gg(M);return}(I=M.target)!=null&&I.isContentEditable&&!(p!=null&&p.enableOnContentEditable)||Od(e,p==null?void 0:p.splitKey).forEach(function(T){var D,_=Ad(T,p==null?void 0:p.combinationKey);if(g8(M,_,p==null?void 0:p.ignoreModifiers)||(D=_.keys)!=null&&D.includes("*")){if(P&&s.current)return;if(h8(M,_,p==null?void 0:p.preventDefault),!p8(M,_,p==null?void 0:p.enabled)){Gg(M);return}h.current(M,_),P||(s.current=!0)}})}},w=function(M){M.key!==void 0&&(jy(ii(M.code)),((p==null?void 0:p.keydown)===void 0&&(p==null?void 0:p.keyup)!==!0||p!=null&&p.keydown)&&C(M))},k=function(M){M.key!==void 0&&(Ey(ii(M.code)),s.current=!1,p!=null&&p.keyup&&C(M,!0))};return(i.current||(c==null?void 0:c.document)||document).addEventListener("keyup",k),(i.current||(c==null?void 0:c.document)||document).addEventListener("keydown",w),S&&Od(e,p==null?void 0:p.splitKey).forEach(function(j){return S.addHotkey(Ad(j,p==null?void 0:p.combinationKey))}),function(){(i.current||(c==null?void 0:c.document)||document).removeEventListener("keyup",k),(i.current||(c==null?void 0:c.document)||document).removeEventListener("keydown",w),S&&Od(e,p==null?void 0:p.splitKey).forEach(function(j){return S.removeHotkey(Ad(j,p==null?void 0:p.combinationKey))})}}},[e,p,y]),i}function k8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M524.531,69.836a1.5,1.5,0,0,0-.764-.7A485.065,485.065,0,0,0,404.081,32.03a1.816,1.816,0,0,0-1.923.91,337.461,337.461,0,0,0-14.9,30.6,447.848,447.848,0,0,0-134.426,0,309.541,309.541,0,0,0-15.135-30.6,1.89,1.89,0,0,0-1.924-.91A483.689,483.689,0,0,0,116.085,69.137a1.712,1.712,0,0,0-.788.676C39.068,183.651,18.186,294.69,28.43,404.354a2.016,2.016,0,0,0,.765,1.375A487.666,487.666,0,0,0,176.02,479.918a1.9,1.9,0,0,0,2.063-.676A348.2,348.2,0,0,0,208.12,430.4a1.86,1.86,0,0,0-1.019-2.588,321.173,321.173,0,0,1-45.868-21.853,1.885,1.885,0,0,1-.185-3.126c3.082-2.309,6.166-4.711,9.109-7.137a1.819,1.819,0,0,1,1.9-.256c96.229,43.917,200.41,43.917,295.5,0a1.812,1.812,0,0,1,1.924.233c2.944,2.426,6.027,4.851,9.132,7.16a1.884,1.884,0,0,1-.162,3.126,301.407,301.407,0,0,1-45.89,21.83,1.875,1.875,0,0,0-1,2.611,391.055,391.055,0,0,0,30.014,48.815,1.864,1.864,0,0,0,2.063.7A486.048,486.048,0,0,0,610.7,405.729a1.882,1.882,0,0,0,.765-1.352C623.729,277.594,590.933,167.465,524.531,69.836ZM222.491,337.58c-28.972,0-52.844-26.587-52.844-59.239S193.056,219.1,222.491,219.1c29.665,0,53.306,26.82,52.843,59.239C275.334,310.993,251.924,337.58,222.491,337.58Zm195.38,0c-28.971,0-52.843-26.587-52.843-59.239S388.437,219.1,417.871,219.1c29.667,0,53.307,26.82,52.844,59.239C470.715,310.993,447.538,337.58,417.871,337.58Z"}}]})(e)}function j8(e){return me({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"}}]})(e)}function E8(e){return me({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M143 256.3L7 120.3c-9.4-9.4-9.4-24.6 0-33.9l22.6-22.6c9.4-9.4 24.6-9.4 33.9 0l96.4 96.4 96.4-96.4c9.4-9.4 24.6-9.4 33.9 0L313 86.3c9.4 9.4 9.4 24.6 0 33.9l-136 136c-9.4 9.5-24.6 9.5-34 .1zm34 192l136-136c9.4-9.4 9.4-24.6 0-33.9l-22.6-22.6c-9.4-9.4-24.6-9.4-33.9 0L160 352.1l-96.4-96.4c-9.4-9.4-24.6-9.4-33.9 0L7 278.3c-9.4 9.4-9.4 24.6 0 33.9l136 136c9.4 9.5 24.6 9.5 34 .1z"}}]})(e)}function P8(e){return me({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"}}]})(e)}function I8(e){return me({tag:"svg",attr:{viewBox:"0 0 256 512"},child:[{tag:"path",attr:{d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"}}]})(e)}function M8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"}}]})(e)}function T8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"}}]})(e)}function My(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M352.201 425.775l-79.196 79.196c-9.373 9.373-24.568 9.373-33.941 0l-79.196-79.196c-15.119-15.119-4.411-40.971 16.971-40.97h51.162L228 284H127.196v51.162c0 21.382-25.851 32.09-40.971 16.971L7.029 272.937c-9.373-9.373-9.373-24.569 0-33.941L86.225 159.8c15.119-15.119 40.971-4.411 40.971 16.971V228H228V127.196h-51.23c-21.382 0-32.09-25.851-16.971-40.971l79.196-79.196c9.373-9.373 24.568-9.373 33.941 0l79.196 79.196c15.119 15.119 4.411 40.971-16.971 40.971h-51.162V228h100.804v-51.162c0-21.382 25.851-32.09 40.97-16.971l79.196 79.196c9.373 9.373 9.373 24.569 0 33.941L425.773 352.2c-15.119 15.119-40.971 4.411-40.97-16.971V284H284v100.804h51.23c21.382 0 32.09 25.851 16.971 40.971z"}}]})(e)}function _8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"}}]})(e)}function D8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M511.988 288.9c-.478 17.43-15.217 31.1-32.653 31.1H424v16c0 21.864-4.882 42.584-13.6 61.145l60.228 60.228c12.496 12.497 12.496 32.758 0 45.255-12.498 12.497-32.759 12.496-45.256 0l-54.736-54.736C345.886 467.965 314.351 480 280 480V236c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v244c-34.351 0-65.886-12.035-90.636-32.108l-54.736 54.736c-12.498 12.497-32.759 12.496-45.256 0-12.496-12.497-12.496-32.758 0-45.255l60.228-60.228C92.882 378.584 88 357.864 88 336v-16H32.666C15.23 320 .491 306.33.013 288.9-.484 270.816 14.028 256 32 256h56v-58.745l-46.628-46.628c-12.496-12.497-12.496-32.758 0-45.255 12.498-12.497 32.758-12.497 45.256 0L141.255 160h229.489l54.627-54.627c12.498-12.497 32.758-12.497 45.256 0 12.496 12.497 12.496 32.758 0 45.255L424 197.255V256h56c17.972 0 32.484 14.816 31.988 32.9zM257 0c-61.856 0-112 50.144-112 112h224C369 50.144 318.856 0 257 0z"}}]})(e)}function zc(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}}]})(e)}function Ty(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}}]})(e)}function Jo(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M320 448v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24V120c0-13.255 10.745-24 24-24h72v296c0 30.879 25.121 56 56 56h168zm0-344V0H152c-13.255 0-24 10.745-24 24v368c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24V128H344c-13.2 0-24-10.8-24-24zm120.971-31.029L375.029 7.029A24 24 0 0 0 358.059 0H352v96h96v-6.059a24 24 0 0 0-7.029-16.97z"}}]})(e)}function _y(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500 224h-30.364C455.724 130.325 381.675 56.276 288 42.364V12c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v30.364C130.325 56.276 56.276 130.325 42.364 224H12c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h30.364C56.276 381.675 130.325 455.724 224 469.636V500c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-30.364C381.675 455.724 455.724 381.675 469.636 288H500c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12zM288 404.634V364c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40.634C165.826 392.232 119.783 346.243 107.366 288H148c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12h-40.634C119.768 165.826 165.757 119.783 224 107.366V148c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12v-40.634C346.174 119.768 392.217 165.757 404.634 224H364c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40.634C392.232 346.174 346.243 392.217 288 404.634zM288 256c0 17.673-14.327 32-32 32s-32-14.327-32-32c0-17.673 14.327-32 32-32s32 14.327 32 32z"}}]})(e)}function O8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M239.1 6.3l-208 78c-18.7 7-31.1 25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"}}]})(e)}function ip(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function Dy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"}}]})(e)}function A8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 344v112a23.94 23.94 0 0 1-24 24H312c-21.39 0-32.09-25.9-17-41l36.2-36.2L224 295.6 116.77 402.9 153 439c15.09 15.1 4.39 41-17 41H24a23.94 23.94 0 0 1-24-24V344c0-21.4 25.89-32.1 41-17l36.19 36.2L184.46 256 77.18 148.7 41 185c-15.1 15.1-41 4.4-41-17V56a23.94 23.94 0 0 1 24-24h112c21.39 0 32.09 25.9 17 41l-36.2 36.2L224 216.4l107.23-107.3L295 73c-15.09-15.1-4.39-41 17-41h112a23.94 23.94 0 0 1 24 24v112c0 21.4-25.89 32.1-41 17l-36.19-36.2L263.54 256l107.28 107.3L407 327.1c15.1-15.2 41-4.5 41 16.9z"}}]})(e)}function z8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z"}}]})(e)}function Oy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M50.75 333.25c-12 12-18.75 28.28-18.75 45.26V424L0 480l32 32 56-32h45.49c16.97 0 33.25-6.74 45.25-18.74l126.64-126.62-128-128L50.75 333.25zM483.88 28.12c-37.47-37.5-98.28-37.5-135.75 0l-77.09 77.09-13.1-13.1c-9.44-9.44-24.65-9.31-33.94 0l-40.97 40.97c-9.37 9.37-9.37 24.57 0 33.94l161.94 161.94c9.44 9.44 24.65 9.31 33.94 0L419.88 288c9.37-9.37 9.37-24.57 0-33.94l-13.1-13.1 77.09-77.09c37.51-37.48 37.51-98.26.01-135.75z"}}]})(e)}function R8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"}}]})(e)}function N8(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"}}]})(e)}function Ay(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M512 320s-64 92.65-64 128c0 35.35 28.66 64 64 64s64-28.65 64-64-64-128-64-128zm-9.37-102.94L294.94 9.37C288.69 3.12 280.5 0 272.31 0s-16.38 3.12-22.62 9.37l-81.58 81.58L81.93 4.76c-6.25-6.25-16.38-6.25-22.62 0L36.69 27.38c-6.24 6.25-6.24 16.38 0 22.62l86.19 86.18-94.76 94.76c-37.49 37.48-37.49 98.26 0 135.75l117.19 117.19c18.74 18.74 43.31 28.12 67.87 28.12 24.57 0 49.13-9.37 67.87-28.12l221.57-221.57c12.5-12.5 12.5-32.75.01-45.25zm-116.22 70.97H65.93c1.36-3.84 3.57-7.98 7.43-11.83l13.15-13.15 81.61-81.61 58.6 58.6c12.49 12.49 32.75 12.49 45.24 0s12.49-32.75 0-45.24l-58.6-58.6 58.95-58.95 162.44 162.44-48.34 48.34z"}}]})(e)}function F8(e){return me({tag:"svg",attr:{viewBox:"0 0 496 512"},child:[{tag:"path",attr:{d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zM94.6 168.9l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.2 1 8.9 8.6 4.3 13.2l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L152 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.6-4.7-1.9-12.3 4.3-13.3zM248 432c-60.6 0-134.5-38.3-143.8-93.3-2-11.8 9.3-21.5 20.7-17.9C155.1 330.5 200 336 248 336s92.9-5.5 123.1-15.2c11.5-3.7 22.6 6.1 20.7 17.9-9.3 55-83.2 93.3-143.8 93.3zm157.7-249.9l-25.4 24.6 6 34.9c1 6.2-5.3 11-11 7.9L344 233.3l-31.3 16.3c-5.7 3.1-12-1.7-11-7.9l6-34.9-25.4-24.6c-4.5-4.6-1.9-12.2 4.3-13.2l34.9-5 15.5-31.6c2.9-5.8 11-5.8 13.9 0l15.5 31.6 34.9 5c6.3.9 9 8.5 4.4 13.1z"}}]})(e)}function L8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z"}}]})(e)}function B8(e){return me({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M528 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h480c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM128 180v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm-336 96v-40c0-6.627-5.373-12-12-12H76c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12zm288 0v-40c0-6.627-5.373-12-12-12H172c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h232c6.627 0 12-5.373 12-12zm96 0v-40c0-6.627-5.373-12-12-12h-40c-6.627 0-12 5.373-12 12v40c0 6.627 5.373 12 12 12h40c6.627 0 12-5.373 12-12z"}}]})(e)}function H8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z"}}]})(e)}function zy(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M12.41 148.02l232.94 105.67c6.8 3.09 14.49 3.09 21.29 0l232.94-105.67c16.55-7.51 16.55-32.52 0-40.03L266.65 2.31a25.607 25.607 0 0 0-21.29 0L12.41 107.98c-16.55 7.51-16.55 32.53 0 40.04zm487.18 88.28l-58.09-26.33-161.64 73.27c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.51 209.97l-58.1 26.33c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 276.3c16.55-7.5 16.55-32.5 0-40zm0 127.8l-57.87-26.23-161.86 73.37c-7.56 3.43-15.59 5.17-23.86 5.17s-16.29-1.74-23.86-5.17L70.29 337.87 12.41 364.1c-16.55 7.5-16.55 32.5 0 40l232.94 105.59c6.8 3.08 14.49 3.08 21.29 0L499.59 404.1c16.55-7.5 16.55-32.5 0-40z"}}]})(e)}function W8(e){return me({tag:"svg",attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M320.67 64c-442.6 0-357.57 384-158.46 384 39.9 0 77.47-20.69 101.42-55.86l25.73-37.79c15.66-22.99 46.97-22.99 62.63 0l25.73 37.79C401.66 427.31 439.23 448 479.13 448c189.86 0 290.63-384-158.46-384zM184 308.36c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05zm272 0c-41.06 0-67.76-25.66-80.08-41.05-5.23-6.53-5.23-16.09 0-22.63 12.32-15.4 39.01-41.05 80.08-41.05s67.76 25.66 80.08 41.05c5.23 6.53 5.23 16.09 0 22.63-12.32 15.4-39.02 41.05-80.08 41.05z"}}]})(e)}function V8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function Ry(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M167.02 309.34c-40.12 2.58-76.53 17.86-97.19 72.3-2.35 6.21-8 9.98-14.59 9.98-11.11 0-45.46-27.67-55.25-34.35C0 439.62 37.93 512 128 512c75.86 0 128-43.77 128-120.19 0-3.11-.65-6.08-.97-9.13l-88.01-73.34zM457.89 0c-15.16 0-29.37 6.71-40.21 16.45C213.27 199.05 192 203.34 192 257.09c0 13.7 3.25 26.76 8.73 38.7l63.82 53.18c7.21 1.8 14.64 3.03 22.39 3.03 62.11 0 98.11-45.47 211.16-256.46 7.38-14.35 13.9-29.85 13.9-45.99C512 20.64 486 0 457.89 0z"}}]})(e)}function U8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"}}]})(e)}function $8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function xs(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}}]})(e)}function G8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M464 32H336c-26.5 0-48 21.5-48 48v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48zm-288 0H48C21.5 32 0 53.5 0 80v128c0 26.5 21.5 48 48 48h80v64c0 35.3-28.7 64-64 64h-8c-13.3 0-24 10.7-24 24v48c0 13.3 10.7 24 24 24h8c88.4 0 160-71.6 160-160V80c0-26.5-21.5-48-48-48z"}}]})(e)}function q8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"}}]})(e)}function Y8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M500.33 0h-47.41a12 12 0 0 0-12 12.57l4 82.76A247.42 247.42 0 0 0 256 8C119.34 8 7.9 119.53 8 256.19 8.1 393.07 119.1 504 256 504a247.1 247.1 0 0 0 166.18-63.91 12 12 0 0 0 .48-17.43l-34-34a12 12 0 0 0-16.38-.55A176 176 0 1 1 402.1 157.8l-101.53-4.87a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12h200.33a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12z"}}]})(e)}function op(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"}}]})(e)}function X8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"}}]})(e)}function K8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M64 96H0c0 123.7 100.3 224 224 224v144c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16V320C288 196.3 187.7 96 64 96zm384-64c-84.2 0-157.4 46.5-195.7 115.2 27.7 30.2 48.2 66.9 59 107.6C424 243.1 512 147.9 512 32h-64z"}}]})(e)}function Q8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M352 320c-22.608 0-43.387 7.819-59.79 20.895l-102.486-64.054a96.551 96.551 0 0 0 0-41.683l102.486-64.054C308.613 184.181 329.392 192 352 192c53.019 0 96-42.981 96-96S405.019 0 352 0s-96 42.981-96 96c0 7.158.79 14.13 2.276 20.841L155.79 180.895C139.387 167.819 118.608 160 96 160c-53.019 0-96 42.981-96 96s42.981 96 96 96c22.608 0 43.387-7.819 59.79-20.895l102.486 64.054A96.301 96.301 0 0 0 256 416c0 53.019 42.981 96 96 96s96-42.981 96-96-42.981-96-96-96z"}}]})(e)}function qg(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M503.691 189.836L327.687 37.851C312.281 24.546 288 35.347 288 56.015v80.053C127.371 137.907 0 170.1 0 322.326c0 61.441 39.581 122.309 83.333 154.132 13.653 9.931 33.111-2.533 28.077-18.631C66.066 312.814 132.917 274.316 288 272.085V360c0 20.7 24.3 31.453 39.687 18.164l176.004-152c11.071-9.562 11.086-26.753 0-36.328z"}}]})(e)}function ap(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"}}]})(e)}function Z8(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"}}]})(e)}function io(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}function J8(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M212.333 224.333H12c-6.627 0-12-5.373-12-12V12C0 5.373 5.373 0 12 0h48c6.627 0 12 5.373 12 12v78.112C117.773 39.279 184.26 7.47 258.175 8.007c136.906.994 246.448 111.623 246.157 248.532C504.041 393.258 393.12 504 256.333 504c-64.089 0-122.496-24.313-166.51-64.215-5.099-4.622-5.334-12.554-.467-17.42l33.967-33.967c4.474-4.474 11.662-4.717 16.401-.525C170.76 415.336 211.58 432 256.333 432c97.268 0 176-78.716 176-176 0-97.267-78.716-176-176-176-58.496 0-110.28 28.476-142.274 72.333h98.274c6.627 0 12 5.373 12 12v48c0 6.627-5.373 12-12 12z"}}]})(e)}function Rc(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"}}]})(e)}function e9(e){return me({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"}}]})(e)}function sp(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"}}]})(e)}const tt=e=>e.canvas,zt=be([tt,Bt,Pt],(e,t,n)=>e.layerState.stagingArea.images.length>0||t==="unifiedCanvas"&&n.isProcessing),Ny=e=>e.canvas.layerState.objects.find(T1),Vr=e=>e.gallery,t9=be([Vr,Ac,zt,Bt],(e,t,n,r)=>{const{categories:i,currentCategory:s,currentImageUuid:c,shouldPinGallery:u,shouldShowGallery:f,galleryImageMinimumWidth:h,galleryImageObjectFit:p,shouldHoldGalleryOpen:g,shouldAutoSwitchToNewImages:y,galleryWidth:S,shouldUseSingleGalleryColumn:C}=e,{isLightboxOpen:w}=t;return{currentImageUuid:c,shouldPinGallery:u,shouldShowGallery:f,galleryImageMinimumWidth:h,galleryImageObjectFit:p,galleryGridTemplateColumns:C?"auto":`repeat(auto-fill, minmax(${h}px, auto))`,activeTabName:r,shouldHoldGalleryOpen:g,shouldAutoSwitchToNewImages:y,images:i[s].images,areMoreImagesAvailable:i[s].areMoreImagesAvailable,currentCategory:s,galleryWidth:S,isLightboxOpen:w,isStaging:n,shouldEnableResize:!(w||r==="unifiedCanvas"&&u),shouldUseSingleGalleryColumn:C}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),n9=be([Vr,Pt,Ac,Bt],(e,t,n,r)=>({mayDeleteImage:t.isConnected&&!t.isProcessing,galleryImageObjectFit:e.galleryImageObjectFit,galleryImageMinimumWidth:e.galleryImageMinimumWidth,shouldUseSingleGalleryColumn:e.shouldUseSingleGalleryColumn,activeTabName:r,isLightboxOpen:n.isLightboxOpen}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),En=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:i,formLabelProps:s,...c}=e;return l.jsxs(rt,{isDisabled:n,width:r,display:"flex",gap:4,alignItems:"center",justifyContent:"space-between",...i,children:[l.jsx(st,{my:1,...s,children:t}),l.jsx(fy,{...c})]})},r9=be(Pt,e=>{const{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}=e;return{shouldConfirmOnDelete:t,isConnected:n,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),uc=he(({image:e,children:t},n)=>{const{isOpen:r,onOpen:i,onClose:s}=ui(),c=X(),{shouldConfirmOnDelete:u,isConnected:f,isProcessing:h}=O(r9),p=x.useRef(null),g=C=>{C.stopPropagation(),u?i():y()},y=()=>{f&&!h&&e&&c(US(e)),s()};fe("delete",()=>{u?i():y()},[e,u,f,h]);const S=C=>c(_1(!C.target.checked));return l.jsxs(l.Fragment,{children:[x.cloneElement(t,{onClick:e?g:void 0,ref:n}),l.jsx(Xx,{isOpen:r,leastDestructiveRef:p,onClose:s,children:l.jsx(Nr,{children:l.jsxs(Kx,{children:[l.jsx(Rr,{fontSize:"lg",fontWeight:"bold",children:"Delete image"}),l.jsx(Fr,{children:l.jsxs(B,{direction:"column",gap:5,children:[l.jsx(Ce,{children:"Are you sure? Deleted images will be sent to the Bin. You can restore from there if you wish to."}),l.jsx(En,{label:"Don't ask me again",isChecked:!u,onChange:S})]})}),l.jsxs(zr,{children:[l.jsx(Je,{ref:p,onClick:s,children:"Cancel"}),l.jsx(Je,{colorScheme:"error",onClick:y,ml:3,children:"Delete"})]})]})})})]})});uc.displayName="DeleteImageModal";const lp=()=>{const e=X();return t=>{const n=typeof t=="string"?t:D1(t),[r,i]=$S(n);e(O1(r)),e(A1(i))}},i9=be([Pt,Vr,rp,ro,Ac,Bt],(e,t,n,r,i,s)=>{const{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h}=e,{upscalingLevel:p,facetoolStrength:g}=n,{isLightboxOpen:y}=i,{shouldShowImageDetails:S}=r,{intermediateImage:C,currentImage:w}=t;return{isProcessing:c,isConnected:u,isGFPGANAvailable:f,isESRGANAvailable:h,upscalingLevel:p,facetoolStrength:g,shouldDisableToolbarButtons:Boolean(C)||!w,currentImage:w,shouldShowImageDetails:S,activeTabName:s,isLightboxOpen:y}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Fy=e=>{var L,Q,$,Z,te,ie,U,K;const t=X(),{isProcessing:n,isConnected:r,isGFPGANAvailable:i,isESRGANAvailable:s,upscalingLevel:c,facetoolStrength:u,shouldDisableToolbarButtons:f,shouldShowImageDetails:h,currentImage:p,isLightboxOpen:g,activeTabName:y}=O(i9),S=us(),{t:C}=Y(),w=lp(),k=()=>{p&&(g&&t(Bi(!1)),t(os(p)),t(jn("img2img")))},j=async()=>{if(!p)return;const ne=await fetch(p.url).then(Re=>Re.blob()),ce=[new ClipboardItem({[ne.type]:ne})];await navigator.clipboard.write(ce),S({title:C("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})},M=()=>{navigator.clipboard.writeText(p?window.location.toString()+p.url:"").then(()=>{S({title:C("toast.imageLinkCopied"),status:"success",duration:2500,isClosable:!0})})};fe("shift+i",()=>{p?(k(),S({title:C("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.imageNotLoaded"),description:C("toast.imageNotLoadedDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const P=()=>{var ne,ce;p&&(p.metadata&&t(z1(p.metadata)),((ne=p.metadata)==null?void 0:ne.image.type)==="img2img"?t(jn("img2img")):((ce=p.metadata)==null?void 0:ce.image.type)==="txt2img"&&t(jn("txt2img")))};fe("a",()=>{var ne,ce;["txt2img","img2img"].includes((ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)==null?void 0:ce.type)?(P(),S({title:C("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.parametersNotSet"),description:C("toast.parametersNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const I=()=>{p!=null&&p.metadata&&t(as(p.metadata.image.seed))};fe("s",()=>{var ne,ce;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.seed?(I(),S({title:C("toast.seedSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.seedNotSet"),description:C("toast.seedNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const T=x.useCallback(()=>{var ne,ce,Re,ze;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.prompt&&w((ze=(Re=p==null?void 0:p.metadata)==null?void 0:Re.image)==null?void 0:ze.prompt)},[(Q=(L=p==null?void 0:p.metadata)==null?void 0:L.image)==null?void 0:Q.prompt,w]);fe("p",()=>{var ne,ce;(ce=(ne=p==null?void 0:p.metadata)==null?void 0:ne.image)!=null&&ce.prompt?(T(),S({title:C("toast.promptSet"),status:"success",duration:2500,isClosable:!0})):S({title:C("toast.promptNotSet"),description:C("toast.promptNotSetDesc"),status:"error",duration:2500,isClosable:!0})},[p]);const D=()=>{p&&t(GS(p))};fe("Shift+U",()=>{s&&!f&&r&&!n&&c?D():S({title:C("toast.upscalingFailed"),status:"error",duration:2500,isClosable:!0})},[p,s,f,r,n,c]);const _=()=>{p&&t(qS(p))};fe("Shift+R",()=>{i&&!f&&r&&!n&&u?_():S({title:C("toast.faceRestoreFailed"),status:"error",duration:2500,isClosable:!0})},[p,i,f,r,n,u]);const z=()=>t(R1(!h)),V=()=>{p&&(g&&t(Bi(!1)),t(bc(p)),t(on(!0)),y!=="unifiedCanvas"&&t(jn("unifiedCanvas")),S({title:C("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0}))};fe("i",()=>{p?z():S({title:C("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[p,h]);const F=()=>{t(Bi(!g))};return l.jsxs(B,{sx:{justifyContent:"center",alignItems:"center",columnGap:"0.5em"},...e,children:[l.jsxs(en,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(ue,{"aria-label":`${C("parameters.sendTo")}...`,icon:l.jsx(Q8,{})}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:2,w:52},children:[l.jsx(Je,{size:"sm",onClick:k,leftIcon:l.jsx(qg,{}),children:C("parameters.sendToImg2Img")}),l.jsx(Je,{size:"sm",onClick:V,leftIcon:l.jsx(qg,{}),children:C("parameters.sendToUnifiedCanvas")}),l.jsx(Je,{size:"sm",onClick:j,leftIcon:l.jsx(Jo,{}),children:C("parameters.copyImage")}),l.jsx(Je,{size:"sm",onClick:M,leftIcon:l.jsx(Jo,{}),children:C("parameters.copyImageToLink")}),l.jsx($i,{download:!0,href:p==null?void 0:p.url,children:l.jsx(Je,{leftIcon:l.jsx(ip,{}),size:"sm",w:"100%",children:C("parameters.downloadImage")})})]})}),l.jsx(ue,{icon:l.jsx(z8,{}),tooltip:g?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,"aria-label":g?`${C("parameters.closeViewer")} (Z)`:`${C("parameters.openInViewer")} (Z)`,isChecked:g,onClick:F})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(ue,{icon:l.jsx(G8,{}),tooltip:`${C("parameters.usePrompt")} (P)`,"aria-label":`${C("parameters.usePrompt")} (P)`,isDisabled:!((Z=($=p==null?void 0:p.metadata)==null?void 0:$.image)!=null&&Z.prompt),onClick:T}),l.jsx(ue,{icon:l.jsx(K8,{}),tooltip:`${C("parameters.useSeed")} (S)`,"aria-label":`${C("parameters.useSeed")} (S)`,isDisabled:!((ie=(te=p==null?void 0:p.metadata)==null?void 0:te.image)!=null&&ie.seed),onClick:I}),l.jsx(ue,{icon:l.jsx(_8,{}),tooltip:`${C("parameters.useAll")} (A)`,"aria-label":`${C("parameters.useAll")} (A)`,isDisabled:!["txt2img","img2img"].includes((K=(U=p==null?void 0:p.metadata)==null?void 0:U.image)==null?void 0:K.type),onClick:P})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(ue,{icon:l.jsx(F8,{}),"aria-label":C("parameters.restoreFaces")}),children:l.jsxs(B,{sx:{flexDirection:"column",rowGap:4},children:[l.jsx(tp,{}),l.jsx(Je,{isDisabled:!i||!p||!(r&&!n)||!u,onClick:_,children:C("parameters.restoreFaces")})]})}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(ue,{icon:l.jsx(A8,{}),"aria-label":C("parameters.upscale")}),children:l.jsxs(B,{sx:{flexDirection:"column",gap:4},children:[l.jsx(np,{}),l.jsx(Je,{isDisabled:!s||!p||!(r&&!n)||!c,onClick:D,children:C("parameters.upscaleImage")})]})})]}),l.jsx(en,{isAttached:!0,children:l.jsx(ue,{icon:l.jsx(Ty,{}),tooltip:`${C("parameters.info")} (I)`,"aria-label":`${C("parameters.info")} (I)`,isChecked:h,onClick:z})}),l.jsx(uc,{image:p,children:l.jsx(ue,{icon:l.jsx(io,{}),tooltip:`${C("parameters.deleteImage")} (Del)`,"aria-label":`${C("parameters.deleteImage")} (Del)`,isDisabled:!p||!r||n,colorScheme:"error"})})]})};var o9=globalThis&&globalThis.__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 s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Wt=globalThis&&globalThis.__assign||function(){return Wt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"u"?void 0:Number(r),maxHeight:typeof i>"u"?void 0:Number(i),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof c>"u"?void 0:Number(c)}},f9=["as","style","className","grid","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Zg="__resizable_base__",Ly=function(e){l9(t,e);function t(n){var r=e.call(this,n)||this;return r.ratio=1,r.resizable=null,r.parentLeft=0,r.parentTop=0,r.resizableLeft=0,r.resizableRight=0,r.resizableTop=0,r.resizableBottom=0,r.targetLeft=0,r.targetTop=0,r.appendBase=function(){if(!r.resizable||!r.window)return null;var i=r.parentNode;if(!i)return null;var s=r.window.document.createElement("div");return s.style.width="100%",s.style.height="100%",s.style.position="absolute",s.style.transform="scale(0, 0)",s.style.left="0",s.style.flex="0 0 100%",s.classList?s.classList.add(Zg):s.className+=Zg,i.appendChild(s),s},r.removeBase=function(i){var s=r.parentNode;s&&s.removeChild(i)},r.ref=function(i){i&&(r.resizable=i)},r.state={isResizing:!1,width:typeof(r.propsSize&&r.propsSize.width)>"u"?"auto":r.propsSize&&r.propsSize.width,height:typeof(r.propsSize&&r.propsSize.height)>"u"?"auto":r.propsSize&&r.propsSize.height,direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},r.onResizeStart=r.onResizeStart.bind(r),r.onMouseMove=r.onMouseMove.bind(r),r.onMouseUp=r.onMouseUp.bind(r),r}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||c9},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var i=this.resizable.offsetWidth,s=this.resizable.offsetHeight,c=this.resizable.style.position;c!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:i,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=c}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,i=function(u){if(typeof n.state[u]>"u"||n.state[u]==="auto")return"auto";if(n.propsSize&&n.propsSize[u]&&n.propsSize[u].toString().endsWith("%")){if(n.state[u].toString().endsWith("%"))return n.state[u].toString();var f=n.getParentSize(),h=Number(n.state[u].toString().replace("px","")),p=h/f[u]*100;return p+"%"}return zd(n.state[u])},s=r&&typeof r.width<"u"&&!this.state.isResizing?zd(r.width):i("width"),c=r&&typeof r.height<"u"&&!this.state.isResizing?zd(r.height):i("height");return{width:s,height:c}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var r=!1,i=this.parentNode.style.flexWrap;i!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=i),this.removeBase(n),s},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var i=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof i>"u"||i==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var i=this.props.boundsByDirection,s=this.state.direction,c=i&&Do("left",s),u=i&&Do("top",s),f,h;if(this.props.bounds==="parent"){var p=this.parentNode;p&&(f=c?this.resizableRight-this.parentLeft:p.offsetWidth+(this.parentLeft-this.resizableLeft),h=u?this.resizableBottom-this.parentTop:p.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(f=c?this.resizableRight:this.window.innerWidth-this.resizableLeft,h=u?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(f=c?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),h=u?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return f&&Number.isFinite(f)&&(n=n&&n"u"?10:s.width,g=typeof i.width>"u"||i.width<0?n:i.width,y=typeof s.height>"u"?10:s.height,S=typeof i.height>"u"||i.height<0?r:i.height,C=f||0,w=h||0;if(u){var k=(y-C)*this.ratio+w,j=(S-C)*this.ratio+w,M=(p-w)/this.ratio+C,P=(g-w)/this.ratio+C,I=Math.max(p,k),T=Math.min(g,j),D=Math.max(y,M),_=Math.min(S,P);n=_l(n,I,T),r=_l(r,D,_)}else n=_l(n,p,g),r=_l(r,y,S);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var r=n.getBoundingClientRect();this.parentLeft=r.left,this.parentTop=r.top}}if(this.props.bounds&&typeof this.props.bounds!="string"){var i=this.props.bounds.getBoundingClientRect();this.targetLeft=i.left,this.targetTop=i.top}if(this.resizable){var s=this.resizable.getBoundingClientRect(),c=s.left,u=s.top,f=s.right,h=s.bottom;this.resizableLeft=c,this.resizableRight=f,this.resizableTop=u,this.resizableBottom=h}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var i=0,s=0;if(n.nativeEvent&&u9(n.nativeEvent)?(i=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&Dl(n.nativeEvent)&&(i=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var c=this.props.onResizeStart(n,r,this.resizable);if(c===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var u,f=this.window.getComputedStyle(this.resizable);if(f.flexBasis!=="auto"){var h=this.parentNode;if(h){var p=this.window.getComputedStyle(h).flexDirection;this.flexDir=p.startsWith("row")?"row":"column",u=f.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var g={original:{x:i,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:mr(mr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:u};this.setState(g)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Dl(n))try{n.preventDefault(),n.stopPropagation()}catch{}var i=this.props,s=i.maxWidth,c=i.maxHeight,u=i.minWidth,f=i.minHeight,h=Dl(n)?n.touches[0].clientX:n.clientX,p=Dl(n)?n.touches[0].clientY:n.clientY,g=this.state,y=g.direction,S=g.original,C=g.width,w=g.height,k=this.getParentSize(),j=d9(k,this.window.innerWidth,this.window.innerHeight,s,c,u,f);s=j.maxWidth,c=j.maxHeight,u=j.minWidth,f=j.minHeight;var M=this.calculateNewSizeFromDirection(h,p),P=M.newHeight,I=M.newWidth,T=this.calculateNewMaxFromBoundary(s,c);this.props.snap&&this.props.snap.x&&(I=Qg(I,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(P=Qg(P,this.props.snap.y,this.props.snapGap));var D=this.calculateNewSizeFromAspectRatio(I,P,{width:T.maxWidth,height:T.maxHeight},{width:u,height:f});if(I=D.newWidth,P=D.newHeight,this.props.grid){var _=Kg(I,this.props.grid[0]),z=Kg(P,this.props.grid[1]),V=this.props.snapGap||0;I=V===0||Math.abs(_-I)<=V?_:I,P=V===0||Math.abs(z-P)<=V?z:P}var F={width:I-S.width,height:P-S.height};if(C&&typeof C=="string"){if(C.endsWith("%")){var L=I/k.width*100;I=L+"%"}else if(C.endsWith("vw")){var Q=I/this.window.innerWidth*100;I=Q+"vw"}else if(C.endsWith("vh")){var $=I/this.window.innerHeight*100;I=$+"vh"}}if(w&&typeof w=="string"){if(w.endsWith("%")){var L=P/k.height*100;P=L+"%"}else if(w.endsWith("vw")){var Q=P/this.window.innerWidth*100;P=Q+"vw"}else if(w.endsWith("vh")){var $=P/this.window.innerHeight*100;P=$+"vh"}}var Z={width:this.createSizeForCssProperty(I,"width"),height:this.createSizeForCssProperty(P,"height")};this.flexDir==="row"?Z.flexBasis=Z.width:this.flexDir==="column"&&(Z.flexBasis=Z.height),YS.flushSync(function(){r.setState(Z)}),this.props.onResize&&this.props.onResize(n,y,this.resizable,F)}},t.prototype.onMouseUp=function(n){var r=this.state,i=r.isResizing,s=r.direction,c=r.original;if(!(!i||!this.resizable)){var u={width:this.size.width-c.width,height:this.size.height-c.height};this.props.onResizeStop&&this.props.onResizeStop(n,s,this.resizable,u),this.props.size&&this.setState(this.props.size),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:mr(mr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){this.setState({width:n.width,height:n.height})},t.prototype.renderResizer=function(){var n=this,r=this.props,i=r.enable,s=r.handleStyles,c=r.handleClasses,u=r.handleWrapperStyle,f=r.handleWrapperClass,h=r.handleComponent;if(!i)return null;var p=Object.keys(i).map(function(g){return i[g]!==!1?x.createElement(s9,{key:g,direction:g,onResizeStart:n.onResizeStart,replaceStyles:s&&s[g],className:c&&c[g]},h&&h[g]?h[g]:null):null});return x.createElement("div",{className:f,style:u},p)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(c,u){return f9.indexOf(u)!==-1||(c[u]=n.props[u]),c},{}),i=mr(mr(mr({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(i.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return x.createElement(s,mr({ref:this.ref,style:i,className:this.props.className},r),this.state.isResizing&&x.createElement("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer())},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(x.PureComponent);const pt=e=>{const{label:t,...n}=e;return l.jsx(P2,{colorScheme:"accent",...n,children:t})};function By(e){return me({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z"}}]})(e)}function Hy(e){return me({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707-.195-.195.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146zm.122 2.112v-.002.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a4.507 4.507 0 0 0-.288-.076 4.922 4.922 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a4.924 4.924 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034.114 0 .23-.011.343-.04L9.927 2.028c-.029.113-.04.23-.04.343a1.779 1.779 0 0 0 .062.46z"}}]})(e)}function h9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M16.5 9c-.42 0-.83.04-1.24.11L1.01 3 1 10l9 2-9 2 .01 7 8.07-3.46C9.59 21.19 12.71 24 16.5 24c4.14 0 7.5-3.36 7.5-7.5S20.64 9 16.5 9zm0 13c-3.03 0-5.5-2.47-5.5-5.5s2.47-5.5 5.5-5.5 5.5 2.47 5.5 5.5-2.47 5.5-5.5 5.5z"}},{tag:"path",attr:{d:"M18.27 14.03l-1.77 1.76-1.77-1.76-.7.7 1.76 1.77-1.76 1.77.7.7 1.77-1.76 1.77 1.76.7-.7-1.76-1.77 1.76-1.77z"}}]})(e)}function p9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}}]})(e)}function m9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.49.49 0 00.12-.61l-1.92-3.32a.488.488 0 00-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 00-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58a.49.49 0 00-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}}]})(e)}function v9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z"}}]})(e)}function g9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function x9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 2v11h3v9l7-12h-4l4-8z"}}]})(e)}function Jg(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"}}]})(e)}function y9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function b9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M19.02 10v9H5V5h9V3H5.02c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2zM17 10l.94-2.06L20 7l-2.06-.94L17 4l-.94 2.06L14 7l2.06.94zm-3.75.75L12 8l-1.25 2.75L8 12l2.75 1.25L12 16l1.25-2.75L16 12z"}}]})(e)}function cp(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function S9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"}}]})(e)}function C9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 10l5 5 5-5z"}}]})(e)}function w9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M7 14l5-5 5 5z"}}]})(e)}function k9(e){return me({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}}]})(e)}function j9(e,t){return e.classList?!!t&&e.classList.contains(t):(" "+(e.className.baseVal||e.className)+" ").indexOf(" "+t+" ")!==-1}function E9(e,t){e.classList?e.classList.add(t):j9(e,t)||(typeof e.className=="string"?e.className=e.className+" "+t:e.setAttribute("class",(e.className&&e.className.baseVal||"")+" "+t))}function e0(e,t){return e.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function P9(e,t){e.classList?e.classList.remove(t):typeof e.className=="string"?e.className=e0(e.className,t):e.setAttribute("class",e0(e.className&&e.className.baseVal||"",t))}const t0={disabled:!1},Wy=ke.createContext(null);var Vy=function(t){return t.scrollTop},La="unmounted",Ai="exited",zi="entering",Ao="entered",_f="exiting",Ur=function(e){vh(t,e);function t(r,i){var s;s=e.call(this,r,i)||this;var c=i,u=c&&!c.isMounting?r.enter:r.appear,f;return s.appearStatus=null,r.in?u?(f=Ai,s.appearStatus=zi):f=Ao:r.unmountOnExit||r.mountOnEnter?f=La:f=Ai,s.state={status:f},s.nextCallback=null,s}t.getDerivedStateFromProps=function(i,s){var c=i.in;return c&&s.status===La?{status:Ai}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(i){var s=null;if(i!==this.props){var c=this.state.status;this.props.in?c!==zi&&c!==Ao&&(s=zi):(c===zi||c===Ao)&&(s=_f)}this.updateStatus(!1,s)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var i=this.props.timeout,s,c,u;return s=c=u=i,i!=null&&typeof i!="number"&&(s=i.exit,c=i.enter,u=i.appear!==void 0?i.appear:c),{exit:s,enter:c,appear:u}},n.updateStatus=function(i,s){if(i===void 0&&(i=!1),s!==null)if(this.cancelNextCallback(),s===zi){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:vl.findDOMNode(this);c&&Vy(c)}this.performEnter(i)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ai&&this.setState({status:La})},n.performEnter=function(i){var s=this,c=this.props.enter,u=this.context?this.context.isMounting:i,f=this.props.nodeRef?[u]:[vl.findDOMNode(this),u],h=f[0],p=f[1],g=this.getTimeouts(),y=u?g.appear:g.enter;if(!i&&!c||t0.disabled){this.safeSetState({status:Ao},function(){s.props.onEntered(h)});return}this.props.onEnter(h,p),this.safeSetState({status:zi},function(){s.props.onEntering(h,p),s.onTransitionEnd(y,function(){s.safeSetState({status:Ao},function(){s.props.onEntered(h,p)})})})},n.performExit=function(){var i=this,s=this.props.exit,c=this.getTimeouts(),u=this.props.nodeRef?void 0:vl.findDOMNode(this);if(!s||t0.disabled){this.safeSetState({status:Ai},function(){i.props.onExited(u)});return}this.props.onExit(u),this.safeSetState({status:_f},function(){i.props.onExiting(u),i.onTransitionEnd(c.exit,function(){i.safeSetState({status:Ai},function(){i.props.onExited(u)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(i,s){s=this.setNextCallback(s),this.setState(i,s)},n.setNextCallback=function(i){var s=this,c=!0;return this.nextCallback=function(u){c&&(c=!1,s.nextCallback=null,i(u))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},n.onTransitionEnd=function(i,s){this.setNextCallback(s);var c=this.props.nodeRef?this.props.nodeRef.current:vl.findDOMNode(this),u=i==null&&!this.props.addEndListener;if(!c||u){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var f=this.props.nodeRef?[this.nextCallback]:[c,this.nextCallback],h=f[0],p=f[1];this.props.addEndListener(h,p)}i!=null&&setTimeout(this.nextCallback,i)},n.render=function(){var i=this.state.status;if(i===La)return null;var s=this.props,c=s.children;s.in,s.mountOnEnter,s.unmountOnExit,s.appear,s.enter,s.exit,s.timeout,s.addEndListener,s.onEnter,s.onEntering,s.onEntered,s.onExit,s.onExiting,s.onExited,s.nodeRef;var u=th(s,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return ke.createElement(Wy.Provider,{value:null},typeof c=="function"?c(i,u):ke.cloneElement(ke.Children.only(c),u))},t}(ke.Component);Ur.contextType=Wy;Ur.propTypes={};function Oo(){}Ur.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Oo,onEntering:Oo,onEntered:Oo,onExit:Oo,onExiting:Oo,onExited:Oo};Ur.UNMOUNTED=La;Ur.EXITED=Ai;Ur.ENTERING=zi;Ur.ENTERED=Ao;Ur.EXITING=_f;const I9=Ur;var M9=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return E9(t,r)})},Rd=function(t,n){return t&&n&&n.split(" ").forEach(function(r){return P9(t,r)})},up=function(e){vh(t,e);function t(){for(var r,i=arguments.length,s=new Array(i),c=0;ce.image.uuid===t.image.uuid&&e.isSelected===t.isSelected,$y=x.memo(e=>{const t=X(),{activeTabName:n,galleryImageObjectFit:r,galleryImageMinimumWidth:i,mayDeleteImage:s,shouldUseSingleGalleryColumn:c}=O(n9),{image:u,isSelected:f}=e,{url:h,thumbnail:p,uuid:g,metadata:y}=u,[S,C]=x.useState(!1),w=us(),{direction:k}=Ji(),{t:j}=Y(),M=lp(),P=()=>C(!0),I=()=>C(!1),T=()=>{var Z,te,ie,U;(te=(Z=u.metadata)==null?void 0:Z.image)!=null&&te.prompt&&M((U=(ie=u.metadata)==null?void 0:ie.image)==null?void 0:U.prompt),w({title:j("toast.promptSet"),status:"success",duration:2500,isClosable:!0})},D=()=>{u.metadata&&t(as(u.metadata.image.seed)),w({title:j("toast.seedSet"),status:"success",duration:2500,isClosable:!0})},_=()=>{t(os(u)),n!=="img2img"&&t(jn("img2img")),w({title:j("toast.sentToImageToImage"),status:"success",duration:2500,isClosable:!0})},z=()=>{t(bc(u)),t(Sc()),n!=="unifiedCanvas"&&t(jn("unifiedCanvas")),w({title:j("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},V=()=>{y&&t(z1(y)),w({title:j("toast.parametersSet"),status:"success",duration:2500,isClosable:!0})},F=async()=>{var Z;if((Z=y==null?void 0:y.image)!=null&&Z.init_image_path&&(await fetch(y.image.init_image_path)).ok){t(jn("img2img")),t(XS(y)),w({title:j("toast.initialImageSet"),status:"success",duration:2500,isClosable:!0});return}w({title:j("toast.initialImageNotSet"),description:j("toast.initialImageNotSetDesc"),status:"error",duration:2500,isClosable:!0})},L=()=>t(Rv(u)),Q=Z=>{Z.dataTransfer.setData("invokeai/imageUuid",g),Z.dataTransfer.effectAllowed="move"},$=()=>{t(Rv(u)),t(Bi(!0))};return l.jsx(T9,{menuProps:{size:"sm",isLazy:!0},renderMenu:()=>{var Z,te,ie,U,K,ne,ce,Re;return l.jsxs(Nh,{children:[l.jsx(pr,{onClickCapture:$,children:j("parameters.openInViewer")}),l.jsx(pr,{onClickCapture:T,isDisabled:((te=(Z=u==null?void 0:u.metadata)==null?void 0:Z.image)==null?void 0:te.prompt)===void 0,children:j("parameters.usePrompt")}),l.jsx(pr,{onClickCapture:D,isDisabled:((U=(ie=u==null?void 0:u.metadata)==null?void 0:ie.image)==null?void 0:U.seed)===void 0,children:j("parameters.useSeed")}),l.jsx(pr,{onClickCapture:V,isDisabled:!["txt2img","img2img"].includes((ne=(K=u==null?void 0:u.metadata)==null?void 0:K.image)==null?void 0:ne.type),children:j("parameters.useAll")}),l.jsx(pr,{onClickCapture:F,isDisabled:((Re=(ce=u==null?void 0:u.metadata)==null?void 0:ce.image)==null?void 0:Re.type)!=="img2img",children:j("parameters.useInitImg")}),l.jsx(pr,{onClickCapture:_,children:j("parameters.sendToImg2Img")}),l.jsx(pr,{onClickCapture:z,children:j("parameters.sendToUnifiedCanvas")}),l.jsx(pr,{"data-warning":!0,children:l.jsx(uc,{image:u,children:l.jsx("p",{children:j("parameters.deleteImage")})})})]})},children:Z=>l.jsxs(We,{position:"relative",onMouseOver:P,onMouseOut:I,userSelect:"none",draggable:!0,onDragStart:Q,ref:Z,sx:{padding:2,display:"flex",justifyContent:"center",transition:"transform 0.2s ease-out",_hover:{cursor:"pointer",zIndex:2},_before:{content:'""',display:"block",paddingBottom:"100%"}},children:[l.jsx(ds,{objectFit:c?"contain":r,rounded:"md",src:p||h,loading:"lazy",sx:{position:"absolute",width:"100%",height:"100%",maxWidth:"100%",maxHeight:"100%",top:"50%",transform:"translate(-50%,-50%)",...k==="rtl"?{insetInlineEnd:"50%"}:{insetInlineStart:"50%"}}}),l.jsx(B,{onClick:L,sx:{position:"absolute",top:"0",insetInlineStart:"0",width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},children:f&&l.jsx(Jt,{as:zc,sx:{width:"50%",height:"50%",fill:"ok.500"}})}),S&&i>=64&&l.jsx(We,{sx:{position:"absolute",top:1,insetInlineEnd:1},children:l.jsx(uc,{image:u,children:l.jsx(ue,{"aria-label":j("parameters.deleteImage"),icon:l.jsx(Z8,{}),size:"xs",fontSize:14,isDisabled:!s})})})]},g)})},_9);$y.displayName="HoverableImage";const D9="0px",dp="calc(70px + 1rem)",O9=4,fp=1.5,A9=`calc(100vw - ${D9})`,z9=`calc(100vh - ${fp*4}px)`,R9=`calc(100vh - ${dp})`,n0=`calc(100vh - (${dp} + 6rem))`,N9=`calc(100vh - (${dp} + 4.4rem))`,Al="22.5rem";const F9=re(Ly,{shouldForwardProp:e=>!["sx"].includes(e)}),zl=320,r0=40,L9={txt2img:{galleryMinWidth:200,galleryMaxWidth:500},img2img:{galleryMinWidth:200,galleryMaxWidth:500},unifiedCanvas:{galleryMinWidth:200,galleryMaxWidth:200},nodes:{galleryMinWidth:200,galleryMaxWidth:500},postprocess:{galleryMinWidth:200,galleryMaxWidth:500},training:{galleryMinWidth:200,galleryMaxWidth:500}},i0=400;function Gy(){const e=X(),{direction:t}=Ji(),{t:n}=Y(),{images:r,currentCategory:i,currentImageUuid:s,shouldPinGallery:c,shouldShowGallery:u,galleryImageMinimumWidth:f,galleryGridTemplateColumns:h,activeTabName:p,galleryImageObjectFit:g,shouldHoldGalleryOpen:y,shouldAutoSwitchToNewImages:S,areMoreImagesAvailable:C,galleryWidth:w,isLightboxOpen:k,isStaging:j,shouldEnableResize:M,shouldUseSingleGalleryColumn:P}=O(t9),{galleryMinWidth:I,galleryMaxWidth:T}=k?{galleryMinWidth:i0,galleryMaxWidth:i0}:L9[p],[D,_]=x.useState(w>=zl),[z,V]=x.useState(!1),[F,L]=x.useState(0),Q=x.useRef(null),$=x.useRef(null),Z=x.useRef(null);x.useEffect(()=>{_(w>=zl)},[w]);const te=()=>{!c&&e(Fi(!0)),e(tC(!c)),e(on(!0))},ie=()=>{u?K():U()},U=()=>{e(Fi(!0)),c&&e(on(!0))},K=x.useCallback(()=>{e(Fi(!1)),e(KS(!1)),setTimeout(()=>c&&e(on(!0)),400)},[e,c]),ne=()=>{e(nC(i))},ce=oe=>{e(Da(oe))},Re=()=>{y||(Z.current=window.setTimeout(()=>K(),500))},ze=()=>{Z.current&&window.clearTimeout(Z.current)};fe("g",()=>{ie()},[u,c]),fe("left",()=>{e(N1())},{enabled:!j||p!=="unifiedCanvas"},[j]),fe("right",()=>{e(F1())},{enabled:!j||p!=="unifiedCanvas"},[j]),fe("shift+g",()=>{te()},[c]),fe("esc",()=>{e(Fi(!1))},{enabled:()=>!c,preventDefault:!0},[c]);const Me=32;return fe("shift+up",()=>{if(f<256){const oe=ee.clamp(f+Me,32,256);e(Da(oe))}},[f]),fe("shift+down",()=>{if(f>32){const oe=ee.clamp(f-Me,32,256);e(Da(oe))}},[f]),x.useEffect(()=>{function oe(ae){!c&&Q.current&&!Q.current.contains(ae.target)&&K()}return document.addEventListener("mousedown",oe),()=>{document.removeEventListener("mousedown",oe)}},[K,c]),l.jsx(Uy,{nodeRef:Q,in:u||y,unmountOnExit:!0,timeout:200,classNames:`${t}-image-gallery-css-transition`,children:l.jsxs(We,{className:`${t}-image-gallery-css-transition`,sx:c?{zIndex:1,insetInlineEnd:0}:{zIndex:100,position:"fixed",height:"100vh",top:0,insetInlineEnd:0},ref:Q,onMouseLeave:c?void 0:Re,onMouseEnter:c?void 0:ze,onMouseOver:c?void 0:ze,children:[l.jsxs(F9,{sx:{padding:4,display:"flex",flexDirection:"column",rowGap:4,borderRadius:c?"base":0,borderInlineStartWidth:5,bg:"base.850",borderColor:"base.700"},minWidth:I,maxWidth:c?T:window.innerWidth,"data-pinned":c,handleStyles:t==="rtl"?{right:{width:"15px"}}:{left:{width:"15px"}},enable:t==="rtl"?{right:M}:{left:M},size:{width:w,height:c?"100%":"100vh"},onResizeStart:(oe,ae,je)=>{L(je.clientHeight),je.style.height=`${je.clientHeight}px`,c&&(je.style.position="fixed",je.style.insetInlineEnd="1rem",V(!0))},onResizeStop:(oe,ae,je,Be)=>{const Ne=c?ee.clamp(Number(w)+Be.width,I,Number(T)):Number(w)+Be.width;e(QS(Ne)),je.removeAttribute("data-resize-alert"),c&&(console.log("unpin"),je.style.position="relative",je.style.removeProperty("inset-inline-end"),je.style.setProperty("height",c?"100%":"100vh"),V(!1),e(on(!0)))},onResize:(oe,ae,je,Be)=>{const Ne=ee.clamp(Number(w)+Be.width,I,Number(c?T:.95*window.innerWidth));Ne>=zl&&!D?_(!0):NeNe-r0&&e(Da(Ne-r0)),c&&(Ne>=T?je.setAttribute("data-resize-alert","true"):je.removeAttribute("data-resize-alert")),je.style.height=`${F}px`},children:[l.jsxs(B,{alignItems:"center",gap:2,justifyContent:"space-between",children:[l.jsx(en,{size:"sm",isAttached:!0,w:"max-content",justifyContent:"stretch",children:D?l.jsxs(l.Fragment,{children:[l.jsx(Je,{size:"sm",isChecked:i==="result",onClick:()=>e(gl("result")),flexGrow:1,children:n("gallery.generations")}),l.jsx(Je,{size:"sm",isChecked:i==="user",onClick:()=>e(gl("user")),flexGrow:1,children:n("gallery.uploads")})]}):l.jsxs(l.Fragment,{children:[l.jsx(ue,{"aria-label":n("gallery.showGenerations"),tooltip:n("gallery.showGenerations"),isChecked:i==="result",icon:l.jsx(L8,{}),onClick:()=>e(gl("result"))}),l.jsx(ue,{"aria-label":n("gallery.showUploads"),tooltip:n("gallery.showUploads"),isChecked:i==="user",icon:l.jsx(e9,{}),onClick:()=>e(gl("user"))})]})}),l.jsxs(B,{gap:2,children:[l.jsx(rr,{triggerComponent:l.jsx(ue,{size:"sm","aria-label":n("gallery.gallerySettings"),icon:l.jsx(sp,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(ut,{value:f,onChange:ce,min:32,max:256,hideTooltip:!0,label:n("gallery.galleryImageSize"),withReset:!0,handleReset:()=>e(Da(64))}),l.jsx(pt,{label:n("gallery.maintainAspectRatio"),isChecked:g==="contain",onChange:()=>e(ZS(g==="contain"?"cover":"contain"))}),l.jsx(pt,{label:n("gallery.autoSwitchNewImages"),isChecked:S,onChange:oe=>e(JS(oe.target.checked))}),l.jsx(pt,{label:n("gallery.singleColumnLayout"),isChecked:P,onChange:oe=>e(eC(oe.target.checked))})]})}),l.jsx(ue,{size:"sm","aria-label":n("gallery.pinGallery"),tooltip:`${n("gallery.pinGallery")} (Shift+G)`,onClick:te,icon:c?l.jsx(By,{}):l.jsx(Hy,{})})]})]}),l.jsx(B,{direction:"column",gap:2,h:c?n0:"100vh",maxH:c?n0:"100vh",overflowY:"scroll",ref:$,sx:{...p2},children:r.length||C?l.jsxs(l.Fragment,{children:[l.jsx($n,{gap:2,style:{gridTemplateColumns:h},children:r.map(oe=>{const{uuid:ae}=oe,je=s===ae;return l.jsx($y,{image:oe,isSelected:je},ae)})}),l.jsx(Je,{onClick:ne,isDisabled:!C,flexShrink:0,children:n(C?"gallery.loadMore":"gallery.allImagesLoaded")})]}):l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,padding:8,h:"100%",w:"100%",color:"base.500"},children:[l.jsx(Jt,{as:cp,sx:{w:16,h:16}}),l.jsx("p",{children:n("gallery.noImagesInGallery")})]})})]}),z&&l.jsx(We,{style:{width:`${w}px`,height:"100%"}})]})})}var B9=nh({displayName:"EditIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),qy=nh({displayName:"ExternalLinkIcon",path:l.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[l.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),l.jsx("path",{d:"M15 3h6v6"}),l.jsx("path",{d:"M10 14L21 3"})]})}),H9=nh({displayName:"DeleteIcon",path:l.jsx("g",{fill:"currentColor",children:l.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});function W9(e){return me({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const xt=({label:e,value:t,onClick:n,isLink:r,labelPosition:i,withCopy:s=!1})=>{const{t:c}=Y();return l.jsxs(B,{gap:2,children:[n&&l.jsx(Yt,{label:`Recall ${e}`,children:l.jsx(ci,{"aria-label":c("accessibility.useThisParameter"),icon:l.jsx(W9,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&l.jsx(Yt,{label:`Copy ${e}`,children:l.jsx(ci,{"aria-label":`Copy ${e}`,icon:l.jsx(Jo,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),l.jsxs(B,{direction:i?"column":"row",children:[l.jsxs(Ce,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?l.jsxs($i,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",l.jsx(qy,{mx:"2px"})]}):l.jsx(Ce,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]})},V9=(e,t)=>e.image.uuid===t.image.uuid,hp=x.memo(({image:e,styleClass:t})=>{var L,Q;const n=X(),r=lp();fe("esc",()=>{n(R1(!1))});const i=((L=e==null?void 0:e.metadata)==null?void 0:L.image)||{},s=e==null?void 0:e.dreamPrompt,{cfg_scale:c,fit:u,height:f,hires_fix:h,init_image_path:p,mask_image_path:g,orig_path:y,perlin:S,postprocessing:C,prompt:w,sampler:k,seamless:j,seed:M,steps:P,strength:I,threshold:T,type:D,variations:_,width:z}=i,{t:V}=Y(),F=JSON.stringify(e.metadata,null,2);return l.jsx(We,{className:t,sx:{position:"absolute",top:"0",width:"100%",borderRadius:"base",padding:4,overflow:"scroll",maxHeight:N9,height:"100%",zIndex:"10",backdropFilter:"blur(10px)",bg:"blackAlpha.600"},children:l.jsxs(B,{gap:1,direction:"column",width:"100%",children:[l.jsxs(B,{gap:2,children:[l.jsx(Ce,{fontWeight:"semibold",children:"File:"}),l.jsxs($i,{href:e.url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.url.length>64?e.url.substring(0,64).concat("..."):e.url,l.jsx(qy,{mx:"2px"})]})]}),Object.keys(i).length>0?l.jsxs(l.Fragment,{children:[D&&l.jsx(xt,{label:"Generation type",value:D}),((Q=e.metadata)==null?void 0:Q.model_weights)&&l.jsx(xt,{label:"Model",value:e.metadata.model_weights}),["esrgan","gfpgan"].includes(D)&&l.jsx(xt,{label:"Original image",value:y}),w&&l.jsx(xt,{label:"Prompt",labelPosition:"top",value:typeof w=="string"?w:D1(w),onClick:()=>r(w)}),M!==void 0&&l.jsx(xt,{label:"Seed",value:M,onClick:()=>n(as(M))}),T!==void 0&&l.jsx(xt,{label:"Noise Threshold",value:T,onClick:()=>n(ef(T))}),S!==void 0&&l.jsx(xt,{label:"Perlin Noise",value:S,onClick:()=>n(tf(S))}),k&&l.jsx(xt,{label:"Sampler",value:k,onClick:()=>n(L1(k))}),P&&l.jsx(xt,{label:"Steps",value:P,onClick:()=>n(nf(P))}),c!==void 0&&l.jsx(xt,{label:"CFG scale",value:c,onClick:()=>n(rf(c))}),_&&_.length>0&&l.jsx(xt,{label:"Seed-weight pairs",value:Nv(_),onClick:()=>n(B1(Nv(_)))}),j&&l.jsx(xt,{label:"Seamless",value:j,onClick:()=>n(H1(j))}),h&&l.jsx(xt,{label:"High Resolution Optimization",value:h,onClick:()=>n(W1(h))}),z&&l.jsx(xt,{label:"Width",value:z,onClick:()=>n(Wl(z))}),f&&l.jsx(xt,{label:"Height",value:f,onClick:()=>n(Vl(f))}),p&&l.jsx(xt,{label:"Initial image",value:p,isLink:!0,onClick:()=>n(os(p))}),g&&l.jsx(xt,{label:"Mask image",value:g,isLink:!0,onClick:()=>n(rC(g))}),D==="img2img"&&I&&l.jsx(xt,{label:"Image to image strength",value:I,onClick:()=>n(of(I))}),u&&l.jsx(xt,{label:"Image to image fit",value:u,onClick:()=>n(V1(u))}),C&&C.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Vn,{size:"sm",children:"Postprocessing"}),C.map(($,Z)=>{if($.type==="esrgan"){const{scale:te,strength:ie,denoise_str:U}=$;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${Z+1}: Upscale (ESRGAN)`}),l.jsx(xt,{label:"Scale",value:te,onClick:()=>n(M1(te))}),l.jsx(xt,{label:"Strength",value:ie,onClick:()=>n(Jd(ie))}),U!==void 0&&l.jsx(xt,{label:"Denoising strength",value:U,onClick:()=>n(Zd(U))})]},Z)}else if($.type==="gfpgan"){const{strength:te}=$;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${Z+1}: Face restoration (GFPGAN)`}),l.jsx(xt,{label:"Strength",value:te,onClick:()=>{n(Zl(te)),n(Hl("gfpgan"))}})]},Z)}else if($.type==="codeformer"){const{strength:te,fidelity:ie}=$;return l.jsxs(B,{pl:8,gap:1,direction:"column",children:[l.jsx(Ce,{size:"md",children:`${Z+1}: Face restoration (Codeformer)`}),l.jsx(xt,{label:"Strength",value:te,onClick:()=>{n(Zl(te)),n(Hl("codeformer"))}}),ie&&l.jsx(xt,{label:"Fidelity",value:ie,onClick:()=>{n(Qd(ie)),n(Hl("codeformer"))}})]},Z)}})]}),s&&l.jsx(xt,{withCopy:!0,label:"Dream Prompt",value:s}),l.jsxs(B,{gap:2,direction:"column",children:[l.jsxs(B,{gap:2,children:[l.jsx(Yt,{label:"Copy metadata JSON",children:l.jsx(ci,{"aria-label":V("accessibility.copyMetadataJson"),icon:l.jsx(Jo,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(F)})}),l.jsx(Ce,{fontWeight:"semibold",children:"Metadata JSON:"})]}),l.jsx(We,{sx:{mt:0,mr:2,mb:4,ml:2,padding:4,borderRadius:"base",overflowX:"scroll",wordBreak:"break-all",bg:"whiteAlpha.100"},children:l.jsx("pre",{children:F})})]})]}):l.jsx(Cx,{width:"100%",pt:10,children:l.jsx(Ce,{fontSize:"lg",fontWeight:"semibold",children:"No metadata available"})})]})})},V9);hp.displayName="ImageMetadataViewer";const o0={height:"100%",width:"15%",alignItems:"center",pointerEvents:"auto"},a0={color:"base.100"},U9=be(Vr,e=>{const{currentImage:t}=e,n=e.categories[t?t.category:"result"].images,r=n.findIndex(s=>{var c;return s.uuid===((c=e==null?void 0:e.currentImage)==null?void 0:c.uuid)}),i=n.length;return{isOnFirstImage:r===0,isOnLastImage:!isNaN(r)&&r===i-1}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Yy=()=>{const e=X(),{t}=Y(),{isOnFirstImage:n,isOnLastImage:r}=O(U9),[i,s]=x.useState(!1),c=()=>{s(!0)},u=()=>{s(!1)},f=()=>{e(N1())},h=()=>{e(F1())};return l.jsxs(B,{sx:{justifyContent:"space-between",zIndex:1,height:"100%",width:"100%",pointerEvents:"none"},children:[l.jsx($n,{sx:{...o0,justifyContent:"flex-start"},onMouseOver:c,onMouseOut:u,children:i&&!n&&l.jsx(ci,{"aria-label":t("accessibility.previousImage"),icon:l.jsx(P8,{size:64}),variant:"unstyled",onClick:f,boxSize:16,sx:a0})}),l.jsx($n,{sx:{...o0,justifyContent:"flex-end"},onMouseOver:c,onMouseOut:u,children:i&&!r&&l.jsx(ci,{"aria-label":t("accessibility.nextImage"),icon:l.jsx(I8,{size:64}),variant:"unstyled",onClick:h,boxSize:16,sx:a0})})]})};var Wn=function(e,t){return Number(e.toFixed(t))},$9=function(e,t){return typeof e=="number"?e:t},Tt=function(e,t,n){n&&typeof n=="function"&&n(e,t)},G9=function(e){return-Math.cos(e*Math.PI)/2+.5},q9=function(e){return e},Y9=function(e){return e*e},X9=function(e){return e*(2-e)},K9=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},Q9=function(e){return e*e*e},Z9=function(e){return--e*e*e+1},J9=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},eP=function(e){return e*e*e*e},tP=function(e){return 1- --e*e*e*e},nP=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},rP=function(e){return e*e*e*e*e},iP=function(e){return 1+--e*e*e*e*e},oP=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},Xy={easeOut:G9,linear:q9,easeInQuad:Y9,easeOutQuad:X9,easeInOutQuad:K9,easeInCubic:Q9,easeOutCubic:Z9,easeInOutCubic:J9,easeInQuart:eP,easeOutQuart:tP,easeInOutQuart:nP,easeInQuint:rP,easeOutQuint:iP,easeInOutQuint:oP},Ky=function(e){typeof e=="number"&&cancelAnimationFrame(e)},gr=function(e){e.mounted&&(Ky(e.animation),e.animate=!1,e.animation=null,e.velocity=null)};function Qy(e,t,n,r){if(e.mounted){var i=new Date().getTime(),s=1;gr(e),e.animation=function(){if(!e.mounted)return Ky(e.animation);var c=new Date().getTime()-i,u=c/n,f=Xy[t],h=f(u);c>=n?(r(s),e.animation=null):e.animation&&(r(h),requestAnimationFrame(e.animation))},requestAnimationFrame(e.animation)}}function aP(e){var t=e.scale,n=e.positionX,r=e.positionY;return!(Number.isNaN(t)||Number.isNaN(n)||Number.isNaN(r))}function vi(e,t,n,r){var i=aP(t);if(!(!e.mounted||!i)){var s=e.setTransformState,c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,p=t.scale-u,g=t.positionX-f,y=t.positionY-h;n===0?s(t.scale,t.positionX,t.positionY):Qy(e,r,n,function(S){var C=u+p*S,w=f+g*S,k=h+y*S;s(C,w,k)})}}function sP(e,t,n){var r=e.offsetWidth,i=e.offsetHeight,s=t.offsetWidth,c=t.offsetHeight,u=s*n,f=c*n,h=r-u,p=i-f;return{wrapperWidth:r,wrapperHeight:i,newContentWidth:u,newDiffWidth:h,newContentHeight:f,newDiffHeight:p}}var lP=function(e,t,n,r,i,s,c){var u=e>t?n*(c?1:.5):0,f=r>i?s*(c?1:.5):0,h=e-t-u,p=u,g=r-i-f,y=f;return{minPositionX:h,maxPositionX:p,minPositionY:g,maxPositionY:y}},pp=function(e,t){var n=e.wrapperComponent,r=e.contentComponent,i=e.setup.centerZoomedOut;if(!n||!r)throw new Error("Components are not mounted");var s=sP(n,r,t),c=s.wrapperWidth,u=s.wrapperHeight,f=s.newContentWidth,h=s.newDiffWidth,p=s.newContentHeight,g=s.newDiffHeight,y=lP(c,f,h,u,p,g,Boolean(i));return y},Df=function(e,t,n,r){return r?en?Wn(n,2):Wn(e,2):Wn(e,2)},ea=function(e,t){var n=pp(e,t);return e.bounds=n,n};function Nc(e,t,n,r,i,s,c){var u=n.minPositionX,f=n.minPositionY,h=n.maxPositionX,p=n.maxPositionY,g=0,y=0;c&&(g=i,y=s);var S=Df(e,u-g,h+g,r),C=Df(t,f-y,p+y,r);return{x:S,y:C}}function Fc(e,t,n,r,i,s){var c=e.transformState,u=c.scale,f=c.positionX,h=c.positionY,p=r-u;if(typeof t!="number"||typeof n!="number")return console.error("Mouse X and Y position were not provided!"),{x:f,y:h};var g=f-t*p,y=h-n*p,S=Nc(g,y,i,s,0,0,null);return S}function ys(e,t,n,r,i){var s=i?r:0,c=t-s;return!Number.isNaN(n)&&e>=n?n:!Number.isNaN(t)&&e<=c?c:e}var s0=function(e,t){var n=e.setup.panning.excluded,r=e.isInitialized,i=e.wrapperComponent,s=t.target,c=i==null?void 0:i.contains(s),u=r&&s&&c;if(!u)return!1;var f=Lc(s,n);return!f},l0=function(e){var t=e.isInitialized,n=e.isPanning,r=e.setup,i=r.panning.disabled,s=t&&n&&!i;return!!s},cP=function(e,t){var n=e.transformState,r=n.positionX,i=n.positionY;e.isPanning=!0;var s=t.clientX,c=t.clientY;e.startCoords={x:s-r,y:c-i}},uP=function(e,t){var n=t.touches,r=e.transformState,i=r.positionX,s=r.positionY;e.isPanning=!0;var c=n.length===1;if(c){var u=n[0].clientX,f=n[0].clientY;e.startCoords={x:u-i,y:f-s}}};function dP(e){var t=e.transformState,n=t.positionX,r=t.positionY,i=t.scale,s=e.setup,c=s.disabled,u=s.limitToBounds,f=s.centerZoomedOut,h=e.wrapperComponent;if(!(c||!h||!e.bounds)){var p=e.bounds,g=p.maxPositionX,y=p.minPositionX,S=p.maxPositionY,C=p.minPositionY,w=n>g||nS||rg?h.offsetWidth:e.setup.minPositionX||0,M=r>S?h.offsetHeight:e.setup.minPositionY||0,P=Fc(e,j,M,i,e.bounds,u||f),I=P.x,T=P.y;return{scale:i,positionX:w?I:n,positionY:k?T:r}}}function fP(e,t,n,r,i){var s=e.setup.limitToBounds,c=e.wrapperComponent,u=e.bounds,f=e.transformState,h=f.scale,p=f.positionX,g=f.positionY;if(!(c===null||u===null||t===p&&n===g)){var y=Nc(t,n,u,s,r,i,c),S=y.x,C=y.y;e.setTransformState(h,S,C)}}var hP=function(e,t,n){var r=e.startCoords,i=e.transformState,s=e.setup.panning,c=s.lockAxisX,u=s.lockAxisY,f=i.positionX,h=i.positionY;if(!r)return{x:f,y:h};var p=t-r.x,g=n-r.y,y=c?f:p,S=u?h:g;return{x:y,y:S}},dc=function(e,t){var n=e.setup,r=e.transformState,i=r.scale,s=n.minScale,c=n.disablePadding;return t>0&&i>=s&&!c?t:0},pP=function(e){var t=e.mounted,n=e.setup,r=n.disabled,i=n.velocityAnimation,s=e.transformState.scale,c=i.disabled,u=!c||s>1||!r||t;return!!u},mP=function(e){var t=e.mounted,n=e.velocity,r=e.bounds,i=e.setup,s=i.disabled,c=i.velocityAnimation,u=e.transformState.scale,f=c.disabled,h=!f||u>1||!s||t;return!(!h||!n||!r)};function vP(e,t){var n=e.setup.velocityAnimation,r=n.equalToMove,i=n.animationTime,s=n.sensitivity;return r?i*t*s:i}function c0(e,t,n,r,i,s,c,u,f,h){if(i){if(t>c&&n>c){var p=c+(e-c)*h;return p>f?f:ps?s:p}}return r?t:Df(e,s,c,i)}function gP(e,t){var n=1;return t?Math.min(n,e.offsetWidth/window.innerWidth):n}function xP(e,t){var n=pP(e);if(n){var r=e.lastMousePosition,i=e.velocityTime,s=e.setup,c=e.wrapperComponent,u=s.velocityAnimation.equalToMove,f=Date.now();if(r&&i&&c){var h=gP(c,u),p=t.x-r.x,g=t.y-r.y,y=p/h,S=g/h,C=f-i,w=p*p+g*g,k=Math.sqrt(w)/C;e.velocity={velocityX:y,velocityY:S,total:k}}e.lastMousePosition=t,e.velocityTime=f}}function yP(e){var t=e.velocity,n=e.bounds,r=e.setup,i=e.wrapperComponent,s=mP(e);if(!(!s||!t||!n||!i)){var c=t.velocityX,u=t.velocityY,f=t.total,h=n.maxPositionX,p=n.minPositionX,g=n.maxPositionY,y=n.minPositionY,S=r.limitToBounds,C=r.alignmentAnimation,w=r.zoomAnimation,k=r.panning,j=k.lockAxisY,M=k.lockAxisX,P=w.animationType,I=C.sizeX,T=C.sizeY,D=C.velocityAlignmentTime,_=D,z=vP(e,f),V=Math.max(z,_),F=dc(e,I),L=dc(e,T),Q=F*i.offsetWidth/100,$=L*i.offsetHeight/100,Z=h+Q,te=p-Q,ie=g+$,U=y-$,K=e.transformState,ne=new Date().getTime();Qy(e,P,V,function(ce){var Re=e.transformState,ze=Re.scale,Me=Re.positionX,oe=Re.positionY,ae=new Date().getTime()-ne,je=ae/_,Be=Xy[C.animationType],Ne=1-Be(Math.min(1,je)),Ge=1-ce,Qe=Me+c*Ge,ve=oe+u*Ge,_e=c0(Qe,K.positionX,Me,M,S,p,h,te,Z,Ne),qe=c0(ve,K.positionY,oe,j,S,y,g,U,ie,Ne);(Me!==Qe||oe!==ve)&&e.setTransformState(ze,_e,qe)})}}function u0(e,t){var n=e.transformState.scale;gr(e),ea(e,n),window.TouchEvent!==void 0&&t instanceof TouchEvent?uP(e,t):cP(e,t)}function Zy(e){var t=e.transformState.scale,n=e.setup,r=n.minScale,i=n.alignmentAnimation,s=i.disabled,c=i.sizeX,u=i.sizeY,f=i.animationTime,h=i.animationType,p=s||t.1&&g;y?yP(e):Zy(e)}}function mp(e,t,n,r){var i=e.setup,s=i.minScale,c=i.maxScale,u=i.limitToBounds,f=ys(Wn(t,2),s,c,0,!1),h=ea(e,f),p=Fc(e,n,r,f,h,u),g=p.x,y=p.y;return{scale:f,positionX:g,positionY:y}}function Jy(e,t,n){var r=e.transformState.scale,i=e.wrapperComponent,s=e.setup,c=s.minScale,u=s.limitToBounds,f=s.zoomAnimation,h=f.disabled,p=f.animationTime,g=f.animationType,y=h||r>=c;if((r>=1||u)&&Zy(e),!(y||!i||!e.mounted)){var S=t||i.offsetWidth/2,C=n||i.offsetHeight/2,w=mp(e,c,S,C);w&&vi(e,w,p,g)}}var li=function(){return li=Object.assign||function(t){for(var n,r=1,i=arguments.length;rc||Math.sign(n.deltaY)!==Math.sign(t.deltaY)||n.deltaY>0&&n.deltaYt.deltaY||Math.sign(n.deltaY)!==Math.sign(t.deltaY):!1},RP=function(e,t){var n=e.setup.pinch,r=n.disabled,i=n.excluded,s=e.isInitialized,c=t.target,u=s&&!r&&c;if(!u)return!1;var f=Lc(c,i);return!f},NP=function(e){var t=e.setup.pinch.disabled,n=e.isInitialized,r=e.pinchStartDistance,i=n&&!t&&r;return!!i},FP=function(e,t,n){var r=n.getBoundingClientRect(),i=e.touches,s=Wn(i[0].clientX-r.left,5),c=Wn(i[0].clientY-r.top,5),u=Wn(i[1].clientX-r.left,5),f=Wn(i[1].clientY-r.top,5);return{x:(s+u)/2/t,y:(c+f)/2/t}},a4=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},LP=function(e,t){var n=e.pinchStartScale,r=e.pinchStartDistance,i=e.setup,s=i.maxScale,c=i.minScale,u=i.zoomAnimation,f=i.disablePadding,h=u.size,p=u.disabled;if(!n||r===null||!t)throw new Error("Pinch touches distance was not provided");if(t<0)return e.transformState.scale;var g=t/r,y=g*n;return ys(Wn(y,2),c,s,h,!p&&!f)},BP=160,HP=100,WP=function(e,t){var n=e.props,r=n.onWheelStart,i=n.onZoomStart;e.wheelStopEventTimer||(gr(e),Tt(dt(e),t,r),Tt(dt(e),t,i))},VP=function(e,t){var n=e.props,r=n.onWheel,i=n.onZoom,s=e.contentComponent,c=e.setup,u=e.transformState,f=u.scale,h=c.limitToBounds,p=c.centerZoomedOut,g=c.zoomAnimation,y=c.wheel,S=c.disablePadding,C=g.size,w=g.disabled,k=y.step;if(!s)throw new Error("Component not mounted");t.preventDefault(),t.stopPropagation();var j=OP(t,null),M=AP(e,j,k,!t.ctrlKey);if(f!==M){var P=ea(e,M),I=o4(t,s,f),T=w||C===0||p||S,D=h&&T,_=Fc(e,I.x,I.y,M,P,D),z=_.x,V=_.y;e.previousWheelEvent=t,e.setTransformState(M,z,V),Tt(dt(e),t,r),Tt(dt(e),t,i)}},UP=function(e,t){var n=e.props,r=n.onWheelStop,i=n.onZoomStop;Of(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(Jy(e,t.x,t.y),e.wheelAnimationTimer=null)},HP);var s=zP(e,t);s&&(Of(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,Tt(dt(e),t,r),Tt(dt(e),t,i))},BP))},$P=function(e,t){var n=a4(t);e.pinchStartDistance=n,e.lastDistance=n,e.pinchStartScale=e.transformState.scale,e.isPanning=!1,gr(e)},GP=function(e,t){var n=e.contentComponent,r=e.pinchStartDistance,i=e.transformState.scale,s=e.setup,c=s.limitToBounds,u=s.centerZoomedOut,f=s.zoomAnimation,h=f.disabled,p=f.size;if(!(r===null||!n)){var g=FP(t,i,n);if(!(!Number.isFinite(g.x)||!Number.isFinite(g.y))){var y=a4(t),S=LP(e,y);if(S!==i){var C=ea(e,S),w=h||p===0||u,k=c&&w,j=Fc(e,g.x,g.y,S,C,k),M=j.x,P=j.y;e.pinchMidpoint=g,e.lastDistance=y,e.setTransformState(S,M,P)}}}},qP=function(e){var t=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,Jy(e,t==null?void 0:t.x,t==null?void 0:t.y)},s4=function(e,t){var n=e.props.onZoomStop,r=e.setup.doubleClick.animationTime;Of(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,Tt(dt(e),t,n)},r)},YP=function(e,t){var n=e.props,r=n.onZoomStart,i=n.onZoom,s=e.setup.doubleClick,c=s.animationTime,u=s.animationType;Tt(dt(e),t,r),r4(e,c,u,function(){return Tt(dt(e),t,i)}),s4(e,t)};function XP(e,t){var n=e.setup,r=e.doubleClickStopEventTimer,i=e.transformState,s=e.contentComponent,c=i.scale,u=e.props,f=u.onZoomStart,h=u.onZoom,p=n.doubleClick,g=p.disabled,y=p.mode,S=p.step,C=p.animationTime,w=p.animationType;if(!g&&!r){if(y==="reset")return YP(e,t);if(!s)return console.error("No ContentComponent found");var k=y==="zoomOut"?-1:1,j=t4(e,k,S);if(c!==j){Tt(dt(e),t,f);var M=o4(t,s,c),P=mp(e,j,M.x,M.y);if(!P)return console.error("Error during zoom event. New transformation state was not calculated.");Tt(dt(e),t,h),vi(e,P,C,w),s4(e,t)}}}var KP=function(e,t){var n=e.isInitialized,r=e.setup,i=e.wrapperComponent,s=r.doubleClick,c=s.disabled,u=s.excluded,f=t.target,h=i==null?void 0:i.contains(f),p=n&&f&&h&&!c;if(!p)return!1;var g=Lc(f,u);return!g},QP=function(){function e(t){var n=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.startCoords=null,this.lastTouch=null,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.animate=!1,this.animation=null,this.maxBounds=null,this.pressedKeys={},this.mount=function(){n.initializeWindowEvents()},this.unmount=function(){n.cleanupWindowEvents()},this.update=function(r){ea(n,n.transformState.scale),n.setup=h0(r)},this.initializeWindowEvents=function(){var r,i=Fd(),s=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,c=s==null?void 0:s.defaultView;c==null||c.addEventListener("mousedown",n.onPanningStart,i),c==null||c.addEventListener("mousemove",n.onPanning,i),c==null||c.addEventListener("mouseup",n.onPanningStop,i),s==null||s.addEventListener("mouseleave",n.clearPanning,i),c==null||c.addEventListener("keyup",n.setKeyUnPressed,i),c==null||c.addEventListener("keydown",n.setKeyPressed,i)},this.cleanupWindowEvents=function(){var r,i,s=Fd(),c=(r=n.wrapperComponent)===null||r===void 0?void 0:r.ownerDocument,u=c==null?void 0:c.defaultView;u==null||u.removeEventListener("mousedown",n.onPanningStart,s),u==null||u.removeEventListener("mousemove",n.onPanning,s),u==null||u.removeEventListener("mouseup",n.onPanningStop,s),c==null||c.removeEventListener("mouseleave",n.clearPanning,s),u==null||u.removeEventListener("keyup",n.setKeyUnPressed,s),u==null||u.removeEventListener("keydown",n.setKeyPressed,s),document.removeEventListener("mouseleave",n.clearPanning,s),gr(n),(i=n.observer)===null||i===void 0||i.disconnect()},this.handleInitializeWrapperEvents=function(r){var i=Fd();r.addEventListener("wheel",n.onWheelZoom,i),r.addEventListener("dblclick",n.onDoubleClick,i),r.addEventListener("touchstart",n.onTouchPanningStart,i),r.addEventListener("touchmove",n.onTouchPanning,i),r.addEventListener("touchend",n.onTouchPanningStop,i)},this.handleInitialize=function(r){var i=n.setup.centerOnInit;n.applyTransformation(),i&&(n.setCenter(),n.observer=new ResizeObserver(function(){var s;n.setCenter(),(s=n.observer)===null||s===void 0||s.disconnect()}),n.observer.observe(r))},this.onWheelZoom=function(r){var i=n.setup.disabled;if(!i){var s=_P(n,r);if(s){var c=n.isPressingKeys(n.setup.wheel.activationKeys);c&&(WP(n,r),VP(n,r),UP(n,r))}}},this.onPanningStart=function(r){var i=n.setup.disabled,s=n.props.onPanningStart;if(!i){var c=s0(n,r);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),gr(n),u0(n,r),Tt(dt(n),r,s))}}},this.onPanning=function(r){var i=n.setup.disabled,s=n.props.onPanning;if(!i){var c=l0(n);if(c){var u=n.isPressingKeys(n.setup.panning.activationKeys);u&&(r.preventDefault(),r.stopPropagation(),d0(n,r.clientX,r.clientY),Tt(dt(n),r,s))}}},this.onPanningStop=function(r){var i=n.props.onPanningStop;n.isPanning&&(bP(n),Tt(dt(n),r,i))},this.onPinchStart=function(r){var i=n.setup.disabled,s=n.props,c=s.onPinchingStart,u=s.onZoomStart;if(!i){var f=RP(n,r);f&&($P(n,r),gr(n),Tt(dt(n),r,c),Tt(dt(n),r,u))}},this.onPinch=function(r){var i=n.setup.disabled,s=n.props,c=s.onPinching,u=s.onZoom;if(!i){var f=NP(n);f&&(r.preventDefault(),r.stopPropagation(),GP(n,r),Tt(dt(n),r,c),Tt(dt(n),r,u))}},this.onPinchStop=function(r){var i=n.props,s=i.onPinchingStop,c=i.onZoomStop;n.pinchStartScale&&(qP(n),Tt(dt(n),r,s),Tt(dt(n),r,c))},this.onTouchPanningStart=function(r){var i=n.setup.disabled,s=n.props.onPanningStart;if(!i){var c=s0(n,r);if(c){var u=n.lastTouch&&+new Date-n.lastTouch<200;if(u&&r.touches.length===1)n.onDoubleClick(r);else{n.lastTouch=+new Date,gr(n);var f=r.touches,h=f.length===1,p=f.length===2;h&&(gr(n),u0(n,r),Tt(dt(n),r,s)),p&&n.onPinchStart(r)}}}},this.onTouchPanning=function(r){var i=n.setup.disabled,s=n.props.onPanning;if(n.isPanning&&r.touches.length===1){if(i)return;var c=l0(n);if(!c)return;r.preventDefault(),r.stopPropagation();var u=r.touches[0];d0(n,u.clientX,u.clientY),Tt(dt(n),r,s)}else r.touches.length>1&&n.onPinch(r)},this.onTouchPanningStop=function(r){n.onPanningStop(r),n.onPinchStop(r)},this.onDoubleClick=function(r){var i=n.setup.disabled;if(!i){var s=KP(n,r);s&&XP(n,r)}},this.clearPanning=function(r){n.isPanning&&n.onPanningStop(r)},this.setKeyPressed=function(r){n.pressedKeys[r.key]=!0},this.setKeyUnPressed=function(r){n.pressedKeys[r.key]=!1},this.isPressingKeys=function(r){return r.length?Boolean(r.find(function(i){return n.pressedKeys[i]})):!0},this.setTransformState=function(r,i,s){var c=n.props.onTransformed;if(!Number.isNaN(r)&&!Number.isNaN(i)&&!Number.isNaN(s)){r!==n.transformState.scale&&(n.transformState.previousScale=n.transformState.scale,n.transformState.scale=r),n.transformState.positionX=i,n.transformState.positionY=s;var u=dt(n);n.onChangeCallbacks.forEach(function(f){return f(u)}),Tt(u,{scale:r,positionX:i,positionY:s},c),n.applyTransformation()}else console.error("Detected NaN set state values")},this.setCenter=function(){if(n.wrapperComponent&&n.contentComponent){var r=i4(n.transformState.scale,n.wrapperComponent,n.contentComponent);n.setTransformState(r.scale,r.positionX,r.positionY)}},this.handleTransformStyles=function(r,i,s){return n.props.customTransform?n.props.customTransform(r,i,s):MP(r,i,s)},this.applyTransformation=function(){if(!(!n.mounted||!n.contentComponent)){var r=n.transformState,i=r.scale,s=r.positionX,c=r.positionY,u=n.handleTransformStyles(s,c,i);n.contentComponent.style.transform=u}},this.getContext=function(){return dt(n)},this.onChange=function(r){return n.onChangeCallbacks.has(r)||n.onChangeCallbacks.add(r),function(){n.onChangeCallbacks.delete(r)}},this.init=function(r,i){n.cleanupWindowEvents(),n.wrapperComponent=r,n.contentComponent=i,ea(n,n.transformState.scale),n.handleInitializeWrapperEvents(r),n.handleInitialize(i),n.initializeWindowEvents(),n.isInitialized=!0,Tt(dt(n),void 0,n.props.onInit)},this.props=t,this.setup=h0(this.props),this.transformState=e4(this.props)}return e}(),Bc=ke.createContext(null),ZP=function(e,t){return typeof e=="function"?e(t):e},JP=ke.forwardRef(function(e,t){var n=x.useState(0),r=n[1],i=e.children,s=x.useRef(new QP(e)).current,c=ZP(e.children,dt(s)),u=x.useCallback(function(){typeof i=="function"&&r(function(f){return f+1})},[i]);return x.useImperativeHandle(t,function(){return dt(s)},[s]),x.useEffect(function(){s.update(e)},[s,e]),x.useEffect(function(){return s.onChange(u)},[s,e,u]),ke.createElement(Bc.Provider,{value:s},c)});function eI(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var tI=`.transform-component-module_wrapper__7HFJe { + position: relative; + width: -moz-fit-content; + width: fit-content; + height: -moz-fit-content; + height: fit-content; + overflow: hidden; + -webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Safari */ + -khtml-user-select: none; /* Konqueror HTML */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; + margin: 0; + padding: 0; +} +.transform-component-module_content__uCDPE { + display: flex; + flex-wrap: wrap; + width: -moz-fit-content; + width: fit-content; + height: -moz-fit-content; + height: fit-content; + margin: 0; + padding: 0; + transform-origin: 0% 0%; +} +.transform-component-module_content__uCDPE img { + pointer-events: none; +} +`,p0={wrapper:"transform-component-module_wrapper__7HFJe",content:"transform-component-module_content__uCDPE"};eI(tI);var nI=function(e){var t=e.children,n=e.wrapperClass,r=n===void 0?"":n,i=e.contentClass,s=i===void 0?"":i,c=e.wrapperStyle,u=e.contentStyle,f=e.wrapperProps,h=f===void 0?{}:f,p=e.contentProps,g=p===void 0?{}:p,y=x.useContext(Bc).init,S=x.useRef(null),C=x.useRef(null);return x.useEffect(function(){var w=S.current,k=C.current;w!==null&&k!==null&&y&&y(w,k)},[]),ke.createElement("div",li({},h,{ref:S,className:"react-transform-wrapper ".concat(p0.wrapper," ").concat(r),style:c}),ke.createElement("div",li({},g,{ref:C,className:"react-transform-component ".concat(p0.content," ").concat(s),style:u}),t))},l4=function(){var e=x.useContext(Bc),t=x.useState(dt(e||{})),n=t[0],r=t[1];if(!e)throw new Error("Transform context mus be placed inside TransformWrapper");return x.useEffect(function(){e.onChange(function(i){r(i)})},[e]),n};ke.forwardRef(function(e,t){var n=x.useRef(null),r=x.useContext(Bc);return x.useEffect(function(){return r.onChange(function(i){if(n.current){var s=0,c=0;n.current.style.transform=r.handleTransformStyles(s,c,1/i.state.scale)}})},[r]),ke.createElement("div",li({},e,{ref:TP([n,t])}))});const rI=()=>{const[e,t]=x.useState(0),[n,r]=x.useState(1),[i,s]=x.useState(1);return{rotation:e,scaleX:n,scaleY:i,flipHorizontally:()=>{r(n*-1)},flipVertically:()=>{s(i*-1)},rotateCounterClockwise:()=>{t(e===-270?0:e-90)},rotateClockwise:()=>{t(e===270?0:e+90)},reset:()=>{t(0),r(1),s(1)}}},iI=({flipHorizontally:e,flipVertically:t,rotateCounterClockwise:n,rotateClockwise:r,reset:i})=>{const{zoomIn:s,zoomOut:c,resetTransform:u}=l4(),{t:f}=Y();return l.jsxs(en,{isAttached:!0,orientation:"vertical",children:[l.jsx(ue,{icon:l.jsx(t8,{}),"aria-label":f("accessibility.zoomIn"),tooltip:"Zoom In",onClick:()=>s(),fontSize:20}),l.jsx(ue,{icon:l.jsx(n8,{}),"aria-label":f("accessibility.zoomOut"),tooltip:"Zoom Out",onClick:()=>c(),fontSize:20}),l.jsx(ue,{icon:l.jsx(J7,{}),"aria-label":f("accessibility.rotateCounterClockwise"),tooltip:"Rotate Counter-Clockwise",onClick:n,fontSize:20}),l.jsx(ue,{icon:l.jsx(e8,{}),"aria-label":f("accessibility.rotateClockwise"),tooltip:"Rotate Clockwise",onClick:r,fontSize:20}),l.jsx(ue,{icon:l.jsx(Jg,{}),"aria-label":f("accessibility.flipHorizontally"),tooltip:"Flip Horizontally",onClick:e,fontSize:20}),l.jsx(ue,{icon:l.jsx(Jg,{style:{transform:"rotate(90deg)"}}),"aria-label":f("accessibility.flipVertically"),tooltip:"Flip Vertically",onClick:t,fontSize:20}),l.jsx(ue,{icon:l.jsx(ep,{}),"aria-label":f("accessibility.reset"),tooltip:"Reset",onClick:()=>{u(),i()},fontSize:20})]})};function oI({image:e,alt:t,ref:n,styleClass:r,rotation:i,scaleX:s,scaleY:c}){const{centerView:u}=l4();return l.jsx(nI,{wrapperStyle:{width:"100%",height:"100%"},children:l.jsx("img",{style:{transform:`rotate(${i}deg) scaleX(${s}) scaleY(${c})`,width:"100%"},src:e,alt:t,ref:n,className:r||"",onLoad:()=>u(1,0,"easeOut")})})}const aI=be([Vr,ro],(e,t)=>{const{currentImage:n}=e,{shouldShowImageDetails:r}=t;return{viewerImageToDisplay:n,shouldShowImageDetails:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function sI(){const e=X(),{t}=Y(),n=O(S=>S.lightbox.isLightboxOpen),{rotation:r,scaleX:i,scaleY:s,flipHorizontally:c,flipVertically:u,rotateCounterClockwise:f,rotateClockwise:h,reset:p}=rI(),{viewerImageToDisplay:g,shouldShowImageDetails:y}=O(aI);return fe("Esc",()=>{n&&e(Bi(!1))},[n]),l.jsx(JP,{centerOnInit:!0,minScale:.1,initialPositionX:50,initialPositionY:50,children:l.jsxs(We,{sx:{width:"100%",height:"100%",overflow:"hidden",position:"absolute",insetInlineStart:0,top:0,zIndex:30,animation:"popIn 0.3s ease-in",bg:"base.800"},children:[l.jsxs(B,{sx:{flexDir:"column",position:"absolute",top:4,insetInlineStart:4,gap:4,zIndex:3},children:[l.jsx(ue,{icon:l.jsx(Z7,{}),"aria-label":t("accessibility.exitViewer"),onClick:()=>{e(Bi(!1))},fontSize:20}),l.jsx(iI,{flipHorizontally:c,flipVertically:u,rotateCounterClockwise:f,rotateClockwise:h,reset:p})]}),l.jsxs(B,{children:[l.jsxs($n,{sx:{overflow:"hidden",gridTemplateColumns:"auto max-content",placeItems:"center",width:"100vw",height:"100vh",bg:"base.850"},children:[g&&l.jsxs(l.Fragment,{children:[l.jsx(oI,{rotation:r,scaleX:i,scaleY:s,image:g.url,styleClass:"lightbox-image"}),y&&l.jsx(hp,{image:g})]}),!y&&l.jsx(We,{sx:{position:"absolute",top:0,insetInlineStart:0,w:`calc(100vw - ${8*2*4}px)`,h:"100vh",mx:8,pointerEvents:"none"},children:l.jsx(Yy,{})}),l.jsx(We,{sx:{position:"absolute",top:4},children:l.jsx(Fy,{})})]}),l.jsx(Gy,{})]})]})})}function lI(e){const{menuType:t="icon",iconTooltip:n,buttonText:r,isLazy:i=!0,menuItems:s,menuProps:c,menuButtonProps:u,menuListProps:f,menuItemProps:h}=e,p=()=>{const g=[];return s.forEach((y,S)=>{g.push(l.jsx(pr,{onClick:y.onClick,fontSize:"sm",...h,children:y.item},S))}),g};return l.jsx(Rh,{...c,isLazy:i,children:({isOpen:g})=>l.jsxs(l.Fragment,{children:[l.jsx(Fh,{as:t==="icon"?ci:to,tooltip:n,"aria-label":n,icon:g?l.jsx(w9,{}):l.jsx(C9,{}),paddingX:0,paddingY:t==="regular"?2:0,...u,children:t==="regular"&&r}),l.jsx(Nh,{zIndex:15,padding:0,...f,children:p()})]})})}const cI=be(Pt,e=>({isProcessing:e.isProcessing,isConnected:e.isConnected,isCancelable:e.isCancelable,currentIteration:e.currentIteration,totalIterations:e.totalIterations,cancelType:e.cancelOptions.cancelType,cancelAfter:e.cancelOptions.cancelAfter}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function vp(e){const t=X(),{btnGroupWidth:n="auto",...r}=e,{isProcessing:i,isConnected:s,isCancelable:c,currentIteration:u,totalIterations:f,cancelType:h,cancelAfter:p}=O(cI),g=x.useCallback(()=>{t(iC()),t(dd(null))},[t]),{t:y}=Y(),S=p!==null;fe("shift+x",()=>{(s||i)&&c&&g()},[s,i,c]),x.useEffect(()=>{p!==null&&pt(Fv("immediate"))},{item:y("parameters.cancel.schedule"),onClick:()=>t(Fv("scheduled"))}];return l.jsxs(en,{isAttached:!0,width:n,children:[h==="immediate"?l.jsx(ue,{icon:l.jsx(k9,{}),tooltip:y("parameters.cancel.immediate"),"aria-label":y("parameters.cancel.immediate"),isDisabled:!s||!i||!c,onClick:g,colorScheme:"error",...r}):l.jsx(ue,{icon:S?l.jsx(ic,{}):l.jsx(h9,{}),tooltip:y(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),"aria-label":y(S?"parameters.cancel.isScheduled":"parameters.cancel.schedule"),isDisabled:!s||!i||!c||u===f,onClick:()=>{t(S?dd(null):dd(u))},colorScheme:"error",...r}),l.jsx(lI,{menuItems:C,iconTooltip:y("parameters.cancel.setType"),menuButtonProps:{colorScheme:"error",minWidth:5}})]})}const gp=e=>e.generation;be(gp,({shouldRandomizeSeed:e,shouldGenerateVariations:t})=>e||t,{memoizeOptions:{resultEqualityCheck:ee.isEqual}});const c4=be([gp,Pt,Ny,Bt],(e,t,n,r)=>{const{prompt:i,shouldGenerateVariations:s,seedWeights:c,initialImage:u,seed:f}=e,{isProcessing:h,isConnected:p}=t;let g=!0;const y=[];return(!i||Boolean(i.match(/^[\s\r\n]+$/)))&&(g=!1,y.push("Missing prompt")),r==="img2img"&&!u&&(g=!1,y.push("No initial image selected")),h&&(g=!1,y.push("System Busy")),p||(g=!1,y.push("System Disconnected")),s&&(!(U1(c)||c==="")||f===-1)&&(g=!1,y.push("Seed-Weights badly formatted.")),{isReady:g,reasonsWhyNotReady:y}},{memoizeOptions:{equalityCheck:ee.isEqual,resultEqualityCheck:ee.isEqual}});function xp(e){const{iconButton:t=!1,...n}=e,r=X(),{isReady:i}=O(c4),s=O(Bt),c=()=>{r(af(s))},{t:u}=Y();return fe(["ctrl+enter","meta+enter"],()=>{r($1()),r(af(s))},{enabled:()=>i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[i,s]),l.jsx(We,{style:{flexGrow:4},children:t?l.jsx(ue,{"aria-label":u("parameters.invoke"),type:"submit",icon:l.jsx($8,{}),isDisabled:!i,onClick:c,flexGrow:1,w:"100%",tooltip:u("parameters.invoke"),tooltipProps:{placement:"bottom"},colorScheme:"accent",...n}):l.jsx(Je,{"aria-label":u("parameters.invoke"),type:"submit",isDisabled:!i,onClick:c,flexGrow:1,w:"100%",colorScheme:"accent",fontWeight:700,...n,children:"Invoke"})})}const Ld={borderStartStartRadius:0,borderEndStartRadius:0},yp=be([Vr,ro,Bt],(e,t,n)=>{const{shouldPinParametersPanel:r,shouldShowParametersPanel:i,shouldHoldParametersPanelOpen:s,shouldUseCanvasBetaLayout:c}=t,{shouldShowGallery:u,shouldPinGallery:f,shouldHoldGalleryOpen:h}=e,p=c&&n==="unifiedCanvas",g=!p&&!(i||s&&!r)&&["txt2img","img2img","unifiedCanvas"].includes(n),y=!(u||h&&!f)&&["txt2img","img2img","unifiedCanvas"].includes(n);return{shouldPinParametersPanel:r,shouldShowProcessButtons:!p&&(!r||!i),shouldShowParametersPanelButton:g,shouldShowParametersPanel:i,shouldShowGallery:u,shouldPinGallery:f,shouldShowGalleryButton:y}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),uI=()=>{const e=X(),{t}=Y(),{shouldShowParametersPanelButton:n,shouldShowProcessButtons:r,shouldPinParametersPanel:i}=O(yp),s=()=>{e(Hi(!0)),i&&setTimeout(()=>e(on(!0)),400)};return n?l.jsxs(B,{pos:"absolute",transform:"translate(0, -50%)",zIndex:20,minW:8,top:"50%",insetInlineStart:"4.5rem",direction:"column",gap:2,children:[l.jsx(ue,{tooltip:"Show Options Panel (O)",tooltipProps:{placement:"top"},"aria-label":t("accessibility.showOptionsPanel"),onClick:s,sx:Ld,children:l.jsx(ap,{})}),r&&l.jsxs(l.Fragment,{children:[l.jsx(xp,{iconButton:!0,sx:Ld}),l.jsx(vp,{sx:Ld})]})]}):null},dI=be(Vr,e=>({resultImages:e.categories.result.images,userImages:e.categories.user.images})),fI=()=>{const{resultImages:e,userImages:t}=O(dI);return n=>{const r=e.find(s=>s.uuid===n);if(r)return r;const i=t.find(s=>s.uuid===n);if(i)return i}},hI=be([ro,Ac,Bt],(e,t,n)=>{const{shouldPinParametersPanel:r}=e,{isLightboxOpen:i}=t;return{shouldPinParametersPanel:r,isLightboxOpen:i,activeTabName:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),bp=e=>{const t=X(),{optionsPanel:n,children:r,...i}=e,{activeTabName:s,isLightboxOpen:c}=O(hI),u=fI(),f=h=>{const p=h.dataTransfer.getData("invokeai/imageUuid"),g=u(p);g&&(s==="img2img"?t(os(g)):s==="unifiedCanvas"&&t(bc(g)))};return l.jsx(We,{...i,pos:"relative",w:"100%",h:"100%",children:l.jsxs(B,{gap:4,h:"100%",children:[n,l.jsx(We,{pos:"relative",w:"100%",h:"100%",onDrop:f,children:r}),!c&&l.jsx(Gy,{})]})})},pI=e=>{const{styleClass:t}=e,n=x.useContext(Qh),r=()=>{n&&n()};return l.jsx(B,{sx:{width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},className:t,children:l.jsxs(B,{onClick:r,sx:{display:"flex",flexDirection:"column",rowGap:8,p:8,borderRadius:"base",alignItems:"center",justifyContent:"center",textAlign:"center",cursor:"pointer",color:"base.600",bg:"base.800",_hover:{bg:"base.700"}},children:[l.jsx(Jt,{as:Rc,boxSize:24}),l.jsx(Vn,{size:"md",children:"Click or Drag and Drop"})]})})},mI=be([Vr,ro],(e,t)=>{const{currentImage:n,intermediateImage:r}=e,{shouldShowImageDetails:i}=t;return{imageToDisplay:r||n,isIntermediate:Boolean(r),shouldShowImageDetails:i}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function vI(){const{shouldShowImageDetails:e,imageToDisplay:t,isIntermediate:n}=O(mI);return l.jsxs(B,{sx:{position:"relative",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:[t&&l.jsx(ds,{src:t.url,sx:{objectFit:"contain",maxWidth:"100%",maxHeight:"100%",height:"auto",position:"absolute",imageRendering:n?"pixelated":"initial",borderRadius:"base"},...n&&{width:t.width,height:t.height}}),!e&&l.jsx(Yy,{}),e&&t&&l.jsx(hp,{image:t,styleClass:"current-image-metadata"})]})}const gI=be([Vr],e=>{const{currentImage:t,intermediateImage:n}=e;return{hasAnImageToDisplay:t||n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),u4=()=>{const{hasAnImageToDisplay:e}=O(gI);return l.jsx(B,{sx:{flexDirection:"column",height:"100%",width:"100%",rowGap:4,borderRadius:"base"},children:e?l.jsxs(l.Fragment,{children:[l.jsx(Fy,{}),l.jsx(vI,{})]}):l.jsx(B,{sx:{alignItems:"center",justifyContent:"center",width:"100%",height:"100%"},children:l.jsx(Jt,{as:S9,sx:{boxSize:24,color:"base.500"}})})})},xI=()=>{const{t:e}=Y(),t=x.useContext(Qh);return l.jsx(ue,{"aria-label":e("accessibility.uploadImage"),tooltip:"Upload Image",icon:l.jsx(Rc,{}),onClick:t||void 0})};function yI(){const e=O(s=>s.generation.initialImage),{t}=Y(),n=X(),r=us(),i=()=>{r({title:t("toast.parametersFailed"),description:t("toast.parametersFailedDesc"),status:"error",isClosable:!0}),n(oC())};return l.jsxs(l.Fragment,{children:[l.jsxs(B,{sx:{alignItems:"center",justifyContent:"center",w:"100%",gap:4},children:[l.jsx(Ce,{sx:{fontSize:"lg"},variant:"subtext",children:t("parameters.initialImage")}),l.jsx(xI,{})]}),e&&l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",alignItems:"center",justifyContent:"center"},children:l.jsx(ds,{sx:{fit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"base",objectFit:"contain",position:"absolute"},src:typeof e=="string"?e:e.url,onError:i})})]})}const m0={flexDirection:"column",height:"100%",width:"100%",gap:4,padding:4},bI=()=>{const t=O(n=>n.generation.initialImage)?l.jsx(B,{flexDirection:"column",gap:4,w:"100%",h:"100%",children:l.jsx(yI,{})}):l.jsx(pI,{});return l.jsxs($n,{sx:{w:"100%",h:"100%",gridTemplateColumns:"1fr 1fr",borderRadius:"base",bg:"base.850"},children:[l.jsx(B,{sx:{...m0,paddingInlineEnd:2},children:t}),l.jsx(B,{sx:{...m0,paddingInlineStart:2},children:l.jsx(u4,{})})]})};var dn=(e=>(e[e.PROMPT=0]="PROMPT",e[e.GALLERY=1]="GALLERY",e[e.OTHER=2]="OTHER",e[e.SEED=3]="SEED",e[e.VARIATIONS=4]="VARIATIONS",e[e.UPSCALE=5]="UPSCALE",e[e.FACE_CORRECTION=6]="FACE_CORRECTION",e[e.IMAGE_TO_IMAGE=7]="IMAGE_TO_IMAGE",e[e.BOUNDING_BOX=8]="BOUNDING_BOX",e[e.SEAM_CORRECTION=9]="SEAM_CORRECTION",e[e.INFILL_AND_SCALING=10]="INFILL_AND_SCALING",e))(dn||{});const SI=()=>{const{t:e}=Y();return x.useMemo(()=>({[0]:{text:e("tooltip.feature.prompt"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[1]:{text:e("tooltip.feature.gallery"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[2]:{text:e("tooltip.feature.other"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[3]:{text:e("tooltip.feature.seed"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[4]:{text:e("tooltip.feature.variations"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[5]:{text:e("tooltip.feature.upscale"),href:"link/to/docs/feature1.html",guideImage:"asset/path.gif"},[6]:{text:e("tooltip.feature.faceCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[7]:{text:e("tooltip.feature.imageToImage"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[8]:{text:e("tooltip.feature.boundingBox"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[9]:{text:e("tooltip.feature.seamCorrection"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"},[10]:{text:e("tooltip.feature.infillAndScaling"),href:"link/to/docs/feature3.html",guideImage:"asset/path.gif"}}),[e])},CI=e=>SI()[e];function d4(){const e=O(i=>i.system.isGFPGANAvailable),t=O(i=>i.postprocessing.shouldRunFacetool),n=X(),r=i=>n(aC(i.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}const f4=()=>{const e=X(),t=O(i=>i.generation.seamless),n=i=>e(H1(i.target.checked)),{t:r}=Y();return l.jsx(En,{label:r("parameters.seamlessTiling"),fontSize:"md",isChecked:t,onChange:n})},wI=()=>l.jsx(Le,{gap:2,alignItems:"stretch",children:l.jsx(f4,{})});function Sp(){const e=O(s=>s.generation.horizontalSymmetrySteps),t=O(s=>s.generation.verticalSymmetrySteps),n=O(s=>s.generation.steps),r=X(),{t:i}=Y();return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:i("parameters.hSymmetryStep"),value:e,onChange:s=>r(Lv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Lv(0))}),l.jsx(ut,{label:i("parameters.vSymmetryStep"),value:t,onChange:s=>r(Bv(s)),min:0,max:n,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>r(Bv(0))})]})}function Cp(){const e=O(n=>n.generation.shouldUseSymmetry),t=X();return l.jsx(En,{isChecked:e,onChange:n=>t(sC(n.target.checked))})}function kI(){const e=X(),t=O(r=>r.generation.perlin),{t:n}=Y();return l.jsx(ut,{label:n("parameters.perlinNoise"),min:0,max:1,step:.05,onChange:r=>e(tf(r)),handleReset:()=>e(tf(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}function jI(){const e=X(),{t}=Y(),n=O(i=>i.generation.shouldRandomizeSeed),r=i=>e(lC(i.target.checked));return l.jsx(En,{label:t("parameters.randomizeSeed"),isChecked:n,onChange:r})}const v0=/^-?(0\.)?\.?$/,Lr=e=>{const{label:t,isDisabled:n=!1,showStepper:r=!0,isInvalid:i,value:s,onChange:c,min:u,max:f,isInteger:h=!0,formControlProps:p,formLabelProps:g,numberInputFieldProps:y,numberInputStepperProps:S,tooltipProps:C,...w}=e,[k,j]=x.useState(String(s));x.useEffect(()=>{!k.match(v0)&&s!==Number(k)&&j(String(s))},[s,k]);const M=I=>{j(I),I.match(v0)||c(h?Math.floor(Number(I)):Number(I))},P=I=>{const T=ee.clamp(h?Math.floor(Number(I.target.value)):Number(I.target.value),u,f);j(String(T)),c(T)};return l.jsx(Yt,{...C,children:l.jsxs(rt,{isDisabled:n,isInvalid:i,...p,children:[t&&l.jsx(st,{...g,children:t}),l.jsxs(Bh,{value:k,min:u,max:f,keepWithinRange:!0,clampValueOnBlur:!1,onChange:M,onBlur:P,...w,children:[l.jsx(Wh,{...y}),r&&l.jsxs(Hh,{children:[l.jsx(Uh,{...S}),l.jsx(Vh,{...S})]})]})]})})};function EI(){const e=X(),t=O(i=>i.generation.shouldRandomizeSeed),{t:n}=Y(),r=()=>e(as(cC(q1,G1)));return l.jsx(to,{size:"sm",isDisabled:t,onClick:r,padding:"0 1.5rem",children:l.jsx("p",{children:n("parameters.shuffle")})})}function PI(){const e=O(c=>c.generation.seed),t=O(c=>c.generation.shouldRandomizeSeed),n=O(c=>c.generation.shouldGenerateVariations),{t:r}=Y(),i=X(),s=c=>i(as(c));return l.jsxs(sa,{gap:2,children:[l.jsx(Lr,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:q1,max:G1,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e,formControlProps:{display:"flex",alignItems:"center",gap:3}}),l.jsx(EI,{})]})}function II(){const e=X(),t=O(r=>r.generation.threshold),{t:n}=Y();return l.jsx(ut,{label:n("parameters.noiseThreshold"),min:0,max:20,step:.1,onChange:r=>e(ef(r)),handleReset:()=>e(ef(0)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0})}const wp=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(jI,{}),l.jsx(PI,{}),l.jsx(II,{}),l.jsx(kI,{})]});function h4(){const e=O(i=>i.system.isESRGANAvailable),t=O(i=>i.postprocessing.shouldRunESRGAN),n=X(),r=i=>n(uC(i.target.checked));return l.jsx(En,{isDisabled:!e,isChecked:t,onChange:r})}function kp(){const e=O(r=>r.generation.shouldGenerateVariations),t=X(),n=r=>t(dC(r.target.checked));return l.jsx(En,{isChecked:e,width:"auto",onChange:n})}function mt(e){const{label:t="",isDisabled:n=!1,isInvalid:r,formControlProps:i,...s}=e;return l.jsxs(rt,{isInvalid:r,isDisabled:n,...i,children:[t!==""&&l.jsx(st,{children:t}),l.jsx(wh,{...s})]})}function MI(){const e=O(s=>s.generation.seedWeights),t=O(s=>s.generation.shouldGenerateVariations),{t:n}=Y(),r=X(),i=s=>r(B1(s.target.value));return l.jsx(mt,{label:n("parameters.seedWeights"),value:e,isInvalid:t&&!(U1(e)||e===""),isDisabled:!t,onChange:i})}function TI(){const e=O(i=>i.generation.variationAmount),t=O(i=>i.generation.shouldGenerateVariations),{t:n}=Y(),r=X();return l.jsx(ut,{label:n("parameters.variationAmount"),value:e,step:.01,min:0,max:1,isSliderDisabled:!t,isInputDisabled:!t,isResetDisabled:!t,onChange:i=>r(Hv(i)),handleReset:()=>r(Hv(.1)),withInput:!0,withReset:!0,withSliderMarks:!0})}const jp=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(TI,{}),l.jsx(MI,{})]});function g0(){const e=X(),t=O(s=>s.generation.cfgScale),n=O(s=>s.ui.shouldUseSliders),{t:r}=Y(),i=s=>e(rf(s));return n?l.jsx(ut,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:30,onChange:i,handleReset:()=>e(rf(7.5)),value:t,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0}):l.jsx(Lr,{label:r("parameters.cfgScale"),step:.5,min:1.01,max:200,onChange:i,value:t,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})}function x0(){const e=O(s=>s.generation.height),t=O(s=>s.ui.shouldUseSliders),n=O(Bt),r=X(),{t:i}=Y();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:i("parameters.height"),value:e,min:64,step:64,max:2048,onChange:s=>r(Vl(s)),handleReset:()=>r(Vl(512)),withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:i("parameters.height"),value:e,flexGrow:1,onChange:s=>r(Vl(Number(s.target.value))),validValues:fC})}function y0(){const e=O(s=>s.generation.iterations),t=O(s=>s.ui.shouldUseSliders),n=X(),{t:r}=Y(),i=s=>n(Wv(s));return t?l.jsx(ut,{label:r("parameters.images"),step:1,min:1,max:16,onChange:i,handleReset:()=>n(Wv(1)),value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Lr,{label:r("parameters.images"),step:1,min:1,max:9999,onChange:i,value:e,numberInputFieldProps:{textAlign:"center"}})}function b0(){const e=O(s=>s.generation.sampler),t=O(wy),n=X(),{t:r}=Y(),i=s=>n(L1(s.target.value));return l.jsx(Mn,{label:r("parameters.sampler"),value:e,onChange:i,validValues:t.format==="diffusers"?hC:pC,minWidth:36})}function S0(){const e=X(),t=O(c=>c.generation.steps),n=O(c=>c.ui.shouldUseSliders),{t:r}=Y(),i=c=>{e(nf(c))},s=()=>{e($1())};return n?l.jsx(ut,{label:r("parameters.steps"),min:1,step:1,onChange:i,handleReset:()=>e(nf(20)),value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:9999}}):l.jsx(Lr,{label:r("parameters.steps"),min:1,max:9999,step:1,onChange:i,value:t,numberInputFieldProps:{textAlign:"center"},onBlur:s})}function C0(){const e=O(s=>s.generation.width),t=O(s=>s.ui.shouldUseSliders),n=O(Bt),{t:r}=Y(),i=X();return t?l.jsx(ut,{isSliderDisabled:n==="unifiedCanvas",isInputDisabled:n==="unifiedCanvas",isResetDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,min:64,step:64,max:2048,onChange:s=>i(Wl(s)),handleReset:()=>i(Wl(512)),withInput:!0,withReset:!0,withSliderMarks:!0,inputReadOnly:!0,sliderNumberInputProps:{max:15360}}):l.jsx(Mn,{isDisabled:n==="unifiedCanvas",label:r("parameters.width"),value:e,flexGrow:1,onChange:s=>i(Wl(Number(s.target.value))),validValues:mC})}function Ep(){return O(t=>t.ui.shouldUseSliders)?l.jsxs(Le,{gap:2,children:[l.jsx(y0,{}),l.jsx(S0,{}),l.jsx(g0,{}),l.jsx(C0,{}),l.jsx(x0,{}),l.jsx(b0,{})]}):l.jsxs(B,{rowGap:2,flexDirection:"column",children:[l.jsxs(B,{columnGap:1,children:[l.jsx(y0,{}),l.jsx(S0,{}),l.jsx(g0,{})]}),l.jsxs(B,{columnGap:1,children:[l.jsx(C0,{}),l.jsx(x0,{}),l.jsx(b0,{})]})]})}const _I=be(Pt,e=>e.shouldDisplayGuides),DI=({children:e,feature:t})=>{const n=O(_I),{text:r}=CI(t);return n?l.jsxs(qh,{trigger:"hover",children:[l.jsx(Gh,{children:l.jsx(We,{children:e})}),l.jsxs(Xh,{maxWidth:"400px",onClick:i=>i.preventDefault(),cursor:"initial",children:[l.jsx(Yh,{}),l.jsx(Zx,{children:r})]})]}):null},OI=he(({feature:e,icon:t=p9},n)=>l.jsx(DI,{feature:e,children:l.jsx(We,{ref:n,children:l.jsx(Jt,{marginBottom:"-.15rem",as:t})})}));function AI(e){const{header:t,feature:n,content:r,additionalHeaderComponents:i}=e;return l.jsxs(No,{children:[l.jsx(zo,{children:l.jsxs(B,{width:"100%",gap:2,align:"center",children:[l.jsx(We,{flexGrow:1,textAlign:"start",children:t}),i,n&&l.jsx(OI,{feature:n}),l.jsx(Ro,{})]})}),l.jsx(Lo,{children:r})]})}const Pp=e=>{const{accordionInfo:t}=e,n=O(c=>c.system.openAccordions),r=X(),i=c=>r(vC(c)),s=()=>{const c=[];return t&&Object.keys(t).forEach(u=>{const{header:f,feature:h,content:p,additionalHeaderComponents:g}=t[u];c.push(l.jsx(AI,{header:f,feature:h,content:p,additionalHeaderComponents:g},u))}),c};return l.jsx(sh,{defaultIndex:n,allowMultiple:!0,reduceMotion:!0,onChange:i,children:s()})},zI=be(rp,({shouldLoopback:e})=>e),RI=()=>{const e=X(),t=O(zI),{t:n}=Y();return l.jsx(ue,{"aria-label":n("parameters.toggleLoopback"),tooltip:n("parameters.toggleLoopback"),isChecked:t,icon:l.jsx(q8,{}),onClick:()=>{e(gC(!t))}})},Ip=()=>{const e=O(Bt);return l.jsxs(B,{gap:2,children:[l.jsx(xp,{}),e==="img2img"&&l.jsx(RI,{}),l.jsx(vp,{})]})},Mp=()=>{const e=O(r=>r.generation.negativePrompt),t=X(),{t:n}=Y();return l.jsx(rt,{children:l.jsx(Kh,{id:"negativePrompt",name:"negativePrompt",value:e,onChange:r=>t(A1(r.target.value)),placeholder:n("parameters.negativePrompts"),_focusVisible:{borderColor:"error.600"},fontSize:"sm"})})},NI=be([e=>e.generation,Bt],(e,t)=>({prompt:e.prompt,activeTabName:t}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Tp=()=>{const e=X(),{prompt:t,activeTabName:n}=O(NI),{isReady:r}=O(c4),i=x.useRef(null),{t:s}=Y(),c=f=>{e(O1(f.target.value))};fe("alt+a",()=>{var f;(f=i.current)==null||f.focus()},[]);const u=f=>{f.key==="Enter"&&f.shiftKey===!1&&r&&(f.preventDefault(),e(af(n)))};return l.jsx(We,{children:l.jsx(rt,{isInvalid:t.length===0||Boolean(t.match(/^[\s\r\n]+$/)),children:l.jsx(Kh,{id:"prompt",name:"prompt",placeholder:s("parameters.promptPlaceholder"),value:t,onChange:c,onKeyDown:u,resize:"vertical",ref:i,minH:40})})})},FI=""+new URL("logo-13003d72.png",import.meta.url).href,p4=()=>{const e=O(t=>t.system.app_version);return l.jsxs(B,{alignItems:"center",gap:3,ps:1,children:[l.jsx(ds,{src:FI,alt:"invoke-ai-logo",w:"32px",h:"32px"}),l.jsxs(Ce,{fontSize:"xl",children:["invoke ",l.jsx("strong",{children:"ai"})]}),l.jsx(Ce,{sx:{fontWeight:300,marginTop:1},variant:"subtext",children:e})]})};const LI=be(ro,e=>{const{shouldShowParametersPanel:t,shouldHoldParametersPanelOpen:n,shouldPinParametersPanel:r,parametersPanelScrollPosition:i}=e;return{shouldShowParametersPanel:t,shouldHoldParametersPanelOpen:n,shouldPinParametersPanel:r,parametersPanelScrollPosition:i}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),_p=e=>{const t=X(),{direction:n}=Ji(),{shouldShowParametersPanel:r,shouldHoldParametersPanelOpen:i,shouldPinParametersPanel:s}=O(LI),c=x.useRef(null),u=x.useRef(null),f=x.useRef(null),{children:h}=e,{t:p}=Y();fe("o",()=>{t(Hi(!r)),s&&setTimeout(()=>t(on(!0)),400)},[r,s]),fe("esc",()=>{t(Hi(!1))},{enabled:()=>!s,preventDefault:!0},[s]),fe("shift+o",()=>{C(),t(on(!0))},[s]);const g=x.useCallback(()=>{s||(t(xC(u.current?u.current.scrollTop:0)),t(Hi(!1)),t(yC(!1)))},[t,s]),y=()=>{f.current=window.setTimeout(()=>g(),500)},S=()=>{f.current&&window.clearTimeout(f.current)},C=()=>{t(bC(!s)),t(on(!0))};return x.useEffect(()=>{function w(k){c.current&&!c.current.contains(k.target)&&g()}return document.addEventListener("mousedown",w),()=>{document.removeEventListener("mousedown",w)}},[g]),l.jsx(Uy,{nodeRef:c,in:r||i&&!s,unmountOnExit:!0,timeout:200,classNames:`${n}-parameters-panel-transition`,children:l.jsx(We,{className:`${n}-parameters-panel-transition`,tabIndex:1,ref:c,onMouseEnter:s?void 0:S,onMouseOver:s?void 0:S,sx:{borderInlineEndWidth:s?0:5,borderInlineEndStyle:"solid",bg:"base.900",borderColor:"base.700",height:R9,width:Al,maxWidth:Al,flexShrink:0,position:"relative",overflowY:"scroll",overflowX:"hidden",...p2,...!s&&{zIndex:20,position:"fixed",top:0,insetInlineStart:0,width:`calc(${Al} + 2rem)`,maxWidth:`calc(${Al} + 2rem)`,height:"100%"}},children:l.jsx(We,{sx:{margin:!s&&4},children:l.jsxs(B,{ref:u,onMouseLeave:w=>{w.target!==u.current?S():!s&&y()},sx:{display:"flex",flexDirection:"column",rowGap:2,height:"100%"},children:[l.jsx(Yt,{label:p("common.pinOptionsPanel"),children:l.jsx(We,{onClick:C,sx:{position:"absolute",cursor:"pointer",padding:2,top:4,insetInlineEnd:4,zIndex:20,...s&&{top:0,insetInlineEnd:0}},children:l.jsx(Jt,{sx:{opacity:.2},as:s?By:Hy})})}),!s&&l.jsx(We,{sx:{pt:fp,pb:2},children:l.jsx(p4,{})}),h]})})})})};function BI(){const e=X(),t=O(i=>i.generation.shouldFitToWidthHeight),n=i=>e(V1(i.target.checked)),{t:r}=Y();return l.jsx(En,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function m4(e){const{t}=Y(),{label:n=`${t("parameters.strength")}`}=e,r=O(u=>u.generation.img2imgStrength),i=X(),s=u=>i(of(u)),c=()=>{i(of(.75))};return l.jsx(ut,{label:n,step:.01,min:.01,max:1,onChange:s,value:r,isInteger:!1,withInput:!0,withSliderMarks:!0,inputWidth:22,withReset:!0,handleReset:c})}function HI(){const{t:e}=Y();return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(m4,{label:e("parameters.img2imgStrength")}),l.jsx(BI,{})]})}function WI(){const{t:e}=Y(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(Ep,{})},imageToImage:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(HI,{})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(wp,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(jp,{}),additionalHeaderComponents:l.jsx(kp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:dn.FACE_CORRECTION,content:l.jsx(tp,{}),additionalHeaderComponents:l.jsx(d4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:dn.UPSCALE,content:l.jsx(np,{}),additionalHeaderComponents:l.jsx(h4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(Sp,{}),additionalHeaderComponents:l.jsx(Cp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:dn.OTHER,content:l.jsx(wI,{})}};return l.jsxs(_p,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Tp,{}),l.jsx(Mp,{})]}),l.jsx(Ip,{}),l.jsx(Pp,{accordionInfo:t})]})}function VI(){return l.jsx(bp,{optionsPanel:l.jsx(WI,{}),children:l.jsx(bI,{})})}const UI=()=>l.jsx(We,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsx(B,{sx:{p:4,width:"100%",height:"100%"},children:l.jsx(u4,{})})}),$I=be([rp],({hiresFix:e,hiresStrength:t})=>({hiresFix:e,hiresStrength:t}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),GI=()=>{const{hiresFix:e,hiresStrength:t}=O($I),n=X(),{t:r}=Y(),i=c=>{n(Vv(c))},s=()=>{n(Vv(.75))};return l.jsx(ut,{label:r("parameters.hiresStrength"),step:.01,min:.01,max:.99,onChange:i,value:t,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s,isSliderDisabled:!e,isInputDisabled:!e,isResetDisabled:!e})},qI=()=>{const e=X(),t=O(i=>i.postprocessing.hiresFix),{t:n}=Y(),r=i=>e(W1(i.target.checked));return l.jsx(En,{label:n("parameters.hiresOptim"),fontSize:"md",isChecked:t,onChange:r})},YI=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(f4,{}),l.jsx(qI,{}),l.jsx(GI,{})]});function XI(){const{t:e}=Y(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(Ep,{})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(wp,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(jp,{}),additionalHeaderComponents:l.jsx(kp,{})},face_restore:{header:`${e("parameters.faceRestoration")}`,feature:dn.FACE_CORRECTION,content:l.jsx(tp,{}),additionalHeaderComponents:l.jsx(d4,{})},upscale:{header:`${e("parameters.upscaling")}`,feature:dn.UPSCALE,content:l.jsx(np,{}),additionalHeaderComponents:l.jsx(h4,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(Sp,{}),additionalHeaderComponents:l.jsx(Cp,{})},other:{header:`${e("parameters.otherOptions")}`,feature:dn.OTHER,content:l.jsx(YI,{})}};return l.jsxs(_p,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Tp,{}),l.jsx(Mp,{})]}),l.jsx(Ip,{}),l.jsx(Pp,{accordionInfo:t})]})}function KI(){return l.jsx(bp,{optionsPanel:l.jsx(XI,{}),children:l.jsx(UI,{})})}var Af={},QI={get exports(){return Af},set exports(e){Af=e}};/** + * @license React + * react-reconciler.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 ZI=function(t){var n={},r=x,i=Ul,s=Object.assign;function c(o){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;dA||v[E]!==b[A]){var W=` +`+v[E].replace(" at new "," at ");return o.displayName&&W.includes("")&&(W=W.replace("",o.displayName)),W}while(1<=E&&0<=A);break}}}finally{eu=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?ha(o):""}var Ub=Object.prototype.hasOwnProperty,nu=[],uo=-1;function Gr(o){return{current:o}}function bt(o){0>uo||(o.current=nu[uo],nu[uo]=null,uo--)}function gt(o,a){uo++,nu[uo]=o.current,o.current=a}var qr={},an=Gr(qr),xn=Gr(!1),Si=qr;function fo(o,a){var d=o.type.contextTypes;if(!d)return qr;var m=o.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===a)return m.__reactInternalMemoizedMaskedChildContext;var v={},b;for(b in d)v[b]=a[b];return m&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=v),v}function yn(o){return o=o.childContextTypes,o!=null}function js(){bt(xn),bt(an)}function Jp(o,a,d){if(an.current!==qr)throw Error(c(168));gt(an,a),gt(xn,d)}function em(o,a,d){var m=o.stateNode;if(a=a.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var v in m)if(!(v in a))throw Error(c(108,z(o)||"Unknown",v));return s({},d,m)}function Es(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||qr,Si=an.current,gt(an,o),gt(xn,xn.current),!0}function tm(o,a,d){var m=o.stateNode;if(!m)throw Error(c(169));d?(o=em(o,a,Si),m.__reactInternalMemoizedMergedChildContext=o,bt(xn),bt(an),gt(an,o)):bt(xn),gt(xn,d)}var Xn=Math.clz32?Math.clz32:qb,$b=Math.log,Gb=Math.LN2;function qb(o){return o>>>=0,o===0?32:31-($b(o)/Gb|0)|0}var Ps=64,Is=4194304;function pa(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function Ms(o,a){var d=o.pendingLanes;if(d===0)return 0;var m=0,v=o.suspendedLanes,b=o.pingedLanes,E=d&268435455;if(E!==0){var A=E&~v;A!==0?m=pa(A):(b&=E,b!==0&&(m=pa(b)))}else E=d&~v,E!==0?m=pa(E):b!==0&&(m=pa(b));if(m===0)return 0;if(a!==0&&a!==m&&!(a&v)&&(v=m&-m,b=a&-a,v>=b||v===16&&(b&4194240)!==0))return a;if(m&4&&(m|=d&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=m;0d;d++)a.push(o);return a}function ma(o,a,d){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-Xn(a),o[a]=d}function Kb(o,a){var d=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var m=o.eventTimes;for(o=o.expirationTimes;0>=E,v-=E,Er=1<<32-Xn(a)+v|d<ot?(Zt=$e,$e=null):Zt=$e.sibling;var at=ye(H,$e,G[ot],Se);if(at===null){$e===null&&($e=Zt);break}o&&$e&&at.alternate===null&&a(H,$e),R=b(at,R,ot),Xe===null?Oe=at:Xe.sibling=at,Xe=at,$e=Zt}if(ot===G.length)return d(H,$e),It&&wi(H,ot),Oe;if($e===null){for(;otot?(Zt=$e,$e=null):Zt=$e.sibling;var ti=ye(H,$e,at.value,Se);if(ti===null){$e===null&&($e=Zt);break}o&&$e&&ti.alternate===null&&a(H,$e),R=b(ti,R,ot),Xe===null?Oe=ti:Xe.sibling=ti,Xe=ti,$e=Zt}if(at.done)return d(H,$e),It&&wi(H,ot),Oe;if($e===null){for(;!at.done;ot++,at=G.next())at=Ue(H,at.value,Se),at!==null&&(R=b(at,R,ot),Xe===null?Oe=at:Xe.sibling=at,Xe=at);return It&&wi(H,ot),Oe}for($e=m(H,$e);!at.done;ot++,at=G.next())at=St($e,H,ot,at.value,Se),at!==null&&(o&&at.alternate!==null&&$e.delete(at.key===null?ot:at.key),R=b(at,R,ot),Xe===null?Oe=at:Xe.sibling=at,Xe=at);return o&&$e.forEach(function(zS){return a(H,zS)}),It&&wi(H,ot),Oe}function _r(H,R,G,Se){if(typeof G=="object"&&G!==null&&G.type===p&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case f:e:{for(var Oe=G.key,Xe=R;Xe!==null;){if(Xe.key===Oe){if(Oe=G.type,Oe===p){if(Xe.tag===7){d(H,Xe.sibling),R=v(Xe,G.props.children),R.return=H,H=R;break e}}else if(Xe.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===P&&bm(Oe)===Xe.type){d(H,Xe.sibling),R=v(Xe,G.props),R.ref=ga(H,Xe,G),R.return=H,H=R;break e}d(H,Xe);break}else a(H,Xe);Xe=Xe.sibling}G.type===p?(R=Ti(G.props.children,H.mode,Se,G.key),R.return=H,H=R):(Se=hl(G.type,G.key,G.props,null,H.mode,Se),Se.ref=ga(H,R,G),Se.return=H,H=Se)}return E(H);case h:e:{for(Xe=G.key;R!==null;){if(R.key===Xe)if(R.tag===4&&R.stateNode.containerInfo===G.containerInfo&&R.stateNode.implementation===G.implementation){d(H,R.sibling),R=v(R,G.children||[]),R.return=H,H=R;break e}else{d(H,R);break}else a(H,R);R=R.sibling}R=ud(G,H.mode,Se),R.return=H,H=R}return E(H);case P:return Xe=G._init,_r(H,R,Xe(G._payload),Se)}if(te(G))return ft(H,R,G,Se);if(D(G))return wn(H,R,G,Se);Hs(H,G)}return typeof G=="string"&&G!==""||typeof G=="number"?(G=""+G,R!==null&&R.tag===6?(d(H,R.sibling),R=v(R,G),R.return=H,H=R):(d(H,R),R=cd(G,H.mode,Se),R.return=H,H=R),E(H)):d(H,R)}return _r}var xo=Sm(!0),Cm=Sm(!1),xa={},Nn=Gr(xa),ya=Gr(xa),yo=Gr(xa);function lr(o){if(o===xa)throw Error(c(174));return o}function wu(o,a){gt(yo,a),gt(ya,o),gt(Nn,xa),o=U(a),bt(Nn),gt(Nn,o)}function bo(){bt(Nn),bt(ya),bt(yo)}function wm(o){var a=lr(yo.current),d=lr(Nn.current);a=K(d,o.type,a),d!==a&&(gt(ya,o),gt(Nn,a))}function ku(o){ya.current===o&&(bt(Nn),bt(ya))}var _t=Gr(0);function Ws(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Zp(d)||Zc(d)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if(a.flags&128)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var ju=[];function Eu(){for(var o=0;od?d:4,o(!0);var m=Pu.transition;Pu.transition={};try{o(!1),a()}finally{it=d,Pu.transition=m}}function Hm(){return Fn().memoizedState}function lS(o,a,d){var m=Zr(o);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Wm(o))Vm(a,d);else if(d=fm(o,a,d,m),d!==null){var v=un();Ln(d,o,m,v),Um(d,a,m)}}function cS(o,a,d){var m=Zr(o),v={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Wm(o))Vm(a,v);else{var b=o.alternate;if(o.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var E=a.lastRenderedState,A=b(E,d);if(v.hasEagerState=!0,v.eagerState=A,Kn(A,E)){var W=a.interleaved;W===null?(v.next=v,yu(a)):(v.next=W.next,W.next=v),a.interleaved=v;return}}catch{}finally{}d=fm(o,a,v,m),d!==null&&(v=un(),Ln(d,o,m,v),Um(d,a,m))}}function Wm(o){var a=o.alternate;return o===Dt||a!==null&&a===Dt}function Vm(o,a){ba=Us=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function Um(o,a,d){if(d&4194240){var m=a.lanes;m&=o.pendingLanes,d|=m,a.lanes=d,ou(o,d)}}var qs={readContext:Rn,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useInsertionEffect:sn,useLayoutEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useMutableSource:sn,useSyncExternalStore:sn,useId:sn,unstable_isNewReconciler:!1},uS={readContext:Rn,useCallback:function(o,a){return cr().memoizedState=[o,a===void 0?null:a],o},useContext:Rn,useEffect:Om,useImperativeHandle:function(o,a,d){return d=d!=null?d.concat([o]):null,$s(4194308,4,Rm.bind(null,a,o),d)},useLayoutEffect:function(o,a){return $s(4194308,4,o,a)},useInsertionEffect:function(o,a){return $s(4,2,o,a)},useMemo:function(o,a){var d=cr();return a=a===void 0?null:a,o=o(),d.memoizedState=[o,a],o},useReducer:function(o,a,d){var m=cr();return a=d!==void 0?d(a):a,m.memoizedState=m.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},m.queue=o,o=o.dispatch=lS.bind(null,Dt,o),[m.memoizedState,o]},useRef:function(o){var a=cr();return o={current:o},a.memoizedState=o},useState:_m,useDebugValue:Au,useDeferredValue:function(o){return cr().memoizedState=o},useTransition:function(){var o=_m(!1),a=o[0];return o=sS.bind(null,o[1]),cr().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,d){var m=Dt,v=cr();if(It){if(d===void 0)throw Error(c(407));d=d()}else{if(d=a(),Qt===null)throw Error(c(349));ji&30||Em(m,a,d)}v.memoizedState=d;var b={value:d,getSnapshot:a};return v.queue=b,Om(Im.bind(null,m,b,o),[o]),m.flags|=2048,wa(9,Pm.bind(null,m,b,d,a),void 0,null),d},useId:function(){var o=cr(),a=Qt.identifierPrefix;if(It){var d=Pr,m=Er;d=(m&~(1<<32-Xn(m)-1)).toString(32)+d,a=":"+a+"R"+d,d=Sa++,0td&&(a.flags|=128,m=!0,Ea(v,!1),a.lanes=4194304)}else{if(!m)if(o=Ws(b),o!==null){if(a.flags|=128,m=!0,o=o.updateQueue,o!==null&&(a.updateQueue=o,a.flags|=4),Ea(v,!0),v.tail===null&&v.tailMode==="hidden"&&!b.alternate&&!It)return ln(a),null}else 2*Xt()-v.renderingStartTime>td&&d!==1073741824&&(a.flags|=128,m=!0,Ea(v,!1),a.lanes=4194304);v.isBackwards?(b.sibling=a.child,a.child=b):(o=v.last,o!==null?o.sibling=b:a.child=b,v.last=b)}return v.tail!==null?(a=v.tail,v.rendering=a,v.tail=a.sibling,v.renderingStartTime=Xt(),a.sibling=null,o=_t.current,gt(_t,m?o&1|2:o&1),a):(ln(a),null);case 22:case 23:return ad(),d=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==d&&(a.flags|=8192),d&&a.mode&1?_n&1073741824&&(ln(a),ve&&a.subtreeFlags&6&&(a.flags|=8192)):ln(a),null;case 24:return null;case 25:return null}throw Error(c(156,a.tag))}function xS(o,a){switch(du(a),a.tag){case 1:return yn(a.type)&&js(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return bo(),bt(xn),bt(an),Eu(),o=a.flags,o&65536&&!(o&128)?(a.flags=o&-65537|128,a):null;case 5:return ku(a),null;case 13:if(bt(_t),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(c(340));mo()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return bt(_t),null;case 4:return bo(),null;case 10:return gu(a.type._context),null;case 22:case 23:return ad(),null;case 24:return null;default:return null}}var Zs=!1,cn=!1,yS=typeof WeakSet=="function"?WeakSet:Set,we=null;function Co(o,a){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){Mt(o,a,m)}else d.current=null}function Vu(o,a,d){try{d()}catch(m){Mt(o,a,m)}}var cv=!1;function bS(o,a){for(ne(o.containerInfo),we=a;we!==null;)if(o=we,a=o.child,(o.subtreeFlags&1028)!==0&&a!==null)a.return=o,we=a;else for(;we!==null;){o=we;try{var d=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var m=d.memoizedProps,v=d.memoizedState,b=o.stateNode,E=b.getSnapshotBeforeUpdate(o.elementType===o.type?m:Zn(o.type,m),v);b.__reactInternalSnapshotBeforeUpdate=E}break;case 3:ve&&bi(o.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(A){Mt(o,o.return,A)}if(a=o.sibling,a!==null){a.return=o.return,we=a;break}we=o.return}return d=cv,cv=!1,d}function Pa(o,a,d){var m=a.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&o)===o){var b=v.destroy;v.destroy=void 0,b!==void 0&&Vu(a,d,b)}v=v.next}while(v!==m)}}function Js(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&o)===o){var m=d.create;d.destroy=m()}d=d.next}while(d!==a)}}function Uu(o){var a=o.ref;if(a!==null){var d=o.stateNode;switch(o.tag){case 5:o=ie(d);break;default:o=d}typeof a=="function"?a(o):a.current=o}}function uv(o){var a=o.alternate;a!==null&&(o.alternate=null,uv(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&Ve(a)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function dv(o){return o.tag===5||o.tag===3||o.tag===4}function fv(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||dv(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function $u(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?hn(d,o,a):He(d,o);else if(m!==4&&(o=o.child,o!==null))for($u(o,a,d),o=o.sibling;o!==null;)$u(o,a,d),o=o.sibling}function Gu(o,a,d){var m=o.tag;if(m===5||m===6)o=o.stateNode,a?De(d,o,a):J(d,o);else if(m!==4&&(o=o.child,o!==null))for(Gu(o,a,d),o=o.sibling;o!==null;)Gu(o,a,d),o=o.sibling}var tn=null,Jn=!1;function dr(o,a,d){for(d=d.child;d!==null;)qu(o,a,d),d=d.sibling}function qu(o,a,d){if(or&&typeof or.onCommitFiberUnmount=="function")try{or.onCommitFiberUnmount(Ts,d)}catch{}switch(d.tag){case 5:cn||Co(d,a);case 6:if(ve){var m=tn,v=Jn;tn=null,dr(o,a,d),tn=m,Jn=v,tn!==null&&(Jn?pn(tn,d.stateNode):$t(tn,d.stateNode))}else dr(o,a,d);break;case 18:ve&&tn!==null&&(Jn?Bb(tn,d.stateNode):Lb(tn,d.stateNode));break;case 4:ve?(m=tn,v=Jn,tn=d.stateNode.containerInfo,Jn=!0,dr(o,a,d),tn=m,Jn=v):(_e&&(m=d.stateNode.containerInfo,v=Yp(m),Qc(m,v)),dr(o,a,d));break;case 0:case 11:case 14:case 15:if(!cn&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var b=v,E=b.destroy;b=b.tag,E!==void 0&&(b&2||b&4)&&Vu(d,a,E),v=v.next}while(v!==m)}dr(o,a,d);break;case 1:if(!cn&&(Co(d,a),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(A){Mt(d,a,A)}dr(o,a,d);break;case 21:dr(o,a,d);break;case 22:d.mode&1?(cn=(m=cn)||d.memoizedState!==null,dr(o,a,d),cn=m):dr(o,a,d);break;default:dr(o,a,d)}}function hv(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new yS),a.forEach(function(m){var v=MS.bind(null,o,m);d.has(m)||(d.add(m),m.then(v,v))})}}function er(o,a){var d=a.deletions;if(d!==null)for(var m=0;m";case tl:return":has("+(Ku(o)||"")+")";case nl:return'[role="'+o.value+'"]';case il:return'"'+o.value+'"';case rl:return'[data-testname="'+o.value+'"]';default:throw Error(c(365))}}function yv(o,a){var d=[];o=[o,0];for(var m=0;mv&&(v=E),m&=~b}if(m=v,m=Xt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*CS(m/1960))-m,10o?16:o,Qr===null)var m=!1;else{if(o=Qr,Qr=null,cl=0,Ke&6)throw Error(c(331));var v=Ke;for(Ke|=4,we=o.current;we!==null;){var b=we,E=b.child;if(we.flags&16){var A=b.deletions;if(A!==null){for(var W=0;WXt()-ed?Pi(o,0):Ju|=d),Cn(o,a)}function Iv(o,a){a===0&&(o.mode&1?(a=Is,Is<<=1,!(Is&130023424)&&(Is=4194304)):a=1);var d=un();o=sr(o,a),o!==null&&(ma(o,a,d),Cn(o,d))}function IS(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),Iv(o,d)}function MS(o,a){var d=0;switch(o.tag){case 13:var m=o.stateNode,v=o.memoizedState;v!==null&&(d=v.retryLane);break;case 19:m=o.stateNode;break;default:throw Error(c(314))}m!==null&&m.delete(a),Iv(o,d)}var Mv;Mv=function(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps||xn.current)bn=!0;else{if(!(o.lanes&d)&&!(a.flags&128))return bn=!1,vS(o,a,d);bn=!!(o.flags&131072)}else bn=!1,It&&a.flags&1048576&&am(a,Os,a.index);switch(a.lanes=0,a.tag){case 2:var m=a.type;Xs(o,a),o=a.pendingProps;var v=fo(a,an.current);go(a,d),v=Mu(null,a,m,o,v,d);var b=Tu();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,yn(m)?(b=!0,Es(a)):b=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,bu(a),v.updater=Bs,a.stateNode=v,v._reactInternals=a,Cu(a,m,o,d),a=Fu(null,a,m,!0,b,d)):(a.tag=0,It&&b&&uu(a),mn(null,a,v,d),a=a.child),a;case 16:m=a.elementType;e:{switch(Xs(o,a),o=a.pendingProps,v=m._init,m=v(m._payload),a.type=m,v=a.tag=_S(m),o=Zn(m,o),v){case 0:a=Nu(null,a,m,o,d);break e;case 1:a=tv(null,a,m,o,d);break e;case 11:a=Km(null,a,m,o,d);break e;case 14:a=Qm(null,a,m,Zn(m.type,o),d);break e}throw Error(c(306,m,""))}return a;case 0:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Nu(o,a,m,v,d);case 1:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),tv(o,a,m,v,d);case 3:e:{if(nv(a),o===null)throw Error(c(387));m=a.pendingProps,b=a.memoizedState,v=b.element,hm(o,a),Ls(a,m,null,d);var E=a.memoizedState;if(m=E.element,qe&&b.isDehydrated)if(b={element:m,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){v=So(Error(c(423)),a),a=rv(o,a,m,d,v);break e}else if(m!==v){v=So(Error(c(424)),a),a=rv(o,a,m,d,v);break e}else for(qe&&(zn=_b(a.stateNode.containerInfo),Tn=a,It=!0,Qn=null,va=!1),d=Cm(a,null,m,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(mo(),m===v){a=Mr(o,a,d);break e}mn(o,a,m,d)}a=a.child}return a;case 5:return wm(a),o===null&&hu(a),m=a.type,v=a.pendingProps,b=o!==null?o.memoizedProps:null,E=v.children,ae(m,v)?E=null:b!==null&&ae(m,b)&&(a.flags|=32),ev(o,a),mn(o,a,E,d),a.child;case 6:return o===null&&hu(a),null;case 13:return iv(o,a,d);case 4:return wu(a,a.stateNode.containerInfo),m=a.pendingProps,o===null?a.child=xo(a,null,m,d):mn(o,a,m,d),a.child;case 11:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Km(o,a,m,v,d);case 7:return mn(o,a,a.pendingProps,d),a.child;case 8:return mn(o,a,a.pendingProps.children,d),a.child;case 12:return mn(o,a,a.pendingProps.children,d),a.child;case 10:e:{if(m=a.type._context,v=a.pendingProps,b=a.memoizedProps,E=v.value,dm(a,m,E),b!==null)if(Kn(b.value,E)){if(b.children===v.children&&!xn.current){a=Mr(o,a,d);break e}}else for(b=a.child,b!==null&&(b.return=a);b!==null;){var A=b.dependencies;if(A!==null){E=b.child;for(var W=A.firstContext;W!==null;){if(W.context===m){if(b.tag===1){W=Ir(-1,d&-d),W.tag=2;var se=b.updateQueue;if(se!==null){se=se.shared;var Pe=se.pending;Pe===null?W.next=W:(W.next=Pe.next,Pe.next=W),se.pending=W}}b.lanes|=d,W=b.alternate,W!==null&&(W.lanes|=d),xu(b.return,d,a),A.lanes|=d;break}W=W.next}}else if(b.tag===10)E=b.type===a.type?null:b.child;else if(b.tag===18){if(E=b.return,E===null)throw Error(c(341));E.lanes|=d,A=E.alternate,A!==null&&(A.lanes|=d),xu(E,d,a),E=b.sibling}else E=b.child;if(E!==null)E.return=b;else for(E=b;E!==null;){if(E===a){E=null;break}if(b=E.sibling,b!==null){b.return=E.return,E=b;break}E=E.return}b=E}mn(o,a,v.children,d),a=a.child}return a;case 9:return v=a.type,m=a.pendingProps.children,go(a,d),v=Rn(v),m=m(v),a.flags|=1,mn(o,a,m,d),a.child;case 14:return m=a.type,v=Zn(m,a.pendingProps),v=Zn(m.type,v),Qm(o,a,m,v,d);case 15:return Zm(o,a,a.type,a.pendingProps,d);case 17:return m=a.type,v=a.pendingProps,v=a.elementType===m?v:Zn(m,v),Xs(o,a),a.tag=1,yn(m)?(o=!0,Es(a)):o=!1,go(a,d),xm(a,m,v),Cu(a,m,v,d),Fu(null,a,m,!0,o,d);case 19:return av(o,a,d);case 22:return Jm(o,a,d)}throw Error(c(156,a.tag))};function Tv(o,a){return au(o,a)}function TS(o,a,d,m){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bn(o,a,d,m){return new TS(o,a,d,m)}function ld(o){return o=o.prototype,!(!o||!o.isReactComponent)}function _S(o){if(typeof o=="function")return ld(o)?1:0;if(o!=null){if(o=o.$$typeof,o===w)return 11;if(o===M)return 14}return 2}function ei(o,a){var d=o.alternate;return d===null?(d=Bn(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function hl(o,a,d,m,v,b){var E=2;if(m=o,typeof o=="function")ld(o)&&(E=1);else if(typeof o=="string")E=5;else e:switch(o){case p:return Ti(d.children,v,b,a);case g:E=8,v|=8;break;case y:return o=Bn(12,d,a,v|2),o.elementType=y,o.lanes=b,o;case k:return o=Bn(13,d,a,v),o.elementType=k,o.lanes=b,o;case j:return o=Bn(19,d,a,v),o.elementType=j,o.lanes=b,o;case I:return pl(d,v,b,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case S:E=10;break e;case C:E=9;break e;case w:E=11;break e;case M:E=14;break e;case P:E=16,m=null;break e}throw Error(c(130,o==null?o:typeof o,""))}return a=Bn(E,d,a,v),a.elementType=o,a.type=m,a.lanes=b,a}function Ti(o,a,d,m){return o=Bn(7,o,m,a),o.lanes=d,o}function pl(o,a,d,m){return o=Bn(22,o,m,a),o.elementType=I,o.lanes=d,o.stateNode={isHidden:!1},o}function cd(o,a,d){return o=Bn(6,o,null,a),o.lanes=d,o}function ud(o,a,d){return a=Bn(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function DS(o,a,d,m,v){this.tag=a,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ge,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=iu(0),this.expirationTimes=iu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=iu(0),this.identifierPrefix=m,this.onRecoverableError=v,qe&&(this.mutableSourceEagerHydrationData=null)}function _v(o,a,d,m,v,b,E,A,W){return o=new DS(o,a,d,A,W),a===1?(a=1,b===!0&&(a|=8)):a=0,b=Bn(3,null,null,a),o.current=b,b.stateNode=o,b.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},bu(b),o}function Dv(o){if(!o)return qr;o=o._reactInternals;e:{if(V(o)!==o||o.tag!==1)throw Error(c(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(yn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(c(171))}if(o.tag===1){var d=o.type;if(yn(d))return em(o,d,a)}return a}function Ov(o){var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(c(188)):(o=Object.keys(o).join(","),Error(c(268,o)));return o=Q(a),o===null?null:o.stateNode}function Av(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d=se&&b>=Ue&&v<=Pe&&E<=ye){o.splice(a,1);break}else if(m!==se||d.width!==W.width||yeE){if(!(b!==Ue||d.height!==W.height||Pev)){se>m&&(W.width+=se-m,W.x=m),Peb&&(W.height+=Ue-b,W.y=b),yed&&(d=E)),E ")+` + +No matching component was found for: + `)+o.join(" > ")}return null},n.getPublicRootInstance=function(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return ie(o.child.stateNode);default:return o.child.stateNode}},n.injectIntoDevTools=function(o){if(o={bundleType:o.bundleType,version:o.version,rendererPackageName:o.rendererPackageName,rendererConfig:o.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:u.ReactCurrentDispatcher,findHostInstanceByFiber:OS,findFiberByHostInstance:o.findFiberByHostInstance||AS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")o=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)o=!0;else{try{Ts=a.inject(o),or=a}catch{}o=!!a.checkDCE}}return o},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(o,a,d,m){if(!N)throw Error(c(363));o=Qu(o,a);var v=Ze(o,d,m).disconnect;return{disconnect:function(){v()}}},n.registerMutableSourceForHydration=function(o,a){var d=a._getVersion;d=d(a._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[a,d]:o.mutableSourceEagerHydrationData.push(a,d)},n.runWithPriority=function(o,a){var d=it;try{return it=o,a()}finally{it=d}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(o,a,d,m){var v=a.current,b=un(),E=Zr(v);return d=Dv(d),a.context===null?a.context=d:a.pendingContext=d,a=Ir(b,E),a.payload={element:o},m=m===void 0?null:m,m!==null&&(a.callback=m),o=Xr(v,a,E),o!==null&&(Ln(o,v,E,b),Fs(o,v,E)),E},n};(function(e){e.exports=ZI})(QI);const JI=SC(Af);var fc={},eM={get exports(){return fc},set exports(e){fc=e}},oo={};/** + * @license React + * react-reconciler-constants.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. + */oo.ConcurrentRoot=1;oo.ContinuousEventPriority=4;oo.DefaultEventPriority=16;oo.DiscreteEventPriority=1;oo.IdleEventPriority=536870912;oo.LegacyRoot=0;(function(e){e.exports=oo})(eM);const w0={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let k0=!1,j0=!1;const Dp=".react-konva-event",tM=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. +Position of a node will be changed during drag&drop, so you should update state of the react app as well. +Consider to add onDragMove or onDragEnd events. +For more info see: https://github.com/konvajs/react-konva/issues/256 +`,nM=`ReactKonva: You are using "zIndex" attribute for a Konva node. +react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. +For more info see: https://github.com/konvajs/react-konva/issues/194 +`,rM={};function Hc(e,t,n=rM){if(!k0&&"zIndex"in t&&(console.warn(nM),k0=!0),!j0&&t.draggable){var r=t.x!==void 0||t.y!==void 0,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(tM),j0=!0)}for(var s in n)if(!w0[s]){var c=s.slice(0,2)==="on",u=n[s]!==t[s];if(c&&u){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),e.off(f,n[s])}var h=!t.hasOwnProperty(s);h&&e.setAttr(s,void 0)}var p=t._useStrictMode,g={},y=!1;const S={};for(var s in t)if(!w0[s]){var c=s.slice(0,2)==="on",C=n[s]!==t[s];if(c&&C){var f=s.substr(2).toLowerCase();f.substr(0,7)==="content"&&(f="content"+f.substr(7,1).toUpperCase()+f.substr(8)),t[s]&&(S[f]=t[s])}!c&&(t[s]!==n[s]||p&&t[s]!==e.getAttr(s))&&(y=!0,g[s]=t[s])}y&&(e.setAttrs(g),gi(e));for(var f in S)e.on(f+Dp,S[f])}function gi(e){if(!CC.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const v4={},iM={};qa.Node.prototype._applyProps=Hc;function oM(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),gi(e)}function aM(e,t,n){let r=qa[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=qa.Group);const i={},s={};for(var c in t){var u=c.slice(0,2)==="on";u?s[c]=t[c]:i[c]=t[c]}const f=new r(i);return Hc(f,s),f}function sM(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function lM(e,t,n){return!1}function cM(e){return e}function uM(){return null}function dM(){return null}function fM(e,t,n,r){return iM}function hM(){}function pM(e){}function mM(e,t){return!1}function vM(){return v4}function gM(){return v4}const xM=setTimeout,yM=clearTimeout,bM=-1;function SM(e,t){return!1}const CM=!1,wM=!0,kM=!0;function jM(e,t){t.parent===e?t.moveToTop():e.add(t),gi(e)}function EM(e,t){t.parent===e?t.moveToTop():e.add(t),gi(e)}function g4(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),gi(e)}function PM(e,t,n){g4(e,t,n)}function IM(e,t){t.destroy(),t.off(Dp),gi(e)}function MM(e,t){t.destroy(),t.off(Dp),gi(e)}function TM(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function _M(e,t,n){}function DM(e,t,n,r,i){Hc(e,i,r)}function OM(e){e.hide(),gi(e)}function AM(e){}function zM(e,t){(t.visible==null||t.visible)&&e.show()}function RM(e,t){}function NM(e){}function FM(){}const LM=()=>fc.DefaultEventPriority,BM=Object.freeze(Object.defineProperty({__proto__:null,appendChild:jM,appendChildToContainer:EM,appendInitialChild:oM,cancelTimeout:yM,clearContainer:NM,commitMount:_M,commitTextUpdate:TM,commitUpdate:DM,createInstance:aM,createTextInstance:sM,detachDeletedInstance:FM,finalizeInitialChildren:lM,getChildHostContext:gM,getCurrentEventPriority:LM,getPublicInstance:cM,getRootHostContext:vM,hideInstance:OM,hideTextInstance:AM,idlePriority:Ul.unstable_IdlePriority,insertBefore:g4,insertInContainerBefore:PM,isPrimaryRenderer:CM,noTimeout:bM,now:Ul.unstable_now,prepareForCommit:uM,preparePortalMount:dM,prepareUpdate:fM,removeChild:IM,removeChildFromContainer:MM,resetAfterCommit:hM,resetTextContent:pM,run:Ul.unstable_runWithPriority,scheduleTimeout:xM,shouldDeprioritizeSubtree:mM,shouldSetTextContent:SM,supportsMutation:kM,unhideInstance:zM,unhideTextInstance:RM,warnsIfNotActing:wM},Symbol.toStringTag,{value:"Module"}));var HM=Object.defineProperty,WM=Object.defineProperties,VM=Object.getOwnPropertyDescriptors,E0=Object.getOwnPropertySymbols,UM=Object.prototype.hasOwnProperty,$M=Object.prototype.propertyIsEnumerable,P0=(e,t,n)=>t in e?HM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I0=(e,t)=>{for(var n in t||(t={}))UM.call(t,n)&&P0(e,n,t[n]);if(E0)for(var n of E0(t))$M.call(t,n)&&P0(e,n,t[n]);return e},GM=(e,t)=>WM(e,VM(t));function x4(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const i=x4(r,t,n);if(i)return i;r=t?null:r.sibling}}function y4(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const Op=y4(x.createContext(null));class b4 extends x.Component{render(){return x.createElement(Op.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:qM,ReactCurrentDispatcher:YM}=x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function XM(){const e=x.useContext(Op);if(!e)throw new Error("its-fine: useFiber must be called within a !");const t=x.useId();return x.useMemo(()=>{var r;return(r=qM.current)!=null?r:x4(e,!1,i=>{let s=i.memoizedState;for(;s;){if(s.memoizedState===t)return!0;s=s.next}})},[e,t])}function KM(){var e,t;const n=XM(),[r]=x.useState(()=>new Map);r.clear();let i=n;for(;i;){const s=(e=i.type)==null?void 0:e._context;s&&s!==Op&&!r.has(s)&&r.set(s,(t=YM.current)==null?void 0:t.readContext(y4(s))),i=i.return}return x.useMemo(()=>Array.from(r.keys()).reduce((s,c)=>u=>x.createElement(s,null,x.createElement(c.Provider,GM(I0({},u),{value:r.get(c)}))),s=>x.createElement(b4,I0({},s))),[r])}function QM(e){const t=ke.useRef();return ke.useLayoutEffect(()=>{t.current=e}),t.current}const ZM=e=>{const t=ke.useRef(),n=ke.useRef(),r=ke.useRef(),i=QM(e),s=KM(),c=u=>{const{forwardedRef:f}=e;f&&(typeof f=="function"?f(u):f.current=u)};return ke.useLayoutEffect(()=>(n.current=new qa.Stage({width:e.width,height:e.height,container:t.current}),c(n.current),r.current=Ba.createContainer(n.current,fc.LegacyRoot,!1,null),Ba.updateContainer(ke.createElement(s,{},e.children),r.current),()=>{qa.isBrowser&&(c(null),Ba.updateContainer(null,r.current,null),n.current.destroy())}),[]),ke.useLayoutEffect(()=>{c(n.current),Hc(n.current,e,i),Ba.updateContainer(ke.createElement(s,{},e.children),r.current,null)}),ke.createElement("div",{ref:t,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},za="Layer",Br="Group",Hr="Rect",_i="Circle",hc="Line",S4="Image",JM="Transformer",Ba=JI(BM);Ba.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:ke.version,rendererPackageName:"react-konva"});const eT=ke.forwardRef((e,t)=>ke.createElement(b4,{},ke.createElement(ZM,{...e,forwardedRef:t}))),tT=be([tt,zt],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),nT=()=>{const e=X(),{tool:t,isStaging:n,isMovingBoundingBox:r}=O(tT);return{handleDragStart:x.useCallback(()=>{(t==="move"||n)&&!r&&e(Jl(!0))},[e,r,n,t]),handleDragMove:x.useCallback(i=>{if(!((t==="move"||n)&&!r))return;const s={x:i.target.x(),y:i.target.y()};e(Y1(s))},[e,r,n,t]),handleDragEnd:x.useCallback(()=>{(t==="move"||n)&&!r&&e(Jl(!1))},[e,r,n,t])}},rT=be([tt,Bt,zt],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:i,shouldShowBoundingBox:s,tool:c,isMaskEnabled:u,shouldSnapToGrid:f}=e;return{activeTabName:t,isCursorOnCanvas:Boolean(r),shouldLockBoundingBox:i,shouldShowBoundingBox:s,tool:c,isStaging:n,isMaskEnabled:u,shouldSnapToGrid:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),iT=()=>{const e=X(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:i,isMaskEnabled:s,shouldSnapToGrid:c}=O(rT),u=x.useRef(null),f=X1(),h=()=>e(Zf());fe(["shift+c"],()=>{h()},{enabled:()=>!i,preventDefault:!0},[]);const p=()=>e(ss(!s));fe(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[s]),fe(["n"],()=>{e(ec(!c))},{enabled:!0,preventDefault:!0},[c]),fe("esc",()=>{e(wC())},{enabled:()=>!0,preventDefault:!0}),fe("shift+h",()=>{e(kC(!n))},{enabled:()=>!i,preventDefault:!0},[t,n]),fe(["space"],g=>{g.repeat||(f==null||f.container().focus(),r!=="move"&&(u.current=r,e(xr("move"))),r==="move"&&u.current&&u.current!=="move"&&(e(xr(u.current)),u.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,u])},Ap=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},C4=()=>{const e=X(),t=Sr(),n=X1();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const i=jC.pixelRatio,[s,c,u,f]=t.getContext().getImageData(r.x*i,r.y*i,1,1).data;e(EC({r:s,g:c,b:u,a:f}))},commitColorUnderCursor:()=>{e(PC())}}},oT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),aT=e=>{const t=X(),{tool:n,isStaging:r}=O(oT),{commitColorUnderCursor:i}=C4();return x.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Jl(!0));return}if(n==="colorPicker"){i();return}const c=Ap(e.current);c&&(s.evt.preventDefault(),t(K1(!0)),t(IC([c.x,c.y])))},[e,n,r,t,i])},sT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r,isDrawing:i}=t;return{tool:r,isDrawing:i,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),lT=(e,t,n)=>{const r=X(),{isDrawing:i,tool:s,isStaging:c}=O(sT),{updateColorUnderCursor:u}=C4();return x.useCallback(()=>{if(!e.current)return;const f=Ap(e.current);if(f){if(r(MC(f)),n.current=f,s==="colorPicker"){u();return}!i||s==="move"||c||(t.current=!0,r(Q1([f.x,f.y])))}},[t,r,i,c,n,e,s,u])},cT=()=>{const e=X();return x.useCallback(()=>{e(TC())},[e])},uT=be([Bt,tt,zt],(e,t,n)=>{const{tool:r,isDrawing:i}=t;return{tool:r,isDrawing:i,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),dT=(e,t)=>{const n=X(),{tool:r,isDrawing:i,isStaging:s}=O(uT);return x.useCallback(()=>{if(r==="move"||s){n(Jl(!1));return}if(!t.current&&i&&e.current){const c=Ap(e.current);if(!c)return;n(Q1([c.x,c.y]))}else t.current=!1;n(K1(!1))},[t,n,i,s,e,r])},fT=be([tt],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),hT=e=>{const t=X(),{isMoveStageKeyHeld:n,stageScale:r}=O(fT);return x.useCallback(i=>{if(!e.current||n)return;i.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const c={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let u=i.evt.deltaY;i.evt.ctrlKey&&(u=-u);const f=ee.clamp(r*_C**u,DC,OC),h={x:s.x-c.x*f,y:s.y-c.y*f};t(AC(f)),t(Y1(h))},[e,n,r,t])},pT=be(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:i,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:c,stageDimensions:r,stageScale:i}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),mT=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:i,stageScale:s}=O(pT);return l.jsxs(Br,{children:[l.jsx(Hr,{offsetX:r.x/s,offsetY:r.y/s,height:i.height/s,width:i.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),l.jsx(Hr,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},vT=be([tt],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),gT={dark:"rgba(255, 255, 255, 0.2)",green:"rgba(255, 255, 255, 0.2)",light:"rgba(0, 0, 0, 0.2)",ocean:"rgba(136, 148, 184, 0.2)"},xT=()=>{const e=O(u=>u.ui.currentTheme),{stageScale:t,stageCoordinates:n,stageDimensions:r}=O(vT),[i,s]=x.useState([]),c=x.useCallback(u=>u/t,[t]);return x.useLayoutEffect(()=>{const u=gT[e],{width:f,height:h}=r,{x:p,y:g}=n,y={x1:0,y1:0,x2:f,y2:h,offset:{x:c(p),y:c(g)}},S={x:Math.ceil(c(p)/64)*64,y:Math.ceil(c(g)/64)*64},C={x1:-S.x,y1:-S.y,x2:c(f)-S.x+64,y2:c(h)-S.y+64},k={x1:Math.min(y.x1,C.x1),y1:Math.min(y.y1,C.y1),x2:Math.max(y.x2,C.x2),y2:Math.max(y.y2,C.y2)},j=k.x2-k.x1,M=k.y2-k.y1,P=Math.round(j/64)+1,I=Math.round(M/64)+1,T=ee.range(0,P).map(_=>l.jsx(hc,{x:k.x1+_*64,y:k.y1,points:[0,0,0,M],stroke:u,strokeWidth:1},`x_${_}`)),D=ee.range(0,I).map(_=>l.jsx(hc,{x:k.x1,y:k.y1+_*64,points:[0,0,j,0],stroke:u,strokeWidth:1},`y_${_}`));s(T.concat(D))},[t,n,r,e,c]),l.jsx(Br,{children:i})},yT=be([e=>e.gallery],e=>e.intermediateImage?e.intermediateImage:null,{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),bT=e=>{const{...t}=e,n=O(yT),[r,i]=x.useState(null);if(x.useEffect(()=>{if(!n)return;const h=new Image;h.onload=()=>{i(h)},h.src=n.url},[n]),!(n!=null&&n.boundingBox))return null;const{boundingBox:{x:s,y:c,width:u,height:f}}=n;return r?l.jsx(S4,{x:s,y:c,width:u,height:f,image:r,listening:!1,...t}):null},qi=e=>{const{r:t,g:n,b:r,a:i}=e;return`rgba(${t}, ${n}, ${r}, ${i})`},ST=be(tt,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:i}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:i,maskColorString:qi(t)}}),M0=e=>`data:image/svg+xml;utf8, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`.replaceAll("black",e),CT=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:i,stageScale:s}=O(ST),[c,u]=x.useState(null),[f,h]=x.useState(0),p=x.useRef(null),g=x.useCallback(()=>{h(f+1),setTimeout(g,500)},[f]);return x.useEffect(()=>{if(c)return;const y=new Image;y.onload=()=>{u(y)},y.src=M0(n)},[c,n]),x.useEffect(()=>{c&&(c.src=M0(n))},[c,n]),x.useEffect(()=>{const y=setInterval(()=>h(S=>(S+1)%5),50);return()=>clearInterval(y)},[]),!c||!ee.isNumber(r.x)||!ee.isNumber(r.y)||!ee.isNumber(s)||!ee.isNumber(i.width)||!ee.isNumber(i.height)?null:l.jsx(Hr,{ref:p,offsetX:r.x/s,offsetY:r.y/s,height:i.height/s,width:i.width/s,fillPatternImage:c,fillPatternOffsetY:ee.isNumber(f)?f:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},wT=be([tt],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),kT=e=>{const{...t}=e,{objects:n}=O(wT);return l.jsx(Br,{listening:!1,...t,children:n.filter(zC).map((r,i)=>l.jsx(hc,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},i))})};var Di=x,jT=function(t,n,r){const i=Di.useRef("loading"),s=Di.useRef(),[c,u]=Di.useState(0),f=Di.useRef(),h=Di.useRef(),p=Di.useRef();return(f.current!==t||h.current!==n||p.current!==r)&&(i.current="loading",s.current=void 0,f.current=t,h.current=n,p.current=r),Di.useLayoutEffect(function(){if(!t)return;var g=document.createElement("img");function y(){i.current="loaded",s.current=g,u(Math.random())}function S(){i.current="failed",s.current=void 0,u(Math.random())}return g.addEventListener("load",y),g.addEventListener("error",S),n&&(g.crossOrigin=n),r&&(g.referrerpolicy=r),g.src=t,function(){g.removeEventListener("load",y),g.removeEventListener("error",S)}},[t,n,r]),[s.current,i.current]};const w4=e=>{const{url:t,x:n,y:r}=e,[i]=jT(t);return l.jsx(S4,{x:n,y:r,image:i,listening:!1})},ET=be([tt],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),PT=()=>{const{objects:e}=O(ET);return e?l.jsx(Br,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(T1(t))return l.jsx(w4,{x:t.x,y:t.y,url:t.image.url},n);if(RC(t)){const r=l.jsx(hc,{points:t.points,stroke:t.color?qi(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?l.jsx(Br,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(NC(t))return l.jsx(Hr,{x:t.x,y:t.y,width:t.width,height:t.height,fill:qi(t.color)},n);if(FC(t))return l.jsx(Hr,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},IT=be([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingImage:r,shouldShowStagingOutline:i,boundingBoxCoordinates:{x:s,y:c},boundingBoxDimensions:{width:u,height:f}}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:r,shouldShowStagingOutline:i,x:s,y:c,width:u,height:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),MT=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:i,x:s,y:c,width:u,height:f}=O(IT);return l.jsxs(Br,{...t,children:[r&&n&&l.jsx(w4,{url:n.image.url,x:s,y:c}),i&&l.jsxs(Br,{children:[l.jsx(Hr,{x:s,y:c,width:u,height:f,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),l.jsx(Hr,{x:s,y:c,width:u,height:f,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},TT=be([tt],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:i}=e;return{currentStagingAreaImage:t.length>0?t[n]:void 0,isOnFirstImage:n===0,isOnLastImage:n===t.length-1,shouldShowStagingImage:i,shouldShowStagingOutline:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),_T=()=>{const e=X(),{isOnFirstImage:t,isOnLastImage:n,currentStagingAreaImage:r,shouldShowStagingImage:i}=O(TT),{t:s}=Y(),c=x.useCallback(()=>{e(Uv(!0))},[e]),u=x.useCallback(()=>{e(Uv(!1))},[e]);fe(["left"],()=>{f()},{enabled:()=>!0,preventDefault:!0}),fe(["right"],()=>{h()},{enabled:()=>!0,preventDefault:!0}),fe(["enter"],()=>{p()},{enabled:()=>!0,preventDefault:!0});const f=()=>e(LC()),h=()=>e(BC()),p=()=>e(HC());return r?l.jsx(B,{pos:"absolute",bottom:4,w:"100%",align:"center",justify:"center",filter:"drop-shadow(0 0.5rem 1rem rgba(0,0,0))",onMouseOver:c,onMouseOut:u,children:l.jsxs(en,{isAttached:!0,children:[l.jsx(ue,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:l.jsx(M8,{}),onClick:f,colorScheme:"accent",isDisabled:t}),l.jsx(ue,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:l.jsx(T8,{}),onClick:h,colorScheme:"accent",isDisabled:n}),l.jsx(ue,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:l.jsx(zc,{}),onClick:p,colorScheme:"accent"}),l.jsx(ue,{tooltip:s("unifiedCanvas.showHide"),"aria-label":s("unifiedCanvas.showHide"),"data-alert":!i,icon:i?l.jsx(N8,{}):l.jsx(R8,{}),onClick:()=>e(WC(!i)),colorScheme:"accent"}),l.jsx(ue,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),icon:l.jsx(op,{}),onClick:()=>e(VC(r.image.url)),colorScheme:"accent"}),l.jsx(ue,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),onClick:()=>e(UC()),colorScheme:"error",fontSize:20})]})}):null},Ho=e=>Math.round(e*100)/100,DT=be([tt],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Ho(n)}, ${Ho(r)})`}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function OT(){const{cursorCoordinatesString:e}=O(DT),{t}=Y();return l.jsx(We,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const zf="var(--invokeai-colors-warning-500)",AT=be([tt],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:i},boundingBoxDimensions:{width:s,height:c},scaledBoundingBoxDimensions:{width:u,height:f},boundingBoxCoordinates:{x:h,y:p},stageScale:g,shouldShowCanvasDebugInfo:y,layer:S,boundingBoxScaleMethod:C,shouldPreserveMaskedArea:w}=e;let k="inherit";return(C==="none"&&(s<512||c<512)||C==="manual"&&u*f<512*512)&&(k=zf),{activeLayerColor:S==="mask"?zf:"inherit",activeLayerString:S.charAt(0).toUpperCase()+S.slice(1),boundingBoxColor:k,boundingBoxCoordinatesString:`(${Ho(h)}, ${Ho(p)})`,boundingBoxDimensionsString:`${s}×${c}`,scaledBoundingBoxDimensionsString:`${u}×${f}`,canvasCoordinatesString:`${Ho(r)}×${Ho(i)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(g*100),shouldShowCanvasDebugInfo:y,shouldShowBoundingBox:C!=="auto",shouldShowScaledBoundingBox:C!=="none",shouldPreserveMaskedArea:w}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),zT=()=>{const{activeLayerColor:e,activeLayerString:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:i,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:c,canvasCoordinatesString:u,canvasDimensionsString:f,canvasScaleString:h,shouldShowCanvasDebugInfo:p,shouldShowBoundingBox:g,shouldPreserveMaskedArea:y}=O(AT),{t:S}=Y();return l.jsxs(B,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"blackAlpha.500"},children:[l.jsx(We,{style:{color:e},children:`${S("unifiedCanvas.activeLayer")}: ${t}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasScale")}: ${h}%`}),y&&l.jsx(We,{style:{color:zf},children:"Preserve Masked Area: On"}),g&&l.jsx(We,{style:{color:n},children:`${S("unifiedCanvas.boundingBox")}: ${i}`}),c&&l.jsx(We,{style:{color:n},children:`${S("unifiedCanvas.scaledBoundingBox")}: ${s}`}),p&&l.jsxs(l.Fragment,{children:[l.jsx(We,{children:`${S("unifiedCanvas.boundingBoxPosition")}: ${r}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasDimensions")}: ${f}`}),l.jsx(We,{children:`${S("unifiedCanvas.canvasPosition")}: ${u}`}),l.jsx(OT,{})]})]})},RT=be(tt,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageScale:r,isDrawing:i,isTransformingBoundingBox:s,isMovingBoundingBox:c,tool:u,shouldSnapToGrid:f}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,isDrawing:i,isMovingBoundingBox:c,isTransformingBoundingBox:s,stageScale:r,shouldSnapToGrid:f,tool:u,hitStrokeWidth:20/r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),NT=e=>{const{...t}=e,n=X(),{boundingBoxCoordinates:r,boundingBoxDimensions:i,isDrawing:s,isMovingBoundingBox:c,isTransformingBoundingBox:u,stageScale:f,shouldSnapToGrid:h,tool:p,hitStrokeWidth:g}=O(RT),y=x.useRef(null),S=x.useRef(null),[C,w]=x.useState(!1);x.useEffect(()=>{var Q;!y.current||!S.current||(y.current.nodes([S.current]),(Q=y.current.getLayer())==null||Q.batchDraw())},[]);const k=64*f,j=x.useCallback(Q=>{if(!h){n(fd({x:Math.floor(Q.target.x()),y:Math.floor(Q.target.y())}));return}const $=Q.target.x(),Z=Q.target.y(),te=$v($,64),ie=$v(Z,64);Q.target.x(te),Q.target.y(ie),n(fd({x:te,y:ie}))},[n,h]),M=x.useCallback(()=>{if(!S.current)return;const Q=S.current,$=Q.scaleX(),Z=Q.scaleY(),te=Math.round(Q.width()*$),ie=Math.round(Q.height()*Z),U=Math.round(Q.x()),K=Math.round(Q.y());n(Na({width:te,height:ie})),n(fd({x:h?xl(U,64):U,y:h?xl(K,64):K})),Q.scaleX(1),Q.scaleY(1)},[n,h]),P=x.useCallback((Q,$,Z)=>{const te=Q.x%k,ie=Q.y%k;return{x:xl($.x,k)+te,y:xl($.y,k)+ie}},[k]),I=()=>{n(hd(!0))},T=()=>{n(hd(!1)),n(pd(!1)),n(yl(!1)),w(!1)},D=()=>{n(pd(!0))},_=()=>{n(hd(!1)),n(pd(!1)),n(yl(!1)),w(!1)},z=()=>{w(!0)},V=()=>{!u&&!c&&w(!1)},F=()=>{n(yl(!0))},L=()=>{n(yl(!1))};return l.jsxs(Br,{...t,children:[l.jsx(Hr,{height:i.height,width:i.width,x:r.x,y:r.y,onMouseEnter:F,onMouseOver:F,onMouseLeave:L,onMouseOut:L}),l.jsx(Hr,{draggable:!0,fillEnabled:!1,height:i.height,hitStrokeWidth:g,listening:!s&&p==="move",onDragStart:D,onDragEnd:_,onDragMove:j,onMouseDown:D,onMouseOut:V,onMouseOver:z,onMouseEnter:z,onMouseUp:_,onTransform:M,onTransformEnd:T,ref:S,stroke:C?"rgba(255,255,255,0.7)":"white",strokeWidth:(C?8:1)/f,width:i.width,x:r.x,y:r.y}),l.jsx(JM,{anchorCornerRadius:3,anchorDragBoundFunc:P,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:p==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&p==="move",onDragStart:D,onDragEnd:_,onMouseDown:I,onMouseUp:T,onTransformEnd:T,ref:y,rotateEnabled:!1})]})},FT=be(tt,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:i,brushColor:s,tool:c,layer:u,shouldShowBrush:f,isMovingBoundingBox:h,isTransformingBoundingBox:p,stageScale:g,stageDimensions:y,boundingBoxCoordinates:S,boundingBoxDimensions:C,shouldRestrictStrokesToBox:w}=e,k=w?{clipX:S.x,clipY:S.y,clipWidth:C.width,clipHeight:C.height}:{};return{cursorPosition:t,brushX:t?t.x:y.width/2,brushY:t?t.y:y.height/2,radius:n/2,colorPickerOuterRadius:Gv/g,colorPickerInnerRadius:(Gv-sf+1)/g,maskColorString:qi({...i,a:.5}),brushColorString:qi(s),colorPickerColorString:qi(r),tool:c,layer:u,shouldShowBrush:f,shouldDrawBrushPreview:!(h||p||!t)&&f,strokeWidth:1.5/g,dotRadius:1.5/g,clip:k}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),LT=e=>{const{...t}=e,{brushX:n,brushY:r,radius:i,maskColorString:s,tool:c,layer:u,shouldDrawBrushPreview:f,dotRadius:h,strokeWidth:p,brushColorString:g,colorPickerColorString:y,colorPickerInnerRadius:S,colorPickerOuterRadius:C,clip:w}=O(FT);return f?l.jsxs(Br,{listening:!1,...w,...t,children:[c==="colorPicker"?l.jsxs(l.Fragment,{children:[l.jsx(_i,{x:n,y:r,radius:C,stroke:g,strokeWidth:sf,strokeScaleEnabled:!1}),l.jsx(_i,{x:n,y:r,radius:S,stroke:y,strokeWidth:sf,strokeScaleEnabled:!1})]}):l.jsxs(l.Fragment,{children:[l.jsx(_i,{x:n,y:r,radius:i,fill:u==="mask"?s:g,globalCompositeOperation:c==="eraser"?"destination-out":"source-out"}),l.jsx(_i,{x:n,y:r,radius:i,stroke:"rgba(255,255,255,0.4)",strokeWidth:p*2,strokeEnabled:!0,listening:!1}),l.jsx(_i,{x:n,y:r,radius:i,stroke:"rgba(0,0,0,1)",strokeWidth:p,strokeEnabled:!0,listening:!1})]}),l.jsx(_i,{x:n,y:r,radius:h*2,fill:"rgba(255,255,255,0.4)",listening:!1}),l.jsx(_i,{x:n,y:r,radius:h,fill:"rgba(0,0,0,1)",listening:!1})]}):null},BT=be([tt,zt],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:i,isTransformingBoundingBox:s,isMouseOverBoundingBox:c,isMovingBoundingBox:u,stageDimensions:f,stageCoordinates:h,tool:p,isMovingStage:g,shouldShowIntermediates:y,shouldShowGrid:S,shouldRestrictStrokesToBox:C}=e;let w="none";return p==="move"||t?g?w="grabbing":w="grab":s?w=void 0:C&&!c&&(w="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||u,shouldShowBoundingBox:i,shouldShowGrid:S,stageCoordinates:h,stageCursor:w,stageDimensions:f,stageScale:r,tool:p,isStaging:t,shouldShowIntermediates:y}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),HT=re(eT,{shouldForwardProp:e=>!["sx"].includes(e)}),k4=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:i,stageCursor:s,stageDimensions:c,stageScale:u,tool:f,isStaging:h,shouldShowIntermediates:p}=O(BT);iT();const g=x.useRef(null),y=x.useRef(null),S=x.useCallback(V=>{GC(V),g.current=V},[]),C=x.useCallback(V=>{$C(V),y.current=V},[]),w=x.useRef({x:0,y:0}),k=x.useRef(!1),j=hT(g),M=aT(g),P=dT(g,k),I=lT(g,k,w),T=cT(),{handleDragStart:D,handleDragMove:_,handleDragEnd:z}=nT();return l.jsx(B,{sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:l.jsxs(We,{sx:{position:"relative"},children:[l.jsxs(HT,{tabIndex:-1,ref:S,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:i.x,y:i.y,width:c.width,height:c.height,scale:{x:u,y:u},onTouchStart:M,onTouchMove:I,onTouchEnd:P,onMouseDown:M,onMouseLeave:T,onMouseMove:I,onMouseUp:P,onDragStart:D,onDragMove:_,onDragEnd:z,onContextMenu:V=>V.evt.preventDefault(),onWheel:j,draggable:(f==="move"||h)&&!t,children:[l.jsx(za,{id:"grid",visible:r,children:l.jsx(xT,{})}),l.jsx(za,{id:"base",ref:C,listening:!1,imageSmoothingEnabled:!1,children:l.jsx(PT,{})}),l.jsxs(za,{id:"mask",visible:e,listening:!1,children:[l.jsx(kT,{visible:!0,listening:!1}),l.jsx(CT,{listening:!1})]}),l.jsx(za,{children:l.jsx(mT,{})}),l.jsxs(za,{id:"preview",imageSmoothingEnabled:!1,children:[!h&&l.jsx(LT,{visible:f!=="move",listening:!1}),l.jsx(MT,{visible:h}),p&&l.jsx(bT,{}),l.jsx(NT,{visible:n&&!h})]})]}),l.jsx(zT,{}),l.jsx(_T,{})]})})},WT=be(tt,Ny,Bt,(e,t,n)=>{const{doesCanvasNeedScaling:r,isCanvasInitialized:i}=e;return{doesCanvasNeedScaling:r,activeTabName:n,initialCanvasImage:t,isCanvasInitialized:i}}),j4=()=>{const e=X(),{doesCanvasNeedScaling:t,activeTabName:n,initialCanvasImage:r,isCanvasInitialized:i}=O(WT),s=x.useRef(null);return x.useLayoutEffect(()=>{window.setTimeout(()=>{if(!s.current)return;const{clientWidth:c,clientHeight:u}=s.current;e(qC({width:c,height:u})),e(i?YC():Sc()),e(on(!1))},0)},[e,r,t,n,i]),l.jsx(B,{ref:s,sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:l.jsx(Qf,{thickness:"2px",speed:"1s",size:"xl"})})},VT=be([tt,Bt,Pt],(e,t,n)=>{const{futureLayerStates:r}=e;return{canRedo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function E4(){const e=X(),{canRedo:t,activeTabName:n}=O(VT),{t:r}=Y(),i=()=>{e(XC())};return fe(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{i()},{enabled:()=>t,preventDefault:!0},[n,t]),l.jsx(ue,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:l.jsx(Y8,{}),onClick:i,isDisabled:!t})}const UT=be([tt,Bt,Pt],(e,t,n)=>{const{pastLayerStates:r}=e;return{canUndo:r.length>0&&!n.isProcessing,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function P4(){const e=X(),{t}=Y(),{canUndo:n,activeTabName:r}=O(UT),i=()=>{e(KC())};return fe(["meta+z","ctrl+z"],()=>{i()},{enabled:()=>n,preventDefault:!0},[r,n]),l.jsx(ue,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:l.jsx(J8,{}),onClick:i,isDisabled:!n})}const $T=(e,t,n)=>{const r=document.createElement("img");r.addEventListener("load",()=>{const i=document.createElement("canvas");i.width=t,i.height=n;const s=i.getContext("2d");s&&(s.drawImage(r,0,0),i.toBlob(c=>{c&&navigator.clipboard.write([new ClipboardItem({[c.type]:c})])}),i.remove(),r.remove())}),r.src=e},GT=e=>{const t=document.createElement("a");t.href=e,t.download="",document.body.appendChild(t),t.click(),document.body.removeChild(t),t.remove()},qT=(e,t,n,r)=>{const i=e.scale(),s=e.getClientRect({relativeTo:e.getParent()});e.scale({x:1/t,y:1/t});const{x:c,y:u,width:f,height:h}=e.getClientRect(),p=r?{x:r.x+n.x,y:r.y+n.y,width:r.width,height:r.height}:{x:c,y:u,width:f,height:h},g=e.toDataURL(p);return e.scale(i),{dataURL:g,boundingBox:{x:s.x,y:s.y,width:f,height:h}}},YT={cropVisible:!1,cropToBoundingBox:!1,shouldSaveToGallery:!1,shouldDownload:!1,shouldCopy:!1,shouldSetAsInitialImage:!0},ai=(e=YT)=>async(t,n)=>{const{cropVisible:r,cropToBoundingBox:i,shouldSaveToGallery:s,shouldDownload:c,shouldCopy:u,shouldSetAsInitialImage:f}=e;t(QC("Exporting Image")),t(bl(!1));const h=n(),{stageScale:p,boundingBoxCoordinates:g,boundingBoxDimensions:y,stageCoordinates:S}=h.canvas,C=Sr();if(!C){t(md(!1)),t(bl(!0));return}const{dataURL:w,boundingBox:k}=qT(C,p,S,i?{...g,...y}:void 0);if(!w){t(md(!1)),t(bl(!0));return}const j=new FormData;j.append("data",JSON.stringify({dataURL:w,filename:"merged_canvas.png",kind:s?"result":"temp",cropVisible:r}));const P=await(await fetch(`${window.location.origin}/upload`,{method:"POST",body:j})).json(),{url:I,width:T,height:D}=P,_={uuid:P1(),category:s?"result":"user",...P};c&&(GT(I),t(Sl({title:nr.t("toast.downloadImageStarted"),status:"success",duration:2500,isClosable:!0}))),u&&($T(I,T,D),t(Sl({title:nr.t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0}))),s&&(t(I1({image:_,category:"result"})),t(Sl({title:nr.t("toast.imageSavedToGallery"),status:"success",duration:2500,isClosable:!0}))),f&&(t(ZC({kind:"image",layer:"base",...k,image:_})),t(Sl({title:nr.t("toast.canvasMerged"),status:"success",duration:2500,isClosable:!0}))),t(md(!1)),t(JC(nr.t("common.statusConnected"))),t(bl(!0))};function XT(){const e=O(zt),t=Sr(),n=O(u=>u.system.isProcessing),r=O(u=>u.canvas.shouldCropToBoundingBoxOnSave),i=X(),{t:s}=Y();fe(["meta+c","ctrl+c"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{i(ai({cropVisible:!r,cropToBoundingBox:r,shouldCopy:!0}))};return l.jsx(ue,{"aria-label":`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${s("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Jo,{}),onClick:c,isDisabled:e})}function KT(){const e=X(),{t}=Y(),n=Sr(),r=O(zt),i=O(u=>u.system.isProcessing),s=O(u=>u.canvas.shouldCropToBoundingBoxOnSave);fe(["shift+d"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n,i]);const c=()=>{e(ai({cropVisible:!s,cropToBoundingBox:s,shouldDownload:!0}))};return l.jsx(ue,{"aria-label":`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${t("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(ip,{}),onClick:c,isDisabled:r})}function QT(){const e=O(zt),{openUploader:t}=Zh(),{t:n}=Y();return l.jsx(ue,{"aria-label":n("common.upload"),tooltip:n("common.upload"),icon:l.jsx(Rc,{}),onClick:t,isDisabled:e})}const ZT=be([tt,zt],(e,t)=>{const{layer:n,isMaskEnabled:r}=e;return{layer:n,isMaskEnabled:r,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function JT(){const e=X(),{t}=Y(),{layer:n,isMaskEnabled:r,isStaging:i}=O(ZT),s=()=>{e(tc(n==="mask"?"base":"mask"))};fe(["q"],()=>{s()},{enabled:()=>!i,preventDefault:!0},[n]);const c=u=>{const f=u.target.value;e(tc(f)),f==="mask"&&!r&&e(ss(!0))};return l.jsx(Mn,{tooltip:`${t("unifiedCanvas.layer")} (Q)`,"aria-label":`${t("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:n,validValues:Z1,onChange:c,isDisabled:i})}function e_(){const e=X(),{t}=Y(),n=Sr(),r=O(zt),i=O(c=>c.system.isProcessing);fe(["shift+m"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n,i]);const s=()=>{e(ai({cropVisible:!1,shouldSetAsInitialImage:!0}))};return l.jsx(ue,{"aria-label":`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${t("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(zy,{}),onClick:s,isDisabled:r})}function t_(){const e=O(s=>s.canvas.tool),t=O(zt),n=X(),{t:r}=Y();fe(["v"],()=>{i()},{enabled:()=>!t,preventDefault:!0},[]);const i=()=>n(xr("move"));return l.jsx(ue,{"aria-label":`${r("unifiedCanvas.move")} (V)`,tooltip:`${r("unifiedCanvas.move")} (V)`,icon:l.jsx(My,{}),isChecked:e==="move"||t,onClick:i})}function n_(){const e=O(i=>i.ui.shouldPinParametersPanel),t=X(),{t:n}=Y(),r=()=>{t(Hi(!0)),e&&setTimeout(()=>t(on(!0)),400)};return l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsx(ue,{tooltip:`${n("parameters.showOptionsPanel")} (O)`,tooltipProps:{placement:"top"},"aria-label":n("parameters.showOptionsPanel"),onClick:r,children:l.jsx(ap,{})}),l.jsx(B,{children:l.jsx(xp,{iconButton:!0})}),l.jsx(B,{children:l.jsx(vp,{width:"100%",height:"40px",btnGroupWidth:"100%"})})]})}function r_(){const e=X(),{t}=Y(),n=O(zt),r=()=>{e(Jf()),e(Sc())};return l.jsx(ue,{"aria-label":t("unifiedCanvas.clearCanvas"),tooltip:t("unifiedCanvas.clearCanvas"),icon:l.jsx(io,{}),onClick:r,isDisabled:n,colorScheme:"error"})}function I4(e,t,n=250){const[r,i]=x.useState(0);return x.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),i(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>i(s=>s+1)}function i_(){const e=Sr(),t=X(),{t:n}=Y();fe(["r"],()=>{i()},{enabled:()=>!0,preventDefault:!0},[e]);const r=I4(()=>i(!1),()=>i(!0)),i=(s=!1)=>{const c=Sr();if(!c)return;const u=c.getClientRect({skipTransform:!0});t(J1({contentRect:u,shouldScaleTo1:s}))};return l.jsx(ue,{"aria-label":`${n("unifiedCanvas.resetView")} (R)`,tooltip:`${n("unifiedCanvas.resetView")} (R)`,icon:l.jsx(_y,{}),onClick:r})}function o_(){const e=O(zt),t=Sr(),n=O(u=>u.system.isProcessing),r=O(u=>u.canvas.shouldCropToBoundingBoxOnSave),i=X(),{t:s}=Y();fe(["shift+s"],()=>{c()},{enabled:()=>!e,preventDefault:!0},[t,n]);const c=()=>{i(ai({cropVisible:!r,cropToBoundingBox:r,shouldSaveToGallery:!0}))};return l.jsx(ue,{"aria-label":`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${s("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(op,{}),onClick:c,isDisabled:e})}const a_=be([tt,zt,Pt],(e,t,n)=>{const{isProcessing:r}=n,{tool:i}=e;return{tool:i,isStaging:t,isProcessing:r}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),s_=()=>{const e=X(),{t}=Y(),{tool:n,isStaging:r}=O(a_);fe(["b"],()=>{i()},{enabled:()=>!r,preventDefault:!0},[]),fe(["e"],()=>{s()},{enabled:()=>!r,preventDefault:!0},[n]),fe(["c"],()=>{c()},{enabled:()=>!r,preventDefault:!0},[n]),fe(["shift+f"],()=>{u()},{enabled:()=>!r,preventDefault:!0}),fe(["delete","backspace"],()=>{f()},{enabled:()=>!r,preventDefault:!0});const i=()=>e(xr("brush")),s=()=>e(xr("eraser")),c=()=>e(xr("colorPicker")),u=()=>e(e2()),f=()=>e(t2());return l.jsxs(B,{flexDirection:"column",gap:2,children:[l.jsxs(en,{children:[l.jsx(ue,{"aria-label":`${t("unifiedCanvas.brush")} (B)`,tooltip:`${t("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ry,{}),isChecked:n==="brush"&&!r,onClick:i,isDisabled:r}),l.jsx(ue,{"aria-label":`${t("unifiedCanvas.eraser")} (E)`,tooltip:`${t("unifiedCanvas.eraser")} (B)`,icon:l.jsx(Dy,{}),isChecked:n==="eraser"&&!r,isDisabled:r,onClick:s})]}),l.jsxs(en,{children:[l.jsx(ue,{"aria-label":`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${t("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Ay,{}),isDisabled:r,onClick:u}),l.jsx(ue,{"aria-label":`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${t("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),isDisabled:r,onClick:f})]}),l.jsx(ue,{"aria-label":`${t("unifiedCanvas.colorPicker")} (C)`,tooltip:`${t("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Oy,{}),isChecked:n==="colorPicker"&&!r,isDisabled:r,onClick:c,width:"max-content"})]})},Wc=he((e,t)=>{const{acceptButtonText:n="Accept",acceptCallback:r,cancelButtonText:i="Cancel",cancelCallback:s,children:c,title:u,triggerComponent:f}=e,{isOpen:h,onOpen:p,onClose:g}=ui(),y=x.useRef(null),S=()=>{r(),g()},C=()=>{s&&s(),g()};return l.jsxs(l.Fragment,{children:[x.cloneElement(f,{onClick:p,ref:t}),l.jsx(Xx,{isOpen:h,leastDestructiveRef:y,onClose:g,children:l.jsx(Nr,{children:l.jsxs(Kx,{children:[l.jsx(Rr,{fontSize:"lg",fontWeight:"bold",children:u}),l.jsx(Fr,{children:c}),l.jsxs(zr,{children:[l.jsx(Je,{ref:y,onClick:C,children:i}),l.jsx(Je,{colorScheme:"error",onClick:S,ml:3,children:n})]})]})})})]})}),M4=()=>{const e=O(zt),t=X(),{t:n}=Y(),r=()=>{t(e3()),t(Jf()),t(n2())};return l.jsxs(Wc,{title:n("unifiedCanvas.emptyTempImageFolder"),acceptCallback:r,acceptButtonText:n("unifiedCanvas.emptyFolder"),triggerComponent:l.jsx(Je,{leftIcon:l.jsx(io,{}),size:"sm",isDisabled:e,children:n("unifiedCanvas.emptyTempImageFolder")}),children:[l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.emptyTempImagesFolderConfirm")})]})},T4=()=>{const e=O(zt),t=X(),{t:n}=Y();return l.jsxs(Wc,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(n2()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:l.jsx(Je,{size:"sm",leftIcon:l.jsx(io,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),l.jsx("br",{}),l.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},l_=be([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:i}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldShowCanvasDebugInfo:r,shouldShowIntermediates:i}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),c_=()=>{const e=X(),{t}=Y(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldShowCanvasDebugInfo:i,shouldShowIntermediates:s}=O(l_);return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(ue,{tooltip:t("unifiedCanvas.canvasSettings"),tooltipProps:{placement:"bottom"},"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(sp,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:s,onChange:c=>e(r2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:c=>e(i2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:c=>e(o2(c.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:i,onChange:c=>e(a2(c.target.checked))}),l.jsx(T4,{}),l.jsx(M4,{})]})})},u_=()=>{const e=O(t=>t.ui.shouldShowParametersPanel);return l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(JT,{}),l.jsx(s_,{}),l.jsxs(B,{gap:2,children:[l.jsx(t_,{}),l.jsx(i_,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(e_,{}),l.jsx(o_,{})]}),l.jsxs(B,{columnGap:2,children:[l.jsx(XT,{}),l.jsx(KT,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(P4,{}),l.jsx(E4,{})]}),l.jsxs(B,{gap:2,children:[l.jsx(QT,{}),l.jsx(r_,{})]}),l.jsx(c_,{}),!e&&l.jsx(n_,{})]})};function d_(){const e=X(),t=O(i=>i.canvas.brushSize),{t:n}=Y(),r=O(zt);return fe(["BracketLeft"],()=>{e(Wo(Math.max(t-5,5)))},{enabled:()=>!r,preventDefault:!0},[t]),fe(["BracketRight"],()=>{e(Wo(Math.min(t+5,500)))},{enabled:()=>!r,preventDefault:!0},[t]),l.jsx(ut,{label:n("unifiedCanvas.brushSize"),value:t,withInput:!0,onChange:i=>e(Wo(i)),sliderNumberInputProps:{max:500},inputReadOnly:!1,isCompact:!0})}function Vc(){return(Vc=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}function Rf(e){var t=x.useRef(e),n=x.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var ta=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:k.buttons>0)&&i.current?s(T0(i.current,k,u.current)):w(!1)},C=function(){return w(!1)};function w(k){var j=f.current,M=Nf(i.current),P=k?M.addEventListener:M.removeEventListener;P(j?"touchmove":"mousemove",S),P(j?"touchend":"mouseup",C)}return[function(k){var j=k.nativeEvent,M=i.current;if(M&&(_0(j),!function(I,T){return T&&!Ua(I)}(j,f.current)&&M)){if(Ua(j)){f.current=!0;var P=j.changedTouches||[];P.length&&(u.current=P[0].identifier)}M.focus(),s(T0(M,j,u.current)),w(!0)}},function(k){var j=k.which||k.keyCode;j<37||j>40||(k.preventDefault(),c({left:j===39?.05:j===37?-.05:0,top:j===40?.05:j===38?-.05:0}))},w]},[c,s]),p=h[0],g=h[1],y=h[2];return x.useEffect(function(){return y},[y]),ke.createElement("div",Vc({},r,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:g,tabIndex:0,role:"slider"}))}),Uc=function(e){return e.filter(Boolean).join(" ")},Rp=function(e){var t=e.color,n=e.left,r=e.top,i=r===void 0?.5:r,s=Uc(["react-colorful__pointer",e.className]);return ke.createElement("div",{className:s,style:{top:100*i+"%",left:100*n+"%"}},ke.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},gn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},D4=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:gn(e.h),s:gn(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:gn(i/2),a:gn(r,2)}},Ff=function(e){var t=D4(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Bd=function(e){var t=D4(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},f_=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),c=r*(1-n),u=r*(1-(t-s)*n),f=r*(1-(1-t+s)*n),h=s%6;return{r:gn(255*[r,u,c,c,f,r][h]),g:gn(255*[f,r,r,u,c,c][h]),b:gn(255*[c,c,f,r,r,u][h]),a:gn(i,2)}},h_=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,s=Math.max(t,n,r),c=s-Math.min(t,n,r),u=c?s===t?(n-r)/c:s===n?2+(r-t)/c:4+(t-n)/c:0;return{h:gn(60*(u<0?u+6:u)),s:gn(s?c/s*100:0),v:gn(s/255*100),a:i}},p_=ke.memo(function(e){var t=e.hue,n=e.onChange,r=Uc(["react-colorful__hue",e.className]);return ke.createElement("div",{className:r},ke.createElement(zp,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:ta(t+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":gn(t),"aria-valuemax":"360","aria-valuemin":"0"},ke.createElement(Rp,{className:"react-colorful__hue-pointer",left:t/360,color:Ff({h:t,s:100,v:100,a:1})})))}),m_=ke.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Ff({h:t.h,s:100,v:100,a:1})};return ke.createElement("div",{className:"react-colorful__saturation",style:r},ke.createElement(zp,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:ta(t.s+100*i.left,0,100),v:ta(t.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+gn(t.s)+"%, Brightness "+gn(t.v)+"%"},ke.createElement(Rp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Ff(t)})))}),O4=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function v_(e,t,n){var r=Rf(n),i=x.useState(function(){return e.toHsva(t)}),s=i[0],c=i[1],u=x.useRef({color:t,hsva:s});x.useEffect(function(){if(!e.equal(t,u.current.color)){var h=e.toHsva(t);u.current={hsva:h,color:t},c(h)}},[t,e]),x.useEffect(function(){var h;O4(s,u.current.hsva)||e.equal(h=e.fromHsva(s),u.current.color)||(u.current={hsva:s,color:h},r(h))},[s,e,r]);var f=x.useCallback(function(h){c(function(p){return Object.assign({},p,h)})},[]);return[s,f]}var g_=typeof window<"u"?x.useLayoutEffect:x.useEffect,x_=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},D0=new Map,y_=function(e){g_(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!D0.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,D0.set(t,n);var r=x_();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},b_=function(e){var t=e.className,n=e.hsva,r=e.onChange,i={backgroundImage:"linear-gradient(90deg, "+Bd(Object.assign({},n,{a:0}))+", "+Bd(Object.assign({},n,{a:1}))+")"},s=Uc(["react-colorful__alpha",t]),c=gn(100*n.a);return ke.createElement("div",{className:s},ke.createElement("div",{className:"react-colorful__alpha-gradient",style:i}),ke.createElement(zp,{onMove:function(u){r({a:u.left})},onKey:function(u){r({a:ta(n.a+u.left)})},"aria-label":"Alpha","aria-valuetext":c+"%","aria-valuenow":c,"aria-valuemin":"0","aria-valuemax":"100"},ke.createElement(Rp,{className:"react-colorful__alpha-pointer",left:n.a,color:Bd(n)})))},S_=function(e){var t=e.className,n=e.colorModel,r=e.color,i=r===void 0?n.defaultColor:r,s=e.onChange,c=_4(e,["className","colorModel","color","onChange"]),u=x.useRef(null);y_(u);var f=v_(n,i,s),h=f[0],p=f[1],g=Uc(["react-colorful",t]);return ke.createElement("div",Vc({},c,{ref:u,className:g}),ke.createElement(m_,{hsva:h,onChange:p}),ke.createElement(p_,{hue:h.h,onChange:p}),ke.createElement(b_,{hsva:h,onChange:p,className:"react-colorful__last-control"}))},C_={defaultColor:{r:0,g:0,b:0,a:1},toHsva:h_,fromHsva:f_,equal:O4},w_=function(e){return ke.createElement(S_,Vc({},e,{colorModel:C_}))};const k_=re(w_,{baseStyle:{paddingInline:4},shouldForwardProp:e=>!["pickerColor"].includes(e)}),Hd={width:6,height:6,borderColor:"base.100"},pc=e=>{const{styleClass:t="",...n}=e;return l.jsx(k_,{sx:{".react-colorful__hue-pointer":Hd,".react-colorful__saturation-pointer":Hd,".react-colorful__alpha-pointer":Hd},className:t,...n})},j_=be([tt,zt],(e,t)=>{const{brushColor:n,maskColor:r,layer:i}=e;return{brushColor:n,maskColor:r,layer:i,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function E_(){const e=X(),{brushColor:t,maskColor:n,layer:r,isStaging:i}=O(j_),s=()=>{if(r==="base")return`rgba(${t.r},${t.g},${t.b},${t.a})`;if(r==="mask")return`rgba(${n.r},${n.g},${n.b},${n.a})`};return fe(["shift+BracketLeft"],()=>{e(Vo({...t,a:ee.clamp(t.a-.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[t]),fe(["shift+BracketRight"],()=>{e(Vo({...t,a:ee.clamp(t.a+.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[t]),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(We,{sx:{width:7,height:7,minWidth:7,minHeight:7,borderRadius:"full",bg:s(),cursor:"pointer"}}),children:l.jsxs(B,{minWidth:60,direction:"column",gap:4,width:"100%",children:[r==="base"&&l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:t,onChange:c=>e(Vo(c))}),r==="mask"&&l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:c=>e(s2(c))})]})})}function A4(){return l.jsxs(B,{columnGap:4,alignItems:"center",children:[l.jsx(d_,{}),l.jsx(E_,{})]})}function P_(){const e=X(),t=O(r=>r.canvas.shouldRestrictStrokesToBox),{t:n}=Y();return l.jsx(pt,{label:n("unifiedCanvas.betaLimitToBox"),isChecked:t,onChange:r=>e(l2(r.target.checked))})}function I_(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(A4,{}),l.jsx(P_,{})]})}function M_(){const e=X(),{t}=Y(),n=()=>e(Zf());return l.jsx(Je,{size:"sm",leftIcon:l.jsx(io,{}),onClick:n,tooltip:`${t("unifiedCanvas.clearMask")} (Shift+C)`,children:t("unifiedCanvas.betaClear")})}function T_(){const e=O(i=>i.canvas.isMaskEnabled),t=X(),{t:n}=Y(),r=()=>t(ss(!e));return l.jsx(pt,{label:`${n("unifiedCanvas.enableMask")} (H)`,isChecked:e,onChange:r})}function __(){const e=X(),{t}=Y(),n=O(r=>r.canvas.shouldPreserveMaskedArea);return l.jsx(pt,{label:t("unifiedCanvas.betaPreserveMasked"),isChecked:n,onChange:r=>e(c2(r.target.checked))})}function D_(){return l.jsxs(B,{gap:4,alignItems:"center",children:[l.jsx(A4,{}),l.jsx(T_,{}),l.jsx(__,{}),l.jsx(M_,{})]})}function O_(){const e=O(r=>r.canvas.shouldDarkenOutsideBoundingBox),t=X(),{t:n}=Y();return l.jsx(pt,{label:n("unifiedCanvas.betaDarkenOutside"),isChecked:e,onChange:r=>t(u2(r.target.checked))})}function A_(){const e=O(r=>r.canvas.shouldShowGrid),t=X(),{t:n}=Y();return l.jsx(pt,{label:n("unifiedCanvas.showGrid"),isChecked:e,onChange:r=>t(d2(r.target.checked))})}function z_(){const e=O(i=>i.canvas.shouldSnapToGrid),t=X(),{t:n}=Y(),r=i=>t(ec(i.target.checked));return l.jsx(pt,{label:`${n("unifiedCanvas.snapToGrid")} (N)`,isChecked:e,onChange:r})}function R_(){return l.jsxs(B,{alignItems:"center",gap:4,children:[l.jsx(A_,{}),l.jsx(z_,{}),l.jsx(O_,{})]})}const N_=be([tt],e=>{const{tool:t,layer:n}=e;return{tool:t,layer:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function F_(){const{tool:e,layer:t}=O(N_);return l.jsxs(B,{height:8,minHeight:8,maxHeight:8,alignItems:"center",children:[t=="base"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(I_,{}),t=="mask"&&["brush","eraser","colorPicker"].includes(e)&&l.jsx(D_,{}),e=="move"&&l.jsx(R_,{})]})}const L_=be([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),B_=()=>{const e=X(),{doesCanvasNeedScaling:t}=O(L_);return x.useLayoutEffect(()=>{e(on(!0));const n=ee.debounce(()=>{e(on(!0))},250);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(We,{sx:{width:"100%",height:"100%",borderRadius:"base",bg:"base.850"},children:l.jsxs(B,{flexDirection:"row",width:"100%",height:"100%",columnGap:4,padding:4,children:[l.jsx(u_,{}),l.jsxs(B,{width:"100%",height:"100%",flexDirection:"column",rowGap:4,children:[l.jsx(F_,{}),t?l.jsx(j4,{}):l.jsx(k4,{})]})]})})},H_=be([tt,zt],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:i,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:qi(n),isMaskEnabled:i,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),W_=()=>{const e=X(),{t}=Y(),{layer:n,maskColor:r,isMaskEnabled:i,shouldPreserveMaskedArea:s,isStaging:c}=O(H_);fe(["q"],()=>{u()},{enabled:()=>!c,preventDefault:!0},[n]),fe(["shift+c"],()=>{f()},{enabled:()=>!c,preventDefault:!0},[]),fe(["h"],()=>{h()},{enabled:()=>!c,preventDefault:!0},[i]);const u=()=>{e(tc(n==="mask"?"base":"mask"))},f=()=>e(Zf()),h=()=>e(ss(!i));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(en,{children:l.jsx(ue,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:l.jsx(W8,{}),isChecked:n==="mask",isDisabled:c})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:i,onChange:h}),l.jsx(pt,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:p=>e(c2(p.target.checked))}),l.jsx(pc,{sx:{paddingTop:2,paddingBottom:2},pickerColor:r,onChange:p=>e(s2(p))}),l.jsxs(Je,{size:"sm",leftIcon:l.jsx(io,{}),onClick:f,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},V_=be([tt],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:i,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:i,shouldShowGrid:s,shouldShowIntermediates:c,shouldSnapToGrid:u,shouldRestrictStrokesToBox:f}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),U_=()=>{const e=X(),{t}=Y(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:i,shouldShowCanvasDebugInfo:s,shouldShowGrid:c,shouldShowIntermediates:u,shouldSnapToGrid:f,shouldRestrictStrokesToBox:h}=O(V_);fe(["n"],()=>{e(ec(!f))},{enabled:!0,preventDefault:!0},[f]);const p=g=>e(ec(g.target.checked));return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(ue,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:l.jsx(sp,{})}),children:l.jsxs(B,{direction:"column",gap:2,children:[l.jsx(pt,{label:t("unifiedCanvas.showIntermediates"),isChecked:u,onChange:g=>e(r2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showGrid"),isChecked:c,onChange:g=>e(d2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.snapToGrid"),isChecked:f,onChange:p}),l.jsx(pt,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:i,onChange:g=>e(u2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(i2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(o2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:h,onChange:g=>e(l2(g.target.checked))}),l.jsx(pt,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(a2(g.target.checked))}),l.jsx(T4,{}),l.jsx(M4,{})]})})},$_=be([tt,zt,Pt],(e,t,n)=>{const{isProcessing:r}=n,{tool:i,brushColor:s,brushSize:c}=e;return{tool:i,isStaging:t,isProcessing:r,brushColor:s,brushSize:c}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),G_=()=>{const e=X(),{tool:t,brushColor:n,brushSize:r,isStaging:i}=O($_),{t:s}=Y();fe(["b"],()=>{c()},{enabled:()=>!i,preventDefault:!0},[]),fe(["e"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[t]),fe(["c"],()=>{f()},{enabled:()=>!i,preventDefault:!0},[t]),fe(["shift+f"],()=>{h()},{enabled:()=>!i,preventDefault:!0}),fe(["delete","backspace"],()=>{p()},{enabled:()=>!i,preventDefault:!0}),fe(["BracketLeft"],()=>{e(Wo(Math.max(r-5,5)))},{enabled:()=>!i,preventDefault:!0},[r]),fe(["BracketRight"],()=>{e(Wo(Math.min(r+5,500)))},{enabled:()=>!i,preventDefault:!0},[r]),fe(["shift+BracketLeft"],()=>{e(Vo({...n,a:ee.clamp(n.a-.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[n]),fe(["shift+BracketRight"],()=>{e(Vo({...n,a:ee.clamp(n.a+.05,.05,1)}))},{enabled:()=>!i,preventDefault:!0},[n]);const c=()=>e(xr("brush")),u=()=>e(xr("eraser")),f=()=>e(xr("colorPicker")),h=()=>e(e2()),p=()=>e(t2());return l.jsxs(en,{isAttached:!0,children:[l.jsx(ue,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:l.jsx(Ry,{}),isChecked:t==="brush"&&!i,onClick:c,isDisabled:i}),l.jsx(ue,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:l.jsx(Dy,{}),isChecked:t==="eraser"&&!i,isDisabled:i,onClick:u}),l.jsx(ue,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:l.jsx(Ay,{}),isDisabled:i,onClick:h}),l.jsx(ue,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),isDisabled:i,onClick:p}),l.jsx(ue,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:l.jsx(Oy,{}),isChecked:t==="colorPicker"&&!i,isDisabled:i,onClick:f}),l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(ue,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:l.jsx(ap,{})}),children:l.jsxs(B,{minWidth:60,direction:"column",gap:4,width:"100%",children:[l.jsx(B,{gap:4,justifyContent:"space-between",children:l.jsx(ut,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:g=>e(Wo(g)),sliderNumberInputProps:{max:500},inputReadOnly:!1})}),l.jsx(pc,{sx:{width:"100%",paddingTop:2,paddingBottom:2},pickerColor:n,onChange:g=>e(Vo(g))})]})})]})},q_=be([Pt,tt,zt],(e,t,n)=>{const{isProcessing:r}=e,{tool:i,shouldCropToBoundingBoxOnSave:s,layer:c,isMaskEnabled:u}=t;return{isProcessing:r,isStaging:n,isMaskEnabled:u,tool:i,layer:c,shouldCropToBoundingBoxOnSave:s}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Y_=()=>{const e=X(),{isProcessing:t,isStaging:n,isMaskEnabled:r,layer:i,tool:s,shouldCropToBoundingBoxOnSave:c}=O(q_),u=Sr(),{t:f}=Y(),{openUploader:h}=Zh();fe(["v"],()=>{p()},{enabled:()=>!n,preventDefault:!0},[]),fe(["r"],()=>{y()},{enabled:()=>!0,preventDefault:!0},[u]),fe(["shift+m"],()=>{C()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["shift+s"],()=>{w()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["meta+c","ctrl+c"],()=>{k()},{enabled:()=>!n,preventDefault:!0},[u,t]),fe(["shift+d"],()=>{j()},{enabled:()=>!n,preventDefault:!0},[u,t]);const p=()=>e(xr("move")),g=I4(()=>y(!1),()=>y(!0)),y=(P=!1)=>{const I=Sr();if(!I)return;const T=I.getClientRect({skipTransform:!0});e(J1({contentRect:T,shouldScaleTo1:P}))},S=()=>{e(Jf()),e(Sc())},C=()=>{e(ai({cropVisible:!1,shouldSetAsInitialImage:!0}))},w=()=>{e(ai({cropVisible:!c,cropToBoundingBox:c,shouldSaveToGallery:!0}))},k=()=>{e(ai({cropVisible:!c,cropToBoundingBox:c,shouldCopy:!0}))},j=()=>{e(ai({cropVisible:!c,cropToBoundingBox:c,shouldDownload:!0}))},M=P=>{const I=P.target.value;e(tc(I)),I==="mask"&&!r&&e(ss(!0))};return l.jsxs(B,{sx:{alignItems:"center",gap:2},children:[l.jsx(Mn,{tooltip:`${f("unifiedCanvas.layer")} (Q)`,tooltipProps:{hasArrow:!0,placement:"top"},value:i,validValues:Z1,onChange:M,isDisabled:n}),l.jsx(W_,{}),l.jsx(G_,{}),l.jsxs(en,{isAttached:!0,children:[l.jsx(ue,{"aria-label":`${f("unifiedCanvas.move")} (V)`,tooltip:`${f("unifiedCanvas.move")} (V)`,icon:l.jsx(My,{}),isChecked:s==="move"||n,onClick:p}),l.jsx(ue,{"aria-label":`${f("unifiedCanvas.resetView")} (R)`,tooltip:`${f("unifiedCanvas.resetView")} (R)`,icon:l.jsx(_y,{}),onClick:g})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(ue,{"aria-label":`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${f("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:l.jsx(zy,{}),onClick:C,isDisabled:n}),l.jsx(ue,{"aria-label":`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${f("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:l.jsx(op,{}),onClick:w,isDisabled:n}),l.jsx(ue,{"aria-label":`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${f("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:l.jsx(Jo,{}),onClick:k,isDisabled:n}),l.jsx(ue,{"aria-label":`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${f("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:l.jsx(ip,{}),onClick:j,isDisabled:n})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(P4,{}),l.jsx(E4,{})]}),l.jsxs(en,{isAttached:!0,children:[l.jsx(ue,{"aria-label":`${f("common.upload")}`,tooltip:`${f("common.upload")}`,icon:l.jsx(Rc,{}),onClick:h,isDisabled:n}),l.jsx(ue,{"aria-label":`${f("unifiedCanvas.clearCanvas")}`,tooltip:`${f("unifiedCanvas.clearCanvas")}`,icon:l.jsx(io,{}),onClick:S,colorScheme:"error",isDisabled:n})]}),l.jsx(en,{isAttached:!0,children:l.jsx(U_,{})})]})},X_=be([tt],e=>{const{doesCanvasNeedScaling:t}=e;return{doesCanvasNeedScaling:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),K_=()=>{const e=X(),{doesCanvasNeedScaling:t}=O(X_);return x.useLayoutEffect(()=>{e(on(!0));const n=ee.debounce(()=>{e(on(!0))},250);return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[e]),l.jsx(We,{sx:{width:"100%",height:"100%",padding:4,borderRadius:"base",bg:"base.850"},children:l.jsxs(B,{sx:{flexDirection:"column",alignItems:"center",gap:4,width:"100%",height:"100%"},children:[l.jsx(Y_,{}),l.jsx(B,{sx:{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:4,width:"100%",height:"100%"},children:t?l.jsx(j4,{}):l.jsx(k4,{})})]})})},Q_=be(tt,e=>{const{boundingBoxDimensions:t,boundingBoxScaleMethod:n}=e;return{boundingBoxDimensions:t,boundingBoxScale:n}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Z_=()=>{const e=X(),{boundingBoxDimensions:t}=O(Q_),{t:n}=Y(),r=u=>{e(Na({...t,width:Math.floor(u)}))},i=u=>{e(Na({...t,height:Math.floor(u)}))},s=()=>{e(Na({...t,width:Math.floor(512)}))},c=()=>{e(Na({...t,height:Math.floor(512)}))};return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(ut,{label:n("parameters.width"),min:64,max:1024,step:64,value:t.width,onChange:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:s}),l.jsx(ut,{label:n("parameters.height"),min:64,max:1024,step:64,value:t.height,onChange:i,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:c})]})},J_=be([gp,Pt,tt],(e,t,n)=>{const{tileSize:r,infillMethod:i}=e,{infill_methods:s}=t,{boundingBoxScaleMethod:c,scaledBoundingBoxDimensions:u}=n;return{boundingBoxScale:c,scaledBoundingBoxDimensions:u,tileSize:r,infillMethod:i,availableInfillMethods:s,isManual:c==="manual"}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),eD=()=>{const e=X(),{tileSize:t,infillMethod:n,availableInfillMethods:r,boundingBoxScale:i,isManual:s,scaledBoundingBoxDimensions:c}=O(J_),{t:u}=Y(),f=S=>{e(Cl({...c,width:Math.floor(S)}))},h=S=>{e(Cl({...c,height:Math.floor(S)}))},p=()=>{e(Cl({...c,width:Math.floor(512)}))},g=()=>{e(Cl({...c,height:Math.floor(512)}))},y=S=>{e(r3(S.target.value))};return l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(Mn,{label:u("parameters.scaleBeforeProcessing"),validValues:t3,value:i,onChange:y}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledWidth"),min:64,max:1024,step:64,value:c.width,onChange:f,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:p}),l.jsx(ut,{isInputDisabled:!s,isResetDisabled:!s,isSliderDisabled:!s,label:u("parameters.scaledHeight"),min:64,max:1024,step:64,value:c.height,onChange:h,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,inputReadOnly:!0,withReset:!0,handleReset:g}),l.jsx(Mn,{label:u("parameters.infillMethod"),value:n,validValues:r,onChange:S=>e(n3(S.target.value))}),l.jsx(ut,{isInputDisabled:n!=="tile",isResetDisabled:n!=="tile",isSliderDisabled:n!=="tile",label:u("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:S=>{e(qv(S))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(qv(32))}})]})};function tD(){const e=X(),t=O(r=>r.generation.seamBlur),{t:n}=Y();return l.jsx(ut,{label:n("parameters.seamBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(Yv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Yv(16))}})}function nD(){const e=X(),{t}=Y(),n=O(r=>r.generation.seamSize);return l.jsx(ut,{label:t("parameters.seamSize"),min:1,max:256,sliderNumberInputProps:{max:512},value:n,onChange:r=>{e(Xv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>e(Xv(96))})}function rD(){const{t:e}=Y(),t=O(r=>r.generation.seamSteps),n=X();return l.jsx(ut,{label:e("parameters.seamSteps"),min:1,max:100,sliderNumberInputProps:{max:999},value:t,onChange:r=>{n(Kv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{n(Kv(30))}})}function iD(){const e=X(),{t}=Y(),n=O(r=>r.generation.seamStrength);return l.jsx(ut,{label:t("parameters.seamStrength"),min:.01,max:.99,step:.01,value:n,onChange:r=>{e(Qv(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Qv(.7))}})}const oD=()=>l.jsxs(Le,{gap:2,alignItems:"stretch",children:[l.jsx(nD,{}),l.jsx(tD,{}),l.jsx(iD,{}),l.jsx(rD,{})]});function aD(){const{t:e}=Y(),t={general:{header:`${e("parameters.general")}`,feature:void 0,content:l.jsx(Ep,{})},unifiedCanvasImg2Img:{header:`${e("parameters.imageToImage")}`,feature:void 0,content:l.jsx(m4,{label:e("parameters.img2imgStrength")})},seed:{header:`${e("parameters.seed")}`,feature:dn.SEED,content:l.jsx(wp,{})},boundingBox:{header:`${e("parameters.boundingBoxHeader")}`,feature:dn.BOUNDING_BOX,content:l.jsx(Z_,{})},seamCorrection:{header:`${e("parameters.seamCorrectionHeader")}`,feature:dn.SEAM_CORRECTION,content:l.jsx(oD,{})},infillAndScaling:{header:`${e("parameters.infillScalingHeader")}`,feature:dn.INFILL_AND_SCALING,content:l.jsx(eD,{})},variations:{header:`${e("parameters.variations")}`,feature:dn.VARIATIONS,content:l.jsx(jp,{}),additionalHeaderComponents:l.jsx(kp,{})},symmetry:{header:`${e("parameters.symmetry")}`,content:l.jsx(Sp,{}),additionalHeaderComponents:l.jsx(Cp,{})}};return l.jsxs(_p,{children:[l.jsxs(B,{flexDir:"column",rowGap:2,children:[l.jsx(Tp,{}),l.jsx(Mp,{})]}),l.jsx(Ip,{}),l.jsx(Pp,{accordionInfo:t})]})}function sD(){const e=O(t=>t.ui.shouldUseCanvasBetaLayout);return l.jsx(bp,{optionsPanel:l.jsx(aD,{}),children:e?l.jsx(B_,{}):l.jsx(K_,{})})}const Dn={txt2img:{title:l.jsx(Jt,{as:v9,boxSize:6}),workarea:l.jsx(KI,{}),tooltip:"Text To Image"},img2img:{title:l.jsx(Jt,{as:cp,boxSize:6}),workarea:l.jsx(VI,{}),tooltip:"Image To Image"},unifiedCanvas:{title:l.jsx(Jt,{as:y9,boxSize:6}),workarea:l.jsx(sD,{}),tooltip:"Unified Canvas"},nodes:{title:l.jsx(Jt,{as:g9,boxSize:6}),workarea:l.jsx($7,{}),tooltip:"Nodes"},postprocess:{title:l.jsx(Jt,{as:b9,boxSize:6}),workarea:l.jsx(G7,{}),tooltip:"Post Processing"},training:{title:l.jsx(Jt,{as:x9,boxSize:6}),workarea:l.jsx(q7,{}),tooltip:"Training"}};function lD(){Dn.txt2img.tooltip=nr.t("common.text2img"),Dn.img2img.tooltip=nr.t("common.img2img"),Dn.unifiedCanvas.tooltip=nr.t("common.unifiedCanvas"),Dn.nodes.tooltip=nr.t("common.nodes"),Dn.postprocess.tooltip=nr.t("common.postProcessing"),Dn.training.tooltip=nr.t("common.training")}function cD(){const e=O(U7),t=O(h=>h.lightbox.isLightboxOpen),{shouldShowGallery:n,shouldShowParametersPanel:r,shouldPinGallery:i,shouldPinParametersPanel:s}=O(yp);Y7(lD);const c=X();fe("1",()=>{c(jn(0))}),fe("2",()=>{c(jn(1))}),fe("3",()=>{c(jn(2))}),fe("4",()=>{c(jn(3))}),fe("5",()=>{c(jn(4))}),fe("6",()=>{c(jn(5))}),fe("z",()=>{c(Bi(!t))},[t]),fe("f",()=>{n||r?(c(Hi(!1)),c(Fi(!1))):(c(Hi(!0)),c(Fi(!0))),(i||s)&&setTimeout(()=>c(on(!0)),400)},[n,r]);const u=()=>{const h=[];return Object.keys(Dn).forEach(p=>{h.push(l.jsx(Yt,{hasArrow:!0,label:Dn[p].tooltip,placement:"end",children:l.jsxs(yy,{children:[l.jsx(k2,{children:Dn[p].tooltip}),Dn[p].title]})},p))}),h},f=()=>{const h=[];return Object.keys(Dn).forEach(p=>{h.push(l.jsx(gy,{children:Dn[p].workarea},p))}),h};return l.jsxs(my,{isLazy:!0,defaultIndex:e,index:e,onChange:h=>{c(jn(h))},children:[l.jsx(vy,{children:u()}),l.jsx(xy,{children:t?l.jsx(sI,{}):f()})]})}var uD=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function bs(e,t){var n=dD(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function dD(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),i=uD.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}var fD=[".DS_Store","Thumbs.db"];function hD(e){return oa(this,void 0,void 0,function(){return aa(this,function(t){return mc(e)&&pD(e.dataTransfer)?[2,xD(e.dataTransfer,e.type)]:mD(e)?[2,vD(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,gD(e)]:[2,[]]})})}function pD(e){return mc(e)}function mD(e){return mc(e)&&mc(e.target)}function mc(e){return typeof e=="object"&&e!==null}function vD(e){return Lf(e.target.files).map(function(t){return bs(t)})}function gD(e){return oa(this,void 0,void 0,function(){var t;return aa(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return bs(r)})]}})})}function xD(e,t){return oa(this,void 0,void 0,function(){var n,r;return aa(this,function(i){switch(i.label){case 0:return e.items?(n=Lf(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(yD))]):[3,2];case 1:return r=i.sent(),[2,O0(z4(r))];case 2:return[2,O0(Lf(e.files).map(function(s){return bs(s)}))]}})})}function O0(e){return e.filter(function(t){return fD.indexOf(t.name)===-1})}function Lf(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,F0(n)];if(e.sizen)return[!1,F0(n)]}return[!0,null]}function Ni(e){return e!=null}function zD(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,s=e.multiple,c=e.maxFiles,u=e.validator;return!s&&t.length>1||s&&c>=1&&t.length>c?!1:t.every(function(f){var h=L4(f,n),p=es(h,1),g=p[0],y=B4(f,r,i),S=es(y,1),C=S[0],w=u?u(f):null;return g&&C&&!w})}function vc(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Nl(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function B0(e){e.preventDefault()}function RD(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function ND(e){return e.indexOf("Edge/")!==-1}function FD(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return RD(e)||ND(e)}function hr(){for(var e=arguments.length,t=new Array(e),n=0;n1?i-1:0),c=1;ce.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tO(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s=0)&&(n[i]=e[i]);return n}var Np=x.forwardRef(function(e,t){var n=e.children,r=gc(e,UD),i=$4(r),s=i.open,c=gc(i,$D);return x.useImperativeHandle(t,function(){return{open:s}},[s]),ke.createElement(x.Fragment,null,n(Ot(Ot({},c),{},{open:s})))});Np.displayName="Dropzone";var U4={disabled:!1,getFilesFromEvent:hD,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Np.defaultProps=U4;Np.propTypes={children:lt.func,accept:lt.objectOf(lt.arrayOf(lt.string)),multiple:lt.bool,preventDropOnDocument:lt.bool,noClick:lt.bool,noKeyboard:lt.bool,noDrag:lt.bool,noDragEventsBubbling:lt.bool,minSize:lt.number,maxSize:lt.number,maxFiles:lt.number,disabled:lt.bool,getFilesFromEvent:lt.func,onFileDialogCancel:lt.func,onFileDialogOpen:lt.func,useFsAccessApi:lt.bool,autoFocus:lt.bool,onDragEnter:lt.func,onDragLeave:lt.func,onDragOver:lt.func,onDrop:lt.func,onDropAccepted:lt.func,onDropRejected:lt.func,onError:lt.func,validator:lt.func};var Vf={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function $4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Ot(Ot({},U4),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,s=t.maxSize,c=t.minSize,u=t.multiple,f=t.maxFiles,h=t.onDragEnter,p=t.onDragLeave,g=t.onDragOver,y=t.onDrop,S=t.onDropAccepted,C=t.onDropRejected,w=t.onFileDialogCancel,k=t.onFileDialogOpen,j=t.useFsAccessApi,M=t.autoFocus,P=t.preventDropOnDocument,I=t.noClick,T=t.noKeyboard,D=t.noDrag,_=t.noDragEventsBubbling,z=t.onError,V=t.validator,F=x.useMemo(function(){return HD(n)},[n]),L=x.useMemo(function(){return BD(n)},[n]),Q=x.useMemo(function(){return typeof k=="function"?k:W0},[k]),$=x.useMemo(function(){return typeof w=="function"?w:W0},[w]),Z=x.useRef(null),te=x.useRef(null),ie=x.useReducer(nO,Vf),U=Wd(ie,2),K=U[0],ne=U[1],ce=K.isFocused,Re=K.isFileDialogActive,ze=x.useRef(typeof window<"u"&&window.isSecureContext&&j&&LD()),Me=function(){!ze.current&&Re&&setTimeout(function(){if(te.current){var le=te.current.files;le.length||(ne({type:"closeDialog"}),$())}},300)};x.useEffect(function(){return window.addEventListener("focus",Me,!1),function(){window.removeEventListener("focus",Me,!1)}},[te,Re,$,ze]);var oe=x.useRef([]),ae=function(le){Z.current&&Z.current.contains(le.target)||(le.preventDefault(),oe.current=[])};x.useEffect(function(){return P&&(document.addEventListener("dragover",B0,!1),document.addEventListener("drop",ae,!1)),function(){P&&(document.removeEventListener("dragover",B0),document.removeEventListener("drop",ae))}},[Z,P]),x.useEffect(function(){return!r&&M&&Z.current&&Z.current.focus(),function(){}},[Z,M,r]);var je=x.useCallback(function(q){z?z(q):console.error(q)},[z]),Be=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q),oe.current=[].concat(YD(oe.current),[q.target]),Nl(q)&&Promise.resolve(i(q)).then(function(le){if(!(vc(q)&&!_)){var Fe=le.length,Ze=Fe>0&&zD({files:le,accept:F,minSize:c,maxSize:s,multiple:u,maxFiles:f,validator:V}),J=Fe>0&&!Ze;ne({isDragAccept:Ze,isDragReject:J,isDragActive:!0,type:"setDraggedFiles"}),h&&h(q)}}).catch(function(le){return je(le)})},[i,h,je,_,F,c,s,u,f,V]),Ne=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var le=Nl(q);if(le&&q.dataTransfer)try{q.dataTransfer.dropEffect="copy"}catch{}return le&&g&&g(q),!1},[g,_]),Ge=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q);var le=oe.current.filter(function(Ze){return Z.current&&Z.current.contains(Ze)}),Fe=le.indexOf(q.target);Fe!==-1&&le.splice(Fe,1),oe.current=le,!(le.length>0)&&(ne({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Nl(q)&&p&&p(q))},[Z,p,_]),Qe=x.useCallback(function(q,le){var Fe=[],Ze=[];q.forEach(function(J){var He=L4(J,F),nt=Wd(He,2),Ft=nt[0],pe=nt[1],De=B4(J,c,s),hn=Wd(De,2),$t=hn[0],pn=hn[1],ir=V?V(J):null;if(Ft&&$t&&!ir)Fe.push(J);else{var yi=[pe,pn];ir&&(yi=yi.concat(ir)),Ze.push({file:J,errors:yi.filter(function(da){return da})})}}),(!u&&Fe.length>1||u&&f>=1&&Fe.length>f)&&(Fe.forEach(function(J){Ze.push({file:J,errors:[AD]})}),Fe.splice(0)),ne({acceptedFiles:Fe,fileRejections:Ze,type:"setFiles"}),y&&y(Fe,Ze,le),Ze.length>0&&C&&C(Ze,le),Fe.length>0&&S&&S(Fe,le)},[ne,u,F,c,s,f,y,S,C,V]),ve=x.useCallback(function(q){q.preventDefault(),q.persist(),N(q),oe.current=[],Nl(q)&&Promise.resolve(i(q)).then(function(le){vc(q)&&!_||Qe(le,q)}).catch(function(le){return je(le)}),ne({type:"reset"})},[i,Qe,je,_]),_e=x.useCallback(function(){if(ze.current){ne({type:"openDialog"}),Q();var q={multiple:u,types:L};window.showOpenFilePicker(q).then(function(le){return i(le)}).then(function(le){Qe(le,null),ne({type:"closeDialog"})}).catch(function(le){WD(le)?($(le),ne({type:"closeDialog"})):VD(le)?(ze.current=!1,te.current?(te.current.value=null,te.current.click()):je(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):je(le)});return}te.current&&(ne({type:"openDialog"}),Q(),te.current.value=null,te.current.click())},[ne,Q,$,j,Qe,je,L,u]),qe=x.useCallback(function(q){!Z.current||!Z.current.isEqualNode(q.target)||(q.key===" "||q.key==="Enter"||q.keyCode===32||q.keyCode===13)&&(q.preventDefault(),_e())},[Z,_e]),ge=x.useCallback(function(){ne({type:"focus"})},[]),Te=x.useCallback(function(){ne({type:"blur"})},[]),et=x.useCallback(function(){I||(FD()?setTimeout(_e,0):_e())},[I,_e]),Ve=function(le){return r?null:le},vt=function(le){return T?null:Ve(le)},Nt=function(le){return D?null:Ve(le)},N=function(le){_&&le.stopPropagation()},de=x.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},le=q.refKey,Fe=le===void 0?"ref":le,Ze=q.role,J=q.onKeyDown,He=q.onFocus,nt=q.onBlur,Ft=q.onClick,pe=q.onDragEnter,De=q.onDragOver,hn=q.onDragLeave,$t=q.onDrop,pn=gc(q,GD);return Ot(Ot(Wf({onKeyDown:vt(hr(J,qe)),onFocus:vt(hr(He,ge)),onBlur:vt(hr(nt,Te)),onClick:Ve(hr(Ft,et)),onDragEnter:Nt(hr(pe,Be)),onDragOver:Nt(hr(De,Ne)),onDragLeave:Nt(hr(hn,Ge)),onDrop:Nt(hr($t,ve)),role:typeof Ze=="string"&&Ze!==""?Ze:"presentation"},Fe,Z),!r&&!T?{tabIndex:0}:{}),pn)}},[Z,qe,ge,Te,et,Be,Ne,Ge,ve,T,D,r]),xe=x.useCallback(function(q){q.stopPropagation()},[]),Ee=x.useMemo(function(){return function(){var q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},le=q.refKey,Fe=le===void 0?"ref":le,Ze=q.onChange,J=q.onClick,He=gc(q,qD),nt=Wf({accept:F,multiple:u,type:"file",style:{display:"none"},onChange:Ve(hr(Ze,ve)),onClick:Ve(hr(J,xe)),tabIndex:-1},Fe,te);return Ot(Ot({},nt),He)}},[te,n,u,ve,r]);return Ot(Ot({},K),{},{isFocused:ce&&!r,getRootProps:de,getInputProps:Ee,rootRef:Z,inputRef:te,open:Ve(_e)})}function nO(e,t){switch(t.type){case"focus":return Ot(Ot({},e),{},{isFocused:!0});case"blur":return Ot(Ot({},e),{},{isFocused:!1});case"openDialog":return Ot(Ot({},Vf),{},{isFileDialogActive:!0});case"closeDialog":return Ot(Ot({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Ot(Ot({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Ot(Ot({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return Ot({},Vf);default:return e}}function W0(){}const rO=e=>{const{isDragAccept:t,isDragReject:n,overlaySecondaryText:r,setIsHandlingUpload:i}=e;return fe("esc",()=>{i(!1)}),l.jsx(We,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:l.jsx(B,{sx:{opacity:.4,width:"100%",height:"100%",flexDirection:"column",rowGap:4,alignItems:"center",justifyContent:"center",bg:"base.900",boxShadow:`inset 0 0 20rem 1rem var(--invokeai-colors-${t?"accent":"error"}-500)`},children:t?l.jsxs(Vn,{size:"lg",children:["Upload Image",r]}):l.jsxs(l.Fragment,{children:[l.jsx(Vn,{size:"lg",children:"Invalid Upload"}),l.jsx(Vn,{size:"md",children:"Must be single JPEG or PNG image"})]})})})},iO=e=>{const{children:t}=e,n=X(),r=O(Bt),i=us({}),{t:s}=Y(),[c,u]=x.useState(!1),{setOpenUploader:f}=Zh(),h=x.useCallback(P=>{u(!0);const I=P.errors.reduce((T,D)=>`${T} +${D.message}`,"");i({title:s("toast.uploadFailed"),description:I,status:"error",isClosable:!0})},[s,i]),p=x.useCallback(async P=>{n(Ug({imageFile:P}))},[n]),g=x.useCallback((P,I)=>{I.forEach(T=>{h(T)}),P.forEach(T=>{p(T)})},[p,h]),{getRootProps:y,getInputProps:S,isDragAccept:C,isDragReject:w,isDragActive:k,open:j}=$4({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:g,onDragOver:()=>u(!0),maxFiles:1});f(j),x.useEffect(()=>{const P=I=>{var z;const T=(z=I.clipboardData)==null?void 0:z.items;if(!T)return;const D=[];for(const V of T)V.kind==="file"&&["image/png","image/jpg"].includes(V.type)&&D.push(V);if(!D.length)return;if(I.stopImmediatePropagation(),D.length>1){i({description:s("toast.uploadFailedMultipleImagesDesc"),status:"error",isClosable:!0});return}const _=D[0].getAsFile();if(!_){i({description:s("toast.uploadFailedUnableToLoadDesc"),status:"error",isClosable:!0});return}n(Ug({imageFile:_}))};return document.addEventListener("paste",P),()=>{document.removeEventListener("paste",P)}},[s,n,i,r]);const M=["img2img","unifiedCanvas"].includes(r)?` to ${Dn[r].tooltip}`:"";return l.jsx(Qh.Provider,{value:j,children:l.jsxs(We,{...y({style:{}}),onKeyDown:P=>{P.key},children:[l.jsx("input",{...S()}),t,k&&c&&l.jsx(rO,{isDragAccept:C,isDragReject:w,overlaySecondaryText:M,setIsHandlingUpload:u})]})})},oO=be(Pt,e=>e.log,{memoizeOptions:{resultEqualityCheck:(e,t)=>e.length===t.length}}),aO=be(Pt,e=>({shouldShowLogViewer:e.shouldShowLogViewer,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),sO=()=>{const e=X(),{t}=Y(),n=O(oO),{shouldShowLogViewer:r,hasError:i,wasErrorSeen:s}=O(aO),[c,u]=x.useState(!0),f=x.useRef(null);x.useLayoutEffect(()=>{f.current!==null&&c&&(f.current.scrollTop=f.current.scrollHeight)},[c,n,r]);const h=()=>{e(f2()),e(vd(!r))};fe("`",()=>{e(vd(!r))},[r]),fe("esc",()=>{e(vd(!1))});const p=()=>{f.current&&c&&f.current.scrollTop{const{timestamp:S,message:C,level:w}=g,k=w==="info"?"base":w;return l.jsxs(B,{sx:{gap:2,color:`${k}.300`},children:[l.jsxs(Ce,{fontWeight:"600",children:[S,":"]}),l.jsx(Ce,{wordBreak:"break-all",children:C})]},y)})})}),r&&l.jsx(Yt,{hasArrow:!0,label:c?"Autoscroll On":"Autoscroll Off",children:l.jsx(ue,{size:"sm","aria-label":t("accessibility.toggleAutoscroll"),icon:l.jsx(E8,{}),onClick:()=>u(!c),isChecked:c,sx:{position:"fixed",insetInlineStart:2,bottom:12,zIndex:"10000"}})}),l.jsx(Yt,{hasArrow:!0,label:r?"Hide Console":"Show Console",children:l.jsx(ue,{size:"sm","aria-label":t("accessibility.toggleLogViewer"),icon:r?l.jsx(V8,{}):l.jsx(Ty,{}),onClick:h,sx:{position:"fixed",insetInlineStart:2,bottom:2,zIndex:"10000"},colorScheme:i||!s?"error":"base"})})]})},lO=be(Pt,e=>({isProcessing:e.isProcessing,currentStep:e.currentStep,totalSteps:e.totalSteps,currentStatusHasSteps:e.currentStatusHasSteps}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),cO=()=>{const{t:e}=Y(),{isProcessing:t,currentStep:n,totalSteps:r,currentStatusHasSteps:i}=O(lO),s=n?Math.round(n*100/r):0;return l.jsx(ey,{value:s,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:t&&!i,height:fp,zIndex:99})};function uO(e){const{title:t,hotkey:n,description:r}=e;return l.jsxs($n,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[l.jsxs($n,{children:[l.jsx(Ce,{fontWeight:600,children:t}),r&&l.jsx(Ce,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),l.jsx(We,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function dO({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ui(),{t:i}=Y(),s=[{title:i("hotkeys.invoke.title"),desc:i("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:i("hotkeys.cancel.title"),desc:i("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:i("hotkeys.focusPrompt.title"),desc:i("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:i("hotkeys.toggleOptions.title"),desc:i("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:i("hotkeys.pinOptions.title"),desc:i("hotkeys.pinOptions.desc"),hotkey:"Shift+O"},{title:i("hotkeys.toggleViewer.title"),desc:i("hotkeys.toggleViewer.desc"),hotkey:"Z"},{title:i("hotkeys.toggleGallery.title"),desc:i("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:i("hotkeys.maximizeWorkSpace.title"),desc:i("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:i("hotkeys.changeTabs.title"),desc:i("hotkeys.changeTabs.desc"),hotkey:"1-5"},{title:i("hotkeys.consoleToggle.title"),desc:i("hotkeys.consoleToggle.desc"),hotkey:"`"}],c=[{title:i("hotkeys.setPrompt.title"),desc:i("hotkeys.setPrompt.desc"),hotkey:"P"},{title:i("hotkeys.setSeed.title"),desc:i("hotkeys.setSeed.desc"),hotkey:"S"},{title:i("hotkeys.setParameters.title"),desc:i("hotkeys.setParameters.desc"),hotkey:"A"},{title:i("hotkeys.restoreFaces.title"),desc:i("hotkeys.restoreFaces.desc"),hotkey:"Shift+R"},{title:i("hotkeys.upscale.title"),desc:i("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:i("hotkeys.showInfo.title"),desc:i("hotkeys.showInfo.desc"),hotkey:"I"},{title:i("hotkeys.sendToImageToImage.title"),desc:i("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:i("hotkeys.deleteImage.title"),desc:i("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:i("hotkeys.closePanels.title"),desc:i("hotkeys.closePanels.desc"),hotkey:"Esc"}],u=[{title:i("hotkeys.previousImage.title"),desc:i("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:i("hotkeys.nextImage.title"),desc:i("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:i("hotkeys.toggleGalleryPin.title"),desc:i("hotkeys.toggleGalleryPin.desc"),hotkey:"Shift+G"},{title:i("hotkeys.increaseGalleryThumbSize.title"),desc:i("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:i("hotkeys.decreaseGalleryThumbSize.title"),desc:i("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],f=[{title:i("hotkeys.selectBrush.title"),desc:i("hotkeys.selectBrush.desc"),hotkey:"B"},{title:i("hotkeys.selectEraser.title"),desc:i("hotkeys.selectEraser.desc"),hotkey:"E"},{title:i("hotkeys.decreaseBrushSize.title"),desc:i("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:i("hotkeys.increaseBrushSize.title"),desc:i("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:i("hotkeys.decreaseBrushOpacity.title"),desc:i("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:i("hotkeys.increaseBrushOpacity.title"),desc:i("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:i("hotkeys.moveTool.title"),desc:i("hotkeys.moveTool.desc"),hotkey:"V"},{title:i("hotkeys.fillBoundingBox.title"),desc:i("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:i("hotkeys.eraseBoundingBox.title"),desc:i("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:i("hotkeys.colorPicker.title"),desc:i("hotkeys.colorPicker.desc"),hotkey:"C"},{title:i("hotkeys.toggleSnap.title"),desc:i("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:i("hotkeys.quickToggleMove.title"),desc:i("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:i("hotkeys.toggleLayer.title"),desc:i("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:i("hotkeys.clearMask.title"),desc:i("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:i("hotkeys.hideMask.title"),desc:i("hotkeys.hideMask.desc"),hotkey:"H"},{title:i("hotkeys.showHideBoundingBox.title"),desc:i("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:i("hotkeys.mergeVisible.title"),desc:i("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:i("hotkeys.saveToGallery.title"),desc:i("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:i("hotkeys.copyToClipboard.title"),desc:i("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:i("hotkeys.downloadImage.title"),desc:i("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:i("hotkeys.undoStroke.title"),desc:i("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:i("hotkeys.redoStroke.title"),desc:i("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:i("hotkeys.resetView.title"),desc:i("hotkeys.resetView.desc"),hotkey:"R"},{title:i("hotkeys.previousStagingImage.title"),desc:i("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:i("hotkeys.nextStagingImage.title"),desc:i("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:i("hotkeys.acceptStagingImage.title"),desc:i("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],h=p=>l.jsx(B,{flexDir:"column",gap:4,children:p.map((g,y)=>l.jsxs(B,{flexDir:"column",px:2,gap:4,children:[l.jsx(uO,{title:g.title,description:g.desc,hotkey:g.hotkey}),y-1}function qO(e,t){var n=this.__data__,r=$c(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function $r(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=ez}var tz="[object Arguments]",nz="[object Array]",rz="[object Boolean]",iz="[object Date]",oz="[object Error]",az="[object Function]",sz="[object Map]",lz="[object Number]",cz="[object Object]",uz="[object RegExp]",dz="[object Set]",fz="[object String]",hz="[object WeakMap]",pz="[object ArrayBuffer]",mz="[object DataView]",vz="[object Float32Array]",gz="[object Float64Array]",xz="[object Int8Array]",yz="[object Int16Array]",bz="[object Int32Array]",Sz="[object Uint8Array]",Cz="[object Uint8ClampedArray]",wz="[object Uint16Array]",kz="[object Uint32Array]",Ct={};Ct[vz]=Ct[gz]=Ct[xz]=Ct[yz]=Ct[bz]=Ct[Sz]=Ct[Cz]=Ct[wz]=Ct[kz]=!0;Ct[tz]=Ct[nz]=Ct[pz]=Ct[rz]=Ct[mz]=Ct[iz]=Ct[oz]=Ct[az]=Ct[sz]=Ct[lz]=Ct[cz]=Ct[uz]=Ct[dz]=Ct[fz]=Ct[hz]=!1;function jz(e){return so(e)&&rb(e.length)&&!!Ct[ao(e)]}function Lp(e){return function(t){return e(t)}}var ib=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$a=ib&&typeof module=="object"&&module&&!module.nodeType&&module,Ez=$a&&$a.exports===ib,Ud=Ez&&G4.process,Pz=function(){try{var e=$a&&$a.require&&$a.require("util").types;return e||Ud&&Ud.binding&&Ud.binding("util")}catch{}}();const na=Pz;var Z0=na&&na.isTypedArray,Iz=Z0?Lp(Z0):jz;const Mz=Iz;var Tz=Object.prototype,_z=Tz.hasOwnProperty;function ob(e,t){var n=Cs(e),r=!n&&$A(e),i=!n&&!r&&nb(e),s=!n&&!r&&!i&&Mz(e),c=n||r||i||s,u=c?BA(e.length,String):[],f=u.length;for(var h in e)(t||_z.call(e,h))&&!(c&&(h=="length"||i&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||JA(h,f)))&&u.push(h);return u}var Dz=Object.prototype;function Bp(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Dz;return e===n}var Oz=Y4(Object.keys,Object);const Az=Oz;var zz=Object.prototype,Rz=zz.hasOwnProperty;function Nz(e){if(!Bp(e))return Az(e);var t=[];for(var n in Object(e))Rz.call(e,n)&&n!="constructor"&&t.push(n);return t}function ab(e){return e!=null&&rb(e.length)&&!Q4(e)}function Hp(e){return ab(e)?ob(e):Nz(e)}function Fz(e,t){return e&&qc(t,Hp(t),e)}function Lz(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Bz=Object.prototype,Hz=Bz.hasOwnProperty;function Wz(e){if(!Ss(e))return Lz(e);var t=Bp(e),n=[];for(var r in e)r=="constructor"&&(t||!Hz.call(e,r))||n.push(r);return n}function Wp(e){return ab(e)?ob(e,!0):Wz(e)}function Vz(e,t){return e&&qc(t,Wp(t),e)}var sb=typeof exports=="object"&&exports&&!exports.nodeType&&exports,J0=sb&&typeof module=="object"&&module&&!module.nodeType&&module,Uz=J0&&J0.exports===sb,e1=Uz?kr.Buffer:void 0,t1=e1?e1.allocUnsafe:void 0;function $z(e,t){if(t)return e.slice();var n=e.length,r=t1?t1(n):new e.constructor(n);return e.copy(r),r}function lb(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n=0)&&(n[i]=e[i]);return n}function g1(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var x1=function(t){return Array.isArray(t)&&t.length===0},kn=function(t){return typeof t=="function"},Yc=function(t){return t!==null&&typeof t=="object"},VN=function(t){return String(Math.floor(Number(t)))===t},$d=function(t){return Object.prototype.toString.call(t)==="[object String]"},yb=function(t){return x.Children.count(t)===0},Gd=function(t){return Yc(t)&&kn(t.then)};function rn(e,t,n,r){r===void 0&&(r=0);for(var i=xb(t);e&&r=0?[]:{}}}return(s===0?e:i)[c[s]]===n?e:(n===void 0?delete i[c[s]]:i[c[s]]=n,s===0&&n===void 0&&delete r[c[s]],r)}function bb(e,t,n,r){n===void 0&&(n=new WeakMap),r===void 0&&(r={});for(var i=0,s=Object.keys(e);i0?de.map(function(Ee){return z(Ee,rn(N,Ee))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(xe).then(function(Ee){return Ee.reduce(function(q,le,Fe){return le==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||le&&(q=br(q,de[Fe],le)),q},{})})},[z]),F=x.useCallback(function(N){return Promise.all([V(N),y.validationSchema?_(N):{},y.validate?D(N):{}]).then(function(de){var xe=de[0],Ee=de[1],q=de[2],le=$f.all([xe,Ee,q],{arrayMerge:XN});return le})},[y.validate,y.validationSchema,V,D,_]),L=Hn(function(N){return N===void 0&&(N=I.values),T({type:"SET_ISVALIDATING",payload:!0}),F(N).then(function(de){return j.current&&(T({type:"SET_ISVALIDATING",payload:!1}),T({type:"SET_ERRORS",payload:de})),de})});x.useEffect(function(){c&&j.current===!0&&ri(S.current,y.initialValues)&&L(S.current)},[c,L]);var Q=x.useCallback(function(N){var de=N&&N.values?N.values:S.current,xe=N&&N.errors?N.errors:C.current?C.current:y.initialErrors||{},Ee=N&&N.touched?N.touched:w.current?w.current:y.initialTouched||{},q=N&&N.status?N.status:k.current?k.current:y.initialStatus;S.current=de,C.current=xe,w.current=Ee,k.current=q;var le=function(){T({type:"RESET_FORM",payload:{isSubmitting:!!N&&!!N.isSubmitting,errors:xe,touched:Ee,status:q,values:de,isValidating:!!N&&!!N.isValidating,submitCount:N&&N.submitCount&&typeof N.submitCount=="number"?N.submitCount:0}})};if(y.onReset){var Fe=y.onReset(I.values,ve);Gd(Fe)?Fe.then(le):le()}else le()},[y.initialErrors,y.initialStatus,y.initialTouched]);x.useEffect(function(){j.current===!0&&!ri(S.current,y.initialValues)&&(h&&(S.current=y.initialValues,Q()),c&&L(S.current))},[h,y.initialValues,Q,c,L]),x.useEffect(function(){h&&j.current===!0&&!ri(C.current,y.initialErrors)&&(C.current=y.initialErrors||Oi,T({type:"SET_ERRORS",payload:y.initialErrors||Oi}))},[h,y.initialErrors]),x.useEffect(function(){h&&j.current===!0&&!ri(w.current,y.initialTouched)&&(w.current=y.initialTouched||Fl,T({type:"SET_TOUCHED",payload:y.initialTouched||Fl}))},[h,y.initialTouched]),x.useEffect(function(){h&&j.current===!0&&!ri(k.current,y.initialStatus)&&(k.current=y.initialStatus,T({type:"SET_STATUS",payload:y.initialStatus}))},[h,y.initialStatus,y.initialTouched]);var $=Hn(function(N){if(M.current[N]&&kn(M.current[N].validate)){var de=rn(I.values,N),xe=M.current[N].validate(de);return Gd(xe)?(T({type:"SET_ISVALIDATING",payload:!0}),xe.then(function(Ee){return Ee}).then(function(Ee){T({type:"SET_FIELD_ERROR",payload:{field:N,value:Ee}}),T({type:"SET_ISVALIDATING",payload:!1})})):(T({type:"SET_FIELD_ERROR",payload:{field:N,value:xe}}),Promise.resolve(xe))}else if(y.validationSchema)return T({type:"SET_ISVALIDATING",payload:!0}),_(I.values,N).then(function(Ee){return Ee}).then(function(Ee){T({type:"SET_FIELD_ERROR",payload:{field:N,value:Ee[N]}}),T({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),Z=x.useCallback(function(N,de){var xe=de.validate;M.current[N]={validate:xe}},[]),te=x.useCallback(function(N){delete M.current[N]},[]),ie=Hn(function(N,de){T({type:"SET_TOUCHED",payload:N});var xe=de===void 0?i:de;return xe?L(I.values):Promise.resolve()}),U=x.useCallback(function(N){T({type:"SET_ERRORS",payload:N})},[]),K=Hn(function(N,de){var xe=kn(N)?N(I.values):N;T({type:"SET_VALUES",payload:xe});var Ee=de===void 0?n:de;return Ee?L(xe):Promise.resolve()}),ne=x.useCallback(function(N,de){T({type:"SET_FIELD_ERROR",payload:{field:N,value:de}})},[]),ce=Hn(function(N,de,xe){T({type:"SET_FIELD_VALUE",payload:{field:N,value:de}});var Ee=xe===void 0?n:xe;return Ee?L(br(I.values,N,de)):Promise.resolve()}),Re=x.useCallback(function(N,de){var xe=de,Ee=N,q;if(!$d(N)){N.persist&&N.persist();var le=N.target?N.target:N.currentTarget,Fe=le.type,Ze=le.name,J=le.id,He=le.value,nt=le.checked,Ft=le.outerHTML,pe=le.options,De=le.multiple;xe=de||Ze||J,Ee=/number|range/.test(Fe)?(q=parseFloat(He),isNaN(q)?"":q):/checkbox/.test(Fe)?QN(rn(I.values,xe),nt,He):pe&&De?KN(pe):He}xe&&ce(xe,Ee)},[ce,I.values]),ze=Hn(function(N){if($d(N))return function(de){return Re(de,N)};Re(N)}),Me=Hn(function(N,de,xe){de===void 0&&(de=!0),T({type:"SET_FIELD_TOUCHED",payload:{field:N,value:de}});var Ee=xe===void 0?i:xe;return Ee?L(I.values):Promise.resolve()}),oe=x.useCallback(function(N,de){N.persist&&N.persist();var xe=N.target,Ee=xe.name,q=xe.id,le=xe.outerHTML,Fe=de||Ee||q;Me(Fe,!0)},[Me]),ae=Hn(function(N){if($d(N))return function(de){return oe(de,N)};oe(N)}),je=x.useCallback(function(N){kn(N)?T({type:"SET_FORMIK_STATE",payload:N}):T({type:"SET_FORMIK_STATE",payload:function(){return N}})},[]),Be=x.useCallback(function(N){T({type:"SET_STATUS",payload:N})},[]),Ne=x.useCallback(function(N){T({type:"SET_ISSUBMITTING",payload:N})},[]),Ge=Hn(function(){return T({type:"SUBMIT_ATTEMPT"}),L().then(function(N){var de=N instanceof Error,xe=!de&&Object.keys(N).length===0;if(xe){var Ee;try{if(Ee=_e(),Ee===void 0)return}catch(q){throw q}return Promise.resolve(Ee).then(function(q){return j.current&&T({type:"SUBMIT_SUCCESS"}),q}).catch(function(q){if(j.current)throw T({type:"SUBMIT_FAILURE"}),q})}else if(j.current&&(T({type:"SUBMIT_FAILURE"}),de))throw N})}),Qe=Hn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),Ge().catch(function(de){console.warn("Warning: An unhandled error was caught from submitForm()",de)})}),ve={resetForm:Q,validateForm:L,validateField:$,setErrors:U,setFieldError:ne,setFieldTouched:Me,setFieldValue:ce,setStatus:Be,setSubmitting:Ne,setTouched:ie,setValues:K,setFormikState:je,submitForm:Ge},_e=Hn(function(){return p(I.values,ve)}),qe=Hn(function(N){N&&N.preventDefault&&kn(N.preventDefault)&&N.preventDefault(),N&&N.stopPropagation&&kn(N.stopPropagation)&&N.stopPropagation(),Q()}),ge=x.useCallback(function(N){return{value:rn(I.values,N),error:rn(I.errors,N),touched:!!rn(I.touched,N),initialValue:rn(S.current,N),initialTouched:!!rn(w.current,N),initialError:rn(C.current,N)}},[I.errors,I.touched,I.values]),Te=x.useCallback(function(N){return{setValue:function(xe,Ee){return ce(N,xe,Ee)},setTouched:function(xe,Ee){return Me(N,xe,Ee)},setError:function(xe){return ne(N,xe)}}},[ce,Me,ne]),et=x.useCallback(function(N){var de=Yc(N),xe=de?N.name:N,Ee=rn(I.values,xe),q={name:xe,value:Ee,onChange:ze,onBlur:ae};if(de){var le=N.type,Fe=N.value,Ze=N.as,J=N.multiple;le==="checkbox"?Fe===void 0?q.checked=!!Ee:(q.checked=!!(Array.isArray(Ee)&&~Ee.indexOf(Fe)),q.value=Fe):le==="radio"?(q.checked=Ee===Fe,q.value=Fe):Ze==="select"&&J&&(q.value=q.value||[],q.multiple=!0)}return q},[ae,ze,I.values]),Ve=x.useMemo(function(){return!ri(S.current,I.values)},[S.current,I.values]),vt=x.useMemo(function(){return typeof u<"u"?Ve?I.errors&&Object.keys(I.errors).length===0:u!==!1&&kn(u)?u(y):u:I.errors&&Object.keys(I.errors).length===0},[u,Ve,I.errors,y]),Nt=ht({},I,{initialValues:S.current,initialErrors:C.current,initialTouched:w.current,initialStatus:k.current,handleBlur:ae,handleChange:ze,handleReset:qe,handleSubmit:Qe,resetForm:Q,setErrors:U,setFormikState:je,setFieldTouched:Me,setFieldValue:ce,setFieldError:ne,setStatus:Be,setSubmitting:Ne,setTouched:ie,setValues:K,submitForm:Ge,validateForm:L,validateField:$,isValid:vt,dirty:Ve,unregisterField:te,registerField:Z,getFieldProps:et,getFieldMeta:ge,getFieldHelpers:Te,validateOnBlur:i,validateOnChange:n,validateOnMount:c});return Nt}function ws(e){var t=GN(e),n=e.component,r=e.children,i=e.render,s=e.innerRef;return x.useImperativeHandle(s,function(){return t}),x.createElement(UN,{value:t},n?x.createElement(n,t):i?i(t):r?kn(r)?r(t):yb(r)?null:x.Children.only(r):null)}function qN(e){var t={};if(e.inner){if(e.inner.length===0)return br(t,e.path,e.message);for(var i=e.inner,n=Array.isArray(i),r=0,i=n?i:i[Symbol.iterator]();;){var s;if(n){if(r>=i.length)break;s=i[r++]}else{if(r=i.next(),r.done)break;s=r.value}var c=s;rn(t,c.path)||(t=br(t,c.path,c.message))}}return t}function YN(e,t,n,r){n===void 0&&(n=!1),r===void 0&&(r={});var i=Kf(e);return t[n?"validateSync":"validate"](i,{abortEarly:!1,context:r})}function Kf(e){var t=Array.isArray(e)?[]:{};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=String(n);Array.isArray(e[r])===!0?t[r]=e[r].map(function(i){return Array.isArray(i)===!0||G0(i)?Kf(i):i!==""?i:void 0}):G0(e[r])?t[r]=Kf(e[r]):t[r]=e[r]!==""?e[r]:void 0}return t}function XN(e,t,n){var r=e.slice();return t.forEach(function(s,c){if(typeof r[c]>"u"){var u=n.clone!==!1,f=u&&n.isMergeableObject(s);r[c]=f?$f(Array.isArray(s)?[]:{},s,n):s}else n.isMergeableObject(s)?r[c]=$f(e[c],s,n):e.indexOf(s)===-1&&r.push(s)}),r}function KN(e){return Array.from(e).filter(function(t){return t.selected}).map(function(t){return t.value})}function QN(e,t,n){if(typeof e=="boolean")return Boolean(t);var r=[],i=!1,s=-1;if(Array.isArray(e))r=e,s=e.indexOf(n),i=s>=0;else if(!n||n=="true"||n=="false")return Boolean(t);return t&&n&&!i?r.concat(n):i?r.slice(0,s).concat(r.slice(s+1)):r}var ZN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?x.useLayoutEffect:x.useEffect;function Hn(e){var t=x.useRef(e);return ZN(function(){t.current=e}),x.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;ir?i:r},0);return Array.from(ht({},t,{length:n+1}))}else return[]},rF=function(e){WN(t,e);function t(r){var i;return i=e.call(this,r)||this,i.updateArrayField=function(s,c,u){var f=i.props,h=f.name,p=f.formik.setFormikState;p(function(g){var y=typeof u=="function"?u:s,S=typeof c=="function"?c:s,C=br(g.values,h,s(rn(g.values,h))),w=u?y(rn(g.errors,h)):void 0,k=c?S(rn(g.touched,h)):void 0;return x1(w)&&(w=void 0),x1(k)&&(k=void 0),ht({},g,{values:C,errors:u?br(g.errors,h,w):g.errors,touched:c?br(g.touched,h,k):g.touched})})},i.push=function(s){return i.updateArrayField(function(c){return[].concat(ra(c),[HN(s)])},!1,!1)},i.handlePush=function(s){return function(){return i.push(s)}},i.swap=function(s,c){return i.updateArrayField(function(u){return tF(u,s,c)},!0,!0)},i.handleSwap=function(s,c){return function(){return i.swap(s,c)}},i.move=function(s,c){return i.updateArrayField(function(u){return eF(u,s,c)},!0,!0)},i.handleMove=function(s,c){return function(){return i.move(s,c)}},i.insert=function(s,c){return i.updateArrayField(function(u){return qd(u,s,c)},function(u){return qd(u,s,null)},function(u){return qd(u,s,null)})},i.handleInsert=function(s,c){return function(){return i.insert(s,c)}},i.replace=function(s,c){return i.updateArrayField(function(u){return nF(u,s,c)},!1,!1)},i.handleReplace=function(s,c){return function(){return i.replace(s,c)}},i.unshift=function(s){var c=-1;return i.updateArrayField(function(u){var f=u?[s].concat(u):[s];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f},function(u){var f=u?[null].concat(u):[null];return c<0&&(c=f.length),f}),c},i.handleUnshift=function(s){return function(){return i.unshift(s)}},i.handleRemove=function(s){return function(){return i.remove(s)}},i.handlePop=function(){return function(){return i.pop()}},i.remove=i.remove.bind(g1(i)),i.pop=i.pop.bind(g1(i)),i}var n=t.prototype;return n.componentDidUpdate=function(i){this.props.validateOnChange&&this.props.formik.validateOnChange&&!ri(rn(i.formik.values,i.name),rn(this.props.formik.values,this.props.name))&&this.props.formik.validateForm(this.props.formik.values)},n.remove=function(i){var s;return this.updateArrayField(function(c){var u=c?ra(c):[];return s||(s=u[i]),kn(u.splice)&&u.splice(i,1),u},!0,!0),s},n.pop=function(){var i;return this.updateArrayField(function(s){var c=s;return i||(i=c&&c.pop&&c.pop()),c},!0,!0),i},n.render=function(){var i={push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},s=this.props,c=s.component,u=s.render,f=s.children,h=s.name,p=s.formik,g=Li(p,["validate","validationSchema"]),y=ht({},i,{form:g,name:h});return c?x.createElement(c,y):u?u(y):f?typeof f=="function"?f(y):yb(f)?null:x.Children.only(f):null},t}(x.Component);rF.defaultProps={validateOnChange:!0};function iF(e){const{model:t}=e,r=O(C=>C.system.model_list)[t],i=X(),{t:s}=Y(),c=O(C=>C.system.isProcessing),u=O(C=>C.system.isConnected),[f,h]=x.useState("same"),[p,g]=x.useState("");x.useEffect(()=>{h("same")},[t]);const y=()=>{h("same")},S=()=>{i(i3({model_name:t,save_location:f,custom_location:f==="custom"&&p!==""?p:null}))};return l.jsxs(Wc,{title:`${s("modelManager.convert")} ${t}`,acceptCallback:S,cancelCallback:y,acceptButtonText:`${s("modelManager.convert")}`,triggerComponent:l.jsxs(Je,{size:"sm","aria-label":s("modelManager.convertToDiffusers"),isDisabled:r.status==="active"||c||!u,className:" modal-close-btn",marginInlineEnd:8,children:["🧨 ",s("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[l.jsxs(B,{flexDirection:"column",rowGap:4,children:[l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText1")}),l.jsxs(gx,{children:[l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText2")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText3")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText4")}),l.jsx(Fa,{children:s("modelManager.convertToDiffusersHelpText5")})]}),l.jsx(Ce,{children:s("modelManager.convertToDiffusersHelpText6")})]}),l.jsxs(B,{flexDir:"column",gap:4,children:[l.jsxs(B,{marginTop:4,flexDir:"column",gap:2,children:[l.jsx(Ce,{fontWeight:"600",children:s("modelManager.convertToDiffusersSaveLocation")}),l.jsx(Ja,{value:f,onChange:C=>h(C),children:l.jsxs(B,{gap:4,children:[l.jsx(vn,{value:"same",children:l.jsx(Yt,{label:"Save converted model in the same folder",children:s("modelManager.sameFolder")})}),l.jsx(vn,{value:"root",children:l.jsx(Yt,{label:"Save converted model in the InvokeAI root folder",children:s("modelManager.invokeRoot")})}),l.jsx(vn,{value:"custom",children:l.jsx(Yt,{label:"Save converted model in a custom folder",children:s("modelManager.custom")})})]})})]}),f==="custom"&&l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.customSaveLocation")}),l.jsx(mt,{value:p,onChange:C=>{C.target.value!==""&&g(C.target.value)},width:"full"})]})]})]})}const oF=be([Pt],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),y1=64,b1=2048;function aF(){const{openModel:e,model_list:t}=O(oF),n=O(f=>f.system.isProcessing),r=X(),{t:i}=Y(),[s,c]=x.useState({name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,default:!1,format:"ckpt"});x.useEffect(()=>{var f,h,p,g,y,S,C;if(e){const w=ee.pickBy(t,(k,j)=>ee.isEqual(j,e));c({name:e,description:(f=w[e])==null?void 0:f.description,config:(h=w[e])==null?void 0:h.config,weights:(p=w[e])==null?void 0:p.weights,vae:(g=w[e])==null?void 0:g.vae,width:(y=w[e])==null?void 0:y.width,height:(S=w[e])==null?void 0:S.height,default:(C=w[e])==null?void 0:C.default,format:"ckpt"})}},[t,e]);const u=f=>{r(ls({...f,width:Number(f.width),height:Number(f.height)}))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsxs(B,{alignItems:"center",gap:4,justifyContent:"space-between",children:[l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e}),l.jsx(iF,{model:e})]}),l.jsx(B,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(ws,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:p})=>l.jsx("form",{onSubmit:f,children:l.jsxs(Le,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:i("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&p.description?l.jsx(kt,{children:h.description}):l.jsx(wt,{margin:0,children:i("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.config&&p.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:i("modelManager.config")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"full"}),h.config&&p.config?l.jsx(kt,{children:h.config}):l.jsx(wt,{margin:0,children:i("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.weights&&p.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:i("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"full"}),h.weights&&p.weights?l.jsx(kt,{children:h.weights}):l.jsx(wt,{margin:0,children:i("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.vae&&p.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:i("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"full"}),h.vae&&p.vae?l.jsx(kt,{children:h.vae}):l.jsx(wt,{margin:0,children:i("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(sa,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!h.width&&p.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:i("modelManager.width")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:g,form:y})=>l.jsx(Lr,{id:"width",name:"width",min:y1,max:b1,step:64,value:y.values.width,onChange:S=>y.setFieldValue(g.name,Number(S))})}),h.width&&p.width?l.jsx(kt,{children:h.width}):l.jsx(wt,{margin:0,children:i("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.height&&p.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:i("modelManager.height")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:g,form:y})=>l.jsx(Lr,{id:"height",name:"height",min:y1,max:b1,step:64,value:y.values.height,onChange:S=>y.setFieldValue(g.name,Number(S))})}),h.height&&p.height?l.jsx(kt,{children:h.height}):l.jsx(wt,{margin:0,children:i("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:i("modelManager.updateModel")})]})})})})]}):l.jsx(B,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:500,children:"Pick A Model To Edit"})})}const sF=be([Pt],e=>{const{openModel:t,model_list:n}=e;return{model_list:n,openModel:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function lF(){const{openModel:e,model_list:t}=O(sF),n=O(f=>f.system.isProcessing),r=X(),{t:i}=Y(),[s,c]=x.useState({name:"",description:"",repo_id:"",path:"",vae:{repo_id:"",path:""},default:!1,format:"diffusers"});x.useEffect(()=>{var f,h,p,g,y,S,C,w,k,j,M,P,I,T,D,_;if(e){const z=ee.pickBy(t,(V,F)=>ee.isEqual(F,e));c({name:e,description:(f=z[e])==null?void 0:f.description,path:(h=z[e])!=null&&h.path&&((p=z[e])==null?void 0:p.path)!=="None"?(g=z[e])==null?void 0:g.path:"",repo_id:(y=z[e])!=null&&y.repo_id&&((S=z[e])==null?void 0:S.repo_id)!=="None"?(C=z[e])==null?void 0:C.repo_id:"",vae:{repo_id:(k=(w=z[e])==null?void 0:w.vae)!=null&&k.repo_id?(M=(j=z[e])==null?void 0:j.vae)==null?void 0:M.repo_id:"",path:(I=(P=z[e])==null?void 0:P.vae)!=null&&I.path?(D=(T=z[e])==null?void 0:T.vae)==null?void 0:D.path:""},default:(_=z[e])==null?void 0:_.default,format:"diffusers"})}},[t,e]);const u=f=>{const h=f;f.path===""&&delete h.path,f.repo_id===""&&delete h.repo_id,f.vae.path===""&&delete h.vae.path,f.vae.repo_id===""&&delete h.vae.repo_id,r(ls(f))};return e?l.jsxs(B,{flexDirection:"column",rowGap:4,width:"100%",children:[l.jsx(B,{alignItems:"center",children:l.jsx(Ce,{fontSize:"lg",fontWeight:"bold",children:e})}),l.jsx(B,{flexDirection:"column",overflowY:"scroll",paddingInlineEnd:8,children:l.jsx(ws,{enableReinitialize:!0,initialValues:s,onSubmit:u,children:({handleSubmit:f,errors:h,touched:p})=>{var g,y,S,C,w,k,j,M,P,I;return l.jsx("form",{onSubmit:f,children:l.jsxs(Le,{rowGap:2,alignItems:"start",children:[l.jsxs(rt,{isInvalid:!!h.description&&p.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:i("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"full"}),h.description&&p.description?l.jsx(kt,{children:h.description}):l.jsx(wt,{margin:0,children:i("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.path&&p.path,isRequired:!0,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:i("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"full"}),h.path&&p.path?l.jsx(kt,{children:h.path}):l.jsx(wt,{margin:0,children:i("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!h.repo_id&&p.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:i("modelManager.repo_id")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"full"}),h.repo_id&&p.repo_id?l.jsx(kt,{children:h.repo_id}):l.jsx(wt,{margin:0,children:i("modelManager.repoIDValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((g=h.vae)!=null&&g.path)&&((y=p.vae)==null?void 0:y.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:i("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"full"}),(S=h.vae)!=null&&S.path&&((C=p.vae)!=null&&C.path)?l.jsx(kt,{children:(w=h.vae)==null?void 0:w.path}):l.jsx(wt,{margin:0,children:i("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((k=h.vae)!=null&&k.repo_id)&&((j=p.vae)==null?void 0:j.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:i("modelManager.vaeRepoID")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"full"}),(M=h.vae)!=null&&M.repo_id&&((P=p.vae)!=null&&P.repo_id)?l.jsx(kt,{children:(I=h.vae)==null?void 0:I.repo_id}):l.jsx(wt,{margin:0,children:i("modelManager.vaeRepoIDValidationMsg")})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:i("modelManager.updateModel")})]})})}})})]}):l.jsx(B,{sx:{width:"100%",justifyContent:"center",alignItems:"center",borderRadius:"base",bg:"base.900"},children:l.jsx(Ce,{fontWeight:"500",children:"Pick A Model To Edit"})})}const Cb=be([Pt],e=>{const{model_list:t}=e,n=[];return ee.forEach(t,r=>{n.push(r.weights)}),n});function S1({model:e,modelsToAdd:t,setModelsToAdd:n}){const{t:r}=Y(),i=O(Cb),s=c=>{t.includes(c.target.value)?n(ee.remove(t,u=>u!==c.target.value)):n([...t,c.target.value])};return l.jsx(Le,{children:l.jsxs(B,{flexDirection:"column",gap:2,backgroundColor:t.includes(e.name)?"accent.650":"base.800",paddingX:4,paddingY:2,borderRadius:4,children:[l.jsxs(B,{gap:4,children:[l.jsx(pt,{value:e.name,label:l.jsx(Ce,{fontWeight:500,children:e.name}),isChecked:t.includes(e.name),isDisabled:i.includes(e.location),onChange:s}),i.includes(e.location)&&l.jsx(Sx,{colorScheme:"accent",children:r("modelManager.modelExists")})]}),l.jsx(Ce,{fontStyle:"italic",variant:"subtext",children:e.location})]})})}function cF(){const e=X(),{t}=Y(),n=O(P=>P.system.searchFolder),r=O(P=>P.system.foundModels),i=O(Cb),s=O(P=>P.ui.shouldShowExistingModelsInSearch),c=O(P=>P.system.isProcessing),[u,f]=ke.useState([]),[h,p]=ke.useState("v1"),[g,y]=ke.useState(""),S=()=>{e(a3(null)),e(s3(null)),f([])},C=P=>{e(Zv(P.checkpointFolder))},w=()=>{f([]),r&&r.forEach(P=>{i.includes(P.location)||f(I=>[...I,P.name])})},k=()=>{f([])},j=()=>{const P=r==null?void 0:r.filter(T=>u.includes(T.name)),I={v1:"configs/stable-diffusion/v1-inference.yaml",v2_base:"configs/stable-diffusion/v2-inference-v.yaml",v2_768:"configs/stable-diffusion/v2-inference-v.yaml",inpainting:"configs/stable-diffusion/v1-inpainting-inference.yaml",custom:g};P==null||P.forEach(T=>{const D={name:T.name,description:"",config:I[h],weights:T.location,vae:"",width:512,height:512,default:!1,format:"ckpt"};e(ls(D))}),f([])},M=()=>{const P=[],I=[];return r&&r.forEach((T,D)=>{i.includes(T.location)?I.push(l.jsx(S1,{model:T,modelsToAdd:u,setModelsToAdd:f},D)):P.push(l.jsx(S1,{model:T,modelsToAdd:u,setModelsToAdd:f},D))}),l.jsxs(l.Fragment,{children:[P,s&&I]})};return l.jsxs(l.Fragment,{children:[n?l.jsxs(B,{sx:{padding:4,gap:2,position:"relative",borderRadius:"base",alignItems:"center",w:"full",bg:"base.900"},children:[l.jsxs(B,{sx:{flexDir:"column",gap:2},children:[l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},variant:"subtext",children:t("modelManager.checkpointFolder")}),l.jsx(Ce,{sx:{fontWeight:500,fontSize:"sm"},children:n})]}),l.jsx(jc,{}),l.jsx(ue,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:l.jsx(ep,{}),fontSize:18,disabled:c,onClick:()=>e(Zv(n))}),l.jsx(ue,{"aria-label":t("modelManager.clearCheckpointFolder"),icon:l.jsx(xs,{style:{transform:"rotate(45deg)"}}),onClick:S})]}):l.jsx(ws,{initialValues:{checkpointFolder:""},onSubmit:P=>{C(P)},children:({handleSubmit:P})=>l.jsx("form",{onSubmit:P,children:l.jsxs(sa,{columnGap:2,alignItems:"flex-end",width:"100%",children:[l.jsx(rt,{isRequired:!0,width:"lg",children:l.jsx(jt,{as:mt,id:"checkpointFolder",name:"checkpointFolder",type:"text",size:"md",label:t("modelManager.checkpointFolder")})}),l.jsx(Je,{leftIcon:l.jsx(X8,{}),"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),type:"submit",disabled:c,paddingX:10,children:t("modelManager.findModels")})]})})}),r&&l.jsxs(B,{flexDirection:"column",rowGap:4,width:"full",children:[l.jsxs(B,{justifyContent:"space-between",alignItems:"center",children:[l.jsxs("p",{children:[t("modelManager.modelsFound"),": ",r.length]}),l.jsxs("p",{children:[t("modelManager.selected"),": ",u.length]})]}),l.jsxs(B,{columnGap:2,justifyContent:"space-between",children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Je,{isDisabled:u.length===r.length,onClick:w,children:t("modelManager.selectAll")}),l.jsx(Je,{isDisabled:u.length===0,onClick:k,children:t("modelManager.deselectAll")}),l.jsx(pt,{label:t("modelManager.showExisting"),isChecked:s,onChange:()=>e(o3(!s))})]}),l.jsx(Je,{isDisabled:u.length===0,onClick:j,colorScheme:"accent",children:t("modelManager.addSelected")})]}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:[l.jsxs(B,{gap:4,children:[l.jsx(Ce,{fontWeight:500,variant:"subtext",children:t("modelManager.pickModelType")}),l.jsx(Ja,{value:h,onChange:P=>p(P),defaultValue:"v1",name:"model_type",children:l.jsxs(B,{gap:4,children:[l.jsx(vn,{value:"v1",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v1")})}),l.jsx(vn,{value:"v2_base",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_base")})}),l.jsx(vn,{value:"v2_768",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.v2_768")})}),l.jsx(vn,{value:"inpainting",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.inpainting")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:t("modelManager.customConfig")})})]})})]}),h==="custom"&&l.jsxs(B,{flexDirection:"column",rowGap:2,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:t("modelManager.pathToCustomConfig")}),l.jsx(mt,{value:g,onChange:P=>{P.target.value!==""&&y(P.target.value)},width:"full"})]})]}),l.jsx(B,{flexDirection:"column",maxHeight:72,overflowY:"scroll",borderRadius:"sm",paddingInlineEnd:4,gap:2,children:r.length>0?M():l.jsx(Ce,{fontWeight:"500",padding:2,borderRadius:"sm",textAlign:"center",variant:"subtext",children:t("modelManager.noModelsFound")})})]})]})}const C1=64,w1=2048;function uF(){const e=X(),{t}=Y(),n=O(h=>h.system.isProcessing);function r(h){return/\s/.test(h)}function i(h){let p;return r(h)&&(p=t("modelManager.cannotUseSpaces")),p}const s={name:"",description:"",config:"configs/stable-diffusion/v1-inference.yaml",weights:"",vae:"",width:512,height:512,format:"ckpt",default:!1},c=h=>{e(ls(h)),e(Wi(null))},[u,f]=ke.useState(!1);return l.jsxs(Le,{gap:2,alignItems:"flex-start",children:[l.jsx(ue,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wi(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(Cy,{})}),l.jsx(cF,{}),l.jsx(pt,{label:t("modelManager.addManually"),isChecked:u,onChange:()=>f(!u)}),u&&l.jsx(ws,{initialValues:s,onSubmit:c,children:({handleSubmit:h,errors:p,touched:g})=>l.jsx("form",{onSubmit:h,children:l.jsxs(Le,{rowGap:2,children:[l.jsx(Ce,{fontSize:20,fontWeight:"bold",alignSelf:"start",children:t("modelManager.manual")}),l.jsxs(rt,{isInvalid:!!p.name&&g.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:i,width:"2xl"}),p.name&&g.name?l.jsx(kt,{children:p.name}):l.jsx(wt,{margin:0,children:t("modelManager.nameValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.description&&g.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"2xl"}),p.description&&g.description?l.jsx(kt,{children:p.description}):l.jsx(wt,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.config&&g.config,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.config")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"config",name:"config",type:"text",width:"2xl"}),p.config&&g.config?l.jsx(kt,{children:p.config}):l.jsx(wt,{margin:0,children:t("modelManager.configValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.weights&&g.weights,isRequired:!0,children:[l.jsx(st,{htmlFor:"config",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"weights",name:"weights",type:"text",width:"2xl"}),p.weights&&g.weights?l.jsx(kt,{children:p.weights}):l.jsx(wt,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.vae&&g.vae,children:[l.jsx(st,{htmlFor:"vae",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae",name:"vae",type:"text",width:"2xl"}),p.vae&&g.vae?l.jsx(kt,{children:p.vae}):l.jsx(wt,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(sa,{width:"100%",children:[l.jsxs(rt,{isInvalid:!!p.width&&g.width,children:[l.jsx(st,{htmlFor:"width",fontSize:"sm",children:t("modelManager.width")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"width",name:"width",children:({field:y,form:S})=>l.jsx(Lr,{id:"width",name:"width",min:C1,max:w1,step:64,width:"90%",value:S.values.width,onChange:C=>S.setFieldValue(y.name,Number(C))})}),p.width&&g.width?l.jsx(kt,{children:p.width}):l.jsx(wt,{margin:0,children:t("modelManager.widthValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!p.height&&g.height,children:[l.jsx(st,{htmlFor:"height",fontSize:"sm",children:t("modelManager.height")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{id:"height",name:"height",children:({field:y,form:S})=>l.jsx(Lr,{id:"height",name:"height",min:C1,max:w1,width:"90%",step:64,value:S.values.height,onChange:C=>S.setFieldValue(y.name,Number(C))})}),p.height&&g.height?l.jsx(kt,{children:p.height}):l.jsx(wt,{margin:0,children:t("modelManager.heightValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",className:"modal-close-btn",isLoading:n,children:t("modelManager.addModel")})]})})})]})}function Ll({children:e}){return l.jsx(B,{sx:{flexDirection:"column",padding:4,rowGap:4,borderRadius:"base",width:"full",bg:"base.900"},children:e})}function dF(){const e=X(),{t}=Y(),n=O(u=>u.system.isProcessing);function r(u){return/\s/.test(u)}function i(u){let f;return r(u)&&(f=t("modelManager.cannotUseSpaces")),f}const s={name:"",description:"",repo_id:"",path:"",format:"diffusers",default:!1,vae:{repo_id:"",path:""}},c=u=>{const f=u;u.path===""&&delete f.path,u.repo_id===""&&delete f.repo_id,u.vae.path===""&&delete f.vae.path,u.vae.repo_id===""&&delete f.vae.repo_id,e(ls(f)),e(Wi(null))};return l.jsxs(B,{children:[l.jsx(ue,{"aria-label":t("common.back"),tooltip:t("common.back"),onClick:()=>e(Wi(null)),width:"max-content",position:"absolute",zIndex:1,size:"sm",insetInlineEnd:12,top:3,icon:l.jsx(Cy,{})}),l.jsx(ws,{initialValues:s,onSubmit:c,children:({handleSubmit:u,errors:f,touched:h})=>{var p,g,y,S,C,w,k,j,M,P;return l.jsx("form",{onSubmit:u,children:l.jsxs(Le,{rowGap:2,children:[l.jsx(Ll,{children:l.jsxs(rt,{isInvalid:!!f.name&&h.name,isRequired:!0,children:[l.jsx(st,{htmlFor:"name",fontSize:"sm",children:t("modelManager.name")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"name",name:"name",type:"text",validate:i,width:"2xl",isRequired:!0}),f.name&&h.name?l.jsx(kt,{children:f.name}):l.jsx(wt,{margin:0,children:t("modelManager.nameValidationMsg")})]})]})}),l.jsx(Ll,{children:l.jsxs(rt,{isInvalid:!!f.description&&h.description,isRequired:!0,children:[l.jsx(st,{htmlFor:"description",fontSize:"sm",children:t("modelManager.description")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"description",name:"description",type:"text",width:"2xl",isRequired:!0}),f.description&&h.description?l.jsx(kt,{children:f.description}):l.jsx(wt,{margin:0,children:t("modelManager.descriptionValidationMsg")})]})]})}),l.jsxs(Ll,{children:[l.jsx(Ce,{fontWeight:"bold",fontSize:"sm",children:t("modelManager.formMessageDiffusersModelLocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersModelLocationDesc")}),l.jsxs(rt,{isInvalid:!!f.path&&h.path,children:[l.jsx(st,{htmlFor:"path",fontSize:"sm",children:t("modelManager.modelLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"path",name:"path",type:"text",width:"2xl"}),f.path&&h.path?l.jsx(kt,{children:f.path}):l.jsx(wt,{margin:0,children:t("modelManager.modelLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!f.repo_id&&h.repo_id,children:[l.jsx(st,{htmlFor:"repo_id",fontSize:"sm",children:t("modelManager.repo_id")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"repo_id",name:"repo_id",type:"text",width:"2xl"}),f.repo_id&&h.repo_id?l.jsx(kt,{children:f.repo_id}):l.jsx(wt,{margin:0,children:t("modelManager.repoIDValidationMsg")})]})]})]}),l.jsxs(Ll,{children:[l.jsx(Ce,{fontWeight:"bold",children:t("modelManager.formMessageDiffusersVAELocation")}),l.jsx(Ce,{sx:{fontSize:"sm",fontStyle:"italic"},variant:"subtext",children:t("modelManager.formMessageDiffusersVAELocationDesc")}),l.jsxs(rt,{isInvalid:!!((p=f.vae)!=null&&p.path)&&((g=h.vae)==null?void 0:g.path),children:[l.jsx(st,{htmlFor:"vae.path",fontSize:"sm",children:t("modelManager.vaeLocation")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.path",name:"vae.path",type:"text",width:"2xl"}),(y=f.vae)!=null&&y.path&&((S=h.vae)!=null&&S.path)?l.jsx(kt,{children:(C=f.vae)==null?void 0:C.path}):l.jsx(wt,{margin:0,children:t("modelManager.vaeLocationValidationMsg")})]})]}),l.jsxs(rt,{isInvalid:!!((w=f.vae)!=null&&w.repo_id)&&((k=h.vae)==null?void 0:k.repo_id),children:[l.jsx(st,{htmlFor:"vae.repo_id",fontSize:"sm",children:t("modelManager.vaeRepoID")}),l.jsxs(Le,{alignItems:"start",children:[l.jsx(jt,{as:mt,id:"vae.repo_id",name:"vae.repo_id",type:"text",width:"2xl"}),(j=f.vae)!=null&&j.repo_id&&((M=h.vae)!=null&&M.repo_id)?l.jsx(kt,{children:(P=f.vae)==null?void 0:P.repo_id}):l.jsx(wt,{margin:0,children:t("modelManager.vaeRepoIDValidationMsg")})]})]})]}),l.jsx(Je,{type:"submit",isLoading:n,children:t("modelManager.addModel")})]})})}})]})}function k1({text:e,onClick:t}){return l.jsx(B,{position:"relative",width:"50%",height:40,justifyContent:"center",alignItems:"center",onClick:t,as:to,children:l.jsx(Ce,{fontWeight:"bold",children:e})})}function fF(){const{isOpen:e,onOpen:t,onClose:n}=ui(),r=O(u=>u.ui.addNewModelUIOption),i=X(),{t:s}=Y(),c=()=>{n(),i(Wi(null))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{"aria-label":s("modelManager.addNewModel"),tooltip:s("modelManager.addNewModel"),onClick:t,size:"sm",children:l.jsxs(B,{columnGap:2,alignItems:"center",children:[l.jsx(xs,{}),s("modelManager.addNew")]})}),l.jsxs(di,{isOpen:e,onClose:c,size:"3xl",closeOnOverlayClick:!1,children:[l.jsx(Nr,{}),l.jsxs(fi,{margin:"auto",paddingInlineEnd:4,children:[l.jsx(Rr,{children:s("modelManager.addNewModel")}),l.jsx(ca,{}),l.jsxs(Fr,{children:[r==null&&l.jsxs(B,{columnGap:4,children:[l.jsx(k1,{text:s("modelManager.addCheckpointModel"),onClick:()=>i(Wi("ckpt"))}),l.jsx(k1,{text:s("modelManager.addDiffuserModel"),onClick:()=>i(Wi("diffusers"))})]}),r=="ckpt"&&l.jsx(uF,{}),r=="diffusers"&&l.jsx(dF,{})]}),l.jsx(zr,{})]})]})]})}function Bl(e){const{isProcessing:t,isConnected:n}=O(S=>S.system),r=O(S=>S.system.openModel),{t:i}=Y(),s=X(),{name:c,status:u,description:f}=e,h=()=>{s(h2(c))},p=()=>{s(Jv(c))},g=()=>{s(l3(c)),s(Jv(null))},y=()=>{switch(u){case"active":return"ok.500";case"cached":return"warning.500";case"not loaded":return"inherit"}};return l.jsxs(B,{alignItems:"center",p:2,borderRadius:"base",sx:c===r?{bg:"accent.750",_hover:{bg:"accent.750"}}:{_hover:{bg:"base.750"}},children:[l.jsx(We,{onClick:p,cursor:"pointer",children:l.jsx(Yt,{label:f,hasArrow:!0,placement:"bottom",children:l.jsx(Ce,{fontWeight:"600",children:c})})}),l.jsx(jc,{onClick:p,cursor:"pointer"}),l.jsxs(B,{gap:2,alignItems:"center",children:[l.jsx(Ce,{color:y(),children:u}),l.jsx(to,{size:"sm",onClick:h,isDisabled:u==="active"||t||!n,children:i("modelManager.load")}),l.jsx(ue,{icon:l.jsx(B9,{}),size:"sm",onClick:p,"aria-label":i("accessibility.modifyConfig"),isDisabled:u==="active"||t||!n}),l.jsx(Wc,{title:i("modelManager.deleteModel"),acceptCallback:g,acceptButtonText:i("modelManager.delete"),triggerComponent:l.jsx(ue,{icon:l.jsx(H9,{}),size:"sm","aria-label":i("modelManager.deleteConfig"),isDisabled:u==="active"||t||!n,colorScheme:"error"}),children:l.jsxs(B,{rowGap:4,flexDirection:"column",children:[l.jsx("p",{style:{fontWeight:"bold"},children:i("modelManager.deleteMsg1")}),l.jsx("p",{children:i("modelManager.deleteMsg2")})]})})]})]})}function hF(){const e=X(),{isOpen:t,onOpen:n,onClose:r}=ui(),i=O(c8),{t:s}=Y(),[c,u]=x.useState(Object.keys(i)[0]),[f,h]=x.useState(Object.keys(i)[1]),[p,g]=x.useState("none"),[y,S]=x.useState(""),[C,w]=x.useState(.5),[k,j]=x.useState("weighted_sum"),[M,P]=x.useState("root"),[I,T]=x.useState(""),[D,_]=x.useState(!1),z=Object.keys(i).filter($=>$!==f&&$!==p),V=Object.keys(i).filter($=>$!==c&&$!==p),F=[{key:s("modelManager.none"),value:"none"},...Object.keys(i).filter($=>$!==c&&$!==f).map($=>({key:$,value:$}))],L=O($=>$.system.isProcessing),Q=()=>{let $=[c,f,p];$=$.filter(te=>te!=="none");const Z={models_to_merge:$,merged_model_name:y!==""?y:$.join("-"),alpha:C,interp:k,model_merge_save_path:M==="root"?null:I,force:D};e(c3(Z))};return l.jsxs(l.Fragment,{children:[l.jsx(Je,{onClick:n,size:"sm",children:l.jsx(B,{columnGap:2,alignItems:"center",children:s("modelManager.mergeModels")})}),l.jsxs(di,{isOpen:t,onClose:r,size:"4xl",closeOnOverlayClick:!1,children:[l.jsx(Nr,{}),l.jsxs(fi,{fontFamily:"Inter",margin:"auto",paddingInlineEnd:4,children:[l.jsx(Rr,{children:s("modelManager.mergeModels")}),l.jsx(ca,{}),l.jsx(Fr,{children:l.jsxs(B,{flexDirection:"column",rowGap:4,children:[l.jsxs(B,{sx:{flexDirection:"column",marginBottom:4,padding:4,borderRadius:"base",rowGap:1,bg:"base.900"},children:[l.jsx(Ce,{children:s("modelManager.modelMergeHeaderHelp1")}),l.jsx(Ce,{fontSize:"sm",variant:"subtext",children:s("modelManager.modelMergeHeaderHelp2")})]}),l.jsxs(B,{columnGap:4,children:[l.jsx(Mn,{label:s("modelManager.modelOne"),validValues:z,onChange:$=>u($.target.value)}),l.jsx(Mn,{label:s("modelManager.modelTwo"),validValues:V,onChange:$=>h($.target.value)}),l.jsx(Mn,{label:s("modelManager.modelThree"),validValues:F,onChange:$=>{$.target.value!=="none"?(g($.target.value),j("add_difference")):(g("none"),j("weighted_sum"))}})]}),l.jsx(mt,{label:s("modelManager.mergedModelName"),value:y,onChange:$=>S($.target.value)}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(ut,{label:s("modelManager.alpha"),min:.01,max:.99,step:.01,value:C,onChange:$=>w($),withInput:!0,withReset:!0,handleReset:()=>w(.5),withSliderMarks:!0}),l.jsx(Ce,{variant:"subtext",fontSize:"sm",children:s("modelManager.modelMergeAlphaHelp")})]}),l.jsxs(B,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsx(Ce,{fontWeight:500,fontSize:"sm",variant:"subtext",children:s("modelManager.interpolationType")}),l.jsx(Ja,{value:k,onChange:$=>j($),children:l.jsx(B,{columnGap:4,children:p==="none"?l.jsxs(l.Fragment,{children:[l.jsx(vn,{value:"weighted_sum",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.weightedSum")})}),l.jsx(vn,{value:"sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.sigmoid")})}),l.jsx(vn,{value:"inv_sigmoid",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.inverseSigmoid")})})]}):l.jsx(vn,{value:"add_difference",children:l.jsx(Yt,{label:s("modelManager.modelMergeInterpAddDifferenceHelp"),children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.addDifference")})})})})})]}),l.jsxs(B,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.900"},children:[l.jsxs(B,{columnGap:4,children:[l.jsx(Ce,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:s("modelManager.mergedModelSaveLocation")}),l.jsx(Ja,{value:M,onChange:$=>P($),children:l.jsxs(B,{columnGap:4,children:[l.jsx(vn,{value:"root",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.invokeAIFolder")})}),l.jsx(vn,{value:"custom",children:l.jsx(Ce,{fontSize:"sm",children:s("modelManager.custom")})})]})})]}),M==="custom"&&l.jsx(mt,{label:s("modelManager.mergedModelCustomSaveLocation"),value:I,onChange:$=>T($.target.value)})]}),l.jsx(pt,{label:s("modelManager.ignoreMismatch"),isChecked:D,onChange:$=>_($.target.checked),fontWeight:"500"}),l.jsx(Je,{onClick:Q,isLoading:L,isDisabled:M==="custom"&&I==="",children:s("modelManager.merge")})]})}),l.jsx(zr,{})]})]})]})}const pF=be(Pt,e=>ee.map(e.model_list,(n,r)=>({name:r,...n})),{memoizeOptions:{resultEqualityCheck:ee.isEqual}});function Yd({label:e,isActive:t,onClick:n}){return l.jsx(Je,{onClick:n,isActive:t,sx:{_active:{bg:"accent.750"}},size:"sm",children:e})}const mF=()=>{const e=O(pF),[t,n]=ke.useState(!1);ke.useEffect(()=>{const y=setTimeout(()=>{n(!0)},200);return()=>clearTimeout(y)},[]);const[r,i]=x.useState(""),[s,c]=x.useState("all"),[u,f]=x.useTransition(),{t:h}=Y(),p=y=>{f(()=>{i(y.target.value)})},g=x.useMemo(()=>{const y=[],S=[],C=[],w=[];return e.forEach((k,j)=>{k.name.toLowerCase().includes(r.toLowerCase())&&(C.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j)),k.format===s&&w.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j))),k.format!=="diffusers"?y.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j)):S.push(l.jsx(Bl,{name:k.name,status:k.status,description:k.description},j))}),r!==""?s==="all"?l.jsx(We,{marginTop:4,children:C}):l.jsx(We,{marginTop:4,children:w}):l.jsxs(B,{flexDirection:"column",rowGap:6,children:[s==="all"&&l.jsxs(l.Fragment,{children:[l.jsxs(We,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,my:4,mx:0,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.checkpointModels")}),y]}),l.jsxs(We,{children:[l.jsx(Ce,{sx:{fontWeight:"500",py:2,px:4,mb:4,borderRadius:"base",width:"max-content",fontSize:"sm",bg:"base.750"},children:h("modelManager.diffusersModels")}),S]})]}),s==="ckpt"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:y}),s==="diffusers"&&l.jsx(B,{flexDirection:"column",marginTop:4,children:S})]})},[e,r,h,s]);return l.jsxs(B,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:[l.jsxs(B,{justifyContent:"space-between",alignItems:"center",gap:2,children:[l.jsx(Vn,{size:"md",children:h("modelManager.availableModels")}),l.jsx(jc,{}),l.jsx(fF,{}),l.jsx(hF,{})]}),l.jsx(mt,{onChange:p,label:h("modelManager.search")}),l.jsxs(B,{flexDirection:"column",gap:1,maxHeight:window.innerHeight-240,overflow:"scroll",paddingInlineEnd:4,children:[l.jsxs(B,{columnGap:2,children:[l.jsx(Yd,{label:h("modelManager.allModels"),onClick:()=>c("all"),isActive:s==="all"}),l.jsx(Yd,{label:h("modelManager.checkpointModels"),onClick:()=>c("ckpt"),isActive:s==="ckpt"}),l.jsx(Yd,{label:h("modelManager.diffusersModels"),onClick:()=>c("diffusers"),isActive:s==="diffusers"})]}),t?g:l.jsx(B,{width:"100%",minHeight:96,justifyContent:"center",alignItems:"center",children:l.jsx(Qf,{})})]})]})};function vF({children:e}){const{isOpen:t,onOpen:n,onClose:r}=ui(),i=O(u=>u.system.model_list),s=O(u=>u.system.openModel),{t:c}=Y();return l.jsxs(l.Fragment,{children:[x.cloneElement(e,{onClick:n}),l.jsxs(di,{isOpen:t,onClose:r,size:"full",children:[l.jsx(Nr,{}),l.jsxs(fi,{children:[l.jsx(ca,{}),l.jsx(Rr,{children:c("modelManager.modelManager")}),l.jsx(Fr,{children:l.jsxs(B,{width:"100%",columnGap:8,children:[l.jsx(mF,{}),s&&i[s].format==="diffusers"?l.jsx(lF,{}):l.jsx(aF,{})]})}),l.jsx(zr,{})]})]})]})}const gF=be([Pt],e=>{const{isProcessing:t,model_list:n}=e;return{models:ee.map(n,(i,s)=>s),isProcessing:t}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),xF=()=>{const e=X(),{t}=Y(),{models:n,isProcessing:r}=O(gF),i=O(wy),s=c=>{e(h2(c.target.value))};return l.jsx(B,{style:{paddingInlineStart:1.5},children:l.jsx(Mn,{style:{fontSize:"sm"},"aria-label":t("accessibility.modelSelect"),tooltip:i.description,isDisabled:r,value:i.name,validValues:n,onChange:s})})},yF=be([Pt,ro],(e,t)=>{const{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:i,model_list:s,saveIntermediatesInterval:c,enableImageDebugging:u}=e,{shouldUseCanvasBetaLayout:f,shouldUseSliders:h}=t;return{shouldDisplayInProgressType:n,shouldConfirmOnDelete:r,shouldDisplayGuides:i,models:ee.map(s,(p,g)=>g),saveIntermediatesInterval:c,enableImageDebugging:u,shouldUseCanvasBetaLayout:f,shouldUseSliders:h}},{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),Xd={flexDirection:"column",gap:2,p:4,bg:"base.900"},bF=({children:e})=>{const t=X(),{t:n}=Y(),r=O(P=>P.generation.steps),{isOpen:i,onOpen:s,onClose:c}=ui(),{isOpen:u,onOpen:f,onClose:h}=ui(),{shouldDisplayInProgressType:p,shouldConfirmOnDelete:g,shouldDisplayGuides:y,saveIntermediatesInterval:S,enableImageDebugging:C,shouldUseCanvasBetaLayout:w,shouldUseSliders:k}=O(yF),j=()=>{v3.purge().then(()=>{c(),f()})},M=P=>{P>r&&(P=r),P<1&&(P=1),t(g3(P))};return l.jsxs(l.Fragment,{children:[x.cloneElement(e,{onClick:s}),l.jsxs(di,{isOpen:i,onClose:c,size:"xl",children:[l.jsx(Nr,{}),l.jsxs(fi,{paddingInlineEnd:4,children:[l.jsx(Rr,{children:n("common.settingsLabel")}),l.jsx(ca,{}),l.jsx(Fr,{children:l.jsxs($n,{gap:4,children:[l.jsxs(B,{sx:Xd,children:[l.jsx(Mn,{label:n("settings.displayInProgress"),validValues:u3,value:p,onChange:P=>t(d3(P.target.value))}),p==="full-res"&&l.jsx(Lr,{label:n("settings.saveSteps"),min:1,max:r,step:1,onChange:M,value:S,width:"auto",textAlign:"center"}),l.jsx(En,{label:n("settings.confirmOnDelete"),isChecked:g,onChange:P=>t(_1(P.target.checked))}),l.jsx(En,{label:n("settings.displayHelpIcons"),isChecked:y,onChange:P=>t(f3(P.target.checked))}),l.jsx(En,{label:n("settings.useCanvasBeta"),isChecked:w,onChange:P=>t(h3(P.target.checked))}),l.jsx(En,{label:n("settings.useSlidersForAll"),isChecked:k,onChange:P=>t(p3(P.target.checked))})]}),l.jsxs(B,{sx:Xd,children:[l.jsx(Vn,{size:"sm",style:{fontWeight:"bold"},children:"Developer"}),l.jsx(En,{label:n("settings.enableImageDebugging"),isChecked:C,onChange:P=>t(m3(P.target.checked))})]}),l.jsxs(B,{sx:Xd,children:[l.jsx(Vn,{size:"sm",children:n("settings.resetWebUI")}),l.jsx(Je,{colorScheme:"error",onClick:j,children:n("settings.resetWebUI")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc1")}),l.jsx(Ce,{children:n("settings.resetWebUIDesc2")})]})]})}),l.jsx(zr,{children:l.jsx(Je,{onClick:c,children:n("common.close")})})]})]}),l.jsxs(di,{closeOnOverlayClick:!1,isOpen:u,onClose:h,isCentered:!0,children:[l.jsx(Nr,{backdropFilter:"blur(40px)"}),l.jsxs(fi,{children:[l.jsx(Rr,{}),l.jsx(Fr,{children:l.jsx(B,{justifyContent:"center",children:l.jsx(Ce,{fontSize:"lg",children:l.jsx(Ce,{children:n("settings.resetComplete")})})})}),l.jsx(zr,{})]})]})]})},SF=be(Pt,e=>({isConnected:e.isConnected,isProcessing:e.isProcessing,currentIteration:e.currentIteration,totalIterations:e.totalIterations,currentStatus:e.currentStatus,hasError:e.hasError,wasErrorSeen:e.wasErrorSeen}),{memoizeOptions:{resultEqualityCheck:ee.isEqual}}),CF=()=>{const{isConnected:e,isProcessing:t,currentIteration:n,totalIterations:r,currentStatus:i,hasError:s,wasErrorSeen:c}=O(SF),u=X(),{t:f}=Y();let h;e&&!s?h="ok":h="error";let p=i;t&&(h="working"),p&&t&&r>1&&(p=`${f(p)} (${n}/${r})`);const g=s&&!c?"Click to clear, check logs for details":void 0,y=s&&!c?"pointer":"initial",S=()=>{(s||!c)&&u(f2())};return l.jsx(Yt,{label:g,children:l.jsx(Ce,{cursor:y,onClick:S,sx:{fontSize:"xs",fontWeight:"600",color:`${h}.400`},children:f(p)})})};function wF(){const{t:e}=Y(),t=X(),n=O(c=>c.ui.currentTheme),r={dark:e("common.darkTheme"),light:e("common.lightTheme"),green:e("common.greenTheme"),ocean:e("common.oceanTheme")},i=c=>{t(x3(c))},s=()=>{const c=[];return Object.keys(r).forEach(u=>{c.push(l.jsx(Je,{sx:{width:24},isChecked:n===u,leftIcon:n===u?l.jsx(zc,{}):void 0,size:"sm",onClick:()=>i(u),children:r[u]},u))}),c};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(ue,{"aria-label":e("common.themeLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(U8,{})}),children:l.jsx(Le,{align:"stretch",children:s()})})}function kF(){const{t:e,i18n:t}=Y(),n={ar:e("common.langArabic",{lng:"ar"}),nl:e("common.langDutch",{lng:"nl"}),en:e("common.langEnglish",{lng:"en"}),fr:e("common.langFrench",{lng:"fr"}),de:e("common.langGerman",{lng:"de"}),he:e("common.langHebrew",{lng:"he"}),it:e("common.langItalian",{lng:"it"}),ja:e("common.langJapanese",{lng:"ja"}),ko:e("common.langKorean",{lng:"ko"}),pl:e("common.langPolish",{lng:"pl"}),pt_BR:e("common.langBrPortuguese",{lng:"pt_BR"}),pt:e("common.langPortuguese",{lng:"pt"}),ru:e("common.langRussian",{lng:"ru"}),zh_CN:e("common.langSimplifiedChinese",{lng:"zh_CN"}),es:e("common.langSpanish",{lng:"es"}),uk:e("common.langUkranian",{lng:"ua"})},r=()=>{const i=[];return Object.keys(n).forEach(s=>{i.push(l.jsx(Je,{isChecked:localStorage.getItem("i18nextLng")===s,leftIcon:localStorage.getItem("i18nextLng")===s?l.jsx(zc,{}):void 0,onClick:()=>t.changeLanguage(s),"aria-label":n[s],size:"sm",minWidth:"200px",children:n[s]},s))}),i};return l.jsx(rr,{trigger:"hover",triggerComponent:l.jsx(ue,{"aria-label":e("common.languagePickerLabel"),tooltip:e("common.languagePickerLabel"),icon:l.jsx(H8,{}),size:"sm",variant:"link","data-variant":"link",fontSize:26}),children:l.jsx(Le,{children:r()})})}const jF=()=>{const{t:e}=Y();return l.jsxs($n,{gridTemplateColumns:"auto max-content",children:[l.jsx(p4,{}),l.jsxs(B,{alignItems:"center",gap:2,children:[l.jsx(CF,{}),l.jsx(xF,{}),l.jsx(vF,{children:l.jsx(ue,{"aria-label":e("modelManager.modelManager"),tooltip:e("modelManager.modelManager"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(O8,{})})}),l.jsx(dO,{children:l.jsx(ue,{"aria-label":e("common.hotkeysLabel"),tooltip:e("common.hotkeysLabel"),size:"sm",variant:"link","data-variant":"link",fontSize:20,icon:l.jsx(B8,{})})}),l.jsx(wF,{}),l.jsx(kF,{}),l.jsx(ue,{"aria-label":e("common.reportBugLabel"),tooltip:e("common.reportBugLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx($i,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI/issues",children:l.jsx(D8,{})})}),l.jsx(ue,{"aria-label":e("common.githubLabel"),tooltip:e("common.githubLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx($i,{isExternal:!0,href:"http://github.com/invoke-ai/InvokeAI",children:l.jsx(j8,{})})}),l.jsx(ue,{"aria-label":e("common.discordLabel"),tooltip:e("common.discordLabel"),variant:"link","data-variant":"link",fontSize:20,size:"sm",icon:l.jsx($i,{isExternal:!0,href:"https://discord.gg/ZmtBAhwWhy",children:l.jsx(k8,{})})}),l.jsx(bF,{children:l.jsx(ue,{"aria-label":e("common.settingsLabel"),tooltip:e("common.settingsLabel"),variant:"link","data-variant":"link",fontSize:22,size:"sm",icon:l.jsx(m9,{})})})]})]})};function EF(){async function e(n=""){return await fetch(n,{method:"GET",cache:"no-cache"})}const t=()=>{const n=document.location;e(n+"/flaskwebgui-keep-server-alive").then(i=>i)};(!{}.NODE_ENV||{}.NODE_ENV==="production")&&document.addEventListener("DOMContentLoaded",()=>{t(),setInterval(t,3e3)})}const PF=()=>{const e=X(),t=O(l8),n=us();x.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(y3())},[e,n,t])},IF=()=>{const{t:e}=Y(),t=X(),{shouldShowGalleryButton:n,shouldPinGallery:r}=O(yp),i=()=>{t(Fi(!0)),r&&t(on(!0))};return n?l.jsx(ue,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":e("accessibility.showGallery"),onClick:i,sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",zIndex:31,p:0,insetInlineEnd:0,px:3,h:48,w:8,borderStartEndRadius:0,borderEndEndRadius:0},children:l.jsx(cp,{})}):null};EF();const OF=()=>(PF(),l.jsxs($n,{w:"100vw",h:"100vh",children:[l.jsxs(iO,{children:[l.jsx(cO,{}),l.jsxs($n,{gap:4,p:O9,gridAutoRows:"min-content auto",w:A9,h:z9,children:[l.jsx(jF,{}),l.jsx(cD,{})]}),l.jsx(We,{children:l.jsx(sO,{})})]}),l.jsx(uI,{}),l.jsx(IF,{})]}));export{OF as default}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-20e303dd.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-2a8c2f39.js similarity index 99% rename from invokeai/frontend/web/dist/assets/ThemeLocaleProvider-20e303dd.js rename to invokeai/frontend/web/dist/assets/ThemeLocaleProvider-2a8c2f39.js index 05dc4fc895..49ae83ef6c 100644 --- a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-20e303dd.js +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-2a8c2f39.js @@ -1,4 +1,4 @@ -import{j as y,cM as Ie,r as _,cN as bt,q as Vr,cO as o,cP as b,cQ as v,cR as S,cS as Lr,cT as ut,cU as vt,cV as ft,cW as mt,n as ht,cX as gt,E as pt}from"./index-61f10aa8.js";import{d as yt,i as St,T as xt,j as $t,s as kt,g as _t}from"./scrollbar-7e342734.js";var Or=` +import{j as y,cM as Ie,r as _,cN as bt,q as Vr,cO as o,cP as b,cQ as v,cR as S,cS as Lr,cT as ut,cU as vt,cV as ft,cW as mt,n as ht,cX as gt,E as pt}from"./index-c5a5b67c.js";import{d as yt,i as St,T as xt,j as $t,s as kt,g as _t}from"./scrollbar-af26543e.js";var Or=` :root { --chakra-vh: 100vh; } diff --git a/invokeai/frontend/web/dist/assets/index-61f10aa8.js b/invokeai/frontend/web/dist/assets/index-c5a5b67c.js similarity index 99% rename from invokeai/frontend/web/dist/assets/index-61f10aa8.js rename to invokeai/frontend/web/dist/assets/index-c5a5b67c.js index e9a5ec3fa2..ae9d1b5dd1 100644 --- a/invokeai/frontend/web/dist/assets/index-61f10aa8.js +++ b/invokeai/frontend/web/dist/assets/index-c5a5b67c.js @@ -112,4 +112,4 @@ function print() { __p += __j.call(arguments, '') } `)+ne+`return __p }`;var Oe=HS(function(){return je(E,ge+"return "+ne).apply(n,R)});if(Oe.source=ne,Ag(Oe))throw Oe;return Oe}function FI(o){return Ve(o).toLowerCase()}function $I(o){return Ve(o).toUpperCase()}function zI(o,l,d){if(o=Ve(o),o&&(d||l===n))return Z0(o);if(!o||!(l=Fn(l)))return o;var m=Er(o),b=Er(l),E=e1(m,b),R=t1(m,b)+1;return aa(m,E,R).join("")}function GI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.slice(0,r1(o)+1);if(!o||!(l=Fn(l)))return o;var m=Er(o),b=t1(m,Er(l))+1;return aa(m,0,b).join("")}function UI(o,l,d){if(o=Ve(o),o&&(d||l===n))return o.replace(nl,"");if(!o||!(l=Fn(l)))return o;var m=Er(o),b=e1(m,Er(l));return aa(m,b).join("")}function jI(o,l){var d=K,m=te;if(ht(l)){var b="separator"in l?l.separator:b;d="length"in l?Pe(l.length):d,m="omission"in l?Fn(l.omission):m}o=Ve(o);var E=o.length;if($o(o)){var R=Er(o);E=R.length}if(d>=E)return o;var M=d-zo(m);if(M<1)return m;var z=R?aa(R,0,M).join(""):o.slice(0,M);if(b===n)return z+m;if(R&&(M+=z.length-M),Ig(b)){if(o.slice(M).search(b)){var Z,ee=z;for(b.global||(b=Kp(b.source,Ve(vi.exec(b))+"g")),b.lastIndex=0;Z=b.exec(ee);)var ne=Z.index;z=z.slice(0,ne===n?M:ne)}}else if(o.indexOf(Fn(b),M)!=M){var ue=z.lastIndexOf(b);ue>-1&&(z=z.slice(0,ue))}return z+m}function HI(o){return o=Ve(o),o&&up.test(o)?o.replace(el,SP):o}var WI=qo(function(o,l,d){return o+(d?" ":"")+l.toUpperCase()}),Dg=W1("toUpperCase");function jS(o,l,d){return o=Ve(o),l=d?n:l,l===n?pP(o)?bP(o):aP(o):o.match(l)||[]}var HS=Re(function(o,l){try{return Nn(o,n,l)}catch(d){return Ag(d)?d:new Ce(d)}}),VI=xi(function(o,l){return tr(l,function(d){d=Yr(d),bi(o,d,Tg(o[d],o))}),o});function qI(o){var l=o==null?0:o.length,d=ye();return o=l?ut(o,function(m){if(typeof m[1]!="function")throw new nr(s);return[d(m[0]),m[1]]}):[],Re(function(m){for(var b=-1;++bH)return[];var d=oe,m=rn(o,oe);l=ye(l),o-=oe;for(var b=Wp(m,l);++d0||l<0)?new Me(d):(o<0?d=d.takeRight(-o):o&&(d=d.drop(o)),l!==n&&(l=Pe(l),d=l<0?d.dropRight(-l):d.take(l-o)),d)},Me.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},Me.prototype.toArray=function(){return this.take(oe)},qr(Me.prototype,function(o,l){var d=/^(?:filter|find|map|reject)|While$/.test(l),m=/^(?:head|last)$/.test(l),b=k[m?"take"+(l=="last"?"Right":""):l],E=m||/^find/.test(l);b&&(k.prototype[l]=function(){var R=this.__wrapped__,M=m?[1]:arguments,z=R instanceof Me,Z=M[0],ee=z||ke(R),ne=function(Le){var Ne=b.apply(k,Zi([Le],M));return m&&ue?Ne[0]:Ne};ee&&d&&typeof Z=="function"&&Z.length!=1&&(z=ee=!1);var ue=this.__chain__,ge=!!this.__actions__.length,Se=E&&!ue,Oe=z&&!ge;if(!E&&ee){R=Oe?R:new Me(this);var _e=o.apply(R,M);return _e.__actions__.push({func:nf,args:[ne],thisArg:n}),new rr(_e,ue)}return Se&&Oe?o.apply(this,M):(_e=this.thru(ne),Se?m?_e.value()[0]:_e.value():_e)})}),tr(["pop","push","shift","sort","splice","unshift"],function(o){var l=Oc[o],d=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",m=/^(?:pop|shift)$/.test(o);k.prototype[o]=function(){var b=arguments;if(m&&!this.__chain__){var E=this.value();return l.apply(ke(E)?E:[],b)}return this[d](function(R){return l.apply(ke(R)?R:[],b)})}}),qr(Me.prototype,function(o,l){var d=k[l];if(d){var m=d.name+"";Xe.call(Ho,m)||(Ho[m]=[]),Ho[m].push({name:l,func:d})}}),Ho[Yc(n,_).name]=[{name:"wrapper",func:n}],Me.prototype.clone=HP,Me.prototype.reverse=WP,Me.prototype.value=VP,k.prototype.at=wR,k.prototype.chain=bR,k.prototype.commit=CR,k.prototype.next=xR,k.prototype.plant=ER,k.prototype.reverse=PR,k.prototype.toJSON=k.prototype.valueOf=k.prototype.value=OR,k.prototype.first=k.prototype.head,pl&&(k.prototype[pl]=kR),k},Go=CP();ze?((ze.exports=Go)._=Go,Te._=Go):Ee._=Go}).call(yn)})(p5,_t);const Jo=(t,e,n,r,i,a,s)=>{const u=t/2-(n+i/2)*s,c=e/2-(r+a/2)*s;return{x:u,y:c}},Zo=(t,e,n,r,i=.95)=>{const a=t*i/n,s=e*i/r;return Math.min(1,Math.min(a,s))},RG=.999,AG=.1,IG=20,Nl=.95,LG=30,MG=10,Ew=t=>({x:Math.floor(t.x),y:Math.floor(t.y)}),Ya=t=>{const{width:e,height:n}=t,r={width:e,height:n},i=512*512,a=e/n;let s=e*n,u=448;for(;s1?(r.width=u,r.height=va(u/a,64)):a<1&&(r.height=u,r.width=va(u*a,64)),s=r.width*r.height;return r},g5=t=>({width:va(t.width,64),height:va(t.height,64)}),DG=[{key:"Base",value:"base"},{key:"Mask",value:"mask"}],NG=[{key:"Auto",value:"auto"},{key:"Manual",value:"manual"},{key:"None",value:"none"}],Jx=t=>t.kind==="line"&&t.layer==="mask",BG=t=>t.kind==="line"&&t.layer==="base",Pw=t=>t.kind==="image"&&t.layer==="base",FG=t=>t.kind==="fillRect"&&t.layer==="base",$G=t=>t.kind==="eraseRect"&&t.layer==="base",m5=t=>t.kind==="line",Zl={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},v5={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"auto",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,canvasContainerDimensions:{width:0,height:0},colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,doesCanvasNeedScaling:!1,futureLayerStates:[],isCanvasInitialized:!1,isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:Zl,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},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"},Zx=vo({name:"canvas",initialState:v5,reducers:{setTool:(t,e)=>{const n=e.payload;t.tool=e.payload,n!=="move"&&(t.isTransformingBoundingBox=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1)},setLayer:(t,e)=>{t.layer=e.payload},toggleTool:t=>{const e=t.tool;e!=="move"&&(t.tool=e==="brush"?"eraser":"brush")},setMaskColor:(t,e)=>{t.maskColor=e.payload},setBrushColor:(t,e)=>{t.brushColor=e.payload},setBrushSize:(t,e)=>{t.brushSize=e.payload},clearMask:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState.objects=t.layerState.objects.filter(e=>!Jx(e)),t.futureLayerStates=[],t.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:t=>{t.shouldPreserveMaskedArea=!t.shouldPreserveMaskedArea},toggleShouldShowMask:t=>{t.isMaskEnabled=!t.isMaskEnabled},setShouldPreserveMaskedArea:(t,e)=>{t.shouldPreserveMaskedArea=e.payload},setIsMaskEnabled:(t,e)=>{t.isMaskEnabled=e.payload,t.layer=e.payload?"mask":"base"},setShouldShowCheckboardTransparency:(t,e)=>{t.shouldShowCheckboardTransparency=e.payload},setShouldShowBrushPreview:(t,e)=>{t.shouldShowBrushPreview=e.payload},setShouldShowBrush:(t,e)=>{t.shouldShowBrush=e.payload},setCursorPosition:(t,e)=>{t.cursorPosition=e.payload},setInitialCanvasImage:(t,e)=>{const n=e.payload,{stageDimensions:r}=t,i={width:Of(_t.clamp(n.width,64,512),64),height:Of(_t.clamp(n.height,64,512),64)},a={x:va(n.width/2-i.width/2,64),y:va(n.height/2-i.height/2,64)};if(t.boundingBoxScaleMethod==="auto"){const c=Ya(i);t.scaledBoundingBoxDimensions=c}t.boundingBoxDimensions=i,t.boundingBoxCoordinates=a,t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState={...Zl,objects:[{kind:"image",layer:"base",x:0,y:0,width:n.width,height:n.height,image:n}]},t.futureLayerStates=[],t.isCanvasInitialized=!1;const s=Zo(r.width,r.height,n.width,n.height,Nl),u=Jo(r.width,r.height,0,0,n.width,n.height,s);t.stageScale=s,t.stageCoordinates=u,t.doesCanvasNeedScaling=!0},setBoundingBoxDimensions:(t,e)=>{const n=g5(e.payload);if(t.boundingBoxDimensions=n,t.boundingBoxScaleMethod==="auto"){const r=Ya(n);t.scaledBoundingBoxDimensions=r}},setBoundingBoxCoordinates:(t,e)=>{t.boundingBoxCoordinates=Ew(e.payload)},setStageCoordinates:(t,e)=>{t.stageCoordinates=e.payload},setBoundingBoxPreviewFill:(t,e)=>{t.boundingBoxPreviewFill=e.payload},setDoesCanvasNeedScaling:(t,e)=>{t.doesCanvasNeedScaling=e.payload},setStageScale:(t,e)=>{t.stageScale=e.payload},setShouldDarkenOutsideBoundingBox:(t,e)=>{t.shouldDarkenOutsideBoundingBox=e.payload},setIsDrawing:(t,e)=>{t.isDrawing=e.payload},clearCanvasHistory:t=>{t.pastLayerStates=[],t.futureLayerStates=[]},setShouldLockBoundingBox:(t,e)=>{t.shouldLockBoundingBox=e.payload},toggleShouldLockBoundingBox:t=>{t.shouldLockBoundingBox=!t.shouldLockBoundingBox},setShouldShowBoundingBox:(t,e)=>{t.shouldShowBoundingBox=e.payload},setIsTransformingBoundingBox:(t,e)=>{t.isTransformingBoundingBox=e.payload},setIsMovingBoundingBox:(t,e)=>{t.isMovingBoundingBox=e.payload},setIsMouseOverBoundingBox:(t,e)=>{t.isMouseOverBoundingBox=e.payload},setIsMoveBoundingBoxKeyHeld:(t,e)=>{t.isMoveBoundingBoxKeyHeld=e.payload},setIsMoveStageKeyHeld:(t,e)=>{t.isMoveStageKeyHeld=e.payload},addImageToStagingArea:(t,e)=>{const{boundingBox:n,image:r}=e.payload;!n||!r||(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea.images.push({kind:"image",layer:"base",...n,image:r}),t.layerState.stagingArea.selectedImageIndex=t.layerState.stagingArea.images.length-1,t.futureLayerStates=[])},discardStagedImages:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingOutline=!0},addFillRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n,brushColor:r}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"fillRect",layer:"base",...e,...n,color:r}),t.futureLayerStates=[]},addEraseRect:t=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:n}=t;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({kind:"eraseRect",layer:"base",...e,...n}),t.futureLayerStates=[]},addLine:(t,e)=>{const{tool:n,layer:r,brushColor:i,brushSize:a,shouldRestrictStrokesToBox:s}=t;if(n==="move"||n==="colorPicker")return;const u=a/2,c=r==="base"&&n==="brush"?{color:i}:{};t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift();const f={kind:"line",layer:r,tool:n,strokeWidth:u,points:e.payload,...c};s&&(f.clip={...t.boundingBoxCoordinates,...t.boundingBoxDimensions}),t.layerState.objects.push(f),t.futureLayerStates=[]},addPointToCurrentLine:(t,e)=>{const n=t.layerState.objects.findLast(m5);n&&n.points.push(...e.payload)},undo:t=>{const e=t.pastLayerStates.pop();e&&(t.futureLayerStates.unshift(_t.cloneDeep(t.layerState)),t.futureLayerStates.length>t.maxHistory&&t.futureLayerStates.pop(),t.layerState=e)},redo:t=>{const e=t.futureLayerStates.shift();e&&(t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState=e)},setShouldShowGrid:(t,e)=>{t.shouldShowGrid=e.payload},setIsMovingStage:(t,e)=>{t.isMovingStage=e.payload},setShouldSnapToGrid:(t,e)=>{t.shouldSnapToGrid=e.payload},setShouldAutoSave:(t,e)=>{t.shouldAutoSave=e.payload},setShouldShowIntermediates:(t,e)=>{t.shouldShowIntermediates=e.payload},resetCanvas:t=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.layerState=Zl,t.futureLayerStates=[]},setCanvasContainerDimensions:(t,e)=>{t.canvasContainerDimensions=e.payload},resizeAndScaleCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r=t.layerState.objects.find(Pw),i={width:Math.floor(e),height:Math.floor(n)};if(!r){const h=Zo(i.width,i.height,512,512,Nl),p=Jo(i.width,i.height,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.stageDimensions=i,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}return}const{width:a,height:s}=r,c=Zo(e,n,a,s,.95),f=Jo(i.width,i.height,0,0,a,s,c);t.minimumStageScale=c,t.stageScale=c,t.stageCoordinates=Ew(f),t.stageDimensions=i,t.isCanvasInitialized=!0},resizeCanvas:t=>{const{width:e,height:n}=t.canvasContainerDimensions,r={width:Math.floor(e),height:Math.floor(n)};if(t.stageDimensions=r,!t.layerState.objects.find(Pw)){const i=Zo(r.width,r.height,512,512,Nl),a=Jo(r.width,r.height,0,0,512,512,i),s={width:512,height:512};if(t.stageScale=i,t.stageCoordinates=a,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=s,t.boundingBoxScaleMethod==="auto"){const u=Ya(s);t.scaledBoundingBoxDimensions=u}}},resetCanvasView:(t,e)=>{const{contentRect:n,shouldScaleTo1:r}=e.payload,{stageDimensions:{width:i,height:a}}=t,{x:s,y:u,width:c,height:f}=n;if(c!==0&&f!==0){const h=r?1:Zo(i,a,c,f,Nl),p=Jo(i,a,s,u,c,f,h);t.stageScale=h,t.stageCoordinates=p}else{const h=Zo(i,a,512,512,Nl),p=Jo(i,a,0,0,512,512,h),g={width:512,height:512};if(t.stageScale=h,t.stageCoordinates=p,t.boundingBoxCoordinates={x:0,y:0},t.boundingBoxDimensions=g,t.boundingBoxScaleMethod==="auto"){const y=Ya(g);t.scaledBoundingBoxDimensions=y}}},nextStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex,n=t.layerState.stagingArea.images.length;t.layerState.stagingArea.selectedImageIndex=Math.min(e+1,n-1)},prevStagingAreaImage:t=>{const e=t.layerState.stagingArea.selectedImageIndex;t.layerState.stagingArea.selectedImageIndex=Math.max(e-1,0)},commitStagingAreaImage:t=>{const{images:e,selectedImageIndex:n}=t.layerState.stagingArea;t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.pastLayerStates.length>t.maxHistory&&t.pastLayerStates.shift(),t.layerState.objects.push({...e[n]}),t.layerState.stagingArea={...Zl.stagingArea},t.futureLayerStates=[],t.shouldShowStagingOutline=!0,t.shouldShowStagingImage=!0},fitBoundingBoxToStage:t=>{const{boundingBoxDimensions:e,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=t,a=r.width/i,s=r.height/i;if(n.x<0||n.x+e.width>a||n.y<0||n.y+e.height>s){const u={width:Of(_t.clamp(a,64,512),64),height:Of(_t.clamp(s,64,512),64)},c={x:va(a/2-u.width/2,64),y:va(s/2-u.height/2,64)};if(t.boundingBoxDimensions=u,t.boundingBoxCoordinates=c,t.boundingBoxScaleMethod==="auto"){const f=Ya(u);t.scaledBoundingBoxDimensions=f}}},setBoundingBoxScaleMethod:(t,e)=>{if(t.boundingBoxScaleMethod=e.payload,e.payload==="auto"){const n=Ya(t.boundingBoxDimensions);t.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(t,e)=>{t.scaledBoundingBoxDimensions=e.payload},setShouldShowStagingImage:(t,e)=>{t.shouldShowStagingImage=e.payload},setShouldShowStagingOutline:(t,e)=>{t.shouldShowStagingOutline=e.payload},setShouldShowCanvasDebugInfo:(t,e)=>{t.shouldShowCanvasDebugInfo=e.payload},setShouldRestrictStrokesToBox:(t,e)=>{t.shouldRestrictStrokesToBox=e.payload},setShouldCropToBoundingBoxOnSave:(t,e)=>{t.shouldCropToBoundingBoxOnSave=e.payload},setColorPickerColor:(t,e)=>{t.colorPickerColor=e.payload},commitColorPickerColor:t=>{t.brushColor={...t.colorPickerColor,a:t.brushColor.a},t.tool="brush"},setMergedCanvas:(t,e)=>{t.pastLayerStates.push(_t.cloneDeep(t.layerState)),t.futureLayerStates=[],t.layerState.objects=[e.payload]},resetCanvasInteractionState:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMoveBoundingBoxKeyHeld=!1,t.isMoveStageKeyHeld=!1,t.isMovingBoundingBox=!1,t.isMovingStage=!1,t.isTransformingBoundingBox=!1},mouseLeftCanvas:t=>{t.cursorPosition=null,t.isDrawing=!1,t.isMouseOverBoundingBox=!1,t.isMovingBoundingBox=!1,t.isTransformingBoundingBox=!1}}}),{addEraseRect:zG,addFillRect:GG,addImageToStagingArea:y5,addLine:UG,addPointToCurrentLine:jG,clearCanvasHistory:HG,clearMask:WG,commitColorPickerColor:VG,commitStagingAreaImage:qG,discardStagedImages:KG,fitBoundingBoxToStage:YG,mouseLeftCanvas:XG,nextStagingAreaImage:QG,prevStagingAreaImage:JG,redo:ZG,resetCanvas:eU,resetCanvasInteractionState:tU,resetCanvasView:nU,resizeAndScaleCanvas:rU,resizeCanvas:iU,setBoundingBoxCoordinates:aU,setBoundingBoxDimensions:oU,setBoundingBoxPreviewFill:sU,setBoundingBoxScaleMethod:lU,setBrushColor:uU,setBrushSize:cU,setCanvasContainerDimensions:fU,setColorPickerColor:dU,setCursorPosition:hU,setDoesCanvasNeedScaling:pU,setInitialCanvasImage:gU,setIsDrawing:mU,setIsMaskEnabled:vU,setIsMouseOverBoundingBox:yU,setIsMoveBoundingBoxKeyHeld:SU,setIsMoveStageKeyHeld:_U,setIsMovingBoundingBox:wU,setIsMovingStage:bU,setIsTransformingBoundingBox:CU,setLayer:xU,setMaskColor:kU,setMergedCanvas:EU,setShouldAutoSave:PU,setShouldCropToBoundingBoxOnSave:OU,setShouldDarkenOutsideBoundingBox:TU,setShouldLockBoundingBox:RU,setShouldPreserveMaskedArea:AU,setShouldShowBoundingBox:IU,setShouldShowBrush:LU,setShouldShowBrushPreview:MU,setShouldShowCanvasDebugInfo:DU,setShouldShowCheckboardTransparency:NU,setShouldShowGrid:BU,setShouldShowIntermediates:FU,setShouldShowStagingImage:$U,setShouldShowStagingOutline:zU,setShouldSnapToGrid:GU,setStageCoordinates:UU,setStageScale:jU,setTool:HU,toggleShouldLockBoundingBox:WU,toggleTool:VU,undo:qU,setScaledBoundingBoxDimensions:KU,setShouldRestrictStrokesToBox:YU}=Zx.actions,S5=Zx.reducer,_5={currentImageUuid:"",shouldPinGallery:!0,shouldShowGallery:!0,galleryImageMinimumWidth:64,galleryImageObjectFit:"cover",shouldHoldGalleryOpen:!1,shouldAutoSwitchToNewImages:!0,currentCategory:"result",categories:{user:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0},result:{images:[],latest_mtime:void 0,earliest_mtime:void 0,areMoreImagesAvailable:!0}},galleryWidth:300,shouldUseSingleGalleryColumn:!1},ek=vo({name:"gallery",initialState:_5,reducers:{setCurrentImage:(t,e)=>{t.currentImage=e.payload,t.currentImageUuid=e.payload.uuid},removeImage:(t,e)=>{const{uuid:n,category:r}=e.payload,i=t.categories[r].images,a=i.filter(s=>s.uuid!==n);if(n===t.currentImageUuid){const s=i.findIndex(c=>c.uuid===n),u=_t.clamp(s,0,a.length-1);t.currentImage=a.length?a[u]:void 0,t.currentImageUuid=a.length?a[u].uuid:""}t.categories[r].images=a},addImage:(t,e)=>{const{image:n,category:r}=e.payload,{uuid:i,url:a,mtime:s}=n,u=t.categories[r];u.images.find(c=>c.url===a&&c.mtime===s)||(u.images.unshift(n),t.shouldAutoSwitchToNewImages&&(t.currentImageUuid=i,t.currentImage=n,t.currentCategory=r),t.intermediateImage=void 0,u.latest_mtime=s)},setIntermediateImage:(t,e)=>{t.intermediateImage=e.payload},clearIntermediateImage:t=>{t.intermediateImage=void 0},selectNextImage:t=>{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r{const{currentImage:e}=t;if(!e)return;const n=t.categories[e.category].images;if(e){const r=n.findIndex(i=>i.uuid===e.uuid);if(r>0){const i=n[r-1];t.currentImage=i,t.currentImageUuid=i.uuid}}},addGalleryImages:(t,e)=>{const{images:n,areMoreImagesAvailable:r,category:i}=e.payload,a=t.categories[i].images;if(n.length>0){const s=n.filter(u=>!a.find(c=>c.url===u.url&&c.mtime===u.mtime));if(t.categories[i].images=a.concat(s).sort((u,c)=>c.mtime-u.mtime),!t.currentImage){const u=n[0];t.currentImage=u,t.currentImageUuid=u.uuid}t.categories[i].latest_mtime=n[0].mtime,t.categories[i].earliest_mtime=n[n.length-1].mtime}r!==void 0&&(t.categories[i].areMoreImagesAvailable=r)},setShouldPinGallery:(t,e)=>{t.shouldPinGallery=e.payload},setShouldShowGallery:(t,e)=>{t.shouldShowGallery=e.payload},setGalleryImageMinimumWidth:(t,e)=>{t.galleryImageMinimumWidth=e.payload},setGalleryImageObjectFit:(t,e)=>{t.galleryImageObjectFit=e.payload},setShouldHoldGalleryOpen:(t,e)=>{t.shouldHoldGalleryOpen=e.payload},setShouldAutoSwitchToNewImages:(t,e)=>{t.shouldAutoSwitchToNewImages=e.payload},setCurrentCategory:(t,e)=>{t.currentCategory=e.payload},setGalleryWidth:(t,e)=>{t.galleryWidth=e.payload},setShouldUseSingleGalleryColumn:(t,e)=>{t.shouldUseSingleGalleryColumn=e.payload}}}),{addImage:Tf,clearIntermediateImage:Cm,removeImage:tk,setCurrentImage:XU,addGalleryImages:w5,setIntermediateImage:b5,selectNextImage:QU,selectPrevImage:JU,setShouldPinGallery:ZU,setShouldShowGallery:ej,setGalleryImageMinimumWidth:tj,setGalleryImageObjectFit:nj,setShouldHoldGalleryOpen:rj,setShouldAutoSwitchToNewImages:ij,setCurrentCategory:aj,setGalleryWidth:oj,setShouldUseSingleGalleryColumn:sj}=ek.actions,C5=ek.reducer,x5={isLightboxOpen:!1},k5=x5,nk=vo({name:"lightbox",initialState:k5,reducers:{setIsLightboxOpen:(t,e)=>{t.isLightboxOpen=e.payload}}}),{setIsLightboxOpen:lj}=nk.actions,E5=nk.reducer,hd=t=>typeof t=="string"?t:t.length===1?t[0].prompt:t.map(e=>`${e.prompt}:${e.weight}`).join(" ");function P5(t){let e=typeof t=="string"?t:hd(t),n="";const r=new RegExp(/\[([^\][]*)]/,"gi"),i=[...e.matchAll(r)].map(a=>a[1]);return i.length&&(n=i.join(" "),i.forEach(a=>{e=e.replace(`[${a}]`,"").replaceAll("[]","").trim()})),[e,n]}const O5=t=>{const r=t.split(",").map(i=>i.split(":")).map(i=>({seed:Number(i[0]),weight:Number(i[1])}));return T5(r)?r:!1},T5=t=>Boolean(typeof t=="string"?O5(t):t.length&&!t.some(e=>{const{seed:n,weight:r}=e,i=!isNaN(parseInt(n.toString(),10)),a=!isNaN(parseInt(r.toString(),10))&&r>=0&&r<=1;return!(i&&a)})),Ow=t=>t.reduce((e,n,r,i)=>{const{seed:a,weight:s}=n;return e+=`${a}:${s}`,r!==i.length-1&&(e+=","),e},""),R5=t=>t.split(",").map(r=>r.split(":")).map(r=>[parseInt(r[0],10),parseFloat(r[1])]),rk={cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,maskPath:"",perlin:0,prompt:"",negativePrompt:"",sampler:"k_lms",seamBlur:16,seamless:!1,seamSize:96,seamSteps:30,seamStrength:.7,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,tileSize:32,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0},A5=rk,ik=vo({name:"generation",initialState:A5,reducers:{setPrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.prompt=n:t.prompt=hd(n)},setNegativePrompt:(t,e)=>{const n=e.payload;typeof n=="string"?t.negativePrompt=n:t.negativePrompt=hd(n)},setIterations:(t,e)=>{t.iterations=e.payload},setSteps:(t,e)=>{t.steps=e.payload},clampSymmetrySteps:t=>{t.horizontalSymmetrySteps=_t.clamp(t.horizontalSymmetrySteps,0,t.steps),t.verticalSymmetrySteps=_t.clamp(t.verticalSymmetrySteps,0,t.steps)},setCfgScale:(t,e)=>{t.cfgScale=e.payload},setThreshold:(t,e)=>{t.threshold=e.payload},setPerlin:(t,e)=>{t.perlin=e.payload},setHeight:(t,e)=>{t.height=e.payload},setWidth:(t,e)=>{t.width=e.payload},setSampler:(t,e)=>{t.sampler=e.payload},setSeed:(t,e)=>{t.seed=e.payload,t.shouldRandomizeSeed=!1},setImg2imgStrength:(t,e)=>{t.img2imgStrength=e.payload},setMaskPath:(t,e)=>{t.maskPath=e.payload},setSeamless:(t,e)=>{t.seamless=e.payload},setShouldFitToWidthHeight:(t,e)=>{t.shouldFitToWidthHeight=e.payload},resetSeed:t=>{t.seed=-1},setParameter:(t,e)=>{const{key:n,value:r}=e.payload,i={...t,[n]:r};return n==="seed"&&(i.shouldRandomizeSeed=!1),i},setShouldGenerateVariations:(t,e)=>{t.shouldGenerateVariations=e.payload},setVariationAmount:(t,e)=>{t.variationAmount=e.payload},setSeedWeights:(t,e)=>{t.seedWeights=e.payload,t.shouldGenerateVariations=!0,t.variationAmount=0},setAllTextToImageParameters:(t,e)=>{const{sampler:n,prompt:r,seed:i,variations:a,steps:s,cfg_scale:u,threshold:c,perlin:f,seamless:h,_hires_fix:p,width:g,height:y}=e.payload.image;a&&a.length>0?(t.seedWeights=Ow(a),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,i&&(t.seed=i,t.shouldRandomizeSeed=!1),r&&(t.prompt=hd(r)),n&&(t.sampler=n),s&&(t.steps=s),u&&(t.cfgScale=u),typeof c>"u"?t.threshold=0:t.threshold=c,typeof f>"u"?t.perlin=0:t.perlin=f,typeof h=="boolean"&&(t.seamless=h),g&&(t.width=g),y&&(t.height=y)},setAllImageToImageParameters:(t,e)=>{const{type:n,strength:r,fit:i,init_image_path:a,mask_image_path:s}=e.payload.image;n==="img2img"&&(a&&(t.initialImage=a),s&&(t.maskPath=s),r&&(t.img2imgStrength=r),typeof i=="boolean"&&(t.shouldFitToWidthHeight=i))},setAllParameters:(t,e)=>{const{type:n,sampler:r,prompt:i,seed:a,variations:s,steps:u,cfg_scale:c,threshold:f,perlin:h,seamless:p,_hires_fix:g,width:y,height:v,strength:w,fit:x,init_image_path:_,mask_image_path:S}=e.payload.image;if(n==="img2img"&&(_&&(t.initialImage=_),S&&(t.maskPath=S),w&&(t.img2imgStrength=w),typeof x=="boolean"&&(t.shouldFitToWidthHeight=x)),s&&s.length>0?(t.seedWeights=Ow(s),t.shouldGenerateVariations=!0,t.variationAmount=0):t.shouldGenerateVariations=!1,a&&(t.seed=a,t.shouldRandomizeSeed=!1),i){const[C,O]=P5(i);C&&(t.prompt=C),O?t.negativePrompt=O:t.negativePrompt=""}r&&(t.sampler=r),u&&(t.steps=u),c&&(t.cfgScale=c),typeof f>"u"?t.threshold=0:t.threshold=f,typeof h>"u"?t.perlin=0:t.perlin=h,typeof p=="boolean"&&(t.seamless=p),y&&(t.width=y),v&&(t.height=v)},resetParametersState:t=>({...t,...rk}),setShouldRandomizeSeed:(t,e)=>{t.shouldRandomizeSeed=e.payload},setInitialImage:(t,e)=>{t.initialImage=e.payload},clearInitialImage:t=>{t.initialImage=void 0},setSeamSize:(t,e)=>{t.seamSize=e.payload},setSeamBlur:(t,e)=>{t.seamBlur=e.payload},setSeamStrength:(t,e)=>{t.seamStrength=e.payload},setSeamSteps:(t,e)=>{t.seamSteps=e.payload},setTileSize:(t,e)=>{t.tileSize=e.payload},setInfillMethod:(t,e)=>{t.infillMethod=e.payload},setShouldUseSymmetry:(t,e)=>{t.shouldUseSymmetry=e.payload},setHorizontalSymmetrySteps:(t,e)=>{t.horizontalSymmetrySteps=e.payload},setVerticalSymmetrySteps:(t,e)=>{t.verticalSymmetrySteps=e.payload}}}),{clampSymmetrySteps:uj,clearInitialImage:I5,resetParametersState:cj,resetSeed:fj,setAllImageToImageParameters:dj,setAllParameters:hj,setAllTextToImageParameters:pj,setCfgScale:gj,setHeight:mj,setImg2imgStrength:vj,setInfillMethod:L5,setInitialImage:M5,setIterations:yj,setMaskPath:D5,setParameter:Sj,setPerlin:_j,setPrompt:wj,setNegativePrompt:bj,setSampler:Cj,setSeamBlur:xj,setSeamless:kj,setSeamSize:Ej,setSeamSteps:Pj,setSeamStrength:Oj,setSeed:Tj,setSeedWeights:Rj,setShouldFitToWidthHeight:Aj,setShouldGenerateVariations:Ij,setShouldRandomizeSeed:Lj,setSteps:Mj,setThreshold:Dj,setTileSize:Nj,setVariationAmount:Bj,setWidth:Fj,setShouldUseSymmetry:$j,setHorizontalSymmetrySteps:zj,setVerticalSymmetrySteps:Gj}=ik.actions,N5=ik.reducer,ak={codeformerFidelity:.75,facetoolStrength:.75,facetoolType:"gfpgan",hiresFix:!1,hiresStrength:.75,shouldLoopback:!1,shouldRunESRGAN:!1,shouldRunFacetool:!1,upscalingLevel:4,upscalingDenoising:.75,upscalingStrength:.75},B5=ak,ok=vo({name:"postprocessing",initialState:B5,reducers:{setFacetoolStrength:(t,e)=>{t.facetoolStrength=e.payload},setCodeformerFidelity:(t,e)=>{t.codeformerFidelity=e.payload},setUpscalingLevel:(t,e)=>{t.upscalingLevel=e.payload},setUpscalingDenoising:(t,e)=>{t.upscalingDenoising=e.payload},setUpscalingStrength:(t,e)=>{t.upscalingStrength=e.payload},setHiresFix:(t,e)=>{t.hiresFix=e.payload},setHiresStrength:(t,e)=>{t.hiresStrength=e.payload},resetPostprocessingState:t=>({...t,...ak}),setShouldRunFacetool:(t,e)=>{t.shouldRunFacetool=e.payload},setFacetoolType:(t,e)=>{t.facetoolType=e.payload},setShouldRunESRGAN:(t,e)=>{t.shouldRunESRGAN=e.payload},setShouldLoopback:(t,e)=>{t.shouldLoopback=e.payload}}}),{resetPostprocessingState:Uj,setCodeformerFidelity:jj,setFacetoolStrength:Hj,setFacetoolType:Wj,setHiresFix:Vj,setHiresStrength:qj,setShouldLoopback:Kj,setShouldRunESRGAN:Yj,setShouldRunFacetool:Xj,setUpscalingLevel:Qj,setUpscalingDenoising:Jj,setUpscalingStrength:Zj}=ok.actions,F5=ok.reducer;function Sr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tw(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=n||G5,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(n){this.debug=n}},{key:"log",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i1?r-1:0),a=1;a-1?u.replace(/###/g,"."):u}function i(){return!t||typeof t=="string"}for(var a=typeof e!="string"?[].concat(e):e.split(".");a.length>1;){if(i())return{};var s=r(a.shift());!t[s]&&n&&(t[s]=new n),Object.prototype.hasOwnProperty.call(t,s)?t=t[s]:t={}}return i()?{}:{obj:t,k:r(a.shift())}}function Mw(t,e,n){var r=O0(t,e,Object),i=r.obj,a=r.k;i[a]=n}function H5(t,e,n,r){var i=O0(t,e,Object),a=i.obj,s=i.k;a[s]=a[s]||[],r&&(a[s]=a[s].concat(n)),r||a[s].push(n)}function rh(t,e){var n=O0(t,e),r=n.obj,i=n.k;if(r)return r[i]}function Dw(t,e,n){var r=rh(t,n);return r!==void 0?r:rh(e,n)}function ck(t,e,n){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in t?typeof t[r]=="string"||t[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?n&&(t[r]=e[r]):ck(t[r],e[r],n):t[r]=e[r]);return t}function es(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var W5={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function V5(t){return typeof t=="string"?t.replace(/[&<>"'\/]/g,function(e){return W5[e]}):t}var Qh=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,q5=[" ",",","?","!",";"];function K5(t,e,n){e=e||"",n=n||"";var r=q5.filter(function(u){return e.indexOf(u)<0&&n.indexOf(u)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(u){return u==="?"?"\\?":u}).join("|"),")")),a=!i.test(t);if(!a){var s=t.indexOf(n);s>0&&!i.test(t.substring(0,s))&&(a=!0)}return a}function Nw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Rf(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function fk(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(t){if(t[e])return t[e];for(var r=e.split(n),i=t,a=0;aa+s;)s++,u=r.slice(a,a+s).join(n),c=i[u];if(c===void 0)return;if(c===null)return null;if(e.endsWith(u)){if(typeof c=="string")return c;if(u&&typeof c[u]=="string")return c[u]}var f=r.slice(a+s).join(n);return f?fk(c,f,n):void 0}i=i[r[a]]}return i}}var Q5=function(t){Xh(n,t);var e=Y5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Pa(i)),i.data=r||{},i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return _r(n,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var a=this.options.ns.indexOf(i);a>-1&&this.options.ns.splice(a,1)}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=u.keySeparator!==void 0?u.keySeparator:this.options.keySeparator,f=u.ignoreJSONStructure!==void 0?u.ignoreJSONStructure:this.options.ignoreJSONStructure,h=[i,a];s&&typeof s!="string"&&(h=h.concat(s)),s&&typeof s=="string"&&(h=h.concat(c?s.split(c):s)),i.indexOf(".")>-1&&(h=i.split("."));var p=rh(this.data,h);return p||!f||typeof s!="string"?p:fk(this.data&&this.data[i]&&this.data[i][a],s,c)}},{key:"addResource",value:function(i,a,s,u){var c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},f=this.options.keySeparator;f===void 0&&(f=".");var h=[i,a];s&&(h=h.concat(f?s.split(f):s)),i.indexOf(".")>-1&&(h=i.split("."),u=a,a=h[1]),this.addNamespaces(a),Mw(this.data,h,u),c.silent||this.emit("added",i,a,s,u)}},{key:"addResources",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var c in s)(typeof s[c]=="string"||Object.prototype.toString.apply(s[c])==="[object Array]")&&this.addResource(i,a,c,s[c],{silent:!0});u.silent||this.emit("added",i,a,s)}},{key:"addResourceBundle",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},h=[i,a];i.indexOf(".")>-1&&(h=i.split("."),u=s,s=a,a=h[1]),this.addNamespaces(a);var p=rh(this.data,h)||{};u?ck(p,s,c):p=Rf(Rf({},p),s),Mw(this.data,h,p),f.silent||this.emit("added",i,a,s)}},{key:"removeResourceBundle",value:function(i,a){this.hasResourceBundle(i,a)&&delete this.data[i][a],this.removeNamespaces(a),this.emit("removed",i,a)}},{key:"hasResourceBundle",value:function(i,a){return this.getResource(i,a)!==void 0}},{key:"getResourceBundle",value:function(i,a){return a||(a=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Rf(Rf({},{}),this.getResource(i,a)):this.getResource(i,a)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var a=this.getDataByLanguage(i),s=a&&Object.keys(a)||[];return!!s.find(function(u){return a[u]&&Object.keys(a[u]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),n}(Aa),dk={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,n,r,i,a){var s=this;return e.forEach(function(u){s.processors[u]&&(n=s.processors[u].process(n,r,i,a))}),n}};function Bw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mn(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Fw={},$w=function(t){Xh(n,t);var e=J5(n);function n(r){var i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Sr(this,n),i=e.call(this),Qh&&Aa.call(Pa(i)),j5(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,Pa(i)),i.options=a,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ii.create("translator"),i}return _r(n,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var s=this.resolve(i,a);return s&&s.res!==void 0}},{key:"extractFromKey",value:function(i,a){var s=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");var u=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ns||this.options.defaultNS||[],f=s&&i.indexOf(s)>-1,h=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!K5(i,s,u);if(f&&!h){var p=i.match(this.interpolator.nestingRegexp);if(p&&p.length>0)return{key:i,namespaces:c};var g=i.split(s);(s!==u||s===u&&this.options.ns.indexOf(g[0])>-1)&&(c=g.shift()),i=g.join(u)}return typeof c=="string"&&(c=[c]),{key:i,namespaces:c}}},{key:"translate",value:function(i,a,s){var u=this;if(gr(a)!=="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),a||(a={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var c=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,f=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,h=this.extractFromKey(i[i.length-1],a),p=h.key,g=h.namespaces,y=g[g.length-1],v=a.lng||this.language,w=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(v&&v.toLowerCase()==="cimode"){if(w){var x=a.nsSeparator||this.options.nsSeparator;return c?{res:"".concat(y).concat(x).concat(p),usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:"".concat(y).concat(x).concat(p)}return c?{res:p,usedKey:p,exactUsedKey:p,usedLng:v,usedNS:y}:p}var _=this.resolve(i,a),S=_&&_.res,C=_&&_.usedKey||p,O=_&&_.exactUsedKey||p,I=Object.prototype.toString.apply(S),L=["[object Number]","[object Function]","[object RegExp]"],D=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,U=!this.i18nFormat||this.i18nFormat.handleAsObject,X=typeof S!="string"&&typeof S!="boolean"&&typeof S!="number";if(U&&S&&X&&L.indexOf(I)<0&&!(typeof D=="string"&&I==="[object Array]")){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var K=this.options.returnedObjectHandler?this.options.returnedObjectHandler(C,S,mn(mn({},a),{},{ns:g})):"key '".concat(p," (").concat(this.language,")' returned an object instead of string.");return c?(_.res=K,_):K}if(f){var te=I==="[object Array]",ce=te?[]:{},j=te?O:C;for(var T in S)if(Object.prototype.hasOwnProperty.call(S,T)){var $="".concat(j).concat(f).concat(T);ce[T]=this.translate($,mn(mn({},a),{joinArrays:!1,ns:g})),ce[T]===$&&(ce[T]=S[T])}S=ce}}else if(U&&typeof D=="string"&&I==="[object Array]")S=S.join(D),S&&(S=this.extendTranslation(S,i,a,s));else{var V=!1,ie=!1,H=a.count!==void 0&&typeof a.count!="string",Y=n.hasDefaultValue(a),Q=H?this.pluralResolver.getSuffix(v,a.count,a):"",oe=a["defaultValue".concat(Q)]||a.defaultValue;!this.isValidLookup(S)&&Y&&(V=!0,S=oe),this.isValidLookup(S)||(ie=!0,S=p);var ve=a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,we=ve&&ie?void 0:S,Ue=Y&&oe!==S&&this.options.updateMissing;if(ie||V||Ue){if(this.logger.log(Ue?"updateKey":"missingKey",v,y,p,Ue?oe:S),f){var At=this.resolve(p,mn(mn({},a),{},{keySeparator:!1}));At&&At.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.")}var me=[],qt=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&qt&&qt[0])for(var Bt=0;Bt1&&arguments[1]!==void 0?arguments[1]:{},u,c,f,h,p;return typeof i=="string"&&(i=[i]),i.forEach(function(g){if(!a.isValidLookup(u)){var y=a.extractFromKey(g,s),v=y.key;c=v;var w=y.namespaces;a.options.fallbackNS&&(w=w.concat(a.options.fallbackNS));var x=s.count!==void 0&&typeof s.count!="string",_=x&&!s.ordinal&&s.count===0&&a.pluralResolver.shouldUseIntlApi(),S=s.context!==void 0&&(typeof s.context=="string"||typeof s.context=="number")&&s.context!=="",C=s.lngs?s.lngs:a.languageUtils.toResolveHierarchy(s.lng||a.language,s.fallbackLng);w.forEach(function(O){a.isValidLookup(u)||(p=O,!Fw["".concat(C[0],"-").concat(O)]&&a.utils&&a.utils.hasLoadedNamespace&&!a.utils.hasLoadedNamespace(p)&&(Fw["".concat(C[0],"-").concat(O)]=!0,a.logger.warn('key "'.concat(c,'" for languages "').concat(C.join(", "),`" won't get resolved as namespace "`).concat(p,'" 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!!!")),C.forEach(function(I){if(!a.isValidLookup(u)){h=I;var L=[v];if(a.i18nFormat&&a.i18nFormat.addLookupKeys)a.i18nFormat.addLookupKeys(L,v,I,O,s);else{var D;x&&(D=a.pluralResolver.getSuffix(I,s.count,s));var U="".concat(a.options.pluralSeparator,"zero");if(x&&(L.push(v+D),_&&L.push(v+U)),S){var X="".concat(v).concat(a.options.contextSeparator).concat(s.context);L.push(X),x&&(L.push(X+D),_&&L.push(X+U))}}for(var K;K=L.pop();)a.isValidLookup(u)||(f=K,u=a.getResource(I,O,K,s))}}))})}}),{res:u,usedKey:c,exactUsedKey:f,usedLng:h,usedNS:p}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,a,s){var u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,a,s,u):this.resourceStore.getResource(i,a,s,u)}}],[{key:"hasDefaultValue",value:function(i){var a="defaultValue";for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)&&a===s.substring(0,a.length)&&i[s]!==void 0)return!0;return!1}}]),n}(Aa);function xm(t){return t.charAt(0).toUpperCase()+t.slice(1)}var zw=function(){function t(e){Sr(this,t),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ii.create("languageUtils")}return _r(t,[{key:"getScriptPartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return null;var r=n.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(n){if(!n||n.indexOf("-")<0)return n;var r=n.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(n){if(typeof n=="string"&&n.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=n.split("-");return this.options.lowerCaseLng?i=i.map(function(a){return a.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=xm(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=xm(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}},{key:"isSupportedCode",value:function(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}},{key:"getBestMatchFromCodes",value:function(n){var r=this;if(!n)return null;var i;return n.forEach(function(a){if(!i){var s=r.formatLanguageCode(a);(!r.options.supportedLngs||r.isSupportedCode(s))&&(i=s)}}),!i&&this.options.supportedLngs&&n.forEach(function(a){if(!i){var s=r.getLanguagePartFromCode(a);if(r.isSupportedCode(s))return i=s;i=r.options.supportedLngs.find(function(u){if(u.indexOf(s)===0)return u})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(n,r){if(!n)return[];if(typeof n=="function"&&(n=n(r)),typeof n=="string"&&(n=[n]),Object.prototype.toString.apply(n)==="[object Array]")return n;if(!r)return n.default||[];var i=n[r];return i||(i=n[this.getScriptPartFromCode(r)]),i||(i=n[this.formatLanguageCode(r)]),i||(i=n[this.getLanguagePartFromCode(r)]),i||(i=n.default),i||[]}},{key:"toResolveHierarchy",value:function(n,r){var i=this,a=this.getFallbackCodes(r||this.options.fallbackLng||[],n),s=[],u=function(f){f&&(i.isSupportedCode(f)?s.push(f):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(f)))};return typeof n=="string"&&n.indexOf("-")>-1?(this.options.load!=="languageOnly"&&u(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&u(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&u(this.getLanguagePartFromCode(n))):typeof n=="string"&&u(this.formatLanguageCode(n)),a.forEach(function(c){s.indexOf(c)<0&&u(i.formatLanguageCode(c))}),s}}]),t}(),e4=[{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}],t4={1:function(e){return Number(e>1)},2:function(e){return Number(e!=1)},3:function(e){return 0},4:function(e){return Number(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 Number(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 Number(e==1?0:e>=2&&e<=4?1:2)},7:function(e){return Number(e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2)},8:function(e){return Number(e==1?0:e==2?1:e!=8&&e!=11?2:3)},9:function(e){return Number(e>=2)},10:function(e){return Number(e==1?0:e==2?1:e<7?2:e<11?3:4)},11:function(e){return Number(e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3)},12:function(e){return Number(e%10!=1||e%100==11)},13:function(e){return Number(e!==0)},14:function(e){return Number(e==1?0:e==2?1:e==3?2:3)},15:function(e){return Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2)},16:function(e){return Number(e%10==1&&e%100!=11?0:e!==0?1:2)},17:function(e){return Number(e==1||e%10==1&&e%100!=11?0:1)},18:function(e){return Number(e==0?0:e==1?1:2)},19:function(e){return Number(e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3)},20:function(e){return Number(e==1?0:e==0||e%100>0&&e%100<20?1:2)},21:function(e){return Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0)},22:function(e){return Number(e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3)}},n4=["v1","v2","v3"],Gw={zero:0,one:1,two:2,few:3,many:4,other:5};function r4(){var t={};return e4.forEach(function(e){e.lngs.forEach(function(n){t[n]={numbers:e.nr,plurals:t4[e.fc]}})}),t}var i4=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.languageUtils=e,this.options=n,this.logger=ii.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(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=r4()}return _r(t,[{key:"addRule",value:function(n,r){this.rules[n]=r}},{key:"getRule",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(n,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[n]||this.rules[this.languageUtils.getLanguagePartFromCode(n)]}},{key:"needsPlural",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(n,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,i).map(function(a){return"".concat(r).concat(a)})}},{key:"getSuffixes",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?a.resolvedOptions().pluralCategories.sort(function(s,u){return Gw[s]-Gw[u]}).map(function(s){return"".concat(r.options.prepend).concat(s)}):a.numbers.map(function(s){return r.getSuffix(n,s,i)}):[]}},{key:"getSuffix",value:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=this.getRule(n,i);return a?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(a.select(r)):this.getSuffixRetroCompatible(a,r):(this.logger.warn("no plural rule found for: ".concat(n)),"")}},{key:"getSuffixRetroCompatible",value:function(n,r){var i=this,a=n.noAbs?n.plurals(r):n.plurals(Math.abs(r)),s=n.numbers[a];this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));var u=function(){return i.options.prepend&&s.toString()?i.options.prepend+s.toString():s.toString()};return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?"_plural_".concat(s.toString()):u():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&n.numbers.length===2&&n.numbers[0]===1?u():this.options.prepend&&a.toString()?this.options.prepend+a.toString():a.toString()}},{key:"shouldUseIntlApi",value:function(){return!n4.includes(this.options.compatibilityJSON)}}]),t}();function Uw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ar(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(n){return n},this.init(e)}return _r(t,[{key:"init",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});var r=n.interpolation;this.escape=r.escape!==void 0?r.escape:V5,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?es(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?es(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?es(r.nestingPrefix):r.nestingPrefixEscaped||es("$t("),this.nestingSuffix=r.nestingSuffix?es(r.nestingSuffix):r.nestingSuffixEscaped||es(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var n="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(n,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(n,r,i,a){var s=this,u,c,f,h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function p(x){return x.replace(/\$/g,"$$$$")}var g=function(_){if(_.indexOf(s.formatSeparator)<0){var S=Dw(r,h,_);return s.alwaysFormat?s.format(S,void 0,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:_})):S}var C=_.split(s.formatSeparator),O=C.shift().trim(),I=C.join(s.formatSeparator).trim();return s.format(Dw(r,h,O),I,i,Ar(Ar(Ar({},a),r),{},{interpolationkey:O}))};this.resetRegExp();var y=a&&a.missingInterpolationHandler||this.options.missingInterpolationHandler,v=a&&a.interpolation&&a.interpolation.skipOnVariables!==void 0?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,w=[{regex:this.regexpUnescape,safeValue:function(_){return p(_)}},{regex:this.regexp,safeValue:function(_){return s.escapeValue?p(s.escape(_)):p(_)}}];return w.forEach(function(x){for(f=0;u=x.regex.exec(n);){var _=u[1].trim();if(c=g(_),c===void 0)if(typeof y=="function"){var S=y(n,u,a);c=typeof S=="string"?S:""}else if(a&&Object.prototype.hasOwnProperty.call(a,_))c="";else if(v){c=u[0];continue}else s.logger.warn("missed to pass in variable ".concat(_," for interpolating ").concat(n)),c="";else typeof c!="string"&&!s.useRawValueToEscape&&(c=Lw(c));var C=x.safeValue(c);if(n=n.replace(u[0],C),v?(x.regex.lastIndex+=c.length,x.regex.lastIndex-=u[0].length):x.regex.lastIndex=0,f++,f>=s.maxReplaces)break}}),n}},{key:"nest",value:function(n,r){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,u,c;function f(y,v){var w=this.nestingOptionsSeparator;if(y.indexOf(w)<0)return y;var x=y.split(new RegExp("".concat(w,"[ ]*{"))),_="{".concat(x[1]);y=x[0],_=this.interpolate(_,c);var S=_.match(/'/g),C=_.match(/"/g);(S&&S.length%2===0&&!C||C.length%2!==0)&&(_=_.replace(/'/g,'"'));try{c=JSON.parse(_),v&&(c=Ar(Ar({},v),c))}catch(O){return this.logger.warn("failed parsing options string in nesting for key ".concat(y),O),"".concat(y).concat(w).concat(_)}return delete c.defaultValue,y}for(;s=this.nestingRegexp.exec(n);){var h=[];c=Ar({},a),c=c.replace&&typeof c.replace!="string"?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;var p=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){var g=s[1].split(this.formatSeparator).map(function(y){return y.trim()});s[1]=g.shift(),h=g,p=!0}if(u=r(f.call(this,s[1].trim(),c),c),u&&s[0]===n&&typeof u!="string")return u;typeof u!="string"&&(u=Lw(u)),u||(this.logger.warn("missed to resolve ".concat(s[1]," for nesting ").concat(n)),u=""),p&&(u=h.reduce(function(y,v){return i.format(y,v,a.lng,Ar(Ar({},a),{},{interpolationkey:s[1].trim()}))},u.trim())),n=n.replace(s[0],u),this.regexp.lastIndex=0}return n}}]),t}();function jw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ri(t){for(var e=1;e-1){var r=t.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)n.currency||(n.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)n.range||(n.range=i.trim());else{var a=i.split(";");a.forEach(function(s){if(s){var u=s.split(":"),c=z5(u),f=c[0],h=c.slice(1),p=h.join(":").trim().replace(/^'+|'+$/g,"");n[f.trim()]||(n[f.trim()]=p),p==="false"&&(n[f.trim()]=!1),p==="true"&&(n[f.trim()]=!0),isNaN(p)||(n[f.trim()]=parseInt(p,10))}})}}return{formatName:e,formatOptions:n}}function ts(t){var e={};return function(r,i,a){var s=i+JSON.stringify(a),u=e[s];return u||(u=t(i,a),e[s]=u),u(r)}}var s4=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Sr(this,t),this.logger=ii.create("formatter"),this.options=e,this.formats={number:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri({},r));return function(a){return i.format(a)}}),currency:ts(function(n,r){var i=new Intl.NumberFormat(n,Ri(Ri({},r),{},{style:"currency"}));return function(a){return i.format(a)}}),datetime:ts(function(n,r){var i=new Intl.DateTimeFormat(n,Ri({},r));return function(a){return i.format(a)}}),relativetime:ts(function(n,r){var i=new Intl.RelativeTimeFormat(n,Ri({},r));return function(a){return i.format(a,r.range||"day")}}),list:ts(function(n,r){var i=new Intl.ListFormat(n,Ri({},r));return function(a){return i.format(a)}})},this.init(e)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(n,r){this.formats[n.toLowerCase().trim()]=r}},{key:"addCached",value:function(n,r){this.formats[n.toLowerCase().trim()]=ts(r)}},{key:"format",value:function(n,r,i){var a=this,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},u=r.split(this.formatSeparator),c=u.reduce(function(f,h){var p=o4(h),g=p.formatName,y=p.formatOptions;if(a.formats[g]){var v=f;try{var w=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},x=w.locale||w.lng||s.locale||s.lng||i;v=a.formats[g](f,x,Ri(Ri(Ri({},y),s),w))}catch(_){a.logger.warn(_)}return v}else a.logger.warn("there was no format function for ".concat(g));return f},n);return c}}]),t}();function Hw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ww(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function c4(t,e){t.pending[e]!==void 0&&(delete t.pending[e],t.pendingCount--)}var f4=function(t){Xh(n,t);var e=l4(n);function n(r,i,a){var s,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Sr(this,n),s=e.call(this),Qh&&Aa.call(Pa(s)),s.backend=r,s.store=i,s.services=a,s.languageUtils=a.languageUtils,s.options=u,s.logger=ii.create("backendConnector"),s.waitingReads=[],s.maxParallelReads=u.maxParallelReads||10,s.readingCalls=0,s.maxRetries=u.maxRetries>=0?u.maxRetries:5,s.retryTimeout=u.retryTimeout>=1?u.retryTimeout:350,s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(a,u.backend,u),s}return _r(n,[{key:"queueLoad",value:function(i,a,s,u){var c=this,f={},h={},p={},g={};return i.forEach(function(y){var v=!0;a.forEach(function(w){var x="".concat(y,"|").concat(w);!s.reload&&c.store.hasResourceBundle(y,w)?c.state[x]=2:c.state[x]<0||(c.state[x]===1?h[x]===void 0&&(h[x]=!0):(c.state[x]=1,v=!1,h[x]===void 0&&(h[x]=!0),f[x]===void 0&&(f[x]=!0),g[w]===void 0&&(g[w]=!0)))}),v||(p[y]=!0)}),(Object.keys(f).length||Object.keys(h).length)&&this.queue.push({pending:h,pendingCount:Object.keys(h).length,loaded:{},errors:[],callback:u}),{toLoad:Object.keys(f),pending:Object.keys(h),toLoadLanguages:Object.keys(p),toLoadNamespaces:Object.keys(g)}}},{key:"loaded",value:function(i,a,s){var u=i.split("|"),c=u[0],f=u[1];a&&this.emit("failedLoading",c,f,a),s&&this.store.addResourceBundle(c,f,s),this.state[i]=a?-1:2;var h={};this.queue.forEach(function(p){H5(p.loaded,[c],f),c4(p,i),a&&p.errors.push(a),p.pendingCount===0&&!p.done&&(Object.keys(p.loaded).forEach(function(g){h[g]||(h[g]={});var y=p.loaded[g];y.length&&y.forEach(function(v){h[g][v]===void 0&&(h[g][v]=!0)})}),p.done=!0,p.errors.length?p.callback(p.errors):p.callback())}),this.emit("loaded",h),this.queue=this.queue.filter(function(p){return!p.done})}},{key:"read",value:function(i,a,s){var u=this,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,h=arguments.length>5?arguments[5]:void 0;if(!i.length)return h(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:a,fcName:s,tried:c,wait:f,callback:h});return}this.readingCalls++;var p=function(w,x){if(u.readingCalls--,u.waitingReads.length>0){var _=u.waitingReads.shift();u.read(_.lng,_.ns,_.fcName,_.tried,_.wait,_.callback)}if(w&&x&&c2&&arguments[2]!==void 0?arguments[2]:{},c=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."),c&&c();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof a=="string"&&(a=[a]);var f=this.queueLoad(i,a,u,c);if(!f.toLoad.length)return f.pending.length||c(),null;f.toLoad.forEach(function(h){s.loadOne(h)})}},{key:"load",value:function(i,a,s){this.prepareLoading(i,a,{},s)}},{key:"reload",value:function(i,a,s){this.prepareLoading(i,a,{reload:!0},s)}},{key:"loadOne",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",u=i.split("|"),c=u[0],f=u[1];this.read(c,f,"read",void 0,void 0,function(h,p){h&&a.logger.warn("".concat(s,"loading namespace ").concat(f," for language ").concat(c," failed"),h),!h&&p&&a.logger.log("".concat(s,"loaded namespace ").concat(f," for language ").concat(c),p),a.loaded(i,h,p)})}},{key:"saveMissing",value:function(i,a,s,u,c){var f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(a)){this.logger.warn('did not save key "'.concat(s,'" as the namespace "').concat(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!!!");return}if(!(s==null||s==="")){if(this.backend&&this.backend.create){var p=Ww(Ww({},f),{},{isUpdate:c}),g=this.backend.create.bind(this.backend);if(g.length<6)try{var y;g.length===5?y=g(i,a,s,u,p):y=g(i,a,s,u),y&&typeof y.then=="function"?y.then(function(v){return h(null,v)}).catch(h):h(null,y)}catch(v){h(v)}else g(i,a,s,u,h,p)}!i||!i[0]||this.store.addResource(i[0],a,s,u)}}}]),n}(Aa);function Vw(){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:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var n={};if(gr(e[1])==="object"&&(n=e[1]),typeof e[1]=="string"&&(n.defaultValue=e[1]),typeof e[2]=="string"&&(n.tDescription=e[2]),gr(e[2])==="object"||gr(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:function(e,n,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function qw(t){return typeof t.ns=="string"&&(t.ns=[t.ns]),typeof t.fallbackLng=="string"&&(t.fallbackLng=[t.fallbackLng]),typeof t.fallbackNS=="string"&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs&&t.supportedLngs.indexOf("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),t}function Kw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Qr(t){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Af(){}function p4(t){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(t));e.forEach(function(n){typeof t[n]=="function"&&(t[n]=t[n].bind(t))})}var ih=function(t){Xh(n,t);var e=d4(n);function n(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if(Sr(this,n),r=e.call(this),Qh&&Aa.call(Pa(r)),r.options=qw(i),r.services={},r.logger=ii,r.modules={external:[]},p4(Pa(r)),a&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,a),Zu(r,Pa(r));setTimeout(function(){r.init(i,a)},0)}return r}return _r(n,[{key:"init",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof a=="function"&&(s=a,a={}),!a.defaultNS&&a.defaultNS!==!1&&a.ns&&(typeof a.ns=="string"?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));var u=Vw();this.options=Qr(Qr(Qr({},u),this.options),qw(a)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Qr(Qr({},u.interpolation),this.options.interpolation)),a.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=a.keySeparator),a.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=a.nsSeparator);function c(_){return _?typeof _=="function"?new _:_:null}if(!this.options.isClone){this.modules.logger?ii.init(c(this.modules.logger),this.options):ii.init(null,this.options);var f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=s4);var h=new zw(this.options);this.store=new Q5(this.options.resources,this.options);var p=this.services;p.logger=ii,p.resourceStore=this.store,p.languageUtils=h,p.pluralResolver=new i4(h,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===u.interpolation.format)&&(p.formatter=c(f),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new a4(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new f4(c(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(_){for(var S=arguments.length,C=new Array(S>1?S-1:0),O=1;O1?S-1:0),O=1;O0&&g[0]!=="dev"&&(this.options.lng=g[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var y=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];y.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments)}});var v=["addResource","addResources","addResourceBundle","removeResourceBundle"];v.forEach(function(_){i[_]=function(){var S;return(S=i.store)[_].apply(S,arguments),i}});var w=Bl(),x=function(){var S=function(O,I){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),w.resolve(I),s(O,I)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return S(null,i.t.bind(i));i.changeLanguage(i.options.lng,S)};return this.options.resources||!this.options.initImmediate?x():setTimeout(x,0),w}},{key:"loadResources",value:function(i){var a=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Af,u=s,c=typeof i=="string"?i:this.language;if(typeof i=="function"&&(u=i),!this.options.resources||this.options.partialBundledLanguages){if(c&&c.toLowerCase()==="cimode")return u();var f=[],h=function(y){if(y){var v=a.services.languageUtils.toResolveHierarchy(y);v.forEach(function(w){f.indexOf(w)<0&&f.push(w)})}};if(c)h(c);else{var p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.forEach(function(g){return h(g)})}this.options.preload&&this.options.preload.forEach(function(g){return h(g)}),this.services.backendConnector.load(f,this.options.ns,function(g){!g&&!a.resolvedLanguage&&a.language&&a.setResolvedLanguage(a.language),u(g)})}else u(null)}},{key:"reloadResources",value:function(i,a,s){var u=Bl();return i||(i=this.languages),a||(a=this.options.ns),s||(s=Af),this.services.backendConnector.reload(i,a,function(c){u.resolve(),s(c)}),u}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&dk.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var a=0;a-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}},{key:"changeLanguage",value:function(i,a){var s=this;this.isLanguageChangingTo=i;var u=Bl();this.emit("languageChanging",i);var c=function(g){s.language=g,s.languages=s.services.languageUtils.toResolveHierarchy(g),s.resolvedLanguage=void 0,s.setResolvedLanguage(g)},f=function(g,y){y?(c(y),s.translator.changeLanguage(y),s.isLanguageChangingTo=void 0,s.emit("languageChanged",y),s.logger.log("languageChanged",y)):s.isLanguageChangingTo=void 0,u.resolve(function(){return s.t.apply(s,arguments)}),a&&a(g,function(){return s.t.apply(s,arguments)})},h=function(g){!i&&!g&&s.services.languageDetector&&(g=[]);var y=typeof g=="string"?g:s.services.languageUtils.getBestMatchFromCodes(g);y&&(s.language||c(y),s.translator.language||s.translator.changeLanguage(y),s.services.languageDetector&&s.services.languageDetector.cacheUserLanguage&&s.services.languageDetector.cacheUserLanguage(y)),s.loadResources(y,function(v){f(v,y)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(i),u}},{key:"getFixedT",value:function(i,a,s){var u=this,c=function f(h,p){var g;if(gr(p)!=="object"){for(var y=arguments.length,v=new Array(y>2?y-2:0),w=2;w1&&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;var u=this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,f=this.languages[this.languages.length-1];if(u.toLowerCase()==="cimode")return!0;var h=function(y,v){var w=a.services.backendConnector.state["".concat(y,"|").concat(v)];return w===-1||w===2};if(s.precheck){var p=s.precheck(this,h);if(p!==void 0)return p}return!!(this.hasResourceBundle(u,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||h(u,i)&&(!c||h(f,i)))}},{key:"loadNamespaces",value:function(i,a){var s=this,u=Bl();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(c){s.options.ns.indexOf(c)<0&&s.options.ns.push(c)}),this.loadResources(function(c){u.resolve(),a&&a(c)}),u):(a&&a(),Promise.resolve())}},{key:"loadLanguages",value:function(i,a){var s=Bl();typeof i=="string"&&(i=[i]);var u=this.options.preload||[],c=i.filter(function(f){return u.indexOf(f)<0});return c.length?(this.options.preload=u.concat(c),this.loadResources(function(f){s.resolve(),a&&a(f)}),s):(a&&a(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var a=["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"],s=this.services&&this.services.languageUtils||new zw(Vw());return a.indexOf(s.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Af,u=Qr(Qr(Qr({},this.options),a),{isClone:!0}),c=new n(u);(a.debug!==void 0||a.prefix!==void 0)&&(c.logger=c.logger.clone(a));var f=["store","services","language"];return f.forEach(function(h){c[h]=i[h]}),c.services=Qr({},this.services),c.services.utils={hasLoadedNamespace:c.hasLoadedNamespace.bind(c)},c.translator=new $w(c.services,c.options),c.translator.on("*",function(h){for(var p=arguments.length,g=new Array(p>1?p-1:0),y=1;y0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new ih(t,e)});var Ae=ih.createInstance();Ae.createInstance=ih.createInstance;Ae.createInstance;Ae.dir;Ae.init;Ae.loadResources;Ae.reloadResources;Ae.use;Ae.changeLanguage;Ae.getFixedT;Ae.t;Ae.exists;Ae.setDefaultNamespace;Ae.hasLoadedNamespace;Ae.loadNamespaces;Ae.loadLanguages;var hk=[],g4=hk.forEach,m4=hk.slice;function v4(t){return g4.call(m4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}var Yw=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,y4=function(e,n,r){var i=r||{};i.path=i.path||"/";var a=encodeURIComponent(n),s="".concat(e,"=").concat(a);if(i.maxAge>0){var u=i.maxAge-0;if(Number.isNaN(u))throw new Error("maxAge should be a Number");s+="; Max-Age=".concat(Math.floor(u))}if(i.domain){if(!Yw.test(i.domain))throw new TypeError("option domain is invalid");s+="; Domain=".concat(i.domain)}if(i.path){if(!Yw.test(i.path))throw new TypeError("option path is invalid");s+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");s+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(s+="; HttpOnly"),i.secure&&(s+="; Secure"),i.sameSite){var c=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(c){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s},Xw={create:function(e,n,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+r*60*1e3)),i&&(a.domain=i),document.cookie=y4(e,encodeURIComponent(n),a)},read:function(e){for(var n="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),a=i.split("&"),s=0;s0){var c=a[s].substring(0,u);c===e.lookupQuerystring&&(n=a[s].substring(u+1))}}}return n}},Fl=null,Qw=function(){if(Fl!==null)return Fl;try{Fl=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{Fl=!1}return Fl},w4={name:"localStorage",lookup:function(e){var n;if(e.lookupLocalStorage&&Qw()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupLocalStorage&&Qw()&&window.localStorage.setItem(n.lookupLocalStorage,e)}},$l=null,Jw=function(){if($l!==null)return $l;try{$l=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{$l=!1}return $l},b4={name:"sessionStorage",lookup:function(e){var n;if(e.lookupSessionStorage&&Jw()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(e,n){n.lookupSessionStorage&&Jw()&&window.sessionStorage.setItem(n.lookupSessionStorage,e)}},C4={name:"navigator",lookup:function(e){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?n:void 0}},x4={name:"htmlTag",lookup:function(e){var n,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},k4={name:"path",lookup:function(e){var n;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;n=r[e.lookupFromPathIndex].replace("/","")}else n=r[0].replace("/","")}return n}},E4={name:"subdomain",lookup:function(e){var n=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[n]}};function P4(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var pk=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sr(this,t),this.type="languageDetector",this.detectors={},this.init(e,n)}return _r(t,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=v4(r,this.options||{},P4()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(S4),this.addDetector(_4),this.addDetector(w4),this.addDetector(b4),this.addDetector(C4),this.addDetector(x4),this.addDetector(k4),this.addDetector(E4)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var i=[];return n.forEach(function(a){if(r.detectors[a]){var s=r.detectors[a].lookup(r.options);s&&typeof s=="string"&&(s=[s]),s&&(i=i.concat(s))}}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(a){i.detectors[a]&&i.detectors[a].cacheUserLanguage(n,i.options)}))}}]),t}();pk.type="languageDetector";function Hv(t){return Hv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hv(t)}var gk=[],O4=gk.forEach,T4=gk.slice;function Wv(t){return O4.call(T4.call(arguments,1),function(e){if(e)for(var n in e)t[n]===void 0&&(t[n]=e[n])}),t}function mk(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Hv(XMLHttpRequest))==="object"}function R4(t){return!!t&&typeof t.then=="function"}function A4(t){return R4(t)?t:Promise.resolve(t)}function I4(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zu={},L4={get exports(){return zu},set exports(t){zu=t}},gu={},M4={get exports(){return gu},set exports(t){gu=t}},Zw;function D4(){return Zw||(Zw=1,function(t,e){var n=typeof self<"u"?self:yn,r=function(){function a(){this.fetch=!1,this.DOMException=n.DOMException}return a.prototype=n,new a}();(function(a){(function(s){var u={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function c(T){return T&&DataView.prototype.isPrototypeOf(T)}if(u.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(T){return T&&f.indexOf(Object.prototype.toString.call(T))>-1};function p(T){if(typeof T!="string"&&(T=String(T)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(T))throw new TypeError("Invalid character in header field name");return T.toLowerCase()}function g(T){return typeof T!="string"&&(T=String(T)),T}function y(T){var $={next:function(){var V=T.shift();return{done:V===void 0,value:V}}};return u.iterable&&($[Symbol.iterator]=function(){return $}),$}function v(T){this.map={},T instanceof v?T.forEach(function($,V){this.append(V,$)},this):Array.isArray(T)?T.forEach(function($){this.append($[0],$[1])},this):T&&Object.getOwnPropertyNames(T).forEach(function($){this.append($,T[$])},this)}v.prototype.append=function(T,$){T=p(T),$=g($);var V=this.map[T];this.map[T]=V?V+", "+$:$},v.prototype.delete=function(T){delete this.map[p(T)]},v.prototype.get=function(T){return T=p(T),this.has(T)?this.map[T]:null},v.prototype.has=function(T){return this.map.hasOwnProperty(p(T))},v.prototype.set=function(T,$){this.map[p(T)]=g($)},v.prototype.forEach=function(T,$){for(var V in this.map)this.map.hasOwnProperty(V)&&T.call($,this.map[V],V,this)},v.prototype.keys=function(){var T=[];return this.forEach(function($,V){T.push(V)}),y(T)},v.prototype.values=function(){var T=[];return this.forEach(function($){T.push($)}),y(T)},v.prototype.entries=function(){var T=[];return this.forEach(function($,V){T.push([V,$])}),y(T)},u.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function w(T){if(T.bodyUsed)return Promise.reject(new TypeError("Already read"));T.bodyUsed=!0}function x(T){return new Promise(function($,V){T.onload=function(){$(T.result)},T.onerror=function(){V(T.error)}})}function _(T){var $=new FileReader,V=x($);return $.readAsArrayBuffer(T),V}function S(T){var $=new FileReader,V=x($);return $.readAsText(T),V}function C(T){for(var $=new Uint8Array(T),V=new Array($.length),ie=0;ie<$.length;ie++)V[ie]=String.fromCharCode($[ie]);return V.join("")}function O(T){if(T.slice)return T.slice(0);var $=new Uint8Array(T.byteLength);return $.set(new Uint8Array(T)),$.buffer}function I(){return this.bodyUsed=!1,this._initBody=function(T){this._bodyInit=T,T?typeof T=="string"?this._bodyText=T:u.blob&&Blob.prototype.isPrototypeOf(T)?this._bodyBlob=T:u.formData&&FormData.prototype.isPrototypeOf(T)?this._bodyFormData=T:u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)?this._bodyText=T.toString():u.arrayBuffer&&u.blob&&c(T)?(this._bodyArrayBuffer=O(T.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(T)||h(T))?this._bodyArrayBuffer=O(T):this._bodyText=T=Object.prototype.toString.call(T):this._bodyText="",this.headers.get("content-type")||(typeof T=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):u.searchParams&&URLSearchParams.prototype.isPrototypeOf(T)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u.blob&&(this.blob=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?w(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(_)}),this.text=function(){var T=w(this);if(T)return T;if(this._bodyBlob)return S(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(C(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},u.formData&&(this.formData=function(){return this.text().then(X)}),this.json=function(){return this.text().then(JSON.parse)},this}var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function D(T){var $=T.toUpperCase();return L.indexOf($)>-1?$:T}function U(T,$){$=$||{};var V=$.body;if(T instanceof U){if(T.bodyUsed)throw new TypeError("Already read");this.url=T.url,this.credentials=T.credentials,$.headers||(this.headers=new v(T.headers)),this.method=T.method,this.mode=T.mode,this.signal=T.signal,!V&&T._bodyInit!=null&&(V=T._bodyInit,T.bodyUsed=!0)}else this.url=String(T);if(this.credentials=$.credentials||this.credentials||"same-origin",($.headers||!this.headers)&&(this.headers=new v($.headers)),this.method=D($.method||this.method||"GET"),this.mode=$.mode||this.mode||null,this.signal=$.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&V)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(V)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function X(T){var $=new FormData;return T.trim().split("&").forEach(function(V){if(V){var ie=V.split("="),H=ie.shift().replace(/\+/g," "),Y=ie.join("=").replace(/\+/g," ");$.append(decodeURIComponent(H),decodeURIComponent(Y))}}),$}function K(T){var $=new v,V=T.replace(/\r?\n[\t ]+/g," ");return V.split(/\r?\n/).forEach(function(ie){var H=ie.split(":"),Y=H.shift().trim();if(Y){var Q=H.join(":").trim();$.append(Y,Q)}}),$}I.call(U.prototype);function te(T,$){$||($={}),this.type="default",this.status=$.status===void 0?200:$.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in $?$.statusText:"OK",this.headers=new v($.headers),this.url=$.url||"",this._initBody(T)}I.call(te.prototype),te.prototype.clone=function(){return new te(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},te.error=function(){var T=new te(null,{status:0,statusText:""});return T.type="error",T};var ce=[301,302,303,307,308];te.redirect=function(T,$){if(ce.indexOf($)===-1)throw new RangeError("Invalid status code");return new te(null,{status:$,headers:{location:T}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function($,V){this.message=$,this.name=V;var ie=Error($);this.stack=ie.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function j(T,$){return new Promise(function(V,ie){var H=new U(T,$);if(H.signal&&H.signal.aborted)return ie(new s.DOMException("Aborted","AbortError"));var Y=new XMLHttpRequest;function Q(){Y.abort()}Y.onload=function(){var oe={status:Y.status,statusText:Y.statusText,headers:K(Y.getAllResponseHeaders()||"")};oe.url="responseURL"in Y?Y.responseURL:oe.headers.get("X-Request-URL");var ve="response"in Y?Y.response:Y.responseText;V(new te(ve,oe))},Y.onerror=function(){ie(new TypeError("Network request failed"))},Y.ontimeout=function(){ie(new TypeError("Network request failed"))},Y.onabort=function(){ie(new s.DOMException("Aborted","AbortError"))},Y.open(H.method,H.url,!0),H.credentials==="include"?Y.withCredentials=!0:H.credentials==="omit"&&(Y.withCredentials=!1),"responseType"in Y&&u.blob&&(Y.responseType="blob"),H.headers.forEach(function(oe,ve){Y.setRequestHeader(ve,oe)}),H.signal&&(H.signal.addEventListener("abort",Q),Y.onreadystatechange=function(){Y.readyState===4&&H.signal.removeEventListener("abort",Q)}),Y.send(typeof H._bodyInit>"u"?null:H._bodyInit)})}return j.polyfill=!0,a.fetch||(a.fetch=j,a.Headers=v,a.Request=U,a.Response=te),s.Headers=v,s.Request=U,s.Response=te,s.fetch=j,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}(M4,gu)),gu}(function(t,e){var n;if(typeof fetch=="function"&&(typeof yn<"u"&&yn.fetch?n=yn.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof I4<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||D4();r.default&&(r=r.default),e.default=r,t.exports=e.default}})(L4,zu);const vk=zu,eb=h2({__proto__:null,default:vk},[zu]);function ah(t){return ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ah(t)}var Fi;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?Fi=global.fetch:typeof window<"u"&&window.fetch?Fi=window.fetch:Fi=fetch);var Gu;mk()&&(typeof global<"u"&&global.XMLHttpRequest?Gu=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Gu=window.XMLHttpRequest));var oh;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?oh=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(oh=window.ActiveXObject));!Fi&&eb&&!Gu&&!oh&&(Fi=vk||eb);typeof Fi!="function"&&(Fi=void 0);var Vv=function(e,n){if(n&&ah(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+r.slice(1)}return e},tb=function(e,n,r){Fi(e,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(a){r(null,{status:i.status,data:a})}).catch(r)}).catch(r)},nb=!1,N4=function(e,n,r,i){e.queryStringParams&&(n=Vv(n,e.queryStringParams));var a=Wv({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);r&&(a["Content-Type"]="application/json");var s=typeof e.requestOptions=="function"?e.requestOptions(r):e.requestOptions,u=Wv({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:a},nb?{}:s);try{tb(n,u,i)}catch(c){if(!s||Object.keys(s).length===0||!c.message||c.message.indexOf("not implemented")<0)return i(c);try{Object.keys(s).forEach(function(f){delete u[f]}),tb(n,u,i),nb=!0}catch(f){i(f)}}},B4=function(e,n,r,i){r&&ah(r)==="object"&&(r=Vv("",r).slice(1)),e.queryStringParams&&(n=Vv(n,e.queryStringParams));try{var a;Gu?a=new Gu:a=new oh("MSXML2.XMLHTTP.3.0"),a.open(r?"POST":"GET",n,1),e.crossDomain||a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.withCredentials=!!e.withCredentials,r&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.overrideMimeType&&a.overrideMimeType("application/json");var s=e.customHeaders;if(s=typeof s=="function"?s():s,s)for(var u in s)a.setRequestHeader(u,s[u]);a.onreadystatechange=function(){a.readyState>3&&i(a.status>=400?a.statusText:null,{status:a.status,data:a.responseText})},a.send(r)}catch(c){console&&console.log(c)}},F4=function(e,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},Fi&&n.indexOf("file:")!==0)return N4(e,n,r,i);if(mk()||typeof ActiveXObject=="function")return B4(e,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function Uu(t){return Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uu(t)}function $4(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rb(t,e){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};$4(this,t),this.services=e,this.options=n,this.allOptions=r,this.type="backend",this.init(e,n,r)}return z4(t,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=Wv(i,this.options||{},j4()),this.allOptions=a,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,a,s){var u=this,c=this.options.loadPath;typeof this.options.loadPath=="function"&&(c=this.options.loadPath(n,i)),c=A4(c),c.then(function(f){if(!f)return s(null,{});var h=u.services.interpolator.interpolate(f,{lng:n.join("+"),ns:i.join("+")});u.loadUrl(h,s,r,a)})}},{key:"loadUrl",value:function(n,r,i,a){var s=this;this.options.request(this.options,n,void 0,function(u,c){if(c&&(c.status>=500&&c.status<600||!c.status))return r("failed loading "+n+"; status code: "+c.status,!0);if(c&&c.status>=400&&c.status<500)return r("failed loading "+n+"; status code: "+c.status,!1);if(!c&&u&&u.message&&u.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+u.message,!0);if(u)return r(u,!1);var f,h;try{typeof c.data=="string"?f=s.options.parse(c.data,i,a):f=c.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,a,s){var u=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,i,a),f=0,h=[],p=[];n.forEach(function(g){var y=u.options.addPath;typeof u.options.addPath=="function"&&(y=u.options.addPath(g,r));var v=u.services.interpolator.interpolate(y,{lng:g,ns:r});u.options.request(u.options,v,c,function(w,x){f+=1,h.push(w),p.push(x),f===n.length&&typeof s=="function"&&s(h,p)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,a=r.languageUtils,s=r.logger,u=i.language;if(!(u&&u.toLowerCase()==="cimode")){var c=[],f=function(p){var g=a.toResolveHierarchy(p);g.forEach(function(y){c.indexOf(y)<0&&c.push(y)})};f(u),this.allOptions.preload&&this.allOptions.preload.forEach(function(h){return f(h)}),c.forEach(function(h){n.allOptions.ns.forEach(function(p){i.read(h,p,"read",null,null,function(g,y){g&&s.warn("loading namespace ".concat(p," for language ").concat(h," failed"),g),!g&&y&&s.log("loaded namespace ".concat(p," for language ").concat(h),y),i.loaded("".concat(h,"|").concat(p),g,y)})})})}}}]),t}();Sk.type="backend";function H4(){if(console&&console.warn){for(var t,e=arguments.length,n=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,a=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var s=function(c,f){var h=e.services.backendConnector.state["".concat(c,"|").concat(f)];return h===-1||h===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!s(e.isLanguageChangingTo,t)?!1:!!(e.hasResourceBundle(r,t)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||s(r,t)&&(!i||s(a,t)))}function V4(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return qv("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(t,{precheck:function(a,s){if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&a.services.backendConnector.backend&&a.isLanguageChangingTo&&!s(a.isLanguageChangingTo,t))return!1}}):W4(t,e,n)}var q4=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,K4={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Y4=function(e){return K4[e]},X4=function(e){return e.replace(q4,Y4)};function ob(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sb(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Kv=sb(sb({},Kv),t)}function J4(){return Kv}var _k;function Z4(t){_k=t}function eB(){return _k}var tB={type:"3rdParty",init:function(e){Q4(e.options.react),Z4(e)}},nB=be.createContext(),rB=function(){function t(){Sr(this,t),this.usedNamespaces={}}return _r(t,[{key:"addUsedNamespaces",value:function(n){var r=this;n.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),t}();function iB(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,a,s,u=[],c=!0,f=!1;try{if(a=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(h){f=!0,i=h}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(f)throw i}}return u}}function aB(t,e){return sk(t)||iB(t,e)||lk(t,e)||uk()}function lb(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function km(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},n=e.i18n,r=be.useContext(nB)||{},i=r.i18n,a=r.defaultNS,s=n||i||eB();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new rB),!s){qv("You will need to pass in an i18next instance by using initReactI18next");var u=function(X,K){return typeof K=="string"?K:K&&gr(K)==="object"&&typeof K.defaultValue=="string"?K.defaultValue:Array.isArray(X)?X[X.length-1]:X},c=[u,{},!1];return c.t=u,c.i18n={},c.ready=!1,c}s.options.react&&s.options.react.wait!==void 0&&qv("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var f=km(km(km({},J4()),s.options.react),e),h=f.useSuspense,p=f.keyPrefix,g=t||a||s.options&&s.options.defaultNS;g=typeof g=="string"?[g]:g||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(g);var y=(s.isInitialized||s.initializedStoreOnce)&&g.every(function(U){return V4(U,s,f)});function v(){return s.getFixedT(null,f.nsMode==="fallback"?g:g[0],p)}var w=be.useState(v),x=aB(w,2),_=x[0],S=x[1],C=g.join(),O=oB(C),I=be.useRef(!0);be.useEffect(function(){var U=f.bindI18n,X=f.bindI18nStore;I.current=!0,!y&&!h&&ab(s,g,function(){I.current&&S(v)}),y&&O&&O!==C&&I.current&&S(v);function K(){I.current&&S(v)}return U&&s&&s.on(U,K),X&&s&&s.store.on(X,K),function(){I.current=!1,U&&s&&U.split(" ").forEach(function(te){return s.off(te,K)}),X&&s&&X.split(" ").forEach(function(te){return s.store.off(te,K)})}},[s,C]);var L=be.useRef(!0);be.useEffect(function(){I.current&&!L.current&&S(v),L.current=!1},[s,p]);var D=[_,s,y];if(D.t=_,D.i18n=s,D.ready=y,y||!y&&!h)return D;throw new Promise(function(U){ab(s,g,function(){U()})})}Ae.use(Sk).use(pk).use(tB).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const lB={isConnected:!1,isProcessing:!1,log:[],shouldShowLogViewer:!1,shouldDisplayInProgressType:"latents",shouldDisplayGuides:!0,isGFPGANAvailable:!0,isESRGANAvailable:!0,socketId:"",shouldConfirmOnDelete:!0,openAccordions:[0],currentStep:0,totalSteps:0,currentIteration:0,totalIterations:0,currentStatus:Ae.isInitialized?Ae.t("common.statusDisconnected"):"Disconnected",currentStatusHasSteps:!1,model:"",model_id:"",model_hash:"",app_id:"",app_version:"",model_list:{},infill_methods:[],hasError:!1,wasErrorSeen:!0,isCancelable:!0,saveIntermediatesInterval:5,enableImageDebugging:!1,toastQueue:[],searchFolder:null,foundModels:null,openModel:null,cancelOptions:{cancelType:"immediate",cancelAfter:null}},wk=vo({name:"system",initialState:lB,reducers:{setShouldDisplayInProgressType:(t,e)=>{t.shouldDisplayInProgressType=e.payload},setIsProcessing:(t,e)=>{t.isProcessing=e.payload},setCurrentStatus:(t,e)=>{t.currentStatus=e.payload},setSystemStatus:(t,e)=>({...t,...e.payload}),errorOccurred:t=>{t.hasError=!0,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusError"),t.wasErrorSeen=!1},errorSeen:t=>{t.hasError=!1,t.wasErrorSeen=!0,t.currentStatus=t.isConnected?Ae.t("common.statusConnected"):Ae.t("common.statusDisconnected")},addLogEntry:(t,e)=>{const{timestamp:n,message:r,level:i}=e.payload,s={timestamp:n,message:r,level:i||"info"};t.log.push(s)},setShouldShowLogViewer:(t,e)=>{t.shouldShowLogViewer=e.payload},setIsConnected:(t,e)=>{t.isConnected=e.payload,t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.hasError=!1},setSocketId:(t,e)=>{t.socketId=e.payload},setShouldConfirmOnDelete:(t,e)=>{t.shouldConfirmOnDelete=e.payload},setOpenAccordions:(t,e)=>{t.openAccordions=e.payload},setSystemConfig:(t,e)=>({...t,...e.payload}),setShouldDisplayGuides:(t,e)=>{t.shouldDisplayGuides=e.payload},processingCanceled:t=>{t.isProcessing=!1,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusProcessingCanceled")},generationRequested:t=>{t.isProcessing=!0,t.isCancelable=!0,t.currentStep=0,t.totalSteps=0,t.currentIteration=0,t.totalIterations=0,t.currentStatusHasSteps=!1,t.currentStatus=Ae.t("common.statusPreparing")},setModelList:(t,e)=>{t.model_list=e.payload},setIsCancelable:(t,e)=>{t.isCancelable=e.payload},modelChangeRequested:t=>{t.currentStatus=Ae.t("common.statusLoadingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelConvertRequested:t=>{t.currentStatus=Ae.t("common.statusConvertingModel"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},modelMergingRequested:t=>{t.currentStatus=Ae.t("common.statusMergingModels"),t.isCancelable=!1,t.isProcessing=!0,t.currentStatusHasSteps=!1},setSaveIntermediatesInterval:(t,e)=>{t.saveIntermediatesInterval=e.payload},setEnableImageDebugging:(t,e)=>{t.enableImageDebugging=e.payload},addToast:(t,e)=>{t.toastQueue.push(e.payload)},clearToastQueue:t=>{t.toastQueue=[]},setProcessingIndeterminateTask:(t,e)=>{t.isProcessing=!0,t.currentStatus=e.payload,t.currentStatusHasSteps=!1},setSearchFolder:(t,e)=>{t.searchFolder=e.payload},setFoundModels:(t,e)=>{t.foundModels=e.payload},setOpenModel:(t,e)=>{t.openModel=e.payload},setCancelType:(t,e)=>{t.cancelOptions.cancelType=e.payload},setCancelAfter:(t,e)=>{t.cancelOptions.cancelAfter=e.payload}}}),{setShouldDisplayInProgressType:eH,setIsProcessing:ei,addLogEntry:Gt,setShouldShowLogViewer:tH,setIsConnected:ub,setSocketId:nH,setShouldConfirmOnDelete:rH,setOpenAccordions:iH,setSystemStatus:uB,setCurrentStatus:ns,setSystemConfig:cB,setShouldDisplayGuides:aH,processingCanceled:fB,errorOccurred:cb,errorSeen:oH,setModelList:rs,setIsCancelable:If,modelChangeRequested:dB,modelConvertRequested:hB,modelMergingRequested:pB,setSaveIntermediatesInterval:sH,setEnableImageDebugging:lH,generationRequested:gB,addToast:zl,clearToastQueue:uH,setProcessingIndeterminateTask:cH,setSearchFolder:mB,setFoundModels:vB,setOpenModel:fH,setCancelType:dH,setCancelAfter:hH}=wk.actions,yB=wk.reducer,bk=["txt2img","img2img","unifiedCanvas","nodes","postprocess","training"],SB={activeTab:0,currentTheme:"dark",parametersPanelScrollPosition:0,shouldHoldParametersPanelOpen:!1,shouldPinParametersPanel:!0,shouldShowParametersPanel:!0,shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,addNewModelUIOption:null},_B=SB,Ck=vo({name:"ui",initialState:_B,reducers:{setActiveTab:(t,e)=>{typeof e.payload=="number"?t.activeTab=e.payload:t.activeTab=bk.indexOf(e.payload)},setCurrentTheme:(t,e)=>{t.currentTheme=e.payload},setParametersPanelScrollPosition:(t,e)=>{t.parametersPanelScrollPosition=e.payload},setShouldPinParametersPanel:(t,e)=>{t.shouldPinParametersPanel=e.payload},setShouldShowParametersPanel:(t,e)=>{t.shouldShowParametersPanel=e.payload},setShouldHoldParametersPanelOpen:(t,e)=>{t.shouldHoldParametersPanelOpen=e.payload},setShouldShowImageDetails:(t,e)=>{t.shouldShowImageDetails=e.payload},setShouldUseCanvasBetaLayout:(t,e)=>{t.shouldUseCanvasBetaLayout=e.payload},setShouldShowExistingModelsInSearch:(t,e)=>{t.shouldShowExistingModelsInSearch=e.payload},setShouldUseSliders:(t,e)=>{t.shouldUseSliders=e.payload},setAddNewModelUIOption:(t,e)=>{t.addNewModelUIOption=e.payload}}}),{setActiveTab:pH,setCurrentTheme:gH,setParametersPanelScrollPosition:mH,setShouldHoldParametersPanelOpen:vH,setShouldPinParametersPanel:yH,setShouldShowParametersPanel:SH,setShouldShowImageDetails:_H,setShouldUseCanvasBetaLayout:wH,setShouldShowExistingModelsInSearch:bH,setShouldUseSliders:CH,setAddNewModelUIOption:xH}=Ck.actions,wB=Ck.reducer,di=Object.create(null);di.open="0";di.close="1";di.ping="2";di.pong="3";di.message="4";di.upgrade="5";di.noop="6";const pd=Object.create(null);Object.keys(di).forEach(t=>{pd[di[t]]=t});const bB={type:"error",data:"parser error"},CB=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",xB=typeof ArrayBuffer=="function",kB=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,xk=({type:t,data:e},n,r)=>CB&&e instanceof Blob?n?r(e):fb(e,r):xB&&(e instanceof ArrayBuffer||kB(e))?n?r(e):fb(new Blob([e]),r):r(di[t]+(e||"")),fb=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)},db="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",eu=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let e=t.length*.75,n=t.length,r,i=0,a,s,u,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const f=new ArrayBuffer(e),h=new Uint8Array(f);for(r=0;r>4,h[i++]=(s&15)<<4|u>>2,h[i++]=(u&3)<<6|c&63;return f},PB=typeof ArrayBuffer=="function",kk=(t,e)=>{if(typeof t!="string")return{type:"message",data:Ek(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:OB(t.substring(1),e)}:pd[n]?t.length>1?{type:pd[n],data:t.substring(1)}:{type:pd[n]}:bB},OB=(t,e)=>{if(PB){const n=EB(t);return Ek(n,e)}else return{base64:!0,data:t}},Ek=(t,e)=>{switch(e){case"blob":return t instanceof ArrayBuffer?new Blob([t]):t;case"arraybuffer":default:return t}},Pk=String.fromCharCode(30),TB=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((a,s)=>{xk(a,!1,u=>{r[s]=u,++i===n&&e(r.join(Pk))})})},RB=(t,e)=>{const n=t.split(Pk),r=[];for(let i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function Tk(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const IB=fr.setTimeout,LB=fr.clearTimeout;function Jh(t,e){e.useNativeTimers?(t.setTimeoutFn=IB.bind(fr),t.clearTimeoutFn=LB.bind(fr)):(t.setTimeoutFn=fr.setTimeout.bind(fr),t.clearTimeoutFn=fr.clearTimeout.bind(fr))}const MB=1.33;function DB(t){return typeof t=="string"?NB(t):Math.ceil((t.byteLength||t.size)*MB)}function NB(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}class BB extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Rk extends Rt{constructor(e){super(),this.writable=!1,Jh(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,n,r){return super.emitReserved("error",new BB(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=kk(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}}const Ak="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Yv=64,FB={};let hb=0,Lf=0,pb;function gb(t){let e="";do e=Ak[t%Yv]+e,t=Math.floor(t/Yv);while(t>0);return e}function Ik(){const t=gb(+new Date);return t!==pb?(hb=0,pb=t):t+"."+gb(hb++)}for(;Lf{this.readyState="paused",e()};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(e){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)};RB(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,TB(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.query||{};const n=this.opts.secure?"https":"http";let r="";this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Ik()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.opts.port&&(n==="https"&&Number(this.opts.port)!==443||n==="http"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port);const i=Lk(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}request(e={}){return Object.assign(e,{xd:this.xd,xs:this.xs},this.opts),new ui(this.uri(),e)}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class ui extends Rt{constructor(e,n){super(),Jh(this,n),this.opts=n,this.method=n.method||"GET",this.uri=e,this.async=n.async!==!1,this.data=n.data!==void 0?n.data:null,this.create()}create(){const e=Tk(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this.opts.xd,e.xscheme=!!this.opts.xs;const n=this.xhr=new Dk(e);try{n.open(this.method,this.uri,this.async);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ui.requestsCount++,ui.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=GB,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ui.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}ui.requestsCount=0;ui.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",mb);else if(typeof addEventListener=="function"){const t="onpagehide"in fr?"pagehide":"unload";addEventListener(t,mb,!1)}}function mb(){for(let t in ui.requests)ui.requests.hasOwnProperty(t)&&ui.requests[t].abort()}const Nk=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0))(),Mf=fr.WebSocket||fr.MozWebSocket,vb=!0,HB="arraybuffer",yb=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WB extends Rk{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),n=this.opts.protocols,r=yb?{}:Tk(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=vb&&!yb?n?new Mf(e,n):new Mf(e):new Mf(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType||HB,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n{const s={};try{vb&&this.ws.send(a)}catch{}i&&Nk(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){let e=this.query||{};const n=this.opts.secure?"wss":"ws";let r="";this.opts.port&&(n==="wss"&&Number(this.opts.port)!==443||n==="ws"&&Number(this.opts.port)!==80)&&(r=":"+this.opts.port),this.opts.timestampRequests&&(e[this.opts.timestampParam]=Ik()),this.supportsBinary||(e.b64=1);const i=Lk(e),a=this.opts.hostname.indexOf(":")!==-1;return n+"://"+(a?"["+this.opts.hostname+"]":this.opts.hostname)+r+this.opts.path+(i.length?"?"+i:"")}check(){return!!Mf}}const VB={websocket:WB,polling:jB},qB=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,KB=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xv(t){const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=qB.exec(t||""),a={},s=14;for(;s--;)a[KB[s]]=i[s]||"";return n!=-1&&r!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=YB(a,a.path),a.queryKey=XB(a,a.query),a}function YB(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function XB(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}let Bk=class os extends Rt{constructor(e,n={}){super(),this.writeBuffer=[],e&&typeof e=="object"&&(n=e,e=null),e?(e=Xv(e),n.hostname=e.host,n.secure=e.protocol==="https"||e.protocol==="wss",n.port=e.port,e.query&&(n.query=e.query)):n.host&&(n.hostname=Xv(n.host).host),Jh(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"],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:!0},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=$B(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(e){const n=Object.assign({},this.opts.query);n.EIO=Ok,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts.transportOptions[e],this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port});return new VB[e](r)}open(){let e;if(this.opts.rememberUpgrade&&os.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.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(e){let n=this.createTransport(e),r=!1;os.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!r)if(p.type==="pong"&&p.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;os.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=n.name,this.emitReserved("upgradeError",g)}}))};function a(){r||(r=!0,h(),n.close(),n=null)}const s=p=>{const g=new Error("probe error: "+p);g.transport=n.name,a(),this.emitReserved("upgradeError",g)};function u(){s("transport closed")}function c(){s("socket closed")}function f(p){n&&p.name!==n.name&&a()}const h=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",u),this.off("close",c),this.off("upgrading",f)};n.once("open",i),n.once("error",s),n.once("close",u),this.once("close",c),this.once("upgrading",f),n.open()}onOpen(){if(this.readyState="open",os.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const n=this.upgrades.length;for(;e{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 e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.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(e,n,r){return this.sendPacket("message",e,n,r),this}send(e,n,r){return this.sendPacket("message",e,n,r),this}sendPacket(e,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 a={type:e,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},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():e()}):this.upgrading?r():e()),this}onError(e){os.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,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",e,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const n=[];let r=0;const i=e.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Fk=Object.prototype.toString,eF=typeof Blob=="function"||typeof Blob<"u"&&Fk.call(Blob)==="[object BlobConstructor]",tF=typeof File=="function"||typeof File<"u"&&Fk.call(File)==="[object FileConstructor]";function T0(t){return JB&&(t instanceof ArrayBuffer||ZB(t))||eF&&t instanceof Blob||tF&&t instanceof File}function gd(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.num0;case Be.ACK:case Be.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class oF{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=rF(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const sF=Object.freeze(Object.defineProperty({__proto__:null,Decoder:R0,Encoder:aF,get PacketType(){return Be},protocol:iF},Symbol.toStringTag,{value:"Module"}));function Dr(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const lF=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class $k extends Rt{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Dr(e,"open",this.onopen.bind(this)),Dr(e,"packet",this.onpacket.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){if(lF.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const r={type:Be.EVENT,data:n};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const s=this.ids++,u=n.pop();this._registerAckCallback(s,u),r.id=s}const i=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!i||!this.connected)||(this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r)),this.flags={},this}_registerAckCallback(e,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[e]=n;return}const a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let s=0;s{this.io.clearTimeoutFn(a),n.apply(this,[null,...s])}}emitWithAck(e,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,a)=>{n.push((s,u)=>r?s?a(s):i(u):i(s)),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...a)=>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,...a)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Be.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 Be.EVENT:case Be.BINARY_EVENT:this.onevent(e);break;case Be.ACK:case Be.BINARY_ACK:this.onack(e);break;case Be.DISCONNECT:this.ondisconnect();break;case Be.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Be.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(n.apply(this,e.data),delete this.acks[e.id])}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}Vs.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};Vs.prototype.reset=function(){this.attempts=0};Vs.prototype.setMin=function(t){this.ms=t};Vs.prototype.setMax=function(t){this.max=t};Vs.prototype.setJitter=function(t){this.jitter=t};class Zv extends Rt{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Jh(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 Vs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||sF;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Bk(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Dr(n,"open",function(){r.onopen(),e&&e()}),a=Dr(n,"error",s=>{r.cleanup(),r._readyState="closed",this.emitReserved("error",s),e?e(s):r.maybeReconnectOnOpen()});if(this._timeout!==!1){const s=this._timeout;s===0&&i();const u=this.setTimeoutFn(()=>{i(),n.close(),n.emit("error",new Error("timeout"))},s);this.opts.autoUnref&&u.unref(),this.subs.push(function(){clearTimeout(u)})}return this.subs.push(i),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Dr(e,"ping",this.onping.bind(this)),Dr(e,"data",this.ondata.bind(this)),Dr(e,"error",this.onerror.bind(this)),Dr(e,"close",this.onclose.bind(this)),Dr(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Nk(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new $k(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;re()),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(e,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=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(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(function(){clearTimeout(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Gl={};function md(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=QB(t,e.path||"/socket.io"),r=n.source,i=n.id,a=n.path,s=Gl[i]&&a in Gl[i].nsps,u=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let c;return u?c=new Zv(r,e):(Gl[i]||(Gl[i]=new Zv(r,e)),c=Gl[i]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(md,{Manager:Zv,Socket:$k,io:md,connect:md});const kH=["ddim","plms","k_lms","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_dpmpp_2_a","k_euler","k_euler_a","k_heun"],EH=["ddim","plms","k_lms","dpmpp_2","k_dpm_2","k_dpm_2_a","k_dpmpp_2","k_euler","k_euler_a","k_heun"],PH=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],OH=[64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600,1664,1728,1792,1856,1920,1984,2048],TH=[{key:"2x",value:2},{key:"4x",value:4}],uF=0,cF=4294967295,RH=["gfpgan","codeformer"],AH=[{key:"None",value:"none"},{key:"Fast",value:"latents"},{key:"Accurate",value:"full-res"}];var fF=Math.PI/180;function dF(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Os=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},pe={_global:Os,version:"8.4.2",isBrowser:dF(),isUnminified:/param/.test(function(t){}.toString()),dblClickWindow:400,getAngle(t){return pe.angleDeg?t*fF:t},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 pe.DD.isDragging},isDragReady(){return!!pe.DD.node},releaseCanvasOnDestroy:!0,document:Os.document,_injectGlobal(t){Os.Konva=t}},yt=t=>{pe[t.prototype.getClassName()]=t};pe._injectGlobal(pe);class Hn{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.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 Hn(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var n=this.m;return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}translate(e,n){return this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n,this}scale(e,n){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n,this}rotate(e){var n=Math.cos(e),r=Math.sin(e),i=this.m[0]*n+this.m[2]*r,a=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,u=this.m[1]*-r+this.m[3]*n;return this.m[0]=i,this.m[1]=a,this.m[2]=s,this.m[3]=u,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,n){var r=this.m[0]+this.m[2]*n,i=this.m[1]+this.m[3]*n,a=this.m[2]+this.m[0]*e,s=this.m[3]+this.m[1]*e;return this.m[0]=r,this.m[1]=i,this.m[2]=a,this.m[3]=s,this}multiply(e){var n=this.m[0]*e.m[0]+this.m[2]*e.m[1],r=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],a=this.m[1]*e.m[2]+this.m[3]*e.m[3],s=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],u=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,r=-this.m[1]*e,i=-this.m[2]*e,a=this.m[0]*e,s=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),u=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=i,this.m[3]=a,this.m[4]=s,this.m[5]=u,this}getMatrix(){return this.m}decompose(){var e=this.m[0],n=this.m[1],r=this.m[2],i=this.m[3],a=this.m[4],s=this.m[5],u=e*i-n*r;let c={x:a,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||n!=0){var f=Math.sqrt(e*e+n*n);c.rotation=n>0?Math.acos(e/f):-Math.acos(e/f),c.scaleX=f,c.scaleY=u/f,c.skewX=(e*r+n*i)/u,c.skewY=0}else if(r!=0||i!=0){var h=Math.sqrt(r*r+i*i);c.rotation=Math.PI/2-(i>0?Math.acos(-r/h):-Math.acos(r/h)),c.scaleX=u/h,c.scaleY=h,c.skewX=0,c.skewY=(e*r+n*i)/u}return c.rotation=G._getRotation(c.rotation),c}}var hF="[object Array]",pF="[object Number]",gF="[object String]",mF="[object Boolean]",vF=Math.PI/180,yF=180/Math.PI,Em="#",SF="",_F="0",wF="Konva warning: ",Sb="Konva error: ",bF="rgb(",Pm={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]},CF=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Df=[];const xF=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,60)},G={_isElement(t){return!!(t&&t.nodeType==1)},_isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject(t){return!!t&&t.constructor===Object},_isArray(t){return Object.prototype.toString.call(t)===hF},_isNumber(t){return Object.prototype.toString.call(t)===pF&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===gF},_isBoolean(t){return Object.prototype.toString.call(t)===mF},isObject(t){return t instanceof Object},isValidSelector(t){if(typeof t!="string")return!1;var e=t[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(t){return t===0||t>0?1:-1},requestAnimFrame(t){Df.push(t),Df.length===1&&xF(function(){const e=Df;Df=[],e.forEach(function(n){n()})})},createCanvasElement(){var t=document.createElement("canvas");try{t.style=t.style||{}}catch{}return t},createImageElement(){return document.createElement("img")},_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){var n=G.createImageElement();n.onload=function(){e(n)},n.src=t},_rgbToHex(t,e,n){return((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)},_hexToRgb(t){t=t.replace(Em,SF);var e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){for(var t=(Math.random()*16777215<<0).toString(16);t.length<6;)t=_F+t;return Em+t},getRGB(t){var e;return t in Pm?(e=Pm[t],{r:e[0],g:e[1],b:e[2]}):t[0]===Em?this._hexToRgb(t.substring(1)):t.substr(0,4)===bF?(e=CF.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA(t){return t=t||"black",G._namedColorToRBA(t)||G._hex3ColorToRGBA(t)||G._hex4ColorToRGBA(t)||G._hex6ColorToRGBA(t)||G._hex8ColorToRGBA(t)||G._rgbColorToRGBA(t)||G._rgbaColorToRGBA(t)||G._hslColorToRGBA(t)},_namedColorToRBA(t){var e=Pm[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(t.indexOf("rgb(")===0){t=t.match(/rgb\(([^)]+)\)/)[1];var e=t.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(t.indexOf("rgba(")===0){t=t.match(/rgba\(([^)]+)\)/)[1];var e=t.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if(t[0]==="#"&&t.length===9)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if(t[0]==="#"&&t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if(t[0]==="#"&&t.length===5)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if(t[0]==="#"&&t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),r=Number(n[0])/360,i=Number(n[1])/100,a=Number(n[2])/100;let s,u,c;if(i===0)return c=a*255,{r:Math.round(c),g:Math.round(c),b:Math.round(c),a:1};a<.5?s=a*(1+i):s=a+i-a*i;const f=2*a-s,h=[0,0,0];for(let p=0;p<3;p++)u=r+1/3*-(p-1),u<0&&u++,u>1&&u--,6*u<1?c=f+(s-f)*6*u:2*u<1?c=s:3*u<2?c=f+(s-f)*(2/3-u)*6:c=f,h[p]=c*255;return{r:Math.round(h[0]),g:Math.round(h[1]),b:Math.round(h[2]),a:1}}},haveIntersection(t,e){return!(e.x>t.x+t.width||e.x+e.widtht.y+t.height||e.y+e.height1?(s=n,u=r,c=(n-i)*(n-i)+(r-a)*(r-a)):(s=t+h*(n-t),u=e+h*(r-e),c=(s-i)*(s-i)+(u-a)*(u-a))}return[s,u,c]},_getProjectionToLine(t,e,n){var r=G.cloneObject(t),i=Number.MAX_VALUE;return e.forEach(function(a,s){if(!(!n&&s===e.length-1)){var u=e[(s+1)%e.length],c=G._getProjectionToSegment(a.x,a.y,u.x,u.y,t.x,t.y),f=c[0],h=c[1],p=c[2];pe.length){var s=e;e=t,t=s}for(r=0;r{e.width=0,e.height=0})},drawRoundedRectPath(t,e,n,r){let i=0,a=0,s=0,u=0;typeof r=="number"?i=a=s=u=Math.min(r,e/2,n/2):(i=Math.min(r[0]||0,e/2,n/2),a=Math.min(r[1]||0,e/2,n/2),u=Math.min(r[2]||0,e/2,n/2),s=Math.min(r[3]||0,e/2,n/2)),t.moveTo(i,0),t.lineTo(e-a,0),t.arc(e-a,a,a,Math.PI*3/2,0,!1),t.lineTo(e,n-u),t.arc(e-u,n-u,u,0,Math.PI/2,!1),t.lineTo(s,n),t.arc(s,n-s,s,Math.PI/2,Math.PI,!1),t.lineTo(0,i),t.arc(i,i,i,Math.PI,Math.PI*3/2,!1)}};function Da(t){return G._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||G._isBoolean(t)?t:Object.prototype.toString.call(t)}function zk(t){return t>255?255:t<0?0:Math.round(t)}function le(){if(pe.isUnminified)return function(t,e){return G._isNumber(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function A0(t){if(pe.isUnminified)return function(e,n){let r=G._isNumber(e),i=G._isArray(e)&&e.length==t;return!r&&!i&&G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+t+")"),e}}function I0(){if(pe.isUnminified)return function(t,e){var n=G._isNumber(t),r=t==="auto";return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function qs(){if(pe.isUnminified)return function(t,e){return G._isString(t)||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function Gk(){if(pe.isUnminified)return function(t,e){const n=G._isString(t),r=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||r||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function kF(){if(pe.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(G._isArray(t)?t.forEach(function(r){G._isNumber(r)||G.warn('"'+e+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function jr(){if(pe.isUnminified)return function(t,e){var n=t===!0||t===!1;return n||G.warn(Da(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function EF(t){if(pe.isUnminified)return function(e,n){return e==null||G.isObject(e)||G.warn(Da(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}var Ul="get",jl="set";const A={addGetterSetter(t,e,n,r,i){A.addGetter(t,e,n),A.addSetter(t,e,r,i),A.addOverloadedGetterSetter(t,e)},addGetter(t,e,n){var r=Ul+G._capitalize(e);t.prototype[r]=t.prototype[r]||function(){var i=this.attrs[e];return i===void 0?n:i}},addSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]||A.overWriteSetter(t,e,n,r)},overWriteSetter(t,e,n,r){var i=jl+G._capitalize(e);t.prototype[i]=function(a){return n&&a!==void 0&&a!==null&&(a=n.call(this,a,e)),this._setAttr(e,a),r&&r.call(this),this}},addComponentsGetterSetter(t,e,n,r,i){var a=n.length,s=G._capitalize,u=Ul+s(e),c=jl+s(e),f,h;t.prototype[u]=function(){var g={};for(f=0;f{this._setAttr(e+s(w),void 0)}),this._fireChangeEvent(e,y,g),i&&i.call(this),this},A.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){var n=G._capitalize(e),r=jl+n,i=Ul+n;t.prototype[e]=function(){return arguments.length?(this[r](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(t,e,n,r){G.error("Adding deprecated "+e);var i=Ul+G._capitalize(e),a=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[i]=function(){G.error(a);var s=this.attrs[e];return s===void 0?n:s},A.addSetter(t,e,r,function(){G.error(a)}),A.addOverloadedGetterSetter(t,e)},backCompat(t,e){G.each(e,function(n,r){var i=t.prototype[r],a=Ul+G._capitalize(n),s=jl+G._capitalize(n);function u(){i.apply(this,arguments),G.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}t.prototype[n]=u,t.prototype[a]=u,t.prototype[s]=u})},afterSetFilter(){this._filterUpToDate=!1}};function PF(t){var e=[],n=t.length,r=G,i,a;for(i=0;itypeof h=="number"?Math.floor(h):h)),a+=OF+f.join(_b)+TF)):(a+=u.property,e||(a+=MF+u.val)),a+=IF;return a}clearTrace(){this.traceArr=[]}_trace(e){var n=this.traceArr,r;n.push(e),r=n.length,r>=NF&&n.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){var n=e.getLineCap();n&&this.setAttr("lineCap",n)}_applyOpacity(e){var n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){var n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(e,n){this._context[e]=n}arc(e,n,r,i,a,s){this._context.arc(e,n,r,i,a,s)}arcTo(e,n,r,i,a){this._context.arcTo(e,n,r,i,a)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,r,i,a,s){this._context.bezierCurveTo(e,n,r,i,a,s)}clearRect(e,n,r,i){this._context.clearRect(e,n,r,i)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,n){var r=arguments;if(r.length===2)return this._context.createImageData(e,n);if(r.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,r,i){return this._context.createLinearGradient(e,n,r,i)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,r,i,a,s){return this._context.createRadialGradient(e,n,r,i,a,s)}drawImage(e,n,r,i,a,s,u,c,f){var h=arguments,p=this._context;h.length===3?p.drawImage(e,n,r):h.length===5?p.drawImage(e,n,r,i,a):h.length===9&&p.drawImage(e,n,r,i,a,s,u,c,f)}ellipse(e,n,r,i,a,s,u,c){this._context.ellipse(e,n,r,i,a,s,u,c)}isPointInPath(e,n,r,i){return r?this._context.isPointInPath(r,e,n,i):this._context.isPointInPath(e,n,i)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,n,r,i){this._context.fillRect(e,n,r,i)}strokeRect(e,n,r,i){this._context.strokeRect(e,n,r,i)}fillText(e,n,r,i){i?this._context.fillText(e,n,r,i):this._context.fillText(e,n,r)}measureText(e){return this._context.measureText(e)}getImageData(e,n,r,i){return this._context.getImageData(e,n,r,i)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,r,i){this._context.rect(e,n,r,i)}putImageData(e,n,r){this._context.putImageData(e,n,r)}quadraticCurveTo(e,n,r,i){this._context.quadraticCurveTo(e,n,r,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,r,i,a,s){this._context.setTransform(e,n,r,i,a,s)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,r,i){this._context.strokeText(e,n,r,i)}transform(e,n,r,i,a,s){this._context.transform(e,n,r,i,a,s)}translate(e,n){this._context.translate(e,n)}_enableTrace(){var e=this,n=wb.length,r=this.setAttr,i,a,s=function(u){var c=e[u],f;e[u]=function(){return a=PF(Array.prototype.slice.call(arguments,0)),f=c.apply(e,arguments),e._trace({method:u,args:a}),f}};for(i=0;i{e.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){var t;return Ge._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const e=[];Ge._dragElements.forEach((n,r)=>{const{node:i}=n,a=i.getStage();a.setPointersPositions(t),n.pointerId===void 0&&(n.pointerId=G._getFirstPointerId(t));const s=a._changedPointerPositions.find(f=>f.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){var u=i.dragDistance(),c=Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y));if(c{n.fire("dragmove",{type:"dragmove",target:n,evt:t},!0)})},_endDragBefore(t){const e=[];Ge._dragElements.forEach(n=>{const{node:r}=n,i=r.getStage();if(t&&i.setPointersPositions(t),!i._changedPointerPositions.find(u=>u.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(Ge.justDragged=!0,pe._mouseListenClick=!1,pe._touchListenClick=!1,pe._pointerListenClick=!1,n.dragStatus="stopped");const s=n.node.getLayer()||n.node instanceof pe.Stage&&n.node;s&&e.indexOf(s)===-1&&e.push(s)}),e.forEach(n=>{n.draw()})},_endDragAfter(t){Ge._dragElements.forEach((e,n)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),e.dragStatus!=="dragging"&&Ge._dragElements.delete(n)})}};pe.isBrowser&&(window.addEventListener("mouseup",Ge._endDragBefore,!0),window.addEventListener("touchend",Ge._endDragBefore,!0),window.addEventListener("mousemove",Ge._drag),window.addEventListener("touchmove",Ge._drag),window.addEventListener("mouseup",Ge._endDragAfter,!1),window.addEventListener("touchend",Ge._endDragAfter,!1));var vd="absoluteOpacity",Bf="allEventListeners",Ii="absoluteTransform",bb="absoluteScale",Xa="canvas",zF="Change",GF="children",UF="konva",ey="listening",Cb="mouseenter",xb="mouseleave",kb="set",Eb="Shape",yd=" ",Pb="stage",ua="transform",jF="Stage",ty="visible",HF=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(yd);let WF=1;class se{constructor(e){this._id=WF++,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(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===ua||e===Ii)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){var r=this._cache.get(e),i=e===ua||e===Ii,a=r===void 0||i&&r.dirty===!0;return a&&(r=n.call(this),this._cache.set(e,r)),r}_calculate(e,n,r){if(!this._attachedDepsListeners.get(e)){const i=n.map(a=>a+"Change.konva").join(yd);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,r)}_getCanvasCache(){return this._cache.get(Xa)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Ii&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Xa)){const{scene:e,filter:n,hit:r}=this._cache.get(Xa);G.releaseCanvas(e,n,r),this._cache.delete(Xa)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var n=e||{},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),a=Math.ceil(n.height||r.height),s=n.pixelRatio,u=n.x===void 0?Math.floor(r.x):n.x,c=n.y===void 0?Math.floor(r.y):n.y,f=n.offset||0,h=n.drawBorder||!1,p=n.hitCanvasPixelRatio||1;if(!i||!a){G.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=f*2+1,a+=f*2+1,u-=f,c-=f;var g=new Ts({pixelRatio:s,width:i,height:a}),y=new Ts({pixelRatio:s,width:0,height:0}),v=new L0({pixelRatio:p,width:i,height:a}),w=g.getContext(),x=v.getContext();return v.isCache=!0,g.isCache=!0,this._cache.delete(Xa),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(g.getContext()._context.imageSmoothingEnabled=!1,y.getContext()._context.imageSmoothingEnabled=!1),w.save(),x.save(),w.translate(-u,-c),x.translate(-u,-c),this._isUnderCache=!0,this._clearSelfAndDescendantCache(vd),this._clearSelfAndDescendantCache(bb),this.drawScene(g,this),this.drawHit(v,this),this._isUnderCache=!1,w.restore(),x.restore(),h&&(w.save(),w.beginPath(),w.rect(0,0,i,a),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),this._cache.set(Xa,{scene:g,filter:y,hit:v,x:u,y:c}),this._requestDraw(),this}isCached(){return this._cache.has(Xa)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){var r=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],i,a,s,u,c=this.getAbsoluteTransform(n);return r.forEach(function(f){var h=c.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),{x:i,y:a,width:s-i,height:u-a}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;e.drawImage(r._canvas,0,0,r.width/i,r.height/i),e.restore()}_drawCachedHitCanvas(e){var n=this._getCanvasCache(),r=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,a=i.getContext(),s,u,c,f;if(e){if(!this._filterUpToDate){var h=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(s=e.length,a.clear(),a.drawImage(r._canvas,0,0,r.getWidth()/h,r.getHeight()/h),u=a.getImageData(0,0,i.getWidth(),i.getHeight()),c=0;c{var n,r;if(!e)return this;for(n in e)n!==GF&&(r=kb+G._capitalize(n),G._isFunction(this[r])?this[r](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(ey,this._isListening)}_isListening(e){if(!this.listening())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isListening(e):!0}isVisible(){return this._getCache(ty,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const r=this.getParent();return r&&r!==e&&this!==e?r._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);var r=this.getLayer(),i=!1;Ge._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(i=!0)});var a=!n&&!pe.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!a}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),n=this,r=0,i,a,s,u;function c(f){for(i=[],a=f.length,s=0;s0&&i[0].getDepth()<=e&&c(i)}return n.nodeType!==jF&&c(n.getStage().getChildren()),r}getDepth(){for(var e=0,n=this.parent;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(ua),this._clearSelfAndDescendantCache(Ii)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(e)}getAbsolutePosition(e){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!e&&(e=!0);var i=this.getAbsoluteTransform(e).getMatrix(),a=new Hn,s=this.offset();return a.m=i.slice(),a.translate(s.x,s.y),a.getTranslation()}setAbsolutePosition(e){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(ua);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(e.x,e.y),e={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:e.x,y:e.y}),this._clearCache(ua),this._clearSelfAndDescendantCache(Ii),this}_setTransform(e){var n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){var e={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,e}move(e){var n=e.x,r=e.y,i=this.x(),a=this.y();return n!==void 0&&(i+=n),r!==void 0&&(a+=r),this.setPosition({x:i,y:a}),this}_eachAncestorReverse(e,n){var r=[],i=this.getParent(),a,s;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(a=r.length,s=0;s0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return G.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return G.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&G.warn("Unexpected value "+e+" 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(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(vd,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},n=this.getAttrs(),r,i,a,s,u;e.attrs={};for(r in n)i=n[r],u=G.isObject(i)&&!G._isPlainObject(i)&&!G._isArray(i),!u&&(a=typeof this[r]=="function"&&this[r],delete n[r],s=a?a.call(this):null,n[r]=i,s!==i&&(e.attrs[r]=i));return e.className=this.getClassName(),G._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,r){var i=[];n&&this._isMatch(e)&&i.push(this);for(var a=this.parent;a;){if(a===r)return i;a._isMatch(e)&&i.push(a),a=a.parent}return i}isAncestorOf(e){return!1}findAncestor(e,n,r){return this.findAncestors(e,n,r)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);var n=e.replace(/ /g,"").split(","),r=n.length,i,a;for(i=0;i{try{const i=e==null?void 0:e.callback;i&&delete e.callback,G._urlToImage(this.toDataURL(e),function(a){n(a),i==null||i(a)})}catch(i){r(i)}})}toBlob(e){return new Promise((n,r)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,this.toCanvas(e).toBlob(a=>{n(a),i==null||i(a)})}catch(i){r(i)}})}setSize(e){return this.width(e.width),this.height(e.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():pe.dragDistance}_off(e,n,r){var i=this.eventListeners[e],a,s,u;for(a=0;a=0;if(r&&!this.isDragging()){var i=!1;Ge._dragElements.forEach(a=>{this.isAncestorOf(a.node)&&(i=!0)}),i||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const n=Ge._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Ge._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return G.haveIntersection(r,this.getClientRect())}static create(e,n){return G._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){var r=se.prototype.getClassName.call(e),i=e.children,a,s,u;n&&(e.attrs.container=n),pe[r]||(G.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const c=pe[r];if(a=new c(e.attrs),i)for(s=i.length,u=0;u0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(e,n){var r=[];return this._descendants(i=>{const a=i._isMatch(e);return a&&r.push(i),!!(a&&n)}),r}_descendants(e){let n=!1;const r=this.getChildren();for(const i of r){if(n=e(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(e),n))return!0}return!1}toObject(){var e=se.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){for(var n=e.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){var n=se.prototype.clone.call(this,e);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(e){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(e)&&n.push(r)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(e,n){var r=this.getLayer(),i=e||r&&r.getCanvas(),a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.scene,c=i&&i.isCache;if(!this.isVisible()&&!c)return this;if(u){a.save();var f=this.getAbsoluteTransform(n).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),this._drawCachedSceneCanvas(a),a.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=e||r&&r.hitCanvas,a=i&&i.getContext(),s=this._getCanvasCache(),u=s&&s.hit;if(u){a.save();var c=this.getAbsoluteTransform(n).getMatrix();a.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(a),a.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,r){var i,a=n&&n.getContext(),s=this.clipWidth(),u=this.clipHeight(),c=this.clipFunc(),f=s&&u||c;const h=r===this;if(f){a.save();var p=this.getAbsoluteTransform(r),g=p.getMatrix();if(a.transform(g[0],g[1],g[2],g[3],g[4],g[5]),a.beginPath(),c)c.call(this,a,this);else{var y=this.clipX(),v=this.clipY();a.rect(y,v,s,u)}a.clip(),g=p.copy().invert().getMatrix(),a.transform(g[0],g[1],g[2],g[3],g[4],g[5])}var w=!h&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";w&&(a.save(),a._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(x){x[e](n,r)}),w&&a.restore(),f&&a.restore()}getClientRect(e){var n;e=e||{};var r=e.skipTransform,i=e.relativeTo,a,s,u,c,f={x:1/0,y:1/0,width:0,height:0},h=this;(n=this.children)===null||n===void 0||n.forEach(function(w){if(w.visible()){var x=w.getClientRect({relativeTo:h,skipShadow:e.skipShadow,skipStroke:e.skipStroke});x.width===0&&x.height===0||(a===void 0?(a=x.x,s=x.y,u=x.x+x.width,c=x.y+x.height):(a=Math.min(a,x.x),s=Math.min(s,x.y),u=Math.max(u,x.x+x.width),c=Math.max(c,x.y+x.height)))}});for(var p=this.find("Shape"),g=!1,y=0;yt.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",is=t=>{const e=iu(t);if(e==="pointer")return pe.pointerEventsEnabled&&Tm.pointer;if(e==="touch")return Tm.touch;if(e==="mouse")return Tm.mouse};function Tb(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&G.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const JF="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);",Sd=[];class tp extends qn{constructor(e){super(Tb(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Sd.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{Tb(this.attrs)}),this._checkVisibility()}_validateAdd(e){const n=e.getType()==="Layer",r=e.getType()==="FastLayer";n||r||G.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===qF){if(e.charAt(0)==="."){var n=e.slice(1);e=document.getElementsByClassName(n)[0]}else{var r;e.charAt(0)!=="#"?r=e:r=e.slice(1),e=document.getElementById(r)}if(!e)throw"Can not find container in document with id "+r}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e=this.children,n=e.length,r;for(r=0;r-1&&Sd.splice(n,1),G.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(G.warn(JF),null)}_getPointerById(e){return this._pointerPositions.find(n=>n.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e=e||{},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var n=new Ts({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),r=n.getContext()._context,i=this.children;return(e.x||e.y)&&r.translate(-1*e.x,-1*e.y),i.forEach(function(a){if(a.isVisible()){var s=a._toKonvaCanvas(e);r.drawImage(s._canvas,e.x,e.y,s.getWidth()/s.getPixelRatio(),s.getHeight()/s.getPixelRatio())}}),n}getIntersection(e){if(!e)return null;var n=this.children,r=n.length,i=r-1,a;for(a=i;a>=0;a--){const s=n[a].getIntersection(e);if(s)return s}return null}_resizeDOM(){var e=this.width(),n=this.height();this.content&&(this.content.style.width=e+Ob,this.content.style.height=n+Ob),this.bufferCanvas.setSize(e,n),this.bufferHitCanvas.setSize(e,n),this.children.forEach(r=>{r.setSize({width:e,height:n}),r.draw()})}add(e,...n){if(arguments.length>1){for(var r=0;rXF&&G.warn("The stage has "+i+" 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."),e.setSize({width:this.width(),height:this.height()}),e.draw(),pe.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return jk(e,this)}setPointerCapture(e){Hk(e,this)}releaseCapture(e){mu(e)}getLayers(){return this.children}_bindContentEvents(){pe.isBrowser&&QF.forEach(([e,n])=>{this.content.addEventListener(e,r=>{this[n](r)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const n=is(e.type);this._fire(n.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let n=this[e+"targetShape"];return n&&!n.getStage()&&(n=null),n}_pointerleave(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=this._getTargetShape(r),a=!Ge.isDragging||pe.hitOnDragEnabled;i&&a?(i._fireAndBubble(n.pointerout,{evt:e}),i._fireAndBubble(n.pointerleave,{evt:e}),this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this[r+"targetShape"]=null):a&&(this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const n=is(e.type),r=iu(e.type);if(n){this.setPointersPositions(e);var i=!1;this._changedPointerPositions.forEach(a=>{var s=this.getIntersection(a);if(Ge.justDragged=!1,pe["_"+r+"ListenClick"]=!0,!(s&&s.isListening()))return;pe.capturePointerEventsEnabled&&s.setPointerCapture(a.id),this[r+"ClickStartShape"]=s,s._fireAndBubble(n.pointerdown,{evt:e,pointerId:a.id}),i=!0;const c=e.type.indexOf("touch")>=0;s.preventDefault()&&e.cancelable&&c&&e.preventDefault()}),i||this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const n=is(e.type),r=iu(e.type);if(!n)return;Ge.isDragging&&Ge.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e);var i=!Ge.isDragging||pe.hitOnDragEnabled;if(!i)return;var a={};let s=!1;var u=this._getTargetShape(r);this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c),h=c.id,p={evt:e,pointerId:h};var g=u!==f;if(g&&u&&(u._fireAndBubble(n.pointerout,Object.assign({},p),f),u._fireAndBubble(n.pointerleave,Object.assign({},p),f)),f){if(a[f._id])return;a[f._id]=!0}f&&f.isListening()?(s=!0,g&&(f._fireAndBubble(n.pointerover,Object.assign({},p),u),f._fireAndBubble(n.pointerenter,Object.assign({},p),u),this[r+"targetShape"]=f),f._fireAndBubble(n.pointermove,Object.assign({},p))):u&&(this._fire(n.pointerover,{evt:e,target:this,currentTarget:this,pointerId:h}),this[r+"targetShape"]=null)}),s||this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const n=is(e.type),r=iu(e.type);if(!n)return;this.setPointersPositions(e);const i=this[r+"ClickStartShape"],a=this[r+"ClickEndShape"];var s={};let u=!1;this._changedPointerPositions.forEach(c=>{const f=Om(c.id)||this.getIntersection(c);if(f){if(f.releaseCapture(c.id),s[f._id])return;s[f._id]=!0}const h=c.id,p={evt:e,pointerId:h};let g=!1;pe["_"+r+"InDblClickWindow"]?(g=!0,clearTimeout(this[r+"DblTimeout"])):Ge.justDragged||(pe["_"+r+"InDblClickWindow"]=!0,clearTimeout(this[r+"DblTimeout"])),this[r+"DblTimeout"]=setTimeout(function(){pe["_"+r+"InDblClickWindow"]=!1},pe.dblClickWindow),f&&f.isListening()?(u=!0,this[r+"ClickEndShape"]=f,f._fireAndBubble(n.pointerup,Object.assign({},p)),pe["_"+r+"ListenClick"]&&i&&i===f&&(f._fireAndBubble(n.pointerclick,Object.assign({},p)),g&&a&&a===f&&f._fireAndBubble(n.pointerdblclick,Object.assign({},p)))):(this[r+"ClickEndShape"]=null,pe["_"+r+"ListenClick"]&&this._fire(n.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:h}),g&&this._fire(n.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:h}))}),u||this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),pe["_"+r+"ListenClick"]=!1,e.cancelable&&r!=="touch"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ny,{evt:e}):this._fire(ny,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(ry,{evt:e}):this._fire(ry,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const n=Om(e.pointerId)||this.getIntersection(this.getPointerPosition());n&&n._fireAndBubble(Ss,M0(e)),mu(e.pointerId)}_lostpointercapture(e){mu(e.pointerId)}setPointersPositions(e){var n=this._getContentPosition(),r=null,i=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,a=>{this._pointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,a=>{this._changedPointerPositions.push({id:a.identifier,x:(a.clientX-n.left)/n.scaleX,y:(a.clientY-n.top)/n.scaleY})})):(r=(e.clientX-n.left)/n.scaleX,i=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:r,y:i},this._pointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}],this._changedPointerPositions=[{x:r,y:i,id:G._getFirstPointerId(e)}])}_setPointerPosition(e){G.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Ts({width:this.width(),height:this.height()}),this.bufferHitCanvas=new L0({pixelRatio:1,width:this.width(),height:this.height()}),!!pe.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.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"),e.appendChild(this.content),this._resizeDOM()}}cache(){return G.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(e){e.batchDraw()}),this}}tp.prototype.nodeType=VF;yt(tp);A.addGetterSetter(tp,"container");var tE="hasShadow",nE="shadowRGBA",rE="patternImage",iE="linearGradient",aE="radialGradient";let Uf;function Rm(){return Uf||(Uf=G.createCanvasElement().getContext("2d"),Uf)}const vu={};function ZF(t){t.fill()}function e$(t){t.stroke()}function t$(t){t.fill()}function n$(t){t.stroke()}function r$(){this._clearCache(tE)}function i$(){this._clearCache(nE)}function a$(){this._clearCache(rE)}function o$(){this._clearCache(iE)}function s$(){this._clearCache(aE)}class re extends se{constructor(e){super(e);let n;for(;n=G.getRandomColor(),!(n&&!(n in vu)););this.colorKey=n,vu[n]=this}getContext(){return G.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return G.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(tE,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(rE,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var e=Rm();const n=e.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){const r=new Hn;r.translate(this.fillPatternX(),this.fillPatternY()),r.rotate(pe.getAngle(this.fillPatternRotation())),r.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),r.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=r.getMatrix(),a=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);n.setTransform(a)}return n}}_getLinearGradient(){return this._getCache(iE,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var n=Rm(),r=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),a=n.createLinearGradient(r.x,r.y,i.x,i.y),s=0;sthis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var n=this.getStage(),r=n.bufferHitCanvas,i;return r.getContext().clear(),this.drawHit(r,null,!0),i=r.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data,i[3]>0}destroy(){return se.prototype.destroy.call(this),delete vu[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var n;if(!this.getStage()||!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;const i=e||this.hasFill(),a=this.hasStroke(),s=this.getAbsoluteOpacity()!==1;if(i&&a&&s)return!0;const u=this.hasShadow(),c=this.shadowForStrokeEnabled();return!!(i&&a&&u&&c)}setStrokeHitEnabled(e){G.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const n=e.skipTransform,r=e.relativeTo,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,u=i.width+s,c=i.height+s,f=!e.skipShadow&&this.hasShadow(),h=f?this.shadowOffsetX():0,p=f?this.shadowOffsetY():0,g=u+Math.abs(h),y=c+Math.abs(p),v=f&&this.shadowBlur()||0,w=g+v*2,x=y+v*2,_={width:w,height:x,x:-(s/2+v)+Math.min(h,0)+i.x,y:-(s/2+v)+Math.min(p,0)+i.y};return n?_:this._transformedRect(_,r)}drawScene(e,n){var r=this.getLayer(),i=e||r.getCanvas(),a=i.getContext(),s=this._getCanvasCache(),u=this.getSceneFunc(),c=this.hasShadow(),f,h,p,g=i.isCache,y=n===this;if(!this.isVisible()&&!y)return this;if(s){a.save();var v=this.getAbsoluteTransform(n).getMatrix();return a.transform(v[0],v[1],v[2],v[3],v[4],v[5]),this._drawCachedSceneCanvas(a),a.restore(),this}if(!u)return this;if(a.save(),this._useBufferCanvas()&&!g){f=this.getStage(),h=f.bufferCanvas,p=h.getContext(),p.clear(),p.save(),p._applyLineJoin(this);var w=this.getAbsoluteTransform(n).getMatrix();p.transform(w[0],w[1],w[2],w[3],w[4],w[5]),u.call(this,p,this),p.restore();var x=h.pixelRatio;c&&a._applyShadow(this),a._applyOpacity(this),a._applyGlobalCompositeOperation(this),a.drawImage(h._canvas,0,0,h.width/x,h.height/x)}else{if(a._applyLineJoin(this),!y){var w=this.getAbsoluteTransform(n).getMatrix();a.transform(w[0],w[1],w[2],w[3],w[4],w[5]),a._applyOpacity(this),a._applyGlobalCompositeOperation(this)}c&&a._applyShadow(this),u.call(this,a,this)}return a.restore(),this}drawHit(e,n,r=!1){if(!this.shouldDrawHit(n,r))return this;var i=this.getLayer(),a=e||i.hitCanvas,s=a&&a.getContext(),u=this.hitFunc()||this.sceneFunc(),c=this._getCanvasCache(),f=c&&c.hit;if(this.colorKey||G.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()"),f){s.save();var h=this.getAbsoluteTransform(n).getMatrix();return s.transform(h[0],h[1],h[2],h[3],h[4],h[5]),this._drawCachedHitCanvas(s),s.restore(),this}if(!u)return this;if(s.save(),s._applyLineJoin(this),!(this===n)){var g=this.getAbsoluteTransform(n).getMatrix();s.transform(g[0],g[1],g[2],g[3],g[4],g[5])}return u.call(this,s,this),s.restore(),this}drawHitFromCache(e=0){var n=this._getCanvasCache(),r=this._getCachedSceneCanvas(),i=n.hit,a=i.getContext(),s=i.getWidth(),u=i.getHeight(),c,f,h,p,g,y;a.clear(),a.drawImage(r._canvas,0,0,s,u);try{for(c=a.getImageData(0,0,s,u),f=c.data,h=f.length,p=G._hexToRgb(this.colorKey),g=0;ge?(f[g]=p.r,f[g+1]=p.g,f[g+2]=p.b,f[g+3]=255):f[g+3]=0;a.putImageData(c,0,0)}catch(v){G.error("Unable to draw hit graph from cached scene canvas. "+v.message)}return this}hasPointerCapture(e){return jk(e,this)}setPointerCapture(e){Hk(e,this)}releaseCapture(e){mu(e)}}re.prototype._fillFunc=ZF;re.prototype._strokeFunc=e$;re.prototype._fillFuncHit=t$;re.prototype._strokeFuncHit=n$;re.prototype._centroid=!1;re.prototype.nodeType="Shape";yt(re);re.prototype.eventListeners={};re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",r$);re.prototype.on.call(re.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",i$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",a$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",o$);re.prototype.on.call(re.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",s$);A.addGetterSetter(re,"stroke",void 0,Gk());A.addGetterSetter(re,"strokeWidth",2,le());A.addGetterSetter(re,"fillAfterStrokeEnabled",!1);A.addGetterSetter(re,"hitStrokeWidth","auto",I0());A.addGetterSetter(re,"strokeHitEnabled",!0,jr());A.addGetterSetter(re,"perfectDrawEnabled",!0,jr());A.addGetterSetter(re,"shadowForStrokeEnabled",!0,jr());A.addGetterSetter(re,"lineJoin");A.addGetterSetter(re,"lineCap");A.addGetterSetter(re,"sceneFunc");A.addGetterSetter(re,"hitFunc");A.addGetterSetter(re,"dash");A.addGetterSetter(re,"dashOffset",0,le());A.addGetterSetter(re,"shadowColor",void 0,qs());A.addGetterSetter(re,"shadowBlur",0,le());A.addGetterSetter(re,"shadowOpacity",1,le());A.addComponentsGetterSetter(re,"shadowOffset",["x","y"]);A.addGetterSetter(re,"shadowOffsetX",0,le());A.addGetterSetter(re,"shadowOffsetY",0,le());A.addGetterSetter(re,"fillPatternImage");A.addGetterSetter(re,"fill",void 0,Gk());A.addGetterSetter(re,"fillPatternX",0,le());A.addGetterSetter(re,"fillPatternY",0,le());A.addGetterSetter(re,"fillLinearGradientColorStops");A.addGetterSetter(re,"strokeLinearGradientColorStops");A.addGetterSetter(re,"fillRadialGradientStartRadius",0);A.addGetterSetter(re,"fillRadialGradientEndRadius",0);A.addGetterSetter(re,"fillRadialGradientColorStops");A.addGetterSetter(re,"fillPatternRepeat","repeat");A.addGetterSetter(re,"fillEnabled",!0);A.addGetterSetter(re,"strokeEnabled",!0);A.addGetterSetter(re,"shadowEnabled",!0);A.addGetterSetter(re,"dashEnabled",!0);A.addGetterSetter(re,"strokeScaleEnabled",!0);A.addGetterSetter(re,"fillPriority","color");A.addComponentsGetterSetter(re,"fillPatternOffset",["x","y"]);A.addGetterSetter(re,"fillPatternOffsetX",0,le());A.addGetterSetter(re,"fillPatternOffsetY",0,le());A.addComponentsGetterSetter(re,"fillPatternScale",["x","y"]);A.addGetterSetter(re,"fillPatternScaleX",1,le());A.addGetterSetter(re,"fillPatternScaleY",1,le());A.addComponentsGetterSetter(re,"fillLinearGradientStartPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientStartPointX",0);A.addGetterSetter(re,"strokeLinearGradientStartPointX",0);A.addGetterSetter(re,"fillLinearGradientStartPointY",0);A.addGetterSetter(re,"strokeLinearGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillLinearGradientEndPoint",["x","y"]);A.addComponentsGetterSetter(re,"strokeLinearGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillLinearGradientEndPointX",0);A.addGetterSetter(re,"strokeLinearGradientEndPointX",0);A.addGetterSetter(re,"fillLinearGradientEndPointY",0);A.addGetterSetter(re,"strokeLinearGradientEndPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientStartPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientStartPointX",0);A.addGetterSetter(re,"fillRadialGradientStartPointY",0);A.addComponentsGetterSetter(re,"fillRadialGradientEndPoint",["x","y"]);A.addGetterSetter(re,"fillRadialGradientEndPointX",0);A.addGetterSetter(re,"fillRadialGradientEndPointY",0);A.addGetterSetter(re,"fillPatternRotation",0);A.backCompat(re,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var l$="#",u$="beforeDraw",c$="draw",oE=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],f$=oE.length;class yo extends qn{constructor(e){super(e),this.canvas=new Ts,this.hitCanvas=new L0({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(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(e,n){var r=this.getLayer(),i=e||r&&r.getCanvas();return this._fire(u$,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),qn.prototype.drawScene.call(this,i,n),this._fire(c$,{node:this}),this}drawHit(e,n){var r=this.getLayer(),i=e||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),qn.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return G.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}destroy(){return G.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}yo.prototype.nodeType="Layer";yt(yo);A.addGetterSetter(yo,"imageSmoothingEnabled",!0);A.addGetterSetter(yo,"clearBeforeDraw",!0);A.addGetterSetter(yo,"hitGraphEnabled",!0,jr());class D0 extends yo{constructor(e){super(e),this.listening(!1),G.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}D0.prototype.nodeType="FastLayer";yt(D0);class zs extends qn{_validateAdd(e){var n=e.getType();n!=="Group"&&n!=="Shape"&&G.throw("You may only add groups and shapes to groups.")}}zs.prototype.nodeType="Group";yt(zs);var Am=function(){return Os.performance&&Os.performance.now?function(){return Os.performance.now()}:function(){return new Date().getTime()}}();class dr{constructor(e,n){this.id=dr.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Am(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){var n=[];return e?e.length>0?n=e:n=[e]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(e){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=Rb,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=Ab,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,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 e=this.getTimer()-this._startTime;this.state===Rb?this.setTime(e):this.state===Ab&&this.setTime(this.duration-e)}pause(){this.state=h$,this.fire("onPause")}getTimer(){return new Date().getTime()}}class kt{constructor(e){var n=this,r=e.node,i=r._id,a,s=e.easing||yu.Linear,u=!!e.yoyo,c;typeof e.duration>"u"?a=.3:e.duration===0?a=.001:a=e.duration,this.node=r,this._id=p$++;var f=r.getLayer()||(r instanceof pe.Stage?r.getLayers():null);f||G.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new dr(function(){n.tween.onEnterFrame()},f),this.tween=new g$(c,function(h){n._tweenFunc(h)},s,0,1,a*1e3,u),this._addListeners(),kt.attrs[i]||(kt.attrs[i]={}),kt.attrs[i][this._id]||(kt.attrs[i][this._id]={}),kt.tweens[i]||(kt.tweens[i]={});for(c in e)d$[c]===void 0&&this._addAttr(c,e[c]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,n){var r=this.node,i=r._id,a,s,u,c,f,h,p,g;if(u=kt.tweens[i][e],u&&delete kt.attrs[i][u][e],a=r.getAttr(e),G._isArray(n))if(s=[],f=Math.max(n.length,a.length),e==="points"&&n.length!==a.length&&(n.length>a.length?(p=a,a=G._prepareArrayForTween(a,n,r.closed())):(h=n,n=G._prepareArrayForTween(n,a,r.closed()))),e.indexOf("fill")===0)for(c=0;c{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueEnd&&e.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,n=kt.attrs[e._id][this._id];n.points&&n.points.trueStart&&e.points(n.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(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e=this.node._id,n=this._id,r=kt.tweens[e],i;this.pause();for(i in r)delete kt.tweens[e][i];delete kt.attrs[e][n]}}kt.attrs={};kt.tweens={};se.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()};var n=new kt(t);n.play()};const yu={BackEaseIn(t,e,n,r){var i=1.70158;return n*(t/=r)*t*((i+1)*t-i)+e},BackEaseOut(t,e,n,r){var i=1.70158;return n*((t=t/r-1)*t*((i+1)*t+i)+1)+e},BackEaseInOut(t,e,n,r){var i=1.70158;return(t/=r/2)<1?n/2*(t*t*(((i*=1.525)+1)*t-i))+e:n/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+e},ElasticEaseIn(t,e,n,r,i,a){var s=0;return t===0?e:(t/=r)===1?e+n:(a||(a=r*.3),!i||i0?e:n),h=s*n,p=u*(u>0?e:n),g=c*(c>0?n:e);return{x:f,y:r?-1*g:p,width:h-f,height:g-p}}}Wi.prototype._centroid=!0;Wi.prototype.className="Arc";Wi.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(Wi);A.addGetterSetter(Wi,"innerRadius",0,le());A.addGetterSetter(Wi,"outerRadius",0,le());A.addGetterSetter(Wi,"angle",0,le());A.addGetterSetter(Wi,"clockwise",!1,jr());function iy(t,e,n,r,i,a,s){var u=Math.sqrt(Math.pow(n-t,2)+Math.pow(r-e,2)),c=Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2)),f=s*u/(u+c),h=s*c/(u+c),p=n-f*(i-t),g=r-f*(a-e),y=n+h*(i-t),v=r+h*(a-e);return[p,g,y,v]}function Mb(t,e){var n=t.length,r=[],i,a;for(i=2;i4){for(u=this.getTensionPoints(),c=u.length,f=a?0:4,a||e.quadraticCurveTo(u[0],u[1],u[2],u[3]);fh?f:h,x=f>h?1:f/h,_=f>h?h/f:1;e.translate(u,c),e.rotate(y),e.scale(x,_),e.arc(0,0,w,p,p+g,1-v),e.scale(1/x,1/_),e.rotate(-y),e.translate(-u,-c);break;case"z":r=!0,e.closePath();break}}!r&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(f){if(f.command==="A"){var h=f.points[4],p=f.points[5],g=f.points[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;v-=y){const w=tt.getPointOnEllipticalArc(f.points[0],f.points[1],f.points[2],f.points[3],v,0);e.push(w.x,w.y)}else for(let v=h+y;vthis.dataArray[r].pathLength;)e-=this.dataArray[r].pathLength,++r;if(r===i)return n=this.dataArray[r-1].points.slice(-2),{x:n[0],y:n[1]};if(e<.01)return n=this.dataArray[r].points.slice(0,2),{x:n[0],y:n[1]};var a=this.dataArray[r],s=a.points;switch(a.command){case"L":return tt.getPointOnLine(e,a.start.x,a.start.y,s[0],s[1]);case"C":return tt.getPointOnCubicBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return tt.getPointOnQuadraticBezier(e/a.pathLength,a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var u=s[0],c=s[1],f=s[2],h=s[3],p=s[4],g=s[5],y=s[6];return p+=g*e/a.pathLength,tt.getPointOnEllipticalArc(u,c,f,h,p,y)}return null}static getLineLength(e,n,r,i){return Math.sqrt((r-e)*(r-e)+(i-n)*(i-n))}static getPointOnLine(e,n,r,i,a,s,u){s===void 0&&(s=n),u===void 0&&(u=r);var c=(a-r)/(i-n+1e-8),f=Math.sqrt(e*e/(1+c*c));i0&&!isNaN(v[0]);){var S=null,C=[],O=c,I=f,L,D,U,X,K,te,ce,j,T,$;switch(y){case"l":c+=v.shift(),f+=v.shift(),S="L",C.push(c,f);break;case"L":c=v.shift(),f=v.shift(),C.push(c,f);break;case"m":var V=v.shift(),ie=v.shift();if(c+=V,f+=ie,S="M",s.length>2&&s[s.length-1].command==="z"){for(var H=s.length-2;H>=0;H--)if(s[H].command==="M"){c=s[H].points[0]+V,f=s[H].points[1]+ie;break}}C.push(c,f),y="l";break;case"M":c=v.shift(),f=v.shift(),S="M",C.push(c,f),y="L";break;case"h":c+=v.shift(),S="L",C.push(c,f);break;case"H":c=v.shift(),S="L",C.push(c,f);break;case"v":f+=v.shift(),S="L",C.push(c,f);break;case"V":f=v.shift(),S="L",C.push(c,f);break;case"C":C.push(v.shift(),v.shift(),v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"c":C.push(c+v.shift(),f+v.shift(),c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"S":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,v.shift(),v.shift()),c=v.shift(),f=v.shift(),S="C",C.push(c,f);break;case"s":D=c,U=f,L=s[s.length-1],L.command==="C"&&(D=c+(c-L.points[2]),U=f+(f-L.points[3])),C.push(D,U,c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="C",C.push(c,f);break;case"Q":C.push(v.shift(),v.shift()),c=v.shift(),f=v.shift(),C.push(c,f);break;case"q":C.push(c+v.shift(),f+v.shift()),c+=v.shift(),f+=v.shift(),S="Q",C.push(c,f);break;case"T":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c=v.shift(),f=v.shift(),S="Q",C.push(D,U,c,f);break;case"t":D=c,U=f,L=s[s.length-1],L.command==="Q"&&(D=c+(c-L.points[0]),U=f+(f-L.points[1])),c+=v.shift(),f+=v.shift(),S="Q",C.push(D,U,c,f);break;case"A":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c=v.shift(),f=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break;case"a":X=v.shift(),K=v.shift(),te=v.shift(),ce=v.shift(),j=v.shift(),T=c,$=f,c+=v.shift(),f+=v.shift(),S="A",C=this.convertEndpointToCenterParameterization(T,$,c,f,ce,j,X,K,te);break}s.push({command:S||y,points:C,start:{x:O,y:I},pathLength:this.calcLength(O,I,S||y,C)})}(y==="z"||y==="Z")&&s.push({command:"z",points:[],start:void 0,pathLength:0})}return s}static calcLength(e,n,r,i){var a,s,u,c,f=tt;switch(r){case"L":return f.getLineLength(e,n,i[0],i[1]);case"C":for(a=0,s=f.getPointOnCubicBezier(0,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),c=.01;c<=1;c+=.01)u=f.getPointOnCubicBezier(c,e,n,i[0],i[1],i[2],i[3],i[4],i[5]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"Q":for(a=0,s=f.getPointOnQuadraticBezier(0,e,n,i[0],i[1],i[2],i[3]),c=.01;c<=1;c+=.01)u=f.getPointOnQuadraticBezier(c,e,n,i[0],i[1],i[2],i[3]),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;return a;case"A":a=0;var h=i[4],p=i[5],g=i[4]+p,y=Math.PI/180;if(Math.abs(h-g)g;c-=y)u=f.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],c,0),a+=f.getLineLength(s.x,s.y,u.x,u.y),s=u;else for(c=h+y;c1&&(u*=Math.sqrt(y),c*=Math.sqrt(y));var v=Math.sqrt((u*u*(c*c)-u*u*(g*g)-c*c*(p*p))/(u*u*(g*g)+c*c*(p*p)));a===s&&(v*=-1),isNaN(v)&&(v=0);var w=v*u*g/c,x=v*-c*p/u,_=(e+r)/2+Math.cos(h)*w-Math.sin(h)*x,S=(n+i)/2+Math.sin(h)*w+Math.cos(h)*x,C=function(K){return Math.sqrt(K[0]*K[0]+K[1]*K[1])},O=function(K,te){return(K[0]*te[0]+K[1]*te[1])/(C(K)*C(te))},I=function(K,te){return(K[0]*te[1]=1&&(X=0),s===0&&X>0&&(X=X-2*Math.PI),s===1&&X<0&&(X=X+2*Math.PI),[_,S,u,c,L,X,h,s]}}tt.prototype.className="Path";tt.prototype._attrsAffectingSize=["data"];yt(tt);A.addGetterSetter(tt,"data");class So extends Vi{_sceneFunc(e){super._sceneFunc(e);var n=Math.PI*2,r=this.points(),i=r,a=this.tension()!==0&&r.length>4;a&&(i=this.getTensionPoints());var s=this.pointerLength(),u=r.length,c,f;if(a){const g=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[u-2],r[u-1]],y=tt.calcLength(i[i.length-4],i[i.length-3],"C",g),v=tt.getPointOnQuadraticBezier(Math.min(1,1-s/y),g[0],g[1],g[2],g[3],g[4],g[5]);c=r[u-2]-v.x,f=r[u-1]-v.y}else c=r[u-2]-r[u-4],f=r[u-1]-r[u-3];var h=(Math.atan2(f,c)+n)%n,p=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(r[u-2],r[u-1]),e.rotate(h),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(r[0],r[1]),a?(c=(i[0]+i[2])/2-r[0],f=(i[1]+i[3])/2-r[1]):(c=r[2]-r[0],f=r[3]-r[1]),e.rotate((Math.atan2(-f,-c)+n)%n),e.moveTo(0,0),e.lineTo(-s,p/2),e.lineTo(-s,-p/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x-n,y:e.y-n,width:e.width+n*2,height:e.height+n*2}}}So.prototype.className="Arrow";yt(So);A.addGetterSetter(So,"pointerLength",10,le());A.addGetterSetter(So,"pointerWidth",10,le());A.addGetterSetter(So,"pointerAtBeginning",!1);A.addGetterSetter(So,"pointerAtEnding",!0);class Ks extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Ks.prototype._centroid=!0;Ks.prototype.className="Circle";Ks.prototype._attrsAffectingSize=["radius"];yt(Ks);A.addGetterSetter(Ks,"radius",0,le());class Na extends re{_sceneFunc(e){var n=this.radiusX(),r=this.radiusY();e.beginPath(),e.save(),n!==r&&e.scale(1,r/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}Na.prototype.className="Ellipse";Na.prototype._centroid=!0;Na.prototype._attrsAffectingSize=["radiusX","radiusY"];yt(Na);A.addComponentsGetterSetter(Na,"radius",["x","y"]);A.addGetterSetter(Na,"radiusX",0,le());A.addGetterSetter(Na,"radiusY",0,le());let hi=class sE extends re{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),a=this.attrs.image;let s;if(a){const u=this.attrs.cropWidth,c=this.attrs.cropHeight;u&&c?s=[a,this.cropX(),this.cropY(),u,c,0,0,n,r]:s=[a,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?G.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)),a&&(i&&e.clip(),e.drawImage.apply(e,s))}_hitFunc(e){var n=this.width(),r=this.height(),i=this.cornerRadius();e.beginPath(),i?G.drawRoundedRectPath(e,n,r,i):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n;return(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var e,n;return(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(e,n,r=null){var i=G.createImageElement();i.onload=function(){var a=new sE({image:i});n(a)},i.onerror=r,i.crossOrigin="Anonymous",i.src=e}};hi.prototype.className="Image";yt(hi);A.addGetterSetter(hi,"cornerRadius",0,A0(4));A.addGetterSetter(hi,"image");A.addComponentsGetterSetter(hi,"crop",["x","y","width","height"]);A.addGetterSetter(hi,"cropX",0,le());A.addGetterSetter(hi,"cropY",0,le());A.addGetterSetter(hi,"cropWidth",0,le());A.addGetterSetter(hi,"cropHeight",0,le());var lE=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],m$="Change.konva",v$="none",ay="up",oy="right",sy="down",ly="left",y$=lE.length;class N0 extends zs{constructor(e){super(e),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(e){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),a=Math.max(a,s.y)}),{x:n,y:i,width:r-n,height:a-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}wo.prototype.className="RegularPolygon";wo.prototype._centroid=!0;wo.prototype._attrsAffectingSize=["radius"];yt(wo);A.addGetterSetter(wo,"radius",0,le());A.addGetterSetter(wo,"sides",0,le());var Db=Math.PI*2;class bo extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,Db,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),Db,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}bo.prototype.className="Ring";bo.prototype._centroid=!0;bo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];yt(bo);A.addGetterSetter(bo,"innerRadius",0,le());A.addGetterSetter(bo,"outerRadius",0,le());class pi extends re{constructor(e){super(e),this._updated=!0,this.anim=new dr(()=>{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(e){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+0],c=a[i+1],f=a[i+2],h=a[i+3],p=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,f,h),e.closePath(),e.fillStrokeShape(this)),p)if(s){var g=s[n],y=r*2;e.drawImage(p,u,c,f,h,g[y+0],g[y+1],f,h)}else e.drawImage(p,u,c,f,h,0,0,f,h)}_hitFunc(e){var n=this.animation(),r=this.frameIndex(),i=r*4,a=this.animations()[n],s=this.frameOffsets(),u=a[i+2],c=a[i+3];if(e.beginPath(),s){var f=s[n],h=r*2;e.rect(f[h+0],f[h+1],u,c)}else e.rect(0,0,u,c);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],a=i.length/4;e{e=e.trim();const n=e.indexOf(" ")>=0,r=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!r&&(e=`"${e}"`),e}).join(", ")}var Hf;function Lm(){return Hf||(Hf=G.createCanvasElement().getContext(w$),Hf)}function I$(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function L$(t){t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function M$(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let vt=class extends re{constructor(e){super(M$(e)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(_+=s)}}}_hitFunc(e){var n=this.getWidth(),r=this.getHeight();e.beginPath(),e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}setText(e){var n=G._isString(e)?e:e==null?"":e+"";return this._setAttr(b$,n),this}getWidth(){var e=this.attrs.width===as||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===as||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return G.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n=Lm(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(e),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+jf+this.fontVariant()+jf+(this.fontSize()+E$)+A$(this.fontFamily())}_addTextLine(e){this.align()===Hl&&(e=e.trim());var r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){var n=this.letterSpacing(),r=e.length;return Lm().measureText(e).width+(r?n*(r-1):0)}_setTextData(){var e=this.text().split(` -`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,a=this.attrs.width,s=this.attrs.height,u=a!==as&&a!==void 0,c=s!==as&&s!==void 0,f=this.padding(),h=a-f*2,p=s-f*2,g=0,y=this.wrap(),v=y!==Fb,w=y!==T$&&v,x=this.ellipsis();this.textArr=[],Lm().font=this._getContextFont();for(var _=x?this._getTextWidth(Im):0,S=0,C=e.length;Sh)for(;O.length>0;){for(var L=0,D=O.length,U="",X=0;L>>1,te=O.slice(0,K+1),ce=this._getTextWidth(te)+_;ce<=h?(L=K+1,U=te,X=ce):D=K}if(U){if(w){var j,T=O[U.length],$=T===jf||T===Nb;$&&X<=h?j=U.length:j=Math.max(U.lastIndexOf(jf),U.lastIndexOf(Nb))+1,j>0&&(L=j,U=U.slice(0,L),X=this._getTextWidth(U))}U=U.trimRight(),this._addTextLine(U),r=Math.max(r,X),g+=i;var V=this._shouldHandleEllipsis(g);if(V){this._tryToAddEllipsisToLastLine();break}if(O=O.slice(L),O=O.trimLeft(),O.length>0&&(I=this._getTextWidth(O),I<=h)){this._addTextLine(O),g+=i,r=Math.max(r,I);break}}else break}else this._addTextLine(O),g+=i,r=Math.max(r,I),this._shouldHandleEllipsis(g)&&Sp)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,a=i!==as&&i!==void 0,s=this.padding(),u=i-s*2,c=this.wrap(),f=c!==Fb;return!f||a&&e+r>u}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,n=e!==as&&e!==void 0,r=this.padding(),i=e-r*2,a=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!a)){if(n){var u=this._getTextWidth(s.text+Im)=1){var r=n[0].p0;e.moveTo(r.x,r.y)}for(var i=0;i0&&(u+=e.dataArray[c].pathLength);var f=0;i==="center"&&(f=Math.max(0,u/2-s/2)),i==="right"&&(f=Math.max(0,u-s));for(var h=uE(this.text()),p=this.text().split(" ").length-1,g,y,v,w=-1,x=0,_=function(){x=0;for(var ce=e.dataArray,j=w+1;j0)return w=j,ce[j];ce[j].command==="M"&&(g={x:ce[j].points[0],y:ce[j].points[1]})}return{}},S=function(ce){var j=e._getTextSize(ce).width+r;ce===" "&&i==="justify"&&(j+=(u-s)/p);var T=0,$=0;for(y=void 0;Math.abs(j-T)/j>.01&&$<20;){$++;for(var V=T;v===void 0;)v=_(),v&&V+v.pathLengthj?y=tt.getPointOnLine(j,g.x,g.y,v.points[0],v.points[1],g.x,g.y):v=void 0;break;case"A":var H=v.points[4],Y=v.points[5],Q=v.points[4]+Y;x===0?x=H+1e-8:j>T?x+=Math.PI/180*Y/Math.abs(Y):x-=Math.PI/360*Y/Math.abs(Y),(Y<0&&x=0&&x>Q)&&(x=Q,ie=!0),y=tt.getPointOnEllipticalArc(v.points[0],v.points[1],v.points[2],v.points[3],x,v.points[6]);break;case"C":x===0?j>v.pathLength?x=1e-8:x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength/2:x=Math.max(x-(T-j)/v.pathLength/2,0),x>1&&(x=1,ie=!0),y=tt.getPointOnCubicBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3],v.points[4],v.points[5]);break;case"Q":x===0?x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength:x-=(T-j)/v.pathLength,x>1&&(x=1,ie=!0),y=tt.getPointOnQuadraticBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3]);break}y!==void 0&&(T=tt.getLineLength(g.x,g.y,y.x,y.y)),ie&&(ie=!1,v=void 0)}},C="C",O=e._getTextSize(C).width+r,I=f/O-1,L=0;Lt+`.${mE}`).join(" "),$b="nodesRect",B$=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],F$={"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 $$="ontouchstart"in pe._global;function z$(t,e){if(t==="rotater")return"crosshair";e+=G.degToRad(F$[t]||0);var n=(G.radToDeg(e)%360+360)%360;return G._inRange(n,315+22.5,360)||G._inRange(n,0,22.5)?"ns-resize":G._inRange(n,45-22.5,45+22.5)?"nesw-resize":G._inRange(n,90-22.5,90+22.5)?"ew-resize":G._inRange(n,135-22.5,135+22.5)?"nwse-resize":G._inRange(n,180-22.5,180+22.5)?"ns-resize":G._inRange(n,225-22.5,225+22.5)?"nesw-resize":G._inRange(n,270-22.5,270+22.5)?"ew-resize":G._inRange(n,315-22.5,315+22.5)?"nwse-resize":(G.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var sh=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],zb=1e8;function G$(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function vE(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:r,y:i})}function U$(t,e){const n=G$(t);return vE(t,e,n)}function j$(t,e,n){let r=e;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");r.on(a,i),r.on(B$.map(s=>s+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=e.getAbsolutePosition(),a=i.x-n.x,s=i.y-n.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const c=u.getAbsolutePosition();u.setAbsolutePosition({x:c.x+a,y:c.y+s}),u.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache($b),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache($b,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){var i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(r),s=e.getAbsolutePosition(r),u=i.x*a.x-e.offsetX()*a.x,c=i.y*a.y-e.offsetY()*a.y;const f=(pe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),h={x:s.x+u*Math.cos(f)+c*Math.sin(-f),y:s.y+c*Math.cos(f)+u*Math.sin(f),width:i.width*a.x,height:i.height*a.y,rotation:f};return vE(h,-pe.getAngle(n),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-zb,y:-zb,width:0,height:0,rotation:0};const n=[];this.nodes().map(f=>{const h=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var p=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}],g=f.getAbsoluteTransform();p.forEach(function(y){var v=g.point(y);n.push(v)})});const r=new Hn;r.rotate(-pe.getAngle(this.rotation()));var i,a,s,u;n.forEach(function(f){var h=r.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),r.invert();const c=r.point({x:i,y:a});return{x:c.x,y:c.y,width:s-i,height:u-a,rotation:pe.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(),sh.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var n=new ec({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:$$?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=pe.getAngle(this.rotation()),a=z$(e,i);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var e=new re({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()*G._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(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,a=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/a),this.cos=Math.abs(r/a),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=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-s.x,y:u.y-s.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(c=>{c._fire("transformstart",{evt:e.evt,target:c})})}_handleMouseMove(e){var n,r,i,a=this.findOne("."+this._movingAnchorName),s=a.getStage();s.setPointersPositions(e);const u=s.getPointerPosition();let c={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const f=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(c=this.anchorDragBoundFunc()(f,c,e)),a.setAbsolutePosition(c);const h=a.getAbsolutePosition();if(!(f.x===h.x&&f.y===h.y)){if(this._movingAnchorName==="rotater"){var p=this._getNodeRect();n=a.x()-p.width/2,r=-a.y()+p.height/2;let ce=Math.atan2(-r,n)+Math.PI/2;p.height<0&&(ce-=Math.PI);var g=pe.getAngle(this.rotation());const j=g+ce,T=pe.getAngle(this.rotationSnapTolerance()),V=j$(this.rotationSnaps(),j,T)-p.rotation,ie=U$(p,V);this._fitNodesInto(ie,e);return}var y=this.keepRatio()||e.shiftKey,S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(y){var v=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(v.x-a.x(),2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-left").x()>v.x?-1:1,x=this.findOne(".top-left").y()>v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-left").x(v.x-n),this.findOne(".top-left").y(v.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(y){var v=S?{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(a.x()-v.x,2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-right").x()v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-right").x(v.x+n),this.findOne(".top-right").y(v.y-r)}var _=a.position();this.findOne(".top-left").y(_.y),this.findOne(".bottom-right").x(_.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(y){var v=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(v.x-a.x(),2)+Math.pow(a.y()-v.y,2));var w=v.x{r._fire("transformend",{evt:e,target:r})}),this._movingAnchorName=null}}_fitNodesInto(e,n){var r=this._getNodeRect();const i=1;if(G._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(G._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const a=this.flipEnabled();var s=new Hn;if(s.rotate(pe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=s.point({x:-this.padding()*2,y:0});if(e.x+=p.x,e.y+=p.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,!a){this.update();return}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.width+=this.padding()*2,!a){this.update();return}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=s.point({x:0,y:-this.padding()*2});if(e.x+=p.x,e.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(r,e);p?e=p:G.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const u=1e7,c=new Hn;c.translate(r.x,r.y),c.rotate(r.rotation),c.scale(r.width/u,r.height/u);const f=new Hn;f.translate(e.x,e.y),f.rotate(e.rotation),f.scale(e.width/u,e.height/u);const h=f.multiply(c.invert());this._nodes.forEach(p=>{var g;const y=p.getParent().getAbsoluteTransform(),v=p.getTransform().copy();v.translate(p.offsetX(),p.offsetY());const w=new Hn;w.multiply(y.copy().invert()).multiply(h).multiply(y).multiply(v);const x=w.decompose();p.setAttrs(x),this._fire("transform",{evt:n,target:p}),p._fire("transform",{evt:n,target:p}),(g=p.getLayer())===null||g===void 0||g.batchDraw()}),this.rotation(G._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e,n=this._getNodeRect();this.rotation(G._getRotation(n.rotation));var r=n.width,i=n.height,a=this.enabledAnchors(),s=this.resizeEnabled(),u=this.padding(),c=this.anchorSize();this.find("._anchor").forEach(f=>{f.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+u,offsetY:c/2+u,visible:s&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:c/2+u,visible:s&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:c/2-u,offsetY:c/2+u,visible:s&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:c/2+u,visible:s&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:c/2-u,visible:s&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:c/2+u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:c/2-u,visible:s&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:c/2-u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*G._sign(i)-u,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}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),zs.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return se.prototype.toObject.call(this)}clone(e){var n=se.prototype.clone.call(this,e);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function H$(t){return t instanceof Array||G.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){sh.indexOf(e)===-1&&G.warn("Unknown anchor name: "+e+". Available names are: "+sh.join(", "))}),t||[]}Ke.prototype.className="Transformer";yt(Ke);A.addGetterSetter(Ke,"enabledAnchors",sh,H$);A.addGetterSetter(Ke,"flipEnabled",!0,jr());A.addGetterSetter(Ke,"resizeEnabled",!0);A.addGetterSetter(Ke,"anchorSize",10,le());A.addGetterSetter(Ke,"rotateEnabled",!0);A.addGetterSetter(Ke,"rotationSnaps",[]);A.addGetterSetter(Ke,"rotateAnchorOffset",50,le());A.addGetterSetter(Ke,"rotationSnapTolerance",5,le());A.addGetterSetter(Ke,"borderEnabled",!0);A.addGetterSetter(Ke,"anchorStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"anchorStrokeWidth",1,le());A.addGetterSetter(Ke,"anchorFill","white");A.addGetterSetter(Ke,"anchorCornerRadius",0,le());A.addGetterSetter(Ke,"borderStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"borderStrokeWidth",1,le());A.addGetterSetter(Ke,"borderDash");A.addGetterSetter(Ke,"keepRatio",!0);A.addGetterSetter(Ke,"centeredScaling",!1);A.addGetterSetter(Ke,"ignoreStroke",!1);A.addGetterSetter(Ke,"padding",0,le());A.addGetterSetter(Ke,"node");A.addGetterSetter(Ke,"nodes");A.addGetterSetter(Ke,"boundBoxFunc");A.addGetterSetter(Ke,"anchorDragBoundFunc");A.addGetterSetter(Ke,"shouldOverdrawWholeArea",!1);A.addGetterSetter(Ke,"useSingleNodeRotation",!0);A.backCompat(Ke,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class qi extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,pe.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}qi.prototype.className="Wedge";qi.prototype._centroid=!0;qi.prototype._attrsAffectingSize=["radius"];yt(qi);A.addGetterSetter(qi,"radius",0,le());A.addGetterSetter(qi,"angle",0,le());A.addGetterSetter(qi,"clockwise",!1);A.backCompat(qi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function Gb(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var W$=[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],V$=[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 q$(t,e){var n=t.data,r=t.width,i=t.height,a,s,u,c,f,h,p,g,y,v,w,x,_,S,C,O,I,L,D,U,X,K,te,ce,j=e+e+1,T=r-1,$=i-1,V=e+1,ie=V*(V+1)/2,H=new Gb,Y=null,Q=H,oe=null,ve=null,we=W$[e],Ue=V$[e];for(u=1;u>Ue,te!==0?(te=255/te,n[h]=(g*we>>Ue)*te,n[h+1]=(y*we>>Ue)*te,n[h+2]=(v*we>>Ue)*te):n[h]=n[h+1]=n[h+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=p+((c=a+e+1)>Ue,te>0?(te=255/te,n[c]=(g*we>>Ue)*te,n[c+1]=(y*we>>Ue)*te,n[c+2]=(v*we>>Ue)*te):n[c]=n[c+1]=n[c+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=a+((c=s+V)<$?c:$)*r<<2,g+=O+=oe.r=n[c],y+=I+=oe.g=n[c+1],v+=L+=oe.b=n[c+2],w+=D+=oe.a=n[c+3],oe=oe.next,x+=U=ve.r,_+=X=ve.g,S+=K=ve.b,C+=te=ve.a,O-=U,I-=X,L-=K,D-=te,ve=ve.next,h+=r}}const K$=function(e){var n=Math.round(this.blurRadius());n>0&&q$(e,n)};A.addGetterSetter(se,"blurRadius",0,le(),A.afterSetFilter);const Y$=function(t){var e=this.brightness()*255,n=t.data,r=n.length,i;for(i=0;i255?255:i,a=a<0?0:a>255?255:a,s=s<0?0:s>255?255:s,n[u]=i,n[u+1]=a,n[u+2]=s};A.addGetterSetter(se,"contrast",0,le(),A.afterSetFilter);const Q$=function(t){var e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),a=0,s=0,u=t.data,c=t.width,f=t.height,h=c*4,p=f;switch(r){case"top-left":a=-1,s=-1;break;case"top":a=-1,s=0;break;case"top-right":a=-1,s=1;break;case"right":a=0,s=1;break;case"bottom-right":a=1,s=1;break;case"bottom":a=1,s=0;break;case"bottom-left":a=1,s=-1;break;case"left":a=0,s=-1;break;default:G.error("Unknown emboss direction: "+r)}do{var g=(p-1)*h,y=a;p+y<1&&(y=0),p+y>f&&(y=0);var v=(p-1+y)*c*4,w=c;do{var x=g+(w-1)*4,_=s;w+_<1&&(_=0),w+_>c&&(_=0);var S=v+(w-1+_)*4,C=u[x]-u[S],O=u[x+1]-u[S+1],I=u[x+2]-u[S+2],L=C,D=L>0?L:-L,U=O>0?O:-O,X=I>0?I:-I;if(U>D&&(L=O),X>D&&(L=I),L*=e,i){var K=u[x]+L,te=u[x+1]+L,ce=u[x+2]+L;u[x]=K>255?255:K<0?0:K,u[x+1]=te>255?255:te<0?0:te,u[x+2]=ce>255?255:ce<0?0:ce}else{var j=n-L;j<0?j=0:j>255&&(j=255),u[x]=u[x+1]=u[x+2]=j}}while(--w)}while(--p)};A.addGetterSetter(se,"embossStrength",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossWhiteLevel",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossDirection","top-left",null,A.afterSetFilter);A.addGetterSetter(se,"embossBlend",!1,null,A.afterSetFilter);function Mm(t,e,n,r,i){var a=n-e,s=i-r,u;return a===0?r+s/2:s===0?r:(u=(t-e)/a,u=s*u+r,u)}const J$=function(t){var e=t.data,n=e.length,r=e[0],i=r,a,s=e[1],u=s,c,f=e[2],h=f,p,g,y=this.enhance();if(y!==0){for(g=0;gi&&(i=a),c=e[g+1],cu&&(u=c),p=e[g+2],ph&&(h=p);i===r&&(i=255,r=0),u===s&&(u=255,s=0),h===f&&(h=255,f=0);var v,w,x,_,S,C,O,I,L;for(y>0?(w=i+y*(255-i),x=r-y*(r-0),S=u+y*(255-u),C=s-y*(s-0),I=h+y*(255-h),L=f-y*(f-0)):(v=(i+r)*.5,w=i+y*(i-v),x=r+y*(r-v),_=(u+s)*.5,S=u+y*(u-_),C=s+y*(s-_),O=(h+f)*.5,I=h+y*(h-O),L=f+y*(f-O)),g=0;g_?x:_;var S=s,C=a,O,I,L=360/C*Math.PI/180,D,U;for(I=0;IC?S:C;var O=s,I=a,L,D,U=n.polarRotation||0,X,K;for(h=0;he&&(O=C,I=0,L=-1),i=0;i=0&&y=0&&v=0&&y=0&&v=255*4?255:0}return s}function fz(t,e,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),s=[],u=0;u=0&&y=0&&v=n))for(a=w;a=r||(s=(n*a+i)*4,u+=O[s+0],c+=O[s+1],f+=O[s+2],h+=O[s+3],C+=1);for(u=u/C,c=c/C,f=f/C,h=h/C,i=y;i=n))for(a=w;a=r||(s=(n*a+i)*4,O[s+0]=u,O[s+1]=c,O[s+2]=f,O[s+3]=h)}};A.addGetterSetter(se,"pixelSize",8,le(),A.afterSetFilter);const gz=function(t){var e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e,a;for(a=0;a255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,zk,A.afterSetFilter);const vz=function(t){var e=t.data,n=e.length,r=this.red(),i=this.green(),a=this.blue(),s=this.alpha(),u,c;for(u=0;u255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,zk,A.afterSetFilter);A.addGetterSetter(se,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const yz=function(t){var e=t.data,n=e.length,r,i,a,s;for(r=0;r127&&(f=255-f),h>127&&(h=255-h),p>127&&(p=255-p),e[c]=f,e[c+1]=h,e[c+2]=p}while(--u)}while(--a)},_z=function(t){var e=this.threshold()*255,n=t.data,r=n.length,i;for(i=0;i{const{width:n,height:r}=e,i=document.createElement("div"),a=new Vl.Stage({container:i,width:n,height:r}),s=new Vl.Layer,u=new Vl.Layer;s.add(new Vl.Rect({...e,fill:"white"})),t.forEach(f=>u.add(new Vl.Line({points:f.points,stroke:"black",strokeWidth:f.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:f.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(u);const c=a.toDataURL({...e});return i.remove(),c};let yE=null,SE=null;const LH=t=>{yE=t},bz=()=>yE,MH=t=>{SE=t},DH=()=>SE,Cz=t=>{const e=window.open("");e&&t.forEach(n=>{const r=new Image;r.src=n.base64,e.document.write(n.caption),e.document.write("
"),e.document.write(r.outerHTML),e.document.write("

")})},xz=(t,e)=>Math.floor(Math.random()*(e-t+1)+t),kz=t=>{const e=bz(),{generationMode:n,generationState:r,postprocessingState:i,canvasState:a,systemState:s}=t,{codeformerFidelity:u,facetoolStrength:c,facetoolType:f,hiresFix:h,hiresStrength:p,shouldRunESRGAN:g,shouldRunFacetool:y,upscalingLevel:v,upscalingStrength:w,upscalingDenoising:x}=i,{cfgScale:_,height:S,img2imgStrength:C,infillMethod:O,initialImage:I,iterations:L,perlin:D,prompt:U,negativePrompt:X,sampler:K,seamBlur:te,seamless:ce,seamSize:j,seamSteps:T,seamStrength:$,seed:V,seedWeights:ie,shouldFitToWidthHeight:H,shouldGenerateVariations:Y,shouldRandomizeSeed:Q,steps:oe,threshold:ve,tileSize:we,variationAmount:Ue,width:At,shouldUseSymmetry:me,horizontalSymmetrySteps:qt,verticalSymmetrySteps:Bt}=r,{shouldDisplayInProgressType:bn,saveIntermediatesInterval:wr,enableImageDebugging:Ft}=s,xe={prompt:U,iterations:L,steps:oe,cfg_scale:_,threshold:ve,perlin:D,height:S,width:At,sampler_name:K,seed:V,progress_images:bn==="full-res",progress_latents:bn==="latents",save_intermediates:wr,generation_mode:n,init_mask:""};let Hr=!1,Pt=!1;if(X!==""&&(xe.prompt=`${U} [${X}]`),xe.seed=Q?xz(uF,cF):V,me&&(qt>0&&(xe.h_symmetry_time_pct=Math.max(0,Math.min(1,qt/oe))),Bt>0&&(xe.v_symmetry_time_pct=Math.max(0,Math.min(1,Bt/oe)))),n==="txt2img"&&(xe.hires_fix=h,h&&(xe.strength=p)),["txt2img","img2img"].includes(n)&&(xe.seamless=ce,g&&(Hr={level:v,denoise_str:x,strength:w}),y&&(Pt={type:f,strength:c},f==="codeformer"&&(Pt.codeformer_fidelity=u))),n==="img2img"&&I&&(xe.init_img=typeof I=="string"?I:I.url,xe.strength=C,xe.fit=H),n==="unifiedCanvas"&&e){const{layerState:{objects:gi},boundingBoxCoordinates:Xs,boundingBoxDimensions:Mn,stageScale:Fa,isMaskEnabled:Qs,shouldPreserveMaskedArea:er,boundingBoxScaleMethod:Kt,scaledBoundingBoxDimensions:Dn}=a,bt={...Xs,...Mn},$a=wz(Qs?gi.filter(Jx):[],bt);xe.init_mask=$a,xe.fit=!1,xe.strength=C,xe.invert_mask=er,xe.bounding_box=bt;const Wr=e.scale();e.scale({x:1/Fa,y:1/Fa});const Co=e.getAbsolutePosition(),Vr=e.toDataURL({x:bt.x+Co.x,y:bt.y+Co.y,width:bt.width,height:bt.height});Ft&&Cz([{base64:$a,caption:"mask sent as init_mask"},{base64:Vr,caption:"image sent as init_img"}]),e.scale(Wr),xe.init_img=Vr,xe.progress_images=!1,Kt!=="none"&&(xe.inpaint_width=Dn.width,xe.inpaint_height=Dn.height),xe.seam_size=j,xe.seam_blur=te,xe.seam_strength=$,xe.seam_steps=T,xe.tile_size=we,xe.infill_method=O,xe.force_outpaint=!1}return Y?(xe.variation_amount=Ue,ie&&(xe.with_variations=R5(ie))):xe.variation_amount=0,Ft&&(xe.enable_image_debugging=Ft),{generationParameters:xe,esrganParameters:Hr,facetoolParameters:Pt}};var Ez=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Pz=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Oz=/[^-+\dA-Z]/g;function Ut(t,e,n,r){if(arguments.length===1&&typeof t=="string"&&!/\d/.test(t)&&(e=t,t=void 0),t=t||t===0?t:new Date,t instanceof Date||(t=new Date(t)),isNaN(t))throw TypeError("Invalid date");e=String(Ub[e]||e||Ub.default);var i=e.slice(0,4);(i==="UTC:"||i==="GMT:")&&(e=e.slice(4),n=!0,i==="GMT:"&&(r=!0));var a=function(){return n?"getUTC":"get"},s=function(){return t[a()+"Date"]()},u=function(){return t[a()+"Day"]()},c=function(){return t[a()+"Month"]()},f=function(){return t[a()+"FullYear"]()},h=function(){return t[a()+"Hours"]()},p=function(){return t[a()+"Minutes"]()},g=function(){return t[a()+"Seconds"]()},y=function(){return t[a()+"Milliseconds"]()},v=function(){return n?0:t.getTimezoneOffset()},w=function(){return Tz(t)},x=function(){return Rz(t)},_={d:function(){return s()},dd:function(){return Un(s())},ddd:function(){return Pn.dayNames[u()]},DDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:Pn.dayNames[u()],short:!0})},dddd:function(){return Pn.dayNames[u()+7]},DDDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:Pn.dayNames[u()+7]})},m:function(){return c()+1},mm:function(){return Un(c()+1)},mmm:function(){return Pn.monthNames[c()]},mmmm:function(){return Pn.monthNames[c()+12]},yy:function(){return String(f()).slice(2)},yyyy:function(){return Un(f(),4)},h:function(){return h()%12||12},hh:function(){return Un(h()%12||12)},H:function(){return h()},HH:function(){return Un(h())},M:function(){return p()},MM:function(){return Un(p())},s:function(){return g()},ss:function(){return Un(g())},l:function(){return Un(y(),3)},L:function(){return Un(Math.floor(y()/10))},t:function(){return h()<12?Pn.timeNames[0]:Pn.timeNames[1]},tt:function(){return h()<12?Pn.timeNames[2]:Pn.timeNames[3]},T:function(){return h()<12?Pn.timeNames[4]:Pn.timeNames[5]},TT:function(){return h()<12?Pn.timeNames[6]:Pn.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":Az(t)},o:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60)*100+Math.abs(v())%60,4)},p:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60),2)+":"+Un(Math.floor(Math.abs(v())%60),2)},S:function(){return["th","st","nd","rd"][s()%10>3?0:(s()%100-s()%10!=10)*s()%10]},W:function(){return w()},WW:function(){return Un(w())},N:function(){return x()}};return e.replace(Ez,function(S){return S in _?_[S]():S.slice(1,S.length-1)})}var Ub={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Pn={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},Un=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(e).padStart(n,"0")},jb=function(e){var n=e.y,r=e.m,i=e.d,a=e._,s=e.dayName,u=e.short,c=u===void 0?!1:u,f=new Date,h=new Date;h.setDate(h[a+"Date"]()-1);var p=new Date;p.setDate(p[a+"Date"]()+1);var g=function(){return f[a+"Date"]()},y=function(){return f[a+"Month"]()},v=function(){return f[a+"FullYear"]()},w=function(){return h[a+"Date"]()},x=function(){return h[a+"Month"]()},_=function(){return h[a+"FullYear"]()},S=function(){return p[a+"Date"]()},C=function(){return p[a+"Month"]()},O=function(){return p[a+"FullYear"]()};return v()===n&&y()===r&&g()===i?c?"Tdy":"Today":_()===n&&x()===r&&w()===i?c?"Ysd":"Yesterday":O()===n&&C()===r&&S()===i?c?"Tmw":"Tomorrow":s},Tz=function(e){var n=new Date(e.getFullYear(),e.getMonth(),e.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var i=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-i);var a=(n-r)/(864e5*7);return 1+Math.floor(a)},Rz=function(e){var n=e.getDay();return n===0&&(n=7),n},Az=function(e){return(String(e).match(Pz)||[""]).pop().replace(Oz,"").replace(/GMT\+0000/g,"UTC")};const Iz=(t,e)=>{const{dispatch:n,getState:r}=t;return{emitGenerateImage:i=>{n(ei(!0));const a=r(),{generation:s,postprocessing:u,system:c,canvas:f}=a,h={generationMode:i,generationState:s,postprocessingState:u,canvasState:f,systemState:c};n(gB());const{generationParameters:p,esrganParameters:g,facetoolParameters:y}=kz(h);e.emit("generateImage",p,g,y),p.init_mask&&(p.init_mask=p.init_mask.substr(0,64).concat("...")),p.init_img&&(p.init_img=p.init_img.substr(0,64).concat("...")),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...p,...g,...y})}`}))},emitRunESRGAN:i=>{n(ei(!0));const{postprocessing:{upscalingLevel:a,upscalingDenoising:s,upscalingStrength:u}}=r(),c={upscale:[a,s,u]};e.emit("runPostprocessing",i,{type:"esrgan",...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...c})}`}))},emitRunFacetool:i=>{n(ei(!0));const{postprocessing:{facetoolType:a,facetoolStrength:s,codeformerFidelity:u}}=r(),c={facetool_strength:s};a==="codeformer"&&(c.codeformer_fidelity=u),e.emit("runPostprocessing",i,{type:a,...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Face restoration (${a}) requested: ${JSON.stringify({file:i.url,...c})}`}))},emitDeleteImage:i=>{const{url:a,uuid:s,category:u,thumbnail:c}=i;n(tk(i)),e.emit("deleteImage",a,c,s,u)},emitRequestImages:i=>{const a=r().gallery,{earliest_mtime:s}=a.categories[i];e.emit("requestImages",i,s)},emitRequestNewImages:i=>{const a=r().gallery,{latest_mtime:s}=a.categories[i];e.emit("requestLatestImages",i,s)},emitCancelProcessing:()=>{e.emit("cancel")},emitRequestSystemConfig:()=>{e.emit("requestSystemConfig")},emitSearchForModels:i=>{e.emit("searchForModels",i)},emitAddNewModel:i=>{e.emit("addNewModel",i)},emitDeleteModel:i=>{e.emit("deleteModel",i)},emitConvertToDiffusers:i=>{n(hB()),e.emit("convertToDiffusers",i)},emitMergeDiffusersModels:i=>{n(pB()),e.emit("mergeDiffusersModels",i)},emitRequestModelChange:i=>{n(dB()),e.emit("requestModelChange",i)},emitSaveStagingAreaImageToGallery:i=>{e.emit("requestSaveStagingAreaImageToGallery",i)},emitRequestEmptyTempFolder:()=>{e.emit("requestEmptyTempFolder")}}};let Vf;const Lz=new Uint8Array(16);function Mz(){if(!Vf&&(Vf=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Vf))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vf(Lz)}const Jt=[];for(let t=0;t<256;++t)Jt.push((t+256).toString(16).slice(1));function Dz(t,e=0){return(Jt[t[e+0]]+Jt[t[e+1]]+Jt[t[e+2]]+Jt[t[e+3]]+"-"+Jt[t[e+4]]+Jt[t[e+5]]+"-"+Jt[t[e+6]]+Jt[t[e+7]]+"-"+Jt[t[e+8]]+Jt[t[e+9]]+"-"+Jt[t[e+10]]+Jt[t[e+11]]+Jt[t[e+12]]+Jt[t[e+13]]+Jt[t[e+14]]+Jt[t[e+15]]).toLowerCase()}const Nz=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hb={randomUUID:Nz};function qf(t,e,n){if(Hb.randomUUID&&!e&&!t)return Hb.randomUUID();t=t||{};const r=t.random||(t.rng||Mz)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=r[i];return e}return Dz(r)}const NH=dt("socketio/generateImage"),BH=dt("socketio/runESRGAN"),FH=dt("socketio/runFacetool"),$H=dt("socketio/deleteImage"),Wb=dt("socketio/requestImages"),Vb=dt("socketio/requestNewImages"),zH=dt("socketio/cancelProcessing"),Bz=dt("socketio/requestSystemConfig"),GH=dt("socketio/searchForModels"),UH=dt("socketio/addNewModel"),jH=dt("socketio/deleteModel"),HH=dt("socketio/convertToDiffusers"),WH=dt("socketio/mergeDiffusersModels"),VH=dt("socketio/requestModelChange"),qH=dt("socketio/saveStagingAreaImageToGallery"),KH=dt("socketio/requestEmptyTempFolder"),Fz=t=>{const{dispatch:e,getState:n}=t;return{onConnect:()=>{try{e(ub(!0)),e(ns(Ae.t("common.statusConnected"))),e(Bz());const r=n().gallery;r.categories.result.latest_mtime?e(Vb("result")):e(Wb("result")),r.categories.user.latest_mtime?e(Vb("user")):e(Wb("user"))}catch(r){console.error(r)}},onDisconnect:()=>{try{e(ub(!1)),e(ns(Ae.t("common.statusDisconnected"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const i=n(),{activeTab:a}=i.ui,{shouldLoopback:s}=i.postprocessing,{boundingBox:u,generationMode:c,...f}=r,h={uuid:qf(),...f};if(["txt2img","img2img"].includes(c)&&e(Tf({category:"result",image:{...h,category:"result"}})),c==="unifiedCanvas"&&r.boundingBox){const{boundingBox:p}=r;e(y5({image:{...h,category:"temp"},boundingBox:p})),i.canvas.shouldAutoSave&&e(Tf({image:{...h,category:"result"},category:"result"}))}if(s)switch(bk[a]){case"img2img":{e(M5(h));break}}e(Cm()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{e(b5({uuid:qf(),...r,category:"result"})),r.isBase64||e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{e(Tf({category:"result",image:{uuid:qf(),...r,category:"result"}})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{e(ei(!0)),e(uB(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:a}=r;try{e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),e(cb()),e(Cm())}catch(s){console.error(s)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:a,category:s}=r,u=i.map(c=>({uuid:qf(),...c}));e(w5({images:u,areMoreImagesAvailable:a,category:s})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{e(fB());const{intermediateImage:r}=n().gallery;r&&(r.isBase64||(e(Tf({category:"result",image:r})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`}))),e(Cm())),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;e(tk(r));const{generation:{initialImage:a,maskPath:s}}=n();(a===i||(a==null?void 0:a.url)===i)&&e(I5()),s===i&&e(D5("")),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onSystemConfig:r=>{e(cB(r)),r.infill_methods.includes("patchmatch")||e(L5(r.infill_methods[0]))},onFoundModels:r=>{const{search_folder:i,found_models:a}=r;e(mB(i)),e(vB(a))},onNewModelAdded:r=>{const{new_model_name:i,model_list:a,update:s}=r;e(rs(a)),e(ei(!1)),e(ns(Ae.t("modelManager.modelAdded"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model Added: ${i}`,level:"info"})),e(zl({title:s?`${Ae.t("modelManager.modelUpdated")}: ${i}`:`${Ae.t("modelManager.modelAdded")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:r=>{const{deleted_model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`${Ae.t("modelManager.modelAdded")}: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelEntryDeleted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelConverted:r=>{const{converted_model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelConverted"))),e(ei(!1)),e(If(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model converted: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelConverted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelsMerged:r=>{const{merged_models:i,merged_model_name:a,model_list:s}=r;e(rs(s)),e(ns(Ae.t("common.statusMergedModels"))),e(ei(!1)),e(If(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Models merged: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelsMerged")}: ${a}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelChanged"))),e(ei(!1)),e(If(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(If(!0)),e(cb()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))},onTempFolderEmptied:()=>{e(zl({title:Ae.t("toast.tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}},$z=()=>{const{origin:t}=new URL(window.location.href),e=md(t,{timeout:6e4,path:`${window.location.pathname}socket.io`});let n=!1;return i=>a=>s=>{const{onConnect:u,onDisconnect:c,onError:f,onPostprocessingResult:h,onGenerationResult:p,onIntermediateResult:g,onProgressUpdate:y,onGalleryImages:v,onProcessingCanceled:w,onImageDeleted:x,onSystemConfig:_,onModelChanged:S,onFoundModels:C,onNewModelAdded:O,onModelDeleted:I,onModelConverted:L,onModelsMerged:D,onModelChangeFailed:U,onTempFolderEmptied:X}=Fz(i),{emitGenerateImage:K,emitRunESRGAN:te,emitRunFacetool:ce,emitDeleteImage:j,emitRequestImages:T,emitRequestNewImages:$,emitCancelProcessing:V,emitRequestSystemConfig:ie,emitSearchForModels:H,emitAddNewModel:Y,emitDeleteModel:Q,emitConvertToDiffusers:oe,emitMergeDiffusersModels:ve,emitRequestModelChange:we,emitSaveStagingAreaImageToGallery:Ue,emitRequestEmptyTempFolder:At}=Iz(i,e);switch(n||(e.on("connect",()=>u()),e.on("disconnect",()=>c()),e.on("error",me=>f(me)),e.on("generationResult",me=>p(me)),e.on("postprocessingResult",me=>h(me)),e.on("intermediateResult",me=>g(me)),e.on("progressUpdate",me=>y(me)),e.on("galleryImages",me=>v(me)),e.on("processingCanceled",()=>{w()}),e.on("imageDeleted",me=>{x(me)}),e.on("systemConfig",me=>{_(me)}),e.on("foundModels",me=>{C(me)}),e.on("newModelAdded",me=>{O(me)}),e.on("modelDeleted",me=>{I(me)}),e.on("modelConverted",me=>{L(me)}),e.on("modelsMerged",me=>{D(me)}),e.on("modelChanged",me=>{S(me)}),e.on("modelChangeFailed",me=>{U(me)}),e.on("tempFolderEmptied",()=>{X()}),n=!0),s.type){case"socketio/generateImage":{K(s.payload);break}case"socketio/runESRGAN":{te(s.payload);break}case"socketio/runFacetool":{ce(s.payload);break}case"socketio/deleteImage":{j(s.payload);break}case"socketio/requestImages":{T(s.payload);break}case"socketio/requestNewImages":{$(s.payload);break}case"socketio/cancelProcessing":{V();break}case"socketio/requestSystemConfig":{ie();break}case"socketio/searchForModels":{H(s.payload);break}case"socketio/addNewModel":{Y(s.payload);break}case"socketio/deleteModel":{Q(s.payload);break}case"socketio/convertToDiffusers":{oe(s.payload);break}case"socketio/mergeDiffusersModels":{ve(s.payload);break}case"socketio/requestModelChange":{we(s.payload);break}case"socketio/saveStagingAreaImageToGallery":{Ue(s.payload);break}case"socketio/requestEmptyTempFolder":{At();break}}a(s)}},zz=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map(t=>`canvas.${t}`),Gz=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel","cancelOptions.cancelAfter"].map(t=>`system.${t}`),Uz=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","shouldHoldGalleryOpen","intermediateImage"].map(t=>`gallery.${t}`),_E=$x({generation:N5,postprocessing:F5,gallery:C5,system:yB,canvas:S5,ui:wB,lightbox:E5}),jz=Xx.getPersistConfig({key:"root",storage:Yx,rootReducer:_E,blacklist:[...zz,...Gz,...Uz],debounce:300}),Hz=JN(jz,_E),wE=ON({reducer:Hz,middleware:t=>t({immutableCheck:!1,serializableCheck:!1}).concat($z()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}}),Wz=i5(wE);function Vz(t){if(t.sheet)return t.sheet;for(var e=0;e0?en(Ys,--Ln):0,Gs--,Ot===10&&(Gs=1,rp--),Ot}function Kn(){return Ot=Ln2||Wu(Ot)>3?"":" "}function i6(t,e){for(;--e&&Kn()&&!(Ot<48||Ot>102||Ot>57&&Ot<65||Ot>70&&Ot<97););return tc(t,_d()+(e<6&&ci()==32&&Kn()==32))}function cy(t){for(;Kn();)switch(Ot){case t:return Ln;case 34:case 39:t!==34&&t!==39&&cy(Ot);break;case 40:t===41&&cy(t);break;case 92:Kn();break}return Ln}function a6(t,e){for(;Kn()&&t+Ot!==47+10;)if(t+Ot===42+42&&ci()===47)break;return"/*"+tc(e,Ln-1)+"*"+np(t===47?t:Kn())}function o6(t){for(;!Wu(ci());)Kn();return tc(t,Ln)}function s6(t){return PE(bd("",null,null,null,[""],t=EE(t),0,[0],t))}function bd(t,e,n,r,i,a,s,u,c){for(var f=0,h=0,p=s,g=0,y=0,v=0,w=1,x=1,_=1,S=0,C="",O=i,I=a,L=r,D=C;x;)switch(v=S,S=Kn()){case 40:if(v!=108&&en(D,p-1)==58){uy(D+=qe(wd(S),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:D+=wd(S);break;case 9:case 10:case 13:case 32:D+=r6(v);break;case 92:D+=i6(_d()-1,7);continue;case 47:switch(ci()){case 42:case 47:Kf(l6(a6(Kn(),_d()),e,n),c);break;default:D+="/"}break;case 123*w:u[f++]=ti(D)*_;case 125*w:case 59:case 0:switch(S){case 0:case 125:x=0;case 59+h:y>0&&ti(D)-p&&Kf(y>32?Kb(D+";",r,n,p-1):Kb(qe(D," ","")+";",r,n,p-2),c);break;case 59:D+=";";default:if(Kf(L=qb(D,e,n,f,h,i,u,C,O=[],I=[],p),a),S===123)if(h===0)bd(D,e,L,L,O,a,p,u,I);else switch(g===99&&en(D,3)===110?100:g){case 100:case 109:case 115:bd(t,L,L,r&&Kf(qb(t,L,L,0,0,i,u,C,i,O=[],p),I),i,I,p,u,r?O:I);break;default:bd(D,L,L,L,[""],I,0,u,I)}}f=h=y=0,w=_=1,C=D="",p=s;break;case 58:p=1+ti(D),y=v;default:if(w<1){if(S==123)--w;else if(S==125&&w++==0&&n6()==125)continue}switch(D+=np(S),S*w){case 38:_=h>0?1:(D+="\f",-1);break;case 44:u[f++]=(ti(D)-1)*_,_=1;break;case 64:ci()===45&&(D+=wd(Kn())),g=ci(),h=p=ti(C=D+=o6(_d())),S++;break;case 45:v===45&&ti(D)==2&&(w=0)}}return a}function qb(t,e,n,r,i,a,s,u,c,f,h){for(var p=i-1,g=i===0?a:[""],y=$0(g),v=0,w=0,x=0;v0?g[_]+" "+S:qe(S,/&\f/g,g[_])))&&(c[x++]=C);return ip(t,e,n,i===0?B0:u,c,f,h)}function l6(t,e,n){return ip(t,e,n,bE,np(t6()),Hu(t,2,-2),0)}function Kb(t,e,n,r){return ip(t,e,n,F0,Hu(t,0,r),Hu(t,r+1,-1),r)}function Rs(t,e){for(var n="",r=$0(t),i=0;i6)switch(en(t,e+1)){case 109:if(en(t,e+4)!==45)break;case 102:return qe(t,/(.+:)(.+)-([^]+)/,"$1"+We+"$2-$3$1"+lh+(en(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~uy(t,"stretch")?TE(qe(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(en(t,e+1)!==115)break;case 6444:switch(en(t,ti(t)-3-(~uy(t,"!important")&&10))){case 107:return qe(t,":",":"+We)+t;case 101:return qe(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+We+(en(t,14)===45?"inline-":"")+"box$3$1"+We+"$2$3$1"+ln+"$2box$3")+t}break;case 5936:switch(en(t,e+11)){case 114:return We+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return We+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return We+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return We+t+ln+t+t}return t}var v6=function(e,n,r,i){if(e.length>-1&&!e.return)switch(e.type){case F0:e.return=TE(e.value,e.length);break;case CE:return Rs([ql(e,{value:qe(e.value,"@","@"+We)})],i);case B0:if(e.length)return e6(e.props,function(a){switch(Zz(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Rs([ql(e,{props:[qe(a,/:(read-\w+)/,":"+lh+"$1")]})],i);case"::placeholder":return Rs([ql(e,{props:[qe(a,/:(plac\w+)/,":"+We+"input-$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,":"+lh+"$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,ln+"input-$1")]})],i)}return""})}},y6=[v6],S6=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var x=w.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var i=e.stylisPlugins||y6,a={},s,u=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var x=w.getAttribute("data-emotion").split(" "),_=1;_=4;++r,i-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var C6={animationIterationCount: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},x6=/[A-Z]|^ms/g,k6=/_EMO_([^_]+?)_([^]*?)_EMO_/g,IE=function(e){return e.charCodeAt(1)===45},Qb=function(e){return e!=null&&typeof e!="boolean"},Dm=OE(function(t){return IE(t)?t:t.replace(x6,"-$&").toLowerCase()}),Jb=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(k6,function(r,i,a){return ni={name:i,styles:a,next:ni},i})}return C6[e]!==1&&!IE(e)&&typeof n=="number"&&n!==0?n+"px":n};function Vu(t,e,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 ni={name:n.name,styles:n.styles,next:ni},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ni={name:r.name,styles:r.styles,next:ni},r=r.next;var i=n.styles+";";return i}return E6(t,e,n)}case"function":{if(t!==void 0){var a=ni,s=n(t);return ni=a,Vu(t,e,s)}break}}if(e==null)return n;var u=e[n];return u!==void 0?u:n}function E6(t,e,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return t}var NE=be.createContext({});NE.displayName="ColorModeContext";function BE(){const t=be.useContext(NE);if(t===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return t}function M6(){const t=BE(),e=L6();return{...t,theme:e}}var FE=(...t)=>t.filter(Boolean).join(" ");function D6(){return!1}function zr(t){const e=typeof t;return t!=null&&(e==="object"||e==="function")&&!Array.isArray(t)}var QH=t=>{const{condition:e,message:n}=t;e&&D6()&&console.warn(n)};function io(t,...e){return N6(t)?t(...e):t}var N6=t=>typeof t=="function",JH=t=>t?"":void 0,ZH=t=>t?!0:void 0;function eW(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function tW(...t){return function(n){t.forEach(r=>{r==null||r(n)})}}var uh={},B6={get exports(){return uh},set exports(t){uh=t}};(function(t,e){var n=200,r="__lodash_hash_undefined__",i=800,a=16,s=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",h="[object Boolean]",p="[object Date]",g="[object Error]",y="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",_="[object Null]",S="[object Object]",C="[object Proxy]",O="[object RegExp]",I="[object Set]",L="[object String]",D="[object Undefined]",U="[object WeakMap]",X="[object ArrayBuffer]",K="[object DataView]",te="[object Float32Array]",ce="[object Float64Array]",j="[object Int8Array]",T="[object Int16Array]",$="[object Int32Array]",V="[object Uint8Array]",ie="[object Uint8ClampedArray]",H="[object Uint16Array]",Y="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,ve=/^(?:0|[1-9]\d*)$/,we={};we[te]=we[ce]=we[j]=we[T]=we[$]=we[V]=we[ie]=we[H]=we[Y]=!0,we[u]=we[c]=we[X]=we[h]=we[K]=we[p]=we[g]=we[y]=we[w]=we[x]=we[S]=we[O]=we[I]=we[L]=we[U]=!1;var Ue=typeof yn=="object"&&yn&&yn.Object===Object&&yn,At=typeof self=="object"&&self&&self.Object===Object&&self,me=Ue||At||Function("return this")(),qt=e&&!e.nodeType&&e,Bt=qt&&!0&&t&&!t.nodeType&&t,bn=Bt&&Bt.exports===qt,wr=bn&&Ue.process,Ft=function(){try{var P=Bt&&Bt.require&&Bt.require("util").types;return P||wr&&wr.binding&&wr.binding("util")}catch{}}(),xe=Ft&&Ft.isTypedArray;function Hr(P,N,W){switch(W.length){case 0:return P.call(N);case 1:return P.call(N,W[0]);case 2:return P.call(N,W[0],W[1]);case 3:return P.call(N,W[0],W[1],W[2])}return P.apply(N,W)}function Pt(P,N){for(var W=-1,fe=Array(P);++W-1}function mp(P,N){var W=this.__data__,fe=yi(W,P);return fe<0?(++this.size,W.push([P,N])):W[fe][1]=N,this}xr.prototype.clear=tl,xr.prototype.delete=pp,xr.prototype.get=nl,xr.prototype.has=gp,xr.prototype.set=mp;function Xi(P){var N=-1,W=P==null?0:P.length;for(this.clear();++N1?W[Ie-1]:void 0,Ee=Ie>2?W[2]:void 0;for(Ye=P.length>3&&typeof Ye=="function"?(Ie--,Ye):void 0,Ee&&pc(W[0],W[1],Ee)&&(Ye=Ie<3?void 0:Ye,Ie=1),N=Object(N);++fe-1&&P%1==0&&P0){if(++N>=i)return arguments[0]}else N=0;return P.apply(void 0,arguments)}}function Sc(P){if(P!=null){try{return Dn.call(P)}catch{}try{return P+""}catch{}}return""}function Mo(P,N){return P===N||P!==P&&N!==N}var ul=il(function(){return arguments}())?il:function(P){return za(P)&&bt.call(P,"callee")&&!Js.call(P,"callee")},cl=Array.isArray;function Do(P){return P!=null&&wc(P.length)&&!fl(P)}function Dp(P){return za(P)&&Do(P)}var _c=sp||Fp;function fl(P){if(!kr(P))return!1;var N=To(P);return N==y||N==v||N==f||N==C}function wc(P){return typeof P=="number"&&P>-1&&P%1==0&&P<=s}function kr(P){var N=typeof P;return P!=null&&(N=="object"||N=="function")}function za(P){return P!=null&&typeof P=="object"}function Np(P){if(!za(P)||To(P)!=S)return!1;var N=Po(P);if(N===null)return!0;var W=bt.call(N,"constructor")&&N.constructor;return typeof W=="function"&&W instanceof W&&Dn.call(W)==Co}var bc=xe?gi(xe):ac;function Bp(P){return cc(P,Cc(P))}function Cc(P){return Do(P)?Pp(P,!0):Rp(P)}var nt=Ro(function(P,N,W,fe){oc(P,N,W,fe)});function et(P){return function(){return P}}function xc(P){return P}function Fp(){return!1}t.exports=nt})(B6,uh);const ai=uh;var F6=t=>/!(important)?$/.test(t),t2=t=>typeof t=="string"?t.replace(/!(important)?$/,"").trim():t,$6=(t,e)=>n=>{const r=String(e),i=F6(r),a=t2(r),s=t?`${t}.${a}`:a;let u=zr(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:e;return u=t2(u),i?`${u} !important`:u};function G0(t){const{scale:e,transform:n,compose:r}=t;return(a,s)=>{var u;const c=$6(e,a)(s);let f=(u=n==null?void 0:n(c,s))!=null?u:c;return r&&(f=r(f,s)),f}}var Yf=(...t)=>e=>t.reduce((n,r)=>r(n),e);function Ir(t,e){return n=>{const r={property:n,scale:t};return r.transform=G0({scale:t,transform:e}),r}}var z6=({rtl:t,ltr:e})=>n=>n.direction==="rtl"?t:e;function G6(t){const{property:e,scale:n,transform:r}=t;return{scale:n,property:z6(e),transform:n?G0({scale:n,compose:r}):r}}var $E=["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 U6(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...$E].join(" ")}function j6(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...$E].join(" ")}var H6={"--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(" ")},W6={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 V6(t){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":t,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var q6={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},fy={"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"},K6=new Set(Object.values(fy)),zE=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Y6=t=>t.trim();function X6(t,e){if(t==null||zE.has(t))return t;const r=/(^[a-z-A-Z]+)\((.*)\)/g.exec(t),i=r==null?void 0:r[1],a=r==null?void 0:r[2];if(!i||!a)return t;const s=i.includes("-gradient")?i:`${i}-gradient`,[u,...c]=a.split(",").map(Y6).filter(Boolean);if((c==null?void 0:c.length)===0)return t;const f=u in fy?fy[u]:u;c.unshift(f);const h=c.map(p=>{if(K6.has(p))return p;const g=p.indexOf(" "),[y,v]=g!==-1?[p.substr(0,g),p.substr(g+1)]:[p],w=GE(v)?v:v&&v.split(" "),x=`colors.${y}`,_=x in e.__cssMap?e.__cssMap[x].varRef:y;return w?[_,...Array.isArray(w)?w:[w]].join(" "):_});return`${s}(${h.join(", ")})`}var GE=t=>typeof t=="string"&&t.includes("(")&&t.includes(")"),Q6=(t,e)=>X6(t,e??{});function J6(t){return/^var\(--.+\)$/.test(t)}var Z6=t=>{const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}},Jr=t=>e=>`${t}(${e})`,Fe={filter(t){return t!=="auto"?t:H6},backdropFilter(t){return t!=="auto"?t:W6},ring(t){return V6(Fe.px(t))},bgClip(t){return t==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:t}},transform(t){return t==="auto"?U6():t==="auto-gpu"?j6():t},vh(t){return t==="$100vh"?"var(--chakra-vh)":t},px(t){if(t==null)return t;const{unitless:e}=Z6(t);return e||typeof t=="number"?`${t}px`:t},fraction(t){return typeof t!="number"||t>1?t:`${t*100}%`},float(t,e){const n={left:"right",right:"left"};return e.direction==="rtl"?n[t]:t},degree(t){if(J6(t)||t==null)return t;const e=typeof t=="string"&&!t.endsWith("deg");return typeof t=="number"||e?`${t}deg`:t},gradient:Q6,blur:Jr("blur"),opacity:Jr("opacity"),brightness:Jr("brightness"),contrast:Jr("contrast"),dropShadow:Jr("drop-shadow"),grayscale:Jr("grayscale"),hueRotate:Jr("hue-rotate"),invert:Jr("invert"),saturate:Jr("saturate"),sepia:Jr("sepia"),bgImage(t){return t==null||GE(t)||zE.has(t)?t:`url(${t})`},outline(t){const e=String(t)==="0"||String(t)==="none";return t!==null&&e?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:t}},flexDirection(t){var e;const{space:n,divide:r}=(e=q6[t])!=null?e:{},i={flexDirection:t};return n&&(i[n]=1),r&&(i[r]=1),i}},B={borderWidths:Ir("borderWidths"),borderStyles:Ir("borderStyles"),colors:Ir("colors"),borders:Ir("borders"),radii:Ir("radii",Fe.px),space:Ir("space",Yf(Fe.vh,Fe.px)),spaceT:Ir("space",Yf(Fe.vh,Fe.px)),degreeT(t){return{property:t,transform:Fe.degree}},prop(t,e,n){return{property:t,scale:e,...e&&{transform:G0({scale:e,transform:n})}}},propT(t,e){return{property:t,transform:e}},sizes:Ir("sizes",Yf(Fe.vh,Fe.px)),sizesT:Ir("sizes",Yf(Fe.vh,Fe.fraction)),shadows:Ir("shadows"),logical:G6,blur:Ir("blur",Fe.blur)},Cd={background:B.colors("background"),backgroundColor:B.colors("backgroundColor"),backgroundImage:B.propT("backgroundImage",Fe.bgImage),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Fe.bgClip},bgSize:B.prop("backgroundSize"),bgPosition:B.prop("backgroundPosition"),bg:B.colors("background"),bgColor:B.colors("backgroundColor"),bgPos:B.prop("backgroundPosition"),bgRepeat:B.prop("backgroundRepeat"),bgAttachment:B.prop("backgroundAttachment"),bgGradient:B.propT("backgroundImage",Fe.gradient),bgClip:{transform:Fe.bgClip}};Object.assign(Cd,{bgImage:Cd.backgroundImage,bgImg:Cd.backgroundImage});var He={border:B.borders("border"),borderWidth:B.borderWidths("borderWidth"),borderStyle:B.borderStyles("borderStyle"),borderColor:B.colors("borderColor"),borderRadius:B.radii("borderRadius"),borderTop:B.borders("borderTop"),borderBlockStart:B.borders("borderBlockStart"),borderTopLeftRadius:B.radii("borderTopLeftRadius"),borderStartStartRadius:B.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:B.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:B.radii("borderTopRightRadius"),borderStartEndRadius:B.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:B.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:B.borders("borderRight"),borderInlineEnd:B.borders("borderInlineEnd"),borderBottom:B.borders("borderBottom"),borderBlockEnd:B.borders("borderBlockEnd"),borderBottomLeftRadius:B.radii("borderBottomLeftRadius"),borderBottomRightRadius:B.radii("borderBottomRightRadius"),borderLeft:B.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:B.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:B.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:B.borders(["borderLeft","borderRight"]),borderInline:B.borders("borderInline"),borderY:B.borders(["borderTop","borderBottom"]),borderBlock:B.borders("borderBlock"),borderTopWidth:B.borderWidths("borderTopWidth"),borderBlockStartWidth:B.borderWidths("borderBlockStartWidth"),borderTopColor:B.colors("borderTopColor"),borderBlockStartColor:B.colors("borderBlockStartColor"),borderTopStyle:B.borderStyles("borderTopStyle"),borderBlockStartStyle:B.borderStyles("borderBlockStartStyle"),borderBottomWidth:B.borderWidths("borderBottomWidth"),borderBlockEndWidth:B.borderWidths("borderBlockEndWidth"),borderBottomColor:B.colors("borderBottomColor"),borderBlockEndColor:B.colors("borderBlockEndColor"),borderBottomStyle:B.borderStyles("borderBottomStyle"),borderBlockEndStyle:B.borderStyles("borderBlockEndStyle"),borderLeftWidth:B.borderWidths("borderLeftWidth"),borderInlineStartWidth:B.borderWidths("borderInlineStartWidth"),borderLeftColor:B.colors("borderLeftColor"),borderInlineStartColor:B.colors("borderInlineStartColor"),borderLeftStyle:B.borderStyles("borderLeftStyle"),borderInlineStartStyle:B.borderStyles("borderInlineStartStyle"),borderRightWidth:B.borderWidths("borderRightWidth"),borderInlineEndWidth:B.borderWidths("borderInlineEndWidth"),borderRightColor:B.colors("borderRightColor"),borderInlineEndColor:B.colors("borderInlineEndColor"),borderRightStyle:B.borderStyles("borderRightStyle"),borderInlineEndStyle:B.borderStyles("borderInlineEndStyle"),borderTopRadius:B.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:B.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:B.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:B.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(He,{rounded:He.borderRadius,roundedTop:He.borderTopRadius,roundedTopLeft:He.borderTopLeftRadius,roundedTopRight:He.borderTopRightRadius,roundedTopStart:He.borderStartStartRadius,roundedTopEnd:He.borderStartEndRadius,roundedBottom:He.borderBottomRadius,roundedBottomLeft:He.borderBottomLeftRadius,roundedBottomRight:He.borderBottomRightRadius,roundedBottomStart:He.borderEndStartRadius,roundedBottomEnd:He.borderEndEndRadius,roundedLeft:He.borderLeftRadius,roundedRight:He.borderRightRadius,roundedStart:He.borderInlineStartRadius,roundedEnd:He.borderInlineEndRadius,borderStart:He.borderInlineStart,borderEnd:He.borderInlineEnd,borderTopStartRadius:He.borderStartStartRadius,borderTopEndRadius:He.borderStartEndRadius,borderBottomStartRadius:He.borderEndStartRadius,borderBottomEndRadius:He.borderEndEndRadius,borderStartRadius:He.borderInlineStartRadius,borderEndRadius:He.borderInlineEndRadius,borderStartWidth:He.borderInlineStartWidth,borderEndWidth:He.borderInlineEndWidth,borderStartColor:He.borderInlineStartColor,borderEndColor:He.borderInlineEndColor,borderStartStyle:He.borderInlineStartStyle,borderEndStyle:He.borderInlineEndStyle});var e8={color:B.colors("color"),textColor:B.colors("color"),fill:B.colors("fill"),stroke:B.colors("stroke")},dy={boxShadow:B.shadows("boxShadow"),mixBlendMode:!0,blendMode:B.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:B.prop("backgroundBlendMode"),opacity:!0};Object.assign(dy,{shadow:dy.boxShadow});var t8={filter:{transform:Fe.filter},blur:B.blur("--chakra-blur"),brightness:B.propT("--chakra-brightness",Fe.brightness),contrast:B.propT("--chakra-contrast",Fe.contrast),hueRotate:B.degreeT("--chakra-hue-rotate"),invert:B.propT("--chakra-invert",Fe.invert),saturate:B.propT("--chakra-saturate",Fe.saturate),dropShadow:B.propT("--chakra-drop-shadow",Fe.dropShadow),backdropFilter:{transform:Fe.backdropFilter},backdropBlur:B.blur("--chakra-backdrop-blur"),backdropBrightness:B.propT("--chakra-backdrop-brightness",Fe.brightness),backdropContrast:B.propT("--chakra-backdrop-contrast",Fe.contrast),backdropHueRotate:B.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:B.propT("--chakra-backdrop-invert",Fe.invert),backdropSaturate:B.propT("--chakra-backdrop-saturate",Fe.saturate)},ch={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Fe.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:B.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:B.space("gap"),rowGap:B.space("rowGap"),columnGap:B.space("columnGap")};Object.assign(ch,{flexDir:ch.flexDirection});var UE={gridGap:B.space("gridGap"),gridColumnGap:B.space("gridColumnGap"),gridRowGap:B.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},n8={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Fe.outline},outlineOffset:!0,outlineColor:B.colors("outlineColor")},lr={width:B.sizesT("width"),inlineSize:B.sizesT("inlineSize"),height:B.sizes("height"),blockSize:B.sizes("blockSize"),boxSize:B.sizes(["width","height"]),minWidth:B.sizes("minWidth"),minInlineSize:B.sizes("minInlineSize"),minHeight:B.sizes("minHeight"),minBlockSize:B.sizes("minBlockSize"),maxWidth:B.sizes("maxWidth"),maxInlineSize:B.sizes("maxInlineSize"),maxHeight:B.sizes("maxHeight"),maxBlockSize:B.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,hideFrom:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.minWQuery)!=null?i:`@media screen and (min-width: ${t})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.maxWQuery)!=null?i:`@media screen and (max-width: ${t})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:B.propT("float",Fe.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(lr,{w:lr.width,h:lr.height,minW:lr.minWidth,maxW:lr.maxWidth,minH:lr.minHeight,maxH:lr.maxHeight,overscroll:lr.overscrollBehavior,overscrollX:lr.overscrollBehaviorX,overscrollY:lr.overscrollBehaviorY});var r8={listStyleType:!0,listStylePosition:!0,listStylePos:B.prop("listStylePosition"),listStyleImage:!0,listStyleImg:B.prop("listStyleImage")};function i8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},o8=a8(i8),s8={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},l8={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},Nm=(t,e,n)=>{const r={},i=o8(t,e,{});for(const a in i)a in n&&n[a]!=null||(r[a]=i[a]);return r},u8={srOnly:{transform(t){return t===!0?s8:t==="focusable"?l8:{}}},layerStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`layerStyles.${t}`,n)},textStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`textStyles.${t}`,n)},apply:{processResult:!0,transform:(t,e,n)=>Nm(e,t,n)}},Su={position:!0,pos:B.prop("position"),zIndex:B.prop("zIndex","zIndices"),inset:B.spaceT("inset"),insetX:B.spaceT(["left","right"]),insetInline:B.spaceT("insetInline"),insetY:B.spaceT(["top","bottom"]),insetBlock:B.spaceT("insetBlock"),top:B.spaceT("top"),insetBlockStart:B.spaceT("insetBlockStart"),bottom:B.spaceT("bottom"),insetBlockEnd:B.spaceT("insetBlockEnd"),left:B.spaceT("left"),insetInlineStart:B.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:B.spaceT("right"),insetInlineEnd:B.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Su,{insetStart:Su.insetInlineStart,insetEnd:Su.insetInlineEnd});var c8={ring:{transform:Fe.ring},ringColor:B.colors("--chakra-ring-color"),ringOffset:B.prop("--chakra-ring-offset-width"),ringOffsetColor:B.colors("--chakra-ring-offset-color"),ringInset:B.prop("--chakra-ring-inset")},st={margin:B.spaceT("margin"),marginTop:B.spaceT("marginTop"),marginBlockStart:B.spaceT("marginBlockStart"),marginRight:B.spaceT("marginRight"),marginInlineEnd:B.spaceT("marginInlineEnd"),marginBottom:B.spaceT("marginBottom"),marginBlockEnd:B.spaceT("marginBlockEnd"),marginLeft:B.spaceT("marginLeft"),marginInlineStart:B.spaceT("marginInlineStart"),marginX:B.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:B.spaceT("marginInline"),marginY:B.spaceT(["marginTop","marginBottom"]),marginBlock:B.spaceT("marginBlock"),padding:B.space("padding"),paddingTop:B.space("paddingTop"),paddingBlockStart:B.space("paddingBlockStart"),paddingRight:B.space("paddingRight"),paddingBottom:B.space("paddingBottom"),paddingBlockEnd:B.space("paddingBlockEnd"),paddingLeft:B.space("paddingLeft"),paddingInlineStart:B.space("paddingInlineStart"),paddingInlineEnd:B.space("paddingInlineEnd"),paddingX:B.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:B.space("paddingInline"),paddingY:B.space(["paddingTop","paddingBottom"]),paddingBlock:B.space("paddingBlock")};Object.assign(st,{m:st.margin,mt:st.marginTop,mr:st.marginRight,me:st.marginInlineEnd,marginEnd:st.marginInlineEnd,mb:st.marginBottom,ml:st.marginLeft,ms:st.marginInlineStart,marginStart:st.marginInlineStart,mx:st.marginX,my:st.marginY,p:st.padding,pt:st.paddingTop,py:st.paddingY,px:st.paddingX,pb:st.paddingBottom,pl:st.paddingLeft,ps:st.paddingInlineStart,paddingStart:st.paddingInlineStart,pr:st.paddingRight,pe:st.paddingInlineEnd,paddingEnd:st.paddingInlineEnd});var f8={textDecorationColor:B.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:B.shadows("textShadow")},d8={clipPath:!0,transform:B.propT("transform",Fe.transform),transformOrigin:!0,translateX:B.spaceT("--chakra-translate-x"),translateY:B.spaceT("--chakra-translate-y"),skewX:B.degreeT("--chakra-skew-x"),skewY:B.degreeT("--chakra-skew-y"),scaleX:B.prop("--chakra-scale-x"),scaleY:B.prop("--chakra-scale-y"),scale:B.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:B.degreeT("--chakra-rotate")},h8={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:B.prop("transitionDuration","transition.duration"),transitionProperty:B.prop("transitionProperty","transition.property"),transitionTimingFunction:B.prop("transitionTimingFunction","transition.easing")},p8={fontFamily:B.prop("fontFamily","fonts"),fontSize:B.prop("fontSize","fontSizes",Fe.px),fontWeight:B.prop("fontWeight","fontWeights"),lineHeight:B.prop("lineHeight","lineHeights"),letterSpacing:B.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(t){if(t===!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"}},g8={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:B.spaceT("scrollMargin"),scrollMarginTop:B.spaceT("scrollMarginTop"),scrollMarginBottom:B.spaceT("scrollMarginBottom"),scrollMarginLeft:B.spaceT("scrollMarginLeft"),scrollMarginRight:B.spaceT("scrollMarginRight"),scrollMarginX:B.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:B.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:B.spaceT("scrollPadding"),scrollPaddingTop:B.spaceT("scrollPaddingTop"),scrollPaddingBottom:B.spaceT("scrollPaddingBottom"),scrollPaddingLeft:B.spaceT("scrollPaddingLeft"),scrollPaddingRight:B.spaceT("scrollPaddingRight"),scrollPaddingX:B.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:B.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function jE(t){return zr(t)&&t.reference?t.reference:String(t)}var ap=(t,...e)=>e.map(jE).join(` ${t} `).replace(/calc/g,""),n2=(...t)=>`calc(${ap("+",...t)})`,r2=(...t)=>`calc(${ap("-",...t)})`,hy=(...t)=>`calc(${ap("*",...t)})`,i2=(...t)=>`calc(${ap("/",...t)})`,a2=t=>{const e=jE(t);return e!=null&&!Number.isNaN(parseFloat(e))?String(e).startsWith("-")?String(e).slice(1):`-${e}`:hy(e,-1)},eo=Object.assign(t=>({add:(...e)=>eo(n2(t,...e)),subtract:(...e)=>eo(r2(t,...e)),multiply:(...e)=>eo(hy(t,...e)),divide:(...e)=>eo(i2(t,...e)),negate:()=>eo(a2(t)),toString:()=>t.toString()}),{add:n2,subtract:r2,multiply:hy,divide:i2,negate:a2});function m8(t,e="-"){return t.replace(/\s+/g,e)}function v8(t){const e=m8(t.toString());return S8(y8(e))}function y8(t){return t.includes("\\.")?t:!Number.isInteger(parseFloat(t.toString()))?t.replace(".","\\."):t}function S8(t){return t.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function _8(t,e=""){return[e,t].filter(Boolean).join("-")}function w8(t,e){return`var(${t}${e?`, ${e}`:""})`}function b8(t,e=""){return v8(`--${_8(t,e)}`)}function C8(t,e,n){const r=b8(t,n);return{variable:r,reference:w8(r,e)}}function x8(t){const e=t==null?0:t.length;return e?t[e-1]:void 0}function k8(t){const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}}function py(t){if(t==null)return t;const{unitless:e}=k8(t);return e||typeof t=="number"?`${t}px`:t}var HE=(t,e)=>parseInt(t[1],10)>parseInt(e[1],10)?1:-1,U0=t=>Object.fromEntries(Object.entries(t).sort(HE));function o2(t){const e=U0(t);return Object.assign(Object.values(e),e)}function E8(t){const e=Object.keys(U0(t));return new Set(e)}function s2(t){var e;if(!t)return t;t=(e=py(t))!=null?e:t;const n=-.02;return typeof t=="number"?`${t+n}`:t.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function au(t,e){const n=["@media screen"];return t&&n.push("and",`(min-width: ${py(t)})`),e&&n.push("and",`(max-width: ${py(e)})`),n.join(" ")}function P8(t){var e;if(!t)return null;t.base=(e=t.base)!=null?e:"0px";const n=o2(t),r=Object.entries(t).sort(HE).map(([s,u],c,f)=>{var h;let[,p]=(h=f[c+1])!=null?h:[];return p=parseFloat(p)>0?s2(p):void 0,{_minW:s2(u),breakpoint:s,minW:u,maxW:p,maxWQuery:au(null,p),minWQuery:au(u),minMaxQuery:au(u,p)}}),i=E8(t),a=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const u=Object.keys(s);return u.length>0&&u.every(c=>i.has(c))},asObject:U0(t),asArray:o2(t),details:r,get(s){return r.find(u=>u.breakpoint===s)},media:[null,...n.map(s=>au(s)).slice(1)],toArrayValue(s){if(!zr(s))throw new Error("toArrayValue: value must be an object");const u=a.map(c=>{var f;return(f=s[c])!=null?f:null});for(;x8(u)===null;)u.pop();return u},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((u,c,f)=>{const h=a[f];return h!=null&&c!=null&&(u[h]=c),u},{})}}}var Qt={hover:(t,e)=>`${t}:hover ${e}, ${t}[data-hover] ${e}`,focus:(t,e)=>`${t}:focus ${e}, ${t}[data-focus] ${e}`,focusVisible:(t,e)=>`${t}:focus-visible ${e}`,focusWithin:(t,e)=>`${t}:focus-within ${e}`,active:(t,e)=>`${t}:active ${e}, ${t}[data-active] ${e}`,disabled:(t,e)=>`${t}:disabled ${e}, ${t}[data-disabled] ${e}`,invalid:(t,e)=>`${t}:invalid ${e}, ${t}[data-invalid] ${e}`,checked:(t,e)=>`${t}:checked ${e}, ${t}[data-checked] ${e}`,indeterminate:(t,e)=>`${t}:indeterminate ${e}, ${t}[aria-checked=mixed] ${e}, ${t}[data-indeterminate] ${e}`,readOnly:(t,e)=>`${t}:read-only ${e}, ${t}[readonly] ${e}, ${t}[data-read-only] ${e}`,expanded:(t,e)=>`${t}:read-only ${e}, ${t}[aria-expanded=true] ${e}, ${t}[data-expanded] ${e}`,placeholderShown:(t,e)=>`${t}:placeholder-shown ${e}`},la=t=>WE(e=>t(e,"&"),"[role=group]","[data-group]",".group"),Ai=t=>WE(e=>t(e,"~ &"),"[data-peer]",".peer"),WE=(t,...e)=>e.map(t).join(", "),op={_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",_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:la(Qt.hover),_peerHover:Ai(Qt.hover),_groupFocus:la(Qt.focus),_peerFocus:Ai(Qt.focus),_groupFocusVisible:la(Qt.focusVisible),_peerFocusVisible:Ai(Qt.focusVisible),_groupActive:la(Qt.active),_peerActive:Ai(Qt.active),_groupDisabled:la(Qt.disabled),_peerDisabled:Ai(Qt.disabled),_groupInvalid:la(Qt.invalid),_peerInvalid:Ai(Qt.invalid),_groupChecked:la(Qt.checked),_peerChecked:Ai(Qt.checked),_groupFocusWithin:la(Qt.focusWithin),_peerFocusWithin:Ai(Qt.focusWithin),_peerPlaceholderShown:Ai(Qt.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]"},O8=Object.keys(op);function l2(t,e){return C8(String(t).replace(/\./g,"-"),void 0,e)}function T8(t,e){let n={};const r={};for(const[i,a]of Object.entries(t)){const{isSemantic:s,value:u}=a,{variable:c,reference:f}=l2(i,e==null?void 0:e.cssVarPrefix);if(!s){if(i.startsWith("space")){const g=i.split("."),[y,...v]=g,w=`${y}.-${v.join(".")}`,x=eo.negate(u),_=eo.negate(f);r[w]={value:x,var:c,varRef:_}}n[c]=u,r[i]={value:u,var:c,varRef:f};continue}const h=g=>{const v=[String(i).split(".")[0],g].join(".");if(!t[v])return g;const{reference:x}=l2(v,e==null?void 0:e.cssVarPrefix);return x},p=zr(u)?u:{default:u};n=ai(n,Object.entries(p).reduce((g,[y,v])=>{var w,x;const _=h(v);if(y==="default")return g[c]=_,g;const S=(x=(w=op)==null?void 0:w[y])!=null?x:y;return g[S]={[c]:_},g},{})),r[i]={value:f,var:c,varRef:f}}return{cssVars:n,cssMap:r}}function R8(t,e=[]){const n=Object.assign({},t);for(const r of e)r in n&&delete n[r];return n}function A8(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}var I8=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function L8(t){return A8(t,I8)}function M8(t){return t.semanticTokens}function D8(t){const{__cssMap:e,__cssVars:n,__breakpoints:r,...i}=t;return i}function N8({tokens:t,semanticTokens:e}){var n,r;const i=Object.entries((n=gy(t))!=null?n:{}).map(([s,u])=>[s,{isSemantic:!1,value:u}]),a=Object.entries((r=gy(e,1))!=null?r:{}).map(([s,u])=>[s,{isSemantic:!0,value:u}]);return Object.fromEntries([...i,...a])}function gy(t,e=1/0){return!zr(t)&&!Array.isArray(t)||!e?t:Object.entries(t).reduce((n,[r,i])=>(zr(i)||Array.isArray(i)?Object.entries(gy(i,e-1)).forEach(([a,s])=>{n[`${r}.${a}`]=s}):n[r]=i,n),{})}function nW(t){var e;const n=D8(t),r=L8(n),i=M8(n),a=N8({tokens:r,semanticTokens:i}),s=(e=n.config)==null?void 0:e.cssVarPrefix,{cssMap:u,cssVars:c}=T8(a,{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"},...c},__cssMap:u,__breakpoints:P8(n.breakpoints)}),n}var j0=ai({},Cd,He,e8,ch,lr,t8,c8,n8,UE,u8,Su,dy,st,g8,p8,f8,d8,r8,h8),B8=Object.assign({},st,lr,ch,UE,Su),rW=Object.keys(B8),F8=[...Object.keys(j0),...O8],$8={...j0,...op},z8=t=>t in $8,G8=t=>e=>{if(!e.__breakpoints)return t;const{isResponsive:n,toArrayValue:r,media:i}=e.__breakpoints,a={};for(const s in t){let u=io(t[s],e);if(u==null)continue;if(u=zr(u)&&n(u)?r(u):u,!Array.isArray(u)){a[s]=u;continue}const c=u.slice(0,i.length).length;for(let f=0;ft.startsWith("--")&&typeof e=="string"&&!j8(e),W8=(t,e)=>{var n,r;if(e==null)return e;const i=c=>{var f,h;return(h=(f=t.__cssMap)==null?void 0:f[c])==null?void 0:h.varRef},a=c=>{var f;return(f=i(c))!=null?f:c},[s,u]=U8(e);return e=(r=(n=i(s))!=null?n:a(u))!=null?r:a(e),e};function V8(t){const{configs:e={},pseudos:n={},theme:r}=t,i=(a,s=!1)=>{var u,c,f;const h=io(a,r),p=G8(h)(r);let g={};for(let y in p){const v=p[y];let w=io(v,r);y in n&&(y=n[y]),H8(y,w)&&(w=W8(r,w));let x=e[y];if(x===!0&&(x={property:y}),zr(w)){g[y]=(u=g[y])!=null?u:{},g[y]=ai({},g[y],i(w,!0));continue}let _=(f=(c=x==null?void 0:x.transform)==null?void 0:c.call(x,w,r,h))!=null?f:w;_=x!=null&&x.processResult?i(_,!0):_;const S=io(x==null?void 0:x.property,r);if(!s&&(x!=null&&x.static)){const C=io(x.static,r);g=ai({},g,C)}if(S&&Array.isArray(S)){for(const C of S)g[C]=_;continue}if(S){S==="&"&&zr(_)?g=ai({},g,_):g[S]=_;continue}if(zr(_)){g=ai({},g,_);continue}g[y]=_}return g};return i}var q8=t=>e=>V8({theme:e,pseudos:op,configs:j0})(t);function iW(t){return t}function aW(t){return t}function oW(t){return{definePartsStyle(e){return e},defineMultiStyleConfig(e){return{parts:t,...e}}}}function K8(t,e){if(Array.isArray(t))return t;if(zr(t))return e(t);if(t!=null)return[t]}function Y8(t,e){for(let n=e+1;n{ai(f,{[C]:g?S[C]:{[_]:S[C]}})});continue}if(!y){g?ai(f,S):f[_]=S;continue}f[_]=S}}return f}}function Q8(t){return e=>{var n;const{variant:r,size:i,theme:a}=e,s=X8(a);return ai({},io((n=t.baseStyle)!=null?n:{},e),s(t,"sizes",i,e),s(t,"variants",r,e))}}function sW(t,e,n){var r,i,a;return(a=(i=(r=t.__cssMap)==null?void 0:r[`${e}.${n}`])==null?void 0:i.varRef)!=null?a:n}function VE(t){return R8(t,["styleConfig","size","variant","colorScheme"])}function J8(t,e){const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),n}function Z8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},tG=eG(Z8);function qE(t,e){const n={};return Object.keys(t).forEach(r=>{const i=t[r];e(i,r,t)&&(n[r]=i)}),n}var KE=t=>qE(t,e=>e!=null);function nG(t){return typeof t=="function"}function rG(t,...e){return nG(t)?t(...e):t}function lW(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var iG=typeof Element<"u",aG=typeof Map=="function",oG=typeof Set=="function",sG=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function xd(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!xd(t[r],e[r]))return!1;return!0}var a;if(aG&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;for(a=t.entries();!(r=a.next()).done;)if(!xd(r.value[1],e.get(r.value[0])))return!1;return!0}if(oG&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(sG&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(iG&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&t.$$typeof)&&!xd(t[i[r]],e[i[r]]))return!1;return!0}return t!==t&&e!==e}var lG=function(e,n){try{return xd(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};function YE(t,e={}){var n;const{styleConfig:r,...i}=e,{theme:a,colorMode:s}=M6(),u=t?tG(a,`components.${t}`):void 0,c=r||u,f=ai({theme:a,colorMode:s},(n=c==null?void 0:c.defaultProps)!=null?n:{},KE(J8(i,["children"]))),h=be.useRef({});if(c){const g=Q8(c)(f);lG(h.current,g)||(h.current=g)}return h.current}function XE(t,e={}){return YE(t,e)}function uW(t,e={}){return YE(t,e)}var uG=new Set([...F8,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),cG=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function fG(t){return cG.has(t)||!uG.has(t)}function dG(t){const e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function hG(t,...e){if(t==null)throw new TypeError("Cannot convert undefined or null to object");const n={...t};for(const r of e)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}var pG=/^((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)-.*))$/,gG=OE(function(t){return pG.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),mG=gG,vG=function(e){return e!=="theme"},u2=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?mG:vG},c2=function(e,n,r){var i;if(n){var a=n.shouldForwardProp;i=e.__emotion_forwardProp&&a?function(s){return e.__emotion_forwardProp(s)&&a(s)}:a}return typeof i!="function"&&r&&(i=e.__emotion_forwardProp),i},yG=function(e){var n=e.cache,r=e.serialized,i=e.isStringTag;return RE(n,r,i),O6(function(){return AE(n,r,i)}),null},SG=function t(e,n){var r=e.__emotion_real===e,i=r&&e.__emotion_base||e,a,s;n!==void 0&&(a=n.label,s=n.target);var u=c2(e,n,r),c=u||u2(i),f=!c("as");return function(){var h=arguments,p=r&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(a!==void 0&&p.push("label:"+a+";"),h[0]==null||h[0].raw===void 0)p.push.apply(p,h);else{p.push(h[0][0]);for(var g=h.length,y=1;ye=>{const{theme:n,css:r,__css:i,sx:a,...s}=e,u=qE(s,(p,g)=>z8(g)),c=rG(t,e),f=hG({},i,c,KE(u),a),h=q8(f)(e.theme);return r?[h,r]:h};function Bm(t,e){const{baseStyle:n,...r}=e??{};r.shouldForwardProp||(r.shouldForwardProp=fG);const i=bG({baseStyle:n}),a=wG(t,r)(i);return As.forwardRef(function(c,f){const{colorMode:h,forced:p}=BE();return As.createElement(a,{ref:f,"data-theme":p?h:void 0,...c})})}function CG(){const t=new Map;return new Proxy(Bm,{apply(e,n,r){return Bm(...r)},get(e,n){return t.has(n)||t.set(n,Bm(n)),t.get(n)}})}var dh=CG();function H0(t){return be.forwardRef(t)}var xG=I6({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QE=H0((t,e)=>{const n=XE("Spinner",t),{label:r="Loading...",thickness:i="2px",speed:a="0.45s",emptyColor:s="transparent",className:u,...c}=VE(t),f=FE("chakra-spinner",u),h={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${xG} ${a} linear infinite`,...n};return jt.jsx(dh.div,{ref:e,__css:h,className:f,...c,children:r&&jt.jsx(dh.span,{srOnly:!0,children:r})})});QE.displayName="Spinner";var JE=H0(function(e,n){const r=XE("Text",e),{className:i,align:a,decoration:s,casing:u,...c}=VE(e),f=dG({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return jt.jsx(dh.p,{ref:n,className:FE("chakra-text",e.className),...f,...c,__css:r})});JE.displayName="Text";var ZE=H0(function(e,n){const{direction:r,align:i,justify:a,wrap:s,basis:u,grow:c,shrink:f,...h}=e,p={display:"flex",flexDirection:r,alignItems:i,justifyContent:a,flexWrap:s,flexBasis:u,flexGrow:c,flexShrink:f};return jt.jsx(dh.div,{ref:n,__css:p,...h})});ZE.displayName="Flex";const d2=t=>{const{t:e}=sB(),{showText:n=!1,text:r=e("common.loadingInvokeAI")}=t;return jt.jsxs(ZE,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#121212",flexDirection:"column",rowGap:4,children:[jt.jsx(QE,{color:"grey",w:"5rem",h:"5rem"}),n&&jt.jsx(JE,{color:"grey",fontWeight:"semibold",fontFamily:"'Inter', sans-serif",children:r})]})},kG=be.lazy(()=>Cx(()=>import("./App-2afdb3c5.js"),["./App-2afdb3c5.js","./scrollbar-7e342734.js","./App-06f6cac1.css"],import.meta.url)),EG=be.lazy(()=>Cx(()=>import("./ThemeLocaleProvider-20e303dd.js"),["./ThemeLocaleProvider-20e303dd.js","./scrollbar-7e342734.js"],import.meta.url));function PG(){return jt.jsx(As.StrictMode,{children:jt.jsx(K3,{store:wE,children:jt.jsx(Ix,{loading:jt.jsx(d2,{}),persistor:Wz,children:jt.jsx(As.Suspense,{fallback:jt.jsx(d2,{showText:!0}),children:jt.jsx(EG,{children:jt.jsx(kG,{})})})})})})}Fm.createRoot(document.getElementById("root")).render(jt.jsx(PG,{}));export{hj as $,qf as A,Tf as B,gU as C,M5 as D,sB as E,ZE as F,RH as G,Wj as H,Hj as I,jj as J,Jj as K,Zj as L,Qj as M,Pw as N,$H as O,rH as P,hd as Q,As as R,QE as S,JE as T,TH as U,P5 as V,wj as W,bj as X,lj as Y,pH as Z,Xd as _,FE as a,vH as a$,Tj as a0,BH as a1,FH as a2,_H as a3,pU as a4,_u as a5,OG as a6,rU as a7,dj as a8,XU as a9,zH as aA,hH as aB,dH as aC,T5 as aD,uj as aE,NH as aF,SH as aG,I5 as aH,Xj as aI,zj as aJ,Gj as aK,$j as aL,Lj as aM,xz as aN,cF as aO,uF as aP,Yj as aQ,Ij as aR,Bj as aS,OH as aT,yj as aU,EH as aV,kH as aW,PH as aX,iH as aY,Kj as aZ,mH as a_,ej as aa,rj as ab,oj as ac,tj as ad,aj as ae,nj as af,ij as ag,sj as ah,ZU as ai,Wb as aj,JU as ak,QU as al,Dj as am,_j as an,Cj as ao,Mj as ap,gj as aq,Ow as ar,Rj as as,kj as at,Vj as au,Fj as av,mj as aw,D5 as ax,vj as ay,Aj as az,eW as b,eU as b$,yH as b0,qj as b1,$m as b2,p2 as b3,pe as b4,Lb as b5,bU as b6,UU as b7,GU as b8,tU as b9,$U as bA,qH as bB,KG as bC,aU as bD,oU as bE,Of as bF,va as bG,CU as bH,wU as bI,yU as bJ,LG as bK,MG as bL,LH as bM,MH as bN,fU as bO,iU as bP,ZG as bQ,qU as bR,cH as bS,If as bT,ei as bU,zl as bV,Ae as bW,EU as bX,ns as bY,DG as bZ,xU as b_,IU as ba,HU as bb,DH as bc,WG as bd,vU as be,Vl as bf,dU as bg,VG as bh,bz as bi,mU as bj,UG as bk,hU as bl,jG as bm,XG as bn,RG as bo,AG as bp,IG as bq,jU as br,Jx as bs,BG as bt,FG as bu,$G as bv,zU as bw,JG as bx,QG as by,qG as bz,dh as c,nU as c0,GG as c1,zG as c2,KH as c3,HG as c4,FU as c5,PU as c6,OU as c7,DU as c8,cU as c9,jH as cA,WH as cB,AH as cC,eH as cD,aH as cE,wH as cF,CH as cG,lH as cH,Wz as cI,sH as cJ,gH as cK,uH as cL,XH as cM,NE as cN,iW as cO,oW as cP,C8 as cQ,aW as cR,ai as cS,nW as cT,YH as cU,BE as cV,tG as cW,q8 as cX,Yd as cY,O3 as cZ,TG as c_,uU as ca,kU as cb,YU as cc,AU as cd,TU as ce,BU as cf,NG as cg,L5 as ch,Nj as ci,KU as cj,lU as ck,xj as cl,Ej as cm,Pj as cn,Oj as co,tH as cp,oH as cq,HH as cr,UH as cs,GH as ct,bH as cu,mB as cv,vB as cw,xH as cx,VH as cy,fH as cz,uW as d,XE as e,H0 as f,JH as g,ZH as h,tW as i,jt as j,I6 as k,jv as l,Ur as m,rG as n,VE as o,lW as p,zr as q,be as r,L6 as s,io as t,M6 as u,rW as v,QH as w,sW as x,bk as y,_t as z}; +`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,a=this.attrs.width,s=this.attrs.height,u=a!==as&&a!==void 0,c=s!==as&&s!==void 0,f=this.padding(),h=a-f*2,p=s-f*2,g=0,y=this.wrap(),v=y!==Fb,w=y!==T$&&v,x=this.ellipsis();this.textArr=[],Lm().font=this._getContextFont();for(var _=x?this._getTextWidth(Im):0,S=0,C=e.length;Sh)for(;O.length>0;){for(var L=0,D=O.length,U="",X=0;L>>1,te=O.slice(0,K+1),ce=this._getTextWidth(te)+_;ce<=h?(L=K+1,U=te,X=ce):D=K}if(U){if(w){var j,T=O[U.length],$=T===jf||T===Nb;$&&X<=h?j=U.length:j=Math.max(U.lastIndexOf(jf),U.lastIndexOf(Nb))+1,j>0&&(L=j,U=U.slice(0,L),X=this._getTextWidth(U))}U=U.trimRight(),this._addTextLine(U),r=Math.max(r,X),g+=i;var V=this._shouldHandleEllipsis(g);if(V){this._tryToAddEllipsisToLastLine();break}if(O=O.slice(L),O=O.trimLeft(),O.length>0&&(I=this._getTextWidth(O),I<=h)){this._addTextLine(O),g+=i,r=Math.max(r,I);break}}else break}else this._addTextLine(O),g+=i,r=Math.max(r,I),this._shouldHandleEllipsis(g)&&Sp)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(e){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,a=i!==as&&i!==void 0,s=this.padding(),u=i-s*2,c=this.wrap(),f=c!==Fb;return!f||a&&e+r>u}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,n=e!==as&&e!==void 0,r=this.padding(),i=e-r*2,a=this.ellipsis(),s=this.textArr[this.textArr.length-1];if(!(!s||!a)){if(n){var u=this._getTextWidth(s.text+Im)=1){var r=n[0].p0;e.moveTo(r.x,r.y)}for(var i=0;i0&&(u+=e.dataArray[c].pathLength);var f=0;i==="center"&&(f=Math.max(0,u/2-s/2)),i==="right"&&(f=Math.max(0,u-s));for(var h=uE(this.text()),p=this.text().split(" ").length-1,g,y,v,w=-1,x=0,_=function(){x=0;for(var ce=e.dataArray,j=w+1;j0)return w=j,ce[j];ce[j].command==="M"&&(g={x:ce[j].points[0],y:ce[j].points[1]})}return{}},S=function(ce){var j=e._getTextSize(ce).width+r;ce===" "&&i==="justify"&&(j+=(u-s)/p);var T=0,$=0;for(y=void 0;Math.abs(j-T)/j>.01&&$<20;){$++;for(var V=T;v===void 0;)v=_(),v&&V+v.pathLengthj?y=tt.getPointOnLine(j,g.x,g.y,v.points[0],v.points[1],g.x,g.y):v=void 0;break;case"A":var H=v.points[4],Y=v.points[5],Q=v.points[4]+Y;x===0?x=H+1e-8:j>T?x+=Math.PI/180*Y/Math.abs(Y):x-=Math.PI/360*Y/Math.abs(Y),(Y<0&&x=0&&x>Q)&&(x=Q,ie=!0),y=tt.getPointOnEllipticalArc(v.points[0],v.points[1],v.points[2],v.points[3],x,v.points[6]);break;case"C":x===0?j>v.pathLength?x=1e-8:x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength/2:x=Math.max(x-(T-j)/v.pathLength/2,0),x>1&&(x=1,ie=!0),y=tt.getPointOnCubicBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3],v.points[4],v.points[5]);break;case"Q":x===0?x=j/v.pathLength:j>T?x+=(j-T)/v.pathLength:x-=(T-j)/v.pathLength,x>1&&(x=1,ie=!0),y=tt.getPointOnQuadraticBezier(x,v.start.x,v.start.y,v.points[0],v.points[1],v.points[2],v.points[3]);break}y!==void 0&&(T=tt.getLineLength(g.x,g.y,y.x,y.y)),ie&&(ie=!1,v=void 0)}},C="C",O=e._getTextSize(C).width+r,I=f/O-1,L=0;Lt+`.${mE}`).join(" "),$b="nodesRect",B$=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],F$={"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 $$="ontouchstart"in pe._global;function z$(t,e){if(t==="rotater")return"crosshair";e+=G.degToRad(F$[t]||0);var n=(G.radToDeg(e)%360+360)%360;return G._inRange(n,315+22.5,360)||G._inRange(n,0,22.5)?"ns-resize":G._inRange(n,45-22.5,45+22.5)?"nesw-resize":G._inRange(n,90-22.5,90+22.5)?"ew-resize":G._inRange(n,135-22.5,135+22.5)?"nwse-resize":G._inRange(n,180-22.5,180+22.5)?"ns-resize":G._inRange(n,225-22.5,225+22.5)?"nesw-resize":G._inRange(n,270-22.5,270+22.5)?"ew-resize":G._inRange(n,315-22.5,315+22.5)?"nwse-resize":(G.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var sh=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],zb=1e8;function G$(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function vE(t,e,n){const r=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return Object.assign(Object.assign({},t),{rotation:t.rotation+e,x:r,y:i})}function U$(t,e){const n=G$(t);return vE(t,e,n)}function j$(t,e,n){let r=e;for(let i=0;i{const i=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=r._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");r.on(a,i),r.on(B$.map(s=>s+`.${this._getEventNamespace()}`).join(" "),i),r.on(`absoluteTransformChange.${this._getEventNamespace()}`,i),this._proxyDrag(r)}),this._resetTransformCache();var n=!!this.findOne(".top-left");return n&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,r=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(r,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=e.getAbsolutePosition(),a=i.x-n.x,s=i.y-n.y;this.nodes().forEach(u=>{if(u===e||u.isDragging())return;const c=u.getAbsolutePosition();u.setAbsolutePosition({x:c.x+a,y:c.y+s}),u.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache($b),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache($b,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),r){var i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),a=e.getAbsoluteScale(r),s=e.getAbsolutePosition(r),u=i.x*a.x-e.offsetX()*a.x,c=i.y*a.y-e.offsetY()*a.y;const f=(pe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),h={x:s.x+u*Math.cos(f)+c*Math.sin(-f),y:s.y+c*Math.cos(f)+u*Math.sin(f),width:i.width*a.x,height:i.height*a.y,rotation:f};return vE(h,-pe.getAngle(n),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-zb,y:-zb,width:0,height:0,rotation:0};const n=[];this.nodes().map(f=>{const h=f.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var p=[{x:h.x,y:h.y},{x:h.x+h.width,y:h.y},{x:h.x+h.width,y:h.y+h.height},{x:h.x,y:h.y+h.height}],g=f.getAbsoluteTransform();p.forEach(function(y){var v=g.point(y);n.push(v)})});const r=new Hn;r.rotate(-pe.getAngle(this.rotation()));var i,a,s,u;n.forEach(function(f){var h=r.point(f);i===void 0&&(i=s=h.x,a=u=h.y),i=Math.min(i,h.x),a=Math.min(a,h.y),s=Math.max(s,h.x),u=Math.max(u,h.y)}),r.invert();const c=r.point({x:i,y:a});return{x:c.x,y:c.y,width:s-i,height:u-a,rotation:pe.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(),sh.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var n=new ec({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:$$?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=pe.getAngle(this.rotation()),a=z$(e,i);n.getStage().content&&(n.getStage().content.style.cursor=a),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var e=new re({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()*G._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(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,a=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/a),this.cos=Math.abs(r/a),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=e.target.getAbsolutePosition(),u=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:u.x-s.x,y:u.y-s.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(c=>{c._fire("transformstart",{evt:e.evt,target:c})})}_handleMouseMove(e){var n,r,i,a=this.findOne("."+this._movingAnchorName),s=a.getStage();s.setPointersPositions(e);const u=s.getPointerPosition();let c={x:u.x-this._anchorDragOffset.x,y:u.y-this._anchorDragOffset.y};const f=a.getAbsolutePosition();this.anchorDragBoundFunc()&&(c=this.anchorDragBoundFunc()(f,c,e)),a.setAbsolutePosition(c);const h=a.getAbsolutePosition();if(!(f.x===h.x&&f.y===h.y)){if(this._movingAnchorName==="rotater"){var p=this._getNodeRect();n=a.x()-p.width/2,r=-a.y()+p.height/2;let ce=Math.atan2(-r,n)+Math.PI/2;p.height<0&&(ce-=Math.PI);var g=pe.getAngle(this.rotation());const j=g+ce,T=pe.getAngle(this.rotationSnapTolerance()),V=j$(this.rotationSnaps(),j,T)-p.rotation,ie=U$(p,V);this._fitNodesInto(ie,e);return}var y=this.keepRatio()||e.shiftKey,S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(y){var v=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(v.x-a.x(),2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-left").x()>v.x?-1:1,x=this.findOne(".top-left").y()>v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-left").x(v.x-n),this.findOne(".top-left").y(v.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(a.y());else if(this._movingAnchorName==="top-right"){if(y){var v=S?{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(a.x()-v.x,2)+Math.pow(v.y-a.y(),2));var w=this.findOne(".top-right").x()v.y?-1:1;n=i*this.cos*w,r=i*this.sin*x,this.findOne(".top-right").x(v.x+n),this.findOne(".top-right").y(v.y-r)}var _=a.position();this.findOne(".top-left").y(_.y),this.findOne(".bottom-right").x(_.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(a.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(a.x());else if(this._movingAnchorName==="bottom-left"){if(y){var v=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(v.x-a.x(),2)+Math.pow(a.y()-v.y,2));var w=v.x{r._fire("transformend",{evt:e,target:r})}),this._movingAnchorName=null}}_fitNodesInto(e,n){var r=this._getNodeRect();const i=1;if(G._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(G._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const a=this.flipEnabled();var s=new Hn;if(s.rotate(pe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const p=s.point({x:-this.padding()*2,y:0});if(e.x+=p.x,e.y+=p.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,!a){this.update();return}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const p=s.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.width+=this.padding()*2,!a){this.update();return}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const p=s.point({x:0,y:-this.padding()*2});if(e.x+=p.x,e.y+=p.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const p=s.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=p.x,this._anchorDragOffset.y-=p.y,e.height+=this.padding()*2,!a){this.update();return}}if(this.boundBoxFunc()){const p=this.boundBoxFunc()(r,e);p?e=p:G.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const u=1e7,c=new Hn;c.translate(r.x,r.y),c.rotate(r.rotation),c.scale(r.width/u,r.height/u);const f=new Hn;f.translate(e.x,e.y),f.rotate(e.rotation),f.scale(e.width/u,e.height/u);const h=f.multiply(c.invert());this._nodes.forEach(p=>{var g;const y=p.getParent().getAbsoluteTransform(),v=p.getTransform().copy();v.translate(p.offsetX(),p.offsetY());const w=new Hn;w.multiply(y.copy().invert()).multiply(h).multiply(y).multiply(v);const x=w.decompose();p.setAttrs(x),this._fire("transform",{evt:n,target:p}),p._fire("transform",{evt:n,target:p}),(g=p.getLayer())===null||g===void 0||g.batchDraw()}),this.rotation(G._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e,n=this._getNodeRect();this.rotation(G._getRotation(n.rotation));var r=n.width,i=n.height,a=this.enabledAnchors(),s=this.resizeEnabled(),u=this.padding(),c=this.anchorSize();this.find("._anchor").forEach(f=>{f.setAttrs({width:c,height:c,offsetX:c/2,offsetY:c/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:c/2+u,offsetY:c/2+u,visible:s&&a.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:c/2+u,visible:s&&a.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:c/2-u,offsetY:c/2+u,visible:s&&a.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:c/2+u,visible:s&&a.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:c/2-u,visible:s&&a.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:c/2+u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:c/2-u,visible:s&&a.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:c/2-u,offsetY:c/2-u,visible:s&&a.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*G._sign(i)-u,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}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),zs.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return se.prototype.toObject.call(this)}clone(e){var n=se.prototype.clone.call(this,e);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function H$(t){return t instanceof Array||G.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){sh.indexOf(e)===-1&&G.warn("Unknown anchor name: "+e+". Available names are: "+sh.join(", "))}),t||[]}Ke.prototype.className="Transformer";yt(Ke);A.addGetterSetter(Ke,"enabledAnchors",sh,H$);A.addGetterSetter(Ke,"flipEnabled",!0,jr());A.addGetterSetter(Ke,"resizeEnabled",!0);A.addGetterSetter(Ke,"anchorSize",10,le());A.addGetterSetter(Ke,"rotateEnabled",!0);A.addGetterSetter(Ke,"rotationSnaps",[]);A.addGetterSetter(Ke,"rotateAnchorOffset",50,le());A.addGetterSetter(Ke,"rotationSnapTolerance",5,le());A.addGetterSetter(Ke,"borderEnabled",!0);A.addGetterSetter(Ke,"anchorStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"anchorStrokeWidth",1,le());A.addGetterSetter(Ke,"anchorFill","white");A.addGetterSetter(Ke,"anchorCornerRadius",0,le());A.addGetterSetter(Ke,"borderStroke","rgb(0, 161, 255)");A.addGetterSetter(Ke,"borderStrokeWidth",1,le());A.addGetterSetter(Ke,"borderDash");A.addGetterSetter(Ke,"keepRatio",!0);A.addGetterSetter(Ke,"centeredScaling",!1);A.addGetterSetter(Ke,"ignoreStroke",!1);A.addGetterSetter(Ke,"padding",0,le());A.addGetterSetter(Ke,"node");A.addGetterSetter(Ke,"nodes");A.addGetterSetter(Ke,"boundBoxFunc");A.addGetterSetter(Ke,"anchorDragBoundFunc");A.addGetterSetter(Ke,"shouldOverdrawWholeArea",!1);A.addGetterSetter(Ke,"useSingleNodeRotation",!0);A.backCompat(Ke,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class qi extends re{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,pe.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}qi.prototype.className="Wedge";qi.prototype._centroid=!0;qi.prototype._attrsAffectingSize=["radius"];yt(qi);A.addGetterSetter(qi,"radius",0,le());A.addGetterSetter(qi,"angle",0,le());A.addGetterSetter(qi,"clockwise",!1);A.backCompat(qi,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function Gb(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var W$=[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],V$=[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 q$(t,e){var n=t.data,r=t.width,i=t.height,a,s,u,c,f,h,p,g,y,v,w,x,_,S,C,O,I,L,D,U,X,K,te,ce,j=e+e+1,T=r-1,$=i-1,V=e+1,ie=V*(V+1)/2,H=new Gb,Y=null,Q=H,oe=null,ve=null,we=W$[e],Ue=V$[e];for(u=1;u>Ue,te!==0?(te=255/te,n[h]=(g*we>>Ue)*te,n[h+1]=(y*we>>Ue)*te,n[h+2]=(v*we>>Ue)*te):n[h]=n[h+1]=n[h+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=p+((c=a+e+1)>Ue,te>0?(te=255/te,n[c]=(g*we>>Ue)*te,n[c+1]=(y*we>>Ue)*te,n[c+2]=(v*we>>Ue)*te):n[c]=n[c+1]=n[c+2]=0,g-=x,y-=_,v-=S,w-=C,x-=oe.r,_-=oe.g,S-=oe.b,C-=oe.a,c=a+((c=s+V)<$?c:$)*r<<2,g+=O+=oe.r=n[c],y+=I+=oe.g=n[c+1],v+=L+=oe.b=n[c+2],w+=D+=oe.a=n[c+3],oe=oe.next,x+=U=ve.r,_+=X=ve.g,S+=K=ve.b,C+=te=ve.a,O-=U,I-=X,L-=K,D-=te,ve=ve.next,h+=r}}const K$=function(e){var n=Math.round(this.blurRadius());n>0&&q$(e,n)};A.addGetterSetter(se,"blurRadius",0,le(),A.afterSetFilter);const Y$=function(t){var e=this.brightness()*255,n=t.data,r=n.length,i;for(i=0;i255?255:i,a=a<0?0:a>255?255:a,s=s<0?0:s>255?255:s,n[u]=i,n[u+1]=a,n[u+2]=s};A.addGetterSetter(se,"contrast",0,le(),A.afterSetFilter);const Q$=function(t){var e=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),a=0,s=0,u=t.data,c=t.width,f=t.height,h=c*4,p=f;switch(r){case"top-left":a=-1,s=-1;break;case"top":a=-1,s=0;break;case"top-right":a=-1,s=1;break;case"right":a=0,s=1;break;case"bottom-right":a=1,s=1;break;case"bottom":a=1,s=0;break;case"bottom-left":a=1,s=-1;break;case"left":a=0,s=-1;break;default:G.error("Unknown emboss direction: "+r)}do{var g=(p-1)*h,y=a;p+y<1&&(y=0),p+y>f&&(y=0);var v=(p-1+y)*c*4,w=c;do{var x=g+(w-1)*4,_=s;w+_<1&&(_=0),w+_>c&&(_=0);var S=v+(w-1+_)*4,C=u[x]-u[S],O=u[x+1]-u[S+1],I=u[x+2]-u[S+2],L=C,D=L>0?L:-L,U=O>0?O:-O,X=I>0?I:-I;if(U>D&&(L=O),X>D&&(L=I),L*=e,i){var K=u[x]+L,te=u[x+1]+L,ce=u[x+2]+L;u[x]=K>255?255:K<0?0:K,u[x+1]=te>255?255:te<0?0:te,u[x+2]=ce>255?255:ce<0?0:ce}else{var j=n-L;j<0?j=0:j>255&&(j=255),u[x]=u[x+1]=u[x+2]=j}}while(--w)}while(--p)};A.addGetterSetter(se,"embossStrength",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossWhiteLevel",.5,le(),A.afterSetFilter);A.addGetterSetter(se,"embossDirection","top-left",null,A.afterSetFilter);A.addGetterSetter(se,"embossBlend",!1,null,A.afterSetFilter);function Mm(t,e,n,r,i){var a=n-e,s=i-r,u;return a===0?r+s/2:s===0?r:(u=(t-e)/a,u=s*u+r,u)}const J$=function(t){var e=t.data,n=e.length,r=e[0],i=r,a,s=e[1],u=s,c,f=e[2],h=f,p,g,y=this.enhance();if(y!==0){for(g=0;gi&&(i=a),c=e[g+1],cu&&(u=c),p=e[g+2],ph&&(h=p);i===r&&(i=255,r=0),u===s&&(u=255,s=0),h===f&&(h=255,f=0);var v,w,x,_,S,C,O,I,L;for(y>0?(w=i+y*(255-i),x=r-y*(r-0),S=u+y*(255-u),C=s-y*(s-0),I=h+y*(255-h),L=f-y*(f-0)):(v=(i+r)*.5,w=i+y*(i-v),x=r+y*(r-v),_=(u+s)*.5,S=u+y*(u-_),C=s+y*(s-_),O=(h+f)*.5,I=h+y*(h-O),L=f+y*(f-O)),g=0;g_?x:_;var S=s,C=a,O,I,L=360/C*Math.PI/180,D,U;for(I=0;IC?S:C;var O=s,I=a,L,D,U=n.polarRotation||0,X,K;for(h=0;he&&(O=C,I=0,L=-1),i=0;i=0&&y=0&&v=0&&y=0&&v=255*4?255:0}return s}function fz(t,e,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),s=[],u=0;u=0&&y=0&&v=n))for(a=w;a=r||(s=(n*a+i)*4,u+=O[s+0],c+=O[s+1],f+=O[s+2],h+=O[s+3],C+=1);for(u=u/C,c=c/C,f=f/C,h=h/C,i=y;i=n))for(a=w;a=r||(s=(n*a+i)*4,O[s+0]=u,O[s+1]=c,O[s+2]=f,O[s+3]=h)}};A.addGetterSetter(se,"pixelSize",8,le(),A.afterSetFilter);const gz=function(t){var e=Math.round(this.levels()*254)+1,n=t.data,r=n.length,i=255/e,a;for(a=0;a255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,zk,A.afterSetFilter);const vz=function(t){var e=t.data,n=e.length,r=this.red(),i=this.green(),a=this.blue(),s=this.alpha(),u,c;for(u=0;u255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});A.addGetterSetter(se,"blue",0,zk,A.afterSetFilter);A.addGetterSetter(se,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const yz=function(t){var e=t.data,n=e.length,r,i,a,s;for(r=0;r127&&(f=255-f),h>127&&(h=255-h),p>127&&(p=255-p),e[c]=f,e[c+1]=h,e[c+2]=p}while(--u)}while(--a)},_z=function(t){var e=this.threshold()*255,n=t.data,r=n.length,i;for(i=0;i{const{width:n,height:r}=e,i=document.createElement("div"),a=new Vl.Stage({container:i,width:n,height:r}),s=new Vl.Layer,u=new Vl.Layer;s.add(new Vl.Rect({...e,fill:"white"})),t.forEach(f=>u.add(new Vl.Line({points:f.points,stroke:"black",strokeWidth:f.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:f.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(u);const c=a.toDataURL({...e});return i.remove(),c};let yE=null,SE=null;const LH=t=>{yE=t},bz=()=>yE,MH=t=>{SE=t},DH=()=>SE,Cz=t=>{const e=window.open("");e&&t.forEach(n=>{const r=new Image;r.src=n.base64,e.document.write(n.caption),e.document.write("
"),e.document.write(r.outerHTML),e.document.write("

")})},xz=(t,e)=>Math.floor(Math.random()*(e-t+1)+t),kz=t=>{const e=bz(),{generationMode:n,generationState:r,postprocessingState:i,canvasState:a,systemState:s}=t,{codeformerFidelity:u,facetoolStrength:c,facetoolType:f,hiresFix:h,hiresStrength:p,shouldRunESRGAN:g,shouldRunFacetool:y,upscalingLevel:v,upscalingStrength:w,upscalingDenoising:x}=i,{cfgScale:_,height:S,img2imgStrength:C,infillMethod:O,initialImage:I,iterations:L,perlin:D,prompt:U,negativePrompt:X,sampler:K,seamBlur:te,seamless:ce,seamSize:j,seamSteps:T,seamStrength:$,seed:V,seedWeights:ie,shouldFitToWidthHeight:H,shouldGenerateVariations:Y,shouldRandomizeSeed:Q,steps:oe,threshold:ve,tileSize:we,variationAmount:Ue,width:At,shouldUseSymmetry:me,horizontalSymmetrySteps:qt,verticalSymmetrySteps:Bt}=r,{shouldDisplayInProgressType:bn,saveIntermediatesInterval:wr,enableImageDebugging:Ft}=s,xe={prompt:U,iterations:L,steps:oe,cfg_scale:_,threshold:ve,perlin:D,height:S,width:At,sampler_name:K,seed:V,progress_images:bn==="full-res",progress_latents:bn==="latents",save_intermediates:wr,generation_mode:n,init_mask:""};let Hr=!1,Pt=!1;if(X!==""&&(xe.prompt=`${U} [${X}]`),xe.seed=Q?xz(uF,cF):V,me&&(qt>0&&(xe.h_symmetry_time_pct=Math.max(0,Math.min(1,qt/oe))),Bt>0&&(xe.v_symmetry_time_pct=Math.max(0,Math.min(1,Bt/oe)))),n==="txt2img"&&(xe.hires_fix=h,h&&(xe.strength=p)),["txt2img","img2img"].includes(n)&&(xe.seamless=ce,g&&(Hr={level:v,denoise_str:x,strength:w}),y&&(Pt={type:f,strength:c},f==="codeformer"&&(Pt.codeformer_fidelity=u))),n==="img2img"&&I&&(xe.init_img=typeof I=="string"?I:I.url,xe.strength=C,xe.fit=H),n==="unifiedCanvas"&&e){const{layerState:{objects:gi},boundingBoxCoordinates:Xs,boundingBoxDimensions:Mn,stageScale:Fa,isMaskEnabled:Qs,shouldPreserveMaskedArea:er,boundingBoxScaleMethod:Kt,scaledBoundingBoxDimensions:Dn}=a,bt={...Xs,...Mn},$a=wz(Qs?gi.filter(Jx):[],bt);xe.init_mask=$a,xe.fit=!1,xe.strength=C,xe.invert_mask=er,xe.bounding_box=bt;const Wr=e.scale();e.scale({x:1/Fa,y:1/Fa});const Co=e.getAbsolutePosition(),Vr=e.toDataURL({x:bt.x+Co.x,y:bt.y+Co.y,width:bt.width,height:bt.height});Ft&&Cz([{base64:$a,caption:"mask sent as init_mask"},{base64:Vr,caption:"image sent as init_img"}]),e.scale(Wr),xe.init_img=Vr,xe.progress_images=!1,Kt!=="none"&&(xe.inpaint_width=Dn.width,xe.inpaint_height=Dn.height),xe.seam_size=j,xe.seam_blur=te,xe.seam_strength=$,xe.seam_steps=T,xe.tile_size=we,xe.infill_method=O,xe.force_outpaint=!1}return Y?(xe.variation_amount=Ue,ie&&(xe.with_variations=R5(ie))):xe.variation_amount=0,Ft&&(xe.enable_image_debugging=Ft),{generationParameters:xe,esrganParameters:Hr,facetoolParameters:Pt}};var Ez=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Pz=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Oz=/[^-+\dA-Z]/g;function Ut(t,e,n,r){if(arguments.length===1&&typeof t=="string"&&!/\d/.test(t)&&(e=t,t=void 0),t=t||t===0?t:new Date,t instanceof Date||(t=new Date(t)),isNaN(t))throw TypeError("Invalid date");e=String(Ub[e]||e||Ub.default);var i=e.slice(0,4);(i==="UTC:"||i==="GMT:")&&(e=e.slice(4),n=!0,i==="GMT:"&&(r=!0));var a=function(){return n?"getUTC":"get"},s=function(){return t[a()+"Date"]()},u=function(){return t[a()+"Day"]()},c=function(){return t[a()+"Month"]()},f=function(){return t[a()+"FullYear"]()},h=function(){return t[a()+"Hours"]()},p=function(){return t[a()+"Minutes"]()},g=function(){return t[a()+"Seconds"]()},y=function(){return t[a()+"Milliseconds"]()},v=function(){return n?0:t.getTimezoneOffset()},w=function(){return Tz(t)},x=function(){return Rz(t)},_={d:function(){return s()},dd:function(){return Un(s())},ddd:function(){return Pn.dayNames[u()]},DDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:Pn.dayNames[u()],short:!0})},dddd:function(){return Pn.dayNames[u()+7]},DDDD:function(){return jb({y:f(),m:c(),d:s(),_:a(),dayName:Pn.dayNames[u()+7]})},m:function(){return c()+1},mm:function(){return Un(c()+1)},mmm:function(){return Pn.monthNames[c()]},mmmm:function(){return Pn.monthNames[c()+12]},yy:function(){return String(f()).slice(2)},yyyy:function(){return Un(f(),4)},h:function(){return h()%12||12},hh:function(){return Un(h()%12||12)},H:function(){return h()},HH:function(){return Un(h())},M:function(){return p()},MM:function(){return Un(p())},s:function(){return g()},ss:function(){return Un(g())},l:function(){return Un(y(),3)},L:function(){return Un(Math.floor(y()/10))},t:function(){return h()<12?Pn.timeNames[0]:Pn.timeNames[1]},tt:function(){return h()<12?Pn.timeNames[2]:Pn.timeNames[3]},T:function(){return h()<12?Pn.timeNames[4]:Pn.timeNames[5]},TT:function(){return h()<12?Pn.timeNames[6]:Pn.timeNames[7]},Z:function(){return r?"GMT":n?"UTC":Az(t)},o:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60)*100+Math.abs(v())%60,4)},p:function(){return(v()>0?"-":"+")+Un(Math.floor(Math.abs(v())/60),2)+":"+Un(Math.floor(Math.abs(v())%60),2)},S:function(){return["th","st","nd","rd"][s()%10>3?0:(s()%100-s()%10!=10)*s()%10]},W:function(){return w()},WW:function(){return Un(w())},N:function(){return x()}};return e.replace(Ez,function(S){return S in _?_[S]():S.slice(1,S.length-1)})}var Ub={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Pn={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},Un=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(e).padStart(n,"0")},jb=function(e){var n=e.y,r=e.m,i=e.d,a=e._,s=e.dayName,u=e.short,c=u===void 0?!1:u,f=new Date,h=new Date;h.setDate(h[a+"Date"]()-1);var p=new Date;p.setDate(p[a+"Date"]()+1);var g=function(){return f[a+"Date"]()},y=function(){return f[a+"Month"]()},v=function(){return f[a+"FullYear"]()},w=function(){return h[a+"Date"]()},x=function(){return h[a+"Month"]()},_=function(){return h[a+"FullYear"]()},S=function(){return p[a+"Date"]()},C=function(){return p[a+"Month"]()},O=function(){return p[a+"FullYear"]()};return v()===n&&y()===r&&g()===i?c?"Tdy":"Today":_()===n&&x()===r&&w()===i?c?"Ysd":"Yesterday":O()===n&&C()===r&&S()===i?c?"Tmw":"Tomorrow":s},Tz=function(e){var n=new Date(e.getFullYear(),e.getMonth(),e.getDate());n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=new Date(n.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);var i=n.getTimezoneOffset()-r.getTimezoneOffset();n.setHours(n.getHours()-i);var a=(n-r)/(864e5*7);return 1+Math.floor(a)},Rz=function(e){var n=e.getDay();return n===0&&(n=7),n},Az=function(e){return(String(e).match(Pz)||[""]).pop().replace(Oz,"").replace(/GMT\+0000/g,"UTC")};const Iz=(t,e)=>{const{dispatch:n,getState:r}=t;return{emitGenerateImage:i=>{n(ei(!0));const a=r(),{generation:s,postprocessing:u,system:c,canvas:f}=a,h={generationMode:i,generationState:s,postprocessingState:u,canvasState:f,systemState:c};n(gB());const{generationParameters:p,esrganParameters:g,facetoolParameters:y}=kz(h);e.emit("generateImage",p,g,y),p.init_mask&&(p.init_mask=p.init_mask.substr(0,64).concat("...")),p.init_img&&(p.init_img=p.init_img.substr(0,64).concat("...")),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generation requested: ${JSON.stringify({...p,...g,...y})}`}))},emitRunESRGAN:i=>{n(ei(!0));const{postprocessing:{upscalingLevel:a,upscalingDenoising:s,upscalingStrength:u}}=r(),c={upscale:[a,s,u]};e.emit("runPostprocessing",i,{type:"esrgan",...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`ESRGAN upscale requested: ${JSON.stringify({file:i.url,...c})}`}))},emitRunFacetool:i=>{n(ei(!0));const{postprocessing:{facetoolType:a,facetoolStrength:s,codeformerFidelity:u}}=r(),c={facetool_strength:s};a==="codeformer"&&(c.codeformer_fidelity=u),e.emit("runPostprocessing",i,{type:a,...c}),n(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Face restoration (${a}) requested: ${JSON.stringify({file:i.url,...c})}`}))},emitDeleteImage:i=>{const{url:a,uuid:s,category:u,thumbnail:c}=i;n(tk(i)),e.emit("deleteImage",a,c,s,u)},emitRequestImages:i=>{const a=r().gallery,{earliest_mtime:s}=a.categories[i];e.emit("requestImages",i,s)},emitRequestNewImages:i=>{const a=r().gallery,{latest_mtime:s}=a.categories[i];e.emit("requestLatestImages",i,s)},emitCancelProcessing:()=>{e.emit("cancel")},emitRequestSystemConfig:()=>{e.emit("requestSystemConfig")},emitSearchForModels:i=>{e.emit("searchForModels",i)},emitAddNewModel:i=>{e.emit("addNewModel",i)},emitDeleteModel:i=>{e.emit("deleteModel",i)},emitConvertToDiffusers:i=>{n(hB()),e.emit("convertToDiffusers",i)},emitMergeDiffusersModels:i=>{n(pB()),e.emit("mergeDiffusersModels",i)},emitRequestModelChange:i=>{n(dB()),e.emit("requestModelChange",i)},emitSaveStagingAreaImageToGallery:i=>{e.emit("requestSaveStagingAreaImageToGallery",i)},emitRequestEmptyTempFolder:()=>{e.emit("requestEmptyTempFolder")}}};let Vf;const Lz=new Uint8Array(16);function Mz(){if(!Vf&&(Vf=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Vf))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Vf(Lz)}const Jt=[];for(let t=0;t<256;++t)Jt.push((t+256).toString(16).slice(1));function Dz(t,e=0){return(Jt[t[e+0]]+Jt[t[e+1]]+Jt[t[e+2]]+Jt[t[e+3]]+"-"+Jt[t[e+4]]+Jt[t[e+5]]+"-"+Jt[t[e+6]]+Jt[t[e+7]]+"-"+Jt[t[e+8]]+Jt[t[e+9]]+"-"+Jt[t[e+10]]+Jt[t[e+11]]+Jt[t[e+12]]+Jt[t[e+13]]+Jt[t[e+14]]+Jt[t[e+15]]).toLowerCase()}const Nz=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hb={randomUUID:Nz};function qf(t,e,n){if(Hb.randomUUID&&!e&&!t)return Hb.randomUUID();t=t||{};const r=t.random||(t.rng||Mz)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let i=0;i<16;++i)e[n+i]=r[i];return e}return Dz(r)}const NH=dt("socketio/generateImage"),BH=dt("socketio/runESRGAN"),FH=dt("socketio/runFacetool"),$H=dt("socketio/deleteImage"),Wb=dt("socketio/requestImages"),Vb=dt("socketio/requestNewImages"),zH=dt("socketio/cancelProcessing"),Bz=dt("socketio/requestSystemConfig"),GH=dt("socketio/searchForModels"),UH=dt("socketio/addNewModel"),jH=dt("socketio/deleteModel"),HH=dt("socketio/convertToDiffusers"),WH=dt("socketio/mergeDiffusersModels"),VH=dt("socketio/requestModelChange"),qH=dt("socketio/saveStagingAreaImageToGallery"),KH=dt("socketio/requestEmptyTempFolder"),Fz=t=>{const{dispatch:e,getState:n}=t;return{onConnect:()=>{try{e(ub(!0)),e(ns(Ae.t("common.statusConnected"))),e(Bz());const r=n().gallery;r.categories.result.latest_mtime?e(Vb("result")):e(Wb("result")),r.categories.user.latest_mtime?e(Vb("user")):e(Wb("user"))}catch(r){console.error(r)}},onDisconnect:()=>{try{e(ub(!1)),e(ns(Ae.t("common.statusDisconnected"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Disconnected from server",level:"warning"}))}catch(r){console.error(r)}},onGenerationResult:r=>{try{const i=n(),{activeTab:a}=i.ui,{shouldLoopback:s}=i.postprocessing,{boundingBox:u,generationMode:c,...f}=r,h={uuid:qf(),...f};if(["txt2img","img2img"].includes(c)&&e(Tf({category:"result",image:{...h,category:"result"}})),c==="unifiedCanvas"&&r.boundingBox){const{boundingBox:p}=r;e(y5({image:{...h,category:"temp"},boundingBox:p})),i.canvas.shouldAutoSave&&e(Tf({image:{...h,category:"result"},category:"result"}))}if(s)switch(bk[a]){case"img2img":{e(M5(h));break}}e(Cm()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image generated: ${r.url}`}))}catch(i){console.error(i)}},onIntermediateResult:r=>{try{e(b5({uuid:qf(),...r,category:"result"})),r.isBase64||e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image generated: ${r.url}`}))}catch(i){console.error(i)}},onPostprocessingResult:r=>{try{e(Tf({category:"result",image:{uuid:qf(),...r,category:"result"}})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Postprocessed: ${r.url}`}))}catch(i){console.error(i)}},onProgressUpdate:r=>{try{e(ei(!0)),e(uB(r))}catch(i){console.error(i)}},onError:r=>{const{message:i,additionalData:a}=r;try{e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Server error: ${i}`,level:"error"})),e(cb()),e(Cm())}catch(s){console.error(s)}},onGalleryImages:r=>{const{images:i,areMoreImagesAvailable:a,category:s}=r,u=i.map(c=>({uuid:qf(),...c}));e(w5({images:u,areMoreImagesAvailable:a,category:s})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Loaded ${i.length} images`}))},onProcessingCanceled:()=>{e(fB());const{intermediateImage:r}=n().gallery;r&&(r.isBase64||(e(Tf({category:"result",image:r})),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Intermediate image saved: ${r.url}`}))),e(Cm())),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:"Processing canceled",level:"warning"}))},onImageDeleted:r=>{const{url:i}=r;e(tk(r));const{generation:{initialImage:a,maskPath:s}}=n();(a===i||(a==null?void 0:a.url)===i)&&e(I5()),s===i&&e(D5("")),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Image deleted: ${i}`}))},onSystemConfig:r=>{e(cB(r)),r.infill_methods.includes("patchmatch")||e(L5(r.infill_methods[0]))},onFoundModels:r=>{const{search_folder:i,found_models:a}=r;e(mB(i)),e(vB(a))},onNewModelAdded:r=>{const{new_model_name:i,model_list:a,update:s}=r;e(rs(a)),e(ei(!1)),e(ns(Ae.t("modelManager.modelAdded"))),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model Added: ${i}`,level:"info"})),e(zl({title:s?`${Ae.t("modelManager.modelUpdated")}: ${i}`:`${Ae.t("modelManager.modelAdded")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelDeleted:r=>{const{deleted_model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`${Ae.t("modelManager.modelAdded")}: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelEntryDeleted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelConverted:r=>{const{converted_model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelConverted"))),e(ei(!1)),e(If(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model converted: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelConverted")}: ${i}`,status:"success",duration:2500,isClosable:!0}))},onModelsMerged:r=>{const{merged_models:i,merged_model_name:a,model_list:s}=r;e(rs(s)),e(ns(Ae.t("common.statusMergedModels"))),e(ei(!1)),e(If(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Models merged: ${i}`,level:"info"})),e(zl({title:`${Ae.t("modelManager.modelsMerged")}: ${a}`,status:"success",duration:2500,isClosable:!0}))},onModelChanged:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ns(Ae.t("common.statusModelChanged"))),e(ei(!1)),e(If(!0)),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model changed: ${i}`,level:"info"}))},onModelChangeFailed:r=>{const{model_name:i,model_list:a}=r;e(rs(a)),e(ei(!1)),e(If(!0)),e(cb()),e(Gt({timestamp:Ut(new Date,"isoDateTime"),message:`Model change failed: ${i}`,level:"error"}))},onTempFolderEmptied:()=>{e(zl({title:Ae.t("toast.tempFoldersEmptied"),status:"success",duration:2500,isClosable:!0}))}}},$z=()=>{const{origin:t}=new URL(window.location.href),e=md(t,{timeout:6e4,path:`${window.location.pathname}socket.io`});let n=!1;return i=>a=>s=>{const{onConnect:u,onDisconnect:c,onError:f,onPostprocessingResult:h,onGenerationResult:p,onIntermediateResult:g,onProgressUpdate:y,onGalleryImages:v,onProcessingCanceled:w,onImageDeleted:x,onSystemConfig:_,onModelChanged:S,onFoundModels:C,onNewModelAdded:O,onModelDeleted:I,onModelConverted:L,onModelsMerged:D,onModelChangeFailed:U,onTempFolderEmptied:X}=Fz(i),{emitGenerateImage:K,emitRunESRGAN:te,emitRunFacetool:ce,emitDeleteImage:j,emitRequestImages:T,emitRequestNewImages:$,emitCancelProcessing:V,emitRequestSystemConfig:ie,emitSearchForModels:H,emitAddNewModel:Y,emitDeleteModel:Q,emitConvertToDiffusers:oe,emitMergeDiffusersModels:ve,emitRequestModelChange:we,emitSaveStagingAreaImageToGallery:Ue,emitRequestEmptyTempFolder:At}=Iz(i,e);switch(n||(e.on("connect",()=>u()),e.on("disconnect",()=>c()),e.on("error",me=>f(me)),e.on("generationResult",me=>p(me)),e.on("postprocessingResult",me=>h(me)),e.on("intermediateResult",me=>g(me)),e.on("progressUpdate",me=>y(me)),e.on("galleryImages",me=>v(me)),e.on("processingCanceled",()=>{w()}),e.on("imageDeleted",me=>{x(me)}),e.on("systemConfig",me=>{_(me)}),e.on("foundModels",me=>{C(me)}),e.on("newModelAdded",me=>{O(me)}),e.on("modelDeleted",me=>{I(me)}),e.on("modelConverted",me=>{L(me)}),e.on("modelsMerged",me=>{D(me)}),e.on("modelChanged",me=>{S(me)}),e.on("modelChangeFailed",me=>{U(me)}),e.on("tempFolderEmptied",()=>{X()}),n=!0),s.type){case"socketio/generateImage":{K(s.payload);break}case"socketio/runESRGAN":{te(s.payload);break}case"socketio/runFacetool":{ce(s.payload);break}case"socketio/deleteImage":{j(s.payload);break}case"socketio/requestImages":{T(s.payload);break}case"socketio/requestNewImages":{$(s.payload);break}case"socketio/cancelProcessing":{V();break}case"socketio/requestSystemConfig":{ie();break}case"socketio/searchForModels":{H(s.payload);break}case"socketio/addNewModel":{Y(s.payload);break}case"socketio/deleteModel":{Q(s.payload);break}case"socketio/convertToDiffusers":{oe(s.payload);break}case"socketio/mergeDiffusersModels":{ve(s.payload);break}case"socketio/requestModelChange":{we(s.payload);break}case"socketio/saveStagingAreaImageToGallery":{Ue(s.payload);break}case"socketio/requestEmptyTempFolder":{At();break}}a(s)}},zz=["cursorPosition","isCanvasInitialized","doesCanvasNeedScaling"].map(t=>`canvas.${t}`),Gz=["currentIteration","currentStatus","currentStep","isCancelable","isConnected","isESRGANAvailable","isGFPGANAvailable","isProcessing","socketId","totalIterations","totalSteps","openModel","cancelOptions.cancelAfter"].map(t=>`system.${t}`),Uz=["categories","currentCategory","currentImage","currentImageUuid","shouldAutoSwitchToNewImages","shouldHoldGalleryOpen","intermediateImage"].map(t=>`gallery.${t}`),_E=$x({generation:N5,postprocessing:F5,gallery:C5,system:yB,canvas:S5,ui:wB,lightbox:E5}),jz=Xx.getPersistConfig({key:"root",storage:Yx,rootReducer:_E,blacklist:[...zz,...Gz,...Uz],debounce:300}),Hz=JN(jz,_E),wE=ON({reducer:Hz,middleware:t=>t({immutableCheck:!1,serializableCheck:!1}).concat($z()),devTools:{actionsDenylist:["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine"]}}),Wz=i5(wE);function Vz(t){if(t.sheet)return t.sheet;for(var e=0;e0?en(Ys,--Ln):0,Gs--,Ot===10&&(Gs=1,rp--),Ot}function Kn(){return Ot=Ln2||Wu(Ot)>3?"":" "}function i6(t,e){for(;--e&&Kn()&&!(Ot<48||Ot>102||Ot>57&&Ot<65||Ot>70&&Ot<97););return tc(t,_d()+(e<6&&ci()==32&&Kn()==32))}function cy(t){for(;Kn();)switch(Ot){case t:return Ln;case 34:case 39:t!==34&&t!==39&&cy(Ot);break;case 40:t===41&&cy(t);break;case 92:Kn();break}return Ln}function a6(t,e){for(;Kn()&&t+Ot!==47+10;)if(t+Ot===42+42&&ci()===47)break;return"/*"+tc(e,Ln-1)+"*"+np(t===47?t:Kn())}function o6(t){for(;!Wu(ci());)Kn();return tc(t,Ln)}function s6(t){return PE(bd("",null,null,null,[""],t=EE(t),0,[0],t))}function bd(t,e,n,r,i,a,s,u,c){for(var f=0,h=0,p=s,g=0,y=0,v=0,w=1,x=1,_=1,S=0,C="",O=i,I=a,L=r,D=C;x;)switch(v=S,S=Kn()){case 40:if(v!=108&&en(D,p-1)==58){uy(D+=qe(wd(S),"&","&\f"),"&\f")!=-1&&(_=-1);break}case 34:case 39:case 91:D+=wd(S);break;case 9:case 10:case 13:case 32:D+=r6(v);break;case 92:D+=i6(_d()-1,7);continue;case 47:switch(ci()){case 42:case 47:Kf(l6(a6(Kn(),_d()),e,n),c);break;default:D+="/"}break;case 123*w:u[f++]=ti(D)*_;case 125*w:case 59:case 0:switch(S){case 0:case 125:x=0;case 59+h:y>0&&ti(D)-p&&Kf(y>32?Kb(D+";",r,n,p-1):Kb(qe(D," ","")+";",r,n,p-2),c);break;case 59:D+=";";default:if(Kf(L=qb(D,e,n,f,h,i,u,C,O=[],I=[],p),a),S===123)if(h===0)bd(D,e,L,L,O,a,p,u,I);else switch(g===99&&en(D,3)===110?100:g){case 100:case 109:case 115:bd(t,L,L,r&&Kf(qb(t,L,L,0,0,i,u,C,i,O=[],p),I),i,I,p,u,r?O:I);break;default:bd(D,L,L,L,[""],I,0,u,I)}}f=h=y=0,w=_=1,C=D="",p=s;break;case 58:p=1+ti(D),y=v;default:if(w<1){if(S==123)--w;else if(S==125&&w++==0&&n6()==125)continue}switch(D+=np(S),S*w){case 38:_=h>0?1:(D+="\f",-1);break;case 44:u[f++]=(ti(D)-1)*_,_=1;break;case 64:ci()===45&&(D+=wd(Kn())),g=ci(),h=p=ti(C=D+=o6(_d())),S++;break;case 45:v===45&&ti(D)==2&&(w=0)}}return a}function qb(t,e,n,r,i,a,s,u,c,f,h){for(var p=i-1,g=i===0?a:[""],y=$0(g),v=0,w=0,x=0;v0?g[_]+" "+S:qe(S,/&\f/g,g[_])))&&(c[x++]=C);return ip(t,e,n,i===0?B0:u,c,f,h)}function l6(t,e,n){return ip(t,e,n,bE,np(t6()),Hu(t,2,-2),0)}function Kb(t,e,n,r){return ip(t,e,n,F0,Hu(t,0,r),Hu(t,r+1,-1),r)}function Rs(t,e){for(var n="",r=$0(t),i=0;i6)switch(en(t,e+1)){case 109:if(en(t,e+4)!==45)break;case 102:return qe(t,/(.+:)(.+)-([^]+)/,"$1"+We+"$2-$3$1"+lh+(en(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~uy(t,"stretch")?TE(qe(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(en(t,e+1)!==115)break;case 6444:switch(en(t,ti(t)-3-(~uy(t,"!important")&&10))){case 107:return qe(t,":",":"+We)+t;case 101:return qe(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+We+(en(t,14)===45?"inline-":"")+"box$3$1"+We+"$2$3$1"+ln+"$2box$3")+t}break;case 5936:switch(en(t,e+11)){case 114:return We+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return We+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return We+t+ln+qe(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return We+t+ln+t+t}return t}var v6=function(e,n,r,i){if(e.length>-1&&!e.return)switch(e.type){case F0:e.return=TE(e.value,e.length);break;case CE:return Rs([ql(e,{value:qe(e.value,"@","@"+We)})],i);case B0:if(e.length)return e6(e.props,function(a){switch(Zz(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Rs([ql(e,{props:[qe(a,/:(read-\w+)/,":"+lh+"$1")]})],i);case"::placeholder":return Rs([ql(e,{props:[qe(a,/:(plac\w+)/,":"+We+"input-$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,":"+lh+"$1")]}),ql(e,{props:[qe(a,/:(plac\w+)/,ln+"input-$1")]})],i)}return""})}},y6=[v6],S6=function(e){var n=e.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(w){var x=w.getAttribute("data-emotion");x.indexOf(" ")!==-1&&(document.head.appendChild(w),w.setAttribute("data-s",""))})}var i=e.stylisPlugins||y6,a={},s,u=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(w){for(var x=w.getAttribute("data-emotion").split(" "),_=1;_=4;++r,i-=4)n=t.charCodeAt(r)&255|(t.charCodeAt(++r)&255)<<8|(t.charCodeAt(++r)&255)<<16|(t.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,e=(n&65535)*1540483477+((n>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(i){case 3:e^=(t.charCodeAt(r+2)&255)<<16;case 2:e^=(t.charCodeAt(r+1)&255)<<8;case 1:e^=t.charCodeAt(r)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}var C6={animationIterationCount: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},x6=/[A-Z]|^ms/g,k6=/_EMO_([^_]+?)_([^]*?)_EMO_/g,IE=function(e){return e.charCodeAt(1)===45},Qb=function(e){return e!=null&&typeof e!="boolean"},Dm=OE(function(t){return IE(t)?t:t.replace(x6,"-$&").toLowerCase()}),Jb=function(e,n){switch(e){case"animation":case"animationName":if(typeof n=="string")return n.replace(k6,function(r,i,a){return ni={name:i,styles:a,next:ni},i})}return C6[e]!==1&&!IE(e)&&typeof n=="number"&&n!==0?n+"px":n};function Vu(t,e,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 ni={name:n.name,styles:n.styles,next:ni},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)ni={name:r.name,styles:r.styles,next:ni},r=r.next;var i=n.styles+";";return i}return E6(t,e,n)}case"function":{if(t!==void 0){var a=ni,s=n(t);return ni=a,Vu(t,e,s)}break}}if(e==null)return n;var u=e[n];return u!==void 0?u:n}function E6(t,e,n){var r="";if(Array.isArray(n))for(var i=0;i` or ``");return t}var NE=be.createContext({});NE.displayName="ColorModeContext";function BE(){const t=be.useContext(NE);if(t===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return t}function M6(){const t=BE(),e=L6();return{...t,theme:e}}var FE=(...t)=>t.filter(Boolean).join(" ");function D6(){return!1}function zr(t){const e=typeof t;return t!=null&&(e==="object"||e==="function")&&!Array.isArray(t)}var QH=t=>{const{condition:e,message:n}=t;e&&D6()&&console.warn(n)};function io(t,...e){return N6(t)?t(...e):t}var N6=t=>typeof t=="function",JH=t=>t?"":void 0,ZH=t=>t?!0:void 0;function eW(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function tW(...t){return function(n){t.forEach(r=>{r==null||r(n)})}}var uh={},B6={get exports(){return uh},set exports(t){uh=t}};(function(t,e){var n=200,r="__lodash_hash_undefined__",i=800,a=16,s=9007199254740991,u="[object Arguments]",c="[object Array]",f="[object AsyncFunction]",h="[object Boolean]",p="[object Date]",g="[object Error]",y="[object Function]",v="[object GeneratorFunction]",w="[object Map]",x="[object Number]",_="[object Null]",S="[object Object]",C="[object Proxy]",O="[object RegExp]",I="[object Set]",L="[object String]",D="[object Undefined]",U="[object WeakMap]",X="[object ArrayBuffer]",K="[object DataView]",te="[object Float32Array]",ce="[object Float64Array]",j="[object Int8Array]",T="[object Int16Array]",$="[object Int32Array]",V="[object Uint8Array]",ie="[object Uint8ClampedArray]",H="[object Uint16Array]",Y="[object Uint32Array]",Q=/[\\^$.*+?()[\]{}|]/g,oe=/^\[object .+?Constructor\]$/,ve=/^(?:0|[1-9]\d*)$/,we={};we[te]=we[ce]=we[j]=we[T]=we[$]=we[V]=we[ie]=we[H]=we[Y]=!0,we[u]=we[c]=we[X]=we[h]=we[K]=we[p]=we[g]=we[y]=we[w]=we[x]=we[S]=we[O]=we[I]=we[L]=we[U]=!1;var Ue=typeof yn=="object"&&yn&&yn.Object===Object&&yn,At=typeof self=="object"&&self&&self.Object===Object&&self,me=Ue||At||Function("return this")(),qt=e&&!e.nodeType&&e,Bt=qt&&!0&&t&&!t.nodeType&&t,bn=Bt&&Bt.exports===qt,wr=bn&&Ue.process,Ft=function(){try{var P=Bt&&Bt.require&&Bt.require("util").types;return P||wr&&wr.binding&&wr.binding("util")}catch{}}(),xe=Ft&&Ft.isTypedArray;function Hr(P,N,W){switch(W.length){case 0:return P.call(N);case 1:return P.call(N,W[0]);case 2:return P.call(N,W[0],W[1]);case 3:return P.call(N,W[0],W[1],W[2])}return P.apply(N,W)}function Pt(P,N){for(var W=-1,fe=Array(P);++W-1}function mp(P,N){var W=this.__data__,fe=yi(W,P);return fe<0?(++this.size,W.push([P,N])):W[fe][1]=N,this}xr.prototype.clear=tl,xr.prototype.delete=pp,xr.prototype.get=nl,xr.prototype.has=gp,xr.prototype.set=mp;function Xi(P){var N=-1,W=P==null?0:P.length;for(this.clear();++N1?W[Ie-1]:void 0,Ee=Ie>2?W[2]:void 0;for(Ye=P.length>3&&typeof Ye=="function"?(Ie--,Ye):void 0,Ee&&pc(W[0],W[1],Ee)&&(Ye=Ie<3?void 0:Ye,Ie=1),N=Object(N);++fe-1&&P%1==0&&P0){if(++N>=i)return arguments[0]}else N=0;return P.apply(void 0,arguments)}}function Sc(P){if(P!=null){try{return Dn.call(P)}catch{}try{return P+""}catch{}}return""}function Mo(P,N){return P===N||P!==P&&N!==N}var ul=il(function(){return arguments}())?il:function(P){return za(P)&&bt.call(P,"callee")&&!Js.call(P,"callee")},cl=Array.isArray;function Do(P){return P!=null&&wc(P.length)&&!fl(P)}function Dp(P){return za(P)&&Do(P)}var _c=sp||Fp;function fl(P){if(!kr(P))return!1;var N=To(P);return N==y||N==v||N==f||N==C}function wc(P){return typeof P=="number"&&P>-1&&P%1==0&&P<=s}function kr(P){var N=typeof P;return P!=null&&(N=="object"||N=="function")}function za(P){return P!=null&&typeof P=="object"}function Np(P){if(!za(P)||To(P)!=S)return!1;var N=Po(P);if(N===null)return!0;var W=bt.call(N,"constructor")&&N.constructor;return typeof W=="function"&&W instanceof W&&Dn.call(W)==Co}var bc=xe?gi(xe):ac;function Bp(P){return cc(P,Cc(P))}function Cc(P){return Do(P)?Pp(P,!0):Rp(P)}var nt=Ro(function(P,N,W,fe){oc(P,N,W,fe)});function et(P){return function(){return P}}function xc(P){return P}function Fp(){return!1}t.exports=nt})(B6,uh);const ai=uh;var F6=t=>/!(important)?$/.test(t),t2=t=>typeof t=="string"?t.replace(/!(important)?$/,"").trim():t,$6=(t,e)=>n=>{const r=String(e),i=F6(r),a=t2(r),s=t?`${t}.${a}`:a;let u=zr(n.__cssMap)&&s in n.__cssMap?n.__cssMap[s].varRef:e;return u=t2(u),i?`${u} !important`:u};function G0(t){const{scale:e,transform:n,compose:r}=t;return(a,s)=>{var u;const c=$6(e,a)(s);let f=(u=n==null?void 0:n(c,s))!=null?u:c;return r&&(f=r(f,s)),f}}var Yf=(...t)=>e=>t.reduce((n,r)=>r(n),e);function Ir(t,e){return n=>{const r={property:n,scale:t};return r.transform=G0({scale:t,transform:e}),r}}var z6=({rtl:t,ltr:e})=>n=>n.direction==="rtl"?t:e;function G6(t){const{property:e,scale:n,transform:r}=t;return{scale:n,property:z6(e),transform:n?G0({scale:n,compose:r}):r}}var $E=["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 U6(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...$E].join(" ")}function j6(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...$E].join(" ")}var H6={"--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(" ")},W6={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 V6(t){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":t,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var q6={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},fy={"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"},K6=new Set(Object.values(fy)),zE=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Y6=t=>t.trim();function X6(t,e){if(t==null||zE.has(t))return t;const r=/(^[a-z-A-Z]+)\((.*)\)/g.exec(t),i=r==null?void 0:r[1],a=r==null?void 0:r[2];if(!i||!a)return t;const s=i.includes("-gradient")?i:`${i}-gradient`,[u,...c]=a.split(",").map(Y6).filter(Boolean);if((c==null?void 0:c.length)===0)return t;const f=u in fy?fy[u]:u;c.unshift(f);const h=c.map(p=>{if(K6.has(p))return p;const g=p.indexOf(" "),[y,v]=g!==-1?[p.substr(0,g),p.substr(g+1)]:[p],w=GE(v)?v:v&&v.split(" "),x=`colors.${y}`,_=x in e.__cssMap?e.__cssMap[x].varRef:y;return w?[_,...Array.isArray(w)?w:[w]].join(" "):_});return`${s}(${h.join(", ")})`}var GE=t=>typeof t=="string"&&t.includes("(")&&t.includes(")"),Q6=(t,e)=>X6(t,e??{});function J6(t){return/^var\(--.+\)$/.test(t)}var Z6=t=>{const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}},Jr=t=>e=>`${t}(${e})`,Fe={filter(t){return t!=="auto"?t:H6},backdropFilter(t){return t!=="auto"?t:W6},ring(t){return V6(Fe.px(t))},bgClip(t){return t==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:t}},transform(t){return t==="auto"?U6():t==="auto-gpu"?j6():t},vh(t){return t==="$100vh"?"var(--chakra-vh)":t},px(t){if(t==null)return t;const{unitless:e}=Z6(t);return e||typeof t=="number"?`${t}px`:t},fraction(t){return typeof t!="number"||t>1?t:`${t*100}%`},float(t,e){const n={left:"right",right:"left"};return e.direction==="rtl"?n[t]:t},degree(t){if(J6(t)||t==null)return t;const e=typeof t=="string"&&!t.endsWith("deg");return typeof t=="number"||e?`${t}deg`:t},gradient:Q6,blur:Jr("blur"),opacity:Jr("opacity"),brightness:Jr("brightness"),contrast:Jr("contrast"),dropShadow:Jr("drop-shadow"),grayscale:Jr("grayscale"),hueRotate:Jr("hue-rotate"),invert:Jr("invert"),saturate:Jr("saturate"),sepia:Jr("sepia"),bgImage(t){return t==null||GE(t)||zE.has(t)?t:`url(${t})`},outline(t){const e=String(t)==="0"||String(t)==="none";return t!==null&&e?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:t}},flexDirection(t){var e;const{space:n,divide:r}=(e=q6[t])!=null?e:{},i={flexDirection:t};return n&&(i[n]=1),r&&(i[r]=1),i}},B={borderWidths:Ir("borderWidths"),borderStyles:Ir("borderStyles"),colors:Ir("colors"),borders:Ir("borders"),radii:Ir("radii",Fe.px),space:Ir("space",Yf(Fe.vh,Fe.px)),spaceT:Ir("space",Yf(Fe.vh,Fe.px)),degreeT(t){return{property:t,transform:Fe.degree}},prop(t,e,n){return{property:t,scale:e,...e&&{transform:G0({scale:e,transform:n})}}},propT(t,e){return{property:t,transform:e}},sizes:Ir("sizes",Yf(Fe.vh,Fe.px)),sizesT:Ir("sizes",Yf(Fe.vh,Fe.fraction)),shadows:Ir("shadows"),logical:G6,blur:Ir("blur",Fe.blur)},Cd={background:B.colors("background"),backgroundColor:B.colors("backgroundColor"),backgroundImage:B.propT("backgroundImage",Fe.bgImage),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:Fe.bgClip},bgSize:B.prop("backgroundSize"),bgPosition:B.prop("backgroundPosition"),bg:B.colors("background"),bgColor:B.colors("backgroundColor"),bgPos:B.prop("backgroundPosition"),bgRepeat:B.prop("backgroundRepeat"),bgAttachment:B.prop("backgroundAttachment"),bgGradient:B.propT("backgroundImage",Fe.gradient),bgClip:{transform:Fe.bgClip}};Object.assign(Cd,{bgImage:Cd.backgroundImage,bgImg:Cd.backgroundImage});var He={border:B.borders("border"),borderWidth:B.borderWidths("borderWidth"),borderStyle:B.borderStyles("borderStyle"),borderColor:B.colors("borderColor"),borderRadius:B.radii("borderRadius"),borderTop:B.borders("borderTop"),borderBlockStart:B.borders("borderBlockStart"),borderTopLeftRadius:B.radii("borderTopLeftRadius"),borderStartStartRadius:B.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:B.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:B.radii("borderTopRightRadius"),borderStartEndRadius:B.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:B.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:B.borders("borderRight"),borderInlineEnd:B.borders("borderInlineEnd"),borderBottom:B.borders("borderBottom"),borderBlockEnd:B.borders("borderBlockEnd"),borderBottomLeftRadius:B.radii("borderBottomLeftRadius"),borderBottomRightRadius:B.radii("borderBottomRightRadius"),borderLeft:B.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:B.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:B.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:B.borders(["borderLeft","borderRight"]),borderInline:B.borders("borderInline"),borderY:B.borders(["borderTop","borderBottom"]),borderBlock:B.borders("borderBlock"),borderTopWidth:B.borderWidths("borderTopWidth"),borderBlockStartWidth:B.borderWidths("borderBlockStartWidth"),borderTopColor:B.colors("borderTopColor"),borderBlockStartColor:B.colors("borderBlockStartColor"),borderTopStyle:B.borderStyles("borderTopStyle"),borderBlockStartStyle:B.borderStyles("borderBlockStartStyle"),borderBottomWidth:B.borderWidths("borderBottomWidth"),borderBlockEndWidth:B.borderWidths("borderBlockEndWidth"),borderBottomColor:B.colors("borderBottomColor"),borderBlockEndColor:B.colors("borderBlockEndColor"),borderBottomStyle:B.borderStyles("borderBottomStyle"),borderBlockEndStyle:B.borderStyles("borderBlockEndStyle"),borderLeftWidth:B.borderWidths("borderLeftWidth"),borderInlineStartWidth:B.borderWidths("borderInlineStartWidth"),borderLeftColor:B.colors("borderLeftColor"),borderInlineStartColor:B.colors("borderInlineStartColor"),borderLeftStyle:B.borderStyles("borderLeftStyle"),borderInlineStartStyle:B.borderStyles("borderInlineStartStyle"),borderRightWidth:B.borderWidths("borderRightWidth"),borderInlineEndWidth:B.borderWidths("borderInlineEndWidth"),borderRightColor:B.colors("borderRightColor"),borderInlineEndColor:B.colors("borderInlineEndColor"),borderRightStyle:B.borderStyles("borderRightStyle"),borderInlineEndStyle:B.borderStyles("borderInlineEndStyle"),borderTopRadius:B.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:B.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:B.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:B.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(He,{rounded:He.borderRadius,roundedTop:He.borderTopRadius,roundedTopLeft:He.borderTopLeftRadius,roundedTopRight:He.borderTopRightRadius,roundedTopStart:He.borderStartStartRadius,roundedTopEnd:He.borderStartEndRadius,roundedBottom:He.borderBottomRadius,roundedBottomLeft:He.borderBottomLeftRadius,roundedBottomRight:He.borderBottomRightRadius,roundedBottomStart:He.borderEndStartRadius,roundedBottomEnd:He.borderEndEndRadius,roundedLeft:He.borderLeftRadius,roundedRight:He.borderRightRadius,roundedStart:He.borderInlineStartRadius,roundedEnd:He.borderInlineEndRadius,borderStart:He.borderInlineStart,borderEnd:He.borderInlineEnd,borderTopStartRadius:He.borderStartStartRadius,borderTopEndRadius:He.borderStartEndRadius,borderBottomStartRadius:He.borderEndStartRadius,borderBottomEndRadius:He.borderEndEndRadius,borderStartRadius:He.borderInlineStartRadius,borderEndRadius:He.borderInlineEndRadius,borderStartWidth:He.borderInlineStartWidth,borderEndWidth:He.borderInlineEndWidth,borderStartColor:He.borderInlineStartColor,borderEndColor:He.borderInlineEndColor,borderStartStyle:He.borderInlineStartStyle,borderEndStyle:He.borderInlineEndStyle});var e8={color:B.colors("color"),textColor:B.colors("color"),fill:B.colors("fill"),stroke:B.colors("stroke")},dy={boxShadow:B.shadows("boxShadow"),mixBlendMode:!0,blendMode:B.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:B.prop("backgroundBlendMode"),opacity:!0};Object.assign(dy,{shadow:dy.boxShadow});var t8={filter:{transform:Fe.filter},blur:B.blur("--chakra-blur"),brightness:B.propT("--chakra-brightness",Fe.brightness),contrast:B.propT("--chakra-contrast",Fe.contrast),hueRotate:B.degreeT("--chakra-hue-rotate"),invert:B.propT("--chakra-invert",Fe.invert),saturate:B.propT("--chakra-saturate",Fe.saturate),dropShadow:B.propT("--chakra-drop-shadow",Fe.dropShadow),backdropFilter:{transform:Fe.backdropFilter},backdropBlur:B.blur("--chakra-backdrop-blur"),backdropBrightness:B.propT("--chakra-backdrop-brightness",Fe.brightness),backdropContrast:B.propT("--chakra-backdrop-contrast",Fe.contrast),backdropHueRotate:B.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:B.propT("--chakra-backdrop-invert",Fe.invert),backdropSaturate:B.propT("--chakra-backdrop-saturate",Fe.saturate)},ch={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:Fe.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:B.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:B.space("gap"),rowGap:B.space("rowGap"),columnGap:B.space("columnGap")};Object.assign(ch,{flexDir:ch.flexDirection});var UE={gridGap:B.space("gridGap"),gridColumnGap:B.space("gridColumnGap"),gridRowGap:B.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},n8={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:Fe.outline},outlineOffset:!0,outlineColor:B.colors("outlineColor")},lr={width:B.sizesT("width"),inlineSize:B.sizesT("inlineSize"),height:B.sizes("height"),blockSize:B.sizes("blockSize"),boxSize:B.sizes(["width","height"]),minWidth:B.sizes("minWidth"),minInlineSize:B.sizes("minInlineSize"),minHeight:B.sizes("minHeight"),minBlockSize:B.sizes("minBlockSize"),maxWidth:B.sizes("maxWidth"),maxInlineSize:B.sizes("maxInlineSize"),maxHeight:B.sizes("maxHeight"),maxBlockSize:B.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,hideFrom:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.minWQuery)!=null?i:`@media screen and (min-width: ${t})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(t,e)=>{var n,r,i;return{[(i=(r=(n=e.__breakpoints)==null?void 0:n.get(t))==null?void 0:r.maxWQuery)!=null?i:`@media screen and (max-width: ${t})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:B.propT("float",Fe.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(lr,{w:lr.width,h:lr.height,minW:lr.minWidth,maxW:lr.maxWidth,minH:lr.minHeight,maxH:lr.maxHeight,overscroll:lr.overscrollBehavior,overscrollX:lr.overscrollBehaviorX,overscrollY:lr.overscrollBehaviorY});var r8={listStyleType:!0,listStylePosition:!0,listStylePos:B.prop("listStylePosition"),listStyleImage:!0,listStyleImg:B.prop("listStyleImage")};function i8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},o8=a8(i8),s8={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},l8={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},Nm=(t,e,n)=>{const r={},i=o8(t,e,{});for(const a in i)a in n&&n[a]!=null||(r[a]=i[a]);return r},u8={srOnly:{transform(t){return t===!0?s8:t==="focusable"?l8:{}}},layerStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`layerStyles.${t}`,n)},textStyle:{processResult:!0,transform:(t,e,n)=>Nm(e,`textStyles.${t}`,n)},apply:{processResult:!0,transform:(t,e,n)=>Nm(e,t,n)}},Su={position:!0,pos:B.prop("position"),zIndex:B.prop("zIndex","zIndices"),inset:B.spaceT("inset"),insetX:B.spaceT(["left","right"]),insetInline:B.spaceT("insetInline"),insetY:B.spaceT(["top","bottom"]),insetBlock:B.spaceT("insetBlock"),top:B.spaceT("top"),insetBlockStart:B.spaceT("insetBlockStart"),bottom:B.spaceT("bottom"),insetBlockEnd:B.spaceT("insetBlockEnd"),left:B.spaceT("left"),insetInlineStart:B.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:B.spaceT("right"),insetInlineEnd:B.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Su,{insetStart:Su.insetInlineStart,insetEnd:Su.insetInlineEnd});var c8={ring:{transform:Fe.ring},ringColor:B.colors("--chakra-ring-color"),ringOffset:B.prop("--chakra-ring-offset-width"),ringOffsetColor:B.colors("--chakra-ring-offset-color"),ringInset:B.prop("--chakra-ring-inset")},st={margin:B.spaceT("margin"),marginTop:B.spaceT("marginTop"),marginBlockStart:B.spaceT("marginBlockStart"),marginRight:B.spaceT("marginRight"),marginInlineEnd:B.spaceT("marginInlineEnd"),marginBottom:B.spaceT("marginBottom"),marginBlockEnd:B.spaceT("marginBlockEnd"),marginLeft:B.spaceT("marginLeft"),marginInlineStart:B.spaceT("marginInlineStart"),marginX:B.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:B.spaceT("marginInline"),marginY:B.spaceT(["marginTop","marginBottom"]),marginBlock:B.spaceT("marginBlock"),padding:B.space("padding"),paddingTop:B.space("paddingTop"),paddingBlockStart:B.space("paddingBlockStart"),paddingRight:B.space("paddingRight"),paddingBottom:B.space("paddingBottom"),paddingBlockEnd:B.space("paddingBlockEnd"),paddingLeft:B.space("paddingLeft"),paddingInlineStart:B.space("paddingInlineStart"),paddingInlineEnd:B.space("paddingInlineEnd"),paddingX:B.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:B.space("paddingInline"),paddingY:B.space(["paddingTop","paddingBottom"]),paddingBlock:B.space("paddingBlock")};Object.assign(st,{m:st.margin,mt:st.marginTop,mr:st.marginRight,me:st.marginInlineEnd,marginEnd:st.marginInlineEnd,mb:st.marginBottom,ml:st.marginLeft,ms:st.marginInlineStart,marginStart:st.marginInlineStart,mx:st.marginX,my:st.marginY,p:st.padding,pt:st.paddingTop,py:st.paddingY,px:st.paddingX,pb:st.paddingBottom,pl:st.paddingLeft,ps:st.paddingInlineStart,paddingStart:st.paddingInlineStart,pr:st.paddingRight,pe:st.paddingInlineEnd,paddingEnd:st.paddingInlineEnd});var f8={textDecorationColor:B.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:B.shadows("textShadow")},d8={clipPath:!0,transform:B.propT("transform",Fe.transform),transformOrigin:!0,translateX:B.spaceT("--chakra-translate-x"),translateY:B.spaceT("--chakra-translate-y"),skewX:B.degreeT("--chakra-skew-x"),skewY:B.degreeT("--chakra-skew-y"),scaleX:B.prop("--chakra-scale-x"),scaleY:B.prop("--chakra-scale-y"),scale:B.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:B.degreeT("--chakra-rotate")},h8={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:B.prop("transitionDuration","transition.duration"),transitionProperty:B.prop("transitionProperty","transition.property"),transitionTimingFunction:B.prop("transitionTimingFunction","transition.easing")},p8={fontFamily:B.prop("fontFamily","fonts"),fontSize:B.prop("fontSize","fontSizes",Fe.px),fontWeight:B.prop("fontWeight","fontWeights"),lineHeight:B.prop("lineHeight","lineHeights"),letterSpacing:B.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(t){if(t===!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"}},g8={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:B.spaceT("scrollMargin"),scrollMarginTop:B.spaceT("scrollMarginTop"),scrollMarginBottom:B.spaceT("scrollMarginBottom"),scrollMarginLeft:B.spaceT("scrollMarginLeft"),scrollMarginRight:B.spaceT("scrollMarginRight"),scrollMarginX:B.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:B.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:B.spaceT("scrollPadding"),scrollPaddingTop:B.spaceT("scrollPaddingTop"),scrollPaddingBottom:B.spaceT("scrollPaddingBottom"),scrollPaddingLeft:B.spaceT("scrollPaddingLeft"),scrollPaddingRight:B.spaceT("scrollPaddingRight"),scrollPaddingX:B.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:B.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function jE(t){return zr(t)&&t.reference?t.reference:String(t)}var ap=(t,...e)=>e.map(jE).join(` ${t} `).replace(/calc/g,""),n2=(...t)=>`calc(${ap("+",...t)})`,r2=(...t)=>`calc(${ap("-",...t)})`,hy=(...t)=>`calc(${ap("*",...t)})`,i2=(...t)=>`calc(${ap("/",...t)})`,a2=t=>{const e=jE(t);return e!=null&&!Number.isNaN(parseFloat(e))?String(e).startsWith("-")?String(e).slice(1):`-${e}`:hy(e,-1)},eo=Object.assign(t=>({add:(...e)=>eo(n2(t,...e)),subtract:(...e)=>eo(r2(t,...e)),multiply:(...e)=>eo(hy(t,...e)),divide:(...e)=>eo(i2(t,...e)),negate:()=>eo(a2(t)),toString:()=>t.toString()}),{add:n2,subtract:r2,multiply:hy,divide:i2,negate:a2});function m8(t,e="-"){return t.replace(/\s+/g,e)}function v8(t){const e=m8(t.toString());return S8(y8(e))}function y8(t){return t.includes("\\.")?t:!Number.isInteger(parseFloat(t.toString()))?t.replace(".","\\."):t}function S8(t){return t.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function _8(t,e=""){return[e,t].filter(Boolean).join("-")}function w8(t,e){return`var(${t}${e?`, ${e}`:""})`}function b8(t,e=""){return v8(`--${_8(t,e)}`)}function C8(t,e,n){const r=b8(t,n);return{variable:r,reference:w8(r,e)}}function x8(t){const e=t==null?0:t.length;return e?t[e-1]:void 0}function k8(t){const e=parseFloat(t.toString()),n=t.toString().replace(String(e),"");return{unitless:!n,value:e,unit:n}}function py(t){if(t==null)return t;const{unitless:e}=k8(t);return e||typeof t=="number"?`${t}px`:t}var HE=(t,e)=>parseInt(t[1],10)>parseInt(e[1],10)?1:-1,U0=t=>Object.fromEntries(Object.entries(t).sort(HE));function o2(t){const e=U0(t);return Object.assign(Object.values(e),e)}function E8(t){const e=Object.keys(U0(t));return new Set(e)}function s2(t){var e;if(!t)return t;t=(e=py(t))!=null?e:t;const n=-.02;return typeof t=="number"?`${t+n}`:t.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function au(t,e){const n=["@media screen"];return t&&n.push("and",`(min-width: ${py(t)})`),e&&n.push("and",`(max-width: ${py(e)})`),n.join(" ")}function P8(t){var e;if(!t)return null;t.base=(e=t.base)!=null?e:"0px";const n=o2(t),r=Object.entries(t).sort(HE).map(([s,u],c,f)=>{var h;let[,p]=(h=f[c+1])!=null?h:[];return p=parseFloat(p)>0?s2(p):void 0,{_minW:s2(u),breakpoint:s,minW:u,maxW:p,maxWQuery:au(null,p),minWQuery:au(u),minMaxQuery:au(u,p)}}),i=E8(t),a=Array.from(i.values());return{keys:i,normalized:n,isResponsive(s){const u=Object.keys(s);return u.length>0&&u.every(c=>i.has(c))},asObject:U0(t),asArray:o2(t),details:r,get(s){return r.find(u=>u.breakpoint===s)},media:[null,...n.map(s=>au(s)).slice(1)],toArrayValue(s){if(!zr(s))throw new Error("toArrayValue: value must be an object");const u=a.map(c=>{var f;return(f=s[c])!=null?f:null});for(;x8(u)===null;)u.pop();return u},toObjectValue(s){if(!Array.isArray(s))throw new Error("toObjectValue: value must be an array");return s.reduce((u,c,f)=>{const h=a[f];return h!=null&&c!=null&&(u[h]=c),u},{})}}}var Qt={hover:(t,e)=>`${t}:hover ${e}, ${t}[data-hover] ${e}`,focus:(t,e)=>`${t}:focus ${e}, ${t}[data-focus] ${e}`,focusVisible:(t,e)=>`${t}:focus-visible ${e}`,focusWithin:(t,e)=>`${t}:focus-within ${e}`,active:(t,e)=>`${t}:active ${e}, ${t}[data-active] ${e}`,disabled:(t,e)=>`${t}:disabled ${e}, ${t}[data-disabled] ${e}`,invalid:(t,e)=>`${t}:invalid ${e}, ${t}[data-invalid] ${e}`,checked:(t,e)=>`${t}:checked ${e}, ${t}[data-checked] ${e}`,indeterminate:(t,e)=>`${t}:indeterminate ${e}, ${t}[aria-checked=mixed] ${e}, ${t}[data-indeterminate] ${e}`,readOnly:(t,e)=>`${t}:read-only ${e}, ${t}[readonly] ${e}, ${t}[data-read-only] ${e}`,expanded:(t,e)=>`${t}:read-only ${e}, ${t}[aria-expanded=true] ${e}, ${t}[data-expanded] ${e}`,placeholderShown:(t,e)=>`${t}:placeholder-shown ${e}`},la=t=>WE(e=>t(e,"&"),"[role=group]","[data-group]",".group"),Ai=t=>WE(e=>t(e,"~ &"),"[data-peer]",".peer"),WE=(t,...e)=>e.map(t).join(", "),op={_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",_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:la(Qt.hover),_peerHover:Ai(Qt.hover),_groupFocus:la(Qt.focus),_peerFocus:Ai(Qt.focus),_groupFocusVisible:la(Qt.focusVisible),_peerFocusVisible:Ai(Qt.focusVisible),_groupActive:la(Qt.active),_peerActive:Ai(Qt.active),_groupDisabled:la(Qt.disabled),_peerDisabled:Ai(Qt.disabled),_groupInvalid:la(Qt.invalid),_peerInvalid:Ai(Qt.invalid),_groupChecked:la(Qt.checked),_peerChecked:Ai(Qt.checked),_groupFocusWithin:la(Qt.focusWithin),_peerFocusWithin:Ai(Qt.focusWithin),_peerPlaceholderShown:Ai(Qt.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]"},O8=Object.keys(op);function l2(t,e){return C8(String(t).replace(/\./g,"-"),void 0,e)}function T8(t,e){let n={};const r={};for(const[i,a]of Object.entries(t)){const{isSemantic:s,value:u}=a,{variable:c,reference:f}=l2(i,e==null?void 0:e.cssVarPrefix);if(!s){if(i.startsWith("space")){const g=i.split("."),[y,...v]=g,w=`${y}.-${v.join(".")}`,x=eo.negate(u),_=eo.negate(f);r[w]={value:x,var:c,varRef:_}}n[c]=u,r[i]={value:u,var:c,varRef:f};continue}const h=g=>{const v=[String(i).split(".")[0],g].join(".");if(!t[v])return g;const{reference:x}=l2(v,e==null?void 0:e.cssVarPrefix);return x},p=zr(u)?u:{default:u};n=ai(n,Object.entries(p).reduce((g,[y,v])=>{var w,x;const _=h(v);if(y==="default")return g[c]=_,g;const S=(x=(w=op)==null?void 0:w[y])!=null?x:y;return g[S]={[c]:_},g},{})),r[i]={value:f,var:c,varRef:f}}return{cssVars:n,cssMap:r}}function R8(t,e=[]){const n=Object.assign({},t);for(const r of e)r in n&&delete n[r];return n}function A8(t,e){const n={};for(const r of e)r in t&&(n[r]=t[r]);return n}var I8=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function L8(t){return A8(t,I8)}function M8(t){return t.semanticTokens}function D8(t){const{__cssMap:e,__cssVars:n,__breakpoints:r,...i}=t;return i}function N8({tokens:t,semanticTokens:e}){var n,r;const i=Object.entries((n=gy(t))!=null?n:{}).map(([s,u])=>[s,{isSemantic:!1,value:u}]),a=Object.entries((r=gy(e,1))!=null?r:{}).map(([s,u])=>[s,{isSemantic:!0,value:u}]);return Object.fromEntries([...i,...a])}function gy(t,e=1/0){return!zr(t)&&!Array.isArray(t)||!e?t:Object.entries(t).reduce((n,[r,i])=>(zr(i)||Array.isArray(i)?Object.entries(gy(i,e-1)).forEach(([a,s])=>{n[`${r}.${a}`]=s}):n[r]=i,n),{})}function nW(t){var e;const n=D8(t),r=L8(n),i=M8(n),a=N8({tokens:r,semanticTokens:i}),s=(e=n.config)==null?void 0:e.cssVarPrefix,{cssMap:u,cssVars:c}=T8(a,{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"},...c},__cssMap:u,__breakpoints:P8(n.breakpoints)}),n}var j0=ai({},Cd,He,e8,ch,lr,t8,c8,n8,UE,u8,Su,dy,st,g8,p8,f8,d8,r8,h8),B8=Object.assign({},st,lr,ch,UE,Su),rW=Object.keys(B8),F8=[...Object.keys(j0),...O8],$8={...j0,...op},z8=t=>t in $8,G8=t=>e=>{if(!e.__breakpoints)return t;const{isResponsive:n,toArrayValue:r,media:i}=e.__breakpoints,a={};for(const s in t){let u=io(t[s],e);if(u==null)continue;if(u=zr(u)&&n(u)?r(u):u,!Array.isArray(u)){a[s]=u;continue}const c=u.slice(0,i.length).length;for(let f=0;ft.startsWith("--")&&typeof e=="string"&&!j8(e),W8=(t,e)=>{var n,r;if(e==null)return e;const i=c=>{var f,h;return(h=(f=t.__cssMap)==null?void 0:f[c])==null?void 0:h.varRef},a=c=>{var f;return(f=i(c))!=null?f:c},[s,u]=U8(e);return e=(r=(n=i(s))!=null?n:a(u))!=null?r:a(e),e};function V8(t){const{configs:e={},pseudos:n={},theme:r}=t,i=(a,s=!1)=>{var u,c,f;const h=io(a,r),p=G8(h)(r);let g={};for(let y in p){const v=p[y];let w=io(v,r);y in n&&(y=n[y]),H8(y,w)&&(w=W8(r,w));let x=e[y];if(x===!0&&(x={property:y}),zr(w)){g[y]=(u=g[y])!=null?u:{},g[y]=ai({},g[y],i(w,!0));continue}let _=(f=(c=x==null?void 0:x.transform)==null?void 0:c.call(x,w,r,h))!=null?f:w;_=x!=null&&x.processResult?i(_,!0):_;const S=io(x==null?void 0:x.property,r);if(!s&&(x!=null&&x.static)){const C=io(x.static,r);g=ai({},g,C)}if(S&&Array.isArray(S)){for(const C of S)g[C]=_;continue}if(S){S==="&"&&zr(_)?g=ai({},g,_):g[S]=_;continue}if(zr(_)){g=ai({},g,_);continue}g[y]=_}return g};return i}var q8=t=>e=>V8({theme:e,pseudos:op,configs:j0})(t);function iW(t){return t}function aW(t){return t}function oW(t){return{definePartsStyle(e){return e},defineMultiStyleConfig(e){return{parts:t,...e}}}}function K8(t,e){if(Array.isArray(t))return t;if(zr(t))return e(t);if(t!=null)return[t]}function Y8(t,e){for(let n=e+1;n{ai(f,{[C]:g?S[C]:{[_]:S[C]}})});continue}if(!y){g?ai(f,S):f[_]=S;continue}f[_]=S}}return f}}function Q8(t){return e=>{var n;const{variant:r,size:i,theme:a}=e,s=X8(a);return ai({},io((n=t.baseStyle)!=null?n:{},e),s(t,"sizes",i,e),s(t,"variants",r,e))}}function sW(t,e,n){var r,i,a;return(a=(i=(r=t.__cssMap)==null?void 0:r[`${e}.${n}`])==null?void 0:i.varRef)!=null?a:n}function VE(t){return R8(t,["styleConfig","size","variant","colorScheme"])}function J8(t,e){const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),n}function Z8(t,e,n,r){const i=typeof e=="string"?e.split("."):[e];for(r=0;r{const e=new WeakMap;return(r,i,a,s)=>{if(typeof r>"u")return t(r,i,a);e.has(r)||e.set(r,new Map);const u=e.get(r);if(u.has(i))return u.get(i);const c=t(r,i,a,s);return u.set(i,c),c}},tG=eG(Z8);function qE(t,e){const n={};return Object.keys(t).forEach(r=>{const i=t[r];e(i,r,t)&&(n[r]=i)}),n}var KE=t=>qE(t,e=>e!=null);function nG(t){return typeof t=="function"}function rG(t,...e){return nG(t)?t(...e):t}function lW(...t){return function(n){t.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var iG=typeof Element<"u",aG=typeof Map=="function",oG=typeof Set=="function",sG=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function xd(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!xd(t[r],e[r]))return!1;return!0}var a;if(aG&&t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;for(a=t.entries();!(r=a.next()).done;)if(!xd(r.value[1],e.get(r.value[0])))return!1;return!0}if(oG&&t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(a=t.entries();!(r=a.next()).done;)if(!e.has(r.value[0]))return!1;return!0}if(sG&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;if(iG&&t instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&t.$$typeof)&&!xd(t[i[r]],e[i[r]]))return!1;return!0}return t!==t&&e!==e}var lG=function(e,n){try{return xd(e,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};function YE(t,e={}){var n;const{styleConfig:r,...i}=e,{theme:a,colorMode:s}=M6(),u=t?tG(a,`components.${t}`):void 0,c=r||u,f=ai({theme:a,colorMode:s},(n=c==null?void 0:c.defaultProps)!=null?n:{},KE(J8(i,["children"]))),h=be.useRef({});if(c){const g=Q8(c)(f);lG(h.current,g)||(h.current=g)}return h.current}function XE(t,e={}){return YE(t,e)}function uW(t,e={}){return YE(t,e)}var uG=new Set([...F8,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),cG=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function fG(t){return cG.has(t)||!uG.has(t)}function dG(t){const e=Object.assign({},t);for(let n in e)e[n]===void 0&&delete e[n];return e}function hG(t,...e){if(t==null)throw new TypeError("Cannot convert undefined or null to object");const n={...t};for(const r of e)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}var pG=/^((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)-.*))$/,gG=OE(function(t){return pG.test(t)||t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)<91}),mG=gG,vG=function(e){return e!=="theme"},u2=function(e){return typeof e=="string"&&e.charCodeAt(0)>96?mG:vG},c2=function(e,n,r){var i;if(n){var a=n.shouldForwardProp;i=e.__emotion_forwardProp&&a?function(s){return e.__emotion_forwardProp(s)&&a(s)}:a}return typeof i!="function"&&r&&(i=e.__emotion_forwardProp),i},yG=function(e){var n=e.cache,r=e.serialized,i=e.isStringTag;return RE(n,r,i),O6(function(){return AE(n,r,i)}),null},SG=function t(e,n){var r=e.__emotion_real===e,i=r&&e.__emotion_base||e,a,s;n!==void 0&&(a=n.label,s=n.target);var u=c2(e,n,r),c=u||u2(i),f=!c("as");return function(){var h=arguments,p=r&&e.__emotion_styles!==void 0?e.__emotion_styles.slice(0):[];if(a!==void 0&&p.push("label:"+a+";"),h[0]==null||h[0].raw===void 0)p.push.apply(p,h);else{p.push(h[0][0]);for(var g=h.length,y=1;ye=>{const{theme:n,css:r,__css:i,sx:a,...s}=e,u=qE(s,(p,g)=>z8(g)),c=rG(t,e),f=hG({},i,c,KE(u),a),h=q8(f)(e.theme);return r?[h,r]:h};function Bm(t,e){const{baseStyle:n,...r}=e??{};r.shouldForwardProp||(r.shouldForwardProp=fG);const i=bG({baseStyle:n}),a=wG(t,r)(i);return As.forwardRef(function(c,f){const{colorMode:h,forced:p}=BE();return As.createElement(a,{ref:f,"data-theme":p?h:void 0,...c})})}function CG(){const t=new Map;return new Proxy(Bm,{apply(e,n,r){return Bm(...r)},get(e,n){return t.has(n)||t.set(n,Bm(n)),t.get(n)}})}var dh=CG();function H0(t){return be.forwardRef(t)}var xG=I6({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),QE=H0((t,e)=>{const n=XE("Spinner",t),{label:r="Loading...",thickness:i="2px",speed:a="0.45s",emptyColor:s="transparent",className:u,...c}=VE(t),f=FE("chakra-spinner",u),h={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:s,borderLeftColor:s,animation:`${xG} ${a} linear infinite`,...n};return jt.jsx(dh.div,{ref:e,__css:h,className:f,...c,children:r&&jt.jsx(dh.span,{srOnly:!0,children:r})})});QE.displayName="Spinner";var JE=H0(function(e,n){const r=XE("Text",e),{className:i,align:a,decoration:s,casing:u,...c}=VE(e),f=dG({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return jt.jsx(dh.p,{ref:n,className:FE("chakra-text",e.className),...f,...c,__css:r})});JE.displayName="Text";var ZE=H0(function(e,n){const{direction:r,align:i,justify:a,wrap:s,basis:u,grow:c,shrink:f,...h}=e,p={display:"flex",flexDirection:r,alignItems:i,justifyContent:a,flexWrap:s,flexBasis:u,flexGrow:c,flexShrink:f};return jt.jsx(dh.div,{ref:n,__css:p,...h})});ZE.displayName="Flex";const d2=t=>{const{t:e}=sB(),{showText:n=!1,text:r=e("common.loadingInvokeAI")}=t;return jt.jsxs(ZE,{width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#121212",flexDirection:"column",rowGap:4,children:[jt.jsx(QE,{color:"grey",w:"5rem",h:"5rem"}),n&&jt.jsx(JE,{color:"grey",fontWeight:"semibold",fontFamily:"'Inter', sans-serif",children:r})]})},kG=be.lazy(()=>Cx(()=>import("./App-5c94d6ff.js"),["./App-5c94d6ff.js","./scrollbar-af26543e.js","./App-06f6cac1.css"],import.meta.url)),EG=be.lazy(()=>Cx(()=>import("./ThemeLocaleProvider-2a8c2f39.js"),["./ThemeLocaleProvider-2a8c2f39.js","./scrollbar-af26543e.js"],import.meta.url));function PG(){return jt.jsx(As.StrictMode,{children:jt.jsx(K3,{store:wE,children:jt.jsx(Ix,{loading:jt.jsx(d2,{}),persistor:Wz,children:jt.jsx(As.Suspense,{fallback:jt.jsx(d2,{showText:!0}),children:jt.jsx(EG,{children:jt.jsx(kG,{})})})})})})}Fm.createRoot(document.getElementById("root")).render(jt.jsx(PG,{}));export{hj as $,qf as A,Tf as B,gU as C,M5 as D,sB as E,ZE as F,RH as G,Wj as H,Hj as I,jj as J,Jj as K,Zj as L,Qj as M,Pw as N,$H as O,rH as P,hd as Q,As as R,QE as S,JE as T,TH as U,P5 as V,wj as W,bj as X,lj as Y,pH as Z,Xd as _,FE as a,vH as a$,Tj as a0,BH as a1,FH as a2,_H as a3,pU as a4,_u as a5,OG as a6,rU as a7,dj as a8,XU as a9,zH as aA,hH as aB,dH as aC,T5 as aD,uj as aE,NH as aF,SH as aG,I5 as aH,Xj as aI,zj as aJ,Gj as aK,$j as aL,Lj as aM,xz as aN,cF as aO,uF as aP,Yj as aQ,Ij as aR,Bj as aS,OH as aT,yj as aU,EH as aV,kH as aW,PH as aX,iH as aY,Kj as aZ,mH as a_,ej as aa,rj as ab,oj as ac,tj as ad,aj as ae,nj as af,ij as ag,sj as ah,ZU as ai,Wb as aj,JU as ak,QU as al,Dj as am,_j as an,Cj as ao,Mj as ap,gj as aq,Ow as ar,Rj as as,kj as at,Vj as au,Fj as av,mj as aw,D5 as ax,vj as ay,Aj as az,eW as b,eU as b$,yH as b0,qj as b1,$m as b2,p2 as b3,pe as b4,Lb as b5,bU as b6,UU as b7,GU as b8,tU as b9,$U as bA,qH as bB,KG as bC,aU as bD,oU as bE,Of as bF,va as bG,CU as bH,wU as bI,yU as bJ,LG as bK,MG as bL,LH as bM,MH as bN,fU as bO,iU as bP,ZG as bQ,qU as bR,cH as bS,If as bT,ei as bU,zl as bV,Ae as bW,EU as bX,ns as bY,DG as bZ,xU as b_,IU as ba,HU as bb,DH as bc,WG as bd,vU as be,Vl as bf,dU as bg,VG as bh,bz as bi,mU as bj,UG as bk,hU as bl,jG as bm,XG as bn,RG as bo,AG as bp,IG as bq,jU as br,Jx as bs,BG as bt,FG as bu,$G as bv,zU as bw,JG as bx,QG as by,qG as bz,dh as c,nU as c0,GG as c1,zG as c2,KH as c3,HG as c4,FU as c5,PU as c6,OU as c7,DU as c8,cU as c9,jH as cA,WH as cB,AH as cC,eH as cD,aH as cE,wH as cF,CH as cG,lH as cH,Wz as cI,sH as cJ,gH as cK,uH as cL,XH as cM,NE as cN,iW as cO,oW as cP,C8 as cQ,aW as cR,ai as cS,nW as cT,YH as cU,BE as cV,tG as cW,q8 as cX,Yd as cY,O3 as cZ,TG as c_,uU as ca,kU as cb,YU as cc,AU as cd,TU as ce,BU as cf,NG as cg,L5 as ch,Nj as ci,KU as cj,lU as ck,xj as cl,Ej as cm,Pj as cn,Oj as co,tH as cp,oH as cq,HH as cr,UH as cs,GH as ct,bH as cu,mB as cv,vB as cw,xH as cx,VH as cy,fH as cz,uW as d,XE as e,H0 as f,JH as g,ZH as h,tW as i,jt as j,I6 as k,jv as l,Ur as m,rG as n,VE as o,lW as p,zr as q,be as r,L6 as s,io as t,M6 as u,rW as v,QH as w,sW as x,bk as y,_t as z}; diff --git a/invokeai/frontend/web/dist/assets/scrollbar-7e342734.js b/invokeai/frontend/web/dist/assets/scrollbar-af26543e.js similarity index 99% rename from invokeai/frontend/web/dist/assets/scrollbar-7e342734.js rename to invokeai/frontend/web/dist/assets/scrollbar-af26543e.js index 0a4e9fe3d0..fd699cac6e 100644 --- a/invokeai/frontend/web/dist/assets/scrollbar-7e342734.js +++ b/invokeai/frontend/web/dist/assets/scrollbar-af26543e.js @@ -1,4 +1,4 @@ -import{cY as zt,cZ as Ji,r as m,j as C,a5 as Cs,R as Ss,c as G,t as Te,f as Mt,a as Dt,e as As,S as Qi,o as Vs,d as to,c_ as eo}from"./index-61f10aa8.js";function ws(t=zt){const e=t===zt?Ji:()=>m.useContext(t);return function(){const{store:s}=e();return s}}const no=ws();function so(t=zt){const e=t===zt?no:ws(t);return function(){return e().dispatch}}const io=so();function oo(t,e){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${e}`}function Rt(t={}){const{name:e,strict:n=!0,hookName:s="useContext",providerName:i="Provider",errorMessage:r}=t,o=m.createContext(void 0);o.displayName=e;function a(){var c;const l=m.useContext(o);if(!l&&n){const u=new Error(r??oo(s,i));throw u.name="ContextError",(c=Error.captureStackTrace)==null||c.call(Error,u,a),u}return l}return[o.Provider,a,o]}var[ro,ao]=Rt({strict:!1,name:"PortalManagerContext"});function co(t){const{children:e,zIndex:n}=t;return C.jsx(ro,{value:{zIndex:n},children:e})}co.displayName="PortalManager";var Ce=Boolean(globalThis==null?void 0:globalThis.document)?m.useLayoutEffect:m.useEffect,[Ms,lo]=Rt({strict:!1,name:"PortalContext"}),ze="chakra-portal",uo=".chakra-portal",fo=t=>C.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:t.zIndex,top:0,left:0,right:0},children:t.children}),ho=t=>{const{appendToParentPortal:e,children:n}=t,[s,i]=m.useState(null),r=m.useRef(null),[,o]=m.useState({});m.useEffect(()=>o({}),[]);const a=lo(),c=ao();Ce(()=>{if(!s)return;const u=s.ownerDocument,f=e?a??u.body:u.body;if(!f)return;r.current=u.createElement("div"),r.current.className=ze,f.appendChild(r.current),o({});const h=r.current;return()=>{f.contains(h)&&f.removeChild(h)}},[s]);const l=c!=null&&c.zIndex?C.jsx(fo,{zIndex:c==null?void 0:c.zIndex,children:n}):n;return r.current?Cs.createPortal(C.jsx(Ms,{value:r.current,children:l}),r.current):C.jsx("span",{ref:u=>{u&&i(u)}})},po=t=>{const{children:e,containerRef:n,appendToParentPortal:s}=t,i=n.current,r=i??(typeof window<"u"?document.body:void 0),o=m.useMemo(()=>{const c=i==null?void 0:i.ownerDocument.createElement("div");return c&&(c.className=ze),c},[i]),[,a]=m.useState({});return Ce(()=>a({}),[]),Ce(()=>{if(!(!o||!r))return r.appendChild(o),()=>{r.removeChild(o)}},[o,r]),r&&o?Cs.createPortal(C.jsx(Ms,{value:s?o:null,children:e}),o):null};function Jt(t){const e={appendToParentPortal:!0,...t},{containerRef:n,...s}=e;return n?C.jsx(po,{containerRef:n,...s}):C.jsx(ho,{...s})}Jt.className=ze;Jt.selector=uo;Jt.displayName="Portal";var mo=(t,e)=>t.find(n=>n.id===e);function yn(t,e){const n=Ds(t,e),s=n?t[n].findIndex(i=>i.id===e):-1;return{position:n,index:s}}function Ds(t,e){for(const[n,s]of Object.entries(t))if(mo(s,e))return n}function go(t){const e=t.includes("right"),n=t.includes("left");let s="center";return e&&(s="flex-end"),n&&(s="flex-start"),{display:"flex",flexDirection:"column",alignItems:s}}function yo(t){const n=t==="top"||t==="bottom"?"0 auto":void 0,s=t.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=t.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,r=t.includes("left")?void 0:"env(safe-area-inset-right, 0px)",o=t.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:5500,pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:s,bottom:i,right:r,left:o}}function vo(t,e=[]){const n=m.useRef(t);return m.useEffect(()=>{n.current=t}),m.useCallback((...s)=>{var i;return(i=n.current)==null?void 0:i.call(n,...s)},e)}function xo(t,e){const n=vo(t);m.useEffect(()=>{if(e==null)return;let s=null;return s=window.setTimeout(()=>{n()},e),()=>{s&&window.clearTimeout(s)}},[e,n])}function vn(t,e){const n=m.useRef(!1),s=m.useRef(!1);m.useEffect(()=>{if(n.current&&s.current)return t();s.current=!0},e),m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const Rs=m.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Qt=m.createContext({});function bo(){return m.useContext(Qt).visualElement}const Et=m.createContext(null),te=typeof document<"u",$t=te?m.useLayoutEffect:m.useEffect,Es=m.createContext({strict:!1});function Po(t,e,n,s){const i=bo(),r=m.useContext(Es),o=m.useContext(Et),a=m.useContext(Rs).reducedMotion,c=m.useRef();s=s||r.renderer,!c.current&&s&&(c.current=s(t,{visualState:e,parent:i,props:n,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const l=c.current;return m.useInsertionEffect(()=>{l&&l.update(n,o)}),$t(()=>{l&&l.render()}),m.useEffect(()=>{l&&l.updateFeatures()}),(window.HandoffAppearAnimations?$t:m.useEffect)(()=>{l&&l.animationState&&l.animationState.animateChanges()}),l}function lt(t){return typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function To(t,e,n){return m.useCallback(s=>{s&&t.mount&&t.mount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):lt(n)&&(n.current=s))},[e])}function Ct(t){return typeof t=="string"||Array.isArray(t)}function ee(t){return typeof t=="object"&&typeof t.start=="function"}const $e=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],We=["initial",...$e];function ne(t){return ee(t.animate)||We.some(e=>Ct(t[e]))}function Ls(t){return Boolean(ne(t)||t.variants)}function Co(t,e){if(ne(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Ct(n)?n:void 0,animate:Ct(s)?s:void 0}}return t.inherit!==!1?e:{}}function So(t){const{initial:e,animate:n}=Co(t,m.useContext(Qt));return m.useMemo(()=>({initial:e,animate:n}),[xn(e),xn(n)])}function xn(t){return Array.isArray(t)?t.join(" "):t}const bn={animation:["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"],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"]},St={};for(const t in bn)St[t]={isEnabled:e=>bn[t].some(n=>!!e[n])};function Ao(t){for(const e in t)St[e]={...St[e],...t[e]}}function He(t){const e=m.useRef(null);return e.current===null&&(e.current=t()),e.current}const yt={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Vo=1;function wo(){return He(()=>{if(yt.hasEverUpdated)return Vo++})}const Ge=m.createContext({}),ks=m.createContext({}),Mo=Symbol.for("motionComponentSymbol");function Do({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:s,Component:i}){t&&Ao(t);function r(a,c){let l;const u={...m.useContext(Rs),...a,layoutId:Ro(a)},{isStatic:f}=u,h=So(a),d=f?void 0:wo(),p=s(a,f);if(!f&&te){h.visualElement=Po(i,p,u,e);const g=m.useContext(ks),T=m.useContext(Es).strict;h.visualElement&&(l=h.visualElement.loadFeatures(u,T,t,d,g))}return m.createElement(Qt.Provider,{value:h},l&&h.visualElement?m.createElement(l,{visualElement:h.visualElement,...u}):null,n(i,a,d,To(p,h.visualElement,c),p,f,h.visualElement))}const o=m.forwardRef(r);return o[Mo]=i,o}function Ro({layoutId:t}){const e=m.useContext(Ge).id;return e&&t!==void 0?e+"-"+t:t}function Eo(t){function e(s,i={}){return Do(t(s,i))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(s,i)=>(n.has(i)||n.set(i,e(i)),n.get(i))})}const Lo=["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 Ke(t){return typeof t!="string"||t.includes("-")?!1:!!(Lo.indexOf(t)>-1||/[A-Z]/.test(t))}const Wt={};function ko(t){Object.assign(Wt,t)}const se=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ot=new Set(se);function js(t,{layout:e,layoutId:n}){return ot.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Wt[t]||t==="opacity")}const k=t=>Boolean(t&&t.getVelocity),jo={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Bo=se.length;function Fo(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},s,i){let r="";for(let o=0;oe=>typeof e=="string"&&e.startsWith(t),Fs=Bs("--"),Se=Bs("var(--"),Io=(t,e)=>e&&typeof t=="number"?e.transform(t):t,ht=(t,e,n)=>Math.min(Math.max(n,t),e),rt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},vt={...rt,transform:t=>ht(0,1,t)},It={...rt,default:1},xt=t=>Math.round(t*1e5)/1e5,At=/(-)?([\d]*\.?[\d])+/g,Ae=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Oo=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Lt(t){return typeof t=="string"}const kt=t=>({test:e=>Lt(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),q=kt("deg"),z=kt("%"),P=kt("px"),No=kt("vh"),Uo=kt("vw"),Pn={...z,parse:t=>z.parse(t)/100,transform:t=>z.transform(t*100)},Tn={...rt,transform:Math.round},Is={borderWidth:P,borderTopWidth:P,borderRightWidth:P,borderBottomWidth:P,borderLeftWidth:P,borderRadius:P,radius:P,borderTopLeftRadius:P,borderTopRightRadius:P,borderBottomRightRadius:P,borderBottomLeftRadius:P,width:P,maxWidth:P,height:P,maxHeight:P,size:P,top:P,right:P,bottom:P,left:P,padding:P,paddingTop:P,paddingRight:P,paddingBottom:P,paddingLeft:P,margin:P,marginTop:P,marginRight:P,marginBottom:P,marginLeft:P,rotate:q,rotateX:q,rotateY:q,rotateZ:q,scale:It,scaleX:It,scaleY:It,scaleZ:It,skew:q,skewX:q,skewY:q,distance:P,translateX:P,translateY:P,translateZ:P,x:P,y:P,z:P,perspective:P,transformPerspective:P,opacity:vt,originX:Pn,originY:Pn,originZ:P,zIndex:Tn,fillOpacity:vt,strokeOpacity:vt,numOctaves:Tn};function Ze(t,e,n,s){const{style:i,vars:r,transform:o,transformOrigin:a}=t;let c=!1,l=!1,u=!0;for(const f in e){const h=e[f];if(Fs(f)){r[f]=h;continue}const d=Is[f],p=Io(h,d);if(ot.has(f)){if(c=!0,o[f]=p,!u)continue;h!==(d.default||0)&&(u=!1)}else f.startsWith("origin")?(l=!0,a[f]=p):i[f]=p}if(e.transform||(c||s?i.transform=Fo(t.transform,n,u,s):i.transform&&(i.transform="none")),l){const{originX:f="50%",originY:h="50%",originZ:d=0}=a;i.transformOrigin=`${f} ${h} ${d}`}}const qe=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Os(t,e,n){for(const s in e)!k(e[s])&&!js(s,n)&&(t[s]=e[s])}function _o({transformTemplate:t},e,n){return m.useMemo(()=>{const s=qe();return Ze(s,e,{enableHardwareAcceleration:!n},t),Object.assign({},s.vars,s.style)},[e])}function zo(t,e,n){const s=t.style||{},i={};return Os(i,s,t),Object.assign(i,_o(t,e,n)),t.transformValues?t.transformValues(i):i}function $o(t,e,n){const s={},i=zo(t,e,n);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=i,s}const Wo=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 Ht(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||Wo.has(t)}let Ns=t=>!Ht(t);function Ho(t){t&&(Ns=e=>e.startsWith("on")?!Ht(e):t(e))}try{Ho(require("@emotion/is-prop-valid").default)}catch{}function Go(t,e,n){const s={};for(const i in t)i==="values"&&typeof t.values=="object"||(Ns(i)||n===!0&&Ht(i)||!e&&!Ht(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}function Cn(t,e,n){return typeof t=="string"?t:P.transform(e+n*t)}function Ko(t,e,n){const s=Cn(e,t.x,t.width),i=Cn(n,t.y,t.height);return`${s} ${i}`}const Zo={offset:"stroke-dashoffset",array:"stroke-dasharray"},qo={offset:"strokeDashoffset",array:"strokeDasharray"};function Yo(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?Zo:qo;t[r.offset]=P.transform(-s);const o=P.transform(e),a=P.transform(n);t[r.array]=`${o} ${a}`}function Ye(t,{attrX:e,attrY:n,originX:s,originY:i,pathLength:r,pathSpacing:o=1,pathOffset:a=0,...c},l,u,f){if(Ze(t,c,l,f),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:d,dimensions:p}=t;h.transform&&(p&&(d.transform=h.transform),delete h.transform),p&&(s!==void 0||i!==void 0||d.transform)&&(d.transformOrigin=Ko(p,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&Yo(h,r,o,a,!1)}const Us=()=>({...qe(),attrs:{}}),Xe=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Xo(t,e,n,s){const i=m.useMemo(()=>{const r=Us();return Ye(r,e,{enableHardwareAcceleration:!1},Xe(s),t.transformTemplate),{...r.attrs,style:{...r.style}}},[e]);if(t.style){const r={};Os(r,t.style,t),i.style={...r,...i.style}}return i}function Jo(t=!1){return(n,s,i,r,{latestValues:o},a)=>{const l=(Ke(n)?Xo:$o)(s,o,a,n),f={...Go(s,typeof n=="string",t),...l,ref:r},{children:h}=s,d=m.useMemo(()=>k(h)?h.get():h,[h]);return i&&(f["data-projection-id"]=i),m.createElement(n,{...f,children:d})}}const Je=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function _s(t,{style:e,vars:n},s,i){Object.assign(t.style,e,i&&i.getProjectionStyles(s));for(const r in n)t.style.setProperty(r,n[r])}const zs=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 $s(t,e,n,s){_s(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(zs.has(i)?i:Je(i),e.attrs[i])}function Qe(t,e){const{style:n}=t,s={};for(const i in n)(k(n[i])||e.style&&k(e.style[i])||js(i,t))&&(s[i]=n[i]);return s}function Ws(t,e){const n=Qe(t,e);for(const s in t)if(k(t[s])||k(e[s])){const i=s==="x"||s==="y"?"attr"+s.toUpperCase():s;n[i]=t[s]}return n}function tn(t,e,n,s={},i={}){return typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),e}const Gt=t=>Array.isArray(t),Qo=t=>Boolean(t&&typeof t=="object"&&t.mix&&t.toValue),tr=t=>Gt(t)?t[t.length-1]||0:t;function Ut(t){const e=k(t)?t.get():t;return Qo(e)?e.toValue():e}function er({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},s,i,r){const o={latestValues:nr(s,i,r,t),renderState:e()};return n&&(o.mount=a=>n(s,a,o)),o}const Hs=t=>(e,n)=>{const s=m.useContext(Qt),i=m.useContext(Et),r=()=>er(t,e,s,i);return n?r():He(r)};function nr(t,e,n,s){const i={},r=s(t,{});for(const h in r)i[h]=Ut(r[h]);let{initial:o,animate:a}=t;const c=ne(t),l=Ls(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!ee(f)&&(Array.isArray(f)?f:[f]).forEach(d=>{const p=tn(t,d);if(!p)return;const{transitionEnd:g,transition:T,...b}=p;for(const x in b){let y=b[x];if(Array.isArray(y)){const v=u?y.length-1:0;y=y[v]}y!==null&&(i[x]=y)}for(const x in g)i[x]=g[x]}),i}const sr={useVisualState:Hs({scrapeMotionValuesFromProps:Ws,createRenderState:Us,onMount:(t,e,{renderState:n,latestValues:s})=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}Ye(n,s,{enableHardwareAcceleration:!1},Xe(e.tagName),t.transformTemplate),$s(e,n)}})},ir={useVisualState:Hs({scrapeMotionValuesFromProps:Qe,createRenderState:qe})};function or(t,{forwardMotionProps:e=!1},n,s){return{...Ke(t)?sr:ir,preloadedFeatures:n,useRender:Jo(e),createVisualElement:s,Component:t}}function $(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const Gs=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function ie(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const rr=t=>e=>Gs(e)&&t(e,ie(e));function W(t,e,n,s){return $(t,e,rr(n),s)}const ar=(t,e)=>n=>e(t(n)),X=(...t)=>t.reduce(ar);function Ks(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const Sn=Ks("dragHorizontal"),An=Ks("dragVertical");function Zs(t){let e=!1;if(t==="y")e=An();else if(t==="x")e=Sn();else{const n=Sn(),s=An();n&&s?e=()=>{n(),s()}:(n&&n(),s&&s())}return e}function qs(){const t=Zs(!0);return t?(t(),!1):!0}class tt{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Vn(t,e){const n="pointer"+(e?"enter":"leave"),s="onHover"+(e?"Start":"End"),i=(r,o)=>{if(r.type==="touch"||qs())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e),a[s]&&a[s](r,o)};return W(t.current,n,i,{passive:!t.getProps()[s]})}class cr extends tt{mount(){this.unmount=X(Vn(this.node,!0),Vn(this.node,!1))}unmount(){}}class lr extends tt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=X($(this.node.current,"focus",()=>this.onFocus()),$(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Ys=(t,e)=>e?t===e?!0:Ys(t,e.parentElement):!1,I=t=>t;function le(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,ie(n))}class ur extends tt{constructor(){super(...arguments),this.removeStartListeners=I,this.removeEndListeners=I,this.removeAccessibleListeners=I,this.startPointerPress=(e,n)=>{if(this.removeEndListeners(),this.isPressing)return;const s=this.node.getProps(),r=W(window,"pointerup",(a,c)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:u}=this.node.getProps();Ys(this.node.current,a.target)?l&&l(a,c):u&&u(a,c)},{passive:!(s.onTap||s.onPointerUp)}),o=W(window,"pointercancel",(a,c)=>this.cancelPress(a,c),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=X(r,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=r=>{if(r.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||le("up",this.node.getProps().onTap)};this.removeEndListeners(),this.removeEndListeners=$(this.node.current,"keyup",o),le("down",(a,c)=>{this.startPress(a,c)})},n=$(this.node.current,"keydown",e),s=()=>{this.isPressing&&le("cancel",(r,o)=>this.cancelPress(r,o))},i=$(this.node.current,"blur",s);this.removeAccessibleListeners=X(n,i)}}startPress(e,n){this.isPressing=!0;const{onTapStart:s,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(e,n)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!qs()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(e,n)}mount(){const e=this.node.getProps(),n=W(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),s=$(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=X(n,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ve=new WeakMap,ue=new WeakMap,fr=t=>{const e=Ve.get(t.target);e&&e(t)},hr=t=>{t.forEach(fr)};function dr({root:t,...e}){const n=t||document;ue.has(n)||ue.set(n,{});const s=ue.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(hr,{root:t,...e})),s[i]}function pr(t,e,n){const s=dr(e);return Ve.set(t,n),s.observe(t),()=>{Ve.delete(t),s.unobserve(t)}}const mr={some:0,all:1};class gr extends tt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}viewportFallback(){requestAnimationFrame(()=>{this.hasEnteredView=!0;const{onViewportEnter:e}=this.node.getProps();e&&e(null),this.node.animationState&&this.node.animationState.setActive("whileInView",!0)})}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r,fallback:o=!0}=e;if(typeof IntersectionObserver>"u"){o&&this.viewportFallback();return}const a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:mr[i]},c=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,r&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),d=u?f:h;d&&d(l)};return pr(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(yr(e,n))&&this.startObserver()}unmount(){}}function yr({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const vr={inView:{Feature:gr},tap:{Feature:ur},focus:{Feature:lr},hover:{Feature:cr}};function Xs(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s/^\-?\d*\.?\d+$/.test(t),br=t=>/^0[^.\s]+$/.test(t),H={delta:0,timestamp:0},Js=1/60*1e3,Pr=typeof performance<"u"?()=>performance.now():()=>Date.now(),Qs=typeof window<"u"?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(Pr()),Js);function Tr(t){let e=[],n=[],s=0,i=!1,r=!1;const o=new WeakSet,a={schedule:(c,l=!1,u=!1)=>{const f=u&&i,h=f?e:n;return l&&o.add(c),h.indexOf(c)===-1&&(h.push(c),f&&i&&(s=e.length)),c},cancel:c=>{const l=n.indexOf(c);l!==-1&&n.splice(l,1),o.delete(c)},process:c=>{if(i){r=!0;return}if(i=!0,[e,n]=[n,e],n.length=0,s=e.length,s)for(let l=0;l(t[e]=Tr(()=>Vt=!0),t),{}),R=jt.reduce((t,e)=>{const n=oe[e];return t[e]=(s,i=!1,r=!1)=>(Vt||Ar(),n.schedule(s,i,r)),t},{}),J=jt.reduce((t,e)=>(t[e]=oe[e].cancel,t),{}),fe=jt.reduce((t,e)=>(t[e]=()=>oe[e].process(H),t),{}),Sr=t=>oe[t].process(H),ti=t=>{Vt=!1,H.delta=we?Js:Math.max(Math.min(t-H.timestamp,Cr),1),H.timestamp=t,Me=!0,jt.forEach(Sr),Me=!1,Vt&&(we=!1,Qs(ti))},Ar=()=>{Vt=!0,we=!0,Me||Qs(ti)};function en(t,e){t.indexOf(e)===-1&&t.push(e)}function nn(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class sn{constructor(){this.subscriptions=[]}add(e){return en(this.subscriptions,e),()=>nn(this.subscriptions,e)}notify(e,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,s);else for(let r=0;r!isNaN(parseFloat(t));class wr{constructor(e,n={}){this.version="9.1.7",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,i=!0)=>{this.prev=this.current,this.current=s;const{delta:r,timestamp:o}=H;this.lastUpdated!==o&&(this.timeDelta=r,this.lastUpdated=o,R.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=()=>R.postRender(this.velocityCheck),this.velocityCheck=({timestamp:s})=>{s!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=Vr(this.current),this.owner=n.owner}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new sn);const s=this.events[e].add(n);return e==="change"?()=>{s(),R.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,s){this.set(n),this.prev=e,this.timeDelta=s}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?on(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n)||null,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(){this.animation=null}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dt(t,e){return new wr(t,e)}const rn=(t,e)=>n=>Boolean(Lt(n)&&Oo.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),ei=(t,e,n)=>s=>{if(!Lt(s))return s;const[i,r,o,a]=s.match(At);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Mr=t=>ht(0,255,t),he={...rt,transform:t=>Math.round(Mr(t))},it={test:rn("rgb","red"),parse:ei("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+he.transform(t)+", "+he.transform(e)+", "+he.transform(n)+", "+xt(vt.transform(s))+")"};function Dr(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const De={test:rn("#"),parse:Dr,transform:it.transform},ut={test:rn("hsl","hue"),parse:ei("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+z.transform(xt(e))+", "+z.transform(xt(n))+", "+xt(vt.transform(s))+")"},E={test:t=>it.test(t)||De.test(t)||ut.test(t),parse:t=>it.test(t)?it.parse(t):ut.test(t)?ut.parse(t):De.parse(t),transform:t=>Lt(t)?t:t.hasOwnProperty("red")?it.transform(t):ut.transform(t)},ni="${c}",si="${n}";function Rr(t){var e,n;return isNaN(t)&&Lt(t)&&(((e=t.match(At))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Ae))===null||n===void 0?void 0:n.length)||0)>0}function Kt(t){typeof t=="number"&&(t=`${t}`);const e=[];let n=0,s=0;const i=t.match(Ae);i&&(n=i.length,t=t.replace(Ae,ni),e.push(...i.map(E.parse)));const r=t.match(At);return r&&(s=r.length,t=t.replace(At,si),e.push(...r.map(rt.parse))),{values:e,numColors:n,numNumbers:s,tokenised:t}}function ii(t){return Kt(t).values}function oi(t){const{values:e,numColors:n,tokenised:s}=Kt(t),i=e.length;return r=>{let o=s;for(let a=0;atypeof t=="number"?0:t;function Lr(t){const e=ii(t);return oi(t)(e.map(Er))}const Q={test:Rr,parse:ii,createTransformer:oi,getAnimatableNone:Lr},kr=new Set(["brightness","contrast","saturate","opacity"]);function jr(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(At)||[];if(!s)return t;const i=n.replace(s,"");let r=kr.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const Br=/([a-z-]*)\(.*?\)/g,Re={...Q,getAnimatableNone:t=>{const e=t.match(Br);return e?e.map(jr).join(" "):t}},Fr={...Is,color:E,backgroundColor:E,outlineColor:E,fill:E,stroke:E,borderColor:E,borderTopColor:E,borderRightColor:E,borderBottomColor:E,borderLeftColor:E,filter:Re,WebkitFilter:Re},an=t=>Fr[t];function cn(t,e){let n=an(t);return n!==Re&&(n=Q),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ri=t=>e=>e.test(t),Ir={test:t=>t==="auto",parse:t=>t},ai=[rt,P,z,q,Uo,No,Ir],pt=t=>ai.find(ri(t)),Or=[...ai,E,Q],Nr=t=>Or.find(ri(t));function Ur(t){const e={};return t.values.forEach((n,s)=>e[s]=n.get()),e}function _r(t){const e={};return t.values.forEach((n,s)=>e[s]=n.getVelocity()),e}function re(t,e,n){const s=t.getProps();return tn(s,e,n!==void 0?n:s.custom,Ur(t),_r(t))}function zr(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,dt(n))}function $r(t,e){const n=re(t,e);let{transitionEnd:s={},transition:i={},...r}=n?t.makeTargetAnimatable(n,!1):{};r={...r,...s};for(const o in r){const a=tr(r[o]);zr(t,o,a)}}function Wr(t,e,n){var s,i;const r=Object.keys(e).filter(a=>!t.hasValue(a)),o=r.length;if(o)for(let a=0;at*1e3,Yr={current:!1},ln=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,un=t=>e=>1-t(1-e),fn=t=>t*t,Xr=un(fn),hn=ln(fn),A=(t,e,n)=>-n*t+n*e+t;function de(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Jr({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,c=2*n-a;i=de(c,a,t+1/3),r=de(c,a,t),o=de(c,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}const pe=(t,e,n)=>{const s=t*t;return Math.sqrt(Math.max(0,n*(e*e-s)+s))},Qr=[De,it,ut],ta=t=>Qr.find(e=>e.test(t));function wn(t){const e=ta(t);let n=e.parse(t);return e===ut&&(n=Jr(n)),n}const ci=(t,e)=>{const n=wn(t),s=wn(e),i={...n};return r=>(i.red=pe(n.red,s.red,r),i.green=pe(n.green,s.green,r),i.blue=pe(n.blue,s.blue,r),i.alpha=A(n.alpha,s.alpha,r),it.transform(i))};function li(t,e){return typeof t=="number"?n=>A(t,e,n):E.test(t)?ci(t,e):fi(t,e)}const ui=(t,e)=>{const n=[...t],s=n.length,i=t.map((r,o)=>li(r,e[o]));return r=>{for(let o=0;o{const n={...t,...e},s={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(s[i]=li(t[i],e[i]));return i=>{for(const r in s)n[r]=s[r](i);return n}},fi=(t,e)=>{const n=Q.createTransformer(e),s=Kt(t),i=Kt(e);return s.numColors===i.numColors&&s.numNumbers>=i.numNumbers?X(ui(s.values,i.values),n):o=>`${o>0?e:t}`},wt=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s},Mn=(t,e)=>n=>A(t,e,n);function na(t){return typeof t=="number"?Mn:typeof t=="string"?E.test(t)?ci:fi:Array.isArray(t)?ui:typeof t=="object"?ea:Mn}function sa(t,e,n){const s=[],i=n||na(t[0]),r=t.length-1;for(let o=0;ot[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=sa(e,s,i),a=o.length,c=l=>{let u=0;if(a>1)for(;uc(ht(t[0],t[r-1],l)):c}function ia(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=wt(0,e,s);t.push(A(n,1,i))}}function oa(t){const e=[0];return ia(e,t.length-1),e}function ra(t,e){return t.map(n=>n*e)}const di=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,aa=1e-7,ca=12;function la(t,e,n,s,i){let r,o,a=0;do o=e+(n-e)/2,r=di(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>aa&&++ala(r,0,1,t,n);return r=>r===0||r===1?r:di(i(r),e,s)}const mi=t=>1-Math.sin(Math.acos(t)),dn=un(mi),ua=ln(dn),gi=pi(.33,1.53,.69,.99),pn=un(gi),fa=ln(pn),ha=t=>(t*=2)<1?.5*pn(t):.5*(2-Math.pow(2,-10*(t-1))),da={linear:I,easeIn:fn,easeInOut:hn,easeOut:Xr,circIn:mi,circInOut:ua,circOut:dn,backIn:pn,backInOut:fa,backOut:gi,anticipate:ha},Dn=t=>{if(Array.isArray(t)){qt(t.length===4);const[e,n,s,i]=t;return pi(e,n,s,i)}else if(typeof t=="string")return da[t];return t},pa=t=>Array.isArray(t)&&typeof t[0]!="number";function ma(t,e){return t.map(()=>e||hn).splice(0,t.length-1)}function Ee({keyframes:t,ease:e=hn,times:n,duration:s=300}){t=[...t];const i=pa(e)?e.map(Dn):Dn(e),r={done:!1,value:t[0]},o=ra(n&&n.length===t.length?n:oa(t),s);function a(){return hi(o,t,{ease:Array.isArray(i)?i:ma(t,i)})}let c=a();return{next:l=>(r.value=c(l),r.done=l>=s,r),flipTarget:()=>{t.reverse(),c=a()}}}const me=.001,ga=.01,Rn=10,ya=.05,va=1;function xa({duration:t=800,bounce:e=.25,velocity:n=0,mass:s=1}){let i,r;qr(t<=Rn*1e3);let o=1-e;o=ht(ya,va,o),t=ht(ga,Rn,t/1e3),o<1?(i=l=>{const u=l*o,f=u*t,h=u-n,d=Le(l,o),p=Math.exp(-f);return me-h/d*p},r=l=>{const f=l*o*t,h=f*n+n,d=Math.pow(o,2)*Math.pow(l,2)*t,p=Math.exp(-f),g=Le(Math.pow(l,2),o);return(-i(l)+me>0?-1:1)*((h-d)*p)/g}):(i=l=>{const u=Math.exp(-l*t),f=(l-n)*t+1;return-me+u*f},r=l=>{const u=Math.exp(-l*t),f=(n-l)*(t*t);return u*f});const a=5/t,c=Pa(i,r,a);if(t=t*1e3,isNaN(c))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(c,2)*s;return{stiffness:l,damping:o*2*Math.sqrt(s*l),duration:t}}}const ba=12;function Pa(t,e,n){let s=n;for(let i=1;it[n]!==void 0)}function Sa(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!En(t,Ca)&&En(t,Ta)){const n=xa(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}const Aa=5;function yi({keyframes:t,restDelta:e,restSpeed:n,...s}){let i=t[0],r=t[t.length-1];const o={done:!1,value:i},{stiffness:a,damping:c,mass:l,velocity:u,duration:f,isResolvedFromDuration:h}=Sa(s);let d=Va,p=u?-(u/1e3):0;const g=c/(2*Math.sqrt(a*l));function T(){const b=r-i,x=Math.sqrt(a/l)/1e3,y=Math.abs(b)<5;if(n||(n=y?.01:2),e||(e=y?.005:.5),g<1){const v=Le(x,g);d=S=>{const w=Math.exp(-g*x*S);return r-w*((p+g*x*b)/v*Math.sin(v*S)+b*Math.cos(v*S))}}else if(g===1)d=v=>r-Math.exp(-x*v)*(b+(p+x*b)*v);else{const v=x*Math.sqrt(g*g-1);d=S=>{const w=Math.exp(-g*x*S),D=Math.min(v*S,300);return r-w*((p+g*x*b)*Math.sinh(D)+v*b*Math.cosh(D))/v}}}return T(),{next:b=>{const x=d(b);if(h)o.done=b>=f;else{let y=p;if(b!==0)if(g<1){const w=Math.max(0,b-Aa);y=on(x-d(w),b-w)}else y=0;const v=Math.abs(y)<=n,S=Math.abs(r-x)<=e;o.done=v&&S}return o.value=o.done?r:x,o},flipTarget:()=>{p=-p,[i,r]=[r,i],T()}}}yi.needsInterpolation=(t,e)=>typeof t=="string"||typeof e=="string";const Va=t=>0;function wa({keyframes:t=[0],velocity:e=0,power:n=.8,timeConstant:s=350,restDelta:i=.5,modifyTarget:r}){const o=t[0],a={done:!1,value:o};let c=n*e;const l=o+c,u=r===void 0?l:r(l);return u!==l&&(c=u-o),{next:f=>{const h=-c*Math.exp(-f/s);return a.done=!(h>i||h<-i),a.value=a.done?u:u+h,a},flipTarget:()=>{}}}const Ma={decay:wa,keyframes:Ee,tween:Ee,spring:yi};function vi(t,e,n=0){return t-e-n}function Da(t,e=0,n=0,s=!0){return s?vi(e+-t,e,n):e-(t-e)+n}function Ra(t,e,n,s){return s?t>=e+n:t<=-n}const Ea=t=>{const e=({delta:n})=>t(n);return{start:()=>R.update(e,!0),stop:()=>J.update(e)}};function Yt({duration:t,driver:e=Ea,elapsed:n=0,repeat:s=0,repeatType:i="loop",repeatDelay:r=0,keyframes:o,autoplay:a=!0,onPlay:c,onStop:l,onComplete:u,onRepeat:f,onUpdate:h,type:d="keyframes",...p}){const g=n;let T,b=0,x=t,y=!1,v=!0,S;const w=Ma[o.length>2?"keyframes":d]||Ee,D=o[0],N=o[o.length-1];let B={done:!1,value:D};const{needsInterpolation:O}=w;O&&O(D,N)&&(S=hi([0,100],[D,N],{clamp:!1}),o=[0,100]);const K=w({...p,duration:t,keyframes:o});function Ft(){b++,i==="reverse"?(v=b%2===0,n=Da(n,x,r,v)):(n=vi(n,x,r),i==="mirror"&&K.flipTarget()),y=!1,f&&f()}function ae(){T&&T.stop(),u&&u()}function Z(L){v||(L=-L),n+=L,y||(B=K.next(Math.max(0,n)),S&&(B.value=S(B.value)),y=v?B.done:n<=0),h&&h(B.value),y&&(b===0&&(x=x!==void 0?x:n),b{l&&l(),T&&T.stop()},set currentTime(L){n=g,Z(L)},sample:L=>{n=g;const at=t&&typeof t=="number"?Math.max(t*.5,50):50;let ce=0;for(Z(0);ce<=L;){const Xi=L-ce;Z(Math.min(Xi,at)),ce+=at}return B}}}function La(t){return!t||Array.isArray(t)||typeof t=="string"&&xi[t]}const gt=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,xi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gt([0,.65,.55,1]),circOut:gt([.55,0,1,.45]),backIn:gt([.31,.01,.66,-.59]),backOut:gt([.33,1.53,.69,.99])};function ka(t){if(t)return Array.isArray(t)?gt(t):xi[t]}function ja(t,e,n,{delay:s=0,duration:i,repeat:r=0,repeatType:o="loop",ease:a,times:c}={}){return t.animate({[e]:n,offset:c},{delay:s,duration:i,easing:ka(a),fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal"})}const Ln={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},ge={},bi={};for(const t in Ln)bi[t]=()=>(ge[t]===void 0&&(ge[t]=Ln[t]()),ge[t]);function Ba(t,{repeat:e,repeatType:n="loop"}){const s=e&&n!=="loop"&&e%2===1?0:t.length-1;return t[s]}const Fa=new Set(["opacity","clipPath","filter","transform"]),Ot=10;function Ia(t,e,{onUpdate:n,onComplete:s,...i}){if(!(bi.waapi()&&Fa.has(e)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0))return!1;let{keyframes:o,duration:a=300,elapsed:c=0,ease:l}=i;if(i.type==="spring"||!La(i.ease)){if(i.repeat===1/0)return;const f=Yt({...i,elapsed:0});let h={done:!1,value:o[0]};const d=[];let p=0;for(;!h.done&&p<2e4;)h=f.sample(p),d.push(h.value),p+=Ot;o=d,a=p-Ot,l="linear"}const u=ja(t.owner.current,e,o,{...i,delay:-c,duration:a,ease:l});return u.onfinish=()=>{t.set(Ba(o,i)),R.update(()=>u.cancel()),s&&s()},{get currentTime(){return u.currentTime||0},set currentTime(f){u.currentTime=f},stop:()=>{const{currentTime:f}=u;if(f){const h=Yt({...i,autoplay:!1});t.setWithVelocity(h.sample(f-Ot).value,h.sample(f).value,Ot)}R.update(()=>u.cancel())}}}function Pi(t,e){const n=performance.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(J.read(s),t(r-e))};return R.read(s,!0),()=>J.read(s)}function Oa({keyframes:t,elapsed:e,onUpdate:n,onComplete:s}){const i=()=>{n&&n(t[t.length-1]),s&&s()};return e?{stop:Pi(i,-e)}:i()}function Na({keyframes:t,velocity:e=0,min:n,max:s,power:i=.8,timeConstant:r=750,bounceStiffness:o=500,bounceDamping:a=10,restDelta:c=1,modifyTarget:l,driver:u,onUpdate:f,onComplete:h,onStop:d}){const p=t[0];let g;function T(v){return n!==void 0&&vs}function b(v){return n===void 0?s:s===void 0||Math.abs(n-v){f&&f(S),v.onUpdate&&v.onUpdate(S)},onComplete:h,onStop:d})}function y(v){x({type:"spring",stiffness:o,damping:a,restDelta:c,...v})}if(T(p))y({velocity:e,keyframes:[p,b(p)]});else{let v=i*e+p;typeof l<"u"&&(v=l(v));const S=b(v),w=S===n?-1:1;let D,N;const B=O=>{D=N,N=O,e=on(O-D,H.delta),(w===1&&O>S||w===-1&&Og&&g.stop()}}const Ua={type:"spring",stiffness:500,damping:25,restSpeed:10},_a=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),za={type:"keyframes",duration:.8},$a={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Wa=(t,{keyframes:e})=>e.length>2?za:ot.has(t)?t.startsWith("scale")?_a(e[1]):Ua:$a,ke=(t,e)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&Q.test(e)&&!e.startsWith("url("));function Ha({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length}function kn(t){return t===0||typeof t=="string"&&parseFloat(t)===0&&t.indexOf(" ")===-1}function jn(t){return typeof t=="number"?0:cn("",t)}function Ti(t,e){return t[e]||t.default||t}function Ga(t,e,n,s){const i=ke(e,n);let r=s.from!==void 0?s.from:t.get();return r==="none"&&i&&typeof n=="string"?r=cn(e,n):kn(r)&&typeof n=="string"?r=jn(n):!Array.isArray(n)&&kn(n)&&typeof r=="string"&&(n=jn(r)),Array.isArray(n)?(n[0]===null&&(n[0]=r),n):[r,n]}const mn=(t,e,n,s={})=>i=>{const r=Ti(s,t)||{},o=r.delay||s.delay||0;let{elapsed:a=0}=s;a=a-_t(o);const c=Ga(e,t,n,r),l=c[0],u=c[c.length-1],f=ke(t,l),h=ke(t,u);let d={keyframes:c,velocity:e.getVelocity(),...r,elapsed:a,onUpdate:p=>{e.set(p),r.onUpdate&&r.onUpdate(p)},onComplete:()=>{i(),r.onComplete&&r.onComplete()}};if(!f||!h||Yr.current||r.type===!1)return Oa(d);if(r.type==="inertia")return Na(d);if(Ha(r)||(d={...d,...Wa(t,d)}),d.duration&&(d.duration=_t(d.duration)),d.repeatDelay&&(d.repeatDelay=_t(d.repeatDelay)),e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const p=Ia(e,t,d);if(p)return p}return Yt(d)};function Ka(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>je(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=je(t,e,n);else{const i=typeof e=="function"?re(t,e,n.custom):e;s=Ci(t,i,n)}return s.then(()=>t.notify("AnimationComplete",e))}function je(t,e,n={}){const s=re(t,e,n.custom);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Ci(t,s,n):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:f}=i;return Za(t,e,l+c,u,f,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[c,l]=a==="beforeChildren"?[r,o]:[o,r];return c().then(l)}else return Promise.all([r(),o(n.delay)])}function Ci(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:o,...a}=t.makeTargetAnimatable(e);const c=t.getValue("willChange");s&&(r=s);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const f in a){const h=t.getValue(f),d=a[f];if(!h||d===void 0||u&&Ya(u,f))continue;const p={delay:n,elapsed:0,...r};if(window.HandoffAppearAnimations&&!h.hasAnimated){const T=t.getProps()[Zr];T&&(p.elapsed=window.HandoffAppearAnimations(T,f,h,R))}let g=h.start(mn(f,h,d,t.shouldReduceMotion&&ot.has(f)?{type:!1}:p));Zt(c)&&(c.add(f),g=g.then(()=>c.remove(f))),l.push(g)}return Promise.all(l).then(()=>{o&&$r(t,o)})}function Za(t,e,n=0,s=0,i=1,r){const o=[],a=(t.variantChildren.size-1)*s,c=i===1?(l=0)=>l*s:(l=0)=>a-l*s;return Array.from(t.variantChildren).sort(qa).forEach((l,u)=>{l.notify("AnimationStart",e),o.push(je(l,e,{...r,delay:n+c(u)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function qa(t,e){return t.sortNodePosition(e)}function Ya({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}const Xa=[...$e].reverse(),Ja=$e.length;function Qa(t){return e=>Promise.all(e.map(({animation:n,options:s})=>Ka(t,n,s)))}function tc(t){let e=Qa(t);const n=nc();let s=!0;const i=(c,l)=>{const u=re(t,l);if(u){const{transition:f,transitionEnd:h,...d}=u;c={...c,...d,...h}}return c};function r(c){e=c(t)}function o(c,l){const u=t.getProps(),f=t.getVariantContext(!0)||{},h=[],d=new Set;let p={},g=1/0;for(let b=0;bg&&S;const O=Array.isArray(v)?v:[v];let K=O.reduce(i,{});w===!1&&(K={});const{prevResolvedValues:Ft={}}=y,ae={...Ft,...K},Z=M=>{B=!0,d.delete(M),y.needsAnimating[M]=!0};for(const M in ae){const L=K[M],at=Ft[M];p.hasOwnProperty(M)||(L!==at?Gt(L)&&Gt(at)?!Xs(L,at)||N?Z(M):y.protectedKeys[M]=!0:L!==void 0?Z(M):d.add(M):L!==void 0&&d.has(M)?Z(M):y.protectedKeys[M]=!0)}y.prevProp=v,y.prevResolvedValues=K,y.isActive&&(p={...p,...K}),s&&t.blockInitialAnimation&&(B=!1),B&&!D&&h.push(...O.map(M=>({animation:M,options:{type:x,...c}})))}if(d.size){const b={};d.forEach(x=>{const y=t.getBaseTarget(x);y!==void 0&&(b[x]=y)}),h.push({animation:b})}let T=Boolean(h.length);return s&&u.initial===!1&&!t.manuallyAnimateOnMount&&(T=!1),s=!1,T?e(h):Promise.resolve()}function a(c,l,u){var f;if(n[c].isActive===l)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(d=>{var p;return(p=d.animationState)===null||p===void 0?void 0:p.setActive(c,l)}),n[c].isActive=l;const h=o(u,c);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:r,getState:()=>n}}function ec(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Xs(e,t):!1}function et(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nc(){return{animate:et(!0),whileInView:et(),whileHover:et(),whileTap:et(),whileDrag:et(),whileFocus:et(),exit:et()}}class sc extends tt{constructor(e){super(e),e.animationState||(e.animationState=tc(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),ee(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let ic=0;class oc extends tt{constructor(){super(...arguments),this.id=ic++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n,custom:s}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e,{custom:s??this.node.getProps().custom});n&&!e&&r.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const rc={animation:{Feature:sc},exit:{Feature:oc}},Bn=(t,e)=>Math.abs(t-e);function ac(t,e){const n=Bn(t.x,e.x),s=Bn(t.y,e.y);return Math.sqrt(n**2+s**2)}class Si{constructor(e,n,{transformPagePoint:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const l=ve(this.lastMoveEventInfo,this.history),u=this.startEvent!==null,f=ac(l.offset,{x:0,y:0})>=3;if(!u&&!f)return;const{point:h}=l,{timestamp:d}=H;this.history.push({...h,timestamp:d});const{onStart:p,onMove:g}=this.handlers;u||(p&&p(this.lastMoveEvent,l),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,l)},this.handlePointerMove=(l,u)=>{this.lastMoveEvent=l,this.lastMoveEventInfo=ye(u,this.transformPagePoint),R.update(this.updatePoint,!0)},this.handlePointerUp=(l,u)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:f,onSessionEnd:h}=this.handlers,d=ve(l.type==="pointercancel"?this.lastMoveEventInfo:ye(u,this.transformPagePoint),this.history);this.startEvent&&f&&f(l,d),h&&h(l,d)},!Gs(e))return;this.handlers=n,this.transformPagePoint=s;const i=ie(e),r=ye(i,this.transformPagePoint),{point:o}=r,{timestamp:a}=H;this.history=[{...o,timestamp:a}];const{onSessionStart:c}=n;c&&c(e,ve(r,this.history)),this.removeListeners=X(W(window,"pointermove",this.handlePointerMove),W(window,"pointerup",this.handlePointerUp),W(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),J.update(this.updatePoint)}}function ye(t,e){return e?{point:e(t.point)}:t}function Fn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ve({point:t},e){return{point:t,delta:Fn(t,Ai(e)),offset:Fn(t,cc(e)),velocity:lc(e,.1)}}function cc(t){return t[0]}function Ai(t){return t[t.length-1]}function lc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=Ai(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>_t(e)));)n--;if(!s)return{x:0,y:0};const r=(i.timestamp-s.timestamp)/1e3;if(r===0)return{x:0,y:0};const o={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function j(t){return t.max-t.min}function Be(t,e=0,n=.01){return Math.abs(t-e)<=n}function In(t,e,n,s=.5){t.origin=s,t.originPoint=A(e.min,e.max,t.origin),t.scale=j(n)/j(e),(Be(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=A(n.min,n.max,t.origin)-t.originPoint,(Be(t.translate)||isNaN(t.translate))&&(t.translate=0)}function bt(t,e,n,s){In(t.x,e.x,n.x,s?s.originX:void 0),In(t.y,e.y,n.y,s?s.originY:void 0)}function On(t,e,n){t.min=n.min+e.min,t.max=t.min+j(e)}function uc(t,e,n){On(t.x,e.x,n.x),On(t.y,e.y,n.y)}function Nn(t,e,n){t.min=e.min-n.min,t.max=t.min+j(e)}function Pt(t,e,n){Nn(t.x,e.x,n.x),Nn(t.y,e.y,n.y)}function fc(t,{min:e,max:n},s){return e!==void 0&&tn&&(t=s?A(n,t,s.max):Math.min(t,n)),t}function Un(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function hc(t,{top:e,left:n,bottom:s,right:i}){return{x:Un(t.x,n,i),y:Un(t.y,e,s)}}function _n(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.mins?n=wt(e.min,e.max-s,t.min):s>i&&(n=wt(t.min,t.max-i,e.min)),ht(0,1,n)}function mc(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Fe=.35;function gc(t=Fe){return t===!1?t=0:t===!0&&(t=Fe),{x:zn(t,"left","right"),y:zn(t,"top","bottom")}}function zn(t,e,n){return{min:$n(t,e),max:$n(t,n)}}function $n(t,e){return typeof t=="number"?t:t[e]||0}const Wn=()=>({translate:0,scale:1,origin:0,originPoint:0}),Tt=()=>({x:Wn(),y:Wn()}),Hn=()=>({min:0,max:0}),V=()=>({x:Hn(),y:Hn()});function U(t){return[t("x"),t("y")]}function Vi({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function yc({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function vc(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function xe(t){return t===void 0||t===1}function Ie({scale:t,scaleX:e,scaleY:n}){return!xe(t)||!xe(e)||!xe(n)}function nt(t){return Ie(t)||wi(t)||t.z||t.rotate||t.rotateX||t.rotateY}function wi(t){return Gn(t.x)||Gn(t.y)}function Gn(t){return t&&t!=="0%"}function Xt(t,e,n){const s=t-n,i=e*s;return n+i}function Kn(t,e,n,s,i){return i!==void 0&&(t=Xt(t,i,s)),Xt(t,n,s)+e}function Oe(t,e=0,n=1,s,i){t.min=Kn(t.min,e,n,s,i),t.max=Kn(t.max,e,n,s,i)}function Mi(t,{x:e,y:n}){Oe(t.x,e.translate,e.scale,e.originPoint),Oe(t.y,n.translate,n.scale,n.originPoint)}function xc(t,e,n,s=!1){const i=n.length;if(!i)return;e.x=e.y=1;let r,o;for(let a=0;a1.0000000000001||t<.999999999999?t:1}function Y(t,e){t.min=t.min+e,t.max=t.max+e}function qn(t,e,[n,s,i]){const r=e[i]!==void 0?e[i]:.5,o=A(t.min,t.max,r);Oe(t,e[n],e[s],o,e.scale)}const bc=["x","scaleX","originX"],Pc=["y","scaleY","originY"];function ft(t,e){qn(t.x,e,bc),qn(t.y,e,Pc)}function Di(t,e){return Vi(vc(t.getBoundingClientRect(),e))}function Tc(t,e,n){const s=Di(t,n),{scroll:i}=e;return i&&(Y(s.x,i.offset.x),Y(s.y,i.offset.y)),s}const Cc=new WeakMap;class Sc{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=V(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=c=>{this.stopAnimation(),n&&this.snapToCursor(ie(c,"page").point)},r=(c,l)=>{const{drag:u,dragPropagation:f,onDragStart:h}=this.getProps();if(u&&!f&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Zs(u),!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),U(p=>{let g=this.getAxisMotionValue(p).get()||0;if(z.test(g)){const{projection:T}=this.visualElement;if(T&&T.layout){const b=T.layout.layoutBox[p];b&&(g=j(b)*(parseFloat(g)/100))}}this.originPoint[p]=g}),h&&h(c,l);const{animationState:d}=this.visualElement;d&&d.setActive("whileDrag",!0)},o=(c,l)=>{const{dragPropagation:u,dragDirectionLock:f,onDirectionLock:h,onDrag:d}=this.getProps();if(!u&&!this.openGlobalLock)return;const{offset:p}=l;if(f&&this.currentDirection===null){this.currentDirection=Ac(p),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",l.point,p),this.updateAxis("y",l.point,p),this.visualElement.render(),d&&d(c,l)},a=(c,l)=>this.stop(c,l);this.panSession=new Si(e,{onSessionStart:i,onStart:r,onMove:o,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(e,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&r(e,n)}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,s){const{drag:i}=this.getProps();if(!s||!Nt(e,i,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=fc(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),{layout:s}=this.visualElement.projection||{},i=this.constraints;e&<(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=hc(s.layoutBox,e):this.constraints=!1,this.elastic=gc(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&U(r=>{this.getAxisMotionValue(r)&&(this.constraints[r]=mc(s.layoutBox[r],this.constraints[r]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!lt(e))return!1;const s=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=Tc(s,i.root,this.visualElement.getTransformPagePoint());let o=dc(i.layout.layoutBox,r);if(n){const a=n(yc(o));this.hasMutatedConstraints=!!a,a&&(o=Vi(a))}return o}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=U(u=>{if(!Nt(u,n,this.currentDirection))return;let f=c&&c[u]||{};o&&(f={min:0,max:0});const h=i?200:1e6,d=i?40:1e7,p={type:"inertia",velocity:s?e[u]:0,bounceStiffness:h,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return s.start(mn(e,s,0,n))}stopAnimation(){U(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n="_drag"+e.toUpperCase(),s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){U(n=>{const{drag:s}=this.getProps();if(!Nt(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];r.set(e[n]-A(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!lt(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};U(o=>{const a=this.getAxisMotionValue(o);if(a){const c=a.get();i[o]=pc({min:c,max:c},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),U(o=>{if(!Nt(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(A(c,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;Cc.set(this.visualElement,this);const e=this.visualElement.current,n=W(e,"pointerdown",c=>{const{drag:l,dragListener:u=!0}=this.getProps();l&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();lt(c)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),s();const o=$(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(U(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{o(),n(),r(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:o=Fe,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function Nt(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Ac(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Vc extends tt{constructor(e){super(e),this.removeGroupControls=I,this.removeListeners=I,this.controls=new Sc(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||I}unmount(){this.removeGroupControls(),this.removeListeners()}}class wc extends tt{constructor(){super(...arguments),this.removePointerDownListener=I}onPointerDown(e){this.session=new Si(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:e,onStart:n,onMove:s,onEnd:(r,o)=>{delete this.session,i&&i(r,o)}}}mount(){this.removePointerDownListener=W(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Mc(){const t=m.useContext(Et);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:s}=t,i=m.useId();return m.useEffect(()=>s(i),[]),!e&&n?[!1,()=>n&&n(i)]:[!0]}function Dc(){return Rc(m.useContext(Et))}function Rc(t){return t===null?!0:t.isPresent}function Yn(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const mt={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(P.test(t))t=parseFloat(t);else return t;const n=Yn(t,e.target.x),s=Yn(t,e.target.y);return`${n}% ${s}%`}},Ri=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Ec(t){const e=Ri.exec(t);if(!e)return[,];const[,n,s]=e;return[n,s]}function Ne(t,e,n=1){const[s,i]=Ec(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);return r?r.trim():Se(i)?Ne(i,e,n+1):i}function Lc(t,{...e},n){const s=t.current;if(!(s instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(i=>{const r=i.get();if(!Se(r))return;const o=Ne(r,s);o&&i.set(o)});for(const i in e){const r=e[i];if(!Se(r))continue;const o=Ne(r,s);o&&(e[i]=o,n&&n[i]===void 0&&(n[i]=r))}return{target:e,transitionEnd:n}}const Xn="_$css",kc={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=t.includes("var("),r=[];i&&(t=t.replace(Ri,d=>(r.push(d),Xn)));const o=Q.parse(t);if(o.length>5)return s;const a=Q.createTransformer(t),c=typeof o[0]!="number"?1:0,l=n.x.scale*e.x,u=n.y.scale*e.y;o[0+c]/=l,o[1+c]/=u;const f=A(l,u,.5);typeof o[2+c]=="number"&&(o[2+c]/=f),typeof o[3+c]=="number"&&(o[3+c]/=f);let h=a(o);if(i){let d=0;h=h.replace(Xn,()=>{const p=r[d];return d++,p})}return h}};class jc extends Ss.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;ko(Bc),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),yt.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,o=s.projection;return o&&(o.isPresent=r,i||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||R.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),!e.currentAnimation&&e.isLead()&&this.safeToRemove())}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Ei(t){const[e,n]=Mc(),s=m.useContext(Ge);return Ss.createElement(jc,{...t,layoutGroup:s,switchLayoutGroup:m.useContext(ks),isPresent:e,safeToRemove:n})}const Bc={borderRadius:{...mt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mt,borderTopRightRadius:mt,borderBottomLeftRadius:mt,borderBottomRightRadius:mt,boxShadow:kc};function Fc(t,e,n={}){const s=k(t)?t:dt(t);return s.start(mn("",s,e,n)),{stop:()=>s.stop(),isAnimating:()=>s.isAnimating()}}const Li=["TopLeft","TopRight","BottomLeft","BottomRight"],Ic=Li.length,Jn=t=>typeof t=="string"?parseFloat(t):t,Qn=t=>typeof t=="number"||P.test(t);function Oc(t,e,n,s,i,r){i?(t.opacity=A(0,n.opacity!==void 0?n.opacity:1,Nc(s)),t.opacityExit=A(e.opacity!==void 0?e.opacity:1,0,Uc(s))):r&&(t.opacity=A(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let o=0;ose?1:n(wt(t,e,s))}function es(t,e){t.min=e.min,t.max=e.max}function F(t,e){es(t.x,e.x),es(t.y,e.y)}function ns(t,e,n,s,i){return t-=e,t=Xt(t,1/n,s),i!==void 0&&(t=Xt(t,1/i,s)),t}function _c(t,e=0,n=1,s=.5,i,r=t,o=t){if(z.test(e)&&(e=parseFloat(e),e=A(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=A(r.min,r.max,s);t===r&&(a-=e),t.min=ns(t.min,e,n,a,i),t.max=ns(t.max,e,n,a,i)}function ss(t,e,[n,s,i],r,o){_c(t,e[n],e[s],e[i],e.scale,r,o)}const zc=["x","scaleX","originX"],$c=["y","scaleY","originY"];function is(t,e,n,s){ss(t.x,e,zc,n?n.x:void 0,s?s.x:void 0),ss(t.y,e,$c,n?n.y:void 0,s?s.y:void 0)}function os(t){return t.translate===0&&t.scale===1}function ji(t){return os(t.x)&&os(t.y)}function Ue(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function rs(t){return j(t.x)/j(t.y)}class Wc{constructor(){this.members=[]}add(e){en(this.members,e),e.scheduleRender()}remove(e){if(nn(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function as(t,e,n){let s="";const i=t.x.translate/e.x,r=t.y.translate/e.y;if((i||r)&&(s=`translate3d(${i}px, ${r}px, 0) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{rotate:c,rotateX:l,rotateY:u}=n;c&&(s+=`rotate(${c}deg) `),l&&(s+=`rotateX(${l}deg) `),u&&(s+=`rotateY(${u}deg) `)}const o=t.x.scale*e.x,a=t.y.scale*e.y;return(o!==1||a!==1)&&(s+=`scale(${o}, ${a})`),s||"none"}const Hc=(t,e)=>t.depth-e.depth;class Gc{constructor(){this.children=[],this.isDirty=!1}add(e){en(this.children,e),this.isDirty=!0}remove(e){nn(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Hc),this.isDirty=!1,this.children.forEach(e)}}function Kc(t){window.MotionDebug&&window.MotionDebug.record(t)}const cs=["","X","Y","Z"],ls=1e3;let Zc=0;const st={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function Bi({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o,a={},c=e==null?void 0:e()){this.id=Zc++,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.potentialNodes=new Map,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{st.totalNodes=st.resolvedTargetDeltas=st.recalculatedProjection=0,this.nodes.forEach(Xc),this.nodes.forEach(el),this.nodes.forEach(nl),this.nodes.forEach(Jc),Kc(st)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.elementId=o,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0,o&&this.root.registerPotentialNode(o,this);for(let l=0;lthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=Pi(h,250),yt.hasAnimatedSinceResize&&(yt.hasAnimatedSinceResize=!1,this.nodes.forEach(fs))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||l)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:d,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||al,{onLayoutAnimationStart:T,onLayoutAnimationComplete:b}=u.getProps(),x=!this.targetLayout||!Ue(this.targetLayout,p)||d,y=!h&&d;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,y);const v={...Ti(g,"layout"),onPlay:T,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v)}else!h&&this.animationProgress===0&&fs(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,J.preRender(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(sl),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(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 u=0;u{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 c=0;c{const S=v/1e3;hs(f.x,o.x,S),hs(f.y,o.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Pt(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ol(this.relativeTarget,this.relativeTargetOrigin,h,S),y&&Ue(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=V()),F(y,this.relativeTarget)),g&&(this.animationValues=u,Oc(u,l,this.latestValues,S,x,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(J.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=R.update(()=>{yt.hasAnimatedSinceResize=!0,this.currentAnimation=Fc(0,ls,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.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 o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ls),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:u}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&Fi(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||V();const f=j(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=j(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}F(a,c),ft(a,u),bt(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Wc),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.rotate||c.rotateX||c.rotateY||c.rotateZ)&&(a=!0),!a)return;const l={};for(let u=0;u{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(us),this.root.sharedNodes.clear()}}}function qc(t){t.updateLayout()}function Yc(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=t.layout,{animationType:r}=t.options,o=n.source!==t.layout.source;r==="size"?U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=j(h);h.min=s[f].min,h.max=h.min+d}):Fi(r,n.layoutBox,s)&&U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=j(s[f]);h.max=h.min+d});const a=Tt();bt(a,s,n.layoutBox);const c=Tt();o?bt(c,t.applyTransform(i,!0),n.measuredBox):bt(c,s,n.layoutBox);const l=!ji(a);let u=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:d}=f;if(h&&d){const p=V();Pt(p,n.layoutBox,h.layoutBox);const g=V();Pt(g,s,d.layoutBox),Ue(p,g)||(u=!0),f.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:u})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function Xc(t){st.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jc(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Qc(t){t.clearSnapshot()}function us(t){t.clearMeasurements()}function tl(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fs(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0}function el(t){t.resolveTargetDelta()}function nl(t){t.calcProjection()}function sl(t){t.resetRotation()}function il(t){t.removeLeadSnapshot()}function hs(t,e,n){t.translate=A(e.translate,0,n),t.scale=A(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function ds(t,e,n,s){t.min=A(e.min,n.min,s),t.max=A(e.max,n.max,s)}function ol(t,e,n,s){ds(t.x,e.x,n.x,s),ds(t.y,e.y,n.y,s)}function rl(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const al={duration:.45,ease:[.4,0,.1,1]};function cl(t,e){let n=t.root;for(let r=t.path.length-1;r>=0;r--)if(Boolean(t.path[r].instance)){n=t.path[r];break}const i=(n&&n!==t.root?n.instance:document).querySelector(`[data-projection-id="${e}"]`);i&&t.mount(i,!0)}function ps(t){t.min=Math.round(t.min),t.max=Math.round(t.max)}function ll(t){ps(t.x),ps(t.y)}function Fi(t,e,n){return t==="position"||t==="preserve-aspect"&&!Be(rs(e),rs(n),.2)}const ul=Bi({attachResizeListener:(t,e)=>$(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),be={current:void 0},Ii=Bi({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!be.current){const t=new ul(0,{});t.mount(window),t.setOptions({layoutScroll:!0}),be.current=t}return be.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>Boolean(window.getComputedStyle(t).position==="fixed")}),fl={pan:{Feature:wc},drag:{Feature:Vc,ProjectionNode:Ii,MeasureLayout:Ei}},hl=new Set(["width","height","top","left","right","bottom","x","y"]),Oi=t=>hl.has(t),dl=t=>Object.keys(t).some(Oi),ms=t=>t===rt||t===P,gs=(t,e)=>parseFloat(t.split(", ")[e]),ys=(t,e)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/);if(i)return gs(i[1],e);{const r=s.match(/^matrix\((.+)\)$/);return r?gs(r[1],t):0}},pl=new Set(["x","y","z"]),ml=se.filter(t=>!pl.has(t));function gl(t){const e=[];return ml.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}const vs={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:ys(4,13),y:ys(5,14)},yl=(t,e,n)=>{const s=e.measureViewportBox(),i=e.current,r=getComputedStyle(i),{display:o}=r,a={};o==="none"&&e.setStaticValue("display",t.display||"block"),n.forEach(l=>{a[l]=vs[l](s,r)}),e.render();const c=e.measureViewportBox();return n.forEach(l=>{const u=e.getValue(l);u&&u.jump(a[l]),t[l]=vs[l](c,r)}),t},vl=(t,e,n={},s={})=>{e={...e},s={...s};const i=Object.keys(e).filter(Oi);let r=[],o=!1;const a=[];if(i.forEach(c=>{const l=t.getValue(c);if(!t.hasValue(c))return;let u=n[c],f=pt(u);const h=e[c];let d;if(Gt(h)){const p=h.length,g=h[0]===null?1:0;u=h[g],f=pt(u);for(let T=g;T=0?window.pageYOffset:null,l=yl(e,t,a);return r.length&&r.forEach(([u,f])=>{t.getValue(u).set(f)}),t.render(),te&&c!==null&&window.scrollTo({top:c}),{target:l,transitionEnd:s}}else return{target:e,transitionEnd:s}};function xl(t,e,n,s){return dl(e)?vl(t,e,n,s):{target:e,transitionEnd:s}}const bl=(t,e,n,s)=>{const i=Lc(t,e,s);return e=i.target,s=i.transitionEnd,xl(t,e,n,s)},_e={current:null},Ni={current:!1};function Pl(){if(Ni.current=!0,!!te)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_e.current=t.matches;t.addListener(e),e()}else _e.current=!1}function Tl(t,e,n){const{willChange:s}=e;for(const i in e){const r=e[i],o=n[i];if(k(r))t.addValue(i,r),Zt(s)&&s.add(i);else if(k(o))t.addValue(i,dt(r,{owner:t})),Zt(s)&&s.remove(i);else if(o!==r)if(t.hasValue(i)){const a=t.getValue(i);!a.hasAnimated&&a.set(r)}else{const a=t.getStaticValue(i);t.addValue(i,dt(a!==void 0?a:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const Ui=Object.keys(St),Cl=Ui.length,xs=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Sl=We.length;class Al{constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:i,visualState:r},o={}){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=()=>R.render(this.render,!1,!0);const{latestValues:a,renderState:c}=r;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=c,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.isControllingVariants=ne(n),this.isVariantNode=Ls(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(n,{});for(const f in u){const h=u[f];a[f]!==void 0&&k(h)&&(h.set(a[f],!1),Zt(l)&&l.add(f))}}scrapeMotionValuesFromProps(e,n){return{}}mount(e){this.current=e,this.projection&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Ni.current||Pl(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_e.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),J.update(this.notifyUpdate),J.render(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,n){const s=ot.has(e),i=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&R.update(this.notifyUpdate,!1,!0),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),r()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...n},s,i,r,o){let a,c;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:d,layoutRoot:p})}return c}updateFeatures(){for(const e in this.features){const n=this.features[e];n.isMounted?n.update(this.props,this.prevProps):(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):V()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}makeTargetAnimatable(e,n=!0){return this.makeTargetAnimatableFromInstance(e,this.props,n)}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;sn.variantChildren.delete(e)}addValue(e,n){n!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,n)),this.values.set(e,n),this.latestValues[e]=n.get()}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=dt(n,{owner:this}),this.addValue(e,s)),s}readValue(e){return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:s}=this.props,i=typeof s=="string"||typeof s=="object"?(n=tn(this.props,s))===null||n===void 0?void 0:n[e]:void 0;if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!k(r)?r:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new sn),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class _i extends Al{sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:n,...s},{transformValues:i},r){let o=Gr(s,e||{},this);if(i&&(n&&(n=i(n)),s&&(s=i(s)),o&&(o=i(o))),r){Wr(this,s,o);const a=bl(this,s,o,n);n=a.transitionEnd,s=a.target}return{transition:e,transitionEnd:n,...s}}}function Vl(t){return window.getComputedStyle(t)}class wl extends _i{readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}else{const s=Vl(e),i=(Fs(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Di(e,n)}build(e,n,s,i){Ze(e,n,s,i.transformTemplate)}scrapeMotionValuesFromProps(e,n){return Qe(e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;k(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,s,i){_s(e,n,s,i)}}class Ml extends _i{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}return n=zs.has(n)?n:Je(n),e.getAttribute(n)}measureInstanceViewportBox(){return V()}scrapeMotionValuesFromProps(e,n){return Ws(e,n)}build(e,n,s,i){Ye(e,n,s,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,s,i){$s(e,n,s,i)}mount(e){this.isSVGTag=Xe(e.tagName),super.mount(e)}}const Dl=(t,e)=>Ke(t)?new Ml(e,{enableHardwareAcceleration:!1}):new wl(e,{enableHardwareAcceleration:!0}),Rl={layout:{ProjectionNode:Ii,MeasureLayout:Ei}},El={...rc,...vr,...fl,...Rl},Ll=Eo((t,e)=>or(t,e,El,Dl));function zi(){const t=m.useRef(!1);return $t(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function kl(){const t=zi(),[e,n]=m.useState(0),s=m.useCallback(()=>{t.current&&n(e+1)},[e]);return[m.useCallback(()=>R.postRender(s),[s]),e]}class jl extends m.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Bl({children:t,isPresent:e}){const n=m.useId(),s=m.useRef(null),i=m.useRef({width:0,height:0,top:0,left:0});return m.useInsertionEffect(()=>{const{width:r,height:o,top:a,left:c}=i.current;if(e||!s.current||!r||!o)return;s.current.dataset.motionPopId=n;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(` +import{cY as zt,cZ as Ji,r as m,j as C,a5 as Cs,R as Ss,c as G,t as Te,f as Mt,a as Dt,e as As,S as Qi,o as Vs,d as to,c_ as eo}from"./index-c5a5b67c.js";function ws(t=zt){const e=t===zt?Ji:()=>m.useContext(t);return function(){const{store:s}=e();return s}}const no=ws();function so(t=zt){const e=t===zt?no:ws(t);return function(){return e().dispatch}}const io=so();function oo(t,e){return`${t} returned \`undefined\`. Seems you forgot to wrap component within ${e}`}function Rt(t={}){const{name:e,strict:n=!0,hookName:s="useContext",providerName:i="Provider",errorMessage:r}=t,o=m.createContext(void 0);o.displayName=e;function a(){var c;const l=m.useContext(o);if(!l&&n){const u=new Error(r??oo(s,i));throw u.name="ContextError",(c=Error.captureStackTrace)==null||c.call(Error,u,a),u}return l}return[o.Provider,a,o]}var[ro,ao]=Rt({strict:!1,name:"PortalManagerContext"});function co(t){const{children:e,zIndex:n}=t;return C.jsx(ro,{value:{zIndex:n},children:e})}co.displayName="PortalManager";var Ce=Boolean(globalThis==null?void 0:globalThis.document)?m.useLayoutEffect:m.useEffect,[Ms,lo]=Rt({strict:!1,name:"PortalContext"}),ze="chakra-portal",uo=".chakra-portal",fo=t=>C.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:t.zIndex,top:0,left:0,right:0},children:t.children}),ho=t=>{const{appendToParentPortal:e,children:n}=t,[s,i]=m.useState(null),r=m.useRef(null),[,o]=m.useState({});m.useEffect(()=>o({}),[]);const a=lo(),c=ao();Ce(()=>{if(!s)return;const u=s.ownerDocument,f=e?a??u.body:u.body;if(!f)return;r.current=u.createElement("div"),r.current.className=ze,f.appendChild(r.current),o({});const h=r.current;return()=>{f.contains(h)&&f.removeChild(h)}},[s]);const l=c!=null&&c.zIndex?C.jsx(fo,{zIndex:c==null?void 0:c.zIndex,children:n}):n;return r.current?Cs.createPortal(C.jsx(Ms,{value:r.current,children:l}),r.current):C.jsx("span",{ref:u=>{u&&i(u)}})},po=t=>{const{children:e,containerRef:n,appendToParentPortal:s}=t,i=n.current,r=i??(typeof window<"u"?document.body:void 0),o=m.useMemo(()=>{const c=i==null?void 0:i.ownerDocument.createElement("div");return c&&(c.className=ze),c},[i]),[,a]=m.useState({});return Ce(()=>a({}),[]),Ce(()=>{if(!(!o||!r))return r.appendChild(o),()=>{r.removeChild(o)}},[o,r]),r&&o?Cs.createPortal(C.jsx(Ms,{value:s?o:null,children:e}),o):null};function Jt(t){const e={appendToParentPortal:!0,...t},{containerRef:n,...s}=e;return n?C.jsx(po,{containerRef:n,...s}):C.jsx(ho,{...s})}Jt.className=ze;Jt.selector=uo;Jt.displayName="Portal";var mo=(t,e)=>t.find(n=>n.id===e);function yn(t,e){const n=Ds(t,e),s=n?t[n].findIndex(i=>i.id===e):-1;return{position:n,index:s}}function Ds(t,e){for(const[n,s]of Object.entries(t))if(mo(s,e))return n}function go(t){const e=t.includes("right"),n=t.includes("left");let s="center";return e&&(s="flex-end"),n&&(s="flex-start"),{display:"flex",flexDirection:"column",alignItems:s}}function yo(t){const n=t==="top"||t==="bottom"?"0 auto":void 0,s=t.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=t.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,r=t.includes("left")?void 0:"env(safe-area-inset-right, 0px)",o=t.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:5500,pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:s,bottom:i,right:r,left:o}}function vo(t,e=[]){const n=m.useRef(t);return m.useEffect(()=>{n.current=t}),m.useCallback((...s)=>{var i;return(i=n.current)==null?void 0:i.call(n,...s)},e)}function xo(t,e){const n=vo(t);m.useEffect(()=>{if(e==null)return;let s=null;return s=window.setTimeout(()=>{n()},e),()=>{s&&window.clearTimeout(s)}},[e,n])}function vn(t,e){const n=m.useRef(!1),s=m.useRef(!1);m.useEffect(()=>{if(n.current&&s.current)return t();s.current=!0},e),m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const Rs=m.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),Qt=m.createContext({});function bo(){return m.useContext(Qt).visualElement}const Et=m.createContext(null),te=typeof document<"u",$t=te?m.useLayoutEffect:m.useEffect,Es=m.createContext({strict:!1});function Po(t,e,n,s){const i=bo(),r=m.useContext(Es),o=m.useContext(Et),a=m.useContext(Rs).reducedMotion,c=m.useRef();s=s||r.renderer,!c.current&&s&&(c.current=s(t,{visualState:e,parent:i,props:n,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const l=c.current;return m.useInsertionEffect(()=>{l&&l.update(n,o)}),$t(()=>{l&&l.render()}),m.useEffect(()=>{l&&l.updateFeatures()}),(window.HandoffAppearAnimations?$t:m.useEffect)(()=>{l&&l.animationState&&l.animationState.animateChanges()}),l}function lt(t){return typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function To(t,e,n){return m.useCallback(s=>{s&&t.mount&&t.mount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):lt(n)&&(n.current=s))},[e])}function Ct(t){return typeof t=="string"||Array.isArray(t)}function ee(t){return typeof t=="object"&&typeof t.start=="function"}const $e=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],We=["initial",...$e];function ne(t){return ee(t.animate)||We.some(e=>Ct(t[e]))}function Ls(t){return Boolean(ne(t)||t.variants)}function Co(t,e){if(ne(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Ct(n)?n:void 0,animate:Ct(s)?s:void 0}}return t.inherit!==!1?e:{}}function So(t){const{initial:e,animate:n}=Co(t,m.useContext(Qt));return m.useMemo(()=>({initial:e,animate:n}),[xn(e),xn(n)])}function xn(t){return Array.isArray(t)?t.join(" "):t}const bn={animation:["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"],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"]},St={};for(const t in bn)St[t]={isEnabled:e=>bn[t].some(n=>!!e[n])};function Ao(t){for(const e in t)St[e]={...St[e],...t[e]}}function He(t){const e=m.useRef(null);return e.current===null&&(e.current=t()),e.current}const yt={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let Vo=1;function wo(){return He(()=>{if(yt.hasEverUpdated)return Vo++})}const Ge=m.createContext({}),ks=m.createContext({}),Mo=Symbol.for("motionComponentSymbol");function Do({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:s,Component:i}){t&&Ao(t);function r(a,c){let l;const u={...m.useContext(Rs),...a,layoutId:Ro(a)},{isStatic:f}=u,h=So(a),d=f?void 0:wo(),p=s(a,f);if(!f&&te){h.visualElement=Po(i,p,u,e);const g=m.useContext(ks),T=m.useContext(Es).strict;h.visualElement&&(l=h.visualElement.loadFeatures(u,T,t,d,g))}return m.createElement(Qt.Provider,{value:h},l&&h.visualElement?m.createElement(l,{visualElement:h.visualElement,...u}):null,n(i,a,d,To(p,h.visualElement,c),p,f,h.visualElement))}const o=m.forwardRef(r);return o[Mo]=i,o}function Ro({layoutId:t}){const e=m.useContext(Ge).id;return e&&t!==void 0?e+"-"+t:t}function Eo(t){function e(s,i={}){return Do(t(s,i))}if(typeof Proxy>"u")return e;const n=new Map;return new Proxy(e,{get:(s,i)=>(n.has(i)||n.set(i,e(i)),n.get(i))})}const Lo=["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 Ke(t){return typeof t!="string"||t.includes("-")?!1:!!(Lo.indexOf(t)>-1||/[A-Z]/.test(t))}const Wt={};function ko(t){Object.assign(Wt,t)}const se=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ot=new Set(se);function js(t,{layout:e,layoutId:n}){return ot.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Wt[t]||t==="opacity")}const k=t=>Boolean(t&&t.getVelocity),jo={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Bo=se.length;function Fo(t,{enableHardwareAcceleration:e=!0,allowTransformNone:n=!0},s,i){let r="";for(let o=0;oe=>typeof e=="string"&&e.startsWith(t),Fs=Bs("--"),Se=Bs("var(--"),Io=(t,e)=>e&&typeof t=="number"?e.transform(t):t,ht=(t,e,n)=>Math.min(Math.max(n,t),e),rt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},vt={...rt,transform:t=>ht(0,1,t)},It={...rt,default:1},xt=t=>Math.round(t*1e5)/1e5,At=/(-)?([\d]*\.?[\d])+/g,Ae=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,Oo=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Lt(t){return typeof t=="string"}const kt=t=>({test:e=>Lt(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),q=kt("deg"),z=kt("%"),P=kt("px"),No=kt("vh"),Uo=kt("vw"),Pn={...z,parse:t=>z.parse(t)/100,transform:t=>z.transform(t*100)},Tn={...rt,transform:Math.round},Is={borderWidth:P,borderTopWidth:P,borderRightWidth:P,borderBottomWidth:P,borderLeftWidth:P,borderRadius:P,radius:P,borderTopLeftRadius:P,borderTopRightRadius:P,borderBottomRightRadius:P,borderBottomLeftRadius:P,width:P,maxWidth:P,height:P,maxHeight:P,size:P,top:P,right:P,bottom:P,left:P,padding:P,paddingTop:P,paddingRight:P,paddingBottom:P,paddingLeft:P,margin:P,marginTop:P,marginRight:P,marginBottom:P,marginLeft:P,rotate:q,rotateX:q,rotateY:q,rotateZ:q,scale:It,scaleX:It,scaleY:It,scaleZ:It,skew:q,skewX:q,skewY:q,distance:P,translateX:P,translateY:P,translateZ:P,x:P,y:P,z:P,perspective:P,transformPerspective:P,opacity:vt,originX:Pn,originY:Pn,originZ:P,zIndex:Tn,fillOpacity:vt,strokeOpacity:vt,numOctaves:Tn};function Ze(t,e,n,s){const{style:i,vars:r,transform:o,transformOrigin:a}=t;let c=!1,l=!1,u=!0;for(const f in e){const h=e[f];if(Fs(f)){r[f]=h;continue}const d=Is[f],p=Io(h,d);if(ot.has(f)){if(c=!0,o[f]=p,!u)continue;h!==(d.default||0)&&(u=!1)}else f.startsWith("origin")?(l=!0,a[f]=p):i[f]=p}if(e.transform||(c||s?i.transform=Fo(t.transform,n,u,s):i.transform&&(i.transform="none")),l){const{originX:f="50%",originY:h="50%",originZ:d=0}=a;i.transformOrigin=`${f} ${h} ${d}`}}const qe=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Os(t,e,n){for(const s in e)!k(e[s])&&!js(s,n)&&(t[s]=e[s])}function _o({transformTemplate:t},e,n){return m.useMemo(()=>{const s=qe();return Ze(s,e,{enableHardwareAcceleration:!n},t),Object.assign({},s.vars,s.style)},[e])}function zo(t,e,n){const s=t.style||{},i={};return Os(i,s,t),Object.assign(i,_o(t,e,n)),t.transformValues?t.transformValues(i):i}function $o(t,e,n){const s={},i=zo(t,e,n);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=i,s}const Wo=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 Ht(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||Wo.has(t)}let Ns=t=>!Ht(t);function Ho(t){t&&(Ns=e=>e.startsWith("on")?!Ht(e):t(e))}try{Ho(require("@emotion/is-prop-valid").default)}catch{}function Go(t,e,n){const s={};for(const i in t)i==="values"&&typeof t.values=="object"||(Ns(i)||n===!0&&Ht(i)||!e&&!Ht(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}function Cn(t,e,n){return typeof t=="string"?t:P.transform(e+n*t)}function Ko(t,e,n){const s=Cn(e,t.x,t.width),i=Cn(n,t.y,t.height);return`${s} ${i}`}const Zo={offset:"stroke-dashoffset",array:"stroke-dasharray"},qo={offset:"strokeDashoffset",array:"strokeDasharray"};function Yo(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?Zo:qo;t[r.offset]=P.transform(-s);const o=P.transform(e),a=P.transform(n);t[r.array]=`${o} ${a}`}function Ye(t,{attrX:e,attrY:n,originX:s,originY:i,pathLength:r,pathSpacing:o=1,pathOffset:a=0,...c},l,u,f){if(Ze(t,c,l,f),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:d,dimensions:p}=t;h.transform&&(p&&(d.transform=h.transform),delete h.transform),p&&(s!==void 0||i!==void 0||d.transform)&&(d.transformOrigin=Ko(p,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&Yo(h,r,o,a,!1)}const Us=()=>({...qe(),attrs:{}}),Xe=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Xo(t,e,n,s){const i=m.useMemo(()=>{const r=Us();return Ye(r,e,{enableHardwareAcceleration:!1},Xe(s),t.transformTemplate),{...r.attrs,style:{...r.style}}},[e]);if(t.style){const r={};Os(r,t.style,t),i.style={...r,...i.style}}return i}function Jo(t=!1){return(n,s,i,r,{latestValues:o},a)=>{const l=(Ke(n)?Xo:$o)(s,o,a,n),f={...Go(s,typeof n=="string",t),...l,ref:r},{children:h}=s,d=m.useMemo(()=>k(h)?h.get():h,[h]);return i&&(f["data-projection-id"]=i),m.createElement(n,{...f,children:d})}}const Je=t=>t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function _s(t,{style:e,vars:n},s,i){Object.assign(t.style,e,i&&i.getProjectionStyles(s));for(const r in n)t.style.setProperty(r,n[r])}const zs=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 $s(t,e,n,s){_s(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(zs.has(i)?i:Je(i),e.attrs[i])}function Qe(t,e){const{style:n}=t,s={};for(const i in n)(k(n[i])||e.style&&k(e.style[i])||js(i,t))&&(s[i]=n[i]);return s}function Ws(t,e){const n=Qe(t,e);for(const s in t)if(k(t[s])||k(e[s])){const i=s==="x"||s==="y"?"attr"+s.toUpperCase():s;n[i]=t[s]}return n}function tn(t,e,n,s={},i={}){return typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"&&(e=e(n!==void 0?n:t.custom,s,i)),e}const Gt=t=>Array.isArray(t),Qo=t=>Boolean(t&&typeof t=="object"&&t.mix&&t.toValue),tr=t=>Gt(t)?t[t.length-1]||0:t;function Ut(t){const e=k(t)?t.get():t;return Qo(e)?e.toValue():e}function er({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:n},s,i,r){const o={latestValues:nr(s,i,r,t),renderState:e()};return n&&(o.mount=a=>n(s,a,o)),o}const Hs=t=>(e,n)=>{const s=m.useContext(Qt),i=m.useContext(Et),r=()=>er(t,e,s,i);return n?r():He(r)};function nr(t,e,n,s){const i={},r=s(t,{});for(const h in r)i[h]=Ut(r[h]);let{initial:o,animate:a}=t;const c=ne(t),l=Ls(t);e&&l&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!ee(f)&&(Array.isArray(f)?f:[f]).forEach(d=>{const p=tn(t,d);if(!p)return;const{transitionEnd:g,transition:T,...b}=p;for(const x in b){let y=b[x];if(Array.isArray(y)){const v=u?y.length-1:0;y=y[v]}y!==null&&(i[x]=y)}for(const x in g)i[x]=g[x]}),i}const sr={useVisualState:Hs({scrapeMotionValuesFromProps:Ws,createRenderState:Us,onMount:(t,e,{renderState:n,latestValues:s})=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}Ye(n,s,{enableHardwareAcceleration:!1},Xe(e.tagName),t.transformTemplate),$s(e,n)}})},ir={useVisualState:Hs({scrapeMotionValuesFromProps:Qe,createRenderState:qe})};function or(t,{forwardMotionProps:e=!1},n,s){return{...Ke(t)?sr:ir,preloadedFeatures:n,useRender:Jo(e),createVisualElement:s,Component:t}}function $(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const Gs=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function ie(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const rr=t=>e=>Gs(e)&&t(e,ie(e));function W(t,e,n,s){return $(t,e,rr(n),s)}const ar=(t,e)=>n=>e(t(n)),X=(...t)=>t.reduce(ar);function Ks(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const Sn=Ks("dragHorizontal"),An=Ks("dragVertical");function Zs(t){let e=!1;if(t==="y")e=An();else if(t==="x")e=Sn();else{const n=Sn(),s=An();n&&s?e=()=>{n(),s()}:(n&&n(),s&&s())}return e}function qs(){const t=Zs(!0);return t?(t(),!1):!0}class tt{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Vn(t,e){const n="pointer"+(e?"enter":"leave"),s="onHover"+(e?"Start":"End"),i=(r,o)=>{if(r.type==="touch"||qs())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e),a[s]&&a[s](r,o)};return W(t.current,n,i,{passive:!t.getProps()[s]})}class cr extends tt{mount(){this.unmount=X(Vn(this.node,!0),Vn(this.node,!1))}unmount(){}}class lr extends tt{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=X($(this.node.current,"focus",()=>this.onFocus()),$(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Ys=(t,e)=>e?t===e?!0:Ys(t,e.parentElement):!1,I=t=>t;function le(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,ie(n))}class ur extends tt{constructor(){super(...arguments),this.removeStartListeners=I,this.removeEndListeners=I,this.removeAccessibleListeners=I,this.startPointerPress=(e,n)=>{if(this.removeEndListeners(),this.isPressing)return;const s=this.node.getProps(),r=W(window,"pointerup",(a,c)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:u}=this.node.getProps();Ys(this.node.current,a.target)?l&&l(a,c):u&&u(a,c)},{passive:!(s.onTap||s.onPointerUp)}),o=W(window,"pointercancel",(a,c)=>this.cancelPress(a,c),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=X(r,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=r=>{if(r.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||le("up",this.node.getProps().onTap)};this.removeEndListeners(),this.removeEndListeners=$(this.node.current,"keyup",o),le("down",(a,c)=>{this.startPress(a,c)})},n=$(this.node.current,"keydown",e),s=()=>{this.isPressing&&le("cancel",(r,o)=>this.cancelPress(r,o))},i=$(this.node.current,"blur",s);this.removeAccessibleListeners=X(n,i)}}startPress(e,n){this.isPressing=!0;const{onTapStart:s,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&s(e,n)}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!qs()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&s(e,n)}mount(){const e=this.node.getProps(),n=W(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),s=$(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=X(n,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ve=new WeakMap,ue=new WeakMap,fr=t=>{const e=Ve.get(t.target);e&&e(t)},hr=t=>{t.forEach(fr)};function dr({root:t,...e}){const n=t||document;ue.has(n)||ue.set(n,{});const s=ue.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(hr,{root:t,...e})),s[i]}function pr(t,e,n){const s=dr(e);return Ve.set(t,n),s.observe(t),()=>{Ve.delete(t),s.unobserve(t)}}const mr={some:0,all:1};class gr extends tt{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}viewportFallback(){requestAnimationFrame(()=>{this.hasEnteredView=!0;const{onViewportEnter:e}=this.node.getProps();e&&e(null),this.node.animationState&&this.node.animationState.setActive("whileInView",!0)})}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r,fallback:o=!0}=e;if(typeof IntersectionObserver>"u"){o&&this.viewportFallback();return}const a={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:mr[i]},c=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,r&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),d=u?f:h;d&&d(l)};return pr(this.node.current,a,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(yr(e,n))&&this.startObserver()}unmount(){}}function yr({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const vr={inView:{Feature:gr},tap:{Feature:ur},focus:{Feature:lr},hover:{Feature:cr}};function Xs(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s/^\-?\d*\.?\d+$/.test(t),br=t=>/^0[^.\s]+$/.test(t),H={delta:0,timestamp:0},Js=1/60*1e3,Pr=typeof performance<"u"?()=>performance.now():()=>Date.now(),Qs=typeof window<"u"?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(Pr()),Js);function Tr(t){let e=[],n=[],s=0,i=!1,r=!1;const o=new WeakSet,a={schedule:(c,l=!1,u=!1)=>{const f=u&&i,h=f?e:n;return l&&o.add(c),h.indexOf(c)===-1&&(h.push(c),f&&i&&(s=e.length)),c},cancel:c=>{const l=n.indexOf(c);l!==-1&&n.splice(l,1),o.delete(c)},process:c=>{if(i){r=!0;return}if(i=!0,[e,n]=[n,e],n.length=0,s=e.length,s)for(let l=0;l(t[e]=Tr(()=>Vt=!0),t),{}),R=jt.reduce((t,e)=>{const n=oe[e];return t[e]=(s,i=!1,r=!1)=>(Vt||Ar(),n.schedule(s,i,r)),t},{}),J=jt.reduce((t,e)=>(t[e]=oe[e].cancel,t),{}),fe=jt.reduce((t,e)=>(t[e]=()=>oe[e].process(H),t),{}),Sr=t=>oe[t].process(H),ti=t=>{Vt=!1,H.delta=we?Js:Math.max(Math.min(t-H.timestamp,Cr),1),H.timestamp=t,Me=!0,jt.forEach(Sr),Me=!1,Vt&&(we=!1,Qs(ti))},Ar=()=>{Vt=!0,we=!0,Me||Qs(ti)};function en(t,e){t.indexOf(e)===-1&&t.push(e)}function nn(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class sn{constructor(){this.subscriptions=[]}add(e){return en(this.subscriptions,e),()=>nn(this.subscriptions,e)}notify(e,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,s);else for(let r=0;r!isNaN(parseFloat(t));class wr{constructor(e,n={}){this.version="9.1.7",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(s,i=!0)=>{this.prev=this.current,this.current=s;const{delta:r,timestamp:o}=H;this.lastUpdated!==o&&(this.timeDelta=r,this.lastUpdated=o,R.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=()=>R.postRender(this.velocityCheck),this.velocityCheck=({timestamp:s})=>{s!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=Vr(this.current),this.owner=n.owner}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new sn);const s=this.events[e].add(n);return e==="change"?()=>{s(),R.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,s){this.set(n),this.prev=e,this.timeDelta=s}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?on(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n)||null,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(){this.animation=null}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dt(t,e){return new wr(t,e)}const rn=(t,e)=>n=>Boolean(Lt(n)&&Oo.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),ei=(t,e,n)=>s=>{if(!Lt(s))return s;const[i,r,o,a]=s.match(At);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Mr=t=>ht(0,255,t),he={...rt,transform:t=>Math.round(Mr(t))},it={test:rn("rgb","red"),parse:ei("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+he.transform(t)+", "+he.transform(e)+", "+he.transform(n)+", "+xt(vt.transform(s))+")"};function Dr(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const De={test:rn("#"),parse:Dr,transform:it.transform},ut={test:rn("hsl","hue"),parse:ei("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+z.transform(xt(e))+", "+z.transform(xt(n))+", "+xt(vt.transform(s))+")"},E={test:t=>it.test(t)||De.test(t)||ut.test(t),parse:t=>it.test(t)?it.parse(t):ut.test(t)?ut.parse(t):De.parse(t),transform:t=>Lt(t)?t:t.hasOwnProperty("red")?it.transform(t):ut.transform(t)},ni="${c}",si="${n}";function Rr(t){var e,n;return isNaN(t)&&Lt(t)&&(((e=t.match(At))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(Ae))===null||n===void 0?void 0:n.length)||0)>0}function Kt(t){typeof t=="number"&&(t=`${t}`);const e=[];let n=0,s=0;const i=t.match(Ae);i&&(n=i.length,t=t.replace(Ae,ni),e.push(...i.map(E.parse)));const r=t.match(At);return r&&(s=r.length,t=t.replace(At,si),e.push(...r.map(rt.parse))),{values:e,numColors:n,numNumbers:s,tokenised:t}}function ii(t){return Kt(t).values}function oi(t){const{values:e,numColors:n,tokenised:s}=Kt(t),i=e.length;return r=>{let o=s;for(let a=0;atypeof t=="number"?0:t;function Lr(t){const e=ii(t);return oi(t)(e.map(Er))}const Q={test:Rr,parse:ii,createTransformer:oi,getAnimatableNone:Lr},kr=new Set(["brightness","contrast","saturate","opacity"]);function jr(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(At)||[];if(!s)return t;const i=n.replace(s,"");let r=kr.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const Br=/([a-z-]*)\(.*?\)/g,Re={...Q,getAnimatableNone:t=>{const e=t.match(Br);return e?e.map(jr).join(" "):t}},Fr={...Is,color:E,backgroundColor:E,outlineColor:E,fill:E,stroke:E,borderColor:E,borderTopColor:E,borderRightColor:E,borderBottomColor:E,borderLeftColor:E,filter:Re,WebkitFilter:Re},an=t=>Fr[t];function cn(t,e){let n=an(t);return n!==Re&&(n=Q),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ri=t=>e=>e.test(t),Ir={test:t=>t==="auto",parse:t=>t},ai=[rt,P,z,q,Uo,No,Ir],pt=t=>ai.find(ri(t)),Or=[...ai,E,Q],Nr=t=>Or.find(ri(t));function Ur(t){const e={};return t.values.forEach((n,s)=>e[s]=n.get()),e}function _r(t){const e={};return t.values.forEach((n,s)=>e[s]=n.getVelocity()),e}function re(t,e,n){const s=t.getProps();return tn(s,e,n!==void 0?n:s.custom,Ur(t),_r(t))}function zr(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,dt(n))}function $r(t,e){const n=re(t,e);let{transitionEnd:s={},transition:i={},...r}=n?t.makeTargetAnimatable(n,!1):{};r={...r,...s};for(const o in r){const a=tr(r[o]);zr(t,o,a)}}function Wr(t,e,n){var s,i;const r=Object.keys(e).filter(a=>!t.hasValue(a)),o=r.length;if(o)for(let a=0;at*1e3,Yr={current:!1},ln=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,un=t=>e=>1-t(1-e),fn=t=>t*t,Xr=un(fn),hn=ln(fn),A=(t,e,n)=>-n*t+n*e+t;function de(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Jr({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,c=2*n-a;i=de(c,a,t+1/3),r=de(c,a,t),o=de(c,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}const pe=(t,e,n)=>{const s=t*t;return Math.sqrt(Math.max(0,n*(e*e-s)+s))},Qr=[De,it,ut],ta=t=>Qr.find(e=>e.test(t));function wn(t){const e=ta(t);let n=e.parse(t);return e===ut&&(n=Jr(n)),n}const ci=(t,e)=>{const n=wn(t),s=wn(e),i={...n};return r=>(i.red=pe(n.red,s.red,r),i.green=pe(n.green,s.green,r),i.blue=pe(n.blue,s.blue,r),i.alpha=A(n.alpha,s.alpha,r),it.transform(i))};function li(t,e){return typeof t=="number"?n=>A(t,e,n):E.test(t)?ci(t,e):fi(t,e)}const ui=(t,e)=>{const n=[...t],s=n.length,i=t.map((r,o)=>li(r,e[o]));return r=>{for(let o=0;o{const n={...t,...e},s={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(s[i]=li(t[i],e[i]));return i=>{for(const r in s)n[r]=s[r](i);return n}},fi=(t,e)=>{const n=Q.createTransformer(e),s=Kt(t),i=Kt(e);return s.numColors===i.numColors&&s.numNumbers>=i.numNumbers?X(ui(s.values,i.values),n):o=>`${o>0?e:t}`},wt=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s},Mn=(t,e)=>n=>A(t,e,n);function na(t){return typeof t=="number"?Mn:typeof t=="string"?E.test(t)?ci:fi:Array.isArray(t)?ui:typeof t=="object"?ea:Mn}function sa(t,e,n){const s=[],i=n||na(t[0]),r=t.length-1;for(let o=0;ot[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=sa(e,s,i),a=o.length,c=l=>{let u=0;if(a>1)for(;uc(ht(t[0],t[r-1],l)):c}function ia(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=wt(0,e,s);t.push(A(n,1,i))}}function oa(t){const e=[0];return ia(e,t.length-1),e}function ra(t,e){return t.map(n=>n*e)}const di=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,aa=1e-7,ca=12;function la(t,e,n,s,i){let r,o,a=0;do o=e+(n-e)/2,r=di(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>aa&&++ala(r,0,1,t,n);return r=>r===0||r===1?r:di(i(r),e,s)}const mi=t=>1-Math.sin(Math.acos(t)),dn=un(mi),ua=ln(dn),gi=pi(.33,1.53,.69,.99),pn=un(gi),fa=ln(pn),ha=t=>(t*=2)<1?.5*pn(t):.5*(2-Math.pow(2,-10*(t-1))),da={linear:I,easeIn:fn,easeInOut:hn,easeOut:Xr,circIn:mi,circInOut:ua,circOut:dn,backIn:pn,backInOut:fa,backOut:gi,anticipate:ha},Dn=t=>{if(Array.isArray(t)){qt(t.length===4);const[e,n,s,i]=t;return pi(e,n,s,i)}else if(typeof t=="string")return da[t];return t},pa=t=>Array.isArray(t)&&typeof t[0]!="number";function ma(t,e){return t.map(()=>e||hn).splice(0,t.length-1)}function Ee({keyframes:t,ease:e=hn,times:n,duration:s=300}){t=[...t];const i=pa(e)?e.map(Dn):Dn(e),r={done:!1,value:t[0]},o=ra(n&&n.length===t.length?n:oa(t),s);function a(){return hi(o,t,{ease:Array.isArray(i)?i:ma(t,i)})}let c=a();return{next:l=>(r.value=c(l),r.done=l>=s,r),flipTarget:()=>{t.reverse(),c=a()}}}const me=.001,ga=.01,Rn=10,ya=.05,va=1;function xa({duration:t=800,bounce:e=.25,velocity:n=0,mass:s=1}){let i,r;qr(t<=Rn*1e3);let o=1-e;o=ht(ya,va,o),t=ht(ga,Rn,t/1e3),o<1?(i=l=>{const u=l*o,f=u*t,h=u-n,d=Le(l,o),p=Math.exp(-f);return me-h/d*p},r=l=>{const f=l*o*t,h=f*n+n,d=Math.pow(o,2)*Math.pow(l,2)*t,p=Math.exp(-f),g=Le(Math.pow(l,2),o);return(-i(l)+me>0?-1:1)*((h-d)*p)/g}):(i=l=>{const u=Math.exp(-l*t),f=(l-n)*t+1;return-me+u*f},r=l=>{const u=Math.exp(-l*t),f=(n-l)*(t*t);return u*f});const a=5/t,c=Pa(i,r,a);if(t=t*1e3,isNaN(c))return{stiffness:100,damping:10,duration:t};{const l=Math.pow(c,2)*s;return{stiffness:l,damping:o*2*Math.sqrt(s*l),duration:t}}}const ba=12;function Pa(t,e,n){let s=n;for(let i=1;it[n]!==void 0)}function Sa(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!En(t,Ca)&&En(t,Ta)){const n=xa(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}const Aa=5;function yi({keyframes:t,restDelta:e,restSpeed:n,...s}){let i=t[0],r=t[t.length-1];const o={done:!1,value:i},{stiffness:a,damping:c,mass:l,velocity:u,duration:f,isResolvedFromDuration:h}=Sa(s);let d=Va,p=u?-(u/1e3):0;const g=c/(2*Math.sqrt(a*l));function T(){const b=r-i,x=Math.sqrt(a/l)/1e3,y=Math.abs(b)<5;if(n||(n=y?.01:2),e||(e=y?.005:.5),g<1){const v=Le(x,g);d=S=>{const w=Math.exp(-g*x*S);return r-w*((p+g*x*b)/v*Math.sin(v*S)+b*Math.cos(v*S))}}else if(g===1)d=v=>r-Math.exp(-x*v)*(b+(p+x*b)*v);else{const v=x*Math.sqrt(g*g-1);d=S=>{const w=Math.exp(-g*x*S),D=Math.min(v*S,300);return r-w*((p+g*x*b)*Math.sinh(D)+v*b*Math.cosh(D))/v}}}return T(),{next:b=>{const x=d(b);if(h)o.done=b>=f;else{let y=p;if(b!==0)if(g<1){const w=Math.max(0,b-Aa);y=on(x-d(w),b-w)}else y=0;const v=Math.abs(y)<=n,S=Math.abs(r-x)<=e;o.done=v&&S}return o.value=o.done?r:x,o},flipTarget:()=>{p=-p,[i,r]=[r,i],T()}}}yi.needsInterpolation=(t,e)=>typeof t=="string"||typeof e=="string";const Va=t=>0;function wa({keyframes:t=[0],velocity:e=0,power:n=.8,timeConstant:s=350,restDelta:i=.5,modifyTarget:r}){const o=t[0],a={done:!1,value:o};let c=n*e;const l=o+c,u=r===void 0?l:r(l);return u!==l&&(c=u-o),{next:f=>{const h=-c*Math.exp(-f/s);return a.done=!(h>i||h<-i),a.value=a.done?u:u+h,a},flipTarget:()=>{}}}const Ma={decay:wa,keyframes:Ee,tween:Ee,spring:yi};function vi(t,e,n=0){return t-e-n}function Da(t,e=0,n=0,s=!0){return s?vi(e+-t,e,n):e-(t-e)+n}function Ra(t,e,n,s){return s?t>=e+n:t<=-n}const Ea=t=>{const e=({delta:n})=>t(n);return{start:()=>R.update(e,!0),stop:()=>J.update(e)}};function Yt({duration:t,driver:e=Ea,elapsed:n=0,repeat:s=0,repeatType:i="loop",repeatDelay:r=0,keyframes:o,autoplay:a=!0,onPlay:c,onStop:l,onComplete:u,onRepeat:f,onUpdate:h,type:d="keyframes",...p}){const g=n;let T,b=0,x=t,y=!1,v=!0,S;const w=Ma[o.length>2?"keyframes":d]||Ee,D=o[0],N=o[o.length-1];let B={done:!1,value:D};const{needsInterpolation:O}=w;O&&O(D,N)&&(S=hi([0,100],[D,N],{clamp:!1}),o=[0,100]);const K=w({...p,duration:t,keyframes:o});function Ft(){b++,i==="reverse"?(v=b%2===0,n=Da(n,x,r,v)):(n=vi(n,x,r),i==="mirror"&&K.flipTarget()),y=!1,f&&f()}function ae(){T&&T.stop(),u&&u()}function Z(L){v||(L=-L),n+=L,y||(B=K.next(Math.max(0,n)),S&&(B.value=S(B.value)),y=v?B.done:n<=0),h&&h(B.value),y&&(b===0&&(x=x!==void 0?x:n),b{l&&l(),T&&T.stop()},set currentTime(L){n=g,Z(L)},sample:L=>{n=g;const at=t&&typeof t=="number"?Math.max(t*.5,50):50;let ce=0;for(Z(0);ce<=L;){const Xi=L-ce;Z(Math.min(Xi,at)),ce+=at}return B}}}function La(t){return!t||Array.isArray(t)||typeof t=="string"&&xi[t]}const gt=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,xi={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gt([0,.65,.55,1]),circOut:gt([.55,0,1,.45]),backIn:gt([.31,.01,.66,-.59]),backOut:gt([.33,1.53,.69,.99])};function ka(t){if(t)return Array.isArray(t)?gt(t):xi[t]}function ja(t,e,n,{delay:s=0,duration:i,repeat:r=0,repeatType:o="loop",ease:a,times:c}={}){return t.animate({[e]:n,offset:c},{delay:s,duration:i,easing:ka(a),fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal"})}const Ln={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},ge={},bi={};for(const t in Ln)bi[t]=()=>(ge[t]===void 0&&(ge[t]=Ln[t]()),ge[t]);function Ba(t,{repeat:e,repeatType:n="loop"}){const s=e&&n!=="loop"&&e%2===1?0:t.length-1;return t[s]}const Fa=new Set(["opacity","clipPath","filter","transform"]),Ot=10;function Ia(t,e,{onUpdate:n,onComplete:s,...i}){if(!(bi.waapi()&&Fa.has(e)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0))return!1;let{keyframes:o,duration:a=300,elapsed:c=0,ease:l}=i;if(i.type==="spring"||!La(i.ease)){if(i.repeat===1/0)return;const f=Yt({...i,elapsed:0});let h={done:!1,value:o[0]};const d=[];let p=0;for(;!h.done&&p<2e4;)h=f.sample(p),d.push(h.value),p+=Ot;o=d,a=p-Ot,l="linear"}const u=ja(t.owner.current,e,o,{...i,delay:-c,duration:a,ease:l});return u.onfinish=()=>{t.set(Ba(o,i)),R.update(()=>u.cancel()),s&&s()},{get currentTime(){return u.currentTime||0},set currentTime(f){u.currentTime=f},stop:()=>{const{currentTime:f}=u;if(f){const h=Yt({...i,autoplay:!1});t.setWithVelocity(h.sample(f-Ot).value,h.sample(f).value,Ot)}R.update(()=>u.cancel())}}}function Pi(t,e){const n=performance.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(J.read(s),t(r-e))};return R.read(s,!0),()=>J.read(s)}function Oa({keyframes:t,elapsed:e,onUpdate:n,onComplete:s}){const i=()=>{n&&n(t[t.length-1]),s&&s()};return e?{stop:Pi(i,-e)}:i()}function Na({keyframes:t,velocity:e=0,min:n,max:s,power:i=.8,timeConstant:r=750,bounceStiffness:o=500,bounceDamping:a=10,restDelta:c=1,modifyTarget:l,driver:u,onUpdate:f,onComplete:h,onStop:d}){const p=t[0];let g;function T(v){return n!==void 0&&vs}function b(v){return n===void 0?s:s===void 0||Math.abs(n-v){f&&f(S),v.onUpdate&&v.onUpdate(S)},onComplete:h,onStop:d})}function y(v){x({type:"spring",stiffness:o,damping:a,restDelta:c,...v})}if(T(p))y({velocity:e,keyframes:[p,b(p)]});else{let v=i*e+p;typeof l<"u"&&(v=l(v));const S=b(v),w=S===n?-1:1;let D,N;const B=O=>{D=N,N=O,e=on(O-D,H.delta),(w===1&&O>S||w===-1&&Og&&g.stop()}}const Ua={type:"spring",stiffness:500,damping:25,restSpeed:10},_a=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),za={type:"keyframes",duration:.8},$a={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Wa=(t,{keyframes:e})=>e.length>2?za:ot.has(t)?t.startsWith("scale")?_a(e[1]):Ua:$a,ke=(t,e)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&Q.test(e)&&!e.startsWith("url("));function Ha({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:c,elapsed:l,...u}){return!!Object.keys(u).length}function kn(t){return t===0||typeof t=="string"&&parseFloat(t)===0&&t.indexOf(" ")===-1}function jn(t){return typeof t=="number"?0:cn("",t)}function Ti(t,e){return t[e]||t.default||t}function Ga(t,e,n,s){const i=ke(e,n);let r=s.from!==void 0?s.from:t.get();return r==="none"&&i&&typeof n=="string"?r=cn(e,n):kn(r)&&typeof n=="string"?r=jn(n):!Array.isArray(n)&&kn(n)&&typeof r=="string"&&(n=jn(r)),Array.isArray(n)?(n[0]===null&&(n[0]=r),n):[r,n]}const mn=(t,e,n,s={})=>i=>{const r=Ti(s,t)||{},o=r.delay||s.delay||0;let{elapsed:a=0}=s;a=a-_t(o);const c=Ga(e,t,n,r),l=c[0],u=c[c.length-1],f=ke(t,l),h=ke(t,u);let d={keyframes:c,velocity:e.getVelocity(),...r,elapsed:a,onUpdate:p=>{e.set(p),r.onUpdate&&r.onUpdate(p)},onComplete:()=>{i(),r.onComplete&&r.onComplete()}};if(!f||!h||Yr.current||r.type===!1)return Oa(d);if(r.type==="inertia")return Na(d);if(Ha(r)||(d={...d,...Wa(t,d)}),d.duration&&(d.duration=_t(d.duration)),d.repeatDelay&&(d.repeatDelay=_t(d.repeatDelay)),e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const p=Ia(e,t,d);if(p)return p}return Yt(d)};function Ka(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>je(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=je(t,e,n);else{const i=typeof e=="function"?re(t,e,n.custom):e;s=Ci(t,i,n)}return s.then(()=>t.notify("AnimationComplete",e))}function je(t,e,n={}){const s=re(t,e,n.custom);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Ci(t,s,n):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:f}=i;return Za(t,e,l+c,u,f,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[c,l]=a==="beforeChildren"?[r,o]:[o,r];return c().then(l)}else return Promise.all([r(),o(n.delay)])}function Ci(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:o,...a}=t.makeTargetAnimatable(e);const c=t.getValue("willChange");s&&(r=s);const l=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const f in a){const h=t.getValue(f),d=a[f];if(!h||d===void 0||u&&Ya(u,f))continue;const p={delay:n,elapsed:0,...r};if(window.HandoffAppearAnimations&&!h.hasAnimated){const T=t.getProps()[Zr];T&&(p.elapsed=window.HandoffAppearAnimations(T,f,h,R))}let g=h.start(mn(f,h,d,t.shouldReduceMotion&&ot.has(f)?{type:!1}:p));Zt(c)&&(c.add(f),g=g.then(()=>c.remove(f))),l.push(g)}return Promise.all(l).then(()=>{o&&$r(t,o)})}function Za(t,e,n=0,s=0,i=1,r){const o=[],a=(t.variantChildren.size-1)*s,c=i===1?(l=0)=>l*s:(l=0)=>a-l*s;return Array.from(t.variantChildren).sort(qa).forEach((l,u)=>{l.notify("AnimationStart",e),o.push(je(l,e,{...r,delay:n+c(u)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(o)}function qa(t,e){return t.sortNodePosition(e)}function Ya({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}const Xa=[...$e].reverse(),Ja=$e.length;function Qa(t){return e=>Promise.all(e.map(({animation:n,options:s})=>Ka(t,n,s)))}function tc(t){let e=Qa(t);const n=nc();let s=!0;const i=(c,l)=>{const u=re(t,l);if(u){const{transition:f,transitionEnd:h,...d}=u;c={...c,...d,...h}}return c};function r(c){e=c(t)}function o(c,l){const u=t.getProps(),f=t.getVariantContext(!0)||{},h=[],d=new Set;let p={},g=1/0;for(let b=0;bg&&S;const O=Array.isArray(v)?v:[v];let K=O.reduce(i,{});w===!1&&(K={});const{prevResolvedValues:Ft={}}=y,ae={...Ft,...K},Z=M=>{B=!0,d.delete(M),y.needsAnimating[M]=!0};for(const M in ae){const L=K[M],at=Ft[M];p.hasOwnProperty(M)||(L!==at?Gt(L)&&Gt(at)?!Xs(L,at)||N?Z(M):y.protectedKeys[M]=!0:L!==void 0?Z(M):d.add(M):L!==void 0&&d.has(M)?Z(M):y.protectedKeys[M]=!0)}y.prevProp=v,y.prevResolvedValues=K,y.isActive&&(p={...p,...K}),s&&t.blockInitialAnimation&&(B=!1),B&&!D&&h.push(...O.map(M=>({animation:M,options:{type:x,...c}})))}if(d.size){const b={};d.forEach(x=>{const y=t.getBaseTarget(x);y!==void 0&&(b[x]=y)}),h.push({animation:b})}let T=Boolean(h.length);return s&&u.initial===!1&&!t.manuallyAnimateOnMount&&(T=!1),s=!1,T?e(h):Promise.resolve()}function a(c,l,u){var f;if(n[c].isActive===l)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(d=>{var p;return(p=d.animationState)===null||p===void 0?void 0:p.setActive(c,l)}),n[c].isActive=l;const h=o(u,c);for(const d in n)n[d].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:r,getState:()=>n}}function ec(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Xs(e,t):!1}function et(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nc(){return{animate:et(!0),whileInView:et(),whileHover:et(),whileTap:et(),whileDrag:et(),whileFocus:et(),exit:et()}}class sc extends tt{constructor(e){super(e),e.animationState||(e.animationState=tc(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),ee(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let ic=0;class oc extends tt{constructor(){super(...arguments),this.id=ic++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n,custom:s}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e,{custom:s??this.node.getProps().custom});n&&!e&&r.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const rc={animation:{Feature:sc},exit:{Feature:oc}},Bn=(t,e)=>Math.abs(t-e);function ac(t,e){const n=Bn(t.x,e.x),s=Bn(t.y,e.y);return Math.sqrt(n**2+s**2)}class Si{constructor(e,n,{transformPagePoint:s}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const l=ve(this.lastMoveEventInfo,this.history),u=this.startEvent!==null,f=ac(l.offset,{x:0,y:0})>=3;if(!u&&!f)return;const{point:h}=l,{timestamp:d}=H;this.history.push({...h,timestamp:d});const{onStart:p,onMove:g}=this.handlers;u||(p&&p(this.lastMoveEvent,l),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,l)},this.handlePointerMove=(l,u)=>{this.lastMoveEvent=l,this.lastMoveEventInfo=ye(u,this.transformPagePoint),R.update(this.updatePoint,!0)},this.handlePointerUp=(l,u)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:f,onSessionEnd:h}=this.handlers,d=ve(l.type==="pointercancel"?this.lastMoveEventInfo:ye(u,this.transformPagePoint),this.history);this.startEvent&&f&&f(l,d),h&&h(l,d)},!Gs(e))return;this.handlers=n,this.transformPagePoint=s;const i=ie(e),r=ye(i,this.transformPagePoint),{point:o}=r,{timestamp:a}=H;this.history=[{...o,timestamp:a}];const{onSessionStart:c}=n;c&&c(e,ve(r,this.history)),this.removeListeners=X(W(window,"pointermove",this.handlePointerMove),W(window,"pointerup",this.handlePointerUp),W(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),J.update(this.updatePoint)}}function ye(t,e){return e?{point:e(t.point)}:t}function Fn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ve({point:t},e){return{point:t,delta:Fn(t,Ai(e)),offset:Fn(t,cc(e)),velocity:lc(e,.1)}}function cc(t){return t[0]}function Ai(t){return t[t.length-1]}function lc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=Ai(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>_t(e)));)n--;if(!s)return{x:0,y:0};const r=(i.timestamp-s.timestamp)/1e3;if(r===0)return{x:0,y:0};const o={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function j(t){return t.max-t.min}function Be(t,e=0,n=.01){return Math.abs(t-e)<=n}function In(t,e,n,s=.5){t.origin=s,t.originPoint=A(e.min,e.max,t.origin),t.scale=j(n)/j(e),(Be(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=A(n.min,n.max,t.origin)-t.originPoint,(Be(t.translate)||isNaN(t.translate))&&(t.translate=0)}function bt(t,e,n,s){In(t.x,e.x,n.x,s?s.originX:void 0),In(t.y,e.y,n.y,s?s.originY:void 0)}function On(t,e,n){t.min=n.min+e.min,t.max=t.min+j(e)}function uc(t,e,n){On(t.x,e.x,n.x),On(t.y,e.y,n.y)}function Nn(t,e,n){t.min=e.min-n.min,t.max=t.min+j(e)}function Pt(t,e,n){Nn(t.x,e.x,n.x),Nn(t.y,e.y,n.y)}function fc(t,{min:e,max:n},s){return e!==void 0&&tn&&(t=s?A(n,t,s.max):Math.min(t,n)),t}function Un(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function hc(t,{top:e,left:n,bottom:s,right:i}){return{x:Un(t.x,n,i),y:Un(t.y,e,s)}}function _n(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.mins?n=wt(e.min,e.max-s,t.min):s>i&&(n=wt(t.min,t.max-i,e.min)),ht(0,1,n)}function mc(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Fe=.35;function gc(t=Fe){return t===!1?t=0:t===!0&&(t=Fe),{x:zn(t,"left","right"),y:zn(t,"top","bottom")}}function zn(t,e,n){return{min:$n(t,e),max:$n(t,n)}}function $n(t,e){return typeof t=="number"?t:t[e]||0}const Wn=()=>({translate:0,scale:1,origin:0,originPoint:0}),Tt=()=>({x:Wn(),y:Wn()}),Hn=()=>({min:0,max:0}),V=()=>({x:Hn(),y:Hn()});function U(t){return[t("x"),t("y")]}function Vi({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function yc({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function vc(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function xe(t){return t===void 0||t===1}function Ie({scale:t,scaleX:e,scaleY:n}){return!xe(t)||!xe(e)||!xe(n)}function nt(t){return Ie(t)||wi(t)||t.z||t.rotate||t.rotateX||t.rotateY}function wi(t){return Gn(t.x)||Gn(t.y)}function Gn(t){return t&&t!=="0%"}function Xt(t,e,n){const s=t-n,i=e*s;return n+i}function Kn(t,e,n,s,i){return i!==void 0&&(t=Xt(t,i,s)),Xt(t,n,s)+e}function Oe(t,e=0,n=1,s,i){t.min=Kn(t.min,e,n,s,i),t.max=Kn(t.max,e,n,s,i)}function Mi(t,{x:e,y:n}){Oe(t.x,e.translate,e.scale,e.originPoint),Oe(t.y,n.translate,n.scale,n.originPoint)}function xc(t,e,n,s=!1){const i=n.length;if(!i)return;e.x=e.y=1;let r,o;for(let a=0;a1.0000000000001||t<.999999999999?t:1}function Y(t,e){t.min=t.min+e,t.max=t.max+e}function qn(t,e,[n,s,i]){const r=e[i]!==void 0?e[i]:.5,o=A(t.min,t.max,r);Oe(t,e[n],e[s],o,e.scale)}const bc=["x","scaleX","originX"],Pc=["y","scaleY","originY"];function ft(t,e){qn(t.x,e,bc),qn(t.y,e,Pc)}function Di(t,e){return Vi(vc(t.getBoundingClientRect(),e))}function Tc(t,e,n){const s=Di(t,n),{scroll:i}=e;return i&&(Y(s.x,i.offset.x),Y(s.y,i.offset.y)),s}const Cc=new WeakMap;class Sc{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=V(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=c=>{this.stopAnimation(),n&&this.snapToCursor(ie(c,"page").point)},r=(c,l)=>{const{drag:u,dragPropagation:f,onDragStart:h}=this.getProps();if(u&&!f&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Zs(u),!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),U(p=>{let g=this.getAxisMotionValue(p).get()||0;if(z.test(g)){const{projection:T}=this.visualElement;if(T&&T.layout){const b=T.layout.layoutBox[p];b&&(g=j(b)*(parseFloat(g)/100))}}this.originPoint[p]=g}),h&&h(c,l);const{animationState:d}=this.visualElement;d&&d.setActive("whileDrag",!0)},o=(c,l)=>{const{dragPropagation:u,dragDirectionLock:f,onDirectionLock:h,onDrag:d}=this.getProps();if(!u&&!this.openGlobalLock)return;const{offset:p}=l;if(f&&this.currentDirection===null){this.currentDirection=Ac(p),this.currentDirection!==null&&h&&h(this.currentDirection);return}this.updateAxis("x",l.point,p),this.updateAxis("y",l.point,p),this.visualElement.render(),d&&d(c,l)},a=(c,l)=>this.stop(c,l);this.panSession=new Si(e,{onSessionStart:i,onStart:r,onMove:o,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(e,n){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:r}=this.getProps();r&&r(e,n)}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,s){const{drag:i}=this.getProps();if(!s||!Nt(e,i,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=fc(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),{layout:s}=this.visualElement.projection||{},i=this.constraints;e&<(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=hc(s.layoutBox,e):this.constraints=!1,this.elastic=gc(n),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&U(r=>{this.getAxisMotionValue(r)&&(this.constraints[r]=mc(s.layoutBox[r],this.constraints[r]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!lt(e))return!1;const s=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=Tc(s,i.root,this.visualElement.getTransformPagePoint());let o=dc(i.layout.layoutBox,r);if(n){const a=n(yc(o));this.hasMutatedConstraints=!!a,a&&(o=Vi(a))}return o}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),c=this.constraints||{},l=U(u=>{if(!Nt(u,n,this.currentDirection))return;let f=c&&c[u]||{};o&&(f={min:0,max:0});const h=i?200:1e6,d=i?40:1e7,p={type:"inertia",velocity:s?e[u]:0,bounceStiffness:h,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...r,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(l).then(a)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return s.start(mn(e,s,0,n))}stopAnimation(){U(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n="_drag"+e.toUpperCase(),s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){U(n=>{const{drag:s}=this.getProps();if(!Nt(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n];r.set(e[n]-A(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!lt(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};U(o=>{const a=this.getAxisMotionValue(o);if(a){const c=a.get();i[o]=pc({min:c,max:c},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),U(o=>{if(!Nt(o,e,null))return;const a=this.getAxisMotionValue(o),{min:c,max:l}=this.constraints[o];a.set(A(c,l,i[o]))})}addListeners(){if(!this.visualElement.current)return;Cc.set(this.visualElement,this);const e=this.visualElement.current,n=W(e,"pointerdown",c=>{const{drag:l,dragListener:u=!0}=this.getProps();l&&u&&this.start(c)}),s=()=>{const{dragConstraints:c}=this.getProps();lt(c)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,r=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),s();const o=$(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:l})=>{this.isDragging&&l&&(U(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=c[u].translate,f.set(f.get()+c[u].translate))}),this.visualElement.render())});return()=>{o(),n(),r(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:o=Fe,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function Nt(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Ac(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Vc extends tt{constructor(e){super(e),this.removeGroupControls=I,this.removeListeners=I,this.controls=new Sc(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||I}unmount(){this.removeGroupControls(),this.removeListeners()}}class wc extends tt{constructor(){super(...arguments),this.removePointerDownListener=I}onPointerDown(e){this.session=new Si(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:e,onStart:n,onMove:s,onEnd:(r,o)=>{delete this.session,i&&i(r,o)}}}mount(){this.removePointerDownListener=W(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Mc(){const t=m.useContext(Et);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:s}=t,i=m.useId();return m.useEffect(()=>s(i),[]),!e&&n?[!1,()=>n&&n(i)]:[!0]}function Dc(){return Rc(m.useContext(Et))}function Rc(t){return t===null?!0:t.isPresent}function Yn(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const mt={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(P.test(t))t=parseFloat(t);else return t;const n=Yn(t,e.target.x),s=Yn(t,e.target.y);return`${n}% ${s}%`}},Ri=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Ec(t){const e=Ri.exec(t);if(!e)return[,];const[,n,s]=e;return[n,s]}function Ne(t,e,n=1){const[s,i]=Ec(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);return r?r.trim():Se(i)?Ne(i,e,n+1):i}function Lc(t,{...e},n){const s=t.current;if(!(s instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(i=>{const r=i.get();if(!Se(r))return;const o=Ne(r,s);o&&i.set(o)});for(const i in e){const r=e[i];if(!Se(r))continue;const o=Ne(r,s);o&&(e[i]=o,n&&n[i]===void 0&&(n[i]=r))}return{target:e,transitionEnd:n}}const Xn="_$css",kc={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=t.includes("var("),r=[];i&&(t=t.replace(Ri,d=>(r.push(d),Xn)));const o=Q.parse(t);if(o.length>5)return s;const a=Q.createTransformer(t),c=typeof o[0]!="number"?1:0,l=n.x.scale*e.x,u=n.y.scale*e.y;o[0+c]/=l,o[1+c]/=u;const f=A(l,u,.5);typeof o[2+c]=="number"&&(o[2+c]/=f),typeof o[3+c]=="number"&&(o[3+c]/=f);let h=a(o);if(i){let d=0;h=h.replace(Xn,()=>{const p=r[d];return d++,p})}return h}};class jc extends Ss.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;ko(Bc),r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,onExitComplete:()=>this.safeToRemove()})),yt.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,o=s.projection;return o&&(o.isPresent=r,i||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||R.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),!e.currentAnimation&&e.isLead()&&this.safeToRemove())}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Ei(t){const[e,n]=Mc(),s=m.useContext(Ge);return Ss.createElement(jc,{...t,layoutGroup:s,switchLayoutGroup:m.useContext(ks),isPresent:e,safeToRemove:n})}const Bc={borderRadius:{...mt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mt,borderTopRightRadius:mt,borderBottomLeftRadius:mt,borderBottomRightRadius:mt,boxShadow:kc};function Fc(t,e,n={}){const s=k(t)?t:dt(t);return s.start(mn("",s,e,n)),{stop:()=>s.stop(),isAnimating:()=>s.isAnimating()}}const Li=["TopLeft","TopRight","BottomLeft","BottomRight"],Ic=Li.length,Jn=t=>typeof t=="string"?parseFloat(t):t,Qn=t=>typeof t=="number"||P.test(t);function Oc(t,e,n,s,i,r){i?(t.opacity=A(0,n.opacity!==void 0?n.opacity:1,Nc(s)),t.opacityExit=A(e.opacity!==void 0?e.opacity:1,0,Uc(s))):r&&(t.opacity=A(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,s));for(let o=0;ose?1:n(wt(t,e,s))}function es(t,e){t.min=e.min,t.max=e.max}function F(t,e){es(t.x,e.x),es(t.y,e.y)}function ns(t,e,n,s,i){return t-=e,t=Xt(t,1/n,s),i!==void 0&&(t=Xt(t,1/i,s)),t}function _c(t,e=0,n=1,s=.5,i,r=t,o=t){if(z.test(e)&&(e=parseFloat(e),e=A(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=A(r.min,r.max,s);t===r&&(a-=e),t.min=ns(t.min,e,n,a,i),t.max=ns(t.max,e,n,a,i)}function ss(t,e,[n,s,i],r,o){_c(t,e[n],e[s],e[i],e.scale,r,o)}const zc=["x","scaleX","originX"],$c=["y","scaleY","originY"];function is(t,e,n,s){ss(t.x,e,zc,n?n.x:void 0,s?s.x:void 0),ss(t.y,e,$c,n?n.y:void 0,s?s.y:void 0)}function os(t){return t.translate===0&&t.scale===1}function ji(t){return os(t.x)&&os(t.y)}function Ue(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function rs(t){return j(t.x)/j(t.y)}class Wc{constructor(){this.members=[]}add(e){en(this.members,e),e.scheduleRender()}remove(e){if(nn(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i];if(r.isPresent!==!1){s=r;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function as(t,e,n){let s="";const i=t.x.translate/e.x,r=t.y.translate/e.y;if((i||r)&&(s=`translate3d(${i}px, ${r}px, 0) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{rotate:c,rotateX:l,rotateY:u}=n;c&&(s+=`rotate(${c}deg) `),l&&(s+=`rotateX(${l}deg) `),u&&(s+=`rotateY(${u}deg) `)}const o=t.x.scale*e.x,a=t.y.scale*e.y;return(o!==1||a!==1)&&(s+=`scale(${o}, ${a})`),s||"none"}const Hc=(t,e)=>t.depth-e.depth;class Gc{constructor(){this.children=[],this.isDirty=!1}add(e){en(this.children,e),this.isDirty=!0}remove(e){nn(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Hc),this.isDirty=!1,this.children.forEach(e)}}function Kc(t){window.MotionDebug&&window.MotionDebug.record(t)}const cs=["","X","Y","Z"],ls=1e3;let Zc=0;const st={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function Bi({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o,a={},c=e==null?void 0:e()){this.id=Zc++,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.potentialNodes=new Map,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{st.totalNodes=st.resolvedTargetDeltas=st.recalculatedProjection=0,this.nodes.forEach(Xc),this.nodes.forEach(el),this.nodes.forEach(nl),this.nodes.forEach(Jc),Kc(st)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.elementId=o,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0,o&&this.root.registerPotentialNode(o,this);for(let l=0;lthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=Pi(h,250),yt.hasAnimatedSinceResize&&(yt.hasAnimatedSinceResize=!1,this.nodes.forEach(fs))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&u&&(c||l)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:d,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||u.getDefaultTransition()||al,{onLayoutAnimationStart:T,onLayoutAnimationComplete:b}=u.getProps(),x=!this.targetLayout||!Ue(this.targetLayout,p)||d,y=!h&&d;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,y);const v={...Ti(g,"layout"),onPlay:T,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v)}else!h&&this.animationProgress===0&&fs(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,J.preRender(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(sl),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(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 u=0;u{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 c=0;c{const S=v/1e3;hs(f.x,o.x,S),hs(f.y,o.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Pt(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ol(this.relativeTarget,this.relativeTargetOrigin,h,S),y&&Ue(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=V()),F(y,this.relativeTarget)),g&&(this.animationValues=u,Oc(u,l,this.latestValues,S,x,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(J.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=R.update(()=>{yt.hasAnimatedSinceResize=!0,this.currentAnimation=Fc(0,ls,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.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 o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ls),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:c,layout:l,latestValues:u}=o;if(!(!a||!c||!l)){if(this!==o&&this.layout&&l&&Fi(this.options.animationType,this.layout.layoutBox,l.layoutBox)){c=this.target||V();const f=j(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+f;const h=j(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+h}F(a,c),ft(a,u),bt(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Wc),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:c}={}){const l=this.getStack();l&&l.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:c}=o;if((c.rotate||c.rotateX||c.rotateY||c.rotateZ)&&(a=!0),!a)return;const l={};for(let u=0;u{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(us),this.root.sharedNodes.clear()}}}function qc(t){t.updateLayout()}function Yc(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:i}=t.layout,{animationType:r}=t.options,o=n.source!==t.layout.source;r==="size"?U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=j(h);h.min=s[f].min,h.max=h.min+d}):Fi(r,n.layoutBox,s)&&U(f=>{const h=o?n.measuredBox[f]:n.layoutBox[f],d=j(s[f]);h.max=h.min+d});const a=Tt();bt(a,s,n.layoutBox);const c=Tt();o?bt(c,t.applyTransform(i,!0),n.measuredBox):bt(c,s,n.layoutBox);const l=!ji(a);let u=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:d}=f;if(h&&d){const p=V();Pt(p,n.layoutBox,h.layoutBox);const g=V();Pt(g,s,d.layoutBox),Ue(p,g)||(u=!0),f.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=p,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:n,delta:c,layoutDelta:a,hasLayoutChanged:l,hasRelativeTargetChanged:u})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function Xc(t){st.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jc(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Qc(t){t.clearSnapshot()}function us(t){t.clearMeasurements()}function tl(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function fs(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0}function el(t){t.resolveTargetDelta()}function nl(t){t.calcProjection()}function sl(t){t.resetRotation()}function il(t){t.removeLeadSnapshot()}function hs(t,e,n){t.translate=A(e.translate,0,n),t.scale=A(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function ds(t,e,n,s){t.min=A(e.min,n.min,s),t.max=A(e.max,n.max,s)}function ol(t,e,n,s){ds(t.x,e.x,n.x,s),ds(t.y,e.y,n.y,s)}function rl(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const al={duration:.45,ease:[.4,0,.1,1]};function cl(t,e){let n=t.root;for(let r=t.path.length-1;r>=0;r--)if(Boolean(t.path[r].instance)){n=t.path[r];break}const i=(n&&n!==t.root?n.instance:document).querySelector(`[data-projection-id="${e}"]`);i&&t.mount(i,!0)}function ps(t){t.min=Math.round(t.min),t.max=Math.round(t.max)}function ll(t){ps(t.x),ps(t.y)}function Fi(t,e,n){return t==="position"||t==="preserve-aspect"&&!Be(rs(e),rs(n),.2)}const ul=Bi({attachResizeListener:(t,e)=>$(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),be={current:void 0},Ii=Bi({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!be.current){const t=new ul(0,{});t.mount(window),t.setOptions({layoutScroll:!0}),be.current=t}return be.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>Boolean(window.getComputedStyle(t).position==="fixed")}),fl={pan:{Feature:wc},drag:{Feature:Vc,ProjectionNode:Ii,MeasureLayout:Ei}},hl=new Set(["width","height","top","left","right","bottom","x","y"]),Oi=t=>hl.has(t),dl=t=>Object.keys(t).some(Oi),ms=t=>t===rt||t===P,gs=(t,e)=>parseFloat(t.split(", ")[e]),ys=(t,e)=>(n,{transform:s})=>{if(s==="none"||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/);if(i)return gs(i[1],e);{const r=s.match(/^matrix\((.+)\)$/);return r?gs(r[1],t):0}},pl=new Set(["x","y","z"]),ml=se.filter(t=>!pl.has(t));function gl(t){const e=[];return ml.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}const vs={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:ys(4,13),y:ys(5,14)},yl=(t,e,n)=>{const s=e.measureViewportBox(),i=e.current,r=getComputedStyle(i),{display:o}=r,a={};o==="none"&&e.setStaticValue("display",t.display||"block"),n.forEach(l=>{a[l]=vs[l](s,r)}),e.render();const c=e.measureViewportBox();return n.forEach(l=>{const u=e.getValue(l);u&&u.jump(a[l]),t[l]=vs[l](c,r)}),t},vl=(t,e,n={},s={})=>{e={...e},s={...s};const i=Object.keys(e).filter(Oi);let r=[],o=!1;const a=[];if(i.forEach(c=>{const l=t.getValue(c);if(!t.hasValue(c))return;let u=n[c],f=pt(u);const h=e[c];let d;if(Gt(h)){const p=h.length,g=h[0]===null?1:0;u=h[g],f=pt(u);for(let T=g;T=0?window.pageYOffset:null,l=yl(e,t,a);return r.length&&r.forEach(([u,f])=>{t.getValue(u).set(f)}),t.render(),te&&c!==null&&window.scrollTo({top:c}),{target:l,transitionEnd:s}}else return{target:e,transitionEnd:s}};function xl(t,e,n,s){return dl(e)?vl(t,e,n,s):{target:e,transitionEnd:s}}const bl=(t,e,n,s)=>{const i=Lc(t,e,s);return e=i.target,s=i.transitionEnd,xl(t,e,n,s)},_e={current:null},Ni={current:!1};function Pl(){if(Ni.current=!0,!!te)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>_e.current=t.matches;t.addListener(e),e()}else _e.current=!1}function Tl(t,e,n){const{willChange:s}=e;for(const i in e){const r=e[i],o=n[i];if(k(r))t.addValue(i,r),Zt(s)&&s.add(i);else if(k(o))t.addValue(i,dt(r,{owner:t})),Zt(s)&&s.remove(i);else if(o!==r)if(t.hasValue(i)){const a=t.getValue(i);!a.hasAnimated&&a.set(r)}else{const a=t.getStaticValue(i);t.addValue(i,dt(a!==void 0?a:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const Ui=Object.keys(St),Cl=Ui.length,xs=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Sl=We.length;class Al{constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:i,visualState:r},o={}){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=()=>R.render(this.render,!1,!0);const{latestValues:a,renderState:c}=r;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=c,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.isControllingVariants=ne(n),this.isVariantNode=Ls(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:l,...u}=this.scrapeMotionValuesFromProps(n,{});for(const f in u){const h=u[f];a[f]!==void 0&&k(h)&&(h.set(a[f],!1),Zt(l)&&l.add(f))}}scrapeMotionValuesFromProps(e,n){return{}}mount(e){this.current=e,this.projection&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),Ni.current||Pl(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:_e.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),J.update(this.notifyUpdate),J.render(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,n){const s=ot.has(e),i=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&R.update(this.notifyUpdate,!1,!0),s&&this.projection&&(this.projection.isTransformDirty=!0)}),r=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),r()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...n},s,i,r,o){let a,c;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:d,layoutRoot:p})}return c}updateFeatures(){for(const e in this.features){const n=this.features[e];n.isMounted?n.update(this.props,this.prevProps):(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):V()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}makeTargetAnimatable(e,n=!0){return this.makeTargetAnimatableFromInstance(e,this.props,n)}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;sn.variantChildren.delete(e)}addValue(e,n){n!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,n)),this.values.set(e,n),this.latestValues[e]=n.get()}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=dt(n,{owner:this}),this.addValue(e,s)),s}readValue(e){return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:s}=this.props,i=typeof s=="string"||typeof s=="object"?(n=tn(this.props,s))===null||n===void 0?void 0:n[e]:void 0;if(s&&i!==void 0)return i;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!k(r)?r:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new sn),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class _i extends Al{sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:n,...s},{transformValues:i},r){let o=Gr(s,e||{},this);if(i&&(n&&(n=i(n)),s&&(s=i(s)),o&&(o=i(o))),r){Wr(this,s,o);const a=bl(this,s,o,n);n=a.transitionEnd,s=a.target}return{transition:e,transitionEnd:n,...s}}}function Vl(t){return window.getComputedStyle(t)}class wl extends _i{readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}else{const s=Vl(e),i=(Fs(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Di(e,n)}build(e,n,s,i){Ze(e,n,s,i.transformTemplate)}scrapeMotionValuesFromProps(e,n){return Qe(e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;k(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(e,n,s,i){_s(e,n,s,i)}}class Ml extends _i{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(ot.has(n)){const s=an(n);return s&&s.default||0}return n=zs.has(n)?n:Je(n),e.getAttribute(n)}measureInstanceViewportBox(){return V()}scrapeMotionValuesFromProps(e,n){return Ws(e,n)}build(e,n,s,i){Ye(e,n,s,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,s,i){$s(e,n,s,i)}mount(e){this.isSVGTag=Xe(e.tagName),super.mount(e)}}const Dl=(t,e)=>Ke(t)?new Ml(e,{enableHardwareAcceleration:!1}):new wl(e,{enableHardwareAcceleration:!0}),Rl={layout:{ProjectionNode:Ii,MeasureLayout:Ei}},El={...rc,...vr,...fl,...Rl},Ll=Eo((t,e)=>or(t,e,El,Dl));function zi(){const t=m.useRef(!1);return $t(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function kl(){const t=zi(),[e,n]=m.useState(0),s=m.useCallback(()=>{t.current&&n(e+1)},[e]);return[m.useCallback(()=>R.postRender(s),[s]),e]}class jl extends m.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const s=this.props.sizeRef.current;s.height=n.offsetHeight||0,s.width=n.offsetWidth||0,s.top=n.offsetTop,s.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Bl({children:t,isPresent:e}){const n=m.useId(),s=m.useRef(null),i=m.useRef({width:0,height:0,top:0,left:0});return m.useInsertionEffect(()=>{const{width:r,height:o,top:a,left:c}=i.current;if(e||!s.current||!r||!o)return;s.current.dataset.motionPopId=n;const l=document.createElement("style");return document.head.appendChild(l),l.sheet&&l.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${r}px !important; diff --git a/invokeai/frontend/web/dist/index.html b/invokeai/frontend/web/dist/index.html index d8aa3ec535..f06d0591ef 100644 --- a/invokeai/frontend/web/dist/index.html +++ b/invokeai/frontend/web/dist/index.html @@ -12,7 +12,7 @@ margin: 0; } - + diff --git a/invokeai/frontend/web/dist/locales/en.json b/invokeai/frontend/web/dist/locales/en.json index 3b6faf8497..5d6eb56e3e 100644 --- a/invokeai/frontend/web/dist/locales/en.json +++ b/invokeai/frontend/web/dist/locales/en.json @@ -1,7 +1,25 @@ { "accessibility": { "modelSelect": "Model Select", - "invokeProgressBar": "Invoke progress bar" + "invokeProgressBar": "Invoke progress bar", + "reset": "Reset", + "uploadImage": "Upload Image", + "previousImage": "Previous Image", + "nextImage": "Next Image", + "useThisParameter": "Use this parameter", + "copyMetadataJson": "Copy metadata JSON", + "exitViewer": "ExitViewer", + "zoomIn": "Zoom In", + "zoomOut": "Zoom Out", + "rotateCounterClockwise": "Rotate Counter-Clockwise", + "rotateClockwise": "Rotate Clockwise", + "flipHorizontally": "Flip Horizontally", + "flipVertically": "Flip Vertically", + "modifyConfig": "Modify Config", + "toggleAutoscroll": "Toggle autoscroll", + "toggleLogViewer": "Toggle Log Viewer", + "showGallery": "Show Gallery", + "showOptionsPanel": "Show Options Panel" }, "common": { "hotkeysLabel": "Hotkeys", diff --git a/invokeai/frontend/web/stats.html b/invokeai/frontend/web/stats.html index 8cb440de4b..59d6d9930b 100644 --- a/invokeai/frontend/web/stats.html +++ b/invokeai/frontend/web/stats.html @@ -6157,7 +6157,7 @@ var drawChart = (function (exports) {