@fungi.computer/prints 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/data-list-C-84r4-E.js +1 -0
- package/dist/assets/index-DVcnPTd7.js +10 -0
- package/dist/assets/log-event-Bq77BTZs.js +1 -0
- package/dist/assets/media-CV91GU1z.js +76 -0
- package/dist/assets/{print-download-button-D0u-jIIO.js → print-download-button-kcfgBeuV.js} +3 -3
- package/dist/assets/print-info-drawer-DQEdoQYi.js +2 -0
- package/dist/index.html +4 -4
- package/package.json +8 -8
- package/dist/assets/data-list-CKVz4p0-.js +0 -1
- package/dist/assets/index-Of5wM-hn.js +0 -10
- package/dist/assets/log-event-Bm3IKl9o.js +0 -1
- package/dist/assets/media-UoClPlTr.js +0 -76
- package/dist/assets/print-info-drawer-BJccZZSi.js +0 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./print-download-button-kcfgBeuV.js","./rolldown-runtime-hePW80VL.js","./media-CV91GU1z.js","./log-event-Bq77BTZs.js","./modules-C4mfDnjH.js","./print-info-drawer-DQEdoQYi.js","./data-list-C-84r4-E.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$ as n,$n as r,$t as i,A as a,An as o,Ar as s,At as c,B as l,Bn as u,Br as d,Bt as f,C as p,Cn as m,Cr as h,D as g,Dn as _,Dr as v,E as y,En as b,Er as x,F as S,Fn as C,Fr as w,Ft as T,G as E,Gn as D,Gr as O,Gt as k,H as A,Hn as j,Hr as M,Ht as N,I as P,In as F,Ir as I,It as L,J as R,Jt as z,K as B,Kn as V,Kt as H,L as ee,Lr as te,Lt as U,M as W,Mn as ne,Mr as re,N as ie,Nn as ae,Nr as oe,O as se,On as ce,Or as le,Ot as ue,P as de,Pn as fe,Pr as G,Q as pe,Qt as me,R as he,Rr as ge,Rt as K,S as _e,Sn as ve,Sr as ye,T as be,Tn as xe,Tr as Se,Tt as Ce,U as we,Un as Te,Ur as Ee,Ut as De,V as Oe,Vn as ke,Vr as Ae,Vt as je,W as Me,Wn as Ne,Wr as Pe,Wt as Fe,X as Ie,Xt as Le,Y as Re,Yt as ze,Z as Be,Zt as Ve,_ as He,_n as Ue,_r as We,an as Ge,ar as Ke,b as qe,bn as Je,c as Ye,cn as Xe,cr as Ze,d as Qe,dn as $e,dr as et,dt as tt,en as nt,er as rt,et as it,fr as at,gn as ot,gr as st,hn as ct,hr as lt,i as ut,in as dt,ir as ft,it as pt,j as mt,jn as ht,k as gt,kn as _t,kr as vt,l as yt,lr as bt,mn as xt,mr as St,n as Ct,nn as wt,nr as Tt,nt as Et,on as Dt,or as Ot,pn as kt,pr as At,pt as jt,q as Mt,qt as Nt,r as Pt,rn as Ft,rr as It,rt as Lt,s as Rt,sr as zt,tt as Bt,u as q,un as Vt,ur as Ht,v as Ut,vr as Wt,w as Gt,wn as Kt,wr as qt,x as Jt,xn as Yt,xr as Xt,y as Zt,yn as Qt,yr as $t,z as en,zr as tn,zt as nn}from"./media-CV91GU1z.js";import{a as rn,c as an,i as on,l as sn,n as cn,o as ln,r as un,s as dn,t as fn,u as pn}from"./log-event-Bq77BTZs.js";import{$ as mn,A as hn,At as gn,B as _n,Bt as vn,C as yn,Ct as bn,D as xn,Dt as Sn,E as Cn,Et as wn,F as Tn,Ft as En,G as Dn,H as On,Ht as kn,I as An,It as jn,J as Mn,K as Nn,L as Pn,Lt as Fn,M as In,Mt as Ln,N as Rn,Nt as zn,Ot as Bn,P as Vn,Pt as Hn,Q as Un,R as Wn,Rt as Gn,S as Kn,St as qn,T as Jn,Tt as Yn,U as Xn,Ut as Zn,V as Qn,Vt as $n,W as er,Wt as tr,X as nr,Y as rr,Z as ir,_ as ar,_t as or,a as sr,at as cr,b as lr,bt as ur,ct as dr,d as fr,dt as pr,et as mr,f as hr,ft as gr,g as _r,gt as vr,h as yr,ht as br,i as xr,it as Sr,j as Cr,jt as wr,kt as Tr,l as Er,lt as Dr,m as Or,mt as kr,n as Ar,nt as jr,o as Mr,ot as Nr,p as Pr,pt as Fr,q as Ir,rt as Lr,s as Rr,st as zr,tt as Br,u as Vr,ut as Hr,v as Ur,vt as Wr,w as Gr,wt as Kr,x as qr,xt as Jr,y as Yr,yt as Xr,z as Zr,zt as Qr}from"./data-list-C-84r4-E.js";import{r as $r}from"./modules-C4mfDnjH.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var J=e(O(),1),ei=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},ti=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function ni(){let e=!1,t=Fi,n=[],r=[],i=!1,a=[],o=new Set,s=()=>{for(let e of o)e()};return Object.freeze({close:()=>{e||(e=!0,n=[],a=[],r=[],t=Fi,s(),o.clear())},contribute:t=>{if(di(t),e)throw new ti;fi(t,n),pi(t,n);let r=Symbol(`whistle-contribution`);ui(t)||(n=[...n,{contribution:mi(t),generation:r}],i=!0,s());let a=!0;return Ni(o=>{if(!a||e)return;let c={...t,commands:o};di(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);fi(c,u),pi(c,u);let d=mi(c);if(ui(c)){if(l<0)return;n=u}else n=l<0?[...n,{contribution:d,generation:r}]:n.map(e=>e.generation===r?{contribution:d,generation:r}:e);i=!0,s()},()=>{a&&(a=!1,n.find(e=>e.generation===r)!==void 0&&(n=n.filter(e=>e.generation!==r),i=!0,s()))})},execute:async(t,r)=>{if(t.namespace.trim().length===0||t.id.trim().length===0)return{status:`invalid`};if(e)return{status:`closed`};let i=li(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=Li(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&ri.has(r.origin)&&(o=n({commandId:ci(t.namespace,t.id),title:i.title}));let s={...r,signal:r.signal??new AbortController().signal};o!==void 0&&(s.interaction=o.interaction,s.signal=AbortSignal.any([s.signal,o.interaction.signal]));let c=await i.handler(s);return o?.settle({status:`handled`}),c===void 0?{status:`handled`}:{status:`handled`,result:c}}catch(e){let t=zi(e instanceof Error?e:Error(`Command handler threw a non-Error value`));return o?.settle(o.interaction.signal.aborted?{status:`cancelled`}:{status:`failed`,message:t.message}),{status:`failed`,error:t}}},present:t=>{let n={presenter:t};return e||(a=[...a,n]),()=>{a=a.filter(e=>e!==n)}},snapshot:()=>{if(e)return Fi;let a=n.flatMap(e=>e.contribution.commands.map(Li));return(i||a.some((e,t)=>!Ri(e,r[t])))&&(t=Bi(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var ri=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),ii=16,ai=32,oi=64,si=256;function ci(e,t){return It.parse(`${e}:${t}`)}function li(e,t){for(let n of t)if(n.contribution.namespace===e.namespace){for(let t of n.contribution.commands)if(t.id===e.id)return t}}function ui(e){return e.commands.length===0}function di(e){ji(e.sourceId,`source ID`),ji(e.namespace,`namespace`),e.scope!==void 0&&ji(e.scope,`scope`);for(let t of e.commands)Ei(t)}function fi(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&Pi(`Namespace is already owned by another source`);let n=new Set,r=new Set;for(let i of t){let t=i.contribution.scope===e.scope;for(let e of i.contribution.commands)if(n.add(ci(i.contribution.namespace,e.id)),t)for(let t of e.projections?.slash?.aliases??[])r.add(t)}for(let t of e.commands){let i=ci(e.namespace,t.id);n.has(i)&&Pi(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&Pi(`Slash alias is already registered`),r.add(e)}}function pi(e,t){t.length>=oi&&Pi(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>si&&Pi(`Live command capacity exceeded`)}function mi(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(hi)};return e.scope===void 0?t:{...t,scope:e.scope}}function hi(e){let t={id:e.id,title:e.title,category:e.category,handler:e.handler};return e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=gi(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=bi(e.projections)),t}function gi(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=_i(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=_i(e.outputSchema)),e.presentation!==void 0&&(t.presentation=yi(e.presentation)),Object.freeze(t)}function _i(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,vi(t)])))}function vi(e){return Array.isArray(e)?Object.freeze(e.map(vi)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,vi(t)]))):e}function yi(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:_i(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:vi(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function bi(e){let t={};return e.bindings!==void 0&&(t.bindings=xi(e.bindings)),e.agent!==void 0&&(t.agent=Si(e.agent)),e.help!==void 0&&(t.help=Ci(e.help.order)),e.menu!==void 0&&(t.menu=Ci(e.menu.order)),e.palette!==void 0&&(t.palette=Ci(e.palette.order)),e.slash!==void 0&&(t.slash=wi(e.slash)),t}function xi(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function Si(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function Ci(e){let t={};return e!==void 0&&(t.order=e),t}function wi(e){let t={aliases:[...e.aliases]};return e.order!==void 0&&(t.order=e.order),e.consumesDraft!==void 0&&(t.consumesDraft=e.consumesDraft),e.arguments!==void 0&&(t.arguments=Ti(e.arguments)),t}function Ti(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:_i(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:_i(e.text.arguments)})),Object.freeze(t)}function Ei(e){ji(e.id,`command ID`,!0),ji(e.title,`title`),ji(e.category,`category`),Di(e.action),Oi(e.projections)}function Di(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)ji(t.label,`choice label`),t.description!==void 0&&ji(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&ji(e.presentation.submitLabel,`submit label`);return;case`confirmation`:ji(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&ji(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&ji(e.presentation.cancelLabel,`cancellation label`)}}function Oi(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&Mi(t.order);if(e.bindings!==void 0&&Ai(e.bindings.values,`binding`),e.slash!==void 0){Ai(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&Pi(`slash alias must not contain whitespace`);ki(e.slash.arguments)}e.agent?.keybind!==void 0&&ji(e.agent.keybind,`agent keybind`)}}function ki(e){if(e===void 0)return;ji(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&Pi(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])ji(n.word,`argument word`),/\s/u.test(n.word)&&Pi(`argument word must not contain whitespace`),t.has(n.word)&&Pi(`argument word is repeated`),t.add(n.word),n.description!==void 0&&ji(n.description,`argument word description`);t.size>ai&&Pi(`argument word count exceeds 32`),e.text!==void 0&&(ji(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&ji(e.text.requestIdField,`request id field`))}function Ai(e,t){e.length>ii&&Pi(`${t} count exceeds 16`);for(let n of e)ji(n,t)}function ji(e,t,n=!1){e.trim().length===0&&Pi(`${t} must not be blank`),n&&e.includes(`:`)&&Pi(`${t} must not contain a colon`)}function Mi(e){e!==void 0&&!Number.isSafeInteger(e)&&Pi(`order must be a safe integer`)}function Ni(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function Pi(e){throw Error(e)}var Fi=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),Ii=Object.freeze({status:`available`});function Li(e){let t=e.availability?.()??Ii;return t.status===`available`?Ii:Object.freeze({status:`unavailable`,reason:t.reason})}function Ri(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function zi(e){if(e instanceof ei){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:vi(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function Bi(e,t){let n=[],r=[],i=[],a=[],o=[],s=[],c=0;for(let l of e){let e=l.contribution;for(let l of e.commands){let u=l.projections,d=t[c++]??Ii;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...qi(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...qi(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...qi(e,l,u.slash.order,d),alias:t};u.slash.consumesDraft!==void 0&&(n={...n,consumesDraft:u.slash.consumesDraft}),u.slash.arguments!==void 0&&(n={...n,arguments:u.slash.arguments}),i.push(n)}u?.help!==void 0&&a.push({...qi(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...qi(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(Yi(e,l,u.agent,d))}}return Wi(n),Gi(i),Ui(r),Ui(a),Ui(o),Ui(s),Object.freeze({bindings:Ki(n),palette:Ki(r),slash:Ki(i),help:Ki(a),menu:Ki(o),agent:Ki(s)})}var Vi=new TextEncoder;function Hi(e,t){let n=Vi.encode(e),r=Vi.encode(t),i=Math.min(n.length,r.length);for(let e=0;e<i;e+=1){let t=n[e]??0,i=r[e]??0;if(t!==i)return t<i?-1:1}return n.length<r.length?-1:+(n.length>r.length)}function Ui(e){e.sort((e,t)=>e.order-t.order||Hi(e.commandId,t.commandId))}function Wi(e){e.sort((e,t)=>e.order-t.order||Hi(e.commandId,t.commandId)||Hi(e.binding,t.binding))}function Gi(e){e.sort((e,t)=>e.order-t.order||Hi(e.commandId,t.commandId)||Hi(e.alias,t.alias))}function Ki(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function qi(e,t,n,r){let i=Ji(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function Ji(e,t,n,r){let i={commandId:ci(e.namespace,t.id),command:Object.freeze({namespace:e.namespace,id:t.id}),sourceId:e.sourceId,title:t.title,category:t.category,order:n??0,availability:r},a=t.description===void 0?i:{...i,description:t.description};return t.action===void 0?a:{...a,action:t.action}}function Yi(e,t,n,r){let i=qi(e,t,n.order,r),a=i.action===void 0?i:{...i,action:Xi(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function Xi(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}function Zi(e,t){let n=!1,r=[];for(let i of t){let{availability:t,handler:a,...o}=i,s=a,c=t===void 0?o:{...o,availability:t()};e.register(c,async({arguments:e,origin:t,signal:n})=>{let r=await s(e===void 0?{origin:t,signal:n}:{arguments:e,origin:t,signal:n});return r===void 0?void 0:Ke(r)}).then(e=>{n?e():r.push(e)},e=>{console.warn(`App command ${i.id} was not registered`,e)})}return()=>{if(!n){n=!0;for(let e of r.splice(0))e()}}}$t(`light.dark.latte.mocha.readout.readout-night.field-guide.field-guide-night.embed.embed-dark.phosphor.codec.paper.ember.tide.tape.sunrise.pirate-radio.pirate-radio-night.consulting.consulting-ink.consulting-night.consulting-night-ink.consulting-riso-latte.consulting-riso-latte-ink.consulting-riso-glomzy.consulting-riso-glomzy-ink.vishnu.coin.coin-night.chamfer`.split(`.`));var Qi=`data-theme`;function $i(e){return e||(globalThis.document?.documentElement??null)}function ea(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function ta(e,t){let n=ea(e),r=$i(t);r&&r.setAttribute(Qi,n)}function na(e){return $i(e)?.getAttribute(Qi)??null}var ra=class extends kn{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Zn(t,n.data),hasPreviousPage:tr(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function ia(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var aa=class extends jt{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,tt.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!c(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ia(e,n).forEach(e=>{e.destroy()}),ia(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=ue(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new kn(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&tt.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}};function oa({queries:e,...t},n){let r=L(n),i=$n(),a=vn(),o=t.subscribed!==!1,s=J.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{Hn(e);let t=r.getQueryCache().get(e.queryHash);Fn(e,a,t)}),Qr(a);let[c]=J.useState(()=>new aa(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;J.useSyncExternalStore(J.useCallback(e=>f?c.subscribe(tt.batchCalls(e)):Ce,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),J.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>jn(s[t],e))?l.flatMap((e,t)=>{let n=s[t];if(n&&jn(n,e)){let e=new kn(r,n);return En(n,e,a)}return[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&Gn({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m)throw m.error;return u(d())}function sa(e){return e}function ca(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function la(e={},t){let n=L(t).getMutationCache(),r=J.useRef(e),i=J.useRef(null);return i.current===null&&(i.current=ca(n,e)),J.useEffect(()=>{r.current=e}),J.useSyncExternalStore(J.useCallback(e=>n.subscribe(()=>{let t=ue(i.current,ca(n,r.current));i.current!==t&&(i.current=t,tt.schedule(e))}),[n]),()=>i.current,()=>i.current)}function ua(e,t){return zn(e,ra,t)}var da=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m){if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,M(x))},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),fa=t(((e,t)=>{t.exports=da()})),pa=t((e=>{var t=O(),n=fa();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n]);return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function p(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function m(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function h(e,t,n,r){if(t==null||m(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function g(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var _={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){_[e]=new g(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];_[t]=new g(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){_[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){_[e]=new g(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){_[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){_[e]=new g(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){_[e]=new g(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){_[e]=new g(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){_[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(v,y);_[t]=new g(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),_.xlinkHref=new g(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){_[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});function b(e,t,n,r){var i=_.hasOwnProperty(t)?_[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(h(t,n,i,r)&&(n=null),r||i===null?p(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type!==3&&``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,S=Symbol.for(`react.element`),C=Symbol.for(`react.portal`),w=Symbol.for(`react.fragment`),T=Symbol.for(`react.strict_mode`),E=Symbol.for(`react.profiler`),D=Symbol.for(`react.provider`),k=Symbol.for(`react.context`),A=Symbol.for(`react.forward_ref`),j=Symbol.for(`react.suspense`),M=Symbol.for(`react.suspense_list`),N=Symbol.for(`react.memo`),P=Symbol.for(`react.lazy`),F=Symbol.for(`react.offscreen`),I=Symbol.iterator;function L(e){return typeof e!=`object`||!e?null:(e=I&&e[I]||e[`@@iterator`],typeof e==`function`?e:null)}var R=Object.assign,z;function B(e){if(z===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);z=t&&t[1]||``}return`
|
|
3
|
+
`+z+e}var V=!1;function H(e,t){if(!e||V)return``;V=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
4
|
+
`),a=r.stack.split(`
|
|
5
|
+
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
6
|
+
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{V=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?B(e):``}function ee(e){switch(e.tag){case 5:return B(e.type);case 16:return B(`Lazy`);case 13:return B(`Suspense`);case 19:return B(`SuspenseList`);case 0:case 2:case 15:return e=H(e.type,!1),e;case 11:return e=H(e.type.render,!1),e;case 1:return e=H(e.type,!0),e;default:return``}}function te(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case w:return`Fragment`;case C:return`Portal`;case E:return`Profiler`;case T:return`StrictMode`;case j:return`Suspense`;case M:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case k:return(e.displayName||`Context`)+`.Consumer`;case D:return(e._context.displayName||`Context`)+`.Provider`;case A:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case N:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case P:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}function U(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return te(t);case 8:return t===T?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function W(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ne(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function re(e){var t=ne(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ie(e){e._valueTracker||=re(e)}function ae(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ne(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function oe(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function se(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ce(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=W(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function le(e,t){t=t.checked,t!=null&&b(e,`checked`,t,!1)}function ue(e,t){le(e,t);var n=W(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?fe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&fe(e,t.type,W(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function de(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function fe(e,t,n){(t!==`number`||oe(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var G=Array.isArray;function pe(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+W(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function me(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return R({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function he(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(G(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:W(n)}}function ge(e,t){var n=W(t.value),r=W(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function K(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function _e(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function ve(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?_e(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var ye,be=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(ye||=document.createElement(`div`),ye.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=ye.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Se={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ce=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Se).forEach(function(e){Ce.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Se[t]=Se[e]})});function we(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Se.hasOwnProperty(e)&&Se[e]?(``+t).trim():t+`px`}function Te(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=we(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ee=R({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function De(e,t){if(t){if(Ee[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Oe(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var ke=null;function Ae(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var je=null,Me=null,Ne=null;function Pe(e){if(e=Ni(e)){if(typeof je!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Fi(t),je(e.stateNode,e.type,t))}}function Fe(e){Me?Ne?Ne.push(e):Ne=[e]:Me=e}function Ie(){if(Me){var e=Me,t=Ne;if(Ne=Me=null,Pe(e),t)for(e=0;e<t.length;e++)Pe(t[e])}}function Le(e,t){return e(t)}function Re(){}var ze=!1;function Be(e,t,n){if(ze)return e(t,n);ze=!0;try{return Le(e,t,n)}finally{ze=!1,(Me!==null||Ne!==null)&&(Re(),Ie())}}function Ve(e,t){var n=e.stateNode;if(n===null)return null;var i=Fi(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var He=!1;if(c)try{var Ue={};Object.defineProperty(Ue,"passive",{get:function(){He=!0}}),window.addEventListener(`test`,Ue,Ue),window.removeEventListener(`test`,Ue,Ue)}catch{He=!1}function We(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Ge=!1,Ke=null,qe=!1,Je=null,Ye={onError:function(e){Ge=!0,Ke=e}};function Xe(e,t,n,r,i,a,o,s,c){Ge=!1,Ke=null,We.apply(Ye,arguments)}function Ze(e,t,n,i,a,o,s,c,l){if(Xe.apply(this,arguments),Ge){if(Ge){var u=Ke;Ge=!1,Ke=null}else throw Error(r(198));qe||(qe=!0,Je=u)}}function Qe(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function $e(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function et(e){if(Qe(e)!==e)throw Error(r(188))}function tt(e){var t=e.alternate;if(!t){if(t=Qe(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return et(a),e;if(o===i)return et(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function nt(e){return e=tt(e),e===null?null:rt(e)}function rt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=rt(e);if(t!==null)return t;e=e.sibling}return null}var it=n.unstable_scheduleCallback,at=n.unstable_cancelCallback,ot=n.unstable_shouldYield,st=n.unstable_requestPaint,ct=n.unstable_now,lt=n.unstable_getCurrentPriorityLevel,ut=n.unstable_ImmediatePriority,dt=n.unstable_UserBlockingPriority,ft=n.unstable_NormalPriority,pt=n.unstable_LowPriority,mt=n.unstable_IdlePriority,ht=null,gt=null;function _t(e){if(gt&&typeof gt.onCommitFiberRoot==`function`)try{gt.onCommitFiberRoot(ht,e,void 0,(e.current.flags&128)==128)}catch{}}var vt=Math.clz32?Math.clz32:xt,yt=Math.log,bt=Math.LN2;function xt(e){return e>>>=0,e===0?32:31-(yt(e)/bt|0)|0}var St=64,Ct=4194304;function wt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Tt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=wt(a))):r=wt(s)}else o=n&~i,o===0?a!==0&&(r=wt(a)):r=wt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-vt(t),i=1<<n,r|=e[n],t&=~i;return r}function Et(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Dt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-vt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Et(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Ot(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function kt(){var e=St;return St<<=1,!(St&4194240)&&(St=64),e}function At(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function jt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vt(t),e[t]=n}function Mt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-vt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Nt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-vt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Pt=0;function Ft(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var It,Lt,Rt,zt,Bt,q=!1,Vt=[],Ht=null,Ut=null,Wt=null,Gt=new Map,Kt=new Map,qt=[],Jt=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit`.split(` `);function Yt(e,t){switch(e){case`focusin`:case`focusout`:Ht=null;break;case`dragenter`:case`dragleave`:Ut=null;break;case`mouseover`:case`mouseout`:Wt=null;break;case`pointerover`:case`pointerout`:Gt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Kt.delete(t.pointerId)}}function Xt(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ni(t),t!==null&&Lt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Zt(e,t,n,r,i){switch(t){case`focusin`:return Ht=Xt(Ht,e,t,n,r,i),!0;case`dragenter`:return Ut=Xt(Ut,e,t,n,r,i),!0;case`mouseover`:return Wt=Xt(Wt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Gt.set(a,Xt(Gt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Kt.set(a,Xt(Kt.get(a)||null,e,t,n,r,i)),!0}return!1}function Qt(e){var t=Mi(e.target);if(t!==null){var n=Qe(t);if(n!==null){if(t=n.tag,t===13){if(t=$e(n),t!==null){e.blockedOn=t,Bt(e.priority,function(){Rt(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function $t(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ke=r,n.target.dispatchEvent(r),ke=null}else return t=Ni(n),t!==null&&Lt(t),e.blockedOn=n,!1;t.shift()}return!0}function en(e,t,n){$t(e)&&n.delete(t)}function tn(){q=!1,Ht!==null&&$t(Ht)&&(Ht=null),Ut!==null&&$t(Ut)&&(Ut=null),Wt!==null&&$t(Wt)&&(Wt=null),Gt.forEach(en),Kt.forEach(en)}function nn(e,t){e.blockedOn===t&&(e.blockedOn=null,q||(q=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,tn)))}function rn(e){function t(t){return nn(t,e)}if(0<Vt.length){nn(Vt[0],e);for(var n=1;n<Vt.length;n++){var r=Vt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ht!==null&&nn(Ht,e),Ut!==null&&nn(Ut,e),Wt!==null&&nn(Wt,e),Gt.forEach(t),Kt.forEach(t),n=0;n<qt.length;n++)r=qt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<qt.length&&(n=qt[0],n.blockedOn===null);)Qt(n),n.blockedOn===null&&qt.shift()}var an=x.ReactCurrentBatchConfig,on=!0;function sn(e,t,n,r){var i=Pt,a=an.transition;an.transition=null;try{Pt=1,ln(e,t,n,r)}finally{Pt=i,an.transition=a}}function cn(e,t,n,r){var i=Pt,a=an.transition;an.transition=null;try{Pt=4,ln(e,t,n,r)}finally{Pt=i,an.transition=a}}function ln(e,t,n,r){if(on){var i=dn(e,t,n,r);if(i===null)ii(e,t,r,un,n),Yt(e,r);else if(Zt(i,e,t,n,r))r.stopPropagation();else if(Yt(e,r),t&4&&-1<Jt.indexOf(e)){for(;i!==null;){var a=Ni(i);if(a!==null&&It(a),a=dn(e,t,n,r),a===null&&ii(e,t,r,un,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else ii(e,t,r,null,n)}}var un=null;function dn(e,t,n,r){if(un=null,e=Ae(r),e=Mi(e),e!==null){if(t=Qe(e),t===null)e=null;else if(n=t.tag,n===13){if(e=$e(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return un=e,null}function fn(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(lt()){case ut:return 1;case dt:return 4;case ft:case pt:return 16;case mt:return 536870912;default:return 16}default:return 16}}var pn=null,mn=null,hn=null;function gn(){if(hn)return hn;var e,t=mn,n=t.length,r,i=`value`in pn?pn.value:pn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return hn=i.slice(e,1<r?1-r:void 0)}function _n(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function vn(){return!0}function yn(){return!1}function bn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?vn:yn,this.isPropagationStopped=yn,this}return R(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=vn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=vn)},persist:function(){},isPersistent:vn}),t}var xn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sn=bn(xn),Cn=R({},xn,{view:0,detail:0}),wn=bn(Cn),Tn,En,Dn,On=R({},Cn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Dn&&(Dn&&e.type===`mousemove`?(Tn=e.screenX-Dn.screenX,En=e.screenY-Dn.screenY):En=Tn=0,Dn=e),Tn)},movementY:function(e){return`movementY`in e?e.movementY:En}}),kn=bn(On),An=bn(R({},On,{dataTransfer:0})),jn=bn(R({},Cn,{relatedTarget:0})),Mn=bn(R({},xn,{animationName:0,elapsedTime:0,pseudoElement:0})),Nn=bn(R({},xn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Pn=bn(R({},xn,{data:0})),Fn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},In={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Ln={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Rn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ln[e])?!!t[e]:!1}function zn(){return Rn}var Bn=bn(R({},Cn,{key:function(e){if(e.key){var t=Fn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=_n(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?In[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zn,charCode:function(e){return e.type===`keypress`?_n(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?_n(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Vn=bn(R({},On,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Hn=bn(R({},Cn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zn})),Un=bn(R({},xn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Wn=bn(R({},On,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Gn=[9,13,27,32],Kn=c&&`CompositionEvent`in window,qn=null;c&&`documentMode`in document&&(qn=document.documentMode);var Jn=c&&`TextEvent`in window&&!qn,Yn=c&&(!Kn||qn&&8<qn&&11>=qn),Xn=` `,Zn=!1;function Qn(e,t){switch(e){case`keyup`:return Gn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function $n(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var er=!1;function tr(e,t){switch(e){case`compositionend`:return $n(t);case`keypress`:return t.which===32?(Zn=!0,Xn):null;case`textInput`:return e=t.data,e===Xn&&Zn?null:e;default:return null}}function nr(e,t){if(er)return e===`compositionend`||!Kn&&Qn(e,t)?(e=gn(),hn=mn=pn=null,er=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Yn&&t.locale!==`ko`?null:t.data;default:return null}}var rr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!rr[e.type]:t===`textarea`}function ar(e,t,n,r){Fe(r),t=oi(t,`onChange`),0<t.length&&(n=new Sn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var or=null,sr=null;function cr(e){$r(e,0)}function lr(e){if(ae(Pi(e)))return e}function ur(e,t){if(e===`change`)return t}var dr=!1;if(c){var fr;if(c){var pr=`oninput`in document;if(!pr){var mr=document.createElement(`div`);mr.setAttribute(`oninput`,`return;`),pr=typeof mr.oninput==`function`}fr=pr}else fr=!1;dr=fr&&(!document.documentMode||9<document.documentMode)}function hr(){or&&(or.detachEvent(`onpropertychange`,gr),sr=or=null)}function gr(e){if(e.propertyName===`value`&&lr(sr)){var t=[];ar(t,sr,e,Ae(e)),Be(cr,t)}}function _r(e,t,n){e===`focusin`?(hr(),or=t,sr=n,or.attachEvent(`onpropertychange`,gr)):e===`focusout`&&hr()}function vr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return lr(sr)}function yr(e,t){if(e===`click`)return lr(t)}function br(e,t){if(e===`input`||e===`change`)return lr(t)}function xr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Sr=typeof Object.is==`function`?Object.is:xr;function Cr(e,t){if(Sr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Sr(e[i],t[i]))return!1}return!0}function wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Tr(e,t){var n=wr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=wr(n)}}function Er(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Er(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Dr(){for(var e=window,t=oe();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=oe(e.document)}return t}function Or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function kr(e){var t=Dr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Er(n.ownerDocument.documentElement,n)){if(r!==null&&Or(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Tr(n,a);var o=Tr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ar=c&&`documentMode`in document&&11>=document.documentMode,jr=null,Mr=null,Nr=null,Pr=!1;function Fr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pr||jr==null||jr!==oe(r)||(r=jr,`selectionStart`in r&&Or(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Nr&&Cr(Nr,r)||(Nr=r,r=oi(Mr,`onSelect`),0<r.length&&(t=new Sn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=jr)))}function Ir(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Lr={animationend:Ir(`Animation`,`AnimationEnd`),animationiteration:Ir(`Animation`,`AnimationIteration`),animationstart:Ir(`Animation`,`AnimationStart`),transitionend:Ir(`Transition`,`TransitionEnd`)},Rr={},zr={};c&&(zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Lr.animationend.animation,delete Lr.animationiteration.animation,delete Lr.animationstart.animation),`TransitionEvent`in window||delete Lr.transitionend.transition);function Br(e){if(Rr[e])return Rr[e];if(!Lr[e])return e;var t=Lr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in zr)return Rr[e]=t[n];return e}var Vr=Br(`animationend`),Hr=Br(`animationiteration`),Ur=Br(`animationstart`),Wr=Br(`transitionend`),Gr=new Map,Kr=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function qr(e,t){Gr.set(e,t),o(t,[e])}for(var Jr=0;Jr<Kr.length;Jr++){var Yr=Kr[Jr];qr(Yr.toLowerCase(),`on`+(Yr[0].toUpperCase()+Yr.slice(1)))}qr(Vr,`onAnimationEnd`),qr(Hr,`onAnimationIteration`),qr(Ur,`onAnimationStart`),qr(`dblclick`,`onDoubleClick`),qr(`focusin`,`onFocus`),qr(`focusout`,`onBlur`),qr(Wr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Xr=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Zr=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(Xr));function Qr(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,Ze(r,t,void 0,e),e.currentTarget=null}function $r(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;Qr(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;Qr(i,s,l),a=c}}}if(qe)throw e=Je,qe=!1,Je=null,e}function J(e,t){var n=t[ki];n===void 0&&(n=t[ki]=new Set);var r=e+`__bubble`;n.has(r)||(ri(t,e,2,!1),n.add(r))}function ei(e,t,n){var r=0;t&&(r|=4),ri(n,e,r,t)}var ti=`_reactListening`+Math.random().toString(36).slice(2);function ni(e){if(!e[ti]){e[ti]=!0,i.forEach(function(t){t!==`selectionchange`&&(Zr.has(t)||ei(t,!1,e),ei(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ti]||(t[ti]=!0,ei(`selectionchange`,!1,t))}}function ri(e,t,n,r){switch(fn(t)){case 1:var i=sn;break;case 4:i=cn;break;default:i=ln}n=i.bind(null,t,n,e),i=void 0,!He||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function ii(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Mi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Be(function(){var r=a,i=Ae(n),o=[];a:{var s=Gr.get(e);if(s!==void 0){var c=Sn,l=e;switch(e){case`keypress`:if(_n(n)===0)break a;case`keydown`:case`keyup`:c=Bn;break;case`focusin`:l=`focus`,c=jn;break;case`focusout`:l=`blur`,c=jn;break;case`beforeblur`:case`afterblur`:c=jn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=kn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=An;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Hn;break;case Vr:case Hr:case Ur:c=Mn;break;case Wr:c=Un;break;case`scroll`:c=wn;break;case`wheel`:c=Wn;break;case`copy`:case`cut`:case`paste`:c=Nn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Vn}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Ve(p,f),h!=null&&u.push(ai(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==ke&&(l=n.relatedTarget||n.fromElement)&&(Mi(l)||l[Oi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Mi(l):null,l!==null&&(d=Qe(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=kn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Vn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Pi(c),m=l==null?s:Pi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Mi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=si(m))p++;for(m=0,h=f;h;h=si(h))m++;for(;0<p-m;)u=si(u),p--;for(;0<m-p;)f=si(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=si(u),f=si(f)}u=null}else u=null;c!==null&&ci(o,s,c,u,!1),l!==null&&d!==null&&ci(o,d,l,u,!0)}}a:{if(s=r?Pi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=ur;else if(ir(s)){if(dr)g=br;else{g=vr;var _=_r}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=yr);if(g&&=g(e,r)){ar(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&fe(s,`number`,s.value)}switch(_=r?Pi(r):window,e){case`focusin`:(ir(_)||_.contentEditable===`true`)&&(jr=_,Mr=r,Nr=null);break;case`focusout`:Nr=Mr=jr=null;break;case`mousedown`:Pr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Pr=!1,Fr(o,n,i);break;case`selectionchange`:if(Ar)break;case`keydown`:case`keyup`:Fr(o,n,i)}var v;if(Kn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else er?Qn(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(Yn&&n.locale!==`ko`&&(er||y!==`onCompositionStart`?y===`onCompositionEnd`&&er&&(v=gn()):(pn=i,mn=`value`in pn?pn.value:pn.textContent,er=!0)),_=oi(r,y),0<_.length&&(y=new Pn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=$n(n),v!==null&&(y.data=v)))),(v=Jn?tr(e,n):nr(e,n))&&(r=oi(r,`onBeforeInput`),0<r.length&&(i=new Pn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}$r(o,t)})}function ai(e,t,n){return{instance:e,listener:t,currentTarget:n}}function oi(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Ve(e,n),a!=null&&r.unshift(ai(e,a,i)),a=Ve(e,t),a!=null&&r.push(ai(e,a,i))),e=e.return}return r}function si(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ci(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Ve(n,a),c!=null&&o.unshift(ai(n,c,s))):i||(c=Ve(n,a),c!=null&&o.push(ai(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var li=/\r\n?/g,ui=/\u0000|\uFFFD/g;function di(e){return(typeof e==`string`?e:``+e).replace(li,`
|
|
7
|
+
`).replace(ui,``)}function fi(e,t,n){if(t=di(t),di(e)!==t&&n)throw Error(r(425))}function pi(){}var mi=null,hi=null;function gi(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var _i=typeof setTimeout==`function`?setTimeout:void 0,vi=typeof clearTimeout==`function`?clearTimeout:void 0,yi=typeof Promise==`function`?Promise:void 0,bi=typeof queueMicrotask==`function`?queueMicrotask:yi===void 0?_i:function(e){return yi.resolve(null).then(e).catch(xi)};function xi(e){setTimeout(function(){throw e})}function Si(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),rn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);rn(t)}function Ci(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function wi(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Ti=Math.random().toString(36).slice(2),Ei=`__reactFiber$`+Ti,Di=`__reactProps$`+Ti,Oi=`__reactContainer$`+Ti,ki=`__reactEvents$`+Ti,Ai=`__reactListeners$`+Ti,ji=`__reactHandles$`+Ti;function Mi(e){var t=e[Ei];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Oi]||n[Ei]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=wi(e);e!==null;){if(n=e[Ei])return n;e=wi(e)}return t}e=n,n=e.parentNode}return null}function Ni(e){return e=e[Ei]||e[Oi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Pi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Fi(e){return e[Di]||null}var Ii=[],Li=-1;function Ri(e){return{current:e}}function zi(e){0>Li||(e.current=Ii[Li],Ii[Li]=null,Li--)}function Bi(e,t){Li++,Ii[Li]=e.current,e.current=t}var Vi={},Hi=Ri(Vi),Ui=Ri(!1),Wi=Vi;function Gi(e,t){var n=e.type.contextTypes;if(!n)return Vi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ki(e){return e=e.childContextTypes,e!=null}function qi(){zi(Ui),zi(Hi)}function Ji(e,t,n){if(Hi.current!==Vi)throw Error(r(168));Bi(Hi,t),Bi(Ui,n)}function Yi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,U(e)||`Unknown`,a));return R({},n,i)}function Xi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vi,Wi=Hi.current,Bi(Hi,e),Bi(Ui,Ui.current),!0}function Zi(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Yi(e,t,Wi),i.__reactInternalMemoizedMergedChildContext=e,zi(Ui),zi(Hi),Bi(Hi,e)):zi(Ui),Bi(Ui,n)}var Qi=null,$i=!1,ea=!1;function ta(e){Qi===null?Qi=[e]:Qi.push(e)}function na(e){$i=!0,ta(e)}function ra(){if(!ea&&Qi!==null){ea=!0;var e=0,t=Pt;try{var n=Qi;for(Pt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Qi=null,$i=!1}catch(t){throw Qi!==null&&(Qi=Qi.slice(e+1)),it(ut,ra),t}finally{Pt=t,ea=!1}}return null}var ia=[],aa=0,oa=null,sa=0,ca=[],la=0,ua=null,da=1,pa=``;function ma(e,t){ia[aa++]=sa,ia[aa++]=oa,oa=e,sa=t}function ha(e,t,n){ca[la++]=da,ca[la++]=pa,ca[la++]=ua,ua=e;var r=da;e=pa;var i=32-vt(r)-1;r&=~(1<<i),n+=1;var a=32-vt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,da=1<<32-vt(t)+i|n<<i|r,pa=a+e}else da=1<<a|n<<i|r,pa=e}function ga(e){e.return!==null&&(ma(e,1),ha(e,1,0))}function _a(e){for(;e===oa;)oa=ia[--aa],ia[aa]=null,sa=ia[--aa],ia[aa]=null;for(;e===ua;)ua=ca[--la],ca[la]=null,pa=ca[--la],ca[la]=null,da=ca[--la],ca[la]=null}var va=null,ya=null,ba=!1,xa=null;function Sa(e,t){var n=Xl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ca(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,va=e,ya=Ci(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,va=e,ya=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=ua===null?null:{id:da,overflow:pa},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Xl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,va=e,ya=null,!0);default:return!1}}function wa(e){return!!(e.mode&1)&&!(e.flags&128)}function Ta(e){if(ba){var t=ya;if(t){var n=t;if(!Ca(e,t)){if(wa(e))throw Error(r(418));t=Ci(n.nextSibling);var i=va;t&&Ca(e,t)?Sa(i,n):(e.flags=e.flags&-4097|2,ba=!1,va=e)}}else{if(wa(e))throw Error(r(418));e.flags=e.flags&-4097|2,ba=!1,va=e}}}function Ea(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;va=e}function Da(e){if(e!==va)return!1;if(!ba)return Ea(e),ba=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!gi(e.type,e.memoizedProps)),t&&=ya){if(wa(e))throw Oa(),Error(r(418));for(;t;)Sa(e,t),t=Ci(t.nextSibling)}if(Ea(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){ya=Ci(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}ya=null}}else ya=va?Ci(e.stateNode.nextSibling):null;return!0}function Oa(){for(var e=ya;e;)e=Ci(e.nextSibling)}function ka(){ya=va=null,ba=!1}function Aa(e){xa===null?xa=[e]:xa.push(e)}var ja=x.ReactCurrentBatchConfig;function Ma(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Na(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Pa(e){var t=e._init;return t(e._payload)}function Fa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=$l(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ru(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===w?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===P&&Pa(i)===t.type)?(r=a(t,n.props),r.ref=Ma(e,t,n),r.return=e,r):(r=eu(n.type,n.key,n.props,null,e.mode,r),r.ref=Ma(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=iu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=tu(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=ru(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case S:return n=eu(t.type,t.key,t.props,null,e.mode,n),n.ref=Ma(e,null,t),n.return=e,n;case C:return t=iu(t,e.mode,n),t.return=e,t;case P:var r=t._init;return f(e,r(t._payload),n)}if(G(t)||L(t))return t=tu(t,e.mode,n,null),t.return=e,t;Na(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case S:return n.key===i?l(e,t,n,r):null;case C:return n.key===i?u(e,t,n,r):null;case P:return i=n._init,p(e,t,i(n._payload),r)}if(G(n)||L(n))return i===null?d(e,t,n,r,null):null;Na(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case S:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case C:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case P:var a=r._init;return m(e,t,n,a(r._payload),i)}if(G(r)||L(r))return e=e.get(n)||null,d(t,e,r,i,null);Na(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),ba&&ma(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ba&&ma(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),ba&&ma(r,h),l}function g(a,s,c,l){var u=L(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ba&&ma(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ba&&ma(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ba&&ma(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===w&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case S:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===w){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===P&&Pa(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Ma(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===w?(r=tu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=eu(i.type,i.key,i.props,null,e.mode,o),o.ref=Ma(e,r,i),o.return=e,e=o)}return s(e);case C:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=iu(i,e.mode,o),r.return=e,e=r}return s(e);case P:return l=i._init,_(e,r,l(i._payload),o)}if(G(i))return h(e,r,i,o);if(L(i))return g(e,r,i,o);Na(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=ru(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ia=Fa(!0),La=Fa(!1),Ra=Ri(null),za=null,Ba=null,Va=null;function Ha(){Va=Ba=za=null}function Ua(e){var t=Ra.current;zi(Ra),e._currentValue=t}function Wa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ga(e,t){za=e,Va=Ba=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Fs=!0),e.firstContext=null)}function Ka(e){var t=e._currentValue;if(Va!==e){if(e={context:e,memoizedValue:t,next:null},Ba===null){if(za===null)throw Error(r(308));Ba=e,za.dependencies={lanes:0,firstContext:e}}else Ba=Ba.next=e}return t}var qa=null;function Ja(e){qa===null?qa=[e]:qa.push(e)}function Ya(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Ja(t)):(n.next=i.next,i.next=n),t.interleaved=n,Xa(e,r)}function Xa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Za=!1;function Qa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $a(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function eo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function to(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Wc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Xa(e,n)}return i=r.interleaved,i===null?(t.next=t,Ja(r)):(t.next=i.next,i.next=t),r.interleaved=t,Xa(e,n)}function no(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Nt(e,n)}}function ro(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function io(e,t,n,r){var i=e.updateQueue;Za=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=R({},d,f);break a;case 2:Za=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Qc|=o,e.lanes=o,e.memoizedState=d}}function ao(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var oo={},so=Ri(oo),co=Ri(oo),lo=Ri(oo);function uo(e){if(e===oo)throw Error(r(174));return e}function fo(e,t){switch(Bi(lo,t),Bi(co,e),Bi(so,oo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ve(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ve(t,e)}zi(so),Bi(so,t)}function po(){zi(so),zi(co),zi(lo)}function mo(e){uo(lo.current);var t=uo(so.current),n=ve(t,e.type);t!==n&&(Bi(co,e),Bi(so,n))}function ho(e){co.current===e&&(zi(so),zi(co))}var go=Ri(0);function _o(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var vo=[];function yo(){for(var e=0;e<vo.length;e++)vo[e]._workInProgressVersionPrimary=null;vo.length=0}var bo=x.ReactCurrentDispatcher,xo=x.ReactCurrentBatchConfig,So=0,Co=null,wo=null,To=null,Eo=!1,Do=!1,Oo=0,ko=0;function Ao(){throw Error(r(321))}function jo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Sr(e[n],t[n]))return!1;return!0}function Mo(e,t,n,i,a,o){if(So=o,Co=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,bo.current=e===null||e.memoizedState===null?hs:gs,e=n(i,a),Do){o=0;do{if(Do=!1,Oo=0,25<=o)throw Error(r(301));o+=1,To=wo=null,t.updateQueue=null,bo.current=_s,e=n(i,a)}while(Do)}if(bo.current=ms,t=wo!==null&&wo.next!==null,So=0,To=wo=Co=null,Eo=!1,t)throw Error(r(300));return e}function No(){var e=Oo!==0;return Oo=0,e}function Po(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return To===null?Co.memoizedState=To=e:To=To.next=e,To}function Fo(){if(wo===null){var e=Co.alternate;e=e===null?null:e.memoizedState}else e=wo.next;var t=To===null?Co.memoizedState:To.next;if(t!==null)To=t,wo=e;else{if(e===null)throw Error(r(310));wo=e,e={memoizedState:wo.memoizedState,baseState:wo.baseState,baseQueue:wo.baseQueue,queue:wo.queue,next:null},To===null?Co.memoizedState=To=e:To=To.next=e}return To}function Io(e,t){return typeof t==`function`?t(e):t}function Lo(e){var t=Fo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=wo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((So&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,Co.lanes|=d,Qc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Sr(i,t.memoizedState)||(Fs=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,Co.lanes|=o,Qc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ro(e){var t=Fo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Sr(o,t.memoizedState)||(Fs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function zo(){}function Bo(e,t){var n=Co,i=Fo(),a=t(),o=!Sr(i.memoizedState,a);if(o&&(i.memoizedState=a,Fs=!0),i=i.queue,Qo(Uo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||To!==null&&To.memoizedState.tag&1){if(n.flags|=2048,qo(9,Ho.bind(null,n,i,a,t),void 0,null),Gc===null)throw Error(r(349));So&30||Vo(n,t,a)}return a}function Vo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Co.updateQueue,t===null?(t={lastEffect:null,stores:null},Co.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ho(e,t,n,r){t.value=n,t.getSnapshot=r,Wo(t)&&Go(e)}function Uo(e,t,n){return n(function(){Wo(t)&&Go(e)})}function Wo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Sr(e,n)}catch{return!0}}function Go(e){var t=Xa(e,1);t!==null&&vl(t,e,1,-1)}function Ko(e){var t=Po();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:e},t.queue=e,e=e.dispatch=us.bind(null,Co,e),[t.memoizedState,e]}function qo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Co.updateQueue,t===null?(t={lastEffect:null,stores:null},Co.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Jo(){return Fo().memoizedState}function Yo(e,t,n,r){var i=Po();Co.flags|=e,i.memoizedState=qo(1|t,n,void 0,r===void 0?null:r)}function Xo(e,t,n,r){var i=Fo();r=r===void 0?null:r;var a=void 0;if(wo!==null){var o=wo.memoizedState;if(a=o.destroy,r!==null&&jo(r,o.deps)){i.memoizedState=qo(t,n,a,r);return}}Co.flags|=e,i.memoizedState=qo(1|t,n,a,r)}function Zo(e,t){return Yo(8390656,8,e,t)}function Qo(e,t){return Xo(2048,8,e,t)}function $o(e,t){return Xo(4,2,e,t)}function es(e,t){return Xo(4,4,e,t)}function ts(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ns(e,t,n){return n=n==null?null:n.concat([e]),Xo(4,4,ts.bind(null,t,e),n)}function rs(){}function is(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&jo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function as(e,t){var n=Fo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&jo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function os(e,t,n){return So&21?(Sr(n,t)||(n=kt(),Co.lanes|=n,Qc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Fs=!0),e.memoizedState=n)}function ss(e,t){var n=Pt;Pt=n!==0&&4>n?n:4,e(!0);var r=xo.transition;xo.transition={};try{e(!1),t()}finally{Pt=n,xo.transition=r}}function cs(){return Fo().memoizedState}function ls(e,t,n){var r=_l(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ds(e))fs(t,n);else if(n=Ya(e,t,n,r),n!==null){var i=gl();vl(n,e,r,i),ps(n,t,r)}}function us(e,t,n){var r=_l(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ds(e))fs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Sr(s,o)){var c=t.interleaved;c===null?(i.next=i,Ja(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Ya(e,t,i,r),n!==null&&(i=gl(),vl(n,e,r,i),ps(n,t,r))}}function ds(e){var t=e.alternate;return e===Co||t!==null&&t===Co}function fs(e,t){Do=Eo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ps(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Nt(e,n)}}var ms={readContext:Ka,useCallback:Ao,useContext:Ao,useEffect:Ao,useImperativeHandle:Ao,useInsertionEffect:Ao,useLayoutEffect:Ao,useMemo:Ao,useReducer:Ao,useRef:Ao,useState:Ao,useDebugValue:Ao,useDeferredValue:Ao,useTransition:Ao,useMutableSource:Ao,useSyncExternalStore:Ao,useId:Ao,unstable_isNewReconciler:!1},hs={readContext:Ka,useCallback:function(e,t){return Po().memoizedState=[e,t===void 0?null:t],e},useContext:Ka,useEffect:Zo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Yo(4194308,4,ts.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Yo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Yo(4,2,e,t)},useMemo:function(e,t){var n=Po();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Po();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ls.bind(null,Co,e),[r.memoizedState,e]},useRef:function(e){var t=Po();return e={current:e},t.memoizedState=e},useState:Ko,useDebugValue:rs,useDeferredValue:function(e){return Po().memoizedState=e},useTransition:function(){var e=Ko(!1),t=e[0];return e=ss.bind(null,e[1]),Po().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Co,a=Po();if(ba){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Gc===null)throw Error(r(349));So&30||Vo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Zo(Uo.bind(null,i,o,e),[e]),i.flags|=2048,qo(9,Ho.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Po(),t=Gc.identifierPrefix;if(ba){var n=pa,r=da;n=(r&~(1<<32-vt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Oo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=ko++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},gs={readContext:Ka,useCallback:is,useContext:Ka,useEffect:Qo,useImperativeHandle:ns,useInsertionEffect:$o,useLayoutEffect:es,useMemo:as,useReducer:Lo,useRef:Jo,useState:function(){return Lo(Io)},useDebugValue:rs,useDeferredValue:function(e){return os(Fo(),wo.memoizedState,e)},useTransition:function(){return[Lo(Io)[0],Fo().memoizedState]},useMutableSource:zo,useSyncExternalStore:Bo,useId:cs,unstable_isNewReconciler:!1},_s={readContext:Ka,useCallback:is,useContext:Ka,useEffect:Qo,useImperativeHandle:ns,useInsertionEffect:$o,useLayoutEffect:es,useMemo:as,useReducer:Ro,useRef:Jo,useState:function(){return Ro(Io)},useDebugValue:rs,useDeferredValue:function(e){var t=Fo();return wo===null?t.memoizedState=e:os(t,wo.memoizedState,e)},useTransition:function(){return[Ro(Io)[0],Fo().memoizedState]},useMutableSource:zo,useSyncExternalStore:Bo,useId:cs,unstable_isNewReconciler:!1};function vs(e,t){if(e&&e.defaultProps){for(var n in t=R({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function ys(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:R({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var bs={isMounted:function(e){return(e=e._reactInternals)?Qe(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=gl(),i=_l(e),a=eo(r,i);a.payload=t,n!=null&&(a.callback=n),t=to(e,a,i),t!==null&&(vl(t,e,i,r),no(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=gl(),i=_l(e),a=eo(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=to(e,a,i),t!==null&&(vl(t,e,i,r),no(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gl(),r=_l(e),i=eo(n,r);i.tag=2,t!=null&&(i.callback=t),t=to(e,i,r),t!==null&&(vl(t,e,r,n),no(t,e,r))}};function xs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Cr(n,r)||!Cr(i,a):!0}function Ss(e,t,n){var r=!1,i=Vi,a=t.contextType;return typeof a==`object`&&a?a=Ka(a):(i=Ki(t)?Wi:Hi.current,r=t.contextTypes,a=(r=r!=null)?Gi(e,i):Vi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=bs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Cs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&bs.enqueueReplaceState(t,t.state,null)}function ws(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Qa(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ka(a):(a=Ki(t)?Wi:Hi.current,i.context=Gi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(ys(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&bs.enqueueReplaceState(i,i.state,null),io(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ts(e,t){try{var n=``,r=t;do n+=ee(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Es(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ds(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Os=typeof WeakMap==`function`?WeakMap:Map;function ks(e,t,n){n=eo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ol||(ol=!0,sl=r),Ds(e,t)},n}function As(e,t,n){n=eo(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Ds(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Ds(e,t),typeof r!=`function`&&(cl===null?cl=new Set([this]):cl.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function js(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Os;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Ul.bind(null,e,t,n),t.then(e,e))}function Ms(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Ns(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=eo(-1,1),t.tag=2,to(n,t,1))),n.lanes|=1),e)}var Ps=x.ReactCurrentOwner,Fs=!1;function Is(e,t,n,r){t.child=e===null?La(t,null,n,r):Ia(t,e.child,n,r)}function Ls(e,t,n,r,i){n=n.render;var a=t.ref;return Ga(t,i),r=Mo(e,t,n,r,a,i),n=No(),e!==null&&!Fs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,rc(e,t,i)):(ba&&n&&ga(t),t.flags|=1,Is(e,t,r,i),t.child)}function Rs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Zl(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,zs(e,t,a,r,i)):(e=eu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Cr:n,n(o,r)&&e.ref===t.ref)return rc(e,t,i)}return t.flags|=1,e=$l(a,r),e.ref=t.ref,e.return=t,t.child=e}function zs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Cr(a,r)&&e.ref===t.ref){if(Fs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Fs=!0);else return t.lanes=e.lanes,rc(e,t,i)}}return Hs(e,t,n,r,i)}function Bs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Bi(Yc,Jc),Jc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Bi(Yc,Jc),Jc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Bi(Yc,Jc),Jc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Bi(Yc,Jc),Jc|=r;return Is(e,t,i,n),t.child}function Vs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Hs(e,t,n,r,i){var a=Ki(n)?Wi:Hi.current;return a=Gi(t,a),Ga(t,i),n=Mo(e,t,n,r,a,i),r=No(),e!==null&&!Fs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,rc(e,t,i)):(ba&&r&&ga(t),t.flags|=1,Is(e,t,n,i),t.child)}function Us(e,t,n,r,i){if(Ki(n)){var a=!0;Xi(t)}else a=!1;if(Ga(t,i),t.stateNode===null)nc(e,t),Ss(t,n,r),ws(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ka(l):(l=Ki(n)?Wi:Hi.current,l=Gi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Cs(t,o,r,l),Za=!1;var f=t.memoizedState;o.state=f,io(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ui.current||Za?(typeof u==`function`&&(ys(t,n,u,r),c=t.memoizedState),(s=Za||xs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,$a(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:vs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ka(c):(c=Ki(n)?Wi:Hi.current,c=Gi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Cs(t,o,r,c),Za=!1,f=t.memoizedState,o.state=f,io(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ui.current||Za?(typeof p==`function`&&(ys(t,n,p,r),m=t.memoizedState),(l=Za||xs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Ws(e,t,n,r,a,i)}function Ws(e,t,n,r,i,a){Vs(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&Zi(t,n,!1),rc(e,t,a);r=t.stateNode,Ps.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ia(t,e.child,null,a),t.child=Ia(t,null,s,a)):Is(e,t,s,a),t.memoizedState=r.state,i&&Zi(t,n,!0),t.child}function Gs(e){var t=e.stateNode;t.pendingContext?Ji(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ji(e,t.context,!1),fo(e,t.containerInfo)}function Ks(e,t,n,r,i){return ka(),Aa(i),t.flags|=256,Is(e,t,n,r),t.child}var qs={dehydrated:null,treeContext:null,retryLane:0};function Js(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ys(e,t,n){var r=t.pendingProps,i=go.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Bi(go,i&1),e===null)return Ta(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=nu(o,r,0,null),e=tu(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Js(n),t.memoizedState=qs,e):Xs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Qs(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=$l(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=tu(a,o,n,null),a.flags|=2):a=$l(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Js(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=qs,r}return a=e.child,e=a.sibling,r=$l(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Xs(e,t){return t=nu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Zs(e,t,n,r){return r!==null&&Aa(r),Ia(t,e.child,null,n),e=Xs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Qs(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Es(Error(r(422))),Zs(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=nu({mode:`visible`,children:i.children},a,0,null),o=tu(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ia(t,e.child,null,s),t.child.memoizedState=Js(s),t.memoizedState=qs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Zs(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Es(o,i,void 0),Zs(e,t,s,i)}if(c=(s&e.childLanes)!==0,Fs||c){if(i=Gc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,Xa(e,a),vl(i,e,a,-1))}return Ml(),i=Es(Error(r(421))),Zs(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Gl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,ya=Ci(a.nextSibling),va=t,ba=!0,xa=null,e!==null&&(ca[la++]=da,ca[la++]=pa,ca[la++]=ua,da=e.id,pa=e.overflow,ua=t),t=Xs(t,i.children),t.flags|=4096,t)}function $s(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wa(e.return,t,n)}function ec(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function tc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Is(e,t,r.children,n),r=go.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&$s(e,n,t);else if(e.tag===19)$s(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Bi(go,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&_o(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ec(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&_o(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ec(t,!0,n,null,a);break;case`together`:ec(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function nc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function rc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Qc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=$l(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=$l(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ic(e,t,n){switch(t.tag){case 3:Gs(t),ka();break;case 5:mo(t);break;case 1:Ki(t.type)&&Xi(t);break;case 4:fo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Bi(Ra,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Bi(go,go.current&1),e=rc(e,t,n),e===null?null:e.sibling):Ys(e,t,n):(Bi(go,go.current&1),t.flags|=128,null);Bi(go,go.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return tc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Bi(go,go.current),r)break;return null;case 22:case 23:return t.lanes=0,Bs(e,t,n)}return rc(e,t,n)}var ac=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},oc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,uo(so.current);var o=null;switch(n){case`input`:i=se(e,i),r=se(e,r),o=[];break;case`select`:i=R({},i,{value:void 0}),r=R({},r,{value:void 0}),o=[];break;case`textarea`:i=me(e,i),r=me(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=pi)}De(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&J(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},sc=function(e,t,n,r){n!==r&&(t.flags|=4)};function cc(e,t){if(!ba)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function lc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function uc(e,t,n){var i=t.pendingProps;switch(_a(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lc(t),null;case 1:return Ki(t.type)&&qi(),lc(t),null;case 3:return i=t.stateNode,po(),zi(Ui),zi(Hi),yo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Da(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,xa!==null&&(Sl(xa),xa=null))),lc(t),null;case 5:ho(t);var o=uo(lo.current);if(n=t.type,e!==null&&t.stateNode!=null)oc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return lc(t),null}if(e=uo(so.current),Da(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Ei]=t,i[Di]=s,e=!!(t.mode&1),n){case`dialog`:J(`cancel`,i),J(`close`,i);break;case`iframe`:case`object`:case`embed`:J(`load`,i);break;case`video`:case`audio`:for(o=0;o<Xr.length;o++)J(Xr[o],i);break;case`source`:J(`error`,i);break;case`img`:case`image`:case`link`:J(`error`,i),J(`load`,i);break;case`details`:J(`toggle`,i);break;case`input`:ce(i,s),J(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},J(`invalid`,i);break;case`textarea`:he(i,s),J(`invalid`,i)}for(var c in De(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&fi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&fi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&J(`scroll`,i)}switch(n){case`input`:ie(i),de(i,s,!0);break;case`textarea`:ie(i),K(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=pi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=_e(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Ei]=t,e[Di]=i,ac(e,t,!1,!1),t.stateNode=e;a:{switch(c=Oe(n,i),n){case`dialog`:J(`cancel`,e),J(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:J(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Xr.length;o++)J(Xr[o],e);o=i;break;case`source`:J(`error`,e),o=i;break;case`img`:case`image`:case`link`:J(`error`,e),J(`load`,e),o=i;break;case`details`:J(`toggle`,e),o=i;break;case`input`:ce(e,i),o=se(e,i),J(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=R({},i,{value:void 0}),J(`invalid`,e);break;case`textarea`:he(e,i),o=me(e,i),J(`invalid`,e);break;default:o=i}for(s in De(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Te(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&be(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&xe(e,u):typeof u==`number`&&xe(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&J(`scroll`,e):u!=null&&b(e,s,u,c))}switch(n){case`input`:ie(e),de(e,i,!1);break;case`textarea`:ie(e),K(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+W(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&pe(e,!!i.multiple,i.defaultValue,!0):pe(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=pi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return lc(t),null;case 6:if(e&&t.stateNode!=null)sc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=uo(lo.current),uo(so.current),Da(t)){if(i=t.stateNode,n=t.memoizedProps,i[Ei]=t,(s=i.nodeValue!==n)&&(e=va,e!==null))switch(e.tag){case 3:fi(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&fi(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Ei]=t,t.stateNode=i}return lc(t),null;case 13:if(zi(go),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ba&&ya!==null&&t.mode&1&&!(t.flags&128))Oa(),ka(),t.flags|=98560,s=!1;else if(s=Da(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Ei]=t}else ka(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;lc(t),s=!1}else xa!==null&&(Sl(xa),xa=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||go.current&1?Xc===0&&(Xc=3):Ml())),t.updateQueue!==null&&(t.flags|=4),lc(t),null);case 4:return po(),e===null&&ni(t.stateNode.containerInfo),lc(t),null;case 10:return Ua(t.type._context),lc(t),null;case 17:return Ki(t.type)&&qi(),lc(t),null;case 19:if(zi(go),s=t.memoizedState,s===null)return lc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)cc(s,!1);else{if(Xc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=_o(e),c!==null){for(t.flags|=128,cc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Bi(go,go.current&1|2),t.child}e=e.sibling}s.tail!==null&&ct()>il&&(t.flags|=128,i=!0,cc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=_o(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),cc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!ba)return lc(t),null}else 2*ct()-s.renderingStartTime>il&&n!==1073741824&&(t.flags|=128,i=!0,cc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(lc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=ct(),t.sibling=null,n=go.current,Bi(go,i?n&1|2:n&1),t);case 22:case 23:return Ol(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Jc&1073741824&&(lc(t),t.subtreeFlags&6&&(t.flags|=8192)):lc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function dc(e,t){switch(_a(t),t.tag){case 1:return Ki(t.type)&&qi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return po(),zi(Ui),zi(Hi),yo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ho(t),null;case 13:if(zi(go),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ka()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zi(go),null;case 4:return po(),null;case 10:return Ua(t.type._context),null;case 22:case 23:return Ol(),null;case 24:return null;default:return null}}var fc=!1,pc=!1,mc=typeof WeakSet==`function`?WeakSet:Set,Y=null;function hc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){Hl(e,t,n)}else n.current=null}}function gc(e,t,n){try{n()}catch(n){Hl(e,t,n)}}var _c=!1;function vc(e,t){if(mi=on,e=Dr(),Or(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(hi={focusedElem:e,selectionRange:n},on=!1,Y=t;Y!==null;)if(t=Y,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Y=e;else for(;Y!==null;){t=Y;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:vs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Hl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,Y=e;break}Y=t.return}return h=_c,_c=!1,h}function yc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&gc(t,n,a)}i=i.next}while(i!==r)}}function bc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function xc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Sc(e){var t=e.alternate;t!==null&&(e.alternate=null,Sc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ei],delete t[Di],delete t[ki],delete t[Ai],delete t[ji])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Cc(e){return e.tag===5||e.tag===3||e.tag===4}function wc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Cc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Tc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=pi));else if(r!==4&&(e=e.child,e!==null))for(Tc(e,t,n),e=e.sibling;e!==null;)Tc(e,t,n),e=e.sibling}function Ec(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ec(e,t,n),e=e.sibling;e!==null;)Ec(e,t,n),e=e.sibling}var Dc=null,Oc=!1;function kc(e,t,n){for(n=n.child;n!==null;)Ac(e,t,n),n=n.sibling}function Ac(e,t,n){if(gt&&typeof gt.onCommitFiberUnmount==`function`)try{gt.onCommitFiberUnmount(ht,n)}catch{}switch(n.tag){case 5:pc||hc(n,t);case 6:var r=Dc,i=Oc;Dc=null,kc(e,t,n),Dc=r,Oc=i,Dc!==null&&(Oc?(e=Dc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dc.removeChild(n.stateNode));break;case 18:Dc!==null&&(Oc?(e=Dc,n=n.stateNode,e.nodeType===8?Si(e.parentNode,n):e.nodeType===1&&Si(e,n),rn(e)):Si(Dc,n.stateNode));break;case 4:r=Dc,i=Oc,Dc=n.stateNode.containerInfo,Oc=!0,kc(e,t,n),Dc=r,Oc=i;break;case 0:case 11:case 14:case 15:if(!pc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&gc(n,t,o),i=i.next}while(i!==r)}kc(e,t,n);break;case 1:if(!pc&&(hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Hl(n,t,e)}kc(e,t,n);break;case 21:kc(e,t,n);break;case 22:n.mode&1?(pc=(r=pc)||n.memoizedState!==null,kc(e,t,n),pc=r):kc(e,t,n);break;default:kc(e,t,n)}}function jc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new mc),t.forEach(function(t){var r=Kl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Mc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:Dc=c.stateNode,Oc=!1;break a;case 3:Dc=c.stateNode.containerInfo,Oc=!0;break a;case 4:Dc=c.stateNode.containerInfo,Oc=!0;break a}c=c.return}if(Dc===null)throw Error(r(160));Ac(o,s,a),Dc=null,Oc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Hl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Nc(t,e),t=t.sibling}function Nc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Mc(t,e),Pc(e),i&4){try{yc(3,e,e.return),bc(3,e)}catch(t){Hl(e,e.return,t)}try{yc(5,e,e.return)}catch(t){Hl(e,e.return,t)}}break;case 1:Mc(t,e),Pc(e),i&512&&n!==null&&hc(n,n.return);break;case 5:if(Mc(t,e),Pc(e),i&512&&n!==null&&hc(n,n.return),e.flags&32){var a=e.stateNode;try{xe(a,``)}catch(t){Hl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&le(a,o),Oe(c,s);var u=Oe(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Te(a,f):d===`dangerouslySetInnerHTML`?be(a,f):d===`children`?xe(a,f):b(a,d,f,u)}switch(c){case`input`:ue(a,o);break;case`textarea`:ge(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?pe(a,!!o.multiple,o.multiple?[]:``,!1):pe(a,!!o.multiple,o.defaultValue,!0)):pe(a,!!o.multiple,m,!1)}a[Di]=o}catch(t){Hl(e,e.return,t)}}break;case 6:if(Mc(t,e),Pc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Hl(e,e.return,t)}}break;case 3:if(Mc(t,e),Pc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{rn(t.containerInfo)}catch(t){Hl(e,e.return,t)}break;case 4:Mc(t,e),Pc(e);break;case 13:Mc(t,e),Pc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(rl=ct())),i&4&&jc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(pc=(u=pc)||d,Mc(t,e),pc=u):Mc(t,e),Pc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Y=e,d=e.child;d!==null;){for(f=Y=d;Y!==null;){switch(p=Y,m=p.child,p.tag){case 0:case 11:case 14:case 15:yc(4,p,p.return);break;case 1:hc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Hl(i,n,e)}}break;case 5:hc(p,p.return);break;case 22:if(p.memoizedState!==null){Rc(f);continue}}m===null?Rc(f):(m.return=p,Y=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=we(`display`,s))}catch(t){Hl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Hl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Mc(t,e),Pc(e),i&4&&jc(e);break;case 21:break;default:Mc(t,e),Pc(e)}}function Pc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Cc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(xe(a,``),i.flags&=-33),Ec(e,wc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Tc(e,wc(e),o);break;default:throw Error(r(161))}}catch(t){Hl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Fc(e,t,n){Y=e,Ic(e,t,n)}function Ic(e,t,n){for(var r=!!(e.mode&1);Y!==null;){var i=Y,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||fc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||pc;s=fc;var l=pc;if(fc=o,(pc=c)&&!l)for(Y=i;Y!==null;)o=Y,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?zc(i):(c.return=o,Y=c);for(;a!==null;)Y=a,Ic(a,t,n),a=a.sibling;Y=i,fc=s,pc=l}Lc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,Y=a):Lc(e,t,n)}}function Lc(e){for(;Y!==null;){var t=Y;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:pc||bc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!pc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:vs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&ao(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ao(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&rn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}pc||t.flags&512&&xc(t)}catch(e){Hl(t,t.return,e)}}if(t===e){Y=null;break}if(n=t.sibling,n!==null){n.return=t.return,Y=n;break}Y=t.return}}function Rc(e){for(;Y!==null;){var t=Y;if(t===e){Y=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Y=n;break}Y=t.return}}function zc(e){for(;Y!==null;){var t=Y;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{bc(4,t)}catch(e){Hl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Hl(t,i,e)}}var a=t.return;try{xc(t)}catch(e){Hl(t,a,e)}break;case 5:var o=t.return;try{xc(t)}catch(e){Hl(t,o,e)}}}catch(e){Hl(t,t.return,e)}if(t===e){Y=null;break}var s=t.sibling;if(s!==null){s.return=t.return,Y=s;break}Y=t.return}}var Bc=Math.ceil,Vc=x.ReactCurrentDispatcher,Hc=x.ReactCurrentOwner,Uc=x.ReactCurrentBatchConfig,Wc=0,Gc=null,Kc=null,qc=0,Jc=0,Yc=Ri(0),Xc=0,Zc=null,Qc=0,$c=0,el=0,tl=null,nl=null,rl=0,il=1/0,al=null,ol=!1,sl=null,cl=null,ll=!1,ul=null,dl=0,fl=0,pl=null,ml=-1,hl=0;function gl(){return Wc&6?ct():ml===-1?ml=ct():ml}function _l(e){return e.mode&1?Wc&2&&qc!==0?qc&-qc:ja.transition===null?(e=Pt,e===0?(e=window.event,e=e===void 0?16:fn(e.type),e):e):(hl===0&&(hl=kt()),hl):1}function vl(e,t,n,i){if(50<fl)throw fl=0,pl=null,Error(r(185));jt(e,n,i),(!(Wc&2)||e!==Gc)&&(e===Gc&&(!(Wc&2)&&($c|=n),Xc===4&&wl(e,qc)),yl(e,i),n===1&&Wc===0&&!(t.mode&1)&&(il=ct()+500,$i&&ra()))}function yl(e,t){var n=e.callbackNode;Dt(e,t);var r=Tt(e,e===Gc?qc:0);if(r===0)n!==null&&at(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&at(n),t===1)e.tag===0?na(Tl.bind(null,e)):ta(Tl.bind(null,e)),bi(function(){!(Wc&6)&&ra()}),n=null;else{switch(Ft(r)){case 1:n=ut;break;case 4:n=dt;break;case 16:n=ft;break;case 536870912:n=mt;break;default:n=ft}n=Jl(n,bl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function bl(e,t){if(ml=-1,hl=0,Wc&6)throw Error(r(327));var n=e.callbackNode;if(Bl()&&e.callbackNode!==n)return null;var i=Tt(e,e===Gc?qc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Nl(e,i);else{t=i;var a=Wc;Wc|=2;var o=jl();(Gc!==e||qc!==t)&&(al=null,il=ct()+500,kl(e,t));do try{Fl();break}catch(t){Al(e,t)}while(1);Ha(),Vc.current=o,Wc=a,Kc===null?(Gc=null,qc=0,t=Xc):t=0}if(t!==0){if(t===2&&(a=Ot(e),a!==0&&(i=a,t=xl(e,a))),t===1)throw n=Zc,kl(e,0),wl(e,i),yl(e,ct()),n;if(t===6)wl(e,i);else{if(a=e.current.alternate,!(i&30)&&!Cl(a)&&(t=Nl(e,i),t===2&&(o=Ot(e),o!==0&&(i=o,t=xl(e,o))),t===1))throw n=Zc,kl(e,0),wl(e,i),yl(e,ct()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Rl(e,nl,al);break;case 3:if(wl(e,i),(i&130023424)===i&&(t=rl+500-ct(),10<t)){if(Tt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){gl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=_i(Rl.bind(null,e,nl,al),t);break}Rl(e,nl,al);break;case 4:if(wl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-vt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ct()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Bc(i/1960))-i,10<i){e.timeoutHandle=_i(Rl.bind(null,e,nl,al),i);break}Rl(e,nl,al);break;case 5:Rl(e,nl,al);break;default:throw Error(r(329))}}}return yl(e,ct()),e.callbackNode===n?bl.bind(null,e):null}function xl(e,t){var n=tl;return e.current.memoizedState.isDehydrated&&(kl(e,t).flags|=256),e=Nl(e,t),e!==2&&(t=nl,nl=n,t!==null&&Sl(t)),e}function Sl(e){nl===null?nl=e:nl.push.apply(nl,e)}function Cl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Sr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function wl(e,t){for(t&=~el,t&=~$c,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-vt(t),r=1<<n;e[n]=-1,t&=~r}}function Tl(e){if(Wc&6)throw Error(r(327));Bl();var t=Tt(e,0);if(!(t&1))return yl(e,ct()),null;var n=Nl(e,t);if(e.tag!==0&&n===2){var i=Ot(e);i!==0&&(t=i,n=xl(e,i))}if(n===1)throw n=Zc,kl(e,0),wl(e,t),yl(e,ct()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Rl(e,nl,al),yl(e,ct()),null}function El(e,t){var n=Wc;Wc|=1;try{return e(t)}finally{Wc=n,Wc===0&&(il=ct()+500,$i&&ra())}}function Dl(e){ul!==null&&ul.tag===0&&!(Wc&6)&&Bl();var t=Wc;Wc|=1;var n=Uc.transition,r=Pt;try{if(Uc.transition=null,Pt=1,e)return e()}finally{Pt=r,Uc.transition=n,Wc=t,!(Wc&6)&&ra()}}function Ol(){Jc=Yc.current,zi(Yc)}function kl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,vi(n)),Kc!==null)for(n=Kc.return;n!==null;){var r=n;switch(_a(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&qi();break;case 3:po(),zi(Ui),zi(Hi),yo();break;case 5:ho(r);break;case 4:po();break;case 13:zi(go);break;case 19:zi(go);break;case 10:Ua(r.type._context);break;case 22:case 23:Ol()}n=n.return}if(Gc=e,Kc=e=$l(e.current,null),qc=Jc=t,Xc=0,Zc=null,el=$c=Qc=0,nl=tl=null,qa!==null){for(t=0;t<qa.length;t++)if(n=qa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}qa=null}return e}function Al(e,t){do{var n=Kc;try{if(Ha(),bo.current=ms,Eo){for(var i=Co.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Eo=!1}if(So=0,To=wo=Co=null,Do=!1,Oo=0,Hc.current=null,n===null||n.return===null){Xc=1,Zc=t,Kc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=qc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Ms(s);if(m!==null){m.flags&=-257,Ns(m,s,c,o,t),m.mode&1&&js(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){js(o,u,t),Ml();break a}l=Error(r(426))}else if(ba&&c.mode&1){var _=Ms(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Ns(_,s,c,o,t),Aa(Ts(l,c));break a}}o=l=Ts(l,c),Xc!==4&&(Xc=2),tl===null?tl=[o]:tl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=ks(o,l,t);ro(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(cl===null||!cl.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=As(o,c,t);ro(o,x);break a}}o=o.return}while(o!==null)}Ll(n)}catch(e){t=e,Kc===n&&n!==null&&(Kc=n=n.return);continue}break}while(1)}function jl(){var e=Vc.current;return Vc.current=ms,e===null?ms:e}function Ml(){(Xc===0||Xc===3||Xc===2)&&(Xc=4),Gc===null||!(Qc&268435455)&&!($c&268435455)||wl(Gc,qc)}function Nl(e,t){var n=Wc;Wc|=2;var i=jl();(Gc!==e||qc!==t)&&(al=null,kl(e,t));do try{Pl();break}catch(t){Al(e,t)}while(1);if(Ha(),Wc=n,Vc.current=i,Kc!==null)throw Error(r(261));return Gc=null,qc=0,Xc}function Pl(){for(;Kc!==null;)Il(Kc)}function Fl(){for(;Kc!==null&&!ot();)Il(Kc)}function Il(e){var t=ql(e.alternate,e,Jc);e.memoizedProps=e.pendingProps,t===null?Ll(e):Kc=t,Hc.current=null}function Ll(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=dc(n,t),n!==null){n.flags&=32767,Kc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Xc=6,Kc=null;return}}else if(n=uc(n,t,Jc),n!==null){Kc=n;return}if(t=t.sibling,t!==null){Kc=t;return}Kc=t=e}while(t!==null);Xc===0&&(Xc=5)}function Rl(e,t,n){var r=Pt,i=Uc.transition;try{Uc.transition=null,Pt=1,zl(e,t,n,r)}finally{Uc.transition=i,Pt=r}return null}function zl(e,t,n,i){do Bl();while(ul!==null);if(Wc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Mt(e,o),e===Gc&&(Kc=Gc=null,qc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ll||(ll=!0,Jl(ft,function(){return Bl(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Uc.transition,Uc.transition=null;var s=Pt;Pt=1;var c=Wc;Wc|=4,Hc.current=null,vc(e,n),Nc(n,e),kr(hi),on=!!mi,hi=mi=null,e.current=n,Fc(n,e,a),st(),Wc=c,Pt=s,Uc.transition=o}else e.current=n;if(ll&&(ll=!1,ul=e,dl=a),o=e.pendingLanes,o===0&&(cl=null),_t(n.stateNode,i),yl(e,ct()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(ol)throw ol=!1,e=sl,sl=null,e;return dl&1&&e.tag!==0&&Bl(),o=e.pendingLanes,o&1?e===pl?fl++:(fl=0,pl=e):fl=0,ra(),null}function Bl(){if(ul!==null){var e=Ft(dl),t=Uc.transition,n=Pt;try{if(Uc.transition=null,Pt=16>e?16:e,ul===null)var i=!1;else{if(e=ul,ul=null,dl=0,Wc&6)throw Error(r(331));var a=Wc;for(Wc|=4,Y=e.current;Y!==null;){var o=Y,s=o.child;if(Y.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(Y=u;Y!==null;){var d=Y;switch(d.tag){case 0:case 11:case 15:yc(8,d,o)}var f=d.child;if(f!==null)f.return=d,Y=f;else for(;Y!==null;){d=Y;var p=d.sibling,m=d.return;if(Sc(d),d===u){Y=null;break}if(p!==null){p.return=m,Y=p;break}Y=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}Y=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,Y=s;else b:for(;Y!==null;){if(o=Y,o.flags&2048)switch(o.tag){case 0:case 11:case 15:yc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,Y=v;break b}Y=o.return}}var y=e.current;for(Y=y;Y!==null;){s=Y;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,Y=b;else b:for(s=y;Y!==null;){if(c=Y,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:bc(9,c)}}catch(e){Hl(c,c.return,e)}if(c===s){Y=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,Y=x;break b}Y=c.return}}if(Wc=a,ra(),gt&&typeof gt.onPostCommitFiberRoot==`function`)try{gt.onPostCommitFiberRoot(ht,e)}catch{}i=!0}return i}finally{Pt=n,Uc.transition=t}}return!1}function Vl(e,t,n){t=Ts(n,t),t=ks(e,t,1),e=to(e,t,1),t=gl(),e!==null&&(jt(e,1,t),yl(e,t))}function Hl(e,t,n){if(e.tag===3)Vl(e,e,n);else for(;t!==null;){if(t.tag===3){Vl(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(cl===null||!cl.has(r))){e=Ts(n,e),e=As(t,e,1),t=to(t,e,1),e=gl(),t!==null&&(jt(t,1,e),yl(t,e));break}}t=t.return}}function Ul(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=gl(),e.pingedLanes|=e.suspendedLanes&n,Gc===e&&(qc&n)===n&&(Xc===4||Xc===3&&(qc&130023424)===qc&&500>ct()-rl?kl(e,0):el|=n),yl(e,t)}function Wl(e,t){t===0&&(e.mode&1?(t=Ct,Ct<<=1,!(Ct&130023424)&&(Ct=4194304)):t=1);var n=gl();e=Xa(e,t),e!==null&&(jt(e,t,n),yl(e,n))}function Gl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Wl(e,n)}function Kl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Wl(e,n)}var ql=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Ui.current)Fs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Fs=!1,ic(e,t,n);Fs=!!(e.flags&131072)}}else Fs=!1,ba&&t.flags&1048576&&ha(t,sa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;nc(e,t),e=t.pendingProps;var a=Gi(t,Hi.current);Ga(t,n),a=Mo(null,t,i,e,a,n);var o=No();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ki(i)?(o=!0,Xi(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Qa(t),a.updater=bs,t.stateNode=a,a._reactInternals=t,ws(t,i,e,n),t=Ws(null,t,i,!0,o,n)):(t.tag=0,ba&&o&&ga(t),Is(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(nc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Ql(i),e=vs(i,e),a){case 0:t=Hs(null,t,i,e,n);break a;case 1:t=Us(null,t,i,e,n);break a;case 11:t=Ls(null,t,i,e,n);break a;case 14:t=Rs(null,t,i,vs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:vs(i,a),Hs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:vs(i,a),Us(e,t,i,a,n);case 3:a:{if(Gs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,$a(e,t),io(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ts(Error(r(423)),t),t=Ks(e,t,i,n,a);break a}if(i!==a){a=Ts(Error(r(424)),t),t=Ks(e,t,i,n,a);break a}for(ya=Ci(t.stateNode.containerInfo.firstChild),va=t,ba=!0,xa=null,n=La(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ka(),i===a){t=rc(e,t,n);break a}Is(e,t,i,n)}t=t.child}return t;case 5:return mo(t),e===null&&Ta(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,gi(i,a)?s=null:o!==null&&gi(i,o)&&(t.flags|=32),Vs(e,t),Is(e,t,s,n),t.child;case 6:return e===null&&Ta(t),null;case 13:return Ys(e,t,n);case 4:return fo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ia(t,null,i,n):Is(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:vs(i,a),Ls(e,t,i,a,n);case 7:return Is(e,t,t.pendingProps,n),t.child;case 8:return Is(e,t,t.pendingProps.children,n),t.child;case 12:return Is(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Bi(Ra,i._currentValue),i._currentValue=s,o!==null){if(Sr(o.value,s)){if(o.children===a.children&&!Ui.current){t=rc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=eo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Wa(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Wa(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}Is(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ga(t,n),a=Ka(a),i=i(a),t.flags|=1,Is(e,t,i,n),t.child;case 14:return i=t.type,a=vs(i,t.pendingProps),a=vs(i.type,a),Rs(e,t,i,a,n);case 15:return zs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:vs(i,a),nc(e,t),t.tag=1,Ki(i)?(e=!0,Xi(t)):e=!1,Ga(t,n),Ss(t,i,a),ws(t,i,a,n),Ws(null,t,i,!0,e,n);case 19:return tc(e,t,n);case 22:return Bs(e,t,n)}throw Error(r(156,t.tag))};function Jl(e,t){return it(e,t)}function Yl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xl(e,t,n,r){return new Yl(e,t,n,r)}function Zl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ql(e){if(typeof e==`function`)return+!!Zl(e);if(e!=null){if(e=e.$$typeof,e===A)return 11;if(e===N)return 14}return 2}function $l(e,t){var n=e.alternate;return n===null?(n=Xl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function eu(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)Zl(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case w:return tu(n.children,a,o,t);case T:s=8,a|=8;break;case E:return e=Xl(12,n,t,a|2),e.elementType=E,e.lanes=o,e;case j:return e=Xl(13,n,t,a),e.elementType=j,e.lanes=o,e;case M:return e=Xl(19,n,t,a),e.elementType=M,e.lanes=o,e;case F:return nu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case D:s=10;break a;case k:s=9;break a;case A:s=11;break a;case N:s=14;break a;case P:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Xl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function tu(e,t,n,r){return e=Xl(7,e,r,t),e.lanes=n,e}function nu(e,t,n,r){return e=Xl(22,e,r,t),e.elementType=F,e.lanes=n,e.stateNode={isHidden:!1},e}function ru(e,t,n){return e=Xl(6,e,null,t),e.lanes=n,e}function iu(e,t,n){return t=Xl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function au(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=At(0),this.expirationTimes=At(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=At(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function ou(e,t,n,r,i,a,o,s,c){return e=new au(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Xl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Qa(a),e}function su(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:C,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function cu(e){if(!e)return Vi;e=e._reactInternals;a:{if(Qe(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Ki(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Ki(n))return Yi(e,n,t)}return t}function lu(e,t,n,r,i,a,o,s,c){return e=ou(n,r,!0,e,i,a,o,s,c),e.context=cu(null),n=e.current,r=gl(),i=_l(n),a=eo(r,i),a.callback=t??null,to(n,a,i),e.current.lanes=i,jt(e,i,r),yl(e,r),e}function uu(e,t,n,r){var i=t.current,a=gl(),o=_l(i);return n=cu(n),t.context===null?t.context=n:t.pendingContext=n,t=eo(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=to(i,t,o),e!==null&&(vl(e,i,o,a),no(e,i,o)),o}function du(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function fu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pu(e,t){fu(e,t),(e=e.alternate)&&fu(e,t)}function mu(){return null}var hu=typeof reportError==`function`?reportError:function(e){console.error(e)};function gu(e){this._internalRoot=e}_u.prototype.render=gu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));uu(e,t,null,null)},_u.prototype.unmount=gu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Dl(function(){uu(null,e,null,null)}),t[Oi]=null}};function _u(e){this._internalRoot=e}_u.prototype.unstable_scheduleHydration=function(e){if(e){var t=zt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<qt.length&&t!==0&&t<qt[n].priority;n++);qt.splice(n,0,e),n===0&&Qt(e)}};function vu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function yu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function bu(){}function xu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=du(o);a.call(e)}}var o=lu(t,r,e,0,null,!1,!1,``,bu);return e._reactRootContainer=o,e[Oi]=o.current,ni(e.nodeType===8?e.parentNode:e),Dl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=du(c);s.call(e)}}var c=ou(e,0,!1,null,null,!1,!1,``,bu);return e._reactRootContainer=c,e[Oi]=c.current,ni(e.nodeType===8?e.parentNode:e),Dl(function(){uu(t,c,n,r)}),c}function Su(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=du(o);s.call(e)}}uu(t,o,e,i)}else o=xu(n,t,e,i,r);return du(o)}It=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=wt(t.pendingLanes);n!==0&&(Nt(t,n|1),yl(t,ct()),!(Wc&6)&&(il=ct()+500,ra()))}break;case 13:Dl(function(){var t=Xa(e,1);t!==null&&vl(t,e,1,gl())}),pu(e,1)}},Lt=function(e){if(e.tag===13){var t=Xa(e,134217728);t!==null&&vl(t,e,134217728,gl()),pu(e,134217728)}},Rt=function(e){if(e.tag===13){var t=_l(e),n=Xa(e,t);n!==null&&vl(n,e,t,gl()),pu(e,t)}},zt=function(){return Pt},Bt=function(e,t){var n=Pt;try{return Pt=e,t()}finally{Pt=n}},je=function(e,t,n){switch(t){case`input`:if(ue(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Fi(i);if(!a)throw Error(r(90));ae(i),ue(i,a)}}}break;case`textarea`:ge(e,n);break;case`select`:t=n.value,t!=null&&pe(e,!!n.multiple,t,!1)}},Le=El,Re=Dl;var Cu={usingClientEntryPoint:!1,Events:[Ni,Pi,Fi,Fe,Ie,El]},wu={findFiberByHostInstance:Mi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Tu={bundleType:wu.bundleType,version:wu.version,rendererPackageName:wu.rendererPackageName,rendererConfig:wu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=nt(e),e===null?null:e.stateNode},findFiberByHostInstance:wu.findFiberByHostInstance||mu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Eu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Eu.isDisabled&&Eu.supportsFiber)try{ht=Eu.inject(Tu),gt=Eu}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Cu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vu(t))throw Error(r(200));return su(e,t,null,n)},e.createRoot=function(e,t){if(!vu(e))throw Error(r(299));var n=!1,i=``,a=hu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=ou(e,1,!1,null,null,n,!1,i,a),e[Oi]=t.current,ni(e.nodeType===8?e.parentNode:e),new gu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=nt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return Dl(e)},e.hydrate=function(e,t,n){if(!yu(t))throw Error(r(200));return Su(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!vu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=hu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=lu(t,null,e,1,n??null,a,!1,o,s),e[Oi]=t.current,ni(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new _u(t)},e.render=function(e,t,n){if(!yu(t))throw Error(r(200));return Su(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!yu(e))throw Error(r(40));return e._reactRootContainer?(Dl(function(){Su(null,null,e,!1,function(){e._reactRootContainer=null,e[Oi]=null})}),!0):!1},e.unstable_batchedUpdates=El,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!yu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Su(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),ma=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=pa()})),ha=t((e=>{var t=ma();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function ga(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function _a(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function va(e){return{name:_a(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function ya(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function ba(e,t){let n=ya(va(e));return{stroke:n,display:t?.display??Oa(n),match:t?.match??wa(n),tokenName:t?.tokenName?ga(t.tokenName):void 0}}function xa(e){return{stroke:ya(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function Sa(e){return e.map(e=>xa(e))}function Ca(e){return`match`in e?e.match:`stroke`in e?wa(e.stroke):wa(e)}function wa(e){return`key:${ka(va(e))}`}function Ta(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function Ea(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:Oa(e.stroke):Oa(va(e))}function Da(e,t){return e.map(e=>Ea(e,t)).join(t?.separator??``)}function Oa(e){let t=[];return e.ctrl&&t.push(`ctrl`),e.shift&&t.push(`shift`),e.meta&&t.push(`meta`),e.super&&t.push(`super`),e.hyper&&t.push(`hyper`),t.push(e.name===`return`?`enter`:e.name),t.join(`+`)}function ka(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var Aa=Symbol(`keymap-extension-context`);function ja(e){return e.isDestroyed?null:e.getFocusedTarget()}function Ma(e,t,n){let r=t??e.rootTarget,i=t!==null;for(;r;){if(n(r,i)===!1)return;r=e.getParentTarget(r),i=!1}}function Na(e,t){let n=new Set;return Ma(e,t,e=>{n.add(e)}),n}function Pa(e,t,n){let r=[],i=Na(t,n),a=Array.isArray(e)?e:Fa(e);for(let e of a)Ia(t,e,n,i)&&r.push(e);return r}function Fa(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function Ia(e,t,n,r=Na(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function La(e){let t=e.binding.sequence[e.index];if(!t?.patternName)return 0;let n=e.patterns?.at(-1);return n?.name===t.patternName?n.values.length:0}function Ra(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?La(e)>=i.min:n}function za(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&La(e)<n.max)return!0}return Ra(e,t,n)&&e.index+1<e.binding.sequence.length}function Ba(e,t){return e.index===e.binding.sequence.length-1&&Ra(e,t,!1)}function Va(e,t,n,r){return{parent:e,depth:e?e.depth+1:0,stroke:t,match:n,pattern:r,children:new Map,patternChildren:[],bindings:[],reachableBindings:[]}}function Ha(e,t){let n=Va(null,null,null);for(let r of e){if(r.event!==`press`)continue;let e=n;for(let n of r.sequence){let i;if(n.patternName){let r=t.get(n.patternName);i=e.patternChildren.find(e=>e.pattern?.name===n.patternName),i||(i=Va(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=Va(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function Ua(e,t){let n=[];for(let r of e){if(!Ra(r,t))continue;let e=r.index+1,i=r.binding.sequence[e];i&&n.push({part:i,binding:r.binding,index:e,exact:e===r.binding.sequence.length-1,continues:e<r.binding.sequence.length-1})}return n}function Wa(e,t,n,r){let i=n.patternName;if(!i)return{...e,index:t};let a=[...e.patterns??[]],o=a.at(-1);return o?.name===i?a[a.length-1]={...o,values:[...o.values,r],parts:[...o.parts,n]}:a.push({name:i,payloadKey:n.payloadKey??i,values:[r],parts:[n]}),{layer:e.layer,binding:e.binding,index:t,parts:[...e.parts,n],patterns:a}}function Ga(e,t){let n=e.parts.at(-1);if(!n||n.patternName)return t.length;let r=t.indexOf(n.match);return r===-1?t.length:r}function Ka(e,t,n,r,i,a,o,s,c){let l=t.sequence[n];if(l){if(l.patternName){let a=s(l.patternName,o);if(!a)return;let u=c(o,l.patternName,a);return Wa({layer:e,binding:t,index:n,parts:r,patterns:i},n,u,a.value??o.name)}if(a.includes(l.match))return{layer:e,binding:t,index:n,parts:[...r,l],patterns:i}}}function qa(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&La(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return Wa(e,e.index,r,t.value??n.name)}}return Ra(e,r,!1)?Ka(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return Ka(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function Ja(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=Ka(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=Ga(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function Ya(e){let t=Object.create(null),n=(e,n)=>{let r=t[e];if(!r)return;let i=r.filter(e=>e!==n);i.length===0?delete t[e]:i.length!==r.length&&(t[e]=i)};return{hook(e,r){return t[e]=[...t[e]??[],r],()=>n(e,r)},has(e){return(t[e]?.length??0)>0},emit(n,...r){let i=t[n];if(i)for(let t of i)try{r.length===0?t():t(r[0])}catch(t){e(n,t)}}}}function Xa(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function Za(){let e=Xa();return{append(t){return e.set([...e.get(),t]),()=>e.remove(t)},prepend(t){return e.set([t,...e.get()]),()=>e.remove(t)},values:e.get,has:e.has,clear:e.clear}}function Qa(){let e=Xa(),t=0;return{register(n,r){let i={...r,listener:n,order:t++};return e.set([...e.get(),i].sort((e,t)=>t.priority-e.priority||e.order-t.order)),()=>e.remove(i)},entries:e.get,has:e.has,clear:e.clear}}function $a(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function eo(e){if(!Array.isArray(e))return{ok:!1,reason:`Invalid keymap bindings: expected an array of binding objects`};for(let[t,n]of e.entries()){if(!n||typeof n!=`object`||Array.isArray(n))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected a binding object`};if(!$a(n.key))return{ok:!1,reason:`Invalid keymap binding at index ${t}: expected "key" to be a string or keystroke object`}}return{ok:!0}}function to(e){let t=eo(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function no(e){return{...e,sequence:Sa(e.sequence)}}function ro(e,t){let n=Za();return{prependLayerAnalyzer(e){return n.prepend(e)},appendLayerAnalyzer(e){return n.append(e)},clearLayerAnalyzers(){n.clear()},analyzeLayer(r){let i=n.values();if(i.length===0)return;let a=io(r.bindings),o={target:r.target,order:r.order,sourceBindings:r.sourceBindings,bindings:a,hasTokenBindings:r.hasTokenBindings,checkCommandResolution(e){return t.getCommandResolutionStatus(e,r.commands)},warn(t,n,r){e.emitWarning(t,n,r)},warnOnce(t,n,r,i){e.warnOnce(t,n,r,i)},error(t,n,r){e.emitError(t,n,r)}};for(let t of i)try{t(o)}catch(t){e.emitError(`layer-analyzer-error`,t,`[Keymap] Error in layer analyzer:`)}}}}function io(e){return e.map(t=>({sequence:Sa(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:no(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&ao(e,t)),hasContinuations:e.some(e=>e.event===`press`&&oo(t,e))}))}function ao(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function oo(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function so(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function co(){return{plain:so(),bindings:so(),metadata:so(),bindingsAndMetadata:so()}}function lo(e,t){if(t===void 0)return e.plain;let n=t.includeBindings===!0,r=t.includeMetadata===!0;return n?r?e.bindingsAndMetadata:e.bindings:r?e.metadata:e.plain}function uo(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function fo(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function po(e,t){if(e===t)return!0;if(!e||!t||e.captures.length!==t.captures.length)return!1;for(let n=0;n<e.captures.length;n+=1){let r=e.captures[n],i=t.captures[n];if(!r||!i||r.layer!==i.layer||r.binding!==i.binding||r.index!==i.index||r.parts.length!==i.parts.length)return!1;for(let e=0;e<r.parts.length;e+=1)if(r.parts[e]?.match!==i.parts[e]?.match)return!1;let a=r.patterns??[],o=i.patterns??[];if(a.length!==o.length)return!1;for(let e=0;e<a.length;e+=1){let t=a[e],n=o[e];if(!t||!n||t.name!==n.name||t.values.length!==n.values.length)return!1;for(let e=0;e<t.values.length;e+=1)if(!Object.is(t.values[e],n.values[e]))return!1}}return!0}function mo(e){let t=e.parts.at(-1);if(!t||e.parts.length<=1)return;let n=e.index-1,r=e.patterns;if(t.patternName){let i=r?.at(-1);i?.name===t.patternName&&(i.values.length>1?(n=e.index,r=[...(r??[]).slice(0,-1),{...i,values:i.values.slice(0,-1),parts:i.parts.slice(0,-1)}]):r=(r??[]).slice(0,-1))}return{layer:e.layer,binding:e.binding,index:n,parts:e.parts.slice(0,-1),patterns:r}}function ho(e){let t=e.captures[0];if(!t||t.parts.length===0)return[];let n=[];for(let r=0;r<t.parts.length;r+=1){let i=t.parts[r];if(!i)continue;let a,o,s=!1,c=!1;for(let t of e.captures){let e=t.parts[r];if(e){if(a===void 0){a=e.display,o=e.tokenName;continue}!s&&a!==e.display&&(s=!0),!c&&o!==e.tokenName&&(c=!0)}}(a===void 0||s)&&(a=Ea(i.stroke)),c&&(o=void 0),n.push(ba(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function go(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function _o(e,t,n,r,i,a,o={}){let s=co(),c=-1,l=[],u=()=>go(t).getFocusedTarget(),d=()=>ja(t),f=t=>{let n=e.pending;po(n,t)||(e.pending=t,o.onPendingSequenceChanged?.(n,t),U(),r.queueStateChange())},p=()=>{let t=e.pending;if(!t)return;let n=u(),r=a.getActiveCommandView(n),o=t.captures.filter(t=>e.layers.has(t.layer)&&C(t.layer,n)&&i.matchesConditions(t.layer)&&D(t.binding,n,r)&&za(t,e.patterns));if(o.length===0){f(null);return}return o.length!==t.captures.length&&f({captures:o}),e.pending??void 0},m=()=>{t.isDestroyed||!e.pending||p()},h=()=>!t.isDestroyed&&e.pending!==null,g=()=>{if(c===e.cacheVersion)return l;let t=p(),n=t?ho(t):[];return(!t||T())&&(c=e.cacheVersion,l=n),n},_=()=>{let e=p();if(!e)return!1;let t=e.captures[0];if(!t||t.parts.length<=1)return f(null),!0;let n=[];for(let t of e.captures){let e=mo(t);e&&n.push(e)}return n.length===0?(f(null),!0):(f({captures:n}),!0)},v=t=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=lo(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&go(t);let o=u(),s=uo(n,e.cacheVersion,o);if(s)return n.notifyVersion=e.derivedVersion,n.version=e.cacheVersion,n.focused=o,n.value=s.value,s.value;let c=a.getActiveCommandView(o),l=p(),d=l?[]:S(o),f=l?F(l.captures,r,i,o,c):j(d,r,i,o,c);return(l?T():w(d))&&(n.version=e.cacheVersion,n.notifyVersion=e.derivedVersion,n.focused=o,n.value=f,fo(n,e.cacheVersion,o,f)),f},b=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=u(),o=a.getActiveCommandView(i);return F(e,n,r,i,o)},x=(e,t)=>{let n=t?.includeBindings===!0,r=t?.includeMetadata===!0,i=e===d()?p():void 0,o=a.getActiveCommandView(e);return i?F(i.captures,n,r,e,o):j(S(e),n,r,e,o)},S=n=>e.activeLayersCacheVersion===e.cacheVersion&&e.activeLayersCacheFocused===n?e.activeLayersCache:(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=n,e.activeLayersCache=Pa(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>Ia(t,e,n),w=t=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,T=()=>!e.commandResolvers.has()&&e.activeKeyCacheBlockers===0,E=(e,t,n)=>{let r=[];for(let o of e)i.matchesConditions(o)&&a.isBindingVisible(o,t,n)&&r.push(o);return r},D=(e,t,n)=>i.matchesConditions(e)&&a.isBindingVisible(e,t,n),O=(e,t)=>{let n,r,i=!1,a=!1;for(let o of e){let e=o.sequence[t];if(e){if(n===void 0){n=e.display,r=e.tokenName;continue}!i&&n!==e.display&&(i=!0),!a&&r!==e.tokenName&&(a=!0)}}if(n===void 0||i){let r=e[0]?.sequence[t]?.stroke;n=r?Ea(r):``}return a&&(r=void 0),{display:n,tokenName:r}},k=(e,t,n)=>({sequence:e.sequence,command:e.command,commandAttrs:a.getBindingCommandAttrs(e,t,n),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),A=(e,t,n)=>e.map(e=>k(e,t,n)),j=(e,t,n,r,a)=>{let o=new Map,s=new Set;for(let n of e)n.root.children.size===0&&n.root.patternChildren.length===0||!i.matchesConditions(n)||(M(n.root.children.values(),o,s,t,r,a),M(n.root.patternChildren,o,s,t,r,a));return R(o,t,n,r,a)},M=(e,t,n,r,i,a)=>{for(let o of e){let e=o.match;if(!e||n.has(e)||!o.stroke)continue;let s=N(o,r,i,a);if(!s)continue;let c=t.get(e);c?ee(c,s,r):t.set(e,H(o.stroke,s,r)),s.stop&&n.add(e)}},N=(e,t,n,r)=>{if(!(e.children.size>0||e.patternChildren.length>0)){let i=V(P(e)?E(e.bindings,n,r):e.bindings,n,r);if(!i)return;let a=O(i.bindings,e.depth-1);return{display:a.display,tokenName:a.tokenName,continues:!1,firstBinding:i.bindings[0],commandBinding:i.commandBinding,bindings:t?[...i.bindings]:void 0,stop:i.stop}}let i=E(e.reachableBindings,n,r);if(i.length===0)return;let a=V(e.bindings,n,r),o=O(i,e.depth-1);return{display:o.display,tokenName:o.tokenName,continues:!0,firstBinding:a?.bindings[0],commandBinding:a?.commandBinding,bindings:t&&a?[...a.bindings]:void 0,stop:!0}},P=t=>{if(e.commandResolvers.has())return!0;for(let e of t.bindings)if(e.matchers.length>0)return!0;return!1},F=(t,n,r,i,a)=>{let o=new Map,s=new Set;return I(Ua(t,e.patterns),o,s,n,i,a),R(o,n,r,i,a)},I=(e,t,n,r,i,a)=>{let o=new Set;for(let s of e)o.has(s.part.match)||(o.add(s.part.match),L(s,e,t,n,r,i,a))},L=(e,t,n,r,i,a,o)=>{let s=e.part.match;if(r.has(s))return;let c=z(e,t,i,a,o);if(!c)return;let l=n.get(s);l?ee(l,c,i):n.set(s,H(e.part.stroke,c,i)),c.stop&&r.add(s)},R=(e,t,n,r,i)=>{let a=[];for(let o of e.values()){let e=te(o,t,n,r,i);e&&a.push(e)}return a},z=(e,t,n,r,i)=>{let a=t.filter(t=>t.part.match===e.part.match),o=a.filter(e=>e.exact).map(e=>e.binding),s=V(o,r,i),c=a.some(e=>e.continues);if(!c&&!s)return;let l=B(a);return{display:l.display,tokenName:l.tokenName,continues:c,firstBinding:s?.bindings[0],commandBinding:s?.commandBinding,bindings:n&&s?[...s.bindings]:void 0,stop:c||s?.stop===!0}},B=e=>{let t,n,r=!1,i=!1;for(let a of e){let e=a.part;if(t===void 0){t=e.display,n=e.tokenName;continue}!r&&t!==e.display&&(r=!0),!i&&n!==e.tokenName&&(i=!0)}let a=e[0]?.part;return(t===void 0||r)&&(t=a?Ea(a.stroke):``),i&&(n=void 0),{display:t,tokenName:n}},V=(e,t,n)=>{let r=[],o;for(let s of e)if(!(!i.matchesConditions(s)||!a.isBindingVisible(s,t,n))&&(r.push(s),s.command!==void 0&&(o??=s,!s.fallthrough)))return{bindings:r,commandBinding:o,stop:!0};if(r.length!==0)return{bindings:r,commandBinding:o,stop:!1}},H=(e,t,n)=>({stroke:e,display:t.display,tokenName:t.tokenName,continues:t.continues,firstBinding:t.firstBinding,commandBinding:t.commandBinding,bindings:n&&t.bindings?[...t.bindings]:void 0}),ee=(e,t,n)=>{if(!e.firstBinding&&t.firstBinding&&(e.firstBinding=t.firstBinding),!e.commandBinding&&t.commandBinding&&(e.commandBinding=t.commandBinding),t.continues&&(e.continues=!0),!(!n||!t.bindings||t.bindings.length===0)){if(!e.bindings){e.bindings=[...t.bindings];return}e.bindings.push(...t.bindings)}},te=(e,t,n,r,i)=>{if(!e.commandBinding&&!e.continues)return;let o={stroke:ya(e.stroke),display:e.display,continues:e.continues};if(e.tokenName&&(o.tokenName=e.tokenName),e.commandBinding&&(o.command=e.commandBinding.command),t&&e.bindings&&e.bindings.length>0&&(o.bindings=e.bindings.length===1?[k(e.bindings[0],r,i)]:A(e.bindings,r,i)),n){e.firstBinding?.attrs&&(o.bindingAttrs=e.firstBinding.attrs);let t=e.commandBinding?a.getBindingCommandAttrs(e.commandBinding,r,i):void 0;t&&(o.commandAttrs=t)}return o},U=()=>{n.has(`pendingSequence`)&&n.emit(`pendingSequence`,e.pending?ho(e.pending):[])};return{getFocusedTarget:u,getFocusedTargetIfAvailable:d,setPendingSequence:f,ensureValidPendingSequence:p,revalidatePendingSequenceIfNeeded:m,hasPendingSequenceState:h,getPendingSequence:g,popPendingSequence:_,getActiveKeys:v,getActiveKeysForCaptures:b,getActiveKeysForFocused:x,getActiveLayers:S,isLayerActiveForFocused:C,collectSequencePartsFromPending:ho,collectMatchingBindings:E,collectActiveBindings:A}}var vo=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),yo=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),bo=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function xo(e){if(e===void 0||typeof e==`function`)return e;let t=e.trim();if(!t)throw Error(`Invalid keymap command: command cannot be empty`);return t}function So(e){let t=e.trim();if(!t)throw Error(`Invalid keymap command name: name cannot be empty`);if(/\s/.test(t))throw Error(`Invalid keymap command name "${e}": command names cannot contain whitespace`);return t}function Co(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function wo(e){let t=[],n=new Map;for(let r of e.layers)for(let e of r.commands){let i={layer:r,commandState:e};t.push(i),Co(n,e.command.name,i)}return{entries:t,chainsByName:n}}function To(e,t,n){let r=[],i=[],a=new Map,o=new Map;for(let s of e)if(s.commands.length!==0&&!(n&&!t.matchesConditions(s)))for(let e of s.commands){if(!t.matchesConditions(e))continue;let n={layer:s,commandState:e};r.push(n),Co(o,e.command.name,n),a.has(e.command.name)||(a.set(e.command.name,n),i.push(n))}return{layers:e,entries:r,reachable:i,reachableByName:a,chainsByName:o}}function Eo(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=Pa(e.sortedLayers,t,r)),To(e.activeLayersCache,n,!0)}function Do(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap requirement for "${t}" from ${r}`);e[t]=n}function Oo(e,t,n,r){if(Object.prototype.hasOwnProperty.call(e,t)&&!Object.is(e[t],n))throw Error(`Conflicting keymap attribute for "${t}" from ${r}`);e[t]=n}function ko(e){let t=`field ${e.fieldName}`;return{require(n,r){Do(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);Oo(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function Ao(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function jo(e,t){return e instanceof Error&&e.message?e.message:t}function Mo(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function No(e,t){let n=t?.deep===!0,r=t?.freeze===!0,i=t?.preserveNonPlainObjects===!0;if(Array.isArray(e)){let i=n?e.map(e=>No(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!Ao(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?No(i,t):i;return r?Object.freeze(a):a}return e}var Po=[`name`],Fo=Object.freeze({}),Io=new WeakMap;function Lo(e,t,n,r,i){let a=-1,o,s=-1,c,l,u=-1,d,f,p=-1,m,h=-1,g=new Map,_=t=>zo({commands:t,commandFields:e.commandFields,conditions:r,onError:(e,t,r)=>{n.emitError(e,t,r)}}),v=t=>R(()=>e.commandResolvers.prepend(t),t),y=t=>R(()=>e.commandResolvers.append(t),t),b=()=>{e.commandResolvers.has()&&n.runWithStateChangeBatch(()=>{e.commandResolvers.clear(),i.onCommandResolversChanged(),n.queueStateChange()})},x=e=>ne(e).map(e=>Ro(e.commandState)),S=e=>{let t=W(e),n=ne(e,t);if(n.length===0)return[];let r=n.map(e=>({entry:e,command:Ro(e.commandState),commandAttrs:e.commandState.attrs,bindings:[]})),i=new Map;for(let[e,t]of r.entries()){let n=i.get(t.command.name);n?n.push(e):i.set(t.command.name,[e])}return i.size>0&&re(r,i,t),r.map(e=>({command:e.command,bindings:e.bindings}))},C=t=>{if(t.visibility===`registered`&&u===e.derivedVersion&&d===t.commands&&f)return f;let n=new Map;for(let e of t.commands)n.has(e)||n.set(e,[]);return n.size===0?n:(ie(n,W(t)),t.visibility===`registered`&&(u=e.derivedVersion,d=t.commands,f=n),n)},w=(e,t,n)=>{let r=M(t);if(n){let i=[],a=r.chainsByName.get(e);if(a)for(let e of a)i.push({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs,payload:n.payload});let o=ue(e,t,{mode:`active`,execution:n});return o.resolved&&i.push(o.resolved),{entries:i.length>0?i:void 0,hadError:o.hadError}}let i=[];for(let t of r.chainsByName.get(e)??[])i.push({target:t.layer.target,command:t.commandState.command,attrs:t.commandState.attrs});let a=ue(e,t,{mode:`active`});return a.resolved&&i.push(a.resolved),{entries:i.length>0?i:void 0,hadError:a.hadError}},T=t=>{if(h!==e.derivedVersion&&(h=e.derivedVersion,g=new Map),g.has(t))return g.get(t)??void 0;let n=H(V(t));return g.set(t,n??null),n},E=(e,t)=>H(M(t).chainsByName.get(e)),D=(e,t)=>ue(e,null,{mode:`registered`,execution:t}),O=(e,t,n)=>ue(e,t,{mode:`active`,execution:n}),k=(e,t)=>z(e,t)?.command,A=e=>B(e)?.commandState.command,j=(e,n,i)=>{let a=N().chainsByName.get(e);if(!a||a.length===0)return;let o,s;for(let e of a){if(!Ia(t,e.layer,n)){o??=e;continue}(!r.matchesConditions(e.layer)||!r.matchesConditions(e.commandState))&&(s??=e)}let c=s??o;if(c)return{reason:s?`disabled`:`inactive`,command:i?c.commandState.command:void 0}},M=n=>{if(s===e.derivedVersion&&c===n&&l)return l;let i=Eo(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=wo(e),o),P=()=>e.activeCommandViewCacheBlockers===0,F=(e,t,n)=>e.command===void 0||e.run?!0:typeof e.command==`string`?n.reachableByName.has(e.command)?!0:ee(e.command,t,`active`)!==void 0:!1,I=(e,t,n)=>{if(typeof e.command!=`string`)return;let r=n.reachableByName.get(e.command);return r?r.commandState.attrs:ee(e.command,t,`active`)?.attrs},L=(e,n)=>{if(n?.some(t=>t.command.name===e)||N().chainsByName.has(e))return`resolved`;let r=ue(e,ja(t));return r.resolved||r.hadError?r.resolved?`resolved`:`error`:`unresolved`},R=(t,r)=>n.runWithStateChangeBatch(()=>{let a=t();return i.onCommandResolversChanged(),n.queueStateChange(),()=>{n.runWithStateChangeBatch(()=>{a(),!e.commandResolvers.values().includes(r)&&(i.onCommandResolversChanged(),n.queueStateChange())})}}),z=(e,t)=>{let n=M(t).reachableByName.get(e);return n?{target:n.layer.target,command:n.commandState.command,attrs:n.commandState.attrs}:ee(e,t,`active`)},B=e=>V(e)?.[0],V=t=>{let n=[];for(let r of e.sortedLayers)for(let e of r.commands)e.command.name===t&&n.push({layer:r,commandState:e});return n.length>0?n:void 0},H=e=>{if(e?.length)return e.map(e=>({target:e.layer.target,command:e.commandState.command,attrs:e.commandState.attrs}))},ee=(e,t,n)=>ue(e,t,{mode:n}).resolved,te=()=>N().entries,U=()=>{if(p===e.derivedVersion&&m)return m;let t=new Map;for(let n of e.layers)for(let e of n.bindings){if(typeof e.command!=`string`)continue;let n=t.get(e.command);n?n.push(e):t.set(e.command,[e])}return p=e.derivedVersion,m=t,t},W=e=>{let n=e?.visibility??`reachable`,r=e&&Object.prototype.hasOwnProperty.call(e,`focused`)?e.focused??null:ja(t);return n===`registered`?{visibility:n,focused:r}:{visibility:n,focused:r,activeView:M(r)}},ne=(e,t=W(e))=>{let r;return r=t.visibility===`registered`?te():t.visibility===`active`?t.activeView?.entries??[]:t.activeView?.reachable??[],Wo({entries:r,query:e,getCommand:e=>Ro(e),onFilterError:e=>{n.emitError(`command-query-filter-error`,e,`[Keymap] Error in command query filter:`)}})},re=(e,t,n)=>{ae(n,n=>{oe(e,t,n)})},ie=(e,t)=>{if(t.visibility===`registered`){let t=U();for(let[n,r]of e){let e=N().chainsByName.get(n)?.[0]?.commandState.attrs;for(let i of t.get(n)??[])r.push(ce(i,e))}return}ae(t,n=>{se(e,n,t)})},ae=(t,n)=>{if(t.visibility===`registered`){for(let t of e.layers)for(let e of t.bindings)n(e);return}let i=t.activeView;if(i){for(let e of i.layers)if(!(e.bindings.length===0||!r.matchesConditions(e)))for(let a of e.bindings)r.matchesConditions(a)&&F(a,t.focused,i)&&n(a)}},oe=(e,t,n)=>{if(typeof n.command!=`string`)return;let r=t.get(n.command);if(!(!r||r.length===0))for(let t of r){let r=e[t];r&&r.bindings.push(ce(n,r.commandAttrs))}},se=(e,t,n)=>{if(typeof t.command!=`string`)return;let r=e.get(t.command);r&&r.push(ce(t,le(t,n)))},ce=(e,t)=>({sequence:e.sequence,command:e.command,commandAttrs:t,attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough}),le=(e,t)=>{if(typeof e.command!=`string`)return;if(t.visibility===`registered`)return N().chainsByName.get(e.command)?.[0]?.commandState.attrs;let n=t.activeView;if(n)return I(e,t.focused,n)},ue=(t,r,i)=>{let a=i?.mode??`active`,o=i?.execution??{input:t},s=Bo(t,e.commandResolvers.values(),()=>G(r,a,o),e=>{n.emitError(`command-resolver-error`,e,`[Keymap] Error in command resolver for "${t}":`)}),c=s.resolved;if(c){let e=fe(c.command.name,r,a);e?.commandState.command===c.command&&c.target===void 0&&(c={...c,target:e.layer.target},s.resolved=c)}if(c&&!c.attrs){let e=de(c.command.name,r,a)??Uo(c.command);e&&(s.resolved={...c,attrs:e})}return s},de=(e,t,n)=>n===`registered`?B(e)?.commandState.attrs:M(t).reachableByName.get(e)?.commandState.attrs,fe=(e,t,n)=>n===`registered`?B(e):M(t).reachableByName.get(e),G=(e,t,n)=>{let r=n.input,i=n.payload;return{context:{get input(){return r},get payload(){return i},setInput(e){r=e},setPayload(e){i=e},getCommand:n=>t===`registered`?A(n):k(n,e)},getExecutionFields(){return{input:r,payload:i}}}};return{normalizeCommands:_,prependCommandResolver:v,appendCommandResolver:y,clearCommandResolvers:b,getCommands:x,getCommandEntries:S,getCommandBindings:C,getResolvedCommandChain:w,getRegisteredResolvedEntries:T,getActiveRegisteredResolvedEntries:E,resolveRegisteredResolverFallback:D,resolveActiveResolverFallback:O,getTopCommand:k,getDispatchUnavailableCommandState:j,getActiveCommandView:M,isBindingVisible:F,getBindingCommandAttrs:I,getCommandResolutionStatus:L}}function Ro(e){return e.command}function zo(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=So(r.name),s=Vo(r),c={};if(n.has(o)){e.onError(`duplicate-command`,{command:o},`Duplicate keymap command "${o}" in the same layer`);continue}r.name=o;for(let[t,n]of Object.entries(s)){if(n===void 0)continue;let r=e.commandFields.get(t);r&&r(n,ko({fieldName:t,conditions:e.conditions,requirements:i,matchers:a,attrs:c}))}let l={command:r,fields:s,attrs:Object.keys(c).length===0?void 0:c,requires:Object.entries(i),matchers:a};n.add(l.command.name),t.push(l)}catch(t){e.onError(`register-command-failed`,t,jo(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function Bo(e,t,n,r){if(t.length===0)return{hadError:!1};let i=!1;for(let a of t){let t,o=n();try{t=a(e,o.context)}catch(e){i=!0,r(e);continue}if(t)return{hadError:i,resolved:Ho(t,o.getExecutionFields())}}return{hadError:i}}function Vo(e){let t={};for(let[n,r]of Object.entries(e))!vo.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?Fo:t}function Ho(e,t){return{command:e,input:t.input,payload:t.payload}}function Uo(e){let t=Vo(e);return t===Fo?void 0:t}function Wo(e){let t=e.query?.namespace,n=Go(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=Po;e.query?.searchIn&&e.query.searchIn.length>0&&(i=e.query.searchIn);let a=e.query?.filter,o,s,c;if(typeof a==`function`)s=a;else if(a){let e=Object.entries(a),t=[];for(let[n,r]of e){if(n===`name`){if(typeof r==`string`){c=new Set([r]);continue}if(Array.isArray(r)){let e=new Set;for(let t of r)typeof t==`string`&&e.add(t);c=e;continue}}t.push([n,r])}o=t.length>0?t:void 0}let l=[];for(let a of e.entries){let u=a.commandState;if(qo(u,t)&&Ko(u,r,i)&&!(c&&!c.has(u.command.name))&&Jo(u,o,e)){if(s){let t=!1;try{t=s(e.getCommand(u))}catch(t){e.onFilterError(t);continue}if(!t)continue}if(l.push(a),n!==void 0&&l.length>=n)break}}return l}function Go(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function Ko(e,t,n){if(!t)return!0;for(let r of n)if(Yo(e,r,t))return!0;return!1}function qo(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?ns(n.namespace,t):!1}function Jo(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!$o(e,r,i,n))return!1;return!0}function Yo(e,t,n){return Xo(e,t)?.includes(n)===!0}function Xo(e,t){let n=Io.get(e);if(n||(n=new Map,Io.set(e,n)),n.has(t))return n.get(t);let r=e.fields,i=e.attrs,a;t===`name`?a=e.command.name:Object.prototype.hasOwnProperty.call(r,t)?a=r[t]:i&&Object.prototype.hasOwnProperty.call(i,t)&&(a=i[t]);let o=Zo(a);return n.set(t,o),o}function Zo(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=Zo(n);e!==void 0&&t.push(e)}return t.length>0?t.join(`\0`):void 0}if(typeof e==`string`)return e.toLowerCase();if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e).toLowerCase()}function Qo(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function $o(e,t,n,r){return typeof n==`function`?es(e,t,n,r):ts(e,t,n)}function es(e,t,n,r){let i=e.command,a=e.fields,o=e.attrs,s,c=!1,l=()=>s??=r.getCommand(e);return t===`name`&&(c=!0,Qo(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,Qo(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,Qo(n,o[t],l(),r.onFilterError))?!0:!c&&Qo(n,void 0,l(),r.onFilterError)}function ts(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&ns(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&ns(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&ns(a[t],n)}function ns(e,t){return Array.isArray(t)?t.some(t=>rs(e,t)):rs(e,t)}function rs(e,t){return Array.isArray(e)?e.some(e=>rs(e,t)):Object.is(e,t)}function is(e,t,n,r,i){let a=(e,t,n,r,a,o)=>({keymap:i.keymap,event:e,focused:t,target:n,data:r,input:a,payload:o}),o=(t,n,r,i)=>{let a=typeof n==`function`?void 0:n,o=typeof n==`function`?n:n.run,s=i?a:void 0,c;try{c=o(a?{...r,command:a}:r)}catch(n){return e.emitError(`command-execution-error`,n,`[Keymap] Error running command "${t}":`),{status:`error`,result:s?{ok:!1,reason:`error`,command:s}:{ok:!1,reason:`error`}}}if(Mo(c))return c.catch(n=>{e.emitError(`async-command-error`,n,`[Keymap] Async error in command "${t}":`)}),{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}};if(as(c)){let e=c;return(!c.ok&&c.reason!==`not-found`&&i&&a&&!c.command||c.ok&&i&&a&&!c.command)&&(e={...c,command:a}),{status:c.ok?`handled`:`rejected`,result:e}}return c===!1?{status:`rejected`,result:s?{ok:!1,reason:`rejected`,command:s}:{ok:!1,reason:`rejected`}}:{status:`handled`,result:s?{ok:!0,command:s}:{ok:!0}}},s=(e,t,n,r,i,s,c,l)=>{let u;for(let d of t??[]){let t=o(e,d.command,a(n,r,i??d.target??null,s,e,c),l);if(t.status===`handled`||t.status===`error`)return[t.result,u];u=t.result}return[void 0,u]},c=(e,c,l)=>{let u;try{u=xo(e)}catch{return{ok:!1,reason:`invalid-args`}}if(typeof u!=`string`)return{ok:!1,reason:`not-found`};let d=c?.includeCommand===!0,f=c?.focused??n.getFocusedTargetIfAvailable(),p=c?.event??i.createCommandEvent(),m=t.getReadonlyData(),h=c?.payload,g=l===`registered`?r.getRegisteredResolvedEntries(u):r.getActiveRegisteredResolvedEntries(u,f),[_,v]=s(u,g,p,f,c?.target,m,h,d);if(_)return _;let y=v,b=l===`registered`?r.resolveRegisteredResolverFallback(u,{input:u,payload:h}):r.resolveActiveResolverFallback(u,f,{input:u,payload:h});if(b.resolved){let e=o(u,b.resolved.command,a(p,f,c?.target??b.resolved.target??null,m,b.resolved.input??u,b.resolved.payload),d);if(e.status===`handled`||e.status===`error`)return e.result;y=e.result}if(b.hadError)return{ok:!1,reason:`error`};if(l===`active`){let e=r.getDispatchUnavailableCommandState(u,f,d);if(e)return e.command?{ok:!1,reason:e.reason,command:e.command}:{ok:!1,reason:e.reason}}return y??{ok:!1,reason:`not-found`}};return{runCommand(e,t){return c(e,t,`registered`)},dispatchCommand(e,t){return c(e,t,`active`)},runBinding(e,n,i,s,c){let l=t.getReadonlyData();if(n.run)return o(typeof n.command==`string`?n.command:`<function>`,n.run,a(i,s,e.target??null,l,typeof n.command==`string`?n.command:`<function>`,c),!1).status!==`rejected`&&(os(n,i),!0);if(typeof n.command!=`string`)return!1;let u=r.getResolvedCommandChain(n.command,s,c===void 0?void 0:{input:n.command,payload:c}).entries;for(let t of u??[])if(o(n.command,t.command,a(i,s,t.target??e.target??null,l,t.input??n.command,t.payload),!1).status!==`rejected`)return os(n,i),!0;return!1}}}function as(e){return typeof e==`object`&&!!e&&`ok`in e}function os(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var ss=Object.freeze({}),cs=[],ls=[];function us(e){if(Object.keys(e).length!==0)return No(e,{freeze:!0})}function ds(e,t,n,r){let i=t=>_s(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:ss,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=gs(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:ss,parseObjectKey:(e,t)=>c(e,t)});for(let e of n.unknownTokens)r.warnUnknownToken(e,t);return n.unknownTokens.length>0?[]:n.parts},o=(e,t)=>Da(a(e),t),s=(i,a,o,s,d)=>{let f=[],p=!1,m=e.bindingExpanders.values(),h=e.bindingParsers.values(),g=e.bindingFields,_=e.disambiguationResolvers.has(),v=r.warnUnknownField,y=r.warnUnknownToken;for(let[r,b]of i.entries()){let i;try{i=ms(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,jo(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?gs(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=hs(x,m)}catch(e){t.emitError(`binding-parse-error`,e,jo(e,`Failed to parse keymap binding`));continue}let S=x.parts;p||=x.hasTokenBindings;for(let e of x.unknownTokens)y(e,typeof i==`string`?i:String(i.name));if(!(x.unknownTokens.length>0))for(let i of u(b,S,a,h,d))try{let t=l(i.event),a=i.sequence,c={},u={},d=[];for(let e in i){if(e===`sequence`||yo.has(e))continue;let t=i[e];if(t===void 0)continue;let r=g.get(e);if(!r){v(`binding`,e);continue}r(t,ko({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?us(u):void 0,m=xo(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:no(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):cs,matchers:d.length>0?d:ls,preventDefault:i.preventDefault!==!1,fallthrough:i.fallthrough??!1};if(p&&(h.attrs=p),typeof m==`function`&&(h.run=m),a.length===0)continue;if(t===`release`&&a.length>1)throw Error(`Keymap release bindings only support a single key stroke`);let y=a.at(-1);if(y?.patternName){let t=e.patterns.get(y.patternName);if(t&&t.max!==t.min)throw Error(`Keymap unbounded sequence patterns must be followed by a concrete continuation`)}t===`press`&&!_&&ps(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,jo(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>ba(e,t),l=e=>{if(e===void 0||e===`press`)return`press`;if(e===`release`)return`release`;throw Error(`Invalid keymap binding event "${String(e)}": expected "press" or "release"`)},u=(n,r,i,a,o)=>{let s=e.bindingTransformers.values();if(s.length===0)return[{...n,sequence:Sa(r)}];let l={...n,sequence:Sa(r)},u=[],d=!0,f=o??ss;for(let n of s)try{n(l,{layer:f,parseKey:t=>_s(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(no(e))},skipOriginal:()=>{d=!1}})}catch(e){t.emitError(`binding-transformer-error`,e,`[Keymap] Error in binding transformer:`)}return d?u.length===0?[l]:[l,...u]:u};return{parseTokenKey:i,parseKeySequence:a,formatKey:o,compileBindings:s}}function fs(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}function ps(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&fs(n.sequence,t.sequence)||t.command!==void 0&&fs(t.sequence,n.sequence)))throw Error(`Keymap bindings cannot use the same sequence as both an exact match and a prefix in the same layer`)}function ms(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??ss,i=[{key:e}];for(let e of t){let t=[];for(let n of i){let i=e({input:n.key,displays:n.displays,layer:r});if(!i){t.push(n);continue}if(i.length===0)throw Error(`Keymap binding expander must return at least one key sequence for "${n.key}"`);for(let e of i){if(!e||typeof e!=`object`||Array.isArray(e)||typeof e.key!=`string`)throw Error(`Keymap binding expander must return expansion objects with string keys for "${n.key}"`);if(e.displays!==void 0){if(!Array.isArray(e.displays))throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`);for(let t of e.displays)if(typeof t!=`string`)throw Error(`Keymap binding expander displays must be an array of strings for "${n.key}"`)}t.push(e)}}i=t}return i}function hs(e,t){if(!t.displays)return e;if(t.displays.length!==e.parts.length)throw Error(`Keymap binding expansion displays length must match parsed sequence length for "${String(t.key)}"`);return{...e,parts:e.parts.map((e,n)=>({...e,display:t.displays[n]}))}}function gs(e,t,n){if(e.length===0)throw Error(`Invalid key sequence: sequence cannot be empty`);if(t.length===0)throw Error(`No keymap binding parsers are registered`);let r=n.tokens??new Map,i=n.patterns??new Map,a=n.layer??ss,o=n.parseObjectKey,s=[],c=new Set,l=new Set,u=0;for(;u<e.length;){let n=!1;for(let d of t){let t=d({input:e,index:u,layer:a,tokens:r,patterns:i,normalizeTokenName:ga,createMatch:Ta,parseObjectKey:o});if(t){if(t.nextIndex<=u||t.nextIndex>e.length)throw Error(`Keymap binding parser must advance the input for "${e}" at index ${u}`);s.push(...t.parts);for(let e of t.usedTokens??[])c.add(e);for(let e of t.unknownTokens??[])l.add(e);u=t.nextIndex,n=!0;break}}if(!n)throw Error(`No keymap binding parser handled input at index ${u} in "${e}"`)}return{parts:s,usedTokens:[...c],unknownTokens:[...l],hasTokenBindings:c.size>0||l.size>0}}function _s(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=gs(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function vs(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function ys(e,t){let n=e=>e.requires.length===0&&e.matchers.length===0,r=e=>{try{return e.match()}catch(n){return t.emitError(`runtime-matcher-error`,n,`[Keymap] Error evaluating runtime matcher from ${e.source}:`),!1}},i=e=>{if(e.matchers.length===0)return!0;if(e.matchers.length===1){let[t]=e.matchers;return!t||r(t)}for(let t of e.matchers)if(!r(t))return!1;return!0},a=t=>{if(t.length===0)return!0;for(let[n,r]of t)if(!Object.is(e.data[n],r))return!1;return!0};return{buildRuntimeMatcher(e,t){if(typeof e==`function`)return{source:t,match:e};if(vs(e))return{source:t,match:()=>e.get(),subscribe:t=>e.subscribe(t)};throw Error(`Keymap ${t} expected a function or a reactive matcher`)},matchesConditions:e=>n(e)||a(e.requires)&&i(e)}}var bs=Symbol(`keymap-disambiguation-decision`),xs=Symbol(`keymap-deferred-disambiguation-decision`);function Ss(e,t){return{[bs]:!0,action:e,handler:t}}function Cs(e){return{[xs]:!0,action:e}}function ws(e){return!!e&&typeof e==`object`&&e[bs]===!0}function Ts(e){return!!e&&typeof e==`object`&&e[xs]===!0}function Es(e,t){return t.aborted?Promise.resolve(!1):new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n(!0)},Math.max(0,e)),i=()=>{clearTimeout(r),t.removeEventListener(`abort`,i),n(!1)};t.addEventListener(`abort`,i,{once:!0})})}function Ds(e,t,n,r){let i=e.get(n);if(i)try{return i.matcher(r)}catch(e){t.emitError(`sequence-pattern-match-error`,e,`[Keymap] Error matching sequence pattern "${i.name}":`);return}}function Os(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...ba({name:t.name,ctrl:t.ctrl,shift:t.shift,meta:t.meta,super:t.super??!1,hyper:t.hyper||void 0},{display:r.display??String(r.value??t.name)}),patternName:n,payloadKey:i}}function ks(e,t,n){if(!n?.patterns||n.patterns.length===0)return;let r={},i=!1;for(let a of n.patterns){let n=e.get(a.name),o;try{o=n?.finalize?n.finalize(a.values):a.values.length===1?a.values[0]:[...a.values]}catch(e){t.emitError(`sequence-pattern-finalize-error`,e,`[Keymap] Error finalizing sequence pattern "${a.name}":`);continue}let s=r[a.payloadKey];s===void 0?(r[a.payloadKey]=o,i=!0):Array.isArray(s)?s.push(o):r[a.payloadKey]=[s,o]}return i?r:void 0}function As(e,t,n,r,i,a,o,s,c,l){let u={resolveKey:e=>o.parseTokenKey(e).match},d=null,f=0;function p(t,n,r){if(t===`key`){let t=r;return e.keyHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}if(t===`key:after`){let t=r;return e.keyAfterHooks.register(n,{priority:t?.priority??0,release:t?.release??!1})}let i=r;return e.rawHooks.register(n,{priority:i?.priority??0})}function m(t){return e.eventMatchResolvers.prepend(t)}function h(t){return e.eventMatchResolvers.append(t)}function g(){e.eventMatchResolvers.clear()}function _(t){return L(()=>e.disambiguationResolvers.prepend(t),t)}function v(t){return L(()=>e.disambiguationResolvers.append(t),t)}function y(){e.disambiguationResolvers.has()&&t.runWithStateChangeBatch(()=>{e.disambiguationResolvers.clear(),c.recompileBindings()})}function b(e,t){d&&ce()}function x(n){let r=e.rawHooks.entries();if(r.length===0)return!1;let i=!1,a={sequence:n,stop(){i=!0}};for(let e of r){try{e.listener(a)}catch(e){t.emitError(`raw-intercept-error`,e,`[Keymap] Error in raw intercept listener:`)}if(i)return!0}return!1}function S(e,t){return{sequence:Sa(e.sequence),command:e.command,commandAttrs:s.getBindingCommandAttrs(e,t,s.getActiveCommandView(t)),attrs:e.attrs,event:e.event,preventDefault:e.preventDefault,fallthrough:e.fallthrough,sourceLayerOrder:e.sourceLayerOrder,bindingIndex:e.bindingIndex}}function C(e){l.has(`dispatch`)&&l.emit(`dispatch`,e)}function w(e,t,n,r){l.has(`dispatch`)&&C({phase:e,event:n.event,focused:r,layer:{order:t.order,priority:t.priority,target:t.target,targetMode:t.targetMode},binding:S(n,r),sequence:Sa(n.sequence),command:n.command})}function T(e,t,n){if(!l.has(`dispatch`))return;let i=t[0],a=t.length>0?r.collectSequencePartsFromPending({captures:t}):[];C({phase:e,event:`press`,focused:n,layer:i?{order:i.layer.order,priority:i.layer.priority,target:i.layer.target,targetMode:i.layer.targetMode}:void 0,sequence:a})}function E(t){let n=e.keyAfterHooks.entries();for(let e of n)if(e.release===t)return n}function D(e){return e.sequence?Sa(e.sequence):e.captures?r.collectSequencePartsFromPending({captures:e.captures}):[]}function O(e,t){return{handled:e!==`sequence-miss`,reason:e,captures:t}}function k(e,t){return{handled:t,reason:t?`binding-handled`:`binding-rejected`,sequence:e.sequence}}function A(e,t){return t.handled||e.reason===`no-match`?t:e}function j(e,i,a,o,s){let c={event:i,eventType:a?`release`:`press`,focused:o,handled:s.handled,reason:s.reason,sequence:D(s),pendingSequence:r.getPendingSequence(),setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let n of e)if(n.release===a)try{n.listener(c)}catch(e){t.emitError(`key-after-intercept-error`,e,`[Keymap] Error in key:after intercept listener:`)}}function M(){return{handled:!1,reason:`no-match`}}function N(e){e.preventDefault(),e.stopPropagation()}function P(e,t,n,i){r.setPendingSequence({captures:t});let a=O(`sequence-pending`,t);return T(e,t,n),N(i),a}function F(e,t,n,i){let a=O(e,t);return T(`sequence-clear`,t,n),r.setPendingSequence(null),N(i),a}function I(i,a){a||ce();let o=E(a),s=o?r.getFocusedTarget():null,c=e.keyHooks.entries(),l={event:i,setData:(e,t)=>{n.setData(e,t)},getData:e=>n.getData(e),consume:e=>{let t=e?.preventDefault??!0,n=e?.stopPropagation??!0;t&&i.preventDefault(),n&&i.stopPropagation()}};for(let e of c)if(e.release===a){try{e.listener(l)}catch(e){t.emitError(`key-intercept-error`,e,`[Keymap] Error in key intercept listener:`)}if(i.propagationStopped){o&&j(o,i,a,s,{handled:!0,reason:`intercept-consumed`,sequence:[]});return}}if(a){let e=R(i);o&&j(o,i,a,s,e);return}let u=z(i);o&&j(o,i,a,s,u)}function L(n,r){return t.runWithStateChangeBatch(()=>{let i=e.disambiguationResolvers.has(),a=n();return!i&&e.disambiguationResolvers.has()&&c.recompileBindings(),()=>{t.runWithStateChangeBatch(()=>{let t=e.disambiguationResolvers.has();a(),!e.disambiguationResolvers.values().includes(r)&&t&&!e.disambiguationResolvers.has()&&c.recompileBindings()})}})}function R(e){let t=r.getFocusedTarget(),n=r.getActiveLayers(t),a=pe(e),o=M();for(let r of a)layerLoop:for(let a of n){if(a.bindings.length===0||!i.matchesConditions(a))continue;let n=me(a,r,e,t);if(o=A(o,n.outcome),n.handled){if(n.stop)return o;continue layerLoop}}return o}function z(e){let t=r.getFocusedTarget(),n=r.ensureValidPendingSequence(),i=pe(e);if(n)return B(n,i,e,t);let a=r.getActiveLayers(t),o=M();for(let n of i){let r=H(a,[n],e,t);if(o=A(o,r),r.handled)return o}return o}function B(t,n,i,a){let o=s.getActiveCommandView(a),c=[];for(let r of t.captures){let t=qa(r,n,i,e.patterns,he,ge);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,Ga(t,n)),1/0),u=c.filter(e=>Ga(e,n)===l);if(u.length===0||!u.some(e=>ye(e,a,o))){let e=O(`sequence-miss`,t.captures);return T(`sequence-clear`,t.captures,a),r.setPendingSequence(null),e}return V(u,0,!1,i,a)}function V(t,n,i,a,o){let s=i,c=M(),l=new Set;for(let i=n;i<t.length;i+=1){let n=t[i];if(!n||l.has(n))continue;let u=fe(t,i,n);if(u.length>0){if(s)continue;let e=G(t,n);return U(t,i,u,e,a,o,s)||P(`sequence-advance`,u,o,a)}if(!Ba(n,e.patterns))continue;let d=G(t,n);for(let e of d)l.add(e);let f=be(n.layer,d,a,o);if(c=A(c,f.outcome),f.handled&&(s=!0,f.stop))return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}return T(`sequence-clear`,t,o),r.setPendingSequence(null),c}function H(e,t,n,r){return ee(e,0,t,n,r)}function ee(t,n,r,a,o){let c=s.getActiveCommandView(o),l=M();for(let s=n;s<t.length;s+=1){let n=t[s];if(!n||!i.matchesConditions(n))continue;let u=K(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>za(t,e.patterns,!1)).length>0){let n=u.filter(t=>Ba(t,e.patterns)),i=de(t,s,r,a,o);return te(t,s,r,i,n,a,o)||P(`sequence-start`,i,o,a)}let d=be(n,u.filter(t=>Ba(t,e.patterns)),a,o);if(l=A(l,d.outcome),d.handled&&d.stop)return l}return l}function te(e,t,n,i,a,o,s){return W({event:o,focused:s,continuationCaptures:i,exactBindingsSource:a.map(e=>e.binding),sequencePhase:`sequence-start`,runExact:()=>{r.setPendingSequence(null);let i=a[0]?.layer;if(!i)return M();let c=be(i,a,o,s);return c.stop?c.outcome:A(c.outcome,ee(e,t+1,n,o,s))}})}function U(e,t,n,i,a,o,s){return W({event:a,focused:o,continuationCaptures:n,exactBindingsSource:i.map(e=>e.binding),sequencePhase:`sequence-advance`,runExact:()=>{r.setPendingSequence(null);let n=i[0]?.layer;if(!n)return M();let c=be(n,i,a,o);return c.stop?c.outcome:A(c.outcome,V(e,t+1,s||c.handled,a,o))}})}function W(t){let{event:n,focused:i,continuationCaptures:a,exactBindingsSource:o,sequencePhase:c,runExact:l}=t;if(!e.disambiguationResolvers.has()||a.length===0)return;let u=s.getActiveCommandView(i),d=r.collectMatchingBindings(o,i,u);if(!d.some(e=>e.command!==void 0))return;let f=()=>P(c,a,i,n),p=()=>F(`sequence-cleared`,a,i,n),m,h=()=>(m??=r.collectSequencePartsFromPending({captures:a}),m),g=re({event:n,focused:i,getSequence:h,exactBindings:d,continuationCaptures:a,activeView:u});return g?ne(g,a,l,f,p,i,h):(ue(h()),f())}function ne(e,t,n,r,i,a,o){if(e.action===`run-exact`)return n();if(e.action===`continue-sequence`)return r();if(e.action===`clear`)return i();let s=r();return ie(t,e.handler,a,o(),e=>{if(e){if(e.action===`run-exact`){n();return}if(e.action===`continue-sequence`){r();return}i()}}),s}function re(i){let a,o,s,c,l={event:i.event,focused:i.focused,get sequence(){return a??=Sa(i.getSequence()),a},get stroke(){let e=i.getSequence().at(-1);if(!e)throw Error(`Disambiguation context expected a non-empty sequence`);return c??={...e,stroke:ya(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:Sa(e.sequence)})),o},get continuations(){return s??=r.getActiveKeysForCaptures(i.continuationCaptures,{includeBindings:!0,includeMetadata:!0}),s},getData:e=>n.getData(e),setData:(e,t)=>{n.setData(e,t)},runExact:()=>Ss(`run-exact`),continueSequence:()=>Ss(`continue-sequence`),clear:()=>Ss(`clear`),defer:e=>Ss(`defer`,e)};for(let n of e.disambiguationResolvers.values()){let e;try{e=n(l)}catch(e){t.emitError(`disambiguation-resolver-error`,e,`[Keymap] Error in disambiguation resolver:`);continue}if(e!==void 0){if(Mo(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!ws(e)){t.emitError(`invalid-disambiguation-decision`,e,`[Keymap] Invalid disambiguation decision returned by resolver:`);continue}return e}}}function ie(e,t,n,r,i){ce();let a=new AbortController,o={id:f++,controller:a,captures:e,apply:i};d=o,queueMicrotask(()=>{ae(o,t,n,r)})}function ae(e,n,r,i){if(!le(e))return;let a={signal:e.controller.signal,sequence:Sa(i),focused:r,sleep:t=>Es(t,e.controller.signal),runExact:()=>Cs(`run-exact`),continueSequence:()=>Cs(`continue-sequence`),clear:()=>Cs(`clear`)},o;try{o=n(a)}catch(n){le(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),se(e));return}if(Mo(o)){o.then(t=>{oe(e,t)}).catch(n=>{le(e)&&(t.emitError(`deferred-disambiguation-error`,n,`[Keymap] Error in deferred disambiguation handler:`),se(e))});return}oe(e,o)}function oe(e,n){if(le(e)){if(n!==void 0&&!Ts(n)){t.emitError(`invalid-deferred-disambiguation-decision`,n,`[Keymap] Invalid deferred disambiguation decision returned by handler:`),se(e);return}se(e),e.apply(n)}}function se(e){le(e)&&(d=null)}function ce(){let e=d;e&&(d=null,e.controller.abort())}function le(e){return d===e}function ue(e){let n=Da(e,{preferDisplay:!0});t.warnOnce(`unresolved-disambiguation:${n}`,`unresolved-disambiguation`,{sequence:n},`[Keymap] Ambiguous exact/prefix sequence "${n}" fell back to prefix handling because no disambiguation resolver resolved it`)}function de(t,n,r,a,o){let c=[],l=s.getActiveCommandView(o);for(let s=n;s<t.length;s+=1){let n=t[s];if(n&&i.matchesConditions(n))for(let t of K(n,r,a,o,l))za(t,e.patterns,!1)&&c.push(t)}return c}function fe(t,n,r){return t.filter((t,i)=>i>=n&&za(t,e.patterns,!1)&&Ms(t.parts,r.parts))}function G(t,n){return t.filter(t=>t.layer===n.layer&&Ba(t,e.patterns)&&Ms(t.parts,n.parts))}function pe(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return js(r[0],n,u,t);let i=[],a=new Set;for(let e of r){let r;try{r=e(n,u)}catch(e){t.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`);continue}if(!(!r||r.length===0))for(let e of r){if(typeof e!=`string`){t.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}a.has(e)||(a.add(e),i.push(e))}}return i}function me(e,t,n,r){let o=!1,s=M();for(let c of e.bindings){if(c.event!==`release`)continue;let l=c.sequence[0];if(!l||l.match!==t||!i.matchesConditions(c))continue;let u=a.runBinding(e,c,n,r);if(s=A(s,k(c,u)),!u){w(`binding-reject`,e,c,r);continue}if(w(`binding-execute`,e,c,r),o=!0,!c.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}function he(n,r){return Ds(e.patterns,t,n,r)}function ge(t,n,r){return Os(e.patterns,t,n,r)}function K(e,t,n,r,i){let a=Ja(e,t,n,he,ge);return a.some(e=>ye(e,r,i))?a:[]}function _e(n){return ks(e.patterns,t,n)}function ve(e,t,n){return i.matchesConditions(e)&&s.isBindingVisible(e,t,n)}function ye(e,t,n){return ve(e.binding,t,n)}function be(e,t,n,r){let o=!1,s=M();for(let c of t){let t=c.binding;if(!i.matchesConditions(t))continue;let l=a.runBinding(e,t,n,r,_e(c));if(s=A(s,k(t,l)),!l){w(`binding-reject`,e,t,r);continue}if(w(`binding-execute`,e,t,r),o=!0,!t.fallthrough)return{handled:!0,stop:!0,outcome:s}}return{handled:o,stop:!1,outcome:s}}return{intercept:p,prependEventMatchResolver:m,appendEventMatchResolver:h,clearEventMatchResolvers:g,prependDisambiguationResolver:_,appendDisambiguationResolver:v,clearDisambiguationResolvers:y,handlePendingSequenceChange:b,handleRawSequence:x,handleKeyEvent:I}}function js(e,t,n,r){let i;try{i=e(t,n)}catch(e){return r.emitError(`event-match-resolver-error`,e,`[Keymap] Error in event match resolver:`),[]}if(!i||i.length===0)return[];if(i.length===1){let[e]=i;return typeof e==`string`?[e]:(r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`),[])}let a=[],o=new Set;for(let e of i){if(typeof e!=`string`){r.emitError(`invalid-event-match-resolver-candidate`,e,`[Keymap] Invalid event match resolver candidate:`);continue}o.has(e)||(o.add(e),a.push(e))}return a}function Ms(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.match!==t[n]?.match)return!1;return!0}var Ns=()=>{};function Ps(e,t,n,r){if(n===void 0)return r;if(typeof n!=`number`||!Number.isInteger(n)||n<0)throw Error(`Keymap sequence pattern "${e}" ${t} must be a non-negative integer`);return n}function Fs(e,t){let{kind:n,reservedFields:r,registeredFields:i,emitError:a}=t,o=Object.entries(e),s=[];for(let[e,t]of o){if(r.has(e)){a(`reserved-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is reserved`);continue}if(i.has(e)){a(`duplicate-${n}-field`,{field:e,kind:n},`Keymap ${n} field "${e}" is already registered`);continue}i.set(e,t),s.push([e,t])}return()=>{for(let[e,t]of s)i.get(e)===t&&i.delete(e)}}function Is(e,t,n,r,i){let a;try{a=ga(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,jo(e,`Failed to register keymap token`)),Ns}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),Ns;let o;try{if(o=n.parseTokenKey(i.key),o.patternName)throw Error(`Invalid key "${String(i.key)}": expected a concrete key stroke`)}catch(e){return t.emitError(`token-parse-error`,e,jo(e,`Failed to register keymap token "${a}"`)),Ns}let s={stroke:o.stroke,match:o.match},c=new Map(e.tokens);c.set(a,s);try{r.applyTokenState(c)}catch(e){return t.emitError(`token-register-error`,e,jo(e,`Failed to register keymap token "${a}"`)),Ns}return()=>{if(e.tokens.get(a)!==s)return;let n=new Map(e.tokens);n.delete(a);try{r.applyTokenState(n)}catch(e){t.emitError(`token-unregister-error`,e,jo(e,`Failed to unregister keymap token "${a}"`))}}}function Ls(e,t,n,r){let i,a;try{i=ga(r.name);let e=Ps(i,`min`,r.min,1),t=Ps(i,`max`,r.max,2**53-1);if(t<e)throw Error(`Keymap sequence pattern "${i}" max must be greater than or equal to min`);a={name:i,display:r.display,payloadKey:r.payloadKey??i,match:Ta(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,jo(e,`Failed to register keymap sequence pattern`)),Ns}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),Ns):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function Rs(e,t,n,r){return Fs(r,{kind:n,reservedFields:n===`layer`?bo:n===`binding`?yo:vo,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var zs=()=>{};function Bs(e,t){return t.priority-e.priority||t.order-e.order}function Vs(e){if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;for(let t of e.bindings)if(t.matchers.length>0)return!0;return!1}function Hs(e){if(e.commands.length===0)return!1;if(e.matchers.length>0)return!0;for(let t of e.commands)if(t.matchers.length>0)return!0;return!1}function Us(e,t,n,r,i){let a=n=>t.runWithStateChangeBatch(()=>{let a=n.target;if(a&&i.host.isTargetDestroyed(a))return t.emitError(`destroyed-layer-target`,{target:a},`Cannot register a keymap layer for a destroyed keymap target`),zs;let o,s,c,p,m,v,y;try{y=l(n),o=u(to(n.bindings??[]),n);let e=d(n.commands??[],n);v=e.length===0?[]:i.commands.normalizeCommands(e),{requires:s,matchers:c,fields:p,attrs:m}=f(n)}catch(e){return t.emitError(`register-layer-failed`,e,jo(e,`Failed to register keymap layer`)),zs}let b=e.order++,x=i.compiler.compileBindings(o,e.tokens,a,b,p);if(x.bindings.length===0&&!x.hasTokenBindings&&v.length===0)return zs;i.diagnostics?.analyzeLayer({target:a,order:b,commands:v,sourceBindings:o,bindings:x.bindings,hasTokenBindings:x.hasTokenBindings});let S={order:b,target:a,targetMode:y,priority:n.priority??0,requires:s,matchers:c,fields:p,attrs:m,commands:v,sourceBindings:o,bindings:x.bindings,root:Ha(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(Bs),g(S);for(let e of S.commands)g(e);for(let e of S.bindings)g(e);return a&&(S.offTargetDestroy=i.host.onTargetDestroy(a,()=>{h(S)})),S.commands.length>0&&r.ensureValidPendingSequence(),t.queueStateChange(),()=>{h(S)}}),o=n=>{t.runWithStateChangeBatch(()=>{let i=new Map;for(let t of e.layers)t.hasTokenBindings&&i.set(t,p(t,n));e.tokens=n;let a=!1;for(let[e,t]of i)m(e,t)&&(a=!0);a&&r.setPendingSequence(null),i.size>0&&t.queueStateChange()})},s=()=>{t.runWithStateChangeBatch(()=>{let n=0,i=!1;for(let t of e.layers){if(t.sourceBindings.length===0)continue;let r=p(t,e.tokens);m(t,r)&&(i=!0),n+=1}i&&r.setPendingSequence(null),n>0&&t.queueStateChange()})},c=()=>{for(let t of e.layers){y(t);for(let e of t.commands)y(e);for(let e of t.bindings)y(e);t.offTargetDestroy?.(),t.offTargetDestroy=void 0}},l=e=>{if(e.targetMode){if(!e.target)throw Error(`Keymap targetMode "${e.targetMode}" requires a target`);return e.targetMode}return e.target?`focus-within`:void 0},u=(t,n)=>{let r=e.layerBindingsTransformers.values();if(r.length===0)return t;let i=t;for(let e of r){let t=e(i,{layer:n,validateBindings:e=>eo(e)});t&&(i=to(t))}return i},d=(n,r)=>{let i=e.commandTransformers.values();if(n.length===0||i.length===0)return n;let a=[];for(let e of n){let n={...e},o=[],s=!0;for(let e of i)try{e(n,{layer:r,add(e){o.push({...e})},skipOriginal(){s=!1}})}catch(e){t.emitError(`command-transformer-error`,e,`[Keymap] Error in command transformer:`)}s&&a.push(n),a.push(...o)}return a},f=t=>{let r={},a=[],o=Object.create(null),s={};for(let[c,l]of Object.entries(t)){if(bo.has(c)||l===void 0)continue;o[c]=No(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,ko({fieldName:c,conditions:n,requirements:r,matchers:a,attrs:s}))}return{requires:Object.entries(r),matchers:a,fields:Object.keys(o).length>0?Object.freeze(o):void 0,attrs:Object.keys(s).length>0?No(s,{freeze:!0}):void 0}},p=(e,t)=>i.compiler.compileBindings(e.sourceBindings,t,e.target,e.order,e.fields),m=(t,n)=>{i.diagnostics?.analyzeLayer({target:t.target,order:t.order,commands:t.commands,sourceBindings:t.sourceBindings,bindings:n.bindings,hasTokenBindings:n.hasTokenBindings}),v(t);for(let e of t.bindings)y(e);t.bindings=n.bindings,t.root=Ha(n.bindings,e.patterns),t.hasTokenBindings=n.hasTokenBindings,_(t);for(let e of t.bindings)g(e);return e.pending?.captures.some(e=>e.layer===t)??!1},h=n=>{t.runWithStateChangeBatch(()=>{if(e.layers.delete(n)){e.sortedLayers=e.sortedLayers.filter(e=>e!==n),v(n),y(n);for(let e of n.commands)y(e);for(let e of n.bindings)y(e);n.offTargetDestroy?.(),n.offTargetDestroy=void 0,e.pending?.captures.some(e=>e.layer===n)?r.setPendingSequence(null):n.commands.length>0&&!i.host.isDestroyed&&r.ensureValidPendingSequence(),t.queueStateChange()}})},g=e=>{for(let n of e.matchers)if(n.subscribe)try{n.dispose=n.subscribe(()=>{if(!r.hasPendingSequenceState()){t.queueStateChange();return}t.runWithStateChangeBatch(()=>{r.revalidatePendingSequenceIfNeeded(),t.queueStateChange()})})}catch(e){t.emitError(`reactive-matcher-subscribe-error`,e,jo(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=Vs(t),r=Hs(t);t.activeKeyCacheBlocked=n,t.activeCommandViewCacheBlocked=r,n&&(e.activeKeyCacheBlockers+=1),r&&(e.activeCommandViewCacheBlockers+=1)},v=t=>{t.activeKeyCacheBlocked&&=(--e.activeKeyCacheBlockers,!1),t.activeCommandViewCacheBlocked&&=(--e.activeCommandViewCacheBlockers,!1)},y=e=>{for(let n of e.matchers)if(n.dispose){try{n.dispose()}catch(e){t.emitError(`reactive-matcher-dispose-error`,e,jo(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var Ws=1e3;function Gs(e,t,n){let r=(e,n,r)=>{if(!t.has(`warning`)){let t=`[${e}] ${r}`;n instanceof Error?console.warn(t,n):console.warn(t);return}t.emit(`warning`,{code:e,message:r,warning:n})},i=(e,n,r)=>{if(!t.has(`error`)){let t=`[${e}] ${r}`;n instanceof Error?console.error(t,n):console.error(t);return}t.emit(`error`,{code:e,message:r,error:n})},a=()=>{if(!(!e.stateChangePending||e.stateChangeDepth>0||e.flushingStateChange)){e.flushingStateChange=!0;try{let t=0;for(;e.stateChangePending&&e.stateChangeDepth===0;){if(t>=Ws){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:Ws},`[Keymap] Possible infinite state listener feedback loop detected after ${Ws} iterations; pending state notifications were dropped`);break}t+=1,e.stateChangePending=!1,n.emit(`state`)}}finally{e.flushingStateChange=!1}}};return{runWithStateChangeBatch(t){e.stateChangeDepth+=1;try{return t()}finally{--e.stateChangeDepth,e.stateChangeDepth===0&&a()}},queueStateChange(t){e.derivedVersion+=1,t?.invalidateCaches!==!1&&(e.cacheVersion+=1),n.has(`state`)&&(e.stateChangePending=!0,e.stateChangeDepth===0&&!e.flushingStateChange&&a())},emitWarning:r,emitError:i,reportListenerError(e,t){if(e===`state`){i(`state-listener-error`,t,`[Keymap] Error in state listener:`);return}if(e===`pendingSequence`){i(`pending-sequence-listener-error`,t,`[Keymap] Error in pending sequence listener:`);return}e===`dispatch`&&i(`dispatch-listener-error`,t,`[Keymap] Error in dispatch listener:`)},warnOnce(t,n,i,a){e.usedWarningKeys.has(t)||(e.usedWarningKeys.add(t),r(n,i,a))}}}function Ks(e,t,n){return{getData(t){return e.data[t]},setData(r,i){t.runWithStateChangeBatch(()=>{if(i===void 0){if(!(r in e.data))return;delete e.data[r],e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange();return}Object.is(e.data[r],i)||(e.data[r]=i,e.dataVersion+=1,n.ensureValidPendingSequence(),t.queueStateChange())})},getReadonlyData(){return e.readonlyDataVersion===e.dataVersion?e.readonlyData:(e.readonlyData=Object.freeze({...e.data}),e.readonlyDataVersion=e.dataVersion,e.readonlyData)}}}var qs=Object.freeze({});function Js(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:Za(),bindingExpanders:Za(),bindingParsers:Za(),bindingTransformers:Za(),bindingFields:new Map,commandTransformers:Za(),commandFields:new Map,eventMatchResolvers:Za(),disambiguationResolvers:Za(),keyHooks:Qa(),keyAfterHooks:Qa(),rawHooks:Qa(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:Za(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:qs,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function Ys(e){return Ca(e)}var Xs=class{#e=Js();#t=!1;#n=new Map;#r=[];#i=Ya(()=>{});#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y;#b;getPendingSequence;getActiveKeys;constructor(e){if(this.#b=e,e.isDestroyed)throw Error(`Cannot create a keymap for a destroyed host`);this.#a=Ya((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=Gs(this.#e,this.#i,this.#a),this.#l=ys(this.#e,this.#o),this.#u=Lo(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=_o(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=Ks(this.#e,this.#o,this.#s),this.#d=is(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=ds(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=ro(this.#o,this.#u),this.#m=Us(this.#e,this.#o,this.#l,this.#s,{compiler:this.#f,commands:this.#u,host:this.#b,diagnostics:this.#h,warnUnknownField:(e,t)=>{this.#C(e,t)}}),this.#p=As(this.#e,this.#o,this.#c,this.#s,this.#l,this.#d,this.#f,this.#u,this.#m,this.#a),this.getPendingSequence=this.#s.getPendingSequence,this.getActiveKeys=this.#s.getActiveKeys,this.#g=e=>{this.#p.handleKeyEvent(e,!1)},this.#_=e=>{this.#p.handleKeyEvent(e,!0)},this.#v=e=>this.#p.handleRawSequence(e),this.#y=e=>{this.#S(e)},this.#r.push(this.#b.onKeyPress(this.#g)),this.#r.push(this.#b.onKeyRelease(this.#_)),this.#b.onRawInput&&this.#r.push(this.#b.onRawInput(this.#v)),this.#r.push(this.#b.onFocusChange(this.#y)),this.#b.onDestroy&&this.#r.push(this.#b.onDestroy(()=>{this.#x()}))}[Aa](){return{state:this.#e,host:this.#b,conditions:this.#l,catalog:this.#u,activation:this.#s}}#x(){if(!this.#t){this.#t=!0,this.#s.setPendingSequence(null);for(let e of this.#n.values())e.dispose();this.#n.clear(),this.#m.cleanup();for(let e of this.#r.splice(0))e()}}setData(e,t){this.#c.setData(e,t)}getData(e){return this.#c.getData(e)}getHostMetadata(){return this.#b.metadata}hasPendingSequence(){return this.#s.ensureValidPendingSequence()!==void 0}createKeyMatcher(e){let t=this.#f.parseTokenKey(e).match;return e=>e?Ys(e)===t:!1}parseKeySequence(e){return this.#f.parseKeySequence(e)}formatKey(e,t){return this.#f.formatKey(e,t)}clearPendingSequence(){this.#s.setPendingSequence(null)}popPendingSequence(){return this.#s.popPendingSequence()}getCommands(e){return this.#u.getCommands(e)}getCommandEntries(e){return this.#u.getCommandEntries(e)}getCommandBindings(e){return this.#u.getCommandBindings(e)}acquireResource(e,t){if(this.#t||this.#b.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);let n=this.#n.get(e);if(n)return n.count+=1,()=>{this.#T(e,n)};let r={count:1,dispose:t()};return this.#n.set(e,r),()=>{this.#T(e,r)}}runCommand(e,t){return this.#d.runCommand(e,t)}dispatchCommand(e,t){return this.#d.dispatchCommand(e,t)}on(e,t){return e===`warning`||e===`error`?this.#i.hook(e,t):this.#a.hook(e,t)}intercept(e,t,n){return this.#p.intercept(e,t,n)}registerLayer(e){return this.#m.registerLayer(e)}registerLayerFields(e){return Rs(this.#e,this.#o,`layer`,e)}prependLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.prepend(e)}appendLayerBindingsTransformer(e){return this.#e.layerBindingsTransformers.append(e)}clearLayerBindingsTransformers(){this.#e.layerBindingsTransformers.clear()}prependBindingTransformer(e){return this.#e.bindingTransformers.prepend(e)}appendBindingTransformer(e){return this.#e.bindingTransformers.append(e)}clearBindingTransformers(){this.#e.bindingTransformers.clear()}prependCommandTransformer(e){return this.#e.commandTransformers.prepend(e)}appendCommandTransformer(e){return this.#e.commandTransformers.append(e)}clearCommandTransformers(){this.#e.commandTransformers.clear()}prependBindingParser(e){return this.#e.bindingParsers.prepend(e)}appendBindingParser(e){return this.#e.bindingParsers.append(e)}clearBindingParsers(){this.#e.bindingParsers.clear()}registerToken(e){return Is(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return Ls(this.#e,this.#o,this.#m,e)}prependBindingExpander(e){return this.#e.bindingExpanders.prepend(e)}appendBindingExpander(e){return this.#e.bindingExpanders.append(e)}clearBindingExpanders(){this.#e.bindingExpanders.clear()}registerBindingFields(e){return Rs(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return Rs(this.#e,this.#o,`command`,e)}prependCommandResolver(e){return this.#u.prependCommandResolver(e)}appendCommandResolver(e){return this.#u.appendCommandResolver(e)}clearCommandResolvers(){this.#u.clearCommandResolvers()}prependLayerAnalyzer(e){return this.#h.prependLayerAnalyzer(e)}appendLayerAnalyzer(e){return this.#h.appendLayerAnalyzer(e)}clearLayerAnalyzers(){this.#h.clearLayerAnalyzers()}prependEventMatchResolver(e){return this.#p.prependEventMatchResolver(e)}appendEventMatchResolver(e){return this.#p.appendEventMatchResolver(e)}clearEventMatchResolvers(){this.#p.clearEventMatchResolvers()}prependDisambiguationResolver(e){return this.#p.prependDisambiguationResolver(e)}appendDisambiguationResolver(e){return this.#p.appendDisambiguationResolver(e)}clearDisambiguationResolvers(){this.#p.clearDisambiguationResolvers()}#S(e){this.#o.runWithStateChangeBatch(()=>{this.#s.setPendingSequence(null),this.#o.queueStateChange({invalidateCaches:!1})})}#C(e,t){this.#o.warnOnce(`${e}:${t}`,`unknown-${e}-field`,{field:t,kind:e},`[Keymap] Unknown ${e} field "${t}" was ignored`)}#w(e,t){this.#o.warnOnce(`token:${e}`,`unknown-token`,{token:e,sequence:t},`[Keymap] Unknown token "${e}" in key sequence "${t}"; binding was skipped until the token is registered`)}#T(e,t){this.#n.get(e)===t&&(--t.count,!(t.count>0)&&(t.dispose(),this.#n.delete(e)))}},Zs=new Set(`up.down.left.right.clear.escape.return.linefeed.enter.tab.backspace.delete.insert.home.end.pageup.pagedown.space.lt.gt.plus.minus.equal.comma.period.slash.backslash.semicolon.quote.backquote.leftbracket.rightbracket.capslock.numlock.scrolllock.printscreen.pause.menu.apps.kp0.kp1.kp2.kp3.kp4.kp5.kp6.kp7.kp8.kp9.kpdecimal.kpdivide.kpmultiply.kpminus.kpplus.kpenter.kpequal.kpseparator.kpleft.kpright.kpup.kpdown.kppageup.kppagedown.kphome.kpend.kpinsert.kpdelete.mediaplay.mediapause.mediaplaypause.mediareverse.mediastop.mediafastforward.mediarewind.medianext.mediaprev.mediarecord.volumedown.volumeup.mute.leftshift.leftctrl.leftalt.leftsuper.lefthyper.leftmeta.rightshift.rightctrl.rightalt.rightsuper.righthyper.rightmeta.iso_level3_shift.iso_level5_shift.option.alt.meta.super.hyper.control.ctrl.shift`.split(`.`)),Qs=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),$s=tc(Zs),ec=tc(Qs);function tc(e){let t=new Map;for(let n of e){let e=n.charCodeAt(0);if(Number.isNaN(e))continue;let r=t.get(e);r||(r=[],t.set(e,r)),r.push(n)}for(let e of t.values())e.sort((e,t)=>t.length-e.length);return t}function nc(e){return e>=65&&e<=90?e+32:e}function rc(e){return e>=48&&e<=57}function ic(e,t,n){if(e.startsWith(t,n))return!0;if(n+t.length>e.length)return!1;for(let r=0;r<t.length;r+=1)if(nc(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function ac(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(nc(r));if(i){for(let e of i)if(ic(t,e,n))return e}}function oc(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function sc(e,t){if(e===` `)return t.parseObjectKey({name:`space`},{display:`space`});if(e===`+`)return t.parseObjectKey({name:`+`},{display:`+`});let n=e.split(`+`),r=``,i=``,a=!1,o=!1,s=!1,c=!1,l=!1;for(let t of n){let n=t.trim();if(!n)continue;let u=n.toLowerCase();if(u===`ctrl`||u===`control`){a=!0;continue}if(u===`shift`){o=!0;continue}if(u===`meta`||u===`alt`||u===`option`){s=!0;continue}if(u===`super`){c=!0;continue}if(u===`hyper`){l=!0;continue}if(r)throw Error(`Invalid key "${e}": multiple key names are not supported`);r=n,i=u}if(!r)throw Error(`Invalid key "${e}": missing key name`);let u=[];return a&&u.push(`ctrl`),o&&u.push(`shift`),s&&u.push(`meta`),c&&u.push(`super`),l&&u.push(`hyper`),u.push(i),t.parseObjectKey({name:r,ctrl:a,shift:o,meta:s,super:c,hyper:l||void 0},{display:u.join(`+`)})}function cc(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function lc(e,t){let n=ac($s,e,t);if(n)return n;if(nc(e.charCodeAt(t))!==102||!rc(e.charCodeAt(t+1)))return;let r=rc(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function uc(e,t){return ac(ec,e,t)}function dc(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=uc(e,r);if(!t)break;let n=r+t.length;if(e[n]!==`+`)break;t===`ctrl`||t===`control`?i=!0:t===`shift`?a=!0:t===`meta`||t===`alt`||t===`option`?o=!0:t===`super`?s=!0:t===`hyper`&&(c=!0),r=n+1}if(r===t)return;let l=e[r];if(l===void 0)throw Error(`Invalid key "${e.slice(t)}": missing key name`);let u=lc(e,r)??l,d=u===` `?`space`:u===`+`?`+`:u.toLowerCase(),f=[];return i&&f.push(`ctrl`),a&&f.push(`shift`),o&&f.push(`meta`),s&&f.push(`super`),c&&f.push(`hyper`),f.push(d),{part:n.parseObjectKey({name:u===` `?`space`:u,ctrl:i,shift:a,meta:o,super:s,hyper:c||void 0},{display:f.join(`+`)}),nextIndex:r+u.length}}var fc=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[sc(t,e)],nextIndex:t.length};let a=t[n];if(a===void 0)return;if(a===`<`){let o=t.indexOf(`>`,n);if(o===-1)return{parts:[sc(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[oc(e,c.stroke,`<${s}>`,c.match,s)],nextIndex:o+1,usedTokens:[s]}:{parts:[],nextIndex:o+1,unknownTokens:[s]}}if(a===`{`){let r=t.indexOf(`}`,n);if(r===-1)return{parts:[sc(a,e)],nextIndex:n+1};let o=i(t.slice(n+1,r)),s=e.patterns.get(o);return s?{parts:[{...e.parseObjectKey({name:o,ctrl:!1,shift:!1,meta:!1,super:!1},{display:s.display??`{${o}}`,match:s.match}),patternName:s.name,payloadKey:s.payloadKey}],nextIndex:r+1,usedTokens:[o]}:{parts:[],nextIndex:r+1,unknownTokens:[o]}}let o=dc(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=lc(t,n);return s?{parts:[cc(s,e)],nextIndex:n+s.length}:{parts:[sc(a,e)],nextIndex:n+1}},pc=(e,t)=>[t.resolveKey({name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0})];function mc(e){return e.appendBindingParser(e=>fc(e))}function Y(e){return e.appendEventMatchResolver((e,t)=>pc(e,t))}function hc(e){let t=mc(e),n=Y(e);return()=>{n(),t()}}var gc=Symbol(`keymap:mod-bindings`),_c=/(^|[+,\s])mod(?=\s*\+)/i,vc=/(^|[+,\s])mod(?=\s*\+)/gi;function yc(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function bc(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function xc(e){return e.acquireResource(gc,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!_c.test(t))return;let r=yc(e.getHostMetadata());return[{key:t.replace(vc,(e,t)=>`${t}${r}`),displays:n??bc(t)}]}))}var Sc=new Map([[` `,`space`],[`Spacebar`,`space`],[`ArrowUp`,`up`],[`ArrowDown`,`down`],[`ArrowLeft`,`left`],[`ArrowRight`,`right`],[`Escape`,`escape`],[`Esc`,`escape`],[`Enter`,`return`],[`Backspace`,`backspace`],[`Delete`,`delete`],[`Tab`,`tab`],[`Home`,`home`],[`End`,`end`],[`PageUp`,`pageup`],[`PageDown`,`pagedown`],[`Insert`,`insert`],[`CapsLock`,`capslock`],[`NumLock`,`numlock`],[`ScrollLock`,`scrolllock`],[`ContextMenu`,`menu`],[`Meta`,`super`],[`OS`,`super`],[`Alt`,`alt`],[`Control`,`control`],[`Shift`,`shift`]]);function Cc(e){let t=e?.trim().toLowerCase();return t?t.includes(`mac`)||t.includes(`darwin`)?`macos`:t.includes(`win`)?`windows`:t.includes(`linux`)||t.includes(`x11`)?`linux`:`unknown`:`unknown`}function wc(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=Cc(t);return n===`unknown`?Cc(e?.platform??e?.userAgent):n}function Tc(){let e=wc();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function Ec(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function Dc(e){let t={name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super??!1,hyper:e.hyper||void 0};return!t.shift||!Ec(t.name)?[t]:[t,{...t,shift:!1}]}var Oc=class{name;ctrl;shift;meta;superKey;originalEvent;propagationStopped=!1;constructor(e,t,n,r,i,a){this.name=e,this.ctrl=t,this.shift=n,this.meta=r,this.superKey=i,this.originalEvent=a}get super(){return this.superKey}preventDefault(){this.originalEvent?.preventDefault()}stopPropagation(){this.propagationStopped=!0,this.originalEvent?.stopPropagation()}};function kc(){return globalThis.MutationObserver}function Ac(e){return Sc.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function jc(e){if(!e)return new Oc(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new Oc(Ac(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Mc=class{metadata=Tc();rootTarget;isDestroyed=!1;observer;targetDestroyListeners=new Map;constructor(e){this.rootTarget=e}getFocusedTarget(){let e=this.rootTarget.ownerDocument.activeElement;return!e||typeof e!=`object`?null:e===this.rootTarget||this.rootTarget.contains(e)?e:null}getParentTarget(e){return e.parentElement}isTargetDestroyed(e){return e===this.rootTarget?!1:!e.isConnected||!this.rootTarget.contains(e)}onKeyPress(e){let t=t=>{e(jc(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(jc(t))};return this.rootTarget.addEventListener(`keyup`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keyup`,t,{capture:!0})}}onFocusChange(e){let t=()=>{queueMicrotask(()=>{e(this.getFocusedTarget())})};return this.rootTarget.addEventListener(`focusin`,t,{capture:!0}),this.rootTarget.addEventListener(`focusout`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`focusin`,t,{capture:!0}),this.rootTarget.removeEventListener(`focusout`,t,{capture:!0})}}onTargetDestroy(e,t){let n=this.targetDestroyListeners.get(e);return n||(n=new Set,this.targetDestroyListeners.set(e,n)),n.add(t),this.ensureObserver(),this.flushDisconnectedTargets(),()=>{let n=this.targetDestroyListeners.get(e);n&&(n.delete(t),n.size===0&&this.targetDestroyListeners.delete(e),this.targetDestroyListeners.size===0&&this.disconnectObserver())}}createCommandEvent(){return jc()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=kc();e&&(this.observer=new e(()=>{this.flushDisconnectedTargets()}),this.observer.observe(this.rootTarget,{childList:!0,subtree:!0}))}disconnectObserver(){this.observer&&=(this.observer.disconnect(),void 0)}flushDisconnectedTargets(){for(let[e,t]of this.targetDestroyListeners)if(this.isTargetDestroyed(e)){this.targetDestroyListeners.delete(e);for(let e of[...t])e()}this.targetDestroyListeners.size===0&&this.disconnectObserver()}};function Nc(e){return new Mc(e)}var Pc=(e,t)=>Dc(e).map(e=>t.resolveKey(e));function Fc(e){return e instanceof K?{code:e.code,message:Lc(e.message),retryable:e.retryable}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function Ic(e){try{let t=mt(e);return new K(t.message,{code:t.code,retryable:t.retryable})}catch(e){return new K(`The host returned a malformed error`,{cause:e,code:`PROTOCOL`,retryable:!1})}}function Lc(e){return e.trim().slice(0,512)||`Host operation failed`}var Rc=e=>({ok:!0,value:e}),zc=e=>({error:Fc(e),ok:!1});async function Bc(e,t){let n,r=new Set;try{return n=await e,Vc(t(n))}catch(e){throw Hc(e)&&Uc(e,r),e instanceof K?e:new K(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&Hc(n)&&Uc(n,r)}}function Vc(e){if(e.ok)return e.value;throw Ic(e.error)}function Hc(e){return rt(e)&&Symbol.dispose in e&&r(e[Symbol.dispose])}function Uc(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function Wc(){let e=[],t=new Set;return{get:()=>e,subscribe:e=>(t.add(e),()=>t.delete(e)),update:n=>{e=n;for(let e of Array.from(t))try{e()}catch(e){console.warn(`App binding subscriber failed`,e)}}}}function Gc(e){let t=Me(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=Me(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function Kc(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=Nc(r),a=new Xs(i);hc(a),xc(a),a.prependEventMatchResolver(Pc);let o=Jc(e.onBroken),s=Qc(a,e.chords,e.remote,o),c=qc(e,o,()=>t,e=>{n=e},()=>n),l=i.onFocusChange(()=>{queueMicrotask(c)}),u=()=>{queueMicrotask(c)};e.window.addEventListener(`focus`,u),e.window.addEventListener(`blur`,u);let d=e.bindings,f=()=>Yc(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:Xc(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=Xc(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=Qc(a,e.chords,e.remote,o)});return queueMicrotask(c),()=>{t&&(t=!1,l(),e.window.removeEventListener(`focus`,u),e.window.removeEventListener(`blur`,u),h(),s(),m(),p())}}function qc(e,t,n,r,i){return()=>{if(!n())return;let a=Yc(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function Jc(e){return t=>{try{Bc(t(),Re).catch(t=>{pn(`browser-bridge.host-call`,t),e(t)})}catch(t){pn(`browser-bridge.host-call`,t),e(t)}}}function Yc(e,t){let n=e.activeElement;return ie({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function Xc(e,t,n){let r=t.get();return e.registerLayer({bindings:r.map((e,t)=>({cmd:`app/${String(t)}`,key:e.key})),commands:r.map((e,t)=>({name:`app/${String(t)}`,run:t=>{let r=t.event.originalEvent;if(r?.defaultPrevented||r?.isComposing||Zc(e.key)&&n())return!1;e.run()}})),priority:500})}function Zc(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function Qc(e,t,n,r){let i=t.get();return e.registerLayer({bindings:i.map(e=>({cmd:`reserved/${e.id}`,key:{ctrl:e.ctrlKey,meta:e.altKey,name:Ac(e.key),shift:e.shiftKey,super:e.metaKey}})),commands:i.map(e=>({name:`reserved/${e.id}`,run:t=>{let i=t.event.originalEvent;if(i?.defaultPrevented||i?.isComposing)return!1;r(()=>n.invokeReservedChord(e.id,i?.repeat??!1))}})),priority:1e3})}function $c(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=nl(t,e.mac);n!==null&&(t.preventDefault(),n===`back`&&!t.repeat&&e.canGoBack()&&e.back())},n=t=>{let n=tl(t.button);if(n===null)return;let r=t.defaultPrevented;t.preventDefault(),t.type===`mouseup`&&n===`back`&&!r&&e.canGoBack()&&e.back()};e.window.addEventListener(`keydown`,t);for(let t of el)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of el)e.window.removeEventListener(t,n)}}var el=[`mousedown`,`mouseup`,`auxclick`];function tl(e){return e===3?`back`:e===4?`forward`:null}function nl(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:rl(e.target)?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null:!e.altKey||e.metaKey?null:e.key===`ArrowLeft`?`back`:e.key===`ArrowRight`?`forward`:null}function rl(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function il(){return!Tt(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}var al=e=>crypto.getRandomValues(new Uint8Array(e)),ol=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}let i=Math.ceil(409.6*t/r);return(a=t)=>{if(!a)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(t[s]<r&&(o+=e[t[s]%e.length],o.length>=a))return o}}},sl=(e,t=21)=>ol(e,t|0,al),cl=`abcdefghijklmnopqrstuvwxyz0123456789`;function ll(e=21){if(e===1/0||e===-1/0)throw RangeError(`nanoid length must be finite`);return sl(cl,e)()}var ul=[];for(let e=0;e<256;++e)ul.push((e+256).toString(16).slice(1));function dl(e,t=0){return(ul[e[t+0]]+ul[e[t+1]]+ul[e[t+2]]+ul[e[t+3]]+`-`+ul[e[t+4]]+ul[e[t+5]]+`-`+ul[e[t+6]]+ul[e[t+7]]+`-`+ul[e[t+8]]+ul[e[t+9]]+`-`+ul[e[t+10]]+ul[e[t+11]]+ul[e[t+12]]+ul[e[t+13]]+ul[e[t+14]]+ul[e[t+15]]).toLowerCase()}var fl,pl=new Uint8Array(16);function ml(){if(!fl){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);fl=crypto.getRandomValues.bind(crypto)}return fl(pl)}var hl={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function gl(e,t,n){if(hl.randomUUID&&!t&&!e)return hl.randomUUID();e||={};let r=e.random??e.rng?.()??ml();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return dl(r)}var _l=re({version:`v7`}),vl=s().regex(/^replay_[a-f0-9]{64}$/);h(e=>vl.safeParse(e).success);var yl=re({version:`v4`});h(e=>_l.safeParse(e).success);var bl=h(e=>yl.safeParse(e).success);function xl(){return bl.parse(gl())}var Sl=class extends Et{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(y(e))?.abort(),Promise.resolve(Rc(void 0))}catch(e){return Promise.resolve(zc(e))}}dispose(){if(this.#e){this.#e=!1;for(let e of this.#n.values())e.abort();this.#n.clear()}}async invoke(e){try{if(!this.#e)throw new K(`The command is disposed`,{code:`DISCONNECTED`,retryable:!0});let t=g(e);if(this.#n.has(t.requestId))throw new K(`Duplicate command request`,{code:`PROTOCOL`,retryable:!1});if(this.#n.size>=64)throw new K(`Too many command requests`,{code:`HOST_FAILURE`,retryable:!0});let n=new AbortController;this.#n.set(t.requestId,n);try{let e=await this.#t(qe(t,n.signal)),r=se(e);return Rc(r===void 0?{status:`handled`}:{status:`handled`,result:r})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof ei)try{let t={code:e.code,message:e.message,details:e.details};return Rc({status:`failed`,error:ft(t)})}catch(e){return zc(e)}return zc(e)}}[Symbol.dispose](){this.dispose()}};function Cl(e){let t=[];for(let n of e.values()){let{commandId:e,definition:r,target:i}=n;if(e===void 0)continue;let a=r.availability?.status!==`unavailable`;for(let n of r.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{a&&Promise.resolve().then(async()=>{let t=Vc(await i.invoke({commandId:e,origin:`keyboard`,requestId:xl()}));if(t.status===`failed`)throw new ei(t.error.code,t.error.message,t.error.details)}).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function wl(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:Cl(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{Bc(e(),Re).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:El(e,t,i,()=>a,t=>{let n=i.get(t);if(!n)return;i.delete(t),n.target.dispose(),o();let r=n.commandId;!a&&r!==void 0&&c(()=>e.unregisterCommand(r))},o),dispose(){if(!a){a=!0;for(let e of i.values())e.target[Symbol.dispose]();i.clear(),o()}}}}function Tl(e,t,n){let r=t.id;if(e.size>=128||e.has(r))throw n.dispose(),new K(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let i={commandId:void 0,definition:t,target:n};e.set(r,i);let a=!1;return{commit(e){a||(i.commandId=e)},release(){a||(a=!0,e.get(r)===i&&e.delete(r),n.dispose())},target:n}}function El(e,t,n,i,a,o){return Object.freeze({async register(s,c){if(t(),!r(c))throw new K(`Command handler must be a function`,{code:`INVALID_ARGUMENT`,retryable:!1});let l=be(s),u=new Sl(c),d=Tl(n,l,u);try{let t=await Dl(e,l,d.target);i()&&await Ol(e,t.commandId,u),d.commit(t.commandId),o()}catch(e){throw d.release(),e}let f=!0;return()=>{f&&(f=!1,a(l.id))}}})}async function Dl(e,t,n){return Bc(e.registerCommand(t,n),we)}async function Ol(e,t,n){throw n.dispose(),await Bc(e.unregisterCommand(t),Re),new K(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var kl=Ge(e=>e instanceof Bt),Al=class extends Et{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw Vl();let t=e===void 0?void 0:mt(e);return setTimeout(()=>this.#t.disconnect?.(t??Gl()),0),Promise.resolve(Rc(void 0))}catch(e){return Promise.resolve(zc(e))}}async requestClose(){try{if(this.#e)throw Vl();return Rc(await(this.#t.beforeClose?.()??!0))}catch(e){return zc(e)}}async requestBack(){try{if(this.#e)throw Vl();return Rc(await(this.#t.back?.()??!1))}catch(e){return zc(e)}}async activateNavigation(e){try{if(this.#e)throw Vl();let t=he(e);return pe(this.#t.navigation,t)?Rc(await(this.#t.activate?.(t)??!1)):Rc(!1)}catch(e){return zc(e)}}async activateStatus(e){try{if(this.#e)throw Vl();let t=E(e);return n(this.#t.statusItems,t)?Rc(await(this.#t.statusAction?.(t)??!1)):Rc(!1)}catch(e){return zc(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?zc(Vl()):this.#n(e,`context`,a,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw Vl();let n=de(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(Rc(void 0));for(let e of n.capabilities)t.push({...e,handle:Xe(kl)(e.handle).dup()});if(!this.#t.capabilities)throw Vl();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(Rc(void 0))}catch(e){for(let e of t)Ut(e.handle);return Promise.resolve(zc(e))}}updateLifecycle(e){try{if(this.#e)throw Vl();let t=W(P)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(Rc(void 0));if(!Kl(this.#t.lifecycle.get(),t.value))throw new K(`The host sent an invalid lifecycle transition`,{code:`PROTOCOL`,retryable:!1});return this.#t.versions.lifecycle=t.version,this.#t.lifecycle.update(t.value),Promise.resolve(Rc(void 0))}catch(e){return Promise.resolve(zc(e))}}async updateReservedChords(e){return this.#e?zc(Vl()):this.#n(e,`chords`,Me,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?zc(Vl()):this.#n(e,`theme`,Mt,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=W(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(Rc(void 0))}catch(e){return Promise.resolve(zc(e))}}};async function jl(e){let t=Fl(),n=new Al(t),r=Lt(e.port,n),i,a=Pl(r);try{performance.mark(`fungi.app-open.agar-rpc-connect-start`);let o=await Promise.race([r.connect({epoch:e.epoch,protocolVersion:2}),a]);performance.mark(`fungi.app-open.agar-rpc-connect-ready`),i=o;let s=Vc(_e(o));if(!e.isActive())throw Nl();let c=Il({bootstrap:s,bootstrapOwner:i,options:e,remote:r,state:t,target:n});return performance.mark(`fungi.app-open.agar-root-created`),i=void 0,c}catch(t){return Jl(t,e,n,r,i)}}function Ml(e,t){e.context.update(t.context.value),e.theme.update(t.theme.value),e.lifecycle.update(t.lifecycle.value),e.chords.update(t.chords.value),e.versions.context=t.context.version,e.versions.theme=t.theme.version,e.versions.lifecycle=t.lifecycle.version,e.versions.chords=t.chords.version}function Nl(){return new K(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Pl(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{pn(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new K(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function Fl(){return{statusItems:[],navigation:{canGoBack:!1},bindings:Wc(),chords:Gc([]),context:Zt({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:Zt(`connecting`),theme:Zt(`default`),canGoBack:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function Il(e){let t=S(e.bootstrap.identity),n=ql(e.bootstrap);Ml(e.state,n);let r=He(e.bootstrap.capabilities);return e.state.capabilities=r,Rl(e,t,r)}function Ll(e,t,n){return Kc({bindings:e.state.bindings,chords:e.state.chords,identity:t,onBroken:e=>{n({code:`DISCONNECTED`,message:e instanceof K?e.message:`The app host rejected a browser bridge operation`,retryable:!0})},remote:e.remote,window:e.options.window})}function Rl(e,t,n){let r=!1,i=t=>{r||(r=!0,Ul([()=>{t&&e.state.lifecycle.update(`disconnected`)},()=>{e.state.lifecycle.update(`disposing`)},l,u,()=>{o.dispose()},()=>{e.state.beforeClose=void 0,e.state.back=void 0,e.state.activate=void 0,e.state.statusAction=void 0},()=>{n.disconnect()},()=>{e.target[Symbol.dispose]()},()=>{Ut(e.bootstrapOwner)},()=>{Ut(e.remote)},()=>{e.options.port.close()},()=>{e.state.lifecycle.update(`disposed`)},e.options.onDisposed],`app connection disposal`))},a=()=>{if(r)throw new K(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})},o=wl(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=Bl(e.remote,a,e.state),c=zl(e.state,e.remote,a),l=Ll(e,t,i),u=$c({window:e.options.window,mac:il(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{pn(`app-window.back-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{Hl(i)}),Wl({capabilities:n.directory,commands:o.commands,context:e.state.context,dispose:i,identity:t,lifecycle:e.state.lifecycle,theme:e.state.theme,ui:s,window:c})}function zl(e,t,n){let r=Object.freeze({async publish(r){n();let i=l(r);e.canGoBack=i.canGoBack,e.navigation=en(i),await Bc(t.reportNavigation(i),Re)},onActivate(t){if(n(),e.activate!==void 0)throw new K(`The App already owns navigation activations`,{code:`INVALID_ARGUMENT`,retryable:!1});e.activate=t;let r=!1;return()=>{r||(r=!0,e.activate===t&&(e.activate=void 0))}},onBack(t){if(n(),e.back!==void 0)throw new K(`The App already owns Back requests`,{code:`INVALID_ARGUMENT`,retryable:!1});e.back=t;let r=!1;return()=>{r||(r=!0,e.back===t&&(e.back=void 0))}}});return Object.freeze({navigation:r,onBeforeClose(t){if(n(),e.beforeClose!==void 0)throw new K(`The App already owns a close consultation`,{code:`INVALID_ARGUMENT`,retryable:!1});e.beforeClose=t;let r=!1;return()=>{r||(r=!0,e.beforeClose===t&&(e.beforeClose=void 0))}}})}function Bl(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await Bc(e.requestComputerChoice(),Re)},async requestBrowserAction(n){t();let r=p(n);return r.kind===`refused`?r:await Bc(e.requestBrowserAction(r),Gt)},onStatusAction(e){if(t(),n.statusAction!==void 0)throw new K(`The App already owns its status actions`,{code:`INVALID_ARGUMENT`,retryable:!1});n.statusAction=e;let r=!1;return()=>{r||(r=!0,n.statusAction===e&&(n.statusAction=void 0))}},async requestAppPermissions(n){return t(),await Bc(e.requestAppPermissions(A(n)),Oe)},async openDesktopSettings(){t(),await Bc(e.openDesktopSettings(),Re)},async openTeamBilling(){t(),await Bc(e.openTeamBilling(),Re)},async openNavigation(n){t(),await Bc(e.openNavigation(ee(n)),Re)},async reportStatus(r){t();let i=B(r);n.statusItems=i,await Bc(e.reportStatus(i),Re)},async reportAgentSessionSelection(n){t(),await Bc(e.reportAgentSessionSelection(Jt(n)),Re)},async showToast(n){t(),await Bc(e.showToast(R(n)),Re)}})}function Vl(){return new K(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function Hl(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function Ul(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function Wl(e){return Object.freeze(e)}function Gl(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function Kl(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function ql(e){let t=W(a)(e.context),n=W(Mt)(e.theme),r=W(P)(e.lifecycle),i=W(Me)(e.reservedChords);if(r.value!==`connected`&&r.value!==`suspended`)throw new K(`The bootstrap lifecycle is invalid`,{code:`PROTOCOL`,retryable:!1});return{chords:i,context:t,lifecycle:r,theme:n}}function Jl(e,t,n,r,i){throw Ul([()=>{n[Symbol.dispose]()},()=>{i&&Ut(i)},()=>{Ut(r)},()=>{t.port.close()},t.onDisposed],`app connection rejection`),e instanceof K?e:new K(`Unable to establish the app RPC session`,{cause:e,code:`PROTOCOL`,retryable:!1})}var Yl=!1,Xl=class{options;#e;#t;#n=!1;#r;#i;constructor(e){this.options=e,this.#e=globalThis.window}start(){performance.mark(`fungi.app-open.agar-connect-start`);let e=this.#l();return e?Promise.reject(e):(Yl=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(Ql())},i=e=>{this.#s(e,n,i)};this.#e.addEventListener(`message`,i),this.options.signal?.addEventListener(`abort`,r,{once:!0});let a=()=>{try{performance.mark(`fungi.app-open.agar-ready-sent`),this.#e.parent.postMessage({protocolVersion:2,type:Be},`*`)}catch(e){pn(`connect.notify-host`,e),n(iu(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(eu())},1e4),a()})}#o(e,t,n,r,i,a){if(!this.#n){if(this.#n=!0,this.#c(),this.#e.removeEventListener(`message`,n),this.options.signal?.removeEventListener(`abort`,r),e||!t){this.#t?.close(),Yl=!1,a(e??eu());return}i(t)}}#s(e,t,n){if(!ru(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||tu(e.origin)===void 0){t(nu());return}let r=au(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(ou(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),jl({epoch:r.epoch,isActive:()=>!this.#n,onDisposed:()=>{Yl=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t($l(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return Ql();if(Yl)return new K(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(Tt(globalThis.window)||this.#e.parent===this.#e)return new K(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function Zl(e){return new Xl(e).start()}function Ql(){return new K(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function $l(e){return e instanceof K?e:new K(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function eu(){return new K(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function tu(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function nu(){return new K(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var ru=$e(me({type:Fe(Ie)}));function iu(e){return new K(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function au(e,t){try{return gt(e.data)}catch(e){pn(`connect.decode-message`,e),t(e instanceof K?e:new K(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function ou(e){return new K(e,{code:`PROTOCOL`,retryable:!1})}function su(e,t,n){e.style.isolation=`isolate`;let r=(0,ha.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=na(a),s,c,l,u=!1,d=e=>{let i=(0,J.createElement)(cu,{state:e,render:n});r.render(t.queryClient?(0,J.createElement)(T,{client:t.queryClient},i):i)},f=()=>{l?.(),l=void 0,c?.(),c=void 0;let e=s;s=void 0,e?.dispose(),u&&=(o===null?a.removeAttribute(`data-theme`):ta(o,a),!1)},{defaultView:p}=e.ownerDocument;return performance.mark(`fungi.app-open.react-root-render-start`),p?p.parent===p?d({app:null,status:`standalone`}):(d({app:null,status:`connecting`}),Zl({host:`parent`,signal:i.signal}).then(e=>{if(i.signal.aborted){e.dispose();return}s=e;let t=()=>{let t=e.lifecycle.get();return t===`disposing`||t===`disconnected`||t===`disposed`?(f(),d({app:null,status:`ended`}),!0):!1};l=e.lifecycle.subscribe(t),!t()&&(u=!0,ta(e.theme.get(),a),c=e.theme.subscribe(e=>{ta(e,a)}),d({app:e,status:`live`}))}).catch(e=>{i.signal.aborted&&e instanceof K&&e.code===`CANCELLED`||(console.error(`${t.name} host connection failed`,e),f(),i.signal.aborted||d({app:null,status:`not-hosted`,error:e instanceof K?e:new K(`The App host is unavailable`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}))})):d({app:null,status:`not-hosted`,error:new K(`The App document has no window`,{code:`DISCONNECTED`,retryable:!1})}),()=>{i.signal.aborted||(i.abort(),r.unmount(),f())}}function cu({state:e,render:t}){return(0,J.useLayoutEffect)(()=>{performance.mark(`fungi.app-open.react-initial-commit`)},[]),(0,J.useLayoutEffect)(()=>{e.app&&performance.mark(`fungi.app-open.react-connected-commit`)},[e.app]),(0,J.createElement)(J.Fragment,null,e.status===`not-hosted`?(0,J.createElement)(`p`,{role:`alert`},`App host connection unavailable. Open this App through its host to try again.`):null,t(e))}function lu(e){let t=(0,J.useCallback)(t=>e?.subscribe(t)??(()=>void 0),[e]),n=(0,J.useCallback)(()=>e?.get(),[e]);return(0,J.useSyncExternalStore)(t,n,n)}function uu(e){return lu(e?.context)??null}function du(e){return uu(e)?.computerId??null}function fu(e,t,n,r){let i=(0,J.useRef)(t);i.current=t;let a=(0,J.useRef)(n);a.current=n;let o=(0,J.useRef)(r);o.current=r;let s=JSON.stringify(t),c=n!==void 0;(0,J.useEffect)(()=>{e&&e.ui.reportStatus(i.current).catch(e=>{o.current?o.current(e):console.error(`Window status report failed`,e)})},[e,s]),(0,J.useEffect)(()=>{if(!(!e||!c))return e.ui.onStatusAction(e=>a.current?.(e)??!1)},[e,c]),(0,J.useEffect)(()=>()=>{e?.ui.reportStatus([]).catch(e=>{console.error(`Window status report failed`,e)})},[e])}function pu(e,{sourceId:t,namespace:n},r){let i=(0,J.useMemo)(()=>ni(),[]),a=(0,J.useMemo)(r,[r]);return(0,J.useEffect)(()=>{let e=i.contribute({sourceId:t,namespace:n,commands:a});return()=>{e.dispose()}},[i,t,n,a]),(0,J.useEffect)(()=>e?Zi(e.commands,a):void 0,[e,a]),i}var mu=Pe(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);I.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>te(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>tn(e,t,n),e.parseAsync=async(t,n)=>ge(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>d(e,t,n),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0}),e.with=e.check,e.clone=(t,n)=>Ae(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),hu=Pe(`ZodMiniObject`,(e,t)=>{w.init(e,t),mu.init(e,t),M(e,`shape`,()=>t.shape)});function gu(e,t){return new hu({type:`object`,shape:e??{},...Ee(t)})}var _u=Pe(`ZodMiniLiteral`,(e,t)=>{G.init(e,t),mu.init(e,t)});function vu(e,t){return new _u({type:`literal`,values:Array.isArray(e)?e:[e],...Ee(t)})}var yu=$t({png:`png`,jpeg:`jpeg`,webp:`webp`}),bu=$t({draft:`draft`,balanced:`balanced`,premium:`premium`,max:`max`}),xu=Se(()=>vt({transport:$t({json:`json`,multipart:`multipart`}),dimensions:$t({none:`none`,own:`own`}),maxDimension:x().int().positive().nullable(),maxDimensionDocumented:ye(),defaultWidth:x().int().positive(),defaultHeight:x().int().positive(),steps:$t({steps:`steps`,num_steps:`num_steps`,fixed:`fixed`}),maxSteps:x().int().positive().nullable(),defaultSteps:x().int().nonnegative().nullable(),referenceField:s().min(1).max(256).nullable(),maxReferences:x().int().nonnegative()}).readonly()),Su=$t({seedance:`bytedance/seedance-2.0`,seedanceFast:`bytedance/seedance-2.0-fast`,seedanceMini:`bytedance/seedance-2.0-mini`,veo:`google/veo-3.1`,veoFast:`google/veo-3.1-fast`,minimaxH3Max:`minimax/h3-max`}),Cu=$t({p480:`480p`,p720:`720p`,p768:`768p`,p1080:`1080p`,p4k:`4k`}),wu=$t({wide:`16:9`,landscape:`4:3`,square:`1:1`,portrait:`3:4`,tall:`9:16`,ultrawide:`21:9`,ultratall:`9:21`}),Tu=$t({first:`first-frame`,last:`last-frame`,reference:`reference`}),Eu=Se(()=>vt({resolution:Cu,aspectRatio:wu,width:x().int().positive(),height:x().int().positive()}).readonly()),Du=Se(()=>vt({minSeconds:x().int().positive(),maxSeconds:x().int().positive(),defaultSeconds:x().int().positive(),durations:Xt(x().int().positive()).readonly(),provider:$t({seedance:`seedance`,veo:`veo`,minimax:`minimax`}),formats:Xt(Eu).readonly(),defaultResolution:Cu,defaultAspectRatio:wu,supportsAudio:ye(),defaultGenerateAudio:ye().nullable(),referenceRoles:Xt(Tu).readonly(),maxReferenceImages:x().int().nonnegative(),referenceResolutions:Xt(Cu).readonly(),prices:Xt(vt({resolution:Cu,silentMilliunitsPerSecond:x().int().positive(),audioMilliunitsPerSecond:x().int().positive()}).readonly()).readonly()}).readonly()),Ou=32e3,ku=2048;vt({id:s().min(1).max(256),label:s().min(1).max(512),kind:$t({image:`image`,video:`video`}),tier:bu,outputFormats:Xt(yu).max(3).readonly(),maxPromptLength:x().int().positive().max(Ou),input:xu,sizes:Xt(s().regex(/^\d+x\d+$/u)).readonly().nullable(),video:Du.nullable()}).readonly();var Au=e=>Object.freeze({kind:`image`,sizes:null,video:null,outputFormats:Object.freeze([]),...e,input:Object.freeze(e.input)}),ju={"480p":480,"720p":720,"768p":768,"1080p":1080,"4k":2160},Mu={"16:9":[16,9],"4:3":[4,3],"1:1":[1,1],"3:4":[3,4],"9:16":[9,16],"21:9":[21,9],"9:21":[9,21]};function Nu(e,t,n,r,i){let a=r===`seedance`,o=a?wu.options:[wu.enum.wide,wu.enum.tall,wu.enum.square],s=Object.freeze(i.flatMap(([e])=>o.map(t=>{let[n,r]=Mu[t],i=ju[e],a=Math.min(n,r);return Object.freeze({resolution:e,aspectRatio:t,width:Math.ceil(i*n/a/2)*2,height:Math.ceil(i*r/a/2)*2})}))),c=Object.freeze(a?[4,5,6,7,8,9,10,11,12]:[4,6,8]),l=Object.freeze({minSeconds:4,maxSeconds:a?12:8,defaultSeconds:a?5:6,durations:c,provider:r,formats:s,defaultResolution:`720p`,defaultAspectRatio:`16:9`,supportsAudio:!0,defaultGenerateAudio:!a||null,referenceRoles:Object.freeze(a?Tu.options:[Tu.enum.first]),maxReferenceImages:a?4:0,referenceResolutions:Object.freeze(a?i.map(([e])=>e).filter(e=>e!==`1080p`):[]),prices:Object.freeze(i.map(([e,t,n])=>Object.freeze({resolution:e,silentMilliunitsPerSecond:t,audioMilliunitsPerSecond:n})))});return Au({id:e,label:t,tier:n,maxPromptLength:a?2e3:ku,kind:`video`,video:l,sizes:Object.freeze(s.map(({width:e,height:t})=>`${String(e)}x${String(t)}`)),input:{transport:`json`,dimensions:`own`,maxDimension:Math.max(...s.map(({width:e,height:t})=>Math.max(e,t))),maxDimensionDocumented:!1,defaultWidth:1280,defaultHeight:720,steps:`fixed`,maxSteps:null,defaultSteps:null,referenceField:a?`image`:`image_input`,maxReferences:a?4:1}})}function Pu(){let e=[`480p`,`768p`],t=[wu.enum.wide,wu.enum.landscape,wu.enum.square,wu.enum.portrait,wu.enum.tall,wu.enum.ultrawide],n=Object.freeze(e.flatMap(e=>t.map(t=>{let[n,r]=Mu[t],i=ju[e],a=Math.min(n,r);return Object.freeze({resolution:e,aspectRatio:t,width:Math.ceil(i*n/a/2)*2,height:Math.ceil(i*r/a/2)*2})}))),r=Cu.enum.p768,i=wu.enum.wide,a=n.find(e=>e.resolution===r&&e.aspectRatio===i);if(a===void 0)throw Error(`minimax/h3-max is missing its default format`);let o=Object.freeze(Array.from({length:11},(e,t)=>t+5)),s=Object.freeze({minSeconds:5,maxSeconds:15,defaultSeconds:5,durations:o,provider:`minimax`,formats:n,defaultResolution:r,defaultAspectRatio:i,defaultGenerateAudio:null,supportsAudio:!1,referenceRoles:Object.freeze([Tu.enum.first,Tu.enum.reference]),maxReferenceImages:4,referenceResolutions:Object.freeze(e),prices:Object.freeze([{resolution:Cu.enum.p480,silentMilliunitsPerSecond:5e3,audioMilliunitsPerSecond:5e3},{resolution:Cu.enum.p768,silentMilliunitsPerSecond:8e3,audioMilliunitsPerSecond:8e3}])});return Au({id:Su.enum.minimaxH3Max,label:`MiniMax H3 Max`,tier:`balanced`,maxPromptLength:7e3,kind:`video`,video:s,sizes:Object.freeze(n.map(({width:e,height:t})=>`${String(e)}x${String(t)}`)),input:{transport:`json`,dimensions:`own`,maxDimension:Math.max(...n.map(({width:e,height:t})=>Math.max(e,t))),maxDimensionDocumented:!1,defaultWidth:a.width,defaultHeight:a.height,steps:`fixed`,maxSteps:null,defaultSteps:null,referenceField:`image_url`,maxReferences:4}})}Object.freeze([Au({id:`@cf/black-forest-labs/flux-1-schnell`,maxPromptLength:2048,outputFormats:Object.freeze([`jpeg`]),tier:`draft`,label:`Flux 1 Schnell — cheap/fast sketches`,input:{transport:`json`,dimensions:`none`,maxDimension:null,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`steps`,maxSteps:8,defaultSteps:4,referenceField:null,maxReferences:0}}),Au({id:`@cf/black-forest-labs/flux-2-klein-4b`,maxPromptLength:ku,tier:`balanced`,label:`Flux 2 Klein 4b — balanced default`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`fixed`,maxSteps:null,defaultSteps:4,referenceField:`input_image_`,maxReferences:4}}),Au({id:`@cf/black-forest-labs/flux-2-klein-9b`,maxPromptLength:ku,tier:`premium`,label:`Flux 2 Klein 9b — higher quality flux-2`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`fixed`,maxSteps:null,defaultSteps:4,referenceField:`input_image_`,maxReferences:4}}),Au({id:`@cf/black-forest-labs/flux-2-dev`,maxPromptLength:ku,tier:`max`,label:`Flux 2 Dev — best detailed quality, expensive`,input:{transport:`multipart`,dimensions:`own`,maxDimension:1920,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:768,steps:`steps`,maxSteps:null,defaultSteps:20,referenceField:`input_image_`,maxReferences:4}}),Au({id:`@cf/leonardo/lucid-origin`,maxPromptLength:ku,tier:`premium`,label:`Leonardo Lucid Origin — premium prompt adherence`,input:{transport:`json`,dimensions:`own`,maxDimension:2500,maxDimensionDocumented:!0,defaultWidth:1120,defaultHeight:1120,steps:`num_steps`,maxSteps:40,defaultSteps:null,referenceField:null,maxReferences:0}}),Au({id:`@cf/leonardo/phoenix-1.0`,maxPromptLength:ku,tier:`balanced`,label:`Leonardo Phoenix 1.0 — best prompt adherence`,input:{transport:`json`,dimensions:`own`,maxDimension:2048,maxDimensionDocumented:!0,defaultWidth:1024,defaultHeight:1024,steps:`num_steps`,maxSteps:50,defaultSteps:25,referenceField:null,maxReferences:0}}),Au({id:`openai/gpt-image-2`,maxPromptLength:32e3,outputFormats:Object.freeze([`png`,`jpeg`,`webp`]),tier:`premium`,label:`GPT Image 2 — strong text and layout, premium`,sizes:Object.freeze([`1024x1024`,`1024x1536`,`1536x1024`]),input:{transport:`json`,dimensions:`own`,maxDimension:1536,maxDimensionDocumented:!1,defaultWidth:1024,defaultHeight:1024,steps:`fixed`,maxSteps:null,defaultSteps:null,referenceField:`images`,maxReferences:16}}),Nu(Su.enum.seedance,`Seedance 2.0`,`balanced`,`seedance`,[[`480p`,7e3,7e3],[`720p`,15e3,15e3],[`1080p`,37e3,37e3],[`4k`,78e3,78e3]]),Nu(Su.enum.seedanceFast,`Seedance 2.0 Fast`,`draft`,`seedance`,[[`480p`,6e3,6e3],[`720p`,12e3,12e3]]),Nu(Su.enum.seedanceMini,`Seedance 2.0 Mini`,`draft`,`seedance`,[[`480p`,4e3,4e3],[`720p`,9e3,9e3]]),Nu(Su.enum.veo,`Veo 3.1`,`premium`,`veo`,[[`720p`,2e4,4e4],[`1080p`,2e4,4e4]]),Nu(Su.enum.veoFast,`Veo 3.1 Fast`,`balanced`,`veo`,[[`720p`,8e3,1e4],[`1080p`,1e4,12e3]]),Pu()]);var Fu=e=>s().min(1).max(e),Iu=x().int().min(-(2**53-1)).max(2**53-1),Lu=Iu.positive(),Ru=Iu.nonnegative(),zu=vt({printId:Fu(256),computerId:Fu(256),kind:$t([`image`,`video`]),prompt:Fu(Ou),model:Fu(256),width:Lu.nullable(),height:Lu.nullable(),steps:Ru.nullable(),durationSeconds:Ru.nullable(),format:Fu(32),bytes:Lu,costMilliunits:Ru,actorKind:$t([`member`,`agent`]),actorId:Fu(256),derivedFrom:Fu(256).nullable(),createdAt:Ru,source:$t([`recorded`,`file`]),schemaVersion:Lu}),Bu=v({printId:zu.shape.printId,path:s().startsWith(`/`).min(2).max(4096)});function Vu(e,t){let n=e?.app??null,r=uu(n),i=r?.openRequest,a=r?.computerId,o=i?.kind===`navigate`?i.params.find(e=>e.key===`print`):void 0,s=zu.shape.printId.safeParse(o?.value),c=s.success?s.data:null,l=i?.kind===`navigate`?i.requestId:null,u=(0,J.useRef)({app:n,requestId:l,computerId:a});(u.current.app!==n||u.current.requestId!==l)&&(u.current={app:n,requestId:l,computerId:a});let d=u.current.computerId===a,f=Ln({...Bn(n,Sn,wr.of(n,`prints`,`navigate`,a,l,c),async(e,t)=>{if(!n||!a||!c||!l)throw Error(`No print selected`);let r=await e.call(`openOutput`,JSON.stringify({printId:c,byteLength:1}));if(t.throwIfAborted(),n.context.get().computerId!==a)throw Error(`Computer selection changed`);let i=Bu.parse(r);if(i.printId!==c)throw Error(`Print selection changed`);return{path:i.path,requestId:l,computerId:a}}),enabled:!!(n&&d&&a&&l&&c&&n.capabilities.has(Sn)),retry:!1,staleTime:1/0}),p=(0,J.useRef)(t);p.current=t;let m=(0,J.useRef)(void 0);return(0,J.useEffect)(()=>{let t=f.data;!e||!t||m.current===t||e.app.context.get().computerId!==t.computerId||(m.current=t,p.current(t.path,e,t.computerId))},[e,f.data]),{target:f.data??null,error:f.error}}function Hu(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var Uu=Hu(`https://base-ui.com/production-error`,`Base UI`),Wu=J.createContext(void 0);function Gu(e){let t=J.useContext(Wu);if(!e&&t===void 0)throw Error(Uu(27));return t}var Ku={};function qu(e,t){let n=J.useRef(Ku);return n.current===Ku&&(n.current=e(t)),n}function Ju(e,t,n,r){let i=qu(Xu).current;return Zu(i,e,t,n,r)&&$u(i,[e,t,n,r]),i.callback}function Yu(e){let t=qu(Xu).current;return Qu(t,e)&&$u(t,e),t.callback}function Xu(){return{callback:null,cleanup:null,refs:[]}}function Zu(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Qu(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function $u(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null}}}}}}var ed=18;function td(e){return ed>=e}function nd(e){if(!J.isValidElement(e))return null;let t=e,n=t.props;return(td(19)?n?.ref:t.ref)??null}function rd(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function id(){}var ad=Object.freeze([]),od=Object.freeze({});function sd(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function cd(e,t){return typeof e==`function`?e(t):e}function ld(e,t){return typeof e==`function`?e(t):e}var ud={};function dd(e,t,n,r,i){if(!n&&!r&&!i&&!e)return pd(t);let a=pd(e);return t&&(a=md(a,t)),n&&(a=md(a,n)),r&&(a=md(a,r)),i&&(a=md(a,i)),a}function fd(e){if(e.length===0)return ud;if(e.length===1)return pd(e[0]);let t=pd(e[0]);for(let n=1;n<e.length;n+=1)t=md(t,e[n]);return t}function pd(e){return vd(e)?{...e(ud)}:hd(e)}function md(e,t){return vd(t)?t(e):gd(e,t)}function hd(e){let t={...e};for(let e in t){let n=t[e];_d(e,n)&&(t[e]=bd(n))}return t}function gd(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=rd(e.style,r);break;case`className`:e[n]=Sd(e.className,r);break;default:e[n]=_d(n,r)?yd(e[n],r):r}}return e}function _d(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function vd(e){return typeof e==`function`}function yd(e,t){return t?e?(...n)=>{let r=n[0];if(Cd(r)){let i=r;xd(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:bd(t):e}function bd(e){return e&&((...t)=>{let n=t[0];return Cd(n)&&xd(n),e(...t)})}function xd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Sd(e,t){return t?e?t+` `+e:t:e}function Cd(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function wd(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=Od(r));let i=Td(t,n,r);if(n.enabled===!1)return null;let a=n.state??od;return kd(e,r,i,a)}function Td(e,t,n){let{className:r,style:i}=e,{state:a=od,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?cd(r,a):void 0,d=l?ld(i,a):void 0,f=l?sd(a,c):od,p=l&&s?Ed(s):void 0,m=l?rd(f,p)??{}:od;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?Yu([m.ref,nd(n),...o]):Ju(m.ref,nd(n),o):Ju(null,null)),l?(u!==void 0&&(m.className=Sd(m.className,u)),d!==void 0&&(m.style=rd(m.style,d)),m):od}function Ed(e){return Array.isArray(e)?fd(e):dd(void 0,e)}var Dd=Symbol.for(`react.lazy`);function Od(e){if(e?.$$typeof!==Dd)return e;let t=J.Children.toArray(e)[0];return J.isValidElement(t)?t:e}function kd(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=dd(n,t.props);return e.ref=n.ref,J.cloneElement(t,e)}return Ad(e,n)}function Ad(e,t){return e===`button`?(0,J.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,J.createElement)(`img`,{alt:``,...t,key:t.key}):J.createElement(e,t)}var jd=`data-starting-style`,Md=`data-ending-style`,Nd={[jd]:``},Pd={[Md]:``},Fd={transitionStatus(e){return e===`starting`?Nd:e===`ending`?Pd:null}},Id=`data-open`,Ld=`data-closed`,Rd=`data-anchor-hidden`,zd=`data-popup-open`,Bd=`data-pressed`,Vd={[zd]:``},Hd={[zd]:``,[Bd]:``},Ud={[Id]:``},Wd={[Ld]:``},Gd={[Rd]:``},Kd={open(e){return e?Vd:null}},qd={open(e){return e?Hd:null}},Jd={open(e){return e?Ud:Wd},anchorHidden(e){return e?Gd:null}},Yd={...Jd,...Fd},Xd=J.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=Gu(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return wd(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Yd,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})});function Zd(){return typeof window<`u`}function Qd(e){return tf(e)?(e.nodeName||``).toLowerCase():`#document`}function $d(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ef(e){return((tf(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function tf(e){return Zd()?e instanceof Node||e instanceof $d(e).Node:!1}function nf(e){return Zd()?e instanceof Element||e instanceof $d(e).Element:!1}function rf(e){return Zd()?e instanceof HTMLElement||e instanceof $d(e).HTMLElement:!1}function af(e){return!Zd()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof $d(e).ShadowRoot}function of(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=_f(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function sf(e){return/^(table|td|th)$/.test(Qd(e))}function cf(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var lf=/transform|translate|scale|rotate|perspective|filter/,uf=/paint|layout|strict|content/,df=e=>!!e&&e!==`none`,ff;function pf(e){let t=nf(e)?_f(e):e;return df(t.transform)||df(t.translate)||df(t.scale)||df(t.rotate)||df(t.perspective)||!hf()&&(df(t.backdropFilter)||df(t.filter))||lf.test(t.willChange||``)||uf.test(t.contain||``)}function mf(e){let t=yf(e);for(;rf(t)&&!gf(t);){if(pf(t))return t;if(cf(t))return null;t=yf(t)}return null}function hf(){return ff??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ff}function gf(e){return/^(html|body|#document)$/.test(Qd(e))}function _f(e){return $d(e).getComputedStyle(e)}function vf(e){return nf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function yf(e){if(Qd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||af(e)&&e.host||ef(e);return af(t)?t.host:t}function bf(e){let t=yf(e);return gf(t)?(e.ownerDocument||e).body:rf(t)&&of(t)?t:bf(t)}function xf(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=bf(e),i=r===e.ownerDocument?.body,a=$d(r);if(i){let e=Sf(a);return t.concat(a,a.visualViewport||[],of(r)?r:[],e&&n?xf(e):[])}return t.concat(r,xf(r,[],n))}function Sf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Cf={...J},wf=Cf.useInsertionEffect,Tf=wf&&wf!==Cf.useLayoutEffect?wf:e=>e();function X(e){let t=qu(Ef).current;return t.next=e,Tf(t.effect),t.trampoline}function Ef(){let e={next:void 0,callback:Df,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Df(){}var Z=typeof document<`u`?J.useLayoutEffect:()=>{},Of=J.createContext(void 0);function kf(e=!1){let t=J.useContext(Of);if(t===void 0&&!e)throw Error(Uu(16));return t}function Af(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:J.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function jf(e){return e?.ownerDocument||document}function Mf(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new($d(e)).PointerEvent(`click`,{bubbles:!0,cancelable:!0,composed:!0,detail:n,pointerType:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Nf(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=J.useRef(null),s=kf(!0),c=a??s!==void 0,{props:l}=Af({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=J.useCallback(()=>{let e=o.current;Pf(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Z(u,[u]),{getButtonProps:J.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return dd({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(xd(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=Pf(r),s=!i&&Ff(r),l=n&&(i?a:!s),u=e.key===`Enter`,d=e.key===` `,f=r.getAttribute(`role`),p=f?.startsWith(`menuitem`)||f===`option`||f===`gridcell`;if(n&&c&&d){if(e.defaultPrevented&&p)return;e.preventDefault(),(!i||a)&&(e.preventBaseUIHandler(),Mf(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),Mf(r,e)))},onKeyUp(e){if(!t){if(xd(e),a?.(e),e.target===e.currentTarget&&i&&c&&Pf(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),Mf(e.currentTarget,e))}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:X(e=>{o.current=e,u()})}}function Pf(e){return rf(e)&&e.tagName===`BUTTON`}function Ff(e){return rf(e)&&e.tagName===`A`&&!!e.href}function If(e,t,n,r){let i=!1,a=!1,o=r??od;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function Lf(e,t,n){let r=n??od;return{reason:e,event:t??new Event(`base-ui`),...r}}var Rf=`none`,zf=`trigger-press`,Bf=`trigger-hover`,Vf=`trigger-focus`,Hf=`outside-press`,Uf=`item-press`,Wf=`close-press`,Gf=`focus-out`,Kf=`escape-key`,qf=`list-navigation`,Jf=`keyboard`,Yf=`pointer`,Xf=`cancel-open`,Zf=`sibling-open`,Qf=`imperative-action`,$f=J.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=Gu(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Nf({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,If(Wf,e.nativeEvent))}return wd(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})});function ep(){let[,e]=J.useState({});return J.useCallback(()=>{e({})},[])}var tp=0;function np(e,t=`mui`){let n=J.useRef(void 0),r=ep(),i=e??n.current;return J.useEffect(()=>{n.current??(tp+=1,n.current=`${t}-${tp}`,e??r())},[e,t,r]),i}var rp=Cf.useId;function ip(e,t){if(rp!==void 0){let n=rp();return e??(t?`${t}-${n}`:n)}return np(e,t)}function ap(e){return ip(e,`base-ui`)}var op=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Gu(),c=ap(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),wd(`p`,e,{ref:t,props:[{id:c},o]})});function sp(e){J.useEffect(e,ad)}var cp=0,lp=class e{static create(){return new e}currentId=cp;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=cp,t()},e)}isStarted(){return this.currentId!==cp}clear=()=>{this.currentId!==cp&&(clearTimeout(this.currentId),this.currentId=cp)};disposeEffect=()=>this.clear};function up(){let e=qu(lp.create).current;return sp(e.disposeEffect),e}function dp(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:fp,platform:pp,maxTouchPoints:mp}=dp(),hp=fp.toLowerCase(),gp=pp.toLowerCase(),_p=/^i(os$|p)/.test(gp)||gp===`macintel`&&mp>1,vp=`android`,yp=gp===vp||hp.includes(vp),bp=!_p&&gp.startsWith(`mac`);gp.startsWith(`win`),!yp&&/^(linux|chrome os)/.test(gp);var xp=bp||_p,Sp=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!Sp&&hp.includes(`firefox`),!Sp&&hp.includes(`chrom`);var Cp=xp,wp=/jsdom|happydom/.test(hp);function Tp(e){e.preventDefault(),e.stopPropagation()}function Ep(e){return`nativeEvent`in e}function Dp(e){return e.pointerType===``&&e.isTrusted?!0:yp&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function Op(e){return wp?!1:!yp&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(yp||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function kp(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function Ap(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function jp(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Q(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&af(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function Mp(e,t){let n=e;for(;n;){if(nf(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(af(n)?n.host:null)}return null}function Np(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var Pp=`data-base-ui-focusable`,Fp=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Ip=`ArrowLeft`,Lp=`ArrowRight`,Rp=`ArrowUp`,zp=`ArrowDown`,Bp=`data-trigger-disabled`;function Vp(e,t){if(!nf(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(Bp);for(let[,e]of t.entries())if(Q(e,n))return!e.hasAttribute(Bp);return!1}function Hp(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function Up(e){return e.matches(`html,body`)}function Wp(e){return rf(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function Gp(e){return Mp(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${Fp}`)!=null}function Kp(e){return e?e.getAttribute(`role`)===`combobox`&&Wp(e):!1}function qp(e){if(!e||wp)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Jp(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Yp(e,t){return t!=null&&!kp(t)?0:typeof e==`function`?e():e}function Xp(e,t,n){let r=Yp(e,n);return typeof r==`number`?r:r?.[t]}function Zp(e){return typeof e==`function`?e():e}function Qp(e,t){return t||e===`click`||e===`mousedown`}function $p(e){return e?.includes(`mouse`)&&e!==`mousedown`}function em(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function tm(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function nm(e){let t=qu(rm,e).current;return t.next=e,Z(t.effect),t}function rm(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var im=null;globalThis.requestAnimationFrame;var am=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||this.callbacks[t]!==null&&(this.callbacks[t]=null,--this.callbacksCount)}},om=class e{static create(){return new e}static request(e){return am.request(e)}static cancel(e){return am.cancel(e)}currentId=im;request(e){this.cancel(),this.currentId=am.request(()=>{this.currentId=im,e()})}cancel=()=>{this.currentId!==im&&(am.cancel(this.currentId),this.currentId=im)};disposeEffect=()=>this.cancel};function sm(){let e=qu(om.create).current;return sp(e.disposeEffect),e}var cm={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},lm={...cm,position:`fixed`,margin:0,top:0,left:0};({...cm});var $=U(),um=J.forwardRef(function(e,t){let[n,r]=J.useState();Z(()=>{Cp&&Sp&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,$.jsx)(`span`,{...e,ref:t,style:lm,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),dm=Math.min,fm=Math.max,pm=Math.round,mm=Math.floor,hm=e=>({x:e,y:e}),gm={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function _m(e,t,n){return fm(e,dm(t,n))}function vm(e,t){return typeof e==`function`?e(t):e}function ym(e){return e.split(`-`)[0]}function bm(e){return e.split(`-`)[1]}function xm(e){return e===`x`?`y`:`x`}function Sm(e){return e===`y`?`height`:`width`}function Cm(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function wm(e){return xm(Cm(e))}function Tm(e,t,n){n===void 0&&(n=!1);let r=bm(e),i=wm(e),a=Sm(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Pm(o)),[o,Pm(o)]}function Em(e){let t=Pm(e);return[Dm(e),t,Dm(t)]}function Dm(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Om=[`left`,`right`],km=[`right`,`left`],Am=[`top`,`bottom`],jm=[`bottom`,`top`];function Mm(e,t,n){switch(e){case`top`:case`bottom`:return n?t?km:Om:t?Om:km;case`left`:case`right`:return t?Am:jm;default:return[]}}function Nm(e,t,n,r){let i=bm(e),a=Mm(ym(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Dm)))),a}function Pm(e){let t=ym(e);return gm[t]+e.slice(t.length)}function Fm(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Im(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Fm(e)}function Lm(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Rm(e,t){return t<0||t>=e.length}function zm(e,t){return Hm(e.current,{disabledIndices:t})}function Bm(e,t){return Hm(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Vm(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>Hm(e,{startingIndex:t,decrement:r,disabledIndices:o}),u,d=!1;if(!i)u=r?Math.max(s,l()):Math.min(c,l());else if(r?t<=s:t>=c){let n=r?-1:e.length;a&&t!==n?u=-1:(u=r?c:s,d=!0)}else u=l();return{index:Rm(e,u)?-1:u,wrapped:d}}function Hm(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Um(e,a,r));return a}function Um(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!Gm(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Wm(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Gm(e,t=e?_f(e):null){return!e||!e.isConnected||!t||Wm(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Km=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function qm(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return af(n)?n.host:null}function Jm(e){for(let t of Array.from(e.children))if(Qd(t)===`summary`)return t;return null}function Ym(e,t){let n=Jm(t);return!!n&&(e===n||Q(n,e))}function Xm(e){let t=e?Qd(e):``;return e!=null&&e.matches(Km)&&(t!==`summary`||e.parentElement!=null&&Qd(e.parentElement)===`details`&&Jm(e.parentElement)===e)&&(t!==`details`||Jm(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Zm(e){if(!Xm(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=qm(t)){let n=t!==e,r=Qd(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Qd(t)===`details`&&!t.open&&!Ym(e,t)||t.hasAttribute(`hidden`)||!r&&!Qm(t,n))return!1}return!0}function Qm(e,t){let n=_f(e);return t?n.display!==`none`:Gm(e,n)}function $m(e){let t=e.tabIndex;if(t<0){let t=Qd(e);if(t===`details`||t===`audio`||t===`video`||rf(e)&&e.isContentEditable)return 0}return t}function eh(e){if(Qd(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function th(e,t){let n=eh(e);if(!n)return!0;let r=t.find(e=>{let t=eh(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=eh(e);return t?.name===n.name&&t.form===n.form})===n}function nh(e){if(rf(e)&&Qd(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return rf(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function rh(e,t){nh(e).forEach(e=>{Xm(e)&&t.push(e),rh(e,t)})}function ih(e,t,n){nh(e).forEach(e=>{rf(e)&&e.matches(t)&&n.push(e),ih(e,t,n)})}function ah(e){return Zm(e)&&$m(e)>=0}function oh(e){let t=[];return rh(e,t),t.filter(Zm)}function sh(e){let t=oh(e);return t.filter(e=>$m(e)>=0&&th(e,t))}function ch(e,t){let n=sh(e),r=n.length;if(r===0)return;let i=jp(jf(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function lh(e){return ch(jf(e).body,1)||e}function uh(e){return ch(jf(e).body,-1)||e}function dh(e,t,n){if(!e)return null;let r=[];rh(jf(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(Zm);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!Q(n,o)&&ah(o)&&th(o,a))return o}return r[i]}function fh(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Q(n,r)}function ph(e){sh(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function mh(e){let t=[];ih(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function hh(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...hh(e,t.id,n)])}function gh(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function _h(e){return`data-base-ui-${e}`}var vh=0;function yh(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(vh);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),id;let o=requestAnimationFrame(a);return vh=o,()=>{vh===o&&(cancelAnimationFrame(o),vh=0)}}var bh=`data-base-ui-inert`,xh=new WeakMap,Sh=new WeakSet,Ch=new WeakMap,wh=0;function Th(e){return e?af(e)?e.host:Th(e.parentNode):null}var Eh=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Th(t);return e.contains(n)?n:null}).filter(e=>e!=null),Dh=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Oh=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{Qd(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function kh(e,t,n,{mark:r=!0}){let i=Eh(t,e),a=r?Oh(t,Dh(i),new Set(i)):[],o=[],s=[];if(n){let e=Eh(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);Oh(t,Dh(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(xh.get(e)||0)+1;xh.set(e,r),o.push(e),r===1&&n&&Sh.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(Ch.get(e)||0)+1;Ch.set(e,t),s.push(e),t===1&&e.setAttribute(bh,``)}),wh+=1,()=>{o.forEach(e=>{let t=(xh.get(e)||0)-1;xh.set(e,t),t||(Sh.has(e)||e.removeAttribute(`aria-hidden`),Sh.delete(e))}),r&&s.forEach(e=>{let t=(Ch.get(e)||0)-1;Ch.set(e,t),t||e.removeAttribute(bh)}),--wh,wh||(xh=new WeakMap,Sh=new WeakSet,Ch=new WeakMap)}}function Ah(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=jf(e[0]).body;return kh(e,i,n,{mark:r})}var jh={style:{transition:`none`}},Mh=`data-base-ui-click-trigger`,Nh={fallbackAxisSide:`none`},Ph={fallbackAxisSide:`end`},Fh={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Ih=e(ma(),1),Lh=J.createContext(null),Rh=()=>J.useContext(Lh),zh=_h(`portal`);function Bh(e={}){let{ref:t,container:n,componentProps:r=od,elementProps:i}=e,a=ip(),o=Rh()?.portalNode,[s,c]=J.useState(null),[l,u]=J.useState(null),d=X(e=>{e!==null&&u(e)}),f=J.useRef(null);Z(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(tf(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=wd(`div`,r,{ref:[t,d],props:[{id:a,[zh]:``},i]}),m=s&&p?Ih.createPortal(p,s):null;return{node:l,nodeId:J.isValidElement(p)?p.props.id:void 0,subtree:m}}var Vh=J.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,portalOwnerRole:s,...c}=e,{node:l,nodeId:u,subtree:d}=Bh({container:o,ref:t,componentProps:e,elementProps:c}),f=J.useRef(null),p=J.useRef(null),m=J.useRef(null),h=J.useRef(null),[g,_]=J.useState(null),v=J.useRef(!1),y=g?.modal,b=g?.open,x=!!g&&!g.modal&&g.open&&!!l;J.useEffect(()=>{if(!l||y)return;function e(e){l&&e.relatedTarget&&fh(e)&&(e.type===`focusin`?v.current&&=(mh(l),!1):(ph(l),v.current=!0))}return tm(em(l,`focusin`,e,!0),em(l,`focusout`,e,!0))},[l,y]),Z(()=>{!l||b!==!0||!v.current||(mh(l),v.current=!1)},[b,l]);let S=J.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:h,portalNode:l,setFocusManagerState:_}),[l]);return(0,$.jsxs)(J.Fragment,{children:[d,(0,$.jsxs)(Lh.Provider,{value:S,children:[x&&l&&(0,$.jsx)(um,{"data-type":`outside`,ref:f,onFocus:e=>{fh(e,l)?m.current?.focus():uh(g?g.domReference:null)?.focus()}}),x&&l&&(0,$.jsx)(`span`,{role:s,"aria-owns":u,style:Fh}),l&&Ih.createPortal(a,l),x&&l&&(0,$.jsx)(um,{"data-type":`outside`,ref:p,onFocus:e=>{fh(e,l)?h.current?.focus():(lh(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,If(`focus-out`,e.nativeEvent)))}})]})]})});function Hh(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Uh=class{nodesRef={current:[]};events=Hh();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},Wh=J.createContext(null),Gh=J.createContext(null),Kh=()=>J.useContext(Wh)?.id||null,qh=e=>{let t=J.useContext(Gh);return e??t};function Jh(e){let t=ip(),n=qh(e),r=Kh();return Z(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Yh(e){let{children:t,id:n}=e,r=Kh();return(0,$.jsx)(Wh.Provider,{value:J.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Xh(e){let{children:t,externalTree:n}=e,r=qu(()=>n??new Uh).current;return(0,$.jsx)(Gh.Provider,{value:r,children:t})}function Zh(e){return e==null?e:`current`in e?e.current:e}function Qh(e,t){let n=$d(Np(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(Dp(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var $h=20,eg=[];function tg(){eg=eg.filter(e=>e.deref()?.isConnected)}function ng(e){tg(),e&&Qd(e)!==`body`&&(eg.push(new WeakRef(e)),eg.length>$h&&(eg=eg.slice(-20)))}function rg(){return tg(),eg[eg.length-1]?.deref()}function ig(e){return e?ah(e)?e:sh(e)[0]||e:null}function ag(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=oh(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return ah(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function og(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,explicitReturnFocus:o,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:d,previousFocusableElement:f,beforeContentFocusGuardRef:p,externalTree:m,getInsideElements:h}=e,g=t.useState(`open`),_=t.useState(`domReferenceElement`),v=t.useState(`floatingElement`),{events:y,dataRef:b}=t.context,x=X(()=>b.current.floatingContext?.nodeId),S=i===!1,C=Kp(_)&&S,w=nm(i),T=nm(a),E=nm(o),D=nm(u),O=nm(g),k=qh(m),A=Rh(),j=J.useRef(!1),M=J.useRef(!1),N=J.useRef(!1),P=J.useRef(null),F=J.useRef(``),I=J.useRef(``),L=J.useRef(null),R=J.useRef(null),z=Ju(L,p,A?.beforeInsideRef),B=Ju(R,A?.afterInsideRef),V=up(),H=up(),ee=sm(),te=A!=null,U=Jp(v),W=X((e=U)=>e?sh(e):[]),ne=X(()=>h?.().filter(e=>e!=null)??[]);J.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&Q(U,jp(jf(U)))&&W().length===0&&!C&&Tp(e)}return em(jf(U),`keydown`,e)},[r,U,c,C,W]),J.useEffect(()=>{if(r||!g)return;let e=jf(U);function t(){N.current=!1}function n(e){let t=Np(e),n=ne(),r=Q(v,t)||Q(_,t)||Q(A?.portalNode,t)||n.some(e=>e===t||Q(e,t));N.current=!r,I.current=e.pointerType||`keyboard`,Mp(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,H.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return tm(em(e,`pointerdown`,n,!0),em(e,`pointerup`,t,!0),em(e,`pointercancel`,t,!0),em(e,`keydown`,i,!0),t)},[r,v,_,U,g,A,H,ne]),J.useEffect(()=>{if(r||!l)return;let e=jf(U);function n(){M.current=!0,H.start(0,()=>{M.current=!1})}function i(e){let t=Np(e);ah(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=Np(n);c&&r==null&&a!=null&&Q(v,a)&&ng(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ne(),p=r?.hasAttribute(_h(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,Zh(f),Zh(d)].includes(r),m=!(Q(_,r)||Q(v,r)||Q(r,v)||Q(A?.portalNode,r)||u.some(e=>e===r||Q(e,r))||l.hasMatchingElement(e=>Q(e,r))||p||k&&(hh(k.nodesRef.current,o).find(e=>Q(e.context?.elements.floating,r)||Q(e.context?.elements.domReference,r))||gh(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,Jp(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&U&&ag(U),s&&i!==_&&!Gm(a)&&jp(e)===e.body){if(rf(U)&&(U.focus(),s===`popup`)){ee.request(()=>{U.focus()});return}let e=W(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||U;rf(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==rg())&&(j.current=!0,t.setOpen(!1,If(Gf,n)))})}function o(){N.current||(b.current.insideReactTree=!0,V.start(0,()=>{b.current.insideReactTree=!1}))}let u=rf(_)?_:null;if(!(!v&&!u))return tm(u&&em(u,`focusout`,a),u&&em(u,`pointerdown`,n),v&&em(v,`focusin`,i),v&&em(v,`focusout`,a),v&&A&&em(v,`focusout`,o,!0))},[r,_,v,U,c,k,A,t,l,s,W,C,x,b,V,H,ee,d,f,ne]),J.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${_h(`portal`)}]`)||[]),t=(k?gh(k.nodesRef.current,x()):[]).find(e=>Kp(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Ah([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ne(),t,Zh(f),Zh(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=Ah([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ne]),Z(()=>{if(!g||r||!rf(U))return;F.current=``,I.current=``;let e=jf(U),t=jp(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(D.current||``):n;if(r===void 0||r===!1||Q(U,t))return;let i=null,a=()=>(i??=W(U),i[0]||U),o;o=r===!0||r===null?a():Zh(r),o||=a();let s=Q(U,jp(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&Dp(c);yh(o,{sync:l,preventScroll:o===U,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=jp(e);return!(t!==o&&Q(U,t))}})})},[r,g,U,W,w,D,O,b]);let re=J.useRef(null);Z(()=>{if(r||!U){re.current=null;return}re.current&&=(re.current.cancelled=!0,null);let e=jf(U),t=jp(e),n=D.current==null;ng(t);function i(e){if(e.open||(F.current=Qh(e.nativeEvent,I.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(_h(`focus-guard`))||e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`)&&(j.current=!0),e.reason===`outside-press`){if(e.nested)j.current=!1;else if(Dp(e.nativeEvent)||Op(e.nativeEvent))j.current=!1;else{let e=!1;jf(U).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&Qd(t)!==`body`?t:null,s=n?o||a:a||o;return s||=rg()||null,typeof i==`boolean`?s:Zh(i)||s||null}return()=>{y.off(`openchange`,i);let t=jp(e),n=ne(),r=Q(v,t)||n.some(e=>e===t||Q(e,t))||k&&hh(k.nodesRef.current,x(),!1).some(e=>Q(e.context?.elements.floating,t)),o=T.current,s=F.current,c=a(s),l={cancelled:!1};re.current=l,queueMicrotask(()=>{re.current===l&&(re.current=null);let n=ig(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&rf(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}j.current=!1})}},[r,v,U,T,E,D,y,k,_,x,ne]),Z(()=>{if(!Sp||g||!v)return;let e=jp(jf(v));!rf(e)||!Wp(e)||Q(v,e)&&e.blur()},[g,v]),Z(()=>{if(!(r||!A))return A.setFocusManagerState({modal:c,closeOnFocusOut:l,open:g,onOpenChange:t.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,c,g,t,l,_]),Z(()=>{if(!(r||!U))return ag(U),()=>{queueMicrotask(tg)}},[r,U]);let ie=!r&&(!c||!C)&&(te||c);return(0,$.jsxs)(J.Fragment,{children:[ie&&(0,$.jsx)(um,{"data-type":`inside`,ref:z,onFocus:e=>{if(c){let e=W();yh(e[e.length-1])}else A?.portalNode&&(j.current=!1,fh(e,A.portalNode)?lh(_)?.focus():Zh(f??A.beforeOutsideRef)?.focus())}}),n,ie&&(0,$.jsx)(um,{"data-type":`inside`,ref:B,onFocus:e=>{c?yh(W()[0]):A?.portalNode&&(l&&(j.current=!0),fh(e,A.portalNode)?uh(_)?.focus():Zh(d??A.afterOutsideRef)?.focus())}})]})}function sg(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=zf}=t,l=e.context.dataRef,u=J.useRef(void 0),d=sm(),f=up(),p=J.useMemo(()=>{function t(t,n,r,i){let a=If(c,n,r);t&&i===`touch`&&s>0?f.start(s,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let a=l.current.openEvent,s=e.select(`domReferenceElement`)!==n;return t&&s||!t||!i?!0:a&&(typeof o==`function`?o():o)?!r(a.type):!1}return{onPointerDown(e){u.current=kp(e.pointerType,!0)&&Op(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||kp(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=Np(s),p=Wp(f);if(p||o===`virtual`){t(l,s,p?f:i.currentTarget,o);return}let m=i.currentTarget;d.request(()=>{t(l,s,m,o)})},onClick(i){if(r===`mousedown-only`)return;let o=u.current;if(r===`mousedown`&&o){u.current=void 0;return}kp(o,!0)&&a||t(n(e.select(`open`),i.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),i.nativeEvent,i.currentTarget,o)},onKeyDown(){u.current=void 0}}},[l,r,a,c,e,o,i,d,f,s]);return J.useMemo(()=>n?{reference:p}:od,[n,p])}function cg(){return!1}function lg(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function ug(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=cg,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=qh(c),m=X(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=X(()=>a),{escapeKey:v,outsidePress:y}=lg(s),b=J.useRef(!1),x=J.useRef(!1),S=J.useRef(!1),C=J.useRef(!1),w=J.useRef(!1),T=J.useRef(``),E=J.useRef(null),D=up(),O=up(),k=up(),A=X(()=>{O.clear(),d.current.insideReactTree=!1}),j=X(e=>{let t=d.current.floatingContext?.nodeId;return(p?hh(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=X(t=>Hp(t,e.select(`floatingElement`))||Hp(t,e.select(`domReferenceElement`))),N=X(t=>{o()&&e.setOpen(!1,If(zf,t.nativeEvent))}),P=X(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=Ep(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=If(Kf,i);e.setOpen(!1,a),a.isCanceled||t.preventDefault(),!v&&!a.isPropagationAllowed&&t.stopPropagation()}),F=X(()=>{d.current.insideReactTree=!0,O.start(0,A)}),I=X(t=>{if(!l||!n||t.button!==0)return;let r=Np(t.nativeEvent);Q(e.select(`floatingElement`),r)&&(b.current||(b.current=!0,x.current=!1))}),L=X(e=>{!l||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});J.useEffect(()=>{function e(e){e.open||(C.current=!1)}return f.on(`openchange`,e),()=>{f.off(`openchange`,e)}},[f]),J.useEffect(()=>A,[A]),J.useEffect(()=>{if(!l||!n)return l||(C.current=!1,w.current=!1,T.current=``,E.current=null),A;d.current.__escapeKeyBubbles=v,d.current.__outsidePressBubbles=y;let t=new lp,i=jf(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(Sp?5:0,()=>{w.current=!1})}function s(){S.current=!0,t.start(0,()=>{S.current=!1})}function c(){b.current=!1,x.current=!1}function f(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function O(e){let t=d.current.floatingContext?.nodeId,n=p&&hh(p.nodesRef.current,t).some(t=>Hp(e,t.context?.elements.floating));return M(e)||n}function N(n){if(m(n)){n.type!==`click`&&!M(n)&&(t.clear(),S.current=!1),A();return}if(d.current.insideReactTree){A();return}let r=Np(n),i=`[${_h(`inert`)}]`,a=nf(r)?r.getRootNode():null,o=Array.from((af(a)?a:jf(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>Q(e,r))))return;let c=nf(r)?r:null;for(;c&&!gf(c);){let e=yf(c);if(gf(e)||!nf(e))break;c=e}if(!(o.length&&nf(r)&&!Up(r)&&!Q(r,e.select(`floatingElement`))&&o.every(e=>!Q(c,e)))){if(rf(r)&&!(`touches`in n)){let e=gf(r),t=_f(r),i=/auto|scroll/,a=e||i.test(t.overflowX),o=e||i.test(t.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=t.direction===`rtl`,u=c&&(l?n.offsetX<=r.offsetWidth-r.clientWidth:n.offsetX>r.clientWidth),d=s&&n.offsetY>r.clientHeight;if(u||d)return}if(!O(n)){if(f()===`intentional`){if(n.detail!==0&&!Dp(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,If(Hf,n)),A())}}}function F(t){f()!==`sloppy`||t.pointerType===`touch`||!e.select(`open`)||!n||M(t)||N(t)}function I(t){if(f()!==`sloppy`||!e.select(`open`)||!n||M(t))return;let r=t.touches[0];r&&(E.current={startTime:Date.now(),startX:r.clientX,startY:r.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=Np(e);if(!n)return;let r=em(n,e.type,()=>{t(e),r()})}function R(e){T.current=`touch`,L(e,I)}function z(e){D.clear(),e.type===`pointerdown`&&(e.button===0&&(C.current=!0),T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?F(e):N(e)})}function B(e){if(e.type===`pointercancel`&&(C.current=!1),!b.current)return;let n=x.current;if(c(),f()===`intentional`){if(e.type===`pointercancel`){n&&s();return}if(!O(e)){if(n){s();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,A())}}}function V(e){if(f()!==`sloppy`||!E.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(N(e),D.clear(),E.current=null)}function H(e){L(e,V)}function ee(e){f()!==`sloppy`||!E.current||M(e)||(E.current.dismissOnTouchEnd&&N(e),D.clear(),E.current=null)}function te(e){L(e,ee)}let U=tm(r&&tm(em(i,`keydown`,P),em(i,`compositionstart`,a),em(i,`compositionend`,o)),g&&tm(em(i,`click`,z,!0),em(i,`pointerdown`,z,!0),em(i,`pointerup`,B,!0),em(i,`pointercancel`,B,!0),em(i,`mousedown`,z,!0),em(i,`mouseup`,B,!0),em(i,`touchstart`,R,{capture:!0,passive:!0}),em(i,`touchmove`,H,{capture:!0,passive:!0}),em(i,`touchend`,te,{capture:!0,passive:!0})));return()=>{U(),t.clear(),c(),S.current=!1}},[d,u,r,g,h,l,n,v,y,P,A,_,j,M,p,e,D,k]);let R=J.useMemo(()=>({onKeyDown:P,onPointerDown:N,onClick:N}),[P,N]),z=J.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return J.useMemo(()=>n?{reference:R,floating:z,trigger:R}:{},[n,R,z])}function dg(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=o;return t.useSyncedValue(`floatingId`,i),Z(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};nf(c)&&(e.domReferenceElement=c),r.state.positionReference===r.state.referenceElement&&(e.positionReference=c),r.update(e)},[s,i,c,l,r]),r.context.onOpenChange=u,r.context.nested=a,r}function fg(e,t=!1,n=!1,r=!1){let[i,a]=J.useState(e&&t?`idle`:void 0),[o,s]=J.useState(e&&!r);return e&&!o&&(s(!0),a(`starting`)),!e&&o&&i!==`ending`&&!n&&a(`ending`),!e&&!o&&i===`ending`&&a(void 0),Z(()=>{if(!e&&o&&i!==`ending`&&n){let e=om.request(()=>{a(`ending`)});return()=>{om.cancel(e)}}},[e,o,i,n]),Z(()=>{if(!e||t||i===void 0)return;let n=om.request(()=>{a(void 0)});return()=>{om.cancel(n)}},[t,e,i]),Z(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=om.request(()=>{a(`idle`)});return()=>{om.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}function pg(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var mg=null;function hg(e){if(!mg){let e=[];mg=e,queueMicrotask(()=>{mg=null,Ih.flushSync(()=>{for(let t of e)t()})})}mg.push(e)}function gg(e,t=!1,n=!1){let r=sm();return X((i,a=null)=>{r.cancel();let o=Zh(e);if(o==null)return;let s=o,c=()=>{if(!n){Ih.flushSync(i);return}hg(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(pg(s).map(e=>e.finished.then(id))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if(pg(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=jd;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function _g(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=X(a),s=gg(r,n,i);J.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function vg(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=X(i),{mounted:c,setMounted:l,transitionStatus:u}=fg(t,!1,!1,o),d=!t&&r;Z(()=>{t&&s(!1)},[t,s]);let f=J.useRef(c),p=J.useRef(!1),m=ep(),h=()=>{f.current=!1,l(!1),a()};Z(()=>{f.current=c,p.current&&(p.current=!1,!t&&c&&h())});let g=X(()=>{if(f.current){if(t){p.current=!0,m();return}h()}});return _g({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var yg={tabIndex:-1,[Pp]:``};function bg(e){return t=>t!==`touch`||e.current}function xg(e,t=!1){let n=ip(),r=Kh()!=null,i=qu(()=>e(n,r)).current;return dg({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function Sg({handle:e,store:t}){return Z(()=>e.attachStore(t),[e,t]),null}function Cg(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function wg(e,t){let n=J.useRef(null);return X(r=>{let i=n.current;if(i!==null){if(i.element===r&&i.store===t&&i.id===e)return;n.current=null;let a=i.store;a.context.triggerElements.getById(i.id)===i.element&&(a.context.triggerElements.delete(i.id),Cg(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),Cg(t))})}function Tg(e,t,n,r=!1){let i=e.preventUnmountingOnClose;t?i=!1:r&&(i=!0);let a=n?.id??null,o=e.activeTriggerId,s=e.activeTriggerElement;return(a||t)&&(o=a,s=n??null),{open:t,preventUnmountingOnClose:i,activeTriggerId:o,activeTriggerElement:s,openedWithoutTrigger:t?n==null:e.openedWithoutTrigger}}function Eg(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Dg(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=wg(e,n),o=X(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){let e={activeTriggerElement:t,...i?r:null};n.update(e);return}if(a==null&&i&&!n.state.openedWithoutTrigger){let i={activeTriggerId:e??null,activeTriggerElement:t,...r};n.update(i)}}),s=X(e=>{a(e),e&&o(e)});return Z(()=>(s(t.current),()=>s(null)),[s,t,n,e]),Z(()=>{if(i){let e={activeTriggerElement:t.current,...r};n.update(e)}},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Og(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=J.useRef(null),i=e.useState(`open`);Z(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0),e.state.openedWithoutTrigger&&e.set(`openedWithoutTrigger`,!1);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&!e.state.openedWithoutTrigger&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=If(Rf);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function kg(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=vg({open:e,ref:t.context.popupRef,preventUnmountOnClose:t.useState(`preventUnmountingOnClose`),setPreventUnmountOnClose:e=>t.set(`preventUnmountingOnClose`,e),animateInitialOpen:r,onUnmount(){t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}});return qu(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function Ag(e,t){e.useSyncedValues(t),Z(()=>()=>{e.update({activeTriggerProps:od,inactiveTriggerProps:od,popupProps:od})},[e])}function jg(e,t){Z(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Z(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var Mg=class{idMap=new Map;add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}},Ng=t((e=>{var t=O();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Pg=t(((e,t)=>{t.exports=Ng()})),Fg=t((e=>{var t=O(),n=Pg();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Ig=t(((e,t)=>{t.exports=Fg()})),Lg=[],Rg=void 0;function zg(){return Rg}function Bg(e){Lg.push(e)}function Vg(e){let t=(t,n)=>{let r=qu(Ug).current,i;try{Rg=r;for(let e of Lg)e.before(r);i=e(t,n);for(let e of Lg)e.after(r);r.didInitialize=!0}finally{Rg=void 0}return i};return t.displayName=e.displayName||e.name,t}function Hg(e){return J.forwardRef(Vg(e))}function Ug(){return{didInitialize:!1}}var Wg=Pg(),Gg=Ig(),Kg=td(19)?Yg:Xg;function qg(e,t,n,r,i){return Kg(e,t,n,r,i)}function Jg(e,t,n,r,i){let a=J.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Wg.useSyncExternalStore)(e.subscribe,a,a)}Bg({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,Wg.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Yg(e,t,n,r,i){let a=zg();if(!a)return Jg(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function Xg(e,t,n,r,i){return(0,Gg.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Zg=class{static create(e){return new this(e)}constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return qg(this,e,t,n,r)}},Qg=class extends Zg{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){J.useDebugValue(e);let n=this;Z(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Z(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Z(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){J.useDebugValue(e);let n=this,r=t!==void 0;Z(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return J.useDebugValue(e),qg(this,this.selectors[e],t,n,r)}useContextCallback(e,t){J.useDebugValue(e);let n=X(t??id);this.context[e]=n}useStateSetter(e){let t=J.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},$g={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},e_=class extends Qg{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Hh(),nested:n,triggerElements:i},$g),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&Ap(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function t_(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new e_({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,openedWithoutTrigger:!1,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:od,inactiveTriggerProps:od,popupProps:od}}var n_=e=>e.triggerIdProp??e.activeTriggerId,r_=e=>e.openProp??e.open,i_=e=>(e.popupElement?.id??e.floatingId)||void 0;function a_(e,t){return t!==void 0&&r_(e)&&n_(e)===t}function o_(e,t){return a_(e,t)?!0:t!==void 0&&r_(e)&&n_(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var s_={open:r_,mounted:e=>e.mounted,transitionStatus:e=>r_(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:n_,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:i_,isTriggerActive:(e,t)=>t!==void 0&&n_(e)===t,isOpenedByTrigger:(e,t)=>a_(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&n_(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>o_(e,t)?i_(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function c_(e){let t=J.useCallback(t=>e===void 0?id:e.subscribeStore(t),[e]),n=J.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Wg.useSyncExternalStore)(t,n,()=>e?.serverStore)}var l_=bp&&Sp;function u_(e,t={}){let{enabled:n=!0,delay:r}=t,{events:i,dataRef:a}=e.context,o=J.useRef(!1),s=J.useRef(null),c=J.useRef(!0),l=up();J.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=$d(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&rf(t)&&t===jp(jf(t))&&(o.current=!0,s.current=t)}function a(){c.current=!0}function l(){c.current=!1}return tm(em(r,`blur`,i),l_&&em(r,`keydown`,a,!0),l_&&em(r,`pointerdown`,l,!0))},[e,n]),J.useEffect(()=>{if(!n)return;function t(t){if(t.reason===`trigger-press`||t.reason===`escape-key`){let t=e.select(`domReferenceElement`);nf(t)&&(s.current=t,o.current=!0)}}return i.on(`openchange`,t),()=>{i.off(`openchange`,t)}},[i,n,e]);let u=J.useMemo(()=>{function t(){o.current=!1,s.current=null}return{onMouseLeave(){t()},onFocus(n){let i=n.currentTarget;if(o.current){if(s.current===i)return;t()}let a=Np(n.nativeEvent);if(nf(a)){if(l_&&!n.relatedTarget){if(!c.current&&!Wp(a))return}else if(!qp(a))return}let u=Vp(n.relatedTarget,e.context.triggerElements),{nativeEvent:d,currentTarget:f}=n;if(e.select(`open`)&&u||!r){e.setOpen(!0,If(Vf,d,f));return}l.start(r,()=>{o.current||e.setOpen(!0,If(Vf,d,f))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,o=nf(r)&&r.hasAttribute(_h(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let t=e.select(`domReferenceElement`),n=jp(jf(t));!r&&n===t||Q(a.current.floatingContext?.refs.floating.current,n)||Q(t,n)||o||Vp(r??n,e.context.triggerElements)||e.setOpen(!1,If(Vf,i))})}}},[a,r,e,l]);return J.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}var d_=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new lp;restTimeout=new lp;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},f_=new WeakMap;function p_(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&f_.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),f_.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function m_(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=f_.get(n);a&&a!==e&&p_(a),p_(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,f_.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function h_(e){let t=e.context.dataRef.current,n=qu(()=>t.hoverInteractionState??d_.create()).current;return t.hoverInteractionState||=n,sp(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function g_(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=e.useState(`open`),o=e.useState(`floatingElement`),s=e.useState(`domReferenceElement`),{dataRef:c}=e.context,l=qh(),u=Kh(),d=h_(e),f=up(),p=X(()=>Qp(c.current.openEvent?.type,d.interactedInside)),m=X(()=>$p(c.current.openEvent?.type)),h=X(()=>{p_(d)});Z(()=>{a||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,h())},[a,d,h]),J.useEffect(()=>h,[h]),Z(()=>{if(n&&a&&d.handleCloseOptions?.blockPointerEvents&&m()&&nf(s)&&o){let e=s,t=o,n=jf(o),r=l?.nodesRef.current.find(e=>e.id===u)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=d.pointerEventsScopeElement===t?null:d.pointerEventsScopeElement,a=r===t?null:r,c=d.handleCloseOptions?.getScope?.()??i??a??Mp(e,`[data-rootownerid]`)??n.body;return m_(d,{scopeElement:c,referenceElement:e,floatingElement:t}),()=>{h()}}},[n,a,s,o,d,m,l,u,h]),J.useEffect(()=>{if(!n)return;function t(){return!!(l&&u&&hh(l.nodesRef.current,u).length>0)}function a(t){let n=Xp(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,If(Bf,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=Np(e);if(!Gp(t)){d.interactedInside=!1;return}d.interactedInside=Mp(t,`[aria-haspopup]`)!=null}function g(){d.openChangeTimeout.clear(),f.clear(),l?.events.off(`floating.closed`,v),h()}function _(n){if(t()&&l){l.events.on(`floating.closed`,v);return}if(Vp(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&nf(o)&&hh(l.nodesRef.current,r,!1).some(e=>Q(e.context?.elements.floating,o)))){if(d.handler){d.handler(n);return}h(),m()&&!p()&&a(n)}}function v(n){!l||!u||t()||f.start(0,()=>{l.events.off(`floating.closed`,v),e.setOpen(!1,If(Bf,n)),l.events.emit(`floating.closed`,n)})}let y=o;return tm(y&&em(y,`mouseenter`,g),y&&em(y,`mouseleave`,_),y&&em(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var __={current:null};function v_(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=__,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=qh(l),v=h_(e),y=J.useRef(!1),b=nm(i),x=nm(r),S=nm(o),C=nm(n),w=nm(p),T=nm(f),E=X(()=>Qp(h.current.openEvent?.type,v.interactedInside)),D=X(()=>w.current?.()!==!1),O=X((t,n,r)=>{let i=e.context.triggerElements;if(i.hasElement(n))return!t||!Q(t,n);if(!nf(r))return!1;let a=r;return i.hasMatchingElement(e=>Q(e,a))&&(!t||!Q(t,a))}),k=X(()=>{v.handler&&=(jf(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=X(()=>{p_(v)});return u&&(v.handleCloseOptions=i?.__options),J.useEffect(()=>k,[k]),J.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===Bf,k(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,k]),J.useEffect(()=>{if(!n)return;function t(t,n=!0){let r=Xp(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,If(Bf,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,If(Bf,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!nf(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!kp(v.pointerType))return;let n=Zp(S.current),r=Xp(x.current,`open`,v.pointerType),i=Np(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(nf(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(Q(t,i)){c=t;break}}nf(o)&&nf(s)&&!e.context.triggerElements.hasElement(o)&&Q(o,s)&&(c=s);let l=c!=null&&O(s,c,i),u=e.select(`open`),d=T.current?.()??e.select(`transitionStatus`)===`ending`,f=!u&&d&&y.current,p=!l&&nf(c)&&nf(s)&&Q(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,If(Bf,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,If(Bf,t,c))}):g&&D()&&e.setOpen(!0,If(Bf,t,c)))}function o(n){if(E()){A();return}k();let r=jf(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!Vp(n.relatedTarget,e.context.triggerElements)){if(b.current&&i){e.select(`open`)||v.openChangeTimeout.clear();let a=c.current;v.handler=b.current({...i,tree:_,x:n.clientX,y:n.clientY,onClose(){A(),k(),C.current&&!E()&&a===e.select(`domReferenceElement`)&&t(n,!0)}}),r.addEventListener(`mousemove`,v.handler),v.handler(n);return}(v.pointerType!==`touch`||!Q(e.select(`floatingElement`),n.relatedTarget))&&t(n)}}function l(e){Q(r,e.relatedTarget)||(v.openChangeTimeout.clear(),v.restTimeout.clear(),v.restTimeoutPending=!1)}let f=m?em(r,`mouseout`,l):void 0;return s?tm(em(r,`mousemove`,i,{once:!0}),em(r,`mouseenter`,i),em(r,`mouseleave`,o),f):tm(em(r,`mouseenter`,i),em(r,`mouseleave`,o),f)},[k,A,h,x,e,n,b,v,u,O,E,a,s,S,c,_,C,d,T,D,m]),J.useMemo(()=>{if(!n)return;function t(e){v.pointerType=e.pointerType}return{onPointerDown:t,onPointerEnter:t,onMouseMove(t){let{nativeEvent:n}=t,r=t.currentTarget,i=e.select(`domReferenceElement`),o=e.select(`open`),s=O(i,r,t.target);if(a&&!kp(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;m_(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=Zp(S.current);if(o&&!s||c===0||!s&&v.restTimeoutPending&&t.movementX**2+t.movementY**2<2)return;v.restTimeout.clear();function l(){if(v.restTimeoutPending=!1,E())return;let t=e.select(`open`);!v.blockMouseMove&&(!t||s)&&D()&&e.setOpen(!0,If(Bf,n,r))}v.pointerType===`touch`?Ih.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}function y_(e){return Sp&&e.movementX===0&&e.movementY===0}function b_(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function x_(e,t){return b_(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function S_(e,t,n){return b_(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function C_(e,t,n){return b_(t,n?e===Ip:e===Lp,e===zp)}function w_(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:b_(t,n?e===Lp:e===Ip,e===Rp)}function T_(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,triggerOrientation:_=g,parentOrientation:v,id:y,resetOnPointerLeave:b=!0,externalTree:x,nestedReturnFocusRef:S,grid:C}=t,w=C!=null,T=e.useState(`open`),E=e.useState(`floatingElement`),D=e.useState(`domReferenceElement`),O=e.context.dataRef,k=Jp(E),A=Kp(D),j=nm(k),M=Kh(),N=qh(x),P=J.useRef(f),F=J.useRef(o??-1),I=J.useRef(null),L=J.useRef(!0),R=X(e=>{i(F.current===-1?null:F.current,e)}),z=J.useRef(!!E),B=J.useRef(T),V=J.useRef(!1),H=J.useRef(!1),ee=J.useRef(null),te=nm(h),U=nm(T),W=nm(o),ne=nm(b),re=sm(),ie=sm(),ae=X(()=>{re.cancel();function e(e){d||(ee.current=yh(e,{sync:V.current,preventScroll:!0}))}let t=n.current[F.current],r=H.current;t&&e(t),(V.current?e=>e():e=>re.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),de&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Z(()=>{O.current.orientation=g},[O,g]),Z(()=>{T||(I.current=null),(!T||f!==`auto`)&&(P.current=f)},[T,f]),Z(()=>{a&&(T&&E?(F.current=o??-1,P.current&&o!=null&&(H.current=!0,R())):z.current&&(F.current=-1,R()))},[a,T,E,o,R]),Z(()=>{if(a){if(!T){V.current=!1;return}if(E){if(r==null){if(V.current=!1,W.current!=null)return;if(z.current&&(F.current=-1,ae()),(!B.current||!z.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ie.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||S_(I.current,_,u)||l?zm(n):Bm(n),I.current=null,R())};t()}}else Rm(n.current,r)||(F.current=r,ae(),H.current=!1)}}},[a,T,E,r,W,l,n,_,u,R,ae,ie]),Z(()=>{if(!a||E||!N||d||!z.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=jp(jf(D??t??null)),r=e.some(e=>e.context&&Q(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[a,E,D,N,M,d]),Z(()=>{B.current=T,z.current=!!E});let oe=r!=null,se=X(e=>{if(!U.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),ce=X(()=>v??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),le=X(()=>zm(n,te.current)),ue=X(t=>{if(L.current=!1,V.current=!0,t.which===229||!U.current&&t.currentTarget===j.current)return;if(l&&w_(t.key,g,u,w)){x_(t.key,ce())||Tp(t),e.setOpen(!1,If(qf,t.nativeEvent));let n=S?.current??D;rf(n)&&n.focus();return}r!=null&&r!==F.current&&!Rm(n.current,r)&&(F.current=r);let i=F.current,a=zm(n,h),o=Bm(n,h);if(A||(t.key===`Home`&&(Tp(t),F.current=a,R(t)),t.key===`End`&&(Tp(t),F.current=o,R(t))),C!=null){let e=C(t,F.current,n,g,c,u,h,a,o);if(e!=null&&e!==F.current&&(F.current=e,R(t)),g===`both`)return}if(x_(t.key,g)){Tp(t);let e=jp(t.currentTarget.ownerDocument);if(T&&!d&&Q(t.currentTarget,e)&&!n.current.some(t=>t!=null&&Q(t,e))){F.current=S_(t.key,g,u)?a:o,R(t),r===F.current&&ae();return}let{index:l,wrapped:f}=Vm(n.current,i,{decrement:!S_(t.key,g,u),loopFocus:c,allowEscape:s,disabledIndices:h,minIndex:a,maxIndex:o});f&&(V.current=!1),F.current=l,R(t)}}),de=J.useMemo(()=>({onFocus(e){V.current=!0,se(e)},onClick({currentTarget:e}){d||e.focus({preventScroll:!0})},onMouseMove(e){y_(e)||(V.current=!0,H.current=!1,p&&se(e))},onPointerLeave(e){if(!U.current||!L.current||e.pointerType===`touch`)return;V.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&ne.current&&(ee.current?.(),ee.current=null,F.current=-1,R(e),!d)){let e=j.current,t=jp(jf(e));e&&Q(e,t)&&e.focus({preventScroll:!0})}}}),[se,U,j,p,n,R,ne,d]),fe=J.useMemo(()=>d&&T&&oe&&{"aria-activedescendant":`${y}-${r}`},[d,T,oe,y,r]),G=J.useMemo(()=>({...A?{}:fe,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&T&&!d){let n=Np(t.nativeEvent);if(n&&!Q(j.current,n))return;Tp(t);let r=If(Gf,t.nativeEvent);e.setOpen(!1,r);let i=S?.current??D;!r.isCanceled&&rf(i)&&i.focus();return}ue(t)},onPointerMove(e){y_(e)||(L.current=!0)}}),[fe,ue,j,A,e,T,d,D,S]),pe=J.useMemo(()=>{function t(t){e.setOpen(!0,If(qf,t.nativeEvent,t.currentTarget))}function n(e){f===`auto`&&Dp(e.nativeEvent)&&(P.current=!d)}function r(e){P.current=f,f===`auto`&&Op(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(n){let r=e.select(`open`);L.current=!1;let i=n.key.startsWith(`Arrow`),a=C_(n.key,ce(),u),o=x_(n.key,r?g:_),s=(l?a:o)||n.key===`Enter`||n.key.trim()===``;if(d&&r&&(!l||Wp(n.currentTarget)))return ue(n);if(!(!r&&!m&&i)){if(s){let e=x_(n.key,ce());I.current=l&&e?null:n.key}if(l){a&&(Tp(n),r?(F.current=le(),R(n),d&&j.current?.focus()):t(n));return}o&&(W.current!=null&&(F.current=W.current),Tp(n),!r&&m?t(n):ue(n),r&&R(n))}},onFocus(t){t.target===t.currentTarget&&e.select(`open`)&&!d&&(F.current=-1,R(t))},onPointerDown:r,onPointerEnter:r,onMouseDown:n,onClick:n}},[ue,f,le,l,R,e,m,g,_,ce,u,W,d,j]),me=J.useMemo(()=>({...fe,...pe}),[fe,pe]);return J.useMemo(()=>a?{reference:me,floating:G,item:de,trigger:pe}:{},[a,me,G,pe,de])}function E_(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=X(s),f=e.useState(`open`),p=up(),m=J.useRef(``),h=J.useRef(u??i??-1),g=J.useRef(null),_=X(e=>{function t(e){return r?.current[e]}function s(e){let n=t(e);return n&&!Gm(n)||n?.matches(`:disabled`)?!1:o==null||!Um(ad,e,o)}function c(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!s(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(Tp(e),d?.(!0)),m.current.length>0&&m.current[0]!==` `&&c(_,m.current)===-1&&e.key!==` `&&d?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(Tp(e),d?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&s(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,d?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=c(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,d?.(!1)):(a?.(b,e),g.current=b)}),v=X(t=>{let n=t.relatedTarget,r=e.select(`domReferenceElement`),i=e.select(`floatingElement`);Q(r,n)||Q(i,n)||(p.clear(),m.current=``,h.current=g.current,d?.(!1))});Z(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``,d?.(!1)))},[f,u,p,d]);let y=J.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return J.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var D_=.1,O_=D_*D_,k_=.5;function A_(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function j_(e,t,n,r,i,a,o,s,c,l){let u=!1;return A_(e,t,n,r,i,a)&&(u=!u),A_(e,t,i,a,o,s)&&(u=!u),A_(e,t,o,s,c,l)&&(u=!u),A_(e,t,c,l,n,r)&&(u=!u),u}function M_(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function N_(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function P_(e={}){let{blockPointerEvents:t=!1}=e,n=new lp,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*O_;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=Np(r),g=r.type===`mouseleave`,_=Q(u,h),v=Q(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&nf(r.relatedTarget)&&Q(u,r.relatedTarget))return;function y(){return!!(s&&hh(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=N_(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=N_(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=N_(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=N_(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!M_(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?k_/2:k_*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+k_+1,o=C||T?S.bottom-k_:S.top,s=C?T?S.bottom-k_:S.top:S.bottom-k_;M=j_(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?k_/2:k_*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-k_,o=C||T?S.top+k_:S.bottom,s=C?T?S.top+k_:S.bottom:S.top+k_;M=j_(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?k_/2:k_*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+k_+1,o=w||E?S.right-k_:S.left,s=w?E?S.right-k_:S.left:S.right-k_;M=j_(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?k_/2:k_*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-k_,o=w||E?S.left+k_:S.right,s=w?E?S.left+k_:S.right:S.left+k_;M=j_(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function F_(e,t,n){let{reference:r,floating:i}=e,a=Cm(t),o=wm(t),s=Sm(o),c=ym(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=bm(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function I_(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=vm(t,e),p=Im(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Lm(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Lm(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var L_=50,R_=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:I_},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=F_(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<L_&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=F_(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},z_=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=vm(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ym(r),_=Cm(o),v=ym(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Pm(o)]:Em(o)),x=p!==`none`;!d&&x&&b.push(...Nm(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Tm(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===Cm(t)||T.every(e=>Cm(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Cm(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},B_=new Set([`left`,`top`]);async function V_(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ym(n),s=bm(n),c=Cm(n)===`y`,l=B_.has(o)?-1:1,u=a&&c?-1:1,d=vm(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var H_=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await V_(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},U_=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=vm(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Cm(i),p=xm(f),m=u[p],h=u[f],g=(e,t)=>_m(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},W_=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=vm(e,t),u={x:n,y:r},d=Cm(i),f=xm(d),p=u[f],m=u[d],h=vm(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=B_.has(ym(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},G_=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=vm(e,t),c=await i.detectOverflow(t,s),l=ym(n),u=bm(n),d=Cm(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=dm(p-c[m],g),y=dm(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*fm(c.left,c.right):S=p-2*fm(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function K_(e){let t=_f(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=rf(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=pm(n)!==a||pm(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function q_(e){return nf(e)?e:e.contextElement}function J_(e){let t=q_(e);if(!rf(t))return hm(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=K_(t),o=(a?pm(n.width):n.width)/r,s=(a?pm(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Y_=hm(0);function X_(e){let t=$d(e);return!hf()||!t.visualViewport?Y_:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Z_(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===$d(e)}function Q_(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=q_(e),o=hm(1);t&&(r?nf(r)&&(o=J_(r)):o=J_(e));let s=Z_(a,n,r)?X_(a):hm(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=$d(a),t=nf(r)?$d(r):r,n=e,i=Sf(n);for(;i&&t!==n;){let e=J_(i),t=i.getBoundingClientRect(),r=_f(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=$d(i),i=Sf(n)}}return Lm({width:u,height:d,x:c,y:l})}function $_(e,t){let n=vf(e).scrollLeft;return t?t.left+n:Q_(ef(e)).left+n}function ev(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-$_(e,n),y:n.top+t.scrollTop}}function tv(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ef(r),s=t?cf(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=hm(1),u=hm(0),d=rf(r);if((d||!a)&&((Qd(r)!==`body`||of(o))&&(c=vf(r)),d)){let e=Q_(r);l=J_(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ev(o,c):hm(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function nv(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function rv(e){let t=vf(e),n=e.ownerDocument.body,r=fm(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=fm(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+$_(e),o=-t.scrollTop;return _f(n).direction===`rtl`&&(a+=fm(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var iv=25;function av(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=$d(e),a=ef(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!hf()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if($_(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=iv&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ov(e,t){let n=Q_(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=J_(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function sv(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=av(e,n,t);else if(t===`document`)r=rv(ef(e));else if(nf(t))r=ov(t,n);else{let n=X_(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Lm(r)}function cv(e,t){let n=t.get(e);if(n)return n;let r=xf(e,[],!1).filter(e=>nf(e)&&Qd(e)!==`body`),i=null,a=_f(e).position===`fixed`,o=a?yf(e):e;for(;nf(o)&&!gf(o);){let e=_f(o),t=pf(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=yf(o)}return t.set(e,r),r}function lv(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?cf(t)?[]:cv(t,this._c):[].concat(n),r],o=sv(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=sv(t,a[e],i);s=fm(n.top,s),c=dm(n.right,c),l=dm(n.bottom,l),u=fm(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function uv(e){let{width:t,height:n}=K_(e);return{width:t,height:n}}function dv(e,t,n){let r=rf(t),i=ef(t),a=n===`fixed`,o=Q_(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=hm(0);if((r||!a)&&((Qd(t)!==`body`||of(i))&&(s=vf(t)),r)){let e=Q_(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=$_(i));let l=i&&!r&&!a?ev(i,s):hm(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function fv(e){return _f(e).position===`static`}function pv(e,t){if(!rf(e)||_f(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ef(e)===n&&(n=n.ownerDocument.body),n}function mv(e,t){let n=$d(e);if(cf(e))return n;if(!rf(e)){let t=yf(e);for(;t&&!gf(t);){if(nf(t)&&!fv(t))return t;t=yf(t)}return n}let r=pv(e,t);for(;r&&sf(r)&&fv(r);)r=pv(r,t);return r&&gf(r)&&fv(r)&&!pf(r)?n:r||mf(e)||n}var hv=async function(e){let t=this.getOffsetParent||mv,n=this.getDimensions,r=await n(e.floating);return{reference:dv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function gv(e){return _f(e).direction===`rtl`}var _v={convertOffsetParentRelativeRectToViewportRelativeRect:tv,getDocumentElement:ef,getClippingRect:lv,getOffsetParent:mv,getElementRects:hv,getClientRects:nv,getDimensions:uv,getScale:J_,isElement:nf,isRTL:gv};function vv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yv(e,t,n){let r=null,i,a=ef(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=mm(d),h=mm(a.clientWidth-(u+f)),g=mm(a.clientHeight-(d+p)),_=mm(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:fm(0,dm(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!vv(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=$d(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function bv(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=q_(e),u=i||a?[...l?xf(l):[],...t?xf(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?yv(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Q_(e):null;c&&g();function g(){let t=Q_(e);h&&!vv(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var xv=H_,Sv=U_,Cv=z_,wv=G_,Tv=W_,Ev=(e,t,n)=>{let r=new Map,i=n??{},a={..._v,...i.platform,_c:r};return R_(e,t,{...i,platform:a})},Dv=typeof document<`u`?J.useLayoutEffect:function(){};function Ov(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ov(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ov(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function kv(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Av(e,t){let n=kv(e);return Math.round(t*n)/n}function jv(e){let t=J.useRef(e);return Dv(()=>{t.current=e}),t}function Mv(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=J.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=J.useState(r);Ov(f,r)||p(r);let[m,h]=J.useState(null),[g,_]=J.useState(null),v=J.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=J.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=J.useRef(null),C=J.useRef(null),w=J.useRef(u),T=c!=null,E=jv(c),D=jv(i),O=jv(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Ev(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Ov(w.current,t)&&(w.current=t,Ih.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Dv(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);Dv(()=>(A.current=!0,()=>{A.current=!1}),[]),Dv(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=J.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=J.useMemo(()=>({reference:b,floating:x}),[b,x]),N=J.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Av(M.floating,u.x),r=Av(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...kv(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return J.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Nv=(e,t)=>{let n=xv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pv=(e,t)=>{let n=Sv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fv=(e,t)=>({fn:Tv(e).fn,options:[e,t]}),Iv=(e,t)=>{let n=Cv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lv=(e,t)=>{let n=wv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rv=J.createContext(void 0);function zv(){let e=J.useContext(Rv);if(e===void 0)throw Error(Uu(26));return e}var Bv=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),Vv=`--nested-dialogs`,Hv=`data-nested-dialog-open`,Uv={...Jd,...Fd,nestedDialogOpen(e){return e?{[Hv]:``}:null}},Wv=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=Gu(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);zv(),_g({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?bg(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=wd(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...yg,hidden:!m,onKeyDown(e){Bv.has(e.key)&&e.stopPropagation()},style:{[Vv]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Uv});return(0,$.jsx)(og,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function Gv(e){return td(19)?e:e?`true`:void 0}var Kv=J.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,$.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),qv=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Gu(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,$.jsx)(Rv.Provider,{value:n,children:(0,$.jsxs)(Vh,{ref:t,...r,children:[a&&o===!0&&(0,$.jsx)(Kv,{ref:i.context.internalBackdropRef,inert:Gv(!s)}),e.children]})}):null}),Jv={},Yv={},Xv=``;function Zv(e,t){return of(e)?e:t}function Qv(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Zv(t,n)).overflowY)}function $v(e){if(typeof document>`u`)return!1;let t=jf(e);return $d(t).innerWidth-t.documentElement.clientWidth>0}function ey(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=jf(e),n=t.documentElement,r=t.body,i=Zv(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function ty(e){let t=jf(e),n=t.documentElement,r=t.body,i=Zv(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function ny(e){let t=jf(e),n=t.documentElement,r=t.body,i=$d(n),a=0,o=0,s=!1,c=om.create();if(Sp&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,Jv={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Xv=n.style.scrollBehavior,Yv={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Zv(n,r);if(s=ey(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,Jv),Object.assign(r.style,Yv),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Xv)}function d(){u(),c.request(l)}l();let f=em(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var ry=new class{lockCount=0;restore=null;timeoutLock=lp.create();timeoutUnlock=lp.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=jf(e),n=t.documentElement,r=t.body,i=$d(n);if(Qv(i,n,r)){let t=new i.MutationObserver(()=>{Qv(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=_p||!$v(e);this.restore=a?ty(e):ny(e)}};function iy(e=!0,t=null){Z(()=>{if(e)return ry.acquire(t)},[e,t])}function ay({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`mounted`),a=e.useState(`disablePointerDismissal`),o=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,u]=J.useState(0),[d,f]=J.useState(0),p=l===0,m=ug(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Np(t);if(p&&!a){if(o){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||Q(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:p});return iy(r&&o===!0,s),e.useContextCallback(`onNestedDialogOpen`,(t,n)=>{!e.select(`open`)&&!e.select(`mounted`)||(u(t),f(n))}),Z(()=>{!r&&!i&&(u(0),f(0))},[r,i]),Z(()=>(t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(l+1,d+ +!!n),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,d,t]),Ag(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var oy={...s_,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},sy=class extends Qg{constructor(e,t,n){let r=new Mg,i=cy(e,r,t,n);super(i,ly(r),oy)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(Tg(this.state,e,t.trigger)))}};function cy(e,t,n,r=!1){return{...t_(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function ly(e){return{popupRef:J.createRef(),backdropRef:J.createRef(),internalBackdropRef:J.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function uy(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=Gu(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=xg((e,t)=>new sy({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);jg(b,x),Og(b);let{forceUnmount:w}=kg(x,b);J.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,If(Qf))}),[w,b]);let T=x||S||u!=null;return(0,$.jsxs)(Wu.Provider,{value:b,children:[u&&(0,$.jsx)(Sg,{handle:u,store:b}),T&&(0,$.jsx)(ay,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var dy=Vg(function(e){return uy(`dialog`,e)}),fy=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Gu(),c=ap(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),wd(`h2`,e,{ref:t,props:[{id:c},o]})});function py(e){let t=J.useRef(``),n=J.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:J.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function my(e,t){let n=J.useRef(e),r=X(t);Z(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function hy(e,t){let{onClick:n,onPointerDown:r}=py(X((n,r)=>{(typeof e==`function`?e():e)||t(r||(_p?`touch`:``))}));return J.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function gy(e){let[t,n]=J.useState(null),r=hy(e,n);return my(e,t=>{t&&!e&&n(null)}),J.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var _y=Hg(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:l,...u}=e,d=Gu(!0),f=c_(l)??d;if(!f)throw Error(Uu(79));let p=ap(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=J.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=Dg(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=Nf({disabled:a,native:o}),S=sg(m),C=hy(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return wd(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[Mh]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:Kd})}),vy=(0,J.createContext)(void 0),yy=(0,J.createContext)(null);function by(e){let t=(0,J.useContext)(yy);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function xy(e){let t=(0,J.useContext)(vy),n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>t?.(()=>{n.current()}),[t])}var Sy=(0,J.createContext)(null);function Cy({children:e,interactionOwner:t=`local`,modal:n=!0,onOpenChange:r,...i}){return(0,$.jsx)(Sy.Provider,{value:{interactionOwner:t,modal:n},children:(0,$.jsx)(dy,{...i,modal:n,onOpenChange:(e,n)=>{if(t===`host`&&!e&&n.reason===`escape-key`){n.cancel(),n.allowPropagation();return}r?.(e,n)},children:e})})}function wy(){let e=(0,J.useContext)(Sy);if(!e)throw Error(`Dialog parts must be used inside <Dialog>`);return e}(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,$.jsx)(_y,{...n,className:t=>q(`btn`,Qe(e,t)),ref:r,type:t})});var Ty=(0,J.forwardRef)(function({container:e,...t},n){let r=by(`dialog`);return e==null&&r===null?null:(0,$.jsx)(qv,{...t,container:e??r,ref:n})}),Ey=(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(Xd,{...t,ref:n,className:t=>q(`caps-dialog-backdrop fixed inset-0 bg-black/40`,Qe(e,t))})}),Dy=(0,J.forwardRef)(function({className:e,finalFocus:t,size:n=`default`,...r},i){let a=wy();return(0,$.jsx)(Wv,{...r,"data-size":n,className:t=>q(`caps-dialog-popup overflow-y-auto overscroll-contain rounded-box bg-base-100 p-lg text-base-content shadow-xl`,n===`fill`?`fixed inset-0 h-full w-full max-w-none`:`max-h-screen w-11/12 max-w-(--container-lg)`,Qe(e,t)),finalFocus:a.interactionOwner===`host`?!1:t??!0,ref:i})}),Oy=(0,J.forwardRef)(function({container:e,keepMounted:t=!0,className:n,size:r=`default`,...i},a){let{modal:o}=wy();return(0,$.jsxs)(Ty,{container:e,keepMounted:t,children:[o===!0?(0,$.jsx)(Ey,{}):null,(0,$.jsx)(Dy,{...i,size:r,className:e=>q(r==="default"&&`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,Qe(n,e)),ref:a})]})});function ky({className:e,...t}){return(0,$.jsx)(`div`,{...t,className:q(`flex justify-end gap-sm`,e)})}function Ay({className:e,...t}){return(0,$.jsx)(`div`,{...t,className:q(`flex flex-col gap-sm`,e)})}var jy=(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(fy,{...t,className:t=>q(`text-lg font-semibold`,Qe(e,t)),ref:n})});(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(op,{...t,className:t=>q(`text-sm text-base-content`,Qe(e,t)),ref:n})});var My=(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,$.jsx)($f,{...n,className:t=>q(`btn btn-ghost`,Qe(e,t)),ref:r,type:t})}),Ny={queued:`Waiting to start`,generating:`Generating`,refining:`Refining`,done:void 0,failed:void 0},Py=(0,J.forwardRef)(function({status:e,children:t,aspectRatio:n,label:r,indicator:i,failure:a,className:o,style:s,...c},l){let u=(0,J.useRef)(null);(0,J.useImperativeHandle)(l,()=>u.current);let d=(0,J.useRef)(e),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(e);m!==e&&(h(e),p(e===`done`)),(0,J.useLayoutEffect)(()=>{let t=u.current,n=d.current;if(d.current=e,!t||n===e)return;if(!br(t)){p(!1);return}let r=Wr(t),i=vr(r,r.ease),a=[],o=t.querySelector(`:scope > [data-layer="media"]`),s=t.querySelector(`:scope > [data-layer="placeholder"]`),c=t.querySelector(`:scope > [data-layer="failure"]`);if(e===`done`&&o){let e=o.animate(r.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,filter:`blur(10px)`,transform:`scale(1.03)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:r.reduced?r.fast:r.slow*2,easing:i,fill:`backwards`});e.addEventListener(`finish`,()=>{p(!1)}),a.push(e),s&&a.push(s.animate([{opacity:1},{opacity:0}],{duration:r.reduced?r.fast:r.slow,easing:i,fill:`forwards`}))}return e===`failed`&&c&&a.push(c.animate([{opacity:0,transform:`translateY(${String(r.distance)}px)`},{opacity:1,transform:`none`}],{duration:r.normal,easing:i})),n===`failed`&&s&&a.push(s.animate([{opacity:.4},{opacity:1}],{duration:r.normal,easing:i})),()=>{for(let e of a)e.cancel()}},[e]);let g=e===`queued`||e===`generating`||e===`refining`,_=r??Ny[e],v=e===`done`||e===`refining`;return(0,$.jsxs)(`div`,{...c,ref:u,className:q(`caps-generation-frame`,o),"data-status":e,"data-aspect":n===void 0?void 0:``,"aria-busy":g,style:n===void 0?s:{aspectRatio:n,...s},children:[e===`done`&&!f?null:(0,$.jsxs)(`div`,{className:q(`caps-generation-placeholder`,e===`queued`&&`skeleton`),"data-layer":`placeholder`,role:e===`done`?void 0:`status`,"aria-hidden":e===`done`||void 0,children:[e===`generating`||e===`refining`||e===`done`?i??(0,$.jsx)(zr,{decorative:!0,size:`lg`,variant:`bloom`}):null,_===void 0?null:(0,$.jsx)(kr,{children:_})]}),v?(0,$.jsx)(`div`,{className:`caps-generation-media`,"data-layer":`media`,children:t}):null,e===`failed`&&a!==void 0?(0,$.jsx)(`div`,{className:`caps-generation-failure`,"data-layer":`failure`,role:`alert`,children:a}):null]})}),Fy=J.createContext(void 0);function Iy(){let e=J.useContext(Fy);if(e===void 0)throw Error(Uu(53));return e}function Ly(e,t,n){if(!e)return 0;let r=getComputedStyle(e),i=`${t}${n===`x`?`Inline`:`Block`}`,a=parseFloat(r[`${i}Start`]);return n===`x`&&t===`margin`?a*2:a+parseFloat(r[`${i}End`])}var Ry=`base-ui-disable-scrollbar`,zy={className:Ry,getElement(e){return(0,$.jsx)(`style`,{nonce:e,href:Ry,precedence:`base-ui:low`,children:`.${Ry}{scrollbar-width:none}.${Ry}::-webkit-scrollbar{display:none}`})}},By=`data-has-overflow-x`,Vy=`data-has-overflow-y`,Hy=`data-overflow-x-start`,Uy=`data-overflow-x-end`,Wy=`data-overflow-y-start`,Gy=`data-overflow-y-end`,Ky=e=>t=>t?{[e]:``}:null,qy={hasOverflowX:Ky(By),hasOverflowY:Ky(Vy),overflowXStart:Ky(Hy),overflowXEnd:Ky(Uy),overflowYStart:Ky(Wy),overflowYEnd:Ky(Gy),cornerHidden:()=>null},Jy=J.createContext(void 0),Yy={disableStyleElements:!1};function Xy(){return J.useContext(Jy)??Yy}var Zy=`--scroll-area-corner-height`,Qy=`--scroll-area-corner-width`,$y=`data-orientation`,eb={x:0,y:0},tb={width:0,height:0},nb={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},rb={x:!0,y:!0,corner:!0},ib=J.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=ab(i),d=ap(),f=up(),p=up(),{nonce:m,disableStyleElements:h}=Xy(),[g,_]=J.useState(!1),[v,y]=J.useState(!1),[b,x]=J.useState(!1),[S,C]=J.useState(!1),[w,T]=J.useState(!1),[E,D]=J.useState(tb),[O,k]=J.useState(tb),[A,j]=J.useState(nb),[M,N]=J.useState(rb),P=J.useRef(null),F=J.useRef(null),I=J.useRef(null),L=J.useRef(null),R=J.useRef(null),z=J.useRef(null),B=J.useRef(null),V=J.useRef(null),H=J.useRef(0),ee=J.useRef(0),te=J.useRef(0),U=J.useRef(0),W=J.useRef(`vertical`),ne=J.useRef(eb),re=J.useRef(null);function ie(e){let t=e?x:y,n=e?f:p;t(!0),n.start(500,()=>{t(!1)})}let ae=X(e=>{let t=e.x-ne.current.x,n=e.y-ne.current.y;ne.current=e,n!==0&&ie(!0),t!==0&&ie(!1)}),oe=X(()=>{let e=F.current;e&&re.current===null&&(re.current=e.style.scrollSnapType,e.style.scrollSnapType=`none`)}),se=X(e=>{if(e.button!==0||V.current!==null&&(W.current===`vertical`?R.current:z.current)?.hasPointerCapture(V.current))return;V.current=e.pointerId,H.current=e.clientY,ee.current=e.clientX,W.current=e.currentTarget.getAttribute($y);let t=F.current;t&&(te.current=t.scrollTop,U.current=t.scrollLeft,oe()),(W.current===`vertical`?R.current:z.current)?.setPointerCapture(e.pointerId)}),ce=X(e=>{if(e.pointerId!==V.current)return;V.current=null,(W.current===`vertical`?x:y)(!1),re.current!==null&&(F.current&&(F.current.style.scrollSnapType=re.current),re.current=null);let t=W.current===`vertical`?R.current:z.current;t?.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId)}),le=X(e=>{if(e.pointerId!==V.current)return;if(e.buttons%2==0){ce(e);return}let t=F.current;if(!t)return;let n=W.current===`vertical`,r=n?R.current:z.current,i=n?I.current:L.current;if(!r||!i)return;let a=n?`y`:`x`,o=Ly(i,`padding`,a),s=Ly(r,`margin`,a),c=n?r.offsetHeight:r.offsetWidth,l=(n?i.offsetHeight:i.offsetWidth)-c-o-s,u=n?e.clientY-H.current:e.clientX-ee.current,d=l<=0?0:u/l,f=n?t.scrollHeight:t.scrollWidth,p=n?t.clientHeight:t.clientWidth,m=(n?te.current:U.current)+d*(f-p);n?t.scrollTop=m:t.scrollLeft=m,e.preventDefault(),ie(n)});function ue(e){C(e.pointerType===`touch`)}function de(e){if(ue(e),e.pointerType!==`touch`){let t=Q(P.current,e.target);_(t)}}let fe=J.useMemo(()=>({scrolling:v||b,hasOverflowX:!M.x,hasOverflowY:!M.y,overflowXStart:A.xStart,overflowXEnd:A.xEnd,overflowYStart:A.yStart,overflowYEnd:A.yEnd,cornerHidden:M.corner}),[v,b,M.x,M.y,M.corner,A]),G={role:`presentation`,onPointerEnter:de,onPointerMove:de,onPointerDown:ue,onPointerLeave(){_(!1)},style:{position:`relative`,[Zy]:`${E.height}px`,[Qy]:`${E.width}px`}},pe=wd(`div`,e,{state:fe,ref:[t,P],props:[G,o],stateAttributesMapping:qy}),me=J.useMemo(()=>({handlePointerDown:se,handlePointerMove:le,handlePointerUp:ce,handleScroll:ae,disableViewportSnap:oe,cornerSize:E,setCornerSize:D,thumbSize:O,setThumbSize:k,hasMeasuredScrollbar:w,setHasMeasuredScrollbar:T,touchModality:S,cornerRef:B,scrollingX:v,scrollingY:b,hovering:g,setHovering:_,viewportRef:F,scrollbarYRef:I,scrollbarXRef:L,thumbYRef:R,thumbXRef:z,rootId:d,hiddenState:M,setHiddenState:N,overflowEdges:A,setOverflowEdges:j,viewportState:fe,overflowEdgeThreshold:{xStart:s,xEnd:c,yStart:l,yEnd:u}}),[se,le,ce,ae,oe,E,O,w,S,v,b,g,d,M,A,fe,s,c,l,u]);return(0,$.jsxs)(Fy.Provider,{value:me,children:[!h&&zy.getElement(m),pe]})});function ab(e){let t=typeof e==`number`?{xStart:e,xEnd:e,yStart:e,yEnd:e}:e;return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}function ob(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var sb=J.createContext(void 0);function cb(){let e=J.useContext(sb);if(e===void 0)throw Error(Uu(55));return e}var lb=J.createContext(void 0);function ub(){return J.useContext(lb)?.direction??`ltr`}function db(e,t){if(t<=0)return 0;let n=ob(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}var fb=`--scroll-area-overflow-x-start`,pb=`--scroll-area-overflow-x-end`,mb=`--scroll-area-overflow-y-start`,hb=`--scroll-area-overflow-y-end`,gb=`--scroll-area-thumb-height`,_b=`--scroll-area-thumb-width`,vb=[fb,pb,mb,hb],yb=!1;function bb(){yb||Sp||(typeof CSS<`u`&&`registerProperty`in CSS&&vb.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),yb=!0)}var xb=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{viewportRef:o,scrollbarYRef:s,scrollbarXRef:c,thumbYRef:l,thumbXRef:u,cornerRef:d,cornerSize:f,setCornerSize:p,setThumbSize:m,rootId:h,setHiddenState:g,hiddenState:_,setHasMeasuredScrollbar:v,handleScroll:y,touchModality:b,setHovering:x,setOverflowEdges:S,overflowEdgeThreshold:C,viewportState:w}=Iy(),T=ub(),E=J.useRef(!0),D=J.useRef([NaN,NaN,NaN,NaN]),O=up(),k=up(),A=X(()=>{let e=o.current,t=s.current,n=c.current,r=l.current,i=u.current,a=d.current;if(!e)return;let h=e.scrollHeight,_=e.scrollWidth,y=e.clientHeight,b=e.clientWidth,x=e.scrollTop,w=e.scrollLeft,E=D.current,O=Number.isNaN(E[0]);if(E[0]=y,E[1]=h,E[2]=b,E[3]=_,O&&v(!0),h===0||_===0)return;let k=Sb(e),A=k.y,j=k.x,M=b/_,N=y/h,P=Math.max(0,_-b),F=Math.max(0,h-y),I=0,L=0;j||(I=db(T===`rtl`?-w:w,P),L=P-I);let R=A?0:db(x,F),z=A?0:F-R,B=j?0:b,V=A?0:y,H=0,ee=0;!j&&!A&&(H=t?.offsetWidth||0,ee=n?.offsetHeight||0);let te=f.width===0&&f.height===0,U=te?H:0,W=te?ee:0,ne=Ly(n,`padding`,`x`),re=Ly(t,`padding`,`y`),ie=Ly(i,`margin`,`x`),ae=Ly(r,`margin`,`y`),oe=B-ne-ie,se=V-re-ae,ce=n?Math.min(n.offsetWidth-U,oe):oe,le=t?Math.min(t.offsetHeight-W,se):se,ue=Math.max(16,ce*M),de=Math.max(16,le*N);if(m(e=>Cb(e,{width:ue,height:de})),t&&r){let e=wb(r,gb,x,F,h,de,t.offsetHeight-de-re-ae);r.style.transform=`translate3d(0,${e}px,0)`}if(n&&i){let e=n.offsetWidth-ue-ne-ie,t=wb(i,_b,T===`rtl`?-w:w,P,_,ue,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let fe=[I,L,R,z];vb.forEach((t,n)=>{e.style.setProperty(t,`${fe[n]}px`)}),a&&p(e=>Cb(e,{width:H,height:ee})),g(e=>Cb(e,k));let G={xStart:!j&&I>C.xStart,xEnd:!j&&L>C.xEnd,yStart:!A&&R>C.yStart,yEnd:!A&&z>C.yEnd};S(e=>Cb(e,G))});Z(()=>{bb()},[]),Z(()=>{queueMicrotask(A)},[A,_,T,C.xStart,C.xEnd,C.yStart,C.yEnd]),Z(()=>{o.current?.matches(`:hover`)&&x(!0)},[o,x]),Z(()=>{let e=o.current;if(typeof ResizeObserver>`u`||!e)return;let t=!1,n=new ResizeObserver(()=>{if(!t){t=!0;let n=D.current;if(n[0]===e.clientHeight&&n[1]===e.scrollHeight&&n[2]===e.clientWidth&&n[3]===e.scrollWidth)return}A()});return n.observe(e),k.start(0,()=>{let t=pg(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(id))).then(A).catch(()=>{})}),()=>{n.disconnect(),k.clear()}},[A,o,k]);function j(){E.current=!1}let M={...h&&{"data-id":`${h}-viewport`},tabIndex:_.x&&_.y?-1:0,className:zy.className,style:{overflow:`scroll`},onScroll(){o.current&&(A(),(b||!E.current)&&y({x:o.current.scrollLeft,y:o.current.scrollTop}),O.start(100,()=>{E.current=!0}))},onWheel:j,onPointerMove:j,onPointerEnter:j,onKeyDown:j},N=wd(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:qy}),P=J.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,$.jsx)(sb.Provider,{value:P,children:N})});function Sb(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function Cb(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function wb(e,t,n,r,i,a,o){let s=ob(n,0,r),c=n-s,l=Math.max(16,a*i/(i+Math.abs(c)));return e.style.setProperty(t,c?`${l}px`:``),(r?s/r*o:0)+(c>0?a-l:0)}var Tb=J.createContext(void 0);function Eb(){let e=J.useContext(Tb);if(e===void 0)throw Error(Uu(54));return e}var Db=J.forwardRef(function(e,t){let{render:n,className:r,orientation:i=`vertical`,keepMounted:a=!1,style:o,...s}=e,{hovering:c,scrollingX:l,scrollingY:u,hiddenState:d,scrollbarYRef:f,scrollbarXRef:p,viewportRef:m,thumbYRef:h,thumbXRef:g,handlePointerDown:_,handlePointerUp:v,handleScroll:y,disableViewportSnap:b,rootId:x,thumbSize:S,hasMeasuredScrollbar:C,viewportState:w}=Iy(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=ub(),O=!C&&!a,k=T?d.y:d.x,A=a||!k;J.useEffect(()=>{if(!A)return;let e=m.current,t=T?f.current:p.current;if(!t)return;function n(t){if(!e||t.ctrlKey)return;let n=!T,r=n?`scrollLeft`:`scrollTop`,i=n?t.deltaX:t.deltaY;if(i===0)return;let a=n?e.scrollWidth-e.clientWidth:e.scrollHeight-e.clientHeight,o=n&&D===`rtl`?-a:0,s=n&&D===`rtl`?0:a,c=e[r];c<=o&&i<0||c>=s&&i>0||(t.preventDefault(),e[r]=Math.min(s,Math.max(o,c+i)),y({x:e.scrollLeft,y:e.scrollTop}))}return em(t,`wheel`,n,{passive:!1})},[D,y,T,p,f,A,m]);let j={...x&&{"data-id":`${x}-scrollbar`},"aria-hidden":!0,onPointerDown(e){if(e.button!==0)return;let t=Np(e.nativeEvent),n=T?h.current:g.current;if(n&&Q(n,t))return;let r=m.current;if(!r)return;let i=T?f.current:p.current;if(!n||!i)return;let a=T?`y`:`x`,o=Ly(n,`margin`,a),s=Ly(i,`padding`,a),c=T?n.offsetHeight:n.offsetWidth,l=i.getBoundingClientRect(),u=T?e.clientY-l.top-c/2-s+o/2:e.clientX-l.left-c/2-s+o/2,d=T?r.scrollHeight:r.scrollWidth,v=T?r.clientHeight:r.clientWidth,x=(T?i.offsetHeight:i.offsetWidth)-c-s-o;if(x<=0)return;let S=u/x,C=d-v;b(),T?r.scrollTop=S*C:r.scrollLeft=D===`rtl`?-(1-S)*C:S*C,y({x:r.scrollLeft,y:r.scrollTop}),_(e)},onMouseDown(e){e.preventDefault()},onPointerUp:v,onPointerCancel:v,style:{position:`absolute`,touchAction:`none`,WebkitUserSelect:`none`,userSelect:`none`,visibility:O?`hidden`:void 0,...T?{top:0,bottom:`var(${Zy})`,insetInlineEnd:0,[gb]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${Qy})`,bottom:0,[_b]:`${S.width}px`}}},M=wd(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:qy});return A?(0,$.jsx)(Tb.Provider,{value:i,children:M}):null}),Ob=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{computeThumbPosition:o}=cb(),{hasMeasuredScrollbar:s,viewportState:c}=Iy(),l=J.useRef(null),u=J.useRef(s);return Z(()=>{if(typeof ResizeObserver>`u`)return;let e=!1,t=new ResizeObserver(()=>{!e&&(e=!0,!u.current)||o()});return l.current&&t.observe(l.current),()=>{t.disconnect()}},[o]),wd(`div`,e,{ref:[t,l],state:c,stateAttributesMapping:qy,props:[{role:`presentation`,style:{minWidth:`fit-content`}},a]})}),kb=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{thumbYRef:o,thumbXRef:s,handlePointerDown:c,handlePointerMove:l,handlePointerUp:u,scrollingX:d,scrollingY:f,hasMeasuredScrollbar:p}=Iy(),m=Eb(),h=m===`vertical`;return wd(`div`,e,{ref:[t,h?o:s],state:{scrolling:h?f:d,orientation:m},props:[{onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,style:{visibility:p?void 0:`hidden`,...h?{height:`var(--scroll-area-thumb-height)`}:{width:`var(--scroll-area-thumb-width)`}}},a]})});function Ab(e,t,n){let r=(Math.abs(t)-Math.abs(e))/Math.max(16,n);if(Math.abs(r)<.035)return null;let i=Math.min(.04,Math.abs(r)*.3),a=r>0,o=Math.sign(t||e);return{scaleY:1+(a?i:-i),scaleX:1+(a?-i/2:i/2),origin:(a?o>0:o<0)?`center top`:`center bottom`}}function jb(e,t,n){if(t<=0||Math.abs(n)<4)return null;let r=e<=0&&n<0,i=e>=t-1&&n>0;if(!r&&!i)return null;let a=Math.min(.06,Math.abs(n)/120*.06);return{scaleY:1-a,scaleX:1+a/2,origin:r?`center top`:`center bottom`}}var Mb=(0,J.forwardRef)(function({children:e,className:t,surface:n=!1,surfaceSize:r,surfaceDepth:i,screen:a=!1,...o},s){let c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=ur();(0,J.useEffect)(()=>{let e=c.current,t=e?.querySelector(`.caps-scroll-viewport`);if(!t||!e)return;let n=null,r,i=t.scrollTop,a=performance.now(),o=0,s=e=>{let t=l.current;if(!e||u||!t)return;n?.cancel(),t.style.transformOrigin=e.origin;let r=Wr(t),i=Lr(r,{ease:`outQuad`,duration:45}),a=Sr(r,{bounce:.18,duration:180});n=$r(t,{scaleY:[{to:e.scaleY,...i},{to:1,...a}],scaleX:[{to:e.scaleX,...i},{to:1,...a}]})},d=(e,t)=>{let n=Ab(o,e,t);o=e,s(n)},f=e=>{if(e.ctrlKey||Math.abs(e.deltaX)>Math.abs(e.deltaY))return;let n=e.deltaMode===1?16:e.deltaMode===2?t.clientHeight:1,i=jb(t.scrollTop,t.scrollHeight-t.clientHeight,e.deltaY*n);i&&(clearTimeout(r),o=0,s(i))},p=()=>{let e=performance.now(),n=e-a,s=n>100?16:Math.max(16,n),c=t.scrollTop-i;n>100&&(o=0),d(c/s,s),i=t.scrollTop,a=e,clearTimeout(r),r=setTimeout(()=>{d(0,32)},64)};return t.addEventListener(`scroll`,p,{passive:!0}),e.addEventListener(`wheel`,f,{passive:!0}),()=>{clearTimeout(r),n?.cancel(),l.current&&(l.current.style.transform=`none`),t.removeEventListener(`scroll`,p),e.removeEventListener(`wheel`,f)}},[a,n,u]);let d=(0,$.jsx)(xb,{render:a?(0,$.jsx)(qn,{}):(0,$.jsx)(`div`,{}),...o,ref:s,className:`caps-scroll-viewport`,children:(0,$.jsx)(Ob,{style:{minWidth:0},children:e})});return(0,$.jsxs)(ib,{render:n?(0,$.jsx)(Kr,{size:r??`md`,depth:i??`shallow`}):(0,$.jsx)(`div`,{}),ref:c,className:q(`caps-scroll-area`,t),children:[a?(0,$.jsx)(`div`,{className:`caps-display-gasket caps-scroll-display`,children:d}):d,(0,$.jsx)(Kr,{size:`sm`,depth:`deep`,placement:`embedded`,className:`caps-scroll-track-surface`,children:(0,$.jsx)(Db,{className:`caps-scroll-track`,children:(0,$.jsx)(kb,{className:`caps-scroll-thumb`,children:(0,$.jsx)(`span`,{className:`caps-scroll-thumb-surface`,ref:l})})})})]})}),Nb={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function Pb({className:e,glyph:t,motion:n}){let r=`caps-status-${(0,J.useId)().replaceAll(`:`,``)}`,i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(Nb[t]).current,d=(0,J.useRef)(t===`dot`?1:4).current,f=(0,J.useRef)(+(t===`bang`)).current,p=(0,J.useRef)(t),m=Xr(s),{reduced:h}=m;return(0,J.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=Nb[t],n=h||p.current===t;p.current=t;let r=Wr(i.current),o=n?{duration:0}:Sr(r,{bounce:.3,duration:360}),s=$r(i.current,{y:e.y,height:e.height,...o}),u=$r(a.current,{cy:e.cy,...n?{duration:0}:{delay:or(r,35),...Sr(r,{bounce:.3,duration:420})}}),d=$r(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=$r(l.current,{opacity:+(t===`bang`),...n?jr:Lr(r,{ease:`inOutSine`,duration:220})});return()=>{s.cancel(),u.cancel(),d.cancel(),f.cancel()}},[t,h]),(0,J.useLayoutEffect)(()=>{if(!o.current||!s.current||h||n===`none`)return;let e=n===`pulse`?$r(o.current,{opacity:[1,.45],...Lr(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):$r(o.current,{keyframes:{"0%":{translateY:0,scaleX:1,scaleY:1},"18%":{translateY:.25,scaleX:1.1,scaleY:.91},"42%":{translateY:-1.3,scaleX:.94,scaleY:1.06},"62%":{translateY:-1.65,scaleX:1,scaleY:1},"82%":{translateY:.15,scaleX:1.06,scaleY:.95},"100%":{translateY:0,scaleX:1,scaleY:1}},...Lr(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=dr(s.current,t=>{t?e.resume():e.pause()});return()=>{t(),e.revert()}},[n,h,m]),(0,$.jsxs)(`svg`,{ref:s,"aria-hidden":`true`,className:`caps-status-bead ${e??``}`,width:`8`,height:`8`,viewBox:`-4 -4 8 8`,focusable:`false`,children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsx)(Dr,{id:r,values:Fr}),(0,$.jsx)(gr,{ref:c,id:`${r}-surface`,transform:`matrix(1 0 0 ${String(d)} 0 0)`}),(0,$.jsxs)(`radialGradient`,{id:`${r}-drop-light`,gradientUnits:`userSpaceOnUse`,cx:`-1.2`,cy:`10.4`,r:`5.6`,children:[(0,$.jsx)(`stop`,{offset:`0`,stopColor:`var(--color-white)`,style:{stopOpacity:`calc(var(--depth) * 0.5)`}}),(0,$.jsx)(`stop`,{offset:`1`,stopColor:`var(--color-white)`,stopOpacity:`0`})]}),(0,$.jsx)(pr,{id:`${r}-shadow`}),(0,$.jsx)(`mask`,{id:`${r}-silhouette`,maskUnits:`userSpaceOnUse`,x:`-12`,y:`-24`,width:`24`,height:`48`,style:{maskType:`alpha`},children:(0,$.jsxs)(`g`,{fill:`var(--color-white)`,filter:`url(#${r})`,children:[(0,$.jsx)(`rect`,{ref:i,x:`-4`,y:u.y,width:`8`,height:u.height,rx:`4`}),(0,$.jsx)(`circle`,{ref:a,cx:`0`,cy:u.cy,r:`4`})]})})]}),(0,$.jsx)(`g`,{ref:o,filter:`url(#${r}-shadow)`,children:(0,$.jsxs)(`g`,{mask:`url(#${r}-silhouette)`,children:[(0,$.jsx)(`rect`,{x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-surface)`}),(0,$.jsx)(`rect`,{ref:l,x:`-12`,y:`-24`,width:`24`,height:`48`,fill:`url(#${r}-drop-light)`,opacity:f})]})})]})}var Fb=.28;function Ib(e,t){switch(e){case`ring`:return{dashes:1,track:0,arc:0,sweep:0,disc:0,tick:0,cross:0};case`arc`:return{dashes:0,track:1,arc:1,sweep:t===void 0?Fb:Math.min(1,Math.max(0,t)),disc:0,tick:0,cross:0};case`check`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:1,cross:0};case`cross`:return{dashes:0,track:0,arc:1,sweep:1,disc:1,tick:0,cross:1}}}var Lb=7.25;function Rb({className:e,glyph:t,progress:n}){let r=`caps-status-mark-${(0,J.useId)().replaceAll(`:`,``)}`,i=(0,J.useRef)(null),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(Ib(t,n)).current,p=(0,J.useRef)(t),m=ur();(0,J.useLayoutEffect)(()=>{let e=i.current,r=a.current,c=o.current,f=s.current,h=l.current,g=u.current,_=d.current;if(!e||!r||!c||!f||!h||!g||!_)return;let v=Ib(t,n),y=p.current;p.current=t;let b=Wr(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:jr:Lr(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=Lr(b,{ease:`inOutSine`,duration:220}),T=[$r(r,{opacity:v.dashes,...S}),$r(c,{opacity:v.track*.28,...S}),$r(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?jr:S:w}),$r(h,{r:v.disc*Lb,...C?{delay:w.duration*.7,...Sr(b,{bounce:.35,duration:360})}:m?jr:Lr(b,{ease:`inCubic`,duration:140})}),$r(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...Lr(b,{ease:`outCubic`,duration:240})}:jr}),$r(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...Lr(b,{ease:`outCubic`,duration:240})}:jr})];return t===`cross`&&C&&b.shake>0&&T.push($r(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...Lr(b,{ease:`linear`,duration:300})})),()=>{for(let e of T)e.cancel()}},[t,n,m]);let h=t===`arc`&&n===void 0&&!m;return(0,J.useLayoutEffect)(()=>{if(!h||!c.current||!i.current)return;let e=Wr(i.current),t=$r(c.current,{rotate:[0,360],...Lr(e,{ease:`linear`,duration:900}),loop:!0}),n=dr(i.current,e=>{e?t.resume():t.pause()});return()=>{n(),t.revert()}},[h]),(0,$.jsxs)(`svg`,{ref:i,"aria-hidden":`true`,className:`caps-status-mark ${e??``}`,viewBox:`0 0 16 16`,focusable:`false`,children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsx)(gr,{id:`${r}-surface`,transform:`matrix(1.6 0 0 1.6 8 8)`}),(0,$.jsxs)(`mask`,{id:`${r}-knock`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`16`,height:`16`,children:[(0,$.jsx)(`rect`,{width:`16`,height:`16`,fill:`var(--color-white)`}),(0,$.jsx)(`path`,{ref:u,d:`M4.9 8.3 7.1 10.5 11.2 5.9`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,strokeLinejoin:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-f.tick}),(0,$.jsx)(`path`,{ref:d,d:`M5.4 5.4 10.6 10.6 M10.6 5.4 5.4 10.6`,fill:`none`,stroke:`var(--color-black)`,strokeWidth:`1.9`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`1 1`,strokeDashoffset:1-f.cross})]})]}),(0,$.jsx)(`circle`,{ref:a,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeDasharray:`1.7 2.2`,opacity:f.dashes}),(0,$.jsx)(`circle`,{ref:o,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,opacity:f.track*.28}),(0,$.jsx)(`g`,{ref:c,className:`caps-status-mark-spin`,children:(0,$.jsx)(`circle`,{ref:s,cx:`8`,cy:`8`,r:`6.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,pathLength:1,strokeDasharray:`${String(f.sweep)} 1`,transform:`rotate(-90 8 8)`,opacity:f.arc})}),(0,$.jsx)(`circle`,{ref:l,cx:`8`,cy:`8`,r:f.disc*Lb,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var zb=new Set([`ring`,`arc`,`check`,`cross`]);function Bb(e){return zb.has(e)}var Vb={neutral:`text-base-content`,primary:`text-primary`,secondary:`text-secondary`,accent:`text-accent`,success:`text-success`,info:`text-info`,warning:`text-warning`,error:`text-error`},Hb=(0,J.forwardRef)(function({className:e,label:t,glyph:n=`dot`,motion:r=`none`,tone:i=`neutral`,size:a=`default`,appearance:o=`plain`,progress:s,...c},l){return(0,$.jsxs)(`span`,{...c,className:q(`caps-status`,a===`compact`&&`caps-status-compact`,o===`chip`&&`caps-status-chip`,e),"data-tone":o===`chip`?i:void 0,"data-glyph":n,"data-motion":r,ref:l,children:[Bb(n)?(0,$.jsx)(Rb,{className:Vb[i],glyph:n,progress:s}):(0,$.jsx)(Pb,{className:Vb[i],glyph:n,motion:r}),t===void 0?null:(0,$.jsx)(`span`,{children:t})]})}),Ub=Ye(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Wb=Ye(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Gb=Ye(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Kb=Ye(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),qb=Ye(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Jb=Ye(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Yb=Ye(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Xb=Ye(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Zb=Ye(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Qb=Ye(`ImagePlus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),$b=Ye(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),ex=Ye(`Maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),tx=Ye(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),nx=Ye(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),rx=Ye(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),ix=Ye(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ax=Ye(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),ox=24,sx={all:e=>wr.of(e,`prints`,`gallery`),listings:e=>[...sx.all(e),`listing`],listing:(e,t)=>[...sx.listings(e),t],file:(e,t)=>[...sx.all(e),`file`,t]};function cx(e,t){let n=e?.context.get().computerId;return sa({queryKey:sx.listing(e,t),initialPageParam:0,enabled:!!(n&&t&&e.capabilities.has(on)&&e.capabilities.has(rn)),queryFn:async({pageParam:r,signal:i})=>{if(!e||!n||!t)throw new K(`No Computer folder selected`,{code:`SELECTION_CHANGED`,retryable:!1});let a=[],o=r;do{if(i.throwIfAborted(),e.context.get().computerId!==n)throw new K(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});let r=await dn(e.capabilities,{path:t,limit:ox-a.length,offset:o});if(i.throwIfAborted(),r.nextOffset!==null&&r.nextOffset<=o)throw new K(`Directory pagination did not advance`,{code:`PROTOCOL`,retryable:!1});a.push(...r.entries.filter(e=>e.type===`file`&&/\.(avif|gif|jpe?g|png|svg|webp|mp4)$/i.test(e.name)).map(e=>({...e,path:`${r.path.replace(/\/$/,``)}/${e.name}`}))),o=r.nextOffset}while(a.length<ox&&o!==null);return{entries:a,nextOffset:o}},getNextPageParam:e=>e.nextOffset})}function lx(e,t,n){return{...Bn(e,rn,[...sx.file(e,t.path),t.modifiedAt,t.size],async(n,r)=>{if(!e)throw new K(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});let i=await an(e.capabilities,{path:t.path},{signal:r});return new File([i],i.name,{type:i.type,lastModified:t.modifiedAt})}),enabled:!!(n&&e?.context.get().computerId&&e.capabilities.has(rn)),structuralSharing:!1}}function ux(e,t){let n=e?.app??null,r=du(n),i=L(),[a,o]=(0,J.useState)(()=>new Set),s=(0,J.useCallback)(e=>{if(!r)return;let t=`${r}:${e}`;o(e=>e.has(t)?e:new Set([...e,t]))},[r]),c=(0,J.useCallback)(e=>{s(e),i.resetQueries({queryKey:sx.file(n,e)})},[n,i,s]),l=cx(n,t),u=ua(l),d=(0,J.useMemo)(()=>l.enabled?u.data?.pages.flatMap(e=>e.entries)??[]:[],[u.data,l.enabled]),f=(0,J.useCallback)(e=>({files:e.flatMap((e,t)=>e.data?[{path:d[t].path,file:e.data}]:[]),failures:e.flatMap((e,t)=>e.isError?[d[t].name]:[]),loading:e.some(e=>e.isLoading)}),[d]),p=oa({queries:d.map(e=>lx(n,e,!!(r&&a.has(`${r}:${e.path}`)))),combine:f});return(0,J.useEffect)(()=>{if(!n)return;let e=sx.all(n),t=sx.listings(n),a=!0;i.invalidateQueries({queryKey:e});let o=()=>{i.cancelQueries({queryKey:e})},s=n.context.subscribe(e=>{e.computerId!==r&&o()}),c=n.lifecycle.subscribe(e=>{(e===`disconnected`||e===`disposing`||e===`disposed`)&&o()}),l=n.capabilities.subscribe(()=>{queueMicrotask(()=>{!a||n.context.get().computerId!==r||i.resetQueries({queryKey:t})})});return()=>{a=!1,s(),c(),l(),o()}},[n,r,e,i]),{entries:d,loadFile:s,retryFile:c,files:p.files,failures:p.failures,error:u.error,loading:u.isFetching||p.loading,hasNextPage:u.hasNextPage,nextPageReady:u.hasNextPage&&!u.isFetching&&!u.error,refresh:()=>{u.refetch({cancelRefetch:!1})},loadMore:()=>{u.isFetching||u.fetchNextPage({cancelRefetch:!1})}}}function dx(e){return e.replace(/\s/gu,` `).replace(/ +/g,` `).trim()}function fx(e,t){let[n,r]=(0,J.useState)([]),i=(0,J.useRef)(new Map),a=(0,J.useRef)(Promise.resolve()),[o,s]=(0,J.useState)(null),c=(0,J.useRef)(new Map),l=(0,J.useRef)(e);l.current=e;let u=(0,J.useRef)(t);u.current=t;let d=(e,t,n)=>{let a=i.current.get(e);a&&i.current.set(e,{...a,status:t,message:n}),r([...i.current.values()])},f=(0,J.useCallback)(async(e,t)=>{let n=()=>t.signal.aborted;if(n()){d(e.id,`cancelled`,`Cancelled before sending`),c.current.delete(e.id);return}let r=e.dimensions;if(!r)try{let t=await cn(e.file,e.previewUrl);r={width:t.width,height:t.height},e.dimensions=r;let n=i.current.get(e.id);n&&i.current.set(e.id,{...n,dimensions:r})}catch(t){fn(`decode-upload-image`,t),d(e.id,`error`,`Could not decode this image. No upload was sent.`),c.current.delete(e.id);return}try{if(n()){d(e.id,`cancelled`,`Cancelled before sending`);return}if(e.app.context.get().computerId!==e.computerId){d(e.id,`error`,`Computer changed. Select the original Computer and retry. No upload was sent.`);return}u.current({id:e.id,path:e.path,computerId:e.computerId,app:e.app,width:r.width,height:r.height}),d(e.id,`sending`,`Sending; awaiting Computer completion`),await sn(e.app.capabilities,{path:e.path,content:e.file.slice()},{signal:t.signal}),d(e.id,`complete`,`Written to Computer`);try{await l.current(e.path,e.app,e.computerId)}catch(t){fn(`refresh-upload-preview`,t),d(e.id,`complete`,`Written; fresh preview unavailable`)}}catch(t){n()||fn(`write-computer-upload`,t),d(e.id,n()?`cancelled`:`error`,n()?`Cancelled request; check Computer before retrying`:`Completion not confirmed; check Computer or retry`)}finally{c.current.delete(e.id)}},[]),p=e=>{let t=new AbortController;c.current.set(e.id,t),d(e.id,`queued`,`Queued`),a.current=a.current.then(()=>f(e,t))},m=(0,J.useCallback)(()=>{for(let e of c.current.values())e.abort()},[]);return(0,J.useEffect)(()=>()=>{m();for(let e of i.current.values())URL.revokeObjectURL(e.previewUrl)},[m]),{items:n,error:o,cancelAll:m,add(e,t,n){s(null);let r=[...i.current.values()].reduce((e,t)=>e+t.file.size,0);for(let a of e){if(!a.type.startsWith(`image/`)){s(`Only image files can be uploaded here`);continue}if(i.current.size>=8||r+a.size>67108864){s(`Upload queue limit: eight files and 64 MiB. Remove finished rows before adding more.`);break}let e=n.context.get().computerId;if(!e){s(`Select a Computer before uploading images.`);continue}let o=`${t.replace(/\/$/,``)}/upload-${ll(8)}-${dx(a.name)}`;if(i.current.has(o)){s(`This path is already in the queue. Retry or remove its existing row.`);continue}let c={computerId:e,id:o,file:a,previewUrl:URL.createObjectURL(a),app:n,path:o,status:`queued`,message:`Queued`};i.current.set(c.id,c),r+=a.size,p(c)}},cancel(e){c.current.get(e)?.abort()},retry(e){let t=n.find(t=>t.id===e);t&&!c.current.has(e)&&p(t)},remove(e){if(!c.current.has(e)){let t=i.current.get(e);t&&URL.revokeObjectURL(t.previewUrl),i.current.delete(e),r([...i.current.values()])}}}}function px(e){return e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name}function mx(e){return e.connection.app.ui.openNavigation({computerId:e.computerId,path:e.path})}function hx(e,t){let n=t.path,r=du(e?.app),i=(0,J.useRef)(new Set),a=(0,J.useRef)(0),o=(0,J.useRef)(e);o.current=e;let s=e?.app.capabilities.has(on)===!0,c=e?.app.capabilities.has(rn)===!0,l=e?.app.capabilities.has(ln)===!0,u=ux(e,t.galleryPath),[d,f]=(0,J.useState)([]),[p,m]=(0,J.useState)([]),[h,g]=(0,J.useState)([]),[_,v]=(0,J.useState)([]);(0,J.useEffect)(()=>{v([])},[e]);let y=e=>{v(t=>t.some(t=>t.key===e.key)?t.map(t=>t.key===e.key?e:t):[...t,e])},[b,x]=(0,J.useState)(!1),S=(0,J.useMemo)(()=>[...u.error?[`Could not refresh the Media gallery`]:[],...u.failures],[u.error,u.failures]),C=(0,J.useRef)(new WeakMap),w=(0,J.useMemo)(()=>{if(!c||!s)return d.filter(e=>e.kind===`local`);let t=r?u.files.map(({file:t,path:n})=>({kind:`computer`,computerId:r,connection:e,file:t,path:n})):[],i=d.filter(t=>t.kind===`local`||t.computerId===r&&t.connection===e&&t.path.slice(0,t.path.lastIndexOf(`/`))===n?.replace(/\/$/,``));return[...t.filter(e=>!i.some(t=>t.kind===`computer`&&e.kind===`computer`&&t.path===e.path)),...i]},[e,r,n,u.files,d,c,s]),T=(0,J.useCallback)(()=>{a.current+=1;for(let e of i.current)e.abort();i.current.clear()},[]);(0,J.useEffect)(()=>{if(!e)return()=>{T()};let t=e.app.lifecycle.subscribe(e=>{(e===`disconnected`||e===`disposing`||e===`disposed`)&&T()});return()=>{t(),T()}},[e,T]),(0,J.useEffect)(()=>{if(e)return e.app.context.subscribe(e=>{e.computerId!==r&&T()})},[e,r,T]),(0,J.useEffect)(()=>{v([]),f(e=>e.filter(e=>e.kind===`local`))},[r]);let E=(0,J.useCallback)(async(e,t,n)=>{let r=n??t.app.context.get().computerId;if(!r){g([`The selected Computer is unavailable`]);return}if(o.current!==t){g([`Computer selection changed`]);return}if(t.app.context.get().computerId!==r){g([`Computer selection changed before the preview was loaded`]);return}let s=a.current,c=new AbortController;i.current.add(c);try{let n=await an(t.app.capabilities,{path:e},{signal:c.signal});if(c.signal.aborted||s!==a.current)return;v(t=>t.map(t=>t.key===`${r}:${e}`?{...t,previewFile:n}:t)),f(i=>[...i.filter(t=>t.kind!==`computer`||t.path!==e||t.computerId!==r),{kind:`computer`,computerId:r,file:n,path:e,connection:t}])}catch(t){c.signal.aborted||(fn(`read-computer-file`,t),g([`Could not read ${e}`]),v(t=>t.map(t=>t.key===`${r}:${e}`?{...t,error:`Saved; preview unavailable. Retry loading it.`}:t)))}finally{i.current.delete(c)}},[]),D=(0,J.useCallback)(t=>{let n=d.find(n=>n.kind===`computer`&&n.connection===e&&n.computerId===r&&n.path===t);n?.kind===`computer`?E(t,n.connection,n.computerId):u.retryFile(t)},[d,e,r,E,u.retryFile]),O=(0,J.useRef)(new Set),k=(0,J.useRef)(new Set),A=(0,J.useCallback)(e=>{URL.revokeObjectURL(e),O.current.delete(e)},[]);(0,J.useEffect)(()=>{let e=!0,t=new Set,n=new Map,r=new Set,i=[...w].sort((e,t)=>t.file.lastModified-e.file.lastModified||e.file.name.localeCompare(t.file.name)).map(e=>{let t=URL.createObjectURL(e.file);return O.current.add(t),{source:e,file:e.file,url:t}}),a=i.length;return g(S),x(a>0),a===0&&m([]),i.forEach(({file:o,url:s,source:c},l)=>{let u=C.current.get(o);u||(u=(async()=>{let e=URL.createObjectURL(o);try{let{width:t,height:n}=await cn(o,e);return{width:t,height:n}}finally{URL.revokeObjectURL(e)}})(),C.current.set(o,u)),u.then(r=>{e&&(n.set(l,{...r,file:o,url:s,source:c}),t.add(s),m(i.flatMap((e,t)=>{let r=n.get(t);return r?[r]:[]})),v(e=>e.map(e=>e.previewFile===o?{...e,resolved:!0,previewFile:void 0,error:void 0}:e)))}).catch(t=>{e&&(fn(`decode-gallery-image`,t),A(s),r.add(o.name),g([...S,...r]),c.kind===`computer`&&v(e=>e.map(e=>e.key===`${c.computerId}:${c.path}`?{...e,error:`Could not decode the saved image.`}:e)))}).finally(()=>{--a,e&&a===0&&(x(!1),m(i.flatMap((e,t)=>{let r=n.get(t);return r?[r]:[]})))})}),()=>{e=!1;for(let{url:e}of i)t.has(e)||A(e)}},[w,S,A]),(0,J.useEffect)(()=>{let e=new Set(p.map(e=>e.url));for(let t of k.current)e.has(t)||A(t);k.current=e},[p,A]),(0,J.useEffect)(()=>{let e=O.current;return()=>{for(let t of e)URL.revokeObjectURL(t);e.clear()}},[]);let j=fx(async(e,t,n)=>{let r=o.current,i=r?.app===t&&t.context.get().computerId===n?r:null;i&&await E(e,i,n)},e=>{o.current?.app===e.app&&e.app.context.get().computerId===e.computerId&&y({key:`${e.computerId}:${e.path}`,path:e.path,computerId:e.computerId,width:e.width,height:e.height,uploadId:e.id})});return(0,J.useEffect)(()=>{let t=j.cancelAll,n=e?.app.lifecycle.subscribe(e=>{(e===`disposing`||e===`disconnected`||e===`disposed`)&&t()});return()=>{n?.(),t()}},[e,j.cancelAll]),{images:p,failed:h,loading:b,gallery:u,gallerySlots:_,canBrowse:s,canRead:c,canWrite:l,reserveSlot:y,addComputerFile:E,retryFile:D,uploads:j,uploadFiles:async i=>{if(!e||!l||n===null)return;let a=e,s=r,c=await t.ensureCreated();if(c){g([c]);return}o.current===a&&a.app.context.get().computerId===s&&j.add(i,n,a.app)},failSlot:(e,t)=>{v(n=>n.map(n=>n.key===e?{...n,error:t}:n))},clearSlotError:e=>{v(t=>t.map(t=>t.key===e?{...t,error:void 0}:t))},removeSlot:e=>{v(t=>t.filter(t=>t.key!==e))}}}function gx(e){return e.map(e=>e.key)}function _x(e,t,n){let r=e.indexOf(t);return r<0?null:e[r+n]??null}function vx(e,t,n){if(e.includes(t))return t;let r=n.indexOf(t);if(r>=0){let t=new Set(e);for(let e=1;e<n.length;e+=1)for(let i of[e,-e]){let e=r+i;if(e<0||e>=n.length)continue;let a=n[e];if(t.has(a))return a}}return e[0]??null}var yx=(0,J.lazy)(async()=>({default:(await ir(()=>import(`./print-download-button-kcfgBeuV.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).PrintDownloadButton}));function bx({url:e,path:t,onError:n,autoPlay:r}){let i=(0,J.useRef)(null);return(0,J.useEffect)(()=>{let t=i.current;if(!t)return;let a=!1;return r&&t.play().catch(t=>{a||t instanceof DOMException&&(t.name===`NotAllowedError`||t.name===`AbortError`)||(fn(`play-print-video`,t),n(e))}),()=>{a=!0,t.pause()}},[e,n,r]),(0,$.jsx)(`video`,{ref:i,src:e,"aria-label":t,controls:!0,playsInline:!0,preload:`auto`,className:`block max-h-full max-w-full object-contain`,onError:()=>{n(e)}})}function xx({item:e,actualSize:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),o=e.pending===!0&&!e.onVisible,[s,c]=(0,J.useState)(o);o&&!s&&c(!0);let l=e.pendingLabel??`Loading print…`,u=(0,$.jsx)(`img`,{src:e.url,alt:e.path,decoding:`async`,width:t?e.width:void 0,height:t?e.height:void 0,className:t?`block max-w-none`:`block max-h-full max-w-full object-contain`,onLoad:()=>{r(e.url)},onError:()=>{a(e.url)}},e.url);return(0,$.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 items-center justify-center overflow-hidden`,"data-print-viewer-stage":!0,children:e.error||i===e.url?(0,$.jsx)(Py,{status:`failed`,className:`h-full w-full`,failure:(0,$.jsxs)(`div`,{className:`flex max-w-full flex-col items-center gap-sm px-md text-center`,children:[(0,$.jsx)(Hb,{tone:`error`,appearance:`chip`,glyph:`bang`,label:o?`Not saved`:`Prints can't show this file`}),(0,$.jsx)(`p`,{className:`max-w-full break-words text-sm`,children:e.path}),e.error?(0,$.jsx)(`p`,{className:`text-sm`,children:e.error}):null,e.onRetry?(0,$.jsx)(cr,{"aria-label":`Retry print`,title:`Retry print`,icon:(0,$.jsx)(mr,{}),onClick:e.onRetry}):null,e.onDismiss?(0,$.jsx)(cr,{"aria-label":`Dismiss print`,title:`Dismiss print`,icon:(0,$.jsx)(mn,{}),onClick:e.onDismiss}):null]})}):un(e.path)&&e.url?(0,$.jsx)(bx,{url:e.url,path:e.path,onError:a,autoPlay:!s}):e.url?(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(Mb,{className:`h-full w-full`,role:`region`,"aria-label":`Actual-size print`,tabIndex:0,"data-print-viewer-scroll":!0,children:u}):u,n===e.url?null:(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,$.jsx)(zr,{label:`Loading print`,variant:`bloom`})})]}):(0,$.jsx)(Py,{status:`generating`,label:l,className:`h-full w-full`,indicator:(0,$.jsxs)(`div`,{"aria-hidden":`true`,className:`flex max-w-full flex-col items-center gap-sm px-md text-center`,children:[(0,$.jsx)(zr,{decorative:!0,variant:`bloom`}),(0,$.jsx)(`p`,{className:`text-sm`,children:l})]})})})}function Sx({source:e}){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)(!1);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(yt,{label:`Open in Inkcap`,icon:(0,$.jsx)(qb,{}),disabled:t,onClick:()=>{n(!0),i(!1),mx(e).catch(e=>{fn(`open-print-in-inkcap`,e),i(!0)}).finally(()=>{n(!1)})}}),r?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Could not open `,e.path,` in Inkcap.`]}):null]})}function Cx({items:e,images:t,viewerKey:n,app:r,onNavigate:i,onClose:a,renderInfo:o}){let s=(0,J.useRef)(null),c=gx(e),l=(0,J.useRef)(c),u=n===null?null:vx(c,n,l.current);(0,J.useEffect)(()=>{l.current=c,n!==null&&u!==n&&(u===null?a(n):i(u))},[c,u,n,a,i]),(0,J.useEffect)(()=>{if(u===null)return;let t=e.findIndex(e=>e.key===u);for(let n of e.slice(Math.max(0,t-1),t+2))n.onVisible?.()},[e,u]);let[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(null);(0,J.useEffect)(()=>{m(null)},[u]),(0,J.useEffect)(()=>{f(null)},[n]);let h=e.find(e=>e.key===u),g=t.find(e=>px(e)===u);if(!h||u===null)return null;let _=_x(c,u,-1),v=_x(c,u,1),y=h.path.split(`/`).at(-1)??h.path,b=()=>{a(u)},x=e=>{e!==null&&i(e)};return(0,$.jsx)(Cy,{open:!0,onOpenChange:e=>{e||b()},children:(0,$.jsxs)(Ty,{children:[(0,$.jsx)(Ey,{}),(0,$.jsxs)(Dy,{ref:s,size:`fill`,initialFocus:s,finalFocus:!1,className:`flex min-h-0 flex-col gap-sm`,onKeyDown:e=>{e.altKey||e.ctrlKey||e.metaKey||e.target instanceof HTMLElement&&e.target.closest(`input, textarea, select, video, [data-print-viewer-scroll], [contenteditable=true]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`?(e.preventDefault(),x(e.key===`ArrowLeft`?_:v)):e.key.toLowerCase()===`i`&&g&&(e.preventDefault(),f(d===u?null:u)))},children:[(0,$.jsx)(Jr,{fit:`fill`,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(bn,{title:(0,$.jsx)(jy,{className:`truncate`,children:y}),status:(0,$.jsxs)(`span`,{"aria-live":`polite`,"aria-atomic":`true`,children:[(0,$.jsxs)(`span`,{className:`sr-only`,children:[y,`, `]}),c.indexOf(u)+1,` of `,c.length]})}),(0,$.jsxs)(`div`,{className:`@container relative flex min-h-0 min-w-0 flex-1`,children:[(0,$.jsx)(xx,{item:h,actualSize:p===u},u),d===u&&g?o(g,()=>{f(null)}):null]})]})}),(0,$.jsxs)(`div`,{className:`prints-viewer-actions`,children:[(0,$.jsx)(cr,{size:`default`,iconSize:`md`,"aria-label":`Previous print`,title:`Previous print (Left arrow)`,"aria-keyshortcuts":`ArrowLeft`,icon:(0,$.jsx)(Ub,{}),disabled:_===null,onClick:()=>{x(_)}}),(0,$.jsx)(cr,{size:`default`,iconSize:`md`,"aria-label":`Next print`,title:`Next print (Right arrow)`,"aria-keyshortcuts":`ArrowRight`,icon:(0,$.jsx)(Wb,{}),disabled:v===null,onClick:()=>{x(v)}}),(0,$.jsx)(cr,{size:`default`,iconSize:`md`,"aria-label":`Image info`,title:`Image info (I)`,"aria-keyshortcuts":`i`,"aria-expanded":d===u,icon:(0,$.jsx)($b,{}),disabled:!g,onClick:()=>{f(d===u?null:u)}}),un(h.path)?null:(0,$.jsx)(cr,{size:`default`,iconSize:`md`,"aria-label":`Actual size`,title:`Actual size`,"aria-pressed":p===u,active:p===u,icon:(0,$.jsx)(ex,{}),disabled:!h.url||!!h.error,onClick:()=>{m(p===u?null:u)}}),g?(0,$.jsx)(J.Suspense,{fallback:null,children:(0,$.jsx)(yx,{source:g.source,app:r},g.url)}):null,g?.source.kind===`computer`?(0,$.jsx)(Sx,{source:g.source},u):null,(0,$.jsx)(cr,{size:`default`,iconSize:`md`,"aria-label":`Close viewer`,title:`Close viewer (Escape)`,icon:(0,$.jsx)(mn,{}),onClick:b})]})]})]})})}var wx=e=>Ve.pipe(dt(Ue(1)),dt(ot(e))),Tx=ze.pipe(dt(ct()),dt(Qt(Number.isSafeInteger,{message:`Expected a safe integer`}))),Ex=Tx.pipe(dt(kt(0))),Dx=Tx.pipe(dt(xt(0))),Ox=me({bytes:Ex,costMilliunits:Dx,destination:me({computerId:wx(256),path:wx(4096)}),format:k([`png`,`jpeg`,`gif`,`webp`,`mp4`]),height:Ex,model:wx(256),width:Ex}),kx=me({operation:Fe(`complete-generation`),reference:ut,result:Ox,derivedFrom:Je(wx(256)),references:Je(f(z(wx(256))))}),Ax=me({prompt:H,references:De.pipe(dt(xt(0)))}),jx=me({reference:ut,input:Pt,typed:Ax,style:Je(Jn),characters:Je(f(Pr))});wt([me({operation:Fe(`remember-generation`),record:jx}),me({operation:Fe(`forget-generation`),reference:ut}),me({operation:Fe(`list-generations`),after:z(Ve)})]);function Mx(e){return{reference:e.reference,input:Rt(e.input),typed:e.typed,style:e.style,characters:e.characters}}async function Nx(e,t){let n=Mx(Xe(jx,{onExcessProperty:`error`})(t)),r=Mx(Xe(jx,{onExcessProperty:`error`})(await e.require(wn).request(JSON.stringify({operation:`remember-generation`,record:n}))));if(JSON.stringify(r)!==JSON.stringify(n))throw new K(`Prints did not confirm the original generation command`,{code:`PROTOCOL`,retryable:!1});return r}async function Px(e,t){Xe(me({removed:je}))(await e.require(wn).request(JSON.stringify({operation:`forget-generation`,reference:t})))}async function Fx(e,t=null){let n=Xe(me({records:f(jx),next:z(Ve)}),{onExcessProperty:`error`})(await e.require(wn).request(JSON.stringify({operation:`list-generations`,after:t})));return{records:n.records.map(Mx),next:n.next}}async function Ix(e,t,n){let r=Xe(kx,{onExcessProperty:`error`})({operation:`complete-generation`,reference:t,result:n}),i=Xe(me({printId:Ve,computerId:Ve}))(await e.require(wn).request(JSON.stringify(r)));if(i.printId!==t.requestId||i.computerId!==t.computerId)throw new K(`Prints did not confirm the saved generation`,{code:`PROTOCOL`,retryable:!1})}var Lx=Dt(me({reference:ut}));function Rx({connection:e,folder:t,effects:n,styles:r,characters:i}){let a=e?.app??null,o=du(a),s=(0,J.useRef)(e);s.current=e;let c=(0,J.useRef)(n);c.current=n;let l=L(),u=wr.of(a,`prints`,`generation`),d=[...u,`recovery`],f=Ln(Mr(a)),p=f.isError?void 0:f.data,m=p?.models??[],h=a?.capabilities.has(Ct)===!0,g=p?.canGenerate??!1,_=f.error?nn(f.error).message:p?.models.length===0?`The granted Media model registry is empty.`:null,v=ua({queryKey:d,enabled:a!==null&&o!==null,initialPageParam:null,queryFn:async({pageParam:e,signal:t})=>{if(!a)throw new K(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0});if(a.context.get().computerId!==o)throw new K(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1});let n=await Fx(a.capabilities,e);return t.throwIfAborted(),n},getNextPageParam:e=>e.next}),y=(0,J.useMemo)(()=>Array.from(new Map(v.data?.pages.flatMap(e=>e.records).map(e=>[e.reference.requestId,e])??[]).values()),[v.data]),b=(0,J.useRef)(new Map),x=(0,J.useRef)(new Set),S=(0,J.useRef)(0),C=(0,J.useRef)(null),[w,T]=(0,J.useState)(null),[E,D]=(0,J.useState)(null),O=e=>{T(e),c.current.notifyFailure(e.message)},k=e=>{D(e),c.current.notifyFailure(e)},A=(0,J.useRef)(null);(0,J.useEffect)(()=>{A.current!==v.error&&(A.current=v.error,v.error&&c.current.notifyFailure(nn(v.error).message))},[v.error]);let j=e=>s.current===e.connection&&e.connection.app.context.get().computerId===e.reference.computerId,M=(e,t)=>{l.setQueryData(e,e=>e&&{...e,pages:e.pages.map(e=>({...e,records:e.records.filter(e=>e.reference.requestId!==t)}))})},N=pt({mutationKey:[...u,`run`],mutationFn:async e=>{e.controller.signal.throwIfAborted();let t=Mx({reference:e.reference,input:e.input,typed:e.typed,style:e.style,characters:e.characters});await Nx(e.connection.app.capabilities,t),e.controller.signal.throwIfAborted();let n=await e.session.restoreAttempt(e.reference),r;try{r=await n.generate(t.input,{signal:e.controller.signal})}finally{n[Symbol.dispose]()}return await Ix(e.connection.app.capabilities,t.reference,r),{input:e.input,result:r}},onMutate:e=>{if(!j(e)||e.controller.signal.aborted)return;let t=Qn(e.session.models,e.input.settings.model),n={key:`${e.reference.computerId}:${e.input.destination.path}`,computerId:e.reference.computerId,path:e.input.destination.path,width:e.draft.width,height:e.draft.height,pendingLabel:Zr(t)};t?.kind===`video`&&(n.startedAt=Date.now(),n.resumed=e.resumed===!0),c.current.reserve(n)},onSuccess:(e,t)=>{M(t.recoveryKey,t.reference.requestId),C.current?.reference.requestId===t.reference.requestId&&(C.current=null),!(!j(t)||t.controller.signal.aborted)&&c.current.saved(e,t.connection)},onError:(e,n)=>{if(fn(`generate-media`,e),!j(n)||n.controller.signal.aborted)return;t.recheck();let r=Vn(e).message;c.current.failed(`${n.reference.computerId}:${n.input.destination.path}`,r),c.current.notifyFailure(r)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),P=pt({mutationKey:[...u,`discard`],mutationFn:async e=>{await Px(e.connection.app.capabilities,e.reference)},onSuccess:(e,t)=>{M(t.recoveryKey,t.reference.requestId),C.current?.reference.requestId===t.reference.requestId&&(C.current=null)},onError:(e,t)=>{j(t)&&k(nn(e).message)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),F=la({filters:{mutationKey:u,status:`pending`},select:e=>ke(Lx(e.state.variables))?.reference.requestId}),I=new Set(F.filter(e=>e!==void 0));(0,J.useEffect)(()=>{x.current.clear(),T(null),D(null),C.current=null;let e=wr.of(a,`prints`,`generation`,`recovery`),t=a?.capabilities.subscribe(()=>{queueMicrotask(()=>{l.resetQueries({queryKey:e,exact:!0})})}),n=()=>{S.current+=1;for(let e of b.current.values())e.abort();b.current.clear(),l.cancelQueries({queryKey:e})},r=a?.context.subscribe(e=>{e.computerId!==o&&n()}),i=a?.lifecycle.subscribe(e=>{(e===`disposing`||e===`disposed`||e===`disconnected`)&&n()});return()=>{r?.(),i?.(),t?.(),n()}},[a,o,e,l]);let R=e=>{let t=e.reference.requestId;if(b.current.has(t))return!1;if(!j(e))return k(`Select the original Computer to retry this generation.`),!1;if(p?.computerId!==e.reference.computerId)return k(`Media access is unavailable for the original Computer.`),!1;let n=new AbortController;return b.current.set(t,n),C.current=e,T(null),D(null),S.current+=1,N.mutate({...e,session:p,controller:n,ticket:S.current,recoveryKey:d}),!0};(0,J.useEffect)(()=>{if(!(!e||!p||!v.isSuccess))for(let t of y){let n=t.reference.requestId;x.current.has(n)||t.reference.computerId!==o||Qn(p.models,t.input.settings.model)?.kind!==`video`||R({connection:e,...t,resumed:!0,draft:{...t.input.settings,references:t.input.settings.references??[],destination:t.input.destination.path}})&&x.current.add(n)}},[e,o,p,v.isSuccess,y]);let z=async n=>{if(!e?.app.capabilities.has(ln)||!g)return!1;if(t.path===null)return t.setEditing(!0),!1;C.current=null;let a=Qn(m,n.model);if(a===void 0)return O({kind:`error`,mediaKind:null,message:`Choose a model from the granted registry.`}),!1;let c=ar({prompt:n.prompt,saved:i,references:n.references,computerId:o,model:{label:a.label,maxReferences:a.input.maxReferences}});if(c.kind===`refused`)return O({kind:`error`,mediaKind:a.kind,message:c.message}),!1;let l=nr({...n,references:c.references},a);if(l)return O({kind:`error`,mediaKind:a.kind,message:l}),!1;let u=n.style===void 0?void 0:r.find(e=>e.name===n.style);if(n.style!==void 0&&u===void 0)return O({kind:`error`,mediaKind:a.kind,message:`The "${n.style}" style no longer exists. Pick another or none.`}),!1;let d=c.characters.map(e=>e.name),f=lr(u?.text,c.prompt),_=Kn(f,yn(a),u?.name,d);if(_!==void 0)return O({kind:`error`,mediaKind:a.kind,message:_}),!1;if(!h||!p)return T(null),!1;let v=e,y=v.app.context.get().computerId,b=S.current,x={...n,prompt:f,references:c.references,destination:Pn(n,t.path,a)},w=Wn(x,a),E;try{let e=await t.ensureCreated();if(e)return O({kind:`error`,mediaKind:a.kind,message:e}),!1;if(S.current!==b||s.current!==v||v.app.context.get().computerId!==y)return!1;let n=await p.createAttempt();E=n.reference,n[Symbol.dispose]()}catch(e){return S.current===b&&s.current===v&&v.app.context.get().computerId===y&&O({kind:`error`,mediaKind:a.kind,...Vn(e)}),!1}return S.current!==b||s.current!==v||v.app.context.get().computerId!==y?!1:R({connection:v,reference:E,input:w,draft:x,typed:{prompt:n.prompt.trim(),references:n.references.length},style:u?.name,characters:d})},B=N.variables;return{state:w??(B&&j(B)&&B.ticket===S.current?N.isPending?{kind:`pending`,draft:B.draft}:N.isError?{kind:`error`,mediaKind:Qn(B.session.models,B.input.settings.model)?.kind??null,...Vn(N.error)}:{kind:`completed`,record:N.data}:null)??(!e||!h||o===null?{kind:`unavailable`,reason:`Image creation is unavailable for this Computer right now.`}:_?{kind:`unavailable`,reason:_}:p?{kind:`ready`}:{kind:`loading`}),models:m,modelsLoading:f.isFetching,modelsError:_,canGenerate:g,mediaCapability:h,retryModels:()=>{f.refetch()},submit:z,isRunning:()=>b.current.size>0,activeGenerations:I,pendingGenerations:y,recoveryError:E??(v.error?nn(v.error).message:null),reportRecoveryError:e=>{k(nn(e).message)},hasMore:v.hasNextPage,loadMore:()=>{v.isFetching||v.fetchNextPage()},resume:t=>{if(!e||p?.computerId!==t.reference.computerId){k(`Select the original Computer to retry this generation.`);return}R({connection:e,...t,draft:{...t.input.settings,references:t.input.settings.references??[],destination:t.input.destination.path}})},discard:t=>{if(!e||b.current.has(t.reference.requestId))return;let n=new AbortController;b.current.set(t.reference.requestId,n),P.mutate({...t,connection:e,controller:n,draft:{...t.input.settings,references:t.input.settings.references??[]},recoveryKey:d})},retryPath:e=>{let t=C.current;return t?.input.destination.path!==e||!j(t)?!1:(R(t),!0)},retry:C.current&&j(C.current)?()=>{C.current&&R(C.current)}:void 0,errorKey:`generation:${C.current?.reference.requestId??`draft`}:${String(S.current)}`}}function zx({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function Bx(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Vx=[],Hx=0,{link:Ux,unlink:Wx,propagate:Gx,checkDirty:Kx,shallowPropagate:qx}=zx({update(e){return e._update()},notify(e){Vx[Yx++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,$x(e))}}),Jx=0,Yx=0,Xx,Zx=0;function Qx(e){try{++Zx,e()}finally{--Zx||eS()}}function $x(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Wx(n,e)}function eS(){if(!(Zx>0)){for(;Jx<Yx;){let e=Vx[Jx];Vx[Jx++]=void 0,e.notify()}Jx=0,Yx=0}}function tS(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return Xx!==void 0&&Ux(i,Xx,Hx),i._snapshot},subscribe(e){let t=Bx(e),n={current:!1},r=nS(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Xx,o=t?.compare??Object.is;if(n)Xx=i,++Hx,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Xx=a,n&&(i.flags&=-5),$x(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Kx(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&qx(e)}}else e&32&&(i.flags=e&-33);return Xx!==void 0&&Ux(i,Xx,Hx),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Gx(e),qx(e),eS())}},i}function nS(e){let t=()=>{let t=Xx;Xx=n,++Hx,n.depsTail=void 0,n.flags=6;try{return e()}finally{Xx=t,n.flags&=-5,$x(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Kx(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,$x(this)}};return t(),n}var rS=class{constructor(e,t){this.atom=tS(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Bx(e))}},iS=class{constructor(e){this.atom=tS(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Bx(e))}};function aS(e,t){return typeof e==`function`?new iS(e):t?new rS(e,t):new rS(e)}var oS=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function sS(e,t){return new oS(e,t).maybeExecute}var cS=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},lS=new class extends cS{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function uS(e,t){return typeof e==`function`?e(t):e}function dS(e,t){return yS(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function fS(e,t,n){let r=yS(t);function i(e){if(!r.length)return uS(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function pS(e,t){let n=yS(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var mS=46,hS=91,gS=93,_S=48,vS=57;function yS(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===hS),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===mS||s===hS||s===gS){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==_S),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==gS&&(a!==-1||s!==gS)&&(a!==s||s!==mS&&s!==hS)&&n.push(``);r=o+1,i=!0}else(s<_S||s>vS)&&(i=!1);a=s}return n.length||n.push(``),n}function bS(e){return!(Array.isArray(e)&&e.length===0)}function xS(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function SS(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var CS=e=>!!e&&typeof e==`object`&&`fields`in e;function wS(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!wS(e[i],t[i]))return!1;return!0}var TS=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},ES=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function DS(e,t){return e==null?t:{...e,...t}}for(var OS=256,kS=[],AS;OS--;)kS[OS]=(OS+256).toString(16).substring(1);function jS(){let e=0,t,n=``;if(!AS||OS+16>256){for(AS=Array(256),e=256;e--;)AS[e]=256*Math.random()|0;e=0,OS=0}for(;e<16;e++)t=AS[OS+e],n+=e===6?kS[t&15|64]:e===8?kS[t&63|128]:kS[t],e&1&&e>1&&e<11&&(n+=`-`);return OS++,n}var MS=sS(e=>lS.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function NS(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=NS(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,NS(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(NS(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=NS(e[n]));return t}function PS(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var FS=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function IS(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var LS=(e,t)=>{let n=IS(e,t);return{form:n,fields:n}},RS={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:LS(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:LS(r.issues,e)}},zS=e=>!!e&&`~standard`in e,BS={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function VS(e){function t(t){let n=e.getFieldMeta(t)??BS;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>BS;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function HS(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var US=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{MS(this)}),t=lS.on(`request-form-state`,e=>{e.payload.id===this._formId&&lS.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=lS.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=lS.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),lS.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return lS.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!wS(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!wS(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(Qx(()=>{this.baseStore.setState(()=>HS(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=VS(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}lS.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=fS(t,e.instance.name,e.instance.options.defaultValue))}),HS({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return Qx(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return Qx(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=xS(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||FS}),r=!1,i={};return Qx(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=WS(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=GS(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??BS,r=a?.[e],{newErrorValue:s,newSource:c}=TS({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=BS)=>({...e,errorMap:{...e.errorMap,[o]:s},errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=GS(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=GS(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=SS(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||FS});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=GS(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=WS(r);s&&(i=i?{...i,...s}:s);let c=GS(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??BS,r=i?.[e],{newErrorValue:a,newSource:o}=TS({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=BS)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),Qx(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),lS.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),lS.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}Qx(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),Qx(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),lS.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),lS.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>dS(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:uS(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=BS,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;Qx(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:fS(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t!==n&&t.startsWith(n)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=pS(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),VS(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],DS(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),VS(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),DS(r,{dontValidate:!0})),VS(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),DS(n,{dontValidate:!0})),VS(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return fS(fS(e,`${t}`,i),`${n}`,r)},DS(r,{dontValidate:!0})),VS(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},DS(r,{dontValidate:!0})),VS(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],DS(t,{dontValidate:!0})),VS(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=dS(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:BS},values:i===void 0?t.values:fS(t.values,e,i)}})},this.setErrorMap=e=>{Qx(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(CS(t)){let{formError:e,fieldErrors:r}=WS(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>RS.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>RS.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??jS(),this._devtoolsSubmissionOverride=!1;let t=HS({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(!(n===void 0||!CS(n)))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=aS(t);let n;this.fieldMetaDerived=aS(e=>{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=dS(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!bS(u),f=!o.isDirty,p=wS(l,this.getFieldInfo(a)?.instance?.options.defaultValue??dS(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=aS(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!PS(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&PS(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=aS(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&CS(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&wS(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return zS(e.validate)?RS[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function WS(e){return e?CS(e)?{formError:WS(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function GS(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var KS=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...BS,isTouched:e.fieldMetaBase[this.name]?.isTouched??BS.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??BS.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??BS.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(wS(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,DS(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,DS(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,DS(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,DS(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,DS(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,DS(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,DS(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,DS(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=xS(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||FS}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=xS(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||FS});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;Qx(()=>{let e=(e,n)=>{let r=JS(n.cause),a=n.validate?qS(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=ES({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=JS(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=SS(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||FS}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=SS(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||FS});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));Qx(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=JS(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=qS(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=ES({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),Qx(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>PS(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[JS(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[JS(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)a.get(t)&&!t.options.asyncAlways||c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>RS.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>RS.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)PS(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=aS(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...BS,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!wS(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return zS(e.validate)?RS[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function qS(e){if(e)return e}function JS(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function YS(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function XS(e){return{...BS,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var ZS=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??YS({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(wS(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...BS,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??YS({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;$S(t)&&(n=t.group,r=t.fields);let i=QS(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:YS({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,DS(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof KS&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&PS(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=TS({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=BS)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=xS(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||FS}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=xS(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||FS});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;Qx(()=>{let t=(t,r)=>{let i=tC(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&$S(s)&&(c=s.group,l=s.fields);let u=QS(c),d=n[i],{newErrorValue:f,newSource:p}=ES({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=tC(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=SS(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||FS}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=SS(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||FS});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=tC(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&$S(o)&&(l=o.group,u=o.fields);let d=QS(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=ES({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return Qx(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>PS(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[tC(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>PS(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),Qx(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}Qx(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),Qx(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=aS(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??XS(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!wS(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(zS(e.validate)){let t=RS[e.type](e.value,e.validate);return e.type===`validate`?eC(t):t.then(eC)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function QS(e){if(e)return e}function $S(e){return!!e&&typeof e==`object`&&`fields`in e}function eC(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function tC(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function nC(e,t){if(!t)return;let n=Object.assign({},e,{state:NS(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return Qx(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}function rC(e,t){return e===t}function iC(e,t=e=>e,n){let r=n?.compare??rC,i=(0,J.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,J.useCallback)(()=>e.get(),[e]);return(0,Gg.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var aC=typeof window<`u`?J.useLayoutEffect:J.useEffect;function oC(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new KS({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new KS({...e}),i(a),n({form:e.form,name:e.name}));let o=iC(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=iC(a.store,e=>e.meta.isTouched),c=iC(a.store,e=>e.meta.isBlurred),l=iC(a.store,e=>e.meta.isDirty),u=iC(a.store,e=>e.meta.errorMap),d=iC(a.store,e=>e.meta.errorSourceMap),f=iC(a.store,e=>e.meta.isValidating),p=(0,J.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return aC(a.mount,[a]),aC(()=>{a.update(e)}),p}var sC=(({children:e,...t})=>{let n=oC(t),r=(0,J.useMemo)(()=>uS(e,n),[e,n]);return(0,$.jsx)($.Fragment,{children:r})});function cC(){return(0,J.useState)(()=>jS())[0]}var lC=J,uC=`18.3.1`.split(`.`)[0]===`17`?cC:lC.useId;function dC(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new ZS({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new ZS({...e})),n({form:e.form,name:e.name}));let a=iC(r.store,e=>e.value),o=iC(r.store,e=>e.meta.isTouched),s=iC(r.store,e=>e.meta.isBlurred),c=iC(r.store,e=>e.meta.isDirty),l=iC(r.store,e=>e.meta.errorMap),u=iC(r.store,e=>e.meta.errorSourceMap),d=iC(r.store,e=>e.meta.isValidating),f=iC(r.store,e=>e.meta.isSubmitting),p=iC(r.store,e=>e.meta.isSubmitted),m=iC(r.store,e=>e.meta.submissionAttempts),h=iC(r.store,e=>e.meta.isSubmitSuccessful),g=iC(r.store,e=>e.meta.canSubmit),_=iC(r.store,e=>e.meta.isValid),v=iC(r.store,e=>e.meta.isFieldsValid),y=iC(r.store,e=>e.meta.isFieldsValidating),b=iC(r.store,e=>e.meta.isGroupValid),x=(0,J.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return aC(r.mount,[r]),aC(()=>{r.update(e)}),x}var fC=(({children:e,...t})=>{let n=dC(t),r=(0,J.useMemo)(()=>uS(e,n),[e,n]);return(0,$.jsx)($.Fragment,{children:r})});function pC({form:e,selector:t=e=>e,children:n}){let r=iC(e.store,t);return(0,$.jsx)($.Fragment,{children:uS(n,r)})}function mC(e){let t=uC(),[n,r]=(0,J.useState)(e?.formId),[i,a]=(0,J.useState)(()=>new US({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new US({...e,formId:n})),r(n)}let o=(0,J.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,$.jsx)(sC,{...e,form:i})},e.FormGroup=function(e){return(0,$.jsx)(fC,{...e,form:i})},e.Subscribe=function(e){return(0,$.jsx)(pC,{form:i,selector:e.selector,children:e.children})},e},[i]);aC(i.mount,[]),aC(()=>{i.update(e)});let s=(0,J.useRef)(!1);return aC(()=>{s.current&&e?.transform&&nC(i,e.transform)},[i,e?.transform]),aC(()=>{s.current=!0}),o}var hC=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,$.jsx)(`input`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:q(`input caps-input w-full`,e),ref:r})});(0,J.forwardRef)(function({leading:e,className:t,...n},r){return(0,$.jsxs)(`span`,{className:`caps-search-input`,"data-leading":e?`true`:void 0,children:[e?(0,$.jsx)(`span`,{className:`caps-search-leading`,"aria-hidden":`true`,children:e}):null,(0,$.jsx)(hC,{...n,type:`search`,className:t,ref:r})]})});function gC(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var _C=e=>{switch(e){case`success`:return bC;case`info`:return SC;case`warning`:return xC;case`error`:return CC;default:return null}},vC=Array(12).fill(0),yC=({visible:e,className:t})=>J.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},J.createElement(`div`,{className:`sonner-spinner`},vC.map((e,t)=>J.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),bC=J.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},J.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),xC=J.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},J.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),SC=J.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},J.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),CC=J.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},J.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),wC=J.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},J.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),J.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),TC=()=>{let[e,t]=J.useState(document.hidden);return J.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},EC=1,DC=100,OC=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:EC++,kC=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-DC;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=OC(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],J.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(jC(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!J.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!J.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!J.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!J.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=OC(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},AC=(e,t)=>kC.message(e,t),jC=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,MC=Object.assign(AC,{success:kC.success,info:kC.info,warning:kC.warning,error:kC.error,custom:kC.custom,message:kC.message,promise:kC.promise,dismiss:kC.dismiss,loading:kC.loading},{getHistory:()=>kC.toasts,getToasts:()=>kC.getActiveToasts()});gC(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function NC(e){return e.label!==void 0}var PC=3,FC=`24px`,IC=`16px`,LC=4e3,RC=356,zC=14,BC=45,VC=200;function HC(...e){return e.filter(Boolean).join(` `)}function UC(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var WC=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=J.useState(null),[O,k]=J.useState(null),[A,j]=J.useState(!1),[M,N]=J.useState(!1),[P,F]=J.useState(!1),[I,L]=J.useState(!1),[R,z]=J.useState(!1),[B,V]=J.useState(0),[H,ee]=J.useState(0),te=J.useRef(n.duration||y||LC),U=J.useRef(null),W=J.useRef(null),ne=c===0,re=c+1<=o,ie=n.type,ae=ie??`default`,oe=n.dismissible!==!1,se=n.className||``,ce=n.descriptionClassName||``,le=J.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),ue=J.useMemo(()=>n.closeButton??p,[n.closeButton,p]),de=J.useMemo(()=>n.duration||y||LC,[n.duration,y]),fe=J.useRef(0),G=J.useRef(0),pe=J.useRef(0),me=J.useRef(null),[he,ge]=b.split(`-`),K=J.useMemo(()=>s.reduce((e,t,n)=>n>=le?e:e+t.height,0),[s,le]),_e=TC(),ve=J.useMemo(()=>e.swipeDirections??UC(b),[e.swipeDirections,b]),ye=n.invert||t,be=ie===`loading`;G.current=J.useMemo(()=>le*x+K,[le,K]),J.useEffect(()=>{te.current=de},[de]),J.useEffect(()=>{j(!0)},[]),J.useEffect(()=>{let e=W.current;if(e){let t=e.getBoundingClientRect().height;return ee(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),J.useLayoutEffect(()=>{if(!A)return;let e=W.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,ee(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let xe=J.useCallback(()=>{N(!0),V(G.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},VC)},[n,d,a,G]);J.useEffect(()=>{if(n.promise&&ie===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||_e?(()=>{if(pe.current<fe.current){let e=new Date().getTime()-fe.current;te.current-=e}pe.current=new Date().getTime()})():te.current!==1/0&&(fe.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),xe()},te.current)),()=>clearTimeout(e)},[u,i,n,ie,_e,xe]),J.useEffect(()=>{n.delete&&(xe(),n.onDismiss==null||n.onDismiss.call(n,n))},[xe,n.delete]);function Se(){return w?.loading?J.createElement(`div`,{className:HC(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ie===`loading`},w.loading):J.createElement(yC,{className:HC(C?.loader,n?.classNames?.loader),visible:ie===`loading`})}let Ce=n.icon||w?.[ie]||_C(ie);return J.createElement(`li`,{tabIndex:0,ref:W,className:HC(_,se,C?.toast,n?.classNames?.toast,C?.[ae],n?.classNames?.[ae]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":A,"data-promise":!!n.promise,"data-swiped":R,"data-removed":M,"data-visible":re,"data-y-position":he,"data-x-position":ge,"data-index":c,"data-front":ne,"data-swiping":P,"data-dismissible":oe,"data-type":ie,"data-invert":ye,"data-swipe-out":I,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?B:G.current}px`,"--initial-height":S?`auto`:`${H}px`,...m,...n.style},onDragEnd:()=>{F(!1),D(null),me.current=null},onPointerDown:e=>{e.button!==2&&(be||!oe||(U.current=new Date,V(G.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(F(!0),me.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(I||!oe)return;me.current=null;let e=Number(W.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(W.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-U.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if((E===`x`?ve.includes(e>0?`right`:`left`):ve.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=BC||a>.11)){V(G.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),xe(),L(!0);return}var o,s;(o=W.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=W.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),z(!1),F(!1),D(null)},onPointerMove:e=>{var t,n;if(!me.current||!oe||window.getSelection()?.toString().length>0)return;let r=e.clientY-me.current.y,i=e.clientX-me.current.x;!E&&(Math.abs(i)>1||Math.abs(r)>1)&&D(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(ve.includes(`top`)||ve.includes(`bottom`)){if(ve.includes(`top`)&&r<0||ve.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(E===`x`&&(ve.includes(`left`)||ve.includes(`right`))){if(ve.includes(`left`)&&i<0||ve.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&z(!0),(t=W.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=W.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},ue&&!n.jsx&&ie!==`loading`?J.createElement(`button`,{"aria-label":T,"data-disabled":be,"data-close-button":!0,onClick:be||!oe?()=>{}:()=>{xe(),n.onDismiss==null||n.onDismiss.call(n,n)},className:HC(C?.closeButton,n?.classNames?.closeButton)},w?.close??wC):null,(ie||n.icon||n.promise)&&n.icon!==null&&(w?.[ie]!==null||n.icon)?J.createElement(`div`,{"data-icon":``,className:HC(C?.icon,n?.classNames?.icon)},ie===`loading`?n.icon||Se():n.promise?Se():null,ie===`loading`?null:Ce):null,J.createElement(`div`,{"data-content":``,className:HC(C?.content,n?.classNames?.content)},J.createElement(`div`,{"data-title":``,className:HC(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?J.createElement(`div`,{"data-description":``,className:HC(v,ce,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),J.isValidElement(n.cancel)?n.cancel:n.cancel&&NC(n.cancel)?J.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{NC(n.cancel)&&oe&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),xe())},className:HC(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,J.isValidElement(n.action)?n.action:n.action&&NC(n.action)?J.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{NC(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&xe())},className:HC(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function GC(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function KC(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?IC:FC;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var qC=J.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=PC,toastOptions:g,dir:_=GC(),gap:v=zC,icons:y,customAriaLabel:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=J.useState([]),w=J.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=J.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=J.useState([]),[O,k]=J.useState(!1),[A,j]=J.useState(!1),[M,N]=J.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),P=J.useRef(null),F=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),I=J.useRef(null),L=J.useRef(!1),R=J.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||kC.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return J.useEffect(()=>kC.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Ih.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),J.useEffect(()=>{if(d!==`system`){N(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?N(`dark`):N(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{N(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{N(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),J.useEffect(()=>{S.length<=1&&k(!1)},[S]),J.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;k(!0),(t=P.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===P.current||P.current?.contains(document.activeElement))&&k(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),J.useEffect(()=>{if(P.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[P.current]),J.createElement(`section`,{ref:t,"aria-label":b??`${x} ${F}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?J.createElement(`ol`,{key:t,dir:_===`auto`?GC():_,tabIndex:-1,ref:P,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${RC}px`,"--gap":`${v}px`,...m,...KC(l,u)},onBlur:e=>{L.current&&!e.currentTarget.contains(e.relatedTarget)&&(L.current=!1,I.current&&=(I.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||L.current||(L.current=!0,I.current=e.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{A||k(!1)},onDragEnd:()=>k(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>J.createElement(WC,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:A,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:R,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:o,gap:v,expanded:O,swipeDirections:e.swipeDirections}))):null}))});function JC({className:e,...t}){let n=by(`toast`);return n?(0,Ih.createPortal)((0,$.jsx)(qC,{position:`top-right`,swipeDirections:[`right`,`top`],offset:16,gap:8,className:q(`caps-toaster`,e),...t}),n):null}var YC=(0,J.forwardRef)(function({children:e,className:t,optional:n,required:r,...i},a){return(0,$.jsxs)(`label`,{...i,className:q(`label caps-label cursor-pointer justify-start gap-sm text-sm font-semibold text-base-content`,t),ref:a,children:[e,r?(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`text-error`,children:`*`}):null,n&&!r?(0,$.jsx)(`span`,{className:`caps-label-optional`,children:`Optional`}):null]})}),XC=(0,J.forwardRef)(function({children:e,className:t,...n},r){return(0,$.jsx)(`div`,{...n,className:q(`caps-input-group join flex w-full items-stretch [&>*]:join-item [&>*:first-child]:rounded-e-none [&>*:last-child]:rounded-s-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>.btn]:shrink-0 [&>.input]:min-w-0 [&>.input]:flex-1 [&>.select]:min-w-0 [&>.select]:flex-1`,t),ref:r,children:J.Children.map(e,e=>(0,J.isValidElement)(e)?(0,J.cloneElement)(e,{className:q(`join-item caps-input-group-control`,e.props.className)}):e)})}),ZC=(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(`div`,{...t,className:q(`join-item flex items-center border border-base-300 bg-base-200 px-md text-sm text-base-content`,e),ref:n})});function QC(e){let t=e.parentElement;if(!t||e.previousElementSibling===null)return 0;let n=getComputedStyle(t);if(!(n.display.includes(`grid`)||n.display.includes(`flex`)&&n.flexDirection.startsWith(`column`)))return 0;let r=Number.parseFloat(n.rowGap);return Number.isFinite(r)?r:0}(0,J.forwardRef)(function({show:e,appear:t=!1,children:n,className:r,...i},a){let o=(0,J.useRef)(null);(0,J.useImperativeHandle)(a,()=>o.current);let s=ur(),[c,l]=(0,J.useState)(e),u=(0,J.useRef)(!0);return e&&!c&&l(!0),(0,J.useLayoutEffect)(()=>{let n=o.current,r=u.current;if(u.current=!1,!n||r&&!t)return;if(!br(n)){e||l(!1);return}let i=Wr(n),a=`translateY(${String(i.distance)}px)`,c=vr(i,i.ease),d=n.getBoundingClientRect().height,f=QC(n),p=(e,t)=>{n.style.overflow=`clip`;let r=e=>({height:`${String(e)}px`,marginBlockStart:`${String(e===0?-f:0)}px`}),a=n.animate([r(e),r(t)],{duration:i.normal,easing:c}),o=()=>{n.style.removeProperty(`overflow`)};return a.addEventListener(`finish`,o),a.addEventListener(`cancel`,o),a};if(e){let e=[n.animate([{opacity:0,transform:a},{opacity:1,transform:`none`}],{duration:i.normal,easing:c})];return!s&&d>0&&e.push(p(0,d)),()=>{for(let t of e)t.cancel()}}let m=n.animate([{opacity:1,transform:`none`},{opacity:0,transform:a}],{duration:i.fast,easing:vr(i,i.easeExit),fill:`forwards`}),h=!s&&d>0?p(d,0):m;return h!==m&&h.effect?.updateTiming({fill:`forwards`}),h.addEventListener(`finish`,()=>{l(!1)}),()=>{m.cancel(),h.cancel()}},[e,t,s]),c?(0,$.jsx)(`div`,{...i,ref:o,className:q(`caps-presence`,r),"data-present":e,"aria-hidden":!e||void 0,children:n}):null});var $C=(0,J.forwardRef)(function({open:e,children:t,className:n,...r},i){return(0,$.jsx)(`div`,{...r,ref:i,className:q(`caps-collapse`,n),"data-open":e,"aria-hidden":!e||void 0,children:(0,$.jsx)(`div`,{className:`caps-collapse-clip`,children:t})})});(0,J.forwardRef)(function({swapKey:e,anchor:t=`start`,children:n,className:r,...i},a){let o=(0,J.useRef)(null);(0,J.useImperativeHandle)(a,()=>o.current);let s=ur(),[c,l]=(0,J.useState)({key:e,content:n}),[u,d]=(0,J.useState)([]);c.key===e?c.content!==n&&l({key:e,content:n}):(d([...u.filter(t=>t.key!==e&&t.key!==c.key),c]),l({key:e,content:n}));let f=(0,J.useRef)(null);return(0,J.useLayoutEffect)(()=>{let e=o.current;if(!e||!(`ResizeObserver`in globalThis))return;f.current=e.getBoundingClientRect();let t=new ResizeObserver(()=>{e.getAnimations().length===0&&(f.current=e.getBoundingClientRect())});return t.observe(e),()=>{t.disconnect()}},[]),(0,J.useLayoutEffect)(()=>{let e=o.current;if(!e)return;let t=[...e.querySelectorAll(`:scope > [data-swap-leaving]`)],n=e.querySelector(`:scope > [data-swap-current]`);if(n===null||t.length===0)return;if(!br(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=Wr(e),c=[n.animate([{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(a.distance/2)}px)`},{opacity:1,filter:`blur(0px)`,transform:`none`}],{duration:a.normal,easing:vr(a,a.ease)})];for(let e of t){let t=e.animate([{opacity:1,filter:`blur(0px)`,transform:`none`},{opacity:0,filter:`blur(${String(a.blur)}px)`,transform:`translateY(${String(-a.distance/2)}px)`}],{duration:a.fast,easing:vr(a,a.easeExit),fill:`forwards`}),n=e.dataset.swapLeaving;t.onfinish=()=>{d(e=>e.filter(e=>e.key!==n))},c.push(t)}let l=r!==null&&(Math.abs(r.height-i.height)>.5||Math.abs(r.width-i.width)>.5);return!s&&l&&c.push(e.animate([{width:`${String(r.width)}px`,height:`${String(r.height)}px`},{width:`${String(i.width)}px`,height:`${String(i.height)}px`}],{duration:a.normal,easing:vr(a,a.ease)})),()=>{for(let e of c)e.cancel()}},[e,s]),(0,$.jsx)(`div`,{...i,ref:o,className:q(`caps-swap`,r),"data-anchor":t,children:[...u.map(e=>(0,$.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-leaving":e.key,"aria-hidden":`true`,children:e.content},e.key)),(0,$.jsx)(`div`,{className:`caps-swap-layer`,"data-swap-current":``,children:n},e)]})});function ew({children:e,...t}){let[n,r]=(0,J.useState)(e);return e&&e!==n&&r(e),(0,$.jsx)($C,{...t,className:q(`caps-field-error-reveal`,t.className),open:!!e,children:(0,$.jsx)(`div`,{className:`caps-field-error`,role:`alert`,"aria-hidden":!e,children:n})})}function tw({children:e,divider:t=!0,error:n,layout:r=`end`,status:i,...a}){return(0,$.jsxs)(`footer`,{...a,className:q(`caps-form-footer`,a.className),"data-divider":t,"data-layout":r,children:[(0,$.jsx)(ew,{children:n}),(0,$.jsxs)(`div`,{className:`caps-form-footer-row`,children:[i?(0,$.jsx)(`div`,{className:`caps-form-footer-status`,role:`status`,children:i}):null,(0,$.jsx)(`div`,{className:`caps-form-footer-actions`,children:e})]})]})}var nw=(0,J.forwardRef)(function({busy:e=!1,children:t,className:n,layout:r,...i},a){return(0,$.jsx)(`form`,{...i,"aria-busy":e||void 0,className:q(`caps-form`,n),"data-layout":r,ref:a,children:(0,$.jsx)(`fieldset`,{className:`caps-form-body`,disabled:e,children:t})})}),rw={2:`h2`,3:`h3`,4:`h4`},iw=(0,J.forwardRef)(function({children:e,className:t,description:n,layout:r,level:i=3,title:a,...o},s){let c=(0,J.useId)(),l=rw[i];return(0,$.jsxs)(`section`,{...o,"aria-labelledby":`${c}-title`,className:q(`caps-form-section`,t),"data-layout":r,ref:s,children:[(0,$.jsxs)(`header`,{className:`caps-form-section-copy`,children:[(0,$.jsx)(l,{className:`caps-form-section-title`,id:`${c}-title`,children:a}),n?(0,$.jsx)(`p`,{className:`caps-form-section-description`,children:n}):null]}),(0,$.jsx)(`div`,{className:`caps-form-section-fields`,children:e})]})}),aw=(0,J.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,layout:a,legend:o,legendTitle:s,...c},l){let u=(0,J.useId)(),d=[n?`${u}-description`:c[`aria-describedby`],r?`${u}-error`:null].filter(Boolean).join(` `)||void 0;return(0,$.jsxs)(`fieldset`,{...c,"aria-describedby":d,"aria-invalid":r?!0:c[`aria-invalid`],className:q(`caps-fieldset`,t),"data-layout":a,ref:l,children:[(0,$.jsxs)(`legend`,{className:`caps-fieldset-legend`,title:s,children:[i?(0,$.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}):null,o]}),n?(0,$.jsx)(`p`,{className:`caps-fieldset-description`,id:`${u}-description`,children:n}):null,(0,$.jsx)(`div`,{className:`caps-fieldset-fields`,children:e}),r===void 0?null:(0,$.jsx)(ew,{id:`${u}-error`,children:r})]})});function ow(e){let t=[];return J.Children.forEach(e.props.children,e=>{(0,J.isValidElement)(e)&&e.type!==ZC&&t.push(e)}),t[0]??null}var sw=(0,J.forwardRef)(function({children:e,className:t,description:n,error:r,icon:i,label:a,labelTitle:o,optional:s,orientation:c=`vertical`,readout:l=!1,required:u,...d},f){let p=(0,J.useId)(),m=(0,J.isValidElement)(e)?e:null,h=m?.type===XC,g=h?ow(m):m,_=g?.props.id??p,v=`${_}-description`,y=`${_}-error`,b=[g?.props[`aria-describedby`],n?v:null,r?y:null].filter(Boolean).join(` `)||void 0,x=u===!0||g?.props.required,S=r?!0:g?.props[`aria-invalid`],C=u===!0||g?.props[`aria-required`],w={id:_};x!==void 0&&(w.required=x),b!==void 0&&(w[`aria-describedby`]=b),S!==void 0&&(w[`aria-invalid`]=S),C!==void 0&&(w[`aria-required`]=C);let T=m&&g&&!l?h?(0,J.cloneElement)(m,void 0,J.Children.map(m.props.children,e=>e===g?(0,J.cloneElement)(g,w):e)):(0,J.cloneElement)(m,w):e,E=a?(0,$.jsx)(YC,{htmlFor:l?void 0:_,title:o,className:c===`inline`?`font-normal`:void 0,...u===void 0?{}:{required:u},...s===void 0?{}:{optional:s},children:a}):null,D=a||n?(0,$.jsxs)(`div`,{className:`caps-field-copy`,children:[E,n?(0,$.jsx)(`p`,{className:`caps-field-description`,id:v,children:n}):null]}):null,O=i?(0,$.jsxs)(`div`,{className:`caps-field-lead`,children:[(0,$.jsx)(`span`,{className:`caps-field-icon`,"aria-hidden":`true`,children:i}),D]}):D;return(0,$.jsxs)(`div`,{...d,className:q(`caps-field`,t),"data-orientation":c,ref:f,children:[c===`horizontal`?(0,$.jsxs)(`div`,{className:`caps-field-row`,children:[O,T]}):c===`inline`?(0,$.jsxs)(`div`,{className:`caps-field-row`,children:[T,O]}):(0,$.jsxs)($.Fragment,{children:[O,T]}),(0,$.jsx)(ew,{id:y,children:r})]})});function cw(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var lw=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,uw=6,dw=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),fw=(0,J.forwardRef)(function({className:e,decrementLabel:t=`Decrease`,defaultValue:n=null,disabled:r,incrementLabel:i=`Increase`,invalid:a,max:o,min:s,onBlur:c,onKeyDown:l,onValueChange:u,step:d=1,unit:f,value:p,wrap:m=!1,...h},g){let[_,v]=(0,J.useState)(n),[y,b]=(0,J.useState)(null),x=p===void 0?_:p,S=cw(d),C=e=>{let t=Number(e.toFixed(S));return s!==void 0&&t<s?s:o!==void 0&&t>o?o:t},w=e=>{let t=e===null?null:C(e);v(t),b(null),t!==x&&u?.(t)},T=()=>{if(y===null)return;let e=Number(y);w(y.trim()===``||!Number.isFinite(e)?null:e)},E=e=>{let t=(x??s??0)+e*d;if(m&&s!==void 0&&o!==void 0){if(t>o){w(s);return}if(t<s){w(o);return}}w(t)},D=s!==void 0&&x!==null&&x<=s,O=o!==void 0&&x!==null&&x>=o,k=r===!0,A=(0,J.useRef)(null),j=s!==void 0&&o!==void 0&&o>s?((x??s)-s)/(o-s):null,M=e=>{k||(e.currentTarget.setPointerCapture(e.pointerId),A.current={y:e.clientY,value:x??s??0})},N=e=>{if(!A.current)return;let t=Math.trunc((A.current.y-e.clientY)/uw),n=C(A.current.value+t*d);n!==x&&w(n)},P=()=>{A.current=null};return(0,$.jsxs)(`span`,{className:q(`caps-number-field`,e),"data-at-max":O||void 0,"data-at-min":D||void 0,"data-disabled":k||void 0,"data-wrap":m||void 0,children:[j===null?null:(0,$.jsxs)(`svg`,{className:`caps-number-field-dial`,viewBox:`0 0 48 48`,"aria-hidden":`true`,focusable:`false`,onPointerDown:M,onPointerMove:N,onPointerUp:P,onPointerCancel:P,children:[(0,$.jsx)(`path`,{className:`caps-number-field-dial-track`,d:lw,pathLength:100}),(0,$.jsx)(`path`,{className:`caps-number-field-dial-level`,d:lw,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,$.jsx)(Nr,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-decrement`,"aria-label":t,"aria-controls":h.id,tabIndex:-1,disabled:k||D&&!m,onClick:()=>{E(-1)},children:(0,$.jsx)(tx,{"aria-hidden":`true`})}),(0,$.jsxs)(`span`,{className:`caps-number-field-readout`,children:[(0,$.jsx)(`input`,{...h,"aria-invalid":a?!0:h[`aria-invalid`]===!1?void 0:h[`aria-invalid`],className:`input caps-input caps-number-field-input`,disabled:r,inputMode:h.inputMode??(S>0?`decimal`:`numeric`),max:o,min:s,onBlur:e=>{T(),c?.(e)},onChange:e=>{b(e.target.value)},onKeyDown:e=>{if(l?.(e),e.defaultPrevented)return;let t=dw.get(e.key);t===void 0?e.key===`Home`&&s!==void 0?(e.preventDefault(),w(s)):e.key===`End`&&o!==void 0?(e.preventDefault(),w(o)):e.key===`Enter`&&T():(e.preventDefault(),E(t))},ref:g,step:d,type:`number`,value:y??(x===null?``:String(x))}),f?(0,$.jsx)(`span`,{className:`caps-number-field-unit`,"aria-hidden":`true`,children:f}):null]}),(0,$.jsx)(Nr,{type:`button`,variant:`outline`,size:`icon`,className:`caps-number-field-increment`,"aria-label":i,"aria-controls":h.id,tabIndex:-1,disabled:k||O&&!m,onClick:()=>{E(1)},children:(0,$.jsx)(nx,{"aria-hidden":`true`})})]})}),pw=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,$.jsxs)(`span`,{className:`caps-select-shell`,children:[(0,$.jsx)(`select`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:q(`select select-bordered caps-select w-full`,t&&`select-error`,e),ref:r}),!n.multiple&&(!n.size||n.size<=1)?(0,$.jsx)(Kb,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})}),mw={2:`h2`,3:`h3`,4:`h4`};function hw(e,t){let{reduced:n}=t,r=e&&!n,i=or(t,600),[a,o]=(0,J.useState)(r);return(0,J.useEffect)(()=>{if(o(r),!r)return;let e=globalThis.setTimeout(()=>{o(!1)},i);return()=>{globalThis.clearTimeout(e)}},[r,i]),a}var gw=(0,J.forwardRef)(function({actions:e,className:t,description:n,headingLevel:r=2,suggestions:i,thinking:a=!1,title:o,visual:s,renderVisual:c,variant:l=`plain`,...u},d){let f=(0,J.useId)(),p=(0,J.useRef)(null),m=Xr(p),h=hw(l===`speech`,m)&&!a,g=mw[r],_=c?c({speaking:h,thinking:a}):s,v=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{ref:p,className:`empty-state-title`,id:u[`aria-labelledby`]?void 0:f,children:o}),(0,$.jsx)(`p`,{children:n}),i&&i.length>0?(0,$.jsx)(`ul`,{"aria-label":`Try one of these`,className:`empty-state-suggestions`,children:i.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Nr,{size:`sm`,variant:`outline`,onClick:e.onSelect,children:e.label})},e.label))}):null,e?(0,$.jsx)(`div`,{className:`empty-state-actions`,children:e}):null]});return(0,$.jsxs)(`section`,{...u,"aria-labelledby":u[`aria-labelledby`]??f,className:q(`empty-state`,l!==`plain`&&`empty-state-${l}`,t),ref:d,children:[_?(0,$.jsx)(`div`,{"aria-hidden":`true`,className:`empty-state-visual`,children:_}):null,l===`speech`?(0,$.jsx)(`div`,{className:`empty-state-bubble`,children:v}):v]})});function _w(e,t){return{kind:`button`,id:`folder`,text:t.checking?`Checking…`:`prints`,icon:`folder`,title:e===null?`Choose where Prints saves images`:it(`Save prints to ${e}`,1024),opens:`dialog`,expanded:t.editing}}function vw(e,t=/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)){return e.startsWith(`<leader>`)?`Ctrl K ${e.slice(8)}`:e.split(` `).map(e=>e.split(`+`).map(e=>e===`mod`?t?`⌘`:`Ctrl`:e===`escape`?`Esc`:e.length===1?e.toUpperCase():e.charAt(0).toUpperCase()+e.slice(1)).join(e===`ctrl+k`||e===`mod+k`?` `:`+`)).join(` `)}function yw(e){let t=new Map;for(let n of e.bindings)t.set(n.commandId,[...t.get(n.commandId)??[],vw(n.binding)]);return e.slash.map(e=>({alias:e.alias,commandId:e.commandId,command:e.command,title:e.title,description:e.description,category:e.category,order:e.order,grammar:e.arguments,consumesDraft:e.consumesDraft,keys:t.get(e.commandId)??[],availability:e.availability}))}function bw(e,t){let n=e.toLocaleLowerCase(),r=t.toLocaleLowerCase();if(r.length===0)return{tier:0,spread:0,indices:[]};let i=e=>Array.from({length:r.length},(t,n)=>e+n);if(n.startsWith(r))return{tier:0,spread:n.length-r.length,indices:i(0)};let a=n.search(RegExp(`[-_\\s]${r.replaceAll(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}`,`u`));if(a>=0)return{tier:1,spread:a,indices:i(a+1)};let o=n.indexOf(r);if(o>=0)return{tier:2,spread:o,indices:i(o)};let s=[],c=0;for(let e of r){let t=n.indexOf(e,c);if(t<0)return;s.push(t),c=t+1}let l=s[0]??0;return{tier:3,spread:(s.at(-1)??0)-l-r.length+1,indices:s}}function xw(e,t,n,r){return e.map(e=>({entry:e,match:bw(t(e),n)})).filter(e=>e.match!==void 0).sort((e,n)=>e.match.tier-n.match.tier||e.match.spread-n.match.spread||r(e.entry)-r(n.entry)||t(e.entry).localeCompare(t(n.entry))).map(({entry:e,match:t})=>({entry:e,indices:t.indices}))}var Sw=[`help`,`login`,`model`];function Cw(e,t,n={}){if(!t.startsWith(`/`)||t.includes(`
|
|
10
|
+
`))return{kind:`none`};let r=t.search(/\s/u);if(r<0){let r=t.slice(1);return{kind:`commands`,query:r,items:xw(e.filter(e=>e.availability.status===`available`&&(r.length===0?e.category===(n.idleCategory??`Conversation`)||Sw.includes(e.alias):e.category!==`Advanced`||e.alias.toLocaleLowerCase().startsWith(r.toLocaleLowerCase()))),e=>e.alias,r,e=>{let t=Sw.indexOf(e.alias);return r.length===0&&t>=0?t-Sw.length:e.order}).map(({entry:e,indices:t})=>({command:e,label:`/${e.alias}`,matches:t.map(e=>e+1),insert:e.grammar===void 0?`/${e.alias}`:`/${e.alias} `}))}}let i=t.slice(1,r),a=e.find(e=>e.alias===i);if(a?.grammar===void 0||a.availability.status!==`available`)return{kind:`none`};let o=t.slice(r).trimStart(),s=(o.includes(` `)?[]:a.grammar.words??[]).filter(e=>e.word.toLocaleLowerCase().startsWith(o.toLocaleLowerCase())).map(e=>({word:e,label:e.word,matches:Array.from({length:o.length},(e,t)=>t),insert:`/${i} ${e.word}`}));return{kind:`arguments`,command:a,query:o,hint:`/${i} ${a.grammar.hint}`,items:s}}var ww=gu({keyCode:vu(229)});function Tw(e){return e.nativeEvent.isComposing||tn(ww,e.nativeEvent).success}function Ew(e,t){return e.animate(t.reduced?[{opacity:1},{opacity:0}]:[{opacity:1,transform:`none`},{opacity:0,transform:`translateY(-120%)`}],{duration:t.reduced?t.fast:t.normal,easing:vr(t,t.easeExit),fill:`backwards`})}function Dw(e,t){let n=-12*Math.min(1.5,t.bounce/.3);return e.animate(t.reduced?[{opacity:0},{opacity:1}]:[{opacity:0,transform:`translateY(70%)`},{opacity:1,transform:`translateY(${String(n)}%)`,offset:.6},{opacity:1,transform:`none`}],{duration:t.reduced?t.fast:t.springDuration,easing:vr(t,t.ease),fill:`backwards`})}function Ow(e,t,n){return e.animate([{opacity:1-n},{opacity:n}],{duration:t.reduced?t.fast:t.normal,delay:n===1&&!t.reduced?t.fast/2:0,easing:vr(t,t.ease),fill:`backwards`})}function kw(e,t){let n=1+.05*Math.min(1.5,.4+t.bounce/.3);return e.animate([{transform:`scale(1)`},{transform:`scale(${String(n)})`,offset:.4},{transform:`scale(1)`}],{duration:t.springDuration,easing:vr(t,`ease-out`)})}var Aw=(0,J.forwardRef)(function({state:e,onStop:t,stopLabel:n=`Stop`,iconSize:r=20,onClick:i,disabled:a,className:o,tone:s=`primary`,"aria-label":c,...l},u){let d=(0,J.useRef)(null);(0,J.useImperativeHandle)(u,()=>d.current);let f=(0,J.useRef)(e);(0,J.useLayoutEffect)(()=>{let t=d.current,n=f.current;if(f.current=e,!t||n===e||!br(t))return;let r=t.querySelector(`[data-glyph="arrow"]`),i=t.querySelector(`[data-glyph="busy"]`);if(!r||!i)return;let a=Wr(t),o=[];return e===`busy`?o.push(Ew(r,a),Ow(i,a,1)):n===`busy`&&o.push(Ow(i,a,0),Dw(r,a)),n===`empty`&&e===`ready`&&!a.reduced&&o.push(kw(t,a)),()=>{for(let e of o)e.cancel()}},[e]);let p=e===`busy`,m=p&&t!==void 0;return(0,$.jsx)(yt,{...l,ref:d,className:q(`caps-send-action`,o),tone:s,"aria-busy":p?!0:void 0,"aria-label":m?n:c,"data-send-state":e,disabled:a===!0||e===`empty`||p&&!m,onClick:m?t:i,label:null,icon:(0,$.jsxs)(`span`,{className:`caps-send-glyph`,"data-state":e,children:[(0,$.jsx)(`span`,{"data-glyph":`arrow`,children:(0,$.jsx)(Gb,{"aria-hidden":`true`,size:r})}),(0,$.jsx)(`span`,{"data-glyph":`busy`,children:t===void 0?(0,$.jsx)(zr,{decorative:!0,size:`sm`}):(0,$.jsx)(ix,{"aria-hidden":`true`,fill:`currentColor`,size:Math.round(r*.7)})})]})})}),jw=(0,J.forwardRef)(function({className:e,label:t,...n},r){return(0,$.jsx)(yt,{...n,ref:r,className:q(`parakeet-composer-model-key`,e),label:t,readout:(0,$.jsx)(Kb,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),Mw=(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(`div`,{...t,ref:n,className:q(`caps-popover-anchor`,e)})}),Nw=(0,J.forwardRef)(function({className:e,open:t,side:n=`top`,...r},i){return t?(0,$.jsx)(`div`,{...r,ref:i,className:q(`caps-popover`,e),"data-side":n}):null}),Pw=(0,J.forwardRef)(function({active:e,className:t,onMouseDown:n,...r},i){return(0,$.jsx)(`div`,{role:`option`,"aria-selected":e,...r,ref:i,className:q(`caps-popover-option`,t),"data-active":e,onMouseDown:e=>{e.preventDefault(),n?.(e)}})});function Fw({items:e,openId:t,onOpenChange:n,leading:r,trailing:i,renderTrigger:a,placement:o=`housing`,align:s=`end`,hostInset:c,className:l,...u}){let d=(0,J.useId)(),f=(0,J.useRef)(null),p=(0,J.useRef)(null),m=(0,J.useRef)(new Map),h=e.find(e=>e.id===t&&!e.disabled),g=h?.id,_=()=>{g&&m.current.get(g)?.focus(),n(null)};return(0,J.useEffect)(()=>{g&&p.current?.focus()},[g]),(0,J.useEffect)(()=>{c===void 0?f.current?.style.removeProperty(`--caps-status-tray-host-inset`):f.current?.style.setProperty(`--caps-status-tray-host-inset`,`${String(Math.max(0,c))}px`)},[c]),(0,J.useEffect)(()=>{if(!g)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),m.current.get(g)?.focus(),n(null))},t=e=>{e.target instanceof Node&&!f.current?.contains(e.target)&&n(null)};return document.addEventListener(`keydown`,e),document.addEventListener(`pointerdown`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`pointerdown`,t)}},[g,n]),(0,$.jsxs)(Mw,{...u,ref:f,className:q(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,$.jsxs)(Nw,{open:!0,ref:p,tabIndex:-1,side:`top`,id:`${d}-${h.id}`,role:`dialog`,"aria-labelledby":`${d}-title`,className:`caps-status-tray-panel`,"data-status-tray-panel":h.id,children:[(0,$.jsxs)(`div`,{className:`caps-status-tray-head`,children:[h.tone?(0,$.jsx)(Hb,{size:`compact`,tone:h.tone,glyph:h.glyph??`dot`}):null,(0,$.jsx)(`span`,{id:`${d}-title`,className:`caps-status-tray-title`,children:h.title??h.label}),h.actions,(0,$.jsx)(cr,{"aria-label":`Close tray`,icon:(0,$.jsx)(mn,{"aria-hidden":`true`}),onClick:_})]}),(0,$.jsx)(`div`,{className:`caps-status-tray-body`,children:h.content})]}):null,o===`host`?null:(0,$.jsxs)(`div`,{className:`caps-status-tray-row`,children:[r,(0,$.jsx)(`div`,{className:`caps-status-tray-chips`,children:e.map(e=>{let r={ref:t=>{t?m.current.set(e.id,t):m.current.delete(e.id)},type:`button`,className:a?void 0:`caps-status-tray-chip`,"aria-expanded":g===e.id,"aria-controls":g===e.id?`${d}-${e.id}`:void 0,"aria-label":e.accessibleLabel,disabled:e.disabled,title:e.disabled?e.accessibleLabel:void 0,"aria-haspopup":`dialog`,"data-status-tray-chip":e.id,onClick:()=>{n(t===e.id?null:e.id)},children:(0,$.jsxs)($.Fragment,{children:[e.tone?(0,$.jsx)(Hb,{size:`compact`,glyph:e.glyph??`dot`,motion:e.motion??`none`,tone:e.tone}):null,(0,$.jsx)(`span`,{className:`caps-status-tray-label`,children:e.label}),e.count!==void 0&&e.count>0?(0,$.jsx)(`span`,{className:`caps-status-tray-count`,children:e.count}):null]})};return(0,$.jsxs)(J.Fragment,{children:[a?a(r):(0,$.jsx)(`button`,{...r}),e.after]},e.id)})}),i]})]})}function Iw({children:e,className:t,...n}){return(0,$.jsx)(`div`,{...n,className:q(`caps-status-tray-list`,t),children:e})}function Lw({icon:e,primary:t,secondary:n,actions:r,className:i,...a}){return(0,$.jsxs)(`div`,{...a,className:q(`caps-status-tray-item`,i),children:[e?(0,$.jsx)(`span`,{className:`caps-status-tray-icon`,children:e}):null,(0,$.jsxs)(`span`,{className:`caps-status-tray-text`,children:[(0,$.jsx)(`span`,{className:`caps-status-tray-primary`,children:t}),n?(0,$.jsx)(`span`,{className:`caps-status-tray-secondary`,children:n}):null]}),r?(0,$.jsx)(`span`,{className:`caps-status-tray-actions`,children:r}):null]})}function Rw({children:e=`All caught up.`,title:t}){return(0,$.jsxs)(`div`,{className:`caps-status-tray-note`,children:[t?(0,$.jsx)(`strong`,{className:`caps-status-tray-note-title`,children:t}):null,(0,$.jsx)(`p`,{children:e})]})}var zw=(0,J.forwardRef)(function({className:e,invalid:t,...n},r){return(0,$.jsx)(`textarea`,{...n,"aria-invalid":t?!0:n[`aria-invalid`]===!1?void 0:n[`aria-invalid`],className:q(`textarea textarea-bordered w-full`,t&&`textarea-error`,e),ref:r})});function Bw(e,t){return`${e}-${String(t)}`}function Vw(e){switch(e.key){case`ArrowDown`:return`next`;case`ArrowUp`:return`previous`;case`Enter`:return e.shiftKey?null:`accept`;case`Tab`:return`accept`;case`Escape`:return`dismiss`;default:return null}}function Hw(e){return{role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":e.open,"aria-controls":e.open?e.listId:void 0,"aria-activedescendant":e.open?Bw(e.listId,e.selected):void 0}}function Uw({open:e,rows:t,selected:n,listId:r,label:i,kind:a,hint:o,empty:s,onHighlight:c,onChoose:l}){return(0,$.jsx)(Nw,{open:e,side:`top`,"data-parakeet-slash":``,children:(0,$.jsxs)(`div`,{className:`parakeet-slash-menu`,"data-kind":a,children:[o===void 0?null:(0,$.jsx)(`p`,{className:`parakeet-slash-hint`,children:o}),t.length===0?s===void 0?null:(0,$.jsx)(`p`,{className:`parakeet-slash-hint`,children:s}):(0,$.jsx)(`div`,{id:r,role:`listbox`,"aria-label":i,children:t.map((e,t)=>(0,$.jsxs)(Pw,{id:Bw(r,t),active:t===n,"aria-disabled":e.disabled===!0||void 0,"data-disabled":e.disabled===!0,onMouseEnter:()=>{c(t)},onClick:()=>{l(t)},children:[e.media===void 0?null:(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`parakeet-slash-media`,children:e.media}),(0,$.jsx)(`span`,{className:`parakeet-slash-label`,children:e.label}),(0,$.jsx)(`span`,{className:`parakeet-slash-detail`,children:e.detail}),e.keys===void 0||e.keys.length===0?null:(0,$.jsx)(`kbd`,{className:`parakeet-slash-keys`,children:e.keys})]},e.key))})]})})}var Ww={unchecked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,checked:`M3.25 5.9 L5.1 7.9 L8.8 3.8`,mixed:`M3.4 6 L6 6 L8.6 6`},Gw={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function Kw({state:e}){let t=`caps-checkbox-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(e).current,i=(0,J.useRef)(e),a=ur();return(0,J.useLayoutEffect)(()=>{if(!n.current)return;let t=e!==`unchecked`,r=i.current!==`unchecked`,o=a||i.current===e;i.current=e;let s=Wr(n.current),c=Lr(s,{ease:`inCubic`,duration:160}),l=$r(n.current,{d:{to:Ww[e],...o?jr:Lr(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?jr:t?Lr(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...Lr(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:or(s,120),...Sr(s,{bounce:.35,duration:220})}]:{to:t?2.4:0,...c}});return()=>{l.cancel()}},[e,a]),(0,$.jsxs)(`svg`,{className:`caps-checkbox-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsx)(gr,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,$.jsx)(pr,{id:`${t}-shadow`}),(0,$.jsx)(Hr,{id:`${t}-inset`}),(0,$.jsx)(Dr,{id:`${t}-goo`,values:Gw}),(0,$.jsxs)(`filter`,{id:`${t}-relief`,x:`-25%`,y:`-25%`,width:`150%`,height:`150%`,colorInterpolationFilters:`sRGB`,children:[(0,$.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`0.28`,result:`relief`}),(0,$.jsx)(`feSpecularLighting`,{in:`relief`,surfaceScale:`1.2`,specularConstant:`0.55`,specularExponent:`18`,lightingColor:`color-mix(in srgb, var(--color-white) calc(var(--depth) * 100%), var(--color-black))`,result:`light`,children:(0,$.jsx)(`feDistantLight`,{azimuth:`225`,elevation:`55`})}),(0,$.jsx)(`feComposite`,{in:`light`,in2:`SourceAlpha`,operator:`in`,result:`clipped-light`}),(0,$.jsx)(`feBlend`,{in:`SourceGraphic`,in2:`clipped-light`,mode:`screen`})]}),(0,$.jsx)(`mask`,{id:`${t}-contour`,maskUnits:`userSpaceOnUse`,x:`0`,y:`0`,width:`12`,height:`12`,style:{maskType:`alpha`},children:(0,$.jsx)(`path`,{ref:n,d:Ww[r],fill:`none`,stroke:`var(--color-white)`,strokeWidth:r===`unchecked`?0:2.4,pathLength:`1`,strokeDasharray:`1`,strokeDashoffset:+(r===`unchecked`),strokeLinecap:`round`,strokeLinejoin:`round`,filter:e===`mixed`?void 0:`url(#${t}-goo)`})}),(0,$.jsx)(`clipPath`,{id:`${t}-well`,children:(0,$.jsx)(`rect`,{x:`1`,y:`1`,width:`10`,height:`10`,rx:`2.5`})})]}),(0,$.jsx)(`rect`,{className:`caps-checkbox-track`,x:`0.5`,y:`0.5`,width:`11`,height:`11`,rx:`3`,filter:`url(#${t}-inset)`}),(0,$.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,$.jsx)(`g`,{filter:`url(#${t}-shadow)`,children:(0,$.jsx)(`g`,{filter:`url(#${t}-relief)`,children:(0,$.jsx)(`g`,{mask:`url(#${t}-contour)`,children:(0,$.jsx)(`rect`,{x:`0`,y:`0`,width:`12`,height:`12`,fill:`url(#${t}-surface)`})})})})})]})}var qw=(0,J.forwardRef)(function({className:e,appearance:t,indicator:n,invalid:r,indeterminate:i=!1,checked:a,defaultChecked:o=!1,onChange:s,...c},l){let u=(0,J.useRef)(null),[d,f]=(0,J.useState)(o),p=a??d,m=i?`mixed`:p?`checked`:`unchecked`;return(0,J.useImperativeHandle)(l,()=>{if(!u.current)throw Error(`Checkbox input is not mounted`);return u.current},[]),(0,J.useLayoutEffect)(()=>{u.current&&(u.current.indeterminate=i)},[i]),(0,J.useEffect)(()=>{let e=u.current?.form;if(!e||a!==void 0)return;let t=e=>{queueMicrotask(()=>{!e.defaultPrevented&&u.current&&f(o)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[a,o,c.form]),(0,$.jsxs)(`span`,{className:`caps-checkbox`,"data-appearance":t===`compact`?t:void 0,"data-state":m,"data-custom-indicator":n!==void 0||void 0,children:[(0,$.jsx)(`input`,{...c,checked:p,"aria-checked":i?`mixed`:p,"aria-invalid":r?!0:c[`aria-invalid`]===!1?void 0:c[`aria-invalid`],className:q(`caps-checkbox-input`,e),onChange:e=>{a===void 0&&f(e.target.checked),s?.(e),e.currentTarget.indeterminate=i},ref:u,type:`checkbox`}),n===void 0?(0,$.jsx)(Kw,{state:m}):n]})}),Jw=`data-glide-stand-in`;function Yw(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left+e.scrollLeft-e.clientLeft,y:r.top-n.top+e.scrollTop-e.clientTop,width:r.width,height:r.height}}function Xw(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function Zw(e){let t=(0,J.useRef)(null);return(0,J.useCallback)(n=>{t.current?.(),t.current=n?Qw(n,e):null},[e])}function Qw(e,t){if(!br(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?Yw(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(Jw);s.clear(),a&&(a.hidden=!0),o=null},l=()=>{if(a)return a;let t=n.createElement(`span`);return t.className=`caps-glide`,t.setAttribute(`aria-hidden`,`true`),e.prepend(t),e.classList.add(`caps-glide-host`),getComputedStyle(e).position===`static`&&e.classList.add(`caps-glide-anchor`),a=t,t},u=(t,n)=>{let r=Wr(e),u=Yw(e,t),d=o&&a?Yw(e,a):i;if(i=u,o?.cancel(),c(),r.reduced||d===null||Math.abs(d.y-u.y)<1&&Math.abs(d.x-u.x)<1)return;t.setAttribute(Jw,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(Jw,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([Xw(d),Xw(u)],{duration:r.normal,easing:vr(r,r.ease),fill:`forwards`});o=g,g.addEventListener(`finish`,()=>{o===g&&c()})},d=()=>{let n=e.querySelector(t);if(n===r)return;let i=r;r=n,n&&u(n,i)},f=new MutationObserver(d);return f.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`,`data-active`,`data-navigation`,`aria-selected`]}),e.addEventListener(`pointerover`,d),e.addEventListener(`pointerout`,d),()=>{f.disconnect(),e.removeEventListener(`pointerover`,d),e.removeEventListener(`pointerout`,d),o?.cancel(),c(),a?.remove()}}function $w({getKey:e,isDisabled:t=()=>!1,items:n}){let r=(0,J.useMemo)(()=>{let r=n.map(e);if(r.some(e=>!e))throw Error(`Selectable items require non-empty keys`);if(new Set(r).size!==r.length)throw Error(`Selectable items require unique keys`);return n.filter(e=>!t(e))},[e,t,n]),[i,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{i!==null&&!r.some(t=>e(t)===i)&&a(null)},[i,r,e]);let o=r.find(t=>e(t)===i),s=o?r.findIndex(t=>e(t)===i):-1;return{activeIndex:s,activeItem:o,activeKey:i,enabledItems:r,move:(t,n)=>{if(r.length===0)return;let i=n?n===`start`?0:r.length-1:s<0?t>0?0:r.length-1:(s+t+r.length)%r.length,o=r[i];o&&a(e(o))},setActiveKey:a}}function eT({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=J.useRef(e!==void 0),[a,o]=J.useState(()=>t);return[i&&e!==void 0?e:a,J.useCallback(e=>{i||o(e)},[])]}var tT=Yn(`card caps-card`,{variants:{variant:{surface:`caps-card-surface`,outline:`caps-card-outline`,interactive:`caps-card-interactive`,game:`caps-card-game caps-card-interactive`,fit:`caps-card-fit`},density:{regular:``,compact:`caps-card-compact`}},defaultVariants:{variant:`surface`,density:`regular`}}),nT=(0,J.forwardRef)(function({className:e,density:t,featured:n=!1,state:r,variant:i,...a},o){return(0,$.jsx)(`div`,{...a,className:q(tT({density:t,variant:i}),n&&`caps-card-featured`,e),"data-state":r,ref:o})});(0,J.forwardRef)(function({className:e,density:t,variant:n,width:r=`default`,...i},a){return(0,$.jsx)(`main`,{className:`caps-centered-card-stage`,children:(0,$.jsx)(nT,{...i,className:q(`caps-centered-card`,r===`wide`&&`caps-centered-card-wide`,e),ref:a,variant:n??`surface`,...t?{density:t}:{}})})}),(0,J.forwardRef)(function({alignment:e=`start`,className:t,...n},r){return(0,$.jsx)(`div`,{...n,className:q(`caps-card-header`,e===`center`&&`caps-card-header-centered`,t),ref:r})}),(0,J.forwardRef)(function({className:e,level:t=3,...n},r){return(0,$.jsx)(t===2?`h2`:`h3`,{...n,className:q(`caps-card-title`,e),ref:r})}),(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(`p`,{...t,className:q(`caps-card-description`,e),ref:n})}),(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(`div`,{...t,className:q(`caps-card-content`,e),ref:n})}),(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(`div`,{...t,className:q(`caps-card-footer`,e),ref:n})});var rT=(0,J.forwardRef)(function({action:e,attachments:t,className:n,input:r,toolbar:i,...a},o){return(0,$.jsxs)(`div`,{...a,ref:o,className:q(`caps-composer`,n),children:[t===void 0?null:(0,$.jsx)(`div`,{className:`caps-composer-attachments`,children:t}),(0,$.jsx)(`div`,{className:`caps-composer-input`,children:r}),i===void 0&&e===void 0?null:(0,$.jsxs)(`div`,{className:`caps-composer-bar`,children:[(0,$.jsx)(`div`,{className:`caps-composer-toolbar`,children:i}),e]})]})});function iT({draft:e,hasAttachments:t=!1,busy:n,queueWhileBusy:r=!1,blocked:i=!1}){let a=!i&&(e.trim().length>0||t);return n&&(!r||!a)?`busy`:a?`ready`:`empty`}function aT({attachments:e,action:t,children:n,className:r,input:i,menu:a,row:o,...s}){return(0,$.jsxs)(Mw,{className:`parakeet-composer-anchor`,children:[a,(0,$.jsxs)(nT,{...s,className:q(`parakeet-composer-shell`,r),children:[(0,$.jsx)(rT,{action:t,attachments:e,input:i,toolbar:o===void 0?void 0:(0,$.jsx)(Fw,{className:`parakeet-composer-row`,align:`start`,items:o.items,openId:o.openId,onOpenChange:o.onOpenChange,renderTrigger:({children:e,...t})=>(0,$.jsx)(yt,{...t,label:e,expanded:t[`aria-expanded`]===!0}),leading:o.controls,trailing:(0,$.jsxs)(`span`,{className:`parakeet-composer-trailing`,children:[o.status,o.readout==null?null:(0,$.jsx)(`span`,{className:`parakeet-composer-readout`,children:o.readout}),(0,$.jsx)(`span`,{className:`parakeet-composer-action`,children:o.action})]})})}),n]})]})}function oT(e,t){(0,J.useLayoutEffect)(()=>{let t=e.current;t&&(t.style.height=`auto`,t.style.height=`${String(t.scrollHeight)}px`)},[e,t])}var sT=J.createContext(void 0);function cT(e){let t=J.useContext(sT);if(t===void 0&&!e)throw Error(Uu(33));return t}var lT=J.createContext(void 0);function uT(e){let t=J.useContext(lT);if(t===void 0&&!e)throw Error(Uu(36));return t}var dT=J.createContext(void 0);function fT(e=!0){let t=J.useContext(dT);if(t===void 0&&!e)throw Error(Uu(25));return t}var pT=J.createContext(null);function mT(e=`root`){let t=J.useContext(pT),n=J.useContext(lT);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var hT={visible:!0,ref:null};function gT(){return hT}function _T(e,t,n=`root`){let r=mT(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??gT)({label:e.label,children:e.children,render:e.render}),a=Ju(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}var vT=J.createContext(void 0);function yT(){let e=J.useContext(vT);if(e===void 0)throw Error(Uu(30));return e}function bT(e){e.preventDefault()}function xT(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=uT(),u=fT(!0),d=c.type===`submenu-trigger`,f=d?l.parentVirtualFocus:l.virtualFocus,p=(d&&l.parent.type===`menu`?l.parent.store:l.store).useState(`webkitAriaSelected`,n),{events:m}=a.useState(`floatingTreeRoot`),h=a.useState(`open`),g=u!==void 0,_=!f&&h&&n?0:-1;return J.useMemo(()=>({id:r,role:`menuitem`,tabIndex:_,"aria-selected":p,onMouseDown:f?bT:void 0,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&m.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&m.emit(`close`,{domEvent:e.nativeEvent,reason:Uf})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,g&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||g&&!bp&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&Mf(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var ST={type:`regular-item`};function CT(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=J.useRef(null),{getButtonProps:d,buttonRef:f}=Nf({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=xT({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=J.useCallback(e=>dd(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=Ju(u,f);return J.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var wT=J.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function TT(){return J.useContext(wT)}function ET(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=TT(),u=J.useRef(-1),[d,f]=J.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=J.useRef(null),h=J.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Z(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var DT=`data-checked`,OT=`data-unchecked`,kT={checked(e){return e?{[DT]:``}:{[OT]:``}},...Fd},AT=J.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l=!1,onCheckedChange:u,style:d,...f}=e,{store:p}=uT(),m=ET({guess:!0,label:a}),h=ap(i),g=p.useState(`disabled`),_=p.useState(`isActive`,m.index),v=p.useState(`floatingNodeId`),y=p.useState(`itemProps`),b=s||g,{getItemProps:x,itemRef:S}=CT({closeOnClick:c,disabled:b,highlighted:_,id:h,store:p,nativeButton:o,nodeId:v,itemMetadata:ST}),C=J.useMemo(()=>({disabled:b,highlighted:_,checked:l}),[b,_,l]);function w(e){let t=If(Uf,e.nativeEvent,void 0,{preventUnmountOnClose:id});u?.(!l,t)}let T=wd(`div`,e,{state:C,stateAttributesMapping:kT,props:[y,{role:`menuitemcheckbox`,"aria-checked":l,onClick:w},f,x],ref:[S,t,m.ref]});return(0,$.jsx)(vT.Provider,{value:C,children:T})}),jT=J.forwardRef(function(e,t){let{checked:n,defaultChecked:r,onCheckedChange:i,...a}=e,[o,s]=eT({controlled:n,default:r??!1,name:`MenuCheckboxItem`,state:`checked`}),c=_T(e,t);function l(e,t){i?.(e,t),t.isCanceled||s(e)}return c.visible?(0,$.jsx)(AT,{...a,checked:o,onCheckedChange:l,ref:c.ref}):null}),MT=J.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=yT(),c=J.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=fg(s.checked);return _g({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),wd(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:kT,props:{"aria-hidden":!0,...o},enabled:a||u})}),NT=J.createContext(void 0);function PT(){let e=J.useContext(NT);if(e===void 0)throw Error(Uu(31));return e}var FT=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=ap(a),c=PT();return Z(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),wd(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),IT=J.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,{store:d}=uT(),f=ET({guess:!0,label:a}),p=ap(i),m=d.useState(`disabled`),h=d.useState(`isActive`,f.index),g=d.useState(`floatingNodeId`),_=d.useState(`itemProps`),v=s||m,{getItemProps:y,itemRef:b}=CT({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:ST});return wd(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),LT=J.forwardRef(function(e,t){let n=_T(e,t);return n.visible?(0,$.jsx)(IT,{...e,ref:n.ref}):null}),RT=J.createContext(void 0);function zT(e){let t=J.useContext(RT);if(t===void 0&&!e)throw Error(Uu(69));return t}function BT(e){return e===`starting`?jh:od}var VT=J.createContext(void 0);function HT(){return J.useContext(VT)}function UT(e,t){let n=Od(e.render);if(J.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function WT(e,t,n){let r=UT(e,t),i=r===t?void 0:r;return[r,J.useCallback(e=>n?.(e?i:void 0),[i,n])]}function GT(e,t,n){let r=Od(e.render),i=J.isValidElement(r)?r.props:void 0,a=e[`aria-label`]??i?.[`aria-label`],o=e[`aria-labelledby`]??i?.[`aria-labelledby`];return o==null&&!a&&(o=t?t.id||void 0:n||void 0),o}var KT=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,id:o,initialFocus:s,...c}=e,{store:l,defaultFloatingId:u,setRenderedFloatingId:d,virtualFocus:f,orientation:p}=uT(),m=HT(),{side:h,align:g}=cT(),_=zT(!0)!=null,v=l.useState(`open`),y=l.useState(`transitionStatus`),b=l.useState(`popupProps`),x=l.useState(`mounted`),S=l.useState(`instantType`),C=l.useState(`activeTriggerElement`),w=l.useState(`parent`),T=l.useState(`lastOpenChangeReason`),E=l.useState(`rootId`),D=l.useState(`floatingRootContext`),O=l.useState(`floatingTreeRoot`),k=l.useState(`closeDelay`),A=l.useState(`hoverEnabled`),j=l.useState(`disabled`),M=l.useState(`openMethod`),N=l.useState(`activeTriggerId`),P=l.useState(`listElement`),[F,I]=WT(e,u,d),L=GT(e,C,N),R=w.type===`menu`?m:void 0,z=w.type===`context-menu`,B=s??w.type!==`menu`;s===void 0&&P&&w.type!==`menu`&&(B=()=>l.state.activeIndex===null&&P),_g({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}}),J.useEffect(()=>{function e(e){l.setOpen(!1,If(e.reason,e.domEvent))}return O.events.on(`close`,e),()=>{O.events.off(`close`,e)}},[O.events,l]),g_(D,{enabled:A&&!j&&!z&&w.type!==`menubar`,closeDelay:k});let V=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:H,handleFocus:ee}=(J.useContext(pT)?.useParentHandoff??JT)(l,w,v,f),te=wd(`div`,e,{state:{transitionStatus:y,side:h,align:g,open:v,nested:w.type===`menu`,instant:S},ref:[t,l.context.popupRef,V,I],stateAttributesMapping:Yd,props:[b,{id:F,...P?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":L},onKeyDown(e){R?.onPopupKeyDown?.(e),_&&Bv.has(e.key)&&e.stopPropagation()},onFocus:ee},BT(y),c,{"data-rootownerid":E}]}),U=w.type===void 0||z;(C||w.type===`menubar`&&T!==`outside-press`)&&(U=!0);let W=R?.getReturnElement??H;return(0,$.jsx)(og,{context:D,openInteractionType:M,modal:z,disabled:!x,returnFocus:a??W??U,explicitReturnFocus:a===void 0&&W?!1:void 0,initialFocus:B,restoreFocus:!0,getInsideElements:w.type===void 0?()=>[l.context.beforeTriggerFocusGuardRef.current]:void 0,externalTree:w.type===`menubar`?void 0:O,previousFocusableElement:C,nextFocusableElement:w.type===void 0?l.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:te})}),qT={parentVirtualFocusRef:void 0,handleFocus:void 0};function JT(){return qT}var YT=J.forwardRef(function(e,t){let n=mT()?.Popup??KT;return(0,$.jsx)(n,{...e,ref:t})}),XT=J.createContext(void 0);function ZT(){let e=J.useContext(XT);if(e===void 0)throw Error(Uu(32));return e}var QT=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=uT();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,$.jsx)(XT.Provider,{value:n,children:(0,$.jsx)(Vh,{ref:t,...r,portalOwnerRole:o})})});function $T(e){let{nodeId:t,externalTree:n,rootContext:r}=e,i=r.useState(`referenceElement`),a=r.useState(`floatingElement`),o=r.useState(`domReferenceElement`),s=r.useState(`open`),c=r.useState(`floatingId`),[l,u]=J.useState(null),d=J.useRef(null),f=qh(n),p=J.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=Mv({...e,elements:{...p,...l&&{reference:l}}}),h=J.useCallback(e=>{let t=nf(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),m.refs.setReference(t)},[m.refs]),g=J.useMemo(()=>({...m.refs,setPositionReference:h,domReference:d}),[m.refs,h]),_=J.useMemo(()=>({...m.elements,domReference:o}),[m.elements,o]),v=J.useMemo(()=>({...m,dataRef:r.context.dataRef,open:s,onOpenChange:r.setOpen,events:r.context.events,floatingId:c,refs:g,elements:_,nodeId:t,rootStore:r}),[m,g,_,t,r,s,c]);return Z(()=>{o&&(d.current=o)},[o]),Z(()=>{r.context.dataRef.current.floatingContext=v;let e=f?.nodesRef.current.find(e=>e.id===t);e&&(e.context=v)}),J.useMemo(()=>({...m,context:v,refs:g,elements:_,rootStore:r}),[m,g,_,v,r])}var eE=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=vm(e,t)||{};if(l==null)return{};let d=Im(u),f={x:n,y:r},p=wm(i),m=Sm(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=s.floating[y]||a.floating[m],C=b/2-x/2,w=S/2-h[m]/2-1,T=Math.min(d[_],w),E=Math.min(d[v],w),D=T,O=S-h[m]-E,k=S/2-h[m]/2+C,A=_m(D,k,O),j=!c.arrow&&bm(i)!=null&&k!==A&&a.reference[m]/2-(k<D?T:E)-h[m]/2<0,M=j?k<D?k-D:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),tE=(e,t)=>{let{name:n,fn:r}=eE(e);return{name:n,fn:r,options:[e,t]}},nE={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},rE={sideX:`left`,sideY:`top`},iE=`--available-width`,aE=`--available-height`,oE=`--anchor-width`,sE=`--anchor-height`,cE=`--transform-origin`,lE=iE,uE=aE;function dE(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function fE(e,t,n){let{rects:r,placement:i}=e;return{side:dE(t,ym(i),n),align:bm(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function pE(e){return mE(e,$T)}function mE(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,C=_.side||`flip`,w=_.align||`flip`,T=_.fallbackAxisSide||`end`,E=v?.crossAxis??!1,D=v?.rootBoundary,O=typeof n==`function`?n:void 0,k=X(O),A=O?k:n,j=nm(n),M=nm(g),N=ub()===`rtl`,[P,F]=J.useState(null);!g&&P!==null&&F(null);let I=x===`placement`,L=P?ym(P):null,R=P&&I?bm(P)||`center`:null,z=L||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[i],B=R||o,V=B===`center`?z:`${z}-${B}`,H=l;typeof H==`number`?H={top:H,right:H,bottom:H,left:H}:H&&={top:H.top||0,right:H.right||0,bottom:H.bottom||0,left:H.left||0};let ee=+(i===`bottom`),te=+(i===`top`),U=+(i===`right`),W=+(i===`left`),ne={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:H},re=J.useRef(null),ie=nm(a),ae=nm(s),oe=typeof a==`function`?0:a,se=typeof s==`function`?0:s,ce=[];p&&ce.push(p),ce.push(Nv(e=>{let t=fE(e,i,N),n=typeof ie.current==`function`?ie.current(t):ie.current,r=typeof ae.current==`function`?ae.current(t):ae.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[oe,se,N,i]));let le=w===`none`&&C!==`shift`,ue=!le&&(u||E||C===`shift`),de=C===`none`?null:Iv({...ne,padding:{top:H.top+1+ee,right:H.right+1+W,bottom:H.bottom+1+te,left:H.left+1+U},mainAxis:!E&&C===`flip`,crossAxis:w===`flip`&&`alignment`,fallbackAxisSideDirection:T}),fe=le?null:Pv({...ne,rootBoundary:D,mainAxis:w!==`none`,crossAxis:ue,limiter:u||E?void 0:Fv(e=>{if(!re.current)return{};let{width:t,height:n}=re.current.getBoundingClientRect(),r=Cm(ym(e.placement)),i=r===`y`?t:n,a=r===`y`?H.left+H.right:H.top+H.bottom;return{offset:i/2+a/2}})},[ne,u,E,D,H,w]);C===`shift`||w===`shift`||B===`center`?ce.push(fe,de):ce.push(de,fe),ce.push(Lv({...ne,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(lE,`${t}px`),i.setProperty(uE,`${n}px`);let a=$d(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(oE,`${u}px`),i.setProperty(sE,`${d}px`)}}),tE(e=>({element:re.current||jf(e.elements.floating).createElement(`div`),padding:re.current?d:0}),[d]),{name:`transformOrigin`,fn(e){let{elements:{floating:t},middlewareData:n,placement:r,platform:o,rects:s,y:c}=e,l=ym(r),u=bm(r),d=Cm(l)===`y`,f=re.current,p=typeof a==`function`?a(fE(e,i,N)):a,m;m=!f&&u&&Math.abs(d?n.shift?.x||0:n.shift?.y||0)<=1?u===`start`===(d&&o.isRTL?.(t)===!0)?`100%`:`0%`:`${(d?n.arrow?.x||0:n.arrow?.y||0)+(d?f?.clientWidth||0:f?.clientHeight||0)/2}px`;let h=l===`top`||l===`left`?`calc(100% + ${p}px)`:`${-p}px`;return ue&&d&&Math.abs(n.shift?.y||0)>p&&(h=`${s.reference.y+s.reference.height/2-c}px`),t.style.setProperty(cE,d?`${m} ${h}`:`${h} ${m}`),{}}},nE,b),Z(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let G=J.useMemo(()=>({ancestorScroll:!f,elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:pe,elements:me,x:he,y:ge,middlewareData:K,update:_e,placement:ve,context:ye,isPositioned:be,floatingStyles:xe}=t({rootContext:h,open:m?g:void 0,placement:V,middleware:ce,strategy:r,whileElementsMounted:m?void 0:(...e)=>bv(...e,G),nodeId:y,externalTree:S}),{sideX:Se,sideY:Ce}=K.adaptiveOrigin||rE,we=be?r:`fixed`,Te=J.useMemo(()=>{let e;return e=be?b?{position:we,[Se]:he,[Ce]:ge}:{...xe,position:we}:{position:we,top:0,left:0},e[lE]=`100vw`,e[uE]=`100vh`,be||(e.opacity=0),e},[b,we,Se,he,Ce,ge,xe,be]),Ee=J.useRef(null);Z(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(hE(t)?t.current:t)||null;n!==Ee.current&&(pe.setPositionReference(n),Ee.current=n)},[g,pe,A,j]),J.useEffect(()=>{if(!g)return;let e=j.current;typeof e!=`function`&&hE(e)&&e.current!==Ee.current&&(pe.setPositionReference(e.current),Ee.current=e.current)},[g,pe,A,j]),J.useEffect(()=>{if(m&&g&&me.reference&&me.floating)return bv(me.reference,me.floating,_e,G)},[m,g,me,_e,G]);let De=ym(ve),Oe=dE(i,De,N),ke=bm(ve)||`center`,Ae=!!K.hide?.referenceHidden;Z(()=>{x&&g&&be&&(De!==z||I&&ke!==B)&&F(ve)},[x,I,g,be,ve,De,ke,z,B]);let je=J.useMemo(()=>({position:`absolute`,top:K.arrow?.y,left:K.arrow?.x}),[K.arrow]),Me=K.arrow?.centerOffset!==0;return J.useMemo(()=>({positionerStyles:Te,arrowStyles:je,arrowRef:re,arrowUncentered:Me,side:Oe,align:ke,physicalSide:De,anchorHidden:Ae,refs:pe,context:ye,isPositioned:be,update:_e}),[Te,je,re,Me,Oe,ke,De,Ae,pe,ye,be,_e])}function hE(e){return e!=null&&`current`in e}function gE(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=X(i),[,o]=J.useState(0),s=qu(vE).current,c=qu(_E).current,l=J.useRef(0),u=J.useRef(!0),d=J.useRef(null),f=J.useRef(null),p=X(()=>{u.current||(u.current=!0,o(e=>e+1))}),m=X((e,t)=>{c.set(e,t),p()}),h=X(e=>{c.delete(e),p()}),g=X(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!xE(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&SE(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=bE(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=X(()=>{let[e,t]=yE(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});Z(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Z(()=>{u.current&&v()}),Z(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=X(e=>(s.add(e),()=>{s.delete(e)})),b=J.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,$.jsx)(wT.Provider,{value:b,children:t})}function _E(){return new Map}function vE(){return new Set}function yE(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>SE(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function bE(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function xE(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function SE(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function CE(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=J.useRef(null),o=J.useRef(null),s=gg(r);Z(()=>{i||(o.current?.abort(),o.current=null,t.state.instantType===`trigger-change`&&t.set(`instantType`,void 0))},[i,t]),Z(()=>{let e=n,r=a.current;if(e&&(a.current=e),!r||!e||e===r||!t.select(`open`))return;t.set(`instantType`,void 0);let i=new AbortController;return o.current=i,s(()=>{t.select(`open`)&&t.set(`instantType`,`trigger-change`)},i.signal),()=>{i.abort()}},[n,s,t])}function wE(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),wd(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},BT(r),i],stateAttributesMapping:Jd})}var TE=20;function EE(e,t,n,r){let[i,a]=J.useState(!1);Z(()=>{if(!e||!t||n==null){a(!1);return}let r=jf(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-TE)},[e,t,n]),iy(e&&(!t||i),r)}var DE=J.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Nh,style:g,..._}=e,{store:v,virtualFocus:y,syncHighlightedItem:b}=uT(),x=ZT(),S=fT(!0),C=v.useState(`parent`),w=v.useState(`floatingRootContext`),T=v.useState(`floatingTreeRoot`),E=v.useState(`mounted`),D=v.useState(`open`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`activeTriggerElement`),j=v.useState(`transitionStatus`),M=v.useState(`positionerElement`),N=v.useState(`instantType`),P=v.useState(`adaptiveOrigin`),F=v.useState(`lastOpenChangeReason`),I=v.useState(`floatingNodeId`),L=v.useState(`floatingParentNodeId`),R=w.useState(`domReferenceElement`),z=n,B=c,V=l,H=s,ee=h;C.type===`context-menu`&&(z=n??C.context?.anchor,H??=`start`,!o&&H!==`center`&&(V=e.alignOffset??2,B=e.sideOffset??-5));let te=o,U=H;C.type===`menu`?(te??=`inline-end`,U??=`start`,ee=e.collisionAvoidance??Ph):C.type===`menubar`&&(te??=C.context.orientation===`vertical`?`inline-end`:`bottom`,U??=`start`);let W=C.type===`context-menu`,ne=pE({anchor:z,floatingRootContext:w,positionMethod:S?`fixed`:r,mounted:E,side:te,sideOffset:B,align:U,alignOffset:V,arrowPadding:W?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:I,keepMounted:x,disableAnchorTracking:m,collisionAvoidance:ee,shift:W?{crossAxis:!(`side`in ee&&ee.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:T,adaptiveOrigin:P,lazyFlip:y?`placement`:!1});J.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===I&&v.set(`hoverEnabled`,!1),e.nodeId!==I&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,If(Zf)))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[v,T.events,I]),J.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,If(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let re=up();J.useEffect(()=>{D||re.clear()},[D,re]),J.useEffect(()=>{function e(e){if(!(!D||e.nodeId!==v.select(`floatingParentNodeId`))){if(e.target&&A&&A!==e.target){let e=v.select(`closeDelay`);e>0?re.isStarted()||re.start(e,()=>{v.setOpen(!1,If(Zf))}):v.setOpen(!1,If(Zf))}else re.clear()}}return T.events.on(`itemhover`,e),()=>{T.events.off(`itemhover`,e)}},[T.events,D,A,v,re]),J.useEffect(()=>{let e={open:D,nodeId:I,parentNodeId:L,reason:v.select(`lastOpenChangeReason`)};T.events.emit(`menuopenchange`,e)},[T.events,D,v,I,L]),CE({store:v,domReference:R,positionerElement:M,open:D});let ie={open:D,side:ne.side,align:ne.align,anchorHidden:ne.anchorHidden,nested:C.type===`menu`,instant:N},ae=C.type===`menubar`&&C.context.modal;EE(D&&(ae||O&&F!==`trigger-hover`),k===`touch`,M,A);let oe=wE(e,ie,{styles:ne.positionerStyles,transitionStatus:j,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!E,inert:!D}),se=E&&C.type!==`menu`&&(C.type!==`menubar`&&O&&F!==`trigger-hover`||C.type===`menubar`&&C.context.modal),ce=null;return C.type===`menubar`?ce=C.context.contentElement:C.type===void 0&&(ce=A),(0,$.jsxs)(sT.Provider,{value:ne,children:[se&&(0,$.jsx)(Kv,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:Gv(!D),cutout:ce}),(0,$.jsx)(Yh,{id:I,children:(0,$.jsx)(gE,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,onMapChange:b,children:oe})})]})}),OE=J.createContext(null);function kE(e){let t=J.useContext(OE);if(t===null&&!e)throw Error(Uu(5));return t}function AE(e){return e==null?Rf:e.type.startsWith(`key`)?Jf:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?Yf:Rf}var jE={...s_,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,keyboardOpen:e=>e.keyboardOpen,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,listElement:e=>e.listElement,triggerControlsId:(e,t)=>{let n=s_.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>Sp&&e.inputFocused&&t?!0:void 0,highlightedItemId:e=>e.highlightedItem?.id||void 0,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType===`trigger-change`&&!s_.open(e)?void 0:e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},ME=class extends Qg{constructor(e,t,n=!1){let r=new Mg,i=PE(r,t,n,e);super(i,NE(r),jE),this.observe(`parent`,e=>{e.type===`menu`?this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef:e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef)})}subscribeToParentMenu(){let e=this.state.parent;if(e.type!==`menu`)return;let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);return e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}setActiveIndex(e,t,n){if(this.state.activeIndex!==e){let r=(e===null?void 0:this.context.itemDomElements.current[e])===this.context.reportedItem;this.context.highlightReason=r?`none`:t,this.context.highlightEvent=r?void 0:n}this.set(`activeIndex`,e)}highlightItem(e,t,n){let r=this.context.itemDomElements.current.indexOf(e);r>-1&&this.setActiveIndex(r,t,n)}};function NE(e){return{positionerRef:J.createRef(),popupRef:J.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},highlightReason:`none`,highlightEvent:void 0,reportedItem:void 0,allowMouseUpTriggerRef:{current:!1},virtualFocusRef:void 0,triggerFocusTargetRef:J.createRef(),beforeTriggerFocusGuardRef:J.createRef(),beforeContentFocusGuardRef:J.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function PE(e,t,n=!1,r){return{...t_(e,t,n),disabled:!1,modal:!0,openMethod:null,keyboardOpen:!1,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,listElement:null,filterTriggerProps:od,inputProps:od,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Uh,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:od,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var FE=J.createContext(null);function IE(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function LE(e,t){return e===`list-navigation`||IE(e,t)}var RE=Vg(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,onItemHighlighted:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:g=!0,isSubmenu:_=!1,virtualFocus:v=!1,virtualFocusRef:y,allowEscape:b=!0,resetOnPointerLeave:x=!0}=e,S=fT(!0),C=uT(!0),w=kE(!0),T=C?.store,E=C?.virtualFocus??!1,D=J.useMemo(()=>_&&T?{type:`menu`,store:T}:w?{type:`menubar`,context:w}:S&&!T?{type:`context-menu`,context:S}:{type:void 0},[S,T,w,_]),O=ap(),k=ap(),[A,j]=J.useState(void 0),M=(A??k)||void 0,N=Kh(),P=D.type===`menu`?D.store:void 0,F=(n??o)&&P?.state.transitionStatus===`starting`,I=qu(()=>F?P?.state.instantType:void 0).current,L=qu(()=>{let e=new ME({open:o,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:D,disabled:s,highlightItemOnHover:g,modal:D.type===void 0?c:void 0,rootId:O,instantType:I},M,N!=null);return e.context.virtualFocusRef=y,e}).current;L.useControlledProp(`openProp`,n),L.useControlledProp(`triggerIdProp`,m),L.useContextCallback(`onOpenChangeComplete`,i);let R=L.useState(`floatingTreeRoot`),z=Jh(R),B=L.useState(`open`),V=L.useState(`activeTriggerElement`),H=L.useState(`positionerElement`),ee=L.useState(`hoverEnabled`),te=L.useState(`disabled`),U=L.useState(`lastOpenChangeReason`),W=L.useState(`parent`),ne=L.useState(`activeIndex`),re=L.useState(`keyboardOpen`),ie=L.useState(`payload`),ae=L.useState(`floatingParentNodeId`),oe=J.useRef(null),se=J.useRef(W.type!==`context-menu`),ce=up(),le=J.useRef(!0),ue=up(),de=ae!=null,{openMethod:fe,triggerProps:G}=gy(B);L.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:W.type===void 0?c:void 0,openMethod:fe,rootId:O}),Og(L);let{forceUnmount:pe,transitionStatus:me}=kg(B,L,()=>{L.set(`allowMouseEnter`,!1)},F),he=gg(L.context.popupRef);J.useEffect(()=>{if(I===void 0)return;let e=()=>{L.state.instantType===I&&L.set(`instantType`,void 0)};if(!B){e();return}if(me!==void 0)return;if(L.context.popupRef.current==null){e();return}let t=new AbortController;return he(e,t.signal),()=>{t.abort()}},[I,B,me,he,L]),Z(()=>{S&&!C?L.update({parent:{type:`context-menu`,context:S},floatingNodeId:z,floatingParentNodeId:N}):(C||!L.select(`activeTriggerElement`))&&L.update({floatingNodeId:z,floatingParentNodeId:N})},[S,C,z,N,V,L]),J.useEffect(()=>{if(B||(oe.current=null),W.type===`context-menu`){if(!B){ce.clear(),se.current=!1;return}ce.start(500,()=>{se.current=!0})}},[ce,B,W.type]),Z(()=>{!B&&!ee&&L.set(`hoverEnabled`,!0)},[B,ee,L]);let ge=X((e,t)=>{let n=t.reason;if(!e&&!L.select(`open`)||B===e&&t.trigger===V&&U===n)return;let i=Eg(t);if(!e&&t.trigger==null&&(t.trigger=V??void 0),r?.(e,t),t.isCanceled)return;L.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&n!==`item-press`&&a?.type===`click`&&a.pointerType===`touch`&&!le.current)return;e&&n===`trigger-focus`?(le.current=!1,ue.start(300,()=>{le.current=!0})):(le.current=!0,ue.clear());let o=!e&&(n===`escape-key`||n==null);oe.current=t.event;let s=Tg(L.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&LE(n,a),s.instantType=W.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:IE(n,a)?`click`:o?`dismiss`:void 0,L.update(s)}),K=dg({popupStore:L,floatingRootContext:L.state.floatingRootContext,floatingId:M,nested:N!=null,onOpenChange:ge}),_e=K.context.events;Z(()=>{let e=({open:e,eventDetails:t})=>ge(e,t);return _e.on(`setOpen`,e),()=>{_e?.off(`setOpen`,e)}},[_e,ge]),Z(()=>L.subscribeToParentMenu(),[L]);let ve=J.useCallback(()=>{L.setOpen(!1,If(Qf))},[L]);J.useImperativeHandle(d,()=>({unmount:pe,close:ve}),[pe,ve]);let ye;W.type===`context-menu`&&(ye=W.context),J.useImperativeHandle(ye?.positionerRef,()=>H,[H]),J.useImperativeHandle(ye?.actionsRef,()=>({setOpen:ge}),[ge]);let be=ug(K,{enabled:!te,bubbles:{escapeKey:f&&W.type===`menu`},outsidePress(){return W.type!==`context-menu`||oe.current?.type===`contextmenu`||se.current},externalTree:de?R:void 0}),xe=ub(),Se=T_(K,{enabled:!te,listRef:L.context.itemDomElements,activeIndex:ne,virtual:v,nested:W.type===`menubar`||!v&&W.type!==void 0,parentOrientation:W.type===`menubar`?W.context.orientation:void 0,loopFocus:l,focusItemOnOpen:v?re:void 0,allowEscape:v&&l&&b,orientation:u,triggerOrientation:v?`vertical`:u,rtl:xe===`rtl`,disabledIndices:ad,onNavigate(e,t){L.setActiveIndex(e,AE(t),t?.nativeEvent)},openOnArrowKeyDown:W.type!==`context-menu`&&!(v&&_),externalTree:!v&&de?R:void 0,nestedReturnFocusRef:P?.context.virtualFocusRef,focusItemOnHover:g,resetOnPointerLeave:x}),Ce=J.useCallback(e=>{L.context.typingRef.current=e},[L]),we=E_(K,{enabled:!te&&!v,listRef:L.context.itemLabels,elementsRef:L.context.itemDomElements,activeIndex:ne,resetMs:500,onMatch:(e,t)=>{B&&e!==ne&&L.setActiveIndex(e,Jf,t.nativeEvent)},onTyping:Ce}),Te=X(a),Ee=J.useRef(-1),De=X(()=>{let e=L.state.activeIndex,t=e===null?void 0:L.context.itemDomElements.current[e]??void 0;if(t?.isConnected===!1)return;let n=t===void 0?-1:e;if(Ee.current===n&&L.context.reportedItem===t)return;Ee.current=n,L.context.reportedItem=t,v&&L.set(`highlightedItem`,t);let{highlightReason:r,highlightEvent:i}=L.context;L.context.highlightReason=Rf,L.context.highlightEvent=void 0,a&&Te(t,Lf(r,i,{label:t===void 0?void 0:L.context.itemLabels.current[n]??void 0}))});Z(()=>{De()},[ne,De]);let Oe=J.useMemo(()=>{if(!v)return Se.reference;if(!Se.trigger)return od;let{onFocus:e,...t}=Se.trigger;return t},[v,Se.reference,Se.trigger]);L.useSyncedValue(`inputProps`,v?Se.reference??od:od);let ke=J.useMemo(()=>{let e=dd(we.reference,Oe,be.reference,{onMouseMove(){L.set(`allowMouseEnter`,!0)}},G);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=B,e},[L,we.reference,Oe,be.reference,G,B]),Ae=J.useMemo(()=>{let e=dd(Se.trigger,be.trigger,G);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Se.trigger,be.trigger,G]);qu(()=>(L.update({inactiveTriggerProps:Ae}),null)),Ag(L,{floatingRootContext:K,activeTriggerProps:ke,inactiveTriggerProps:Ae,popupProps:J.useMemo(()=>dd(yg,{onMouseMove(){L.set(`allowMouseEnter`,!0),W.type===`menu`&&L.set(`hoverEnabled`,!1)},onClick(){L.select(`hoverEnabled`)&&L.set(`hoverEnabled`,!1)},onKeyDown(e){let t=L.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},we.floating,Se.floating,be.floating),[W.type,L,we.floating,Se.floating,be.floating]),itemProps:Se.item??od});let je=J.useMemo(()=>({store:L,parent:D,orientation:u,loopFocus:l,allowEscape:b,defaultFloatingId:k,setRenderedFloatingId:j,virtualFocus:v,parentVirtualFocus:E,syncHighlightedItem:De}),[L,D,u,l,b,k,v,E,De]),Me=typeof t==`function`?t({payload:ie}):t,Ne=(0,$.jsxs)(lT.Provider,{value:je,children:[p&&(0,$.jsx)(Sg,{handle:p,store:L}),Me]});return(W.type===void 0||W.type===`context-menu`)&&(Ne=(0,$.jsx)(Xh,{externalTree:R,children:Ne})),Ne});function zE(e){let t=J.useContext(FE);if(t===null)return(0,$.jsx)(RE,{...e});let n=t.Root;return(0,$.jsx)(FE.Provider,{value:null,children:(0,$.jsx)(n,{...t.options,...e})})}var BE=5;function VE(e,t){let n=HE(t);return e.clientX>=n.left-BE&&e.clientX<=n.right+BE&&e.clientY>=n.top-BE&&e.clientY<=n.bottom+BE}function HE(e){let t=e.getBoundingClientRect(),n=$d(e);if(wp)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function UE(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=kf(),{ref:i,index:a}=ET(e),o=n===a,s=J.useRef(null),c=Ju(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function WE(e){let{render:t,className:n,style:r,state:i=od,props:a=ad,refs:o=ad,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=UE({metadata:s});return wd(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function GE(e){if(rf(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!gf(e))return GE(yf(e))}function KE(e,t){function n(n,r,i){let a=n.currentTarget;Ih.flushSync(()=>{e.setOpen(!1,If(Gf,n.nativeEvent,a))}),dh(a.isConnected?a:t.current,r,i)?.focus()}function r(t){n(t,-1,e.select(`positionerElement`))}function i(t){let r=e.select(`positionerElement`);r&&fh(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function qE(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=J.useRef(!1);return J.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,jf(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:od,[t,n,r])}var JE=Hg(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=uT(!0),h=c_(d)??m?.store;if(!h)throw Error(Uu(85));let g=ap(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerControlsId`,g),x=J.useRef(null),S=XE(),C=kf(!0),w=qh(),T=J.useMemo(()=>w??new Uh,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=Dg(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:Jh(T),floatingParentNodeId:Kh(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=Nf({disabled:A,native:o});J.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=J.useRef(null),P=up(),F=X(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;Q(N.current,t)||Q(h.select(`positionerElement`),t)||t===N.current||(t==null||GE(t)!==h.select(`rootId`))&&(VE(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:Xf}))});J.useEffect(()=>{let e=jf(N.current);if(y&&h.select(`lastOpenChangeReason`)===`trigger-hover`)return e.addEventListener(`mouseup`,F,{once:!0}),()=>{e.removeEventListener(`mouseup`,F)}},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=v_(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:P_({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=YE(y,h.select(`lastOpenChangeReason`)),z=sg(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),B=u_(v,{enabled:!A&&I}),V=qE({open:y,enabled:O,mouseDownAction:`open`}),H=J.useMemo(()=>dd(B.reference,z.reference),[B.reference,z.reference]),ee=h.useState(`triggerProps`,D),te=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:U,handleFocusTargetFocus:W}=KE(h,x),ne={disabled:A,open:y},re=[N,t,M,E,x],ie=[H,L??od,ee,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),jf(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},te,O?{role:`menuitem`}:{},V,p,j],ae=wd(`button`,e,{enabled:!O,stateAttributesMapping:qd,state:ne,ref:re,props:ie});return O?(0,$.jsx)(WE,{tag:`button`,render:n,className:r,style:i,state:ne,refs:re,props:ie,stateAttributesMapping:qd}):y?(0,$.jsxs)(J.Fragment,{children:[(0,$.jsx)(um,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:U},`${g}-pre-focus-guard`),(0,$.jsx)(J.Fragment,{children:ae},g),(0,$.jsx)(um,{ref:h.context.triggerFocusTargetRef,onFocus:W},`${g}-post-focus-guard`)]}):(0,$.jsx)(J.Fragment,{children:ae},g)});function YE(e,t){let n=up(),[r,i]=J.useState(!1);return Z(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function XE(){let e=kE(!0);return J.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var ZE=J.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return wd(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),QE=(0,J.createContext)(null);function $E({actionsRef:e,children:t,interactionOwner:n=`local`,onOpenChange:r,...i}){let a=(0,J.useRef)(null),o=e??a;return xy(()=>o.current?.close()),(0,$.jsx)(QE.Provider,{value:{actionsRef:o,interactionOwner:n},children:(0,$.jsx)(zE,{...i,actionsRef:o,onOpenChange:(e,t)=>{if(n===`host`&&!e&&t.reason===`escape-key`){t.cancel(),t.allowPropagation();return}r?.(e,t)},children:t})})}function eD(){let e=(0,J.useContext)(QE);if(!e)throw Error(`DropdownMenu parts must be used inside <DropdownMenu>`);return e}var tD=(0,J.forwardRef)(function({className:e,render:t,type:n=`button`,...r},i){return(0,$.jsx)(JE,{...r,className:t=>q(`btn caps-dropdown-trigger`,Qe(e,t)),ref:i,render:t,type:n})}),nD=(0,J.forwardRef)(function({container:e,...t},n){let r=by(`popover`);return e==null&&r===null?null:(0,$.jsx)(QT,{...t,container:e??r,ref:n})}),rD=(0,J.forwardRef)(function({collisionBoundary:e,...t},n){let r=by(`popover`);return(0,$.jsx)(DE,{...t,collisionBoundary:e??(r&&r!==document.body?r:void 0),ref:n})}),iD=(0,J.forwardRef)(function({className:e,finalFocus:t,...n},r){let{interactionOwner:i}=eD(),a=(0,J.useRef)(null);(0,J.useImperativeHandle)(r,()=>a.current);let o=Zw(`.caps-dropdown-item[data-highlighted]`),s=(0,J.useCallback)(e=>{a.current=e,o(e)},[o]);return(0,$.jsx)(YT,{...n,className:t=>q(`caps-dropdown-popup min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none`,Qe(e,t)),finalFocus:i===`host`?!1:t??!0,ref:s})}),aD=(0,J.forwardRef)(function({align:e=`end`,alignOffset:t,children:n,container:r,keepMounted:i,side:a=`bottom`,sideOffset:o=4,...s},c){return(0,$.jsx)(nD,{container:r,keepMounted:i,children:(0,$.jsx)(rD,{align:e,alignOffset:t,side:a,sideOffset:o,children:(0,$.jsx)(iD,{...s,ref:c,children:n})})})}),oD=`caps-dropdown-item flex w-full items-center gap-sm rounded-field px-md py-sm text-left text-sm outline-none transition-colors hover:bg-base-200 focus-visible:bg-base-200 aria-[current=page]:bg-base-200 aria-[current=page]:font-semibold disabled:cursor-not-allowed disabled:text-base-content/40 data-disabled:cursor-not-allowed data-disabled:text-base-content/40`;(0,J.forwardRef)(function({className:e,onClick:t,onSelect:n,variant:r=`default`,...i},a){return(0,$.jsx)(LT,{...i,className:t=>q(oD,r===`destructive`&&`text-error hover:bg-error hover:text-error-content focus-visible:bg-error focus-visible:text-error-content`,Qe(e,t)),onClick:e=>{t?.(e),e.defaultPrevented||n?.(e)},ref:a})});var sD=(0,J.forwardRef)(function({children:e,className:t,onClick:n,onSelect:r,...i},a){return(0,$.jsxs)(jT,{...i,className:e=>q(oD,Qe(t,e)),onClick:e=>{n?.(e),e.defaultPrevented||r?.(e)},ref:a,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:e}),(0,$.jsx)(MT,{"aria-hidden":`true`,className:`shrink-0`,children:`✓`})]})});(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(ZE,{...t,className:t=>q(`my-xs h-px bg-base-300`,Qe(e,t)),ref:n})}),(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(FT,{...t,className:t=>q(`px-md pb-xs pt-sm text-xs font-semibold text-base-content/60`,Qe(e,t)),ref:n})});function cD({disabled:e,emptyLabel:t,models:n,onChange:r,value:i}){let a=n.find(e=>e.id===i),[o,s]=(0,J.useState)(null);return(0,$.jsx)(`span`,{className:`contents`,ref:s,children:(0,$.jsxs)($E,{children:[(0,$.jsx)(tD,{"aria-label":`Generation model`,"data-generation-model":i,disabled:e||n.length===0,render:(e,n)=>(0,$.jsx)(jw,{...e,expanded:n.open,label:a===void 0?t:On(a)})}),(0,$.jsx)(aD,{"data-generation-model-menu":!0,container:o,side:`top`,align:`start`,"aria-label":`Generation models`,children:n.map(e=>(0,$.jsx)(sD,{"data-generation-model-option":e.id,checked:e.id===i,closeOnClick:!0,onSelect:()=>{r(e.id)},children:On(e)},e.id))})]})})}function lD(e){let t=du(e),n=(0,J.useRef)(e);n.current=e;let r=L(),i=Ln(sr(e)),a=ua(cx(e,i.data?.configured?i.data.path:null)),[o,s]=(0,J.useState)(null),c=n=>n?.app===e&&n.computerId===t,l=pt({mutationKey:Er.folder(e),mutationFn:async({owner:e,id:t,path:r,create:i})=>{let a=()=>{if(n.current!==e||e.context.get().computerId!==t)throw new K(`Computer selection changed`,{code:`SELECTION_CHANGED`,retryable:!1})};return a(),i&&await e.capabilities.require(ln).mkdir({path:r}),a(),await dn(e.capabilities,{path:r,limit:1,offset:0}),a(),xn(e.capabilities,{operation:`select-folder`,computerId:t,path:r})},onSuccess:(e,t)=>{t.owner===n.current&&t.owner.context.get().computerId===t.id&&s(null)},onSettled:(e,t,n)=>Promise.all([r.invalidateQueries({queryKey:n.queryKey,exact:!0}),r.invalidateQueries({queryKey:sx.listing(n.owner,n.path),exact:!0})])}),u=l.variables?.owner===e&&l.variables.id===t,d=i.isFetching||u&&l.isPending,f=async(n,r)=>{if(!e||!t||d)return`Computer selection changed. Try again.`;let i=n.trim();if(!$e(Un)(i))return`Enter an absolute Computer folder, such as /media.`;try{return await l.mutateAsync({owner:e,id:t,path:i,create:r,queryKey:Er.folder(e)}),null}catch{return`Could not use this folder. Check its location and your Computer permissions.`}},p=i.isError||a.isError;return{path:p?null:i.data?.path??null,galleryPath:p||!i.data?.configured?null:i.data.path,computerId:t,available:e?.capabilities.has(wn)===!0,writable:e?.capabilities.has(ln)===!0,busy:d,error:p?`Your media folder is unavailable. Choose or create a folder.`:null,editing:c(o),setEditing:n=>{s(n?{app:e,computerId:t}:null)},choose:f,ensureCreated:async()=>i.data?i.data.configured?null:f(i.data.path,!0):`Your Prints library is still loading.`,recheck:()=>{r.invalidateQueries({queryKey:sx.listing(e,i.data?.path??null),exact:!0}),r.invalidateQueries({queryKey:Er.folder(e),exact:!0})}}}var uD=Dt(Ve),dD=Dt(me({message:Ve}));function fD(e){for(let t of e.errors){let e=j(V(Ne(dD(t),e=>e.message),()=>uD(t)));if(e!==void 0&&e.length>0)return e}}var pD={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},mD=(0,J.forwardRef)(function({className:e,tone:t=`primary`,...n},r){return(0,$.jsx)(`progress`,{...n,"data-complete":n.value!==void 0&&Number(n.value)>=Number(n.max??1)?`true`:void 0,className:q(`progress caps-gooey-motion caps-gooey-progress w-full`,pD[t],e),ref:r})});(0,J.forwardRef)(function({label:e,value:t,max:n,tone:r=`info`,className:i,...a},o){return(0,$.jsxs)(`div`,{...a,ref:o,className:q(`caps-game-meter`,i),children:[(0,$.jsxs)(`div`,{className:`caps-game-meter-readout`,children:[(0,$.jsx)(`span`,{children:e}),(0,$.jsxs)(`span`,{className:`caps-game-meter-value`,children:[t,` / `,n]})]}),(0,$.jsx)(mD,{"aria-label":e,value:t,max:n,tone:r})]})});function hD({className:e,items:t,onCancel:n,onRemove:r,onRetry:i,rowClassName:a}){return t.length?(0,$.jsx)(`div`,{"aria-live":`polite`,className:`caps-upload-queue flex w-full min-w-0 flex-col gap-sm ${e??``}`,"data-upload-rows":!0,children:t.map(e=>(0,$.jsx)(vD,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function gD({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,$.jsx)(cr,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,$.jsx)(mr,{}):(0,$.jsx)(mn,{}),onClick:()=>void n(t),type:`button`}):null}function _D({item:e}){return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block min-w-0 truncate`,title:e.name,children:e.name}),(0,$.jsx)(`div`,{className:`caps-upload-details`,children:(0,$.jsxs)(`span`,{"aria-live":e.alert?`assertive`:void 0,className:`caps-upload-status min-w-0 break-words`,"data-upload-status":!0,role:e.alert?`alert`:void 0,children:[e.alert??e.statusLabel,` `,e.progressLabel]})})]})}function vD({item:e,onCancel:t,onRemove:n,onRetry:r,rowClassName:i}){return(0,$.jsxs)(`div`,{className:`caps-upload-row grid w-full min-w-0 max-w-full grid-cols-[2rem_minmax(0,1fr)_auto] items-center gap-sm p-sm text-xs ${i??``}`,children:[e.preview.kind===`image`?(0,$.jsx)(`img`,{alt:``,className:`caps-upload-preview mask mask-squircle size-8 shrink-0 object-cover`,src:e.preview.url}):(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`caps-upload-preview mask mask-squircle flex size-8 shrink-0 items-center justify-center bg-base-300`,children:(0,$.jsx)(Xb,{className:`size-4`})}),(0,$.jsx)(_D,{item:e}),(0,$.jsx)(yD,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,$.jsx)(mD,{"aria-label":`${e.name} progress`,className:`caps-upload-progress`,tone:e.alert?`error`:e.progress===100?`success`:`accent`,max:100,value:e.progress??(e.alert?0:void 0)})]})}function yD({actions:e,id:t,onCancel:n,onRemove:r,onRetry:i}){return(0,$.jsxs)(`div`,{className:`caps-upload-actions flex min-w-0 flex-wrap justify-end gap-xs`,children:[(0,$.jsx)(gD,{action:e.retry,id:t,onAction:i,retry:!0}),(0,$.jsx)(gD,{action:e.cancel,id:t,onAction:n}),(0,$.jsx)(gD,{action:e.remove,id:t,onAction:r})]})}var bD=J.createContext(void 0);function xD(e){let t=J.useContext(bD);if(t===void 0&&!e)throw Error(Uu(47));return t}var SD={...s_,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!s_.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&s_.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>s_.isOpenedByTrigger(e,t)&&!e.focusManagerModal,modal:e=>e.modal,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},CD=class extends Qg{constructor(e,t,n){let r=new Mg;super(wD(e,r,t,n),TD(r),SD)}setOpen=(e,t)=>{let n=t.reason===Bf,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=Eg(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n=Tg(this.state,e,t.trigger,a());n.openChangeReason=t.reason,this.update(n)};n?(this.context.stickIfOpen=!0,this.context.stickIfOpenTimeout.start(500,()=>{this.context.stickIfOpen=!1}),Ih.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function wD(e,t,n,r=!1){let i={...t_(t,n,r),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return i.open&&e?.mounted===void 0&&(i.mounted=!0),i}function TD(e){return{popupRef:J.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:J.createRef(),beforeTriggerFocusGuardRef:J.createRef(),beforeContentFocusGuardRef:J.createRef(),stickIfOpenTimeout:new lp,stickIfOpen:!0,triggerElements:e}}var ED=Vg(function({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=OD(s,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),jg(u,d),Og(u);let{forceUnmount:m}=kg(d,u,()=>{u.context.stickIfOpen=!0,u.set(`openChangeReason`,null)});u.useSyncedValues({modal:o}),J.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]),J.useImperativeHandle(e.actionsRef,()=>({unmount:m,close:()=>u.setOpen(!1,If(Qf))}),[m,u]);let h=d||f||s!=null;return(0,$.jsxs)(bD.Provider,{value:u,children:[s&&(0,$.jsx)(Sg,{handle:s,store:u}),h&&(0,$.jsx)(kD,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function DD(e){return xD(!0)?(0,$.jsx)(ED,{props:e}):(0,$.jsx)(Xh,{children:(0,$.jsx)(ED,{props:e})})}function OD(e,t){let n=xg((e,n)=>new CD(t,e,n));return J.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function kD({store:e,modal:t}){let n=ug(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return Ag(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var AD=Hg(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,handle:s,payload:c,openOnHover:l=!1,delay:u=300,closeDelay:d=0,id:f,...p}=e,m=xD(!0),h=c_(s)??m;if(!h)throw Error(Uu(74));let g=ap(f),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=J.useRef(null),{registerTrigger:S,isMountedByThisTrigger:C}=Dg(g,x,h,{payload:c,disabled:a,openOnHover:l,closeDelay:d}),w=h.useState(`isPressOpenedByTrigger`,g),T=h.useState(`isTouchPressOpen`,l),E=h.useState(`hasTriggerFocusGuards`,g),D=v_(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:P_(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=sg(v,{stickIfOpen:X(()=>h.context.stickIfOpen)}),k=hy(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=Nf({disabled:a,native:o}),N={open(e){return w?qd.open(e):Kd.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:F}=KE(h,x),I=wd(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[Mh]:``,id:g,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":b},p,j],stateAttributesMapping:N}),L=(0,$.jsx)(J.Fragment,{children:I},g);return E?(0,$.jsxs)(J.Fragment,{children:[(0,$.jsx)(um,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),L,(0,$.jsx)(um,{ref:h.context.triggerFocusTargetRef,onFocus:F})]}):L}),jD=J.createContext(void 0);function MD(){let e=J.useContext(jD);if(e===void 0)throw Error(Uu(45));return e}var ND=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return xD().useState(`mounted`)||n?(0,$.jsx)(jD.Provider,{value:n,children:(0,$.jsx)(Vh,{ref:t,...r})}):null}),PD=J.createContext(void 0);function FD(){let e=J.useContext(PD);if(!e)throw Error(Uu(46));return e}var ID=J.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o,side:s,align:c,sideOffset:l,alignOffset:u,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f,arrowPadding:p,sticky:m,disableAnchorTracking:h=!1,collisionAvoidance:g=Ph,..._}=e,v=xD(),y=MD(),b=Jh(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=pE({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:v.useState(`adaptiveOrigin`)});CE({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;EE(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=wE(e,{open:C,side:j.side,align:j.align,anchorHidden:j.anchorHidden,instant:k},{styles:j.positionerStyles,transitionStatus:A,props:_,refs:[t,N],hidden:!S,inert:!C});return(0,$.jsxs)(PD.Provider,{value:j,children:[S&&M&&(0,$.jsx)(Kv,{inert:Gv(!C),cutout:T}),(0,$.jsx)(Yh,{id:b,children:P})]})}),LD=J.createContext(void 0);function RD(){let[e,t]=J.useState(0),n=X(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:J.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}var zD=J.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=xD(),l=FD(),u=zT(!0)!=null,{context:d,hasClosePart:f}=RD(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),y=c.useState(`descriptionElementId`),b=c.useState(`modal`),x=c.useState(`mounted`),S=c.useState(`openChangeReason`),C=c.useState(`activeTriggerElement`),w=c.useState(`floatingRootContext`),T=w.useState(`floatingId`),E=c.useState(`disabled`),D=c.useState(`openOnHover`),O=c.useState(`closeDelay`);_g({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),g_(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?bg(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=wd(`div`,e,{state:{open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},ref:[t,c.context.popupRef,j],props:[_,{id:T,role:`dialog`,...yg,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&Bv.has(e.key)&&e.stopPropagation()}},BT(g),s],stateAttributesMapping:Yd});return(0,$.jsx)(og,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:rf(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,$.jsx)(LD.Provider,{value:d,children:M})})}),BD=(0,J.forwardRef)(function({children:e,className:t,type:n=`button`,...r},i){return(0,$.jsxs)(`button`,{...r,ref:i,type:n,className:q(`select caps-select caps-combobox-trigger w-full`,t),children:[(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(Kb,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function VD({defaultOpen:e,defaultValue:t,getKey:n,getSearchText:r,groupBy:i,id:a,isDisabled:o,items:s,onOpenChange:c,onCommit:l,multiple:u,controlledOpen:d,controlledKeys:f,trigger:p}){let m=`${a}-listbox`,[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(!1),[y,b]=(0,J.useState)(t),[x,S]=(0,J.useState)(e),C=f??(y===null?[]:[y]),w=p?d??x:!0,T=(0,J.useMemo)(()=>{let e=h.trim().toLowerCase();return e?s.filter(t=>r(t).toLowerCase().includes(e)):s},[r,s,h]),E=$w({getKey:n,isDisabled:o,items:T});(0,J.useEffect)(()=>{if(E.activeKey!==null)return;let e=E.enabledItems.find(e=>C.includes(n(e)))??E.enabledItems[0];e&&E.setActiveKey(n(e))},[E.activeKey,E.enabledItems,E.setActiveKey,n,C]);let D=e=>{v(!1),e||g(``),d===void 0&&S(e),c?.(e)},O=e=>`${m}-option-${encodeURIComponent(e)}`,k=e=>{let t=n(e);f===void 0&&b(t),l(e),p&&!u&&D(!1)},A=e=>{v(!0),g(e.target.value),E.setActiveKey(null)},j=e=>{if(Tw(e))return;let t;switch(e.key){case`ArrowDown`:t=[1,void 0];break;case`ArrowUp`:t=[-1,void 0];break;case`End`:t=[1,`end`];break;case`Home`:t=[-1,`start`]}t?(v(!0),e.preventDefault(),E.move(t[0],t[1])):e.key===`Enter`&&E.activeItem&&(e.preventDefault(),k(E.activeItem))},M=(0,J.useMemo)(()=>{if(!i)return[{label:``,items:T}];let e=new Map;for(let t of T){let n=i(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return[...e].map(([e,t])=>({label:e,items:t}))},[T,i]);return{keyboardNavigation:_,onPointerMove:()=>{v(!1)},activeKey:E.activeKey,activeItem:E.activeItem,groups:M,inputValue:h,listboxId:m,onInputChange:A,onInputKeyDown:j,optionId:O,open:w,commit:k,selectedKeys:C,setOpen:D}}function HD(e){let{"aria-describedby":t,"aria-invalid":n,"aria-label":r,"aria-labelledby":i,"aria-required":a,activeTone:o=`neutral`,container:s,contentClassName:c,defaultOpen:l=!1,defaultValue:u=null,emptyMessage:d=`No matches`,getKey:f,getLabel:p,getSearchText:m=p,groupBy:h,id:g,inputProps:_,inputRef:v,isDisabled:y=()=>!1,items:b,onOpenChange:x,onValueChange:S,multiple:C,open:w,placeholder:T=`Search…`,renderItem:E,rootRef:D,trigger:O,triggerRef:k,value:A,...j}=e,M=e=>{let t=f(e);if(C){let e=A.includes(t)?A.filter(e=>e!==t):[...A,t];S?.(e,b.filter(t=>e.includes(f(t))))}else S?.(t,e)},N;C?N=A:A!==void 0&&(N=A===null?[]:[A]);let P=(0,J.useId)(),F=O?.props??_,I=g??F?.id??P,L={id:I,"aria-describedby":[t,F?.[`aria-describedby`]].filter(Boolean).join(` `)||void 0,"aria-invalid":n??F?.[`aria-invalid`],"aria-label":F?.[`aria-label`]??r,"aria-labelledby":F?.[`aria-labelledby`]??i,"aria-required":a??F?.[`aria-required`]},{keyboardNavigation:R,onPointerMove:z,activeItem:B,activeKey:V,commit:H,groups:ee,inputValue:te,listboxId:U,onInputChange:W,onInputKeyDown:ne,open:re,optionId:ie,selectedKeys:ae,setOpen:oe}=VD({defaultOpen:l,defaultValue:u,getKey:f,getSearchText:m,groupBy:h,id:I,isDisabled:y,items:b,onOpenChange:x,onCommit:M,multiple:C??!1,controlledOpen:w,controlledKeys:N,trigger:O});xy(()=>{O&&oe(!1)});let se=by(`popover`),ce=s===void 0?se:s,le=Zw(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),ue=(0,$.jsx)(hC,{..._,...O?{}:L,"aria-activedescendant":B?ie(f(B)):void 0,"aria-autocomplete":`list`,"aria-controls":U,"aria-expanded":!0,className:q(`input-sm`,_?.className),id:O?_?.id??`${I}-input`:I,onChange:e=>{_?.onChange?.(e),W(e)},onKeyDown:e=>{_?.onKeyDown?.(e),e.defaultPrevented||ne(e)},placeholder:_?.placeholder??T,ref:v,role:`combobox`,value:te}),de=(0,$.jsx)(`div`,{id:U,ref:le,className:`caps-combobox-list`,"data-navigation":R?`keyboard`:`pointer`,onPointerMove:z,role:`listbox`,"aria-multiselectable":C??void 0,children:ee.every(e=>e.items.length===0)?(0,$.jsx)(`div`,{className:`px-md py-md text-sm text-base-content`,children:d}):ee.map(e=>(0,$.jsxs)(`div`,{"aria-label":e.label||void 0,role:e.label?`group`:void 0,children:[e.label?(0,$.jsx)(`div`,{className:`px-md pb-xs pt-sm text-xs text-base-content uppercase tracking-wider`,children:e.label}):null,e.items.map(e=>{let t=f(e),n=y(e),r=V===t,i={active:r,disabled:n,selected:ae.includes(t)};return(0,$.jsxs)(`button`,{"aria-disabled":n||void 0,"aria-selected":i.selected,className:`caps-combobox-option`,"data-active":r&&R,disabled:n,id:ie(t),onClick:()=>{H(e)},onMouseDown:e=>{e.preventDefault()},role:`option`,tabIndex:-1,type:`button`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`caps-combobox-check`,children:i.selected?(0,$.jsx)(Br,{}):null}),E?.(e,r,i)??p(e)]},t)})]},e.label))});return O?(0,$.jsx)(`div`,{...j,className:q(j.className),ref:D,children:(0,$.jsxs)(DD,{modal:!0,onOpenChange:oe,open:re,children:[(0,$.jsx)(AD,{...L,"aria-haspopup":`dialog`,className:`btn`,ref:k,render:O}),ce===null?null:(0,$.jsx)(ND,{container:ce,children:(0,$.jsx)(ID,{align:`start`,side:`bottom`,sideOffset:4,children:(0,$.jsxs)(zD,{"data-active-tone":o,className:q(`min-w-40 rounded-box border border-base-300 bg-base-100 p-xs shadow-lg outline-none caps-combobox-panel caps-combobox-popup`,c),children:[(0,$.jsx)(`div`,{className:`caps-combobox-search`,children:ue}),de]})})})]})}):(0,$.jsx)(`div`,{...j,className:q(j.className),ref:D,children:(0,$.jsxs)(`div`,{className:q(`caps-combobox-panel`,c),"data-active-tone":o,children:[(0,$.jsx)(`div`,{className:`caps-combobox-search`,children:ue}),de]})})}function UD({icon:e,caption:t}){return(0,$.jsxs)(`span`,{className:`caps-icon-choice-mark`,"aria-hidden":`true`,children:[(0,$.jsx)(`span`,{className:`caps-icon-choice-art`,children:e}),t?(0,$.jsx)(`span`,{className:`caps-icon-choice-caption`,children:t}):null,(0,$.jsx)(`span`,{className:`caps-icon-choice-lamp`})]})}var WD=(0,J.forwardRef)(function({label:e,icon:t,caption:n,appearance:r,className:i,...a},o){return(0,$.jsx)(`label`,{className:`caps-icon-choice`,"data-appearance":r===`compact`?r:void 0,children:(0,$.jsx)(qw,{...a,appearance:r??`default`,"aria-label":e,className:q(`caps-icon-choice-input`,i),indicator:(0,$.jsx)(UD,{icon:t,caption:n}),ref:o})})}),GD=(0,J.forwardRef)(function({label:e,icon:t,hint:n,className:r,...i},a){let o=(0,J.useId)(),s=[i[`aria-describedby`],n?o:null].filter(Boolean).join(` `)||void 0;return(0,$.jsx)(`label`,{className:`caps-check-key`,children:(0,$.jsx)(qw,{...i,"aria-label":e,"aria-describedby":s,className:q(`caps-check-key-input`,r),indicator:(0,$.jsxs)(`span`,{className:`caps-check-key-face`,"aria-hidden":`true`,children:[t?(0,$.jsx)(`span`,{className:`caps-check-key-icon`,children:t}):null,(0,$.jsxs)(`span`,{className:`caps-check-key-copy`,children:[(0,$.jsx)(`span`,{className:`caps-check-key-label`,children:e}),n?(0,$.jsx)(`span`,{className:`caps-check-key-hint`,id:o,children:n}):null]}),(0,$.jsx)(`span`,{className:`caps-check-key-lamp`})]}),ref:a})})});function KD({className:e,...t}){return(0,$.jsx)(`div`,{...t,className:q(`caps-check-keys`,e)})}function qD({checked:e}){let t=`caps-radio-${(0,J.useId)().replaceAll(`:`,``)}`,n=(0,J.useRef)(null),r=(0,J.useRef)(e).current,i=(0,J.useRef)(e),a=(0,J.useRef)(null),o=Xr(a),{reduced:s}=o;return(0,J.useLayoutEffect)(()=>{if(!n.current)return;let t=s||i.current===e;i.current=e;let r=e?4:0,a=Lr(o,{ease:`outCubic`,duration:75}),c=e?Sr(o,{bounce:.65,duration:300}):Lr(o,{ease:`inCubic`,duration:100}),l=$r(n.current,t?{rx:r,ry:r,cy:6,duration:0}:{rx:[{to:e?3.5:4.15,...a},{to:r,...c}],ry:[{to:e?4.5:3.85,...a},{to:r,...c}],cy:[{to:e?5.85:6.1,...a},{to:6,...c}]});return()=>{l.cancel()}},[e,s,o]),(0,$.jsxs)(`svg`,{ref:a,className:`caps-radio-visual`,width:`24`,height:`24`,viewBox:`0 0 12 12`,"aria-hidden":`true`,focusable:`false`,children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsx)(gr,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,$.jsx)(pr,{id:`${t}-shadow`}),(0,$.jsx)(Hr,{id:`${t}-inset`}),(0,$.jsx)(`clipPath`,{id:`${t}-well`,children:(0,$.jsx)(`circle`,{cx:`6`,cy:`6`,r:`5`})})]}),(0,$.jsx)(`circle`,{className:`caps-radio-track`,cx:`6`,cy:`6`,r:`5.5`,filter:`url(#${t}-inset)`}),(0,$.jsx)(`g`,{clipPath:`url(#${t}-well)`,children:(0,$.jsx)(`ellipse`,{ref:n,cx:`6`,cy:`6`,rx:r?4:0,ry:r?4:0,fill:`url(#${t}-surface)`,filter:`url(#${t}-shadow)`})})]})}var JD=(0,J.createContext)(null),YD=(0,J.forwardRef)(function({children:e,className:t,defaultValue:n,disabled:r=!1,name:i,onValueChange:a,orientation:o=`vertical`,value:s,...c},l){let u=(0,J.useId)(),d=(0,J.useRef)(null);(0,J.useImperativeHandle)(l,()=>{if(!d.current)throw Error(`RadioGroup is not mounted`);return d.current},[]);let f=i??`radio-group-${u}`,[p,m]=(0,J.useState)(n),h=s??p;return(0,J.useEffect)(()=>{let e=d.current?.form;if(!e||s!==void 0)return;let t=e=>{queueMicrotask(()=>{e.defaultPrevented||m(n)})};return e.addEventListener(`reset`,t),()=>{e.removeEventListener(`reset`,t)}},[s,n,c.form]),(0,$.jsx)(JD.Provider,{value:{disabled:r,name:f,onValueChange:e=>{s===void 0&&m(e),a?.(e)},value:h},children:(0,$.jsx)(`fieldset`,{...c,className:q(`flex gap-md`,o===`horizontal`?`flex-row flex-wrap`:`flex-col`,t),disabled:r,role:c.role??`radiogroup`,ref:d,children:e})})}),XD=(0,J.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,J.useContext)(JD);if(!s)throw Error(`RadioGroupItem must be used inside <RadioGroup>`);let c=s.value===i,l=e=>{n?.(e),e.target.checked&&s.onValueChange?.(i)};return(0,$.jsxs)(`span`,{className:`caps-radio`,"data-checked":c,"data-custom-indicator":t!==void 0||void 0,children:[(0,$.jsx)(`input`,{...a,"aria-checked":c,checked:c,className:q(`caps-radio-input`,e),disabled:s.disabled||a.disabled,name:s.name,onChange:l,onClick:r,ref:o,type:`radio`,value:i}),t===void 0?(0,$.jsx)(qD,{checked:c}):t]})}),ZD=(0,J.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,J.useContext)(JD),s=(0,J.useId)(),c=t??s,l=o?.value===i.value,u=o?.disabled===!0||i.disabled===!0;return(0,$.jsxs)(`label`,{className:`caps-choice-card`,"data-checked":l,"data-disabled":u||void 0,htmlFor:c,children:[(0,$.jsx)(XD,{...i,"aria-describedby":e?`${c}-description`:void 0,"aria-labelledby":`${c}-title`,id:c,ref:a}),(0,$.jsxs)(`span`,{className:`caps-choice-card-copy`,children:[(0,$.jsx)(`span`,{className:`caps-choice-card-title`,id:`${c}-title`,children:r}),e?(0,$.jsx)(`span`,{className:`caps-choice-card-description`,id:`${c}-description`,children:e}):null]}),n?(0,$.jsx)(`span`,{className:`caps-choice-card-meta`,children:n}):null]})}),QD=(0,J.forwardRef)(function({label:e,icon:t,caption:n,art:r=`dim`,className:i,...a},o){return(0,$.jsx)(`label`,{className:`caps-icon-choice`,"data-art":r===`color`?r:void 0,children:(0,$.jsx)(XD,{...a,"aria-label":e,className:q(`caps-icon-choice-input`,i),indicator:(0,$.jsx)(UD,{icon:t,caption:n}),ref:o})})});(0,J.forwardRef)(function({label:e,color:t,className:n,...r},i){return(0,$.jsx)(`label`,{className:`caps-icon-choice`,"data-art":`color`,"data-swatch":``,title:e,children:(0,$.jsx)(XD,{...r,"aria-label":e,className:q(`caps-icon-choice-input`,n),indicator:(0,$.jsx)(UD,{icon:(0,$.jsx)(`span`,{className:`caps-swatch-dot`,style:{backgroundColor:t}})}),ref:i})})});var $D=Dt(Ve),eO=Dt(je),tO=Dt(z(N)),nO=Dt(f(Ve)),rO=f(Vt(File)),iO=Dt(rO),aO=wt([Ve,N,je,Nt,nt,f(Ve),rO]),oO=Dt(aO),sO=e=>u($D(e.state.value),()=>``),cO=e=>u(eO(e.state.value),()=>!1),lO=e=>u(tO(e.state.value),()=>null),uO=e=>u(nO(e.state.value),()=>[]),dO=e=>u(iO(e.state.value),()=>[]),fO=e=>u(oO(e.state.value),()=>null);function pO({field:e,spec:t,locked:n,...r}){let[i,a]=(0,J.useState)(!1);return(0,$.jsxs)(XC,{children:[(0,$.jsx)(hC,{...r,name:t.name,disabled:n,type:i?`text`:`password`,autoComplete:`off`,spellCheck:!1,className:`caps-field-secret`,placeholder:t.placeholder,readOnly:t.readOnly,value:sO(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,$.jsx)(Nr,{type:`button`,variant:`outline`,size:`icon`,"aria-label":i?`Hide`:`Show`,"aria-pressed":i,disabled:n,onClick:()=>{a(e=>!e)},children:i?(0,$.jsx)(Jb,{"aria-hidden":`true`}):(0,$.jsx)(Yb,{"aria-hidden":`true`})})]})}var mO={text:`text`,email:`email`,url:`url`,tel:`tel`};function hO({spec:e,field:t,locked:n,...r}){let i=dO(t),a=n||e.readOnly===!0,o=(0,J.useRef)(null);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,$.jsx)(kr,{asChild:!0,children:(0,$.jsx)(`input`,{...r,ref:o,type:`file`,tabIndex:-1,required:r.required===!0&&i.length===0,name:e.name,accept:e.accept,multiple:e.multiple,disabled:a,onBlur:t.handleBlur,onChange:e=>{t.handleChange(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,$.jsx)(Nr,{type:`button`,variant:`outline`,"aria-label":`Choose files for ${e.label}`,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],disabled:a,onBlur:t.handleBlur,onClick:()=>{o.current?.click()},children:`Choose files`}),(0,$.jsx)(hD,{items:i.map((e,t)=>({id:String(t),name:e.name,preview:{kind:`file`},progress:0,progressLabel:`${String(e.size)} bytes`,statusLabel:`Selected`,actions:a?{}:{remove:{label:`Remove`,accessibleLabel:`Remove ${e.name}`}}})),onRemove:e=>{t.handleChange(i.filter((t,n)=>String(n)!==e))},onCancel:()=>void 0,onRetry:()=>void 0})]})}function gO({spec:e,field:t,locked:n,...r}){let i=e=>{t.handleChange(e)},a={...r,name:e.name,disabled:n,onBlur:t.handleBlur};switch(e.kind){case`text`:case`email`:case`url`:case`tel`:return(0,$.jsx)(hC,{...a,type:mO[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:sO(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,$.jsx)(zw,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:sO(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,$.jsx)(pO,{...r,field:t,spec:e,locked:n});case`money`:return(0,$.jsxs)(XC,{children:[(0,$.jsx)(ZC,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,$.jsx)(hC,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:sO(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,$.jsx)(hC,{...a,type:`date`,readOnly:e.readOnly,value:sO(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,$.jsx)(fw,{...a,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},...e.unit===void 0?{}:{unit:e.unit},...e.wrap===void 0?{}:{wrap:e.wrap},disabled:n||e.readOnly===!0,decrementLabel:`Decrease ${e.label}`,incrementLabel:`Increase ${e.label}`,value:lO(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,$.jsxs)(pw,{...a,value:sO(t),onChange:e=>{i(e.currentTarget.value)},children:[e.placeholder===void 0?null:(0,$.jsx)(`option`,{value:``,disabled:!0,children:e.placeholder}),e.options.map(e=>(0,$.jsx)(`option`,{value:e.value,disabled:e.disabled,children:e.label},e.value))]});case`combobox`:return(0,$.jsx)(HD,{id:r.id??e.name,"aria-describedby":r[`aria-describedby`],"aria-invalid":r[`aria-invalid`],"aria-required":r[`aria-required`],items:e.options,getKey:e=>e.value,getLabel:e=>e.label,isDisabled:t=>t.disabled||n||e.readOnly===!0,value:sO(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,$.jsx)(BD,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===sO(t))?.label??e.placeholder??`Choose…`}),inputProps:{"aria-label":`Search ${e.label}`,disabled:n||e.readOnly===!0},onValueChange:e=>{i(e??``),t.handleBlur()}});case`file`:return(0,$.jsx)(hO,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,$.jsx)(qw,{...a,disabled:n||e.readOnly===!0,checked:cO(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,$.jsx)(xr,{...a,disabled:n||e.readOnly===!0,checked:cO(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var _O=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function vO({spec:e,field:t,locked:n,error:r,layout:i}){let a=n||e.readOnly===!0,o=e.label;if(e.kind===`checkboxes`||e.kind===`icon-checkboxes`){let n=uO(t),s=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,$.jsx)(aw,{legend:o,icon:e.icon,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:e.kind===`icon-checkboxes`?(0,$.jsx)(`div`,{className:`caps-field-icon-choices`,children:e.options.map(r=>(0,$.jsx)(WD,{name:e.name,value:r.value,label:r.label,...r.caption===void 0?{}:{caption:r.caption},icon:r.icon,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))}):(0,$.jsx)(KD,{children:e.options.map(r=>(0,$.jsx)(GD,{name:e.name,value:r.value,label:r.label,icon:r.icon,hint:r.description,disabled:r.disabled,checked:n.includes(r.value),onBlur:t.handleBlur,onChange:e=>{s(r.value,e.currentTarget.checked)}},r.value))})})}let s=e.options.some(e=>e.description!==void 0||e.meta!==void 0);return(0,$.jsx)(aw,{legend:o,icon:e.icon,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:(0,$.jsx)(YD,{name:e.name,"aria-label":o,value:sO(t),onValueChange:e=>{t.handleChange(e),t.handleBlur()},orientation:e.kind===`icon-radio`||s?`horizontal`:`vertical`,children:e.options.map(t=>e.kind===`icon-radio`?(0,$.jsx)(QD,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):s?(0,$.jsx)(ZD,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,$.jsx)(sw,{label:t.label,orientation:`inline`,children:(0,$.jsx)(XD,{value:t.value,disabled:t.disabled})},t.value))})})}function yO({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:fO(t),onChange:e=>{t.handleChange(e)},onBlur:t.handleBlur,error:r,disabled:n,id:a.id??e.name,"aria-describedby":a[`aria-describedby`],"aria-invalid":r!==void 0})}function bO({form:e,spec:t,locked:n,layout:r}){let i=oC({form:e,name:t.name}),a=iC(e.store,e=>e.submissionAttempts>0),o=i.state.meta.isBlurred||a?fD(i.state.meta):void 0;if(t.render===void 0&&_O.has(t.kind))return(0,$.jsx)(vO,{spec:t,field:i,locked:n,error:o,layout:r});let s=r===`columns`?t.kind===`switch`||t.kind===`checkbox`?`horizontal`:`vertical`:t.kind===`checkbox`?`inline`:(t.layout??(t.kind===`switch`?`row`:`stacked`))===`row`?`horizontal`:`vertical`;return(0,$.jsx)(sw,{label:t.label,...r===`columns`?{labelTitle:t.label}:{},description:t.help,icon:t.icon,orientation:s,error:o,...t.required===void 0?{}:{required:t.required},...t.optional===void 0?{}:{optional:t.optional},children:t.render===void 0?(0,$.jsx)(gO,{spec:t,field:i,locked:n}):(0,$.jsx)(yO,{spec:t,field:i,locked:n,error:o,render:t.render})})}var xO=Dt(Le(Ve,aO));function SO({form:e,spec:t,locked:n,layout:r}){let i=t.when;return iC(e.store,e=>i===void 0||i(u(xO(e.values),()=>({}))))?(0,$.jsx)(bO,{form:e,spec:t,locked:n,layout:r}):null}function CO({form:e,section:t,locked:n,layout:r}){let i=t.fields.map(t=>(0,$.jsx)(SO,{form:e,spec:t,locked:n,layout:r},t.name));return t.title===void 0?i:(0,$.jsx)(iw,{title:t.title,description:t.description,layout:r,children:i})}function wO({model:e,names:t,disabled:n=!1,layout:r}){let i=e.form;return t===void 0?e.description.sections.map(e=>(0,$.jsx)(CO,{form:i,section:e,locked:n,layout:r},e.id??``)):t.map(t=>{let a=e.description.fields.find(e=>e.name===t);return a===void 0?null:(0,$.jsx)(SO,{form:i,spec:a,locked:n,layout:r},t)})}var TO=class{annotation;constructor(e){this.annotation=e}},EO=class{sections;constructor(e){this.sections=e}},DO=`caps/form`,OO=0;function kO(e){OO+=1;let t={[`${DO}:${String(OO)}`]:new TO(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}Ve.annotate(kO({kind:`secret`})).pipe(Ft(`Secret`));var AO=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]+/g,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)};function jO(e){return Object.values(e??{}).reduce((e,t)=>t instanceof TO?{...e,...t.annotation}:e,{})}function MO(e){return e.reduce((e,t)=>({...e,...jO(t)}),{})}function NO(e){let t=e?.[DO];return t instanceof EO?t.sections:{}}var PO=Dt(Ve);function FO(e){if(b(e))return D(PO(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!ne(e))return null;let t=[];for(let n of e.types){if(ht(n))continue;let e=FO(n);if(e===null)return null;t.push(...e)}return t}function IO(e){if(o(e))return{type:`string`,literals:[]};if(ce(e))return{type:`number`,nullable:!1};if(xe(e))return{type:`boolean`};let t=FO(e);if(t!==null)return{type:`string`,literals:t};if(Kt(e)){let[t]=e.rest;if(t===void 0)return null;if(o(t))return{type:`strings`,literals:[]};let n=FO(t);return n===null?null:{type:`strings`,literals:n}}if(ne(e)){let t=e.types.filter(e=>!ht(e)&&!_(e)),n=e.types.some(e=>_(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=IO(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function LO(e){let t=e.ast;if(!_t(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=F(e.type),r=MO([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:IO(n);if(i===null)throw Error(`Schema field "${t}" has no form control. Annotate it with field({ render }) or a kind.`);return{name:t,valueType:i,optional:e.type.context?.isOptional===!0,annotation:r,title:C(e.type),description:fe(e.type)}}),sections:NO(ae(t))}}function RO(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof St)n=!0,t=t.unwrap();else if(t instanceof et)r=!0,t=t.unwrap();else if(t instanceof Ze)t=t.unwrap();else if(t instanceof lt)t=t.in;else return{node:t,optional:n,nullable:r}}function zO(e){if(e instanceof Wt){let t=e.options.map(e=>zO(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof bt?e.options:e instanceof Ht?[...e.values]:null;if(t===null)return null;let n=t.map(e=>PO(e));return n.every(Te)?n.map(e=>e.value):null}function BO(e){let{node:t,nullable:n}=RO(e);if(t instanceof st)return{type:`string`,literals:[]};if(t instanceof at)return{type:`number`,nullable:n};if(t instanceof zt)return{type:`boolean`};let r=zO(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof Ot){let e=RO(t.element).node;if(e instanceof st)return{type:`strings`,literals:[]};let n=zO(e);return n===null?null:{type:`strings`,literals:n}}return null}function VO(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof St||e instanceof et||e instanceof Ze?e.unwrap():e instanceof lt?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>oe.get(e))}function HO(e){return VO(e).reduce((e,t)=>({...e,...t}),{})}function UO(e){return Object.entries(e.shape)}function WO(e){let t=RO(e).node;if(!(t instanceof At))throw Error(`A schema form needs a z.object.`);return{fields:UO(t).map(([e,t])=>{let n=MO(VO(t)),r=n.kind===`file`?{type:`files`}:BO(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=HO(t);return{name:e,valueType:r,optional:RO(t).optional,annotation:n,title:i.title,description:i.description}}),sections:NO(HO(e))}}function GO(e,t){let n=t.options??{};return(e.length>0?e:Object.keys(n)).map(e=>{let t=n[e],r=t===void 0?{}:t instanceof Object?t:{label:t};return{value:e,label:r.label??AO(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function KO(e,t){let n=t.some(e=>e.icon!==void 0);switch(e.type){case`boolean`:return`switch`;case`number`:return`number`;case`strings`:return n?`icon-checkboxes`:`checkboxes`;case`files`:return`file`;case`string`:return t.length===0?`text`:t.length>12?`combobox`:n?`icon-radio`:t.some(e=>e.description!==void 0||e.meta!==void 0)||t.length<=3?`radio`:`select`}}function qO(e,t){switch(e.type){case`boolean`:return!1;case`number`:return e.nullable?null:0;case`strings`:case`files`:return[];case`string`:return t[0]?.value??``}}function JO(e){let t=e instanceof We?WO(e):LO(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=GO(e.valueType.type===`string`||e.valueType.type===`strings`?e.valueType.literals:[],e.annotation),a=r.help??e.description;return{...r,name:e.name,label:r.label??e.title??AO(e.name),help:a,kind:n??KO(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=qO(e.valueType,i.options))});let i=e=>e.order??e.index,a=e=>e.section!==void 0&&Object.hasOwn(t.sections,e.section)?e.section:null,o=e=>n.filter(t=>a(t)===e).sort((e,t)=>i(e)-i(t)),s=Object.entries(t.sections).map(([e,t])=>({id:e,title:t.title,description:t.description,fields:o(e)}));return{fields:n,sections:[{id:null,title:void 0,description:void 0,fields:o(null)},...s].filter(e=>e.fields.length>0),defaults:r}}function YO(e){let t=e instanceof We?e:m(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>XO(e)):XO(n)}}}}function XO(e){return e.issues===void 0?e:{issues:e.issues.map(e=>e.path===void 0?e:{...e,path:e.path.slice(0,1)})}}var ZO=`onServer`;function QO(e){let t=e?.querySelector(`[aria-invalid="true"]`);t?.matches(`input, select, textarea, button, [tabindex]`)?t.focus():t?.querySelector(`input, select, textarea, button`)?.focus()}function $O(e){return e.state.meta.errorMap.onServer!==void 0}function ek(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[ZO]:void 0}}))}function tk(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[ZO]:n}}))}function nk(e){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null),[a,o]=(0,J.useState)(e.defaultValues),[s,c]=(0,J.useState)(null);wS(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,J.useMemo)(()=>JO(l),[l]),d=(0,J.useMemo)(()=>YO(l),[l]),f=mC({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),$O(e)&&ek(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await YO(l)[`~standard`].validate(t);if(a.issues){n(a.issues[0]?.message??`Check the form and try again.`);return}let o;try{o=await e.onSubmit(a.value,t)??{kind:`saved`}}catch(t){console.error(`SchemaForm submit failed`,t),n(e.failure??`Couldn't save changes. Try again.`);return}if(o.kind===`refused`){n(o.error??null);let e=r;for(let[t,n]of Object.entries(o.fields??{}))n!==void 0&&n.length>0&&tk(e,t,n);return}let s=o.values??t;c(s),r.reset(s),i(o.message??`Saved`),e.onSaved?.(s)}});return{description:u,form:f,error:t,saved:r,discard:()=>{n(null),i(null),f.reset()},submit:()=>f.handleSubmit()}}function rk(e){return{dirty:iC(e.form.store,e=>!e.isDefaultValue),submitting:iC(e.form.store,e=>e.isSubmitting),canSubmit:iC(e.form.store,e=>e.canSubmit)}}function ik({model:e,submitLabel:t=`Save changes`,discardLabel:n,onCancel:r,cancelLabel:i,allowClean:a,layout:o,footer:s,children:c,disabled:l=!1,...u}){let{submitting:d}=rk(e),f=(0,J.useRef)(null);return(0,$.jsxs)(nw,{...u,ref:f,layout:o,busy:d,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit().then(()=>{setTimeout(()=>{QO(f.current)},0)})},children:[c??(0,$.jsx)(wO,{model:e,disabled:l,layout:o}),s===void 0?(0,$.jsx)(sk,{model:e,label:t,discardLabel:r===void 0?n:void 0,onCancel:r,cancelLabel:i,allowClean:a??r!==void 0,divider:r===void 0}):s]})}function ak({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i,...a}){let o=nk({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i});return(0,$.jsx)(ik,{...a,model:o})}function ok(e){return`model`in e?(0,$.jsx)(ik,{...e}):(0,$.jsx)(ak,{...e})}function sk({model:e,label:t,discardLabel:n,onCancel:r,cancelLabel:i=`Cancel`,allowClean:a=!1,dirtyLabel:o=`Unsaved changes`,buttonProps:s,...c}){let{dirty:l,submitting:u}=rk(e),d=u?null:e.saved&&!l?(0,$.jsx)(Hb,{tone:`success`,size:`compact`,label:e.saved}):l?(0,$.jsx)(Hb,{tone:`neutral`,size:`compact`,label:o}):null;return(0,$.jsxs)(tw,{...c,error:e.error,status:d,children:[r?(0,$.jsx)(Nr,{type:`button`,variant:`ghost`,disabled:u,onClick:r,children:i}):n&&l?(0,$.jsx)(Nr,{type:`button`,variant:`ghost`,disabled:u,onClick:e.discard,children:n}):null,(0,$.jsx)(Nr,{...s,type:`submit`,loading:u,disabled:u||!l&&!a,title:!l&&!a?`No changes to save`:void 0,children:t})]})}var ck={error:0,warning:1,info:2};function lk(e,t){let n=t.generating+t.uploading>0;if(n)return{busy:n,tone:void 0,label:[t.generating?`Creating ${String(t.generating)}`:``,t.uploading?`Uploading ${String(t.uploading)}`:``].filter(Boolean).join(` · `)};let r=[...e].sort((e,t)=>Number(t.blocking??!1)-Number(e.blocking??!1)||ck[e.tone]-ck[t.tone]).at(0);return r?{busy:n,tone:r.tone===`info`?`neutral`:r.tone,label:r.short+(e.length>1?` +${String(e.length-1)}`:``)}:null}function uk(e,t,n){let r=lk(e,t);if(!r)return null;let i={kind:`button`,id:`activity`,text:`Activity`,count:e.length+t.generating+t.uploading,busy:r.busy,title:it(`Activity: ${r.label}`,1024),opens:`dialog`,expanded:n};return r.tone===void 0?i:{...i,tone:r.tone}}var dk={Setup:(0,$.jsx)(rx,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),Images:(0,$.jsx)(Qb,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),Uploads:(0,$.jsx)(ax,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`})};function fk({notices:e,uploads:t,open:n,inset:r,onOpenChange:i,onDismiss:a,onDismissAll:o,onLoadMore:s}){return(0,$.jsx)(Fw,{className:`prints-activity-tray`,placement:`host`,align:`start`,...r===void 0?{}:{hostInset:r},items:[{id:`activity`,label:`Activity`,title:`Activity`,content:(0,$.jsx)(pk,{notices:e,uploads:t,onDismiss:a,onDismissAll:o,onLoadMore:s})}],openId:n?`activity`:null,onOpenChange:e=>{i(e===`activity`)}})}function pk({notices:e,uploads:t,onDismiss:n,onDismissAll:r,onLoadMore:i}){let a=[`Setup`,`Images`,`Uploads`].map(t=>({group:t,items:e.filter(e=>e.group===t)})).filter(e=>e.items.length);return(0,$.jsxs)(`div`,{className:`prints-instrument`,children:[a.map(({group:e,items:t})=>(0,$.jsxs)(`section`,{"aria-label":e,className:`prints-notice-group`,children:[(0,$.jsx)(Ar,{level:3,children:e}),(0,$.jsx)(Iw,{children:t.map(e=>(0,$.jsx)(Lw,{icon:dk[e.group],primary:e.title,secondary:e.detail,actions:(0,$.jsxs)(`div`,{className:`prints-notice-actions`,"aria-label":`Actions for ${e.title}`,children:[e.actions?.map(e=>(0,$.jsx)(Nr,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label)),e.blocking?null:(0,$.jsx)(cr,{"aria-label":`Dismiss ${e.title}`,icon:(0,$.jsx)(mn,{"aria-hidden":`true`}),onClick:()=>{n(e.key)}})]})},e.key))})]},e)),e.length?null:(0,$.jsx)(Rw,{children:`All caught up.`}),t&&t.items.length>0?(0,$.jsxs)(`section`,{"aria-label":`Upload queue`,className:`prints-upload-bank`,children:[(0,$.jsx)(Ar,{level:3,children:`Uploading`}),(0,$.jsx)(hD,{...t})]}):null,(0,$.jsxs)(`div`,{className:`prints-panel-footer`,children:[(0,$.jsx)(`span`,{className:`prints-footer-note`,children:`Clear keeps setup notices`}),(0,$.jsx)(Nr,{variant:`ghost`,size:`xs`,disabled:!e.some(e=>!e.blocking),onClick:r,children:`Clear`}),i?(0,$.jsx)(Nr,{variant:`ghost`,size:`xs`,onClick:i,children:`Load more activity`}):null]})]})}function mk({folder:e}){return(0,$.jsx)(Cy,{open:e.editing,onOpenChange:e.setEditing,children:(0,$.jsxs)(Oy,{children:[(0,$.jsx)(Ay,{children:(0,$.jsx)(jy,{children:`Save prints to`})}),(0,$.jsx)(gk,{folder:e},e.computerId),(0,$.jsx)(ky,{children:(0,$.jsx)(My,{render:(0,$.jsx)(Nr,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var hk=me({path:i.check(Qt($e(Un),{message:`Enter an absolute Computer folder, such as /media.`})).annotate(kO({label:`Folder`,placeholder:`/media`}))});function gk({folder:e}){let t=(0,J.useRef)(!1),n=nk({schema:hk,defaultValues:{path:e.path??`/media`},onSubmit:async({path:n})=>{let r=await e.choose(n,t.current);return r?{kind:`refused`,fields:{path:r}}:{kind:`saved`}}}),r=e=>{t.current=e,n.form.setFieldMeta(`path`,e=>({...e,errorMap:{...e.errorMap,onServer:void 0}}))},i=e.busy||!e.writable;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ok,{model:n,disabled:i,footer:(0,$.jsxs)(tw,{divider:!1,children:[(0,$.jsx)(yt,{className:`[--caps-keycap-width:auto]`,label:`Use`,type:`submit`,disabled:i,onClick:()=>{r(!1)}}),(0,$.jsx)(yt,{className:`[--caps-keycap-width:auto]`,label:`Create`,type:`submit`,disabled:i,onClick:()=>{r(!0)}})]})}),e.error?(0,$.jsx)(Lw,{role:`alert`,icon:(0,$.jsx)(Zb,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),primary:e.error}):(0,$.jsx)(Rw,{children:e.writable?`Prints saves new images and uploads here and shows this folder as your gallery.`:`This Computer is read-only for Prints, so the folder can’t change.`})]})}function _k({connected:e,mediaCapability:t,modelsError:n,retryModels:r,modelsLoading:i,models:a,canGenerate:o,canWrite:s,generationError:c,recoveryError:l,pendingGenerations:u,activeGenerations:d,gallerySlots:f,computerId:p,failed:m,uploadError:h,uploads:g,permissions:_,resume:v,discard:y,retryUpload:b}){let x=[];if(e)p===null?x.push({key:`no-computer`,group:`Setup`,tone:`info`,blocking:!0,short:`Choose a Computer`,title:`No Computer selected`,detail:`Choose a Computer for this window, or create one in Grove.`}):t?n===null?!i&&!o&&x.push({key:`approval`,group:`Setup`,tone:`warning`,blocking:!0,short:`Generation not enabled`,title:`Media generation isn’t enabled`,detail:`Turn it on in this App’s Team permissions. Images already generated can still be saved.`,actions:[{label:`Permissions`,run:()=>{_()}}]}):x.push({key:`models:${n}`,group:`Setup`,tone:`warning`,blocking:!0,short:`Models unavailable`,title:`Couldn’t load image models`,detail:n,actions:[{label:`Retry`,run:r}]}):x.push({key:`no-media`,group:`Setup`,tone:`info`,blocking:!0,short:`Image creation off`,title:`Image creation is off for this Computer`,detail:`You can still browse and upload images.`});else{let e=nn(new K(`Prints disconnected`,{code:`DISCONNECTED`,retryable:!0}));x.push({key:`disconnected`,group:`Setup`,tone:`warning`,blocking:!0,short:e.title,title:e.title,detail:e.message})}if(e&&p!==null&&!s&&x.push({key:`read-only`,group:`Setup`,tone:`info`,blocking:!0,short:`Read-only`,title:`Read-only Computer`,detail:`Uploads and new prints are off.`}),c!==null){let e=c.mediaKind??`media`;x.push({key:c.key,group:`Images`,tone:`error`,short:{image:`Image failed`,video:`Video failed`,media:`Media failed`}[e],title:`Couldn’t create ${e}`,detail:c.message,actions:c.billing?[{label:`Open Billing`,run:c.billing}]:c.retry?[{label:`Retry`,run:c.retry}]:[]})}l!==null&&x.push({key:`recovery:${l}`,group:`Images`,tone:`error`,short:`Retry blocked`,title:l});for(let e of u){if(d.has(e.reference.requestId)||f.some(t=>t.computerId===e.reference.computerId&&t.path===e.input.destination.path))continue;let t=`Unfinished ${Qn(a,e.input.settings.model)?.kind??`media`}`;x.push({key:`unfinished:${e.reference.requestId}`,group:`Images`,tone:`info`,short:t,title:t,detail:e.reference.computerId===p?e.input.settings.prompt:`${e.input.settings.prompt} · on Computer ${e.reference.computerId}`,actions:[...e.reference.computerId===p?[{label:`Resume`,run:()=>{v(e)}}]:[],{label:`Discard`,run:()=>{y(e)}}]})}m.length>0&&x.push({key:`files:${m.join(`|`)}`,group:`Images`,tone:`error`,short:`Couldn’t open images`,title:`Couldn’t open some images`,detail:m.join(`, `)}),h!==null&&x.push({key:`uploads:${h}`,group:`Uploads`,tone:`error`,short:`Upload failed`,title:`Couldn’t add images`,detail:h});for(let e of g)(e.status===`error`||e.status===`cancelled`)&&x.push({key:`upload:${e.id}:${e.status}`,group:`Uploads`,tone:e.status===`error`?`error`:`info`,short:`Upload failed`,title:`${e.file.name} wasn’t saved`,detail:e.message,actions:[{label:`Retry`,run:()=>{b(e.id)}}]});return x}function vk(e,t){let n=Ln(Rr(e)),r=pt(gn({queryKey:Er.dismissals(e),mutationFn:({owner:e,id:t,keys:n})=>Cn(e.capabilities,{operation:`dismiss-notices`,computerId:t,keys:n}),apply:(e,t)=>({keys:[...new Set([...e.keys,...t.keys])].slice(-200)})})),i=n=>{e&&t&&n.length>0&&r.mutate({owner:e,id:t,keys:n})};return{error:r.variables?.owner===e&&r.variables.id===t&&r.isError?`Could not dismiss activity. Please try again.`:n.isError?`Could not load dismissed activity. Notices may reappear.`:null,visible:e=>e.filter(e=>(e.blocking??!1)||!n.data?.keys.includes(e.key)),dismiss:e=>{i([e])},dismissAll:e=>{i(e.filter(e=>!e.blocking).map(e=>e.key).slice(-200))}}}var yk=0,bk=1,xk=2,Sk=0,Ck=1;function wk(e,t,n){let r=e.list,i;for(;r;){if(r.index===n)return!1;if(t>r.high)break;i=r,r=r.next}return i||(e.list={index:n,high:t,next:r}),i&&(i.next={index:n,high:t,next:i.next}),!0}function Tk(e,t){let n=e.list;if(n.index===t)return n.next===null?Sk:(e.list=n.next,Ck);let r=n;for(n=n.next;n!==null;){if(n.index===t)return r.next=n.next,Ck;r=n,n=n.next}}var Ek={low:0,max:0,high:0,C:xk,P:void 0,R:void 0,L:void 0,list:void 0};Ek.P=Ek,Ek.L=Ek,Ek.R=Ek;function Dk(e){let t=e.high;e.max=e.L===Ek&&e.R===Ek?t:e.L===Ek?Math.max(e.R.max,t):e.R===Ek?Math.max(e.L.max,t):Math.max(Math.max(e.L.max,e.R.max),t)}function Ok(e){let t=e;for(;t.P!==Ek;)Dk(t.P),t=t.P}function kk(e,t){if(t.R===Ek)return;let n=t.R;t.R=n.L,n.L!==Ek&&(n.L.P=t),n.P=t.P,t.P===Ek?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.L=t,t.P=n,Dk(t),Dk(n)}function Ak(e,t){if(t.L===Ek)return;let n=t.L;t.L=n.R,n.R!==Ek&&(n.R.P=t),n.P=t.P,t.P===Ek?e.root=n:t===t.P.R?t.P.R=n:t.P.L=n,n.R=t,t.P=n,Dk(t),Dk(n)}function jk(e,t,n){t.P===Ek?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.P=t.P}function Mk(e,t){let n;for(;t!==Ek&&t.C===bk;)t===t.P.L?(n=t.P.R,n.C===yk&&(n.C=bk,t.P.C=yk,kk(e,t.P),n=t.P.R),n.L.C===bk&&n.R.C===bk?(n.C=yk,t=t.P):(n.R.C===bk&&(n.L.C=bk,n.C=yk,Ak(e,n),n=t.P.R),n.C=t.P.C,t.P.C=bk,n.R.C=bk,kk(e,t.P),t=e.root)):(n=t.P.L,n.C===yk&&(n.C=bk,t.P.C=yk,Ak(e,t.P),n=t.P.L),n.R.C===bk&&n.L.C===bk?(n.C=yk,t=t.P):(n.L.C===bk&&(n.R.C=bk,n.C=yk,kk(e,n),n=t.P.L),n.C=t.P.C,t.P.C=bk,n.L.C=bk,Ak(e,t.P),t=e.root));t.C=bk}function Nk(e){for(;e.L!==Ek;)e=e.L;return e}function Pk(e,t){let n;for(;t.P.C===yk;)t.P===t.P.P.L?(n=t.P.P.R,n.C===yk?(t.P.C=bk,n.C=bk,t.P.P.C=yk,t=t.P.P):(t===t.P.R&&(t=t.P,kk(e,t)),t.P.C=bk,t.P.P.C=yk,Ak(e,t.P.P))):(n=t.P.P.L,n.C===yk?(t.P.C=bk,n.C=bk,t.P.P.C=yk,t=t.P.P):(t===t.P.L&&(t=t.P,Ak(e,t)),t.P.C=bk,t.P.P.C=yk,kk(e,t.P.P)));e.root.C=bk}function Fk(){let e={root:Ek,size:0},t={};return{insert(n,r,i){let a=e.root,o=Ek;for(;a!==Ek&&(o=a,n!==o.low);)a=n<a.low?a.L:a.R;if(n===o.low&&o!==Ek){if(!wk(o,r,i))return;o.high=Math.max(o.high,r),Dk(o),Ok(o),t[i]=o,e.size++;return}let s={low:n,high:r,max:r,C:yk,P:o,L:Ek,R:Ek,list:{index:i,high:r,next:null}};o===Ek?e.root=s:(s.low<o.low?o.L=s:o.R=s,Ok(s)),Pk(e,s),t[i]=s,e.size++},remove(n){let r=t[n];if(r===void 0)return;delete t[n];let i=Tk(r,n);if(i===void 0)return;if(i===Ck){r.high=r.list.high,Dk(r),Ok(r),e.size--;return}let a=r,o=a.C,s;r.L===Ek?(s=r.R,jk(e,r,r.R)):r.R===Ek?(s=r.L,jk(e,r,r.L)):(a=Nk(r.R),o=a.C,s=a.R,a.P===r?s.P=a:(jk(e,a,a.R),a.R=r.R,a.R.P=a),jk(e,r,a),a.L=r.L,a.L.P=a,a.C=r.C),Dk(s),Ok(s),o===bk&&Mk(e,s),e.size--},search(t,n,r){let i=[e.root];for(;i.length!==0;){let e=i.pop();if(!(e===Ek||t>e.max)&&(e.L!==Ek&&i.push(e.L),e.R!==Ek&&i.push(e.R),e.low<=n&&e.high>=t)){let n=e.list;for(;n!==null;)n.high>=t&&r(n.index,e.low),n=n.next}}},get size(){return e.size}}}var Ik=e=>{let t=J.useRef(e);return J.useEffect(()=>{t.current=e}),t},Lk=(e,t)=>{let n=t||Rk,r,i;return function(){return r&&n(arguments,r)?i:i=e.apply(null,r=arguments)}},Rk=(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3],zk=class{constructor(){this.set=void 0,this.get=void 0;let e,t;this.get=n=>n===e?t:void 0,this.set=(n,r)=>{e=n,t=r}}},Bk=e=>{try{return new e}catch{let e={};return{set(t,n){e[t]=n},get(t){return e[t]}}}},Vk=e=>{let t=e.length,n=Bk(e[0]),r,i,a,o,s=t===1;return t<3?{g:e=>(r=n.get(e[0]))===void 0||s?r:r.get(e[1]),s:(t,a)=>(s?n.set(t[0],a):(r=n.get(t[0]))===void 0?(i=Bk(e[1]),i.set(t[1],a),n.set(t[0],i)):r.set(t[1],a),a)}:{g:e=>{for(o=n,a=0;a<t;a++)if((o=o.get(e[a]))===void 0)return;return o},s:(r,s)=>{for(o=n,a=0;a<t-1;a++)(i=o.get(r[a]))===void 0?(i=Bk(e[a+1]),o.set(r[a],i),o=i):o=i;return o.set(r[t-1],s),s}}},Hk=(e,t)=>{let n,{g:r,s:i}=Vk(e);return function(){return(n=r(arguments))===void 0?i(arguments,t.apply(null,arguments)):n}},Uk=new WeakMap;function Wk(){let e=J.useState(Gk)[1];return J.useRef(()=>e({})).current}var Gk={},Kk=J.createElement;function qk(e){let{positioner:t,resizeObserver:n,items:r,as:i=`div`,id:a,className:o,style:s,role:c=`grid`,tabIndex:l=0,containerRef:u,itemAs:d=`div`,itemStyle:f,itemHeightEstimate:p=300,itemKey:m=$k,overscanBy:h=2,scrollTop:g,isScrolling:_,height:v,render:y,onRender:b}=e,x=0,S,C=Wk(),w=tA(t,n),T=r.length,{columnWidth:E,columnCount:D,range:O,estimateHeight:k,size:A,shortestColumn:j}=t,M=A(),N=j(),P=[],F=c===`list`?`listitem`:c===`grid`?`gridcell`:void 0,I=Ik(b);h=v*h;let L=g+h,R=N<L&&M<T;if(O(Math.max(0,g-h/2),L,(e,t,n)=>{let i=r[e],a=m(i,e),o={top:n,left:t,width:E,writingMode:`horizontal-tb`,position:`absolute`};P.push(Kk(d,{key:a,ref:w(e),role:F,style:typeof f==`object`&&f?Object.assign({},o,f):o},Yk(y,e,i,E))),S===void 0?(x=e,S=e):(x=Math.min(x,e),S=Math.max(S,e))}),R){let e=Math.min(T-M,Math.ceil((g+h-N)/p*D)),t=M,n=eA(E);for(;t<M+e;t++){let e=r[t],i=m(e,t);P.push(Kk(d,{key:i,ref:w(t),role:F,style:typeof f==`object`?Object.assign({},n,f):n},Yk(y,t,e,E)))}}J.useEffect(()=>{typeof I.current==`function`&&S!==void 0&&I.current(x,S,r),Jk=`1`},[x,S,r,I]),J.useEffect(()=>{R&&C()},[R,t]);let z=Xk(_,k(T,p));return Kk(i,{ref:u,key:Jk,id:a,role:c,className:o,tabIndex:l,style:typeof s==`object`?Qk(z,s):z,children:P})}var Jk=`0`,Yk=Hk([zk,{},WeakMap,zk],(e,t,n,r)=>Kk(e,{index:t,data:n,width:r})),Xk=Lk((e,t)=>({position:`relative`,width:`100%`,maxWidth:`100%`,height:Math.ceil(t),maxHeight:Math.ceil(t),willChange:e?`contents`:void 0,pointerEvents:e?`none`:void 0})),Zk=(e,t)=>e[0]===t[0]&&e[1]===t[1],Qk=Lk((e,t)=>Object.assign({},e,t),Zk);function $k(e,t){return t}var eA=Lk(e=>({width:e,zIndex:-1e3,visibility:`hidden`,position:`absolute`,writingMode:`horizontal-tb`}),(e,t)=>e[0]===t[0]),tA=Lk((e,t)=>n=>r=>{r!==null&&(t&&(t.observe(r),Uk.set(r,n)),e.get(n)===void 0&&e.set(n,r.offsetHeight))},Zk),nA=function(e,t,n,r){n===void 0&&(n=0),r===void 0&&(r=n);let i=Fk(),a=Array(e),o=[],s=Array(e);for(let t=0;t<e;t++)a[t]=0,s[t]=[];return{columnCount:e,columnWidth:t,set:function(e,c){c===void 0&&(c=0);let l=0;for(let e=1;e<a.length;e++)a[e]<a[l]&&(l=e);let u=a[l]||0;a[l]=u+c+r,s[l].push(e),o[e]={left:l*(t+n),top:u,height:c,column:l},i.insert(u,u+c,e)},get:e=>o[e],update:t=>{let n=Array(e),c=0,l=0;for(;c<t.length-1;c++){let e=t[c],r=o[e];r.height=t[++c],i.remove(e),i.insert(r.top,r.top+r.height,e),n[r.column]=n[r.column]===void 0?e:Math.min(e,n[r.column])}for(c=0;c<n.length;c++){if(n[c]===void 0)continue;let e=s[c],t=rA(e,n[c]),u=s[c][t],d=o[u];for(a[c]=d.top+d.height+r,l=t+1;l<e.length;l++){let t=e[l],n=o[t];n.top=a[c],a[c]=n.top+n.height+r,i.remove(t),i.insert(n.top,n.top+n.height,t)}}},range:(e,t,n)=>i.search(e,t,(e,t)=>n(e,o[e].left,t)),estimateHeight:(t,n)=>{let r=Math.max(0,Math.max.apply(null,a));return t===i.size?r:r+Math.ceil((t-i.size)/e)*n},shortestColumn:()=>a.length>1?Math.min.apply(null,a):a[0]||0,size(){return i.size},all(){return o}}},rA=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){let i=n+r>>>1,a=e[i];if(a===t)return i;a<=t?n=i+1:r=i-1}return-1},iA=0,aA=320,oA=656;function sA(e,t){return e<=0||!Number.isFinite(t)||t<=0?0:e===1?1:e<=4?2:t>=1280?4:t>=oA?3:2}function cA({item:e}){return un(e.path)?(0,$.jsx)(`video`,{"aria-label":e.path,className:`block h-full w-full object-cover`,"data-media-thumb":!0,loop:!0,muted:!0,playsInline:!0,src:e.url}):(0,$.jsx)(`img`,{alt:e.path,className:`block h-full w-full object-cover`,"data-media-thumb":!0,src:e.url})}var lA=(0,J.memo)(function({item:e}){let t=(0,J.useRef)(null);(0,J.useEffect)(()=>{e.onVisible?.()},[e.onVisible]);let[n,r]=(0,J.useState)(e.pending===!0&&!e.onVisible);return e.pending&&!e.onVisible&&!n&&r(!0),(0,J.useLayoutEffect)(()=>{let r=t.current;if(!r||e.pending||n)return;let i=window.matchMedia(`(prefers-reduced-motion: reduce)`);if(i.matches)return;let a=!0,o,s,c=()=>o?.();return ir(async()=>{let{animate:e,spring:t}=await import(`./modules-C4mfDnjH.js`).then(e=>e.t);return{animate:e,spring:t}},__vite__mapDeps([4,1]),import.meta.url).then(({animate:e,spring:t})=>{if(!a)return;let n=e(r,{opacity:{from:0,to:1,duration:160,ease:`outQuad`},translateY:{from:6,to:0,ease:t({bounce:.16,duration:320})},scale:{from:.985,to:1,ease:t({bounce:.16,duration:320})}});o=()=>{n.complete()},s=()=>{n.revert()}}),i.addEventListener(`change`,c),()=>{a=!1,i.removeEventListener(`change`,c),s?.()}},[e.key,e.pending,n]),(0,$.jsxs)(`div`,{ref:t,className:`prints-gallery-tile`,"data-referenced":e.referenced?!0:void 0,children:[(0,$.jsx)(`button`,{className:`block h-full w-full overflow-hidden bg-base-200 p-0 text-left`,"data-media-thumb-wrap":!0,type:`button`,disabled:e.pending,onClick:()=>{e.onOpen(e.path)},onKeyDown:t=>{t.key.toLowerCase()===`i`&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&e.onInfo&&(t.preventDefault(),e.onInfo())},title:e.path,children:(0,$.jsx)(`div`,{className:`caps-item block! h-full w-full overflow-hidden rounded-none! border-0! bg-transparent! shadow-none! z-auto! -outline-offset-2!`,"data-selected":e.selected??!1,children:e.pending||n||e.error?(0,$.jsx)(Py,{"data-media-pending":e.pending?`true`:void 0,failure:e.error?(0,$.jsx)(`span`,{title:e.error,className:`prints-tile-failed`,children:(0,$.jsx)(Hb,{size:`compact`,appearance:`chip`,glyph:`bang`,tone:`error`,label:`Not saved`})}):void 0,indicator:(0,$.jsx)(zr,{decorative:!0,size:`fill`,tone:`accent`,variant:`bloom`}),label:e.pendingLabel??`Preparing image…`,status:e.pending?e.error?`failed`:`generating`:`done`,children:e.pending?null:(0,$.jsx)(cA,{item:e})}):(0,$.jsx)(cA,{item:e})})}),e.error?(0,$.jsxs)(`div`,{className:`prints-gallery-pending-actions`,children:[e.onRetry?(0,$.jsx)(cr,{"aria-label":`Retry ${e.path}`,icon:(0,$.jsx)(mr,{}),onClick:e.onRetry}):null,e.onDismiss?(0,$.jsx)(cr,{"aria-label":`Dismiss ${e.path}`,icon:(0,$.jsx)(mn,{}),onClick:e.onDismiss}):null]}):null,(0,$.jsxs)(`div`,{className:`prints-gallery-tools`,children:[!e.pending&&e.onInfo?(0,$.jsx)(cr,{"aria-label":`Image info: ${e.path}`,title:`Image info (I)`,"aria-keyshortcuts":`I`,onClick:e.onInfo,icon:(0,$.jsx)($b,{})}):null,!e.pending&&e.onToggleReference?(0,$.jsx)(cr,{className:`prints-gallery-reference`,"aria-label":`${e.referenced?`Remove reference`:`Add reference`}: ${e.path}`,title:e.referenced?`Remove reference`:`Add reference`,"aria-pressed":e.referenced??!1,disabled:e.referenceDisabled,onClick:e.onToggleReference,icon:e.referenced?(0,$.jsx)(Br,{}):(0,$.jsx)(Qb,{})}):null]})]})}),uA=(0,J.memo)(function({children:e,style:t,...n}){return(0,$.jsx)(`div`,{"data-media-grid":!0,...n,style:t,children:e})});function dA(e,t){let[n,r]=(0,J.useState)({height:0,width:0});return(0,J.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{r(e=>{let n={height:t.clientHeight,width:t.clientWidth};return n.width===e.width&&n.height===e.height?e:n})};n();let i=new ResizeObserver(n);return i.observe(t),window.addEventListener(`resize`,n),()=>{i.disconnect(),window.removeEventListener(`resize`,n)}},[e,t]),n}function fA(e){let[t,n]=(0,J.useState)(0),[r,i]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{let t=e.current;if(!t)return;let r=null,a=()=>{n(t.scrollTop),i(!0),r!==null&&clearTimeout(r),r=setTimeout(()=>{i(!1)},150)};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{t.removeEventListener(`scroll`,a),r!==null&&clearTimeout(r)}},[e]),{isScrolling:r,scrollTop:t}}function pA(e,t){let n=Math.max(1,sA(e.length,t));return(0,J.useMemo)(()=>{let r=Math.floor((t-(n-1)*iA)/n),i=nA(n,r,iA);return r>0&&e.forEach((e,t)=>{let n=e.height>0?e.width/e.height:1;i.set(t,r/n)}),i},[e,t,n])}var mA=(0,J.memo)(function({data:e,width:t}){let n=e.height>0?e.width/e.height:1;return(0,$.jsx)(`div`,{"data-media-tile":e.key,style:{height:t/n,width:t},children:(0,$.jsx)(lA,{item:e})})});function hA(e,t){let n=Array.from(e.querySelectorAll(`[data-media-tile]`)).find(e=>e.dataset.mediaTile===t)?.querySelector(`[data-media-thumb-wrap]`);return!n||n.disabled?!1:(n.focus({preventScroll:!0}),!0)}function gA(e,t,n){let r=e.ownerDocument;(r.activeElement!==r.body||hA(e,t))&&n()}function _A(e,t,n){let r=n.top+t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;return(r<e.scrollTop||r+n.height>e.scrollTop+e.clientHeight)&&e.scrollTo({top:r,behavior:`instant`}),r}var vA=(0,J.memo)(function({items:e,scrollRef:t,focus:n}){let r=dA(t,e.length),i=r.width||aA,a=pA(e,i),{isScrolling:o,scrollTop:s}=fA(t),c=(0,J.useRef)(new Set),l=(0,J.useRef)(null),u=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(!n)return;let o=l.current===n.requestId;if(o&&u.current===i)return;let s=t.current,c=e.findIndex(e=>e.key===n.key),d=a.get(c);if(!s||!d||r.height===0)return;let f=s.querySelector(`[data-media-grid]`);if(!f)return;let p=_A(s,f,d);if(o){gA(s,n.key,()=>{u.current=i});return}hA(s,n.key)?(l.current=n.requestId,u.current=i,n.onFocus()):s.scrollTo({top:p,behavior:`instant`})},[n,e,r.height,t,s,a,i]),(0,J.useEffect)(()=>{let n=t.current;if(!n||r.width===0||r.height===0)return;let i=e.reduce((e,t,n)=>t.pending&&!t.onVisible&&!c.current.has(t.key)?n:e,-1);if(c.current=new Set(e.map(e=>e.key)),i<0)return;let o=a.get(i),s=n.querySelector(`[data-media-grid]`);if(!o||!s)return;let l=s.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop+o.top,u=l+o.height;l>=n.scrollTop&&u<=n.scrollTop+n.clientHeight||n.scrollTo({top:Math.max(0,l-Math.max(0,(n.clientHeight-o.height)/2)),behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},[e,r.width,r.height,t,a]);let d=(0,J.useCallback)(({data:e,width:t})=>(0,$.jsx)(mA,{data:e,width:t}),[]);return qk({as:uA,height:r.height,isScrolling:o,itemKey:e=>e.key,items:e,overscanBy:2,positioner:a,render:d,scrollTop:s})});function yA({items:e,scrollRef:t,focus:n}){return(0,$.jsx)(`section`,{"data-media-mosaic":!0,children:(0,$.jsx)(vA,{items:e,scrollRef:t,focus:n})})}function bA(e,t,n){let r=new Map(e.map(e=>[e.key,e])),i=new Set(t.map(e=>e.key));return[...t.filter(e=>!e.resolved||r.has(e.key)).map(e=>{let t=r.get(e.key);return t&&e.resolved?t:n(e)}),...e.filter(e=>!i.has(e.key))]}var xA=`prints-prompt-counter`;function SA({busy:e,disabled:t,draft:n,label:r,onGenerate:i,promptOver:a}){return(0,$.jsx)(Aw,{"aria-describedby":a?xA:void 0,"aria-label":r,className:`prints-generate`,"data-generation-submit":!0,disabled:t||a,onClick:i,state:iT({draft:n,busy:e}),title:r})}function CA({caretRequest:e,disabled:t,maxLength:n,addedLength:r=0,menu:i,mentionCount:a,onCaret:o,onChange:s,onMentionDismiss:c,onMentionMove:l,onMentionPick:u,onSend:d,onSlashMove:f,onSlashPick:p,placeholder:m,slashCount:h,value:g}){let _=(0,J.useRef)(null),v=(0,J.useRef)(g),[y,b]=(0,J.useState)([]),[x,S]=(0,J.useState)(-1),[C,w]=(0,J.useState)(!1),T=(0,J.useRef)(!1),E=(0,J.useRef)(!1);v.current=g,(0,J.useLayoutEffect)(()=>{if(C||t||!E.current)return;E.current=!1;let e=_.current;e&&e.ownerDocument.activeElement===e.ownerDocument.body&&e.focus({preventScroll:!0})},[t,C]),(0,J.useLayoutEffect)(()=>{let t=_.current;!t||e?.value!==g||(t.setSelectionRange(e.caret,e.caret),t.focus({preventScroll:!0}))},[e,g]),oT(_,g);let D=(0,J.useCallback)(async()=>{let e=v.current.trim();if(!(!e||t||T.current)&&!(n!==void 0&&e.length+r>n)){E.current=_.current===_.current?.ownerDocument.activeElement,T.current=!0,w(!0);try{if(!await d())return;b(t=>t.at(-1)===e?t:[...t,e].slice(-20)),S(-1)}finally{T.current=!1,w(!1)}}},[t,n,d,r]),O=g.trim().length,k=O>0?O+r:0,A=n!==void 0&&k>n;return(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,$.jsx)(zw,{"aria-invalid":A?!0:void 0,"aria-label":`Image prompt`,className:`w-full`,"data-generation-prompt":!0,...Hw(i),disabled:t===!0||C,onChange:e=>{s(e.currentTarget.value),o(e.currentTarget.selectionStart),S(-1)},onSelect:e=>{o(e.currentTarget.selectionStart)},onKeyDown:e=>{if(Tw(e))return;let t=Vw(e);if(a>0&&t!==null){e.preventDefault(),t===`next`?l(1):t===`previous`?l(-1):t===`accept`?u():c();return}if(g.startsWith(`/`)&&t!==null&&(h>0||t===`dismiss`||e.key===`Enter`)){if(e.preventDefault(),t===`dismiss`)s(g.slice(1));else if(h)t===`next`?f(1):t===`previous`?f(-1):p();else return;return}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),D();return}if(e.key===`ArrowUp`&&_.current?.selectionStart===0&&y.length&&(x===-1||x>0)){e.preventDefault();let t=x===-1?y.length-1:x-1;S(t),s(y[t]);return}if(e.key===`ArrowDown`&&x!==-1){e.preventDefault();let t=x+1;t>=y.length?(S(-1),s(``)):(S(t),s(y[t]))}},placeholder:m,ref:_,rows:1,value:g}),n!==void 0&&k>0?(0,$.jsx)(`p`,{className:`px-3 pb-1 text-xs tabular-nums ${A?`text-error`:`text-dim`}`,"data-prompt-counter":!0,id:xA,role:A?`alert`:`status`,children:A?`${String(k)} / ${String(n)} characters. This model accepts up to ${String(n)}; shorten the prompt${r>0?` or its style and characters`:``} by ${String(k-n)} or pick another model.`:`${String(k)} / ${String(n)}`}):null]})}function wA({index:e,listId:t,matches:n,onHighlight:r,onPick:i}){return(0,$.jsx)(Uw,{open:!0,rows:n.map(e=>({key:e.id,label:`/${e.slash}`,detail:e.description??e.title})),selected:e,listId:t,label:`Commands`,kind:`commands`,empty:`No matching commands`,onHighlight:r,onChoose:i})}function TA(e,t){let[n,r]=(0,J.useState)(0),i=t.startsWith(`/`),a=(0,J.useMemo)(()=>{if(!i)return[];let n=Cw(e.map((e,t)=>({alias:e.slash,commandId:e.id,command:e.command,title:e.title,description:e.description,category:`Prompt`,order:t,keys:[],availability:{status:`available`}})),t,{idleCategory:`Prompt`});return n.kind===`commands`?n.items.flatMap(({command:t})=>e.find(e=>e.id===t.commandId)??[]):[]},[t,e,i]);return(0,J.useEffect)(()=>{r(0)},[t]),{moveSlash:e=>{r(t=>a.length?(t+e+a.length)%a.length:0)},highlightSlash:r,resetSlash:()=>{r(0)},slashIndex:n,slashMatches:a,slashOpen:i}}function EA({images:e,index:t,listId:n,matches:r,onHighlight:i,onPick:a}){return(0,$.jsx)(Uw,{open:!0,rows:r.map(t=>{let n=t.references.at(0)?.path,r=e.find(e=>e.path===n);return{key:String(t.id),label:`@${t.name}`,detail:t.description||void 0,media:(0,$.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,children:r?(0,$.jsx)(`img`,{src:r.url,alt:``}):null})}}),selected:t,listId:n,label:`Characters`,kind:`characters`,onHighlight:i,onChoose:a})}function DA(e,t){let[n,r]=(0,J.useState)(0),[i,a]=(0,J.useState)(0),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(null),u=o===t?null:_r(t,n),d=u?Yr(e,u.query):[];return(0,J.useEffect)(()=>{a(0)},[t]),{caretRequest:c,matches:d,index:i,setCaret:r,highlight:a,dismiss:()=>{s(t)},move:e=>{a(t=>d.length?(t+e+d.length)%d.length:0)},complete:e=>{let i=d.at(e);if(!u||!i)return null;let a=`${t.slice(0,u.start)}@${i.name} ${t.slice(n)}`,o=u.start+i.name.length+2;return l({value:a,caret:o}),r(o),a}}}function OA(e){let t=L(),n=Ln(Vr(e)),r=n=>({mutationFn:t=>{let r=e?.context.get().computerId;if(!e||!r)throw Error(`No Computer selected`);return n(e,r,t)},onSuccess:n=>{t.setQueryData(Er.characters(e),n)}}),i=pt(r((e,t,n)=>Ur(e.capabilities,t,n))),a=pt(r((e,t,n)=>Or(e.capabilities,t,n))),o=i.error??a.error??n.error;return{characters:n.data?.characters??[],error:o?nn(o).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onSuccess:t})},remove:(e,t)=>{a.mutate(e,{onSuccess:t})}}}var kA=$e(Pr),AA=e=>e.split(`/`).at(-1)??e;function jA({paths:e,images:t}){return(0,$.jsx)(`span`,{className:`flex gap-xs`,children:e.map(e=>{let n=t.find(t=>t.path===e);return(0,$.jsx)(`span`,{className:`prints-character-thumb mask mask-squircle`,title:e,children:n?(0,$.jsx)(`img`,{src:n.url,alt:AA(e)}):null},e)})})}function MA({characters:e,images:t,open:n,onOpenChange:r,busy:i,error:a,canUpload:o,onUpload:s,onSave:c,onDelete:l}){let[u,d]=(0,J.useState)(null),f=(0,J.useId)(),p=u?.name.trim()??``,m=p.startsWith(`@`)?p.slice(1):p,h=[];m===``?h.push(`Enter a character name.`):m.length>32?h.push(`Use 32 characters or fewer for the name.`):kA(m)||h.push(`Use only letters, numbers, hyphens (-) and underscores (_).`),u?.references.length===0&&h.push(`Select at least one reference image.`),i&&h.push(`Wait for the current character change to finish, then save.`);let g=h.length>0,_=g?f:void 0;return(0,$.jsx)(Cy,{open:n,onOpenChange:e=>{e||d(null),r(e)},children:(0,$.jsxs)(Oy,{children:[(0,$.jsx)(Ay,{children:(0,$.jsx)(jy,{children:`Characters`})}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[e.length===0&&u===null?(0,$.jsx)(`p`,{className:`text-sm`,children:`No characters yet. Save one, then type @name in a prompt to keep it the same in every image.`}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-sm`,"aria-label":`Saved characters`,children:e.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-sm`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-sm`,children:[(0,$.jsx)(jA,{paths:e.references.map(e=>e.path),images:t}),(0,$.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`@`,e.name]})]}),(0,$.jsxs)(`span`,{className:`flex gap-xs`,children:[(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{d(e)},children:`Edit`}),(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,disabled:i,onClick:()=>{l(e,()=>{u?.id===e.id&&d(null)})},children:`Delete`})]})]},e.id))}),u===null?(0,$.jsx)(Nr,{size:`xs`,type:`button`,onClick:()=>{d({name:``,description:``,references:[]})},children:`New character`}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,$.jsx)(hC,{"aria-label":`Character name`,"aria-invalid":!kA(m),"aria-describedby":_,maxLength:33,placeholder:`Name, typed as @name`,value:u.name,onChange:e=>{d({...u,name:e.currentTarget.value})}}),(0,$.jsx)(zw,{"aria-label":`Character description`,maxLength:500,rows:4,placeholder:`Short description added to the prompt, e.g. a tall girl with silver hair and a red scarf`,value:u.description,onChange:e=>{d({...u,description:e.currentTarget.value})}}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-sm`,children:[(0,$.jsxs)(`span`,{className:`text-xs`,children:[`Reference images · `,u.references.length,` selected, up to`,` `,8]}),(0,$.jsxs)(Nr,{size:`xs`,variant:`ghost`,type:`button`,disabled:!o,onClick:s,children:[(0,$.jsx)(ax,{"aria-hidden":`true`,size:14}),`Upload`]})]}),t.length===0?(0,$.jsx)(`p`,{className:`text-xs`,children:`No images in the Prints folder yet. Upload one to use it as a reference.`}):(0,$.jsx)(`ul`,{className:`prints-character-picker`,"aria-label":`Reference images`,children:t.map(e=>{let t=u.references.some(t=>t.path===e.path);return(0,$.jsx)(`li`,{title:e.path,children:(0,$.jsxs)(`label`,{className:`prints-character-pick`,children:[(0,$.jsx)(`img`,{src:e.url,alt:``}),(0,$.jsx)(`span`,{className:`prints-character-check`,children:(0,$.jsx)(qw,{"aria-label":`Use ${AA(e.path)}`,checked:t,disabled:!t&&u.references.length>=8,onChange:()=>{d({...u,references:t?u.references.filter(t=>t.path!==e.path):[...u.references,{path:e.path}]})}})})]})},e.path)})}),g?(0,$.jsx)(`p`,{id:f,role:`status`,className:`text-xs`,children:h.join(` `)}):null,(0,$.jsxs)(`div`,{className:`flex gap-xs`,children:[(0,$.jsx)(Nr,{size:`xs`,variant:`primary`,type:`button`,disabled:g,"aria-describedby":_,onClick:()=>{c({id:u.id,name:m,description:u.description.trim(),references:u.references},()=>{d(null)})},children:`Save character`}),(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{d(null)},children:`Cancel`})]})]}),a?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs`,children:a}):null]}),(0,$.jsx)(ky,{children:(0,$.jsx)(My,{render:(0,$.jsx)(Nr,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var NA=me({destination:Yt(z(Ve)),height:Yt(De),model:Yt(Ve),prompt:Yt(Ve),references:Yt(f(me({computerId:Yt(Ve),path:Ve,role:Yt(k([`first-frame`,`last-frame`,`reference`]))}))),generateAudio:Yt(z(je)),steps:Yt(z(De)),style:Yt(z(Ve)),width:Yt(De)}),PA=le(s(),qt()).parse(structuredClone(ve(NA,{onExcessProperty:`error`}).schema)),FA=(e,t,n,r)=>({id:e,title:t,category:`Image generation`,description:n,projections:{agent:{}},action:r===void 0?{presentation:{type:`action`}}:{inputSchema:r,presentation:{type:`action`}}}),IA=FA(`inspect-generation-draft`,`Inspect image draft`,`Read the current Prints image form and available models`),LA=FA(`set-generation-draft`,`Edit image draft`,`Set selected Prints image form fields; this does not generate an image`,PA),RA=FA(`submit-generation-draft`,`Generate image`,`Submit the current Prints image form using the same action as the Send button`);function zA(e,t){let n=!1,r=new Set,i=(t,i)=>{e.commands.register(t,i).then(e=>{n?e():r.add(e)},()=>void 0)};return i(IA,()=>{if(n)return;let e=t.readDraft();return{draft:{destination:e.destination??null,height:e.height,model:e.model,prompt:e.prompt,generateAudio:e.generateAudio??null,references:e.references.map(e=>{let t={path:e.path,role:e.role??null};return e.computerId===void 0?t:{...t,computerId:e.computerId}}),steps:e.steps??null,style:e.style??null,width:e.width},models:t.readModels().map(e=>({id:e.id,label:e.label,defaultHeight:e.input.defaultHeight,defaultWidth:e.input.defaultWidth,maxReferences:e.input.maxReferences}))}}),i(LA,({arguments:e})=>{if(n)return;let r=Xe(NA,{onExcessProperty:`error`})(e);t.setDraft(r)}),i(RA,async()=>{if(!n)return{accepted:await t.submit()}}),()=>{if(!n){n=!0;for(let e of r)e();r.clear()}}}function BA(e){return[{id:`clear-prompt`,title:`Clear prompt`,category:`Prompt`,description:`Remove the current prompt`,projections:{slash:{aliases:[`clear`],order:0},palette:{}},handler:()=>{e().clear()}},...Cr.map((t,n)=>({id:`size-${t}`,title:`Use ${t} size`,category:`Prompt`,description:`Use ${String(In[t].width)} × ${String(In[t].height)}`,projections:{slash:{aliases:[t],order:n+1},palette:{}},handler:()=>{e().useSize(t)}})),{id:`choose-style`,title:`Choose style`,category:`Prompt`,description:`Pick, create or edit a saved style`,projections:{slash:{aliases:[`style`],order:4},palette:{}},handler:()=>{e().openStyles()}},{id:`no-style`,title:`Use no style`,category:`Prompt`,description:`Send the prompt without a style`,projections:{slash:{aliases:[`nostyle`],order:5},palette:{}},handler:()=>{e().clearStyle()}}]}function VA(e,t){let n=(0,J.useRef)(e);n.current=e;let r=pu(t,{sourceId:`media-prompt`,namespace:`media`},(0,J.useCallback)(()=>BA(()=>n.current),[])),i=(0,J.useSyncExternalStore)(r.subscribe,r.snapshot,r.snapshot);return{items:(0,J.useMemo)(()=>yw(i).map(e=>({id:e.commandId,command:e.command,slash:e.alias,title:e.title,description:e.description})),[i]),run:e=>{r.execute(e,{origin:`slash`})}}}function HA(e){let t=L(),n=Ln(fr(e)),r=n=>({mutationFn:t=>{let r=e?.context.get().computerId;if(!e||!r)throw Error(`No Computer selected`);return n(e,r,t)},onSuccess:n=>{t.setQueryData(Er.styles(e),n)}}),i=pt(r((e,t,n)=>Gr(e.capabilities,t,n))),a=pt(r((e,t,n)=>qr(e.capabilities,t,n))),o=i.error??a.error??n.error;return{styles:n.data?.styles??[],error:o?nn(o).message:null,busy:i.isPending||a.isPending,save:(e,t)=>{i.mutate(e,{onSuccess:n=>{t(n.styles.find(t=>t.name===e.name))}})},remove:(e,t)=>{a.mutate(e,{onSuccess:t})}}}function UA(e){let t=e.filter(e=>e.kind===`video`&&e.video!==null&&e.input.maxReferences>=1&&e.video.referenceRoles.includes(`first-frame`));return t.find(e=>e.video?.provider===`seedance`)??t.at(0)}function WA(e,t,n){let r=e.video;if(r===null)return;let i=Math.log(t/n),a=e=>Math.abs(Math.log(e.width/e.height)-i);return r.formats.filter(e=>e.resolution===r.defaultResolution).reduce((e,t)=>e===void 0||a(t)<a(e)?t:e,void 0)}function GA(e,t){let{lineage:n,printPath:r,models:i,current:a}=t,o=e===`animate`?UA(i):void 0;if(e===`animate`&&o===void 0)return{kind:`refused`,message:`No video model on this Computer takes a first frame.`};let s=Qn(i,n.model),c=o??s??Qn(i,a.model);if(c===void 0)return{kind:`refused`,message:`Choose a model from the granted registry.`};let l=o===void 0&&s===void 0?`This print was made with ${n.model}, which is no longer available. Loaded it with ${On(c)} instead.`:null,u=n.references.slice(0,n.typed.references),d=e===`animate`?{path:r,role:`first-frame`}:{path:r},f=[d,...u.filter(e=>!_n(e,t.printComputerId)||e.path!==r)];if(e!==`reuse`&&c.input.maxReferences===0)return{kind:`refused`,message:`${c.label} does not take reference images.`};let p=e===`reuse`?u:e===`remix`?f:[d],m=Tn(a,c),h={width:n.width??m.width,height:n.height??m.height},g=o===void 0?rr(h,c,void 0):WA(c,h.width,h.height)??m,_=o===void 0&&c.input.steps!==`fixed`&&n.steps!==null&&c.id===n.model?n.steps:m.steps,v=n.style!==null&&t.styles.includes(n.style)?n.style:void 0;return{kind:`draft`,notice:l,draft:{...m,destination:void 0,prompt:n.typed.prompt,references:p,steps:_,style:v,width:g.width,height:g.height}}}function KA({id:e,styles:t,selected:n,disabled:r,onSelect:i}){let a=n===void 0||t.some(e=>e.name===n);return(0,$.jsxs)(pw,{id:e,"aria-label":`Prompt style`,"data-generation-style":!0,className:`select-sm`,disabled:r,onChange:e=>{i(e.currentTarget.value||void 0)},value:n??``,children:[(0,$.jsx)(`option`,{value:``,children:`No style`}),a?null:(0,$.jsx)(`option`,{value:n,children:n}),t.map(e=>(0,$.jsx)(`option`,{value:e.name,children:e.name},e.id))]})}function qA({styles:e,selected:t,open:n,onOpenChange:r,busy:i,error:a,onSelect:o,onSave:s,onDelete:c}){let[l,u]=(0,J.useState)(null);return(0,$.jsx)(Cy,{open:n,onOpenChange:r,children:(0,$.jsxs)(Oy,{children:[(0,$.jsx)(Ay,{children:(0,$.jsx)(jy,{children:`Styles`})}),(0,$.jsx)(`ul`,{className:`space-y-1`,"aria-label":`Saved styles`,children:e.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-sm`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,$.jsxs)(`span`,{className:`flex gap-xs`,children:[(0,$.jsx)(Nr,{size:`xs`,variant:t===e.name?`primary`:`ghost`,type:`button`,"aria-pressed":t===e.name,onClick:()=>{o(e.name),r(!1)},children:`Use`}),e.builtIn?null:(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u(e)},children:`Edit`}),(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u({name:`${e.name} copy`.slice(0,64),text:e.text})},children:`Duplicate`}),e.builtIn?null:(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,disabled:i,onClick:()=>{c(e,()=>{t===e.name&&o(void 0),l?.id===e.id&&u(null)})},children:`Delete`})]})]},e.id))}),l===null?(0,$.jsx)(Nr,{size:`xs`,type:`button`,onClick:()=>{u({name:``,text:``})},children:`New style`}):(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(hC,{"aria-label":`Style name`,maxLength:64,value:l.name,onChange:e=>{u({...l,name:e.currentTarget.value})}}),(0,$.jsx)(zw,{"aria-label":`Style text`,maxLength:8e3,rows:6,value:l.text,onChange:e=>{u({...l,text:e.currentTarget.value})}}),(0,$.jsxs)(`div`,{className:`flex gap-xs`,children:[(0,$.jsx)(Nr,{size:`xs`,variant:`primary`,type:`button`,disabled:i||l.name.trim()===``||l.text.trim()===``,onClick:()=>{let n=e.find(e=>e.id===l.id);s({id:l.id,name:l.name.trim(),text:l.text},e=>{n&&t===n.name&&e&&o(e.name),u(null)})},children:`Save style`}),(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u(null)},children:`Cancel`})]})]}),a?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs`,children:a}):null,(0,$.jsx)(ky,{children:(0,$.jsx)(My,{render:(0,$.jsx)(Nr,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var JA=(0,J.lazy)(async()=>({default:(await ir(()=>import(`./print-info-drawer-DQEdoQYi.js`),__vite__mapDeps([5,1,2,6,4]),import.meta.url)).PrintInfoDrawer})),YA=[`a mushroom knight`,`moss on a keyboard`,`your Agent's selfie`];function XA(e){MC.error(e,{id:`prints-generation-error`,toasterId:`prints-generation-notices`})}function ZA(e){let t=(0,J.useRef)(!1),n=mC({defaultValues:Rn(),onSubmit:async({value:n})=>{t.current=await e.current(n)}}),r=(0,J.useCallback)(async()=>(t.current=!1,await n.handleSubmit(),t.current),[n]);return Object.assign(n,{submitCurrent:r})}function QA({form:e,selected:t,stylePicker:n,sizeChoices:r,sizeMode:i,onCustomSize:a,onEditStyles:o,onEditCharacters:s}){let c=t?.input.dimensions===`none`,l=t!==void 0&&t.sizes!==null,u=t?.video??null;return(0,$.jsxs)(`div`,{className:`prints-settings`,children:[(0,$.jsx)(sw,{label:`Style`,orientation:`horizontal`,children:n}),(0,$.jsx)(sw,{label:`Size`,orientation:`horizontal`,children:(0,$.jsx)(pw,{"aria-label":`Generation size`,"data-generation-size":!0,className:`select-sm`,disabled:c,title:c?`This model chooses the output size.`:void 0,onChange:t=>{let n=t.currentTarget.value;a(n===`custom`);let i=r.find(e=>e.value===n);i&&(e.setFieldValue(`width`,i.width),e.setFieldValue(`height`,i.height))},value:c?`provider`:i,children:c?(0,$.jsx)(`option`,{value:`provider`,children:`Model default`}):(0,$.jsxs)($.Fragment,{children:[l&&!r.some(e=>e.value===i)?(0,$.jsx)(`option`,{value:i,disabled:!0,children:`Choose a supported resolution`}):null,r.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value)),l?null:(0,$.jsx)(`option`,{value:`custom`,children:`Custom size`})]})})}),!c&&!l&&i===`custom`?(0,$.jsxs)(`div`,{className:`prints-custom-size`,children:[(0,$.jsx)(e.Field,{name:`width`,children:e=>(0,$.jsx)(sw,{label:`Width`,children:(0,$.jsx)(hC,{"aria-label":`Generation width`,"data-generation-width":!0,max:4096,min:1,onChange:t=>{e.handleChange(Number(t.currentTarget.value)||1)},type:`number`,value:e.state.value})})}),(0,$.jsx)(e.Field,{name:`height`,children:e=>(0,$.jsx)(sw,{label:`Height`,children:(0,$.jsx)(hC,{"aria-label":`Generation height`,"data-generation-height":!0,max:4096,min:1,onChange:t=>{e.handleChange(Number(t.currentTarget.value)||1)},type:`number`,value:e.state.value})})})]}):null,u?(0,$.jsx)(e.Field,{name:`durationSeconds`,children:e=>(0,$.jsx)(sw,{label:`Length`,orientation:`horizontal`,children:(0,$.jsx)(pw,{"aria-label":`Video length in seconds`,className:`select-sm`,"data-generation-duration":!0,onChange:t=>{let n=t.currentTarget.value;e.handleChange(u.durations.find(e=>String(e)===n))},value:e.state.value===void 0?``:String(e.state.value),children:u.durations.map(e=>(0,$.jsxs)(`option`,{value:String(e),children:[e,` seconds`]},e))})})}):null,u?.supportsAudio?(0,$.jsx)(e.Field,{name:`generateAudio`,children:e=>u.defaultGenerateAudio===null?(0,$.jsx)(sw,{label:`Audio`,orientation:`horizontal`,children:(0,$.jsxs)(pw,{"aria-label":`Video audio`,className:`select-sm`,"data-generation-audio":!0,onChange:t=>{let n=t.currentTarget.value;e.handleChange(n===``?void 0:n===`on`)},value:e.state.value===void 0?``:e.state.value?`on`:`off`,children:[(0,$.jsx)(`option`,{value:``,children:`Model default`}),(0,$.jsx)(`option`,{value:`on`,children:`On`}),(0,$.jsx)(`option`,{value:`off`,children:`Off`})]})}):(0,$.jsx)(sw,{label:`Audio`,orientation:`horizontal`,children:(0,$.jsx)(xr,{"aria-label":`Video audio`,checked:e.state.value??!0,"data-generation-audio":!0,onCheckedChange:e.handleChange})})}):null,t&&t.input.steps!==`fixed`?(0,$.jsx)(e.Field,{name:`steps`,children:e=>(0,$.jsx)(sw,{label:`Steps`,optional:!0,orientation:`horizontal`,children:(0,$.jsx)(hC,{"aria-label":`Generation steps`,className:`input-sm`,"data-generation-steps":!0,max:t.input.maxSteps??void 0,min:1,onChange:t=>{e.handleChange(t.currentTarget.value===``?void 0:Number(t.currentTarget.value))},type:`number`,value:e.state.value??``})})}):null,(0,$.jsxs)(`div`,{className:`prints-settings-library`,children:[(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{o()},children:`Edit styles…`}),(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{s()},children:`Characters…`})]})]})}function $A({actions:e,guidance:t,commandApp:n,form:r,models:i,modelsLoading:a,mediaCapability:o,submitting:s,values:c,computerId:l,mediaDirectory:u,referenceImages:d,characters:f,characterDialog:p,onSubmit:m,styleControls:h,addedLength:g}){let _=Qn(i,c.model),v=c.prompt.trim().length,y=_!==void 0&&v>0&&v+g>_.maxPromptLength,b=Dn(_),x=_?.video??null,S=Nn(c.references,_),C=_===void 0?void 0:er(S,_,x?.formats.find(e=>e.width===c.width&&e.height===c.height)?.resolution),w=_?.input.maxReferences??0,T=c.references.length>w,[E,D]=(0,J.useState)(!1),[O,k]=(0,J.useState)(!1),A=_!==void 0&&_.sizes!==null,j=Mn(_),M=A?`${String(c.width)}x${String(c.height)}`:E?`custom`:j.find(e=>e.width===c.width&&e.height===c.height)?.value??`custom`,[N,P]=(0,J.useState)(!1),F=VA({clear:()=>{r.setFieldValue(`prompt`,``)},useSize:e=>{D(!1),r.setFieldValue(`width`,In[e].width),r.setFieldValue(`height`,In[e].height),r.setFieldValue(`prompt`,``)},openStyles:()=>{r.setFieldValue(`prompt`,``),P(!0)},clearStyle:()=>{r.setFieldValue(`style`,void 0),r.setFieldValue(`prompt`,``)}},n),[I,L]=(0,J.useState)(!1),R=DA(f,c.prompt),z=TA(F.items,c.prompt),B=(0,J.useId)(),V=`${B}-commands`,H=`${B}-characters`,ee=ar({computerId:l,prompt:c.prompt,saved:f,references:c.references,model:_===void 0?void 0:{label:_.label,maxReferences:_.input.maxReferences}}),te=yr(c.prompt,f).characters,U=e=>{let t=z.slashMatches.at(e);t&&(z.resetSlash(),F.run(t.command))},W=h({open:N,onOpenChange:P}),ne=[c.style,Ir(_,c.width,c.height),x&&c.durationSeconds!==void 0?`${String(c.durationSeconds)}s`:void 0,x?.supportsAudio&&c.generateAudio===!1?`silent`:void 0].filter(e=>e!=null),re=(0,$.jsx)(QA,{form:r,selected:_,stylePicker:W.picker,sizeChoices:j,sizeMode:M,onCustomSize:D,onEditStyles:()=>{k(!1),P(!0)},onEditCharacters:()=>{k(!1),L(!0)}});return(0,$.jsxs)(aT,{"aria-label":`Image generation`,"data-generation-form":!0,attachments:c.references.length>0?(0,$.jsx)(`div`,{className:`prints-reference-tray`,"aria-label":`Image references`,children:c.references.map((e,t)=>{let n=l!==null&&_n(e,l)?d.find(t=>t.path===e.path):void 0,i=S[t]?.role,a=Xn(b,S,t);return(0,$.jsxs)(`div`,{className:`prints-reference-tile`,title:e.computerId===void 0?e.path:`${e.computerId}:${e.path}`,children:[(0,$.jsx)(`div`,{className:`prints-reference-face mask mask-squircle`,children:n?(0,$.jsx)(`img`,{src:n.url,alt:e.path.split(`/`).at(-1)}):(0,$.jsxs)(`span`,{children:[`Ref `,t+1]})}),i===void 0?null:a===void 0?(0,$.jsx)(`span`,{className:`prints-reference-role`,"data-reference-role":i,children:hn[i]}):(0,$.jsx)(Nr,{size:`xs`,variant:`ghost`,type:`button`,className:`prints-reference-role`,"data-reference-role":i,"aria-label":`Reference ${String(t+1)}: ${hn[i]}. Use as ${hn[a]}`,title:`Use as ${hn[a]}`,onClick:()=>{r.setFieldValue(`references`,S.map((e,n)=>n===t?{...e,role:a}:e))},children:hn[i]}),(0,$.jsx)(cr,{icon:(0,$.jsx)(mn,{}),className:`prints-reference-remove`,"aria-label":`Remove reference ${String(t+1)}`,onClick:()=>{r.setFieldValue(`references`,c.references.filter((e,n)=>n!==t))}})]},JSON.stringify([e.computerId??l,e.path]))})}):void 0,input:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`form`,{"aria-busy":s,onSubmit:e=>{e.preventDefault(),m()},children:(0,$.jsx)(r.Field,{name:`prompt`,children:e=>(0,$.jsxs)(`div`,{className:`prints-prompt`,children:[z.slashOpen?(0,$.jsx)(wA,{index:z.slashIndex,listId:V,matches:z.slashMatches,onHighlight:z.highlightSlash,onPick:U}):null,!z.slashOpen&&R.matches.length>0?(0,$.jsx)(EA,{images:d,index:R.index,listId:H,matches:R.matches,onHighlight:R.highlight,onPick:t=>{let n=R.complete(t);n!==null&&e.handleChange(n)}}):null,(0,$.jsx)(CA,{caretRequest:R.caretRequest,menu:z.slashOpen?{open:z.slashMatches.length>0,listId:V,selected:z.slashIndex}:{open:R.matches.length>0,listId:H,selected:R.index},mentionCount:z.slashOpen?0:R.matches.length,onCaret:R.setCaret,onMentionDismiss:R.dismiss,onMentionMove:R.move,onMentionPick:()=>{let t=R.complete(R.index);t!==null&&e.handleChange(t)},disabled:!o||a||i.length===0||s,maxLength:_?.maxPromptLength,addedLength:g,onChange:t=>{e.handleChange(t)},onSend:m,onSlashMove:z.moveSlash,onSlashPick:()=>{U(z.slashIndex)},placeholder:`What are we making?`,slashCount:z.slashMatches.length,value:e.state.value}),c.references.length>0||C!==void 0||te.length>0?(0,$.jsxs)(`div`,{className:`prints-composer-notes`,children:[c.references.length>0?(0,$.jsxs)(`span`,{className:`prints-reference-count`,"data-generation-references":!0,"data-over-limit":T?``:void 0,role:T?`alert`:void 0,children:[c.references.length,` / `,w,` `,`references`,T?w===0?` — this model takes none; remove them or pick another model`:` — over this model's limit; remove some to generate`:null]}):null,C===void 0?null:(0,$.jsx)(`span`,{className:`prints-reference-count`,"data-generation-reference-roles":!0,"data-over-limit":``,role:`alert`,children:C}),te.length>0?(0,$.jsx)(`span`,{className:`prints-reference-count`,"data-generation-characters":!0,"data-over-limit":ee.kind===`refused`?``:void 0,role:ee.kind===`refused`?`alert`:void 0,children:ee.kind===`refused`?ee.message:`Characters: ${te.map(e=>e.name).join(`, `)}`}):null]}):null]})})}),t?(0,$.jsxs)(`div`,{className:`prints-composer-guidance`,role:`status`,"data-composer-guidance":!0,children:[(0,$.jsx)(`span`,{children:t.group===`Images`&&t.detail?t.detail:(0,$.jsxs)($.Fragment,{children:[t.title,`. `,t.detail]})}),t.actions?.map(e=>(0,$.jsx)(Nr,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label))]}):null]}),row:{controls:(0,$.jsxs)($.Fragment,{children:[e,(0,$.jsx)(r.Field,{name:`model`,children:e=>(0,$.jsx)(cD,{models:i,emptyLabel:l===null?`Choose a Computer`:a?`Loading models…`:`Models unavailable`,disabled:a||!o,onChange:t=>{let n=Qn(i,t);if(e.handleChange(t),!n)return;let a=r.store.state.fieldMeta,o=Tn(c,n),s=rr(c,n,_);(n.input.dimensions===`none`||n.sizes!==null)&&D(!1),r.setFieldValue(`width`,s.width),r.setFieldValue(`height`,s.height),r.setFieldValue(`durationSeconds`,o.durationSeconds),r.setFieldValue(`generateAudio`,o.generateAudio),(n.input.steps===`fixed`||!a.steps?.isTouched)&&r.setFieldValue(`steps`,o.steps)},value:e.state.value})}),l&&u?(0,$.jsxs)(`span`,{className:`sr-only`,"data-generation-computer":!0,title:`Saved to ${l}:${u}`,children:[`Saves to `,u]}):null]}),action:(0,$.jsx)(SA,{busy:s,draft:c.prompt,disabled:!o||a||i.length===0||s,label:An(_),onGenerate:()=>{m()},promptOver:y}),items:[{id:`settings`,accessibleLabel:`Generation settings`,title:`Settings`,label:(0,$.jsxs)(`span`,{className:`prints-settings-chip`,children:[(0,$.jsx)(rx,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),ne.length>0?ne.join(` · `):`Settings`]}),content:re}],openId:O?`settings`:null,onOpenChange:e=>{k(e===`settings`)}},children:[W.dialog,p({open:I,onOpenChange:L})]})}function ej({connection:e}){let t=(0,J.useRef)(e);t.current=e;let n=lD(e?.app??null),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(),s=vk(e?.app??null,n.computerId),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(),m=(0,J.useRef)(0);(0,J.useEffect)(()=>{l(null),d(null),p(void 0)},[e,n.computerId,n.path]);let h=n.path,{gallery:g,images:_,failed:v,loading:y,gallerySlots:b,canBrowse:x,canRead:S,canWrite:C,reserveSlot:w,failSlot:T,clearSlotError:E,removeSlot:D,addComputerFile:O,retryFile:k,uploads:A,uploadFiles:j}=hx(e,n),[M,N]=(0,J.useState)(Date.now),P=b.some(e=>e.startedAt!==void 0&&!e.resolved&&!e.error);(0,J.useEffect)(()=>{if(!P)return;let e=setInterval(()=>{N(Date.now())},1e3);return()=>{clearInterval(e)}},[P]);let F=Vu(e,(e,t,n)=>(g.refresh(),O(e,t,n)));(0,J.useLayoutEffect)(()=>{p(void 0),F.target&&(l(null),d(null))},[F.target]);let I=g.entries.some(e=>e.path===F.target?.path);(0,J.useEffect)(()=>{F.target&&!I&&g.nextPageReady&&g.loadMore()},[F.target,I,g.nextPageReady,g.loadMore]);let L=_.find(e=>e.source.kind===`computer`&&e.source.computerId===F.target?.computerId&&e.source.path===F.target.path),R=HA(e?.app??null),z=OA(e?.app??null),B=Rx({connection:e,folder:n,styles:R.styles,characters:z.characters,effects:{reserve:w,failed:T,notifyFailure:XA,saved:({result:e},t)=>{S?O(e.destination.path,t,e.destination.computerId):T(`${e.destination.computerId}:${e.destination.path}`,`Image saved, but this App cannot read its preview.`)}}}),{state:V,models:H,modelsLoading:ee,modelsError:te,canGenerate:U,mediaCapability:W,pendingGenerations:ne,activeGenerations:re,recoveryError:ie}=B,ae=(0,J.useRef)(H),oe=(0,J.useRef)(B);oe.current=B;let se=(0,J.useRef)(null),ce=(0,J.useRef)(null),le=(0,J.useRef)(0),[ue,de]=(0,J.useState)(null),fe=(0,J.useRef)(B.submit);fe.current=async e=>{let t=await B.submit(e);return t&&de(null),t};let G=ZA(fe),pe=e=>{G.setFieldValue(`model`,e.model),G.setFieldValue(`width`,e.width),G.setFieldValue(`height`,e.height),G.setFieldValue(`steps`,e.steps),G.setFieldValue(`durationSeconds`,e.durationSeconds),G.setFieldValue(`generateAudio`,e.generateAudio),G.setFieldValue(`prompt`,e.prompt),G.setFieldValue(`references`,e.references),G.setFieldValue(`style`,e.style),G.setFieldValue(`destination`,void 0)},me=(0,J.useRef)(G);me.current=G;let he=iC(G.store,e=>e.values),ge=iC(G.store,e=>e.isSubmitting),K=e?.app;(0,J.useEffect)(()=>{if(K)return zA(K,{readDraft:()=>me.current.store.state.values,readModels:()=>ae.current,setDraft:e=>{let t=me.current;if(e.model!==void 0){let n=Qn(ae.current,e.model);if(!n)throw Error(`Choose a model from the granted registry.`);let r=Tn(t.store.state.values,n),i=Qn(ae.current,t.store.state.values.model),a=rr(t.store.state.values,n,i);t.setFieldValue(`model`,r.model),t.setFieldValue(`width`,a.width),t.setFieldValue(`height`,a.height),t.setFieldValue(`steps`,r.steps),t.setFieldValue(`durationSeconds`,r.durationSeconds),t.setFieldValue(`generateAudio`,r.generateAudio)}e.generateAudio!==void 0&&t.setFieldValue(`generateAudio`,e.generateAudio??void 0),e.destination!==void 0&&t.setFieldValue(`destination`,e.destination??void 0),e.height!==void 0&&t.setFieldValue(`height`,e.height),e.prompt!==void 0&&t.setFieldValue(`prompt`,e.prompt),e.references!==void 0&&t.setFieldValue(`references`,e.references),e.steps!==void 0&&t.setFieldValue(`steps`,e.steps??void 0),e.style!==void 0&&t.setFieldValue(`style`,e.style??void 0),e.width!==void 0&&t.setFieldValue(`width`,e.width)},submit:()=>me.current.store.state.isSubmitting||oe.current.isRunning()?Promise.resolve(!1):me.current.submitCurrent()})},[K]),(0,J.useEffect)(()=>{ae.current=H},[H]),(0,J.useEffect)(()=>{if(H.length===0||te)return;let e=H.find(e=>e.id===`@cf/black-forest-labs/flux-2-klein-4b`)??H[0];if(!G.store.state.fieldMeta.model?.isTouched){let t=Tn(G.store.state.values,e);G.setFieldValue(`model`,t.model),G.store.state.fieldMeta.width?.isTouched||G.setFieldValue(`width`,t.width),G.store.state.fieldMeta.height?.isTouched||G.setFieldValue(`height`,t.height),G.store.state.fieldMeta.steps?.isTouched||G.setFieldValue(`steps`,t.steps)}},[G,te,H]);let _e=Qn(H,he.model),ve=he.references,ye=_e?.input.maxReferences??0,be=(0,J.useRef)({addComputerFile:O,retryPath:B.retryPath,uploads:A});be.current={addComputerFile:O,retryPath:B.retryPath,uploads:A};let xe=L?px(L):null,Se=(0,J.useMemo)(()=>_.map(e=>({key:px(e),selected:px(e)===xe,path:e.source.kind===`computer`?e.source.path:e.file.name,referenced:ve.some(t=>e.source.kind===`computer`&&_n(t,e.source.computerId)&&t.path===e.source.path),referenceDisabled:ve.length>=ye&&!ve.some(t=>e.source.kind===`computer`&&_n(t,e.source.computerId)&&t.path===e.source.path),onToggleReference:e.source.kind===`computer`&&ye>0?()=>{if(e.source.kind!==`computer`)return;let t=e.source.path,n=e.source.computerId,r=ve.some(e=>_n(e,n)&&e.path===t);G.setFieldValue(`references`,r?ve.filter(e=>!_n(e,n)||e.path!==t):[...ve,{path:t}])}:void 0,onInfo:()=>{l(e)},url:e.url,width:e.width,height:e.height,onOpen:()=>{l(null),d(px(e))}})),[_,ve,ye,G,xe]),Ce=(0,J.useMemo)(()=>{let e=n.computerId;if(!e)return Se;let t=new Map(Se.map(e=>[e.key,e])),r=[...g.entries].sort((e,t)=>t.modifiedAt-e.modifiedAt||e.name.localeCompare(t.name)).map(n=>{let r=`${e}:${n.path}`;return{...t.get(r)??{key:r,path:n.path,width:1,height:1,url:``,pending:!0,pendingLabel:`Loading print…`,onOpen:()=>void 0,onVisible:()=>{g.loadFile(n.path)},error:v.includes(n.name)?`Could not load this print.`:void 0},onRetry:()=>{k(n.path)}}}),i=new Set(r.map(e=>e.key));return[...r,...Se.filter(e=>!i.has(e.key)&&e.key!==xe)]},[Se,g.entries,g.loadFile,k,v,n.computerId,xe]),we=V.kind===`pending`,Te=(0,J.useMemo)(()=>bA(Ce,b,e=>{let n=A.items.find(t=>t.id===e.uploadId),r=e.error??(n?.status===`error`||n?.status===`cancelled`?n.message:void 0);return{key:e.key,path:e.path,width:e.width,height:e.height,url:``,pending:!0,error:r,pendingLabel:n?.status===`complete`||V.kind===`completed`?`Loading preview…`:e.uploadId?`Uploading image…`:e.startedAt===void 0?e.pendingLabel:Zr(H.find(e=>e.kind===`video`),M-e.startedAt,e.resumed),onOpen:()=>void 0,onRetry:r&&(S||n&&n.status!==`complete`)?()=>{if(E(e.key),n&&n.status!==`complete`){be.current.uploads.retry(n.id);return}!e.uploadId&&be.current.retryPath(e.path)||t.current&&be.current.addComputerFile(e.path,t.current,e.computerId)}:void 0,onDismiss:r?()=>{D(e.key),e.uploadId&&be.current.uploads.remove(e.uploadId)}:void 0}}),[Ce,b,A.items,V.kind,S,H,M]),Ee=ge||we,De=b.some(e=>e.error!==void 0),Oe=A.items.filter(e=>e.computerId===n.computerId),ke=V.kind===`error`&&te===null?{key:B.errorKey,mediaKind:V.mediaKind,message:V.message,billing:V.action===`billing`&&e?()=>{e.app.ui.openTeamBilling().catch(n=>{fn(`open-team-billing`,n),t.current===e&&B.reportRecoveryError(n)})}:void 0,retry:De&&V.retryable!==!1?B.retry:void 0}:null,Ae=_k({connected:e!==null,mediaCapability:W,modelsError:te,retryModels:B.retryModels,modelsLoading:ee,models:H,canGenerate:U,canWrite:C,generationError:ke,recoveryError:ie,pendingGenerations:ne,activeGenerations:re,gallerySlots:b,computerId:n.computerId,failed:v,uploadError:A.error,uploads:Oe,permissions:()=>{e?.app.ui.requestAppPermissions({}).catch(e=>{B.reportRecoveryError(e)})},resume:e=>{B.resume(e)},discard:e=>{B.discard(e)},retryUpload:e=>{A.retry(e)}});s.error&&Ae.push({key:`dismissal-storage`,group:`Setup`,tone:`warning`,blocking:!0,short:`Activity not saved`,title:`Activity not saved`,detail:s.error});let je=s.visible(Ae),Me={generating:re.size,uploading:Oe.filter(e=>e.status===`sending`||e.status===`queued`).length},Ne={items:Oe.filter(e=>e.status===`sending`||e.status===`queued`).map(e=>({id:e.id,name:e.file.name,preview:{kind:`image`,url:e.previewUrl},progress:null,progressLabel:``,statusLabel:e.message,actions:{cancel:{label:`Cancel`,accessibleLabel:`Cancel ${e.file.name}`}}})),onCancel:e=>{A.cancel(e)},onRetry:e=>{A.retry(e)},onRemove:e=>{A.remove(e)}},Pe=new Set([...g.entries.map(e=>`${n.computerId??``}:${e.path}`),..._.map(e=>e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name)]).size,Fe=uk(je,Me,r);fu(e?.app,[...n.available?[_w(n.path,{checking:n.busy&&n.path===null,editing:n.editing})]:[],...Fe===null?[]:[Fe],...x?[{kind:`text`,id:`prints`,text:`${String(Pe)} ${Pe===1?`print`:`prints`}`}]:[]],e=>e.itemId===`activity`?(o(e.anchor?.start),i(e=>!e),!0):e.itemId!==`folder`||!n.available?!1:(n.setEditing(!0),!0),t=>{fn(`prints.status.report`,t),e?.app.ui.showToast({message:`Prints couldn't update its status bar.`,tone:`error`}).catch(e=>{fn(`prints.status.toast`,e)})});let Ie=_.flatMap(e=>e.source.kind===`computer`?[{path:e.source.path,url:e.url}]:[]),Le=e=>{d(null),m.current+=1,p({key:e,requestId:`viewer-close-${String(m.current)}`,onFocus:()=>void 0})},Re=(t,n,r)=>(0,$.jsx)(J.Suspense,{fallback:null,children:(0,$.jsx)(JA,{image:t,app:e?.app??null,referenceImages:Ie,models:H,canAnimate:UA(H)!==void 0,download:r,onIterate:(e,n)=>{if(t.source.kind!==`computer`)return null;let r=GA(e,{lineage:n,printComputerId:t.source.computerId,printPath:t.source.path,models:H,styles:R.styles.map(e=>e.name),current:G.store.state.values});return r.kind===`refused`?r.message:(pe(r.draft),de(r.notice===null?null:{model:r.draft.model,message:r.notice}),l(null),u!==null&&Le(px(t)),null)},onClose:n},t.url)});return(0,$.jsxs)(`main`,{className:`h-full w-full flex flex-col overflow-hidden`,"data-app-pane":`media`,"data-generation-state":V.kind,"data-computer-capability":x?`connected`:`absent`,onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&C&&(e.preventDefault(),j(t.map(e=>(le.current+=1,new File([e],`paste-${String(le.current)}-${dx(e.name)}`,{type:e.type,lastModified:e.lastModified})))))},children:[(0,$.jsx)(JC,{id:`prints-generation-notices`}),(0,$.jsxs)(`div`,{className:`prints-gallery-region`,children:[(0,$.jsx)(Mb,{screen:!0,surface:!0,surfaceSize:`lg`,surfaceDepth:`deep`,ref:se,className:`flex-1 min-h-0`,"data-media-scroll":!0,"aria-busy":y||g.loading,onDragOver:e=>{e.preventDefault()},onDrop:e=>{e.preventDefault();let t=Array.from(e.dataTransfer.files);t.length&&C&&j(t)},children:(0,$.jsxs)(`div`,{className:`prints-gallery-content`,children:[Te.length>0?(0,$.jsx)(yA,{items:Te,scrollRef:se,focus:u===null?f??(L&&F.target?{key:`${F.target.computerId}:${F.target.path}`,requestId:F.target.requestId,onFocus:()=>{l(null),d(px(L))}}:void 0):void 0}):y||g.loading?(0,$.jsx)(gw,{variant:`hint`,role:`status`,"aria-live":`polite`,title:`Loading prints…`,description:`Your library is on its way.`}):(0,$.jsx)(gw,{"aria-live":`polite`,"data-absence":!0,"data-media-empty":!0,role:`status`,variant:`panel`,visual:(0,$.jsx)(Qb,{}),title:`Nothing printed yet.`,description:n.computerId===null?`Your images will appear here.`:n.available&&h===null?`Pick a folder in the composer below, then describe something or drop in images.`:`Describe something and it lands here, or drop in images from your Computer.`,...W?{suggestions:YA.map(e=>({label:e,onSelect:()=>{G.setFieldValue(`prompt`,e)}}))}:{}}),g.hasNextPage&&(0,$.jsx)(Nr,{variant:`ghost`,disabled:g.loading,onClick:g.loadMore,children:g.loading?`Loading images…`:`Load more images`})]})}),F.error?(0,$.jsx)(`p`,{role:`alert`,children:`Could not open this print. It may no longer be available on this Computer.`}):null,c&&(c.source.kind===`local`||c.source.connection===e&&c.source.computerId===n.computerId)?Re(c,()=>{l(null)}):null]}),(0,$.jsx)(Cx,{items:Te,images:_,viewerKey:u,app:e?.app??null,onNavigate:d,onClose:Le,renderInfo:(e,t)=>Re(e,t,null)}),(0,$.jsxs)(`div`,{className:`prints-composer-dock`,children:[(0,$.jsx)(`section`,{"aria-label":`Computer uploads`,className:`prints-uploads`,children:(0,$.jsx)(`input`,{ref:ce,type:`file`,disabled:!C||h===null,accept:`image/*`,multiple:!0,hidden:!0,"aria-label":`Choose images to upload`,onChange:e=>{j(Array.from(e.currentTarget.files??[])),e.currentTarget.value=``}})}),(0,$.jsx)($A,{addedLength:hr(he.prompt,R.styles.find(e=>e.name===he.style)?.text,z.characters),styleControls:e=>({picker:(0,$.jsx)(KA,{styles:R.styles,selected:he.style,disabled:!W||ee||Ee,onSelect:e=>{G.setFieldValue(`style`,e)}}),dialog:(0,$.jsx)(qA,{open:e.open,onOpenChange:e.onOpenChange,styles:R.styles,selected:he.style,busy:R.busy,error:R.error,onSelect:e=>{G.setFieldValue(`style`,e)},onSave:R.save,onDelete:(e,t)=>{R.remove(e.id,t)}})}),characters:z.characters,characterDialog:e=>(0,$.jsx)(MA,{open:e.open,onOpenChange:e.onOpenChange,characters:z.characters,images:Ie,busy:z.busy,error:z.error,canUpload:C&&h!==null,onUpload:()=>ce.current?.click(),onSave:z.save,onDelete:(e,t)=>{z.remove(e.id,t)}}),guidance:je.find(e=>e.blocking&&e.group===`Setup`)??(ue!==null&&ue.model===he.model?{key:`iteration-model`,group:`Images`,tone:`warning`,short:`Model changed`,title:`Model changed`,detail:ue.message,actions:[{label:`Dismiss`,run:()=>{de(null)}}]}:void 0),commandApp:K,actions:(0,$.jsx)(yt,{"aria-label":`Upload images`,title:C?`Upload images to Computer`:`Connect a writable Computer to upload`,icon:(0,$.jsx)(ax,{}),label:null,className:`prints-upload-key`,disabled:!C||h===null,onClick:()=>ce.current?.click()}),form:G,mediaCapability:W&&U&&C&&h!==null,models:H,modelsLoading:ee,onSubmit:G.submitCurrent,submitting:Ee,values:he,computerId:n.computerId,mediaDirectory:h,referenceImages:Ie}),Fe===null?null:(0,$.jsx)(fk,{notices:je,uploads:Ne,open:r,inset:a,onOpenChange:i,onDismiss:s.dismiss,onDismissAll:()=>{s.dismissAll(Ae)},onLoadMore:B.hasMore?B.loadMore:void 0})]}),(0,$.jsx)(mk,{folder:n})]})}var tj=document.getElementById(`media-root`);if(!tj)throw Error(`Media root is missing`);su(tj,{name:`Prints`,queryClient:Tr()},({app:e})=>(0,J.createElement)(ej,{connection:e?{app:e}:null}));
|