@datnguyennnx/localterm 0.1.4 → 0.2.0

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.
@@ -116,6 +116,6 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
116
116
 
117
117
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=jf,s=!gf.jitless,c=s&&Mf.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Qm([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function th(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Jf(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Zf(e,r,_f())))}),t)}var nh=J(`$ZodUnion`,(e,t)=>{mm.init(e,t),Tf(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Tf(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Tf(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Tf(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Sf(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>th(t,i,e,a)):th(s,i,e,a)}}),rh=J(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,nh.init(e,t);let n=e._zod.parse;Tf(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=bf(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!jf(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),ih=J(`$ZodIntersection`,(e,t)=>{mm.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>oh(e,t,n)):oh(e,i,a)}});function ah(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Nf(e)&&Nf(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=ah(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ah(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function oh(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Jf(e))return e;let o=ah(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var sh=J(`$ZodRecord`,(e,t)=>{mm.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Nf(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...Yf(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Yf(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Gp.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Zf(e,r,_f())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Yf(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Yf(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),ch=J(`$ZodEnum`,(e,t)=>{mm.init(e,t);let n=vf(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ff.has(typeof e)).map(e=>typeof e==`string`?If(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),lh=J(`$ZodLiteral`,(e,t)=>{if(mm.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?If(e):e?If(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),uh=J(`$ZodTransform`,(e,t)=>{mm.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new hf(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new mf;return n.value=i,n}});function dh(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var fh=J(`$ZodOptional`,(e,t)=>{mm.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Tf(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Tf(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Sf(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>dh(t,e.value)):dh(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ph=J(`$ZodExactOptional`,(e,t)=>{fh.init(e,t),Tf(e._zod,`values`,()=>t.innerType._zod.values),Tf(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),mh=J(`$ZodNullable`,(e,t)=>{mm.init(e,t),Tf(e._zod,`optin`,()=>t.innerType._zod.optin),Tf(e._zod,`optout`,()=>t.innerType._zod.optout),Tf(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Sf(e.source)}|null)$`):void 0}),Tf(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),hh=J(`$ZodDefault`,(e,t)=>{mm.init(e,t),e._zod.optin=`optional`,Tf(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>gh(e,t)):gh(r,t)}});function gh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var _h=J(`$ZodPrefault`,(e,t)=>{mm.init(e,t),e._zod.optin=`optional`,Tf(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),vh=J(`$ZodNonOptional`,(e,t)=>{mm.init(e,t),Tf(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>yh(t,e)):yh(i,e)}});function yh(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var bh=J(`$ZodCatch`,(e,t)=>{mm.init(e,t),Tf(e._zod,`optin`,()=>t.innerType._zod.optin),Tf(e._zod,`optout`,()=>t.innerType._zod.optout),Tf(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Zf(e,n,_f()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Zf(e,n,_f()))},input:e.value}),e.issues=[]),e)}}),xh=J(`$ZodPipe`,(e,t)=>{mm.init(e,t),Tf(e._zod,`values`,()=>t.in._zod.values),Tf(e._zod,`optin`,()=>t.in._zod.optin),Tf(e._zod,`optout`,()=>t.out._zod.optout),Tf(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Sh(e,t.in,n)):Sh(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Sh(e,t.out,n)):Sh(r,t.out,n)}});function Sh(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Ch=J(`$ZodReadonly`,(e,t)=>{mm.init(e,t),Tf(e._zod,`propValues`,()=>t.innerType._zod.propValues),Tf(e._zod,`values`,()=>t.innerType._zod.values),Tf(e._zod,`optin`,()=>t.innerType?._zod?.optin),Tf(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(wh):wh(r)}});function wh(e){return e.value=Object.freeze(e.value),e}var Th=J(`$ZodCustom`,(e,t)=>{Yp.init(e,t),mm.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Eh(t,n,r,e));Eh(i,n,r,e)}});function Eh(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push($f(e))}}var Dh,Oh=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function kh(){return new Oh}(Dh=globalThis).__zod_globalRegistry??(Dh.__zod_globalRegistry=kh());var Ah=globalThis.__zod_globalRegistry;function jh(e,t){return new e({type:`string`,...Rf(t)})}function Mh(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Rf(t)})}function Nh(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Rf(t)})}function Ph(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Rf(t)})}function Fh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Rf(t)})}function Ih(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Rf(t)})}function Lh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Rf(t)})}function Rh(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Rf(t)})}function zh(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Rf(t)})}function Bh(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Rf(t)})}function Vh(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Rf(t)})}function Hh(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Rf(t)})}function Uh(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Rf(t)})}function Wh(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Rf(t)})}function Gh(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Rf(t)})}function Kh(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Rf(t)})}function qh(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Rf(t)})}function Jh(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Rf(t)})}function Yh(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Rf(t)})}function Xh(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Rf(t)})}function Zh(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Rf(t)})}function Qh(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Rf(t)})}function $h(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Rf(t)})}function eg(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Rf(t)})}function tg(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Rf(t)})}function ng(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Rf(t)})}function rg(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Rf(t)})}function ig(e,t){return new e({type:`number`,checks:[],...Rf(t)})}function ag(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Rf(t)})}function og(e,t){return new e({type:`boolean`,...Rf(t)})}function sg(e){return new e({type:`unknown`})}function cg(e,t){return new e({type:`never`,...Rf(t)})}function lg(e,t){return new Zp({check:`less_than`,...Rf(t),value:e,inclusive:!1})}function ug(e,t){return new Zp({check:`less_than`,...Rf(t),value:e,inclusive:!0})}function dg(e,t){return new Qp({check:`greater_than`,...Rf(t),value:e,inclusive:!1})}function fg(e,t){return new Qp({check:`greater_than`,...Rf(t),value:e,inclusive:!0})}function pg(e,t){return new $p({check:`multiple_of`,...Rf(t),value:e})}function mg(e,t){return new tm({check:`max_length`,...Rf(t),maximum:e})}function hg(e,t){return new nm({check:`min_length`,...Rf(t),minimum:e})}function gg(e,t){return new rm({check:`length_equals`,...Rf(t),length:e})}function _g(e,t){return new am({check:`string_format`,format:`regex`,...Rf(t),pattern:e})}function vg(e){return new om({check:`string_format`,format:`lowercase`,...Rf(e)})}function yg(e){return new sm({check:`string_format`,format:`uppercase`,...Rf(e)})}function bg(e,t){return new cm({check:`string_format`,format:`includes`,...Rf(t),includes:e})}function xg(e,t){return new lm({check:`string_format`,format:`starts_with`,...Rf(t),prefix:e})}function Sg(e,t){return new um({check:`string_format`,format:`ends_with`,...Rf(t),suffix:e})}function Cg(e){return new dm({check:`overwrite`,tx:e})}function wg(e){return Cg(t=>t.normalize(e))}function Tg(){return Cg(e=>e.trim())}function Eg(){return Cg(e=>e.toLowerCase())}function Dg(){return Cg(e=>e.toUpperCase())}function Og(){return Cg(e=>kf(e))}function kg(e,t,n){return new e({type:`array`,element:t,...Rf(n)})}function Ag(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Rf(n)})}function jg(e){let t=Mg(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push($f(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push($f(r))}},e(n.value,n)));return t}function Mg(e,t){let n=new Yp({check:`custom`,...Rf(t)});return n._zod.check=e,n}function Ng(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ah,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Pg(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Pg(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Lg(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Fg(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
118
118
 
119
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ig(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:zg(t,`input`,e.processors),output:zg(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Lg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Lg(r.element,n);if(r.type===`set`)return Lg(r.valueType,n);if(r.type===`lazy`)return Lg(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Lg(r.innerType,n);if(r.type===`intersection`)return Lg(r.left,n)||Lg(r.right,n);if(r.type===`record`||r.type===`map`)return Lg(r.keyType,n)||Lg(r.valueType,n);if(r.type===`pipe`)return Lg(r.in,n)||Lg(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Lg(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Lg(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Lg(e,n))return!0;return!!(r.rest&&Lg(r.rest,n))}return!1}var Rg=(e,t={})=>n=>{let r=Ng({...n,processors:t});return Pg(e,r),Fg(r,e),Ig(r,e)},zg=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ng({...i??{},target:a,io:t,processors:n});return Pg(e,o),Fg(o,e),Ig(o,e)},Bg={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Vg=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Bg[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Hg=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Ug=(e,t,n,r)=>{n.type=`boolean`},Wg=(e,t,n,r)=>{n.not={}},Gg=(e,t,n,r)=>{let i=e._zod.def,a=vf(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Kg=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},qg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Jg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Yg=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Pg(a.element,t,{...r,path:[...r.path,`items`]})},Xg=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Pg(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Pg(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Zg=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Pg(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qg=(e,t,n,r)=>{let i=e._zod.def,a=Pg(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Pg(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},$g=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Pg(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Pg(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Pg(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},e_=(e,t,n,r)=>{let i=e._zod.def,a=Pg(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},t_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},n_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},r_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},i_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},a_=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Pg(a,t,r);let o=t.seen.get(e);o.ref=a},o_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},s_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},c_=J(`ZodISODateTime`,(e,t)=>{Om.init(e,t),P_.init(e,t)});function l_(e){return eg(c_,e)}var u_=J(`ZodISODate`,(e,t)=>{km.init(e,t),P_.init(e,t)});function d_(e){return tg(u_,e)}var f_=J(`ZodISOTime`,(e,t)=>{Am.init(e,t),P_.init(e,t)});function p_(e){return ng(f_,e)}var m_=J(`ZodISODuration`,(e,t)=>{jm.init(e,t),P_.init(e,t)});function h_(e){return rg(m_,e)}var g_=(e,t)=>{tp.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ip(e,t)},flatten:{value:t=>rp(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yf,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yf,2)}},isEmpty:{get(){return e.issues.length===0}}})};J(`ZodError`,g_);var __=J(`ZodError`,g_,{Parent:Error}),v_=ap(__),y_=op(__),b_=sp(__),x_=lp(__),S_=dp(__),C_=fp(__),w_=pp(__),T_=mp(__),E_=hp(__),D_=gp(__),O_=_p(__),k_=vp(__),A_=J(`ZodType`,(e,t)=>(mm.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:zg(e,`input`),output:zg(e,`output`)}}),e.toJSONSchema=Rg(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Df(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Lf(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>v_(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>b_(e,t,n),e.parseAsync=async(t,n)=>y_(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>x_(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>S_(e,t,n),e.decode=(t,n)=>C_(e,t,n),e.encodeAsync=async(t,n)=>w_(e,t,n),e.decodeAsync=async(t,n)=>T_(e,t,n),e.safeEncode=(t,n)=>E_(e,t,n),e.safeDecode=(t,n)=>D_(e,t,n),e.safeEncodeAsync=async(t,n)=>O_(e,t,n),e.safeDecodeAsync=async(t,n)=>k_(e,t,n),e.refine=(t,n)=>e.check(qv(t,n)),e.superRefine=t=>e.check(Jv(t)),e.overwrite=t=>e.check(Cg(t)),e.optional=()=>kv(e),e.exactOptional=()=>jv(e),e.nullable=()=>Nv(e),e.nullish=()=>kv(Nv(e)),e.nonoptional=t=>zv(e,t),e.array=()=>dv(e),e.or=t=>hv([e,t]),e.and=t=>yv(e,t),e.transform=t=>Uv(e,Dv(t)),e.default=t=>Fv(e,t),e.prefault=t=>Lv(e,t),e.catch=t=>Vv(e,t),e.pipe=t=>Uv(e,t),e.readonly=()=>Gv(e),e.describe=t=>{let n=e.clone();return Ah.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Ah.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Ah.get(e);let n=e.clone();return Ah.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),j_=J(`_ZodString`,(e,t)=>{hm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vg(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(_g(...t)),e.includes=(...t)=>e.check(bg(...t)),e.startsWith=(...t)=>e.check(xg(...t)),e.endsWith=(...t)=>e.check(Sg(...t)),e.min=(...t)=>e.check(hg(...t)),e.max=(...t)=>e.check(mg(...t)),e.length=(...t)=>e.check(gg(...t)),e.nonempty=(...t)=>e.check(hg(1,...t)),e.lowercase=t=>e.check(vg(t)),e.uppercase=t=>e.check(yg(t)),e.trim=()=>e.check(Tg()),e.normalize=(...t)=>e.check(wg(...t)),e.toLowerCase=()=>e.check(Eg()),e.toUpperCase=()=>e.check(Dg()),e.slugify=()=>e.check(Og())}),M_=J(`ZodString`,(e,t)=>{hm.init(e,t),j_.init(e,t),e.email=t=>e.check(Mh(F_,t)),e.url=t=>e.check(Rh(R_,t)),e.jwt=t=>e.check($h($_,t)),e.emoji=t=>e.check(zh(z_,t)),e.guid=t=>e.check(Nh(I_,t)),e.uuid=t=>e.check(Ph(L_,t)),e.uuidv4=t=>e.check(Fh(L_,t)),e.uuidv6=t=>e.check(Ih(L_,t)),e.uuidv7=t=>e.check(Lh(L_,t)),e.nanoid=t=>e.check(Bh(B_,t)),e.guid=t=>e.check(Nh(I_,t)),e.cuid=t=>e.check(Vh(V_,t)),e.cuid2=t=>e.check(Hh(H_,t)),e.ulid=t=>e.check(Uh(U_,t)),e.base64=t=>e.check(Xh(X_,t)),e.base64url=t=>e.check(Zh(Z_,t)),e.xid=t=>e.check(Wh(W_,t)),e.ksuid=t=>e.check(Gh(G_,t)),e.ipv4=t=>e.check(Kh(K_,t)),e.ipv6=t=>e.check(qh(q_,t)),e.cidrv4=t=>e.check(Jh(J_,t)),e.cidrv6=t=>e.check(Yh(Y_,t)),e.e164=t=>e.check(Qh(Q_,t)),e.datetime=t=>e.check(l_(t)),e.date=t=>e.check(d_(t)),e.time=t=>e.check(p_(t)),e.duration=t=>e.check(h_(t))});function N_(e){return jh(M_,e)}var P_=J(`ZodStringFormat`,(e,t)=>{gm.init(e,t),j_.init(e,t)}),F_=J(`ZodEmail`,(e,t)=>{ym.init(e,t),P_.init(e,t)}),I_=J(`ZodGUID`,(e,t)=>{_m.init(e,t),P_.init(e,t)}),L_=J(`ZodUUID`,(e,t)=>{vm.init(e,t),P_.init(e,t)}),R_=J(`ZodURL`,(e,t)=>{bm.init(e,t),P_.init(e,t)}),z_=J(`ZodEmoji`,(e,t)=>{xm.init(e,t),P_.init(e,t)}),B_=J(`ZodNanoID`,(e,t)=>{Sm.init(e,t),P_.init(e,t)}),V_=J(`ZodCUID`,(e,t)=>{Cm.init(e,t),P_.init(e,t)}),H_=J(`ZodCUID2`,(e,t)=>{wm.init(e,t),P_.init(e,t)}),U_=J(`ZodULID`,(e,t)=>{Tm.init(e,t),P_.init(e,t)}),W_=J(`ZodXID`,(e,t)=>{Em.init(e,t),P_.init(e,t)}),G_=J(`ZodKSUID`,(e,t)=>{Dm.init(e,t),P_.init(e,t)}),K_=J(`ZodIPv4`,(e,t)=>{Mm.init(e,t),P_.init(e,t)}),q_=J(`ZodIPv6`,(e,t)=>{Nm.init(e,t),P_.init(e,t)}),J_=J(`ZodCIDRv4`,(e,t)=>{Pm.init(e,t),P_.init(e,t)}),Y_=J(`ZodCIDRv6`,(e,t)=>{Fm.init(e,t),P_.init(e,t)}),X_=J(`ZodBase64`,(e,t)=>{Lm.init(e,t),P_.init(e,t)}),Z_=J(`ZodBase64URL`,(e,t)=>{zm.init(e,t),P_.init(e,t)}),Q_=J(`ZodE164`,(e,t)=>{Bm.init(e,t),P_.init(e,t)}),$_=J(`ZodJWT`,(e,t)=>{Hm.init(e,t),P_.init(e,t)}),ev=J(`ZodNumber`,(e,t)=>{Um.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hg(e,t,n,r),e.gt=(t,n)=>e.check(dg(t,n)),e.gte=(t,n)=>e.check(fg(t,n)),e.min=(t,n)=>e.check(fg(t,n)),e.lt=(t,n)=>e.check(lg(t,n)),e.lte=(t,n)=>e.check(ug(t,n)),e.max=(t,n)=>e.check(ug(t,n)),e.int=t=>e.check(rv(t)),e.safe=t=>e.check(rv(t)),e.positive=t=>e.check(dg(0,t)),e.nonnegative=t=>e.check(fg(0,t)),e.negative=t=>e.check(lg(0,t)),e.nonpositive=t=>e.check(ug(0,t)),e.multipleOf=(t,n)=>e.check(pg(t,n)),e.step=(t,n)=>e.check(pg(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function tv(e){return ig(ev,e)}var nv=J(`ZodNumberFormat`,(e,t)=>{Wm.init(e,t),ev.init(e,t)});function rv(e){return ag(nv,e)}var iv=J(`ZodBoolean`,(e,t)=>{Gm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ug(e,t,n,r)});function av(e){return og(iv,e)}var ov=J(`ZodUnknown`,(e,t)=>{Km.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function sv(){return sg(ov)}var cv=J(`ZodNever`,(e,t)=>{qm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wg(e,t,n,r)});function lv(e){return cg(cv,e)}var uv=J(`ZodArray`,(e,t)=>{Ym.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yg(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(hg(t,n)),e.nonempty=t=>e.check(hg(1,t)),e.max=(t,n)=>e.check(mg(t,n)),e.length=(t,n)=>e.check(gg(t,n)),e.unwrap=()=>e.element});function dv(e,t){return kg(uv,e,t)}var fv=J(`ZodObject`,(e,t)=>{eh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xg(e,t,n,r),Tf(e,`shape`,()=>t.shape),e.keyof=()=>Cv(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sv()}),e.loose=()=>e.clone({...e._zod.def,catchall:sv()}),e.strict=()=>e.clone({...e._zod.def,catchall:lv()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Uf(e,t),e.safeExtend=t=>Wf(e,t),e.merge=t=>Gf(e,t),e.pick=t=>Vf(e,t),e.omit=t=>Hf(e,t),e.partial=(...t)=>Kf(Ov,e,t[0]),e.required=(...t)=>qf(Rv,e,t[0])});function pv(e,t){return new fv({type:`object`,shape:e??{},...Rf(t)})}var mv=J(`ZodUnion`,(e,t)=>{nh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zg(e,t,n,r),e.options=t.options});function hv(e,t){return new mv({type:`union`,options:e,...Rf(t)})}var gv=J(`ZodDiscriminatedUnion`,(e,t)=>{mv.init(e,t),rh.init(e,t)});function _v(e,t,n){return new gv({type:`union`,options:t,discriminator:e,...Rf(n)})}var vv=J(`ZodIntersection`,(e,t)=>{ih.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qg(e,t,n,r)});function yv(e,t){return new vv({type:`intersection`,left:e,right:t})}var bv=J(`ZodRecord`,(e,t)=>{sh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$g(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function xv(e,t,n){return new bv({type:`record`,keyType:e,valueType:t,...Rf(n)})}var Sv=J(`ZodEnum`,(e,t)=>{ch.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gg(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Sv({...t,checks:[],...Rf(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Sv({...t,checks:[],...Rf(r),entries:i})}});function Cv(e,t){return new Sv({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Rf(t)})}var wv=J(`ZodLiteral`,(e,t)=>{lh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kg(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Tv(e,t){return new wv({type:`literal`,values:Array.isArray(e)?e:[e],...Rf(t)})}var Ev=J(`ZodTransform`,(e,t)=>{uh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jg(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new hf(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push($f(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push($f(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Dv(e){return new Ev({type:`transform`,transform:e})}var Ov=J(`ZodOptional`,(e,t)=>{fh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kv(e){return new Ov({type:`optional`,innerType:e})}var Av=J(`ZodExactOptional`,(e,t)=>{ph.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jv(e){return new Av({type:`optional`,innerType:e})}var Mv=J(`ZodNullable`,(e,t)=>{mh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nv(e){return new Mv({type:`nullable`,innerType:e})}var Pv=J(`ZodDefault`,(e,t)=>{hh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Fv(e,t){return new Pv({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pf(t)}})}var Iv=J(`ZodPrefault`,(e,t)=>{_h.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lv(e,t){return new Iv({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pf(t)}})}var Rv=J(`ZodNonOptional`,(e,t)=>{vh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zv(e,t){return new Rv({type:`nonoptional`,innerType:e,...Rf(t)})}var Bv=J(`ZodCatch`,(e,t)=>{bh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>i_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vv(e,t){return new Bv({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Hv=J(`ZodPipe`,(e,t)=>{xh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>a_(e,t,n,r),e.in=t.in,e.out=t.out});function Uv(e,t){return new Hv({type:`pipe`,in:e,out:t})}var Wv=J(`ZodReadonly`,(e,t)=>{Ch.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gv(e){return new Wv({type:`readonly`,innerType:e})}var Kv=J(`ZodCustom`,(e,t)=>{Th.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qg(e,t,n,r)});function qv(e,t={}){return Ag(Kv,e,t)}function Jv(e){return jg(e)}pv({ok:av(),sessions:tv().int().nonnegative()}).strict(),_v(`type`,[pv({type:Tv(`input`),data:N_().max(lf)}).strict(),pv({type:Tv(`resize`),cols:tv().int().positive().max(ff),rows:tv().int().positive().max(pf)}).strict(),pv({type:Tv(`flow-pause`)}).strict(),pv({type:Tv(`flow-resume`)}).strict(),pv({type:Tv(`rpc`),id:N_().min(1).max(64),method:Cv([`spawn_session`,`list_sessions`,`write_input`,`read_output`,`wait_for_boundary`,`exec`]),params:xv(N_(),sv()).optional()}).strict()]),_v(`type`,[pv({type:Tv(`output`),data:N_().max(uf)}).strict(),pv({type:Tv(`exit`),code:tv().int().nullable()}).strict(),pv({type:Tv(`title`),title:N_().max(df)}).strict(),pv({type:Tv(`session`),shell:N_().min(1),shellName:N_().min(1),pid:tv().int().nonnegative(),cwd:N_().min(1)}).strict(),pv({type:Tv(`cwd`),cwd:N_().min(1)}).strict(),pv({type:Tv(`agent-output`),text:N_().max(uf)}).strict(),pv({type:Tv(`command-boundary`),phase:Cv([`prompt-start`,`command-start`,`output-start`,`command-end`]),exitCode:tv().int().optional()}).strict(),pv({type:Tv(`rpc-response`),id:N_().min(1).max(64),result:sv().optional(),error:N_().optional()}).strict()]);var Yv=e=>typeof e==`string`?e.length:e.byteLength,Xv=e=>{let t=new URL(`/ws`,window.location.href);t.protocol=t.protocol===`https:`?`wss:`:`ws:`;let n=e??new URLSearchParams(window.location.search).get(`cwd`);return n&&t.searchParams.set(`cwd`,n),t.toString()},Zv=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(`cwd`,e),t.toString()},Qv=e=>{let t=0,n=0,r=!1,i=t=>{if(e.hasScrollRestore()){e.restoreScrollFromResize();return}t.wasAtBottom&&e.restoreScrollAnchor(t)};return{write:a=>{if(e.isExited())return;let o=e.captureScrollAnchor(),s=Yv(a),c=t;t+=s,!r&&n>=4&&(e.sendFlowPause(),r=!0),e.terminalWrite(a,()=>{n=Math.max(0,n-1),r&&n<1&&(e.sendFlowResume(),r=!1),i(o)}),n++,c<131072&&t>=131072&&(t=0)},clear:()=>{t=0,n=0,r=!1}}},$v=(e,t)=>`\x1b[${e};${t+1}u`,ey=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),ty=(e,t)=>e.key!==`f`&&e.key!==`F`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,ny=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,ry=e=>{let t=[0];return e.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let n=e[0],r=typeof n==`number`?n:1;return t.push(r),!0}),e.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let n=e[0],r=typeof n==`number`&&n>0?n:1;for(let e=0;e<r&&t.length>1;e+=1)t.pop();return!0}),e.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let n=e[0],r=e[1];if(typeof n!=`number`)return!0;let i=n,a=typeof r==`number`&&r>0?r:1,o=t.length-1,s=t[o]??0;return a===1?t[o]=i:a===2?t[o]=s|i:a===3&&(t[o]=s&~i),!0}),{getFlags:()=>t[t.length-1]??0}},iy=(e,t)=>{e.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(ty(e,t.isMac))return e.type===`keydown`&&(e.preventDefault(),t.openFindOverlay()),!1;if(e.type===`keydown`&&e.key===`Enter`){let n=ey(e),r=(t.getKittyFlags()&1)!=0;if(n!==0&&r)return e.preventDefault(),t.sendInput($v(13,n)),!1;if(n===1)return e.preventDefault(),t.sendInput(`
120
- `),!1}return!0})},ay=e=>{e.attachCustomWheelEventHandler(t=>ny(t,e)?(t.preventDefault(),!1):!0)},oy=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},sy=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active,r=Math.max(0,n.baseY-t.distanceFromBottom)-n.viewportY;r!==0&&e.scrollLines(r)},cy=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=Math.max(0,t.baseY-r)-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},ly=e=>{let t=null,n=null,r=null,i=()=>oy(e.terminal),a=t=>{sy(e.terminal,t)},o=()=>{r&&window.clearTimeout(r.timer),n!==null&&(window.cancelAnimationFrame(n),n=null),r=null},s=()=>{r&&a(r.anchor)},c=e=>{o(),r={anchor:e,timer:window.setTimeout(()=>{s(),r=null},rd)},n=window.requestAnimationFrame(()=>{n=null,s()})},l=()=>{let t=i();cy(e.terminal,e.fitAddon)&&c(t)};return{captureAnchor:i,restoreAnchor:a,fitToContainer:l,scheduleFit:()=>{t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null,l()},e.resizeDebounceMs)},beginResizeScrollRestore:c,clearResizeScrollRestore:o,restoreResizeScroll:s,hasResizeRestore:()=>r!==null,cleanupResizeScroll:()=>{t!==null&&window.clearTimeout(t),o()}}},uy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),dy=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),fy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),py=e=>{let t=fy(e);return t.charAt(0).toUpperCase()+t.slice(1)},my={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`},hy=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},gy=(0,b.createContext)({}),_y=()=>(0,b.useContext)(gy),vy=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=_y()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...my,width:t??l??my.width,height:t??l??my.height,stroke:e??f,strokeWidth:m,className:uy(`lucide`,p,i),...!a&&!hy(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),yy=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)(vy,{ref:i,iconNode:t,className:uy(`lucide-${dy(py(e))}`,`lucide-${e}`,n),...r}));return n.displayName=py(e),n},by=yy(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),xy=yy(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Sy=yy(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Cy=yy(`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`}]]),wy=yy(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Ty=yy(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Ey=yy(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Dy=yy(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Oy=yy(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ky=yy(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ay=yy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function jy(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=jy(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function My(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=jy(e))&&(r&&(r+=` `),r+=t);return r}var Ny=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Py=My,Fy=(e,t)=>n=>{if(t?.variants==null)return Py(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=Ny(t)||Ny(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 Py(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)},Iy=(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},Ly=(e,t)=>({classGroupId:e,validator:t}),Ry=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),zy=`-`,By=[],Vy=`arbitrary..`,Hy=e=>{let t=Gy(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Wy(e);let n=e.split(zy);return Uy(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Iy(i,t):t:i||By}return n[e]||By}}},Uy=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Uy(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(zy):e.slice(t).join(zy),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Wy=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?Vy+r:void 0})(),Gy=e=>{let{theme:t,classGroups:n}=e;return Ky(n,t)},Ky=(e,t)=>{let n=Ry();for(let r in e){let i=e[r];qy(i,n,r,t)}return n},qy=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Jy(i,t,n,r)}},Jy=(e,t,n,r)=>{if(typeof e==`string`){Yy(e,t,n);return}if(typeof e==`function`){Xy(e,t,n,r);return}Zy(e,t,n,r)},Yy=(e,t,n)=>{let r=e===``?t:Qy(t,e);r.classGroupId=n},Xy=(e,t,n,r)=>{if($y(e)){qy(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ly(n,e))},Zy=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];qy(o,Qy(t,a),n,r)}},Qy=(e,t)=>{let n=e,r=t.split(zy),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ry(),n.nextPart.set(t,i)),n=i}return n},$y=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,eb=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)}}},tb=`!`,nb=`:`,rb=[],ib=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),ab=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===nb){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(tb)?(c=s.slice(0,-1),l=!0):s.startsWith(tb)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ib(t,l,c,u)};if(t){let e=t+nb,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ib(rb,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ob=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}},sb=e=>({cache:eb(e.cacheSize),parseClassName:ab(e),sortModifiers:ob(e),...Hy(e)}),cb=/\s+/,lb=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(cb),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+tb:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},ub=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=db(n))&&(i&&(i+=` `),i+=r);return i},db=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=db(e[r]))&&(n&&(n+=` `),n+=t);return n},fb=(e,...t)=>{let n,r,i,a,o=o=>(n=sb(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=lb(e,n);return i(e,a),a};return a=o,(...e)=>a(ub(...e))},pb=[],mb=e=>{let t=t=>t[e]||pb;return t.isThemeGetter=!0,t},hb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_b=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,vb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yb=/\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$/,bb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,xb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Sb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Cb=e=>_b.test(e),wb=e=>!!e&&!Number.isNaN(Number(e)),Tb=e=>!!e&&Number.isInteger(Number(e)),Eb=e=>e.endsWith(`%`)&&wb(e.slice(0,-1)),Db=e=>vb.test(e),Ob=()=>!0,kb=e=>yb.test(e)&&!bb.test(e),Ab=()=>!1,jb=e=>xb.test(e),Mb=e=>Sb.test(e),Nb=e=>!Y(e)&&!X(e),Pb=e=>Yb(e,$b,Ab),Y=e=>hb.test(e),Fb=e=>Yb(e,ex,kb),Ib=e=>Yb(e,tx,wb),Lb=e=>Yb(e,rx,Ob),Rb=e=>Yb(e,nx,Ab),zb=e=>Yb(e,Zb,Ab),Bb=e=>Yb(e,Qb,Mb),Vb=e=>Yb(e,ix,jb),X=e=>gb.test(e),Hb=e=>Xb(e,ex),Ub=e=>Xb(e,nx),Wb=e=>Xb(e,Zb),Gb=e=>Xb(e,$b),Kb=e=>Xb(e,Qb),qb=e=>Xb(e,ix,!0),Jb=e=>Xb(e,rx,!0),Yb=(e,t,n)=>{let r=hb.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Xb=(e,t,n=!1)=>{let r=gb.exec(e);return r?r[1]?t(r[1]):n:!1},Zb=e=>e===`position`||e===`percentage`,Qb=e=>e===`image`||e===`url`,$b=e=>e===`length`||e===`size`||e===`bg-size`,ex=e=>e===`length`,tx=e=>e===`number`,nx=e=>e===`family-name`,rx=e=>e===`number`||e===`weight`,ix=e=>e===`shadow`,ax=fb(()=>{let e=mb(`color`),t=mb(`font`),n=mb(`text`),r=mb(`font-weight`),i=mb(`tracking`),a=mb(`leading`),o=mb(`breakpoint`),s=mb(`container`),c=mb(`spacing`),l=mb(`radius`),u=mb(`shadow`),d=mb(`inset-shadow`),f=mb(`text-shadow`),p=mb(`drop-shadow`),m=mb(`blur`),h=mb(`perspective`),g=mb(`aspect`),_=mb(`ease`),v=mb(`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(),X,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[X,Y,c],T=()=>[Cb,`full`,`auto`,...w()],E=()=>[Tb,`none`,`subgrid`,X,Y],D=()=>[`auto`,{span:[`full`,Tb,X,Y]},Tb,X,Y],O=()=>[Tb,`auto`,X,Y],k=()=>[`auto`,`min`,`max`,`fr`,X,Y],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=()=>[Cb,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Cb,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Cb,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,X,Y],L=()=>[...b(),Wb,zb,{position:[X,Y]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],R=()=>[`auto`,`cover`,`contain`,Gb,Pb,{size:[X,Y]}],te=()=>[Eb,Hb,Fb],z=()=>[``,`none`,`full`,l,X,Y],B=()=>[``,wb,Hb,Fb],V=()=>[`solid`,`dashed`,`dotted`,`double`],ne=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],re=()=>[wb,Eb,Wb,zb],H=()=>[``,`none`,m,X,Y],ie=()=>[`none`,wb,X,Y],ae=()=>[`none`,wb,X,Y],oe=()=>[wb,X,Y],se=()=>[Cb,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Db],breakpoint:[Db],color:[Ob],container:[Db],"drop-shadow":[Db],ease:[`in`,`out`,`in-out`],font:[Nb],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Db],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Db],shadow:[Db],spacing:[`px`,wb],text:[Db],"text-shadow":[Db],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Cb,Y,X,g]}],container:[`container`],columns:[{columns:[wb,Y,X,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:[Tb,`auto`,X,Y]}],basis:[{basis:[Cb,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[wb,Cb,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,wb,X,Y]}],shrink:[{shrink:[``,wb,X,Y]}],order:[{order:[Tb,`first`,`last`,`none`,X,Y]}],"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`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],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,Hb,Fb]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Jb,Lb]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Eb,Y]}],"font-family":[{font:[Ub,Rb,t]}],"font-features":[{"font-features":[Y]}],"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,X,Y]}],"line-clamp":[{"line-clamp":[wb,`none`,X,Ib]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,X,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,X,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[wb,`from-font`,`auto`,X,Fb]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[wb,`auto`,X,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,X,Y]}],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`,X,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:R()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Tb,X,Y],radial:[``,X,Y],conic:[Tb,X,Y]},Kb,Bb]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[wb,X,Y]}],"outline-w":[{outline:[``,wb,Hb,Fb]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,qb,Vb]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,qb,Vb]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[wb,Fb]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,qb,Vb]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[wb,X,Y]}],"mix-blend":[{"mix-blend":[...ne(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ne()}],"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":[wb]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[X,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[wb]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,X,Y]}],filter:[{filter:[``,`none`,X,Y]}],blur:[{blur:H()}],brightness:[{brightness:[wb,X,Y]}],contrast:[{contrast:[wb,X,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,qb,Vb]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,wb,X,Y]}],"hue-rotate":[{"hue-rotate":[wb,X,Y]}],invert:[{invert:[``,wb,X,Y]}],saturate:[{saturate:[wb,X,Y]}],sepia:[{sepia:[``,wb,X,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,X,Y]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[wb,X,Y]}],"backdrop-contrast":[{"backdrop-contrast":[wb,X,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,wb,X,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[wb,X,Y]}],"backdrop-invert":[{"backdrop-invert":[``,wb,X,Y]}],"backdrop-opacity":[{"backdrop-opacity":[wb,X,Y]}],"backdrop-saturate":[{"backdrop-saturate":[wb,X,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,wb,X,Y]}],"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`,X,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[wb,`initial`,X,Y]}],ease:[{ease:[`linear`,`initial`,_,X,Y]}],delay:[{delay:[wb,X,Y]}],animate:[{animate:[`none`,v,X,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,X,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":[`scale-3d`],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[X,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"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`,X,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"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`,X,Y]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[wb,Hb,Fb,Ib]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{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`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function ox(...e){return ax(My(e))}function sx(){return typeof window<`u`}function cx(e){return dx(e)?(e.nodeName||``).toLowerCase():`#document`}function lx(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ux(e){return((dx(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function dx(e){return sx()?e instanceof Node||e instanceof lx(e).Node:!1}function fx(e){return sx()?e instanceof Element||e instanceof lx(e).Element:!1}function px(e){return sx()?e instanceof HTMLElement||e instanceof lx(e).HTMLElement:!1}function mx(e){return!sx()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof lx(e).ShadowRoot}function hx(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ex(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function gx(e){return/^(table|td|th)$/.test(cx(e))}function _x(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var vx=/transform|translate|scale|rotate|perspective|filter/,yx=/paint|layout|strict|content/,bx=e=>!!e&&e!==`none`,xx;function Sx(e){let t=fx(e)?Ex(e):e;return bx(t.transform)||bx(t.translate)||bx(t.scale)||bx(t.rotate)||bx(t.perspective)||!wx()&&(bx(t.backdropFilter)||bx(t.filter))||vx.test(t.willChange||``)||yx.test(t.contain||``)}function Cx(e){let t=Ox(e);for(;px(t)&&!Tx(t);){if(Sx(t))return t;if(_x(t))return null;t=Ox(t)}return null}function wx(){return xx??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),xx}function Tx(e){return/^(html|body|#document)$/.test(cx(e))}function Ex(e){return lx(e).getComputedStyle(e)}function Dx(e){return fx(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ox(e){if(cx(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||mx(e)&&e.host||ux(e);return mx(t)?t.host:t}function kx(e){let t=Ox(e);return Tx(t)?e.ownerDocument?e.ownerDocument.body:e.body:px(t)&&hx(t)?t:kx(t)}function Ax(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=kx(e),i=r===e.ownerDocument?.body,a=lx(r);if(i){let e=jx(a);return t.concat(a,a.visualViewport||[],hx(r)?r:[],e&&n?Ax(e):[])}else return t.concat(r,Ax(r,[],n))}function jx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Mx={};function Nx(e,t){let n=b.useRef(Mx);return n.current===Mx&&(n.current=e(t)),n}var Px=b[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Fx=Px&&Px!==b.useLayoutEffect?Px:e=>e();function Z(e){let t=Nx(Ix).current;return t.next=e,Fx(t.effect),t.trampoline}function Ix(){let e={next:void 0,callback:Lx,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Lx(){}var Rx={...b},Q=typeof document<`u`?b.useLayoutEffect:()=>{};function zx(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var Bx={};function Vx(e,t,n,r,i){if(!n&&!r&&!i&&!e)return Ux(t);let a=Ux(e);return t&&(a=Wx(a,t)),n&&(a=Wx(a,n)),r&&(a=Wx(a,r)),i&&(a=Wx(a,i)),a}function Hx(e){if(e.length===0)return Bx;if(e.length===1)return Ux(e[0]);let t=Ux(e[0]);for(let n=1;n<e.length;n+=1)t=Wx(t,e[n]);return t}function Ux(e){return Jx(e)?{...Yx(e,Bx)}:Gx(e)}function Wx(e,t){return Jx(t)?Yx(t,e):Kx(e,t)}function Gx(e){let t={...e};for(let e in t){let n=t[e];qx(e,n)&&(t[e]=Zx(n))}return t}function Kx(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=zx(e.style,r);break;case`className`:e[n]=$x(e.className,r);break;default:qx(n,r)?e[n]=Xx(e[n],r):e[n]=r}}return e}function qx(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function Jx(e){return typeof e==`function`}function Yx(e,t){return Jx(e)?e(t):e??Bx}function Xx(e,t){return t?e?(...n)=>{let r=n[0];if(eS(r)){let i=r;Qx(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:Zx(t):e}function Zx(e){return e&&((...t)=>{let n=t[0];return eS(n)&&Qx(n),e(...t)})}function Qx(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function $x(e,t){return t?e?t+` `+e:t:e}function eS(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function tS(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var nS=tS(`https://base-ui.com/production-error`,`Base UI`),rS=b.createContext(void 0);function iS(e=!1){let t=b.useContext(rS);if(t===void 0&&!e)throw Error(nS(16));return t}function aS(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:b.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function oS(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=b.useRef(null),s=iS(!0),c=a??s!==void 0,{props:l}=aS({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=b.useCallback(()=>{let e=o.current;sS(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Q(u,[u]),{getButtonProps:b.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Vx({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(Qx(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=sS(a),l=!i&&cS(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(Qx(e),a?.(e),e.target===e.currentTarget&&i&&c&&sS(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function sS(e){return px(e)&&e.tagName===`BUTTON`}function cS(e){return!!(e?.tagName===`A`&&e?.href)}function lS(e,t,n,r){let i=Nx(dS).current;return fS(i,e,t,n,r)&&mS(i,[e,t,n,r]),i.callback}function uS(e){let t=Nx(dS).current;return pS(t,e)&&mS(t,e),t.callback}function dS(){return{callback:null,cleanup:null,refs:[]}}function fS(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function pS(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function mS(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var hS=19;function gS(e){return hS>=e}function _S(e){if(!b.isValidElement(e))return null;let t=e,n=t.props;return(gS(19)?n?.ref:t.ref)??null}function vS(){}var yS=Object.freeze([]),bS=Object.freeze({});function xS(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function SS(e,t){return typeof e==`function`?e(t):e}function CS(e,t){return typeof e==`function`?e(t):e}function wS(e,t,n={}){let r=t.render,i=TS(t,n);return n.enabled===!1?null:OS(e,r,i,n.state??bS)}function TS(e,t={}){let{className:n,style:r,render:i}=e,{state:a=bS,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?SS(n,a):void 0,d=l?CS(r,a):void 0,f=l?xS(a,c):bS,p=l&&s?ES(s):void 0,m=l?zx(f,p)??{}:bS;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=uS([m.ref,_S(i),...o]):m.ref=lS(m.ref,_S(i),o):lS(null,null)),l?(u!==void 0&&(m.className=$x(m.className,u)),d!==void 0&&(m.style=zx(m.style,d)),m):bS}function ES(e){return Array.isArray(e)?Hx(e):Vx(void 0,e)}var DS=Symbol.for(`react.lazy`);function OS(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Vx(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===DS&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,e)}if(e&&typeof e==`string`)return kS(e,n);throw Error(nS(8))}function kS(e,t){return e===`button`?(0,b.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,b.createElement)(`img`,{alt:``,...t,key:t.key}):b.createElement(e,t)}var AS=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=oS({disabled:i,focusableWhenDisabled:a,native:o});return wS(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),jS=Fy(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,lg:`h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function MS({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,y.jsx)(AS,{"data-slot":`button`,className:ox(jS({variant:t,size:n,className:e})),...r})}var NS=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),PS={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},FS={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},IS={disabled:!1,...FS},LS={valid(e){return e===null?null:e?{[NS.valid]:``}:{[NS.invalid]:``}}},RS=b.createContext({invalid:void 0,name:void 0,validityData:{state:PS,errors:[],error:``,value:``,initialValue:null},setValidityData:vS,disabled:void 0,touched:FS.touched,setTouched:vS,dirty:FS.dirty,setDirty:vS,filled:FS.filled,setFilled:vS,focused:FS.focused,setFocused:vS,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:IS,markedDirtyRef:{current:!1},registerFieldControl:vS,validation:{getValidationProps:(e=bS)=>e,getInputValidationProps:(e=bS)=>e,inputRef:{current:null},commit:async()=>{}}});function zS(e=!0){let t=b.useContext(RS);if(t.setValidityData===vS&&!e)throw Error(nS(28));return t}var BS=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:vS,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function VS(){return b.useContext(BS)}var HS=0;function US(e,t=`mui`){let[n,r]=b.useState(e),i=e||n;return b.useEffect(()=>{n??(HS+=1,r(`${t}-${HS}`))},[n,t]),i}var WS=Rx.useId;function GS(e,t){if(WS!==void 0){let n=WS();return e??(t?`${t}-${n}`:n)}return US(e,t)}function KS(e){return GS(e,`base-ui`)}var qS=b.createContext({controlId:void 0,registerControlId:vS,labelId:void 0,setLabelId:vS,messageIds:[],setMessageIds:vS,getDescriptionProps:e=>e});function JS(){return b.useContext(qS)}function YS(e,t,n,r=!0,i){let[a,o]=b.useState(),s=KS(i?`${i}-label`:void 0),c=e??t??a;return Q(()=>{let i=e||t||!r?void 0:XS(n.current,s);a!==i&&o(i)}),c}function XS(e,t){let n=ZS(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function ZS(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function QS(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=JS(),o=KS(t),s=n?i:void 0,c=Nx(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=Z(()=>{!l.current||a===vS||(l.current=!1,a(c.current,void 0))});return Q(()=>{if(a===vS)return;let e;if(n){let n=r?.current;e=fx(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),b.useEffect(()=>d,[d]),i??o}function $S(e){return e?.ownerDocument||document}var eC=typeof navigator<`u`,tC=uC(),nC=fC(),rC=dC(),iC=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),aC=tC.platform===`MacIntel`&&tC.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(tC.platform);eC&&/firefox/i.test(rC);var oC=eC&&/apple/i.test(navigator.vendor);eC&&/Edg/i.test(rC);var sC=eC&&/android/i.test(nC)||/android/i.test(rC),cC=eC&&nC.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,lC=rC.includes(`jsdom/`);function uC(){if(!eC)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function dC(){if(!eC)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function fC(){if(!eC)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var pC=`data-base-ui-focusable`,mC=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,hC=`ArrowLeft`,gC=`ArrowRight`,_C=`ArrowUp`,vC=`ArrowDown`;function yC(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function bC(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&mx(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function xC(e){return`composedPath`in e?e.composedPath()[0]:e.target}function SC(e,t){if(!fx(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(bC(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function CC(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function wC(e){return e.matches(`html,body`)}function TC(e){return px(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function EC(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${mC}`)!=null}function DC(e){return e?e.getAttribute(`role`)===`combobox`&&TC(e):!1}function OC(e){if(!e||lC)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function kC(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function AC(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...AC(e,t.id,n)])}function jC(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function MC(e){e.preventDefault(),e.stopPropagation()}function NC(e){return`nativeEvent`in e}function PC(e){return e.pointerType===``&&e.isTrusted?!0:sC&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function FC(e){return lC?!1:!sC&&e.width===0&&e.height===0||sC&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function IC(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function LC(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var RC=[`top`,`right`,`bottom`,`left`],zC=Math.min,BC=Math.max,VC=Math.round,HC=Math.floor,UC=e=>({x:e,y:e}),WC={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function GC(e,t,n){return BC(e,zC(t,n))}function KC(e,t){return typeof e==`function`?e(t):e}function qC(e){return e.split(`-`)[0]}function JC(e){return e.split(`-`)[1]}function YC(e){return e===`x`?`y`:`x`}function XC(e){return e===`y`?`height`:`width`}function ZC(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function QC(e){return YC(ZC(e))}function $C(e,t,n){n===void 0&&(n=!1);let r=JC(e),i=QC(e),a=XC(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=cw(o)),[o,cw(o)]}function ew(e){let t=cw(e);return[tw(e),t,tw(t)]}function tw(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var nw=[`left`,`right`],rw=[`right`,`left`],iw=[`top`,`bottom`],aw=[`bottom`,`top`];function ow(e,t,n){switch(e){case`top`:case`bottom`:return n?t?rw:nw:t?nw:rw;case`left`:case`right`:return t?iw:aw;default:return[]}}function sw(e,t,n,r){let i=JC(e),a=ow(qC(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(tw)))),a}function cw(e){let t=qC(e);return WC[t]+e.slice(t.length)}function lw(e){return{top:0,right:0,bottom:0,left:0,...e}}function uw(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:lw(e)}function dw(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function fw(e,t,n){return Math.floor(e/t)!==n}function pw(e,t){return t<0||t>=e.length}function mw(e,t){return gw(e.current,{disabledIndices:t})}function hw(e,t){return gw(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function gw(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&xw(e,a,r));return a}function _w(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!xw(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=HC(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!xw(e,r,s))return r}};d&&MC(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=gw(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=gw(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}pw(e,f)&&(f=u)}if(n===`both`){let n=HC(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&MC(t),u%o===o-1?r&&(f=gw(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=gw(e,{startingIndex:u,disabledIndices:s}),r&&fw(f,o,n)&&(f=gw(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),fw(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&MC(t),u%o===0?r&&(f=gw(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=gw(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&fw(f,o,n)&&(f=gw(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),fw(f,o,n)&&(f=u));let c=HC(l/o)===n;pw(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:gw(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function vw(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function yw(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function bw(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function xw(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?Cw(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function Sw(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Cw(e,t=e?Ex(e):null){return!e||!e.isConnected||!t||Sw(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var ww=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Tw(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return mx(n)?n.host:null}function Ew(e){for(let t of Array.from(e.children))if(cx(t)===`summary`)return t;return null}function Dw(e,t){let n=Ew(t);return!!n&&(e===n||bC(n,e))}function Ow(e){let t=e?cx(e):``;return e!=null&&e.matches(ww)&&(t!==`summary`||e.parentElement!=null&&cx(e.parentElement)===`details`&&Ew(e.parentElement)===e)&&(t!==`details`||Ew(e)==null)&&(t!==`input`||e.type!==`hidden`)}function kw(e){if(!Ow(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Tw(t)){let n=t!==e,r=cx(t)===`slot`;if(t.hasAttribute(`inert`)||n&&cx(t)===`details`&&!t.open&&!Dw(e,t)||t.hasAttribute(`hidden`)||!r&&!Aw(t,n))return!1}return!0}function Aw(e,t){let n=Ex(e);return t?n.display!==`none`:Cw(e,n)}function jw(e){let t=e.tabIndex;if(t<0){let t=cx(e);if(t===`details`||t===`audio`||t===`video`||px(e)&&e.isContentEditable)return 0}return t}function Mw(e){if(cx(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Nw(e,t){let n=Mw(e);if(!n)return!0;let r=t.find(e=>{let t=Mw(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Mw(e);return t?.name===n.name&&t.form===n.form})===n}function Pw(e){if(px(e)&&cx(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return px(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Fw(e,t){Pw(e).forEach(e=>{Ow(e)&&t.push(e),Fw(e,t)})}function Iw(e,t,n){Pw(e).forEach(e=>{px(e)&&e.matches(t)&&n.push(e),Iw(e,t,n)})}function Lw(e){return kw(e)&&jw(e)>=0}function Rw(e){let t=[];return Fw(e,t),t.filter(kw)}function zw(e){let t=Rw(e);return t.filter(e=>jw(e)>=0&&Nw(e,t))}function Bw(e,t){let n=zw(e),r=n.length;if(r===0)return;let i=yC($S(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Vw(e){return Bw($S(e).body,1)||e}function Hw(e){return Bw($S(e).body,-1)||e}function Uw(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!bC(n,r)}function Ww(e){zw(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Gw(e){let t=[];Iw(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Kw=[];function qw(e){b.useEffect(e,Kw)}var Jw=0,Yw=class e{static create(){return new e}currentId=Jw;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Jw,t()},e)}isStarted(){return this.currentId!==Jw}clear=()=>{this.currentId!==Jw&&(clearTimeout(this.currentId),this.currentId=Jw)};disposeEffect=()=>this.clear};function Xw(){let e=Nx(Yw.create).current;return qw(e.disposeEffect),e}var Zw=null;globalThis.requestAnimationFrame;var Qw=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},$w=class e{static create(){return new e}static request(e){return Qw.request(e)}static cancel(e){return Qw.cancel(e)}currentId=Zw;request(e){this.cancel(),this.currentId=Qw.request(()=>{this.currentId=Zw,e()})}cancel=()=>{this.currentId!==Zw&&(Qw.cancel(this.currentId),this.currentId=Zw)};disposeEffect=()=>this.cancel};function eT(){let e=Nx($w.create).current;return qw(e.disposeEffect),e}function tT(e){return e==null?e:`current`in e?e.current:e}var nT=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),rT={[nT.startingStyle]:``},iT={[nT.endingStyle]:``},aT={transitionStatus(e){return e===`starting`?rT:e===`ending`?iT:null}},oT=c(g());function sT(e,t=!1,n=!0){let r=eT();return Z((i,a=null)=>{r.cancel();let o=tT(e);if(o==null)return;let s=o,c=()=>{oT.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=nT.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function cT(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Z(i),o=sT(r,n,!1);b.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function lT(e,t=!1,n=!1){let[r,i]=b.useState(e&&t?`idle`:void 0),[a,o]=b.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Q(()=>{if(!e&&a&&r!==`ending`&&n){let e=$w.request(()=>{i(`ending`)});return()=>{$w.cancel(e)}}},[e,a,r,n]),Q(()=>{if(!e||t)return;let n=$w.request(()=>{i(void 0)});return()=>{$w.cancel(n)}},[t,e]),Q(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=$w.request(()=>{i(`idle`)});return()=>{$w.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function uT({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=b.useRef(e!==void 0),[a,o]=b.useState(t);return[i?e:a,b.useCallback(e=>{i||o(e)},[])]}function dT(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=zS(),s=b.useRef(null);s.current||=Symbol(),Q(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}var fT=`none`,pT=`trigger-press`,mT=`trigger-hover`,hT=`trigger-focus`,gT=`outside-press`,_T=`item-press`,vT=`close-press`,yT=`focus-out`,bT=`escape-key`,xT=`list-navigation`,ST=`cancel-open`,CT=`disabled`,wT=`imperative-action`,TT=`window-resize`;function ET(e,t,n,r){let i=!1,a=!1,o=r??bS;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var DT=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:x,validationMode:S,validation:C}=zS(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=JS(),O=QS({id:i});Q(()=>{let e=o!=null;C.inputRef.current?.value||e&&o!==``?x(!0):e&&o===``&&x(!1)},[C.inputRef,x,o]);let k=b.useRef(null);Q(()=>{u&&k.current===yC($S(k.current))&&y(!0)},[u,y]);let[A]=uT({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=Z(()=>C.inputRef.current?.value);return dT(C.inputRef,{id:O,value:M,getValue:N}),wS(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:C.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,ET(fT,e.nativeEvent)),_(t!==v.initialValue),x(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),S===`onBlur`&&C.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),f],stateAttributesMapping:LS})}),OT=b.forwardRef(function(e,t){return(0,y.jsx)(DT,{ref:t,...e})});function kT({className:e,type:t,...n}){return(0,y.jsx)(OT,{type:t,"data-slot":`input`,className:ox(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function AT({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:ox(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 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 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 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 jT=Fy(`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-1 has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:-mr-1 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 MT({className:e,align:t=`inline-start`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:ox(jT({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var NT=Fy(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function PT({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,y.jsx)(MS,{type:t,"data-size":r,variant:n,className:ox(NT({size:r}),e),...i})}function FT({className:e,...t}){return(0,y.jsx)(`span`,{className:ox(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function IT({className:e,...t}){return(0,y.jsx)(kT,{"data-slot":`input-group-control`,className:ox(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}var LT=({searchInputRef:e,searchQuery:t,searchResults:n,onSearchChange:r,onKeyDown:i,onFindNext:a,onFindPrevious:o})=>{let s=n.resultCount===0?`0/0`:`${n.resultIndex+1}/${n.resultCount}`;return(0,y.jsxs)(AT,{role:`search`,"aria-label":`find in terminal`,className:`absolute top-2 right-3 z-10 w-[min(20rem,calc(100vw-1.5rem))] border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(IT,{ref:e,type:`search`,value:t,onChange:r,onKeyDown:i,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(MT,{align:`inline-end`,children:[(0,y.jsx)(FT,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:s}),(0,y.jsx)(PT,{size:`icon-xs`,onClick:o,disabled:n.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(Sy,{})}),(0,y.jsx)(PT,{size:`icon-xs`,onClick:a,disabled:n.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(xy,{})})]})]})};function RT(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}function zT(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var BT={},VT={},HT=``;function UT(e){if(typeof document>`u`)return!1;let t=$S(e);return lx(t).innerWidth-t.documentElement.clientWidth>0}function WT(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=$S(e),n=t.documentElement,r=t.body,i=hx(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function GT(e){let t=$S(e),n=t.documentElement,r=t.body,i=hx(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function KT(e){let t=$S(e),n=t.documentElement,r=t.body,i=lx(n),a=0,o=0,s=!1,c=$w.create();if(iC&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,BT={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},HT=n.style.scrollBehavior,VT={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=hx(n)?n:r;if(s=WT(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,BT),Object.assign(r.style,VT),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=HT)}function d(){u(),c.request(l)}l();let f=zT(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var qT=new class{lockCount=0;restore=null;timeoutLock=Yw.create();timeoutUnlock=Yw.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=$S(e).documentElement,n=lx(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=vS;return}let r=aC||!UT(e);this.restore=r?GT(e):KT(e)}};function JT(e=!0,t=null){Q(()=>{if(e)return qT.acquire(t)},[e,t])}function YT(e,t){return t!=null&&!IC(t)?0:typeof e==`function`?e():e}function XT(e,t,n){let r=YT(e,n);return typeof r==`number`?r:r?.[t]}function ZT(e){return typeof e==`function`?e():e}function QT(e,t){return t||e===`click`||e===`mousedown`}var $T=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Yw,currentIdRef:{current:null},currentContextRef:{current:null}});function eE(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=b.useRef(n),a=b.useRef(n),o=b.useRef(null),s=b.useRef(null),c=Xw();return(0,y.jsx)($T.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function tE(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{open:i}=t,{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=b.useContext($T),[f,p]=b.useState(!1);return Q(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!i&&a.current===r){if(p(!1),s){let t=r;return d.start(s,()=>{n.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[i,r,a,o,s,c,l,d,n]),Q(()=>{if(!i)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:n.setOpen,setIsInstantPhase:p},a.current=r,o.current={open:0,close:XT(c.current,`close`)},t!==null&&t!==r?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,ET(fT))):(p(!1),e?.setIsInstantPhase(!1))},[i,r,n,a,o,s,c,l,d]),Q(()=>()=>{l.current=null},[l]),b.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function nE(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function rE(e){let t=Nx(iE,e).current;return t.next=e,Q(t.effect),t}function iE(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var aE={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},oE={...aE,position:`fixed`,top:0,left:0},sE={...aE,position:`absolute`},cE=b.forwardRef(function(e,t){let[n,r]=b.useState();Q(()=>{oC&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,y.jsx)(`span`,{...e,ref:t,style:oE,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})});function lE(e){return`data-base-ui-${e}`}var uE=0;function dE(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(uE);let a=()=>e?.focus({preventScroll:n});if(i)return a(),vS;let o=requestAnimationFrame(a);return uE=o,()=>{uE===o&&(cancelAnimationFrame(o),uE=0)}}var fE={inert:new WeakMap,"aria-hidden":new WeakMap},pE=`data-base-ui-inert`,mE={inert:new WeakSet,"aria-hidden":new WeakSet},hE=new WeakMap,gE=0;function _E(e){return mE[e]}function vE(e){return e?mx(e)?e.host:vE(e.parentNode):null}var yE=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=vE(t);return e.contains(n)?n:null}).filter(e=>e!=null),bE=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},xE=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{cx(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function SE(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=yE(t,e),u=i?yE(t,a):[],d=new Set(u),f=i?xE(t,bE(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=fE[o],n=_E(o);c=n,s=e;let r=yE(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);xE(t,bE(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(hE.get(e)||0)+1;hE.set(e,t),m.push(e),t===1&&e.setAttribute(pE,``)}),gE+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(hE.get(e)||0)-1;hE.set(e,t),t||e.removeAttribute(pE)}),--gE,gE||(fE.inert=new WeakMap,fE[`aria-hidden`]=new WeakMap,mE.inert=new WeakSet,mE[`aria-hidden`]=new WeakSet,hE=new WeakMap)}}function CE(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=$S(e[0]).body;return SE(e,o,n,r,{mark:i,markerIgnoreElements:a})}var wE={style:{transition:`none`}},TE=`data-base-ui-click-trigger`,EE={fallbackAxisSide:`none`},DE={fallbackAxisSide:`end`},OE={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},kE=b.createContext(null),AE=()=>b.useContext(kE),jE=lE(`portal`);function ME(e={}){let{ref:t,container:n,componentProps:r=bS,elementProps:i}=e,a=GS(),o=AE()?.portalNode,[s,c]=b.useState(null),[l,u]=b.useState(null),d=Z(e=>{e!==null&&u(e)}),f=b.useRef(null);Q(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(dx(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=wS(`div`,r,{ref:[t,d],props:[{id:a,[jE]:``},i]});return{portalNode:l,portalSubtree:s&&p?oT.createPortal(p,s):null}}var NE=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,style:s,...c}=e,{portalNode:l,portalSubtree:u}=ME({container:r,ref:t,componentProps:e,elementProps:c}),d=b.useRef(null),f=b.useRef(null),p=b.useRef(null),m=b.useRef(null),[h,g]=b.useState(null),_=b.useRef(!1),v=h?.modal,x=h?.open,S=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;b.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&Uw(e)&&(e.type===`focusin`?_.current&&=(Gw(l),!1):(Ww(l),_.current=!0))}return nE(zT(l,`focusin`,e,!0),zT(l,`focusout`,e,!0))},[l,v]),b.useEffect(()=>{!l||x!==!1||(Gw(l),_.current=!1)},[x,l]);let C=b.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,y.jsxs)(b.Fragment,{children:[u,(0,y.jsxs)(kE.Provider,{value:C,children:[S&&l&&(0,y.jsx)(cE,{"data-type":`outside`,ref:d,onFocus:e=>{Uw(e,l)?p.current?.focus():Hw(h?h.domReference:null)?.focus()}}),S&&l&&(0,y.jsx)(`span`,{"aria-owns":l.id,style:OE}),l&&oT.createPortal(n,l),S&&l&&(0,y.jsx)(cE,{"data-type":`outside`,ref:f,onFocus:e=>{Uw(e,l)?m.current?.focus():(Vw(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,ET(`focus-out`,e.nativeEvent)))}})]})]})});function PE(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var FE=b.createContext(null),IE=b.createContext(null),LE=()=>b.useContext(FE)?.id||null,RE=e=>{let t=b.useContext(IE);return e??t};function zE(e,t){let n=lx(xC(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var BE=20,VE=[];function HE(){VE=VE.filter(e=>e.deref()?.isConnected)}function UE(e){HE(),e&&cx(e)!==`body`&&(VE.push(new WeakRef(e)),VE.length>BE&&(VE=VE.slice(-BE)))}function WE(){return HE(),VE[VE.length-1]?.deref()}function GE(e){return e?Lw(e)?e:zw(e)[0]||e:null}function KE(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=Rw(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Lw(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function qE(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:x,dataRef:S}=h.context,C=Z(()=>S.current.floatingContext?.nodeId),w=i===!1,T=DC(_)&&w,E=b.useRef([`content`]),D=rE(i),O=rE(a),k=rE(l),A=RE(p),j=AE(),M=b.useRef(!1),N=b.useRef(!1),P=b.useRef(!1),F=b.useRef(null),I=b.useRef(``),L=b.useRef(``),ee=b.useRef(null),R=b.useRef(null),te=lS(ee,f,j?.beforeInsideRef),z=lS(R,j?.afterInsideRef),B=Xw(),V=Xw(),ne=eT(),re=j!=null,H=kC(v),ie=Z((e=H)=>e?zw(e):[]),ae=Z(()=>m?.().filter(e=>e!=null)??[]);b.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&bC(H,yC($S(H)))&&ie().length===0&&!T&&MC(e)}return zT($S(H),`keydown`,e)},[r,_,H,s,E,T,ie]),b.useEffect(()=>{if(r||!g)return;let e=$S(H);function t(){P.current=!1}function n(e){let t=xC(e),n=ae();P.current=!(bC(v,t)||bC(_,t)||bC(j?.portalNode,t)||n.some(e=>e===t||bC(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(N.current=!0)}function i(){L.current=`keyboard`}return nE(zT(e,`pointerdown`,n,!0),zT(e,`pointerup`,t,!0),zT(e,`pointercancel`,t,!0),zT(e,`keydown`,i,!0))},[r,v,_,H,g,j,ae]),b.useEffect(()=>{if(r||!c)return;let e=$S(H);function t(){N.current=!0,V.start(0,()=>{N.current=!1})}function n(e){let t=xC(e);Lw(t)&&(F.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=xC(t);queueMicrotask(()=>{let a=C(),c=h.context.triggerElements,l=ae(),f=n?.hasAttribute(lE(`focus-guard`))&&[ee.current,R.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,tT(d),tT(u)].includes(n),p=!(bC(_,n)||bC(v,n)||bC(n,v)||bC(j?.portalNode,n)||l.some(e=>e===n||bC(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>bC(e,n))||f||A&&(AC(A.nodesRef.current,a).find(e=>bC(e.context?.elements.floating,n)||bC(e.context?.elements.domReference,n))||jC(A.nodesRef.current,a).find(e=>[e.context?.elements.floating,kC(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&H&&KE(H,E),o&&r!==_&&!Cw(i)&&yC(e)===e.body){if(px(H)&&(H.focus(),o===`popup`)){ne.request(()=>{H.focus()});return}let e=ie(),t=F.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||H;px(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(T||!s)&&n&&p&&!N.current&&(T||n!==WE())&&(M.current=!0,h.setOpen(!1,ET(yT,t)))})}function a(){P.current||(S.current.insideReactTree=!0,B.start(0,()=>{S.current.insideReactTree=!1}))}let l=px(_)?_:null;if(!(!v&&!l))return nE(l&&zT(l,`focusout`,i),l&&zT(l,`pointerdown`,t),v&&zT(v,`focusin`,n),v&&zT(v,`focusout`,i),v&&j&&zT(v,`focusout`,a,!0))},[r,_,v,H,s,A,j,h,c,o,ie,T,C,E,S,B,V,ne,u,d,ae]),b.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${lE(`portal`)}]`)||[]),t=(A?jC(A.nodesRef.current,C()):[]).find(e=>DC(e.context?.elements.domReference||null))?.context?.elements.domReference,n=CE([...[v,...e,ee.current,R.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...ae()],t,tT(d),tT(u),T?_:null].filter(e=>e!=null),{ariaHidden:s||T,mark:!1}),i=CE([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,E,j,T,A,C,u,d,ae]),Q(()=>{if(!g||r||!px(H))return;let e=yC($S(H));queueMicrotask(()=>{let t=D.current,n=typeof t==`function`?t(k.current||``):t;if(n===void 0||n===!1||bC(H,e))return;let r=null,i=()=>(r??=ie(H),r[0]||H),a;a=n===!0||n===null?i():tT(n),a||=i(),dE(a,{preventScroll:a===H})})},[r,g,H,w,ie,D,k]),Q(()=>{if(r||!H)return;let e=$S(H);UE(yC(e));function t(e){if(e.open||(I.current=zE(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(M.current=!0),e.reason===`outside-press`)if(e.nested)M.current=!1;else if(PC(e.nativeEvent)||FC(e.nativeEvent))M.current=!1;else{let e=!1;$S(H).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?M.current=!1:M.current=!0}}x.on(`openchange`,t);function n(){let e=O.current,t=typeof e==`function`?e(I.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=_||WE();return e&&e.isConnected?e:null}let n=_||WE();return tT(t)||n||null}return()=>{x.off(`openchange`,t);let r=yC(e),i=ae(),a=bC(v,r)||i.some(e=>e===r||bC(e,r))||A&&AC(A.nodesRef.current,C(),!1).some(e=>bC(e.context?.elements.floating,r)),o=O.current,s=n();queueMicrotask(()=>{let t=GE(s),n=typeof o!=`boolean`;o&&!M.current&&px(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),M.current=!1})}},[r,v,H,O,S,x,A,_,C,ae]),Q(()=>{if(!iC||g||!v)return;let e=yC($S(v));!px(e)||!TC(e)||bC(v,e)&&e.blur()},[g,v]),Q(()=>{if(!(r||!j))return j.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{j.setFocusManagerState(null)}},[r,j,s,g,h,c,_]),Q(()=>{if(!(r||!H))return KE(H,E),()=>{queueMicrotask(HE)}},[r,H,E]);let oe=!r&&(s?!T:!0)&&(re||s);return(0,y.jsxs)(b.Fragment,{children:[oe&&(0,y.jsx)(cE,{"data-type":`inside`,ref:te,onFocus:e=>{if(s){let e=ie();dE(e[e.length-1])}else j?.portalNode&&(M.current=!1,Uw(e,j.portalNode)?Vw(_)?.focus():tT(d??j.beforeOutsideRef)?.focus())}}),n,oe&&(0,y.jsx)(cE,{"data-type":`inside`,ref:z,onFocus:e=>{s?dE(ie()[0]):j?.portalNode&&(c&&(M.current=!0),Uw(e,j.portalNode)?Hw(_)?.focus():tT(u??j.afterOutsideRef)?.focus())}})]})}function JE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=pT}=t,d=b.useRef(void 0),f=eT(),p=Xw(),m=b.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||IC(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=xC(i);if(TC(y)){let e=ET(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=ET(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(IC(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||LC(f))),g=ET(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return b.useMemo(()=>i?{reference:m}:bS,[i,m])}function YE(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function XE(e){return e!=null&&e.clientX!=null}function ZE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`}=t,l=b.useRef(!1),u=b.useRef(null),[d,f]=b.useState(),[p,m]=b.useState([]),h=Z((e,t,r)=>{l.current||o.current.openEvent&&!XE(o.current.openEvent)||n.set(`positionReference`,YE(r??a,{x:e,y:t,axis:c,dataRef:o,pointerType:d}))}),g=Z(e=>{r?u.current||m([]):h(e.clientX,e.clientY,e.currentTarget)}),_=IC(d)?i:r,v=b.useCallback(()=>{if(!_||!s)return;let e=lx(i);function t(e){bC(i,xC(e))?(u.current?.(),u.current=null):h(e.clientX,e.clientY)}if(!o.current.openEvent||XE(o.current.openEvent))return u.current=zT(e,`mousemove`,t),()=>{u.current?.(),u.current=null};n.set(`positionReference`,a)},[_,s,i,o,a,n,h]);b.useEffect(()=>v(),[v,p]),b.useEffect(()=>{s&&!i&&(l.current=!1)},[s,i]),b.useEffect(()=>{!s&&r&&(l.current=!0)},[s,r]);let y=b.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return b.useMemo(()=>s?{reference:y,trigger:y}:{},[s,y])}var QE={intentional:`onClick`,sloppy:`onPointerDown`};function $E(){return!1}function eD(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function tD(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`sloppy`,referencePress:u=$E,referencePressEvent:d=`sloppy`,bubbles:f,externalTree:p}=t,m=RE(p),h=Z(typeof c==`function`?c:()=>!1),g=typeof c==`function`?h:c,_=g!==!1,v=Z(()=>l),y=b.useRef(!1),x=b.useRef(!1),S=b.useRef(!1),{escapeKey:C,outsidePress:w}=eD(f),T=b.useRef(null),E=Xw(),D=Xw(),O=Z(()=>{D.clear(),a.current.insideReactTree=!1}),k=b.useRef(!1),A=b.useRef(``),j=Z(u),M=Z(e=>{if(!r||!o||!s||e.key!==`Escape`||k.current)return;let t=a.current.floatingContext?.nodeId,i=m?AC(m.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let c=ET(bT,NC(e)?e.nativeEvent:e);n.setOpen(!1,c),!C&&!c.isPropagationAllowed&&e.stopPropagation()}),N=Z(()=>{a.current.insideReactTree=!0,D.start(0,O)});b.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=C,a.current.__outsidePressBubbles=w;let e=new Yw,t=new Yw;function c(){e.clear(),k.current=!0}function l(){e.start(wx()?5:0,()=>{k.current=!1})}function u(){S.current=!0,t.start(0,()=>{S.current=!1})}function d(){y.current=!1,x.current=!1}function f(){let e=A.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function p(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=a.current.floatingContext?.nodeId,r=m&&AC(m.nodesRef.current,t).some(t=>CC(e,t.context?.elements.floating));return CC(e,n.select(`floatingElement`))||CC(e,n.select(`domReferenceElement`))||r}function b(e){if(p(e)){O();return}if(a.current.insideReactTree){O();return}let r=xC(e),i=`[${lE(`inert`)}]`,o=fx(r)?r.getRootNode():null,s=Array.from((mx(o)?o:$S(n.select(`floatingElement`))).querySelectorAll(i)),c=n.context.triggerElements;if(r&&(c.hasElement(r)||c.hasMatchingElement(e=>bC(e,r))))return;let l=fx(r)?r:null;for(;l&&!Tx(l);){let e=Ox(l);if(Tx(e)||!fx(e))break;l=e}if(s.length&&fx(r)&&!wC(r)&&!bC(r,n.select(`floatingElement`))&&s.every(e=>!bC(l,e)))return;if(px(r)&&!(`touches`in e)){let t=Tx(r),n=Ex(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}if(h(e))return;if(f()===`intentional`&&S.current){t.clear(),S.current=!1;return}if(typeof g==`function`&&!g(e))return;let u=a.current.floatingContext?.nodeId,d=m?AC(m.nodesRef.current,u):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,ET(gT,e)),O()}function D(e){f()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!o||CC(e,n.select(`floatingElement`))||CC(e,n.select(`domReferenceElement`))||b(e)}function j(e){if(f()!==`sloppy`||!n.select(`open`)||!o||CC(e,n.select(`floatingElement`))||CC(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function N(e,t){let n=xC(e);if(!n)return;let r=zT(n,e.type,()=>{t(e),r()})}function P(e){A.current=`touch`,N(e,j)}function F(e){E.clear(),e.type===`pointerdown`&&(A.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&N(e,e=>{e.type===`pointerdown`?D(e):b(e)})}function I(e){if(!y.current)return;let n=x.current;if(d(),f()===`intentional`){if(e.type===`pointercancel`){n&&u();return}if(!h(e)){if(n){u();return}typeof g==`function`&&!g(e)||(t.clear(),S.current=!0,O())}}}function L(e){if(f()!==`sloppy`||!T.current||CC(e,n.select(`floatingElement`))||CC(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(b(e),E.clear(),T.current=null)}function ee(e){N(e,L)}function R(e){f()!==`sloppy`||!T.current||CC(e,n.select(`floatingElement`))||CC(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&b(e),E.clear(),T.current=null)}function te(e){N(e,R)}let z=$S(i),B=nE(s&&nE(zT(z,`keydown`,M),zT(z,`compositionstart`,c),zT(z,`compositionend`,l)),_&&nE(zT(z,`click`,F,!0),zT(z,`pointerdown`,F,!0),zT(z,`pointerup`,I,!0),zT(z,`pointercancel`,I,!0),zT(z,`mousedown`,F,!0),zT(z,`mouseup`,I,!0),zT(z,`touchstart`,P,!0),zT(z,`touchmove`,ee,!0),zT(z,`touchend`,te,!0)));return()=>{B(),e.clear(),t.clear(),d(),S.current=!1}},[a,i,s,_,g,r,o,C,w,M,O,v,m,n,E]),b.useEffect(O,[g,O]);let P=b.useMemo(()=>({onKeyDown:M,[QE[d]]:e=>{j()&&n.setOpen(!1,ET(pT,e.nativeEvent))},...d!==`intentional`&&{onClick(e){j()&&n.setOpen(!1,ET(`trigger-press`,e.nativeEvent))}}}),[M,n,d,j]),F=Z(e=>{if(!r||!o||e.button!==0)return;let t=xC(e.nativeEvent);bC(n.select(`floatingElement`),t)&&(y.current||(y.current=!0,x.current=!1))}),I=Z(e=>{!r||!o||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&y.current&&(x.current=!0)}),L=b.useMemo(()=>({onKeyDown:M,onPointerDown:I,onMouseDown:I,onClickCapture:N,onMouseDownCapture(e){N(),F(e)},onPointerDownCapture(e){N(),F(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,F,I]);return b.useMemo(()=>o?{reference:P,floating:L,trigger:P}:{},[o,P,L])}function nD(e,t,n){let{reference:r,floating:i}=e,a=ZC(t),o=QC(t),s=XC(o),c=qC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(JC(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function rD(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=KC(t,e),p=uw(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=dw(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=dw(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var iD=50,aD=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:rD},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=nD(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<iD&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=nD(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},oD=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=KC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=qC(r),_=ZC(o),v=qC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[cw(o)]:ew(o)),x=p!==`none`;!d&&x&&b.push(...sw(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=$C(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==ZC(t))||T.every(e=>ZC(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=ZC(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function sD(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function cD(e){return RC.some(t=>e[t]>=0)}var lD=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=KC(e,t);switch(i){case`referenceHidden`:{let e=sD(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:cD(e)}}}case`escaped`:{let e=sD(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:cD(e)}}}default:return{}}}}},uD=new Set([`left`,`top`]);async function dD(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=qC(n),s=JC(n),c=ZC(n)===`y`,l=uD.has(o)?-1:1,u=a&&c?-1:1,d=KC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var fD=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await dD(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},pD=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=KC(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=ZC(qC(i)),p=YC(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=GC(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=GC(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},mD=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=KC(e,t),u={x:n,y:r},d=ZC(i),f=YC(d),p=u[f],m=u[d],h=KC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=uD.has(qC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},hD=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=KC(e,t),u=await o.detectOverflow(t,l),d=qC(i),f=JC(i),p=ZC(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=zC(h-u[g],v),x=zC(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=BC(u.left,0),t=BC(u.right,0),n=BC(u.top,0),r=BC(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:BC(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:BC(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function gD(e){let t=Ex(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=px(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=VC(n)!==a||VC(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function _D(e){return fx(e)?e:e.contextElement}function vD(e){let t=_D(e);if(!px(t))return UC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=gD(t),o=(a?VC(n.width):n.width)/r,s=(a?VC(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var yD=UC(0);function bD(e){let t=lx(e);return!wx()||!t.visualViewport?yD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xD(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==lx(e)?!1:t}function SD(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=_D(e),o=UC(1);t&&(r?fx(r)&&(o=vD(r)):o=vD(e));let s=xD(a,n,r)?bD(a):UC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=lx(a),t=r&&fx(r)?lx(r):r,n=e,i=jx(n);for(;i&&r&&t!==n;){let e=vD(i),t=i.getBoundingClientRect(),r=Ex(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=lx(i),i=jx(n)}}return dw({width:u,height:d,x:c,y:l})}function CD(e,t){let n=Dx(e).scrollLeft;return t?t.left+n:SD(ux(e)).left+n}function wD(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-CD(e,n),y:n.top+t.scrollTop}}function TD(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ux(r),s=t?_x(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=UC(1),u=UC(0),d=px(r);if((d||!d&&!a)&&((cx(r)!==`body`||hx(o))&&(c=Dx(r)),d)){let e=SD(r);l=vD(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?wD(o,c):UC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ED(e){return Array.from(e.getClientRects())}function DD(e){let t=ux(e),n=Dx(e),r=e.ownerDocument.body,i=BC(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=BC(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+CD(e),s=-n.scrollTop;return Ex(r).direction===`rtl`&&(o+=BC(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var OD=25;function kD(e,t){let n=lx(e),r=ux(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=wx();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=CD(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=OD&&(a-=o)}else l<=OD&&(a+=l);return{width:a,height:o,x:s,y:c}}function AD(e,t){let n=SD(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=px(e)?vD(e):UC(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function jD(e,t,n){let r;if(t===`viewport`)r=kD(e,n);else if(t===`document`)r=DD(ux(e));else if(fx(t))r=AD(t,n);else{let n=bD(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return dw(r)}function MD(e,t){let n=Ox(e);return n===t||!fx(n)||Tx(n)?!1:Ex(n).position===`fixed`||MD(n,t)}function ND(e,t){let n=t.get(e);if(n)return n;let r=Ax(e,[],!1).filter(e=>fx(e)&&cx(e)!==`body`),i=null,a=Ex(e).position===`fixed`,o=a?Ox(e):e;for(;fx(o)&&!Tx(o);){let t=Ex(o),n=Sx(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||hx(o)&&!n&&MD(e,o))?r=r.filter(e=>e!==o):i=t,o=Ox(o)}return t.set(e,r),r}function PD(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?_x(t)?[]:ND(t,this._c):[].concat(n),r],o=jD(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=jD(t,a[e],i);s=BC(n.top,s),c=zC(n.right,c),l=zC(n.bottom,l),u=BC(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function FD(e){let{width:t,height:n}=gD(e);return{width:t,height:n}}function ID(e,t,n){let r=px(t),i=ux(t),a=n===`fixed`,o=SD(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=UC(0);function l(){c.x=CD(i)}if(r||!r&&!a)if((cx(t)!==`body`||hx(i))&&(s=Dx(t)),r){let e=SD(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?wD(i,s):UC(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function LD(e){return Ex(e).position===`static`}function RD(e,t){if(!px(e)||Ex(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ux(e)===n&&(n=n.ownerDocument.body),n}function zD(e,t){let n=lx(e);if(_x(e))return n;if(!px(e)){let t=Ox(e);for(;t&&!Tx(t);){if(fx(t)&&!LD(t))return t;t=Ox(t)}return n}let r=RD(e,t);for(;r&&gx(r)&&LD(r);)r=RD(r,t);return r&&Tx(r)&&LD(r)&&!Sx(r)?n:r||Cx(e)||n}var BD=async function(e){let t=this.getOffsetParent||zD,n=this.getDimensions,r=await n(e.floating);return{reference:ID(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function VD(e){return Ex(e).direction===`rtl`}var HD={convertOffsetParentRelativeRectToViewportRelativeRect:TD,getDocumentElement:ux,getClippingRect:PD,getOffsetParent:zD,getElementRects:BD,getClientRects:ED,getDimensions:FD,getScale:vD,isElement:fx,isRTL:VD};function UD(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function WD(e,t){let n=null,r,i=ux(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=HC(d),h=HC(i.clientWidth-(u+f)),g=HC(i.clientHeight-(d+p)),_=HC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:BC(0,zC(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!UD(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function GD(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=_D(e),u=i||a?[...l?Ax(l):[],...t?Ax(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?WD(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?SD(e):null;c&&g();function g(){let t=SD(e);h&&!UD(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var KD=fD,qD=pD,JD=oD,YD=hD,XD=lD,ZD=mD,QD=(e,t,n)=>{let r=new Map,i={platform:HD,...n},a={...i.platform,_c:r};return aD(e,t,{...i,platform:a})},$D=typeof document<`u`?b.useLayoutEffect:function(){};function eO(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!eO(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!eO(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function tO(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nO(e,t){let n=tO(e);return Math.round(t*n)/n}function rO(e){let t=b.useRef(e);return $D(()=>{t.current=e}),t}function iO(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);eO(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=rO(c),O=rO(i),k=rO(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),QD(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!eO(T.current,t)&&(T.current=t,oT.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);$D(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);$D(()=>(j.current=!0,()=>{j.current=!1}),[]),$D(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),P=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=nO(N.floating,u.x),r=nO(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...tO(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var aO=(e,t)=>{let n=KD(e);return{name:n.name,fn:n.fn,options:[e,t]}},oO=(e,t)=>{let n=qD(e);return{name:n.name,fn:n.fn,options:[e,t]}},sO=(e,t)=>({fn:ZD(e).fn,options:[e,t]}),cO=(e,t)=>{let n=JD(e);return{name:n.name,fn:n.fn,options:[e,t]}},lO=(e,t)=>{let n=YD(e);return{name:n.name,fn:n.fn,options:[e,t]}},uO=(e,t)=>{let n=XD(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(nS(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},dO=o((e=>{var t=f();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),fO=o(((e,t)=>{t.exports=dO()})),pO=o((e=>{var t=f(),n=fO();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),mO=o(((e,t)=>{t.exports=pO()})),hO=[],gO=void 0;function _O(){return gO}function vO(e){hO.push(e)}function yO(e){let t=(t,n)=>{let r=Nx(xO).current,i;try{gO=r;for(let e of hO)e.before(r);i=e(t,n);for(let e of hO)e.after(r);r.didInitialize=!0}finally{gO=void 0}return i};return t.displayName=e.displayName||e.name,t}function bO(e){return b.forwardRef(yO(e))}function xO(){return{didInitialize:!1}}var SO=fO(),CO=mO(),wO=gS(19)?DO:OO;function TO(e,t,n,r,i){return wO(e,t,n,r,i)}function EO(e,t,n,r,i){let a=b.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,SO.useSyncExternalStore)(e.subscribe,a,a)}vO({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,SO.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function DO(e,t,n,r,i){let a=_O();if(!a)return EO(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function OO(e,t,n,r,i){return(0,CO.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var kO=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return TO(this,e,t,n,r)}},AO=class extends kO{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){b.useDebugValue(e),Q(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;Q(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Q(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){b.useDebugValue(e);let n=t!==void 0;Q(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return b.useDebugValue(e),TO(this,this.selectors[e],t,n,r)}useContextCallback(e,t){b.useDebugValue(e);let n=Z(t??vS);this.context[e]=n}useStateSetter(e){let t=b.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},jO={open:$(e=>e.open),transitionStatus:$(e=>e.transitionStatus),domReferenceElement:$(e=>e.domReferenceElement),referenceElement:$(e=>e.positionReference??e.referenceElement),floatingElement:$(e=>e.floatingElement),floatingId:$(e=>e.floatingId)},MO=class extends AO{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:PE(),nested:n,triggerElements:i},jO),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&LC(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function NO(e,t){let n=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function PO(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=NO(e,n),o=Z(t=>{if(a(t),!t||!n.select(`open`))return;let i=n.select(`activeTriggerId`);if(i===e){n.update({activeTriggerElement:t,...r});return}i??n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return Q(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function FO(e){let t=e.useState(`open`);Q(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function IO(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=lT(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=Z(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return cT({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var LO=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function RO(){return new MO({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new LO,floatingId:``,syncOnly:!1,nested:!1,onOpenChange:void 0})}function zO(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:RO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:bS,inactiveTriggerProps:bS,popupProps:bS}}var BO=$(e=>e.triggerIdProp??e.activeTriggerId),VO={open:$(e=>e.openProp??e.open),mounted:$(e=>e.mounted),transitionStatus:$(e=>e.transitionStatus),floatingRootContext:$(e=>e.floatingRootContext),preventUnmountingOnClose:$(e=>e.preventUnmountingOnClose),payload:$(e=>e.payload),activeTriggerId:BO,activeTriggerElement:$(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:$((e,t)=>t!==void 0&&BO(e)===t),isOpenedByTrigger:$((e,t)=>t!==void 0&&BO(e)===t&&e.open),isMountedByTrigger:$((e,t)=>t!==void 0&&BO(e)===t&&e.mounted),triggerProps:$((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:$(e=>e.popupProps),popupElement:$(e=>e.popupElement),positionerElement:$(e=>e.positionerElement)};function HO(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=GS(),a=LE()!=null,o=Nx(()=>new MO({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new LO,floatingId:i,syncOnly:!1,nested:a})).current;return Q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=fx(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function UO(e={}){let{nodeId:t,externalTree:n}=e,r=HO(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=b.useState(null),c=b.useRef(null),l=RE(n);Q(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=iO({...e,elements:{...a,...o&&{reference:o}}}),d=b.useCallback(e=>{let t=fx(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=b.useState(void 0),[m,h]=b.useState(null);i.useSyncedValue(`referenceElement`,f??null);let g=fx(f)?f:null;i.useSyncedValue(`domReferenceElement`,f===void 0?a.domReference:g),i.useSyncedValue(`floatingElement`,m);let _=b.useCallback(e=>{(fx(e)||e===null)&&(c.current=e,p(e)),(fx(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!fx(e))&&u.refs.setReference(e)},[u.refs,p]),v=b.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),y=b.useMemo(()=>({...u.refs,setReference:_,setFloating:v,setPositionReference:d,domReference:c}),[u.refs,_,v,d]),x=b.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),S=i.useState(`open`),C=i.useState(`floatingId`),w=b.useMemo(()=>({...u,dataRef:i.context.dataRef,open:S,onOpenChange:i.setOpen,events:i.context.events,floatingId:C,refs:y,elements:x,nodeId:t,rootStore:i}),[u,y,x,t,i,S,C]);return Q(()=>{i.context.dataRef.current.floatingContext=w;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=w)}),b.useMemo(()=>({...u,context:w,refs:y,elements:x,rootStore:i}),[u,y,x,w,i])}function WO(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=GS(),a=LE()!=null,o=t.useState(`open`),s=t.useState(`activeTriggerElement`),c=t.useState(n?`popupElement`:`positionerElement`),l=t.context.triggerElements,u=Nx(()=>new MO({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:c,triggerElements:l,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return Q(()=>{let e={open:o,floatingId:i,referenceElement:s,floatingElement:c};fx(s)&&(e.domReferenceElement=s),u.state.positionReference===u.state.referenceElement&&(e.positionReference=s),u.update(e)},[o,i,s,c,u]),u.context.onOpenChange=r,u.context.nested=a,u}var GO=cC&&oC;function KO(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=b.useRef(!1),c=b.useRef(null),l=Xw(),u=b.useRef(!0);b.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=lx(e);function r(){let e=n.select(`domReferenceElement`);!n.select(`open`)&&px(e)&&e===yC($S(e))&&(s.current=!0)}function i(){u.current=!0}function o(){u.current=!1}return nE(zT(t,`blur`,r),GO&&zT(t,`keydown`,i,!0),GO&&zT(t,`pointerdown`,o,!0))},[n,a]),b.useEffect(()=>{if(!a)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=n.select(`domReferenceElement`);fx(e)&&(c.current=e,s.current=!0)}}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a,n]);let d=b.useMemo(()=>({onMouseLeave(){s.current=!1,c.current=null},onFocus(e){let t=e.currentTarget;if(s.current){if(c.current===t)return;s.current=!1,c.current=null}let r=xC(e.nativeEvent);if(fx(r)){if(GO&&!e.relatedTarget){if(!u.current&&!TC(r))return}else if(!OC(r))return}let i=SC(e.relatedTarget,n.context.triggerElements),{nativeEvent:a,currentTarget:d}=e,f=typeof o==`function`?o():o;if(n.select(`open`)&&i||f===0||f===void 0){n.setOpen(!0,ET(hT,a,d));return}l.start(f,()=>{s.current||n.setOpen(!0,ET(hT,a,d))})},onBlur(e){s.current=!1,c.current=null;let t=e.relatedTarget,r=e.nativeEvent,a=fx(t)&&t.hasAttribute(lE(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let e=n.select(`domReferenceElement`),o=yC($S(e));!t&&o===e||bC(i.current.floatingContext?.refs.floating.current,o)||bC(e,o)||a||SC(t??o,n.context.triggerElements)||n.setOpen(!1,ET(hT,r))})}}),[i,n,l,o]);return b.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}var qO=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Yw,this.restTimeout=new Yw,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},JO=new WeakMap;function YO(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&JO.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),JO.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function XO(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=JO.get(n);a&&a!==e&&YO(a),YO(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,JO.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function ZO(e){let t=Nx(qO.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||=t,qw(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function QO(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,nodeId:l}=t,u=ZO(n),d=RE(),f=LE(),p=Z(()=>QT(o.current.openEvent?.type,u.interactedInside)),m=Z(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),h=Z(e=>SC(e,n.context.triggerElements)),g=b.useCallback(e=>{let t=XT(c,`close`,u.pointerType),r=()=>{n.setOpen(!1,ET(mT,e)),d?.events.emit(`floating.closed`,e)};t?u.openChangeTimeout.start(t,r):(u.openChangeTimeout.clear(),r())},[c,n,u,d]),_=Z(()=>{YO(u)}),v=Z(e=>{let t=xC(e);if(!EC(t)){u.interactedInside=!1;return}u.interactedInside=t?.closest(`[aria-haspopup]`)!=null});Q(()=>{r||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,_())},[r,u,_]),b.useEffect(()=>_,[_]),Q(()=>{if(s&&r&&u.handleCloseOptions?.blockPointerEvents&&m()&&fx(a)&&i){let e=a,t=i,n=$S(i),r=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),XO(u,{scopeElement:u.handleCloseOptions?.getScope?.()??u.pointerEventsScopeElement??r??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{_()}}},[s,r,a,i,u,m,d,f,_]);let y=Xw();b.useEffect(()=>{if(!s)return;function e(){u.openChangeTimeout.clear(),y.clear(),d?.events.off(`floating.closed`,r),_()}function t(e){if(d&&f&&AC(d.nodesRef.current,f).length>0){d.events.on(`floating.closed`,r);return}if(h(e.relatedTarget))return;let t=o.current.floatingContext?.nodeId??l,n=e.relatedTarget;if(!(d&&t&&fx(n)&&AC(d.nodesRef.current,t,!1).some(e=>bC(e.context?.elements.floating,n)))){if(u.handler){u.handler(e);return}_(),p()||g(e)}}function r(e){!d||!f||AC(d.nodesRef.current,f).length>0||y.start(0,()=>{d.events.off(`floating.closed`,r),n.setOpen(!1,ET(mT,e)),d.events.emit(`floating.closed`,e)})}let a=i;return nE(a&&zT(a,`mouseenter`,e),a&&zT(a,`mouseleave`,t),a&&zT(a,`pointerdown`,v,!0),()=>{d?.events.off(`floating.closed`,r)})},[s,i,n,o,l,p,h,g,_,v,u,d,f,y])}var $O={current:null};function ek(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=$O,externalTree:f,isActiveTrigger:p=!0,getHandleCloseContext:m,isClosing:h}=t,g=RE(f),_=ZO(n),v=b.useRef(!1),y=rE(s),x=rE(o),S=rE(l),C=rE(a),w=rE(h);p&&(_.handleCloseOptions=y.current?.__options);let T=Z(()=>QT(r.current.openEvent?.type,_.interactedInside)),E=Z(e=>SC(e,n.context.triggerElements)),D=Z((e,t,r)=>{let i=n.context.triggerElements;if(i.hasElement(t))return!e||!bC(e,t);if(!fx(r))return!1;let a=r;return i.hasMatchingElement(e=>bC(e,a))&&(!e||!bC(e,a))}),O=Z((e,t=!0)=>{let r=XT(x.current,`close`,_.pointerType);r?_.openChangeTimeout.start(r,()=>{n.setOpen(!1,ET(mT,e)),g?.events.emit(`floating.closed`,e)}):t&&(_.openChangeTimeout.clear(),n.setOpen(!1,ET(mT,e)),g?.events.emit(`floating.closed`,e))}),k=Z(()=>{_.handler&&=($S(n.select(`domReferenceElement`)).removeEventListener(`mousemove`,_.handler),void 0)}),A=Z(()=>{YO(_)});return b.useEffect(()=>k,[k]),b.useEffect(()=>{if(!a)return;function e(e){e.open?v.current=!1:(v.current=e.reason===mT,k(),_.openChangeTimeout.clear(),_.restTimeout.clear(),_.blockMouseMove=!0,_.restTimeoutPending=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,_,k]),b.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!fx(e))return;function t(e){if(_.openChangeTimeout.clear(),_.blockMouseMove=!1,c&&!IC(_.pointerType))return;let t=ZT(S.current),r=XT(x.current,`open`,_.pointerType),i=xC(e),a=e.currentTarget??null,o=n.select(`domReferenceElement`),s=a;if(fx(i)&&!n.context.triggerElements.hasElement(i)){for(let e of n.context.triggerElements.elements())if(bC(e,i)){s=e;break}}fx(a)&&fx(o)&&!n.context.triggerElements.hasElement(a)&&bC(a,o)&&(s=o);let l=s==null?!1:D(o,s,i),u=n.select(`open`),d=w.current?.()??n.select(`transitionStatus`)===`ending`,f=!u&&d&&v.current,p=!l&&fx(s)&&fx(o)&&bC(o,s)&&f,m=t>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){n.setOpen(!0,ET(mT,e,s));return}m||(r?_.openChangeTimeout.start(r,()=>{g&&n.setOpen(!0,ET(mT,e,s))}):g&&n.setOpen(!0,ET(mT,e,s)))}function i(e){if(T()){A();return}k();let t=$S(n.select(`domReferenceElement`));_.restTimeout.clear(),_.restTimeoutPending=!1;let i=r.current.floatingContext??m?.();if(!E(e.relatedTarget)){if(y.current&&i){n.select(`open`)||_.openChangeTimeout.clear();let r=d.current;_.handler=y.current({...i,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!T()&&r===n.select(`domReferenceElement`)&&O(e,!0)}}),t.addEventListener(`mousemove`,_.handler),_.handler(e);return}(_.pointerType!==`touch`||!bC(n.select(`floatingElement`),e.relatedTarget))&&O(e)}}return u?nE(zT(e,`mousemove`,t,{once:!0}),zT(e,`mouseenter`,t),zT(e,`mouseleave`,i)):nE(zT(e,`mouseenter`,t),zT(e,`mouseleave`,i))},[k,A,r,x,O,n,a,y,_,p,D,T,E,c,u,S,d,g,C,m,w]),b.useMemo(()=>{if(!a)return;function e(e){_.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.select(`open`),o=D(i,r,e.target);if(c&&!IC(_.pointerType))return;if(a&&o&&_.handleCloseOptions?.blockPointerEvents){let e=n.select(`floatingElement`);e&&XO(_,{scopeElement:_.handleCloseOptions?.getScope?.()??r.ownerDocument.body,referenceElement:r,floatingElement:e})}let s=ZT(S.current);if(a&&!o||s===0||!o&&_.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;_.restTimeout.clear();function l(){if(_.restTimeoutPending=!1,T())return;let e=n.select(`open`);!_.blockMouseMove&&(!e||o)&&n.setOpen(!0,ET(mT,t,r))}_.pointerType===`touch`?oT.flushSync(()=>{l()}):o&&a?l():(_.restTimeoutPending=!0,_.restTimeout.start(s,l))}}},[a,_,T,D,c,n,S])}function tk(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=b.useCallback(t=>nk(t,e,`reference`),t),o=b.useCallback(t=>nk(t,e,`floating`),n),s=b.useCallback(t=>nk(t,e,`item`),r),c=b.useCallback(t=>nk(t,e,`trigger`),i);return b.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function nk(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[pC]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&rk(a,s,i,r)}return rk(a,e,i,r),a}function rk(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var ik=`Escape`;function ak(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function ok(e,t){return ak(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function sk(e,t,n){return ak(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function ck(e,t,n){return ak(t,n?e===hC:e===gC,e===vC)}function lk(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===ik:ak(t,n?e===gC:e===hC,e===_C)}function uk(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:C,cols:w=1,id:T,resetOnPointerLeave:E=!0,externalTree:D}=t,O=rE(kC(i)),k=LE(),A=RE(D);Q(()=>{o.current.orientation=S},[o,S]);let j=DC(a),M=b.useRef(_),N=b.useRef(d??-1),P=b.useRef(null),F=b.useRef(!0),I=Z(e=>{l(N.current===-1?null:N.current,e)}),L=b.useRef(I),ee=b.useRef(!!i),R=b.useRef(r),te=b.useRef(!1),z=b.useRef(!1),B=b.useRef(null),V=rE(x),ne=rE(r),re=rE(d),H=rE(E),ie=Z(()=>{function e(e){g?A?.events.emit(`virtualfocus`,e):B.current=dE(e,{sync:te.current,preventScroll:!0})}let t=s.current[N.current],n=z.current;t&&e(t),(te.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[N.current]||t;r&&(t||e(r),se&&(n||!F.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Q(()=>{u&&(r&&i?(N.current=d??-1,M.current&&d!=null&&(z.current=!0,I())):ee.current&&(N.current=-1,L.current()))},[u,r,i,d,I]),Q(()=>{if(u){if(!r){te.current=!1;return}if(i)if(c==null){if(te.current=!1,re.current!=null)return;if(ee.current&&(N.current=-1,ie()),(!R.current||!ee.current)&&M.current&&(P.current!=null||M.current===!0&&P.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(N.current=P.current==null||sk(P.current,S,h)||m?mw(s):hw(s),P.current=null,I())};t()}}else pw(s.current,c)||(N.current=c,ie(),z.current=!1)}},[u,r,i,c,re,m,s,S,h,I,ie,V]),Q(()=>{if(!u||i||!A||g||!ee.current)return;let e=A.nodesRef.current,t=e.find(e=>e.id===k)?.context?.elements.floating,n=yC($S(i)),r=e.some(e=>e.context&&bC(e.context.elements.floating,n));t&&!r&&F.current&&t.focus({preventScroll:!0})},[u,i,A,k,g]),Q(()=>{L.current=I,R.current=r,ee.current=!!i}),Q(()=>{r||(P.current=null,M.current=_)},[r,_]);let ae=c!=null,oe=Z(e=>{if(!ne.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&(N.current!==t||c!==t)&&(N.current=t,I(e))}),se=b.useMemo(()=>({onFocus(e){te.current=!0,oe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){te.current=!0,z.current=!1,v&&oe(e)},onPointerLeave(e){if(!ne.current||!F.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!(!v||s.current.includes(t))&&H.current&&(B.current?.(),B.current=null,N.current=-1,I(e),!g)){let e=O.current,t=yC($S(e));e&&bC(e,t)&&e.focus({preventScroll:!0})}}}),[oe,ne,O,v,s,I,H,g]),ce=b.useCallback(()=>C??A?.nodesRef.current.find(e=>e.id===k)?.context?.dataRef?.current.orientation,[k,A,C]),le=Z(e=>{if(F.current=!1,te.current=!0,e.which===229||!ne.current&&e.currentTarget===O.current)return;if(m&&lk(e.key,S,h,w)){ok(e.key,ce())||MC(e),n.setOpen(!1,ET(xT,e.nativeEvent)),px(a)&&(g?A?.events.emit(`virtualfocus`,a):a.focus());return}let t=N.current,i=mw(s,x),o=hw(s,x);if(j||(e.key===`Home`&&(MC(e),N.current=i,I(e)),e.key===`End`&&(MC(e),N.current=o,I(e))),w>1){let t=Array.from({length:s.current.length},()=>({width:1,height:1})),n=vw(t,w,!1),r=n.findIndex(e=>e!=null&&!xw(s.current,e,x)),a=n.reduce((e,t,n)=>t!=null&&!xw(s.current,t,x)?n:e,-1),c=n[_w(n.map(e=>e==null?null:s.current[e]),{event:e,orientation:S,loopFocus:p,rtl:h,cols:w,disabledIndices:bw([...(typeof x==`function`?null:x)||s.current.map((e,t)=>xw(s.current,t,x)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:yw(N.current>o?i:N.current,t,n,w,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(N.current=c,I(e)),S===`both`)return}if(ok(e.key,S)){if(MC(e),r&&!g&&yC(e.currentTarget.ownerDocument)===e.currentTarget){N.current=sk(e.key,S,h)?i:o,I(e);return}sk(e.key,S,h)?p?t>=o?f&&t!==s.current.length?N.current=-1:(te.current=!1,N.current=i):N.current=gw(s.current,{startingIndex:t,disabledIndices:x}):N.current=Math.min(o,gw(s.current,{startingIndex:t,disabledIndices:x})):p?t<=i?f&&t!==-1?N.current=s.current.length:(te.current=!1,N.current=o):N.current=gw(s.current,{startingIndex:t,decrement:!0,disabledIndices:x}):N.current=Math.max(i,gw(s.current,{startingIndex:t,decrement:!0,disabledIndices:x})),pw(s.current,N.current)&&(N.current=-1),I(e)}}),ue=b.useMemo(()=>g&&r&&ae&&{"aria-activedescendant":`${T}-${c}`},[g,r,ae,T,c]),de=b.useMemo(()=>({"aria-orientation":S===`both`?void 0:S,...j?{}:ue,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=xC(e.nativeEvent);if(t&&!bC(O.current,t))return;MC(e),n.setOpen(!1,ET(yT,e.nativeEvent)),px(a)&&a.focus();return}le(e)},onPointerMove(){F.current=!0}}),[ue,le,O,S,j,n,r,g,a]),fe=b.useMemo(()=>{function e(e){_===`auto`&&PC(e.nativeEvent)&&(M.current=!g)}function t(e){M.current=_,_===`auto`&&FC(e.nativeEvent)&&(M.current=!0)}return{onKeyDown(e){let t=n.select(`open`);F.current=!1;let r=e.key.startsWith(`Arrow`),i=ck(e.key,ce(),h),a=ok(e.key,S),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return le(e);if(!(!t&&!y&&r)){if(o){let t=ok(e.key,ce());P.current=m&&t?null:e.key}if(m){i&&(MC(e),t?(N.current=mw(s,V.current),I(e)):n.setOpen(!0,ET(xT,e.nativeEvent,e.currentTarget)));return}a&&(re.current!=null&&(N.current=re.current),MC(e),!t&&y?n.setOpen(!0,ET(xT,e.nativeEvent,e.currentTarget)):le(e),t&&I(e))}},onFocus(e){n.select(`open`)&&!g&&(N.current=-1,I(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[le,V,_,s,m,I,n,y,S,ce,h,re,g]),pe=b.useMemo(()=>({...ue,...fe}),[ue,fe]);return b.useMemo(()=>u?{reference:pe,floating:de,item:se,trigger:fe}:{},[u,pe,de,fe,se])}var dk=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function fk(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=GS(),l=a?.id||c,u=b.useMemo(()=>kC(o)?.id||i,[o,i]),d=dk.get(s)??s,f=LE()!=null,p=b.useMemo(()=>d===`tooltip`||s===`label`?bS:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=b.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=b.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=b.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return b.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function pk(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Xw(),m=b.useRef(``),h=b.useRef(f??s??-1),g=b.useRef(null);Q(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),Q(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=Z(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=Z(e=>{function t(e){let t=o?.current[e];return!t||Cw(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(m.current.length>0&&e.key===` `&&(MC(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(MC(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=Z(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=bC(r,t),o=bC(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),x=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),S=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return b.useMemo(()=>u?{reference:x,floating:S}:{},[u,x,S])}var mk=.1,hk=mk*mk,gk=.5;function _k(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function vk(e,t,n,r,i,a,o,s,c,l){let u=!1;return _k(e,t,n,r,i,a)&&(u=!u),_k(e,t,i,a,o,s)&&(u=!u),_k(e,t,o,s,c,l)&&(u=!u),_k(e,t,c,l,n,r)&&(u=!u),u}function yk(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function bk(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function xk(e={}){let{blockPointerEvents:t=!1}=e,n=new Yw,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*hk;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=xC(r),g=r.type===`mouseleave`,_=bC(u,h),v=bC(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&fx(r.relatedTarget)&&bC(u,r.relatedTarget))return;function y(){return!!(s&&AC(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=bk(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=bk(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=bk(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=bk(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!yk(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?gk/2:gk*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+gk+1,o=C||T?S.bottom-gk:S.top,s=C?T?S.bottom-gk:S.top:S.bottom-gk;M=vk(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?gk/2:gk*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-gk,o=C||T?S.top+gk:S.bottom,s=C?T?S.top+gk:S.bottom:S.top+gk;M=vk(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?gk/2:gk*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+gk+1,o=w||E?S.right-gk:S.left,s=w?E?S.right-gk:S.left:S.right-gk;M=vk(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?gk/2:gk*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-gk,o=w||E?S.left+gk:S.right,s=w?E?S.left+gk:S.right:S.left+gk;M=vk(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function Sk(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Ck(e,t){let n=b.useRef(e),r=Z(t);Q(()=>{n.current!==e&&r(n.current)},[e,r]),Q(()=>{n.current=e},[e])}function wk(e){let[t,n]=b.useState(null),r=Z((t,r)=>{e||n(r||(aC?`touch`:``))});Ck(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=Sk(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Tk(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=wk(a);FO(t);let{forceUnmount:d}=IO(a,t),f=b.useCallback(()=>{t.setOpen(!1,ET(wT))},[t]);b.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]);let p=WO({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,h]=b.useState(0),[g,_]=b.useState(0),v=m===0,y=fk(p),x=tD(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=xC(e);if(v&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||bC(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});JT(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=tk([y,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{h(e),_(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0),_(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(m+1,g+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,m,g,n]);let T=b.useMemo(()=>S(u),[S,u]),E=b.useMemo(()=>w(u),[w,u]),D=b.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:p,nestedOpenDialogCount:m,nestedOpenDrawerCount:g})}var Ek=b.createContext(void 0);function Dk(e){let t=b.useContext(Ek);if(e===!1&&t===void 0)throw Error(nS(27));return t}var Ok={...VO,modal:$(e=>e.modal),nested:$(e=>e.nested),nestedOpenDialogCount:$(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:$(e=>e.nestedOpenDrawerCount),disablePointerDismissal:$(e=>e.disablePointerDismissal),openMethod:$(e=>e.openMethod),descriptionElementId:$(e=>e.descriptionElementId),titleElementId:$(e=>e.titleElementId),viewportElement:$(e=>e.viewportElement),role:$(e=>e.role)},kk=class e extends AO{constructor(e){super(Ak(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new LO,onOpenChange:void 0,onOpenChangeComplete:void 0},Ok)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=Nx(()=>new e(n)).current;return t??r}};function Ak(e={}){return{...zO(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var jk=b.createContext(!1);function Mk(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=Dk(!0),p=b.useContext(jk),m=!!f,h=kk.useStore(l?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:m});RT(()=>{n===void 0&&h.state.open===!1&&r===!0&&h.update({open:!0,activeTriggerId:d})}),h.useControlledProp(`openProp`,n),h.useControlledProp(`triggerIdProp`,u),h.useSyncedValues({disablePointerDismissal:o,nested:m,modal:s}),h.useContextCallback(`onOpenChange`,i),h.useContextCallback(`onOpenChangeComplete`,a);let g=h.useState(`payload`);Tk({store:h,actionsRef:c,parentContext:f?.store.context,isDrawer:p,onOpenChange:i,triggerIdProp:u});let _=b.useMemo(()=>({store:h}),[h]);return(0,y.jsx)(jk.Provider,{value:!1,children:(0,y.jsx)(Ek.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})})}function Nk(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Dk(!0),d=!!u,f=kk.useStore(s?.store,{open:r,openProp:n,activeTriggerId:l,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,c),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);Tk({store:f,actionsRef:o,parentContext:u?.store.context,isDrawer:!1,onOpenChange:i,triggerIdProp:c});let m=b.useMemo(()=>({store:f}),[f]);return(0,y.jsx)(jk.Provider,{value:!1,children:(0,y.jsx)(Ek.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})})}var Pk=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=nT.startingStyle]=`startingStyle`,e[e.endingStyle=nT.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),Fk=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Ik={[Fk.popupOpen]:``},Lk={[Fk.popupOpen]:``,[Fk.pressed]:``},Rk={[Pk.open]:``},zk={[Pk.closed]:``},Bk={[Pk.anchorHidden]:``},Vk={open(e){return e?Ik:null}},Hk={open(e){return e?Lk:null}},Uk={open(e){return e?Rk:zk},anchorHidden(e){return e?Bk:null}},Wk={...Uk,...aT},Gk=b.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Dk(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return wS(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Wk,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Kk=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{store:c}=Dk(),l=c.useState(`open`);function u(e){l&&c.setOpen(!1,ET(vT,e.nativeEvent))}let{getButtonProps:d,buttonRef:f}=oS({disabled:i,native:a});return wS(`button`,e,{state:{disabled:i},ref:[t,f],props:[{onClick:u},s,d]})}),qk=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Dk(),c=KS(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),wS(`p`,e,{ref:t,props:[{id:c},o]})}),Jk=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),Yk=function(e){return e[e.open=Pk.open]=`open`,e[e.closed=Pk.closed]=`closed`,e[e.startingStyle=Pk.startingStyle]=`startingStyle`,e[e.endingStyle=Pk.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Xk=b.createContext(void 0);function Zk(){let e=b.useContext(Xk);if(e===void 0)throw Error(nS(26));return e}var Qk=`ArrowUp`,$k=`ArrowDown`,eA=`ArrowLeft`,tA=`ArrowRight`,nA=`Home`,rA=new Set([eA,tA]),iA=new Set([Qk,$k]),aA=new Set([...rA,...iA]);new Set([...aA,nA,`End`]);var oA=new Set([Qk,$k,eA,tA,nA,`End`]),sA={...Uk,...aT,nestedDialogOpen(e){return e?{[Yk.nestedDialogOpen]:``}:null}},cA=b.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=Dk(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`);Zk(),cT({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=wS(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){oA.has(e.key)&&e.stopPropagation()},style:{[Jk.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:sA});return(0,y.jsx)(qE,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})});function lA(e){return gS(19)?e:e?`true`:void 0}var uA=b.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,y.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),dA=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Dk(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,y.jsx)(Xk.Provider,{value:n,children:(0,y.jsxs)(NE,{ref:t,...r,children:[a&&o===!0&&(0,y.jsx)(uA,{ref:i.context.internalBackdropRef,inert:lA(!s)}),e.children]})}):null}),fA=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Dk(),c=KS(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),wS(`h2`,e,{ref:t,props:[{id:c},o]})}),pA=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,payload:s,handle:c,style:l,...u}=e,d=Dk(!0),f=c?.store??d?.store;if(!f)throw Error(nS(79));let p=KS(o),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=b.useRef(null),{registerTrigger:_,isMountedByThisTrigger:v}=PO(p,g,f,{payload:s}),{getButtonProps:y,buttonRef:x}=oS({disabled:i,native:a}),S=tk([JE(m,{enabled:m!=null})]),C={disabled:i,open:h},w=f.useState(`triggerProps`,v);return wS(`button`,e,{state:C,ref:[x,t,_,g],props:[S.getReferenceProps(),w,{[TE]:``,id:p},u,y],stateAttributesMapping:Vk})});function mA({...e}){return(0,y.jsx)(Nk,{"data-slot":`alert-dialog`,...e})}function hA({...e}){return(0,y.jsx)(dA,{"data-slot":`alert-dialog-portal`,...e})}function gA({className:e,...t}){return(0,y.jsx)(Gk,{"data-slot":`alert-dialog-overlay`,className:ox(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function _A({className:e,size:t=`default`,...n}){return(0,y.jsxs)(hA,{children:[(0,y.jsx)(gA,{}),(0,y.jsx)(cA,{"data-slot":`alert-dialog-content`,"data-size":t,className:ox(`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-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg 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 vA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:ox(`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-6 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 yA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:ox(`flex flex-col-reverse gap-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 bA({className:e,...t}){return(0,y.jsx)(fA,{"data-slot":`alert-dialog-title`,className:ox(`font-heading text-lg 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 xA({className:e,...t}){return(0,y.jsx)(qk,{"data-slot":`alert-dialog-description`,className:ox(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function SA({className:e,...t}){return(0,y.jsx)(MS,{"data-slot":`alert-dialog-action`,className:ox(e),...t})}function CA({className:e,...t}){return(0,y.jsx)(wy,{role:`status`,"aria-label":`Loading`,className:ox(`spinner-line-fade size-4`,e),...t})}var wA=({isModalOpen:e,exitInfo:t,isRetryingConnection:n,hasCopiedRestartCommand:r,newTabUrl:i,onReconnect:a,onCopyRestartCommand:o})=>(0,y.jsx)(mA,{open:e,children:(0,y.jsx)(_A,{children:t===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(vA,{children:[(0,y.jsxs)(bA,{className:`flex items-center gap-2`,children:[(0,y.jsx)(CA,{"aria-hidden":`true`,role:`presentation`}),`Lost connection`]}),(0,y.jsx)(xA,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(AT,{children:[(0,y.jsx)(IT,{readOnly:!0,value:od,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(MT,{align:`inline-end`,children:(0,y.jsx)(PT,{size:`icon-xs`,onClick:o,"aria-label":r?`Copied`:`Copy restart command`,children:r?(0,y.jsx)(by,{}):(0,y.jsx)(Cy,{})})})]}),(0,y.jsx)(yA,{children:(0,y.jsxs)(SA,{onClick:a,disabled:n,children:[n?(0,y.jsx)(CA,{"data-icon":`inline-start`}):null,`Retry`]})})]}):t.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(vA,{children:[(0,y.jsx)(bA,{children:`Shell ended`}),(0,y.jsx)(xA,{children:t.exitCode===null||t.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${t.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(yA,{children:(0,y.jsx)(SA,{onClick:()=>window.open(i,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(vA,{children:[(0,y.jsxs)(bA,{className:`flex items-center gap-2`,children:[(0,y.jsx)(CA,{"aria-hidden":`true`,role:`presentation`}),`Connection lost`]}),(0,y.jsxs)(xA,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,t.closeCode,t.closeReason?` · ${t.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(yA,{children:(0,y.jsxs)(SA,{onClick:a,disabled:n,children:[n?(0,y.jsx)(CA,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})});function TA({...e}){return(0,y.jsx)(Mk,{"data-slot":`dialog`,...e})}function EA({...e}){return(0,y.jsx)(pA,{"data-slot":`dialog-trigger`,...e})}function DA({...e}){return(0,y.jsx)(dA,{"data-slot":`dialog-portal`,...e})}function OA({className:e,...t}){return(0,y.jsx)(Gk,{"data-slot":`dialog-overlay`,className:ox(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function kA({className:e,children:t,showCloseButton:n=!0,...r}){return(0,y.jsxs)(DA,{children:[(0,y.jsx)(OA,{}),(0,y.jsxs)(cA,{"data-slot":`dialog-content`,className:ox(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md 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?(0,y.jsxs)(Kk,{"data-slot":`dialog-close`,render:(0,y.jsx)(MS,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,y.jsx)(Ay,{}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Close`})]}):null]})]})}function AA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`dialog-header`,className:ox(`flex flex-col gap-2`,e),...t})}function jA({className:e,...t}){return(0,y.jsx)(fA,{"data-slot":`dialog-title`,className:ox(`font-heading leading-none font-medium`,e),...t})}var MA=`border border-border/60 bg-background/70 text-muted-foreground shadow-xs ring-0 backdrop-blur-md`,NA=`duration-150 ease-snappy data-closed:duration-100 data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:blur-out-[5px] data-closed:slide-out-to-top-2 data-open:fade-in-0 data-open:zoom-in-95 data-open:blur-in-[5px] data-open:slide-in-from-top-2`,PA=()=>typeof window<`u`&&typeof window.queryLocalFonts==`function`,FA=async()=>{if(typeof window>`u`)return[];let e=window.queryLocalFonts;if(typeof e!=`function`)return[];try{let t=await e(),n=new Set;for(let e of t)e.family&&n.add(e.family);return[...n].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}catch{return[]}},IA=async()=>{if(typeof navigator>`u`||!navigator.permissions)return`unsupported`;try{return(await navigator.permissions.query({name:`local-fonts`})).state}catch{return`unsupported`}},LA=(e,t)=>{let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e},RA=({open:e,onFontSelect:t})=>{let[n,r]=(0,b.useState)({kind:`loading`}),[i,a]=(0,b.useState)(``),o=(0,b.useDeferredValue)(i);(0,b.useEffect)(()=>{if(!e)return;a(``);let t=!1;return r({kind:`loading`}),(async()=>{if(!PA()){t||r({kind:`unsupported`});return}let e=await IA();if(!t)if(e===`granted`){let e=await FA();t||r({kind:`ready`,families:e})}else r(e===`denied`?{kind:`denied`}:{kind:`prompt`})})(),()=>{t=!0}},[e]);let s=(0,b.useCallback)(async()=>{r({kind:`loading`});let e=await FA();if(e.length===0){r({kind:`denied`});return}r({kind:`ready`,families:e})},[]),c=(0,b.useCallback)(e=>{t(e)},[t]);return{state:n,searchQuery:i,setSearchQuery:a,deferredQuery:o,filteredFamilies:(0,b.useMemo)(()=>n.kind===`ready`?LA(n.families,o):[],[n.kind,n.kind===`ready`?n.families:void 0,o]),handleApply:c,requestPermission:s}},zA=`flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground/90 outline-none transition-colors hover:bg-foreground/10 focus-visible:bg-foreground/10`,BA={contentVisibility:`auto`,containIntrinsicSize:`auto 28px`},VA=`text-xs leading-snug text-muted-foreground/80`,HA=({initialValue:e,onApply:t})=>{let[n,r]=(0,b.useState)(e),i=n.trim(),a=(0,b.useCallback)(()=>{i&&t(i)},[i,t]);return(0,y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,y.jsx)(kT,{autoFocus:!0,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a())},placeholder:`Family name (e.g. Iosevka)`,className:`h-8 text-xs`}),(0,y.jsx)(MS,{type:`button`,size:`sm`,variant:`secondary`,disabled:!i,onClick:a,className:`h-7 text-xs`,children:`Apply`})]})},UA=({open:e,onOpenChange:t,currentFamily:n,onApply:r})=>{let{state:i,searchQuery:a,setSearchQuery:o,deferredQuery:s,filteredFamilies:c,handleApply:l,requestPermission:u}=RA({open:e,onFontSelect:e=>{r(e),t(!1)}});return(0,y.jsx)(TA,{open:e,onOpenChange:t,children:(0,y.jsxs)(kA,{className:ox(`max-h-[calc(100dvh-2rem)] gap-2 overflow-hidden p-4 sm:max-w-sm`,MA),children:[(0,y.jsx)(AA,{className:`pr-8`,children:(0,y.jsx)(jA,{children:`Local font`})}),i.kind===`loading`?(0,y.jsx)(`p`,{className:VA,children:`Loading…`}):i.kind===`unsupported`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:VA,children:`This browser doesn't expose installed fonts. Type a family name to use any installed font.`}),(0,y.jsx)(HA,{initialValue:n??``,onApply:l})]}):i.kind===`denied`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:VA,children:`Permission denied. Re-allow in browser site settings, or type a family name.`}),(0,y.jsx)(HA,{initialValue:n??``,onApply:l})]}):i.kind===`prompt`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:VA,children:`Allow localterm to read your installed fonts to preview them.`}),(0,y.jsx)(MS,{type:`button`,size:`sm`,variant:`secondary`,onClick:u,className:`h-7 text-xs`,children:`Allow access`}),(0,y.jsx)(`div`,{className:`my-1 border-t border-border/40`}),(0,y.jsx)(`p`,{className:VA,children:`Or type a family name:`}),(0,y.jsx)(HA,{initialValue:n??``,onApply:l})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(Oy,{className:`pointer-events-none absolute top-1/2 left-2 size-3 -translate-y-1/2 text-muted-foreground/70`}),(0,y.jsx)(kT,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search installed fonts`,className:`h-8 pl-7 text-xs`})]}),(0,y.jsx)(`div`,{className:`-mx-1 max-h-72 overflow-y-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:c.length===0?(0,y.jsxs)(`p`,{className:ox(VA,`px-2 py-2`),children:[`No fonts match "`,a,`".`]}):c.map(e=>(0,y.jsx)(`button`,{type:`button`,onClick:()=>l(e),className:ox(zA,e===n&&`bg-foreground/5`),style:{...BA,fontFamily:`"${wd(e)}", ui-monospace, monospace`},children:(0,y.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,y.jsx)(`p`,{className:ox(VA,`px-1 tabular-nums`),children:s?`${c.length} of ${i.families.length}`:`${i.families.length} fonts`})]})]})})};function WA({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:ox(`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})}var GA=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return wS(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function KA({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(GA,{"data-slot":`separator`,orientation:t,className:ox(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}function qA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:ox(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var JA=Fy(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function YA({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:ox(JA({orientation:t}),e),...n})}function XA({className:e,...t}){return(0,y.jsx)(WA,{"data-slot":`field-label`,className:ox(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var ZA=b.createContext(void 0);function QA(e){let t=b.useContext(ZA);if(t===void 0&&!e)throw Error(nS(72));return t}var $A={...VO,disabled:$(e=>e.disabled),instantType:$(e=>e.instantType),isInstantPhase:$(e=>e.isInstantPhase),trackCursorAxis:$(e=>e.trackCursorAxis),disableHoverablePopup:$(e=>e.disableHoverablePopup),lastOpenChangeReason:$(e=>e.openChangeReason),closeOnClick:$(e=>e.closeOnClick),closeDelay:$(e=>e.closeDelay),hasViewport:$(e=>e.hasViewport)},ej=class e extends AO{constructor(e){super({...tj(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new LO},$A)}setOpen=(e,t)=>{let n=t.reason,r=n===mT,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?oT.flushSync(o):o()};static useStore(t,n){let r=Nx(()=>new e(n)).current,i=t??r,a=WO({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function tj(){return{...zO(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var nj=yO(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=ej.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});RT(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),Q(()=>{m&&t&&p.setOpen(!1,ET(CT))},[m,t,p]),p.useSyncedValue(`disabled`,t),FO(p);let{forceUnmount:v,transitionStatus:x}=IO(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);Q(()=>{x===`ending`&&T===`none`||x!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[x,C,T,w,p]),Q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,ET(wT))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=tk([tD(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),ZE(S,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),j=b.useMemo(()=>O(),[O]),M=b.useMemo(()=>A(),[A]),N=b.useMemo(()=>k(),[k]);return p.useSyncedValues({activeTriggerProps:j,inactiveTriggerProps:M,popupProps:N}),(0,y.jsx)(ZA.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),rj=b.createContext(void 0);function ij(){return b.useContext(rj)}var aj=function(e){return e[e.popupOpen=Fk.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),oj=bO(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeOnClick:c=!0,closeDelay:l,id:u,style:d,...f}=e,p=QA(!0),m=i?.store??p;if(!m)throw Error(nS(82));let h=KS(u),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=b.useRef(null),x=s??600,S=l??0,{registerTrigger:C,isMountedByThisTrigger:w}=PO(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=ij(),{delayRef:E,isInstantPhase:D,hasProvider:O}=tE(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=ek(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?xk():null,restMs(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:s??e??x),n},delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return l==null&&O&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`}),P=KO(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return wS(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[aj.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:Vk})}),sj=b.createContext(void 0);function cj(){let e=b.useContext(sj);if(e===void 0)throw Error(nS(70));return e}var lj=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=ME({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&oT.createPortal(n,c)]})}),uj=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return QA().useState(`mounted`)||n?(0,y.jsx)(sj.Provider,{value:n,children:(0,y.jsx)(lj,{ref:t,...r})}):null}),dj=b.createContext(void 0);function fj(){let e=b.useContext(dj);if(e===void 0)throw Error(nS(71));return e}var pj=b.createContext(void 0);function mj(){return b.useContext(pj)?.direction??`ltr`}var hj=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=KC(e,t)||{};if(l==null)return{};let f=uw(u),p={x:n,y:r},m=QC(i),h=XC(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=GC(k,j,A),N=!c.arrow&&JC(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),gj=(e,t)=>({...hj(e),options:[e,t]}),_j={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await uO().fn(e)).data?.referenceHidden||a}}}},vj={sideX:`left`,sideY:`top`},yj={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=lx(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:vj};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=$S(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=qC(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:vj.sideX,g=f===`top`?`bottom`:vj.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function bj(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function xj(e,t,n){let{rects:r,placement:i}=e;return{side:bj(t,qC(i),n),align:JC(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Sj(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=Z(D),k=D?O:t,A=rE(t),j=rE(m),M=mj()===`rtl`,N=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":M?`left`:`right`,"inline-start":M?`right`:`left`}[r],P=a===`center`?N:`${N}-${a}`,F=c,I=+(r===`bottom`),L=+(r===`top`),ee=+(r===`right`),R=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+R,bottom:F+L,left:F+ee}:F&&={top:(F.top||0)+I,right:(F.right||0)+R,bottom:(F.bottom||0)+L,left:(F.left||0)+ee};let te={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},z=b.useRef(null),B=rE(i),V=rE(o),ne=[aO(e=>{let t=xj(e,r,M),n=typeof B.current==`function`?B.current(t):B.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],re=T===`none`&&w!==`shift`,H=!re&&(l||g||w===`shift`),ie=w===`none`?null:cO({...te,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ae=re?null:oO(e=>{let t=$S(e.elements.floating).documentElement;return{...te,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:H,limiter:l||g?void 0:sO(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=ZC(qC(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[te,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?ne.push(ae,ie):ne.push(ie,ae),ne.push(lO({...te,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!j.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=lx(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),gj(()=>({element:z.current||$S(z.current).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=qC(a),l=ZC(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(xj(e,r,M)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,H&&l===`y`&&b?S:x),{}}},_j,v),Q(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let oe=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:se,elements:ce,x:le,y:ue,middlewareData:de,update:fe,placement:pe,context:me,isPositioned:he,floatingStyles:ge}=UO({rootContext:p,open:f?m:void 0,placement:P,middleware:ne,strategy:n,whileElementsMounted:f?void 0:(...e)=>GD(...e,oe),nodeId:_,externalTree:x}),{sideX:_e,sideY:ve}=de.adaptiveOrigin||vj,ye=he?n:`fixed`,be=b.useMemo(()=>{let e=v?{position:ye,[_e]:le,[ve]:ue}:{position:ye,...ge};return he||(e.opacity=0),e},[v,ye,_e,le,ve,ue,ge,he]),xe=b.useRef(null);Q(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(Cj(t)?t.current:t)||null;n!==xe.current&&(se.setPositionReference(n),xe.current=n)},[m,se,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&Cj(e)&&e.current!==xe.current&&(se.setPositionReference(e.current),xe.current=e.current)},[m,se,k,A]),b.useEffect(()=>{if(f&&m&&ce.domReference&&ce.floating)return GD(ce.domReference,ce.floating,fe,oe)},[f,m,ce,fe,oe]);let Se=qC(pe),Ce=bj(r,Se,M),we=JC(pe)||`center`,Te=!!de.hide?.referenceHidden;Q(()=>{y&&m&&he&&C(Se)},[y,m,he,Se]);let Ee=b.useMemo(()=>({position:`absolute`,top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),De=de.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:be,arrowStyles:Ee,arrowRef:z,arrowUncentered:De,side:Ce,align:we,physicalSide:Se,anchorHidden:Te,refs:se,context:me,isPositioned:he,update:fe}),[be,Ee,z,De,Ce,we,Se,Te,se,me,he,fe])}function Cj(e){return e!=null&&`current`in e}function wj(e){return e===`starting`?wE:bS}function Tj(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),wS(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},wj(r),i],stateAttributesMapping:Uk})}var Ej=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=DE,style:g,..._}=e,v=QA(),x=cj(),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`trackCursorAxis`),T=v.useState(`disableHoverablePopup`),E=v.useState(`floatingRootContext`),D=v.useState(`instantType`),O=v.useState(`transitionStatus`),k=Sj({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?yj:void 0}),A=Tj(e,b.useMemo(()=>({open:S,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:w===`none`?D:`tracking-cursor`}),[S,k.side,k.align,k.anchorHidden,w,D]),{styles:k.positionerStyles,transitionStatus:O,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!C,inert:!S||w===`both`||T});return(0,y.jsx)(dj.Provider,{value:k,children:A})}),Dj={...Uk,...aT},Oj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=QA(),{side:s,align:c}=fj(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);cT({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return QO(p,{enabled:!m,closeDelay:h}),wS(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,wj(d),a],stateAttributesMapping:Dj})}),kj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=QA(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=fj();return wS(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:Uk})}),Aj=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=b.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=b.useMemo(()=>({open:t,close:n}),[t,n]);return(0,y.jsx)(rj.Provider,{value:i,children:(0,y.jsx)(eE,{delay:a,timeoutMs:r,children:e.children})})};function jj(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Mj({delay:e=0,...t}){return(0,y.jsx)(Aj,{"data-slot":`tooltip-provider`,delay:e,...t})}function Nj({...e}){return(0,y.jsx)(nj,{"data-slot":`tooltip`,...e})}function Pj({...e}){return(0,y.jsx)(oj,{"data-slot":`tooltip-trigger`,...e})}function Fj({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(uj,{children:(0,y.jsx)(Ej,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(Oj,{"data-slot":`tooltip-content`,className:ox(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 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-[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`,e),...o,children:[a,(0,y.jsx)(kj,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var Ij=b.createContext(null),Lj=b.createContext(null);function Rj(){let e=b.useContext(Ij);if(e===null)throw Error(nS(60));return e}function zj(){let e=b.useContext(Lj);if(e===null)throw Error(nS(61));return e}var Bj=(e,t)=>Object.is(e,t);function Vj(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Hj(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Vj(t,e,n))}function Uj(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Vj(e,t,n))}function Wj(e,t,n){return e.filter(e=>!Vj(t,e,n))}function Gj(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Kj(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function qj(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Kj(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Jj(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Gj(e)}function Yj(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Gj(e.value):Gj(e)}function Xj(e,t,n){function r(){return Jj(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Kj(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Zj(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:Xj(r,t,n)},i)),e),[])}var Qj={id:$(e=>e.id),labelId:$(e=>e.labelId),modal:$(e=>e.modal),multiple:$(e=>e.multiple),items:$(e=>e.items),itemToStringLabel:$(e=>e.itemToStringLabel),itemToStringValue:$(e=>e.itemToStringValue),isItemEqualToValue:$(e=>e.isItemEqualToValue),value:$(e=>e.value),hasSelectedValue:$(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Yj(t,r)!==``}),hasNullItemLabel:$((e,t)=>t?qj(e.items):!1),open:$(e=>e.open),mounted:$(e=>e.mounted),forceMount:$(e=>e.forceMount),transitionStatus:$(e=>e.transitionStatus),openMethod:$(e=>e.openMethod),activeIndex:$(e=>e.activeIndex),selectedIndex:$(e=>e.selectedIndex),isActive:$((e,t)=>e.activeIndex===t),isSelected:$((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>Vj(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Vj(n,i,r)}),isSelectedByFocus:$((e,t)=>e.selectedIndex===t),popupProps:$(e=>e.popupProps),triggerProps:$(e=>e.triggerProps),triggerElement:$(e=>e.triggerElement),positionerElement:$(e=>e.positionerElement),listElement:$(e=>e.listElement),scrollUpArrowVisible:$(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:$(e=>e.scrollDownArrowVisible),hasScrollArrows:$(e=>e.hasScrollArrows)};function $j(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function eM(e,t){return Math.max(0,e-t)}function tM(e,t){if(t<=0)return 0;let n=$j(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function nM(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:x=!1,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w=Bj,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=VS(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=zS(),ee=QS({id:t}),R=F||d,te=P??c,[z,B]=uT({controlled:n,default:x?r??yS:r,name:`Select`,state:`value`}),[V,ne]=uT({controlled:a,default:o,name:`Select`,state:`open`}),re=b.useRef([]),H=b.useRef([]),ie=b.useRef(null),ae=b.useRef(null),oe=b.useRef(0),se=b.useRef(null),ce=b.useRef([]),le=b.useRef(!1),ue=b.useRef(!1),de=b.useRef(null),fe=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),pe=b.useRef(!1),{mounted:me,setMounted:he,transitionStatus:ge}=lT(V),{openMethod:_e,triggerProps:ve}=wk(V),ye=Nx(()=>new kO({id:ee,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:z,open:V,mounted:me,transitionStatus:ge,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,be=TO(ye,Qj.activeIndex),xe=TO(ye,Qj.selectedIndex),Se=TO(ye,Qj.triggerElement),Ce=TO(ye,Qj.positionerElement),we=jj(_e),Te=_e??we,Ee=b.useMemo(()=>x&&Array.isArray(z)&&z.length===0?``:Yj(z,C),[x,z,C]),De=b.useMemo(()=>x&&Array.isArray(z)?z.map(e=>Yj(e,C)):Yj(z,C),[x,z,C]);dT(rE(ye.state.triggerElement),{id:ee,value:z,getValue:Z(()=>De)});let Oe=b.useRef(z);Q(()=>{z!==Oe.current&&ye.set(`forceMount`,!0)},[ye,z]),Q(()=>{N(x?Array.isArray(z)&&z.length>0:z!=null)},[x,z,N]),Q(function(){if(V)return;let e=ce.current;if(x){let t=Array.isArray(z)?z:[];if(t.length===0){ye.set(`selectedIndex`,null);return}let n=t[t.length-1],r=Uj(e,n,w);ye.set(`selectedIndex`,r===-1?null:r);return}let t=Uj(e,z,w);ye.set(`selectedIndex`,t===-1?null:t)},[x,V,z,ce,w,ye]),Ck(z,()=>{D(te),O(z!==M.initialValue),j()?I.commit(z):I.commit(z,!0)});let ke=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(ne(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(z)),!e&&ye.state.activeIndex!==null)){let e=re.current[ye.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Ae=Z(()=>{he(!1),ye.update({activeIndex:null,openMethod:null}),_?.(!1)});cT({enabled:!h,open:V,ref:ie,onComplete(){V||Ae()}}),b.useImperativeHandle(h,()=>({unmount:Ae}),[Ae]);let je=Z((e,t)=>{i?.(e,t),!t.isCanceled&&B(e)}),Me=Z(()=>{let e=ye.state.listElement||ie.current;if(!e)return;let t=eM(e.scrollHeight,e.clientHeight),n=tM(e.scrollTop,t),r=n>0,i=n<t;ye.state.scrollUpArrowVisible!==r&&ye.set(`scrollUpArrowVisible`,r),ye.state.scrollDownArrowVisible!==i&&ye.set(`scrollDownArrowVisible`,i)}),Ne=HO({open:V,onOpenChange:ke,elements:{reference:Se,floating:Ce}}),{getReferenceProps:Pe,getFloatingProps:Fe,getItemProps:Ie}=tk([JE(Ne,{enabled:!f&&!R,event:`mousedown`}),tD(Ne,{bubbles:!1}),uk(Ne,{enabled:!f&&!R,listRef:re,activeIndex:be,selectedIndex:xe,disabledIndices:yS,onNavigate(e){e===null&&!V||ye.set(`activeIndex`,e)},focusItemOnHover:T}),pk(Ne,{enabled:!f&&!R&&(V||!x),listRef:H,activeIndex:be,selectedIndex:xe,onMatch(e){V?ye.set(`activeIndex`,e):je(ce.current[e],ET(`none`))},onTypingChange(e){le.current=e}})]),Le=b.useMemo(()=>Vx(Pe(),ve,ee?{id:ee}:bS),[Pe,ve,ee]);RT(()=>{ye.update({popupProps:Fe(),triggerProps:Le})}),Q(()=>{ye.update({id:ee,modal:m,multiple:x,value:z,open:V,mounted:me,transitionStatus:ge,popupProps:Fe(),triggerProps:Le,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Te})},[ye,ee,m,x,z,V,me,ge,Fe,Le,v,S,C,w,Te]);let Re=b.useMemo(()=>({store:ye,name:te,required:p,disabled:R,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:je,setOpen:ke,listRef:re,popupRef:ie,scrollHandlerRef:ae,handleScrollArrowVisibility:Me,scrollArrowsMountedCountRef:oe,getItemProps:Ie,events:Ne.context.events,valueRef:se,valuesRef:ce,labelsRef:H,typingRef:le,selectionRef:fe,selectedItemTextRef:de,validation:I,onOpenChangeComplete:_,keyboardActiveRef:ue,alignItemWithTriggerActiveRef:pe,initialValueRef:Oe}),[ye,te,p,R,f,x,T,je,ke,Ie,Ne.context.events,I,_,Me]),ze=lS(g,I.inputRef),Be=x&&Array.isArray(z)&&z.length>0,Ve=x?void 0:te,He=b.useMemo(()=>!x||!Array.isArray(z)||!te?null:z.map(e=>{let t=Yj(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:te,value:t},t)}),[x,z,l,te,C]);return(0,y.jsx)(Ij.Provider,{value:Re,children:(0,y.jsxs)(Lj.Provider,{value:Ne,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){ye.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=ET(fT,e.nativeEvent);function r(){if(x)return;let e=ce.current.find(e=>Yj(e,C).toLowerCase()===t.toLowerCase()||Jj(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),je(e,n),j()&&I.commit(e))}ye.set(`forceMount`,!0),queueMicrotask(r)}}),id:ee&&Ve==null?`${ee}-hidden-input`:void 0,form:l,name:Ve,autoComplete:u,value:Ee,disabled:R,required:p&&!Be,readOnly:f,ref:ze,style:te?sE:oE,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),He]})})}function rM(e,t){return e??t}function iM(e){let t=e.getBoundingClientRect(),n=lx(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var aM=2,oM=400,sM=200,cM={...Hk,...LS,value:()=>null},lM=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=zS(),{labelId:m}=JS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=Rj(),T=p||C||a,E=TO(h,Qj.open),D=TO(h,Qj.value),O=TO(h,Qj.triggerProps),k=TO(h,Qj.positionerElement),A=TO(h,Qj.listElement),j=TO(h,Qj.id),M=TO(h,Qj.labelId),N=TO(h,Qj.hasSelectedValue),P=!N&&E,F=TO(h,Qj.hasNullItemLabel,P),I=i??j,L=rM(m,M);QS({id:I});let ee=rE(k),R=b.useRef(null),{getButtonProps:te,buttonRef:z}=oS({disabled:T,native:o}),B=lS(t,R,z,Z(e=>{h.set(`triggerElement`,e)})),V=Xw(),ne=Xw(),re=Xw(),H=Xw();b.useEffect(()=>{if(E)return N||F?H.start(sM,()=>{_.current.allowUnselectedMouseUp=!0,re.start(sM,()=>{_.current.allowSelectedMouseUp=!0})}):re.start(oM,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{re.clear(),H.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},ne.clear()},[E,N,F,_,ne,re,H]);let ie=b.useMemo(()=>A?.id??kC(k)?.id,[A,k]),ae=Vx(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?ie:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:B,onFocus(e){u(!0),E&&S.current&&g(!1,ET(fT,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){bC(k,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(D))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=$S(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;if(bC(R.current,t)||bC(ee.current,t)||t===R.current)return;let n=iM(R.current);e.clientX>=n.left-aM&&e.clientX<=n.right+aM&&e.clientY>=n.top-aM&&e.clientY<=n.bottom+aM||g(!1,ET(ST,e))}ne.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,te);ae.role=`combobox`;let oe={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return wS(`button`,e,{ref:[t,R],state:oe,stateAttributesMapping:cM,props:ae})}),uM={value:()=>null},dM=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Rj(),u=TO(c,Qj.value),d=TO(c,Qj.items),f=TO(c,Qj.itemToStringLabel),p=TO(c,Qj.hasSelectedValue),m=!p&&a!=null&&i==null,h=TO(c,Qj.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?Zj(u,d,f):Xj(u,d,f)),wS(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:uM})}),fM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=Rj();return wS(`span`,e,{state:{open:TO(o,Qj.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Vk})}),pM=b.createContext(void 0),mM=b.forwardRef(function(e,t){let{store:n}=Rj(),r=TO(n,Qj.mounted),i=TO(n,Qj.forceMount);return r||i?(0,y.jsx)(pM.Provider,{value:!0,children:(0,y.jsx)(NE,{ref:t,...e})}):null}),hM=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function gM(){return b.useContext(hM)}function _M(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Nx(yM).current,c=Nx(vM).current,[l,u]=b.useState(0),d=b.useRef(l),f=Z((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=Z(e=>{c.delete(e),d.current+=1,u(d.current)}),m=b.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(bM).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);Q(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),Q(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),Q(()=>()=>{n.current=[]},[n]),Q(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));Q(()=>{s.forEach(e=>e(m))},[s,m]);let g=b.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,y.jsx)(hM.Provider,{value:g,children:t})}function vM(){return new Map}function yM(){return new Set}function bM(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var xM=b.createContext(void 0);function SM(){let e=b.useContext(xM);if(!e)throw Error(nS(59));return e}function CM(e,t){e&&Object.assign(e.style,t)}var wM={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},TM=20;function EM(e,t,n,r){let[i,a]=b.useState(!1);Q(()=>{if(!e||!t||n==null){a(!1);return}let r=$S(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-TM)},[e,t,n]),JT(e&&(!t||i),r)}var DM={position:`fixed`},OM=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=EE,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=Rj(),A=zj(),j=TO(x,Qj.open),M=TO(x,Qj.mounted),N=TO(x,Qj.modal),P=TO(x,Qj.value),F=TO(x,Qj.openMethod),I=TO(x,Qj.positionerElement),L=TO(x,Qj.triggerElement),ee=TO(x,Qj.isItemEqualToValue),R=TO(x,Qj.transitionStatus),te=b.useRef(null),z=b.useRef(null),[B,V]=b.useState(h),ne=M&&B&&F!==`touch`;!M&&B!==h&&V(h),Q(()=>{M||(Qj.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),Qj.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>ne),EM((ne||N)&&j,F===`touch`,I,L);let re=Sj({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??ne,collisionAvoidance:g,keepMounted:!0}),H=ne?`none`:re.side,ie=ne?DM:re.positionerStyles,ae=Tj(e,{open:j,side:H,align:re.align,anchorHidden:re.anchorHidden},{styles:ie,transitionStatus:R,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),oe=b.useRef(0),se=Z(e=>{if(e.size===0&&oe.current===0||E.current.length===0)return;let t=oe.current;if(oe.current=e.size,e.size===t)return;let n=ET(fT);if(t!==0&&!x.state.multiple&&P!==null&&Uj(E.current,P,ee)===-1){let e=D.current,t=e!=null&&Uj(E.current,e,ee)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>Uj(E.current,e,ee)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!Hj(P,e,ee)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&ne){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};CM(I,e),CM(O.current,e)}}),ce=b.useMemo(()=>({...re,side:H,alignItemWithTriggerActive:ne,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:te,scrollDownArrowRef:z}),[re,H,ne,V]);return(0,y.jsx)(_M,{elementsRef:S,labelsRef:C,onMapChange:se,children:(0,y.jsxs)(xM.Provider,{value:ce,children:[M&&N&&(0,y.jsx)(uA,{inert:lA(!j),cutout:L}),ae]})})}),kM=`base-ui-disable-scrollbar`,AM={className:kM,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:kM,precedence:`base-ui:low`,children:`.${kM}{scrollbar-width:none}.${kM}::-webkit-scrollbar{display:none}`})}},jM=b.createContext(void 0);function MM(e){let t=b.useContext(jM);if(t===void 0&&!e)throw Error(nS(69));return t}var NM=b.createContext(void 0),PM={disableStyleElements:!1};function FM(){return b.useContext(NM)??PM}var IM={...Uk,...aT},LM=b.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,selectedItemTextRef:f,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v}=Rj(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=SM(),O=MM(!0)!=null,k=zj(),A=mj(),{nonce:j,disableStyleElements:M}=FM(),N=TO(s,Qj.id),P=TO(s,Qj.open),F=TO(s,Qj.mounted),I=TO(s,Qj.popupProps),L=TO(s,Qj.transitionStatus),ee=TO(s,Qj.triggerElement),R=TO(s,Qj.positionerElement),te=TO(s,Qj.listElement),z=b.useRef(!1),B=b.useRef(!1),V=b.useRef({}),ne=eT(),re=Z(e=>{if(!R||!c.current||!B.current)return;if(z.current||!C){h();return}let t=R.style.top===`0px`,n=R.style.bottom===`0px`;if(!t&&!n){h();return}let r=BM(R),i=VM(R.getBoundingClientRect().height,`y`,r),a=$S(R),o=getComputedStyle(R),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=RM(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=zM(e),m=0,g=null,_=!1,v=!1,y=e=>{R.style.height=`${e}px`},b=(t,n)=>{let r=$j(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(z.current=!0),h()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:g=0:(_=!0,n&&f<p&&(g=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||g!=null){let t=zM(e),n=v?t:$j(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(z.current=!0),h()});b.useImperativeHandle(g,()=>re,[re]),cT({open:P,ref:c,onComplete(){P&&l?.(!0)}});let H={open:P,transitionStatus:L,side:x,align:S};Q(()=>{!R||!c.current||Object.keys(V.current).length||(V.current={top:R.style.top||`0`,left:R.style.left||`0`,right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),Q(()=>{P||C||(B.current=!1,z.current=!1,CM(R,V.current))},[P,C,R,c]),Q(()=>{let e=c.current;if(!P||!ee||!R||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){B.current=!0,ne.request(h),e.style.removeProperty(`--transform-origin`);return}let t=WM(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(R),i=getComputedStyle(e),a=$S(ee),o=lx(R),c=BM(ee),l=HM(ee.getBoundingClientRect(),c),u=HM(R.getBoundingClientRect(),c),p=l.height,m=te||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=RM(i),w=a.documentElement.clientHeight-b-x,E=a.documentElement.clientWidth,D=w-l.bottom+p,O,k=A===`rtl`?l.right-u.width:l.left,j=0;if(t&&n){let e=HM(n.getBoundingClientRect(),c);O=HM(t.getBoundingClientRect(),c),k=u.left+(A===`rtl`?e.right-O.right:e.left-O.left);let r=e.top-l.top+e.height/2;j=O.top-u.top+O.height/2-r}let M=D+j+x+y,N=Math.min(w,M),P=w-b-x,F=M-N,I=E-5;R.style.left=`${$j(k,5,I-u.width)}px`,R.style.height=`${N}px`,R.style.maxHeight=`auto`,R.style.marginTop=`${b}px`,R.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=zM(m),ne=F>=L-1;ne&&(N=Math.min(w,u.height)-(F-L));let re=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),H=(o.visualViewport?.scale??1)!==1&&iC;if(re||H){B.current=!0,CM(R,V.current),T(!1);return}let ie=Math.max(S,N);if(ne){let e=Math.max(0,w-M);R.style.top=u.height>=P?`0`:`${e}px`,R.style.height=`${N}px`,m.scrollTop=zM(m)}else R.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=$j(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ie===w||N>=C)&&(z.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),B.current=!0}finally{t()}},[s,P,R,ee,d,f,c,h,C,T,ne,E,D,te,_,v,A,w]),b.useEffect(()=>{if(!C||!R||!P)return;let e=lx(R);function t(e){u(!1,ET(TT,e))}return zT(e,`resize`,t)},[u,C,R,P]);let ie={...te?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&oA.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){te||re(e.currentTarget)},...C&&{style:te?{height:`100%`}:wM}},ae=wS(`div`,e,{ref:[t,c],state:H,stateAttributesMapping:IM,props:[I,ie,wj(L),{className:!te&&C?AM.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&AM.getElement(j),(0,y.jsx)(qE,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:ae})]})});function RM(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function zM(e){return eM(e.scrollHeight,e.clientHeight)}function BM(e){return HD.getScale(e)}function VM(e,t,n){return e/n[t]}function HM(e,t){return dw({x:VM(e.x,`x`,t),y:VM(e.y,`y`,t),width:VM(e.width,`x`,t),height:VM(e.height,`y`,t)})}var UM=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function WM(e){let{style:t}=e,n={};for(let[e,r]of UM)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of UM){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var GM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=Rj(),{alignItemWithTriggerActive:c}=SM(),l=TO(o,Qj.hasScrollArrows),u=TO(o,Qj.openMethod),d=TO(o,Qj.multiple),f={id:`${TO(o,Qj.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:wM},className:l&&u!==`touch`?AM.className:void 0};return wS(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),KM=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function qM(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=gM(),f=b.useRef(-1),[p,m]=b.useState(a??(i===KM.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=b.useRef(null),g=b.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Q(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Q(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),b.useMemo(()=>({ref:g,index:p}),[p,g])}var JM=b.createContext(void 0);function YM(){let e=b.useContext(JM);if(!e)throw Error(nS(57));return e}var XM=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,style:c,...l}=e,u=b.useRef(null),d=qM({label:a,textRef:u,indexGuessBehavior:KM.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=Rj(),C=TO(f,Qj.isActive,d.index),w=TO(f,Qj.isSelected,d.index,i),T=TO(f,Qj.isSelectedByFocus,d.index),E=TO(f,Qj.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=rE(D);Q(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),Q(()=>{if(!O)return;let e=f.state.value,t=e;x&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&Vj(i,t,E)&&(f.set(`selectedIndex`,D),u.current&&(S.current=u.current))},[O,D,x,E,f,i,S]);let j={disabled:o,selected:w,highlighted:C},M=p({active:C,selected:w});M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=oS({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function ee(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?Wj(n,i,E):[...n,i],ET(_T,e))}else h(i,ET(_T,e)),m(!1,ET(_T,e))}let R={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,f.set(`activeIndex`,D),e.key===` `&&_.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&_.current||P.current!==`touch`&&!C||(N.current=null,ee(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!g.current.allowSelectedMouseUp&&w,t=!g.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},te=wS(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,R,l,I]}),z=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(JM.Provider,{value:z,children:te})})),ZM=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=YM();return n||r?(0,y.jsx)(QM,{...e,ref:t}):null}),QM=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=YM(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=lT(s),d=wS(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:aT});return cT({open:s,ref:c,onComplete(){s||u(!1)}}),d})),$M=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=YM(),{selectedItemTextRef:o}=Rj(),{className:s,render:c,style:l,...u}=e;return wS(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:u})})),eN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=Rj(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=SM(),_=TO(l,c?Qj.scrollUpArrowVisible:Qj.scrollDownArrowVisible),v=TO(l,Qj.openMethod),y=_&&v!==`touch`,b=Xw(),x=c?g:h,{transitionStatus:S,setMounted:C}=lT(y);Q(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),cT({open:y,ref:x,onComplete(){y||C(!1)}});let w=wS(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=eM(e.scrollHeight,e.clientHeight),r=tM(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=tN(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function tN(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?tM(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?tM(l.offsetTop+l.offsetHeight-r+i,a):a}var nN=b.forwardRef(function(e,t){return(0,y.jsx)(eN,{...e,ref:t,direction:`down`})}),rN=b.forwardRef(function(e,t){return(0,y.jsx)(eN,{...e,ref:t,direction:`up`})}),iN=nM;function aN({className:e,...t}){return(0,y.jsx)(dM,{"data-slot":`select-value`,className:ox(`flex flex-1 text-left`,e),...t})}function oN({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(lM,{"data-slot":`select-trigger`,"data-size":t,className:ox(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *: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 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,y.jsx)(fM,{render:(0,y.jsx)(xy,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function sN({className:e,children:t,footer:n,side:r=`bottom`,sideOffset:i=4,align:a=`center`,alignOffset:o=0,alignItemWithTrigger:s=!0,...c}){return(0,y.jsx)(mM,{children:(0,y.jsx)(OM,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(LM,{"data-slot":`select-content`,"data-align-trigger":s,className:ox(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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),...c,children:[(0,y.jsx)(lN,{}),(0,y.jsx)(GM,{children:t}),(0,y.jsx)(uN,{}),n]})})})}function cN({className:e,children:t,...n}){return(0,y.jsxs)(XM,{"data-slot":`select-item`,className:ox(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,y.jsx)($M,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(ZM,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(by,{className:`pointer-events-none`})})]})}function lN({className:e,...t}){return(0,y.jsx)(rN,{"data-slot":`select-scroll-up-button`,className:ox(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(Sy,{})})}function uN({className:e,...t}){return(0,y.jsx)(nN,{"data-slot":`select-scroll-down-button`,className:ox(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(xy,{})})}var dN=`h-7 justify-between gap-1.5 rounded-md border-border/60 bg-transparent px-2 text-xs font-normal text-foreground shadow-none focus-visible:border-ring/40 focus-visible:ring-1 focus-visible:ring-ring/40 dark:bg-transparent`,fN=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,pN=`rounded-sm py-1.5 pr-7 pl-2 text-xs hover:bg-foreground/10 hover:text-foreground focus:bg-foreground/10 focus:text-foreground`,mN=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=(0,b.useMemo)(()=>t.find(t=>t.id===e),[t,e]),f=(0,b.useMemo)(()=>d?.itemStyle?{...d.itemStyle,...l}:l,[d?.itemStyle,l]);return(0,y.jsxs)(iN,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(oN,{size:`sm`,"aria-label":n,className:ox(dN,`w-full`,c),style:f,children:(0,y.jsx)(aN,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(sN,{alignItemWithTrigger:!1,sideOffset:4,className:ox(fN,MA,NA),footer:u?(0,y.jsx)(`div`,{className:`border-t border-border/40 p-1`,children:u}):void 0,children:t.map(e=>(0,y.jsx)(cN,{value:e.id,className:pN,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})},hN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,gN=Fd.map(e=>({id:e.id,label:e.name})),_N=({themeId:e,onThemeChange:t,onThemePreview:n,onOpenChange:r})=>(0,y.jsxs)(YA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(XA,{className:hN,children:`Theme`}),(0,y.jsx)(mN,{value:e,items:gN,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:t,onOpenChange:r,onItemHover:n})]});function vN(e){return wS(e.defaultTagName??`div`,e,e)}var yN=Fy(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function bN({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:ox(yN({orientation:t}),e),...n})}function xN({className:e,render:t,...n}){return vN({defaultTagName:`div`,props:Vx({className:ox(`flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e)},n),render:t,state:{slot:`button-group-text`}})}var SN={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1};function CN({value:e,min:t,max:n,step:r,onChange:i}){let a=(0,b.useRef)(null),o=(0,b.useRef)(e);return{onPointerDown:t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}a.current=t.clientX,o.current=e}},onPointerMove:e=>{let s=a.current;if(s===null)return;let c=e.clientX-s,l=Math.round(c/5);if(l===0)return;let u=o.current+l*r;i(Math.max(t,Math.min(n,u)))},onPointerUp:e=>{if(a.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}a.current=null}},onPointerLeave:e=>{if(a.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(a.current=null)},onKeyDown:a=>{if(a.key===`Home`){a.preventDefault(),i(t);return}if(a.key===`End`){a.preventDefault(),i(n);return}let o=SN[a.key];o!==void 0&&(a.preventDefault(),i(Math.max(t,Math.min(n,e+o*r))))}}}var wN=e=>String(e),TN=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,EN=`h-7 min-w-[3rem] cursor-ew-resize touch-none justify-center border-y-0 border-r border-l! border-border/60 bg-transparent px-1.5 text-xs font-medium tabular-nums text-foreground select-none hover:bg-foreground/5 focus-visible:outline-none focus-visible:bg-foreground/5`,DN=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=wN,onValueChange:c})=>{let l=CN({value:e,min:t,max:n,step:r,onChange:c});return(0,y.jsxs)(bN,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(MS,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:TN,children:(0,y.jsx)(Ty,{})}),(0,y.jsx)(xN,{role:`slider`,tabIndex:0,"aria-label":i,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":s(e),"aria-orientation":`horizontal`,title:`Drag or use arrow keys to adjust`,className:EN,...l,onPointerCancel:l.onPointerUp,children:s(e)}),(0,y.jsx)(MS,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:TN,children:(0,y.jsx)(Dy,{})})]})},ON=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,kN=`text-xs font-normal text-muted-foreground`,AN=e=>e.toFixed(1),jN=({fontId:e,fontItems:t,isFontSelectOpen:n,onFontChange:r,onFontPreview:i,onFontSelectOpenChange:a,onOpenLocalFontPicker:o,fontSize:s,onFontSizeChange:c,lineHeight:l,onLineHeightChange:u})=>(0,y.jsxs)(YA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(XA,{className:ON,children:`Font`}),(0,y.jsx)(mN,{value:e,items:t,ariaLabel:`select font`,placeholder:`Font`,open:n,onValueChange:r,onOpenChange:a,onItemHover:i,footerSlot:(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs text-muted-foreground outline-none transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:bg-foreground/10 focus-visible:text-foreground`,onClick:o,children:[(0,y.jsx)(Ey,{className:`size-3`}),(0,y.jsx)(`span`,{children:`Local font…`})]})}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:kN,children:`Size`}),(0,y.jsx)(DN,{value:s,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:c})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:kN,children:`Line height`}),(0,y.jsx)(DN,{value:l,min:1,max:2,step:ad,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:AN,onValueChange:u})]})]}),MN=b.createContext(void 0);function NN(){let e=b.useContext(MN);if(e===void 0)throw Error(nS(63));return e}var PN=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),FN={...LS,checked(e){return e?{[PN.checked]:``}:{[PN.unchecked]:``}}},IN=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...x}=e,{clearErrors:S}=VS(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=zS(),{labelId:P}=JS(),F=j||m,I=M??l,L=Z(d),ee=b.useRef(null),R=lS(ee,c,N.inputRef),te=b.useRef(null),z=KS(),B=QS({id:s,implicit:!1,controlRef:te}),V=u?void 0:B,[ne,re]=uT({controlled:n,default:!!i,name:`Switch`,state:`checked`});dT(te,{id:z,value:ne}),Q(()=>{ee.current&&D(ee.current.checked)},[ee,D]),Ck(ne,()=>{S(I),T(ne!==E.initialValue),D(ne),k()?N.commit(ne):N.commit(ne,!0)});let{getButtonProps:H,buttonRef:ie}=oS({disabled:F,native:u}),ae=YS(a,P,ee,!u,V),oe={id:u?B:z,role:`switch`,"aria-checked":ne,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ae,onFocus(){F||O(!0)},onBlur(){let e=ee.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),ee.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},se=b.useMemo(()=>Vx({checked:ne,disabled:F,form:o,id:V,name:I,required:p,style:I?sE:oE,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:R,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=ET(fT,e.nativeEvent);L?.(t,n),!n.isCanceled&&re(t)},onFocus(){te.current?.focus()}},N.getInputValidationProps,_===void 0?bS:{value:_}),[ne,F,o,R,V,I,L,f,p,re,N,_]),ce=b.useMemo(()=>({...C,checked:ne,disabled:F,readOnly:f,required:p}),[C,ne,F,f,p]),le=wS(`span`,e,{state:ce,ref:[t,te,ie],props:[oe,N.getValidationProps,x,H],stateAttributesMapping:FN});return(0,y.jsxs)(MN.Provider,{value:ce,children:[le,!ne&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...se,suppressHydrationWarning:!0})]})}),LN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=zS(),s=NN();return wS(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:FN,props:a})});function RN({className:e,size:t=`default`,...n}){return(0,y.jsx)(IN,{"data-slot":`switch`,"data-size":t,className:ox(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,y.jsx)(LN,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%_-_2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%_-_2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var zN=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],BN=`block`,VN=zN.map(e=>e.id),HN=e=>typeof e==`string`&&VN.includes(e),UN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,WN=`text-xs font-normal text-muted-foreground`,GN=zN.map(e=>({id:e.id,label:e.name})),KN=({cursorStyle:e,onCursorStyleChange:t,onCursorStyleSelectOpenChange:n,onCursorStyleHover:r,cursorBlink:i,onCursorBlinkChange:a})=>(0,y.jsxs)(YA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(XA,{className:UN,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:WN,children:`Style`}),(0,y.jsx)(mN,{value:e,items:GN,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:t,onOpenChange:n,onItemHover:r})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:WN,children:`Blink`}),(0,y.jsx)(RN,{"aria-label":`toggle cursor blink`,checked:i,onCheckedChange:a})]})]}),qN=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],JN=1e4,YN=qN.map(e=>e.value),XN=e=>YN.includes(e),ZN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,QN=`text-xs font-normal text-muted-foreground`,$N=qN.map(e=>({id:String(e.value),label:e.label})),eP=({scrollback:e,onScrollbackChange:t,scrollOnUserInput:n,onScrollOnUserInputChange:r})=>(0,y.jsxs)(YA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(XA,{className:ZN,children:`Scrollback`}),(0,y.jsx)(mN,{value:String(e),items:$N,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:t}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(Nj,{children:[(0,y.jsx)(Pj,{render:(0,y.jsx)(`span`,{className:QN}),children:`Pin to bottom on input`}),(0,y.jsx)(Fj,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, typing scrolls the viewport back to the bottom. When off, the viewport stays where you scrolled — useful for reading history while typing.`})]}),(0,y.jsx)(RN,{"aria-label":`toggle pin to bottom on input`,checked:n,onCheckedChange:r})]})]});function tP(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=uT({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=lT(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=KS(),[_,v]=b.useState(),y=_??g,[x,S]=b.useState(!1),[C,w]=b.useState(!1),T=b.useRef(null),E=b.useRef(null),D=b.useRef(null),O=b.useRef(null),k=sT(O,!1),A=Z(e=>{let t=!o,n=ET(pT,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!x&&!C&&(E.current!=null&&E.current!==`css-animation`&&!c&&t&&l(!0),E.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),E.current===`none`&&c&&!t&&l(!1)});return Q(()=>{a&&E.current===`none`&&!o&&l(!1)},[a,o,t,l]),b.useMemo(()=>({abortControllerRef:T,animationTypeRef:E,disabled:i,handleTrigger:A,height:p,mounted:c,open:o,panelId:y,panelRef:O,runOnceAnimationsFinish:k,setDimensions:h,setHiddenUntilFound:S,setKeepMounted:w,setMounted:l,setOpen:s,setPanelIdState:v,setVisible:f,transitionDimensionRef:D,transitionStatus:u,visible:d,width:m}),[T,E,i,A,p,c,o,y,O,k,h,S,w,l,s,f,D,u,d,m])}var nP=b.createContext(void 0);function rP(){let e=b.useContext(nP);if(e===void 0)throw Error(nS(15));return e}var iP=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=nT.startingStyle]=`startingStyle`,e[e.endingStyle=nT.endingStyle]=`endingStyle`,e}({}),aP=function(e){return e.panelOpen=`data-panel-open`,e}({}),oP={[iP.open]:``},sP={[iP.closed]:``},cP={open(e){return e?{[aP.panelOpen]:``}:null}},lP={open(e){return e?oP:sP},...aT},uP=b.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Z(o),d=tP({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=b.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=b.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=wS(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:lP});return(0,y.jsx)(nP.Provider,{value:p,children:m})}),dP={...cP,...aT},fP=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=rP(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=oS({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return wS(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:dP})}),pP=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function mP(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:g,transitionDimensionRef:_,visible:v,width:y}=e,x=b.useRef(!1),S=b.useRef(null),C=b.useRef(u),w=b.useRef(u),T=eT(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=lS(r,d,Z(e=>{if(!e)return;if(n.current==null||_.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(pP.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?_.current=`width`:_.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||y===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),w.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=$w.request(()=>{w.current=!1,r=$w.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{$w.cancel(t),$w.cancel(r)}}));return Q(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!w.current&&!o&&e.setAttribute(iP.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=$w.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=iP.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),T.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{$w.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),Q(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(S.current=e.style.animationName||S.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!C.current&&!x.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),g(!0)):(t.current=new AbortController,f(()=>{m(!1),g(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,g,v]),qw(()=>{let e=$w.request(()=>{C.current=!1});return()=>$w.cancel(e)}),Q(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&x.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=$w.request(()=>{x.current=!1,n=$w.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{$w.cancel(t),$w.cancel(n)}},[a,u,d,p]),Q(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(iP.startingStyle,``))},[a,E,n,d]),b.useEffect(function(){let e=d.current;if(!e)return;function t(e){x.current=!0,h(!0),l(!0,ET(fT,e))}return zT(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var hP=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),gP=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=rP(),j=r??!1,M=i??!1;Q(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),Q(()=>{y(j)},[y,j]),Q(()=>{x(M)},[x,M]);let{props:N}=mP({abortControllerRef:l,animationTypeRef:u,externalRef:t,height:d,hiddenUntilFound:j,id:h,keepMounted:M,mounted:f,onOpenChange:p,open:m,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setMounted:S,setOpen:w,setVisible:T,transitionDimensionRef:D,visible:O,width:k});cT({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=wS(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[hP.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[hP.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:lP});return M||j||f?P:null});function _P({...e}){return(0,y.jsx)(uP,{"data-slot":`collapsible`,...e})}function vP({...e}){return(0,y.jsx)(fP,{"data-slot":`collapsible-trigger`,...e})}function yP({...e}){return(0,y.jsx)(gP,{"data-slot":`collapsible-content`,...e})}var bP=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,xP=`text-xs font-normal text-muted-foreground`,SP=({label:e,value:t,title:n,valueClassName:r})=>(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:xP,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:ox(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),CP=({sessionInfo:e})=>e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(KA,{className:`bg-border/40`}),(0,y.jsxs)(_P,{defaultOpen:!1,children:[(0,y.jsx)(vP,{render:(0,y.jsxs)(`button`,{type:`button`,className:`group/shell flex w-full items-center justify-between gap-2 rounded-sm py-1 text-left transition-colors outline-none hover:text-foreground/90 focus-visible:text-foreground/90`,children:[(0,y.jsx)(`span`,{className:bP,children:`Shell`}),(0,y.jsx)(xy,{className:`size-3 text-muted-foreground/60 transition-transform duration-200 ease-snappy will-change-transform group-aria-expanded/shell:rotate-180`})]})}),(0,y.jsx)(yP,{className:`h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-snappy data-closed:h-0`,children:(0,y.jsxs)(`dl`,{className:`flex flex-col gap-1 pt-2 text-xs`,children:[(0,y.jsx)(SP,{label:`Name`,value:e.shellName}),(0,y.jsx)(SP,{label:`Path`,value:e.shell,title:e.shell}),(0,y.jsx)(SP,{label:`PID`,value:String(e.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(SP,{label:`Cwd`,value:e.cwd,title:e.cwd})]})})]})]}):null,wP=Fy(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>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:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,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 TP({className:e,variant:t=`default`,render:n,...r}){return vN({defaultTagName:`span`,props:Vx({className:ox(wP({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var EP=Object.fromEntries(Ad.map(e=>[e.id,{fontFamily:e.family}])),DP=Ad.map(e=>({id:e.id,label:e.name,itemStyle:EP[e.id]})),OP=e=>({id:md,label:(0,y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:e}),(0,y.jsx)(TP,{variant:`secondary`,className:`h-4 px-1.5 text-[10px] font-medium`,children:`Local`})]}),itemStyle:{fontFamily:`"${wd(e)}", ui-monospace, monospace`}}),kP=({onThemeChange:e,onThemePreview:t,fontId:n,onFontChange:r,onFontPreview:i,localFontFamily:a,onCursorStyleChange:o,onCursorStylePreview:s,onScrollbackChange:c})=>{let[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(!1);return{isDialogOpen:l,isFontSelectOpen:d,isLocalFontPickerOpen:p,setIsLocalFontPickerOpen:m,fontItems:(0,b.useMemo)(()=>n!==`local`||!a?DP:[...DP,OP(a)],[n,a]),handleDialogOpenChange:e=>{u(e),e||(f(!1),m(!1),t?.(null),i?.(null),s?.(null))},openLocalFontPicker:()=>{f(!1),m(!0)},handleThemeChange:t=>{t&&e(t)},handleFontChange:e=>{e&&r(e)},handleCursorStyleChange:e=>{HN(e)&&o(e)},handleScrollbackChange:e=>{if(e===null)return;let t=Number(e);XN(t)&&c(t)},handleThemeSelectOpenChange:e=>{e||t?.(null)},handleFontSelectOpenChange:e=>{f(e),e||i?.(null)},handleCursorStyleSelectOpenChange:e=>{e||s?.(null)},handleCursorStyleHover:e=>{HN(e)&&s?.(e)}}},AP=e=>{let{isDialogOpen:t,isFontSelectOpen:n,isLocalFontPickerOpen:r,setIsLocalFontPickerOpen:i,fontItems:a,handleDialogOpenChange:o,openLocalFontPicker:s,handleThemeChange:c,handleFontChange:l,handleCursorStyleChange:u,handleScrollbackChange:d,handleThemeSelectOpenChange:f,handleFontSelectOpenChange:p,handleCursorStyleSelectOpenChange:m,handleCursorStyleHover:h}=kP(e),{themeId:g,onThemePreview:_,fontId:v,onFontPreview:b,localFontFamily:x,onLocalFontChange:S,fontSize:C,onFontSizeChange:w,lineHeight:T,onLineHeightChange:E,cursorStyle:D,onCursorStylePreview:O,cursorBlink:k,onCursorBlinkChange:A,scrollback:j,scrollOnUserInput:M,onScrollOnUserInputChange:N,sessionInfo:P}=e;return(0,y.jsxs)(TA,{open:t,onOpenChange:o,children:[(0,y.jsxs)(Nj,{children:[(0,y.jsx)(Pj,{render:(0,y.jsx)(EA,{render:(0,y.jsx)(MS,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`})}),children:(0,y.jsx)(ky,{})}),t?null:(0,y.jsx)(Fj,{side:`bottom`,sideOffset:8,children:`Settings`})]}),(0,y.jsxs)(kA,{className:ox(`max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-4 sm:max-w-md`,MA),children:[(0,y.jsx)(AA,{className:`mb-4 pr-8`,children:(0,y.jsx)(jA,{children:`Settings`})}),(0,y.jsxs)(qA,{className:`gap-3`,children:[(0,y.jsx)(_N,{themeId:g,onThemeChange:c,onThemePreview:_,onOpenChange:f}),(0,y.jsx)(KA,{className:`bg-border/40`}),(0,y.jsx)(jN,{fontId:v,fontItems:a,isFontSelectOpen:n,onFontChange:l,onFontPreview:b,onFontSelectOpenChange:p,onOpenLocalFontPicker:s,fontSize:C,onFontSizeChange:w,lineHeight:T,onLineHeightChange:E}),(0,y.jsx)(KA,{className:`bg-border/40`}),(0,y.jsx)(KN,{cursorStyle:D,onCursorStyleChange:u,onCursorStyleSelectOpenChange:m,onCursorStyleHover:O?h:void 0,cursorBlink:k,onCursorBlinkChange:A}),(0,y.jsx)(KA,{className:`bg-border/40`}),(0,y.jsx)(eP,{scrollback:j,onScrollbackChange:d,scrollOnUserInput:M,onScrollOnUserInputChange:N}),(0,y.jsx)(CP,{sessionInfo:P??null})]})]}),(0,y.jsx)(UA,{open:r,onOpenChange:i,currentFamily:x,onApply:S})]})},jP=({activeThemeId:e,onThemeChange:t,onThemePreview:n,activeFontId:r,onFontChange:i,onFontPreview:a,activeLocalFontFamily:o,onLocalFontChange:s,activeFontSize:c,onFontSizeChange:l,activeLineHeight:u,onLineHeightChange:d,activeCursorStyle:f,onCursorStyleChange:p,onCursorStylePreview:m,activeCursorBlink:h,onCursorBlinkChange:g,activeScrollback:_,onScrollbackChange:v,activeScrollOnUserInput:b,onScrollOnUserInputChange:x,sessionInfo:S,newTabUrl:C,onOpenSearch:w,isMac:T,isSearchOpen:E})=>E?null:(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,"data-terminal-toolbar":!0,className:`absolute top-2 right-3 z-10 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,children:[(0,y.jsx)(AP,{themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,localFontFamily:o,onLocalFontChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,cursorStyle:f,onCursorStyleChange:p,onCursorStylePreview:m,cursorBlink:h,onCursorBlinkChange:g,scrollback:_,onScrollbackChange:v,scrollOnUserInput:b,onScrollOnUserInputChange:x,sessionInfo:S}),(0,y.jsxs)(Nj,{children:[(0,y.jsx)(Pj,{render:(0,y.jsx)(MS,{variant:`ghost`,size:`icon-sm`,onClick:w,"aria-label":`find in terminal`,className:`hover:text-foreground`}),children:(0,y.jsx)(Oy,{})}),(0,y.jsxs)(Fj,{side:`bottom`,sideOffset:8,children:[`Find `,T?`(⌘F)`:`(Ctrl+F)`]})]}),(0,y.jsxs)(Nj,{children:[(0,y.jsx)(Pj,{render:(0,y.jsx)(MS,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{href:C,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`}),children:(0,y.jsx)(Dy,{})}),(0,y.jsx)(Fj,{side:`bottom`,sideOffset:8,children:`New shell (new tab)`})]})]}),MP=({exitInfo:e})=>e?(0,y.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10 inline-flex items-center rounded-md border border-red-500/30 bg-red-500/10 px-2 py-0.5 text-xs font-medium text-red-400`,children:e.reason===`shell-exited`?e.exitCode===null?`exited`:`exited · code ${e.exitCode}`:`disconnected · code ${e.closeCode}`}):null,NP=(e,t)=>{let n=null,r=()=>{n=null,e.style.height=`${t.height}px`,e.style.transform=t.offsetTop?`translateY(${t.offsetTop}px)`:``},i=()=>{n===null&&(n=window.requestAnimationFrame(r))};return i(),t.addEventListener(`resize`,i),t.addEventListener(`scroll`,i),()=>{n!==null&&window.cancelAnimationFrame(n),t.removeEventListener(`resize`,i),t.removeEventListener(`scroll`,i),e.style.height=``,e.style.transform=``}},PP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!t||!n)return;let r=e.current,i=window.visualViewport;if(!(!r||!i))return NP(r,i)},[t,n,e])},FP=e=>{(0,b.useEffect)(()=>{if(!e)return;let t=new URL(window.location.href);t.searchParams.set(`cwd`,e),window.history.replaceState(null,``,t)},[e])},IP=(e,t)=>{(0,b.useEffect)(()=>{t?.(e)},[e,t])},LP=()=>typeof navigator<`u`&&navigator.vendor===`Apple Computer, Inc.`,RP=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},zP=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,BP=()=>({isMac:(0,b.useMemo)(RP,[]),isTouchDevice:(0,b.useMemo)(zP,[]),isAppleWebKit:(0,b.useMemo)(LP,[])}),VP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!e)return;let r=window.setInterval(()=>{t()},n);return()=>window.clearInterval(r)},[e,t,n])},HP=(e,t,n)=>{let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(0),[s,c]=(0,b.useState)(``),[l,u]=(0,b.useState)({resultIndex:-1,resultCount:0}),d=(0,b.useRef)(null),f=(0,b.useCallback)(t=>{if(!t){e.current?.clearDecorations(),u({resultIndex:-1,resultCount:0});return}e.current?.findNext(t)},[e]),p=(0,b.useCallback)(t=>{t&&e.current?.findPrevious(t)},[e]),m=(0,b.useCallback)(()=>{i(!1),c(``),u({resultIndex:-1,resultCount:0}),e.current?.clearDecorations(),t.current?.()},[e,t]),h=(0,b.useCallback)(()=>{i(!0),o(e=>e+1)},[]);return d.current=h,{isSearchOpen:r,setIsSearchOpen:i,searchOpenAttempt:a,searchQuery:s,searchResults:l,setSearchResults:u,openSearchOverlayRef:d,openSearchOverlay:h,handleSearchInputChange:(0,b.useCallback)(e=>{let t=e.target.value;c(t),f(t)},[f]),handleSearchKeyDown:(0,b.useCallback)(e=>{if(ty(e.nativeEvent,n)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),m();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?p(s):f(s))},[m,f,p,n,s]),handleSearchClose:m,findNextMatch:f,findPreviousMatch:p}},UP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!e)return;let t=n.current;t&&(t.focus(),t.select())},[e,t,n])},WP=async e=>{if(!(typeof document>`u`)&&e.name)try{await Promise.all([document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`)])}catch{}},GP=(e,t,n,r)=>{n?.clearTextureAtlas(),e.options.fontFamily=``,e.options.fontFamily=r,cy(e,t),n?.clearTextureAtlas()},KP=(e,t,n,r)=>{(0,b.useEffect)(()=>{if(!e.current)return;let i=!1;return WP(r).then(()=>{if(i)return;let a=e.current;if(!a)return;let o=t.current;o&&GP(a,o,n.current,r.family)}),()=>{i=!0}},[r,e,t,n])},qP=(e,t,n,r)=>{(0,b.useEffect)(()=>{let i=e.current;if(!i)return;i.options.fontSize=n,i.options.lineHeight=r;let a=t.current;a&&cy(i,a)},[n,r,e,t])},JP=(e,t,n,r,i,a)=>{(0,b.useEffect)(()=>{let o=e.current;o&&(o.options.theme=t.colors,o.options.cursorStyle=n,o.options.cursorBlink=r,o.options.scrollback=i,o.options.scrollOnUserInput=a)},[t,n,r,i,a,e])},YP=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},XP=1/ad,ZP=e=>Math.round(e*XP)/XP,QP=e=>{if(!Number.isFinite(e))return id;let t=ZP(e);return t<1?1:t>2?2:t},$P=(e,t,n)=>({load:()=>{if(typeof window>`u`)return t;try{let r=window.localStorage.getItem(e);return r===null||r===``?t:n?n(r):r}catch{return t}},store:t=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,String(t))}catch{}}}),eF=$P(pd,null,e=>e.trim()||null),tF=()=>eF.load(),nF=e=>eF.store(e),rF=$P(dd,Id,e=>Ld(e).id),iF=()=>rF.load(),aF=e=>rF.store(e),oF=$P(fd,jd,e=>e===`local`?eF.load()?md:jd:Md(e).id),sF=()=>oF.load(),cF=e=>oF.store(e),lF=$P(hd,13,e=>YP(Number(e))),uF=()=>lF.load(),dF=e=>lF.store(e),fF=$P(gd,id,e=>QP(Number(e))),pF=()=>fF.load(),mF=e=>fF.store(e),hF=$P(_d,BN,e=>HN(e)?e:BN),gF=()=>hF.load(),_F=e=>hF.store(e),vF=$P(vd,!0,e=>e===`true`?!0:e!==`false`),yF=()=>vF.load(),bF=e=>vF.store(e),xF=$P(yd,JN,e=>{let t=Number(e);return XN(t)?t:JN}),SF=()=>xF.load(),CF=e=>xF.store(e),wF=$P(bd,!0,e=>e===`true`?!0:e!==`false`),TF=()=>wF.load(),EF=e=>wF.store(e),DF=(e,t,n)=>{let r=(0,b.useRef)(iF()),i=(0,b.useRef)(sF()),a=(0,b.useRef)(tF()),o=(0,b.useRef)(uF()),s=(0,b.useRef)(pF()),c=(0,b.useRef)(gF()),l=(0,b.useRef)(yF()),u=(0,b.useRef)(SF()),d=(0,b.useRef)(TF()),[f,p]=(0,b.useState)(r.current),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(i.current),[v,y]=(0,b.useState)(a.current),[x,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(o.current),[T,E]=(0,b.useState)(s.current),[D,O]=(0,b.useState)(c.current),[k,A]=(0,b.useState)(null),[j,M]=(0,b.useState)(l.current),[N,P]=(0,b.useState)(u.current),[F,I]=(0,b.useState)(d.current),L=m??f,ee=(0,b.useMemo)(()=>Ld(L),[L]),R=x??g;return{initialThemeIdRef:r,initialFontIdRef:i,initialLocalFontFamilyRef:a,initialFontSizeRef:o,initialLineHeightRef:s,initialCursorStyleRef:c,initialCursorBlinkRef:l,initialScrollbackRef:u,initialScrollOnUserInputRef:d,activeThemeId:f,setActiveThemeId:p,previewThemeId:m,setPreviewThemeId:h,activeFontId:g,setActiveFontId:_,activeLocalFontFamily:v,setActiveLocalFontFamily:y,previewFontId:x,setPreviewFontId:S,activeFontSize:C,setActiveFontSize:w,activeLineHeight:T,setActiveLineHeight:E,activeCursorStyle:D,setActiveCursorStyle:O,previewCursorStyle:k,setPreviewCursorStyle:A,activeCursorBlink:j,setActiveCursorBlink:M,activeScrollback:N,setActiveScrollback:P,activeScrollOnUserInput:F,setActiveScrollOnUserInput:I,effectiveTheme:ee,effectiveFont:(0,b.useMemo)(()=>Md(R,v),[R,v]),newTabUrl:(0,b.useMemo)(()=>Zv(n),[n]),handleThemeChange:(0,b.useCallback)(e=>{p(e),h(null),aF(e)},[]),handlePreviewTheme:(0,b.useCallback)(e=>{h(e)},[]),handleFontChange:(0,b.useCallback)(e=>{_(e),S(null),cF(e)},[]),handlePreviewFont:(0,b.useCallback)(e=>{S(e)},[]),handleLocalFontChange:(0,b.useCallback)(e=>{y(e),_(md),S(null),nF(e),cF(md)},[]),handleFontSizeChange:(0,b.useCallback)(e=>{let t=YP(e);w(t),dF(t)},[]),handleLineHeightChange:(0,b.useCallback)(e=>{let t=QP(e);E(t),mF(t)},[]),handleCursorStyleChange:(0,b.useCallback)(e=>{O(e),A(null),_F(e)},[]),handlePreviewCursor:(0,b.useCallback)(e=>{A(e)},[]),handleCursorBlinkChange:(0,b.useCallback)(e=>{M(e),bF(e)},[]),handleScrollbackChange:(0,b.useCallback)(e=>{P(e),CF(e)},[]),handleScrollOnUserInputChange:(0,b.useCallback)(e=>{I(e),EF(e)},[])}},OF=(e,t,n)=>{(0,b.useEffect)(()=>{let r=e.current;if(!r)return;let i=0,a=0,o=!1,s=new AbortController,c=()=>{r.textarea&&(r.textarea.inputMode=``),r.focus()},l=()=>{t&&r.textarea&&(r.textarea.inputMode=`none`),r.focus()};if(n.current=l,t){let e=s.signal,t=()=>{r.textarea&&(r.textarea.inputMode=`none`)},n=()=>{r.textarea&&(r.textarea.blur(),r.textarea.inputMode=`none`)};t(),r.textarea?.addEventListener(`blur`,t,{signal:e});let l=window.visualViewport;if(l){let t=l.height,r=l.width;l.addEventListener(`resize`,()=>{let e=l.height,i=l.width,a=e>t+150,o=Math.abs(i-r)<20;a&&o&&n(),t=e,r=i},{signal:e})}r.element?.addEventListener(`touchstart`,e=>{if(e.touches.length!==1){o=!0;return}i=e.touches[0].clientX,a=e.touches[0].clientY,o=!1},{capture:!0,passive:!0,signal:e}),r.element?.addEventListener(`touchmove`,e=>{if(e.touches.length!==1){o=!0;return}Math.hypot(e.touches[0].clientX-i,e.touches[0].clientY-a)>10&&(o=!0)},{capture:!0,passive:!0,signal:e}),r.element?.addEventListener(`touchend`,e=>{if(o){e.preventDefault();return}c()},{capture:!0,passive:!1,signal:e})}return l(),()=>{s.abort(),n.current=null}},[e,t,n])},kF=(e,t)=>{(0,b.useEffect)(()=>()=>{e.current!==null&&(window.clearTimeout(e.current),e.current=null),t.current!==null&&(window.clearTimeout(t.current),t.current=null)},[e,t])},AF=(e,t)=>`\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,jF=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,MF=({terminalRef:e,flowControllerRef:t,exitedRef:n,lastTitleRef:r,resetFaviconRef:i,noteOutputActivityRef:a,liveCwdRef:o,isReconnectingRef:s,retryFeedbackTimerRef:c,copyFeedbackTimerRef:l,setExitInfo:u,setSessionInfo:d,setConsecutiveFailures:f,setHasCopiedRestartCommand:p,setIsRetryingConnection:m,setLiveCwd:h})=>{let g=(0,b.useRef)(null),_=(0,b.useRef)(null),v=(0,b.useCallback)(e=>{g.current?.readyState===WebSocket.OPEN&&g.current.send(JSON.stringify(e))},[]);return(0,b.useEffect)(()=>{let c=!1,l=!1,p=null,m=()=>{if(t.current?.clear(),c)return;let u=new WebSocket(Xv(o.current));u.binaryType=`arraybuffer`,g.current=u,u.addEventListener(`open`,()=>{c||g.current!==u||(l=!0,f(0),e.current&&v({type:`resize`,cols:e.current.cols,rows:e.current.rows}),s.current=!1)}),u.addEventListener(`message`,e=>{if(c||g.current!==u)return;if(e.data instanceof ArrayBuffer){t.current?.write(new Uint8Array(e.data)),a.current?.();return}if(typeof e.data!=`string`)return;let n;try{n=JSON.parse(e.data)}catch{return}if(typeof n!=`object`||!n||typeof n.type!=`string`)return;let o=n;if(o.type===`output`)t.current?.write(o.data),a.current?.();else if(o.type===`title`){let e=o.title.trim();if(!e)return;r.current=e,document.title=e}else o.type===`session`?(d({shell:o.shell,shellName:o.shellName,pid:o.pid,cwd:o.cwd}),h(o.cwd)):o.type===`cwd`?h(o.cwd):o.type===`exit`&&(i.current?.(),y(o.code))}),u.addEventListener(`close`,e=>{if(g.current===u&&(g.current=null,s.current=!1,!c&&!n.current)){if(l){console.warn(`[localterm] websocket closed: code=${e.code} reason=${JSON.stringify(e.reason)} wasClean=${e.wasClean}`),b(e.code,e.reason,e.wasClean);return}f(e=>e+1),p=window.setTimeout(m,nd)}}),u.addEventListener(`error`,()=>{console.warn(`[localterm] websocket error`);try{u.close()}catch{}})},y=t=>{n.current||(n.current=!0,i.current?.(),sf(`dead`),e.current?.write(jF(t)),document.title=`† ${r.current||`localterm`}`,u({reason:`shell-exited`,exitCode:t}),d(null))},b=(t,a,o)=>{n.current||(n.current=!0,i.current?.(),sf(`dead`),e.current?.write(AF(t,a)),document.title=`† ${r.current||`localterm`}`,u({reason:`connection-lost`,closeCode:t,closeReason:a,wasClean:o}),d(null))};return _.current=()=>{if(!c){n.current=!1,l=!1,u(null),d(null),f(0),sf(`idle`),p!==null&&(window.clearTimeout(p),p=null);try{g.current?.close()}catch{}g.current=null,m()}},m(),()=>{c=!0,_.current=null,p!==null&&window.clearTimeout(p);try{g.current?.close()}catch{}g.current=null}},[]),{send:v,triggerManualReconnect:(0,b.useCallback)(()=>{s.current||(s.current=!0,m(!0),_.current?.(),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{c.current=null,m(!1)},800))},[]),copyRestartCommand:(0,b.useCallback)(()=>{navigator.clipboard.writeText(od).then(()=>{p(!0),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,p(!1)},sd)}).catch(()=>{})},[])}},NF=({onModalOpenChange:e}={})=>{let t=(0,b.useRef)(null),n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(null),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(!1),d=(0,b.useRef)(null),f=(0,b.useRef)(null),p=(0,b.useRef)(!1),m=(0,b.useRef)(``),h=(0,b.useRef)(null),g=(0,b.useRef)(null),_=(0,b.useRef)(null),[v,x]=(0,b.useState)(null),[C,w]=(0,b.useState)(0),[T,E]=(0,b.useState)(!1),[O,k]=(0,b.useState)(!1),[A,j]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),{initialThemeIdRef:P,initialFontIdRef:F,initialLocalFontFamilyRef:I,initialFontSizeRef:L,initialLineHeightRef:ee,initialCursorStyleRef:R,initialCursorBlinkRef:te,initialScrollbackRef:z,initialScrollOnUserInputRef:B,activeThemeId:V,setActiveThemeId:ne,activeFontId:re,setActiveFontId:H,activeLocalFontFamily:ie,setActiveLocalFontFamily:ae,activeFontSize:oe,setActiveFontSize:se,activeLineHeight:ce,setActiveLineHeight:le,activeCursorStyle:ue,setActiveCursorStyle:de,previewCursorStyle:fe,activeCursorBlink:pe,setActiveCursorBlink:me,activeScrollback:he,setActiveScrollback:ge,activeScrollOnUserInput:_e,setActiveScrollOnUserInput:ve,effectiveTheme:ye,effectiveFont:be,newTabUrl:xe,handleThemeChange:Se,handlePreviewTheme:Ce,handleFontChange:we,handlePreviewFont:Te,handleLocalFontChange:Ee,handleFontSizeChange:De,handleLineHeightChange:Oe,handleCursorStyleChange:ke,handlePreviewCursor:Ae,handleCursorBlinkChange:je,handleScrollbackChange:Me,handleScrollOnUserInputChange:Ne}=DF(r,i,M),{isMac:Pe,isTouchDevice:Fe,isAppleWebKit:Ie}=BP();PP(t,Fe,Ie),OF(r,Fe,d);let{isSearchOpen:Le,searchOpenAttempt:Re,searchQuery:ze,searchResults:Be,setSearchResults:Ve,openSearchOverlay:He,handleSearchInputChange:Ue,handleSearchKeyDown:We,findNextMatch:Ge,findPreviousMatch:Ke,openSearchOverlayRef:qe}=HP(o,d,Pe),Ye=fe??ue,Ze=ye.colors.background??`#101010`,{send:Qe,triggerManualReconnect:$e,copyRestartCommand:et}=MF({terminalRef:r,flowControllerRef:g,exitedRef:p,lastTitleRef:m,resetFaviconRef:h,noteOutputActivityRef:_,liveCwdRef:f,isReconnectingRef:u,retryFeedbackTimerRef:c,copyFeedbackTimerRef:l,setExitInfo:x,setSessionInfo:j,setConsecutiveFailures:w,setHasCopiedRestartCommand:E,setIsRetryingConnection:k,setLiveCwd:N,setActiveThemeId:ne,setActiveFontId:H,setActiveLocalFontFamily:ae,setActiveFontSize:se,setActiveLineHeight:le,setActiveCursorStyle:de,setActiveCursorBlink:me,setActiveScrollback:ge,setActiveScrollOnUserInput:ve,initialThemeIdRef:P,initialFontIdRef:F,initialLocalFontFamilyRef:I,initialFontSizeRef:L,initialLineHeightRef:ee,initialCursorStyleRef:R,initialCursorBlinkRef:te,initialScrollbackRef:z,initialScrollOnUserInputRef:B});(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let t=!1;p.current=!1,m.current=``;let s=null,c=null,l=`idle`;_.current=()=>{c!==null&&(window.clearTimeout(c),c=null),l===`idle`&&s===null&&(s=window.setTimeout(()=>{s=null,!(t||p.current)&&(l=`active`,sf(`active`))},250)),c=window.setTimeout(()=>{c=null,s!==null&&(window.clearTimeout(s),s=null),l===`active`&&(l=`idle`,sf(`idle`))},750)};let u=()=>{s!==null&&(window.clearTimeout(s),s=null),c!==null&&(window.clearTimeout(c),c=null),l===`active`&&(l=`idle`,sf(`idle`))};h.current=u;let f=Md(F.current,I.current),v=new td({allowProposedApi:!0,cursorBlink:te.current,cursorStyle:R.current,fontFamily:f.family,fontSize:L.current,lineHeight:ee.current,scrollback:z.current,theme:Ld(P.current).colors,macOptionIsMeta:!0,scrollOnUserInput:B.current});r.current=v;let y=new D;i.current=y,v.loadAddon(y),v.loadAddon(new Pn),v.loadAddon(new S),v.loadAddon(new Je),v.loadAddon(new Xe),v.loadAddon(new On);let b=new dt;v.loadAddon(b),o.current=b;let x=b.onDidChangeResults(Ve);v.open(e);try{let e=new oa;e.onContextLoss(()=>{a.current===e&&(a.current=null),e.dispose()}),v.loadAddon(e),a.current=e}catch{a.current=null}let C=v.textarea;C&&(C.autocomplete=`off`,C.setAttribute(`autocapitalize`,`off`),C.setAttribute(`autocorrect`,`off`),C.spellcheck=!1);let w=ry(v);v.parser.registerCsiHandler({final:`J`},cf),v.parser.registerCsiHandler({prefix:`?`,final:`J`},cf);let T=ly({terminal:v,fitAddon:y,sendResize:(e,t)=>Qe({type:`resize`,cols:e,rows:t}),resizeDebounceMs:80});g.current=Qv({terminalWrite:(e,t)=>v.write(e,t),sendFlowPause:()=>Qe({type:`flow-pause`}),sendFlowResume:()=>Qe({type:`flow-resume`}),captureScrollAnchor:()=>T.captureAnchor(),restoreScrollAnchor:e=>T.restoreAnchor(e),hasScrollRestore:()=>T.hasResizeRestore(),restoreScrollFromResize:()=>T.restoreResizeScroll(),isExited:()=>p.current}),iy(v,{isMac:Pe,getKittyFlags:()=>w.getFlags(),openFindOverlay:()=>qe.current?.(),sendInput:e=>Qe({type:`input`,data:e}),isTouchDevice:Fe}),ay(v);let E=v.onTitleChange(e=>{if(p.current)return;let t=e.trim();t&&(m.current=t,document.title=t||`localterm`)});v.onData(e=>{for(let t of Rd(e,lf))Qe({type:`input`,data:t})}),v.onResize(({cols:e,rows:t})=>Qe({type:`resize`,cols:e,rows:t}));let O=new ResizeObserver(()=>T.scheduleFit());return O.observe(e),T.fitToContainer(),()=>{t=!0,d.current=null,qe.current=null,o.current=null,r.current=null,i.current=null,a.current=null,E.dispose(),x.dispose(),T.cleanupResizeScroll(),u(),O.disconnect(),v.dispose(),document.title=`localterm`}},[]),qP(r,i,oe,ce),JP(r,ye,Ye,pe,he,_e),KP(r,i,a,be),UP(Le,Re,s),kF(c,l),(0,b.useEffect)(()=>{f.current=M},[M]),FP(M);let tt=v!==null,nt=tt||!tt&&C>=2;return VP(v!==null&&v.reason!==`shell-exited`,$e,cd),IP(nt,e),(0,y.jsxs)(`main`,{ref:t,className:`h-dvh w-dvw pt-[env(safe-area-inset-top)] pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)]`,style:{background:Ze},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute inset-0`}),(0,y.jsx)(MP,{exitInfo:v}),(0,y.jsx)(jP,{activeThemeId:V,onThemeChange:Se,onThemePreview:Ce,activeFontId:re,onFontChange:we,onFontPreview:Te,activeLocalFontFamily:ie,onLocalFontChange:Ee,activeFontSize:oe,onFontSizeChange:De,activeLineHeight:ce,onLineHeightChange:Oe,activeCursorStyle:ue,onCursorStyleChange:ke,onCursorStylePreview:Ae,activeCursorBlink:pe,onCursorBlinkChange:je,activeScrollback:he,onScrollbackChange:Me,activeScrollOnUserInput:_e,onScrollOnUserInputChange:Ne,sessionInfo:A,newTabUrl:xe,onOpenSearch:He,isMac:Pe,isSearchOpen:Le}),Le&&(0,y.jsx)(LT,{searchInputRef:s,searchQuery:ze,searchResults:Be,onSearchChange:Ue,onKeyDown:We,onFindNext:()=>Ge(ze),onFindPrevious:()=>Ke(ze),isSearchOpen:Le})]}),(0,y.jsx)(wA,{isModalOpen:nt,exitInfo:v,isRetryingConnection:O,hasCopiedRestartCommand:T,newTabUrl:xe,onReconnect:$e,onCopyRestartCommand:et})]})},PF=()=>{let e=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let t=t=>{e.current||(t.preventDefault(),t.returnValue=``)};return window.addEventListener(`beforeunload`,t),()=>{window.removeEventListener(`beforeunload`,t)}},[]),(0,y.jsx)(NF,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[])})},FF=null,IF=null,LF=()=>FF||(typeof BroadcastChannel>`u`||typeof crypto>`u`||typeof crypto.randomUUID!=`function`?null:(IF=crypto.randomUUID(),FF=new BroadcastChannel(ud),FF.addEventListener(`message`,e=>{let t=e.data,n=ef();t.type===`ping`&&t.tabId!==IF&&t.hue===n&&FF&&IF&&FF.postMessage({type:`claimed`,tabId:IF,hue:n})}),FF));of(),sf(`idle`),(()=>{let e=LF();if(!e||!IF)return()=>{};let t=ef(),n=new Set,r=e=>{let r=e.data;r.type===`claimed`&&r.tabId!==IF&&r.hue===t&&n.add(r.hue)};e.addEventListener(`message`,r),e.postMessage({type:`ping`,tabId:IF,hue:t});let i=setTimeout(()=>{if(e.removeEventListener(`message`,r),n.size===0)return;let i=tf([...n]);i!==t&&(nf(i),sf(`idle`))},250);return()=>{clearTimeout(i),e.removeEventListener(`message`,r),FF?.close(),FF=null,IF=null}})(),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=Nd();if(!e)return;let t=document.createElement(`link`);t.id=xd,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})(),((e=!1)=>{e||typeof navigator>`u`||!(`serviceWorker`in navigator)||navigator.serviceWorker.register(`/sw.js`,{scope:`/`}).catch(e=>{console.warn(`[localterm] service worker registration failed`,e)})})();var RF=document.getElementById(`root`);if(!RF)throw Error(`Root element not found`);(0,x.createRoot)(RF,{onCaughtError(e,t){console.error(`[localterm] React caught error:`,e,t)},onUncaughtError(e,t){console.error(`[localterm] React uncaught error:`,e,t)},onRecoverableError(e,t){console.error(`[localterm] React recoverable error:`,e,t)}}).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(Mj,{delay:300,children:(0,y.jsx)(PF,{})})}));
121
- //# sourceMappingURL=index-Cowmkfwh.js.map
119
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ig(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:zg(t,`input`,e.processors),output:zg(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Lg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Lg(r.element,n);if(r.type===`set`)return Lg(r.valueType,n);if(r.type===`lazy`)return Lg(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Lg(r.innerType,n);if(r.type===`intersection`)return Lg(r.left,n)||Lg(r.right,n);if(r.type===`record`||r.type===`map`)return Lg(r.keyType,n)||Lg(r.valueType,n);if(r.type===`pipe`)return Lg(r.in,n)||Lg(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Lg(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Lg(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Lg(e,n))return!0;return!!(r.rest&&Lg(r.rest,n))}return!1}var Rg=(e,t={})=>n=>{let r=Ng({...n,processors:t});return Pg(e,r),Fg(r,e),Ig(r,e)},zg=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ng({...i??{},target:a,io:t,processors:n});return Pg(e,o),Fg(o,e),Ig(o,e)},Bg={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Vg=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Bg[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Hg=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Ug=(e,t,n,r)=>{n.type=`boolean`},Wg=(e,t,n,r)=>{n.not={}},Gg=(e,t,n,r)=>{let i=e._zod.def,a=vf(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Kg=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},qg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Jg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Yg=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Pg(a.element,t,{...r,path:[...r.path,`items`]})},Xg=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Pg(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Pg(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Zg=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Pg(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qg=(e,t,n,r)=>{let i=e._zod.def,a=Pg(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Pg(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},$g=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Pg(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Pg(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Pg(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},e_=(e,t,n,r)=>{let i=e._zod.def,a=Pg(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},t_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},n_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},r_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},i_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},a_=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Pg(a,t,r);let o=t.seen.get(e);o.ref=a},o_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},s_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},c_=J(`ZodISODateTime`,(e,t)=>{Om.init(e,t),P_.init(e,t)});function l_(e){return eg(c_,e)}var u_=J(`ZodISODate`,(e,t)=>{km.init(e,t),P_.init(e,t)});function d_(e){return tg(u_,e)}var f_=J(`ZodISOTime`,(e,t)=>{Am.init(e,t),P_.init(e,t)});function p_(e){return ng(f_,e)}var m_=J(`ZodISODuration`,(e,t)=>{jm.init(e,t),P_.init(e,t)});function h_(e){return rg(m_,e)}var g_=(e,t)=>{tp.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ip(e,t)},flatten:{value:t=>rp(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yf,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yf,2)}},isEmpty:{get(){return e.issues.length===0}}})};J(`ZodError`,g_);var __=J(`ZodError`,g_,{Parent:Error}),v_=ap(__),y_=op(__),b_=sp(__),x_=lp(__),S_=dp(__),C_=fp(__),w_=pp(__),T_=mp(__),E_=hp(__),D_=gp(__),O_=_p(__),k_=vp(__),A_=J(`ZodType`,(e,t)=>(mm.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:zg(e,`input`),output:zg(e,`output`)}}),e.toJSONSchema=Rg(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Df(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Lf(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>v_(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>b_(e,t,n),e.parseAsync=async(t,n)=>y_(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>x_(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>S_(e,t,n),e.decode=(t,n)=>C_(e,t,n),e.encodeAsync=async(t,n)=>w_(e,t,n),e.decodeAsync=async(t,n)=>T_(e,t,n),e.safeEncode=(t,n)=>E_(e,t,n),e.safeDecode=(t,n)=>D_(e,t,n),e.safeEncodeAsync=async(t,n)=>O_(e,t,n),e.safeDecodeAsync=async(t,n)=>k_(e,t,n),e.refine=(t,n)=>e.check(qv(t,n)),e.superRefine=t=>e.check(Jv(t)),e.overwrite=t=>e.check(Cg(t)),e.optional=()=>kv(e),e.exactOptional=()=>jv(e),e.nullable=()=>Nv(e),e.nullish=()=>kv(Nv(e)),e.nonoptional=t=>zv(e,t),e.array=()=>dv(e),e.or=t=>hv([e,t]),e.and=t=>yv(e,t),e.transform=t=>Uv(e,Dv(t)),e.default=t=>Fv(e,t),e.prefault=t=>Lv(e,t),e.catch=t=>Vv(e,t),e.pipe=t=>Uv(e,t),e.readonly=()=>Gv(e),e.describe=t=>{let n=e.clone();return Ah.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Ah.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Ah.get(e);let n=e.clone();return Ah.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),j_=J(`_ZodString`,(e,t)=>{hm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vg(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(_g(...t)),e.includes=(...t)=>e.check(bg(...t)),e.startsWith=(...t)=>e.check(xg(...t)),e.endsWith=(...t)=>e.check(Sg(...t)),e.min=(...t)=>e.check(hg(...t)),e.max=(...t)=>e.check(mg(...t)),e.length=(...t)=>e.check(gg(...t)),e.nonempty=(...t)=>e.check(hg(1,...t)),e.lowercase=t=>e.check(vg(t)),e.uppercase=t=>e.check(yg(t)),e.trim=()=>e.check(Tg()),e.normalize=(...t)=>e.check(wg(...t)),e.toLowerCase=()=>e.check(Eg()),e.toUpperCase=()=>e.check(Dg()),e.slugify=()=>e.check(Og())}),M_=J(`ZodString`,(e,t)=>{hm.init(e,t),j_.init(e,t),e.email=t=>e.check(Mh(F_,t)),e.url=t=>e.check(Rh(R_,t)),e.jwt=t=>e.check($h($_,t)),e.emoji=t=>e.check(zh(z_,t)),e.guid=t=>e.check(Nh(I_,t)),e.uuid=t=>e.check(Ph(L_,t)),e.uuidv4=t=>e.check(Fh(L_,t)),e.uuidv6=t=>e.check(Ih(L_,t)),e.uuidv7=t=>e.check(Lh(L_,t)),e.nanoid=t=>e.check(Bh(B_,t)),e.guid=t=>e.check(Nh(I_,t)),e.cuid=t=>e.check(Vh(V_,t)),e.cuid2=t=>e.check(Hh(H_,t)),e.ulid=t=>e.check(Uh(U_,t)),e.base64=t=>e.check(Xh(X_,t)),e.base64url=t=>e.check(Zh(Z_,t)),e.xid=t=>e.check(Wh(W_,t)),e.ksuid=t=>e.check(Gh(G_,t)),e.ipv4=t=>e.check(Kh(K_,t)),e.ipv6=t=>e.check(qh(q_,t)),e.cidrv4=t=>e.check(Jh(J_,t)),e.cidrv6=t=>e.check(Yh(Y_,t)),e.e164=t=>e.check(Qh(Q_,t)),e.datetime=t=>e.check(l_(t)),e.date=t=>e.check(d_(t)),e.time=t=>e.check(p_(t)),e.duration=t=>e.check(h_(t))});function N_(e){return jh(M_,e)}var P_=J(`ZodStringFormat`,(e,t)=>{gm.init(e,t),j_.init(e,t)}),F_=J(`ZodEmail`,(e,t)=>{ym.init(e,t),P_.init(e,t)}),I_=J(`ZodGUID`,(e,t)=>{_m.init(e,t),P_.init(e,t)}),L_=J(`ZodUUID`,(e,t)=>{vm.init(e,t),P_.init(e,t)}),R_=J(`ZodURL`,(e,t)=>{bm.init(e,t),P_.init(e,t)}),z_=J(`ZodEmoji`,(e,t)=>{xm.init(e,t),P_.init(e,t)}),B_=J(`ZodNanoID`,(e,t)=>{Sm.init(e,t),P_.init(e,t)}),V_=J(`ZodCUID`,(e,t)=>{Cm.init(e,t),P_.init(e,t)}),H_=J(`ZodCUID2`,(e,t)=>{wm.init(e,t),P_.init(e,t)}),U_=J(`ZodULID`,(e,t)=>{Tm.init(e,t),P_.init(e,t)}),W_=J(`ZodXID`,(e,t)=>{Em.init(e,t),P_.init(e,t)}),G_=J(`ZodKSUID`,(e,t)=>{Dm.init(e,t),P_.init(e,t)}),K_=J(`ZodIPv4`,(e,t)=>{Mm.init(e,t),P_.init(e,t)}),q_=J(`ZodIPv6`,(e,t)=>{Nm.init(e,t),P_.init(e,t)}),J_=J(`ZodCIDRv4`,(e,t)=>{Pm.init(e,t),P_.init(e,t)}),Y_=J(`ZodCIDRv6`,(e,t)=>{Fm.init(e,t),P_.init(e,t)}),X_=J(`ZodBase64`,(e,t)=>{Lm.init(e,t),P_.init(e,t)}),Z_=J(`ZodBase64URL`,(e,t)=>{zm.init(e,t),P_.init(e,t)}),Q_=J(`ZodE164`,(e,t)=>{Bm.init(e,t),P_.init(e,t)}),$_=J(`ZodJWT`,(e,t)=>{Hm.init(e,t),P_.init(e,t)}),ev=J(`ZodNumber`,(e,t)=>{Um.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hg(e,t,n,r),e.gt=(t,n)=>e.check(dg(t,n)),e.gte=(t,n)=>e.check(fg(t,n)),e.min=(t,n)=>e.check(fg(t,n)),e.lt=(t,n)=>e.check(lg(t,n)),e.lte=(t,n)=>e.check(ug(t,n)),e.max=(t,n)=>e.check(ug(t,n)),e.int=t=>e.check(rv(t)),e.safe=t=>e.check(rv(t)),e.positive=t=>e.check(dg(0,t)),e.nonnegative=t=>e.check(fg(0,t)),e.negative=t=>e.check(lg(0,t)),e.nonpositive=t=>e.check(ug(0,t)),e.multipleOf=(t,n)=>e.check(pg(t,n)),e.step=(t,n)=>e.check(pg(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function tv(e){return ig(ev,e)}var nv=J(`ZodNumberFormat`,(e,t)=>{Wm.init(e,t),ev.init(e,t)});function rv(e){return ag(nv,e)}var iv=J(`ZodBoolean`,(e,t)=>{Gm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ug(e,t,n,r)});function av(e){return og(iv,e)}var ov=J(`ZodUnknown`,(e,t)=>{Km.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function sv(){return sg(ov)}var cv=J(`ZodNever`,(e,t)=>{qm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wg(e,t,n,r)});function lv(e){return cg(cv,e)}var uv=J(`ZodArray`,(e,t)=>{Ym.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yg(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(hg(t,n)),e.nonempty=t=>e.check(hg(1,t)),e.max=(t,n)=>e.check(mg(t,n)),e.length=(t,n)=>e.check(gg(t,n)),e.unwrap=()=>e.element});function dv(e,t){return kg(uv,e,t)}var fv=J(`ZodObject`,(e,t)=>{eh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xg(e,t,n,r),Tf(e,`shape`,()=>t.shape),e.keyof=()=>Cv(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sv()}),e.loose=()=>e.clone({...e._zod.def,catchall:sv()}),e.strict=()=>e.clone({...e._zod.def,catchall:lv()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Uf(e,t),e.safeExtend=t=>Wf(e,t),e.merge=t=>Gf(e,t),e.pick=t=>Vf(e,t),e.omit=t=>Hf(e,t),e.partial=(...t)=>Kf(Ov,e,t[0]),e.required=(...t)=>qf(Rv,e,t[0])});function pv(e,t){return new fv({type:`object`,shape:e??{},...Rf(t)})}var mv=J(`ZodUnion`,(e,t)=>{nh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zg(e,t,n,r),e.options=t.options});function hv(e,t){return new mv({type:`union`,options:e,...Rf(t)})}var gv=J(`ZodDiscriminatedUnion`,(e,t)=>{mv.init(e,t),rh.init(e,t)});function _v(e,t,n){return new gv({type:`union`,options:t,discriminator:e,...Rf(n)})}var vv=J(`ZodIntersection`,(e,t)=>{ih.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qg(e,t,n,r)});function yv(e,t){return new vv({type:`intersection`,left:e,right:t})}var bv=J(`ZodRecord`,(e,t)=>{sh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$g(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function xv(e,t,n){return new bv({type:`record`,keyType:e,valueType:t,...Rf(n)})}var Sv=J(`ZodEnum`,(e,t)=>{ch.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gg(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Sv({...t,checks:[],...Rf(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Sv({...t,checks:[],...Rf(r),entries:i})}});function Cv(e,t){return new Sv({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Rf(t)})}var wv=J(`ZodLiteral`,(e,t)=>{lh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kg(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Tv(e,t){return new wv({type:`literal`,values:Array.isArray(e)?e:[e],...Rf(t)})}var Ev=J(`ZodTransform`,(e,t)=>{uh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jg(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new hf(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push($f(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push($f(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Dv(e){return new Ev({type:`transform`,transform:e})}var Ov=J(`ZodOptional`,(e,t)=>{fh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kv(e){return new Ov({type:`optional`,innerType:e})}var Av=J(`ZodExactOptional`,(e,t)=>{ph.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jv(e){return new Av({type:`optional`,innerType:e})}var Mv=J(`ZodNullable`,(e,t)=>{mh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nv(e){return new Mv({type:`nullable`,innerType:e})}var Pv=J(`ZodDefault`,(e,t)=>{hh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Fv(e,t){return new Pv({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pf(t)}})}var Iv=J(`ZodPrefault`,(e,t)=>{_h.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lv(e,t){return new Iv({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pf(t)}})}var Rv=J(`ZodNonOptional`,(e,t)=>{vh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zv(e,t){return new Rv({type:`nonoptional`,innerType:e,...Rf(t)})}var Bv=J(`ZodCatch`,(e,t)=>{bh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>i_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vv(e,t){return new Bv({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Hv=J(`ZodPipe`,(e,t)=>{xh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>a_(e,t,n,r),e.in=t.in,e.out=t.out});function Uv(e,t){return new Hv({type:`pipe`,in:e,out:t})}var Wv=J(`ZodReadonly`,(e,t)=>{Ch.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gv(e){return new Wv({type:`readonly`,innerType:e})}var Kv=J(`ZodCustom`,(e,t)=>{Th.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qg(e,t,n,r)});function qv(e,t={}){return Ag(Kv,e,t)}function Jv(e){return jg(e)}pv({ok:av(),sessions:tv().int().nonnegative()}).strict(),_v(`type`,[pv({type:Tv(`input`),data:N_().max(lf)}).strict(),pv({type:Tv(`resize`),cols:tv().int().positive().max(ff),rows:tv().int().positive().max(pf)}).strict(),pv({type:Tv(`flow-pause`)}).strict(),pv({type:Tv(`flow-resume`)}).strict(),pv({type:Tv(`rpc`),id:N_().min(1).max(64),method:Cv([`spawn_session`,`list_sessions`,`write_input`,`read_output`,`wait_for_boundary`,`exec`]),params:xv(N_(),sv()).optional()}).strict()]),_v(`type`,[pv({type:Tv(`output`),data:N_().max(uf)}).strict(),pv({type:Tv(`exit`),code:tv().int().nullable()}).strict(),pv({type:Tv(`title`),title:N_().max(df)}).strict(),pv({type:Tv(`session`),id:N_(),shell:N_().min(1),shellName:N_().min(1),pid:tv().int().nonnegative(),cwd:N_().min(1)}).strict(),pv({type:Tv(`cwd`),cwd:N_().min(1)}).strict(),pv({type:Tv(`agent-output`),text:N_().max(uf)}).strict(),pv({type:Tv(`command-boundary`),phase:Cv([`prompt-start`,`command-start`,`output-start`,`command-end`]),exitCode:tv().int().optional()}).strict(),pv({type:Tv(`rpc-response`),id:N_().min(1).max(64),result:sv().optional(),error:N_().optional()}).strict()]);var Yv=e=>typeof e==`string`?e.length:e.byteLength,Xv=`cwd`,Zv=(e,t)=>{let n=new URL(`/ws`,window.location.href);n.protocol=n.protocol===`https:`?`wss:`:`ws:`;let r=e??new URLSearchParams(window.location.search).get(Xv);return r&&n.searchParams.set(Xv,r),t&&n.searchParams.set(`sessionId`,t),n.toString()},Qv=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(Xv,e),t.toString()},$v=16384,ey=e=>{let t=0,n=!1,r=t=>{if(e.hasScrollRestore()){e.restoreScrollFromResize();return}t.wasAtBottom&&e.restoreScrollAnchor(t)};return{write:i=>{if(e.isExited())return;let a=Yv(i);if(a>=$v){let o=[],s=0;for(;s<a;){let e=Math.min(s+$v,a);o.push(typeof i==`string`?i.slice(s,e):i.subarray(s,e)),s=e}let c=e.captureScrollAnchor(),l=0,u=()=>{if(l>=o.length)return;let i=o[l];l++,!n&&t>=4&&(e.sendFlowPause(),n=!0),e.terminalWrite(i,()=>{t=Math.max(0,t-1),n&&t<1&&(e.sendFlowResume(),n=!1),l>=o.length?r(c):e.restoreScrollFromResize(),setTimeout(u,0)}),t++};u();return}let o=e.captureScrollAnchor();!n&&t>=4&&(e.sendFlowPause(),n=!0),e.terminalWrite(i,()=>{t=Math.max(0,t-1),n&&t<1&&(e.sendFlowResume(),n=!1),r(o)}),t++},clear:()=>{t=0,n=!1}}},ty=(e,t)=>`\x1b[${e};${t+1}u`,ny=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),ry=(e,t)=>e.key!==`f`&&e.key!==`F`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,iy=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,ay=e=>{let t=[0];return e.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let n=e[0],r=typeof n==`number`?n:1;return t.push(r),!0}),e.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let n=e[0],r=typeof n==`number`&&n>0?n:1;for(let e=0;e<r&&t.length>1;e+=1)t.pop();return!0}),e.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let n=e[0],r=e[1];if(typeof n!=`number`)return!0;let i=n,a=typeof r==`number`&&r>0?r:1,o=t.length-1,s=t[o]??0;return a===1?t[o]=i:a===2?t[o]=s|i:a===3&&(t[o]=s&~i),!0}),{getFlags:()=>t[t.length-1]??0}},oy=(e,t)=>{e.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(ry(e,t.isMac))return e.type===`keydown`&&(e.preventDefault(),t.openFindOverlay()),!1;if(e.type===`keydown`&&e.key===`Enter`){let n=ny(e),r=(t.getKittyFlags()&1)!=0;if(n!==0&&r)return e.preventDefault(),t.sendInput(ty(13,n)),!1;if(n===1)return e.preventDefault(),t.sendInput(`
120
+ `),!1}return!0})},sy=e=>{e.attachCustomWheelEventHandler(t=>iy(t,e)?(t.preventDefault(),!1):!0)},cy=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},ly=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active,r=Math.max(0,n.baseY-t.distanceFromBottom)-n.viewportY;r!==0&&e.scrollLines(r)},uy=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=Math.max(0,t.baseY-r)-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},dy=e=>{let t=null,n=null,r=null,i=()=>cy(e.terminal),a=t=>{ly(e.terminal,t)},o=()=>{r&&window.clearTimeout(r.timer),n!==null&&(window.cancelAnimationFrame(n),n=null),r=null},s=()=>{r&&a(r.anchor)},c=e=>{o(),r={anchor:e,timer:window.setTimeout(()=>{s(),r=null},rd)},n=window.requestAnimationFrame(()=>{n=null,s()})},l=()=>{let t=i();uy(e.terminal,e.fitAddon)&&c(t)};return{captureAnchor:i,restoreAnchor:a,fitToContainer:l,scheduleFit:()=>{t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null,l()},e.resizeDebounceMs)},beginResizeScrollRestore:c,clearResizeScrollRestore:o,restoreResizeScroll:s,hasResizeRestore:()=>r!==null,cleanupResizeScroll:()=>{t!==null&&window.clearTimeout(t),o()}}},fy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),py=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),my=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),hy=e=>{let t=my(e);return t.charAt(0).toUpperCase()+t.slice(1)},gy={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`},_y=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},vy=(0,b.createContext)({}),yy=()=>(0,b.useContext)(vy),by=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=yy()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...gy,width:t??l??gy.width,height:t??l??gy.height,stroke:e??f,strokeWidth:m,className:fy(`lucide`,p,i),...!a&&!_y(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),xy=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)(by,{ref:i,iconNode:t,className:fy(`lucide-${py(hy(e))}`,`lucide-${e}`,n),...r}));return n.displayName=hy(e),n},Sy=xy(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Cy=xy(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),wy=xy(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ty=xy(`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`}]]),Ey=xy(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Dy=xy(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Oy=xy(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),ky=xy(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ay=xy(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),jy=xy(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),My=xy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Ny(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=Ny(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Py(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ny(e))&&(r&&(r+=` `),r+=t);return r}var Fy=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Iy=Py,Ly=(e,t)=>n=>{if(t?.variants==null)return Iy(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=Fy(t)||Fy(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 Iy(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)},Ry=(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},zy=(e,t)=>({classGroupId:e,validator:t}),By=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Vy=`-`,Hy=[],Uy=`arbitrary..`,Wy=e=>{let t=qy(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ky(e);let n=e.split(Vy);return Gy(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ry(i,t):t:i||Hy}return n[e]||Hy}}},Gy=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Gy(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Vy):e.slice(t).join(Vy),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ky=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?Uy+r:void 0})(),qy=e=>{let{theme:t,classGroups:n}=e;return Jy(n,t)},Jy=(e,t)=>{let n=By();for(let r in e){let i=e[r];Yy(i,n,r,t)}return n},Yy=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Xy(i,t,n,r)}},Xy=(e,t,n,r)=>{if(typeof e==`string`){Zy(e,t,n);return}if(typeof e==`function`){Qy(e,t,n,r);return}$y(e,t,n,r)},Zy=(e,t,n)=>{let r=e===``?t:eb(t,e);r.classGroupId=n},Qy=(e,t,n,r)=>{if(tb(e)){Yy(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(zy(n,e))},$y=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Yy(o,eb(t,a),n,r)}},eb=(e,t)=>{let n=e,r=t.split(Vy),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=By(),n.nextPart.set(t,i)),n=i}return n},tb=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,nb=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)}}},rb=`!`,ib=`:`,ab=[],ob=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),sb=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===ib){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(rb)?(c=s.slice(0,-1),l=!0):s.startsWith(rb)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ob(t,l,c,u)};if(t){let e=t+ib,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ob(ab,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},cb=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}},lb=e=>({cache:nb(e.cacheSize),parseClassName:sb(e),sortModifiers:cb(e),...Wy(e)}),ub=/\s+/,db=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(ub),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+rb:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},fb=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=pb(n))&&(i&&(i+=` `),i+=r);return i},pb=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=pb(e[r]))&&(n&&(n+=` `),n+=t);return n},mb=(e,...t)=>{let n,r,i,a,o=o=>(n=lb(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=db(e,n);return i(e,a),a};return a=o,(...e)=>a(fb(...e))},hb=[],gb=e=>{let t=t=>t[e]||hb;return t.isThemeGetter=!0,t},_b=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,vb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,yb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,bb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xb=/\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$/,Sb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Cb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Tb=e=>yb.test(e),Eb=e=>!!e&&!Number.isNaN(Number(e)),Db=e=>!!e&&Number.isInteger(Number(e)),Ob=e=>e.endsWith(`%`)&&Eb(e.slice(0,-1)),kb=e=>bb.test(e),Ab=()=>!0,jb=e=>xb.test(e)&&!Sb.test(e),Mb=()=>!1,Nb=e=>Cb.test(e),Pb=e=>wb.test(e),Fb=e=>!Y(e)&&!X(e),Ib=e=>Zb(e,tx,Mb),Y=e=>_b.test(e),Lb=e=>Zb(e,nx,jb),Rb=e=>Zb(e,rx,Eb),zb=e=>Zb(e,ax,Ab),Bb=e=>Zb(e,ix,Mb),Vb=e=>Zb(e,$b,Mb),Hb=e=>Zb(e,ex,Pb),Ub=e=>Zb(e,ox,Nb),X=e=>vb.test(e),Wb=e=>Qb(e,nx),Gb=e=>Qb(e,ix),Kb=e=>Qb(e,$b),qb=e=>Qb(e,tx),Jb=e=>Qb(e,ex),Yb=e=>Qb(e,ox,!0),Xb=e=>Qb(e,ax,!0),Zb=(e,t,n)=>{let r=_b.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Qb=(e,t,n=!1)=>{let r=vb.exec(e);return r?r[1]?t(r[1]):n:!1},$b=e=>e===`position`||e===`percentage`,ex=e=>e===`image`||e===`url`,tx=e=>e===`length`||e===`size`||e===`bg-size`,nx=e=>e===`length`,rx=e=>e===`number`,ix=e=>e===`family-name`,ax=e=>e===`number`||e===`weight`,ox=e=>e===`shadow`,sx=mb(()=>{let e=gb(`color`),t=gb(`font`),n=gb(`text`),r=gb(`font-weight`),i=gb(`tracking`),a=gb(`leading`),o=gb(`breakpoint`),s=gb(`container`),c=gb(`spacing`),l=gb(`radius`),u=gb(`shadow`),d=gb(`inset-shadow`),f=gb(`text-shadow`),p=gb(`drop-shadow`),m=gb(`blur`),h=gb(`perspective`),g=gb(`aspect`),_=gb(`ease`),v=gb(`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(),X,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[X,Y,c],T=()=>[Tb,`full`,`auto`,...w()],E=()=>[Db,`none`,`subgrid`,X,Y],D=()=>[`auto`,{span:[`full`,Db,X,Y]},Db,X,Y],O=()=>[Db,`auto`,X,Y],k=()=>[`auto`,`min`,`max`,`fr`,X,Y],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=()=>[Tb,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Tb,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Tb,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,X,Y],L=()=>[...b(),Kb,Vb,{position:[X,Y]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],R=()=>[`auto`,`cover`,`contain`,qb,Ib,{size:[X,Y]}],te=()=>[Ob,Wb,Lb],z=()=>[``,`none`,`full`,l,X,Y],B=()=>[``,Eb,Wb,Lb],V=()=>[`solid`,`dashed`,`dotted`,`double`],ne=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],re=()=>[Eb,Ob,Kb,Vb],H=()=>[``,`none`,m,X,Y],ie=()=>[`none`,Eb,X,Y],ae=()=>[`none`,Eb,X,Y],oe=()=>[Eb,X,Y],se=()=>[Tb,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[kb],breakpoint:[kb],color:[Ab],container:[kb],"drop-shadow":[kb],ease:[`in`,`out`,`in-out`],font:[Fb],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[kb],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[kb],shadow:[kb],spacing:[`px`,Eb],text:[kb],"text-shadow":[kb],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Tb,Y,X,g]}],container:[`container`],columns:[{columns:[Eb,Y,X,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:[Db,`auto`,X,Y]}],basis:[{basis:[Tb,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Eb,Tb,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,Eb,X,Y]}],shrink:[{shrink:[``,Eb,X,Y]}],order:[{order:[Db,`first`,`last`,`none`,X,Y]}],"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`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],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,Wb,Lb]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Xb,zb]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Ob,Y]}],"font-family":[{font:[Gb,Bb,t]}],"font-features":[{"font-features":[Y]}],"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,X,Y]}],"line-clamp":[{"line-clamp":[Eb,`none`,X,Rb]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,X,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,X,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[Eb,`from-font`,`auto`,X,Lb]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Eb,`auto`,X,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,X,Y]}],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`,X,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:R()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Db,X,Y],radial:[``,X,Y],conic:[Db,X,Y]},Jb,Hb]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Eb,X,Y]}],"outline-w":[{outline:[``,Eb,Wb,Lb]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Yb,Ub]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Yb,Ub]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Eb,Lb]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Yb,Ub]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Eb,X,Y]}],"mix-blend":[{"mix-blend":[...ne(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ne()}],"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":[Eb]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[X,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":[Eb]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,X,Y]}],filter:[{filter:[``,`none`,X,Y]}],blur:[{blur:H()}],brightness:[{brightness:[Eb,X,Y]}],contrast:[{contrast:[Eb,X,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Yb,Ub]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Eb,X,Y]}],"hue-rotate":[{"hue-rotate":[Eb,X,Y]}],invert:[{invert:[``,Eb,X,Y]}],saturate:[{saturate:[Eb,X,Y]}],sepia:[{sepia:[``,Eb,X,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,X,Y]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[Eb,X,Y]}],"backdrop-contrast":[{"backdrop-contrast":[Eb,X,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Eb,X,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Eb,X,Y]}],"backdrop-invert":[{"backdrop-invert":[``,Eb,X,Y]}],"backdrop-opacity":[{"backdrop-opacity":[Eb,X,Y]}],"backdrop-saturate":[{"backdrop-saturate":[Eb,X,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,Eb,X,Y]}],"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`,X,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Eb,`initial`,X,Y]}],ease:[{ease:[`linear`,`initial`,_,X,Y]}],delay:[{delay:[Eb,X,Y]}],animate:[{animate:[`none`,v,X,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,X,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":[`scale-3d`],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[X,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"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`,X,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"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`,X,Y]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Eb,Wb,Lb,Rb]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{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`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function cx(...e){return sx(Py(e))}function lx(){return typeof window<`u`}function ux(e){return px(e)?(e.nodeName||``).toLowerCase():`#document`}function dx(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fx(e){return((px(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function px(e){return lx()?e instanceof Node||e instanceof dx(e).Node:!1}function mx(e){return lx()?e instanceof Element||e instanceof dx(e).Element:!1}function hx(e){return lx()?e instanceof HTMLElement||e instanceof dx(e).HTMLElement:!1}function gx(e){return!lx()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof dx(e).ShadowRoot}function _x(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ox(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function vx(e){return/^(table|td|th)$/.test(ux(e))}function yx(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var bx=/transform|translate|scale|rotate|perspective|filter/,xx=/paint|layout|strict|content/,Sx=e=>!!e&&e!==`none`,Cx;function wx(e){let t=mx(e)?Ox(e):e;return Sx(t.transform)||Sx(t.translate)||Sx(t.scale)||Sx(t.rotate)||Sx(t.perspective)||!Ex()&&(Sx(t.backdropFilter)||Sx(t.filter))||bx.test(t.willChange||``)||xx.test(t.contain||``)}function Tx(e){let t=Ax(e);for(;hx(t)&&!Dx(t);){if(wx(t))return t;if(yx(t))return null;t=Ax(t)}return null}function Ex(){return Cx??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Cx}function Dx(e){return/^(html|body|#document)$/.test(ux(e))}function Ox(e){return dx(e).getComputedStyle(e)}function kx(e){return mx(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ax(e){if(ux(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||gx(e)&&e.host||fx(e);return gx(t)?t.host:t}function jx(e){let t=Ax(e);return Dx(t)?e.ownerDocument?e.ownerDocument.body:e.body:hx(t)&&_x(t)?t:jx(t)}function Mx(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=jx(e),i=r===e.ownerDocument?.body,a=dx(r);if(i){let e=Nx(a);return t.concat(a,a.visualViewport||[],_x(r)?r:[],e&&n?Mx(e):[])}else return t.concat(r,Mx(r,[],n))}function Nx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Px={};function Fx(e,t){let n=b.useRef(Px);return n.current===Px&&(n.current=e(t)),n}var Ix=b[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Lx=Ix&&Ix!==b.useLayoutEffect?Ix:e=>e();function Z(e){let t=Fx(Rx).current;return t.next=e,Lx(t.effect),t.trampoline}function Rx(){let e={next:void 0,callback:zx,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function zx(){}var Bx={...b},Q=typeof document<`u`?b.useLayoutEffect:()=>{};function Vx(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var Hx={};function Ux(e,t,n,r,i){if(!n&&!r&&!i&&!e)return Gx(t);let a=Gx(e);return t&&(a=Kx(a,t)),n&&(a=Kx(a,n)),r&&(a=Kx(a,r)),i&&(a=Kx(a,i)),a}function Wx(e){if(e.length===0)return Hx;if(e.length===1)return Gx(e[0]);let t=Gx(e[0]);for(let n=1;n<e.length;n+=1)t=Kx(t,e[n]);return t}function Gx(e){return Xx(e)?{...Zx(e,Hx)}:qx(e)}function Kx(e,t){return Xx(t)?Zx(t,e):Jx(e,t)}function qx(e){let t={...e};for(let e in t){let n=t[e];Yx(e,n)&&(t[e]=$x(n))}return t}function Jx(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Vx(e.style,r);break;case`className`:e[n]=tS(e.className,r);break;default:Yx(n,r)?e[n]=Qx(e[n],r):e[n]=r}}return e}function Yx(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function Xx(e){return typeof e==`function`}function Zx(e,t){return Xx(e)?e(t):e??Hx}function Qx(e,t){return t?e?(...n)=>{let r=n[0];if(nS(r)){let i=r;eS(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:$x(t):e}function $x(e){return e&&((...t)=>{let n=t[0];return nS(n)&&eS(n),e(...t)})}function eS(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function tS(e,t){return t?e?t+` `+e:t:e}function nS(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function rS(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var iS=rS(`https://base-ui.com/production-error`,`Base UI`),aS=b.createContext(void 0);function oS(e=!1){let t=b.useContext(aS);if(t===void 0&&!e)throw Error(iS(16));return t}function sS(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:b.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function cS(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=b.useRef(null),s=oS(!0),c=a??s!==void 0,{props:l}=sS({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=b.useCallback(()=>{let e=o.current;lS(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Q(u,[u]),{getButtonProps:b.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Ux({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(eS(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=lS(a),l=!i&&uS(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(eS(e),a?.(e),e.target===e.currentTarget&&i&&c&&lS(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function lS(e){return hx(e)&&e.tagName===`BUTTON`}function uS(e){return!!(e?.tagName===`A`&&e?.href)}function dS(e,t,n,r){let i=Fx(pS).current;return mS(i,e,t,n,r)&&gS(i,[e,t,n,r]),i.callback}function fS(e){let t=Fx(pS).current;return hS(t,e)&&gS(t,e),t.callback}function pS(){return{callback:null,cleanup:null,refs:[]}}function mS(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function hS(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function gS(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var _S=19;function vS(e){return _S>=e}function yS(e){if(!b.isValidElement(e))return null;let t=e,n=t.props;return(vS(19)?n?.ref:t.ref)??null}function bS(){}var xS=Object.freeze([]),SS=Object.freeze({});function CS(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function wS(e,t){return typeof e==`function`?e(t):e}function TS(e,t){return typeof e==`function`?e(t):e}function ES(e,t,n={}){let r=t.render,i=DS(t,n);return n.enabled===!1?null:AS(e,r,i,n.state??SS)}function DS(e,t={}){let{className:n,style:r,render:i}=e,{state:a=SS,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?wS(n,a):void 0,d=l?TS(r,a):void 0,f=l?CS(a,c):SS,p=l&&s?OS(s):void 0,m=l?Vx(f,p)??{}:SS;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=fS([m.ref,yS(i),...o]):m.ref=dS(m.ref,yS(i),o):dS(null,null)),l?(u!==void 0&&(m.className=tS(m.className,u)),d!==void 0&&(m.style=Vx(m.style,d)),m):SS}function OS(e){return Array.isArray(e)?Wx(e):Ux(void 0,e)}var kS=Symbol.for(`react.lazy`);function AS(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Ux(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===kS&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,e)}if(e&&typeof e==`string`)return jS(e,n);throw Error(iS(8))}function jS(e,t){return e===`button`?(0,b.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,b.createElement)(`img`,{alt:``,...t,key:t.key}):b.createElement(e,t)}var MS=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=cS({disabled:i,focusableWhenDisabled:a,native:o});return ES(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),NS=Ly(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,lg:`h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function PS({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,y.jsx)(MS,{"data-slot":`button`,className:cx(NS({variant:t,size:n,className:e})),...r})}var FS=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),IS={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},LS={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},RS={disabled:!1,...LS},zS={valid(e){return e===null?null:e?{[FS.valid]:``}:{[FS.invalid]:``}}},BS=b.createContext({invalid:void 0,name:void 0,validityData:{state:IS,errors:[],error:``,value:``,initialValue:null},setValidityData:bS,disabled:void 0,touched:LS.touched,setTouched:bS,dirty:LS.dirty,setDirty:bS,filled:LS.filled,setFilled:bS,focused:LS.focused,setFocused:bS,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:RS,markedDirtyRef:{current:!1},registerFieldControl:bS,validation:{getValidationProps:(e=SS)=>e,getInputValidationProps:(e=SS)=>e,inputRef:{current:null},commit:async()=>{}}});function VS(e=!0){let t=b.useContext(BS);if(t.setValidityData===bS&&!e)throw Error(iS(28));return t}var HS=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:bS,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function US(){return b.useContext(HS)}var WS=0;function GS(e,t=`mui`){let[n,r]=b.useState(e),i=e||n;return b.useEffect(()=>{n??(WS+=1,r(`${t}-${WS}`))},[n,t]),i}var KS=Bx.useId;function qS(e,t){if(KS!==void 0){let n=KS();return e??(t?`${t}-${n}`:n)}return GS(e,t)}function JS(e){return qS(e,`base-ui`)}var YS=b.createContext({controlId:void 0,registerControlId:bS,labelId:void 0,setLabelId:bS,messageIds:[],setMessageIds:bS,getDescriptionProps:e=>e});function XS(){return b.useContext(YS)}function ZS(e,t,n,r=!0,i){let[a,o]=b.useState(),s=JS(i?`${i}-label`:void 0),c=e??t??a;return Q(()=>{let i=e||t||!r?void 0:QS(n.current,s);a!==i&&o(i)}),c}function QS(e,t){let n=$S(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function $S(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function eC(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=XS(),o=JS(t),s=n?i:void 0,c=Fx(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=Z(()=>{!l.current||a===bS||(l.current=!1,a(c.current,void 0))});return Q(()=>{if(a===bS)return;let e;if(n){let n=r?.current;e=mx(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),b.useEffect(()=>d,[d]),i??o}function tC(e){return e?.ownerDocument||document}var nC=typeof navigator<`u`,rC=fC(),iC=mC(),aC=pC(),oC=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),sC=rC.platform===`MacIntel`&&rC.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(rC.platform);nC&&/firefox/i.test(aC);var cC=nC&&/apple/i.test(navigator.vendor);nC&&/Edg/i.test(aC);var lC=nC&&/android/i.test(iC)||/android/i.test(aC),uC=nC&&iC.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,dC=aC.includes(`jsdom/`);function fC(){if(!nC)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function pC(){if(!nC)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function mC(){if(!nC)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var hC=`data-base-ui-focusable`,gC=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,_C=`ArrowLeft`,vC=`ArrowRight`,yC=`ArrowUp`,bC=`ArrowDown`;function xC(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function SC(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&gx(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function CC(e){return`composedPath`in e?e.composedPath()[0]:e.target}function wC(e,t){if(!mx(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(SC(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function TC(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function EC(e){return e.matches(`html,body`)}function DC(e){return hx(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function OC(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${gC}`)!=null}function kC(e){return e?e.getAttribute(`role`)===`combobox`&&DC(e):!1}function AC(e){if(!e||dC)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function jC(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function MC(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...MC(e,t.id,n)])}function NC(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function PC(e){e.preventDefault(),e.stopPropagation()}function FC(e){return`nativeEvent`in e}function IC(e){return e.pointerType===``&&e.isTrusted?!0:lC&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function LC(e){return dC?!1:!lC&&e.width===0&&e.height===0||lC&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function RC(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function zC(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var BC=[`top`,`right`,`bottom`,`left`],VC=Math.min,HC=Math.max,UC=Math.round,WC=Math.floor,GC=e=>({x:e,y:e}),KC={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function qC(e,t,n){return HC(e,VC(t,n))}function JC(e,t){return typeof e==`function`?e(t):e}function YC(e){return e.split(`-`)[0]}function XC(e){return e.split(`-`)[1]}function ZC(e){return e===`x`?`y`:`x`}function QC(e){return e===`y`?`height`:`width`}function $C(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ew(e){return ZC($C(e))}function tw(e,t,n){n===void 0&&(n=!1);let r=XC(e),i=ew(e),a=QC(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=uw(o)),[o,uw(o)]}function nw(e){let t=uw(e);return[rw(e),t,rw(t)]}function rw(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var iw=[`left`,`right`],aw=[`right`,`left`],ow=[`top`,`bottom`],sw=[`bottom`,`top`];function cw(e,t,n){switch(e){case`top`:case`bottom`:return n?t?aw:iw:t?iw:aw;case`left`:case`right`:return t?ow:sw;default:return[]}}function lw(e,t,n,r){let i=XC(e),a=cw(YC(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(rw)))),a}function uw(e){let t=YC(e);return KC[t]+e.slice(t.length)}function dw(e){return{top:0,right:0,bottom:0,left:0,...e}}function fw(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:dw(e)}function pw(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function mw(e,t,n){return Math.floor(e/t)!==n}function hw(e,t){return t<0||t>=e.length}function gw(e,t){return vw(e.current,{disabledIndices:t})}function _w(e,t){return vw(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function vw(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Cw(e,a,r));return a}function yw(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!Cw(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=WC(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!Cw(e,r,s))return r}};d&&PC(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=vw(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=vw(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}hw(e,f)&&(f=u)}if(n===`both`){let n=WC(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&PC(t),u%o===o-1?r&&(f=vw(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=vw(e,{startingIndex:u,disabledIndices:s}),r&&mw(f,o,n)&&(f=vw(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),mw(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&PC(t),u%o===0?r&&(f=vw(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=vw(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&mw(f,o,n)&&(f=vw(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),mw(f,o,n)&&(f=u));let c=WC(l/o)===n;hw(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:vw(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function bw(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function xw(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function Sw(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Cw(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?Tw(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function ww(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Tw(e,t=e?Ox(e):null){return!e||!e.isConnected||!t||ww(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Ew=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Dw(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return gx(n)?n.host:null}function Ow(e){for(let t of Array.from(e.children))if(ux(t)===`summary`)return t;return null}function kw(e,t){let n=Ow(t);return!!n&&(e===n||SC(n,e))}function Aw(e){let t=e?ux(e):``;return e!=null&&e.matches(Ew)&&(t!==`summary`||e.parentElement!=null&&ux(e.parentElement)===`details`&&Ow(e.parentElement)===e)&&(t!==`details`||Ow(e)==null)&&(t!==`input`||e.type!==`hidden`)}function jw(e){if(!Aw(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Dw(t)){let n=t!==e,r=ux(t)===`slot`;if(t.hasAttribute(`inert`)||n&&ux(t)===`details`&&!t.open&&!kw(e,t)||t.hasAttribute(`hidden`)||!r&&!Mw(t,n))return!1}return!0}function Mw(e,t){let n=Ox(e);return t?n.display!==`none`:Tw(e,n)}function Nw(e){let t=e.tabIndex;if(t<0){let t=ux(e);if(t===`details`||t===`audio`||t===`video`||hx(e)&&e.isContentEditable)return 0}return t}function Pw(e){if(ux(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Fw(e,t){let n=Pw(e);if(!n)return!0;let r=t.find(e=>{let t=Pw(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Pw(e);return t?.name===n.name&&t.form===n.form})===n}function Iw(e){if(hx(e)&&ux(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return hx(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Lw(e,t){Iw(e).forEach(e=>{Aw(e)&&t.push(e),Lw(e,t)})}function Rw(e,t,n){Iw(e).forEach(e=>{hx(e)&&e.matches(t)&&n.push(e),Rw(e,t,n)})}function zw(e){return jw(e)&&Nw(e)>=0}function Bw(e){let t=[];return Lw(e,t),t.filter(jw)}function Vw(e){let t=Bw(e);return t.filter(e=>Nw(e)>=0&&Fw(e,t))}function Hw(e,t){let n=Vw(e),r=n.length;if(r===0)return;let i=xC(tC(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Uw(e){return Hw(tC(e).body,1)||e}function Ww(e){return Hw(tC(e).body,-1)||e}function Gw(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!SC(n,r)}function Kw(e){Vw(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function qw(e){let t=[];Rw(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Jw=[];function Yw(e){b.useEffect(e,Jw)}var Xw=0,Zw=class e{static create(){return new e}currentId=Xw;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Xw,t()},e)}isStarted(){return this.currentId!==Xw}clear=()=>{this.currentId!==Xw&&(clearTimeout(this.currentId),this.currentId=Xw)};disposeEffect=()=>this.clear};function Qw(){let e=Fx(Zw.create).current;return Yw(e.disposeEffect),e}var $w=null;globalThis.requestAnimationFrame;var eT=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},tT=class e{static create(){return new e}static request(e){return eT.request(e)}static cancel(e){return eT.cancel(e)}currentId=$w;request(e){this.cancel(),this.currentId=eT.request(()=>{this.currentId=$w,e()})}cancel=()=>{this.currentId!==$w&&(eT.cancel(this.currentId),this.currentId=$w)};disposeEffect=()=>this.cancel};function nT(){let e=Fx(tT.create).current;return Yw(e.disposeEffect),e}function rT(e){return e==null?e:`current`in e?e.current:e}var iT=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),aT={[iT.startingStyle]:``},oT={[iT.endingStyle]:``},sT={transitionStatus(e){return e===`starting`?aT:e===`ending`?oT:null}},cT=c(g());function lT(e,t=!1,n=!0){let r=nT();return Z((i,a=null)=>{r.cancel();let o=rT(e);if(o==null)return;let s=o,c=()=>{cT.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=iT.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function uT(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Z(i),o=lT(r,n,!1);b.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function dT(e,t=!1,n=!1){let[r,i]=b.useState(e&&t?`idle`:void 0),[a,o]=b.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Q(()=>{if(!e&&a&&r!==`ending`&&n){let e=tT.request(()=>{i(`ending`)});return()=>{tT.cancel(e)}}},[e,a,r,n]),Q(()=>{if(!e||t)return;let n=tT.request(()=>{i(void 0)});return()=>{tT.cancel(n)}},[t,e]),Q(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=tT.request(()=>{i(`idle`)});return()=>{tT.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function fT({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=b.useRef(e!==void 0),[a,o]=b.useState(t);return[i?e:a,b.useCallback(e=>{i||o(e)},[])]}function pT(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=VS(),s=b.useRef(null);s.current||=Symbol(),Q(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}var mT=`none`,hT=`trigger-press`,gT=`trigger-hover`,_T=`trigger-focus`,vT=`outside-press`,yT=`item-press`,bT=`close-press`,xT=`focus-out`,ST=`escape-key`,CT=`list-navigation`,wT=`cancel-open`,TT=`disabled`,ET=`imperative-action`,DT=`window-resize`;function OT(e,t,n,r){let i=!1,a=!1,o=r??SS;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var kT=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:x,validationMode:S,validation:C}=VS(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=XS(),O=eC({id:i});Q(()=>{let e=o!=null;C.inputRef.current?.value||e&&o!==``?x(!0):e&&o===``&&x(!1)},[C.inputRef,x,o]);let k=b.useRef(null);Q(()=>{u&&k.current===xC(tC(k.current))&&y(!0)},[u,y]);let[A]=fT({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=Z(()=>C.inputRef.current?.value);return pT(C.inputRef,{id:O,value:M,getValue:N}),ES(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:C.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,OT(mT,e.nativeEvent)),_(t!==v.initialValue),x(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),S===`onBlur`&&C.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),f],stateAttributesMapping:zS})}),AT=b.forwardRef(function(e,t){return(0,y.jsx)(kT,{ref:t,...e})});function jT({className:e,type:t,...n}){return(0,y.jsx)(AT,{type:t,"data-slot":`input`,className:cx(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function MT({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:cx(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 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 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 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 NT=Ly(`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-1 has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:-mr-1 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 PT({className:e,align:t=`inline-start`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:cx(NT({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var FT=Ly(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function IT({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,y.jsx)(PS,{type:t,"data-size":r,variant:n,className:cx(FT({size:r}),e),...i})}function LT({className:e,...t}){return(0,y.jsx)(`span`,{className:cx(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function RT({className:e,...t}){return(0,y.jsx)(jT,{"data-slot":`input-group-control`,className:cx(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}var zT=({searchInputRef:e,searchQuery:t,searchResults:n,onSearchChange:r,onKeyDown:i,onFindNext:a,onFindPrevious:o})=>{let s=n.resultCount===0?`0/0`:`${n.resultIndex+1}/${n.resultCount}`;return(0,y.jsxs)(MT,{role:`search`,"aria-label":`find in terminal`,className:`absolute top-2 right-3 z-10 w-[min(20rem,calc(100vw-1.5rem))] border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(RT,{ref:e,type:`search`,value:t,onChange:r,onKeyDown:i,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(PT,{align:`inline-end`,children:[(0,y.jsx)(LT,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:s}),(0,y.jsx)(IT,{size:`icon-xs`,onClick:o,disabled:n.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(wy,{})}),(0,y.jsx)(IT,{size:`icon-xs`,onClick:a,disabled:n.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(Cy,{})})]})]})};function BT(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}function VT(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var HT={},UT={},WT=``;function GT(e){if(typeof document>`u`)return!1;let t=tC(e);return dx(t).innerWidth-t.documentElement.clientWidth>0}function KT(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=tC(e),n=t.documentElement,r=t.body,i=_x(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function qT(e){let t=tC(e),n=t.documentElement,r=t.body,i=_x(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function JT(e){let t=tC(e),n=t.documentElement,r=t.body,i=dx(n),a=0,o=0,s=!1,c=tT.create();if(oC&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,HT={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},WT=n.style.scrollBehavior,UT={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=_x(n)?n:r;if(s=KT(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,HT),Object.assign(r.style,UT),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=WT)}function d(){u(),c.request(l)}l();let f=VT(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var YT=new class{lockCount=0;restore=null;timeoutLock=Zw.create();timeoutUnlock=Zw.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=tC(e).documentElement,n=dx(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=bS;return}let r=sC||!GT(e);this.restore=r?qT(e):JT(e)}};function XT(e=!0,t=null){Q(()=>{if(e)return YT.acquire(t)},[e,t])}function ZT(e,t){return t!=null&&!RC(t)?0:typeof e==`function`?e():e}function QT(e,t,n){let r=ZT(e,n);return typeof r==`number`?r:r?.[t]}function $T(e){return typeof e==`function`?e():e}function eE(e,t){return t||e===`click`||e===`mousedown`}var tE=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Zw,currentIdRef:{current:null},currentContextRef:{current:null}});function nE(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=b.useRef(n),a=b.useRef(n),o=b.useRef(null),s=b.useRef(null),c=Qw();return(0,y.jsx)(tE.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function rE(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{open:i}=t,{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=b.useContext(tE),[f,p]=b.useState(!1);return Q(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!i&&a.current===r){if(p(!1),s){let t=r;return d.start(s,()=>{n.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[i,r,a,o,s,c,l,d,n]),Q(()=>{if(!i)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:n.setOpen,setIsInstantPhase:p},a.current=r,o.current={open:0,close:QT(c.current,`close`)},t!==null&&t!==r?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,OT(mT))):(p(!1),e?.setIsInstantPhase(!1))},[i,r,n,a,o,s,c,l,d]),Q(()=>()=>{l.current=null},[l]),b.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function iE(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function aE(e){let t=Fx(oE,e).current;return t.next=e,Q(t.effect),t}function oE(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var sE={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},cE={...sE,position:`fixed`,top:0,left:0},lE={...sE,position:`absolute`},uE=b.forwardRef(function(e,t){let[n,r]=b.useState();Q(()=>{cC&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,y.jsx)(`span`,{...e,ref:t,style:cE,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})});function dE(e){return`data-base-ui-${e}`}var fE=0;function pE(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(fE);let a=()=>e?.focus({preventScroll:n});if(i)return a(),bS;let o=requestAnimationFrame(a);return fE=o,()=>{fE===o&&(cancelAnimationFrame(o),fE=0)}}var mE={inert:new WeakMap,"aria-hidden":new WeakMap},hE=`data-base-ui-inert`,gE={inert:new WeakSet,"aria-hidden":new WeakSet},_E=new WeakMap,vE=0;function yE(e){return gE[e]}function bE(e){return e?gx(e)?e.host:bE(e.parentNode):null}var xE=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=bE(t);return e.contains(n)?n:null}).filter(e=>e!=null),SE=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},CE=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{ux(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function wE(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=xE(t,e),u=i?xE(t,a):[],d=new Set(u),f=i?CE(t,SE(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=mE[o],n=yE(o);c=n,s=e;let r=xE(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);CE(t,SE(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(_E.get(e)||0)+1;_E.set(e,t),m.push(e),t===1&&e.setAttribute(hE,``)}),vE+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(_E.get(e)||0)-1;_E.set(e,t),t||e.removeAttribute(hE)}),--vE,vE||(mE.inert=new WeakMap,mE[`aria-hidden`]=new WeakMap,gE.inert=new WeakSet,gE[`aria-hidden`]=new WeakSet,_E=new WeakMap)}}function TE(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=tC(e[0]).body;return wE(e,o,n,r,{mark:i,markerIgnoreElements:a})}var EE={style:{transition:`none`}},DE=`data-base-ui-click-trigger`,OE={fallbackAxisSide:`none`},kE={fallbackAxisSide:`end`},AE={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},jE=b.createContext(null),ME=()=>b.useContext(jE),NE=dE(`portal`);function PE(e={}){let{ref:t,container:n,componentProps:r=SS,elementProps:i}=e,a=qS(),o=ME()?.portalNode,[s,c]=b.useState(null),[l,u]=b.useState(null),d=Z(e=>{e!==null&&u(e)}),f=b.useRef(null);Q(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(px(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=ES(`div`,r,{ref:[t,d],props:[{id:a,[NE]:``},i]});return{portalNode:l,portalSubtree:s&&p?cT.createPortal(p,s):null}}var FE=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,style:s,...c}=e,{portalNode:l,portalSubtree:u}=PE({container:r,ref:t,componentProps:e,elementProps:c}),d=b.useRef(null),f=b.useRef(null),p=b.useRef(null),m=b.useRef(null),[h,g]=b.useState(null),_=b.useRef(!1),v=h?.modal,x=h?.open,S=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;b.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&Gw(e)&&(e.type===`focusin`?_.current&&=(qw(l),!1):(Kw(l),_.current=!0))}return iE(VT(l,`focusin`,e,!0),VT(l,`focusout`,e,!0))},[l,v]),b.useEffect(()=>{!l||x!==!1||(qw(l),_.current=!1)},[x,l]);let C=b.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,y.jsxs)(b.Fragment,{children:[u,(0,y.jsxs)(jE.Provider,{value:C,children:[S&&l&&(0,y.jsx)(uE,{"data-type":`outside`,ref:d,onFocus:e=>{Gw(e,l)?p.current?.focus():Ww(h?h.domReference:null)?.focus()}}),S&&l&&(0,y.jsx)(`span`,{"aria-owns":l.id,style:AE}),l&&cT.createPortal(n,l),S&&l&&(0,y.jsx)(uE,{"data-type":`outside`,ref:f,onFocus:e=>{Gw(e,l)?m.current?.focus():(Uw(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,OT(`focus-out`,e.nativeEvent)))}})]})]})});function IE(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var LE=b.createContext(null),RE=b.createContext(null),zE=()=>b.useContext(LE)?.id||null,BE=e=>{let t=b.useContext(RE);return e??t};function VE(e,t){let n=dx(CC(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var HE=20,UE=[];function WE(){UE=UE.filter(e=>e.deref()?.isConnected)}function GE(e){WE(),e&&ux(e)!==`body`&&(UE.push(new WeakRef(e)),UE.length>HE&&(UE=UE.slice(-HE)))}function KE(){return WE(),UE[UE.length-1]?.deref()}function qE(e){return e?zw(e)?e:Vw(e)[0]||e:null}function JE(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=Bw(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return zw(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function YE(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:x,dataRef:S}=h.context,C=Z(()=>S.current.floatingContext?.nodeId),w=i===!1,T=kC(_)&&w,E=b.useRef([`content`]),D=aE(i),O=aE(a),k=aE(l),A=BE(p),j=ME(),M=b.useRef(!1),N=b.useRef(!1),P=b.useRef(!1),F=b.useRef(null),I=b.useRef(``),L=b.useRef(``),ee=b.useRef(null),R=b.useRef(null),te=dS(ee,f,j?.beforeInsideRef),z=dS(R,j?.afterInsideRef),B=Qw(),V=Qw(),ne=nT(),re=j!=null,H=jC(v),ie=Z((e=H)=>e?Vw(e):[]),ae=Z(()=>m?.().filter(e=>e!=null)??[]);b.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&SC(H,xC(tC(H)))&&ie().length===0&&!T&&PC(e)}return VT(tC(H),`keydown`,e)},[r,_,H,s,E,T,ie]),b.useEffect(()=>{if(r||!g)return;let e=tC(H);function t(){P.current=!1}function n(e){let t=CC(e),n=ae();P.current=!(SC(v,t)||SC(_,t)||SC(j?.portalNode,t)||n.some(e=>e===t||SC(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(N.current=!0)}function i(){L.current=`keyboard`}return iE(VT(e,`pointerdown`,n,!0),VT(e,`pointerup`,t,!0),VT(e,`pointercancel`,t,!0),VT(e,`keydown`,i,!0))},[r,v,_,H,g,j,ae]),b.useEffect(()=>{if(r||!c)return;let e=tC(H);function t(){N.current=!0,V.start(0,()=>{N.current=!1})}function n(e){let t=CC(e);zw(t)&&(F.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=CC(t);queueMicrotask(()=>{let a=C(),c=h.context.triggerElements,l=ae(),f=n?.hasAttribute(dE(`focus-guard`))&&[ee.current,R.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,rT(d),rT(u)].includes(n),p=!(SC(_,n)||SC(v,n)||SC(n,v)||SC(j?.portalNode,n)||l.some(e=>e===n||SC(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>SC(e,n))||f||A&&(MC(A.nodesRef.current,a).find(e=>SC(e.context?.elements.floating,n)||SC(e.context?.elements.domReference,n))||NC(A.nodesRef.current,a).find(e=>[e.context?.elements.floating,jC(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&H&&JE(H,E),o&&r!==_&&!Tw(i)&&xC(e)===e.body){if(hx(H)&&(H.focus(),o===`popup`)){ne.request(()=>{H.focus()});return}let e=ie(),t=F.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||H;hx(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(T||!s)&&n&&p&&!N.current&&(T||n!==KE())&&(M.current=!0,h.setOpen(!1,OT(xT,t)))})}function a(){P.current||(S.current.insideReactTree=!0,B.start(0,()=>{S.current.insideReactTree=!1}))}let l=hx(_)?_:null;if(!(!v&&!l))return iE(l&&VT(l,`focusout`,i),l&&VT(l,`pointerdown`,t),v&&VT(v,`focusin`,n),v&&VT(v,`focusout`,i),v&&j&&VT(v,`focusout`,a,!0))},[r,_,v,H,s,A,j,h,c,o,ie,T,C,E,S,B,V,ne,u,d,ae]),b.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${dE(`portal`)}]`)||[]),t=(A?NC(A.nodesRef.current,C()):[]).find(e=>kC(e.context?.elements.domReference||null))?.context?.elements.domReference,n=TE([...[v,...e,ee.current,R.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...ae()],t,rT(d),rT(u),T?_:null].filter(e=>e!=null),{ariaHidden:s||T,mark:!1}),i=TE([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,E,j,T,A,C,u,d,ae]),Q(()=>{if(!g||r||!hx(H))return;let e=xC(tC(H));queueMicrotask(()=>{let t=D.current,n=typeof t==`function`?t(k.current||``):t;if(n===void 0||n===!1||SC(H,e))return;let r=null,i=()=>(r??=ie(H),r[0]||H),a;a=n===!0||n===null?i():rT(n),a||=i(),pE(a,{preventScroll:a===H})})},[r,g,H,w,ie,D,k]),Q(()=>{if(r||!H)return;let e=tC(H);GE(xC(e));function t(e){if(e.open||(I.current=VE(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(M.current=!0),e.reason===`outside-press`)if(e.nested)M.current=!1;else if(IC(e.nativeEvent)||LC(e.nativeEvent))M.current=!1;else{let e=!1;tC(H).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?M.current=!1:M.current=!0}}x.on(`openchange`,t);function n(){let e=O.current,t=typeof e==`function`?e(I.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=_||KE();return e&&e.isConnected?e:null}let n=_||KE();return rT(t)||n||null}return()=>{x.off(`openchange`,t);let r=xC(e),i=ae(),a=SC(v,r)||i.some(e=>e===r||SC(e,r))||A&&MC(A.nodesRef.current,C(),!1).some(e=>SC(e.context?.elements.floating,r)),o=O.current,s=n();queueMicrotask(()=>{let t=qE(s),n=typeof o!=`boolean`;o&&!M.current&&hx(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),M.current=!1})}},[r,v,H,O,S,x,A,_,C,ae]),Q(()=>{if(!oC||g||!v)return;let e=xC(tC(v));!hx(e)||!DC(e)||SC(v,e)&&e.blur()},[g,v]),Q(()=>{if(!(r||!j))return j.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{j.setFocusManagerState(null)}},[r,j,s,g,h,c,_]),Q(()=>{if(!(r||!H))return JE(H,E),()=>{queueMicrotask(WE)}},[r,H,E]);let oe=!r&&(s?!T:!0)&&(re||s);return(0,y.jsxs)(b.Fragment,{children:[oe&&(0,y.jsx)(uE,{"data-type":`inside`,ref:te,onFocus:e=>{if(s){let e=ie();pE(e[e.length-1])}else j?.portalNode&&(M.current=!1,Gw(e,j.portalNode)?Uw(_)?.focus():rT(d??j.beforeOutsideRef)?.focus())}}),n,oe&&(0,y.jsx)(uE,{"data-type":`inside`,ref:z,onFocus:e=>{s?pE(ie()[0]):j?.portalNode&&(c&&(M.current=!0),Gw(e,j.portalNode)?Ww(_)?.focus():rT(u??j.afterOutsideRef)?.focus())}})]})}function XE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=hT}=t,d=b.useRef(void 0),f=nT(),p=Qw(),m=b.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||RC(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=CC(i);if(DC(y)){let e=OT(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=OT(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(RC(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||zC(f))),g=OT(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return b.useMemo(()=>i?{reference:m}:SS,[i,m])}function ZE(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function QE(e){return e!=null&&e.clientX!=null}function $E(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`}=t,l=b.useRef(!1),u=b.useRef(null),[d,f]=b.useState(),[p,m]=b.useState([]),h=Z((e,t,r)=>{l.current||o.current.openEvent&&!QE(o.current.openEvent)||n.set(`positionReference`,ZE(r??a,{x:e,y:t,axis:c,dataRef:o,pointerType:d}))}),g=Z(e=>{r?u.current||m([]):h(e.clientX,e.clientY,e.currentTarget)}),_=RC(d)?i:r,v=b.useCallback(()=>{if(!_||!s)return;let e=dx(i);function t(e){SC(i,CC(e))?(u.current?.(),u.current=null):h(e.clientX,e.clientY)}if(!o.current.openEvent||QE(o.current.openEvent))return u.current=VT(e,`mousemove`,t),()=>{u.current?.(),u.current=null};n.set(`positionReference`,a)},[_,s,i,o,a,n,h]);b.useEffect(()=>v(),[v,p]),b.useEffect(()=>{s&&!i&&(l.current=!1)},[s,i]),b.useEffect(()=>{!s&&r&&(l.current=!0)},[s,r]);let y=b.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return b.useMemo(()=>s?{reference:y,trigger:y}:{},[s,y])}var eD={intentional:`onClick`,sloppy:`onPointerDown`};function tD(){return!1}function nD(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function rD(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`sloppy`,referencePress:u=tD,referencePressEvent:d=`sloppy`,bubbles:f,externalTree:p}=t,m=BE(p),h=Z(typeof c==`function`?c:()=>!1),g=typeof c==`function`?h:c,_=g!==!1,v=Z(()=>l),y=b.useRef(!1),x=b.useRef(!1),S=b.useRef(!1),{escapeKey:C,outsidePress:w}=nD(f),T=b.useRef(null),E=Qw(),D=Qw(),O=Z(()=>{D.clear(),a.current.insideReactTree=!1}),k=b.useRef(!1),A=b.useRef(``),j=Z(u),M=Z(e=>{if(!r||!o||!s||e.key!==`Escape`||k.current)return;let t=a.current.floatingContext?.nodeId,i=m?MC(m.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let c=OT(ST,FC(e)?e.nativeEvent:e);n.setOpen(!1,c),!C&&!c.isPropagationAllowed&&e.stopPropagation()}),N=Z(()=>{a.current.insideReactTree=!0,D.start(0,O)});b.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=C,a.current.__outsidePressBubbles=w;let e=new Zw,t=new Zw;function c(){e.clear(),k.current=!0}function l(){e.start(Ex()?5:0,()=>{k.current=!1})}function u(){S.current=!0,t.start(0,()=>{S.current=!1})}function d(){y.current=!1,x.current=!1}function f(){let e=A.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function p(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=a.current.floatingContext?.nodeId,r=m&&MC(m.nodesRef.current,t).some(t=>TC(e,t.context?.elements.floating));return TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`))||r}function b(e){if(p(e)){O();return}if(a.current.insideReactTree){O();return}let r=CC(e),i=`[${dE(`inert`)}]`,o=mx(r)?r.getRootNode():null,s=Array.from((gx(o)?o:tC(n.select(`floatingElement`))).querySelectorAll(i)),c=n.context.triggerElements;if(r&&(c.hasElement(r)||c.hasMatchingElement(e=>SC(e,r))))return;let l=mx(r)?r:null;for(;l&&!Dx(l);){let e=Ax(l);if(Dx(e)||!mx(e))break;l=e}if(s.length&&mx(r)&&!EC(r)&&!SC(r,n.select(`floatingElement`))&&s.every(e=>!SC(l,e)))return;if(hx(r)&&!(`touches`in e)){let t=Dx(r),n=Ox(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}if(h(e))return;if(f()===`intentional`&&S.current){t.clear(),S.current=!1;return}if(typeof g==`function`&&!g(e))return;let u=a.current.floatingContext?.nodeId,d=m?MC(m.nodesRef.current,u):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,OT(vT,e)),O()}function D(e){f()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!o||TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`))||b(e)}function j(e){if(f()!==`sloppy`||!n.select(`open`)||!o||TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function N(e,t){let n=CC(e);if(!n)return;let r=VT(n,e.type,()=>{t(e),r()})}function P(e){A.current=`touch`,N(e,j)}function F(e){E.clear(),e.type===`pointerdown`&&(A.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&N(e,e=>{e.type===`pointerdown`?D(e):b(e)})}function I(e){if(!y.current)return;let n=x.current;if(d(),f()===`intentional`){if(e.type===`pointercancel`){n&&u();return}if(!h(e)){if(n){u();return}typeof g==`function`&&!g(e)||(t.clear(),S.current=!0,O())}}}function L(e){if(f()!==`sloppy`||!T.current||TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(b(e),E.clear(),T.current=null)}function ee(e){N(e,L)}function R(e){f()!==`sloppy`||!T.current||TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&b(e),E.clear(),T.current=null)}function te(e){N(e,R)}let z=tC(i),B=iE(s&&iE(VT(z,`keydown`,M),VT(z,`compositionstart`,c),VT(z,`compositionend`,l)),_&&iE(VT(z,`click`,F,!0),VT(z,`pointerdown`,F,!0),VT(z,`pointerup`,I,!0),VT(z,`pointercancel`,I,!0),VT(z,`mousedown`,F,!0),VT(z,`mouseup`,I,!0),VT(z,`touchstart`,P,!0),VT(z,`touchmove`,ee,!0),VT(z,`touchend`,te,!0)));return()=>{B(),e.clear(),t.clear(),d(),S.current=!1}},[a,i,s,_,g,r,o,C,w,M,O,v,m,n,E]),b.useEffect(O,[g,O]);let P=b.useMemo(()=>({onKeyDown:M,[eD[d]]:e=>{j()&&n.setOpen(!1,OT(hT,e.nativeEvent))},...d!==`intentional`&&{onClick(e){j()&&n.setOpen(!1,OT(`trigger-press`,e.nativeEvent))}}}),[M,n,d,j]),F=Z(e=>{if(!r||!o||e.button!==0)return;let t=CC(e.nativeEvent);SC(n.select(`floatingElement`),t)&&(y.current||(y.current=!0,x.current=!1))}),I=Z(e=>{!r||!o||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&y.current&&(x.current=!0)}),L=b.useMemo(()=>({onKeyDown:M,onPointerDown:I,onMouseDown:I,onClickCapture:N,onMouseDownCapture(e){N(),F(e)},onPointerDownCapture(e){N(),F(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,F,I]);return b.useMemo(()=>o?{reference:P,floating:L,trigger:P}:{},[o,P,L])}function iD(e,t,n){let{reference:r,floating:i}=e,a=$C(t),o=ew(t),s=QC(o),c=YC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(XC(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function aD(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=JC(t,e),p=fw(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=pw(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=pw(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var oD=50,sD=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:aD},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=iD(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<oD&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=iD(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},cD=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=JC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=YC(r),_=$C(o),v=YC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[uw(o)]:nw(o)),x=p!==`none`;!d&&x&&b.push(...lw(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=tw(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==$C(t))||T.every(e=>$C(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=$C(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function lD(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uD(e){return BC.some(t=>e[t]>=0)}var dD=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=JC(e,t);switch(i){case`referenceHidden`:{let e=lD(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uD(e)}}}case`escaped`:{let e=lD(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:uD(e)}}}default:return{}}}}},fD=new Set([`left`,`top`]);async function pD(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=YC(n),s=XC(n),c=$C(n)===`y`,l=fD.has(o)?-1:1,u=a&&c?-1:1,d=JC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var mD=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await pD(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},hD=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=JC(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=$C(YC(i)),p=ZC(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=qC(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=qC(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},gD=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=JC(e,t),u={x:n,y:r},d=$C(i),f=ZC(d),p=u[f],m=u[d],h=JC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=fD.has(YC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},_D=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=JC(e,t),u=await o.detectOverflow(t,l),d=YC(i),f=XC(i),p=$C(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=VC(h-u[g],v),x=VC(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=HC(u.left,0),t=HC(u.right,0),n=HC(u.top,0),r=HC(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:HC(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:HC(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function vD(e){let t=Ox(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=hx(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=UC(n)!==a||UC(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function yD(e){return mx(e)?e:e.contextElement}function bD(e){let t=yD(e);if(!hx(t))return GC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=vD(t),o=(a?UC(n.width):n.width)/r,s=(a?UC(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var xD=GC(0);function SD(e){let t=dx(e);return!Ex()||!t.visualViewport?xD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function CD(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==dx(e)?!1:t}function wD(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=yD(e),o=GC(1);t&&(r?mx(r)&&(o=bD(r)):o=bD(e));let s=CD(a,n,r)?SD(a):GC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=dx(a),t=r&&mx(r)?dx(r):r,n=e,i=Nx(n);for(;i&&r&&t!==n;){let e=bD(i),t=i.getBoundingClientRect(),r=Ox(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=dx(i),i=Nx(n)}}return pw({width:u,height:d,x:c,y:l})}function TD(e,t){let n=kx(e).scrollLeft;return t?t.left+n:wD(fx(e)).left+n}function ED(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-TD(e,n),y:n.top+t.scrollTop}}function DD(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=fx(r),s=t?yx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=GC(1),u=GC(0),d=hx(r);if((d||!d&&!a)&&((ux(r)!==`body`||_x(o))&&(c=kx(r)),d)){let e=wD(r);l=bD(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ED(o,c):GC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function OD(e){return Array.from(e.getClientRects())}function kD(e){let t=fx(e),n=kx(e),r=e.ownerDocument.body,i=HC(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=HC(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+TD(e),s=-n.scrollTop;return Ox(r).direction===`rtl`&&(o+=HC(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var AD=25;function jD(e,t){let n=dx(e),r=fx(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ex();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=TD(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=AD&&(a-=o)}else l<=AD&&(a+=l);return{width:a,height:o,x:s,y:c}}function MD(e,t){let n=wD(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=hx(e)?bD(e):GC(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ND(e,t,n){let r;if(t===`viewport`)r=jD(e,n);else if(t===`document`)r=kD(fx(e));else if(mx(t))r=MD(t,n);else{let n=SD(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pw(r)}function PD(e,t){let n=Ax(e);return n===t||!mx(n)||Dx(n)?!1:Ox(n).position===`fixed`||PD(n,t)}function FD(e,t){let n=t.get(e);if(n)return n;let r=Mx(e,[],!1).filter(e=>mx(e)&&ux(e)!==`body`),i=null,a=Ox(e).position===`fixed`,o=a?Ax(e):e;for(;mx(o)&&!Dx(o);){let t=Ox(o),n=wx(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||_x(o)&&!n&&PD(e,o))?r=r.filter(e=>e!==o):i=t,o=Ax(o)}return t.set(e,r),r}function ID(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?yx(t)?[]:FD(t,this._c):[].concat(n),r],o=ND(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ND(t,a[e],i);s=HC(n.top,s),c=VC(n.right,c),l=VC(n.bottom,l),u=HC(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function LD(e){let{width:t,height:n}=vD(e);return{width:t,height:n}}function RD(e,t,n){let r=hx(t),i=fx(t),a=n===`fixed`,o=wD(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=GC(0);function l(){c.x=TD(i)}if(r||!r&&!a)if((ux(t)!==`body`||_x(i))&&(s=kx(t)),r){let e=wD(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?ED(i,s):GC(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function zD(e){return Ox(e).position===`static`}function BD(e,t){if(!hx(e)||Ox(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return fx(e)===n&&(n=n.ownerDocument.body),n}function VD(e,t){let n=dx(e);if(yx(e))return n;if(!hx(e)){let t=Ax(e);for(;t&&!Dx(t);){if(mx(t)&&!zD(t))return t;t=Ax(t)}return n}let r=BD(e,t);for(;r&&vx(r)&&zD(r);)r=BD(r,t);return r&&Dx(r)&&zD(r)&&!wx(r)?n:r||Tx(e)||n}var HD=async function(e){let t=this.getOffsetParent||VD,n=this.getDimensions,r=await n(e.floating);return{reference:RD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function UD(e){return Ox(e).direction===`rtl`}var WD={convertOffsetParentRelativeRectToViewportRelativeRect:DD,getDocumentElement:fx,getClippingRect:ID,getOffsetParent:VD,getElementRects:HD,getClientRects:OD,getDimensions:LD,getScale:bD,isElement:mx,isRTL:UD};function GD(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function KD(e,t){let n=null,r,i=fx(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=WC(d),h=WC(i.clientWidth-(u+f)),g=WC(i.clientHeight-(d+p)),_=WC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:HC(0,VC(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!GD(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function qD(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=yD(e),u=i||a?[...l?Mx(l):[],...t?Mx(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?KD(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?wD(e):null;c&&g();function g(){let t=wD(e);h&&!GD(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var JD=mD,YD=hD,XD=cD,ZD=_D,QD=dD,$D=gD,eO=(e,t,n)=>{let r=new Map,i={platform:WD,...n},a={...i.platform,_c:r};return sD(e,t,{...i,platform:a})},tO=typeof document<`u`?b.useLayoutEffect:function(){};function nO(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!nO(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!nO(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function rO(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iO(e,t){let n=rO(e);return Math.round(t*n)/n}function aO(e){let t=b.useRef(e);return tO(()=>{t.current=e}),t}function oO(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);nO(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=aO(c),O=aO(i),k=aO(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),eO(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!nO(T.current,t)&&(T.current=t,cT.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);tO(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);tO(()=>(j.current=!0,()=>{j.current=!1}),[]),tO(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),P=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=iO(N.floating,u.x),r=iO(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...rO(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var sO=(e,t)=>{let n=JD(e);return{name:n.name,fn:n.fn,options:[e,t]}},cO=(e,t)=>{let n=YD(e);return{name:n.name,fn:n.fn,options:[e,t]}},lO=(e,t)=>({fn:$D(e).fn,options:[e,t]}),uO=(e,t)=>{let n=XD(e);return{name:n.name,fn:n.fn,options:[e,t]}},dO=(e,t)=>{let n=ZD(e);return{name:n.name,fn:n.fn,options:[e,t]}},fO=(e,t)=>{let n=QD(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(iS(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},pO=o((e=>{var t=f();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),mO=o(((e,t)=>{t.exports=pO()})),hO=o((e=>{var t=f(),n=mO();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),gO=o(((e,t)=>{t.exports=hO()})),_O=[],vO=void 0;function yO(){return vO}function bO(e){_O.push(e)}function xO(e){let t=(t,n)=>{let r=Fx(CO).current,i;try{vO=r;for(let e of _O)e.before(r);i=e(t,n);for(let e of _O)e.after(r);r.didInitialize=!0}finally{vO=void 0}return i};return t.displayName=e.displayName||e.name,t}function SO(e){return b.forwardRef(xO(e))}function CO(){return{didInitialize:!1}}var wO=mO(),TO=gO(),EO=vS(19)?kO:AO;function DO(e,t,n,r,i){return EO(e,t,n,r,i)}function OO(e,t,n,r,i){let a=b.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,wO.useSyncExternalStore)(e.subscribe,a,a)}bO({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,wO.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function kO(e,t,n,r,i){let a=yO();if(!a)return OO(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function AO(e,t,n,r,i){return(0,TO.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var jO=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return DO(this,e,t,n,r)}},MO=class extends jO{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){b.useDebugValue(e),Q(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;Q(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Q(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){b.useDebugValue(e);let n=t!==void 0;Q(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return b.useDebugValue(e),DO(this,this.selectors[e],t,n,r)}useContextCallback(e,t){b.useDebugValue(e);let n=Z(t??bS);this.context[e]=n}useStateSetter(e){let t=b.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},NO={open:$(e=>e.open),transitionStatus:$(e=>e.transitionStatus),domReferenceElement:$(e=>e.domReferenceElement),referenceElement:$(e=>e.positionReference??e.referenceElement),floatingElement:$(e=>e.floatingElement),floatingId:$(e=>e.floatingId)},PO=class extends MO{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:IE(),nested:n,triggerElements:i},NO),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&zC(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function FO(e,t){let n=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function IO(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=FO(e,n),o=Z(t=>{if(a(t),!t||!n.select(`open`))return;let i=n.select(`activeTriggerId`);if(i===e){n.update({activeTriggerElement:t,...r});return}i??n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return Q(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function LO(e){let t=e.useState(`open`);Q(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function RO(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=dT(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=Z(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return uT({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var zO=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function BO(){return new PO({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new zO,floatingId:``,syncOnly:!1,nested:!1,onOpenChange:void 0})}function VO(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:BO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:SS,inactiveTriggerProps:SS,popupProps:SS}}var HO=$(e=>e.triggerIdProp??e.activeTriggerId),UO={open:$(e=>e.openProp??e.open),mounted:$(e=>e.mounted),transitionStatus:$(e=>e.transitionStatus),floatingRootContext:$(e=>e.floatingRootContext),preventUnmountingOnClose:$(e=>e.preventUnmountingOnClose),payload:$(e=>e.payload),activeTriggerId:HO,activeTriggerElement:$(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:$((e,t)=>t!==void 0&&HO(e)===t),isOpenedByTrigger:$((e,t)=>t!==void 0&&HO(e)===t&&e.open),isMountedByTrigger:$((e,t)=>t!==void 0&&HO(e)===t&&e.mounted),triggerProps:$((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:$(e=>e.popupProps),popupElement:$(e=>e.popupElement),positionerElement:$(e=>e.positionerElement)};function WO(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=qS(),a=zE()!=null,o=Fx(()=>new PO({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new zO,floatingId:i,syncOnly:!1,nested:a})).current;return Q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=mx(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function GO(e={}){let{nodeId:t,externalTree:n}=e,r=WO(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=b.useState(null),c=b.useRef(null),l=BE(n);Q(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=oO({...e,elements:{...a,...o&&{reference:o}}}),d=b.useCallback(e=>{let t=mx(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=b.useState(void 0),[m,h]=b.useState(null);i.useSyncedValue(`referenceElement`,f??null);let g=mx(f)?f:null;i.useSyncedValue(`domReferenceElement`,f===void 0?a.domReference:g),i.useSyncedValue(`floatingElement`,m);let _=b.useCallback(e=>{(mx(e)||e===null)&&(c.current=e,p(e)),(mx(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!mx(e))&&u.refs.setReference(e)},[u.refs,p]),v=b.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),y=b.useMemo(()=>({...u.refs,setReference:_,setFloating:v,setPositionReference:d,domReference:c}),[u.refs,_,v,d]),x=b.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),S=i.useState(`open`),C=i.useState(`floatingId`),w=b.useMemo(()=>({...u,dataRef:i.context.dataRef,open:S,onOpenChange:i.setOpen,events:i.context.events,floatingId:C,refs:y,elements:x,nodeId:t,rootStore:i}),[u,y,x,t,i,S,C]);return Q(()=>{i.context.dataRef.current.floatingContext=w;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=w)}),b.useMemo(()=>({...u,context:w,refs:y,elements:x,rootStore:i}),[u,y,x,w,i])}function KO(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=qS(),a=zE()!=null,o=t.useState(`open`),s=t.useState(`activeTriggerElement`),c=t.useState(n?`popupElement`:`positionerElement`),l=t.context.triggerElements,u=Fx(()=>new PO({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:c,triggerElements:l,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return Q(()=>{let e={open:o,floatingId:i,referenceElement:s,floatingElement:c};mx(s)&&(e.domReferenceElement=s),u.state.positionReference===u.state.referenceElement&&(e.positionReference=s),u.update(e)},[o,i,s,c,u]),u.context.onOpenChange=r,u.context.nested=a,u}var qO=uC&&cC;function JO(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=b.useRef(!1),c=b.useRef(null),l=Qw(),u=b.useRef(!0);b.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=dx(e);function r(){let e=n.select(`domReferenceElement`);!n.select(`open`)&&hx(e)&&e===xC(tC(e))&&(s.current=!0)}function i(){u.current=!0}function o(){u.current=!1}return iE(VT(t,`blur`,r),qO&&VT(t,`keydown`,i,!0),qO&&VT(t,`pointerdown`,o,!0))},[n,a]),b.useEffect(()=>{if(!a)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=n.select(`domReferenceElement`);mx(e)&&(c.current=e,s.current=!0)}}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a,n]);let d=b.useMemo(()=>({onMouseLeave(){s.current=!1,c.current=null},onFocus(e){let t=e.currentTarget;if(s.current){if(c.current===t)return;s.current=!1,c.current=null}let r=CC(e.nativeEvent);if(mx(r)){if(qO&&!e.relatedTarget){if(!u.current&&!DC(r))return}else if(!AC(r))return}let i=wC(e.relatedTarget,n.context.triggerElements),{nativeEvent:a,currentTarget:d}=e,f=typeof o==`function`?o():o;if(n.select(`open`)&&i||f===0||f===void 0){n.setOpen(!0,OT(_T,a,d));return}l.start(f,()=>{s.current||n.setOpen(!0,OT(_T,a,d))})},onBlur(e){s.current=!1,c.current=null;let t=e.relatedTarget,r=e.nativeEvent,a=mx(t)&&t.hasAttribute(dE(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let e=n.select(`domReferenceElement`),o=xC(tC(e));!t&&o===e||SC(i.current.floatingContext?.refs.floating.current,o)||SC(e,o)||a||wC(t??o,n.context.triggerElements)||n.setOpen(!1,OT(_T,r))})}}),[i,n,l,o]);return b.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}var YO=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Zw,this.restTimeout=new Zw,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},XO=new WeakMap;function ZO(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&XO.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),XO.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function QO(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=XO.get(n);a&&a!==e&&ZO(a),ZO(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,XO.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function $O(e){let t=Fx(YO.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||=t,Yw(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function ek(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,nodeId:l}=t,u=$O(n),d=BE(),f=zE(),p=Z(()=>eE(o.current.openEvent?.type,u.interactedInside)),m=Z(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),h=Z(e=>wC(e,n.context.triggerElements)),g=b.useCallback(e=>{let t=QT(c,`close`,u.pointerType),r=()=>{n.setOpen(!1,OT(gT,e)),d?.events.emit(`floating.closed`,e)};t?u.openChangeTimeout.start(t,r):(u.openChangeTimeout.clear(),r())},[c,n,u,d]),_=Z(()=>{ZO(u)}),v=Z(e=>{let t=CC(e);if(!OC(t)){u.interactedInside=!1;return}u.interactedInside=t?.closest(`[aria-haspopup]`)!=null});Q(()=>{r||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,_())},[r,u,_]),b.useEffect(()=>_,[_]),Q(()=>{if(s&&r&&u.handleCloseOptions?.blockPointerEvents&&m()&&mx(a)&&i){let e=a,t=i,n=tC(i),r=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),QO(u,{scopeElement:u.handleCloseOptions?.getScope?.()??u.pointerEventsScopeElement??r??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{_()}}},[s,r,a,i,u,m,d,f,_]);let y=Qw();b.useEffect(()=>{if(!s)return;function e(){u.openChangeTimeout.clear(),y.clear(),d?.events.off(`floating.closed`,r),_()}function t(e){if(d&&f&&MC(d.nodesRef.current,f).length>0){d.events.on(`floating.closed`,r);return}if(h(e.relatedTarget))return;let t=o.current.floatingContext?.nodeId??l,n=e.relatedTarget;if(!(d&&t&&mx(n)&&MC(d.nodesRef.current,t,!1).some(e=>SC(e.context?.elements.floating,n)))){if(u.handler){u.handler(e);return}_(),p()||g(e)}}function r(e){!d||!f||MC(d.nodesRef.current,f).length>0||y.start(0,()=>{d.events.off(`floating.closed`,r),n.setOpen(!1,OT(gT,e)),d.events.emit(`floating.closed`,e)})}let a=i;return iE(a&&VT(a,`mouseenter`,e),a&&VT(a,`mouseleave`,t),a&&VT(a,`pointerdown`,v,!0),()=>{d?.events.off(`floating.closed`,r)})},[s,i,n,o,l,p,h,g,_,v,u,d,f,y])}var tk={current:null};function nk(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=tk,externalTree:f,isActiveTrigger:p=!0,getHandleCloseContext:m,isClosing:h}=t,g=BE(f),_=$O(n),v=b.useRef(!1),y=aE(s),x=aE(o),S=aE(l),C=aE(a),w=aE(h);p&&(_.handleCloseOptions=y.current?.__options);let T=Z(()=>eE(r.current.openEvent?.type,_.interactedInside)),E=Z(e=>wC(e,n.context.triggerElements)),D=Z((e,t,r)=>{let i=n.context.triggerElements;if(i.hasElement(t))return!e||!SC(e,t);if(!mx(r))return!1;let a=r;return i.hasMatchingElement(e=>SC(e,a))&&(!e||!SC(e,a))}),O=Z((e,t=!0)=>{let r=QT(x.current,`close`,_.pointerType);r?_.openChangeTimeout.start(r,()=>{n.setOpen(!1,OT(gT,e)),g?.events.emit(`floating.closed`,e)}):t&&(_.openChangeTimeout.clear(),n.setOpen(!1,OT(gT,e)),g?.events.emit(`floating.closed`,e))}),k=Z(()=>{_.handler&&=(tC(n.select(`domReferenceElement`)).removeEventListener(`mousemove`,_.handler),void 0)}),A=Z(()=>{ZO(_)});return b.useEffect(()=>k,[k]),b.useEffect(()=>{if(!a)return;function e(e){e.open?v.current=!1:(v.current=e.reason===gT,k(),_.openChangeTimeout.clear(),_.restTimeout.clear(),_.blockMouseMove=!0,_.restTimeoutPending=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,_,k]),b.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!mx(e))return;function t(e){if(_.openChangeTimeout.clear(),_.blockMouseMove=!1,c&&!RC(_.pointerType))return;let t=$T(S.current),r=QT(x.current,`open`,_.pointerType),i=CC(e),a=e.currentTarget??null,o=n.select(`domReferenceElement`),s=a;if(mx(i)&&!n.context.triggerElements.hasElement(i)){for(let e of n.context.triggerElements.elements())if(SC(e,i)){s=e;break}}mx(a)&&mx(o)&&!n.context.triggerElements.hasElement(a)&&SC(a,o)&&(s=o);let l=s==null?!1:D(o,s,i),u=n.select(`open`),d=w.current?.()??n.select(`transitionStatus`)===`ending`,f=!u&&d&&v.current,p=!l&&mx(s)&&mx(o)&&SC(o,s)&&f,m=t>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){n.setOpen(!0,OT(gT,e,s));return}m||(r?_.openChangeTimeout.start(r,()=>{g&&n.setOpen(!0,OT(gT,e,s))}):g&&n.setOpen(!0,OT(gT,e,s)))}function i(e){if(T()){A();return}k();let t=tC(n.select(`domReferenceElement`));_.restTimeout.clear(),_.restTimeoutPending=!1;let i=r.current.floatingContext??m?.();if(!E(e.relatedTarget)){if(y.current&&i){n.select(`open`)||_.openChangeTimeout.clear();let r=d.current;_.handler=y.current({...i,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!T()&&r===n.select(`domReferenceElement`)&&O(e,!0)}}),t.addEventListener(`mousemove`,_.handler),_.handler(e);return}(_.pointerType!==`touch`||!SC(n.select(`floatingElement`),e.relatedTarget))&&O(e)}}return u?iE(VT(e,`mousemove`,t,{once:!0}),VT(e,`mouseenter`,t),VT(e,`mouseleave`,i)):iE(VT(e,`mouseenter`,t),VT(e,`mouseleave`,i))},[k,A,r,x,O,n,a,y,_,p,D,T,E,c,u,S,d,g,C,m,w]),b.useMemo(()=>{if(!a)return;function e(e){_.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.select(`open`),o=D(i,r,e.target);if(c&&!RC(_.pointerType))return;if(a&&o&&_.handleCloseOptions?.blockPointerEvents){let e=n.select(`floatingElement`);e&&QO(_,{scopeElement:_.handleCloseOptions?.getScope?.()??r.ownerDocument.body,referenceElement:r,floatingElement:e})}let s=$T(S.current);if(a&&!o||s===0||!o&&_.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;_.restTimeout.clear();function l(){if(_.restTimeoutPending=!1,T())return;let e=n.select(`open`);!_.blockMouseMove&&(!e||o)&&n.setOpen(!0,OT(gT,t,r))}_.pointerType===`touch`?cT.flushSync(()=>{l()}):o&&a?l():(_.restTimeoutPending=!0,_.restTimeout.start(s,l))}}},[a,_,T,D,c,n,S])}function rk(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=b.useCallback(t=>ik(t,e,`reference`),t),o=b.useCallback(t=>ik(t,e,`floating`),n),s=b.useCallback(t=>ik(t,e,`item`),r),c=b.useCallback(t=>ik(t,e,`trigger`),i);return b.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function ik(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[hC]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&ak(a,s,i,r)}return ak(a,e,i,r),a}function ak(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var ok=`Escape`;function sk(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function ck(e,t){return sk(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function lk(e,t,n){return sk(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function uk(e,t,n){return sk(t,n?e===_C:e===vC,e===bC)}function dk(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===ok:sk(t,n?e===vC:e===_C,e===yC)}function fk(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:C,cols:w=1,id:T,resetOnPointerLeave:E=!0,externalTree:D}=t,O=aE(jC(i)),k=zE(),A=BE(D);Q(()=>{o.current.orientation=S},[o,S]);let j=kC(a),M=b.useRef(_),N=b.useRef(d??-1),P=b.useRef(null),F=b.useRef(!0),I=Z(e=>{l(N.current===-1?null:N.current,e)}),L=b.useRef(I),ee=b.useRef(!!i),R=b.useRef(r),te=b.useRef(!1),z=b.useRef(!1),B=b.useRef(null),V=aE(x),ne=aE(r),re=aE(d),H=aE(E),ie=Z(()=>{function e(e){g?A?.events.emit(`virtualfocus`,e):B.current=pE(e,{sync:te.current,preventScroll:!0})}let t=s.current[N.current],n=z.current;t&&e(t),(te.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[N.current]||t;r&&(t||e(r),se&&(n||!F.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Q(()=>{u&&(r&&i?(N.current=d??-1,M.current&&d!=null&&(z.current=!0,I())):ee.current&&(N.current=-1,L.current()))},[u,r,i,d,I]),Q(()=>{if(u){if(!r){te.current=!1;return}if(i)if(c==null){if(te.current=!1,re.current!=null)return;if(ee.current&&(N.current=-1,ie()),(!R.current||!ee.current)&&M.current&&(P.current!=null||M.current===!0&&P.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(N.current=P.current==null||lk(P.current,S,h)||m?gw(s):_w(s),P.current=null,I())};t()}}else hw(s.current,c)||(N.current=c,ie(),z.current=!1)}},[u,r,i,c,re,m,s,S,h,I,ie,V]),Q(()=>{if(!u||i||!A||g||!ee.current)return;let e=A.nodesRef.current,t=e.find(e=>e.id===k)?.context?.elements.floating,n=xC(tC(i)),r=e.some(e=>e.context&&SC(e.context.elements.floating,n));t&&!r&&F.current&&t.focus({preventScroll:!0})},[u,i,A,k,g]),Q(()=>{L.current=I,R.current=r,ee.current=!!i}),Q(()=>{r||(P.current=null,M.current=_)},[r,_]);let ae=c!=null,oe=Z(e=>{if(!ne.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&(N.current!==t||c!==t)&&(N.current=t,I(e))}),se=b.useMemo(()=>({onFocus(e){te.current=!0,oe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){te.current=!0,z.current=!1,v&&oe(e)},onPointerLeave(e){if(!ne.current||!F.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!(!v||s.current.includes(t))&&H.current&&(B.current?.(),B.current=null,N.current=-1,I(e),!g)){let e=O.current,t=xC(tC(e));e&&SC(e,t)&&e.focus({preventScroll:!0})}}}),[oe,ne,O,v,s,I,H,g]),ce=b.useCallback(()=>C??A?.nodesRef.current.find(e=>e.id===k)?.context?.dataRef?.current.orientation,[k,A,C]),le=Z(e=>{if(F.current=!1,te.current=!0,e.which===229||!ne.current&&e.currentTarget===O.current)return;if(m&&dk(e.key,S,h,w)){ck(e.key,ce())||PC(e),n.setOpen(!1,OT(CT,e.nativeEvent)),hx(a)&&(g?A?.events.emit(`virtualfocus`,a):a.focus());return}let t=N.current,i=gw(s,x),o=_w(s,x);if(j||(e.key===`Home`&&(PC(e),N.current=i,I(e)),e.key===`End`&&(PC(e),N.current=o,I(e))),w>1){let t=Array.from({length:s.current.length},()=>({width:1,height:1})),n=bw(t,w,!1),r=n.findIndex(e=>e!=null&&!Cw(s.current,e,x)),a=n.reduce((e,t,n)=>t!=null&&!Cw(s.current,t,x)?n:e,-1),c=n[yw(n.map(e=>e==null?null:s.current[e]),{event:e,orientation:S,loopFocus:p,rtl:h,cols:w,disabledIndices:Sw([...(typeof x==`function`?null:x)||s.current.map((e,t)=>Cw(s.current,t,x)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:xw(N.current>o?i:N.current,t,n,w,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(N.current=c,I(e)),S===`both`)return}if(ck(e.key,S)){if(PC(e),r&&!g&&xC(e.currentTarget.ownerDocument)===e.currentTarget){N.current=lk(e.key,S,h)?i:o,I(e);return}lk(e.key,S,h)?p?t>=o?f&&t!==s.current.length?N.current=-1:(te.current=!1,N.current=i):N.current=vw(s.current,{startingIndex:t,disabledIndices:x}):N.current=Math.min(o,vw(s.current,{startingIndex:t,disabledIndices:x})):p?t<=i?f&&t!==-1?N.current=s.current.length:(te.current=!1,N.current=o):N.current=vw(s.current,{startingIndex:t,decrement:!0,disabledIndices:x}):N.current=Math.max(i,vw(s.current,{startingIndex:t,decrement:!0,disabledIndices:x})),hw(s.current,N.current)&&(N.current=-1),I(e)}}),ue=b.useMemo(()=>g&&r&&ae&&{"aria-activedescendant":`${T}-${c}`},[g,r,ae,T,c]),de=b.useMemo(()=>({"aria-orientation":S===`both`?void 0:S,...j?{}:ue,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=CC(e.nativeEvent);if(t&&!SC(O.current,t))return;PC(e),n.setOpen(!1,OT(xT,e.nativeEvent)),hx(a)&&a.focus();return}le(e)},onPointerMove(){F.current=!0}}),[ue,le,O,S,j,n,r,g,a]),fe=b.useMemo(()=>{function e(e){_===`auto`&&IC(e.nativeEvent)&&(M.current=!g)}function t(e){M.current=_,_===`auto`&&LC(e.nativeEvent)&&(M.current=!0)}return{onKeyDown(e){let t=n.select(`open`);F.current=!1;let r=e.key.startsWith(`Arrow`),i=uk(e.key,ce(),h),a=ck(e.key,S),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return le(e);if(!(!t&&!y&&r)){if(o){let t=ck(e.key,ce());P.current=m&&t?null:e.key}if(m){i&&(PC(e),t?(N.current=gw(s,V.current),I(e)):n.setOpen(!0,OT(CT,e.nativeEvent,e.currentTarget)));return}a&&(re.current!=null&&(N.current=re.current),PC(e),!t&&y?n.setOpen(!0,OT(CT,e.nativeEvent,e.currentTarget)):le(e),t&&I(e))}},onFocus(e){n.select(`open`)&&!g&&(N.current=-1,I(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[le,V,_,s,m,I,n,y,S,ce,h,re,g]),pe=b.useMemo(()=>({...ue,...fe}),[ue,fe]);return b.useMemo(()=>u?{reference:pe,floating:de,item:se,trigger:fe}:{},[u,pe,de,fe,se])}var pk=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function mk(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=qS(),l=a?.id||c,u=b.useMemo(()=>jC(o)?.id||i,[o,i]),d=pk.get(s)??s,f=zE()!=null,p=b.useMemo(()=>d===`tooltip`||s===`label`?SS:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=b.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=b.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=b.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return b.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function hk(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Qw(),m=b.useRef(``),h=b.useRef(f??s??-1),g=b.useRef(null);Q(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),Q(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=Z(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=Z(e=>{function t(e){let t=o?.current[e];return!t||Tw(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(m.current.length>0&&e.key===` `&&(PC(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(PC(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=Z(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=SC(r,t),o=SC(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),x=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),S=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return b.useMemo(()=>u?{reference:x,floating:S}:{},[u,x,S])}var gk=.1,_k=gk*gk,vk=.5;function yk(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function bk(e,t,n,r,i,a,o,s,c,l){let u=!1;return yk(e,t,n,r,i,a)&&(u=!u),yk(e,t,i,a,o,s)&&(u=!u),yk(e,t,o,s,c,l)&&(u=!u),yk(e,t,c,l,n,r)&&(u=!u),u}function xk(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Sk(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ck(e={}){let{blockPointerEvents:t=!1}=e,n=new Zw,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*_k;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=CC(r),g=r.type===`mouseleave`,_=SC(u,h),v=SC(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&mx(r.relatedTarget)&&SC(u,r.relatedTarget))return;function y(){return!!(s&&MC(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Sk(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Sk(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Sk(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Sk(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!xk(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?vk/2:vk*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+vk+1,o=C||T?S.bottom-vk:S.top,s=C?T?S.bottom-vk:S.top:S.bottom-vk;M=bk(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?vk/2:vk*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-vk,o=C||T?S.top+vk:S.bottom,s=C?T?S.top+vk:S.bottom:S.top+vk;M=bk(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?vk/2:vk*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+vk+1,o=w||E?S.right-vk:S.left,s=w?E?S.right-vk:S.left:S.right-vk;M=bk(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?vk/2:vk*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-vk,o=w||E?S.left+vk:S.right,s=w?E?S.left+vk:S.right:S.left+vk;M=bk(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function wk(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Tk(e,t){let n=b.useRef(e),r=Z(t);Q(()=>{n.current!==e&&r(n.current)},[e,r]),Q(()=>{n.current=e},[e])}function Ek(e){let[t,n]=b.useState(null),r=Z((t,r)=>{e||n(r||(sC?`touch`:``))});Tk(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=wk(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Dk(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=Ek(a);LO(t);let{forceUnmount:d}=RO(a,t),f=b.useCallback(()=>{t.setOpen(!1,OT(ET))},[t]);b.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]);let p=KO({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,h]=b.useState(0),[g,_]=b.useState(0),v=m===0,y=mk(p),x=rD(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=CC(e);if(v&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||SC(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});XT(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=rk([y,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{h(e),_(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0),_(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(m+1,g+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,m,g,n]);let T=b.useMemo(()=>S(u),[S,u]),E=b.useMemo(()=>w(u),[w,u]),D=b.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:p,nestedOpenDialogCount:m,nestedOpenDrawerCount:g})}var Ok=b.createContext(void 0);function kk(e){let t=b.useContext(Ok);if(e===!1&&t===void 0)throw Error(iS(27));return t}var Ak={...UO,modal:$(e=>e.modal),nested:$(e=>e.nested),nestedOpenDialogCount:$(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:$(e=>e.nestedOpenDrawerCount),disablePointerDismissal:$(e=>e.disablePointerDismissal),openMethod:$(e=>e.openMethod),descriptionElementId:$(e=>e.descriptionElementId),titleElementId:$(e=>e.titleElementId),viewportElement:$(e=>e.viewportElement),role:$(e=>e.role)},jk=class e extends MO{constructor(e){super(Mk(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new zO,onOpenChange:void 0,onOpenChangeComplete:void 0},Ak)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=Fx(()=>new e(n)).current;return t??r}};function Mk(e={}){return{...VO(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var Nk=b.createContext(!1);function Pk(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=kk(!0),p=b.useContext(Nk),m=!!f,h=jk.useStore(l?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:m});BT(()=>{n===void 0&&h.state.open===!1&&r===!0&&h.update({open:!0,activeTriggerId:d})}),h.useControlledProp(`openProp`,n),h.useControlledProp(`triggerIdProp`,u),h.useSyncedValues({disablePointerDismissal:o,nested:m,modal:s}),h.useContextCallback(`onOpenChange`,i),h.useContextCallback(`onOpenChangeComplete`,a);let g=h.useState(`payload`);Dk({store:h,actionsRef:c,parentContext:f?.store.context,isDrawer:p,onOpenChange:i,triggerIdProp:u});let _=b.useMemo(()=>({store:h}),[h]);return(0,y.jsx)(Nk.Provider,{value:!1,children:(0,y.jsx)(Ok.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})})}function Fk(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=kk(!0),d=!!u,f=jk.useStore(s?.store,{open:r,openProp:n,activeTriggerId:l,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,c),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);Dk({store:f,actionsRef:o,parentContext:u?.store.context,isDrawer:!1,onOpenChange:i,triggerIdProp:c});let m=b.useMemo(()=>({store:f}),[f]);return(0,y.jsx)(Nk.Provider,{value:!1,children:(0,y.jsx)(Ok.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})})}var Ik=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=iT.startingStyle]=`startingStyle`,e[e.endingStyle=iT.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),Lk=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Rk={[Lk.popupOpen]:``},zk={[Lk.popupOpen]:``,[Lk.pressed]:``},Bk={[Ik.open]:``},Vk={[Ik.closed]:``},Hk={[Ik.anchorHidden]:``},Uk={open(e){return e?Rk:null}},Wk={open(e){return e?zk:null}},Gk={open(e){return e?Bk:Vk},anchorHidden(e){return e?Hk:null}},Kk={...Gk,...sT},qk=b.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=kk(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return ES(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Kk,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Jk=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{store:c}=kk(),l=c.useState(`open`);function u(e){l&&c.setOpen(!1,OT(bT,e.nativeEvent))}let{getButtonProps:d,buttonRef:f}=cS({disabled:i,native:a});return ES(`button`,e,{state:{disabled:i},ref:[t,f],props:[{onClick:u},s,d]})}),Yk=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=kk(),c=JS(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),ES(`p`,e,{ref:t,props:[{id:c},o]})}),Xk=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),Zk=function(e){return e[e.open=Ik.open]=`open`,e[e.closed=Ik.closed]=`closed`,e[e.startingStyle=Ik.startingStyle]=`startingStyle`,e[e.endingStyle=Ik.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Qk=b.createContext(void 0);function $k(){let e=b.useContext(Qk);if(e===void 0)throw Error(iS(26));return e}var eA=`ArrowUp`,tA=`ArrowDown`,nA=`ArrowLeft`,rA=`ArrowRight`,iA=`Home`,aA=new Set([nA,rA]),oA=new Set([eA,tA]),sA=new Set([...aA,...oA]);new Set([...sA,iA,`End`]);var cA=new Set([eA,tA,nA,rA,iA,`End`]),lA={...Gk,...sT,nestedDialogOpen(e){return e?{[Zk.nestedDialogOpen]:``}:null}},uA=b.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=kk(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`);$k(),uT({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=ES(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){cA.has(e.key)&&e.stopPropagation()},style:{[Xk.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:lA});return(0,y.jsx)(YE,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})});function dA(e){return vS(19)?e:e?`true`:void 0}var fA=b.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,y.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),pA=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=kk(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,y.jsx)(Qk.Provider,{value:n,children:(0,y.jsxs)(FE,{ref:t,...r,children:[a&&o===!0&&(0,y.jsx)(fA,{ref:i.context.internalBackdropRef,inert:dA(!s)}),e.children]})}):null}),mA=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=kk(),c=JS(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),ES(`h2`,e,{ref:t,props:[{id:c},o]})}),hA=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,payload:s,handle:c,style:l,...u}=e,d=kk(!0),f=c?.store??d?.store;if(!f)throw Error(iS(79));let p=JS(o),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=b.useRef(null),{registerTrigger:_,isMountedByThisTrigger:v}=IO(p,g,f,{payload:s}),{getButtonProps:y,buttonRef:x}=cS({disabled:i,native:a}),S=rk([XE(m,{enabled:m!=null})]),C={disabled:i,open:h},w=f.useState(`triggerProps`,v);return ES(`button`,e,{state:C,ref:[x,t,_,g],props:[S.getReferenceProps(),w,{[DE]:``,id:p},u,y],stateAttributesMapping:Uk})});function gA({...e}){return(0,y.jsx)(Fk,{"data-slot":`alert-dialog`,...e})}function _A({...e}){return(0,y.jsx)(pA,{"data-slot":`alert-dialog-portal`,...e})}function vA({className:e,...t}){return(0,y.jsx)(qk,{"data-slot":`alert-dialog-overlay`,className:cx(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function yA({className:e,size:t=`default`,...n}){return(0,y.jsxs)(_A,{children:[(0,y.jsx)(vA,{}),(0,y.jsx)(uA,{"data-slot":`alert-dialog-content`,"data-size":t,className:cx(`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-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg 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 bA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:cx(`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-6 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 xA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:cx(`flex flex-col-reverse gap-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 SA({className:e,...t}){return(0,y.jsx)(mA,{"data-slot":`alert-dialog-title`,className:cx(`font-heading text-lg 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 CA({className:e,...t}){return(0,y.jsx)(Yk,{"data-slot":`alert-dialog-description`,className:cx(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function wA({className:e,...t}){return(0,y.jsx)(PS,{"data-slot":`alert-dialog-action`,className:cx(e),...t})}function TA({className:e,...t}){return(0,y.jsx)(Ey,{role:`status`,"aria-label":`Loading`,className:cx(`spinner-line-fade size-4`,e),...t})}var EA=({isModalOpen:e,exitInfo:t,isRetryingConnection:n,hasCopiedRestartCommand:r,newTabUrl:i,onReconnect:a,onCopyRestartCommand:o})=>(0,y.jsx)(gA,{open:e,children:(0,y.jsx)(yA,{children:t===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(bA,{children:[(0,y.jsxs)(SA,{className:`flex items-center gap-2`,children:[(0,y.jsx)(TA,{"aria-hidden":`true`,role:`presentation`}),`Lost connection`]}),(0,y.jsx)(CA,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(MT,{children:[(0,y.jsx)(RT,{readOnly:!0,value:od,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(PT,{align:`inline-end`,children:(0,y.jsx)(IT,{size:`icon-xs`,onClick:o,"aria-label":r?`Copied`:`Copy restart command`,children:r?(0,y.jsx)(Sy,{}):(0,y.jsx)(Ty,{})})})]}),(0,y.jsx)(xA,{children:(0,y.jsxs)(wA,{onClick:a,disabled:n,children:[n?(0,y.jsx)(TA,{"data-icon":`inline-start`}):null,`Retry`]})})]}):t.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(bA,{children:[(0,y.jsx)(SA,{children:`Shell ended`}),(0,y.jsx)(CA,{children:t.exitCode===null||t.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${t.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(xA,{children:(0,y.jsx)(wA,{onClick:()=>window.open(i,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(bA,{children:[(0,y.jsxs)(SA,{className:`flex items-center gap-2`,children:[(0,y.jsx)(TA,{"aria-hidden":`true`,role:`presentation`}),`Connection lost`]}),(0,y.jsxs)(CA,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,t.closeCode,t.closeReason?` · ${t.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(xA,{children:(0,y.jsxs)(wA,{onClick:a,disabled:n,children:[n?(0,y.jsx)(TA,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})});function DA({...e}){return(0,y.jsx)(Pk,{"data-slot":`dialog`,...e})}function OA({...e}){return(0,y.jsx)(hA,{"data-slot":`dialog-trigger`,...e})}function kA({...e}){return(0,y.jsx)(pA,{"data-slot":`dialog-portal`,...e})}function AA({className:e,...t}){return(0,y.jsx)(qk,{"data-slot":`dialog-overlay`,className:cx(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function jA({className:e,children:t,showCloseButton:n=!0,...r}){return(0,y.jsxs)(kA,{children:[(0,y.jsx)(AA,{}),(0,y.jsxs)(uA,{"data-slot":`dialog-content`,className:cx(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md 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?(0,y.jsxs)(Jk,{"data-slot":`dialog-close`,render:(0,y.jsx)(PS,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,y.jsx)(My,{}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Close`})]}):null]})]})}function MA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`dialog-header`,className:cx(`flex flex-col gap-2`,e),...t})}function NA({className:e,...t}){return(0,y.jsx)(mA,{"data-slot":`dialog-title`,className:cx(`font-heading leading-none font-medium`,e),...t})}var PA=`border border-border/60 bg-background/70 text-muted-foreground shadow-xs ring-0 backdrop-blur-md`,FA=`duration-150 ease-snappy data-closed:duration-100 data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:blur-out-[5px] data-closed:slide-out-to-top-2 data-open:fade-in-0 data-open:zoom-in-95 data-open:blur-in-[5px] data-open:slide-in-from-top-2`,IA=()=>typeof window<`u`&&typeof window.queryLocalFonts==`function`,LA=async()=>{if(typeof window>`u`)return[];let e=window.queryLocalFonts;if(typeof e!=`function`)return[];try{let t=await e(),n=new Set;for(let e of t)e.family&&n.add(e.family);return[...n].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}catch{return[]}},RA=async()=>{if(typeof navigator>`u`||!navigator.permissions)return`unsupported`;try{return(await navigator.permissions.query({name:`local-fonts`})).state}catch{return`unsupported`}},zA=(e,t)=>{let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e},BA=({open:e,onFontSelect:t})=>{let[n,r]=(0,b.useState)({kind:`loading`}),[i,a]=(0,b.useState)(``),o=(0,b.useDeferredValue)(i);(0,b.useEffect)(()=>{if(!e)return;a(``);let t=!1;return r({kind:`loading`}),(async()=>{if(!IA()){t||r({kind:`unsupported`});return}let e=await RA();if(!t)if(e===`granted`){let e=await LA();t||r({kind:`ready`,families:e})}else r(e===`denied`?{kind:`denied`}:{kind:`prompt`})})(),()=>{t=!0}},[e]);let s=(0,b.useCallback)(async()=>{r({kind:`loading`});let e=await LA();if(e.length===0){r({kind:`denied`});return}r({kind:`ready`,families:e})},[]),c=(0,b.useCallback)(e=>{t(e)},[t]);return{state:n,searchQuery:i,setSearchQuery:a,deferredQuery:o,filteredFamilies:(0,b.useMemo)(()=>n.kind===`ready`?zA(n.families,o):[],[n.kind,n.kind===`ready`?n.families:void 0,o]),handleApply:c,requestPermission:s}},VA=`flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground/90 outline-none transition-colors hover:bg-foreground/10 focus-visible:bg-foreground/10`,HA={contentVisibility:`auto`,containIntrinsicSize:`auto 28px`},UA=`text-xs leading-snug text-muted-foreground/80`,WA=({initialValue:e,onApply:t})=>{let[n,r]=(0,b.useState)(e),i=n.trim(),a=(0,b.useCallback)(()=>{i&&t(i)},[i,t]);return(0,y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,y.jsx)(jT,{autoFocus:!0,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a())},placeholder:`Family name (e.g. Iosevka)`,className:`h-8 text-xs`}),(0,y.jsx)(PS,{type:`button`,size:`sm`,variant:`secondary`,disabled:!i,onClick:a,className:`h-7 text-xs`,children:`Apply`})]})},GA=({open:e,onOpenChange:t,currentFamily:n,onApply:r})=>{let{state:i,searchQuery:a,setSearchQuery:o,deferredQuery:s,filteredFamilies:c,handleApply:l,requestPermission:u}=BA({open:e,onFontSelect:e=>{r(e),t(!1)}});return(0,y.jsx)(DA,{open:e,onOpenChange:t,children:(0,y.jsxs)(jA,{className:cx(`max-h-[calc(100dvh-2rem)] gap-2 overflow-hidden p-4 sm:max-w-sm`,PA),children:[(0,y.jsx)(MA,{className:`pr-8`,children:(0,y.jsx)(NA,{children:`Local font`})}),i.kind===`loading`?(0,y.jsx)(`p`,{className:UA,children:`Loading…`}):i.kind===`unsupported`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:UA,children:`This browser doesn't expose installed fonts. Type a family name to use any installed font.`}),(0,y.jsx)(WA,{initialValue:n??``,onApply:l})]}):i.kind===`denied`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:UA,children:`Permission denied. Re-allow in browser site settings, or type a family name.`}),(0,y.jsx)(WA,{initialValue:n??``,onApply:l})]}):i.kind===`prompt`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:UA,children:`Allow localterm to read your installed fonts to preview them.`}),(0,y.jsx)(PS,{type:`button`,size:`sm`,variant:`secondary`,onClick:u,className:`h-7 text-xs`,children:`Allow access`}),(0,y.jsx)(`div`,{className:`my-1 border-t border-border/40`}),(0,y.jsx)(`p`,{className:UA,children:`Or type a family name:`}),(0,y.jsx)(WA,{initialValue:n??``,onApply:l})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(Ay,{className:`pointer-events-none absolute top-1/2 left-2 size-3 -translate-y-1/2 text-muted-foreground/70`}),(0,y.jsx)(jT,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search installed fonts`,className:`h-8 pl-7 text-xs`})]}),(0,y.jsx)(`div`,{className:`-mx-1 max-h-72 overflow-y-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:c.length===0?(0,y.jsxs)(`p`,{className:cx(UA,`px-2 py-2`),children:[`No fonts match "`,a,`".`]}):c.map(e=>(0,y.jsx)(`button`,{type:`button`,onClick:()=>l(e),className:cx(VA,e===n&&`bg-foreground/5`),style:{...HA,fontFamily:`"${wd(e)}", ui-monospace, monospace`},children:(0,y.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,y.jsx)(`p`,{className:cx(UA,`px-1 tabular-nums`),children:s?`${c.length} of ${i.families.length}`:`${i.families.length} fonts`})]})]})})};function KA({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:cx(`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})}var qA=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return ES(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function JA({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(qA,{"data-slot":`separator`,orientation:t,className:cx(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}function YA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:cx(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var XA=Ly(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function ZA({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:cx(XA({orientation:t}),e),...n})}function QA({className:e,...t}){return(0,y.jsx)(KA,{"data-slot":`field-label`,className:cx(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var $A=b.createContext(void 0);function ej(e){let t=b.useContext($A);if(t===void 0&&!e)throw Error(iS(72));return t}var tj={...UO,disabled:$(e=>e.disabled),instantType:$(e=>e.instantType),isInstantPhase:$(e=>e.isInstantPhase),trackCursorAxis:$(e=>e.trackCursorAxis),disableHoverablePopup:$(e=>e.disableHoverablePopup),lastOpenChangeReason:$(e=>e.openChangeReason),closeOnClick:$(e=>e.closeOnClick),closeDelay:$(e=>e.closeDelay),hasViewport:$(e=>e.hasViewport)},nj=class e extends MO{constructor(e){super({...rj(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new zO},tj)}setOpen=(e,t)=>{let n=t.reason,r=n===gT,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?cT.flushSync(o):o()};static useStore(t,n){let r=Fx(()=>new e(n)).current,i=t??r,a=KO({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function rj(){return{...VO(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var ij=xO(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=nj.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});BT(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),Q(()=>{m&&t&&p.setOpen(!1,OT(TT))},[m,t,p]),p.useSyncedValue(`disabled`,t),LO(p);let{forceUnmount:v,transitionStatus:x}=RO(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);Q(()=>{x===`ending`&&T===`none`||x!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[x,C,T,w,p]),Q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,OT(ET))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=rk([rD(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),$E(S,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),j=b.useMemo(()=>O(),[O]),M=b.useMemo(()=>A(),[A]),N=b.useMemo(()=>k(),[k]);return p.useSyncedValues({activeTriggerProps:j,inactiveTriggerProps:M,popupProps:N}),(0,y.jsx)($A.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),aj=b.createContext(void 0);function oj(){return b.useContext(aj)}var sj=function(e){return e[e.popupOpen=Lk.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),cj=SO(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeOnClick:c=!0,closeDelay:l,id:u,style:d,...f}=e,p=ej(!0),m=i?.store??p;if(!m)throw Error(iS(82));let h=JS(u),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=b.useRef(null),x=s??600,S=l??0,{registerTrigger:C,isMountedByThisTrigger:w}=IO(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=oj(),{delayRef:E,isInstantPhase:D,hasProvider:O}=rE(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=nk(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Ck():null,restMs(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:s??e??x),n},delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return l==null&&O&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`}),P=JO(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return ES(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[sj.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:Uk})}),lj=b.createContext(void 0);function uj(){let e=b.useContext(lj);if(e===void 0)throw Error(iS(70));return e}var dj=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=PE({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&cT.createPortal(n,c)]})}),fj=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return ej().useState(`mounted`)||n?(0,y.jsx)(lj.Provider,{value:n,children:(0,y.jsx)(dj,{ref:t,...r})}):null}),pj=b.createContext(void 0);function mj(){let e=b.useContext(pj);if(e===void 0)throw Error(iS(71));return e}var hj=b.createContext(void 0);function gj(){return b.useContext(hj)?.direction??`ltr`}var _j=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=JC(e,t)||{};if(l==null)return{};let f=fw(u),p={x:n,y:r},m=ew(i),h=QC(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=qC(k,j,A),N=!c.arrow&&XC(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),vj=(e,t)=>({..._j(e),options:[e,t]}),yj={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await fO().fn(e)).data?.referenceHidden||a}}}},bj={sideX:`left`,sideY:`top`},xj={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=dx(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:bj};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=tC(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=YC(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:bj.sideX,g=f===`top`?`bottom`:bj.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Sj(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Cj(e,t,n){let{rects:r,placement:i}=e;return{side:Sj(t,YC(i),n),align:XC(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function wj(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=Z(D),k=D?O:t,A=aE(t),j=aE(m),M=gj()===`rtl`,N=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":M?`left`:`right`,"inline-start":M?`right`:`left`}[r],P=a===`center`?N:`${N}-${a}`,F=c,I=+(r===`bottom`),L=+(r===`top`),ee=+(r===`right`),R=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+R,bottom:F+L,left:F+ee}:F&&={top:(F.top||0)+I,right:(F.right||0)+R,bottom:(F.bottom||0)+L,left:(F.left||0)+ee};let te={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},z=b.useRef(null),B=aE(i),V=aE(o),ne=[sO(e=>{let t=Cj(e,r,M),n=typeof B.current==`function`?B.current(t):B.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],re=T===`none`&&w!==`shift`,H=!re&&(l||g||w===`shift`),ie=w===`none`?null:uO({...te,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ae=re?null:cO(e=>{let t=tC(e.elements.floating).documentElement;return{...te,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:H,limiter:l||g?void 0:lO(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=$C(YC(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[te,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?ne.push(ae,ie):ne.push(ie,ae),ne.push(dO({...te,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!j.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=dx(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),vj(()=>({element:z.current||tC(z.current).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=YC(a),l=$C(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Cj(e,r,M)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,H&&l===`y`&&b?S:x),{}}},yj,v),Q(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let oe=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:se,elements:ce,x:le,y:ue,middlewareData:de,update:fe,placement:pe,context:me,isPositioned:he,floatingStyles:ge}=GO({rootContext:p,open:f?m:void 0,placement:P,middleware:ne,strategy:n,whileElementsMounted:f?void 0:(...e)=>qD(...e,oe),nodeId:_,externalTree:x}),{sideX:_e,sideY:ve}=de.adaptiveOrigin||bj,ye=he?n:`fixed`,be=b.useMemo(()=>{let e=v?{position:ye,[_e]:le,[ve]:ue}:{position:ye,...ge};return he||(e.opacity=0),e},[v,ye,_e,le,ve,ue,ge,he]),xe=b.useRef(null);Q(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(Tj(t)?t.current:t)||null;n!==xe.current&&(se.setPositionReference(n),xe.current=n)},[m,se,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&Tj(e)&&e.current!==xe.current&&(se.setPositionReference(e.current),xe.current=e.current)},[m,se,k,A]),b.useEffect(()=>{if(f&&m&&ce.domReference&&ce.floating)return qD(ce.domReference,ce.floating,fe,oe)},[f,m,ce,fe,oe]);let Se=YC(pe),Ce=Sj(r,Se,M),we=XC(pe)||`center`,Te=!!de.hide?.referenceHidden;Q(()=>{y&&m&&he&&C(Se)},[y,m,he,Se]);let Ee=b.useMemo(()=>({position:`absolute`,top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),De=de.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:be,arrowStyles:Ee,arrowRef:z,arrowUncentered:De,side:Ce,align:we,physicalSide:Se,anchorHidden:Te,refs:se,context:me,isPositioned:he,update:fe}),[be,Ee,z,De,Ce,we,Se,Te,se,me,he,fe])}function Tj(e){return e!=null&&`current`in e}function Ej(e){return e===`starting`?EE:SS}function Dj(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),ES(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Ej(r),i],stateAttributesMapping:Gk})}var Oj=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=kE,style:g,..._}=e,v=ej(),x=uj(),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`trackCursorAxis`),T=v.useState(`disableHoverablePopup`),E=v.useState(`floatingRootContext`),D=v.useState(`instantType`),O=v.useState(`transitionStatus`),k=wj({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?xj:void 0}),A=Dj(e,b.useMemo(()=>({open:S,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:w===`none`?D:`tracking-cursor`}),[S,k.side,k.align,k.anchorHidden,w,D]),{styles:k.positionerStyles,transitionStatus:O,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!C,inert:!S||w===`both`||T});return(0,y.jsx)(pj.Provider,{value:k,children:A})}),kj={...Gk,...sT},Aj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=ej(),{side:s,align:c}=mj(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);uT({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return ek(p,{enabled:!m,closeDelay:h}),ES(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,Ej(d),a],stateAttributesMapping:kj})}),jj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=ej(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=mj();return ES(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:Gk})}),Mj=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=b.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=b.useMemo(()=>({open:t,close:n}),[t,n]);return(0,y.jsx)(aj.Provider,{value:i,children:(0,y.jsx)(nE,{delay:a,timeoutMs:r,children:e.children})})};function Nj(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Pj({delay:e=0,...t}){return(0,y.jsx)(Mj,{"data-slot":`tooltip-provider`,delay:e,...t})}function Fj({...e}){return(0,y.jsx)(ij,{"data-slot":`tooltip`,...e})}function Ij({...e}){return(0,y.jsx)(cj,{"data-slot":`tooltip-trigger`,...e})}function Lj({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(fj,{children:(0,y.jsx)(Oj,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(Aj,{"data-slot":`tooltip-content`,className:cx(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 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-[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`,e),...o,children:[a,(0,y.jsx)(jj,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var Rj=b.createContext(null),zj=b.createContext(null);function Bj(){let e=b.useContext(Rj);if(e===null)throw Error(iS(60));return e}function Vj(){let e=b.useContext(zj);if(e===null)throw Error(iS(61));return e}var Hj=(e,t)=>Object.is(e,t);function Uj(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Wj(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Uj(t,e,n))}function Gj(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Uj(e,t,n))}function Kj(e,t,n){return e.filter(e=>!Uj(t,e,n))}function qj(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Jj(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Yj(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Jj(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Xj(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return qj(e)}function Zj(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?qj(e.value):qj(e)}function Qj(e,t,n){function r(){return Xj(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Jj(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function $j(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:Qj(r,t,n)},i)),e),[])}var eM={id:$(e=>e.id),labelId:$(e=>e.labelId),modal:$(e=>e.modal),multiple:$(e=>e.multiple),items:$(e=>e.items),itemToStringLabel:$(e=>e.itemToStringLabel),itemToStringValue:$(e=>e.itemToStringValue),isItemEqualToValue:$(e=>e.isItemEqualToValue),value:$(e=>e.value),hasSelectedValue:$(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Zj(t,r)!==``}),hasNullItemLabel:$((e,t)=>t?Yj(e.items):!1),open:$(e=>e.open),mounted:$(e=>e.mounted),forceMount:$(e=>e.forceMount),transitionStatus:$(e=>e.transitionStatus),openMethod:$(e=>e.openMethod),activeIndex:$(e=>e.activeIndex),selectedIndex:$(e=>e.selectedIndex),isActive:$((e,t)=>e.activeIndex===t),isSelected:$((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>Uj(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Uj(n,i,r)}),isSelectedByFocus:$((e,t)=>e.selectedIndex===t),popupProps:$(e=>e.popupProps),triggerProps:$(e=>e.triggerProps),triggerElement:$(e=>e.triggerElement),positionerElement:$(e=>e.positionerElement),listElement:$(e=>e.listElement),scrollUpArrowVisible:$(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:$(e=>e.scrollDownArrowVisible),hasScrollArrows:$(e=>e.hasScrollArrows)};function tM(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function nM(e,t){return Math.max(0,e-t)}function rM(e,t){if(t<=0)return 0;let n=tM(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function iM(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:x=!1,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w=Hj,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=US(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=VS(),ee=eC({id:t}),R=F||d,te=P??c,[z,B]=fT({controlled:n,default:x?r??xS:r,name:`Select`,state:`value`}),[V,ne]=fT({controlled:a,default:o,name:`Select`,state:`open`}),re=b.useRef([]),H=b.useRef([]),ie=b.useRef(null),ae=b.useRef(null),oe=b.useRef(0),se=b.useRef(null),ce=b.useRef([]),le=b.useRef(!1),ue=b.useRef(!1),de=b.useRef(null),fe=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),pe=b.useRef(!1),{mounted:me,setMounted:he,transitionStatus:ge}=dT(V),{openMethod:_e,triggerProps:ve}=Ek(V),ye=Fx(()=>new jO({id:ee,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:z,open:V,mounted:me,transitionStatus:ge,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,be=DO(ye,eM.activeIndex),xe=DO(ye,eM.selectedIndex),Se=DO(ye,eM.triggerElement),Ce=DO(ye,eM.positionerElement),we=Nj(_e),Te=_e??we,Ee=b.useMemo(()=>x&&Array.isArray(z)&&z.length===0?``:Zj(z,C),[x,z,C]),De=b.useMemo(()=>x&&Array.isArray(z)?z.map(e=>Zj(e,C)):Zj(z,C),[x,z,C]);pT(aE(ye.state.triggerElement),{id:ee,value:z,getValue:Z(()=>De)});let Oe=b.useRef(z);Q(()=>{z!==Oe.current&&ye.set(`forceMount`,!0)},[ye,z]),Q(()=>{N(x?Array.isArray(z)&&z.length>0:z!=null)},[x,z,N]),Q(function(){if(V)return;let e=ce.current;if(x){let t=Array.isArray(z)?z:[];if(t.length===0){ye.set(`selectedIndex`,null);return}let n=t[t.length-1],r=Gj(e,n,w);ye.set(`selectedIndex`,r===-1?null:r);return}let t=Gj(e,z,w);ye.set(`selectedIndex`,t===-1?null:t)},[x,V,z,ce,w,ye]),Tk(z,()=>{D(te),O(z!==M.initialValue),j()?I.commit(z):I.commit(z,!0)});let ke=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(ne(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(z)),!e&&ye.state.activeIndex!==null)){let e=re.current[ye.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Ae=Z(()=>{he(!1),ye.update({activeIndex:null,openMethod:null}),_?.(!1)});uT({enabled:!h,open:V,ref:ie,onComplete(){V||Ae()}}),b.useImperativeHandle(h,()=>({unmount:Ae}),[Ae]);let je=Z((e,t)=>{i?.(e,t),!t.isCanceled&&B(e)}),Me=Z(()=>{let e=ye.state.listElement||ie.current;if(!e)return;let t=nM(e.scrollHeight,e.clientHeight),n=rM(e.scrollTop,t),r=n>0,i=n<t;ye.state.scrollUpArrowVisible!==r&&ye.set(`scrollUpArrowVisible`,r),ye.state.scrollDownArrowVisible!==i&&ye.set(`scrollDownArrowVisible`,i)}),Ne=WO({open:V,onOpenChange:ke,elements:{reference:Se,floating:Ce}}),{getReferenceProps:Pe,getFloatingProps:Fe,getItemProps:Ie}=rk([XE(Ne,{enabled:!f&&!R,event:`mousedown`}),rD(Ne,{bubbles:!1}),fk(Ne,{enabled:!f&&!R,listRef:re,activeIndex:be,selectedIndex:xe,disabledIndices:xS,onNavigate(e){e===null&&!V||ye.set(`activeIndex`,e)},focusItemOnHover:T}),hk(Ne,{enabled:!f&&!R&&(V||!x),listRef:H,activeIndex:be,selectedIndex:xe,onMatch(e){V?ye.set(`activeIndex`,e):je(ce.current[e],OT(`none`))},onTypingChange(e){le.current=e}})]),Le=b.useMemo(()=>Ux(Pe(),ve,ee?{id:ee}:SS),[Pe,ve,ee]);BT(()=>{ye.update({popupProps:Fe(),triggerProps:Le})}),Q(()=>{ye.update({id:ee,modal:m,multiple:x,value:z,open:V,mounted:me,transitionStatus:ge,popupProps:Fe(),triggerProps:Le,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Te})},[ye,ee,m,x,z,V,me,ge,Fe,Le,v,S,C,w,Te]);let Re=b.useMemo(()=>({store:ye,name:te,required:p,disabled:R,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:je,setOpen:ke,listRef:re,popupRef:ie,scrollHandlerRef:ae,handleScrollArrowVisibility:Me,scrollArrowsMountedCountRef:oe,getItemProps:Ie,events:Ne.context.events,valueRef:se,valuesRef:ce,labelsRef:H,typingRef:le,selectionRef:fe,selectedItemTextRef:de,validation:I,onOpenChangeComplete:_,keyboardActiveRef:ue,alignItemWithTriggerActiveRef:pe,initialValueRef:Oe}),[ye,te,p,R,f,x,T,je,ke,Ie,Ne.context.events,I,_,Me]),ze=dS(g,I.inputRef),Be=x&&Array.isArray(z)&&z.length>0,Ve=x?void 0:te,He=b.useMemo(()=>!x||!Array.isArray(z)||!te?null:z.map(e=>{let t=Zj(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:te,value:t},t)}),[x,z,l,te,C]);return(0,y.jsx)(Rj.Provider,{value:Re,children:(0,y.jsxs)(zj.Provider,{value:Ne,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){ye.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=OT(mT,e.nativeEvent);function r(){if(x)return;let e=ce.current.find(e=>Zj(e,C).toLowerCase()===t.toLowerCase()||Xj(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),je(e,n),j()&&I.commit(e))}ye.set(`forceMount`,!0),queueMicrotask(r)}}),id:ee&&Ve==null?`${ee}-hidden-input`:void 0,form:l,name:Ve,autoComplete:u,value:Ee,disabled:R,required:p&&!Be,readOnly:f,ref:ze,style:te?lE:cE,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),He]})})}function aM(e,t){return e??t}function oM(e){let t=e.getBoundingClientRect(),n=dx(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var sM=2,cM=400,lM=200,uM={...Wk,...zS,value:()=>null},dM=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=VS(),{labelId:m}=XS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=Bj(),T=p||C||a,E=DO(h,eM.open),D=DO(h,eM.value),O=DO(h,eM.triggerProps),k=DO(h,eM.positionerElement),A=DO(h,eM.listElement),j=DO(h,eM.id),M=DO(h,eM.labelId),N=DO(h,eM.hasSelectedValue),P=!N&&E,F=DO(h,eM.hasNullItemLabel,P),I=i??j,L=aM(m,M);eC({id:I});let ee=aE(k),R=b.useRef(null),{getButtonProps:te,buttonRef:z}=cS({disabled:T,native:o}),B=dS(t,R,z,Z(e=>{h.set(`triggerElement`,e)})),V=Qw(),ne=Qw(),re=Qw(),H=Qw();b.useEffect(()=>{if(E)return N||F?H.start(lM,()=>{_.current.allowUnselectedMouseUp=!0,re.start(lM,()=>{_.current.allowSelectedMouseUp=!0})}):re.start(cM,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{re.clear(),H.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},ne.clear()},[E,N,F,_,ne,re,H]);let ie=b.useMemo(()=>A?.id??jC(k)?.id,[A,k]),ae=Ux(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?ie:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:B,onFocus(e){u(!0),E&&S.current&&g(!1,OT(mT,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){SC(k,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(D))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=tC(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;if(SC(R.current,t)||SC(ee.current,t)||t===R.current)return;let n=oM(R.current);e.clientX>=n.left-sM&&e.clientX<=n.right+sM&&e.clientY>=n.top-sM&&e.clientY<=n.bottom+sM||g(!1,OT(wT,e))}ne.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,te);ae.role=`combobox`;let oe={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return ES(`button`,e,{ref:[t,R],state:oe,stateAttributesMapping:uM,props:ae})}),fM={value:()=>null},pM=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Bj(),u=DO(c,eM.value),d=DO(c,eM.items),f=DO(c,eM.itemToStringLabel),p=DO(c,eM.hasSelectedValue),m=!p&&a!=null&&i==null,h=DO(c,eM.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?$j(u,d,f):Qj(u,d,f)),ES(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:fM})}),mM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=Bj();return ES(`span`,e,{state:{open:DO(o,eM.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Uk})}),hM=b.createContext(void 0),gM=b.forwardRef(function(e,t){let{store:n}=Bj(),r=DO(n,eM.mounted),i=DO(n,eM.forceMount);return r||i?(0,y.jsx)(hM.Provider,{value:!0,children:(0,y.jsx)(FE,{ref:t,...e})}):null}),_M=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function vM(){return b.useContext(_M)}function yM(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Fx(xM).current,c=Fx(bM).current,[l,u]=b.useState(0),d=b.useRef(l),f=Z((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=Z(e=>{c.delete(e),d.current+=1,u(d.current)}),m=b.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(SM).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);Q(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),Q(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),Q(()=>()=>{n.current=[]},[n]),Q(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));Q(()=>{s.forEach(e=>e(m))},[s,m]);let g=b.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,y.jsx)(_M.Provider,{value:g,children:t})}function bM(){return new Map}function xM(){return new Set}function SM(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var CM=b.createContext(void 0);function wM(){let e=b.useContext(CM);if(!e)throw Error(iS(59));return e}function TM(e,t){e&&Object.assign(e.style,t)}var EM={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},DM=20;function OM(e,t,n,r){let[i,a]=b.useState(!1);Q(()=>{if(!e||!t||n==null){a(!1);return}let r=tC(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-DM)},[e,t,n]),XT(e&&(!t||i),r)}var kM={position:`fixed`},AM=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=OE,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=Bj(),A=Vj(),j=DO(x,eM.open),M=DO(x,eM.mounted),N=DO(x,eM.modal),P=DO(x,eM.value),F=DO(x,eM.openMethod),I=DO(x,eM.positionerElement),L=DO(x,eM.triggerElement),ee=DO(x,eM.isItemEqualToValue),R=DO(x,eM.transitionStatus),te=b.useRef(null),z=b.useRef(null),[B,V]=b.useState(h),ne=M&&B&&F!==`touch`;!M&&B!==h&&V(h),Q(()=>{M||(eM.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),eM.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>ne),OM((ne||N)&&j,F===`touch`,I,L);let re=wj({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??ne,collisionAvoidance:g,keepMounted:!0}),H=ne?`none`:re.side,ie=ne?kM:re.positionerStyles,ae=Dj(e,{open:j,side:H,align:re.align,anchorHidden:re.anchorHidden},{styles:ie,transitionStatus:R,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),oe=b.useRef(0),se=Z(e=>{if(e.size===0&&oe.current===0||E.current.length===0)return;let t=oe.current;if(oe.current=e.size,e.size===t)return;let n=OT(mT);if(t!==0&&!x.state.multiple&&P!==null&&Gj(E.current,P,ee)===-1){let e=D.current,t=e!=null&&Gj(E.current,e,ee)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>Gj(E.current,e,ee)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!Wj(P,e,ee)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&ne){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};TM(I,e),TM(O.current,e)}}),ce=b.useMemo(()=>({...re,side:H,alignItemWithTriggerActive:ne,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:te,scrollDownArrowRef:z}),[re,H,ne,V]);return(0,y.jsx)(yM,{elementsRef:S,labelsRef:C,onMapChange:se,children:(0,y.jsxs)(CM.Provider,{value:ce,children:[M&&N&&(0,y.jsx)(fA,{inert:dA(!j),cutout:L}),ae]})})}),jM=`base-ui-disable-scrollbar`,MM={className:jM,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:jM,precedence:`base-ui:low`,children:`.${jM}{scrollbar-width:none}.${jM}::-webkit-scrollbar{display:none}`})}},NM=b.createContext(void 0);function PM(e){let t=b.useContext(NM);if(t===void 0&&!e)throw Error(iS(69));return t}var FM=b.createContext(void 0),IM={disableStyleElements:!1};function LM(){return b.useContext(FM)??IM}var RM={...Gk,...sT},zM=b.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,selectedItemTextRef:f,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v}=Bj(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=wM(),O=PM(!0)!=null,k=Vj(),A=gj(),{nonce:j,disableStyleElements:M}=LM(),N=DO(s,eM.id),P=DO(s,eM.open),F=DO(s,eM.mounted),I=DO(s,eM.popupProps),L=DO(s,eM.transitionStatus),ee=DO(s,eM.triggerElement),R=DO(s,eM.positionerElement),te=DO(s,eM.listElement),z=b.useRef(!1),B=b.useRef(!1),V=b.useRef({}),ne=nT(),re=Z(e=>{if(!R||!c.current||!B.current)return;if(z.current||!C){h();return}let t=R.style.top===`0px`,n=R.style.bottom===`0px`;if(!t&&!n){h();return}let r=HM(R),i=UM(R.getBoundingClientRect().height,`y`,r),a=tC(R),o=getComputedStyle(R),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=BM(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=VM(e),m=0,g=null,_=!1,v=!1,y=e=>{R.style.height=`${e}px`},b=(t,n)=>{let r=tM(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(z.current=!0),h()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:g=0:(_=!0,n&&f<p&&(g=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||g!=null){let t=VM(e),n=v?t:tM(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(z.current=!0),h()});b.useImperativeHandle(g,()=>re,[re]),uT({open:P,ref:c,onComplete(){P&&l?.(!0)}});let H={open:P,transitionStatus:L,side:x,align:S};Q(()=>{!R||!c.current||Object.keys(V.current).length||(V.current={top:R.style.top||`0`,left:R.style.left||`0`,right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),Q(()=>{P||C||(B.current=!1,z.current=!1,TM(R,V.current))},[P,C,R,c]),Q(()=>{let e=c.current;if(!P||!ee||!R||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){B.current=!0,ne.request(h),e.style.removeProperty(`--transform-origin`);return}let t=KM(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(R),i=getComputedStyle(e),a=tC(ee),o=dx(R),c=HM(ee),l=WM(ee.getBoundingClientRect(),c),u=WM(R.getBoundingClientRect(),c),p=l.height,m=te||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=BM(i),w=a.documentElement.clientHeight-b-x,E=a.documentElement.clientWidth,D=w-l.bottom+p,O,k=A===`rtl`?l.right-u.width:l.left,j=0;if(t&&n){let e=WM(n.getBoundingClientRect(),c);O=WM(t.getBoundingClientRect(),c),k=u.left+(A===`rtl`?e.right-O.right:e.left-O.left);let r=e.top-l.top+e.height/2;j=O.top-u.top+O.height/2-r}let M=D+j+x+y,N=Math.min(w,M),P=w-b-x,F=M-N,I=E-5;R.style.left=`${tM(k,5,I-u.width)}px`,R.style.height=`${N}px`,R.style.maxHeight=`auto`,R.style.marginTop=`${b}px`,R.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=VM(m),ne=F>=L-1;ne&&(N=Math.min(w,u.height)-(F-L));let re=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),H=(o.visualViewport?.scale??1)!==1&&oC;if(re||H){B.current=!0,TM(R,V.current),T(!1);return}let ie=Math.max(S,N);if(ne){let e=Math.max(0,w-M);R.style.top=u.height>=P?`0`:`${e}px`,R.style.height=`${N}px`,m.scrollTop=VM(m)}else R.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=tM(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ie===w||N>=C)&&(z.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),B.current=!0}finally{t()}},[s,P,R,ee,d,f,c,h,C,T,ne,E,D,te,_,v,A,w]),b.useEffect(()=>{if(!C||!R||!P)return;let e=dx(R);function t(e){u(!1,OT(DT,e))}return VT(e,`resize`,t)},[u,C,R,P]);let ie={...te?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&cA.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){te||re(e.currentTarget)},...C&&{style:te?{height:`100%`}:EM}},ae=ES(`div`,e,{ref:[t,c],state:H,stateAttributesMapping:RM,props:[I,ie,Ej(L),{className:!te&&C?MM.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&MM.getElement(j),(0,y.jsx)(YE,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:ae})]})});function BM(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function VM(e){return nM(e.scrollHeight,e.clientHeight)}function HM(e){return WD.getScale(e)}function UM(e,t,n){return e/n[t]}function WM(e,t){return pw({x:UM(e.x,`x`,t),y:UM(e.y,`y`,t),width:UM(e.width,`x`,t),height:UM(e.height,`y`,t)})}var GM=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function KM(e){let{style:t}=e,n={};for(let[e,r]of GM)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of GM){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var qM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=Bj(),{alignItemWithTriggerActive:c}=wM(),l=DO(o,eM.hasScrollArrows),u=DO(o,eM.openMethod),d=DO(o,eM.multiple),f={id:`${DO(o,eM.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:EM},className:l&&u!==`touch`?MM.className:void 0};return ES(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),JM=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function YM(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=vM(),f=b.useRef(-1),[p,m]=b.useState(a??(i===JM.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=b.useRef(null),g=b.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Q(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Q(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),b.useMemo(()=>({ref:g,index:p}),[p,g])}var XM=b.createContext(void 0);function ZM(){let e=b.useContext(XM);if(!e)throw Error(iS(57));return e}var QM=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,style:c,...l}=e,u=b.useRef(null),d=YM({label:a,textRef:u,indexGuessBehavior:JM.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=Bj(),C=DO(f,eM.isActive,d.index),w=DO(f,eM.isSelected,d.index,i),T=DO(f,eM.isSelectedByFocus,d.index),E=DO(f,eM.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=aE(D);Q(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),Q(()=>{if(!O)return;let e=f.state.value,t=e;x&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&Uj(i,t,E)&&(f.set(`selectedIndex`,D),u.current&&(S.current=u.current))},[O,D,x,E,f,i,S]);let j={disabled:o,selected:w,highlighted:C},M=p({active:C,selected:w});M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=cS({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function ee(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?Kj(n,i,E):[...n,i],OT(yT,e))}else h(i,OT(yT,e)),m(!1,OT(yT,e))}let R={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,f.set(`activeIndex`,D),e.key===` `&&_.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&_.current||P.current!==`touch`&&!C||(N.current=null,ee(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!g.current.allowSelectedMouseUp&&w,t=!g.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},te=ES(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,R,l,I]}),z=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(XM.Provider,{value:z,children:te})})),$M=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=ZM();return n||r?(0,y.jsx)(eN,{...e,ref:t}):null}),eN=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=ZM(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=dT(s),d=ES(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:sT});return uT({open:s,ref:c,onComplete(){s||u(!1)}}),d})),tN=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=ZM(),{selectedItemTextRef:o}=Bj(),{className:s,render:c,style:l,...u}=e;return ES(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:u})})),nN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=Bj(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=wM(),_=DO(l,c?eM.scrollUpArrowVisible:eM.scrollDownArrowVisible),v=DO(l,eM.openMethod),y=_&&v!==`touch`,b=Qw(),x=c?g:h,{transitionStatus:S,setMounted:C}=dT(y);Q(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),uT({open:y,ref:x,onComplete(){y||C(!1)}});let w=ES(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=nM(e.scrollHeight,e.clientHeight),r=rM(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=rN(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function rN(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?rM(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?rM(l.offsetTop+l.offsetHeight-r+i,a):a}var iN=b.forwardRef(function(e,t){return(0,y.jsx)(nN,{...e,ref:t,direction:`down`})}),aN=b.forwardRef(function(e,t){return(0,y.jsx)(nN,{...e,ref:t,direction:`up`})}),oN=iM;function sN({className:e,...t}){return(0,y.jsx)(pM,{"data-slot":`select-value`,className:cx(`flex flex-1 text-left`,e),...t})}function cN({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(dM,{"data-slot":`select-trigger`,"data-size":t,className:cx(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *: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 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,y.jsx)(mM,{render:(0,y.jsx)(Cy,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function lN({className:e,children:t,footer:n,side:r=`bottom`,sideOffset:i=4,align:a=`center`,alignOffset:o=0,alignItemWithTrigger:s=!0,...c}){return(0,y.jsx)(gM,{children:(0,y.jsx)(AM,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(zM,{"data-slot":`select-content`,"data-align-trigger":s,className:cx(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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),...c,children:[(0,y.jsx)(dN,{}),(0,y.jsx)(qM,{children:t}),(0,y.jsx)(fN,{}),n]})})})}function uN({className:e,children:t,...n}){return(0,y.jsxs)(QM,{"data-slot":`select-item`,className:cx(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,y.jsx)(tN,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)($M,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(Sy,{className:`pointer-events-none`})})]})}function dN({className:e,...t}){return(0,y.jsx)(aN,{"data-slot":`select-scroll-up-button`,className:cx(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(wy,{})})}function fN({className:e,...t}){return(0,y.jsx)(iN,{"data-slot":`select-scroll-down-button`,className:cx(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(Cy,{})})}var pN=`h-7 justify-between gap-1.5 rounded-md border-border/60 bg-transparent px-2 text-xs font-normal text-foreground shadow-none focus-visible:border-ring/40 focus-visible:ring-1 focus-visible:ring-ring/40 dark:bg-transparent`,mN=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,hN=`rounded-sm py-1.5 pr-7 pl-2 text-xs hover:bg-foreground/10 hover:text-foreground focus:bg-foreground/10 focus:text-foreground`,gN=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=(0,b.useMemo)(()=>t.find(t=>t.id===e),[t,e]),f=(0,b.useMemo)(()=>d?.itemStyle?{...d.itemStyle,...l}:l,[d?.itemStyle,l]);return(0,y.jsxs)(oN,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(cN,{size:`sm`,"aria-label":n,className:cx(pN,`w-full`,c),style:f,children:(0,y.jsx)(sN,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(lN,{alignItemWithTrigger:!1,sideOffset:4,className:cx(mN,PA,FA),footer:u?(0,y.jsx)(`div`,{className:`border-t border-border/40 p-1`,children:u}):void 0,children:t.map(e=>(0,y.jsx)(uN,{value:e.id,className:hN,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})},_N=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,vN=Fd.map(e=>({id:e.id,label:e.name})),yN=({themeId:e,onThemeChange:t,onThemePreview:n,onOpenChange:r})=>(0,y.jsxs)(ZA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(QA,{className:_N,children:`Theme`}),(0,y.jsx)(gN,{value:e,items:vN,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:t,onOpenChange:r,onItemHover:n})]});function bN(e){return ES(e.defaultTagName??`div`,e,e)}var xN=Ly(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function SN({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:cx(xN({orientation:t}),e),...n})}function CN({className:e,render:t,...n}){return bN({defaultTagName:`div`,props:Ux({className:cx(`flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e)},n),render:t,state:{slot:`button-group-text`}})}var wN={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1};function TN({value:e,min:t,max:n,step:r,onChange:i}){let a=(0,b.useRef)(null),o=(0,b.useRef)(e);return{onPointerDown:t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}a.current=t.clientX,o.current=e}},onPointerMove:e=>{let s=a.current;if(s===null)return;let c=e.clientX-s,l=Math.round(c/5);if(l===0)return;let u=o.current+l*r;i(Math.max(t,Math.min(n,u)))},onPointerUp:e=>{if(a.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}a.current=null}},onPointerLeave:e=>{if(a.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(a.current=null)},onKeyDown:a=>{if(a.key===`Home`){a.preventDefault(),i(t);return}if(a.key===`End`){a.preventDefault(),i(n);return}let o=wN[a.key];o!==void 0&&(a.preventDefault(),i(Math.max(t,Math.min(n,e+o*r))))}}}var EN=e=>String(e),DN=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,ON=`h-7 min-w-[3rem] cursor-ew-resize touch-none justify-center border-y-0 border-r border-l! border-border/60 bg-transparent px-1.5 text-xs font-medium tabular-nums text-foreground select-none hover:bg-foreground/5 focus-visible:outline-none focus-visible:bg-foreground/5`,kN=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=EN,onValueChange:c})=>{let l=TN({value:e,min:t,max:n,step:r,onChange:c});return(0,y.jsxs)(SN,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(PS,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:DN,children:(0,y.jsx)(Dy,{})}),(0,y.jsx)(CN,{role:`slider`,tabIndex:0,"aria-label":i,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":s(e),"aria-orientation":`horizontal`,title:`Drag or use arrow keys to adjust`,className:ON,...l,onPointerCancel:l.onPointerUp,children:s(e)}),(0,y.jsx)(PS,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:DN,children:(0,y.jsx)(ky,{})})]})},AN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,jN=`text-xs font-normal text-muted-foreground`,MN=e=>e.toFixed(1),NN=({fontId:e,fontItems:t,isFontSelectOpen:n,onFontChange:r,onFontPreview:i,onFontSelectOpenChange:a,onOpenLocalFontPicker:o,fontSize:s,onFontSizeChange:c,lineHeight:l,onLineHeightChange:u})=>(0,y.jsxs)(ZA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(QA,{className:AN,children:`Font`}),(0,y.jsx)(gN,{value:e,items:t,ariaLabel:`select font`,placeholder:`Font`,open:n,onValueChange:r,onOpenChange:a,onItemHover:i,footerSlot:(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs text-muted-foreground outline-none transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:bg-foreground/10 focus-visible:text-foreground`,onClick:o,children:[(0,y.jsx)(Oy,{className:`size-3`}),(0,y.jsx)(`span`,{children:`Local font…`})]})}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:jN,children:`Size`}),(0,y.jsx)(kN,{value:s,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:c})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:jN,children:`Line height`}),(0,y.jsx)(kN,{value:l,min:1,max:2,step:ad,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:MN,onValueChange:u})]})]}),PN=b.createContext(void 0);function FN(){let e=b.useContext(PN);if(e===void 0)throw Error(iS(63));return e}var IN=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),LN={...zS,checked(e){return e?{[IN.checked]:``}:{[IN.unchecked]:``}}},RN=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...x}=e,{clearErrors:S}=US(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=VS(),{labelId:P}=XS(),F=j||m,I=M??l,L=Z(d),ee=b.useRef(null),R=dS(ee,c,N.inputRef),te=b.useRef(null),z=JS(),B=eC({id:s,implicit:!1,controlRef:te}),V=u?void 0:B,[ne,re]=fT({controlled:n,default:!!i,name:`Switch`,state:`checked`});pT(te,{id:z,value:ne}),Q(()=>{ee.current&&D(ee.current.checked)},[ee,D]),Tk(ne,()=>{S(I),T(ne!==E.initialValue),D(ne),k()?N.commit(ne):N.commit(ne,!0)});let{getButtonProps:H,buttonRef:ie}=cS({disabled:F,native:u}),ae=ZS(a,P,ee,!u,V),oe={id:u?B:z,role:`switch`,"aria-checked":ne,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ae,onFocus(){F||O(!0)},onBlur(){let e=ee.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),ee.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},se=b.useMemo(()=>Ux({checked:ne,disabled:F,form:o,id:V,name:I,required:p,style:I?lE:cE,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:R,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=OT(mT,e.nativeEvent);L?.(t,n),!n.isCanceled&&re(t)},onFocus(){te.current?.focus()}},N.getInputValidationProps,_===void 0?SS:{value:_}),[ne,F,o,R,V,I,L,f,p,re,N,_]),ce=b.useMemo(()=>({...C,checked:ne,disabled:F,readOnly:f,required:p}),[C,ne,F,f,p]),le=ES(`span`,e,{state:ce,ref:[t,te,ie],props:[oe,N.getValidationProps,x,H],stateAttributesMapping:LN});return(0,y.jsxs)(PN.Provider,{value:ce,children:[le,!ne&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...se,suppressHydrationWarning:!0})]})}),zN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=VS(),s=FN();return ES(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:LN,props:a})});function BN({className:e,size:t=`default`,...n}){return(0,y.jsx)(RN,{"data-slot":`switch`,"data-size":t,className:cx(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,y.jsx)(zN,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%_-_2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%_-_2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var VN=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],HN=`block`,UN=VN.map(e=>e.id),WN=e=>typeof e==`string`&&UN.includes(e),GN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,KN=`text-xs font-normal text-muted-foreground`,qN=VN.map(e=>({id:e.id,label:e.name})),JN=({cursorStyle:e,onCursorStyleChange:t,onCursorStyleSelectOpenChange:n,onCursorStyleHover:r,cursorBlink:i,onCursorBlinkChange:a})=>(0,y.jsxs)(ZA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(QA,{className:GN,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:KN,children:`Style`}),(0,y.jsx)(gN,{value:e,items:qN,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:t,onOpenChange:n,onItemHover:r})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:KN,children:`Blink`}),(0,y.jsx)(BN,{"aria-label":`toggle cursor blink`,checked:i,onCheckedChange:a})]})]}),YN=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],XN=1e4,ZN=YN.map(e=>e.value),QN=e=>ZN.includes(e),$N=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,eP=`text-xs font-normal text-muted-foreground`,tP=YN.map(e=>({id:String(e.value),label:e.label})),nP=({scrollback:e,onScrollbackChange:t,scrollOnUserInput:n,onScrollOnUserInputChange:r})=>(0,y.jsxs)(ZA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(QA,{className:$N,children:`Scrollback`}),(0,y.jsx)(gN,{value:String(e),items:tP,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:t}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(Fj,{children:[(0,y.jsx)(Ij,{render:(0,y.jsx)(`span`,{className:eP}),children:`Pin to bottom on input`}),(0,y.jsx)(Lj,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, typing scrolls the viewport back to the bottom. When off, the viewport stays where you scrolled — useful for reading history while typing.`})]}),(0,y.jsx)(BN,{"aria-label":`toggle pin to bottom on input`,checked:n,onCheckedChange:r})]})]});function rP(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=fT({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=dT(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=JS(),[_,v]=b.useState(),y=_??g,[x,S]=b.useState(!1),[C,w]=b.useState(!1),T=b.useRef(null),E=b.useRef(null),D=b.useRef(null),O=b.useRef(null),k=lT(O,!1),A=Z(e=>{let t=!o,n=OT(hT,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!x&&!C&&(E.current!=null&&E.current!==`css-animation`&&!c&&t&&l(!0),E.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),E.current===`none`&&c&&!t&&l(!1)});return Q(()=>{a&&E.current===`none`&&!o&&l(!1)},[a,o,t,l]),b.useMemo(()=>({abortControllerRef:T,animationTypeRef:E,disabled:i,handleTrigger:A,height:p,mounted:c,open:o,panelId:y,panelRef:O,runOnceAnimationsFinish:k,setDimensions:h,setHiddenUntilFound:S,setKeepMounted:w,setMounted:l,setOpen:s,setPanelIdState:v,setVisible:f,transitionDimensionRef:D,transitionStatus:u,visible:d,width:m}),[T,E,i,A,p,c,o,y,O,k,h,S,w,l,s,f,D,u,d,m])}var iP=b.createContext(void 0);function aP(){let e=b.useContext(iP);if(e===void 0)throw Error(iS(15));return e}var oP=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=iT.startingStyle]=`startingStyle`,e[e.endingStyle=iT.endingStyle]=`endingStyle`,e}({}),sP=function(e){return e.panelOpen=`data-panel-open`,e}({}),cP={[oP.open]:``},lP={[oP.closed]:``},uP={open(e){return e?{[sP.panelOpen]:``}:null}},dP={open(e){return e?cP:lP},...sT},fP=b.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Z(o),d=rP({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=b.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=b.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=ES(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:dP});return(0,y.jsx)(iP.Provider,{value:p,children:m})}),pP={...uP,...sT},mP=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=aP(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=cS({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return ES(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:pP})}),hP=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function gP(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:g,transitionDimensionRef:_,visible:v,width:y}=e,x=b.useRef(!1),S=b.useRef(null),C=b.useRef(u),w=b.useRef(u),T=nT(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=dS(r,d,Z(e=>{if(!e)return;if(n.current==null||_.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(hP.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?_.current=`width`:_.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||y===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),w.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=tT.request(()=>{w.current=!1,r=tT.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{tT.cancel(t),tT.cancel(r)}}));return Q(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!w.current&&!o&&e.setAttribute(oP.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=tT.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=oP.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),T.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{tT.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),Q(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(S.current=e.style.animationName||S.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!C.current&&!x.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),g(!0)):(t.current=new AbortController,f(()=>{m(!1),g(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,g,v]),Yw(()=>{let e=tT.request(()=>{C.current=!1});return()=>tT.cancel(e)}),Q(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&x.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=tT.request(()=>{x.current=!1,n=tT.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{tT.cancel(t),tT.cancel(n)}},[a,u,d,p]),Q(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(oP.startingStyle,``))},[a,E,n,d]),b.useEffect(function(){let e=d.current;if(!e)return;function t(e){x.current=!0,h(!0),l(!0,OT(mT,e))}return VT(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var _P=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),vP=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=aP(),j=r??!1,M=i??!1;Q(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),Q(()=>{y(j)},[y,j]),Q(()=>{x(M)},[x,M]);let{props:N}=gP({abortControllerRef:l,animationTypeRef:u,externalRef:t,height:d,hiddenUntilFound:j,id:h,keepMounted:M,mounted:f,onOpenChange:p,open:m,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setMounted:S,setOpen:w,setVisible:T,transitionDimensionRef:D,visible:O,width:k});uT({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=ES(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[_P.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[_P.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:dP});return M||j||f?P:null});function yP({...e}){return(0,y.jsx)(fP,{"data-slot":`collapsible`,...e})}function bP({...e}){return(0,y.jsx)(mP,{"data-slot":`collapsible-trigger`,...e})}function xP({...e}){return(0,y.jsx)(vP,{"data-slot":`collapsible-content`,...e})}var SP=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,CP=`text-xs font-normal text-muted-foreground`,wP=({label:e,value:t,title:n,valueClassName:r})=>(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:CP,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:cx(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),TP=({sessionInfo:e})=>e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(JA,{className:`bg-border/40`}),(0,y.jsxs)(yP,{defaultOpen:!1,children:[(0,y.jsx)(bP,{render:(0,y.jsxs)(`button`,{type:`button`,className:`group/shell flex w-full items-center justify-between gap-2 rounded-sm py-1 text-left transition-colors outline-none hover:text-foreground/90 focus-visible:text-foreground/90`,children:[(0,y.jsx)(`span`,{className:SP,children:`Shell`}),(0,y.jsx)(Cy,{className:`size-3 text-muted-foreground/60 transition-transform duration-200 ease-snappy will-change-transform group-aria-expanded/shell:rotate-180`})]})}),(0,y.jsx)(xP,{className:`h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-snappy data-closed:h-0`,children:(0,y.jsxs)(`dl`,{className:`flex flex-col gap-1 pt-2 text-xs`,children:[(0,y.jsx)(wP,{label:`Name`,value:e.shellName}),(0,y.jsx)(wP,{label:`Path`,value:e.shell,title:e.shell}),(0,y.jsx)(wP,{label:`PID`,value:String(e.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(wP,{label:`Cwd`,value:e.cwd,title:e.cwd})]})})]})]}):null,EP=Ly(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>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:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,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 DP({className:e,variant:t=`default`,render:n,...r}){return bN({defaultTagName:`span`,props:Ux({className:cx(EP({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var OP=Object.fromEntries(Ad.map(e=>[e.id,{fontFamily:e.family}])),kP=Ad.map(e=>({id:e.id,label:e.name,itemStyle:OP[e.id]})),AP=e=>({id:md,label:(0,y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:e}),(0,y.jsx)(DP,{variant:`secondary`,className:`h-4 px-1.5 text-[10px] font-medium`,children:`Local`})]}),itemStyle:{fontFamily:`"${wd(e)}", ui-monospace, monospace`}}),jP=({onThemeChange:e,onThemePreview:t,fontId:n,onFontChange:r,onFontPreview:i,localFontFamily:a,onCursorStyleChange:o,onCursorStylePreview:s,onScrollbackChange:c})=>{let[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(!1);return{isDialogOpen:l,isFontSelectOpen:d,isLocalFontPickerOpen:p,setIsLocalFontPickerOpen:m,fontItems:(0,b.useMemo)(()=>n!==`local`||!a?kP:[...kP,AP(a)],[n,a]),handleDialogOpenChange:e=>{u(e),e||(f(!1),m(!1),t?.(null),i?.(null),s?.(null))},openLocalFontPicker:()=>{f(!1),m(!0)},handleThemeChange:t=>{t&&e(t)},handleFontChange:e=>{e&&r(e)},handleCursorStyleChange:e=>{WN(e)&&o(e)},handleScrollbackChange:e=>{if(e===null)return;let t=Number(e);QN(t)&&c(t)},handleThemeSelectOpenChange:e=>{e||t?.(null)},handleFontSelectOpenChange:e=>{f(e),e||i?.(null)},handleCursorStyleSelectOpenChange:e=>{e||s?.(null)},handleCursorStyleHover:e=>{WN(e)&&s?.(e)}}},MP=e=>{let{isDialogOpen:t,isFontSelectOpen:n,isLocalFontPickerOpen:r,setIsLocalFontPickerOpen:i,fontItems:a,handleDialogOpenChange:o,openLocalFontPicker:s,handleThemeChange:c,handleFontChange:l,handleCursorStyleChange:u,handleScrollbackChange:d,handleThemeSelectOpenChange:f,handleFontSelectOpenChange:p,handleCursorStyleSelectOpenChange:m,handleCursorStyleHover:h}=jP(e),{themeId:g,onThemePreview:_,fontId:v,onFontPreview:b,localFontFamily:x,onLocalFontChange:S,fontSize:C,onFontSizeChange:w,lineHeight:T,onLineHeightChange:E,cursorStyle:D,onCursorStylePreview:O,cursorBlink:k,onCursorBlinkChange:A,scrollback:j,scrollOnUserInput:M,onScrollOnUserInputChange:N,sessionInfo:P}=e;return(0,y.jsxs)(DA,{open:t,onOpenChange:o,children:[(0,y.jsxs)(Fj,{children:[(0,y.jsx)(Ij,{render:(0,y.jsx)(OA,{render:(0,y.jsx)(PS,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`})}),children:(0,y.jsx)(jy,{})}),t?null:(0,y.jsx)(Lj,{side:`bottom`,sideOffset:8,children:`Settings`})]}),(0,y.jsxs)(jA,{className:cx(`max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-4 sm:max-w-md`,PA),children:[(0,y.jsx)(MA,{className:`mb-4 pr-8`,children:(0,y.jsx)(NA,{children:`Settings`})}),(0,y.jsxs)(YA,{className:`gap-3`,children:[(0,y.jsx)(yN,{themeId:g,onThemeChange:c,onThemePreview:_,onOpenChange:f}),(0,y.jsx)(JA,{className:`bg-border/40`}),(0,y.jsx)(NN,{fontId:v,fontItems:a,isFontSelectOpen:n,onFontChange:l,onFontPreview:b,onFontSelectOpenChange:p,onOpenLocalFontPicker:s,fontSize:C,onFontSizeChange:w,lineHeight:T,onLineHeightChange:E}),(0,y.jsx)(JA,{className:`bg-border/40`}),(0,y.jsx)(JN,{cursorStyle:D,onCursorStyleChange:u,onCursorStyleSelectOpenChange:m,onCursorStyleHover:O?h:void 0,cursorBlink:k,onCursorBlinkChange:A}),(0,y.jsx)(JA,{className:`bg-border/40`}),(0,y.jsx)(nP,{scrollback:j,onScrollbackChange:d,scrollOnUserInput:M,onScrollOnUserInputChange:N}),(0,y.jsx)(TP,{sessionInfo:P??null})]})]}),(0,y.jsx)(GA,{open:r,onOpenChange:i,currentFamily:x,onApply:S})]})},NP=({activeThemeId:e,onThemeChange:t,onThemePreview:n,activeFontId:r,onFontChange:i,onFontPreview:a,activeLocalFontFamily:o,onLocalFontChange:s,activeFontSize:c,onFontSizeChange:l,activeLineHeight:u,onLineHeightChange:d,activeCursorStyle:f,onCursorStyleChange:p,onCursorStylePreview:m,activeCursorBlink:h,onCursorBlinkChange:g,activeScrollback:_,onScrollbackChange:v,activeScrollOnUserInput:b,onScrollOnUserInputChange:x,sessionInfo:S,newTabUrl:C,onOpenSearch:w,isMac:T,isSearchOpen:E})=>E?null:(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,"data-terminal-toolbar":!0,className:`absolute top-2 right-3 z-10 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,children:[(0,y.jsx)(MP,{themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,localFontFamily:o,onLocalFontChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,cursorStyle:f,onCursorStyleChange:p,onCursorStylePreview:m,cursorBlink:h,onCursorBlinkChange:g,scrollback:_,onScrollbackChange:v,scrollOnUserInput:b,onScrollOnUserInputChange:x,sessionInfo:S}),(0,y.jsxs)(Fj,{children:[(0,y.jsx)(Ij,{render:(0,y.jsx)(PS,{variant:`ghost`,size:`icon-sm`,onClick:w,"aria-label":`find in terminal`,className:`hover:text-foreground`}),children:(0,y.jsx)(Ay,{})}),(0,y.jsxs)(Lj,{side:`bottom`,sideOffset:8,children:[`Find `,T?`(⌘F)`:`(Ctrl+F)`]})]}),(0,y.jsxs)(Fj,{children:[(0,y.jsx)(Ij,{render:(0,y.jsx)(PS,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{href:C,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`}),children:(0,y.jsx)(ky,{})}),(0,y.jsx)(Lj,{side:`bottom`,sideOffset:8,children:`New shell (new tab)`})]})]}),PP=({exitInfo:e})=>e?(0,y.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10 inline-flex items-center rounded-md border border-red-500/30 bg-red-500/10 px-2 py-0.5 text-xs font-medium text-red-400`,children:e.reason===`shell-exited`?e.exitCode===null?`exited`:`exited · code ${e.exitCode}`:`disconnected · code ${e.closeCode}`}):null,FP=(e,t)=>{let n=null,r=()=>{n=null,e.style.height=`${t.height}px`,e.style.transform=t.offsetTop?`translateY(${t.offsetTop}px)`:``},i=()=>{n===null&&(n=window.requestAnimationFrame(r))};return i(),t.addEventListener(`resize`,i),t.addEventListener(`scroll`,i),()=>{n!==null&&window.cancelAnimationFrame(n),t.removeEventListener(`resize`,i),t.removeEventListener(`scroll`,i),e.style.height=``,e.style.transform=``}},IP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!t||!n)return;let r=e.current,i=window.visualViewport;if(!(!r||!i))return FP(r,i)},[t,n,e])},LP=e=>{(0,b.useEffect)(()=>{if(!e)return;let t=new URL(window.location.href);t.searchParams.set(`cwd`,e),window.history.replaceState(null,``,t)},[e])},RP=(e,t)=>{(0,b.useEffect)(()=>{t?.(e)},[e,t])},zP=()=>typeof navigator<`u`&&navigator.vendor===`Apple Computer, Inc.`,BP=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},VP=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,HP=()=>({isMac:(0,b.useMemo)(BP,[]),isTouchDevice:(0,b.useMemo)(VP,[]),isAppleWebKit:(0,b.useMemo)(zP,[])}),UP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!e)return;let r=window.setInterval(()=>{t()},n);return()=>window.clearInterval(r)},[e,t,n])},WP=(e,t,n)=>{let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(0),[s,c]=(0,b.useState)(``),[l,u]=(0,b.useState)({resultIndex:-1,resultCount:0}),d=(0,b.useRef)(null),f=(0,b.useCallback)(t=>{if(!t){e.current?.clearDecorations(),u({resultIndex:-1,resultCount:0});return}e.current?.findNext(t)},[e]),p=(0,b.useCallback)(t=>{t&&e.current?.findPrevious(t)},[e]),m=(0,b.useCallback)(()=>{i(!1),c(``),u({resultIndex:-1,resultCount:0}),e.current?.clearDecorations(),t.current?.()},[e,t]),h=(0,b.useCallback)(()=>{i(!0),o(e=>e+1)},[]);return d.current=h,{isSearchOpen:r,setIsSearchOpen:i,searchOpenAttempt:a,searchQuery:s,searchResults:l,setSearchResults:u,openSearchOverlayRef:d,openSearchOverlay:h,handleSearchInputChange:(0,b.useCallback)(e=>{let t=e.target.value;c(t),f(t)},[f]),handleSearchKeyDown:(0,b.useCallback)(e=>{if(ry(e.nativeEvent,n)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),m();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?p(s):f(s))},[m,f,p,n,s]),handleSearchClose:m,findNextMatch:f,findPreviousMatch:p}},GP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!e)return;let t=n.current;t&&(t.focus(),t.select())},[e,t,n])},KP=async e=>{if(!(typeof document>`u`)&&e.name)try{await Promise.all([document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`)])}catch{}},qP=(e,t,n,r)=>{n?.clearTextureAtlas(),e.options.fontFamily=``,e.options.fontFamily=r,uy(e,t),n?.clearTextureAtlas()},JP=(e,t,n,r)=>{(0,b.useEffect)(()=>{if(!e.current)return;let i=!1;return KP(r).then(()=>{if(i)return;let a=e.current;if(!a)return;let o=t.current;o&&qP(a,o,n.current,r.family)}),()=>{i=!0}},[r,e,t,n])},YP=(e,t,n,r)=>{(0,b.useEffect)(()=>{let i=e.current;if(!i)return;i.options.fontSize=n,i.options.lineHeight=r;let a=t.current;a&&uy(i,a)},[n,r,e,t])},XP=(e,t,n,r,i,a)=>{(0,b.useEffect)(()=>{let o=e.current;o&&(o.options.theme=t.colors,o.options.cursorStyle=n,o.options.cursorBlink=r,o.options.scrollback=i,o.options.scrollOnUserInput=a)},[t,n,r,i,a,e])},ZP=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},QP=1/ad,$P=e=>Math.round(e*QP)/QP,eF=e=>{if(!Number.isFinite(e))return id;let t=$P(e);return t<1?1:t>2?2:t},tF=(e,t,n)=>({load:()=>{if(typeof window>`u`)return t;try{let r=window.localStorage.getItem(e);return r===null||r===``?t:n?n(r):r}catch{return t}},store:t=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,String(t))}catch{}}}),nF=tF(pd,null,e=>e.trim()||null),rF=()=>nF.load(),iF=e=>nF.store(e),aF=tF(dd,Id,e=>Ld(e).id),oF=()=>aF.load(),sF=e=>aF.store(e),cF=tF(fd,jd,e=>e===`local`?nF.load()?md:jd:Md(e).id),lF=()=>cF.load(),uF=e=>cF.store(e),dF=tF(hd,13,e=>ZP(Number(e))),fF=()=>dF.load(),pF=e=>dF.store(e),mF=tF(gd,id,e=>eF(Number(e))),hF=()=>mF.load(),gF=e=>mF.store(e),_F=tF(_d,HN,e=>WN(e)?e:HN),vF=()=>_F.load(),yF=e=>_F.store(e),bF=tF(vd,!0,e=>e===`true`?!0:e!==`false`),xF=()=>bF.load(),SF=e=>bF.store(e),CF=tF(yd,XN,e=>{let t=Number(e);return QN(t)?t:XN}),wF=()=>CF.load(),TF=e=>CF.store(e),EF=tF(bd,!0,e=>e===`true`?!0:e!==`false`),DF=()=>EF.load(),OF=e=>EF.store(e),kF=(e,t,n)=>{let r=(0,b.useRef)(oF()),i=(0,b.useRef)(lF()),a=(0,b.useRef)(rF()),o=(0,b.useRef)(fF()),s=(0,b.useRef)(hF()),c=(0,b.useRef)(vF()),l=(0,b.useRef)(xF()),u=(0,b.useRef)(wF()),d=(0,b.useRef)(DF()),[f,p]=(0,b.useState)(r.current),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(i.current),[v,y]=(0,b.useState)(a.current),[x,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(o.current),[T,E]=(0,b.useState)(s.current),[D,O]=(0,b.useState)(c.current),[k,A]=(0,b.useState)(null),[j,M]=(0,b.useState)(l.current),[N,P]=(0,b.useState)(u.current),[F,I]=(0,b.useState)(d.current),L=m??f,ee=(0,b.useMemo)(()=>Ld(L),[L]),R=x??g;return{initialThemeIdRef:r,initialFontIdRef:i,initialLocalFontFamilyRef:a,initialFontSizeRef:o,initialLineHeightRef:s,initialCursorStyleRef:c,initialCursorBlinkRef:l,initialScrollbackRef:u,initialScrollOnUserInputRef:d,activeThemeId:f,setActiveThemeId:p,previewThemeId:m,setPreviewThemeId:h,activeFontId:g,setActiveFontId:_,activeLocalFontFamily:v,setActiveLocalFontFamily:y,previewFontId:x,setPreviewFontId:S,activeFontSize:C,setActiveFontSize:w,activeLineHeight:T,setActiveLineHeight:E,activeCursorStyle:D,setActiveCursorStyle:O,previewCursorStyle:k,setPreviewCursorStyle:A,activeCursorBlink:j,setActiveCursorBlink:M,activeScrollback:N,setActiveScrollback:P,activeScrollOnUserInput:F,setActiveScrollOnUserInput:I,effectiveTheme:ee,effectiveFont:(0,b.useMemo)(()=>Md(R,v),[R,v]),newTabUrl:(0,b.useMemo)(()=>Qv(n),[n]),handleThemeChange:(0,b.useCallback)(e=>{p(e),h(null),sF(e)},[]),handlePreviewTheme:(0,b.useCallback)(e=>{h(e)},[]),handleFontChange:(0,b.useCallback)(e=>{_(e),S(null),uF(e)},[]),handlePreviewFont:(0,b.useCallback)(e=>{S(e)},[]),handleLocalFontChange:(0,b.useCallback)(e=>{y(e),_(md),S(null),iF(e),uF(md)},[]),handleFontSizeChange:(0,b.useCallback)(e=>{let t=ZP(e);w(t),pF(t)},[]),handleLineHeightChange:(0,b.useCallback)(e=>{let t=eF(e);E(t),gF(t)},[]),handleCursorStyleChange:(0,b.useCallback)(e=>{O(e),A(null),yF(e)},[]),handlePreviewCursor:(0,b.useCallback)(e=>{A(e)},[]),handleCursorBlinkChange:(0,b.useCallback)(e=>{M(e),SF(e)},[]),handleScrollbackChange:(0,b.useCallback)(e=>{P(e),TF(e)},[]),handleScrollOnUserInputChange:(0,b.useCallback)(e=>{I(e),OF(e)},[])}},AF=(e,t,n)=>{(0,b.useEffect)(()=>{let r=e.current;if(!r)return;let i=0,a=0,o=!1,s=new AbortController,c=()=>{r.textarea&&(r.textarea.inputMode=``),r.focus()},l=()=>{t&&r.textarea&&(r.textarea.inputMode=`none`),r.focus()};if(n.current=l,t){let e=s.signal,t=()=>{r.textarea&&(r.textarea.inputMode=`none`)},n=()=>{r.textarea&&(r.textarea.blur(),r.textarea.inputMode=`none`)};t(),r.textarea?.addEventListener(`blur`,t,{signal:e});let l=window.visualViewport;if(l){let t=l.height,r=l.width;l.addEventListener(`resize`,()=>{let e=l.height,i=l.width,a=e>t+150,o=Math.abs(i-r)<20;a&&o&&n(),t=e,r=i},{signal:e})}r.element?.addEventListener(`touchstart`,e=>{if(e.touches.length!==1){o=!0;return}i=e.touches[0].clientX,a=e.touches[0].clientY,o=!1},{capture:!0,passive:!0,signal:e}),r.element?.addEventListener(`touchmove`,e=>{if(e.touches.length!==1){o=!0;return}Math.hypot(e.touches[0].clientX-i,e.touches[0].clientY-a)>10&&(o=!0)},{capture:!0,passive:!0,signal:e}),r.element?.addEventListener(`touchend`,e=>{if(o){e.preventDefault();return}c()},{capture:!0,passive:!1,signal:e})}return l(),()=>{s.abort(),n.current=null}},[e,t,n])},jF=(e,t)=>{(0,b.useEffect)(()=>()=>{e.current!==null&&(window.clearTimeout(e.current),e.current=null),t.current!==null&&(window.clearTimeout(t.current),t.current=null)},[e,t])},MF=(e,t)=>`\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,NF=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,PF=({terminalRef:e,flowControllerRef:t,exitedRef:n,lastTitleRef:r,resetFaviconRef:i,noteOutputActivityRef:a,liveCwdRef:o,isReconnectingRef:s,retryFeedbackTimerRef:c,copyFeedbackTimerRef:l,setExitInfo:u,setSessionInfo:d,setConsecutiveFailures:f,setHasCopiedRestartCommand:p,setIsRetryingConnection:m,setLiveCwd:h})=>{let g=(0,b.useRef)(null),_=(0,b.useRef)(null),v=(0,b.useRef)(null),y=(0,b.useCallback)(e=>{g.current?.readyState===WebSocket.OPEN&&g.current.send(JSON.stringify(e))},[]);return(0,b.useEffect)(()=>{let c=!1,l=!1,p=null,m=()=>{if(t.current?.clear(),c)return;let u=new WebSocket(Zv(o.current,_.current));u.binaryType=`arraybuffer`,g.current=u,u.addEventListener(`open`,()=>{c||g.current!==u||(l=!0,f(0),e.current&&y({type:`resize`,cols:e.current.cols,rows:e.current.rows}),s.current=!1)}),u.addEventListener(`message`,e=>{if(c||g.current!==u)return;if(e.data instanceof ArrayBuffer){t.current?.write(new Uint8Array(e.data)),a.current?.();return}if(typeof e.data!=`string`)return;let n;try{n=JSON.parse(e.data)}catch{return}if(typeof n!=`object`||!n||typeof n.type!=`string`)return;let o=n;if(o.type===`output`)t.current?.write(o.data),a.current?.();else if(o.type===`title`){let e=o.title.trim();if(!e)return;r.current=e,document.title=e}else o.type===`session`?(_.current=o.id,d({id:o.id,shell:o.shell,shellName:o.shellName,pid:o.pid,cwd:o.cwd}),h(o.cwd)):o.type===`cwd`?h(o.cwd):o.type===`exit`&&(i.current?.(),b(o.code))}),u.addEventListener(`close`,e=>{if(g.current===u&&(g.current=null,s.current=!1,!c&&!n.current)){if(l){console.warn(`[localterm] websocket closed: code=${e.code} reason=${JSON.stringify(e.reason)} wasClean=${e.wasClean}`),x(e.code,e.reason,e.wasClean);return}f(e=>e+1),p=window.setTimeout(m,nd)}}),u.addEventListener(`error`,()=>{console.warn(`[localterm] websocket error`);try{u.close()}catch{}})},b=t=>{n.current||(n.current=!0,i.current?.(),sf(`dead`),e.current?.write(NF(t)),document.title=`† ${r.current||`localterm`}`,u({reason:`shell-exited`,exitCode:t}),d(null))},x=(t,a,o)=>{n.current||(n.current=!0,i.current?.(),sf(`dead`),e.current?.write(MF(t,a)),document.title=`† ${r.current||`localterm`}`,u({reason:`connection-lost`,closeCode:t,closeReason:a,wasClean:o}),d(null))};return v.current=()=>{if(!c){n.current=!1,l=!1,u(null),d(null),f(0),sf(`idle`),p!==null&&(window.clearTimeout(p),p=null);try{g.current?.close()}catch{}g.current=null,m()}},m(),()=>{c=!0,v.current=null,p!==null&&window.clearTimeout(p);try{g.current?.close()}catch{}g.current=null}},[]),{send:y,triggerManualReconnect:(0,b.useCallback)(()=>{s.current||(s.current=!0,m(!0),v.current?.(),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{c.current=null,m(!1)},800))},[]),copyRestartCommand:(0,b.useCallback)(()=>{navigator.clipboard.writeText(od).then(()=>{p(!0),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,p(!1)},sd)}).catch(()=>{})},[])}},FF=({onModalOpenChange:e}={})=>{let t=(0,b.useRef)(null),n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(null),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(!1),d=(0,b.useRef)(null),f=(0,b.useRef)(null),p=(0,b.useRef)(!1),m=(0,b.useRef)(``),h=(0,b.useRef)(null),g=(0,b.useRef)(null),_=(0,b.useRef)(null),[v,x]=(0,b.useState)(null),[C,w]=(0,b.useState)(0),[T,E]=(0,b.useState)(!1),[O,k]=(0,b.useState)(!1),[A,j]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),{initialThemeIdRef:P,initialFontIdRef:F,initialLocalFontFamilyRef:I,initialFontSizeRef:L,initialLineHeightRef:ee,initialCursorStyleRef:R,initialCursorBlinkRef:te,initialScrollbackRef:z,initialScrollOnUserInputRef:B,activeThemeId:V,setActiveThemeId:ne,activeFontId:re,setActiveFontId:H,activeLocalFontFamily:ie,setActiveLocalFontFamily:ae,activeFontSize:oe,setActiveFontSize:se,activeLineHeight:ce,setActiveLineHeight:le,activeCursorStyle:ue,setActiveCursorStyle:de,previewCursorStyle:fe,activeCursorBlink:pe,setActiveCursorBlink:me,activeScrollback:he,setActiveScrollback:ge,activeScrollOnUserInput:_e,setActiveScrollOnUserInput:ve,effectiveTheme:ye,effectiveFont:be,newTabUrl:xe,handleThemeChange:Se,handlePreviewTheme:Ce,handleFontChange:we,handlePreviewFont:Te,handleLocalFontChange:Ee,handleFontSizeChange:De,handleLineHeightChange:Oe,handleCursorStyleChange:ke,handlePreviewCursor:Ae,handleCursorBlinkChange:je,handleScrollbackChange:Me,handleScrollOnUserInputChange:Ne}=kF(r,i,M),{isMac:Pe,isTouchDevice:Fe,isAppleWebKit:Ie}=HP();IP(t,Fe,Ie),AF(r,Fe,d);let{isSearchOpen:Le,searchOpenAttempt:Re,searchQuery:ze,searchResults:Be,setSearchResults:Ve,openSearchOverlay:He,handleSearchInputChange:Ue,handleSearchKeyDown:We,findNextMatch:Ge,findPreviousMatch:Ke,openSearchOverlayRef:qe}=WP(o,d,Pe),Ye=fe??ue,Ze=ye.colors.background??`#101010`,{send:Qe,triggerManualReconnect:$e,copyRestartCommand:et}=PF({terminalRef:r,flowControllerRef:g,exitedRef:p,lastTitleRef:m,resetFaviconRef:h,noteOutputActivityRef:_,liveCwdRef:f,isReconnectingRef:u,retryFeedbackTimerRef:c,copyFeedbackTimerRef:l,setExitInfo:x,setSessionInfo:j,setConsecutiveFailures:w,setHasCopiedRestartCommand:E,setIsRetryingConnection:k,setLiveCwd:N,setActiveThemeId:ne,setActiveFontId:H,setActiveLocalFontFamily:ae,setActiveFontSize:se,setActiveLineHeight:le,setActiveCursorStyle:de,setActiveCursorBlink:me,setActiveScrollback:ge,setActiveScrollOnUserInput:ve,initialThemeIdRef:P,initialFontIdRef:F,initialLocalFontFamilyRef:I,initialFontSizeRef:L,initialLineHeightRef:ee,initialCursorStyleRef:R,initialCursorBlinkRef:te,initialScrollbackRef:z,initialScrollOnUserInputRef:B});(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let t=!1;p.current=!1,m.current=``;let s=null,c=null,l=`idle`;_.current=()=>{c!==null&&(window.clearTimeout(c),c=null),l===`idle`&&s===null&&(s=window.setTimeout(()=>{s=null,!(t||p.current)&&(l=`active`,sf(`active`))},250)),c=window.setTimeout(()=>{c=null,s!==null&&(window.clearTimeout(s),s=null),l===`active`&&(l=`idle`,sf(`idle`))},750)};let u=()=>{s!==null&&(window.clearTimeout(s),s=null),c!==null&&(window.clearTimeout(c),c=null),l===`active`&&(l=`idle`,sf(`idle`))};h.current=u;let f=Md(F.current,I.current),v=new td({allowProposedApi:!0,cursorBlink:te.current,cursorStyle:R.current,fontFamily:f.family,fontSize:L.current,lineHeight:ee.current,scrollback:z.current,theme:Ld(P.current).colors,macOptionIsMeta:!0,scrollOnUserInput:B.current});r.current=v;let y=new D;i.current=y,v.loadAddon(y),v.loadAddon(new Pn),v.loadAddon(new S),v.loadAddon(new Je),v.loadAddon(new Xe),v.loadAddon(new On);let b=new dt;v.loadAddon(b),o.current=b;let x=b.onDidChangeResults(Ve);v.open(e);try{let e=new oa;e.onContextLoss(()=>{a.current===e&&(a.current=null),e.dispose()}),v.loadAddon(e),a.current=e}catch{a.current=null}let C=v.textarea;C&&(C.autocomplete=`off`,C.setAttribute(`autocapitalize`,`off`),C.setAttribute(`autocorrect`,`off`),C.spellcheck=!1);let w=ay(v);v.parser.registerCsiHandler({final:`J`},cf),v.parser.registerCsiHandler({prefix:`?`,final:`J`},cf);let T=dy({terminal:v,fitAddon:y,sendResize:(e,t)=>Qe({type:`resize`,cols:e,rows:t}),resizeDebounceMs:80});g.current=ey({terminalWrite:(e,t)=>v.write(e,t),sendFlowPause:()=>Qe({type:`flow-pause`}),sendFlowResume:()=>Qe({type:`flow-resume`}),captureScrollAnchor:()=>T.captureAnchor(),restoreScrollAnchor:e=>T.restoreAnchor(e),hasScrollRestore:()=>T.hasResizeRestore(),restoreScrollFromResize:()=>T.restoreResizeScroll(),isExited:()=>p.current}),oy(v,{isMac:Pe,getKittyFlags:()=>w.getFlags(),openFindOverlay:()=>qe.current?.(),sendInput:e=>Qe({type:`input`,data:e}),isTouchDevice:Fe}),sy(v);let E=v.onTitleChange(e=>{if(p.current)return;let t=e.trim();t&&(m.current=t,document.title=t||`localterm`)});v.onData(e=>{for(let t of Rd(e,lf))Qe({type:`input`,data:t})}),v.onResize(({cols:e,rows:t})=>Qe({type:`resize`,cols:e,rows:t}));let O=new ResizeObserver(()=>T.scheduleFit());return O.observe(e),T.fitToContainer(),()=>{t=!0,d.current=null,qe.current=null,o.current=null,r.current=null,i.current=null,a.current=null,E.dispose(),x.dispose(),T.cleanupResizeScroll(),u(),O.disconnect(),v.dispose(),document.title=`localterm`}},[]),YP(r,i,oe,ce),XP(r,ye,Ye,pe,he,_e),JP(r,i,a,be),GP(Le,Re,s),jF(c,l),(0,b.useEffect)(()=>{f.current=M},[M]),LP(M);let tt=v!==null,nt=tt||!tt&&C>=2;return UP(v!==null&&v.reason!==`shell-exited`,$e,cd),RP(nt,e),(0,y.jsxs)(`main`,{ref:t,className:`h-dvh w-dvw pt-[env(safe-area-inset-top)] pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)]`,style:{background:Ze},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute inset-0`}),(0,y.jsx)(PP,{exitInfo:v}),(0,y.jsx)(NP,{activeThemeId:V,onThemeChange:Se,onThemePreview:Ce,activeFontId:re,onFontChange:we,onFontPreview:Te,activeLocalFontFamily:ie,onLocalFontChange:Ee,activeFontSize:oe,onFontSizeChange:De,activeLineHeight:ce,onLineHeightChange:Oe,activeCursorStyle:ue,onCursorStyleChange:ke,onCursorStylePreview:Ae,activeCursorBlink:pe,onCursorBlinkChange:je,activeScrollback:he,onScrollbackChange:Me,activeScrollOnUserInput:_e,onScrollOnUserInputChange:Ne,sessionInfo:A,newTabUrl:xe,onOpenSearch:He,isMac:Pe,isSearchOpen:Le}),Le&&(0,y.jsx)(zT,{searchInputRef:s,searchQuery:ze,searchResults:Be,onSearchChange:Ue,onKeyDown:We,onFindNext:()=>Ge(ze),onFindPrevious:()=>Ke(ze),isSearchOpen:Le})]}),(0,y.jsx)(EA,{isModalOpen:nt,exitInfo:v,isRetryingConnection:O,hasCopiedRestartCommand:T,newTabUrl:xe,onReconnect:$e,onCopyRestartCommand:et})]})},IF=()=>{let e=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let t=t=>{e.current||(t.preventDefault(),t.returnValue=``)};return window.addEventListener(`beforeunload`,t),()=>{window.removeEventListener(`beforeunload`,t)}},[]),(0,y.jsx)(FF,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[])})},LF=null,RF=null,zF=()=>LF||(typeof BroadcastChannel>`u`||typeof crypto>`u`||typeof crypto.randomUUID!=`function`?null:(RF=crypto.randomUUID(),LF=new BroadcastChannel(ud),LF.addEventListener(`message`,e=>{let t=e.data,n=ef();t.type===`ping`&&t.tabId!==RF&&t.hue===n&&LF&&RF&&LF.postMessage({type:`claimed`,tabId:RF,hue:n})}),LF));of(),sf(`idle`),(()=>{let e=zF();if(!e||!RF)return()=>{};let t=ef(),n=new Set,r=e=>{let r=e.data;r.type===`claimed`&&r.tabId!==RF&&r.hue===t&&n.add(r.hue)};e.addEventListener(`message`,r),e.postMessage({type:`ping`,tabId:RF,hue:t});let i=setTimeout(()=>{if(e.removeEventListener(`message`,r),n.size===0)return;let i=tf([...n]);i!==t&&(nf(i),sf(`idle`))},250);return()=>{clearTimeout(i),e.removeEventListener(`message`,r),LF?.close(),LF=null,RF=null}})(),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=Nd();if(!e)return;let t=document.createElement(`link`);t.id=xd,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})(),((e=!1)=>{e||typeof navigator>`u`||!(`serviceWorker`in navigator)||navigator.serviceWorker.register(`/sw.js`,{scope:`/`}).catch(e=>{console.warn(`[localterm] service worker registration failed`,e)})})();var BF=document.getElementById(`root`);if(!BF)throw Error(`Root element not found`);(0,x.createRoot)(BF,{onCaughtError(e,t){console.error(`[localterm] React caught error:`,e,t)},onUncaughtError(e,t){console.error(`[localterm] React uncaught error:`,e,t)},onRecoverableError(e,t){console.error(`[localterm] React recoverable error:`,e,t)}}).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(Pj,{delay:300,children:(0,y.jsx)(IF,{})})}));
121
+ //# sourceMappingURL=index-BvGM-LOc.js.map