@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.
@@ -1,10 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./print-download-button-D0u-jIIO.js","./rolldown-runtime-hePW80VL.js","./media-UoClPlTr.js","./log-event-Bm3IKl9o.js","./modules-C4mfDnjH.js","./print-info-drawer-BJccZZSi.js","./data-list-CKVz4p0-.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,At as s,B as c,Bn as l,Br as u,Bt as d,C as f,Cn as p,Cr as m,D as h,Dn as g,Dr as _,E as v,En as y,Er as b,F as x,Fn as S,Fr as C,Ft as w,G as T,Gn as E,Gt as D,H as O,Hn as k,Hr as A,Ht as j,I as M,In as N,Ir as P,It as F,J as I,Jt as L,K as R,Kn as z,Kt as B,L as V,Lr as H,Lt as ee,M as te,Mn as U,Mr as W,N as ne,Nn as re,Nr as ie,O as ae,On as oe,Or as se,Ot as ce,P as le,Pn as ue,Pr as de,Q as fe,Qt as G,R as pe,Rr as me,Rt as K,S as he,Sn as ge,Sr as _e,T as ve,Tn as ye,Tr as be,Tt as xe,U as Se,Un as Ce,Ur as we,Ut as Te,V as Ee,Vn as De,Vr as Oe,Vt as ke,W as Ae,Wn as je,Wt as Me,X as Ne,Xt as Pe,Y as Fe,Yt as Ie,Z as Le,Zt as Re,_ as ze,_n as Be,_r as Ve,an as He,ar as Ue,b as We,bn as Ge,c as Ke,cn as qe,cr as Je,d as Ye,dn as Xe,dr as Ze,dt as Qe,en as $e,er as et,et as tt,fr as nt,gn as rt,gr as it,hn as at,hr as ot,i as st,in as ct,ir as lt,it as ut,j as dt,jn as ft,jr as pt,k as mt,kn as ht,kr as gt,l as _t,lr as vt,mn as yt,mr as bt,n as xt,nn as St,nr as Ct,nt as wt,on as Tt,or as Et,pn as Dt,pr as Ot,pt as kt,q as At,qt as jt,r as Mt,rn as Nt,rr as Pt,rt as Ft,s as It,sr as Lt,tt as Rt,u as q,un as zt,ur as Bt,v as Vt,vr as Ht,w as Ut,wn as Wt,wr as Gt,x as Kt,xn as qt,xr as Jt,y as Yt,yn as Xt,yr as Zt,z as Qt,zr as $t,zt as en}from"./media-UoClPlTr.js";import{a as tn,c as nn,i as rn,l as an,n as on,o as sn,r as cn,s as ln,t as un,u as dn}from"./log-event-Bm3IKl9o.js";import{$ as fn,A as pn,At as mn,B as hn,Bt as gn,C as _n,Ct as vn,D as yn,Dt as bn,E as xn,Et as Sn,F as Cn,Ft as wn,G as Tn,H as En,Ht as Dn,I as On,It as kn,J as An,K as jn,L as Mn,Lt as Nn,M as Pn,Mt as Fn,N as In,Nt as Ln,Ot as Rn,P as zn,Pt as Bn,Q as Vn,R as Hn,Rt as Un,S as Wn,St as Gn,T as Kn,Tt as qn,U as Jn,Ut as Yn,V as Xn,Vt as Zn,W as Qn,Wt as $n,X as er,Y as tr,Z as nr,_ as rr,_t as ir,a as ar,at as or,b as sr,bt as cr,ct as lr,d as ur,dt as dr,et as fr,f as pr,ft as mr,g as hr,gt as gr,h as _r,ht as vr,i as yr,it as br,j as xr,jt as Sr,kt as Cr,l as wr,lt as Tr,m as Er,mt as Dr,n as Or,nt as kr,o as Ar,ot as jr,p as Mr,pt as Nr,q as Pr,rt as Fr,s as Ir,st as Lr,tt as Rr,u as zr,ut as Br,v as Vr,vt as Hr,w as Ur,wt as Wr,x as Gr,xt as Kr,y as qr,yt as Jr,z as Yr,zt as Xr}from"./data-list-CKVz4p0-.js";import{r as Zr}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(we(),1),Qr=class extends Error{code;details;constructor(e,t,n){super(t),this.code=e,this.details=n,this.name=`WhistleActionError`}},$r=class extends Error{constructor(){super(`Whistle runtime is closed`),this.name=`WhistleClosedError`}};function ei(){let e=!1,t=Ni,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=Ni,s(),o.clear())},contribute:t=>{if(li(t),e)throw new $r;ui(t,n),di(t,n);let r=Symbol(`whistle-contribution`);ci(t)||(n=[...n,{contribution:fi(t),generation:r}],i=!0,s());let a=!0;return ji(o=>{if(!a||e)return;let c={...t,commands:o};li(c);let l=n.findIndex(e=>e.generation===r),u=n.filter(e=>e.generation!==r);ui(c,u),di(c,u);let d=fi(c);if(ci(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=si(t,n);if(i===void 0)return{status:`missing`};let o;try{let e=Fi(i);if(e.status===`unavailable`)return e;let n=a.at(-1)?.presenter;r.interaction===void 0&&n!==void 0&&ti.has(r.origin)&&(o=n({commandId:oi(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=Li(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 Ni;let a=n.flatMap(e=>e.contribution.commands.map(Fi));return(i||a.some((e,t)=>!Ii(e,r[t])))&&(t=Ri(n,a),r=a,i=!1),t},subscribe:t=>e?()=>void 0:(o.add(t),()=>{o.delete(t)})})}var ti=new Set([`browser`,`keyboard`,`menu`,`palette`,`slash`,`terminal`]),ni=16,ri=32,ii=64,ai=256;function oi(e,t){return Pt.parse(`${e}:${t}`)}function si(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 ci(e){return e.commands.length===0}function li(e){ki(e.sourceId,`source ID`),ki(e.namespace,`namespace`),e.scope!==void 0&&ki(e.scope,`scope`);for(let t of e.commands)wi(t)}function ui(e,t){t.find(t=>t.contribution.namespace===e.namespace&&t.contribution.sourceId!==e.sourceId)!==void 0&&Mi(`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(oi(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=oi(e.namespace,t.id);n.has(i)&&Mi(`Canonical command ID is already registered`),n.add(i);for(let e of t.projections?.slash?.aliases??[])r.has(e)&&Mi(`Slash alias is already registered`),r.add(e)}}function di(e,t){t.length>=ii&&Mi(`Live contribution capacity exceeded`),t.reduce((e,t)=>e+t.contribution.commands.length,0)+e.commands.length>ai&&Mi(`Live command capacity exceeded`)}function fi(e){let t={sourceId:e.sourceId,namespace:e.namespace,commands:e.commands.map(pi)};return e.scope===void 0?t:{...t,scope:e.scope}}function pi(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=mi(e.action)),e.availability!==void 0&&(t.availability=e.availability),e.projections!==void 0&&(t.projections=vi(e.projections)),t}function mi(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=hi(e.inputSchema)),e.outputSchema!==void 0&&(t.outputSchema=hi(e.outputSchema)),e.presentation!==void 0&&(t.presentation=_i(e.presentation)),Object.freeze(t)}function hi(e){return Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,gi(t)])))}function gi(e){return Array.isArray(e)?Object.freeze(e.map(gi)):e!==null&&e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,gi(t)]))):e}function _i(e){switch(e.type){case`action`:return Object.freeze({type:`action`});case`custom`:return Object.freeze({type:`custom`,data:hi(e.data)});case`choice`:return Object.freeze({type:`choice`,options:Object.freeze(e.options.map(e=>Object.freeze({...e,value:gi(e.value)})))});case`form`:return Object.freeze({...e});case`confirmation`:return Object.freeze({...e})}}function vi(e){let t={};return e.bindings!==void 0&&(t.bindings=yi(e.bindings)),e.agent!==void 0&&(t.agent=bi(e.agent)),e.help!==void 0&&(t.help=xi(e.help.order)),e.menu!==void 0&&(t.menu=xi(e.menu.order)),e.palette!==void 0&&(t.palette=xi(e.palette.order)),e.slash!==void 0&&(t.slash=Si(e.slash)),t}function yi(e){let t={values:[...e.values]};return e.order!==void 0&&(t.order=e.order),t}function bi(e){let t={};return e.keybind!==void 0&&(t.keybind=e.keybind),e.order!==void 0&&(t.order=e.order),t}function xi(e){let t={};return e!==void 0&&(t.order=e),t}function Si(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=Ci(e.arguments)),t}function Ci(e){let t={hint:e.hint};return e.words!==void 0&&(t.words=Object.freeze(e.words.map(e=>Object.freeze({...e,arguments:hi(e.arguments)})))),e.text!==void 0&&(t.text=Object.freeze({...e.text,arguments:hi(e.text.arguments)})),Object.freeze(t)}function wi(e){ki(e.id,`command ID`,!0),ki(e.title,`title`),ki(e.category,`category`),Ti(e.action),Ei(e.projections)}function Ti(e){if(e?.presentation!==void 0)switch(e.presentation.type){case`action`:case`custom`:return;case`choice`:for(let t of e.presentation.options)ki(t.label,`choice label`),t.description!==void 0&&ki(t.description,`choice description`);return;case`form`:e.presentation.submitLabel!==void 0&&ki(e.presentation.submitLabel,`submit label`);return;case`confirmation`:ki(e.presentation.message,`confirmation message`),e.presentation.confirmLabel!==void 0&&ki(e.presentation.confirmLabel,`confirmation label`),e.presentation.cancelLabel!==void 0&&ki(e.presentation.cancelLabel,`cancellation label`)}}function Ei(e){if(e!==void 0){for(let t of[e.bindings,e.palette,e.slash,e.help,e.menu,e.agent])t!==void 0&&Ai(t.order);if(e.bindings!==void 0&&Oi(e.bindings.values,`binding`),e.slash!==void 0){Oi(e.slash.aliases,`slash alias`);for(let t of e.slash.aliases)/\s/u.test(t)&&Mi(`slash alias must not contain whitespace`);Di(e.slash.arguments)}e.agent?.keybind!==void 0&&ki(e.agent.keybind,`agent keybind`)}}function Di(e){if(e===void 0)return;ki(e.hint,`argument hint`),e.words===void 0&&e.text===void 0&&Mi(`slash arguments need words or text`);let t=new Set;for(let n of e.words??[])ki(n.word,`argument word`),/\s/u.test(n.word)&&Mi(`argument word must not contain whitespace`),t.has(n.word)&&Mi(`argument word is repeated`),t.add(n.word),n.description!==void 0&&ki(n.description,`argument word description`);t.size>ri&&Mi(`argument word count exceeds 32`),e.text!==void 0&&(ki(e.text.field,`argument text field`),e.text.requestIdField!==void 0&&ki(e.text.requestIdField,`request id field`))}function Oi(e,t){e.length>ni&&Mi(`${t} count exceeds 16`);for(let n of e)ki(n,t)}function ki(e,t,n=!1){e.trim().length===0&&Mi(`${t} must not be blank`),n&&e.includes(`:`)&&Mi(`${t} must not contain a colon`)}function Ai(e){e!==void 0&&!Number.isSafeInteger(e)&&Mi(`order must be a safe integer`)}function ji(e=()=>void 0,t=()=>void 0){return Object.freeze({update:e,dispose:t})}function Mi(e){throw Error(e)}var Ni=Object.freeze({bindings:Object.freeze([]),palette:Object.freeze([]),slash:Object.freeze([]),help:Object.freeze([]),menu:Object.freeze([]),agent:Object.freeze([])}),Pi=Object.freeze({status:`available`});function Fi(e){let t=e.availability?.()??Pi;return t.status===`available`?Pi:Object.freeze({status:`unavailable`,reason:t.reason})}function Ii(e,t){return e.status===`available`?t?.status===`available`:t?.status===`unavailable`&&e.reason===t.reason}function Li(e){if(e instanceof Qr){let t={code:e.code,message:e.message};return Object.freeze(e.details===void 0?t:{...t,details:gi(e.details)})}return Object.freeze({code:`command_failed`,message:e.message})}function Ri(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++]??Pi;if(u?.bindings!==void 0)for(let t of u.bindings.values)n.push({...Gi(e,l,u.bindings.order,d),binding:t});if(u?.palette!==void 0&&r.push({...Gi(e,l,u.palette.order,d)}),u?.slash!==void 0)for(let t of u.slash.aliases){let n={...Gi(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({...Gi(e,l,u.help.order,d)}),u?.menu!==void 0&&o.push({...Gi(e,l,u.menu.order,d)}),u?.agent!==void 0&&s.push(qi(e,l,u.agent,d))}}return Hi(n),Ui(i),Vi(r),Vi(a),Vi(o),Vi(s),Object.freeze({bindings:Wi(n),palette:Wi(r),slash:Wi(i),help:Wi(a),menu:Wi(o),agent:Wi(s)})}var zi=new TextEncoder;function Bi(e,t){let n=zi.encode(e),r=zi.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 Vi(e){e.sort((e,t)=>e.order-t.order||Bi(e.commandId,t.commandId))}function Hi(e){e.sort((e,t)=>e.order-t.order||Bi(e.commandId,t.commandId)||Bi(e.binding,t.binding))}function Ui(e){e.sort((e,t)=>e.order-t.order||Bi(e.commandId,t.commandId)||Bi(e.alias,t.alias))}function Wi(e){return Object.freeze(e.map(e=>Object.freeze(e)))}function Gi(e,t,n,r){let i=Ki(e,t,n,r);return e.scope===void 0?i:{...i,scope:e.scope}}function Ki(e,t,n,r){let i={commandId:oi(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 qi(e,t,n,r){let i=Gi(e,t,n.order,r),a=i.action===void 0?i:{...i,action:Ji(i.action)};return n.keybind===void 0?a:{...a,keybind:n.keybind}}function Ji(e){let t={};return e.inputSchema!==void 0&&(t.inputSchema=e.inputSchema),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),Object.freeze(t)}function Yi(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:Ue(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()}}}Zt(`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 Xi=`data-theme`;function Zi(e){return e||(globalThis.document?.documentElement??null)}function Qi(e){let t=e.trim();if(t.length===0)throw TypeError(`Theme must be a non-empty string`);return t}function $i(e,t){let n=Qi(e),r=Zi(t);r&&r.setAttribute(Xi,n)}function ea(e){return Zi(e)?.getAttribute(Xi)??null}var ta=class extends Dn{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:Yn(t,n.data),hasPreviousPage:$n(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function na(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var ra=class extends kt{#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,Qe.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,c=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!s(e,n)});!o&&!c||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(na(e,n).forEach(e=>{e.destroy()}),na(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=ce(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 Dn(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)&&Qe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}};function ia({queries:e,...t},n){let r=F(n),i=Zn(),a=gn(),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=>{Bn(e);let t=r.getQueryCache().get(e.queryHash);Nn(e,a,t)}),Xr(a);let[c]=J.useState(()=>new ra(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;J.useSyncExternalStore(J.useCallback(e=>f?c.subscribe(Qe.batchCalls(e)):xe,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),J.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>kn(s[t],e))?l.flatMap((e,t)=>{let n=s[t];if(n&&kn(n,e)){let e=new Dn(r,n);return wn(n,e,a)}return[]}):[];if(p.length>0)throw Promise.all(p);let m=l.find((e,t)=>{let n=s[t];return n&&Un({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 aa(e){return e}function oa(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function sa(e={},t){let n=F(t).getMutationCache(),r=J.useRef(e),i=J.useRef(null);return i.current===null&&(i.current=oa(n,e)),J.useEffect(()=>{r.current=e}),J.useSyncExternalStore(J.useCallback(e=>n.subscribe(()=>{let t=ce(i.current,oa(n,r.current));i.current!==t&&(i.current=t,Qe.schedule(e))}),[n]),()=>i.current,()=>i.current)}function ca(e,t){return Ln(e,ta,t)}var la=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}}}})),ua=t(((e,t)=>{t.exports=la()})),da=t((e=>{var t=we(),n=ua();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`),O=Symbol.for(`react.context`),k=Symbol.for(`react.forward_ref`),A=Symbol.for(`react.suspense`),j=Symbol.for(`react.suspense_list`),M=Symbol.for(`react.memo`),N=Symbol.for(`react.lazy`),P=Symbol.for(`react.offscreen`),F=Symbol.iterator;function I(e){return typeof e!=`object`||!e?null:(e=F&&e[F]||e[`@@iterator`],typeof e==`function`?e:null)}var L=Object.assign,R;function z(e){if(R===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);R=t&&t[1]||``}return`
3
- `+R+e}var B=!1;function V(e,t){if(!e||B)return``;B=!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{B=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?z(e):``}function H(e){switch(e.tag){case 5:return z(e.type);case 16:return z(`Lazy`);case 13:return z(`Suspense`);case 19:return z(`SuspenseList`);case 0:case 2:case 15:return e=V(e.type,!1),e;case 11:return e=V(e.type.render,!1),e;case 1:return e=V(e.type,!0),e;default:return``}}function ee(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 A:return`Suspense`;case j:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case O:return(e.displayName||`Context`)+`.Consumer`;case D:return(e._context.displayName||`Context`)+`.Provider`;case k:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case M:return t=e.displayName||null,t===null?ee(e.type)||`Memo`:t;case N:t=e._payload,e=e._init;try{return ee(e(t))}catch{}}return null}function te(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 ee(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 U(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function W(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ne(e){var t=W(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 re(e){e._valueTracker||=ne(e)}function ie(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=W(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function ae(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 oe(e,t){var n=t.checked;return L({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function se(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=U(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 ce(e,t){t=t.checked,t!=null&&b(e,`checked`,t,!1)}function le(e,t){ce(e,t);var n=U(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`)?de(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&de(e,t.type,U(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ue(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 de(e,t,n){(t!==`number`||ae(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var fe=Array.isArray;function G(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=``+U(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 pe(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return L({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function me(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(fe(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:U(n)}}function K(e,t){var n=U(t.value),r=U(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 he(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function ge(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 _e(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?ge(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var ve,ye=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(ve||=document.createElement(`div`),ve.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=ve.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function be(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xe={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},Se=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(xe).forEach(function(e){Se.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xe[t]=xe[e]})});function Ce(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||xe.hasOwnProperty(e)&&xe[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=Ce(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ee=L({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,q,zt,Bt=!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,zt(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(){Bt=!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,Bt||(Bt=!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 L(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=L({},xn,{view:0,detail:0}),wn=bn(Cn),Tn,En,Dn,On=L({},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(L({},On,{dataTransfer:0})),jn=bn(L({},Cn,{relatedTarget:0})),Mn=bn(L({},xn,{animationName:0,elapsedTime:0,pseudoElement:0})),Nn=bn(L({},xn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Pn=bn(L({},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(L({},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(L({},On,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Hn=bn(L({},Cn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zn})),Un=bn(L({},xn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Wn=bn(L({},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){Qr(e,0)}function lr(e){if(ie(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=ae();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ae(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!==ae(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 J(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,Ze(r,t,void 0,e),e.currentTarget=null}function Qr(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;J(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;J(i,s,l),a=c}}}if(qe)throw e=Je,qe=!1,Je=null,e}function $r(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`&&de(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))}Qr(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,te(e)||`Unknown`,a));return L({},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,da=null,fa=1,pa=``;function ma(e,t){ia[aa++]=sa,ia[aa++]=oa,oa=e,sa=t}function ha(e,t,n){ca[la++]=fa,ca[la++]=pa,ca[la++]=da,da=e;var r=fa;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,fa=1<<32-vt(t)+i|n<<i|r,pa=a+e}else fa=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===da;)da=ca[--la],ca[la]=null,pa=ca[--la],ca[la]=null,fa=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=da===null?null:{id:fa,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===N&&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 N:var r=t._init;return f(e,r(t._payload),n)}if(fe(t)||I(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 N:return i=n._init,p(e,t,i(n._payload),r)}if(fe(n)||I(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 N:var a=r._init;return m(e,t,n,a(r._payload),i)}if(fe(r)||I(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=I(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===N&&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 N:return l=i._init,_(e,r,l(i._payload),o)}if(fe(i))return h(e,r,i,o);if(I(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=L({},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:_e(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=_e(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=_e(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=fa;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=L({},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:L({},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+=H(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++]=fa,ca[la++]=pa,ca[la++]=da,fa=e.id,pa=e.overflow,da=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=oe(e,i),r=oe(e,r),o=[];break;case`select`:i=L({},i,{value:void 0}),r=L({},r,{value:void 0}),o=[];break;case`textarea`:i=pe(e,i),r=pe(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`&&$r(`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`:$r(`cancel`,i),$r(`close`,i);break;case`iframe`:case`object`:case`embed`:$r(`load`,i);break;case`video`:case`audio`:for(o=0;o<Xr.length;o++)$r(Xr[o],i);break;case`source`:$r(`error`,i);break;case`img`:case`image`:case`link`:$r(`error`,i),$r(`load`,i);break;case`details`:$r(`toggle`,i);break;case`input`:se(i,s),$r(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},$r(`invalid`,i);break;case`textarea`:me(i,s),$r(`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`&&$r(`scroll`,i)}switch(n){case`input`:re(i),ue(i,s,!0);break;case`textarea`:re(i),he(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=ge(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`:$r(`cancel`,e),$r(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:$r(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Xr.length;o++)$r(Xr[o],e);o=i;break;case`source`:$r(`error`,e),o=i;break;case`img`:case`image`:case`link`:$r(`error`,e),$r(`load`,e),o=i;break;case`details`:$r(`toggle`,e),o=i;break;case`input`:se(e,i),o=oe(e,i),$r(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=L({},i,{value:void 0}),$r(`invalid`,e);break;case`textarea`:me(e,i),o=pe(e,i),$r(`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&&ye(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&be(e,u):typeof u==`number`&&be(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&$r(`scroll`,e):u!=null&&b(e,s,u,c))}switch(n){case`input`:re(e),ue(e,i,!1);break;case`textarea`:re(e),he(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+U(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&G(e,!!i.multiple,i.defaultValue,!0):G(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{be(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&&ce(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`?ye(a,f):d===`children`?be(a,f):b(a,d,f,u)}switch(c){case`input`:le(a,o);break;case`textarea`:K(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?G(a,!!o.multiple,o.multiple?[]:``,!1):G(a,!!o.multiple,o.defaultValue,!0)):G(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=Ce(`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&&(be(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===k)return 11;if(e===M)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 A:return e=Xl(13,n,t,a),e.elementType=A,e.lanes=o,e;case j:return e=Xl(19,n,t,a),e.elementType=j,e.lanes=o,e;case P:return nu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case D:s=10;break a;case O:s=9;break a;case k:s=11;break a;case M:s=14;break a;case N: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=P,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=q();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)}},q=function(){return Pt},zt=function(e,t){var n=Pt;try{return Pt=e,t()}finally{Pt=n}},je=function(e,t,n){switch(t){case`input`:if(le(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));ie(i),le(i,a)}}}break;case`textarea`:K(e,n);break;case`select`:t=n.value,t!=null&&G(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`})),fa=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=da()})),pa=t((e=>{var t=fa();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))();function ma(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid keymap token: token cannot be empty`);return t}function ha(e){let t=e.trim().toLowerCase();if(!t)throw Error(`Invalid key name: key name cannot be empty`);return t}function ga(e){return{name:ha(e.name),ctrl:e.ctrl??!1,shift:e.shift??!1,meta:e.meta??!1,super:e.super??!1,hyper:e.hyper||void 0}}function _a(e){return{name:e.name,ctrl:e.ctrl,shift:e.shift,meta:e.meta,super:e.super,hyper:e.hyper||void 0}}function va(e,t){let n=_a(ga(e));return{stroke:n,display:t?.display??Ea(n),match:t?.match??Sa(n),tokenName:t?.tokenName?ma(t.tokenName):void 0}}function ya(e){return{stroke:_a(e.stroke),display:e.display,match:e.match,tokenName:e.tokenName,patternName:e.patternName,payloadKey:e.payloadKey}}function ba(e){return e.map(e=>ya(e))}function xa(e){return`match`in e?e.match:`stroke`in e?Sa(e.stroke):Sa(e)}function Sa(e){return`key:${Da(ga(e))}`}function Ca(e){let t=e.trim();if(!t)throw Error(`Invalid keymap match id: id cannot be empty`);return`text:${t}`}function wa(e,t){return`stroke`in e?t?.preferDisplay&&e.display?e.display:Ea(e.stroke):Ea(ga(e))}function Ta(e,t){return e.map(e=>wa(e,t)).join(t?.separator??``)}function Ea(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 Da(e){return`${e.name}:${+!!e.ctrl}:${+!!e.shift}:${+!!e.meta}:${+!!e.super}:${+!!e.hyper}`}var Oa=Symbol(`keymap-extension-context`);function ka(e){return e.isDestroyed?null:e.getFocusedTarget()}function Aa(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 ja(e,t){let n=new Set;return Aa(e,t,e=>{n.add(e)}),n}function Ma(e,t,n){let r=[],i=ja(t,n),a=Array.isArray(e)?e:Na(e);for(let e of a)Pa(t,e,n,i)&&r.push(e);return r}function Na(e){return[...e].sort((e,t)=>t.priority-e.priority||t.order-e.order)}function Pa(e,t,n,r=ja(e,n)){let i=t.target;return i?e.isTargetDestroyed(i)?!1:t.targetMode===`focus`?i===n:r.has(i):!0}function Fa(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 Ia(e,t,n=!0){let r=e.binding.sequence[e.index];if(!r?.patternName)return!0;let i=t.get(r.patternName);return i?Fa(e)>=i.min:n}function La(e,t,n=!0){let r=e.binding.sequence[e.index];if(r?.patternName){let n=t.get(r.patternName);if(n&&Fa(e)<n.max)return!0}return Ia(e,t,n)&&e.index+1<e.binding.sequence.length}function Ra(e,t){return e.index===e.binding.sequence.length-1&&Ia(e,t,!1)}function za(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 Ba(e,t){let n=za(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=za(e,n.stroke,n.match,r),e.patternChildren.push(i))}else i=e.children.get(n.match),i||(i=za(e,n.stroke,n.match),e.children.set(n.match,i));i.reachableBindings.push(r),e=i}e.bindings.push(r)}return n}function Va(e,t){let n=[];for(let r of e){if(!Ia(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 Ha(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 Ua(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 Wa(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 Ha({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 Ga(e,t,n,r,i,a){let o=e.binding.sequence[e.index];if(o?.patternName){let s=r.get(o.patternName);if(s&&Fa(e)<s.max){let t=i(s.name,n);if(t){let r=a(n,s.name,t);return Ha(e,e.index,r,t.value??n.name)}}return Ia(e,r,!1)?Wa(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a):void 0}return Wa(e.layer,e.binding,e.index+1,e.parts,e.patterns,t,n,i,a)}function Ka(e,t,n,r,i){let a=[],o=1/0;for(let s of e.bindings){if(s.event!==`press`)continue;let c=Wa(e,s,0,[],void 0,t,n,r,i);if(!c)continue;let l=Ua(c,t);l<o&&(o=l,a.length=0),l===o&&a.push(c)}return a}import.meta.require;function qa(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 Ja(){let e=[];return{get:()=>e,set:t=>{e=t},remove(t){e=e.filter(e=>e!==t)},has:()=>e.length>0,clear:()=>{e=[]}}}function Ya(){let e=Ja();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 Xa(){let e=Ja(),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 Za(e){return typeof e==`string`||!!e&&typeof e==`object`&&!Array.isArray(e)}function Qa(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(!Za(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 $a(e){let t=Qa(e);if(!t.ok)throw Error(t.reason);return e.map(e=>({...e,key:typeof e.key==`string`?e.key:{...e.key}}))}function eo(e){return{...e,sequence:ba(e.sequence)}}function to(e,t){let n=Ya();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=no(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 no(e){return e.map(t=>({sequence:ba(t.sequence),command:t.command,attrs:t.attrs,event:t.event,preventDefault:t.preventDefault,fallthrough:t.fallthrough,parsedBinding:eo(t.parsedBinding),sourceTarget:t.sourceTarget,sourceLayerOrder:t.sourceLayerOrder,bindingIndex:t.bindingIndex,hasCommandAtSequence:e.some(e=>e.event===`press`&&e.command!==void 0&&ro(e,t)),hasContinuations:e.some(e=>e.event===`press`&&io(t,e))}))}function ro(e,t){return e.sequence.length===t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function io(e,t){return e.sequence.length<t.sequence.length&&e.sequence.every((e,n)=>e.match===t.sequence[n]?.match)}function ao(){return{version:-1,notifyVersion:-1,focused:void 0,value:[],targets:new WeakMap}}function oo(){return{plain:ao(),bindings:ao(),metadata:ao(),bindingsAndMetadata:ao()}}function so(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 co(e,t,n){let r=n?e.targets.get(n):e.nullTarget;return r?.version===t?r:void 0}function lo(e,t,n,r){let i={version:t,value:r};n?e.targets.set(n,i):e.nullTarget=i}function uo(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 fo(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 po(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=wa(i.stroke)),c&&(o=void 0),n.push(va(i.stroke,{display:a,match:i.match,tokenName:o}))}return n}function mo(e){if(e.isDestroyed)throw Error(`Cannot use a keymap after its host was destroyed`);return e}function ho(e,t,n,r,i,a,o={}){let s=oo(),c=-1,l=[],u=()=>mo(t).getFocusedTarget(),d=()=>ka(t),f=t=>{let n=e.pending;uo(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)&&La(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?po(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=fo(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=so(s,t);return i.notifyVersion===e.derivedVersion?i.value:y(i,n,r)},y=(n,r,i)=>{t.isDestroyed&&mo(t);let o=u(),s=co(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,lo(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=Ma(e.sortedLayers,t,n),e.activeLayersCache),C=(e,n)=>Pa(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?wa(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(Va(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?wa(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:_a(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?po(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:po,collectMatchingBindings:E,collectActiveBindings:A}}var go=new Set([`name`,`run`,`fields`,`attrs`,`rejectedResult`]),_o=new Set([`key`,`cmd`,`event`,`preventDefault`,`fallthrough`]),vo=new Set([`target`,`targetMode`,`priority`,`bindings`,`commands`]);function yo(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 bo(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 xo(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function So(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),xo(n,e.command.name,i)}return{entries:t,chainsByName:n}}function Co(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),xo(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 wo(e,t,n,r){return(e.activeLayersCacheVersion!==e.cacheVersion||e.activeLayersCacheFocused!==r)&&(e.activeLayersCacheVersion=e.cacheVersion,e.activeLayersCacheFocused=r,e.activeLayersCache=Ma(e.sortedLayers,t,r)),Co(e.activeLayersCache,n,!0)}function To(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 Eo(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 Do(e){let t=`field ${e.fieldName}`;return{require(n,r){To(e.requirements,n,r,t)},attr(n,r){if(!e.attrs)throw Error(`Keymap ${t} cannot publish attrs`);Eo(e.attrs,n,r,t)},activeWhen(n){e.matchers.push(e.conditions.buildRuntimeMatcher(n,t))}}}function Oo(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ko(e,t){return e instanceof Error&&e.message?e.message:t}function Ao(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:typeof e.then==`function`}function jo(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=>jo(e,t)):[...e];return r?Object.freeze(i):i}if(e&&typeof e==`object`){if(i&&!Oo(e))return e;let a={};for(let[r,i]of Object.entries(e))a[r]=n?jo(i,t):i;return r?Object.freeze(a):a}return e}var Mo=[`name`],No=Object.freeze({}),Po=new WeakMap;function Fo(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=>Lo({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=>Io(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:Io(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(!Pa(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=wo(e,t,r,n);return P()&&(s=e.derivedVersion,c=n,l=i),i},N=()=>a===e.derivedVersion&&o?o:(a=e.derivedVersion,o=So(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,ka(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:ka(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??[],Ho({entries:r,query:e,getCommand:e=>Io(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=Ro(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)??Vo(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 Io(e){return e.command}function Lo(e){let t=[],n=new Set;for(let r of e.commands)try{let i={},a=[],o=bo(r.name),s=zo(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,Do({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,ko(t,`Failed to register keymap command "${String(r.name)}"`));continue}return t}function Ro(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:Bo(t,o.getExecutionFields())}}return{hadError:i}}function zo(e){let t={};for(let[n,r]of Object.entries(e))!go.has(n)&&r!==void 0&&(t[n]=r);return Object.keys(t).length===0?No:t}function Bo(e,t){return{command:e,input:t.input,payload:t.payload}}function Vo(e){let t=zo(e);return t===No?void 0:t}function Ho(e){let t=e.query?.namespace,n=Uo(e.query?.limit);if(n===0)return[];let r=e.query?.search?.trim().toLowerCase()??``,i=Mo;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(Go(u,t)&&Wo(u,r,i)&&!(c&&!c.has(u.command.name))&&Ko(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 Uo(e){if(e===void 0)return;let t=Math.floor(Number(e));return!Number.isFinite(t)||t<=0?0:t}function Wo(e,t,n){if(!t)return!0;for(let r of n)if(qo(e,r,t))return!0;return!1}function Go(e,t){if(t===void 0)return!0;let n=e.fields;return Object.prototype.hasOwnProperty.call(n,`namespace`)?es(n.namespace,t):!1}function Ko(e,t,n){if(!t)return!0;for(let[r,i]of t)if(!Zo(e,r,i,n))return!1;return!0}function qo(e,t,n){return Jo(e,t)?.includes(n)===!0}function Jo(e,t){let n=Po.get(e);if(n||(n=new Map,Po.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=Yo(a);return n.set(t,o),o}function Yo(e){if(Array.isArray(e)){let t=[];for(let n of e){let e=Yo(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 Xo(e,t,n,r){try{return e(t,n)}catch(e){return r(e),!1}}function Zo(e,t,n,r){return typeof n==`function`?Qo(e,t,n,r):$o(e,t,n)}function Qo(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,Xo(n,i.name,l(),r.onFilterError))||Object.prototype.hasOwnProperty.call(a,t)&&(c=!0,Xo(n,a[t],l(),r.onFilterError))||o&&Object.prototype.hasOwnProperty.call(o,t)&&(c=!0,Xo(n,o[t],l(),r.onFilterError))?!0:!c&&Xo(n,void 0,l(),r.onFilterError)}function $o(e,t,n){let r=e.command,i=e.fields,a=e.attrs;return t===`name`&&es(r.name,n)||Object.prototype.hasOwnProperty.call(i,t)&&es(i[t],n)?!0:!!a&&Object.prototype.hasOwnProperty.call(a,t)&&es(a[t],n)}function es(e,t){return Array.isArray(t)?t.some(t=>ts(e,t)):ts(e,t)}function ts(e,t){return Array.isArray(e)?e.some(e=>ts(e,t)):Object.is(e,t)}function ns(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(Ao(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(rs(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=yo(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`&&(is(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 is(n,i),!0;return!1}}}function rs(e){return typeof e==`object`&&!!e&&`ok`in e}function is(e,t){e.preventDefault&&(t.preventDefault(),t.stopPropagation())}var as=Object.freeze({}),os=[],ss=[];function cs(e){if(Object.keys(e).length!==0)return jo(e,{freeze:!0})}function ls(e,t,n,r){let i=t=>hs(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:as,parseObjectKey:(e,t)=>c(e,t)}),a=t=>{if(typeof t!=`string`)return[c(t)];let n=ms(t,e.bindingParsers.values(),{tokens:e.tokens,patterns:e.patterns,layer:as,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)=>Ta(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=fs(b.key,m,{layer:d})}catch(e){t.emitError(`binding-expand-error`,e,ko(e,`Failed to expand keymap binding`));continue}for(let m of i){let i=m.key,x;try{x=typeof i==`string`?ms(i,h,{tokens:a,patterns:e.patterns,layer:d,parseObjectKey:(e,t)=>c(e,t)}):{parts:[c(i)],usedTokens:[],unknownTokens:[],hasTokenBindings:!1},x=ps(x,m)}catch(e){t.emitError(`binding-parse-error`,e,ko(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`||_o.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,Do({fieldName:e,conditions:n,requirements:c,matchers:d,attrs:u}))}let p=Object.keys(u).length>0?cs(u):void 0,m=yo(i.cmd),h={binding:b,sequence:a,command:m,event:t,parsedBinding:eo(i),sourceTarget:o,sourceLayerOrder:s,bindingIndex:r,requires:Object.keys(c).length>0?Object.entries(c):os,matchers:d.length>0?d:ss,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`&&!_&&ds(f,h),f.push(h)}catch(e){t.emitError(`binding-compile-error`,e,ko(e,`Failed to compile keymap binding`))}}}return{bindings:f,hasTokenBindings:p}},c=(e,t)=>va(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:ba(r)}];let l={...n,sequence:ba(r)},u=[],d=!0,f=o??as;for(let n of s)try{n(l,{layer:f,parseKey:t=>hs(t,a,{tokens:i,patterns:e.patterns,layer:f,parseObjectKey:(e,t)=>c(e,t)}),add:e=>{u.push(eo(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 us(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 ds(e,t){for(let n of e)if(n.event===`press`&&(n.command!==void 0&&us(n.sequence,t.sequence)||t.command!==void 0&&us(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 fs(e,t,n){if(typeof e!=`string`||t.length===0)return[{key:e}];let r=n?.layer??as,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 ps(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 ms(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??as,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:ma,createMatch:Ca,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 hs(e,t,n){if(typeof e!=`string`)return n.parseObjectKey(e);let{parts:r}=ms(e,t,n),[i]=r;if(!i||r.length!==1)throw Error(`Invalid key "${String(e)}": expected a single key stroke`);return i}function gs(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.get==`function`&&typeof t.subscribe==`function`}function _s(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(gs(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 vs=Symbol(`keymap-disambiguation-decision`),ys=Symbol(`keymap-deferred-disambiguation-decision`);function bs(e,t){return{[vs]:!0,action:e,handler:t}}function xs(e){return{[ys]:!0,action:e}}function Ss(e){return!!e&&typeof e==`object`&&e[vs]===!0}function Cs(e){return!!e&&typeof e==`object`&&e[ys]===!0}function ws(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 Ts(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 Es(e,t,n,r){let i=e.get(n)?.payloadKey??n;return{...va({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 Ds(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 Os(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:ba(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:ba(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?ba(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=Ga(r,n,i,e.patterns,K,he);t&&c.push(t)}let l=c.reduce((e,t)=>Math.min(e,Ua(t,n)),1/0),u=c.filter(e=>Ua(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(!Ra(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=ge(n,r,a,o,c);if(u.length===0)continue;if(u.filter(t=>La(t,e.patterns,!1)).length>0){let n=u.filter(t=>Ra(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=>Ra(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??=ba(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:_a(e.stroke)},c},get exact(){return o??=r.collectActiveBindings(i.exactBindings,i.focused,i.activeView).map(e=>({...e,sequence:ba(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:()=>bs(`run-exact`),continueSequence:()=>bs(`continue-sequence`),clear:()=>bs(`clear`),defer:e=>bs(`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(Ao(e)){t.emitError(`invalid-disambiguation-resolver-return`,e,`[Keymap] Disambiguation resolvers must return synchronously; use ctx.defer(...) for async handling`);continue}if(!Ss(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:ba(i),focused:r,sleep:t=>ws(t,e.controller.signal),runExact:()=>xs(`run-exact`),continueSequence:()=>xs(`continue-sequence`),clear:()=>xs(`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(Ao(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&&!Cs(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=Ta(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 ge(n,r,a,o,l))La(t,e.patterns,!1)&&c.push(t)}return c}function fe(t,n,r){return t.filter((t,i)=>i>=n&&La(t,e.patterns,!1)&&As(t.parts,r.parts))}function G(t,n){return t.filter(t=>t.layer===n.layer&&Ra(t,e.patterns)&&As(t.parts,n.parts))}function pe(n){let r=e.eventMatchResolvers.values();if(r.length===0)return[];if(r.length===1)return ks(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 K(n,r){return Ts(e.patterns,t,n,r)}function he(t,n,r){return Es(e.patterns,t,n,r)}function ge(e,t,n,r,i){let a=Ka(e,t,n,K,he);return a.some(e=>ye(e,r,i))?a:[]}function _e(n){return Ds(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 ks(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 As(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 js=()=>{};function Ms(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 Ns(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 Ps(e,t,n,r,i){let a;try{a=ma(i.name)}catch(e){return t.emitError(`token-name-normalize-error`,e,ko(e,`Failed to register keymap token`)),js}if(e.tokens.has(a)||e.patterns.has(a))return t.emitError(`duplicate-token`,{token:a},`Keymap token "${a}" is already registered`),js;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,ko(e,`Failed to register keymap token "${a}"`)),js}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,ko(e,`Failed to register keymap token "${a}"`)),js}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,ko(e,`Failed to unregister keymap token "${a}"`))}}}function Fs(e,t,n,r){let i,a;try{i=ma(r.name);let e=Ms(i,`min`,r.min,1),t=Ms(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:Ca(`pattern:${i}`),min:e,max:t,matcher:e=>r.match(e),finalize:r.finalize}}catch(e){return t.emitError(`sequence-pattern-register-error`,e,ko(e,`Failed to register keymap sequence pattern`)),js}return e.tokens.has(i)||e.patterns.has(i)?(t.emitError(`duplicate-sequence-pattern`,{pattern:i},`Keymap sequence pattern "${i}" is already registered`),js):(e.patterns.set(i,a),n.recompileBindings(),()=>{e.patterns.get(i)===a&&(e.patterns.delete(i),n.recompileBindings())})}function Is(e,t,n,r){return Ns(r,{kind:n,reservedFields:n===`layer`?vo:n===`binding`?_o:go,registeredFields:n===`layer`?e.layerFields:n===`binding`?e.bindingFields:e.commandFields,emitError:(e,n,r)=>t.emitError(e,n,r)})}var Ls=()=>{};function Rs(e,t){return t.priority-e.priority||t.order-e.order}function zs(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 Bs(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 Vs(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`),Ls;let o,s,c,p,m,v,y;try{y=l(n),o=u($a(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,ko(e,`Failed to register keymap layer`)),Ls}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 Ls;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:Ba(x.bindings,e.patterns),hasTokenBindings:x.hasTokenBindings,activeKeyCacheBlocked:!1,activeCommandViewCacheBlocked:!1};_(S),e.layers.add(S),e.sortedLayers=[...e.sortedLayers,S].sort(Rs),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=>Qa(e)});t&&(i=$a(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(vo.has(c)||l===void 0)continue;o[c]=jo(l);let t=e.layerFields.get(c);if(!t){i.warnUnknownField(`layer`,c);continue}t(l,Do({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?jo(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=Ba(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,ko(e,`Failed to subscribe to reactive matcher from ${n.source}`))}},_=t=>{let n=zs(t),r=Bs(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,ko(e,`Failed to dispose reactive matcher from ${n.source}`))}n.dispose=void 0}};return{registerLayer:a,applyTokenState:o,recompileBindings:s,cleanup:c}}var Hs=1e3;function Us(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>=Hs){e.stateChangePending=!1,i(`state-change-feedback-loop`,{iterations:Hs},`[Keymap] Possible infinite state listener feedback loop detected after ${Hs} 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 Ws(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 Gs=Object.freeze({});function Ks(){return{order:0,tokens:new Map,patterns:new Map,layerFields:new Map,layerBindingsTransformers:Ya(),bindingExpanders:Ya(),bindingParsers:Ya(),bindingTransformers:Ya(),bindingFields:new Map,commandTransformers:Ya(),commandFields:new Map,eventMatchResolvers:Ya(),disambiguationResolvers:Ya(),keyHooks:Xa(),keyAfterHooks:Xa(),rawHooks:Xa(),layers:new Set,sortedLayers:[],activeLayersCacheVersion:-1,activeLayersCacheFocused:void 0,activeLayersCache:[],activeKeyCacheBlockers:0,activeCommandViewCacheBlockers:0,commandResolvers:Ya(),pending:null,data:{},dataVersion:0,readonlyDataVersion:-1,readonlyData:Gs,cacheVersion:0,derivedVersion:0,stateChangeDepth:0,stateChangePending:!1,flushingStateChange:!1,usedWarningKeys:new Set}}function qs(e){return xa(e)}var Js=class{#e=Ks();#t=!1;#n=new Map;#r=[];#i=qa(()=>{});#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=qa((e,t)=>{this.#o.reportListenerError(e,t)}),this.#o=Us(this.#e,this.#i,this.#a),this.#l=_s(this.#e,this.#o),this.#u=Fo(this.#e,this.#b,this.#o,this.#l,{onCommandResolversChanged:()=>{this.#s.ensureValidPendingSequence()}}),this.#s=ho(this.#e,this.#b,this.#a,this.#o,this.#l,this.#u,{onPendingSequenceChanged:(e,t)=>{this.#p?.handlePendingSequenceChange(e,t)}}),this.#c=Ws(this.#e,this.#o,this.#s),this.#d=ns(this.#o,this.#c,this.#s,this.#u,{keymap:this,createCommandEvent:()=>this.#b.createCommandEvent()}),this.#f=ls(this.#e,this.#o,this.#l,{warnUnknownField:(e,t)=>{this.#C(e,t)},warnUnknownToken:(e,t)=>{this.#w(e,t)}}),this.#h=to(this.#o,this.#u),this.#m=Vs(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=Os(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()}))}[Oa](){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?qs(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 Is(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 Ps(this.#e,this.#o,this.#f,this.#m,e)}registerSequencePattern(e){return Fs(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 Is(this.#e,this.#o,`binding`,e)}registerCommandFields(e){return Is(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)))}},Ys=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(`.`)),Xs=new Set([`ctrl`,`control`,`shift`,`meta`,`alt`,`option`,`super`,`hyper`]),Zs=$s(Ys),Qs=$s(Xs);function $s(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 ec(e){return e>=65&&e<=90?e+32:e}function tc(e){return e>=48&&e<=57}function nc(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(ec(e.charCodeAt(n+r))!==t.charCodeAt(r))return!1;return!0}function rc(e,t,n){let r=t.charCodeAt(n);if(Number.isNaN(r))return;let i=e.get(ec(r));if(i){for(let e of i)if(nc(t,e,n))return e}}function ic(e,t,n,r,i){return e.parseObjectKey(t,{display:n,match:r,tokenName:i})}function ac(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 oc(e,t){let n=e.trim().toLowerCase();return t.parseObjectKey({name:n},{display:n})}function sc(e,t){let n=rc(Zs,e,t);if(n)return n;if(ec(e.charCodeAt(t))!==102||!tc(e.charCodeAt(t+1)))return;let r=tc(e.charCodeAt(t+2))?t+3:t+2;return e.slice(t,r).toLowerCase()}function cc(e,t){return rc(Qs,e,t)}function lc(e,t,n){let r=t,i=!1,a=!1,o=!1,s=!1,c=!1;for(;r<e.length;){let t=cc(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=sc(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 uc=e=>{let{input:t,index:n,tokens:r,normalizeTokenName:i}=e;if(n===0&&t.includes(`+`)&&/\s/.test(t))return{parts:[ac(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:[ac(a,e)],nextIndex:n+1};let s=i(t.slice(n+1,o)),c=r.get(s);return c?{parts:[ic(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:[ac(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=lc(t,n,e);if(o)return{parts:[o.part],nextIndex:o.nextIndex};let s=sc(t,n);return s?{parts:[oc(s,e)],nextIndex:n+s.length}:{parts:[ac(a,e)],nextIndex:n+1}},dc=(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 fc(e){return e.appendBindingParser(e=>uc(e))}function pc(e){return e.appendEventMatchResolver((e,t)=>dc(e,t))}function mc(e){let t=fc(e),n=pc(e);return()=>{n(),t()}}var Y=Symbol(`keymap:mod-bindings`),hc=/(^|[+,\s])mod(?=\s*\+)/i,gc=/(^|[+,\s])mod(?=\s*\+)/gi;function _c(e){let t=e.primaryModifier;return(t===`ctrl`||t===`super`)&&e.modifiers[t]!==`unsupported`?t:e.modifiers.ctrl===`unsupported`?`super`:`ctrl`}function vc(e){if(e.includes(`,`))return[e];let t=e.trim();return t.includes(` `)?t.split(/\s+/):[e]}function yc(e){return e.acquireResource(Y,()=>e.appendBindingExpander(({input:t,displays:n})=>{if(!hc.test(t))return;let r=_c(e.getHostMetadata());return[{key:t.replace(gc,(e,t)=>`${t}${r}`),displays:n??vc(t)}]}))}var bc=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 xc(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 Sc(){let e=globalThis.navigator,t=e?.userAgentData?.platform,n=xc(t);return n===`unknown`?xc(e?.platform??e?.userAgent):n}function Cc(){let e=Sc();return{platform:e,primaryModifier:e===`macos`?`super`:e===`unknown`?`unknown`:`ctrl`,modifiers:{ctrl:`supported`,shift:`supported`,meta:`supported`,super:`supported`,hyper:`unsupported`}}}function wc(e){return e.length===1&&!/^[a-z0-9]$/i.test(e)}function Tc(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||!wc(t.name)?[t]:[t,{...t,shift:!1}]}var Ec=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 Dc(){return globalThis.MutationObserver}function Oc(e){return bc.get(e)||(/^F\d{1,2}$/i.test(e)||e.length===1?e.toLowerCase():e.trim().toLowerCase().replace(/\s+/g,``))}function kc(e){if(!e)return new Ec(`command`,!1,!1,!1,!1);let t=globalThis.KeyboardEvent;return new Ec(Oc(e.key),e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t&&e instanceof t?e:void 0)}var Ac=class{metadata=Cc();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(kc(t))};return this.rootTarget.addEventListener(`keydown`,t,{capture:!0}),()=>{this.rootTarget.removeEventListener(`keydown`,t,{capture:!0})}}onKeyRelease(e){let t=t=>{e(kc(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 kc()}ensureObserver(){if(this.observer||this.targetDestroyListeners.size===0)return;let e=Dc();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 jc(e){return new Ac(e)}var Mc=(e,t)=>Tc(e).map(e=>t.resolveKey(e));function Nc(e){return e instanceof K?{code:e.code,message:Fc(e.message),retryable:e.retryable}:{code:`HOST_FAILURE`,message:`Host operation failed`,retryable:!1}}function Pc(e){try{let t=dt(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 Fc(e){return e.trim().slice(0,512)||`Host operation failed`}var Ic=e=>({ok:!0,value:e}),Lc=e=>({error:Nc(e),ok:!1});async function Rc(e,t){let n,r=new Set;try{return n=await e,zc(t(n))}catch(e){throw Bc(e)&&Vc(e,r),e instanceof K?e:new K(`The remote operation failed`,{cause:e,code:`HOST_FAILURE`,retryable:!0})}finally{n!==e&&Bc(n)&&Vc(n,r)}}function zc(e){if(e.ok)return e.value;throw Pc(e.error)}function Bc(e){return et(e)&&Symbol.dispose in e&&r(e[Symbol.dispose])}function Vc(e,t){if(!t.has(e)){t.add(e);try{e[Symbol.dispose]()}catch(e){console.warn(`RPC result disposal failed`,e)}}}function Hc(){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 Uc(e){let t=Ae(e),n=new Set;return{get:()=>t,subscribe:e=>(n.add(e),()=>n.delete(e)),update:e=>{t=Ae(e);for(let e of Array.from(n))try{e()}catch(e){console.warn(`Reserved chord subscriber failed`,e)}}}}function Wc(e){let t=!0,n,r=e.window.document.querySelector(`html`);if(!r)return()=>{t=!1};let i=jc(r),a=new Js(i);mc(a),yc(a),a.prependEventMatchResolver(Mc);let o=Kc(e.onBroken),s=Xc(a,e.chords,e.remote,o),c=Gc(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=()=>qc(e.window.document,e.identity.surfaceId).editing,p=d===void 0?()=>void 0:Jc(a,d,f),m=d===void 0?()=>void 0:d.subscribe(()=>{p(),p=Jc(a,d,f)}),h=e.chords.subscribe(()=>{s(),s=Xc(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 Gc(e,t,n,r,i){return()=>{if(!n())return;let a=qc(e.window.document,e.identity.surfaceId),o=i();(a.editing!==o?.editing||a.surface!==o.surface)&&(r(a),t(()=>e.remote.reportFocus(a)))}}function Kc(e){return t=>{try{Rc(t(),Fe).catch(t=>{dn(`browser-bridge.host-call`,t),e(t)})}catch(t){dn(`browser-bridge.host-call`,t),e(t)}}}function qc(e,t){let n=e.activeElement;return ne({editing:!!(n?.matches(`input, textarea, select, [contenteditable='true']`)===!0||n?.closest(`[contenteditable='true']`)),surface:e.hasFocus()?t:null})}function Jc(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||Yc(e.key)&&n())return!1;e.run()}})),priority:500})}function Yc(e){return!/(?:^|\+)(?:ctrl|control|super|meta|cmd|alt|option|mod)\+/iu.test(e)}function Xc(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:Oc(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 Zc(e){let t=t=>{if(t.defaultPrevented||t.isComposing)return;let n=el(t,e.mac);n!==null&&(t.preventDefault(),n===`back`&&!t.repeat&&e.canGoBack()&&e.back())},n=t=>{let n=$c(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 Qc)e.window.addEventListener(t,n);return()=>{e.window.removeEventListener(`keydown`,t);for(let t of Qc)e.window.removeEventListener(t,n)}}var Qc=[`mousedown`,`mouseup`,`auxclick`];function $c(e){return e===3?`back`:e===4?`forward`:null}function el(e,t){return e.shiftKey||e.ctrlKey?null:t?!e.metaKey||e.altKey?null:e.key===`[`?`back`:e.key===`]`?`forward`:tl(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 tl(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}function nl(){return!Ct(globalThis.navigator)&&/Mac|iPhone|iPad/u.test(globalThis.navigator.userAgent)}var rl=class extends wt{#e=!0;#t;#n=new Map;constructor(e){super(),this.#t=e}cancel(e){try{return this.#n.get(v(e))?.abort(),Promise.resolve(Ic(void 0))}catch(e){return Promise.resolve(Lc(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=h(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(We(t,n.signal)),r=ae(e);return Ic(r===void 0?{status:`handled`}:{status:`handled`,result:r})}finally{this.#n.delete(t.requestId)}}catch(e){if(e instanceof Qr)try{let t={code:e.code,message:e.message,details:e.details};return Ic({status:`failed`,error:lt(t)})}catch(e){return Lc(e)}return Lc(e)}}[Symbol.dispose](){this.dispose()}};function il(e){let t=[];for(let n of e.values()){let{definition:e,handler:r}=n;if(n.commandId===void 0)continue;let i=e.availability?.status!==`unavailable`;for(let n of e.projections?.bindings?.values??[])n.trim().includes(` `)||n.startsWith(`<`)||t.push({key:n,run:()=>{i&&Promise.resolve().then(()=>r({origin:`keyboard`,signal:new AbortController().signal})).catch(e=>{console.warn(`App key command failed`,e)})}})}return t}function al(e,t,n,r){let i=new Map,a=!1,o=()=>{r?.update(a?[]:il(i))},s=e=>{try{n()}catch(t){console.warn(`App command failure callback failed`,t,e)}},c=e=>{try{Rc(e(),Fe).catch(e=>{s(e)})}catch(e){console.warn(`App command RPC supervision failed`,e),s(e)}};return{commands:sl(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 ol(e,t,n,r){let i=t.id;if(e.size>=128||e.has(i))throw r.dispose(),new K(`Command registration is unavailable`,{code:`INVALID_ARGUMENT`,retryable:!1});let a={commandId:void 0,definition:t,handler:n,target:r};e.set(i,a);let o=!1;return{commit(e){o||(a.commandId=e)},release(){o||(o=!0,e.get(i)===a&&e.delete(i),r.dispose())},target:r}}function sl(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=ve(s),u=new rl(c),d=ol(n,l,c,u);try{let t=await cl(e,l,d.target);i()&&await ll(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 cl(e,t,n){return Rc(e.registerCommand(t,n),Se)}async function ll(e,t,n){throw n.dispose(),await Rc(e.unregisterCommand(t),Fe),new K(`The command controller is disposed`,{code:`DISCONNECTED`,retryable:!0})}var ul=He(e=>e instanceof Rt),dl=class extends wt{#e=!1;#t;constructor(e){super(),this.#t=e}disconnect(e){try{if(this.#e)throw Sl();let t=e===void 0?void 0:dt(e);return setTimeout(()=>this.#t.disconnect?.(t??El()),0),Promise.resolve(Ic(void 0))}catch(e){return Promise.resolve(Lc(e))}}async requestClose(){try{if(this.#e)throw Sl();return Ic(await(this.#t.beforeClose?.()??!0))}catch(e){return Lc(e)}}async requestBack(){try{if(this.#e)throw Sl();return Ic(await(this.#t.back?.()??!1))}catch(e){return Lc(e)}}async activateNavigation(e){try{if(this.#e)throw Sl();let t=pe(e);return fe(this.#t.navigation,t)?Ic(await(this.#t.activate?.(t)??!1)):Ic(!1)}catch(e){return Lc(e)}}async activateStatus(e){try{if(this.#e)throw Sl();let t=T(e);return n(this.#t.statusItems,t)?Ic(await(this.#t.statusAction?.(t)??!1)):Ic(!1)}catch(e){return Lc(e)}}[Symbol.dispose](){this.#e=!0}async updateContext(e){return this.#e?Lc(Sl()):this.#n(e,`context`,a,e=>{this.#t.context.update(e)})}reconfigure(e){let t=[];try{if(this.#e)throw Sl();let n=le(e);if(n.context.version<=this.#t.versions.context)return Promise.resolve(Ic(void 0));for(let e of n.capabilities)t.push({...e,handle:qe(ul)(e.handle).dup()});if(!this.#t.capabilities)throw Sl();return this.#t.capabilities.replace(t),t=[],this.#t.versions.context=n.context.version,this.#t.context.update(n.context.value),Promise.resolve(Ic(void 0))}catch(e){for(let e of t)Vt(e.handle);return Promise.resolve(Lc(e))}}updateLifecycle(e){try{if(this.#e)throw Sl();let t=te(M)(e);if(t.version<=this.#t.versions.lifecycle)return Promise.resolve(Ic(void 0));if(!Dl(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(Ic(void 0))}catch(e){return Promise.resolve(Lc(e))}}async updateReservedChords(e){return this.#e?Lc(Sl()):this.#n(e,`chords`,Ae,e=>{this.#t.chords.update(e)})}async updateTheme(e){return this.#e?Lc(Sl()):this.#n(e,`theme`,At,e=>{this.#t.theme.update(e)})}#n(e,t,n,r){try{let i=te(n)(e);return i.version>this.#t.versions[t]&&(this.#t.versions[t]=i.version,r(i.value)),Promise.resolve(Ic(void 0))}catch(e){return Promise.resolve(Lc(e))}}};async function fl(e){let t=gl(),n=new dl(t),r=Ft(e.port,n),i,a=hl(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=zc(he(o));if(!e.isActive())throw ml();let c=_l({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 kl(t,e,n,r,i)}}function pl(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 ml(){return new K(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function hl(e){let t,n=new Promise((e,n)=>{t=n});return n.catch(e=>{dn(`app-session.rpc-disconnect`,e)}),e.onRpcBroken(()=>t?.(new K(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0}))),n}function gl(){return{statusItems:[],navigation:{canGoBack:!1},bindings:Hc(),chords:Uc([]),context:Yt({computerId:null,focus:{editing:!1,surface:null},openRequest:null,visibility:`hidden`}),lifecycle:Yt(`connecting`),theme:Yt(`default`),canGoBack:!1,versions:{chords:-1,context:-1,lifecycle:-1,theme:-1}}}function _l(e){let t=x(e.bootstrap.identity),n=Ol(e.bootstrap);pl(e.state,n);let r=ze(e.bootstrap.capabilities);return e.state.capabilities=r,yl(e,t,r)}function vl(e,t,n){return Wc({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 yl(e,t,n){let r=!1,i=t=>{r||(r=!0,wl([()=>{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]()},()=>{Vt(e.bootstrapOwner)},()=>{Vt(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=al(e.remote,a,()=>{i({code:`DISCONNECTED`,message:`The app host rejected a terminal command operation`,retryable:!0})},e.state.bindings),s=xl(e.remote,a,e.state),c=bl(e.state,e.remote,a),l=vl(e,t,i),u=Zc({window:e.options.window,mac:nl(),canGoBack:()=>e.state.canGoBack&&e.state.back!==void 0,back:()=>{let t=e.state.back;t&&Promise.resolve().then(t).catch(e=>{dn(`app-window.back-input`,e)})}});return e.state.disconnect=i,e.remote.onRpcBroken(()=>{Cl(i)}),Tl({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 bl(e,t,n){let r=Object.freeze({async publish(r){n();let i=c(r);e.canGoBack=i.canGoBack,e.navigation=Qt(i),await Rc(t.reportNavigation(i),Fe)},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 xl(e,t,n){return Object.freeze({async requestComputerChoice(){t(),await Rc(e.requestComputerChoice(),Fe)},async requestBrowserAction(n){t();let r=f(n);return r.kind===`refused`?r:await Rc(e.requestBrowserAction(r),Ut)},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 Rc(e.requestAppPermissions(O(n)),Ee)},async openDesktopSettings(){t(),await Rc(e.openDesktopSettings(),Fe)},async openTeamBilling(){t(),await Rc(e.openTeamBilling(),Fe)},async openNavigation(n){t(),await Rc(e.openNavigation(V(n)),Fe)},async reportStatus(r){t();let i=R(r);n.statusItems=i,await Rc(e.reportStatus(i),Fe)},async reportAgentSessionSelection(n){t(),await Rc(e.reportAgentSessionSelection(Kt(n)),Fe)},async showToast(n){t(),await Rc(e.showToast(I(n)),Fe)}})}function Sl(){return new K(`The app connection is disposed`,{code:`DISCONNECTED`,retryable:!0})}function Cl(e){e({code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!0})}function wl(e,t){for(let n of e)try{n()}catch(e){console.warn(`${t} cleanup failed`,e)}}function Tl(e){return Object.freeze(e)}function El(){return{code:`DISCONNECTED`,message:`The app host disconnected`,retryable:!1}}function Dl(e,t){return e===t||e===`connected`&&t===`suspended`||e===`suspended`&&t===`connected`}function Ol(e){let t=te(a)(e.context),n=te(At)(e.theme),r=te(M)(e.lifecycle),i=te(Ae)(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 kl(e,t,n,r,i){throw wl([()=>{n[Symbol.dispose]()},()=>{i&&Vt(i)},()=>{Vt(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 Al=!1,jl=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):(Al=!0,this.#a())}#a(){return new Promise((e,t)=>{let n=(n,a)=>{this.#o(n,a,i,r,e,t)},r=()=>{n(Nl())},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:Le},`*`)}catch(e){dn(`connect.notify-host`,e),n(zl(e))}};this.#r=setInterval(a,200),this.#i=setTimeout(()=>{n(Fl())},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(),Al=!1,a(e??Fl());return}i(t)}}#s(e,t,n){if(!Rl(e.data))return;if(performance.mark(`fungi.app-open.agar-connect-received`),e.source!==this.#e.parent||Il(e.origin)===void 0){t(Ll());return}let r=Bl(e,t);if(!r)return;let i=e.ports.length===1?e.ports[0]:void 0;if(!i){t(Vl(`The app host did not transfer exactly one port`));return}this.#t=i,this.#c(),this.#e.removeEventListener(`message`,n),fl({epoch:r.epoch,isActive:()=>!this.#n,onDisposed:()=>{Al=!1},port:i,window:this.#e}).then(e=>{performance.mark(`fungi.app-open.agar-root-ready`),t(void 0,e)},e=>{t(Pl(e))})}#c(){clearInterval(this.#r),clearTimeout(this.#i),this.#r=void 0,this.#i=void 0}#l(){if(this.options.signal?.aborted)return Nl();if(Al)return new K(`An app connection is already live`,{code:`IDENTITY`,retryable:!1});if(Ct(globalThis.window)||this.#e.parent===this.#e)return new K(`The app host is unavailable`,{code:`DISCONNECTED`,retryable:!0})}};function Ml(e){return new jl(e).start()}function Nl(){return new K(`App connection was cancelled`,{code:`CANCELLED`,retryable:!1})}function Pl(e){return e instanceof K?e:new K(`Unable to connect to the app host`,{cause:e,code:`PROTOCOL`,retryable:!1})}function Fl(){return new K(`The app host disconnected`,{code:`DISCONNECTED`,retryable:!0})}function Il(e){if(!URL.canParse(e))return;let t=new URL(e).origin;return t===e?t:void 0}function Ll(){return new K(`The app connection identity is invalid`,{code:`IDENTITY`,retryable:!1})}var Rl=Xe(G({type:Me(Ne)}));function zl(e){return new K(`Unable to notify the app host`,{cause:e,code:`DISCONNECTED`,retryable:!0})}function Bl(e,t){try{return mt(e.data)}catch(e){dn(`connect.decode-message`,e),t(e instanceof K?e:new K(`Malformed app connection`,{cause:e,code:`PROTOCOL`,retryable:!1}));return}}function Vl(e){return new K(e,{code:`PROTOCOL`,retryable:!1})}function Hl(e,t,n){e.style.isolation=`isolate`;let r=(0,pa.createRoot)(e),i=new AbortController,a=e.ownerDocument.documentElement,o=ea(a),s,c,l,u=!1,d=e=>{let i=(0,J.createElement)(Ul,{state:e,render:n});r.render(t.queryClient?(0,J.createElement)(w,{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`):$i(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`}),Ml({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,$i(e.theme.get(),a),c=e.theme.subscribe(e=>{$i(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 Ul({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 Wl(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 Gl(e){return Wl(e?.context)??null}function Kl(e){return Gl(e)?.computerId??null}function ql(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 Jl(e,{sourceId:t,namespace:n},r){let i=(0,J.useMemo)(()=>ei(),[]),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?Yi(e.commands,a):void 0,[e,a]),i}var Yl=e=>crypto.getRandomValues(new Uint8Array(e)),Xl=(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}}},Zl=(e,t=21)=>Xl(e,t|0,Yl),Ql=`abcdefghijklmnopqrstuvwxyz0123456789`;function $l(e=21){if(e===1/0||e===-1/0)throw RangeError(`nanoid length must be finite`);return Zl(Ql,e)()}var eu=A(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);de.init(e,t),e.def=t,e.type=t.type,e.parse=(t,n)=>C(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>H(e,t,n),e.parseAsync=async(t,n)=>P(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>me(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)=>$t(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.apply=t=>t(e)}),tu=A(`ZodMiniObject`,(e,t)=>{ie.init(e,t),eu.init(e,t),u(e,`shape`,()=>t.shape)});function nu(e,t){return new tu({type:`object`,shape:e??{},...Oe(t)})}var ru=A(`ZodMiniLiteral`,(e,t)=>{W.init(e,t),eu.init(e,t)});function iu(e,t){return new ru({type:`literal`,values:Array.isArray(e)?e:[e],...Oe(t)})}var au=Zt({png:`png`,jpeg:`jpeg`,webp:`webp`}),ou=Zt({draft:`draft`,balanced:`balanced`,premium:`premium`,max:`max`}),su=Gt(()=>se({transport:Zt({json:`json`,multipart:`multipart`}),dimensions:Zt({none:`none`,own:`own`}),maxDimension:be().int().positive().nullable(),maxDimensionDocumented:_e(),defaultWidth:be().int().positive(),defaultHeight:be().int().positive(),steps:Zt({steps:`steps`,num_steps:`num_steps`,fixed:`fixed`}),maxSteps:be().int().positive().nullable(),defaultSteps:be().int().nonnegative().nullable(),referenceField:gt().min(1).max(256).nullable(),maxReferences:be().int().nonnegative()}).readonly()),cu=Zt({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`}),lu=Zt({p480:`480p`,p720:`720p`,p768:`768p`,p1080:`1080p`,p4k:`4k`}),uu=Zt({wide:`16:9`,landscape:`4:3`,square:`1:1`,portrait:`3:4`,tall:`9:16`,ultrawide:`21:9`,ultratall:`9:21`}),du=Zt({first:`first-frame`,last:`last-frame`,reference:`reference`}),fu=Gt(()=>se({resolution:lu,aspectRatio:uu,width:be().int().positive(),height:be().int().positive()}).readonly()),pu=Gt(()=>se({minSeconds:be().int().positive(),maxSeconds:be().int().positive(),defaultSeconds:be().int().positive(),durations:Jt(be().int().positive()).readonly(),provider:Zt({seedance:`seedance`,veo:`veo`,minimax:`minimax`}),formats:Jt(fu).readonly(),defaultResolution:lu,defaultAspectRatio:uu,supportsAudio:_e(),defaultGenerateAudio:_e().nullable(),referenceRoles:Jt(du).readonly(),maxReferenceImages:be().int().nonnegative(),referenceResolutions:Jt(lu).readonly(),prices:Jt(se({resolution:lu,silentMilliunitsPerSecond:be().int().positive(),audioMilliunitsPerSecond:be().int().positive()}).readonly()).readonly()}).readonly()),mu=32e3,hu=2048;se({id:gt().min(1).max(256),label:gt().min(1).max(512),kind:Zt({image:`image`,video:`video`}),tier:ou,outputFormats:Jt(au).max(3).readonly(),maxPromptLength:be().int().positive().max(mu),input:su,sizes:Jt(gt().regex(/^\d+x\d+$/u)).readonly().nullable(),video:pu.nullable()}).readonly();var gu=e=>Object.freeze({kind:`image`,sizes:null,video:null,outputFormats:Object.freeze([]),...e,input:Object.freeze(e.input)}),_u={"480p":480,"720p":720,"768p":768,"1080p":1080,"4k":2160},vu={"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 yu(e,t,n,r,i){let a=r===`seedance`,o=a?uu.options:[uu.enum.wide,uu.enum.tall,uu.enum.square],s=Object.freeze(i.flatMap(([e])=>o.map(t=>{let[n,r]=vu[t],i=_u[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?du.options:[du.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 gu({id:e,label:t,tier:n,maxPromptLength:a?2e3:hu,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 bu(){let e=[`480p`,`768p`],t=[uu.enum.wide,uu.enum.landscape,uu.enum.square,uu.enum.portrait,uu.enum.tall,uu.enum.ultrawide],n=Object.freeze(e.flatMap(e=>t.map(t=>{let[n,r]=vu[t],i=_u[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=lu.enum.p768,i=uu.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([du.enum.first,du.enum.reference]),maxReferenceImages:4,referenceResolutions:Object.freeze(e),prices:Object.freeze([{resolution:lu.enum.p480,silentMilliunitsPerSecond:5e3,audioMilliunitsPerSecond:5e3},{resolution:lu.enum.p768,silentMilliunitsPerSecond:8e3,audioMilliunitsPerSecond:8e3}])});return gu({id:cu.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([gu({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}}),gu({id:`@cf/black-forest-labs/flux-2-klein-4b`,maxPromptLength:hu,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}}),gu({id:`@cf/black-forest-labs/flux-2-klein-9b`,maxPromptLength:hu,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}}),gu({id:`@cf/black-forest-labs/flux-2-dev`,maxPromptLength:hu,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}}),gu({id:`@cf/leonardo/lucid-origin`,maxPromptLength:hu,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}}),gu({id:`@cf/leonardo/phoenix-1.0`,maxPromptLength:hu,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}}),gu({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}}),yu(cu.enum.seedance,`Seedance 2.0`,`balanced`,`seedance`,[[`480p`,7e3,7e3],[`720p`,15e3,15e3],[`1080p`,37e3,37e3],[`4k`,78e3,78e3]]),yu(cu.enum.seedanceFast,`Seedance 2.0 Fast`,`draft`,`seedance`,[[`480p`,6e3,6e3],[`720p`,12e3,12e3]]),yu(cu.enum.seedanceMini,`Seedance 2.0 Mini`,`draft`,`seedance`,[[`480p`,4e3,4e3],[`720p`,9e3,9e3]]),yu(cu.enum.veo,`Veo 3.1`,`premium`,`veo`,[[`720p`,2e4,4e4],[`1080p`,2e4,4e4]]),yu(cu.enum.veoFast,`Veo 3.1 Fast`,`balanced`,`veo`,[[`720p`,8e3,1e4],[`1080p`,1e4,12e3]]),bu()]);var xu=e=>gt().min(1).max(e),Su=be().int().min(-(2**53-1)).max(2**53-1),Cu=Su.positive(),wu=Su.nonnegative(),Tu=se({printId:xu(256),computerId:xu(256),kind:Zt([`image`,`video`]),prompt:xu(mu),model:xu(256),width:Cu.nullable(),height:Cu.nullable(),steps:wu.nullable(),durationSeconds:wu.nullable(),format:xu(32),bytes:Cu,costMilliunits:wu,actorKind:Zt([`member`,`agent`]),actorId:xu(256),derivedFrom:xu(256).nullable(),createdAt:wu,source:Zt([`recorded`,`file`]),schemaVersion:Cu}),Eu=b({printId:Tu.shape.printId,path:gt().startsWith(`/`).min(2).max(4096)});function Du(e,t){let n=e?.app??null,r=Gl(n),i=r?.openRequest,a=r?.computerId,o=i?.kind===`navigate`?i.params.find(e=>e.key===`print`):void 0,s=Tu.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=Fn({...Rn(n,bn,Sr.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=Eu.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(bn)),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 Ou(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 ku=Ou(`https://base-ui.com/production-error`,`Base UI`),Au=J.createContext(void 0);function ju(e){let t=J.useContext(Au);if(!e&&t===void 0)throw Error(ku(27));return t}var Mu={};function Nu(e,t){let n=J.useRef(Mu);return n.current===Mu&&(n.current=e(t)),n}function Pu(e,t,n,r){let i=Nu(Iu).current;return Lu(i,e,t,n,r)&&zu(i,[e,t,n,r]),i.callback}function Fu(e){let t=Nu(Iu).current;return Ru(t,e)&&zu(t,e),t.callback}function Iu(){return{callback:null,cleanup:null,refs:[]}}function Lu(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function Ru(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function zu(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 Bu=18;function Vu(e){return Bu>=e}function Hu(e){if(!J.isValidElement(e))return null;let t=e,n=t.props;return(Vu(19)?n?.ref:t.ref)??null}function Uu(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Wu(){}var Gu=Object.freeze([]),Ku=Object.freeze({});function qu(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 Ju(e,t){return typeof e==`function`?e(t):e}function Yu(e,t){return typeof e==`function`?e(t):e}var Xu={};function Zu(e,t,n,r,i){if(!n&&!r&&!i&&!e)return $u(t);let a=$u(e);return t&&(a=ed(a,t)),n&&(a=ed(a,n)),r&&(a=ed(a,r)),i&&(a=ed(a,i)),a}function Qu(e){if(e.length===0)return Xu;if(e.length===1)return $u(e[0]);let t=$u(e[0]);for(let n=1;n<e.length;n+=1)t=ed(t,e[n]);return t}function $u(e){return id(e)?{...e(Xu)}:td(e)}function ed(e,t){return id(t)?t(e):nd(e,t)}function td(e){let t={...e};for(let e in t){let n=t[e];rd(e,n)&&(t[e]=od(n))}return t}function nd(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Uu(e.style,r);break;case`className`:e[n]=cd(e.className,r);break;default:e[n]=rd(n,r)?ad(e[n],r):r}}return e}function rd(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 id(e){return typeof e==`function`}function ad(e,t){return t?e?(...n)=>{let r=n[0];if(ld(r)){let i=r;sd(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:od(t):e}function od(e){return e&&((...t)=>{let n=t[0];return ld(n)&&sd(n),e(...t)})}function sd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function cd(e,t){return t?e?t+` `+e:t:e}function ld(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function ud(e,t,n={}){let r=t.render;n.enabled!==!1&&(r=md(r));let i=dd(t,n,r);if(n.enabled===!1)return null;let a=n.state??Ku;return hd(e,r,i,a)}function dd(e,t,n){let{className:r,style:i}=e,{state:a=Ku,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Ju(r,a):void 0,d=l?Yu(i,a):void 0,f=l?qu(a,c):Ku,p=l&&s?fd(s):void 0,m=l?Uu(f,p)??{}:Ku;return typeof document<`u`&&(l?m.ref=Array.isArray(o)?Fu([m.ref,Hu(n),...o]):Pu(m.ref,Hu(n),o):Pu(null,null)),l?(u!==void 0&&(m.className=cd(m.className,u)),d!==void 0&&(m.style=Uu(m.style,d)),m):Ku}function fd(e){return Array.isArray(e)?Qu(e):Zu(void 0,e)}var pd=Symbol.for(`react.lazy`);function md(e){if(e?.$$typeof!==pd)return e;let t=J.Children.toArray(e)[0];return J.isValidElement(t)?t:e}function hd(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Zu(n,t.props);return e.ref=n.ref,J.cloneElement(t,e)}return gd(e,n)}function gd(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 _d=`data-starting-style`,vd=`data-ending-style`,yd={[_d]:``},bd={[vd]:``},xd={transitionStatus(e){return e===`starting`?yd:e===`ending`?bd:null}},Sd=`data-open`,Cd=`data-closed`,wd=`data-anchor-hidden`,Td=`data-popup-open`,Ed=`data-pressed`,Dd={[Td]:``},Od={[Td]:``,[Ed]:``},kd={[Sd]:``},Ad={[Cd]:``},jd={[wd]:``},Md={open(e){return e?Dd:null}},Nd={open(e){return e?Od:null}},Pd={open(e){return e?kd:Ad},anchorHidden(e){return e?jd:null}},Fd={...Pd,...xd},Id=J.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=ju(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return ud(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Fd,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})});function Ld(){return typeof window<`u`}function Rd(e){return Vd(e)?(e.nodeName||``).toLowerCase():`#document`}function zd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bd(e){return((Vd(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Vd(e){return Ld()?e instanceof Node||e instanceof zd(e).Node:!1}function Hd(e){return Ld()?e instanceof Element||e instanceof zd(e).Element:!1}function Ud(e){return Ld()?e instanceof HTMLElement||e instanceof zd(e).HTMLElement:!1}function Wd(e){return!Ld()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof zd(e).ShadowRoot}function Gd(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=nf(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Kd(e){return/^(table|td|th)$/.test(Rd(e))}function qd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Jd=/transform|translate|scale|rotate|perspective|filter/,Yd=/paint|layout|strict|content/,Xd=e=>!!e&&e!==`none`,Zd;function Qd(e){let t=Hd(e)?nf(e):e;return Xd(t.transform)||Xd(t.translate)||Xd(t.scale)||Xd(t.rotate)||Xd(t.perspective)||!ef()&&(Xd(t.backdropFilter)||Xd(t.filter))||Jd.test(t.willChange||``)||Yd.test(t.contain||``)}function $d(e){let t=af(e);for(;Ud(t)&&!tf(t);){if(Qd(t))return t;if(qd(t))return null;t=af(t)}return null}function ef(){return Zd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Zd}function tf(e){return/^(html|body|#document)$/.test(Rd(e))}function nf(e){return zd(e).getComputedStyle(e)}function rf(e){return Hd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function af(e){if(Rd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Wd(e)&&e.host||Bd(e);return Wd(t)?t.host:t}function of(e){let t=af(e);return tf(t)?(e.ownerDocument||e).body:Ud(t)&&Gd(t)?t:of(t)}function sf(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=of(e),i=r===e.ownerDocument?.body,a=zd(r);if(i){let e=cf(a);return t.concat(a,a.visualViewport||[],Gd(r)?r:[],e&&n?sf(e):[])}return t.concat(r,sf(r,[],n))}function cf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var lf={...J},uf=lf.useInsertionEffect,df=uf&&uf!==lf.useLayoutEffect?uf:e=>e();function X(e){let t=Nu(ff).current;return t.next=e,df(t.effect),t.trampoline}function ff(){let e={next:void 0,callback:pf,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function pf(){}var Z=typeof document<`u`?J.useLayoutEffect:()=>{},mf=J.createContext(void 0);function hf(e=!1){let t=J.useContext(mf);if(t===void 0&&!e)throw Error(ku(16));return t}function gf(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 _f(e){return e?.ownerDocument||document}function vf(e,t,{detail:n=0,pointerType:r=``}={}){e.dispatchEvent(new(zd(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 yf(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=J.useRef(null),s=hf(!0),c=a??s!==void 0,{props:l}=gf({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=J.useCallback(()=>{let e=o.current;bf(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 Zu({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(sd(e),o?.(e),e.baseUIHandlerPrevented))return;let n=e.target===e.currentTarget,r=e.currentTarget,a=bf(r),s=!i&&xf(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(),vf(r,e));return}if(!l||i||!d&&!u){n&&s&&d&&e.preventDefault();return}e.defaultPrevented||(e.preventDefault(),u&&(e.preventBaseUIHandler(),vf(r,e)))},onKeyUp(e){if(!t){if(sd(e),a?.(e),e.target===e.currentTarget&&i&&c&&bf(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&!e.defaultPrevented&&e.key===` `&&(e.preventBaseUIHandler(),vf(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 bf(e){return Ud(e)&&e.tagName===`BUTTON`}function xf(e){return Ud(e)&&e.tagName===`A`&&!!e.href}function Sf(e,t,n,r){let i=!1,a=!1,o=r??Ku;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 Cf(e,t,n){let r=n??Ku;return{reason:e,event:t??new Event(`base-ui`),...r}}var wf=`none`,Tf=`trigger-press`,Ef=`trigger-hover`,Df=`trigger-focus`,Of=`outside-press`,kf=`item-press`,Af=`close-press`,jf=`focus-out`,Mf=`escape-key`,Nf=`list-navigation`,Pf=`keyboard`,Ff=`pointer`,If=`cancel-open`,Lf=`sibling-open`,Rf=`imperative-action`,zf=J.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=ju(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=yf({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,Sf(Af,e.nativeEvent))}return ud(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})});function Bf(){let[,e]=J.useState({});return J.useCallback(()=>{e({})},[])}var Vf=0;function Hf(e,t=`mui`){let n=J.useRef(void 0),r=Bf(),i=e??n.current;return J.useEffect(()=>{n.current??(Vf+=1,n.current=`${t}-${Vf}`,e??r())},[e,t,r]),i}var Uf=lf.useId;function Wf(e,t){if(Uf!==void 0){let n=Uf();return e??(t?`${t}-${n}`:n)}return Hf(e,t)}function Gf(e){return Wf(e,`base-ui`)}var Kf=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=ju(),c=Gf(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),ud(`p`,e,{ref:t,props:[{id:c},o]})});function qf(e){J.useEffect(e,Gu)}var Jf=0,Yf=class e{static create(){return new e}currentId=Jf;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Jf,t()},e)}isStarted(){return this.currentId!==Jf}clear=()=>{this.currentId!==Jf&&(clearTimeout(this.currentId),this.currentId=Jf)};disposeEffect=()=>this.clear};function Xf(){let e=Nu(Yf.create).current;return qf(e.disposeEffect),e}function Zf(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:Qf,platform:$f,maxTouchPoints:ep}=Zf(),tp=Qf.toLowerCase(),np=$f.toLowerCase(),rp=/^i(os$|p)/.test(np)||np===`macintel`&&ep>1,ip=`android`,ap=np===ip||tp.includes(ip),op=!rp&&np.startsWith(`mac`);np.startsWith(`win`),!ap&&/^(linux|chrome os)/.test(np);var sp=op||rp,cp=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`);!cp&&tp.includes(`firefox`),!cp&&tp.includes(`chrom`);var lp=sp,up=/jsdom|happydom/.test(tp);function dp(e){e.preventDefault(),e.stopPropagation()}function fp(e){return`nativeEvent`in e}function pp(e){return e.pointerType===``&&e.isTrusted?!0:ap&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function mp(e){return up?!1:!ap&&e.width===0&&e.height===0||e.type===`pointerdown`&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`&&(ap||e.buttons===0)||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function hp(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function gp(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}function _p(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&&Wd(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function vp(e,t){let n=e;for(;n;){if(Hd(n)&&n.matches(t))return n;n=n.assignedSlot??n.parentNode??(Wd(n)?n.host:null)}return null}function yp(e){return`composedPath`in e?e.composedPath()[0]??e.target:e.target}var bp=`data-base-ui-focusable`,xp=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,Sp=`ArrowLeft`,Cp=`ArrowRight`,wp=`ArrowUp`,Tp=`ArrowDown`,Ep=`data-trigger-disabled`;function Dp(e,t){if(!Hd(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(Ep);for(let[,e]of t.entries())if(Q(e,n))return!e.hasAttribute(Ep);return!1}function Op(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 kp(e){return e.matches(`html,body`)}function Ap(e){return Ud(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function jp(e){return vp(e,`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${xp}`)!=null}function Mp(e){return e?e.getAttribute(`role`)===`combobox`&&Ap(e):!1}function Np(e){if(!e||up)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function Pp(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function Fp(e,t){return t!=null&&!hp(t)?0:typeof e==`function`?e():e}function Ip(e,t,n){let r=Fp(e,n);return typeof r==`number`?r:r?.[t]}function Lp(e){return typeof e==`function`?e():e}function Rp(e,t){return t||e===`click`||e===`mousedown`}function zp(e){return e?.includes(`mouse`)&&e!==`mousedown`}function Bp(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function Vp(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Hp(e){let t=Nu(Up,e).current;return t.next=e,Z(t.effect),t}function Up(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Wp=null;globalThis.requestAnimationFrame;var Gp=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)}},Kp=class e{static create(){return new e}static request(e){return Gp.request(e)}static cancel(e){return Gp.cancel(e)}currentId=Wp;request(e){this.cancel(),this.currentId=Gp.request(()=>{this.currentId=Wp,e()})}cancel=()=>{this.currentId!==Wp&&(Gp.cancel(this.currentId),this.currentId=Wp)};disposeEffect=()=>this.cancel};function qp(){let e=Nu(Kp.create).current;return qf(e.disposeEffect),e}var Jp={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Yp={...Jp,position:`fixed`,margin:0,top:0,left:0};({...Jp});var $=ee(),Xp=J.forwardRef(function(e,t){let[n,r]=J.useState();Z(()=>{lp&&cp&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,$.jsx)(`span`,{...e,ref:t,style:Yp,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),Zp=Math.min,Qp=Math.max,$p=Math.round,em=Math.floor,tm=e=>({x:e,y:e}),nm={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function rm(e,t,n){return Qp(e,Zp(t,n))}function im(e,t){return typeof e==`function`?e(t):e}function am(e){return e.split(`-`)[0]}function om(e){return e.split(`-`)[1]}function sm(e){return e===`x`?`y`:`x`}function cm(e){return e===`y`?`height`:`width`}function lm(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function um(e){return sm(lm(e))}function dm(e,t,n){n===void 0&&(n=!1);let r=om(e),i=um(e),a=cm(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=bm(o)),[o,bm(o)]}function fm(e){let t=bm(e);return[pm(e),t,pm(t)]}function pm(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var mm=[`left`,`right`],hm=[`right`,`left`],gm=[`top`,`bottom`],_m=[`bottom`,`top`];function vm(e,t,n){switch(e){case`top`:case`bottom`:return n?t?hm:mm:t?mm:hm;case`left`:case`right`:return t?gm:_m;default:return[]}}function ym(e,t,n,r){let i=om(e),a=vm(am(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(pm)))),a}function bm(e){let t=am(e);return nm[t]+e.slice(t.length)}function xm(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Sm(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:xm(e)}function Cm(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 wm(e,t){return t<0||t>=e.length}function Tm(e,t){return Om(e.current,{disabledIndices:t})}function Em(e,t){return Om(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Dm(e,t,n){let{decrement:r,loopFocus:i,allowEscape:a,disabledIndices:o,minIndex:s,maxIndex:c}=n,l=()=>Om(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:wm(e,u)?-1:u,wrapped:d}}function Om(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&&km(e,a,r));return a}function km(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!jm(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function Am(e){return e.visibility===`hidden`||e.visibility===`collapse`}function jm(e,t=e?nf(e):null){return!e||!e.isConnected||!t||Am(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Mm=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Nm(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return Wd(n)?n.host:null}function Pm(e){for(let t of Array.from(e.children))if(Rd(t)===`summary`)return t;return null}function Fm(e,t){let n=Pm(t);return!!n&&(e===n||Q(n,e))}function Im(e){let t=e?Rd(e):``;return e!=null&&e.matches(Mm)&&(t!==`summary`||e.parentElement!=null&&Rd(e.parentElement)===`details`&&Pm(e.parentElement)===e)&&(t!==`details`||Pm(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Lm(e){if(!Im(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Nm(t)){let n=t!==e,r=Rd(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Rd(t)===`details`&&!t.open&&!Fm(e,t)||t.hasAttribute(`hidden`)||!r&&!Rm(t,n))return!1}return!0}function Rm(e,t){let n=nf(e);return t?n.display!==`none`:jm(e,n)}function zm(e){let t=e.tabIndex;if(t<0){let t=Rd(e);if(t===`details`||t===`audio`||t===`video`||Ud(e)&&e.isContentEditable)return 0}return t}function Bm(e){if(Rd(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Vm(e,t){let n=Bm(e);if(!n)return!0;let r=t.find(e=>{let t=Bm(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Bm(e);return t?.name===n.name&&t.form===n.form})===n}function Hm(e){if(Ud(e)&&Rd(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ud(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Um(e,t){Hm(e).forEach(e=>{Im(e)&&t.push(e),Um(e,t)})}function Wm(e,t,n){Hm(e).forEach(e=>{Ud(e)&&e.matches(t)&&n.push(e),Wm(e,t,n)})}function Gm(e){return Lm(e)&&zm(e)>=0}function Km(e){let t=[];return Um(e,t),t.filter(Lm)}function qm(e){let t=Km(e);return t.filter(e=>zm(e)>=0&&Vm(e,t))}function Jm(e,t){let n=qm(e),r=n.length;if(r===0)return;let i=_p(_f(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Ym(e){return Jm(_f(e).body,1)||e}function Xm(e){return Jm(_f(e).body,-1)||e}function Zm(e,t,n){if(!e)return null;let r=[];Um(_f(e).body,r);let i=r.indexOf(e);if(i===-1)return null;let a=r.filter(Lm);for(let e=1;e<r.length;e+=1){let o=r[(i+t*e+r.length)%r.length];if(!Q(n,o)&&Gm(o)&&Vm(o,a))return o}return r[i]}function Qm(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!Q(n,r)}function $m(e){qm(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function eh(e){let t=[];Wm(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 th(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...th(e,t.id,n)])}function nh(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 rh(e){return`data-base-ui-${e}`}var ih=0;function ah(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(ih);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),Wu;let o=requestAnimationFrame(a);return ih=o,()=>{ih===o&&(cancelAnimationFrame(o),ih=0)}}var oh=`data-base-ui-inert`,sh=new WeakMap,ch=new WeakSet,lh=new WeakMap,uh=0;function dh(e){return e?Wd(e)?e.host:dh(e.parentNode):null}var fh=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=dh(t);return e.contains(n)?n:null}).filter(e=>e!=null),ph=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},mh=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{Rd(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function hh(e,t,n,{mark:r=!0}){let i=fh(t,e),a=r?mh(t,ph(i),new Set(i)):[],o=[],s=[];if(n){let e=fh(t,Array.from(t.querySelectorAll(`[aria-live]`))),n=i.concat(e);mh(t,ph(n),new Set(n)).forEach(e=>{let t=e.getAttribute(`aria-hidden`),n=t!==null&&t!==`false`,r=(sh.get(e)||0)+1;sh.set(e,r),o.push(e),r===1&&n&&ch.add(e),n||e.setAttribute(`aria-hidden`,`true`)})}return r&&a.forEach(e=>{let t=(lh.get(e)||0)+1;lh.set(e,t),s.push(e),t===1&&e.setAttribute(oh,``)}),uh+=1,()=>{o.forEach(e=>{let t=(sh.get(e)||0)-1;sh.set(e,t),t||(ch.has(e)||e.removeAttribute(`aria-hidden`),ch.delete(e))}),r&&s.forEach(e=>{let t=(lh.get(e)||0)-1;lh.set(e,t),t||e.removeAttribute(oh)}),--uh,uh||(sh=new WeakMap,ch=new WeakSet,lh=new WeakMap)}}function gh(e,t={}){let{ariaHidden:n=!1,mark:r=!0}=t,i=_f(e[0]).body;return hh(e,i,n,{mark:r})}var _h={style:{transition:`none`}},vh=`data-base-ui-click-trigger`,yh={fallbackAxisSide:`none`},bh={fallbackAxisSide:`end`},xh={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Sh=e(fa(),1),Ch=J.createContext(null),wh=()=>J.useContext(Ch),Th=rh(`portal`);function Eh(e={}){let{ref:t,container:n,componentProps:r=Ku,elementProps:i}=e,a=Wf(),o=wh()?.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&&(Vd(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=ud(`div`,r,{ref:[t,d],props:[{id:a,[Th]:``},i]}),m=s&&p?Sh.createPortal(p,s):null;return{node:l,nodeId:J.isValidElement(p)?p.props.id:void 0,subtree:m}}var Dh=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}=Eh({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&&Qm(e)&&(e.type===`focusin`?v.current&&=(eh(l),!1):($m(l),v.current=!0))}return Vp(Bp(l,`focusin`,e,!0),Bp(l,`focusout`,e,!0))},[l,y]),Z(()=>{!l||b!==!0||!v.current||(eh(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)(Ch.Provider,{value:S,children:[x&&l&&(0,$.jsx)(Xp,{"data-type":`outside`,ref:f,onFocus:e=>{Qm(e,l)?m.current?.focus():Xm(g?g.domReference:null)?.focus()}}),x&&l&&(0,$.jsx)(`span`,{role:s,"aria-owns":u,style:xh}),l&&Sh.createPortal(a,l),x&&l&&(0,$.jsx)(Xp,{"data-type":`outside`,ref:p,onFocus:e=>{Qm(e,l)?h.current?.focus():(Ym(g?g.domReference:null)?.focus(),g?.closeOnFocusOut&&g?.onOpenChange(!1,Sf(`focus-out`,e.nativeEvent)))}})]})]})});function Oh(){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 kh=class{nodesRef={current:[]};events=Oh();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)}},Ah=J.createContext(null),jh=J.createContext(null),Mh=()=>J.useContext(Ah)?.id||null,Nh=e=>{let t=J.useContext(jh);return e??t};function Ph(e){let t=Wf(),n=Nh(e),r=Mh();return Z(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function Fh(e){let{children:t,id:n}=e,r=Mh();return(0,$.jsx)(Ah.Provider,{value:J.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Ih(e){let{children:t,externalTree:n}=e,r=Nu(()=>n??new kh).current;return(0,$.jsx)(jh.Provider,{value:r,children:t})}function Lh(e){return e==null?e:`current`in e?e.current:e}function Rh(e,t){let n=zd(yp(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||(pp(e)?`keyboard`:t||`mouse`):`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var zh=20,Bh=[];function Vh(){Bh=Bh.filter(e=>e.deref()?.isConnected)}function Hh(e){Vh(),e&&Rd(e)!==`body`&&(Bh.push(new WeakRef(e)),Bh.length>zh&&(Bh=Bh.slice(-20)))}function Uh(){return Vh(),Bh[Bh.length-1]?.deref()}function Wh(e){return e?Gm(e)?e:qm(e)[0]||e:null}function Gh(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=Km(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Gm(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 Kh(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=Mp(_)&&S,w=Hp(i),T=Hp(a),E=Hp(o),D=Hp(u),O=Hp(g),k=Nh(m),A=wh(),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=Pu(L,p,A?.beforeInsideRef),B=Pu(R,A?.afterInsideRef),V=Xf(),H=Xf(),ee=qp(),te=A!=null,U=Pp(v),W=X((e=U)=>e?qm(e):[]),ne=X(()=>h?.().filter(e=>e!=null)??[]);J.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&Q(U,_p(_f(U)))&&W().length===0&&!C&&dp(e)}return Bp(_f(U),`keydown`,e)},[r,U,c,C,W]),J.useEffect(()=>{if(r||!g)return;let e=_f(U);function t(){N.current=!1}function n(e){let t=yp(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`,vp(t,`[data-base-ui-click-trigger]`)&&(M.current=!0,H.start(0,()=>{M.current=!1}))}function i(){I.current=`keyboard`}return Vp(Bp(e,`pointerdown`,n,!0),Bp(e,`pointerup`,t,!0),Bp(e,`pointercancel`,t,!0),Bp(e,`keydown`,i,!0),t)},[r,v,_,U,g,A,H,ne]),J.useEffect(()=>{if(r||!l)return;let e=_f(U);function n(){M.current=!0,H.start(0,()=>{M.current=!1})}function i(e){let t=yp(e);Gm(t)&&(P.current=t)}function a(n){let r=n.relatedTarget,i=n.currentTarget,a=yp(n);c&&r==null&&a!=null&&Q(v,a)&&Hh(a),queueMicrotask(()=>{let o=x(),l=t.context.triggerElements,u=ne(),p=r?.hasAttribute(rh(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,Lh(f),Lh(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&&(th(k.nodesRef.current,o).find(e=>Q(e.context?.elements.floating,r)||Q(e.context?.elements.domReference,r))||nh(k.nodesRef.current,o).find(e=>[e.context?.elements.floating,Pp(e.context?.elements.floating)].includes(r)||e.context?.elements.domReference===r)));if(i===_&&U&&Gh(U),s&&i!==_&&!jm(a)&&_p(e)===e.body){if(Ud(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;Ud(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!c)&&r&&m&&!M.current&&(C||r!==Uh())&&(j.current=!0,t.setOpen(!1,Sf(jf,n)))})}function o(){N.current||(b.current.insideReactTree=!0,V.start(0,()=>{b.current.insideReactTree=!1}))}let u=Ud(_)?_:null;if(!(!v&&!u))return Vp(u&&Bp(u,`focusout`,a),u&&Bp(u,`pointerdown`,n),v&&Bp(v,`focusin`,i),v&&Bp(v,`focusout`,a),v&&A&&Bp(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(`[${rh(`portal`)}]`)||[]),t=(k?nh(k.nodesRef.current,x()):[]).find(e=>Mp(e.context?.elements.domReference||null))?.context?.elements.domReference,n=gh([v,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...ne(),t,Lh(f),Lh(d),C?_:null].filter(e=>e!=null),{ariaHidden:c||C,mark:!1}),i=gh([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,c,A,C,k,x,d,f,ne]),Z(()=>{if(!g||r||!Ud(U))return;F.current=``,I.current=``;let e=_f(U),t=_p(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():Lh(r),o||=a();let s=Q(U,_p(e)),c=b.current.openEvent,l=c?.type===`mousedown`&&pp(c);ah(o,{sync:l,preventScroll:o===U,shouldFocus(){if(!O.current)return!1;if(s)return!0;let t=_p(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=_f(U),t=_p(e),n=D.current==null;Hh(t);function i(e){if(e.open||(F.current=Rh(e.nativeEvent,I.current)),(e.reason===`focus-out`&&e.triggerElement?.hasAttribute(rh(`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(pp(e.nativeEvent)||mp(e.nativeEvent))j.current=!1;else{let e=!1;_f(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&&Rd(t)!==`body`?t:null,s=n?o||a:a||o;return s||=Uh()||null,typeof i==`boolean`?s:Lh(i)||s||null}return()=>{y.off(`openchange`,i);let t=_p(e),n=ne(),r=Q(v,t)||n.some(e=>e===t||Q(e,t))||k&&th(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=Wh(c),i=E.current??typeof o!=`boolean`;if(!l.cancelled&&o&&!j.current&&Ud(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(!cp||g||!v)return;let e=_p(_f(v));!Ud(e)||!Ap(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 Gh(U),()=>{queueMicrotask(Vh)}},[r,U]);let ie=!r&&(!c||!C)&&(te||c);return(0,$.jsxs)(J.Fragment,{children:[ie&&(0,$.jsx)(Xp,{"data-type":`inside`,ref:z,onFocus:e=>{if(c){let e=W();ah(e[e.length-1])}else A?.portalNode&&(j.current=!1,Qm(e,A.portalNode)?Ym(_)?.focus():Lh(f??A.beforeOutsideRef)?.focus())}}),n,ie&&(0,$.jsx)(Xp,{"data-type":`inside`,ref:B,onFocus:e=>{c?ah(W()[0]):A?.portalNode&&(l&&(j.current=!0),Qm(e,A.portalNode)?Xm(_)?.focus():Lh(d??A.afterOutsideRef)?.focus())}})]})}function qh(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Tf}=t,l=e.context.dataRef,u=J.useRef(void 0),d=qp(),f=Xf(),p=J.useMemo(()=>{function t(t,n,r,i){let a=Sf(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=hp(e.pointerType,!0)&&mp(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(i){let o=u.current,s=i.nativeEvent,c=e.select(`open`);if(i.button!==0||r===`click`||hp(o,!0)&&a)return;let l=n(c,i.currentTarget,e=>e===`click`||e===`mousedown`),f=yp(s),p=Ap(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}hp(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}:Ku,[n,p])}function Jh(){return!1}function Yh(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function Xh(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=Jh,bubbles:s,externalTree:c}=t,l=e.useState(`open`),u=e.useState(`floatingElement`),{dataRef:d,events:f}=e.context,p=Nh(c),m=X(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=X(()=>a),{escapeKey:v,outsidePress:y}=Yh(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=Xf(),O=Xf(),k=Xf(),A=X(()=>{O.clear(),d.current.insideReactTree=!1}),j=X(e=>{let t=d.current.floatingContext?.nodeId;return(p?th(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=X(t=>Op(t,e.select(`floatingElement`))||Op(t,e.select(`domReferenceElement`))),N=X(t=>{o()&&e.setOpen(!1,Sf(Tf,t.nativeEvent))}),P=X(t=>{if(!l||!n||!r||t.key!==`Escape`)return;let i=fp(t)?t.nativeEvent:t;if(w.current||i.isComposing||!v&&j(`__escapeKeyBubbles`))return;let a=Sf(Mf,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=yp(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 Yf,i=_f(u);function a(){k.clear(),w.current=!0}function o(){w.current=!0,k.start(cp?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&&th(p.nodesRef.current,t).some(t=>Op(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=yp(n),i=`[${rh(`inert`)}]`,a=Hd(r)?r.getRootNode():null,o=Array.from((Wd(a)?a:_f(e.select(`floatingElement`))).querySelectorAll(i)),s=e.context.triggerElements;if(r&&(s.hasElement(r)||s.hasMatchingElement(e=>Q(e,r))))return;let c=Hd(r)?r:null;for(;c&&!tf(c);){let e=af(c);if(tf(e)||!Hd(e))break;c=e}if(!(o.length&&Hd(r)&&!kp(r)&&!Q(r,e.select(`floatingElement`))&&o.every(e=>!Q(c,e)))){if(Ud(r)&&!(`touches`in n)){let e=tf(r),t=nf(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&&!pp(n)&&!C.current)return;if(S.current){t.clear(),S.current=!1;return}}typeof h==`function`&&!h(n)||j(`__outsidePressBubbles`)||(e.setOpen(!1,Sf(Of,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=yp(e);if(!n)return;let r=Bp(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=Vp(r&&Vp(Bp(i,`keydown`,P),Bp(i,`compositionstart`,a),Bp(i,`compositionend`,o)),g&&Vp(Bp(i,`click`,z,!0),Bp(i,`pointerdown`,z,!0),Bp(i,`pointerup`,B,!0),Bp(i,`pointercancel`,B,!0),Bp(i,`mousedown`,z,!0),Bp(i,`mouseup`,B,!0),Bp(i,`touchstart`,R,{capture:!0,passive:!0}),Bp(i,`touchmove`,H,{capture:!0,passive:!0}),Bp(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 Zh(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};Hd(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 Qh(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=Kp.request(()=>{a(`ending`)});return()=>{Kp.cancel(e)}}},[e,o,i,n]),Z(()=>{if(!e||t||i===void 0)return;let n=Kp.request(()=>{a(void 0)});return()=>{Kp.cancel(n)}},[t,e,i]),Z(()=>{if(!e||!t)return;e&&o&&i!==`idle`&&a(`starting`);let n=Kp.request(()=>{a(`idle`)});return()=>{Kp.cancel(n)}},[t,e,o,i]),{mounted:o,setMounted:s,transitionStatus:i}}function $h(e,t){return e.getAnimations(t).filter(e=>{let t=e.effect?.getTiming();return t?.duration!==1/0&&t?.iterations!==1/0})}var eg=null;function tg(e){if(!eg){let e=[];eg=e,queueMicrotask(()=>{eg=null,Sh.flushSync(()=>{for(let t of e)t()})})}eg.push(e)}function ng(e,t=!1,n=!1){let r=qp();return X((i,a=null)=>{r.cancel();let o=Lh(e);if(o==null)return;let s=o,c=()=>{if(!n){Sh.flushSync(i);return}tg(()=>{a?.aborted||i()})};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all($h(s).map(e=>e.finished.then(Wu))).then(()=>{a?.aborted||c()},()=>{if(!a?.aborted){if($h(s).some(e=>e.pending||e.playState!==`finished`)){l();return}c()}})}if(t){let e=_d;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 rg(e){let{enabled:t=!0,open:n,ref:r,batch:i=!1,onComplete:a}=e,o=X(a),s=ng(r,n,i);J.useEffect(()=>{if(!t)return;let e=new AbortController;return s(o,e.signal),()=>{e.abort()}},[t,n,o,s])}function ig(e){let{open:t,ref:n,preventUnmountOnClose:r,setPreventUnmountOnClose:i,onUnmount:a,animateInitialOpen:o}=e,s=X(i),{mounted:c,setMounted:l,transitionStatus:u}=Qh(t,!1,!1,o),d=!t&&r;Z(()=>{t&&s(!1)},[t,s]);let f=J.useRef(c),p=J.useRef(!1),m=Bf(),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 rg({enabled:c&&!t&&!d,open:t,ref:n,onComplete(){t||g()}}),{mounted:c,transitionStatus:u,preventUnmountingOnClose:d,forceUnmount:g}}var ag={tabIndex:-1,[bp]:``};function og(e){return t=>t!==`touch`||e.current}function sg(e,t=!1){let n=Wf(),r=Mh()!=null,i=Nu(()=>e(n,r)).current;return Zh({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function cg({handle:e,store:t}){return Z(()=>e.attachStore(t),[e,t]),null}function lg(e){let t=e.context.triggerElements.size;e.select(`open`)&&e.state.triggerCount!==t&&e.set(`triggerCount`,t)}function ug(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),lg(a))}r!==null&&e!==void 0&&(n.current={store:t,id:e,element:r},t.context.triggerElements.add(e,r),lg(t))})}function dg(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 fg(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function pg(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=ug(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 mg(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=Sf(wf);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 hg(e,t,n,r){let{mounted:i,transitionStatus:a,forceUnmount:o}=ig({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 Nu(()=>(t.set(`mounted`,i),null)),t.useSyncedValues({mounted:i,transitionStatus:a}),{forceUnmount:o,transitionStatus:a}}function gg(e,t){e.useSyncedValues(t),Z(()=>()=>{e.update({activeTriggerProps:Ku,inactiveTriggerProps:Ku,popupProps:Ku})},[e])}function _g(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 vg=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}},yg=t((e=>{var t=we();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})),bg=t(((e,t)=>{t.exports=yg()})),xg=t((e=>{var t=we(),n=bg();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}})),Sg=t(((e,t)=>{t.exports=xg()})),Cg=[],wg=void 0;function Tg(){return wg}function Eg(e){Cg.push(e)}function Dg(e){let t=(t,n)=>{let r=Nu(kg).current,i;try{wg=r;for(let e of Cg)e.before(r);i=e(t,n);for(let e of Cg)e.after(r);r.didInitialize=!0}finally{wg=void 0}return i};return t.displayName=e.displayName||e.name,t}function Og(e){return J.forwardRef(Dg(e))}function kg(){return{didInitialize:!1}}var Ag=bg(),jg=Sg(),Mg=Vu(19)?Fg:Ig;function Ng(e,t,n,r,i){return Mg(e,t,n,r,i)}function Pg(e,t,n,r,i){let a=J.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Ag.useSyncExternalStore)(e.subscribe,a,a)}Eg({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,Ag.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Fg(e,t,n,r,i){let a=Tg();if(!a)return Pg(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 Ig(e,t,n,r,i){return(0,jg.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Lg=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 Ng(this,e,t,n,r)}},Rg=class extends Lg{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),Ng(this,this.selectors[e],t,n,r)}useContextCallback(e,t){J.useDebugValue(e);let n=X(t??Wu);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)}})}},zg={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},Bg=class extends Rg{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:Oh(),nested:n,triggerElements:i},zg),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&gp(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 Vg(e,t,n=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new Bg({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:Ku,inactiveTriggerProps:Ku,popupProps:Ku}}var Hg=e=>e.triggerIdProp??e.activeTriggerId,Ug=e=>e.openProp??e.open,Wg=e=>(e.popupElement?.id??e.floatingId)||void 0;function Gg(e,t){return t!==void 0&&Ug(e)&&Hg(e)===t}function Kg(e,t){return Gg(e,t)?!0:t!==void 0&&Ug(e)&&Hg(e)==null&&!e.openedWithoutTrigger&&e.triggerCount===1}var qg={open:Ug,mounted:e=>e.mounted,transitionStatus:e=>Ug(e)&&!e.mounted?`starting`:e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Hg,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Wg,isTriggerActive:(e,t)=>t!==void 0&&Hg(e)===t,isOpenedByTrigger:(e,t)=>Gg(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Hg(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Kg(e,t)?Wg(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Jg(e){let t=J.useCallback(t=>e===void 0?Wu:e.subscribeStore(t),[e]),n=J.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,Ag.useSyncExternalStore)(t,n,()=>e?.serverStore)}var Yg=op&&cp;function Xg(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=Xf();J.useEffect(()=>{let t=e.select(`domReferenceElement`);if(!n)return;let r=zd(t);function i(){let t=e.select(`domReferenceElement`);!e.select(`open`)&&Ud(t)&&t===_p(_f(t))&&(o.current=!0,s.current=t)}function a(){c.current=!0}function l(){c.current=!1}return Vp(Bp(r,`blur`,i),Yg&&Bp(r,`keydown`,a,!0),Yg&&Bp(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`);Hd(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=yp(n.nativeEvent);if(Hd(a)){if(Yg&&!n.relatedTarget){if(!c.current&&!Ap(a))return}else if(!Np(a))return}let u=Dp(n.relatedTarget,e.context.triggerElements),{nativeEvent:d,currentTarget:f}=n;if(e.select(`open`)&&u||!r){e.setOpen(!0,Sf(Df,d,f));return}l.start(r,()=>{o.current||e.setOpen(!0,Sf(Df,d,f))})},onBlur(n){t();let r=n.relatedTarget,i=n.nativeEvent,o=Hd(r)&&r.hasAttribute(rh(`focus-guard`))&&r.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let t=e.select(`domReferenceElement`),n=_p(_f(t));!r&&n===t||Q(a.current.floatingContext?.refs.floating.current,n)||Q(t,n)||o||Dp(r??n,e.context.triggerElements)||e.setOpen(!1,Sf(Df,i))})}}},[a,r,e,l]);return J.useMemo(()=>n?{reference:u,trigger:u}:{},[n,u])}var Zg=class e{pointerType=void 0;interactedInside=!1;handler=void 0;blockMouseMove=!0;performedPointerEventsMutation=!1;pointerEventsScopeElement=null;pointerEventsReferenceElement=null;pointerEventsFloatingElement=null;restTimeoutPending=!1;openChangeTimeout=new Yf;restTimeout=new Yf;handleCloseOptions=void 0;static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Qg=new WeakMap;function $g(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Qg.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Qg.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function e_(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Qg.get(n);a&&a!==e&&$g(a),$g(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Qg.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function t_(e){let t=e.context.dataRef.current,n=Nu(()=>t.hoverInteractionState??Zg.create()).current;return t.hoverInteractionState||=n,qf(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function n_(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=Nh(),u=Mh(),d=t_(e),f=Xf(),p=X(()=>Rp(c.current.openEvent?.type,d.interactedInside)),m=X(()=>zp(c.current.openEvent?.type)),h=X(()=>{$g(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()&&Hd(s)&&o){let e=s,t=o,n=_f(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??vp(e,`[data-rootownerid]`)??n.body;return e_(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&&th(l.nodesRef.current,u).length>0)}function a(t){let n=Ip(r,`close`,d.pointerType),i=()=>{e.setOpen(!1,Sf(Ef,t)),l?.events.emit(`floating.closed`,t)};n?d.openChangeTimeout.start(n,i):(d.openChangeTimeout.clear(),i())}function s(e){let t=yp(e);if(!jp(t)){d.interactedInside=!1;return}d.interactedInside=vp(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(Dp(n.relatedTarget,e.context.triggerElements))return;let r=c.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(l&&r&&Hd(o)&&th(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,Sf(Ef,n)),l.events.emit(`floating.closed`,n)})}let y=o;return Vp(y&&Bp(y,`mouseenter`,g),y&&Bp(y,`mouseleave`,_),y&&Bp(y,`pointerdown`,s,!0),()=>{l?.events.off(`floating.closed`,v)})},[n,o,e,c,r,i,m,p,h,d,l,u,f])}var r_={current:null};function i_(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=r_,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,{dataRef:h,events:g}=e.context,_=Nh(l),v=t_(e),y=J.useRef(!1),b=Hp(i),x=Hp(r),S=Hp(o),C=Hp(n),w=Hp(p),T=Hp(f),E=X(()=>Rp(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(!Hd(r))return!1;let a=r;return i.hasMatchingElement(e=>Q(e,a))&&(!t||!Q(t,a))}),k=X(()=>{v.handler&&=(_f(e.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),A=X(()=>{$g(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===Ef,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=Ip(x.current,`close`,v.pointerType);r?v.openChangeTimeout.start(r,()=>{e.setOpen(!1,Sf(Ef,t)),_?.events.emit(`floating.closed`,t)}):n&&(v.openChangeTimeout.clear(),e.setOpen(!1,Sf(Ef,t)),_?.events.emit(`floating.closed`,t))}let r=c.current??(u?e.select(`domReferenceElement`):null);if(!Hd(r))return;function i(t){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!hp(v.pointerType))return;let n=Lp(S.current),r=Ip(x.current,`open`,v.pointerType),i=yp(t),o=t.currentTarget??null,s=e.select(`domReferenceElement`),c=o;if(Hd(i)&&!e.context.triggerElements.hasElement(i)){for(let t of e.context.triggerElements.elements())if(Q(t,i)){c=t;break}}Hd(o)&&Hd(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&&Hd(c)&&Hd(s)&&Q(s,c)&&f,m=n>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){D()&&e.setOpen(!0,Sf(Ef,t,c));return}m||(r?v.openChangeTimeout.start(r,()=>{g&&D()&&e.setOpen(!0,Sf(Ef,t,c))}):g&&D()&&e.setOpen(!0,Sf(Ef,t,c)))}function o(n){if(E()){A();return}k();let r=_f(e.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let i=h.current.floatingContext??d?.();if(!Dp(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?Bp(r,`mouseout`,l):void 0;return s?Vp(Bp(r,`mousemove`,i,{once:!0}),Bp(r,`mouseenter`,i),Bp(r,`mouseleave`,o),f):Vp(Bp(r,`mouseenter`,i),Bp(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&&!hp(v.pointerType))return;if(o&&s&&v.handleCloseOptions?.blockPointerEvents){let t=e.select(`floatingElement`);if(t){let e=v.handleCloseOptions?.getScope?.()??r.ownerDocument.body;e_(v,{scopeElement:e,referenceElement:r,floatingElement:t})}}let c=Lp(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,Sf(Ef,n,r))}v.pointerType===`touch`?Sh.flushSync(()=>{l()}):s&&o?l():(v.restTimeoutPending=!0,v.restTimeout.start(c,l))}}},[n,v,E,O,a,e,S,D])}function a_(e){return cp&&e.movementX===0&&e.movementY===0}function o_(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function s_(e,t){return o_(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function c_(e,t,n){return o_(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function l_(e,t,n){return o_(t,n?e===Sp:e===Cp,e===Tp)}function u_(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:o_(t,n?e===Cp:e===Sp,e===wp)}function d_(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=Pp(E),A=Mp(D),j=Hp(k),M=Mh(),N=Nh(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=Hp(h),U=Hp(T),W=Hp(o),ne=Hp(b),re=qp(),ie=qp(),ae=X(()=>{re.cancel();function e(e){d||(ee.current=ah(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||c_(I.current,_,u)||l?Tm(n):Em(n),I.current=null,R())};t()}}else wm(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=_p(_f(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(()=>Tm(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&&u_(t.key,g,u,w)){s_(t.key,ce())||dp(t),e.setOpen(!1,Sf(Nf,t.nativeEvent));let n=S?.current??D;Ud(n)&&n.focus();return}r!=null&&r!==F.current&&!wm(n.current,r)&&(F.current=r);let i=F.current,a=Tm(n,h),o=Em(n,h);if(A||(t.key===`Home`&&(dp(t),F.current=a,R(t)),t.key===`End`&&(dp(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(s_(t.key,g)){dp(t);let e=_p(t.currentTarget.ownerDocument);if(T&&!d&&Q(t.currentTarget,e)&&!n.current.some(t=>t!=null&&Q(t,e))){F.current=c_(t.key,g,u)?a:o,R(t),r===F.current&&ae();return}let{index:l,wrapped:f}=Dm(n.current,i,{decrement:!c_(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){a_(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=_p(_f(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=yp(t.nativeEvent);if(n&&!Q(j.current,n))return;dp(t);let r=Sf(jf,t.nativeEvent);e.setOpen(!1,r);let i=S?.current??D;!r.isCanceled&&Ud(i)&&i.focus();return}ue(t)},onPointerMove(e){a_(e)||(L.current=!0)}}),[fe,ue,j,A,e,T,d,D,S]),pe=J.useMemo(()=>{function t(t){e.setOpen(!0,Sf(Nf,t.nativeEvent,t.currentTarget))}function n(e){f===`auto`&&pp(e.nativeEvent)&&(P.current=!d)}function r(e){P.current=f,f===`auto`&&mp(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(n){let r=e.select(`open`);L.current=!1;let i=n.key.startsWith(`Arrow`),a=l_(n.key,ce(),u),o=s_(n.key,r?g:_),s=(l?a:o)||n.key===`Enter`||n.key.trim()===``;if(d&&r&&(!l||Ap(n.currentTarget)))return ue(n);if(!(!r&&!m&&i)){if(s){let e=s_(n.key,ce());I.current=l&&e?null:n.key}if(l){a&&(dp(n),r?(F.current=le(),R(n),d&&j.current?.focus()):t(n));return}o&&(W.current!=null&&(F.current=W.current),dp(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 f_(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=Xf(),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&&!jm(n)||n?.matches(`:disabled`)?!1:o==null||!km(Gu,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===` `&&(dp(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!==` `&&(dp(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 p_=.1,m_=p_*p_,h_=.5;function g_(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function __(e,t,n,r,i,a,o,s,c,l){let u=!1;return g_(e,t,n,r,i,a)&&(u=!u),g_(e,t,i,a,o,s)&&(u=!u),g_(e,t,o,s,c,l)&&(u=!u),g_(e,t,c,l,n,r)&&(u=!u),u}function v_(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function y_(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 b_(e={}){let{blockPointerEvents:t=!1}=e,n=new Yf,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*m_;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=yp(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&&Hd(r.relatedTarget)&&Q(u,r.relatedTarget))return;function y(){return!!(s&&th(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=y_(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=y_(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=y_(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=y_(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!v_(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?h_/2:h_*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+h_+1,o=C||T?S.bottom-h_:S.top,s=C?T?S.bottom-h_:S.top:S.bottom-h_;M=__(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?h_/2:h_*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-h_,o=C||T?S.top+h_:S.bottom,s=C?T?S.top+h_:S.bottom:S.top+h_;M=__(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?h_/2:h_*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+h_+1,o=w||E?S.right-h_:S.left,s=w?E?S.right-h_:S.left:S.right-h_;M=__(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?h_/2:h_*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-h_,o=w||E?S.left+h_:S.right,s=w?E?S.left+h_:S.right:S.left+h_;M=__(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 x_(e,t,n){let{reference:r,floating:i}=e,a=lm(t),o=um(t),s=cm(o),c=am(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=om(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function S_(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}=im(t,e),p=Sm(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Cm(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=Cm(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 C_=50,w_=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:S_},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=x_(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<C_&&(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}=x_(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},T_=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}=im(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=am(r),_=lm(o),v=am(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[bm(o)]:fm(o)),x=p!==`none`;!d&&x&&b.push(...ym(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=dm(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`||_===lm(t)||T.every(e=>lm(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=lm(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{}}}},E_=new Set([`left`,`top`]);async function D_(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=am(n),s=om(n),c=lm(n)===`y`,l=E_.has(o)?-1:1,u=a&&c?-1:1,d=im(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 O_=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 D_(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}}}}},k_=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}=im(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=lm(i),p=sm(f),m=u[p],h=u[f],g=(e,t)=>rm(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}}}}}},A_=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}=im(e,t),u={x:n,y:r},d=lm(i),f=sm(d),p=u[f],m=u[d],h=im(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=E_.has(am(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}}}},j_=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}=im(e,t),c=await i.detectOverflow(t,s),l=am(n),u=om(n),d=lm(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=Zp(p-c[m],g),y=Zp(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*Qp(c.left,c.right):S=p-2*Qp(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 M_(e){let t=nf(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ud(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=$p(n)!==a||$p(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function N_(e){return Hd(e)?e:e.contextElement}function P_(e){let t=N_(e);if(!Ud(t))return tm(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=M_(t),o=(a?$p(n.width):n.width)/r,s=(a?$p(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var F_=tm(0);function I_(e){let t=zd(e);return!ef()||!t.visualViewport?F_:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function L_(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===zd(e)}function R_(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=N_(e),o=tm(1);t&&(r?Hd(r)&&(o=P_(r)):o=P_(e));let s=L_(a,n,r)?I_(a):tm(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=zd(a),t=Hd(r)?zd(r):r,n=e,i=cf(n);for(;i&&t!==n;){let e=P_(i),t=i.getBoundingClientRect(),r=nf(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=zd(i),i=cf(n)}}return Cm({width:u,height:d,x:c,y:l})}function z_(e,t){let n=rf(e).scrollLeft;return t?t.left+n:R_(Bd(e)).left+n}function B_(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-z_(e,n),y:n.top+t.scrollTop}}function V_(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Bd(r),s=t?qd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=tm(1),u=tm(0),d=Ud(r);if((d||!a)&&((Rd(r)!==`body`||Gd(o))&&(c=rf(r)),d)){let e=R_(r);l=P_(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?B_(o,c):tm(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 H_(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function U_(e){let t=rf(e),n=e.ownerDocument.body,r=Qp(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Qp(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+z_(e),o=-t.scrollTop;return nf(n).direction===`rtl`&&(a+=Qp(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var W_=25;function G_(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=zd(e),a=Bd(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!ef()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(z_(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<=W_&&(s-=o)}return{width:s,height:c,x:l,y:u}}function K_(e,t){let n=R_(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=P_(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function q_(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=G_(e,n,t);else if(t===`document`)r=U_(Bd(e));else if(Hd(t))r=K_(t,n);else{let n=I_(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Cm(r)}function J_(e,t){let n=t.get(e);if(n)return n;let r=sf(e,[],!1).filter(e=>Hd(e)&&Rd(e)!==`body`),i=null,a=nf(e).position===`fixed`,o=a?af(e):e;for(;Hd(o)&&!tf(o);){let e=nf(o),t=Qd(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=af(o)}return t.set(e,r),r}function Y_(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?qd(t)?[]:J_(t,this._c):[].concat(n),r],o=q_(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=q_(t,a[e],i);s=Qp(n.top,s),c=Zp(n.right,c),l=Zp(n.bottom,l),u=Qp(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function X_(e){let{width:t,height:n}=M_(e);return{width:t,height:n}}function Z_(e,t,n){let r=Ud(t),i=Bd(t),a=n===`fixed`,o=R_(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=tm(0);if((r||!a)&&((Rd(t)!==`body`||Gd(i))&&(s=rf(t)),r)){let e=R_(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=z_(i));let l=i&&!r&&!a?B_(i,s):tm(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 Q_(e){return nf(e).position===`static`}function $_(e,t){if(!Ud(e)||nf(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Bd(e)===n&&(n=n.ownerDocument.body),n}function ev(e,t){let n=zd(e);if(qd(e))return n;if(!Ud(e)){let t=af(e);for(;t&&!tf(t);){if(Hd(t)&&!Q_(t))return t;t=af(t)}return n}let r=$_(e,t);for(;r&&Kd(r)&&Q_(r);)r=$_(r,t);return r&&tf(r)&&Q_(r)&&!Qd(r)?n:r||$d(e)||n}var tv=async function(e){let t=this.getOffsetParent||ev,n=this.getDimensions,r=await n(e.floating);return{reference:Z_(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nv(e){return nf(e).direction===`rtl`}var rv={convertOffsetParentRelativeRectToViewportRelativeRect:V_,getDocumentElement:Bd,getClippingRect:Y_,getOffsetParent:ev,getElementRects:tv,getClientRects:H_,getDimensions:X_,getScale:P_,isElement:Hd,isRTL:nv};function iv(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function av(e,t,n){let r=null,i,a=Bd(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=em(d),h=em(a.clientWidth-(u+f)),g=em(a.clientHeight-(d+p)),_=em(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Qp(0,Zp(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!iv(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=zd(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function ov(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=N_(e),u=i||a?[...l?sf(l):[],...t?sf(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?av(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?R_(e):null;c&&g();function g(){let t=R_(e);h&&!iv(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 sv=O_,cv=k_,lv=T_,uv=j_,dv=A_,fv=(e,t,n)=>{let r=new Map,i=n??{},a={...rv,...i.platform,_c:r};return w_(e,t,{...i,platform:a})},pv=typeof document<`u`?J.useLayoutEffect:function(){};function mv(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(!mv(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)&&!mv(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function hv(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gv(e,t){let n=hv(e);return Math.round(t*n)/n}function _v(e){let t=J.useRef(e);return pv(()=>{t.current=e}),t}function vv(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);mv(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=_v(c),D=_v(i),O=_v(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),fv(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!mv(w.current,t)&&(w.current=t,Sh.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);pv(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);pv(()=>(A.current=!0,()=>{A.current=!1}),[]),pv(()=>{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=gv(M.floating,u.x),r=gv(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...hv(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 yv=(e,t)=>{let n=sv(e);return{name:n.name,fn:n.fn,options:[e,t]}},bv=(e,t)=>{let n=cv(e);return{name:n.name,fn:n.fn,options:[e,t]}},xv=(e,t)=>({fn:dv(e).fn,options:[e,t]}),Sv=(e,t)=>{let n=lv(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cv=(e,t)=>{let n=uv(e);return{name:n.name,fn:n.fn,options:[e,t]}},wv=J.createContext(void 0);function Tv(){let e=J.useContext(wv);if(e===void 0)throw Error(ku(26));return e}var Ev=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`]),Dv=`--nested-dialogs`,Ov=`data-nested-dialog-open`,kv={...Pd,...xd,nestedDialogOpen(e){return e?{[Ov]:``}:null}},Av=J.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=ju(),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`);Tv(),rg({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?og(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=ud(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...ag,hidden:!m,onKeyDown(e){Ev.has(e.key)&&e.stopPropagation()},style:{[Dv]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:kv});return(0,$.jsx)(Kh,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function jv(e){return Vu(19)?e:e?`true`:void 0}var Mv=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}})}),Nv=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=ju(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,$.jsx)(wv.Provider,{value:n,children:(0,$.jsxs)(Dh,{ref:t,...r,children:[a&&o===!0&&(0,$.jsx)(Mv,{ref:i.context.internalBackdropRef,inert:jv(!s)}),e.children]})}):null}),Pv={},Fv={},Iv=``;function Lv(e,t){return Gd(e)?e:t}function Rv(e,t,n){return/hidden|clip/.test(e.getComputedStyle(Lv(t,n)).overflowY)}function zv(e){if(typeof document>`u`)return!1;let t=_f(e);return zd(t).innerWidth-t.documentElement.clientWidth>0}function Bv(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=_f(e),n=t.documentElement,r=t.body,i=Lv(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 Vv(e){let t=_f(e),n=t.documentElement,r=t.body,i=Lv(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 Hv(e){let t=_f(e),n=t.documentElement,r=t.body,i=zd(n),a=0,o=0,s=!1,c=Kp.create();if(cp&&(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,Pv={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Iv=n.style.scrollBehavior,Fv={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=Lv(n,r);if(s=Bv(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,Pv),Object.assign(r.style,Fv),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=Iv)}function d(){u(),c.request(l)}l();let f=Bp(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Uv=new class{lockCount=0;restore=null;timeoutLock=Yf.create();timeoutUnlock=Yf.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=_f(e),n=t.documentElement,r=t.body,i=zd(n);if(Rv(i,n,r)){let t=new i.MutationObserver(()=>{Rv(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=rp||!zv(e);this.restore=a?Vv(e):Hv(e)}};function Wv(e=!0,t=null){Z(()=>{if(e)return Uv.acquire(t)},[e,t])}function Gv({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=Xh(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=yp(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 Wv(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]),gg(e,{activeTriggerProps:m.reference,inactiveTriggerProps:m.trigger,popupProps:m.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:d}),null}var Kv={...qg,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},qv=class extends Rg{constructor(e,t,n){let r=new vg,i=Jv(e,r,t,n);super(i,Yv(r),Kv)}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(dg(this.state,e,t.trigger)))}};function Jv(e,t,n,r=!1){return{...Vg(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 Yv(e){return{popupRef:J.createRef(),backdropRef:J.createRef(),internalBackdropRef:J.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function Xv(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=ju(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=sg((e,t)=>new qv({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`);_g(b,x),mg(b);let{forceUnmount:w}=hg(x,b);J.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,Sf(Rf))}),[w,b]);let T=x||S||u!=null;return(0,$.jsxs)(Au.Provider,{value:b,children:[u&&(0,$.jsx)(cg,{handle:u,store:b}),T&&(0,$.jsx)(Gv,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}var Zv=Dg(function(e){return Xv(`dialog`,e)}),Qv=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=ju(),c=Gf(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),ud(`h2`,e,{ref:t,props:[{id:c},o]})});function $v(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 ey(e,t){let n=J.useRef(e),r=X(t);Z(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function ty(e,t){let{onClick:n,onPointerDown:r}=$v(X((n,r)=>{(typeof e==`function`?e():e)||t(r||(rp?`touch`:``))}));return J.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function ny(e){let[t,n]=J.useState(null),r=ty(e,n);return ey(e,t=>{t&&!e&&n(null)}),J.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var ry=Og(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=ju(!0),f=Jg(l)??d;if(!f)throw Error(ku(79));let p=Gf(s),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=f.useState(`triggerPopupId`,p),_=J.useRef(null),{registerTrigger:v,isMountedByThisTrigger:y}=pg(p,_,f,{payload:c}),{getButtonProps:b,buttonRef:x}=yf({disabled:a,native:o}),S=qh(m),C=ty(()=>f.select(`open`),e=>{f.set(`openMethod`,e)}),w={disabled:a,open:h},T=f.useState(`triggerProps`,y);return ud(`button`,e,{state:w,ref:[x,t,v,_],props:[S.reference,T,C,{[vh]:``,id:p,"aria-haspopup":`dialog`,"aria-expanded":h,"aria-controls":g},u,b],stateAttributesMapping:Md})}),iy=(0,J.createContext)(void 0),ay=(0,J.createContext)(null);function oy(e){let t=(0,J.useContext)(ay);return t===null?Object.hasOwn(globalThis,`document`)?document.body:null:t[e]}function sy(e){let t=(0,J.useContext)(iy),n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>t?.(()=>{n.current()}),[t])}var cy=(0,J.createContext)(null);function ly({children:e,interactionOwner:t=`local`,modal:n=!0,onOpenChange:r,...i}){return(0,$.jsx)(cy.Provider,{value:{interactionOwner:t,modal:n},children:(0,$.jsx)(Zv,{...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 uy(){let e=(0,J.useContext)(cy);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)(ry,{...n,className:t=>q(`btn`,Ye(e,t)),ref:r,type:t})});var dy=(0,J.forwardRef)(function({container:e,...t},n){let r=oy(`dialog`);return e==null&&r===null?null:(0,$.jsx)(Nv,{...t,container:e??r,ref:n})}),fy=(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(Id,{...t,ref:n,className:t=>q(`caps-dialog-backdrop fixed inset-0 bg-black/40`,Ye(e,t))})}),py=(0,J.forwardRef)(function({className:e,finalFocus:t,size:n=`default`,...r},i){let a=uy();return(0,$.jsx)(Av,{...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)`,Ye(e,t)),finalFocus:a.interactionOwner===`host`?!1:t??!0,ref:i})}),my=(0,J.forwardRef)(function({container:e,keepMounted:t=!0,className:n,size:r=`default`,...i},a){let{modal:o}=uy();return(0,$.jsxs)(dy,{container:e,keepMounted:t,children:[o===!0?(0,$.jsx)(fy,{}):null,(0,$.jsx)(py,{...i,size:r,className:e=>q(r==="default"&&`fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2`,Ye(n,e)),ref:a})]})});function hy({className:e,...t}){return(0,$.jsx)(`div`,{...t,className:q(`flex justify-end gap-sm`,e)})}function gy({className:e,...t}){return(0,$.jsx)(`div`,{...t,className:q(`flex flex-col gap-sm`,e)})}var _y=(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(Qv,{...t,className:t=>q(`text-lg font-semibold`,Ye(e,t)),ref:n})});(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(Kf,{...t,className:t=>q(`text-sm text-base-content`,Ye(e,t)),ref:n})});var vy=(0,J.forwardRef)(function({className:e,type:t=`button`,...n},r){return(0,$.jsx)(zf,{...n,className:t=>q(`btn btn-ghost`,Ye(e,t)),ref:r,type:t})}),yy={queued:`Waiting to start`,generating:`Generating`,refining:`Refining`,done:void 0,failed:void 0},by=(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(!vr(t)){p(!1);return}let r=Hr(t),i=gr(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??yy[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)(Lr,{decorative:!0,size:`lg`,variant:`bloom`}):null,_===void 0?null:(0,$.jsx)(Dr,{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]})}),xy=J.createContext(void 0);function Sy(){let e=J.useContext(xy);if(e===void 0)throw Error(ku(53));return e}function Cy(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 wy=`base-ui-disable-scrollbar`,Ty={className:wy,getElement(e){return(0,$.jsx)(`style`,{nonce:e,href:wy,precedence:`base-ui:low`,children:`.${wy}{scrollbar-width:none}.${wy}::-webkit-scrollbar{display:none}`})}},Ey=`data-has-overflow-x`,Dy=`data-has-overflow-y`,Oy=`data-overflow-x-start`,ky=`data-overflow-x-end`,Ay=`data-overflow-y-start`,jy=`data-overflow-y-end`,My=e=>t=>t?{[e]:``}:null,Ny={hasOverflowX:My(Ey),hasOverflowY:My(Dy),overflowXStart:My(Oy),overflowXEnd:My(ky),overflowYStart:My(Ay),overflowYEnd:My(jy),cornerHidden:()=>null},Py=J.createContext(void 0),Fy={disableStyleElements:!1};function Iy(){return J.useContext(Py)??Fy}var Ly=`--scroll-area-corner-height`,Ry=`--scroll-area-corner-width`,zy=`data-orientation`,By={x:0,y:0},Vy={width:0,height:0},Hy={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Uy={x:!0,y:!0,corner:!0},Wy=J.forwardRef(function(e,t){let{render:n,className:r,overflowEdgeThreshold:i,style:a,...o}=e,{xStart:s,xEnd:c,yStart:l,yEnd:u}=Gy(i),d=Gf(),f=Xf(),p=Xf(),{nonce:m,disableStyleElements:h}=Iy(),[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(Vy),[O,k]=J.useState(Vy),[A,j]=J.useState(Hy),[M,N]=J.useState(Uy),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(By),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(zy);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=Cy(i,`padding`,a),s=Cy(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`,[Ly]:`${E.height}px`,[Ry]:`${E.width}px`}},pe=ud(`div`,e,{state:fe,ref:[t,P],props:[G,o],stateAttributesMapping:Ny}),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)(xy.Provider,{value:me,children:[!h&&Ty.getElement(m),pe]})});function Gy(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 Ky(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}var qy=J.createContext(void 0);function Jy(){let e=J.useContext(qy);if(e===void 0)throw Error(ku(55));return e}var Yy=J.createContext(void 0);function Xy(){return J.useContext(Yy)?.direction??`ltr`}function Zy(e,t){if(t<=0)return 0;let n=Ky(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 Qy=`--scroll-area-overflow-x-start`,$y=`--scroll-area-overflow-x-end`,eb=`--scroll-area-overflow-y-start`,tb=`--scroll-area-overflow-y-end`,nb=`--scroll-area-thumb-height`,rb=`--scroll-area-thumb-width`,ib=[Qy,$y,eb,tb],ab=!1;function ob(){ab||cp||(typeof CSS<`u`&&`registerProperty`in CSS&&ib.forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),ab=!0)}var sb=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}=Sy(),T=Xy(),E=J.useRef(!0),D=J.useRef([NaN,NaN,NaN,NaN]),O=Xf(),k=Xf(),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=cb(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=Zy(T===`rtl`?-w:w,P),L=P-I);let R=A?0:Zy(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=Cy(n,`padding`,`x`),re=Cy(t,`padding`,`y`),ie=Cy(i,`margin`,`x`),ae=Cy(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=>lb(e,{width:ue,height:de})),t&&r){let e=ub(r,nb,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=ub(i,rb,T===`rtl`?-w:w,P,_,ue,e);i.style.transform=`translate3d(${T===`rtl`?-t:t}px,0,0)`}let fe=[I,L,R,z];ib.forEach((t,n)=>{e.style.setProperty(t,`${fe[n]}px`)}),a&&p(e=>lb(e,{width:H,height:ee})),g(e=>lb(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=>lb(e,G))});Z(()=>{ob()},[]),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=$h(e,{subtree:!0});t.length!==0&&Promise.allSettled(t.map(e=>e.finished.then(Wu))).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:Ty.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=ud(`div`,e,{ref:[t,o],state:w,props:[M,a],stateAttributesMapping:Ny}),P=J.useMemo(()=>({computeThumbPosition:A}),[A]);return(0,$.jsx)(qy.Provider,{value:P,children:N})});function cb(e){let t=e.clientHeight>=e.scrollHeight,n=e.clientWidth>=e.scrollWidth;return{y:t,x:n,corner:t||n}}function lb(e,t){for(let n in t)if(e[n]!==t[n])return t;return e}function ub(e,t,n,r,i,a,o){let s=Ky(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 db=J.createContext(void 0);function fb(){let e=J.useContext(db);if(e===void 0)throw Error(ku(54));return e}var pb=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}=Sy(),T=i===`vertical`,E={...w,hovering:c,scrolling:T?u:l,orientation:i},D=Xy(),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 Bp(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=yp(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=Cy(n,`margin`,a),s=Cy(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(${Ly})`,insetInlineEnd:0,[nb]:`${S.height}px`}:{insetInlineStart:0,insetInlineEnd:`var(${Ry})`,bottom:0,[rb]:`${S.width}px`}}},M=ud(`div`,e,{ref:[t,T?f:p],state:E,props:[j,s],stateAttributesMapping:Ny});return A?(0,$.jsx)(db.Provider,{value:i,children:M}):null}),mb=J.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{computeThumbPosition:o}=Jy(),{hasMeasuredScrollbar:s,viewportState:c}=Sy(),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]),ud(`div`,e,{ref:[t,l],state:c,stateAttributesMapping:Ny,props:[{role:`presentation`,style:{minWidth:`fit-content`}},a]})}),hb=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}=Sy(),m=fb(),h=m===`vertical`;return ud(`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 gb(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 _b(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 vb=(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=cr();(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=Hr(t),i=Fr(r,{ease:`outQuad`,duration:45}),a=br(r,{bounce:.18,duration:180});n=Zr(t,{scaleY:[{to:e.scaleY,...i},{to:1,...a}],scaleX:[{to:e.scaleX,...i},{to:1,...a}]})},d=(e,t)=>{let n=gb(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=_b(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)(sb,{render:a?(0,$.jsx)(Gn,{}):(0,$.jsx)(`div`,{}),...o,ref:s,className:`caps-scroll-viewport`,children:(0,$.jsx)(mb,{style:{minWidth:0},children:e})});return(0,$.jsxs)(Wy,{render:n?(0,$.jsx)(Wr,{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)(Wr,{size:`sm`,depth:`deep`,placement:`embedded`,className:`caps-scroll-track-surface`,children:(0,$.jsx)(pb,{className:`caps-scroll-track`,children:(0,$.jsx)(hb,{className:`caps-scroll-thumb`,children:(0,$.jsx)(`span`,{className:`caps-scroll-thumb-surface`,ref:l})})})})]})}),yb={dot:{y:-4,height:8,cy:0},pill:{y:-16,height:32,cy:0},bang:{y:-16,height:20,cy:12}};function bb({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)(yb[t]).current,d=(0,J.useRef)(t===`dot`?1:4).current,f=(0,J.useRef)(+(t===`bang`)).current,p=(0,J.useRef)(t),m=Jr(s),{reduced:h}=m;return(0,J.useLayoutEffect)(()=>{if(!i.current||!a.current||!c.current||!l.current)return;let e=yb[t],n=h||p.current===t;p.current=t;let r=Hr(i.current),o=n?{duration:0}:br(r,{bounce:.3,duration:360}),s=Zr(i.current,{y:e.y,height:e.height,...o}),u=Zr(a.current,{cy:e.cy,...n?{duration:0}:{delay:ir(r,35),...br(r,{bounce:.3,duration:420})}}),d=Zr(c.current,{gradientTransform:`matrix(1 0 0 ${t===`dot`?`1`:`4`} 0 0)`,...o}),f=Zr(l.current,{opacity:+(t===`bang`),...n?kr:Fr(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`?Zr(o.current,{opacity:[1,.45],...Fr(m,{ease:`inOutSine`,duration:750}),alternate:!0,loop:!0}):Zr(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}},...Fr(m,{ease:`inOutSine`,duration:1e3}),loop:!0}),t=lr(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)(Tr,{id:r,values:Nr}),(0,$.jsx)(mr,{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)(dr,{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 xb=.28;function Sb(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?xb: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 Cb=7.25;function wb({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)(Sb(t,n)).current,p=(0,J.useRef)(t),m=cr();(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=Sb(t,n),y=p.current;p.current=t;let b=Hr(e),x=m||y===t&&t!==`arc`,S=x?m?{ease:b.ease,duration:b.fast}:kr:Fr(b,{ease:`outQuad`,duration:160}),C=(t===`check`||t===`cross`)&&!x,w=Fr(b,{ease:`inOutSine`,duration:220}),T=[Zr(r,{opacity:v.dashes,...S}),Zr(c,{opacity:v.track*.28,...S}),Zr(f,{opacity:v.arc,"stroke-dasharray":`${String(v.sweep)} 1`,...x?m?kr:S:w}),Zr(h,{r:v.disc*Cb,...C?{delay:w.duration*.7,...br(b,{bounce:.35,duration:360})}:m?kr:Fr(b,{ease:`inCubic`,duration:140})}),Zr(g,{"stroke-dashoffset":1-v.tick,...C&&v.tick>0?{delay:w.duration*.7+b.fast,...Fr(b,{ease:`outCubic`,duration:240})}:kr}),Zr(_,{"stroke-dashoffset":1-v.cross,...C&&v.cross>0?{delay:w.duration*.7+b.fast,...Fr(b,{ease:`outCubic`,duration:240})}:kr})];return t===`cross`&&C&&b.shake>0&&T.push(Zr(e,{translateX:[0,-b.shake,b.shake,-b.shake/2,0],delay:w.duration+b.fast,...Fr(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=Hr(i.current),t=Zr(c.current,{rotate:[0,360],...Fr(e,{ease:`linear`,duration:900}),loop:!0}),n=lr(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)(mr,{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*Cb,fill:`url(#${r}-surface)`,mask:`url(#${r}-knock)`})]})}var Tb=new Set([`ring`,`arc`,`check`,`cross`]);function Eb(e){return Tb.has(e)}var Db={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`},Ob=(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:[Eb(n)?(0,$.jsx)(wb,{className:Db[i],glyph:n,progress:s}):(0,$.jsx)(bb,{className:Db[i],glyph:n,motion:r}),t===void 0?null:(0,$.jsx)(`span`,{children:t})]})}),kb=Ke(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Ab=Ke(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),jb=Ke(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Mb=Ke(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Nb=Ke(`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`}]]),Pb=Ke(`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`}]]),Fb=Ke(`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`}]]),Ib=Ke(`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`}]]),Lb=Ke(`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`}]]),Rb=Ke(`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`}]]),zb=Ke(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Bb=Ke(`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`}]]),Vb=Ke(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Hb=Ke(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ub=Ke(`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`}]]),Wb=Ke(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Gb=Ke(`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`}]]),Kb=24,qb={all:e=>Sr.of(e,`prints`,`gallery`),listings:e=>[...qb.all(e),`listing`],listing:(e,t)=>[...qb.listings(e),t],file:(e,t)=>[...qb.all(e),`file`,t]};function Jb(e,t){let n=e?.context.get().computerId;return aa({queryKey:qb.listing(e,t),initialPageParam:0,enabled:!!(n&&t&&e.capabilities.has(rn)&&e.capabilities.has(tn)),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 ln(e.capabilities,{path:t,limit:Kb-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<Kb&&o!==null);return{entries:a,nextOffset:o}},getNextPageParam:e=>e.nextOffset})}function Yb(e,t,n){return{...Rn(e,tn,[...qb.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 nn(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(tn)),structuralSharing:!1}}function Xb(e,t){let n=e?.app??null,r=Kl(n),i=F(),[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:qb.file(n,e)})},[n,i,s]),l=Jb(n,t),u=ca(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=ia({queries:d.map(e=>Yb(n,e,!!(r&&a.has(`${r}:${e.path}`)))),combine:f});return(0,J.useEffect)(()=>{if(!n)return;let e=qb.all(n),t=qb.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 Zb(e){return e.replace(/\s/gu,` `).replace(/ +/g,` `).trim()}function Qb(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 on(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){un(`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 an(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){un(`refresh-upload-preview`,t),d(e.id,`complete`,`Written; fresh preview unavailable`)}}catch(t){n()||un(`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-${$l(8)}-${Zb(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 $b(e){return e.source.kind===`computer`?`${e.source.computerId}:${e.source.path}`:e.file.name}function ex(e){return e.connection.app.ui.openNavigation({computerId:e.computerId,path:e.path})}function tx(e,t){let n=t.path,r=Kl(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(rn)===!0,c=e?.app.capabilities.has(tn)===!0,l=e?.app.capabilities.has(sn)===!0,u=Xb(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 nn(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||(un(`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 on(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&&(un(`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=Qb(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 nx(e){return e.map(e=>e.key)}function rx(e,t,n){let r=e.indexOf(t);return r<0?null:e[r+n]??null}function ix(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 ax=(0,J.lazy)(async()=>({default:(await nr(()=>import(`./print-download-button-D0u-jIIO.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).PrintDownloadButton}));function ox({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`)||(un(`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 sx({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)(by,{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)(Ob,{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)(or,{"aria-label":`Retry print`,title:`Retry print`,icon:(0,$.jsx)(fr,{}),onClick:e.onRetry}):null,e.onDismiss?(0,$.jsx)(or,{"aria-label":`Dismiss print`,title:`Dismiss print`,icon:(0,$.jsx)(fn,{}),onClick:e.onDismiss}):null]})}):cn(e.path)&&e.url?(0,$.jsx)(ox,{url:e.url,path:e.path,onError:a,autoPlay:!s}):e.url?(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(vb,{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)(Lr,{label:`Loading print`,variant:`bloom`})})]}):(0,$.jsx)(by,{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)(Lr,{decorative:!0,variant:`bloom`}),(0,$.jsx)(`p`,{className:`text-sm`,children:l})]})})})}function cx({source:e}){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)(!1);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_t,{label:`Open in Inkcap`,icon:(0,$.jsx)(Nb,{}),disabled:t,onClick:()=>{n(!0),i(!1),ex(e).catch(e=>{un(`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 lx({items:e,images:t,viewerKey:n,app:r,onNavigate:i,onClose:a,renderInfo:o}){let s=(0,J.useRef)(null),c=nx(e),l=(0,J.useRef)(c),u=n===null?null:ix(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=>$b(e)===u);if(!h||u===null)return null;let _=rx(c,u,-1),v=rx(c,u,1),y=h.path.split(`/`).at(-1)??h.path,b=()=>{a(u)},x=e=>{e!==null&&i(e)};return(0,$.jsx)(ly,{open:!0,onOpenChange:e=>{e||b()},children:(0,$.jsxs)(dy,{children:[(0,$.jsx)(fy,{}),(0,$.jsxs)(py,{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)(Kr,{fit:`fill`,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(vn,{title:(0,$.jsx)(_y,{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)(sx,{item:h,actualSize:p===u},u),d===u&&g?o(g,()=>{f(null)}):null]})]})}),(0,$.jsxs)(`div`,{className:`prints-viewer-actions`,children:[(0,$.jsx)(or,{size:`default`,iconSize:`md`,"aria-label":`Previous print`,title:`Previous print (Left arrow)`,"aria-keyshortcuts":`ArrowLeft`,icon:(0,$.jsx)(kb,{}),disabled:_===null,onClick:()=>{x(_)}}),(0,$.jsx)(or,{size:`default`,iconSize:`md`,"aria-label":`Next print`,title:`Next print (Right arrow)`,"aria-keyshortcuts":`ArrowRight`,icon:(0,$.jsx)(Ab,{}),disabled:v===null,onClick:()=>{x(v)}}),(0,$.jsx)(or,{size:`default`,iconSize:`md`,"aria-label":`Image info`,title:`Image info (I)`,"aria-keyshortcuts":`i`,"aria-expanded":d===u,icon:(0,$.jsx)(zb,{}),disabled:!g,onClick:()=>{f(d===u?null:u)}}),cn(h.path)?null:(0,$.jsx)(or,{size:`default`,iconSize:`md`,"aria-label":`Actual size`,title:`Actual size`,"aria-pressed":p===u,active:p===u,icon:(0,$.jsx)(Bb,{}),disabled:!h.url||!!h.error,onClick:()=>{m(p===u?null:u)}}),g?(0,$.jsx)(J.Suspense,{fallback:null,children:(0,$.jsx)(ax,{source:g.source,app:r},g.url)}):null,g?.source.kind===`computer`?(0,$.jsx)(cx,{source:g.source},u):null,(0,$.jsx)(or,{size:`default`,iconSize:`md`,"aria-label":`Close viewer`,title:`Close viewer (Escape)`,icon:(0,$.jsx)(fn,{}),onClick:b})]})]})]})})}var ux=e=>Re.pipe(ct(Be(1)),ct(rt(e))),dx=Ie.pipe(ct(at()),ct(Xt(Number.isSafeInteger,{message:`Expected a safe integer`}))),fx=dx.pipe(ct(Dt(0))),px=dx.pipe(ct(yt(0))),mx=G({bytes:fx,costMilliunits:px,destination:G({computerId:ux(256),path:ux(4096)}),format:D([`png`,`jpeg`,`gif`,`webp`,`mp4`]),height:fx,model:ux(256),width:fx}),hx=G({operation:Me(`complete-generation`),reference:st,result:mx,derivedFrom:Ge(ux(256)),references:Ge(d(L(ux(256))))}),gx=G({prompt:B,references:Te.pipe(ct(yt(0)))}),_x=G({reference:st,input:Mt,typed:gx,style:Ge(Kn),characters:Ge(d(Mr))});St([G({operation:Me(`remember-generation`),record:_x}),G({operation:Me(`forget-generation`),reference:st}),G({operation:Me(`list-generations`),after:L(Re)})]);function vx(e){return{reference:e.reference,input:It(e.input),typed:e.typed,style:e.style,characters:e.characters}}async function yx(e,t){let n=vx(qe(_x,{onExcessProperty:`error`})(t)),r=vx(qe(_x,{onExcessProperty:`error`})(await e.require(Sn).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 bx(e,t){qe(G({removed:ke}))(await e.require(Sn).request(JSON.stringify({operation:`forget-generation`,reference:t})))}async function xx(e,t=null){let n=qe(G({records:d(_x),next:L(Re)}),{onExcessProperty:`error`})(await e.require(Sn).request(JSON.stringify({operation:`list-generations`,after:t})));return{records:n.records.map(vx),next:n.next}}async function Sx(e,t,n){let r=qe(hx,{onExcessProperty:`error`})({operation:`complete-generation`,reference:t,result:n}),i=qe(G({printId:Re,computerId:Re}))(await e.require(Sn).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 Cx=Tt(G({reference:st}));function wx({connection:e,folder:t,effects:n,styles:r,characters:i}){let a=e?.app??null,o=Kl(a),s=(0,J.useRef)(e);s.current=e;let c=(0,J.useRef)(n);c.current=n;let l=F(),u=Sr.of(a,`prints`,`generation`),d=[...u,`recovery`],f=Fn(Ar(a)),p=f.isError?void 0:f.data,m=p?.models??[],h=a?.capabilities.has(xt)===!0,g=p?.canGenerate??!1,_=f.error?en(f.error).message:p?.models.length===0?`The granted Media model registry is empty.`:null,v=ca({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 xx(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(en(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=ut({mutationKey:[...u,`run`],mutationFn:async e=>{e.controller.signal.throwIfAborted();let t=vx({reference:e.reference,input:e.input,typed:e.typed,style:e.style,characters:e.characters});await yx(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 Sx(e.connection.app.capabilities,t.reference,r),{input:e.input,result:r}},onMutate:e=>{if(!j(e)||e.controller.signal.aborted)return;let t=Xn(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:Yr(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(un(`generate-media`,e),!j(n)||n.controller.signal.aborted)return;t.recheck();let r=zn(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=ut({mutationKey:[...u,`discard`],mutationFn:async e=>{await bx(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(en(e).message)},onSettled:(e,t,n)=>{b.current.get(n.reference.requestId)===n.controller&&b.current.delete(n.reference.requestId)}}),I=sa({filters:{mutationKey:u,status:`pending`},select:e=>De(Cx(e.state.variables))?.reference.requestId}),L=new Set(I.filter(e=>e!==void 0));(0,J.useEffect)(()=>{x.current.clear(),T(null),D(null),C.current=null;let e=Sr.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||Xn(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(sn)||!g)return!1;if(t.path===null)return t.setEditing(!0),!1;C.current=null;let a=Xn(m,n.model);if(a===void 0)return O({kind:`error`,mediaKind:null,message:`Choose a model from the granted registry.`}),!1;let c=rr({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=er({...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=sr(u?.text,c.prompt),_=Wn(f,_n(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:Mn(n,t.path,a)},w=Hn(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,...zn(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:Xn(B.session.models,B.input.settings.model)?.kind??null,...zn(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:L,pendingGenerations:y,recoveryError:E??(v.error?en(v.error).message:null),reportRecoveryError:e=>{k(en(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 Tx({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 Ex(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 Dx=[],Ox=0,{link:kx,unlink:Ax,propagate:jx,checkDirty:Mx,shallowPropagate:Nx}=Tx({update(e){return e._update()},notify(e){Dx[Fx++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,zx(e))}}),Px=0,Fx=0,Ix,Lx=0;function Rx(e){try{++Lx,e()}finally{--Lx||Bx()}}function zx(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ax(n,e)}function Bx(){if(!(Lx>0)){for(;Px<Fx;){let e=Dx[Px];Dx[Px++]=void 0,e.notify()}Px=0,Fx=0}}function Vx(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 Ix!==void 0&&kx(i,Ix,Ox),i._snapshot},subscribe(e){let t=Ex(e),n={current:!1},r=Hx(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Ix,o=t?.compare??Object.is;if(n)Ix=i,++Ox,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{Ix=a,n&&(i.flags&=-5),zx(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Mx(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Nx(e)}}else e&32&&(i.flags=e&-33);return Ix!==void 0&&kx(i,Ix,Ox),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(jx(e),Nx(e),Bx())}},i}function Hx(e){let t=()=>{let t=Ix;Ix=n,++Ox,n.depsTail=void 0,n.flags=6;try{return e()}finally{Ix=t,n.flags&=-5,zx(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&&Mx(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,zx(this)}};return t(),n}var Ux=class{constructor(e,t){this.atom=Vx(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(Ex(e))}},Wx=class{constructor(e){this.atom=Vx(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Ex(e))}};function Gx(e,t){return typeof e==`function`?new Wx(e):t?new Ux(e,t):new Ux(e)}var Kx=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 qx(e,t){return new Kx(e,t).maybeExecute}var Jx=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)}},Yx=new class extends Jx{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function Xx(e,t){return typeof e==`function`?e(t):e}function Zx(e,t){return aS(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function Qx(e,t,n){let r=aS(t);function i(e){if(!r.length)return Xx(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 $x(e,t){let n=aS(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 eS=46,tS=91,nS=93,rS=48,iS=57;function aS(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)===tS),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===eS||s===tS||s===nS){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==rS),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!==nS&&(a!==-1||s!==nS)&&(a!==s||s!==eS&&s!==tS)&&n.push(``);r=o+1,i=!0}else(s<rS||s>iS)&&(i=!1);a=s}return n.length||n.push(``),n}function oS(e){return!(Array.isArray(e)&&e.length===0)}function sS(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 cS(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 lS=e=>!!e&&typeof e==`object`&&`fields`in e;function uS(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)||!uS(e[i],t[i]))return!1;return!0}var dS=({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},fS=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function pS(e,t){return e==null?t:{...e,...t}}for(var mS=256,hS=[],gS;mS--;)hS[mS]=(mS+256).toString(16).substring(1);function _S(){let e=0,t,n=``;if(!gS||mS+16>256){for(gS=Array(256),e=256;e--;)gS[e]=256*Math.random()|0;e=0,mS=0}for(;e<16;e++)t=gS[mS+e],n+=e===6?hS[t&15|64]:e===8?hS[t&63|128]:hS[t],e&1&&e>1&&e<11&&(n+=`-`);return mS++,n}var vS=qx(e=>Yx.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function yS(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]=yS(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,yS(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(yS(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=yS(e[n]));return t}function bS(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var xS=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 SS(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 CS=(e,t)=>{let n=SS(e,t);return{form:n,fields:n}},wS={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:CS(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:CS(r.issues,e)}},TS=e=>!!e&&`~standard`in e,ES={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function DS(e){function t(t){let n=e.getFieldMeta(t)??ES;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=()=>ES;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function OS(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 kS=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{vS(this)}),t=Yx.on(`request-form-state`,e=>{e.payload.id===this._formId&&Yx.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=Yx.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=Yx.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(),Yx.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return Yx.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&&!uS(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!uS(e.defaultState,t.defaultState)&&!this.state.isTouched;if(!(!n&&!r)){if(Rx(()=>{this.baseStore.setState(()=>OS(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=DS(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}Yx.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=Qx(t,e.instance.name,e.instance.options.defaultValue))}),OS({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return Rx(()=>{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 Rx(()=>{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=sS(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||xS}),r=!1,i={};return Rx(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=AS(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=jS(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)??ES,r=a?.[e],{newErrorValue:s,newSource:c}=dS({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=ES)=>({...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=jS(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=jS(`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=cS(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||xS});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=jS(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}=AS(r);s&&(i=i?{...i,...s}:s);let c=jS(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)??ES,r=i?.[e],{newErrorValue:a,newSource:o}=dS({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=ES)=>({...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})),Rx(()=>{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}),Yx.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}),Yx.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}Rx(()=>{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}),Rx(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),Yx.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1})),Yx.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>Zx(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]:Xx(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=ES,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;Rx(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:Qx(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=$x(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),DS(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],pS(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),DS(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),pS(r,{dontValidate:!0})),DS(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),pS(n,{dontValidate:!0})),DS(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 Qx(Qx(e,`${t}`,i),`${n}`,r)},pS(r,{dontValidate:!0})),DS(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},pS(r,{dontValidate:!0})),DS(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,[],pS(t,{dontValidate:!0})),DS(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=Zx(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:ES},values:i===void 0?t.values:Qx(t.values,e,i)}})},this.setErrorMap=e=>{Rx(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(lS(t)){let{formError:e,fieldErrors:r}=AS(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=>wS.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>wS.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??_S(),this._devtoolsSubmissionOverride=!1;let t=OS({...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||!lS(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=Gx(t);let n;this.fieldMetaDerived=Gx(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=Zx(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=!oS(u),f=!o.isDirty,p=uS(l,this.getFieldInfo(a)?.instance?.options.defaultValue??Zx(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=Gx(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||!bS(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&&bS(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=Gx(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&&lS(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&&uS(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 TS(e.validate)?wS[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function AS(e){return e?lS(e)?{formError:AS(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}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`}}var MS=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]:{...ES,isTouched:e.fieldMetaBase[this.name]?.isTouched??ES.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??ES.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??ES.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&&(uS(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,pS(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,pS(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,pS(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,pS(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,pS(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,pS(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,pS(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,pS(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=sS(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||xS}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=sS(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||xS});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;Rx(()=>{let e=(e,n)=>{let r=PS(n.cause),a=n.validate?NS(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}=fS({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=PS(`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=cS(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||xS}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=cS(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||xS});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)));Rx(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=PS(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=NS(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=fS({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)),Rx(()=>{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=>bS(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[PS(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[PS(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=>wS.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>wS.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)bS(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=Gx(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...ES,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!uS(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 TS(e.validate)?wS[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 NS(e){if(e)return e}function PS(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 FS(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function IS(e){return{...ES,...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 LS=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??FS({});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&&(uS(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,{...ES,...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]??FS({...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;zS(t)&&(n=t.group,r=t.fields);let i=RS(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]:FS({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,pS(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 MS&&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&&bS(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}=dS({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=ES)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=sS(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||xS}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=sS(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||xS});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;Rx(()=>{let t=(t,r)=>{let i=VS(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&&zS(s)&&(c=s.group,l=s.fields);let u=RS(c),d=n[i],{newErrorValue:f,newSource:p}=fS({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=VS(`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=cS(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||xS}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=cS(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||xS});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=VS(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&&zS(o)&&(l=o.group,u=o.fields);let d=RS(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=fS({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 Rx(()=>{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=>bS(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[VS(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>bS(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})),Rx(()=>{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}Rx(()=>{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}),Rx(()=>{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=Gx(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??IS(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!uS(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(TS(e.validate)){let t=wS[e.type](e.value,e.validate);return e.type===`validate`?BS(t):t.then(BS)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function RS(e){if(e)return e}function zS(e){return!!e&&typeof e==`object`&&`fields`in e}function BS(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 VS(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 HS(e,t){if(!t)return;let n=Object.assign({},e,{state:yS(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 Rx(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}function US(e,t){return e===t}function WS(e,t=e=>e,n){let r=n?.compare??US,i=(0,J.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,J.useCallback)(()=>e.get(),[e]);return(0,jg.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var GS=typeof window<`u`?J.useLayoutEffect:J.useEffect;function KS(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new MS({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new MS({...e}),i(a),n({form:e.form,name:e.name}));let o=WS(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=WS(a.store,e=>e.meta.isTouched),c=WS(a.store,e=>e.meta.isBlurred),l=WS(a.store,e=>e.meta.isDirty),u=WS(a.store,e=>e.meta.errorMap),d=WS(a.store,e=>e.meta.errorSourceMap),f=WS(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 GS(a.mount,[a]),GS(()=>{a.update(e)}),p}var qS=(({children:e,...t})=>{let n=KS(t),r=(0,J.useMemo)(()=>Xx(e,n),[e,n]);return(0,$.jsx)($.Fragment,{children:r})});function JS(){return(0,J.useState)(()=>_S())[0]}var YS=J,XS=`18.3.1`.split(`.`)[0]===`17`?JS:YS.useId;function ZS(e){let[t,n]=(0,J.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,J.useState)(()=>new LS({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new LS({...e})),n({form:e.form,name:e.name}));let a=WS(r.store,e=>e.value),o=WS(r.store,e=>e.meta.isTouched),s=WS(r.store,e=>e.meta.isBlurred),c=WS(r.store,e=>e.meta.isDirty),l=WS(r.store,e=>e.meta.errorMap),u=WS(r.store,e=>e.meta.errorSourceMap),d=WS(r.store,e=>e.meta.isValidating),f=WS(r.store,e=>e.meta.isSubmitting),p=WS(r.store,e=>e.meta.isSubmitted),m=WS(r.store,e=>e.meta.submissionAttempts),h=WS(r.store,e=>e.meta.isSubmitSuccessful),g=WS(r.store,e=>e.meta.canSubmit),_=WS(r.store,e=>e.meta.isValid),v=WS(r.store,e=>e.meta.isFieldsValid),y=WS(r.store,e=>e.meta.isFieldsValidating),b=WS(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 GS(r.mount,[r]),GS(()=>{r.update(e)}),x}var QS=(({children:e,...t})=>{let n=ZS(t),r=(0,J.useMemo)(()=>Xx(e,n),[e,n]);return(0,$.jsx)($.Fragment,{children:r})});function $S({form:e,selector:t=e=>e,children:n}){let r=WS(e.store,t);return(0,$.jsx)($.Fragment,{children:Xx(n,r)})}function eC(e){let t=XS(),[n,r]=(0,J.useState)(e?.formId),[i,a]=(0,J.useState)(()=>new kS({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new kS({...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)(qS,{...e,form:i})},e.FormGroup=function(e){return(0,$.jsx)(QS,{...e,form:i})},e.Subscribe=function(e){return(0,$.jsx)($S,{form:i,selector:e.selector,children:e.children})},e},[i]);GS(i.mount,[]),GS(()=>{i.update(e)});let s=(0,J.useRef)(!1);return GS(()=>{s.current&&e?.transform&&HS(i,e.transform)},[i,e?.transform]),GS(()=>{s.current=!0}),o}var tC=(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)(tC,{...n,type:`search`,className:t,ref:r})]})});function nC(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 rC=e=>{switch(e){case`success`:return oC;case`info`:return cC;case`warning`:return sC;case`error`:return lC;default:return null}},iC=Array(12).fill(0),aC=({visible:e,className:t})=>J.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},J.createElement(`div`,{className:`sonner-spinner`},iC.map((e,t)=>J.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),oC=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`})),sC=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`})),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-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`})),lC=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`})),uC=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`})),dC=()=>{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},fC=1,pC=100,mC=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:fC++,hC=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-pC;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=mC(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(_C(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=mC(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}},gC=(e,t)=>hC.message(e,t),_C=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,vC=Object.assign(gC,{success:hC.success,info:hC.info,warning:hC.warning,error:hC.error,custom:hC.custom,message:hC.message,promise:hC.promise,dismiss:hC.dismiss,loading:hC.loading},{getHistory:()=>hC.toasts,getToasts:()=>hC.getActiveToasts()});nC(`[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 yC(e){return e.label!==void 0}var bC=3,xC=`24px`,SC=`16px`,CC=4e3,wC=356,TC=14,EC=45,DC=200;function OC(...e){return e.filter(Boolean).join(` `)}function kC(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var AC=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||CC),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||CC,[n.duration,y]),fe=J.useRef(0),G=J.useRef(0),pe=J.useRef(0),me=J.useRef(null),[K,he]=b.split(`-`),ge=J.useMemo(()=>s.reduce((e,t,n)=>n>=le?e:e+t.height,0),[s,le]),_e=dC(),ve=J.useMemo(()=>e.swipeDirections??kC(b),[e.swipeDirections,b]),ye=n.invert||t,be=ie===`loading`;G.current=J.useMemo(()=>le*x+ge,[le,ge]),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)},DC)},[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:OC(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ie===`loading`},w.loading):J.createElement(aC,{className:OC(C?.loader,n?.classNames?.loader),visible:ie===`loading`})}let Ce=n.icon||w?.[ie]||rC(ie);return J.createElement(`li`,{tabIndex:0,ref:W,className:OC(_,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":K,"data-x-position":he,"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)>=EC||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:OC(C?.closeButton,n?.classNames?.closeButton)},w?.close??uC):null,(ie||n.icon||n.promise)&&n.icon!==null&&(w?.[ie]!==null||n.icon)?J.createElement(`div`,{"data-icon":``,className:OC(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:OC(C?.content,n?.classNames?.content)},J.createElement(`div`,{"data-title":``,className:OC(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:OC(v,ce,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),J.isValidElement(n.cancel)?n.cancel:n.cancel&&yC(n.cancel)?J.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{yC(n.cancel)&&oe&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),xe())},className:OC(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,J.isValidElement(n.action)?n.action:n.action&&yC(n.action)?J.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{yC(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&xe())},className:OC(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function jC(){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 MC(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?SC:xC;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 NC=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=bC,toastOptions:g,dir:_=jC(),gap:v=TC,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||hC.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return J.useEffect(()=>hC.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Sh.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`?jC():_,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":`${wC}px`,"--gap":`${v}px`,...m,...MC(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(AC,{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 PC({className:e,...t}){let n=oy(`toast`);return n?(0,Sh.createPortal)((0,$.jsx)(NC,{position:`top-right`,swipeDirections:[`right`,`top`],offset:16,gap:8,className:q(`caps-toaster`,e),...t}),n):null}var FC=(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]})}),IC=(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)})}),LC=(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 RC(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=cr(),[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(!vr(n)){e||l(!1);return}let i=Hr(n),a=`translateY(${String(i.distance)}px)`,c=gr(i,i.ease),d=n.getBoundingClientRect().height,f=RC(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:gr(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 zC=(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=cr(),[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(!vr(e)){d([]);return}let r=f.current,i=e.getBoundingClientRect(),a=Hr(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:gr(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:gr(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:gr(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 BC({children:e,...t}){let[n,r]=(0,J.useState)(e);return e&&e!==n&&r(e),(0,$.jsx)(zC,{...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 VC({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)(BC,{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 HC=(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})})}),UC={2:`h2`,3:`h3`,4:`h4`},WC=(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=UC[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})]})}),GC=(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)(BC,{id:`${u}-error`,children:r})]})});function KC(e){let t=[];return J.Children.forEach(e.props.children,e=>{(0,J.isValidElement)(e)&&e.type!==LC&&t.push(e)}),t[0]??null}var qC=(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===IC,g=h?KC(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)(FC,{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)(BC,{id:y,children:r})]})});function JC(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}var YC=`M 9.86 38.14 A 20 20 0 1 1 38.14 38.14`,XC=6,ZC=new Map([[`ArrowUp`,1],[`ArrowDown`,-1],[`PageUp`,10],[`PageDown`,-10]]),QC=(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=JC(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)/XC),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:YC,pathLength:100}),(0,$.jsx)(`path`,{className:`caps-number-field-dial-level`,d:YC,pathLength:100,strokeDasharray:`${String(Math.max(.5,j*100))} 100`})]}),(0,$.jsx)(jr,{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)(Vb,{"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=ZC.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)(jr,{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)(Hb,{"aria-hidden":`true`})})]})}),$C=(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)(Mb,{className:`caps-select-chevron`,"aria-hidden":`true`}):null]})}),ew={2:`h2`,3:`h3`,4:`h4`};function tw(e,t){let{reduced:n}=t,r=e&&!n,i=ir(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 nw=(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=Jr(p),h=tw(l===`speech`,m)&&!a,g=ew[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)(jr,{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 rw(e,t){return{kind:`button`,id:`folder`,text:t.checking?`Checking…`:`prints`,icon:`folder`,title:e===null?`Choose where Prints saves images`:tt(`Save prints to ${e}`,1024),opens:`dialog`,expanded:t.editing}}function iw(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 aw(e){let t=new Map;for(let n of e.bindings)t.set(n.commandId,[...t.get(n.commandId)??[],iw(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 ow(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 sw(e,t,n,r){return e.map(e=>({entry:e,match:ow(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 cw=[`help`,`login`,`model`];function lw(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:sw(e.filter(e=>e.availability.status===`available`&&(r.length===0?e.category===(n.idleCategory??`Conversation`)||cw.includes(e.alias):e.category!==`Advanced`||e.alias.toLocaleLowerCase().startsWith(r.toLocaleLowerCase()))),e=>e.alias,r,e=>{let t=cw.indexOf(e.alias);return r.length===0&&t>=0?t-cw.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 uw=nu({keyCode:iu(229)});function dw(e){return e.nativeEvent.isComposing||H(uw,e.nativeEvent).success}function fw(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:gr(t,t.easeExit),fill:`backwards`})}function pw(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:gr(t,t.ease),fill:`backwards`})}function mw(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:gr(t,t.ease),fill:`backwards`})}function hw(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:gr(t,`ease-out`)})}var gw=(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||!vr(t))return;let r=t.querySelector(`[data-glyph="arrow"]`),i=t.querySelector(`[data-glyph="busy"]`);if(!r||!i)return;let a=Hr(t),o=[];return e===`busy`?o.push(fw(r,a),mw(i,a,1)):n===`busy`&&o.push(mw(i,a,0),pw(r,a)),n===`empty`&&e===`ready`&&!a.reduced&&o.push(hw(t,a)),()=>{for(let e of o)e.cancel()}},[e]);let p=e===`busy`,m=p&&t!==void 0;return(0,$.jsx)(_t,{...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)(jb,{"aria-hidden":`true`,size:r})}),(0,$.jsx)(`span`,{"data-glyph":`busy`,children:t===void 0?(0,$.jsx)(Lr,{decorative:!0,size:`sm`}):(0,$.jsx)(Wb,{"aria-hidden":`true`,fill:`currentColor`,size:Math.round(r*.7)})})]})})}),_w=(0,J.forwardRef)(function({className:e,label:t,...n},r){return(0,$.jsx)(_t,{...n,ref:r,className:q(`parakeet-composer-model-key`,e),label:t,readout:(0,$.jsx)(Mb,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)] shrink-0`})})}),vw=(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(`div`,{...t,ref:n,className:q(`caps-popover-anchor`,e)})}),yw=(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}),bw=(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 xw({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)(vw,{...u,ref:f,className:q(`caps-status-tray`,l),"data-placement":o,"data-align":s,children:[h?(0,$.jsxs)(yw,{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)(Ob,{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)(or,{"aria-label":`Close tray`,icon:(0,$.jsx)(fn,{"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)(Ob,{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 Sw({children:e,className:t,...n}){return(0,$.jsx)(`div`,{...n,className:q(`caps-status-tray-list`,t),children:e})}function Cw({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 ww({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 Tw=(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 Ew(e,t){return`${e}-${String(t)}`}function Dw(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 Ow(e){return{role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":e.open,"aria-controls":e.open?e.listId:void 0,"aria-activedescendant":e.open?Ew(e.listId,e.selected):void 0}}function kw({open:e,rows:t,selected:n,listId:r,label:i,kind:a,hint:o,empty:s,onHighlight:c,onChoose:l}){return(0,$.jsx)(yw,{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)(bw,{id:Ew(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 Aw={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`},jw={blurStdDeviation:.22,alphaSlope:18,alphaIntercept:-8};function Mw({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=cr();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=Hr(n.current),c=Fr(s,{ease:`inCubic`,duration:160}),l=Zr(n.current,{d:{to:Aw[e],...o?kr:Fr(s,{ease:`outCubic`,duration:200})},"stroke-dashoffset":{to:+!t,...o?kr:t?Fr(s,{ease:`inOutSine`,duration:260}):c},"stroke-width":o?{to:t?2.4:0,duration:0}:t&&!r?[{to:2.2,...Fr(s,{ease:`outCubic`,duration:65})},{to:2.4,delay:ir(s,120),...br(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)(mr,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,$.jsx)(dr,{id:`${t}-shadow`}),(0,$.jsx)(Br,{id:`${t}-inset`}),(0,$.jsx)(Tr,{id:`${t}-goo`,values:jw}),(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:Aw[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 Nw=(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)(Mw,{state:m}):n]})}),Pw=`data-glide-stand-in`;function Fw(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 Iw(e){return{transform:`translate(${String(e.x)}px, ${String(e.y)}px)`,width:`${String(e.width)}px`,height:`${String(e.height)}px`}}function Lw(e){let t=(0,J.useRef)(null);return(0,J.useCallback)(n=>{t.current?.(),t.current=n?Rw(n,e):null},[e])}function Rw(e,t){if(!vr(e))return()=>void 0;let n=e.ownerDocument,r=e.querySelector(t),i=r?Fw(e,r):null,a=null,o=null,s=new Set,c=()=>{for(let e of s)e.removeAttribute(Pw);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=Hr(e),u=Fw(e,t),d=o&&a?Fw(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(Pw,`measure`);let f=getComputedStyle(t),p=f.backgroundColor,m=f.borderRadius;for(let e of[t,n])e&&(e.setAttribute(Pw,``),s.add(e));let h=l();h.hidden=!1,h.style.backgroundColor=p,h.style.borderRadius=m;let g=h.animate([Iw(d),Iw(u)],{duration:r.normal,easing:gr(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 zw({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 Bw({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 Vw=qn(`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`}}),Hw=(0,J.forwardRef)(function({className:e,density:t,featured:n=!1,state:r,variant:i,...a},o){return(0,$.jsx)(`div`,{...a,className:q(Vw({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)(Hw,{...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 Uw=(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 Ww({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 Gw({attachments:e,action:t,children:n,className:r,input:i,menu:a,row:o,...s}){return(0,$.jsxs)(vw,{className:`parakeet-composer-anchor`,children:[a,(0,$.jsxs)(Hw,{...s,className:q(`parakeet-composer-shell`,r),children:[(0,$.jsx)(Uw,{action:t,attachments:e,input:i,toolbar:o===void 0?void 0:(0,$.jsx)(xw,{className:`parakeet-composer-row`,align:`start`,items:o.items,openId:o.openId,onOpenChange:o.onOpenChange,renderTrigger:({children:e,...t})=>(0,$.jsx)(_t,{...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 Kw(e,t){(0,J.useLayoutEffect)(()=>{let t=e.current;t&&(t.style.height=`auto`,t.style.height=`${String(t.scrollHeight)}px`)},[e,t])}var qw=J.createContext(void 0);function Jw(e){let t=J.useContext(qw);if(t===void 0&&!e)throw Error(ku(33));return t}var Yw=J.createContext(void 0);function Xw(e){let t=J.useContext(Yw);if(t===void 0&&!e)throw Error(ku(36));return t}var Zw=J.createContext(void 0);function Qw(e=!0){let t=J.useContext(Zw);if(t===void 0&&!e)throw Error(ku(25));return t}var $w=J.createContext(null);function eT(e=`root`){let t=J.useContext($w),n=J.useContext(Yw);return t===null||n===void 0?null:(e===`submenu-trigger`?n.virtualFocus||n.parentVirtualFocus:n.virtualFocus)?t:null}var tT={visible:!0,ref:null};function nT(){return tT}function rT(e,t,n=`root`){let r=eT(n),i=((n===`submenu-trigger`?r?.useSubmenuTrigger:r?.useItem)??nT)({label:e.label,children:e.children,render:e.render}),a=Pu(t,i.ref);return{visible:i.visible,ref:a,props:i.props}}var iT=J.createContext(void 0);function aT(){let e=J.useContext(iT);if(e===void 0)throw Error(ku(30));return e}function oT(e){e.preventDefault()}function sT(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,l=Xw(),u=Qw(!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?oT: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:kf})},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&&!op&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!g||e.button===2)&&c.type===`regular-item`&&vf(s.current,e,{detail:1,pointerType:`mouse`})}}),[t,_,r,m,i,a.context.allowMouseUpTriggerRef,o,s,u,g,c.type,p,f])}var cT={type:`regular-item`};function lT(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}=yf({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=sT({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=J.useCallback(e=>Zu(p,{onMouseEnter(e){c.type===`submenu-trigger`&&c.setActive(e.nativeEvent)}},e,d),[p,d,c]),h=Pu(u,f);return J.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var uT=J.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function dT(){return J.useContext(uT)}function fT(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=dT(),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 pT=`data-checked`,mT=`data-unchecked`,hT={checked(e){return e?{[pT]:``}:{[mT]:``}},...xd},gT=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}=Xw(),m=fT({guess:!0,label:a}),h=Gf(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}=lT({closeOnClick:c,disabled:b,highlighted:_,id:h,store:p,nativeButton:o,nodeId:v,itemMetadata:cT}),C=J.useMemo(()=>({disabled:b,highlighted:_,checked:l}),[b,_,l]);function w(e){let t=Sf(kf,e.nativeEvent,void 0,{preventUnmountOnClose:Wu});u?.(!l,t)}let T=ud(`div`,e,{state:C,stateAttributesMapping:hT,props:[y,{role:`menuitemcheckbox`,"aria-checked":l,onClick:w},f,x],ref:[S,t,m.ref]});return(0,$.jsx)(iT.Provider,{value:C,children:T})}),_T=J.forwardRef(function(e,t){let{checked:n,defaultChecked:r,onCheckedChange:i,...a}=e,[o,s]=Bw({controlled:n,default:r??!1,name:`MenuCheckboxItem`,state:`checked`}),c=rT(e,t);function l(e,t){i?.(e,t),t.isCanceled||s(e)}return c.visible?(0,$.jsx)(gT,{...a,checked:o,onCheckedChange:l,ref:c.ref}):null}),vT=J.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=aT(),c=J.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Qh(s.checked);return rg({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),ud(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},ref:[t,c],stateAttributesMapping:hT,props:{"aria-hidden":!0,...o},enabled:a||u})}),yT=J.createContext(void 0);function bT(){let e=J.useContext(yT);if(e===void 0)throw Error(ku(31));return e}var xT=J.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=Gf(a),c=bT();return Z(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),ud(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),ST=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}=Xw(),f=fT({guess:!0,label:a}),p=Gf(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}=lT({closeOnClick:c,disabled:v,highlighted:h,id:p,store:d,nativeButton:o,nodeId:g,itemMetadata:cT});return ud(`div`,e,{state:{disabled:v,highlighted:h},props:[_,u,y],ref:[b,t,f.ref]})}),CT=J.forwardRef(function(e,t){let n=rT(e,t);return n.visible?(0,$.jsx)(ST,{...e,ref:n.ref}):null}),wT=J.createContext(void 0);function TT(e){let t=J.useContext(wT);if(t===void 0&&!e)throw Error(ku(69));return t}function ET(e){return e===`starting`?_h:Ku}var DT=J.createContext(void 0);function OT(){return J.useContext(DT)}function kT(e,t){let n=md(e.render);if(J.isValidElement(n)){let e=n.props;if(Object.hasOwn(e,`id`))return e.id??``}return e.id??t}function AT(e,t,n){let r=kT(e,t),i=r===t?void 0:r;return[r,J.useCallback(e=>n?.(e?i:void 0),[i,n])]}function jT(e,t,n){let r=md(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 MT=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}=Xw(),m=OT(),{side:h,align:g}=Jw(),_=TT(!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]=AT(e,u,d),L=jT(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),rg({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}}),J.useEffect(()=>{function e(e){l.setOpen(!1,Sf(e.reason,e.domEvent))}return O.events.on(`close`,e),()=>{O.events.off(`close`,e)}},[O.events,l]),n_(D,{enabled:A&&!j&&!z&&w.type!==`menubar`,closeDelay:k});let V=l.useStateSetter(`popupElement`),{parentVirtualFocusRef:H,handleFocus:ee}=(J.useContext($w)?.useParentHandoff??PT)(l,w,v,f),te=ud(`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:Fd,props:[b,{id:F,...P?{role:`presentation`}:{role:`menu`,"aria-orientation":p===`horizontal`?`horizontal`:void 0,"aria-labelledby":L},onKeyDown(e){R?.onPopupKeyDown?.(e),_&&Ev.has(e.key)&&e.stopPropagation()},onFocus:ee},ET(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)(Kh,{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})}),NT={parentVirtualFocusRef:void 0,handleFocus:void 0};function PT(){return NT}var FT=J.forwardRef(function(e,t){let n=eT()?.Popup??MT;return(0,$.jsx)(n,{...e,ref:t})}),IT=J.createContext(void 0);function LT(){let e=J.useContext(IT);if(e===void 0)throw Error(ku(32));return e}var RT=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=Xw();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,$.jsx)(IT.Provider,{value:n,children:(0,$.jsx)(Dh,{ref:t,...r,portalOwnerRole:o})})});function zT(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=Nh(n),p=J.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),m=vv({...e,elements:{...p,...l&&{reference:l}}}),h=J.useCallback(e=>{let t=Hd(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 BT=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}=im(e,t)||{};if(l==null)return{};let d=Sm(u),f={x:n,y:r},p=um(i),m=cm(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=rm(D,k,O),j=!c.arrow&&om(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}}}),VT=(e,t)=>{let{name:n,fn:r}=BT(e);return{name:n,fn:r,options:[e,t]}},HT={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}}}},UT={sideX:`left`,sideY:`top`},WT=`--available-width`,GT=`--available-height`,KT=`--anchor-width`,qT=`--anchor-height`,JT=`--transform-origin`,YT=WT,XT=GT;function ZT(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 QT(e,t,n){let{rects:r,placement:i}=e;return{side:ZT(t,am(i),n),align:om(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function $T(e){return eE(e,zT)}function eE(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=Hp(n),M=Hp(g),N=Xy()===`rtl`,[P,F]=J.useState(null);!g&&P!==null&&F(null);let I=x===`placement`,L=P?am(P):null,R=P&&I?om(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=Hp(a),ae=Hp(s),oe=typeof a==`function`?0:a,se=typeof s==`function`?0:s,ce=[];p&&ce.push(p),ce.push(yv(e=>{let t=QT(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:Sv({...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:bv({...ne,rootBoundary:D,mainAxis:w!==`none`,crossAxis:ue,limiter:u||E?void 0:xv(e=>{if(!re.current)return{};let{width:t,height:n}=re.current.getBoundingClientRect(),r=lm(am(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(Cv({...ne,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(YT,`${t}px`),i.setProperty(XT,`${n}px`);let a=zd(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(KT,`${u}px`),i.setProperty(qT,`${d}px`)}}),VT(e=>({element:re.current||_f(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=am(r),u=om(r),d=lm(l)===`y`,f=re.current,p=typeof a==`function`?a(QT(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(JT,d?`${m} ${h}`:`${h} ${m}`),{}}},HT,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:K,y:he,middlewareData:ge,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)=>ov(...e,G),nodeId:y,externalTree:S}),{sideX:Se,sideY:Ce}=ge.adaptiveOrigin||UT,we=be?r:`fixed`,Te=J.useMemo(()=>{let e;return e=be?b?{position:we,[Se]:K,[Ce]:he}:{...xe,position:we}:{position:we,top:0,left:0},e[YT]=`100vw`,e[XT]=`100vh`,be||(e.opacity=0),e},[b,we,Se,K,Ce,he,xe,be]),Ee=J.useRef(null);Z(()=>{if(!g)return;let e=j.current,t=typeof e==`function`?e():e,n=(tE(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`&&tE(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 ov(me.reference,me.floating,_e,G)},[m,g,me,_e,G]);let De=am(ve),Oe=ZT(i,De,N),ke=om(ve)||`center`,Ae=!!ge.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:ge.arrow?.y,left:ge.arrow?.x}),[ge.arrow]),Me=ge.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 tE(e){return e!=null&&`current`in e}function nE(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=X(i),[,o]=J.useState(0),s=Nu(iE).current,c=Nu(rE).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(!sE(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&cE(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=oE(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=X(()=>{let[e,t]=aE(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)(uT.Provider,{value:b,children:t})}function rE(){return new Map}function iE(){return new Set}function aE(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)=>cE(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 oE(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function sE(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 cE(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function lE(e){let{store:t,domReference:n,positionerElement:r,open:i}=e,a=J.useRef(null),o=J.useRef(null),s=ng(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 uE(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),ud(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},ET(r),i],stateAttributesMapping:Pd})}var dE=20;function fE(e,t,n,r){let[i,a]=J.useState(!1);Z(()=>{if(!e||!t||n==null){a(!1);return}let r=_f(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-dE)},[e,t,n]),Wv(e&&(!t||i),r)}var pE=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=yh,style:g,..._}=e,{store:v,virtualFocus:y,syncHighlightedItem:b}=Xw(),x=LT(),S=Qw(!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??bh):C.type===`menubar`&&(te??=C.context.orientation===`vertical`?`inline-end`:`bottom`,U??=`start`);let W=C.type===`context-menu`,ne=$T({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,Sf(Lf)))}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,Sf(t))}return T.events.on(`menuopenchange`,e),()=>{T.events.off(`menuopenchange`,e)}},[T.events,v]);let re=Xf();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,Sf(Lf))}):v.setOpen(!1,Sf(Lf))}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]),lE({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;fE(D&&(ae||O&&F!==`trigger-hover`),k===`touch`,M,A);let oe=uE(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)(qw.Provider,{value:ne,children:[se&&(0,$.jsx)(Mv,{ref:C.type===`context-menu`||C.type===`nested-context-menu`?C.context.internalBackdropRef:null,inert:jv(!D),cutout:ce}),(0,$.jsx)(Fh,{id:I,children:(0,$.jsx)(nE,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,onMapChange:b,children:oe})})]})}),mE=J.createContext(null);function hE(e){let t=J.useContext(mE);if(t===null&&!e)throw Error(ku(5));return t}function gE(e){return e==null?wf:e.type.startsWith(`key`)?Pf:e.type.startsWith(`mouse`)||e.type.startsWith(`pointer`)?Ff:wf}var _E={...qg,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=qg.triggerPopupId(e,t);return n?e.listElement?.id||n:void 0},filterTriggerProps:e=>e.filterTriggerProps,inputProps:e=>e.inputProps,webkitAriaSelected:(e,t)=>cp&&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`&&!qg.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`)}},vE=class extends Rg{constructor(e,t,n=!1){let r=new vg,i=bE(r,t,n,e);super(i,yE(r),_E),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 yE(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 bE(e,t,n=!1,r){return{...Vg(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:Ku,inputProps:Ku,inputFocused:!1,highlightedItem:void 0,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new kh,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Ku,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var xE=J.createContext(null);function SE(e,t){return(e===`trigger-press`||e===`item-press`)&&t?.detail===0}function CE(e,t){return e===`list-navigation`||SE(e,t)}var wE=Dg(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=Qw(!0),C=Xw(!0),w=hE(!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=Gf(),k=Gf(),[A,j]=J.useState(void 0),M=(A??k)||void 0,N=Mh(),P=D.type===`menu`?D.store:void 0,F=(n??o)&&P?.state.transitionStatus===`starting`,I=Nu(()=>F?P?.state.instantType:void 0).current,L=Nu(()=>{let e=new vE({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=Ph(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=Xf(),le=J.useRef(!0),ue=Xf(),de=ae!=null,{openMethod:fe,triggerProps:G}=ny(B);L.useSyncedValues({disabled:s,highlightItemOnHover:g,modal:W.type===void 0?c:void 0,openMethod:fe,rootId:O}),mg(L);let{forceUnmount:pe,transitionStatus:me}=hg(B,L,()=>{L.set(`allowMouseEnter`,!1)},F),K=ng(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 K(e,t.signal),()=>{t.abort()}},[I,B,me,K,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 he=X((e,t)=>{let n=t.reason;if(!e&&!L.select(`open`)||B===e&&t.trigger===V&&U===n)return;let i=fg(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=dg(L.state,e,t.trigger,i());s.openChangeReason=n,s.keyboardOpen=e&&CE(n,a),s.instantType=W.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:SE(n,a)?`click`:o?`dismiss`:void 0,L.update(s)}),ge=Zh({popupStore:L,floatingRootContext:L.state.floatingRootContext,floatingId:M,nested:N!=null,onOpenChange:he}),_e=ge.context.events;Z(()=>{let e=({open:e,eventDetails:t})=>he(e,t);return _e.on(`setOpen`,e),()=>{_e?.off(`setOpen`,e)}},[_e,he]),Z(()=>L.subscribeToParentMenu(),[L]);let ve=J.useCallback(()=>{L.setOpen(!1,Sf(Rf))},[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:he}),[he]);let be=Xh(ge,{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=Xy(),Se=d_(ge,{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:Gu,onNavigate(e,t){L.setActiveIndex(e,gE(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=f_(ge,{enabled:!te&&!v,listRef:L.context.itemLabels,elementsRef:L.context.itemDomElements,activeIndex:ne,resetMs:500,onMatch:(e,t)=>{B&&e!==ne&&L.setActiveIndex(e,Pf,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=wf,L.context.highlightEvent=void 0,a&&Te(t,Cf(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 Ku;let{onFocus:e,...t}=Se.trigger;return t},[v,Se.reference,Se.trigger]);L.useSyncedValue(`inputProps`,v?Se.reference??Ku:Ku);let ke=J.useMemo(()=>{let e=Zu(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=Zu(Se.trigger,be.trigger,G);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[Se.trigger,be.trigger,G]);Nu(()=>(L.update({inactiveTriggerProps:Ae}),null)),gg(L,{floatingRootContext:ge,activeTriggerProps:ke,inactiveTriggerProps:Ae,popupProps:J.useMemo(()=>Zu(ag,{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??Ku});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)(Yw.Provider,{value:je,children:[p&&(0,$.jsx)(cg,{handle:p,store:L}),Me]});return(W.type===void 0||W.type===`context-menu`)&&(Ne=(0,$.jsx)(Ih,{externalTree:R,children:Ne})),Ne});function TE(e){let t=J.useContext(xE);if(t===null)return(0,$.jsx)(wE,{...e});let n=t.Root;return(0,$.jsx)(xE.Provider,{value:null,children:(0,$.jsx)(n,{...t.options,...e})})}var EE=5;function DE(e,t){let n=OE(t);return e.clientX>=n.left-EE&&e.clientX<=n.right+EE&&e.clientY>=n.top-EE&&e.clientY<=n.bottom+EE}function OE(e){let t=e.getBoundingClientRect(),n=zd(e);if(up)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 kE(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=hf(),{ref:i,index:a}=fT(e),o=n===a,s=J.useRef(null),c=Pu(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 AE(e){let{render:t,className:n,style:r,state:i=Ku,props:a=Gu,refs:o=Gu,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=kE({metadata:s});return ud(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function jE(e){if(Ud(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!tf(e))return jE(af(e))}function ME(e,t){function n(n,r,i){let a=n.currentTarget;Sh.flushSync(()=>{e.setOpen(!1,Sf(jf,n.nativeEvent,a))}),Zm(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&&Qm(t,r)?e.context.beforeContentFocusGuardRef.current?.focus():n(t,1,r)}return{handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function NE(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,_f(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Ku,[t,n,r])}var PE=Og(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=Xw(!0),h=Jg(d)??m?.store;if(!h)throw Error(ku(85));let g=Gf(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerControlsId`,g),x=J.useRef(null),S=IE(),C=hf(!0),w=Nh(),T=J.useMemo(()=>w??new kh,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=pg(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:Ph(T),floatingParentNodeId:Mh(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=yf({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=Xf(),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||jE(t)!==h.select(`rootId`))&&(DE(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:If}))});J.useEffect(()=>{let e=_f(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=i_(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:b_({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=FE(y,h.select(`lastOpenChangeReason`)),z=qh(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),B=Xg(v,{enabled:!A&&I}),V=NE({open:y,enabled:O,mouseDownAction:`open`}),H=J.useMemo(()=>Zu(B.reference,z.reference),[B.reference,z.reference]),ee=h.useState(`triggerProps`,D),te=h.useState(`filterTriggerProps`),{handlePreFocusGuardFocus:U,handleFocusTargetFocus:W}=ME(h,x),ne={disabled:A,open:y},re=[N,t,M,E,x],ie=[H,L??Ku,ee,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),_f(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},te,O?{role:`menuitem`}:{},V,p,j],ae=ud(`button`,e,{enabled:!O,stateAttributesMapping:Nd,state:ne,ref:re,props:ie});return O?(0,$.jsx)(AE,{tag:`button`,render:n,className:r,style:i,state:ne,refs:re,props:ie,stateAttributesMapping:Nd}):y?(0,$.jsxs)(J.Fragment,{children:[(0,$.jsx)(Xp,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:U},`${g}-pre-focus-guard`),(0,$.jsx)(J.Fragment,{children:ae},g),(0,$.jsx)(Xp,{ref:h.context.triggerFocusTargetRef,onFocus:W},`${g}-post-focus-guard`)]}):(0,$.jsx)(J.Fragment,{children:ae},g)});function FE(e,t){let n=Xf(),[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 IE(){let e=hE(!0);return J.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var LE=J.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return ud(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),RE=(0,J.createContext)(null);function zE({actionsRef:e,children:t,interactionOwner:n=`local`,onOpenChange:r,...i}){let a=(0,J.useRef)(null),o=e??a;return sy(()=>o.current?.close()),(0,$.jsx)(RE.Provider,{value:{actionsRef:o,interactionOwner:n},children:(0,$.jsx)(TE,{...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 BE(){let e=(0,J.useContext)(RE);if(!e)throw Error(`DropdownMenu parts must be used inside <DropdownMenu>`);return e}var VE=(0,J.forwardRef)(function({className:e,render:t,type:n=`button`,...r},i){return(0,$.jsx)(PE,{...r,className:t=>q(`btn caps-dropdown-trigger`,Ye(e,t)),ref:i,render:t,type:n})}),HE=(0,J.forwardRef)(function({container:e,...t},n){let r=oy(`popover`);return e==null&&r===null?null:(0,$.jsx)(RT,{...t,container:e??r,ref:n})}),UE=(0,J.forwardRef)(function({collisionBoundary:e,...t},n){let r=oy(`popover`);return(0,$.jsx)(pE,{...t,collisionBoundary:e??(r&&r!==document.body?r:void 0),ref:n})}),WE=(0,J.forwardRef)(function({className:e,finalFocus:t,...n},r){let{interactionOwner:i}=BE(),a=(0,J.useRef)(null);(0,J.useImperativeHandle)(r,()=>a.current);let o=Lw(`.caps-dropdown-item[data-highlighted]`),s=(0,J.useCallback)(e=>{a.current=e,o(e)},[o]);return(0,$.jsx)(FT,{...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`,Ye(e,t)),finalFocus:i===`host`?!1:t??!0,ref:s})}),GE=(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)(HE,{container:r,keepMounted:i,children:(0,$.jsx)(UE,{align:e,alignOffset:t,side:a,sideOffset:o,children:(0,$.jsx)(WE,{...s,ref:c,children:n})})})}),KE=`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)(CT,{...i,className:t=>q(KE,r===`destructive`&&`text-error hover:bg-error hover:text-error-content focus-visible:bg-error focus-visible:text-error-content`,Ye(e,t)),onClick:e=>{t?.(e),e.defaultPrevented||n?.(e)},ref:a})});var qE=(0,J.forwardRef)(function({children:e,className:t,onClick:n,onSelect:r,...i},a){return(0,$.jsxs)(_T,{...i,className:e=>q(KE,Ye(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)(vT,{"aria-hidden":`true`,className:`shrink-0`,children:`✓`})]})});(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(LE,{...t,className:t=>q(`my-xs h-px bg-base-300`,Ye(e,t)),ref:n})}),(0,J.forwardRef)(function({className:e,...t},n){return(0,$.jsx)(xT,{...t,className:t=>q(`px-md pb-xs pt-sm text-xs font-semibold text-base-content/60`,Ye(e,t)),ref:n})});function JE({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)(zE,{children:[(0,$.jsx)(VE,{"aria-label":`Generation model`,"data-generation-model":i,disabled:e||n.length===0,render:(e,n)=>(0,$.jsx)(_w,{...e,expanded:n.open,label:a===void 0?t:En(a)})}),(0,$.jsx)(GE,{"data-generation-model-menu":!0,container:o,side:`top`,align:`start`,"aria-label":`Generation models`,children:n.map(e=>(0,$.jsx)(qE,{"data-generation-model-option":e.id,checked:e.id===i,closeOnClick:!0,onSelect:()=>{r(e.id)},children:En(e)},e.id))})]})})}function YE(e){let t=Kl(e),n=(0,J.useRef)(e);n.current=e;let r=F(),i=Fn(ar(e)),a=ca(Jb(e,i.data?.configured?i.data.path:null)),[o,s]=(0,J.useState)(null),c=n=>n?.app===e&&n.computerId===t,l=ut({mutationKey:wr.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(sn).mkdir({path:r}),a(),await ln(e.capabilities,{path:r,limit:1,offset:0}),a(),yn(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:qb.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(!Xe(Vn)(i))return`Enter an absolute Computer folder, such as /media.`;try{return await l.mutateAsync({owner:e,id:t,path:i,create:r,queryKey:wr.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(Sn)===!0,writable:e?.capabilities.has(sn)===!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:qb.listing(e,i.data?.path??null),exact:!0}),r.invalidateQueries({queryKey:wr.folder(e),exact:!0})}}}var XE=Tt(Re),ZE=Tt(G({message:Re}));function QE(e){for(let t of e.errors){let e=k(z(je(ZE(t),e=>e.message),()=>XE(t)));if(e!==void 0&&e.length>0)return e}}var $E={neutral:`progress-neutral`,primary:`progress-primary`,secondary:`progress-secondary`,accent:`progress-accent`,success:`progress-success`,info:`progress-info`,warning:`progress-warning`,error:`progress-error`},eD=(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`,$E[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)(eD,{"aria-label":e,value:t,max:n,tone:r})]})});function tD({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)(iD,{item:e,onCancel:n,onRemove:r,onRetry:i,...a===void 0?{}:{rowClassName:a}},e.id))}):null}function nD({action:e,id:t,onAction:n,retry:r=!1}){return e?(0,$.jsx)(or,{"aria-label":e.accessibleLabel,title:e.label,variant:`ghost`,size:`xs`,className:`motion-reduce:transition-none`,icon:r?(0,$.jsx)(fr,{}):(0,$.jsx)(fn,{}),onClick:()=>void n(t),type:`button`}):null}function rD({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 iD({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)(Ib,{className:`size-4`})}),(0,$.jsx)(rD,{item:e}),(0,$.jsx)(aD,{actions:e.actions,id:e.id,onCancel:t,onRemove:n,onRetry:r}),(0,$.jsx)(eD,{"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 aD({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)(nD,{action:e.retry,id:t,onAction:i,retry:!0}),(0,$.jsx)(nD,{action:e.cancel,id:t,onAction:n}),(0,$.jsx)(nD,{action:e.remove,id:t,onAction:r})]})}var oD=J.createContext(void 0);function sD(e){let t=J.useContext(oD);if(t===void 0&&!e)throw Error(ku(47));return t}var cD={...qg,disabled:e=>e.disabled,instantType:e=>e.instantType===`trigger-change`&&!qg.open(e)?void 0:e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,isPressOpenedByTrigger:(e,t)=>e.openChangeReason===`trigger-press`&&qg.isOpenedByTrigger(e,t),isTouchPressOpen:(e,t)=>t&&e.openMethod===`touch`&&e.openChangeReason===`trigger-press`,hasTriggerFocusGuards:(e,t)=>qg.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},lD=class extends Rg{constructor(e,t,n){let r=new vg;super(uD(e,r,t,n),dD(r),cD)}setOpen=(e,t)=>{let n=t.reason===Ef,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=fg(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=dg(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}),Sh.flushSync(s)):s();let c;r?c=`click`:i?c=`dismiss`:t.reason===`focus-out`&&(c=`focus`),this.set(`instantType`,c)}};function uD(e,t,n,r=!1){let i={...Vg(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 dD(e){return{popupRef:J.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:J.createRef(),beforeTriggerFocusGuardRef:J.createRef(),beforeContentFocusGuardRef:J.createRef(),stickIfOpenTimeout:new Yf,stickIfOpen:!0,triggerElements:e}}var fD=Dg(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=mD(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),_g(u,d),mg(u);let{forceUnmount:m}=hg(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,Sf(Rf))}),[m,u]);let h=d||f||s!=null;return(0,$.jsxs)(oD.Provider,{value:u,children:[s&&(0,$.jsx)(cg,{handle:s,store:u}),h&&(0,$.jsx)(hD,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})});function pD(e){return sD(!0)?(0,$.jsx)(fD,{props:e}):(0,$.jsx)(Ih,{children:(0,$.jsx)(fD,{props:e})})}function mD(e,t){let n=sg((e,n)=>new lD(t,e,n));return J.useEffect(()=>n.context.stickIfOpenTimeout.disposeEffect(),[n]),n}function hD({store:e,modal:t}){let n=Xh(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),r=n.reference,i=n.floating;return gg(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:i}),null}var gD=Og(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=sD(!0),h=Jg(s)??m;if(!h)throw Error(ku(74));let g=Gf(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}=pg(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=i_(v,{enabled:!a&&l&&!T,mouseOnly:!0,move:!1,handleClose:b_(),restMs:u,delay:{close:d},triggerElementRef:x,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),O=qh(v,{stickIfOpen:X(()=>h.context.stickIfOpen)}),k=ty(()=>h.select(`open`),e=>{h.set(`openMethod`,e)}),A=h.useState(`triggerProps`,C),{getButtonProps:j,buttonRef:M}=yf({disabled:a,native:o}),N={open(e){return w?Nd.open(e):Md.open(e)}},{handlePreFocusGuardFocus:P,handleFocusTargetFocus:F}=ME(h,x),I=ud(`button`,e,{state:{disabled:a,open:y},ref:[M,t,S,x],props:[O.reference,D,A,k,{[vh]:``,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)(Xp,{ref:h.context.beforeTriggerFocusGuardRef,onFocus:P}),L,(0,$.jsx)(Xp,{ref:h.context.triggerFocusTargetRef,onFocus:F})]}):L}),_D=J.createContext(void 0);function vD(){let e=J.useContext(_D);if(e===void 0)throw Error(ku(45));return e}var yD=J.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return sD().useState(`mounted`)||n?(0,$.jsx)(_D.Provider,{value:n,children:(0,$.jsx)(Dh,{ref:t,...r})}):null}),bD=J.createContext(void 0);function xD(){let e=J.useContext(bD);if(!e)throw Error(ku(46));return e}var SD=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=bh,..._}=e,v=sD(),y=vD(),b=Ph(),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=$T({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`)});lE({store:v,domReference:x.useState(`domReferenceElement`),positionerElement:O,open:C});let M=E===!0&&w!==`trigger-hover`;fE(C&&M,D===`touch`,O,T);let N=v.useStateSetter(`positionerElement`),P=uE(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)(bD.Provider,{value:j,children:[S&&M&&(0,$.jsx)(Mv,{inert:jv(!C),cutout:T}),(0,$.jsx)(Fh,{id:b,children:P})]})}),CD=J.createContext(void 0);function wD(){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 TD=J.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=sD(),l=xD(),u=TT(!0)!=null,{context:d,hasClosePart:f}=wD(),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`);rg({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}}),n_(w,{enabled:D&&!E,closeDelay:O});let k=a===void 0?og(c.context.popupRef):a,A=b!==!1&&f;c.useSyncedValue(`focusManagerModal`,A);let j=c.useStateSetter(`popupElement`),M=ud(`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`,...ag,"aria-labelledby":v,"aria-describedby":y,onKeyDown(e){u&&Ev.has(e.key)&&e.stopPropagation()}},ET(g),s],stateAttributesMapping:Fd});return(0,$.jsx)(Kh,{context:w,openInteractionType:m,modal:A,disabled:!x||S===`trigger-hover`,initialFocus:k,returnFocus:o,restoreFocus:`popup`,getInsideElements:()=>[c.context.beforeTriggerFocusGuardRef.current],previousFocusableElement:Ud(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,$.jsx)(CD.Provider,{value:d,children:M})})}),ED=(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)(Mb,{className:`caps-select-chevron`,"aria-hidden":`true`})]})});function DD({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=zw({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(dw(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 OD(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}=DD({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});sy(()=>{O&&oe(!1)});let se=oy(`popover`),ce=s===void 0?se:s,le=Lw(`.caps-combobox-option[data-active="true"]:not(:disabled), [data-navigation="pointer"] .caps-combobox-option:hover:not(:disabled)`),ue=(0,$.jsx)(tC,{..._,...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)(Rr,{}):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)(pD,{modal:!0,onOpenChange:oe,open:re,children:[(0,$.jsx)(gD,{...L,"aria-haspopup":`dialog`,className:`btn`,ref:k,render:O}),ce===null?null:(0,$.jsx)(yD,{container:ce,children:(0,$.jsx)(SD,{align:`start`,side:`bottom`,sideOffset:4,children:(0,$.jsxs)(TD,{"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 kD({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 AD=(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)(Nw,{...a,appearance:r??`default`,"aria-label":e,className:q(`caps-icon-choice-input`,i),indicator:(0,$.jsx)(kD,{icon:t,caption:n}),ref:o})})}),jD=(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)(Nw,{...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 MD({className:e,...t}){return(0,$.jsx)(`div`,{...t,className:q(`caps-check-keys`,e)})}function ND({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=Jr(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=Fr(o,{ease:`outCubic`,duration:75}),c=e?br(o,{bounce:.65,duration:300}):Fr(o,{ease:`inCubic`,duration:100}),l=Zr(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)(mr,{id:`${t}-surface`,transform:`matrix(1 0 0 1 6 6)`}),(0,$.jsx)(dr,{id:`${t}-shadow`}),(0,$.jsx)(Br,{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 PD=(0,J.createContext)(null),FD=(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)(PD.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})})}),ID=(0,J.forwardRef)(function({className:e,indicator:t,onChange:n,onClick:r,value:i,...a},o){let s=(0,J.useContext)(PD);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)(ND,{checked:c}):t]})}),LD=(0,J.forwardRef)(function({description:e,id:t,meta:n,title:r,...i},a){let o=(0,J.useContext)(PD),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)(ID,{...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]})}),RD=(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)(ID,{...a,"aria-label":e,className:q(`caps-icon-choice-input`,i),indicator:(0,$.jsx)(kD,{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)(ID,{...r,"aria-label":e,className:q(`caps-icon-choice-input`,n),indicator:(0,$.jsx)(kD,{icon:(0,$.jsx)(`span`,{className:`caps-swatch-dot`,style:{backgroundColor:t}})}),ref:i})})});var zD=Tt(Re),BD=Tt(ke),VD=Tt(L(j)),HD=Tt(d(Re)),UD=d(zt(File)),WD=Tt(UD),GD=St([Re,j,ke,jt,$e,d(Re),UD]),KD=Tt(GD),qD=e=>l(zD(e.state.value),()=>``),JD=e=>l(BD(e.state.value),()=>!1),YD=e=>l(VD(e.state.value),()=>null),XD=e=>l(HD(e.state.value),()=>[]),ZD=e=>l(WD(e.state.value),()=>[]),QD=e=>l(KD(e.state.value),()=>null);function $D({field:e,spec:t,locked:n,...r}){let[i,a]=(0,J.useState)(!1);return(0,$.jsxs)(IC,{children:[(0,$.jsx)(tC,{...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:qD(e),onBlur:e.handleBlur,onChange:t=>{e.handleChange(t.currentTarget.value)}}),(0,$.jsx)(jr,{type:`button`,variant:`outline`,size:`icon`,"aria-label":i?`Hide`:`Show`,"aria-pressed":i,disabled:n,onClick:()=>{a(e=>!e)},children:i?(0,$.jsx)(Pb,{"aria-hidden":`true`}):(0,$.jsx)(Fb,{"aria-hidden":`true`})})]})}var eO={text:`text`,email:`email`,url:`url`,tel:`tel`};function tO({spec:e,field:t,locked:n,...r}){let i=ZD(t),a=n||e.readOnly===!0,o=(0,J.useRef)(null);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,$.jsx)(Dr,{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)(jr,{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)(tD,{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 nO({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)(tC,{...a,type:eO[e.kind],inputMode:e.kind===`text`?void 0:e.kind,autoComplete:e.autoComplete,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:qD(t),onChange:e=>{i(e.currentTarget.value)}});case`textarea`:return(0,$.jsx)(Tw,{...a,rows:e.rows??3,placeholder:e.placeholder,maxLength:e.maxLength,readOnly:e.readOnly,value:qD(t),onChange:e=>{i(e.currentTarget.value)}});case`secret`:return(0,$.jsx)($D,{...r,field:t,spec:e,locked:n});case`money`:return(0,$.jsxs)(IC,{children:[(0,$.jsx)(LC,{className:`caps-field-currency`,children:e.currency??`USD`}),(0,$.jsx)(tC,{...a,inputMode:`decimal`,autoComplete:`off`,className:`caps-field-amount`,placeholder:e.placeholder??`0.00`,readOnly:e.readOnly,value:qD(t),onChange:e=>{i(e.currentTarget.value)}})]});case`date`:return(0,$.jsx)(tC,{...a,type:`date`,readOnly:e.readOnly,value:qD(t),onChange:e=>{i(e.currentTarget.value)}});case`number`:return(0,$.jsx)(QC,{...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:YD(t),onValueChange:e=>{t.handleChange(e)}});case`select`:return(0,$.jsxs)($C,{...a,value:qD(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)(OD,{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:qD(t),...e.placeholder===void 0?{}:{placeholder:e.placeholder},trigger:(0,$.jsx)(ED,{name:e.name,disabled:n||e.readOnly===!0,onBlur:t.handleBlur,children:e.options.find(e=>e.value===qD(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)(tO,{...r,spec:e,field:t,locked:n});case`checkbox`:return(0,$.jsx)(Nw,{...a,disabled:n||e.readOnly===!0,checked:JD(t),onChange:e=>{t.handleChange(e.currentTarget.checked)}});case`switch`:return(0,$.jsx)(yr,{...a,disabled:n||e.readOnly===!0,checked:JD(t),onCheckedChange:e=>{t.handleChange(e)}});case`radio`:case`icon-radio`:case`checkboxes`:case`icon-checkboxes`:return null}}var rO=new Set([`radio`,`icon-radio`,`checkboxes`,`icon-checkboxes`]);function iO({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=XD(t),s=(e,r)=>{t.handleChange(r?[...n,e]:n.filter(t=>t!==e))};return(0,$.jsx)(GC,{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)(AD,{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)(MD,{children:e.options.map(r=>(0,$.jsx)(jD,{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)(GC,{legend:o,icon:e.icon,layout:i,...i===`columns`?{legendTitle:o}:{},description:e.help,disabled:a,error:r??null,children:(0,$.jsx)(FD,{name:e.name,"aria-label":o,value:qD(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)(RD,{value:t.value,label:t.label,...t.caption===void 0?{}:{caption:t.caption},icon:t.icon,disabled:t.disabled},t.value):s?(0,$.jsx)(LD,{value:t.value,title:t.label,description:t.description,meta:t.meta,disabled:t.disabled},t.value):(0,$.jsx)(qC,{label:t.label,orientation:`inline`,children:(0,$.jsx)(ID,{value:t.value,disabled:t.disabled})},t.value))})})}function aO({spec:e,field:t,locked:n,error:r,render:i,...a}){return i({name:e.name,label:e.label,help:e.help,value:QD(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 oO({form:e,spec:t,locked:n,layout:r}){let i=KS({form:e,name:t.name}),a=WS(e.store,e=>e.submissionAttempts>0),o=i.state.meta.isBlurred||a?QE(i.state.meta):void 0;if(t.render===void 0&&rO.has(t.kind))return(0,$.jsx)(iO,{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)(qC,{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)(nO,{spec:t,field:i,locked:n}):(0,$.jsx)(aO,{spec:t,field:i,locked:n,error:o,render:t.render})})}var sO=Tt(Pe(Re,GD));function cO({form:e,spec:t,locked:n,layout:r}){let i=t.when;return WS(e.store,e=>i===void 0||i(l(sO(e.values),()=>({}))))?(0,$.jsx)(oO,{form:e,spec:t,locked:n,layout:r}):null}function lO({form:e,section:t,locked:n,layout:r}){let i=t.fields.map(t=>(0,$.jsx)(cO,{form:e,spec:t,locked:n,layout:r},t.name));return t.title===void 0?i:(0,$.jsx)(WC,{title:t.title,description:t.description,layout:r,children:i})}function uO({model:e,names:t,disabled:n=!1,layout:r}){let i=e.form;return t===void 0?e.description.sections.map(e=>(0,$.jsx)(lO,{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)(cO,{form:i,spec:a,locked:n,layout:r},t)})}var dO=class{annotation;constructor(e){this.annotation=e}},fO=class{sections;constructor(e){this.sections=e}},pO=`caps/form`,mO=0;function hO(e){mO+=1;let t={[`${pO}:${String(mO)}`]:new dO(e)};return e.label!==void 0&&(t.title=e.label),e.help!==void 0&&(t.description=e.help),t}Re.annotate(hO({kind:`secret`})).pipe(Nt(`Secret`));var gO=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 _O(e){return Object.values(e??{}).reduce((e,t)=>t instanceof dO?{...e,...t.annotation}:e,{})}function vO(e){return e.reduce((e,t)=>({...e,..._O(t)}),{})}function yO(e){let t=e?.[pO];return t instanceof fO?t.sections:{}}var bO=Tt(Re);function xO(e){if(y(e))return E(bO(e.literal),{onNone:()=>null,onSome:e=>[e]});if(!U(e))return null;let t=[];for(let n of e.types){if(ft(n))continue;let e=xO(n);if(e===null)return null;t.push(...e)}return t}function SO(e){if(o(e))return{type:`string`,literals:[]};if(oe(e))return{type:`number`,nullable:!1};if(ye(e))return{type:`boolean`};let t=xO(e);if(t!==null)return{type:`string`,literals:t};if(Wt(e)){let[t]=e.rest;if(t===void 0)return null;if(o(t))return{type:`strings`,literals:[]};let n=xO(t);return n===null?null:{type:`strings`,literals:n}}if(U(e)){let t=e.types.filter(e=>!ft(e)&&!g(e)),n=e.types.some(e=>g(e)),[r]=t;if(t.length!==1||r===void 0)return null;let i=SO(r);return i?.type===`number`?{type:`number`,nullable:n}:n?null:i}return null}function CO(e){let t=e.ast;if(!ht(t))throw Error(`A schema form needs a Schema.Struct.`);return{fields:t.propertySignatures.map(e=>{let t=String(e.name),n=N(e.type),r=vO([e.type.annotations,...(e.type.checks??[]).map(e=>e.annotations)]),i=r.kind===`file`?{type:`files`}:SO(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:S(e.type),description:ue(e.type)}}),sections:yO(re(t))}}function wO(e){let t=e,n=!1,r=!1;for(;;)if(t instanceof bt)n=!0,t=t.unwrap();else if(t instanceof Ze)r=!0,t=t.unwrap();else if(t instanceof Je)t=t.unwrap();else if(t instanceof ot)t=t.in;else return{node:t,optional:n,nullable:r}}function TO(e){if(e instanceof Ht){let t=e.options.map(e=>TO(e));return t.some(e=>e===null)?null:t.flatMap(e=>e??[])}let t=e instanceof vt?e.options:e instanceof Bt?[...e.values]:null;if(t===null)return null;let n=t.map(e=>bO(e));return n.every(Ce)?n.map(e=>e.value):null}function EO(e){let{node:t,nullable:n}=wO(e);if(t instanceof it)return{type:`string`,literals:[]};if(t instanceof nt)return{type:`number`,nullable:n};if(t instanceof Lt)return{type:`boolean`};let r=TO(t);if(r!==null)return{type:`string`,literals:r};if(t instanceof Et){let e=wO(t.element).node;if(e instanceof it)return{type:`strings`,literals:[]};let n=TO(e);return n===null?null:{type:`strings`,literals:n}}return null}function DO(e){let t=[e];for(;;){let e=t[t.length-1];if(e===void 0)break;let n=e instanceof bt||e instanceof Ze||e instanceof Je?e.unwrap():e instanceof ot?e.in:e;if(n===e)break;t.push(n)}return t.reverse().map(e=>pt.get(e))}function OO(e){return DO(e).reduce((e,t)=>({...e,...t}),{})}function kO(e){return Object.entries(e.shape)}function AO(e){let t=wO(e).node;if(!(t instanceof Ot))throw Error(`A schema form needs a z.object.`);return{fields:kO(t).map(([e,t])=>{let n=vO(DO(t)),r=n.kind===`file`?{type:`files`}:EO(t);if(r===null)throw Error(`Schema field "${e}" has no form control. Annotate it with field({ render }) or a kind.`);let i=OO(t);return{name:e,valueType:r,optional:wO(t).optional,annotation:n,title:i.title,description:i.description}}),sections:yO(OO(e))}}function jO(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??gO(e),description:r.description,meta:r.meta,icon:r.icon,caption:r.caption,disabled:r.disabled===!0}})}function MO(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 NO(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 PO(e){let t=e instanceof Ve?AO(e):CO(e),n=t.fields.map((e,t)=>{let{kind:n,...r}=e.annotation,i=jO(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??gO(e.name),help:a,kind:n??MO(e.valueType,i),options:i,optionalInSchema:e.optional,index:t}}),r={};t.fields.forEach((e,t)=>{let i=n[t];i&&(r[e.name]=NO(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 FO(e){let t=e instanceof Ve?e:p(e);return{"~standard":{...t[`~standard`],validate:e=>{let n=t[`~standard`].validate(e);return n instanceof Promise?n.then(e=>IO(e)):IO(n)}}}}function IO(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 LO=`onServer`;function RO(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 zO(e){return e.state.meta.errorMap.onServer!==void 0}function BO(e){e.setMeta(e=>({...e,errorMap:{...e.errorMap,[LO]:void 0}}))}function VO(e,t,n){e.setFieldMeta(t,e=>({...e,isBlurred:!0,errorMap:{...e.errorMap,[LO]:n}}))}function HO(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);uS(a,e.defaultValues)||(o(e.defaultValues),c(null));let{schema:l}=e,u=(0,J.useMemo)(()=>PO(l),[l]),d=(0,J.useMemo)(()=>FO(l),[l]),f=eC({defaultValues:s??a,validators:{onChange:d,onSubmit:d},listeners:{onChange:({fieldApi:e})=>{n(null),i(null),zO(e)&&BO(e)}},onSubmit:async({value:t,formApi:r})=>{n(null),i(null);let a=await FO(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&&VO(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 UO(e){return{dirty:WS(e.form.store,e=>!e.isDefaultValue),submitting:WS(e.form.store,e=>e.isSubmitting),canSubmit:WS(e.form.store,e=>e.canSubmit)}}function WO({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}=UO(e),f=(0,J.useRef)(null);return(0,$.jsxs)(HC,{...u,ref:f,layout:o,busy:d,noValidate:!0,onSubmit:t=>{t.preventDefault(),e.form.state.isSubmitting||e.submit().then(()=>{setTimeout(()=>{RO(f.current)},0)})},children:[c??(0,$.jsx)(uO,{model:e,disabled:l,layout:o}),s===void 0?(0,$.jsx)(qO,{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 GO({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i,...a}){let o=HO({schema:e,defaultValues:t,onSubmit:n,onSaved:r,failure:i});return(0,$.jsx)(WO,{...a,model:o})}function KO(e){return`model`in e?(0,$.jsx)(WO,{...e}):(0,$.jsx)(GO,{...e})}function qO({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}=UO(e),d=u?null:e.saved&&!l?(0,$.jsx)(Ob,{tone:`success`,size:`compact`,label:e.saved}):l?(0,$.jsx)(Ob,{tone:`neutral`,size:`compact`,label:o}):null;return(0,$.jsxs)(VC,{...c,error:e.error,status:d,children:[r?(0,$.jsx)(jr,{type:`button`,variant:`ghost`,disabled:u,onClick:r,children:i}):n&&l?(0,$.jsx)(jr,{type:`button`,variant:`ghost`,disabled:u,onClick:e.discard,children:n}):null,(0,$.jsx)(jr,{...s,type:`submit`,loading:u,disabled:u||!l&&!a,title:!l&&!a?`No changes to save`:void 0,children:t})]})}var JO={error:0,warning:1,info:2};function YO(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)||JO[e.tone]-JO[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 XO(e,t,n){let r=YO(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:tt(`Activity: ${r.label}`,1024),opens:`dialog`,expanded:n};return r.tone===void 0?i:{...i,tone:r.tone}}var ZO={Setup:(0,$.jsx)(Ub,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),Images:(0,$.jsx)(Rb,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),Uploads:(0,$.jsx)(Gb,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`})};function QO({notices:e,uploads:t,open:n,inset:r,onOpenChange:i,onDismiss:a,onDismissAll:o,onLoadMore:s}){return(0,$.jsx)(xw,{className:`prints-activity-tray`,placement:`host`,align:`start`,...r===void 0?{}:{hostInset:r},items:[{id:`activity`,label:`Activity`,title:`Activity`,content:(0,$.jsx)($O,{notices:e,uploads:t,onDismiss:a,onDismissAll:o,onLoadMore:s})}],openId:n?`activity`:null,onOpenChange:e=>{i(e===`activity`)}})}function $O({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)(Or,{level:3,children:e}),(0,$.jsx)(Sw,{children:t.map(e=>(0,$.jsx)(Cw,{icon:ZO[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)(jr,{variant:`ghost`,size:`xs`,onClick:e.run,children:e.label},e.label)),e.blocking?null:(0,$.jsx)(or,{"aria-label":`Dismiss ${e.title}`,icon:(0,$.jsx)(fn,{"aria-hidden":`true`}),onClick:()=>{n(e.key)}})]})},e.key))})]},e)),e.length?null:(0,$.jsx)(ww,{children:`All caught up.`}),t&&t.items.length>0?(0,$.jsxs)(`section`,{"aria-label":`Upload queue`,className:`prints-upload-bank`,children:[(0,$.jsx)(Or,{level:3,children:`Uploading`}),(0,$.jsx)(tD,{...t})]}):null,(0,$.jsxs)(`div`,{className:`prints-panel-footer`,children:[(0,$.jsx)(`span`,{className:`prints-footer-note`,children:`Clear keeps setup notices`}),(0,$.jsx)(jr,{variant:`ghost`,size:`xs`,disabled:!e.some(e=>!e.blocking),onClick:r,children:`Clear`}),i?(0,$.jsx)(jr,{variant:`ghost`,size:`xs`,onClick:i,children:`Load more activity`}):null]})]})}function ek({folder:e}){return(0,$.jsx)(ly,{open:e.editing,onOpenChange:e.setEditing,children:(0,$.jsxs)(my,{children:[(0,$.jsx)(gy,{children:(0,$.jsx)(_y,{children:`Save prints to`})}),(0,$.jsx)(nk,{folder:e},e.computerId),(0,$.jsx)(hy,{children:(0,$.jsx)(vy,{render:(0,$.jsx)(jr,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var tk=G({path:i.check(Xt(Xe(Vn),{message:`Enter an absolute Computer folder, such as /media.`})).annotate(hO({label:`Folder`,placeholder:`/media`}))});function nk({folder:e}){let t=(0,J.useRef)(!1),n=HO({schema:tk,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)(KO,{model:n,disabled:i,footer:(0,$.jsxs)(VC,{divider:!1,children:[(0,$.jsx)(_t,{className:`[--caps-keycap-width:auto]`,label:`Use`,type:`submit`,disabled:i,onClick:()=>{r(!1)}}),(0,$.jsx)(_t,{className:`[--caps-keycap-width:auto]`,label:`Create`,type:`submit`,disabled:i,onClick:()=>{r(!0)}})]})}),e.error?(0,$.jsx)(Cw,{role:`alert`,icon:(0,$.jsx)(Lb,{"aria-hidden":`true`,className:`size-[var(--stipe-icon-size-sm)]`}),primary:e.error}):(0,$.jsx)(ww,{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 rk({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=en(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 ${Xn(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 ik(e,t){let n=Fn(Ir(e)),r=ut(mn({queryKey:wr.dismissals(e),mutationFn:({owner:e,id:t,keys:n})=>xn(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 ak=0,ok=1,sk=2,ck=0,lk=1;function uk(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 dk(e,t){let n=e.list;if(n.index===t)return n.next===null?ck:(e.list=n.next,lk);let r=n;for(n=n.next;n!==null;){if(n.index===t)return r.next=n.next,lk;r=n,n=n.next}}var fk={low:0,max:0,high:0,C:sk,P:void 0,R:void 0,L:void 0,list:void 0};fk.P=fk,fk.L=fk,fk.R=fk;function pk(e){let t=e.high;e.max=e.L===fk&&e.R===fk?t:e.L===fk?Math.max(e.R.max,t):e.R===fk?Math.max(e.L.max,t):Math.max(Math.max(e.L.max,e.R.max),t)}function mk(e){let t=e;for(;t.P!==fk;)pk(t.P),t=t.P}function hk(e,t){if(t.R===fk)return;let n=t.R;t.R=n.L,n.L!==fk&&(n.L.P=t),n.P=t.P,t.P===fk?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.L=t,t.P=n,pk(t),pk(n)}function gk(e,t){if(t.L===fk)return;let n=t.L;t.L=n.R,n.R!==fk&&(n.R.P=t),n.P=t.P,t.P===fk?e.root=n:t===t.P.R?t.P.R=n:t.P.L=n,n.R=t,t.P=n,pk(t),pk(n)}function _k(e,t,n){t.P===fk?e.root=n:t===t.P.L?t.P.L=n:t.P.R=n,n.P=t.P}function vk(e,t){let n;for(;t!==fk&&t.C===ok;)t===t.P.L?(n=t.P.R,n.C===ak&&(n.C=ok,t.P.C=ak,hk(e,t.P),n=t.P.R),n.L.C===ok&&n.R.C===ok?(n.C=ak,t=t.P):(n.R.C===ok&&(n.L.C=ok,n.C=ak,gk(e,n),n=t.P.R),n.C=t.P.C,t.P.C=ok,n.R.C=ok,hk(e,t.P),t=e.root)):(n=t.P.L,n.C===ak&&(n.C=ok,t.P.C=ak,gk(e,t.P),n=t.P.L),n.R.C===ok&&n.L.C===ok?(n.C=ak,t=t.P):(n.L.C===ok&&(n.R.C=ok,n.C=ak,hk(e,n),n=t.P.L),n.C=t.P.C,t.P.C=ok,n.L.C=ok,gk(e,t.P),t=e.root));t.C=ok}function yk(e){for(;e.L!==fk;)e=e.L;return e}function bk(e,t){let n;for(;t.P.C===ak;)t.P===t.P.P.L?(n=t.P.P.R,n.C===ak?(t.P.C=ok,n.C=ok,t.P.P.C=ak,t=t.P.P):(t===t.P.R&&(t=t.P,hk(e,t)),t.P.C=ok,t.P.P.C=ak,gk(e,t.P.P))):(n=t.P.P.L,n.C===ak?(t.P.C=ok,n.C=ok,t.P.P.C=ak,t=t.P.P):(t===t.P.L&&(t=t.P,gk(e,t)),t.P.C=ok,t.P.P.C=ak,hk(e,t.P.P)));e.root.C=ok}function xk(){let e={root:fk,size:0},t={};return{insert(n,r,i){let a=e.root,o=fk;for(;a!==fk&&(o=a,n!==o.low);)a=n<a.low?a.L:a.R;if(n===o.low&&o!==fk){if(!uk(o,r,i))return;o.high=Math.max(o.high,r),pk(o),mk(o),t[i]=o,e.size++;return}let s={low:n,high:r,max:r,C:ak,P:o,L:fk,R:fk,list:{index:i,high:r,next:null}};o===fk?e.root=s:(s.low<o.low?o.L=s:o.R=s,mk(s)),bk(e,s),t[i]=s,e.size++},remove(n){let r=t[n];if(r===void 0)return;delete t[n];let i=dk(r,n);if(i===void 0)return;if(i===lk){r.high=r.list.high,pk(r),mk(r),e.size--;return}let a=r,o=a.C,s;r.L===fk?(s=r.R,_k(e,r,r.R)):r.R===fk?(s=r.L,_k(e,r,r.L)):(a=yk(r.R),o=a.C,s=a.R,a.P===r?s.P=a:(_k(e,a,a.R),a.R=r.R,a.R.P=a),_k(e,r,a),a.L=r.L,a.L.P=a,a.C=r.C),pk(s),mk(s),o===ok&&vk(e,s),e.size--},search(t,n,r){let i=[e.root];for(;i.length!==0;){let e=i.pop();if(!(e===fk||t>e.max)&&(e.L!==fk&&i.push(e.L),e.R!==fk&&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 Sk=e=>{let t=J.useRef(e);return J.useEffect(()=>{t.current=e}),t},Ck=(e,t)=>{let n=t||wk,r,i;return function(){return r&&n(arguments,r)?i:i=e.apply(null,r=arguments)}},wk=(e,t)=>e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3],Tk=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}}},Ek=e=>{try{return new e}catch{let e={};return{set(t,n){e[t]=n},get(t){return e[t]}}}},Dk=e=>{let t=e.length,n=Ek(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=Ek(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=Ek(e[a+1]),o.set(r[a],i),o=i):o=i;return o.set(r[t-1],s),s}}},Ok=(e,t)=>{let n,{g:r,s:i}=Dk(e);return function(){return(n=r(arguments))===void 0?i(arguments,t.apply(null,arguments)):n}},kk=new WeakMap;function Ak(){let e=J.useState(jk)[1];return J.useRef(()=>e({})).current}var jk={},Mk=J.createElement;function Nk(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=zk,overscanBy:h=2,scrollTop:g,isScrolling:_,height:v,render:y,onRender:b}=e,x=0,S,C=Ak(),w=Vk(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=Sk(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(Mk(d,{key:a,ref:w(e),role:F,style:typeof f==`object`&&f?Object.assign({},o,f):o},Fk(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=Bk(E);for(;t<M+e;t++){let e=r[t],i=m(e,t);P.push(Mk(d,{key:i,ref:w(t),role:F,style:typeof f==`object`?Object.assign({},n,f):n},Fk(y,t,e,E)))}}J.useEffect(()=>{typeof I.current==`function`&&S!==void 0&&I.current(x,S,r),Pk=`1`},[x,S,r,I]),J.useEffect(()=>{R&&C()},[R,t]);let z=Ik(_,k(T,p));return Mk(i,{ref:u,key:Pk,id:a,role:c,className:o,tabIndex:l,style:typeof s==`object`?Rk(z,s):z,children:P})}var Pk=`0`,Fk=Ok([Tk,{},WeakMap,Tk],(e,t,n,r)=>Mk(e,{index:t,data:n,width:r})),Ik=Ck((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})),Lk=(e,t)=>e[0]===t[0]&&e[1]===t[1],Rk=Ck((e,t)=>Object.assign({},e,t),Lk);function zk(e,t){return t}var Bk=Ck(e=>({width:e,zIndex:-1e3,visibility:`hidden`,position:`absolute`,writingMode:`horizontal-tb`}),(e,t)=>e[0]===t[0]),Vk=Ck((e,t)=>n=>r=>{r!==null&&(t&&(t.observe(r),kk.set(r,n)),e.get(n)===void 0&&e.set(n,r.offsetHeight))},Lk),Hk=function(e,t,n,r){n===void 0&&(n=0),r===void 0&&(r=n);let i=xk(),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=Uk(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}}},Uk=(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},Wk=0,Gk=320,Kk=656;function qk(e,t){return e<=0||!Number.isFinite(t)||t<=0?0:e===1?1:e<=4?2:t>=1280?4:t>=Kk?3:2}function Jk({item:e}){return cn(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 Yk=(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 nr(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)(by,{"data-media-pending":e.pending?`true`:void 0,failure:e.error?(0,$.jsx)(`span`,{title:e.error,className:`prints-tile-failed`,children:(0,$.jsx)(Ob,{size:`compact`,appearance:`chip`,glyph:`bang`,tone:`error`,label:`Not saved`})}):void 0,indicator:(0,$.jsx)(Lr,{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)(Jk,{item:e})}):(0,$.jsx)(Jk,{item:e})})}),e.error?(0,$.jsxs)(`div`,{className:`prints-gallery-pending-actions`,children:[e.onRetry?(0,$.jsx)(or,{"aria-label":`Retry ${e.path}`,icon:(0,$.jsx)(fr,{}),onClick:e.onRetry}):null,e.onDismiss?(0,$.jsx)(or,{"aria-label":`Dismiss ${e.path}`,icon:(0,$.jsx)(fn,{}),onClick:e.onDismiss}):null]}):null,(0,$.jsxs)(`div`,{className:`prints-gallery-tools`,children:[!e.pending&&e.onInfo?(0,$.jsx)(or,{"aria-label":`Image info: ${e.path}`,title:`Image info (I)`,"aria-keyshortcuts":`I`,onClick:e.onInfo,icon:(0,$.jsx)(zb,{})}):null,!e.pending&&e.onToggleReference?(0,$.jsx)(or,{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)(Rr,{}):(0,$.jsx)(Rb,{})}):null]})]})}),Xk=(0,J.memo)(function({children:e,style:t,...n}){return(0,$.jsx)(`div`,{"data-media-grid":!0,...n,style:t,children:e})});function Zk(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 Qk(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 $k(e,t){let n=Math.max(1,qk(e.length,t));return(0,J.useMemo)(()=>{let r=Math.floor((t-(n-1)*Wk)/n),i=Hk(n,r,Wk);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 eA=(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)(Yk,{item:e})})});function tA(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 nA(e,t,n){let r=e.ownerDocument;(r.activeElement!==r.body||tA(e,t))&&n()}function rA(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 iA=(0,J.memo)(function({items:e,scrollRef:t,focus:n}){let r=Zk(t,e.length),i=r.width||Gk,a=$k(e,i),{isScrolling:o,scrollTop:s}=Qk(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=rA(s,f,d);if(o){nA(s,n.key,()=>{u.current=i});return}tA(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)(eA,{data:e,width:t}),[]);return Nk({as:Xk,height:r.height,isScrolling:o,itemKey:e=>e.key,items:e,overscanBy:2,positioner:a,render:d,scrollTop:s})});function aA({items:e,scrollRef:t,focus:n}){return(0,$.jsx)(`section`,{"data-media-mosaic":!0,children:(0,$.jsx)(iA,{items:e,scrollRef:t,focus:n})})}function oA(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 sA=`prints-prompt-counter`;function cA({busy:e,disabled:t,draft:n,label:r,onGenerate:i,promptOver:a}){return(0,$.jsx)(gw,{"aria-describedby":a?sA:void 0,"aria-label":r,className:`prints-generate`,"data-generation-submit":!0,disabled:t||a,onClick:i,state:Ww({draft:n,busy:e}),title:r})}function lA({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]),Kw(_,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)(Tw,{"aria-invalid":A?!0:void 0,"aria-label":`Image prompt`,className:`w-full`,"data-generation-prompt":!0,...Ow(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(dw(e))return;let t=Dw(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:sA,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 uA({index:e,listId:t,matches:n,onHighlight:r,onPick:i}){return(0,$.jsx)(kw,{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 dA(e,t){let[n,r]=(0,J.useState)(0),i=t.startsWith(`/`),a=(0,J.useMemo)(()=>{if(!i)return[];let n=lw(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 fA({images:e,index:t,listId:n,matches:r,onHighlight:i,onPick:a}){return(0,$.jsx)(kw,{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 pA(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:hr(t,n),d=u?qr(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 mA(e){let t=F(),n=Fn(zr(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(wr.characters(e),n)}}),i=ut(r((e,t,n)=>Vr(e.capabilities,t,n))),a=ut(r((e,t,n)=>Er(e.capabilities,t,n))),o=i.error??a.error??n.error;return{characters:n.data?.characters??[],error:o?en(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 hA=Xe(Mr),gA=e=>e.split(`/`).at(-1)??e;function _A({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:gA(e)}):null},e)})})}function vA({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.`):hA(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)(ly,{open:n,onOpenChange:e=>{e||d(null),r(e)},children:(0,$.jsxs)(my,{children:[(0,$.jsx)(gy,{children:(0,$.jsx)(_y,{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)(_A,{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)(jr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{d(e)},children:`Edit`}),(0,$.jsx)(jr,{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)(jr,{size:`xs`,type:`button`,onClick:()=>{d({name:``,description:``,references:[]})},children:`New character`}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-sm`,children:[(0,$.jsx)(tC,{"aria-label":`Character name`,"aria-invalid":!hA(m),"aria-describedby":_,maxLength:33,placeholder:`Name, typed as @name`,value:u.name,onChange:e=>{d({...u,name:e.currentTarget.value})}}),(0,$.jsx)(Tw,{"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)(jr,{size:`xs`,variant:`ghost`,type:`button`,disabled:!o,onClick:s,children:[(0,$.jsx)(Gb,{"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)(Nw,{"aria-label":`Use ${gA(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)(jr,{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)(jr,{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)(hy,{children:(0,$.jsx)(vy,{render:(0,$.jsx)(jr,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var yA=G({destination:qt(L(Re)),height:qt(Te),model:qt(Re),prompt:qt(Re),references:qt(d(G({computerId:qt(Re),path:Re,role:qt(D([`first-frame`,`last-frame`,`reference`]))}))),generateAudio:qt(L(ke)),steps:qt(L(Te)),style:qt(L(Re)),width:qt(Te)}),bA=_(gt(),m()).parse(structuredClone(ge(yA,{onExcessProperty:`error`}).schema)),xA=(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`}}}),SA=xA(`inspect-generation-draft`,`Inspect image draft`,`Read the current Prints image form and available models`),CA=xA(`set-generation-draft`,`Edit image draft`,`Set selected Prints image form fields; this does not generate an image`,bA),wA=xA(`submit-generation-draft`,`Generate image`,`Submit the current Prints image form using the same action as the Send button`);function TA(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(SA,()=>{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(CA,({arguments:e})=>{if(n)return;let r=qe(yA,{onExcessProperty:`error`})(e);t.setDraft(r)}),i(wA,async()=>{if(!n)return{accepted:await t.submit()}}),()=>{if(!n){n=!0;for(let e of r)e();r.clear()}}}function EA(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()}},...xr.map((t,n)=>({id:`size-${t}`,title:`Use ${t} size`,category:`Prompt`,description:`Use ${String(Pn[t].width)} × ${String(Pn[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 DA(e,t){let n=(0,J.useRef)(e);n.current=e;let r=Jl(t,{sourceId:`media-prompt`,namespace:`media`},(0,J.useCallback)(()=>EA(()=>n.current),[])),i=(0,J.useSyncExternalStore)(r.subscribe,r.snapshot,r.snapshot);return{items:(0,J.useMemo)(()=>aw(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 OA(e){let t=F(),n=Fn(ur(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(wr.styles(e),n)}}),i=ut(r((e,t,n)=>Ur(e.capabilities,t,n))),a=ut(r((e,t,n)=>Gr(e.capabilities,t,n))),o=i.error??a.error??n.error;return{styles:n.data?.styles??[],error:o?en(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 kA(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 AA(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 jA(e,t){let{lineage:n,printPath:r,models:i,current:a}=t,o=e===`animate`?kA(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=Xn(i,n.model),c=o??s??Xn(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 ${En(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=>!hn(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=Cn(a,c),h={width:n.width??m.width,height:n.height??m.height},g=o===void 0?tr(h,c,void 0):AA(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 MA({id:e,styles:t,selected:n,disabled:r,onSelect:i}){let a=n===void 0||t.some(e=>e.name===n);return(0,$.jsxs)($C,{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 NA({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)(ly,{open:n,onOpenChange:r,children:(0,$.jsxs)(my,{children:[(0,$.jsx)(gy,{children:(0,$.jsx)(_y,{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)(jr,{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)(jr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{u(e)},children:`Edit`}),(0,$.jsx)(jr,{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)(jr,{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)(jr,{size:`xs`,type:`button`,onClick:()=>{u({name:``,text:``})},children:`New style`}):(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(tC,{"aria-label":`Style name`,maxLength:64,value:l.name,onChange:e=>{u({...l,name:e.currentTarget.value})}}),(0,$.jsx)(Tw,{"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)(jr,{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)(jr,{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)(hy,{children:(0,$.jsx)(vy,{render:(0,$.jsx)(jr,{variant:`outline`,size:`sm`}),children:`Close`})})]})})}var PA=(0,J.lazy)(async()=>({default:(await nr(()=>import(`./print-info-drawer-BJccZZSi.js`),__vite__mapDeps([5,1,2,6,4]),import.meta.url)).PrintInfoDrawer})),FA=[`a mushroom knight`,`moss on a keyboard`,`your Agent's selfie`];function IA(e){vC.error(e,{id:`prints-generation-error`,toasterId:`prints-generation-notices`})}function LA(e){let t=(0,J.useRef)(!1),n=eC({defaultValues:In(),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 RA({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)(qC,{label:`Style`,orientation:`horizontal`,children:n}),(0,$.jsx)(qC,{label:`Size`,orientation:`horizontal`,children:(0,$.jsx)($C,{"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)(qC,{label:`Width`,children:(0,$.jsx)(tC,{"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)(qC,{label:`Height`,children:(0,$.jsx)(tC,{"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)(qC,{label:`Length`,orientation:`horizontal`,children:(0,$.jsx)($C,{"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)(qC,{label:`Audio`,orientation:`horizontal`,children:(0,$.jsxs)($C,{"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)(qC,{label:`Audio`,orientation:`horizontal`,children:(0,$.jsx)(yr,{"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)(qC,{label:`Steps`,optional:!0,orientation:`horizontal`,children:(0,$.jsx)(tC,{"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)(jr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{o()},children:`Edit styles…`}),(0,$.jsx)(jr,{size:`xs`,variant:`ghost`,type:`button`,onClick:()=>{s()},children:`Characters…`})]})]})}function zA({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 _=Xn(i,c.model),v=c.prompt.trim().length,y=_!==void 0&&v>0&&v+g>_.maxPromptLength,b=Tn(_),x=_?.video??null,S=jn(c.references,_),C=_===void 0?void 0:Qn(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=An(_),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=DA({clear:()=>{r.setFieldValue(`prompt`,``)},useSize:e=>{D(!1),r.setFieldValue(`width`,Pn[e].width),r.setFieldValue(`height`,Pn[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=pA(f,c.prompt),z=dA(F.items,c.prompt),B=(0,J.useId)(),V=`${B}-commands`,H=`${B}-characters`,ee=rr({computerId:l,prompt:c.prompt,saved:f,references:c.references,model:_===void 0?void 0:{label:_.label,maxReferences:_.input.maxReferences}}),te=_r(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,Pr(_,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)(RA,{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)(Gw,{"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&&hn(e,l)?d.find(t=>t.path===e.path):void 0,i=S[t]?.role,a=Jn(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:pn[i]}):(0,$.jsx)(jr,{size:`xs`,variant:`ghost`,type:`button`,className:`prints-reference-role`,"data-reference-role":i,"aria-label":`Reference ${String(t+1)}: ${pn[i]}. Use as ${pn[a]}`,title:`Use as ${pn[a]}`,onClick:()=>{r.setFieldValue(`references`,S.map((e,n)=>n===t?{...e,role:a}:e))},children:pn[i]}),(0,$.jsx)(or,{icon:(0,$.jsx)(fn,{}),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)(uA,{index:z.slashIndex,listId:V,matches:z.slashMatches,onHighlight:z.highlightSlash,onPick:U}):null,!z.slashOpen&&R.matches.length>0?(0,$.jsx)(fA,{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)(lA,{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)(jr,{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)(JE,{models:i,emptyLabel:l===null?`Choose a Computer`:a?`Loading models…`:`Models unavailable`,disabled:a||!o,onChange:t=>{let n=Xn(i,t);if(e.handleChange(t),!n)return;let a=r.store.state.fieldMeta,o=Cn(c,n),s=tr(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)(cA,{busy:s,draft:c.prompt,disabled:!o||a||i.length===0||s,label:On(_),onGenerate:()=>{m()},promptOver:y}),items:[{id:`settings`,accessibleLabel:`Generation settings`,title:`Settings`,label:(0,$.jsxs)(`span`,{className:`prints-settings-chip`,children:[(0,$.jsx)(Ub,{"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 BA({connection:e}){let t=(0,J.useRef)(e);t.current=e;let n=YE(e?.app??null),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(),s=ik(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}=tx(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=Du(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=OA(e?.app??null),z=mA(e?.app??null),B=wx({connection:e,folder:n,styles:R.styles,characters:z.characters,effects:{reserve:w,failed:T,notifyFailure:IA,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=LA(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 K=WS(G.store,e=>e.values),he=WS(G.store,e=>e.isSubmitting),ge=e?.app;(0,J.useEffect)(()=>{if(ge)return TA(ge,{readDraft:()=>me.current.store.state.values,readModels:()=>ae.current,setDraft:e=>{let t=me.current;if(e.model!==void 0){let n=Xn(ae.current,e.model);if(!n)throw Error(`Choose a model from the granted registry.`);let r=Cn(t.store.state.values,n),i=Xn(ae.current,t.store.state.values.model),a=tr(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()})},[ge]),(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=Cn(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=Xn(H,K.model),ve=K.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?$b(L):null,Se=(0,J.useMemo)(()=>_.map(e=>({key:$b(e),selected:$b(e)===xe,path:e.source.kind===`computer`?e.source.path:e.file.name,referenced:ve.some(t=>e.source.kind===`computer`&&hn(t,e.source.computerId)&&t.path===e.source.path),referenceDisabled:ve.length>=ye&&!ve.some(t=>e.source.kind===`computer`&&hn(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=>hn(e,n)&&e.path===t);G.setFieldValue(`references`,r?ve.filter(e=>!hn(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($b(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)(()=>oA(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:Yr(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=he||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=>{un(`open-team-billing`,n),t.current===e&&B.reportRecoveryError(n)})}:void 0,retry:De&&V.retryable!==!1?B.retry:void 0}:null,Ae=rk({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=XO(je,Me,r);ql(e?.app,[...n.available?[rw(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=>{un(`prints.status.report`,t),e?.app.ui.showToast({message:`Prints couldn't update its status bar.`,tone:`error`}).catch(e=>{un(`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)(PA,{image:t,app:e?.app??null,referenceImages:Ie,models:H,canAnimate:kA(H)!==void 0,download:r,onIterate:(e,n)=>{if(t.source.kind!==`computer`)return null;let r=jA(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($b(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)}-${Zb(e.name)}`,{type:e.type,lastModified:e.lastModified})))))},children:[(0,$.jsx)(PC,{id:`prints-generation-notices`}),(0,$.jsxs)(`div`,{className:`prints-gallery-region`,children:[(0,$.jsx)(vb,{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)(aA,{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($b(L))}}:void 0):void 0}):y||g.loading?(0,$.jsx)(nw,{variant:`hint`,role:`status`,"aria-live":`polite`,title:`Loading prints…`,description:`Your library is on its way.`}):(0,$.jsx)(nw,{"aria-live":`polite`,"data-absence":!0,"data-media-empty":!0,role:`status`,variant:`panel`,visual:(0,$.jsx)(Rb,{}),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:FA.map(e=>({label:e,onSelect:()=>{G.setFieldValue(`prompt`,e)}}))}:{}}),g.hasNextPage&&(0,$.jsx)(jr,{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)(lx,{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)(zA,{addedLength:pr(K.prompt,R.styles.find(e=>e.name===K.style)?.text,z.characters),styleControls:e=>({picker:(0,$.jsx)(MA,{styles:R.styles,selected:K.style,disabled:!W||ee||Ee,onSelect:e=>{G.setFieldValue(`style`,e)}}),dialog:(0,$.jsx)(NA,{open:e.open,onOpenChange:e.onOpenChange,styles:R.styles,selected:K.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)(vA,{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===K.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:ge,actions:(0,$.jsx)(_t,{"aria-label":`Upload images`,title:C?`Upload images to Computer`:`Connect a writable Computer to upload`,icon:(0,$.jsx)(Gb,{}),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:K,computerId:n.computerId,mediaDirectory:h,referenceImages:Ie}),Fe===null?null:(0,$.jsx)(QO,{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)(ek,{folder:n})]})}var VA=document.getElementById(`media-root`);if(!VA)throw Error(`Media root is missing`);Hl(VA,{name:`Prints`,queryClient:Cr()},({app:e})=>(0,J.createElement)(BA,{connection:e?{app:e}:null}));