chatluna-plugin-onebot-sandbox 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -14
- package/dist/.vite/manifest.json +1 -1
- package/dist/{app-63rfTh6w.js → app-bHKIhF6g.js} +1 -1
- package/dist/client.js +1 -1
- package/package.json +3 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import*as e from"react";import t,{createContext as n,createElement as r,forwardRef as i,isValidElement as a,useCallback as o,useContext as s,useEffect as c,useId as l,useImperativeHandle as u,useLayoutEffect as d,useMemo as f,useRef as p,useState as m,useSyncExternalStore as h}from"react";import{useNavigate as g,useParams as _,useSearchParams as v}from"react-router";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import{Button as S}from"@base-ui/react/button";import{Dialog as C}from"@base-ui/react/dialog";import{Input as w}from"@base-ui/react/input";import{Tooltip as T}from"@base-ui/react/tooltip";import{Popover as E}from"@base-ui/react/popover";import{AlertDialog as D}from"@base-ui/react/alert-dialog";import{mergeProps as O}from"@base-ui/react/merge-props";import{useRender as k}from"@base-ui/react/use-render";import{Checkbox as A}from"@base-ui/react/checkbox";import{Collapsible as j}from"@base-ui/react/collapsible";import{Combobox as M}from"@base-ui/react";import{ContextMenu as N}from"@base-ui/react/context-menu";import{ScrollArea as ee}from"@base-ui/react/scroll-area";import{Select as P}from"@base-ui/react/select";import{Switch as F}from"@base-ui/react/switch";import{Tabs as I}from"@base-ui/react/tabs";import{apiErrorMessage as te,callAction as ne,toast as L,useLive as R,useLocale as re,useTranslate as ie}from"@chatluna/ui-client/client";import{readStored as z,writeStored as B}from"@chatluna/ui-storage";import{createPortal as ae}from"react-dom";import{SchemaForm as oe,useFormValidation as se}from"@chatluna/ui-schema-form/client";var ce=Object.create,le=Object.defineProperty,ue=Object.getOwnPropertyDescriptor,de=Object.getOwnPropertyNames,fe=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty,me=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},he=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),ge=(e,t)=>{let n={};for(var r in e)le(n,r,{get:e[r],enumerable:!0});return t||le(n,Symbol.toStringTag,{value:`Module`}),n},_e=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=de(t),a=0,o=i.length,s;a<o;a++)s=i[a],!pe.call(e,s)&&s!==n&&le(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=ue(t,s))||r.enumerable});return e},ve=(e,t,n)=>(n=e==null?{}:ce(fe(e)),_e(t||!e||!e.__esModule||!pe.call(e,`default`)?le(n,`default`,{value:e,enumerable:!0}):n,e)),ye=e=>pe.call(e,`module.exports`)?e[`module.exports`]:_e(le({},`__esModule`,{value:!0}),e);function be(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=be(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function xe(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=be(e))&&(r&&(r+=` `),r+=t);return r}var Se=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Ce=(e,t)=>({classGroupId:e,validator:t}),we=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Te=`-`,Ee=[],De=`arbitrary..`,Oe=e=>{let t=je(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ae(e);let n=e.split(Te);return ke(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Se(i,t):t:i||Ee}return n[e]||Ee}}},ke=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=ke(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Te):e.slice(t).join(Te),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ae=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?De+r:void 0})(),je=e=>{let{theme:t,classGroups:n}=e;return Me(n,t)},Me=(e,t)=>{let n=we();for(let r in e){let i=e[r];Ne(i,n,r,t)}return n},Ne=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Pe(i,t,n,r)}},Pe=(e,t,n,r)=>{if(typeof e==`string`){Fe(e,t,n);return}if(typeof e==`function`){Ie(e,t,n,r);return}Le(e,t,n,r)},Fe=(e,t,n)=>{let r=e===``?t:Re(t,e);r.classGroupId=n},Ie=(e,t,n,r)=>{if(ze(e)){Ne(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ce(n,e))},Le=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Ne(o,Re(t,a),n,r)}},Re=(e,t)=>{let n=e,r=t.split(Te),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=we(),n.nextPart.set(t,i)),n=i}return n},ze=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Be=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ve=`!`,He=`:`,Ue=[],We=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ge=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===He){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Ve)?(c=s.slice(0,-1),l=!0):s.startsWith(Ve)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return We(t,l,c,u)};if(t){let e=t+He,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):We(Ue,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Ke=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},qe=e=>({cache:Be(e.cacheSize),parseClassName:Ge(e),sortModifiers:Ke(e),postfixLookupClassGroupIds:Je(e),...Oe(e)}),Je=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Ye=/\s+/,Xe=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Ye),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ve:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Ze=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Qe(n))&&(i&&(i+=` `),i+=r);return i},Qe=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Qe(e[r]))&&(n&&(n+=` `),n+=t);return n},$e=(e,...t)=>{let n,r,i,a,o=o=>(n=qe(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Xe(e,n);return i(e,a),a};return a=o,(...e)=>a(Ze(...e))},et=[],tt=e=>{let t=t=>t[e]||et;return t.isThemeGetter=!0,t},nt=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rt=/^\((?:(\w[\w-]*):)?(.+)\)$/i,it=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,at=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ot=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,st=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ct=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ut=e=>it.test(e),dt=e=>!!e&&!Number.isNaN(Number(e)),ft=e=>!!e&&Number.isInteger(Number(e)),pt=e=>e.endsWith(`%`)&&dt(e.slice(0,-1)),mt=e=>at.test(e),ht=()=>!0,gt=e=>ot.test(e)&&!st.test(e),_t=()=>!1,vt=e=>ct.test(e),yt=e=>lt.test(e),bt=e=>!V(e)&&!H(e),xt=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),St=e=>Lt(e,Vt,_t),V=e=>nt.test(e),Ct=e=>Lt(e,Ht,gt),wt=e=>Lt(e,Ut,dt),Tt=e=>Lt(e,Gt,ht),Et=e=>Lt(e,Wt,_t),Dt=e=>Lt(e,zt,_t),Ot=e=>Lt(e,Bt,yt),kt=e=>Lt(e,Kt,vt),H=e=>rt.test(e),At=e=>Rt(e,Ht),jt=e=>Rt(e,Wt),Mt=e=>Rt(e,zt),Nt=e=>Rt(e,Vt),Pt=e=>Rt(e,Bt),Ft=e=>Rt(e,Kt,!0),It=e=>Rt(e,Gt,!0),Lt=(e,t,n)=>{let r=nt.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Rt=(e,t,n=!1)=>{let r=rt.exec(e);return r?r[1]?t(r[1]):n:!1},zt=e=>e===`position`||e===`percentage`,Bt=e=>e===`image`||e===`url`,Vt=e=>e===`length`||e===`size`||e===`bg-size`,Ht=e=>e===`length`,Ut=e=>e===`number`,Wt=e=>e===`family-name`,Gt=e=>e===`number`||e===`weight`,Kt=e=>e===`shadow`,qt=$e(()=>{let e=tt(`color`),t=tt(`font`),n=tt(`text`),r=tt(`font-weight`),i=tt(`tracking`),a=tt(`leading`),o=tt(`breakpoint`),s=tt(`container`),c=tt(`spacing`),l=tt(`radius`),u=tt(`shadow`),d=tt(`inset-shadow`),f=tt(`text-shadow`),p=tt(`drop-shadow`),m=tt(`blur`),h=tt(`perspective`),g=tt(`aspect`),_=tt(`ease`),v=tt(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),H,V],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[H,V,c],T=()=>[ut,`full`,`auto`,...w()],E=()=>[ft,`none`,`subgrid`,H,V],D=()=>[`auto`,{span:[`full`,ft,H,V]},ft,H,V],O=()=>[ft,`auto`,H,V],k=()=>[`auto`,`min`,`max`,`fr`,H,V],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[ut,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ee=()=>[ut,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],P=()=>[ut,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,H,V],I=()=>[...b(),Mt,Dt,{position:[H,V]}],te=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,Nt,St,{size:[H,V]}],L=()=>[pt,At,Ct],R=()=>[``,`none`,`full`,l,H,V],re=()=>[``,dt,At,Ct],ie=()=>[`solid`,`dashed`,`dotted`,`double`],z=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],B=()=>[dt,pt,Mt,Dt],ae=()=>[``,`none`,m,H,V],oe=()=>[`none`,dt,H,V],se=()=>[`none`,dt,H,V],ce=()=>[dt,H,V],le=()=>[ut,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[mt],breakpoint:[mt],color:[ht],container:[mt],"drop-shadow":[mt],ease:[`in`,`out`,`in-out`],font:[bt],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[mt],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[mt],shadow:[mt],spacing:[`px`,dt],text:[mt],"text-shadow":[mt],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,ut,V,H,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,H,V]}],"container-named":[xt],columns:[{columns:[dt,V,H,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[ft,`auto`,H,V]}],basis:[{basis:[ut,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[dt,ut,`auto`,`initial`,`none`,V]}],grow:[{grow:[``,dt,H,V]}],shrink:[{shrink:[``,dt,H,V]}],order:[{order:[ft,`first`,`last`,`none`,H,V]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...ee()]}],"min-inline-size":[{"min-inline":[`auto`,...ee()]}],"max-inline-size":[{"max-inline":[`none`,...ee()]}],"block-size":[{block:[`auto`,...P()]}],"min-block-size":[{"min-block":[`auto`,...P()]}],"max-block-size":[{"max-block":[`none`,...P()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,At,Ct]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,It,Tt]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,pt,V]}],"font-family":[{font:[jt,Et,t]}],"font-features":[{"font-features":[V]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,H,V]}],"line-clamp":[{"line-clamp":[dt,`none`,H,wt]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,H,V]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,H,V]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ie(),`wavy`]}],"text-decoration-thickness":[{decoration:[dt,`from-font`,`auto`,H,Ct]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[dt,`auto`,H,V]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[ft,H,V]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,H,V]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,H,V]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ft,H,V],radial:[``,H,V],conic:[ft,H,V]},Pt,Ot]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-bs":[{"border-bs":re()}],"border-w-be":[{"border-be":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":re()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ie(),`hidden`,`none`]}],"divide-style":[{divide:[...ie(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...ie(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[dt,H,V]}],"outline-w":[{outline:[``,dt,At,Ct]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,Ft,kt]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,Ft,kt]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:re()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[dt,Ct]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,Ft,kt]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[dt,H,V]}],"mix-blend":[{"mix-blend":[...z(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":z()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[dt]}],"mask-image-linear-from-pos":[{"mask-linear-from":B()}],"mask-image-linear-to-pos":[{"mask-linear-to":B()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":B()}],"mask-image-t-to-pos":[{"mask-t-to":B()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":B()}],"mask-image-r-to-pos":[{"mask-r-to":B()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":B()}],"mask-image-b-to-pos":[{"mask-b-to":B()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":B()}],"mask-image-l-to-pos":[{"mask-l-to":B()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":B()}],"mask-image-x-to-pos":[{"mask-x-to":B()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":B()}],"mask-image-y-to-pos":[{"mask-y-to":B()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[H,V]}],"mask-image-radial-from-pos":[{"mask-radial-from":B()}],"mask-image-radial-to-pos":[{"mask-radial-to":B()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[dt]}],"mask-image-conic-from-pos":[{"mask-conic-from":B()}],"mask-image-conic-to-pos":[{"mask-conic-to":B()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,H,V]}],filter:[{filter:[``,`none`,H,V]}],blur:[{blur:ae()}],brightness:[{brightness:[dt,H,V]}],contrast:[{contrast:[dt,H,V]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Ft,kt]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,dt,H,V]}],"hue-rotate":[{"hue-rotate":[dt,H,V]}],invert:[{invert:[``,dt,H,V]}],saturate:[{saturate:[dt,H,V]}],sepia:[{sepia:[``,dt,H,V]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,H,V]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[dt,H,V]}],"backdrop-contrast":[{"backdrop-contrast":[dt,H,V]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,dt,H,V]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dt,H,V]}],"backdrop-invert":[{"backdrop-invert":[``,dt,H,V]}],"backdrop-opacity":[{"backdrop-opacity":[dt,H,V]}],"backdrop-saturate":[{"backdrop-saturate":[dt,H,V]}],"backdrop-sepia":[{"backdrop-sepia":[``,dt,H,V]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,H,V]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[dt,`initial`,H,V]}],ease:[{ease:[`linear`,`initial`,_,H,V]}],delay:[{delay:[dt,H,V]}],animate:[{animate:[`none`,v,H,V]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,H,V]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:oe()}],"rotate-x":[{"rotate-x":oe()}],"rotate-y":[{"rotate-y":oe()}],"rotate-z":[{"rotate-z":oe()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":[`scale-3d`],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[H,V,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:le()}],"translate-x":[{"translate-x":le()}],"translate-y":[{"translate-y":le()}],"translate-z":[{"translate-z":le()}],"translate-none":[`translate-none`],zoom:[{zoom:[ft,H,V]}],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,H,V]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,H,V]}],fill:[{fill:[`none`,...F()]}],"stroke-w":[{stroke:[dt,At,Ct,wt]}],stroke:[{stroke:[`none`,...F()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function U(...e){return qt(xe(e))}var Jt=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Yt=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Xt=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Zt=e=>{let t=Xt(e);return t.charAt(0).toUpperCase()+t.slice(1)},Qt={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},$t=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},en=n({}),tn=()=>s(en),nn=i(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:i,className:a=``,children:o,iconNode:s,...c},l)=>{let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=tn()??{},h=i??f?Number(n??d)*24/Number(t??u):n??d;return r(`svg`,{ref:l,...Qt,width:t??u??Qt.width,height:t??u??Qt.height,stroke:e??p,strokeWidth:h,className:Jt(`lucide`,m,a),...!o&&!$t(c)&&{"aria-hidden":`true`},...c},[...s.map(([e,t])=>r(e,t)),...Array.isArray(o)?o:[o]])}),W=(e,t)=>{let n=i(({className:n,...i},a)=>r(nn,{ref:a,iconNode:t,className:Jt(`lucide-${Yt(Zt(e))}`,`lucide-${e}`,n),...i}));return n.displayName=Zt(e),n},rn=W(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),an=W(`arrow-down-wide-narrow`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M11 4h10`,key:`1w87gc`}],[`path`,{d:`M11 8h7`,key:`djye34`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}]]),on=W(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),sn=W(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),cn=W(`arrow-up-narrow-wide`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M11 12h4`,key:`q8tih4`}],[`path`,{d:`M11 16h7`,key:`uosisv`}],[`path`,{d:`M11 20h10`,key:`jvxblo`}]]),ln=W(`arrow-up-to-line`,[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]),un=W(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),dn=W(`award`,[[`path`,{d:`m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526`,key:`1yiouv`}],[`circle`,{cx:`12`,cy:`8`,r:`6`,key:`1vp47v`}]]),fn=W(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),pn=W(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),mn=W(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),hn=W(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),gn=W(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338`,key:`7hb8p4`}],[`path`,{d:`M3 9h5.859`,key:`numkqi`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),_n=W(`calendar`,[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]),vn=W(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),yn=W(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),bn=W(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),xn=W(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Sn=W(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Cn=W(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),wn=W(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Tn=W(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),En=W(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Dn=W(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),On=W(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),kn=W(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),An=W(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),jn=W(`external-link`,[[`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`}]]),Mn=W(`face-slightly-smiling-plus`,[[`path`,{d:`M13.267 2.08a10 10 0 108.653 8.653`,key:`1wbpyh`}],[`path`,{d:`M15 10V9`,key:`4dkmfx`}],[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M16.472 15a6 6 0 01-8.943 0`,key:`7qomzy`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M9 10V9`,key:`1lazqi`}]]),Nn=W(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Pn=W(`flask-conical`,[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`,key:`18mbvz`}],[`path`,{d:`M6.453 15h11.094`,key:`3shlmq`}],[`path`,{d:`M8.5 2h7`,key:`csnxdl`}]]),Fn=W(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),In=W(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Ln=W(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Rn=W(`hand`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),zn=W(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Bn=W(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Vn=W(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Hn=W(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Un=W(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Wn=W(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Gn=W(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),Kn=W(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),qn=W(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Jn=W(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Yn=W(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Xn=W(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Zn=W(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Qn=W(`reply`,[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]),$n=W(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),er=W(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),tr=W(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),nr=W(`server-cog`,[[`path`,{d:`m10.852 14.772-.383.923`,key:`11vil6`}],[`path`,{d:`M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923`,key:`1v3clb`}],[`path`,{d:`m13.148 9.228.383-.923`,key:`t2zzyc`}],[`path`,{d:`m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544`,key:`1bxfiv`}],[`path`,{d:`m14.772 10.852.923-.383`,key:`k9m8cz`}],[`path`,{d:`m14.772 13.148.923.383`,key:`1xvhww`}],[`path`,{d:`M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5`,key:`tn8das`}],[`path`,{d:`M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5`,key:`1g2pve`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M6 6h.01`,key:`1utrut`}],[`path`,{d:`m9.228 10.852-.923-.383`,key:`1wtb30`}],[`path`,{d:`m9.228 13.148-.923.383`,key:`1a830x`}]]),rr=W(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),ir=W(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),ar=W(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),or=W(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),sr=W(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),cr=W(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),lr=W(`user-minus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),ur=W(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),dr=W(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),fr=W(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),pr=W(`webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),mr=W(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),hr=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,gr=xe,_r=(e,t)=>n=>{if(t?.variants==null)return gr(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=hr(t)||hr(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return gr(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},vr=_r(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-[13px] font-medium whitespace-nowrap transition-[background-color,border-color,color,scale] duration-150 ease-spring outline-none select-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:not-aria-[haspopup]:scale-[0.97] disabled:pointer-events-none disabled:opacity-40 aria-invalid:border-destructive motion-reduce:active:scale-100 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-[color-mix(in_oklab,var(--primary),var(--primary-foreground)_14%)] active:bg-[color-mix(in_oklab,var(--primary),var(--primary-foreground)_20%)]`,outline:`border-input bg-control hover:border-muted-foreground/60 hover:bg-foreground/4 aria-expanded:bg-foreground/6`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklab,var(--secondary),var(--foreground)_6%)] active:bg-[color-mix(in_oklab,var(--secondary),var(--foreground)_10%)] aria-expanded:bg-[color-mix(in_oklab,var(--secondary),var(--foreground)_6%)]`,ghost:`hover:bg-foreground/6 active:bg-foreground/10 aria-expanded:bg-foreground/6`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/16 active:bg-destructive/22 focus-visible:outline-destructive`,link:`text-primary underline-offset-4 hover:underline active:scale-100`},size:{default:`h-[30px] gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5`,xs:`h-[22px] gap-1 rounded-md px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-[26px] gap-1 rounded-md px-2.5 text-[12.5px] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-4 text-sm has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-[30px]`,"icon-xs":`size-[22px] rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-[26px] rounded-md`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function G({className:e,variant:t=`default`,size:n=`default`,...r}){return b(S,{"data-slot":`button`,className:U(vr({variant:t,size:n,className:e})),...r})}function yr({...e}){return b(C.Root,{"data-slot":`dialog`,...e})}function br({...e}){return b(C.Portal,{"data-slot":`dialog-portal`,...e})}function xr({className:e,...t}){return b(C.Backdrop,{forceRender:!0,"data-slot":`dialog-overlay`,className:U(`fixed inset-0 isolate z-50 bg-linear-to-b from-scrim-from to-scrim-to duration-200 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Sr({className:e,children:t,showCloseButton:n=!0,...r}){return x(br,{children:[b(xr,{}),x(C.Popup,{"data-slot":`dialog-content`,className:U(`[--control:var(--popover)] fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-[20px] bg-popover p-5 text-sm text-popover-foreground shadow-[0_24px_64px_rgb(0_0_0/0.22)] ring-1 ring-border duration-200 ease-spring outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&x(C.Close,{"data-slot":`dialog-close`,render:b(G,{variant:`ghost`,className:`absolute top-2 right-2 z-20`,size:`icon-sm`}),children:[b(mr,{}),b(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Cr({className:e,...t}){return b(`div`,{"data-slot":`dialog-header`,className:U(`sticky top-0 z-10 flex shrink-0 flex-col gap-2 bg-popover`,e),...t})}function wr({className:e,showCloseButton:t=!1,children:n,...r}){return x(`div`,{"data-slot":`dialog-footer`,className:U(`sticky bottom-0 z-10 flex shrink-0 flex-col-reverse gap-2 bg-popover pt-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&b(C.Close,{render:b(G,{variant:`outline`}),children:`Close`})]})}function Tr({className:e,...t}){return b(C.Title,{"data-slot":`dialog-title`,className:U(`text-base leading-none font-medium`,e),...t})}function Er({className:e,...t}){return b(C.Description,{"data-slot":`dialog-description`,className:U(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Dr({className:e,...t}){return b(`textarea`,{"data-slot":`textarea`,className:U(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-control px-2.5 py-2 text-base transition-colors duration-150 outline-none placeholder:text-muted-foreground/70 hover:border-muted-foreground/60 focus-visible:border-primary disabled:cursor-not-allowed disabled:border-border disabled:bg-muted disabled:text-muted-foreground aria-invalid:border-destructive md:text-[13px]`,e),...t})}function Or({className:e,type:t,...n}){return b(w,{type:t,"data-slot":`input`,className:U(`h-[30px] w-full min-w-0 text-ellipsis rounded-lg border border-input bg-control px-2.5 py-1 text-base transition-colors duration-150 outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/70 hover:border-muted-foreground/60 focus-visible:border-primary disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-border disabled:bg-muted disabled:text-muted-foreground aria-invalid:border-destructive md:text-[13px]`,e),...n})}function kr({className:e,...t}){return b(`div`,{"data-slot":`input-group`,role:`group`,className:U(`group/input-group relative flex h-[30px] w-full min-w-0 items-center rounded-lg border border-input bg-control transition-colors duration-150 outline-none hover:border-muted-foreground/60 in-data-[slot=combobox-content]:focus-within:border-inherit has-[[data-slot=input-group-control]:disabled]:border-border has-[[data-slot=input-group-control]:disabled]:bg-muted has-[[data-slot=input-group-control]:disabled]:text-muted-foreground has-[[data-slot=input-group-control]:focus-visible]:border-primary has-[[data-slot][aria-invalid=true]]:border-destructive has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var Ar=_r(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function jr({className:e,align:t=`inline-start`,...n}){return b(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:U(Ar({align:t}),e),onClick:e=>{!e.currentTarget.contains(e.target)||e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}function Mr({className:e,...t}){return b(Or,{"data-slot":`input-group-control`,className:U(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}e.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function Nr({delay:e=0,...t}){return b(T.Provider,{"data-slot":`tooltip-provider`,delay:e,...t})}function Pr({...e}){return b(T.Root,{"data-slot":`tooltip`,...e})}function Fr({...e}){return b(T.Trigger,{"data-slot":`tooltip-trigger`,...e})}function Ir({className:e,side:t=`top`,sideOffset:n=6,align:r=`center`,alignOffset:i=0,children:a,...o}){return b(T.Portal,{children:b(T.Positioner,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:b(T.Popup,{"data-slot":`tooltip-content`,className:U(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-lg bg-foreground px-2 py-1 text-xs leading-4 text-background shadow-popup duration-150 ease-fluid has-data-[slot=kbd]:pr-1 dark:bg-popover dark:text-popover-foreground dark:ring-1 dark:ring-border data-[side=bottom]:slide-in-from-top-1 data-[side=inline-end]:slide-in-from-left-1 data-[side=inline-start]:slide-in-from-right-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none`,e),...o,children:a})})})}e.createContext(null),e.createContext(null);function Lr({...e}){return b(E.Root,{"data-slot":`popover`,...e})}function Rr({...e}){return b(E.Trigger,{"data-slot":`popover-trigger`,...e})}function zr({align:e=`center`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return b(E.Portal,{children:b(E.Positioner,{align:e,alignOffset:t,side:n,sideOffset:r,className:`isolate z-50`,children:b(E.Popup,{"data-slot":`popover-content`,className:U(`[--control:var(--popover)] z-50 flex max-h-(--available-height) w-72 flex-col gap-2.5 origin-(--transform-origin) overflow-y-auto rounded-xl bg-popover p-2.5 text-sm text-popover-foreground shadow-popup ring-1 ring-border outline-hidden duration-200 ease-fluid data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.userAgent);var Br=_r(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function Vr({className:e,variant:t,...n}){return b(`div`,{"data-slot":`alert`,role:`alert`,className:U(Br({variant:t}),e),...n})}function Hr({className:e,...t}){return b(`div`,{"data-slot":`alert-description`,className:U(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function Ur({...e}){return b(D.Root,{"data-slot":`alert-dialog`,...e})}function Wr({...e}){return b(D.Portal,{"data-slot":`alert-dialog-portal`,...e})}function Gr({className:e,...t}){return b(D.Backdrop,{forceRender:!0,"data-slot":`alert-dialog-overlay`,className:U(`fixed inset-0 isolate z-50 bg-linear-to-b from-scrim-from to-scrim-to duration-200 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Kr({className:e,size:t=`default`,...n}){return x(Wr,{children:[b(Gr,{}),b(D.Popup,{"data-slot":`alert-dialog-content`,"data-size":t,className:U(`[--control:var(--popover)] group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[20px] bg-popover p-5 text-popover-foreground shadow-[0_24px_64px_rgb(0_0_0/0.22)] ring-1 ring-border duration-200 ease-spring outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function qr({className:e,...t}){return b(`div`,{"data-slot":`alert-dialog-header`,className:U(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Jr({className:e,...t}){return b(`div`,{"data-slot":`alert-dialog-footer`,className:U(`flex flex-col-reverse gap-2 pt-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Yr({className:e,...t}){return b(D.Title,{"data-slot":`alert-dialog-title`,className:U(`text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Xr({className:e,...t}){return b(D.Description,{"data-slot":`alert-dialog-description`,className:U(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Zr({className:e,...t}){return b(G,{"data-slot":`alert-dialog-action`,className:U(e),...t})}function Qr({className:e,variant:t=`outline`,size:n=`default`,...r}){return b(D.Close,{"data-slot":`alert-dialog-cancel`,className:U(e),render:b(G,{variant:t,size:n}),...r})}var $r=_r(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-md border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:outline-destructive dark:bg-destructive/16 [a]:hover:bg-destructive/20`,outline:`border-input text-foreground [a]:hover:bg-muted`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function ei({className:e,variant:t=`default`,render:n,...r}){return k({defaultTagName:`span`,props:O({className:U($r({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}function ti(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var ni={},ri={};function ii(e,t){try{let n=(ni[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in ri?ri[n]:oi(n,n.split(`:`))}catch{if(e in ri)return ri[e];let t=e?.match(ai);return t?oi(e,t.slice(1)):NaN}}var ai=/([+-]\d\d):?(\d\d)?/;function oi(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return ri[e]=n*60+r>0?n*60+r+i:n*60-r-i}var si=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(ii(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),di(this,e)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-ii(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),li(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},ci=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!ci.test(e))return;let t=e.replace(ci,`$1UTC`);si.prototype[t]&&(e.startsWith(`get`)?si.prototype[e]=function(){return this.internal[t]()}:(si.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),ui(this),+this},si.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),li(this),+this}))});function li(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-ii(e.timeZone,e)*60))}function ui(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),di(e)}function di(e,t){let n=Array.isArray(t)?fi(t):+e.internal,r=ii(e.timeZone,e),i=r>0?Math.floor(r):Math.ceil(r),a=new Date(+e);a.setUTCHours(a.getUTCHours()-1);let o=-new Date(+e).getTimezoneOffset(),s=-new Date(+a).getTimezoneOffset(),c=o-s,l=o;if(c&&o!==i&&Date.prototype.getHours.apply(e)!==(Array.isArray(t)?t[3]||0:e.internal.getUTCHours())){let t=new Date(+e),n=o-i;n&&t.setUTCMinutes(t.getUTCMinutes()+n);let r=ii(e.timeZone,t);(r>0?Math.floor(r):Math.ceil(r))===i&&(l=s)}let u=l-i;u&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+u);let d=new Date(+e);d.setUTCSeconds(0);let f=o>0?d.getSeconds():(d.getSeconds()-60)%60,p=Math.round(-(ii(e.timeZone,e)*60))%60;(p||f)&&Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+p+f);let m=ii(e.timeZone,e),h=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-h,_=h!==i,v=g-u,y=h-i,b=n-h*60*1e3,x=y>0&&pi(e)-n===y*60*1e3&&pi(e,b)!==n;if(_&&v&&!x){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+v);let t=ii(e.timeZone,e),n=h-(t>0?Math.floor(t):Math.ceil(t));n&&v<0&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n)}li(e);let S=(t?n:n+p*1e3)-+e.internal;S&&Math.abs(S)<18e5&&(Date.prototype.setTime.call(e,+e+S),li(e))}function fi(e){return Date.UTC(e[0],e.length>1?e[1]:0,e.length>2?e[2]:1,...e.slice(3))}function pi(e,t){let n=new Date(t??+e);return n.setUTCSeconds(n.getUTCSeconds()-Math.round(-ii(e.timeZone,n)*60)),+n}var mi=class e extends si{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${ti(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},hi=365.2425,gi=6048e5,_i=864e5,vi=86400;vi*7,vi*hi/12*3;var yi=Symbol.for(`constructDateFrom`);function bi(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&yi in e?e[yi](t):e instanceof Date?new e.constructor(t):new Date(t)}function xi(e,t){return bi(t||e,e)}function Si(e,t,n){let r=xi(e,n?.in);return isNaN(t)?bi(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Ci(e,t,n){let r=xi(e,n?.in);if(isNaN(t))return bi(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=bi(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var wi={};function Ti(){return wi}function Ei(e,t){let n=Ti(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=xi(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Di(e,t){return Ei(e,{...t,weekStartsOn:1})}function Oi(e,t){let n=xi(e,t?.in),r=n.getFullYear(),i=bi(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Di(i),o=bi(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Di(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function ki(e){let t=xi(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Ai(e,...t){let n=bi.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function ji(e,t){let n=xi(e,t?.in);return n.setHours(0,0,0,0),n}function Mi(e,t,n){let[r,i]=Ai(n?.in,e,t),a=ji(r),o=ji(i),s=+a-ki(a),c=+o-ki(o);return Math.round((s-c)/_i)}function Ni(e,t){let n=Oi(e,t),r=bi(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Di(r)}function Pi(e,t,n){return Si(e,t*7,n)}function Fi(e,t,n){return Ci(e,t*12,n)}function Ii(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=bi.bind(null,e));let t=xi(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),bi(r,n||NaN)}function Li(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=bi.bind(null,e));let t=xi(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),bi(r,n||NaN)}function Ri(e,t,n){let[r,i]=Ai(n?.in,e,t);return+ji(r)==+ji(i)}function zi(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Bi(e){return!(!zi(e)&&typeof e!=`number`||isNaN(+xi(e)))}function Vi(e,t,n){let[r,i]=Ai(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Hi(e,t){let n=xi(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Ui(e,t){let[n,r]=Ai(e,t.start,t.end);return{start:n,end:r}}function Wi(e,t){let{start:n,end:r}=Ui(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(bi(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function Gi(e,t){let n=xi(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Ki(e,t){let n=xi(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function qi(e,t){let n=xi(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Ji(e,t){let{start:n,end:r}=Ui(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(bi(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function Yi(e,t){let n=Ti(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=xi(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function Xi(e,t){return Yi(e,{...t,weekStartsOn:1})}var Zi={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},Qi=(e,t,n)=>{let r,i=Zi[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function $i(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var ea={date:$i({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:$i({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:$i({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},ta={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},na=(e,t,n,r)=>ta[e];function ra(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var ia={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:ra({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:ra({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:ra({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:ra({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:ra({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function aa(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?sa(s,e=>e.test(o)):oa(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function oa(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function sa(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function ca(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var la={code:`en-US`,formatDistance:Qi,formatLong:ea,formatRelative:na,localize:ia,match:{ordinalNumber:ca({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:aa({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:aa({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:aa({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:aa({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:aa({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function ua(e,t){let n=xi(e,t?.in);return Mi(n,qi(n))+1}function da(e,t){let n=xi(e,t?.in),r=Di(n)-+Ni(n);return Math.round(r/gi)+1}function fa(e,t){let n=xi(e,t?.in),r=n.getFullYear(),i=Ti(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=bi(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Ei(o,t),c=bi(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Ei(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function pa(e,t){let n=Ti(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=fa(e,t),a=bi(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Ei(a,t)}function ma(e,t){let n=xi(e,t?.in),r=Ei(n,t)-+pa(n,t);return Math.round(r/gi)+1}function ha(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var ga={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return ha(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):ha(n+1,2)},d(e,t){return ha(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return ha(e.getHours()%12||12,t.length)},H(e,t){return ha(e.getHours(),t.length)},m(e,t){return ha(e.getMinutes(),t.length)},s(e,t){return ha(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return ha(Math.trunc(r*10**(n-3)),t.length)}},_a={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},va={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return ga.y(e,t)},Y:function(e,t,n,r){let i=fa(e,r),a=i>0?i:1-i;return t===`YY`?ha(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):ha(a,t.length)},R:function(e,t){return ha(Oi(e),t.length)},u:function(e,t){return ha(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return ha(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return ha(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return ga.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return ha(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=ma(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):ha(i,t.length)},I:function(e,t,n){let r=da(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):ha(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):ga.d(e,t)},D:function(e,t,n){let r=ua(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):ha(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return ha(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return ha(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return ha(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?_a.noon:r===0?_a.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?_a.evening:r>=12?_a.afternoon:r>=4?_a.morning:_a.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return ga.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):ga.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):ha(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):ha(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):ga.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):ga.s(e,t)},S:function(e,t){return ga.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return ba(r);case`XXXX`:case`XX`:return xa(r);default:return xa(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return ba(r);case`xxxx`:case`xx`:return xa(r);default:return xa(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+ya(r,`:`);default:return`GMT`+xa(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+ya(r,`:`);default:return`GMT`+xa(r,`:`)}},t:function(e,t,n){return ha(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return ha(+e,t.length)}};function ya(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+ha(a,2)}function ba(e,t){return e%60==0?(e>0?`-`:`+`)+ha(Math.abs(e)/60,2):xa(e,t)}function xa(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=ha(Math.trunc(r/60),2),a=ha(r%60,2);return n+i+t+a}var Sa=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},Ca=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},wa={p:Ca,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Sa(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`})}return a.replace(`{{date}}`,Sa(r,t)).replace(`{{time}}`,Ca(i,t))}},Ta=/^D+$/,Ea=/^Y+$/,Da=[`D`,`DD`,`YY`,`YYYY`];function Oa(e){return Ta.test(e)}function ka(e){return Ea.test(e)}function Aa(e,t,n){let r=ja(e,t,n);if(console.warn(r),Da.includes(e))throw RangeError(r)}function ja(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var Ma=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Na=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Pa=/^'([^]*?)'?$/,Fa=/''/g,Ia=/[a-zA-Z]/;function La(e,t,n){let r=Ti(),i=n?.locale??r.locale??la,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=xi(e,n?.in);if(!Bi(s))throw RangeError(`Invalid time value`);let c=t.match(Na).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=wa[t];return n(e,i.formatLong)}return e}).join(``).match(Ma).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Ra(e)};if(va[t])return{isToken:!0,value:e};if(t.match(Ia))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&ka(a)||!n?.useAdditionalDayOfYearTokens&&Oa(a))&&Aa(a,t,String(e));let o=va[a[0]];return o(s,a,i.localize,l)}).join(``)}function Ra(e){let t=e.match(Pa);return t?t[1].replace(Fa,`'`):e}function za(e,t){let n=xi(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=bi(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function Ba(e,t){return xi(e,t?.in).getMonth()}function Va(e,t){return xi(e,t?.in).getFullYear()}function Ha(e,t){return+xi(e)>+xi(t)}function Ua(e,t){return+xi(e)<+xi(t)}function Wa(e,t,n){let[r,i]=Ai(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function Ga(e,t,n){let[r,i]=Ai(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function Ka(e,t,n){let r=xi(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=bi(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=za(o);return r.setMonth(t,Math.min(a,s)),r}function qa(e,t,n){let r=xi(e,n?.in);return isNaN(+r)?bi(n?.in||e,NaN):(r.setFullYear(t),r)}var Ja=5,Ya=4;function Xa(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,34);return t.getMonth(e)===t.getMonth(a)?Ja:Ya}function Za(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function Qa(e,t){let n=Za(e,t),r=Xa(e,t);return t.addDays(n,r*7-1)}var $a={...la,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>La(e,t,{locale:la,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>La(e,n,{locale:la,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>La(e,t,{locale:la,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>La(e,n,{locale:la,...t}),r(e,`cccc`)}}},eo=class e{constructor(e,t){this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?mi.tz(this.options.timeZone):new(this.options.Date??Date),this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new mi(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):Si(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):Ci(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):Pi(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):Fi(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):Mi(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Vi(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):Wi(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):Ji(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):Qa(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):Xi(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):Hi(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):Yi(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):Ki(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):La(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):da(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):Ba(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):Va(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):ma(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):Ha(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):Ua(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):zi(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):Ri(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):Wa(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):Ga(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):Ii(e),this.min=e=>this.overrides?.min?this.overrides.min(e):Li(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):Ka(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):qa(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):Za(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):ji(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):Di(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):Gi(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):Ei(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):qi(e),this.options={locale:$a,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};eo.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var to=new eo,no=class{constructor(e,t,n=to){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},ro=class{constructor(e,t){this.date=e,this.weeks=t}},io=class{constructor(e,t){this.days=t,this.weekNumber=e}};function ao(e){return t.createElement(`span`,{...e})}function oo(e){let{size:n=24,orientation:r=`left`,className:i,style:a}=e;return t.createElement(`svg`,{className:i,style:a,width:n,height:n,viewBox:`0 0 24 24`},r===`up`&&t.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),r===`down`&&t.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),r===`left`&&t.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),r===`right`&&t.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function so(e){let{day:n,modifiers:r,...i}=e;return t.createElement(`td`,{...i})}function co(e){let{day:n,modifiers:r,...i}=e,a=t.useRef(null);return t.useEffect(()=>{r.focused&&a.current?.focus()},[r.focused]),t.createElement(`button`,{ref:a,...i})}var K;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(K||={});var lo;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(lo||={});var uo;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(uo||={});var fo;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(fo||={});var po=n(void 0);function mo(){let e=s(po);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function ho(e){let{options:n,className:r,...i}=e,{classNames:a,components:o,styles:s}=mo(),c=[a[K.Dropdown],r].join(` `),l=n?.find(({value:e})=>e===i.value);return t.createElement(`span`,{"data-disabled":i.disabled,className:a[K.DropdownRoot],style:s?.[K.DropdownRoot]},t.createElement(o.Select,{className:c,...i},n?.map(({value:e,label:n,disabled:r})=>t.createElement(o.Option,{key:e,value:e,disabled:r},n))),t.createElement(`span`,{className:a[K.CaptionLabel],style:s?.[K.CaptionLabel],"aria-hidden":!0},l?.label,t.createElement(o.Chevron,{orientation:`down`,size:18,className:a[K.Chevron],style:s?.[K.Chevron]})))}function go(e){return t.createElement(`div`,{...e})}function _o(e){return t.createElement(`div`,{...e})}function vo(e){let{calendarMonth:n,displayIndex:r,...i}=e;return t.createElement(`div`,{...i},e.children)}function yo(e){let{calendarMonth:n,displayIndex:r,...i}=e;return t.createElement(`div`,{...i})}function bo(e){return t.createElement(`table`,{...e})}function xo(e){return t.createElement(`div`,{...e})}function So(e){let{components:n}=mo();return t.createElement(n.Dropdown,{...e})}function Co(e){let{onPreviousClick:n,onNextClick:r,previousMonth:i,nextMonth:a,...s}=e,{components:c,classNames:l,styles:u,labels:{labelPrevious:d,labelNext:f}}=mo(),p=o(e=>{a&&r?.(e)},[a,r]),m=o(e=>{i&&n?.(e)},[i,n]);return t.createElement(`nav`,{...s},t.createElement(c.PreviousMonthButton,{type:`button`,className:l[K.PreviousMonthButton],style:u?.[K.PreviousMonthButton],tabIndex:i?void 0:-1,"aria-disabled":!i||void 0,"aria-label":d(i),onClick:m},t.createElement(c.Chevron,{disabled:!i||void 0,className:l[K.Chevron],style:u?.[K.Chevron],orientation:`left`})),t.createElement(c.NextMonthButton,{type:`button`,className:l[K.NextMonthButton],style:u?.[K.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":!a||void 0,"aria-label":f(a),onClick:p},t.createElement(c.Chevron,{disabled:!a||void 0,orientation:`right`,className:l[K.Chevron],style:u?.[K.Chevron]})))}function wo(e){return t.createElement(`button`,{...e})}function To(e){return t.createElement(`option`,{...e})}function Eo(e){return t.createElement(`button`,{...e})}function Do(e){let{rootRef:n,...r}=e;return t.createElement(`div`,{...r,ref:n})}function Oo(e){return t.createElement(`select`,{...e})}function ko(e){let{week:n,...r}=e;return t.createElement(`tr`,{...r})}function Ao(e){return t.createElement(`th`,{...e})}function jo(e){return t.createElement(`thead`,{"aria-hidden":!0},t.createElement(`tr`,{...e}))}function Mo(e){let{week:n,...r}=e;return t.createElement(`th`,{...r})}function No(e){return t.createElement(`th`,{...e})}function Po(e){return t.createElement(`tbody`,{...e})}function Fo(e){let{components:n}=mo();return t.createElement(n.Dropdown,{...e})}var Io=ge({CaptionLabel:()=>ao,Chevron:()=>oo,Day:()=>so,DayButton:()=>co,Dropdown:()=>ho,DropdownNav:()=>go,Footer:()=>_o,Month:()=>vo,MonthCaption:()=>yo,MonthGrid:()=>bo,Months:()=>xo,MonthsDropdown:()=>So,Nav:()=>Co,NextMonthButton:()=>wo,Option:()=>To,PreviousMonthButton:()=>Eo,Root:()=>Do,Select:()=>Oo,Week:()=>ko,WeekNumber:()=>Mo,WeekNumberHeader:()=>No,Weekday:()=>Ao,Weekdays:()=>jo,Weeks:()=>Po,YearsDropdown:()=>Fo});function Lo(e,t,n=!1,r=to){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function Ro(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function zo(e){return!!(e&&typeof e==`object`&&`from`in e)}function Bo(e){return!!(e&&typeof e==`object`&&`after`in e)}function Vo(e){return!!(e&&typeof e==`object`&&`before`in e)}function Ho(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function Uo(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Wo(e,t,n=to){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(Uo(t,n))return t.some(t=>i(e,t));if(zo(t))return Lo(t,e,!1,n);if(Ho(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(Ro(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return Bo(t)?a(e,t.after)>0:Vo(t)?a(t.before,e)>0:typeof t==`function`&&t(e)})}function Go(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[lo.focused]:[],[lo.outside]:[],[lo.disabled]:[],[lo.hidden]:[],[lo.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&Wo(e,a,i)),S=!!(o&&Wo(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&Wo(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[lo.focused]:!1,[lo.disabled]:!1,[lo.hidden]:!1,[lo.outside]:!1,[lo.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function Ko(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[lo[r]]?e.push(t[lo[r]]):t[uo[r]]&&e.push(t[uo[r]]),e),[t[K.Day]])}function qo(e){return{...Io,...e}}function Jo(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function Yo(){let e={};for(let t in K)e[K[t]]=`rdp-${K[t]}`;for(let t in lo)e[lo[t]]=`rdp-${lo[t]}`;for(let t in uo)e[uo[t]]=`rdp-${uo[t]}`;for(let t in fo)e[fo[t]]=`rdp-${fo[t]}`;return e}function Xo(e,t,n){return(n??new eo(t)).formatMonthYear(e)}function Zo(e,t,n){return(n??new eo(t)).format(e,`d`)}function Qo(e,t=to){return t.format(e,`LLLL`)}function $o(e,t,n){return(n??new eo(t)).format(e,`cccccc`)}function es(e,t=to){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function ts(){return``}function ns(e,t=to){return t.format(e,`yyyy`)}var rs=ge({formatCaption:()=>Xo,formatDay:()=>Zo,formatMonthDropdown:()=>Qo,formatWeekNumber:()=>es,formatWeekNumberHeader:()=>ts,formatWeekdayName:()=>$o,formatYearDropdown:()=>ns});function is(e){return{...rs,...e}}function as(e,t,n,r){let i=(r??new eo(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}function os(e,t,n){return(n??new eo(t)).formatMonthYear(e)}function ss(e,t,n,r){let i=(r??new eo(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function cs(e){return`Choose the Month`}function ls(){return``}var us=`Go to the Next Month`;function ds(e,t){return us}function fs(e){return`Go to the Previous Month`}function ps(e,t,n){return(n??new eo(t)).format(e,`cccc`)}function ms(e,t){return`Week ${e}`}function hs(e){return`Week Number`}function gs(e){return`Choose the Year`}var _s=ge({labelDayButton:()=>as,labelGrid:()=>os,labelGridcell:()=>ss,labelMonthDropdown:()=>cs,labelNav:()=>ls,labelNext:()=>ds,labelPrevious:()=>fs,labelWeekNumber:()=>ms,labelWeekNumberHeader:()=>hs,labelWeekday:()=>ps,labelYearDropdown:()=>gs}),vs=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function ys(e,t){let n=t.locale?.labels??{};return{..._s,...e??{},labelDayButton:vs(as,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:vs(cs,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:vs(ds,e?.labelNext,n.labelNext),labelPrevious:vs(fs,e?.labelPrevious,n.labelPrevious),labelWeekNumber:vs(ms,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:vs(gs,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:vs(os,e?.labelGrid,n.labelGrid),labelGridcell:vs(ss,e?.labelGridcell,n.labelGridcell),labelNav:vs(ls,e?.labelNav,n.labelNav),labelWeekNumberHeader:vs(hs,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:vs(ps,e?.labelWeekday,n.labelWeekday)}}function bs(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function xs(e,t={},n={}){let r={...t?.[K.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function Ss(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function Cs(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function ws(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new mi(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(mi.tz(e)),newDate:(t,n,r)=>new mi(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new mi(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new mi(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new mi(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new mi(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>ma(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>da(o(e)),differenceInCalendarDays:(e,t)=>Mi(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Vi(o(e),o(t))}}var Ts=e=>e instanceof HTMLElement?e:null,Es=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],Ds=e=>Ts(e.querySelector(`[data-animated-month]`)),Os=e=>Ts(e.querySelector(`[data-animated-caption]`)),ks=e=>Ts(e.querySelector(`[data-animated-weeks]`)),As=e=>Ts(e.querySelector(`[data-animated-nav]`)),js=e=>Ts(e.querySelector(`[data-animated-weekdays]`));function Ms(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=p(null),s=p(r),c=p(!1);d(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[fo.caption_after_enter]:n[fo.caption_before_enter],p=d?n[fo.weeks_after_enter]:n[fo.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(Es(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=Ds(e);t&&e.contains(t)&&e.removeChild(t);let n=Os(e);n&&n.classList.remove(f);let r=ks(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?Es(m):[],_=Es(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g?.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=As(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=Os(i);s&&s.classList.add(f);let l=ks(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=js(o);m&&(m.style.opacity=`0`);let h=Os(o);h&&(h.classList.add(d?n[fo.caption_before_exit]:n[fo.caption_after_exit]),h.addEventListener(`animationend`,u));let _=ks(o);_&&_.classList.add(d?n[fo.weeks_before_exit]:n[fo.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function Ns(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function Ps(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function Fs(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function Is(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function Ls(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new ro(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new no(t,m,r);return a?a.days.push(o):e.push(new io(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function Rs(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,today:u}=t,d=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):!n&&d&&(n=i(c(e.today??u(),-100))),r?r=s(r):!r&&d&&(r=l(e.today??u())),[n&&a(n),r&&a(r)]}function zs(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function Bs(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function Vs(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function Hs(e,t){let[n,r]=m(e);return[t===void 0?n:t,r]}function Us(e,t){let[n,r]=Rs(e,t),{startOfMonth:i,endOfMonth:a}=t,o=Is(e,n,r,t),[s,l]=Hs(o,e.month?o:void 0);c(()=>{let i=Is(e,n,r,t);l(i)},[e.timeZone]);let{months:u,weeks:d,days:p,previousMonth:m,nextMonth:h}=f(()=>{let i=Fs(s,r,{numberOfMonths:e.numberOfMonths},t),o=Ls(i,Ns(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:Vs(o),days:Ps(o),previousMonth:Bs(s,n,e,t),nextMonth:zs(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:g,onMonthChange:_}=e,v=e=>d.some(t=>t.days.some(t=>t.isEqualTo(e))),y=e=>{if(g)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),l(t),_?.(t)};return{months:u,weeks:d,days:p,navStart:n,navEnd:r,previousMonth:m,nextMonth:h,goToMonth:y,goToDay:e=>{v(e)||y(e.date)}}}var Ws;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(Ws||={});function Gs(e){return!e[lo.disabled]&&!e[lo.hidden]&&!e[lo.outside]}function Ks(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);Gs(e)&&(e[lo.focused]&&a<Ws.FocusedModifier?(i=o,a=Ws.FocusedModifier):r?.isEqualTo(o)&&a<Ws.LastFocused?(i=o,a=Ws.LastFocused):n(o.date)&&a<Ws.Selected?(i=o,a=Ws.Selected):e[lo.today]&&a<Ws.Today&&(i=o,a=Ws.Today))}return i||=e.find(e=>Gs(t(e))),i}function qs(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function Js(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=qs(e,t,n.date,r,i,a,o),l=!!(a.disabled&&Wo(c,a.disabled,o)),u=!!(a.hidden&&Wo(c,a.hidden,o)),d=new no(c,c,o);return!l&&!u?d:Js(e,t,d,r,i,a,o,s+1)}function Ys(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=m(),c=Ks(t.days,n,r||(()=>!1),o),[l,u]=m(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=Js(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function Xs(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=Hs(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function Zs(e,t,n=0,r=0,i=!1,a=to){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s){if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`)}if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function Qs(e,t,n=to){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function $s(e,t,n=to){return Lo(e,t.from,!1,n)||Lo(e,t.to,!1,n)||Lo(t,e.from,!1,n)||Lo(t,e.to,!1,n)}function ec(e,t,n=to){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?Lo(e,t,!1,n):Uo(t,n)?t.some(t=>Lo(e,t,!1,n)):zo(t)?t.from&&t.to?$s(e,{from:t.from,to:t.to},n):!1:Ho(t)?Qs(e,t.dayOfWeek,n):Ro(t)?n.isAfter(t.before,t.after)?$s(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):Wo(e.from,t,n)||Wo(e.to,t,n):Bo(t)||Vo(t)?Wo(e.from,t,n)||Wo(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function tc(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=Hs(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:Zs(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&ec({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&Lo(u,e,!1,t)}}function nc(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=Hs(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function rc(e,t){let n=nc(e,t),r=Xs(e,t),i=tc(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function ic(e,t){return e instanceof mi&&e.timeZone===t?e:new mi(e,t)}function ac(e,t,n){if(!n)return ic(e,t);let r=ic(e,t),i=new mi(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function oc(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?ac(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?ac(e,t,n):e):zo(e)?{...e,from:e.from?ic(e.from,t):e.from,to:e.to?ic(e.to,t):e.to}:Ro(e)?{before:ac(e.before,t,n),after:ac(e.after,t,n)}:Bo(e)?{after:ac(e.after,t,n)}:Vo(e)?{before:ac(e.before,t,n)}:e}function sc(e,t,n){return e&&(Array.isArray(e)?e.map(e=>oc(e,t,n)):oc(e,t,n))}function cc(e){let n=e,r=n.timeZone;if(r&&(n={...e,timeZone:r},n.today&&(n.today=ic(n.today,r)),n.month&&(n.month=ic(n.month,r)),n.defaultMonth&&(n.defaultMonth=ic(n.defaultMonth,r)),n.startMonth&&(n.startMonth=ic(n.startMonth,r)),n.endMonth&&(n.endMonth=ic(n.endMonth,r)),n.mode===`single`&&n.selected?n.selected=ic(n.selected,r):n.mode===`multiple`&&n.selected?n.selected=n.selected?.map(e=>ic(e,r)):n.mode===`range`&&n.selected&&(n.selected={from:n.selected.from?ic(n.selected.from,r):n.selected.from,to:n.selected.to?ic(n.selected.to,r):n.selected.to}),n.disabled!==void 0&&(n.disabled=sc(n.disabled,r)),n.hidden!==void 0&&(n.hidden=sc(n.hidden,r)),n.modifiers)){let e={};Object.keys(n.modifiers).forEach(t=>{e[t]=sc(n.modifiers?.[t],r)}),n.modifiers=e}let{components:i,formatters:a,labels:s,dateLib:c,locale:l,classNames:u}=f(()=>{let e={...$a,...n.locale},t=n.broadcastCalendar?1:n.weekStartsOn,r=n.noonSafe&&n.timeZone?ws(n.timeZone,{weekStartsOn:t,locale:e}):void 0,i=n.dateLib&&r?{...r,...n.dateLib}:n.dateLib??r,a=new eo({locale:e,weekStartsOn:t,firstWeekContainsDate:n.firstWeekContainsDate,useAdditionalWeekYearTokens:n.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:n.useAdditionalDayOfYearTokens,timeZone:n.timeZone,numerals:n.numerals},i);return{dateLib:a,components:qo(n.components),formatters:is(n.formatters),labels:ys(n.labels,a.options),locale:e,classNames:{...Yo(),...n.classNames}}},[n.locale,n.broadcastCalendar,n.weekStartsOn,n.firstWeekContainsDate,n.useAdditionalWeekYearTokens,n.useAdditionalDayOfYearTokens,n.timeZone,n.numerals,n.dateLib,n.noonSafe,n.components,n.formatters,n.labels,n.classNames]);n.today||(n={...n,today:c.today()});let{captionLayout:d,mode:m,navLayout:h,numberOfMonths:g=1,onDayBlur:_,onDayClick:v,onDayFocus:y,onDayKeyDown:b,onDayMouseEnter:x,onDayMouseLeave:S,onNextClick:C,onPrevClick:w,showWeekNumber:T,styles:E}=n,{formatCaption:D,formatDay:O,formatMonthDropdown:k,formatWeekNumber:A,formatWeekNumberHeader:j,formatWeekdayName:M,formatYearDropdown:N}=a,ee=Us(n,c),{days:P,months:F,navStart:I,navEnd:te,previousMonth:ne,nextMonth:L,goToMonth:R}=ee,re=Go(P,n,I,te,c),{isSelected:ie,select:z,selected:B}=rc(n,c)??{},{blur:ae,focused:oe,isFocusTarget:se,moveFocus:ce,setFocused:le}=Ys(n,ee,re,ie??(()=>!1),c),{labelDayButton:ue,labelGridcell:de,labelGrid:fe,labelMonthDropdown:pe,labelNav:me,labelPrevious:he,labelNext:ge,labelWeekday:_e,labelWeekNumber:ve,labelWeekNumberHeader:ye,labelYearDropdown:be}=s,xe=f(()=>Ss(c,n.ISOWeek,n.broadcastCalendar,n.today),[c,n.ISOWeek,n.broadcastCalendar,n.today]),Se=m!==void 0||v!==void 0,Ce=o(()=>{ne&&(R(ne),w?.(ne))},[ne,R,w]),we=o(()=>{L&&(R(L),C?.(L))},[R,L,C]),Te=o((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),le(e),!t.disabled&&(z?.(e.date,t,n),v?.(e.date,t,n))},[z,v,le]),Ee=o((e,t)=>n=>{le(e),y?.(e.date,t,n)},[y,le]),De=o((e,t)=>n=>{ae(),_?.(e.date,t,n)},[ae,_]),Oe=o((e,t)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,n.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,n.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];ce(e,t)}b?.(e.date,t,r)},[ce,b,n.dir]),ke=o((e,t)=>n=>{x?.(e.date,t,n)},[x]),Ae=o((e,t)=>n=>{S?.(e.date,t,n)},[S]),je=o((e,t)=>n=>{let r=Number(n.target.value),i=c.setMonth(c.startOfMonth(e),r);R(c.addMonths(i,-t))},[c,R]),Me=o((e,t)=>n=>{let r=Number(n.target.value),i=c.setYear(c.startOfMonth(e),r);R(c.addMonths(i,-t))},[c,R]),{className:Ne,style:Pe}=f(()=>({className:[u[K.Root],n.className].filter(Boolean).join(` `),style:{...E?.[K.Root],...n.style}}),[u,n.className,n.style,E]),Fe=Jo(n),Ie=e=>{let t=E?.[K.Dropdown],n=E?.[e];if(!(!t&&!n))return{...t,...n}},Le=p(null);Ms(Le,!!n.animate,{classNames:u,months:F,focused:oe,dateLib:c});let Re={dayPickerProps:n,selected:B,select:z,isSelected:ie,months:F,nextMonth:L,previousMonth:ne,goToMonth:R,getModifiers:re,components:i,classNames:u,styles:E,labels:s,formatters:a};return t.createElement(po.Provider,{value:Re},t.createElement(i.Root,{rootRef:n.animate?Le:void 0,className:Ne,style:Pe,dir:n.dir,id:n.id,lang:n.lang??l.code,nonce:n.nonce,title:n.title,role:n.role,"aria-label":n[`aria-label`],"aria-labelledby":n[`aria-labelledby`],...Fe},t.createElement(i.Months,{className:u[K.Months],style:E?.[K.Months]},!n.hideNavigation&&!h&&t.createElement(i.Nav,{"data-animated-nav":n.animate?`true`:void 0,className:u[K.Nav],style:E?.[K.Nav],"aria-label":me(),onPreviousClick:Ce,onNextClick:we,previousMonth:ne,nextMonth:L}),F.map((e,r)=>{let o=n.reverseMonths?F.length-1-r:r;return t.createElement(i.Month,{"data-animated-month":n.animate?`true`:void 0,className:u[K.Month],style:E?.[K.Month],key:r,displayIndex:r,calendarMonth:e},h===`around`&&!n.hideNavigation&&r===0&&t.createElement(i.PreviousMonthButton,{type:`button`,className:u[K.PreviousMonthButton],style:E?.[K.PreviousMonthButton],tabIndex:ne?void 0:-1,"aria-disabled":!ne||void 0,"aria-label":he(ne),onClick:Ce,"data-animated-button":n.animate?`true`:void 0},t.createElement(i.Chevron,{disabled:!ne||void 0,className:u[K.Chevron],style:E?.[K.Chevron],orientation:n.dir===`rtl`?`right`:`left`})),t.createElement(i.MonthCaption,{"data-animated-caption":n.animate?`true`:void 0,className:u[K.MonthCaption],style:E?.[K.MonthCaption],calendarMonth:e,displayIndex:r},d?.startsWith(`dropdown`)?t.createElement(i.DropdownNav,{className:u[K.Dropdowns],style:E?.[K.Dropdowns]},(()=>{let r=d===`dropdown`||d===`dropdown-months`?t.createElement(i.MonthsDropdown,{key:`month`,className:u[K.MonthsDropdown],"aria-label":pe(),disabled:!!n.disableNavigation,onChange:je(e.date,o),options:bs(e.date,I,te,a,c),style:Ie(K.MonthsDropdown),value:c.getMonth(e.date)}):t.createElement(`span`,{key:`month`},k(e.date,c)),s=d===`dropdown`||d===`dropdown-years`?t.createElement(i.YearsDropdown,{key:`year`,className:u[K.YearsDropdown],"aria-label":be(c.options),disabled:!!n.disableNavigation,onChange:Me(e.date,o),options:Cs(I,te,a,c,!!n.reverseYears),style:Ie(K.YearsDropdown),value:c.getYear(e.date)}):t.createElement(`span`,{key:`year`},N(e.date,c));return c.getMonthYearOrder()===`year-first`?[s,r]:[r,s]})(),t.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},D(e.date,c.options,c))):t.createElement(i.CaptionLabel,{className:u[K.CaptionLabel],style:E?.[K.CaptionLabel],role:`status`,"aria-live":`polite`},D(e.date,c.options,c))),h===`around`&&!n.hideNavigation&&r===g-1&&t.createElement(i.NextMonthButton,{type:`button`,className:u[K.NextMonthButton],style:E?.[K.NextMonthButton],tabIndex:L?void 0:-1,"aria-disabled":!L||void 0,"aria-label":ge(L),onClick:we,"data-animated-button":n.animate?`true`:void 0},t.createElement(i.Chevron,{disabled:!L||void 0,className:u[K.Chevron],style:E?.[K.Chevron],orientation:n.dir===`rtl`?`left`:`right`})),r===g-1&&h===`after`&&!n.hideNavigation&&t.createElement(i.Nav,{"data-animated-nav":n.animate?`true`:void 0,className:u[K.Nav],style:E?.[K.Nav],"aria-label":me(),onPreviousClick:Ce,onNextClick:we,previousMonth:ne,nextMonth:L}),t.createElement(i.MonthGrid,{role:`grid`,"aria-multiselectable":m===`multiple`||m===`range`,"aria-label":fe(e.date,c.options,c)||void 0,className:u[K.MonthGrid],style:E?.[K.MonthGrid]},!n.hideWeekdays&&t.createElement(i.Weekdays,{"data-animated-weekdays":n.animate?`true`:void 0,className:u[K.Weekdays],style:E?.[K.Weekdays]},T&&t.createElement(i.WeekNumberHeader,{"aria-label":ye(c.options),className:u[K.WeekNumberHeader],style:E?.[K.WeekNumberHeader],scope:`col`},j()),xe.map(e=>t.createElement(i.Weekday,{"aria-label":_e(e,c.options,c),className:u[K.Weekday],key:String(e),style:E?.[K.Weekday],scope:`col`},M(e,c.options,c)))),t.createElement(i.Weeks,{"data-animated-weeks":n.animate?`true`:void 0,className:u[K.Weeks],style:E?.[K.Weeks]},e.weeks.map(e=>t.createElement(i.Week,{className:u[K.Week],key:e.weekNumber,style:E?.[K.Week],week:e},T&&t.createElement(i.WeekNumber,{week:e,style:E?.[K.WeekNumber],"aria-label":ve(e.weekNumber,{locale:l}),className:u[K.WeekNumber],scope:`row`,role:`rowheader`},A(e.weekNumber,c)),e.days.map(e=>{let{date:r}=e,a=re(e);if(a[lo.focused]=!a.hidden&&!!oe?.isEqualTo(e),a[uo.selected]=ie?.(r)||a.selected,zo(B)){let{from:e,to:t}=B;a[uo.range_start]=!!(e&&t&&c.isSameDay(r,e)),a[uo.range_end]=!!(e&&t&&c.isSameDay(r,t)),a[uo.range_middle]=Lo(B,r,!0,c)}let o=xs(a,E,n.modifiersStyles),s=Ko(a,u,n.modifiersClassNames),l=!Se&&!a.hidden?de(r,a,c.options,c):void 0;return t.createElement(i.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:a,className:s.join(` `),style:o,role:`gridcell`,"aria-selected":a.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":a.selected||void 0,"data-disabled":a.disabled||void 0,"data-hidden":a.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":a.focused||void 0,"data-today":a.today||void 0},!a.hidden&&Se?t.createElement(i.DayButton,{className:u[K.DayButton],style:E?.[K.DayButton],type:`button`,day:e,modifiers:a,disabled:!a.focused&&a.disabled||void 0,"aria-disabled":a.focused&&a.disabled||void 0,tabIndex:se(e)?0:-1,"aria-label":ue(r,a,c.options,c),onClick:Te(e,a),onBlur:De(e,a),onFocus:Ee(e,a),onKeyDown:Oe(e,a),onMouseEnter:ke(e,a),onMouseLeave:Ae(e,a)},O(r,c.options,c)):!a.hidden&&O(e.date,c.options,c))}))))))})),n.footer&&t.createElement(i.Footer,{className:u[K.Footer],style:E?.[K.Footer],role:`status`,"aria-live":`polite`},n.footer)))}function lc({className:e,classNames:t,showOutsideDays:n=!0,captionLayout:r=`label`,buttonVariant:i=`ghost`,locale:a,formatters:o,components:s,...c}){let l=Yo();return b(cc,{showOutsideDays:n,className:U(`group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent`,String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,e),captionLayout:r,locale:a,formatters:{formatMonthDropdown:e=>e.toLocaleString(a?.code,{month:`short`}),...o},classNames:{root:U(`w-fit`,l.root),months:U(`relative flex flex-col gap-4 md:flex-row`,l.months),month:U(`flex w-full flex-col gap-4`,l.month),nav:U(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,l.nav),button_previous:U(vr({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,l.button_previous),button_next:U(vr({variant:i}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,l.button_next),month_caption:U(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,l.month_caption),dropdowns:U(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,l.dropdowns),dropdown_root:U(`relative rounded-(--cell-radius)`,l.dropdown_root),dropdown:U(`absolute inset-0 bg-popover opacity-0`,l.dropdown),caption_label:U(`font-medium select-none`,r===`label`?`text-sm`:`flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground`,l.caption_label),month_grid:U(`w-full border-collapse`,l.month_grid),weekdays:U(`flex`,l.weekdays),weekday:U(`flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none`,l.weekday),week:U(`mt-2 flex w-full`,l.week),week_number_header:U(`w-(--cell-size) select-none`,l.week_number_header),week_number:U(`text-[0.8rem] text-muted-foreground select-none`,l.week_number),day:U(`group/day relative aspect-square h-full w-full p-0 text-center select-none [&:has([data-range-start])]:rounded-l-(--cell-radius) [&:has([data-range-end])]:rounded-r-(--cell-radius) [&[data-outside][data-selected]_button]:bg-transparent [&[data-outside][data-selected]_button]:text-muted-foreground`,l.day),today:U(`rounded-(--cell-radius) text-foreground [&_button]:ring-1 [&_button]:ring-ring/60 data-[selected=true]:rounded-none`,l.today),outside:U(`text-muted-foreground aria-selected:text-muted-foreground`,l.outside),disabled:U(`text-muted-foreground opacity-50`,l.disabled),hidden:U(`invisible`,l.hidden),...t},components:{Root:({className:e,rootRef:t,...n})=>b(`div`,{"data-slot":`calendar`,ref:t,className:U(e),...n}),Chevron:({className:e,orientation:t,...n})=>b(t===`left`?bn:t===`right`?xn:yn,{className:U(`size-4`,e),...n}),DayButton:({...e})=>b(uc,{...e,...a===void 0?{}:{locale:a}}),WeekNumber:({children:e,...t})=>b(`td`,{...t,children:b(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:e})}),...s},...c})}function uc({className:t,day:n,modifiers:r,locale:i,...a}){let o=Yo(),s=e.useRef(null);return e.useEffect(()=>{r.focused&&s.current?.focus()},[r.focused]),b(G,{variant:`ghost`,size:`icon`,"data-day":n.date.toLocaleDateString(i?.code),"data-selected-single":r.selected&&!r.range_start&&!r.range_end&&!r.range_middle,"data-range-start":r.range_start||void 0,"data-range-end":r.range_end||void 0,"data-range-middle":r.range_middle||void 0,className:U(`relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:outline-2 group-data-[focused=true]/day:outline-offset-2 group-data-[focused=true]/day:outline-ring data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70`,o.day,t),...a})}function dc({className:e,...t}){return b(A.Root,{"data-slot":`checkbox`,className:U(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border-[1.5px] border-input bg-control transition-[background-color,border-color,scale] duration-150 ease-spring outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:outline-none after:absolute after:-inset-x-3 after:-inset-y-2 hover:border-muted-foreground active:scale-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:cursor-not-allowed disabled:opacity-40 aria-invalid:border-destructive data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground motion-reduce:active:scale-100`,e),...t,children:b(A.Indicator,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3 [&>svg]:stroke-3 [&_path]:[stroke-dasharray:24] [&_path]:animate-[check-draw_260ms_var(--ease-fluid)] motion-reduce:[&_path]:animate-none`,children:b(vn,{})})})}function fc({...e}){return b(j.Root,{"data-slot":`collapsible`,...e})}function pc({...e}){return b(j.Trigger,{"data-slot":`collapsible-trigger`,...e})}function mc({...e}){return b(j.Panel,{"data-slot":`collapsible-content`,...e})}M.Root;function hc(){let t=e.useRef(null);return e.useEffect(()=>{let e=t.current,n=e?.parentElement;if(!e||!n)return;let r=!1,i=null,a=new ResizeObserver(()=>o());a.observe(n);let o=()=>{let t=n.querySelector(`[data-highlighted]`);if(t!==i&&(i&&a.unobserve(i),t&&a.observe(t),i=t),!t){r=!1,e.style.opacity=`0`;return}let o=0,s=0;for(let e=t;e&&e!==n;e=e.offsetParent instanceof HTMLElement?e.offsetParent:null)o+=e.offsetLeft,s+=e.offsetTop;r||(e.style.transitionProperty=`opacity`),e.style.transform=`translate(${o}px, ${s}px)`,e.style.width=`${t.offsetWidth}px`,e.style.height=`${t.offsetHeight}px`,e.style.opacity=`1`,r||(e.getBoundingClientRect(),e.style.transitionProperty=``),r=!0},s=new MutationObserver(o);return s.observe(n,{subtree:!0,attributes:!0,attributeFilter:[`data-highlighted`]}),()=>{s.disconnect(),a.disconnect()}},[]),b(`span`,{ref:t,"aria-hidden":!0,"data-slot":`sliding-highlight`,className:`pointer-events-none absolute top-0 left-0 -z-1 rounded-md bg-accent opacity-0 transition-[transform,width,height,opacity] duration-200 ease-fluid motion-reduce:transition-none`})}function gc({...e}){return b(N.Root,{"data-slot":`context-menu`,...e})}function _c({...e}){return b(N.Trigger,{"data-slot":`context-menu-trigger`,...e})}function vc({align:e=`start`,alignOffset:t,side:n,sideOffset:r,className:i,children:a,...o}){return b(N.Portal,{children:b(N.Positioner,{className:`isolate z-50 outline-none`,align:e,...t===void 0?{}:{alignOffset:t},...n===void 0?{}:{side:n},...r===void 0?{}:{sideOffset:r},children:x(N.Popup,{"data-slot":`context-menu-content`,className:U(`relative z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover p-[5px] text-popover-foreground shadow-popup ring-1 ring-border duration-200 ease-fluid outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...o,children:[b(hc,{}),a]})})})}function q({className:e,inset:t,variant:n=`default`,...r}){return b(N.Item,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:U(`group/context-menu-item relative flex cursor-default items-center min-h-[30px] gap-2.5 rounded-md px-2.5 py-1 text-[13px] outline-hidden select-none data-inset:pl-[35px] data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-[15px] *:[svg]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function yc({...e}){return b(N.SubmenuRoot,{"data-slot":`context-menu-sub`,...e})}function bc({className:e,inset:t,children:n,...r}){return x(N.SubmenuTrigger,{"data-slot":`context-menu-sub-trigger`,"data-inset":t,className:U(`flex cursor-default items-center min-h-[30px] gap-2.5 rounded-md px-2.5 py-1 text-[13px] outline-hidden select-none data-inset:pl-[35px] data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-[15px] *:[svg]:text-muted-foreground`,e),...r,children:[n,b(xn,{className:`ml-auto`})]})}function xc({className:e,...t}){return b(vc,{"data-slot":`context-menu-sub-content`,className:U(`w-auto min-w-[96px] rounded-lg bg-popover p-[5px] text-popover-foreground shadow-lg ring-1 ring-foreground/10`,e),...t})}function Sc({className:e,...t}){return b(N.Separator,{"data-slot":`context-menu-separator`,className:U(`-mx-[5px] my-[5px] h-px bg-border`,e),...t})}function Cc({className:e,...t}){return b(`label`,{"data-slot":`label`,className:U(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function wc({className:e,children:t,...n}){return x(ee.Root,{"data-slot":`scroll-area`,className:U(`relative`,e),...n,children:[b(ee.Viewport,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`,children:t}),b(Tc,{}),b(ee.Corner,{})]})}function Tc({className:e,orientation:t=`vertical`,...n}){return b(ee.Scrollbar,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:U(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:b(ee.Thumb,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var Ec=P.Root;function Dc({className:e,...t}){return b(P.Value,{"data-slot":`select-value`,className:U(`flex flex-1 text-left`,e),...t})}function Oc({className:e,size:t=`default`,children:n,...r}){return x(P.Trigger,{"data-slot":`select-trigger`,"data-size":t,className:U(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-control py-2 pr-2 pl-2.5 text-[13px] whitespace-nowrap transition-colors duration-150 outline-none select-none hover:border-muted-foreground/60 focus-visible:border-primary data-popup-open:border-primary disabled:cursor-not-allowed disabled:border-border disabled:bg-muted disabled:text-muted-foreground aria-invalid:border-destructive data-placeholder:text-muted-foreground data-[size=default]:h-[30px] data-[size=sm]:h-[26px] data-[size=sm]:rounded-md *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[popup-open]:[&_svg]:rotate-180`,e),...r,children:[n,b(P.Icon,{render:b(yn,{className:`pointer-events-none size-4 text-muted-foreground transition-transform duration-200 ease-fluid`})})]})}function kc({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!1,...s}){return b(P.Portal,{children:b(P.Positioner,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:x(P.Popup,{"data-slot":`select-content`,"data-align-trigger":o,className:U(`relative isolate z-50 max-h-(--available-height) w-max max-w-[min(24rem,var(--available-width))] min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover text-popover-foreground shadow-popup ring-1 ring-border duration-200 ease-fluid data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:[b(hc,{}),b(jc,{}),b(P.List,{children:t}),b(Mc,{})]})})})}function Ac({className:e,children:t,...n}){return x(P.Item,{"data-slot":`select-item`,className:U(`relative flex w-full cursor-default items-center min-h-[30px] gap-2.5 rounded-md py-1 pr-8 pl-2.5 text-[13px] outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-[15px] *:[svg]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[b(P.ItemText,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),b(P.ItemIndicator,{render:b(`span`,{className:`pointer-events-none absolute right-2.5 flex size-4 items-center justify-center`}),children:b(vn,{className:`pointer-events-none`})})]})}function jc({className:e,...t}){return b(P.ScrollUpArrow,{"data-slot":`select-scroll-up-button`,className:U(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-[15px] *:[svg]:text-muted-foreground`,e),...t,children:b(Sn,{})})}function Mc({className:e,...t}){return b(P.ScrollDownArrow,{"data-slot":`select-scroll-down-button`,className:U(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-[15px] *:[svg]:text-muted-foreground`,e),...t,children:b(yn,{})})}function Nc({className:e,...t}){return b(Wn,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:U(`size-4 animate-spin`,e),...t})}function Pc({className:e,size:t=`default`,...n}){return b(F.Root,{"data-slot":`switch`,"data-size":t,className:U(`peer group/switch relative inline-flex shrink-0 items-center rounded-full p-0.5 transition-colors duration-200 outline-none group-has-[:focus-visible]/field-label:outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring aria-invalid:outline-2 aria-invalid:outline-destructive data-[size=default]:h-5 data-[size=default]:w-[34px] data-[size=sm]:h-4 data-[size=sm]:w-[26px] data-checked:bg-primary data-unchecked:bg-foreground/12 data-disabled:cursor-not-allowed data-disabled:opacity-40`,e),...n,children:b(F.Thumb,{"data-slot":`switch-thumb`,className:`pointer-events-none block h-4 w-4 rounded-full bg-white shadow-[0_1px_2px_rgb(0_0_0/0.25)] transition-[translate,width] duration-[260ms] ease-spring group-data-[size=sm]/switch:h-3 group-data-[size=sm]/switch:w-3 group-active/switch:w-5 group-data-[size=sm]/switch:group-active/switch:w-[15px] data-checked:translate-x-3.5 group-active/switch:data-checked:translate-x-2.5 group-data-[size=sm]/switch:data-checked:translate-x-2.5 group-data-[size=sm]/switch:group-active/switch:data-checked:translate-x-[7px] dark:data-checked:bg-primary-foreground motion-reduce:transition-none`})})}function Fc({className:e,orientation:t=`horizontal`,...n}){return b(I.Root,{"data-slot":`tabs`,"data-orientation":t,className:U(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Ic=_r(`group/tabs-list relative isolate inline-flex w-fit items-center justify-center text-muted-foreground group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col`,{variants:{variant:{default:`gap-0.5 rounded-lg bg-muted p-[3px] group-data-horizontal/tabs:h-[30px]`,line:`gap-1 bg-transparent group-data-horizontal/tabs:h-9`}},defaultVariants:{variant:`default`}}),Lc=_r(`absolute z-0 transition-[left,top,width,height] duration-[260ms] ease-spring motion-reduce:transition-none`,{variants:{variant:{default:`top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height) w-(--active-tab-width) rounded-md bg-background shadow-[0_1px_2px_rgb(0_0_0/0.1),0_1px_1px_rgb(0_0_0/0.04)] dark:bg-accent`,line:`rounded-full bg-foreground group-data-horizontal/tabs:bottom-0 group-data-horizontal/tabs:left-(--active-tab-left) group-data-horizontal/tabs:h-0.5 group-data-horizontal/tabs:w-(--active-tab-width) group-data-vertical/tabs:top-(--active-tab-top) group-data-vertical/tabs:right-0 group-data-vertical/tabs:h-(--active-tab-height) group-data-vertical/tabs:w-0.5`}},defaultVariants:{variant:`default`}});function Rc({className:e,variant:t=`default`,children:n,...r}){return x(I.List,{"data-slot":`tabs-list`,"data-variant":t,className:U(Ic({variant:t}),e),...r,children:[n,b(I.Indicator,{"data-slot":`tabs-indicator`,className:Lc({variant:t})})]})}function zc({className:e,...t}){return b(I.Tab,{"data-slot":`tabs-trigger`,className:U(`relative z-1 inline-flex h-full flex-1 items-center justify-center gap-1.5 rounded-md px-2.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors duration-150 outline-none group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-1.5 group-data-[variant=line]/tabs-list:px-2 hover:text-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-40 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-disabled:pointer-events-none aria-disabled:opacity-40 data-active:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...t})}function Bc(e){let t=l();return`${e??t}`}var Vc=typeof window<`u`?d:c;function Hc(e){let t=p(e);return Vc(()=>{t.current=e},[e]),o((...e)=>t.current?.(...e),[t])}function Uc(...e){return Hc(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Wc(e,t=`Assertion error`){if(!e)throw Error(t)}n(null);var Gc;function Kc(){return Gc===void 0&&(Gc=typeof matchMedia==`function`&&!!matchMedia(`(pointer:coarse)`).matches),Gc}function qc({expandHitTargets:e,axis:t,rect:n}){let r=e?Kc()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(n.width<r){let e=r-n.width;n=new DOMRect(n.x-e/2,n.y,n.width+e,n.height)}if(n.height<r){let e=r-n.height;n=new DOMRect(n.x,n.y-e/2,n.width,n.height+e)}return n}function Jc(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}var Yc=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0){if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},Xc={cursorFlags:0,state:`inactive`},Zc=new Yc;function Qc(){return Xc}function $c(e){return Zc.addListener(`change`,e)}function el(e,t=[],n,r=!1){let i=Xc,a={...Xc};a.cursorFlags=e,a.state===`active`&&(a.didPointerMove||=r,a.previews=t,n&&(a.previewLayoutMap=n)),Xc=a,Zc.emit(`change`,{prev:i,next:a})}function tl(e){let t=Xc;Xc=e,t.state===`active`&&e.state!==`active`&&t.didPointerMove&&t.hitRegions.forEach(({separator:e})=>{e&&e.element.ownerDocument.activeElement===e.element&&e.element.blur()}),Zc.emit(`change`,{prev:t,next:e})}function nl(e){Xc.state!==`active`||!Xc.previews.some(t=>t.separator===e)||tl({...Xc,previews:Xc.previews.map(t=>t.separator===e?{...t}:t)})}function rl(e){if(Xc.state===`inactive`)return!1;let t=Xc.hitRegions.filter(t=>t.axis!==e),n=Xc.state===`active`&&Xc.previews.some(t=>t.axis===e);if(t.length===Xc.hitRegions.length&&!n)return!1;if(t.length===0)tl({cursorFlags:0,state:`inactive`});else if(Xc.state===`active`){let n=new Map(Xc.initialLayoutMap),r=new Map(Xc.previewLayoutMap);n.delete(e),r.delete(e),tl({...Xc,cursorFlags:0,hitRegions:t,initialLayoutMap:n,previewLayoutMap:r,previews:Xc.previews.filter(t=>t.axis!==e)})}else tl({...Xc,hitRegions:t});return!0}var il=e=>e,al=()=>{},ol=1,sl=2,cl=4,ll=8,ul=3,dl=12,fl;function pl(){return fl===void 0&&(fl=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(fl=!0)),fl}function ml({cursorFlags:e,axes:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(r!==0||i!==0){if(n===`active`&&e&&pl()){let t=(e&ol)!==0,n=(e&sl)!==0,r=(e&cl)!==0,i=(e&ll)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}return pl()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var hl=new WeakMap;function gl(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=hl.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Qc();switch(r.state){case`active`:case`hover`:{let e=ml({cursorFlags:r.cursorFlags,axes:r.hitRegions.map(e=>e.axis),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0)}hl.set(e,{prevStyle:t,styleSheet:n})}function _l({axis:e}){let{layoutStrategy:t,orientation:n,items:r}=e;return t?t.calculateAvailableSize():r.reduce((e,t)=>(e+=n===`horizontal`?t.element.offsetWidth:t.element.offsetHeight,e),0)}function vl(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_DISCONNECTED?0:n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0}function yl(e,t){return Array.from(t).sort((t,n)=>{let r=e===`horizontal`?bl(t,n):xl(t,n);return r===0?vl(t.element,n.element):r})}function bl(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function xl(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function Sl(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Cl(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function wl({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Cl(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Wc(i,`No rect found`),i}function Tl({expandHitTargets:e=!0,axis:t,includeDisabled:n=!1}){if(t.layoutStrategy)return t.layoutStrategy.calculateHitRegions({expandHitTargets:e,axis:t,includeDisabled:n});let{element:r,orientation:i,items:a,separators:o}=t,s=yl(i,Array.from(r.children).filter(Sl).filter(e=>!e.hasAttribute(`data-resize-preview`)).map(e=>({element:e}))).map(({element:e})=>e),c=[],l=!1,u=!1,d=-1,f,p=-1,m=0,h,g=[];{let e=-1;for(let t of s)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(m++,d===-1&&(d=e),p=e))}if(n||m>1){let r=-1;for(let m of s)if(m.hasAttribute(`data-panel`)){r++;let o=a.find(e=>e.element===m);if(o){if(h){let a=h.element.getBoundingClientRect(),s=m.getBoundingClientRect(),_;if(u){let e=i===`horizontal`?new DOMRect(a.right,a.top,0,a.height):new DOMRect(a.left,a.bottom,a.width,0),t=i===`horizontal`?new DOMRect(s.left,s.top,0,s.height):new DOMRect(s.left,s.top,s.width,0);switch(g.length){case 0:_=[e,t];break;case 1:{let n=g[0];_=[n,wl({orientation:i,rects:[a,s],targetRect:n.element.getBoundingClientRect()})===a?t:e];break}default:_=g}}else _=g.length?g:[i===`horizontal`?new DOMRect(a.right,s.top,s.left-a.right,s.height):new DOMRect(s.left,a.bottom,s.width,s.top-a.bottom)];for(let i of _){let a=qc({expandHitTargets:e,axis:t,rect:`width`in i?i:i.element.getBoundingClientRect()});(n||!l&&!(r<=d||r>p))&&(f??=_l({axis:t}),c.push({axis:t,axisSize:f,items:[h,o],separator:`width`in i?void 0:i,rect:a})),l=!1}}u=!1,h=o,g=[]}}else if(m.hasAttribute(`data-separator`)){m.ariaDisabled!==null&&(l=!0);let e=o.find(e=>e.element===m);e?g.push(e):(h=void 0,g=[])}else u=!0}return c}function El(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Dl(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Ol(e){return e/100*window.innerHeight}function kl(e){return e/100*window.innerWidth}function Al({axisSize:e,itemElement:t,styleProp:n}){let r,[i,a]=Jc(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Dl(t,i);break;case`em`:r=El(t,i);break;case`vh`:r=Ol(i);break;case`vw`:r=kl(i)}return r}function jl(e){return parseFloat(e.toFixed(3))}function Ml(e){let{items:t}=e,n=_l({axis:e});return n===0?t.map(e=>({groupResizeBehavior:e.constraintProps.groupResizeBehavior,collapsedSize:0,collapsible:e.constraintProps.collapsible===!0,defaultSize:void 0,disabled:e.constraintProps.disabled,minSize:0,maxSize:100,itemId:e.id})):t.map(e=>{let{element:t,constraintProps:r}=e,i=0;r.collapsedSize!==void 0&&(i=jl(Al({axisSize:n,itemElement:t,styleProp:r.collapsedSize})/n*100));let a;r.collapsedThreshold!==void 0&&(a=jl(Al({axisSize:n,itemElement:t,styleProp:r.collapsedThreshold})/n*100));let o;r.defaultSize!==void 0&&(o=jl(Al({axisSize:n,itemElement:t,styleProp:r.defaultSize})/n*100));let s=0;r.minSize!==void 0&&(s=jl(Al({axisSize:n,itemElement:t,styleProp:r.minSize})/n*100));let c=100;return r.maxSize!==void 0&&(c=jl(Al({axisSize:n,itemElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsedThreshold:a,collapsible:r.collapsible===!0,defaultSize:o,disabled:r.disabled,minSize:s,maxSize:c,itemId:e.id}})}var Nl=new Map,Pl=new Yc;function Fl(e){Nl=new Map(Nl),Nl.delete(e)}function Il(e,t){for(let[t]of Nl)if(t.id===e)return t}function Ll(e,t){for(let[t,n]of Nl)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Rl(){return Nl}function zl(e,t){return Pl.addListener(`axisChange`,n=>{n.axis.id===e&&t(n)})}function Bl(e,t,n){let r=Nl.get(e);Nl=new Map(Nl),Nl.set(e,t),Pl.emit(`axisChange`,{axis:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function Vl(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Hl(e,t,n=0){return Math.abs(jl(e)-jl(t))<=n}function Ul(e,t){return Hl(e,t)?0:e>t?1:-1}function Wl({overrideDisabledItems:e,itemConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsedThreshold:a,collapsible:o,disabled:s,maxSize:c=100,minSize:l=0}=t;if(s&&!e)return n;if(Ul(r,l)<0){if(o){let e=a??(l-i)/2,t=Ul(n,i)<=0,o=t?i+e:l-e,s=Ul(r,o);r=Ul(r,i)<=0||s<0||a!==void 0&&t&&s===0?i:l}else r=l}return r=Math.min(c,r),r=jl(r),r}function Gl({delta:e,initialLayout:t,itemConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Hl(e,0))return t;let o=a===`imperative-api`,s=n.map(({itemId:e})=>t[e]),c=n.map(({itemId:e})=>i[e]),l=[...s],[u,d]=r;Wc(u!=null,`Invalid first pivot index`),Wc(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Wc(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Wc(n!=null,`Previous layout not found for panel index ${t}`),Hl(n,i)){let t=o-n;Ul(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Wc(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(Wc(n!=null,`Previous layout not found for panel index ${t}`),Hl(n,o)){let t=n-i;Ul(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Wc(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsedSize:a,collapsedThreshold:o,collapsible:c,minSize:l}=r;if(c&&Ul(i,l)<0){let t=l-a,n=o??t/2;if(Ul(i+Math.abs(e),l)<0){let r=Ul(Math.abs(e),n);e=r>0||r===0&&o===void 0&&e<0?e<0?-t:t:0}}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];Wc(e!=null,`Previous layout not found for panel index ${r}`);let a=Wl({overrideDisabledItems:o,itemConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Wc(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Wl({overrideDisabledItems:o,itemConstraints:n[t],prevSize:i,size:a});if(!Hl(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(Vl(c,l))return i;{let t=e<0?d:u,r=s[t];Wc(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Wl({overrideDisabledItems:o,itemConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Hl(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Wc(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Wl({overrideDisabledItems:o,itemConstraints:n[r],prevSize:i,size:a});if(Hl(i,s)||(t-=s-i,l[r]=s),Hl(t,0))break;e>0?r--:r++}}}return Hl(Object.values(l).reduce((e,t)=>t+e,0),100,.1)?l.reduce((e,t,r)=>(e[n[r].itemId]=t,e),{}):i}function Kl(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Ul(e[n],t[n])!==0)return!1;return!0}function ql({commit:e,document:t,event:n,hitRegions:r,initialLayoutMap:i,mountedAxes:a,pointerDownAtPoint:o,prevCursorFlags:s}){let c=0,l=Qc(),u=l.state===`active`?l.previews:[],d=new Map(l.state===`active`?l.previewLayoutMap:void 0);r.forEach(t=>{let{axis:r,axisSize:s}=t,{orientation:l,items:f}=r;if(e&&r.resizePreviewMode!==`separator`)return;let{disableCursor:p}=r.mutableState,m=0;m=o?l===`horizontal`?(n.clientX-o.x)/s*100:(n.clientY-o.y)/s*100:l===`horizontal`?n.clientX<0?-100:100:n.clientY<0?-100:100;let h=i.get(r),g=a.get(r);if(!h||!g)return;let{defaultLayoutDeferred:_,derivedItemConstraints:v,axisSize:y,layout:b,separatorToItems:x}=g;if(v&&b&&x){let n=r.resizePreviewMode===`separator`?d.get(r)??b:b,i=Gl({delta:m,initialLayout:h,itemConstraints:v,pivotIndices:t.items.map(e=>f.indexOf(e)),prevLayout:n,trigger:`mouse-or-touch`});if(r.resizePreviewMode===`separator`&&!e&&!Kl(i,n)){d.set(r,i);let e=0,t=f.map(t=>(e+=i[t.id]-h[t.id],s/100*e));u=u.map(e=>{if(e.axis!==r)return e;let n=t[e.itemIndex];return n===e.offset?e:{...e,offset:n}})}if(Kl(i,n)&&m!==0&&!p)switch(l){case`horizontal`:c|=m<0?ol:sl;break;case`vertical`:c|=m<0?cl:ll;break}(r.resizePreviewMode!==`separator`||e)&&!Kl(i,b)&&Bl(t.axis,{defaultLayoutDeferred:_,derivedItemConstraints:v,axisSize:y,layout:i,requestedAxisSize:y,requestedLayout:i,separatorToItems:x})}});let f=0;n.movementX===0?f|=s&ul:f|=c&ul,n.movementY===0?f|=s&dl:f|=c&dl;let p=l.state===`active`&&(n.clientX!==l.pointerDownAtPoint.x||n.clientY!==l.pointerDownAtPoint.y);el(f,u,d,p),gl(t)}function Jl(e,t){let n=Qc(),r=Rl(),i=!1;return n.state===`active`&&(ql({commit:!0,document:e,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:r,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),tl({cursorFlags:0,state:`inactive`}),n.hitRegions.length>0&&(gl(e),i=!0,n.hitRegions.forEach(e=>{if(!r.has(e.axis))return;let t=Ll(e.axis.id,!0);Bl(e.axis,t,{isUserInteraction:!0})}))),i}function Yl(e){e.defaultPrevented||Jl(e.currentTarget,e)}function Xl(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Cl(n,a.rect);switch(e){case`horizontal`:(t.x<i.x||t.x===i.x&&t.y<=i.y)&&(r=a,i=t);break;case`vertical`:(t.y<i.y||t.y===i.y&&t.x<=i.x)&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}function Zl(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ql(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:iu(e),b:iu(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Wc(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:ru(nu(n.a)),b:ru(nu(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var $l=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function eu(e){let t=getComputedStyle(au(e)??e).display;return t===`flex`||t===`inline-flex`}function tu(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||eu(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||$l.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function nu(e){let t=e.length;for(;t--;){let n=e[t];if(Wc(n,`Missing node`),tu(n))return n}return null}function ru(e){return e&&Number(getComputedStyle(e).zIndex)||0}function iu(e){let t=[];for(;e;)t.push(e),e=au(e);return t}function au(e){let{parentNode:t}=e;return Zl(t)?t.host:t}function ou(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function su(e){try{return e.matches(`:modal`)}catch{return!1}}function cu({axisElement:e,hitRegion:t,pointerEventTarget:n}){if(Sl(n)){let t=n.closest(`dialog`);if(t&&!t.contains(e)&&su(t))return!1}if(!Sl(n)||n.contains(e)||e.contains(n))return!0;if(Ql(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ou(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function lu(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Tl({axis:r}),a=Xl(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&cu({axisElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function uu({layout:e,itemConstraints:t}){let n=t.map(({itemId:t})=>e[t]),r=[...n],i=r.reduce((e,t)=>e+t,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map(e=>`${e}%`).join(`, `)}`);if(!Hl(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Wc(t!=null,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];Wc(i!=null,`No layout data found for index ${e}`);let o=r[e];Wc(o!=null,`No layout data found for index ${e}`);let s=Wl({overrideDisabledItems:!0,itemConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Hl(a,0))for(let e=0;e<t.length;e++){let n=r[e];Wc(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Wl({overrideDisabledItems:!0,itemConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Hl(a,0)))break}return r.reduce((e,n,r)=>(e[t[r].itemId]=n,e),{})}function du({axisId:e,itemId:t}){let n=()=>{let t=Rl();for(let[n,{defaultLayoutDeferred:r,derivedItemConstraints:i,layout:a,axisSize:o,separatorToItems:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedItemConstraints:i,axis:n,axisSize:o,layout:a,separatorToItems:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedItemConstraints.find(e=>e.itemId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().axis.items.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,items:n,prevLayout:r,derivedItemConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Hl(n.collapsedSize,r[n.itemId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:jl(100-e)}}return Gl({delta:l?o-e:e-o,initialLayout:r,itemConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedItemConstraints:r,axis:i,axisSize:s,layout:c,separatorToItems:l}=n(),u=uu({layout:o({nextSize:e,items:i.items,prevLayout:c,derivedItemConstraints:r}),itemConstraints:r});Kl(c,u)||Bl(i,{defaultLayoutDeferred:t,derivedItemConstraints:r,axisSize:s,layout:u,requestedAxisSize:s,requestedLayout:u,separatorToItems:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{axis:e}=n(),r=a(),{element:o}=i();return{asPercentage:r,inPixels:e.layoutStrategy?e.layoutStrategy.getItemSizeInPixels(t):e.orientation===`horizontal`?o.offsetWidth:o.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Hl(t,n)},resize:e=>{let{axis:t}=n(),{element:r}=i(),a=_l({axis:t}),o=jl(Al({axisSize:a,itemElement:r,styleProp:e})/a*100);s(o)}}}function fu(e){e.defaultPrevented||lu(e,Rl()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.items.find(e=>e.constraintProps.defaultSize!==void 0);if(n){let r=n.constraintProps.defaultSize,i=du({axisId:t.axis.id,itemId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function pu(e){let t=Rl();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function mu({axisId:e}){let t=()=>{let t=Rl();for(let[n,r]of t)if(n.id===e)return{axis:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedItemConstraints:r,axis:i,axisSize:a,layout:o,separatorToItems:s}=t(),c=uu({layout:e,itemConstraints:r});return n?o:(Kl(o,c)||Bl(i,{defaultLayoutDeferred:n,derivedItemConstraints:r,axisSize:a,layout:c,requestedAxisSize:a,requestedLayout:c,separatorToItems:s}),c)}}}function hu(e,t){let n=pu(e),r=Ll(n.id,!0),i=n.separators.find(t=>t.element===e);Wc(i,`Matching separator not found`);let a=r.separatorToItems.get(i);Wc(a,`Matching panels not found`);let o=a.map(e=>n.items.indexOf(e)),s=mu({axisId:n.id}).getLayout(),c=uu({layout:Gl({delta:t,initialLayout:s,itemConstraints:r.derivedItemConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),itemConstraints:r.derivedItemConstraints});Kl(s,c)||Bl(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedItemConstraints:r.derivedItemConstraints,axisSize:r.axisSize,layout:c,requestedAxisSize:r.axisSize,requestedLayout:c,separatorToItems:r.separatorToItems},{isUserInteraction:!0})}function gu(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=pu(t);if(!(n.disabled||n.separators.find(e=>e.element===t)?.disabled))switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&hu(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&hu(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&hu(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&hu(t,-5);break;case`End`:e.preventDefault(),hu(t,100);break;case`Enter`:{e.preventDefault();let{derivedItemConstraints:r,layout:i,separatorToItems:a}=Ll(n.id,!0),o=n.separators.find(e=>e.element===t);Wc(o,`Matching separator not found`);let s=a.get(o);Wc(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.itemId===c.id);if(Wc(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];hu(t,(l.collapsedSize===e?n.mutableState.expandedItemSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let t=n.separators.map(e=>e.element),r=Array.from(t).findIndex(t=>t===e.currentTarget);Wc(r!==null,`Index not found`),t[e.shiftKey?r>0?r-1:t.length-1:r+1<t.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),hu(t,-100);break}}function _u(e,t){let{element:n,orientation:r,items:i}=e,a=n.getBoundingClientRect(),o=r===`horizontal`;return Tl({expandHitTargets:!1,axis:e,includeDisabled:!0}).map(({items:r,rect:s,separator:c},l)=>{let u=i.indexOf(r[0]),d=o?s.left+s.width/2:s.top+s.height/2;return{active:t.some(t=>{if(t.axis!==e||t.items[0]!==r[0])return!1;if(c||t.separator)return t.separator===c;let n=o?t.rect.left+t.rect.width/2:t.rect.top+t.rect.height/2;return Hl(d,n)}),axis:e,key:c?`separator-${c.id}`:`panel-${r[0].id}-${l}`,offset:0,itemIndex:u,rect:new DOMRect((o&&!c?d:s.left)-a.left-n.clientLeft+n.scrollLeft,(!o&&!c?d:s.top)-a.top-n.clientTop+n.scrollTop,o&&!c?0:s.width,!o&&!c?0:s.height),separator:c}})}function vu(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Rl(),n=lu(e,t);if(n.length===0)return;let r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.axis);n&&r.set(e.axis,n.layout)});let a=Array.from(r.keys()).flatMap(e=>e.resizePreviewMode===`separator`?_u(e,n):[]);tl({cursorFlags:0,didPointerMove:!1,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},previewLayoutMap:new Map(r),previews:a,state:`active`}),e.preventDefault()}function yu(e){let t=Rl(),n=Qc();n.state===`active`&&ql({commit:!1,document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedAxes:t,prevCursorFlags:n.cursorFlags})}function bu(e){if(e.defaultPrevented)return;let t=Qc(),n=Rl();switch(t.state){case`active`:if(e.buttons===0){t.previewLayoutMap.forEach((e,t)=>{let r=n.get(t);t.resizePreviewMode===`separator`&&r&&!Kl(e,r.layout)&&Bl(t,{...r,layout:e,requestedAxisSize:r.axisSize,requestedLayout:e})}),tl({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{if(!n.has(e.axis))return;let t=Ll(e.axis.id,!0);Bl(e.axis,t,{isUserInteraction:!0})}),gl(e.currentTarget);return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.isConnected&&!t.hasPointerCapture?.(e.pointerId)&&t.setPointerCapture?.(e.pointerId)}ql({commit:!1,document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedAxes:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=lu(e,n);r.length===0?t.state!==`inactive`&&tl({cursorFlags:0,state:`inactive`}):tl({cursorFlags:0,hitRegions:r,state:`hover`}),gl(e.currentTarget);break}}}function xu(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Qc().state){case`hover`:tl({cursorFlags:0,state:`inactive`})}}function Su(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||Jl(e.currentTarget,e)&&e.preventDefault()}function Cu(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=jl(i.defaultSize);n+=e,r[i.itemId]=e}else r[i.itemId]=void 0;let i=e.length-t;if(i!==0){let t=jl((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.itemId]=t)}return r}function wu(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}function Tu({axis:e,itemConstraints:t}){let n=e.items.map(({id:e})=>e).join(`,`),r=e.mutableState.defaultLayout;return e.mutableState.layouts[n]??(r&&wu(e.items,r)?r:Cu(t))}function Eu({itemIds:e,layout:t}){return uu({layout:t,itemConstraints:e.map(e=>({collapsedSize:0,collapsible:!1,defaultSize:void 0,disabled:void 0,itemId:e,maxSize:100,minSize:0}))})}function Du(e,t,n){if(!n[0])return;let r=e.items.find(e=>e.element===t);if(!r||!r.onResize)return;let i=_l({axis:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:jl(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Ou(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ku(e,t){return e.length===t.length&&e.every((e,n)=>Ou(e,t[n]))}function Au({axis:e,nextAxisSize:t,prevAxisSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.items){let e=r[l.id]??0;switch(l.constraintProps.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=jl(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=jl((r[e]??0)/a*l);else{let e=jl(l/c.length);for(let t of c)u[t]=e}return u}var ju=new Map;function Mu(e){let t=!0;Wc(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=_l({axis:e});if(t===0)return;let n=Ll(e.id);if(!n)return;let r=Ml(e),i=n.requestedAxisSize,a=n.requestedLayout;n.defaultLayoutDeferred&&(i=t,a=Eu({itemIds:e.items.map(({id:e})=>e),layout:Tu({axis:e,itemConstraints:r})}));let o=uu({layout:Au({axis:e,nextAxisSize:t,prevAxisSize:i,prevLayout:a}),itemConstraints:r});if(!n.defaultLayoutDeferred&&Kl(n.layout,o)&&ku(n.derivedItemConstraints,r)&&n.axisSize===t)continue;Bl(e,{defaultLayoutDeferred:!1,derivedItemConstraints:r,axisSize:t,layout:o,requestedAxisSize:i,requestedLayout:a,separatorToItems:n.separatorToItems})}}else Du(e,i,n)}});a.observe(e.element),e.items.forEach(e=>{Wc(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=_l({axis:e}),s=Ml(e),c=Tu({axis:e,itemConstraints:s}),l=uu({layout:c,itemConstraints:s}),u=e.element.ownerDocument;ju.set(u,(ju.get(u)??0)+1);let d=new Map;return Tl({axis:e,includeDisabled:!0}).forEach(e=>{e.separator&&d.set(e.separator,e.items)}),Bl(e,{defaultLayoutDeferred:o===0,derivedItemConstraints:s,axisSize:o,layout:l,requestedAxisSize:o,requestedLayout:Eu({itemIds:e.items.map(({id:e})=>e),layout:c}),separatorToItems:d}),e.separators.forEach(e=>{Wc(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,gu)}),ju.get(u)===1&&(u.addEventListener(`contextmenu`,Yl,!0),u.addEventListener(`dblclick`,fu,!0),u.addEventListener(`pointerdown`,vu,!0),u.addEventListener(`pointerleave`,yu),u.addEventListener(`pointermove`,bu),u.addEventListener(`pointerout`,xu),u.addEventListener(`pointerup`,Su,!0)),function(){t=!1,ju.set(u,Math.max(0,(ju.get(u)??0)-1)),Fl(e),rl(e)&&gl(u),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,gu)}),ju.get(u)||(u.removeEventListener(`contextmenu`,Yl,!0),u.removeEventListener(`dblclick`,fu,!0),u.removeEventListener(`pointerdown`,vu,!0),u.removeEventListener(`pointerleave`,yu),u.removeEventListener(`pointermove`,bu),u.removeEventListener(`pointerout`,xu),u.removeEventListener(`pointerup`,Su,!0)),a.disconnect()}}function Nu({derivedItemConstraints:e,axis:t,layout:n,prevLayout:r,requestedLayout:i}){let a=t.items.map(({id:e})=>e).join(`,`);t.mutableState.layouts[a]=i,r&&e.forEach(e=>{if(e.collapsible){let i=Hl(e.collapsedSize,n[e.itemId]),a=Hl(e.collapsedSize,r[e.itemId]);i&&!a&&(t.mutableState.expandedItemSizes[e.itemId]=r[e.itemId])}})}function Pu(){let[e,t]=m({});return[e,o(()=>t({}),[])]}function Fu(e){let t=p({...e});return Vc(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Iu=n(null);function Lu({layout:e,itemConstraints:t,itemId:n,itemIndex:r}){let i,a,o=e[n],s=t.find(e=>e.itemId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=uu({layout:Gl({delta:l-o,initialLayout:e,itemConstraints:t,pivotIndices:u,prevLayout:e}),itemConstraints:t})[n],i=uu({layout:Gl({delta:c-o,initialLayout:e,itemConstraints:t,pivotIndices:u,prevLayout:e}),itemConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Ru({attributes:e,axisId:t,axisOrientation:n,children:r,className:i,disableCursor:a,disabled:o,disableDoubleClick:s,elementRef:l,id:u,isSharedHitRegion:d,preview:f,registerSeparator:h,requiredStyle:g,style:_,styleDefaults:v,tabIndex:y=0,updateSeparatorProps:x}){let S=Fu({disabled:o,disableDoubleClick:s,children:r,className:i,preview:f,style:_}),[C,w]=m({}),[T,E]=m(`inactive`),[D,O]=m(!1),k=p(null),A=p(null),j=Uc(k,l),M=n===`horizontal`?`vertical`:`horizontal`;Vc(()=>{let e=k.current;if(e!==null){let n={disabled:S.disabled,disableDoubleClick:S.disableDoubleClick,element:e,id:u,get children(){return S.children},get className(){return S.className},get preview(){return S.preview},get style(){return S.style}};A.current=n;let r=h(n),i=$c(e=>{E(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===n||(d?.(e)??!1))?e.next.state:`inactive`)}),a=zl(t,e=>{let{derivedItemConstraints:t,layout:r,separatorToItems:i}=e.next,a=i.get(n);if(a){let n=a[0],i=t.findIndex(e=>e.itemId===n.id),{layoutStrategy:o}=e.axis;w({...Lu({layout:r,itemConstraints:t,itemId:n.id,itemIndex:i}),...o?.getItemAriaControls&&{valueControls:o.getItemAriaControls(n.id)}})}});return()=>{A.current=null,i(),a(),r()}}},[t,u,d,h,S]),Vc(()=>{let e=A.current;e&&nl(e)},[f]),c(()=>{x(u,{disabled:o,disableDoubleClick:s})},[o,s,u,x]);let N;o&&!a&&(N=`not-allowed`);let ee;if(o)ee=`disabled`;else switch(T){case`active`:ee=`active`;break;default:ee=D?`focus`:T}return b(`div`,{...e,"aria-controls":C.valueControls,"aria-disabled":o||void 0,"aria-orientation":M,"aria-valuemax":C.valueMax,"aria-valuemin":C.valueMin,"aria-valuenow":C.valueNow,children:r,className:i,"data-separator":ee,"data-testid":u,id:u,onBlur:()=>O(!1),onFocus:()=>O(!0),ref:j,role:`separator`,style:{...v,cursor:N,..._,...g,touchAction:`none`},tabIndex:o?void 0:y})}function zu(e){for(let t=1;t<e.length;t++)if(vl(e[t-1],e[t])>0)return!1;return!0}function Bu({separator:e}){let{element:t}=e,n=p(null);return Vc(()=>{let e=t.cloneNode(!0),r=[t,...t.querySelectorAll(`*`)],i=[e,...e.querySelectorAll(`*`)],a=t.ownerDocument.defaultView;return r.forEach((e,t)=>{let n=i[t];if(n instanceof a.HTMLElement||n instanceof a.SVGElement){let t=a.getComputedStyle(e);for(let e=0;e<t.length;e++){let r=t.item(e);n.style.setProperty(r,t.getPropertyValue(r))}}n.removeAttribute(`data-testid`),n.removeAttribute(`id`)}),Object.assign(e.style,{boxSizing:`border-box`,height:`100%`,margin:`0`,position:`static`,transform:`none`,width:`100%`}),n.current.appendChild(e),()=>e.remove()},[t]),b(`div`,{ref:n,style:{height:`100%`,opacity:.65,pointerEvents:`none`,width:`100%`}})}function Vu(){let e=s(Iu);return Wc(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Hu(e){let{registerOverlay:t}=Vu(),n=p(e);Ou(n.current,e)||(n.current=e);let r=n.current;return Vc(()=>t(r),[t,r]),null}Hu.displayName=`SeparatorOverlay`;function Uu({active:e,orientation:t,style:n,...r}){let i;switch(t){case`horizontal`:i={height:`100%`,minWidth:`1px`};break;case`vertical`:i={minHeight:`1px`,width:`100%`}}return b(`div`,{...r,"data-separator-overlay":e?`active`:`inactive`,style:{...i,...n,flexShrink:0,pointerEvents:`none`}})}function Wu({overlay:e,preview:t}){let{axis:n,offset:r,rect:i,separator:o}=t,s=n.orientation===`horizontal`,c=o?.preview,l=e;return a(c)&&c.type===Hu&&(l=c.props,c=void 0),c??(l?c=b(Uu,{...l,active:t.active,orientation:n.orientation}):o&&(c=b(Bu,{separator:o}))),b(`div`,{"aria-hidden":`true`,"data-resize-preview":!0,inert:!0,style:{height:i.height,left:i.left,pointerEvents:`none`,position:`absolute`,top:i.top,transform:s?`translateX(${r}px)`:`translateY(${r}px)`,width:i.width},children:c})}function Gu(e){return Array.from(e).sort(vl)}function Ku(e,t){let n=p({getLayout:()=>({}),setLayout:il});u(t,()=>n.current,[]),Vc(()=>{Object.assign(n.current,mu({axisId:e}))})}function qu({groupId:e,resizePreviewMode:t}){let[n,r]=m([]),i=p(n);return Vc(()=>{let n=n=>{let a=Il(e),o=t===`separator`&&n.state===`active`?n.previews.filter(e=>e.axis===a&&(e.active||!Hl(e.offset,0))):[],s=i.current;s.length===o.length&&o.every((e,t)=>e===s[t])||(i.current=o,r(o))};if(t!==`separator`){n(Qc());return}let a=$c(({next:e})=>n(e));return n(Qc()),a},[e,t]),n}function Ju({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:l,onLayoutChanged:u,orientation:d=`horizontal`,resizePreviewMode:h=`panel`,resizeTargetMinimumSize:g={coarse:20,fine:10},style:_,...v}){let y=p({onLayoutChange:{},onLayoutChanged:{}}),S=Hc(e=>{Kl(y.current.onLayoutChange,e)||(y.current.onLayoutChange=e,l?.(e))}),C=Hc((e,t,n)=>{Kl(y.current.onLayoutChanged,e)||(y.current.onLayoutChanged=e,u?.(e,{isUserInteraction:t,requestedLayout:n}))}),w=Bc(s),[T,E]=m(),D=qu({groupId:w,resizePreviewMode:h}),O=p(null),[k,A]=Pu(),j=p([]),M=p({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),N=Uc(O,a);Ku(w,o);let ee=Hc((e,t)=>{let r=Ll(e);if(r)return{flexGrow:r.layout[t]??1};if(n?.[t])return{flexGrow:n?.[t]}}),P=Fu({defaultLayout:n,disableCursor:r,resizeTargetMinimumSize:g}),F=f(()=>({get disableCursor(){return!!P.disableCursor},getPanelStyles:ee,id:w,orientation:d,registerPanel:e=>{let t=M.current;return t.panels=yl(d,[...t.panels,e]),A(),()=>{t.panels=t.panels.filter(t=>t!==e),A()}},registerOverlay:e=>(E(e),()=>{E(void 0)}),registerSeparator:e=>{let t=M.current;return t.separators=yl(d,[...t.separators,e]),A(),()=>{t.separators=t.separators.filter(t=>t!==e),A()}},updatePanelProps:(e,{disabled:t})=>{let n=M.current.panels.find(t=>t.id===e);n&&(n.constraintProps.disabled=t);let r=Il(w),i=Ll(w);r&&i&&Bl(r,{...i,derivedItemConstraints:Ml(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=M.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[ee,w,A,d,P]),I=p(null);return Vc(()=>{let e=O.current;if(e===null)return;let t=M.current;t.panels=yl(d,t.panels),t.separators=yl(d,t.separators),j.current=Gu([...t.panels.map(({element:e})=>e),...t.separators.map(({element:e})=>e)]);let n;if(P.defaultLayout!==void 0&&Object.keys(P.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=P.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:w,mutableState:{defaultLayout:n,disableCursor:!!P.disableCursor,expandedItemSizes:M.current.lastExpandedPanelSizes,layouts:M.current.layouts},orientation:d,items:t.panels,resizePreviewMode:h,get resizeTargetMinimumSize(){return P.resizeTargetMinimumSize},separators:t.separators};I.current=r;let a=Mu(r),{defaultLayoutDeferred:o,derivedItemConstraints:s,layout:c,requestedLayout:l}=Ll(r.id,!0);!o&&s.length>0&&(S(c),C(c,!1,l));let u=zl(w,e=>{let{defaultLayoutDeferred:t,derivedItemConstraints:n,layout:i,requestedLayout:a}=e.next;if(t||n.length===0)return;Nu({derivedItemConstraints:n,axis:r,layout:i,prevLayout:e.prev?.layout,requestedLayout:a});let o=Qc(),s=o.state!==`active`||!o.hitRegions.some(e=>e.axis===r);S(i),s&&C(i,e.isUserInteraction,a)});return()=>{I.current=null,a(),u()}},[i,w,C,S,d,k,h,P]),Vc(()=>{zu(j.current)||A()}),c(()=>{let e=I.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),b(Iu.Provider,{value:F,children:x(`div`,{...v,className:t,"data-group":!0,"data-testid":w,id:w,ref:N,style:{height:`100%`,width:`100%`,overflow:`hidden`,position:h===`separator`?`relative`:void 0,..._,display:`flex`,flexDirection:d===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:d===`horizontal`?`pan-y`:`pan-x`},children:[e,D.map(e=>b(Wu,{overlay:T,preview:e},e.key))]})})}Ju.displayName=`Group`;function Yu(e,t){let{id:n}=Vu(),r=p({collapse:al,expand:al,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:al});u(t,()=>r.current,[]),Vc(()=>{Object.assign(r.current,du({axisId:n,itemId:e}))})}function Xu({children:e,className:t,collapsedSize:n=`0%`,collapsedThreshold:r,collapsible:i=!1,defaultSize:a,disabled:o,elementRef:s,groupResizeBehavior:l=`preserve-relative-size`,id:u,maxSize:d=`100%`,minSize:f=`0%`,onResize:m,panelRef:g,style:_,...v}){let y=!!u,x=Bc(u),S=Fu({disabled:o}),C=p(null),w=Uc(C,s),{getPanelStyles:T,id:E,orientation:D,registerPanel:O,updatePanelProps:k}=Vu(),A=m!==null,j=Hc((e,t,n)=>{m?.(e,u,n)});Vc(()=>{let e=C.current;if(e!==null){let t={element:e,id:x,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:A?j:void 0,constraintProps:{groupResizeBehavior:l,collapsedSize:n,collapsedThreshold:r,collapsible:i,defaultSize:a,disabled:S.disabled,maxSize:d,minSize:f}};return O(t)}},[l,n,r,i,a,A,x,y,d,f,j,O,S]),c(()=>{k(x,{disabled:o})},[o,x,k]),Yu(x,g);let M=()=>{let e=T(E,x);if(e)return JSON.stringify(e)},N=h(e=>zl(E,e),M,M),ee;return ee=N?JSON.parse(N):a===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:a},b(`div`,{...v,"data-disabled":o||void 0,"data-panel":!0,"data-testid":x,id:x,ref:w,style:{...Zu,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...ee},children:b(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,..._,touchAction:D===`horizontal`?`pan-y`:`pan-x`},children:e})})}Xu.displayName=`Panel`;var Zu={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0},Qu={flexBasis:`auto`},$u={flexGrow:0,flexShrink:0};function ed({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,preview:o,style:s,...c}){let l=Bc(a),{disableCursor:u,id:d,orientation:f,registerSeparator:p,updateSeparatorProps:m}=Vu();return b(Ru,{attributes:c,axisId:d,axisOrientation:f,className:t,disableCursor:u,disabled:n,disableDoubleClick:r,elementRef:i,id:l,preview:o,registerSeparator:p,requiredStyle:$u,style:s,styleDefaults:Qu,updateSeparatorProps:m,children:e})}ed.displayName=`Separator`;function td({className:e,...t}){return b(Ju,{"data-slot":`resizable-panel-group`,className:U(`flex h-full w-full aria-[orientation=vertical]:flex-col`,e),...t})}function nd({...e}){return b(Xu,{"data-slot":`resizable-panel`,...e})}function rd({withHandle:e,className:t,...n}){return b(ed,{"data-slot":`resizable-handle`,className:U(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,t),...n,children:e&&b(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`})})}e.createContext(null);var id=`onebot-sandbox`;function J(){let t=re(),n=ie(id);return e.useMemo(()=>(e,t)=>n(e,t),[n,t])}function ad(e,t){return t.type===`main`?e(`sandbox.source.main`):t.name}function od(){let t=e.useRef(null),[n,r]=e.useState(0);return e.useLayoutEffect(()=>{let e=t.current;if(!e)return;r(e.offsetWidth);let n=new ResizeObserver(()=>r(e.offsetWidth));return n.observe(e),()=>n.disconnect()},[]),[t,n]}function sd(e){return e.kind===`user`}function cd(e){return e.kind===`bot`}function ld(e){return e.participants.filter(sd)}function ud(e){return e.participants.filter(cd)}function dd(e,t){let[n,r]=[e,t].sort();return`private:${n}:${r}`}function fd(e){return`group:${e}`}function pd(e){return e.forwardId&&(e.sourceMessageId||e.content.trim()===`[合并转发]`)?``:e.content}function md(e){return e?.lifecycle?.status===`recalled`}function hd(e,t){return`${t||e.lifecycle.operatorId} 撤回了一条消息`}function gd(e){let t={id:e.id,kind:`root`,rootConversationId:e.id,...e.hasMoreMessages?{hasMoreMessages:!0}:{}};return e.type===`direct`?{...t,type:`direct`,participantIds:e.participantIds}:{...t,type:`group`,groupId:e.groupId}}function _d(e,t){let n=vd(e,t.rootConversationId);if(!n)return;let r={id:t.id,kind:`instance`,rootConversationId:n.id,title:t.title,...t.hasMoreMessages?{hasMoreMessages:!0}:{}};return n.type===`direct`?{...r,type:`direct`,participantIds:n.participantIds}:{...r,type:`group`,groupId:n.groupId}}function vd(e,t){return e.conversations.find(({id:e})=>e===t)}function yd(e){return Array.isArray(e.conversationInstances)?e.conversationInstances:[]}function bd(e,t){return yd(e).find(({id:e})=>e===t)}function xd(e,t){return vd(e,t)??bd(e,t)}function Sd(e){let t=`forkPoint`in e?e.forkPoint:void 0;if(!(!t||typeof t!=`object`))return typeof t.conversationId==`string`&&typeof t.messageId==`string`?t:void 0}function Cd(e,t,n){let r=Sd(t);if(!r)return t.messageIds;if(n.has(t.id))return[];n.add(t.id);let i=xd(e,r.conversationId);if(!i)return t.messageIds;let a=Cd(e,i,n),o=a.indexOf(r.messageId);return o<0?t.messageIds:[...a.slice(0,o+1),...t.messageIds]}function wd(e,t){let n=xd(e,t);return n?Cd(e,n,new Set):[]}function Td(e,t){return!!t&&e.conversationId!==t}function Ed(e){return e.conversations.map(gd)}function Dd(e){return yd(e).flatMap(t=>{let n=_d(e,t);return n?[n]:[]})}function Od(e){return[...Ed(e),...Dd(e)]}function kd(e,t,n){return t.type===`direct`?!!t.participantIds?.includes(n):!!e.groups.find(({id:e})=>e===t.groupId)?.members.some(e=>e.participantId===n)}function Ad(e,t,n){let r=vd(e,dd(t,n));return r?gd(r):void 0}function jd(e,t){let n=vd(e,fd(t));return n?gd(n):void 0}function Md(e,t){if(e.type!==`direct`)return;let n=e.participantIds;return n?.find(e=>e!==t)??n?.[0]}function Nd(e,t){return t?e.participants.filter(({id:e})=>e!==t).map(n=>{let r=e.friendships.find(({participantIds:e})=>e.includes(t)&&e.includes(n.id)),i=e.requests.some(({type:e,requesterId:r,targetId:i})=>e===`friend`&&r===t&&i===n.id),a=e.requests.some(({type:e,requesterId:r,targetId:i})=>e===`friend`&&r===n.id&&i===t),o=n.kind===`bot`,s=Ad(e,t,n.id)?.id;return{id:n.id,isBot:o,isFriend:!!r,pendingOutgoing:i,pendingIncoming:a,conversationId:s,avatar:n.avatar,displayName:r?.remarks[t]||n.name,statusKey:r?o?`sandbox.relation.botFriend`:`sandbox.relation.friend`:i?`sandbox.relation.outgoing`:a?`sandbox.relation.incoming`:o?`sandbox.relation.botMissing`:`sandbox.relation.missing`,participantName:n.name,relation:r?`added`:i||a?`pending`:`missing`}}):[]}function Pd(e,t){return t?e.groups.map(n=>{let r=n.members.find(({participantId:e})=>e===t),i=e.requests.some(({type:e,subType:r,requesterId:i,groupId:a})=>e===`group`&&(r??`add`)===`add`&&i===t&&a===n.id),a=r?jd(e,n.id)?.id:void 0;return{...n,member:r,pending:i,conversationId:a,relation:r?`joined`:i?`pending`:`missing`}}):[]}function Fd(e,t){let n=e.participants.find(({id:e})=>e===t.currentOperatorId)??e.participants.find(({kind:e})=>e===`user`)??e.participants[0],r=n?Od(e).filter(t=>kd(e,t,n.id)):[],i=r.find(({id:e})=>e===t.activeConversationId)??r[0];return{currentOperatorId:n?.id,activeConversationId:i?.id}}async function Id(e,t){try{return await ne(e,t??{})}catch(e){throw Error(zd(e))}}var Ld=e=>e;function Rd(e){Ld=e}function zd(e,t=Ld(`sandbox.common.failed`)){return(e instanceof Error?e.message:typeof e==`string`?e:``).trim().split(/\r?\n/,1)[0]?.replace(/^Error:\s*/,``)||t}var Bd=/^sandbox-media:\/\/([a-f0-9]{32})$/;function Vd(e){return e?.match(Bd)?.[1]}function Hd(e){return`chatluna.onebot-sandbox.selection.${e??`main`}`}function Ud(e){let t=z(Hd(e));if(!t||typeof t!=`object`)return{};let n=t;return{currentOperatorId:typeof n.currentOperatorId==`string`?n.currentOperatorId:void 0,activeConversationId:typeof n.activeConversationId==`string`?n.activeConversationId:void 0}}var Wd=class{spaceId;view={media:{},mediaFailures:{}};listeners=new Set;refreshTask;pendingRefresh=!1;mediaLoading=new Set;disposed=!1;constructor(e){this.spaceId=e}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getView=()=>this.view;activate(){this.disposed=!1}dispose(){this.disposed=!0}set(e){if(!this.disposed){this.view={...this.view,...e};for(let e of this.listeners)e()}}scoped(e){return this.spaceId?{...e,spaceId:this.spaceId}:e}get snapshot(){return this.view.workspace?.snapshot}requireOperatorId(){let e=this.view.currentOperatorId;if(!e)throw Error(Ld(`sandbox.error.noOperator`));return e}saveSelection(){B(Hd(this.spaceId),{currentOperatorId:this.view.currentOperatorId,activeConversationId:this.view.activeConversationId})}replaceWorkspace(e,t={},n=!0){let r=Fd(e.snapshot,{currentOperatorId:t.currentOperatorId??this.view.currentOperatorId,activeConversationId:t.activeConversationId??this.view.activeConversationId});this.set({workspace:e,currentOperatorId:r.currentOperatorId,activeConversationId:r.activeConversationId,loadError:void 0}),n&&this.saveSelection(),this.loadVisibleMedia()}seed(e){this.replaceWorkspace(e,Ud(this.spaceId),!1)}async load(){let e=Ud(this.spaceId);try{let t;try{t=await Id(`onebot-sandbox.workspace`,this.scoped(e.currentOperatorId?{operatorId:e.currentOperatorId}:{}))}catch{t=await Id(`onebot-sandbox.workspace`,this.scoped({}))}this.replaceWorkspace(t,e)}catch(e){this.set({loadError:zd(e,Ld(`sandbox.error.loadWorkspace`))})}}notifySceneChanged(){this.pendingRefresh=!0,!this.refreshTask&&(this.refreshTask=(async()=>{try{for(;this.pendingRefresh&&!this.disposed;){this.pendingRefresh=!1;let e=this.view.currentOperatorId;try{let t=await Id(`onebot-sandbox.workspace`,this.scoped(e?{operatorId:e}:{}));t.snapshot.revision>=(this.snapshot?.revision??0)&&this.replaceWorkspace(t)}catch{}}}finally{this.refreshTask=void 0}})())}selectConversation(e){this.set({activeConversationId:e}),this.saveSelection()}async selectOperator(e){let t=await Id(`onebot-sandbox.workspace`,this.scoped({operatorId:e}));this.set({currentOperatorId:e}),this.replaceWorkspace(t,{currentOperatorId:e})}async mutate(e,t){let n=await Id(e,this.scoped({...t,operatorId:this.requireOperatorId()}));return n&&typeof n==`object`&&`snapshot`in n&&this.replaceWorkspace(n),n}sendMessage(e){return this.mutate(`onebot-sandbox.send-message`,e)}sendMediaMessage(e){return this.mutate(`onebot-sandbox.send-media-message`,e)}sendForwardMessage(e){return this.mutate(`onebot-sandbox.send-forward-message`,e)}recallMessage(e){return this.mutate(`onebot-sandbox.recall-message`,e)}clearConversationMessages(e){return this.mutate(`onebot-sandbox.clear-conversation-messages`,e)}setMessageReaction(e){return this.mutate(`onebot-sandbox.set-message-reaction`,e)}async createConversationInstance(e){let{conversationId:t}=await this.mutate(`onebot-sandbox.create-conversation-instance`,{rootConversationId:e});return this.selectConversation(t),t}async branchConversationInstance(e){let{conversationId:t}=await this.mutate(`onebot-sandbox.branch-conversation-instance`,e);return this.selectConversation(t),t}renameConversationInstance(e){return this.mutate(`onebot-sandbox.rename-conversation-instance`,e)}deleteConversationInstance(e){return this.mutate(`onebot-sandbox.delete-conversation-instance`,{conversationId:e})}performFriendAction(e){return this.mutate(`onebot-sandbox.friend-action`,e)}performGroupAction(e){return this.mutate(`onebot-sandbox.group-action`,e)}handleRelationshipRequest(e,t){let n=this.snapshot?.requests.find(({id:t})=>t===e);if(!n)throw Error(Ld(`sandbox.error.requestMissing`));return n.type===`group`?this.performGroupAction({action:`handle-request`,requestId:e,approve:t}):this.performFriendAction({action:`handle-request`,requestId:e,approve:t})}setGroupAnnouncement(e){return this.mutate(`onebot-sandbox.set-group-announcement`,e)}deleteGroupAnnouncement(e){return this.mutate(`onebot-sandbox.delete-group-announcement`,e)}async manageEnvironment(e){let t=this.view.currentOperatorId,n=await Id(`onebot-sandbox.manage-environment`,this.scoped(e)),r=(e.action===`delete-user`||e.action===`delete-bot`)&&e.data.id===t;this.replaceWorkspace(t&&!r?await Id(`onebot-sandbox.workspace`,this.scoped({operatorId:t})):n)}searchConversationMessages(e){return Id(`onebot-sandbox.search-conversation-messages`,this.scoped({...e,operatorId:this.requireOperatorId()}))}async getForwardMessage(e){let t=await Id(`onebot-sandbox.get-forward-message`,this.scoped({...e,operatorId:this.requireOperatorId()})),n=this.view.workspace;return n&&!(n.snapshot.forwards??[]).some(({id:e})=>e===t.id)&&(this.set({workspace:{...n,snapshot:{...n.snapshot,forwards:[...n.snapshot.forwards??[],t]}}}),this.loadVisibleMedia()),t}async loadEarlierMessages(e){let t=this.view.workspace;if(!t)return;let n=wd(t.snapshot,e)[0];if(!n)return;let r=await Id(`onebot-sandbox.message-history`,this.scoped({operatorId:this.requireOperatorId(),conversationId:e,beforeMessageId:n,limit:50})),i=this.view.workspace??t,a=i.snapshot,o=new Set(a.messages.map(({id:e})=>e)),s=new Set((a.forwards??[]).map(({id:e})=>e)),c=t=>t.map(t=>t.id===e?{...t,messageIds:[...r.messages.map(({id:e})=>e),...t.messageIds],hasMoreMessages:!!r.nextBeforeMessageId}:t);this.set({workspace:{...i,snapshot:{...a,conversations:c(a.conversations),conversationInstances:c(a.conversationInstances??[]),messages:[...r.messages.filter(({id:e})=>!o.has(e)),...a.messages],forwards:[...a.forwards??[],...(r.forwards??[]).filter(({id:e})=>!s.has(e))]}}}),this.loadVisibleMedia()}resolveAvatar(e){let t=Vd(e);return t?this.view.media[t]??``:e??``}async loadVisibleMedia(){let e=this.snapshot,t=this.view.currentOperatorId;if(!e||!t)return;let n=[...e.messages.flatMap(({media:e})=>e?.map(({id:e})=>e)??[]),...(e.forwards??[]).flatMap(({nodes:e})=>e.flatMap(({media:e})=>e?.map(({id:e})=>e)??[])),...[...e.participants.map(({avatar:e})=>e),...e.groups.map(({avatar:e})=>e)].flatMap(e=>Vd(e)??[])],r=[...new Set(n)].filter(e=>!this.view.media[e]&&!this.mediaLoading.has(e));await Promise.all(r.map(async e=>{this.mediaLoading.add(e);try{let n=await Id(`onebot-sandbox.media-content`,this.scoped({operatorId:t,mediaId:e})),{[e]:r,...i}=this.view.mediaFailures;this.set({media:{...this.view.media,[e]:`data:${n.mimeType};base64,${n.dataBase64}`},mediaFailures:i})}catch{this.set({mediaFailures:{...this.view.mediaFailures,[e]:!0}})}finally{this.mediaLoading.delete(e)}}))}};function Gd(e,t){return t?Od(e).filter(n=>kd(e,n,t)):[]}function Kd(e,t){if(!t)return[];let n=wd(e,t),r=new Map(e.messages.map(e=>[e.id,e]));return n.flatMap(e=>r.get(e)??[])}var qd=e.createContext(void 0);function Jd(){let t=e.useContext(qd);if(!t)throw Error(`useSandbox must be used inside SandboxProvider`);return t}function Yd(){let{derived:e}=Jd();if(!e)throw Error(`workspace is not loaded`);return e}function Xd(e,t){let n=e.workspace;if(!n)return;let r=n.snapshot,i=e.currentOperatorId,a=r.participants.find(({id:e})=>e===i),o=Gd(r,i),s=o.find(({id:t})=>t===e.activeConversationId),c=s?Md(s,i):void 0,l=ud(r).find(({id:e})=>e===c),u=l??ld(r).find(({id:e})=>e===c),d=e=>t.resolveAvatar(e),f=Object.fromEntries(r.participants.map(({id:e,name:t,avatar:n,kind:r})=>[e,{name:t,avatar:d(n),isBot:r===`bot`}]));return{workspace:n,snapshot:r,operator:a,operatorId:i,conversations:o,conversation:s,group:r.groups.find(({id:e})=>e===s?.groupId),peer:u,bot:l,participants:f,participantNames:Object.fromEntries(r.participants.map(({id:e,name:t})=>[e,t])),resolveAvatar:d,media:e.media,mediaFailures:e.mediaFailures}}function Zd({store:t,dialogs:n,children:r}){let i=e.useSyncExternalStore(t.subscribe,t.getView,t.getView),a=e.useMemo(()=>Xd(i,t),[i,t]),o=e.useCallback(async(e,t)=>{try{return await t(),!0}catch(t){return L.error(e,{description:zd(t)}),!1}},[]),s=e.useMemo(()=>({store:t,view:i,derived:a,run:o,dialogs:n}),[t,i,a,o,n]);return b(qd.Provider,{value:s,children:r})}var Qd={recall:!1,react:!1,reply:!1,branch:!1,forward:!1};function $d(e,t){let{message:n}=t;switch(e){case`reply`:return n.event?`event-message`:md(n)?`recalled-message`:void 0;case`branch`:return n.event?`event-message`:void 0;case`forward`:return n.event?`event-message`:md(n)?`recalled-message`:void 0;case`react`:return tf(t)??(t.operatorId?void 0:`no-operator`);case`recall`:return tf(t)??nf(t)}}function ef(e){return{recall:!$d(`recall`,e),react:!$d(`react`,e),reply:!$d(`reply`,e),branch:!$d(`branch`,e),forward:!$d(`forward`,e)}}function tf({message:e,conversation:t}){return e.event?`event-message`:md(e)?`recalled-message`:Td(e,t.id)?`inherited-prefix`:void 0}function nf({message:e,operatorId:t,group:n}){if(!t)return`no-operator`;if(e.authorId===t)return;if(!n)return`not-own-message`;let r=rf(n,t);if(!r)return`actor-not-in-group`;let i=rf(n,e.authorId);if(!i)return`author-not-in-group`;if(r.role===`member`)return`requires-group-authority`;if(i.role===`owner`||r.role===`admin`&&i.role===`admin`)return`target-outranks-actor`}function rf(e,t){return e.members.find(e=>e.participantId===t)}function af(e){let t=e.conversation;return t?Object.fromEntries(e.messages.map(n=>[n.id,ef({message:n,conversation:t,operatorId:e.operatorId,group:e.group})])):{}}function of(e,t,n){let r=e[t],i=e[t-1];return!r||!i?!1:!Td(r,n)&&Td(i,n)}function sf(e,t){return e.replace(/<at\s+id="([^"]+)"\s*\/>/g,(e,n)=>`@${t[n]??n}`)}function cf(e){return e.type===`image`?`图片`:e.type===`audio`?`语音`:e.type===`video`?`视频`:`文件`}function lf(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function uf(e,t){return!!e.event||md(e)&&!t.markRecalledMessages}function df(e,t){return md(e)?hd(e,t(e.lifecycle?.operatorId??e.authorId)):e.content}function ff(e){return e.chatLuna?.thought?e.chatLuna:void 0}function pf(e){let t=e.chatLuna;return t&&!t.thought&&t.usage?t:void 0}function mf(e,t){return!!ff(e)&&!(md(e)&&!t.markRecalledMessages)}function hf(e,t){return!!pf(e)&&!(md(e)&&!t.markRecalledMessages)}function gf(e,t){if(e.forwardId)return``;let n=e.media;return n?.length===1&&e.content===`[${cf(n[0])}] ${n[0].name}`?``:sf(e.content,t.participantNames)}function _f(e,t){return e.replyToMessageId?t.replyMessages[e.replyToMessageId]:void 0}function vf(e,t){return e.forwardId?t.forwardPreviews[e.id]:void 0}function yf(e,t){return t.messageCapabilities[e.id]??Qd}function bf(e,t){return Td(e,t.currentConversationId)}function xf(e,t,n){return of(e,t,n.currentConversationId)}function Sf(e,t,n){let r=n.currentOperatorId;if(!yf(e,n).react||!r)return;let i=e.reactions?.find(e=>e.emojiId===t);return{messageId:e.id,emojiId:t,enabled:!i?.participantIds.includes(r)}}function Cf(e){let t=pd(e).replace(/\s+/g,` `).trim();return[t,...!t&&e.media?.length?e.media.map(e=>`[${cf(e)}] ${e.name}`):[],...e.forwardId?[`[合并转发]`]:[]].filter(Boolean).join(` `)||`[消息]`}function wf(e){return{title:e.title??`群聊的聊天记录`,total:e.nodes.length,lines:e.nodes.slice(0,4).map(e=>`${e.nickname}:${Cf(e)}`)}}function Tf(e,t){let n=new Map(t.map(e=>[e.id,e]));return Object.fromEntries(e.flatMap(e=>{if(!e.forwardId)return[];let t=n.get(e.forwardId);return t?[[e.id,wf(t)]]:[]}))}function Ef(e){return e}var Df=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`});function Of(e){let t=new Map;for(let n of e.conversations){if(n.kind!==`instance`)continue;let r=t.get(n.rootConversationId)??[];r.push({...Af(e,n),kind:`instance`}),t.set(n.rootConversationId,r)}return e.conversations.filter(({kind:e})=>e===`root`).map(n=>({...Af(e,n),kind:`root`,children:t.get(n.id)??[]}))}function kf(e){return e.map(({id:e,title:t,preview:n,avatar:r,avatarKind:i})=>({conversationId:e,title:t,subtitle:n,avatar:r,avatarKind:i}))}function Af(e,t){let{scene:n,operatorId:r}=e,i=e.resolveAvatar??Ef,a=t.type===`group`?n.groups.find(({id:e})=>e===t.groupId):void 0,o=Md(t,r),s=ud(n).find(({id:e})=>e===o),c=s??ld(n).find(({id:e})=>e===o),l=jf(n,t.id);return{id:t.id,groupId:a?.id,kind:t.kind,title:t.title??a?.name??c?.name??t.id,avatar:i(a?.avatar??c?.avatar),avatarKind:a?`group`:s?`bot`:`user`,preview:l?Mf(n,l):e.emptyPreview??``,time:l?.createdAt?Df.format(new Date(l.createdAt)):``,actorRole:a?.members.find(({participantId:e})=>e===r)?.role,entityTarget:a?{type:`group`,id:a.id}:{type:s?`bot`:`user`,id:o??``}}}function jf(e,t){let n=new Set(wd(e,t));return e.messages.filter(({id:e})=>n.has(e)).at(-1)}function Mf(e,t){let n=Object.fromEntries(e.participants.map(({id:e,name:t})=>[e,t]));if(!md(t))return sf(t.content,n);let r=t.lifecycle.operatorId;return hd(t,n[r]??r)}function Nf(e,t,n){return n===`push`?[...e,t]:[t]}function Pf(){return[]}async function Ff(e){let t;try{t=await e.load(e.input)}catch{return}let n=await Promise.all(t.nodes.map(e=>e.forwardId).filter(e=>!!e).map(async t=>{try{return[t,await e.load({forwardId:t})]}catch{return}}));return{title:wf(t).title,items:t.nodes.map(e=>({...e})),nestedForwards:Object.fromEntries(n.filter(e=>!!e))}}var If={active:!1,messageIds:[]};function Lf(e,t){return t.messageCapabilities[e]?.forward??!1}function Rf(e,t){if(Lf(e,t))return{active:!0,messageIds:[e]}}function zf(e,t,n){return!e.active||!Lf(t,n)?e:e.messageIds.includes(t)?{active:!0,messageIds:e.messageIds.filter(e=>e!==t)}:{active:!0,messageIds:[...e.messageIds,t]}}function Bf(){return If}function Vf(e,t,n){let r=e.messageIds.filter(e=>Lf(e,n));return r.length?{kind:`send`,conversationId:t,messageIds:r}:{kind:`reject`}}function Hf({kind:t,name:n=``,src:r,className:i,badge:a=!0}){let[o,s]=e.useState(!1),c=r&&!r.startsWith(`sandbox-media:`)?r:``;return e.useEffect(()=>s(!1),[c]),x(`span`,{className:U(`relative inline-flex size-9 shrink-0 select-none`,i),children:[b(`span`,{className:`flex size-full items-center justify-center overflow-hidden rounded-full bg-muted text-[13px] font-medium text-muted-foreground`,children:c&&!o?b(`img`,{src:c,alt:n,className:`size-full object-cover`,onError:()=>s(!0)}):n.trim().slice(0,1).toUpperCase()||`?`}),a&&t!==`user`&&b(`span`,{className:`absolute -right-0.5 -bottom-0.5 flex size-3.5 items-center justify-center rounded-full bg-background ring-1 ring-border`,children:t===`bot`?b(pn,{className:`size-2.5 text-primary`}):b(fr,{className:`size-2.5 text-muted-foreground`})})]})}var Uf=typeof window<`u`,Wf=Uf?window:null,Gf=Uf?document:null,Kf={OBJECT:0,ATTRIBUTE:1,CSS:2,TRANSFORM:3,CSS_VAR:4},qf={NUMBER:0,UNIT:1,COLOR:2,COMPLEX:3},Jf={NONE:0,AUTO:1,FORCE:2},Yf={replace:0,none:1,blend:2},Xf=Symbol(),Zf=Symbol(),Qf=Symbol(),$f=Symbol(),ep=Symbol(),tp=1e-11,np=0xe8d4a51000,rp=1e3,ip=[],ap=(()=>{let e=new Map;return e.set(`x`,`translateX`),e.set(`y`,`translateY`),e.set(`z`,`translateZ`),e})(),op=[`perspective`,`translateX`,`translateY`,`translateZ`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`scale`,`scaleX`,`scaleY`,`scaleZ`,`skew`,`skewX`,`skewY`],sp=op.reduce((e,t)=>({...e,[t]:t+`(`}),{}),cp=()=>{},lp=e=>e,up=/\)\s*[-.\d]/,dp=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,fp=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,pp=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,mp=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,hp=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,gp=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,_p=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,vp=/([a-z])([A-Z])/g,yp=/(\*=|\+=|-=)/,bp=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,xp={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:rp,delay:0,loopDelay:0,ease:`out(2)`,composition:Yf.replace,modifier:lp,onBegin:cp,onBeforeUpdate:cp,onUpdate:cp,onLoop:cp,onPause:cp,onComplete:cp,onRender:cp},Sp={current:null,root:Gf},Y={defaults:xp,precision:4,timeScale:1,tickThreshold:200,editor:null},Cp={version:`4.5.0`,engine:null};Uf&&(Wf.AnimeJS||=[],Wf.AnimeJS.push(Cp));var wp=e=>e.replace(vp,`$1-$2`).toLowerCase(),Tp=(e,t)=>e.indexOf(t)===0,Ep=Date.now,Dp=Array.isArray,Op=e=>e&&e.constructor===Object,kp=e=>typeof e==`number`&&!isNaN(e),Ap=e=>typeof e==`string`,jp=e=>typeof e==`function`,X=e=>e===void 0,Mp=e=>X(e)||e===null,Np=e=>Uf&&e instanceof SVGElement,Pp=e=>dp.test(e),Fp=e=>Tp(e,`rgb`),Ip=e=>Tp(e,`hsl`),Lp=e=>Pp(e)||(Fp(e)||Ip(e))&&(e[e.length-1]===`)`||!up.test(e)),Rp=e=>!Y.defaults.hasOwnProperty(e),zp=[`opacity`,`rotate`,`overflow`,`color`],Bp=(e,t)=>{if(zp.includes(t))return!1;if(e.getAttribute(t)||t in e){if(t===`scale`){let t=e.parentNode;return t&&t.tagName===`filter`}return!0}},Vp=Math.pow,Hp=Math.sqrt,Up=Math.sin,Wp=Math.cos,Gp=Math.abs,Kp=Math.exp,qp=Math.floor,Jp=Math.asin,Yp=Math.PI,Xp=Math.round,Zp=(e,t,n)=>e<t?t:e>n?n:e,Qp=(e,t)=>{if(t<0)return e;if(!t)return Xp(e);let n=10**t;return Xp(e*n)/n},$p=(e,t,n)=>n===1?t:n===0?e:e+(t-e)*n,em=e=>e===1/0?np:e===-1/0?-np:e,tm=e=>e<=1e-11?tp:em(Qp(e,11)),nm=e=>Dp(e)?[...e]:e,rm=(e,t)=>{let n={...e};for(let r in t){let i=e[r];n[r]=X(i)?t[r]:i}return n},im=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._head,o=i;for(n&&(a=e._tail,o=r);a;){let e=a[o];t(a),a=e}},am=(e,t,n=`_prev`,r=`_next`)=>{let i=t[n],a=t[r];i?i[r]=a:e._head=a,a?a[n]=i:e._tail=i,t[n]=null,t[r]=null},om=(e,t,n,r=`_prev`,i=`_next`)=>{let a=e._tail;for(;a&&n&&n(a,t);)a=a[r];let o=a?a[i]:e._head;a?a[i]=t:e._head=t,o?o[r]=t:e._tail=t,t[r]=a,t[i]=o},sm=(e,t,n)=>{let r=e.style.transform;if(r){let i=e[$f],a=0,o=r.length,s;for(;a<o;){for(;a<o&&r.charCodeAt(a)===32;)a++;if(a>=o)break;let e=a;for(;a<o&&r.charCodeAt(a)!==40;)a++;if(a>=o)break;let t=r.substring(e,a),n=1,c=a+1,l=-1,u=-1;for(a++;a<o&&n>0;){let e=r.charCodeAt(a);e===40?n++:e===41?n--:e===44&&n===1&&(l===-1?l=a:u===-1&&(u=a)),a++}let d=a-1;t===`translate`||t===`translate3d`?(l===-1?i.translateX=r.substring(c,d).trim():(i.translateX=r.substring(c,l).trim(),u===-1?i.translateY=r.substring(l+1,d).trim():(i.translateY=r.substring(l+1,u).trim(),i.translateZ=r.substring(u+1,d).trim())),s=r.substring(c,d)):t===`scale`||t===`scale3d`?l===-1?i.scale=r.substring(c,d).trim():(i.scaleX=r.substring(c,l).trim(),u===-1?i.scaleY=r.substring(l+1,d).trim():(i.scaleY=r.substring(l+1,u).trim(),i.scaleZ=r.substring(u+1,d).trim())):i[t]=r.substring(c,d)}if(t===`translate3d`&&s)return n&&(n[t]=s),s;let c=i[t];if(!X(c))return n&&(n[t]=c),c}return t===`translate3d`?`0px, 0px, 0px`:t===`rotate3d`?`0, 0, 0, 0deg`:Tp(t,`scale`)?`1`:Tp(t,`rotate`)||Tp(t,`skew`)?`0deg`:`0px`},cm=e=>{let t=``;for(let n=0,r=op.length;n<r;n++){let r=op[n],i=e[r];if(i!==void 0){if(r===`translateX`){let r=e.translateY;if(r!==void 0){let a=e.translateZ;a===void 0?(t+=`translate(${i},${r}) `,n+=1):(t+=`translate3d(${i},${r},${a}) `,n+=2);continue}}if(r===`scaleX`&&e.scale===void 0){let r=e.scaleY;if(r!==void 0){let a=e.scaleZ;a===void 0?(t+=`scale(${i},${r}) `,n+=1):(t+=`scale3d(${i},${r},${a}) `,n+=2);continue}}t+=`${sp[r]}${i}) `}r===`rotateZ`&&e.rotate3d!==void 0&&(t+=`rotate3d(${e.rotate3d}) `)}return e.matrix!==void 0&&(t+=`matrix(${e.matrix}) `),e.matrix3d!==void 0&&(t+=`matrix3d(${e.matrix3d}) `),t},lm=[];function um(e,t){if(!e)return null;let n=lm.length;outer:for(let r=0;r<n;r++){let n=lm[r];if(n.detect&&!n.detect(e))continue;let i=n.targetAdapters;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(r.detect(e)){let n=r.props[t];if(n&&(!n.gate||n.gate(e)))return n;break outer}}}for(let r=0;r<n;r++){let n=lm[r];if(n.detect&&!n.detect(e))continue;let i=n.propertyResolvers;for(let n=0,r=i.length;n<r;n++){let r=i[n](e,t);if(r)return r}}return null}var dm=e=>{let t=fp.exec(e)||pp.exec(e),n=X(t[4])?1:+t[4];return[+t[1],+t[2],+t[3],n]},fm=e=>{let t=e.length,n=t===4||t===5;return[+(`0x`+e[1]+e[n?1:2]),+(`0x`+e[n?2:3]+e[n?2:4]),+(`0x`+e[n?3:5]+e[n?3:6]),t===5||t===9?+((`0x`+e[n?4:7]+e[n?4:8])/255).toFixed(3):1]},pm=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),mm=e=>{let t=mp.exec(e)||hp.exec(e),n=t[1]/360,r=t[2]/100,i=t[3]/100,a=X(t[4])?1:+t[4],o,s,c;if(r===0)o=s=c=i;else{let e=i<.5?i*(1+r):i+r-i*r,t=2*i-e;o=Qp(pm(t,e,n+1/3)*255,0),s=Qp(pm(t,e,n)*255,0),c=Qp(pm(t,e,n-1/3)*255,0)}return[o,s,c,a]},hm=e=>Fp(e)?dm(e):Pp(e)?fm(e):Ip(e)?mm(e):[0,0,0,1],Z=(e,t)=>X(e)?t:e,gm=(e,t)=>{let n=e.match(bp),r=t[Zf]?t:document.documentElement,i=getComputedStyle(r)?.getPropertyValue(n[1]);return(!i||i.trim()===``)&&n[2]&&(i=n[2].trim()),i||0},_m=(e,t,n,r,i,a)=>{if(jp(e)){if(!i){let i=e(t,n,r,a);return isNaN(+i)?i||0:+i}let o=()=>{let i=e(t,n,r,a);return isNaN(+i)?i||0:+i};return i.func=o,o()}if(Ap(e)&&Tp(e,`var(`)){if(!i)return gm(e,t);let n=()=>gm(e,t);return i.func=n,n()}return e},vm=(e,t)=>e[Zf]?e[Qf]&&Bp(e,t)?Kf.ATTRIBUTE:op.includes(t)||ap.get(t)?Kf.TRANSFORM:Tp(t,`--`)?Kf.CSS_VAR:t in e.style?Kf.CSS:t in e?Kf.OBJECT:Kf.ATTRIBUTE:Kf.OBJECT,ym=(e,t,n)=>{let r=e.style[t];r&&n&&(n[t]=r);let i=r||getComputedStyle(e[ep]||e).getPropertyValue(t);return i===`auto`?`0`:i},bm=(e,t,n,r)=>{let i=X(n)?vm(e,t):n,a=um(e,t);if(a){let n=a.get(e);return n&&r&&(r[t]=n),n??0}if(i===Kf.OBJECT){let n=e[t];return n&&r&&(r[t]=n),n||0}if(i===Kf.ATTRIBUTE){let n=e.getAttribute(t);return n&&r&&(r[t]=n),n}return i===Kf.TRANSFORM?sm(e,t,r):i===Kf.CSS_VAR?ym(e,t,r).trimStart():ym(e,t,r)},xm=(e,t,n)=>n===`-`?e-t:n===`+`?e+t:e*t,Sm=()=>({t:qf.NUMBER,n:0,u:null,o:null,d:null,s:null}),Cm=(e,t)=>{if(t.t=qf.NUMBER,t.n=0,t.u=null,t.o=null,t.d=null,t.s=null,!e)return t;let n=+e;if(!isNaN(n))return t.n=n,t;let r=e;r[1]===`=`&&(t.o=r[0],r=r.slice(2));let i=!r.includes(` `)&&_p.exec(r);if(i)return t.t=qf.UNIT,t.n=+i[1],t.u=i[2],t;if(t.o)return t.n=+r,t;if(Lp(r))return t.t=qf.COLOR,t.d=hm(r),t;{let e=r.match(gp);return t.t=qf.COMPLEX,t.d=e?e.map(Number):[],t.s=r.split(gp)||[],t}},wm=(e,t)=>(t.t=e._valueType,t.n=e._toNumber,t.u=e._unit,t.o=null,t.d=nm(e._toNumbers),t.s=nm(e._strings),t),Tm=Sm(),Em=(e,t,n)=>{let r=e._modifier,i=e._fromNumbers,a=e._toNumbers,o=e._strings,s=o[0];for(let c=0,l=a.length;c<l;c++){let l=r(Qp($p(i[c],a[c],t),n)),u=o[c+1];s+=`${u?l+u:l}`,e._numbers[c]=l}return s},Dm=(e,t,n,r,i)=>{let a=e.parent,o=e.duration,s=e.completed,c=e.iterationDuration,l=e.iterationCount,u=e._currentIteration,d=e._loopDelay,f=e._reversed,p=e._alternate,m=e._hasChildren,h=e._delay,g=e._currentTime,_=h+c,v=t-h,y=Zp(g,-h,o),b=Zp(v,-h,o),x=v-g,S=b>0,C=b>=o,w=o<=tp,T=i===Jf.FORCE,E=0,D=v,O=0;if(l>1){let t=c+(C?0:d),n=~~(b/t);e._currentIteration=Zp(n,0,l),C&&e._currentIteration--,E=e._currentIteration%2,D=b-n*t||0}let k=f^(p&&E),A=e._ease,j=C?k?0:o:k?c-D:D;A&&(j=c*A(j/c)||0);let M=(a?a.backwards:v<g)?!k:!!k;if(e._currentTime=v,e._iterationTime=j,e.backwards=M,S&&!e.began?(e.began=!0,!n&&!(a&&(M||!a.began))&&e.onBegin(e)):v<=0&&(e.began=!1),!n&&!m&&S&&e._currentIteration!==u&&e.onLoop(e),T||i===Jf.AUTO&&(t>=(a&&h>0?0:h)&&t<=_||t<=h&&y>h||t>=_&&y!==o)||j>=_&&y!==o||j<=h&&y>0&&!C||t<=y&&y===o&&s||C&&!s&&w){if(S&&(e.computeDeltaTime(y),n||e.onBeforeUpdate(e)),!m){let t=T||(M?x*-1:x)>=Y.tickThreshold,i=Qp(e._offset+(a?a._offset:0)+h+j,12),o=e._head,s,c,l,u,d=0;for(;o;){let e=o._composition,n=o._currentTime,a=o._changeDuration,f=o._absoluteStartTime+o._changeDuration,p=o._nextRep,m=o._prevRep,h=e!==Yf.none,g=m?m._absoluteStartTime+m._changeDuration:0,_=m&&m.parent!==o.parent,v=!p||p._isOverridden?f:p.parent===o.parent?f+p._delay:p._absoluteStartTime<p._absoluteUpdateStartTime?p._absoluteStartTime:p._absoluteUpdateStartTime;if((t||(n!==a||i<=v||m&&!_&&(!p||p.parent!==o.parent))&&(n!==0||i>=o._absoluteStartTime||_&&!o._hasFromValue&&!m._isOverridden&&i>=g||p&&!p._isOverridden&&p.parent===o.parent&&p._currentTime!==0&&j<p._startTime))&&(!m||_||j>=o._startTime)&&(!h||!o._isOverridden&&(!o._isOverlapped||i<=f)&&(!p||p._isOverridden||i<=v)&&(!m||m._isOverridden||(_?i>=o._absoluteStartTime||!o._hasFromValue&&i>=g:i>=g+o._delay)))){let t=o._currentTime=Zp(j-o._startTime,0,a),n=o._ease(t/o._updateDuration),i=o._modifier,f=o._valueType,p=o._tweenType,m=p===Kf.OBJECT,g=f===qf.NUMBER,_=g&&m||n===0||n===1?-1:Y.precision,v,y;if(g)v=y=i(Qp($p(o._fromNumber,o._toNumber,n),_));else if(f===qf.UNIT)y=i(Qp($p(o._fromNumber,o._toNumber,n),_)),v=`${y}${o._unit}`;else if(f===qf.COLOR){let e=o._numbers,t=o._fromNumbers,a=o._toNumbers,s=1-n,c=t[0],l=t[1],u=t[2],d=a[0],f=a[1],p=a[2];e[0]=i(Math.sqrt(c*c*s+d*d*n)),e[1]=i(Math.sqrt(l*l*s+f*f*n)),e[2]=i(Math.sqrt(u*u*s+p*p*n)),e[3]=i($p(t[3],a[3],n)),(!o._setter||r)&&(v=`rgba(${Qp(e[0],0)},${Qp(e[1],0)},${Qp(e[2],0)},${e[3]})`)}else f===qf.COMPLEX&&(v=Em(o,n,_));if(h&&(o._number=y),!r&&e!==Yf.blend){let e=o.property;s=o.target,o._setter?o._setter(s,y,o):m?s[e]=v:p===Kf.ATTRIBUTE?s.setAttribute(e,v):(c=s.style,p===Kf.TRANSFORM?(s!==l&&(l=s,u=s[$f]),u[e]=v,d=1):p===Kf.CSS?c[e]=v:p===Kf.CSS_VAR&&c.setProperty(e,v)),S&&(O=1)}else o._value=v}else n&&m&&!_&&j<o._startTime&&(o._currentTime=0);d&&o._renderTransforms&&(c.transform=cm(u),d=0),o=o._next}!n&&O&&e.onRender(e)}!n&&S&&e.onUpdate(e)}return a&&w?!n&&(a.began&&!M&&v>0&&!s||M&&v<=1e-11&&s)&&(e.onComplete(e),e.completed=!M):S&&C?l===1/0?e._startTime+=e.duration:e._currentIteration>=l-1&&(e.paused=!0,!s&&!m&&(e.completed=!0,!n&&!(a&&(M||!a.began))&&(e.onComplete(e),e._resolve(e)))):e.completed=!1,O},Om=(e,t,n,r,i)=>{let a=e._currentIteration;if(Dm(e,t,n,r,i),e._hasChildren){let o=e,s=o.backwards,c=r?t:o._iterationTime,l=Ep(),u=0,d=!0;if(!r&&o._currentIteration!==a){let e=o.iterationDuration;im(o,t=>{if(!s)!t.completed&&!t.backwards&&t._currentTime<t.iterationDuration&&Dm(t,e,n,1,Jf.FORCE),t.began=!1,t.completed=!1;else{let r=t.duration,i=t._offset+t._delay,a=i+r;!n&&r<=1e-11&&(!i||a===e)&&t.onComplete(t)}}),n||o.onLoop(o)}im(o,e=>{let t=Qp((c-e._offset)*e._speed,12);if(s&&t>e._delay+e.duration)return;let a=e._fps<o._fps?e.requestTick(l):i;u+=Dm(e,t,n,r,a),!e.completed&&d&&(d=!1)},s),!n&&u&&o.onRender(o),(d||s)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,n||(o.onComplete(o),o._resolve(o))))}},km={},Am=(e,t,n)=>{if(n===Kf.TRANSFORM)return ap.get(e)||e;if(n===Kf.CSS||n===Kf.ATTRIBUTE&&Np(t)&&e in t.style){let t=km[e];if(t)return t;{let t=e&&wp(e);return km[e]=t,t}}return e},jm=(e,t=!1)=>{if(e._hasChildren)im(e,e=>jm(e,t),!0);else{let n=e;n.pause(),im(n,e=>{let r=e.property,i=e.target,a=e._tweenType,o=e._inlineValue,s=Mp(o)||o===``;if(e._setter){if(!t&&!s){if(Cm(o,Tm),Tm.d){let t=Tm.d,n=e._numbers;for(let e=0,r=t.length;e<r;e++)n[e]=t[e]}else e._number=Tm.n;e._setter(e.target,e._number,e)}}else if(a===Kf.OBJECT)!t&&!s&&(i[r]=o);else if(i[Zf]){if(a===Kf.ATTRIBUTE)t||(s?i.removeAttribute(r):i.setAttribute(r,o));else{let t=i.style;if(a===Kf.TRANSFORM){let n=i[$f];s?delete n[r]:n[r]=o,e._renderTransforms&&(Object.keys(n).length?t.transform=cm(n):t.removeProperty(`transform`))}else s?t.removeProperty(wp(r)):t[r]=o}}i[Zf]&&n._tail===e&&n.targets.forEach(e=>{e.getAttribute&&e.getAttribute(`style`)===``&&e.removeAttribute(`style`)})})}return e},Mm=class{constructor(e=0){this.deltaTime=0,this._currentTime=e,this._lastTickTime=e,this._startTime=e,this._lastTime=e,this._frameDuration=rp/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(e){let t=+e,n=t<1e-11?tp:t,r=rp/n;n>xp.frameRate&&(xp.frameRate=n),this._fps=n,this._frameDuration=r}get speed(){return this._speed}set speed(e){let t=+e;this._speed=t<1e-11?tp:t}requestTick(e){let t=this._frameDuration,n=e-this._lastTickTime,r=t*.25;return n+(r<4?r:4)<t?Jf.NONE:(this._lastTickTime=n>=t?e-n%t:e,Jf.AUTO)}computeDeltaTime(e){let t=e-this._lastTime;return this.deltaTime=t,this._lastTime=e,t}},Nm={animation:null,update:cp},Pm=e=>{let t=Nm.animation;return t||(t={duration:tp,computeDeltaTime:cp,_offset:0,_delay:0,_head:null,_tail:null},Nm.animation=t,Nm.update=()=>{e.forEach(e=>{for(let t in e){let n=e[t],r=n._head;if(r){let e=r._valueType,t=e===qf.COMPLEX||e===qf.COLOR?nm(r._fromNumbers):null,i=r._fromNumber,a=n._tail;for(;a&&a!==r;){if(t)for(let e=0,n=a._numbers.length;e<n;e++)t[e]+=a._numbers[e];else i+=a._number;a=a._prevAdd}r._toNumber=i,r._toNumbers=t}}}),Dm(t,1,1,0,Jf.FORCE)}),t},Fm=Uf?requestAnimationFrame:setImmediate,Im=Uf?cancelAnimationFrame:clearImmediate,Lm=class extends Mm{constructor(e){super(e),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=xp,this.paused=!0,this.reqId=0}update(){let e=this._currentTime=Ep();if(this.requestTick(e)){this.computeDeltaTime(e);let t=this._speed,n=this._fps,r=this._head;for(;r;){let i=r._next;r.paused?(am(this,r),this._hasChildren=!!this._tail,r._running=!1,r.completed&&!r._cancelled&&r.cancel()):Om(r,(e-r._startTime)*r._speed*t,0,0,r._fps<n?r.requestTick(e):Jf.AUTO),r=i}Nm.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(Ep()),this.reqId=Fm(zm)),this}pause(){if(this.reqId)return this.paused=!0,Bm()}resume(){if(this.paused)return this.paused=!1,im(this,e=>e.resetTime()),this.wake()}get speed(){return this._speed*(Y.timeScale===1?1:rp)}set speed(e){let t=e*Y.timeScale;this._speed!==t&&(this._speed=t,im(this,e=>e.speed=e._speed))}get timeUnit(){return Y.timeScale===1?`ms`:`s`}set timeUnit(e){let t=.001,n=e===`s`,r=n?t:1;if(Y.timeScale!==r){Y.timeScale=r,Y.tickThreshold=200*r;let e=n?t:rp;this.defaults.duration*=e,this._speed*=e}}get precision(){return Y.precision}set precision(e){Y.precision=e}},Rm=(()=>{let e=new Lm(Ep());return Uf&&(Cp.engine=e,Gf.addEventListener(`visibilitychange`,()=>{e.pauseOnDocumentHidden&&(Gf.hidden?e.pause():e.resume())})),e})(),zm=()=>{Rm._head?(Rm.reqId=Fm(zm),Rm.update()):Rm.reqId=0},Bm=()=>(Im(Rm.reqId),Rm.reqId=0,Rm),Vm={_rep:new WeakMap,_add:new Map},Hm=(e,t,n=`_rep`)=>{let r=Vm[n],i=r.get(e);return i||(i={},r.set(e,i)),i[t]?i[t]:i[t]={_head:null,_tail:null}},Um=(e,t)=>e._isOverridden||e._absoluteStartTime>t._absoluteStartTime,Wm=e=>{e._isOverlapped=1,e._isOverridden=1,e._changeDuration=tp,e._currentTime=tp},Gm=(e,t)=>{let n=e._composition;if(n===Yf.replace){let n=e._absoluteStartTime;om(t,e,Um,`_prevRep`,`_nextRep`);let r=e._prevRep;if(r){let t=r.parent,i=r._absoluteEndTime;if(e.parent.id!==t.id&&t.iterationCount>1&&i+(t.duration-t.iterationDuration)>n){Wm(r);let e=r._prevRep;for(;e&&e.parent.id===t.id;)Wm(e),e=e._prevRep}let a=e._absoluteUpdateStartTime;if(i>a){let e=r._startTime,t=Qp(a-(i-(e+r._updateDuration))-e,12);r._changeDuration=t,r._currentTime=t,r._isOverlapped=1,t<1e-11&&Wm(r)}let o=e.parent.parent;if(!o||o!==t.parent){let e=!0;if(im(t,t=>{t._isOverlapped||(e=!1)}),e){let e=t.parent;if(e){let n=!0;im(e,e=>{e!==t&&im(e,e=>{e._isOverlapped||(n=!1)})}),n&&e.cancel()}else t.cancel()}}}}else if(n===Yf.blend){let t=Hm(e.target,e.property,`_add`),n=Pm(Vm._add),r=t._head;r||(r={...e},r._composition=Yf.replace,r._updateDuration=tp,r._startTime=0,r._numbers=nm(e._fromNumbers),r._number=0,r._next=null,r._prev=null,om(t,r),om(n,r));let i=e._toNumber;if(e._fromNumber=r._fromNumber-i,e._toNumber=0,e._numbers=nm(e._fromNumbers),e._number=0,r._fromNumber=i,e._toNumbers.length){let t=nm(e._toNumbers);t.forEach((t,n)=>{e._fromNumbers[n]=r._fromNumbers[n]-t,e._toNumbers[n]=0}),r._fromNumbers=t}om(t,e,null,`_prevAdd`,`_nextAdd`)}return e},Km=e=>{let t=e._composition;if(t!==Yf.none){let n=e.target,r=e.property,i=Vm._rep.get(n)[r];if(am(i,e,`_prevRep`,`_nextRep`),t===Yf.blend){let t=Vm._add,i=t.get(n);if(!i)return;let a=i[r],o=Nm.animation;am(a,e,`_prevAdd`,`_nextAdd`);let s=a._head;if(s&&s===a._tail){am(a,s,`_prevAdd`,`_nextAdd`),am(o,s);let e=!0;for(let t in i)if(i[t]._head){e=!1;break}e&&t.delete(n)}}}return e},qm=(e,t,n)=>{let r=!1;return im(t,i=>{let a=i.target;if(e.includes(a)){let e=i.property,o=i._tweenType,s=Am(n,a,o);(!s||s&&s===e)&&(i.parent._tail===i&&i._tweenType===Kf.TRANSFORM&&i._prev&&i._prev._tweenType===Kf.TRANSFORM&&(i._prev._renderTransforms=1),am(t,i),Km(i),r=!0)}},!0),r},Jm=(e,t,n)=>{let r=t||Rm,i;if(r._hasChildren){let t=0;im(r,a=>{if(!a._hasChildren){if(i=qm(e,a,n),i&&!a._head)a.cancel(),am(r,a);else{let e=a._offset+a._delay+a.duration;e>t&&(t=e)}}a._head?Jm(e,a,n):a._hasChildren=!1},!0),X(r.iterationDuration)||(r.iterationDuration=t)}else i=qm(e,r,n);i&&!r._head&&(r._hasChildren=!1,r.cancel&&r.cancel())},Ym=e=>(e.paused=!0,e.began=!1,e.completed=!1,e),Xm=e=>e._cancelled?(e._hasChildren?im(e,Xm):im(e,e=>{e._composition!==Yf.none&&Gm(e,Hm(e.target,e.property))}),e._cancelled=0,e):e,Zm=0,Qm=(e,t)=>e._priority>t._priority,$m=class extends Mm{constructor(e={},t=null,n=0){super(0),++Zm;let{id:r,delay:i,duration:a,reversed:o,alternate:s,loop:c,loopDelay:l,autoplay:u,frameRate:d,playbackRate:f,priority:p,onComplete:m,onLoop:h,onPause:g,onBegin:_,onBeforeUpdate:v,onUpdate:y}=e;Sp.current&&Sp.current.register(this);let b=t?0:Rm._lastTickTime,x=t?t.defaults:Y.defaults,S=jp(i)||X(i)?x.delay:+i,C=jp(a)||X(a)?1/0:+a,w=Z(c,x.loop),T=Z(l,x.loopDelay),E=w===!0||w===1/0||w<0?1/0:w+1,D=0;t?D=n:(Rm.reqId||Rm.requestTick(Ep()),D=(Rm._lastTickTime-Rm._startTime)*Y.timeScale),this.id=X(r)?Zm:r,this.parent=t,this.duration=em((C+T)*E-T)||1e-11,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=_||x.onBegin,this.onBeforeUpdate=v||x.onBeforeUpdate,this.onUpdate=y||x.onUpdate,this.onLoop=h||x.onLoop,this.onPause=g||x.onPause,this.onComplete=m||x.onComplete,this.iterationDuration=C,this.iterationCount=E,this._autoplay=!t&&Z(u,x.autoplay),this._offset=D,this._delay=S,this._loopDelay=T,this._iterationTime=0,this._currentIteration=0,this._resolve=cp,this._running=!1,this._reversed=+Z(o,x.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=Z(s,x.alternate),this._prev=null,this._next=null,this._lastTickTime=b,this._startTime=b,this._lastTime=b,this._fps=Z(d,x.frameRate),this._speed=Z(f,x.playbackRate),this._priority=+Z(p,1)}get cancelled(){return!!this._cancelled}set cancelled(e){e?this.cancel():this.reset(!0).play()}get currentTime(){return Zp(Qp(this._currentTime,Y.precision),-this._delay,this.duration)}set currentTime(e){let t=this.paused;this.pause().seek(+e),t||this.resume()}get iterationCurrentTime(){return Zp(Qp(this._iterationTime,Y.precision),0,this.iterationDuration)}set iterationCurrentTime(e){this.currentTime=this.iterationDuration*this._currentIteration+e}get progress(){return Zp(Qp(this._currentTime/this.duration,10),0,1)}set progress(e){this.currentTime=this.duration*e}get iterationProgress(){return Zp(Qp(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(e){let t=this.iterationDuration;this.currentTime=t*this._currentIteration+t*e}get currentIteration(){return this._currentIteration}set currentIteration(e){this.currentTime=this.iterationDuration*Zp(+e,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(e){e?this.reverse():this.play()}get speed(){return super.speed}set speed(e){super.speed=e,this.resetTime()}reset(e=!1){return Xm(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,Om(this,0,1,~~e,Jf.FORCE),Ym(this),this._hasChildren&&im(this,Ym),this}init(e=!1){this.fps=this._fps,this.speed=this._speed,!e&&this._hasChildren&&Om(this,this.duration,1,~~e,Jf.FORCE),this.reset(e);let t=this._autoplay;return t===!0?this.resume():t&&!X(t.linked)&&t.link(this),this}resetTime(){let e=1/(this._speed*Rm._speed);return this._startTime=Ep()-(this._currentTime+this._delay)*e,this}pause(){return this.paused?this:(this.paused=!0,this.onPause(this),this)}resume(){return this.paused?(this.paused=!1,this.duration<=1e-11&&!this._hasChildren?Om(this,tp,0,0,Jf.FORCE):(this._running||=(om(Rm,this,Qm),Rm._hasChildren=!0,!0),this.resetTime(),this._startTime-=12,Rm.wake()),this):this}restart(){return this.reset().resume()}seek(e,t=0,n=0){Xm(this),this.completed=!1;let r=this.paused;return this.paused=!0,Om(this,e+this._delay,~~t,~~n,Jf.AUTO),r?this:this.resume()}alternate(){let e=this._reversed,t=this.iterationCount,n=this.iterationDuration,r=t===1/0?qp(np/n):t;return this._reversed=+(this._alternate&&!(r%2)?e:!e),t===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(n*r-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?im(this,e=>e.cancel(),!0):im(this,Km),this._cancelled=1,this.pause()}stretch(e){let t=this.duration,n=tm(e);if(t===n)return this;let r=e/t,i=e<=tp;return this.duration=i?tp:n,this.iterationDuration=i?tp:tm(this.iterationDuration*r),this._offset*=r,this._delay*=r,this._loopDelay*=r,this}revert(){Om(this,0,1,0,Jf.AUTO);let e=this._autoplay;return e&&e.linked&&e.linked===this&&e.revert(),this.cancel()}complete(e=0){return this.seek(this.duration,e).cancel()}then(e=cp){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=cp};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}};function eh(e){let t=Ap(e)?Sp.root.querySelectorAll(e):e;if(t instanceof NodeList||t instanceof HTMLCollection)return t}function th(e){if(Mp(e))return[];if(!Uf)return Dp(e)&&e.flat(1/0)||[e];if(Dp(e)){let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;e++){let r=t[e];if(!Mp(r)){let e=eh(r);if(e)for(let t=0,r=e.length;t<r;t++){let r=e[t];if(!Mp(r)){let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}else{let e=!1;for(let t=0,i=n.length;t<i;t++)if(n[t]===r){e=!0;break}e||n.push(r)}}}return n}let t=eh(e);return t?Array.from(t):[e]}function nh(e){let t=th(e),n=t.length;for(let e=0;e<n;e++){let n=t[e];if(!n[Xf]){n[Xf]=!0;let e=Np(n);(n.nodeType||e)&&(n[Zf]=!0,n[Qf]=e,n[$f]={})}}return t}var rh={deg:1,rad:180/Yp,turn:360},ih={},ah=(e,t,n,r=!1)=>{let i=t.u,a=t.n;if(t.t===qf.UNIT&&i===n)return t;let o=a+i+n,s=ih[o];if(!X(s)&&!r)t.n=s;else{let r;if(i in rh)r=a*rh[i]/rh[n];else{let t=e.cloneNode(),o=e.parentNode,s=o&&o!==Gf?o:Gf.body;s.appendChild(t);let c=t.style;c.width=100+i;let l=t.offsetWidth||100;c.width=100+n;let u=l/(t.offsetWidth||100);s.removeChild(t),r=u*a}t.n=r,ih[o]=r}return t.t,qf.UNIT,t.u=n,t},oh=e=>e,sh=(e=1.68)=>t=>Vp(t,+e),ch={in:e=>t=>e(t),out:e=>t=>1-e(1-t),inOut:e=>t=>t<.5?e(t*2)/2:1-e(t*-2+2)/2,outIn:e=>t=>t<.5?(1-e(1-t*2))/2:(e(t*2-1)+1)/2},lh=Yp/2,uh=Yp*2,dh={"":sh,Quad:sh(2),Cubic:sh(3),Quart:sh(4),Quint:sh(5),Sine:e=>1-Wp(e*lh),Circ:e=>1-Hp(1-e*e),Expo:e=>e?Vp(2,10*e-10):0,Bounce:e=>{let t,n=4;for(;e<((t=Vp(2,--n))-1)/11;);return 1/Vp(4,3-n)-7.5625*Vp((t*3-2)/22-e,2)},Back:(e=1.7)=>t=>(+e+1)*t*t*t-+e*t*t,Elastic:(e=1,t=.3)=>{let n=Zp(+e,1,10),r=Zp(+t,tp,2),i=r/uh*Jp(1/n),a=uh/r;return e=>e===0||e===1?e:-n*Vp(2,-10*(1-e))*Up((1-e-i)*a)}},fh=(()=>{let e={linear:oh,none:oh};for(let t in ch)for(let n in dh){let r=dh[n],i=ch[t];e[t+n]=n===``||n===`Back`||n===`Elastic`?(e,t)=>i(r(e,t)):i(r)}return e})(),ph={linear:oh,none:oh},mh=e=>{if(ph[e])return ph[e];if(e.indexOf(`(`)<=-1){let t=ch[e]||e.includes(`Back`)||e.includes(`Elastic`)?fh[e]():fh[e];return t?ph[e]=t:oh}{let t=e.slice(0,-1).split(`(`),n=fh[t[0]];return n?ph[e]=n(...t[1].split(`,`)):oh}},hh=[`steps(`,`irregular(`,`linear(`,`cubicBezier(`],gh=e=>{if(Ap(e)){for(let t=0,n=hh.length;t<n;t++)if(Tp(e,hh[t]))return console.warn(`String syntax for \`ease: "${e}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${e}\``),oh}return jp(e)?e:Ap(e)?mh(e):oh},Q=Sm(),$=Sm(),_h={},vh={func:null},yh={func:null},bh=[null],xh=[null,null],Sh={to:null},Ch=0,wh=0,Th,Eh,Dh=(e,t)=>{let n={};if(Dp(e)){let t=[].concat(...e.map(e=>Object.keys(e))).filter(Rp);for(let r=0,i=t.length;r<i;r++){let i=t[r];n[i]=e.map(e=>{let t={};for(let n in e){let r=e[n];Rp(n)?n===i&&(t.to=r):t[n]=r}return t})}}else{let r=Z(t.duration,Y.defaults.duration);Object.keys(e).map(t=>({o:parseFloat(t)/100,p:e[t]})).sort((e,t)=>e.o-t.o).forEach(e=>{let t=e.o,i=e.p;for(let e in i)if(Rp(e)){let a=n[e];a||=n[e]=[];let o=t*r,s=a.length,c=a[s-1],l={to:i[e]},u=0;for(let e=0;e<s;e++)u+=a[e].duration;s===1&&(l.from=c.to),i.ease&&(l.ease=i.ease),l.duration=o-(s?u:0),a.push(l)}return e});for(let e in n){let t=n[e],r;for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.ease;n.ease=r||void 0,r=i}t[0].duration||t.shift()}}return n},Oh=class extends $m{constructor(e,t,n,r,i=!1,a=0,o){super(t,n,r),this._head,this._tail,++wh;let s=nh(e),c=s.length,l=t.keyframes,u=l?rm(Dh(l,t),t):t,{id:d,delay:f,duration:p,ease:m,playbackEase:h,modifier:g,composition:_,onRender:v}=u,y=n?n.defaults:Y.defaults,b=Z(m,y.ease),x=Z(h,y.playbackEase),S=x?gh(x):null,C=!X(b.ease),w=C?b.ease:Z(m,S?`linear`:y.ease),T=C?b.settlingDuration:Z(p,y.duration),E=Z(f,y.delay),D=g||y.modifier,O=X(_)&&c>=1e3?Yf.none:X(_)?y.composition:_,k=this._offset+(n?n._offset:0);C&&(b.parent=this);let A=NaN,j=NaN,M=0,N=0;for(let e=0;e<c;e++){let t=s[e],r=a||e,c=o||s,l=NaN,d=NaN;for(let e in u)if(Rp(e)){let a=vm(t,e),o=um(t,e),s=Am(e,t,a),f=u[e],p=Dp(f);if(i&&!p&&(xh[0]=f,xh[1]=f,f=xh),p){let e=f.length,t=!Op(f[0]);e===2&&t?(Sh.to=f,bh[0]=Sh,Th=bh):e>2&&t?(Th=[],f.forEach((e,t)=>{t?t===1?(xh[1]=e,Th.push(xh)):Th.push(e):xh[0]=e})):Th=f}else bh[0]=f,Th=bh;let m=null,h=null,g=NaN,_=0,v=0;for(let e=Th.length;v<e;v++){let i=Th[v];Op(i)?Eh=i:(Sh.to=i,Eh=Sh),vh.func=null,yh.func=null;let l=_m(Z(Eh.composition,O),t,r,c,null,null),u=kp(l)?l:Yf[l];!m&&u!==Yf.none&&(m=Hm(t,s));let d=m?m._tail:null,f=n&&d&&d.parent.parent===n?d:h,p=_m(Eh.to,t,r,c,vh,f),y;Op(p)&&!X(p.to)?(Eh=p,y=p.to):y=p;let b=_m(Eh.from,t,r,c,yh,f),x=Eh.ease||w,S=_m(x,t,r,c,null,f),C=jp(S)||Ap(S)?S:x,A=!X(C)&&!X(C.ease),j=A?C.ease:C,ee=A?C.settlingDuration:_m(Z(Eh.duration,e>1?_m(T,t,r,c,null,f)/e:T),t,r,c,null,f),P=_m(Z(Eh.delay,v?0:E),t,r,c,null,f),F=Eh.modifier||D,I=!X(b),te=!X(y),ne=Dp(y),L=ne||I&&te,R=h?_:0,re=h?_+P:P,ie=Qp(k+re,12),z=Qp(k+R,12);!N&&(I||ne)&&(N=1);let B=h;if(u!==Yf.none){let e=m._head;for(;e&&e._absoluteStartTime<=ie;)if(e._isOverridden||(B=e),e=e._nextRep,e&&e._absoluteStartTime>=ie)for(;e;)Wm(e),e=e._nextRep}if(L){Cm(ne?_m(y[0],t,r,c,yh,f):b,Q),Cm(ne?_m(y[1],t,r,c,vh,f):y,$);let e=bm(t,s,a,_h);Q.t===qf.NUMBER&&(B?B._valueType===qf.UNIT&&(Q.t=qf.UNIT,Q.u=B._unit):(Cm(e,Tm),Tm.t===qf.UNIT&&(Q.t=qf.UNIT,Q.u=Tm.u)))}else te?Cm(y,$):h?wm(h,$):Cm(n&&B&&B.parent.parent===n?B._value:bm(t,s,a,_h),$),I?Cm(b,Q):h?wm(h,Q):Cm(n&&B&&B.parent.parent===n?B._value:bm(t,s,a,_h),Q);if(Q.o&&(Q.n=xm(B?B._toNumber:Cm(bm(t,s,a,_h),Tm).n,Q.n,Q.o)),$.o&&($.n=xm(Q.n,$.n,$.o)),Q.t!==$.t){if(Q.t===qf.COMPLEX||$.t===qf.COMPLEX){let e=Q.t===qf.COMPLEX?Q:$,t=Q.t===qf.COMPLEX?$:Q;t.t=qf.COMPLEX,t.s=nm(e.s),t.d=e.d.map(()=>t.n)}else if(Q.t===qf.UNIT||$.t===qf.UNIT){let e=Q.t===qf.UNIT?Q:$,t=Q.t===qf.UNIT?$:Q;t.t=qf.UNIT,t.u=e.u}else if(Q.t===qf.COLOR||$.t===qf.COLOR){let e=Q.t===qf.COLOR?Q:$,t=Q.t===qf.COLOR?$:Q;t.t=qf.COLOR,t.d=e.d.map(()=>0)}}if(Q.u!==$.u){let e=$.u?Q:$;e=ah(t,e,$.u?$.u:Q.u,!1)}if($.d&&Q.d&&$.d.length!==Q.d.length){let e=Q.d.length>$.d.length?Q:$,t=e===Q?$:Q;t.d=e.d.map((e,n)=>X(t.d[n])?0:t.d[n]),t.s=nm(e.s)}let ae=Qp(+ee||1e-11,12),oe=_h[s];Mp(oe)||(_h[s]=null);let se=o?o.set:null;_=Qp(re+ae,12);let ce=Q.d,le=$.d,ue=$.s,de={parent:this,id:Ch++,property:s,target:t,_value:null,_toFunc:vh.func,_fromFunc:yh.func,_ease:gh(j),_fromNumbers:ce?nm(ce):ip,_toNumbers:le?nm(le):ip,_strings:ue?nm(ue):ip,_fromNumber:Q.n,_toNumber:$.n,_numbers:ce?nm(ce):ip,_number:Q.n,_unit:$.u,_modifier:F,_currentTime:0,_startTime:re,_delay:+P,_updateDuration:ae,_changeDuration:ae,_absoluteStartTime:ie,_absoluteUpdateStartTime:z,_absoluteEndTime:Qp(k+_,12),_hasFromValue:I||ne?1:0,_tweenType:a,_setter:se,_valueType:$.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:oe,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==Yf.none&&Gm(de,m);let fe=de._valueType;if(fe===qf.COMPLEX)de._value=Em(de,1,-1);else if(fe===qf.UNIT)de._value=`${F(de._toNumber)}${de._unit}`;else if(fe===qf.COLOR){let e=$.d;de._value=`rgba(${Qp(e[0],0)},${Qp(e[1],0)},${Qp(e[2],0)},${e[3]})`}else de._value=F(de._toNumber);isNaN(g)&&(g=de._startTime),h=de,M++,om(this,de)}(isNaN(j)||g<j)&&(j=g),(isNaN(A)||_>A)&&(A=_),a===Kf.TRANSFORM&&(l=M-v,d=M)}if(!isNaN(l)){let e=0;im(this,t=>{e>=l&&e<d&&(t._renderTransforms=1,t._composition===Yf.blend&&im(Nm.animation,e=>{e.id===t.id&&(e._renderTransforms=1)})),e++})}}c||console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`),j?(im(this,e=>{e._startTime-e._delay||(e._delay-=j),e._startTime-=j}),A-=j):j=0,A||(A=tp,this.iterationCount=0),this.targets=s,this.id=X(d)?wh:d,this.duration=A===1e-11?tp:em((A+this._loopDelay)*this.iterationCount-this._loopDelay)||1e-11,this.onRender=v||y.onRender,this._ease=S,this._delay=j,this.iterationDuration=A,!this._autoplay&&N&&this.onRender(this)}stretch(e){let t=this.duration;if(t===tm(e))return this;let n=e/t;return im(this,e=>{e._updateDuration=tm(e._updateDuration*n),e._changeDuration=tm(e._changeDuration*n),e._currentTime*=n,e._delay*=n,e._startTime*=n,e._absoluteStartTime*=n,e._absoluteUpdateStartTime*=n,e._absoluteEndTime*=n}),super.stretch(e)}refresh(){return im(this,e=>{let t=e._toFunc,n=e._fromFunc;(t||n)&&(n?(Cm(n(),Q),Q.u!==e._unit&&e.target[Zf]&&ah(e.target,Q,e._unit,!0),e._fromNumbers=nm(Q.d),e._fromNumber=Q.n):t&&(Cm(bm(e.target,e.property,e._tweenType),Tm),e._fromNumbers=nm(Tm.d),e._fromNumber=Tm.n),t&&(Cm(t(),$),e._toNumbers=nm($.d),e._strings=nm($.s),e._toNumber=$.o?xm(e._fromNumber,$.n,$.o):$.n))}),this.duration===1e-11&&this.restart(),this}revert(){return super.revert(),jm(this)}then(e){return super.then(e)}},kh=(e,t)=>{if(Tp(t,`<`)){let n=t[1]===`<`,r=e._tail,i=r?r._offset+r._delay:0;return n?i:i+r.duration}},Ah=(e,t)=>{let n=e.iterationDuration;if(n===1e-11&&(n=0),X(t))return n;if(kp(+t))return+t;let r=t,i=e?e.labels:null,a=!Mp(i),o=kh(e,r),s=!X(o),c=yp.exec(r);if(c){let e=c[0],t=r.split(e),l=a&&t[0]?i[t[0]]:n;return xm(s?o:a?l:n,+t[1],e[0])}return s?o:a?X(i[r])?n:i[r]:n};function jh(e){return em((e.iterationDuration+e._loopDelay)*e.iterationCount-e._loopDelay)||1e-11}function Mh(e,t,n,r,i,a){let o=kp(e.duration)&&e.duration<=1e-11?n-tp:n;t.composition&&Om(t,o,1,1,Jf.AUTO);let s=r?new Oh(r,e,t,o,!1,i,a):new $m(e,t,o);return t.composition&&s.init(!0),om(t,s),im(t,e=>{let n=e._offset+e._delay+e.duration;n>t.iterationDuration&&(t.iterationDuration=n)}),t.duration=jh(t),t}var Nh=0,Ph=class extends $m{constructor(e={}){super(e,null,0),++Nh,this.id=X(e.id)?Nh:e.id,this.duration=0,this.labels={};let t=e.defaults,n=Y.defaults;this.defaults=t?rm(t,n):n,this.composition=Z(e.composition,!0),this.onRender=e.onRender||n.onRender;let r=Z(e.playbackEase,n.playbackEase);this._ease=r?gh(r):null,this.iterationDuration=0}add(e,t,n){let r=Op(t),i=Op(e);if(r||i){if(this._hasChildren=!0,r){let r=t,i=Y.editor&&Y.editor.addTimelineChild,a=n&&n.type===`Stagger`&&Y.editor,o=jp(n)?n:null;if(o||a){let t=th(e),a=this.duration,s=this.iterationDuration,c=r.id,l=0,u=t.length,d=i?i(e,r,this.id,n,u):null,f=o||Y.editor.resolveStagger(n.defaultValue);t.forEach(e=>{let n={...d||r};this.duration=a,this.iterationDuration=s,X(c)||(n.id=c+`-`+l);let i=Ah(this,f(e,l,t,null,this));Mh(n,this,i,e,l,t),l++})}else{let t=i?i(e,r,this.id,n):r,a=n&&n.type?n.defaultValue:n;Mh(t,this,Ah(this,a),e)}}else Mh(e,this,Ah(this,t));return this.composition&&this.init(!0),this}}sync(e,t){if(X(e)||e&&X(e.pause))return this;e.pause();let n=+(e.effect?e.effect.getTiming().duration:e.duration);!X(e)&&!X(e.persist)&&(e.persist=!0);let r=Y.editor,i=r&&r.addTimelineChild;r&&r.addTimelineSync&&(t=r.addTimelineSync(e,t,this.id),r.addTimelineChild=null);let a=this.add(e,{currentTime:[0,n],duration:n,delay:0,ease:`linear`,playbackEase:`linear`},t);return r&&(r.addTimelineChild=i),a}set(e,t,n){return X(t)?this:(t.duration=tp,t.composition=Yf.replace,this.add(e,t,n))}call(e,t){return X(e)||e&&!jp(e)?this:(Y.editor&&Y.editor.addTimelineCall&&(t=Y.editor.addTimelineCall(e,t,this.id)),this.add({duration:0,delay:0,onComplete:()=>e(this)},t))}label(e,t){return X(e)||e&&!Ap(e)?this:(Y.editor&&Y.editor.addTimelineLabel&&(t=Y.editor.addTimelineLabel(e,t,this.id)),this.labels[e]=Ah(this,t),this)}remove(e,t){return Jm(th(e),this,t),this}stretch(e){let t=this.duration;if(t===tm(e))return this;let n=e/t,r=this.labels;im(this,e=>e.stretch(e.duration*n));for(let e in r)r[e]*=n;return super.stretch(e)}refresh(){return im(this,e=>{e.refresh&&e.refresh()}),this}revert(){return super.revert(),im(this,e=>e.revert,!0),jm(this)}then(e){return super.then(e)}},Fh=e=>Y.editor?Y.editor.addTimeline(e):new Ph(e).init(),Ih=rp*10,Lh=class{constructor(e={}){let t=!X(e.bounce)||!X(e.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/rp,this.maxIterations=this.maxDuration/this.timeStep/rp,this.bn=Zp(Z(e.bounce,.5),-1,1),this.pd=Zp(Z(e.duration,628),10*Y.timeScale,Ih*Y.timeScale),this.m=Zp(Z(e.mass,1),1,Ih),this.s=Zp(Z(e.stiffness,100),tp,Ih),this.d=Zp(Z(e.damping,10),tp,Ih),this.v=Zp(Z(e.velocity,0),-Ih,Ih),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=e.onComplete||cp,t&&this.calculateSDFromBD(),this.compute(),this.ease=e=>{let t=e*this.settlingDuration,n=this.completed,r=this.pd;return t>=r&&!n&&(this.completed=!0,this.onComplete(this.parent)),t<r&&n&&(this.completed=!1),e===0||e===1?e:this.solve(e*this.solverDuration)}}solve(e){let{zeta:t,w0:n,wd:r,b:i}=this,a=e;return a=t<1?Kp(-a*t*n)*(1*Wp(r*a)+i*Up(r*a)):t===1?(1+i*a)*Kp(-a*n):((1+i)*Kp((-t*n+r)*a)+(1-i)*Kp((-t*n-r)*a))/2,1-a}calculateSDFromBD(){let e=Y.timeScale===1?this.pd/rp:this.pd;this.m=1,this.v=0,this.s=Vp(2*Yp/e,2),this.d=this.bn>=0?(1-this.bn)*4*Yp/e:4*Yp/(e*(1+this.bn)),this.s=Qp(Zp(this.s,tp,Ih),3),this.d=Qp(Zp(this.d,tp,300),3)}calculateBDFromSD(){let e=2*Yp/Hp(this.s);this.pd=e*(Y.timeScale===1?rp:1),this.bn=this.d/(2*Hp(this.s))<=1?1-this.d*e/(4*Yp):4*Yp/(this.d*e)-1,this.bn=Qp(Zp(this.bn,-1,1),3),this.pd=Qp(Zp(this.pd,10*Y.timeScale,Ih*Y.timeScale),3)}compute(){let{maxRestSteps:e,maxIterations:t,restThreshold:n,timeStep:r,m:i,d:a,s:o,v:s}=this,c=this.w0=Zp(Hp(o/i),tp,rp),l=this.zeta=a/(2*Hp(o*i));l<1?(this.wd=c*Hp(1-l*l),this.b=(l*c+-s)/this.wd):l===1?(this.wd=0,this.b=-s+c):(this.wd=c*Hp(l*l-1),this.b=(l*c+-s)/this.wd);let u=0,d=0,f=0;for(;d<=e&&f<=t;)Gp(1-this.solve(u))<n?d++:d=0,this.solverDuration=u,u+=r,f++;this.settlingDuration=Qp(this.solverDuration*rp,0)*Y.timeScale}get bounce(){return this.bn}set bounce(e){this.bn=Zp(Z(e,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(e){this.pd=Zp(Z(e,1),10*Y.timeScale,Ih*Y.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(e){this.s=Zp(Z(e,100),tp,Ih),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(e){this.d=Zp(Z(e,10),tp,Ih),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(e){this.m=Zp(Z(e,1),1,Ih),this.compute()}get velocity(){return this.v}set velocity(e){this.v=Zp(Z(e,0),-Ih,Ih),this.compute()}},Rh=e=>new Lh(e),zh={_head:null,_tail:null},Bh=(e,t,n)=>{let r=zh._head,i;for(;r;){let a=r._next,o=r.$el===e,s=!t||r.property===t,c=!n||r.parent===n;if(o&&s&&c){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),am(zh,r);let e=r.parent;e&&(e._completed++,e.animations.length===e._completed&&(e.completed=!0,e.paused=!0,e.muteCallbacks||(e.onComplete(e),e._resolve(e))))}r=a}return i},Vh=(e,t,n,r,i)=>{let a=t.animate(r,i),o=i.delay+ +i.duration*i.iterations;a.playbackRate=e._speed,e.paused&&a.pause(),e.duration<o&&(e.duration=o,e.controlAnimation=a),e.animations.push(a),Bh(t,n),om(zh,{parent:e,animation:a,$el:t,property:n,_next:null,_prev:null});let s=()=>Bh(t,n,e);return a.oncancel=s,a.onremove=s,e.persist||(a.onfinish=s),a},Hh=(e,t=100)=>{let n=[];for(let r=0;r<=t;r++)n.push(Qp(e(r/t),4));return`linear(${n.join(`, `)})`},Uh={},Wh=e=>{let t=Uh[e];if(t)return t;if(t=`linear`,Ap(e)){if(Tp(e,`linear`)||Tp(e,`cubic-`)||Tp(e,`steps`)||Tp(e,`ease`))t=e;else if(Tp(e,`cubicB`))t=wp(e);else{let n=mh(e);jp(n)&&(t=n===oh?`linear`:Hh(n))}Uh[e]=t}else if(jp(e)){let n=Hh(e);n&&(t=n)}else e.ease&&(t=Hh(e.ease));return t},Gh=[`x`,`y`,`z`],Kh=[`perspective`,`width`,`height`,`margin`,`padding`,`top`,`right`,`bottom`,`left`,`borderWidth`,`fontSize`,`borderRadius`,...Gh],qh=[...Gh,...op.filter(e=>[`X`,`Y`,`Z`].some(t=>e.endsWith(t)))],Jh=null,Yh=(e,t,n,r,i)=>{let a=Ap(t)?t:_m(t,n,r,i,null,null);return kp(a)?Kh.includes(e)||Tp(e,`translate`)?`${a}px`:Tp(e,`rotate`)||Tp(e,`skew`)?`${a}deg`:`${a}`:a},Xh=(e,t,n,r,i,a)=>{let o=`0`,s=X(r)?getComputedStyle(e)[t]:Yh(t,r,e,i,a);return o=X(n)?Dp(r)?r.map(n=>Yh(t,n,e,i,a)):s:[Yh(t,n,e,i,a),s],o},Zh=class{constructor(e,t){Sp.current&&Sp.current.register(this),Mp(Jh)&&(Uf&&(X(CSS)||!Object.hasOwnProperty.call(CSS,`registerProperty`))?Jh=!1:(op.forEach(e=>{let t=Tp(e,`skew`),n=Tp(e,`scale`),r=Tp(e,`rotate`),i=Tp(e,`translate`),a=r||t,o=a?`<angle>`:n?`<number>`:i?`<length-percentage>`:`*`;try{CSS.registerProperty({name:`--`+e,syntax:o,inherits:!1,initialValue:i?`0px`:a?`0deg`:n?`1`:`0`})}catch{}}),Jh=!0));let n=nh(e);n.length||console.warn(`No target found. Make sure the element you're trying to animate is accessible before creating your animation.`);let r=Z(t.autoplay,Y.defaults.autoplay),i=r&&r.link?r:!1,a=t.alternate&&t.alternate===!0,o=t.reversed&&t.reversed===!0,s=Z(t.loop,Y.defaults.loop),c=s===!0||s===1/0?1/0:kp(s)?s+1:1,l=a?o?`alternate-reverse`:`alternate`:o?`reverse`:`normal`,u=Y.timeScale===1?1:rp;this.targets=n,this.animations=[],this.controlAnimation=null,this.onComplete=t.onComplete||Y.defaults.onComplete,this.duration=0,this.muteCallbacks=!1,this.completed=!1,this.paused=!r||i!==!1,this.reversed=o,this.persist=Z(t.persist,Y.defaults.persist),this.autoplay=r,this._speed=Z(t.playbackRate,Y.defaults.playbackRate),this._resolve=cp,this._completed=0,this._inlineStyles=[],n.forEach((e,r)=>{let i=e[$f],a=qh.some(e=>t.hasOwnProperty(e)),o=e.style,s=this._inlineStyles[r]={},d=Z(t.ease,Y.defaults.ease),f=_m(d,e,r,n,null,null),p=jp(f)||Ap(f)?f:d,m=d.ease&&d,h=Wh(p),g=(m?m.settlingDuration:_m(Z(t.duration,Y.defaults.duration),e,r,n,null,null))*u,_=_m(Z(t.delay,Y.defaults.delay),e,r,n,null,null)*u,v=Z(t.composition,`replace`);for(let d in t){if(!Rp(d))continue;let f={},p={iterations:c,direction:l,fill:`both`,easing:h,duration:g,delay:_,composite:v},m=t[d],y=a?op.includes(d)?d:ap.get(d):!1,b=y?`transform`:d;s[b]||(s[b]=o[b]);let x;if(Op(m)){let t=m,a=Z(t.ease,h),s=a.ease&&a,c=t.to,l=t.from;if(p.duration=(s?s.settlingDuration:_m(Z(t.duration,g),e,r,n,null,null))*u,p.delay=_m(Z(t.delay,_),e,r,n,null,null)*u,p.composite=Z(t.composition,v),p.easing=Wh(a),x=Xh(e,d,l,c,r,n),y?(f[`--${y}`]=x,i[y]=x):f[d]=Xh(e,d,l,c,r,n),Vh(this,e,d,f,p),!X(l)){if(!y)o[d]=f[d][0];else{let e=`--${y}`;o.setProperty(e,f[e][0])}}}else x=Dp(m)?m.map(t=>Yh(d,t,e,r,n)):Yh(d,m,e,r,n),y?(f[`--${y}`]=x,i[y]=x):f[d]=x,Vh(this,e,d,f,p)}if(a){let e=``;for(let t in i)e+=`${sp[t]}var(--${t})) `;o.transform=e}}),i&&this.autoplay.link(this)}forEach(e){try{let t=Ap(e)?t=>t[e]():e;this.animations.forEach(t)}catch{}return this}get speed(){return this._speed}set speed(e){this._speed=+e,this.forEach(t=>t.playbackRate=e)}get currentTime(){let e=this.controlAnimation,t=Y.timeScale;return this.completed?this.duration:e?+e.currentTime*(t===1?1:t):0}set currentTime(e){let t=e*(Y.timeScale===1?1:rp);this.forEach(e=>{!this.persist&&t>=this.duration&&e.play(),e.currentTime=t})}get progress(){return this.currentTime/this.duration}set progress(e){this.forEach(t=>t.currentTime=e*this.duration||0)}resume(){return this.paused?(this.paused=!1,this.forEach(`play`)):this}pause(){return this.paused?this:(this.paused=!0,this.forEach(`pause`))}alternate(){return this.reversed=!this.reversed,this.forEach(`reverse`),this.paused&&this.forEach(`pause`),this}play(){return this.reversed&&this.alternate(),this.resume()}reverse(){return this.reversed||this.alternate(),this.resume()}seek(e,t=!1){return t&&(this.muteCallbacks=!0),e<this.duration&&(this.completed=!1),this.currentTime=e,this.muteCallbacks=!1,this.paused&&this.pause(),this}restart(){return this.completed=!1,this.seek(0,!0).resume()}commitStyles(){return this.forEach(`commitStyles`)}complete(){return this.seek(this.duration)}cancel(){return this.muteCallbacks=!0,this.commitStyles().forEach(`cancel`),this.animations.length=0,requestAnimationFrame(()=>{this.targets.forEach(e=>{e.style.transform===`none`&&e.style.removeProperty(`transform`)})}),this}revert(){return this.cancel().targets.forEach((e,t)=>{let n=e.style,r=this._inlineStyles[t];for(let t in r){let i=r[t];X(i)||i===``?n.removeProperty(wp(t)):e.style[t]=i}e.getAttribute(`style`)===``&&e.removeAttribute(`style`)}),this}then(e=cp){let t=this.then,n=()=>{this.then=null,e(this),this.then=t,this._resolve=cp};return new Promise(e=>(this._resolve=()=>e(n()),this.completed&&this._resolve(),this))}},Qh={animate:(e,t)=>new Zh(e,t),convertEase:Hh},$h=0,eg=0,tg=(e,t)=>!e||!t?!1:e===t||e.contains(t),ng=e=>{if(!e)return null;let t=e.style,n=t.transition||``;return t.setProperty(`transition`,`none`,`important`),n},rg=(e,t)=>{if(!e)return;let n=e.style;t?n.transition=t:n.removeProperty(`transition`)},ig=e=>{let t=e.layout.transitionMuteStore,n=e.$el,r=e.$measure;n&&!t.has(n)&&t.set(n,ng(n)),r&&!t.has(r)&&t.set(r,ng(r))},ag=e=>{e.forEach((e,t)=>rg(t,e)),e.clear()},og={display:`none`,visibility:`hidden`,opacity:`0`,transform:`none`,position:`static`},sg=e=>{if(!e)return;let t=e.parentNode;t&&(t._head===e&&(t._head=e._next),t._tail===e&&(t._tail=e._prev),e._prev&&(e._prev._next=e._next),e._next&&(e._next._prev=e._prev),e._prev=null,e._next=null,e.parentNode=null)},cg=(e,t,n,r)=>{let i=e.dataset.layoutId;i||=e.dataset.layoutId=`node-${eg++}`;let a=r||{};return a.$el=e,a.$measure=e,a.id=i,a.index=0,a.targets=null,a.delay=0,a.duration=0,a.ease=null,a.state=n,a.layout=n.layout,a.parentNode=t||null,a.isTarget=!1,a.isEntering=!1,a.isLeaving=!1,a.isInlined=!1,a.hasTransform=!1,a.inlineStyles=[],a.inlineTransforms=null,a.inlineTransition=null,a.branchAdded=!1,a.branchRemoved=!1,a.branchNotRendered=!1,a.sizeChanged=!1,a.hasVisibilitySwap=!1,a.hasDisplayNone=!1,a.hasVisibilityHidden=!1,a.measuredInlineTransform=null,a.measuredInlineTransition=null,a.measuredDisplay=null,a.measuredVisibility=null,a.measuredPosition=null,a.measuredHasDisplayNone=!1,a.measuredHasVisibilityHidden=!1,a.measuredIsVisible=!1,a.measuredIsRemoved=!1,a.measuredIsInsideRoot=!1,a.properties={transform:`none`,x:0,y:0,left:0,top:0,clientLeft:0,clientTop:0,width:0,height:0},a.layout.properties.forEach(e=>a.properties[e]=0),a._head=null,a._tail=null,a._prev=null,a._next=null,a},lg=(e,t,n,r)=>{let i=e.$el,a=e.layout.root,o=a===i,s=e.properties,c=e.state.rootNode,l=e.parentNode,u=n.transform,d=i.style.transform,f=l?l.measuredIsRemoved:!1,p=n.position;o&&(e.layout.absoluteCoords=p===`fixed`||p===`absolute`),e.$measure=t,e.inlineTransforms=d,e.hasTransform=u&&u!==`none`,e.measuredIsInsideRoot=tg(a,t),e.measuredInlineTransform=null,e.measuredDisplay=n.display,e.measuredVisibility=n.visibility,e.measuredPosition=p,e.measuredHasDisplayNone=n.display===`none`,e.measuredHasVisibilityHidden=n.visibility===`hidden`,e.measuredIsVisible=!(e.measuredHasDisplayNone||e.measuredHasVisibilityHidden),e.measuredIsRemoved=e.measuredHasDisplayNone||e.measuredHasVisibilityHidden||f;let m=!1,h=i.previousSibling;for(;h&&(h.nodeType===Node.COMMENT_NODE||h.nodeType===Node.TEXT_NODE&&!h.textContent.trim());)h=h.previousSibling;if(h&&h.nodeType===Node.TEXT_NODE)m=!0;else{for(h=i.nextSibling;h&&(h.nodeType===Node.COMMENT_NODE||h.nodeType===Node.TEXT_NODE&&!h.textContent.trim());)h=h.nextSibling;m=h!==null&&h.nodeType===Node.TEXT_NODE}if(e.isInlined=m,e.hasTransform&&!r){let n=e.layout.transitionMuteStore;n.get(i)||(e.inlineTransition=ng(i)),t===i?i.style.transform=`none`:(n.get(t)||(e.measuredInlineTransition=ng(t)),e.measuredInlineTransform=t.style.transform,t.style.transform=`none`)}let g=0,_=0,v=0,y=0;if(!r){let e=t.getBoundingClientRect();g=e.left,_=e.top,v=e.width,y=e.height}for(let e in s){let t=e===`transform`?u:n[e]||n.getPropertyValue&&n.getPropertyValue(e);X(t)||(s[e]=t)}s.left=g,s.top=_,s.clientLeft=r?0:t.clientLeft,s.clientTop=r?0:t.clientTop;let b,x;if(o)e.layout.absoluteCoords?(b=g,x=_):(b=0,x=0);else{let t=l||c,n=t.properties.left,r=t.properties.top,i=t.properties.clientLeft,a=t.properties.clientTop;if(e.layout.absoluteCoords)b=g-n-i,x=_-r-a;else if(t===c){let e=c.properties.left,t=c.properties.top,n=c.properties.clientLeft,r=c.properties.clientTop;b=g-e-n,x=_-t-r}else b=g-n-i,x=_-r-a}return s.x=b,s.y=x,s.width=v,s.height=y,e},ug=(e,t)=>{if(t)for(let n in t)e.properties[n]=t[n]},dg=(e,t)=>{let n=_m(t.ease,e.$el,e.index,e.targets,null,null),r=jp(n)?n:t.ease,i=!X(r)&&!X(r.ease);e.ease=i?r.ease:r,e.duration=i?r.settlingDuration:_m(t.duration,e.$el,e.index,e.targets,null,null),e.delay=_m(t.delay,e.$el,e.index,e.targets,null,null)},fg=e=>{let t=e.$el.style,n=e.inlineStyles;n.length=0,e.layout.recordedProperties.forEach(e=>{n.push(e,t[e]||``)})},pg=e=>{let t=e.$el.style,n=e.inlineStyles;for(let e=0,r=n.length;e<r;e+=2){let r=n[e],i=n[e+1];i&&i!==``?t[r]=i:(t[r]=``,t.removeProperty(r))}},mg=e=>{let t=e.inlineTransforms,n=e.$el.style;!e.hasTransform||!t||e.hasTransform&&n.transform===`none`||t&&t===`none`?n.removeProperty(`transform`):t&&(n.transform=t);let r=e.$measure;if(e.hasTransform&&r!==e.$el){let t=r.style,n=e.measuredInlineTransform;n&&n!==``?t.transform=n:t.removeProperty(`transform`)}e.measuredInlineTransform=null,e.inlineTransition!==null&&(rg(e.$el,e.inlineTransition),e.inlineTransition=null),r!==e.$el&&e.measuredInlineTransition!==null&&(rg(r,e.measuredInlineTransition),e.measuredInlineTransition=null)},hg=e=>{(e.measuredIsRemoved||e.hasVisibilitySwap)&&(e.$el.style.removeProperty(`display`),e.$el.style.removeProperty(`visibility`),e.hasVisibilitySwap&&(e.$measure.style.removeProperty(`display`),e.$measure.style.removeProperty(`visibility`))),e.layout.pendingRemoval.delete(e.$el)},gg=(e,t,n)=>(t.properties={...e.properties},t.state=n,t.isTarget=e.isTarget,t.hasTransform=e.hasTransform,t.inlineTransforms=e.inlineTransforms,t.measuredIsVisible=e.measuredIsVisible,t.measuredDisplay=e.measuredDisplay,t.measuredIsRemoved=e.measuredIsRemoved,t.measuredHasDisplayNone=e.measuredHasDisplayNone,t.measuredHasVisibilityHidden=e.measuredHasVisibilityHidden,t.hasDisplayNone=e.hasDisplayNone,t.isInlined=e.isInlined,t.hasVisibilityHidden=e.hasVisibilityHidden,t),_g=class{constructor(e){this.layout=e,this.rootNode=null,this.rootNodes=new Set,this.nodes=new Map,this.scrollX=0,this.scrollY=0}revert(){return this.forEachNode(e=>{this.layout.pendingRemoval.delete(e.$el),e.$el.removeAttribute(`data-layout-id`),e.$measure.removeAttribute(`data-layout-id`)}),this.rootNode=null,this.rootNodes.clear(),this.nodes.clear(),this}getNode(e){if(!(!e||!e.dataset))return this.nodes.get(e.dataset.layoutId)}getComputedValue(e,t){let n=this.getNode(e);if(n)return n.properties[t]}forEach(e,t){let n=e,r=0;for(;n;)if(t(n,r++),n._head)n=n._head;else if(n._next)n=n._next;else{for(;n&&!n._next;)n=n.parentNode;n&&=n._next}}forEachRootNode(e){this.forEach(this.rootNode,e)}forEachNode(e){for(let t of this.rootNodes)this.forEach(t,e)}registerElement(e,t){if(!e||e.nodeType!==1)return null;this.layout.transitionMuteStore.has(e)||this.layout.transitionMuteStore.set(e,ng(e));let n=[e,t],r=this.layout.root,i=null;for(;n.length;){let e=n.pop(),t=n.pop();if(!t||t.nodeType!==1||Np(t))continue;let a=e?e.measuredIsRemoved:!1,o=a?og:getComputedStyle(t),s=a?!0:o.display===`none`,c=a?!0:o.visibility===`hidden`,l=!s&&!c,u=t.dataset.layoutId,d=tg(r,t),f=u?this.nodes.get(u):null;if(f&&f.$el!==t){let s=tg(r,f.$el),c=f.measuredIsVisible,u=!s&&(d||!d&&!c&&l),p=s&&!c&&l;if(u)sg(f),f=cg(t,e,this,f);else if(p){lg(f,t,o,a);let e=t.lastElementChild;for(;e;)n.push(e,f),e=e.previousElementSibling;i||=f;continue}else{let r=t.lastElementChild;for(;r;)n.push(r,e),r=r.previousElementSibling;i||=f;continue}}else f=cg(t,e,this,f);f.branchAdded=!1,f.branchRemoved=!1,f.branchNotRendered=!1,f.isTarget=!1,f.sizeChanged=!1,f.hasVisibilityHidden=c,f.hasDisplayNone=s,f.hasVisibilitySwap=c&&!f.measuredHasVisibilityHidden||s&&!f.measuredHasDisplayNone,this.nodes.set(f.id,f),f.parentNode=e||null,f._prev=null,f._next=null,e?(this.rootNodes.delete(f),e._head?(e._tail._next=f,f._prev=e._tail,e._tail=f):(e._head=f,e._tail=f)):this.rootNodes.add(f),lg(f,f.$el,o,a);let p=t.lastElementChild;for(;p;)n.push(p,f),p=p.previousElementSibling;i||=f}return i}ensureDetachedNode(e,t){if(!e||e===this.layout.root)return null;let n=e.dataset.layoutId,r=n?this.nodes.get(n):null;if(r&&r.$el===e)return r;let i=null,a=e.parentElement;for(;a&&a!==this.layout.root;){if(t.has(a)){i=this.ensureDetachedNode(a,t);break}a=a.parentElement}return this.registerElement(e,i)}record(){let e=this.layout,t=e.children,n=e.root,r=Dp(t)?t:[t],i=[],a=t===`*`?n:Sp.root,o=[],s=n.parentElement;for(;s&&s.nodeType===1;){let e=getComputedStyle(s);if(e.transform&&e.transform!==`none`){let e=s.style.transform||``,t=ng(s);o.push(s,e,t),s.style.transform=`none`}s=s.parentElement}for(let e=0,t=r.length;e<t;e++){let t=r[e];i[e]=Ap(t)?a.querySelectorAll(t):t}let c=nh(i);this.nodes.clear(),this.rootNodes.clear();let l=this.registerElement(n,null);l.isTarget=!0,this.rootNode=l;let u=new Set,d=0,f=[];this.nodes.forEach(e=>{f.push(e.$el)}),this.nodes.forEach((e,t)=>{e.index=d++,e.targets=f,e&&e.measuredIsInsideRoot&&u.add(t)});let p=new Set,m=[];for(let e=0,t=c.length;e<t;e++){let t=c[e];if(!(!t||t.nodeType!==1||t===n)){if(!tg(n,t)){let e=t.dataset.layoutId;if(!e||!u.has(e))continue}p.has(t)||(p.add(t),m.push(t))}}for(let e=0,t=m.length;e<t;e++)this.ensureDetachedNode(m[e],p);for(let e=0,t=c.length;e<t;e++){let t=c[e],n=this.getNode(t);if(n){let e=n;for(;e&&!e.isTarget;)e.isTarget=!0,e=e.parentNode}}this.scrollX=window.scrollX,this.scrollY=window.scrollY,this.forEachNode(mg);for(let e=0,t=o.length;e<t;e+=3){let t=o[e],n=o[e+1],r=o[e+2];n&&n!==``?t.style.transform=n:t.style.removeProperty(`transform`),rg(t,r)}return this}};function vg(e){let t={},n={};for(let r in e){let i=e[r];r===`duration`||r===`delay`||r===`ease`?n[r]=i:t[r]=i}return[t,n]}var yg=class{constructor(e,t={}){Sp.current&&Sp.current.register(this);let n=vg(t.swapAt),r=vg(t.enterFrom),i=vg(t.leaveTo),a=t.properties;if(t.duration=Z(t.duration,350),t.delay=Z(t.delay,0),t.ease=Z(t.ease,`inOut(3.5)`),this.params=t,this.root=nh(e)[0],this.id=t.id||$h++,this.children=t.children||`*`,this.absoluteCoords=!1,this.swapAtParams=rm(t.swapAt||{opacity:0},{ease:`inOut(1.75)`}),this.enterFromParams=t.enterFrom||{opacity:0},this.leaveToParams=t.leaveTo||{opacity:0},this.properties=new Set([`opacity`,`fontSize`,`color`,`backgroundColor`,`borderRadius`,`border`,`filter`,`clipPath`]),n[0])for(let e in n[0])this.properties.add(e);if(r[0])for(let e in r[0])this.properties.add(e);if(i[0])for(let e in i[0])this.properties.add(e);if(a)for(let e=0,t=a.length;e<t;e++)this.properties.add(a[e]);this.recordedProperties=new Set([`display`,`visibility`,`translate`,`position`,`left`,`top`,`marginLeft`,`marginTop`,`width`,`height`,`maxWidth`,`maxHeight`,`minWidth`,`minHeight`]),this.properties.forEach(e=>this.recordedProperties.add(e)),this.pendingRemoval=new WeakSet,this.transitionMuteStore=new Map,this.oldState=new _g(this),this.newState=new _g(this),this.timeline=null,this.transformAnimation=null,this.animating=[],this.swapping=[],this.leaving=[],this.entering=[],this.oldState.record(),ag(this.transitionMuteStore)}revert(){return this.root.classList.remove(`is-animated`),this.timeline&&=(this.timeline.complete(),null),this.transformAnimation&&=(this.transformAnimation.complete(),null),this.animating.length=this.swapping.length=this.leaving.length=this.entering.length=0,this.oldState.revert(),this.newState.revert(),requestAnimationFrame(()=>ag(this.transitionMuteStore)),this}record(){return this.transformAnimation&&=(this.transformAnimation.cancel(),null),this.oldState.record(),this.timeline&&=(this.timeline.cancel(),null),this.newState.forEachRootNode(pg),this}animate(e={}){let t={ease:Z(e.ease,this.params.ease),delay:Z(e.delay,this.params.delay),duration:Z(e.duration,this.params.duration)},n={id:this.id},r=Z(e.onComplete,this.params.onComplete),i=Z(e.onPause,this.params.onPause);for(let t in xp)t!==`ease`&&t!==`duration`&&t!==`delay`&&(X(e[t])?X(this.params[t])||(n[t]=this.params[t]):n[t]=e[t]);n.onComplete=()=>{let t=e.autoplay,n=Y.editor;if(t&&t.linked||n&&n.showPanel){r&&r(this.timeline);return}this.transformAnimation&&this.transformAnimation.cancel(),h.forEachRootNode(e=>{hg(e),pg(e)});for(let e=0,t=C.length;e<t;e++){let t=C[e];t.style.transform=h.getComputedValue(t,`transform`)}this.root.classList.contains(`is-animated`)&&(this.root.classList.remove(`is-animated`),r&&r(this.timeline)),requestAnimationFrame(()=>{this.root.classList.contains(`is-animated`)||ag(this.transitionMuteStore)})},n.onPause=()=>{let t=e.autoplay;if(t&&t.linked){r&&r(this.timeline),i&&i(this.timeline);return}this.root.classList.contains(`is-animated`)&&(this.transformAnimation&&this.transformAnimation.cancel(),h.forEachRootNode(hg),this.root.classList.remove(`is-animated`),r&&r(this.timeline),i&&i(this.timeline))},n.composition=!1;let a=rm(rm(e.swapAt||{},this.swapAtParams),t),o=rm(rm(e.enterFrom||{},this.enterFromParams),t),s=rm(rm(e.leaveTo||{},this.leaveToParams),t),[c,l]=vg(a),[u,d]=vg(o),[f,p]=vg(s),m=this.oldState,h=this.newState,g=this.animating,_=this.swapping,v=this.entering,y=this.leaving,b=this.pendingRemoval;g.length=_.length=v.length=y.length=0,m.forEachRootNode(ig),h.record(),h.forEachRootNode(fg);let x=[],S=[],C=[],w=[],T=h.rootNode,E=T.$el;h.forEachRootNode(e=>{let t=e.$el,n=e.id,r=e.parentNode,i=r?r.branchAdded:!1,a=r?r.branchRemoved:!1,o=r?r.branchNotRendered:!1,s=m.nodes.get(n),c=!s;c?(s=gg(e,{},m),m.nodes.set(n,s),s.measuredIsRemoved=!0):s.measuredIsRemoved&&!e.measuredIsRemoved&&(gg(e,s,m),s.measuredIsRemoved=!0);let l=s.parentNode,d=(l?l.id:null)!==(r?r.id:null),p=s.$el!==e.$el,_=s.measuredIsRemoved,S=e.measuredIsRemoved;if(!s.measuredIsRemoved&&!S&&!c&&(d||p)){let e=s.properties.left,t=s.properties.top,n=r||h.rootNode,i=n.id?m.nodes.get(n.id):null,a=i?i.properties.left:n.properties.left,o=i?i.properties.top:n.properties.top,c=i?i.properties.clientLeft:n.properties.clientLeft,l=i?i.properties.clientTop:n.properties.clientTop;s.properties.x=e-a-c,s.properties.y=t-o-l}e.hasVisibilitySwap&&(e.hasVisibilityHidden&&(e.$el.style.visibility=`visible`,e.$measure.style.visibility=`hidden`),e.hasDisplayNone&&(e.$el.style.display=s.measuredDisplay||e.measuredDisplay||``,e.$measure.style.visibility=`hidden`));let C=b.has(t),w=s.measuredIsVisible,E=e.measuredIsVisible,D=!w&&E&&!o,O=!S&&(_||C)&&!i,k=S&&!_&&!a,A=k||S&&C&&!a;e.branchAdded=i||O,e.branchRemoved=a||A,e.branchNotRendered=o||S,S&&w&&(e.$el.style.display=s.measuredDisplay,e.$el.style.visibility=`visible`,gg(s,e,h)),k?(e.isTarget&&(y.push(t),e.isLeaving=!0),b.add(t)):!S&&C&&b.delete(t),O&&!o||D?(ug(s,u),e.isTarget&&(v.push(t),e.isEntering=!0)):A&&!o&&ug(e,f),e!==T&&e.isTarget&&!e.isEntering&&!e.isLeaving&&g.push(t),x.push(t)});let D=0,O=0,k=0;h.forEachRootNode(e=>{let n=e.$el,r=e.parentNode,i=m.nodes.get(e.id),a=e.properties,o=i.properties,s=r!==T&&r;for(;s&&!s.isTarget&&s!==T;)s=s.parentNode;e===T?(e.index=0,e.targets=g,dg(e,t)):e.isEntering?(e.index=s?s.index:D,e.targets=s?g:v,dg(e,d),D++):e.isLeaving?(e.index=s?s.index:O,e.targets=s?g:y,O++,dg(e,p)):e.isTarget?(e.index=k++,e.targets=g,dg(e,t)):(e.index=s?s.index:0,e.targets=g,dg(e,l)),i.index=e.index,i.targets=e.targets;for(let t in a)a[t]=_m(a[t],n,e.index,e.targets,null,null),o[t]=_m(o[t],n,i.index,i.targets,null,null);let u=Math.abs(a.width-o.width)>1,f=Math.abs(a.height-o.height)>1;if(e.sizeChanged=u||f,e.isTarget&&(!e.measuredIsRemoved&&i.measuredIsVisible||e.measuredIsRemoved&&e.measuredIsVisible)){(a.transform!==`none`||o.transform!==`none`)&&(e.hasTransform=!0,C.push(n));for(let e in a)if(e!==`transform`&&a[e]!==o[e]){S.push(n);break}}e.isTarget||(_.push(n),e.sizeChanged&&r&&r.isTarget&&r.sizeChanged&&(c.transform&&(e.hasTransform=!0,C.push(n)),w.push(n)))});let A={delay:e=>h.getNode(e).delay,duration:e=>h.getNode(e).duration,ease:e=>h.getNode(e).ease};if(n.defaults=A,this.timeline=Fh(n),!S.length&&!C.length&&!_.length)return ag(this.transitionMuteStore),this.timeline.complete();if(x.length){this.root.classList.add(`is-animated`);for(let e=0,t=x.length;e<t;e++){let t=x[e],n=t.dataset.layoutId,r=m.nodes.get(n),i=h.nodes.get(n),a=r.properties;i.isInlined||((r.measuredDisplay===`grid`||i.measuredDisplay===`grid`)&&t.style.setProperty(`display`,`block`,`important`),(t!==E||this.absoluteCoords)&&(t.style.position=this.absoluteCoords?`fixed`:`absolute`,t.style.left=`0px`,t.style.top=`0px`,t.style.marginLeft=`0px`,t.style.marginTop=`0px`,t.style.translate=`${a.x}px ${a.y}px`),t===E&&i.measuredPosition===`static`&&(t.style.position=`relative`,t.style.left=`0px`,t.style.top=`0px`)),t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.minWidth=`auto`,t.style.minHeight=`auto`,t.style.maxWidth=`none`,t.style.maxHeight=`none`}(m.scrollX!==window.scrollX||m.scrollY!==window.scrollY)&&requestAnimationFrame(()=>window.scrollTo(m.scrollX,m.scrollY));for(let e=0,t=S.length;e<t;e++){let t=S[e],n=t.dataset.layoutId,r=m.nodes.get(n),i=h.nodes.get(n),a=r.properties,o=i.properties,s=!1,c={composition:`none`};a.width!==o.width&&(c.width=[a.width,o.width],s=!0),a.height!==o.height&&(c.height=[a.height,o.height],s=!0),!i.hasTransform&&!i.isInlined&&(c.translate=[`${a.x}px ${a.y}px`,`${o.x}px ${o.y}px`],s=!0),this.properties.forEach(e=>{let t=a[e],n=o[e];e!==`transform`&&t!==n&&(c[e]=[t,n],s=!0)}),s&&this.timeline.add(t,c,0)}}if(_.length){for(let e=0,t=_.length;e<t;e++){let t=_[e],n=m.getNode(t),r=n.properties;t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.minWidth=`auto`,t.style.minHeight=`auto`,t.style.maxWidth=`none`,t.style.maxHeight=`none`,n.isInlined||(t.style.translate=`${r.x}px ${r.y}px`),this.properties.forEach(e=>{e!==`transform`&&(t.style[e]=`${m.getComputedValue(t,e)}`)})}for(let e=0,t=_.length;e<t;e++){let t=_[e],n=h.getNode(t),r=n.properties;this.timeline.call(()=>{t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.minWidth=`auto`,t.style.minHeight=`auto`,t.style.maxWidth=`none`,t.style.maxHeight=`none`,n.isInlined||(t.style.translate=`${r.x}px ${r.y}px`),this.properties.forEach(e=>{e!==`transform`&&(t.style[e]=`${h.getComputedValue(t,e)}`)})},n.delay+n.duration/2)}if(w.length){let e=gh(h.nodes.get(w[0].dataset.layoutId).ease),t=t=>1-e(1-t),n={};if(c)for(let e in c)e!==`transform`&&(n[e]=[{from:t=>m.getComputedValue(t,e),to:c[e]},{from:c[e],to:t=>h.getComputedValue(t,e),ease:t}]);this.timeline.add(w,n,0)}}let j=C.length;if(j){for(let e=0;e<j;e++){let t=C[e],n=h.getNode(t);n.isInlined||(t.style.translate=`${m.getComputedValue(t,`x`)}px ${m.getComputedValue(t,`y`)}px`),t.style.transform=m.getComputedValue(t,`transform`),w.includes(t)&&(n.ease=_m(a.ease,t,n.index,n.targets,null,null),n.duration=_m(a.duration,t,n.index,n.targets,null,null))}this.transformAnimation=Qh.animate(C,{translate:e=>h.getNode(e).isInlined?`0px 0px`:`${h.getComputedValue(e,`x`)}px ${h.getComputedValue(e,`y`)}px`,transform:e=>{let t=h.getComputedValue(e,`transform`);if(!w.includes(e))return t;let n=m.getComputedValue(e,`transform`),r=h.getNode(e);return[n,_m(c.transform,e,r.index,r.targets,null,null),t]},autoplay:!1,...A}),this.timeline.sync(this.transformAnimation,0)}return this.timeline.init()}update(e,t={}){return this.record(),e(this),this.animate(t)}},bg=(e,t)=>new yg(e,t);function xg(e,t,n,r){return{id:t,kind:e,svg:`<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><rect width="128" height="128" rx="32" fill="${n}"/>${r}</svg>`}}function Sg(e,t,n,r,i){return xg(`user`,e,t,`<circle cx="64" cy="64" r="44" fill="${n}" opacity=".18"/><circle cx="64" cy="${r}" r="${i}" fill="${n}"/><path d="M28 108c5-24 18-36 36-36s31 12 36 36" fill="${n}"/>`)}function Cg(e,t,n,r,i){return xg(`bot`,e,t,`<path d="${i}" stroke="${n}" stroke-width="7" stroke-linecap="round"/><rect x="24" y="32" width="80" height="68" rx="22" fill="${n}"/><circle cx="49" cy="62" r="8" fill="${r}"/><circle cx="79" cy="62" r="8" fill="${r}"/><path d="M45 82h38" stroke="${r}" stroke-width="7" stroke-linecap="round"/>`)}function wg(e,t,n,r,i){return xg(`group`,e,t,`<circle cx="46" cy="50" r="16" fill="${n}"/><circle cx="82" cy="50" r="16" fill="${r}"/><circle cx="64" cy="42" r="18" fill="${n}"/><path d="M17 105c3-20 14-30 29-30 8 0 14 2 18 7 4-5 10-7 18-7 15 0 26 10 29 30" fill="${r}"/><path d="M33 ${108-i%3*2}c4-25 15-37 31-37s27 12 31 37" fill="${n}"/>`)}var Tg={user:[Sg(`sunny`,`#f59e0b`,`#fff7ed`,54,20),Sg(`mint`,`#10b981`,`#ecfdf5`,50,19),Sg(`ocean`,`#0ea5e9`,`#f0f9ff`,52,20),Sg(`violet`,`#8b5cf6`,`#f5f3ff`,51,19),Sg(`rose`,`#f43f5e`,`#fff1f2`,53,20),Sg(`slate`,`#475569`,`#f8fafc`,50,18),Sg(`coral`,`#f97316`,`#fff7ed`,52,19),Sg(`indigo`,`#4f46e5`,`#eef2ff`,51,20)],bot:[Cg(`cobalt`,`#1d4ed8`,`#dbeafe`,`#1e3a8a`,`M64 32V18M64 18l10-8`),Cg(`cyan`,`#0891b2`,`#cffafe`,`#155e75`,`M64 32V16M55 12h18`),Cg(`emerald`,`#059669`,`#d1fae5`,`#065f46`,`M64 32V17M64 17l-9-7`),Cg(`amber`,`#d97706`,`#fef3c7`,`#92400e`,`M64 32V15M64 15h12`),Cg(`magenta`,`#c026d3`,`#fae8ff`,`#86198f`,`M64 32V18M54 12l10 6`),Cg(`crimson`,`#dc2626`,`#fee2e2`,`#991b1b`,`M64 32V16M58 10h12`),Cg(`navy`,`#334155`,`#e2e8f0`,`#0f172a`,`M64 32V17M64 17l8-7`),Cg(`lime`,`#65a30d`,`#ecfccb`,`#3f6212`,`M64 32V16M54 9l10 7`)],group:[wg(`harbor`,`#0f766e`,`#ccfbf1`,`#5eead4`,0),wg(`sky`,`#0369a1`,`#e0f2fe`,`#7dd3fc`,1),wg(`grape`,`#7e22ce`,`#f3e8ff`,`#d8b4fe`,2),wg(`cherry`,`#be123c`,`#ffe4e6`,`#fda4af`,3),wg(`forest`,`#15803d`,`#dcfce7`,`#86efac`,4),wg(`sunset`,`#c2410c`,`#ffedd5`,`#fdba74`,5),wg(`night`,`#3730a3`,`#e0e7ff`,`#a5b4fc`,6),wg(`stone`,`#44403c`,`#f5f5f4`,`#d6d3d1`,7)]};function Eg(e){let t=new TextEncoder().encode(e.svg),n=``;for(let e of t)n+=String.fromCharCode(e);return`data:image/svg+xml;base64,${btoa(n)}`}function Dg({kind:e,onBack:t,onSelect:n}){let r=J();return x(`section`,{className:`flex flex-col gap-4`,"aria-label":r(`sandbox.avatar.title`),children:[x(`header`,{className:`flex items-start gap-2`,children:[b(G,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":r(`sandbox.avatar.back`),onClick:t,children:b(on,{})}),x(`div`,{className:`flex flex-col gap-1`,children:[b(`strong`,{className:`text-sm font-medium`,children:r(`sandbox.avatar.title`)}),b(`p`,{className:`text-xs text-muted-foreground`,children:r(`sandbox.avatar.description`)})]})]}),b(Og,{kind:e,onSelect:n})]})}function Og({kind:t,onSelect:n}){let r=J(),[i,a]=e.useState(``),o=e.useRef(null);return x(`div`,{className:`flex flex-col gap-4`,children:[b(`div`,{className:`grid grid-cols-4 gap-2`,children:Tg[t].map(e=>b(`button`,{type:`button`,className:`aspect-square overflow-hidden rounded-full ring-1 ring-border transition-transform duration-150 ease-spring hover:scale-105 focus-visible:outline-2 focus-visible:outline-ring`,"aria-label":r(`sandbox.avatar.builtin`,{id:e.id}),onClick:()=>n(Eg(e)),children:b(`img`,{src:Eg(e),alt:``,className:`size-full`})},e.id))}),b(`input`,{ref:o,type:`file`,className:`hidden`,accept:`image/png,image/jpeg,image/webp,image/gif,image/svg+xml`,onChange:e=>{let t=e.target.files?.[0];if(e.target.value=``,!t)return;if(!t.type.startsWith(`image/`))return a(r(`sandbox.avatar.notImage`));let i=new FileReader;i.addEventListener(`load`,()=>{typeof i.result==`string`&&(a(``),n(i.result))}),i.addEventListener(`error`,()=>a(r(`sandbox.avatar.readFailed`))),i.readAsDataURL(t)}}),x(`button`,{type:`button`,className:`flex items-center gap-3 rounded-lg border border-border px-3 py-2 text-left transition-colors hover:bg-accent`,onClick:()=>o.current?.click(),children:[b(`span`,{className:`flex size-8 items-center justify-center rounded-md bg-muted`,children:b(cr,{className:`size-4`})}),x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[b(`strong`,{className:`text-[13px] font-medium`,children:r(`sandbox.avatar.upload`)}),b(`small`,{className:`text-xs text-muted-foreground`,children:r(`sandbox.avatar.uploadHint`)})]}),b(xn,{className:`size-4 text-muted-foreground`})]}),i&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:i})]})}var kg=[{value:`napcat`,label:`NapCat`},{value:`llbot`,label:`LLBot`},{value:`snowluma`,label:`SnowLuma`}];function Ag(e){return kg.find(t=>t.value===e)?.label??e}function jg({type:t,operator:n,bots:r=[],side:i=`right`,trigger:a,onOpenChange:o}){let s=J(),{store:c}=Jd(),[l,u]=e.useState(!1),[d,f]=e.useState(!1),[p,m]=e.useState(``),[h,g]=e.useState(!1),[_,v]=e.useState(`user`),[S,C]=e.useState(`napcat`),[w,T]=e.useState(!0),[E,D]=e.useState({id:``,name:``,avatar:``,personalNote:``}),O=t===`participant`?_:t,k=!!n&&r.length>0,A=e=>{u(e),o?.(e),e&&(m(``),g(!1),D({id:``,name:``,avatar:``,personalNote:``}),v(`user`),C(`napcat`),T(!0))},j=()=>{let e=E.personalNote.trim()?{personalNote:E.personalNote.trim()}:void 0,t=E.avatar?{avatar:E.avatar}:{};if(O===`user`)return{action:`create-user`,data:{id:E.id,name:E.name,...t,...e?{profile:e}:{}}};if(O===`bot`)return{action:`create-bot`,data:{id:E.id,name:E.name,implementation:S,enabled:w,...t,...e?{profile:e}:{}}};if(!(!n||!r.length))return{action:`create-group`,data:{id:E.id,name:E.name,...t,members:[{participantId:n.id,card:n.name,role:`owner`},...r.filter(({id:e})=>e!==n.id).map(e=>({participantId:e.id,card:e.name,role:`member`}))]}}},M=async e=>{if(e.preventDefault(),d)return;let t=j();if(t){f(!0),m(``);try{await c.manageEnvironment(t),A(!1)}catch(e){m(zd(e,s(`sandbox.create.failed`)))}finally{f(!1)}}},N=s(t===`participant`?`sandbox.create.participant`:`sandbox.create.${t}`),ee=O===`user`?s(`sandbox.create.userHint`):O===`bot`?s(`sandbox.create.botHint`):n?r.length?s(`sandbox.create.groupHint`,{name:n.name}):s(`sandbox.create.groupNoBot`):s(`sandbox.create.groupNoOperator`);return x(Lr,{open:l,onOpenChange:A,children:[b(Rr,{render:a}),b(zr,{side:i,align:`start`,className:`sandbox-glass w-80 gap-4 p-4`,"aria-label":N,children:h?b(Dg,{kind:O,onBack:()=>g(!1),onSelect:e=>{D(t=>({...t,avatar:e})),g(!1)}}):x(`form`,{className:`flex flex-col gap-4`,onSubmit:M,children:[x(`div`,{className:`flex items-center gap-3`,children:[x(`button`,{type:`button`,className:`group relative rounded-full`,"aria-label":s(`sandbox.avatar.title`),onClick:()=>g(!0),children:[b(Hf,{kind:O,name:E.name,src:E.avatar,className:`size-12`,badge:!1}),b(`span`,{className:`absolute inset-0 flex items-center justify-center rounded-full bg-black/45 text-[10px] text-white opacity-0 transition-opacity group-hover:opacity-100`,children:s(`sandbox.avatar.change`)})]}),x(`header`,{className:`flex min-w-0 flex-col gap-1`,children:[b(`strong`,{className:`text-sm font-medium`,children:N}),b(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:ee})]})]}),t===`participant`&&x(`div`,{className:`flex flex-col gap-2`,children:[b(Cc,{children:s(`sandbox.create.accountType`)}),x(Ec,{value:_,onValueChange:e=>e&&v(e===`bot`?`bot`:`user`),items:[{value:`user`,label:s(`sandbox.kind.user`)},{value:`bot`,label:s(`sandbox.kind.bot`)}],children:[b(Oc,{className:`w-full`,children:b(Dc,{})}),x(kc,{className:`sandbox-glass`,children:[b(Ac,{value:`user`,children:s(`sandbox.kind.user`)}),b(Ac,{value:`bot`,children:s(`sandbox.kind.bot`)})]})]})]}),x(`div`,{className:`flex flex-col gap-2`,children:[b(Cc,{htmlFor:`sandbox-create-id`,children:s(O===`group`?`sandbox.field.groupId`:`sandbox.field.qqId`)}),b(Or,{id:`sandbox-create-id`,inputMode:`numeric`,pattern:`[0-9]+`,required:!0,value:E.id,onChange:e=>D(t=>({...t,id:e.target.value}))})]}),x(`div`,{className:`flex flex-col gap-2`,children:[b(Cc,{htmlFor:`sandbox-create-name`,children:s(`sandbox.field.name.${O}`)}),b(Or,{id:`sandbox-create-name`,required:!0,value:E.name,onChange:e=>D(t=>({...t,name:e.target.value}))})]}),O!==`group`&&x(`div`,{className:`flex flex-col gap-2`,children:[b(Cc,{htmlFor:`sandbox-create-note`,children:s(`sandbox.field.personalNote`)}),b(Or,{id:`sandbox-create-note`,placeholder:s(`sandbox.field.optional`),value:E.personalNote,onChange:e=>D(t=>({...t,personalNote:e.target.value}))})]}),O===`bot`&&x(y,{children:[b(Mg,{value:S,onChange:C}),x(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[b(dc,{checked:w,onCheckedChange:e=>T(e===!0)}),s(`sandbox.field.botEnabled`)]})]}),p&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:p}),b(G,{type:`submit`,disabled:d||O===`group`&&!k,children:s(d?`sandbox.create.busy`:`sandbox.create.${O}`)})]})})]})}function Mg({value:e,onChange:t}){let n=J();return x(`div`,{className:`flex flex-col gap-2`,children:[b(Cc,{children:n(`sandbox.field.implementation`)}),x(Ec,{value:e,onValueChange:e=>{let n=kg.find(({value:t})=>t===e);n&&t(n.value)},items:kg,children:[b(Oc,{className:`w-full`,children:b(Dc,{})}),b(kc,{className:`sandbox-glass`,children:kg.map(({value:e,label:t})=>b(Ac,{value:e,children:t},e))})]})]})}function Ng(){return{tokens:[{type:`text`,text:``}],tokenIndex:0,offset:0}}function Pg(e){return!e.some(e=>e.type===`mention`||!!e.text.trim())}function Fg(e){return e.map(e=>e.type===`mention`?`<at id="${e.id}"/>`:e.text.replace(/ /g,` `)).join(``).trim()}function Ig(e){let t=[];for(let n of e)if(n.type===`mention`)t.push({...n});else{let e=n.text.replace(//g,``),r=t.at(-1);r?.type===`text`?r.text+=e:t.push({type:`text`,text:e})}if(!t.length)return[{type:`text`,text:``}];let n=[];return t.forEach((e,r)=>{n.push(e),e.type===`mention`&&(!t[r+1]||t[r+1].type===`mention`)&&n.push({type:`text`,text:``})}),n[0]?.type===`mention`&&n.unshift({type:`text`,text:``}),n}function Lg(e,t,n){let r=Math.min(Math.max(t,0),Math.max(0,e.length-1));if(e[r]?.type!==`text`&&(r=e.findIndex(e=>e.type===`text`)),r<0)return Ng();let i=e[r],a=i?.type===`text`?i.text:``;return{tokens:[...e],tokenIndex:r,offset:Math.min(Math.max(n,0),a.length)}}function Rg(e,t,n,r){return zg(e,t,n,n,r)}function zg(e,t,n,r,i){let a=e[t]?.type===`text`?e[t].text:``,o=Math.max(0,Math.min(n,r,a.length)),s=Math.max(o,Math.min(Math.max(n,r),a.length)),c=a.slice(0,o),l=a.slice(s);c&&!/\s$/.test(c)&&(c+=` `);let u=l?l.startsWith(` `)?l:` ${l}`:`\xA0`,d=Ig([...e.slice(0,t),...c?[{type:`text`,text:c}]:[],{type:`mention`,id:i.id,name:i.name},{type:`text`,text:u},...e.slice(t+1)]),f=d.findIndex((e,n)=>n>=t&&e.type===`mention`&&e.id===i.id)+1,p=d[f];return Lg(d,f,p?.type===`text`&&/^[ ]/.test(p.text)?1:0)}function Bg(e,t,n){let r=Lg(Ig(e),t,n),i=r.tokens[r.tokenIndex],a=r.tokens[r.tokenIndex-1];return i?.type===`text`&&r.offset===1&&i.text.startsWith(`\xA0`)&&a?.type===`mention`?Lg(Ig([...r.tokens.slice(0,r.tokenIndex-1),{type:`text`,text:i.text.slice(1)},...r.tokens.slice(r.tokenIndex+1)]),r.tokenIndex-1,2**53-1):i?.type===`text`&&r.offset>0?Lg(Ig([...r.tokens.slice(0,r.tokenIndex),{type:`text`,text:i.text.slice(0,r.offset-1)+i.text.slice(r.offset)},...r.tokens.slice(r.tokenIndex+1)]),r.tokenIndex,r.offset-1):r.tokenIndex<=0?r:a?.type===`mention`?Lg(Ig([...r.tokens.slice(0,r.tokenIndex-1),...r.tokens.slice(r.tokenIndex)]),r.tokenIndex-1,2**53-1):r}function Vg(e,t){let n=e.slice(0,t),r=/(^|[^\s@])?@([^\s@]*)$/.exec(n);return r?{query:r[2],start:t-r[2].length-1}:null}function Hg(e){return[e.name,e.id,...e.keywords??[]]}function Ug(e,t){let n=t.trim().toLocaleLowerCase();return[...e].filter(e=>!n||Hg(e).some(e=>e.toLocaleLowerCase().includes(n))).sort((e,t)=>{let r=Hg(e).some(e=>e.toLocaleLowerCase().startsWith(n)),i=Hg(t).some(e=>e.toLocaleLowerCase().startsWith(n));return Number(i)-Number(r)||e.name.localeCompare(t.name,`zh-Hans`)||e.id.localeCompare(t.id)})}function Wg(e){let t=[],n=e=>{if(e.kind===`text`){t.push({type:`text`,text:e.text});return}if(e.kind===`mention`){t.push({type:`mention`,id:e.id,name:e.name});return}if(e.kind===`line-break`){t.push({type:`text`,text:`
|
|
2
2
|
`});return}e.children.forEach(n)};return e.forEach(n),Ig(t)}function Gg(e){let t=e.map(e=>e.type===`text`?{kind:`text`,text:e.text||``}:{kind:`mention`,id:e.id,name:e.name});return t.length?t:[{kind:`text`,text:``}]}function Kg(e,t,n){let r=Math.max(0,e.length-1),i=Math.min(Math.max(t,0),r),a=e[i];return a?.type===`text`?{tokenIndex:i,offset:Math.min(Math.max(n,0),a.text.length)}:{tokenIndex:Math.min(i+1,r),offset:0}}function qg(e,t){if(t.kind===`editor`){let n=e[t.childOffset];return n?n.type===`mention`?Kg(e,t.childOffset-1,2**53-1):Kg(e,t.childOffset,0):Kg(e,e.length-1,2**53-1)}let n=e[t.childIndex];return Kg(e,t.childIndex,n?.type===`text`?t.offset:0)}function Jg(e,t,n){let r=e[t];return r?r.type===`text`?{kind:`child`,childIndex:t,offset:Math.max(n,0)}:{kind:`child`,childIndex:t+1,offset:0}:{kind:`editor-end`}}function Yg(e,t){let n=Math.max(t,0),r=0;for(;r<e.length&&n>0;)e[r]!==``&&--n,r+=1;for(;r<e.length&&e[r]===``;)r+=1;return r}function Xg(e){if(!e.hasCandidates||e.composing)return;let t=e.tokens[e.tokenIndex];if(t?.type!==`text`)return;let n=Vg(t.text,e.offset);if(n)return{tokenIndex:e.tokenIndex,start:n.start,query:n.query}}function Zg(e,t,n){return n!==0||e[t]?.type!==`text`?!1:e[t-1]?.type===`mention`}function Qg(e,t){let n=e[t-2];return{tokens:Bg(e,t,0).tokens,tokenIndex:Math.max(0,t-2),offset:n?.type===`text`?n.text.length:0}}function $g(e){if(e.disabled)return{kind:`blocked`};if(e.menuOpen){if(e.key===`ArrowDown`)return{kind:`move-candidate`,delta:1};if(e.key===`ArrowUp`)return{kind:`move-candidate`,delta:-1};if(e.key===`Enter`||e.key===`Tab`)return{kind:`select-candidate`};if(e.key===`Escape`)return{kind:`close-menu`}}return e.key===`Enter`&&!e.shiftKey&&!e.composing?{kind:`submit`}:e.key===`Backspace`&&e.mentionBoundary&&!e.composing?{kind:`delete-mention`}:{kind:`none`}}function e_(e){return{ref:t=>{let n=t;return{get value(){return n},set value(t){Object.is(t,n)||(n=t,e())}}},computed:e=>({get value(){return e()}})}}function t_(e,t=()=>{}){let{ref:n,computed:r}=e_(t),i=n(Ng()),a=n(!1),o=r(()=>!a.value&&Pg(i.value.tokens)),s=n(void 0),c=n(0),l=r(()=>!!s.value&&e.readMentionCandidates().length>0),u=r(()=>s.value?Ug(e.readMentionCandidates(),s.value.query):[]),d=r(()=>Math.min(Math.max(c.value,0),Math.max(0,u.value.length-1))),f=!1;function p(){s.value=void 0,c.value=0}function m(){let t=i.value,n=Xg({tokens:t.tokens,tokenIndex:t.tokenIndex,offset:t.offset,composing:a.value,hasCandidates:e.readMentionCandidates().length>0});if(!n){p();return}s.value=n,c.value=0}function h(){f=!0,e.renderNodes(Gg(i.value.tokens)),f=!1}function g(t,n={}){i.value={tokens:Ig(t.tokens),tokenIndex:t.tokenIndex,offset:t.offset},h(),n.focus!==!1&&e.nextTick().then(_)}function _(){e.focus();let t=i.value;e.writeCaret(Jg(t.tokens,t.tokenIndex,t.offset))}function v(){g(Ng(),{focus:!1}),p()}function y(t){let n=e.readCaret();if(n)return qg(t,n)}function b(){let e=y(i.value.tokens);e&&(i.value={...i.value,...e})}async function x(){if(f)return;if(a.value){p();return}await e.nextTick();let t=e.readNodes();if(!t)return;let n=Wg(t),r=y(n);i.value={tokens:n,tokenIndex:r?.tokenIndex??i.value.tokenIndex,offset:r?.offset??i.value.offset},m()}function S(){a.value=!0}async function C(){a.value=!1,await x()}function w(e){b();let t=i.value,n=t.tokens[t.tokenIndex]?.type===`text`?t.offset:0;g(Rg(t.tokens,t.tokenIndex,n,e)),p()}function T(e){let t=s.value;if(!t)return;let n=i.value.tokens[t.tokenIndex]?.type===`text`?i.value.offset:t.start;g(zg(i.value.tokens,t.tokenIndex,t.start,Math.max(t.start,n),{id:e.id,name:e.name})),p()}function E(e){let t=u.value.length;t&&(c.value=(d.value+e+t)%t)}function D(e){let t=i.value,n=$g({key:e.key,shiftKey:e.shiftKey,disabled:e.disabled,composing:a.value,menuOpen:l.value,mentionBoundary:Zg(t.tokens,t.tokenIndex,t.offset)});if(n.kind===`move-candidate`&&E(n.delta),n.kind===`close-menu`&&p(),n.kind===`select-candidate`){let e=u.value[d.value];e&&T(e)}return n.kind===`delete-mention`&&g(Qg(t.tokens,t.tokenIndex)),n}function O(){return Fg(i.value.tokens)}return{draft:i,composing:a,isEmpty:o,mentionMenuOpen:l,mentionCandidates:u,mentionMenuIndex:d,render:h,apply:g,reset:v,syncCaretFromHost:b,handleInput:x,startComposition:S,endComposition:C,insertMention:w,selectMentionCandidate:T,closeMentionMenu:p,setMentionSelection:e=>{c.value=e},routeKey:D,serialize:O,focus:_}}function n_(e,t){let n=e.findIndex(({id:e})=>e===t);return n>0?[e[n],...e.slice(0,n),...e.slice(n+1)]:e}function r_(e,t=!1){let n=Math.min(e,t?1:3),r=Math.max(0,e-n);return{collapsedVisibleCount:n,overflowCount:r,collapsedWidth:36+Math.max(0,n-1)*21+(r?21:0),expandedWidth:36+Math.max(0,e-1)*27}}function i_(e,t=!1){let n=r_(e,t),r=n.overflowCount?n.collapsedWidth-36:e*21,i=e*27;return{collapsedWidth:n.overflowCount?n.collapsedWidth:36+r,expandedWidth:36+i,addCollapsedRight:r,addExpandedRight:i}}function a_(){let e=J();return x(Pr,{children:[b(Fr,{render:b(`span`,{className:`ml-auto inline-flex text-muted-foreground`,"aria-label":e(`sandbox.extension.description`)}),children:b(Pn,{className:`size-3.5`})}),b(Ir,{side:`right`,children:e(`sandbox.extension.description`)})]})}var o_=10485760,s_=88,c_=100,l_=`image/png,image/jpeg,image/gif,image/webp,audio/*,video/mp4,video/webm,video/quicktime,.txt,.csv,.json,.pdf,.zip,.doc,.docx,.xls,.xlsx,.ppt,.pptx`;function u_(e){let t=e.lastIndexOf(`.`);return t<=0?{baseName:e,extension:``}:{baseName:e.slice(0,t),extension:e.slice(t)}}function d_(e){return new Promise((t,n)=>{let r=new FileReader;r.addEventListener(`load`,()=>t(typeof r.result==`string`?r.result:``)),r.addEventListener(`error`,()=>n(r.error??Error(`unreadable`))),r.readAsDataURL(e)})}var f_=e.forwardRef(function({replyingTo:t,mentionCandidates:n,onClearReply:r,onSend:i,onOpenImage:a,onSpaceChange:o},s){let c=J(),{store:l,dialogs:u}=Jd(),{conversation:d,operatorId:f,snapshot:p,resolveAvatar:m}=Yd(),h=e.useRef(null),g=e.useRef(null),[,_]=e.useReducer(e=>e+1,0),[v,y]=e.useState([]),[S,C]=e.useState(!1),[w,T]=e.useState(``),[E,D]=e.useState(!1),[O,k]=e.useState(`idle`),[A,j]=e.useState(!1),M=e.useRef(null),N=e.useRef(null),ee=e.useRef(null),P=e.useRef(null),F=e.useRef(void 0),I=e.useRef(void 0),te=e.useRef(0),ne=e.useRef({}),L=e.useRef({hovered:!1,focused:!1,creating:!1,suppress:!1}),R=e.useRef({hasOverflow:!1,expanded:!1}),re=e.useRef(n);re.current=n;let ie=e.useRef({conversationId:d?.id,operatorId:f});ie.current={conversationId:d?.id,operatorId:f};let z=e.useMemo(()=>t_({readNodes:()=>{let e=h.current;if(!e)return;let t=e=>e.nodeType===Node.TEXT_NODE?{kind:`text`,text:e.textContent??``}:e instanceof HTMLElement?e.dataset.mentionId?{kind:`mention`,id:e.dataset.mentionId,name:e.dataset.mentionName||e.textContent?.replace(/^@/,``)||e.dataset.mentionId}:e.tagName===`BR`?{kind:`line-break`}:{kind:`container`,children:Array.from(e.childNodes).map(t)}:{kind:`container`,children:[]};return Array.from(e.childNodes).map(t)},renderNodes:e=>{let t=h.current;if(t){t.replaceChildren();for(let n of e){if(n.kind===`text`){t.appendChild(document.createTextNode(n.text));continue}let e=document.createElement(`span`);e.className=`sandbox-composer-mention`,e.contentEditable=`false`,e.dataset.mentionId=n.id,e.dataset.mentionName=n.name,e.textContent=`@${n.name}`,t.appendChild(e)}}},readCaret:()=>{let e=h.current,t=window.getSelection();if(!e||!t||t.rangeCount===0)return;let n=t.getRangeAt(0);if(!e.contains(n.startContainer))return;if(n.startContainer===e)return{kind:`editor`,childOffset:n.startOffset};let r=0;for(let t of Array.from(e.childNodes)){if(t===n.startContainer||t.contains(n.startContainer))return{kind:`child`,childIndex:r,offset:n.startOffset};(t.nodeType===Node.TEXT_NODE||t instanceof HTMLElement&&t.dataset.mentionId)&&(r+=1)}return{kind:`editor`,childOffset:e.childNodes.length}},writeCaret:e=>{let t=h.current,n=window.getSelection();if(!t||!n)return;let r=t,i=t.childNodes.length;if(e.kind===`child`){let n=t.childNodes[e.childIndex];n&&(r=n,i=Yg(n.textContent??``,e.offset))}try{let e=document.createRange();e.setStart(r,i),e.collapse(!0),n.removeAllRanges(),n.addRange(e)}catch{}},nextTick:()=>new Promise(e=>requestAnimationFrame(()=>e())),focus:()=>h.current?.focus(),readMentionCandidates:()=>re.current},_),[]);e.useImperativeHandle(s,()=>({focus:()=>z.focus(),insertMention:e=>z.insertMention(e)}),[z]),e.useEffect(()=>{z.render()},[z]),e.useEffect(()=>{z.reset(),T(``),y(e=>{for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl);return[]})},[d?.id,f,z]),e.useEffect(()=>()=>{y(e=>{for(let t of e)t.previewUrl&&URL.revokeObjectURL(t.previewUrl);return e})},[]);let B=e=>{let t=[],n=!1;for(let r of e){if(r.size>o_){n=!0;continue}t.push({id:`${r.name}:${r.size}:${r.lastModified}:${Math.random().toString(36).slice(2,8)}`,file:r,previewUrl:r.type.startsWith(`image/`)?URL.createObjectURL(r):void 0,...u_(r.name)})}n&&T(c(`sandbox.composer.oversize`)),t.length&&y(e=>[...e,...t])},ae=e=>y(t=>t.filter(t=>t.id!==e||(t.previewUrl&&URL.revokeObjectURL(t.previewUrl),!1))),oe=S||!d,se=async()=>{z.closeMentionMenu();let e=z.serialize(),n={...ie.current};if(!(S||z.composing.value||!e&&!v.length||!n.conversationId||!n.operatorId)){C(!0),T(``);try{let a=v.length?await Promise.all(v.map(async({file:e})=>{let t=await d_(e);return{fileName:e.name,mimeType:e.type,dataBase64:t.slice(t.indexOf(`,`)+1)}})):void 0;await i({conversationId:n.conversationId,content:e,replyToMessageId:t?.id,media:a}),z.reset();for(let e of v)e.previewUrl&&URL.revokeObjectURL(e.previewUrl);y([]),r()}catch(e){T(zd(e,c(`sandbox.composer.failed`)))}finally{ce.current=n,C(!1)}}},ce=e.useRef(void 0);e.useLayoutEffect(()=>{let e=ce.current;if(S||!e||(ce.current=void 0,ie.current.conversationId!==e.conversationId||ie.current.operatorId!==e.operatorId))return;let t=h.current;if(!t)return;t.focus();let n=document.createRange();n.selectNodeContents(t),n.collapse(!1);let r=window.getSelection();r?.removeAllRanges(),r?.addRange(n)},[S]);let le=n_(p.participants.map(e=>({...e,avatar:m(e.avatar)})),f),ue=r_(le.length,A),de=i_(le.length,A),fe=ue.overflowCount>0,pe=E&&fe,me=pe||!fe,he=le[ue.collapsedVisibleCount],ge=e=>fe&&e>=ue.collapsedVisibleCount,_e=e=>!pe&&ge(e);R.current={hasOverflow:fe,expanded:pe};let ve=e=>{!R.current.hasOverflow||R.current.expanded===e||(k(e?`expanding`:`collapsing`),clearTimeout(ne.current.motion),ne.current.motion=setTimeout(()=>k(`idle`),280),R.current.expanded=e,D(e),te.current=performance.now()+180)},ye=()=>{L.current.suppress||ve(L.current.hovered||L.current.focused||L.current.creating)};e.useEffect(()=>{fe||D(!1)},[fe]);let be=()=>(!F.current&&P.current&&(F.current=bg(P.current,{children:[`.sandbox-composer-user-capsule`,`.sandbox-composer-user-stack`,`.sandbox-composer-user-switch`,`.sandbox-composer-user-overflow`,`.sandbox-composer-user-add`]})),F.current?.record(),F.current);e.useLayoutEffect(()=>{let e=I.current;e&&(I.current=void 0,e.animate({duration:260,ease:`out(3)`}))},[f]),e.useEffect(()=>()=>{F.current?.revert(),clearTimeout(ne.current.motion),clearTimeout(ne.current.suppress)},[]);let xe=async e=>{if(e===f)return;L.current.suppress=!0,clearTimeout(ne.current.suppress);let t=te.current-performance.now();t>0&&await new Promise(e=>setTimeout(e,t)),I.current=be();try{await l.selectOperator(e),T(``)}catch(e){I.current=void 0,T(zd(e,c(`sandbox.composer.switchFailed`)))}finally{ne.current.suppress=setTimeout(()=>{L.current.suppress=!1,L.current.focused=!!M.current?.contains(document.activeElement),ye()},280)}},Se=le.length;e.useLayoutEffect(()=>{let e=N.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>{let t=i_(Se).collapsedWidth;j(e.clientWidth<t+s_+c_);let n=Math.ceil(e.getBoundingClientRect().height),r=ee.current?Math.ceil(ee.current.getBoundingClientRect().height)+8:0;o?.(n+r+28)},n=new ResizeObserver(t);return n.observe(e),ee.current&&n.observe(ee.current),t(),()=>n.disconnect()},[Se,!!t,v.length,o]);let Ce=Math.max(0,de.collapsedWidth-36),we=me?Math.max(0,de.expandedWidth-de.collapsedWidth):0,Te=pe||O===`expanding`,Ee=e=>e,De=z.mentionMenuOpen.value,Oe=z.mentionCandidates.value,ke=z.mentionMenuIndex.value;return b(`div`,{ref:M,className:`sandbox-composer-layout-root`,children:x(`form`,{ref:N,className:`sandbox-composer`,style:Ee({width:`${460+Ce}px`,"--sandbox-composer-visual-extension":`${we}px`}),onSubmit:e=>{e.preventDefault(),se()},children:[w&&b(`span`,{role:`alert`,className:`sandbox-composer-error`,children:w}),(t||v.length>0)&&x(`div`,{ref:ee,className:`sandbox-composer-context`,children:[t&&x(`div`,{className:`sandbox-composer-reply`,children:[b(`span`,{children:c(`sandbox.composer.replyTo`,{name:t.authorName,content:t.content})}),b(`button`,{type:`button`,"aria-label":c(`sandbox.composer.clearReply`),onClick:r,children:b(mr,{className:`size-[15px]`,"aria-hidden":!0})})]}),v.map(e=>e.previewUrl?x(`span`,{className:`sandbox-composer-attachment-image`,children:[b(`button`,{type:`button`,className:`sandbox-composer-attachment-preview`,"aria-label":c(`sandbox.composer.preview`,{name:e.file.name}),onClick:()=>a?.(e.previewUrl),children:b(`img`,{src:e.previewUrl,alt:e.file.name})}),b(`button`,{type:`button`,className:`sandbox-composer-attachment-remove`,"aria-label":c(`sandbox.composer.remove`,{name:e.file.name}),onClick:()=>ae(e.id),children:b(mr,{className:`size-3`,"aria-hidden":!0})})]},e.id):x(`span`,{className:`sandbox-composer-attachment-file`,children:[b(Nn,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),x(`span`,{className:`sandbox-composer-attachment-name`,children:[b(`span`,{className:`sandbox-composer-attachment-base`,children:e.baseName}),b(`span`,{children:e.extension})]}),b(`button`,{type:`button`,"aria-label":c(`sandbox.composer.remove`,{name:e.file.name}),onClick:()=>ae(e.id),children:b(mr,{className:`size-3.5`,"aria-hidden":!0})})]},e.id))]}),b(`div`,{ref:P,className:`sandbox-composer-user-layout-root`,style:Ee({"--sandbox-user-layout-width":`${de.collapsedWidth}px`}),children:b(`div`,{className:U(`sandbox-composer-user-capsule`,me&&`is-expanded`),style:Ee({"--sandbox-user-capsule-collapsed-width":`${de.collapsedWidth}px`,"--sandbox-user-capsule-expanded-width":`${de.expandedWidth}px`}),onPointerEnter:()=>{L.current.hovered=!0,ye()},onPointerLeave:()=>{L.current.hovered=!1,ye()},onFocus:()=>{L.current.focused=!0,ye()},onBlur:e=>{L.current.focused=e.relatedTarget instanceof Node&&e.currentTarget.contains(e.relatedTarget),ye()},children:x(`div`,{className:U(`sandbox-composer-user-stack`,me&&`is-expanded`,O===`expanding`&&`is-overflow-expanding`,O===`collapsing`&&`is-overflow-collapsing`),style:Ee({"--sandbox-user-stack-collapsed-width":`${de.collapsedWidth}px`,"--sandbox-user-stack-expanded-width":`${de.expandedWidth}px`}),children:[le.map((e,t)=>{let n=e.id===f,r=e.kind===`bot`?`${e.name}(${c(`sandbox.kind.bot`)})`:e.name;return x(Pr,{children:[b(Fr,{render:b(`span`,{className:U(`sandbox-composer-user-switch`,t>0&&`is-overlapped`,ge(t)&&`is-collapsed-extra`),"aria-hidden":_e(t)||void 0,style:Ee({"--sandbox-user-collapsed-right":`${(ge(t)?ue.collapsedVisibleCount:t)*21}px`,"--sandbox-user-expanded-right":`${t*27}px`,zIndex:le.length-t})}),children:x(gc,{children:[b(_c,{render:b(`button`,{type:`button`,className:`sandbox-composer-user-button`,"aria-pressed":n,"aria-label":c(n?`sandbox.composer.currentSender`:`sandbox.composer.switchSender`,{name:r}),tabIndex:_e(t)?-1:void 0,onClick:()=>void xe(e.id)}),children:b(Hf,{kind:e.kind,name:e.name,src:e.avatar,badge:!1,className:`sandbox-composer-user-avatar`})}),x(vc,{className:`sandbox-glass`,children:[x(q,{onClick:()=>u.openEntity(`edit`,{type:e.kind,id:e.id}),children:[b(Jn,{}),c(`sandbox.menu.editEntity`,{kind:c(`sandbox.kind.${e.kind}`)}),b(a_,{})]}),x(q,{variant:`destructive`,onClick:()=>u.openEntity(`delete`,{type:e.kind,id:e.id}),children:[b(or,{}),c(`sandbox.menu.deleteEntity`,{kind:c(`sandbox.kind.${e.kind}`)}),b(a_,{})]})]})]})}),b(Ir,{side:`top`,children:e.name})]},e.id)}),fe&&x(`span`,{className:`sandbox-composer-user-overflow`,"aria-hidden":!0,style:Ee({"--sandbox-user-overflow-right":`${ue.collapsedVisibleCount*21}px`,"--sandbox-user-overflow-expanded-right":`${ue.collapsedVisibleCount*27}px`,"--sandbox-user-overflow-z-index":`${le.length-ue.collapsedVisibleCount-+!!Te}`}),children:[he&&b(Hf,{kind:he.kind,name:he.name,src:he.avatar,badge:!1,className:`sandbox-composer-user-overflow-avatar`}),x(`span`,{className:`sandbox-composer-user-overflow-label`,children:[b(`span`,{className:`sandbox-composer-user-overflow-plus`,children:`+`}),b(`span`,{className:`sandbox-composer-user-overflow-count`,children:ue.overflowCount})]})]}),b(jg,{type:`participant`,side:`top`,onOpenChange:e=>{L.current.creating=e,ye()},trigger:b(`button`,{type:`button`,className:U(`sandbox-composer-user-add`,fe&&!me&&`is-collapsed-hidden`),style:Ee({"--sandbox-user-add-collapsed-right":`${de.addCollapsedRight}px`,"--sandbox-user-add-expanded-right":`${de.addExpandedRight}px`}),"aria-label":c(`sandbox.composer.addAccount`),children:b(Xn,{className:`size-[18px]`,strokeWidth:2,"aria-hidden":!0})})})]})})}),x(`div`,{className:`sandbox-composer-main`,children:[z.isEmpty.value&&b(`span`,{"aria-hidden":!0,className:`sandbox-composer-placeholder`,children:c(`sandbox.composer.placeholder`)}),b(`div`,{ref:h,role:`textbox`,"aria-multiline":`true`,"aria-label":c(`sandbox.composer.input`),"aria-disabled":oe||void 0,contentEditable:!oe,suppressContentEditableWarning:!0,className:`sandbox-composer-editor`,onKeyDown:e=>{let t=z.routeKey({key:e.key,shiftKey:e.shiftKey,disabled:oe});t.kind!==`none`&&e.preventDefault(),t.kind===`submit`&&se()},onInput:()=>void z.handleInput(),onCompositionStart:()=>z.startComposition(),onCompositionEnd:()=>void z.endComposition(),onPaste:e=>{let t=Array.from(e.clipboardData?.files??[]);if(t.length){e.preventDefault(),B(t);return}e.preventDefault(),document.execCommand(`insertText`,!1,e.clipboardData.getData(`text/plain`))},onMouseUp:()=>z.syncCaretFromHost(),onKeyUp:()=>z.syncCaretFromHost()}),De&&x(`div`,{className:`sandbox-glass absolute right-0 bottom-[calc(100%+8px)] left-0 z-30 flex max-h-[220px] flex-col gap-0.5 overflow-y-auto rounded-[14px] bg-popover p-1.5 text-popover-foreground shadow-popup ring-1 ring-border`,role:`listbox`,"aria-label":c(`sandbox.composer.mention`),children:[Oe.map((e,t)=>x(`button`,{type:`button`,role:`option`,"aria-selected":t===ke,className:U(`flex min-w-0 items-center gap-2 rounded-[10px] px-2 py-1.5 text-left hover:bg-accent`,t===ke&&`bg-accent`),onMouseDown:t=>{t.preventDefault(),z.selectMentionCandidate(e)},onMouseEnter:()=>z.setMentionSelection(t),children:[b(Hf,{kind:e.kind,name:e.name,src:e.avatar,className:`size-7`}),x(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[b(`strong`,{className:`truncate text-[13px] leading-4 font-semibold`,children:e.name}),b(`small`,{className:`truncate text-[11px] leading-[14px] text-muted-foreground`,children:e.id})]})]},e.id)),!Oe.length&&b(`p`,{className:`px-2 py-2.5 text-center text-xs text-muted-foreground`,children:c(`sandbox.composer.noMention`)})]})]}),b(`input`,{ref:g,type:`file`,multiple:!0,accept:l_,className:`sr-only`,onChange:e=>{e.target.files&&B(Array.from(e.target.files)),e.target.value=``}}),b(`button`,{type:`button`,className:`sandbox-composer-action`,"aria-label":c(`sandbox.composer.attach`),disabled:oe,onClick:()=>g.current?.click(),children:b(qn,{className:`size-[19px]`,strokeWidth:2,"aria-hidden":!0})}),b(`button`,{type:`submit`,className:`sandbox-composer-action is-primary`,"aria-label":c(`sandbox.composer.send`),disabled:oe||z.isEmpty.value&&!v.length,children:b(tr,{className:`size-[19px]`,strokeWidth:2,"aria-hidden":!0})})]})})}),p_=ge({default:()=>m_}),m_,h_=me((()=>{m_=JSON.parse(`[{"QSid":"0","QDes":"/惊讶","IQLid":"33","AQLid":"33","EMCode":"114","Input":["jingya","jy"]},{"QSid":"1","QDes":"/撇嘴","IQLid":"40","AQLid":"40","EMCode":"101","Input":["piezui","pz"]},{"QSid":"2","QDes":"/色","IQLid":"19","AQLid":"19","EMCode":"102","Input":["se"]},{"QSid":"3","QDes":"/发呆","IQLid":"43","AQLid":"43","EMCode":"103","Input":["fadai","fd"]},{"QSid":"4","QDes":"/得意","IQLid":"21","AQLid":"21","EMCode":"104","Input":["deyi","dy"]},{"QSid":"5","QDes":"/流泪","IQLid":"9","AQLid":"9","EMCode":"105","Input":["liulei","ll"]},{"QSid":"6","QDes":"/害羞","IQLid":"20","AQLid":"20","EMCode":"106","Input":["haixiu","hx"]},{"QSid":"7","QDes":"/闭嘴","IQLid":"104","AQLid":"106","EMCode":"107","Input":["bizui","bz"]},{"QSid":"8","QDes":"/睡","IQLid":"35","AQLid":"35","EMCode":"108","Input":["shui"]},{"QSid":"9","QDes":"/大哭","IQLid":"10","AQLid":"10","EMCode":"109","Input":["daku","dk"]},{"QSid":"10","QDes":"/尴尬","IQLid":"25","AQLid":"25","EMCode":"110","Input":["ganga","gg"]},{"QSid":"11","QDes":"/发怒","IQLid":"24","AQLid":"24","EMCode":"111","Input":["fanu","fn"]},{"QSid":"12","QDes":"/调皮","IQLid":"1","AQLid":"1","EMCode":"112","Input":["tiaopi","tp"]},{"QSid":"13","QDes":"/呲牙","IQLid":"0","AQLid":"0","EMCode":"113","Input":["ziya","zy"]},{"QSid":"14","QDes":"/微笑","IQLid":"23","AQLid":"23","EMCode":"100","Input":["weixiao","wx"]},{"QSid":"15","QDes":"/难过","IQLid":"32","AQLid":"32","EMCode":"115","isStatic":"1","Input":["nanguo","ng"]},{"QSid":"16","QDes":"/酷","IQLid":"12","AQLid":"12","EMCode":"116","Input":["ku"]},{"QSid":"18","QDes":"/抓狂","IQLid":"13","AQLid":"13","EMCode":"118","Input":["zhuakuang","zk"]},{"QSid":"19","QDes":"/吐","IQLid":"22","AQLid":"22","EMCode":"119","Input":["tu"]},{"QSid":"20","QDes":"/偷笑","IQLid":"3","AQLid":"3","EMCode":"120","Input":["touxiao","tx"]},{"QSid":"21","QDes":"/可爱","IQLid":"18","AQLid":"18","EMCode":"121","Input":["keai","ka"]},{"QSid":"22","QDes":"/白眼","IQLid":"30","AQLid":"30","EMCode":"122","Input":["baiyan","by"]},{"QSid":"23","QDes":"/傲慢","IQLid":"31","AQLid":"31","EMCode":"123","Input":["aoman","am"]},{"QSid":"24","QDes":"/饥饿","IQLid":"79","AQLid":"81","EMCode":"124","Input":["jie","je"]},{"QSid":"25","QDes":"/困","IQLid":"80","AQLid":"82","EMCode":"125","Input":["kun"]},{"QSid":"26","QDes":"/惊恐","IQLid":"26","AQLid":"26","EMCode":"126","Input":["jingkong","jk"]},{"QSid":"27","QDes":"/流汗","IQLid":"2","AQLid":"2","EMCode":"127","Input":["liuhan","lh"]},{"QSid":"28","QDes":"/憨笑","IQLid":"37","AQLid":"37","EMCode":"128","Input":["hanxiao","hx"]},{"QSid":"29","QDes":"/悠闲","IQLid":"50","AQLid":"50","EMCode":"129","Input":["youxian","yx"]},{"QSid":"30","QDes":"/奋斗","IQLid":"42","AQLid":"42","EMCode":"130","Input":["fendou","fd"]},{"QSid":"31","QDes":"/咒骂","IQLid":"81","AQLid":"83","EMCode":"131","Input":["zhouma","zm"]},{"QSid":"32","QDes":"/疑问","IQLid":"34","AQLid":"34","EMCode":"132","Input":["yiwen","yw"]},{"QSid":"33","QDes":"/嘘","IQLid":"11","AQLid":"11","EMCode":"133","Input":["xu"]},{"QSid":"34","QDes":"/晕","IQLid":"49","AQLid":"49","EMCode":"134","Input":["yun"]},{"QSid":"35","QDes":"/折磨","IQLid":"82","AQLid":"84","EMCode":"135","Input":["zhemo","zm"]},{"QSid":"36","QDes":"/衰","isStatic":"1","IQLid":"39","AQLid":"39","EMCode":"136","Input":["shuai"]},{"QSid":"37","QDes":"/骷髅","isStatic":"1","IQLid":"76","AQLid":"78","EMCode":"137","Input":["kulou","kl"]},{"QSid":"38","QDes":"/敲打","IQLid":"5","AQLid":"5","EMCode":"138","Input":["qiaoda","qd"]},{"QSid":"39","QDes":"/再见","IQLid":"4","AQLid":"4","EMCode":"139","Input":["zaijian","zj"]},{"QSid":"41","QDes":"/发抖","isStatic":"1","IQLid":"69","AQLid":"71","EMCode":"193","Input":["fadou","fd"]},{"QSid":"42","QDes":"/爱情","IQLid":"38","AQLid":"38","EMCode":"190","Input":["aiqing","aq"]},{"QSid":"43","QDes":"/跳跳","IQLid":"93","AQLid":"95","EMCode":"192","Input":["tiaotiao","tt"]},{"QSid":"46","QDes":"/猪头","isStatic":"1","IQLid":"7","AQLid":"7","EMCode":"162","Input":["zhutou","zt"]},{"QSid":"49","QDes":"/拥抱","IQLid":"45","AQLid":"45","EMCode":"178","Input":["yongbao","yb"]},{"QSid":"53","QDes":"/蛋糕","IQLid":"59","AQLid":"59","EMCode":"168","Input":["dangao","dg"]},{"QSid":"54","QDes":"/闪电","isStatic":"1","IQLid":"78","AQLid":"80","EMCode":"169","Input":["shandian","sd"]},{"QSid":"55","QDes":"/炸弹","isStatic":"1","IQLid":"16","AQLid":"16","EMCode":"170","Input":["zhadan","zd"]},{"QSid":"56","QDes":"/刀","IQLid":"68","AQLid":"70","EMCode":"171","Input":["dao"]},{"QSid":"57","QDes":"/足球","IQLid":"75","AQLid":"77","EMCode":"172","Input":["zuqiu","zq"]},{"QSid":"59","QDes":"/便便","IQLid":"15","AQLid":"15","EMCode":"174","Input":["bianbian","bb"]},{"QSid":"60","QDes":"/咖啡","IQLid":"66","AQLid":"66","EMCode":"160","Input":["kafei","kf"]},{"QSid":"61","QDes":"/饭","isStatic":"1","IQLid":"58","AQLid":"58","EMCode":"161","Input":["fan"]},{"QSid":"63","QDes":"/玫瑰","isStatic":"1","IQLid":"8","AQLid":"8","EMCode":"163","Input":["meigui","mg"]},{"QSid":"64","QDes":"/凋谢","isStatic":"1","IQLid":"57","AQLid":"57","EMCode":"164","Input":["diaoxie","dx"]},{"QSid":"66","QDes":"/爱心","isStatic":"1","IQLid":"28","AQLid":"28","EMCode":"166","Input":["aixin","ax"]},{"QSid":"67","QDes":"/心碎","IQLid":"72","AQLid":"74","EMCode":"167","Input":["xinsui","xs"]},{"QSid":"69","QDes":"/礼物","isStatic":"1","IQLid":"74","AQLid":"76","EMCode":"177","Input":["liwu","lw"]},{"QSid":"74","QDes":"/太阳","isStatic":"1","IQLid":"73","AQLid":"75","EMCode":"176","Input":["taiyang","ty"]},{"QSid":"75","QDes":"/月亮","isStatic":"1","IQLid":"67","AQLid":"68","EMCode":"175","Input":["yueliang","yl"]},{"QSid":"76","QDes":"/赞","IQLid":"52","AQLid":"52","EMCode":"179","Input":["zan"]},{"QSid":"77","QDes":"/踩","IQLid":"53","AQLid":"53","EMCode":"180","Input":["cai"]},{"QSid":"78","QDes":"/握手","IQLid":"54","AQLid":"54","EMCode":"181","Input":["woshou","ws"]},{"QSid":"79","QDes":"/胜利","IQLid":"55","AQLid":"55","EMCode":"182","Input":["shengli","sl"]},{"QSid":"85","QDes":"/飞吻","isStatic":"1","IQLid":"47","AQLid":"47","EMCode":"191","Input":["feiwen","fw"]},{"QSid":"86","QDes":"/怄火","IQLid":"94","AQLid":"96","EMCode":"194","Input":["ouhuo","oh"]},{"QSid":"89","QDes":"/西瓜","isStatic":"1","IQLid":"60","AQLid":"60","EMCode":"156","Input":["xigua","xg"]},{"QSid":"96","QDes":"/冷汗","IQLid":"27","AQLid":"27","EMCode":"117","Input":["lenghan","lh"]},{"QSid":"97","QDes":"/擦汗","IQLid":"6","AQLid":"6","EMCode":"140","Input":["cahan","ch"]},{"QSid":"98","QDes":"/抠鼻","IQLid":"83","AQLid":"85","EMCode":"141","Input":["koubi","kb"]},{"QSid":"99","QDes":"/鼓掌","IQLid":"84","AQLid":"86","EMCode":"142","Input":["guzhang","gz"]},{"QSid":"100","QDes":"/糗大了","IQLid":"85","AQLid":"87","EMCode":"143","Input":["qiudale","qdl"]},{"QSid":"101","QDes":"/坏笑","IQLid":"46","AQLid":"46","EMCode":"144","Input":["huaixiao","hx"]},{"QSid":"102","QDes":"/左哼哼","IQLid":"86","AQLid":"88","EMCode":"145","Input":["zuohengheng","zhh"]},{"QSid":"103","QDes":"/右哼哼","IQLid":"44","AQLid":"44","EMCode":"146","Input":["youhengheng","yhh"]},{"QSid":"104","QDes":"/哈欠","IQLid":"87","AQLid":"89","EMCode":"147","Input":["haqian","hq"]},{"QSid":"105","QDes":"/鄙视","IQLid":"48","AQLid":"48","EMCode":"148","Input":["bishi","bs"]},{"QSid":"106","QDes":"/委屈","IQLid":"14","AQLid":"14","EMCode":"149","Input":["weiqu","wq"]},{"QSid":"107","QDes":"/快哭了","IQLid":"88","AQLid":"90","EMCode":"150","Input":["kuaikule","kkl"]},{"QSid":"108","QDes":"/阴险","IQLid":"41","AQLid":"41","EMCode":"151","Input":["yinxian","yx"]},{"QSid":"109","QDes":"/左亲亲","IQLid":"36","AQLid":"36","EMCode":"152","Input":["zuoqinqin","zqq"]},{"QSid":"110","QDes":"/吓","IQLid":"89","AQLid":"91","EMCode":"153","Input":["xia"]},{"QSid":"111","QDes":"/可怜","IQLid":"51","AQLid":"51","EMCode":"154","Input":["kelian","kl"]},{"QSid":"112","QDes":"/菜刀","IQLid":"17","AQLid":"17","EMCode":"155","Input":["caidao","cd"]},{"QSid":"113","QDes":"/啤酒","IQLid":"61","AQLid":"61","EMCode":"157","Input":["pijiu","pj"]},{"QSid":"114","QDes":"/篮球","IQLid":"90","AQLid":"92","EMCode":"158","Input":["lanqiu","lq"]},{"QSid":"115","QDes":"/乒乓","IQLid":"91","AQLid":"93","EMCode":"159","Input":["pingpang","pp"]},{"QSid":"116","QDes":"/示爱","IQLid":"29","AQLid":"29","EMCode":"165","Input":["shiai","sa"]},{"QSid":"117","QDes":"/瓢虫","IQLid":"62","AQLid":"62","EMCode":"173","Input":["piaochong","pc"]},{"QSid":"118","QDes":"/抱拳","IQLid":"56","AQLid":"56","EMCode":"183","Input":["baoquan","bq"]},{"QSid":"119","QDes":"/勾引","IQLid":"63","AQLid":"63","EMCode":"184","Input":["gouyin","gy"]},{"QSid":"120","QDes":"/拳头","IQLid":"71","AQLid":"73","EMCode":"185","Input":["quantou","qt"]},{"QSid":"121","QDes":"/差劲","IQLid":"70","AQLid":"72","EMCode":"186","Input":["chajin","cj"]},{"QSid":"122","QDes":"/爱你","IQLid":"65","AQLid":"65","EMCode":"187","Input":["aini","an"]},{"QSid":"123","QDes":"/NO","IQLid":"92","AQLid":"94","EMCode":"188","Input":["NO","N"]},{"QSid":"124","QDes":"/OK","isStatic":"1","IQLid":"64","AQLid":"64","EMCode":"189","Input":["OK","O"]},{"QSid":"125","QDes":"/转圈","IQLid":"95","AQLid":"97","EMCode":"195","Input":["zhuanquan","zq"]},{"QSid":"126","QDes":"/磕头","IQLid":"96","AQLid":"98","EMCode":"196","Input":["ketou","kt"]},{"QSid":"127","QDes":"/回头","IQLid":"97","AQLid":"99","EMCode":"197","Input":["huitou","ht"]},{"QSid":"128","QDes":"/跳绳","IQLid":"98","AQLid":"100","EMCode":"198","Input":["tiaosheng","ts"]},{"QSid":"129","QDes":"/挥手","IQLid":"77","AQLid":"79","EMCode":"199","Input":["huishou","hs"]},{"QSid":"130","QDes":"/激动","IQLid":"99","AQLid":"101","EMCode":"200","Input":["jidong","jd"]},{"QSid":"131","QDes":"/街舞","IQLid":"100","AQLid":"102","EMCode":"201","Input":["jiewu","jw"]},{"QSid":"132","QDes":"/献吻","IQLid":"101","AQLid":"103","EMCode":"202","Input":["xianwen","xw"]},{"QSid":"133","QDes":"/左太极","IQLid":"102","AQLid":"104","EMCode":"203","Input":["zuotaiji","ztj"]},{"QSid":"134","QDes":"/右太极","IQLid":"103","AQLid":"105","EMCode":"204","Input":["youtaiji","ytj"]},{"QSid":"136","QDes":"/双喜","isStatic":"1","IQLid":"106","AQLid":"108","EMCode":"121001","Input":["shuangxi","sx"]},{"QSid":"137","QDes":"/鞭炮","isStatic":"1","IQLid":"107","AQLid":"109","EMCode":"121002","Input":["bianpao","bp"]},{"QSid":"138","QDes":"/灯笼","isStatic":"1","IQLid":"108","AQLid":"110","EMCode":"121003","Input":["denglong","dl"]},{"QSid":"140","QDes":"/K歌","isStatic":"1","IQLid":"110","AQLid":"112","EMCode":"121005","Input":["Kge","Kg"]},{"QSid":"144","QDes":"/喝彩","isStatic":"1","IQLid":"114","AQLid":"116","EMCode":"121009","Input":["hecai","hc"]},{"QSid":"145","QDes":"/祈祷","isStatic":"1","IQLid":"115","AQLid":"117","EMCode":"121010","Input":["qidao","qd"]},{"QSid":"146","QDes":"/爆筋","isStatic":"1","IQLid":"116","AQLid":"118","EMCode":"121011","Input":["baojin","bj"]},{"QSid":"147","QDes":"/棒棒糖","isStatic":"1","IQLid":"117","AQLid":"119","EMCode":"121012","Input":["bangbangtang","bbt"]},{"QSid":"148","QDes":"/喝奶","isStatic":"1","IQLid":"118","AQLid":"120","EMCode":"121013","Input":["henai","hn"]},{"QSid":"151","QDes":"/飞机","isStatic":"1","IQLid":"121","AQLid":"123","EMCode":"121016","Input":["feiji","fj"]},{"QSid":"158","QDes":"/钞票","isStatic":"1","IQLid":"128","AQLid":"130","EMCode":"121023","Input":["chaopiao","cp"]},{"QSid":"168","QDes":"/药","isStatic":"1","IQLid":"138","AQLid":"140","EMCode":"121033","Input":["yao"]},{"QSid":"169","QDes":"/手枪","isStatic":"1","IQLid":"139","AQLid":"141","EMCode":"121034","Input":["shouqiang","sq"]},{"QSid":"171","QDes":"/茶","IQLid":"141","AQLid":"163","EMCode":"241","Input":["cha"]},{"QSid":"172","QDes":"/眨眼睛","IQLid":"142","AQLid":"164","EMCode":"242","Input":["zhayanjing","zyj"]},{"QSid":"173","QDes":"/泪奔","IQLid":"143","AQLid":"165","EMCode":"243","Input":["leiben","lb"]},{"QSid":"174","QDes":"/无奈","IQLid":"144","AQLid":"166","EMCode":"244","Input":["wunai","wn"]},{"QSid":"175","QDes":"/卖萌","IQLid":"145","AQLid":"167","EMCode":"245","Input":["maimeng","mm"]},{"QSid":"176","QDes":"/小纠结","IQLid":"146","AQLid":"168","EMCode":"246","Input":["xiaojiujie","xjj"]},{"QSid":"177","QDes":"/喷血","IQLid":"147","AQLid":"169","EMCode":"247","Input":["penxie","px"]},{"QSid":"178","QDes":"/斜眼笑","IQLid":"148","AQLid":"170","EMCode":"248","Input":["xieyanxiao","xyx"]},{"QSid":"179","QDes":"/doge","IQLid":"149","AQLid":"171","EMCode":"249","Input":["doge","d"]},{"QSid":"180","QDes":"/惊喜","IQLid":"150","AQLid":"172","EMCode":"250","Input":["jingxi","jx"]},{"QSid":"181","QDes":"/骚扰","IQLid":"151","AQLid":"173","EMCode":"251","Input":["saorao","sr"]},{"QSid":"182","QDes":"/笑哭","IQLid":"152","AQLid":"174","EMCode":"252","Input":["xiaoku","xk"]},{"QSid":"183","QDes":"/我最美","IQLid":"153","AQLid":"175","EMCode":"253","Input":["wozuimei","wzm"]},{"QSid":"184","QDes":"/河蟹","IQLid":"154","AQLid":"176","EMCode":"254","Input":["hexie","hx"]},{"QSid":"185","QDes":"/羊驼","IQLid":"155","AQLid":"177","EMCode":"255","Input":["yangtuo","yt"]},{"QSid":"187","QDes":"/幽灵","IQLid":"157","AQLid":"179","EMCode":"257","Input":["youling","yl"]},{"QSid":"188","QDes":"/蛋","IQLid":"158","AQLid":"180","EMCode":"258","Input":["dan"]},{"QSid":"190","QDes":"/菊花","IQLid":"160","AQLid":"182","EMCode":"260","Input":["juhua","jh"]},{"QSid":"192","QDes":"/红包","IQLid":"162","AQLid":"184","EMCode":"262","Input":["hongbao","hb"]},{"QSid":"193","QDes":"/大笑","IQLid":"163","AQLid":"185","EMCode":"263","isStatic":"1","Input":["daxiao","dx"]},{"QSid":"194","QDes":"/不开心","IQLid":"164","AQLid":"143","EMCode":"264","Input":["bukaixin","bkx"]},{"QSid":"197","QDes":"/冷漠","IQLid":"167","AQLid":"146","EMCode":"267","Input":["lengmo","lm"]},{"QSid":"198","QDes":"/呃","IQLid":"168","AQLid":"147","EMCode":"268","Input":["e"]},{"QSid":"199","QDes":"/好棒","IQLid":"169","AQLid":"148","EMCode":"269","Input":["haobang","hb"]},{"QSid":"200","QDes":"/拜托","IQLid":"170","AQLid":"149","EMCode":"270","Input":["baituo","bt"]},{"QSid":"201","QDes":"/点赞","IQLid":"171","AQLid":"150","EMCode":"271","Input":["dianzan","dz"]},{"QSid":"202","QDes":"/无聊","IQLid":"172","AQLid":"151","EMCode":"272","Input":["wuliao","wl"]},{"QSid":"203","QDes":"/托脸","IQLid":"173","AQLid":"152","EMCode":"273","Input":["tuolian","tl"]},{"QSid":"204","QDes":"/吃","IQLid":"174","AQLid":"153","EMCode":"274","Input":["chi"]},{"QSid":"205","QDes":"/送花","IQLid":"175","AQLid":"154","EMCode":"275","Input":["songhua","sh"]},{"QSid":"206","QDes":"/害怕","IQLid":"176","AQLid":"155","EMCode":"276","Input":["haipa","hp"]},{"QSid":"207","QDes":"/花痴","IQLid":"177","AQLid":"156","EMCode":"277","Input":["huachi","hc"]},{"QSid":"208","QDes":"/小样儿","IQLid":"178","AQLid":"157","EMCode":"278","Input":["xiaoyanger","xye"]},{"QSid":"210","QDes":"/飙泪","IQLid":"180","AQLid":"159","EMCode":"280","Input":["biaolei","bl"]},{"QSid":"211","QDes":"/我不看","IQLid":"181","AQLid":"160","EMCode":"281","Input":["wobukan","wbk"]},{"QSid":"212","QDes":"/托腮","IQLid":"182","AQLid":"161","EMCode":"282","Input":["tuosai","ts"]},{"QSid":"214","QDes":"/啵啵","IQLid":"184","isCMEmoji":"1","AQLid":"186","EMCode":"284","Input":["bobo","bb"]},{"QSid":"215","QDes":"/糊脸","IQLid":"185","isCMEmoji":"1","AQLid":"187","EMCode":"285","Input":["hulian","hl"]},{"QSid":"216","QDes":"/拍头","IQLid":"186","isCMEmoji":"1","AQLid":"188","EMCode":"286","Input":["paitou","pt"]},{"QSid":"217","QDes":"/扯一扯","IQLid":"187","isCMEmoji":"1","AQLid":"189","EMCode":"287","Input":["cheyiche","cyc"]},{"QSid":"218","QDes":"/舔一舔","IQLid":"188","isCMEmoji":"1","AQLid":"190","EMCode":"288","Input":["tianyitian","tyt"]},{"QSid":"219","QDes":"/蹭一蹭","IQLid":"189","isCMEmoji":"1","AQLid":"191","EMCode":"289","Input":["cengyiceng","cyc"]},{"QSid":"220","QDes":"/拽炸天","IQLid":"190","isCMEmoji":"1","AQLid":"192","EMCode":"290","Input":["zhuaizhatian","zzt"]},{"QSid":"221","QDes":"/顶呱呱","IQLid":"191","isCMEmoji":"1","AQLid":"193","EMCode":"291","Input":["dingguagua","dgg"]},{"QSid":"222","QDes":"/抱抱","IQLid":"192","isCMEmoji":"1","AQLid":"194","EMCode":"292","Input":["baobao","bb"]},{"QSid":"223","QDes":"/暴击","IQLid":"193","isCMEmoji":"1","AQLid":"195","EMCode":"293","Input":["baoji","bj"]},{"QSid":"224","QDes":"/开枪","IQLid":"194","isCMEmoji":"1","AQLid":"196","EMCode":"295","Input":["kaiqiang","kq"]},{"QSid":"225","QDes":"/撩一撩","IQLid":"195","isCMEmoji":"1","AQLid":"197","EMCode":"296","Input":["liaoyiliao","lyl"]},{"QSid":"226","QDes":"/拍桌","IQLid":"196","isCMEmoji":"1","AQLid":"198","EMCode":"297","Input":["paizhuo","pz"]},{"QSid":"227","QDes":"/拍手","IQLid":"197","isCMEmoji":"1","AQLid":"199","EMCode":"294","Input":["paishou","ps"]},{"QSid":"228","QDes":"/恭喜","IQLid":"198","isCMEmoji":"1","AQLid":"200","EMCode":"298","Input":["gongxi","gx"]},{"QSid":"229","QDes":"/干杯","IQLid":"199","isCMEmoji":"1","AQLid":"201","EMCode":"299","Input":["ganbei","gb"]},{"QSid":"230","QDes":"/嘲讽","IQLid":"200","isCMEmoji":"1","AQLid":"202","EMCode":"300","Input":["chaofeng","cf"]},{"QSid":"231","QDes":"/哼","IQLid":"201","isCMEmoji":"1","AQLid":"203","EMCode":"301","Input":["heng"]},{"QSid":"232","QDes":"/佛系","IQLid":"202","isCMEmoji":"1","AQLid":"204","EMCode":"302","Input":["foxi","fx"]},{"QSid":"233","QDes":"/掐一掐","IQLid":"203","isCMEmoji":"1","AQLid":"205","EMCode":"303","Input":["qiayiqia","qyq"]},{"QSid":"234","QDes":"/惊呆","IQLid":"204","isCMEmoji":"1","AQLid":"206","EMCode":"304","Input":["jingdai","jd"]},{"QSid":"235","QDes":"/颤抖","IQLid":"205","isCMEmoji":"1","AQLid":"207","EMCode":"305","Input":["chandou","cd"]},{"QSid":"236","QDes":"/啃头","IQLid":"206","isCMEmoji":"1","AQLid":"208","EMCode":"306","Input":["kentou","kt"]},{"QSid":"237","QDes":"/偷看","IQLid":"207","isCMEmoji":"1","AQLid":"209","EMCode":"307","Input":["toukan","tk"]},{"QSid":"238","QDes":"/扇脸","IQLid":"208","isCMEmoji":"1","AQLid":"210","EMCode":"308","Input":["shanlian","sl"]},{"QSid":"239","QDes":"/原谅","IQLid":"209","isCMEmoji":"1","AQLid":"211","EMCode":"309","Input":["yuanliang","yl"]},{"QSid":"240","QDes":"/喷脸","IQLid":"210","isCMEmoji":"1","AQLid":"212","EMCode":"310","Input":["penlian","pl"]},{"QSid":"241","QDes":"/生日快乐","IQLid":"211","isCMEmoji":"1","AQLid":"213","EMCode":"311","Input":["shengrikuaile","srkl"]},{"QSid":"242","QDes":"/头撞击","IQLid":"212","isCMEmoji":"1","AQLid":"214","EMCode":"314","Input":["touzhuangji","tzj"]},{"QSid":"243","QDes":"/甩头","IQLid":"213","isCMEmoji":"1","AQLid":"215","EMCode":"313","Input":["shuaitou","st"]},{"QSid":"244","QDes":"/扔狗","IQLid":"214","isCMEmoji":"1","AQLid":"216","EMCode":"312","Input":["renggou","rg"]},{"QSid":"245","QDes":"/加油必胜","IQLid":"245","AQLid":"217","EMCode":"202001","Input":["jiayoubisheng","jybs"]},{"QSid":"246","QDes":"/加油抱抱","IQLid":"246","AQLid":"218","EMCode":"202002","Input":["jiayoubaobao","jybb"]},{"QSid":"247","QDes":"/口罩护体","isStatic":"1","IQLid":"247","AQLid":"219","EMCode":"202003","Input":["kouzhaohuti","kzht"]},{"QSid":"260","QDes":"/搬砖中","isStatic":"1","IQLid":"260","AQLid":"260","EMCode":"10260","Input":["banzhuanzhong","bzz"]},{"QSid":"261","QDes":"/忙到飞起","IQLid":"261","AQLid":"261","EMCode":"10261","Input":["mangdaofeiqi","mdfq"]},{"QSid":"262","QDes":"/脑阔疼","IQLid":"262","AQLid":"262","EMCode":"10262","Input":["naokuoteng","nkt"]},{"QSid":"263","QDes":"/沧桑","IQLid":"263","AQLid":"263","EMCode":"10263","Input":["cangsang","cs"]},{"QSid":"264","QDes":"/捂脸","IQLid":"264","AQLid":"264","EMCode":"10264","Input":["wulian","wl"]},{"QSid":"265","QDes":"/辣眼睛","IQLid":"265","AQLid":"265","EMCode":"10265","Input":["layanjing","lyj"]},{"QSid":"266","QDes":"/哦哟","IQLid":"266","AQLid":"266","EMCode":"10266","Input":["oyo","oy"]},{"QSid":"267","QDes":"/头秃","IQLid":"267","AQLid":"267","EMCode":"10267","Input":["toutu","tt"]},{"QSid":"268","QDes":"/问号脸","IQLid":"268","AQLid":"268","EMCode":"10268","Input":["wenhaolian","whl"]},{"QSid":"269","QDes":"/暗中观察","IQLid":"269","AQLid":"269","EMCode":"10269","Input":["anzhongguancha","azgc"]},{"QSid":"270","QDes":"/emm","IQLid":"270","AQLid":"270","EMCode":"10270","Input":["emm","e"]},{"QSid":"271","QDes":"/吃瓜","IQLid":"271","AQLid":"271","EMCode":"10271","Input":["chigua","cg"]},{"QSid":"272","QDes":"/呵呵哒","IQLid":"272","AQLid":"272","EMCode":"10272","Input":["heheda","hhd"]},{"QSid":"273","QDes":"/我酸了","isStatic":"1","IQLid":"273","AQLid":"273","EMCode":"10273","Input":["wosuanle","wsl"]},{"QSid":"274","QDes":"/太南了","isStatic":"1","IQLid":"274","AQLid":"274","EMCode":"10274","Input":["tainanle","tnl"]},{"QSid":"276","QDes":"/辣椒酱","isStatic":"1","IQLid":"276","AQLid":"276","QHide":"1","EMCode":"10276","Input":["lajiaojiang","ljj"]},{"QSid":"277","QDes":"/汪汪","isStatic":"1","IQLid":"277","AQLid":"277","EMCode":"10277","Input":["wangwang","ww"]},{"QSid":"278","QDes":"/汗","IQLid":"278","isCMEmoji":"1","AQLid":"278","EMCode":"20237","Input":["han"]},{"QSid":"279","QDes":"/打脸","IQLid":"279","isCMEmoji":"1","AQLid":"279","EMCode":"20238","Input":["dalian","dl"]},{"QSid":"280","QDes":"/击掌","IQLid":"280","isCMEmoji":"1","AQLid":"280","EMCode":"20239","Input":["jizhang","jz"]},{"QSid":"281","QDes":"/无眼笑","IQLid":"281","AQLid":"281","EMCode":"10281","Input":["wuyanxiao","wyx"]},{"QSid":"282","QDes":"/敬礼","IQLid":"282","AQLid":"282","EMCode":"10282","Input":["jingli","jl"]},{"QSid":"283","QDes":"/狂笑","IQLid":"283","AQLid":"283","EMCode":"10283","Input":["kuangxiao","kx"]},{"QSid":"284","QDes":"/面无表情","IQLid":"284","AQLid":"284","EMCode":"10284","Input":["mianwubiaoqing","mwbq"]},{"QSid":"285","QDes":"/摸鱼","IQLid":"285","AQLid":"285","EMCode":"10285","Input":["moyu","my"]},{"QSid":"286","QDes":"/魔鬼笑","IQLid":"286","AQLid":"286","EMCode":"10286","Input":["moguixiao","mgx"]},{"QSid":"287","QDes":"/哦","IQLid":"287","AQLid":"287","EMCode":"10287","Input":["o"]},{"QSid":"288","QDes":"/请","IQLid":"288","AQLid":"288","EMCode":"10288","Input":["qing"]},{"QSid":"289","QDes":"/睁眼","IQLid":"289","AQLid":"289","EMCode":"10289","Input":["zhengyan","zy"]},{"QSid":"290","QDes":"/敲开心","IQLid":"290","isCMEmoji":"1","AQLid":"290","EMCode":"20240","Input":["qiaokaixin","qkx"]},{"QSid":"291","QDes":"/震惊","IQLid":"291","isCMEmoji":"1","AQLid":"291","EMCode":"20241","Input":["zhenjing","zj"]},{"QSid":"292","QDes":"/让我康康","IQLid":"292","isCMEmoji":"1","AQLid":"292","EMCode":"20242","Input":["rangwokangkang","rwkk"]},{"QSid":"293","QDes":"/摸锦鲤","IQLid":"293","AQLid":"293","EMCode":"10293","Input":["mojinli","mjl"]},{"QSid":"294","QDes":"/期待","IQLid":"294","AQLid":"294","EMCode":"10294","Input":["qidai","qd"]},{"QSid":"295","QDes":"/拿到红包","IQLid":"295","AQLid":"295","QHide":"1","EMCode":"10295","Input":["nadaohongbao","ndhb"]},{"QSid":"296","QDes":"/真好","IQLid":"296","AQLid":"296","QHide":"1","EMCode":"10296","Input":["zhenhao","zh"]},{"QSid":"297","QDes":"/拜谢","IQLid":"297","AQLid":"297","EMCode":"10297","Input":["baixie","bx"]},{"QSid":"298","QDes":"/元宝","IQLid":"298","AQLid":"298","EMCode":"10298","Input":["yuanbao","yb"]},{"QSid":"299","QDes":"/牛啊","IQLid":"299","AQLid":"299","EMCode":"10299","Input":["niua","na"]},{"QSid":"300","QDes":"/胖三斤","IQLid":"300","AQLid":"300","EMCode":"10300","Input":["pangsanjin","psj"]},{"QSid":"301","QDes":"/好闪","IQLid":"301","AQLid":"301","EMCode":"10301","Input":["haoshan","hs"]},{"QSid":"302","QDes":"/左拜年","IQLid":"302","AQLid":"302","QHide":"1","EMCode":"10302","Input":["zuobainian","zbn"]},{"QSid":"303","QDes":"/右拜年","IQLid":"303","AQLid":"303","QHide":"1","EMCode":"10303","Input":["youbainian","ybn"]},{"QSid":"304","QDes":"/红包包","IQLid":"304","AQLid":"304","QHide":"1","EMCode":"10304","Input":["hongbaobao","hbb"]},{"QSid":"305","QDes":"/右亲亲","IQLid":"305","AQLid":"305","EMCode":"10305","Input":["youqinqin","yqq"]},{"QSid":"306","QDes":"/牛气冲天","isStatic":"1","IQLid":"306","AQLid":"306","EMCode":"10306","Input":["niuqichongtian","nqct"]},{"QSid":"307","QDes":"/喵喵","isStatic":"1","IQLid":"307","AQLid":"307","EMCode":"10307","Input":["miaomiao","mm"]},{"QSid":"308","QDes":"/求红包","IQLid":"308","isCMEmoji":"1","AQLid":"308","EMCode":"20243","Input":["qiuhongbao","qhb"]},{"QSid":"309","QDes":"/谢红包","IQLid":"309","isCMEmoji":"1","AQLid":"309","EMCode":"20244","Input":["xiehongbao","xhb"]},{"QSid":"310","QDes":"/新年烟花","IQLid":"310","isCMEmoji":"1","AQLid":"310","EMCode":"20245","Input":["xinnianyanhua","xnyh"]},{"QSid":"311","QDes":"/打call","IQLid":"311","AQLid":"311","EMCode":"10311","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"1","Input":["dacall","dc"]},{"QSid":"312","QDes":"/变形","IQLid":"312","AQLid":"312","EMCode":"10312","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"2","Input":["bianxing","bx"]},{"QSid":"313","QDes":"/嗑到了","IQLid":"313","AQLid":"313","QHide":"1","EMCode":"10313","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"3","Input":["kedaole","kdl"]},{"QSid":"314","QDes":"/仔细分析","IQLid":"314","AQLid":"314","EMCode":"10314","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"4","Input":["zixifenxi","zxfx"]},{"QSid":"315","QDes":"/加油","IQLid":"315","AQLid":"315","EMCode":"10315","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"5","Input":["jiayou","jy"]},{"QSid":"316","QDes":"/我没事","IQLid":"316","AQLid":"316","QHide":"1","EMCode":"10316","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"6","Input":["womeishi","wms"]},{"QSid":"317","QDes":"/菜狗","IQLid":"317","AQLid":"317","EMCode":"10317","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"7","Input":["caigou","cg"]},{"QSid":"318","QDes":"/崇拜","IQLid":"318","AQLid":"318","EMCode":"10318","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"8","Input":["chongbai","cb"]},{"QSid":"319","QDes":"/比心","IQLid":"319","AQLid":"319","EMCode":"10319","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"9","Input":["bixin","bx"]},{"QSid":"320","QDes":"/庆祝","IQLid":"320","AQLid":"320","EMCode":"10320","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"10","Input":["qingzhu","qz"]},{"QSid":"321","QDes":"/老色痞","IQLid":"321","AQLid":"321","QHide":"1","EMCode":"10321","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"11","Input":["laosepi","lsp"]},{"QSid":"322","QDes":"/拒绝","IQLid":"322","AQLid":"322","EMCode":"10322","Input":["jujue","jj"]},{"QSid":"323","QDes":"/嫌弃","IQLid":"323","AQLid":"323","EMCode":"10323","Input":["xianqi","xq"]},{"QSid":"324","QDes":"/吃糖","IQLid":"324","AQLid":"324","EMCode":"10324","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"12"},{"QSid":"325","QDes":"/惊吓","IQLid":"325","AQLid":"325","EMCode":"10325","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"14"},{"QSid":"326","QDes":"/生气","IQLid":"326","AQLid":"326","EMCode":"10326","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"15"},{"QSid":"327","QDes":"/加一","QHide":"1","IQLid":"327","AQLid":"327","EMCode":"10327"},{"QSid":"328","QDes":"/错号","QHide":"1","IQLid":"328","AQLid":"328","EMCode":"10328"},{"QSid":"329","QDes":"/对号","QHide":"1","IQLid":"329","AQLid":"329","EMCode":"10329"},{"QSid":"330","QDes":"/完成","QHide":"1","IQLid":"330","AQLid":"330","EMCode":"10330"},{"QSid":"331","QDes":"/明白","QHide":"1","IQLid":"331","AQLid":"331","EMCode":"10331"},{"QSid":"332","QDes":"/举牌牌","IQLid":"332","AQLid":"332","EMCode":"10332"},{"QSid":"333","QDes":"/烟花","isStatic":"1","IQLid":"333","AQLid":"333","EMCode":"10333","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"19"},{"QSid":"334","QDes":"/虎虎生威","IQLid":"334","AQLid":"334","EMCode":"10334","isStatic":"1"},{"QSid":"336","QDes":"/豹富","IQLid":"336","AQLid":"336","EMCode":"10336","isStatic":"1"},{"QSid":"337","QDes":"/花朵脸","IQLid":"337","AQLid":"337","EMCode":"10337","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"22"},{"QSid":"338","QDes":"/我想开了","IQLid":"338","AQLid":"338","EMCode":"10338","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"20"},{"QSid":"339","QDes":"/舔屏","IQLid":"339","AQLid":"339","EMCode":"10339","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"21"},{"QSid":"340","QDes":"/热化了","IQLid":"340","AQLid":"340","QHide":"1","EMCode":"10340","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"23"},{"QSid":"341","QDes":"/打招呼","IQLid":"341","AQLid":"341","EMCode":"10341","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"24"},{"QSid":"342","QDes":"/酸Q","IQLid":"342","AQLid":"342","EMCode":"10342","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"26"},{"QSid":"343","QDes":"/我方了","IQLid":"343","AQLid":"343","EMCode":"10343","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"27"},{"QSid":"344","QDes":"/大怨种","IQLid":"344","AQLid":"344","EMCode":"10344","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"28"},{"QSid":"345","QDes":"/红包多多","IQLid":"345","AQLid":"345","EMCode":"10345","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"29"},{"QSid":"346","QDes":"/你真棒棒","IQLid":"346","AQLid":"346","EMCode":"10346","AniStickerType":1,"AniStickerPackId":"1","AniStickerId":"25"},{"QSid":"347","QDes":"/大展宏兔","IQLid":"347","AQLid":"347","EMCode":"10347","isStatic":"1"},{"QSid":"348","QDes":"/福萝卜","IQLid":"348","AQLid":"348","EMCode":"10348","isStatic":"1"}]`)})),g_=ve(he(((e,t)=>{var n=(h_(),ye(p_).default);function r(e){return e=String(e),n.find(t=>t.QSid===e)}function i(e){e[0]===`/`&&(e=e.substring(1));let t=n.find(t=>t.QDes.substring(1)===e)||n.find(t=>t.Input.includes(e))||n.find(t=>t.Input.some(t=>t.startsWith(e)));return t?t.QSid:null}function a(e,t=`https://koishi.js.org/QFace`){let n=r(e);return n?t+(n.isStatic?`/static/s${e}.png`:`/gif/s${e}.gif`):``}t.exports={data:n,get:r,getUrl:a,getByText:i}}))(),1),__=[`76`,`66`,`63`,`64`,`39`,`116`,`59`,`98`,`2`,`178`,`179`,`182`];function v_(e){return{id:e.QSid,label:e.QDes.replace(/^\//,``)||e.QSid,url:g_.getUrl(e.QSid),inputs:e.Input??[]}}function y_(){return g_.data.filter(e=>!e.QHide).map(v_)}function b_(e){let t=g_.get(e);if(t)return v_(t);let n=e.trim();if(n)return{id:n,label:/^\d+$/.test(n)?`[表情]`:n,url:``,inputs:[]}}function x_(){let e=new Map(y_().map(e=>[e.id,e])),t=__.flatMap(t=>{let n=e.get(t);return n?[n]:[]});return t.length?t:y_().filter(e=>g_.get(e.id)?.isCMEmoji).slice(0,24)}function S_(e){let t=e.trim().toLowerCase(),n=y_();return t?n.filter(e=>e.id.includes(t)||e.label.toLowerCase().includes(t)?!0:e.inputs.some(e=>e.toLowerCase().includes(t))):n}var C_=`chatluna.onebot-sandbox.recent-emoji-ids`;function w_(){let e=z(C_);return Array.isArray(e)?e.filter(e=>typeof e==`string`&&!!e.trim()).slice(0,24):[]}function T_(e){let t=e.trim();if(!t)return w_();let n=[t,...w_().filter(e=>e!==t)].slice(0,24);return B(C_,n),n}function E_({open:t,onOpenChange:n,onSelect:r}){let i=J(),[a,o]=e.useState(``),[s,c]=e.useState([]);e.useEffect(()=>{t&&(o(``),c(w_()))},[t]);let l=!!a.trim(),u=s.map(b_).filter(e=>!!e),d=e.useMemo(()=>S_(a),[a]),f=e=>{c(T_(e)),r(e),n(!1)},p=(e,t)=>b(`div`,{className:`grid grid-cols-8 gap-1`,children:e.map(e=>b(`button`,{type:`button`,title:e.label,className:`flex aspect-square items-center justify-center rounded-md transition-colors hover:bg-accent`,onClick:()=>f(e.id),children:e.url?b(`img`,{src:e.url,alt:e.label,className:`size-6`}):b(`span`,{className:`text-[10px]`,children:e.label})},`${t}:${e.id}`))});return b(yr,{open:t,onOpenChange:n,children:x(Sr,{className:`flex flex-col overflow-hidden sm:max-w-md`,children:[b(Cr,{children:b(Tr,{children:i(`sandbox.emoji.title`)})}),b(Or,{type:`search`,className:`sandbox-search-input`,value:a,autoFocus:!0,placeholder:i(`sandbox.emoji.search`),"aria-label":i(`sandbox.emoji.search`),onChange:e=>o(e.target.value)}),x(`div`,{className:`-mx-5 flex max-h-[55vh] min-h-0 flex-col gap-4 overflow-y-auto px-5`,children:[!l&&u.length>0&&x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs text-muted-foreground`,children:i(`sandbox.emoji.recent`)}),p(u,`recent`)]}),!l&&x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs text-muted-foreground`,children:i(`sandbox.emoji.common`)}),p(x_(),`common`)]}),x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs text-muted-foreground`,children:i(l?`sandbox.emoji.results`:`sandbox.emoji.all`)}),d.length?p(d,`all`):b(`p`,{className:`py-6 text-center text-xs text-muted-foreground`,children:i(`sandbox.emoji.empty`)})]})]})]})})}function D_(t){let n=e.useRef(t);return t!==void 0&&(n.current=t),t??n.current}function O_(e,t){return!!e&&!!t&&e.userId===t.userId}function k_(e,t){return O_(e[t-1],e[t])}function A_(e,t){if(!e[t])return``;let n=O_(e[t-1],e[t]),r=O_(e[t],e[t+1]);return n&&r?`is-cluster-middle`:r?`is-cluster-first`:n?`is-cluster-last`:``}function j_({open:t,targets:n,onOpenChange:r,onConfirm:i}){let a=J(),[o,s]=e.useState(`recent`),[c,l]=e.useState(``),[u,d]=e.useState(``),[f,p]=e.useState(!1),[m,h]=e.useState(``),g=c.trim().toLowerCase(),_=n[o].filter(e=>!g||e.title.toLowerCase().includes(g)||e.conversationId.toLowerCase().includes(g)||!!e.subtitle?.toLowerCase().includes(g));return e.useEffect(()=>{t&&(s(`recent`),l(``),p(!1),h(``),d(n.recent[0]?.conversationId??n.friends[0]?.conversationId??n.groups[0]?.conversationId??``))},[t]),e.useEffect(()=>{_.some(({conversationId:e})=>e===u)||d(_[0]?.conversationId??``)},[o,g]),b(yr,{open:t,onOpenChange:r,children:x(Sr,{className:`flex flex-col overflow-hidden sm:max-w-md`,children:[x(Cr,{children:[b(Tr,{children:a(`sandbox.forward.targetTitle`)}),b(Er,{children:a(`sandbox.forward.targetHint`)})]}),x(`div`,{className:`relative`,children:[b(er,{className:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),b(Or,{type:`search`,className:`sandbox-search-input pl-8!`,value:c,placeholder:a(`sandbox.forward.search`),"aria-label":a(`sandbox.forward.search`),onChange:e=>l(e.target.value)})]}),b(Fc,{value:o,onValueChange:e=>s(e),children:b(Rc,{className:`w-full`,children:[`recent`,`friends`,`groups`].map(e=>b(zc,{value:e,className:`text-xs`,children:a(`sandbox.sidebar.${e}`)},e))})}),x(`div`,{className:`-mx-5 flex max-h-72 min-h-0 flex-col gap-0.5 overflow-y-auto px-5 py-1`,role:`listbox`,"aria-label":a(`sandbox.forward.targets`),children:[_.map(e=>x(`button`,{type:`button`,role:`option`,"aria-selected":u===e.conversationId,className:U(`flex items-center gap-3 rounded-lg px-2 py-1.5 text-left hover:bg-accent`,u===e.conversationId&&`bg-accent ring-1 ring-primary/40`),onClick:()=>d(e.conversationId),children:[b(Hf,{kind:e.avatarKind,name:e.title,src:e.avatar,className:`size-8`}),x(`span`,{className:`flex min-w-0 flex-col`,children:[b(`strong`,{className:`truncate text-[13px] font-medium`,children:e.title}),b(`small`,{className:`truncate text-xs text-muted-foreground`,children:e.subtitle||e.conversationId})]})]},e.conversationId)),!_.length&&b(`p`,{className:`py-10 text-center text-xs text-muted-foreground`,children:a(g?`sandbox.forward.noMatch`:`sandbox.forward.empty.${o}`)})]}),m&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:m}),x(wr,{children:[b(G,{variant:`outline`,disabled:f,onClick:()=>r(!1),children:a(`sandbox.common.cancel`)}),b(G,{disabled:!u||f,onClick:async()=>{if(!(!u||f)){p(!0),h(``);try{await i(u),r(!1)}catch(e){h(zd(e,a(`sandbox.forward.failed`)))}finally{p(!1)}}},children:a(f?`sandbox.forward.sending`:`sandbox.forward.send`)})]})]})})}function M_({stack:e,imageOpen:t,onCloseFrom:n,onOpenForward:r,onOpenImage:i}){return b(N_,{stack:e,depth:0,imageOpen:t,onCloseFrom:n,onOpenForward:r,onOpenImage:i})}function N_({stack:e,depth:t,imageOpen:n,onCloseFrom:r,onOpenForward:i,onOpenImage:a}){let o=J(),{participants:s,media:c,mediaFailures:l,workspace:u}=Yd(),d=e[t],f=D_(d);if(!f)return null;let p=e=>{let t=pd(e);return e.media?.length===1&&t===`[${cf(e.media[0])}] ${e.media[0].name}`?``:t},{appearance:m}=u;return b(yr,{open:!!d,onOpenChange:e=>!e&&!n&&r(t),children:x(Sr,{className:`flex max-h-[80vh] flex-col gap-3 overflow-hidden sm:max-w-lg`,children:[b(Cr,{className:`min-w-0 pr-8`,children:b(Tr,{className:`truncate leading-6`,children:f.title||o(`sandbox.forward.title`)})}),b(`div`,{className:`-mx-5 flex min-h-0 flex-1 flex-col overflow-y-auto px-5`,children:f.items.length?b(`ol`,{className:U(`sandbox-message-list sandbox-forward-list`,m.sandboxTimBubbleTail&&`has-tail`,m.sandboxIncomingBubbleStyle===`outline`&&`has-outline`),style:{"--sandbox-accent":m.sandboxAccentColor},children:f.items.map((e,t)=>{let n=k_(f.items,t),r=e.forwardId?f.nestedForwards[e.forwardId]:void 0,u=r?wf(r):void 0,d=p(e);return x(`li`,{className:U(`sandbox-message-row is-incoming`,A_(f.items,t),n&&`is-merged`),children:[b(`span`,{className:`sandbox-message-avatar-wrap`,children:b(Hf,{kind:s[e.userId]?.isBot?`bot`:`user`,name:e.nickname,src:s[e.userId]?.avatar,className:`size-8`})}),x(`div`,{className:`sandbox-message-content`,children:[!n&&b(`div`,{className:`sandbox-message-sender-line`,children:b(`span`,{children:e.nickname})}),b(`div`,{className:`sandbox-message-body`,children:b(`div`,{className:`sandbox-message-stack`,children:x(`div`,{className:`sandbox-message-bubble`,children:[e.forwardId&&x(`button`,{type:`button`,className:`sandbox-message-quote sandbox-message-forward`,"aria-label":o(`sandbox.forward.open`),onClick:()=>e.forwardId&&i(e.forwardId),children:[b(`strong`,{className:`sandbox-message-quote-title`,children:u?.title||o(`sandbox.forward.title`)}),u?x(y,{children:[u.lines.map((e,t)=>b(`span`,{children:e},t)),x(`span`,{className:`sandbox-message-forward-entry`,children:[o(`sandbox.forward.total`,{count:u.total}),b(xn,{className:`size-4`})]})]}):b(`span`,{children:o(`sandbox.forward.placeholder`)})]}),e.media?.map(e=>{let t=c[e.id];return b(`div`,{className:`sandbox-message-media`,children:t?e.type===`image`?b(`button`,{type:`button`,className:`sandbox-message-image`,"aria-label":o(`sandbox.media.viewImage`),onClick:()=>a(t),children:b(`img`,{src:t,alt:e.name})}):e.type===`audio`?b(`audio`,{src:t,controls:!0,preload:`metadata`}):e.type===`video`?b(`video`,{src:t,controls:!0,preload:`metadata`}):x(`a`,{href:t,download:e.name,className:`sandbox-message-file`,children:[b(qn,{className:`size-[18px]`}),x(`span`,{children:[b(`strong`,{children:e.name}),b(`small`,{children:lf(e.size)})]})]}):b(`span`,{className:`sandbox-message-media-loading`,children:l[e.id]?o(`sandbox.media.unavailable`):o(`sandbox.media.loading`)})},e.id)}),d&&b(`span`,{className:`sandbox-message-text`,children:d}),!d&&!e.media?.length&&!e.forwardId&&b(`span`,{className:`sandbox-message-text`,children:o(`sandbox.forward.emptyNode`)})]})})})]})]},t)})}):b(`p`,{className:`py-8 text-center text-xs text-muted-foreground`,children:o(`sandbox.forward.noItems`)})}),b(N_,{stack:e,depth:t+1,imageOpen:n,onCloseFrom:r,onOpenForward:i,onOpenImage:a})]})})}var P_=1,F_=8,I_=1.2;function L_({url:t,onClose:n}){let r=J(),i=e.useRef(null),[a,o]=e.useState(1),[s,c]=e.useState({x:0,y:0}),l=e.useRef(void 0),u=e.useRef(0);e.useEffect(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]);let d=(e,t)=>{let n=i.current;if(!n)return e;let r=Math.max((n.offsetWidth*t-window.innerWidth)/2,0),a=Math.max((n.offsetHeight*t-window.innerHeight)/2,0);return{x:Math.min(Math.max(e.x,-r),r),y:Math.min(Math.max(e.y,-a),a)}};return ae(x(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":r(`sandbox.media.preview`),className:`fixed inset-0 z-[100] flex items-center justify-center overflow-hidden bg-black/80 text-sm leading-6 animate-in fade-in-0`,onWheel:e=>{if(!e.deltaY)return;let t=Math.min(Math.max(a*(e.deltaY<0?I_:1/I_),P_),F_);if(t===a)return;let n=t/a,r=e.clientX-window.innerWidth/2,i=e.clientY-window.innerHeight/2;o(t),c(d({x:r-(r-s.x)*n,y:i-(i-s.y)*n},t))},onClick:e=>{performance.now()<u.current||e.target===e.currentTarget&&n()},children:[b(`img`,{ref:i,src:t,alt:``,draggable:!1,className:`max-h-[90vh] max-w-[90vw] select-none object-contain transition-transform duration-75`,style:{transform:`translate(${s.x}px, ${s.y}px) scale(${a})`},onPointerDown:e=>{e.button!==0||a<=P_||(l.current={id:e.pointerId,x:e.clientX,y:e.clientY,ox:s.x,oy:s.y,moved:!1},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=l.current;if(!t||t.id!==e.pointerId)return;let n=e.clientX-t.x,r=e.clientY-t.y;!t.moved&&Math.hypot(n,r)<3||(t.moved=!0,c(d({x:t.ox+n,y:t.oy+r},a)))},onPointerUp:e=>{l.current?.moved&&(u.current=performance.now()+250),l.current=void 0,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}}),x(`span`,{className:`absolute bottom-6 left-1/2 -translate-x-1/2 rounded-full bg-black/60 px-3 py-1 text-xs text-white tabular-nums`,children:[Math.round(a*100),`%`]}),b(G,{variant:`ghost`,size:`icon`,className:`absolute top-4 right-4 text-white hover:bg-white/15 hover:text-white`,"aria-label":r(`sandbox.common.close`),onClick:n,children:b(mr,{})})]}),document.body)}var R_=`—`,z_=new Map;function B_(e){let t=`${e.locale??``}|${e.timeZone??``}`,n=z_.get(t);if(n)return n;let r=new Intl.DateTimeFormat(e.locale??[],{...e.timeZone?{timeZone:e.timeZone}:{},hour:`2-digit`,minute:`2-digit`});return z_.set(t,r),r}function V_(e,t={}){let n=H_(e);return n===void 0?R_:B_(t).format(new Date(n))}function H_(e){let t=e instanceof Date?e.getTime():typeof e==`number`?e:Date.parse(e);return Number.isFinite(t)?t:void 0}var U_=24,W_=900;function G_({target:t,className:n}){let r=e.useRef(null),[i,a]=e.useState({top:0,size:0,visible:!1}),[o,s]=e.useState(!1),[c,l]=e.useState(!1),u=e.useRef(void 0),d=e.useRef(void 0),f=e.useCallback(()=>{let e=t.current,n=r.current;if(!e||!n)return;let i=e.scrollHeight-e.clientHeight,o=n.clientHeight;if(i<=1||!o)return a(e=>e.visible?{top:0,size:0,visible:!1}:e);let s=Math.max(U_,o*e.clientHeight/e.scrollHeight),c=(o-s)*e.scrollTop/i;a({top:c,size:s,visible:!0})},[t]);e.useLayoutEffect(()=>{let e=t.current;if(!e)return;f();let n=()=>{s(!0),clearTimeout(d.current),d.current=setTimeout(()=>s(!1),W_)},i=()=>{f(),n()};e.addEventListener(`scroll`,i,{passive:!0}),e.addEventListener(`pointermove`,n,{passive:!0});let a=new ResizeObserver(f);a.observe(e),r.current&&a.observe(r.current);for(let t of e.children)a.observe(t);let o=new MutationObserver(()=>{for(let t of e.children)a.observe(t);f()});return o.observe(e,{childList:!0,subtree:!0}),()=>{clearTimeout(d.current),e.removeEventListener(`scroll`,i),e.removeEventListener(`pointermove`,n),a.disconnect(),o.disconnect()}},[t,f]);let p=()=>{let e=t.current,n=r.current;if(!e||!n)return 0;let a=n.clientHeight-i.size;return a>0?(e.scrollHeight-e.clientHeight)/a:0};return b(`div`,{ref:r,"aria-hidden":!0,className:U(`sandbox-overlay-scrollbar`,i.visible&&`is-visible`,(o||c)&&`is-active`,c&&`is-dragging`,n),onPointerDown:e=>{let n=t.current;if(e.button!==0||!n||e.target!==e.currentTarget)return;let r=e.clientY-e.currentTarget.getBoundingClientRect().top;n.scrollBy({top:(r<i.top?-1:1)*n.clientHeight*.9,behavior:`smooth`})},children:b(`div`,{className:`sandbox-overlay-scrollbar-thumb`,style:{height:i.size,transform:`translateY(${i.top}px)`},onPointerDown:e=>{let n=t.current;e.button!==0||!n||(e.preventDefault(),u.current={id:e.pointerId,y:e.clientY,scrollTop:n.scrollTop},e.currentTarget.setPointerCapture(e.pointerId),l(!0))},onPointerMove:e=>{let n=u.current,r=t.current;!n||n.id!==e.pointerId||!r||(r.scrollTop=n.scrollTop+(e.clientY-n.y)*p())},onPointerUp:()=>{u.current=void 0,l(!1)},onPointerCancel:()=>{u.current=void 0,l(!1)}})})}function K_(e){let t=e?.media;return!!e&&t?.length===1&&t[0].type===`image`&&e.content===`[图片] ${t[0].name}`}function q_(e,t){if(e)return e.authorId===t?`outgoing`:`incoming`}function J_(e,t,n){return!!e&&!!t&&!e.event&&!t.event&&e.authorId===t.authorId&&e.conversationId===t.conversationId&&q_(e,n)===q_(t,n)}function Y_(e,t,n,r){let i=e[t];if(i)for(let a=t+n;a>=0&&a<e.length;a+=n){let t=e[a];if(!J_(i,t,r))return;if(!K_(t))return t}}function X_(e,t,n){return J_(e[t-1],e[t],n)}function Z_(e,t,n){if(!e[t])return``;let r=!!Y_(e,t,-1,n),i=!!Y_(e,t,1,n);return r&&i?`is-cluster-middle`:i?`is-cluster-first`:r?`is-cluster-last`:``}function Q_(e,t){return e.isFriend?t?[`poke`,`remark`,`delete`]:[`remark`,`delete`]:e.pendingOutgoing||e.pendingIncoming?[]:[`request`]}function $_(e,t){return e?.card?.trim()||t}function ev(e){if(!e)return;let t=e.title?.trim()||void 0;return e.role===`owner`||e.role===`admin`?t?{kind:e.role,title:t}:{kind:e.role}:t?{kind:`title`,title:t}:void 0}function tv(e,t){if(!e)return[];let n=[];return e.participantId!==t.participantId&&n.push(`mention`,`poke`),(e.participantId===t.participantId||e.role===`owner`||e.role===`admin`&&t.role===`member`)&&n.push(`set-card`),e.role===`owner`&&n.push(`set-title`),e.role===`owner`&&t.role!==`owner`&&n.push(t.role===`admin`?`unset-admin`:`set-admin`),e.role===`owner`&&e.participantId!==t.participantId&&n.push(`transfer-owner`),e.participantId!==t.participantId&&t.role!==`owner`&&(e.role===`owner`||e.role===`admin`&&t.role===`member`)&&n.push(`kick`),n}var nv={isFriend:!1,pendingOutgoing:!1,pendingIncoming:!1};function rv(e,t){return t.participants[e]?.name??e}function iv(e,t){return t.currentGroup?.members.find(t=>t.participantId===e)}function av(e,t){return $_(iv(e,t),rv(e,t))}function ov(e,t){return ev(iv(e,t))}function sv(e,t){let n=iv(e,t);return n?tv(iv(t.currentOperatorId??``,t),n):[]}var cv=[`set-card`,`set-title`,`set-admin`,`unset-admin`,`transfer-owner`,`kick`];function lv(e,t){return sv(e,t).some(e=>cv.includes(e))}function uv(e,t){return t.friendMenuStates[e]??nv}function dv(e,t){return Q_(uv(e,t),!0)}function fv(e,t){return t===void 0?e(`sandbox.chat.thinkingProcess`):e(`sandbox.chat.thoughtFor`,{seconds:Math.max(0,Math.round(t/1e3))})}function pv({target:e,managementOnly:t,onMention:n}){let r=J(),{store:i,run:a,dialogs:o}=Jd(),{group:s,operatorId:c,conversation:l}=Yd();if(!s)return null;let u=s.members.find(({participantId:e})=>e===c),d=tv(u,e),f=e.participantId,p=e=>a(r(`sandbox.error.group`),()=>i.performGroupAction(e)),m=!u||u.participantId===f?``:u.role===`member`?r(`sandbox.member.kickNeedAdmin`):u.role===`admin`&&e.role!==`member`?r(`sandbox.member.adminLimit`):``;return x(y,{children:[!t&&d.includes(`mention`)&&n&&x(q,{onClick:()=>n(f),children:[b(un,{}),r(`sandbox.member.mention`)]}),!t&&d.includes(`poke`)&&l&&x(q,{onClick:()=>p({action:`poke`,groupId:s.id,targetId:f,conversationId:l.id}),children:[b(Rn,{}),r(`sandbox.member.poke`)]}),d.includes(`set-card`)&&x(q,{onClick:()=>o.openGroupAction(`card`,f,s.id),children:[b(ar,{}),r(`sandbox.member.setCard`)]}),d.includes(`set-title`)&&x(q,{onClick:()=>o.openGroupAction(`title`,f,s.id),children:[b(dn,{}),r(`sandbox.member.setTitle`)]}),d.includes(`set-admin`)&&x(q,{onClick:()=>p({action:`set-admin`,groupId:s.id,targetId:f,enabled:!0}),children:[b(ur,{}),r(`sandbox.member.setAdmin`)]}),d.includes(`unset-admin`)&&x(q,{onClick:()=>p({action:`set-admin`,groupId:s.id,targetId:f,enabled:!1}),children:[b(lr,{}),r(`sandbox.member.unsetAdmin`)]}),d.includes(`transfer-owner`)&&x(q,{onClick:()=>p({action:`transfer-owner`,groupId:s.id,targetId:f}),children:[b(On,{}),r(`sandbox.member.transferOwner`),b(a_,{})]}),d.includes(`kick`)?x(q,{variant:`destructive`,onClick:()=>p({action:`kick`,groupId:s.id,targetId:f}),children:[b(lr,{}),r(`sandbox.member.kick`)]}):m&&x(q,{disabled:!0,children:[b(lr,{}),m]})]})}var mv=3;function hv({reactions:e,readonly:t,onToggle:n}){let{participants:r}=Yd();return b(`div`,{className:`sandbox-message-reactions`,children:e.map(e=>{let i=b_(e.emojiId),a=e.participantIds.slice(0,mv);return x(`button`,{type:`button`,className:`sandbox-message-reaction`,disabled:t,"aria-label":`${i?.label??e.emojiId} ${e.participantIds.length}`,onClick:t=>{t.stopPropagation(),n(e.emojiId)},children:[i?.url?b(`img`,{src:i.url,alt:i.label,className:`sandbox-message-reaction-emoji`}):b(`span`,{children:i?.label??e.emojiId}),a.length>0&&b(`span`,{className:`sandbox-message-reaction-users`,children:a.map((e,t)=>b(`span`,{title:r[e]?.name??e,className:`sandbox-message-reaction-avatar`,style:{zIndex:a.length-t},children:b(Hf,{kind:r[e]?.isBot?`bot`:`user`,name:r[e]?.name??e,src:r[e]?.avatar,className:`size-full text-[9px]`,badge:!1})},e))})]},e.emojiId)})})}var gv=new Map,_v=48,vv=e.forwardRef(function(t,n){let r=J(),i=g(),{store:a,run:o,dialogs:s}=Jd(),{conversation:c,group:l,peer:u,operatorId:d,participants:f,participantNames:p,resolveAvatar:m,media:h,mediaFailures:_,workspace:v}=Yd(),S=v.appearance.sandboxMarkRecalledMessages,C=v.appearance.sandboxTimBubbleTail,w=v.appearance.sandboxIncomingBubbleStyle===`outline`,T=e.useRef(null),E=e.useRef(null),D=e.useRef(!0),O=e.useRef(0),k=e.useRef(void 0),[A,j]=e.useState(!1),[M,N]=e.useState(``),[ee,P]=e.useState({}),F=e.useRef(void 0),I={replyMessages:t.replyMessages,forwardPreviews:t.forwardPreviews,messageCapabilities:t.capabilities,participantNames:p,markRecalledMessages:S,currentConversationId:c?.id,currentOperatorId:d,participants:f,friendMenuStates:t.friendMenuStates,currentGroup:l},te=e=>av(e,I),ne=()=>{let e=T.current;e&&(e.scrollTop=e.scrollHeight)};e.useLayoutEffect(()=>{let e=gv.get(t.scrollKey);D.current=!e||e.bottom,D.current?ne():T.current&&(T.current.scrollTop=e.top),O.current=T.current?.scrollTop??0;let n=t.scrollKey,r=T.current;return()=>{r&&gv.set(n,{top:r.scrollTop,bottom:D.current})}},[t.scrollKey]);let L=`${t.messages.at(-1)?.id??``}:${t.messages.length}:${t.chatLunaStates.filter(({thinking:e})=>e).length}`;e.useLayoutEffect(()=>{let e=T.current;if(!e)return;let t=k.current;if(t){k.current=void 0;let n=e.querySelector(`[data-message-id="${CSS.escape(t.messageId)}"]`);n&&(e.scrollTop+=n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.offset);return}D.current&&ne()},[L]),e.useEffect(()=>{let e=E.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{D.current&&ne()});return t.observe(e),()=>t.disconnect()},[t.scrollKey,t.messages.length>0]);let R=()=>{let e=T.current;if(!e)return;let t=e.scrollTop;e.scrollHeight-t-e.clientHeight<_v?D.current=!0:t<O.current&&(D.current=!1),O.current=t},re=async()=>{let e=T.current;if(A||!e)return;let n=e.querySelector(`[data-message-id]`);n&&(k.current={messageId:n.dataset.messageId??``,offset:n.getBoundingClientRect().top-e.getBoundingClientRect().top}),D.current=!1,j(!0);try{await t.onLoadHistory()}catch{k.current=void 0}finally{j(!1)}},ie=e=>{let t=T.current,n=t?.querySelector(`[data-message-id="${CSS.escape(e)}"]`);return!t||!n?!1:(D.current=!1,n.scrollIntoView({block:`center`,behavior:`smooth`}),N(e),clearTimeout(F.current),F.current=setTimeout(()=>N(``),1600),!0)};e.useImperativeHandle(n,()=>({revealMessage:ie})),e.useEffect(()=>()=>clearTimeout(F.current),[]);let z=t.chatLunaStates.filter(({thinking:e})=>e),B=!t.messages.length&&!z.length,ae=l?`group`:f[c?.participantIds?.find(e=>e!==d)??``]?.isBot?`bot`:`user`,oe=e=>o(r(`sandbox.error.friend`),()=>a.performFriendAction(e)),se=e=>e.media?.map(e=>{let n=h[e.id];return b(`div`,{className:`sandbox-message-media`,children:n?e.type===`image`?b(`button`,{type:`button`,className:`sandbox-message-image`,"aria-label":r(`sandbox.media.viewImage`),onClick:e=>{t.selectionMode||(e.stopPropagation(),t.onOpenImage(n))},children:b(`img`,{src:n,alt:e.name})}):e.type===`audio`?b(`audio`,{src:n,controls:!0,preload:`metadata`}):e.type===`video`?b(`video`,{src:n,controls:!0,preload:`metadata`}):x(`a`,{href:n,download:e.name,className:`sandbox-message-file`,children:[b(qn,{className:`size-[18px]`}),x(`span`,{children:[b(`strong`,{children:e.name}),b(`small`,{children:lf(e.size)})]})]}):b(`span`,{className:`sandbox-message-media-loading`,children:_[e.id]?r(`sandbox.media.unavailable`):r(`sandbox.media.loading`)})},e.id)});return x(y,{children:[x(gc,{disabled:t.selectionMode||!c,children:[b(_c,{render:b(`div`,{ref:T,className:`sandbox-message-scroller min-h-0 flex-1 overflow-y-auto overscroll-contain [overflow-anchor:none]`,"aria-label":r(`sandbox.chat.messages`),onScroll:R}),children:B?x(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 px-6 text-center`,style:{paddingBottom:t.bottomSpace},children:[b(Hf,{kind:ae,name:c?.title??l?.name??u?.name,src:m(l?.avatar??u?.avatar),className:`size-14`}),ae===`bot`?x(y,{children:[b(`h2`,{className:`mt-2 text-sm font-medium`,children:r(`sandbox.chat.emptyBotTitle`)}),b(`p`,{className:`text-xs text-muted-foreground`,children:r(`sandbox.chat.emptyBotHint`)})]}):b(`p`,{className:`text-xs text-muted-foreground`,children:r(`sandbox.chat.emptyHint`)})]}):x(`ol`,{ref:E,className:U(`sandbox-message-list`,C&&`has-tail`,w&&`has-outline`,t.selectionMode&&`is-selecting`),style:{paddingBottom:t.bottomSpace},children:[t.hasMoreMessages&&b(`li`,{className:`sandbox-message-history-row`,children:b(`button`,{type:`button`,className:`sandbox-message-history`,disabled:A,onClick:re,children:r(A?`sandbox.common.loading`:`sandbox.chat.earlier`)})}),t.messages.map((n,u)=>{let p=n.authorId===d,m=p?`is-outgoing`:`is-incoming`,h=yf(n,I),g=X_(t.messages,u,d),_=Z_(t.messages,u,d),v=md(n),S=bf(n,I),C=t.selectedIds.includes(n.id),w=t.selectionMode&&h.forward,T=_f(n,I),E=vf(n,I),D=gf(n,I),O=ov(n.authorId,I),k=f[n.authorId]?.isBot,A=mf(n,I)?ff(n):void 0,j=!A&&hf(n,I)?pf(n)?.usage:void 0,N=xf(t.messages,u,I)&&b(`li`,{className:`sandbox-message-fork-boundary`,children:r(`sandbox.chat.forkBoundary`)},`${n.id}:boundary`);if(uf(n,I))return x(e.Fragment,{children:[N,b(`li`,{"data-message-id":n.id,className:`sandbox-message-event`,children:df(n,te)})]},n.id);let F=x(gc,{disabled:t.selectionMode,children:[b(_c,{render:b(`button`,{type:`button`,className:`sandbox-message-avatar-wrap`,"aria-label":r(`sandbox.chat.viewProfileOf`,{name:te(n.authorId)}),onClick:e=>{t.selectionMode||(e.stopPropagation(),s.openProfile(n.authorId,{x:e.clientX,y:e.clientY}))},onContextMenu:e=>e.stopPropagation()}),children:b(Hf,{kind:k?`bot`:`user`,name:te(n.authorId),src:f[n.authorId]?.avatar,className:`size-8`})}),x(vc,{className:`sandbox-glass`,children:[x(q,{onClick:()=>s.openProfile(n.authorId),children:[b(zn,{}),r(`sandbox.menu.profile`)]}),!p&&x(y,{children:[sv(n.authorId,I).includes(`mention`)&&x(q,{onClick:()=>t.onMention(n.authorId),children:[b(un,{}),r(`sandbox.member.mention`)]}),l&&c&&sv(n.authorId,I).includes(`poke`)&&x(q,{onClick:()=>o(r(`sandbox.error.group`),()=>a.performGroupAction({action:`poke`,groupId:l.id,targetId:n.authorId,conversationId:c.id})),children:[b(Rn,{}),r(`sandbox.member.poke`)]}),lv(n.authorId,I)&&x(yc,{children:[x(bc,{children:[b(fr,{}),r(`sandbox.member.manage`)]}),b(xc,{className:`sandbox-glass`,children:b(pv,{target:iv(n.authorId,I),managementOnly:!0})})]}),dv(n.authorId,I).includes(`request`)?x(q,{onClick:()=>oe({action:`request`,targetId:n.authorId,comment:r(`sandbox.friend.requestComment`)}),children:[b(ur,{}),r(`sandbox.menu.requestFriend`),b(a_,{})]}):uv(n.authorId,I).pendingOutgoing?x(q,{disabled:!0,children:[b(wn,{}),r(`sandbox.menu.waitingPeer`)]}):uv(n.authorId,I).pendingIncoming?x(q,{disabled:!0,children:[b(fn,{}),r(`sandbox.menu.handleInNotice`)]}):null,!l&&c&&dv(n.authorId,I).includes(`poke`)&&x(q,{onClick:()=>oe({action:`poke`,targetId:n.authorId,conversationId:c.id}),children:[b(Rn,{}),r(`sandbox.member.poke`)]}),!l&&dv(n.authorId,I).includes(`remark`)&&x(q,{onClick:()=>s.openRemark(n.authorId),children:[b(ar,{}),r(`sandbox.menu.remark`),b(a_,{})]}),!l&&dv(n.authorId,I).includes(`delete`)&&x(q,{variant:`destructive`,onClick:()=>oe({action:`delete`,targetId:n.authorId}),children:[b(lr,{}),r(`sandbox.menu.deleteFriend`)]})]})]})]}),ne=x(`div`,{className:`sandbox-message-bubble`,onClickCapture:e=>{!t.selectionMode||!w||(e.preventDefault(),e.stopPropagation(),t.onToggleSelection(n.id))},children:[T&&x(`button`,{type:`button`,className:`sandbox-message-quote`,"aria-label":r(`sandbox.chat.jumpToQuote`),onClick:e=>{e.stopPropagation(),ie(T.id)},children:[b(`strong`,{className:`sandbox-message-quote-title`,children:te(T.authorId)}),b(`span`,{children:gf(T,I)})]}),n.forwardId?x(`button`,{type:`button`,className:`sandbox-message-quote sandbox-message-forward`,disabled:!E,"aria-label":r(`sandbox.forward.open`),onClick:e=>{t.selectionMode||!E||!n.forwardId||(e.stopPropagation(),t.onOpenForward({messageId:n.id,forwardId:n.forwardId}))},children:[b(`strong`,{className:`sandbox-message-quote-title`,children:E?.title||r(`sandbox.forward.title`)}),E?x(y,{children:[E.lines.map((e,t)=>b(`span`,{children:e},t)),x(`span`,{className:`sandbox-message-forward-entry`,children:[r(`sandbox.forward.total`,{count:E.total}),b(xn,{className:`size-4`})]})]}):b(`span`,{children:D||r(`sandbox.forward.placeholder`)})]}):x(y,{children:[se(n),D&&b(`span`,{className:`sandbox-message-text`,children:D})]}),v&&b(`span`,{className:`sandbox-message-recalled-label`,children:r(`sandbox.chat.recalled`)}),!!n.reactions?.length&&b(hv,{reactions:n.reactions,readonly:!h.react,onToggle:e=>{let r=Sf(n,e,I);r&&t.onReact(r.messageId,r.emojiId,r.enabled)}})]}),L=n.chatLuna?.trace,R=!!ee[n.id];return x(e.Fragment,{children:[N,x(`li`,{"data-message-id":n.id,"aria-selected":t.selectionMode?C:void 0,className:U(`sandbox-message-row`,m,_,g&&`is-merged`,M===n.id&&`is-quote-target`,v&&`is-recalled`,S&&`is-inherited`,t.selectionMode&&`is-selecting`,w&&`is-selectable`),onClick:e=>{w&&e.currentTarget.contains(e.target)&&(e.target.closest(`a,button,audio,video`)||t.onToggleSelection(n.id))},children:[w&&b(`span`,{className:U(`sandbox-message-select-marker`,C&&`is-checked`),"aria-hidden":!0,children:b(vn,{className:`size-3`,strokeWidth:3})}),x(`div`,{className:`sandbox-message-select-body`,children:[F,x(`div`,{className:`sandbox-message-content`,children:[!g&&x(`div`,{className:`sandbox-message-sender-line`,children:[b(`span`,{children:te(n.authorId)}),O&&b(`span`,{className:U(`sandbox-message-role-badge`,`is-${O.kind}`),children:O.title??r(`sandbox.role.${O.kind}`)})]}),x(`div`,{className:`sandbox-message-body`,children:[b(`div`,{className:`sandbox-message-stack`,children:x(gc,{disabled:v||t.selectionMode,children:[b(_c,{render:b(`div`,{className:`sandbox-message-bubble-trigger`,onContextMenu:e=>e.stopPropagation()}),children:ne}),x(vc,{className:`sandbox-glass`,children:[k&&L&&x(q,{onClick:()=>i(bv(L)),children:[b(jn,{}),r(`sandbox.chat.openRequest`)]}),h.reply&&x(q,{onClick:()=>t.onReply(n.id),children:[b(Qn,{}),r(`sandbox.chat.reply`)]}),h.branch&&x(q,{onClick:()=>t.onBranch(n.id),children:[b(In,{}),r(`sandbox.chat.branch`)]}),h.react&&x(q,{onClick:()=>t.onOpenReactionPicker(n.id),children:[b(Mn,{}),r(`sandbox.chat.react`)]}),h.forward&&x(q,{onClick:()=>t.onEnterSelection(n.id),children:[b(Un,{}),r(`sandbox.chat.multiSelect`)]}),h.recall&&x(y,{children:[b(Sc,{}),x(q,{variant:`destructive`,onClick:()=>t.onRecall(n.id),children:[b(En,{}),r(`sandbox.chat.recall`)]})]})]})]})}),b(`time`,{className:`sandbox-message-time`,children:V_(n.createdAt)})]})]})]})]}),A?x(`li`,{className:U(`sandbox-message-thinking-row`,m,v&&`is-recalled`),children:[x(`button`,{type:`button`,className:`sandbox-message-thinking-toggle`,"aria-expanded":R,onClick:()=>P(e=>({...e,[n.id]:!e[n.id]})),children:[A.usage&&b(yv,{input:A.usage.inputTokens,output:A.usage.outputTokens}),b(`span`,{className:`sandbox-message-thinking-duration`,children:fv(r,A.thoughtDurationMs)}),b(xn,{className:U(`sandbox-message-thinking-chevron`,R&&`is-expanded`),"aria-hidden":!0})]}),R&&b(`div`,{className:`sandbox-message-thinking-panel`,children:b(`div`,{className:`sandbox-message-thinking-content`,children:A.thought})})]}):j&&b(`li`,{className:U(`sandbox-message-thinking-row is-usage-only`,m,v&&`is-recalled`),children:b(yv,{input:j.inputTokens,output:j.outputTokens})})]},n.id)}),z.map(e=>x(`li`,{className:U(`sandbox-message-row`,e.botParticipantId===d?`is-outgoing`:`is-incoming`),children:[b(`span`,{className:`sandbox-message-avatar-wrap`,children:b(Hf,{kind:`bot`,name:f[e.botParticipantId]?.name,src:f[e.botParticipantId]?.avatar,className:`size-8`})}),x(`div`,{className:`sandbox-message-content`,children:[b(`div`,{className:`sandbox-message-sender-line`,children:b(`span`,{children:f[e.botParticipantId]?.name??e.botParticipantId})}),b(`div`,{className:`sandbox-message-body`,children:b(`div`,{className:`sandbox-message-bubble`,"aria-label":r(`sandbox.chat.thinking`),children:b(`span`,{className:`sandbox-message-thinking-dots`,children:[0,1,2].map(e=>b(`span`,{className:`sandbox-message-thinking-dot`},e))})})})]})]},`${e.botParticipantId}:${e.conversationId}`))]})}),b(vc,{className:`sandbox-glass`,children:x(q,{variant:`destructive`,onClick:t.onClearConversation,children:[b(or,{}),r(`sandbox.chat.clear`)]})})]}),b(G_,{target:T,className:`sandbox-message-scrollbar`})]})});function yv({input:e,output:t}){let n=J();return b(`span`,{className:`sandbox-message-thinking-usage`,"aria-label":n(`sandbox.chat.usage`),children:x(`span`,{className:`sandbox-message-thinking-usage-group`,children:[b(ln,{className:`sandbox-message-thinking-usage-icon`,"aria-hidden":!0}),b(`span`,{children:e??`-`}),b(rn,{className:`sandbox-message-thinking-usage-icon is-output`,"aria-hidden":!0}),b(`span`,{children:t??`-`})]})})}function bv({sessionId:e,turn:t,step:n}){return`/traces/${encodeURIComponent(e)}?turn=${t}&step=${n}`}function xv(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return;let n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return n.getDate()===Number(t[3])?n:void 0}function Sv(e){if(!e)return``;let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Cv(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),a=new Date(n,r-1,i);if(a.getFullYear()!==n||a.getMonth()!==r-1||a.getDate()!==i)return;let o=new Date(a);return o.setDate(o.getDate()+1),{createdAtStart:a.toISOString(),createdAtEnd:o.toISOString()}}async function wv(e){if(e.isLoaded())return!0;let t=0,n=e.maxAttempts??40,r=e.getOldestLoadedMessageId?.();for(;!e.isLoaded()&&e.canLoadMore()&&t<n;){if(t+=1,await e.loadMore(),e.isLoaded())return!0;let n=e.getOldestLoadedMessageId?.();if(e.getOldestLoadedMessageId&&n===r)return!1;r=n}return e.isLoaded()}var Tv=30;function Ev({adapter:t,onClose:n}){let r=J(),{participants:i,participantNames:a}=Yd(),[o,s]=e.useState(``),[c,l]=e.useState(``),[u,d]=e.useState(!1),[f,p]=e.useState(!1),[m,h]=e.useState(``),[g,_]=e.useState([]),[v,y]=e.useState(),[S,C]=e.useState(``),[w,T]=e.useState(``),E=e.useRef(0),D=e.useRef({query:``}),O=e.useRef(null),k=e.useRef(t);k.current=t,e.useEffect(()=>O.current?.focus(),[]);let A=e.useCallback(async(e,t)=>{let n=k.current.conversationId,i=t?Cv(t):void 0,a=++E.current;if(D.current={query:e,...i},C(``),_([]),y(void 0),h(``),!n||!e&&!i)return p(!1);if(t&&!i)return p(!1),h(r(`sandbox.search.invalidDate`));p(!0);try{let e=await k.current.search({conversationId:n,...D.current,limit:Tv});if(a!==E.current)return;_(e.hits),y(e.nextBeforeMessageId)}catch(e){a===E.current&&h(zd(e,r(`sandbox.search.failed`)))}finally{a===E.current&&p(!1)}},[r]);e.useEffect(()=>{let e=o.trim();if(!e){A(``,c);return}let t=setTimeout(()=>void A(e,c),250);return()=>clearTimeout(t)},[o,c,A]);let j=async()=>{let e=t.conversationId;if(!e||!v||f)return;let n=++E.current;p(!0),h(``);try{let r=await t.search({conversationId:e,...D.current,beforeMessageId:v,limit:Tv});if(n!==E.current)return;_(e=>{let t=new Set(e.map(({messageId:e})=>e));return[...e,...r.hits.filter(({messageId:e})=>!t.has(e))]}),y(r.nextBeforeMessageId)}catch(e){n===E.current&&h(zd(e,r(`sandbox.search.failed`)))}finally{n===E.current&&p(!1)}},M=async e=>{if(!w){T(e.messageId),h(``);try{if(!await wv({messageId:e.messageId,isLoaded:()=>k.current.isLoaded(e.messageId),canLoadMore:()=>k.current.canLoadMore(),getOldestLoadedMessageId:()=>k.current.oldestLoadedId(),loadMore:()=>k.current.loadMore()}))return h(r(`sandbox.search.notLoaded`));if(await new Promise(e=>requestAnimationFrame(e)),!k.current.reveal(e.messageId))return h(r(`sandbox.search.notFound`));C(e.messageId)}catch(e){h(zd(e,r(`sandbox.search.revealFailed`)))}finally{T(``)}}},N=m||(f&&!g.length?r(`sandbox.search.searching`):``)||(w?r(`sandbox.search.revealing`):``)||(!f&&!g.length?r(`sandbox.search.empty`):``),ee=new Date;return x(`section`,{role:`search`,"aria-label":r(`sandbox.search.label`),className:`relative w-72 min-w-36 shrink`,children:[x(kr,{className:`h-8`,children:[b(jr,{children:b(er,{})}),b(Mr,{ref:O,type:`search`,value:o,autoComplete:`off`,className:`sandbox-search-input text-[13px]!`,placeholder:r(`sandbox.search.placeholder`),"aria-label":r(`sandbox.search.input`),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key!==`Escape`||u||(e.preventDefault(),e.stopPropagation(),n())}}),x(jr,{align:`inline-end`,className:`gap-0.5`,children:[x(Lr,{open:u,onOpenChange:d,children:[b(Rr,{render:b(G,{variant:`ghost`,size:`icon-xs`,className:U(c&&`text-primary`),"aria-pressed":!!c,"aria-label":c?r(`sandbox.search.dateCurrent`,{date:c}):r(`sandbox.search.date`)}),children:b(_n,{})}),b(zr,{align:`end`,className:`sandbox-glass w-auto p-0`,children:b(lc,{mode:`single`,captionLayout:`dropdown`,startMonth:new Date(ee.getFullYear()-9,0),endMonth:ee,selected:xv(c),onSelect:e=>{l(Sv(e)),d(!1)}})})]}),b(G,{variant:`ghost`,size:`icon-xs`,"aria-label":r(o||c?`sandbox.search.clear`:`sandbox.search.close`),onClick:()=>{o||c?(s(``),l(``),O.current?.focus()):n()},children:b(mr,{})})]})]}),(o.trim()||c)&&x(`div`,{className:`absolute top-10 right-0 z-30 flex max-h-96 w-80 flex-col gap-0.5 overflow-y-auto rounded-xl sandbox-search-results p-1.5 text-popover-foreground shadow-popup ring-1 ring-border`,role:`listbox`,"aria-label":r(`sandbox.search.results`),children:[N&&b(`p`,{role:`status`,"aria-live":`polite`,className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:N}),g.map(e=>{let t=i[e.authorId]??{name:e.authorId,isBot:!1};return x(`button`,{type:`button`,role:`option`,"aria-selected":S===e.messageId,disabled:!!w,className:U(`flex items-start gap-2.5 rounded-lg px-2 py-1.5 text-left hover:bg-accent disabled:opacity-60`,S===e.messageId&&`bg-accent`),onClick:()=>M(e),children:[b(Hf,{kind:t.isBot?`bot`:`user`,name:t.name,src:t.avatar,className:`size-7`}),x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[x(`span`,{className:`flex items-center gap-2`,children:[b(`strong`,{className:`truncate text-xs font-medium`,children:t.name}),b(`time`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground`,dateTime:e.createdAt,children:new Intl.DateTimeFormat(void 0,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e.createdAt))})]}),b(`span`,{className:`line-clamp-2 text-xs text-muted-foreground`,children:sf(e.summary,a)})]})]},e.messageId)}),v&&g.length>0&&b(G,{variant:`ghost`,size:`sm`,disabled:f||!!w,onClick:j,children:r(f?`sandbox.common.loading`:`sandbox.search.more`)})]})]})}var Dv=80;function Ov({detailsVisible:t,onToggleDetails:n,onBack:r,mentionBridge:i,className:a}){let o=J(),{store:s,run:c,dialogs:l}=Jd(),u=Yd(),{snapshot:d,conversation:f,group:p,peer:m,bot:h,operatorId:g,participants:_,participantNames:v,resolveAvatar:S}=u,C=e.useRef(null),w=e.useRef(null),[T,E]=e.useState(``),[D,O]=e.useState(``),[k,A]=e.useState(Bf()),[j,M]=e.useState(!1),[N,ee]=e.useState([]),[P,F]=e.useState(``),[I,te]=e.useState(72),[ne,L]=e.useState(!1),R=e.useMemo(()=>Kd(d,f?.id),[d,f?.id]),re=e.useMemo(()=>{let e=new Map(d.messages.map(e=>[e.id,e]));return Object.fromEntries(R.flatMap(({replyToMessageId:t})=>{let n=t?e.get(t):void 0;return n?[[n.id,n]]:[]}))},[R,d.messages]),ie=e.useMemo(()=>Tf(R,d.forwards??[]),[R,d.forwards]),z=e.useMemo(()=>af({messages:R,conversation:f,operatorId:g,group:p}),[R,f,g,p]),B=e.useMemo(()=>g?Object.fromEntries(d.participants.map(({id:e})=>[e,{isFriend:d.friendships.some(({participantIds:t})=>t.includes(g)&&t.includes(e)),pendingOutgoing:d.requests.some(t=>t.type===`friend`&&t.requesterId===g&&t.targetId===e),pendingIncoming:d.requests.some(t=>t.type===`friend`&&t.requesterId===e&&t.targetId===g)}])):{},[d,g]),ae=e.useMemo(()=>p?.members.flatMap(e=>{let t=_[e.participantId];if(!t)return[];let n=e.card?.trim();return[{id:e.participantId,name:n||t.name,avatar:t.avatar,kind:t.isBot?`bot`:`user`,keywords:n&&n!==t.name?[t.name]:void 0}]})??[],[p,_]),oe=e.useMemo(()=>({recent:kf(Of({scene:d,conversations:u.conversations,operatorId:g,resolveAvatar:S,emptyPreview:o(`sandbox.chat.emptyPreview`)})),friends:Nd(d,g).filter(e=>e.isFriend&&e.conversationId).map(e=>({conversationId:e.conversationId,title:e.displayName,subtitle:o(e.statusKey,{name:e.participantName}),avatar:S(e.avatar),avatarKind:e.isBot?`bot`:`user`})),groups:Pd(d,g).filter(e=>e.member&&e.conversationId).map(e=>({conversationId:e.conversationId,title:e.name,subtitle:o(`sandbox.chat.groupSubtitle`,{id:e.id,count:e.members.length}),avatar:S(e.avatar),avatarKind:`group`}))}),[d,u.conversations,g,S,o]),se=u.workspace.chatLunaStates.filter(({conversationId:e})=>e===f?.id);e.useEffect(()=>{E(``),O(``),A(Bf()),M(!1),ee(Pf()),L(!1)},[f?.id]),e.useEffect(()=>{let e=e=>{e.key!==`Escape`||!k.active||j||(e.preventDefault(),A(Bf()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[k.active,j]);let ce=e=>w.current?.insertMention({id:e,name:ae.find(t=>t.id===e)?.name??v[e]??e});e.useEffect(()=>{i&&(i.current=ce)});let le={messageCapabilities:z},ue=R.find(({id:e})=>e===T),de=f?.id,fe=async(e,t)=>{let n=await Ff({input:e,load:e=>s.getForwardMessage(e)});n&&ee(e=>Nf(e,n,t))},pe=f?.title??p?.name??m?.name??f?.id??o(`sandbox.chat.pick`),me=p?.name??m?.name??``,he=f?.kind===`instance`?`${me} · `:``,ge=p?`${he}${o(`sandbox.chat.groupSubtitle`,{id:p.id,count:p.members.length})}`:h?`${he}${o(`sandbox.chat.botSubtitle`)}`:m?`${he}${o(`sandbox.chat.friendSubtitle`)}`:o(`sandbox.chat.none`),_e=p?`group`:h?`bot`:`user`;return x(`main`,{className:U(`sandbox-chat-pane flex min-h-0 min-w-0 flex-1 flex-col bg-background`,a),children:[x(`header`,{className:`sandbox-chat-header flex h-14 shrink-0 items-center gap-2 border-b border-border px-3`,children:[r&&b(G,{variant:`ghost`,size:`icon-sm`,"aria-label":o(`sandbox.chat.back`),onClick:r,children:b(bn,{})}),x(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2.5 rounded-lg px-1 py-1 text-left hover:bg-accent/60 disabled:hover:bg-transparent`,disabled:!p&&!m,"aria-label":o(`sandbox.chat.viewProfileOf`,{name:pe}),onClick:e=>{let t={x:e.clientX,y:e.clientY};p?l.openGroupProfile(p.id,t):m&&l.openProfile(m.id,t)},children:[b(Hf,{kind:_e,name:pe,src:S(p?.avatar??m?.avatar),className:`size-8`}),x(`span`,{className:`flex min-w-0 flex-col`,children:[b(`strong`,{className:`truncate text-sm font-medium`,children:pe}),b(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:ge})]})]}),x(`div`,{className:`ml-auto flex min-w-0 items-center gap-1`,children:[ne&&f?b(Ev,{adapter:{conversationId:de,search:e=>s.searchConversationMessages(e),isLoaded:e=>Kd(s.snapshot??d,de).some(({id:t})=>t===e),canLoadMore:()=>!!kv(s,de)?.hasMoreMessages,oldestLoadedId:()=>Kd(s.snapshot??d,de)[0]?.id,loadMore:()=>de?s.loadEarlierMessages(de):Promise.resolve(),reveal:e=>C.current?.revealMessage(e)??!1},onClose:()=>L(!1)}):b(G,{variant:`ghost`,size:`icon`,disabled:!f,"aria-label":o(`sandbox.search.label`),onClick:()=>{A(Bf()),L(!0)},children:b(er,{})}),n&&b(G,{variant:`ghost`,size:`icon`,"aria-pressed":t,"aria-label":o(t?`sandbox.details.close`:`sandbox.details.open`),onClick:n,children:b(An,{})})]})]}),f?b(y,{children:x(`div`,{className:`sandbox-chat-stage relative flex min-h-0 flex-1 flex-col`,children:[b(vv,{ref:C,bottomSpace:k.active?Dv:I,messages:R,chatLunaStates:se,replyMessages:re,forwardPreviews:ie,capabilities:z,friendMenuStates:B,hasMoreMessages:!!f.hasMoreMessages,scrollKey:`${s.spaceId??`main`}:${f.id}`,selectionMode:k.active,selectedIds:[...k.messageIds],onReply:e=>{E(e),requestAnimationFrame(()=>w.current?.focus())},onBranch:e=>c(o(`sandbox.error.branch`),()=>s.branchConversationInstance({conversationId:f.id,messageId:e})),onRecall:e=>c(o(`sandbox.error.recall`),()=>s.recallMessage({conversationId:f.id,messageId:e})),onReact:(e,t,n)=>c(o(`sandbox.error.react`),()=>s.setMessageReaction({conversationId:f.id,messageId:e,emojiId:t,enabled:n})),onOpenReactionPicker:e=>!k.active&&O(e),onEnterSelection:e=>{let t=Rf(e,le);t&&(E(``),L(!1),A(t))},onToggleSelection:e=>A(t=>zf(t,e,le)),onOpenForward:e=>void fe(e,`replace`),onOpenImage:F,onLoadHistory:()=>s.loadEarlierMessages(f.id),onClearConversation:()=>c(o(`sandbox.error.clear`),()=>s.clearConversationMessages({conversationId:f.id})),onMention:ce}),!k.active&&b(f_,{ref:w,replyingTo:ue?{id:ue.id,authorName:v[ue.authorId]??ue.authorId,content:sf(ue.content,v)}:void 0,mentionCandidates:ae,onClearReply:()=>E(``),onOpenImage:F,onSpaceChange:te,onSend:async e=>{e.media?.length?await s.sendMediaMessage({conversationId:e.conversationId,media:e.media,content:e.content||void 0,replyToMessageId:e.replyToMessageId}):await s.sendMessage({conversationId:e.conversationId,content:e.content,replyToMessageId:e.replyToMessageId})}}),k.active&&x(`div`,{role:`toolbar`,"aria-label":o(`sandbox.chat.selectionToolbar`),className:`sandbox-selection-bar`,children:[b(`strong`,{className:`text-[13px] font-medium`,children:o(`sandbox.chat.selected`,{count:k.messageIds.length})}),x(`div`,{className:`flex gap-2`,children:[b(G,{variant:`outline`,onClick:()=>A(Bf()),children:o(`sandbox.common.cancel`)}),x(G,{disabled:!k.messageIds.length,onClick:()=>M(!0),children:[b(rr,{}),o(`sandbox.forward.send`)]})]})]})]})}):b(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:o(`sandbox.chat.pick`)}),b(E_,{open:!!D,onOpenChange:e=>!e&&O(``),onSelect:e=>{f&&D&&c(o(`sandbox.error.react`),()=>s.setMessageReaction({conversationId:f.id,messageId:D,emojiId:e,enabled:!0}))}}),b(j_,{open:j,targets:oe,onOpenChange:M,onConfirm:async e=>{let t=Vf(k,e,le);if(t.kind===`reject`)throw Error(o(`sandbox.forward.noSelectable`));await s.sendForwardMessage({conversationId:e,messageIds:[...t.messageIds]}),A(Bf())}}),b(M_,{stack:N,imageOpen:!!P,onCloseFrom:e=>ee(t=>e?t.slice(0,e):Pf()),onOpenForward:e=>void fe({forwardId:e},`push`),onOpenImage:F}),P&&b(L_,{url:P,onClose:()=>F(``)})]})}function kv(e,t){let n=e.snapshot;if(!(!n||!t))return[...n.conversations,...n.conversationInstances??[]].find(({id:e})=>e===t)}function Av({request:e,onClose:t}){let n=J(),r=D_(e);return b(Ur,{open:!!e,onOpenChange:e=>!e&&t(),children:x(Kr,{children:[x(qr,{children:[b(Yr,{children:r?.title}),b(Xr,{children:r?.description})]}),x(Jr,{children:[b(Qr,{children:n(`sandbox.common.cancel`)}),b(Zr,{variant:`destructive`,onClick:()=>{t(),e?.onConfirm()},children:r?.action})]})]})})}var jv=`chatluna.onebot-sandbox.details-layout`,Mv=`announcements`,Nv=`members`;function Pv(){let e=z(jv);if(!e||typeof e!=`object`)return;let t=e,n=t[Mv],r=t[Nv];if(typeof n==`number`&&typeof r==`number`)return{[Mv]:n,[Nv]:r}}function Fv({onClose:t,onMention:n,className:r}){let i=J(),{store:a,dialogs:o}=Jd(),{group:s,conversation:c,participants:l}=Yd(),[u,d]=e.useState(``),[f,p]=e.useState(!1),[m,h]=e.useState(``),[g,_]=e.useState(!1),[v,y]=e.useState(``),[S,C]=e.useState(),[w,T]=e.useState(``),[E]=e.useState(Pv);e.useEffect(()=>{d(``),p(!1),h(``),y(``),T(``)},[c?.id]);let D=(e,t)=>$_({card:t},l[e]?.name??e),O=u.trim().toLowerCase(),k=s?.members.filter(e=>!O||D(e.participantId,e.card).toLowerCase().includes(O)||e.participantId.includes(O))??[],A=async e=>{e.preventDefault();let t=m.trim();if(!(!s||!t||g)){_(!0),T(``);try{await a.setGroupAnnouncement({groupId:s.id,content:t}),h(``),p(!1)}catch(e){T(zd(e,i(`sandbox.details.publishFailed`)))}finally{_(!1)}}},j=async e=>{if(!(!s||v)){y(e),T(``);try{await a.deleteGroupAnnouncement({groupId:s.id,announcementId:e})}catch(e){T(zd(e,i(`sandbox.details.deleteFailed`)))}finally{y(``)}}};if(!s)return null;let M=i(`sandbox.details.group`);return x(`aside`,{className:U(`flex min-h-0 w-72 shrink-0 flex-col border-l border-border bg-sidebar/40`,r),"aria-label":M,children:[x(`header`,{className:`flex h-14 shrink-0 items-center justify-between border-b border-border px-4`,children:[b(`strong`,{className:`text-sm font-medium`,children:M}),b(G,{variant:`ghost`,size:`icon-sm`,"aria-label":i(`sandbox.details.close`),onClick:t,children:b(mr,{})})]}),x(td,{orientation:`vertical`,className:`min-h-0 flex-1`,defaultLayout:E,onLayoutChanged:e=>B(jv,e),children:[x(nd,{id:Mv,defaultSize:`40`,minSize:96,maxSize:`75`,className:`flex min-h-0 flex-col gap-2 p-4`,style:{overflow:`hidden`},children:[x(`div`,{className:`flex items-center justify-between`,children:[b(`h3`,{className:`text-[13px] font-medium`,children:i(`sandbox.details.announcements`)}),b(G,{variant:`ghost`,size:`icon-xs`,"aria-label":i(f?`sandbox.details.cancelAnnouncement`:`sandbox.details.addAnnouncement`),onClick:()=>{p(e=>!e),h(``),T(``)},children:b(Xn,{className:U(`transition-transform duration-200 ease-spring`,f&&`rotate-45`)})})]}),x(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto`,children:[w&&b(`span`,{role:`alert`,className:`text-xs text-destructive`,children:w}),f&&x(`form`,{className:`flex shrink-0 flex-col gap-2`,onSubmit:A,children:[b(Dr,{rows:3,value:m,placeholder:i(`sandbox.details.announcementPlaceholder`),onChange:e=>h(e.target.value)}),b(G,{type:`submit`,size:`sm`,className:`self-end`,disabled:g||!m.trim(),children:i(g?`sandbox.details.publishing`:`sandbox.details.publish`)})]}),!s.announcements.length&&b(`p`,{className:`py-2 text-xs text-muted-foreground`,children:i(`sandbox.details.noAnnouncement`)}),s.announcements.map(e=>x(`article`,{className:`group/notice relative rounded-lg bg-muted/60 p-2.5 pr-8`,children:[b(`p`,{className:`text-xs leading-5 whitespace-pre-wrap`,children:e.content}),x(`time`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:[l[e.authorId]?.name??e.authorId,` · `,new Intl.DateTimeFormat(void 0,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e.createdAt))]}),b(G,{variant:`ghost`,size:`icon-xs`,className:`absolute top-1.5 right-1.5 opacity-0 group-hover/notice:opacity-100 focus-visible:opacity-100`,disabled:v===e.id,"aria-label":i(`sandbox.details.deleteAnnouncement`,{content:e.content}),onClick:()=>C({title:i(`sandbox.details.deleteAnnouncementTitle`),description:i(`sandbox.details.deleteAnnouncementDescription`,{content:e.content}),action:i(`sandbox.common.delete`),onConfirm:()=>void j(e.id)}),children:b(or,{})})]},e.id))]})]}),b(rd,{"aria-label":i(`sandbox.details.resize`)}),x(nd,{id:Nv,minSize:160,className:`flex min-h-0 flex-col gap-2 p-4`,style:{overflow:`hidden`},children:[b(`h3`,{className:`text-[13px] font-medium`,children:i(`sandbox.details.members`,{count:s.members.length})}),b(Or,{type:`search`,className:`sandbox-search-input h-8`,value:u,placeholder:i(`sandbox.details.memberSearch`),onChange:e=>d(e.target.value)}),x(`div`,{className:`-mx-2 flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto`,children:[!k.length&&b(`p`,{className:`px-2 py-4 text-center text-xs text-muted-foreground`,children:i(`sandbox.details.noMember`)}),k.map(e=>x(gc,{children:[x(_c,{render:b(`button`,{type:`button`,className:`flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left hover:bg-accent`,onClick:t=>o.openProfile(e.participantId,{x:t.clientX,y:t.clientY})}),children:[b(Hf,{kind:l[e.participantId]?.isBot?`bot`:`user`,name:D(e.participantId,e.card),src:l[e.participantId]?.avatar,className:`size-8`}),x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[b(`strong`,{className:`truncate text-xs font-medium`,children:D(e.participantId,e.card)}),b(`small`,{className:`text-[11px] text-muted-foreground`,children:e.participantId})]}),x(`span`,{className:`flex shrink-0 gap-1`,children:[e.title&&b(`span`,{className:`sandbox-message-role-badge is-title`,children:e.title}),e.role!==`member`&&b(`span`,{className:`sandbox-message-role-badge is-${e.role}`,children:i(`sandbox.role.${e.role}`)})]})]}),b(vc,{className:`sandbox-glass`,children:b(pv,{target:e,onMention:n})})]},e.participantId))]})]})]}),b(Av,{request:S,onClose:()=>C(void 0)})]})}function Iv(e,t){if(!t)return{friends:[],groups:[]};let n=new Set(e.groups.filter(({members:e})=>e.some(({participantId:e,role:n})=>e===t&&(n===`owner`||n===`admin`))).map(({id:e})=>e));return{friends:e.requests.filter(({type:e,targetId:n})=>e===`friend`&&n===t),groups:e.requests.filter(({type:e,subType:r,groupId:i,targetId:a})=>e===`group`&&!!i&&(r===`invite`&&a===t||(r??`add`)===`add`&&n.has(i)))}}function Lv(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getMonth()+1)}/${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function Rv({requests:t}){let n=J(),{store:r}=Jd(),{participants:i,snapshot:a}=Yd(),[o,s]=e.useState(`friends`),[c,l]=e.useState(``),[u,d]=e.useState(``),f=o===`friends`?t.friends:t.groups,p=e=>a.groups.find(t=>t.id===e)?.name??n(`sandbox.notice.group`),m=e=>i[e]?.name??e,h=async(e,t)=>{l(e.id),d(``);try{await r.handleRelationshipRequest(e.id,t)}catch(e){d(zd(e,n(`sandbox.notice.failed`)))}finally{l(``)}};return x(`div`,{className:`flex max-h-96 flex-col`,children:[b(`div`,{className:`flex gap-1 border-b border-border p-1.5`,children:[`friends`,`groups`].map(e=>x(G,{variant:`ghost`,size:`sm`,className:U(`flex-1`,o===e&&`bg-accent`),onClick:()=>s(e),children:[n(`sandbox.notice.${e}`),(e===`friends`?t.friends:t.groups).length>0&&b(`span`,{className:`ml-1 rounded-full bg-destructive px-1.5 text-[10px] leading-4 text-white`,children:(e===`friends`?t.friends:t.groups).length})]},e))}),x(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-1.5`,children:[u&&b(`p`,{role:`alert`,className:`px-2 py-1 text-xs text-destructive`,children:u}),!f.length&&b(`p`,{className:`py-8 text-center text-xs text-muted-foreground`,children:n(`sandbox.notice.empty`)}),f.map(e=>x(`article`,{className:`flex items-start gap-2.5 rounded-lg p-2 hover:bg-accent/50`,children:[b(Hf,{kind:i[e.requesterId]?.isBot?`bot`:`user`,name:m(e.requesterId),src:i[e.requesterId]?.avatar,className:`size-8`}),x(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[b(`strong`,{className:`truncate text-[13px] font-medium`,children:e.type===`friend`?m(e.requesterId):p(e.groupId)}),b(`span`,{className:`truncate text-xs text-muted-foreground`,children:e.type===`friend`?n(`sandbox.notice.fromQQ`,{id:e.requesterId}):n(e.subType===`invite`?`sandbox.notice.invite`:`sandbox.notice.join`,{name:m(e.requesterId)})}),e.comment&&b(`small`,{className:`truncate text-[11px] text-muted-foreground`,children:e.comment}),b(`time`,{className:`text-[11px] text-muted-foreground`,children:Lv(e.createdAt)})]}),x(`div`,{className:`flex shrink-0 gap-1`,children:[b(G,{size:`xs`,disabled:c===e.id,onClick:()=>h(e,!0),children:n(`sandbox.notice.approve`)}),b(G,{size:`xs`,variant:`outline`,disabled:c===e.id,onClick:()=>h(e,!1),children:n(`sandbox.notice.reject`)})]})]},e.id))]})]})}function zv({onSelectConversation:t,className:n}){let r=J(),{store:i,run:a,dialogs:o}=Jd(),s=Yd(),{snapshot:c,operatorId:l,operator:u,conversation:d,group:f,resolveAvatar:p}=s,[m,h]=e.useState(`recent`),[g,_]=e.useState(``),[v,S]=e.useState({}),C=e.useMemo(()=>Of({scene:c,conversations:s.conversations,operatorId:l,resolveAvatar:p,emptyPreview:r(`sandbox.chat.emptyPreview`)}),[c,s.conversations,l,p,r]),w=Iv(c,l),T=w.friends.length+w.groups.length,E=ud(c);e.useEffect(()=>{d?.kind===`instance`&&S(e=>e[d.rootConversationId]?e:{...e,[d.rootConversationId]:!0})},[d]);let D=g.trim().toLowerCase(),O=m===`friends`?Nd(c,l).filter(({id:e,displayName:t})=>!D||e.includes(D)||t.toLowerCase().includes(D)):[],k=m===`groups`?Pd(c,l).filter(({id:e,name:t})=>!D||e.includes(D)||t.toLowerCase().includes(D)):[],A=m===`recent`?!C.length:m===`friends`?!O.length:!k.length,j=!u&&m!==`groups`,M=(e,t)=>a(e,()=>i.performFriendAction(t)),N=(e,t)=>a(e,()=>i.performGroupAction(t)),ee=[{id:`recent`,icon:wn},{id:`friends`,icon:dr},{id:`groups`,icon:fr}];return x(`aside`,{className:U(`flex min-h-0 w-72 shrink-0 flex-col border-r border-border bg-sidebar/40`,n),"aria-label":r(`sandbox.sidebar.label`),children:[x(`header`,{className:`flex items-center gap-1 px-3 pt-3 pb-2`,children:[b(Fc,{className:`min-w-0 flex-1`,value:m,onValueChange:e=>{h(e),_(``)},children:b(Rc,{className:`w-full`,"aria-label":r(`sandbox.sidebar.tabs`),children:ee.map(({id:e,icon:t})=>x(zc,{value:e,className:`gap-1 px-1.5 text-xs`,children:[b(t,{className:`size-3.5`}),r(`sandbox.sidebar.${e}`)]},e))})}),x(Lr,{children:[b(Rr,{render:x(G,{variant:`ghost`,size:`icon`,className:`relative`,"aria-label":T?r(`sandbox.notice.labelCount`,{count:T}):r(`sandbox.notice.label`),children:[b(fn,{}),T>0&&b(`span`,{className:`absolute top-1 right-1 size-2 rounded-full bg-destructive`})]})}),b(zr,{align:`end`,className:`sandbox-glass w-80 p-0`,children:b(Rv,{requests:w})})]})]}),m!==`recent`&&b(`div`,{className:`px-3 pb-2`,children:x(`div`,{className:`relative`,children:[b(er,{className:`pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),b(Or,{type:`search`,className:`sandbox-search-input h-8 pl-8!`,value:g,autoComplete:`off`,"aria-label":r(`sandbox.sidebar.search`),placeholder:r(m===`friends`?`sandbox.sidebar.searchFriends`:`sandbox.sidebar.searchGroups`),onChange:e=>_(e.target.value)})]})}),b(wc,{className:`min-h-0 flex-1`,children:x(`div`,{className:`flex flex-col gap-0.5 px-2 pb-3`,children:[j&&b(jg,{type:`participant`,trigger:x(`button`,{type:`button`,className:`flex items-center gap-3 rounded-lg px-2 py-2 text-left transition-colors hover:bg-accent`,children:[b(`span`,{className:`flex size-9 items-center justify-center rounded-full border border-dashed border-border text-muted-foreground`,children:b(Xn,{className:`size-4`})}),x(`span`,{className:`flex min-w-0 flex-col`,children:[b(`strong`,{className:`text-[13px] font-medium`,children:r(`sandbox.create.participant`)}),b(`small`,{className:`text-xs text-muted-foreground`,children:r(`sandbox.sidebar.addAccountHint`)})]})]})}),m===`groups`&&b(jg,{type:`group`,operator:u,bots:E,trigger:x(`button`,{type:`button`,className:`flex items-center gap-3 rounded-lg px-2 py-2 text-left transition-colors hover:bg-accent`,children:[b(`span`,{className:`flex size-9 items-center justify-center rounded-full border border-dashed border-border text-muted-foreground`,children:b(Xn,{className:`size-4`})}),x(`span`,{className:`flex min-w-0 flex-col`,children:[b(`strong`,{className:`text-[13px] font-medium`,children:r(`sandbox.sidebar.addGroup`)}),b(`small`,{className:`text-xs text-muted-foreground`,children:r(`sandbox.sidebar.addGroupHint`)})]})]})}),m===`recent`&&C.map(e=>b(Vv,{node:e,activeId:d?.id,expanded:!!v[e.id],onToggle:()=>S(t=>({...t,[e.id]:!t[e.id]})),onSelect:t},e.id)),O.map(e=>x(gc,{children:[b(_c,{render:b(Bv,{kind:e.isBot?`bot`:`user`,title:e.displayName,subtitle:r(e.statusKey,{name:e.participantName}),avatar:p(e.avatar),active:!!e.conversationId&&e.conversationId===d?.id,status:r(e.isFriend?`sandbox.sidebar.added`:e.pendingOutgoing||e.pendingIncoming?`sandbox.sidebar.pending`:`sandbox.sidebar.notAdded`),onClick:n=>e.conversationId?t(e.conversationId):o.openProfile(e.id,{x:n.clientX,y:n.clientY})})}),x(vc,{className:`sandbox-glass`,children:[x(q,{onClick:()=>o.openProfile(e.id),children:[b(zn,{}),r(`sandbox.menu.profile`)]}),!e.isFriend&&!e.pendingOutgoing&&!e.pendingIncoming&&x(q,{onClick:()=>M(r(`sandbox.error.friend`),{action:`request`,targetId:e.id,comment:r(`sandbox.friend.requestComment`)}),children:[b(ur,{}),r(`sandbox.menu.requestFriend`),b(a_,{})]}),e.pendingOutgoing&&x(q,{disabled:!0,children:[b(wn,{}),r(`sandbox.menu.waitingPeer`)]}),e.pendingIncoming&&x(q,{disabled:!0,children:[b(fn,{}),r(`sandbox.menu.handleInNotice`)]}),e.isFriend&&x(y,{children:[x(q,{onClick:()=>o.openRemark(e.id),children:[b(ar,{}),r(`sandbox.menu.remark`),b(a_,{})]}),x(q,{variant:`destructive`,onClick:()=>M(r(`sandbox.error.friend`),{action:`delete`,targetId:e.id}),children:[b(lr,{}),r(`sandbox.menu.deleteFriend`)]})]}),e.isFriend&&f&&!f.members.some(({participantId:t})=>t===e.id)&&x(q,{onClick:()=>N(r(`sandbox.error.group`),{action:`invite`,groupId:f.id,targetId:e.id}),children:[b(ur,{}),r(`sandbox.menu.inviteToGroup`),b(a_,{})]}),b(Sc,{}),b(Wv,{target:{type:e.isBot?`bot`:`user`,id:e.id}})]})]},e.id)),k.map(e=>x(gc,{children:[b(_c,{render:b(Bv,{kind:`group`,title:e.name,subtitle:r(`sandbox.chat.groupSubtitle`,{id:e.id,count:e.members.length}),avatar:p(e.avatar),active:!!e.conversationId&&e.conversationId===d?.id,status:r(e.member?`sandbox.sidebar.joined`:e.pending?`sandbox.sidebar.pending`:`sandbox.sidebar.notJoined`),onClick:()=>e.conversationId&&t(e.conversationId)})}),x(vc,{className:`sandbox-glass`,children:[!e.member&&!e.pending&&x(q,{onClick:()=>N(r(`sandbox.error.group`),{action:`request-join`,groupId:e.id,comment:r(`sandbox.group.requestComment`)}),children:[b(ur,{}),r(`sandbox.menu.requestJoin`),b(a_,{})]}),!e.member&&e.pending&&x(q,{disabled:!0,children:[b(wn,{}),r(`sandbox.menu.waitingAdmin`)]}),e.member&&b(Uv,{groupId:e.id,role:e.member.role}),b(Sc,{}),b(Wv,{target:{type:`group`,id:e.id}})]})]},e.id)),A&&b(`p`,{className:`px-3 py-8 text-center text-xs text-muted-foreground`,children:r(D?`sandbox.sidebar.empty`:`sandbox.sidebar.none.${m}`)})]})})]})}var Bv=e.forwardRef(function({kind:e,title:t,subtitle:n,avatar:r,status:i,time:a,active:o,className:s,...c},l){return x(`button`,{ref:l,type:`button`,className:U(`flex w-full items-center gap-3 rounded-lg px-2 py-2 text-left transition-colors hover:bg-accent`,o&&`bg-accent`,s),"aria-current":o||void 0,...c,children:[b(Hf,{kind:e,name:t,src:r}),x(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[x(`span`,{className:`flex items-center gap-2`,children:[b(`strong`,{className:`truncate text-[13px] font-medium`,children:t}),a&&b(`time`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground`,children:a})]}),b(`small`,{className:`truncate text-xs text-muted-foreground`,children:n})]}),i&&b(ei,{variant:`outline`,className:`shrink-0 text-[10px] text-muted-foreground`,children:i})]})});function Vv({node:e,activeId:t,expanded:n,onToggle:r,onSelect:i}){let a=J(),{store:o,run:s,dialogs:c}=Jd(),l=e.children.length;return x(`div`,{className:`flex flex-col`,children:[x(gc,{children:[b(_c,{render:x(`div`,{className:`group relative`,children:[b(Bv,{kind:e.avatarKind,title:e.title,subtitle:e.preview,avatar:e.avatar,time:e.time,active:e.id===t,className:l?`pr-12!`:void 0,onClick:()=>i(e.id)}),l>0&&x(`button`,{type:`button`,className:`absolute top-1/2 right-2 flex h-6 -translate-y-1/2 items-center gap-0.5 rounded-md px-1.5 text-[11px] text-muted-foreground hover:bg-background hover:text-foreground`,"aria-expanded":n,"aria-label":a(n?`sandbox.sidebar.collapse`:`sandbox.sidebar.expand`,{count:l}),onClick:e=>{e.stopPropagation(),r()},children:[l,b(yn,{className:U(`size-3.5 transition-transform duration-200 ease-spring`,n&&`rotate-180`)})]})]})}),x(vc,{className:`sandbox-glass`,children:[e.groupId&&b(Uv,{groupId:e.groupId,role:e.actorRole}),x(q,{onClick:()=>s(a(`sandbox.error.createConversation`),()=>o.createConversationInstance(e.id)),children:[b(Xn,{}),a(`sandbox.menu.newConversation`)]}),b(Sc,{}),b(Wv,{target:e.entityTarget})]})]}),n&&b(`div`,{className:`ml-6 flex flex-col gap-0.5 border-l border-border pl-2`,children:e.children.map(e=>x(gc,{children:[b(_c,{render:b(Hv,{row:e,active:e.id===t,onClick:()=>i(e.id)})}),x(vc,{className:`sandbox-glass`,children:[x(q,{onClick:()=>c.openConversationRename(e.id),children:[b(Jn,{}),a(`sandbox.menu.renameConversation`)]}),x(q,{variant:`destructive`,onClick:()=>s(a(`sandbox.error.deleteConversation`),()=>o.deleteConversationInstance(e.id)),children:[b(or,{}),a(`sandbox.menu.deleteConversation`)]})]})]},e.id))})]})}var Hv=e.forwardRef(function({row:e,active:t,className:n,...r},i){return x(`button`,{ref:i,type:`button`,className:U(`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent`,t&&`bg-accent`,n),"aria-current":t||void 0,...r,children:[b(Gn,{className:`size-3.5 shrink-0 text-muted-foreground`}),x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[x(`span`,{className:`flex items-center gap-2`,children:[b(`strong`,{className:`truncate text-xs font-medium`,children:e.title}),e.time&&b(`time`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground`,children:e.time})]}),b(`small`,{className:`truncate text-[11px] text-muted-foreground`,children:e.preview})]})]})});function Uv({groupId:e,role:t}){let n=J(),{store:r,run:i,dialogs:a}=Jd();return x(y,{children:[x(q,{disabled:t===`member`,onClick:()=>a.openGroupAction(`name`,``,e),children:[b(Jn,{}),n(t===`member`?`sandbox.menu.renameGroupNeedAdmin`:`sandbox.menu.renameGroup`)]}),x(q,{disabled:t===`owner`,variant:`destructive`,onClick:()=>i(n(`sandbox.error.group`),()=>r.performGroupAction({action:`leave`,groupId:e})),children:[b(lr,{}),n(t===`owner`?`sandbox.menu.ownerCannotLeave`:`sandbox.menu.leaveGroup`)]})]})}function Wv({target:e}){let t=J(),{dialogs:n}=Jd(),r=t(`sandbox.kind.${e.type}`);return x(y,{children:[x(q,{onClick:()=>n.openEntity(`edit`,e),children:[b(Jn,{}),t(`sandbox.menu.editEntity`,{kind:r}),b(a_,{})]}),x(q,{variant:`destructive`,onClick:()=>n.openEntity(`delete`,e),children:[b(or,{}),t(`sandbox.menu.deleteEntity`,{kind:r}),b(a_,{})]})]})}var Gv=640;function Kv(){let{store:t}=Jd(),{workspace:n,group:r}=Yd(),[i,a]=od(),o=a>=1132,s=a>0&&a<Gv,[c,l]=e.useState(`auto`),[u,d]=e.useState(`chat`),f=u===`details`&&!r?`chat`:u,p=!!r&&(c===`auto`?o:c===`open`);e.useEffect(()=>l(`auto`),[o]);let m=()=>{if(s)return d(e=>e===`details`?`chat`:`details`);l(p?`closed`:`open`)},h=e.useRef(()=>{});return x(`div`,{ref:i,className:`sandbox-webqq flex min-h-0 min-w-0 flex-1 border-t border-border`,style:{"--sandbox-accent":n.appearance.sandboxAccentColor},children:[b(zv,{className:U(s&&f!==`contacts`&&`hidden`,s&&`w-full`),onSelectConversation:e=>{t.selectConversation(e),s&&d(`chat`)}}),b(Ov,{className:U(s&&f!==`chat`&&`hidden`,!s&&!o&&p&&`hidden`),detailsVisible:s?f===`details`:p,onToggleDetails:r?m:void 0,onBack:s?()=>d(`contacts`):void 0,mentionBridge:h}),(s?f===`details`:p)&&b(Fv,{className:U(s&&`w-full border-l-0`,!s&&!o&&`flex-1`),onClose:s?()=>d(`chat`):()=>l(`closed`),onMention:e=>h.current(e)})]})}var qv=[`read`,`interact`,`manage`,`debug`];function Jv(t,n){let[r,i]=e.useState(),[a,o]=e.useState(!1),[s,c]=e.useState(``),l=e.useRef(t);return l.current=t,{catalog:r,loading:a,error:s,load:e.useCallback(async()=>{o(!0),c(``);try{i(await l.current())}catch(e){c(zd(e,n))}finally{o(!1)}},[n])}}function Yv({loading:e,error:t,onRetry:n,unavailable:r}){let i=J();return e?b(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:b(Nc,{})}):t?x(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-8 text-xs`,children:[b(`p`,{role:`alert`,className:`text-destructive`,children:t}),b(G,{size:`sm`,variant:`outline`,onClick:n,children:i(`sandbox.common.retry`)})]}):b(`p`,{className:`p-8 text-center text-xs text-muted-foreground`,children:r})}function Xv({items:e}){return b(`div`,{className:`grid grid-cols-3 gap-2`,children:e.map(e=>x(`article`,{className:`flex flex-col gap-0.5 rounded-lg bg-muted/50 px-3 py-2.5`,children:[b(`strong`,{className:`text-base font-semibold tabular-nums`,children:e.value}),b(`span`,{className:`text-[11px] text-muted-foreground`,children:e.label})]},e.label))})}function Zv({value:e,onChange:t,placeholder:n}){return x(`div`,{className:`relative flex-1`,children:[b(er,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground`}),b(Or,{type:`search`,className:`sandbox-search-input h-8 pl-8!`,value:e,placeholder:n,"aria-label":n,onChange:e=>t(e.target.value)})]})}function Qv({active:e,onClick:t,children:n}){return b(G,{size:`sm`,variant:e?`secondary`:`ghost`,"aria-pressed":e,onClick:t,children:n})}function $v({catalog:t,loading:n,error:r,onRetry:i}){let a=J(),[o,s]=e.useState(``),[c,l]=e.useState(`tools`),[u,d]=e.useState(`all`);if(!t||n||r)return b(Yv,{loading:n,error:r,onRetry:i,unavailable:a(`sandbox.env.mcpUnavailable`)});let f=o.trim().toLocaleLowerCase(),p=e=>a(`sandbox.scope.${e}`),m=t.tools.filter(e=>(u===`all`||e.scope===u)&&(!f||[e.name,e.description,p(e.scope)].some(e=>e.toLocaleLowerCase().includes(f)))),h=t.resources.filter(e=>!f||[e.name,e.uri,e.mimeType].some(e=>e.toLocaleLowerCase().includes(f))),g=t.serverCapabilities,_=t.endpoint,v=_&&JSON.stringify({mcpServers:{"onebot-sandbox":{type:`streamable-http`,url:_.url,headers:{Authorization:`Bearer <${a(`sandbox.env.http.tokenPlaceholder`)}>`}}}},null,2);return x(`div`,{className:`flex flex-col gap-4 p-4`,children:[_&&!_.enabled&&b(`p`,{className:`rounded-lg bg-amber-500/10 p-3 text-xs leading-5 text-amber-800 dark:text-amber-300`,children:a(`sandbox.env.mcp.disabledNotice`)}),_&&x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs font-medium`,children:a(`sandbox.env.mcp.connect`)}),x(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:[a(`sandbox.env.mcp.connectBefore`),(e=>b(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[11px]`,children:e}))(_.url),a(`sandbox.env.mcp.connectAfter`)]}),b(`pre`,{className:`overflow-auto rounded-lg bg-muted/50 p-3 font-mono text-[11px] leading-5`,children:v})]}),b(Xv,{items:[{value:t.tools.length,label:a(`sandbox.env.mcp.tools`)},{value:t.resources.length,label:a(`sandbox.env.mcp.resources`)},{value:t.scopes.length,label:a(`sandbox.env.mcp.scopes`)}]}),x(`div`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[b(`span`,{className:`mr-1 text-muted-foreground`,children:a(`sandbox.env.mcp.serverCapabilities`)}),b(ei,{variant:g.tools?`secondary`:`outline`,children:a(`sandbox.env.mcp.capability.tools`)}),b(ei,{variant:g.resources?`secondary`:`outline`,children:a(`sandbox.env.mcp.capability.resources`)}),b(ei,{variant:g.prompts?`secondary`:`outline`,children:g.prompts?a(`sandbox.env.mcp.capability.prompts`):a(`sandbox.env.mcp.promptsMissing`)})]}),x(`div`,{className:`flex flex-wrap items-center gap-2`,children:[b(Zv,{value:o,onChange:s,placeholder:a(`sandbox.env.mcp.search`)}),x(`div`,{className:`flex gap-0.5`,children:[b(Qv,{active:c===`tools`,onClick:()=>l(`tools`),children:a(`sandbox.env.mcp.tools`)}),b(Qv,{active:c===`resources`,onClick:()=>l(`resources`),children:a(`sandbox.env.mcp.resources`)})]})]}),c===`tools`?x(y,{children:[x(`div`,{className:`flex flex-wrap gap-0.5`,"aria-label":a(`sandbox.env.mcp.scopeFilter`),children:[b(Qv,{active:u===`all`,onClick:()=>d(`all`),children:a(`sandbox.env.mcp.allScopes`)}),qv.map(e=>b(Qv,{active:u===e,onClick:()=>d(e),children:p(e)},e))]}),x(`div`,{className:`flex flex-col gap-1.5`,children:[m.map(e=>x(fc,{className:`rounded-lg ring-1 ring-border`,children:[x(pc,{className:`group flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left hover:bg-accent/60`,children:[b(xn,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[panel-open]:rotate-90`}),x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[b(`strong`,{className:`truncate font-mono text-xs font-medium`,children:e.name}),b(`small`,{className:`line-clamp-2 text-[11px] text-muted-foreground`,children:e.description})]}),b(ei,{variant:`outline`,children:p(e.scope)})]}),x(mc,{className:`flex flex-col gap-1.5 px-3 pb-3`,children:[b(`span`,{className:`text-[11px] text-muted-foreground`,children:a(`sandbox.env.mcp.inputSchema`)}),b(`pre`,{className:`max-h-80 overflow-auto rounded-md bg-muted/50 p-2.5 font-mono text-[11px] leading-5`,children:JSON.stringify(e.inputSchema,null,2)})]})]},e.name)),!m.length&&b(`p`,{className:`py-6 text-center text-xs text-muted-foreground`,children:a(`sandbox.env.mcp.noTool`)})]})]}):x(`div`,{className:`flex flex-col gap-1.5`,children:[h.map(e=>x(`article`,{className:`flex items-center gap-3 rounded-lg px-3 py-2.5 ring-1 ring-border`,children:[x(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[b(`strong`,{className:`truncate text-xs font-medium`,children:e.name}),b(`small`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:e.uri})]}),x(`span`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:[e.requiredScopes.map(e=>b(ei,{variant:`outline`,children:p(e)},e)),b(ei,{variant:`secondary`,children:e.mimeType})]})]},e.uri)),!h.length&&b(`p`,{className:`py-6 text-center text-xs text-muted-foreground`,children:a(`sandbox.env.mcp.noResource`)})]})]})}function ey({catalog:t,loading:n,error:r,onRetry:i}){let a=J(),[o,s]=e.useState(``);if(!t||n||r)return b(Yv,{loading:n,error:r,onRetry:i,unavailable:a(`sandbox.env.httpUnavailable`)});let c=t.maxBodyBytes/1048576,l=`${Number.isInteger(c)?c:c.toFixed(1)} MiB`,u=t.routes.find(e=>e.kind===`list-tools`),d=u?[`TOKEN=<${a(`sandbox.env.http.tokenPlaceholder`)}>`,``,`# ${a(`sandbox.env.http.exampleList`)}`,`curl -s -H "authorization: Bearer $TOKEN" "${t.baseUrl}${u.target}"`,``,`# ${a(`sandbox.env.http.exampleCall`)}`,`curl -s -X POST -H "authorization: Bearer $TOKEN" "${t.baseUrl}${u.target}/get_server_info"`].join(`
|
|
3
|
-
`):``,f=o.trim().toLocaleLowerCase(),p=new Map;for(let{code:e,status:n}of t.errorStatuses)f&&!e.includes(f)&&!String(n).includes(f)||p.set(n,[...p.get(n)??[],e]);let m=[...p].sort(([e],[t])=>e-t),h=e=>b(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[11px]`,children:e});return x(`div`,{className:`flex flex-col gap-4 p-4`,children:[!t.enabled&&b(`p`,{className:`rounded-lg bg-amber-500/10 p-3 text-xs leading-5 text-amber-800 dark:text-amber-300`,children:a(`sandbox.env.http.disabledNotice`)}),b(Xv,{items:[{value:t.routes.length,label:a(`sandbox.env.http.routes`)},{value:t.errorStatuses.length,label:a(`sandbox.env.http.errorMappings`)},{value:l,label:a(`sandbox.env.http.bodyLimit`)}]}),x(`div`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[b(`span`,{className:`mr-1 text-muted-foreground`,children:a(`sandbox.env.http.protocol`)}),b(ei,{variant:t.enabled?`secondary`:`outline`,children:a(t.enabled?`sandbox.env.enabled`:`sandbox.env.http.closed`)}),b(ei,{variant:`outline`,children:a(`sandbox.env.http.basePath`,{path:t.basePath})}),b(ei,{variant:`outline`,children:a(`sandbox.env.http.version`,{version:t.version})})]}),x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs font-medium`,children:a(`sandbox.env.http.auth`)}),x(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:[a(`sandbox.env.http.authBefore`),h(t.baseUrl),a(`sandbox.env.http.authMiddle`),h(`Authorization`),a(`sandbox.env.http.authCarry`),h(`Bearer <${a(`sandbox.env.http.tokenPlaceholder`)}>`),a(`sandbox.env.http.authAfter`)]}),d&&b(`pre`,{className:`overflow-auto rounded-lg bg-muted/50 p-3 font-mono text-[11px] leading-5`,children:d})]}),x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs font-medium`,children:a(`sandbox.env.http.routes`)}),t.routes.map(e=>x(`article`,{className:`flex flex-col gap-1 rounded-lg px-3 py-2.5 ring-1 ring-border`,children:[x(`p`,{className:`flex min-w-0 items-center gap-2`,children:[b(ei,{variant:`secondary`,className:`font-mono`,children:e.method}),b(`code`,{className:`truncate font-mono text-xs`,children:e.target})]}),b(`small`,{className:`text-[11px] text-muted-foreground`,children:e.summary})]},e.kind))]}),x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs font-medium`,children:a(`sandbox.env.http.statusTitle`)}),x(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:[a(`sandbox.env.http.statusBefore`),h(`Retry-After`),a(`sandbox.env.http.statusAfter`)]}),b(Zv,{value:o,onChange:s,placeholder:a(`sandbox.env.http.statusSearch`)}),m.map(([e,t])=>x(`article`,{className:`flex items-start gap-3 rounded-lg px-3 py-2 ring-1 ring-border`,children:[b(ei,{variant:e>=500?`destructive`:`outline`,className:`font-mono`,children:e}),b(`span`,{className:`flex min-w-0 flex-wrap gap-1`,children:t.map(e=>b(`code`,{className:U(`rounded bg-muted px-1 py-0.5 font-mono text-[11px]`),children:e},e))})]},e)),!m.length&&b(`p`,{className:`py-4 text-center text-xs text-muted-foreground`,children:a(`sandbox.env.http.noStatus`)})]})]})}function ty(t,n){let r=J(),[i,a]=e.useState(!1);return{requestClose:()=>{t?a(!0):n()},confirm:b(Ur,{open:i,onOpenChange:a,children:x(Kr,{children:[x(qr,{children:[b(Yr,{children:r(`sandbox.discard.title`)}),b(Xr,{children:r(`sandbox.discard.description`)})]}),x(Jr,{children:[b(Qr,{children:r(`sandbox.discard.keep`)}),b(Zr,{variant:`destructive`,onClick:()=>{a(!1),n()},children:r(`sandbox.discard.confirm`)})]})]})})}}function ny(){let t=J(),[n,r]=e.useState([]),[i,a]=e.useState(``),[o,s]=e.useState(),[c,l]=e.useState(``),[u,d]=e.useState(!1),[f,p]=e.useState(``),[m,h]=e.useState(),g=e.useCallback(async()=>{try{r(await Id(`onebot-sandbox.test-credentials`,void 0)),a(``)}catch(e){a(zd(e,t(`sandbox.credential.loadFailed`)))}},[t]);e.useEffect(()=>{g()},[g]);let _=async(e,t)=>{d(!0);try{await t()}catch(t){l(zd(t,e))}finally{d(!1)}},v=async()=>{if(!o)return;if(l(``),!o.name.trim()||!o.scopes.length){l(t(`sandbox.credential.invalid`));return}let e=o.editing;e?await _(t(`sandbox.credential.saveFailed`),async()=>{await Id(`onebot-sandbox.update-test-credential`,{id:e.id,name:o.name,scopes:o.scopes}),s(void 0),await g()}):await _(t(`sandbox.credential.createFailed`),async()=>{let e=await Id(`onebot-sandbox.create-test-credential`,{name:o.name,scopes:o.scopes});s(void 0),p(e.token),await g()})},y=async()=>{let e=o?.editing;e&&(l(``),await _(t(`sandbox.credential.rotateFailed`),async()=>{let t=await Id(`onebot-sandbox.rotate-test-credential-token`,{id:e.id});s(e=>e&&{...e,editing:t}),await g()}))},S=async(e,t)=>{try{await t(),await g()}catch(t){a(zd(t,e))}},C=async e=>{try{await navigator.clipboard.writeText(e),L.success(t(`sandbox.credential.copied`))}catch{L.error(t(`sandbox.credential.copyFailed`))}},w=D_(o),T=D_(m),E=D_(f||void 0)??``,D=o?.editing?{name:o.editing.name,scopes:o.editing.scopes}:{name:``,scopes:[`read`]},{requestClose:O,confirm:k}=ty(!!o&&(o.name!==D.name||[...o.scopes].sort().join()!==[...D.scopes].sort().join()),()=>s(void 0)),A=e=>e.map(e=>t(`sandbox.scope.${e}`)).join(` · `),j=e=>new Intl.DateTimeFormat(void 0,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)),M=w?.editing;return x(`div`,{className:`flex flex-col gap-3 p-4`,children:[x(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[b(`p`,{className:`max-w-xl text-xs leading-5 text-muted-foreground`,children:t(`sandbox.credential.hint`)}),x(G,{size:`sm`,onClick:()=>{l(``),s({name:``,scopes:[`read`]})},children:[b(Xn,{}),t(`sandbox.credential.create`)]})]}),i&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:i}),n.map(e=>x(`article`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg px-3 py-2.5 ring-1 ring-border`,children:[x(`button`,{type:`button`,className:`flex min-w-0 flex-col gap-0.5 text-left`,onClick:()=>{l(``),s({editing:e,name:e.name,scopes:[...e.scopes]})},children:[b(`strong`,{className:`truncate text-xs font-medium`,children:e.name}),x(`small`,{className:`text-[11px] text-muted-foreground`,children:[A(e.scopes),` · `,j(e.createdAt)]})]}),x(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[b(ei,{variant:e.enabled?`secondary`:`outline`,children:t(e.enabled?`sandbox.env.enabled`:`sandbox.env.disabled`)}),b(G,{size:`sm`,variant:`outline`,onClick:()=>{l(``),s({editing:e,name:e.name,scopes:[...e.scopes]})},children:t(`sandbox.credential.view`)}),b(G,{size:`sm`,variant:`outline`,onClick:()=>void S(t(`sandbox.common.failed`),()=>Id(`onebot-sandbox.set-test-credential-enabled`,{id:e.id,enabled:!e.enabled})),children:t(e.enabled?`sandbox.credential.disable`:`sandbox.credential.enable`)}),b(G,{size:`sm`,variant:`destructive`,onClick:()=>h(e),children:t(`sandbox.credential.revoke`)})]})]},e.id)),!n.length&&!i&&b(`p`,{className:`py-6 text-center text-xs text-muted-foreground`,children:t(`sandbox.credential.empty`)}),b(yr,{open:!!o,onOpenChange:e=>!e&&O(),children:x(Sr,{className:`flex flex-col overflow-hidden`,children:[x(Cr,{children:[b(Tr,{children:t(M?`sandbox.credential.viewTitle`:`sandbox.credential.createTitle`)}),b(Er,{children:t(M?`sandbox.credential.viewDescription`:`sandbox.credential.createDescription`)})]}),x(`div`,{className:`-mx-5 flex min-h-0 flex-col gap-4 overflow-y-auto px-5`,children:[x(`div`,{className:`flex flex-col gap-2`,children:[b(Cc,{htmlFor:`sandbox-credential-name`,children:t(`sandbox.credential.name`)}),b(Or,{id:`sandbox-credential-name`,autoComplete:`off`,value:w?.name??``,onChange:e=>s(t=>t&&{...t,name:e.target.value})})]}),x(`fieldset`,{className:`flex flex-col gap-2`,children:[b(`legend`,{className:`mb-2 text-sm font-medium`,children:t(`sandbox.credential.scopes`)}),b(`div`,{className:`grid grid-cols-2 gap-2`,children:qv.map(e=>x(`label`,{className:`flex items-center gap-2 text-sm`,children:[b(dc,{checked:w?.scopes.includes(e)??!1,onCheckedChange:t=>s(n=>n&&{...n,scopes:t===!0?[...new Set([...n.scopes,e])]:n.scopes.filter(t=>t!==e)})}),t(`sandbox.scope.${e}`)]},e))})]}),M&&x(`div`,{className:`flex flex-col gap-2`,children:[b(Cc,{children:`Token`}),M.token?x(`div`,{className:`flex items-center gap-2`,children:[b(`code`,{className:`min-w-0 flex-1 rounded-md bg-muted px-2.5 py-2 font-mono text-xs break-all`,children:M.token}),b(G,{size:`icon-sm`,variant:`ghost`,"aria-label":t(`sandbox.credential.copy`),onClick:()=>void C(M.token),children:b(Tn,{})})]}):b(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:t(`sandbox.credential.noPlainToken`)}),b(G,{size:`sm`,variant:`outline`,className:`self-start`,disabled:u,onClick:()=>void y(),children:t(M.token?`sandbox.credential.rotate`:`sandbox.credential.generate`)}),x(`p`,{className:`text-[11px] text-muted-foreground`,children:[t(`sandbox.credential.createdAt`,{time:j(M.createdAt)}),` · `,t(M.enabled?`sandbox.env.enabled`:`sandbox.env.disabled`)]})]}),c&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:c})]}),x(wr,{children:[b(G,{variant:`outline`,onClick:O,children:t(`sandbox.common.cancel`)}),b(G,{disabled:u,onClick:()=>void v(),children:t(M?`sandbox.common.save`:`sandbox.credential.createAction`)})]}),k]})}),b(yr,{open:!!f,onOpenChange:e=>!e&&p(``),children:x(Sr,{children:[x(Cr,{children:[b(Tr,{children:t(`sandbox.credential.tokenTitle`)}),b(Er,{children:t(`sandbox.credential.tokenDescription`)})]}),x(`div`,{className:`flex items-center gap-2`,children:[b(Or,{readOnly:!0,value:E,className:`font-mono text-xs!`}),b(G,{size:`icon-sm`,variant:`ghost`,"aria-label":t(`sandbox.credential.copy`),onClick:()=>void C(E),children:b(Tn,{})})]}),b(wr,{children:b(G,{onClick:()=>p(``),children:t(`sandbox.credential.saved`)})})]})}),b(Ur,{open:!!m,onOpenChange:e=>!e&&h(void 0),children:x(Kr,{children:[x(qr,{children:[b(Yr,{children:t(`sandbox.credential.revokeTitle`,{name:T?.name??``})}),b(Xr,{children:t(`sandbox.credential.revokeDescription`)})]}),x(Jr,{children:[b(Qr,{children:t(`sandbox.common.cancel`)}),b(Zr,{variant:`destructive`,onClick:()=>{let e=m;h(void 0),e&&S(t(`sandbox.common.failed`),()=>Id(`onebot-sandbox.revoke-test-credential`,{id:e.id}))},children:t(`sandbox.credential.revoke`)})]})]})})]})}function ry(){let[t,n]=e.useState([]),[r,i]=e.useState(``),a=e.useCallback(async()=>{try{n(await Id(`onebot-sandbox.test-spaces`,void 0)),i(``)}catch(e){i(zd(e))}},[]);return e.useEffect(()=>{a()},[a]),{spaces:t,error:r,reload:a}}function iy(e){return e}function ay(e,t=[],n=iy){return[...ud(e).map(e=>({...e,avatar:n(e.avatar),source:{type:`main`,name:`主环境`}})),...t.flatMap(e=>ud(e.snapshot).map(t=>({...t,avatar:n(t.avatar),source:{type:`test-space`,spaceId:e.id,name:e.name}})))]}function oy(e,t=[],n=iy){return{users:ld(e).map(e=>({...e,avatar:n(e.avatar)})),bots:ay(e,t,n),groups:e.groups.map(e=>({...e,avatar:n(e.avatar)}))}}var sy={users:`user`,bots:`bot`,groups:`group`};function cy(){let t=J(),{snapshot:n,resolveAvatar:r,operator:i}=Yd(),{spaces:a}=ry(),o=e.useMemo(()=>oy(n,a,r),[n,a,r]),[s,c]=e.useState(`users`),l=e.useRef(null),u=Jv(()=>Id(`onebot-sandbox.mcp-capabilities`,void 0),t(`sandbox.env.mcpFailed`)),d=Jv(()=>Id(`onebot-sandbox.http-capabilities`,void 0),t(`sandbox.env.httpFailed`)),f=u.load,p=d.load;e.useEffect(()=>{f(),p()},[f,p]);let m=[{id:`directory`,items:[{id:`users`,icon:dr,count:o.users.length},{id:`bots`,icon:pn,count:o.bots.length},{id:`groups`,icon:fr,count:o.groups.length}]},{id:`endpoint`,items:[{id:`mcp`,icon:nr,count:u.catalog?.tools.length},{id:`http`,icon:pr,count:d.catalog?.routes.length},{id:`credentials`,icon:Vn}]}],h=sy[s],g=e=>{c(e),l.current?.scrollTo({top:0})};return x(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden px-6 pt-3 pb-6 text-sm leading-5`,children:[b(`p`,{className:`text-xs text-muted-foreground`,children:t(`sandbox.env.description`)}),x(`div`,{className:`grid min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-4 md:grid-cols-[14rem_minmax(0,1fr)] md:grid-rows-1`,children:[b(`nav`,{"aria-label":t(`sandbox.env.sections`),className:`sandbox-scroll-strip flex gap-0.5 self-start overflow-x-auto rounded-xl p-1.5 ring-1 ring-border md:flex-col md:overflow-x-visible`,children:m.map((n,r)=>x(e.Fragment,{children:[r>0&&b(`div`,{role:`separator`,className:`mx-1 w-px shrink-0 bg-border md:hidden`}),b(`p`,{className:U(`hidden px-2.5 pt-1.5 pb-1 text-[11px] leading-4 font-medium text-muted-foreground md:block`,r>0&&`md:mt-2`),children:t(`sandbox.env.nav.${n.id}`)}),n.items.map(({id:e,icon:n,count:r})=>x(G,{variant:`ghost`,className:U(`shrink-0 justify-start md:w-full`,s===e&&`bg-accent text-accent-foreground`),"aria-current":s===e?`page`:void 0,onClick:()=>g(e),children:[b(n,{}),b(`span`,{children:t(`sandbox.env.section.${e}.label`)}),r!==void 0&&b(`span`,{className:U(`ml-auto pl-2 text-xs tabular-nums`,s===e?`text-foreground/70`:`text-muted-foreground`),children:r})]},e))]},n.id))}),x(`section`,{"aria-label":t(`sandbox.env.section.${s}.label`),className:`flex min-h-0 flex-col overflow-hidden rounded-xl ring-1 ring-border`,children:[x(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-border px-5 py-3.5`,children:[x(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[b(`h2`,{className:`text-sm leading-5 font-semibold`,children:t(`sandbox.env.section.${s}.label`)}),b(`p`,{className:`text-xs leading-4 text-muted-foreground`,children:t(`sandbox.env.section.${s}.description`)})]}),h&&b(jg,{type:h,operator:i,bots:ud(n),side:`bottom`,trigger:x(G,{size:`sm`,variant:`outline`,className:`shrink-0`,children:[b(Xn,{}),t(`sandbox.create.${h}`)]})},h)]}),x(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[x(`div`,{ref:l,className:`sandbox-env-scroller min-h-0 flex-1 overflow-y-auto`,children:[s===`users`&&b(ly,{icon:dr,empty:t(`sandbox.env.noUser`),children:o.users.map(e=>b(uy,{target:{type:`user`,id:e.id},avatar:b(Hf,{kind:`user`,name:e.name,src:e.avatar,className:`size-10`}),title:e.name,subtitle:e.id},e.id))}),s===`bots`&&b(ly,{icon:pn,empty:t(`sandbox.env.noBot`),children:o.bots.map(e=>{let n={avatar:b(Hf,{kind:`bot`,name:e.name,src:e.avatar,className:`size-10`}),title:e.name,subtitle:e.id,meta:x(y,{children:[b(ei,{variant:`secondary`,children:Ag(e.implementation)}),b(ei,{variant:`outline`,className:`max-w-40`,children:b(`span`,{className:`truncate`,children:ad(t,e.source)})}),b(fy,{enabled:e.enabled})]})};return e.source.type===`main`?b(uy,{target:{type:`bot`,id:e.id},...n},`main:${e.id}`):b(dy,{...n},`space:${e.source.spaceId}:${e.id}`)})}),s===`groups`&&b(ly,{icon:fr,empty:t(`sandbox.env.noGroup`),children:o.groups.map(e=>b(uy,{target:{type:`group`,id:e.id},avatar:b(Hf,{kind:`group`,name:e.name,src:e.avatar,className:`size-10`}),title:e.name,subtitle:t(`sandbox.env.groupSubtitle`,{id:e.id,count:e.members.length})},e.id))}),s===`credentials`&&b(ny,{}),s===`mcp`&&b($v,{catalog:u.catalog,loading:u.loading,error:u.error,onRetry:()=>void u.load()}),s===`http`&&b(ey,{catalog:d.catalog,loading:d.loading,error:d.error,onRetry:()=>void d.load()})]}),b(G_,{target:l,className:`sandbox-env-scrollbar`})]})]})]})]})}function ly({icon:e,empty:t,children:n}){return n.length?b(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3 p-4`,children:n}):x(`div`,{className:`flex flex-col items-center gap-3 px-6 py-16 text-center`,children:[b(`span`,{className:`flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground`,children:b(e,{className:`size-5`})}),b(`p`,{className:`text-xs text-muted-foreground`,children:t})]})}function uy({target:e,...t}){let n=J(),{dialogs:r}=Jd(),i=n(`sandbox.kind.${e.type}`),a=n(`sandbox.menu.editEntity`,{kind:i}),o=n(`sandbox.menu.deleteEntity`,{kind:i}),s=()=>r.openEntity(`edit`,e),c=()=>r.openEntity(`delete`,e);return x(gc,{children:[b(_c,{render:b(dy,{...t,onEdit:s,actions:x(y,{children:[b(G,{size:`icon-sm`,variant:`ghost`,"aria-label":a,onClick:s,children:b(Jn,{})}),b(G,{size:`icon-sm`,variant:`ghost`,"aria-label":o,className:`hover:text-destructive`,onClick:c,children:b(or,{})})]})})}),x(vc,{className:`sandbox-glass`,children:[x(q,{onClick:s,children:[b(Jn,{}),a]}),x(q,{variant:`destructive`,onClick:c,children:[b(or,{}),o]})]})]})}var dy=e.forwardRef(function({avatar:e,title:t,subtitle:n,meta:r,onEdit:i,actions:a,className:o,...s},c){return x(`article`,{ref:c,className:U(`relative flex flex-col gap-3 rounded-xl bg-muted/30 p-3.5 ring-1 ring-border/70`,i&&`group transition-[background-color,box-shadow] duration-150 hover:bg-muted/60 hover:ring-border`,o),...s,children:[x(`div`,{className:`flex items-center gap-3`,children:[e,x(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[i?b(`button`,{type:`button`,className:`block w-full truncate text-left text-[13px] leading-5 font-medium outline-none after:absolute after:inset-0 after:rounded-xl focus-visible:after:ring-2 focus-visible:after:ring-ring/50`,onClick:i,children:t}):b(`strong`,{className:`truncate text-[13px] leading-5 font-medium`,children:t}),b(`small`,{className:`truncate text-xs leading-4 text-muted-foreground tabular-nums`,children:n})]}),a&&b(`span`,{className:`relative z-10 -my-1 -mr-1.5 flex shrink-0 items-center gap-0.5 self-start text-muted-foreground opacity-0 transition-opacity duration-150 group-focus-within:opacity-100 group-hover:opacity-100`,children:a})]}),r&&b(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:r})]})});function fy({enabled:e}){let t=J();return x(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] leading-5 text-muted-foreground`,children:[b(`span`,{"aria-hidden":!0,className:U(`size-1.5 rounded-full`,e?`bg-emerald-500`:`bg-muted-foreground/40`)}),t(e?`sandbox.env.enabled`:`sandbox.env.disabled`)]})}function py(e){if(!Number.isFinite(e)||e<0)return`—`;if(e<1e3)return`${Math.round(e)} ms`;if(e<6e4){let t=e/1e3;return`${my(t,t<10?2:1)} s`}let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=[];return n&&a.push(`${n} h`),r&&a.push(`${r} min`),(i||!a.length)&&a.push(`${i} s`),a.join(` `)}function my(e,t){return String(Number(e.toFixed(t)))}var hy=2e3;function gy({title:t,description:n,loading:r,error:i,live:a,onLiveChange:o,onRefresh:s,clear:c,children:l}){let u=J(),[d,f]=e.useState(!1);return x(`section`,{"aria-label":t,className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden px-6 pt-3 pb-6 text-sm leading-5`,children:[x(`header`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[b(`p`,{className:`min-w-0 text-xs text-muted-foreground`,children:n}),x(`div`,{className:`flex items-center gap-2`,children:[x(`label`,{className:`mr-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[b(Pc,{checked:a,onCheckedChange:e=>o(e===!0)}),u(`sandbox.records.live`)]}),x(G,{variant:`outline`,size:`sm`,disabled:r,onClick:s,children:[b(Zn,{}),u(`sandbox.records.refresh`)]}),x(G,{variant:`outline`,size:`sm`,className:`text-destructive`,disabled:r||c.disabled,onClick:()=>f(!0),children:[b(or,{}),c.label]})]})]}),i&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:i}),b(`div`,{className:`grid min-h-0 flex-1 grid-rows-[minmax(10rem,40%)_minmax(0,1fr)] gap-4 md:grid-cols-[minmax(16rem,22rem)_minmax(0,1fr)] md:grid-rows-1`,children:l}),b(Ur,{open:d,onOpenChange:f,children:x(Kr,{children:[x(qr,{children:[b(Yr,{children:c.title}),b(Xr,{children:c.description})]}),x(Jr,{children:[b(Qr,{children:u(`sandbox.common.cancel`)}),b(Zr,{variant:`destructive`,onClick:()=>{f(!1),c.onConfirm()},children:c.label})]})]})})]})}function _y({label:t,order:n,onToggleOrder:r,filter:i,loading:a,empty:o,children:s}){let c=J(),l=e.useRef(null),u=n===`asc`?cn:an;return x(`section`,{"aria-label":t,className:`flex min-h-0 flex-col overflow-hidden rounded-xl ring-1 ring-border`,children:[x(`header`,{className:`flex h-12 shrink-0 items-center justify-between gap-2 border-b border-border pr-2 pl-4`,children:[b(`h2`,{className:`text-[13px] font-medium`,children:t}),x(`div`,{className:`flex items-center gap-1`,children:[x(G,{variant:`ghost`,size:`sm`,"aria-label":c(n===`asc`?`sandbox.records.orderAscHint`:`sandbox.records.orderDescHint`),onClick:r,children:[b(u,{}),c(n===`asc`?`sandbox.records.orderAsc`:`sandbox.records.orderDesc`)]}),x(Lr,{open:i.open,onOpenChange:i.onOpenChange,children:[b(Rr,{render:b(G,{variant:i.active?`secondary`:`ghost`,size:`icon-sm`,"aria-label":c(`sandbox.records.filterLabel`,{summary:i.summary})}),children:b(Fn,{})}),b(zr,{align:`end`,className:`sandbox-glass flex w-72 flex-col gap-3`,children:i.content})]})]})]}),a&&o?b(`div`,{className:`flex flex-1 items-center justify-center`,children:b(Nc,{})}):o?b(`p`,{className:`flex flex-1 items-center justify-center p-6 text-center text-xs text-muted-foreground`,children:c(`sandbox.records.empty`)}):x(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[b(`div`,{ref:l,className:`sandbox-record-scroller flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5`,children:s}),b(G_,{target:l,className:`sandbox-record-scrollbar`})]})]})}function vy({active:e,onClick:t,title:n,status:r,tag:i,time:a,duration:o,meta:s=[]}){let c=J();return x(`button`,{type:`button`,"aria-current":e?`true`:void 0,className:U(`sandbox-record-item`,e&&`is-active`),onClick:t,children:[x(`span`,{className:`flex min-w-0 items-center gap-2`,children:[b(`span`,{role:`img`,"aria-label":c(r===`error`?`sandbox.records.statusError`:`sandbox.records.statusSuccess`),className:U(`sandbox-record-dot`,r===`error`&&`is-error`)}),b(`strong`,{className:U(`min-w-0 flex-1 truncate font-mono text-[13px] leading-5 font-medium`,r===`error`&&`text-destructive`),children:n}),i&&b(yy,{children:i})]}),x(`span`,{className:`sandbox-record-item-meta`,children:[b(`time`,{dateTime:a,title:Py(a),children:Ny(a)}),b(`span`,{children:py(o)}),s.map((e,t)=>b(`span`,{className:`min-w-0 truncate`,children:e},t))]})]})}function yy({children:e}){return b(`span`,{className:`sandbox-record-tag`,children:e})}function by({time:e,duration:t}){return x(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted-foreground tabular-nums`,children:[x(`time`,{dateTime:e,className:`flex items-center gap-1`,children:[b(gn,{className:`size-3.5`}),Py(e)]}),x(`span`,{className:`flex items-center gap-1`,children:[b(wn,{className:`size-3.5`}),py(t)]})]})}function xy({label:t,loading:n,header:r,scrollKey:i,children:a}){let o=J(),s=e.useRef(null);return e.useLayoutEffect(()=>{s.current?.scrollTo({top:0})},[i]),b(`section`,{"aria-label":t,className:`flex min-h-0 flex-col overflow-hidden rounded-xl ring-1 ring-border`,children:a?x(y,{children:[r,x(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[b(`article`,{ref:s,className:`sandbox-record-scroller flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pt-4 pb-6`,children:a}),b(G_,{target:s,className:`sandbox-record-scrollbar`})]})]}):n?b(`div`,{className:`flex flex-1 items-center justify-center`,children:b(Nc,{})}):b(`p`,{className:`flex flex-1 items-center justify-center p-6 text-center text-xs text-muted-foreground`,children:o(`sandbox.records.pick`)})})}function Sy({title:e,badges:t,time:n,duration:r}){return x(`header`,{className:`flex shrink-0 flex-col gap-1.5 border-b border-border px-5 py-3.5`,children:[x(`span`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[b(`h2`,{className:`min-w-0 truncate font-mono text-[15px] leading-6 font-semibold`,children:e}),t]}),b(by,{time:n,duration:r})]})}function Cy({status:e}){let t=J();return e===`error`?b(ei,{variant:`destructive`,children:t(`sandbox.records.statusError`)}):b(ei,{variant:`secondary`,className:`text-emerald-700 dark:text-emerald-400`,children:t(`sandbox.records.statusSuccess`)})}function wy({children:e}){return b(`dl`,{className:`sandbox-record-meta`,children:e})}function Ty({icon:e,label:t,value:n,wide:r}){return x(`div`,{className:U(`sandbox-record-meta-item`,r&&`is-wide`),children:[x(`dt`,{className:`sandbox-record-meta-label`,children:[b(e,{}),t]}),b(`dd`,{className:`sandbox-record-meta-value`,children:n})]})}function Ey({items:e}){return b(`span`,{className:`sandbox-record-chips`,children:e.map(([e,t])=>x(`span`,{className:`sandbox-record-chip`,children:[b(`span`,{className:`sandbox-record-chip-key`,children:e}),t]},e))})}function Dy({icon:e,title:t,tone:n,children:r}){return x(`section`,{className:U(`sandbox-record-notice`,n===`destructive`&&`is-destructive`),children:[b(e,{}),x(`div`,{className:`min-w-0`,children:[b(`h3`,{className:`sandbox-record-notice-title`,children:t}),b(`div`,{className:`sandbox-record-notice-body`,children:r})]})]})}function Oy({icon:e,title:t,children:n}){return x(`section`,{className:`flex flex-col gap-2`,children:[x(`h3`,{className:`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[b(e,{className:`size-3.5`}),t]}),n]})}var ky=/("(?:\\.|[^"\\])*")(\s*:)?|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}[\],]/g;function Ay(e){let t=[],n=0;for(let r of e.matchAll(ky)){let[i,a,o]=r;r.index>n&&t.push(e.slice(n,r.index));let s=a===void 0?/^[{}[\],]$/.test(i)?`punct`:/^[tfn]/.test(i)?`literal`:`number`:o?`key`:`string`;t.push(b(`span`,{className:`sandbox-json-${s}`,children:a??i},r.index)),o&&t.push(o),n=r.index+i.length}return n<e.length&&t.push(e.slice(n)),t}function jy({value:t}){let n=J(),r=e.useMemo(()=>JSON.stringify(t,null,2)??String(t),[t]),i=e.useMemo(()=>Ay(r),[r]),[a,o]=e.useState(!1);e.useEffect(()=>{if(!a)return;let e=setTimeout(()=>o(!1),1500);return()=>clearTimeout(e)},[a]);let s=async()=>{try{await navigator.clipboard.writeText(r),o(!0)}catch{L.error(n(`sandbox.records.copyFailed`))}};return x(`div`,{className:`sandbox-record-code`,children:[b(`pre`,{children:i}),b(G,{variant:`outline`,size:`icon-sm`,className:`sandbox-record-code-copy`,"aria-label":n(a?`sandbox.records.copied`:`sandbox.records.copy`),onClick:()=>void s(),children:b(a?vn:Tn,{})})]})}function My({label:e,children:t}){return x(`label`,{className:`flex flex-col gap-1.5 text-xs`,children:[b(`span`,{className:`text-muted-foreground`,children:e}),t]})}function Ny(e){let t=new Date(e),n=Py(e),r=new Date;return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()?n.slice(11):n.slice(5)}function Py(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function Fy(t,n){let r=e.useRef(n);r.current=n,e.useEffect(()=>{r.current()},[]),e.useEffect(()=>{if(!t)return;let e,n=()=>{let t=document.visibilityState===`visible`;t&&!e&&(e=setInterval(()=>r.current(),hy)),!t&&e&&(clearInterval(e),e=void 0)};return n(),document.addEventListener(`visibilitychange`,n),()=>{document.removeEventListener(`visibilitychange`,n),e&&clearInterval(e)}},[t])}function Iy(e,t,n){let r=t===`asc`?1:-1;return[...e].sort((e,t)=>r*(e.createdAt.localeCompare(t.createdAt)||n(e,t)))}var Ly={botKey:`all`,direction:`all`,action:``,requestedAction:``,errorsOnly:!1};function Ry(e){return e.type===`main`?`main`:`space:${e.spaceId}`}function zy(e){return`${Ry(e.source)}:${e.id}`}function By(e){return`${Ry(e.source)}:${e.id}`}function Vy(e){return!e||typeof e!=`object`?0:Reflect.get(e,`kind`)===`large-value`?1:Object.values(e).reduce((e,t)=>e+Vy(t),0)}function Hy(){let t=J(),{view:n}=Jd(),r=n.workspace?.snapshot,{spaces:i}=ry(),a=e.useMemo(()=>r?ay(r,i):[],[r,i]),[o,s]=e.useState([]),[c,l]=e.useState(),[u,d]=e.useState(!1),[f,p]=e.useState(!1),[m,h]=e.useState(``),[g,_]=e.useState(Ly),[v,S]=e.useState(`desc`),[C,w]=e.useState(!1),[T,E]=e.useState(!1),D=async(e=g,n=v)=>{let r={botId:e.botKey===`all`?void 0:a.find(t=>zy(t)===e.botKey)?.id,direction:e.direction===`all`?void 0:e.direction,action:e.action.trim()||void 0,requestedAction:e.requestedAction.trim()||void 0,status:e.errorsOnly?`error`:void 0,order:n};d(!0);try{s((await Id(`onebot-sandbox.debug-records`,r)).records),h(``)}catch(e){h(zd(e,t(`sandbox.debug.loadFailed`)))}finally{d(!1)}},O=async e=>{p(!0);try{l(await Id(`onebot-sandbox.debug-record`,{recordId:e.id,includeLargeValues:!0,...e.source.type===`test-space`?{spaceId:e.source.spaceId}:{}})),h(``)}catch(e){h(zd(e,t(`sandbox.debug.detailFailed`)))}finally{p(!1)}},k=()=>{D(),c&&O(c)};Fy(T,k);let A=(e,t=!1)=>{let n={...g,...e};_(n),t&&D(n)},j=g.botKey!==`all`||g.direction!==`all`||!!g.action.trim()||!!g.requestedAction.trim()||g.errorsOnly,M=[g.botKey===`all`?``:a.find(e=>zy(e)===g.botKey)?.name??g.botKey,g.direction===`all`?``:t(`sandbox.debug.direction.${g.direction}`),g.action.trim(),g.requestedAction.trim(),g.errorsOnly?t(`sandbox.records.errorsOnly`):``].filter(Boolean).join(` · `)||t(`sandbox.records.noFilter`),N=e=>a.find(t=>t.id===e.botId&&Ry(t.source)===Ry(e.source))?.name??e.botId,ee=c?By(c):void 0,P=[{value:`all`,label:t(`sandbox.debug.allBots`)},...a.map(e=>({value:zy(e),label:`${e.name} · ${e.id} · ${ad(t,e.source)}`}))],F=[`all`,`action`,`event`].map(e=>({value:e,label:t(`sandbox.debug.direction.${e}`)}));return x(gy,{title:t(`sandbox.debug.title`),description:t(`sandbox.debug.description`),loading:u,error:m,live:T,onLiveChange:E,onRefresh:k,clear:{label:t(`sandbox.debug.clear`),title:t(`sandbox.debug.clearTitle`),description:t(`sandbox.debug.clearDescription`),disabled:!o.length,onConfirm:async()=>{try{await Id(`onebot-sandbox.clear-debug-records`,{}),l(void 0),await D()}catch(e){h(zd(e,t(`sandbox.debug.clearFailed`)))}}},children:[b(_y,{label:t(`sandbox.records.list`),order:v,onToggleOrder:()=>{let e=v===`desc`?`asc`:`desc`;S(e),D(g,e)},loading:u,empty:!o.length,filter:{active:j,summary:M,open:C,onOpenChange:e=>{w(e),e||D()},content:x(y,{children:[b(My,{label:t(`sandbox.debug.bot`),children:x(Ec,{value:g.botKey,onValueChange:e=>e&&A({botKey:e}),items:P,children:[b(Oc,{className:`w-full`,children:b(Dc,{})}),x(kc,{className:`sandbox-glass`,children:[b(Ac,{value:`all`,children:t(`sandbox.debug.allBots`)}),a.map(e=>x(Ac,{value:zy(e),children:[b(Hf,{kind:`bot`,name:e.name,src:e.avatar,className:`size-5`,badge:!1}),x(`span`,{className:`truncate`,children:[e.name,` · `,e.id,` · `,ad(t,e.source)]})]},zy(e)))]})]})}),b(My,{label:t(`sandbox.debug.directionLabel`),children:x(Ec,{value:g.direction,onValueChange:e=>e&&A({direction:e}),items:F,children:[b(Oc,{className:`w-full`,children:b(Dc,{})}),b(kc,{className:`sandbox-glass`,children:F.map(e=>b(Ac,{value:e.value,children:e.label},e.value))})]})}),b(My,{label:t(`sandbox.debug.action`),children:b(Or,{value:g.action,placeholder:`get_group_info`,onChange:e=>A({action:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void D()})}),b(My,{label:t(`sandbox.debug.requestedAction`),children:b(Or,{value:g.requestedAction,placeholder:`getGroupInfo`,onChange:e=>A({requestedAction:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void D()})}),x(`label`,{className:`flex items-center gap-2 text-xs`,children:[b(dc,{checked:g.errorsOnly,onCheckedChange:e=>A({errorsOnly:e===!0},!0)}),t(`sandbox.records.errorsOnly`)]}),b(G,{variant:`outline`,size:`sm`,onClick:()=>{_(Ly),D(Ly)},children:t(`sandbox.records.reset`)})]})},children:Iy(o,v,(e,t)=>e.sequence-t.sequence).map(e=>b(vy,{active:By(e)===ee,onClick:()=>void O(e),title:e.requestedAction,status:e.status,tag:e.direction.toUpperCase(),time:e.createdAt,duration:e.durationMs,meta:[ad(t,e.source)]},By(e)))}),b(xy,{label:t(`sandbox.records.detail`),loading:f,scrollKey:ee,header:c&&b(Sy,{title:c.requestedAction,time:c.createdAt,duration:c.durationMs,badges:x(y,{children:[b(Cy,{status:c.status}),b(yy,{children:c.direction.toUpperCase()})]})}),children:c&&b(Uy,{record:c,botName:N(c)})})]})}function Uy({record:e,botName:t}){let n=J(),r=Object.entries(e.entities).filter(e=>!!e[1]),i=e.conversationObservation,a=e.direction===`action`;return x(y,{children:[e.error&&x(Dy,{icon:Cn,title:n(`sandbox.records.diagnosis`),tone:`destructive`,children:[b(`span`,{className:`font-mono`,children:e.error.code}),` · `,e.error.message,x(`span`,{className:`mt-0.5 block font-mono text-[11px]`,children:[`trace `,e.error.traceId]})]}),i&&b(Dy,{icon:In,title:n(`sandbox.debug.observation.${i.kind}.title`),children:n(`sandbox.debug.observation.${i.kind}.detail`,{event:i.eventConversationId,actual:i.conversationId})}),x(wy,{children:[b(Ty,{icon:pn,label:n(`sandbox.debug.bot`),value:x(y,{children:[t,` `,b(`span`,{className:`font-mono font-normal text-muted-foreground`,children:e.botId})]})}),b(Ty,{icon:mn,label:n(`sandbox.debug.source`),value:ad(n,e.source)}),b(Ty,{icon:Dn,label:n(`sandbox.debug.implementation`),value:Ag(e.implementation)}),e.action!==e.requestedAction&&b(Ty,{icon:sn,label:n(`sandbox.debug.action`),value:b(`span`,{className:`font-mono`,children:e.action})}),e.matchedAlias&&b(Ty,{icon:ar,label:n(`sandbox.debug.alias`),value:b(`span`,{className:`font-mono`,children:e.matchedAlias})}),b(Ty,{icon:Hn,label:n(`sandbox.debug.entities`),wide:!0,value:r.length?b(Ey,{items:r}):b(`span`,{className:`font-normal text-muted-foreground`,children:n(`sandbox.debug.noEntities`)})})]}),e.payload!==void 0&&x(Oy,{icon:hn,title:n(a?`sandbox.debug.input`:`sandbox.debug.eventData`),children:[b(jy,{value:e.payload}),Vy(e.payload)>0&&b(`p`,{className:`text-[11px] text-muted-foreground`,children:n(`sandbox.debug.folded`,{count:Vy(e.payload)})})]}),e.result!==void 0&&x(Oy,{icon:hn,title:n(a?`sandbox.debug.output`:`sandbox.debug.handled`),children:[b(jy,{value:e.result}),Vy(e.result)>0&&b(`p`,{className:`text-[11px] text-muted-foreground`,children:n(`sandbox.debug.folded`,{count:Vy(e.result)})})]})]})}var Wy={dirty:!1},Gy=new Set,Ky=e=>{e.preventDefault()};function qy(e){e.dirty!==Wy.dirty&&(e.dirty?window.addEventListener(`beforeunload`,Ky):window.removeEventListener(`beforeunload`,Ky)),Wy=e;for(let e of Gy)e()}var Jy=e=>(Gy.add(e),()=>Gy.delete(e)),Yy=()=>Wy,Xy={setValue:e=>qy({value:e,dirty:e!==void 0&&Wy.dirty}),setDirty:e=>{e!==Wy.dirty&&qy({...Wy,dirty:e})}};function Zy(){return e.useSyncExternalStore(Jy,Yy,Yy)}var Qy=`chatluna-plugin-onebot-sandbox`,$y=`1.0.0`;function eb(){let e=J(),t=[{label:e(`sandbox.settings.about.version`),value:$y,mono:!0},{label:e(`sandbox.settings.about.package`),value:Qy,mono:!0},{label:e(`sandbox.settings.about.license`),value:`MIT`},{label:e(`sandbox.settings.about.protocol`),value:`OneBot v11`},{label:e(`sandbox.settings.about.host`),value:`ChatLuna v2`}];return x(`div`,{className:`flex flex-col gap-5`,children:[x(`div`,{className:`flex items-center gap-3`,children:[b(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary`,children:b(Pn,{className:`size-5`})}),x(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x(`div`,{className:`flex flex-wrap items-center gap-2`,children:[b(`h3`,{className:`text-[15px] leading-5 font-semibold`,children:e(`onebot-sandbox.title`)}),x(ei,{variant:`outline`,className:`font-mono`,children:[`v`,$y]})]}),b(`p`,{className:`text-xs text-muted-foreground`,children:e(`sandbox.settings.about.summary`)})]})]}),b(`dl`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] gap-x-6 gap-y-2.5 border-t border-border pt-4 text-[13px] leading-5`,children:t.map(e=>x(`div`,{className:`contents`,children:[b(`dt`,{className:`text-muted-foreground`,children:e.label}),b(`dd`,{className:e.mono?`font-mono text-xs leading-5 break-all`:void 0,children:e.value})]},e.label))})]})}var tb=`sandbox.settings.schema.`,nb=[`label`,`description`];function rb(e,t,n,r,i){let a=e.refs[t];if(!a)return;let o=a.meta?.i18n,s=typeof o==`string`?o:n;if(s&&i(t,s),a.type===`object`)for(let[t,n]of Object.entries(a.dict??{})){let a=r?`${r}.${t}`:t;rb(e,n,a,a,i)}else if(a.type===`intersect`)for(let t of a.list??[])rb(e,t,void 0,r,i);else if(a.type===`array`&&a.inner!==void 0)rb(e,a.inner,void 0,r,i);else if(a.type===`union`)for(let t of a.list??[]){let n=e.refs[t];n?.type===`const`&&rb(e,t,`${r}.option.${String(n.value)}`,r,i)}}function ib(e,t){let n={...e.refs};return rb(e,e.uid,void 0,``,(e,r)=>{let i=n[e],a={...i.meta};for(let e of nb){if(typeof a[e]!=`string`||!a[e])continue;let n=`${tb}${r}.${e}`,i=t(n);i!==n&&(a[e]=i)}n[e]={...i,meta:a}}),{uid:e.uid,refs:n}}var ab={sandboxAccentColor:Kn,persistenceMode:kn,testEndpoint:nr},ob=(e,t)=>JSON.stringify(e)===JSON.stringify(t),sb=e=>typeof e==`string`&&e?e:void 0;function cb(e,t){let n=e[t];return n?.type===`intersect`?(n.list??[]).flatMap(t=>cb(e,t)):Object.keys(n?.dict??{})}function lb(e,t){let n=e.refs[e.uid];return(n?.type===`intersect`?n.list??[]:[e.uid]).map(n=>{let r=e.refs[n],{label:i,description:a,...o}=r.meta??{},s={...r,meta:o};return{title:sb(i)??sb(a)??t,description:sb(i)?sb(a):void 0,schema:{uid:n,refs:{...e.refs,[n]:s}},keys:cb(e.refs,n)}})}function ub(){let t=J(),n=R(`onebot-sandbox.settings`),r=se(),i=Zy().value,a=Xy.setValue,[o,s]=e.useState(),[c,l]=e.useState(!1),[u,d]=e.useState(0),f=e.useRef(null),p=n.data,m=o&&o.revision===p?.revision?o.value:p?.value,h=i??m??{},g=i!==void 0&&!ob(i,m);e.useEffect(()=>{p&&Xy.setDirty(g)},[p,g]);let _=t(`sandbox.nav.settings`),v=e.useMemo(()=>p?lb(ib(p.schema,t),_):[],[p,t,_]),y=u===`about`,S=y?void 0:v[Math.min(u,v.length-1)],C=y?t(`sandbox.settings.about.title`):S?.title,w=y?t(`sandbox.settings.about.description`):S?.description,T=()=>{a(void 0),r.reset()},E=async()=>{if(!(!p||!i)){if(!r.attempt()){L.error(t(`sandbox.settings.invalid`));return}l(!0);try{await ne(`onebot-sandbox.settings.save`,{config:i,revision:p.revision}),s({revision:p.revision,value:i}),a(void 0),r.reset(),L.success(t(`sandbox.settings.saved`))}catch(e){L.error(t(`sandbox.settings.saveFailed`),{description:te(e)})}finally{l(!1)}}},D=e=>{d(e),f.current?.scrollTo({top:0})};return x(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden px-6 pt-3 pb-6 text-sm leading-5`,children:[x(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[b(`p`,{className:`min-w-0 text-xs text-muted-foreground`,children:t(`sandbox.settings.description`)}),x(`div`,{className:`flex items-center gap-2`,children:[g&&b(`span`,{className:`text-xs text-muted-foreground`,children:t(`sandbox.settings.unsaved`)}),x(G,{variant:`outline`,size:`sm`,disabled:!g||c,onClick:T,children:[b(sr,{}),t(`sandbox.settings.discard`)]}),x(G,{size:`sm`,disabled:!g||c,onClick:()=>void E(),children:[b(c?Nc:$n,{}),t(c?`sandbox.common.saving`:`sandbox.common.save`)]})]})]}),p&&v.length?x(`div`,{className:`grid min-h-0 w-full max-w-5xl flex-1 grid-rows-[auto_minmax(0,1fr)] gap-4 md:grid-cols-[14rem_minmax(0,1fr)] md:grid-rows-1`,children:[x(`nav`,{"aria-label":t(`sandbox.settings.sections`),className:`sandbox-scroll-strip flex gap-0.5 self-start overflow-x-auto rounded-xl p-1.5 ring-1 ring-border md:flex-col md:overflow-x-visible`,children:[v.map((e,n)=>{let r=ab[e.keys[0]??``]??ir,a=i!==void 0&&e.keys.some(e=>!ob(i[e],m?.[e]));return x(G,{variant:`ghost`,className:U(`shrink-0 justify-start md:w-full`,e===S&&`bg-accent text-accent-foreground`),"aria-current":e===S?`page`:void 0,onClick:()=>D(n),children:[b(r,{}),b(`span`,{children:e.title}),a&&b(`span`,{role:`img`,"aria-label":t(`sandbox.settings.unsaved`),className:`ml-auto size-1.5 shrink-0 rounded-full bg-primary`})]},n)}),b(`div`,{role:`separator`,className:`mx-1 shrink-0 bg-border max-md:w-px md:my-1 md:h-px`}),x(G,{variant:`ghost`,className:U(`shrink-0 justify-start md:w-full`,y&&`bg-accent text-accent-foreground`),"aria-current":y?`page`:void 0,onClick:()=>D(`about`),children:[b(Bn,{}),b(`span`,{children:t(`sandbox.settings.about.title`)})]})]}),x(`section`,{"aria-label":C,className:`flex min-h-0 flex-col overflow-hidden rounded-xl ring-1 ring-border`,children:[x(`header`,{className:`flex shrink-0 flex-col gap-0.5 border-b border-border px-4 py-3`,children:[b(`h2`,{className:`text-[13px] font-medium`,children:C}),w&&b(`p`,{className:`text-[11px] text-muted-foreground`,children:w})]}),x(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[b(`div`,{ref:f,className:`sandbox-settings-scroller min-h-0 flex-1 overflow-y-auto`,children:x(`fieldset`,{disabled:c,className:`sandbox-settings-form min-w-0 px-5 py-4`,children:[v.map((e,t)=>b(`div`,{hidden:e!==S,children:b(oe,{schema:e.schema,value:h,initial:m,onChange:a,validation:r,formId:`onebot-sandbox.settings`})},t)),y&&b(eb,{})]})}),b(G_,{target:f,className:`sandbox-settings-scrollbar`})]})]})]}):n.error?b(Vr,{variant:`destructive`,className:`max-w-5xl`,children:b(Hr,{children:t(`sandbox.settings.unavailableDetail`,{error:n.error})})}):b(`div`,{className:`flex justify-center py-12 text-muted-foreground`,children:b(Nc,{})})]})}var db={tool:``,credentialName:``,transport:`all`,spaceId:``,testRunId:``,errorsOnly:!1};function fb(){let t=J(),[n,r]=e.useState([]),[i,a]=e.useState(),[o,s]=e.useState(!1),[c,l]=e.useState(!1),[u,d]=e.useState(``),[f,p]=e.useState(db),[m,h]=e.useState(`desc`),[g,_]=e.useState(!1),[v,S]=e.useState(!1),C=async(e=f,n=m)=>{let i={tool:e.tool.trim()||void 0,credentialName:e.credentialName.trim()||void 0,transport:e.transport===`all`?void 0:e.transport,spaceId:e.spaceId.trim()||void 0,testRunId:e.testRunId.trim()||void 0,status:e.errorsOnly?`error`:void 0,order:n};s(!0);try{r((await Id(`onebot-sandbox.test-call-records`,i)).records),d(``)}catch(e){d(zd(e,t(`sandbox.testCall.loadFailed`)))}finally{s(!1)}},w=async e=>{l(!0);try{a(await Id(`onebot-sandbox.test-call-record`,{recordId:e})),d(``)}catch(e){d(zd(e,t(`sandbox.testCall.detailFailed`)))}finally{l(!1)}},T=()=>{C(),i&&w(i.id)};Fy(v,T);let E=(e,t=!1)=>{let n={...f,...e};p(n),t&&C(n)},D=e=>t(`sandbox.testCall.transport.${e}`),O=[f.tool,f.credentialName,f.spaceId,f.testRunId].map(e=>e.trim()),k=O.some(Boolean)||f.transport!==`all`||f.errorsOnly,A=[O[0],O[1],f.transport===`all`?``:D(f.transport),O[2],O[3],f.errorsOnly?t(`sandbox.records.errorsOnly`):``].filter(Boolean).join(` · `)||t(`sandbox.records.noFilter`),j=[{value:`all`,label:t(`sandbox.testCall.transport.all`)},{value:`mcp`,label:D(`mcp`)},{value:`http`,label:D(`http`)},{value:`chatluna`,label:D(`chatluna`)}];return x(gy,{title:t(`sandbox.testCall.title`),description:t(`sandbox.testCall.description`),loading:o,error:u,live:v,onLiveChange:S,onRefresh:T,clear:{label:t(`sandbox.testCall.clear`),title:t(`sandbox.testCall.clearTitle`),description:t(`sandbox.testCall.clearDescription`),disabled:!n.length,onConfirm:async()=>{try{await Id(`onebot-sandbox.clear-test-call-records`,void 0),a(void 0),await C()}catch(e){d(zd(e,t(`sandbox.testCall.clearFailed`)))}}},children:[b(_y,{label:t(`sandbox.records.list`),order:m,onToggleOrder:()=>{let e=m===`desc`?`asc`:`desc`;h(e),C(f,e)},loading:o,empty:!n.length,filter:{active:k,summary:A,open:g,onOpenChange:e=>{_(e),e||C()},content:x(y,{children:[b(My,{label:t(`sandbox.testCall.tool`),children:b(Or,{value:f.tool,placeholder:`send_message`,onChange:e=>E({tool:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void C()})}),b(My,{label:t(`sandbox.testCall.credential`),children:b(Or,{value:f.credentialName,onChange:e=>E({credentialName:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void C()})}),b(My,{label:t(`sandbox.testCall.transportLabel`),children:x(Ec,{value:f.transport,onValueChange:e=>e&&E({transport:e},!0),items:j,children:[b(Oc,{className:`w-full`,children:b(Dc,{})}),b(kc,{className:`sandbox-glass`,children:j.map(e=>b(Ac,{value:e.value,children:e.label},e.value))})]})}),b(My,{label:t(`sandbox.testCall.space`),children:b(Or,{value:f.spaceId,placeholder:`space-1`,onChange:e=>E({spaceId:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void C()})}),b(My,{label:t(`sandbox.testCall.testRun`),children:b(Or,{value:f.testRunId,placeholder:`run-1`,onChange:e=>E({testRunId:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void C()})}),x(`label`,{className:`flex items-center gap-2 text-xs`,children:[b(dc,{checked:f.errorsOnly,onCheckedChange:e=>E({errorsOnly:e===!0},!0)}),t(`sandbox.records.errorsOnly`)]}),b(G,{variant:`outline`,size:`sm`,onClick:()=>{p(db),C(db)},children:t(`sandbox.records.reset`)})]})},children:Iy(n,m,(e,t)=>e.id.localeCompare(t.id)).map(e=>b(vy,{active:e.id===i?.id,onClick:()=>void w(e.id),title:e.tool,status:e.status,tag:e.transport.toUpperCase(),time:e.createdAt,duration:e.durationMs,meta:[e.credentialName]},e.id))}),b(xy,{label:t(`sandbox.records.detail`),loading:c,scrollKey:i?.id,header:i&&b(Sy,{title:i.tool,time:i.createdAt,duration:i.durationMs,badges:x(y,{children:[b(Cy,{status:i.status}),b(yy,{children:i.transport.toUpperCase()})]})}),children:i&&b(pb,{record:i})})]})}function pb({record:e}){let t=J();return x(y,{children:[e.error&&x(Dy,{icon:Cn,title:t(`sandbox.records.diagnosis`),tone:`destructive`,children:[b(`span`,{className:`font-mono`,children:e.error.code}),` · `,e.error.message]}),x(wy,{children:[b(Ty,{icon:Vn,label:t(`sandbox.testCall.credential`),value:e.credentialName}),b(Ty,{icon:Yn,label:t(`sandbox.testCall.transportLabel`),value:(e=>t(`sandbox.testCall.transport.${e}`))(e.transport)}),e.sourceIp&&b(Ty,{icon:Ln,label:t(`sandbox.testCall.sourceIp`),value:b(`span`,{className:`font-mono`,children:e.sourceIp})}),e.spaceId&&b(Ty,{icon:mn,label:t(`sandbox.testCall.space`),value:b(`span`,{className:`font-mono`,children:e.spaceId})}),e.testRunId&&b(Ty,{icon:ar,label:t(`sandbox.testCall.testRun`),value:b(`span`,{className:`font-mono`,children:e.testRunId})})]}),b(Oy,{icon:hn,title:t(`sandbox.testCall.arguments`),children:b(jy,{value:e.arguments})}),e.result!==void 0&&b(Oy,{icon:hn,title:t(`sandbox.testCall.result`),children:b(jy,{value:e.result})}),e.error&&b(Oy,{icon:Cn,title:t(`sandbox.testCall.error`),children:b(jy,{value:e.error})})]})}function mb({label:t=`AI`,size:n=20}){let[r,i]=e.useState({top:`38%`,left:`55%`}),[a,o]=e.useState(!1),[s,c]=e.useState(!1),l=e.useRef({}),u=e.useCallback(()=>{clearTimeout(l.current.click),clearTimeout(l.current.loading)},[]);return e.useEffect(()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e,t=()=>{e=setTimeout(()=>{u(),o(!1),c(!1),i({top:`${22+Math.random()*52}%`,left:`${18+Math.random()*60}%`}),t()},5200+Math.random()*3800)};return l.current.loading=setTimeout(()=>c(!0),200),t(),()=>{clearTimeout(e),u()}},[u]),b(`div`,{className:U(`sandbox-agent-cursor`,a&&`is-clicking`,s&&`is-loading`),style:r,"aria-hidden":`true`,onTransitionEnd:e=>{e.propertyName===`top`&&(u(),o(!0),l.current.click=setTimeout(()=>{o(!1),l.current.loading=setTimeout(()=>c(!0),200)},400))},children:x(`span`,{className:`sandbox-agent-cursor-float`,children:[b(`svg`,{viewBox:`0 0 20 20`,width:n,height:n,fill:`none`,"aria-hidden":`true`,children:b(`path`,{d:`M6.465 15.647 4.511 4.813a1 1 0 0 1 1.366-1.102l9.698 4.007c.853.352.815 1.572-.058 1.87l-4.682 1.6a1 1 0 0 0-.588.534l-1.887 4.16c-.405.894-1.72.73-1.895-.235Z`,fill:`currentColor`,stroke:`#fff`,strokeWidth:`1.5`})}),b(`span`,{className:`sandbox-agent-cursor-label`,children:t})]})})}var hb=`url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cdefs%3E%3Cmask%20id%3D%22m%22%20maskUnits%3D%22userSpaceOnUse%22%3E%3Crect%20x%3D%22-8%22%20y%3D%22-8%22%20width%3D%2236%22%20height%3D%2236%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M9.3%2016.3%208.08%209.53a.63%20.63%200%200%201%20.85-.69L15%2011.35a.63%20.63%200%200%201-.03%201.18l-2.93%201a.63%20.63%200%200%200-.37.34l-1.18%202.6a.63%20.63%200%200%201-1.19-.17Z%22%20transform%3D%22translate(1.6%201)%20translate(0%20.35)%20translate(10.8%2012.4)%20scale(1.28)%20translate(-10.8%20-12.4)%22%20fill%3D%22%23000%22%20stroke%3D%22%23000%22%20stroke-width%3D%223.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cellipse%20cx%3D%2212.6%22%20cy%3D%2216.9%22%20rx%3D%224.2%22%20ry%3D%223.4%22%20fill%3D%22%23000%22%2F%3E%3Cellipse%20cx%3D%2214.8%22%20cy%3D%2214.6%22%20rx%3D%222.6%22%20ry%3D%222.4%22%20fill%3D%22%23000%22%2F%3E%3Ccircle%20cx%3D%2210.6%22%20cy%3D%2217.8%22%20r%3D%222.8%22%20fill%3D%22%23000%22%2F%3E%3C%2Fmask%3E%3C%2Fdefs%3E%3Crect%20x%3D%22-8%22%20y%3D%22-8%22%20width%3D%2236%22%20height%3D%2236%22%20fill%3D%22%23fff%22%20mask%3D%22url(%23m)%22%2F%3E%3C%2Fsvg%3E")`,gb={maskImage:hb,maskSize:`100% 100%`,maskRepeat:`no-repeat`,WebkitMaskImage:hb,WebkitMaskSize:`100% 100%`,WebkitMaskRepeat:`no-repeat`};function _b({running:e,small:t}){return x(`span`,{className:U(`sandbox-agent-control`,e&&`is-running`,t&&`is-small`),"aria-hidden":`true`,children:[x(`span`,{className:`sandbox-agent-control-orbit`,children:[b(`span`,{className:`sandbox-agent-control-orbit-band is-inner`}),b(`span`,{className:`sandbox-agent-control-orbit-band is-outer`})]}),b(`svg`,{className:`sandbox-agent-control-icon sandbox-agent-control-rays-layer`,style:gb,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:b(`g`,{transform:`translate(1.6 1)`,children:b(`g`,{transform:`translate(8.7 8.4)`,children:b(`g`,{className:`sandbox-agent-control-icon-rays`,children:b(`g`,{transform:`translate(-8.7 -8.4)`,children:b(`path`,{d:`M8.4.9v2.5M3.33 3.33 5.1 5.1M1.2 8.4h2.5M3.33 13.47l1.77-1.77M13.47 3.33 11.7 5.1M13.1 8.4h2.5M8.4 15.9v-2.5M13.47 13.47 11.7 11.7`,transform:`translate(.3 0)`})})})})})}),b(`svg`,{className:`sandbox-agent-control-icon sandbox-agent-control-pointer`,viewBox:`0 0 20 20`,fill:`none`,children:b(`g`,{transform:`translate(1.6 1)`,children:b(`path`,{d:`M9.3 16.3 8.08 9.53a.63 .63 0 0 1 .85-.69L15 11.35a.63 .63 0 0 1-.03 1.18l-2.93 1a.63 .63 0 0 0-.37.34l-1.18 2.6a.63 .63 0 0 1-1.19-.17Z`,transform:`translate(0 .35)`,fill:`currentColor`,stroke:`none`})})})]})}var vb=`#version 100
|
|
3
|
+
`):``,f=o.trim().toLocaleLowerCase(),p=new Map;for(let{code:e,status:n}of t.errorStatuses)f&&!e.includes(f)&&!String(n).includes(f)||p.set(n,[...p.get(n)??[],e]);let m=[...p].sort(([e],[t])=>e-t),h=e=>b(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[11px]`,children:e});return x(`div`,{className:`flex flex-col gap-4 p-4`,children:[!t.enabled&&b(`p`,{className:`rounded-lg bg-amber-500/10 p-3 text-xs leading-5 text-amber-800 dark:text-amber-300`,children:a(`sandbox.env.http.disabledNotice`)}),b(Xv,{items:[{value:t.routes.length,label:a(`sandbox.env.http.routes`)},{value:t.errorStatuses.length,label:a(`sandbox.env.http.errorMappings`)},{value:l,label:a(`sandbox.env.http.bodyLimit`)}]}),x(`div`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[b(`span`,{className:`mr-1 text-muted-foreground`,children:a(`sandbox.env.http.protocol`)}),b(ei,{variant:t.enabled?`secondary`:`outline`,children:a(t.enabled?`sandbox.env.enabled`:`sandbox.env.http.closed`)}),b(ei,{variant:`outline`,children:a(`sandbox.env.http.basePath`,{path:t.basePath})}),b(ei,{variant:`outline`,children:a(`sandbox.env.http.version`,{version:t.version})})]}),x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs font-medium`,children:a(`sandbox.env.http.auth`)}),x(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:[a(`sandbox.env.http.authBefore`),h(t.baseUrl),a(`sandbox.env.http.authMiddle`),h(`Authorization`),a(`sandbox.env.http.authCarry`),h(`Bearer <${a(`sandbox.env.http.tokenPlaceholder`)}>`),a(`sandbox.env.http.authAfter`)]}),d&&b(`pre`,{className:`overflow-auto rounded-lg bg-muted/50 p-3 font-mono text-[11px] leading-5`,children:d})]}),x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs font-medium`,children:a(`sandbox.env.http.routes`)}),t.routes.map(e=>x(`article`,{className:`flex flex-col gap-1 rounded-lg px-3 py-2.5 ring-1 ring-border`,children:[x(`p`,{className:`flex min-w-0 items-center gap-2`,children:[b(ei,{variant:`secondary`,className:`font-mono`,children:e.method}),b(`code`,{className:`truncate font-mono text-xs`,children:e.target})]}),b(`small`,{className:`text-[11px] text-muted-foreground`,children:e.summary})]},e.kind))]}),x(`section`,{className:`flex flex-col gap-2`,children:[b(`h3`,{className:`text-xs font-medium`,children:a(`sandbox.env.http.statusTitle`)}),x(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:[a(`sandbox.env.http.statusBefore`),h(`Retry-After`),a(`sandbox.env.http.statusAfter`)]}),b(Zv,{value:o,onChange:s,placeholder:a(`sandbox.env.http.statusSearch`)}),m.map(([e,t])=>x(`article`,{className:`flex items-start gap-3 rounded-lg px-3 py-2 ring-1 ring-border`,children:[b(ei,{variant:e>=500?`destructive`:`outline`,className:`font-mono`,children:e}),b(`span`,{className:`flex min-w-0 flex-wrap gap-1`,children:t.map(e=>b(`code`,{className:U(`rounded bg-muted px-1 py-0.5 font-mono text-[11px]`),children:e},e))})]},e)),!m.length&&b(`p`,{className:`py-4 text-center text-xs text-muted-foreground`,children:a(`sandbox.env.http.noStatus`)})]})]})}function ty(t,n){let r=J(),[i,a]=e.useState(!1);return{requestClose:()=>{t?a(!0):n()},confirm:b(Ur,{open:i,onOpenChange:a,children:x(Kr,{children:[x(qr,{children:[b(Yr,{children:r(`sandbox.discard.title`)}),b(Xr,{children:r(`sandbox.discard.description`)})]}),x(Jr,{children:[b(Qr,{children:r(`sandbox.discard.keep`)}),b(Zr,{variant:`destructive`,onClick:()=>{a(!1),n()},children:r(`sandbox.discard.confirm`)})]})]})})}}function ny(){let t=J(),[n,r]=e.useState([]),[i,a]=e.useState(``),[o,s]=e.useState(),[c,l]=e.useState(``),[u,d]=e.useState(!1),[f,p]=e.useState(``),[m,h]=e.useState(),g=e.useCallback(async()=>{try{r(await Id(`onebot-sandbox.test-credentials`,void 0)),a(``)}catch(e){a(zd(e,t(`sandbox.credential.loadFailed`)))}},[t]);e.useEffect(()=>{g()},[g]);let _=async(e,t)=>{d(!0);try{await t()}catch(t){l(zd(t,e))}finally{d(!1)}},v=async()=>{if(!o)return;if(l(``),!o.name.trim()||!o.scopes.length){l(t(`sandbox.credential.invalid`));return}let e=o.editing;e?await _(t(`sandbox.credential.saveFailed`),async()=>{await Id(`onebot-sandbox.update-test-credential`,{id:e.id,name:o.name,scopes:o.scopes}),s(void 0),await g()}):await _(t(`sandbox.credential.createFailed`),async()=>{let e=await Id(`onebot-sandbox.create-test-credential`,{name:o.name,scopes:o.scopes});s(void 0),p(e.token),await g()})},y=async()=>{let e=o?.editing;e&&(l(``),await _(t(`sandbox.credential.rotateFailed`),async()=>{let t=await Id(`onebot-sandbox.rotate-test-credential-token`,{id:e.id});s(e=>e&&{...e,editing:t}),await g()}))},S=async(e,t)=>{try{await t(),await g()}catch(t){a(zd(t,e))}},C=async e=>{try{await navigator.clipboard.writeText(e),L.success(t(`sandbox.credential.copied`))}catch{L.error(t(`sandbox.credential.copyFailed`))}},w=D_(o),T=D_(m),E=D_(f||void 0)??``,D=o?.editing?{name:o.editing.name,scopes:o.editing.scopes}:{name:``,scopes:[`read`]},{requestClose:O,confirm:k}=ty(!!o&&(o.name!==D.name||[...o.scopes].sort().join()!==[...D.scopes].sort().join()),()=>s(void 0)),A=e=>e.map(e=>t(`sandbox.scope.${e}`)).join(` · `),j=e=>new Intl.DateTimeFormat(void 0,{month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)),M=w?.editing;return x(`div`,{className:`flex flex-col gap-3 p-4`,children:[x(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[b(`p`,{className:`max-w-xl text-xs leading-5 text-muted-foreground`,children:t(`sandbox.credential.hint`)}),x(G,{size:`sm`,onClick:()=>{l(``),s({name:``,scopes:[`read`]})},children:[b(Xn,{}),t(`sandbox.credential.create`)]})]}),i&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:i}),n.map(e=>x(`article`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg px-3 py-2.5 ring-1 ring-border`,children:[x(`button`,{type:`button`,className:`flex min-w-0 flex-col gap-0.5 text-left`,onClick:()=>{l(``),s({editing:e,name:e.name,scopes:[...e.scopes]})},children:[b(`strong`,{className:`truncate text-xs font-medium`,children:e.name}),x(`small`,{className:`text-[11px] text-muted-foreground`,children:[A(e.scopes),` · `,j(e.createdAt)]})]}),x(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[b(ei,{variant:e.enabled?`secondary`:`outline`,children:t(e.enabled?`sandbox.env.enabled`:`sandbox.env.disabled`)}),b(G,{size:`sm`,variant:`outline`,onClick:()=>{l(``),s({editing:e,name:e.name,scopes:[...e.scopes]})},children:t(`sandbox.credential.view`)}),b(G,{size:`sm`,variant:`outline`,onClick:()=>void S(t(`sandbox.common.failed`),()=>Id(`onebot-sandbox.set-test-credential-enabled`,{id:e.id,enabled:!e.enabled})),children:t(e.enabled?`sandbox.credential.disable`:`sandbox.credential.enable`)}),b(G,{size:`sm`,variant:`destructive`,onClick:()=>h(e),children:t(`sandbox.credential.revoke`)})]})]},e.id)),!n.length&&!i&&b(`p`,{className:`py-6 text-center text-xs text-muted-foreground`,children:t(`sandbox.credential.empty`)}),b(yr,{open:!!o,onOpenChange:e=>!e&&O(),children:x(Sr,{className:`flex flex-col overflow-hidden`,children:[x(Cr,{children:[b(Tr,{children:t(M?`sandbox.credential.viewTitle`:`sandbox.credential.createTitle`)}),b(Er,{children:t(M?`sandbox.credential.viewDescription`:`sandbox.credential.createDescription`)})]}),x(`div`,{className:`-mx-5 flex min-h-0 flex-col gap-4 overflow-y-auto px-5`,children:[x(`div`,{className:`flex flex-col gap-2`,children:[b(Cc,{htmlFor:`sandbox-credential-name`,children:t(`sandbox.credential.name`)}),b(Or,{id:`sandbox-credential-name`,autoComplete:`off`,value:w?.name??``,onChange:e=>s(t=>t&&{...t,name:e.target.value})})]}),x(`fieldset`,{className:`flex flex-col gap-2`,children:[b(`legend`,{className:`mb-2 text-sm font-medium`,children:t(`sandbox.credential.scopes`)}),b(`div`,{className:`grid grid-cols-2 gap-2`,children:qv.map(e=>x(`label`,{className:`flex items-center gap-2 text-sm`,children:[b(dc,{checked:w?.scopes.includes(e)??!1,onCheckedChange:t=>s(n=>n&&{...n,scopes:t===!0?[...new Set([...n.scopes,e])]:n.scopes.filter(t=>t!==e)})}),t(`sandbox.scope.${e}`)]},e))})]}),M&&x(`div`,{className:`flex flex-col gap-2`,children:[b(Cc,{children:`Token`}),M.token?x(`div`,{className:`flex items-center gap-2`,children:[b(`code`,{className:`min-w-0 flex-1 rounded-md bg-muted px-2.5 py-2 font-mono text-xs break-all`,children:M.token}),b(G,{size:`icon-sm`,variant:`ghost`,"aria-label":t(`sandbox.credential.copy`),onClick:()=>void C(M.token),children:b(Tn,{})})]}):b(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:t(`sandbox.credential.noPlainToken`)}),b(G,{size:`sm`,variant:`outline`,className:`self-start`,disabled:u,onClick:()=>void y(),children:t(M.token?`sandbox.credential.rotate`:`sandbox.credential.generate`)}),x(`p`,{className:`text-[11px] text-muted-foreground`,children:[t(`sandbox.credential.createdAt`,{time:j(M.createdAt)}),` · `,t(M.enabled?`sandbox.env.enabled`:`sandbox.env.disabled`)]})]}),c&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:c})]}),x(wr,{children:[b(G,{variant:`outline`,onClick:O,children:t(`sandbox.common.cancel`)}),b(G,{disabled:u,onClick:()=>void v(),children:t(M?`sandbox.common.save`:`sandbox.credential.createAction`)})]}),k]})}),b(yr,{open:!!f,onOpenChange:e=>!e&&p(``),children:x(Sr,{children:[x(Cr,{children:[b(Tr,{children:t(`sandbox.credential.tokenTitle`)}),b(Er,{children:t(`sandbox.credential.tokenDescription`)})]}),x(`div`,{className:`flex items-center gap-2`,children:[b(Or,{readOnly:!0,value:E,className:`font-mono text-xs!`}),b(G,{size:`icon-sm`,variant:`ghost`,"aria-label":t(`sandbox.credential.copy`),onClick:()=>void C(E),children:b(Tn,{})})]}),b(wr,{children:b(G,{onClick:()=>p(``),children:t(`sandbox.credential.saved`)})})]})}),b(Ur,{open:!!m,onOpenChange:e=>!e&&h(void 0),children:x(Kr,{children:[x(qr,{children:[b(Yr,{children:t(`sandbox.credential.revokeTitle`,{name:T?.name??``})}),b(Xr,{children:t(`sandbox.credential.revokeDescription`)})]}),x(Jr,{children:[b(Qr,{children:t(`sandbox.common.cancel`)}),b(Zr,{variant:`destructive`,onClick:()=>{let e=m;h(void 0),e&&S(t(`sandbox.common.failed`),()=>Id(`onebot-sandbox.revoke-test-credential`,{id:e.id}))},children:t(`sandbox.credential.revoke`)})]})]})})]})}function ry(){let[t,n]=e.useState([]),[r,i]=e.useState(``),a=e.useCallback(async()=>{try{n(await Id(`onebot-sandbox.test-spaces`,void 0)),i(``)}catch(e){i(zd(e))}},[]);return e.useEffect(()=>{a()},[a]),{spaces:t,error:r,reload:a}}function iy(e){return e}function ay(e,t=[],n=iy){return[...ud(e).map(e=>({...e,avatar:n(e.avatar),source:{type:`main`,name:`主环境`}})),...t.flatMap(e=>ud(e.snapshot).map(t=>({...t,avatar:n(t.avatar),source:{type:`test-space`,spaceId:e.id,name:e.name}})))]}function oy(e,t=[],n=iy){return{users:ld(e).map(e=>({...e,avatar:n(e.avatar)})),bots:ay(e,t,n),groups:e.groups.map(e=>({...e,avatar:n(e.avatar)}))}}var sy={users:`user`,bots:`bot`,groups:`group`};function cy(){let t=J(),{snapshot:n,resolveAvatar:r,operator:i}=Yd(),{spaces:a}=ry(),o=e.useMemo(()=>oy(n,a,r),[n,a,r]),[s,c]=e.useState(`users`),l=e.useRef(null),u=Jv(()=>Id(`onebot-sandbox.mcp-capabilities`,void 0),t(`sandbox.env.mcpFailed`)),d=Jv(()=>Id(`onebot-sandbox.http-capabilities`,void 0),t(`sandbox.env.httpFailed`)),f=u.load,p=d.load;e.useEffect(()=>{f(),p()},[f,p]);let m=[{id:`directory`,items:[{id:`users`,icon:dr,count:o.users.length},{id:`bots`,icon:pn,count:o.bots.length},{id:`groups`,icon:fr,count:o.groups.length}]},{id:`endpoint`,items:[{id:`mcp`,icon:nr,count:u.catalog?.tools.length},{id:`http`,icon:pr,count:d.catalog?.routes.length},{id:`credentials`,icon:Vn}]}],h=sy[s],g=e=>{c(e),l.current?.scrollTo({top:0})};return x(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden px-6 pt-3 pb-6 text-sm leading-5`,children:[b(`p`,{className:`text-xs text-muted-foreground`,children:t(`sandbox.env.description`)}),x(`div`,{className:`grid min-h-0 flex-1 grid-rows-[auto_minmax(0,1fr)] gap-4 md:grid-cols-[14rem_minmax(0,1fr)] md:grid-rows-1`,children:[b(`nav`,{"aria-label":t(`sandbox.env.sections`),className:`sandbox-scroll-strip flex gap-0.5 self-start overflow-x-auto rounded-xl p-1.5 ring-1 ring-border md:flex-col md:overflow-x-visible`,children:m.map((n,r)=>x(e.Fragment,{children:[r>0&&b(`div`,{role:`separator`,className:`mx-1 w-px shrink-0 bg-border md:hidden`}),b(`p`,{className:U(`hidden px-2.5 pt-1.5 pb-1 text-[11px] leading-4 font-medium text-muted-foreground md:block`,r>0&&`md:mt-2`),children:t(`sandbox.env.nav.${n.id}`)}),n.items.map(({id:e,icon:n,count:r})=>x(G,{variant:`ghost`,className:U(`shrink-0 justify-start md:w-full`,s===e&&`bg-accent text-accent-foreground`),"aria-current":s===e?`page`:void 0,onClick:()=>g(e),children:[b(n,{}),b(`span`,{children:t(`sandbox.env.section.${e}.label`)}),r!==void 0&&b(`span`,{className:U(`ml-auto pl-2 text-xs tabular-nums`,s===e?`text-foreground/70`:`text-muted-foreground`),children:r})]},e))]},n.id))}),x(`section`,{"aria-label":t(`sandbox.env.section.${s}.label`),className:`flex min-h-0 flex-col overflow-hidden rounded-xl ring-1 ring-border`,children:[x(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-border px-5 py-3.5`,children:[x(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[b(`h2`,{className:`text-sm leading-5 font-semibold`,children:t(`sandbox.env.section.${s}.label`)}),b(`p`,{className:`text-xs leading-4 text-muted-foreground`,children:t(`sandbox.env.section.${s}.description`)})]}),h&&b(jg,{type:h,operator:i,bots:ud(n),side:`bottom`,trigger:x(G,{size:`sm`,variant:`outline`,className:`shrink-0`,children:[b(Xn,{}),t(`sandbox.create.${h}`)]})},h)]}),x(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[x(`div`,{ref:l,className:`sandbox-env-scroller min-h-0 flex-1 overflow-y-auto`,children:[s===`users`&&b(ly,{icon:dr,empty:t(`sandbox.env.noUser`),children:o.users.map(e=>b(uy,{target:{type:`user`,id:e.id},avatar:b(Hf,{kind:`user`,name:e.name,src:e.avatar,className:`size-10`}),title:e.name,subtitle:e.id},e.id))}),s===`bots`&&b(ly,{icon:pn,empty:t(`sandbox.env.noBot`),children:o.bots.map(e=>{let n={avatar:b(Hf,{kind:`bot`,name:e.name,src:e.avatar,className:`size-10`}),title:e.name,subtitle:e.id,meta:x(y,{children:[b(ei,{variant:`secondary`,children:Ag(e.implementation)}),b(ei,{variant:`outline`,className:`max-w-40`,children:b(`span`,{className:`truncate`,children:ad(t,e.source)})}),b(fy,{enabled:e.enabled})]})};return e.source.type===`main`?b(uy,{target:{type:`bot`,id:e.id},...n},`main:${e.id}`):b(dy,{...n},`space:${e.source.spaceId}:${e.id}`)})}),s===`groups`&&b(ly,{icon:fr,empty:t(`sandbox.env.noGroup`),children:o.groups.map(e=>b(uy,{target:{type:`group`,id:e.id},avatar:b(Hf,{kind:`group`,name:e.name,src:e.avatar,className:`size-10`}),title:e.name,subtitle:t(`sandbox.env.groupSubtitle`,{id:e.id,count:e.members.length})},e.id))}),s===`credentials`&&b(ny,{}),s===`mcp`&&b($v,{catalog:u.catalog,loading:u.loading,error:u.error,onRetry:()=>void u.load()}),s===`http`&&b(ey,{catalog:d.catalog,loading:d.loading,error:d.error,onRetry:()=>void d.load()})]}),b(G_,{target:l,className:`sandbox-env-scrollbar`})]})]})]})]})}function ly({icon:e,empty:t,children:n}){return n.length?b(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3 p-4`,children:n}):x(`div`,{className:`flex flex-col items-center gap-3 px-6 py-16 text-center`,children:[b(`span`,{className:`flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground`,children:b(e,{className:`size-5`})}),b(`p`,{className:`text-xs text-muted-foreground`,children:t})]})}function uy({target:e,...t}){let n=J(),{dialogs:r}=Jd(),i=n(`sandbox.kind.${e.type}`),a=n(`sandbox.menu.editEntity`,{kind:i}),o=n(`sandbox.menu.deleteEntity`,{kind:i}),s=()=>r.openEntity(`edit`,e),c=()=>r.openEntity(`delete`,e);return x(gc,{children:[b(_c,{render:b(dy,{...t,onEdit:s,actions:x(y,{children:[b(G,{size:`icon-sm`,variant:`ghost`,"aria-label":a,onClick:s,children:b(Jn,{})}),b(G,{size:`icon-sm`,variant:`ghost`,"aria-label":o,className:`hover:text-destructive`,onClick:c,children:b(or,{})})]})})}),x(vc,{className:`sandbox-glass`,children:[x(q,{onClick:s,children:[b(Jn,{}),a]}),x(q,{variant:`destructive`,onClick:c,children:[b(or,{}),o]})]})]})}var dy=e.forwardRef(function({avatar:e,title:t,subtitle:n,meta:r,onEdit:i,actions:a,className:o,...s},c){return x(`article`,{ref:c,className:U(`relative flex flex-col gap-3 rounded-xl bg-muted/30 p-3.5 ring-1 ring-border/70`,i&&`group transition-[background-color,box-shadow] duration-150 hover:bg-muted/60 hover:ring-border`,o),...s,children:[x(`div`,{className:`flex items-center gap-3`,children:[e,x(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[i?b(`button`,{type:`button`,className:`block w-full truncate text-left text-[13px] leading-5 font-medium outline-none after:absolute after:inset-0 after:rounded-xl focus-visible:after:ring-2 focus-visible:after:ring-ring/50`,onClick:i,children:t}):b(`strong`,{className:`truncate text-[13px] leading-5 font-medium`,children:t}),b(`small`,{className:`truncate text-xs leading-4 text-muted-foreground tabular-nums`,children:n})]}),a&&b(`span`,{className:`relative z-10 -my-1 -mr-1.5 flex shrink-0 items-center gap-0.5 self-start text-muted-foreground opacity-0 transition-opacity duration-150 group-focus-within:opacity-100 group-hover:opacity-100`,children:a})]}),r&&b(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:r})]})});function fy({enabled:e}){let t=J();return x(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] leading-5 text-muted-foreground`,children:[b(`span`,{"aria-hidden":!0,className:U(`size-1.5 rounded-full`,e?`bg-emerald-500`:`bg-muted-foreground/40`)}),t(e?`sandbox.env.enabled`:`sandbox.env.disabled`)]})}function py(e){if(!Number.isFinite(e)||e<0)return`—`;if(e<1e3)return`${Math.round(e)} ms`;if(e<6e4){let t=e/1e3;return`${my(t,t<10?2:1)} s`}let t=Math.round(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=[];return n&&a.push(`${n} h`),r&&a.push(`${r} min`),(i||!a.length)&&a.push(`${i} s`),a.join(` `)}function my(e,t){return String(Number(e.toFixed(t)))}var hy=2e3;function gy({title:t,description:n,loading:r,error:i,live:a,onLiveChange:o,onRefresh:s,clear:c,children:l}){let u=J(),[d,f]=e.useState(!1);return x(`section`,{"aria-label":t,className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden px-6 pt-3 pb-6 text-sm leading-5`,children:[x(`header`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[b(`p`,{className:`min-w-0 text-xs text-muted-foreground`,children:n}),x(`div`,{className:`flex items-center gap-2`,children:[x(`label`,{className:`mr-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[b(Pc,{checked:a,onCheckedChange:e=>o(e===!0)}),u(`sandbox.records.live`)]}),x(G,{variant:`outline`,size:`sm`,disabled:r,onClick:s,children:[b(Zn,{}),u(`sandbox.records.refresh`)]}),x(G,{variant:`outline`,size:`sm`,className:`text-destructive`,disabled:r||c.disabled,onClick:()=>f(!0),children:[b(or,{}),c.label]})]})]}),i&&b(`p`,{role:`alert`,className:`text-xs text-destructive`,children:i}),b(`div`,{className:`grid min-h-0 flex-1 grid-rows-[minmax(10rem,40%)_minmax(0,1fr)] gap-4 md:grid-cols-[minmax(16rem,22rem)_minmax(0,1fr)] md:grid-rows-1`,children:l}),b(Ur,{open:d,onOpenChange:f,children:x(Kr,{children:[x(qr,{children:[b(Yr,{children:c.title}),b(Xr,{children:c.description})]}),x(Jr,{children:[b(Qr,{children:u(`sandbox.common.cancel`)}),b(Zr,{variant:`destructive`,onClick:()=>{f(!1),c.onConfirm()},children:c.label})]})]})})]})}function _y({label:t,order:n,onToggleOrder:r,filter:i,loading:a,empty:o,children:s}){let c=J(),l=e.useRef(null),u=n===`asc`?cn:an;return x(`section`,{"aria-label":t,className:`flex min-h-0 flex-col overflow-hidden rounded-xl ring-1 ring-border`,children:[x(`header`,{className:`flex h-12 shrink-0 items-center justify-between gap-2 border-b border-border pr-2 pl-4`,children:[b(`h2`,{className:`text-[13px] font-medium`,children:t}),x(`div`,{className:`flex items-center gap-1`,children:[x(G,{variant:`ghost`,size:`sm`,"aria-label":c(n===`asc`?`sandbox.records.orderAscHint`:`sandbox.records.orderDescHint`),onClick:r,children:[b(u,{}),c(n===`asc`?`sandbox.records.orderAsc`:`sandbox.records.orderDesc`)]}),x(Lr,{open:i.open,onOpenChange:i.onOpenChange,children:[b(Rr,{render:b(G,{variant:i.active?`secondary`:`ghost`,size:`icon-sm`,"aria-label":c(`sandbox.records.filterLabel`,{summary:i.summary})}),children:b(Fn,{})}),b(zr,{align:`end`,className:`sandbox-glass flex w-72 flex-col gap-3`,children:i.content})]})]})]}),a&&o?b(`div`,{className:`flex flex-1 items-center justify-center`,children:b(Nc,{})}):o?b(`p`,{className:`flex flex-1 items-center justify-center p-6 text-center text-xs text-muted-foreground`,children:c(`sandbox.records.empty`)}):x(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[b(`div`,{ref:l,className:`sandbox-record-scroller flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5`,children:s}),b(G_,{target:l,className:`sandbox-record-scrollbar`})]})]})}function vy({active:e,onClick:t,title:n,status:r,tag:i,time:a,duration:o,meta:s=[]}){let c=J();return x(`button`,{type:`button`,"aria-current":e?`true`:void 0,className:U(`sandbox-record-item`,e&&`is-active`),onClick:t,children:[x(`span`,{className:`flex min-w-0 items-center gap-2`,children:[b(`span`,{role:`img`,"aria-label":c(r===`error`?`sandbox.records.statusError`:`sandbox.records.statusSuccess`),className:U(`sandbox-record-dot`,r===`error`&&`is-error`)}),b(`strong`,{className:U(`min-w-0 flex-1 truncate font-mono text-[13px] leading-5 font-medium`,r===`error`&&`text-destructive`),children:n}),i&&b(yy,{children:i})]}),x(`span`,{className:`sandbox-record-item-meta`,children:[b(`time`,{dateTime:a,title:Py(a),children:Ny(a)}),b(`span`,{children:py(o)}),s.map((e,t)=>b(`span`,{className:`min-w-0 truncate`,children:e},t))]})]})}function yy({children:e}){return b(`span`,{className:`sandbox-record-tag`,children:e})}function by({time:e,duration:t}){return x(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-muted-foreground tabular-nums`,children:[x(`time`,{dateTime:e,className:`flex items-center gap-1`,children:[b(gn,{className:`size-3.5`}),Py(e)]}),x(`span`,{className:`flex items-center gap-1`,children:[b(wn,{className:`size-3.5`}),py(t)]})]})}function xy({label:t,loading:n,header:r,scrollKey:i,children:a}){let o=J(),s=e.useRef(null);return e.useLayoutEffect(()=>{s.current?.scrollTo({top:0})},[i]),b(`section`,{"aria-label":t,className:`flex min-h-0 flex-col overflow-hidden rounded-xl ring-1 ring-border`,children:a?x(y,{children:[r,x(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[b(`article`,{ref:s,className:`sandbox-record-scroller flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-5 pt-4 pb-6`,children:a}),b(G_,{target:s,className:`sandbox-record-scrollbar`})]})]}):n?b(`div`,{className:`flex flex-1 items-center justify-center`,children:b(Nc,{})}):b(`p`,{className:`flex flex-1 items-center justify-center p-6 text-center text-xs text-muted-foreground`,children:o(`sandbox.records.pick`)})})}function Sy({title:e,badges:t,time:n,duration:r}){return x(`header`,{className:`flex shrink-0 flex-col gap-1.5 border-b border-border px-5 py-3.5`,children:[x(`span`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[b(`h2`,{className:`min-w-0 truncate font-mono text-[15px] leading-6 font-semibold`,children:e}),t]}),b(by,{time:n,duration:r})]})}function Cy({status:e}){let t=J();return e===`error`?b(ei,{variant:`destructive`,children:t(`sandbox.records.statusError`)}):b(ei,{variant:`secondary`,className:`text-emerald-700 dark:text-emerald-400`,children:t(`sandbox.records.statusSuccess`)})}function wy({children:e}){return b(`dl`,{className:`sandbox-record-meta`,children:e})}function Ty({icon:e,label:t,value:n,wide:r}){return x(`div`,{className:U(`sandbox-record-meta-item`,r&&`is-wide`),children:[x(`dt`,{className:`sandbox-record-meta-label`,children:[b(e,{}),t]}),b(`dd`,{className:`sandbox-record-meta-value`,children:n})]})}function Ey({items:e}){return b(`span`,{className:`sandbox-record-chips`,children:e.map(([e,t])=>x(`span`,{className:`sandbox-record-chip`,children:[b(`span`,{className:`sandbox-record-chip-key`,children:e}),t]},e))})}function Dy({icon:e,title:t,tone:n,children:r}){return x(`section`,{className:U(`sandbox-record-notice`,n===`destructive`&&`is-destructive`),children:[b(e,{}),x(`div`,{className:`min-w-0`,children:[b(`h3`,{className:`sandbox-record-notice-title`,children:t}),b(`div`,{className:`sandbox-record-notice-body`,children:r})]})]})}function Oy({icon:e,title:t,children:n}){return x(`section`,{className:`flex flex-col gap-2`,children:[x(`h3`,{className:`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[b(e,{className:`size-3.5`}),t]}),n]})}var ky=/("(?:\\.|[^"\\])*")(\s*:)?|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|[{}[\],]/g;function Ay(e){let t=[],n=0;for(let r of e.matchAll(ky)){let[i,a,o]=r;r.index>n&&t.push(e.slice(n,r.index));let s=a===void 0?/^[{}[\],]$/.test(i)?`punct`:/^[tfn]/.test(i)?`literal`:`number`:o?`key`:`string`;t.push(b(`span`,{className:`sandbox-json-${s}`,children:a??i},r.index)),o&&t.push(o),n=r.index+i.length}return n<e.length&&t.push(e.slice(n)),t}function jy({value:t}){let n=J(),r=e.useMemo(()=>JSON.stringify(t,null,2)??String(t),[t]),i=e.useMemo(()=>Ay(r),[r]),[a,o]=e.useState(!1);e.useEffect(()=>{if(!a)return;let e=setTimeout(()=>o(!1),1500);return()=>clearTimeout(e)},[a]);let s=async()=>{try{await navigator.clipboard.writeText(r),o(!0)}catch{L.error(n(`sandbox.records.copyFailed`))}};return x(`div`,{className:`sandbox-record-code`,children:[b(`pre`,{children:i}),b(G,{variant:`outline`,size:`icon-sm`,className:`sandbox-record-code-copy`,"aria-label":n(a?`sandbox.records.copied`:`sandbox.records.copy`),onClick:()=>void s(),children:b(a?vn:Tn,{})})]})}function My({label:e,children:t}){return x(`label`,{className:`flex flex-col gap-1.5 text-xs`,children:[b(`span`,{className:`text-muted-foreground`,children:e}),t]})}function Ny(e){let t=new Date(e),n=Py(e),r=new Date;return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()?n.slice(11):n.slice(5)}function Py(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function Fy(t,n){let r=e.useRef(n);r.current=n,e.useEffect(()=>{r.current()},[]),e.useEffect(()=>{if(!t)return;let e,n=()=>{let t=document.visibilityState===`visible`;t&&!e&&(e=setInterval(()=>r.current(),hy)),!t&&e&&(clearInterval(e),e=void 0)};return n(),document.addEventListener(`visibilitychange`,n),()=>{document.removeEventListener(`visibilitychange`,n),e&&clearInterval(e)}},[t])}function Iy(e,t,n){let r=t===`asc`?1:-1;return[...e].sort((e,t)=>r*(e.createdAt.localeCompare(t.createdAt)||n(e,t)))}var Ly={botKey:`all`,direction:`all`,action:``,requestedAction:``,errorsOnly:!1};function Ry(e){return e.type===`main`?`main`:`space:${e.spaceId}`}function zy(e){return`${Ry(e.source)}:${e.id}`}function By(e){return`${Ry(e.source)}:${e.id}`}function Vy(e){return!e||typeof e!=`object`?0:Reflect.get(e,`kind`)===`large-value`?1:Object.values(e).reduce((e,t)=>e+Vy(t),0)}function Hy(){let t=J(),{view:n}=Jd(),r=n.workspace?.snapshot,{spaces:i}=ry(),a=e.useMemo(()=>r?ay(r,i):[],[r,i]),[o,s]=e.useState([]),[c,l]=e.useState(),[u,d]=e.useState(!1),[f,p]=e.useState(!1),[m,h]=e.useState(``),[g,_]=e.useState(Ly),[v,S]=e.useState(`desc`),[C,w]=e.useState(!1),[T,E]=e.useState(!1),D=async(e=g,n=v)=>{let r={botId:e.botKey===`all`?void 0:a.find(t=>zy(t)===e.botKey)?.id,direction:e.direction===`all`?void 0:e.direction,action:e.action.trim()||void 0,requestedAction:e.requestedAction.trim()||void 0,status:e.errorsOnly?`error`:void 0,order:n};d(!0);try{s((await Id(`onebot-sandbox.debug-records`,r)).records),h(``)}catch(e){h(zd(e,t(`sandbox.debug.loadFailed`)))}finally{d(!1)}},O=async e=>{p(!0);try{l(await Id(`onebot-sandbox.debug-record`,{recordId:e.id,includeLargeValues:!0,...e.source.type===`test-space`?{spaceId:e.source.spaceId}:{}})),h(``)}catch(e){h(zd(e,t(`sandbox.debug.detailFailed`)))}finally{p(!1)}},k=()=>{D(),c&&O(c)};Fy(T,k);let A=(e,t=!1)=>{let n={...g,...e};_(n),t&&D(n)},j=g.botKey!==`all`||g.direction!==`all`||!!g.action.trim()||!!g.requestedAction.trim()||g.errorsOnly,M=[g.botKey===`all`?``:a.find(e=>zy(e)===g.botKey)?.name??g.botKey,g.direction===`all`?``:t(`sandbox.debug.direction.${g.direction}`),g.action.trim(),g.requestedAction.trim(),g.errorsOnly?t(`sandbox.records.errorsOnly`):``].filter(Boolean).join(` · `)||t(`sandbox.records.noFilter`),N=e=>a.find(t=>t.id===e.botId&&Ry(t.source)===Ry(e.source))?.name??e.botId,ee=c?By(c):void 0,P=[{value:`all`,label:t(`sandbox.debug.allBots`)},...a.map(e=>({value:zy(e),label:`${e.name} · ${e.id} · ${ad(t,e.source)}`}))],F=[`all`,`action`,`event`].map(e=>({value:e,label:t(`sandbox.debug.direction.${e}`)}));return x(gy,{title:t(`sandbox.debug.title`),description:t(`sandbox.debug.description`),loading:u,error:m,live:T,onLiveChange:E,onRefresh:k,clear:{label:t(`sandbox.debug.clear`),title:t(`sandbox.debug.clearTitle`),description:t(`sandbox.debug.clearDescription`),disabled:!o.length,onConfirm:async()=>{try{await Id(`onebot-sandbox.clear-debug-records`,{}),l(void 0),await D()}catch(e){h(zd(e,t(`sandbox.debug.clearFailed`)))}}},children:[b(_y,{label:t(`sandbox.records.list`),order:v,onToggleOrder:()=>{let e=v===`desc`?`asc`:`desc`;S(e),D(g,e)},loading:u,empty:!o.length,filter:{active:j,summary:M,open:C,onOpenChange:e=>{w(e),e||D()},content:x(y,{children:[b(My,{label:t(`sandbox.debug.bot`),children:x(Ec,{value:g.botKey,onValueChange:e=>e&&A({botKey:e}),items:P,children:[b(Oc,{className:`w-full`,children:b(Dc,{})}),x(kc,{className:`sandbox-glass`,children:[b(Ac,{value:`all`,children:t(`sandbox.debug.allBots`)}),a.map(e=>x(Ac,{value:zy(e),children:[b(Hf,{kind:`bot`,name:e.name,src:e.avatar,className:`size-5`,badge:!1}),x(`span`,{className:`truncate`,children:[e.name,` · `,e.id,` · `,ad(t,e.source)]})]},zy(e)))]})]})}),b(My,{label:t(`sandbox.debug.directionLabel`),children:x(Ec,{value:g.direction,onValueChange:e=>e&&A({direction:e}),items:F,children:[b(Oc,{className:`w-full`,children:b(Dc,{})}),b(kc,{className:`sandbox-glass`,children:F.map(e=>b(Ac,{value:e.value,children:e.label},e.value))})]})}),b(My,{label:t(`sandbox.debug.action`),children:b(Or,{value:g.action,placeholder:`get_group_info`,onChange:e=>A({action:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void D()})}),b(My,{label:t(`sandbox.debug.requestedAction`),children:b(Or,{value:g.requestedAction,placeholder:`getGroupInfo`,onChange:e=>A({requestedAction:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void D()})}),x(`label`,{className:`flex items-center gap-2 text-xs`,children:[b(dc,{checked:g.errorsOnly,onCheckedChange:e=>A({errorsOnly:e===!0},!0)}),t(`sandbox.records.errorsOnly`)]}),b(G,{variant:`outline`,size:`sm`,onClick:()=>{_(Ly),D(Ly)},children:t(`sandbox.records.reset`)})]})},children:Iy(o,v,(e,t)=>e.sequence-t.sequence).map(e=>b(vy,{active:By(e)===ee,onClick:()=>void O(e),title:e.requestedAction,status:e.status,tag:e.direction.toUpperCase(),time:e.createdAt,duration:e.durationMs,meta:[ad(t,e.source)]},By(e)))}),b(xy,{label:t(`sandbox.records.detail`),loading:f,scrollKey:ee,header:c&&b(Sy,{title:c.requestedAction,time:c.createdAt,duration:c.durationMs,badges:x(y,{children:[b(Cy,{status:c.status}),b(yy,{children:c.direction.toUpperCase()})]})}),children:c&&b(Uy,{record:c,botName:N(c)})})]})}function Uy({record:e,botName:t}){let n=J(),r=Object.entries(e.entities).filter(e=>!!e[1]),i=e.conversationObservation,a=e.direction===`action`;return x(y,{children:[e.error&&x(Dy,{icon:Cn,title:n(`sandbox.records.diagnosis`),tone:`destructive`,children:[b(`span`,{className:`font-mono`,children:e.error.code}),` · `,e.error.message,x(`span`,{className:`mt-0.5 block font-mono text-[11px]`,children:[`trace `,e.error.traceId]})]}),i&&b(Dy,{icon:In,title:n(`sandbox.debug.observation.${i.kind}.title`),children:n(`sandbox.debug.observation.${i.kind}.detail`,{event:i.eventConversationId,actual:i.conversationId})}),x(wy,{children:[b(Ty,{icon:pn,label:n(`sandbox.debug.bot`),value:x(y,{children:[t,` `,b(`span`,{className:`font-mono font-normal text-muted-foreground`,children:e.botId})]})}),b(Ty,{icon:mn,label:n(`sandbox.debug.source`),value:ad(n,e.source)}),b(Ty,{icon:Dn,label:n(`sandbox.debug.implementation`),value:Ag(e.implementation)}),e.action!==e.requestedAction&&b(Ty,{icon:sn,label:n(`sandbox.debug.action`),value:b(`span`,{className:`font-mono`,children:e.action})}),e.matchedAlias&&b(Ty,{icon:ar,label:n(`sandbox.debug.alias`),value:b(`span`,{className:`font-mono`,children:e.matchedAlias})}),b(Ty,{icon:Hn,label:n(`sandbox.debug.entities`),wide:!0,value:r.length?b(Ey,{items:r}):b(`span`,{className:`font-normal text-muted-foreground`,children:n(`sandbox.debug.noEntities`)})})]}),e.payload!==void 0&&x(Oy,{icon:hn,title:n(a?`sandbox.debug.input`:`sandbox.debug.eventData`),children:[b(jy,{value:e.payload}),Vy(e.payload)>0&&b(`p`,{className:`text-[11px] text-muted-foreground`,children:n(`sandbox.debug.folded`,{count:Vy(e.payload)})})]}),e.result!==void 0&&x(Oy,{icon:hn,title:n(a?`sandbox.debug.output`:`sandbox.debug.handled`),children:[b(jy,{value:e.result}),Vy(e.result)>0&&b(`p`,{className:`text-[11px] text-muted-foreground`,children:n(`sandbox.debug.folded`,{count:Vy(e.result)})})]})]})}var Wy={dirty:!1},Gy=new Set,Ky=e=>{e.preventDefault()};function qy(e){e.dirty!==Wy.dirty&&(e.dirty?window.addEventListener(`beforeunload`,Ky):window.removeEventListener(`beforeunload`,Ky)),Wy=e;for(let e of Gy)e()}var Jy=e=>(Gy.add(e),()=>Gy.delete(e)),Yy=()=>Wy,Xy={setValue:e=>qy({value:e,dirty:e!==void 0&&Wy.dirty}),setDirty:e=>{e!==Wy.dirty&&qy({...Wy,dirty:e})}};function Zy(){return e.useSyncExternalStore(Jy,Yy,Yy)}var Qy=`chatluna-plugin-onebot-sandbox`,$y=`1.0.2`;function eb(){let e=J(),t=[{label:e(`sandbox.settings.about.version`),value:$y,mono:!0},{label:e(`sandbox.settings.about.package`),value:Qy,mono:!0},{label:e(`sandbox.settings.about.license`),value:`MIT`},{label:e(`sandbox.settings.about.protocol`),value:`OneBot v11`},{label:e(`sandbox.settings.about.host`),value:`ChatLuna v2`}];return x(`div`,{className:`flex flex-col gap-5`,children:[x(`div`,{className:`flex items-center gap-3`,children:[b(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary`,children:b(Pn,{className:`size-5`})}),x(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x(`div`,{className:`flex flex-wrap items-center gap-2`,children:[b(`h3`,{className:`text-[15px] leading-5 font-semibold`,children:e(`onebot-sandbox.title`)}),x(ei,{variant:`outline`,className:`font-mono`,children:[`v`,$y]})]}),b(`p`,{className:`text-xs text-muted-foreground`,children:e(`sandbox.settings.about.summary`)})]})]}),b(`dl`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] gap-x-6 gap-y-2.5 border-t border-border pt-4 text-[13px] leading-5`,children:t.map(e=>x(`div`,{className:`contents`,children:[b(`dt`,{className:`text-muted-foreground`,children:e.label}),b(`dd`,{className:e.mono?`font-mono text-xs leading-5 break-all`:void 0,children:e.value})]},e.label))})]})}var tb=`sandbox.settings.schema.`,nb=[`label`,`description`];function rb(e,t,n,r,i){let a=e.refs[t];if(!a)return;let o=a.meta?.i18n,s=typeof o==`string`?o:n;if(s&&i(t,s),a.type===`object`)for(let[t,n]of Object.entries(a.dict??{})){let a=r?`${r}.${t}`:t;rb(e,n,a,a,i)}else if(a.type===`intersect`)for(let t of a.list??[])rb(e,t,void 0,r,i);else if(a.type===`array`&&a.inner!==void 0)rb(e,a.inner,void 0,r,i);else if(a.type===`union`)for(let t of a.list??[]){let n=e.refs[t];n?.type===`const`&&rb(e,t,`${r}.option.${String(n.value)}`,r,i)}}function ib(e,t){let n={...e.refs};return rb(e,e.uid,void 0,``,(e,r)=>{let i=n[e],a={...i.meta};for(let e of nb){if(typeof a[e]!=`string`||!a[e])continue;let n=`${tb}${r}.${e}`,i=t(n);i!==n&&(a[e]=i)}n[e]={...i,meta:a}}),{uid:e.uid,refs:n}}var ab={sandboxAccentColor:Kn,persistenceMode:kn,testEndpoint:nr},ob=(e,t)=>JSON.stringify(e)===JSON.stringify(t),sb=e=>typeof e==`string`&&e?e:void 0;function cb(e,t){let n=e[t];return n?.type===`intersect`?(n.list??[]).flatMap(t=>cb(e,t)):Object.keys(n?.dict??{})}function lb(e,t){let n=e.refs[e.uid];return(n?.type===`intersect`?n.list??[]:[e.uid]).map(n=>{let r=e.refs[n],{label:i,description:a,...o}=r.meta??{},s={...r,meta:o};return{title:sb(i)??sb(a)??t,description:sb(i)?sb(a):void 0,schema:{uid:n,refs:{...e.refs,[n]:s}},keys:cb(e.refs,n)}})}function ub(){let t=J(),n=R(`onebot-sandbox.settings`),r=se(),i=Zy().value,a=Xy.setValue,[o,s]=e.useState(),[c,l]=e.useState(!1),[u,d]=e.useState(0),f=e.useRef(null),p=n.data,m=o&&o.revision===p?.revision?o.value:p?.value,h=i??m??{},g=i!==void 0&&!ob(i,m);e.useEffect(()=>{p&&Xy.setDirty(g)},[p,g]);let _=t(`sandbox.nav.settings`),v=e.useMemo(()=>p?lb(ib(p.schema,t),_):[],[p,t,_]),y=u===`about`,S=y?void 0:v[Math.min(u,v.length-1)],C=y?t(`sandbox.settings.about.title`):S?.title,w=y?t(`sandbox.settings.about.description`):S?.description,T=()=>{a(void 0),r.reset()},E=async()=>{if(!(!p||!i)){if(!r.attempt()){L.error(t(`sandbox.settings.invalid`));return}l(!0);try{await ne(`onebot-sandbox.settings.save`,{config:i,revision:p.revision}),s({revision:p.revision,value:i}),a(void 0),r.reset(),L.success(t(`sandbox.settings.saved`))}catch(e){L.error(t(`sandbox.settings.saveFailed`),{description:te(e)})}finally{l(!1)}}},D=e=>{d(e),f.current?.scrollTo({top:0})};return x(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden px-6 pt-3 pb-6 text-sm leading-5`,children:[x(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[b(`p`,{className:`min-w-0 text-xs text-muted-foreground`,children:t(`sandbox.settings.description`)}),x(`div`,{className:`flex items-center gap-2`,children:[g&&b(`span`,{className:`text-xs text-muted-foreground`,children:t(`sandbox.settings.unsaved`)}),x(G,{variant:`outline`,size:`sm`,disabled:!g||c,onClick:T,children:[b(sr,{}),t(`sandbox.settings.discard`)]}),x(G,{size:`sm`,disabled:!g||c,onClick:()=>void E(),children:[b(c?Nc:$n,{}),t(c?`sandbox.common.saving`:`sandbox.common.save`)]})]})]}),p&&v.length?x(`div`,{className:`grid min-h-0 w-full max-w-5xl flex-1 grid-rows-[auto_minmax(0,1fr)] gap-4 md:grid-cols-[14rem_minmax(0,1fr)] md:grid-rows-1`,children:[x(`nav`,{"aria-label":t(`sandbox.settings.sections`),className:`sandbox-scroll-strip flex gap-0.5 self-start overflow-x-auto rounded-xl p-1.5 ring-1 ring-border md:flex-col md:overflow-x-visible`,children:[v.map((e,n)=>{let r=ab[e.keys[0]??``]??ir,a=i!==void 0&&e.keys.some(e=>!ob(i[e],m?.[e]));return x(G,{variant:`ghost`,className:U(`shrink-0 justify-start md:w-full`,e===S&&`bg-accent text-accent-foreground`),"aria-current":e===S?`page`:void 0,onClick:()=>D(n),children:[b(r,{}),b(`span`,{children:e.title}),a&&b(`span`,{role:`img`,"aria-label":t(`sandbox.settings.unsaved`),className:`ml-auto size-1.5 shrink-0 rounded-full bg-primary`})]},n)}),b(`div`,{role:`separator`,className:`mx-1 shrink-0 bg-border max-md:w-px md:my-1 md:h-px`}),x(G,{variant:`ghost`,className:U(`shrink-0 justify-start md:w-full`,y&&`bg-accent text-accent-foreground`),"aria-current":y?`page`:void 0,onClick:()=>D(`about`),children:[b(Bn,{}),b(`span`,{children:t(`sandbox.settings.about.title`)})]})]}),x(`section`,{"aria-label":C,className:`flex min-h-0 flex-col overflow-hidden rounded-xl ring-1 ring-border`,children:[x(`header`,{className:`flex shrink-0 flex-col gap-0.5 border-b border-border px-4 py-3`,children:[b(`h2`,{className:`text-[13px] font-medium`,children:C}),w&&b(`p`,{className:`text-[11px] text-muted-foreground`,children:w})]}),x(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[b(`div`,{ref:f,className:`sandbox-settings-scroller min-h-0 flex-1 overflow-y-auto`,children:x(`fieldset`,{disabled:c,className:`sandbox-settings-form min-w-0 px-5 py-4`,children:[v.map((e,t)=>b(`div`,{hidden:e!==S,children:b(oe,{schema:e.schema,value:h,initial:m,onChange:a,validation:r,formId:`onebot-sandbox.settings`})},t)),y&&b(eb,{})]})}),b(G_,{target:f,className:`sandbox-settings-scrollbar`})]})]})]}):n.error?b(Vr,{variant:`destructive`,className:`max-w-5xl`,children:b(Hr,{children:t(`sandbox.settings.unavailableDetail`,{error:n.error})})}):b(`div`,{className:`flex justify-center py-12 text-muted-foreground`,children:b(Nc,{})})]})}var db={tool:``,credentialName:``,transport:`all`,spaceId:``,testRunId:``,errorsOnly:!1};function fb(){let t=J(),[n,r]=e.useState([]),[i,a]=e.useState(),[o,s]=e.useState(!1),[c,l]=e.useState(!1),[u,d]=e.useState(``),[f,p]=e.useState(db),[m,h]=e.useState(`desc`),[g,_]=e.useState(!1),[v,S]=e.useState(!1),C=async(e=f,n=m)=>{let i={tool:e.tool.trim()||void 0,credentialName:e.credentialName.trim()||void 0,transport:e.transport===`all`?void 0:e.transport,spaceId:e.spaceId.trim()||void 0,testRunId:e.testRunId.trim()||void 0,status:e.errorsOnly?`error`:void 0,order:n};s(!0);try{r((await Id(`onebot-sandbox.test-call-records`,i)).records),d(``)}catch(e){d(zd(e,t(`sandbox.testCall.loadFailed`)))}finally{s(!1)}},w=async e=>{l(!0);try{a(await Id(`onebot-sandbox.test-call-record`,{recordId:e})),d(``)}catch(e){d(zd(e,t(`sandbox.testCall.detailFailed`)))}finally{l(!1)}},T=()=>{C(),i&&w(i.id)};Fy(v,T);let E=(e,t=!1)=>{let n={...f,...e};p(n),t&&C(n)},D=e=>t(`sandbox.testCall.transport.${e}`),O=[f.tool,f.credentialName,f.spaceId,f.testRunId].map(e=>e.trim()),k=O.some(Boolean)||f.transport!==`all`||f.errorsOnly,A=[O[0],O[1],f.transport===`all`?``:D(f.transport),O[2],O[3],f.errorsOnly?t(`sandbox.records.errorsOnly`):``].filter(Boolean).join(` · `)||t(`sandbox.records.noFilter`),j=[{value:`all`,label:t(`sandbox.testCall.transport.all`)},{value:`mcp`,label:D(`mcp`)},{value:`http`,label:D(`http`)},{value:`chatluna`,label:D(`chatluna`)}];return x(gy,{title:t(`sandbox.testCall.title`),description:t(`sandbox.testCall.description`),loading:o,error:u,live:v,onLiveChange:S,onRefresh:T,clear:{label:t(`sandbox.testCall.clear`),title:t(`sandbox.testCall.clearTitle`),description:t(`sandbox.testCall.clearDescription`),disabled:!n.length,onConfirm:async()=>{try{await Id(`onebot-sandbox.clear-test-call-records`,void 0),a(void 0),await C()}catch(e){d(zd(e,t(`sandbox.testCall.clearFailed`)))}}},children:[b(_y,{label:t(`sandbox.records.list`),order:m,onToggleOrder:()=>{let e=m===`desc`?`asc`:`desc`;h(e),C(f,e)},loading:o,empty:!n.length,filter:{active:k,summary:A,open:g,onOpenChange:e=>{_(e),e||C()},content:x(y,{children:[b(My,{label:t(`sandbox.testCall.tool`),children:b(Or,{value:f.tool,placeholder:`send_message`,onChange:e=>E({tool:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void C()})}),b(My,{label:t(`sandbox.testCall.credential`),children:b(Or,{value:f.credentialName,onChange:e=>E({credentialName:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void C()})}),b(My,{label:t(`sandbox.testCall.transportLabel`),children:x(Ec,{value:f.transport,onValueChange:e=>e&&E({transport:e},!0),items:j,children:[b(Oc,{className:`w-full`,children:b(Dc,{})}),b(kc,{className:`sandbox-glass`,children:j.map(e=>b(Ac,{value:e.value,children:e.label},e.value))})]})}),b(My,{label:t(`sandbox.testCall.space`),children:b(Or,{value:f.spaceId,placeholder:`space-1`,onChange:e=>E({spaceId:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void C()})}),b(My,{label:t(`sandbox.testCall.testRun`),children:b(Or,{value:f.testRunId,placeholder:`run-1`,onChange:e=>E({testRunId:e.target.value}),onKeyDown:e=>e.key===`Enter`&&void C()})}),x(`label`,{className:`flex items-center gap-2 text-xs`,children:[b(dc,{checked:f.errorsOnly,onCheckedChange:e=>E({errorsOnly:e===!0},!0)}),t(`sandbox.records.errorsOnly`)]}),b(G,{variant:`outline`,size:`sm`,onClick:()=>{p(db),C(db)},children:t(`sandbox.records.reset`)})]})},children:Iy(n,m,(e,t)=>e.id.localeCompare(t.id)).map(e=>b(vy,{active:e.id===i?.id,onClick:()=>void w(e.id),title:e.tool,status:e.status,tag:e.transport.toUpperCase(),time:e.createdAt,duration:e.durationMs,meta:[e.credentialName]},e.id))}),b(xy,{label:t(`sandbox.records.detail`),loading:c,scrollKey:i?.id,header:i&&b(Sy,{title:i.tool,time:i.createdAt,duration:i.durationMs,badges:x(y,{children:[b(Cy,{status:i.status}),b(yy,{children:i.transport.toUpperCase()})]})}),children:i&&b(pb,{record:i})})]})}function pb({record:e}){let t=J();return x(y,{children:[e.error&&x(Dy,{icon:Cn,title:t(`sandbox.records.diagnosis`),tone:`destructive`,children:[b(`span`,{className:`font-mono`,children:e.error.code}),` · `,e.error.message]}),x(wy,{children:[b(Ty,{icon:Vn,label:t(`sandbox.testCall.credential`),value:e.credentialName}),b(Ty,{icon:Yn,label:t(`sandbox.testCall.transportLabel`),value:(e=>t(`sandbox.testCall.transport.${e}`))(e.transport)}),e.sourceIp&&b(Ty,{icon:Ln,label:t(`sandbox.testCall.sourceIp`),value:b(`span`,{className:`font-mono`,children:e.sourceIp})}),e.spaceId&&b(Ty,{icon:mn,label:t(`sandbox.testCall.space`),value:b(`span`,{className:`font-mono`,children:e.spaceId})}),e.testRunId&&b(Ty,{icon:ar,label:t(`sandbox.testCall.testRun`),value:b(`span`,{className:`font-mono`,children:e.testRunId})})]}),b(Oy,{icon:hn,title:t(`sandbox.testCall.arguments`),children:b(jy,{value:e.arguments})}),e.result!==void 0&&b(Oy,{icon:hn,title:t(`sandbox.testCall.result`),children:b(jy,{value:e.result})}),e.error&&b(Oy,{icon:Cn,title:t(`sandbox.testCall.error`),children:b(jy,{value:e.error})})]})}function mb({label:t=`AI`,size:n=20}){let[r,i]=e.useState({top:`38%`,left:`55%`}),[a,o]=e.useState(!1),[s,c]=e.useState(!1),l=e.useRef({}),u=e.useCallback(()=>{clearTimeout(l.current.click),clearTimeout(l.current.loading)},[]);return e.useEffect(()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e,t=()=>{e=setTimeout(()=>{u(),o(!1),c(!1),i({top:`${22+Math.random()*52}%`,left:`${18+Math.random()*60}%`}),t()},5200+Math.random()*3800)};return l.current.loading=setTimeout(()=>c(!0),200),t(),()=>{clearTimeout(e),u()}},[u]),b(`div`,{className:U(`sandbox-agent-cursor`,a&&`is-clicking`,s&&`is-loading`),style:r,"aria-hidden":`true`,onTransitionEnd:e=>{e.propertyName===`top`&&(u(),o(!0),l.current.click=setTimeout(()=>{o(!1),l.current.loading=setTimeout(()=>c(!0),200)},400))},children:x(`span`,{className:`sandbox-agent-cursor-float`,children:[b(`svg`,{viewBox:`0 0 20 20`,width:n,height:n,fill:`none`,"aria-hidden":`true`,children:b(`path`,{d:`M6.465 15.647 4.511 4.813a1 1 0 0 1 1.366-1.102l9.698 4.007c.853.352.815 1.572-.058 1.87l-4.682 1.6a1 1 0 0 0-.588.534l-1.887 4.16c-.405.894-1.72.73-1.895-.235Z`,fill:`currentColor`,stroke:`#fff`,strokeWidth:`1.5`})}),b(`span`,{className:`sandbox-agent-cursor-label`,children:t})]})})}var hb=`url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cdefs%3E%3Cmask%20id%3D%22m%22%20maskUnits%3D%22userSpaceOnUse%22%3E%3Crect%20x%3D%22-8%22%20y%3D%22-8%22%20width%3D%2236%22%20height%3D%2236%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M9.3%2016.3%208.08%209.53a.63%20.63%200%200%201%20.85-.69L15%2011.35a.63%20.63%200%200%201-.03%201.18l-2.93%201a.63%20.63%200%200%200-.37.34l-1.18%202.6a.63%20.63%200%200%201-1.19-.17Z%22%20transform%3D%22translate(1.6%201)%20translate(0%20.35)%20translate(10.8%2012.4)%20scale(1.28)%20translate(-10.8%20-12.4)%22%20fill%3D%22%23000%22%20stroke%3D%22%23000%22%20stroke-width%3D%223.2%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3Cellipse%20cx%3D%2212.6%22%20cy%3D%2216.9%22%20rx%3D%224.2%22%20ry%3D%223.4%22%20fill%3D%22%23000%22%2F%3E%3Cellipse%20cx%3D%2214.8%22%20cy%3D%2214.6%22%20rx%3D%222.6%22%20ry%3D%222.4%22%20fill%3D%22%23000%22%2F%3E%3Ccircle%20cx%3D%2210.6%22%20cy%3D%2217.8%22%20r%3D%222.8%22%20fill%3D%22%23000%22%2F%3E%3C%2Fmask%3E%3C%2Fdefs%3E%3Crect%20x%3D%22-8%22%20y%3D%22-8%22%20width%3D%2236%22%20height%3D%2236%22%20fill%3D%22%23fff%22%20mask%3D%22url(%23m)%22%2F%3E%3C%2Fsvg%3E")`,gb={maskImage:hb,maskSize:`100% 100%`,maskRepeat:`no-repeat`,WebkitMaskImage:hb,WebkitMaskSize:`100% 100%`,WebkitMaskRepeat:`no-repeat`};function _b({running:e,small:t}){return x(`span`,{className:U(`sandbox-agent-control`,e&&`is-running`,t&&`is-small`),"aria-hidden":`true`,children:[x(`span`,{className:`sandbox-agent-control-orbit`,children:[b(`span`,{className:`sandbox-agent-control-orbit-band is-inner`}),b(`span`,{className:`sandbox-agent-control-orbit-band is-outer`})]}),b(`svg`,{className:`sandbox-agent-control-icon sandbox-agent-control-rays-layer`,style:gb,viewBox:`0 0 20 20`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:b(`g`,{transform:`translate(1.6 1)`,children:b(`g`,{transform:`translate(8.7 8.4)`,children:b(`g`,{className:`sandbox-agent-control-icon-rays`,children:b(`g`,{transform:`translate(-8.7 -8.4)`,children:b(`path`,{d:`M8.4.9v2.5M3.33 3.33 5.1 5.1M1.2 8.4h2.5M3.33 13.47l1.77-1.77M13.47 3.33 11.7 5.1M13.1 8.4h2.5M8.4 15.9v-2.5M13.47 13.47 11.7 11.7`,transform:`translate(.3 0)`})})})})})}),b(`svg`,{className:`sandbox-agent-control-icon sandbox-agent-control-pointer`,viewBox:`0 0 20 20`,fill:`none`,children:b(`g`,{transform:`translate(1.6 1)`,children:b(`path`,{d:`M9.3 16.3 8.08 9.53a.63 .63 0 0 1 .85-.69L15 11.35a.63 .63 0 0 1-.03 1.18l-2.93 1a.63 .63 0 0 0-.37.34l-1.18 2.6a.63 .63 0 0 1-1.19-.17Z`,transform:`translate(0 .35)`,fill:`currentColor`,stroke:`none`})})})]})}var vb=`#version 100
|
|
4
4
|
precision mediump float;
|
|
5
5
|
|
|
6
6
|
uniform vec2 uResolution;
|