@membank/dashboard 0.3.1 → 0.4.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.
@@ -1 +1 @@
1
- import{r as e,B as n}from"./index-D_ebWYgx.js";const r=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),e.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),a=e.forwardRef((t,l)=>e.createElement(n,{ref:l,...t,weights:r}));a.displayName="MagnifyingGlassIcon";const c=a;export{c as f};
1
+ import{r as e,B as n}from"./index-O2KJf81b.js";const r=new Map([["bold",e.createElement(e.Fragment,null,e.createElement("path",{d:"M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z"}))],["duotone",e.createElement(e.Fragment,null,e.createElement("path",{d:"M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z",opacity:"0.2"}),e.createElement("path",{d:"M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["fill",e.createElement(e.Fragment,null,e.createElement("path",{d:"M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z"}))],["light",e.createElement(e.Fragment,null,e.createElement("path",{d:"M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z"}))],["regular",e.createElement(e.Fragment,null,e.createElement("path",{d:"M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"}))],["thin",e.createElement(e.Fragment,null,e.createElement("path",{d:"M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z"}))]]),a=e.forwardRef((t,l)=>e.createElement(n,{ref:l,...t,weights:r}));a.displayName="MagnifyingGlassIcon";const c=a;export{c as f};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/memories-CNGWeG5C.js","assets/MagnifyingGlass.es-BZ4bp5Mi.js","assets/native-select-Dno9-QLw.js","assets/memories.index-BWhFh4-P.js","assets/memories._id-CR3hZNKX.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/memories-3VR4rZ5U.js","assets/MagnifyingGlass.es-B8P_LfEH.js","assets/native-select-DqP_P0PQ.js","assets/memories.index-ByQeKvpK.js","assets/memories._id-D3XqSd0M.js"])))=>i.map(i=>d[i]);
2
2
  var WE=Object.defineProperty;var O1=e=>{throw TypeError(e)};var eC=(e,t,s)=>t in e?WE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Qu=(e,t,s)=>eC(e,typeof t!="symbol"?t+"":t,s),bp=(e,t,s)=>t.has(e)||O1("Cannot "+s);var E=(e,t,s)=>(bp(e,t,"read from private field"),s?s.call(e):t.get(e)),pe=(e,t,s)=>t.has(e)?O1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ue=(e,t,s,r)=>(bp(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),Ae=(e,t,s)=>(bp(e,t,"access private method"),s);var Nl=(e,t,s,r)=>({set _(o){ue(e,t,o,s)},get _(){return E(e,t,r)}});function tC(e,t){for(var s=0;s<t.length;s++){const r=t[s];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(r,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function s(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=s(o);fetch(o.href,l)}})();function ew(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sp={exports:{}},Il={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -116,4 +116,4 @@ Or switch to syncMode "eager" if you want all data to sync automatically.`),e.st
116
116
 
117
117
  `)}_.write("payload.value = newResult;"),_.write("return payload;");const M=_.compile();return(R,A)=>M(b,R,A)};let l;const u=Vf,f=!v_.jitless,p=f&&v3.value,y=t.catchall;let m;e._zod.parse=(b,_)=>{m??(m=r.value);const v=b.value;return u(v)?f&&p&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(l||(l=o(t.shape)),b=l(b,_),y?z_([],v,b,_,m,e):b):s(b,_):(b.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),b)}});function TS(e,t,s,r){for(const l of e)if(l.issues.length===0)return t.value=l.value,t;const o=e.filter(l=>!ya(l));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:s,errors:e.map(l=>l.issues.map(u=>vo(u,r,yo())))}),t)}const Wk=ae("$ZodUnion",(e,t)=>{Pt.init(e,t),st(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),st(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),st(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),st(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(l=>l._zod.pattern);return new RegExp(`^(${o.map(l=>Dg(l.source)).join("|")})$`)}});const s=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,l)=>{if(s)return r(o,l);let u=!1;const f=[];for(const h of t.options){const p=h._zod.run({value:o.value,issues:[]},l);if(p instanceof Promise)f.push(p),u=!0;else{if(p.issues.length===0)return p;f.push(p)}}return u?Promise.all(f).then(h=>TS(h,o,e,l)):TS(f,o,e,l)}}),e5=ae("$ZodIntersection",(e,t)=>{Pt.init(e,t),e._zod.parse=(s,r)=>{const o=s.value,l=t.left._zod.run({value:o,issues:[]},r),u=t.right._zod.run({value:o,issues:[]},r);return l instanceof Promise||u instanceof Promise?Promise.all([l,u]).then(([h,p])=>OS(s,h,p)):OS(s,l,u)}});function Fm(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(fc(e)&&fc(t)){const s=Object.keys(t),r=Object.keys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of r){const u=Fm(e[l],t[l]);if(!u.valid)return{valid:!1,mergeErrorPath:[l,...u.mergeErrorPath]};o[l]=u.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const s=[];for(let r=0;r<e.length;r++){const o=e[r],l=t[r],u=Fm(o,l);if(!u.valid)return{valid:!1,mergeErrorPath:[r,...u.mergeErrorPath]};s.push(u.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function OS(e,t,s){const r=new Map;let o;for(const f of t.issues)if(f.code==="unrecognized_keys"){o??(o=f);for(const h of f.keys)r.has(h)||r.set(h,{}),r.get(h).l=!0}else e.issues.push(f);for(const f of s.issues)if(f.code==="unrecognized_keys")for(const h of f.keys)r.has(h)||r.set(h,{}),r.get(h).r=!0;else e.issues.push(f);const l=[...r].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(l.length&&o&&e.issues.push({...o,keys:l}),ya(e))return e;const u=Fm(t.value,s.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const t5=ae("$ZodEnum",(e,t)=>{Pt.init(e,t);const s=b_(t.entries),r=new Set(s);e._zod.values=r,e._zod.pattern=new RegExp(`^(${s.filter(o=>b3.has(typeof o)).map(o=>typeof o=="string"?od(o):o.toString()).join("|")})$`),e._zod.parse=(o,l)=>{const u=o.value;return r.has(u)||o.issues.push({code:"invalid_value",values:s,input:u,inst:e}),o}}),n5=ae("$ZodTransform",(e,t)=>{Pt.init(e,t),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new y_(e.constructor.name);const o=t.transform(s.value,s);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(s.value=u,s));if(o instanceof Promise)throw new wa;return s.value=o,s}});function MS(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const k_=ae("$ZodOptional",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",st(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),st(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${Dg(s.source)})?$`):void 0}),e._zod.parse=(s,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(l=>MS(l,s.value)):MS(o,s.value)}return s.value===void 0?s:t.innerType._zod.run(s,r)}}),s5=ae("$ZodExactOptional",(e,t)=>{k_.init(e,t),st(e._zod,"values",()=>t.innerType._zod.values),st(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(s,r)=>t.innerType._zod.run(s,r)}),i5=ae("$ZodNullable",(e,t)=>{Pt.init(e,t),st(e._zod,"optin",()=>t.innerType._zod.optin),st(e._zod,"optout",()=>t.innerType._zod.optout),st(e._zod,"pattern",()=>{const s=t.innerType._zod.pattern;return s?new RegExp(`^(${Dg(s.source)}|null)$`):void 0}),st(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(s,r)=>s.value===null?s:t.innerType._zod.run(s,r)}),r5=ae("$ZodDefault",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",st(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);if(s.value===void 0)return s.value=t.defaultValue,s;const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(l=>zS(l,t)):zS(o,t)}});function zS(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const o5=ae("$ZodPrefault",(e,t)=>{Pt.init(e,t),e._zod.optin="optional",st(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>(r.direction==="backward"||s.value===void 0&&(s.value=t.defaultValue),t.innerType._zod.run(s,r))}),a5=ae("$ZodNonOptional",(e,t)=>{Pt.init(e,t),st(e._zod,"values",()=>{const s=t.innerType._zod.values;return s?new Set([...s].filter(r=>r!==void 0)):void 0}),e._zod.parse=(s,r)=>{const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(l=>kS(l,e)):kS(o,e)}});function kS(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const l5=ae("$ZodCatch",(e,t)=>{Pt.init(e,t),st(e._zod,"optin",()=>t.innerType._zod.optin),st(e._zod,"optout",()=>t.innerType._zod.optout),st(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(l=>(s.value=l.value,l.issues.length&&(s.value=t.catchValue({...s,error:{issues:l.issues.map(u=>vo(u,r,yo()))},input:s.value}),s.issues=[]),s)):(s.value=o.value,o.issues.length&&(s.value=t.catchValue({...s,error:{issues:o.issues.map(l=>vo(l,r,yo()))},input:s.value}),s.issues=[]),s)}}),c5=ae("$ZodPipe",(e,t)=>{Pt.init(e,t),st(e._zod,"values",()=>t.in._zod.values),st(e._zod,"optin",()=>t.in._zod.optin),st(e._zod,"optout",()=>t.out._zod.optout),st(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(s,r)=>{if(r.direction==="backward"){const l=t.out._zod.run(s,r);return l instanceof Promise?l.then(u=>ff(u,t.in,r)):ff(l,t.in,r)}const o=t.in._zod.run(s,r);return o instanceof Promise?o.then(l=>ff(l,t.out,r)):ff(o,t.out,r)}});function ff(e,t,s){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},s)}const u5=ae("$ZodReadonly",(e,t)=>{Pt.init(e,t),st(e._zod,"propValues",()=>t.innerType._zod.propValues),st(e._zod,"values",()=>t.innerType._zod.values),st(e._zod,"optin",()=>{var s,r;return(r=(s=t.innerType)==null?void 0:s._zod)==null?void 0:r.optin}),st(e._zod,"optout",()=>{var s,r;return(r=(s=t.innerType)==null?void 0:s._zod)==null?void 0:r.optout}),e._zod.parse=(s,r)=>{if(r.direction==="backward")return t.innerType._zod.run(s,r);const o=t.innerType._zod.run(s,r);return o instanceof Promise?o.then(DS):DS(o)}});function DS(e){return e.value=Object.freeze(e.value),e}const f5=ae("$ZodCustom",(e,t)=>{Bs.init(e,t),Pt.init(e,t),e._zod.parse=(s,r)=>s,e._zod.check=s=>{const r=s.value,o=t.fn(r);if(o instanceof Promise)return o.then(l=>jS(l,s,r,e));jS(o,s,r,e)}});function jS(e,t,s,r){if(!e){const o={code:"custom",input:s,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(dc(o))}}var NS;class d5{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...s){const r=s[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const s=this._map.get(t);return s&&typeof s=="object"&&"id"in s&&this._idmap.delete(s.id),this._map.delete(t),this}get(t){const s=t._zod.parent;if(s){const r={...this.get(s)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function h5(){return new d5}(NS=globalThis).__zod_globalRegistry??(NS.__zod_globalRegistry=h5());const Xl=globalThis.__zod_globalRegistry;function p5(e,t){return new e({type:"string",...Me(t)})}function m5(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Me(t)})}function IS(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Me(t)})}function g5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Me(t)})}function y5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Me(t)})}function v5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Me(t)})}function b5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Me(t)})}function S5(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Me(t)})}function w5(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Me(t)})}function _5(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Me(t)})}function x5(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Me(t)})}function E5(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Me(t)})}function C5(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Me(t)})}function R5(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Me(t)})}function A5(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Me(t)})}function T5(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Me(t)})}function O5(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Me(t)})}function M5(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Me(t)})}function z5(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Me(t)})}function k5(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Me(t)})}function D5(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Me(t)})}function j5(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Me(t)})}function N5(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Me(t)})}function I5(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Me(t)})}function L5(e,t){return new e({type:"string",format:"date",check:"string_format",...Me(t)})}function B5(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Me(t)})}function U5(e,t){return new e({type:"string",format:"duration",check:"string_format",...Me(t)})}function P5(e,t){return new e({type:"boolean",...Me(t)})}function Z5(e){return new e({type:"unknown"})}function $5(e,t){return new e({type:"never",...Me(t)})}function D_(e,t){return new uk({check:"max_length",...Me(t),maximum:e})}function Kf(e,t){return new fk({check:"min_length",...Me(t),minimum:e})}function j_(e,t){return new dk({check:"length_equals",...Me(t),length:e})}function q5(e,t){return new hk({check:"string_format",format:"regex",...Me(t),pattern:e})}function V5(e){return new pk({check:"string_format",format:"lowercase",...Me(e)})}function H5(e){return new mk({check:"string_format",format:"uppercase",...Me(e)})}function K5(e,t){return new gk({check:"string_format",format:"includes",...Me(t),includes:e})}function F5(e,t){return new yk({check:"string_format",format:"starts_with",...Me(t),prefix:e})}function G5(e,t){return new vk({check:"string_format",format:"ends_with",...Me(t),suffix:e})}function Ha(e){return new bk({check:"overwrite",tx:e})}function Q5(e){return Ha(t=>t.normalize(e))}function Y5(){return Ha(e=>e.trim())}function J5(){return Ha(e=>e.toLowerCase())}function X5(){return Ha(e=>e.toUpperCase())}function W5(){return Ha(e=>y3(e))}function eD(e,t,s){return new e({type:"array",element:t,...Me(s)})}function tD(e,t,s){return new e({type:"custom",check:"custom",fn:t,...Me(s)})}function nD(e){const t=sD(s=>(s.addIssue=r=>{if(typeof r=="string")s.issues.push(dc(r,s.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=s.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),s.issues.push(dc(o))}},e(s.value,s)));return t}function sD(e,t){const s=new Bs({check:"custom",...Me(t)});return s._zod.check=e,s}function N_(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Xl,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function ln(e,t,s={path:[],schemaPath:[]}){var y,m;var r;const o=e._zod.def,l=t.seen.get(e);if(l)return l.count++,s.schemaPath.includes(e)&&(l.cycle=s.path),l.schema;const u={schema:{},count:1,cycle:void 0,path:s.path};t.seen.set(e,u);const f=(m=(y=e._zod).toJSONSchema)==null?void 0:m.call(y);if(f)u.schema=f;else{const b={...s,schemaPath:[...s.schemaPath,e],path:s.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,b);else{const v=u.schema,S=t.processors[o.type];if(!S)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);S(e,t,v,b)}const _=e._zod.parent;_&&(u.ref||(u.ref=_),ln(_,t,b),t.seen.get(_).isParent=!0)}const h=t.metadataRegistry.get(e);return h&&Object.assign(u.schema,h),t.io==="input"&&yn(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((r=u.schema).default??(r.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function I_(e,t){var u,f,h,p;const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const y of e.seen.entries()){const m=(u=e.metadataRegistry.get(y[0]))==null?void 0:u.id;if(m){const b=r.get(m);if(b&&b!==y[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,y[0])}}const o=y=>{var S;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const x=(S=e.external.registry.get(y[0]))==null?void 0:S.id,T=e.external.uri??(O=>O);if(x)return{ref:T(x)};const M=y[1].defId??y[1].schema.id??`schema${e.counter++}`;return y[1].defId=M,{defId:M,ref:`${T("__shared")}#/${m}/${M}`}}if(y[1]===s)return{ref:"#"};const _=`#/${m}/`,v=y[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:_+v}},l=y=>{if(y[1].schema.$ref)return;const m=y[1],{ref:b,defId:_}=o(y);m.def={...m.schema},_&&(m.defId=_);const v=m.schema;for(const S in v)delete v[S];v.$ref=b};if(e.cycles==="throw")for(const y of e.seen.entries()){const m=y[1];if(m.cycle)throw new Error(`Cycle detected: #/${(f=m.cycle)==null?void 0:f.join("/")}/<root>
118
118
 
119
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const m=y[1];if(t===y[0]){l(y);continue}if(e.external){const _=(h=e.external.registry.get(y[0]))==null?void 0:h.id;if(t!==y[0]&&_){l(y);continue}}if((p=e.metadataRegistry.get(y[0]))==null?void 0:p.id){l(y);continue}if(m.cycle){l(y);continue}if(m.count>1&&e.reused==="ref"){l(y);continue}}}function L_(e,t){var u,f,h;const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const y=e.seen.get(p);if(y.ref===null)return;const m=y.def??y.schema,b={...m},_=y.ref;if(y.ref=null,_){r(_);const S=e.seen.get(_),x=S.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(x)):Object.assign(m,x),Object.assign(m,b),p._zod.parent===_)for(const M in m)M==="$ref"||M==="allOf"||M in b||delete m[M];if(x.$ref&&S.def)for(const M in m)M==="$ref"||M==="allOf"||M in S.def&&JSON.stringify(m[M])===JSON.stringify(S.def[M])&&delete m[M]}const v=p._zod.parent;if(v&&v!==_){r(v);const S=e.seen.get(v);if(S!=null&&S.schema.$ref&&(m.$ref=S.schema.$ref,S.def))for(const x in m)x==="$ref"||x==="allOf"||x in S.def&&JSON.stringify(m[x])===JSON.stringify(S.def[x])&&delete m[x]}e.override({zodSchema:p,jsonSchema:m,path:y.path??[]})};for(const p of[...e.seen.entries()].reverse())r(p[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(u=e.external)!=null&&u.uri){const p=(f=e.external.registry.get(t))==null?void 0:f.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}Object.assign(o,s.def??s.schema);const l=((h=e.external)==null?void 0:h.defs)??{};for(const p of e.seen.entries()){const y=p[1];y.def&&y.defId&&(l[y.defId]=y.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ff(t,"input",e.processors),output:Ff(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function yn(e,t){const s=t??{seen:new Set};if(s.seen.has(e))return!1;s.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return yn(r.element,s);if(r.type==="set")return yn(r.valueType,s);if(r.type==="lazy")return yn(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return yn(r.innerType,s);if(r.type==="intersection")return yn(r.left,s)||yn(r.right,s);if(r.type==="record"||r.type==="map")return yn(r.keyType,s)||yn(r.valueType,s);if(r.type==="pipe")return yn(r.in,s)||yn(r.out,s);if(r.type==="object"){for(const o in r.shape)if(yn(r.shape[o],s))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(yn(o,s))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(yn(o,s))return!0;return!!(r.rest&&yn(r.rest,s))}return!1}const iD=(e,t={})=>s=>{const r=N_({...s,processors:t});return ln(e,r),I_(r,e),L_(r,e)},Ff=(e,t,s={})=>r=>{const{libraryOptions:o,target:l}=r??{},u=N_({...o??{},target:l,io:t,processors:s});return ln(e,u),I_(u,e),L_(u,e)},rD={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oD=(e,t,s,r)=>{const o=s;o.type="string";const{minimum:l,maximum:u,format:f,patterns:h,contentEncoding:p}=e._zod.bag;if(typeof l=="number"&&(o.minLength=l),typeof u=="number"&&(o.maxLength=u),f&&(o.format=rD[f]??f,o.format===""&&delete o.format,f==="time"&&delete o.format),p&&(o.contentEncoding=p),h&&h.size>0){const y=[...h];y.length===1?o.pattern=y[0].source:y.length>1&&(o.allOf=[...y.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},aD=(e,t,s,r)=>{s.type="boolean"},lD=(e,t,s,r)=>{s.not={}},cD=(e,t,s,r)=>{},uD=(e,t,s,r)=>{const o=e._zod.def,l=b_(o.entries);l.every(u=>typeof u=="number")&&(s.type="number"),l.every(u=>typeof u=="string")&&(s.type="string"),s.enum=l},fD=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},dD=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},hD=(e,t,s,r)=>{const o=s,l=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof f=="number"&&(o.maxItems=f),o.type="array",o.items=ln(l.element,t,{...r,path:[...r.path,"items"]})},pD=(e,t,s,r)=>{var p;const o=s,l=e._zod.def;o.type="object",o.properties={};const u=l.shape;for(const y in u)o.properties[y]=ln(u[y],t,{...r,path:[...r.path,"properties",y]});const f=new Set(Object.keys(u)),h=new Set([...f].filter(y=>{const m=l.shape[y]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));h.size>0&&(o.required=Array.from(h)),((p=l.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:l.catchall?l.catchall&&(o.additionalProperties=ln(l.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},mD=(e,t,s,r)=>{const o=e._zod.def,l=o.inclusive===!1,u=o.options.map((f,h)=>ln(f,t,{...r,path:[...r.path,l?"oneOf":"anyOf",h]}));l?s.oneOf=u:s.anyOf=u},gD=(e,t,s,r)=>{const o=e._zod.def,l=ln(o.left,t,{...r,path:[...r.path,"allOf",0]}),u=ln(o.right,t,{...r,path:[...r.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,h=[...f(l)?l.allOf:[l],...f(u)?u.allOf:[u]];s.allOf=h},yD=(e,t,s,r)=>{const o=e._zod.def,l=ln(o.innerType,t,r),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,s.nullable=!0):s.anyOf=[l,{type:"null"}]},vD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},bD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,s.default=JSON.parse(JSON.stringify(o.defaultValue))},SD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,t.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},wD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=u},_D=(e,t,s,r)=>{const o=e._zod.def,l=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;ln(l,t,r);const u=t.seen.get(e);u.ref=l},xD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,s.readOnly=!0},B_=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},ED=ae("ZodISODateTime",(e,t)=>{Dk.init(e,t),bt.init(e,t)});function CD(e){return I5(ED,e)}const RD=ae("ZodISODate",(e,t)=>{jk.init(e,t),bt.init(e,t)});function AD(e){return L5(RD,e)}const TD=ae("ZodISOTime",(e,t)=>{Nk.init(e,t),bt.init(e,t)});function OD(e){return B5(TD,e)}const MD=ae("ZodISODuration",(e,t)=>{Ik.init(e,t),bt.init(e,t)});function zD(e){return U5(MD,e)}const kD=(e,t)=>{E_.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:s=>O3(e,s)},flatten:{value:s=>T3(e,s)},addIssue:{value:s=>{e.issues.push(s),e.message=JSON.stringify(e.issues,Km,2)}},addIssues:{value:s=>{e.issues.push(...s),e.message=JSON.stringify(e.issues,Km,2)}},isEmpty:{get(){return e.issues.length===0}}})},ms=ae("ZodError",kD,{Parent:Error}),DD=Ng(ms),jD=Ig(ms),ND=ad(ms),ID=ld(ms),LD=k3(ms),BD=D3(ms),UD=j3(ms),PD=N3(ms),ZD=I3(ms),$D=L3(ms),qD=B3(ms),VD=U3(ms),Zt=ae("ZodType",(e,t)=>(Pt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ff(e,"input"),output:Ff(e,"output")}}),e.toJSONSchema=iD(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...s)=>e.clone(xr(t,{checks:[...t.checks??[],...s.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(s,r)=>Er(e,s,r),e.brand=()=>e,e.register=((s,r)=>(s.add(e,r),e)),e.parse=(s,r)=>DD(e,s,r,{callee:e.parse}),e.safeParse=(s,r)=>ND(e,s,r),e.parseAsync=async(s,r)=>jD(e,s,r,{callee:e.parseAsync}),e.safeParseAsync=async(s,r)=>ID(e,s,r),e.spa=e.safeParseAsync,e.encode=(s,r)=>LD(e,s,r),e.decode=(s,r)=>BD(e,s,r),e.encodeAsync=async(s,r)=>UD(e,s,r),e.decodeAsync=async(s,r)=>PD(e,s,r),e.safeEncode=(s,r)=>ZD(e,s,r),e.safeDecode=(s,r)=>$D(e,s,r),e.safeEncodeAsync=async(s,r)=>qD(e,s,r),e.safeDecodeAsync=async(s,r)=>VD(e,s,r),e.refine=(s,r)=>e.check(L9(s,r)),e.superRefine=s=>e.check(B9(s)),e.overwrite=s=>e.check(Ha(s)),e.optional=()=>ZS(e),e.exactOptional=()=>E9(e),e.nullable=()=>$S(e),e.nullish=()=>ZS($S(e)),e.nonoptional=s=>M9(e,s),e.array=()=>p9(e),e.or=s=>v9([e,s]),e.and=s=>S9(e,s),e.transform=s=>qS(e,_9(s)),e.default=s=>A9(e,s),e.prefault=s=>O9(e,s),e.catch=s=>k9(e,s),e.pipe=s=>qS(e,s),e.readonly=()=>N9(e),e.describe=s=>{const r=e.clone();return Xl.add(r,{description:s}),r},Object.defineProperty(e,"description",{get(){var s;return(s=Xl.get(e))==null?void 0:s.description},configurable:!0}),e.meta=(...s)=>{if(s.length===0)return Xl.get(e);const r=e.clone();return Xl.add(r,s[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=s=>s(e),e)),U_=ae("_ZodString",(e,t)=>{Lg.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>oD(e,r,o);const s=e._zod.bag;e.format=s.format??null,e.minLength=s.minimum??null,e.maxLength=s.maximum??null,e.regex=(...r)=>e.check(q5(...r)),e.includes=(...r)=>e.check(K5(...r)),e.startsWith=(...r)=>e.check(F5(...r)),e.endsWith=(...r)=>e.check(G5(...r)),e.min=(...r)=>e.check(Kf(...r)),e.max=(...r)=>e.check(D_(...r)),e.length=(...r)=>e.check(j_(...r)),e.nonempty=(...r)=>e.check(Kf(1,...r)),e.lowercase=r=>e.check(V5(r)),e.uppercase=r=>e.check(H5(r)),e.trim=()=>e.check(Y5()),e.normalize=(...r)=>e.check(Q5(...r)),e.toLowerCase=()=>e.check(J5()),e.toUpperCase=()=>e.check(X5()),e.slugify=()=>e.check(W5())}),HD=ae("ZodString",(e,t)=>{Lg.init(e,t),U_.init(e,t),e.email=s=>e.check(m5(KD,s)),e.url=s=>e.check(S5(FD,s)),e.jwt=s=>e.check(N5(l9,s)),e.emoji=s=>e.check(w5(GD,s)),e.guid=s=>e.check(IS(BS,s)),e.uuid=s=>e.check(g5(df,s)),e.uuidv4=s=>e.check(y5(df,s)),e.uuidv6=s=>e.check(v5(df,s)),e.uuidv7=s=>e.check(b5(df,s)),e.nanoid=s=>e.check(_5(QD,s)),e.guid=s=>e.check(IS(BS,s)),e.cuid=s=>e.check(x5(YD,s)),e.cuid2=s=>e.check(E5(JD,s)),e.ulid=s=>e.check(C5(XD,s)),e.base64=s=>e.check(k5(r9,s)),e.base64url=s=>e.check(D5(o9,s)),e.xid=s=>e.check(R5(WD,s)),e.ksuid=s=>e.check(A5(e9,s)),e.ipv4=s=>e.check(T5(t9,s)),e.ipv6=s=>e.check(O5(n9,s)),e.cidrv4=s=>e.check(M5(s9,s)),e.cidrv6=s=>e.check(z5(i9,s)),e.e164=s=>e.check(j5(a9,s)),e.datetime=s=>e.check(CD(s)),e.date=s=>e.check(AD(s)),e.time=s=>e.check(OD(s)),e.duration=s=>e.check(zD(s))});function LS(e){return p5(HD,e)}const bt=ae("ZodStringFormat",(e,t)=>{yt.init(e,t),U_.init(e,t)}),KD=ae("ZodEmail",(e,t)=>{Ek.init(e,t),bt.init(e,t)}),BS=ae("ZodGUID",(e,t)=>{_k.init(e,t),bt.init(e,t)}),df=ae("ZodUUID",(e,t)=>{xk.init(e,t),bt.init(e,t)}),FD=ae("ZodURL",(e,t)=>{Ck.init(e,t),bt.init(e,t)}),GD=ae("ZodEmoji",(e,t)=>{Rk.init(e,t),bt.init(e,t)}),QD=ae("ZodNanoID",(e,t)=>{Ak.init(e,t),bt.init(e,t)}),YD=ae("ZodCUID",(e,t)=>{Tk.init(e,t),bt.init(e,t)}),JD=ae("ZodCUID2",(e,t)=>{Ok.init(e,t),bt.init(e,t)}),XD=ae("ZodULID",(e,t)=>{Mk.init(e,t),bt.init(e,t)}),WD=ae("ZodXID",(e,t)=>{zk.init(e,t),bt.init(e,t)}),e9=ae("ZodKSUID",(e,t)=>{kk.init(e,t),bt.init(e,t)}),t9=ae("ZodIPv4",(e,t)=>{Lk.init(e,t),bt.init(e,t)}),n9=ae("ZodIPv6",(e,t)=>{Bk.init(e,t),bt.init(e,t)}),s9=ae("ZodCIDRv4",(e,t)=>{Uk.init(e,t),bt.init(e,t)}),i9=ae("ZodCIDRv6",(e,t)=>{Pk.init(e,t),bt.init(e,t)}),r9=ae("ZodBase64",(e,t)=>{Zk.init(e,t),bt.init(e,t)}),o9=ae("ZodBase64URL",(e,t)=>{qk.init(e,t),bt.init(e,t)}),a9=ae("ZodE164",(e,t)=>{Vk.init(e,t),bt.init(e,t)}),l9=ae("ZodJWT",(e,t)=>{Kk.init(e,t),bt.init(e,t)}),c9=ae("ZodBoolean",(e,t)=>{Fk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>aD(e,s,r)});function US(e){return P5(c9,e)}const u9=ae("ZodUnknown",(e,t)=>{Gk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>cD()});function PS(){return Z5(u9)}const f9=ae("ZodNever",(e,t)=>{Qk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>lD(e,s,r)});function d9(e){return $5(f9,e)}const h9=ae("ZodArray",(e,t)=>{Yk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>hD(e,s,r,o),e.element=t.element,e.min=(s,r)=>e.check(Kf(s,r)),e.nonempty=s=>e.check(Kf(1,s)),e.max=(s,r)=>e.check(D_(s,r)),e.length=(s,r)=>e.check(j_(s,r)),e.unwrap=()=>e.element});function p9(e,t){return eD(h9,e,t)}const m9=ae("ZodObject",(e,t)=>{Xk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>pD(e,s,r,o),st(e,"shape",()=>t.shape),e.keyof=()=>P_(Object.keys(e._zod.def.shape)),e.catchall=s=>e.clone({...e._zod.def,catchall:s}),e.passthrough=()=>e.clone({...e._zod.def,catchall:PS()}),e.loose=()=>e.clone({...e._zod.def,catchall:PS()}),e.strict=()=>e.clone({...e._zod.def,catchall:d9()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=s=>x3(e,s),e.safeExtend=s=>E3(e,s),e.merge=s=>C3(e,s),e.pick=s=>w3(e,s),e.omit=s=>_3(e,s),e.partial=(...s)=>R3(Z_,e,s[0]),e.required=(...s)=>A3($_,e,s[0])});function g9(e,t){const s={type:"object",shape:e??{},...Me(t)};return new m9(s)}const y9=ae("ZodUnion",(e,t)=>{Wk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>mD(e,s,r,o),e.options=t.options});function v9(e,t){return new y9({type:"union",options:e,...Me(t)})}const b9=ae("ZodIntersection",(e,t)=>{e5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>gD(e,s,r,o)});function S9(e,t){return new b9({type:"intersection",left:e,right:t})}const Gm=ae("ZodEnum",(e,t)=>{t5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>uD(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const s=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const l={};for(const u of r)if(s.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Gm({...t,checks:[],...Me(o),entries:l})},e.exclude=(r,o)=>{const l={...t.entries};for(const u of r)if(s.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Gm({...t,checks:[],...Me(o),entries:l})}});function P_(e,t){const s=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Gm({type:"enum",entries:s,...Me(t)})}const w9=ae("ZodTransform",(e,t)=>{n5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>dD(e,s),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new y_(e.constructor.name);s.addIssue=l=>{if(typeof l=="string")s.issues.push(dc(l,s.value,t));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=s.value),u.inst??(u.inst=e),s.issues.push(dc(u))}};const o=t.transform(s.value,s);return o instanceof Promise?o.then(l=>(s.value=l,s)):(s.value=o,s)}});function _9(e){return new w9({type:"transform",transform:e})}const Z_=ae("ZodOptional",(e,t)=>{k_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>B_(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function ZS(e){return new Z_({type:"optional",innerType:e})}const x9=ae("ZodExactOptional",(e,t)=>{s5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>B_(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function E9(e){return new x9({type:"optional",innerType:e})}const C9=ae("ZodNullable",(e,t)=>{i5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>yD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function $S(e){return new C9({type:"nullable",innerType:e})}const R9=ae("ZodDefault",(e,t)=>{r5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>bD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function A9(e,t){return new R9({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w_(t)}})}const T9=ae("ZodPrefault",(e,t)=>{o5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>SD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function O9(e,t){return new T9({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w_(t)}})}const $_=ae("ZodNonOptional",(e,t)=>{a5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>vD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function M9(e,t){return new $_({type:"nonoptional",innerType:e,...Me(t)})}const z9=ae("ZodCatch",(e,t)=>{l5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>wD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function k9(e,t){return new z9({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const D9=ae("ZodPipe",(e,t)=>{c5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>_D(e,s,r,o),e.in=t.in,e.out=t.out});function qS(e,t){return new D9({type:"pipe",in:e,out:t})}const j9=ae("ZodReadonly",(e,t)=>{u5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>xD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function N9(e){return new j9({type:"readonly",innerType:e})}const I9=ae("ZodCustom",(e,t)=>{f5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>fD(e,s)});function L9(e,t={}){return tD(I9,e,t)}function B9(e){return nD(e)}const U9=()=>Mg(()=>import("./memories-CNGWeG5C.js"),__vite__mapDeps([0,1,2])),P9=g9({search:LS().default("").catch(""),type:P_(d2).optional().catch(void 0),pinned:US().default(!1).catch(!1),needsReview:US().default(!1).catch(!1),projectId:LS().optional().catch(void 0)}),Z9=ed("/memories")({validateSearch:P9,component:ng(U9,"component")}),$9=ed("/")({beforeLoad:()=>{throw aw({to:"/memories"})}}),q9=()=>Mg(()=>import("./memories.index-BWhFh4-P.js"),__vite__mapDeps([3,1])),V9=ed("/memories/")({component:ng(q9,"component")}),H9=()=>Mg(()=>import("./memories._id-CR3hZNKX.js"),__vite__mapDeps([4,2])),K9=ed("/memories/$id")({component:ng(H9,"component")}),Bg=Z9.update({id:"/memories",path:"/memories",getParentRoute:()=>Og}),F9=$9.update({id:"/",path:"/",getParentRoute:()=>Og}),G9=V9.update({id:"/",path:"/",getParentRoute:()=>Bg}),Q9=K9.update({id:"/$id",path:"/$id",getParentRoute:()=>Bg}),Y9={MemoriesIdRoute:Q9,MemoriesIndexRoute:G9},J9=Bg._addFileChildren(Y9),X9={IndexRoute:F9,MemoriesRoute:J9},W9=Og._addFileChildren(X9)._addFileTypes(),ej=e8({routeTree:W9}),q_=document.getElementById("root");if(!q_)throw new Error("No #root element");l8.createRoot(q_).render(fe.jsx(z.StrictMode,{children:fe.jsx(aC,{children:fe.jsx(j4,{children:fe.jsx(s8,{router:ej})})})}));export{Q4 as $,dC as A,Sr as B,o6 as C,Rb as D,Kl as E,uj as F,D4 as G,s2 as H,G4 as I,n6 as J,oj as K,u2 as L,xw as M,ij as N,wz as O,d3 as P,hj as Q,Z9 as R,d2 as S,nd as T,Mw as U,h8 as V,ym as W,dj as X,g_ as Y,Ab as Z,fj as _,ps as a,K9 as a0,rC as a1,Fn as b,Fr as c,td as d,u8 as e,kw as f,b8 as g,mb as h,v8 as i,fe as j,Rw as k,E8 as l,Dw as m,I8 as n,gb as o,p8 as p,zc as q,z as r,aj as s,rj as t,nj as u,lj as v,cj as w,zw as x,cC as y,T8 as z};
119
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const y of e.seen.entries()){const m=y[1];if(t===y[0]){l(y);continue}if(e.external){const _=(h=e.external.registry.get(y[0]))==null?void 0:h.id;if(t!==y[0]&&_){l(y);continue}}if((p=e.metadataRegistry.get(y[0]))==null?void 0:p.id){l(y);continue}if(m.cycle){l(y);continue}if(m.count>1&&e.reused==="ref"){l(y);continue}}}function L_(e,t){var u,f,h;const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const y=e.seen.get(p);if(y.ref===null)return;const m=y.def??y.schema,b={...m},_=y.ref;if(y.ref=null,_){r(_);const S=e.seen.get(_),x=S.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(x)):Object.assign(m,x),Object.assign(m,b),p._zod.parent===_)for(const M in m)M==="$ref"||M==="allOf"||M in b||delete m[M];if(x.$ref&&S.def)for(const M in m)M==="$ref"||M==="allOf"||M in S.def&&JSON.stringify(m[M])===JSON.stringify(S.def[M])&&delete m[M]}const v=p._zod.parent;if(v&&v!==_){r(v);const S=e.seen.get(v);if(S!=null&&S.schema.$ref&&(m.$ref=S.schema.$ref,S.def))for(const x in m)x==="$ref"||x==="allOf"||x in S.def&&JSON.stringify(m[x])===JSON.stringify(S.def[x])&&delete m[x]}e.override({zodSchema:p,jsonSchema:m,path:y.path??[]})};for(const p of[...e.seen.entries()].reverse())r(p[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(u=e.external)!=null&&u.uri){const p=(f=e.external.registry.get(t))==null?void 0:f.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}Object.assign(o,s.def??s.schema);const l=((h=e.external)==null?void 0:h.defs)??{};for(const p of e.seen.entries()){const y=p[1];y.def&&y.defId&&(l[y.defId]=y.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ff(t,"input",e.processors),output:Ff(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function yn(e,t){const s=t??{seen:new Set};if(s.seen.has(e))return!1;s.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return yn(r.element,s);if(r.type==="set")return yn(r.valueType,s);if(r.type==="lazy")return yn(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return yn(r.innerType,s);if(r.type==="intersection")return yn(r.left,s)||yn(r.right,s);if(r.type==="record"||r.type==="map")return yn(r.keyType,s)||yn(r.valueType,s);if(r.type==="pipe")return yn(r.in,s)||yn(r.out,s);if(r.type==="object"){for(const o in r.shape)if(yn(r.shape[o],s))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(yn(o,s))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(yn(o,s))return!0;return!!(r.rest&&yn(r.rest,s))}return!1}const iD=(e,t={})=>s=>{const r=N_({...s,processors:t});return ln(e,r),I_(r,e),L_(r,e)},Ff=(e,t,s={})=>r=>{const{libraryOptions:o,target:l}=r??{},u=N_({...o??{},target:l,io:t,processors:s});return ln(e,u),I_(u,e),L_(u,e)},rD={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oD=(e,t,s,r)=>{const o=s;o.type="string";const{minimum:l,maximum:u,format:f,patterns:h,contentEncoding:p}=e._zod.bag;if(typeof l=="number"&&(o.minLength=l),typeof u=="number"&&(o.maxLength=u),f&&(o.format=rD[f]??f,o.format===""&&delete o.format,f==="time"&&delete o.format),p&&(o.contentEncoding=p),h&&h.size>0){const y=[...h];y.length===1?o.pattern=y[0].source:y.length>1&&(o.allOf=[...y.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},aD=(e,t,s,r)=>{s.type="boolean"},lD=(e,t,s,r)=>{s.not={}},cD=(e,t,s,r)=>{},uD=(e,t,s,r)=>{const o=e._zod.def,l=b_(o.entries);l.every(u=>typeof u=="number")&&(s.type="number"),l.every(u=>typeof u=="string")&&(s.type="string"),s.enum=l},fD=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},dD=(e,t,s,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},hD=(e,t,s,r)=>{const o=s,l=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof f=="number"&&(o.maxItems=f),o.type="array",o.items=ln(l.element,t,{...r,path:[...r.path,"items"]})},pD=(e,t,s,r)=>{var p;const o=s,l=e._zod.def;o.type="object",o.properties={};const u=l.shape;for(const y in u)o.properties[y]=ln(u[y],t,{...r,path:[...r.path,"properties",y]});const f=new Set(Object.keys(u)),h=new Set([...f].filter(y=>{const m=l.shape[y]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));h.size>0&&(o.required=Array.from(h)),((p=l.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:l.catchall?l.catchall&&(o.additionalProperties=ln(l.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},mD=(e,t,s,r)=>{const o=e._zod.def,l=o.inclusive===!1,u=o.options.map((f,h)=>ln(f,t,{...r,path:[...r.path,l?"oneOf":"anyOf",h]}));l?s.oneOf=u:s.anyOf=u},gD=(e,t,s,r)=>{const o=e._zod.def,l=ln(o.left,t,{...r,path:[...r.path,"allOf",0]}),u=ln(o.right,t,{...r,path:[...r.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,h=[...f(l)?l.allOf:[l],...f(u)?u.allOf:[u]];s.allOf=h},yD=(e,t,s,r)=>{const o=e._zod.def,l=ln(o.innerType,t,r),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,s.nullable=!0):s.anyOf=[l,{type:"null"}]},vD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},bD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,s.default=JSON.parse(JSON.stringify(o.defaultValue))},SD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,t.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},wD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=u},_D=(e,t,s,r)=>{const o=e._zod.def,l=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;ln(l,t,r);const u=t.seen.get(e);u.ref=l},xD=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType,s.readOnly=!0},B_=(e,t,s,r)=>{const o=e._zod.def;ln(o.innerType,t,r);const l=t.seen.get(e);l.ref=o.innerType},ED=ae("ZodISODateTime",(e,t)=>{Dk.init(e,t),bt.init(e,t)});function CD(e){return I5(ED,e)}const RD=ae("ZodISODate",(e,t)=>{jk.init(e,t),bt.init(e,t)});function AD(e){return L5(RD,e)}const TD=ae("ZodISOTime",(e,t)=>{Nk.init(e,t),bt.init(e,t)});function OD(e){return B5(TD,e)}const MD=ae("ZodISODuration",(e,t)=>{Ik.init(e,t),bt.init(e,t)});function zD(e){return U5(MD,e)}const kD=(e,t)=>{E_.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:s=>O3(e,s)},flatten:{value:s=>T3(e,s)},addIssue:{value:s=>{e.issues.push(s),e.message=JSON.stringify(e.issues,Km,2)}},addIssues:{value:s=>{e.issues.push(...s),e.message=JSON.stringify(e.issues,Km,2)}},isEmpty:{get(){return e.issues.length===0}}})},ms=ae("ZodError",kD,{Parent:Error}),DD=Ng(ms),jD=Ig(ms),ND=ad(ms),ID=ld(ms),LD=k3(ms),BD=D3(ms),UD=j3(ms),PD=N3(ms),ZD=I3(ms),$D=L3(ms),qD=B3(ms),VD=U3(ms),Zt=ae("ZodType",(e,t)=>(Pt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ff(e,"input"),output:Ff(e,"output")}}),e.toJSONSchema=iD(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...s)=>e.clone(xr(t,{checks:[...t.checks??[],...s.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(s,r)=>Er(e,s,r),e.brand=()=>e,e.register=((s,r)=>(s.add(e,r),e)),e.parse=(s,r)=>DD(e,s,r,{callee:e.parse}),e.safeParse=(s,r)=>ND(e,s,r),e.parseAsync=async(s,r)=>jD(e,s,r,{callee:e.parseAsync}),e.safeParseAsync=async(s,r)=>ID(e,s,r),e.spa=e.safeParseAsync,e.encode=(s,r)=>LD(e,s,r),e.decode=(s,r)=>BD(e,s,r),e.encodeAsync=async(s,r)=>UD(e,s,r),e.decodeAsync=async(s,r)=>PD(e,s,r),e.safeEncode=(s,r)=>ZD(e,s,r),e.safeDecode=(s,r)=>$D(e,s,r),e.safeEncodeAsync=async(s,r)=>qD(e,s,r),e.safeDecodeAsync=async(s,r)=>VD(e,s,r),e.refine=(s,r)=>e.check(L9(s,r)),e.superRefine=s=>e.check(B9(s)),e.overwrite=s=>e.check(Ha(s)),e.optional=()=>ZS(e),e.exactOptional=()=>E9(e),e.nullable=()=>$S(e),e.nullish=()=>ZS($S(e)),e.nonoptional=s=>M9(e,s),e.array=()=>p9(e),e.or=s=>v9([e,s]),e.and=s=>S9(e,s),e.transform=s=>qS(e,_9(s)),e.default=s=>A9(e,s),e.prefault=s=>O9(e,s),e.catch=s=>k9(e,s),e.pipe=s=>qS(e,s),e.readonly=()=>N9(e),e.describe=s=>{const r=e.clone();return Xl.add(r,{description:s}),r},Object.defineProperty(e,"description",{get(){var s;return(s=Xl.get(e))==null?void 0:s.description},configurable:!0}),e.meta=(...s)=>{if(s.length===0)return Xl.get(e);const r=e.clone();return Xl.add(r,s[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=s=>s(e),e)),U_=ae("_ZodString",(e,t)=>{Lg.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>oD(e,r,o);const s=e._zod.bag;e.format=s.format??null,e.minLength=s.minimum??null,e.maxLength=s.maximum??null,e.regex=(...r)=>e.check(q5(...r)),e.includes=(...r)=>e.check(K5(...r)),e.startsWith=(...r)=>e.check(F5(...r)),e.endsWith=(...r)=>e.check(G5(...r)),e.min=(...r)=>e.check(Kf(...r)),e.max=(...r)=>e.check(D_(...r)),e.length=(...r)=>e.check(j_(...r)),e.nonempty=(...r)=>e.check(Kf(1,...r)),e.lowercase=r=>e.check(V5(r)),e.uppercase=r=>e.check(H5(r)),e.trim=()=>e.check(Y5()),e.normalize=(...r)=>e.check(Q5(...r)),e.toLowerCase=()=>e.check(J5()),e.toUpperCase=()=>e.check(X5()),e.slugify=()=>e.check(W5())}),HD=ae("ZodString",(e,t)=>{Lg.init(e,t),U_.init(e,t),e.email=s=>e.check(m5(KD,s)),e.url=s=>e.check(S5(FD,s)),e.jwt=s=>e.check(N5(l9,s)),e.emoji=s=>e.check(w5(GD,s)),e.guid=s=>e.check(IS(BS,s)),e.uuid=s=>e.check(g5(df,s)),e.uuidv4=s=>e.check(y5(df,s)),e.uuidv6=s=>e.check(v5(df,s)),e.uuidv7=s=>e.check(b5(df,s)),e.nanoid=s=>e.check(_5(QD,s)),e.guid=s=>e.check(IS(BS,s)),e.cuid=s=>e.check(x5(YD,s)),e.cuid2=s=>e.check(E5(JD,s)),e.ulid=s=>e.check(C5(XD,s)),e.base64=s=>e.check(k5(r9,s)),e.base64url=s=>e.check(D5(o9,s)),e.xid=s=>e.check(R5(WD,s)),e.ksuid=s=>e.check(A5(e9,s)),e.ipv4=s=>e.check(T5(t9,s)),e.ipv6=s=>e.check(O5(n9,s)),e.cidrv4=s=>e.check(M5(s9,s)),e.cidrv6=s=>e.check(z5(i9,s)),e.e164=s=>e.check(j5(a9,s)),e.datetime=s=>e.check(CD(s)),e.date=s=>e.check(AD(s)),e.time=s=>e.check(OD(s)),e.duration=s=>e.check(zD(s))});function LS(e){return p5(HD,e)}const bt=ae("ZodStringFormat",(e,t)=>{yt.init(e,t),U_.init(e,t)}),KD=ae("ZodEmail",(e,t)=>{Ek.init(e,t),bt.init(e,t)}),BS=ae("ZodGUID",(e,t)=>{_k.init(e,t),bt.init(e,t)}),df=ae("ZodUUID",(e,t)=>{xk.init(e,t),bt.init(e,t)}),FD=ae("ZodURL",(e,t)=>{Ck.init(e,t),bt.init(e,t)}),GD=ae("ZodEmoji",(e,t)=>{Rk.init(e,t),bt.init(e,t)}),QD=ae("ZodNanoID",(e,t)=>{Ak.init(e,t),bt.init(e,t)}),YD=ae("ZodCUID",(e,t)=>{Tk.init(e,t),bt.init(e,t)}),JD=ae("ZodCUID2",(e,t)=>{Ok.init(e,t),bt.init(e,t)}),XD=ae("ZodULID",(e,t)=>{Mk.init(e,t),bt.init(e,t)}),WD=ae("ZodXID",(e,t)=>{zk.init(e,t),bt.init(e,t)}),e9=ae("ZodKSUID",(e,t)=>{kk.init(e,t),bt.init(e,t)}),t9=ae("ZodIPv4",(e,t)=>{Lk.init(e,t),bt.init(e,t)}),n9=ae("ZodIPv6",(e,t)=>{Bk.init(e,t),bt.init(e,t)}),s9=ae("ZodCIDRv4",(e,t)=>{Uk.init(e,t),bt.init(e,t)}),i9=ae("ZodCIDRv6",(e,t)=>{Pk.init(e,t),bt.init(e,t)}),r9=ae("ZodBase64",(e,t)=>{Zk.init(e,t),bt.init(e,t)}),o9=ae("ZodBase64URL",(e,t)=>{qk.init(e,t),bt.init(e,t)}),a9=ae("ZodE164",(e,t)=>{Vk.init(e,t),bt.init(e,t)}),l9=ae("ZodJWT",(e,t)=>{Kk.init(e,t),bt.init(e,t)}),c9=ae("ZodBoolean",(e,t)=>{Fk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>aD(e,s,r)});function US(e){return P5(c9,e)}const u9=ae("ZodUnknown",(e,t)=>{Gk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>cD()});function PS(){return Z5(u9)}const f9=ae("ZodNever",(e,t)=>{Qk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>lD(e,s,r)});function d9(e){return $5(f9,e)}const h9=ae("ZodArray",(e,t)=>{Yk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>hD(e,s,r,o),e.element=t.element,e.min=(s,r)=>e.check(Kf(s,r)),e.nonempty=s=>e.check(Kf(1,s)),e.max=(s,r)=>e.check(D_(s,r)),e.length=(s,r)=>e.check(j_(s,r)),e.unwrap=()=>e.element});function p9(e,t){return eD(h9,e,t)}const m9=ae("ZodObject",(e,t)=>{Xk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>pD(e,s,r,o),st(e,"shape",()=>t.shape),e.keyof=()=>P_(Object.keys(e._zod.def.shape)),e.catchall=s=>e.clone({...e._zod.def,catchall:s}),e.passthrough=()=>e.clone({...e._zod.def,catchall:PS()}),e.loose=()=>e.clone({...e._zod.def,catchall:PS()}),e.strict=()=>e.clone({...e._zod.def,catchall:d9()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=s=>x3(e,s),e.safeExtend=s=>E3(e,s),e.merge=s=>C3(e,s),e.pick=s=>w3(e,s),e.omit=s=>_3(e,s),e.partial=(...s)=>R3(Z_,e,s[0]),e.required=(...s)=>A3($_,e,s[0])});function g9(e,t){const s={type:"object",shape:e??{},...Me(t)};return new m9(s)}const y9=ae("ZodUnion",(e,t)=>{Wk.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>mD(e,s,r,o),e.options=t.options});function v9(e,t){return new y9({type:"union",options:e,...Me(t)})}const b9=ae("ZodIntersection",(e,t)=>{e5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>gD(e,s,r,o)});function S9(e,t){return new b9({type:"intersection",left:e,right:t})}const Gm=ae("ZodEnum",(e,t)=>{t5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(r,o,l)=>uD(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const s=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const l={};for(const u of r)if(s.has(u))l[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Gm({...t,checks:[],...Me(o),entries:l})},e.exclude=(r,o)=>{const l={...t.entries};for(const u of r)if(s.has(u))delete l[u];else throw new Error(`Key ${u} not found in enum`);return new Gm({...t,checks:[],...Me(o),entries:l})}});function P_(e,t){const s=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Gm({type:"enum",entries:s,...Me(t)})}const w9=ae("ZodTransform",(e,t)=>{n5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>dD(e,s),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new y_(e.constructor.name);s.addIssue=l=>{if(typeof l=="string")s.issues.push(dc(l,s.value,t));else{const u=l;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=s.value),u.inst??(u.inst=e),s.issues.push(dc(u))}};const o=t.transform(s.value,s);return o instanceof Promise?o.then(l=>(s.value=l,s)):(s.value=o,s)}});function _9(e){return new w9({type:"transform",transform:e})}const Z_=ae("ZodOptional",(e,t)=>{k_.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>B_(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function ZS(e){return new Z_({type:"optional",innerType:e})}const x9=ae("ZodExactOptional",(e,t)=>{s5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>B_(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function E9(e){return new x9({type:"optional",innerType:e})}const C9=ae("ZodNullable",(e,t)=>{i5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>yD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function $S(e){return new C9({type:"nullable",innerType:e})}const R9=ae("ZodDefault",(e,t)=>{r5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>bD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function A9(e,t){return new R9({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w_(t)}})}const T9=ae("ZodPrefault",(e,t)=>{o5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>SD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function O9(e,t){return new T9({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w_(t)}})}const $_=ae("ZodNonOptional",(e,t)=>{a5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>vD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function M9(e,t){return new $_({type:"nonoptional",innerType:e,...Me(t)})}const z9=ae("ZodCatch",(e,t)=>{l5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>wD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function k9(e,t){return new z9({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const D9=ae("ZodPipe",(e,t)=>{c5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>_D(e,s,r,o),e.in=t.in,e.out=t.out});function qS(e,t){return new D9({type:"pipe",in:e,out:t})}const j9=ae("ZodReadonly",(e,t)=>{u5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>xD(e,s,r,o),e.unwrap=()=>e._zod.def.innerType});function N9(e){return new j9({type:"readonly",innerType:e})}const I9=ae("ZodCustom",(e,t)=>{f5.init(e,t),Zt.init(e,t),e._zod.processJSONSchema=(s,r,o)=>fD(e,s)});function L9(e,t={}){return tD(I9,e,t)}function B9(e){return nD(e)}const U9=()=>Mg(()=>import("./memories-3VR4rZ5U.js"),__vite__mapDeps([0,1,2])),P9=g9({search:LS().default("").catch(""),type:P_(d2).optional().catch(void 0),pinned:US().default(!1).catch(!1),needsReview:US().default(!1).catch(!1),projectId:LS().optional().catch(void 0)}),Z9=ed("/memories")({validateSearch:P9,component:ng(U9,"component")}),$9=ed("/")({beforeLoad:()=>{throw aw({to:"/memories"})}}),q9=()=>Mg(()=>import("./memories.index-ByQeKvpK.js"),__vite__mapDeps([3,1])),V9=ed("/memories/")({component:ng(q9,"component")}),H9=()=>Mg(()=>import("./memories._id-D3XqSd0M.js"),__vite__mapDeps([4,2])),K9=ed("/memories/$id")({component:ng(H9,"component")}),Bg=Z9.update({id:"/memories",path:"/memories",getParentRoute:()=>Og}),F9=$9.update({id:"/",path:"/",getParentRoute:()=>Og}),G9=V9.update({id:"/",path:"/",getParentRoute:()=>Bg}),Q9=K9.update({id:"/$id",path:"/$id",getParentRoute:()=>Bg}),Y9={MemoriesIdRoute:Q9,MemoriesIndexRoute:G9},J9=Bg._addFileChildren(Y9),X9={IndexRoute:F9,MemoriesRoute:J9},W9=Og._addFileChildren(X9)._addFileTypes(),ej=e8({routeTree:W9}),q_=document.getElementById("root");if(!q_)throw new Error("No #root element");l8.createRoot(q_).render(fe.jsx(z.StrictMode,{children:fe.jsx(aC,{children:fe.jsx(j4,{children:fe.jsx(s8,{router:ej})})})}));export{ym as $,dC as A,Sr as B,o6 as C,Rb as D,Kl as E,uj as F,D4 as G,s2 as H,G4 as I,n6 as J,oj as K,u2 as L,xw as M,ij as N,wz as O,d3 as P,hj as Q,Z9 as R,d2 as S,nd as T,Mw as U,ob as V,_R as W,yw as X,rC as Y,h8 as Z,f2 as _,ps as a,dj as a0,g_ as a1,Ab as a2,fj as a3,Q4 as a4,g9 as a5,LS as a6,P_ as a7,K9 as a8,Fn as b,Fr as c,td as d,u8 as e,kw as f,b8 as g,mb as h,v8 as i,fe as j,Rw as k,E8 as l,Dw as m,I8 as n,gb as o,p8 as p,zc as q,z as r,aj as s,rj as t,nj as u,lj as v,cj as w,zw as x,cC as y,T8 as z};
@@ -1 +1 @@
1
- var $r=Object.defineProperty;var tn=e=>{throw TypeError(e)};var Yr=(e,t,n)=>t in e?$r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ge=(e,t,n)=>Yr(e,typeof t!="symbol"?t+"":t,n),xt=(e,t,n)=>t.has(e)||tn("Cannot "+n);var Q=(e,t,n)=>(xt(e,t,"read from private field"),n?n.call(e):t.get(e)),Be=(e,t,n)=>t.has(e)?tn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),it=(e,t,n,r)=>(xt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ue=(e,t,n)=>(xt(e,t,"access private method"),n);import{u as Zr,r as c,a as Gr,b as qr,c as zr,d as Wt,e as ne,j as f,i as Se,g as Bt,f as Te,h as _t,N as $t,k as On,E as Qe,l as se,m as Xr,n as nt,o as nn,p as ft,q as bt,T as pt,s as Jr,t as Je,v as St,w as Qr,x as Yt,y as es,z as Dn,A as ts,B as An,C as Ae,D as rn,F as Nn,G as jn,H as de,I as Fn,J as ns,K as Zt,L as rs,R as ss,M as Hn,O as sn,P as Et,Q as os,S as is,U as as}from"./index-D_ebWYgx.js";import{f as cs}from"./MagnifyingGlass.es-BZ4bp5Mi.js";import{c as G,o as ee,a as He,b as Z,d as Ne,f as Ln,u as Gt,e as ls,r as De,t as us,g as Vn,h as Fe,i as ds,j as on,k as fs,l as Kn,T as an,m as Un,n as ps,A as hs,p as gs,q as ms,I as bs,N as cn,s as ze}from"./native-select-Dno9-QLw.js";function ys(e){return e!==null&&typeof e=="object"&&"current"in e}function Ie(){var n,r;if(typeof navigator>"u")return"linux";const e=((n=navigator.platform)==null?void 0:n.toLowerCase())??"",t=((r=navigator.userAgent)==null?void 0:r.toLowerCase())??"";return e.includes("mac")||t.includes("mac")?"mac":e.includes("win")||t.includes("win")?"windows":"linux"}const rt=["Control","Alt","Shift","Meta"];new Set(rt);const ln={Control:"Control",Ctrl:"Control",control:"Control",ctrl:"Control",Shift:"Shift",shift:"Shift",Alt:"Alt",Option:"Alt",alt:"Alt",option:"Alt",Command:"Meta",Cmd:"Meta",Meta:"Meta",command:"Meta",cmd:"Meta",meta:"Meta",OS:"Meta",os:"Meta",Win:"Meta",win:"Meta",CommandOrControl:"Mod",Mod:"Mod",commandorcontrol:"Mod",mod:"Mod"};function Wn(e,t=Ie()){return e==="Mod"?t==="mac"?"Meta":"Control":e}const xs=new Set(["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),Ss=new Set(["0","1","2","3","4","5","6","7","8","9"]),Es=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),ws=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),vs=new Set(["Enter","Escape","Space","Tab","Backspace","Delete"]),Rs=new Set(["/","[","]","\\","=","-",",",".",";","`"]),un={Backquote:"`",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Comma:",",Equal:"=",Minus:"-",Period:".",Semicolon:";",Slash:"/"};[...xs,...Ss,...Es,...ws,...vs,...Rs];const dn={Esc:"Escape",esc:"Escape",escape:"Escape",Return:"Enter",return:"Enter",enter:"Enter"," ":"Space",space:"Space",Spacebar:"Space",spacebar:"Space",tab:"Tab",backspace:"Backspace",Del:"Delete",del:"Delete",delete:"Delete",Up:"ArrowUp",up:"ArrowUp",arrowup:"ArrowUp",Down:"ArrowDown",down:"ArrowDown",arrowdown:"ArrowDown",Left:"ArrowLeft",left:"ArrowLeft",arrowleft:"ArrowLeft",Right:"ArrowRight",right:"ArrowRight",arrowright:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",PgUp:"PageUp",PgDn:"PageDown",pgup:"PageUp",pgdn:"PageDown"};function Bn(e){return new RegExp("^\\p{Letter}$","u").test(e)}function _e(e){if(!e)return"";if(e in dn)return dn[e];if(Bn(e)){const n=e.toUpperCase();return n.length===1?n:e}const t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}function qt(e,t=Ie()){const n=e.split("+"),r=new Set;let s="";for(let o=0;o<n.length;o++){const i=n[o].trim();if(o===n.length-1)s=_e(i);else{const l=ln[i]??ln[i.toLowerCase()];if(l){const h=Wn(l,t);r.add(h)}else n.length===1&&(s=_e(i))}}return!s&&n.length>0&&(s=_e(n[n.length-1].trim())),{key:s,ctrl:r.has("Control"),shift:r.has("Shift"),alt:r.has("Alt"),meta:r.has("Meta"),modifiers:rt.filter(o=>r.has(o))}}function _n(e,t=Ie()){let n=e.ctrl??!1;const r=e.shift??!1,s=e.alt??!1;let o=e.meta??!1;e.mod&&(Wn("Mod",t)==="Control"?n=!0:o=!0);const i=rt.filter(l=>{switch(l){case"Control":return n;case"Shift":return r;case"Alt":return s;case"Meta":return o;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:s,meta:o,modifiers:i}}function $n(e,t){const n=t==="mac"?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push("Mod"),e.alt&&r.push("Alt"),e.shift&&r.push("Shift");else for(const s of rt)e.modifiers.includes(s)&&r.push(s);return r.push(_e(e.key)),r.join("+")}function Cs(e,t=Ie()){return $n(qt(e,t),t)}function Ts(e,t=Ie()){return $n(e,t)}function ks(e,t=Ie()){return typeof e=="string"?Cs(e,t):Ts(_n(e,t),t)}function Ps(e){const t=[];for(const n of rt)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join("+")}function fn(e,t,n=Ie()){const r=typeof t=="string"?qt(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;const s=_e(e.key),o=r.key;if(s!=="Dead"&&s.length===1&&o.length===1){if(s.toUpperCase()===o.toUpperCase())return!0;if(Bn(s)&&(/^[A-Za-z]$/.test(s)||!e.altKey))return!1}if(e.code&&(s==="Dead"||s.length===1&&o.length===1)){if(e.code.startsWith("Key")){const i=e.code.slice(3);if(i.length===1&&/^[A-Za-z]$/.test(i))return i.toUpperCase()===o.toUpperCase()}if(e.code.startsWith("Digit")){const i=e.code.slice(5);if(i.length===1&&/^[0-9]$/.test(i))return i===o}return e.code in un?un[e.code]===o:!1}return s===o}const Is={preventDefault:!0,stopPropagation:!0,eventType:"keydown",enabled:!0,ignoreInputs:!0,conflictBehavior:"warn"};function Ms(e){return!(e.ctrl||e.meta||e.key==="Escape")}function wt(e){if(!e)return!1;if(e instanceof HTMLInputElement){const t=e.type.toLowerCase();return!(t==="button"||t==="submit"||t==="reset")}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function Os(e){return typeof document>"u"?null:typeof Document<"u"&&e instanceof Document||typeof Node<"u"&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<"u"&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function Ds(e,t,n){const r=Os(t);return r&&wt(r)&&r!==n||e.composedPath().some(s=>wt(s)&&s!==n)?!0:wt(e.target)&&e.target!==n}function As(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function Ns(e,t,n,r){if(n!=="allow"){if(n==="warn"){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n==="error")throw new Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}let R=(function(e){return e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e})({});function js({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:o,checkDirty:i,shallowPropagate:l};function r(a,d,g){const w=d.depsTail;if(w!==void 0&&w.dep===a)return;const m=w!==void 0?w.nextDep:d.deps;if(m!==void 0&&m.dep===a){m.version=g,d.depsTail=m;return}const b=a.subsTail;if(b!==void 0&&b.version===g&&b.sub===d)return;const p=d.depsTail=a.subsTail={version:g,dep:a,sub:d,prevDep:w,nextDep:m,prevSub:b,nextSub:void 0};m!==void 0&&(m.prevDep=p),w!==void 0?w.nextDep=p:d.deps=p,b!==void 0?b.nextSub=p:a.subs=p}function s(a,d=a.sub){const g=a.dep,w=a.prevDep,m=a.nextDep,b=a.nextSub,p=a.prevSub;return m!==void 0?m.prevDep=w:d.depsTail=w,w!==void 0?w.nextDep=m:d.deps=m,b!==void 0?b.prevSub=p:g.subsTail=p,p!==void 0?p.nextSub=b:(g.subs=b)===void 0&&n(g),m}function o(a){let d=a.nextSub,g;e:do{const w=a.sub;let m=w.flags;if(m&(R.RecursedCheck|R.Recursed|R.Dirty|R.Pending)?m&(R.RecursedCheck|R.Recursed)?m&R.RecursedCheck?!(m&(R.Dirty|R.Pending))&&h(a,w)?(w.flags=m|(R.Recursed|R.Pending),m&=R.Mutable):m=R.None:w.flags=m&~R.Recursed|R.Pending:m=R.None:w.flags=m|R.Pending,m&R.Watching&&t(w),m&R.Mutable){const b=w.subs;if(b!==void 0){const p=(a=b).nextSub;p!==void 0&&(g={value:d,prev:g},d=p);continue}}if((a=d)!==void 0){d=a.nextSub;continue}for(;g!==void 0;)if(a=g.value,g=g.prev,a!==void 0){d=a.nextSub;continue e}break}while(!0)}function i(a,d){let g,w=0,m=!1;e:do{const b=a.dep,p=b.flags;if(d.flags&R.Dirty)m=!0;else if((p&(R.Mutable|R.Dirty))===(R.Mutable|R.Dirty)){if(e(b)){const y=b.subs;y.nextSub!==void 0&&l(y),m=!0}}else if((p&(R.Mutable|R.Pending))===(R.Mutable|R.Pending)){(a.nextSub!==void 0||a.prevSub!==void 0)&&(g={value:a,prev:g}),a=b.deps,d=b,++w;continue}if(!m){const y=a.nextDep;if(y!==void 0){a=y;continue}}for(;w--;){const y=d.subs,E=y.nextSub!==void 0;if(E?(a=g.value,g=g.prev):a=y,m){if(e(d)){E&&l(y),d=a.sub;continue}m=!1}else d.flags&=~R.Pending;d=a.sub;const S=a.nextDep;if(S!==void 0){a=S;continue e}}return m}while(!0)}function l(a){do{const d=a.sub,g=d.flags;(g&(R.Pending|R.Dirty))===R.Pending&&(d.flags=g|R.Dirty,(g&(R.Watching|R.RecursedCheck))===R.Watching&&t(d))}while((a=a.nextSub)!==void 0)}function h(a,d){let g=d.depsTail;for(;g!==void 0;){if(g===a)return!0;g=g.prevDep}return!1}}function Yn(e,t,n){var o,i,l;const r=typeof e=="object",s=r?e:void 0;return{next:(o=r?e.next:e)==null?void 0:o.bind(s),error:(i=r?e.error:t)==null?void 0:i.bind(s),complete:(l=r?e.complete:n)==null?void 0:l.bind(s)}}const Ot=[];let dt=0;const{link:pn,unlink:Fs,propagate:Hs,checkDirty:Zn,shallowPropagate:hn}=js({update(e){return e._update()},notify(e){Ot[Dt++]=e,e.flags&=~R.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=R.Mutable|R.Dirty,ht(e))}});let at=0,Dt=0,Re;function ht(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Fs(n,e)}function Ls(){for(;at<Dt;){const e=Ot[at];Ot[at++]=void 0,e.notify()}at=0,Dt=0}function Vs(e,t){const n=typeof e=="function",r=e,s={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?R.None:R.Mutable,get(){return Re!==void 0&&pn(s,Re,dt),s._snapshot},subscribe(o){const i=Yn(o),l={current:!1},h=Ks(()=>{var a;s.get(),l.current?(a=i.next)==null||a.call(i,s._snapshot):l.current=!0});return{unsubscribe:()=>{h.stop()}}},_update(o){const i=Re,l=Object.is;if(n)Re=s,++dt,s.depsTail=void 0;else if(o===void 0)return!1;n&&(s.flags=R.Mutable|R.RecursedCheck);try{const h=s._snapshot,a=typeof o=="function"?o(h):o===void 0&&n?r(h):o;return h===void 0||!l(h,a)?(s._snapshot=a,!0):!1}finally{Re=i,n&&(s.flags&=~R.RecursedCheck),ht(s)}}};return n?(s.flags=R.Mutable|R.Dirty,s.get=function(){const o=s.flags;if(o&R.Dirty||o&R.Pending&&Zn(s.deps,s)){if(s._update()){const i=s.subs;i!==void 0&&hn(i)}}else o&R.Pending&&(s.flags=o&~R.Pending);return Re!==void 0&&pn(s,Re,dt),s._snapshot}):s.set=function(o){if(s._update(o)){const i=s.subs;i!==void 0&&(Hs(i),hn(i),Ls())}},s}function Ks(e){const t=()=>{const r=Re;Re=n,++dt,n.depsTail=void 0,n.flags=R.Watching|R.RecursedCheck;try{return e()}finally{Re=r,n.flags&=~R.RecursedCheck,ht(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:R.Watching|R.RecursedCheck,notify(){const r=this.flags;r&R.Dirty||r&R.Pending&&Zn(this.deps,this)?t():this.flags=R.Watching},stop(){this.flags=R.None,this.depsTail=void 0,ht(this)}};return t(),n}var Us=class{constructor(t,n){this.atom=Vs(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),n&&(this.actions=n(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Yn(t))}};let Ws=0;function gn(){return`hotkey_${++Ws}`}var me,ke,tt,Pe,Ce,q,At,Gn,Nt,jt,Ft,qn,zn,Xn,Jn,Bs=(me=class{constructor(){Be(this,q);Be(this,tt);Be(this,Pe,new Map);Be(this,Ce,new Map);this.registrations=new Us(new Map),it(this,tt,Ie())}static getInstance(){return Q(me,ke)||it(me,ke,new me),Q(me,ke)}static resetInstance(){Q(me,ke)&&(Q(me,ke).destroy(),it(me,ke,null))}register(t,n,r={}){if(typeof document>"u"&&!r.target){let b=n;return{id:gn(),unregister:()=>{},get callback(){return b},set callback(p){b=p},setOptions:()=>{},get isActive(){return!1}}}const s=gn(),o=r.platform??Q(this,tt),i=typeof t=="string"?qt(t,o):_n(t,o),l=typeof t=="string"?t:Ps(i),h=r.target??document,a=r.conflictBehavior??"warn",d=ue(this,q,Xn).call(this,l,h);d&&Ns(d.id,l,a,b=>ue(this,q,At).call(this,b));const g=r.ignoreInputs??Ms(i),w={id:s,hotkey:l,parsedHotkey:i,callback:n,options:{...Is,requireReset:!1,...r,platform:o,ignoreInputs:g},hasFired:!1,triggerCount:0,target:h};this.registrations.setState(b=>new Map(b).set(s,w)),Q(this,Ce).has(h)||Q(this,Ce).set(h,new Set),Q(this,Ce).get(h).add(s),ue(this,q,Gn).call(this,h);const m=this;return{get id(){return s},unregister:()=>{var b;ue(b=m,q,At).call(b,s)},get callback(){var b;return((b=m.registrations.state.get(s))==null?void 0:b.callback)??n},set callback(b){const p=m.registrations.state.get(s);p&&(p.callback=b)},setOptions:b=>{m.registrations.setState(p=>{const y=p.get(s);if(y){const E=new Map(p);return E.set(s,{...y,options:{...y.options,...b}}),E}return p})},get isActive(){return m.registrations.state.has(s)}}}triggerRegistration(t){const n=this.registrations.state.get(t);if(!n)return!1;const r=n.parsedHotkey,s=new KeyboardEvent(n.options.eventType??"keydown",{key:r.key,ctrlKey:r.ctrl,shiftKey:r.shift,altKey:r.alt,metaKey:r.meta,bubbles:!0,cancelable:!0});return n.triggerCount++,this.registrations.setState(o=>new Map(o)),n.callback(s,{hotkey:n.hotkey,parsedHotkey:n.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(t,n){for(const r of this.registrations.state.values())if(r.hotkey===t&&(n===void 0||r.target===n))return!0;return!1}destroy(){for(const t of Q(this,Pe).keys())ue(this,q,Nt).call(this,t);this.registrations.setState(()=>new Map),Q(this,Pe).clear(),Q(this,Ce).clear()}},ke=new WeakMap,tt=new WeakMap,Pe=new WeakMap,Ce=new WeakMap,q=new WeakSet,At=function(t){const n=this.registrations.state.get(t);if(!n)return;const r=n.target;this.registrations.setState(o=>{const i=new Map(o);return i.delete(t),i});const s=Q(this,Ce).get(r);s&&(s.delete(t),s.size===0&&ue(this,q,Nt).call(this,r))},Gn=function(t){if(typeof document>"u"||Q(this,Pe).has(t))return;const n=ue(this,q,qn).call(this,t),r=ue(this,q,zn).call(this,t);t.addEventListener("keydown",n),t.addEventListener("keyup",r),Q(this,Pe).set(t,{keydown:n,keyup:r})},Nt=function(t){if(typeof document>"u")return;const n=Q(this,Pe).get(t);n&&(t.removeEventListener("keydown",n.keydown),t.removeEventListener("keyup",n.keyup),Q(this,Pe).delete(t),Q(this,Ce).delete(t))},jt=function(t,n,r){const s=Q(this,Ce).get(n);if(s)for(const o of s){const i=this.registrations.state.get(o);if(i&&As(t,n)&&i.options.enabled&&!(i.options.ignoreInputs!==!1&&Ds(t,n,i.target)))if(r==="keydown"){if(i.options.eventType!=="keydown")continue;fn(t,i.parsedHotkey,i.options.platform)&&(i.options.preventDefault&&t.preventDefault(),i.options.stopPropagation&&t.stopPropagation(),(!i.options.requireReset||!i.hasFired)&&(ue(this,q,Ft).call(this,i,t),i.options.requireReset&&(i.hasFired=!0)))}else i.options.eventType==="keyup"&&fn(t,i.parsedHotkey,i.options.platform)&&ue(this,q,Ft).call(this,i,t),i.options.requireReset&&i.hasFired&&ue(this,q,Jn).call(this,i,t)&&(i.hasFired=!1)}},Ft=function(t,n){t.options.preventDefault&&n.preventDefault(),t.options.stopPropagation&&n.stopPropagation(),t.triggerCount++,this.registrations.setState(s=>new Map(s));const r={hotkey:t.hotkey,parsedHotkey:t.parsedHotkey};t.callback(n,r)},qn=function(t){return n=>{ue(this,q,jt).call(this,n,t,"keydown")}},zn=function(t){return n=>{ue(this,q,jt).call(this,n,t,"keyup")}},Xn=function(t,n){for(const r of this.registrations.state.values())if(r.hotkey===t&&r.target===n)return r;return null},Jn=function(t,n){const r=t.parsedHotkey,s=_e(n.key),o=r.key.length===1?r.key.toUpperCase():r.key;return!!((s.length===1?s.toUpperCase():s)===o||r.ctrl&&s==="Control"||r.shift&&s==="Shift"||r.alt&&s==="Alt"||r.meta&&s==="Meta")},Be(me,ke,null),me);function _s(){return Bs.getInstance()}function $s(e,t={}){var w;const n=Zr().hotkey,r=_s(),s=t.platform??(n==null?void 0:n.platform)??Ie(),o=c.useRef(new Map),i=c.useRef(e),l=c.useRef([]),h=c.useRef(t),a=c.useRef(n),d=c.useRef(r),g=e.map(m=>ks(m.hotkey,s));i.current=e,l.current=g,h.current=t,a.current=n,d.current=r,c.useEffect(()=>{const m=o.current,b=new Map,p=[];for(let E=0;E<i.current.length;E++){const S=i.current[E],D=l.current[E],P={...a.current,...h.current,...S.options},k=ys(P.target)?P.target.current:P.target??(typeof document<"u"?document:null);if(!k)continue;const L=`${E}:${D}`;p.push({registrationKey:L,def:S,hotkeyStr:D,mergedOptions:P,resolvedTarget:k})}const y=new Set(p.map(E=>E.registrationKey));for(const[E,S]of m)!y.has(E)&&S.handle.isActive&&S.handle.unregister();for(const E of p){const{registrationKey:S,def:D,hotkeyStr:P,mergedOptions:k,resolvedTarget:L}=E,x=m.get(S);if(x!=null&&x.handle.isActive&&x.target===L){b.set(S,x);continue}x!=null&&x.handle.isActive&&x.handle.unregister();const C=d.current.register(P,D.callback,{...k,target:L});b.set(S,{handle:C,target:L})}o.current=b}),c.useEffect(()=>()=>{for(const{handle:m}of o.current.values())m.isActive&&m.unregister();o.current=new Map},[]);for(let m=0;m<e.length;m++){const b=e[m],p=g[m],y=`${m}:${p}`,E=(w=o.current.get(y))==null?void 0:w.handle;if(E!=null&&E.isActive){E.callback=b.callback;const{target:S,...D}={...n,...t,...b.options};E.setOptions(D)}}}function Ys(e){const t=Gr({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t,r=c.useRef(void 0);return qr(n.stores.__store,s=>{if(e!=null&&e.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const o=zr(r.current,e.select(s));return r.current=o,o}return e.select(s)}return s})}function Zs(e){const t=c.useRef(!0);t.current&&(t.current=!1,e())}const Ze=typeof navigator<"u",vt=zs(),Qn=Js(),er=Xs(),tr=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),nr=vt.platform==="MacIntel"&&vt.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(vt.platform),Gs=Ze&&/apple/i.test(navigator.vendor),Ht=Ze&&/android/i.test(Qn)||/android/i.test(er);Ze&&Qn.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const qs=er.includes("jsdom/");function zs(){if(!Ze)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e!=null&&e.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Xs(){if(!Ze)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function Js(){if(!Ze)return"";const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform??""}function Qs(e){e.preventDefault(),e.stopPropagation()}function eo(e){return"nativeEvent"in e}function to(e){return e.pointerType===""&&e.isTrusted?!0:Ht&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function no(e){return qs?!1:!Ht&&e.width===0&&e.height===0||Ht&&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 ro(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function $e(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Rt(e){const t=Wt(so,e).current;return t.next=e,ne(t.effect),t}function so(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const oo={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},io={...oo,position:"fixed",top:0,left:0},gt=c.forwardRef(function(t,n){const[r,s]=c.useState();ne(()=>{Gs&&s("button")},[]);const o={tabIndex:0,role:r};return f.jsx("span",{...t,ref:n,style:io,"aria-hidden":r?void 0:!0,...o,"data-base-ui-focus-guard":""})}),Lt="data-base-ui-focusable",rr="active",sr="selected",ao="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function we(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function co(e){return e.matches("html,body")}function or(e){return Se(e)&&e.matches(ao)}function mn(e){return e?e.getAttribute("role")==="combobox"&&or(e):!1}function Vt(e){return e?e.hasAttribute(Lt)?e:e.querySelector(`[${Lt}]`)||e:null}function lo(e){return e.visibility==="hidden"||e.visibility==="collapse"}function ir(e,t=e?Bt(e):null){return!e||!e.isConnected||!t||lo(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const uo='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function fo(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return _t(n)?n.host:null}function Kt(e){for(const t of Array.from(e.children))if(Te(t)==="summary")return t;return null}function po(e,t){const n=Kt(t);return!!n&&(e===n||G(n,e))}function ar(e){const t=e?Te(e):"";return e!=null&&e.matches(uo)&&(t!=="summary"||e.parentElement!=null&&Te(e.parentElement)==="details"&&Kt(e.parentElement)===e)&&(t!=="details"||Kt(e)==null)&&(t!=="input"||e.type!=="hidden")}function cr(e){if(!ar(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=fo(t)){const n=t!==e,r=Te(t)==="slot";if(t.hasAttribute("inert")||n&&Te(t)==="details"&&!t.open&&!po(e,t)||t.hasAttribute("hidden")||!r&&!ho(t,n))return!1}return!0}function ho(e,t){const n=Bt(e);return t?n.display!=="none":ir(e,n)}function lr(e){const t=e.tabIndex;if(t<0){const n=Te(e);if(n==="details"||n==="audio"||n==="video"||Se(e)&&e.isContentEditable)return 0}return t}function Ct(e){if(Te(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function go(e,t){const n=Ct(e);if(!n)return!0;const r=t.find(s=>{const o=Ct(s);return(o==null?void 0:o.name)===n.name&&o.form===n.form&&o.checked});return r?r===n:t.find(s=>{const o=Ct(s);return(o==null?void 0:o.name)===n.name&&o.form===n.form})===n}function ur(e){if(Se(e)&&Te(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Se(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function dr(e,t){ur(e).forEach(n=>{ar(n)&&t.push(n),dr(n,t)})}function fr(e,t,n){ur(e).forEach(r=>{Se(r)&&r.matches(t)&&n.push(r),fr(r,t,n)})}function zt(e){return cr(e)&&lr(e)>=0}function pr(e){const t=[];return dr(e,t),t.filter(cr)}function yt(e){const t=pr(e);return t.filter(n=>lr(n)>=0&&go(n,t))}function hr(e,t){const n=yt(e),r=n.length;if(r===0)return;const s=He(ee(e)),o=n.indexOf(s),i=o===-1?t===1?0:r-1:o+t;return n[i]}function gr(e){return hr(ee(e).body,1)||e}function mr(e){return hr(ee(e).body,-1)||e}function et(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!G(n,r)}function mo(e){yt(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function bn(e){const t=[];fr(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Ye(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>{var o;return[...!n||(o=s.context)!=null&&o.open?[s]:[],...Ye(e,s.id,n)]})}function yn(e,t){var s;let n=[],r=(s=e.find(o=>o.id===t))==null?void 0:s.parentId;for(;r;){const o=e.find(i=>i.id===r);r=o==null?void 0:o.parentId,o&&(n=n.concat(o))}return n}function mt(e){return`data-base-ui-${e}`}let ct=0;function Tt(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:s=!1}=t;r&&cancelAnimationFrame(ct);const o=()=>e==null?void 0:e.focus({preventScroll:n});if(s)return o(),$t;const i=requestAnimationFrame(o);return ct=i,()=>{ct===i&&(cancelAnimationFrame(i),ct=0)}}const kt={inert:new WeakMap,"aria-hidden":new WeakMap},xn="data-base-ui-inert",Ut={inert:new WeakSet,"aria-hidden":new WeakSet};let Xe=new WeakMap,Pt=0;function bo(e){return Ut[e]}function br(e){return e?_t(e)?e.host:br(e.parentNode):null}const It=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=br(n);return e.contains(r)?r:null}).filter(n=>n!=null),Sn=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},En=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{Te(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function yo(e,t,n,r,{mark:s=!0,markerIgnoreElements:o=[]}){const i=r?"inert":n?"aria-hidden":null;let l=null,h=null;const a=It(t,e),d=s?It(t,o):[],g=new Set(d),w=s?En(t,Sn(a),new Set(a)).filter(p=>!g.has(p)):[],m=[],b=[];if(i){const p=kt[i],y=bo(i);h=y,l=p;const E=It(t,Array.from(t.querySelectorAll("[aria-live]"))),S=a.concat(E);En(t,Sn(S),new Set(S)).forEach(P=>{const k=P.getAttribute(i),L=k!==null&&k!=="false",x=(p.get(P)||0)+1;p.set(P,x),m.push(P),x===1&&L&&y.add(P),L||P.setAttribute(i,i==="inert"?"":"true")})}return s&&w.forEach(p=>{const y=(Xe.get(p)||0)+1;Xe.set(p,y),b.push(p),y===1&&p.setAttribute(xn,"")}),Pt+=1,()=>{l&&m.forEach(p=>{const E=(l.get(p)||0)-1;l.set(p,E),E||(!(h!=null&&h.has(p))&&i&&p.removeAttribute(i),h==null||h.delete(p))}),s&&b.forEach(p=>{const y=(Xe.get(p)||0)-1;Xe.set(p,y),y||p.removeAttribute(xn)}),Pt-=1,Pt||(kt.inert=new WeakMap,kt["aria-hidden"]=new WeakMap,Ut.inert=new WeakSet,Ut["aria-hidden"]=new WeakSet,Xe=new WeakMap)}}function wn(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0,markerIgnoreElements:o=[]}=t,i=ee(e[0]).body;return yo(e,i,n,r,{mark:s,markerIgnoreElements:o})}const xo="data-base-ui-click-trigger",So={clipPath:"inset(50%)",position:"fixed",top:0,left:0},yr=c.createContext(null),xr=()=>c.useContext(yr),Eo=mt("portal");function wo(e={}){const{ref:t,container:n,componentProps:r=Qe,elementProps:s}=e,o=Gt(),i=xr(),l=i==null?void 0:i.portalNode,[h,a]=c.useState(null),[d,g]=c.useState(null),w=se(y=>{y!==null&&g(y)}),m=c.useRef(null);ne(()=>{if(n===null){m.current&&(m.current=null,g(null),a(null));return}if(o==null)return;const y=(n&&(Xr(n)?n:n.current))??l??document.body;if(y==null){m.current&&(m.current=null,g(null),a(null));return}m.current!==y&&(m.current=y,g(null),a(y))},[n,l,o]);const b=nt("div",r,{ref:[t,w],props:[{id:o,[Eo]:""},s]});return{portalNode:d,portalSubtree:h&&b?On.createPortal(b,h):null}}const vo=c.forwardRef(function(t,n){const{children:r,container:s,className:o,render:i,renderGuards:l,style:h,...a}=t,{portalNode:d,portalSubtree:g}=wo({container:s,ref:n,componentProps:t,elementProps:a}),w=c.useRef(null),m=c.useRef(null),b=c.useRef(null),p=c.useRef(null),[y,E]=c.useState(null),S=c.useRef(!1),D=y==null?void 0:y.modal,P=y==null?void 0:y.open,k=typeof l=="boolean"?l:!!y&&!y.modal&&y.open&&!!d;c.useEffect(()=>{if(!d||D)return;function x(C){d&&C.relatedTarget&&et(C)&&(C.type==="focusin"?S.current&&(bn(d),S.current=!1):(mo(d),S.current=!0))}return $e(Z(d,"focusin",x,!0),Z(d,"focusout",x,!0))},[d,D]),c.useEffect(()=>{!d||P!==!1||(bn(d),S.current=!1)},[P,d]);const L=c.useMemo(()=>({beforeOutsideRef:w,afterOutsideRef:m,beforeInsideRef:b,afterInsideRef:p,portalNode:d,setFocusManagerState:E}),[d]);return f.jsxs(c.Fragment,{children:[g,f.jsxs(yr.Provider,{value:L,children:[k&&d&&f.jsx(gt,{"data-type":"outside",ref:w,onFocus:x=>{var C;if(et(x,d))(C=b.current)==null||C.focus();else{const j=y?y.domReference:null,_=mr(j);_==null||_.focus()}}}),k&&d&&f.jsx("span",{"aria-owns":d.id,style:So}),d&&On.createPortal(r,d),k&&d&&f.jsx(gt,{"data-type":"outside",ref:m,onFocus:x=>{var C;if(et(x,d))(C=p.current)==null||C.focus();else{const j=y?y.domReference:null,_=gr(j);_==null||_.focus(),y!=null&&y.closeOnFocusOut&&(y==null||y.onOpenChange(!1,Ne(Ln,x.nativeEvent)))}}})]})]})});function Ro(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const Co=c.createContext(null),To=c.createContext(null),Sr=()=>{var e;return((e=c.useContext(Co))==null?void 0:e.id)||null},Er=e=>{const t=c.useContext(To);return e??t};function ko(e,t){const n=bt(Fe(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"):""}const vn=20;let je=[];function Xt(){je=je.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function Po(e){Xt(),e&&Te(e)!=="body"&&(je.push(new WeakRef(e)),je.length>vn&&(je=je.slice(-vn)))}function Mt(){var e;return Xt(),(e=je[je.length-1])==null?void 0:e.deref()}function Io(e){return e?zt(e)?e:yt(e)[0]||e:null}function Rn(e,t){var o;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!((o=e.getAttribute("role"))!=null&&o.includes("dialog")))return;const r=pr(e).filter(i=>{const l=i.getAttribute("data-tabindex")||"";return zt(i)||i.hasAttribute("data-tabindex")&&!l.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Mo(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:o=!0,restoreFocus:i=!1,modal:l=!0,closeOnFocusOut:h=!0,openInteractionType:a="",nextFocusableElement:d,previousFocusableElement:g,beforeContentFocusGuardRef:w,externalTree:m,getInsideElements:b}=e,p="rootStore"in t?t.rootStore:t,y=p.useState("open"),E=p.useState("domReferenceElement"),S=p.useState("floatingElement"),{events:D,dataRef:P}=p.context,k=se(()=>{var O;return(O=P.current.floatingContext)==null?void 0:O.nodeId}),L=s===!1,x=mn(E)&&L,C=c.useRef(["content"]),j=Rt(s),_=Rt(o),K=Rt(a),V=Er(m),u=xr(),I=c.useRef(!1),W=c.useRef(!1),$=c.useRef(!1),fe=c.useRef(null),ae=c.useRef(""),Ee=c.useRef(""),Ve=c.useRef(null),B=c.useRef(null),ve=nn(Ve,w,u==null?void 0:u.beforeInsideRef),Ke=nn(B,u==null?void 0:u.afterInsideRef),Ue=ft(),Me=ft(),Oe=ls(),be=u!=null,A=Vt(S),ce=se((O=A)=>O?yt(O):[]),pe=se(()=>(b==null?void 0:b().filter(O=>O!=null))??[]);c.useEffect(()=>{if(r||!l)return;function O(U){U.key==="Tab"&&G(A,He(ee(A)))&&ce().length===0&&!x&&Qs(U)}const X=ee(A);return Z(X,"keydown",O)},[r,E,A,l,C,x,ce]),c.useEffect(()=>{if(r||!y)return;const O=ee(A);function X(){$.current=!1}function U(F){const N=Fe(F),J=pe(),M=G(S,N)||G(E,N)||G(u==null?void 0:u.portalNode,N)||J.some(ye=>ye===N||G(ye,N));$.current=!M,Ee.current=F.pointerType||"keyboard",N!=null&&N.closest(`[${xo}]`)&&(W.current=!0)}function te(){Ee.current="keyboard"}return $e(Z(O,"pointerdown",U,!0),Z(O,"pointerup",X,!0),Z(O,"pointercancel",X,!0),Z(O,"keydown",te,!0))},[r,S,E,A,y,u,pe]),c.useEffect(()=>{if(r||!h)return;const O=ee(A);function X(){W.current=!0,Me.start(0,()=>{W.current=!1})}function U(J){const M=Fe(J);zt(M)&&(fe.current=M)}function te(J){const M=J.relatedTarget,ye=J.currentTarget,Y=Fe(J);queueMicrotask(()=>{const xe=k(),v=p.context.triggerElements,T=pe(),oe=(M==null?void 0:M.hasAttribute(mt("focus-guard")))&&[Ve.current,B.current,u==null?void 0:u.beforeInsideRef.current,u==null?void 0:u.afterInsideRef.current,u==null?void 0:u.beforeOutsideRef.current,u==null?void 0:u.afterOutsideRef.current,De(g),De(d)].includes(M),re=!(G(E,M)||G(S,M)||G(M,S)||G(u==null?void 0:u.portalNode,M)||T.some(z=>z===M||G(z,M))||M!=null&&v.hasElement(M)||v.hasMatchingElement(z=>G(z,M))||oe||V&&(Ye(V.nodesRef.current,xe).find(z=>{var ie,le;return G((ie=z.context)==null?void 0:ie.elements.floating,M)||G((le=z.context)==null?void 0:le.elements.domReference,M)})||yn(V.nodesRef.current,xe).find(z=>{var ie,le,ot;return[(ie=z.context)==null?void 0:ie.elements.floating,Vt((le=z.context)==null?void 0:le.elements.floating)].includes(M)||((ot=z.context)==null?void 0:ot.elements.domReference)===M})));if(ye===E&&A&&Rn(A,C),i&&ye!==E&&!ir(Y)&&He(O)===O.body){if(Se(A)&&(A.focus(),i==="popup")){Oe.request(()=>{A.focus()});return}const z=ce(),ie=fe.current,le=(ie&&z.includes(ie)?ie:null)||z[z.length-1]||A;Se(le)&&le.focus()}if(P.current.insideReactTree){P.current.insideReactTree=!1;return}(x||!l)&&M&&re&&!W.current&&(x||M!==Mt())&&(I.current=!0,p.setOpen(!1,Ne(Ln,J)))})}function F(){$.current||(P.current.insideReactTree=!0,Ue.start(0,()=>{P.current.insideReactTree=!1}))}const N=Se(E)?E:null;if(!(!S&&!N))return $e(N&&Z(N,"focusout",te),N&&Z(N,"pointerdown",X),S&&Z(S,"focusin",U),S&&Z(S,"focusout",te),S&&u&&Z(S,"focusout",F,!0))},[r,E,S,A,l,V,u,p,h,i,ce,x,k,C,P,Ue,Me,Oe,d,g,pe]),c.useEffect(()=>{var ye,Y,xe;if(r||!S||!y)return;const O=Array.from(((ye=u==null?void 0:u.portalNode)==null?void 0:ye.querySelectorAll(`[${mt("portal")}]`))||[]),U=(xe=(Y=(V?yn(V.nodesRef.current,k()):[]).find(v=>{var T;return mn(((T=v.context)==null?void 0:T.elements.domReference)||null)}))==null?void 0:Y.context)==null?void 0:xe.elements.domReference,F=[...[S,...O,Ve.current,B.current,u==null?void 0:u.beforeOutsideRef.current,u==null?void 0:u.afterOutsideRef.current,...pe()],U,De(g),De(d),x?E:null].filter(v=>v!=null),N=wn(F,{ariaHidden:l||x,mark:!1}),J=[S,...O].filter(v=>v!=null),M=wn(J);return()=>{M(),N()}},[y,r,E,S,l,C,u,x,V,k,d,g,pe]),ne(()=>{if(!y||r||!Se(A))return;const O=ee(A),X=He(O);queueMicrotask(()=>{const U=j.current,te=typeof U=="function"?U(K.current||""):U;if(te===void 0||te===!1||G(A,X))return;let N=null;const J=()=>(N==null&&(N=ce(A)),N[0]||A);let M;te===!0||te===null?M=J():M=De(te),M=M||J(),Tt(M,{preventScroll:M===A})})},[r,y,A,L,ce,j,K]),ne(()=>{if(r||!A)return;const O=ee(A),X=He(O);Po(X);function U(F){if(F.open||(ae.current=ko(F.nativeEvent,Ee.current)),F.reason===us&&F.nativeEvent.type==="mouseleave"&&(I.current=!0),F.reason===Vn)if(F.nested)I.current=!1;else if(to(F.nativeEvent)||no(F.nativeEvent))I.current=!1;else{let N=!1;ee(A).createElement("div").focus({get preventScroll(){return N=!0,!1}}),N?I.current=!1:I.current=!0}}D.on("openchange",U);function te(){const F=_.current;let N=typeof F=="function"?F(ae.current):F;if(N===void 0||N===!1)return null;if(N===null&&(N=!0),typeof N=="boolean"){const M=E||Mt();return M&&M.isConnected?M:null}const J=E||Mt();return De(N)||J||null}return()=>{D.off("openchange",U);const F=He(O),N=pe(),J=G(S,F)||N.some(Y=>Y===F||G(Y,F))||V&&Ye(V.nodesRef.current,k(),!1).some(Y=>{var xe;return G((xe=Y.context)==null?void 0:xe.elements.floating,F)}),M=_.current,ye=te();queueMicrotask(()=>{const Y=Io(ye),xe=typeof M!="boolean";M&&!I.current&&Se(Y)&&(!(!xe&&Y!==F&&F!==O.body)||J)&&Y.focus({preventScroll:!0}),I.current=!1})}},[r,S,A,_,P,D,V,E,k,pe]),ne(()=>{if(!tr||y||!S)return;const O=He(ee(S));!Se(O)||!or(O)||G(S,O)&&O.blur()},[y,S]),ne(()=>{if(!(r||!u))return u.setFocusManagerState({modal:l,closeOnFocusOut:h,open:y,onOpenChange:p.setOpen,domReference:E}),()=>{u.setFocusManagerState(null)}},[r,u,l,y,p,h,E]),ne(()=>{if(!(r||!A))return Rn(A,C),()=>{queueMicrotask(Xt)}},[r,A,C]);const st=!r&&(l?!x:!0)&&(be||l);return f.jsxs(c.Fragment,{children:[st&&f.jsx(gt,{"data-type":"inside",ref:ve,onFocus:O=>{var X;if(l){const U=ce();Tt(U[U.length-1])}else if(u!=null&&u.portalNode)if(I.current=!1,et(O,u.portalNode)){const U=gr(E);U==null||U.focus()}else(X=De(g??u.beforeOutsideRef))==null||X.focus()}}),n,st&&f.jsx(gt,{"data-type":"inside",ref:Ke,onFocus:O=>{var X;if(l)Tt(ce()[0]);else if(u!=null&&u.portalNode)if(h&&(I.current=!0),et(O,u.portalNode)){const U=mr(E);U==null||U.focus()}else(X=De(d??u.afterOutsideRef))==null||X.focus()}})]})}const Oo={intentional:"onClick",sloppy:"onPointerDown"};function Do(){return!1}function Ao(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function No(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingElement"),{dataRef:o}=n.context,{enabled:i=!0,escapeKey:l=!0,outsidePress:h=!0,outsidePressEvent:a="sloppy",referencePress:d=Do,referencePressEvent:g="sloppy",bubbles:w,externalTree:m}=t,b=Er(m),p=se(typeof h=="function"?h:()=>!1),y=typeof h=="function"?p:h,E=y!==!1,S=se(()=>a),D=c.useRef(!1),P=c.useRef(!1),k=c.useRef(!1),{escapeKey:L,outsidePress:x}=Ao(w),C=c.useRef(null),j=ft(),_=ft(),K=se(()=>{_.clear(),o.current.insideReactTree=!1}),V=c.useRef(!1),u=c.useRef(""),I=se(d),W=se(B=>{var Oe;if(!r||!i||!l||B.key!=="Escape"||V.current)return;const ve=(Oe=o.current.floatingContext)==null?void 0:Oe.nodeId,Ke=b?Ye(b.nodesRef.current,ve):[];if(!L&&Ke.length>0){let be=!0;if(Ke.forEach(A=>{var ce;(ce=A.context)!=null&&ce.open&&!A.context.dataRef.current.__escapeKeyBubbles&&(be=!1)}),!be)return}const Ue=eo(B)?B.nativeEvent:B,Me=Ne(ds,Ue);n.setOpen(!1,Me),!L&&!Me.isPropagationAllowed&&B.stopPropagation()}),$=se(()=>{o.current.insideReactTree=!0,_.start(0,K)});c.useEffect(()=>{if(!r||!i)return;o.current.__escapeKeyBubbles=L,o.current.__outsidePressBubbles=x;const B=new pt,ve=new pt;function Ke(){B.clear(),V.current=!0}function Ue(){B.start(Jr()?5:0,()=>{V.current=!1})}function Me(){k.current=!0,ve.start(0,()=>{k.current=!1})}function Oe(){D.current=!1,P.current=!1}function be(){const v=u.current,T=v==="pen"||!v?"mouse":v,oe=S(),re=typeof oe=="function"?oe():oe;return typeof re=="string"?re:re[T]}function A(v){const T=be();return T==="intentional"&&v.type!=="click"||T==="sloppy"&&v.type==="click"}function ce(v){var re;const T=(re=o.current.floatingContext)==null?void 0:re.nodeId,oe=b&&Ye(b.nodesRef.current,T).some(z=>{var ie;return we(v,(ie=z.context)==null?void 0:ie.elements.floating)});return we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement"))||oe}function pe(v){var en;if(A(v)){K();return}if(o.current.insideReactTree){K();return}const T=Fe(v),oe=`[${mt("inert")}]`,re=Je(T)?T.getRootNode():null,z=Array.from((_t(re)?re:ee(n.select("floatingElement"))).querySelectorAll(oe)),ie=n.context.triggerElements;if(T&&(ie.hasElement(T)||ie.hasMatchingElement(he=>G(he,T))))return;let le=Je(T)?T:null;for(;le&&!St(le);){const he=Qr(le);if(St(he)||!Je(he))break;le=he}if(z.length&&Je(T)&&!co(T)&&!G(T,n.select("floatingElement"))&&z.every(he=>!G(le,he)))return;if(Se(T)&&!("touches"in v)){const he=St(T),We=Bt(T),qe=/auto|scroll/,Lr=he||qe.test(We.overflowX),Vr=he||qe.test(We.overflowY),Kr=Lr&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,Ur=Vr&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Wr=We.direction==="rtl",Br=Ur&&(Wr?v.offsetX<=T.offsetWidth-T.clientWidth:v.offsetX>T.clientWidth),_r=Kr&&v.offsetY>T.clientHeight;if(Br||_r)return}if(ce(v))return;if(be()==="intentional"&&k.current){ve.clear(),k.current=!1;return}if(typeof y=="function"&&!y(v))return;const ot=(en=o.current.floatingContext)==null?void 0:en.nodeId,Qt=b?Ye(b.nodesRef.current,ot):[];if(Qt.length>0){let he=!0;if(Qt.forEach(We=>{var qe;(qe=We.context)!=null&&qe.open&&!We.context.dataRef.current.__outsidePressBubbles&&(he=!1)}),!he)return}n.setOpen(!1,Ne(Vn,v)),K()}function st(v){be()!=="sloppy"||v.pointerType==="touch"||!n.select("open")||!i||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement"))||pe(v)}function O(v){if(be()!=="sloppy"||!n.select("open")||!i||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement")))return;const T=v.touches[0];T&&(C.current={startTime:Date.now(),startX:T.clientX,startY:T.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{C.current&&(C.current.dismissOnTouchEnd=!1,C.current.dismissOnMouseDown=!1)}))}function X(v,T){const oe=Fe(v);if(!oe)return;const re=Z(oe,v.type,()=>{T(v),re()})}function U(v){u.current="touch",X(v,O)}function te(v){j.clear(),v.type==="pointerdown"&&(u.current=v.pointerType),!(v.type==="mousedown"&&C.current&&!C.current.dismissOnMouseDown)&&X(v,T=>{T.type==="pointerdown"?st(T):pe(T)})}function F(v){if(!D.current)return;const T=P.current;if(Oe(),be()==="intentional"){if(v.type==="pointercancel"){T&&Me();return}if(!ce(v)){if(T){Me();return}typeof y=="function"&&!y(v)||(ve.clear(),k.current=!0,K())}}}function N(v){if(be()!=="sloppy"||!C.current||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement")))return;const T=v.touches[0];if(!T)return;const oe=Math.abs(T.clientX-C.current.startX),re=Math.abs(T.clientY-C.current.startY),z=Math.sqrt(oe*oe+re*re);z>5&&(C.current.dismissOnTouchEnd=!0),z>10&&(pe(v),j.clear(),C.current=null)}function J(v){X(v,N)}function M(v){be()!=="sloppy"||!C.current||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement"))||(C.current.dismissOnTouchEnd&&pe(v),j.clear(),C.current=null)}function ye(v){X(v,M)}const Y=ee(s),xe=$e(l&&$e(Z(Y,"keydown",W),Z(Y,"compositionstart",Ke),Z(Y,"compositionend",Ue)),E&&$e(Z(Y,"click",te,!0),Z(Y,"pointerdown",te,!0),Z(Y,"pointerup",F,!0),Z(Y,"pointercancel",F,!0),Z(Y,"mousedown",te,!0),Z(Y,"mouseup",F,!0),Z(Y,"touchstart",U,!0),Z(Y,"touchmove",J,!0),Z(Y,"touchend",ye,!0)));return()=>{xe(),B.clear(),ve.clear(),Oe(),k.current=!1}},[o,s,l,E,y,r,i,L,x,W,K,S,b,n,j]),c.useEffect(K,[y,K]);const fe=c.useMemo(()=>({onKeyDown:W,[Oo[g]]:B=>{I()&&n.setOpen(!1,Ne(on,B.nativeEvent))},...g!=="intentional"&&{onClick(B){I()&&n.setOpen(!1,Ne(on,B.nativeEvent))}}}),[W,n,g,I]),ae=se(B=>{if(!r||!i||B.button!==0)return;const ve=Fe(B.nativeEvent);G(n.select("floatingElement"),ve)&&(D.current||(D.current=!0,P.current=!1))}),Ee=se(B=>{!r||!i||(B.defaultPrevented||B.nativeEvent.defaultPrevented)&&D.current&&(P.current=!0)}),Ve=c.useMemo(()=>({onKeyDown:W,onPointerDown:Ee,onMouseDown:Ee,onClickCapture:$,onMouseDownCapture(B){$(),ae(B)},onPointerDownCapture(B){$(),ae(B)},onMouseUpCapture:$,onTouchEndCapture:$,onTouchMoveCapture:$}),[W,$,ae,Ee]);return c.useMemo(()=>i?{reference:fe,floating:Ve,trigger:fe}:{},[i,fe,Ve])}const H=(e,t,n,r,s,o,...i)=>{if(i.length>0)throw new Error(Yt(1));let l;if(e)l=e;else throw new Error("Missing arguments");return l};var jo=es();const Fo=Dn(19),Ho=Fo?Vo:Ko;function wr(e,t,n,r,s){return Ho(e,t,n,r,s)}function Lo(e,t,n,r,s){const o=c.useCallback(()=>t(e.getSnapshot(),n,r,s),[e,t,n,r,s]);return jo.useSyncExternalStore(e.subscribe,o,o)}function Vo(e,t,n,r,s){return Lo(e,t,n,r,s)}function Ko(e,t,n,r,s){return ts.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,r,s))}class Uo{constructor(t){ge(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ge(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,s){return wr(this,t,n,r,s)}}class vr extends Uo{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){c.useDebugValue(t),ne(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;ne(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);ne(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){c.useDebugValue(t);const r=n!==void 0;ne(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r])}select(t,n,r,s){const o=this.selectors[t];return o(this.state,n,r,s)}useState(t,n,r,s){return c.useDebugValue(t),wr(this,this.selectors[t],n,r,s)}useContextCallback(t,n){c.useDebugValue(t);const r=se(n??$t);this.context[t]=r}useStateSetter(t){const n=c.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let s=r(this.state);return n(s,s,this),this.subscribe(o=>{const i=r(o);if(!Object.is(s,i)){const l=s;s=i,n(i,l,this)}})}}const Wo={open:H(e=>e.open),transitionStatus:H(e=>e.transitionStatus),domReferenceElement:H(e=>e.domReferenceElement),referenceElement:H(e=>e.positionReference??e.referenceElement),floatingElement:H(e=>e.floatingElement),floatingId:H(e=>e.floatingId)};class Rr extends vr{constructor(n){const{syncOnly:r,nested:s,onOpenChange:o,triggerElements:i,...l}=n;super({...l,positionReference:l.referenceElement,domReferenceElement:l.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:Ro(),nested:s,triggerElements:i},Wo);ge(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&ro(r))&&(this.context.dataRef.current.openEvent=n?r:void 0)});ge(this,"dispatchOpenChange",(n,r)=>{this.syncOpenEvent(n,r.event);const s={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",s)});ge(this,"setOpen",(n,r)=>{var s,o,i,l;if(this.syncOnly){(o=(s=this.context).onOpenChange)==null||o.call(s,n,r);return}this.dispatchOpenChange(n,r),(l=(i=this.context).onOpenChange)==null||l.call(i,n,r)});this.syncOnly=r}}function Bo(e){const t=e.useState("open");ne(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,s]=n.value;e.update({activeTriggerId:r,activeTriggerElement:s})}}},[t,e])}function _o(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=fs(e);t.useSyncedValues({mounted:r,transitionStatus:o});const i=se(()=>{var h,a;s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),(a=(h=t.context).onOpenChangeComplete)==null||a.call(h,!1)}),l=t.useState("preventUnmountingOnClose");return Kn({enabled:!l,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:o}}class Cr{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function $o(){return new Rr({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Cr,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0})}function Yo(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:$o(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Qe,inactiveTriggerProps:Qe,popupProps:Qe}}const lt=H(e=>e.triggerIdProp??e.activeTriggerId),Zo={open:H(e=>e.openProp??e.open),mounted:H(e=>e.mounted),transitionStatus:H(e=>e.transitionStatus),floatingRootContext:H(e=>e.floatingRootContext),preventUnmountingOnClose:H(e=>e.preventUnmountingOnClose),payload:H(e=>e.payload),activeTriggerId:lt,activeTriggerElement:H(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:H((e,t)=>t!==void 0&&lt(e)===t),isOpenedByTrigger:H((e,t)=>t!==void 0&&lt(e)===t&&e.open),isMountedByTrigger:H((e,t)=>t!==void 0&&lt(e)===t&&e.mounted),triggerProps:H((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:H(e=>e.popupProps),popupElement:H(e=>e.popupElement),positionerElement:H(e=>e.positionerElement)};function Go(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,s=Gt(),o=Sr()!=null,i=t.useState("open"),l=t.useState("activeTriggerElement"),h=t.useState(n?"popupElement":"positionerElement"),a=t.context.triggerElements,d=Wt(()=>new Rr({open:i,transitionStatus:void 0,referenceElement:l,floatingElement:h,triggerElements:a,onOpenChange:r,floatingId:s,syncOnly:!0,nested:o})).current;return ne(()=>{const g={open:i,floatingId:s,referenceElement:l,floatingElement:h};Je(l)&&(g.domReferenceElement=l),d.state.positionReference===d.state.referenceElement&&(g.positionReference=l),d.update(g)},[i,s,l,h,d]),d.context.onOpenChange=r,d.context.nested=o,d}function qo(e=[]){const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),s=e.map(a=>a==null?void 0:a.trigger),o=c.useCallback(a=>ut(a,e,"reference"),t),i=c.useCallback(a=>ut(a,e,"floating"),n),l=c.useCallback(a=>ut(a,e,"item"),r),h=c.useCallback(a=>ut(a,e,"trigger"),s);return c.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:l,getTriggerProps:h}),[o,i,l,h])}function ut(e,t,n){var i;const r=new Map,s=n==="item",o={};n==="floating"&&(o.tabIndex=-1,o[Lt]="");for(const l in e)s&&e&&(l===rr||l===sr)||(o[l]=e[l]);for(let l=0;l<t.length;l+=1){let h;const a=(i=t[l])==null?void 0:i[n];typeof a=="function"?h=e?a(e):null:h=a,h&&Cn(o,h,s,r)}return Cn(o,e,s,r),o}function Cn(e,t,n,r){var s;for(const o in t){const i=t[o];n&&(o===rr||o===sr)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof i=="function"&&((s=r.get(o))==null||s.push(i),e[o]=(...l)=>{var h;return(h=r.get(o))==null?void 0:h.map(a=>a(...l)).find(a=>a!==void 0)})):e[o]=i)}}const zo=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Xo(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingId"),o=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:l="dialog"}=t,h=Gt(),a=(o==null?void 0:o.id)||h,d=c.useMemo(()=>{var S;return((S=Vt(i))==null?void 0:S.id)||s},[i,s]),g=zo.get(l)??l,m=Sr()!=null,b=c.useMemo(()=>g==="tooltip"||l==="label"?Qe:{"aria-haspopup":g==="alertdialog"?"dialog":g,"aria-expanded":"false",...g==="listbox"&&{role:"combobox"},...g==="menu"&&m&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,m,l]),p=c.useMemo(()=>g==="tooltip"||l==="label"?{[`aria-${l==="label"?"labelledby":"describedby"}`]:r?d:void 0}:{...b,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,...g==="menu"&&{id:a}},[g,d,r,a,l,b]),y=c.useMemo(()=>{const S={id:d,...g&&{role:g}};return g==="tooltip"||l==="label"?S:{...S,...g==="menu"&&{"aria-labelledby":a}}},[g,d,a,l]),E=c.useCallback(({active:S,selected:D})=>{const P={role:"option",...S&&{id:`${d}-fui-option`}};switch(l){case"select":case"combobox":return{...P,"aria-selected":D}}return{}},[d,l]);return c.useMemo(()=>({reference:p,floating:y,item:E,trigger:b}),[p,y,b,E])}let Le=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=an.startingStyle]="startingStyle",e[e.endingStyle=an.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const Jo={[Le.open]:""},Qo={[Le.closed]:""},ei={[Le.anchorHidden]:""},Tr={open(e){return e?Jo:Qo},anchorHidden(e){return e?ei:null}};function ti(e){return Dn(19)?e:e?"true":void 0}const ni=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M238.15,78.54,177.46,17.86a20,20,0,0,0-28.3,0L97.2,70c-12.43-3.33-36.68-5.72-61.74,14.5a20,20,0,0,0-1.6,29.73l45.46,45.47-39.8,39.8a12,12,0,0,0,17,17l39.8-39.81,45.47,45.46A20,20,0,0,0,155.91,228c.46,0,.93,0,1.4-.05A20,20,0,0,0,171.87,220c4.69-6.23,11-16.13,14.44-28s3.45-22.88.16-33.4l51.7-51.87A20,20,0,0,0,238.15,78.54Zm-74.26,68.79a12,12,0,0,0-2.23,13.84c3.43,6.86,6.9,21-6.28,40.65L54.08,100.53c21.09-14.59,39.53-6.64,41-6a11.67,11.67,0,0,0,13.81-2.29l54.43-54.61,55,55Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M229.66,98.34,172.39,155.8c11.46,22.93-1.72,45.86-10.11,57a8,8,0,0,1-12,.83L42.34,105.76A8,8,0,0,1,43,93.85c29.65-23.92,57.4-10,57.4-10l57.27-57.46a8,8,0,0,1,11.31,0L229.66,87A8,8,0,0,1,229.66,98.34Z",opacity:"0.2"}),c.createElement("path",{d:"M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M235.33,104l-53.47,53.65c4.56,12.67,6.45,33.89-13.19,60A15.93,15.93,0,0,1,157,224c-.38,0-.75,0-1.13,0a16,16,0,0,1-11.32-4.69L96.29,171,53.66,213.66a8,8,0,0,1-11.32-11.32L85,159.71l-48.3-48.3A16,16,0,0,1,38,87.63c25.42-20.51,49.75-16.48,60.4-13.14L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.33,104Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M233.91,82.79,173.22,22.1a14,14,0,0,0-19.81,0L98.93,76.77c-9.52-3.25-34-8.34-59.71,12.41A14,14,0,0,0,38.1,110l49.71,49.71-44.05,44a6,6,0,1,0,8.48,8.48l44.05-44.05L146,217.89a14,14,0,0,0,9.9,4.11q.49,0,1,0a14,14,0,0,0,10.19-5.54c19.72-26.21,17.15-47.23,12.46-59.3l54.37-54.55A14,14,0,0,0,233.91,82.79ZM225.42,94.1h0l-57.27,57.46a6,6,0,0,0-1.11,6.92c9.94,19.88-1.71,40.32-9.54,50.72a2,2,0,0,1-3,.2L46.58,101.51a2,2,0,0,1,.18-3c12.5-10.09,24.5-12.76,33.7-12.76a42.13,42.13,0,0,1,17.25,3.41A6,6,0,0,0,104.64,88L161.9,30.59a2,2,0,0,1,2.83,0l60.69,60.68A2,2,0,0,1,225.42,94.1Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M232.49,84.2,171.8,23.51a12,12,0,0,0-17,0L99.45,79.07c-8.08-3-32.79-9.45-59,11.67a12,12,0,0,0-1,17.84l51.13,51.13L45.17,205.17a4,4,0,0,0,5.66,5.66l45.46-45.47,51.12,51.12A12,12,0,0,0,155.9,220c.28,0,.57,0,.85,0a12,12,0,0,0,8.73-4.74c19.83-26.36,16.51-47.18,11.71-58.57l55.3-55.49A12,12,0,0,0,232.49,84.2Zm-5.66,11.31h0L169.56,153a4,4,0,0,0-.75,4.61c10.43,20.85-1.62,42-9.73,52.83a4,4,0,0,1-6,.4L45.17,102.93a4,4,0,0,1,.33-6C58.44,86.53,70.86,83.74,80.44,83.74A43.9,43.9,0,0,1,98.6,87.38a4,4,0,0,0,4.62-.75l57.27-57.46a4,4,0,0,1,5.66,0l60.68,60.69A4,4,0,0,1,226.83,95.51Z"}))]]),ri=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),c.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),kr=c.forwardRef((e,t)=>c.createElement(An,{ref:t,...e,weights:ni}));kr.displayName="PushPinIcon";const Pr=kr,Ir=c.forwardRef((e,t)=>c.createElement(An,{ref:t,...e,weights:ri}));Ir.displayName="TrashIcon";const si=Ir,oi=c.forwardRef(function({memory:t,selected:n,focused:r,confirming:s,onSelect:o,onPin:i,onDelete:l,onDeleteStart:h,onDeleteCancel:a},d){const g=t.content.length>140?`${t.content.slice(0,140)}…`:t.content;return f.jsxs("li",{ref:d,className:de("group relative flex flex-col gap-1.5 border-b border-border px-4 py-3 transition-colors","hover:bg-accent/40",n&&"bg-accent/60",r&&!n&&"bg-accent/20",r&&"outline-none ring-1 ring-inset ring-primary/40"),onMouseLeave:a,children:[f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsxs(Ae,{variant:"ghost",onClick:o,className:"h-auto flex-1 min-w-0 items-start justify-start whitespace-normal p-0 font-normal hover:bg-transparent",children:[f.jsx(rn,{variant:t.type,className:"mt-px shrink-0",title:Nn[t.type],children:jn(t.type)}),f.jsx("p",{className:"flex-1 text-xs leading-relaxed text-foreground line-clamp-2 min-w-0 text-left",children:g})]}),f.jsxs("div",{className:de("flex items-center gap-1 transition-opacity shrink-0",t.pinned?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[f.jsx(Ae,{variant:"ghost",size:"icon-sm",onClick:i,"aria-label":t.pinned?"Unpin":"Pin",className:de(t.pinned&&"text-primary"),children:f.jsx(Pr,{weight:t.pinned?"fill":"regular"})}),f.jsx(Ae,{variant:"ghost",size:"icon-sm",onClick:s?l:h,onBlur:a,"aria-label":s?"Confirm delete":"Delete",className:de(s?"text-destructive bg-destructive/10":"hover:text-destructive",t.pinned&&"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity"),children:f.jsx(si,{weight:s?"fill":"regular"})})]})]}),f.jsxs("div",{className:"flex items-center gap-2 pl-[42px]",children:[t.tags.length>0&&f.jsx("div",{className:"flex gap-1 flex-wrap",children:t.tags.map(w=>f.jsx(rn,{variant:"outline",children:w},w))}),f.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[t.needsReview&&f.jsx("span",{title:"Flagged for review — possible duplicate or conflict with another memory",children:f.jsx(Fn,{weight:"fill",className:"size-3 text-[var(--type-correction)]"})}),t.projects.length>0?f.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-32",children:t.projects.map(w=>w.name).join(", ")}):f.jsx("span",{className:"text-[11px] text-muted-foreground",children:"global"}),f.jsx("span",{className:"text-[11px] text-muted-foreground",children:new Date(t.updatedAt).toLocaleDateString()})]})]})]})}),Mr=c.createContext(void 0);function Ge(e){const t=c.useContext(Mr);if(e===!1&&t===void 0)throw new Error(Yt(27));return t}const ii={...Tr,...Un},ai=c.forwardRef(function(t,n){const{render:r,className:s,style:o,forceRender:i=!1,...l}=t,{store:h}=Ge(),a=h.useState("open"),d=h.useState("nested"),g=h.useState("mounted"),w=h.useState("transitionStatus");return nt("div",t,{state:{open:a,transitionStatus:w},ref:[h.context.backdropRef,n],stateAttributesMapping:ii,props:[{role:"presentation",hidden:!g,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:i||!d})}),ci=c.forwardRef(function(t,n){const{render:r,className:s,disabled:o=!1,nativeButton:i=!0,style:l,...h}=t,{store:a}=Ge(),d=a.useState("open");function g(p){d&&a.setOpen(!1,Ne(ps,p.nativeEvent))}const{getButtonProps:w,buttonRef:m}=ns({disabled:o,native:i});return nt("button",t,{state:{disabled:o},ref:[n,m],props:[{onClick:g},h,w]})});let li=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),ui=(function(e){return e[e.open=Le.open]="open",e[e.closed=Le.closed]="closed",e[e.startingStyle=Le.startingStyle]="startingStyle",e[e.endingStyle=Le.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Or=c.createContext(void 0);function di(){const e=c.useContext(Or);if(e===void 0)throw new Error(Yt(26));return e}const Dr="ArrowUp",Ar="ArrowDown",Nr="ArrowLeft",jr="ArrowRight",Fr="Home",Hr="End",fi=new Set([Nr,jr]),pi=new Set([Dr,Ar]),hi=new Set([...fi,...pi]);[...hi];const gi=new Set([Dr,Ar,Nr,jr,Fr,Hr]),mi={...Tr,...Un,nestedDialogOpen(e){return e?{[ui.nestedDialogOpen]:""}:null}},bi=c.forwardRef(function(t,n){const{className:r,finalFocus:s,initialFocus:o,render:i,style:l,...h}=t,{store:a}=Ge(),d=a.useState("descriptionElementId"),g=a.useState("disablePointerDismissal"),w=a.useState("floatingRootContext"),m=a.useState("popupProps"),b=a.useState("modal"),p=a.useState("mounted"),y=a.useState("nested"),E=a.useState("nestedOpenDialogCount"),S=a.useState("open"),D=a.useState("openMethod"),P=a.useState("titleElementId"),k=a.useState("transitionStatus"),L=a.useState("role");di(),Kn({open:S,ref:a.context.popupRef,onComplete(){var V,u;S&&((u=(V=a.context).onOpenChangeComplete)==null||u.call(V,!0))}});function x(V){return V==="touch"?a.context.popupRef.current:!0}const C=o===void 0?x:o,j=E>0,K=nt("div",t,{state:{open:S,nested:y,transitionStatus:k,nestedDialogOpen:j},props:[m,{"aria-labelledby":P??void 0,"aria-describedby":d??void 0,role:L,tabIndex:-1,hidden:!p,onKeyDown(V){gi.has(V.key)&&V.stopPropagation()},style:{[li.nestedDialogs]:E}},h],ref:[n,a.context.popupRef,a.useStateSetter("popupElement")],stateAttributesMapping:mi});return f.jsx(Mo,{context:w,openInteractionType:D,disabled:!p,closeOnFocusOut:!g,initialFocus:C,returnFocus:s,modal:b!==!1,restoreFocus:"popup",children:K})}),yi=c.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return f.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),xi=c.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t,{store:o}=Ge(),i=o.useState("mounted"),l=o.useState("modal"),h=o.useState("open");return i||r?f.jsx(Or.Provider,{value:r,children:f.jsxs(vo,{ref:n,...s,children:[i&&l===!0&&f.jsx(yi,{ref:o.context.internalBackdropRef,inert:ti(!h)}),t.children]})}):null});let Tn={},kn={},Pn="";function Si(e){if(typeof document>"u")return!1;const t=ee(e);return bt(t).innerWidth-t.documentElement.clientWidth>0}function Ei(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=ee(e),r=n.documentElement,s=n.body,o=Zt(r)?r:s,i=o.style.overflowY,l=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const h=o.offsetWidth;o.style.overflowY="hidden";const a=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=l,h===a}function wi(e){const t=ee(e),n=t.documentElement,r=t.body,s=Zt(n)?n:r,o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function vi(e){var m;const t=ee(e),n=t.documentElement,r=t.body,s=bt(n);let o=0,i=0,l=!1;const h=hs.create();if(tr&&(((m=s.visualViewport)==null?void 0:m.scale)??1)!==1)return()=>{};function a(){const b=s.getComputedStyle(n),p=s.getComputedStyle(r),S=(b.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Tn={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Pn=n.style.scrollBehavior,kn={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};const D=n.scrollHeight>n.clientHeight,P=n.scrollWidth>n.clientWidth,k=b.overflowY==="scroll"||p.overflowY==="scroll",L=b.overflowX==="scroll"||p.overflowX==="scroll",x=Math.max(0,s.innerWidth-r.clientWidth),C=Math.max(0,s.innerHeight-r.clientHeight),j=parseFloat(p.marginTop)+parseFloat(p.marginBottom),_=parseFloat(p.marginLeft)+parseFloat(p.marginRight),K=Zt(n)?n:r;if(l=Ei(e),l){n.style.scrollbarGutter=S,K.style.overflowY="hidden",K.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:S,overflowY:"hidden",overflowX:"hidden"}),(D||k)&&(n.style.overflowY="scroll"),(P||L)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:j||C?`calc(100dvh - ${j+C}px)`:"100dvh",width:_||x?`calc(100vw - ${_+x}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,Tn),Object.assign(r.style,kn),l||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Pn)}function g(){d(),h.request(a)}a();const w=Z(s,"resize",g);return()=>{h.cancel(),d(),typeof s.removeEventListener=="function"&&w()}}class Ri{constructor(){ge(this,"lockCount",0);ge(this,"restore",null);ge(this,"timeoutLock",pt.create());ge(this,"timeoutUnlock",pt.create());ge(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});ge(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=ee(t).documentElement,s=bt(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=$t;return}const o=nr||!Si(t);this.restore=o?wi(t):vi(t)}}const Ci=new Ri;function Ti(e=!0,t=null){ne(()=>{if(e)return Ci.acquire(t)},[e,t])}function ki(e){const t=c.useRef(""),n=c.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:c.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function Pi(e,t){const n=c.useRef(e),r=se(t);ne(()=>{n.current!==e&&r(n.current)},[e,r]),ne(()=>{n.current=e},[e])}function Ii(e){const[t,n]=c.useState(null),r=se((i,l)=>{e||n(l||(nr?"touch":""))});Pi(e,i=>{i&&!e&&n(null)});const{onClick:s,onPointerDown:o}=ki(r);return c.useMemo(()=>({openMethod:t,triggerProps:{onClick:s,onPointerDown:o}}),[t,s,o])}function Mi(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:s}=e,o=t.useState("open"),i=t.useState("disablePointerDismissal"),l=t.useState("modal"),h=t.useState("popupElement"),{openMethod:a,triggerProps:d}=Ii(o);Bo(t);const{forceUnmount:g}=_o(o,t),w=c.useCallback(()=>{t.setOpen(!1,Ne(gs))},[t]);c.useImperativeHandle(r,()=>({unmount:g,close:w}),[g,w]);const m=Go({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[b,p]=c.useState(0),[y,E]=c.useState(0),S=b===0,D=Xo(m),P=No(m,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(K){if(!t.context.outsidePressEnabledRef.current||"button"in K&&K.button!==0||"touches"in K&&K.touches.length!==1)return!1;const V=Fe(K);if(S&&!i){const u=V;return l&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===u||t.context.backdropRef.current===u||G(u,h)&&!(u!=null&&u.hasAttribute("data-base-ui-portal")):!0}return!1},escapeKey:S});Ti(o&&l===!0,h);const{getReferenceProps:k,getFloatingProps:L,getTriggerProps:x}=qo([D,P]);t.useContextCallback("onNestedDialogOpen",(K,V)=>{p(K),E(V)}),t.useContextCallback("onNestedDialogClose",()=>{p(0),E(0)}),c.useEffect(()=>(n!=null&&n.onNestedDialogOpen&&o&&n.onNestedDialogOpen(b+1,y+(s?1:0)),n!=null&&n.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n!=null&&n.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[s,o,b,y,n]);const C=c.useMemo(()=>k(d),[k,d]),j=c.useMemo(()=>x(d),[x,d]),_=c.useMemo(()=>L(),[L]);t.useSyncedValues({openMethod:a,activeTriggerProps:C,inactiveTriggerProps:j,popupProps:_,floatingRootContext:m,nestedOpenDialogCount:b,nestedOpenDrawerCount:y})}const Oi={...Zo,modal:H(e=>e.modal),nested:H(e=>e.nested),nestedOpenDialogCount:H(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:H(e=>e.nestedOpenDrawerCount),disablePointerDismissal:H(e=>e.disablePointerDismissal),openMethod:H(e=>e.openMethod),descriptionElementId:H(e=>e.descriptionElementId),titleElementId:H(e=>e.titleElementId),viewportElement:H(e=>e.viewportElement),role:H(e=>e.role)};class Jt extends vr{constructor(n){super(Di(n),{popupRef:c.createRef(),backdropRef:c.createRef(),internalBackdropRef:c.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Cr,onOpenChange:void 0,onOpenChangeComplete:void 0},Oi);ge(this,"setOpen",(n,r)=>{var i,l,h;if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),(l=(i=this.context).onOpenChange)==null||l.call(i,n,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,r);const s={open:n},o=((h=r.trigger)==null?void 0:h.id)??null;(o||n)&&(s.activeTriggerId=o,s.activeTriggerElement=r.trigger??null),this.update(s)})}static useStore(n,r){const s=Wt(()=>new Jt(r)).current;return n??s}}function Di(e={}){return{...Yo(),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}}const In=c.createContext(!1);function Ai(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:o,disablePointerDismissal:i=!1,modal:l=!0,actionsRef:h,handle:a,triggerId:d,defaultTriggerId:g=null}=e,w=Ge(!0),m=c.useContext(In),b=!!w,p=Jt.useStore(a==null?void 0:a.store,{open:r,openProp:n,activeTriggerId:g,triggerIdProp:d,modal:l,disablePointerDismissal:i,nested:b});Zs(()=>{n===void 0&&p.state.open===!1&&r===!0&&p.update({open:!0,activeTriggerId:g})}),p.useControlledProp("openProp",n),p.useControlledProp("triggerIdProp",d),p.useSyncedValues({disablePointerDismissal:i,nested:b,modal:l}),p.useContextCallback("onOpenChange",s),p.useContextCallback("onOpenChangeComplete",o);const y=p.useState("payload");Mi({store:p,actionsRef:h,parentContext:w==null?void 0:w.store.context,isDrawer:m});const E=c.useMemo(()=>({store:p}),[p]);return f.jsx(In.Provider,{value:!1,children:f.jsx(Mr.Provider,{value:E,children:typeof t=="function"?t({payload:y}):t})})}const Ni=c.forwardRef(function(t,n){const{render:r,className:s,style:o,id:i,...l}=t,{store:h}=Ge(),a=ms(i);return h.useSyncedValueWithCleanup("titleElementId",a),nt("h2",t,{ref:n,props:[{id:a},l]})});function ji({...e}){return f.jsx(Ai,{"data-slot":"dialog",...e})}function Fi({...e}){return f.jsx(xi,{"data-slot":"dialog-portal",...e})}function Hi({className:e,...t}){return f.jsx(ai,{"data-slot":"dialog-overlay",className:de("fixed inset-0 isolate z-50 bg-black/80 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 Li({className:e,children:t,showCloseButton:n=!0,...r}){return f.jsxs(Fi,{children:[f.jsx(Hi,{}),f.jsxs(bi,{"data-slot":"dialog-content",className:de("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-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&f.jsxs(ci,{"data-slot":"dialog-close",render:f.jsx(Ae,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[f.jsx(rs,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Vi({className:e,...t}){return f.jsx("div",{"data-slot":"dialog-header",className:de("flex flex-col gap-1",e),...t})}function Ki({className:e,...t}){return f.jsx(Ni,{"data-slot":"dialog-title",className:de("font-heading text-sm font-medium",e),...t})}function Ui({className:e,...t}){return f.jsx("div",{"data-slot":"empty",className:de("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",e),...t})}function Mn({className:e,...t}){return f.jsx("div",{"data-slot":"empty-title",className:de("font-heading text-sm font-medium tracking-tight",e),...t})}function Wi({className:e,...t}){return f.jsx("div",{"data-slot":"empty-description",className:de("text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Bi({className:e,...t}){return f.jsx("kbd",{"data-slot":"kbd",className:de("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-xs bg-muted px-1 font-sans text-[0.625rem] font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",e),...t})}function _i(e){const t=ss.useSearch(),n=Hn(),[r,s]=c.useState(t.search),o=c.useRef(null),i=c.useRef(null),[l,h]=c.useState(new Set),[a,d]=c.useState(-1),[g,w]=c.useState(null),[m,b]=c.useState(!1),p=c.useRef([]),{data:y=[],isLoading:E}=sn(u=>u.from({m:Et}).orderBy(({m:I})=>I.createdAt,"desc"),[]),{data:S=[]}=sn(u=>u.from({p:os}),[]),D=c.useMemo(()=>{let u=y;if(t.type&&(u=u.filter(I=>I.type===t.type)),t.pinned&&(u=u.filter(I=>I.pinned)),t.needsReview&&(u=u.filter(I=>I.needsReview)),t.search){const I=t.search.toLowerCase();u=u.filter(W=>W.content.toLowerCase().includes(I))}return u},[y,t]),P=c.useMemo(()=>{const{projectId:u}=t;if(u==="global")return[{label:"Global",projectId:null,memories:D.filter($=>$.projects.length===0)}];if(u!==void 0){const $=S.find(ae=>ae.id===u),fe=D.filter(ae=>ae.projects.some(Ee=>Ee.id===u));return[{label:($==null?void 0:$.name)??u,projectId:u,memories:fe}]}const I=[],W=D.filter($=>$.projects.length===0);W.length>0&&I.push({label:"Global",projectId:null,memories:W});for(const $ of[...S].sort((fe,ae)=>fe.name.localeCompare(ae.name))){const fe=D.filter(ae=>ae.projects.some(Ee=>Ee.id===$.id));fe.length>0&&I.push({label:$.name,projectId:$.id,memories:fe})}return I},[D,S,t]),k=c.useMemo(()=>P.flatMap(u=>l.has(u.label)?[]:u.memories),[P,l]),L=c.useMemo(()=>{const u=new Set;let I=0;for(const W of P)for(const $ of W.memories)u.has($.id)||(u.add($.id),I++);return I},[P]);c.useEffect(()=>{k.length===0?d(-1):a>=k.length&&d(k.length-1)},[k.length,a]),c.useEffect(()=>{var u;a>=0&&((u=p.current[a])==null||u.scrollIntoView({block:"nearest"}))},[a]);const x=u=>{s(u),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{n({to:"/memories",search:I=>({...I,search:u})})},300)},C=(u,I)=>{Et.update(u,W=>{W.pinned=!I})},j=u=>{Et.delete(u),e===u&&n({to:"/memories"})},_=u=>{const I=k.findIndex(W=>W.id===u);I>=0&&d(I),n(e===u?{to:"/memories"}:{to:"/memories/$id",params:{id:u}})},K=u=>{h(I=>{const W=new Set(I);return W.has(u)?W.delete(u):W.add(u),W})},V=()=>{const u=k[a];u&&(g===u.id?(j(u.id),w(null)):w(u.id))};return $s([{hotkey:"/",callback:()=>{var u,I;(u=i.current)==null||u.focus(),(I=i.current)==null||I.select()},options:{preventDefault:!0}},{hotkey:"ArrowUp",callback:()=>{d(u=>u<=0?k.length-1:u-1)},options:{preventDefault:!0,enabled:k.length>0}},{hotkey:"ArrowDown",callback:()=>{d(u=>u<0||u>=k.length-1?0:u+1)},options:{preventDefault:!0,enabled:k.length>0}},{hotkey:"Enter",callback:()=>{const u=k[a];u&&_(u.id)},options:{enabled:a>=0}},{hotkey:"P",callback:()=>{const u=k[a];u&&C(u.id,u.pinned)},options:{enabled:a>=0}},{hotkey:"D",callback:V,options:{enabled:a>=0}},{hotkey:"Delete",callback:V,options:{enabled:a>=0}},{hotkey:"Escape",callback:()=>{if(g){w(null);return}if(m){b(!1);return}e&&n({to:"/memories"})}},{hotkey:{key:"?",shift:!0},callback:()=>b(u=>!u)}]),{search:t,searchInput:r,inputRef:i,allMemories:y,allProjects:S,isLoading:E,groups:P,totalCount:L,collapsedGroups:l,flatMemories:k,focusedIndex:a,confirmingId:g,setConfirmingId:w,showShortcuts:m,setShowShortcuts:b,rowRefs:p,handleSearchChange:x,handlePin:C,handleDelete:j,handleSelect:_,toggleGroup:K}}const $i=[["↑ / ↓","Navigate list"],["Enter","Open memory"],["P","Pin / unpin"],["D / Del","Delete (confirm twice)"],["Escape","Close / cancel"],["/","Focus search"],["?","Toggle this help"]];function Yi({selectedId:e}){const t=Hn(),{search:n,searchInput:r,inputRef:s,allMemories:o,allProjects:i,isLoading:l,groups:h,totalCount:a,collapsedGroups:d,focusedIndex:g,confirmingId:w,setConfirmingId:m,showShortcuts:b,setShowShortcuts:p,rowRefs:y,handleSearchChange:E,handlePin:S,handleDelete:D,handleSelect:P,toggleGroup:k}=_i(e);let L=0;return f.jsxs("div",{className:"relative flex flex-col h-full",children:[f.jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:[a," ",a===1?"memory":"memories",n.search?` matching "${n.search}"`:""]}),f.jsxs("div",{className:"flex flex-col gap-1.5 px-4 pt-3 pb-2 border-b border-border shrink-0",children:[f.jsxs("div",{className:"relative",children:[f.jsx(cs,{weight:"regular",className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground pointer-events-none"}),f.jsx(bs,{ref:s,placeholder:"Search…",value:r,onChange:x=>E(x.target.value),className:"pl-7",title:"Press / to focus"})]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsxs(cn,{value:n.type??"",onChange:x=>void t({to:"/memories",search:C=>({...C,type:x.target.value?x.target.value:void 0})}),size:"sm",className:"w-24",children:[f.jsx(ze,{value:"",children:"All types"}),is.map(x=>f.jsx(ze,{value:x,title:Nn[x],children:jn(x)},x))]}),f.jsxs(cn,{value:n.projectId??"",onChange:x=>void t({to:"/memories",search:C=>({...C,projectId:x.target.value||void 0})}),size:"sm",className:"w-28",children:[f.jsx(ze,{value:"",children:"All projects"}),f.jsx(ze,{value:"global",children:"Global"}),[...i].sort((x,C)=>x.name.localeCompare(C.name)).map(x=>f.jsx(ze,{value:x.id,children:x.name},x.id))]}),f.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[f.jsx(Ae,{variant:n.pinned?"default":"ghost",size:"icon-sm",onClick:()=>void t({to:"/memories",search:x=>({...x,pinned:!x.pinned})}),"aria-label":"Pinned only","aria-pressed":n.pinned,children:f.jsx(Pr,{weight:n.pinned?"fill":"regular"})}),f.jsx(Ae,{variant:n.needsReview?"destructive":"ghost",size:"icon-sm",onClick:()=>void t({to:"/memories",search:x=>({...x,needsReview:!x.needsReview})}),"aria-label":"Needs review only","aria-pressed":n.needsReview,title:"Show memories flagged for review — possible duplicates or conflicts",children:f.jsx(Fn,{weight:n.needsReview?"fill":"regular"})}),f.jsx(Ae,{variant:"ghost",size:"icon-sm",onClick:()=>p(x=>!x),"aria-label":"Keyboard shortcuts","aria-pressed":b,title:"Press ? for shortcuts",children:f.jsx("span",{className:"text-[11px] font-mono font-bold",children:"?"})})]})]})]}),f.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l&&o.length===0&&f.jsx("div",{className:"flex items-center justify-center h-24 text-xs text-muted-foreground",children:"Loading…"}),!l&&h.length===0&&f.jsx(Ui,{className:"border-0 rounded-none p-0 h-32",children:o.length===0?f.jsxs(f.Fragment,{children:[f.jsx(Mn,{className:"text-xs font-normal",children:"No memories yet"}),f.jsxs(Wi,{className:"max-w-48",children:["Memories are saved automatically by AI coding tools. Run"," ",f.jsx("code",{className:"font-mono",children:"membank setup"})," to connect your tools."]})]}):f.jsxs(f.Fragment,{children:[f.jsx(Mn,{className:"text-xs font-normal",children:n.search?`No memories match "${n.search}"`:"No memories match the current filters"}),f.jsx(Ae,{variant:"link",size:"sm",onClick:()=>void t({to:"/memories",search:{}}),children:"Clear filters"})]})}),h.map(x=>{const C=d.has(x.label);return f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>k(x.label),className:de("sticky top-0 z-10 w-full flex items-center justify-between px-4 py-1.5","bg-background/95 backdrop-blur border-b border-border","text-[11px] uppercase tracking-wide text-muted-foreground hover:text-foreground transition-colors"),children:[f.jsx("span",{children:x.label}),f.jsx("span",{children:x.memories.length})]}),!C&&f.jsx("ul",{className:"m-0 p-0",children:x.memories.map(j=>{const _=L++;return f.jsx(oi,{ref:K=>{y.current[_]=K},memory:j,selected:e===j.id,focused:g===_,confirming:w===j.id,onSelect:()=>P(j.id),onPin:()=>S(j.id,j.pinned),onDelete:()=>{D(j.id),m(null)},onDeleteStart:()=>m(j.id),onDeleteCancel:()=>m(null)},`${x.label}-${j.id}`)})})]},x.label)})]}),a>0&&f.jsxs("div",{className:de("px-4 py-2 border-t border-border shrink-0","text-[11px] text-muted-foreground"),children:[a," ",a===1?"memory":"memories"]}),f.jsx(ji,{open:b,onOpenChange:p,children:f.jsxs(Li,{className:"min-w-56 sm:max-w-sm",children:[f.jsx(Vi,{children:f.jsx(Ki,{children:"Keyboard shortcuts"})}),f.jsx("dl",{className:"space-y-2",children:$i.map(([x,C])=>f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("dt",{className:"shrink-0 min-w-20 text-right",children:f.jsx(Bi,{children:x})}),f.jsx("dd",{className:"text-xs text-foreground",children:C})]},x))})]})})]})}function Ji(){const e=Ys({select:t=>{const n=t.location.pathname;return n.startsWith("/memories/")?n.slice(10):null}});return f.jsxs("div",{className:"flex flex-1 min-h-0 w-full",children:[f.jsx("div",{className:"w-[380px] shrink-0 border-r border-border overflow-hidden flex flex-col",children:f.jsx(Yi,{selectedId:e})}),f.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:f.jsx(as,{})})]})}export{Ji as component};
1
+ var $r=Object.defineProperty;var tn=e=>{throw TypeError(e)};var Yr=(e,t,n)=>t in e?$r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ge=(e,t,n)=>Yr(e,typeof t!="symbol"?t+"":t,n),xt=(e,t,n)=>t.has(e)||tn("Cannot "+n);var Q=(e,t,n)=>(xt(e,t,"read from private field"),n?n.call(e):t.get(e)),Be=(e,t,n)=>t.has(e)?tn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),it=(e,t,n,r)=>(xt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ue=(e,t,n)=>(xt(e,t,"access private method"),n);import{u as Zr,r as c,a as Gr,b as qr,c as zr,d as Wt,e as ne,j as f,i as Se,g as Bt,f as Te,h as _t,N as $t,k as On,E as Qe,l as se,m as Xr,n as nt,o as nn,p as ft,q as bt,T as pt,s as Jr,t as Je,v as St,w as Qr,x as Yt,y as es,z as Dn,A as ts,B as An,C as Ae,D as rn,F as Nn,G as jn,H as de,I as Fn,J as ns,K as Zt,L as rs,R as ss,M as Hn,O as sn,P as Et,Q as os,S as is,U as as}from"./index-O2KJf81b.js";import{f as cs}from"./MagnifyingGlass.es-B8P_LfEH.js";import{c as G,o as ee,a as He,b as Z,d as Ne,f as Ln,u as Gt,e as ls,r as De,t as us,g as Vn,h as Fe,i as ds,j as on,k as fs,l as Kn,T as an,m as Un,n as ps,A as hs,p as gs,q as ms,I as bs,N as cn,s as ze}from"./native-select-DqP_P0PQ.js";function ys(e){return e!==null&&typeof e=="object"&&"current"in e}function Ie(){var n,r;if(typeof navigator>"u")return"linux";const e=((n=navigator.platform)==null?void 0:n.toLowerCase())??"",t=((r=navigator.userAgent)==null?void 0:r.toLowerCase())??"";return e.includes("mac")||t.includes("mac")?"mac":e.includes("win")||t.includes("win")?"windows":"linux"}const rt=["Control","Alt","Shift","Meta"];new Set(rt);const ln={Control:"Control",Ctrl:"Control",control:"Control",ctrl:"Control",Shift:"Shift",shift:"Shift",Alt:"Alt",Option:"Alt",alt:"Alt",option:"Alt",Command:"Meta",Cmd:"Meta",Meta:"Meta",command:"Meta",cmd:"Meta",meta:"Meta",OS:"Meta",os:"Meta",Win:"Meta",win:"Meta",CommandOrControl:"Mod",Mod:"Mod",commandorcontrol:"Mod",mod:"Mod"};function Wn(e,t=Ie()){return e==="Mod"?t==="mac"?"Meta":"Control":e}const xs=new Set(["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),Ss=new Set(["0","1","2","3","4","5","6","7","8","9"]),Es=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),ws=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),vs=new Set(["Enter","Escape","Space","Tab","Backspace","Delete"]),Rs=new Set(["/","[","]","\\","=","-",",",".",";","`"]),un={Backquote:"`",Backslash:"\\",BracketLeft:"[",BracketRight:"]",Comma:",",Equal:"=",Minus:"-",Period:".",Semicolon:";",Slash:"/"};[...xs,...Ss,...Es,...ws,...vs,...Rs];const dn={Esc:"Escape",esc:"Escape",escape:"Escape",Return:"Enter",return:"Enter",enter:"Enter"," ":"Space",space:"Space",Spacebar:"Space",spacebar:"Space",tab:"Tab",backspace:"Backspace",Del:"Delete",del:"Delete",delete:"Delete",Up:"ArrowUp",up:"ArrowUp",arrowup:"ArrowUp",Down:"ArrowDown",down:"ArrowDown",arrowdown:"ArrowDown",Left:"ArrowLeft",left:"ArrowLeft",arrowleft:"ArrowLeft",Right:"ArrowRight",right:"ArrowRight",arrowright:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown",PgUp:"PageUp",PgDn:"PageDown",pgup:"PageUp",pgdn:"PageDown"};function Bn(e){return new RegExp("^\\p{Letter}$","u").test(e)}function _e(e){if(!e)return"";if(e in dn)return dn[e];if(Bn(e)){const n=e.toUpperCase();return n.length===1?n:e}const t=e.toUpperCase();return/^F([1-9]|1[0-2])$/.test(t)?t:e}function qt(e,t=Ie()){const n=e.split("+"),r=new Set;let s="";for(let o=0;o<n.length;o++){const i=n[o].trim();if(o===n.length-1)s=_e(i);else{const l=ln[i]??ln[i.toLowerCase()];if(l){const h=Wn(l,t);r.add(h)}else n.length===1&&(s=_e(i))}}return!s&&n.length>0&&(s=_e(n[n.length-1].trim())),{key:s,ctrl:r.has("Control"),shift:r.has("Shift"),alt:r.has("Alt"),meta:r.has("Meta"),modifiers:rt.filter(o=>r.has(o))}}function _n(e,t=Ie()){let n=e.ctrl??!1;const r=e.shift??!1,s=e.alt??!1;let o=e.meta??!1;e.mod&&(Wn("Mod",t)==="Control"?n=!0:o=!0);const i=rt.filter(l=>{switch(l){case"Control":return n;case"Shift":return r;case"Alt":return s;case"Meta":return o;default:return!1}});return{key:e.key,ctrl:n,shift:r,alt:s,meta:o,modifiers:i}}function $n(e,t){const n=t==="mac"?e.meta&&!e.ctrl:e.ctrl&&!e.meta,r=[];if(n)r.push("Mod"),e.alt&&r.push("Alt"),e.shift&&r.push("Shift");else for(const s of rt)e.modifiers.includes(s)&&r.push(s);return r.push(_e(e.key)),r.join("+")}function Cs(e,t=Ie()){return $n(qt(e,t),t)}function Ts(e,t=Ie()){return $n(e,t)}function ks(e,t=Ie()){return typeof e=="string"?Cs(e,t):Ts(_n(e,t),t)}function Ps(e){const t=[];for(const n of rt)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join("+")}function fn(e,t,n=Ie()){const r=typeof t=="string"?qt(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;const s=_e(e.key),o=r.key;if(s!=="Dead"&&s.length===1&&o.length===1){if(s.toUpperCase()===o.toUpperCase())return!0;if(Bn(s)&&(/^[A-Za-z]$/.test(s)||!e.altKey))return!1}if(e.code&&(s==="Dead"||s.length===1&&o.length===1)){if(e.code.startsWith("Key")){const i=e.code.slice(3);if(i.length===1&&/^[A-Za-z]$/.test(i))return i.toUpperCase()===o.toUpperCase()}if(e.code.startsWith("Digit")){const i=e.code.slice(5);if(i.length===1&&/^[0-9]$/.test(i))return i===o}return e.code in un?un[e.code]===o:!1}return s===o}const Is={preventDefault:!0,stopPropagation:!0,eventType:"keydown",enabled:!0,ignoreInputs:!0,conflictBehavior:"warn"};function Ms(e){return!(e.ctrl||e.meta||e.key==="Escape")}function wt(e){if(!e)return!1;if(e instanceof HTMLInputElement){const t=e.type.toLowerCase();return!(t==="button"||t==="submit"||t==="reset")}return!!(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable)}function Os(e){return typeof document>"u"?null:typeof Document<"u"&&e instanceof Document||typeof Node<"u"&&e.nodeType===Node.DOCUMENT_NODE?e.activeElement:typeof HTMLElement<"u"&&e instanceof HTMLElement?e.ownerDocument.activeElement??null:e.document.activeElement??null}function Ds(e,t,n){const r=Os(t);return r&&wt(r)&&r!==n||e.composedPath().some(s=>wt(s)&&s!==n)?!0:wt(e.target)&&e.target!==n}function As(e,t){return t===document||t===window?e.currentTarget===t||e.currentTarget===document.documentElement:t===window?e.currentTarget===window||e.currentTarget===document||e.currentTarget===document.documentElement:!!(t instanceof HTMLElement&&(e.currentTarget===t||e.target instanceof Node&&t.contains(e.target)))}function Ns(e,t,n,r){if(n!=="allow"){if(n==="warn"){console.warn(`'${t}' is already registered. Multiple handlers will be triggered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to suppress this warning.`);return}if(n==="error")throw new Error(`'${t}' is already registered. Use conflictBehavior: 'replace' to replace the existing handler, or conflictBehavior: 'allow' to allow multiple registrations.`);r(e)}}let R=(function(e){return e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e})({});function js({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:o,checkDirty:i,shallowPropagate:l};function r(a,d,g){const w=d.depsTail;if(w!==void 0&&w.dep===a)return;const m=w!==void 0?w.nextDep:d.deps;if(m!==void 0&&m.dep===a){m.version=g,d.depsTail=m;return}const b=a.subsTail;if(b!==void 0&&b.version===g&&b.sub===d)return;const p=d.depsTail=a.subsTail={version:g,dep:a,sub:d,prevDep:w,nextDep:m,prevSub:b,nextSub:void 0};m!==void 0&&(m.prevDep=p),w!==void 0?w.nextDep=p:d.deps=p,b!==void 0?b.nextSub=p:a.subs=p}function s(a,d=a.sub){const g=a.dep,w=a.prevDep,m=a.nextDep,b=a.nextSub,p=a.prevSub;return m!==void 0?m.prevDep=w:d.depsTail=w,w!==void 0?w.nextDep=m:d.deps=m,b!==void 0?b.prevSub=p:g.subsTail=p,p!==void 0?p.nextSub=b:(g.subs=b)===void 0&&n(g),m}function o(a){let d=a.nextSub,g;e:do{const w=a.sub;let m=w.flags;if(m&(R.RecursedCheck|R.Recursed|R.Dirty|R.Pending)?m&(R.RecursedCheck|R.Recursed)?m&R.RecursedCheck?!(m&(R.Dirty|R.Pending))&&h(a,w)?(w.flags=m|(R.Recursed|R.Pending),m&=R.Mutable):m=R.None:w.flags=m&~R.Recursed|R.Pending:m=R.None:w.flags=m|R.Pending,m&R.Watching&&t(w),m&R.Mutable){const b=w.subs;if(b!==void 0){const p=(a=b).nextSub;p!==void 0&&(g={value:d,prev:g},d=p);continue}}if((a=d)!==void 0){d=a.nextSub;continue}for(;g!==void 0;)if(a=g.value,g=g.prev,a!==void 0){d=a.nextSub;continue e}break}while(!0)}function i(a,d){let g,w=0,m=!1;e:do{const b=a.dep,p=b.flags;if(d.flags&R.Dirty)m=!0;else if((p&(R.Mutable|R.Dirty))===(R.Mutable|R.Dirty)){if(e(b)){const y=b.subs;y.nextSub!==void 0&&l(y),m=!0}}else if((p&(R.Mutable|R.Pending))===(R.Mutable|R.Pending)){(a.nextSub!==void 0||a.prevSub!==void 0)&&(g={value:a,prev:g}),a=b.deps,d=b,++w;continue}if(!m){const y=a.nextDep;if(y!==void 0){a=y;continue}}for(;w--;){const y=d.subs,E=y.nextSub!==void 0;if(E?(a=g.value,g=g.prev):a=y,m){if(e(d)){E&&l(y),d=a.sub;continue}m=!1}else d.flags&=~R.Pending;d=a.sub;const S=a.nextDep;if(S!==void 0){a=S;continue e}}return m}while(!0)}function l(a){do{const d=a.sub,g=d.flags;(g&(R.Pending|R.Dirty))===R.Pending&&(d.flags=g|R.Dirty,(g&(R.Watching|R.RecursedCheck))===R.Watching&&t(d))}while((a=a.nextSub)!==void 0)}function h(a,d){let g=d.depsTail;for(;g!==void 0;){if(g===a)return!0;g=g.prevDep}return!1}}function Yn(e,t,n){var o,i,l;const r=typeof e=="object",s=r?e:void 0;return{next:(o=r?e.next:e)==null?void 0:o.bind(s),error:(i=r?e.error:t)==null?void 0:i.bind(s),complete:(l=r?e.complete:n)==null?void 0:l.bind(s)}}const Ot=[];let dt=0;const{link:pn,unlink:Fs,propagate:Hs,checkDirty:Zn,shallowPropagate:hn}=js({update(e){return e._update()},notify(e){Ot[Dt++]=e,e.flags&=~R.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=R.Mutable|R.Dirty,ht(e))}});let at=0,Dt=0,Re;function ht(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Fs(n,e)}function Ls(){for(;at<Dt;){const e=Ot[at];Ot[at++]=void 0,e.notify()}at=0,Dt=0}function Vs(e,t){const n=typeof e=="function",r=e,s={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?R.None:R.Mutable,get(){return Re!==void 0&&pn(s,Re,dt),s._snapshot},subscribe(o){const i=Yn(o),l={current:!1},h=Ks(()=>{var a;s.get(),l.current?(a=i.next)==null||a.call(i,s._snapshot):l.current=!0});return{unsubscribe:()=>{h.stop()}}},_update(o){const i=Re,l=Object.is;if(n)Re=s,++dt,s.depsTail=void 0;else if(o===void 0)return!1;n&&(s.flags=R.Mutable|R.RecursedCheck);try{const h=s._snapshot,a=typeof o=="function"?o(h):o===void 0&&n?r(h):o;return h===void 0||!l(h,a)?(s._snapshot=a,!0):!1}finally{Re=i,n&&(s.flags&=~R.RecursedCheck),ht(s)}}};return n?(s.flags=R.Mutable|R.Dirty,s.get=function(){const o=s.flags;if(o&R.Dirty||o&R.Pending&&Zn(s.deps,s)){if(s._update()){const i=s.subs;i!==void 0&&hn(i)}}else o&R.Pending&&(s.flags=o&~R.Pending);return Re!==void 0&&pn(s,Re,dt),s._snapshot}):s.set=function(o){if(s._update(o)){const i=s.subs;i!==void 0&&(Hs(i),hn(i),Ls())}},s}function Ks(e){const t=()=>{const r=Re;Re=n,++dt,n.depsTail=void 0,n.flags=R.Watching|R.RecursedCheck;try{return e()}finally{Re=r,n.flags&=~R.RecursedCheck,ht(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:R.Watching|R.RecursedCheck,notify(){const r=this.flags;r&R.Dirty||r&R.Pending&&Zn(this.deps,this)?t():this.flags=R.Watching},stop(){this.flags=R.None,this.depsTail=void 0,ht(this)}};return t(),n}var Us=class{constructor(t,n){this.atom=Vs(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),n&&(this.actions=n(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Yn(t))}};let Ws=0;function gn(){return`hotkey_${++Ws}`}var me,ke,tt,Pe,Ce,q,At,Gn,Nt,jt,Ft,qn,zn,Xn,Jn,Bs=(me=class{constructor(){Be(this,q);Be(this,tt);Be(this,Pe,new Map);Be(this,Ce,new Map);this.registrations=new Us(new Map),it(this,tt,Ie())}static getInstance(){return Q(me,ke)||it(me,ke,new me),Q(me,ke)}static resetInstance(){Q(me,ke)&&(Q(me,ke).destroy(),it(me,ke,null))}register(t,n,r={}){if(typeof document>"u"&&!r.target){let b=n;return{id:gn(),unregister:()=>{},get callback(){return b},set callback(p){b=p},setOptions:()=>{},get isActive(){return!1}}}const s=gn(),o=r.platform??Q(this,tt),i=typeof t=="string"?qt(t,o):_n(t,o),l=typeof t=="string"?t:Ps(i),h=r.target??document,a=r.conflictBehavior??"warn",d=ue(this,q,Xn).call(this,l,h);d&&Ns(d.id,l,a,b=>ue(this,q,At).call(this,b));const g=r.ignoreInputs??Ms(i),w={id:s,hotkey:l,parsedHotkey:i,callback:n,options:{...Is,requireReset:!1,...r,platform:o,ignoreInputs:g},hasFired:!1,triggerCount:0,target:h};this.registrations.setState(b=>new Map(b).set(s,w)),Q(this,Ce).has(h)||Q(this,Ce).set(h,new Set),Q(this,Ce).get(h).add(s),ue(this,q,Gn).call(this,h);const m=this;return{get id(){return s},unregister:()=>{var b;ue(b=m,q,At).call(b,s)},get callback(){var b;return((b=m.registrations.state.get(s))==null?void 0:b.callback)??n},set callback(b){const p=m.registrations.state.get(s);p&&(p.callback=b)},setOptions:b=>{m.registrations.setState(p=>{const y=p.get(s);if(y){const E=new Map(p);return E.set(s,{...y,options:{...y.options,...b}}),E}return p})},get isActive(){return m.registrations.state.has(s)}}}triggerRegistration(t){const n=this.registrations.state.get(t);if(!n)return!1;const r=n.parsedHotkey,s=new KeyboardEvent(n.options.eventType??"keydown",{key:r.key,ctrlKey:r.ctrl,shiftKey:r.shift,altKey:r.alt,metaKey:r.meta,bubbles:!0,cancelable:!0});return n.triggerCount++,this.registrations.setState(o=>new Map(o)),n.callback(s,{hotkey:n.hotkey,parsedHotkey:n.parsedHotkey}),!0}getRegistrationCount(){return this.registrations.state.size}isRegistered(t,n){for(const r of this.registrations.state.values())if(r.hotkey===t&&(n===void 0||r.target===n))return!0;return!1}destroy(){for(const t of Q(this,Pe).keys())ue(this,q,Nt).call(this,t);this.registrations.setState(()=>new Map),Q(this,Pe).clear(),Q(this,Ce).clear()}},ke=new WeakMap,tt=new WeakMap,Pe=new WeakMap,Ce=new WeakMap,q=new WeakSet,At=function(t){const n=this.registrations.state.get(t);if(!n)return;const r=n.target;this.registrations.setState(o=>{const i=new Map(o);return i.delete(t),i});const s=Q(this,Ce).get(r);s&&(s.delete(t),s.size===0&&ue(this,q,Nt).call(this,r))},Gn=function(t){if(typeof document>"u"||Q(this,Pe).has(t))return;const n=ue(this,q,qn).call(this,t),r=ue(this,q,zn).call(this,t);t.addEventListener("keydown",n),t.addEventListener("keyup",r),Q(this,Pe).set(t,{keydown:n,keyup:r})},Nt=function(t){if(typeof document>"u")return;const n=Q(this,Pe).get(t);n&&(t.removeEventListener("keydown",n.keydown),t.removeEventListener("keyup",n.keyup),Q(this,Pe).delete(t),Q(this,Ce).delete(t))},jt=function(t,n,r){const s=Q(this,Ce).get(n);if(s)for(const o of s){const i=this.registrations.state.get(o);if(i&&As(t,n)&&i.options.enabled&&!(i.options.ignoreInputs!==!1&&Ds(t,n,i.target)))if(r==="keydown"){if(i.options.eventType!=="keydown")continue;fn(t,i.parsedHotkey,i.options.platform)&&(i.options.preventDefault&&t.preventDefault(),i.options.stopPropagation&&t.stopPropagation(),(!i.options.requireReset||!i.hasFired)&&(ue(this,q,Ft).call(this,i,t),i.options.requireReset&&(i.hasFired=!0)))}else i.options.eventType==="keyup"&&fn(t,i.parsedHotkey,i.options.platform)&&ue(this,q,Ft).call(this,i,t),i.options.requireReset&&i.hasFired&&ue(this,q,Jn).call(this,i,t)&&(i.hasFired=!1)}},Ft=function(t,n){t.options.preventDefault&&n.preventDefault(),t.options.stopPropagation&&n.stopPropagation(),t.triggerCount++,this.registrations.setState(s=>new Map(s));const r={hotkey:t.hotkey,parsedHotkey:t.parsedHotkey};t.callback(n,r)},qn=function(t){return n=>{ue(this,q,jt).call(this,n,t,"keydown")}},zn=function(t){return n=>{ue(this,q,jt).call(this,n,t,"keyup")}},Xn=function(t,n){for(const r of this.registrations.state.values())if(r.hotkey===t&&r.target===n)return r;return null},Jn=function(t,n){const r=t.parsedHotkey,s=_e(n.key),o=r.key.length===1?r.key.toUpperCase():r.key;return!!((s.length===1?s.toUpperCase():s)===o||r.ctrl&&s==="Control"||r.shift&&s==="Shift"||r.alt&&s==="Alt"||r.meta&&s==="Meta")},Be(me,ke,null),me);function _s(){return Bs.getInstance()}function $s(e,t={}){var w;const n=Zr().hotkey,r=_s(),s=t.platform??(n==null?void 0:n.platform)??Ie(),o=c.useRef(new Map),i=c.useRef(e),l=c.useRef([]),h=c.useRef(t),a=c.useRef(n),d=c.useRef(r),g=e.map(m=>ks(m.hotkey,s));i.current=e,l.current=g,h.current=t,a.current=n,d.current=r,c.useEffect(()=>{const m=o.current,b=new Map,p=[];for(let E=0;E<i.current.length;E++){const S=i.current[E],D=l.current[E],P={...a.current,...h.current,...S.options},k=ys(P.target)?P.target.current:P.target??(typeof document<"u"?document:null);if(!k)continue;const L=`${E}:${D}`;p.push({registrationKey:L,def:S,hotkeyStr:D,mergedOptions:P,resolvedTarget:k})}const y=new Set(p.map(E=>E.registrationKey));for(const[E,S]of m)!y.has(E)&&S.handle.isActive&&S.handle.unregister();for(const E of p){const{registrationKey:S,def:D,hotkeyStr:P,mergedOptions:k,resolvedTarget:L}=E,x=m.get(S);if(x!=null&&x.handle.isActive&&x.target===L){b.set(S,x);continue}x!=null&&x.handle.isActive&&x.handle.unregister();const C=d.current.register(P,D.callback,{...k,target:L});b.set(S,{handle:C,target:L})}o.current=b}),c.useEffect(()=>()=>{for(const{handle:m}of o.current.values())m.isActive&&m.unregister();o.current=new Map},[]);for(let m=0;m<e.length;m++){const b=e[m],p=g[m],y=`${m}:${p}`,E=(w=o.current.get(y))==null?void 0:w.handle;if(E!=null&&E.isActive){E.callback=b.callback;const{target:S,...D}={...n,...t,...b.options};E.setOptions(D)}}}function Ys(e){const t=Gr({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t,r=c.useRef(void 0);return qr(n.stores.__store,s=>{if(e!=null&&e.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const o=zr(r.current,e.select(s));return r.current=o,o}return e.select(s)}return s})}function Zs(e){const t=c.useRef(!0);t.current&&(t.current=!1,e())}const Ze=typeof navigator<"u",vt=zs(),Qn=Js(),er=Xs(),tr=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),nr=vt.platform==="MacIntel"&&vt.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(vt.platform),Gs=Ze&&/apple/i.test(navigator.vendor),Ht=Ze&&/android/i.test(Qn)||/android/i.test(er);Ze&&Qn.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const qs=er.includes("jsdom/");function zs(){if(!Ze)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e!=null&&e.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Xs(){if(!Ze)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function Js(){if(!Ze)return"";const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform??""}function Qs(e){e.preventDefault(),e.stopPropagation()}function eo(e){return"nativeEvent"in e}function to(e){return e.pointerType===""&&e.isTrusted?!0:Ht&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function no(e){return qs?!1:!Ht&&e.width===0&&e.height===0||Ht&&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 ro(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function $e(...e){return()=>{for(let t=0;t<e.length;t+=1){const n=e[t];n&&n()}}}function Rt(e){const t=Wt(so,e).current;return t.next=e,ne(t.effect),t}function so(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const oo={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},io={...oo,position:"fixed",top:0,left:0},gt=c.forwardRef(function(t,n){const[r,s]=c.useState();ne(()=>{Gs&&s("button")},[]);const o={tabIndex:0,role:r};return f.jsx("span",{...t,ref:n,style:io,"aria-hidden":r?void 0:!0,...o,"data-base-ui-focus-guard":""})}),Lt="data-base-ui-focusable",rr="active",sr="selected",ao="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function we(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function co(e){return e.matches("html,body")}function or(e){return Se(e)&&e.matches(ao)}function mn(e){return e?e.getAttribute("role")==="combobox"&&or(e):!1}function Vt(e){return e?e.hasAttribute(Lt)?e:e.querySelector(`[${Lt}]`)||e:null}function lo(e){return e.visibility==="hidden"||e.visibility==="collapse"}function ir(e,t=e?Bt(e):null){return!e||!e.isConnected||!t||lo(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const uo='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function fo(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.getRootNode();return _t(n)?n.host:null}function Kt(e){for(const t of Array.from(e.children))if(Te(t)==="summary")return t;return null}function po(e,t){const n=Kt(t);return!!n&&(e===n||G(n,e))}function ar(e){const t=e?Te(e):"";return e!=null&&e.matches(uo)&&(t!=="summary"||e.parentElement!=null&&Te(e.parentElement)==="details"&&Kt(e.parentElement)===e)&&(t!=="details"||Kt(e)==null)&&(t!=="input"||e.type!=="hidden")}function cr(e){if(!ar(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=fo(t)){const n=t!==e,r=Te(t)==="slot";if(t.hasAttribute("inert")||n&&Te(t)==="details"&&!t.open&&!po(e,t)||t.hasAttribute("hidden")||!r&&!ho(t,n))return!1}return!0}function ho(e,t){const n=Bt(e);return t?n.display!=="none":ir(e,n)}function lr(e){const t=e.tabIndex;if(t<0){const n=Te(e);if(n==="details"||n==="audio"||n==="video"||Se(e)&&e.isContentEditable)return 0}return t}function Ct(e){if(Te(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function go(e,t){const n=Ct(e);if(!n)return!0;const r=t.find(s=>{const o=Ct(s);return(o==null?void 0:o.name)===n.name&&o.form===n.form&&o.checked});return r?r===n:t.find(s=>{const o=Ct(s);return(o==null?void 0:o.name)===n.name&&o.form===n.form})===n}function ur(e){if(Se(e)&&Te(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Se(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function dr(e,t){ur(e).forEach(n=>{ar(n)&&t.push(n),dr(n,t)})}function fr(e,t,n){ur(e).forEach(r=>{Se(r)&&r.matches(t)&&n.push(r),fr(r,t,n)})}function zt(e){return cr(e)&&lr(e)>=0}function pr(e){const t=[];return dr(e,t),t.filter(cr)}function yt(e){const t=pr(e);return t.filter(n=>lr(n)>=0&&go(n,t))}function hr(e,t){const n=yt(e),r=n.length;if(r===0)return;const s=He(ee(e)),o=n.indexOf(s),i=o===-1?t===1?0:r-1:o+t;return n[i]}function gr(e){return hr(ee(e).body,1)||e}function mr(e){return hr(ee(e).body,-1)||e}function et(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!G(n,r)}function mo(e){yt(e).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function bn(e){const t=[];fr(e,"[data-tabindex]",t),t.forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function Ye(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>{var o;return[...!n||(o=s.context)!=null&&o.open?[s]:[],...Ye(e,s.id,n)]})}function yn(e,t){var s;let n=[],r=(s=e.find(o=>o.id===t))==null?void 0:s.parentId;for(;r;){const o=e.find(i=>i.id===r);r=o==null?void 0:o.parentId,o&&(n=n.concat(o))}return n}function mt(e){return`data-base-ui-${e}`}let ct=0;function Tt(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:s=!1}=t;r&&cancelAnimationFrame(ct);const o=()=>e==null?void 0:e.focus({preventScroll:n});if(s)return o(),$t;const i=requestAnimationFrame(o);return ct=i,()=>{ct===i&&(cancelAnimationFrame(i),ct=0)}}const kt={inert:new WeakMap,"aria-hidden":new WeakMap},xn="data-base-ui-inert",Ut={inert:new WeakSet,"aria-hidden":new WeakSet};let Xe=new WeakMap,Pt=0;function bo(e){return Ut[e]}function br(e){return e?_t(e)?e.host:br(e.parentNode):null}const It=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=br(n);return e.contains(r)?r:null}).filter(n=>n!=null),Sn=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},En=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{Te(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function yo(e,t,n,r,{mark:s=!0,markerIgnoreElements:o=[]}){const i=r?"inert":n?"aria-hidden":null;let l=null,h=null;const a=It(t,e),d=s?It(t,o):[],g=new Set(d),w=s?En(t,Sn(a),new Set(a)).filter(p=>!g.has(p)):[],m=[],b=[];if(i){const p=kt[i],y=bo(i);h=y,l=p;const E=It(t,Array.from(t.querySelectorAll("[aria-live]"))),S=a.concat(E);En(t,Sn(S),new Set(S)).forEach(P=>{const k=P.getAttribute(i),L=k!==null&&k!=="false",x=(p.get(P)||0)+1;p.set(P,x),m.push(P),x===1&&L&&y.add(P),L||P.setAttribute(i,i==="inert"?"":"true")})}return s&&w.forEach(p=>{const y=(Xe.get(p)||0)+1;Xe.set(p,y),b.push(p),y===1&&p.setAttribute(xn,"")}),Pt+=1,()=>{l&&m.forEach(p=>{const E=(l.get(p)||0)-1;l.set(p,E),E||(!(h!=null&&h.has(p))&&i&&p.removeAttribute(i),h==null||h.delete(p))}),s&&b.forEach(p=>{const y=(Xe.get(p)||0)-1;Xe.set(p,y),y||p.removeAttribute(xn)}),Pt-=1,Pt||(kt.inert=new WeakMap,kt["aria-hidden"]=new WeakMap,Ut.inert=new WeakSet,Ut["aria-hidden"]=new WeakSet,Xe=new WeakMap)}}function wn(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0,markerIgnoreElements:o=[]}=t,i=ee(e[0]).body;return yo(e,i,n,r,{mark:s,markerIgnoreElements:o})}const xo="data-base-ui-click-trigger",So={clipPath:"inset(50%)",position:"fixed",top:0,left:0},yr=c.createContext(null),xr=()=>c.useContext(yr),Eo=mt("portal");function wo(e={}){const{ref:t,container:n,componentProps:r=Qe,elementProps:s}=e,o=Gt(),i=xr(),l=i==null?void 0:i.portalNode,[h,a]=c.useState(null),[d,g]=c.useState(null),w=se(y=>{y!==null&&g(y)}),m=c.useRef(null);ne(()=>{if(n===null){m.current&&(m.current=null,g(null),a(null));return}if(o==null)return;const y=(n&&(Xr(n)?n:n.current))??l??document.body;if(y==null){m.current&&(m.current=null,g(null),a(null));return}m.current!==y&&(m.current=y,g(null),a(y))},[n,l,o]);const b=nt("div",r,{ref:[t,w],props:[{id:o,[Eo]:""},s]});return{portalNode:d,portalSubtree:h&&b?On.createPortal(b,h):null}}const vo=c.forwardRef(function(t,n){const{children:r,container:s,className:o,render:i,renderGuards:l,style:h,...a}=t,{portalNode:d,portalSubtree:g}=wo({container:s,ref:n,componentProps:t,elementProps:a}),w=c.useRef(null),m=c.useRef(null),b=c.useRef(null),p=c.useRef(null),[y,E]=c.useState(null),S=c.useRef(!1),D=y==null?void 0:y.modal,P=y==null?void 0:y.open,k=typeof l=="boolean"?l:!!y&&!y.modal&&y.open&&!!d;c.useEffect(()=>{if(!d||D)return;function x(C){d&&C.relatedTarget&&et(C)&&(C.type==="focusin"?S.current&&(bn(d),S.current=!1):(mo(d),S.current=!0))}return $e(Z(d,"focusin",x,!0),Z(d,"focusout",x,!0))},[d,D]),c.useEffect(()=>{!d||P!==!1||(bn(d),S.current=!1)},[P,d]);const L=c.useMemo(()=>({beforeOutsideRef:w,afterOutsideRef:m,beforeInsideRef:b,afterInsideRef:p,portalNode:d,setFocusManagerState:E}),[d]);return f.jsxs(c.Fragment,{children:[g,f.jsxs(yr.Provider,{value:L,children:[k&&d&&f.jsx(gt,{"data-type":"outside",ref:w,onFocus:x=>{var C;if(et(x,d))(C=b.current)==null||C.focus();else{const j=y?y.domReference:null,_=mr(j);_==null||_.focus()}}}),k&&d&&f.jsx("span",{"aria-owns":d.id,style:So}),d&&On.createPortal(r,d),k&&d&&f.jsx(gt,{"data-type":"outside",ref:m,onFocus:x=>{var C;if(et(x,d))(C=p.current)==null||C.focus();else{const j=y?y.domReference:null,_=gr(j);_==null||_.focus(),y!=null&&y.closeOnFocusOut&&(y==null||y.onOpenChange(!1,Ne(Ln,x.nativeEvent)))}}})]})]})});function Ro(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(s=>s(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const Co=c.createContext(null),To=c.createContext(null),Sr=()=>{var e;return((e=c.useContext(Co))==null?void 0:e.id)||null},Er=e=>{const t=c.useContext(To);return e??t};function ko(e,t){const n=bt(Fe(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"):""}const vn=20;let je=[];function Xt(){je=je.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function Po(e){Xt(),e&&Te(e)!=="body"&&(je.push(new WeakRef(e)),je.length>vn&&(je=je.slice(-vn)))}function Mt(){var e;return Xt(),(e=je[je.length-1])==null?void 0:e.deref()}function Io(e){return e?zt(e)?e:yt(e)[0]||e:null}function Rn(e,t){var o;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!((o=e.getAttribute("role"))!=null&&o.includes("dialog")))return;const r=pr(e).filter(i=>{const l=i.getAttribute("data-tabindex")||"";return zt(i)||i.hasAttribute("data-tabindex")&&!l.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Mo(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:o=!0,restoreFocus:i=!1,modal:l=!0,closeOnFocusOut:h=!0,openInteractionType:a="",nextFocusableElement:d,previousFocusableElement:g,beforeContentFocusGuardRef:w,externalTree:m,getInsideElements:b}=e,p="rootStore"in t?t.rootStore:t,y=p.useState("open"),E=p.useState("domReferenceElement"),S=p.useState("floatingElement"),{events:D,dataRef:P}=p.context,k=se(()=>{var O;return(O=P.current.floatingContext)==null?void 0:O.nodeId}),L=s===!1,x=mn(E)&&L,C=c.useRef(["content"]),j=Rt(s),_=Rt(o),K=Rt(a),V=Er(m),u=xr(),I=c.useRef(!1),W=c.useRef(!1),$=c.useRef(!1),fe=c.useRef(null),ae=c.useRef(""),Ee=c.useRef(""),Ve=c.useRef(null),B=c.useRef(null),ve=nn(Ve,w,u==null?void 0:u.beforeInsideRef),Ke=nn(B,u==null?void 0:u.afterInsideRef),Ue=ft(),Me=ft(),Oe=ls(),be=u!=null,A=Vt(S),ce=se((O=A)=>O?yt(O):[]),pe=se(()=>(b==null?void 0:b().filter(O=>O!=null))??[]);c.useEffect(()=>{if(r||!l)return;function O(U){U.key==="Tab"&&G(A,He(ee(A)))&&ce().length===0&&!x&&Qs(U)}const X=ee(A);return Z(X,"keydown",O)},[r,E,A,l,C,x,ce]),c.useEffect(()=>{if(r||!y)return;const O=ee(A);function X(){$.current=!1}function U(F){const N=Fe(F),J=pe(),M=G(S,N)||G(E,N)||G(u==null?void 0:u.portalNode,N)||J.some(ye=>ye===N||G(ye,N));$.current=!M,Ee.current=F.pointerType||"keyboard",N!=null&&N.closest(`[${xo}]`)&&(W.current=!0)}function te(){Ee.current="keyboard"}return $e(Z(O,"pointerdown",U,!0),Z(O,"pointerup",X,!0),Z(O,"pointercancel",X,!0),Z(O,"keydown",te,!0))},[r,S,E,A,y,u,pe]),c.useEffect(()=>{if(r||!h)return;const O=ee(A);function X(){W.current=!0,Me.start(0,()=>{W.current=!1})}function U(J){const M=Fe(J);zt(M)&&(fe.current=M)}function te(J){const M=J.relatedTarget,ye=J.currentTarget,Y=Fe(J);queueMicrotask(()=>{const xe=k(),v=p.context.triggerElements,T=pe(),oe=(M==null?void 0:M.hasAttribute(mt("focus-guard")))&&[Ve.current,B.current,u==null?void 0:u.beforeInsideRef.current,u==null?void 0:u.afterInsideRef.current,u==null?void 0:u.beforeOutsideRef.current,u==null?void 0:u.afterOutsideRef.current,De(g),De(d)].includes(M),re=!(G(E,M)||G(S,M)||G(M,S)||G(u==null?void 0:u.portalNode,M)||T.some(z=>z===M||G(z,M))||M!=null&&v.hasElement(M)||v.hasMatchingElement(z=>G(z,M))||oe||V&&(Ye(V.nodesRef.current,xe).find(z=>{var ie,le;return G((ie=z.context)==null?void 0:ie.elements.floating,M)||G((le=z.context)==null?void 0:le.elements.domReference,M)})||yn(V.nodesRef.current,xe).find(z=>{var ie,le,ot;return[(ie=z.context)==null?void 0:ie.elements.floating,Vt((le=z.context)==null?void 0:le.elements.floating)].includes(M)||((ot=z.context)==null?void 0:ot.elements.domReference)===M})));if(ye===E&&A&&Rn(A,C),i&&ye!==E&&!ir(Y)&&He(O)===O.body){if(Se(A)&&(A.focus(),i==="popup")){Oe.request(()=>{A.focus()});return}const z=ce(),ie=fe.current,le=(ie&&z.includes(ie)?ie:null)||z[z.length-1]||A;Se(le)&&le.focus()}if(P.current.insideReactTree){P.current.insideReactTree=!1;return}(x||!l)&&M&&re&&!W.current&&(x||M!==Mt())&&(I.current=!0,p.setOpen(!1,Ne(Ln,J)))})}function F(){$.current||(P.current.insideReactTree=!0,Ue.start(0,()=>{P.current.insideReactTree=!1}))}const N=Se(E)?E:null;if(!(!S&&!N))return $e(N&&Z(N,"focusout",te),N&&Z(N,"pointerdown",X),S&&Z(S,"focusin",U),S&&Z(S,"focusout",te),S&&u&&Z(S,"focusout",F,!0))},[r,E,S,A,l,V,u,p,h,i,ce,x,k,C,P,Ue,Me,Oe,d,g,pe]),c.useEffect(()=>{var ye,Y,xe;if(r||!S||!y)return;const O=Array.from(((ye=u==null?void 0:u.portalNode)==null?void 0:ye.querySelectorAll(`[${mt("portal")}]`))||[]),U=(xe=(Y=(V?yn(V.nodesRef.current,k()):[]).find(v=>{var T;return mn(((T=v.context)==null?void 0:T.elements.domReference)||null)}))==null?void 0:Y.context)==null?void 0:xe.elements.domReference,F=[...[S,...O,Ve.current,B.current,u==null?void 0:u.beforeOutsideRef.current,u==null?void 0:u.afterOutsideRef.current,...pe()],U,De(g),De(d),x?E:null].filter(v=>v!=null),N=wn(F,{ariaHidden:l||x,mark:!1}),J=[S,...O].filter(v=>v!=null),M=wn(J);return()=>{M(),N()}},[y,r,E,S,l,C,u,x,V,k,d,g,pe]),ne(()=>{if(!y||r||!Se(A))return;const O=ee(A),X=He(O);queueMicrotask(()=>{const U=j.current,te=typeof U=="function"?U(K.current||""):U;if(te===void 0||te===!1||G(A,X))return;let N=null;const J=()=>(N==null&&(N=ce(A)),N[0]||A);let M;te===!0||te===null?M=J():M=De(te),M=M||J(),Tt(M,{preventScroll:M===A})})},[r,y,A,L,ce,j,K]),ne(()=>{if(r||!A)return;const O=ee(A),X=He(O);Po(X);function U(F){if(F.open||(ae.current=ko(F.nativeEvent,Ee.current)),F.reason===us&&F.nativeEvent.type==="mouseleave"&&(I.current=!0),F.reason===Vn)if(F.nested)I.current=!1;else if(to(F.nativeEvent)||no(F.nativeEvent))I.current=!1;else{let N=!1;ee(A).createElement("div").focus({get preventScroll(){return N=!0,!1}}),N?I.current=!1:I.current=!0}}D.on("openchange",U);function te(){const F=_.current;let N=typeof F=="function"?F(ae.current):F;if(N===void 0||N===!1)return null;if(N===null&&(N=!0),typeof N=="boolean"){const M=E||Mt();return M&&M.isConnected?M:null}const J=E||Mt();return De(N)||J||null}return()=>{D.off("openchange",U);const F=He(O),N=pe(),J=G(S,F)||N.some(Y=>Y===F||G(Y,F))||V&&Ye(V.nodesRef.current,k(),!1).some(Y=>{var xe;return G((xe=Y.context)==null?void 0:xe.elements.floating,F)}),M=_.current,ye=te();queueMicrotask(()=>{const Y=Io(ye),xe=typeof M!="boolean";M&&!I.current&&Se(Y)&&(!(!xe&&Y!==F&&F!==O.body)||J)&&Y.focus({preventScroll:!0}),I.current=!1})}},[r,S,A,_,P,D,V,E,k,pe]),ne(()=>{if(!tr||y||!S)return;const O=He(ee(S));!Se(O)||!or(O)||G(S,O)&&O.blur()},[y,S]),ne(()=>{if(!(r||!u))return u.setFocusManagerState({modal:l,closeOnFocusOut:h,open:y,onOpenChange:p.setOpen,domReference:E}),()=>{u.setFocusManagerState(null)}},[r,u,l,y,p,h,E]),ne(()=>{if(!(r||!A))return Rn(A,C),()=>{queueMicrotask(Xt)}},[r,A,C]);const st=!r&&(l?!x:!0)&&(be||l);return f.jsxs(c.Fragment,{children:[st&&f.jsx(gt,{"data-type":"inside",ref:ve,onFocus:O=>{var X;if(l){const U=ce();Tt(U[U.length-1])}else if(u!=null&&u.portalNode)if(I.current=!1,et(O,u.portalNode)){const U=gr(E);U==null||U.focus()}else(X=De(g??u.beforeOutsideRef))==null||X.focus()}}),n,st&&f.jsx(gt,{"data-type":"inside",ref:Ke,onFocus:O=>{var X;if(l)Tt(ce()[0]);else if(u!=null&&u.portalNode)if(h&&(I.current=!0),et(O,u.portalNode)){const U=mr(E);U==null||U.focus()}else(X=De(d??u.afterOutsideRef))==null||X.focus()}})]})}const Oo={intentional:"onClick",sloppy:"onPointerDown"};function Do(){return!1}function Ao(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function No(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingElement"),{dataRef:o}=n.context,{enabled:i=!0,escapeKey:l=!0,outsidePress:h=!0,outsidePressEvent:a="sloppy",referencePress:d=Do,referencePressEvent:g="sloppy",bubbles:w,externalTree:m}=t,b=Er(m),p=se(typeof h=="function"?h:()=>!1),y=typeof h=="function"?p:h,E=y!==!1,S=se(()=>a),D=c.useRef(!1),P=c.useRef(!1),k=c.useRef(!1),{escapeKey:L,outsidePress:x}=Ao(w),C=c.useRef(null),j=ft(),_=ft(),K=se(()=>{_.clear(),o.current.insideReactTree=!1}),V=c.useRef(!1),u=c.useRef(""),I=se(d),W=se(B=>{var Oe;if(!r||!i||!l||B.key!=="Escape"||V.current)return;const ve=(Oe=o.current.floatingContext)==null?void 0:Oe.nodeId,Ke=b?Ye(b.nodesRef.current,ve):[];if(!L&&Ke.length>0){let be=!0;if(Ke.forEach(A=>{var ce;(ce=A.context)!=null&&ce.open&&!A.context.dataRef.current.__escapeKeyBubbles&&(be=!1)}),!be)return}const Ue=eo(B)?B.nativeEvent:B,Me=Ne(ds,Ue);n.setOpen(!1,Me),!L&&!Me.isPropagationAllowed&&B.stopPropagation()}),$=se(()=>{o.current.insideReactTree=!0,_.start(0,K)});c.useEffect(()=>{if(!r||!i)return;o.current.__escapeKeyBubbles=L,o.current.__outsidePressBubbles=x;const B=new pt,ve=new pt;function Ke(){B.clear(),V.current=!0}function Ue(){B.start(Jr()?5:0,()=>{V.current=!1})}function Me(){k.current=!0,ve.start(0,()=>{k.current=!1})}function Oe(){D.current=!1,P.current=!1}function be(){const v=u.current,T=v==="pen"||!v?"mouse":v,oe=S(),re=typeof oe=="function"?oe():oe;return typeof re=="string"?re:re[T]}function A(v){const T=be();return T==="intentional"&&v.type!=="click"||T==="sloppy"&&v.type==="click"}function ce(v){var re;const T=(re=o.current.floatingContext)==null?void 0:re.nodeId,oe=b&&Ye(b.nodesRef.current,T).some(z=>{var ie;return we(v,(ie=z.context)==null?void 0:ie.elements.floating)});return we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement"))||oe}function pe(v){var en;if(A(v)){K();return}if(o.current.insideReactTree){K();return}const T=Fe(v),oe=`[${mt("inert")}]`,re=Je(T)?T.getRootNode():null,z=Array.from((_t(re)?re:ee(n.select("floatingElement"))).querySelectorAll(oe)),ie=n.context.triggerElements;if(T&&(ie.hasElement(T)||ie.hasMatchingElement(he=>G(he,T))))return;let le=Je(T)?T:null;for(;le&&!St(le);){const he=Qr(le);if(St(he)||!Je(he))break;le=he}if(z.length&&Je(T)&&!co(T)&&!G(T,n.select("floatingElement"))&&z.every(he=>!G(le,he)))return;if(Se(T)&&!("touches"in v)){const he=St(T),We=Bt(T),qe=/auto|scroll/,Lr=he||qe.test(We.overflowX),Vr=he||qe.test(We.overflowY),Kr=Lr&&T.clientWidth>0&&T.scrollWidth>T.clientWidth,Ur=Vr&&T.clientHeight>0&&T.scrollHeight>T.clientHeight,Wr=We.direction==="rtl",Br=Ur&&(Wr?v.offsetX<=T.offsetWidth-T.clientWidth:v.offsetX>T.clientWidth),_r=Kr&&v.offsetY>T.clientHeight;if(Br||_r)return}if(ce(v))return;if(be()==="intentional"&&k.current){ve.clear(),k.current=!1;return}if(typeof y=="function"&&!y(v))return;const ot=(en=o.current.floatingContext)==null?void 0:en.nodeId,Qt=b?Ye(b.nodesRef.current,ot):[];if(Qt.length>0){let he=!0;if(Qt.forEach(We=>{var qe;(qe=We.context)!=null&&qe.open&&!We.context.dataRef.current.__outsidePressBubbles&&(he=!1)}),!he)return}n.setOpen(!1,Ne(Vn,v)),K()}function st(v){be()!=="sloppy"||v.pointerType==="touch"||!n.select("open")||!i||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement"))||pe(v)}function O(v){if(be()!=="sloppy"||!n.select("open")||!i||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement")))return;const T=v.touches[0];T&&(C.current={startTime:Date.now(),startX:T.clientX,startY:T.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{C.current&&(C.current.dismissOnTouchEnd=!1,C.current.dismissOnMouseDown=!1)}))}function X(v,T){const oe=Fe(v);if(!oe)return;const re=Z(oe,v.type,()=>{T(v),re()})}function U(v){u.current="touch",X(v,O)}function te(v){j.clear(),v.type==="pointerdown"&&(u.current=v.pointerType),!(v.type==="mousedown"&&C.current&&!C.current.dismissOnMouseDown)&&X(v,T=>{T.type==="pointerdown"?st(T):pe(T)})}function F(v){if(!D.current)return;const T=P.current;if(Oe(),be()==="intentional"){if(v.type==="pointercancel"){T&&Me();return}if(!ce(v)){if(T){Me();return}typeof y=="function"&&!y(v)||(ve.clear(),k.current=!0,K())}}}function N(v){if(be()!=="sloppy"||!C.current||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement")))return;const T=v.touches[0];if(!T)return;const oe=Math.abs(T.clientX-C.current.startX),re=Math.abs(T.clientY-C.current.startY),z=Math.sqrt(oe*oe+re*re);z>5&&(C.current.dismissOnTouchEnd=!0),z>10&&(pe(v),j.clear(),C.current=null)}function J(v){X(v,N)}function M(v){be()!=="sloppy"||!C.current||we(v,n.select("floatingElement"))||we(v,n.select("domReferenceElement"))||(C.current.dismissOnTouchEnd&&pe(v),j.clear(),C.current=null)}function ye(v){X(v,M)}const Y=ee(s),xe=$e(l&&$e(Z(Y,"keydown",W),Z(Y,"compositionstart",Ke),Z(Y,"compositionend",Ue)),E&&$e(Z(Y,"click",te,!0),Z(Y,"pointerdown",te,!0),Z(Y,"pointerup",F,!0),Z(Y,"pointercancel",F,!0),Z(Y,"mousedown",te,!0),Z(Y,"mouseup",F,!0),Z(Y,"touchstart",U,!0),Z(Y,"touchmove",J,!0),Z(Y,"touchend",ye,!0)));return()=>{xe(),B.clear(),ve.clear(),Oe(),k.current=!1}},[o,s,l,E,y,r,i,L,x,W,K,S,b,n,j]),c.useEffect(K,[y,K]);const fe=c.useMemo(()=>({onKeyDown:W,[Oo[g]]:B=>{I()&&n.setOpen(!1,Ne(on,B.nativeEvent))},...g!=="intentional"&&{onClick(B){I()&&n.setOpen(!1,Ne(on,B.nativeEvent))}}}),[W,n,g,I]),ae=se(B=>{if(!r||!i||B.button!==0)return;const ve=Fe(B.nativeEvent);G(n.select("floatingElement"),ve)&&(D.current||(D.current=!0,P.current=!1))}),Ee=se(B=>{!r||!i||(B.defaultPrevented||B.nativeEvent.defaultPrevented)&&D.current&&(P.current=!0)}),Ve=c.useMemo(()=>({onKeyDown:W,onPointerDown:Ee,onMouseDown:Ee,onClickCapture:$,onMouseDownCapture(B){$(),ae(B)},onPointerDownCapture(B){$(),ae(B)},onMouseUpCapture:$,onTouchEndCapture:$,onTouchMoveCapture:$}),[W,$,ae,Ee]);return c.useMemo(()=>i?{reference:fe,floating:Ve,trigger:fe}:{},[i,fe,Ve])}const H=(e,t,n,r,s,o,...i)=>{if(i.length>0)throw new Error(Yt(1));let l;if(e)l=e;else throw new Error("Missing arguments");return l};var jo=es();const Fo=Dn(19),Ho=Fo?Vo:Ko;function wr(e,t,n,r,s){return Ho(e,t,n,r,s)}function Lo(e,t,n,r,s){const o=c.useCallback(()=>t(e.getSnapshot(),n,r,s),[e,t,n,r,s]);return jo.useSyncExternalStore(e.subscribe,o,o)}function Vo(e,t,n,r,s){return Lo(e,t,n,r,s)}function Ko(e,t,n,r,s){return ts.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,o=>t(o,n,r,s))}class Uo{constructor(t){ge(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));ge(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,s){return wr(this,t,n,r,s)}}class vr extends Uo{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){c.useDebugValue(t),ne(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;ne(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this,r=Object.values(t);ne(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){c.useDebugValue(t);const r=n!==void 0;ne(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r])}select(t,n,r,s){const o=this.selectors[t];return o(this.state,n,r,s)}useState(t,n,r,s){return c.useDebugValue(t),wr(this,this.selectors[t],n,r,s)}useContextCallback(t,n){c.useDebugValue(t);const r=se(n??$t);this.context[t]=r}useStateSetter(t){const n=c.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let s=r(this.state);return n(s,s,this),this.subscribe(o=>{const i=r(o);if(!Object.is(s,i)){const l=s;s=i,n(i,l,this)}})}}const Wo={open:H(e=>e.open),transitionStatus:H(e=>e.transitionStatus),domReferenceElement:H(e=>e.domReferenceElement),referenceElement:H(e=>e.positionReference??e.referenceElement),floatingElement:H(e=>e.floatingElement),floatingId:H(e=>e.floatingId)};class Rr extends vr{constructor(n){const{syncOnly:r,nested:s,onOpenChange:o,triggerElements:i,...l}=n;super({...l,positionReference:l.referenceElement,domReferenceElement:l.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:Ro(),nested:s,triggerElements:i},Wo);ge(this,"syncOpenEvent",(n,r)=>{(!n||!this.state.open||r!=null&&ro(r))&&(this.context.dataRef.current.openEvent=n?r:void 0)});ge(this,"dispatchOpenChange",(n,r)=>{this.syncOpenEvent(n,r.event);const s={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",s)});ge(this,"setOpen",(n,r)=>{var s,o,i,l;if(this.syncOnly){(o=(s=this.context).onOpenChange)==null||o.call(s,n,r);return}this.dispatchOpenChange(n,r),(l=(i=this.context).onOpenChange)==null||l.call(i,n,r)});this.syncOnly=r}}function Bo(e){const t=e.useState("open");ne(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,s]=n.value;e.update({activeTriggerId:r,activeTriggerElement:s})}}},[t,e])}function _o(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=fs(e);t.useSyncedValues({mounted:r,transitionStatus:o});const i=se(()=>{var h,a;s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),(a=(h=t.context).onOpenChangeComplete)==null||a.call(h,!1)}),l=t.useState("preventUnmountingOnClose");return Kn({enabled:!l,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:o}}class Cr{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function $o(){return new Rr({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Cr,floatingId:"",syncOnly:!1,nested:!1,onOpenChange:void 0})}function Yo(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:$o(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Qe,inactiveTriggerProps:Qe,popupProps:Qe}}const lt=H(e=>e.triggerIdProp??e.activeTriggerId),Zo={open:H(e=>e.openProp??e.open),mounted:H(e=>e.mounted),transitionStatus:H(e=>e.transitionStatus),floatingRootContext:H(e=>e.floatingRootContext),preventUnmountingOnClose:H(e=>e.preventUnmountingOnClose),payload:H(e=>e.payload),activeTriggerId:lt,activeTriggerElement:H(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:H((e,t)=>t!==void 0&&lt(e)===t),isOpenedByTrigger:H((e,t)=>t!==void 0&&lt(e)===t&&e.open),isMountedByTrigger:H((e,t)=>t!==void 0&&lt(e)===t&&e.mounted),triggerProps:H((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:H(e=>e.popupProps),popupElement:H(e=>e.popupElement),positionerElement:H(e=>e.positionerElement)};function Go(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,s=Gt(),o=Sr()!=null,i=t.useState("open"),l=t.useState("activeTriggerElement"),h=t.useState(n?"popupElement":"positionerElement"),a=t.context.triggerElements,d=Wt(()=>new Rr({open:i,transitionStatus:void 0,referenceElement:l,floatingElement:h,triggerElements:a,onOpenChange:r,floatingId:s,syncOnly:!0,nested:o})).current;return ne(()=>{const g={open:i,floatingId:s,referenceElement:l,floatingElement:h};Je(l)&&(g.domReferenceElement=l),d.state.positionReference===d.state.referenceElement&&(g.positionReference=l),d.update(g)},[i,s,l,h,d]),d.context.onOpenChange=r,d.context.nested=o,d}function qo(e=[]){const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),s=e.map(a=>a==null?void 0:a.trigger),o=c.useCallback(a=>ut(a,e,"reference"),t),i=c.useCallback(a=>ut(a,e,"floating"),n),l=c.useCallback(a=>ut(a,e,"item"),r),h=c.useCallback(a=>ut(a,e,"trigger"),s);return c.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:l,getTriggerProps:h}),[o,i,l,h])}function ut(e,t,n){var i;const r=new Map,s=n==="item",o={};n==="floating"&&(o.tabIndex=-1,o[Lt]="");for(const l in e)s&&e&&(l===rr||l===sr)||(o[l]=e[l]);for(let l=0;l<t.length;l+=1){let h;const a=(i=t[l])==null?void 0:i[n];typeof a=="function"?h=e?a(e):null:h=a,h&&Cn(o,h,s,r)}return Cn(o,e,s,r),o}function Cn(e,t,n,r){var s;for(const o in t){const i=t[o];n&&(o===rr||o===sr)||(o.startsWith("on")?(r.has(o)||r.set(o,[]),typeof i=="function"&&((s=r.get(o))==null||s.push(i),e[o]=(...l)=>{var h;return(h=r.get(o))==null?void 0:h.map(a=>a(...l)).find(a=>a!==void 0)})):e[o]=i)}}const zo=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Xo(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),s=n.useState("floatingId"),o=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:l="dialog"}=t,h=Gt(),a=(o==null?void 0:o.id)||h,d=c.useMemo(()=>{var S;return((S=Vt(i))==null?void 0:S.id)||s},[i,s]),g=zo.get(l)??l,m=Sr()!=null,b=c.useMemo(()=>g==="tooltip"||l==="label"?Qe:{"aria-haspopup":g==="alertdialog"?"dialog":g,"aria-expanded":"false",...g==="listbox"&&{role:"combobox"},...g==="menu"&&m&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[g,m,l]),p=c.useMemo(()=>g==="tooltip"||l==="label"?{[`aria-${l==="label"?"labelledby":"describedby"}`]:r?d:void 0}:{...b,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,...g==="menu"&&{id:a}},[g,d,r,a,l,b]),y=c.useMemo(()=>{const S={id:d,...g&&{role:g}};return g==="tooltip"||l==="label"?S:{...S,...g==="menu"&&{"aria-labelledby":a}}},[g,d,a,l]),E=c.useCallback(({active:S,selected:D})=>{const P={role:"option",...S&&{id:`${d}-fui-option`}};switch(l){case"select":case"combobox":return{...P,"aria-selected":D}}return{}},[d,l]);return c.useMemo(()=>({reference:p,floating:y,item:E,trigger:b}),[p,y,b,E])}let Le=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=an.startingStyle]="startingStyle",e[e.endingStyle=an.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const Jo={[Le.open]:""},Qo={[Le.closed]:""},ei={[Le.anchorHidden]:""},Tr={open(e){return e?Jo:Qo},anchorHidden(e){return e?ei:null}};function ti(e){return Dn(19)?e:e?"true":void 0}const ni=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M238.15,78.54,177.46,17.86a20,20,0,0,0-28.3,0L97.2,70c-12.43-3.33-36.68-5.72-61.74,14.5a20,20,0,0,0-1.6,29.73l45.46,45.47-39.8,39.8a12,12,0,0,0,17,17l39.8-39.81,45.47,45.46A20,20,0,0,0,155.91,228c.46,0,.93,0,1.4-.05A20,20,0,0,0,171.87,220c4.69-6.23,11-16.13,14.44-28s3.45-22.88.16-33.4l51.7-51.87A20,20,0,0,0,238.15,78.54Zm-74.26,68.79a12,12,0,0,0-2.23,13.84c3.43,6.86,6.9,21-6.28,40.65L54.08,100.53c21.09-14.59,39.53-6.64,41-6a11.67,11.67,0,0,0,13.81-2.29l54.43-54.61,55,55Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M229.66,98.34,172.39,155.8c11.46,22.93-1.72,45.86-10.11,57a8,8,0,0,1-12,.83L42.34,105.76A8,8,0,0,1,43,93.85c29.65-23.92,57.4-10,57.4-10l57.27-57.46a8,8,0,0,1,11.31,0L229.66,87A8,8,0,0,1,229.66,98.34Z",opacity:"0.2"}),c.createElement("path",{d:"M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M235.33,104l-53.47,53.65c4.56,12.67,6.45,33.89-13.19,60A15.93,15.93,0,0,1,157,224c-.38,0-.75,0-1.13,0a16,16,0,0,1-11.32-4.69L96.29,171,53.66,213.66a8,8,0,0,1-11.32-11.32L85,159.71l-48.3-48.3A16,16,0,0,1,38,87.63c25.42-20.51,49.75-16.48,60.4-13.14L152,20.7a16,16,0,0,1,22.63,0l60.69,60.68A16,16,0,0,1,235.33,104Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M233.91,82.79,173.22,22.1a14,14,0,0,0-19.81,0L98.93,76.77c-9.52-3.25-34-8.34-59.71,12.41A14,14,0,0,0,38.1,110l49.71,49.71-44.05,44a6,6,0,1,0,8.48,8.48l44.05-44.05L146,217.89a14,14,0,0,0,9.9,4.11q.49,0,1,0a14,14,0,0,0,10.19-5.54c19.72-26.21,17.15-47.23,12.46-59.3l54.37-54.55A14,14,0,0,0,233.91,82.79ZM225.42,94.1h0l-57.27,57.46a6,6,0,0,0-1.11,6.92c9.94,19.88-1.71,40.32-9.54,50.72a2,2,0,0,1-3,.2L46.58,101.51a2,2,0,0,1,.18-3c12.5-10.09,24.5-12.76,33.7-12.76a42.13,42.13,0,0,1,17.25,3.41A6,6,0,0,0,104.64,88L161.9,30.59a2,2,0,0,1,2.83,0l60.69,60.68A2,2,0,0,1,225.42,94.1Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M232.49,84.2,171.8,23.51a12,12,0,0,0-17,0L99.45,79.07c-8.08-3-32.79-9.45-59,11.67a12,12,0,0,0-1,17.84l51.13,51.13L45.17,205.17a4,4,0,0,0,5.66,5.66l45.46-45.47,51.12,51.12A12,12,0,0,0,155.9,220c.28,0,.57,0,.85,0a12,12,0,0,0,8.73-4.74c19.83-26.36,16.51-47.18,11.71-58.57l55.3-55.49A12,12,0,0,0,232.49,84.2Zm-5.66,11.31h0L169.56,153a4,4,0,0,0-.75,4.61c10.43,20.85-1.62,42-9.73,52.83a4,4,0,0,1-6,.4L45.17,102.93a4,4,0,0,1,.33-6C58.44,86.53,70.86,83.74,80.44,83.74A43.9,43.9,0,0,1,98.6,87.38a4,4,0,0,0,4.62-.75l57.27-57.46a4,4,0,0,1,5.66,0l60.68,60.69A4,4,0,0,1,226.83,95.51Z"}))]]),ri=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),c.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),kr=c.forwardRef((e,t)=>c.createElement(An,{ref:t,...e,weights:ni}));kr.displayName="PushPinIcon";const Pr=kr,Ir=c.forwardRef((e,t)=>c.createElement(An,{ref:t,...e,weights:ri}));Ir.displayName="TrashIcon";const si=Ir,oi=c.forwardRef(function({memory:t,selected:n,focused:r,confirming:s,onSelect:o,onPin:i,onDelete:l,onDeleteStart:h,onDeleteCancel:a},d){const g=t.content.length>140?`${t.content.slice(0,140)}…`:t.content;return f.jsxs("li",{ref:d,className:de("group relative flex flex-col gap-1.5 border-b border-border px-4 py-3 transition-colors","hover:bg-accent/40",n&&"bg-accent/60",r&&!n&&"bg-accent/20",r&&"outline-none ring-1 ring-inset ring-primary/40"),onMouseLeave:a,children:[f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsxs(Ae,{variant:"ghost",onClick:o,className:"h-auto flex-1 min-w-0 items-start justify-start whitespace-normal p-0 font-normal hover:bg-transparent",children:[f.jsx(rn,{variant:t.type,className:"mt-px shrink-0",title:Nn[t.type],children:jn(t.type)}),f.jsx("p",{className:"flex-1 text-xs leading-relaxed text-foreground line-clamp-2 min-w-0 text-left",children:g})]}),f.jsxs("div",{className:de("flex items-center gap-1 transition-opacity shrink-0",t.pinned?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"),children:[f.jsx(Ae,{variant:"ghost",size:"icon-sm",onClick:i,"aria-label":t.pinned?"Unpin":"Pin",className:de(t.pinned&&"text-primary"),children:f.jsx(Pr,{weight:t.pinned?"fill":"regular"})}),f.jsx(Ae,{variant:"ghost",size:"icon-sm",onClick:s?l:h,onBlur:a,"aria-label":s?"Confirm delete":"Delete",className:de(s?"text-destructive bg-destructive/10":"hover:text-destructive",t.pinned&&"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity"),children:f.jsx(si,{weight:s?"fill":"regular"})})]})]}),f.jsxs("div",{className:"flex items-center gap-2 pl-[42px]",children:[t.tags.length>0&&f.jsx("div",{className:"flex gap-1 flex-wrap",children:t.tags.map(w=>f.jsx(rn,{variant:"outline",children:w},w))}),f.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[t.needsReview&&f.jsx("span",{title:"Flagged for review — possible duplicate or conflict with another memory",children:f.jsx(Fn,{weight:"fill",className:"size-3 text-[var(--type-correction)]"})}),t.projects.length>0?f.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-32",children:t.projects.map(w=>w.name).join(", ")}):f.jsx("span",{className:"text-[11px] text-muted-foreground",children:"global"}),f.jsx("span",{className:"text-[11px] text-muted-foreground",children:new Date(t.updatedAt).toLocaleDateString()})]})]})]})}),Mr=c.createContext(void 0);function Ge(e){const t=c.useContext(Mr);if(e===!1&&t===void 0)throw new Error(Yt(27));return t}const ii={...Tr,...Un},ai=c.forwardRef(function(t,n){const{render:r,className:s,style:o,forceRender:i=!1,...l}=t,{store:h}=Ge(),a=h.useState("open"),d=h.useState("nested"),g=h.useState("mounted"),w=h.useState("transitionStatus");return nt("div",t,{state:{open:a,transitionStatus:w},ref:[h.context.backdropRef,n],stateAttributesMapping:ii,props:[{role:"presentation",hidden:!g,style:{userSelect:"none",WebkitUserSelect:"none"}},l],enabled:i||!d})}),ci=c.forwardRef(function(t,n){const{render:r,className:s,disabled:o=!1,nativeButton:i=!0,style:l,...h}=t,{store:a}=Ge(),d=a.useState("open");function g(p){d&&a.setOpen(!1,Ne(ps,p.nativeEvent))}const{getButtonProps:w,buttonRef:m}=ns({disabled:o,native:i});return nt("button",t,{state:{disabled:o},ref:[n,m],props:[{onClick:g},h,w]})});let li=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),ui=(function(e){return e[e.open=Le.open]="open",e[e.closed=Le.closed]="closed",e[e.startingStyle=Le.startingStyle]="startingStyle",e[e.endingStyle=Le.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Or=c.createContext(void 0);function di(){const e=c.useContext(Or);if(e===void 0)throw new Error(Yt(26));return e}const Dr="ArrowUp",Ar="ArrowDown",Nr="ArrowLeft",jr="ArrowRight",Fr="Home",Hr="End",fi=new Set([Nr,jr]),pi=new Set([Dr,Ar]),hi=new Set([...fi,...pi]);[...hi];const gi=new Set([Dr,Ar,Nr,jr,Fr,Hr]),mi={...Tr,...Un,nestedDialogOpen(e){return e?{[ui.nestedDialogOpen]:""}:null}},bi=c.forwardRef(function(t,n){const{className:r,finalFocus:s,initialFocus:o,render:i,style:l,...h}=t,{store:a}=Ge(),d=a.useState("descriptionElementId"),g=a.useState("disablePointerDismissal"),w=a.useState("floatingRootContext"),m=a.useState("popupProps"),b=a.useState("modal"),p=a.useState("mounted"),y=a.useState("nested"),E=a.useState("nestedOpenDialogCount"),S=a.useState("open"),D=a.useState("openMethod"),P=a.useState("titleElementId"),k=a.useState("transitionStatus"),L=a.useState("role");di(),Kn({open:S,ref:a.context.popupRef,onComplete(){var V,u;S&&((u=(V=a.context).onOpenChangeComplete)==null||u.call(V,!0))}});function x(V){return V==="touch"?a.context.popupRef.current:!0}const C=o===void 0?x:o,j=E>0,K=nt("div",t,{state:{open:S,nested:y,transitionStatus:k,nestedDialogOpen:j},props:[m,{"aria-labelledby":P??void 0,"aria-describedby":d??void 0,role:L,tabIndex:-1,hidden:!p,onKeyDown(V){gi.has(V.key)&&V.stopPropagation()},style:{[li.nestedDialogs]:E}},h],ref:[n,a.context.popupRef,a.useStateSetter("popupElement")],stateAttributesMapping:mi});return f.jsx(Mo,{context:w,openInteractionType:D,disabled:!p,closeOnFocusOut:!g,initialFocus:C,returnFocus:s,modal:b!==!1,restoreFocus:"popup",children:K})}),yi=c.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return f.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),xi=c.forwardRef(function(t,n){const{keepMounted:r=!1,...s}=t,{store:o}=Ge(),i=o.useState("mounted"),l=o.useState("modal"),h=o.useState("open");return i||r?f.jsx(Or.Provider,{value:r,children:f.jsxs(vo,{ref:n,...s,children:[i&&l===!0&&f.jsx(yi,{ref:o.context.internalBackdropRef,inert:ti(!h)}),t.children]})}):null});let Tn={},kn={},Pn="";function Si(e){if(typeof document>"u")return!1;const t=ee(e);return bt(t).innerWidth-t.documentElement.clientWidth>0}function Ei(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=ee(e),r=n.documentElement,s=n.body,o=Zt(r)?r:s,i=o.style.overflowY,l=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const h=o.offsetWidth;o.style.overflowY="hidden";const a=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=l,h===a}function wi(e){const t=ee(e),n=t.documentElement,r=t.body,s=Zt(n)?n:r,o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function vi(e){var m;const t=ee(e),n=t.documentElement,r=t.body,s=bt(n);let o=0,i=0,l=!1;const h=hs.create();if(tr&&(((m=s.visualViewport)==null?void 0:m.scale)??1)!==1)return()=>{};function a(){const b=s.getComputedStyle(n),p=s.getComputedStyle(r),S=(b.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Tn={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Pn=n.style.scrollBehavior,kn={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};const D=n.scrollHeight>n.clientHeight,P=n.scrollWidth>n.clientWidth,k=b.overflowY==="scroll"||p.overflowY==="scroll",L=b.overflowX==="scroll"||p.overflowX==="scroll",x=Math.max(0,s.innerWidth-r.clientWidth),C=Math.max(0,s.innerHeight-r.clientHeight),j=parseFloat(p.marginTop)+parseFloat(p.marginBottom),_=parseFloat(p.marginLeft)+parseFloat(p.marginRight),K=Zt(n)?n:r;if(l=Ei(e),l){n.style.scrollbarGutter=S,K.style.overflowY="hidden",K.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:S,overflowY:"hidden",overflowX:"hidden"}),(D||k)&&(n.style.overflowY="scroll"),(P||L)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:j||C?`calc(100dvh - ${j+C}px)`:"100dvh",width:_||x?`calc(100vw - ${_+x}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,Tn),Object.assign(r.style,kn),l||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Pn)}function g(){d(),h.request(a)}a();const w=Z(s,"resize",g);return()=>{h.cancel(),d(),typeof s.removeEventListener=="function"&&w()}}class Ri{constructor(){ge(this,"lockCount",0);ge(this,"restore",null);ge(this,"timeoutLock",pt.create());ge(this,"timeoutUnlock",pt.create());ge(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});ge(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=ee(t).documentElement,s=bt(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=$t;return}const o=nr||!Si(t);this.restore=o?wi(t):vi(t)}}const Ci=new Ri;function Ti(e=!0,t=null){ne(()=>{if(e)return Ci.acquire(t)},[e,t])}function ki(e){const t=c.useRef(""),n=c.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:c.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function Pi(e,t){const n=c.useRef(e),r=se(t);ne(()=>{n.current!==e&&r(n.current)},[e,r]),ne(()=>{n.current=e},[e])}function Ii(e){const[t,n]=c.useState(null),r=se((i,l)=>{e||n(l||(nr?"touch":""))});Pi(e,i=>{i&&!e&&n(null)});const{onClick:s,onPointerDown:o}=ki(r);return c.useMemo(()=>({openMethod:t,triggerProps:{onClick:s,onPointerDown:o}}),[t,s,o])}function Mi(e){const{store:t,parentContext:n,actionsRef:r,isDrawer:s}=e,o=t.useState("open"),i=t.useState("disablePointerDismissal"),l=t.useState("modal"),h=t.useState("popupElement"),{openMethod:a,triggerProps:d}=Ii(o);Bo(t);const{forceUnmount:g}=_o(o,t),w=c.useCallback(()=>{t.setOpen(!1,Ne(gs))},[t]);c.useImperativeHandle(r,()=>({unmount:g,close:w}),[g,w]);const m=Go({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[b,p]=c.useState(0),[y,E]=c.useState(0),S=b===0,D=Xo(m),P=No(m,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:l==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(K){if(!t.context.outsidePressEnabledRef.current||"button"in K&&K.button!==0||"touches"in K&&K.touches.length!==1)return!1;const V=Fe(K);if(S&&!i){const u=V;return l&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===u||t.context.backdropRef.current===u||G(u,h)&&!(u!=null&&u.hasAttribute("data-base-ui-portal")):!0}return!1},escapeKey:S});Ti(o&&l===!0,h);const{getReferenceProps:k,getFloatingProps:L,getTriggerProps:x}=qo([D,P]);t.useContextCallback("onNestedDialogOpen",(K,V)=>{p(K),E(V)}),t.useContextCallback("onNestedDialogClose",()=>{p(0),E(0)}),c.useEffect(()=>(n!=null&&n.onNestedDialogOpen&&o&&n.onNestedDialogOpen(b+1,y+(s?1:0)),n!=null&&n.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n!=null&&n.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[s,o,b,y,n]);const C=c.useMemo(()=>k(d),[k,d]),j=c.useMemo(()=>x(d),[x,d]),_=c.useMemo(()=>L(),[L]);t.useSyncedValues({openMethod:a,activeTriggerProps:C,inactiveTriggerProps:j,popupProps:_,floatingRootContext:m,nestedOpenDialogCount:b,nestedOpenDrawerCount:y})}const Oi={...Zo,modal:H(e=>e.modal),nested:H(e=>e.nested),nestedOpenDialogCount:H(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:H(e=>e.nestedOpenDrawerCount),disablePointerDismissal:H(e=>e.disablePointerDismissal),openMethod:H(e=>e.openMethod),descriptionElementId:H(e=>e.descriptionElementId),titleElementId:H(e=>e.titleElementId),viewportElement:H(e=>e.viewportElement),role:H(e=>e.role)};class Jt extends vr{constructor(n){super(Di(n),{popupRef:c.createRef(),backdropRef:c.createRef(),internalBackdropRef:c.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Cr,onOpenChange:void 0,onOpenChangeComplete:void 0},Oi);ge(this,"setOpen",(n,r)=>{var i,l,h;if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),(l=(i=this.context).onOpenChange)==null||l.call(i,n,r),r.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,r);const s={open:n},o=((h=r.trigger)==null?void 0:h.id)??null;(o||n)&&(s.activeTriggerId=o,s.activeTriggerElement=r.trigger??null),this.update(s)})}static useStore(n,r){const s=Wt(()=>new Jt(r)).current;return n??s}}function Di(e={}){return{...Yo(),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}}const In=c.createContext(!1);function Ai(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:o,disablePointerDismissal:i=!1,modal:l=!0,actionsRef:h,handle:a,triggerId:d,defaultTriggerId:g=null}=e,w=Ge(!0),m=c.useContext(In),b=!!w,p=Jt.useStore(a==null?void 0:a.store,{open:r,openProp:n,activeTriggerId:g,triggerIdProp:d,modal:l,disablePointerDismissal:i,nested:b});Zs(()=>{n===void 0&&p.state.open===!1&&r===!0&&p.update({open:!0,activeTriggerId:g})}),p.useControlledProp("openProp",n),p.useControlledProp("triggerIdProp",d),p.useSyncedValues({disablePointerDismissal:i,nested:b,modal:l}),p.useContextCallback("onOpenChange",s),p.useContextCallback("onOpenChangeComplete",o);const y=p.useState("payload");Mi({store:p,actionsRef:h,parentContext:w==null?void 0:w.store.context,isDrawer:m});const E=c.useMemo(()=>({store:p}),[p]);return f.jsx(In.Provider,{value:!1,children:f.jsx(Mr.Provider,{value:E,children:typeof t=="function"?t({payload:y}):t})})}const Ni=c.forwardRef(function(t,n){const{render:r,className:s,style:o,id:i,...l}=t,{store:h}=Ge(),a=ms(i);return h.useSyncedValueWithCleanup("titleElementId",a),nt("h2",t,{ref:n,props:[{id:a},l]})});function ji({...e}){return f.jsx(Ai,{"data-slot":"dialog",...e})}function Fi({...e}){return f.jsx(xi,{"data-slot":"dialog-portal",...e})}function Hi({className:e,...t}){return f.jsx(ai,{"data-slot":"dialog-overlay",className:de("fixed inset-0 isolate z-50 bg-black/80 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 Li({className:e,children:t,showCloseButton:n=!0,...r}){return f.jsxs(Fi,{children:[f.jsx(Hi,{}),f.jsxs(bi,{"data-slot":"dialog-content",className:de("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-4 rounded-xl bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r,children:[t,n&&f.jsxs(ci,{"data-slot":"dialog-close",render:f.jsx(Ae,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[f.jsx(rs,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Vi({className:e,...t}){return f.jsx("div",{"data-slot":"dialog-header",className:de("flex flex-col gap-1",e),...t})}function Ki({className:e,...t}){return f.jsx(Ni,{"data-slot":"dialog-title",className:de("font-heading text-sm font-medium",e),...t})}function Ui({className:e,...t}){return f.jsx("div",{"data-slot":"empty",className:de("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",e),...t})}function Mn({className:e,...t}){return f.jsx("div",{"data-slot":"empty-title",className:de("font-heading text-sm font-medium tracking-tight",e),...t})}function Wi({className:e,...t}){return f.jsx("div",{"data-slot":"empty-description",className:de("text-xs/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Bi({className:e,...t}){return f.jsx("kbd",{"data-slot":"kbd",className:de("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-xs bg-muted px-1 font-sans text-[0.625rem] font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",e),...t})}function _i(e){const t=ss.useSearch(),n=Hn(),[r,s]=c.useState(t.search),o=c.useRef(null),i=c.useRef(null),[l,h]=c.useState(new Set),[a,d]=c.useState(-1),[g,w]=c.useState(null),[m,b]=c.useState(!1),p=c.useRef([]),{data:y=[],isLoading:E}=sn(u=>u.from({m:Et}).orderBy(({m:I})=>I.createdAt,"desc"),[]),{data:S=[]}=sn(u=>u.from({p:os}),[]),D=c.useMemo(()=>{let u=y;if(t.type&&(u=u.filter(I=>I.type===t.type)),t.pinned&&(u=u.filter(I=>I.pinned)),t.needsReview&&(u=u.filter(I=>I.needsReview)),t.search){const I=t.search.toLowerCase();u=u.filter(W=>W.content.toLowerCase().includes(I))}return u},[y,t]),P=c.useMemo(()=>{const{projectId:u}=t;if(u==="global")return[{label:"Global",projectId:null,memories:D.filter($=>$.projects.length===0)}];if(u!==void 0){const $=S.find(ae=>ae.id===u),fe=D.filter(ae=>ae.projects.some(Ee=>Ee.id===u));return[{label:($==null?void 0:$.name)??u,projectId:u,memories:fe}]}const I=[],W=D.filter($=>$.projects.length===0);W.length>0&&I.push({label:"Global",projectId:null,memories:W});for(const $ of[...S].sort((fe,ae)=>fe.name.localeCompare(ae.name))){const fe=D.filter(ae=>ae.projects.some(Ee=>Ee.id===$.id));fe.length>0&&I.push({label:$.name,projectId:$.id,memories:fe})}return I},[D,S,t]),k=c.useMemo(()=>P.flatMap(u=>l.has(u.label)?[]:u.memories),[P,l]),L=c.useMemo(()=>{const u=new Set;let I=0;for(const W of P)for(const $ of W.memories)u.has($.id)||(u.add($.id),I++);return I},[P]);c.useEffect(()=>{k.length===0?d(-1):a>=k.length&&d(k.length-1)},[k.length,a]),c.useEffect(()=>{var u;a>=0&&((u=p.current[a])==null||u.scrollIntoView({block:"nearest"}))},[a]);const x=u=>{s(u),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{n({to:"/memories",search:I=>({...I,search:u})})},300)},C=(u,I)=>{Et.update(u,W=>{W.pinned=!I})},j=u=>{Et.delete(u),e===u&&n({to:"/memories"})},_=u=>{const I=k.findIndex(W=>W.id===u);I>=0&&d(I),n(e===u?{to:"/memories"}:{to:"/memories/$id",params:{id:u}})},K=u=>{h(I=>{const W=new Set(I);return W.has(u)?W.delete(u):W.add(u),W})},V=()=>{const u=k[a];u&&(g===u.id?(j(u.id),w(null)):w(u.id))};return $s([{hotkey:"/",callback:()=>{var u,I;(u=i.current)==null||u.focus(),(I=i.current)==null||I.select()},options:{preventDefault:!0}},{hotkey:"ArrowUp",callback:()=>{d(u=>u<=0?k.length-1:u-1)},options:{preventDefault:!0,enabled:k.length>0}},{hotkey:"ArrowDown",callback:()=>{d(u=>u<0||u>=k.length-1?0:u+1)},options:{preventDefault:!0,enabled:k.length>0}},{hotkey:"Enter",callback:()=>{const u=k[a];u&&_(u.id)},options:{enabled:a>=0}},{hotkey:"P",callback:()=>{const u=k[a];u&&C(u.id,u.pinned)},options:{enabled:a>=0}},{hotkey:"D",callback:V,options:{enabled:a>=0}},{hotkey:"Delete",callback:V,options:{enabled:a>=0}},{hotkey:"Escape",callback:()=>{if(g){w(null);return}if(m){b(!1);return}e&&n({to:"/memories"})}},{hotkey:{key:"?",shift:!0},callback:()=>b(u=>!u)}]),{search:t,searchInput:r,inputRef:i,allMemories:y,allProjects:S,isLoading:E,groups:P,totalCount:L,collapsedGroups:l,flatMemories:k,focusedIndex:a,confirmingId:g,setConfirmingId:w,showShortcuts:m,setShowShortcuts:b,rowRefs:p,handleSearchChange:x,handlePin:C,handleDelete:j,handleSelect:_,toggleGroup:K}}const $i=[["↑ / ↓","Navigate list"],["Enter","Open memory"],["P","Pin / unpin"],["D / Del","Delete (confirm twice)"],["Escape","Close / cancel"],["/","Focus search"],["?","Toggle this help"]];function Yi({selectedId:e}){const t=Hn(),{search:n,searchInput:r,inputRef:s,allMemories:o,allProjects:i,isLoading:l,groups:h,totalCount:a,collapsedGroups:d,focusedIndex:g,confirmingId:w,setConfirmingId:m,showShortcuts:b,setShowShortcuts:p,rowRefs:y,handleSearchChange:E,handlePin:S,handleDelete:D,handleSelect:P,toggleGroup:k}=_i(e);let L=0;return f.jsxs("div",{className:"relative flex flex-col h-full",children:[f.jsxs("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:[a," ",a===1?"memory":"memories",n.search?` matching "${n.search}"`:""]}),f.jsxs("div",{className:"flex flex-col gap-1.5 px-4 pt-3 pb-2 border-b border-border shrink-0",children:[f.jsxs("div",{className:"relative",children:[f.jsx(cs,{weight:"regular",className:"absolute left-2.5 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground pointer-events-none"}),f.jsx(bs,{ref:s,placeholder:"Search…",value:r,onChange:x=>E(x.target.value),className:"pl-7",title:"Press / to focus"})]}),f.jsxs("div",{className:"flex items-center gap-1.5",children:[f.jsxs(cn,{value:n.type??"",onChange:x=>void t({to:"/memories",search:C=>({...C,type:x.target.value?x.target.value:void 0})}),size:"sm",className:"w-24",children:[f.jsx(ze,{value:"",children:"All types"}),is.map(x=>f.jsx(ze,{value:x,title:Nn[x],children:jn(x)},x))]}),f.jsxs(cn,{value:n.projectId??"",onChange:x=>void t({to:"/memories",search:C=>({...C,projectId:x.target.value||void 0})}),size:"sm",className:"w-28",children:[f.jsx(ze,{value:"",children:"All projects"}),f.jsx(ze,{value:"global",children:"Global"}),[...i].sort((x,C)=>x.name.localeCompare(C.name)).map(x=>f.jsx(ze,{value:x.id,children:x.name},x.id))]}),f.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[f.jsx(Ae,{variant:n.pinned?"default":"ghost",size:"icon-sm",onClick:()=>void t({to:"/memories",search:x=>({...x,pinned:!x.pinned})}),"aria-label":"Pinned only","aria-pressed":n.pinned,children:f.jsx(Pr,{weight:n.pinned?"fill":"regular"})}),f.jsx(Ae,{variant:n.needsReview?"destructive":"ghost",size:"icon-sm",onClick:()=>void t({to:"/memories",search:x=>({...x,needsReview:!x.needsReview})}),"aria-label":"Needs review only","aria-pressed":n.needsReview,title:"Show memories flagged for review — possible duplicates or conflicts",children:f.jsx(Fn,{weight:n.needsReview?"fill":"regular"})}),f.jsx(Ae,{variant:"ghost",size:"icon-sm",onClick:()=>p(x=>!x),"aria-label":"Keyboard shortcuts","aria-pressed":b,title:"Press ? for shortcuts",children:f.jsx("span",{className:"text-[11px] font-mono font-bold",children:"?"})})]})]})]}),f.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l&&o.length===0&&f.jsx("div",{className:"flex items-center justify-center h-24 text-xs text-muted-foreground",children:"Loading…"}),!l&&h.length===0&&f.jsx(Ui,{className:"border-0 rounded-none p-0 h-32",children:o.length===0?f.jsxs(f.Fragment,{children:[f.jsx(Mn,{className:"text-xs font-normal",children:"No memories yet"}),f.jsxs(Wi,{className:"max-w-48",children:["Memories are saved automatically by AI coding tools. Run"," ",f.jsx("code",{className:"font-mono",children:"membank setup"})," to connect your tools."]})]}):f.jsxs(f.Fragment,{children:[f.jsx(Mn,{className:"text-xs font-normal",children:n.search?`No memories match "${n.search}"`:"No memories match the current filters"}),f.jsx(Ae,{variant:"link",size:"sm",onClick:()=>void t({to:"/memories",search:{}}),children:"Clear filters"})]})}),h.map(x=>{const C=d.has(x.label);return f.jsxs("div",{children:[f.jsxs("button",{type:"button",onClick:()=>k(x.label),className:de("sticky top-0 z-10 w-full flex items-center justify-between px-4 py-1.5","bg-background/95 backdrop-blur border-b border-border","text-[11px] uppercase tracking-wide text-muted-foreground hover:text-foreground transition-colors"),children:[f.jsx("span",{children:x.label}),f.jsx("span",{children:x.memories.length})]}),!C&&f.jsx("ul",{className:"m-0 p-0",children:x.memories.map(j=>{const _=L++;return f.jsx(oi,{ref:K=>{y.current[_]=K},memory:j,selected:e===j.id,focused:g===_,confirming:w===j.id,onSelect:()=>P(j.id),onPin:()=>S(j.id,j.pinned),onDelete:()=>{D(j.id),m(null)},onDeleteStart:()=>m(j.id),onDeleteCancel:()=>m(null)},`${x.label}-${j.id}`)})})]},x.label)})]}),a>0&&f.jsxs("div",{className:de("px-4 py-2 border-t border-border shrink-0","text-[11px] text-muted-foreground"),children:[a," ",a===1?"memory":"memories"]}),f.jsx(ji,{open:b,onOpenChange:p,children:f.jsxs(Li,{className:"min-w-56 sm:max-w-sm",children:[f.jsx(Vi,{children:f.jsx(Ki,{children:"Keyboard shortcuts"})}),f.jsx("dl",{className:"space-y-2",children:$i.map(([x,C])=>f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsx("dt",{className:"shrink-0 min-w-20 text-right",children:f.jsx(Bi,{children:x})}),f.jsx("dd",{className:"text-xs text-foreground",children:C})]},x))})]})})]})}function Ji(){const e=Ys({select:t=>{const n=t.location.pathname;return n.startsWith("/memories/")?n.slice(10):null}});return f.jsxs("div",{className:"flex flex-1 min-h-0 w-full",children:[f.jsx("div",{className:"w-[380px] shrink-0 border-r border-border overflow-hidden flex flex-col",children:f.jsx(Yi,{selectedId:e})}),f.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:f.jsx(as,{})})]})}export{Ji as component};
@@ -0,0 +1 @@
1
+ var We=e=>{throw TypeError(e)};var ze=(e,t,i)=>t.has(e)||We("Cannot "+i);var S=(e,t,i)=>(ze(e,t,"read from private field"),i?i.call(e):t.get(e)),R=(e,t,i)=>t.has(e)?We("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),P=(e,t,i,r)=>(ze(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);var Ke=(e,t,i,r)=>({set _(u){P(e,t,u,i)},get _(){return S(e,t,r)}});import{V as rt,W as ot,a as bt,r as V,X as W,j as g,b as Q,Y as pt,l as Ne,e as Z,x as yt,n as _e,J as Mt,o as St,Z as Ft,H as ue,_ as wt,M as xt,O as He,P as Pe,$ as Vt,Q as Et,a0 as At,a1 as qe,a2 as Ge,a3 as It,D as ve,C as se,a4 as Qe,S as lt,G as jt,F as Lt,a5 as Ct,a6 as Ye,a7 as kt,a8 as Tt}from"./index-O2KJf81b.js";import{v as Ot,k as Pt,q as Bt,w as Rt,d as ut,j as Dt,T as Je,m as dt,e as Nt,A as $,b as _t,x as $t,l as Ut,N as Xe,s as ke,I as Wt}from"./native-select-DqP_P0PQ.js";class zt{constructor(t){this.atom=rt(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(ot(t))}}class Kt{constructor(t){this.atom=rt(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(ot(t))}}function we(e){return typeof e=="function"?new Kt(e):new zt(e)}function Ht(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in e)return e;if(typeof e=="function")return{shouldBlockFn:async()=>await e(),enableBeforeUnload:!0,withResolver:!1};const i=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>i&&r!==void 0?await r():i,enableBeforeUnload:i,withResolver:r===void 0}}function qt(e,t){const{shouldBlockFn:i,enableBeforeUnload:r=!0,disabled:u=!1,withResolver:f=!1}=Ht(e),s=bt(),{history:n}=s,[c,d]=V.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return V.useEffect(()=>{const l=async o=>{function h(b){const F=s.parseLocation(b),p=s.getMatchedRoutes(F.pathname);return p.foundRoute===void 0?{routeId:"__notFound__",fullPath:F.pathname,pathname:F.pathname,params:p.routeParams,search:s.options.parseSearch(b.search)}:{routeId:p.foundRoute.id,fullPath:p.foundRoute.fullPath,pathname:F.pathname,params:p.routeParams,search:s.options.parseSearch(b.search)}}const a=h(o.currentLocation),m=h(o.nextLocation);if(a.routeId==="__notFound__"&&m.routeId!=="__notFound__")return!1;const v=await i({action:o.action,current:a,next:m});if(!f)return v;if(!v)return!1;const M=await new Promise(b=>{d({status:"blocked",current:a,next:m,action:o.action,proceed:()=>b(!1),reset:()=>b(!0)})});return d({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),M};return u?void 0:n.block({blockerFn:l,enableBeforeUnload:r})},[i,r,u,f,n,s]),c}var Gt=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...i)=>{const r=Date.now()-this.lastExecutionTime;if(this.options.leading&&r>=this.options.wait)this.execute(...i);else if(this.lastArgs=i,!this.timeoutId&&this.options.trailing){const u=this.options.wait-r;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},u)}},this.execute=(...i)=>{var r,u;this.fn(...i),(u=(r=this.options).onExecute)==null||u.call(r,i,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function Qt(e,t){return new Gt(e,t).maybeExecute}var J,_,D,fe,H,te,q,re,me,Ae,X,oe,G,ge,le,Ie;class Yt{constructor({pluginId:t,debug:i=!1,enabled:r=!0,reconnectEveryMs:u=300}){R(this,J,!0);R(this,_);R(this,D);R(this,fe);R(this,H);R(this,te);R(this,q);R(this,re);R(this,me,0);R(this,Ae,5);R(this,X,!1);R(this,oe,!1);R(this,G,null);R(this,ge,()=>{this.debugLog("Connected to event bus"),P(this,te,!0),P(this,X,!1),this.debugLog("Emitting queued events",S(this,H)),S(this,H).forEach(t=>this.emitEventToBus(t)),P(this,H,[]),this.stopConnectLoop(),S(this,D).call(this).removeEventListener("tanstack-connect-success",S(this,ge))});R(this,le,()=>{if(S(this,me)<S(this,Ae)){Ke(this,me)._++,this.dispatchCustomEvent("tanstack-connect",{});return}S(this,D).call(this).removeEventListener("tanstack-connect",S(this,le)),P(this,oe,!0),this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()});R(this,Ie,()=>{S(this,X)||(P(this,X,!0),S(this,D).call(this).addEventListener("tanstack-connect-success",S(this,ge)),S(this,le).call(this))});P(this,_,t),P(this,J,r),P(this,D,this.getGlobalTarget),P(this,fe,i),this.debugLog(" Initializing event subscription for plugin",S(this,_)),P(this,H,[]),P(this,te,!1),P(this,oe,!1),P(this,q,null),P(this,re,u)}startConnectLoop(){S(this,q)!==null||S(this,te)||(this.debugLog(`Starting connect loop (every ${S(this,re)}ms)`),P(this,q,setInterval(S(this,le),S(this,re))))}stopConnectLoop(){P(this,X,!1),S(this,q)!==null&&(clearInterval(S(this,q)),P(this,q,null),P(this,H,[]),this.debugLog("Stopped connect loop"))}debugLog(...t){S(this,fe)&&console.log(`🌴 [tanstack-devtools:${S(this,_)}-plugin]`,...t)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const t=typeof EventTarget<"u"?new EventTarget:void 0;return typeof t>"u"||typeof t.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),t)}getPluginId(){return S(this,_)}dispatchCustomEventShim(t,i){try{const r=new Event(t,{detail:i});S(this,D).call(this).dispatchEvent(r)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(t,i){try{S(this,D).call(this).dispatchEvent(new CustomEvent(t,{detail:i}))}catch{this.dispatchCustomEventShim(t,i)}}emitEventToBus(t){this.debugLog("Emitting event to client bus",t),this.dispatchCustomEvent("tanstack-dispatch-event",t)}createEventPayload(t,i){return{type:`${S(this,_)}:${t}`,payload:i,pluginId:S(this,_)}}emit(t,i){if(!S(this,J)){this.debugLog("Event bus client is disabled, not emitting event",t,i);return}if(S(this,G)&&(this.debugLog("Emitting event to internal event target",t,i),S(this,G).dispatchEvent(new CustomEvent(`${S(this,_)}:${t}`,{detail:this.createEventPayload(t,i)}))),S(this,oe)){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!S(this,te)){this.debugLog("Bus not available, will be pushed as soon as connected"),S(this,H).push(this.createEventPayload(t,i)),typeof CustomEvent<"u"&&!S(this,X)&&(S(this,Ie).call(this),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(t,i))}on(t,i,r){const u=(r==null?void 0:r.withEventTarget)??!1,f=`${S(this,_)}:${t}`;if(u&&(S(this,G)||P(this,G,new EventTarget),S(this,G).addEventListener(f,n=>{i(n.detail)})),!S(this,J))return this.debugLog("Event bus client is disabled, not registering event",f),()=>{};const s=n=>{this.debugLog("Received event from bus",n.detail),i(n.detail)};return S(this,D).call(this).addEventListener(f,s),this.debugLog("Registered event to bus",f),()=>{var n;u&&((n=S(this,G))==null||n.removeEventListener(f,s)),S(this,D).call(this).removeEventListener(f,s)}}onAll(t){if(!S(this,J))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const i=r=>{const u=r.detail;t(u)};return S(this,D).call(this).addEventListener("tanstack-devtools-global",i),()=>S(this,D).call(this).removeEventListener("tanstack-devtools-global",i)}onAllPluginEvents(t){if(!S(this,J))return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const i=r=>{const u=r.detail;S(this,_)&&u.pluginId!==S(this,_)||t(u)};return S(this,D).call(this).addEventListener("tanstack-devtools-global",i),()=>S(this,D).call(this).removeEventListener("tanstack-devtools-global",i)}}J=new WeakMap,_=new WeakMap,D=new WeakMap,fe=new WeakMap,H=new WeakMap,te=new WeakMap,q=new WeakMap,re=new WeakMap,me=new WeakMap,Ae=new WeakMap,X=new WeakMap,oe=new WeakMap,G=new WeakMap,ge=new WeakMap,le=new WeakMap,Ie=new WeakMap;class Jt extends Yt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const U=new Jt;function je(e,t){return typeof e=="function"?e(t):e}function be(e,t){return $e(t).reduce((r,u)=>{if(r===null)return null;if(typeof r<"u")return r[u]},e)}function pe(e,t,i){const r=$e(t);function u(f){if(!r.length)return je(i,f);const s=r.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(f))return typeof f=="object"?(f===null&&(f={}),{...f,[s]:u(f[s])}):{[s]:u()};if(Array.isArray(f)&&typeof s=="number"){const n=f.slice(0,s);return[...n.length?n:new Array(s),u(f[s]),...f.slice(s+1)]}return[...new Array(s),u()]}return u(e)}function Xt(e,t){const i=$e(t);function r(u){if(!u)return;if(i.length===1){const s=i[0];if(Array.isArray(u)&&typeof s=="number")return u.filter((d,l)=>l!==s);const{[s]:n,...c}=u;return c}const f=i.shift();if((typeof f=="string"||typeof f=="number"&&!Array.isArray(u))&&typeof u=="object")return{...u,[f]:r(u[f])};if(typeof f=="number"&&Array.isArray(u)){if(f>=u.length)return u;const s=u.slice(0,f);return[...s.length?s:new Array(f),r(u[f]),...u.slice(f+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return r(e)}const Zt=/^(\d+)$/gm,es=/\.(\d+)(?=\.)/gm,ts=/^(\d+)\./gm,ss=/\.(\d+$)/gm,is=/\.{2,}/gm,Be="__int__",ye=`${Be}$1`;function $e(e){if(Array.isArray(e))return[...e];if(typeof e!="string")throw new Error("Path must be a string.");return e.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(Zt,ye).replace(es,`.${ye}.`).replace(ts,`${ye}.`).replace(ss,`.${ye}`).replace(is,".").split(".").map(t=>{if(t.startsWith(Be)){const i=t.substring(Be.length),r=parseInt(i,10);return String(r)===i?r:i}return t})}function ns(e){return!(Array.isArray(e)&&e.length===0)}function Re(e,t){const i=r=>r.validators.filter(Boolean).map(u=>({cause:u.cause,validate:u.fn}));return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:i})}function De(e,t){const{asyncDebounceMs:i}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:u,onDynamicAsyncDebounceMs:f}=t.validators||{},s=i??0,n=c=>c.validators.filter(Boolean).map(d=>{const l=(d==null?void 0:d.cause)||e;let o=s;switch(l){case"change":o=u??s;break;case"blur":o=r??s;break;case"dynamic":o=f??s;break;case"submit":o=0;break}return e==="submit"&&(o=0),{cause:l,validate:d.fn,debounceMs:o}});return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:n})}const xe=e=>!!e&&typeof e=="object"&&"fields"in e;function Y(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[u,f]of e)if(!t.has(u)||!Object.is(f,t.get(u)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const u of e)if(!t.has(u))return!1;return!0}const i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(const u of i)if(!r.includes(u)||!Y(e[u],t[u]))return!1;return!0}const Ze=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:i})=>e?{newErrorValue:e,newSource:"form"}:t?{newErrorValue:void 0,newSource:void 0}:i?{newErrorValue:i,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},et=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:"field"}:e?{newErrorValue:e,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function N(e,t){return e==null?t:{...e,...t}}let ee=256;const Ve=[];let Me;for(;ee--;)Ve[ee]=(ee+256).toString(16).substring(1);function ct(){let e=0,t,i="";if(!Me||ee+16>256){for(Me=new Array(256),e=256;e--;)Me[e]=256*Math.random()|0;e=0,ee=0}for(;e<16;e++)t=Me[ee+e],e===6?i+=Ve[t&15|64]:e===8?i+=Ve[t&63|128]:i+=Ve[t],e&1&&e>1&&e<11&&(i+="-");return ee++,i}const as=Qt(e=>U.emit("form-state",{id:e.formId,state:e.store.state}),{wait:300});function ce(e){if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){const i=[];for(let r=0;r<e.length;r++)i[r]=ce(e[r]);return i}if(e instanceof Map){const i=new Map;return e.forEach((r,u)=>{i.set(u,ce(r))}),i}if(e instanceof Set){const i=new Set;return e.forEach(r=>{i.add(ce(r))}),i}const t={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=ce(e[i]));return t}const ie=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});const t=e.event.async,i=t?void 0:{fn:e.validators.onMount,cause:"mount"},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:"change"},u={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:"blur"},f={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:"submit"},s=t?void 0:{fn:()=>{},cause:"server"};switch(e.event.type){case"mount":return e.runValidation({validators:[i],form:e.form});case"submit":return e.runValidation({validators:[r,u,f,s],form:e.form});case"server":return e.runValidation({validators:[],form:e.form});case"blur":return e.runValidation({validators:[u,s],form:e.form});case"change":return e.runValidation({validators:[r,s],form:e.form});default:throw new Error(`Unknown validation event type: ${e.event.type}`)}};function rs(e,t){const i=new Map;for(const r of e){const u=r.path??[];let f=t,s="";for(let n=0;n<u.length;n++){const c=u[n];if(c===void 0)continue;const d=typeof c=="object"?c.key:c,l=Number(d);Array.isArray(f)&&!Number.isNaN(l)?s+=`[${l}]`:s+=(n>0?".":"")+String(d),typeof f=="object"&&f!==null?f=f[d]:f=void 0}i.set(s,(i.get(s)??[]).concat(r))}return Object.fromEntries(i)}const tt=(e,t)=>{const i=rs(e,t);return{form:i,fields:i}},ae={validate({value:e,validationSource:t},i){const r=i["~standard"].validate(e);if(r instanceof Promise)throw new Error("async function passed to sync validator");if(r.issues)return t==="field"?r.issues:tt(r.issues,e)},async validateAsync({value:e,validationSource:t},i){const r=await i["~standard"].validate(e);if(r.issues)return t==="field"?r.issues:tt(r.issues,e)}},ht=e=>!!e&&"~standard"in e,z={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Se(e){function t(l,o,h){const a=s(l,o,"move",h),m=Math.min(o,h),v=Math.max(o,h);for(let b=m;b<=v;b++)a.push(f(l,b));const M=Object.keys(e.fieldInfo).reduce((b,F)=>(F.startsWith(f(l,o))&&b.set(F,e.getFieldMeta(F)),b),new Map);c(a,o<h?"up":"down"),Object.keys(e.fieldInfo).filter(b=>b.startsWith(f(l,h))).forEach(b=>{const F=b.replace(f(l,h),f(l,o)),p=M.get(F);p&&e.setFieldMeta(b,p)})}function i(l,o){const h=s(l,o,"remove");c(h,"up")}function r(l,o,h){s(l,o,"swap",h).forEach(m=>{if(!m.toString().startsWith(f(l,o)))return;const v=m.toString().replace(f(l,o),f(l,h)),[M,b]=[e.getFieldMeta(m),e.getFieldMeta(v)];M&&e.setFieldMeta(v,M),b&&e.setFieldMeta(m,b)})}function u(l,o){const h=s(l,o,"insert");c(h,"down"),h.forEach(a=>{a.toString().startsWith(f(l,o))&&e.setFieldMeta(a,d())})}function f(l,o){return`${l}[${o}]`}function s(l,o,h,a){const m=[f(l,o)];switch(h){case"swap":m.push(f(l,a));break;case"move":{const[v,M]=[Math.min(o,a),Math.max(o,a)];for(let b=v;b<=M;b++)m.push(f(l,b));break}default:{const v=e.getFieldValue(l),M=Array.isArray(v)?v.length:0;for(let b=o+1;b<M;b++)m.push(f(l,b));break}}return Object.keys(e.fieldInfo).filter(v=>m.some(M=>v.startsWith(M)))}function n(l,o){return l.replace(/\[(\d+)\]/,(h,a)=>{const m=parseInt(a,10);return`[${o==="up"?m+1:Math.max(0,m-1)}]`})}function c(l,o){(o==="up"?l:[...l].reverse()).forEach(a=>{const m=n(a.toString(),o),v=e.getFieldMeta(m);v?e.setFieldMeta(a,v):e.setFieldMeta(a,d())})}const d=()=>z;return{handleArrayMove:t,handleArrayRemove:i,handleArraySwap:r,handleArrayInsert:u}}function Te(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class st{constructor(t){var f;this.options={},this.fieldInfo={},this.mount=()=>{var h,a;const s=this.store.subscribe(()=>{as(this)}),n=U.on("request-form-state",m=>{m.payload.id===this._formId&&U.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),c=U.on("request-form-reset",m=>{m.payload.id===this._formId&&this.reset()}),d=U.on("request-form-force-submit",m=>{m.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),l=()=>{d(),c(),n(),s.unsubscribe(),U.emit("form-unmounted",{id:this._formId})};(a=(h=this.options.listeners)==null?void 0:h.onMount)==null||a.call(h,{formApi:this});const{onMount:o}=this.options.validators||{};return U.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),o&&this.validateSync("mount"),l},this.update=s=>{if(!s)return;const n=this.options;this.options=s;const c=s.defaultValues&&!Y(s.defaultValues,n.defaultValues)&&!this.state.isTouched,d=!Y(s.defaultState,n.defaultState)&&!this.state.isTouched;!c&&!d||(W(()=>{this.baseStore.setState(()=>Te(Object.assign({},this.state,d?s.defaultState:{},c?{values:s.defaultValues}:{})))}),U.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(s,n)=>{const{fieldMeta:c}=this.state,d=this.resetFieldMeta(c);s&&!(n!=null&&n.keepDefaultValues)&&(this.options={...this.options,defaultValues:s}),this.baseStore.setState(()=>{var l;return Te({...this.options.defaultState,values:s??this.options.defaultValues??((l=this.options.defaultState)==null?void 0:l.values),fieldMetaBase:d})})},this.validateAllFields=async s=>{const n=[];return W(()=>{Object.values(this.fieldInfo).forEach(d=>{if(!d.instance)return;const l=d.instance;n.push(Promise.resolve().then(()=>l.validate(s,{skipFormValidation:!0}))),d.instance.state.meta.isTouched||d.instance.setMeta(o=>({...o,isTouched:!0}))})}),(await Promise.all(n)).flat()},this.validateArrayFieldsStartingFrom=async(s,n,c)=>{const d=this.getFieldValue(s),l=Array.isArray(d)?Math.max(d.length-1,0):null,o=[`${s}[${n}]`];for(let v=n+1;v<=(l??0);v++)o.push(`${s}[${v}]`);const h=Object.keys(this.fieldInfo).filter(v=>o.some(M=>v.startsWith(M))),a=[];return W(()=>{h.forEach(v=>{a.push(Promise.resolve().then(()=>this.validateField(v,c)))})}),(await Promise.all(a)).flat()},this.validateField=(s,n)=>{var d,l;const c=(d=this.fieldInfo[s])==null?void 0:d.instance;if(!c){const{hasErrored:o}=this.validateSync(n);return o&&!this.options.asyncAlways?((l=this.getFieldMeta(s))==null?void 0:l.errors)??[]:this.validateAsync(n).then(()=>{var h;return((h=this.getFieldMeta(s))==null?void 0:h.errors)??[]})}return c.state.meta.isTouched||c.setMeta(o=>({...o,isTouched:!0})),c.validate(n)},this.validateSync=s=>{const n=Re(s,{...this.options,form:this,validationLogic:this.options.validationLogic||ie});let c=!1;const d={};return W(()=>{var h,a,m;for(const v of n){if(!v.validate)continue;const M=this.runValidator({validate:v.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:b,fieldErrors:F}=Ee(M),p=de(v.cause),E=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(F||{})]);for(const w of E){if(this.baseStore.state.fieldMetaBase[w]===void 0&&!(F!=null&&F[w]))continue;const k=this.getFieldMeta(w)??z,{errorMap:A,errorSourceMap:O}=k,C=F==null?void 0:F[w],{newErrorValue:B,newSource:L}=Ze({newFormValidatorError:C,isPreviousErrorFromFormValidator:(O==null?void 0:O[p])==="form",previousErrorValue:A==null?void 0:A[p]});L==="form"&&(d[w]={...d[w],[p]:C}),(A==null?void 0:A[p])!==B&&this.setFieldMeta(w,(y=z)=>({...y,errorMap:{...y.errorMap,[p]:B},errorSourceMap:{...y.errorSourceMap,[p]:L}}))}((h=this.state.errorMap)==null?void 0:h[p])!==b&&this.baseStore.setState(w=>({...w,errorMap:{...w.errorMap,[p]:b}})),(b||F)&&(c=!0)}const l=de("submit");(a=this.state.errorMap)!=null&&a[l]&&s!=="submit"&&!c&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[l]:void 0}}));const o=de("server");(m=this.state.errorMap)!=null&&m[o]&&s!=="server"&&!c&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[o]:void 0}}))}),{hasErrored:c,fieldsErrorMap:d}},this.validateAsync=async s=>{const n=De(s,{...this.options,form:this,validationLogic:this.options.validationLogic||ie});this.state.isFormValidating||this.baseStore.setState(h=>({...h,isFormValidating:!0}));const c=[];let d;for(const h of n){if(!h.validate)continue;const a=de(h.cause),m=this.state.validationMetaMap[a];m==null||m.lastAbortController.abort();const v=new AbortController;this.state.validationMetaMap[a]={lastAbortController:v},c.push(new Promise(async M=>{let b;try{b=await new Promise((w,k)=>{setTimeout(async()=>{if(v.signal.aborted)return w(void 0);try{w(await this.runValidator({validate:h.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:v.signal},type:"validateAsync"}))}catch(A){k(A)}},h.debounceMs)})}catch(w){b=w}const{formError:F,fieldErrors:p}=Ee(b);p&&(d=d?{...d,...p}:p);const E=de(h.cause);for(const w of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[w]===void 0)continue;const k=this.getFieldMeta(w);if(!k)continue;const{errorMap:A,errorSourceMap:O}=k,C=d==null?void 0:d[w],{newErrorValue:B,newSource:L}=Ze({newFormValidatorError:C,isPreviousErrorFromFormValidator:(O==null?void 0:O[E])==="form",previousErrorValue:A==null?void 0:A[E]});(A==null?void 0:A[E])!==B&&this.setFieldMeta(w,y=>({...y,errorMap:{...y.errorMap,[E]:B},errorSourceMap:{...y.errorSourceMap,[E]:L}}))}this.baseStore.setState(w=>({...w,errorMap:{...w.errorMap,[E]:F}})),M(d?{fieldErrors:d,errorMapKey:E}:void 0)}))}let l=[];const o={};if(c.length){l=await Promise.all(c);for(const h of l)if(h!=null&&h.fieldErrors){const{errorMapKey:a}=h;for(const[m,v]of Object.entries(h.fieldErrors)){const b={...o[m]||{},[a]:v};o[m]=b}}}return this.baseStore.setState(h=>({...h,isFormValidating:!1})),o},this.validate=s=>{const{hasErrored:n,fieldsErrorMap:c}=this.validateSync(s);return n&&!this.options.asyncAlways?c:this.validateAsync(s)},this._handleSubmit=async s=>{var d,l,o,h,a,m,v,M,b,F;this.baseStore.setState(p=>({...p,isSubmitted:!1,submissionAttempts:p.submissionAttempts+1,isSubmitSuccessful:!1})),W(()=>{Object.values(this.fieldInfo).forEach(p=>{p.instance&&(p.instance.state.meta.isTouched||p.instance.setMeta(E=>({...E,isTouched:!0})))})});const n=s??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){(l=(d=this.options).onSubmitInvalid)==null||l.call(d,{value:this.state.values,formApi:this,meta:n});return}this.baseStore.setState(p=>({...p,isSubmitting:!0}));const c=()=>{this.baseStore.setState(p=>({...p,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){c(),(h=(o=this.options).onSubmitInvalid)==null||h.call(o,{value:this.state.values,formApi:this,meta:n}),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(p=>p.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){c(),(m=(a=this.options).onSubmitInvalid)==null||m.call(a,{value:this.state.values,formApi:this,meta:n}),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}W(()=>{Object.values(this.fieldInfo).forEach(p=>{var E,w,k;(k=(w=(E=p.instance)==null?void 0:E.options.listeners)==null?void 0:w.onSubmit)==null||k.call(w,{value:p.instance.state.value,fieldApi:p.instance})})}),(M=(v=this.options.listeners)==null?void 0:v.onSubmit)==null||M.call(v,{formApi:this,meta:n});try{await((F=(b=this.options).onSubmit)==null?void 0:F.call(b,{value:this.state.values,formApi:this,meta:n})),W(()=>{this.baseStore.setState(p=>({...p,isSubmitted:!0,isSubmitSuccessful:!0})),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),c()})}catch(p){throw this.baseStore.setState(E=>({...E,isSubmitSuccessful:!1})),U.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:p}),c(),p}},this.getFieldValue=s=>be(this.state.values,s),this.getFieldMeta=s=>this.state.fieldMeta[s],this.getFieldInfo=s=>{var n;return(n=this.fieldInfo)[s]||(n[s]={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}})},this.setFieldMeta=(s,n)=>{this.baseStore.setState(c=>({...c,fieldMetaBase:{...c.fieldMetaBase,[s]:je(n,c.fieldMetaBase[s])}}))},this.resetFieldMeta=s=>Object.keys(s).reduce((n,c)=>{const d=c;return n[d]=z,n},{}),this.setFieldValue=(s,n,c)=>{var h;const d=(c==null?void 0:c.dontUpdateMeta)??!1,l=(c==null?void 0:c.dontRunListeners)??!1,o=(c==null?void 0:c.dontValidate)??!1;W(()=>{d||this.setFieldMeta(s,a=>({...a,isTouched:!0,isDirty:!0,errorMap:{...a==null?void 0:a.errorMap,onMount:void 0}})),this.baseStore.setState(a=>({...a,values:pe(a.values,s,n)}))}),l||(h=this.getFieldInfo(s).instance)==null||h.triggerOnChangeListener(),o||this.validateField(s,"change")},this.deleteField=s=>{const c=[...Object.keys(this.fieldInfo).filter(d=>{const l=s.toString();return d!==l&&d.startsWith(l)}),s];this.baseStore.setState(d=>{const l={...d};return c.forEach(o=>{l.values=Xt(l.values,o),delete this.fieldInfo[o],delete l.fieldMetaBase[o]}),l})},this.pushFieldValue=(s,n,c)=>{this.setFieldValue(s,d=>[...Array.isArray(d)?d:[],n],c)},this.insertFieldValue=async(s,n,c,d)=>{this.setFieldValue(s,o=>[...o.slice(0,n),c,...o.slice(n)],N(d,{dontValidate:!0}));const l=(d==null?void 0:d.dontValidate)??!1;l||await this.validateField(s,"change"),Se(this).handleArrayInsert(s,n),l||await this.validateArrayFieldsStartingFrom(s,n,"change")},this.replaceFieldValue=async(s,n,c,d)=>{this.setFieldValue(s,o=>o.map((h,a)=>a===n?c:h),N(d,{dontValidate:!0})),((d==null?void 0:d.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,n,"change"))},this.removeFieldValue=async(s,n,c)=>{const d=this.getFieldValue(s),l=Array.isArray(d)?Math.max(d.length-1,0):null;if(this.setFieldValue(s,h=>h.filter((a,m)=>m!==n),N(c,{dontValidate:!0})),Se(this).handleArrayRemove(s,n),l!==null){const h=`${s}[${l}]`;this.deleteField(h)}((c==null?void 0:c.dontValidate)??!1)||(await this.validateField(s,"change"),await this.validateArrayFieldsStartingFrom(s,n,"change"))},this.swapFieldValues=(s,n,c,d)=>{this.setFieldValue(s,o=>{const h=o[n],a=o[c];return pe(pe(o,`${n}`,a),`${c}`,h)},N(d,{dontValidate:!0})),Se(this).handleArraySwap(s,n,c),((d==null?void 0:d.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${n}]`,"change"),this.validateField(`${s}[${c}]`,"change"))},this.moveFieldValues=(s,n,c,d)=>{this.setFieldValue(s,o=>{const h=[...o];return h.splice(c,0,h.splice(n,1)[0]),h},N(d,{dontValidate:!0})),Se(this).handleArrayMove(s,n,c),((d==null?void 0:d.dontValidate)??!1)||(this.validateField(s,"change"),this.validateField(`${s}[${n}]`,"change"),this.validateField(`${s}[${c}]`,"change"))},this.clearFieldValues=(s,n)=>{const c=this.getFieldValue(s),d=Array.isArray(c)?Math.max(c.length-1,0):null;if(this.setFieldValue(s,[],N(n,{dontValidate:!0})),d!==null)for(let o=0;o<=d;o++){const h=`${s}[${o}]`;this.deleteField(h)}((n==null?void 0:n.dontValidate)??!1)||this.validateField(s,"change")},this.resetField=s=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[s]:z},values:this.options.defaultValues?pe(n.values,s,be(this.options.defaultValues,s)):n.values}))},this.setErrorMap=s=>{W(()=>{Object.entries(s).forEach(([n,c])=>{const d=n;if(xe(c)){const{formError:l,fieldErrors:o}=Ee(c);for(const h of Object.keys(this.fieldInfo))this.getFieldMeta(h)&&this.setFieldMeta(h,m=>({...m,errorMap:{...m.errorMap,[d]:o==null?void 0:o[h]},errorSourceMap:{...m.errorSourceMap,[d]:"form"}}));this.baseStore.setState(h=>({...h,errorMap:{...h.errorMap,[d]:l}}))}else this.baseStore.setState(l=>({...l,errorMap:{...l.errorMap,[d]:c}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((s,[n,c])=>(Object.keys(c).length&&c.errors.length&&(s[n]={errors:c.errors,errorMap:c.errorMap}),s),{})}),this.parseValuesWithSchema=s=>ae.validate({value:this.state.values,validationSource:"form"},s),this.parseValuesWithSchemaAsync=s=>ae.validateAsync({value:this.state.values,validationSource:"form"},s),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=(t==null?void 0:t.formId)??ct(),this._devtoolsSubmissionOverride=!1;let i=Te({...t==null?void 0:t.defaultState,values:(t==null?void 0:t.defaultValues)??((f=t==null?void 0:t.defaultState)==null?void 0:f.values)});if(t!=null&&t.transform){i=t.transform({state:i}).state;for(const s of Object.keys(i.errorMap)){const n=i.errorMap[s];if(!(n===void 0||!xe(n)))for(const c of Object.keys(n.fields)){const d=n.fields[c];if(d===void 0)continue;const l=i.fieldMetaBase[c];i.fieldMetaBase[c]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,...l??{},errorSourceMap:{...(l==null?void 0:l.errorSourceMap)??{},onChange:"form"},errorMap:{...(l==null?void 0:l.errorMap)??{},[s]:d}}}}}this.baseStore=we(i);let r;this.fieldMetaDerived=we(s=>{var l,o,h;const n=this.baseStore.get();let c=0;const d={};for(const a of Object.keys(n.fieldMetaBase)){const m=n.fieldMetaBase[a],v=r==null?void 0:r.fieldMetaBase[a],M=s==null?void 0:s[a],b=be(n.values,a);let F=M==null?void 0:M.errors;if(!v||m.errorMap!==v.errorMap){F=Object.values(m.errorMap??{}).filter(A=>A!==void 0);const k=(l=this.getFieldInfo(a))==null?void 0:l.instance;(!k||!k.options.disableErrorFlat)&&(F=F.flat(1))}const p=!ns(F),E=!m.isDirty,w=Y(b,be(this.options.defaultValues,a))||Y(b,(h=(o=this.getFieldInfo(a))==null?void 0:o.instance)==null?void 0:h.options.defaultValue);if(M&&M.isPristine===E&&M.isValid===p&&M.isDefaultValue===w&&M.errors===F&&m===v){d[a]=M,c++;continue}d[a]={...m,errors:F??[],isPristine:E,isValid:p,isDefaultValue:w}}return Object.keys(n.fieldMetaBase).length?s&&c===Object.keys(n.fieldMetaBase).length?s:(r=this.baseStore.get(),d):d});let u;this.store=we(s=>{var L,y;const n=this.baseStore.get(),c=this.fieldMetaDerived.get(),d=Object.values(c).filter(Boolean),l=d.some(x=>x.isValidating),o=d.every(x=>x.isValid),h=d.some(x=>x.isTouched),a=d.some(x=>x.isBlurred),m=d.every(x=>x.isDefaultValue),v=h&&((L=n.errorMap)==null?void 0:L.onMount),M=d.some(x=>x.isDirty),b=!M,F=!!((y=n.errorMap)!=null&&y.onMount||d.some(x=>{var I;return(I=x==null?void 0:x.errorMap)==null?void 0:I.onMount})),p=!!l;let E=(s==null?void 0:s.errors)??[];(!u||n.errorMap!==u.errorMap)&&(E=Object.values(n.errorMap).reduce((x,I)=>I===void 0?x:I&&xe(I)?(x.push(I.form),x):(x.push(I),x),[]));const w=E.length===0,k=o&&w,A=this.options.canSubmitWhenInvalid??!1,O=n.submissionAttempts===0&&!h&&!F||!p&&!n.isSubmitting&&k||A;let C=n.errorMap;if(v&&(E=E.filter(x=>x!==n.errorMap.onMount),C=Object.assign(C,{onMount:void 0})),s&&u&&s.errorMap===C&&s.fieldMeta===this.fieldMetaDerived.state&&s.errors===E&&s.isFieldsValidating===l&&s.isFieldsValid===o&&s.isFormValid===w&&s.isValid===k&&s.canSubmit===O&&s.isTouched===h&&s.isBlurred===a&&s.isPristine===b&&s.isDefaultValue===m&&s.isDirty===M&&Y(u,n))return s;const B={...n,errorMap:C,fieldMeta:this.fieldMetaDerived.state,errors:E,isFieldsValidating:l,isFieldsValid:o,isFormValid:w,isValid:k,canSubmit:O,isTouched:h,isBlurred:a,isPristine:b,isDefaultValue:m,isDirty:M};return u=this.baseStore.get(),B}),this.handleSubmit=this.handleSubmit.bind(this),this.update(t||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(t){return ht(t.validate)?ae[t.type](t.value,t.validate):t.validate(t.value)}handleSubmit(t){return this._handleSubmit(t)}}function Ee(e){if(e){if(xe(e)){const t=Ee(e.form).formError,i=e.fields;return{formError:t,fieldErrors:i}}return{formError:e}}return{formError:void 0}}function de(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class it{constructor(t){this.options={},this.mount=()=>{var u,f;this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const i=this.getInfo();i.instance=this,this.update(this.options);const{onMount:r}=this.options.validators||{};if(r){const s=this.runValidator({validate:r,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});s&&this.setMeta(n=>({...n,errorMap:{...n==null?void 0:n.errorMap,onMount:s},errorSourceMap:{...n==null?void 0:n.errorSourceMap,onMount:"field"}}))}return(f=(u=this.options.listeners)==null?void 0:u.onMount)==null||f.call(u,{value:this.state.value,fieldApi:this}),()=>{var n,c,d,l;for(const[o,h]of Object.entries(this.timeoutIds.validations))h&&(clearTimeout(h),this.timeoutIds.validations[o]=null);for(const[o,h]of Object.entries(this.timeoutIds.listeners))h&&(clearTimeout(h),this.timeoutIds.listeners[o]=null);for(const[o,h]of Object.entries(this.timeoutIds.formListeners))h&&(clearTimeout(h),this.timeoutIds.formListeners[o]=null);const s=this.form.fieldInfo[this.name];if(s&&s.instance===this){for(const[o,h]of Object.entries(s.validationMetaMap))h==null||h.lastAbortController.abort(),s.validationMetaMap[o]=void 0;this.form.baseStore.setState(o=>{var h,a,m;return{...o,fieldMetaBase:{...o.fieldMetaBase,[this.name]:{...z,isTouched:((h=o.fieldMetaBase[this.name])==null?void 0:h.isTouched)??z.isTouched,isBlurred:((a=o.fieldMetaBase[this.name])==null?void 0:a.isBlurred)??z.isBlurred,isDirty:((m=o.fieldMetaBase[this.name])==null?void 0:m.isDirty)??z.isDirty}}}}),s.instance=null,(c=(n=this.options.listeners)==null?void 0:n.onUnmount)==null||c.call(n,{value:this.state.value,fieldApi:this}),(l=(d=this.form.options.listeners)==null?void 0:d.onFieldUnmount)==null||l.call(d,{formApi:this.form,fieldApi:this})}}},this.update=i=>{if(this.options=i,this.name=i.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const r=this.form.getFieldValue(this.name);Y(r,i.defaultValue)||this.form.setFieldValue(this.name,i.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(i,r)=>{this.form.setFieldValue(this.name,i,N(r,{dontRunListeners:!0,dontValidate:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener(),r!=null&&r.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=i=>this.form.setFieldMeta(this.name,i),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(i,r)=>{this.form.pushFieldValue(this.name,i,N(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(i,r,u)=>{this.form.insertFieldValue(this.name,i,r,N(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(i,r,u)=>{this.form.replaceFieldValue(this.name,i,r,N(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(i,r)=>{this.form.removeFieldValue(this.name,i,N(r,{dontRunListeners:!0})),r!=null&&r.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(i,r,u)=>{this.form.swapFieldValues(this.name,i,r,N(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(i,r,u)=>{this.form.moveFieldValues(this.name,i,r,N(u,{dontRunListeners:!0})),u!=null&&u.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=i=>{this.form.clearFieldValues(this.name,N(i,{dontRunListeners:!0})),i!=null&&i.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=i=>{const r=Object.values(this.form.fieldInfo),u=[];for(const f of r){if(!f.instance)continue;const{onChangeListenTo:s,onBlurListenTo:n}=f.instance.options.validators||{};i==="change"&&(s!=null&&s.includes(this.name))&&u.push(f.instance),i==="blur"&&(n!=null&&n.includes(this.name))&&u.push(f.instance)}return u},this.validateSync=(i,r)=>{var d;const u=Re(i,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||ie}),s=this.getLinkedFields(i).reduce((l,o)=>{const h=Re(i,{...o.options,form:o.form,fieldName:o.name,validationLogic:o.form.options.validationLogic||ie});return h.forEach(a=>{a.field=o}),l.concat(h)},[]);let n=!1;W(()=>{const l=(o,h)=>{var F;const a=Fe(h.cause),m=h.validate?nt(o.runValidator({validate:h.validate,value:{value:o.store.state.value,validationSource:"field",fieldApi:o},type:"validate"})):void 0,v=r[a],{newErrorValue:M,newSource:b}=et({formLevelError:v,fieldLevelError:m});((F=o.state.meta.errorMap)==null?void 0:F[a])!==M&&o.setMeta(p=>({...p,errorMap:{...p.errorMap,[a]:M},errorSourceMap:{...p.errorSourceMap,[a]:b}})),M&&(n=!0)};for(const o of u)l(this,o);for(const o of s)o.validate&&l(o.field,o)});const c=Fe("submit");return(d=this.state.meta.errorMap)!=null&&d[c]&&i!=="submit"&&!n&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,[c]:void 0},errorSourceMap:{...l.errorSourceMap,[c]:void 0}})),{hasErrored:n}},this.validateAsync=async(i,r)=>{const u=De(i,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||ie}),f=await r,s=this.getLinkedFields(i),n=s.reduce((a,m)=>{const v=De(i,{...m.options,form:m.form,fieldName:m.name,validationLogic:m.form.options.validationLogic||ie});return v.forEach(M=>{M.field=m}),a.concat(v)},[]),c=[],d=[],l=u.some(a=>a.validate)||n.some(a=>a.validate);if(l){this.state.meta.isValidating||this.setMeta(a=>({...a,isValidating:!0}));for(const a of s)a.setMeta(m=>({...m,isValidating:!0}))}const o=(a,m,v)=>{const M=Fe(m.cause),b=a.getInfo(),F=b.validationMetaMap[M];F==null||F.lastAbortController.abort();const p=new AbortController;b.validationMetaMap[M]={lastAbortController:p},v.push(new Promise(async E=>{var B;let w;try{w=await new Promise((L,y)=>{a.timeoutIds.validations[m.cause]&&clearTimeout(a.timeoutIds.validations[m.cause]),a.timeoutIds.validations[m.cause]=setTimeout(async()=>{if(p.signal.aborted)return L(void 0);try{L(await this.runValidator({validate:m.validate,value:{value:a.store.state.value,fieldApi:a,signal:p.signal,validationSource:"field"},type:"validateAsync"}))}catch(x){y(x)}},m.debounceMs)})}catch(L){w=L}if(p.signal.aborted)return E(void 0);const k=nt(w),A=(B=f[a.name])==null?void 0:B[M],{newErrorValue:O,newSource:C}=et({formLevelError:A,fieldLevelError:k});if(a.getInfo().instance!==a)return E(void 0);a.setMeta(L=>({...L,errorMap:{...L==null?void 0:L.errorMap,[M]:O},errorSourceMap:{...L.errorSourceMap,[M]:C}})),E(O)}))};for(const a of u)a.validate&&o(this,a,c);for(const a of n)a.validate&&o(a.field,a,d);let h=[];if((c.length||d.length)&&(h=await Promise.all(c),await Promise.all(d)),l){this.setMeta(a=>({...a,isValidating:!1}));for(const a of s)a.setMeta(m=>({...m,isValidating:!1}))}return h.filter(Boolean)},this.validate=(i,r)=>{var n;if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:u}=r!=null&&r.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(i),{hasErrored:f}=this.validateSync(i,u[this.name]??{});if(f&&!this.options.asyncAlways)return(n=this.getInfo().validationMetaMap[Fe(i)])==null||n.lastAbortController.abort(),this.state.meta.errors;const s=r!=null&&r.skipFormValidation?Promise.resolve({}):this.form.validateAsync(i);return this.validateAsync(i,s)},this.handleChange=i=>{this.setValue(i)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(r=>({...r,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(r=>({...r,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=i=>{this.setMeta(r=>({...r,errorMap:{...r.errorMap,...i}}))},this.parseValueWithSchema=i=>ae.validate({value:this.state.value,validationSource:"field"},i),this.parseValueWithSchemaAsync=i=>ae.validateAsync({value:this.state.value,validationSource:"field"},i),this.triggerOnChangeListener=()=>{var u,f,s,n,c,d;const i=(u=this.form.options.listeners)==null?void 0:u.onChangeDebounceMs;i&&i>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{var l,o;(o=(l=this.form.options.listeners)==null?void 0:l.onChange)==null||o.call(l,{formApi:this.form,fieldApi:this})},i)):(s=(f=this.form.options.listeners)==null?void 0:f.onChange)==null||s.call(f,{formApi:this.form,fieldApi:this});const r=(n=this.options.listeners)==null?void 0:n.onChangeDebounceMs;r&&r>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{var l,o;(o=(l=this.options.listeners)==null?void 0:l.onChange)==null||o.call(l,{value:this.state.value,fieldApi:this})},r)):(d=(c=this.options.listeners)==null?void 0:c.onChange)==null||d.call(c,{value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=we(i=>{this.form.store.get();const r=this.form.getFieldMeta(this.name)??{...z,...t.defaultMeta};let u=this.form.getFieldValue(this.name);return!r.isTouched&&u===void 0&&this.options.defaultValue!==void 0&&!Y(u,this.options.defaultValue)&&(u=this.options.defaultValue),i&&i.value===u&&i.meta===r?i:{value:u,meta:r}})}get state(){return this.store.state}runValidator(t){return ht(t.validate)?ae[t.type](t.value,t.validate):t.validate(t.value)}triggerOnBlurListener(){var r,u,f,s,n,c;const t=(r=this.form.options.listeners)==null?void 0:r.onBlurDebounceMs;t&&t>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{var d,l;(l=(d=this.form.options.listeners)==null?void 0:d.onBlur)==null||l.call(d,{formApi:this.form,fieldApi:this})},t)):(f=(u=this.form.options.listeners)==null?void 0:u.onBlur)==null||f.call(u,{formApi:this.form,fieldApi:this});const i=(s=this.options.listeners)==null?void 0:s.onBlurDebounceMs;i&&i>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{var d,l;(l=(d=this.options.listeners)==null?void 0:d.onBlur)==null||l.call(d,{value:this.state.value,fieldApi:this})},i)):(c=(n=this.options.listeners)==null?void 0:n.onBlur)==null||c.call(n,{value:this.state.value,fieldApi:this})}}function nt(e){if(e)return e}function Fe(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}function os(e,t){if(!t)return;const i=Object.assign({},e,{state:ce(e.state)});t(i),i.fieldInfo!==e.fieldInfo&&(e.fieldInfo=i.fieldInfo),i.options!==e.options&&(e.options=i.options);const u=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((f,s)=>(e.state[s]!==i.state[s]&&(f[s]=i.state[s]),f),{});return W(()=>{Object.keys(u).length&&e.baseStore.setState(f=>({...f,...u})),i.state.errorMap!==e.state.errorMap&&e.setErrorMap(i.state.errorMap)}),i}const ne=typeof window<"u"?V.useLayoutEffect:V.useEffect;function ls(e){const[t,i]=V.useState(()=>({form:e.form,name:e.name})),[r,u]=V.useState(()=>new it({...e}));(t.form!==e.form||t.name!==e.name)&&(u(new it({...e})),i({form:e.form,name:e.name}));const f=Q(r.store,e.mode==="array"?a=>Object.keys(a.value??[]).length:a=>a.value),s=Q(r.store,a=>a.meta.isTouched),n=Q(r.store,a=>a.meta.isBlurred),c=Q(r.store,a=>a.meta.isDirty),d=Q(r.store,a=>a.meta.errorMap),l=Q(r.store,a=>a.meta.errorSourceMap),o=Q(r.store,a=>a.meta.isValidating),h=V.useMemo(()=>{const m={...r,get state(){return{value:e.mode==="array"?r.state.value:f,get meta(){return{...r.state.meta,isTouched:s,isBlurred:n,isDirty:c,errorMap:d,errorSourceMap:l,isValidating:o}}}}};return m.Field=ft,m},[r,e.mode,f,s,n,c,d,l,o]);return ne(r.mount,[r]),ne(()=>{r.update(e)}),h}const ft=(({children:e,...t})=>{const i=ls(t),r=V.useMemo(()=>je(e,i),[e,i]);return g.jsx(g.Fragment,{children:r})});function us(){return V.useState(()=>ct())[0]}const ds=pt,cs=V.version.split(".")[0]==="17"?us:ds.useId;function hs({form:e,selector:t=r=>r,children:i}){const r=Q(e.store,t);return g.jsx(g.Fragment,{children:je(i,r)})}function fs(e){const t=cs(),[i,r]=V.useState(e==null?void 0:e.formId),[u,f]=V.useState(()=>new st({...e,formId:(e==null?void 0:e.formId)??t}));if(i!==(e==null?void 0:e.formId)){const c=(e==null?void 0:e.formId)??t;f(new st({...e,formId:c})),r(c)}const s=V.useMemo(()=>{const c={...u,handleSubmit:((...d)=>u._handleSubmit(...d)),get formId(){return u._formId},get state(){return u.store.state}};return c.Field=function(l){return g.jsx(ft,{...l,form:u})},c.Subscribe=function(l){return g.jsx(hs,{form:u,selector:l.selector,children:l.children})},c},[u]);ne(u.mount,[]),ne(()=>{u.update(e)});const n=V.useRef(!1);return ne(()=>{n.current&&e!=null&&e.transform&&os(u,e.transform)},[u,e==null?void 0:e.transform]),ne(()=>{n.current=!0}),s}function ms(e){const{open:t,defaultOpen:i,onOpenChange:r,disabled:u}=e,f=t!==void 0,[s,n]=Ot({controlled:t,default:i,name:"Collapsible",state:"open"}),{mounted:c,setMounted:d,transitionStatus:l}=Pt(s,!0,!0),[o,h]=V.useState(s),[{height:a,width:m},v]=V.useState({height:void 0,width:void 0}),M=Bt(),[b,F]=V.useState(),p=b??M,[E,w]=V.useState(!1),[k,A]=V.useState(!1),O=V.useRef(null),C=V.useRef(null),B=V.useRef(null),L=V.useRef(null),y=Rt(L,!1),x=Ne(I=>{const j=!s,T=ut(Dt,I.nativeEvent);if(r(j,T),T.isCanceled)return;const K=L.current;C.current==="css-animation"&&K!=null&&K.style.removeProperty("animation-name"),!E&&!k&&(C.current!=null&&C.current!=="css-animation"&&!c&&j&&d(!0),C.current==="css-animation"&&(!o&&j&&h(!0),!c&&j&&d(!0))),n(j),C.current==="none"&&c&&!j&&d(!1)});return Z(()=>{f&&C.current==="none"&&!s&&d(!1)},[f,s,t,d]),V.useMemo(()=>({abortControllerRef:O,animationTypeRef:C,disabled:u,handleTrigger:x,height:a,mounted:c,open:s,panelId:p,panelRef:L,runOnceAnimationsFinish:y,setDimensions:v,setHiddenUntilFound:w,setKeepMounted:A,setMounted:d,setOpen:n,setPanelIdState:F,setVisible:h,transitionDimensionRef:B,transitionStatus:l,visible:o,width:m}),[O,C,u,x,a,c,s,p,L,y,v,w,A,d,n,h,B,l,o,m])}const mt=V.createContext(void 0);function gt(){const e=V.useContext(mt);if(e===void 0)throw new Error(yt(15));return e}let he=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Je.startingStyle]="startingStyle",e[e.endingStyle=Je.endingStyle]="endingStyle",e})({}),gs=(function(e){return e.panelOpen="data-panel-open",e})({});const vs={[he.open]:""},bs={[he.closed]:""},ps={open(e){return e?{[gs.panelOpen]:""}:null}},ys={open(e){return e?vs:bs}},vt={...ys,...dt},Ms=V.forwardRef(function(t,i){const{render:r,className:u,defaultOpen:f=!1,disabled:s=!1,onOpenChange:n,open:c,style:d,...l}=t,o=Ne(n),h=ms({open:c,defaultOpen:f,onOpenChange:o,disabled:s}),a=V.useMemo(()=>({open:h.open,disabled:h.disabled,transitionStatus:h.transitionStatus}),[h.open,h.disabled,h.transitionStatus]),m=V.useMemo(()=>({...h,onOpenChange:o,state:a}),[h,o,a]),v=_e("div",t,{state:a,ref:i,props:l,stateAttributesMapping:vt});return g.jsx(mt.Provider,{value:m,children:v})}),Ss={...ps,...dt},Fs=V.forwardRef(function(t,i){const{panelId:r,open:u,handleTrigger:f,state:s,disabled:n}=gt(),{className:c,disabled:d=n,id:l,render:o,nativeButton:h=!0,style:a,...m}=t,{getButtonProps:v,buttonRef:M}=Mt({disabled:d,focusableWhenDisabled:!0,native:h}),b=V.useMemo(()=>({"aria-controls":u?r:void 0,"aria-expanded":u,onClick:f}),[r,u,f]);return _e("button",t,{state:s,ref:[i,M],props:[b,m,v],stateAttributesMapping:Ss})});let ws=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e})({});function xs(e){const{abortControllerRef:t,animationTypeRef:i,externalRef:r,height:u,hiddenUntilFound:f,keepMounted:s,id:n,mounted:c,onOpenChange:d,open:l,panelRef:o,runOnceAnimationsFinish:h,setDimensions:a,setMounted:m,setOpen:v,setVisible:M,transitionDimensionRef:b,visible:F,width:p}=e,E=V.useRef(!1),w=V.useRef(null),k=V.useRef(l),A=V.useRef(l),O=Nt(),C=V.useMemo(()=>i.current==="css-animation"?!F:!l&&!c,[l,c,F,i]),B=Ne(y=>{if(!y)return;if(i.current==null||b.current==null){const j=getComputedStyle(y),T=j.animationName!=="none"&&j.animationName!=="",K=j.transitionDuration!=="0s"&&j.transitionDuration!=="";T&&K||(j.animationName==="none"&&j.transitionDuration!=="0s"?i.current="css-transition":j.animationName!=="none"&&j.transitionDuration==="0s"?i.current="css-animation":i.current="none"),y.getAttribute(ws.orientation)==="horizontal"||j.transitionProperty.indexOf("width")>-1?b.current="width":b.current="height"}if(i.current!=="css-transition")return;(u===void 0||p===void 0)&&(a({height:y.scrollHeight,width:y.scrollWidth}),A.current&&y.style.setProperty("transition-duration","0s"));let x=-1,I=-1;return x=$.request(()=>{A.current=!1,I=$.request(()=>{setTimeout(()=>{y.style.removeProperty("transition-duration")})})}),()=>{$.cancel(x),$.cancel(I)}}),L=St(r,o,B);return Z(()=>{if(i.current!=="css-transition")return;const y=o.current;if(!y)return;let x=-1;if(t.current!=null&&(t.current.abort(),t.current=null),l){const I={"justify-content":y.style.justifyContent,"align-items":y.style.alignItems,"align-content":y.style.alignContent,"justify-items":y.style.justifyItems};Object.keys(I).forEach(j=>{y.style.setProperty(j,"initial","important")}),!A.current&&!s&&y.setAttribute(he.startingStyle,""),a({height:y.scrollHeight,width:y.scrollWidth}),x=$.request(()=>{Object.entries(I).forEach(([j,T])=>{T===""?y.style.removeProperty(j):y.style.setProperty(j,T)})})}else{if(y.scrollHeight===0&&y.scrollWidth===0)return;a({height:y.scrollHeight,width:y.scrollWidth});const I=new AbortController;t.current=I;const j=I.signal;let T=null;const K=he.endingStyle;return T=new MutationObserver(Le=>{Le.some(Ce=>Ce.type==="attributes"&&Ce.attributeName===K)&&(T==null||T.disconnect(),T=null,h(()=>{a({height:0,width:0}),y.style.removeProperty("content-visibility"),m(!1),t.current===I&&(t.current=null)},j))}),T.observe(y,{attributes:!0,attributeFilter:[K]}),()=>{T==null||T.disconnect(),O.cancel(),t.current===I&&(I.abort(),t.current=null)}}return()=>{$.cancel(x)}},[t,i,O,f,s,c,l,o,h,a,m]),Z(()=>{if(i.current!=="css-animation")return;const y=o.current;y&&(w.current=y.style.animationName||w.current,y.style.setProperty("animation-name","none"),a({height:y.scrollHeight,width:y.scrollWidth}),!k.current&&!E.current&&y.style.removeProperty("animation-name"),l?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),M(!0)):(t.current=new AbortController,h(()=>{m(!1),M(!1),t.current=null},t.current.signal)))},[t,i,l,o,h,a,m,M,F]),Ft(()=>{const y=$.request(()=>{k.current=!1});return()=>$.cancel(y)}),Z(()=>{if(!f)return;const y=o.current;if(!y)return;let x=-1,I=-1;return l&&E.current&&(y.style.transitionDuration="0s",a({height:y.scrollHeight,width:y.scrollWidth}),x=$.request(()=>{E.current=!1,I=$.request(()=>{setTimeout(()=>{y.style.removeProperty("transition-duration")})})})),()=>{$.cancel(x),$.cancel(I)}},[f,l,o,a]),Z(()=>{const y=o.current;y&&f&&C&&(y.setAttribute("hidden","until-found"),i.current==="css-transition"&&y.setAttribute(he.startingStyle,""))},[f,C,i,o]),V.useEffect(function(){const x=o.current;if(!x)return;function I(j){E.current=!0,v(!0),d(!0,ut($t,j))}return _t(x,"beforematch",I)},[d,o,v]),V.useMemo(()=>({props:{hidden:C,id:n,ref:L}}),[C,n,L])}let at=(function(e){return e.collapsiblePanelHeight="--collapsible-panel-height",e.collapsiblePanelWidth="--collapsible-panel-width",e})({});const Vs=V.forwardRef(function(t,i){const{className:r,hiddenUntilFound:u,keepMounted:f,render:s,id:n,style:c,...d}=t,{abortControllerRef:l,animationTypeRef:o,height:h,mounted:a,onOpenChange:m,open:v,panelId:M,panelRef:b,runOnceAnimationsFinish:F,setDimensions:p,setHiddenUntilFound:E,setKeepMounted:w,setMounted:k,setPanelIdState:A,setOpen:O,setVisible:C,state:B,transitionDimensionRef:L,visible:y,width:x,transitionStatus:I}=gt(),j=u??!1,T=f??!1;Z(()=>{if(n)return A(n),()=>{A(void 0)}},[n,A]),Z(()=>{E(j)},[E,j]),Z(()=>{w(T)},[w,T]);const{props:K}=xs({abortControllerRef:l,animationTypeRef:o,externalRef:i,height:h,hiddenUntilFound:j,id:M,keepMounted:T,mounted:a,onOpenChange:m,open:v,panelRef:b,runOnceAnimationsFinish:F,setDimensions:p,setMounted:k,setOpen:O,setVisible:C,transitionDimensionRef:L,visible:y,width:x});Ut({open:v&&I==="idle",ref:b,onComplete(){v&&p({height:void 0,width:void 0})}});const Le=V.useMemo(()=>({...B,transitionStatus:I}),[B,I]),Ue=_e("div",t,{state:Le,ref:[i,b],props:[K,{style:{[at.collapsiblePanelHeight]:h===void 0?"auto":`${h}px`,[at.collapsiblePanelWidth]:x===void 0?"auto":`${x}px`}},d],stateAttributesMapping:vt});return T||j||a?Ue:null});function Es({...e}){return g.jsx(Ms,{"data-slot":"collapsible",...e})}function As({...e}){return g.jsx(Fs,{"data-slot":"collapsible-trigger",...e})}function Is({...e}){return g.jsx(Vs,{"data-slot":"collapsible-content",...e})}function js({className:e,...t}){return g.jsx("label",{"data-slot":"label",className:ue("flex items-center gap-2 text-xs/relaxed leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}function Ls({className:e,...t}){return g.jsx("div",{"data-slot":"field-group",className:ue("group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",e),...t})}const Cs=wt("group/field flex w-full gap-2 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 ks({className:e,orientation:t="vertical",...i}){return g.jsx("fieldset",{"data-slot":"field","data-orientation":t,className:ue(Cs({orientation:t}),e),...i})}function Ts({className:e,...t}){return g.jsx(js,{"data-slot":"field-label",className:ue("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-2 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function Os({className:e,children:t,errors:i,...r}){const u=V.useMemo(()=>{var s;if(t)return t;if(!(i!=null&&i.length))return null;const f=[...new Map(i.map(n=>[n==null?void 0:n.message,n])).values()];return(f==null?void 0:f.length)===1?(s=f[0])==null?void 0:s.message:g.jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:f.map(n=>(n==null?void 0:n.message)&&g.jsx("li",{children:n.message},n.message))})},[t,i]);return u?g.jsx("div",{role:"alert","data-slot":"field-error",className:ue("text-xs/relaxed font-normal text-destructive",e),...r,children:u}):null}function Ps({className:e,...t}){return g.jsx("textarea",{"data-slot":"textarea",className:ue("flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}function Bs(e){const t=xt(),{data:i=[],isLoading:r}=He(o=>o.from({m:Pe}).where(({m:h})=>Vt(h.id,e)),[e]),u=i[0]??null,{data:f=[]}=He(o=>o.from({p:Et}),[]),s=()=>{Pe.update(e,o=>{o.needsReview=!1})},n=async o=>{try{return await It(e,o),await qe.invalidateQueries({queryKey:["memories"]}),!0}catch{return Ge.error("Failed to add project — try again"),!1}},c=async o=>{try{await At(e,o),await qe.invalidateQueries({queryKey:["memories"]})}catch{Ge.error("Failed to remove project — try again")}},d=()=>void t({to:"/memories"}),l=f.filter(o=>!(u!=null&&u.projects.some(h=>h.id===o.id)));return{memory:u,isLoading:r,availableProjects:l,handleApprove:s,handleAddProject:n,handleRemoveProject:c,handleClose:d}}const Rs=Ct({content:Ye().min(1,"Content is required."),type:kt(lt),tagsInput:Ye()});function Oe({field:e,label:t,description:i,children:r}){const u=e.state.meta.isTouched&&!e.state.meta.isValid;return g.jsxs(ks,{"data-invalid":u,children:[g.jsx(Ts,{htmlFor:e.name,className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:t}),r,i,u&&g.jsx(Os,{errors:e.state.meta.errors})]})}function Ds({memory:e,availableProjects:t,handleApprove:i,handleAddProject:r,handleRemoveProject:u,handleClose:f}){const[s,n]=V.useState(!1),[c,d]=V.useState("");V.useEffect(()=>{if(!s)return;const a=setTimeout(()=>n(!1),1500);return()=>clearTimeout(a)},[s]);const l=fs({defaultValues:{content:e.content,type:e.type,tagsInput:e.tags.join(", ")},validators:{onSubmit:Rs},onSubmit:({value:a})=>{const m=a.tagsInput.split(",").map(v=>v.trim()).filter(Boolean);Pe.update(e.id,v=>{a.content!==e.content&&(v.content=a.content),a.type!==e.type&&(v.type=a.type),JSON.stringify(m)!==JSON.stringify(e.tags)&&(v.tags=m)}),n(!0)}}),o=qt({shouldBlockFn:()=>l.state.isDirty,withResolver:!0}),h=async()=>{if(!c)return;await r(c)&&d("")};return g.jsxs("div",{className:"flex flex-col h-full",children:[g.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(ve,{variant:e.type,children:e.type}),e.needsReview&&g.jsx(ve,{variant:"destructive",title:"Flagged for review — possible duplicate or conflict with another memory",children:"needs review"}),e.pinned&&g.jsx(ve,{variant:"default",children:"pinned"})]}),g.jsx(se,{variant:"ghost",size:"icon-sm",onClick:f,"aria-label":"Close",children:g.jsx(Qe,{weight:"regular"})})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[g.jsxs(Ls,{children:[g.jsx(l.Field,{name:"content",children:a=>g.jsx(Oe,{field:a,label:"Content",children:g.jsx(Ps,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:m=>a.handleChange(m.target.value),rows:8,className:"min-h-32 font-[var(--font-heading)] text-sm","aria-invalid":a.state.meta.isTouched&&!a.state.meta.isValid})})}),g.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[g.jsx(l.Field,{name:"type",children:a=>g.jsx(Oe,{field:a,label:"Type",description:g.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:Lt[a.state.value]}),children:g.jsx(Xe,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:m=>a.handleChange(m.target.value),className:"w-full",children:lt.map(m=>g.jsx(ke,{value:m,children:jt(m)},m))})})}),g.jsx(l.Field,{name:"tagsInput",children:a=>g.jsx(Oe,{field:a,label:"Tags",children:g.jsx(Wt,{id:a.name,name:a.name,value:a.state.value,onBlur:a.handleBlur,onChange:m=>a.handleChange(m.target.value),placeholder:"tag1, tag2","aria-invalid":a.state.meta.isTouched&&!a.state.meta.isValid})})})]})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Projects"}),g.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.projects.length===0&&g.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Global (no project)"}),e.projects.map(a=>g.jsxs(ve,{variant:"secondary",className:"gap-1 rounded-full text-[11px]",children:[a.name,g.jsx("button",{type:"button",onClick:()=>void u(a.id),className:"hover:text-destructive transition-colors leading-none","aria-label":`Remove from ${a.name}`,children:g.jsx(Qe,{weight:"regular",className:"size-2.5"})})]},a.id))]}),t.length>0&&g.jsxs("div",{className:"flex gap-1",children:[g.jsxs(Xe,{value:c,onChange:a=>d(a.target.value),size:"sm",className:"flex-1",children:[g.jsx(ke,{value:"",children:"Add to project…"}),t.map(a=>g.jsx(ke,{value:a.id,children:a.name},a.id))]}),g.jsx(se,{variant:"outline",size:"sm",disabled:!c,onClick:()=>void h(),children:"+"})]})]}),g.jsxs(Es,{className:"group pt-2 border-t border-border",children:[g.jsxs(As,{className:"flex items-center gap-1 cursor-pointer text-[11px] uppercase tracking-wide text-muted-foreground hover:text-foreground transition-colors select-none w-full",children:[g.jsx("span",{className:"transition-transform group-data-[open]:rotate-90",children:"›"}),"Details"]}),g.jsxs(Is,{className:"space-y-1 mt-2",children:[e.sourceHarness&&g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Source"}),g.jsx("span",{children:e.sourceHarness})]}),g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Accessed"}),g.jsxs("span",{children:[e.accessCount,"×"]})]}),g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Updated"}),g.jsx("span",{children:new Date(e.updatedAt).toLocaleString()})]}),g.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[g.jsx("span",{children:"Created"}),g.jsx("span",{children:new Date(e.createdAt).toLocaleString()})]})]})]})]}),g.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0",children:[o.status==="blocked"&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-xs text-destructive",children:"Unsaved changes"}),g.jsx(se,{variant:"ghost",size:"sm",onClick:()=>o.proceed(),children:"Discard"}),g.jsx(se,{variant:"outline",size:"sm",onClick:()=>o.reset(),children:"Keep editing"})]}),e.needsReview&&o.status!=="blocked"&&g.jsx(se,{variant:"outline",size:"sm",onClick:i,title:"Mark as reviewed — this memory was flagged as a possible duplicate or conflict",children:"Mark reviewed"}),g.jsx("div",{className:"flex-1"}),g.jsx(se,{variant:"default",size:"sm",disabled:!l.state.isDirty,onClick:()=>void l.handleSubmit(),children:s?"Saved":"Save"})]})]})}function Ns({id:e}){const{memory:t,isLoading:i,availableProjects:r,handleApprove:u,handleAddProject:f,handleRemoveProject:s,handleClose:n}=Bs(e);return i||!t?g.jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:i?"Loading…":"Memory not found"}):g.jsx(Ds,{memory:t,availableProjects:r,handleApprove:u,handleAddProject:f,handleRemoveProject:s,handleClose:n},t.id)}function Ws(){const{id:e}=Tt.useParams();return g.jsx(Ns,{id:e},e)}export{Ws as component};
@@ -1 +1 @@
1
- import{j as e}from"./index-D_ebWYgx.js";import{f as t}from"./MagnifyingGlass.es-BZ4bp5Mi.js";function o(){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-center px-8",children:[e.jsx(t,{weight:"regular",className:"size-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a memory to view or edit"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Press"," ",e.jsx("kbd",{className:"font-mono px-1 py-0.5 rounded border border-border text-[10px]",children:"/"})," to search"]})]})}export{o as component};
1
+ import{j as e}from"./index-O2KJf81b.js";import{f as t}from"./MagnifyingGlass.es-B8P_LfEH.js";function o(){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-center px-8",children:[e.jsx(t,{weight:"regular",className:"size-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a memory to view or edit"}),e.jsxs("p",{className:"text-[10px] text-muted-foreground/60",children:["Press"," ",e.jsx("kbd",{className:"font-mono px-1 py-0.5 rounded border border-border text-[10px]",children:"/"})," to search"]})]})}export{o as component};
@@ -0,0 +1 @@
1
+ var ne=Object.defineProperty;var re=(e,t,n)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var p=(e,t,n)=>re(e,typeof t!="symbol"?t+"":t,n);import{E as k,d as j,Z as ae,h as se,Y as ie,r as a,e as E,l as A,k as le,B as oe,N as v,x as ue,t as ce,n as de,j as x,H as M}from"./index-O2KJf81b.js";const fe="none",je="trigger-press",Ze="trigger-hover",Be="outside-press",He="close-press",ze="focus-out",$e="escape-key",Ke="imperative-action";function me(e,t,n,i){let s=!1,r=!1;const o=k;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){r=!0},get isCanceled(){return s},get isPropagationAllowed(){return r},trigger:n,...o}}function Ye(e,t,n,i){return e.addEventListener(t,n,i),()=>{e.removeEventListener(t,n,i)}}const R=null;class ve{constructor(){p(this,"callbacks",[]);p(this,"callbacksCount",0);p(this,"nextId",1);p(this,"startId",1);p(this,"isScheduled",!1);p(this,"tick",t=>{var s;this.isScheduled=!1;const n=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let r=0;r<n.length;r+=1)(s=n[r])==null||s.call(n,t)})}request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const T=new ve;class g{constructor(){p(this,"currentId",R);p(this,"cancel",()=>{this.currentId!==R&&(T.cancel(this.currentId),this.currentId=R)});p(this,"disposeEffect",()=>this.cancel)}static create(){return new g}static request(t){return T.request(t)}static cancel(t){return T.cancel(t)}request(t){this.cancel(),this.currentId=T.request(()=>{this.currentId=R,t()})}}function pe(){const e=j(g.create).current;return ae(e.disposeEffect),e}function ge(e){return(e==null?void 0:e.ownerDocument)||document}function he(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function Ge(e,t){var i;if(!e||!t)return!1;const n=(i=t.getRootNode)==null?void 0:i.call(t);if(e.contains(t))return!0;if(n&&se(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Je(e){return"composedPath"in e?e.composedPath()[0]:e.target}const be={...ie};let _=0;function Ee(e,t="mui"){const[n,i]=a.useState(e),s=e||n;return a.useEffect(()=>{n==null&&(_+=1,i(`${t}-${_}`))},[n,t]),s}const q=be.useId;function Ie(e,t){if(q!==void 0){const n=q();return e??(t?`${t}-${n}`:n)}return Ee(e,t)}function xe(e){return e==null?e:"current"in e?e.current:e}function We(e,t=!1,n=!1){const[i,s]=a.useState(e&&t?"idle":void 0),[r,o]=a.useState(e);return e&&!r&&(o(!0),s("starting")),!e&&r&&i!=="ending"&&!n&&s("ending"),!e&&!r&&i==="ending"&&s(void 0),E(()=>{if(!e&&r&&i!=="ending"&&n){const l=g.request(()=>{s("ending")});return()=>{g.cancel(l)}}},[e,r,i,n]),E(()=>{if(!e||t)return;const l=g.request(()=>{s(void 0)});return()=>{g.cancel(l)}},[t,e]),E(()=>{if(!e||!t)return;e&&r&&i!=="idle"&&s("starting");const l=g.request(()=>{s("idle")});return()=>{g.cancel(l)}},[t,e,r,i]),{mounted:r,setMounted:o,transitionStatus:i}}let N=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const ye={[N.startingStyle]:""},Ce={[N.endingStyle]:""},Qe={transitionStatus(e){return e==="starting"?ye:e==="ending"?Ce:null}};function we(e,t=!1,n=!0){const i=pe();return A((s,r=null)=>{i.cancel();const o=xe(e);if(o==null)return;const l=o,c=()=>{le.flushSync(s)};if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){s();return}function d(){Promise.all(l.getAnimations().map(f=>f.finished)).then(()=>{r!=null&&r.aborted||c()}).catch(()=>{if(n){r!=null&&r.aborted||c();return}const f=l.getAnimations();!(r!=null&&r.aborted)&&f.length>0&&f.some(u=>u.pending||u.playState!=="finished")&&d()})}if(t){const f=N.startingStyle;if(!l.hasAttribute(f)){i.request(d);return}const u=new MutationObserver(()=>{l.hasAttribute(f)||(u.disconnect(),d())});u.observe(l,{attributes:!0,attributeFilter:[f]}),r==null||r.addEventListener("abort",()=>u.disconnect(),{once:!0});return}i.request(d)})}function Xe(e){const{enabled:t=!0,open:n,ref:i,onComplete:s}=e,r=A(s),o=we(i,n,!1);a.useEffect(()=>{if(!t)return;const l=new AbortController;return o(r,l.signal),()=>{l.abort()}},[t,n,r,o])}function Se(e){return Ie(e,"base-ui")}const Re=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),a.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),Z=a.forwardRef((e,t)=>a.createElement(oe,{ref:t,...e,weights:Re}));Z.displayName="CaretDownIcon";const Te=Z;let U=(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})({});const Ae={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},y={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Fe={disabled:!1,...y},ke={valid(e){return e===null?null:e?{[U.valid]:""}:{[U.invalid]:""}}},Me=a.createContext({invalid:void 0,name:void 0,validityData:{state:Ae,errors:[],error:"",value:"",initialValue:null},setValidityData:v,disabled:void 0,touched:y.touched,setTouched:v,dirty:y.dirty,setDirty:v,filled:y.filled,setFilled:v,focused:y.focused,setFocused:v,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Fe,markedDirtyRef:{current:!1},registerFieldControl:v,validation:{getValidationProps:(e=k)=>e,getInputValidationProps:(e=k)=>e,inputRef:{current:null},commit:async()=>{}}});function B(e=!0){const t=a.useContext(Me);if(t.setValidityData===v&&!e)throw new Error(ue(28));return t}const Ne=a.createContext({controlId:void 0,registerControlId:v,labelId:void 0,setLabelId:v,messageIds:[],setMessageIds:v,getDescriptionProps:e=>e});function H(){return a.useContext(Ne)}function Pe(e={}){const{id:t,implicit:n=!1,controlRef:i}=e,{controlId:s,registerControlId:r}=H(),o=Se(t),l=n?s:void 0,c=j(()=>Symbol("labelable-control")),d=a.useRef(!1),f=a.useRef(t!=null),u=A(()=>{!d.current||r===v||(d.current=!1,r(c.current,void 0))});return E(()=>{if(r===v)return;let b;if(n){const C=i==null?void 0:i.current;ce(C)&&C.closest("label")!=null?b=t??null:b=l??o}else if(t!=null)f.current=!0,b=t;else if(f.current)b=o;else{u();return}if(b===void 0){u();return}d.current=!0,r(c.current,b)},[t,i,l,r,n,o,c,u]),a.useEffect(()=>u,[u]),s??o}function Le({controlled:e,default:t,name:n,state:i="value"}){const{current:s}=a.useRef(e!==void 0),[r,o]=a.useState(t),l=s?e:r,c=a.useCallback(d=>{s||o(d)},[]);return[l,c]}function De(e,t){const{enabled:n=!0,getValue:i,id:s,value:r}=t,{registerFieldControl:o}=B(),l=a.useRef(null);l.current||(l.current=Symbol()),E(()=>{const c=l.current;if(!(!c||!n))return o(c,{controlRef:e,getValue:i,id:s,value:r}),()=>{o(c,void 0)}},[e,n,i,s,o,r])}const Oe=a.forwardRef(function(t,n){const{render:i,className:s,id:r,name:o,value:l,disabled:c=!1,onValueChange:d,defaultValue:f,autoFocus:u=!1,style:b,...C}=t,{state:z,name:$,disabled:K,setTouched:P,setDirty:Y,validityData:G,setFocused:w,setFilled:S,validationMode:J,validation:h}=B(),L=K||c,W=$??o,Q={...z,disabled:L},{labelId:X}=H(),D=Pe({id:r});E(()=>{var I;const m=l!=null;(I=h.inputRef.current)!=null&&I.value||m&&l!==""?S(!0):m&&l===""&&S(!1)},[h.inputRef,S,l]);const F=a.useRef(null);E(()=>{u&&F.current===he(ge(F.current))&&w(!0)},[u,w]);const[ee]=Le({controlled:l,default:f,name:"FieldControl",state:"value"}),O=l!==void 0,V=O?ee:void 0,te=A(()=>{var m;return(m=h.inputRef.current)==null?void 0:m.value});return De(h.inputRef,{id:D,value:V,getValue:te}),de("input",t,{ref:[n,F],state:Q,props:[{id:D,disabled:L,name:W,ref:h.inputRef,"aria-labelledby":X,autoFocus:u,...O?{value:V}:{defaultValue:f},onChange(m){const I=m.currentTarget.value;d==null||d(I,me(fe,m.nativeEvent)),Y(I!==G.initialValue),S(I!=="")},onFocus(){w(!0)},onBlur(m){P(!0),w(!1),J==="onBlur"&&h.commit(m.currentTarget.value)},onKeyDown(m){m.currentTarget.tagName==="INPUT"&&m.key==="Enter"&&(P(!0),h.commit(m.currentTarget.value))}},h.getInputValidationProps(),C],stateAttributesMapping:ke})}),Ve=a.forwardRef(function(t,n){return x.jsx(Oe,{ref:n,...t})});function et({className:e,type:t,...n}){return x.jsx(Ve,{type:t,"data-slot":"input",className:M("h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}function tt({className:e,size:t="default",...n}){return x.jsxs("div",{className:M("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),"data-slot":"native-select-wrapper","data-size":t,children:[x.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-7 w-full min-w-0 appearance-none rounded-md border border-input bg-input/20 py-0.5 pr-6 pl-2 text-xs/relaxed transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=sm]:h-6 data-[size=sm]:text-[0.625rem] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...n}),x.jsx(Te,{className:"pointer-events-none absolute top-1/2 right-1.5 size-3.5 -translate-y-1/2 text-muted-foreground select-none group-data-[size=sm]/native-select:size-3","aria-hidden":"true","data-slot":"native-select-icon"})]})}function nt({className:e,...t}){return x.jsx("option",{"data-slot":"native-select-option",className:M("bg-[Canvas] text-[CanvasText]",e),...t})}export{g as A,et as I,tt as N,N as T,he as a,Ye as b,Ge as c,me as d,pe as e,ze as f,Be as g,Je as h,$e as i,je as j,We as k,Xe as l,Qe as m,He as n,ge as o,Ke as p,Se as q,xe as r,nt as s,Ze as t,Ie as u,Le as v,we as w,fe as x};
@@ -12,7 +12,7 @@
12
12
  document.documentElement.classList.add(theme);
13
13
  })();
14
14
  </script>
15
- <script type="module" crossorigin src="/assets/index-D_ebWYgx.js"></script>
15
+ <script type="module" crossorigin src="/assets/index-O2KJf81b.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="/assets/index-CMSfmat6.css">
17
17
  </head>
18
18
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@membank/dashboard",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,6 +31,7 @@
31
31
  "@tanstack/query-core": "^5.100.6",
32
32
  "@tanstack/query-db-collection": "^1.0.36",
33
33
  "@tanstack/react-db": "^0.1.83",
34
+ "@tanstack/react-form": "^1.29.1",
34
35
  "@tanstack/react-hotkeys": "^0.10.0",
35
36
  "@tanstack/react-router": "^1.168.25",
36
37
  "@tanstack/router-plugin": "^1.167.28",
@@ -1 +0,0 @@
1
- import{a as le,r as a,l as $,e as _,x as ce,n as Q,j as e,J as de,o as ue,V as pe,H as ne,M as fe,O as Y,P as W,W as me,Q as he,X as ge,Y as J,Z as G,_ as xe,D as z,C as D,$ as X,S as ve,G as ye,F as be,a0 as je}from"./index-D_ebWYgx.js";import{v as we,k as Ce,q as Se,w as Re,d as se,j as Ne,T as Z,m as re,e as Pe,A as B,b as ke,x as Me,l as Fe,N as ee,s as K,I as Oe}from"./native-select-Dno9-QLw.js";function Be(t,n){if(t===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if("shouldBlockFn"in t)return t;if(typeof t=="function")return{shouldBlockFn:async()=>await t(),enableBeforeUnload:!0,withResolver:!1};const o=!!(t.condition??!0),S=t.blockerFn;return{shouldBlockFn:async()=>o&&S!==void 0?await S():o,enableBeforeUnload:o,withResolver:S===void 0}}function Ie(t,n){const{shouldBlockFn:o,enableBeforeUnload:S=!0,disabled:r=!1,withResolver:h=!1}=Be(t),u=le(),{history:v}=u,[y,g]=a.useState({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return a.useEffect(()=>{const f=async i=>{function c(x){const R=u.parseLocation(x),k=u.getMatchedRoutes(R.pathname);return k.foundRoute===void 0?{routeId:"__notFound__",fullPath:R.pathname,pathname:R.pathname,params:k.routeParams,search:u.options.parseSearch(x.search)}:{routeId:k.foundRoute.id,fullPath:k.foundRoute.fullPath,pathname:R.pathname,params:k.routeParams,search:u.options.parseSearch(x.search)}}const d=c(i.currentLocation),m=c(i.nextLocation);if(d.routeId==="__notFound__"&&m.routeId!=="__notFound__")return!1;const w=await o({action:i.action,current:d,next:m});if(!h)return w;if(!w)return!1;const F=await new Promise(x=>{g({status:"blocked",current:d,next:m,action:i.action,proceed:()=>x(!1),reset:()=>x(!0)})});return g({status:"idle",current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),F};return r?void 0:v.block({blockerFn:f,enableBeforeUnload:S})},[o,S,r,h,v,u]),y}function Te(t){const{open:n,defaultOpen:o,onOpenChange:S,disabled:r}=t,h=n!==void 0,[u,v]=we({controlled:n,default:o,name:"Collapsible",state:"open"}),{mounted:y,setMounted:g,transitionStatus:f}=Ce(u,!0,!0),[i,c]=a.useState(u),[{height:d,width:m},w]=a.useState({height:void 0,width:void 0}),F=Se(),[x,R]=a.useState(),k=x??F,[l,I]=a.useState(!1),[E,O]=a.useState(!1),T=a.useRef(null),M=a.useRef(null),C=a.useRef(null),N=a.useRef(null),s=Re(N,!1),P=$(b=>{const p=!u,j=se(Ne,b.nativeEvent);if(S(p,j),j.isCanceled)return;const A=N.current;M.current==="css-animation"&&A!=null&&A.style.removeProperty("animation-name"),!l&&!E&&(M.current!=null&&M.current!=="css-animation"&&!y&&p&&g(!0),M.current==="css-animation"&&(!i&&p&&c(!0),!y&&p&&g(!0))),v(p),M.current==="none"&&y&&!p&&g(!1)});return _(()=>{h&&M.current==="none"&&!u&&g(!1)},[h,u,n,g]),a.useMemo(()=>({abortControllerRef:T,animationTypeRef:M,disabled:r,handleTrigger:P,height:d,mounted:y,open:u,panelId:k,panelRef:N,runOnceAnimationsFinish:s,setDimensions:w,setHiddenUntilFound:I,setKeepMounted:O,setMounted:g,setOpen:v,setPanelIdState:R,setVisible:c,transitionDimensionRef:C,transitionStatus:f,visible:i,width:m}),[T,M,r,P,d,y,u,k,N,s,w,I,O,g,v,c,C,f,i,m])}const ae=a.createContext(void 0);function oe(){const t=a.useContext(ae);if(t===void 0)throw new Error(ce(15));return t}let L=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=Z.startingStyle]="startingStyle",t[t.endingStyle=Z.endingStyle]="endingStyle",t})({}),Ae=(function(t){return t.panelOpen="data-panel-open",t})({});const Ee={[L.open]:""},_e={[L.closed]:""},De={open(t){return t?{[Ae.panelOpen]:""}:null}},Le={open(t){return t?Ee:_e}},ie={...Le,...re},ze=a.forwardRef(function(n,o){const{render:S,className:r,defaultOpen:h=!1,disabled:u=!1,onOpenChange:v,open:y,style:g,...f}=n,i=$(v),c=Te({open:y,defaultOpen:h,onOpenChange:i,disabled:u}),d=a.useMemo(()=>({open:c.open,disabled:c.disabled,transitionStatus:c.transitionStatus}),[c.open,c.disabled,c.transitionStatus]),m=a.useMemo(()=>({...c,onOpenChange:i,state:d}),[c,i,d]),w=Q("div",n,{state:d,ref:o,props:f,stateAttributesMapping:ie});return e.jsx(ae.Provider,{value:m,children:w})}),He={...De,...re},Ue=a.forwardRef(function(n,o){const{panelId:S,open:r,handleTrigger:h,state:u,disabled:v}=oe(),{className:y,disabled:g=v,id:f,render:i,nativeButton:c=!0,style:d,...m}=n,{getButtonProps:w,buttonRef:F}=de({disabled:g,focusableWhenDisabled:!0,native:c}),x=a.useMemo(()=>({"aria-controls":r?S:void 0,"aria-expanded":r,onClick:h}),[S,r,h]);return Q("button",n,{state:u,ref:[o,F],props:[x,m,w],stateAttributesMapping:He})});let qe=(function(t){return t.disabled="data-disabled",t.orientation="data-orientation",t})({});function We(t){const{abortControllerRef:n,animationTypeRef:o,externalRef:S,height:r,hiddenUntilFound:h,keepMounted:u,id:v,mounted:y,onOpenChange:g,open:f,panelRef:i,runOnceAnimationsFinish:c,setDimensions:d,setMounted:m,setOpen:w,setVisible:F,transitionDimensionRef:x,visible:R,width:k}=t,l=a.useRef(!1),I=a.useRef(null),E=a.useRef(f),O=a.useRef(f),T=Pe(),M=a.useMemo(()=>o.current==="css-animation"?!R:!f&&!y,[f,y,R,o]),C=$(s=>{if(!s)return;if(o.current==null||x.current==null){const p=getComputedStyle(s),j=p.animationName!=="none"&&p.animationName!=="",A=p.transitionDuration!=="0s"&&p.transitionDuration!=="";j&&A||(p.animationName==="none"&&p.transitionDuration!=="0s"?o.current="css-transition":p.animationName!=="none"&&p.transitionDuration==="0s"?o.current="css-animation":o.current="none"),s.getAttribute(qe.orientation)==="horizontal"||p.transitionProperty.indexOf("width")>-1?x.current="width":x.current="height"}if(o.current!=="css-transition")return;(r===void 0||k===void 0)&&(d({height:s.scrollHeight,width:s.scrollWidth}),O.current&&s.style.setProperty("transition-duration","0s"));let P=-1,b=-1;return P=B.request(()=>{O.current=!1,b=B.request(()=>{setTimeout(()=>{s.style.removeProperty("transition-duration")})})}),()=>{B.cancel(P),B.cancel(b)}}),N=ue(S,i,C);return _(()=>{if(o.current!=="css-transition")return;const s=i.current;if(!s)return;let P=-1;if(n.current!=null&&(n.current.abort(),n.current=null),f){const b={"justify-content":s.style.justifyContent,"align-items":s.style.alignItems,"align-content":s.style.alignContent,"justify-items":s.style.justifyItems};Object.keys(b).forEach(p=>{s.style.setProperty(p,"initial","important")}),!O.current&&!u&&s.setAttribute(L.startingStyle,""),d({height:s.scrollHeight,width:s.scrollWidth}),P=B.request(()=>{Object.entries(b).forEach(([p,j])=>{j===""?s.style.removeProperty(p):s.style.setProperty(p,j)})})}else{if(s.scrollHeight===0&&s.scrollWidth===0)return;d({height:s.scrollHeight,width:s.scrollWidth});const b=new AbortController;n.current=b;const p=b.signal;let j=null;const A=L.endingStyle;return j=new MutationObserver(U=>{U.some(q=>q.type==="attributes"&&q.attributeName===A)&&(j==null||j.disconnect(),j=null,c(()=>{d({height:0,width:0}),s.style.removeProperty("content-visibility"),m(!1),n.current===b&&(n.current=null)},p))}),j.observe(s,{attributes:!0,attributeFilter:[A]}),()=>{j==null||j.disconnect(),T.cancel(),n.current===b&&(b.abort(),n.current=null)}}return()=>{B.cancel(P)}},[n,o,T,h,u,y,f,i,c,d,m]),_(()=>{if(o.current!=="css-animation")return;const s=i.current;s&&(I.current=s.style.animationName||I.current,s.style.setProperty("animation-name","none"),d({height:s.scrollHeight,width:s.scrollWidth}),!E.current&&!l.current&&s.style.removeProperty("animation-name"),f?(n.current!=null&&(n.current.abort(),n.current=null),m(!0),F(!0)):(n.current=new AbortController,c(()=>{m(!1),F(!1),n.current=null},n.current.signal)))},[n,o,f,i,c,d,m,F,R]),pe(()=>{const s=B.request(()=>{E.current=!1});return()=>B.cancel(s)}),_(()=>{if(!h)return;const s=i.current;if(!s)return;let P=-1,b=-1;return f&&l.current&&(s.style.transitionDuration="0s",d({height:s.scrollHeight,width:s.scrollWidth}),P=B.request(()=>{l.current=!1,b=B.request(()=>{setTimeout(()=>{s.style.removeProperty("transition-duration")})})})),()=>{B.cancel(P),B.cancel(b)}},[h,f,i,d]),_(()=>{const s=i.current;s&&h&&M&&(s.setAttribute("hidden","until-found"),o.current==="css-transition"&&s.setAttribute(L.startingStyle,""))},[h,M,o,i]),a.useEffect(function(){const P=i.current;if(!P)return;function b(p){l.current=!0,w(!0),g(!0,se(Me,p))}return ke(P,"beforematch",b)},[g,i,w]),a.useMemo(()=>({props:{hidden:M,id:v,ref:N}}),[M,v,N])}let te=(function(t){return t.collapsiblePanelHeight="--collapsible-panel-height",t.collapsiblePanelWidth="--collapsible-panel-width",t})({});const Ke=a.forwardRef(function(n,o){const{className:S,hiddenUntilFound:r,keepMounted:h,render:u,id:v,style:y,...g}=n,{abortControllerRef:f,animationTypeRef:i,height:c,mounted:d,onOpenChange:m,open:w,panelId:F,panelRef:x,runOnceAnimationsFinish:R,setDimensions:k,setHiddenUntilFound:l,setKeepMounted:I,setMounted:E,setPanelIdState:O,setOpen:T,setVisible:M,state:C,transitionDimensionRef:N,visible:s,width:P,transitionStatus:b}=oe(),p=r??!1,j=h??!1;_(()=>{if(v)return O(v),()=>{O(void 0)}},[v,O]),_(()=>{l(p)},[l,p]),_(()=>{I(j)},[I,j]);const{props:A}=We({abortControllerRef:f,animationTypeRef:i,externalRef:o,height:c,hiddenUntilFound:p,id:F,keepMounted:j,mounted:d,onOpenChange:m,open:w,panelRef:x,runOnceAnimationsFinish:R,setDimensions:k,setMounted:E,setOpen:T,setVisible:M,transitionDimensionRef:N,visible:s,width:P});Fe({open:w&&b==="idle",ref:x,onComplete(){w&&k({height:void 0,width:void 0})}});const U=a.useMemo(()=>({...C,transitionStatus:b}),[C,b]),V=Q("div",n,{state:U,ref:[o,x],props:[A,{style:{[te.collapsiblePanelHeight]:c===void 0?"auto":`${c}px`,[te.collapsiblePanelWidth]:P===void 0?"auto":`${P}px`}},g],stateAttributesMapping:ie});return j||p||d?V:null});function $e({...t}){return e.jsx(ze,{"data-slot":"collapsible",...t})}function Qe({...t}){return e.jsx(Ue,{"data-slot":"collapsible-trigger",...t})}function Ve({...t}){return e.jsx(Ke,{"data-slot":"collapsible-content",...t})}function H({className:t,...n}){return e.jsx("label",{"data-slot":"label",className:ne("flex items-center gap-2 text-xs/relaxed 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",t),...n})}function Ye({className:t,...n}){return e.jsx("textarea",{"data-slot":"textarea",className:ne("flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-input/20 px-2 py-2 text-sm transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",t),...n})}function Je(t){const n=fe(),{data:o=[],isLoading:S}=Y(C=>C.from({m:W}).where(({m:N})=>me(N.id,t)),[t]),r=o[0]??null,{data:h=[]}=Y(C=>C.from({p:he}),[]),[u,v]=a.useState(""),[y,g]=a.useState("fact"),[f,i]=a.useState(""),[c,d]=a.useState(!1),[m,w]=a.useState(""),[F,x]=a.useState(!1);a.useEffect(()=>{r&&!c&&(v(r.content),g(r.type),i(r.tags.join(", ")),d(!0))},[r,c]);const R=r!==null&&(u!==r.content||y!==r.type||f!==r.tags.join(", ")),k=Ie({shouldBlockFn:()=>R,withResolver:!0}),l=()=>{if(!r||!R)return;const C=f.split(",").map(N=>N.trim()).filter(Boolean);W.update(t,N=>{u!==r.content&&(N.content=u),y!==r.type&&(N.type=y),JSON.stringify(C)!==JSON.stringify(r.tags)&&(N.tags=C)}),x(!0),setTimeout(()=>x(!1),1500)},I=()=>{W.update(t,C=>{C.needsReview=!1})},E=async()=>{if(m)try{await xe(t,m),await J.invalidateQueries({queryKey:["memories"]}),w("")}catch{G.error("Failed to add project — try again")}},O=async C=>{try{await ge(t,C),await J.invalidateQueries({queryKey:["memories"]})}catch{G.error("Failed to remove project — try again")}},T=()=>void n({to:"/memories"}),M=h.filter(C=>!(r!=null&&r.projects.some(N=>N.id===C.id)));return{memory:r,isLoading:S,content:u,setContent:v,type:y,setType:g,tagsInput:f,setTagsInput:i,addProjectId:m,setAddProjectId:w,saved:F,dirty:R,blocker:k,availableProjects:M,handleSave:l,handleApprove:I,handleAddProject:E,handleRemoveProject:O,handleClose:T}}function Ge({id:t}){const{memory:n,isLoading:o,content:S,setContent:r,type:h,setType:u,tagsInput:v,setTagsInput:y,addProjectId:g,setAddProjectId:f,saved:i,dirty:c,blocker:d,availableProjects:m,handleSave:w,handleApprove:F,handleAddProject:x,handleRemoveProject:R,handleClose:k}=Je(t);return o||!n?e.jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:o?"Loading…":"Memory not found"}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{variant:n.type,children:n.type}),n.needsReview&&e.jsx(z,{variant:"destructive",title:"Flagged for review — possible duplicate or conflict with another memory",children:"needs review"}),n.pinned&&e.jsx(z,{variant:"default",children:"pinned"})]}),e.jsx(D,{variant:"ghost",size:"icon-sm",onClick:k,"aria-label":"Close",children:e.jsx(X,{weight:"regular"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(H,{htmlFor:"memory-content",className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Content"}),e.jsx(Ye,{id:"memory-content",value:S,onChange:l=>r(l.target.value),rows:8,className:"min-h-32 font-[var(--font-heading)] text-sm"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(H,{htmlFor:"memory-type",className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Type"}),e.jsx(ee,{id:"memory-type",value:h,onChange:l=>u(l.target.value),className:"w-full",children:ve.map(l=>e.jsx(K,{value:l,children:ye(l)},l))}),e.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:be[h]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(H,{htmlFor:"memory-tags",className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Tags"}),e.jsx(Oe,{id:"memory-tags",value:v,onChange:l=>y(l.target.value),placeholder:"tag1, tag2"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(H,{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Projects"}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[n.projects.length===0&&e.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Global (no project)"}),n.projects.map(l=>e.jsxs(z,{variant:"secondary",className:"gap-1 rounded-full text-[11px]",children:[l.name,e.jsx("button",{type:"button",onClick:()=>void R(l.id),className:"hover:text-destructive transition-colors leading-none","aria-label":`Remove from ${l.name}`,children:e.jsx(X,{weight:"regular",className:"size-2.5"})})]},l.id))]}),m.length>0&&e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(ee,{value:g,onChange:l=>f(l.target.value),size:"sm",className:"flex-1",children:[e.jsx(K,{value:"",children:"Add to project…"}),m.map(l=>e.jsx(K,{value:l.id,children:l.name},l.id))]}),e.jsx(D,{variant:"outline",size:"sm",disabled:!g,onClick:()=>void x(),children:"+"})]})]}),e.jsxs($e,{className:"group pt-2 border-t border-border",children:[e.jsxs(Qe,{className:"flex items-center gap-1 cursor-pointer text-[11px] uppercase tracking-wide text-muted-foreground hover:text-foreground transition-colors select-none w-full",children:[e.jsx("span",{className:"transition-transform group-data-[open]:rotate-90",children:"›"}),"Details"]}),e.jsxs(Ve,{className:"space-y-1 mt-2",children:[n.sourceHarness&&e.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[e.jsx("span",{children:"Source"}),e.jsx("span",{children:n.sourceHarness})]}),e.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[e.jsx("span",{children:"Accessed"}),e.jsxs("span",{children:[n.accessCount,"×"]})]}),e.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[e.jsx("span",{children:"Updated"}),e.jsx("span",{children:new Date(n.updatedAt).toLocaleString()})]}),e.jsxs("div",{className:"flex justify-between text-[11px] text-muted-foreground",children:[e.jsx("span",{children:"Created"}),e.jsx("span",{children:new Date(n.createdAt).toLocaleString()})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-t border-border shrink-0",children:[d.status==="blocked"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xs text-destructive",children:"Unsaved changes"}),e.jsx(D,{variant:"ghost",size:"sm",onClick:()=>d.proceed(),children:"Discard"}),e.jsx(D,{variant:"outline",size:"sm",onClick:()=>d.reset(),children:"Keep editing"})]}),n.needsReview&&d.status!=="blocked"&&e.jsx(D,{variant:"outline",size:"sm",onClick:F,title:"Mark as reviewed — this memory was flagged as a possible duplicate or conflict",children:"Mark reviewed"}),e.jsx("div",{className:"flex-1"}),e.jsx(D,{variant:"default",size:"sm",onClick:w,disabled:!c,children:i?"Saved":"Save"})]})]})}function et(){const{id:t}=je.useParams();return e.jsx(Ge,{id:t},t)}export{et as component};
@@ -1 +0,0 @@
1
- var ne=Object.defineProperty;var re=(e,t,n)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var p=(e,t,n)=>re(e,typeof t!="symbol"?t+"":t,n);import{E as k,d as j,V as ae,h as se,a1 as ie,r as a,e as E,l as A,k as le,B as oe,N as v,x as ue,t as ce,n as de,j as x,H as M}from"./index-D_ebWYgx.js";const fe="none",je="trigger-press",Be="trigger-hover",Ze="outside-press",He="close-press",ze="focus-out",$e="escape-key",Ke="imperative-action";function me(e,t,n,i){let s=!1,r=!1;const o=k;return{reason:e,event:t??new Event("base-ui"),cancel(){s=!0},allowPropagation(){r=!0},get isCanceled(){return s},get isPropagationAllowed(){return r},trigger:n,...o}}function Ge(e,t,n,i){return e.addEventListener(t,n,i),()=>{e.removeEventListener(t,n,i)}}const R=null;class ve{constructor(){p(this,"callbacks",[]);p(this,"callbacksCount",0);p(this,"nextId",1);p(this,"startId",1);p(this,"isScheduled",!1);p(this,"tick",t=>{var s;this.isScheduled=!1;const n=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let r=0;r<n.length;r+=1)(s=n[r])==null||s.call(n,t)})}request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const T=new ve;class g{constructor(){p(this,"currentId",R);p(this,"cancel",()=>{this.currentId!==R&&(T.cancel(this.currentId),this.currentId=R)});p(this,"disposeEffect",()=>this.cancel)}static create(){return new g}static request(t){return T.request(t)}static cancel(t){return T.cancel(t)}request(t){this.cancel(),this.currentId=T.request(()=>{this.currentId=R,t()})}}function pe(){const e=j(g.create).current;return ae(e.disposeEffect),e}function ge(e){return(e==null?void 0:e.ownerDocument)||document}function he(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function Ye(e,t){var i;if(!e||!t)return!1;const n=(i=t.getRootNode)==null?void 0:i.call(t);if(e.contains(t))return!0;if(n&&se(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Je(e){return"composedPath"in e?e.composedPath()[0]:e.target}const be={...ie};let _=0;function Ee(e,t="mui"){const[n,i]=a.useState(e),s=e||n;return a.useEffect(()=>{n==null&&(_+=1,i(`${t}-${_}`))},[n,t]),s}const q=be.useId;function Ie(e,t){if(q!==void 0){const n=q();return e??(t?`${t}-${n}`:n)}return Ee(e,t)}function xe(e){return e==null?e:"current"in e?e.current:e}function We(e,t=!1,n=!1){const[i,s]=a.useState(e&&t?"idle":void 0),[r,o]=a.useState(e);return e&&!r&&(o(!0),s("starting")),!e&&r&&i!=="ending"&&!n&&s("ending"),!e&&!r&&i==="ending"&&s(void 0),E(()=>{if(!e&&r&&i!=="ending"&&n){const l=g.request(()=>{s("ending")});return()=>{g.cancel(l)}}},[e,r,i,n]),E(()=>{if(!e||t)return;const l=g.request(()=>{s(void 0)});return()=>{g.cancel(l)}},[t,e]),E(()=>{if(!e||!t)return;e&&r&&i!=="idle"&&s("starting");const l=g.request(()=>{s("idle")});return()=>{g.cancel(l)}},[t,e,r,i]),{mounted:r,setMounted:o,transitionStatus:i}}let N=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const ye={[N.startingStyle]:""},Ce={[N.endingStyle]:""},Qe={transitionStatus(e){return e==="starting"?ye:e==="ending"?Ce:null}};function we(e,t=!1,n=!0){const i=pe();return A((s,r=null)=>{i.cancel();const o=xe(e);if(o==null)return;const l=o,c=()=>{le.flushSync(s)};if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){s();return}function d(){Promise.all(l.getAnimations().map(f=>f.finished)).then(()=>{r!=null&&r.aborted||c()}).catch(()=>{if(n){r!=null&&r.aborted||c();return}const f=l.getAnimations();!(r!=null&&r.aborted)&&f.length>0&&f.some(u=>u.pending||u.playState!=="finished")&&d()})}if(t){const f=N.startingStyle;if(!l.hasAttribute(f)){i.request(d);return}const u=new MutationObserver(()=>{l.hasAttribute(f)||(u.disconnect(),d())});u.observe(l,{attributes:!0,attributeFilter:[f]}),r==null||r.addEventListener("abort",()=>u.disconnect(),{once:!0});return}i.request(d)})}function Xe(e){const{enabled:t=!0,open:n,ref:i,onComplete:s}=e,r=A(s),o=we(i,n,!1);a.useEffect(()=>{if(!t)return;const l=new AbortController;return o(r,l.signal),()=>{l.abort()}},[t,n,r,o])}function Se(e){return Ie(e,"base-ui")}const Re=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),a.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),B=a.forwardRef((e,t)=>a.createElement(oe,{ref:t,...e,weights:Re}));B.displayName="CaretDownIcon";const Te=B;let U=(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})({});const Ae={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},y={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Fe={disabled:!1,...y},ke={valid(e){return e===null?null:e?{[U.valid]:""}:{[U.invalid]:""}}},Me=a.createContext({invalid:void 0,name:void 0,validityData:{state:Ae,errors:[],error:"",value:"",initialValue:null},setValidityData:v,disabled:void 0,touched:y.touched,setTouched:v,dirty:y.dirty,setDirty:v,filled:y.filled,setFilled:v,focused:y.focused,setFocused:v,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Fe,markedDirtyRef:{current:!1},registerFieldControl:v,validation:{getValidationProps:(e=k)=>e,getInputValidationProps:(e=k)=>e,inputRef:{current:null},commit:async()=>{}}});function Z(e=!0){const t=a.useContext(Me);if(t.setValidityData===v&&!e)throw new Error(ue(28));return t}const Ne=a.createContext({controlId:void 0,registerControlId:v,labelId:void 0,setLabelId:v,messageIds:[],setMessageIds:v,getDescriptionProps:e=>e});function H(){return a.useContext(Ne)}function Pe(e={}){const{id:t,implicit:n=!1,controlRef:i}=e,{controlId:s,registerControlId:r}=H(),o=Se(t),l=n?s:void 0,c=j(()=>Symbol("labelable-control")),d=a.useRef(!1),f=a.useRef(t!=null),u=A(()=>{!d.current||r===v||(d.current=!1,r(c.current,void 0))});return E(()=>{if(r===v)return;let b;if(n){const C=i==null?void 0:i.current;ce(C)&&C.closest("label")!=null?b=t??null:b=l??o}else if(t!=null)f.current=!0,b=t;else if(f.current)b=o;else{u();return}if(b===void 0){u();return}d.current=!0,r(c.current,b)},[t,i,l,r,n,o,c,u]),a.useEffect(()=>u,[u]),s??o}function Le({controlled:e,default:t,name:n,state:i="value"}){const{current:s}=a.useRef(e!==void 0),[r,o]=a.useState(t),l=s?e:r,c=a.useCallback(d=>{s||o(d)},[]);return[l,c]}function De(e,t){const{enabled:n=!0,getValue:i,id:s,value:r}=t,{registerFieldControl:o}=Z(),l=a.useRef(null);l.current||(l.current=Symbol()),E(()=>{const c=l.current;if(!(!c||!n))return o(c,{controlRef:e,getValue:i,id:s,value:r}),()=>{o(c,void 0)}},[e,n,i,s,o,r])}const Ve=a.forwardRef(function(t,n){const{render:i,className:s,id:r,name:o,value:l,disabled:c=!1,onValueChange:d,defaultValue:f,autoFocus:u=!1,style:b,...C}=t,{state:z,name:$,disabled:K,setTouched:P,setDirty:G,validityData:Y,setFocused:w,setFilled:S,validationMode:J,validation:h}=Z(),L=K||c,W=$??o,Q={...z,disabled:L},{labelId:X}=H(),D=Pe({id:r});E(()=>{var I;const m=l!=null;(I=h.inputRef.current)!=null&&I.value||m&&l!==""?S(!0):m&&l===""&&S(!1)},[h.inputRef,S,l]);const F=a.useRef(null);E(()=>{u&&F.current===he(ge(F.current))&&w(!0)},[u,w]);const[ee]=Le({controlled:l,default:f,name:"FieldControl",state:"value"}),V=l!==void 0,O=V?ee:void 0,te=A(()=>{var m;return(m=h.inputRef.current)==null?void 0:m.value});return De(h.inputRef,{id:D,value:O,getValue:te}),de("input",t,{ref:[n,F],state:Q,props:[{id:D,disabled:L,name:W,ref:h.inputRef,"aria-labelledby":X,autoFocus:u,...V?{value:O}:{defaultValue:f},onChange(m){const I=m.currentTarget.value;d==null||d(I,me(fe,m.nativeEvent)),G(I!==Y.initialValue),S(I!=="")},onFocus(){w(!0)},onBlur(m){P(!0),w(!1),J==="onBlur"&&h.commit(m.currentTarget.value)},onKeyDown(m){m.currentTarget.tagName==="INPUT"&&m.key==="Enter"&&(P(!0),h.commit(m.currentTarget.value))}},h.getInputValidationProps(),C],stateAttributesMapping:ke})}),Oe=a.forwardRef(function(t,n){return x.jsx(Ve,{ref:n,...t})});function et({className:e,type:t,...n}){return x.jsx(Oe,{type:t,"data-slot":"input",className:M("h-7 w-full min-w-0 rounded-md border border-input bg-input/20 px-2 py-0.5 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-xs/relaxed file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 md:text-xs/relaxed dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...n})}function tt({className:e,size:t="default",...n}){return x.jsxs("div",{className:M("group/native-select relative w-fit has-[select:disabled]:opacity-50",e),"data-slot":"native-select-wrapper","data-size":t,children:[x.jsx("select",{"data-slot":"native-select","data-size":t,className:"h-7 w-full min-w-0 appearance-none rounded-md border border-input bg-input/20 py-0.5 pr-6 pl-2 text-xs/relaxed transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-2 aria-invalid:ring-destructive/20 data-[size=sm]:h-6 data-[size=sm]:text-[0.625rem] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",...n}),x.jsx(Te,{className:"pointer-events-none absolute top-1/2 right-1.5 size-3.5 -translate-y-1/2 text-muted-foreground select-none group-data-[size=sm]/native-select:size-3","aria-hidden":"true","data-slot":"native-select-icon"})]})}function nt({className:e,...t}){return x.jsx("option",{"data-slot":"native-select-option",className:M("bg-[Canvas] text-[CanvasText]",e),...t})}export{g as A,et as I,tt as N,N as T,he as a,Ge as b,Ye as c,me as d,pe as e,ze as f,Ze as g,Je as h,$e as i,je as j,We as k,Xe as l,Qe as m,He as n,ge as o,Ke as p,Se as q,xe as r,nt as s,Be as t,Ie as u,Le as v,we as w,fe as x};