@objectstack/account 7.2.0 → 7.2.1
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.
|
@@ -99,13 +99,13 @@ The cached manifest will be removed. The app will remain loaded in the running k
|
|
|
99
99
|
|
|
100
100
|
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=qa,s=!Ma.jitless,c=s&&Ja.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Cc([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Ec(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!lo(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>mo(e,r,Na())))}),t)}var Dc=N(`$ZodUnion`,(e,t)=>{Fs.init(e,t),Va(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Va(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Va(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Va(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Ra(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Ec(t,r,e,i)):Ec(o,r,e,i)}}),Oc=N(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Dc.init(e,t);let n=e._zod.parse;Va(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Ia(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!qa(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),kc=N(`$ZodIntersection`,(e,t)=>{Fs.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>jc(e,t,n)):jc(e,i,a)}});function Ac(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ya(e)&&Ya(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ac(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ac(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function jc(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),lo(e))return e;let o=Ac(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Mc=N(`$ZodTuple`,(e,t)=>{Fs.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Nc(n,`optin`),c=Nc(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>Pc(t,r,e))):Pc(a,r,e)}}return o.length?Promise.all(o).then(()=>Fc(l,r,n,a,c)):Fc(l,r,n,a,c)}});function Nc(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Pc(e,t,n){e.issues.length&&t.issues.push(...fo(n,e.issues)),t.value[n]=e.value}function Fc(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...fo(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Ic=N(`$ZodRecord`,(e,t)=>{Fs.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Ya(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>mo(e,r,Na())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...fo(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...fo(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&ds.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>mo(e,r,Na())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...fo(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...fo(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Lc=N(`$ZodEnum`,(e,t)=>{Fs.init(e,t);let n=Pa(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Za.has(typeof e)).map(e=>typeof e==`string`?Qa(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Rc=N(`$ZodLiteral`,(e,t)=>{if(Fs.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Qa(e):e?Qa(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),zc=N(`$ZodTransform`,(e,t)=>{Fs.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ja(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Aa;return n.value=i,n.fallback=!0,n}});function Bc(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Vc=N(`$ZodOptional`,(e,t)=>{Fs.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Va(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Va(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ra(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Bc(e,r)):Bc(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Hc=N(`$ZodExactOptional`,(e,t)=>{Vc.init(e,t),Va(e._zod,`values`,()=>t.innerType._zod.values),Va(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Uc=N(`$ZodNullable`,(e,t)=>{Fs.init(e,t),Va(e._zod,`optin`,()=>t.innerType._zod.optin),Va(e._zod,`optout`,()=>t.innerType._zod.optout),Va(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Ra(e.source)}|null)$`):void 0}),Va(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Wc=N(`$ZodDefault`,(e,t)=>{Fs.init(e,t),e._zod.optin=`optional`,Va(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Gc(e,t)):Gc(r,t)}});function Gc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Kc=N(`$ZodPrefault`,(e,t)=>{Fs.init(e,t),e._zod.optin=`optional`,Va(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),qc=N(`$ZodNonOptional`,(e,t)=>{Fs.init(e,t),Va(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Jc(t,e)):Jc(i,e)}});function Jc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Yc=N(`$ZodCatch`,(e,t)=>{Fs.init(e,t),e._zod.optin=`optional`,Va(e._zod,`optout`,()=>t.innerType._zod.optout),Va(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>mo(e,n,Na()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>mo(e,n,Na()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Xc=N(`$ZodPipe`,(e,t)=>{Fs.init(e,t),Va(e._zod,`values`,()=>t.in._zod.values),Va(e._zod,`optin`,()=>t.in._zod.optin),Va(e._zod,`optout`,()=>t.out._zod.optout),Va(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Zc(e,t.in,n)):Zc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Zc(e,t.out,n)):Zc(r,t.out,n)}});function Zc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Qc=N(`$ZodReadonly`,(e,t)=>{Fs.init(e,t),Va(e._zod,`propValues`,()=>t.innerType._zod.propValues),Va(e._zod,`values`,()=>t.innerType._zod.values),Va(e._zod,`optin`,()=>t.innerType?._zod?.optin),Va(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then($c):$c(r)}});function $c(e){return e.value=Object.freeze(e.value),e}var el=N(`$ZodFunction`,(e,t)=>(Fs.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?Co(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?Co(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await To(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await To(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new Mc({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),tl=N(`$ZodPromise`,(e,t)=>{Fs.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),nl=N(`$ZodLazy`,(e,t)=>{Fs.init(e,t),Va(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Va(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Va(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Va(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Va(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),rl=N(`$ZodCustom`,(e,t)=>{gs.init(e,t),Fs.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>il(t,n,r,e));il(i,n,r,e)}});function il(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(go(e))}}var al,ol=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function sl(){return new ol}(al=globalThis).__zod_globalRegistry??(al.__zod_globalRegistry=sl());var cl=globalThis.__zod_globalRegistry;function ll(e,t){return new e({type:`string`,...P(t)})}function ul(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...P(t)})}function dl(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...P(t)})}function fl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...P(t)})}function pl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...P(t)})}function ml(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...P(t)})}function hl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...P(t)})}function gl(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...P(t)})}function _l(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...P(t)})}function vl(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...P(t)})}function yl(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...P(t)})}function bl(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...P(t)})}function xl(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...P(t)})}function Sl(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...P(t)})}function Cl(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...P(t)})}function wl(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...P(t)})}function Tl(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...P(t)})}function El(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...P(t)})}function Dl(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...P(t)})}function Ol(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...P(t)})}function kl(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...P(t)})}function Al(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...P(t)})}function jl(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...P(t)})}function Ml(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...P(t)})}function Nl(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...P(t)})}function Pl(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...P(t)})}function Fl(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...P(t)})}function Il(e,t){return new e({type:`number`,checks:[],...P(t)})}function Ll(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...P(t)})}function Rl(e,t){return new e({type:`boolean`,...P(t)})}function zl(e,t){return new e({type:`null`,...P(t)})}function Bl(e){return new e({type:`any`})}function Vl(e){return new e({type:`unknown`})}function Hl(e,t){return new e({type:`never`,...P(t)})}function Ul(e,t){return new e({type:`void`,...P(t)})}function Wl(e,t){return new e({type:`date`,...P(t)})}function Gl(e,t){return new vs({check:`less_than`,...P(t),value:e,inclusive:!1})}function Kl(e,t){return new vs({check:`less_than`,...P(t),value:e,inclusive:!0})}function ql(e,t){return new ys({check:`greater_than`,...P(t),value:e,inclusive:!1})}function Jl(e,t){return new ys({check:`greater_than`,...P(t),value:e,inclusive:!0})}function Yl(e,t){return new bs({check:`multiple_of`,...P(t),value:e})}function Xl(e,t){return new Ss({check:`max_length`,...P(t),maximum:e})}function Zl(e,t){return new Cs({check:`min_length`,...P(t),minimum:e})}function Ql(e,t){return new ws({check:`length_equals`,...P(t),length:e})}function $l(e,t){return new Es({check:`string_format`,format:`regex`,...P(t),pattern:e})}function eu(e){return new Ds({check:`string_format`,format:`lowercase`,...P(e)})}function tu(e){return new Os({check:`string_format`,format:`uppercase`,...P(e)})}function nu(e,t){return new ks({check:`string_format`,format:`includes`,...P(t),includes:e})}function ru(e,t){return new As({check:`string_format`,format:`starts_with`,...P(t),prefix:e})}function iu(e,t){return new js({check:`string_format`,format:`ends_with`,...P(t),suffix:e})}function au(e){return new Ms({check:`overwrite`,tx:e})}function ou(e){return au(t=>t.normalize(e))}function su(){return au(e=>e.trim())}function cu(){return au(e=>e.toLowerCase())}function lu(){return au(e=>e.toUpperCase())}function uu(){return au(e=>Ga(e))}function du(e,t,n){return new e({type:`array`,element:t,...P(n)})}function fu(e,t,n){let r=P(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function pu(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...P(n)})}function mu(e,t){let n=hu(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(go(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(go(r))}},e(t.value,t)),t);return n}function hu(e,t){let n=new gs({check:`custom`,...P(t)});return n._zod.check=e,n}function gu(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??cl,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function _u(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,_u(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&bu(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function vu(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
101
101
|
|
|
102
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function yu(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Su(t,`input`,e.processors),output:Su(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function bu(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return bu(r.element,n);if(r.type===`set`)return bu(r.valueType,n);if(r.type===`lazy`)return bu(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return bu(r.innerType,n);if(r.type===`intersection`)return bu(r.left,n)||bu(r.right,n);if(r.type===`record`||r.type===`map`)return bu(r.keyType,n)||bu(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:bu(r.in,n)||bu(r.out,n);if(r.type===`object`){for(let e in r.shape)if(bu(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(bu(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(bu(e,n))return!0;return!!(r.rest&&bu(r.rest,n))}return!1}var xu=(e,t={})=>n=>{let r=gu({...n,processors:t});return _u(e,r),vu(r,e),yu(r,e)},Su=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=gu({...i??{},target:a,io:t,processors:n});return _u(e,o),vu(o,e),yu(o,e)},Cu={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},wu=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Cu[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Tu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Eu=(e,t,n,r)=>{n.type=`boolean`},Du=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ou=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},ku=(e,t,n,r)=>{n.not={}},Au=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},ju=(e,t,n,r)=>{let i=e._zod.def,a=Pa(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Mu=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Nu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Pu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Fu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Iu=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=_u(a.element,t,{...r,path:[...r.path,`items`]})},Lu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=_u(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=_u(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ru=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>_u(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},zu=(e,t,n,r)=>{let i=e._zod.def,a=_u(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=_u(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Bu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>_u(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?_u(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Vu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=_u(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=_u(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=_u(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Hu=(e,t,n,r)=>{let i=e._zod.def,a=_u(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Uu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Gu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ku=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},qu=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;_u(o,t,r);let s=t.seen.get(e);s.ref=o},Ju=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Yu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zu=(e,t,n,r)=>{let i=e._zod.innerType;_u(i,t,r);let a=t.seen.get(e);a.ref=i},Qu=N(`ZodISODateTime`,(e,t)=>{Ys.init(e,t),wd.init(e,t)});function $u(e){return Ml(Qu,e)}var ed=N(`ZodISODate`,(e,t)=>{Xs.init(e,t),wd.init(e,t)});function td(e){return Nl(ed,e)}var nd=N(`ZodISOTime`,(e,t)=>{Zs.init(e,t),wd.init(e,t)});function rd(e){return Pl(nd,e)}var id=N(`ZodISODuration`,(e,t)=>{Qs.init(e,t),wd.init(e,t)});function ad(e){return Fl(id,e)}var od=N(`ZodError`,(e,t)=>{vo.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>xo(e,t)},flatten:{value:t=>bo(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Fa,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Fa,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),sd=So(od),cd=wo(od),ld=Eo(od),ud=Oo(od),dd=Ao(od),fd=jo(od),pd=Mo(od),md=No(od),hd=Po(od),gd=Fo(od),_d=Io(od),vd=Lo(od),yd=new WeakMap;function bd(e,t,n){let r=Object.getPrototypeOf(e),i=yd.get(r);if(i||(i=new Set,yd.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var xd=N(`ZodType`,(e,t)=>(Fs.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Su(e,`input`),output:Su(e,`output`)}}),e.toJSONSchema=xu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>sd(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ld(e,t,n),e.parseAsync=async(t,n)=>cd(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ud(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>dd(e,t,n),e.decode=(t,n)=>fd(e,t,n),e.encodeAsync=async(t,n)=>pd(e,t,n),e.decodeAsync=async(t,n)=>md(e,t,n),e.safeEncode=(t,n)=>hd(e,t,n),e.safeDecode=(t,n)=>gd(e,t,n),e.safeEncodeAsync=async(t,n)=>_d(e,t,n),e.safeDecodeAsync=async(t,n)=>vd(e,t,n),bd(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ua(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $a(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Kf(e,t))},superRefine(e,t){return this.check(qf(e,t))},overwrite(e){return this.check(au(e))},optional(){return xf(this)},exactOptional(){return Cf(this)},nullable(){return Tf(this)},nullish(){return xf(Tf(this))},nonoptional(e){return jf(this,e)},array(){return z(this)},or(e){return V([this,e])},and(e){return ff(this,e)},transform(e){return Ff(this,yf(e))},default(e){return Df(this,e)},prefault(e){return kf(this,e)},catch(e){return Nf(this,e)},pipe(e){return Ff(this,e)},readonly(){return Lf(this)},describe(e){let t=this.clone();return cl.add(t,{description:e}),t},meta(...e){if(e.length===0)return cl.get(this);let t=this.clone();return cl.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return cl.get(e)?.description},configurable:!0}),e)),Sd=N(`_ZodString`,(e,t)=>{Is.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,bd(e,`_ZodString`,{regex(...e){return this.check($l(...e))},includes(...e){return this.check(nu(...e))},startsWith(...e){return this.check(ru(...e))},endsWith(...e){return this.check(iu(...e))},min(...e){return this.check(Zl(...e))},max(...e){return this.check(Xl(...e))},length(...e){return this.check(Ql(...e))},nonempty(...e){return this.check(Zl(1,...e))},lowercase(e){return this.check(eu(e))},uppercase(e){return this.check(tu(e))},trim(){return this.check(su())},normalize(...e){return this.check(ou(...e))},toLowerCase(){return this.check(cu())},toUpperCase(){return this.check(lu())},slugify(){return this.check(uu())}})}),Cd=N(`ZodString`,(e,t)=>{Is.init(e,t),Sd.init(e,t),e.email=t=>e.check(ul(Td,t)),e.url=t=>e.check(gl(Od,t)),e.jwt=t=>e.check(jl(Ud,t)),e.emoji=t=>e.check(_l(kd,t)),e.guid=t=>e.check(dl(Ed,t)),e.uuid=t=>e.check(fl(Dd,t)),e.uuidv4=t=>e.check(pl(Dd,t)),e.uuidv6=t=>e.check(ml(Dd,t)),e.uuidv7=t=>e.check(hl(Dd,t)),e.nanoid=t=>e.check(vl(Ad,t)),e.guid=t=>e.check(dl(Ed,t)),e.cuid=t=>e.check(yl(jd,t)),e.cuid2=t=>e.check(bl(Md,t)),e.ulid=t=>e.check(xl(Nd,t)),e.base64=t=>e.check(Ol(Bd,t)),e.base64url=t=>e.check(kl(Vd,t)),e.xid=t=>e.check(Sl(Pd,t)),e.ksuid=t=>e.check(Cl(Fd,t)),e.ipv4=t=>e.check(wl(Id,t)),e.ipv6=t=>e.check(Tl(Ld,t)),e.cidrv4=t=>e.check(El(Rd,t)),e.cidrv6=t=>e.check(Dl(zd,t)),e.e164=t=>e.check(Al(Hd,t)),e.datetime=t=>e.check($u(t)),e.date=t=>e.check(td(t)),e.time=t=>e.check(rd(t)),e.duration=t=>e.check(ad(t))});function F(e){return ll(Cd,e)}var wd=N(`ZodStringFormat`,(e,t)=>{Ls.init(e,t),Sd.init(e,t)}),Td=N(`ZodEmail`,(e,t)=>{Bs.init(e,t),wd.init(e,t)}),Ed=N(`ZodGUID`,(e,t)=>{Rs.init(e,t),wd.init(e,t)}),Dd=N(`ZodUUID`,(e,t)=>{zs.init(e,t),wd.init(e,t)}),Od=N(`ZodURL`,(e,t)=>{Vs.init(e,t),wd.init(e,t)}),kd=N(`ZodEmoji`,(e,t)=>{Hs.init(e,t),wd.init(e,t)}),Ad=N(`ZodNanoID`,(e,t)=>{Us.init(e,t),wd.init(e,t)}),jd=N(`ZodCUID`,(e,t)=>{Ws.init(e,t),wd.init(e,t)}),Md=N(`ZodCUID2`,(e,t)=>{Gs.init(e,t),wd.init(e,t)}),Nd=N(`ZodULID`,(e,t)=>{Ks.init(e,t),wd.init(e,t)}),Pd=N(`ZodXID`,(e,t)=>{qs.init(e,t),wd.init(e,t)}),Fd=N(`ZodKSUID`,(e,t)=>{Js.init(e,t),wd.init(e,t)}),Id=N(`ZodIPv4`,(e,t)=>{$s.init(e,t),wd.init(e,t)}),Ld=N(`ZodIPv6`,(e,t)=>{ec.init(e,t),wd.init(e,t)}),Rd=N(`ZodCIDRv4`,(e,t)=>{tc.init(e,t),wd.init(e,t)}),zd=N(`ZodCIDRv6`,(e,t)=>{nc.init(e,t),wd.init(e,t)}),Bd=N(`ZodBase64`,(e,t)=>{ic.init(e,t),wd.init(e,t)}),Vd=N(`ZodBase64URL`,(e,t)=>{oc.init(e,t),wd.init(e,t)}),Hd=N(`ZodE164`,(e,t)=>{sc.init(e,t),wd.init(e,t)}),Ud=N(`ZodJWT`,(e,t)=>{lc.init(e,t),wd.init(e,t)}),Wd=N(`ZodNumber`,(e,t)=>{uc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r),bd(e,`ZodNumber`,{gt(e,t){return this.check(ql(e,t))},gte(e,t){return this.check(Jl(e,t))},min(e,t){return this.check(Jl(e,t))},lt(e,t){return this.check(Gl(e,t))},lte(e,t){return this.check(Kl(e,t))},max(e,t){return this.check(Kl(e,t))},int(e){return this.check(Kd(e))},safe(e){return this.check(Kd(e))},positive(e){return this.check(ql(0,e))},nonnegative(e){return this.check(Jl(0,e))},negative(e){return this.check(Gl(0,e))},nonpositive(e){return this.check(Kl(0,e))},multipleOf(e,t){return this.check(Yl(e,t))},step(e,t){return this.check(Yl(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return Il(Wd,e)}var Gd=N(`ZodNumberFormat`,(e,t)=>{dc.init(e,t),Wd.init(e,t)});function Kd(e){return Ll(Gd,e)}var qd=N(`ZodBoolean`,(e,t)=>{fc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r)});function L(e){return Rl(qd,e)}var Jd=N(`ZodNull`,(e,t)=>{pc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r)});function Yd(e){return zl(Jd,e)}var Xd=N(`ZodAny`,(e,t)=>{mc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Zd(){return Bl(Xd)}var Qd=N(`ZodUnknown`,(e,t)=>{hc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function R(){return Vl(Qd)}var $d=N(`ZodNever`,(e,t)=>{gc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r)});function ef(e){return Hl($d,e)}var tf=N(`ZodVoid`,(e,t)=>{_c.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r)});function nf(e){return Ul(tf,e)}var rf=N(`ZodDate`,(e,t)=>{vc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Au(e,t,n,r),e.min=(t,n)=>e.check(Jl(t,n)),e.max=(t,n)=>e.check(Kl(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function af(e){return Wl(rf,e)}var of=N(`ZodArray`,(e,t)=>{bc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iu(e,t,n,r),e.element=t.element,bd(e,`ZodArray`,{min(e,t){return this.check(Zl(e,t))},nonempty(e){return this.check(Zl(1,e))},max(e,t){return this.check(Xl(e,t))},length(e,t){return this.check(Ql(e,t))},unwrap(){return this.element}})});function z(e,t){return du(of,e,t)}var sf=N(`ZodObject`,(e,t)=>{Tc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lu(e,t,n,r),Va(e,`shape`,()=>t.shape),bd(e,`ZodObject`,{keyof(){return U(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:R()})},loose(){return this.clone({...this._zod.def,catchall:R()})},strict(){return this.clone({...this._zod.def,catchall:ef()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return io(this,e)},safeExtend(e){return ao(this,e)},merge(e){return oo(this,e)},pick(e){return no(this,e)},omit(e){return ro(this,e)},partial(...e){return so(bf,this,e[0])},required(...e){return co(Af,this,e[0])}})});function B(e,t){return new sf({type:`object`,shape:e??{},...P(t)})}var cf=N(`ZodUnion`,(e,t)=>{Dc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ru(e,t,n,r),e.options=t.options});function V(e,t){return new cf({type:`union`,options:e,...P(t)})}var lf=N(`ZodDiscriminatedUnion`,(e,t)=>{cf.init(e,t),Oc.init(e,t)});function uf(e,t,n){return new lf({type:`union`,options:t,discriminator:e,...P(n)})}var df=N(`ZodIntersection`,(e,t)=>{kc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zu(e,t,n,r)});function ff(e,t){return new df({type:`intersection`,left:e,right:t})}var pf=N(`ZodTuple`,(e,t)=>{Mc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bu(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function mf(e,t,n){let r=t instanceof Fs;return new pf({type:`tuple`,items:e,rest:r?t:null,...P(r?n:t)})}var hf=N(`ZodRecord`,(e,t)=>{Ic.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vu(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function H(e,t,n){return!t||!t._zod?new hf({type:`record`,keyType:F(),valueType:e,...P(t)}):new hf({type:`record`,keyType:e,valueType:t,...P(n)})}var gf=N(`ZodEnum`,(e,t)=>{Lc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new gf({...t,checks:[],...P(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new gf({...t,checks:[],...P(r),entries:i})}});function U(e,t){return new gf({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...P(t)})}var _f=N(`ZodLiteral`,(e,t)=>{Rc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mu(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function W(e,t){return new _f({type:`literal`,values:Array.isArray(e)?e:[e],...P(t)})}var vf=N(`ZodTransform`,(e,t)=>{zc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ja(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(go(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(go(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function yf(e){return new vf({type:`transform`,transform:e})}var bf=N(`ZodOptional`,(e,t)=>{Vc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xf(e){return new bf({type:`optional`,innerType:e})}var Sf=N(`ZodExactOptional`,(e,t)=>{Hc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cf(e){return new Sf({type:`optional`,innerType:e})}var wf=N(`ZodNullable`,(e,t)=>{Uc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tf(e){return new wf({type:`nullable`,innerType:e})}var Ef=N(`ZodDefault`,(e,t)=>{Wc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Df(e,t){return new Ef({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xa(t)}})}var Of=N(`ZodPrefault`,(e,t)=>{Kc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kf(e,t){return new Of({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xa(t)}})}var Af=N(`ZodNonOptional`,(e,t)=>{qc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jf(e,t){return new Af({type:`nonoptional`,innerType:e,...P(t)})}var Mf=N(`ZodCatch`,(e,t)=>{Yc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Nf(e,t){return new Mf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Pf=N(`ZodPipe`,(e,t)=>{Xc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qu(e,t,n,r),e.in=t.in,e.out=t.out});function Ff(e,t){return new Pf({type:`pipe`,in:e,out:t})}var If=N(`ZodReadonly`,(e,t)=>{Qc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lf(e){return new If({type:`readonly`,innerType:e})}var Rf=N(`ZodLazy`,(e,t)=>{nl.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zu(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function zf(e){return new Rf({type:`lazy`,getter:e})}var Bf=N(`ZodPromise`,(e,t)=>{tl.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vf(e){return new Bf({type:`promise`,innerType:e})}var Hf=N(`ZodFunction`,(e,t)=>{el.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pu(e,t,n,r)});function Uf(e){return new Hf({type:`function`,input:Array.isArray(e?.input)?mf(e?.input):e?.input??z(R()),output:e?.output??R()})}var Wf=N(`ZodCustom`,(e,t)=>{rl.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nu(e,t,n,r)});function Gf(e,t){return fu(Wf,e??(()=>!0),t)}function Kf(e,t={}){return pu(Wf,e,t)}function qf(e,t){return mu(e,t)}var Jf=c(_(),1);function G(e){if(typeof process<`u`&&{}.OS_EAGER_SCHEMAS===`1`)return e();let t,n=()=>(t===void 0&&(t=e()),t);return new Proxy(function(){},{get(e,t){let r=n(),i=r[t];return typeof i==`function`?i.bind(r):i},set(e,t,r){let i=n();return i[t]=r,!0},has(e,t){return t in n()},ownKeys(){return Reflect.ownKeys(n())},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(n(),t)},getPrototypeOf(){return Reflect.getPrototypeOf(n())}})}var Yf=G(()=>B({$field:F().describe(`Field Reference/Column Name`)}));G(()=>B({$eq:Zd().optional(),$ne:Zd().optional()})),G(()=>B({$gt:V([I(),af(),Yf]).optional(),$gte:V([I(),af(),Yf]).optional(),$lt:V([I(),af(),Yf]).optional(),$lte:V([I(),af(),Yf]).optional()})),G(()=>B({$in:z(Zd()).optional(),$nin:z(Zd()).optional()})),G(()=>B({$between:mf([V([I(),af(),Yf]),V([I(),af(),Yf])]).optional()})),G(()=>B({$contains:F().optional(),$notContains:F().optional(),$startsWith:F().optional(),$endsWith:F().optional()})),G(()=>B({$null:L().optional(),$exists:L().optional()}));var Xf=G(()=>B({$eq:Zd().optional(),$ne:Zd().optional(),$gt:V([I(),af(),Yf]).optional(),$gte:V([I(),af(),Yf]).optional(),$lt:V([I(),af(),Yf]).optional(),$lte:V([I(),af(),Yf]).optional(),$in:z(Zd()).optional(),$nin:z(Zd()).optional(),$between:mf([V([I(),af(),Yf]),V([I(),af(),Yf])]).optional(),$contains:F().optional(),$notContains:F().optional(),$startsWith:F().optional(),$endsWith:F().optional(),$null:L().optional(),$exists:L().optional()})),Zf=zf(()=>H(F(),R()).and(B({$and:z(Zf).optional(),$or:z(Zf).optional(),$not:Zf.optional()})));G(()=>B({where:Zf.optional()}));var Qf=zf(()=>B({$and:z(V([H(F(),Xf),Qf])).optional(),$or:z(V([H(F(),Xf),Qf])).optional(),$not:V([H(F(),Xf),Qf]).optional()})),$f=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function ep(e){if(!Array.isArray(e)||e.length===0)return!1;let t=e[0];if(typeof t==`string`){let n=t.toLowerCase();if(n===`and`||n===`or`)return e.length>=2&&e.slice(1).every(e=>ep(e));if(e.length>=2&&typeof e[1]==`string`)return $f.has(e[1].toLowerCase())}return e.every(e=>ep(e))?e.length>0:!1}var tp=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],np=[`$and`,`$or`,`$not`];[...tp,...np];var rp=G(()=>B({field:F(),order:U([`asc`,`desc`]).default(`asc`)})),ip=U([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),ap=U([`day`,`week`,`month`,`quarter`,`year`]),op=G(()=>V([F(),B({field:F().describe(`Field to group by`),dateGranularity:ap.optional().describe(`Bucket date values into uniform periods (day/week/month/quarter/year)`),alias:F().optional().describe(`Alias for the projected group value`)})])),sp=G(()=>B({function:ip.describe(`Aggregation function`),field:F().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:F().describe(`Result column alias`),distinct:L().optional().describe(`Apply DISTINCT before aggregation`),filter:Zf.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)})),cp=U([`inner`,`left`,`right`,`full`]),lp=U([`auto`,`database`,`hash`,`loop`]),up=zf(()=>B({type:cp.describe(`Join type`),strategy:lp.optional().describe(`Execution strategy hint`),object:F().describe(`Object/table to join`),alias:F().optional().describe(`Table alias`),on:Zf.describe(`Join condition`),subquery:zf(()=>_p).optional().describe(`Subquery instead of object`)})),dp=U([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),fp=G(()=>B({partitionBy:z(F()).optional().describe(`PARTITION BY fields`),orderBy:z(rp).optional().describe(`ORDER BY specification`),frame:B({type:U([`rows`,`range`]).optional(),start:F().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:F().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)})),pp=G(()=>B({function:dp.describe(`Window function name`),field:F().optional().describe(`Field to operate on (for aggregate window functions)`),alias:F().describe(`Result column alias`),over:fp.describe(`Window specification (OVER clause)`)})),mp=zf(()=>V([F(),B({field:F(),fields:z(mp).optional(),alias:F().optional()})])),hp=G(()=>B({query:F().describe(`Search query text`),fields:z(F()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:L().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:U([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:H(F(),I()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:I().optional().describe(`Minimum relevance score threshold`),language:F().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:L().optional().default(!1).describe(`Enable search result highlighting`)})),gp=B({object:F().describe(`Object name (e.g. account)`),fields:z(mp).optional().describe(`Fields to retrieve`),where:Zf.optional().describe(`Filtering criteria (WHERE)`),search:hp.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:z(rp).optional().describe(`Sorting instructions (ORDER BY)`),limit:I().optional().describe(`Max records to return (LIMIT)`),offset:I().optional().describe(`Records to skip (OFFSET)`),top:I().optional().describe(`Alias for limit (OData compatibility)`),cursor:H(F(),R()).optional().describe(`Cursor for keyset pagination`),joins:z(up).optional().describe(`Explicit Table Joins`),aggregations:z(sp).optional().describe(`Aggregation functions`),groupBy:z(op).optional().describe("GROUP BY targets (strings or `{field, dateGranularity?}` objects for date bucketing)"),having:Zf.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:z(pp).optional().describe(`Window functions with OVER clause`),distinct:L().optional().describe(`SELECT DISTINCT flag`)}),_p=G(()=>gp.extend({expand:zf(()=>H(F(),_p)).optional().describe(`Recursive relation loading map. Keys are lookup/master_detail field names; values are nested QueryAST objects that control select, filter, sort, and further expansion on the related object. The engine resolves expand via batch $in queries (driver-agnostic) with a default max depth of 3.`)})),vp=[`today`,`yesterday`,`tomorrow`,`now`],yp=[`current_week_start`,`current_week_end`,`current_month_start`,`current_month_end`,`current_quarter_start`,`current_quarter_end`,`current_year_start`,`current_year_end`,`last_week_start`,`last_week_end`,`last_month_start`,`last_month_end`,`last_quarter_start`,`last_quarter_end`,`last_year_start`,`last_year_end`,`next_week_start`,`next_week_end`,`next_month_start`,`next_month_end`,`next_quarter_start`,`next_quarter_end`,`next_year_start`,`next_year_end`],bp=[`week_start`,`week_end`,`month_start`,`month_end`,`quarter_start`,`quarter_end`,`year_start`,`year_end`],xp=[...vp,...yp,...bp],Sp=/^(\d+)_(minutes?|hours?|days?|weeks?|months?|years?)_(ago|from_now)$/,Cp=[`minute`,`hour`,`day`,`week`,`month`,`year`];function wp(e){return xp.includes(e)||Sp.test(e)}F().refine(wp,{message:`Unknown date macro. Must be a fixed token (see DATE_MACRO_TOKENS) or match {N_<unit>_(ago|from_now)} where unit is one of: `+Cp.join(`, `)});var Tp=/^\$?\{([a-zA-Z0-9_]+)\}$/;F().refine(e=>{let t=e.match(Tp);return!!t&&wp(t[1])},{message:`Not a recognised {date-macro} placeholder`});var Ep=G(()=>F().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`)),Dp=G(()=>F().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`));G(()=>F().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`));var Op=U([`cel`,`js`,`cron`,`template`]),kp=B({rationale:F().optional(),generatedBy:F().optional()}),Ap=B({dialect:Op,source:F().min(1).optional(),ast:R().optional(),meta:kp.optional()}).refine(e=>e.source!==void 0||e.ast!==void 0,{message:"Expression requires at least one of `source` or `ast`"}),jp=V([F().min(1).transform(e=>({dialect:`cel`,source:e})),Ap]);V([F().min(1).transform(e=>({dialect:`cron`,source:e})),Ap]);var Mp=V([F().min(1).transform(e=>({dialect:`template`,source:e})),Ap]),Np=G(()=>U([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`)),Pp=G(()=>U([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`)),Fp=G(()=>B({enabled:L().default(!1).describe(`Enable automatic key rotation`),frequencyDays:I().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:I().default(3).describe(`Number of old key versions to retain`),autoRotate:L().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`)),Ip=G(()=>B({enabled:L().default(!1).describe(`Enable field-level encryption`),algorithm:Np.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:B({provider:Pp.describe(`Key management service provider`),keyId:F().optional().describe(`Key identifier in the provider`),rotationPolicy:Fp.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:U([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:L().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:L().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`));G(()=>B({fieldName:F().describe(`Name of the field to encrypt`),encryptionConfig:Ip.describe(`Encryption settings for this field`),indexable:L().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`));var Lp=G(()=>U([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`)),Rp=G(()=>B({field:F().describe(`Field name to apply masking to`),strategy:Lp.describe(`Masking strategy to use`),pattern:F().optional().describe(`Regex pattern for partial masking`),preserveFormat:L().default(!0).describe(`Keep the original data format after masking`),preserveLength:L().default(!0).describe(`Keep the original data length after masking`),roles:z(F()).optional().describe(`Roles that see masked data`),exemptRoles:z(F()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`));G(()=>B({enabled:L().default(!1).describe(`Enable data masking`),rules:z(Rp).describe(`List of field-level masking rules`),auditUnmasking:L().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`));var zp=U(`text.textarea.email.url.phone.password.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.composite.repeater.record.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),Bp=G(()=>B({label:F().describe(`Display label (human-readable, any case allowed)`),value:Ep.describe(`Stored value (lowercase machine identifier)`),color:F().optional().describe(`Color code for badges/charts`),default:L().optional().describe(`Is default option`)}));G(()=>B({latitude:I().min(-90).max(90).describe(`Latitude coordinate`),longitude:I().min(-180).max(180).describe(`Longitude coordinate`),altitude:I().optional().describe(`Altitude in meters`),accuracy:I().optional().describe(`Accuracy in meters`)}));var Vp=G(()=>B({precision:I().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:U([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:F().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}));G(()=>B({value:I().describe(`Monetary amount`),currency:F().length(3).describe(`Currency code (ISO 4217)`)})),G(()=>B({street:F().optional().describe(`Street address`),city:F().optional().describe(`City name`),state:F().optional().describe(`State/Province`),postalCode:F().optional().describe(`Postal/ZIP code`),country:F().optional().describe(`Country name or code`),countryCode:F().optional().describe(`ISO country code (e.g., US, GB)`),formatted:F().optional().describe(`Formatted address string`)}));var Hp=G(()=>B({dimensions:I().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:U([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:L().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:L().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:U([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)})),Up=G(()=>B({minSize:I().min(0).optional().describe(`Minimum file size in bytes`),maxSize:I().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:z(F()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:z(F()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:z(F()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:z(F()).optional().describe(`Blocked MIME types`),virusScan:L().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:U([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:L().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:L().default(!0).describe(`Quarantine files if threat detected`),storageProvider:F().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:F().optional().describe(`Target bucket name`),storagePrefix:F().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:B({minWidth:I().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:I().min(1).optional().describe(`Maximum image width in pixels`),minHeight:I().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:I().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:F().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:L().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:z(B({name:F().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:I().min(1).describe(`Thumbnail width in pixels`),height:I().min(1).describe(`Thumbnail height in pixels`),crop:L().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:L().default(!1).describe(`Preserve EXIF metadata`),autoRotate:L().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:L().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:L().default(!0).describe(`Allow replacing existing files`),allowDelete:L().default(!0).describe(`Allow deleting uploaded files`),requireUpload:L().default(!1).describe(`Require at least one file when field is required`),extractMetadata:L().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:L().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:L().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:I().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:L().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:I().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`})),Wp=G(()=>B({uniqueness:L().default(!1).describe(`Enforce unique values across all records`),completeness:I().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:B({source:F().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:I().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)})),Gp=G(()=>B({enabled:L().describe(`Enable caching for computed field results`),ttl:I().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:z(F()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)})),Kp=G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:F().optional().describe(`Human readable label`),type:zp.describe(`Field Data Type`),description:F().optional().describe(`Tooltip/Help text`),format:F().optional().describe(`Format string (e.g. email, phone)`),columnName:F().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:L().default(!1).describe(`Is required`),searchable:L().default(!1).describe(`Is searchable`),multiple:L().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:L().default(!1).describe(`Is unique constraint`),defaultValue:R().optional().describe(`Default value`),maxLength:I().optional().describe(`Max character length`),minLength:I().optional().describe(`Min character length`),precision:I().optional().describe(`Total digits`),scale:I().optional().describe(`Decimal places`),min:I().optional().describe(`Minimum value`),max:I().optional().describe(`Maximum value`),options:z(Bp).optional().describe(`Static options for select/multiselect`),reference:F().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:z(F()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:L().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:U([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:jp.optional().describe("Formula expression (CEL). e.g. F`record.amount * 0.1`"),summaryOperations:B({object:F().describe(`Source child object name for roll-up`),field:F().describe(`Field on child object to aggregate`),function:U([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:F().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:F().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:L().optional().describe(`Show line numbers in code editor`),maxRating:I().optional().describe(`Maximum rating value (default: 5)`),allowHalf:L().optional().describe(`Allow half-star ratings`),displayMap:L().optional().describe(`Display map widget for location field`),allowGeocoding:L().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:U([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:U([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:L().optional().describe(`Allow transparency/alpha channel`),presetColors:z(F()).optional().describe(`Preset color options`),step:I().optional().describe(`Step increment for slider (default: 1)`),showValue:L().optional().describe(`Display current value on slider`),marks:H(F(),F()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:U([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:U([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:L().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:L().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:Vp.optional().describe(`Configuration for currency field type`),vectorConfig:Hp.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:Up.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:Ip.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:Rp.optional().describe(`Data masking rules for PII protection`),auditTrail:L().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:z(F()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:Gp.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:Wp.optional().describe(`Data quality validation and monitoring rules`),group:F().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:jp.optional().describe("Predicate (CEL) — field is required when TRUE. e.g. P`record.status == 'closed_won'`"),hidden:L().default(!1).describe(`Hidden from default UI`),readonly:L().default(!1).describe(`Read-only in UI`),system:L().optional().describe(`Auto-injected system/audit field (e.g. created_at, updated_by, organization_id). Tools that surface system fields separately from author-declared business fields should branch on this flag.`),sortable:L().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:F().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:L().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:L().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:F().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:L().default(!1).describe(`Create standard database index`),externalId:L().default(!1).describe(`Is external ID for upsert operations`)})),qp=B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:F().optional().describe(`Human-readable label for the rule listing`),description:F().optional().describe(`Administrative notes explaining the business reason`),active:L().default(!0),events:z(U([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:I().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:z(F()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:U([`error`,`warning`,`info`]).default(`error`),message:F().describe(`Error message to display to the user`)}),Jp=G(()=>qp.extend({type:W(`script`),condition:jp.describe("Predicate (CEL). If TRUE, validation fails. e.g. P`record.amount < 0`")})),Yp=G(()=>qp.extend({type:W(`unique`),fields:z(F()).describe(`Fields that must be combined unique`),scope:jp.optional().describe("Predicate (CEL) limiting uniqueness scope. e.g. P`record.active == true`"),caseSensitive:L().default(!0)})),Xp=G(()=>qp.extend({type:W(`state_machine`),field:F().describe(`State field (e.g. status)`),transitions:H(F(),z(F())).describe(`Map of { OldState: [AllowedNewStates] }`)})),Zp=G(()=>qp.extend({type:W(`format`),field:F(),regex:F().optional(),format:U([`email`,`url`,`phone`,`json`]).optional()})),Qp=G(()=>qp.extend({type:W(`cross_field`),condition:jp.describe("Predicate (CEL) comparing fields. e.g. P`record.end_date > record.start_date`"),fields:z(F()).describe(`Fields involved in the validation`)})),$p=G(()=>qp.extend({type:W(`json_schema`),field:F().describe(`JSON field to validate`),schema:H(F(),R()).describe(`JSON Schema object definition`)})),em=G(()=>qp.extend({type:W(`async`),field:F().describe(`Field to validate`),validatorUrl:F().optional().describe(`External API endpoint for validation`),method:U([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:H(F(),F()).optional().describe(`Custom headers for the request`),validatorFunction:F().optional().describe(`Reference to custom validator function`),timeout:I().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:I().optional().describe(`Debounce delay in milliseconds`),params:H(F(),R()).optional().describe(`Additional parameters to pass to validator`)})),tm=G(()=>qp.extend({type:W(`custom`),handler:F().describe(`Name of the custom validation function registered in the system`),params:H(F(),R()).optional().describe(`Parameters passed to the custom handler`)})),nm=zf(()=>uf(`type`,[Jp,Yp,Xp,Zp,Qp,$p,em,tm,rm])),rm=G(()=>qp.extend({type:W(`conditional`),when:jp.describe("Predicate (CEL). e.g. P`record.type == 'enterprise'`"),then:nm.describe(`Validation rule to apply when condition is true`),otherwise:nm.optional().describe(`Validation rule to apply when condition is false`)})),im=G(()=>V([F().describe(`Action Name`),B({type:F(),params:H(F(),R()).optional()})])),am=G(()=>V([F().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),B({type:F(),params:H(F(),R()).optional()})])),om=G(()=>B({target:F().optional().describe(`Target State ID`),cond:am.optional().describe(`Condition (Guard) required to take this path`),actions:z(im).optional().describe(`Actions to execute during transition`),description:F().optional().describe(`Human readable description of this rule`)}));G(()=>B({type:F().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:H(F(),R()).optional().describe(`Expected event payload structure`)}));var sm=zf(()=>B({type:U([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:z(im).optional().describe(`Actions to run when entering this state`),exit:z(im).optional().describe(`Actions to run when leaving this state`),on:H(F(),V([F(),om,z(om)])).optional().describe(`Map of Event Type -> Transition Definition`),always:z(om).optional(),initial:F().optional().describe(`Initial child state (if compound)`),states:H(F(),sm).optional(),meta:B({label:F().optional(),description:F().optional(),color:F().optional(),aiInstructions:F().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),cm=G(()=>B({id:Dp.describe(`Unique Machine ID`),description:F().optional(),contextSchema:H(F(),R()).optional().describe(`Zod Schema for the machine context/memory`),initial:F().describe(`Initial State ID`),states:H(F(),sm).describe(`State Nodes`),on:H(F(),V([F(),om,z(om)])).optional()}));G(()=>B({key:F().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:F().optional().describe(`Fallback value when translation key is not found`),params:H(F(),V([F(),I(),L()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}));var lm=G(()=>F().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`)),um=G(()=>B({ariaLabel:lm.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:F().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:F().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`));G(()=>B({key:F().describe(`Translation key`),zero:F().optional().describe(`Zero form (e.g., "No items")`),one:F().optional().describe(`Singular form (e.g., "{count} item")`),two:F().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:F().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:F().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:F().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`));var dm=G(()=>B({style:U([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:F().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:F().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:I().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:I().optional().describe(`Maximum number of fraction digits`),useGrouping:L().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`)),fm=G(()=>B({dateStyle:U([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:U([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:F().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:L().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`));G(()=>B({code:F().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:z(F()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:U([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:dm.optional().describe(`Default number formatting rules`),dateFormat:fm.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`));var pm=U([`api.read`,`api.write`,`crypto.uuid`,`crypto.hash`,`log`]),mm=uf(`language`,[B({language:W(`expression`),source:F().min(1).describe(`Formula expression source`)}).describe(`L1 expression body — pure formula, no IO`),B({language:W(`js`),source:F().min(1).describe(`Function body source`),capabilities:z(pm).default([]).describe(`Granted capability tokens`),timeoutMs:I().int().positive().max(3e4).optional().describe(`Per-invocation timeout (ms)`),memoryMb:I().int().positive().max(256).optional().describe(`Per-invocation memory cap (MB)`)}).describe(`L2 sandboxed JS body — runs inside an isolated VM with declared capabilities`)]).describe(`Hook/Action body — expression (L1) or sandboxed JS (L2)`),hm=G(()=>B({name:F().optional(),field:Dp.optional(),objectOverride:Dp.optional(),label:lm.optional(),type:zp.optional(),required:L().optional().default(!1),options:z(B({label:lm,value:F()})).optional(),placeholder:F().optional(),helpText:F().optional(),defaultValue:R().optional(),defaultFromRow:L().optional()}).refine(e=>!!e.name||!!e.field,{message:`ActionParam requires either "name" or "field"`})),gm=U([`script`,`url`,`modal`,`flow`,`api`,`form`]),_m=new Set(gm.options.filter(e=>e!==`script`)),vm=U([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`record_section`,`global_nav`]),ym=G(()=>B({name:Dp.describe(`Machine name (lowercase snake_case)`),label:lm.describe(`Display label`),objectName:F().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:F().optional().describe(`Icon name`),locations:z(vm).optional().describe(`Locations where this action is visible`),component:U([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:gm.default(`script`).describe(`Action functionality type`),target:F().optional().describe("URL, Script Name, Flow ID, or API Endpoint. Supports ${param.X} and ${ctx.X} interpolation."),body:mm.optional().describe("Action body — expression (L1) or sandboxed JS (L2). Only used when type is `script`."),execute:F().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:z(hm).optional().describe(`Input parameters required from user`),variant:U([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:lm.optional().describe(`Confirmation message before execution`),successMessage:lm.optional().describe(`Success message to show after execution`),refreshAfter:L().default(!1).describe(`Refresh view after execution`),resultDialog:B({title:lm.optional(),description:lm.optional(),acknowledge:lm.optional().describe(`Acknowledge button label, e.g. "I have saved this"`),format:U([`qrcode`,`code-list`,`secret`,`text`,`json`]).optional().describe(`Default format for fields without their own format. Defaults to json when omitted.`),fields:z(B({path:F().describe(`Dot path into result.data (e.g. "totpURI", "client.client_secret").`),label:lm.optional(),format:U([`qrcode`,`code-list`,`secret`,`text`,`json`]).optional().describe(`Per-field format override.`)})).optional().describe(`Which fields from result.data to render. Omit to dump full JSON.`)}).optional().describe(`Render API response in a one-shot reveal dialog (suppresses successMessage when set).`),visible:jp.optional().describe(`Visibility predicate (CEL).`),disabled:V([L(),jp]).optional().describe(`Boolean or predicate (CEL) — action is disabled when TRUE.`),shortcut:F().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:L().optional().describe(`Whether this action can be applied to multiple selected records`),aiExposed:L().optional().describe(`Set to false to keep this action out of the AI tool registry.`),recordIdParam:F().optional().describe(`Body key to inject the row id into when running from a list_item context.`),recordIdField:F().optional().describe(`Row field whose value seeds recordIdParam. Defaults to "id".`),bodyShape:V([W(`flat`),B({wrap:F()})]).optional().describe(`Body wrapping: flat (default) or { wrap: key } to nest user-collected params under a key.`),method:U([`POST`,`PATCH`,`PUT`,`DELETE`]).optional().describe(`HTTP method for type:"api" actions. Defaults to POST.`),bodyExtra:H(F(),R()).optional().describe(`Constant body fields merged into the API request (applied last; overrides user params).`),mode:U([`create`,`edit`,`delete`,`custom`]).optional().describe(`Semantic mode of the action.`),timeout:I().optional().describe(`Maximum execution time in milliseconds for the action`),aria:um.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(_m.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', 'api', or 'form'.`,path:[`target`]})),bm=G(()=>B({enabled:L().default(!1).describe(`Enable public sharing`),publicLink:F().optional().describe(`Generated public share URL`),password:F().optional().describe(`Password required to access shared link`),allowedDomains:z(F()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:F().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:L().optional().default(!1).describe(`Allow access without authentication`)}));G(()=>B({enabled:L().default(!1).describe(`Enable iframe embedding`),allowedOrigins:z(F()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:F().optional().default(`100%`).describe(`Embed width (CSS value)`),height:F().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:L().optional().default(!0).describe(`Show interface header in embed`),showNavigation:L().optional().default(!1).describe(`Show navigation in embed`),responsive:L().optional().default(!0).describe(`Enable responsive resizing`)}));var xm=U([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),Sm=G(()=>B({xs:I().min(1).max(12).optional(),sm:I().min(1).max(12).optional(),md:I().min(1).max(12).optional(),lg:I().min(1).max(12).optional(),xl:I().min(1).max(12).optional(),"2xl":I().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`)),Cm=G(()=>B({xs:I().optional(),sm:I().optional(),md:I().optional(),lg:I().optional(),xl:I().optional(),"2xl":I().optional()}).describe(`Display order per breakpoint`)),wm=G(()=>B({breakpoint:xm.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:z(xm).optional().describe(`Hide on these breakpoints`),columns:Sm.optional().describe(`Grid columns per breakpoint`),order:Cm.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`)),Tm=G(()=>B({lazyLoad:L().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:B({enabled:L().default(!1).describe(`Enable virtual scrolling`),itemHeight:I().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:I().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:U([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:L().optional().describe(`Prefetch data before component is visible`),pageSize:I().optional().describe(`Number of items per page for pagination`),debounceMs:I().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`)),Em=U([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),Dm=G(()=>U([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`])),Om=G(()=>B({url:F().describe(`API endpoint URL`),method:Dm.optional().default(`GET`).describe(`HTTP method`),headers:H(F(),F()).optional().describe(`Custom HTTP headers`),params:H(F(),R()).optional().describe(`Query parameters`),body:R().optional().describe(`Request body for POST/PUT/PATCH`)}));G(()=>B({enabled:L().default(!0).describe(`Enable CORS`),origins:V([F(),z(F())]).default(`*`).describe(`Allowed origins (* for all)`),methods:z(Em).optional().describe(`Allowed HTTP methods`),credentials:L().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:I().int().optional().describe(`Preflight cache duration in seconds`)})),G(()=>B({enabled:L().default(!1).describe(`Enable rate limiting`),windowMs:I().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:I().int().default(100).describe(`Max requests per window`)})),G(()=>B({path:F().describe(`URL path to serve from`),directory:F().describe(`Physical directory to serve`),cacheControl:F().optional().describe(`Cache-Control header value`)}));var km=G(()=>uf(`provider`,[B({provider:W(`object`),object:F().describe(`Target object name`)}),B({provider:W(`api`),read:Om.optional().describe(`Configuration for fetching data`),write:Om.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),B({provider:W(`value`),items:z(R()).describe(`Static data array`)}),B({provider:W(`schema`),schemaId:F().describe(`Schema identifier — typically the metadata type name`),schema:H(F(),R()).optional().describe(`Inline JSON Schema (Draft 2020-12). Optional when schemaId is resolvable.`)})])),Am=G(()=>B({field:F().describe(`Field name to filter on`),operator:F().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:V([F(),I(),L(),Yd(),z(V([F(),I()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`)),jm=G(()=>U([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`)),Mm=G(()=>B({field:F().describe(`Field name (snake_case)`),label:lm.optional().describe(`Display label override`),width:I().positive().optional().describe(`Column width in pixels`),align:U([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:L().optional().describe(`Hide column by default`),sortable:L().optional().describe(`Allow sorting by this column`),resizable:L().optional().describe(`Allow resizing this column`),wrap:L().optional().describe(`Allow text wrapping`),type:F().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:U([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:jm.optional().describe(`Footer aggregation function for this column`),link:L().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:F().optional().describe(`Registered Action ID to execute when clicked`)})),Nm=G(()=>B({type:U([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)})),Pm=G(()=>B({pageSize:I().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:z(I().int().positive()).optional().describe(`Available page size options`)})),Fm=G(()=>U([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`)),Im=G(()=>B({field:F().describe(`Field name to group by`),order:U([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:L().default(!1).describe(`Collapse groups by default`)})),Lm=G(()=>B({fields:z(Im).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`)),Rm=G(()=>B({coverField:F().optional().describe(`Attachment/image field to display as card cover`),coverFit:U([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:U([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:F().optional().describe(`Field to display as card title`),visibleFields:z(F()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`)),zm=G(()=>B({startDateField:F().describe(`Field for timeline item start date`),endDateField:F().optional().describe(`Field for timeline item end date`),titleField:F().describe(`Field to display as timeline item title`),groupByField:F().optional().describe(`Field to group timeline rows`),colorField:F().optional().describe(`Field to determine item color`),scale:U([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`)),Bm=G(()=>B({type:U([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:F().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`)),Vm=G(()=>B({field:F().describe(`Field to derive color from (typically a select/status field)`),colors:H(F(),F()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`)),Hm=G(()=>U([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`)),Um=G(()=>B({sort:L().default(!0).describe(`Allow users to sort records`),search:L().default(!0).describe(`Allow users to search records`),filter:L().default(!0).describe(`Allow users to filter records`),rowHeight:L().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:L().default(!1).describe(`Add records through a form instead of inline`),buttons:z(F()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`)),Wm=G(()=>B({showDescription:L().default(!0).describe(`Show the view description text`),allowedVisualizations:z(Hm).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`)),Gm=G(()=>B({name:Dp.describe(`Tab identifier (snake_case)`),label:lm.optional().describe(`Display label`),icon:F().optional().describe(`Tab icon name`),view:F().optional().describe(`Referenced list view name from listViews`),filter:z(Am).optional().describe(`Tab-specific filter criteria`),order:I().int().min(0).optional().describe(`Tab display order`),pinned:L().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:L().default(!1).describe(`Set as the default active tab`),visible:L().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`)),Km=G(()=>B({enabled:L().default(!0).describe(`Show the add record entry point`),position:U([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:U([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:F().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`)),qm=G(()=>B({groupByField:F().describe(`Field to group columns by (usually status/select)`),summarizeField:F().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:z(F()).describe(`Fields to show on cards`)})),Jm=G(()=>B({chartType:U([`bar`,`line`,`pie`,`area`,`scatter`]).default(`bar`).describe(`Chart visualisation type`),xAxisField:F().describe(`Field used as the X axis / category dimension`),yAxisFields:z(F()).min(1).describe(`Field(s) used as the Y axis / measures`),aggregation:U([`sum`,`avg`,`count`,`min`,`max`]).optional().describe(`Aggregation function applied to Y axis fields`),groupByField:F().optional().describe(`Optional field used to split / stack the chart`)}).describe(`List chart view configuration`)),Ym=G(()=>B({startDateField:F(),endDateField:F().optional(),titleField:F(),colorField:F().optional()})),Xm=G(()=>B({startDateField:F(),endDateField:F(),titleField:F(),progressField:F().optional(),dependenciesField:F().optional()})),Zm=G(()=>U([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`])),Qm=G(()=>B({mode:Zm.default(`page`),view:F().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:L().default(!1).describe(`Disable standard navigation entirely`),openNewTab:L().default(!1).describe(`Force open in new tab (applies to page mode)`),width:V([F(),I()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)})),$m=G(()=>B({name:Dp.optional().describe(`Internal view name (lowercase snake_case)`),label:lm.optional(),type:U([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`,`chart`]).default(`grid`),data:km.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:V([z(F()),z(Mm)]).describe(`Fields to display as columns`),filter:z(Am).optional().describe(`Filter criteria (JSON Rules)`),sort:V([F(),z(B({field:F(),order:U([`asc`,`desc`])}))]).optional(),searchableFields:z(F()).optional().describe(`Fields enabled for search`),filterableFields:z(F()).optional().describe(`Fields enabled for end-user filtering in the top bar`),resizable:L().optional().describe(`Enable column resizing`),striped:L().optional().describe(`Striped row styling`),bordered:L().optional().describe(`Show borders`),compactToolbar:L().optional().describe(`Collapse Group/Color/Density/Hide-fields into a single View settings popover`),selection:Nm.optional().describe(`Row selection configuration`),navigation:Qm.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:Pm.optional().describe(`Pagination configuration`),kanban:qm.optional(),calendar:Ym.optional(),gantt:Xm.optional(),gallery:Rm.optional(),timeline:zm.optional(),chart:Jm.optional(),description:lm.optional().describe(`View description for documentation/tooltips`),sharing:Bm.optional().describe(`View sharing and access configuration`),rowHeight:Fm.optional().describe(`Row height / density setting`),grouping:Lm.optional().describe(`Group records by one or more fields`),rowColor:Vm.optional().describe(`Color rows based on field value`),hiddenFields:z(F()).optional().describe(`Fields to hide in this specific view`),fieldOrder:z(F()).optional().describe(`Explicit field display order for this view`),rowActions:z(F()).optional().describe(`Actions available for individual row items`),bulkActions:z(F()).optional().describe(`Actions available when multiple rows are selected`),bulkActionDefs:z(H(F(),Zd())).optional().describe(`Rich bulk action definitions (schema-driven, executed via BulkActionDialog)`),virtualScroll:L().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:z(B({condition:jp.describe(`Predicate (CEL) to evaluate.`),style:H(F(),F()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:L().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:z(U([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:Um.optional().describe(`User action toggles for the view toolbar`),appearance:Wm.optional().describe(`Appearance and visualization configuration`),tabs:z(Gm).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:Km.optional().describe(`Add record entry point configuration`),showRecordCount:L().optional().describe(`Show record count at the bottom of the list`),allowPrinting:L().optional().describe(`Allow users to print the view`),emptyState:B({title:lm.optional(),message:lm.optional(),icon:F().optional()}).optional().describe(`Empty state configuration when no records found`),aria:um.optional().describe(`ARIA accessibility attributes for the list view`),responsive:wm.optional().describe(`Responsive layout configuration`),performance:Tm.optional().describe(`Performance optimization settings`)})),eh=G(()=>B({field:F().describe(`Field name (snake_case)`),type:zp.optional().describe(`Field type (auto-infers widget if omitted)`),options:z(Bp).optional().describe(`Options for select/multiselect/radio/checkboxes fields`),reference:F().optional().describe(`Target object name for lookup/master_detail fields`),maxLength:I().optional().describe(`Maximum character length (for text/textarea/email/url/phone)`),minLength:I().optional().describe(`Minimum character length`),min:I().optional().describe(`Minimum value (for number/currency/percent/slider)`),max:I().optional().describe(`Maximum value`),precision:I().optional().describe(`Total digits (for number/currency)`),scale:I().optional().describe(`Decimal places`),multiple:L().optional().describe(`Allow multiple values (for select/lookup/file/image)`),label:lm.optional().describe(`Display label override`),placeholder:lm.optional().describe(`Placeholder text`),helpText:lm.optional().describe(`Help/hint text`),readonly:L().optional().describe(`Read-only override`),immutable:L().optional().describe(`Editable on create, locked once the record exists (e.g. machine names).`),required:L().optional().describe(`Required override`),hidden:L().optional().describe(`Hidden override`),colSpan:I().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:F().optional().describe(`Custom widget/component name (overrides type-based inference)`),language:F().optional().describe(`Code editor language (for type=code)`),fields:z(zf(()=>eh)).optional().describe(`Sub-fields for composite/repeater/record types`),keyField:B({field:F().default(`name`).describe(`Property name that holds the key inside each item (defaults to "name")`),label:lm.optional().describe(`Display label for the key column`),placeholder:lm.optional().describe(`Placeholder when entering a new key`),helpText:lm.optional().describe(`Help text under the key input`),regex:F().optional().describe(`JS regex source string the key must match (no flags)`),immutable:L().default(!0).describe(`If true, the key is read-only after creation`)}).optional().describe(`Key column config for record-typed fields`),dependsOn:F().optional().describe(`Parent field name for cascading`),visibleOn:jp.optional().describe(`Visibility predicate (CEL).`)})),th=G(()=>B({name:F().optional().describe(`Stable section identifier for i18n lookup (snake_case)`),label:lm.optional(),description:F().optional().describe(`Optional description rendered under the section header.`),collapsible:L().default(!1),collapsed:L().default(!1),visibleOn:jp.optional().describe(`Visibility predicate (CEL). Hides the whole section when false.`),columns:V([U([`1`,`2`,`3`,`4`]),W(1),W(2),W(3),W(4)]).default(1).transform(e=>typeof e==`string`?parseInt(e):e),fields:z(V([F(),eh]))})),nh=G(()=>B({type:U([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:km.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:z(th).optional(),groups:z(th).optional(),defaultSort:z(B({field:F().describe(`Field name to sort by`),order:U([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:bm.optional().describe(`Public sharing configuration for this form`),submitBehavior:V([B({kind:W(`thank-you`),title:F().optional(),message:F().optional()}),B({kind:W(`redirect`),url:F(),delayMs:I().int().min(0).optional()}),B({kind:W(`continue`)}),B({kind:W(`next-record`)})]).optional().describe(`Post-submit behavior`),aria:um.optional().describe(`ARIA accessibility attributes for the form view`)}));G(()=>B({list:$m.optional(),form:nh.optional(),listViews:H(F(),$m).optional().describe(`Additional named list views`),formViews:H(F(),nh).optional().describe(`Additional named form views`)}));function rh(e){let{schemaId:t,...n}=e;return nh.parse({...n,data:{provider:`schema`,schemaId:t}})}var ih=U([`none`,`no-overlay`,`no-delete`,`full`]),ah=U([`artifact`,`package`,`env-forced`]),oh=U([`package`,`org`,`env-forced`]),sh={_lock:ih.optional().describe(`Item-level lock — controls overlay & delete (ADR-0010).`),_lockReason:F().max(500).optional().describe(`Human-readable reason shown when a write is refused by _lock.`),_lockSource:ah.optional().describe(`Layer that set _lock (artifact | package | env-forced).`),_provenance:oh.optional().describe(`Origin of the item (package | org | env-forced).`),_packageId:F().optional().describe(`Owning package machine id.`),_packageVersion:F().optional().describe(`Owning package version.`)},ch=U([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),lh=B({trackHistory:L().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:L().default(!0).describe(`Index records for global search`),apiEnabled:L().default(!0).describe(`Expose object via automatic APIs`),apiMethods:z(ch).optional().describe(`Whitelist of allowed API operations`),files:L().default(!1).describe(`Enable file attachments and document management`),feeds:L().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:L().default(!1).describe(`Enable standard tasks and events tracking`),trash:L().default(!0).describe(`Enable soft-delete with restore capability`),mru:L().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:L().default(!0).describe(`Allow record deep cloning`)}),uh=G(()=>B({name:F().optional().describe(`Index name (auto-generated if not provided)`),fields:z(F()).describe(`Fields included in the index`),type:U([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:L().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:F().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)})),dh=G(()=>B({fields:z(F()).describe(`Fields to index for full-text search weighting`),displayFields:z(F()).optional().describe(`Fields to display in search result cards`),filters:z(F()).optional().describe(`Default filters for search results`)})),fh=G(()=>B({enabled:L().describe(`Enable multi-tenancy for this object`),strategy:U([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:F().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:L().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)})),ph=G(()=>B({enabled:L().describe(`Enable soft delete (trash/recycle bin)`),field:F().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:L().default(!1).describe(`Cascade soft delete to related records`)})),mh=G(()=>B({enabled:L().describe(`Enable record versioning`),strategy:U([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:I().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:F().default(`version`).describe(`Field name for version number/timestamp`)})),hh=G(()=>B({enabled:L().describe(`Enable table partitioning`),strategy:U([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:F().describe(`Field name to partition by`),interval:F().optional().describe(`Partition interval for range strategy (e.g., "1 month", "1 year")`)}).refine(e=>!(e.strategy===`range`&&!e.interval),{message:`interval is required when strategy is "range"`})),gh=G(()=>B({enabled:L().describe(`Enable Change Data Capture`),events:z(U([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:F().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)})),_h=G(()=>B({key:F().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field group key must be lowercase snake_case (e.g., "contact_info", "billing", "system")`}).describe(`Group machine key (snake_case). Referenced by Field.group.`),label:F().describe(`Group display label`),icon:F().optional().describe(`Icon name (Lucide/Material) for the group header`),description:F().optional().describe(`Optional description shown under the group header`),defaultExpanded:L().optional().default(!0).describe(`Whether the group is expanded by default`),visibleOn:jp.optional().describe(`Visibility predicate (CEL); group is hidden when FALSE.`)})),vh=B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:F().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:F().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:F().optional().describe(`Developer documentation / description`),icon:F().optional().describe(`Icon name (Lucide/Material) for UI representation`),tags:z(F()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:L().optional().default(!0).describe(`Is the object active and usable`),isSystem:L().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:L().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),managedBy:U([`platform`,`config`,`system`,`append-only`,`better-auth`]).optional().describe(`Lifecycle bucket — platform (user CRUD) | config (admin authored) | system (engine-managed) | append-only (audit) | better-auth (identity). UI clients honour the resolved affordance matrix.`),userActions:B({create:L().optional().describe(`Show generic "New" button.`),import:L().optional().describe(`Show CSV import wizard entry.`),edit:L().optional().describe(`Allow inline / form edit of existing rows.`),delete:L().optional().describe(`Show row-level delete + bulk delete.`),exportCsv:L().optional().describe(`Show CSV export entry.`)}).optional().describe(`Per-object override of the resolved CRUD affordance matrix.`),systemFields:V([W(!1),B({tenant:L().optional().describe(`Inject organization_id (multi-tenant only). Default true.`),owner:L().optional().describe(`Reserved for future owner_id auto-injection.`),audit:L().optional().describe(`Reserved for future created_by/updated_by auto-injection.`)})]).optional().describe(`Opt out of, or selectively disable, registry-level system-field auto-injection.`),datasource:F().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),fields:H(F().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),Kp).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:z(uh).optional().describe(`Database performance indexes`),fieldGroups:z(_h).refine(e=>new Set(e.map(e=>e.key)).size===e.length,{message:`fieldGroups[].key must be unique within an object`}).optional().describe(`Ordered list of field groups (array order = display order). See ObjectFieldGroupSchema.`),tenancy:fh.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:ph.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:mh.optional().describe(`Record versioning and history tracking configuration`),partitioning:hh.optional().describe(`Table partitioning configuration for performance`),cdc:gh.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:z(nm).optional().describe(`Object-level validation rules`),stateMachines:H(F(),cm).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:F().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:B({type:U([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:F().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:I().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:Mp.optional().describe(`Title template — supports {{record.field}} interpolation. Overrides displayNameField.`),compactLayout:z(F()).optional().describe(`Primary fields for hover/cards/lookups`),listViews:H(F(),$m).optional().describe(`Built-in named list views (segmented tabs) shipped with the object schema`),defaultDetailForm:F().optional().describe(`Name of the default FormView for record detail / edit screens`),search:dh.optional().describe(`Search engine configuration`),enable:lh.optional().describe(`Enabled system features modules`),recordTypes:z(F()).optional().describe(`Record type names for this object`),sharingModel:U([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),publicSharing:B({enabled:L().default(!1).describe(`Allow records of this object to be published via share link`),allowedAudiences:z(U([`public`,`link_only`,`signed_in`,`email`])).optional().describe(`Audiences callers may select when creating a link`),allowedPermissions:z(U([`view`,`comment`,`edit`])).optional().describe(`Permission levels selectable on the share dialog`),maxExpiryDays:I().int().positive().optional().describe(`Reject links with expiry beyond this many days`),redactFields:z(F()).optional().describe(`Field names removed from records served via a share token`),eligibility:F().optional().describe(`CEL expression that must evaluate to true on the target record`)}).optional().describe(`Public share-link policy (Notion/Figma-style link sharing)`),keyPrefix:F().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),detail:B({renderViaSchema:L().optional().describe(`Opt this object out of the schema-driven detail renderer`),hideReferenceRail:L().optional().describe(`Suppress the right-hand reference-rail on the detail page`),hideRelatedTab:L().optional().describe(`Suppress the Related tab on the detail page`)}).passthrough().optional().describe(`Detail-page UI hints consumed by @object-ui/plugin-detail synth`),actions:z(ym).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`),...sh});function yh(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}G(()=>Object.assign(vh,{create:e=>{let t={...e,label:e.label??yh(e.name)};return vh.parse(t)}})),U([`own`,`extend`]),G(()=>B({extend:F().describe(`Target object name (FQN) to extend`),fields:H(F(),Kp).optional().describe(`Fields to add/override`),label:F().optional().describe(`Override label for the extended object`),pluralLabel:F().optional().describe(`Override plural label for the extended object`),description:F().optional().describe(`Override description for the extended object`),validations:z(nm).optional().describe(`Additional validation rules to merge into the target object`),indexes:z(uh).optional().describe(`Additional indexes to merge into the target object`),priority:I().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)}));var bh=U([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]);G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:F().optional().describe(`Description of what this hook does`),object:V([F(),z(F())]).describe(`Target object(s)`),events:z(bh).describe(`Lifecycle events`),handler:V([F(),Gf(e=>typeof e==`function`,{message:`Expected function`})]).optional().describe("Handler function name (string, post-build) or inline function (pre-build) — DEPRECATED, prefer `body`"),body:mm.optional().describe(`Hook body — expression (L1) or sandboxed JS (L2)`),priority:I().default(100).describe(`Execution priority`),async:L().default(!1).describe(`Run specifically as fire-and-forget`),condition:jp.optional().describe('Predicate (CEL); hook runs only when TRUE. e.g. P`record.status == "closed" && record.amount > 1000`'),description:F().optional().describe(`Human-readable description of what this hook does`),retryPolicy:B({maxRetries:I().default(3).describe(`Maximum retry attempts on failure`),backoffMs:I().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:I().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:U([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)})),G(()=>B({id:F().optional().describe(`Unique execution ID for tracing`),object:F(),event:bh,input:H(F(),R()).describe(`Mutable input parameters`),result:R().optional().describe(`Operation result (After hooks only)`),previous:H(F(),R()).optional().describe(`Record state before operation`),session:B({userId:F().optional(),tenantId:F().optional(),roles:z(F()).optional(),accessToken:F().optional(),isSystem:L().optional().describe(`True when the call was made with an elevated system context (engine self-writes)`)}).optional().describe(`Current session context`),transaction:R().optional().describe(`Database transaction handle`),ql:R().describe(`ObjectQL Engine Reference`),api:R().optional().describe(`Cross-object data access (ScopedContext)`),user:B({id:F().optional(),name:F().optional(),email:F().optional()}).optional().describe(`Current user info shortcut`)}));var xh=U([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),Sh=G(()=>B({source:V([F(),z(F())]).describe(`Source column header(s)`),target:V([F(),z(F())]).describe(`Target object field(s)`),transform:xh.default(`none`),params:B({value:R().optional(),object:F().optional(),fromField:F().optional(),toField:F().optional(),autoCreate:L().optional(),valueMap:H(F(),R()).optional(),separator:F().optional()}).optional()}));G(()=>B({name:Dp.describe(`Mapping unique name (lowercase snake_case)`),label:F().optional(),sourceFormat:U([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:F().describe(`Target Object Name`),fieldMapping:z(Sh),mode:U([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:z(F()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:_p.optional().describe(`Query to run for export only`),errorPolicy:U([`skip`,`abort`,`retry`]).default(`skip`),batchSize:I().default(1e3)}));var Ch=G(()=>B({userId:F().optional(),tenantId:F().optional(),roles:z(F()).default([]),permissions:z(F()).default([]),systemPermissions:z(F()).optional(),tabPermissions:H(F(),U([`visible`,`hidden`,`default_on`,`default_off`])).optional(),org_user_ids:z(F()).optional(),isSystem:L().default(!1),accessToken:F().optional(),transaction:R().optional(),traceId:F().optional()})),wh=G(()=>V([H(F(),R()),Zf]).describe(`Data Engine query filter conditions`)),Th=G(()=>V([H(F(),U([`asc`,`desc`])),H(F(),V([W(1),W(-1)])),z(rp)]).describe(`Sort order definition`)),Eh=G(()=>B({context:Ch.optional()})),Dh=G(()=>Eh.extend({where:V([H(F(),R()),Zf]).optional(),fields:z(mp).optional(),orderBy:z(rp).optional(),limit:I().optional(),offset:I().optional(),top:I().optional(),cursor:H(F(),R()).optional(),search:hp.optional(),expand:zf(()=>H(F(),_p)).optional(),distinct:L().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`));G(()=>Eh.extend({filter:wh.optional(),select:z(F()).optional(),sort:Th.optional(),limit:I().int().min(1).optional(),skip:I().int().min(0).optional(),top:I().int().min(1).optional(),populate:z(F()).optional()}).describe(`Query options for IDataEngine.find() operations`));var Oh=G(()=>Eh.extend({returning:L().default(!0).optional()}).describe(`Options for DataEngine.insert operations`)),kh=G(()=>Eh.extend({where:V([H(F(),R()),Zf]).optional(),upsert:L().default(!1).optional(),multi:L().default(!1).optional(),returning:L().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`));G(()=>Eh.extend({filter:wh.optional(),upsert:L().default(!1).optional(),multi:L().default(!1).optional(),returning:L().default(!1).optional()}).describe(`Options for DataEngine.update operations`));var Ah=G(()=>Eh.extend({where:V([H(F(),R()),Zf]).optional(),multi:L().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`));G(()=>Eh.extend({filter:wh.optional(),multi:L().default(!1).optional()}).describe(`Options for DataEngine.delete operations`));var jh=G(()=>Eh.extend({where:V([H(F(),R()),Zf]).optional(),groupBy:z(F()).optional(),aggregations:z(sp).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`));G(()=>Eh.extend({filter:wh.optional(),groupBy:z(F()).optional(),aggregations:z(B({field:F(),method:U([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:F().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`));var Mh=G(()=>Eh.extend({where:V([H(F(),R()),Zf]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`));G(()=>Eh.extend({filter:wh.optional()}).describe(`Options for DataEngine.count operations`)),G(()=>B({find:Uf().input(mf([F(),Dh.optional()])).output(Vf(z(R()))),findOne:Uf().input(mf([F(),Dh.optional()])).output(Vf(R())),insert:Uf().input(mf([F(),V([H(F(),R()),z(H(F(),R()))]),Oh.optional()])).output(Vf(R())),update:Uf().input(mf([F(),H(F(),R()),kh.optional()])).output(Vf(R())),delete:Uf().input(mf([F(),Ah.optional()])).output(Vf(R())),count:Uf().input(mf([F(),Mh.optional()])).output(Vf(I())),aggregate:Uf().input(mf([F(),jh])).output(Vf(z(R())))}).describe(`Standard Data Engine Contract`));var Nh={filter:wh.optional()},Ph=Dh.extend({...Nh,select:z(F()).optional(),sort:Th.optional(),skip:I().int().min(0).optional(),populate:z(F()).optional()}),Fh=G(()=>B({method:W(`find`),object:F(),query:Ph.optional()})),Ih=G(()=>B({method:W(`findOne`),object:F(),query:Ph.optional()})),Lh=G(()=>B({method:W(`insert`),object:F(),data:V([H(F(),R()),z(H(F(),R()))]),options:Oh.optional()})),Rh=G(()=>B({method:W(`update`),object:F(),data:H(F(),R()),id:V([F(),I()]).optional().describe(`ID for single update, or use where in options`),options:kh.extend(Nh).optional()})),zh=G(()=>B({method:W(`delete`),object:F(),id:V([F(),I()]).optional().describe(`ID for single delete, or use where in options`),options:Ah.extend(Nh).optional()})),Bh=G(()=>B({method:W(`count`),object:F(),query:Mh.extend(Nh).optional()})),Vh=G(()=>B({method:W(`aggregate`),object:F(),query:jh.extend(Nh)})),Hh=G(()=>B({method:W(`execute`),command:R(),options:H(F(),R()).optional()})),Uh=G(()=>B({method:W(`vectorFind`),object:F(),vector:z(I()),where:V([H(F(),R()),Zf]).optional(),fields:z(F()).optional(),limit:I().int().default(5).optional(),threshold:I().optional()})),Wh=G(()=>B({method:W(`batch`),requests:z(uf(`method`,[Fh,Ih,Lh,Rh,zh,Bh,Vh,Hh,Uh])),transaction:L().default(!0).optional()}));G(()=>uf(`method`,[Fh,Ih,Lh,Rh,zh,Bh,Vh,Wh,Hh,Uh]).describe(`Virtual ObjectQL Request Protocol`)),U([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var Gh=U([`asc`,`desc`]).describe(`Sort order direction`);G(()=>B({field:F().describe(`Field name to sort by`),order:Gh.describe(`Sort direction`)}).describe(`Sort field and direction pair`)),U([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`);var Kh=U([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`);U([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var qh=G(()=>B({transaction:R().optional().describe(`Transaction handle`),timeout:I().optional().describe(`Timeout in ms`),skipCache:L().optional().describe(`Bypass cache`),traceContext:H(F(),F()).optional().describe(`OpenTelemetry context or request ID`),tenantId:F().optional().describe(`Tenant Isolation identifier`)})),Jh=G(()=>B({create:L().default(!0).describe(`Supports CREATE operations`),read:L().default(!0).describe(`Supports READ operations`),update:L().default(!0).describe(`Supports UPDATE operations`),delete:L().default(!0).describe(`Supports DELETE operations`),bulkCreate:L().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:L().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:L().default(!1).describe(`Supports bulk DELETE operations`),transactions:L().default(!1).describe(`Supports ACID transactions`),savepoints:L().default(!1).describe(`Supports transaction savepoints`),isolationLevels:z(Kh).optional().describe(`Supported isolation levels`),queryFilters:L().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:L().default(!1).describe(`Supports GROUP BY and aggregation functions`),queryDateGranularity:H(ap,L()).optional().describe(`Per-granularity native date bucketing (day/week/month/quarter/year). Missing keys fall back to in-memory bucketing.`),querySorting:L().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:L().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:L().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:L().default(!1).describe(`Supports subqueries`),queryCTE:L().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:L().default(!1).describe(`Supports SQL joins`),fullTextSearch:L().default(!1).describe(`Supports full-text search`),jsonQuery:L().default(!1).describe(`Supports JSON field querying`),geospatialQuery:L().default(!1).describe(`Supports geospatial queries`),streaming:L().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:L().default(!1).describe(`Supports JSON field types`),arrayFields:L().default(!1).describe(`Supports array field types`),vectorSearch:L().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:L().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:L().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:L().default(!1).describe(`Supports database migrations`),indexes:L().default(!1).describe(`Supports index creation and management`),connectionPooling:L().default(!1).describe(`Supports connection pooling`),preparedStatements:L().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:L().default(!1).describe(`Supports query result caching`)}));G(()=>B({name:F().describe(`Driver unique name`),version:F().describe(`Driver version`),supports:Jh,connect:Uf().input(mf([])).output(Vf(nf())).describe(`Establish connection`),disconnect:Uf().input(mf([])).output(Vf(nf())).describe(`Close connection`),checkHealth:Uf().input(mf([])).output(Vf(L())).describe(`Health check`),getPoolStats:Uf().input(mf([])).output(B({total:I(),idle:I(),active:I(),waiting:I()}).optional()).optional().describe(`Get connection pool statistics`),execute:Uf().input(mf([R(),z(R()).optional(),qh.optional()])).output(Vf(R())).describe(`Execute raw command`),find:Uf().input(mf([F(),_p,qh.optional()])).output(Vf(z(H(F(),R())))).describe(`Find records`),findStream:Uf().input(mf([F(),_p,qh.optional()])).output(R()).describe(`Stream records (AsyncIterable)`),findOne:Uf().input(mf([F(),_p,qh.optional()])).output(Vf(H(F(),R()).nullable())).describe(`Find one record`),create:Uf().input(mf([F(),H(F(),R()),qh.optional()])).output(Vf(H(F(),R()))).describe(`Create record`),update:Uf().input(mf([F(),F().or(I()),H(F(),R()),qh.optional()])).output(Vf(H(F(),R()))).describe(`Update record`),upsert:Uf().input(mf([F(),H(F(),R()),z(F()).optional(),qh.optional()])).output(Vf(H(F(),R()))).describe(`Upsert record`),delete:Uf().input(mf([F(),F().or(I()),qh.optional()])).output(Vf(L())).describe(`Delete record`),count:Uf().input(mf([F(),_p.optional(),qh.optional()])).output(Vf(I())).describe(`Count records`),bulkCreate:Uf().input(mf([F(),z(H(F(),R())),qh.optional()])).output(Vf(z(H(F(),R())))),bulkUpdate:Uf().input(mf([F(),z(B({id:F().or(I()),data:H(F(),R())})),qh.optional()])).output(Vf(z(H(F(),R())))),bulkDelete:Uf().input(mf([F(),z(F().or(I())),qh.optional()])).output(Vf(nf())),updateMany:Uf().input(mf([F(),_p,H(F(),R()),qh.optional()])).output(Vf(I())).optional(),deleteMany:Uf().input(mf([F(),_p,qh.optional()])).output(Vf(I())).optional(),beginTransaction:Uf().input(mf([B({isolationLevel:Kh.optional()}).optional()])).output(Vf(R())).describe(`Start transaction`),commit:Uf().input(mf([R()])).output(Vf(nf())).describe(`Commit transaction`),rollback:Uf().input(mf([R()])).output(Vf(nf())).describe(`Rollback transaction`),syncSchema:Uf().input(mf([F(),R(),qh.optional()])).output(Vf(nf())).describe(`Sync object schema to DB`),syncSchemasBatch:Uf().input(mf([z(B({object:F(),schema:R()})),qh.optional()])).output(Vf(nf())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:Uf().input(mf([F(),qh.optional()])).output(Vf(nf())),explain:Uf().input(mf([F(),_p,qh.optional()])).output(Vf(R())).optional()}));var Yh=G(()=>B({min:I().min(0).default(2).describe(`Minimum number of connections in pool`),max:I().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:I().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:I().min(0).default(5e3).describe(`Time in ms to wait for available connection`)})),Xh=G(()=>B({name:F().describe(`Driver instance name`),type:U([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:Jh.describe(`Driver capability flags`),connectionString:F().optional().describe(`Database connection string (driver-specific format)`),poolConfig:Yh.optional().describe(`Connection pool configuration`)})),Zh=G(()=>U([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`])),Qh=G(()=>B({text:F().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:F().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:F().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:F().describe(`SQL type for date fields (e.g., DATE)`),datetime:F().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:F().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:F().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:F().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)})),$h=G(()=>B({rejectUnauthorized:L().default(!0).describe(`Reject connections with invalid certificates`),ca:F().optional().describe(`CA certificate file path or content`),cert:F().optional().describe(`Client certificate file path or content`),key:F().optional().describe(`Client private key file path or content`)}).refine(e=>e.cert!==void 0==(e.key!==void 0),{message:`Client certificate (cert) and private key (key) must be provided together`}));G(()=>Xh.extend({type:W(`sql`).describe(`Driver type must be "sql"`),dialect:Zh.describe(`SQL database dialect`),dataTypeMapping:Qh.describe(`SQL data type mapping configuration`),ssl:L().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:$h.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`}));var eg=G(()=>U([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]));G(()=>U([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]));var tg=G(()=>U([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`])),ng=G(()=>U([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`])),rg=G(()=>B({enabled:L().default(!1).describe(`Enable sharding`),shardKey:F().optional().describe(`Field to use as shard key`),shardingStrategy:U([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:I().int().positive().optional().describe(`Number of shards`)})),ig=G(()=>B({enabled:L().default(!1).describe(`Enable replication`),replicaSetName:F().optional().describe(`Replica set name`),replicas:I().int().positive().optional().describe(`Number of replicas`),readPreference:U([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:U([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)})),ag=G(()=>B({enabled:L().default(!1).describe(`Enable schema validation`),validationLevel:U([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:U([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:H(F(),R()).optional().describe(`JSON Schema for validation`)})),og=G(()=>B({text:F().describe(`NoSQL type for text fields`),number:F().describe(`NoSQL type for number fields`),boolean:F().describe(`NoSQL type for boolean fields`),date:F().describe(`NoSQL type for date fields`),datetime:F().describe(`NoSQL type for datetime fields`),json:F().optional().describe(`NoSQL type for JSON/object fields`),uuid:F().optional().describe(`NoSQL type for UUID fields`),binary:F().optional().describe(`NoSQL type for binary fields`),array:F().optional().describe(`NoSQL type for array fields`),objectId:F().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:F().optional().describe(`NoSQL type for geospatial point fields`)}));G(()=>Xh.extend({type:W(`nosql`).describe(`Driver type must be "nosql"`),databaseType:eg.describe(`Specific NoSQL database type`),dataTypeMapping:og.describe(`NoSQL data type mapping configuration`),consistency:tg.optional().describe(`Consistency level for operations`),replication:ig.optional().describe(`Replication configuration`),sharding:rg.optional().describe(`Sharding configuration`),schemaValidation:ag.optional().describe(`Document schema validation`),region:F().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:F().optional().describe(`AWS access key ID`),secretAccessKey:F().optional().describe(`AWS secret access key`),ttlField:F().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:I().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:F().optional().describe(`Prefix for collection/table names`)}));var sg=G(()=>B({consistency:tg.optional().describe(`Consistency level override`),readFromSecondary:L().optional().describe(`Allow reading from secondary replicas`),projection:H(F(),V([W(0),W(1)])).optional().describe(`Field projection`),timeout:I().int().positive().optional().describe(`Query timeout (ms)`),useCursor:L().optional().describe(`Use cursor instead of loading all results`),batchSize:I().int().positive().optional().describe(`Cursor batch size`),profile:L().optional().describe(`Enable query profiling`),hint:F().optional().describe(`Index hint for query optimization`)})),cg=G(()=>B({operator:F().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:H(F(),R()).describe(`Stage-specific options`)}));G(()=>B({collection:F().describe(`Collection/table name`),stages:z(cg).describe(`Aggregation pipeline stages`),options:sg.optional().describe(`Query options`)})),G(()=>B({name:F().describe(`Index name`),type:ng.describe(`Index type`),fields:z(B({field:F().describe(`Field name`),order:U([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:L().default(!1).describe(`Enforce uniqueness`),sparse:L().default(!1).describe(`Sparse index`),expireAfterSeconds:I().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:H(F(),R()).optional().describe(`Partial index filter`),background:L().default(!1).describe(`Create index in background`)})),G(()=>B({readConcern:U([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:U([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:U([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:I().int().positive().optional().describe(`Transaction commit timeout (ms)`)}));var lg=U([`insert`,`update`,`upsert`,`replace`,`ignore`]),ug=G(()=>B({object:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:F().default(`name`).describe(`Field match for uniqueness check`),mode:lg.default(`upsert`).describe(`Conflict resolution strategy`),env:z(U([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:z(H(F(),R())).describe(`Data records`)}));rh({schemaId:`object`,type:`simple`,sections:[{name:`basics`,label:`Basics`,description:`Identity, labels, and taxonomy.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,immutable:!0,colSpan:1,helpText:`snake_case unique identifier (immutable after creation)`},{field:`label`,type:`text`,colSpan:1,helpText:`Singular display name (e.g. "Account")`},{field:`pluralLabel`,type:`text`,colSpan:1,helpText:`Plural display name (e.g. "Accounts")`},{field:`icon`,type:`text`,colSpan:1,helpText:`Lucide icon name (e.g. "building", "users")`},{field:`description`,type:`textarea`,colSpan:2,helpText:`Developer documentation`},{field:`tags`,type:`tags`,colSpan:2,helpText:`Categorization tags (e.g. "sales", "system")`},{field:`active`,type:`boolean`,colSpan:1,helpText:`Is the object active and usable`},{field:`isSystem`,type:`boolean`,colSpan:1,helpText:`System object (protected from deletion)`},{field:`abstract`,type:`boolean`,colSpan:1,helpText:`Abstract base (cannot be instantiated)`}]},{name:`fields`,label:`Fields`,description:`Define the data model — each entry becomes a column in the database table.`,fields:[{field:`fields`,type:`record`,required:!0,helpText:`Add the columns this object will store`,keyField:{field:`name`,label:`Name`,placeholder:`snake_case_identifier`,helpText:`snake_case machine name (used as column name and API key)`,regex:`^[a-z_][a-z0-9_]*$`,immutable:!0},fields:[{field:`label`,type:`text`,helpText:`Display label`},{field:`type`,type:`select`,required:!0,helpText:`Field type`,options:[{label:`Text`,value:`text`},{label:`Textarea`,value:`textarea`},{label:`Email`,value:`email`},{label:`URL`,value:`url`},{label:`Phone`,value:`phone`},{label:`Password`,value:`password`},{label:`Markdown`,value:`markdown`},{label:`HTML`,value:`html`},{label:`Rich Text`,value:`richtext`},{label:`Number`,value:`number`},{label:`Currency`,value:`currency`},{label:`Percent`,value:`percent`},{label:`Date`,value:`date`},{label:`Date & Time`,value:`datetime`},{label:`Time`,value:`time`},{label:`Boolean`,value:`boolean`},{label:`Toggle`,value:`toggle`},{label:`Select`,value:`select`},{label:`Multiselect`,value:`multiselect`},{label:`Radio`,value:`radio`},{label:`Checkboxes`,value:`checkboxes`},{label:`Lookup (reference)`,value:`lookup`},{label:`Master–Detail`,value:`master_detail`},{label:`Tree`,value:`tree`},{label:`Image`,value:`image`},{label:`File`,value:`file`},{label:`Avatar`,value:`avatar`},{label:`Video`,value:`video`},{label:`Audio`,value:`audio`},{label:`Formula (computed)`,value:`formula`},{label:`Summary (rollup)`,value:`summary`},{label:`Autonumber`,value:`autonumber`},{label:`Composite (embedded)`,value:`composite`},{label:`Repeater (embedded array)`,value:`repeater`},{label:`Record (keyed map)`,value:`record`},{label:`Location (GPS)`,value:`location`},{label:`Address`,value:`address`},{label:`Code`,value:`code`},{label:`JSON`,value:`json`},{label:`Color`,value:`color`},{label:`Rating`,value:`rating`},{label:`Slider`,value:`slider`},{label:`Signature`,value:`signature`},{label:`QR / Barcode`,value:`qrcode`},{label:`Progress`,value:`progress`},{label:`Tags`,value:`tags`},{label:`Vector embedding`,value:`vector`}]},{field:`description`,type:`textarea`,helpText:`Developer documentation for this column`},{field:`required`,type:`boolean`,helpText:`Must be set on every record`},{field:`unique`,type:`boolean`,helpText:`Disallow duplicate values`},{field:`indexed`,type:`boolean`,helpText:`Create a database index for faster querying`},{field:`readonly`,type:`boolean`,helpText:`Visible but never user-editable`},{field:`immutable`,type:`boolean`,helpText:`Editable on create, locked thereafter`},{field:`hidden`,type:`boolean`,helpText:`Hidden from default UI`},{field:`searchable`,type:`boolean`,helpText:`Include in full-text search`},{field:`sortable`,type:`boolean`,helpText:`Allow sorting on this column`},{field:`filterable`,type:`boolean`,helpText:`Allow filtering on this column`},{field:`defaultValue`,type:`text`,helpText:`Default value for new records (JSON literal)`},{field:`placeholder`,type:`text`,helpText:`Placeholder hint`},{field:`maxLength`,type:`number`,helpText:`Max characters`,visibleOn:`type in ['text','textarea','email','url','phone','password','markdown','html','richtext']`},{field:`minLength`,type:`number`,helpText:`Min characters`,visibleOn:`type in ['text','textarea','email','url','phone','password','markdown','html','richtext']`},{field:`min`,type:`number`,helpText:`Minimum value`,visibleOn:`type in ['number','currency','percent','rating','slider','progress']`},{field:`max`,type:`number`,helpText:`Maximum value`,visibleOn:`type in ['number','currency','percent','rating','slider','progress']`},{field:`precision`,type:`number`,helpText:`Total digits`,visibleOn:`type in ['number','currency','percent']`},{field:`scale`,type:`number`,helpText:`Decimal places`,visibleOn:`type in ['number','currency','percent']`},{field:`options`,type:`repeater`,helpText:`Available choices`,visibleOn:`type in ['select','multiselect','radio','checkboxes']`,fields:[{field:`label`,type:`text`,required:!0},{field:`value`,type:`text`,required:!0},{field:`color`,type:`color`},{field:`icon`,type:`text`,helpText:`Lucide icon name`},{field:`description`,type:`text`}]},{field:`reference`,type:`text`,helpText:`Target object name`,visibleOn:`type in ['lookup','master_detail','tree']`},{field:`referenceFilter`,type:`code`,language:`expression`,helpText:`CEL filter applied to the picker`,visibleOn:`type in ['lookup','master_detail']`},{field:`cascadeDelete`,type:`boolean`,helpText:`Delete children when parent is deleted`,visibleOn:`type == 'master_detail'`},{field:`multiple`,type:`boolean`,helpText:`Allow selecting multiple records`,visibleOn:`type in ['lookup']`},{field:`formula`,type:`code`,language:`expression`,helpText:`CEL formula expression`,visibleOn:`type == 'formula'`},{field:`returnType`,type:`select`,helpText:`Result type for formulas`,visibleOn:`type == 'formula'`,options:[{label:`Text`,value:`text`},{label:`Number`,value:`number`},{label:`Boolean`,value:`boolean`},{label:`Date`,value:`date`},{label:`Datetime`,value:`datetime`},{label:`Currency`,value:`currency`}]},{field:`summaryType`,type:`select`,helpText:`Aggregation`,visibleOn:`type == 'summary'`,options:[{label:`Count`,value:`count`},{label:`Sum`,value:`sum`},{label:`Avg`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{field:`summaryField`,type:`text`,helpText:`Field on child object to aggregate`,visibleOn:`type == 'summary'`},{field:`displayFormat`,type:`text`,helpText:`e.g. "INV-{0000}"`,visibleOn:`type == 'autonumber'`},{field:`startingNumber`,type:`number`,helpText:`Starting sequence value`,visibleOn:`type == 'autonumber'`},{field:`language`,type:`text`,helpText:`Editor language (e.g. sql, javascript)`,visibleOn:`type == 'code'`},{field:`validation`,type:`code`,language:`expression`,helpText:`CEL predicate — must evaluate true`},{field:`errorMessage`,type:`text`,helpText:`Shown when validation fails`},{field:`audit`,type:`boolean`,helpText:`Audit changes to this field`},{field:`trackHistory`,type:`boolean`,helpText:`Keep change history`},{field:`pii`,type:`boolean`,helpText:`Personally identifiable information`},{field:`encrypted`,type:`boolean`,helpText:`Encrypt at rest`}]}]},{name:`capabilities`,label:`Capabilities`,description:`System features and API exposure.`,collapsible:!0,collapsed:!0,fields:[{field:`capabilities`,type:`composite`,helpText:`Enable/disable system features`,fields:[{field:`trackHistory`,type:`boolean`},{field:`searchable`,type:`boolean`},{field:`apiEnabled`,type:`boolean`},{field:`files`,type:`boolean`},{field:`feeds`,type:`boolean`},{field:`activities`,type:`boolean`},{field:`trash`,type:`boolean`},{field:`mru`,type:`boolean`},{field:`clone`,type:`boolean`}]}]},{name:`advanced`,label:`Advanced`,description:`State machines, actions, and storage.`,collapsible:!0,collapsed:!0,fields:[{field:`datasource`,type:`text`,helpText:`Target datasource ID (default: "default")`}]}]}),rh({schemaId:`field`,type:`simple`,sections:[{name:`basics`,label:`Basics`,description:`Core field identity and constraints.`,columns:2,fields:[{field:`name`,required:!0,immutable:!0,colSpan:1,helpText:`Unique identifier (snake_case, immutable after creation)`},{field:`label`,required:!0,colSpan:1,helpText:`Display name for users`},{field:`type`,required:!0,colSpan:1,helpText:`Data type of this field`},{field:`group`,colSpan:1,helpText:`Group name for form layout`},{field:`description`,widget:`textarea`,colSpan:2,helpText:`Help text shown to users`},{field:`required`,colSpan:1,helpText:`User must provide a value`},{field:`unique`,colSpan:1,helpText:`No two records can have the same value`},{field:`multiple`,colSpan:1,helpText:`Allow multiple values (for select/lookup)`}]},{name:`configuration`,label:`Configuration`,description:`Field-type specific settings (visible blocks depend on the chosen type).`,fields:[{field:`defaultValue`,helpText:`Default value for new records`},{field:`minLength`,visibleOn:`data.type == 'text' || data.type == 'textarea' || data.type == 'email'`,helpText:`Minimum character length`},{field:`maxLength`,visibleOn:`data.type == 'text' || data.type == 'textarea' || data.type == 'email'`,helpText:`Maximum character length`},{field:`min`,visibleOn:`data.type == 'number' || data.type == 'currency'`,helpText:`Minimum value`},{field:`max`,visibleOn:`data.type == 'number' || data.type == 'currency'`,helpText:`Maximum value`},{field:`precision`,visibleOn:`data.type == 'currency' || data.type == 'number'`,helpText:`Decimal places (e.g., 2 for $10.50)`},{field:`scale`,visibleOn:`data.type == 'number'`,helpText:`Number of decimal digits`},{field:`options`,type:`repeater`,visibleOn:`data.type == 'select' || data.type == 'multiselect'`,helpText:`Available options (label/value pairs)`},{field:`reference`,widget:`ref:object`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`Referenced object name`},{field:`referenceFilters`,widget:`string-tags`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`Filter expressions (e.g., "active = true")`},{field:`deleteBehavior`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`What happens when referenced record is deleted`}]},{name:`formula`,label:`Formula & Computed`,description:`Calculated values and roll-up summaries.`,collapsible:!0,collapsed:!0,fields:[{field:`expression`,widget:`textarea`,helpText:`CEL expression to calculate this field (makes it read-only)`},{field:`summaryOperations`,type:`composite`,helpText:`Roll-up summary configuration (for parent-child relationships)`},{field:`cached`,type:`composite`,helpText:`Caching configuration for computed fields`}]},{name:`advanced`,label:`Advanced`,description:`Database, UI, audit, and security settings.`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`columnName`,colSpan:2,helpText:`Physical column name in database (defaults to field name)`},{field:`index`,colSpan:1,helpText:`Create database index for faster queries`},{field:`externalId`,colSpan:1,helpText:`Mark as external ID for upsert operations`},{field:`readonly`,colSpan:1,helpText:`Field is read-only in forms`},{field:`hidden`,colSpan:1,helpText:`Hide field from default UI views`},{field:`searchable`,colSpan:1,helpText:`Include in global search results`},{field:`sortable`,colSpan:1,helpText:`Allow sorting lists by this field`},{field:`auditTrail`,colSpan:1,helpText:`Track detailed changes with user and timestamp`},{field:`trackFeedHistory`,colSpan:1,helpText:`Show changes in activity feed`},{field:`encryptionConfig`,type:`composite`,colSpan:2,helpText:`Field-level encryption (GDPR/HIPAA/PCI-DSS)`},{field:`maskingRule`,type:`composite`,colSpan:2,helpText:`Data masking rules for PII protection`}]}]}),rh({schemaId:`hook`,type:`simple`,sections:[{label:`Identity`,description:`What this hook is and when it fires.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,immutable:!0,colSpan:1,helpText:`snake_case identifier (immutable after creation)`},{field:`label`,type:`text`,colSpan:1},{field:`description`,type:`textarea`,colSpan:2},{field:`object`,type:`text`,required:!0,colSpan:1,helpText:`Target object name (or "*" for global)`},{field:`events`,type:`tags`,required:!0,colSpan:1,helpText:`Lifecycle events (e.g. beforeInsert, afterUpdate)`},{field:`priority`,type:`number`,colSpan:1,helpText:`Lower numbers run first`}]},{label:`Body`,description:`Inline expression or sandboxed JavaScript executed when the hook fires.`,fields:[{field:`body`,type:`composite`,helpText:`Either an L1 expression or an L2 sandboxed JS body`,fields:[{field:`language`,type:`select`,required:!0,helpText:`expression = pure formula; js = sandboxed JavaScript`,options:[{label:`Expression (L1)`,value:`expression`},{label:`JavaScript (L2 sandboxed)`,value:`js`}]},{field:`source`,type:`code`,language:`javascript`,required:!0,helpText:`Function body source — no top-level imports`},{field:`capabilities`,type:`tags`,helpText:`Allowed ctx APIs (api.read, api.write, crypto.uuid, log, …)`},{field:`timeoutMs`,type:`number`,helpText:`Per-invocation timeout (ms)`}]}]},{label:`Legacy handler`,description:`Function name reference — deprecated in favour of body.`,collapsible:!0,collapsed:!0,fields:[{field:`handler`,type:`text`,helpText:"Handler function name (deprecated — prefer `body`)"}]},{label:`Execution`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`async`,type:`boolean`,colSpan:1,helpText:`Run in background, do not block the transaction`},{field:`onError`,type:`select`,colSpan:1,options:[{label:`Abort`,value:`abort`},{label:`Log`,value:`log`}]},{field:`condition`,type:`code`,language:`javascript`,colSpan:2,helpText:`Optional formula — skip the hook when this evaluates to false`}]}]});var dg=G(()=>B({field:F().describe(`Source field name containing the reference value`),targetObject:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:F().default(`name`).describe(`Field on target object used for matching`),fieldType:U([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`)),fg=G(()=>B({object:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:z(F()).describe(`Objects this object depends on`),references:z(dg).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`)),pg=G(()=>B({nodes:z(fg).describe(`All objects in the dependency graph`),insertOrder:z(F()).describe(`Topologically sorted insert order`),circularDependencies:z(z(F())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`)),mg=G(()=>B({sourceObject:F().describe(`Object with the broken reference`),field:F().describe(`Field name with unresolved reference`),targetObject:F().describe(`Target object searched for the reference`),targetField:F().describe(`ExternalId field used for matching`),attemptedValue:R().describe(`Value that failed to resolve`),recordIndex:I().int().min(0).describe(`Index of the record in the dataset`),message:F().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`)),hg=G(()=>B({dryRun:L().default(!1).describe(`Validate references without writing data`),haltOnError:L().default(!1).describe(`Stop on first reference resolution error`),multiPass:L().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:lg.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:I().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:L().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:U([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`),organizationId:F().min(1).optional().describe(`Target organization id for per-tenant seed replay`)}).describe(`Seed data loader configuration`)),gg=G(()=>B({object:F().describe(`Object that was loaded`),mode:lg.describe(`Import mode used`),inserted:I().int().min(0).describe(`Records inserted`),updated:I().int().min(0).describe(`Records updated`),skipped:I().int().min(0).describe(`Records skipped`),errored:I().int().min(0).describe(`Records with errors`),total:I().int().min(0).describe(`Total records in dataset`),referencesResolved:I().int().min(0).describe(`References resolved via externalId`),referencesDeferred:I().int().min(0).describe(`References deferred to second pass`),errors:z(mg).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`));G(()=>B({success:L().describe(`Overall success status`),dryRun:L().describe(`Whether this was a dry-run`),dependencyGraph:pg.describe(`Object dependency graph`),results:z(gg).describe(`Per-object load results`),errors:z(mg).describe(`All reference resolution errors`),summary:B({objectsProcessed:I().int().min(0).describe(`Total objects processed`),totalRecords:I().int().min(0).describe(`Total records across all objects`),totalInserted:I().int().min(0).describe(`Total records inserted`),totalUpdated:I().int().min(0).describe(`Total records updated`),totalSkipped:I().int().min(0).describe(`Total records skipped`),totalErrored:I().int().min(0).describe(`Total records with errors`),totalReferencesResolved:I().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:I().int().min(0).describe(`Total references deferred`),circularDependencyCount:I().int().min(0).describe(`Circular dependency chains detected`),durationMs:I().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`)),G(()=>B({datasets:z(ug).min(1).describe(`Datasets to load`),config:hg.default(()=>hg.parse({})).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`));var _g=G(()=>B({versionNumber:I().describe(`Version number`),createdAt:I().describe(`Creation timestamp`),createdBy:F().describe(`Creator user ID`),size:I().describe(`File size in bytes`),checksum:F().describe(`File checksum`),downloadUrl:F().url().describe(`Download URL`),isLatest:L().optional().default(!1).describe(`Is latest version`)})),vg=G(()=>B({id:F().describe(`Template ID`),name:F().describe(`Template name`),description:F().optional().describe(`Template description`),fileUrl:F().url().describe(`Template file URL`),fileType:F().describe(`File MIME type`),placeholders:z(B({key:F().describe(`Placeholder key`),label:F().describe(`Placeholder label`),type:U([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:L().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)})),yg=G(()=>B({provider:U([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:L().optional().default(!1).describe(`E-signature enabled`),signers:z(B({email:F().email().describe(`Signer email`),name:F().describe(`Signer name`),role:F().describe(`Signer role`),order:I().describe(`Signing order`)})).describe(`Document signers`),expirationDays:I().optional().default(30).describe(`Expiration days`),reminderDays:I().optional().default(7).describe(`Reminder interval days`)}));G(()=>B({id:F().describe(`Document ID`),name:F().describe(`Document name`),description:F().optional().describe(`Document description`),fileType:F().describe(`File MIME type`),fileSize:I().describe(`File size in bytes`),category:F().optional().describe(`Document category`),tags:z(F()).optional().describe(`Document tags`),versioning:B({enabled:L().describe(`Versioning enabled`),versions:z(_g).describe(`Version history`),majorVersion:I().describe(`Major version`),minorVersion:I().describe(`Minor version`)}).optional().describe(`Version control`),template:vg.optional().describe(`Document template`),eSignature:yg.optional().describe(`E-signature config`),access:B({isPublic:L().optional().default(!1).describe(`Public access`),sharedWith:z(F()).optional().describe(`Shared with`),expiresAt:I().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:H(F(),R()).optional().describe(`Custom metadata`)}));var bg=G(()=>uf(`type`,[B({type:W(`constant`),value:R().describe(`Constant value to use`)}).describe(`Set a constant value`),B({type:W(`cast`),targetType:U([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),B({type:W(`lookup`),table:F().describe(`Lookup table name`),keyField:F().describe(`Field to match on`),valueField:F().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),B({type:W(`javascript`),expression:jp.describe(`JS expression (dialect="js" recommended). e.g. value.toUpperCase()`)}).describe(`Custom JavaScript transformation`),B({type:W(`map`),mappings:H(F(),R()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)])),xg=G(()=>B({source:F().describe(`Source field name`),target:F().describe(`Target field name`),transform:bg.optional().describe(`Transformation to apply`),defaultValue:R().optional().describe(`Default if source is null/undefined`)})),Sg=G(()=>B({id:F().describe(`Data source ID`),name:F().describe(`Data source name`),type:U([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:F().url().describe(`API endpoint URL`),authentication:B({type:U([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:H(F(),R()).describe(`Auth configuration`)}).describe(`Authentication`)})),Cg=G(()=>xg.extend({type:F().optional().describe(`Field type`),readonly:L().optional().default(!0).describe(`Read-only field`)}));G(()=>B({fieldName:F().describe(`Field name`),dataSource:Sg.describe(`External data source`),query:B({endpoint:F().describe(`Query endpoint path`),method:U([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:H(F(),R()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:z(Cg).describe(`Field mappings`),caching:B({enabled:L().optional().default(!0).describe(`Cache enabled`),ttl:I().optional().default(300).describe(`Cache TTL (seconds)`),strategy:U([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:B({enabled:L().optional().default(!0).describe(`Fallback enabled`),defaultValue:R().optional().describe(`Default fallback value`),showError:L().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:B({requestsPerSecond:I().describe(`Requests per second limit`),burstSize:I().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:B({maxRetries:I().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:I().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:I().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:I().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:z(I()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:B({request:B({headers:H(F(),F()).optional().describe(`Additional request headers`),queryParams:H(F(),F()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:B({dataPath:F().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:F().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:B({type:U([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:I().default(100).describe(`Items per page`),maxPages:I().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)}));var wg=F().describe(`Underlying driver identifier`);G(()=>B({id:F().describe(`Unique driver identifier (e.g. "postgres")`),label:F().describe(`Display label (e.g. "PostgreSQL")`),description:F().optional(),icon:F().optional(),configSchema:H(F(),R()).describe(`JSON Schema for connection configuration`),capabilities:zf(()=>Tg).optional()}));var Tg=B({transactions:L().default(!1),queryFilters:L().default(!1),queryAggregations:L().default(!1),querySorting:L().default(!1),queryPagination:L().default(!1),queryWindowFunctions:L().default(!1),querySubqueries:L().default(!1),joins:L().default(!1),fullTextSearch:L().default(!1),readOnly:L().default(!1),dynamicSchema:L().default(!1)});G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:F().optional().describe(`Display label`),driver:wg.describe(`Underlying driver type`),config:H(F(),R()).describe(`Driver specific configuration`),pool:B({min:I().default(0).describe(`Minimum connections`),max:I().default(10).describe(`Maximum connections`),idleTimeoutMillis:I().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:I().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:z(H(F(),R())).optional().describe(`Read-only replica configurations`),capabilities:Tg.optional().describe(`Capability overrides`),healthCheck:B({enabled:L().default(!0).describe(`Enable health check endpoint`),intervalMs:I().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:I().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:B({enabled:L().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:L().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:F().optional().describe(`CA certificate (PEM format or path to file)`),cert:F().optional().describe(`Client certificate (PEM format or path to file)`),key:F().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:B({maxRetries:I().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:I().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:I().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:I().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:F().optional().describe(`Internal description`),active:L().default(!0).describe(`Is datasource enabled`)}));var Eg=U([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),Dg=U([`string`,`number`,`boolean`,`time`,`geo`]),Og=U([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),kg=G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:F().describe(`Human readable label`),description:F().optional(),type:Eg,sql:F().describe(`SQL expression or field reference`),filters:z(B({sql:F()})).optional(),format:F().optional()})),Ag=G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:F().describe(`Human readable label`),description:F().optional(),type:Dg,sql:F().describe(`SQL expression or column reference`),granularities:z(Og).optional()})),jg=G(()=>B({name:F().describe(`Target cube name`),relationship:U([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:F().describe(`Join condition (ON clause)`)}));G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:F().optional(),description:F().optional(),sql:F().describe(`Base SQL statement or Table Name`),measures:H(F(),kg).describe(`Quantitative metrics`),dimensions:H(F(),Ag).describe(`Qualitative attributes`),joins:H(F(),jg).optional(),refreshKey:B({every:F().optional(),sql:F().optional()}).optional(),public:L().default(!1)})),G(()=>B({cube:F().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:z(F()).describe(`List of metrics to calculate`),dimensions:z(F()).optional().describe(`List of dimensions to group by`),where:Zf.optional().describe(`Filtering criteria (canonical Query DSL FilterCondition)`),timeDimensions:z(B({dimension:F(),granularity:Og.optional(),dateRange:V([F(),z(F())]).optional()})).optional(),order:H(F(),U([`asc`,`desc`])).optional(),limit:I().optional(),offset:I().optional(),timezone:F().optional().default(`UTC`)}));var Mg=U([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Ng=G(()=>B({type:U([`user`,`team`,`record`]).describe(`Mention target type`),id:F().describe(`Target ID`),name:F().describe(`Display name for rendering`),offset:I().int().min(0).describe(`Character offset in body text`),length:I().int().min(1).describe(`Length of mention token in body text`)})),Pg=G(()=>B({field:F().describe(`Field machine name`),fieldLabel:F().optional().describe(`Field display label`),oldValue:R().optional().describe(`Previous value`),newValue:R().optional().describe(`New value`),oldDisplayValue:F().optional().describe(`Human-readable old value`),newDisplayValue:F().optional().describe(`Human-readable new value`)})),Fg=G(()=>B({emoji:F().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:z(F()).describe(`Users who reacted`),count:I().int().min(1).describe(`Total reaction count`)})),Ig=G(()=>B({type:U([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:F().describe(`Actor ID`),name:F().optional().describe(`Actor display name`),avatarUrl:F().url().optional().describe(`Actor avatar URL`),source:F().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)})),Lg=U([`public`,`internal`,`private`]);G(()=>B({id:F().describe(`Feed item ID`),type:Mg.describe(`Activity type`),object:F().describe(`Object name (e.g., "account")`),recordId:F().describe(`Record ID this feed item belongs to`),actor:Ig.describe(`Who performed this action`),body:F().optional().describe(`Rich text body (Markdown supported)`),mentions:z(Ng).optional().describe(`Mentioned users/teams/records`),changes:z(Pg).optional().describe(`Field-level changes`),reactions:z(Fg).optional().describe(`Emoji reactions on this item`),parentId:F().optional().describe(`Parent feed item ID for threaded replies`),replyCount:I().int().min(0).default(0).describe(`Number of replies`),pinned:L().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:F().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:F().optional().describe(`User ID who pinned the item`),starred:L().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:F().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Lg.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:F().datetime().describe(`Creation timestamp`),updatedAt:F().datetime().optional().describe(`Last update timestamp`),editedAt:F().datetime().optional().describe(`When comment was last edited`),isEdited:L().default(!1).describe(`Whether comment has been edited`)})),U([`all`,`comments_only`,`changes_only`,`tasks_only`]);var Rg=U([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),zg=U([`in_app`,`email`,`push`,`slack`]);G(()=>B({object:F().describe(`Object name`),recordId:F().describe(`Record ID`),userId:F().describe(`Subscribing user ID`),events:z(Rg).default([`all`]).describe(`Event types to receive notifications for`),channels:z(zg).default([`in_app`]).describe(`Notification delivery channels`),active:L().default(!0).describe(`Whether the subscription is active`),createdAt:F().datetime().describe(`Subscription creation timestamp`)}));var Bg=(e=>l===void 0?typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(l===void 0?e:l)[t]}):e:l)(function(e){if(l!==void 0)return l.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),Vg={debug:0,info:1,warn:2,error:3,fatal:4,silent:5},Hg={debug:`\x1B[36m`,info:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`,fatal:`\x1B[35m`,silent:``},Ug=`\x1B[0m`,Wg=class e{constructor(e={},t={}){this.config={name:e.name,level:e.level??`info`,format:e.format??`pretty`,redact:e.redact??[`password`,`token`,`secret`,`key`],sourceLocation:e.sourceLocation??!1,file:e.file,rotation:e.rotation??{maxSize:`10m`,maxFiles:5}},this.bindings=t,this.config.file&&typeof process<`u`&&this.openFileStream(this.config.file)}openFileStream(e){try{let t=Bg(`fs`),n=Bg(`path`).dirname(e);t.mkdirSync(n,{recursive:!0}),this.fileStream=t.createWriteStream(e,{flags:`a`})}catch{}}isEnabled(e){return Vg[e]>=Vg[this.config.level]}redactSensitive(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?[...e]:{...e};for(let e in t){let n=e.toLowerCase();this.config.redact.some(e=>n.includes(e.toLowerCase()))?t[e]=`***REDACTED***`:typeof t[e]==`object`&&t[e]!==null&&(t[e]=this.redactSensitive(t[e]))}return t}write(e,t,n,r){if(!this.isEnabled(e))return;let i=this.redactSensitive({...this.bindings,...n,...r?{error:{message:r.message,stack:r.stack}}:{}}),a=Object.keys(i).length>0,o=new Date().toISOString(),s;if(this.config.format===`json`)s=JSON.stringify({time:o,level:e,...this.config.name?{name:this.config.name}:{},msg:t,...i});else if(this.config.format===`text`){let n=[o,e.toUpperCase(),t];a&&n.push(JSON.stringify(i)),s=n.join(` | `)}else{let n=Hg[e]||``,r=this.config.name?`[${this.config.name}] `:``;s=`${n}${o} ${e.toUpperCase()}${Ug} ${r}${t}`,a&&(s+=` ${JSON.stringify(i)}`)}let c=s+`
|
|
103
|
-
`;typeof process<`u`&&process.stderr?e===`error`||e===`fatal`?process.stderr.write(c):process.stdout?.write(c):typeof console<`u`&&(e===`error`||e===`fatal`?console.error:e===`warn`?console.warn:e===`debug`?console.debug:console.log)(s),this.fileStream&&this.fileStream.write(c)}debug(e,t){this.write(`debug`,e,t)}info(e,t){this.write(`info`,e,t)}warn(e,t){this.write(`warn`,e,t)}error(e,t,n){t instanceof Error?this.write(`error`,e,n,t):this.write(`error`,e,t)}fatal(e,t,n){t instanceof Error?this.write(`fatal`,e,n,t):this.write(`fatal`,e,t)}log(e,...t){this.info(e,t.length>0?{args:t}:void 0)}child(t){let n=new e(this.config,{...this.bindings,...t});return n.fileStream=this.fileStream,n}withTrace(e,t){return this.child({traceId:e,spanId:t})}async destroy(){this.fileStream&&=(await new Promise(e=>this.fileStream.end(e)),void 0)}};function Gg(e){return new Wg(e)}var Kg=class{constructor(e,t){this.subscriptions=new Map,this.eventBuffer=[],this._baseUrl=e,this._token=t}subscribeMetadata(e,t,n){let r=`metadata-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,packageId:n?.packageId,eventTypes:[`metadata.${e}.created`,`metadata.${e}.updated`,`metadata.${e}.deleted`]},handler:e=>{e.type.startsWith(`metadata.`)&&t(e)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}subscribeData(e,t,n){let r=`data-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,recordId:n?.recordId,eventTypes:[`data.record.created`,`data.record.updated`,`data.record.deleted`]},handler:r=>{r.type.startsWith(`data.`)&&r.object===e&&(!n?.recordId||r.payload?.recordId===n.recordId)&&t(r)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}emitEvent(e){for(let t of this.subscriptions.values()){let n=!t.filter.type||e.type.includes(t.filter.type)||e.object===t.filter.type,r=!t.filter.eventTypes?.length||t.filter.eventTypes.includes(e.type),i=!t.filter.packageId||e.payload?.packageId===t.filter.packageId;if(n&&r&&i)try{t.handler(e)}catch(e){console.error(`Error in realtime event handler:`,e)}}}startPolling(){this.pollInterval||=setInterval(()=>{for(;this.eventBuffer.length>0;){let e=this.eventBuffer.shift();e&&this.emitEvent(e)}},2e3)}stopPolling(){this.pollInterval&&=(clearInterval(this.pollInterval),void 0)}_bufferEvent(e){this.eventBuffer.push(e)}disconnect(){this.stopPolling(),this.subscriptions.clear(),this.eventBuffer=[]}},qg=class{constructor(e){this.meta={getTypes:async()=>{let e=this.getRoute(`metadata`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},getItems:async(e,t)=>{let n=this.getRoute(`metadata`),r=new URLSearchParams;t?.packageId&&r.set(`package`,t.packageId);let i=r.toString(),a=`${this.baseUrl}${n}/${e}${i?`?${i}`:``}`,o=await this.fetch(a);return this.unwrapResponse(o)},getItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.packageId&&i.set(`package`,n.packageId);let a=i.toString(),o=`${this.baseUrl}${r}/${e}/${t}${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},saveItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`PUT`,body:JSON.stringify(n)});return this.unwrapResponse(i)},deleteItem:async(e,t)=>{let n=this.getRoute(`metadata`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)},getHistory:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.sinceSeq!==void 0&&i.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&i.set(`limit`,String(n.limit));let a=i.toString(),o=`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},getCached:async(e,t)=>{let n=this.getRoute(`metadata`),r={};t?.ifNoneMatch&&(r[`If-None-Match`]=t.ifNoneMatch),t?.ifModifiedSince&&(r[`If-Modified-Since`]=t.ifModifiedSince);let i=await this.fetch(`${this.baseUrl}${n}/object/${e}`,{headers:r});if(i.status===304)return{notModified:!0,etag:t?.ifNoneMatch?{value:t.ifNoneMatch.replace(/^W\/|"/g,``),weak:t.ifNoneMatch.startsWith(`W/`)}:void 0};let a=await i.json(),o=i.headers.get(`ETag`),s=i.headers.get(`Last-Modified`);return{data:a,etag:o?{value:o.replace(/^W\/|"/g,``),weak:o.startsWith(`W/`)}:void 0,lastModified:s||void 0,notModified:!1}},getView:async(e,t=`list`)=>{let n=this.getRoute(`ui`),r=await this.fetch(`${this.baseUrl}${n}/view/${e}?type=${t}`);return this.unwrapResponse(r)}},this.analytics={query:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/query`,{method:`POST`,body:JSON.stringify(e)})).json()},meta:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/meta/${e}`)).json()},explain:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/explain`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.packages={list:async e=>{let t=this.getRoute(`packages`),n=new URLSearchParams;e?.status&&n.set(`status`,e.status),e?.type&&n.set(`type`,e.type),e?.enabled!==void 0&&n.set(`enabled`,String(e.enabled));let r=n.toString(),i=`${this.baseUrl}${t}${r?`?`+r:``}`,a=await this.fetch(i);return this.unwrapResponse(a)},get:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},install:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({manifest:e,settings:t?.settings,enableOnInstall:t?.enableOnInstall})});return this.unwrapResponse(r)},uninstall:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},enable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)}},this.projects={list:async e=>{let t=new URLSearchParams;e?.organization_id&&t.set(`organizationId`,e.organization_id),e?.env_type&&t.set(`envType`,e.env_type),e?.status&&t.set(`status`,e.status);let n=t.toString(),r=`${this.baseUrl}/api/v1/cloud/environments${n?`?`+n:``}`,i=await this.fetch(r);return this.unwrapResponse(i)},get:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`);return this.unwrapResponse(t)},create:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(t)},update:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)});return this.unwrapResponse(n)},delete:async(e,t)=>{let n=t?.force?`?force=1`:``,r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}${n}`,{method:`DELETE`});return this.unwrapResponse(r)},activate:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/activate`,{method:`POST`});return this.unwrapResponse(t)},rotateCredential:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/credentials/rotate`,{method:`POST`,body:JSON.stringify({plaintext:t})});return this.unwrapResponse(n)},updateHostname:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/hostname`,{method:`POST`,body:JSON.stringify({hostname:t})});return this.unwrapResponse(n)},updateVisibility:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({visibility:t})});return this.unwrapResponse(n)},listRevisions:async(e,t)=>{let n=new URLSearchParams;t?.limit&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor),t?.branch&&n.set(`branch`,t.branch);let r=n.toString(),i=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions${r?`?${r}`:``}`);return this.unwrapResponse(i)},listBranches:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches`);return this.unwrapResponse(t)},renameBranch:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({newName:n})});return this.unwrapResponse(r)},deleteBranch:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},activateRevision:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions/${encodeURIComponent(t)}/activate`,{method:`POST`});return this.unwrapResponse(n)},retryProvisioning:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/retry`,{method:`POST`});return this.unwrapResponse(t)},listMembers:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`);return this.unwrapResponse(t)},addMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return this.unwrapResponse(n)},updateMemberRole:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({role:n})});return this.unwrapResponse(r)},removeMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},listDrivers:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/drivers`);return this.unwrapResponse(e)},listTemplates:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/templates`);return this.unwrapResponse(e)},packages:{list:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`);return this.unwrapResponse(t)},install:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(n)},get:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`);return this.unwrapResponse(n)},enable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)},uninstall:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},upgrade:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/upgrade`,{method:`POST`,body:JSON.stringify({targetVersion:n})});return this.unwrapResponse(r)}}},this.organizations={list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list`)).json();return{organizations:Array.isArray(t)?t:t?.data??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update`,{method:`POST`,body:JSON.stringify({organizationId:e,data:t})})).json()},setActive:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/set-active`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-full-organization?organizationId=${encodeURIComponent(e)}`)).json()},listMembers:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/list-members?organizationId=${encodeURIComponent(e)}`)).json()},invite:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/invite-member`,{method:`POST`,body:JSON.stringify(e)})).json()},leave:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/leave`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/delete`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},removeMember:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/remove-member`,{method:`POST`,body:JSON.stringify({memberIdOrEmail:t.memberIdOrEmail,organizationId:e})})).json()},updateMemberRole:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update-member-role`,{method:`POST`,body:JSON.stringify({memberId:t.memberId,role:t.role,organizationId:e})})).json()},getActiveMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-active-member?organizationId=${encodeURIComponent(e)}`)).json()},invitations:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-invitations?organizationId=${encodeURIComponent(e)}`)).json();return{invitations:Array.isArray(n)?n:n?.data??n?.invitations??[]}},listMine:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list-user-invitations`)).json();return{invitations:Array.isArray(t)?t:t?.data??t?.invitations??[]}},cancel:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/cancel-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},accept:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/accept-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},reject:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/reject-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},resend:async e=>{if(e.id)try{await this.organizations.invitations.cancel(e.id)}catch{}return this.organizations.invite({email:e.email,role:e.role??`member`,organizationId:e.organizationId})}},teams:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-teams?organizationId=${encodeURIComponent(e)}`)).json();return{teams:Array.isArray(n)?n:n?.data??n?.teams??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create-team`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/update-team`,{method:`POST`,body:JSON.stringify(e)})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team`,{method:`POST`,body:JSON.stringify(e)})).json()},listMembers:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-team-members?teamId=${encodeURIComponent(e)}`)).json();return{members:Array.isArray(n)?n:n?.data??n?.members??[]}},addMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/add-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()},removeMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()}}},this.oauth={applications:{register:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/create-client`,{method:`POST`,body:JSON.stringify(e)})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/get-client?client_id=${encodeURIComponent(e)}`)).json()},getPublic:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/public-client?client_id=${encodeURIComponent(e)}`)).json()},list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/oauth2/get-clients`)).json();return{applications:Array.isArray(t)?t:t?.clients??t?.data??[]}},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/delete-client`,{method:`POST`,body:JSON.stringify({client_id:e})})).json()}},consent:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/consent`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.auth={getConfig:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/config`);return this.unwrapResponse(t)},login:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/sign-in/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)}),r=await n.json().catch(()=>({}));if(!n.ok){let e=r?.message||r?.error?.message||`Login failed (HTTP ${n.status})`,t=Error(e);throw r?.code&&(t.code=r.code),t.status=n.status,t}let i=r&&(r.data??(r.token||r.user?{token:r.token,user:r.user}:void 0)),a=i?{...r,data:i}:r;return a.data?.token&&(this.token=a.data.token),a},logout:async()=>{let e=this.getRoute(`auth`);await this.fetch(`${this.baseUrl}${e}/sign-out`,{method:`POST`,headers:{"Content-Type":`application/json`,Origin:this.baseUrl},body:`{}`}),this.token=void 0},me:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/get-session`,{headers:{Origin:this.baseUrl}})).json()},register:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-up/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)})).json(),r=n&&(n.data??(n.token||n.user?{token:n.token,user:n.user}:void 0)),i=r?{...n,data:r}:n;return i.data?.token&&(this.token=i.data.token),i},signInWithProvider:async(e,t)=>{if(typeof window>`u`)throw Error(`signInWithProvider requires a browser environment`);let n=this.getRoute(`auth`),r=t?.callbackURL??window.location.origin+`/login`,i=t?.type===`oidc`,a=i?`/sign-in/oauth2`:`/sign-in/social`,o=i?{providerId:e,callbackURL:r}:{provider:e,callbackURL:r};t?.errorCallbackURL&&(o.errorCallbackURL=t.errorCallbackURL);let s=await(await this.fetch(`${this.baseUrl}${n}${a}`,{method:`POST`,body:JSON.stringify(o)})).json(),c=s?.url??s?.data?.url;if(c)window.location.assign(c);else throw Error(`signInWithProvider: no redirect URL returned for provider "${e}"`)},refreshToken:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/get-session`,{method:`GET`})).json();return n.data?.token&&(this.token=n.data.token),n},bootstrapStatus:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/bootstrap-status`)).json();return{hasOwner:!!(t?.data??t)?.hasOwner}},updateUser:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/update-user`,{method:`POST`,body:JSON.stringify(e)})).json()},changePassword:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-password`,{method:`POST`,body:JSON.stringify(e)})).json()},changeEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-email`,{method:`POST`,body:JSON.stringify(e)})).json()},sendVerificationEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/send-verification-email`,{method:`POST`,body:JSON.stringify(e)})).json()},verifyEmail:async e=>{let t=this.getRoute(`auth`),n=new URL(`${this.baseUrl}${t}/verify-email`);return n.searchParams.set(`token`,e.token),e.callbackURL&&n.searchParams.set(`callbackURL`,e.callbackURL),(await this.fetch(n.toString())).json()},deleteUser:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/delete-user`,{method:`POST`,body:JSON.stringify(e)});return this.token=void 0,n.json()},sessions:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-sessions`)).json();return{sessions:Array.isArray(t)?t:t?.data??t?.sessions??[]}},revoke:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/revoke-session`,{method:`POST`,body:JSON.stringify({token:e})})).json()},revokeOthers:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/revoke-other-sessions`,{method:`POST`,body:`{}`})).json()},revokeAll:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/revoke-sessions`,{method:`POST`,body:`{}`});return this.token=void 0,t.json()}},twoFactor:{enable:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/enable`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyTotp:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-totp`,{method:`POST`,body:JSON.stringify(e)})).json()},disable:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/disable`,{method:`POST`,body:JSON.stringify(e)})).json()},generateBackupCodes:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/generate-backup-codes`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyBackupCode:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-backup-code`,{method:`POST`,body:JSON.stringify(e)})).json()}},accounts:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-accounts`)).json();return{accounts:Array.isArray(t)?t:t?.data??t?.accounts??[]}},unlink:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/unlink-account`,{method:`POST`,body:JSON.stringify(e)})).json()},linkSocial:async e=>{let t=this.getRoute(`auth`),n=e.callbackURL??(typeof window<`u`?window.location.href:void 0),r=await(await this.fetch(`${this.baseUrl}${t}/link-social`,{method:`POST`,body:JSON.stringify({provider:e.provider,callbackURL:n})})).json();return r?.data??r}}},this.storage={upload:async(e,t=`user`)=>{let n={filename:e.name,mimeType:e.type,size:e.size,scope:t},r=this.getRoute(`storage`),{data:i}=await(await this.fetch(`${this.baseUrl}${r}/upload/presigned`,{method:`POST`,body:JSON.stringify(n)})).json(),a=await this.fetchImpl(i.uploadUrl,{method:i.method,headers:i.headers,body:e});if(!a.ok)throw Error(`Storage Upload Failed: ${a.statusText}`);let o={fileId:i.fileId};return(await this.fetch(`${this.baseUrl}${r}/upload/complete`,{method:`POST`,body:JSON.stringify(o)})).json()},getDownloadUrl:async e=>{let t=this.getRoute(`storage`);return(await(await this.fetch(`${this.baseUrl}${t}/files/${e}/url`)).json()).url},getPresignedUrl:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/presigned`,{method:`POST`,body:JSON.stringify(e)})).json()},initChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked`,{method:`POST`,body:JSON.stringify(e)})).json()},uploadPart:async(e,t,n,r)=>{let i=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/chunk/${t}`,{method:`PUT`,headers:{"x-resume-token":n},body:r})).json()},completeChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked/${e.uploadId}/complete`,{method:`POST`,body:JSON.stringify(e)})).json()},resumeUpload:async(e,t,n,r)=>{let i=this.getRoute(`storage`),{totalChunks:a,uploadedChunks:o}=(await(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/progress`)).json()).data,s=[],c=t instanceof ArrayBuffer?t:await t.arrayBuffer();for(let t=o;t<a;t++){let i=t*n,a=Math.min(i+n,c.byteLength),o=new Blob([c.slice(i,a)]),l=await this.storage.uploadPart(e,t,r,o);s.push({chunkIndex:t,eTag:l.data.eTag})}return this.storage.completeChunkedUpload({uploadId:e,parts:s})}},this.automation={trigger:async(e,t)=>{let n=this.getRoute(`automation`);return(await this.fetch(`${this.baseUrl}${n}/trigger/${e}`,{method:`POST`,body:JSON.stringify(t)})).json()},list:async()=>{let e=this.getRoute(`automation`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},get:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`);return this.unwrapResponse(n)},create:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({name:e,...t})});return this.unwrapResponse(r)},update:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`PUT`,body:JSON.stringify({definition:t})});return this.unwrapResponse(r)},delete:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`,{method:`DELETE`});return this.unwrapResponse(n)},toggle:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/toggle`,{method:`POST`,body:JSON.stringify({enabled:t})});return this.unwrapResponse(r)},runs:{list:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${e}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/runs/${t}`);return this.unwrapResponse(r)}},getFlow:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},execute:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/trigger`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},listRuns:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit!=null&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},getRun:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.permissions={check:async e=>{let t=this.getRoute(`permissions`),n=new URLSearchParams({object:e.object,action:e.action});e.recordId!==void 0&&n.set(`recordId`,e.recordId),e.field!==void 0&&n.set(`field`,e.field);let r=await this.fetch(`${this.baseUrl}${t}/check?${n.toString()}`);return this.unwrapResponse(r)},getObjectPermissions:async e=>{let t=this.getRoute(`permissions`),n=await this.fetch(`${this.baseUrl}${t}/objects/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},getEffectivePermissions:async()=>{let e=this.getRoute(`permissions`),t=await this.fetch(`${this.baseUrl}${e}/effective`);return this.unwrapResponse(t)}},this.realtime={connect:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/connect`,{method:`POST`,body:JSON.stringify(e||{})});return this.unwrapResponse(n)},disconnect:async()=>{let e=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${e}/disconnect`,{method:`POST`})},subscribe:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/subscribe`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unsubscribe:async e=>{let t=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${t}/unsubscribe`,{method:`POST`,body:JSON.stringify({subscriptionId:e})})},setPresence:async(e,t)=>{let n=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${n}/presence`,{method:`PUT`,body:JSON.stringify({channel:e,state:t})})},getPresence:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/presence/${encodeURIComponent(e)}`);return this.unwrapResponse(n)}},this.workflow={getConfig:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/config`);return this.unwrapResponse(n)},getState:async(e,t)=>{let n=this.getRoute(`workflow`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/state`);return this.unwrapResponse(r)},transition:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/transition`,{method:`POST`,body:JSON.stringify({transition:e.transition,comment:e.comment,data:e.data})});return this.unwrapResponse(n)},approve:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/approve`,{method:`POST`,body:JSON.stringify({comment:e.comment,data:e.data})});return this.unwrapResponse(n)},reject:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/reject`,{method:`POST`,body:JSON.stringify({reason:e.reason,comment:e.comment})});return this.unwrapResponse(n)}},this.views={list:async(e,t)=>{let n=this.getRoute(`views`),r=new URLSearchParams;t&&r.set(`type`,t);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({object:e,data:t})});return this.unwrapResponse(r)},update:async(e,t,n)=>{let r=this.getRoute(`views`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`PUT`,body:JSON.stringify({object:e,viewId:t,data:n})});return this.unwrapResponse(i)},delete:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)}},this.notifications={registerDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unregisterDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},getPreferences:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/preferences`);return this.unwrapResponse(t)},updatePreferences:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/preferences`,{method:`PUT`,body:JSON.stringify({preferences:e})});return this.unwrapResponse(n)},list:async e=>{let t=this.getRoute(`notifications`),n=new URLSearchParams;e?.read!==void 0&&n.set(`read`,String(e.read)),e?.type&&n.set(`type`,e.type),e?.limit&&n.set(`limit`,String(e.limit)),e?.cursor&&n.set(`cursor`,e.cursor);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}${r?`?${r}`:``}`);return this.unwrapResponse(i)},markRead:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/read`,{method:`POST`,body:JSON.stringify({ids:e})});return this.unwrapResponse(n)},markAllRead:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/read/all`,{method:`POST`});return this.unwrapResponse(t)}},this.ai={nlq:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/nlq`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},suggest:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/suggest`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},insights:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/insights`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)}},this.i18n={getLocales:async()=>{let e=this.getRoute(`i18n`),t=await this.fetch(`${this.baseUrl}${e}/locales`);return this.unwrapResponse(t)},getTranslations:async(e,t)=>{let n=this.getRoute(`i18n`),r=new URLSearchParams;r.set(`locale`,e),t?.namespace&&r.set(`namespace`,t.namespace),t?.keys&&r.set(`keys`,t.keys.join(`,`));let i=await this.fetch(`${this.baseUrl}${n}/translations?${r.toString()}`);return this.unwrapResponse(i)},getFieldLabels:async(e,t)=>{let n=this.getRoute(`i18n`),r=await this.fetch(`${this.baseUrl}${n}/labels/${encodeURIComponent(e)}?locale=${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.feed={list:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.type&&i.set(`type`,n.type),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed${a?`?${a}`:``}`);return this.unwrapResponse(o)},create:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed`,{method:`POST`,body:JSON.stringify(n)});return this.unwrapResponse(i)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`PUT`,body:JSON.stringify(r)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`DELETE`});return this.unwrapResponse(i)},addReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions`,{method:`POST`,body:JSON.stringify({emoji:r})});return this.unwrapResponse(a)},removeReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions/${encodeURIComponent(r)}`,{method:`DELETE`});return this.unwrapResponse(a)},pin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`POST`});return this.unwrapResponse(i)},unpin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`DELETE`});return this.unwrapResponse(i)},star:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`POST`});return this.unwrapResponse(i)},unstar:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`DELETE`});return this.unwrapResponse(i)},search:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=new URLSearchParams;a.set(`query`,n),r?.type&&a.set(`type`,r.type),r?.actorId&&a.set(`actorId`,r.actorId),r?.dateFrom&&a.set(`dateFrom`,r.dateFrom),r?.dateTo&&a.set(`dateTo`,r.dateTo),r?.limit&&a.set(`limit`,String(r.limit)),r?.cursor&&a.set(`cursor`,r.cursor);let o=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/search?${a.toString()}`);return this.unwrapResponse(o)},getChangelog:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.field&&i.set(`field`,n.field),n?.actorId&&i.set(`actorId`,n.actorId),n?.dateFrom&&i.set(`dateFrom`,n.dateFrom),n?.dateTo&&i.set(`dateTo`,n.dateTo),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/changelog${a?`?${a}`:``}`);return this.unwrapResponse(o)},subscribe:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`POST`,body:JSON.stringify(n||{})});return this.unwrapResponse(i)},unsubscribe:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`DELETE`});return this.unwrapResponse(r)}},this.data={query:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/query`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},find:async(e,t={})=>{let n=this.getRoute(`data`),r=new URLSearchParams,i=t,a={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(i.where&&(a.filter=i.where),i.fields&&(a.select=i.fields),i.orderBy&&(a.sort=i.orderBy),i.limit!=null&&(a.top=i.limit),i.offset!=null&&(a.skip=i.offset),i.aggregations&&(a.aggregations=i.aggregations),i.groupBy&&(a.groupBy=i.groupBy)):Object.assign(a,t),a.top&&r.set(`top`,a.top.toString()),a.skip&&r.set(`skip`,a.skip.toString()),a.sort)if(Array.isArray(a.sort)&&typeof a.sort[0]==`object`)r.set(`sort`,JSON.stringify(a.sort));else{let e=Array.isArray(a.sort)?a.sort.join(`,`):a.sort;r.set(`sort`,e)}a.select&&r.set(`select`,a.select.join(`,`));let o=a.filter??a.filters;o&&(this.isFilterAST(o)||Array.isArray(o)?r.set(`filter`,JSON.stringify(o)):typeof o==`object`&&o&&Object.entries(o).forEach(([e,t])=>{t!=null&&r.append(e,String(t))})),a.aggregations&&r.set(`aggregations`,JSON.stringify(a.aggregations)),a.groupBy&&r.set(`groupBy`,a.groupBy.join(`,`));let s=await this.fetch(`${this.baseUrl}${n}/${e}?${r.toString()}`);return this.unwrapResponse(s)},get:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},createMany:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/createMany`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a={};r?.ifMatch&&(a[`If-Match`]=String(r.ifMatch));let o=await this.fetch(`${this.baseUrl}${i}/${e}/${t}`,{method:`PATCH`,body:JSON.stringify(n),...Object.keys(a).length?{headers:a}:{}});return this.unwrapResponse(o)},batch:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/batch`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},updateMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={records:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/updateMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i={};n?.ifMatch&&(i[`If-Match`]=String(n.ifMatch));let a=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`DELETE`,...Object.keys(i).length?{headers:i}:{}});return this.unwrapResponse(a)},deleteMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={ids:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/deleteMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)}},this.baseUrl=e.baseUrl.replace(/\/$/,``),this.token=e.token,this.environmentId=e.environmentId,this.fetchImpl=e.fetch||globalThis.fetch.bind(globalThis),this.logger=e.logger||Gg({level:e.debug?`debug`:`info`,format:`pretty`}),this.realtimeAPI=new Kg(this.baseUrl,this.token),this.logger.debug(`ObjectStack client created`,{baseUrl:this.baseUrl})}async connect(){this.logger.debug(`Connecting to ObjectStack server`,{baseUrl:this.baseUrl});try{let e;try{let t=`${this.baseUrl}/api/v1/discovery`;this.logger.debug(`Probing protocol-standard discovery endpoint`,{url:t});let n=await this.fetchImpl(t);if(n.ok){let t=await n.json();e=t.data||t,this.logger.debug(`Discovered via /api/v1/discovery`)}}catch(e){this.logger.debug(`Protocol-standard discovery probe failed`,{error:e.message})}if(!e){let t;try{t=`${new URL(this.baseUrl).origin}/.well-known/objectstack`}catch{t=`/.well-known/objectstack`}this.logger.debug(`Falling back to .well-known discovery`,{url:t});let n=await this.fetchImpl(t);if(!n.ok)throw Error(`Failed to connect to ${t}: ${n.statusText}`);let r=await n.json();e=r.data||r}if(!e)throw Error(`Connection failed: No discovery data returned`);return this.discoveryInfo=e,this.logger.info(`Connected to ObjectStack server`,{version:e.version,apiName:e.apiName,services:e.services}),e}catch(e){throw this.logger.error(`Failed to connect to ObjectStack server`,e,{baseUrl:this.baseUrl}),e}}get capabilities(){let e=this.discoveryInfo?.capabilities;if(!e)return;let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r?!!r.enabled:!!r;return t}project(e){if(!e)throw Error(`[ObjectStack] project(id): environmentId is required`);return new Jg(this,e)}_baseUrl(){return this.baseUrl}_fetch(e,t){return this.fetch(e,t)}_unwrap(e){return this.unwrapResponse(e)}_isFilterAST(e){return this.isFilterAST(e)}setProjectId(e){this.environmentId=e,this.logger.debug(`Active project changed`,{environmentId:e})}getProjectId(){return this.environmentId}get events(){return this.realtimeAPI}isFilterAST(e){return ep(e)}async unwrapResponse(e){let t=await e.json();return t&&typeof t.success==`boolean`&&`data`in t?t.data:t}async fetch(e,t={}){this.logger.debug(`HTTP request`,{method:t.method||`GET`,url:e,hasBody:!!t.body});let n={"Content-Type":`application/json`,...t.headers||{}};this.token&&(n.Authorization=`Bearer ${this.token}`),this.environmentId&&(n[`X-Environment-Id`]=this.environmentId);let r=await this.fetchImpl(e,{...t,headers:n});if(this.logger.debug(`HTTP response`,{method:t.method||`GET`,url:e,status:r.status,ok:r.ok}),!r.ok){let n;try{n=await r.json()}catch{n={message:r.statusText}}this.logger.error(`HTTP request failed`,void 0,{method:t.method||`GET`,url:e,status:r.status,error:n});let i=n?.message??n?.error?.message??(typeof n?.error==`string`?n.error:void 0)??r.statusText,a=n?.code||n?.error?.code,o=Error(`[ObjectStack] ${a?`${a}: `:``}${i}`);throw o.code=a,o.category=n?.category,o.httpStatus=r.status,o.retryable=n?.retryable,o.details=n?.details||n,o}return r}getRoute(e){let t=this.discoveryInfo?.routes;if(t){let n=t[e];if(n)return n}return{data:`/api/v1/data`,metadata:`/api/v1/meta`,discovery:`/api/v1/discovery`,ui:`/api/v1/ui`,auth:`/api/v1/auth`,analytics:`/api/v1/analytics`,storage:`/api/v1/storage`,automation:`/api/v1/automation`,packages:`/api/v1/packages`,permissions:`/api/v1/permissions`,realtime:`/api/v1/realtime`,workflow:`/api/v1/workflow`,views:`/api/v1/ui/views`,notifications:`/api/v1/notifications`,ai:`/api/v1/ai`,i18n:`/api/v1/i18n`,feed:`/api/v1/feed`,graphql:`/graphql`}[e]||`/api/v1/${e}`}},Jg=class{constructor(e,t){this.meta={getTypes:async()=>{let e=await this.parent._fetch(this.url(`/meta`));return this.parent._unwrap(e)},getItems:async(e,t)=>{let n=new URLSearchParams;t?.packageId&&n.set(`package`,t.packageId);let r=n.toString(),i=await this.parent._fetch(this.url(`/meta/${e}${r?`?${r}`:``}`));return this.parent._unwrap(i)},getItem:async(e,t,n)=>{let r=new URLSearchParams;n?.packageId&&r.set(`package`,n.packageId);let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${e}/${t}${i?`?${i}`:``}`));return this.parent._unwrap(a)},saveItem:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/meta/${e}/${t}`),{method:`PUT`,body:JSON.stringify(n)});return this.parent._unwrap(r)},deleteItem:async(e,t)=>{let n=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}`),{method:`DELETE`});return this.parent._unwrap(n)},getHistory:async(e,t,n)=>{let r=new URLSearchParams;n?.sinceSeq!==void 0&&r.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&r.set(`limit`,String(n.limit));let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${i?`?${i}`:``}`));return this.parent._unwrap(a)}},this.data={query:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/query`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},find:async(e,t={})=>{let n=new URLSearchParams,r=t,i={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(r.where&&(i.filter=r.where),r.fields&&(i.select=r.fields),r.orderBy&&(i.sort=r.orderBy),r.limit!=null&&(i.top=r.limit),r.offset!=null&&(i.skip=r.offset),r.aggregations&&(i.aggregations=r.aggregations),r.groupBy&&(i.groupBy=r.groupBy)):Object.assign(i,t),i.top&&n.set(`top`,i.top.toString()),i.skip&&n.set(`skip`,i.skip.toString()),i.sort)if(Array.isArray(i.sort)&&typeof i.sort[0]==`object`)n.set(`sort`,JSON.stringify(i.sort));else{let e=Array.isArray(i.sort)?i.sort.join(`,`):i.sort;n.set(`sort`,e)}i.select&&n.set(`select`,i.select.join(`,`));let a=i.filter??i.filters;a&&(this.parent._isFilterAST(a)||Array.isArray(a)?n.set(`filter`,JSON.stringify(a)):typeof a==`object`&&a&&Object.entries(a).forEach(([e,t])=>{t!=null&&n.append(e,String(t))})),i.aggregations&&n.set(`aggregations`,JSON.stringify(i.aggregations)),i.groupBy&&n.set(`groupBy`,i.groupBy.join(`,`));let o=n.toString(),s=await this.parent._fetch(this.url(`/data/${e}${o?`?${o}`:``}`));return this.parent._unwrap(s)},get:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`));return this.parent._unwrap(n)},create:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},createMany:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/createMany`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},update:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`PATCH`,body:JSON.stringify(n)});return this.parent._unwrap(r)},batch:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/batch`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},updateMany:async(e,t,n)=>{let r={records:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/updateMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)},delete:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`DELETE`});return this.parent._unwrap(n)},deleteMany:async(e,t,n)=>{let r={ids:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/deleteMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)}},this.packages={list:async()=>{let e=await this.parent._fetch(this.url(`/packages`));return this.parent._unwrap(e)},get:async(e,t)=>{let n=t?`?version=${encodeURIComponent(t)}`:``,r=await this.parent._fetch(this.url(`/packages/${encodeURIComponent(e)}${n}`));return this.parent._unwrap(r)}},this.automation={getFlow:async e=>{let t=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}`));return this.parent._unwrap(t)},execute:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/trigger`),{method:`POST`,body:JSON.stringify(t??{})});return this.parent._unwrap(n)},listRuns:async(e,t)=>{let n=new URLSearchParams;t?.limit!=null&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor);let r=n.toString(),i=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs${r?`?${r}`:``}`));return this.parent._unwrap(i)},getRun:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`));return this.parent._unwrap(n)}},this.parent=e,this.environmentId=t}getProjectId(){return this.environmentId}scope(){return`/api/v1/environments/${encodeURIComponent(this.environmentId)}`}url(e){return`${this.parent._baseUrl()}${this.scope()}${e}`}},Yg=(0,j.createContext)(null);function Xg({client:e,children:t}){return j.createElement(Yg.Provider,{value:e},t)}function Zg(){let e=(0,j.useContext)(Yg);if(!e)throw Error(`useClient must be used within an ObjectStackProvider. Make sure your component is wrapped with <ObjectStackProvider client={...}>.`);return e}var Qg=1,$g=1e6,e_=0;function t_(){return e_=(e_+1)%(2**53-1),e_.toString()}var n_=new Map,r_=e=>{if(n_.has(e))return;let t=setTimeout(()=>{n_.delete(e),s_({type:`REMOVE_TOAST`,toastId:e})},$g);n_.set(e,t)},i_=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,Qg)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?r_(n):e.toasts.forEach(e=>{r_(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},a_=[],o_={toasts:[]};function s_(e){o_=i_(o_,e),a_.forEach(e=>{e(o_)})}function K({...e}){let t=t_(),n=e=>s_({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>s_({type:`DISMISS_TOAST`,toastId:t});return s_({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function c_(){let[e,t]=j.useState(o_);return j.useEffect(()=>(a_.push(t),()=>{let e=a_.indexOf(t);e>-1&&a_.splice(e,1)}),[e]),{...e,toast:K,dismiss:e=>s_({type:`DISMISS_TOAST`,toastId:e})}}typeof window<`u`&&window.document&&window.document.createElement;function q(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function l_(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function u_(...e){return t=>{let n=!1,r=e.map(e=>{let r=l_(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():l_(e[t],null)}}}}function d_(...e){return j.useCallback(u_(...e),e)}function f_(e,t){let n=j.createContext(t),r=e=>{let{children:t,...r}=e,i=j.useMemo(()=>r,Object.values(r));return(0,M.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=j.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function p_(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,m_(i,...t)]}function m_(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function h_(e){let t=g_(e),n=j.forwardRef((e,n)=>{let{children:r,...i}=e,a=j.Children.toArray(r),o=a.find(y_);if(o){let e=o.props.children,r=a.map(t=>t===o?j.Children.count(e)>1?j.Children.only(null):j.isValidElement(e)?e.props.children:null:t);return(0,M.jsx)(t,{...i,ref:n,children:j.isValidElement(e)?j.cloneElement(e,void 0,r):null})}return(0,M.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function g_(e){let t=j.forwardRef((e,t)=>{let{children:n,...r}=e;if(j.isValidElement(n)){let e=x_(n),i=b_(r,n.props);return n.type!==j.Fragment&&(i.ref=t?u_(t,e):e),j.cloneElement(n,i)}return j.Children.count(n)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var __=Symbol(`radix.slottable`);function v_(e){let t=({children:e})=>(0,M.jsx)(M.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=__,t}function y_(e){return j.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===__}function b_(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function x_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function S_(e){let t=e+`CollectionProvider`,[n,r]=p_(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=j.useRef(null),a=j.useRef(new Map).current;return(0,M.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=h_(s),l=j.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,M.jsx)(c,{ref:d_(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=h_(u),p=j.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=j.useRef(null),s=d_(t,o),c=a(u,n);return j.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,M.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return j.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var C_=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=h_(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function w_(e,t){e&&Gi.flushSync(()=>e.dispatchEvent(t))}function T_(e){let t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>(...e)=>t.current?.(...e),[])}function E_(e,t=globalThis?.document){let n=T_(e);j.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var D_=`DismissableLayer`,O_=`dismissableLayer.update`,k_=`dismissableLayer.pointerDownOutside`,A_=`dismissableLayer.focusOutside`,j_,M_=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),N_=j.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=j.useContext(M_),[u,d]=j.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=j.useState({}),m=d_(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=I_(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=L_(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return E_(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),j.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(j_=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),R_(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=j_)}},[u,f,n,l]),j.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),R_())},[u,l]),j.useEffect(()=>{let e=()=>p({});return document.addEventListener(O_,e),()=>document.removeEventListener(O_,e)},[]),(0,M.jsx)(C_.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:q(e.onFocusCapture,S.onFocusCapture),onBlurCapture:q(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:q(e.onPointerDownCapture,x.onPointerDownCapture)})});N_.displayName=D_;var P_=`DismissableLayerBranch`,F_=j.forwardRef((e,t)=>{let n=j.useContext(M_),r=j.useRef(null),i=d_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,M.jsx)(C_.div,{...e,ref:i})});F_.displayName=P_;function I_(e,t=globalThis?.document){let n=T_(e),r=j.useRef(!1),i=j.useRef(()=>{});return j.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){z_(k_,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function L_(e,t=globalThis?.document){let n=T_(e),r=j.useRef(!1);return j.useEffect(()=>{let e=e=>{e.target&&!r.current&&z_(A_,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function R_(){let e=new CustomEvent(O_);document.dispatchEvent(e)}function z_(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?w_(i,a):i.dispatchEvent(a)}var B_=N_,V_=F_,H_=globalThis?.document?j.useLayoutEffect:()=>{},U_=`Portal`,W_=j.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=j.useState(!1);H_(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Gi.createPortal((0,M.jsx)(C_.div,{...r,ref:t}),o):null});W_.displayName=U_;function G_(e,t){return j.useReducer((e,n)=>t[e][n]??e,e)}var K_=e=>{let{present:t,children:n}=e,r=q_(t),i=typeof n==`function`?n({present:r.isPresent}):j.Children.only(n),a=d_(r.ref,Y_(i));return typeof n==`function`||r.isPresent?j.cloneElement(i,{ref:a}):null};K_.displayName=`Presence`;function q_(e){let[t,n]=j.useState(),r=j.useRef(null),i=j.useRef(e),a=j.useRef(`none`),[o,s]=G_(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return j.useEffect(()=>{let e=J_(r.current);a.current=o===`mounted`?e:`none`},[o]),H_(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=J_(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),H_(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=J_(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=J_(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:j.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function J_(e){return e?.animationName||`none`}function Y_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var X_=j.useInsertionEffect||H_;function Z_({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Q_({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=j.useRef(e!==void 0);j.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,j.useCallback(t=>{if(s){let n=$_(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Q_({defaultProp:e,onChange:t}){let[n,r]=j.useState(e),i=j.useRef(n),a=j.useRef(t);return X_(()=>{a.current=t},[t]),j.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function $_(e){return typeof e==`function`}var ev=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),tv=`VisuallyHidden`,nv=j.forwardRef((e,t)=>(0,M.jsx)(C_.span,{...e,ref:t,style:{...ev,...e.style}}));nv.displayName=tv;var rv=nv,iv=`ToastProvider`,[av,ov,sv]=S_(`Toast`),[cv,lv]=p_(`Toast`,[sv]),[uv,dv]=cv(iv),fv=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=j.useState(null),[l,u]=j.useState(0),d=j.useRef(!1),f=j.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${iv}\`. Expected non-empty \`string\`.`),(0,M.jsx)(av.Provider,{scope:t,children:(0,M.jsx)(uv,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:j.useCallback(()=>u(e=>e+1),[]),onToastRemove:j.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};fv.displayName=iv;var pv=`ToastViewport`,mv=[`F8`],hv=`toast.viewportPause`,gv=`toast.viewportResume`,_v=j.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=mv,label:i=`Notifications ({hotkey})`,...a}=e,o=dv(pv,n),s=ov(n),c=j.useRef(null),l=j.useRef(null),u=j.useRef(null),d=j.useRef(null),f=d_(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;j.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),j.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(hv);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(gv);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=j.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...Wv(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return j.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Gv(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,M.jsxs)(V_,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,M.jsx)(yv,{ref:l,onFocusFromOutsideViewport:()=>{Gv(h({tabbingDirection:`forwards`}))}}),(0,M.jsx)(av.Slot,{scope:n,children:(0,M.jsx)(C_.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,M.jsx)(yv,{ref:u,onFocusFromOutsideViewport:()=>{Gv(h({tabbingDirection:`backwards`}))}})]})});_v.displayName=pv;var vv=`ToastFocusProxy`,yv=j.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=dv(vv,n);return(0,M.jsx)(nv,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});yv.displayName=vv;var bv=`Toast`,xv=`toast.swipeStart`,Sv=`toast.swipeMove`,Cv=`toast.swipeCancel`,wv=`toast.swipeEnd`,Tv=j.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=Z_({prop:r,defaultProp:i??!0,onChange:a,caller:bv});return(0,M.jsx)(K_,{present:n||s,children:(0,M.jsx)(Ov,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:T_(e.onPause),onResume:T_(e.onResume),onSwipeStart:q(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:q(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:q(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:q(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Tv.displayName=bv;var[Ev,Dv]=cv(bv,{onClose(){}}),Ov=j.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=dv(bv,n),[g,_]=j.useState(null),v=d_(t,e=>_(e)),y=j.useRef(null),b=j.useRef(null),x=i||h.duration,S=j.useRef(0),C=j.useRef(x),w=j.useRef(0),{onToastAdd:T,onToastRemove:E}=h,D=T_(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),O=j.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),S.current=new Date().getTime(),w.current=window.setTimeout(D,e))},[D]);j.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{O(C.current),l?.()},n=()=>{let e=new Date().getTime()-S.current;C.current-=e,window.clearTimeout(w.current),c?.()};return e.addEventListener(hv,n),e.addEventListener(gv,t),()=>{e.removeEventListener(hv,n),e.removeEventListener(gv,t)}}},[h.viewport,x,c,l,O]),j.useEffect(()=>{a&&!h.isClosePausedRef.current&&O(x)},[a,x,h.isClosePausedRef,O]),j.useEffect(()=>(T(),()=>E()),[T,E]);let ee=j.useMemo(()=>g?zv(g):null,[g]);return h.viewport?(0,M.jsxs)(M.Fragment,{children:[ee&&(0,M.jsx)(kv,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:ee}),(0,M.jsx)(Ev,{scope:n,onClose:D,children:Gi.createPortal((0,M.jsx)(av.ItemSlot,{scope:n,children:(0,M.jsx)(B_,{asChild:!0,onEscapeKeyDown:q(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||D(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,M.jsx)(C_.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:q(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:q(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:q(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!b.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(b.current=l,Bv(Sv,d,f,{discrete:!1})):Vv(l,h.swipeDirection,c)?(b.current=l,Bv(xv,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:q(e.onPointerUp,e=>{let t=b.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),b.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};Vv(t,h.swipeDirection,h.swipeThreshold)?Bv(wv,p,r,{discrete:!0}):Bv(Cv,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),kv=e=>{let{__scopeToast:t,children:n,...r}=e,i=dv(bv,t),[a,o]=j.useState(!1),[s,c]=j.useState(!1);return Hv(()=>o(!0)),j.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,M.jsx)(W_,{asChild:!0,children:(0,M.jsx)(nv,{...r,children:a&&(0,M.jsxs)(M.Fragment,{children:[i.label,` `,n]})})})},Av=`ToastTitle`,jv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,M.jsx)(C_.div,{...r,ref:t})});jv.displayName=Av;var Mv=`ToastDescription`,Nv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,M.jsx)(C_.div,{...r,ref:t})});Nv.displayName=Mv;var Pv=`ToastAction`,Fv=j.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,M.jsx)(Rv,{altText:n,asChild:!0,children:(0,M.jsx)(Lv,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Pv}\`. Expected non-empty \`string\`.`),null)});Fv.displayName=Pv;var Iv=`ToastClose`,Lv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Dv(Iv,n);return(0,M.jsx)(Rv,{asChild:!0,children:(0,M.jsx)(C_.button,{type:`button`,...r,ref:t,onClick:q(e.onClick,i.onClose)})})});Lv.displayName=Iv;var Rv=j.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,M.jsx)(C_.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function zv(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Uv(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...zv(e))}}),t}function Bv(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?w_(i,a):i.dispatchEvent(a)}var Vv=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function Hv(e=()=>{}){let t=T_(e);H_(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function Uv(e){return e.nodeType===e.ELEMENT_NODE}function Wv(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Gv(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var Kv=fv,qv=_v,Jv=Tv,Yv=jv,Xv=Nv,Zv=Fv,Qv=Lv;function $v(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=$v(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ey(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=$v(e))&&(r&&(r+=` `),r+=t);return r}var ty=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ny=ey,ry=(e,t)=>n=>{if(t?.variants==null)return ny(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ty(t)||ty(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ny(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},iy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ay=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),oy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),sy=e=>{let t=oy(e);return t.charAt(0).toUpperCase()+t.slice(1)},cy={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ly=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},uy=(0,j.createContext)({}),dy=()=>(0,j.useContext)(uy),fy=(0,j.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=dy()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,j.createElement)(`svg`,{ref:c,...cy,width:t??l??cy.width,height:t??l??cy.height,stroke:e??f,strokeWidth:m,className:iy(`lucide`,p,i),...!a&&!ly(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,j.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),J=(e,t)=>{let n=(0,j.forwardRef)(({className:n,...r},i)=>(0,j.createElement)(fy,{ref:i,iconNode:t,className:iy(`lucide-${ay(sy(e))}`,`lucide-${e}`,n),...r}));return n.displayName=sy(e),n},py=J(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),my=J(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),hy=J(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),gy=J(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),_y=J(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),vy=J(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),yy=J(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),by=J(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),xy=J(`circle-user-round`,[[`path`,{d:`M17.925 20.056a6 6 0 0 0-11.851.001`,key:`z69sun`}],[`circle`,{cx:`12`,cy:`11`,r:`4`,key:`1gt34v`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Sy=J(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Cy=J(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),wy=J(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Ty=J(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ey=J(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Dy=J(`gallery-vertical-end`,[[`path`,{d:`M7 2h10`,key:`nczekb`}],[`path`,{d:`M5 6h14`,key:`u2x4p`}],[`rect`,{width:`18`,height:`12`,x:`3`,y:`10`,rx:`2`,key:`l0tzu3`}]]),Oy=J(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),ky=J(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),Ay=J(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),jy=J(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),My=J(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Ny=J(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),Py=J(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Fy=J(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Iy=J(`mail-check`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]]),Ly=J(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Ry=J(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),zy=J(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),By=J(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Vy=J(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Hy=J(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Uy=J(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Wy=J(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Gy=J(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ky=J(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),qy=J(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Jy=J(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Yy=J(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),Xy=J(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Zy=J(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Qy=J(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),$y=J(`user-minus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),eb=J(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),tb=J(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),nb=J(`users-round`,[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]]),rb=J(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ib=J(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ab=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},ob=(e,t)=>({classGroupId:e,validator:t}),sb=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),cb=`-`,lb=[],ub=`arbitrary..`,db=e=>{let t=mb(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return pb(e);let n=e.split(cb);return fb(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?ab(i,t):t:i||lb}return n[e]||lb}}},fb=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=fb(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(cb):e.slice(t).join(cb),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},pb=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ub+r:void 0})(),mb=e=>{let{theme:t,classGroups:n}=e;return hb(n,t)},hb=(e,t)=>{let n=sb();for(let r in e){let i=e[r];gb(i,n,r,t)}return n},gb=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];_b(i,t,n,r)}},_b=(e,t,n,r)=>{if(typeof e==`string`){vb(e,t,n);return}if(typeof e==`function`){yb(e,t,n,r);return}bb(e,t,n,r)},vb=(e,t,n)=>{let r=e===``?t:xb(t,e);r.classGroupId=n},yb=(e,t,n,r)=>{if(Sb(e)){gb(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ob(n,e))},bb=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];gb(o,xb(t,a),n,r)}},xb=(e,t)=>{let n=e,r=t.split(cb),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=sb(),n.nextPart.set(t,i)),n=i}return n},Sb=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Cb=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},wb=`!`,Tb=`:`,Eb=[],Db=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ob=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Tb){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(wb)?(c=s.slice(0,-1),l=!0):s.startsWith(wb)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Db(t,l,c,u)};if(t){let e=t+Tb,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Db(Eb,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},kb=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ab=e=>({cache:Cb(e.cacheSize),parseClassName:Ob(e),sortModifiers:kb(e),postfixLookupClassGroupIds:jb(e),...db(e)}),jb=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Mb=/\s+/,Nb=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Mb),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+wb:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Pb=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Fb(n))&&(i&&(i+=` `),i+=r);return i},Fb=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Fb(e[r]))&&(n&&(n+=` `),n+=t);return n},Ib=(e,...t)=>{let n,r,i,a,o=o=>(n=Ab(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Nb(e,n);return i(e,a),a};return a=o,(...e)=>a(Pb(...e))},Lb=[],Rb=e=>{let t=t=>t[e]||Lb;return t.isThemeGetter=!0,t},zb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Bb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Vb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Hb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ub=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Wb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Gb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Kb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qb=e=>Vb.test(e),Jb=e=>!!e&&!Number.isNaN(Number(e)),Yb=e=>!!e&&Number.isInteger(Number(e)),Xb=e=>e.endsWith(`%`)&&Jb(e.slice(0,-1)),Zb=e=>Hb.test(e),Qb=()=>!0,$b=e=>Ub.test(e)&&!Wb.test(e),ex=()=>!1,tx=e=>Gb.test(e),nx=e=>Kb.test(e),rx=e=>!Y(e)&&!X(e),ix=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),ax=e=>bx(e,wx,ex),Y=e=>zb.test(e),ox=e=>bx(e,Tx,$b),sx=e=>bx(e,Ex,Jb),cx=e=>bx(e,Ox,Qb),lx=e=>bx(e,Dx,ex),ux=e=>bx(e,Sx,ex),dx=e=>bx(e,Cx,nx),fx=e=>bx(e,kx,tx),X=e=>Bb.test(e),px=e=>xx(e,Tx),mx=e=>xx(e,Dx),hx=e=>xx(e,Sx),gx=e=>xx(e,wx),_x=e=>xx(e,Cx),vx=e=>xx(e,kx,!0),yx=e=>xx(e,Ox,!0),bx=(e,t,n)=>{let r=zb.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},xx=(e,t,n=!1)=>{let r=Bb.exec(e);return r?r[1]?t(r[1]):n:!1},Sx=e=>e===`position`||e===`percentage`,Cx=e=>e===`image`||e===`url`,wx=e=>e===`length`||e===`size`||e===`bg-size`,Tx=e=>e===`length`,Ex=e=>e===`number`,Dx=e=>e===`family-name`,Ox=e=>e===`number`||e===`weight`,kx=e=>e===`shadow`,Ax=Ib(()=>{let e=Rb(`color`),t=Rb(`font`),n=Rb(`text`),r=Rb(`font-weight`),i=Rb(`tracking`),a=Rb(`leading`),o=Rb(`breakpoint`),s=Rb(`container`),c=Rb(`spacing`),l=Rb(`radius`),u=Rb(`shadow`),d=Rb(`inset-shadow`),f=Rb(`text-shadow`),p=Rb(`drop-shadow`),m=Rb(`blur`),h=Rb(`perspective`),g=Rb(`aspect`),_=Rb(`ease`),v=Rb(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),X,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[X,Y,c],T=()=>[qb,`full`,`auto`,...w()],E=()=>[Yb,`none`,`subgrid`,X,Y],D=()=>[`auto`,{span:[`full`,Yb,X,Y]},Yb,X,Y],O=()=>[Yb,`auto`,X,Y],ee=()=>[`auto`,`min`,`max`,`fr`,X,Y],te=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ne=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],re=()=>[`auto`,...w()],ie=()=>[qb,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[qb,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],oe=()=>[qb,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],k=()=>[e,X,Y],se=()=>[...b(),hx,ux,{position:[X,Y]}],ce=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],le=()=>[`auto`,`cover`,`contain`,gx,ax,{size:[X,Y]}],ue=()=>[Xb,px,ox],A=()=>[``,`none`,`full`,l,X,Y],de=()=>[``,Jb,px,ox],fe=()=>[`solid`,`dashed`,`dotted`,`double`],pe=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],me=()=>[Jb,Xb,hx,ux],he=()=>[``,`none`,m,X,Y],ge=()=>[`none`,Jb,X,Y],_e=()=>[`none`,Jb,X,Y],ve=()=>[Jb,X,Y],ye=()=>[qb,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Zb],breakpoint:[Zb],color:[Qb],container:[Zb],"drop-shadow":[Zb],ease:[`in`,`out`,`in-out`],font:[rx],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Zb],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Zb],shadow:[Zb],spacing:[`px`,Jb],text:[Zb],"text-shadow":[Zb],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,qb,Y,X,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,X,Y]}],"container-named":[ix],columns:[{columns:[Jb,Y,X,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Yb,`auto`,X,Y]}],basis:[{basis:[qb,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Jb,qb,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,Jb,X,Y]}],shrink:[{shrink:[``,Jb,X,Y]}],order:[{order:[Yb,`first`,`last`,`none`,X,Y]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...te(),`normal`]}],"justify-items":[{"justify-items":[...ne(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ne()]}],"align-content":[{content:[`normal`,...te()]}],"align-items":[{items:[...ne(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ne(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...ne(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ne()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mbs:[{mbs:re()}],mbe:[{mbe:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,px,ox]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,yx,cx]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Xb,Y]}],"font-family":[{font:[mx,lx,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,X,Y]}],"line-clamp":[{"line-clamp":[Jb,`none`,X,sx]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,X,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,X,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...fe(),`wavy`]}],"text-decoration-thickness":[{decoration:[Jb,`from-font`,`auto`,X,ox]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[Jb,`auto`,X,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Yb,X,Y]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,X,Y]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,X,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:ce()}],"bg-size":[{bg:le()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Yb,X,Y],radial:[``,X,Y],conic:[Yb,X,Y]},_x,dx]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":de()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...fe(),`hidden`,`none`]}],"divide-style":[{divide:[...fe(),`hidden`,`none`]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...fe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Jb,X,Y]}],"outline-w":[{outline:[``,Jb,px,ox]}],"outline-color":[{outline:k()}],shadow:[{shadow:[``,`none`,u,vx,fx]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":[`none`,d,vx,fx]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:de()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[Jb,ox]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":[`none`,f,vx,fx]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[Jb,X,Y]}],"mix-blend":[{"mix-blend":[...pe(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Jb]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[X,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Jb]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:ce()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,X,Y]}],filter:[{filter:[``,`none`,X,Y]}],blur:[{blur:he()}],brightness:[{brightness:[Jb,X,Y]}],contrast:[{contrast:[Jb,X,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,vx,fx]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:[``,Jb,X,Y]}],"hue-rotate":[{"hue-rotate":[Jb,X,Y]}],invert:[{invert:[``,Jb,X,Y]}],saturate:[{saturate:[Jb,X,Y]}],sepia:[{sepia:[``,Jb,X,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,X,Y]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[Jb,X,Y]}],"backdrop-contrast":[{"backdrop-contrast":[Jb,X,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Jb,X,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Jb,X,Y]}],"backdrop-invert":[{"backdrop-invert":[``,Jb,X,Y]}],"backdrop-opacity":[{"backdrop-opacity":[Jb,X,Y]}],"backdrop-saturate":[{"backdrop-saturate":[Jb,X,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,Jb,X,Y]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,X,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Jb,`initial`,X,Y]}],ease:[{ease:[`linear`,`initial`,_,X,Y]}],delay:[{delay:[Jb,X,Y]}],animate:[{animate:[`none`,v,X,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,X,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":[`scale-3d`],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[X,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":[`translate-none`],zoom:[{zoom:[Yb,X,Y]}],accent:[{accent:k()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,X,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":k()}],"scrollbar-track-color":[{"scrollbar-track":k()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,X,Y]}],fill:[{fill:[`none`,...k()]}],"stroke-w":[{stroke:[Jb,px,ox,sx]}],stroke:[{stroke:[`none`,...k()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Z(...e){return Ax(ey(e))}var jx=Kv,Mx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(qv,{ref:n,className:Z(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));Mx.displayName=qv.displayName;var Nx=ry(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),Px=j.forwardRef(({className:e,variant:t,...n},r)=>(0,M.jsx)(Jv,{ref:r,className:Z(Nx({variant:t}),e),...n}));Px.displayName=Jv.displayName;var Fx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Zv,{ref:n,className:Z(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));Fx.displayName=Zv.displayName;var Ix=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Qv,{ref:n,className:Z(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,M.jsx)(ib,{className:`h-4 w-4`})}));Ix.displayName=Qv.displayName;var Lx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Yv,{ref:n,className:Z(`text-sm font-semibold`,e),...t}));Lx.displayName=Yv.displayName;var Rx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Xv,{ref:n,className:Z(`text-sm opacity-90`,e),...t}));Rx.displayName=Xv.displayName;function zx(){let{toasts:e}=c_();return(0,M.jsxs)(jx,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,M.jsxs)(Px,{...i,children:[(0,M.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,M.jsx)(Lx,{children:t}),n&&(0,M.jsx)(Rx,{children:n})]}),r,(0,M.jsx)(Ix,{})]},e)}),(0,M.jsx)(Mx,{})]})}var Bx=Symbol.for(`react.lazy`),Vx=j.use;function Hx(e){return typeof e==`object`&&!!e&&`then`in e}function Ux(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Bx&&`_payload`in e&&Hx(e._payload)}function Wx(e){let t=Kx(e),n=j.forwardRef((e,n)=>{let{children:r,...i}=e;Ux(r)&&typeof Vx==`function`&&(r=Vx(r._payload));let a=j.Children.toArray(r),o=a.find(Jx);if(o){let e=o.props.children,r=a.map(t=>t===o?j.Children.count(e)>1?j.Children.only(null):j.isValidElement(e)?e.props.children:null:t);return(0,M.jsx)(t,{...i,ref:n,children:j.isValidElement(e)?j.cloneElement(e,void 0,r):null})}return(0,M.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Gx=Wx(`Slot`);function Kx(e){let t=j.forwardRef((e,t)=>{let{children:n,...r}=e;if(Ux(n)&&typeof Vx==`function`&&(n=Vx(n._payload)),j.isValidElement(n)){let e=Xx(n),i=Yx(r,n.props);return n.type!==j.Fragment&&(i.ref=t?u_(t,e):e),j.cloneElement(n,i)}return j.Children.count(n)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qx=Symbol(`radix.slottable`);function Jx(e){return j.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===qx}function Yx(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Xx(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Zx=768;function Qx(){let[e,t]=j.useState(void 0);return j.useEffect(()=>{let e=window.matchMedia(`(max-width: ${Zx-1}px)`),n=()=>{t(window.innerWidth<Zx)};return e.addEventListener(`change`,n),t(window.innerWidth<Zx),()=>e.removeEventListener(`change`,n)},[]),!!e}var $x=ry(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`,outline:`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Q=j.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,M.jsx)(r?Gx:`button`,{className:Z($x({variant:t,size:n,className:e})),ref:a,...i}));Q.displayName=`Button`;var eS=j.forwardRef(({className:e,type:t,...n},r)=>(0,M.jsx)(`input`,{type:t,className:Z(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));eS.displayName=`Input`;var tS=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Wx(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),nS=`Separator`,rS=`horizontal`,iS=[`horizontal`,`vertical`],aS=j.forwardRef((e,t)=>{let{decorative:n,orientation:r=rS,...i}=e,a=oS(r)?r:rS,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,M.jsx)(tS.div,{"data-orientation":a,...o,...i,ref:t})});aS.displayName=nS;function oS(e){return iS.includes(e)}var sS=aS,cS=j.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,M.jsx)(sS,{ref:i,decorative:n,orientation:t,className:Z(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));cS.displayName=sS.displayName;var lS=j.useId||(()=>void 0),uS=0;function dS(e){let[t,n]=j.useState(lS());return H_(()=>{e||n(e=>e??String(uS++))},[e]),e||(t?`radix-${t}`:``)}var fS=`focusScope.autoFocusOnMount`,pS=`focusScope.autoFocusOnUnmount`,mS={bubbles:!1,cancelable:!0},hS=`FocusScope`,gS=j.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=j.useState(null),l=T_(i),u=T_(a),d=j.useRef(null),f=d_(t,e=>c(e)),p=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:CS(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||CS(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&CS(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),j.useEffect(()=>{if(s){wS.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(fS,mS);s.addEventListener(fS,l),s.dispatchEvent(t),t.defaultPrevented||(_S(DS(yS(s)),{select:!0}),document.activeElement===e&&CS(s))}return()=>{s.removeEventListener(fS,l),setTimeout(()=>{let t=new CustomEvent(pS,mS);s.addEventListener(pS,u),s.dispatchEvent(t),t.defaultPrevented||CS(e??document.body,{select:!0}),s.removeEventListener(pS,u),wS.remove(p)},0)}}},[s,l,u,p]);let m=j.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=vS(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&CS(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&CS(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,M.jsx)(C_.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});gS.displayName=hS;function _S(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(CS(r,{select:t}),document.activeElement!==n)return}function vS(e){let t=yS(e);return[bS(t,e),bS(t.reverse(),e)]}function yS(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function bS(e,t){for(let n of e)if(!xS(n,{upTo:t}))return n}function xS(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function SS(e){return e instanceof HTMLInputElement&&`select`in e}function CS(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&SS(e)&&t&&e.select()}}var wS=TS();function TS(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ES(e,t),e.unshift(t)},remove(t){e=ES(e,t),e[0]?.resume()}}}function ES(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function DS(e){return e.filter(e=>e.tagName!==`A`)}var OS=0;function kS(){j.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??AS()),document.body.insertAdjacentElement(`beforeend`,e[1]??AS()),OS++,()=>{OS===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),OS--}},[])}function AS(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var jS=function(){return jS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},jS.apply(this,arguments)};function MS(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function NS(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var PS=`right-scroll-bar-position`,FS=`width-before-scroll-bar`,IS=`with-scroll-bars-hidden`,LS=`--removed-body-scroll-bar-size`;function RS(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function zS(e,t){var n=(0,j.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var BS=typeof window<`u`?j.useLayoutEffect:j.useEffect,VS=new WeakMap;function HS(e,t){var n=zS(t||null,function(t){return e.forEach(function(e){return RS(e,t)})});return BS(function(){var t=VS.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||RS(e,null)}),i.forEach(function(e){r.has(e)||RS(e,a)})}VS.set(n,e)},[e]),n}function US(e){return e}function WS(e,t){t===void 0&&(t=US);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function GS(e){e===void 0&&(e={});var t=WS(null);return t.options=jS({async:!0,ssr:!1},e),t}var KS=function(e){var t=e.sideCar,n=MS(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return j.createElement(r,jS({},n))};KS.isSideCarExport=!0;function qS(e,t){return e.useMedium(t),KS}var JS=GS(),YS=function(){},XS=j.forwardRef(function(e,t){var n=j.useRef(null),r=j.useState({onScrollCapture:YS,onWheelCapture:YS,onTouchMoveCapture:YS}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=MS(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=HS([n,t]),C=jS(jS({},b),i);return j.createElement(j.Fragment,null,u&&j.createElement(x,{sideCar:JS,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?j.cloneElement(j.Children.only(s),jS(jS({},C),{ref:S})):j.createElement(v,jS({},C,{className:c,ref:S}),s))});XS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},XS.classNames={fullWidth:FS,zeroRight:PS};var ZS,QS=function(){if(ZS)return ZS;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function $S(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=QS();return t&&e.setAttribute(`nonce`,t),e}function eC(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function tC(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var nC=function(){var e=0,t=null;return{add:function(n){e==0&&(t=$S())&&(eC(t,n),tC(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},rC=function(){var e=nC();return function(t,n){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},iC=function(){var e=rC();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},aC={left:0,top:0,right:0,gap:0},oC=function(e){return parseInt(e||``,10)||0},sC=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[oC(n),oC(r),oC(i)]},cC=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return aC;var t=sC(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},lC=iC(),uC=`data-scroll-locked`,dC=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
104
|
-
.${
|
|
102
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function yu(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Su(t,`input`,e.processors),output:Su(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function bu(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return bu(r.element,n);if(r.type===`set`)return bu(r.valueType,n);if(r.type===`lazy`)return bu(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return bu(r.innerType,n);if(r.type===`intersection`)return bu(r.left,n)||bu(r.right,n);if(r.type===`record`||r.type===`map`)return bu(r.keyType,n)||bu(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:bu(r.in,n)||bu(r.out,n);if(r.type===`object`){for(let e in r.shape)if(bu(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(bu(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(bu(e,n))return!0;return!!(r.rest&&bu(r.rest,n))}return!1}var xu=(e,t={})=>n=>{let r=gu({...n,processors:t});return _u(e,r),vu(r,e),yu(r,e)},Su=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=gu({...i??{},target:a,io:t,processors:n});return _u(e,o),vu(o,e),yu(o,e)},Cu={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},wu=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Cu[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Tu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Eu=(e,t,n,r)=>{n.type=`boolean`},Du=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ou=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},ku=(e,t,n,r)=>{n.not={}},Au=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},ju=(e,t,n,r)=>{let i=e._zod.def,a=Pa(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Mu=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Nu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Pu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Fu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Iu=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=_u(a.element,t,{...r,path:[...r.path,`items`]})},Lu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=_u(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=_u(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ru=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>_u(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},zu=(e,t,n,r)=>{let i=e._zod.def,a=_u(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=_u(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Bu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>_u(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?_u(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Vu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=_u(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=_u(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=_u(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Hu=(e,t,n,r)=>{let i=e._zod.def,a=_u(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Uu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Gu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ku=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},qu=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;_u(o,t,r);let s=t.seen.get(e);s.ref=o},Ju=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Yu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xu=(e,t,n,r)=>{let i=e._zod.def;_u(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zu=(e,t,n,r)=>{let i=e._zod.innerType;_u(i,t,r);let a=t.seen.get(e);a.ref=i},Qu=N(`ZodISODateTime`,(e,t)=>{Ys.init(e,t),wd.init(e,t)});function $u(e){return Ml(Qu,e)}var ed=N(`ZodISODate`,(e,t)=>{Xs.init(e,t),wd.init(e,t)});function td(e){return Nl(ed,e)}var nd=N(`ZodISOTime`,(e,t)=>{Zs.init(e,t),wd.init(e,t)});function rd(e){return Pl(nd,e)}var id=N(`ZodISODuration`,(e,t)=>{Qs.init(e,t),wd.init(e,t)});function ad(e){return Fl(id,e)}var od=N(`ZodError`,(e,t)=>{vo.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>xo(e,t)},flatten:{value:t=>bo(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Fa,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Fa,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),sd=So(od),cd=wo(od),ld=Eo(od),ud=Oo(od),dd=Ao(od),fd=jo(od),pd=Mo(od),md=No(od),hd=Po(od),gd=Fo(od),_d=Io(od),vd=Lo(od),yd=new WeakMap;function bd(e,t,n){let r=Object.getPrototypeOf(e),i=yd.get(r);if(i||(i=new Set,yd.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var xd=N(`ZodType`,(e,t)=>(Fs.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Su(e,`input`),output:Su(e,`output`)}}),e.toJSONSchema=xu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>sd(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ld(e,t,n),e.parseAsync=async(t,n)=>cd(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ud(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>dd(e,t,n),e.decode=(t,n)=>fd(e,t,n),e.encodeAsync=async(t,n)=>pd(e,t,n),e.decodeAsync=async(t,n)=>md(e,t,n),e.safeEncode=(t,n)=>hd(e,t,n),e.safeDecode=(t,n)=>gd(e,t,n),e.safeEncodeAsync=async(t,n)=>_d(e,t,n),e.safeDecodeAsync=async(t,n)=>vd(e,t,n),bd(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ua(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $a(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Kf(e,t))},superRefine(e,t){return this.check(qf(e,t))},overwrite(e){return this.check(au(e))},optional(){return xf(this)},exactOptional(){return Cf(this)},nullable(){return Tf(this)},nullish(){return xf(Tf(this))},nonoptional(e){return jf(this,e)},array(){return z(this)},or(e){return V([this,e])},and(e){return ff(this,e)},transform(e){return Ff(this,yf(e))},default(e){return Df(this,e)},prefault(e){return kf(this,e)},catch(e){return Nf(this,e)},pipe(e){return Ff(this,e)},readonly(){return Lf(this)},describe(e){let t=this.clone();return cl.add(t,{description:e}),t},meta(...e){if(e.length===0)return cl.get(this);let t=this.clone();return cl.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return cl.get(e)?.description},configurable:!0}),e)),Sd=N(`_ZodString`,(e,t)=>{Is.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,bd(e,`_ZodString`,{regex(...e){return this.check($l(...e))},includes(...e){return this.check(nu(...e))},startsWith(...e){return this.check(ru(...e))},endsWith(...e){return this.check(iu(...e))},min(...e){return this.check(Zl(...e))},max(...e){return this.check(Xl(...e))},length(...e){return this.check(Ql(...e))},nonempty(...e){return this.check(Zl(1,...e))},lowercase(e){return this.check(eu(e))},uppercase(e){return this.check(tu(e))},trim(){return this.check(su())},normalize(...e){return this.check(ou(...e))},toLowerCase(){return this.check(cu())},toUpperCase(){return this.check(lu())},slugify(){return this.check(uu())}})}),Cd=N(`ZodString`,(e,t)=>{Is.init(e,t),Sd.init(e,t),e.email=t=>e.check(ul(Td,t)),e.url=t=>e.check(gl(Od,t)),e.jwt=t=>e.check(jl(Ud,t)),e.emoji=t=>e.check(_l(kd,t)),e.guid=t=>e.check(dl(Ed,t)),e.uuid=t=>e.check(fl(Dd,t)),e.uuidv4=t=>e.check(pl(Dd,t)),e.uuidv6=t=>e.check(ml(Dd,t)),e.uuidv7=t=>e.check(hl(Dd,t)),e.nanoid=t=>e.check(vl(Ad,t)),e.guid=t=>e.check(dl(Ed,t)),e.cuid=t=>e.check(yl(jd,t)),e.cuid2=t=>e.check(bl(Md,t)),e.ulid=t=>e.check(xl(Nd,t)),e.base64=t=>e.check(Ol(Bd,t)),e.base64url=t=>e.check(kl(Vd,t)),e.xid=t=>e.check(Sl(Pd,t)),e.ksuid=t=>e.check(Cl(Fd,t)),e.ipv4=t=>e.check(wl(Id,t)),e.ipv6=t=>e.check(Tl(Ld,t)),e.cidrv4=t=>e.check(El(Rd,t)),e.cidrv6=t=>e.check(Dl(zd,t)),e.e164=t=>e.check(Al(Hd,t)),e.datetime=t=>e.check($u(t)),e.date=t=>e.check(td(t)),e.time=t=>e.check(rd(t)),e.duration=t=>e.check(ad(t))});function F(e){return ll(Cd,e)}var wd=N(`ZodStringFormat`,(e,t)=>{Ls.init(e,t),Sd.init(e,t)}),Td=N(`ZodEmail`,(e,t)=>{Bs.init(e,t),wd.init(e,t)}),Ed=N(`ZodGUID`,(e,t)=>{Rs.init(e,t),wd.init(e,t)}),Dd=N(`ZodUUID`,(e,t)=>{zs.init(e,t),wd.init(e,t)}),Od=N(`ZodURL`,(e,t)=>{Vs.init(e,t),wd.init(e,t)}),kd=N(`ZodEmoji`,(e,t)=>{Hs.init(e,t),wd.init(e,t)}),Ad=N(`ZodNanoID`,(e,t)=>{Us.init(e,t),wd.init(e,t)}),jd=N(`ZodCUID`,(e,t)=>{Ws.init(e,t),wd.init(e,t)}),Md=N(`ZodCUID2`,(e,t)=>{Gs.init(e,t),wd.init(e,t)}),Nd=N(`ZodULID`,(e,t)=>{Ks.init(e,t),wd.init(e,t)}),Pd=N(`ZodXID`,(e,t)=>{qs.init(e,t),wd.init(e,t)}),Fd=N(`ZodKSUID`,(e,t)=>{Js.init(e,t),wd.init(e,t)}),Id=N(`ZodIPv4`,(e,t)=>{$s.init(e,t),wd.init(e,t)}),Ld=N(`ZodIPv6`,(e,t)=>{ec.init(e,t),wd.init(e,t)}),Rd=N(`ZodCIDRv4`,(e,t)=>{tc.init(e,t),wd.init(e,t)}),zd=N(`ZodCIDRv6`,(e,t)=>{nc.init(e,t),wd.init(e,t)}),Bd=N(`ZodBase64`,(e,t)=>{ic.init(e,t),wd.init(e,t)}),Vd=N(`ZodBase64URL`,(e,t)=>{oc.init(e,t),wd.init(e,t)}),Hd=N(`ZodE164`,(e,t)=>{sc.init(e,t),wd.init(e,t)}),Ud=N(`ZodJWT`,(e,t)=>{lc.init(e,t),wd.init(e,t)}),Wd=N(`ZodNumber`,(e,t)=>{uc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r),bd(e,`ZodNumber`,{gt(e,t){return this.check(ql(e,t))},gte(e,t){return this.check(Jl(e,t))},min(e,t){return this.check(Jl(e,t))},lt(e,t){return this.check(Gl(e,t))},lte(e,t){return this.check(Kl(e,t))},max(e,t){return this.check(Kl(e,t))},int(e){return this.check(Kd(e))},safe(e){return this.check(Kd(e))},positive(e){return this.check(ql(0,e))},nonnegative(e){return this.check(Jl(0,e))},negative(e){return this.check(Gl(0,e))},nonpositive(e){return this.check(Kl(0,e))},multipleOf(e,t){return this.check(Yl(e,t))},step(e,t){return this.check(Yl(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function I(e){return Il(Wd,e)}var Gd=N(`ZodNumberFormat`,(e,t)=>{dc.init(e,t),Wd.init(e,t)});function Kd(e){return Ll(Gd,e)}var qd=N(`ZodBoolean`,(e,t)=>{fc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r)});function L(e){return Rl(qd,e)}var Jd=N(`ZodNull`,(e,t)=>{pc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r)});function Yd(e){return zl(Jd,e)}var Xd=N(`ZodAny`,(e,t)=>{mc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Zd(){return Bl(Xd)}var Qd=N(`ZodUnknown`,(e,t)=>{hc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function R(){return Vl(Qd)}var $d=N(`ZodNever`,(e,t)=>{gc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r)});function ef(e){return Hl($d,e)}var tf=N(`ZodVoid`,(e,t)=>{_c.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r)});function nf(e){return Ul(tf,e)}var rf=N(`ZodDate`,(e,t)=>{vc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Au(e,t,n,r),e.min=(t,n)=>e.check(Jl(t,n)),e.max=(t,n)=>e.check(Kl(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function af(e){return Wl(rf,e)}var of=N(`ZodArray`,(e,t)=>{bc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iu(e,t,n,r),e.element=t.element,bd(e,`ZodArray`,{min(e,t){return this.check(Zl(e,t))},nonempty(e){return this.check(Zl(1,e))},max(e,t){return this.check(Xl(e,t))},length(e,t){return this.check(Ql(e,t))},unwrap(){return this.element}})});function z(e,t){return du(of,e,t)}var sf=N(`ZodObject`,(e,t)=>{Tc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lu(e,t,n,r),Va(e,`shape`,()=>t.shape),bd(e,`ZodObject`,{keyof(){return U(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:R()})},loose(){return this.clone({...this._zod.def,catchall:R()})},strict(){return this.clone({...this._zod.def,catchall:ef()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return io(this,e)},safeExtend(e){return ao(this,e)},merge(e){return oo(this,e)},pick(e){return no(this,e)},omit(e){return ro(this,e)},partial(...e){return so(bf,this,e[0])},required(...e){return co(Af,this,e[0])}})});function B(e,t){return new sf({type:`object`,shape:e??{},...P(t)})}var cf=N(`ZodUnion`,(e,t)=>{Dc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ru(e,t,n,r),e.options=t.options});function V(e,t){return new cf({type:`union`,options:e,...P(t)})}var lf=N(`ZodDiscriminatedUnion`,(e,t)=>{cf.init(e,t),Oc.init(e,t)});function uf(e,t,n){return new lf({type:`union`,options:t,discriminator:e,...P(n)})}var df=N(`ZodIntersection`,(e,t)=>{kc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zu(e,t,n,r)});function ff(e,t){return new df({type:`intersection`,left:e,right:t})}var pf=N(`ZodTuple`,(e,t)=>{Mc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bu(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function mf(e,t,n){let r=t instanceof Fs;return new pf({type:`tuple`,items:e,rest:r?t:null,...P(r?n:t)})}var hf=N(`ZodRecord`,(e,t)=>{Ic.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vu(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function H(e,t,n){return!t||!t._zod?new hf({type:`record`,keyType:F(),valueType:e,...P(t)}):new hf({type:`record`,keyType:e,valueType:t,...P(n)})}var gf=N(`ZodEnum`,(e,t)=>{Lc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new gf({...t,checks:[],...P(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new gf({...t,checks:[],...P(r),entries:i})}});function U(e,t){return new gf({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...P(t)})}var _f=N(`ZodLiteral`,(e,t)=>{Rc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mu(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function W(e,t){return new _f({type:`literal`,values:Array.isArray(e)?e:[e],...P(t)})}var vf=N(`ZodTransform`,(e,t)=>{zc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ja(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(go(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(go(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function yf(e){return new vf({type:`transform`,transform:e})}var bf=N(`ZodOptional`,(e,t)=>{Vc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xf(e){return new bf({type:`optional`,innerType:e})}var Sf=N(`ZodExactOptional`,(e,t)=>{Hc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cf(e){return new Sf({type:`optional`,innerType:e})}var wf=N(`ZodNullable`,(e,t)=>{Uc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tf(e){return new wf({type:`nullable`,innerType:e})}var Ef=N(`ZodDefault`,(e,t)=>{Wc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Df(e,t){return new Ef({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xa(t)}})}var Of=N(`ZodPrefault`,(e,t)=>{Kc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kf(e,t){return new Of({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xa(t)}})}var Af=N(`ZodNonOptional`,(e,t)=>{qc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jf(e,t){return new Af({type:`nonoptional`,innerType:e,...P(t)})}var Mf=N(`ZodCatch`,(e,t)=>{Yc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Nf(e,t){return new Mf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Pf=N(`ZodPipe`,(e,t)=>{Xc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qu(e,t,n,r),e.in=t.in,e.out=t.out});function Ff(e,t){return new Pf({type:`pipe`,in:e,out:t})}var If=N(`ZodReadonly`,(e,t)=>{Qc.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lf(e){return new If({type:`readonly`,innerType:e})}var Rf=N(`ZodLazy`,(e,t)=>{nl.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zu(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function zf(e){return new Rf({type:`lazy`,getter:e})}var Bf=N(`ZodPromise`,(e,t)=>{tl.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vf(e){return new Bf({type:`promise`,innerType:e})}var Hf=N(`ZodFunction`,(e,t)=>{el.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pu(e,t,n,r)});function Uf(e){return new Hf({type:`function`,input:Array.isArray(e?.input)?mf(e?.input):e?.input??z(R()),output:e?.output??R()})}var Wf=N(`ZodCustom`,(e,t)=>{rl.init(e,t),xd.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nu(e,t,n,r)});function Gf(e,t){return fu(Wf,e??(()=>!0),t)}function Kf(e,t={}){return pu(Wf,e,t)}function qf(e,t){return mu(e,t)}var Jf=c(_(),1);function G(e){if(typeof process<`u`&&{}.OS_EAGER_SCHEMAS===`1`)return e();let t,n=()=>(t===void 0&&(t=e()),t);return new Proxy(function(){},{get(e,t){let r=n(),i=r[t];return typeof i==`function`?i.bind(r):i},set(e,t,r){let i=n();return i[t]=r,!0},has(e,t){return t in n()},ownKeys(){return Reflect.ownKeys(n())},getOwnPropertyDescriptor(e,t){return Reflect.getOwnPropertyDescriptor(n(),t)},getPrototypeOf(){return Reflect.getPrototypeOf(n())}})}var Yf=G(()=>B({$field:F().describe(`Field Reference/Column Name`)}));G(()=>B({$eq:Zd().optional(),$ne:Zd().optional()})),G(()=>B({$gt:V([I(),af(),Yf]).optional(),$gte:V([I(),af(),Yf]).optional(),$lt:V([I(),af(),Yf]).optional(),$lte:V([I(),af(),Yf]).optional()})),G(()=>B({$in:z(Zd()).optional(),$nin:z(Zd()).optional()})),G(()=>B({$between:mf([V([I(),af(),Yf]),V([I(),af(),Yf])]).optional()})),G(()=>B({$contains:F().optional(),$notContains:F().optional(),$startsWith:F().optional(),$endsWith:F().optional()})),G(()=>B({$null:L().optional(),$exists:L().optional()}));var Xf=G(()=>B({$eq:Zd().optional(),$ne:Zd().optional(),$gt:V([I(),af(),Yf]).optional(),$gte:V([I(),af(),Yf]).optional(),$lt:V([I(),af(),Yf]).optional(),$lte:V([I(),af(),Yf]).optional(),$in:z(Zd()).optional(),$nin:z(Zd()).optional(),$between:mf([V([I(),af(),Yf]),V([I(),af(),Yf])]).optional(),$contains:F().optional(),$notContains:F().optional(),$startsWith:F().optional(),$endsWith:F().optional(),$null:L().optional(),$exists:L().optional()})),Zf=zf(()=>H(F(),R()).and(B({$and:z(Zf).optional(),$or:z(Zf).optional(),$not:Zf.optional()})));G(()=>B({where:Zf.optional()}));var Qf=zf(()=>B({$and:z(V([H(F(),Xf),Qf])).optional(),$or:z(V([H(F(),Xf),Qf])).optional(),$not:V([H(F(),Xf),Qf]).optional()})),$f=new Set([`=`,`==`,`!=`,`<>`,`>`,`>=`,`<`,`<=`,`in`,`nin`,`not_in`,`contains`,`notcontains`,`not_contains`,`like`,`startswith`,`starts_with`,`endswith`,`ends_with`,`between`,`is_null`,`is_not_null`]);function ep(e){if(!Array.isArray(e)||e.length===0)return!1;let t=e[0];if(typeof t==`string`){let n=t.toLowerCase();if(n===`and`||n===`or`)return e.length>=2&&e.slice(1).every(e=>ep(e));if(e.length>=2&&typeof e[1]==`string`)return $f.has(e[1].toLowerCase())}return e.every(e=>ep(e))?e.length>0:!1}var tp=[`$eq`,`$ne`,`$gt`,`$gte`,`$lt`,`$lte`,`$in`,`$nin`,`$between`,`$contains`,`$notContains`,`$startsWith`,`$endsWith`,`$null`,`$exists`],np=[`$and`,`$or`,`$not`];[...tp,...np];var rp=G(()=>B({field:F(),order:U([`asc`,`desc`]).default(`asc`)})),ip=U([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`array_agg`,`string_agg`]),ap=U([`day`,`week`,`month`,`quarter`,`year`]),op=G(()=>V([F(),B({field:F().describe(`Field to group by`),dateGranularity:ap.optional().describe(`Bucket date values into uniform periods (day/week/month/quarter/year)`),alias:F().optional().describe(`Alias for the projected group value`)})])),sp=G(()=>B({function:ip.describe(`Aggregation function`),field:F().optional().describe(`Field to aggregate (optional for COUNT(*))`),alias:F().describe(`Result column alias`),distinct:L().optional().describe(`Apply DISTINCT before aggregation`),filter:Zf.optional().describe(`Filter/Condition to apply to the aggregation (FILTER WHERE clause)`)})),cp=U([`inner`,`left`,`right`,`full`]),lp=U([`auto`,`database`,`hash`,`loop`]),up=zf(()=>B({type:cp.describe(`Join type`),strategy:lp.optional().describe(`Execution strategy hint`),object:F().describe(`Object/table to join`),alias:F().optional().describe(`Table alias`),on:Zf.describe(`Join condition`),subquery:zf(()=>_p).optional().describe(`Subquery instead of object`)})),dp=U([`row_number`,`rank`,`dense_rank`,`percent_rank`,`lag`,`lead`,`first_value`,`last_value`,`sum`,`avg`,`count`,`min`,`max`]),fp=G(()=>B({partitionBy:z(F()).optional().describe(`PARTITION BY fields`),orderBy:z(rp).optional().describe(`ORDER BY specification`),frame:B({type:U([`rows`,`range`]).optional(),start:F().optional().describe(`Frame start (e.g., "UNBOUNDED PRECEDING", "1 PRECEDING")`),end:F().optional().describe(`Frame end (e.g., "CURRENT ROW", "1 FOLLOWING")`)}).optional().describe(`Window frame specification`)})),pp=G(()=>B({function:dp.describe(`Window function name`),field:F().optional().describe(`Field to operate on (for aggregate window functions)`),alias:F().describe(`Result column alias`),over:fp.describe(`Window specification (OVER clause)`)})),mp=zf(()=>V([F(),B({field:F(),fields:z(mp).optional(),alias:F().optional()})])),hp=G(()=>B({query:F().describe(`Search query text`),fields:z(F()).optional().describe(`Fields to search in (if not specified, searches all text fields)`),fuzzy:L().optional().default(!1).describe(`Enable fuzzy matching (tolerates typos)`),operator:U([`and`,`or`]).optional().default(`or`).describe(`Logical operator between terms`),boost:H(F(),I()).optional().describe(`Field-specific relevance boosting (field name -> boost factor)`),minScore:I().optional().describe(`Minimum relevance score threshold`),language:F().optional().describe(`Language for text analysis (e.g., "en", "zh", "es")`),highlight:L().optional().default(!1).describe(`Enable search result highlighting`)})),gp=B({object:F().describe(`Object name (e.g. account)`),fields:z(mp).optional().describe(`Fields to retrieve`),where:Zf.optional().describe(`Filtering criteria (WHERE)`),search:hp.optional().describe(`Full-text search configuration ($search parameter)`),orderBy:z(rp).optional().describe(`Sorting instructions (ORDER BY)`),limit:I().optional().describe(`Max records to return (LIMIT)`),offset:I().optional().describe(`Records to skip (OFFSET)`),top:I().optional().describe(`Alias for limit (OData compatibility)`),cursor:H(F(),R()).optional().describe(`Cursor for keyset pagination`),joins:z(up).optional().describe(`Explicit Table Joins`),aggregations:z(sp).optional().describe(`Aggregation functions`),groupBy:z(op).optional().describe("GROUP BY targets (strings or `{field, dateGranularity?}` objects for date bucketing)"),having:Zf.optional().describe(`HAVING clause for aggregation filtering`),windowFunctions:z(pp).optional().describe(`Window functions with OVER clause`),distinct:L().optional().describe(`SELECT DISTINCT flag`)}),_p=G(()=>gp.extend({expand:zf(()=>H(F(),_p)).optional().describe(`Recursive relation loading map. Keys are lookup/master_detail field names; values are nested QueryAST objects that control select, filter, sort, and further expansion on the related object. The engine resolves expand via batch $in queries (driver-agnostic) with a default max depth of 3.`)})),vp=[`today`,`yesterday`,`tomorrow`,`now`],yp=[`current_week_start`,`current_week_end`,`current_month_start`,`current_month_end`,`current_quarter_start`,`current_quarter_end`,`current_year_start`,`current_year_end`,`last_week_start`,`last_week_end`,`last_month_start`,`last_month_end`,`last_quarter_start`,`last_quarter_end`,`last_year_start`,`last_year_end`,`next_week_start`,`next_week_end`,`next_month_start`,`next_month_end`,`next_quarter_start`,`next_quarter_end`,`next_year_start`,`next_year_end`],bp=[`week_start`,`week_end`,`month_start`,`month_end`,`quarter_start`,`quarter_end`,`year_start`,`year_end`],xp=[...vp,...yp,...bp],Sp=/^(\d+)_(minutes?|hours?|days?|weeks?|months?|years?)_(ago|from_now)$/,Cp=[`minute`,`hour`,`day`,`week`,`month`,`year`];function wp(e){return xp.includes(e)||Sp.test(e)}F().refine(wp,{message:`Unknown date macro. Must be a fixed token (see DATE_MACRO_TOKENS) or match {N_<unit>_(ago|from_now)} where unit is one of: `+Cp.join(`, `)});var Tp=/^\$?\{([a-zA-Z0-9_]+)\}$/;F().refine(e=>{let t=e.match(Tp);return!!t&&wp(t[1])},{message:`Not a recognised {date-macro} placeholder`});var Ep=G(()=>F().min(2,{message:`System identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`System identifier must be lowercase, starting with a letter, and may contain letters, numbers, underscores, or dots (e.g., "user_profile" or "order.created")`}).describe(`System identifier (lowercase with underscores or dots)`)),Dp=G(()=>F().min(2,{message:`Identifier must be at least 2 characters`}).regex(/^[a-z][a-z0-9_]*$/,{message:`Identifier must be lowercase snake_case, starting with a letter, and may contain only letters, numbers, and underscores (e.g., "user_profile")`}).describe(`Snake case identifier (lowercase with underscores only)`));G(()=>F().min(3,{message:`Event name must be at least 3 characters`}).regex(/^[a-z][a-z0-9_.]*$/,{message:`Event name must be lowercase with dots for namespacing (e.g., "user.created", "order.paid")`}).describe(`Event name (lowercase with dot notation for namespacing)`));var Op=U([`cel`,`js`,`cron`,`template`]),kp=B({rationale:F().optional(),generatedBy:F().optional()}),Ap=B({dialect:Op,source:F().min(1).optional(),ast:R().optional(),meta:kp.optional()}).refine(e=>e.source!==void 0||e.ast!==void 0,{message:"Expression requires at least one of `source` or `ast`"}),jp=V([F().min(1).transform(e=>({dialect:`cel`,source:e})),Ap]);V([F().min(1).transform(e=>({dialect:`cron`,source:e})),Ap]);var Mp=V([F().min(1).transform(e=>({dialect:`template`,source:e})),Ap]),Np=G(()=>U([`aes-256-gcm`,`aes-256-cbc`,`chacha20-poly1305`]).describe(`Supported encryption algorithm`)),Pp=G(()=>U([`local`,`aws-kms`,`azure-key-vault`,`gcp-kms`,`hashicorp-vault`]).describe(`Key management service provider`)),Fp=G(()=>B({enabled:L().default(!1).describe(`Enable automatic key rotation`),frequencyDays:I().min(1).default(90).describe(`Rotation frequency in days`),retainOldVersions:I().default(3).describe(`Number of old key versions to retain`),autoRotate:L().default(!0).describe(`Automatically rotate without manual approval`)}).describe(`Policy for automatic encryption key rotation`)),Ip=G(()=>B({enabled:L().default(!1).describe(`Enable field-level encryption`),algorithm:Np.default(`aes-256-gcm`).describe(`Encryption algorithm`),keyManagement:B({provider:Pp.describe(`Key management service provider`),keyId:F().optional().describe(`Key identifier in the provider`),rotationPolicy:Fp.optional().describe(`Key rotation policy`)}).describe(`Key management configuration`),scope:U([`field`,`record`,`table`,`database`]).describe(`Encryption scope level`),deterministicEncryption:L().default(!1).describe(`Allows equality queries on encrypted data`),searchableEncryption:L().default(!1).describe(`Allows search on encrypted data`)}).describe(`Field-level encryption configuration`));G(()=>B({fieldName:F().describe(`Name of the field to encrypt`),encryptionConfig:Ip.describe(`Encryption settings for this field`),indexable:L().default(!1).describe(`Allow indexing on encrypted field`)}).describe(`Per-field encryption assignment`));var Lp=G(()=>U([`redact`,`partial`,`hash`,`tokenize`,`randomize`,`nullify`,`substitute`]).describe(`Data masking strategy for PII protection`)),Rp=G(()=>B({field:F().describe(`Field name to apply masking to`),strategy:Lp.describe(`Masking strategy to use`),pattern:F().optional().describe(`Regex pattern for partial masking`),preserveFormat:L().default(!0).describe(`Keep the original data format after masking`),preserveLength:L().default(!0).describe(`Keep the original data length after masking`),roles:z(F()).optional().describe(`Roles that see masked data`),exemptRoles:z(F()).optional().describe(`Roles that see unmasked data`)}).describe(`Masking rule for a single field`));G(()=>B({enabled:L().default(!1).describe(`Enable data masking`),rules:z(Rp).describe(`List of field-level masking rules`),auditUnmasking:L().default(!0).describe(`Log when masked data is accessed unmasked`)}).describe(`Top-level data masking configuration for PII protection`));var zp=U(`text.textarea.email.url.phone.password.markdown.html.richtext.number.currency.percent.date.datetime.time.boolean.toggle.select.multiselect.radio.checkboxes.lookup.master_detail.tree.image.file.avatar.video.audio.formula.summary.autonumber.composite.repeater.record.location.address.code.json.color.rating.slider.signature.qrcode.progress.tags.vector`.split(`.`)),Bp=G(()=>B({label:F().describe(`Display label (human-readable, any case allowed)`),value:Ep.describe(`Stored value (lowercase machine identifier)`),color:F().optional().describe(`Color code for badges/charts`),default:L().optional().describe(`Is default option`)}));G(()=>B({latitude:I().min(-90).max(90).describe(`Latitude coordinate`),longitude:I().min(-180).max(180).describe(`Longitude coordinate`),altitude:I().optional().describe(`Altitude in meters`),accuracy:I().optional().describe(`Accuracy in meters`)}));var Vp=G(()=>B({precision:I().int().min(0).max(10).default(2).describe(`Decimal precision (default: 2)`),currencyMode:U([`dynamic`,`fixed`]).default(`dynamic`).describe(`Currency mode: dynamic (user selectable) or fixed (single currency)`),defaultCurrency:F().length(3).default(`CNY`).describe(`Default or fixed currency code (ISO 4217, e.g., USD, CNY, EUR)`)}));G(()=>B({value:I().describe(`Monetary amount`),currency:F().length(3).describe(`Currency code (ISO 4217)`)})),G(()=>B({street:F().optional().describe(`Street address`),city:F().optional().describe(`City name`),state:F().optional().describe(`State/Province`),postalCode:F().optional().describe(`Postal/ZIP code`),country:F().optional().describe(`Country name or code`),countryCode:F().optional().describe(`ISO country code (e.g., US, GB)`),formatted:F().optional().describe(`Formatted address string`)}));var Hp=G(()=>B({dimensions:I().int().min(1).max(1e4).describe(`Vector dimensionality (e.g., 1536 for OpenAI embeddings)`),distanceMetric:U([`cosine`,`euclidean`,`dotProduct`,`manhattan`]).default(`cosine`).describe(`Distance/similarity metric for vector search`),normalized:L().default(!1).describe(`Whether vectors are normalized (unit length)`),indexed:L().default(!0).describe(`Whether to create a vector index for fast similarity search`),indexType:U([`hnsw`,`ivfflat`,`flat`]).optional().describe(`Vector index algorithm (HNSW for high accuracy, IVFFlat for large datasets)`)})),Up=G(()=>B({minSize:I().min(0).optional().describe(`Minimum file size in bytes`),maxSize:I().min(1).optional().describe(`Maximum file size in bytes (e.g., 10485760 = 10MB)`),allowedTypes:z(F()).optional().describe(`Allowed file extensions (e.g., [".pdf", ".docx", ".jpg"])`),blockedTypes:z(F()).optional().describe(`Blocked file extensions (e.g., [".exe", ".bat", ".sh"])`),allowedMimeTypes:z(F()).optional().describe(`Allowed MIME types (e.g., ["image/jpeg", "application/pdf"])`),blockedMimeTypes:z(F()).optional().describe(`Blocked MIME types`),virusScan:L().default(!1).describe(`Enable virus scanning for uploaded files`),virusScanProvider:U([`clamav`,`virustotal`,`metadefender`,`custom`]).optional().describe(`Virus scanning service provider`),virusScanOnUpload:L().default(!0).describe(`Scan files immediately on upload`),quarantineOnThreat:L().default(!0).describe(`Quarantine files if threat detected`),storageProvider:F().optional().describe(`Object storage provider name (references ObjectStorageConfig)`),storageBucket:F().optional().describe(`Target bucket name`),storagePrefix:F().optional().describe(`Storage path prefix (e.g., "uploads/documents/")`),imageValidation:B({minWidth:I().min(1).optional().describe(`Minimum image width in pixels`),maxWidth:I().min(1).optional().describe(`Maximum image width in pixels`),minHeight:I().min(1).optional().describe(`Minimum image height in pixels`),maxHeight:I().min(1).optional().describe(`Maximum image height in pixels`),aspectRatio:F().optional().describe(`Required aspect ratio (e.g., "16:9", "1:1")`),generateThumbnails:L().default(!1).describe(`Auto-generate thumbnails`),thumbnailSizes:z(B({name:F().describe(`Thumbnail variant name (e.g., "small", "medium", "large")`),width:I().min(1).describe(`Thumbnail width in pixels`),height:I().min(1).describe(`Thumbnail height in pixels`),crop:L().default(!1).describe(`Crop to exact dimensions`)})).optional().describe(`Thumbnail size configurations`),preserveMetadata:L().default(!1).describe(`Preserve EXIF metadata`),autoRotate:L().default(!0).describe(`Auto-rotate based on EXIF orientation`)}).optional().describe(`Image-specific validation rules`),allowMultiple:L().default(!1).describe(`Allow multiple file uploads (overrides field.multiple)`),allowReplace:L().default(!0).describe(`Allow replacing existing files`),allowDelete:L().default(!0).describe(`Allow deleting uploaded files`),requireUpload:L().default(!1).describe(`Require at least one file when field is required`),extractMetadata:L().default(!0).describe(`Extract file metadata (name, size, type, etc.)`),extractText:L().default(!1).describe(`Extract text content from documents (OCR/parsing)`),versioningEnabled:L().default(!1).describe(`Keep previous versions of replaced files`),maxVersions:I().min(1).optional().describe(`Maximum number of versions to retain`),publicRead:L().default(!1).describe(`Allow public read access to uploaded files`),presignedUrlExpiry:I().min(60).max(604800).default(3600).describe(`Presigned URL expiration in seconds (default: 1 hour)`)}).refine(e=>!(e.minSize!==void 0&&e.maxSize!==void 0&&e.minSize>e.maxSize),{message:`minSize must be less than or equal to maxSize`}).refine(e=>!(e.virusScanProvider!==void 0&&e.virusScan!==!0),{message:`virusScanProvider requires virusScan to be enabled`})),Wp=G(()=>B({uniqueness:L().default(!1).describe(`Enforce unique values across all records`),completeness:I().min(0).max(1).default(0).describe(`Minimum ratio of non-null values (0-1, default: 0 = no requirement)`),accuracy:B({source:F().describe(`Reference data source for validation (e.g., "api.verify.com", "master_data")`),threshold:I().min(0).max(1).describe(`Minimum accuracy threshold (0-1, e.g., 0.95 = 95% match required)`)}).optional().describe(`Accuracy validation configuration`)})),Gp=G(()=>B({enabled:L().describe(`Enable caching for computed field results`),ttl:I().min(0).describe(`Cache TTL in seconds (0 = no expiration)`),invalidateOn:z(F()).describe(`Field paths that invalidate cache (e.g., ["inventory.quantity", "pricing.base_price"])`)})),Kp=G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine name (snake_case)`).optional(),label:F().optional().describe(`Human readable label`),type:zp.describe(`Field Data Type`),description:F().optional().describe(`Tooltip/Help text`),format:F().optional().describe(`Format string (e.g. email, phone)`),columnName:F().optional().describe(`Physical column name in the target datasource. Defaults to the field key when not set.`),required:L().default(!1).describe(`Is required`),searchable:L().default(!1).describe(`Is searchable`),multiple:L().default(!1).describe(`Allow multiple values (Stores as Array/JSON). Applicable for select, lookup, file, image.`),unique:L().default(!1).describe(`Is unique constraint`),defaultValue:R().optional().describe(`Default value`),maxLength:I().optional().describe(`Max character length`),minLength:I().optional().describe(`Min character length`),precision:I().optional().describe(`Total digits`),scale:I().optional().describe(`Decimal places`),min:I().optional().describe(`Minimum value`),max:I().optional().describe(`Maximum value`),options:z(Bp).optional().describe(`Static options for select/multiselect`),reference:F().optional().describe(`Target object name (snake_case) for lookup/master_detail fields. Required for relationship types. Used by $expand to resolve foreign key IDs into full objects.`),referenceFilters:z(F()).optional().describe(`Filters applied to lookup dialogs (e.g. "active = true")`),writeRequiresMasterRead:L().optional().describe(`If true, user needs read access to master record to edit this field`),deleteBehavior:U([`set_null`,`cascade`,`restrict`]).optional().default(`set_null`).describe(`What happens if referenced record is deleted`),expression:jp.optional().describe("Formula expression (CEL). e.g. F`record.amount * 0.1`"),summaryOperations:B({object:F().describe(`Source child object name for roll-up`),field:F().describe(`Field on child object to aggregate`),function:U([`count`,`sum`,`min`,`max`,`avg`]).describe(`Aggregation function to apply`)}).optional().describe(`Roll-up summary definition`),language:F().optional().describe(`Programming language for syntax highlighting (e.g., javascript, python, sql)`),theme:F().optional().describe(`Code editor theme (e.g., dark, light, monokai)`),lineNumbers:L().optional().describe(`Show line numbers in code editor`),maxRating:I().optional().describe(`Maximum rating value (default: 5)`),allowHalf:L().optional().describe(`Allow half-star ratings`),displayMap:L().optional().describe(`Display map widget for location field`),allowGeocoding:L().optional().describe(`Allow address-to-coordinate conversion`),addressFormat:U([`us`,`uk`,`international`]).optional().describe(`Address format template`),colorFormat:U([`hex`,`rgb`,`rgba`,`hsl`]).optional().describe(`Color value format`),allowAlpha:L().optional().describe(`Allow transparency/alpha channel`),presetColors:z(F()).optional().describe(`Preset color options`),step:I().optional().describe(`Step increment for slider (default: 1)`),showValue:L().optional().describe(`Display current value on slider`),marks:H(F(),F()).optional().describe(`Custom marks/labels at specific values (e.g., {0: "Low", 50: "Medium", 100: "High"})`),barcodeFormat:U([`qr`,`ean13`,`ean8`,`code128`,`code39`,`upca`,`upce`]).optional().describe(`Barcode format type`),qrErrorCorrection:U([`L`,`M`,`Q`,`H`]).optional().describe(`QR code error correction level (L=7%, M=15%, Q=25%, H=30%). Only applicable when barcodeFormat is "qr"`),displayValue:L().optional().describe(`Display human-readable value below barcode/QR code`),allowScanning:L().optional().describe(`Enable camera scanning for barcode/QR code input`),currencyConfig:Vp.optional().describe(`Configuration for currency field type`),vectorConfig:Hp.optional().describe(`Configuration for vector field type (AI/ML embeddings)`),fileAttachmentConfig:Up.optional().describe(`Configuration for file and attachment field types`),encryptionConfig:Ip.optional().describe(`Field-level encryption configuration for sensitive data (GDPR/HIPAA/PCI-DSS)`),maskingRule:Rp.optional().describe(`Data masking rules for PII protection`),auditTrail:L().default(!1).describe(`Enable detailed audit trail for this field (tracks all changes with user and timestamp)`),dependencies:z(F()).optional().describe(`Array of field names that this field depends on (for formulas, visibility rules, etc.)`),cached:Gp.optional().describe(`Caching configuration for computed/formula fields`),dataQuality:Wp.optional().describe(`Data quality validation and monitoring rules`),group:F().optional().describe(`Field group name for organizing fields in forms and layouts (e.g., "contact_info", "billing", "system")`),conditionalRequired:jp.optional().describe("Predicate (CEL) — field is required when TRUE. e.g. P`record.status == 'closed_won'`"),hidden:L().default(!1).describe(`Hidden from default UI`),readonly:L().default(!1).describe(`Read-only in UI`),system:L().optional().describe(`Auto-injected system/audit field (e.g. created_at, updated_by, organization_id). Tools that surface system fields separately from author-declared business fields should branch on this flag.`),sortable:L().optional().default(!0).describe(`Whether field is sortable in list views`),inlineHelpText:F().optional().describe(`Help text displayed below the field in forms`),trackFeedHistory:L().optional().describe(`Track field changes in Chatter/activity feed (Salesforce pattern)`),caseSensitive:L().optional().describe(`Whether text comparisons are case-sensitive`),autonumberFormat:F().optional().describe(`Auto-number display format pattern (e.g., "CASE-{0000}")`),index:L().default(!1).describe(`Create standard database index`),externalId:L().default(!1).describe(`Is external ID for upsert operations`)})),qp=B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique rule name (snake_case)`),label:F().optional().describe(`Human-readable label for the rule listing`),description:F().optional().describe(`Administrative notes explaining the business reason`),active:L().default(!0),events:z(U([`insert`,`update`,`delete`])).default([`insert`,`update`]).describe(`Validation contexts`),priority:I().int().min(0).max(9999).default(100).describe(`Execution priority (lower runs first, default: 100)`),tags:z(F()).optional().describe(`Categorization tags (e.g., "compliance", "billing")`),severity:U([`error`,`warning`,`info`]).default(`error`),message:F().describe(`Error message to display to the user`)}),Jp=G(()=>qp.extend({type:W(`script`),condition:jp.describe("Predicate (CEL). If TRUE, validation fails. e.g. P`record.amount < 0`")})),Yp=G(()=>qp.extend({type:W(`unique`),fields:z(F()).describe(`Fields that must be combined unique`),scope:jp.optional().describe("Predicate (CEL) limiting uniqueness scope. e.g. P`record.active == true`"),caseSensitive:L().default(!0)})),Xp=G(()=>qp.extend({type:W(`state_machine`),field:F().describe(`State field (e.g. status)`),transitions:H(F(),z(F())).describe(`Map of { OldState: [AllowedNewStates] }`)})),Zp=G(()=>qp.extend({type:W(`format`),field:F(),regex:F().optional(),format:U([`email`,`url`,`phone`,`json`]).optional()})),Qp=G(()=>qp.extend({type:W(`cross_field`),condition:jp.describe("Predicate (CEL) comparing fields. e.g. P`record.end_date > record.start_date`"),fields:z(F()).describe(`Fields involved in the validation`)})),$p=G(()=>qp.extend({type:W(`json_schema`),field:F().describe(`JSON field to validate`),schema:H(F(),R()).describe(`JSON Schema object definition`)})),em=G(()=>qp.extend({type:W(`async`),field:F().describe(`Field to validate`),validatorUrl:F().optional().describe(`External API endpoint for validation`),method:U([`GET`,`POST`]).default(`GET`).describe(`HTTP method for external call`),headers:H(F(),F()).optional().describe(`Custom headers for the request`),validatorFunction:F().optional().describe(`Reference to custom validator function`),timeout:I().optional().default(5e3).describe(`Timeout in milliseconds`),debounce:I().optional().describe(`Debounce delay in milliseconds`),params:H(F(),R()).optional().describe(`Additional parameters to pass to validator`)})),tm=G(()=>qp.extend({type:W(`custom`),handler:F().describe(`Name of the custom validation function registered in the system`),params:H(F(),R()).optional().describe(`Parameters passed to the custom handler`)})),nm=zf(()=>uf(`type`,[Jp,Yp,Xp,Zp,Qp,$p,em,tm,rm])),rm=G(()=>qp.extend({type:W(`conditional`),when:jp.describe("Predicate (CEL). e.g. P`record.type == 'enterprise'`"),then:nm.describe(`Validation rule to apply when condition is true`),otherwise:nm.optional().describe(`Validation rule to apply when condition is false`)})),im=G(()=>V([F().describe(`Action Name`),B({type:F(),params:H(F(),R()).optional()})])),am=G(()=>V([F().describe(`Guard Name (e.g., "isManager", "amountGT1000")`),B({type:F(),params:H(F(),R()).optional()})])),om=G(()=>B({target:F().optional().describe(`Target State ID`),cond:am.optional().describe(`Condition (Guard) required to take this path`),actions:z(im).optional().describe(`Actions to execute during transition`),description:F().optional().describe(`Human readable description of this rule`)}));G(()=>B({type:F().describe(`Event Type (e.g. "APPROVE", "REJECT", "Submit")`),schema:H(F(),R()).optional().describe(`Expected event payload structure`)}));var sm=zf(()=>B({type:U([`atomic`,`compound`,`parallel`,`final`,`history`]).default(`atomic`),entry:z(im).optional().describe(`Actions to run when entering this state`),exit:z(im).optional().describe(`Actions to run when leaving this state`),on:H(F(),V([F(),om,z(om)])).optional().describe(`Map of Event Type -> Transition Definition`),always:z(om).optional(),initial:F().optional().describe(`Initial child state (if compound)`),states:H(F(),sm).optional(),meta:B({label:F().optional(),description:F().optional(),color:F().optional(),aiInstructions:F().optional().describe(`Specific instructions for AI when in this state`)}).optional()})),cm=G(()=>B({id:Dp.describe(`Unique Machine ID`),description:F().optional(),contextSchema:H(F(),R()).optional().describe(`Zod Schema for the machine context/memory`),initial:F().describe(`Initial State ID`),states:H(F(),sm).describe(`State Nodes`),on:H(F(),V([F(),om,z(om)])).optional()}));G(()=>B({key:F().describe(`Translation key (e.g., "views.task_list.label")`),defaultValue:F().optional().describe(`Fallback value when translation key is not found`),params:H(F(),V([F(),I(),L()])).optional().describe(`Interpolation parameters (e.g., { count: 5 })`)}));var lm=G(()=>F().describe(`Display label (plain string; i18n keys are auto-generated by the framework)`)),um=G(()=>B({ariaLabel:lm.optional().describe(`Accessible label for screen readers (WAI-ARIA aria-label)`),ariaDescribedBy:F().optional().describe(`ID of element providing additional description (WAI-ARIA aria-describedby)`),role:F().optional().describe(`WAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")`)}).describe(`ARIA accessibility attributes`));G(()=>B({key:F().describe(`Translation key`),zero:F().optional().describe(`Zero form (e.g., "No items")`),one:F().optional().describe(`Singular form (e.g., "{count} item")`),two:F().optional().describe(`Dual form (e.g., "{count} items" for exactly 2)`),few:F().optional().describe(`Few form (e.g., for 2-4 in some languages)`),many:F().optional().describe(`Many form (e.g., for 5+ in some languages)`),other:F().describe(`Default plural form (e.g., "{count} items")`)}).describe(`ICU plural rules for a translation key`));var dm=G(()=>B({style:U([`decimal`,`currency`,`percent`,`unit`]).default(`decimal`).describe(`Number formatting style`),currency:F().optional().describe(`ISO 4217 currency code (e.g., "USD", "EUR")`),unit:F().optional().describe(`Unit for unit formatting (e.g., "kilometer", "liter")`),minimumFractionDigits:I().optional().describe(`Minimum number of fraction digits`),maximumFractionDigits:I().optional().describe(`Maximum number of fraction digits`),useGrouping:L().optional().describe(`Whether to use grouping separators (e.g., 1,000)`)}).describe(`Number formatting rules`)),fm=G(()=>B({dateStyle:U([`full`,`long`,`medium`,`short`]).optional().describe(`Date display style`),timeStyle:U([`full`,`long`,`medium`,`short`]).optional().describe(`Time display style`),timeZone:F().optional().describe(`IANA time zone (e.g., "America/New_York")`),hour12:L().optional().describe(`Use 12-hour format`)}).describe(`Date/time formatting rules`));G(()=>B({code:F().describe(`BCP 47 language code (e.g., "en-US", "zh-CN")`),fallbackChain:z(F()).optional().describe(`Fallback language codes in priority order (e.g., ["zh-TW", "en"])`),direction:U([`ltr`,`rtl`]).default(`ltr`).describe(`Text direction: left-to-right or right-to-left`),numberFormat:dm.optional().describe(`Default number formatting rules`),dateFormat:fm.optional().describe(`Default date/time formatting rules`)}).describe(`Locale configuration`));var pm=U([`api.read`,`api.write`,`crypto.uuid`,`crypto.hash`,`log`]),mm=uf(`language`,[B({language:W(`expression`),source:F().min(1).describe(`Formula expression source`)}).describe(`L1 expression body — pure formula, no IO`),B({language:W(`js`),source:F().min(1).describe(`Function body source`),capabilities:z(pm).default([]).describe(`Granted capability tokens`),timeoutMs:I().int().positive().max(3e4).optional().describe(`Per-invocation timeout (ms)`),memoryMb:I().int().positive().max(256).optional().describe(`Per-invocation memory cap (MB)`)}).describe(`L2 sandboxed JS body — runs inside an isolated VM with declared capabilities`)]).describe(`Hook/Action body — expression (L1) or sandboxed JS (L2)`),hm=G(()=>B({name:F().optional(),field:Dp.optional(),objectOverride:Dp.optional(),label:lm.optional(),type:zp.optional(),required:L().optional().default(!1),options:z(B({label:lm,value:F()})).optional(),placeholder:F().optional(),helpText:F().optional(),defaultValue:R().optional(),defaultFromRow:L().optional()}).refine(e=>!!e.name||!!e.field,{message:`ActionParam requires either "name" or "field"`})),gm=U([`script`,`url`,`modal`,`flow`,`api`,`form`]),_m=new Set(gm.options.filter(e=>e!==`script`)),vm=U([`list_toolbar`,`list_item`,`record_header`,`record_more`,`record_related`,`record_section`,`global_nav`]),ym=G(()=>B({name:Dp.describe(`Machine name (lowercase snake_case)`),label:lm.describe(`Display label`),objectName:F().regex(/^[a-z_][a-z0-9_]*$/).optional().describe(`Target object this action belongs to. When set, the action is auto-merged into the object's actions array by defineStack().`),icon:F().optional().describe(`Icon name`),locations:z(vm).optional().describe(`Locations where this action is visible`),component:U([`action:button`,`action:icon`,`action:menu`,`action:group`]).optional().describe(`Visual component override`),type:gm.default(`script`).describe(`Action functionality type`),target:F().optional().describe("URL, Script Name, Flow ID, or API Endpoint. Supports ${param.X} and ${ctx.X} interpolation."),body:mm.optional().describe("Action body — expression (L1) or sandboxed JS (L2). Only used when type is `script`."),execute:F().optional().describe(`@deprecated — Use target instead. Auto-migrated to target during parsing.`),params:z(hm).optional().describe(`Input parameters required from user`),variant:U([`primary`,`secondary`,`danger`,`ghost`,`link`]).optional().describe(`Button visual variant for styling (primary = highlighted, danger = destructive, ghost = transparent)`),confirmText:lm.optional().describe(`Confirmation message before execution`),successMessage:lm.optional().describe(`Success message to show after execution`),refreshAfter:L().default(!1).describe(`Refresh view after execution`),resultDialog:B({title:lm.optional(),description:lm.optional(),acknowledge:lm.optional().describe(`Acknowledge button label, e.g. "I have saved this"`),format:U([`qrcode`,`code-list`,`secret`,`text`,`json`]).optional().describe(`Default format for fields without their own format. Defaults to json when omitted.`),fields:z(B({path:F().describe(`Dot path into result.data (e.g. "totpURI", "client.client_secret").`),label:lm.optional(),format:U([`qrcode`,`code-list`,`secret`,`text`,`json`]).optional().describe(`Per-field format override.`)})).optional().describe(`Which fields from result.data to render. Omit to dump full JSON.`)}).optional().describe(`Render API response in a one-shot reveal dialog (suppresses successMessage when set).`),visible:jp.optional().describe(`Visibility predicate (CEL).`),disabled:V([L(),jp]).optional().describe(`Boolean or predicate (CEL) — action is disabled when TRUE.`),shortcut:F().optional().describe(`Keyboard shortcut to trigger this action (e.g., "Ctrl+S")`),bulkEnabled:L().optional().describe(`Whether this action can be applied to multiple selected records`),aiExposed:L().optional().describe(`Set to false to keep this action out of the AI tool registry.`),recordIdParam:F().optional().describe(`Body key to inject the row id into when running from a list_item context.`),recordIdField:F().optional().describe(`Row field whose value seeds recordIdParam. Defaults to "id".`),bodyShape:V([W(`flat`),B({wrap:F()})]).optional().describe(`Body wrapping: flat (default) or { wrap: key } to nest user-collected params under a key.`),method:U([`POST`,`PATCH`,`PUT`,`DELETE`]).optional().describe(`HTTP method for type:"api" actions. Defaults to POST.`),bodyExtra:H(F(),R()).optional().describe(`Constant body fields merged into the API request (applied last; overrides user params).`),mode:U([`create`,`edit`,`delete`,`custom`]).optional().describe(`Semantic mode of the action.`),timeout:I().optional().describe(`Maximum execution time in milliseconds for the action`),aria:um.optional().describe(`ARIA accessibility attributes`)}).transform(e=>e.execute&&!e.target?{...e,target:e.execute}:e).refine(e=>!(_m.has(e.type)&&!e.target),{message:`Action 'target' is required when type is 'url', 'flow', 'modal', 'api', or 'form'.`,path:[`target`]})),bm=U([`none`,`no-overlay`,`no-delete`,`full`]),xm=U([`artifact`,`package`,`env-forced`]),Sm=U([`package`,`org`,`env-forced`]),Cm={_lock:bm.optional().describe(`Item-level lock — controls overlay & delete (ADR-0010).`),_lockReason:F().max(500).optional().describe(`Human-readable reason shown when a write is refused by _lock.`),_lockSource:xm.optional().describe(`Layer that set _lock (artifact | package | env-forced).`),_provenance:Sm.optional().describe(`Origin of the item (package | org | env-forced).`),_packageId:F().optional().describe(`Owning package machine id.`),_packageVersion:F().optional().describe(`Owning package version.`),_lockDocsUrl:F().optional().describe(`Optional documentation link surfaced next to _lockReason.`)},wm=B({lock:bm.describe(`Lock policy — none | no-overlay | no-delete | full.`),reason:F().min(1).max(500).describe(`User-visible reason shown when the lock blocks an action.`),docsUrl:F().url().optional().describe(`Optional URL the Studio banner links to for more context.`)}).strict(),Tm=G(()=>B({enabled:L().default(!1).describe(`Enable public sharing`),publicLink:F().optional().describe(`Generated public share URL`),password:F().optional().describe(`Password required to access shared link`),allowedDomains:z(F()).optional().describe(`Restrict access to specific email domains (e.g. ["example.com"])`),expiresAt:F().optional().describe(`Expiration date/time in ISO 8601 format`),allowAnonymous:L().optional().default(!1).describe(`Allow access without authentication`)}));G(()=>B({enabled:L().default(!1).describe(`Enable iframe embedding`),allowedOrigins:z(F()).optional().describe(`Allowed iframe parent origins (e.g. ["https://example.com"])`),width:F().optional().default(`100%`).describe(`Embed width (CSS value)`),height:F().optional().default(`600px`).describe(`Embed height (CSS value)`),showHeader:L().optional().default(!0).describe(`Show interface header in embed`),showNavigation:L().optional().default(!1).describe(`Show navigation in embed`),responsive:L().optional().default(!0).describe(`Enable responsive resizing`)}));var Em=U([`xs`,`sm`,`md`,`lg`,`xl`,`2xl`]),Dm=G(()=>B({xs:I().min(1).max(12).optional(),sm:I().min(1).max(12).optional(),md:I().min(1).max(12).optional(),lg:I().min(1).max(12).optional(),xl:I().min(1).max(12).optional(),"2xl":I().min(1).max(12).optional()}).describe(`Grid columns per breakpoint (1-12)`)),Om=G(()=>B({xs:I().optional(),sm:I().optional(),md:I().optional(),lg:I().optional(),xl:I().optional(),"2xl":I().optional()}).describe(`Display order per breakpoint`)),km=G(()=>B({breakpoint:Em.optional().describe(`Minimum breakpoint for visibility`),hiddenOn:z(Em).optional().describe(`Hide on these breakpoints`),columns:Dm.optional().describe(`Grid columns per breakpoint`),order:Om.optional().describe(`Display order per breakpoint`)}).describe(`Responsive layout configuration`)),Am=G(()=>B({lazyLoad:L().optional().describe(`Enable lazy loading (defer rendering until visible)`),virtualScroll:B({enabled:L().default(!1).describe(`Enable virtual scrolling`),itemHeight:I().optional().describe(`Fixed item height in pixels (for estimation)`),overscan:I().optional().describe(`Number of extra items to render outside viewport`)}).optional().describe(`Virtual scrolling configuration`),cacheStrategy:U([`none`,`cache-first`,`network-first`,`stale-while-revalidate`]).optional().describe(`Client-side data caching strategy`),prefetch:L().optional().describe(`Prefetch data before component is visible`),pageSize:I().optional().describe(`Number of items per page for pagination`),debounceMs:I().optional().describe(`Debounce interval for user interactions in milliseconds`)}).describe(`Performance optimization configuration`)),jm=U([`GET`,`POST`,`PUT`,`DELETE`,`PATCH`,`HEAD`,`OPTIONS`]),Mm=G(()=>U([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`])),Nm=G(()=>B({url:F().describe(`API endpoint URL`),method:Mm.optional().default(`GET`).describe(`HTTP method`),headers:H(F(),F()).optional().describe(`Custom HTTP headers`),params:H(F(),R()).optional().describe(`Query parameters`),body:R().optional().describe(`Request body for POST/PUT/PATCH`)}));G(()=>B({enabled:L().default(!0).describe(`Enable CORS`),origins:V([F(),z(F())]).default(`*`).describe(`Allowed origins (* for all)`),methods:z(jm).optional().describe(`Allowed HTTP methods`),credentials:L().default(!1).describe(`Allow credentials (cookies, authorization headers)`),maxAge:I().int().optional().describe(`Preflight cache duration in seconds`)})),G(()=>B({enabled:L().default(!1).describe(`Enable rate limiting`),windowMs:I().int().default(6e4).describe(`Time window in milliseconds`),maxRequests:I().int().default(100).describe(`Max requests per window`)})),G(()=>B({path:F().describe(`URL path to serve from`),directory:F().describe(`Physical directory to serve`),cacheControl:F().optional().describe(`Cache-Control header value`)}));var Pm=G(()=>uf(`provider`,[B({provider:W(`object`),object:F().describe(`Target object name`)}),B({provider:W(`api`),read:Nm.optional().describe(`Configuration for fetching data`),write:Nm.optional().describe(`Configuration for submitting data (for forms/editable tables)`)}),B({provider:W(`value`),items:z(R()).describe(`Static data array`)}),B({provider:W(`schema`),schemaId:F().describe(`Schema identifier — typically the metadata type name`),schema:H(F(),R()).optional().describe(`Inline JSON Schema (Draft 2020-12). Optional when schemaId is resolvable.`)})])),Fm=G(()=>B({field:F().describe(`Field name to filter on`),operator:F().describe(`Filter operator (e.g. equals, not_equals, contains, this_quarter)`),value:V([F(),I(),L(),Yd(),z(V([F(),I()]))]).optional().describe(`Filter value`)}).describe(`View filter rule`)),Im=G(()=>U([`none`,`count`,`count_empty`,`count_filled`,`count_unique`,`percent_empty`,`percent_filled`,`sum`,`avg`,`min`,`max`]).describe(`Aggregation function for column footer summary`)),Lm=G(()=>B({field:F().describe(`Field name (snake_case)`),label:lm.optional().describe(`Display label override`),width:I().positive().optional().describe(`Column width in pixels`),align:U([`left`,`center`,`right`]).optional().describe(`Text alignment`),hidden:L().optional().describe(`Hide column by default`),sortable:L().optional().describe(`Allow sorting by this column`),resizable:L().optional().describe(`Allow resizing this column`),wrap:L().optional().describe(`Allow text wrapping`),type:F().optional().describe(`Renderer type override (e.g., "currency", "date")`),pinned:U([`left`,`right`]).optional().describe(`Pin/freeze column to left or right side`),summary:Im.optional().describe(`Footer aggregation function for this column`),link:L().optional().describe(`Functions as the primary navigation link (triggers View navigation)`),action:F().optional().describe(`Registered Action ID to execute when clicked`)})),Rm=G(()=>B({type:U([`none`,`single`,`multiple`]).default(`none`).describe(`Selection mode`)})),zm=G(()=>B({pageSize:I().int().positive().default(25).describe(`Number of records per page`),pageSizeOptions:z(I().int().positive()).optional().describe(`Available page size options`)})),Bm=G(()=>U([`compact`,`short`,`medium`,`tall`,`extra_tall`]).describe(`Row height / density setting for list view`)),Vm=G(()=>B({field:F().describe(`Field name to group by`),order:U([`asc`,`desc`]).default(`asc`).describe(`Group sort order`),collapsed:L().default(!1).describe(`Collapse groups by default`)})),Hm=G(()=>B({fields:z(Vm).min(1).describe(`Fields to group by (supports up to 3 levels)`)}).describe(`Record grouping configuration`)),Um=G(()=>B({coverField:F().optional().describe(`Attachment/image field to display as card cover`),coverFit:U([`cover`,`contain`]).default(`cover`).describe(`Image fit mode for card cover`),cardSize:U([`small`,`medium`,`large`]).default(`medium`).describe(`Card size in gallery view`),titleField:F().optional().describe(`Field to display as card title`),visibleFields:z(F()).optional().describe(`Fields to display on card body`)}).describe(`Gallery/card view configuration`)),Wm=G(()=>B({startDateField:F().describe(`Field for timeline item start date`),endDateField:F().optional().describe(`Field for timeline item end date`),titleField:F().describe(`Field to display as timeline item title`),groupByField:F().optional().describe(`Field to group timeline rows`),colorField:F().optional().describe(`Field to determine item color`),scale:U([`hour`,`day`,`week`,`month`,`quarter`,`year`]).default(`week`).describe(`Default timeline scale`)}).describe(`Timeline view configuration`)),Gm=G(()=>B({type:U([`personal`,`collaborative`]).default(`collaborative`).describe(`View ownership type`),lockedBy:F().optional().describe(`User who locked the view configuration`)}).describe(`View sharing and access configuration`)),Km=G(()=>B({field:F().describe(`Field to derive color from (typically a select/status field)`),colors:H(F(),F()).optional().describe(`Map of field value to color (hex/token)`)}).describe(`Row color configuration based on field values`)),qm=G(()=>U([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]).describe(`Visualization type that users can switch to`)),Jm=G(()=>B({sort:L().default(!0).describe(`Allow users to sort records`),search:L().default(!0).describe(`Allow users to search records`),filter:L().default(!0).describe(`Allow users to filter records`),rowHeight:L().default(!0).describe(`Allow users to toggle row height/density`),addRecordForm:L().default(!1).describe(`Add records through a form instead of inline`),buttons:z(F()).optional().describe(`Custom action button IDs to show in the toolbar`)}).describe(`User action toggles for the view toolbar`)),Ym=G(()=>B({showDescription:L().default(!0).describe(`Show the view description text`),allowedVisualizations:z(qm).optional().describe(`Whitelist of visualization types users can switch between (e.g. ["grid", "gallery", "kanban"])`)}).describe(`Appearance and visualization configuration`)),Xm=G(()=>B({name:Dp.describe(`Tab identifier (snake_case)`),label:lm.optional().describe(`Display label`),icon:F().optional().describe(`Tab icon name`),view:F().optional().describe(`Referenced list view name from listViews`),filter:z(Fm).optional().describe(`Tab-specific filter criteria`),order:I().int().min(0).optional().describe(`Tab display order`),pinned:L().default(!1).describe(`Pin tab (cannot be removed by users)`),isDefault:L().default(!1).describe(`Set as the default active tab`),visible:L().default(!0).describe(`Tab visibility`)}).describe(`Tab configuration for multi-tab view interface`)),Zm=G(()=>B({enabled:L().default(!0).describe(`Show the add record entry point`),position:U([`top`,`bottom`,`both`]).default(`bottom`).describe(`Position of the add record button`),mode:U([`inline`,`form`,`modal`]).default(`inline`).describe(`How to add a new record`),formView:F().optional().describe(`Named form view to use when mode is "form" or "modal"`)}).describe(`Add record entry point configuration`)),Qm=G(()=>B({groupByField:F().describe(`Field to group columns by (usually status/select)`),summarizeField:F().optional().describe(`Field to sum at top of column (e.g. amount)`),columns:z(F()).describe(`Fields to show on cards`)})),$m=G(()=>B({chartType:U([`bar`,`line`,`pie`,`area`,`scatter`]).default(`bar`).describe(`Chart visualisation type`),xAxisField:F().describe(`Field used as the X axis / category dimension`),yAxisFields:z(F()).min(1).describe(`Field(s) used as the Y axis / measures`),aggregation:U([`sum`,`avg`,`count`,`min`,`max`]).optional().describe(`Aggregation function applied to Y axis fields`),groupByField:F().optional().describe(`Optional field used to split / stack the chart`)}).describe(`List chart view configuration`)),eh=G(()=>B({startDateField:F(),endDateField:F().optional(),titleField:F(),colorField:F().optional()})),th=G(()=>B({startDateField:F(),endDateField:F(),titleField:F(),progressField:F().optional(),dependenciesField:F().optional()})),nh=G(()=>U([`page`,`drawer`,`modal`,`split`,`popover`,`new_window`,`none`])),rh=G(()=>B({mode:nh.default(`page`),view:F().optional().describe(`Name of the form view to use for details (e.g. "summary_view", "edit_form")`),preventNavigation:L().default(!1).describe(`Disable standard navigation entirely`),openNewTab:L().default(!1).describe(`Force open in new tab (applies to page mode)`),width:V([F(),I()]).optional().describe(`Width of the drawer/modal (e.g. "600px", "50%")`)})),ih=G(()=>B({name:Dp.optional().describe(`Internal view name (lowercase snake_case)`),label:lm.optional(),type:U([`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`,`chart`]).default(`grid`),data:Pm.optional().describe(`Data source configuration (defaults to "object" provider)`),columns:V([z(F()),z(Lm)]).describe(`Fields to display as columns`),filter:z(Fm).optional().describe(`Filter criteria (JSON Rules)`),sort:V([F(),z(B({field:F(),order:U([`asc`,`desc`])}))]).optional(),searchableFields:z(F()).optional().describe(`Fields enabled for search`),filterableFields:z(F()).optional().describe(`Fields enabled for end-user filtering in the top bar`),resizable:L().optional().describe(`Enable column resizing`),striped:L().optional().describe(`Striped row styling`),bordered:L().optional().describe(`Show borders`),compactToolbar:L().optional().describe(`Collapse Group/Color/Density/Hide-fields into a single View settings popover`),selection:Rm.optional().describe(`Row selection configuration`),navigation:rh.optional().describe(`Configuration for item click navigation (page, drawer, modal, etc.)`),pagination:zm.optional().describe(`Pagination configuration`),kanban:Qm.optional(),calendar:eh.optional(),gantt:th.optional(),gallery:Um.optional(),timeline:Wm.optional(),chart:$m.optional(),description:lm.optional().describe(`View description for documentation/tooltips`),sharing:Gm.optional().describe(`View sharing and access configuration`),rowHeight:Bm.optional().describe(`Row height / density setting`),grouping:Hm.optional().describe(`Group records by one or more fields`),rowColor:Km.optional().describe(`Color rows based on field value`),hiddenFields:z(F()).optional().describe(`Fields to hide in this specific view`),fieldOrder:z(F()).optional().describe(`Explicit field display order for this view`),rowActions:z(F()).optional().describe(`Actions available for individual row items`),bulkActions:z(F()).optional().describe(`Actions available when multiple rows are selected`),bulkActionDefs:z(H(F(),Zd())).optional().describe(`Rich bulk action definitions (schema-driven, executed via BulkActionDialog)`),virtualScroll:L().optional().describe(`Enable virtual scrolling for large datasets`),conditionalFormatting:z(B({condition:jp.describe(`Predicate (CEL) to evaluate.`),style:H(F(),F()).describe(`CSS styles to apply when condition is true`)})).optional().describe(`Conditional formatting rules for list rows`),inlineEdit:L().optional().describe(`Allow inline editing of records directly in the list view`),exportOptions:z(U([`csv`,`xlsx`,`pdf`,`json`])).optional().describe(`Available export format options`),userActions:Jm.optional().describe(`User action toggles for the view toolbar`),appearance:Ym.optional().describe(`Appearance and visualization configuration`),tabs:z(Xm).optional().describe(`Tab definitions for multi-tab view interface`),addRecord:Zm.optional().describe(`Add record entry point configuration`),showRecordCount:L().optional().describe(`Show record count at the bottom of the list`),allowPrinting:L().optional().describe(`Allow users to print the view`),emptyState:B({title:lm.optional(),message:lm.optional(),icon:F().optional()}).optional().describe(`Empty state configuration when no records found`),aria:um.optional().describe(`ARIA accessibility attributes for the list view`),responsive:km.optional().describe(`Responsive layout configuration`),performance:Am.optional().describe(`Performance optimization settings`)})),ah=G(()=>B({field:F().describe(`Field name (snake_case)`),type:zp.optional().describe(`Field type (auto-infers widget if omitted)`),options:z(Bp).optional().describe(`Options for select/multiselect/radio/checkboxes fields`),reference:F().optional().describe(`Target object name for lookup/master_detail fields`),maxLength:I().optional().describe(`Maximum character length (for text/textarea/email/url/phone)`),minLength:I().optional().describe(`Minimum character length`),min:I().optional().describe(`Minimum value (for number/currency/percent/slider)`),max:I().optional().describe(`Maximum value`),precision:I().optional().describe(`Total digits (for number/currency)`),scale:I().optional().describe(`Decimal places`),multiple:L().optional().describe(`Allow multiple values (for select/lookup/file/image)`),label:lm.optional().describe(`Display label override`),placeholder:lm.optional().describe(`Placeholder text`),helpText:lm.optional().describe(`Help/hint text`),readonly:L().optional().describe(`Read-only override`),immutable:L().optional().describe(`Editable on create, locked once the record exists (e.g. machine names).`),required:L().optional().describe(`Required override`),hidden:L().optional().describe(`Hidden override`),colSpan:I().int().min(1).max(4).optional().describe(`Column span in grid layout (1-4)`),widget:F().optional().describe(`Custom widget/component name (overrides type-based inference)`),language:F().optional().describe(`Code editor language (for type=code)`),fields:z(zf(()=>ah)).optional().describe(`Sub-fields for composite/repeater/record types`),keyField:B({field:F().default(`name`).describe(`Property name that holds the key inside each item (defaults to "name")`),label:lm.optional().describe(`Display label for the key column`),placeholder:lm.optional().describe(`Placeholder when entering a new key`),helpText:lm.optional().describe(`Help text under the key input`),regex:F().optional().describe(`JS regex source string the key must match (no flags)`),immutable:L().default(!0).describe(`If true, the key is read-only after creation`)}).optional().describe(`Key column config for record-typed fields`),dependsOn:F().optional().describe(`Parent field name for cascading`),visibleOn:jp.optional().describe(`Visibility predicate (CEL).`)})),oh=G(()=>B({name:F().optional().describe(`Stable section identifier for i18n lookup (snake_case)`),label:lm.optional(),description:F().optional().describe(`Optional description rendered under the section header.`),collapsible:L().default(!1),collapsed:L().default(!1),visibleOn:jp.optional().describe(`Visibility predicate (CEL). Hides the whole section when false.`),columns:V([U([`1`,`2`,`3`,`4`]),W(1),W(2),W(3),W(4)]).default(1).transform(e=>typeof e==`string`?parseInt(e):e),fields:z(V([F(),ah]))})),sh=G(()=>B({type:U([`simple`,`tabbed`,`wizard`,`split`,`drawer`,`modal`]).default(`simple`),data:Pm.optional().describe(`Data source configuration (defaults to "object" provider)`),sections:z(oh).optional(),groups:z(oh).optional(),defaultSort:z(B({field:F().describe(`Field name to sort by`),order:U([`asc`,`desc`]).default(`desc`).describe(`Sort direction`)})).optional().describe(`Default sort order for related list views within this form`),sharing:Tm.optional().describe(`Public sharing configuration for this form`),submitBehavior:V([B({kind:W(`thank-you`),title:F().optional(),message:F().optional()}),B({kind:W(`redirect`),url:F(),delayMs:I().int().min(0).optional()}),B({kind:W(`continue`)}),B({kind:W(`next-record`)})]).optional().describe(`Post-submit behavior`),aria:um.optional().describe(`ARIA accessibility attributes for the form view`)}));G(()=>B({list:ih.optional(),form:sh.optional(),listViews:H(F(),ih).optional().describe(`Additional named list views`),formViews:H(F(),sh).optional().describe(`Additional named form views`),protection:wm.optional().describe(`Package author protection block — lock policy for this view.`),...Cm}));function ch(e){let{schemaId:t,...n}=e;return sh.parse({...n,data:{provider:`schema`,schemaId:t}})}var lh=U([`get`,`list`,`create`,`update`,`delete`,`upsert`,`bulk`,`aggregate`,`history`,`search`,`restore`,`purge`,`import`,`export`]),uh=B({trackHistory:L().default(!1).describe(`Enable field history tracking for audit compliance`),searchable:L().default(!0).describe(`Index records for global search`),apiEnabled:L().default(!0).describe(`Expose object via automatic APIs`),apiMethods:z(lh).optional().describe(`Whitelist of allowed API operations`),files:L().default(!1).describe(`Enable file attachments and document management`),feeds:L().default(!1).describe(`Enable social feed, comments, and mentions (Chatter-like)`),activities:L().default(!1).describe(`Enable standard tasks and events tracking`),trash:L().default(!0).describe(`Enable soft-delete with restore capability`),mru:L().default(!0).describe(`Track Most Recently Used (MRU) list for users`),clone:L().default(!0).describe(`Allow record deep cloning`)}),dh=G(()=>B({name:F().optional().describe(`Index name (auto-generated if not provided)`),fields:z(F()).describe(`Fields included in the index`),type:U([`btree`,`hash`,`gin`,`gist`,`fulltext`]).optional().default(`btree`).describe(`Index algorithm type`),unique:L().optional().default(!1).describe(`Whether the index enforces uniqueness`),partial:F().optional().describe(`Partial index condition (SQL WHERE clause for conditional indexes)`)})),fh=G(()=>B({fields:z(F()).describe(`Fields to index for full-text search weighting`),displayFields:z(F()).optional().describe(`Fields to display in search result cards`),filters:z(F()).optional().describe(`Default filters for search results`)})),ph=G(()=>B({enabled:L().describe(`Enable multi-tenancy for this object`),strategy:U([`shared`,`isolated`,`hybrid`]).describe(`Tenant isolation strategy: shared (single DB, row-level), isolated (separate DB per tenant), hybrid (mix)`),tenantField:F().default(`tenant_id`).describe(`Field name for tenant identifier`),crossTenantAccess:L().default(!1).describe(`Allow cross-tenant data access (with explicit permission)`)})),mh=G(()=>B({enabled:L().describe(`Enable soft delete (trash/recycle bin)`),field:F().default(`deleted_at`).describe(`Field name for soft delete timestamp`),cascadeDelete:L().default(!1).describe(`Cascade soft delete to related records`)})),hh=G(()=>B({enabled:L().describe(`Enable record versioning`),strategy:U([`snapshot`,`delta`,`event-sourcing`]).describe(`Versioning strategy: snapshot (full copy), delta (changes only), event-sourcing (event log)`),retentionDays:I().min(1).optional().describe(`Number of days to retain old versions (undefined = infinite)`),versionField:F().default(`version`).describe(`Field name for version number/timestamp`)})),gh=G(()=>B({enabled:L().describe(`Enable table partitioning`),strategy:U([`range`,`hash`,`list`]).describe(`Partitioning strategy: range (date ranges), hash (consistent hashing), list (predefined values)`),key:F().describe(`Field name to partition by`),interval:F().optional().describe(`Partition interval for range strategy (e.g., "1 month", "1 year")`)}).refine(e=>!(e.strategy===`range`&&!e.interval),{message:`interval is required when strategy is "range"`})),_h=G(()=>B({enabled:L().describe(`Enable Change Data Capture`),events:z(U([`insert`,`update`,`delete`])).describe(`Event types to capture`),destination:F().describe(`Destination endpoint (e.g., "kafka://topic", "webhook://url")`)})),vh=G(()=>B({key:F().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field group key must be lowercase snake_case (e.g., "contact_info", "billing", "system")`}).describe(`Group machine key (snake_case). Referenced by Field.group.`),label:F().describe(`Group display label`),icon:F().optional().describe(`Icon name (Lucide/Material) for the group header`),description:F().optional().describe(`Optional description shown under the group header`),defaultExpanded:L().optional().default(!0).describe(`Whether the group is expanded by default`),visibleOn:jp.optional().describe(`Visibility predicate (CEL); group is hidden when FALSE.`)})),yh=B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Machine unique key (snake_case). Immutable.`),label:F().optional().describe(`Human readable singular label (e.g. "Account")`),pluralLabel:F().optional().describe(`Human readable plural label (e.g. "Accounts")`),description:F().optional().describe(`Developer documentation / description`),icon:F().optional().describe(`Icon name (Lucide/Material) for UI representation`),tags:z(F()).optional().describe(`Categorization tags (e.g. "sales", "system", "reference")`),active:L().optional().default(!0).describe(`Is the object active and usable`),isSystem:L().optional().default(!1).describe(`Is system object (protected from deletion)`),abstract:L().optional().default(!1).describe(`Is abstract base object (cannot be instantiated)`),managedBy:U([`platform`,`config`,`system`,`append-only`,`better-auth`]).optional().describe(`Lifecycle bucket — platform (user CRUD) | config (admin authored) | system (engine-managed) | append-only (audit) | better-auth (identity). UI clients honour the resolved affordance matrix.`),userActions:B({create:L().optional().describe(`Show generic "New" button.`),import:L().optional().describe(`Show CSV import wizard entry.`),edit:L().optional().describe(`Allow inline / form edit of existing rows.`),delete:L().optional().describe(`Show row-level delete + bulk delete.`),exportCsv:L().optional().describe(`Show CSV export entry.`)}).optional().describe(`Per-object override of the resolved CRUD affordance matrix.`),systemFields:V([W(!1),B({tenant:L().optional().describe(`Inject organization_id (multi-tenant only). Default true.`),owner:L().optional().describe(`Reserved for future owner_id auto-injection.`),audit:L().optional().describe(`Reserved for future created_by/updated_by auto-injection.`)})]).optional().describe(`Opt out of, or selectively disable, registry-level system-field auto-injection.`),datasource:F().optional().default(`default`).describe(`Target Datasource ID. "default" is the primary DB.`),fields:H(F().regex(/^[a-z_][a-z0-9_]*$/,{message:`Field names must be lowercase snake_case (e.g., "first_name", "company", "annual_revenue")`}),Kp).describe(`Field definitions map. Keys must be snake_case identifiers.`),indexes:z(dh).optional().describe(`Database performance indexes`),fieldGroups:z(vh).refine(e=>new Set(e.map(e=>e.key)).size===e.length,{message:`fieldGroups[].key must be unique within an object`}).optional().describe(`Ordered list of field groups (array order = display order). See ObjectFieldGroupSchema.`),tenancy:ph.optional().describe(`Multi-tenancy configuration for SaaS applications`),softDelete:mh.optional().describe(`Soft delete (trash/recycle bin) configuration`),versioning:hh.optional().describe(`Record versioning and history tracking configuration`),partitioning:gh.optional().describe(`Table partitioning configuration for performance`),cdc:_h.optional().describe(`Change Data Capture (CDC) configuration for real-time data streaming`),validations:z(nm).optional().describe(`Object-level validation rules`),stateMachines:H(F(),cm).optional().describe(`Named state machines for parallel lifecycles (e.g., status, payment, approval)`),displayNameField:F().optional().describe(`Field to use as the record display name (e.g., "name", "title"). Defaults to "name" if present.`),recordName:B({type:U([`text`,`autonumber`]).describe(`Record name type: text (user-entered) or autonumber (system-generated)`),displayFormat:F().optional().describe(`Auto-number format pattern (e.g., "CASE-{0000}", "INV-{YYYY}-{0000}")`),startNumber:I().int().min(0).optional().describe(`Starting number for autonumber (default: 1)`)}).optional().describe(`Record name generation configuration (Salesforce pattern)`),titleFormat:Mp.optional().describe(`Title template — supports {{record.field}} interpolation. Overrides displayNameField.`),compactLayout:z(F()).optional().describe(`Primary fields for hover/cards/lookups`),listViews:H(F(),ih).optional().describe(`Built-in named list views (segmented tabs) shipped with the object schema`),defaultDetailForm:F().optional().describe(`Name of the default FormView for record detail / edit screens`),search:fh.optional().describe(`Search engine configuration`),enable:uh.optional().describe(`Enabled system features modules`),recordTypes:z(F()).optional().describe(`Record type names for this object`),sharingModel:U([`private`,`read`,`read_write`,`full`]).optional().describe(`Default sharing model`),publicSharing:B({enabled:L().default(!1).describe(`Allow records of this object to be published via share link`),allowedAudiences:z(U([`public`,`link_only`,`signed_in`,`email`])).optional().describe(`Audiences callers may select when creating a link`),allowedPermissions:z(U([`view`,`comment`,`edit`])).optional().describe(`Permission levels selectable on the share dialog`),maxExpiryDays:I().int().positive().optional().describe(`Reject links with expiry beyond this many days`),redactFields:z(F()).optional().describe(`Field names removed from records served via a share token`),eligibility:F().optional().describe(`CEL expression that must evaluate to true on the target record`)}).optional().describe(`Public share-link policy (Notion/Figma-style link sharing)`),keyPrefix:F().max(5).optional().describe(`Short prefix for record IDs (e.g., "001" for Account)`),detail:B({renderViaSchema:L().optional().describe(`Opt this object out of the schema-driven detail renderer`),hideReferenceRail:L().optional().describe(`Suppress the right-hand reference-rail on the detail page`),hideRelatedTab:L().optional().describe(`Suppress the Related tab on the detail page`)}).passthrough().optional().describe(`Detail-page UI hints consumed by @object-ui/plugin-detail synth`),actions:z(ym).optional().describe(`Actions associated with this object (auto-populated from top-level actions via objectName)`),protection:wm.optional().describe(`Package author protection block — lock policy for this object.`),...Cm});function bh(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}G(()=>Object.assign(yh,{create:e=>{let t={...e,label:e.label??bh(e.name)};return yh.parse(t)}})),U([`own`,`extend`]),G(()=>B({extend:F().describe(`Target object name (FQN) to extend`),fields:H(F(),Kp).optional().describe(`Fields to add/override`),label:F().optional().describe(`Override label for the extended object`),pluralLabel:F().optional().describe(`Override plural label for the extended object`),description:F().optional().describe(`Override description for the extended object`),validations:z(nm).optional().describe(`Additional validation rules to merge into the target object`),indexes:z(dh).optional().describe(`Additional indexes to merge into the target object`),priority:I().int().min(0).max(999).default(200).describe(`Merge priority (higher = applied later)`)}));var xh=U([`beforeFind`,`afterFind`,`beforeFindOne`,`afterFindOne`,`beforeCount`,`afterCount`,`beforeAggregate`,`afterAggregate`,`beforeInsert`,`afterInsert`,`beforeUpdate`,`afterUpdate`,`beforeDelete`,`afterDelete`,`beforeUpdateMany`,`afterUpdateMany`,`beforeDeleteMany`,`afterDeleteMany`]);G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Hook unique name (snake_case)`),label:F().optional().describe(`Description of what this hook does`),object:V([F(),z(F())]).describe(`Target object(s)`),events:z(xh).describe(`Lifecycle events`),handler:V([F(),Gf(e=>typeof e==`function`,{message:`Expected function`})]).optional().describe("Handler function name (string, post-build) or inline function (pre-build) — DEPRECATED, prefer `body`"),body:mm.optional().describe(`Hook body — expression (L1) or sandboxed JS (L2)`),priority:I().default(100).describe(`Execution priority`),async:L().default(!1).describe(`Run specifically as fire-and-forget`),condition:jp.optional().describe('Predicate (CEL); hook runs only when TRUE. e.g. P`record.status == "closed" && record.amount > 1000`'),description:F().optional().describe(`Human-readable description of what this hook does`),retryPolicy:B({maxRetries:I().default(3).describe(`Maximum retry attempts on failure`),backoffMs:I().default(1e3).describe(`Backoff delay between retries in milliseconds`)}).optional().describe(`Retry policy for failed hook executions`),timeout:I().optional().describe(`Maximum execution time in milliseconds before the hook is aborted`),onError:U([`abort`,`log`]).default(`abort`).describe(`Error handling strategy`)})),G(()=>B({id:F().optional().describe(`Unique execution ID for tracing`),object:F(),event:xh,input:H(F(),R()).describe(`Mutable input parameters`),result:R().optional().describe(`Operation result (After hooks only)`),previous:H(F(),R()).optional().describe(`Record state before operation`),session:B({userId:F().optional(),tenantId:F().optional(),roles:z(F()).optional(),accessToken:F().optional(),isSystem:L().optional().describe(`True when the call was made with an elevated system context (engine self-writes)`)}).optional().describe(`Current session context`),transaction:R().optional().describe(`Database transaction handle`),ql:R().describe(`ObjectQL Engine Reference`),api:R().optional().describe(`Cross-object data access (ScopedContext)`),user:B({id:F().optional(),name:F().optional(),email:F().optional()}).optional().describe(`Current user info shortcut`)}));var Sh=U([`none`,`constant`,`lookup`,`split`,`join`,`javascript`,`map`]),Ch=G(()=>B({source:V([F(),z(F())]).describe(`Source column header(s)`),target:V([F(),z(F())]).describe(`Target object field(s)`),transform:Sh.default(`none`),params:B({value:R().optional(),object:F().optional(),fromField:F().optional(),toField:F().optional(),autoCreate:L().optional(),valueMap:H(F(),R()).optional(),separator:F().optional()}).optional()}));G(()=>B({name:Dp.describe(`Mapping unique name (lowercase snake_case)`),label:F().optional(),sourceFormat:U([`csv`,`json`,`xml`,`sql`]).default(`csv`),targetObject:F().describe(`Target Object Name`),fieldMapping:z(Ch),mode:U([`insert`,`update`,`upsert`]).default(`insert`),upsertKey:z(F()).optional().describe(`Fields to match for upsert (e.g. email)`),extractQuery:_p.optional().describe(`Query to run for export only`),errorPolicy:U([`skip`,`abort`,`retry`]).default(`skip`),batchSize:I().default(1e3)}));var wh=G(()=>B({userId:F().optional(),tenantId:F().optional(),roles:z(F()).default([]),permissions:z(F()).default([]),systemPermissions:z(F()).optional(),tabPermissions:H(F(),U([`visible`,`hidden`,`default_on`,`default_off`])).optional(),org_user_ids:z(F()).optional(),isSystem:L().default(!1),accessToken:F().optional(),transaction:R().optional(),traceId:F().optional()})),Th=G(()=>V([H(F(),R()),Zf]).describe(`Data Engine query filter conditions`)),Eh=G(()=>V([H(F(),U([`asc`,`desc`])),H(F(),V([W(1),W(-1)])),z(rp)]).describe(`Sort order definition`)),Dh=G(()=>B({context:wh.optional()})),Oh=G(()=>Dh.extend({where:V([H(F(),R()),Zf]).optional(),fields:z(mp).optional(),orderBy:z(rp).optional(),limit:I().optional(),offset:I().optional(),top:I().optional(),cursor:H(F(),R()).optional(),search:hp.optional(),expand:zf(()=>H(F(),_p)).optional(),distinct:L().optional()}).describe(`QueryAST-aligned query options for IDataEngine.find() operations`));G(()=>Dh.extend({filter:Th.optional(),select:z(F()).optional(),sort:Eh.optional(),limit:I().int().min(1).optional(),skip:I().int().min(0).optional(),top:I().int().min(1).optional(),populate:z(F()).optional()}).describe(`Query options for IDataEngine.find() operations`));var kh=G(()=>Dh.extend({returning:L().default(!0).optional()}).describe(`Options for DataEngine.insert operations`)),Ah=G(()=>Dh.extend({where:V([H(F(),R()),Zf]).optional(),upsert:L().default(!1).optional(),multi:L().default(!1).optional(),returning:L().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.update operations`));G(()=>Dh.extend({filter:Th.optional(),upsert:L().default(!1).optional(),multi:L().default(!1).optional(),returning:L().default(!1).optional()}).describe(`Options for DataEngine.update operations`));var jh=G(()=>Dh.extend({where:V([H(F(),R()),Zf]).optional(),multi:L().default(!1).optional()}).describe(`QueryAST-aligned options for DataEngine.delete operations`));G(()=>Dh.extend({filter:Th.optional(),multi:L().default(!1).optional()}).describe(`Options for DataEngine.delete operations`));var Mh=G(()=>Dh.extend({where:V([H(F(),R()),Zf]).optional(),groupBy:z(F()).optional(),aggregations:z(sp).optional()}).describe(`QueryAST-aligned options for DataEngine.aggregate operations`));G(()=>Dh.extend({filter:Th.optional(),groupBy:z(F()).optional(),aggregations:z(B({field:F(),method:U([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`]),alias:F().optional()})).optional()}).describe(`Options for DataEngine.aggregate operations`));var Nh=G(()=>Dh.extend({where:V([H(F(),R()),Zf]).optional()}).describe(`QueryAST-aligned options for DataEngine.count operations`));G(()=>Dh.extend({filter:Th.optional()}).describe(`Options for DataEngine.count operations`)),G(()=>B({find:Uf().input(mf([F(),Oh.optional()])).output(Vf(z(R()))),findOne:Uf().input(mf([F(),Oh.optional()])).output(Vf(R())),insert:Uf().input(mf([F(),V([H(F(),R()),z(H(F(),R()))]),kh.optional()])).output(Vf(R())),update:Uf().input(mf([F(),H(F(),R()),Ah.optional()])).output(Vf(R())),delete:Uf().input(mf([F(),jh.optional()])).output(Vf(R())),count:Uf().input(mf([F(),Nh.optional()])).output(Vf(I())),aggregate:Uf().input(mf([F(),Mh])).output(Vf(z(R())))}).describe(`Standard Data Engine Contract`));var Ph={filter:Th.optional()},Fh=Oh.extend({...Ph,select:z(F()).optional(),sort:Eh.optional(),skip:I().int().min(0).optional(),populate:z(F()).optional()}),Ih=G(()=>B({method:W(`find`),object:F(),query:Fh.optional()})),Lh=G(()=>B({method:W(`findOne`),object:F(),query:Fh.optional()})),Rh=G(()=>B({method:W(`insert`),object:F(),data:V([H(F(),R()),z(H(F(),R()))]),options:kh.optional()})),zh=G(()=>B({method:W(`update`),object:F(),data:H(F(),R()),id:V([F(),I()]).optional().describe(`ID for single update, or use where in options`),options:Ah.extend(Ph).optional()})),Bh=G(()=>B({method:W(`delete`),object:F(),id:V([F(),I()]).optional().describe(`ID for single delete, or use where in options`),options:jh.extend(Ph).optional()})),Vh=G(()=>B({method:W(`count`),object:F(),query:Nh.extend(Ph).optional()})),Hh=G(()=>B({method:W(`aggregate`),object:F(),query:Mh.extend(Ph)})),Uh=G(()=>B({method:W(`execute`),command:R(),options:H(F(),R()).optional()})),Wh=G(()=>B({method:W(`vectorFind`),object:F(),vector:z(I()),where:V([H(F(),R()),Zf]).optional(),fields:z(F()).optional(),limit:I().int().default(5).optional(),threshold:I().optional()})),Gh=G(()=>B({method:W(`batch`),requests:z(uf(`method`,[Ih,Lh,Rh,zh,Bh,Vh,Hh,Uh,Wh])),transaction:L().default(!0).optional()}));G(()=>uf(`method`,[Ih,Lh,Rh,zh,Bh,Vh,Hh,Gh,Uh,Wh]).describe(`Virtual ObjectQL Request Protocol`)),U([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`percentile`,`median`,`stddev`,`variance`]).describe(`Standard aggregation functions`);var Kh=U([`asc`,`desc`]).describe(`Sort order direction`);G(()=>B({field:F().describe(`Field name to sort by`),order:Kh.describe(`Sort direction`)}).describe(`Sort field and direction pair`)),U([`insert`,`update`,`delete`,`upsert`]).describe(`Data mutation event types`);var qh=U([`read_uncommitted`,`read_committed`,`repeatable_read`,`serializable`,`snapshot`]).describe(`Transaction isolation levels (snake_case standard)`);U([`lru`,`lfu`,`ttl`,`fifo`]).describe(`Cache eviction strategy`);var Jh=G(()=>B({transaction:R().optional().describe(`Transaction handle`),timeout:I().optional().describe(`Timeout in ms`),skipCache:L().optional().describe(`Bypass cache`),traceContext:H(F(),F()).optional().describe(`OpenTelemetry context or request ID`),tenantId:F().optional().describe(`Tenant Isolation identifier`)})),Yh=G(()=>B({create:L().default(!0).describe(`Supports CREATE operations`),read:L().default(!0).describe(`Supports READ operations`),update:L().default(!0).describe(`Supports UPDATE operations`),delete:L().default(!0).describe(`Supports DELETE operations`),bulkCreate:L().default(!1).describe(`Supports bulk CREATE operations`),bulkUpdate:L().default(!1).describe(`Supports bulk UPDATE operations`),bulkDelete:L().default(!1).describe(`Supports bulk DELETE operations`),transactions:L().default(!1).describe(`Supports ACID transactions`),savepoints:L().default(!1).describe(`Supports transaction savepoints`),isolationLevels:z(qh).optional().describe(`Supported isolation levels`),queryFilters:L().default(!0).describe(`Supports WHERE clause filtering`),queryAggregations:L().default(!1).describe(`Supports GROUP BY and aggregation functions`),queryDateGranularity:H(ap,L()).optional().describe(`Per-granularity native date bucketing (day/week/month/quarter/year). Missing keys fall back to in-memory bucketing.`),querySorting:L().default(!0).describe(`Supports ORDER BY sorting`),queryPagination:L().default(!0).describe(`Supports LIMIT/OFFSET pagination`),queryWindowFunctions:L().default(!1).describe(`Supports window functions with OVER clause`),querySubqueries:L().default(!1).describe(`Supports subqueries`),queryCTE:L().default(!1).describe(`Supports Common Table Expressions (WITH clause)`),joins:L().default(!1).describe(`Supports SQL joins`),fullTextSearch:L().default(!1).describe(`Supports full-text search`),jsonQuery:L().default(!1).describe(`Supports JSON field querying`),geospatialQuery:L().default(!1).describe(`Supports geospatial queries`),streaming:L().default(!1).describe(`Supports result streaming (cursors/iterators)`),jsonFields:L().default(!1).describe(`Supports JSON field types`),arrayFields:L().default(!1).describe(`Supports array field types`),vectorSearch:L().default(!1).describe(`Supports vector embeddings and similarity search`),schemaSync:L().default(!1).describe(`Supports automatic schema synchronization`),batchSchemaSync:L().default(!1).describe(`Supports batched schema sync to reduce schema DDL round-trips`),migrations:L().default(!1).describe(`Supports database migrations`),indexes:L().default(!1).describe(`Supports index creation and management`),connectionPooling:L().default(!1).describe(`Supports connection pooling`),preparedStatements:L().default(!1).describe(`Supports prepared statements (SQL injection prevention)`),queryCache:L().default(!1).describe(`Supports query result caching`)}));G(()=>B({name:F().describe(`Driver unique name`),version:F().describe(`Driver version`),supports:Yh,connect:Uf().input(mf([])).output(Vf(nf())).describe(`Establish connection`),disconnect:Uf().input(mf([])).output(Vf(nf())).describe(`Close connection`),checkHealth:Uf().input(mf([])).output(Vf(L())).describe(`Health check`),getPoolStats:Uf().input(mf([])).output(B({total:I(),idle:I(),active:I(),waiting:I()}).optional()).optional().describe(`Get connection pool statistics`),execute:Uf().input(mf([R(),z(R()).optional(),Jh.optional()])).output(Vf(R())).describe(`Execute raw command`),find:Uf().input(mf([F(),_p,Jh.optional()])).output(Vf(z(H(F(),R())))).describe(`Find records`),findStream:Uf().input(mf([F(),_p,Jh.optional()])).output(R()).describe(`Stream records (AsyncIterable)`),findOne:Uf().input(mf([F(),_p,Jh.optional()])).output(Vf(H(F(),R()).nullable())).describe(`Find one record`),create:Uf().input(mf([F(),H(F(),R()),Jh.optional()])).output(Vf(H(F(),R()))).describe(`Create record`),update:Uf().input(mf([F(),F().or(I()),H(F(),R()),Jh.optional()])).output(Vf(H(F(),R()))).describe(`Update record`),upsert:Uf().input(mf([F(),H(F(),R()),z(F()).optional(),Jh.optional()])).output(Vf(H(F(),R()))).describe(`Upsert record`),delete:Uf().input(mf([F(),F().or(I()),Jh.optional()])).output(Vf(L())).describe(`Delete record`),count:Uf().input(mf([F(),_p.optional(),Jh.optional()])).output(Vf(I())).describe(`Count records`),bulkCreate:Uf().input(mf([F(),z(H(F(),R())),Jh.optional()])).output(Vf(z(H(F(),R())))),bulkUpdate:Uf().input(mf([F(),z(B({id:F().or(I()),data:H(F(),R())})),Jh.optional()])).output(Vf(z(H(F(),R())))),bulkDelete:Uf().input(mf([F(),z(F().or(I())),Jh.optional()])).output(Vf(nf())),updateMany:Uf().input(mf([F(),_p,H(F(),R()),Jh.optional()])).output(Vf(I())).optional(),deleteMany:Uf().input(mf([F(),_p,Jh.optional()])).output(Vf(I())).optional(),beginTransaction:Uf().input(mf([B({isolationLevel:qh.optional()}).optional()])).output(Vf(R())).describe(`Start transaction`),commit:Uf().input(mf([R()])).output(Vf(nf())).describe(`Commit transaction`),rollback:Uf().input(mf([R()])).output(Vf(nf())).describe(`Rollback transaction`),syncSchema:Uf().input(mf([F(),R(),Jh.optional()])).output(Vf(nf())).describe(`Sync object schema to DB`),syncSchemasBatch:Uf().input(mf([z(B({object:F(),schema:R()})),Jh.optional()])).output(Vf(nf())).optional().describe(`Batch sync multiple schemas in one round-trip`),dropTable:Uf().input(mf([F(),Jh.optional()])).output(Vf(nf())),explain:Uf().input(mf([F(),_p,Jh.optional()])).output(Vf(R())).optional()}));var Xh=G(()=>B({min:I().min(0).default(2).describe(`Minimum number of connections in pool`),max:I().min(1).default(10).describe(`Maximum number of connections in pool`),idleTimeoutMillis:I().min(0).default(3e4).describe(`Time in ms before idle connection is closed`),connectionTimeoutMillis:I().min(0).default(5e3).describe(`Time in ms to wait for available connection`)})),Zh=G(()=>B({name:F().describe(`Driver instance name`),type:U([`sql`,`nosql`,`cache`,`search`,`graph`,`timeseries`]).describe(`Driver type category`),capabilities:Yh.describe(`Driver capability flags`),connectionString:F().optional().describe(`Database connection string (driver-specific format)`),poolConfig:Xh.optional().describe(`Connection pool configuration`)})),Qh=G(()=>U([`postgresql`,`mysql`,`sqlite`,`mssql`,`oracle`,`mariadb`])),$h=G(()=>B({text:F().describe(`SQL type for text fields (e.g., VARCHAR, TEXT)`),number:F().describe(`SQL type for number fields (e.g., NUMERIC, DECIMAL, INT)`),boolean:F().describe(`SQL type for boolean fields (e.g., BOOLEAN, BIT)`),date:F().describe(`SQL type for date fields (e.g., DATE)`),datetime:F().describe(`SQL type for datetime fields (e.g., TIMESTAMP, DATETIME)`),json:F().optional().describe(`SQL type for JSON fields (e.g., JSON, JSONB)`),uuid:F().optional().describe(`SQL type for UUID fields (e.g., UUID, CHAR(36))`),binary:F().optional().describe(`SQL type for binary fields (e.g., BLOB, BYTEA)`)})),eg=G(()=>B({rejectUnauthorized:L().default(!0).describe(`Reject connections with invalid certificates`),ca:F().optional().describe(`CA certificate file path or content`),cert:F().optional().describe(`Client certificate file path or content`),key:F().optional().describe(`Client private key file path or content`)}).refine(e=>e.cert!==void 0==(e.key!==void 0),{message:`Client certificate (cert) and private key (key) must be provided together`}));G(()=>Zh.extend({type:W(`sql`).describe(`Driver type must be "sql"`),dialect:Qh.describe(`SQL database dialect`),dataTypeMapping:$h.describe(`SQL data type mapping configuration`),ssl:L().default(!1).describe(`Enable SSL/TLS connection`),sslConfig:eg.optional().describe(`SSL/TLS configuration (required when ssl is true)`)}).refine(e=>!(e.ssl&&!e.sslConfig),{message:`sslConfig is required when ssl is true`}));var tg=G(()=>U([`mongodb`,`couchdb`,`dynamodb`,`cassandra`,`redis`,`elasticsearch`,`neo4j`,`orientdb`]));G(()=>U([`find`,`findOne`,`insert`,`update`,`delete`,`aggregate`,`mapReduce`,`count`,`distinct`,`createIndex`,`dropIndex`]));var ng=G(()=>U([`all`,`quorum`,`one`,`local_quorum`,`each_quorum`,`eventual`])),rg=G(()=>U([`single`,`compound`,`unique`,`text`,`geospatial`,`hashed`,`ttl`,`sparse`])),ig=G(()=>B({enabled:L().default(!1).describe(`Enable sharding`),shardKey:F().optional().describe(`Field to use as shard key`),shardingStrategy:U([`hash`,`range`,`zone`]).optional().describe(`Sharding strategy`),numShards:I().int().positive().optional().describe(`Number of shards`)})),ag=G(()=>B({enabled:L().default(!1).describe(`Enable replication`),replicaSetName:F().optional().describe(`Replica set name`),replicas:I().int().positive().optional().describe(`Number of replicas`),readPreference:U([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference for replica set`),writeConcern:U([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`)})),og=G(()=>B({enabled:L().default(!1).describe(`Enable schema validation`),validationLevel:U([`strict`,`moderate`,`off`]).optional().describe(`Validation strictness`),validationAction:U([`error`,`warn`]).optional().describe(`Action on validation failure`),jsonSchema:H(F(),R()).optional().describe(`JSON Schema for validation`)})),sg=G(()=>B({text:F().describe(`NoSQL type for text fields`),number:F().describe(`NoSQL type for number fields`),boolean:F().describe(`NoSQL type for boolean fields`),date:F().describe(`NoSQL type for date fields`),datetime:F().describe(`NoSQL type for datetime fields`),json:F().optional().describe(`NoSQL type for JSON/object fields`),uuid:F().optional().describe(`NoSQL type for UUID fields`),binary:F().optional().describe(`NoSQL type for binary fields`),array:F().optional().describe(`NoSQL type for array fields`),objectId:F().optional().describe(`NoSQL type for ObjectID fields (MongoDB)`),geopoint:F().optional().describe(`NoSQL type for geospatial point fields`)}));G(()=>Zh.extend({type:W(`nosql`).describe(`Driver type must be "nosql"`),databaseType:tg.describe(`Specific NoSQL database type`),dataTypeMapping:sg.describe(`NoSQL data type mapping configuration`),consistency:ng.optional().describe(`Consistency level for operations`),replication:ag.optional().describe(`Replication configuration`),sharding:ig.optional().describe(`Sharding configuration`),schemaValidation:og.optional().describe(`Document schema validation`),region:F().optional().describe(`AWS region (for managed NoSQL services)`),accessKeyId:F().optional().describe(`AWS access key ID`),secretAccessKey:F().optional().describe(`AWS secret access key`),ttlField:F().optional().describe(`Field name for TTL (auto-deletion)`),maxDocumentSize:I().int().positive().optional().describe(`Maximum document size in bytes`),collectionPrefix:F().optional().describe(`Prefix for collection/table names`)}));var cg=G(()=>B({consistency:ng.optional().describe(`Consistency level override`),readFromSecondary:L().optional().describe(`Allow reading from secondary replicas`),projection:H(F(),V([W(0),W(1)])).optional().describe(`Field projection`),timeout:I().int().positive().optional().describe(`Query timeout (ms)`),useCursor:L().optional().describe(`Use cursor instead of loading all results`),batchSize:I().int().positive().optional().describe(`Cursor batch size`),profile:L().optional().describe(`Enable query profiling`),hint:F().optional().describe(`Index hint for query optimization`)})),lg=G(()=>B({operator:F().describe(`Aggregation operator (e.g., $match, $group, $sort)`),options:H(F(),R()).describe(`Stage-specific options`)}));G(()=>B({collection:F().describe(`Collection/table name`),stages:z(lg).describe(`Aggregation pipeline stages`),options:cg.optional().describe(`Query options`)})),G(()=>B({name:F().describe(`Index name`),type:rg.describe(`Index type`),fields:z(B({field:F().describe(`Field name`),order:U([`asc`,`desc`,`text`,`2dsphere`]).optional().describe(`Index order or type`)})).describe(`Fields to index`),unique:L().default(!1).describe(`Enforce uniqueness`),sparse:L().default(!1).describe(`Sparse index`),expireAfterSeconds:I().int().positive().optional().describe(`TTL in seconds`),partialFilterExpression:H(F(),R()).optional().describe(`Partial index filter`),background:L().default(!1).describe(`Create index in background`)})),G(()=>B({readConcern:U([`local`,`majority`,`linearizable`,`snapshot`]).optional().describe(`Read concern level`),writeConcern:U([`majority`,`acknowledged`,`unacknowledged`]).optional().describe(`Write concern level`),readPreference:U([`primary`,`primaryPreferred`,`secondary`,`secondaryPreferred`,`nearest`]).optional().describe(`Read preference`),maxCommitTimeMS:I().int().positive().optional().describe(`Transaction commit timeout (ms)`)}));var ug=U([`insert`,`update`,`upsert`,`replace`,`ignore`]),dg=G(()=>B({object:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target Object Name`),externalId:F().default(`name`).describe(`Field match for uniqueness check`),mode:ug.default(`upsert`).describe(`Conflict resolution strategy`),env:z(U([`prod`,`dev`,`test`])).default([`prod`,`dev`,`test`]).describe(`Applicable environments`),records:z(H(F(),R())).describe(`Data records`)}));ch({schemaId:`object`,type:`simple`,sections:[{name:`basics`,label:`Basics`,description:`Identity, labels, and taxonomy.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,immutable:!0,colSpan:1,helpText:`snake_case unique identifier (immutable after creation)`},{field:`label`,type:`text`,colSpan:1,helpText:`Singular display name (e.g. "Account")`},{field:`pluralLabel`,type:`text`,colSpan:1,helpText:`Plural display name (e.g. "Accounts")`},{field:`icon`,type:`text`,colSpan:1,helpText:`Lucide icon name (e.g. "building", "users")`},{field:`description`,type:`textarea`,colSpan:2,helpText:`Developer documentation`},{field:`tags`,type:`tags`,colSpan:2,helpText:`Categorization tags (e.g. "sales", "system")`},{field:`active`,type:`boolean`,colSpan:1,helpText:`Is the object active and usable`},{field:`isSystem`,type:`boolean`,colSpan:1,helpText:`System object (protected from deletion)`},{field:`abstract`,type:`boolean`,colSpan:1,helpText:`Abstract base (cannot be instantiated)`}]},{name:`fields`,label:`Fields`,description:`Define the data model — each entry becomes a column in the database table.`,fields:[{field:`fields`,type:`record`,required:!0,helpText:`Add the columns this object will store`,keyField:{field:`name`,label:`Name`,placeholder:`snake_case_identifier`,helpText:`snake_case machine name (used as column name and API key)`,regex:`^[a-z_][a-z0-9_]*$`,immutable:!0},fields:[{field:`label`,type:`text`,helpText:`Display label`},{field:`type`,type:`select`,required:!0,helpText:`Field type`,options:[{label:`Text`,value:`text`},{label:`Textarea`,value:`textarea`},{label:`Email`,value:`email`},{label:`URL`,value:`url`},{label:`Phone`,value:`phone`},{label:`Password`,value:`password`},{label:`Markdown`,value:`markdown`},{label:`HTML`,value:`html`},{label:`Rich Text`,value:`richtext`},{label:`Number`,value:`number`},{label:`Currency`,value:`currency`},{label:`Percent`,value:`percent`},{label:`Date`,value:`date`},{label:`Date & Time`,value:`datetime`},{label:`Time`,value:`time`},{label:`Boolean`,value:`boolean`},{label:`Toggle`,value:`toggle`},{label:`Select`,value:`select`},{label:`Multiselect`,value:`multiselect`},{label:`Radio`,value:`radio`},{label:`Checkboxes`,value:`checkboxes`},{label:`Lookup (reference)`,value:`lookup`},{label:`Master–Detail`,value:`master_detail`},{label:`Tree`,value:`tree`},{label:`Image`,value:`image`},{label:`File`,value:`file`},{label:`Avatar`,value:`avatar`},{label:`Video`,value:`video`},{label:`Audio`,value:`audio`},{label:`Formula (computed)`,value:`formula`},{label:`Summary (rollup)`,value:`summary`},{label:`Autonumber`,value:`autonumber`},{label:`Composite (embedded)`,value:`composite`},{label:`Repeater (embedded array)`,value:`repeater`},{label:`Record (keyed map)`,value:`record`},{label:`Location (GPS)`,value:`location`},{label:`Address`,value:`address`},{label:`Code`,value:`code`},{label:`JSON`,value:`json`},{label:`Color`,value:`color`},{label:`Rating`,value:`rating`},{label:`Slider`,value:`slider`},{label:`Signature`,value:`signature`},{label:`QR / Barcode`,value:`qrcode`},{label:`Progress`,value:`progress`},{label:`Tags`,value:`tags`},{label:`Vector embedding`,value:`vector`}]},{field:`description`,type:`textarea`,helpText:`Developer documentation for this column`},{field:`required`,type:`boolean`,helpText:`Must be set on every record`},{field:`unique`,type:`boolean`,helpText:`Disallow duplicate values`},{field:`indexed`,type:`boolean`,helpText:`Create a database index for faster querying`},{field:`readonly`,type:`boolean`,helpText:`Visible but never user-editable`},{field:`immutable`,type:`boolean`,helpText:`Editable on create, locked thereafter`},{field:`hidden`,type:`boolean`,helpText:`Hidden from default UI`},{field:`searchable`,type:`boolean`,helpText:`Include in full-text search`},{field:`sortable`,type:`boolean`,helpText:`Allow sorting on this column`},{field:`filterable`,type:`boolean`,helpText:`Allow filtering on this column`},{field:`defaultValue`,type:`text`,helpText:`Default value for new records (JSON literal)`},{field:`placeholder`,type:`text`,helpText:`Placeholder hint`},{field:`maxLength`,type:`number`,helpText:`Max characters`,visibleOn:`type in ['text','textarea','email','url','phone','password','markdown','html','richtext']`},{field:`minLength`,type:`number`,helpText:`Min characters`,visibleOn:`type in ['text','textarea','email','url','phone','password','markdown','html','richtext']`},{field:`min`,type:`number`,helpText:`Minimum value`,visibleOn:`type in ['number','currency','percent','rating','slider','progress']`},{field:`max`,type:`number`,helpText:`Maximum value`,visibleOn:`type in ['number','currency','percent','rating','slider','progress']`},{field:`precision`,type:`number`,helpText:`Total digits`,visibleOn:`type in ['number','currency','percent']`},{field:`scale`,type:`number`,helpText:`Decimal places`,visibleOn:`type in ['number','currency','percent']`},{field:`options`,type:`repeater`,helpText:`Available choices`,visibleOn:`type in ['select','multiselect','radio','checkboxes']`,fields:[{field:`label`,type:`text`,required:!0},{field:`value`,type:`text`,required:!0},{field:`color`,type:`color`},{field:`icon`,type:`text`,helpText:`Lucide icon name`},{field:`description`,type:`text`}]},{field:`reference`,type:`text`,helpText:`Target object name`,visibleOn:`type in ['lookup','master_detail','tree']`},{field:`referenceFilter`,type:`code`,language:`expression`,helpText:`CEL filter applied to the picker`,visibleOn:`type in ['lookup','master_detail']`},{field:`cascadeDelete`,type:`boolean`,helpText:`Delete children when parent is deleted`,visibleOn:`type == 'master_detail'`},{field:`multiple`,type:`boolean`,helpText:`Allow selecting multiple records`,visibleOn:`type in ['lookup']`},{field:`formula`,type:`code`,language:`expression`,helpText:`CEL formula expression`,visibleOn:`type == 'formula'`},{field:`returnType`,type:`select`,helpText:`Result type for formulas`,visibleOn:`type == 'formula'`,options:[{label:`Text`,value:`text`},{label:`Number`,value:`number`},{label:`Boolean`,value:`boolean`},{label:`Date`,value:`date`},{label:`Datetime`,value:`datetime`},{label:`Currency`,value:`currency`}]},{field:`summaryType`,type:`select`,helpText:`Aggregation`,visibleOn:`type == 'summary'`,options:[{label:`Count`,value:`count`},{label:`Sum`,value:`sum`},{label:`Avg`,value:`avg`},{label:`Min`,value:`min`},{label:`Max`,value:`max`}]},{field:`summaryField`,type:`text`,helpText:`Field on child object to aggregate`,visibleOn:`type == 'summary'`},{field:`displayFormat`,type:`text`,helpText:`e.g. "INV-{0000}"`,visibleOn:`type == 'autonumber'`},{field:`startingNumber`,type:`number`,helpText:`Starting sequence value`,visibleOn:`type == 'autonumber'`},{field:`language`,type:`text`,helpText:`Editor language (e.g. sql, javascript)`,visibleOn:`type == 'code'`},{field:`validation`,type:`code`,language:`expression`,helpText:`CEL predicate — must evaluate true`},{field:`errorMessage`,type:`text`,helpText:`Shown when validation fails`},{field:`audit`,type:`boolean`,helpText:`Audit changes to this field`},{field:`trackHistory`,type:`boolean`,helpText:`Keep change history`},{field:`pii`,type:`boolean`,helpText:`Personally identifiable information`},{field:`encrypted`,type:`boolean`,helpText:`Encrypt at rest`}]}]},{name:`capabilities`,label:`Capabilities`,description:`System features and API exposure.`,collapsible:!0,collapsed:!0,fields:[{field:`capabilities`,type:`composite`,helpText:`Enable/disable system features`,fields:[{field:`trackHistory`,type:`boolean`},{field:`searchable`,type:`boolean`},{field:`apiEnabled`,type:`boolean`},{field:`files`,type:`boolean`},{field:`feeds`,type:`boolean`},{field:`activities`,type:`boolean`},{field:`trash`,type:`boolean`},{field:`mru`,type:`boolean`},{field:`clone`,type:`boolean`}]}]},{name:`advanced`,label:`Advanced`,description:`State machines, actions, and storage.`,collapsible:!0,collapsed:!0,fields:[{field:`datasource`,type:`text`,helpText:`Target datasource ID (default: "default")`}]}]}),ch({schemaId:`field`,type:`simple`,sections:[{name:`basics`,label:`Basics`,description:`Core field identity and constraints.`,columns:2,fields:[{field:`name`,required:!0,immutable:!0,colSpan:1,helpText:`Unique identifier (snake_case, immutable after creation)`},{field:`label`,required:!0,colSpan:1,helpText:`Display name for users`},{field:`type`,required:!0,colSpan:1,helpText:`Data type of this field`},{field:`group`,colSpan:1,helpText:`Group name for form layout`},{field:`description`,widget:`textarea`,colSpan:2,helpText:`Help text shown to users`},{field:`required`,colSpan:1,helpText:`User must provide a value`},{field:`unique`,colSpan:1,helpText:`No two records can have the same value`},{field:`multiple`,colSpan:1,helpText:`Allow multiple values (for select/lookup)`}]},{name:`configuration`,label:`Configuration`,description:`Field-type specific settings (visible blocks depend on the chosen type).`,fields:[{field:`defaultValue`,helpText:`Default value for new records`},{field:`minLength`,visibleOn:`data.type == 'text' || data.type == 'textarea' || data.type == 'email'`,helpText:`Minimum character length`},{field:`maxLength`,visibleOn:`data.type == 'text' || data.type == 'textarea' || data.type == 'email'`,helpText:`Maximum character length`},{field:`min`,visibleOn:`data.type == 'number' || data.type == 'currency'`,helpText:`Minimum value`},{field:`max`,visibleOn:`data.type == 'number' || data.type == 'currency'`,helpText:`Maximum value`},{field:`precision`,visibleOn:`data.type == 'currency' || data.type == 'number'`,helpText:`Decimal places (e.g., 2 for $10.50)`},{field:`scale`,visibleOn:`data.type == 'number'`,helpText:`Number of decimal digits`},{field:`options`,type:`repeater`,visibleOn:`data.type == 'select' || data.type == 'multiselect'`,helpText:`Available options (label/value pairs)`},{field:`reference`,widget:`ref:object`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`Referenced object name`},{field:`referenceFilters`,widget:`string-tags`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`Filter expressions (e.g., "active = true")`},{field:`deleteBehavior`,visibleOn:`data.type == 'lookup' || data.type == 'master_detail'`,helpText:`What happens when referenced record is deleted`}]},{name:`formula`,label:`Formula & Computed`,description:`Calculated values and roll-up summaries.`,collapsible:!0,collapsed:!0,fields:[{field:`expression`,widget:`textarea`,helpText:`CEL expression to calculate this field (makes it read-only)`},{field:`summaryOperations`,type:`composite`,helpText:`Roll-up summary configuration (for parent-child relationships)`},{field:`cached`,type:`composite`,helpText:`Caching configuration for computed fields`}]},{name:`advanced`,label:`Advanced`,description:`Database, UI, audit, and security settings.`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`columnName`,colSpan:2,helpText:`Physical column name in database (defaults to field name)`},{field:`index`,colSpan:1,helpText:`Create database index for faster queries`},{field:`externalId`,colSpan:1,helpText:`Mark as external ID for upsert operations`},{field:`readonly`,colSpan:1,helpText:`Field is read-only in forms`},{field:`hidden`,colSpan:1,helpText:`Hide field from default UI views`},{field:`searchable`,colSpan:1,helpText:`Include in global search results`},{field:`sortable`,colSpan:1,helpText:`Allow sorting lists by this field`},{field:`auditTrail`,colSpan:1,helpText:`Track detailed changes with user and timestamp`},{field:`trackFeedHistory`,colSpan:1,helpText:`Show changes in activity feed`},{field:`encryptionConfig`,type:`composite`,colSpan:2,helpText:`Field-level encryption (GDPR/HIPAA/PCI-DSS)`},{field:`maskingRule`,type:`composite`,colSpan:2,helpText:`Data masking rules for PII protection`}]}]}),ch({schemaId:`hook`,type:`simple`,sections:[{label:`Identity`,description:`What this hook is and when it fires.`,columns:2,fields:[{field:`name`,type:`text`,required:!0,immutable:!0,colSpan:1,helpText:`snake_case identifier (immutable after creation)`},{field:`label`,type:`text`,colSpan:1},{field:`description`,type:`textarea`,colSpan:2},{field:`object`,type:`text`,required:!0,colSpan:1,helpText:`Target object name (or "*" for global)`},{field:`events`,type:`tags`,required:!0,colSpan:1,helpText:`Lifecycle events (e.g. beforeInsert, afterUpdate)`},{field:`priority`,type:`number`,colSpan:1,helpText:`Lower numbers run first`}]},{label:`Body`,description:`Inline expression or sandboxed JavaScript executed when the hook fires.`,fields:[{field:`body`,type:`composite`,helpText:`Either an L1 expression or an L2 sandboxed JS body`,fields:[{field:`language`,type:`select`,required:!0,helpText:`expression = pure formula; js = sandboxed JavaScript`,options:[{label:`Expression (L1)`,value:`expression`},{label:`JavaScript (L2 sandboxed)`,value:`js`}]},{field:`source`,type:`code`,language:`javascript`,required:!0,helpText:`Function body source — no top-level imports`},{field:`capabilities`,type:`tags`,helpText:`Allowed ctx APIs (api.read, api.write, crypto.uuid, log, …)`},{field:`timeoutMs`,type:`number`,helpText:`Per-invocation timeout (ms)`}]}]},{label:`Legacy handler`,description:`Function name reference — deprecated in favour of body.`,collapsible:!0,collapsed:!0,fields:[{field:`handler`,type:`text`,helpText:"Handler function name (deprecated — prefer `body`)"}]},{label:`Execution`,collapsible:!0,collapsed:!0,columns:2,fields:[{field:`async`,type:`boolean`,colSpan:1,helpText:`Run in background, do not block the transaction`},{field:`onError`,type:`select`,colSpan:1,options:[{label:`Abort`,value:`abort`},{label:`Log`,value:`log`}]},{field:`condition`,type:`code`,language:`javascript`,colSpan:2,helpText:`Optional formula — skip the hook when this evaluates to false`}]}]});var fg=G(()=>B({field:F().describe(`Source field name containing the reference value`),targetObject:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Target object name (snake_case)`),targetField:F().default(`name`).describe(`Field on target object used for matching`),fieldType:U([`lookup`,`master_detail`]).describe(`Relationship field type`)}).describe(`Describes how a field reference is resolved during seed loading`)),pg=G(()=>B({object:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Object name (snake_case)`),dependsOn:z(F()).describe(`Objects this object depends on`),references:z(fg).describe(`Field-level reference details`)}).describe(`Object node in the seed data dependency graph`)),mg=G(()=>B({nodes:z(pg).describe(`All objects in the dependency graph`),insertOrder:z(F()).describe(`Topologically sorted insert order`),circularDependencies:z(z(F())).default([]).describe(`Circular dependency chains (e.g., [["a", "b", "a"]])`)}).describe(`Complete object dependency graph for seed data loading`)),hg=G(()=>B({sourceObject:F().describe(`Object with the broken reference`),field:F().describe(`Field name with unresolved reference`),targetObject:F().describe(`Target object searched for the reference`),targetField:F().describe(`ExternalId field used for matching`),attemptedValue:R().describe(`Value that failed to resolve`),recordIndex:I().int().min(0).describe(`Index of the record in the dataset`),message:F().describe(`Human-readable error description`)}).describe(`Actionable error for a failed reference resolution`)),gg=G(()=>B({dryRun:L().default(!1).describe(`Validate references without writing data`),haltOnError:L().default(!1).describe(`Stop on first reference resolution error`),multiPass:L().default(!0).describe(`Enable multi-pass loading for circular dependencies`),defaultMode:ug.default(`upsert`).describe(`Default conflict resolution strategy`),batchSize:I().int().min(1).default(1e3).describe(`Maximum records per batch insert/upsert`),transaction:L().default(!1).describe(`Wrap entire load in a transaction (all-or-nothing)`),env:U([`prod`,`dev`,`test`]).optional().describe(`Only load datasets matching this environment`),organizationId:F().min(1).optional().describe(`Target organization id for per-tenant seed replay`)}).describe(`Seed data loader configuration`)),_g=G(()=>B({object:F().describe(`Object that was loaded`),mode:ug.describe(`Import mode used`),inserted:I().int().min(0).describe(`Records inserted`),updated:I().int().min(0).describe(`Records updated`),skipped:I().int().min(0).describe(`Records skipped`),errored:I().int().min(0).describe(`Records with errors`),total:I().int().min(0).describe(`Total records in dataset`),referencesResolved:I().int().min(0).describe(`References resolved via externalId`),referencesDeferred:I().int().min(0).describe(`References deferred to second pass`),errors:z(hg).default([]).describe(`Reference resolution errors`)}).describe(`Result of loading a single dataset`));G(()=>B({success:L().describe(`Overall success status`),dryRun:L().describe(`Whether this was a dry-run`),dependencyGraph:mg.describe(`Object dependency graph`),results:z(_g).describe(`Per-object load results`),errors:z(hg).describe(`All reference resolution errors`),summary:B({objectsProcessed:I().int().min(0).describe(`Total objects processed`),totalRecords:I().int().min(0).describe(`Total records across all objects`),totalInserted:I().int().min(0).describe(`Total records inserted`),totalUpdated:I().int().min(0).describe(`Total records updated`),totalSkipped:I().int().min(0).describe(`Total records skipped`),totalErrored:I().int().min(0).describe(`Total records with errors`),totalReferencesResolved:I().int().min(0).describe(`Total references resolved`),totalReferencesDeferred:I().int().min(0).describe(`Total references deferred`),circularDependencyCount:I().int().min(0).describe(`Circular dependency chains detected`),durationMs:I().min(0).describe(`Load duration in milliseconds`)}).describe(`Summary statistics`)}).describe(`Complete seed loader result`)),G(()=>B({datasets:z(dg).min(1).describe(`Datasets to load`),config:gg.default(()=>gg.parse({})).describe(`Loader configuration`)}).describe(`Seed loader request with datasets and configuration`));var vg=G(()=>B({versionNumber:I().describe(`Version number`),createdAt:I().describe(`Creation timestamp`),createdBy:F().describe(`Creator user ID`),size:I().describe(`File size in bytes`),checksum:F().describe(`File checksum`),downloadUrl:F().url().describe(`Download URL`),isLatest:L().optional().default(!1).describe(`Is latest version`)})),yg=G(()=>B({id:F().describe(`Template ID`),name:F().describe(`Template name`),description:F().optional().describe(`Template description`),fileUrl:F().url().describe(`Template file URL`),fileType:F().describe(`File MIME type`),placeholders:z(B({key:F().describe(`Placeholder key`),label:F().describe(`Placeholder label`),type:U([`text`,`number`,`date`,`image`]).describe(`Placeholder type`),required:L().optional().default(!1).describe(`Is required`)})).describe(`Template placeholders`)})),bg=G(()=>B({provider:U([`docusign`,`adobe-sign`,`hellosign`,`custom`]).describe(`E-signature provider`),enabled:L().optional().default(!1).describe(`E-signature enabled`),signers:z(B({email:F().email().describe(`Signer email`),name:F().describe(`Signer name`),role:F().describe(`Signer role`),order:I().describe(`Signing order`)})).describe(`Document signers`),expirationDays:I().optional().default(30).describe(`Expiration days`),reminderDays:I().optional().default(7).describe(`Reminder interval days`)}));G(()=>B({id:F().describe(`Document ID`),name:F().describe(`Document name`),description:F().optional().describe(`Document description`),fileType:F().describe(`File MIME type`),fileSize:I().describe(`File size in bytes`),category:F().optional().describe(`Document category`),tags:z(F()).optional().describe(`Document tags`),versioning:B({enabled:L().describe(`Versioning enabled`),versions:z(vg).describe(`Version history`),majorVersion:I().describe(`Major version`),minorVersion:I().describe(`Minor version`)}).optional().describe(`Version control`),template:yg.optional().describe(`Document template`),eSignature:bg.optional().describe(`E-signature config`),access:B({isPublic:L().optional().default(!1).describe(`Public access`),sharedWith:z(F()).optional().describe(`Shared with`),expiresAt:I().optional().describe(`Access expiration`)}).optional().describe(`Access control`),metadata:H(F(),R()).optional().describe(`Custom metadata`)}));var xg=G(()=>uf(`type`,[B({type:W(`constant`),value:R().describe(`Constant value to use`)}).describe(`Set a constant value`),B({type:W(`cast`),targetType:U([`string`,`number`,`boolean`,`date`]).describe(`Target data type`)}).describe(`Cast to a specific data type`),B({type:W(`lookup`),table:F().describe(`Lookup table name`),keyField:F().describe(`Field to match on`),valueField:F().describe(`Field to retrieve`)}).describe(`Lookup value from another table`),B({type:W(`javascript`),expression:jp.describe(`JS expression (dialect="js" recommended). e.g. value.toUpperCase()`)}).describe(`Custom JavaScript transformation`),B({type:W(`map`),mappings:H(F(),R()).describe(`Value mappings (e.g., {"Active": "active"})`)}).describe(`Map values using a dictionary`)])),Sg=G(()=>B({source:F().describe(`Source field name`),target:F().describe(`Target field name`),transform:xg.optional().describe(`Transformation to apply`),defaultValue:R().optional().describe(`Default if source is null/undefined`)})),Cg=G(()=>B({id:F().describe(`Data source ID`),name:F().describe(`Data source name`),type:U([`odata`,`rest-api`,`graphql`,`custom`]).describe(`Protocol type`),endpoint:F().url().describe(`API endpoint URL`),authentication:B({type:U([`oauth2`,`api-key`,`basic`,`none`]).describe(`Auth type`),config:H(F(),R()).describe(`Auth configuration`)}).describe(`Authentication`)})),wg=G(()=>Sg.extend({type:F().optional().describe(`Field type`),readonly:L().optional().default(!0).describe(`Read-only field`)}));G(()=>B({fieldName:F().describe(`Field name`),dataSource:Cg.describe(`External data source`),query:B({endpoint:F().describe(`Query endpoint path`),method:U([`GET`,`POST`]).optional().default(`GET`).describe(`HTTP method`),parameters:H(F(),R()).optional().describe(`Query parameters`)}).describe(`Query configuration`),fieldMappings:z(wg).describe(`Field mappings`),caching:B({enabled:L().optional().default(!0).describe(`Cache enabled`),ttl:I().optional().default(300).describe(`Cache TTL (seconds)`),strategy:U([`lru`,`lfu`,`ttl`]).optional().default(`ttl`).describe(`Cache strategy`)}).optional().describe(`Caching configuration`),fallback:B({enabled:L().optional().default(!0).describe(`Fallback enabled`),defaultValue:R().optional().describe(`Default fallback value`),showError:L().optional().default(!0).describe(`Show error to user`)}).optional().describe(`Fallback configuration`),rateLimit:B({requestsPerSecond:I().describe(`Requests per second limit`),burstSize:I().optional().describe(`Burst size`)}).optional().describe(`Rate limiting`),retry:B({maxRetries:I().min(0).default(3).describe(`Maximum retry attempts`),initialDelayMs:I().default(1e3).describe(`Initial retry delay in milliseconds`),maxDelayMs:I().default(3e4).describe(`Maximum retry delay in milliseconds`),backoffMultiplier:I().default(2).describe(`Exponential backoff multiplier`),retryableStatusCodes:z(I()).default([429,500,502,503,504]).describe(`HTTP status codes that are retryable`)}).optional().describe(`Retry configuration with exponential backoff`),transform:B({request:B({headers:H(F(),F()).optional().describe(`Additional request headers`),queryParams:H(F(),F()).optional().describe(`Additional query parameters`)}).optional().describe(`Request transformation`),response:B({dataPath:F().optional().describe(`JSONPath to extract data (e.g., "$.data.results")`),totalPath:F().optional().describe(`JSONPath to extract total count (e.g., "$.meta.total")`)}).optional().describe(`Response transformation`)}).optional().describe(`Request/response transformation pipeline`),pagination:B({type:U([`offset`,`cursor`,`page`]).default(`offset`).describe(`Pagination type`),pageSize:I().default(100).describe(`Items per page`),maxPages:I().optional().describe(`Maximum number of pages to fetch`)}).optional().describe(`Pagination configuration for external data`)}));var Tg=F().describe(`Underlying driver identifier`);G(()=>B({id:F().describe(`Unique driver identifier (e.g. "postgres")`),label:F().describe(`Display label (e.g. "PostgreSQL")`),description:F().optional(),icon:F().optional(),configSchema:H(F(),R()).describe(`JSON Schema for connection configuration`),capabilities:zf(()=>Eg).optional()}));var Eg=B({transactions:L().default(!1),queryFilters:L().default(!1),queryAggregations:L().default(!1),querySorting:L().default(!1),queryPagination:L().default(!1),queryWindowFunctions:L().default(!1),querySubqueries:L().default(!1),joins:L().default(!1),fullTextSearch:L().default(!1),readOnly:L().default(!1),dynamicSchema:L().default(!1)});G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique datasource identifier`),label:F().optional().describe(`Display label`),driver:Tg.describe(`Underlying driver type`),config:H(F(),R()).describe(`Driver specific configuration`),pool:B({min:I().default(0).describe(`Minimum connections`),max:I().default(10).describe(`Maximum connections`),idleTimeoutMillis:I().default(3e4).describe(`Idle timeout`),connectionTimeoutMillis:I().default(3e3).describe(`Connection establishment timeout`)}).optional().describe(`Connection pool settings`),readReplicas:z(H(F(),R())).optional().describe(`Read-only replica configurations`),capabilities:Eg.optional().describe(`Capability overrides`),healthCheck:B({enabled:L().default(!0).describe(`Enable health check endpoint`),intervalMs:I().default(3e4).describe(`Health check interval in milliseconds`),timeoutMs:I().default(5e3).describe(`Health check timeout in milliseconds`)}).optional().describe(`Datasource health check configuration`),ssl:B({enabled:L().default(!1).describe(`Enable SSL/TLS for database connection`),rejectUnauthorized:L().default(!0).describe(`Reject connections with invalid/self-signed certificates`),ca:F().optional().describe(`CA certificate (PEM format or path to file)`),cert:F().optional().describe(`Client certificate (PEM format or path to file)`),key:F().optional().describe(`Client private key (PEM format or path to file)`)}).optional().describe(`SSL/TLS configuration for secure database connections`),retryPolicy:B({maxRetries:I().default(3).describe(`Maximum number of retry attempts`),baseDelayMs:I().default(1e3).describe(`Base delay between retries in milliseconds`),maxDelayMs:I().default(3e4).describe(`Maximum delay between retries in milliseconds`),backoffMultiplier:I().default(2).describe(`Exponential backoff multiplier`)}).optional().describe(`Connection retry policy for transient failures`),description:F().optional().describe(`Internal description`),active:L().default(!0).describe(`Is datasource enabled`)}));var Dg=U([`count`,`sum`,`avg`,`min`,`max`,`count_distinct`,`number`,`string`,`boolean`]),Og=U([`string`,`number`,`boolean`,`time`,`geo`]),kg=U([`second`,`minute`,`hour`,`day`,`week`,`month`,`quarter`,`year`]),Ag=G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique metric ID`),label:F().describe(`Human readable label`),description:F().optional(),type:Dg,sql:F().describe(`SQL expression or field reference`),filters:z(B({sql:F()})).optional(),format:F().optional()})),jg=G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Unique dimension ID`),label:F().describe(`Human readable label`),description:F().optional(),type:Og,sql:F().describe(`SQL expression or column reference`),granularities:z(kg).optional()})),Mg=G(()=>B({name:F().describe(`Target cube name`),relationship:U([`one_to_one`,`one_to_many`,`many_to_one`]).default(`many_to_one`),sql:F().describe(`Join condition (ON clause)`)}));G(()=>B({name:F().regex(/^[a-z_][a-z0-9_]*$/).describe(`Cube name (snake_case)`),title:F().optional(),description:F().optional(),sql:F().describe(`Base SQL statement or Table Name`),measures:H(F(),Ag).describe(`Quantitative metrics`),dimensions:H(F(),jg).describe(`Qualitative attributes`),joins:H(F(),Mg).optional(),refreshKey:B({every:F().optional(),sql:F().optional()}).optional(),public:L().default(!1)})),G(()=>B({cube:F().optional().describe(`Target cube name (optional when provided externally, e.g. in API request wrapper)`),measures:z(F()).describe(`List of metrics to calculate`),dimensions:z(F()).optional().describe(`List of dimensions to group by`),where:Zf.optional().describe(`Filtering criteria (canonical Query DSL FilterCondition)`),timeDimensions:z(B({dimension:F(),granularity:kg.optional(),dateRange:V([F(),z(F())]).optional()})).optional(),order:H(F(),U([`asc`,`desc`])).optional(),limit:I().optional(),offset:I().optional(),timezone:F().optional().default(`UTC`)}));var Ng=U([`comment`,`field_change`,`task`,`event`,`email`,`call`,`note`,`file`,`record_create`,`record_delete`,`approval`,`sharing`,`system`]),Pg=G(()=>B({type:U([`user`,`team`,`record`]).describe(`Mention target type`),id:F().describe(`Target ID`),name:F().describe(`Display name for rendering`),offset:I().int().min(0).describe(`Character offset in body text`),length:I().int().min(1).describe(`Length of mention token in body text`)})),Fg=G(()=>B({field:F().describe(`Field machine name`),fieldLabel:F().optional().describe(`Field display label`),oldValue:R().optional().describe(`Previous value`),newValue:R().optional().describe(`New value`),oldDisplayValue:F().optional().describe(`Human-readable old value`),newDisplayValue:F().optional().describe(`Human-readable new value`)})),Ig=G(()=>B({emoji:F().describe(`Emoji character or shortcode (e.g., "👍", ":thumbsup:")`),userIds:z(F()).describe(`Users who reacted`),count:I().int().min(1).describe(`Total reaction count`)})),Lg=G(()=>B({type:U([`user`,`system`,`service`,`automation`]).describe(`Actor type`),id:F().describe(`Actor ID`),name:F().optional().describe(`Actor display name`),avatarUrl:F().url().optional().describe(`Actor avatar URL`),source:F().optional().describe(`Source application (e.g., "Omni", "API", "Studio")`)})),Rg=U([`public`,`internal`,`private`]);G(()=>B({id:F().describe(`Feed item ID`),type:Ng.describe(`Activity type`),object:F().describe(`Object name (e.g., "account")`),recordId:F().describe(`Record ID this feed item belongs to`),actor:Lg.describe(`Who performed this action`),body:F().optional().describe(`Rich text body (Markdown supported)`),mentions:z(Pg).optional().describe(`Mentioned users/teams/records`),changes:z(Fg).optional().describe(`Field-level changes`),reactions:z(Ig).optional().describe(`Emoji reactions on this item`),parentId:F().optional().describe(`Parent feed item ID for threaded replies`),replyCount:I().int().min(0).default(0).describe(`Number of replies`),pinned:L().default(!1).describe(`Whether the feed item is pinned to the top of the timeline`),pinnedAt:F().datetime().optional().describe(`Timestamp when the item was pinned`),pinnedBy:F().optional().describe(`User ID who pinned the item`),starred:L().default(!1).describe(`Whether the feed item is starred/bookmarked by the current user`),starredAt:F().datetime().optional().describe(`Timestamp when the item was starred`),visibility:Rg.default(`public`).describe(`Visibility: public (all users), internal (team only), private (author + mentioned)`),createdAt:F().datetime().describe(`Creation timestamp`),updatedAt:F().datetime().optional().describe(`Last update timestamp`),editedAt:F().datetime().optional().describe(`When comment was last edited`),isEdited:L().default(!1).describe(`Whether comment has been edited`)})),U([`all`,`comments_only`,`changes_only`,`tasks_only`]);var zg=U([`comment`,`mention`,`field_change`,`task`,`approval`,`all`]),Bg=U([`in_app`,`email`,`push`,`slack`]);G(()=>B({object:F().describe(`Object name`),recordId:F().describe(`Record ID`),userId:F().describe(`Subscribing user ID`),events:z(zg).default([`all`]).describe(`Event types to receive notifications for`),channels:z(Bg).default([`in_app`]).describe(`Notification delivery channels`),active:L().default(!0).describe(`Whether the subscription is active`),createdAt:F().datetime().describe(`Subscription creation timestamp`)}));var Vg=(e=>l===void 0?typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(l===void 0?e:l)[t]}):e:l)(function(e){if(l!==void 0)return l.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),Hg={debug:0,info:1,warn:2,error:3,fatal:4,silent:5},Ug={debug:`\x1B[36m`,info:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`,fatal:`\x1B[35m`,silent:``},Wg=`\x1B[0m`,Gg=class e{constructor(e={},t={}){this.config={name:e.name,level:e.level??`info`,format:e.format??`pretty`,redact:e.redact??[`password`,`token`,`secret`,`key`],sourceLocation:e.sourceLocation??!1,file:e.file,rotation:e.rotation??{maxSize:`10m`,maxFiles:5}},this.bindings=t,this.config.file&&typeof process<`u`&&this.openFileStream(this.config.file)}openFileStream(e){try{let t=Vg(`fs`),n=Vg(`path`).dirname(e);t.mkdirSync(n,{recursive:!0}),this.fileStream=t.createWriteStream(e,{flags:`a`})}catch{}}isEnabled(e){return Hg[e]>=Hg[this.config.level]}redactSensitive(e){if(!e||typeof e!=`object`)return e;let t=Array.isArray(e)?[...e]:{...e};for(let e in t){let n=e.toLowerCase();this.config.redact.some(e=>n.includes(e.toLowerCase()))?t[e]=`***REDACTED***`:typeof t[e]==`object`&&t[e]!==null&&(t[e]=this.redactSensitive(t[e]))}return t}write(e,t,n,r){if(!this.isEnabled(e))return;let i=this.redactSensitive({...this.bindings,...n,...r?{error:{message:r.message,stack:r.stack}}:{}}),a=Object.keys(i).length>0,o=new Date().toISOString(),s;if(this.config.format===`json`)s=JSON.stringify({time:o,level:e,...this.config.name?{name:this.config.name}:{},msg:t,...i});else if(this.config.format===`text`){let n=[o,e.toUpperCase(),t];a&&n.push(JSON.stringify(i)),s=n.join(` | `)}else{let n=Ug[e]||``,r=this.config.name?`[${this.config.name}] `:``;s=`${n}${o} ${e.toUpperCase()}${Wg} ${r}${t}`,a&&(s+=` ${JSON.stringify(i)}`)}let c=s+`
|
|
103
|
+
`;typeof process<`u`&&process.stderr?e===`error`||e===`fatal`?process.stderr.write(c):process.stdout?.write(c):typeof console<`u`&&(e===`error`||e===`fatal`?console.error:e===`warn`?console.warn:e===`debug`?console.debug:console.log)(s),this.fileStream&&this.fileStream.write(c)}debug(e,t){this.write(`debug`,e,t)}info(e,t){this.write(`info`,e,t)}warn(e,t){this.write(`warn`,e,t)}error(e,t,n){t instanceof Error?this.write(`error`,e,n,t):this.write(`error`,e,t)}fatal(e,t,n){t instanceof Error?this.write(`fatal`,e,n,t):this.write(`fatal`,e,t)}log(e,...t){this.info(e,t.length>0?{args:t}:void 0)}child(t){let n=new e(this.config,{...this.bindings,...t});return n.fileStream=this.fileStream,n}withTrace(e,t){return this.child({traceId:e,spanId:t})}async destroy(){this.fileStream&&=(await new Promise(e=>this.fileStream.end(e)),void 0)}};function Kg(e){return new Gg(e)}var qg=class{constructor(e,t){this.subscriptions=new Map,this.eventBuffer=[],this._baseUrl=e,this._token=t}subscribeMetadata(e,t,n){let r=`metadata-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,packageId:n?.packageId,eventTypes:[`metadata.${e}.created`,`metadata.${e}.updated`,`metadata.${e}.deleted`]},handler:e=>{e.type.startsWith(`metadata.`)&&t(e)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}subscribeData(e,t,n){let r=`data-${e}-${Date.now()}`;return this.subscriptions.set(r,{filter:{type:e,recordId:n?.recordId,eventTypes:[`data.record.created`,`data.record.updated`,`data.record.deleted`]},handler:r=>{r.type.startsWith(`data.`)&&r.object===e&&(!n?.recordId||r.payload?.recordId===n.recordId)&&t(r)}}),this.startPolling(),()=>{this.subscriptions.delete(r),this.subscriptions.size===0&&this.stopPolling()}}emitEvent(e){for(let t of this.subscriptions.values()){let n=!t.filter.type||e.type.includes(t.filter.type)||e.object===t.filter.type,r=!t.filter.eventTypes?.length||t.filter.eventTypes.includes(e.type),i=!t.filter.packageId||e.payload?.packageId===t.filter.packageId;if(n&&r&&i)try{t.handler(e)}catch(e){console.error(`Error in realtime event handler:`,e)}}}startPolling(){this.pollInterval||=setInterval(()=>{for(;this.eventBuffer.length>0;){let e=this.eventBuffer.shift();e&&this.emitEvent(e)}},2e3)}stopPolling(){this.pollInterval&&=(clearInterval(this.pollInterval),void 0)}_bufferEvent(e){this.eventBuffer.push(e)}disconnect(){this.stopPolling(),this.subscriptions.clear(),this.eventBuffer=[]}},Jg=class{constructor(e){this.meta={getTypes:async()=>{let e=this.getRoute(`metadata`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},getItems:async(e,t)=>{let n=this.getRoute(`metadata`),r=new URLSearchParams;t?.packageId&&r.set(`package`,t.packageId);let i=r.toString(),a=`${this.baseUrl}${n}/${e}${i?`?${i}`:``}`,o=await this.fetch(a);return this.unwrapResponse(o)},getItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.packageId&&i.set(`package`,n.packageId);let a=i.toString(),o=`${this.baseUrl}${r}/${e}/${t}${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},saveItem:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`PUT`,body:JSON.stringify(n)});return this.unwrapResponse(i)},deleteItem:async(e,t)=>{let n=this.getRoute(`metadata`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)},getHistory:async(e,t,n)=>{let r=this.getRoute(`metadata`),i=new URLSearchParams;n?.sinceSeq!==void 0&&i.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&i.set(`limit`,String(n.limit));let a=i.toString(),o=`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${a?`?${a}`:``}`,s=await this.fetch(o);return this.unwrapResponse(s)},getCached:async(e,t)=>{let n=this.getRoute(`metadata`),r={};t?.ifNoneMatch&&(r[`If-None-Match`]=t.ifNoneMatch),t?.ifModifiedSince&&(r[`If-Modified-Since`]=t.ifModifiedSince);let i=await this.fetch(`${this.baseUrl}${n}/object/${e}`,{headers:r});if(i.status===304)return{notModified:!0,etag:t?.ifNoneMatch?{value:t.ifNoneMatch.replace(/^W\/|"/g,``),weak:t.ifNoneMatch.startsWith(`W/`)}:void 0};let a=await i.json(),o=i.headers.get(`ETag`),s=i.headers.get(`Last-Modified`);return{data:a,etag:o?{value:o.replace(/^W\/|"/g,``),weak:o.startsWith(`W/`)}:void 0,lastModified:s||void 0,notModified:!1}},getView:async(e,t=`list`)=>{let n=this.getRoute(`ui`),r=await this.fetch(`${this.baseUrl}${n}/view/${e}?type=${t}`);return this.unwrapResponse(r)}},this.analytics={query:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/query`,{method:`POST`,body:JSON.stringify(e)})).json()},meta:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/meta/${e}`)).json()},explain:async e=>{let t=this.getRoute(`analytics`);return(await this.fetch(`${this.baseUrl}${t}/explain`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.packages={list:async e=>{let t=this.getRoute(`packages`),n=new URLSearchParams;e?.status&&n.set(`status`,e.status),e?.type&&n.set(`type`,e.type),e?.enabled!==void 0&&n.set(`enabled`,String(e.enabled));let r=n.toString(),i=`${this.baseUrl}${t}${r?`?`+r:``}`,a=await this.fetch(i);return this.unwrapResponse(a)},get:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},install:async(e,t)=>{let n=this.getRoute(`packages`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({manifest:e,settings:t?.settings,enableOnInstall:t?.enableOnInstall})});return this.unwrapResponse(r)},uninstall:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},enable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async e=>{let t=this.getRoute(`packages`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)}},this.projects={list:async e=>{let t=new URLSearchParams;e?.organization_id&&t.set(`organizationId`,e.organization_id),e?.env_type&&t.set(`envType`,e.env_type),e?.status&&t.set(`status`,e.status);let n=t.toString(),r=`${this.baseUrl}/api/v1/cloud/environments${n?`?`+n:``}`,i=await this.fetch(r);return this.unwrapResponse(i)},get:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`);return this.unwrapResponse(t)},create:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(t)},update:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)});return this.unwrapResponse(n)},delete:async(e,t)=>{let n=t?.force?`?force=1`:``,r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}${n}`,{method:`DELETE`});return this.unwrapResponse(r)},activate:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/activate`,{method:`POST`});return this.unwrapResponse(t)},rotateCredential:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/credentials/rotate`,{method:`POST`,body:JSON.stringify({plaintext:t})});return this.unwrapResponse(n)},updateHostname:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/hostname`,{method:`POST`,body:JSON.stringify({hostname:t})});return this.unwrapResponse(n)},updateVisibility:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({visibility:t})});return this.unwrapResponse(n)},listRevisions:async(e,t)=>{let n=new URLSearchParams;t?.limit&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor),t?.branch&&n.set(`branch`,t.branch);let r=n.toString(),i=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions${r?`?${r}`:``}`);return this.unwrapResponse(i)},listBranches:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches`);return this.unwrapResponse(t)},renameBranch:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({newName:n})});return this.unwrapResponse(r)},deleteBranch:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/branches/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},activateRevision:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/revisions/${encodeURIComponent(t)}/activate`,{method:`POST`});return this.unwrapResponse(n)},retryProvisioning:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/retry`,{method:`POST`});return this.unwrapResponse(t)},listMembers:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`);return this.unwrapResponse(t)},addMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return this.unwrapResponse(n)},updateMemberRole:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({role:n})});return this.unwrapResponse(r)},removeMember:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},listDrivers:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/drivers`);return this.unwrapResponse(e)},listTemplates:async()=>{let e=await this.fetch(`${this.baseUrl}/api/v1/cloud/templates`);return this.unwrapResponse(e)},packages:{list:async e=>{let t=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`);return this.unwrapResponse(t)},install:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(n)},get:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`);return this.unwrapResponse(n)},enable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/enable`,{method:`PATCH`});return this.unwrapResponse(n)},disable:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/disable`,{method:`PATCH`});return this.unwrapResponse(n)},uninstall:async(e,t)=>{let n=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(n)},upgrade:async(e,t,n)=>{let r=await this.fetch(`${this.baseUrl}/api/v1/cloud/environments/${encodeURIComponent(e)}/packages/${encodeURIComponent(t)}/upgrade`,{method:`POST`,body:JSON.stringify({targetVersion:n})});return this.unwrapResponse(r)}}},this.organizations={list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list`)).json();return{organizations:Array.isArray(t)?t:t?.data??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update`,{method:`POST`,body:JSON.stringify({organizationId:e,data:t})})).json()},setActive:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/set-active`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-full-organization?organizationId=${encodeURIComponent(e)}`)).json()},listMembers:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/list-members?organizationId=${encodeURIComponent(e)}`)).json()},invite:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/invite-member`,{method:`POST`,body:JSON.stringify(e)})).json()},leave:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/leave`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/delete`,{method:`POST`,body:JSON.stringify({organizationId:e})})).json()},removeMember:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/remove-member`,{method:`POST`,body:JSON.stringify({memberIdOrEmail:t.memberIdOrEmail,organizationId:e})})).json()},updateMemberRole:async(e,t)=>{let n=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${n}/organization/update-member-role`,{method:`POST`,body:JSON.stringify({memberId:t.memberId,role:t.role,organizationId:e})})).json()},getActiveMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/get-active-member?organizationId=${encodeURIComponent(e)}`)).json()},invitations:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-invitations?organizationId=${encodeURIComponent(e)}`)).json();return{invitations:Array.isArray(n)?n:n?.data??n?.invitations??[]}},listMine:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/organization/list-user-invitations`)).json();return{invitations:Array.isArray(t)?t:t?.data??t?.invitations??[]}},cancel:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/cancel-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},accept:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/accept-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},reject:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/reject-invitation`,{method:`POST`,body:JSON.stringify({invitationId:e})})).json()},resend:async e=>{if(e.id)try{await this.organizations.invitations.cancel(e.id)}catch{}return this.organizations.invite({email:e.email,role:e.role??`member`,organizationId:e.organizationId})}},teams:{list:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-teams?organizationId=${encodeURIComponent(e)}`)).json();return{teams:Array.isArray(n)?n:n?.data??n?.teams??[]}},create:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/create-team`,{method:`POST`,body:JSON.stringify(e)})).json()},update:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/update-team`,{method:`POST`,body:JSON.stringify(e)})).json()},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team`,{method:`POST`,body:JSON.stringify(e)})).json()},listMembers:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/organization/list-team-members?teamId=${encodeURIComponent(e)}`)).json();return{members:Array.isArray(n)?n:n?.data??n?.members??[]}},addMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/add-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()},removeMember:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/organization/remove-team-member`,{method:`POST`,body:JSON.stringify(e)})).json()}}},this.oauth={applications:{register:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/create-client`,{method:`POST`,body:JSON.stringify(e)})).json()},get:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/get-client?client_id=${encodeURIComponent(e)}`)).json()},getPublic:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/public-client?client_id=${encodeURIComponent(e)}`)).json()},list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/oauth2/get-clients`)).json();return{applications:Array.isArray(t)?t:t?.clients??t?.data??[]}},delete:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/delete-client`,{method:`POST`,body:JSON.stringify({client_id:e})})).json()}},consent:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/oauth2/consent`,{method:`POST`,body:JSON.stringify(e)})).json()}},this.auth={getConfig:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/config`);return this.unwrapResponse(t)},login:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/sign-in/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)}),r=await n.json().catch(()=>({}));if(!n.ok){let e=r?.message||r?.error?.message||`Login failed (HTTP ${n.status})`,t=Error(e);throw r?.code&&(t.code=r.code),t.status=n.status,t}let i=r&&(r.data??(r.token||r.user?{token:r.token,user:r.user}:void 0)),a=i?{...r,data:i}:r;return a.data?.token&&(this.token=a.data.token),a},logout:async()=>{let e=this.getRoute(`auth`);await this.fetch(`${this.baseUrl}${e}/sign-out`,{method:`POST`,headers:{"Content-Type":`application/json`,Origin:this.baseUrl},body:`{}`}),this.token=void 0},me:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/get-session`,{headers:{Origin:this.baseUrl}})).json()},register:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/sign-up/email`,{method:`POST`,headers:{Origin:this.baseUrl},body:JSON.stringify(e)})).json(),r=n&&(n.data??(n.token||n.user?{token:n.token,user:n.user}:void 0)),i=r?{...n,data:r}:n;return i.data?.token&&(this.token=i.data.token),i},signInWithProvider:async(e,t)=>{if(typeof window>`u`)throw Error(`signInWithProvider requires a browser environment`);let n=this.getRoute(`auth`),r=t?.callbackURL??window.location.origin+`/login`,i=t?.type===`oidc`,a=i?`/sign-in/oauth2`:`/sign-in/social`,o=i?{providerId:e,callbackURL:r}:{provider:e,callbackURL:r};t?.errorCallbackURL&&(o.errorCallbackURL=t.errorCallbackURL);let s=await(await this.fetch(`${this.baseUrl}${n}${a}`,{method:`POST`,body:JSON.stringify(o)})).json(),c=s?.url??s?.data?.url;if(c)window.location.assign(c);else throw Error(`signInWithProvider: no redirect URL returned for provider "${e}"`)},refreshToken:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/get-session`,{method:`GET`})).json();return n.data?.token&&(this.token=n.data.token),n},bootstrapStatus:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/bootstrap-status`)).json();return{hasOwner:!!(t?.data??t)?.hasOwner}},updateUser:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/update-user`,{method:`POST`,body:JSON.stringify(e)})).json()},changePassword:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-password`,{method:`POST`,body:JSON.stringify(e)})).json()},changeEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/change-email`,{method:`POST`,body:JSON.stringify(e)})).json()},sendVerificationEmail:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/send-verification-email`,{method:`POST`,body:JSON.stringify(e)})).json()},verifyEmail:async e=>{let t=this.getRoute(`auth`),n=new URL(`${this.baseUrl}${t}/verify-email`);return n.searchParams.set(`token`,e.token),e.callbackURL&&n.searchParams.set(`callbackURL`,e.callbackURL),(await this.fetch(n.toString())).json()},deleteUser:async e=>{let t=this.getRoute(`auth`),n=await this.fetch(`${this.baseUrl}${t}/delete-user`,{method:`POST`,body:JSON.stringify(e)});return this.token=void 0,n.json()},sessions:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-sessions`)).json();return{sessions:Array.isArray(t)?t:t?.data??t?.sessions??[]}},revoke:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/revoke-session`,{method:`POST`,body:JSON.stringify({token:e})})).json()},revokeOthers:async()=>{let e=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${e}/revoke-other-sessions`,{method:`POST`,body:`{}`})).json()},revokeAll:async()=>{let e=this.getRoute(`auth`),t=await this.fetch(`${this.baseUrl}${e}/revoke-sessions`,{method:`POST`,body:`{}`});return this.token=void 0,t.json()}},twoFactor:{enable:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/enable`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyTotp:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-totp`,{method:`POST`,body:JSON.stringify(e)})).json()},disable:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/disable`,{method:`POST`,body:JSON.stringify(e)})).json()},generateBackupCodes:async e=>{let t=this.getRoute(`auth`),n=await(await this.fetch(`${this.baseUrl}${t}/two-factor/generate-backup-codes`,{method:`POST`,body:JSON.stringify(e)})).json();return n?.data??n},verifyBackupCode:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/two-factor/verify-backup-code`,{method:`POST`,body:JSON.stringify(e)})).json()}},accounts:{list:async()=>{let e=this.getRoute(`auth`),t=await(await this.fetch(`${this.baseUrl}${e}/list-accounts`)).json();return{accounts:Array.isArray(t)?t:t?.data??t?.accounts??[]}},unlink:async e=>{let t=this.getRoute(`auth`);return(await this.fetch(`${this.baseUrl}${t}/unlink-account`,{method:`POST`,body:JSON.stringify(e)})).json()},linkSocial:async e=>{let t=this.getRoute(`auth`),n=e.callbackURL??(typeof window<`u`?window.location.href:void 0),r=await(await this.fetch(`${this.baseUrl}${t}/link-social`,{method:`POST`,body:JSON.stringify({provider:e.provider,callbackURL:n})})).json();return r?.data??r}}},this.storage={upload:async(e,t=`user`)=>{let n={filename:e.name,mimeType:e.type,size:e.size,scope:t},r=this.getRoute(`storage`),{data:i}=await(await this.fetch(`${this.baseUrl}${r}/upload/presigned`,{method:`POST`,body:JSON.stringify(n)})).json(),a=await this.fetchImpl(i.uploadUrl,{method:i.method,headers:i.headers,body:e});if(!a.ok)throw Error(`Storage Upload Failed: ${a.statusText}`);let o={fileId:i.fileId};return(await this.fetch(`${this.baseUrl}${r}/upload/complete`,{method:`POST`,body:JSON.stringify(o)})).json()},getDownloadUrl:async e=>{let t=this.getRoute(`storage`);return(await(await this.fetch(`${this.baseUrl}${t}/files/${e}/url`)).json()).url},getPresignedUrl:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/presigned`,{method:`POST`,body:JSON.stringify(e)})).json()},initChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked`,{method:`POST`,body:JSON.stringify(e)})).json()},uploadPart:async(e,t,n,r)=>{let i=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/chunk/${t}`,{method:`PUT`,headers:{"x-resume-token":n},body:r})).json()},completeChunkedUpload:async e=>{let t=this.getRoute(`storage`);return(await this.fetch(`${this.baseUrl}${t}/upload/chunked/${e.uploadId}/complete`,{method:`POST`,body:JSON.stringify(e)})).json()},resumeUpload:async(e,t,n,r)=>{let i=this.getRoute(`storage`),{totalChunks:a,uploadedChunks:o}=(await(await this.fetch(`${this.baseUrl}${i}/upload/chunked/${e}/progress`)).json()).data,s=[],c=t instanceof ArrayBuffer?t:await t.arrayBuffer();for(let t=o;t<a;t++){let i=t*n,a=Math.min(i+n,c.byteLength),o=new Blob([c.slice(i,a)]),l=await this.storage.uploadPart(e,t,r,o);s.push({chunkIndex:t,eTag:l.data.eTag})}return this.storage.completeChunkedUpload({uploadId:e,parts:s})}},this.automation={trigger:async(e,t)=>{let n=this.getRoute(`automation`);return(await this.fetch(`${this.baseUrl}${n}/trigger/${e}`,{method:`POST`,body:JSON.stringify(t)})).json()},list:async()=>{let e=this.getRoute(`automation`),t=await this.fetch(`${this.baseUrl}${e}`);return this.unwrapResponse(t)},get:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`);return this.unwrapResponse(n)},create:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}`,{method:`POST`,body:JSON.stringify({name:e,...t})});return this.unwrapResponse(r)},update:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`PUT`,body:JSON.stringify({definition:t})});return this.unwrapResponse(r)},delete:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${e}`,{method:`DELETE`});return this.unwrapResponse(n)},toggle:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/toggle`,{method:`POST`,body:JSON.stringify({enabled:t})});return this.unwrapResponse(r)},runs:{list:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${e}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${e}/runs/${t}`);return this.unwrapResponse(r)}},getFlow:async e=>{let t=this.getRoute(`automation`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},execute:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/trigger`,{method:`POST`,body:JSON.stringify(t??{})});return this.unwrapResponse(r)},listRuns:async(e,t)=>{let n=this.getRoute(`automation`),r=new URLSearchParams;t?.limit!=null&&r.set(`limit`,String(t.limit)),t?.cursor&&r.set(`cursor`,t.cursor);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs${i?`?${i}`:``}`);return this.unwrapResponse(a)},getRun:async(e,t)=>{let n=this.getRoute(`automation`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.permissions={check:async e=>{let t=this.getRoute(`permissions`),n=new URLSearchParams({object:e.object,action:e.action});e.recordId!==void 0&&n.set(`recordId`,e.recordId),e.field!==void 0&&n.set(`field`,e.field);let r=await this.fetch(`${this.baseUrl}${t}/check?${n.toString()}`);return this.unwrapResponse(r)},getObjectPermissions:async e=>{let t=this.getRoute(`permissions`),n=await this.fetch(`${this.baseUrl}${t}/objects/${encodeURIComponent(e)}`);return this.unwrapResponse(n)},getEffectivePermissions:async()=>{let e=this.getRoute(`permissions`),t=await this.fetch(`${this.baseUrl}${e}/effective`);return this.unwrapResponse(t)}},this.realtime={connect:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/connect`,{method:`POST`,body:JSON.stringify(e||{})});return this.unwrapResponse(n)},disconnect:async()=>{let e=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${e}/disconnect`,{method:`POST`})},subscribe:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/subscribe`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unsubscribe:async e=>{let t=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${t}/unsubscribe`,{method:`POST`,body:JSON.stringify({subscriptionId:e})})},setPresence:async(e,t)=>{let n=this.getRoute(`realtime`);await this.fetch(`${this.baseUrl}${n}/presence`,{method:`PUT`,body:JSON.stringify({channel:e,state:t})})},getPresence:async e=>{let t=this.getRoute(`realtime`),n=await this.fetch(`${this.baseUrl}${t}/presence/${encodeURIComponent(e)}`);return this.unwrapResponse(n)}},this.workflow={getConfig:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e)}/config`);return this.unwrapResponse(n)},getState:async(e,t)=>{let n=this.getRoute(`workflow`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/state`);return this.unwrapResponse(r)},transition:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/transition`,{method:`POST`,body:JSON.stringify({transition:e.transition,comment:e.comment,data:e.data})});return this.unwrapResponse(n)},approve:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/approve`,{method:`POST`,body:JSON.stringify({comment:e.comment,data:e.data})});return this.unwrapResponse(n)},reject:async e=>{let t=this.getRoute(`workflow`),n=await this.fetch(`${this.baseUrl}${t}/${encodeURIComponent(e.object)}/${encodeURIComponent(e.recordId)}/reject`,{method:`POST`,body:JSON.stringify({reason:e.reason,comment:e.comment})});return this.unwrapResponse(n)}},this.views={list:async(e,t)=>{let n=this.getRoute(`views`),r=new URLSearchParams;t&&r.set(`type`,t);let i=r.toString(),a=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}${i?`?${i}`:``}`);return this.unwrapResponse(a)},get:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({object:e,data:t})});return this.unwrapResponse(r)},update:async(e,t,n)=>{let r=this.getRoute(`views`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`PUT`,body:JSON.stringify({object:e,viewId:t,data:n})});return this.unwrapResponse(i)},delete:async(e,t)=>{let n=this.getRoute(`views`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`});return this.unwrapResponse(r)}},this.notifications={registerDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},unregisterDevice:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/devices/${encodeURIComponent(e)}`,{method:`DELETE`});return this.unwrapResponse(n)},getPreferences:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/preferences`);return this.unwrapResponse(t)},updatePreferences:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/preferences`,{method:`PUT`,body:JSON.stringify({preferences:e})});return this.unwrapResponse(n)},list:async e=>{let t=this.getRoute(`notifications`),n=new URLSearchParams;e?.read!==void 0&&n.set(`read`,String(e.read)),e?.type&&n.set(`type`,e.type),e?.limit&&n.set(`limit`,String(e.limit)),e?.cursor&&n.set(`cursor`,e.cursor);let r=n.toString(),i=await this.fetch(`${this.baseUrl}${t}${r?`?${r}`:``}`);return this.unwrapResponse(i)},markRead:async e=>{let t=this.getRoute(`notifications`),n=await this.fetch(`${this.baseUrl}${t}/read`,{method:`POST`,body:JSON.stringify({ids:e})});return this.unwrapResponse(n)},markAllRead:async()=>{let e=this.getRoute(`notifications`),t=await this.fetch(`${this.baseUrl}${e}/read/all`,{method:`POST`});return this.unwrapResponse(t)}},this.ai={nlq:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/nlq`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},suggest:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/suggest`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)},insights:async e=>{let t=this.getRoute(`ai`),n=await this.fetch(`${this.baseUrl}${t}/insights`,{method:`POST`,body:JSON.stringify(e)});return this.unwrapResponse(n)}},this.i18n={getLocales:async()=>{let e=this.getRoute(`i18n`),t=await this.fetch(`${this.baseUrl}${e}/locales`);return this.unwrapResponse(t)},getTranslations:async(e,t)=>{let n=this.getRoute(`i18n`),r=new URLSearchParams;r.set(`locale`,e),t?.namespace&&r.set(`namespace`,t.namespace),t?.keys&&r.set(`keys`,t.keys.join(`,`));let i=await this.fetch(`${this.baseUrl}${n}/translations?${r.toString()}`);return this.unwrapResponse(i)},getFieldLabels:async(e,t)=>{let n=this.getRoute(`i18n`),r=await this.fetch(`${this.baseUrl}${n}/labels/${encodeURIComponent(e)}?locale=${encodeURIComponent(t)}`);return this.unwrapResponse(r)}},this.feed={list:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.type&&i.set(`type`,n.type),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed${a?`?${a}`:``}`);return this.unwrapResponse(o)},create:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed`,{method:`POST`,body:JSON.stringify(n)});return this.unwrapResponse(i)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`PUT`,body:JSON.stringify(r)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}`,{method:`DELETE`});return this.unwrapResponse(i)},addReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions`,{method:`POST`,body:JSON.stringify({emoji:r})});return this.unwrapResponse(a)},removeReaction:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/reactions/${encodeURIComponent(r)}`,{method:`DELETE`});return this.unwrapResponse(a)},pin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`POST`});return this.unwrapResponse(i)},unpin:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/pin`,{method:`DELETE`});return this.unwrapResponse(i)},star:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`POST`});return this.unwrapResponse(i)},unstar:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/${encodeURIComponent(n)}/star`,{method:`DELETE`});return this.unwrapResponse(i)},search:async(e,t,n,r)=>{let i=this.getRoute(`data`),a=new URLSearchParams;a.set(`query`,n),r?.type&&a.set(`type`,r.type),r?.actorId&&a.set(`actorId`,r.actorId),r?.dateFrom&&a.set(`dateFrom`,r.dateFrom),r?.dateTo&&a.set(`dateTo`,r.dateTo),r?.limit&&a.set(`limit`,String(r.limit)),r?.cursor&&a.set(`cursor`,r.cursor);let o=await this.fetch(`${this.baseUrl}${i}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/feed/search?${a.toString()}`);return this.unwrapResponse(o)},getChangelog:async(e,t,n)=>{let r=this.getRoute(`data`),i=new URLSearchParams;n?.field&&i.set(`field`,n.field),n?.actorId&&i.set(`actorId`,n.actorId),n?.dateFrom&&i.set(`dateFrom`,n.dateFrom),n?.dateTo&&i.set(`dateTo`,n.dateTo),n?.limit&&i.set(`limit`,String(n.limit)),n?.cursor&&i.set(`cursor`,n.cursor);let a=i.toString(),o=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/changelog${a?`?${a}`:``}`);return this.unwrapResponse(o)},subscribe:async(e,t,n)=>{let r=this.getRoute(`data`),i=await this.fetch(`${this.baseUrl}${r}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`POST`,body:JSON.stringify(n||{})});return this.unwrapResponse(i)},unsubscribe:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${encodeURIComponent(e)}/${encodeURIComponent(t)}/subscribe`,{method:`DELETE`});return this.unwrapResponse(r)}},this.data={query:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/query`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},find:async(e,t={})=>{let n=this.getRoute(`data`),r=new URLSearchParams,i=t,a={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(i.where&&(a.filter=i.where),i.fields&&(a.select=i.fields),i.orderBy&&(a.sort=i.orderBy),i.limit!=null&&(a.top=i.limit),i.offset!=null&&(a.skip=i.offset),i.aggregations&&(a.aggregations=i.aggregations),i.groupBy&&(a.groupBy=i.groupBy)):Object.assign(a,t),a.top&&r.set(`top`,a.top.toString()),a.skip&&r.set(`skip`,a.skip.toString()),a.sort)if(Array.isArray(a.sort)&&typeof a.sort[0]==`object`)r.set(`sort`,JSON.stringify(a.sort));else{let e=Array.isArray(a.sort)?a.sort.join(`,`):a.sort;r.set(`sort`,e)}a.select&&r.set(`select`,a.select.join(`,`));let o=a.filter??a.filters;o&&(this.isFilterAST(o)||Array.isArray(o)?r.set(`filter`,JSON.stringify(o)):typeof o==`object`&&o&&Object.entries(o).forEach(([e,t])=>{t!=null&&r.append(e,String(t))})),a.aggregations&&r.set(`aggregations`,JSON.stringify(a.aggregations)),a.groupBy&&r.set(`groupBy`,a.groupBy.join(`,`));let s=await this.fetch(`${this.baseUrl}${n}/${e}?${r.toString()}`);return this.unwrapResponse(s)},get:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/${t}`);return this.unwrapResponse(r)},create:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},createMany:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/createMany`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},update:async(e,t,n,r)=>{let i=this.getRoute(`data`),a={};r?.ifMatch&&(a[`If-Match`]=String(r.ifMatch));let o=await this.fetch(`${this.baseUrl}${i}/${e}/${t}`,{method:`PATCH`,body:JSON.stringify(n),...Object.keys(a).length?{headers:a}:{}});return this.unwrapResponse(o)},batch:async(e,t)=>{let n=this.getRoute(`data`),r=await this.fetch(`${this.baseUrl}${n}/${e}/batch`,{method:`POST`,body:JSON.stringify(t)});return this.unwrapResponse(r)},updateMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={records:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/updateMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)},delete:async(e,t,n)=>{let r=this.getRoute(`data`),i={};n?.ifMatch&&(i[`If-Match`]=String(n.ifMatch));let a=await this.fetch(`${this.baseUrl}${r}/${e}/${t}`,{method:`DELETE`,...Object.keys(i).length?{headers:i}:{}});return this.unwrapResponse(a)},deleteMany:async(e,t,n)=>{let r=this.getRoute(`data`),i={ids:t,options:n},a=await this.fetch(`${this.baseUrl}${r}/${e}/deleteMany`,{method:`POST`,body:JSON.stringify(i)});return this.unwrapResponse(a)}},this.baseUrl=e.baseUrl.replace(/\/$/,``),this.token=e.token,this.environmentId=e.environmentId,this.fetchImpl=e.fetch||globalThis.fetch.bind(globalThis),this.logger=e.logger||Kg({level:e.debug?`debug`:`info`,format:`pretty`}),this.realtimeAPI=new qg(this.baseUrl,this.token),this.logger.debug(`ObjectStack client created`,{baseUrl:this.baseUrl})}async connect(){this.logger.debug(`Connecting to ObjectStack server`,{baseUrl:this.baseUrl});try{let e;try{let t=`${this.baseUrl}/api/v1/discovery`;this.logger.debug(`Probing protocol-standard discovery endpoint`,{url:t});let n=await this.fetchImpl(t);if(n.ok){let t=await n.json();e=t.data||t,this.logger.debug(`Discovered via /api/v1/discovery`)}}catch(e){this.logger.debug(`Protocol-standard discovery probe failed`,{error:e.message})}if(!e){let t;try{t=`${new URL(this.baseUrl).origin}/.well-known/objectstack`}catch{t=`/.well-known/objectstack`}this.logger.debug(`Falling back to .well-known discovery`,{url:t});let n=await this.fetchImpl(t);if(!n.ok)throw Error(`Failed to connect to ${t}: ${n.statusText}`);let r=await n.json();e=r.data||r}if(!e)throw Error(`Connection failed: No discovery data returned`);return this.discoveryInfo=e,this.logger.info(`Connected to ObjectStack server`,{version:e.version,apiName:e.apiName,services:e.services}),e}catch(e){throw this.logger.error(`Failed to connect to ObjectStack server`,e,{baseUrl:this.baseUrl}),e}}get capabilities(){let e=this.discoveryInfo?.capabilities;if(!e)return;let t={};for(let[n,r]of Object.entries(e))t[n]=typeof r==`object`&&r?!!r.enabled:!!r;return t}project(e){if(!e)throw Error(`[ObjectStack] project(id): environmentId is required`);return new Yg(this,e)}_baseUrl(){return this.baseUrl}_fetch(e,t){return this.fetch(e,t)}_unwrap(e){return this.unwrapResponse(e)}_isFilterAST(e){return this.isFilterAST(e)}setProjectId(e){this.environmentId=e,this.logger.debug(`Active project changed`,{environmentId:e})}getProjectId(){return this.environmentId}get events(){return this.realtimeAPI}isFilterAST(e){return ep(e)}async unwrapResponse(e){let t=await e.json();return t&&typeof t.success==`boolean`&&`data`in t?t.data:t}async fetch(e,t={}){this.logger.debug(`HTTP request`,{method:t.method||`GET`,url:e,hasBody:!!t.body});let n={"Content-Type":`application/json`,...t.headers||{}};this.token&&(n.Authorization=`Bearer ${this.token}`),this.environmentId&&(n[`X-Environment-Id`]=this.environmentId);let r=await this.fetchImpl(e,{...t,headers:n});if(this.logger.debug(`HTTP response`,{method:t.method||`GET`,url:e,status:r.status,ok:r.ok}),!r.ok){let n;try{n=await r.json()}catch{n={message:r.statusText}}this.logger.error(`HTTP request failed`,void 0,{method:t.method||`GET`,url:e,status:r.status,error:n});let i=n?.message??n?.error?.message??(typeof n?.error==`string`?n.error:void 0)??r.statusText,a=n?.code||n?.error?.code,o=Error(`[ObjectStack] ${a?`${a}: `:``}${i}`);throw o.code=a,o.category=n?.category,o.httpStatus=r.status,o.retryable=n?.retryable,o.details=n?.details||n,o}return r}getRoute(e){let t=this.discoveryInfo?.routes;if(t){let n=t[e];if(n)return n}return{data:`/api/v1/data`,metadata:`/api/v1/meta`,discovery:`/api/v1/discovery`,ui:`/api/v1/ui`,auth:`/api/v1/auth`,analytics:`/api/v1/analytics`,storage:`/api/v1/storage`,automation:`/api/v1/automation`,packages:`/api/v1/packages`,permissions:`/api/v1/permissions`,realtime:`/api/v1/realtime`,workflow:`/api/v1/workflow`,views:`/api/v1/ui/views`,notifications:`/api/v1/notifications`,ai:`/api/v1/ai`,i18n:`/api/v1/i18n`,feed:`/api/v1/feed`,graphql:`/graphql`}[e]||`/api/v1/${e}`}},Yg=class{constructor(e,t){this.meta={getTypes:async()=>{let e=await this.parent._fetch(this.url(`/meta`));return this.parent._unwrap(e)},getItems:async(e,t)=>{let n=new URLSearchParams;t?.packageId&&n.set(`package`,t.packageId);let r=n.toString(),i=await this.parent._fetch(this.url(`/meta/${e}${r?`?${r}`:``}`));return this.parent._unwrap(i)},getItem:async(e,t,n)=>{let r=new URLSearchParams;n?.packageId&&r.set(`package`,n.packageId);let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${e}/${t}${i?`?${i}`:``}`));return this.parent._unwrap(a)},saveItem:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/meta/${e}/${t}`),{method:`PUT`,body:JSON.stringify(n)});return this.parent._unwrap(r)},deleteItem:async(e,t)=>{let n=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}`),{method:`DELETE`});return this.parent._unwrap(n)},getHistory:async(e,t,n)=>{let r=new URLSearchParams;n?.sinceSeq!==void 0&&r.set(`sinceSeq`,String(n.sinceSeq)),n?.limit!==void 0&&r.set(`limit`,String(n.limit));let i=r.toString(),a=await this.parent._fetch(this.url(`/meta/${encodeURIComponent(e)}/${encodeURIComponent(t)}/history${i?`?${i}`:``}`));return this.parent._unwrap(a)}},this.data={query:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/query`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},find:async(e,t={})=>{let n=new URLSearchParams,r=t,i={};if(`where`in t||`fields`in t||`orderBy`in t||`offset`in t?(r.where&&(i.filter=r.where),r.fields&&(i.select=r.fields),r.orderBy&&(i.sort=r.orderBy),r.limit!=null&&(i.top=r.limit),r.offset!=null&&(i.skip=r.offset),r.aggregations&&(i.aggregations=r.aggregations),r.groupBy&&(i.groupBy=r.groupBy)):Object.assign(i,t),i.top&&n.set(`top`,i.top.toString()),i.skip&&n.set(`skip`,i.skip.toString()),i.sort)if(Array.isArray(i.sort)&&typeof i.sort[0]==`object`)n.set(`sort`,JSON.stringify(i.sort));else{let e=Array.isArray(i.sort)?i.sort.join(`,`):i.sort;n.set(`sort`,e)}i.select&&n.set(`select`,i.select.join(`,`));let a=i.filter??i.filters;a&&(this.parent._isFilterAST(a)||Array.isArray(a)?n.set(`filter`,JSON.stringify(a)):typeof a==`object`&&a&&Object.entries(a).forEach(([e,t])=>{t!=null&&n.append(e,String(t))})),i.aggregations&&n.set(`aggregations`,JSON.stringify(i.aggregations)),i.groupBy&&n.set(`groupBy`,i.groupBy.join(`,`));let o=n.toString(),s=await this.parent._fetch(this.url(`/data/${e}${o?`?${o}`:``}`));return this.parent._unwrap(s)},get:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`));return this.parent._unwrap(n)},create:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},createMany:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/createMany`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},update:async(e,t,n)=>{let r=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`PATCH`,body:JSON.stringify(n)});return this.parent._unwrap(r)},batch:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/batch`),{method:`POST`,body:JSON.stringify(t)});return this.parent._unwrap(n)},updateMany:async(e,t,n)=>{let r={records:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/updateMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)},delete:async(e,t)=>{let n=await this.parent._fetch(this.url(`/data/${e}/${t}`),{method:`DELETE`});return this.parent._unwrap(n)},deleteMany:async(e,t,n)=>{let r={ids:t,options:n},i=await this.parent._fetch(this.url(`/data/${e}/deleteMany`),{method:`POST`,body:JSON.stringify(r)});return this.parent._unwrap(i)}},this.packages={list:async()=>{let e=await this.parent._fetch(this.url(`/packages`));return this.parent._unwrap(e)},get:async(e,t)=>{let n=t?`?version=${encodeURIComponent(t)}`:``,r=await this.parent._fetch(this.url(`/packages/${encodeURIComponent(e)}${n}`));return this.parent._unwrap(r)}},this.automation={getFlow:async e=>{let t=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}`));return this.parent._unwrap(t)},execute:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/trigger`),{method:`POST`,body:JSON.stringify(t??{})});return this.parent._unwrap(n)},listRuns:async(e,t)=>{let n=new URLSearchParams;t?.limit!=null&&n.set(`limit`,String(t.limit)),t?.cursor&&n.set(`cursor`,t.cursor);let r=n.toString(),i=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs${r?`?${r}`:``}`));return this.parent._unwrap(i)},getRun:async(e,t)=>{let n=await this.parent._fetch(this.url(`/automation/${encodeURIComponent(e)}/runs/${encodeURIComponent(t)}`));return this.parent._unwrap(n)}},this.parent=e,this.environmentId=t}getProjectId(){return this.environmentId}scope(){return`/api/v1/environments/${encodeURIComponent(this.environmentId)}`}url(e){return`${this.parent._baseUrl()}${this.scope()}${e}`}},Xg=(0,j.createContext)(null);function Zg({client:e,children:t}){return j.createElement(Xg.Provider,{value:e},t)}function Qg(){let e=(0,j.useContext)(Xg);if(!e)throw Error(`useClient must be used within an ObjectStackProvider. Make sure your component is wrapped with <ObjectStackProvider client={...}>.`);return e}var $g=1,e_=1e6,t_=0;function n_(){return t_=(t_+1)%(2**53-1),t_.toString()}var r_=new Map,i_=e=>{if(r_.has(e))return;let t=setTimeout(()=>{r_.delete(e),c_({type:`REMOVE_TOAST`,toastId:e})},e_);r_.set(e,t)},a_=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,$g)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?i_(n):e.toasts.forEach(e=>{i_(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},o_=[],s_={toasts:[]};function c_(e){s_=a_(s_,e),o_.forEach(e=>{e(s_)})}function K({...e}){let t=n_(),n=e=>c_({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>c_({type:`DISMISS_TOAST`,toastId:t});return c_({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function l_(){let[e,t]=j.useState(s_);return j.useEffect(()=>(o_.push(t),()=>{let e=o_.indexOf(t);e>-1&&o_.splice(e,1)}),[e]),{...e,toast:K,dismiss:e=>c_({type:`DISMISS_TOAST`,toastId:e})}}typeof window<`u`&&window.document&&window.document.createElement;function q(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function u_(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function d_(...e){return t=>{let n=!1,r=e.map(e=>{let r=u_(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():u_(e[t],null)}}}}function f_(...e){return j.useCallback(d_(...e),e)}function p_(e,t){let n=j.createContext(t),r=e=>{let{children:t,...r}=e,i=j.useMemo(()=>r,Object.values(r));return(0,M.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=j.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function m_(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,h_(i,...t)]}function h_(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function g_(e){let t=__(e),n=j.forwardRef((e,n)=>{let{children:r,...i}=e,a=j.Children.toArray(r),o=a.find(b_);if(o){let e=o.props.children,r=a.map(t=>t===o?j.Children.count(e)>1?j.Children.only(null):j.isValidElement(e)?e.props.children:null:t);return(0,M.jsx)(t,{...i,ref:n,children:j.isValidElement(e)?j.cloneElement(e,void 0,r):null})}return(0,M.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function __(e){let t=j.forwardRef((e,t)=>{let{children:n,...r}=e;if(j.isValidElement(n)){let e=S_(n),i=x_(r,n.props);return n.type!==j.Fragment&&(i.ref=t?d_(t,e):e),j.cloneElement(n,i)}return j.Children.count(n)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var v_=Symbol(`radix.slottable`);function y_(e){let t=({children:e})=>(0,M.jsx)(M.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=v_,t}function b_(e){return j.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===v_}function x_(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function S_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function C_(e){let t=e+`CollectionProvider`,[n,r]=m_(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=j.useRef(null),a=j.useRef(new Map).current;return(0,M.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=g_(s),l=j.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,M.jsx)(c,{ref:f_(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=g_(u),p=j.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=j.useRef(null),s=f_(t,o),c=a(u,n);return j.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,M.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return j.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var w_=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=g_(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function T_(e,t){e&&Gi.flushSync(()=>e.dispatchEvent(t))}function E_(e){let t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>(...e)=>t.current?.(...e),[])}function D_(e,t=globalThis?.document){let n=E_(e);j.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var O_=`DismissableLayer`,k_=`dismissableLayer.update`,A_=`dismissableLayer.pointerDownOutside`,j_=`dismissableLayer.focusOutside`,M_,N_=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),P_=j.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=j.useContext(N_),[u,d]=j.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=j.useState({}),m=f_(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=L_(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=R_(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return D_(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),j.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(M_=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),z_(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=M_)}},[u,f,n,l]),j.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),z_())},[u,l]),j.useEffect(()=>{let e=()=>p({});return document.addEventListener(k_,e),()=>document.removeEventListener(k_,e)},[]),(0,M.jsx)(w_.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:q(e.onFocusCapture,S.onFocusCapture),onBlurCapture:q(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:q(e.onPointerDownCapture,x.onPointerDownCapture)})});P_.displayName=O_;var F_=`DismissableLayerBranch`,I_=j.forwardRef((e,t)=>{let n=j.useContext(N_),r=j.useRef(null),i=f_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,M.jsx)(w_.div,{...e,ref:i})});I_.displayName=F_;function L_(e,t=globalThis?.document){let n=E_(e),r=j.useRef(!1),i=j.useRef(()=>{});return j.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){B_(A_,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function R_(e,t=globalThis?.document){let n=E_(e),r=j.useRef(!1);return j.useEffect(()=>{let e=e=>{e.target&&!r.current&&B_(j_,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function z_(){let e=new CustomEvent(k_);document.dispatchEvent(e)}function B_(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?T_(i,a):i.dispatchEvent(a)}var V_=P_,H_=I_,U_=globalThis?.document?j.useLayoutEffect:()=>{},W_=`Portal`,G_=j.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=j.useState(!1);U_(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Gi.createPortal((0,M.jsx)(w_.div,{...r,ref:t}),o):null});G_.displayName=W_;function K_(e,t){return j.useReducer((e,n)=>t[e][n]??e,e)}var q_=e=>{let{present:t,children:n}=e,r=J_(t),i=typeof n==`function`?n({present:r.isPresent}):j.Children.only(n),a=f_(r.ref,X_(i));return typeof n==`function`||r.isPresent?j.cloneElement(i,{ref:a}):null};q_.displayName=`Presence`;function J_(e){let[t,n]=j.useState(),r=j.useRef(null),i=j.useRef(e),a=j.useRef(`none`),[o,s]=K_(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return j.useEffect(()=>{let e=Y_(r.current);a.current=o===`mounted`?e:`none`},[o]),U_(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Y_(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),U_(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Y_(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=Y_(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:j.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Y_(e){return e?.animationName||`none`}function X_(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Z_=j.useInsertionEffect||U_;function Q_({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=$_({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=j.useRef(e!==void 0);j.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,j.useCallback(t=>{if(s){let n=ev(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function $_({defaultProp:e,onChange:t}){let[n,r]=j.useState(e),i=j.useRef(n),a=j.useRef(t);return Z_(()=>{a.current=t},[t]),j.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function ev(e){return typeof e==`function`}var tv=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),nv=`VisuallyHidden`,rv=j.forwardRef((e,t)=>(0,M.jsx)(w_.span,{...e,ref:t,style:{...tv,...e.style}}));rv.displayName=nv;var iv=rv,av=`ToastProvider`,[ov,sv,cv]=C_(`Toast`),[lv,uv]=m_(`Toast`,[cv]),[dv,fv]=lv(av),pv=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=j.useState(null),[l,u]=j.useState(0),d=j.useRef(!1),f=j.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${av}\`. Expected non-empty \`string\`.`),(0,M.jsx)(ov.Provider,{scope:t,children:(0,M.jsx)(dv,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:j.useCallback(()=>u(e=>e+1),[]),onToastRemove:j.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};pv.displayName=av;var mv=`ToastViewport`,hv=[`F8`],gv=`toast.viewportPause`,_v=`toast.viewportResume`,vv=j.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=hv,label:i=`Notifications ({hotkey})`,...a}=e,o=fv(mv,n),s=sv(n),c=j.useRef(null),l=j.useRef(null),u=j.useRef(null),d=j.useRef(null),f=f_(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;j.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),j.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(gv);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(_v);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=j.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...Gv(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return j.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Kv(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,M.jsxs)(H_,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,M.jsx)(bv,{ref:l,onFocusFromOutsideViewport:()=>{Kv(h({tabbingDirection:`forwards`}))}}),(0,M.jsx)(ov.Slot,{scope:n,children:(0,M.jsx)(w_.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,M.jsx)(bv,{ref:u,onFocusFromOutsideViewport:()=>{Kv(h({tabbingDirection:`backwards`}))}})]})});vv.displayName=mv;var yv=`ToastFocusProxy`,bv=j.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=fv(yv,n);return(0,M.jsx)(rv,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});bv.displayName=yv;var xv=`Toast`,Sv=`toast.swipeStart`,Cv=`toast.swipeMove`,wv=`toast.swipeCancel`,Tv=`toast.swipeEnd`,Ev=j.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=Q_({prop:r,defaultProp:i??!0,onChange:a,caller:xv});return(0,M.jsx)(q_,{present:n||s,children:(0,M.jsx)(kv,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:E_(e.onPause),onResume:E_(e.onResume),onSwipeStart:q(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:q(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:q(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:q(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Ev.displayName=xv;var[Dv,Ov]=lv(xv,{onClose(){}}),kv=j.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=fv(xv,n),[g,_]=j.useState(null),v=f_(t,e=>_(e)),y=j.useRef(null),b=j.useRef(null),x=i||h.duration,S=j.useRef(0),C=j.useRef(x),w=j.useRef(0),{onToastAdd:T,onToastRemove:E}=h,D=E_(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),O=j.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),S.current=new Date().getTime(),w.current=window.setTimeout(D,e))},[D]);j.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{O(C.current),l?.()},n=()=>{let e=new Date().getTime()-S.current;C.current-=e,window.clearTimeout(w.current),c?.()};return e.addEventListener(gv,n),e.addEventListener(_v,t),()=>{e.removeEventListener(gv,n),e.removeEventListener(_v,t)}}},[h.viewport,x,c,l,O]),j.useEffect(()=>{a&&!h.isClosePausedRef.current&&O(x)},[a,x,h.isClosePausedRef,O]),j.useEffect(()=>(T(),()=>E()),[T,E]);let ee=j.useMemo(()=>g?Bv(g):null,[g]);return h.viewport?(0,M.jsxs)(M.Fragment,{children:[ee&&(0,M.jsx)(Av,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:ee}),(0,M.jsx)(Dv,{scope:n,onClose:D,children:Gi.createPortal((0,M.jsx)(ov.ItemSlot,{scope:n,children:(0,M.jsx)(V_,{asChild:!0,onEscapeKeyDown:q(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||D(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,M.jsx)(w_.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:q(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:q(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:q(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!b.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(b.current=l,Vv(Cv,d,f,{discrete:!1})):Hv(l,h.swipeDirection,c)?(b.current=l,Vv(Sv,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:q(e.onPointerUp,e=>{let t=b.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),b.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};Hv(t,h.swipeDirection,h.swipeThreshold)?Vv(Tv,p,r,{discrete:!0}):Vv(wv,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Av=e=>{let{__scopeToast:t,children:n,...r}=e,i=fv(xv,t),[a,o]=j.useState(!1),[s,c]=j.useState(!1);return Uv(()=>o(!0)),j.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,M.jsx)(G_,{asChild:!0,children:(0,M.jsx)(rv,{...r,children:a&&(0,M.jsxs)(M.Fragment,{children:[i.label,` `,n]})})})},jv=`ToastTitle`,Mv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,M.jsx)(w_.div,{...r,ref:t})});Mv.displayName=jv;var Nv=`ToastDescription`,Pv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,M.jsx)(w_.div,{...r,ref:t})});Pv.displayName=Nv;var Fv=`ToastAction`,Iv=j.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,M.jsx)(zv,{altText:n,asChild:!0,children:(0,M.jsx)(Rv,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Fv}\`. Expected non-empty \`string\`.`),null)});Iv.displayName=Fv;var Lv=`ToastClose`,Rv=j.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Ov(Lv,n);return(0,M.jsx)(zv,{asChild:!0,children:(0,M.jsx)(w_.button,{type:`button`,...r,ref:t,onClick:q(e.onClick,i.onClose)})})});Rv.displayName=Lv;var zv=j.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,M.jsx)(w_.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Bv(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Wv(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Bv(e))}}),t}function Vv(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?T_(i,a):i.dispatchEvent(a)}var Hv=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function Uv(e=()=>{}){let t=E_(e);U_(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function Wv(e){return e.nodeType===e.ELEMENT_NODE}function Gv(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Kv(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var qv=pv,Jv=vv,Yv=Ev,Xv=Mv,Zv=Pv,Qv=Iv,$v=Rv;function ey(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=ey(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ty(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ey(e))&&(r&&(r+=` `),r+=t);return r}var ny=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ry=ty,iy=(e,t)=>n=>{if(t?.variants==null)return ry(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ny(t)||ny(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ry(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},ay=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),oy=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),sy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),cy=e=>{let t=sy(e);return t.charAt(0).toUpperCase()+t.slice(1)},ly={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},uy=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},dy=(0,j.createContext)({}),fy=()=>(0,j.useContext)(dy),py=(0,j.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=fy()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,j.createElement)(`svg`,{ref:c,...ly,width:t??l??ly.width,height:t??l??ly.height,stroke:e??f,strokeWidth:m,className:ay(`lucide`,p,i),...!a&&!uy(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,j.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),my=(e,t)=>{let n=(0,j.forwardRef)(({className:n,...r},i)=>(0,j.createElement)(py,{ref:i,iconNode:t,className:ay(`lucide-${oy(cy(e))}`,`lucide-${e}`,n),...r}));return n.displayName=cy(e),n},hy=my(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),gy=my(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),_y=my(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),vy=my(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),yy=my(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),by=my(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),xy=my(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Sy=my(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Cy=my(`circle-user-round`,[[`path`,{d:`M17.925 20.056a6 6 0 0 0-11.851.001`,key:`z69sun`}],[`circle`,{cx:`12`,cy:`11`,r:`4`,key:`1gt34v`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),wy=my(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ty=my(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ey=my(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Dy=my(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Oy=my(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),ky=my(`gallery-vertical-end`,[[`path`,{d:`M7 2h10`,key:`nczekb`}],[`path`,{d:`M5 6h14`,key:`u2x4p`}],[`rect`,{width:`18`,height:`12`,x:`3`,y:`10`,rx:`2`,key:`l0tzu3`}]]),Ay=my(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),jy=my(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),My=my(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Ny=my(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Py=my(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),Fy=my(`link-2-off`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),Iy=my(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),Ly=my(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Ry=my(`mail-check`,[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`m16 19 2 2 4-4`,key:`1b14m6`}]]),zy=my(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),By=my(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Vy=my(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Hy=my(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Uy=my(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Wy=my(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Gy=my(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Ky=my(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),qy=my(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Jy=my(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Yy=my(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Xy=my(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Zy=my(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),Qy=my(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),$y=my(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),eb=my(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),tb=my(`user-minus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),nb=my(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),rb=my(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),ib=my(`users-round`,[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]]),ab=my(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ob=my(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),sb=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},cb=(e,t)=>({classGroupId:e,validator:t}),lb=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ub=`-`,db=[],fb=`arbitrary..`,pb=e=>{let t=gb(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return hb(e);let n=e.split(ub);return mb(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?sb(i,t):t:i||db}return n[e]||db}}},mb=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=mb(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ub):e.slice(t).join(ub),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},hb=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?fb+r:void 0})(),gb=e=>{let{theme:t,classGroups:n}=e;return _b(n,t)},_b=(e,t)=>{let n=lb();for(let r in e){let i=e[r];vb(i,n,r,t)}return n},vb=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];yb(i,t,n,r)}},yb=(e,t,n,r)=>{if(typeof e==`string`){bb(e,t,n);return}if(typeof e==`function`){xb(e,t,n,r);return}Sb(e,t,n,r)},bb=(e,t,n)=>{let r=e===``?t:Cb(t,e);r.classGroupId=n},xb=(e,t,n,r)=>{if(wb(e)){vb(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(cb(n,e))},Sb=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];vb(o,Cb(t,a),n,r)}},Cb=(e,t)=>{let n=e,r=t.split(ub),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=lb(),n.nextPart.set(t,i)),n=i}return n},wb=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Tb=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Eb=`!`,Db=`:`,Ob=[],kb=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Ab=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===Db){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Eb)?(c=s.slice(0,-1),l=!0):s.startsWith(Eb)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return kb(t,l,c,u)};if(t){let e=t+Db,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):kb(Ob,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},jb=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Mb=e=>({cache:Tb(e.cacheSize),parseClassName:Ab(e),sortModifiers:jb(e),postfixLookupClassGroupIds:Nb(e),...pb(e)}),Nb=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},Pb=/\s+/,Fb=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Pb),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Eb:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},Ib=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Lb(n))&&(i&&(i+=` `),i+=r);return i},Lb=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Lb(e[r]))&&(n&&(n+=` `),n+=t);return n},Rb=(e,...t)=>{let n,r,i,a,o=o=>(n=Mb(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Fb(e,n);return i(e,a),a};return a=o,(...e)=>a(Ib(...e))},zb=[],Bb=e=>{let t=t=>t[e]||zb;return t.isThemeGetter=!0,t},Vb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ub=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Wb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Gb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Kb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,qb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Jb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yb=e=>Ub.test(e),Xb=e=>!!e&&!Number.isNaN(Number(e)),Zb=e=>!!e&&Number.isInteger(Number(e)),Qb=e=>e.endsWith(`%`)&&Xb(e.slice(0,-1)),$b=e=>Wb.test(e),ex=()=>!0,tx=e=>Gb.test(e)&&!Kb.test(e),nx=()=>!1,rx=e=>qb.test(e),ix=e=>Jb.test(e),ax=e=>!J(e)&&!Y(e),ox=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),sx=e=>Sx(e,Ex,nx),J=e=>Vb.test(e),cx=e=>Sx(e,Dx,tx),lx=e=>Sx(e,Ox,Xb),ux=e=>Sx(e,Ax,ex),dx=e=>Sx(e,kx,nx),fx=e=>Sx(e,wx,nx),px=e=>Sx(e,Tx,ix),mx=e=>Sx(e,jx,rx),Y=e=>Hb.test(e),hx=e=>Cx(e,Dx),gx=e=>Cx(e,kx),_x=e=>Cx(e,wx),vx=e=>Cx(e,Ex),yx=e=>Cx(e,Tx),bx=e=>Cx(e,jx,!0),xx=e=>Cx(e,Ax,!0),Sx=(e,t,n)=>{let r=Vb.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Cx=(e,t,n=!1)=>{let r=Hb.exec(e);return r?r[1]?t(r[1]):n:!1},wx=e=>e===`position`||e===`percentage`,Tx=e=>e===`image`||e===`url`,Ex=e=>e===`length`||e===`size`||e===`bg-size`,Dx=e=>e===`length`,Ox=e=>e===`number`,kx=e=>e===`family-name`,Ax=e=>e===`number`||e===`weight`,jx=e=>e===`shadow`,Mx=Rb(()=>{let e=Bb(`color`),t=Bb(`font`),n=Bb(`text`),r=Bb(`font-weight`),i=Bb(`tracking`),a=Bb(`leading`),o=Bb(`breakpoint`),s=Bb(`container`),c=Bb(`spacing`),l=Bb(`radius`),u=Bb(`shadow`),d=Bb(`inset-shadow`),f=Bb(`text-shadow`),p=Bb(`drop-shadow`),m=Bb(`blur`),h=Bb(`perspective`),g=Bb(`aspect`),_=Bb(`ease`),v=Bb(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[Yb,`full`,`auto`,...w()],E=()=>[Zb,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,Zb,Y,J]},Zb,Y,J],O=()=>[Zb,`auto`,Y,J],ee=()=>[`auto`,`min`,`max`,`fr`,Y,J],te=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ne=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],re=()=>[`auto`,...w()],ie=()=>[Yb,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[Yb,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],oe=()=>[Yb,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],k=()=>[e,Y,J],se=()=>[...b(),_x,fx,{position:[Y,J]}],ce=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],le=()=>[`auto`,`cover`,`contain`,vx,sx,{size:[Y,J]}],ue=()=>[Qb,hx,cx],A=()=>[``,`none`,`full`,l,Y,J],de=()=>[``,Xb,hx,cx],fe=()=>[`solid`,`dashed`,`dotted`,`double`],pe=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],me=()=>[Xb,Qb,_x,fx],he=()=>[``,`none`,m,Y,J],ge=()=>[`none`,Xb,Y,J],_e=()=>[`none`,Xb,Y,J],ve=()=>[Xb,Y,J],ye=()=>[Yb,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[$b],breakpoint:[$b],color:[ex],container:[$b],"drop-shadow":[$b],ease:[`in`,`out`,`in-out`],font:[ax],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[$b],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[$b],shadow:[$b],spacing:[`px`,Xb],text:[$b],"text-shadow":[$b],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Yb,J,Y,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Y,J]}],"container-named":[ox],columns:[{columns:[Xb,J,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Zb,`auto`,Y,J]}],basis:[{basis:[Yb,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Xb,Yb,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,Xb,Y,J]}],shrink:[{shrink:[``,Xb,Y,J]}],order:[{order:[Zb,`first`,`last`,`none`,Y,J]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...te(),`normal`]}],"justify-items":[{"justify-items":[...ne(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ne()]}],"align-content":[{content:[`normal`,...te()]}],"align-items":[{items:[...ne(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ne(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...ne(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ne()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:re()}],mx:[{mx:re()}],my:[{my:re()}],ms:[{ms:re()}],me:[{me:re()}],mbs:[{mbs:re()}],mbe:[{mbe:re()}],mt:[{mt:re()}],mr:[{mr:re()}],mb:[{mb:re()}],ml:[{ml:re()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ie()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[s,`screen`,...ie()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ie()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ie()]}],h:[{h:[`screen`,`lh`,...ie()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ie()]}],"max-h":[{"max-h":[`screen`,`lh`,...ie()]}],"font-size":[{text:[`base`,n,hx,cx]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,xx,ux]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Qb,J]}],"font-family":[{font:[gx,dx,t]}],"font-features":[{"font-features":[J]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,J]}],"line-clamp":[{"line-clamp":[Xb,`none`,Y,lx]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...fe(),`wavy`]}],"text-decoration-thickness":[{decoration:[Xb,`from-font`,`auto`,Y,cx]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[Xb,`auto`,Y,J]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[Zb,Y,J]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:ce()}],"bg-size":[{bg:le()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Zb,Y,J],radial:[``,Y,J],conic:[Zb,Y,J]},yx,px]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:A()}],"rounded-s":[{"rounded-s":A()}],"rounded-e":[{"rounded-e":A()}],"rounded-t":[{"rounded-t":A()}],"rounded-r":[{"rounded-r":A()}],"rounded-b":[{"rounded-b":A()}],"rounded-l":[{"rounded-l":A()}],"rounded-ss":[{"rounded-ss":A()}],"rounded-se":[{"rounded-se":A()}],"rounded-ee":[{"rounded-ee":A()}],"rounded-es":[{"rounded-es":A()}],"rounded-tl":[{"rounded-tl":A()}],"rounded-tr":[{"rounded-tr":A()}],"rounded-br":[{"rounded-br":A()}],"rounded-bl":[{"rounded-bl":A()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":de()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...fe(),`hidden`,`none`]}],"divide-style":[{divide:[...fe(),`hidden`,`none`]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...fe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Xb,Y,J]}],"outline-w":[{outline:[``,Xb,hx,cx]}],"outline-color":[{outline:k()}],shadow:[{shadow:[``,`none`,u,bx,mx]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":[`none`,d,bx,mx]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:de()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[Xb,cx]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":[`none`,f,bx,mx]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[Xb,Y,J]}],"mix-blend":[{"mix-blend":[...pe(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Xb]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Xb]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:ce()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:he()}],brightness:[{brightness:[Xb,Y,J]}],contrast:[{contrast:[Xb,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,bx,mx]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:[``,Xb,Y,J]}],"hue-rotate":[{"hue-rotate":[Xb,Y,J]}],invert:[{invert:[``,Xb,Y,J]}],saturate:[{saturate:[Xb,Y,J]}],sepia:[{sepia:[``,Xb,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[Xb,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[Xb,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Xb,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Xb,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,Xb,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[Xb,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[Xb,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,Xb,Y,J]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Xb,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[Xb,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":[`scale-3d`],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":[`translate-none`],zoom:[{zoom:[Zb,Y,J]}],accent:[{accent:k()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:k()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,J]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":k()}],"scrollbar-track-color":[{"scrollbar-track":k()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,J]}],fill:[{fill:[`none`,...k()]}],"stroke-w":[{stroke:[Xb,hx,cx,lx]}],stroke:[{stroke:[`none`,...k()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function X(...e){return Mx(ty(e))}var Nx=qv,Px=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Jv,{ref:n,className:X(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));Px.displayName=Jv.displayName;var Fx=iy(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),Ix=j.forwardRef(({className:e,variant:t,...n},r)=>(0,M.jsx)(Yv,{ref:r,className:X(Fx({variant:t}),e),...n}));Ix.displayName=Yv.displayName;var Lx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Qv,{ref:n,className:X(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));Lx.displayName=Qv.displayName;var Rx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)($v,{ref:n,className:X(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,M.jsx)(ob,{className:`h-4 w-4`})}));Rx.displayName=$v.displayName;var zx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Xv,{ref:n,className:X(`text-sm font-semibold`,e),...t}));zx.displayName=Xv.displayName;var Bx=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Zv,{ref:n,className:X(`text-sm opacity-90`,e),...t}));Bx.displayName=Zv.displayName;function Vx(){let{toasts:e}=l_();return(0,M.jsxs)(Nx,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,M.jsxs)(Ix,{...i,children:[(0,M.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,M.jsx)(zx,{children:t}),n&&(0,M.jsx)(Bx,{children:n})]}),r,(0,M.jsx)(Rx,{})]},e)}),(0,M.jsx)(Px,{})]})}var Hx=Symbol.for(`react.lazy`),Ux=j.use;function Wx(e){return typeof e==`object`&&!!e&&`then`in e}function Gx(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Hx&&`_payload`in e&&Wx(e._payload)}function Kx(e){let t=Jx(e),n=j.forwardRef((e,n)=>{let{children:r,...i}=e;Gx(r)&&typeof Ux==`function`&&(r=Ux(r._payload));let a=j.Children.toArray(r),o=a.find(Xx);if(o){let e=o.props.children,r=a.map(t=>t===o?j.Children.count(e)>1?j.Children.only(null):j.isValidElement(e)?e.props.children:null:t);return(0,M.jsx)(t,{...i,ref:n,children:j.isValidElement(e)?j.cloneElement(e,void 0,r):null})}return(0,M.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var qx=Kx(`Slot`);function Jx(e){let t=j.forwardRef((e,t)=>{let{children:n,...r}=e;if(Gx(n)&&typeof Ux==`function`&&(n=Ux(n._payload)),j.isValidElement(n)){let e=Qx(n),i=Zx(r,n.props);return n.type!==j.Fragment&&(i.ref=t?d_(t,e):e),j.cloneElement(n,i)}return j.Children.count(n)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yx=Symbol(`radix.slottable`);function Xx(e){return j.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Yx}function Zx(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Qx(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $x=768;function eS(){let[e,t]=j.useState(void 0);return j.useEffect(()=>{let e=window.matchMedia(`(max-width: ${$x-1}px)`),n=()=>{t(window.innerWidth<$x)};return e.addEventListener(`change`,n),t(window.innerWidth<$x),()=>e.removeEventListener(`change`,n)},[]),!!e}var tS=iy(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90`,outline:`border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,lg:`h-10 rounded-md px-8`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Z=j.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,M.jsx)(r?qx:`button`,{className:X(tS({variant:t,size:n,className:e})),ref:a,...i}));Z.displayName=`Button`;var nS=j.forwardRef(({className:e,type:t,...n},r)=>(0,M.jsx)(`input`,{type:t,className:X(`flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));nS.displayName=`Input`;var rS=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Kx(`Primitive.${t}`),r=j.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,M.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),iS=`Separator`,aS=`horizontal`,oS=[`horizontal`,`vertical`],sS=j.forwardRef((e,t)=>{let{decorative:n,orientation:r=aS,...i}=e,a=cS(r)?r:aS,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,M.jsx)(rS.div,{"data-orientation":a,...o,...i,ref:t})});sS.displayName=iS;function cS(e){return oS.includes(e)}var lS=sS,uS=j.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,M.jsx)(lS,{ref:i,decorative:n,orientation:t,className:X(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));uS.displayName=lS.displayName;var dS=j.useId||(()=>void 0),fS=0;function pS(e){let[t,n]=j.useState(dS());return U_(()=>{e||n(e=>e??String(fS++))},[e]),e||(t?`radix-${t}`:``)}var mS=`focusScope.autoFocusOnMount`,hS=`focusScope.autoFocusOnUnmount`,gS={bubbles:!1,cancelable:!0},_S=`FocusScope`,vS=j.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=j.useState(null),l=E_(i),u=E_(a),d=j.useRef(null),f=f_(t,e=>c(e)),p=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:TS(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||TS(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&TS(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),j.useEffect(()=>{if(s){ES.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(mS,gS);s.addEventListener(mS,l),s.dispatchEvent(t),t.defaultPrevented||(yS(kS(xS(s)),{select:!0}),document.activeElement===e&&TS(s))}return()=>{s.removeEventListener(mS,l),setTimeout(()=>{let t=new CustomEvent(hS,gS);s.addEventListener(hS,u),s.dispatchEvent(t),t.defaultPrevented||TS(e??document.body,{select:!0}),s.removeEventListener(hS,u),ES.remove(p)},0)}}},[s,l,u,p]);let m=j.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=bS(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&TS(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&TS(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,M.jsx)(w_.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});vS.displayName=_S;function yS(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(TS(r,{select:t}),document.activeElement!==n)return}function bS(e){let t=xS(e);return[SS(t,e),SS(t.reverse(),e)]}function xS(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function SS(e,t){for(let n of e)if(!CS(n,{upTo:t}))return n}function CS(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function wS(e){return e instanceof HTMLInputElement&&`select`in e}function TS(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&wS(e)&&t&&e.select()}}var ES=DS();function DS(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=OS(e,t),e.unshift(t)},remove(t){e=OS(e,t),e[0]?.resume()}}}function OS(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function kS(e){return e.filter(e=>e.tagName!==`A`)}var AS=0;function jS(){j.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??MS()),document.body.insertAdjacentElement(`beforeend`,e[1]??MS()),AS++,()=>{AS===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),AS--}},[])}function MS(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var NS=function(){return NS=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},NS.apply(this,arguments)};function PS(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function FS(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var IS=`right-scroll-bar-position`,LS=`width-before-scroll-bar`,RS=`with-scroll-bars-hidden`,zS=`--removed-body-scroll-bar-size`;function BS(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function VS(e,t){var n=(0,j.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var HS=typeof window<`u`?j.useLayoutEffect:j.useEffect,US=new WeakMap;function WS(e,t){var n=VS(t||null,function(t){return e.forEach(function(e){return BS(e,t)})});return HS(function(){var t=US.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||BS(e,null)}),i.forEach(function(e){r.has(e)||BS(e,a)})}US.set(n,e)},[e]),n}function GS(e){return e}function KS(e,t){t===void 0&&(t=GS);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function qS(e){e===void 0&&(e={});var t=KS(null);return t.options=NS({async:!0,ssr:!1},e),t}var JS=function(e){var t=e.sideCar,n=PS(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return j.createElement(r,NS({},n))};JS.isSideCarExport=!0;function YS(e,t){return e.useMedium(t),JS}var XS=qS(),ZS=function(){},QS=j.forwardRef(function(e,t){var n=j.useRef(null),r=j.useState({onScrollCapture:ZS,onWheelCapture:ZS,onTouchMoveCapture:ZS}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=PS(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=WS([n,t]),C=NS(NS({},b),i);return j.createElement(j.Fragment,null,u&&j.createElement(x,{sideCar:XS,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?j.cloneElement(j.Children.only(s),NS(NS({},C),{ref:S})):j.createElement(v,NS({},C,{className:c,ref:S}),s))});QS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},QS.classNames={fullWidth:LS,zeroRight:IS};var $S,eC=function(){if($S)return $S;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function tC(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=eC();return t&&e.setAttribute(`nonce`,t),e}function nC(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function rC(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var iC=function(){var e=0,t=null;return{add:function(n){e==0&&(t=tC())&&(nC(t,n),rC(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},aC=function(){var e=iC();return function(t,n){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},oC=function(){var e=aC();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},sC={left:0,top:0,right:0,gap:0},cC=function(e){return parseInt(e||``,10)||0},lC=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[cC(n),cC(r),cC(i)]},uC=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return sC;var t=lC(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},dC=oC(),fC=`data-scroll-locked`,pC=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
104
|
+
.${RS} {
|
|
105
105
|
overflow: hidden ${r};
|
|
106
106
|
padding-right: ${s}px ${r};
|
|
107
107
|
}
|
|
108
|
-
body[${
|
|
108
|
+
body[${fC}] {
|
|
109
109
|
overflow: hidden ${r};
|
|
110
110
|
overscroll-behavior: contain;
|
|
111
111
|
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
@@ -118,31 +118,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
118
118
|
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
.${
|
|
121
|
+
.${IS} {
|
|
122
122
|
right: ${s}px ${r};
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
.${
|
|
125
|
+
.${LS} {
|
|
126
126
|
margin-right: ${s}px ${r};
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
.${
|
|
129
|
+
.${IS} .${IS} {
|
|
130
130
|
right: 0 ${r};
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
.${
|
|
133
|
+
.${LS} .${LS} {
|
|
134
134
|
margin-right: 0 ${r};
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
body[${
|
|
138
|
-
${
|
|
137
|
+
body[${fC}] {
|
|
138
|
+
${zS}: ${s}px;
|
|
139
139
|
}
|
|
140
|
-
`},
|
|
140
|
+
`},mC=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},hC=function(){j.useEffect(function(){return document.body.setAttribute(fC,(mC()+1).toString()),function(){var e=mC()-1;e<=0?document.body.removeAttribute(fC):document.body.setAttribute(fC,e.toString())}},[])},gC=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;hC();var a=j.useMemo(function(){return uC(i)},[i]);return j.createElement(dC,{styles:pC(a,!t,i,n?``:`!important`)})},_C=!1;if(typeof window<`u`)try{var vC=Object.defineProperty({},"passive",{get:function(){return _C=!0,!0}});window.addEventListener(`test`,vC,vC),window.removeEventListener(`test`,vC,vC)}catch{_C=!1}var yC=_C?{passive:!1}:!1,bC=function(e){return e.tagName===`TEXTAREA`},xC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!bC(e)&&n[t]===`visible`)},SC=function(e){return xC(e,`overflowY`)},CC=function(e){return xC(e,`overflowX`)},wC=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),DC(e,r)){var i=OC(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},TC=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},EC=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},DC=function(e,t){return e===`v`?SC(t):CC(t)},OC=function(e,t){return e===`v`?TC(t):EC(t)},kC=function(e,t){return e===`h`&&t===`rtl`?-1:1},AC=function(e,t,n,r,i){var a=kC(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=OC(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&DC(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},jC=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},MC=function(e){return[e.deltaX,e.deltaY]},NC=function(e){return e&&`current`in e?e.current:e},PC=function(e,t){return e[0]===t[0]&&e[1]===t[1]},FC=function(e){return`
|
|
141
141
|
.block-interactivity-${e} {pointer-events: none;}
|
|
142
142
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
143
|
-
`},
|
|
143
|
+
`},IC=0,LC=[];function RC(e){var t=j.useRef([]),n=j.useRef([0,0]),r=j.useRef(),i=j.useState(IC++)[0],a=j.useState(oC)[0],o=j.useRef(e);j.useEffect(function(){o.current=e},[e]),j.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=FS([e.lockRef.current],(e.shards||[]).map(NC),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=j.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=jC(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=wC(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=wC(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return AC(h,t,e,h===`h`?s:c,!0)},[]),c=j.useCallback(function(e){var n=e;if(!(!LC.length||LC[LC.length-1]!==a)){var r=`deltaY`in n?MC(n):jC(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&PC(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(NC).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=j.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:zC(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=j.useCallback(function(e){n.current=jC(e),r.current=void 0},[]),d=j.useCallback(function(t){l(t.type,MC(t),t.target,s(t,e.lockRef.current))},[]),f=j.useCallback(function(t){l(t.type,jC(t),t.target,s(t,e.lockRef.current))},[]);j.useEffect(function(){return LC.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,yC),document.addEventListener(`touchmove`,c,yC),document.addEventListener(`touchstart`,u,yC),function(){LC=LC.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,yC),document.removeEventListener(`touchmove`,c,yC),document.removeEventListener(`touchstart`,u,yC)}},[]);var p=e.removeScrollBar,m=e.inert;return j.createElement(j.Fragment,null,m?j.createElement(a,{styles:FC(i)}):null,p?j.createElement(gC,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function zC(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var BC=YS(XS,RC),VC=j.forwardRef(function(e,t){return j.createElement(QS,NS({},e,{ref:t,sideCar:BC}))});VC.classNames=QS.classNames;var HC=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},UC=new WeakMap,WC=new WeakMap,GC={},KC=0,qC=function(e){return e&&(e.host||qC(e.parentNode))},JC=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=qC(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},YC=function(e,t,n,r){var i=JC(t,Array.isArray(e)?e:[e]);GC[n]||(GC[n]=new WeakMap);var a=GC[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(UC.get(e)||0)+1,l=(a.get(e)||0)+1;UC.set(e,c),a.set(e,l),o.push(e),c===1&&i&&WC.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),KC++,function(){o.forEach(function(e){var t=UC.get(e)-1,i=a.get(e)-1;UC.set(e,t),a.set(e,i),t||(WC.has(e)||e.removeAttribute(r),WC.delete(e)),i||e.removeAttribute(n)}),KC--,KC||(UC=new WeakMap,UC=new WeakMap,WC=new WeakMap,GC={})}},XC=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||HC(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),YC(r,i,n,`aria-hidden`)):function(){return null}},ZC=`Dialog`,[QC,$C]=m_(ZC),[ew,tw]=QC(ZC),nw=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=j.useRef(null),c=j.useRef(null),[l,u]=Q_({prop:r,defaultProp:i??!1,onChange:a,caller:ZC});return(0,M.jsx)(ew,{scope:t,triggerRef:s,contentRef:c,contentId:pS(),titleId:pS(),descriptionId:pS(),open:l,onOpenChange:u,onOpenToggle:j.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};nw.displayName=ZC;var rw=`DialogTrigger`,iw=j.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=tw(rw,n),a=f_(t,i.triggerRef);return(0,M.jsx)(w_.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ww(i.open),...r,ref:a,onClick:q(e.onClick,i.onOpenToggle)})});iw.displayName=rw;var aw=`DialogPortal`,[ow,sw]=QC(aw,{forceMount:void 0}),cw=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=tw(aw,t);return(0,M.jsx)(ow,{scope:t,forceMount:n,children:j.Children.map(r,e=>(0,M.jsx)(q_,{present:n||a.open,children:(0,M.jsx)(G_,{asChild:!0,container:i,children:e})}))})};cw.displayName=aw;var lw=`DialogOverlay`,uw=j.forwardRef((e,t)=>{let n=sw(lw,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=tw(lw,e.__scopeDialog);return a.modal?(0,M.jsx)(q_,{present:r||a.open,children:(0,M.jsx)(fw,{...i,ref:t})}):null});uw.displayName=lw;var dw=g_(`DialogOverlay.RemoveScroll`),fw=j.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=tw(lw,n);return(0,M.jsx)(VC,{as:dw,allowPinchZoom:!0,shards:[i.contentRef],children:(0,M.jsx)(w_.div,{"data-state":ww(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),pw=`DialogContent`,mw=j.forwardRef((e,t)=>{let n=sw(pw,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=tw(pw,e.__scopeDialog);return(0,M.jsx)(q_,{present:r||a.open,children:a.modal?(0,M.jsx)(hw,{...i,ref:t}):(0,M.jsx)(gw,{...i,ref:t})})});mw.displayName=pw;var hw=j.forwardRef((e,t)=>{let n=tw(pw,e.__scopeDialog),r=j.useRef(null),i=f_(t,n.contentRef,r);return j.useEffect(()=>{let e=r.current;if(e)return XC(e)},[]),(0,M.jsx)(_w,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:q(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault())})}),gw=j.forwardRef((e,t)=>{let n=tw(pw,e.__scopeDialog),r=j.useRef(!1),i=j.useRef(!1);return(0,M.jsx)(_w,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),_w=j.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=tw(pw,n),c=j.useRef(null),l=f_(t,c);return jS(),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(vS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,M.jsx)(P_,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ww(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Ow,{titleId:s.titleId}),(0,M.jsx)(Aw,{contentRef:c,descriptionId:s.descriptionId})]})]})}),vw=`DialogTitle`,yw=j.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=tw(vw,n);return(0,M.jsx)(w_.h2,{id:i.titleId,...r,ref:t})});yw.displayName=vw;var bw=`DialogDescription`,xw=j.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=tw(bw,n);return(0,M.jsx)(w_.p,{id:i.descriptionId,...r,ref:t})});xw.displayName=bw;var Sw=`DialogClose`,Cw=j.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=tw(Sw,n);return(0,M.jsx)(w_.button,{type:`button`,...r,ref:t,onClick:q(e.onClick,()=>i.onOpenChange(!1))})});Cw.displayName=Sw;function ww(e){return e?`open`:`closed`}var Tw=`DialogTitleWarning`,[Ew,Dw]=p_(Tw,{contentName:pw,titleName:vw,docsSlug:`dialog`}),Ow=({titleId:e})=>{let t=Dw(Tw),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
144
144
|
|
|
145
145
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
146
146
|
|
|
147
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Dw=`DialogDescriptionWarning`,Ow=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Tw(Dw).contentName}}.`;return j.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},kw=ew,Aw=ow,jw=cw,Mw=fw,Nw=_w,Pw=yw,Fw=xw,Iw=kw,Lw=Aw,Rw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(jw,{className:Z(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Rw.displayName=jw.displayName;var zw=ry(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Bw=j.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,M.jsxs)(Lw,{children:[(0,M.jsx)(Rw,{}),(0,M.jsxs)(Mw,{ref:i,className:Z(zw({side:e}),t),...r,children:[n,(0,M.jsxs)(Fw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,M.jsx)(ib,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Bw.displayName=Mw.displayName;var Vw=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Vw.displayName=`SheetHeader`;var Hw=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Hw.displayName=`SheetFooter`;var Uw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Nw,{ref:n,className:Z(`text-lg font-semibold text-foreground`,e),...t}));Uw.displayName=Nw.displayName;var Ww=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Pw,{ref:n,className:Z(`text-sm text-muted-foreground`,e),...t}));Ww.displayName=Pw.displayName;function Gw({className:e,...t}){return(0,M.jsx)(`div`,{className:Z(`bg-muted animate-pulse rounded-md`,e),...t})}var Kw=[`top`,`right`,`bottom`,`left`],qw=Math.min,Jw=Math.max,Yw=Math.round,Xw=Math.floor,Zw=e=>({x:e,y:e}),Qw={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function $w(e,t,n){return Jw(e,qw(t,n))}function eT(e,t){return typeof e==`function`?e(t):e}function tT(e){return e.split(`-`)[0]}function nT(e){return e.split(`-`)[1]}function rT(e){return e===`x`?`y`:`x`}function iT(e){return e===`y`?`height`:`width`}function aT(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function oT(e){return rT(aT(e))}function sT(e,t,n){n===void 0&&(n=!1);let r=nT(e),i=oT(e),a=iT(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=gT(o)),[o,gT(o)]}function cT(e){let t=gT(e);return[lT(e),t,lT(t)]}function lT(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var uT=[`left`,`right`],dT=[`right`,`left`],fT=[`top`,`bottom`],pT=[`bottom`,`top`];function mT(e,t,n){switch(e){case`top`:case`bottom`:return n?t?dT:uT:t?uT:dT;case`left`:case`right`:return t?fT:pT;default:return[]}}function hT(e,t,n,r){let i=nT(e),a=mT(tT(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(lT)))),a}function gT(e){let t=tT(e);return Qw[t]+e.slice(t.length)}function _T(e){return{top:0,right:0,bottom:0,left:0,...e}}function vT(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:_T(e)}function yT(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function bT(e,t,n){let{reference:r,floating:i}=e,a=aT(t),o=oT(t),s=iT(o),c=tT(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(nT(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function xT(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=eT(t,e),p=vT(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=yT(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=yT(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ST=50,CT=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:xT},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=bT(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ST&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=bT(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},wT=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=eT(e,t)||{};if(l==null)return{};let d=vT(u),f={x:n,y:r},p=oT(i),m=iT(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=qw(d[_],T),D=qw(d[v],T),O=E,ee=C-h[m]-D,te=C/2-h[m]/2+w,ne=$w(O,te,ee),re=!c.arrow&&nT(i)!=null&&te!==ne&&a.reference[m]/2-(te<O?E:D)-h[m]/2<0,ie=re?te<O?te-O:te-ee:0;return{[p]:f[p]+ie,data:{[p]:ne,centerOffset:te-ne-ie,...re&&{alignmentOffset:ie}},reset:re}}}),TT=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=eT(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=tT(r),_=aT(o),v=tT(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[gT(o)]:cT(o)),x=p!==`none`;!d&&x&&b.push(...hT(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=sT(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==aT(t))||T.every(e=>aT(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=aT(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ET(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function DT(e){return Kw.some(t=>e[t]>=0)}var OT=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=eT(e,t);switch(i){case`referenceHidden`:{let e=ET(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:DT(e)}}}case`escaped`:{let e=ET(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:DT(e)}}}default:return{}}}}},kT=new Set([`left`,`top`]);async function AT(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=tT(n),s=nT(n),c=aT(n)===`y`,l=kT.has(o)?-1:1,u=a&&c?-1:1,d=eT(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var jT=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await AT(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},MT=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=eT(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=aT(tT(i)),p=rT(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=$w(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=$w(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},NT=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=eT(e,t),u={x:n,y:r},d=aT(i),f=rT(d),p=u[f],m=u[d],h=eT(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=kT.has(tT(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},PT=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=eT(e,t),u=await o.detectOverflow(t,l),d=tT(i),f=nT(i),p=aT(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=qw(h-u[g],v),x=qw(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Jw(u.left,0),t=Jw(u.right,0),n=Jw(u.top,0),r=Jw(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Jw(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Jw(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function FT(){return typeof window<`u`}function IT(e){return zT(e)?(e.nodeName||``).toLowerCase():`#document`}function LT(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function RT(e){return((zT(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function zT(e){return FT()?e instanceof Node||e instanceof LT(e).Node:!1}function BT(e){return FT()?e instanceof Element||e instanceof LT(e).Element:!1}function VT(e){return FT()?e instanceof HTMLElement||e instanceof LT(e).HTMLElement:!1}function HT(e){return!FT()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof LT(e).ShadowRoot}function UT(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=eE(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function WT(e){return/^(table|td|th)$/.test(IT(e))}function GT(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var KT=/transform|translate|scale|rotate|perspective|filter/,qT=/paint|layout|strict|content/,JT=e=>!!e&&e!==`none`,YT;function XT(e){let t=BT(e)?eE(e):e;return JT(t.transform)||JT(t.translate)||JT(t.scale)||JT(t.rotate)||JT(t.perspective)||!QT()&&(JT(t.backdropFilter)||JT(t.filter))||KT.test(t.willChange||``)||qT.test(t.contain||``)}function ZT(e){let t=nE(e);for(;VT(t)&&!$T(t);){if(XT(t))return t;if(GT(t))return null;t=nE(t)}return null}function QT(){return YT??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),YT}function $T(e){return/^(html|body|#document)$/.test(IT(e))}function eE(e){return LT(e).getComputedStyle(e)}function tE(e){return BT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nE(e){if(IT(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||HT(e)&&e.host||RT(e);return HT(t)?t.host:t}function rE(e){let t=nE(e);return $T(t)?e.ownerDocument?e.ownerDocument.body:e.body:VT(t)&&UT(t)?t:rE(t)}function iE(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=rE(e),i=r===e.ownerDocument?.body,a=LT(r);if(i){let e=aE(a);return t.concat(a,a.visualViewport||[],UT(r)?r:[],e&&n?iE(e):[])}else return t.concat(r,iE(r,[],n))}function aE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oE(e){let t=eE(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=VT(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Yw(n)!==a||Yw(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function sE(e){return BT(e)?e:e.contextElement}function cE(e){let t=sE(e);if(!VT(t))return Zw(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=oE(t),o=(a?Yw(n.width):n.width)/r,s=(a?Yw(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var lE=Zw(0);function uE(e){let t=LT(e);return!QT()||!t.visualViewport?lE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==LT(e)?!1:t}function fE(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=sE(e),o=Zw(1);t&&(r?BT(r)&&(o=cE(r)):o=cE(e));let s=dE(a,n,r)?uE(a):Zw(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=LT(a),t=r&&BT(r)?LT(r):r,n=e,i=aE(n);for(;i&&r&&t!==n;){let e=cE(i),t=i.getBoundingClientRect(),r=eE(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=LT(i),i=aE(n)}}return yT({width:u,height:d,x:c,y:l})}function pE(e,t){let n=tE(e).scrollLeft;return t?t.left+n:fE(RT(e)).left+n}function mE(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-pE(e,n),y:n.top+t.scrollTop}}function hE(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=RT(r),s=t?GT(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Zw(1),u=Zw(0),d=VT(r);if((d||!d&&!a)&&((IT(r)!==`body`||UT(o))&&(c=tE(r)),d)){let e=fE(r);l=cE(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?mE(o,c):Zw(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function gE(e){return Array.from(e.getClientRects())}function _E(e){let t=RT(e),n=tE(e),r=e.ownerDocument.body,i=Jw(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Jw(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+pE(e),s=-n.scrollTop;return eE(r).direction===`rtl`&&(o+=Jw(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var vE=25;function yE(e,t){let n=LT(e),r=RT(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=QT();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=pE(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=vE&&(a-=o)}else l<=vE&&(a+=l);return{width:a,height:o,x:s,y:c}}function bE(e,t){let n=fE(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=VT(e)?cE(e):Zw(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function xE(e,t,n){let r;if(t===`viewport`)r=yE(e,n);else if(t===`document`)r=_E(RT(e));else if(BT(t))r=bE(t,n);else{let n=uE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return yT(r)}function SE(e,t){let n=nE(e);return n===t||!BT(n)||$T(n)?!1:eE(n).position===`fixed`||SE(n,t)}function CE(e,t){let n=t.get(e);if(n)return n;let r=iE(e,[],!1).filter(e=>BT(e)&&IT(e)!==`body`),i=null,a=eE(e).position===`fixed`,o=a?nE(e):e;for(;BT(o)&&!$T(o);){let t=eE(o),n=XT(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||UT(o)&&!n&&SE(e,o))?r=r.filter(e=>e!==o):i=t,o=nE(o)}return t.set(e,r),r}function wE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?GT(t)?[]:CE(t,this._c):[].concat(n),r],o=xE(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=xE(t,a[e],i);s=Jw(n.top,s),c=qw(n.right,c),l=qw(n.bottom,l),u=Jw(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function TE(e){let{width:t,height:n}=oE(e);return{width:t,height:n}}function EE(e,t,n){let r=VT(t),i=RT(t),a=n===`fixed`,o=fE(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Zw(0);function l(){c.x=pE(i)}if(r||!r&&!a)if((IT(t)!==`body`||UT(i))&&(s=tE(t)),r){let e=fE(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?mE(i,s):Zw(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function DE(e){return eE(e).position===`static`}function OE(e,t){if(!VT(e)||eE(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return RT(e)===n&&(n=n.ownerDocument.body),n}function kE(e,t){let n=LT(e);if(GT(e))return n;if(!VT(e)){let t=nE(e);for(;t&&!$T(t);){if(BT(t)&&!DE(t))return t;t=nE(t)}return n}let r=OE(e,t);for(;r&&WT(r)&&DE(r);)r=OE(r,t);return r&&$T(r)&&DE(r)&&!XT(r)?n:r||ZT(e)||n}var AE=async function(e){let t=this.getOffsetParent||kE,n=this.getDimensions,r=await n(e.floating);return{reference:EE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function jE(e){return eE(e).direction===`rtl`}var ME={convertOffsetParentRelativeRectToViewportRelativeRect:hE,getDocumentElement:RT,getClippingRect:wE,getOffsetParent:kE,getElementRects:AE,getClientRects:gE,getDimensions:TE,getScale:cE,isElement:BT,isRTL:jE};function NE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function PE(e,t){let n=null,r,i=RT(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Xw(d),h=Xw(i.clientWidth-(u+f)),g=Xw(i.clientHeight-(d+p)),_=Xw(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Jw(0,qw(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!NE(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function FE(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=sE(e),u=i||a?[...l?iE(l):[],...t?iE(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?PE(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?fE(e):null;c&&g();function g(){let t=fE(e);h&&!NE(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var IE=jT,LE=MT,RE=TT,zE=PT,BE=OT,VE=wT,HE=NT,UE=(e,t,n)=>{let r=new Map,i={platform:ME,...n},a={...i.platform,_c:r};return CT(e,t,{...i,platform:a})},WE=typeof document<`u`?j.useLayoutEffect:function(){};function GE(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!GE(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!GE(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function KE(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qE(e,t){let n=KE(e);return Math.round(t*n)/n}function JE(e){let t=j.useRef(e);return WE(()=>{t.current=e}),t}function YE(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=j.useState(r);GE(f,r)||p(r);let[m,h]=j.useState(null),[g,_]=j.useState(null),v=j.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=j.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=j.useRef(null),C=j.useRef(null),w=j.useRef(u),T=c!=null,E=JE(c),D=JE(i),O=JE(l),ee=j.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),UE(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};te.current&&!GE(w.current,t)&&(w.current=t,Gi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);WE(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=j.useRef(!1);WE(()=>(te.current=!0,()=>{te.current=!1}),[]),WE(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let ne=j.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),re=j.useMemo(()=>({reference:b,floating:x}),[b,x]),ie=j.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=qE(re.floating,u.x),r=qE(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...KE(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:ee,refs:ne,elements:re,floatingStyles:ie}),[u,ee,ne,re,ie])}var XE=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:VE({element:r.current,padding:i}).fn(n):r?VE({element:r,padding:i}).fn(n):{}}}},ZE=(e,t)=>{let n=IE(e);return{name:n.name,fn:n.fn,options:[e,t]}},QE=(e,t)=>{let n=LE(e);return{name:n.name,fn:n.fn,options:[e,t]}},$E=(e,t)=>({fn:HE(e).fn,options:[e,t]}),eD=(e,t)=>{let n=RE(e);return{name:n.name,fn:n.fn,options:[e,t]}},tD=(e,t)=>{let n=zE(e);return{name:n.name,fn:n.fn,options:[e,t]}},nD=(e,t)=>{let n=BE(e);return{name:n.name,fn:n.fn,options:[e,t]}},rD=(e,t)=>{let n=XE(e);return{name:n.name,fn:n.fn,options:[e,t]}},iD=`Arrow`,aD=j.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,M.jsx)(C_.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,M.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});aD.displayName=iD;var oD=aD;function sD(e){let[t,n]=j.useState(void 0);return H_(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var cD=`Popper`,[lD,uD]=p_(cD),[dD,fD]=lD(cD),pD=e=>{let{__scopePopper:t,children:n}=e,[r,i]=j.useState(null);return(0,M.jsx)(dD,{scope:t,anchor:r,onAnchorChange:i,children:n})};pD.displayName=cD;var mD=`PopperAnchor`,hD=j.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=fD(mD,n),o=j.useRef(null),s=d_(t,o),c=j.useRef(null);return j.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,M.jsx)(C_.div,{...i,ref:s})});hD.displayName=mD;var gD=`PopperContent`,[_D,vD]=lD(gD),yD=j.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=fD(gD,n),[_,v]=j.useState(null),y=d_(t,e=>v(e)),[b,x]=j.useState(null),S=sD(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(CD),altBoundary:O},{refs:te,floatingStyles:ne,placement:re,isPositioned:ie,middlewareData:ae}=YE({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>FE(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[ZE({mainAxis:i+w,alignmentAxis:o}),c&&QE({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?$E():void 0,...ee}),c&&eD({...ee}),tD({...ee,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&rD({element:b,padding:s}),wD({arrowWidth:C,arrowHeight:w}),f&&nD({strategy:`referenceHidden`,...ee})]}),[oe,k]=TD(re),se=T_(m);H_(()=>{ie&&se?.()},[ie,se]);let ce=ae.arrow?.x,le=ae.arrow?.y,ue=ae.arrow?.centerOffset!==0,[A,de]=j.useState();return H_(()=>{_&&de(window.getComputedStyle(_).zIndex)},[_]),(0,M.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ie?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:A,"--radix-popper-transform-origin":[ae.transformOrigin?.x,ae.transformOrigin?.y].join(` `),...ae.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,M.jsx)(_D,{scope:n,placedSide:oe,onArrowChange:x,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,M.jsx)(C_.div,{"data-side":oe,"data-align":k,...h,ref:y,style:{...h.style,animation:ie?void 0:`none`}})})})});yD.displayName=gD;var bD=`PopperArrow`,xD={top:`bottom`,right:`left`,bottom:`top`,left:`right`},SD=j.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=vD(bD,n),a=xD[i.placedSide];return(0,M.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,M.jsx)(oD,{...r,ref:t,style:{...r.style,display:`block`}})})});SD.displayName=bD;function CD(e){return e!==null}var wD=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=TD(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function TD(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ED=pD,DD=hD,OD=yD,kD=SD,[AD,jD]=p_(`Tooltip`,[uD]),MD=uD(),ND=`TooltipProvider`,PD=700,FD=`tooltip.open`,[ID,LD]=AD(ND),RD=e=>{let{__scopeTooltip:t,delayDuration:n=PD,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=j.useRef(!0),s=j.useRef(!1),c=j.useRef(0);return j.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,M.jsx)(ID,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:j.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:j.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:j.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};RD.displayName=ND;var zD=`Tooltip`,[BD,VD]=AD(zD),HD=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=LD(zD,e.__scopeTooltip),l=MD(t),[u,d]=j.useState(null),f=dS(),p=j.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=j.useRef(!1),[_,v]=Z_({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(FD))):c.onClose(),a?.(e)},caller:zD}),y=j.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=j.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return j.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,M.jsx)(ED,{...l,children:(0,M.jsx)(BD,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:j.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:j.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};HD.displayName=zD;var UD=`TooltipTrigger`,WD=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=VD(UD,n),a=LD(UD,n),o=MD(n),s=d_(t,j.useRef(null),i.onTriggerChange),c=j.useRef(!1),l=j.useRef(!1),u=j.useCallback(()=>c.current=!1,[]);return j.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,M.jsx)(DD,{asChild:!0,...o,children:(0,M.jsx)(C_.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:q(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:q(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:q(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:q(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:q(e.onBlur,i.onClose),onClick:q(e.onClick,i.onClose)})})});WD.displayName=UD;var GD=`TooltipPortal`,[KD,qD]=AD(GD,{forceMount:void 0}),JD=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=VD(GD,t);return(0,M.jsx)(KD,{scope:t,forceMount:n,children:(0,M.jsx)(K_,{present:n||a.open,children:(0,M.jsx)(W_,{asChild:!0,container:i,children:r})})})};JD.displayName=GD;var YD=`TooltipContent`,XD=j.forwardRef((e,t)=>{let n=qD(YD,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=VD(YD,e.__scopeTooltip);return(0,M.jsx)(K_,{present:r||o.open,children:o.disableHoverableContent?(0,M.jsx)(tO,{side:i,...a,ref:t}):(0,M.jsx)(ZD,{side:i,...a,ref:t})})}),ZD=j.forwardRef((e,t)=>{let n=VD(YD,e.__scopeTooltip),r=LD(YD,e.__scopeTooltip),i=j.useRef(null),a=d_(t,i),[o,s]=j.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=j.useCallback(()=>{s(null),d(!1)},[d]),p=j.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=aO(r,iO(r,n.getBoundingClientRect())),a=oO(t.getBoundingClientRect());s(cO([...i,...a])),d(!0)},[d]);return j.useEffect(()=>()=>f(),[f]),j.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),j.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!sO(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,M.jsx)(tO,{...e,ref:a})}),[QD,$D]=AD(zD,{isInside:!1}),eO=v_(`TooltipContent`),tO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=VD(YD,n),l=MD(n),{onClose:u}=c;return j.useEffect(()=>(document.addEventListener(FD,u),()=>document.removeEventListener(FD,u)),[u]),j.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,M.jsx)(N_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,M.jsxs)(OD,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,M.jsx)(eO,{children:r}),(0,M.jsx)(QD,{scope:n,isInside:!0,children:(0,M.jsx)(rv,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});XD.displayName=YD;var nO=`TooltipArrow`,rO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=MD(n);return $D(nO,n).isInside?null:(0,M.jsx)(kD,{...i,...r,ref:t})});rO.displayName=nO;function iO(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function aO(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function oO(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function sO(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cO(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),lO(t)}function lO(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var uO=RD,dO=HD,fO=WD,pO=XD,mO=uO,hO=dO,gO=fO,_O=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(pO,{ref:r,sideOffset:t,className:Z(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));_O.displayName=pO.displayName;var vO=`sidebar_state`,yO=3600*24*7,bO=`16rem`,xO=`18rem`,SO=`3rem`,CO=`b`,wO=j.createContext(null);function TO(){let e=j.useContext(wO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider`);return e}var EO=j.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=Qx(),[l,u]=j.useState(!1),[d,f]=j.useState(e),p=t??d,m=j.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${vO}=${t}; path=/; max-age=${yO}`},[n,p]),h=j.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);j.useEffect(()=>{let e=e=>{e.key===CO&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=j.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,M.jsx)(wO.Provider,{value:_,children:(0,M.jsx)(mO,{delayDuration:0,children:(0,M.jsx)(`div`,{style:{"--sidebar-width":bO,"--sidebar-width-icon":SO,...i},className:Z(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-0 w-full`,r),ref:s,...o,children:a})})})});EO.displayName=`SidebarProvider`;var DO=j.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},o)=>{let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=TO();return n===`none`?(0,M.jsx)(`div`,{className:Z(`bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col`,r),ref:o,...a,children:i}):s?(0,M.jsx)(Iw,{open:l,onOpenChange:u,...a,children:(0,M.jsx)(Bw,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden`,style:{"--sidebar-width":xO},side:e,children:(0,M.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})})}):(0,M.jsx)(`div`,{ref:o,className:Z(`bg-sidebar text-sidebar-foreground hidden md:flex h-svh w-[var(--sidebar-width)] shrink-0 flex-col border-r transition-[width] duration-200 ease-linear overflow-hidden`,c===`collapsed`&&n===`offcanvas`&&`w-0 border-0`,c===`collapsed`&&n===`icon`&&`w-[var(--sidebar-width-icon)]`,r),"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,...a,children:i})});DO.displayName=`Sidebar`;var OO=j.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=TO();return(0,M.jsxs)(Q,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:Z(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,M.jsx)(By,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});OO.displayName=`SidebarTrigger`;var kO=j.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=TO();return(0,M.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:Z(`hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});kO.displayName=`SidebarRail`;var AO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`main`,{ref:n,className:Z(`relative flex min-h-svh flex-1 flex-col bg-background`,`peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));AO.displayName=`SidebarInset`;var jO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(eS,{ref:n,"data-sidebar":`input`,className:Z(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));jO.displayName=`SidebarInput`;var MO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:Z(`flex flex-col gap-2 p-2`,e),...t}));MO.displayName=`SidebarHeader`;var NO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:Z(`flex flex-col gap-2 p-2`,e),...t}));NO.displayName=`SidebarFooter`;var PO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(cS,{ref:n,"data-sidebar":`separator`,className:Z(`mx-2 w-auto bg-sidebar-border`,e),...t}));PO.displayName=`SidebarSeparator`;var FO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:Z(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,e),...t}));FO.displayName=`SidebarContent`;var IO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:Z(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));IO.displayName=`SidebarGroup`;var LO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?Gx:`div`,{ref:r,"data-sidebar":`group-label`,className:Z(`text-xs/6 font-medium text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 [[data-collapsible=icon]_&]:-mt-8 [[data-collapsible=icon]_&]:opacity-0 [[data-collapsible=icon]_&]:overflow-hidden`,e),...n}));LO.displayName=`SidebarGroupLabel`;var RO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?Gx:`button`,{ref:r,"data-sidebar":`group-action`,className:Z(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));RO.displayName=`SidebarGroupAction`;var zO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:Z(`w-full text-sm`,e),...t}));zO.displayName=`SidebarGroupContent`;var BO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:Z(`flex w-full min-w-0 flex-col gap-1`,e),...t}));BO.displayName=`SidebarMenu`;var VO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:Z(`group/menu-item relative`,e),...t}));VO.displayName=`SidebarMenuItem`;var HO=j.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?Gx:`button`,{isMobile:l,state:u}=TO(),d=(0,M.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:Z(UO({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,M.jsxs)(hO,{children:[(0,M.jsx)(gO,{asChild:!0,children:d}),(0,M.jsx)(_O,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});HO.displayName=`SidebarMenuButton`;var UO=ry(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),WO=j.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,M.jsx)(t?Gx:`button`,{ref:i,"data-sidebar":`menu-action`,className:Z(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));WO.displayName=`SidebarMenuAction`;var GO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:Z(`text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));GO.displayName=`SidebarMenuBadge`;var KO=j.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=j.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,M.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:Z(`rounded-md h-8 flex gap-2 px-2 items-center`,e),...n,children:[t&&(0,M.jsx)(Gw,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,M.jsx)(Gw,{className:`h-4 flex-1 max-w-[var(--skeleton-width)]`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});KO.displayName=`SidebarMenuSkeleton`;var qO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:Z(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));qO.displayName=`SidebarMenuSub`;var JO=j.forwardRef(({...e},t)=>(0,M.jsx)(`li`,{ref:t,...e}));JO.displayName=`SidebarMenuSubItem`;var YO=j.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,M.jsx)(e?Gx:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:Z(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,r),...i}));YO.displayName=`SidebarMenuSubButton`;var XO=ry(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`),ZO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`nav`,{ref:n,"aria-label":`breadcrumb`,className:Z(XO(),e),...t}));ZO.displayName=`Breadcrumb`;var QO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ol`,{ref:n,className:Z(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`,e),...t}));QO.displayName=`BreadcrumbList`;var $O=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,className:Z(`inline-flex items-center gap-1.5`,e),...t}));$O.displayName=`BreadcrumbItem`;var ek=j.forwardRef(({asChild:e,className:t,...n},r)=>(0,M.jsx)(e?Gx:`a`,{ref:r,className:Z(`hover:text-foreground transition-colors`,t),...n}));ek.displayName=`BreadcrumbLink`;var tk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:Z(`text-foreground font-normal`,e),...t}));tk.displayName=`BreadcrumbPage`;var nk=({children:e,className:t,...n})=>(0,M.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:Z(`[&>svg]:size-3.5`,t),...n,children:e??(0,M.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:(0,M.jsx)(`path`,{d:`m9 18 6-6-6-6`})})});nk.displayName=`BreadcrumbSeparator`;var rk=({className:e,...t})=>(0,M.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:Z(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,M.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`})]}),(0,M.jsx)(`span`,{className:`sr-only`,children:`More`})]});rk.displayName=`BreadcrumbElipssis`;var ik=j.createContext(void 0);function ak(e){let t=j.useContext(ik);return e||t||`ltr`}var ok=`rovingFocusGroup.onEntryFocus`,sk={bubbles:!1,cancelable:!0},ck=`RovingFocusGroup`,[lk,uk,dk]=S_(ck),[fk,pk]=p_(ck,[dk]),[mk,hk]=fk(ck),gk=j.forwardRef((e,t)=>(0,M.jsx)(lk.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(lk.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(_k,{...e,ref:t})})}));gk.displayName=ck;var _k=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=j.useRef(null),p=d_(t,f),m=ak(a),[h,g]=Z_({prop:o,defaultProp:s??null,onChange:c,caller:ck}),[_,v]=j.useState(!1),y=T_(l),b=uk(n),x=j.useRef(!1),[S,C]=j.useState(0);return j.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(ok,y),()=>e.removeEventListener(ok,y)},[y]),(0,M.jsx)(mk,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:j.useCallback(e=>g(e),[g]),onItemShiftTab:j.useCallback(()=>v(!0),[]),onFocusableItemAdd:j.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:j.useCallback(()=>C(e=>e-1),[]),children:(0,M.jsx)(C_.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:q(e.onMouseDown,()=>{x.current=!0}),onFocus:q(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(ok,sk);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Ck([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:q(e.onBlur,()=>v(!1))})})}),vk=`RovingFocusGroupItem`,yk=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=dS(),l=a||c,u=hk(vk,n),d=u.currentTabStopId===l,f=uk(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return j.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,M.jsx)(lk.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,M.jsx)(C_.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:q(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:q(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:q(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Sk(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?wk(n,r+1):n.slice(r+1)}setTimeout(()=>Ck(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});yk.displayName=vk;var bk={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function xk(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Sk(e,t,n){let r=xk(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return bk[r]}function Ck(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function wk(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Tk=gk,Ek=yk,Dk=[`Enter`,` `],Ok=[`ArrowDown`,`PageUp`,`Home`],kk=[`ArrowUp`,`PageDown`,`End`],Ak=[...Ok,...kk],jk={ltr:[...Dk,`ArrowRight`],rtl:[...Dk,`ArrowLeft`]},Mk={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Nk=`Menu`,[Pk,Fk,Ik]=S_(Nk),[Lk,Rk]=p_(Nk,[Ik,uD,pk]),zk=uD(),Bk=pk(),[Vk,Hk]=Lk(Nk),[Uk,Wk]=Lk(Nk),Gk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=zk(t),[c,l]=j.useState(null),u=j.useRef(!1),d=T_(a),f=ak(i);return j.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,M.jsx)(ED,{...s,children:(0,M.jsx)(Vk,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,M.jsx)(Uk,{scope:t,onClose:j.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};Gk.displayName=Nk;var Kk=`MenuAnchor`,qk=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=zk(n);return(0,M.jsx)(DD,{...i,...r,ref:t})});qk.displayName=Kk;var Jk=`MenuPortal`,[Yk,Xk]=Lk(Jk,{forceMount:void 0}),Zk=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Hk(Jk,t);return(0,M.jsx)(Yk,{scope:t,forceMount:n,children:(0,M.jsx)(K_,{present:n||a.open,children:(0,M.jsx)(W_,{asChild:!0,container:i,children:r})})})};Zk.displayName=Jk;var Qk=`MenuContent`,[$k,eA]=Lk(Qk),tA=j.forwardRef((e,t)=>{let n=Xk(Qk,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Hk(Qk,e.__scopeMenu),o=Wk(Qk,e.__scopeMenu);return(0,M.jsx)(Pk.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(K_,{present:r||a.open,children:(0,M.jsx)(Pk.Slot,{scope:e.__scopeMenu,children:o.modal?(0,M.jsx)(nA,{...i,ref:t}):(0,M.jsx)(rA,{...i,ref:t})})})})}),nA=j.forwardRef((e,t)=>{let n=Hk(Qk,e.__scopeMenu),r=j.useRef(null),i=d_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return JC(e)},[]),(0,M.jsx)(aA,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),rA=j.forwardRef((e,t)=>{let n=Hk(Qk,e.__scopeMenu);return(0,M.jsx)(aA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),iA=h_(`MenuContent.ScrollLock`),aA=j.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Hk(Qk,n),_=Wk(Qk,n),v=zk(n),y=Bk(n),b=Fk(n),[x,S]=j.useState(null),C=j.useRef(null),w=d_(t,C,g.onContentChange),T=j.useRef(0),E=j.useRef(``),D=j.useRef(0),O=j.useRef(null),ee=j.useRef(`right`),te=j.useRef(0),ne=m?zC:j.Fragment,re=m?{as:iA,allowPinchZoom:!0}:void 0,ie=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=UA(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};j.useEffect(()=>()=>window.clearTimeout(T.current),[]),kS();let ae=j.useCallback(e=>ee.current===O.current?.side&&GA(e,O.current?.area),[]);return(0,M.jsx)($k,{scope:n,searchRef:E,onItemEnter:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:j.useCallback(e=>{ae(e)||(C.current?.focus(),S(null))},[ae]),onTriggerLeave:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:D,onPointerGraceIntentChange:j.useCallback(e=>{O.current=e},[]),children:(0,M.jsx)(ne,{...re,children:(0,M.jsx)(gS,{asChild:!0,trapped:i,onMountAutoFocus:q(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,M.jsx)(N_,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,M.jsx)(Tk,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:q(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,M.jsx)(OD,{role:`menu`,"aria-orientation":`vertical`,"data-state":RA(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:q(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=C.current;if(e.target!==i||!Ak.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);kk.includes(e.key)&&a.reverse(),VA(a)}),onBlur:q(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:q(e.onPointerMove,KA(e=>{let t=e.target,n=te.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ee.current=e.clientX>te.current?`right`:`left`,te.current=e.clientX)}))})})})})})})});tA.displayName=Qk;var oA=`MenuGroup`,sA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(C_.div,{role:`group`,...r,ref:t})});sA.displayName=oA;var cA=`MenuLabel`,lA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(C_.div,{...r,ref:t})});lA.displayName=cA;var uA=`MenuItem`,dA=`menu.itemSelect`,fA=j.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=j.useRef(null),o=Wk(uA,e.__scopeMenu),s=eA(uA,e.__scopeMenu),c=d_(t,a),l=j.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(dA,{bubbles:!0,cancelable:!0});e.addEventListener(dA,e=>r?.(e),{once:!0}),w_(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,M.jsx)(pA,{...i,ref:c,disabled:n,onClick:q(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:q(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:q(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Dk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});fA.displayName=uA;var pA=j.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=eA(uA,n),s=Bk(n),c=j.useRef(null),l=d_(t,c),[u,d]=j.useState(!1),[f,p]=j.useState(``);return j.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,M.jsx)(Pk.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,M.jsx)(Ek,{asChild:!0,...s,focusable:!r,children:(0,M.jsx)(C_.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:q(e.onPointerMove,KA(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,KA(e=>o.onItemLeave(e))),onFocus:q(e.onFocus,()=>d(!0)),onBlur:q(e.onBlur,()=>d(!1))})})})}),mA=`MenuCheckboxItem`,hA=j.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,M.jsx)(CA,{scope:e.__scopeMenu,checked:n,children:(0,M.jsx)(fA,{role:`menuitemcheckbox`,"aria-checked":zA(n)?`mixed`:n,...i,ref:t,"data-state":BA(n),onSelect:q(i.onSelect,()=>r?.(zA(n)?!0:!n),{checkForDefaultPrevented:!1})})})});hA.displayName=mA;var gA=`MenuRadioGroup`,[_A,vA]=Lk(gA,{value:void 0,onValueChange:()=>{}}),yA=j.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=T_(r);return(0,M.jsx)(_A,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,M.jsx)(sA,{...i,ref:t})})});yA.displayName=gA;var bA=`MenuRadioItem`,xA=j.forwardRef((e,t)=>{let{value:n,...r}=e,i=vA(bA,e.__scopeMenu),a=n===i.value;return(0,M.jsx)(CA,{scope:e.__scopeMenu,checked:a,children:(0,M.jsx)(fA,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":BA(a),onSelect:q(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});xA.displayName=bA;var SA=`MenuItemIndicator`,[CA,wA]=Lk(SA,{checked:!1}),TA=j.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=wA(SA,n);return(0,M.jsx)(K_,{present:r||zA(a.checked)||a.checked===!0,children:(0,M.jsx)(C_.span,{...i,ref:t,"data-state":BA(a.checked)})})});TA.displayName=SA;var EA=`MenuSeparator`,DA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(C_.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});DA.displayName=EA;var OA=`MenuArrow`,kA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=zk(n);return(0,M.jsx)(kD,{...i,...r,ref:t})});kA.displayName=OA;var AA=`MenuSub`,[jA,MA]=Lk(AA),NA=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Hk(AA,t),o=zk(t),[s,c]=j.useState(null),[l,u]=j.useState(null),d=T_(i);return j.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,M.jsx)(ED,{...o,children:(0,M.jsx)(Vk,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,M.jsx)(jA,{scope:t,contentId:dS(),triggerId:dS(),trigger:s,onTriggerChange:c,children:n})})})};NA.displayName=AA;var PA=`MenuSubTrigger`,FA=j.forwardRef((e,t)=>{let n=Hk(PA,e.__scopeMenu),r=Wk(PA,e.__scopeMenu),i=MA(PA,e.__scopeMenu),a=eA(PA,e.__scopeMenu),o=j.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=j.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return j.useEffect(()=>u,[u]),j.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,M.jsx)(qk,{asChild:!0,...l,children:(0,M.jsx)(pA,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":RA(n.open),...e,ref:u_(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:q(e.onPointerMove,KA(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:q(e.onPointerLeave,KA(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:q(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||jk[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});FA.displayName=PA;var IA=`MenuSubContent`,LA=j.forwardRef((e,t)=>{let n=Xk(Qk,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Hk(Qk,e.__scopeMenu),o=Wk(Qk,e.__scopeMenu),s=MA(IA,e.__scopeMenu),c=j.useRef(null),l=d_(t,c);return(0,M.jsx)(Pk.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(K_,{present:r||a.open,children:(0,M.jsx)(Pk.Slot,{scope:e.__scopeMenu,children:(0,M.jsx)(aA,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:q(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:q(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:q(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Mk[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});LA.displayName=IA;function RA(e){return e?`open`:`closed`}function zA(e){return e===`indeterminate`}function BA(e){return zA(e)?`indeterminate`:e?`checked`:`unchecked`}function VA(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function HA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function UA(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=HA(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function WA(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function GA(e,t){return t?WA({x:e.clientX,y:e.clientY},t):!1}function KA(e){return t=>t.pointerType===`mouse`?e(t):void 0}var qA=Gk,JA=qk,YA=Zk,XA=tA,ZA=sA,QA=lA,$A=fA,ej=hA,tj=yA,nj=xA,rj=TA,ij=DA,aj=kA,oj=FA,sj=LA,cj=`DropdownMenu`,[lj,uj]=p_(cj,[Rk]),dj=Rk(),[fj,pj]=lj(cj),mj=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=dj(t),l=j.useRef(null),[u,d]=Z_({prop:i,defaultProp:a??!1,onChange:o,caller:cj});return(0,M.jsx)(fj,{scope:t,triggerId:dS(),triggerRef:l,contentId:dS(),open:u,onOpenChange:d,onOpenToggle:j.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,M.jsx)(qA,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};mj.displayName=cj;var hj=`DropdownMenuTrigger`,gj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=pj(hj,n),o=dj(n);return(0,M.jsx)(JA,{asChild:!0,...o,children:(0,M.jsx)(C_.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:u_(t,a.triggerRef),onPointerDown:q(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:q(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});gj.displayName=hj;var _j=`DropdownMenuPortal`,vj=e=>{let{__scopeDropdownMenu:t,...n}=e,r=dj(t);return(0,M.jsx)(YA,{...r,...n})};vj.displayName=_j;var yj=`DropdownMenuContent`,bj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(yj,n),a=dj(n),o=j.useRef(!1);return(0,M.jsx)(XA,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:q(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});bj.displayName=yj;var xj=`DropdownMenuGroup`,Sj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(ZA,{...i,...r,ref:t})});Sj.displayName=xj;var Cj=`DropdownMenuLabel`,wj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(QA,{...i,...r,ref:t})});wj.displayName=Cj;var Tj=`DropdownMenuItem`,Ej=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)($A,{...i,...r,ref:t})});Ej.displayName=Tj;var Dj=`DropdownMenuCheckboxItem`,Oj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(ej,{...i,...r,ref:t})});Oj.displayName=Dj;var kj=`DropdownMenuRadioGroup`,Aj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(tj,{...i,...r,ref:t})});Aj.displayName=kj;var jj=`DropdownMenuRadioItem`,Mj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(nj,{...i,...r,ref:t})});Mj.displayName=jj;var Nj=`DropdownMenuItemIndicator`,Pj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(rj,{...i,...r,ref:t})});Pj.displayName=Nj;var Fj=`DropdownMenuSeparator`,Ij=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(ij,{...i,...r,ref:t})});Ij.displayName=Fj;var Lj=`DropdownMenuArrow`,Rj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(aj,{...i,...r,ref:t})});Rj.displayName=Lj;var zj=`DropdownMenuSubTrigger`,Bj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(oj,{...i,...r,ref:t})});Bj.displayName=zj;var Vj=`DropdownMenuSubContent`,Hj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=dj(n);return(0,M.jsx)(sj,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Hj.displayName=Vj;var Uj=mj,Wj=gj,Gj=vj,Kj=bj,qj=wj,Jj=Ej,Yj=Oj,Xj=Mj,Zj=Pj,Qj=Ij,$j=Bj,eM=Hj,tM=Uj,nM=Wj,rM=j.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,M.jsxs)($j,{ref:i,className:Z(`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,M.jsx)(_y,{className:`ml-auto`})]}));rM.displayName=$j.displayName;var iM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(eM,{ref:n,className:Z(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));iM.displayName=eM.displayName;var aM=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(Gj,{children:(0,M.jsx)(Kj,{ref:r,sideOffset:t,className:Z(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));aM.displayName=Kj.displayName;var oM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(Jj,{ref:r,className:Z(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));oM.displayName=Jj.displayName;var sM=j.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,M.jsxs)(Yj,{ref:i,className:Z(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(Zj,{children:(0,M.jsx)(hy,{className:`h-4 w-4`})})}),t]}));sM.displayName=Yj.displayName;var cM=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(Xj,{ref:r,className:Z(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(Zj,{children:(0,M.jsx)(Cy,{className:`h-2 w-2 fill-current`})})}),t]}));cM.displayName=Xj.displayName;var lM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(qj,{ref:r,className:Z(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));lM.displayName=qj.displayName;var uM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Qj,{ref:n,className:Z(`-mx-1 my-1 h-px bg-muted`,e),...t}));uM.displayName=Qj.displayName;var dM=({className:e,...t})=>(0,M.jsx)(`span`,{className:Z(`ml-auto text-xs tracking-widest opacity-60`,e),...t});dM.displayName=`DropdownMenuShortcut`;var fM=`modulepreload`,pM=function(e){return`/_account/`+e},mM={},hM=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=pM(t,n),t in mM)return;mM[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:fM,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},gM=[`en`,`zh-CN`],_M={en:()=>hM(()=>import(`./en-QM3gmMOi.js`),[]),"zh-CN":()=>hM(()=>import(`./zh-CN-B0Jn4kQl.js`),[])};function vM(e){return gM.includes(e)?e:e.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}async function yM(e){let t=vM(e);try{return(await _M[t]()).default}catch(t){return console.warn(`[account/i18n] Failed to load language pack '${e}':`,t),{}}}var bM={en:`English`,"zh-CN":`中文`};function xM(){let{t:e,language:t,changeLanguage:n}=vt();async function r(e){await n(e);try{localStorage.setItem(`account.lang`,e)}catch{}}return(0,M.jsxs)(tM,{children:[(0,M.jsx)(nM,{asChild:!0,children:(0,M.jsxs)(Q,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":e(`common.language`),children:[(0,M.jsx)(My,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.language`)})]})}),(0,M.jsx)(aM,{align:`end`,children:gM.map(e=>(0,M.jsx)(oM,{onSelect:()=>void r(e),className:e===t?`font-medium`:void 0,children:bM[e]},e))})]})}function SM(e){let t=document.documentElement;e===`dark`?t.classList.add(`dark`):t.classList.remove(`dark`)}function CM(){let{t:e}=vt(),[,t]=(0,j.useState)(`light`);(0,j.useEffect)(()=>{let e=localStorage.getItem(`theme`);e?(t(e),SM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)):(t(`system`),SM(window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`))},[]);function n(e){t(e),localStorage.setItem(`theme`,e),SM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)}return(0,M.jsxs)(tM,{children:[(0,M.jsx)(nM,{asChild:!0,children:(0,M.jsxs)(Q,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:[(0,M.jsx)(Jy,{className:`h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,M.jsx)(zy,{className:`absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.toggleTheme`)})]})}),(0,M.jsxs)(aM,{align:`end`,children:[(0,M.jsxs)(oM,{onClick:()=>n(`light`),children:[(0,M.jsx)(Jy,{className:`mr-2 h-4 w-4`}),e(`common.light`)]}),(0,M.jsxs)(oM,{onClick:()=>n(`dark`),children:[(0,M.jsx)(zy,{className:`mr-2 h-4 w-4`}),e(`common.dark`)]}),(0,M.jsx)(oM,{onClick:()=>n(`system`),children:e(`common.system`)})]})]})}function wM(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,TM(i,...t)]}function TM(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function EM(){return(0,ot.useSyncExternalStore)(DM,()=>!0,()=>!1)}function DM(){return()=>{}}var OM=`Avatar`,[kM,AM]=wM(OM),[jM,MM]=kM(OM),NM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=j.useState(`idle`);return(0,M.jsx)(jM,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,M.jsx)(tS.span,{...r,ref:t})})});NM.displayName=OM;var PM=`AvatarImage`,FM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=MM(PM,n),s=zM(r,a),c=T_(e=>{i(e),o.onImageLoadingStatusChange(e)});return H_(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,M.jsx)(tS.img,{...a,ref:t,src:r}):null});FM.displayName=PM;var IM=`AvatarFallback`,LM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=MM(IM,n),[o,s]=j.useState(r===void 0);return j.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,M.jsx)(tS.span,{...i,ref:t}):null});LM.displayName=IM;function RM(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function zM(e,{referrerPolicy:t,crossOrigin:n}){let r=EM(),i=j.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=j.useState(()=>RM(a,e));return H_(()=>{s(RM(a,e))},[a,e]),H_(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var BM=NM,VM=FM,HM=LM,UM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(BM,{ref:n,className:Z(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));UM.displayName=BM.displayName;var WM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(VM,{ref:n,className:Z(`aspect-square h-full w-full`,e),...t}));WM.displayName=VM.displayName;var GM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(HM,{ref:n,className:Z(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));GM.displayName=HM.displayName;var KM=(0,j.createContext)(null),qM=`auth-session-token`,JM=`auth-active-organization-id`;function YM(e){if(!(typeof window>`u`))try{e?.token?localStorage.setItem(qM,e.token):localStorage.removeItem(qM),e?.activeOrganizationId?localStorage.setItem(JM,e.activeOrganizationId):localStorage.removeItem(JM)}catch{}}function XM(e){if(!e)return{user:null,session:null};let t=e.data===void 0?e:e.data;return t?{user:t.user??null,session:t.session??null}:{user:null,session:null}}function ZM({children:e}){let t=Zg(),[n,r]=(0,j.useState)(null),[i,a]=(0,j.useState)(null),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null),[u,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(!1),[g,_]=(0,j.useState)(null);(0,j.useEffect)(()=>{if(!t?.auth?.getConfig)return;let e=!1;return t.auth.getConfig().then(t=>{if(e)return;let n=t?.data??t??{},r={...n.features??{}};n.emailPassword?.disableSignUp===!0&&(r.signUpDisabled=!0),_(r)}).catch(()=>{e||_(null)}),()=>{e=!0}},[t]);let v=(0,j.useCallback)(async()=>{if(t?.organizations){p(!0);try{d((await t.organizations.list())?.organizations??[])}catch{d([])}finally{p(!1),h(!0)}}},[t]),y=(0,j.useCallback)(async()=>{if(t?.auth){s(!0),l(null);try{let{user:e,session:n}=XM(await t.auth.me());r(e),a(n),YM(e?n:null)}catch(e){l(e),r(null),a(null),YM(null)}finally{s(!1)}}},[t]);(0,j.useEffect)(()=>{y()},[y]),(0,j.useEffect)(()=>{n?v():(d([]),h(!1))},[n,v]);let b=(0,j.useCallback)(async()=>{if(t?.auth)try{await t.auth.logout()}finally{r(null),a(null),d([]),h(!1),YM(null)}},[t]),x=(0,j.useCallback)(async e=>{if(t?.organizations){await t.organizations.setActive(e),await y();try{localStorage.setItem(JM,e)}catch{}}},[t,y]),S=(0,j.useMemo)(()=>({user:n,session:i,loading:o,error:c,refresh:y,logout:b,setActiveOrganization:x,organizations:u,organizationsLoading:f,organizationsFetched:m,reloadOrganizations:v,features:g}),[n,i,o,c,y,b,x,u,f,m,v,g]);return(0,j.createElement)(KM.Provider,{value:S},e)}function QM(){let e=(0,j.useContext)(KM);if(!e)throw Error(`useSession must be used inside <SessionProvider>.`);return e}function $M(){let{organizations:e,organizationsLoading:t,reloadOrganizations:n}=QM();return{organizations:e,loading:t,error:null,reload:n}}function eN(){let e=Zg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{create:(0,j.useCallback)(async t=>{if(!e?.organizations)throw Error(`Client not ready`);n(!0),i(null);try{return await e.organizations.create(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),creating:t,error:r}}function tN(){let e=Zg(),{reloadOrganizations:t,refresh:n}=QM(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{update:(0,j.useCallback)(async(r,a)=>{if(!e?.organizations?.update)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.update(r,a);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),updating:r,error:a}}function nN(){let e=Zg(),{reloadOrganizations:t,refresh:n}=QM(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async r=>{if(!e?.organizations?.delete)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.delete(r);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),deleting:r,error:a}}function rN({message:e}){return typeof document>`u`?null:(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e})]})}),document.body)}function iN(e,t){let n=(e||t||`?`).trim(),r=n.split(/\s+/);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():n.slice(0,2).toUpperCase()}function aN(){let{t:e}=vt(),t=Hi(),{user:n,loading:r,logout:i}=QM(),[a,o]=(0,j.useState)(!1);return r&&!n?(0,M.jsx)(`div`,{className:`h-8 w-8 animate-pulse rounded-full bg-muted`,"aria-hidden":!0}):n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(tM,{children:[(0,M.jsx)(nM,{asChild:!0,children:(0,M.jsx)(Q,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,children:(0,M.jsxs)(UM,{className:`h-7 w-7`,children:[n.image?(0,M.jsx)(WM,{src:n.image,alt:n.name??n.email??e(`userMenu.user`)}):null,(0,M.jsx)(GM,{className:`text-[11px]`,children:iN(n.name,n.email)})]})})}),(0,M.jsxs)(aM,{align:`end`,className:`w-64`,children:[(0,M.jsx)(lM,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:n.name||n.email}),n.email&&(0,M.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:n.email})]})}),(0,M.jsx)(uM,{}),(0,M.jsxs)(oM,{onSelect:()=>t({to:`/account`}),children:[(0,M.jsx)(tb,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.account`)]}),(0,M.jsxs)(oM,{onSelect:()=>t({to:`/organizations`}),children:[(0,M.jsx)(my,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.organizations`)]}),(0,M.jsx)(uM,{}),(0,M.jsxs)(oM,{onSelect:async()=>{o(!0);try{await i()}finally{window.location.assign(`/_account/login`)}},disabled:a,children:[(0,M.jsx)(Fy,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.signOut`)]})]})]}),a?(0,M.jsx)(rN,{message:e(`auth.userMenu.signingOut`,{defaultValue:`Signing you out…`})}):null]}):(0,M.jsx)(Q,{variant:`outline`,size:`sm`,className:`h-8`,onClick:()=>t({to:`/login`}),children:e(`userMenu.signIn`)})}function oN(){let{t:e}=vt(),t=Hi(),n=Oa(),{organizations:r,loading:i,reload:a}=$M(),{session:o,setActiveOrganization:s}=QM(),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=o?.activeOrganizationId??void 0,p=(0,j.useMemo)(()=>r.find(e=>e.id===f)??null,[r,f]),m=async r=>{if(l(!1),r===f){t({to:`/organizations/$orgId/general`,params:{orgId:r}});return}d(!0);try{await s(r),await a(),K({title:e(`organizations.general.switched`)});let i=n.pathname.match(/^\/organizations\/[^/]+\/(general|members)\/?$/);t({to:(i?i[1]:`general`)===`members`?`/organizations/$orgId/members`:`/organizations/$orgId/general`,params:{orgId:r}})}catch(t){K({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}};return(0,M.jsxs)(tM,{open:c,onOpenChange:l,children:[(0,M.jsx)(nM,{asChild:!0,children:(0,M.jsxs)(Q,{variant:`ghost`,size:`sm`,className:`h-8 gap-2 px-2 text-sm font-medium`,disabled:u,children:[p?(0,M.jsx)(`span`,{className:`max-w-[160px] truncate`,children:p.name}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(i?`organizations.loading`:`organizationSwitcher.select`)}),(0,M.jsx)(yy,{className:`h-3 w-3 opacity-50`})]})}),(0,M.jsxs)(aM,{align:`start`,className:`w-[280px]`,sideOffset:4,children:[(0,M.jsx)(lM,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e(`organizations.title`)}),r.length===0&&!i&&(0,M.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:e(`organizations.emptyTitle`)}),r.map(e=>(0,M.jsxs)(oM,{onSelect:t=>{t.preventDefault(),m(e.id)},className:`flex items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-medium`,children:e.name}),e.slug&&(0,M.jsx)(`code`,{className:`text-[11px] text-muted-foreground font-mono`,children:e.slug})]}),e.id===f&&(0,M.jsx)(hy,{className:`h-3.5 w-3.5 text-primary`})]},e.id)),(0,M.jsx)(uM,{}),(0,M.jsxs)(oM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations/new`})},className:`gap-2 text-sm`,children:[(0,M.jsx)(Vy,{className:`h-3.5 w-3.5`}),e(`organizationSwitcher.new`)]}),(0,M.jsx)(oM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations`})},className:`gap-2 text-sm text-muted-foreground`,children:e(`organizationSwitcher.manage`)})]})]})}function sN({label:e}){return(0,M.jsx)(`a`,{href:`/`,className:`flex h-8 w-8 items-center justify-center rounded-md bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15 transition-transform hover:scale-105`,"aria-label":e,children:(0,M.jsx)(xy,{className:`h-4 w-4`})})}function cN(){return(0,M.jsx)(_y,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground/50`})}function lN(){let{t:e}=vt(),t=Oa(),n=Bi({strict:!1}),r=(0,j.useMemo)(()=>{let r=t.pathname,i=t=>e(`topBar.breadcrumb.${t}`);if(r.startsWith(`/account`)){let e=[{label:i(`account`)}];return r===`/account/profile`?e.push({label:i(`profile`)}):r===`/account/security`?e.push({label:i(`security`)}):r===`/account/sessions`?e.push({label:i(`sessions`)}):r===`/account/two-factor`?e.push({label:i(`twoFactor`)}):r===`/account/oauth-applications`?e.push({label:i(`oauthApps`)}):r===`/account/oauth-applications/new`?e.push({label:i(`oauthApps`)},{label:i(`new`)}):r.startsWith(`/account/oauth-applications/`)&&e.push({label:i(`oauthApps`)}),e}if(r===`/organizations/new`)return[{label:i(`organizations`)},{label:i(`new`)}];if(n.orgId){let e=r.endsWith(`/general`)?i(`general`):r.endsWith(`/members`)?i(`members`):i(`settings`);return[{label:i(`organizations`)},{label:e}]}return r===`/organizations`||r.startsWith(`/organizations/`)?[{label:i(`organizations`)}]:r.startsWith(`/accept-invitation/`)?[{label:i(`acceptInvitation`)}]:r.startsWith(`/auth/device`)?[{label:i(`deviceAuthorization`)}]:[{label:i(`account`)}]},[t.pathname,n.orgId,e]);return(0,M.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 shrink-0 items-center justify-between gap-2 border-b bg-background/80 px-2 backdrop-blur supports-[backdrop-filter]:bg-background/70 sm:px-4`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 sm:gap-2.5`,children:[(0,M.jsx)(`div`,{className:`sm:hidden`,children:(0,M.jsx)(OO,{className:`h-9 w-9`})}),(0,M.jsx)(sN,{label:e(`topBar.accountHome`)}),(0,M.jsx)(`span`,{className:`hidden text-sm font-semibold tracking-tight sm:inline`,children:e(`topBar.brand`)}),(0,M.jsxs)(`div`,{className:`hidden items-center gap-1.5 sm:flex`,children:[(0,M.jsx)(cS,{orientation:`vertical`,className:`mx-1 h-4`}),(0,M.jsx)(oN,{}),(0,M.jsx)(cN,{}),(0,M.jsx)(ZO,{children:(0,M.jsx)(QO,{children:r.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex items-center`,children:[t>0&&(0,M.jsx)(nk,{}),(0,M.jsx)($O,{children:(0,M.jsx)(tk,{className:`font-medium`,children:e.label})})]},t))})})]}),(0,M.jsx)(`div`,{className:`min-w-0 flex-1 sm:hidden`,children:r.length>0&&(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:r[r.length-1].label})})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 sm:gap-2`,children:[(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(xM,{})}),(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(CM,{})}),(0,M.jsx)(aN,{})]})]})}var uN=[{to:`/account`,label:`home`,icon:ky,exact:!0},{to:`/account/profile`,label:`profile`,icon:tb},{to:`/account/security`,label:`security`,icon:Ky},{to:`/account/sessions`,label:`sessions`,icon:Ry},{to:`/account/two-factor`,label:`twoFactor`,icon:Gy},{to:`/account/invitations`,label:`invitations`,icon:Ay},{to:`/account/linked-accounts`,label:`linkedAccounts`,icon:Py}],dN=[`group/nav relative transition-all duration-150`,`before:absolute before:left-0 before:top-1/2 before:h-5 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-brand-gradient before:opacity-0 before:transition-opacity`,`data-[active=true]:before:opacity-100`,`data-[active=true]:bg-sidebar-accent/80 data-[active=true]:text-sidebar-accent-foreground`,`[&>svg]:transition-transform [&>svg]:duration-150 hover:[&>svg]:scale-110`,`data-[active=true]:[&>svg]:text-primary`].join(` `);function fN(){let{t:e}=vt(),{pathname:t}=Oa(),{organizations:n}=$M(),r=t,i=t.match(/^\/organizations\/([^/]+)(?:\/.*)?$/),a=i&&n.some(e=>e.id===i[1])?i[1]:null;return(0,M.jsxs)(DO,{collapsible:`icon`,className:`h-full`,children:[(0,M.jsxs)(FO,{children:[(0,M.jsxs)(IO,{children:[(0,M.jsx)(LO,{children:e(`sidebar.groups.account`)}),(0,M.jsx)(zO,{children:(0,M.jsx)(BO,{children:uN.map(t=>{let n=t.icon;return(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{asChild:!0,isActive:t.exact?r===t.to||r===`${t.to}/`:r===t.to||r.startsWith(`${t.to}/`),tooltip:e(`sidebar.items.${t.label}`),className:dN,children:(0,M.jsxs)(ra,{to:t.to,children:[(0,M.jsx)(n,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.${t.label}`)})]})})},t.to)})})})]}),(0,M.jsx)(PO,{}),(0,M.jsxs)(IO,{children:[(0,M.jsx)(LO,{children:e(`sidebar.groups.organization`)}),(0,M.jsx)(zO,{children:(0,M.jsxs)(BO,{children:[(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{asChild:!0,isActive:t===`/organizations`,tooltip:e(`sidebar.items.overview`),className:dN,children:(0,M.jsxs)(ra,{to:`/organizations`,children:[(0,M.jsx)(my,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.overview`)})]})})}),a&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{asChild:!0,isActive:t===`/organizations/${a}/general`,tooltip:e(`sidebar.items.general`),className:dN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/general`,params:{orgId:a},children:[(0,M.jsx)(Wy,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.general`)})]})})}),(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{asChild:!0,isActive:t===`/organizations/${a}/members`,tooltip:e(`sidebar.items.members`),className:dN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/members`,params:{orgId:a},children:[(0,M.jsx)(rb,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.members`)})]})})}),(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{asChild:!0,isActive:t===`/organizations/${a}/teams`,tooltip:e(`sidebar.items.teams`),className:dN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/teams`,params:{orgId:a},children:[(0,M.jsx)(nb,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.teams`)})]})})})]})]})})]}),(0,M.jsx)(PO,{}),(0,M.jsxs)(IO,{children:[(0,M.jsx)(LO,{children:e(`sidebar.groups.developer`)}),(0,M.jsx)(zO,{children:(0,M.jsx)(BO,{children:(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{asChild:!0,isActive:t.startsWith(`/account/oauth-applications`),tooltip:e(`sidebar.items.oauthApps`),className:dN,children:(0,M.jsxs)(ra,{to:`/account/oauth-applications`,children:[(0,M.jsx)(jy,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.oauthApps`)})]})})})})})]})]}),(0,M.jsx)(NO,{children:(0,M.jsx)(BO,{children:(0,M.jsx)(VO,{children:(0,M.jsx)(pN,{})})})})]})}function pN(){let{t:e}=vt(),{state:t,toggleSidebar:n}=TO(),r=e(t===`collapsed`?`sidebar.expand`:`sidebar.collapse`);return(0,M.jsx)(HO,{onClick:n,tooltip:r,"aria-label":r,children:(0,M.jsx)(By,{className:`size-4`})})}function mN(){return typeof window<`u`&&window.location.pathname.startsWith(`/_account`)?window.location.origin:`http://localhost:3000`}var hN=new Set([`/login`,`/register`,`/forgot-password`,`/reset-password`,`/verify-email`,`/verify-email-prompt`,`/auth/device`,`/setup`]);function gN(e){return hN.has(e)||e.startsWith(`/accept-invitation/`)}function _N(){let[e,t]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/v1/auth/bootstrap-status`);if(!n.ok){e||t(!0);return}let r=await n.json();e||t(r.hasOwner!==!1)}catch{e||t(!0)}})(),()=>{e=!0}},[]),e}function vN({children:e}){let{user:t,loading:n}=QM(),r=Hi(),i=Oa(),a=gN(i.pathname),o=i.pathname.startsWith(`/oauth/`)||i.pathname===`/organizations/new`,s=_N(),c=i.pathname===`/setup`;return(0,j.useEffect)(()=>{s===!1&&!c&&!t&&r({to:`/setup`,replace:!0})},[s,c,t,r]),(0,j.useEffect)(()=>{n||s!==!1&&!t&&!a&&r({to:`/login`,search:{redirect:i.pathname+i.searchStr},replace:!0})},[t,n,a,r,i.pathname,i.searchStr,s]),s===null||n&&!t?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full flex-1 items-center justify-center bg-background`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted border-t-primary`})}):s===!1&&!c||!t&&!a?null:a||o?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full`,children:e}):(0,M.jsxs)(EO,{className:`flex h-svh w-full flex-col`,children:[(0,M.jsx)(lN,{}),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 w-full`,children:[(0,M.jsx)(fN,{}),(0,M.jsx)(AO,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-auto bg-background`,children:e})})]})]})}function yN(){let e=mN();return(0,M.jsx)(Xg,{client:(0,j.useMemo)(()=>new qg({baseUrl:e}),[e]),children:(0,M.jsxs)(ZM,{children:[(0,M.jsx)(vN,{children:(0,M.jsx)(ya,{})}),(0,M.jsx)(zx,{})]})})}var bN=ca({component:yN}),$=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));$.displayName=`Card`;var xN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`flex flex-col space-y-1.5 p-6`,e),...t}));xN.displayName=`CardHeader`;var SN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`h3`,{ref:n,className:Z(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));SN.displayName=`CardTitle`;var CN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`p`,{ref:n,className:Z(`text-sm text-muted-foreground`,e),...t}));CN.displayName=`CardDescription`;var wN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`p-6 pt-0`,e),...t}));wN.displayName=`CardContent`;var TN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:Z(`flex items-center p-6 pt-0`,e),...t}));TN.displayName=`CardFooter`;function EN(e){let t=e.split(`:`)[0].toLowerCase();return/^cloud\./.test(t)}function DN(){return typeof window>`u`?null:window.location.host||null}function ON({children:e,formWidth:t=`sm`}){let{t:n}=vt(),r=t===`md`?`max-w-md`:`max-w-sm`,i=DN(),a=!!i&&!EN(i);return j.useEffect(()=>{if(typeof document>`u`||!i)return;let e=document.title;return a&&(document.title=i),()=>{document.title=e}},[i,a]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsxs)(`div`,{className:Z(`flex w-full flex-col gap-4`,r),children:[a?(0,M.jsx)(`div`,{className:`flex justify-center`,children:(0,M.jsx)(`span`,{className:`rounded-full border border-border/60 bg-background/60 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-foreground`,title:n(`auth.shell.tenantHostHint`,{defaultValue:`You are signing in to this workspace`}),children:i})}):null,e]})})}var kN=la(`/verify-email-prompt`)({validateSearch:e=>({email:typeof e.email==`string`?e.email:void 0,redirect:typeof e.redirect==`string`?e.redirect:void 0}),component:AN});function AN(){let{t:e}=vt(),t=Hi(),{email:n,redirect:r}=kN.useSearch(),i=Zg(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(ON,{children:(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10`,children:(0,M.jsx)(Iy,{className:`size-8 text-primary`})}),(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.title`,{defaultValue:`Verify your email address`})}),(0,M.jsx)(CN,{children:e(`auth.verifyEmail.description`,{defaultValue:`We sent a verification link to your email address. Please click the link to verify your account.`})})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n?(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.verifyEmail.sentTo`,{defaultValue:`Sent to:`}),` `,(0,M.jsx)(`span`,{className:`font-medium text-foreground`,children:n})]}):null,(0,M.jsx)(Q,{onClick:async()=>{if(!n||!i?.auth){K({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`}),description:e(`auth.verifyEmail.emailMissing`,{defaultValue:`Email address is missing`}),variant:`destructive`});return}o(!0);try{let t=await fetch(`/api/v1/auth/send-verification-email`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:n,callbackURL:r||`/`})});if(!t.ok){let e=await t.json().catch(()=>({message:`Unknown error`}));throw Error(e.message||`Failed to send verification email`)}c(!0),K({title:e(`auth.verifyEmail.resentSuccess`,{defaultValue:`Verification email sent!`}),description:e(`auth.verifyEmail.resentDescription`,{defaultValue:`Please check your inbox and click the verification link.`})})}catch(t){K({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Failed to resend verification email`}),description:t.message,variant:`destructive`})}finally{o(!1)}},disabled:a||s,className:`w-full`,variant:s?`outline`:`default`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Hy,{className:`mr-2 size-4 animate-spin`}),e(`auth.verifyEmail.resending`,{defaultValue:`Sending...`})]}):s?e(`auth.verifyEmail.resent`,{defaultValue:`Email sent! Check your inbox`}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Hy,{className:`mr-2 size-4`}),e(`auth.verifyEmail.resendButton`,{defaultValue:`Resend verification email`})]})}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:e(`auth.verifyEmail.or`,{defaultValue:`Or`})})})]}),(0,M.jsx)(Q,{onClick:()=>{t({to:`/login`,search:r?{redirect:r}:void 0})},variant:`ghost`,className:`w-full`,children:e(`auth.verifyEmail.backToLogin`,{defaultValue:`Back to login`})}),(0,M.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.verifyEmail.checkSpam`,{defaultValue:`Didn't receive the email? Check your spam folder or contact support.`})})]})})]})})})}var jN=la(`/verify-email`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:MN});function MN(){let{t:e}=vt(),{token:t}=jN.useSearch(),n=Zg(),[r,i]=(0,j.useState)(`loading`),[a,o]=(0,j.useState)(``);return(0,j.useEffect)(()=>{if(!t){i(`error`),o(e(`auth.verifyEmail.missingToken`));return}let r=!1;return(async()=>{try{await n.auth.verifyEmail({token:t}),r||i(`success`)}catch(t){r||(i(`error`),o(t.message||e(`auth.verifyEmail.errorDescription`)))}})(),()=>{r=!0}},[t,e,n]),(0,M.jsx)(ON,{children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[r===`loading`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.verifyingTitle`)}),(0,M.jsx)(CN,{children:e(`auth.verifyEmail.verifyingDescription`)})]}),(0,M.jsx)(wN,{className:`flex justify-center py-6`,children:(0,M.jsx)(`div`,{className:`h-10 w-10 animate-spin rounded-full border-4 border-muted border-t-primary`})})]}),r===`success`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-500 ring-1 ring-emerald-500/30`,children:(0,M.jsx)(by,{className:`size-6`})}),(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.successTitle`)}),(0,M.jsx)(CN,{children:e(`auth.verifyEmail.successDescription`)})]}),(0,M.jsx)(wN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.signInLink`)})})]}),r===`error`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-destructive/10 text-destructive ring-1 ring-destructive/30`,children:(0,M.jsx)(Sy,{className:`size-6`})}),(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.errorTitle`)}),(0,M.jsx)(CN,{children:a||e(`auth.verifyEmail.errorDescription`)})]}),(0,M.jsx)(wN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.backToSignIn`)})})]})]})})}var NN=`Label`,PN=j.forwardRef((e,t)=>(0,M.jsx)(tS.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));PN.displayName=NN;var FN=PN,IN=ry(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),LN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(FN,{ref:n,className:Z(IN(),e),...t}));LN.displayName=FN.displayName;var RN=la(`/setup`)({component:BN});function zN(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function BN(){let{t:e}=vt(),t=Hi(),n=Zg(),{user:r,refresh:i}=QM(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let{hasOwner:t}=await n.auth.bootstrapStatus();e||g(t)}catch{e||g(!1)}})(),()=>{e=!0}},[n]),(0,j.useEffect)(()=>{h===!0&&!r&&t({to:`/login`,replace:!0})},[h,r,t]),(0,j.useEffect)(()=>{r&&window.location.assign(`/`)},[r]),h===null?(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted-foreground/20 border-t-primary`})}):(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-md flex-col gap-6`,children:(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{children:e(`auth.setup.welcomeTitle`)}),(0,M.jsx)(CN,{children:e(`auth.setup.description`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),n?.auth){m(!0);try{await n.auth.register({name:a,email:s,password:l}),await i();let e=d.trim();if(e)try{let{organizations:t}=await n.organizations.list(),r=t?.[0],i;if(r?.id)await n.organizations.update(r.id,{name:e,slug:zN(e)}),i=r.id;else{let t=await n.organizations.create({name:e,slug:zN(e)});i=t?.id??t?.data?.id}i&&await n.organizations.setActive(i).catch(()=>{})}catch(e){console.warn(`[setup] organization rename/create failed`,e)}window.location.assign(`/`)}catch(t){K({title:e(`auth.setup.failed`),description:t.message,variant:`destructive`})}finally{m(!1)}}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`name`,children:e(`auth.setup.yourName`)}),(0,M.jsx)(eS,{id:`name`,autoComplete:`name`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`orgName`,children:e(`auth.setup.orgName`)}),(0,M.jsx)(eS,{id:`orgName`,required:!0,placeholder:e(`auth.setup.orgNamePlaceholder`),value:d,onChange:e=>f(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(eS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(eS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,placeholder:e(`auth.setup.passwordHint`),value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`mt-2 w-full`,disabled:p,children:e(p?`auth.setup.submitting`:`auth.setup.submit`)})]})})]})})})}var VN=la(`/reset-password`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:HN});function HN(){let{t:e}=vt(),t=Hi(),{token:n}=VN.useSearch(),[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(ON,{children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`auth.resetPassword.title`)}),(0,M.jsx)(CN,{children:e(`auth.resetPassword.description`)})]}),(0,M.jsx)(wN,{children:n?(0,M.jsxs)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r!==a){K({title:e(`auth.resetPassword.passwordsMismatch`),variant:`destructive`});return}if(!n){K({title:e(`auth.resetPassword.missingToken`),variant:`destructive`});return}c(!0);try{let i=await fetch(`/api/v1/auth/reset-password`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({token:n,newPassword:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${i.status}`)}K({title:e(`auth.resetPassword.success`)}),t({to:`/login`})}catch(t){K({title:e(`auth.resetPassword.failed`),description:t.message,variant:`destructive`})}finally{c(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`new-password`,children:e(`auth.resetPassword.newPassword`)}),(0,M.jsx)(eS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:r,onChange:e=>i(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`confirm-password`,children:e(`auth.resetPassword.confirmPassword`)}),(0,M.jsx)(eS,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:s,children:e(s?`auth.resetPassword.submitting`:`auth.resetPassword.submit`)})]}):(0,M.jsxs)(`p`,{className:`text-sm text-muted-foreground text-center`,children:[e(`auth.resetPassword.invalidToken`),` `,(0,M.jsx)(ra,{to:`/forgot-password`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.resetPassword.requestNewLink`)})]})})]})})}function UN({mode:e,redirect:t}){let{t:n}=vt(),r=Zg(),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null);if((0,j.useEffect)(()=>{r?.auth?.getConfig&&r.auth.getConfig().then(e=>{a((e?.socialProviders??e?.data?.socialProviders??[]).filter(e=>e.enabled))}).catch(e=>{console.warn(`[SocialSignInButtons] failed to load auth config`,e)}).finally(()=>s(!1))},[r]),o||i.length===0)return null;let u=n(e===`sign-in`?`auth.social.continueWith`:`auth.social.signUpWith`),d=window.location.origin+`/_account/login`+(t?`?redirect=${encodeURIComponent(t)}`:``),f=e=>{c||(l(e),Promise.resolve(r.auth.signInWithProvider(e.id,{callbackURL:d,errorCallbackURL:d,type:e.type??`social`})).catch(e=>{console.warn(`[SocialSignInButtons] signInWithProvider failed`,e),l(null)}))};return(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.map(e=>{let t=c?.id===e.id;return(0,M.jsxs)(Q,{type:`button`,variant:`outline`,className:`w-full`,disabled:!!c,onClick:()=>f(e),children:[t?(0,M.jsx)(`span`,{className:`mr-2 inline-block size-4 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}):(0,M.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center rounded-sm bg-muted text-[10px] font-bold uppercase`,children:e.id[0]}),t?n(`auth.social.redirectingTo`,{provider:e.name,defaultValue:`Redirecting to ${e.name}…`}):`${u} ${e.name}`]},e.id)}),(0,M.jsxs)(`div`,{className:`relative my-1`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:n(`auth.social.orContinueEmail`)})})]}),c&&typeof document<`u`?(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:n(`auth.social.redirectingTo`,{provider:c.name,defaultValue:`Redirecting to ${c.name}…`})})]})}),document.body):null]})}function WN(e,t){if(e.metaKey||e.ctrlKey||e.shiftKey||e.button===1)return;e.preventDefault();let n=Math.min(960,window.screen.availWidth-80),r=Math.min(720,window.screen.availHeight-80),i=Math.max(0,Math.round((window.screen.availWidth-n)/2)),a=Math.max(0,Math.round((window.screen.availHeight-r)/2)),o=[`popup=yes`,`width=${n}`,`height=${r}`,`left=${i}`,`top=${a}`,`resizable=yes`,`scrollbars=yes`,`noopener=yes`,`noreferrer=yes`].join(`,`);window.open(t,`objectstack-legal`,o)||window.open(t,`_blank`,`noopener,noreferrer`)}function GN({termsUrl:e,privacyUrl:t}){let{t:n}=vt(`account`),r=typeof e==`string`&&e.length>0,i=typeof t==`string`&&t.length>0;return!r&&!i?null:(0,M.jsxs)(`p`,{className:`px-6 text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary`,children:[n(`legal.agreementPrefix`),` `,r?(0,M.jsx)(`a`,{href:e,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:t=>WN(t,e),children:n(`legal.termsOfService`)}):null,r&&i?(0,M.jsxs)(M.Fragment,{children:[` `,n(`legal.and`),` `]}):null,i?(0,M.jsx)(`a`,{href:t,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:e=>WN(e,t),children:n(`legal.privacyPolicy`)}):null,`.`]})}var KN=la(`/register`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:YN});function qN(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function JN(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function YN(){let{t:e}=vt(),t=Hi(),{redirect:n}=KN.useSearch(),r=Zg(),{session:i,user:a,loading:o,refresh:s,organizations:c,organizationsLoading:l,organizationsFetched:u,setActiveOrganization:d,features:f}=QM();(0,j.useEffect)(()=>{f?.signUpDisabled===!0&&t({to:`/login`,search:n?{redirect:n}:{},replace:!0})},[f?.signUpDisabled,t,n]);let[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(a){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!i?.activeOrganizationId){if(!u||l||x)return;if(c.length===1){S(!0),d(c[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!f)return;if(c.length>1){t({to:`/organizations`});return}if(f.multiOrgEnabled===!1){qN(n)?window.location.assign(JN(n)):window.location.assign(`/`);return}t({to:`/organizations/new`,search:n?{redirect:n}:{}});return}if(!x){if(qN(n)){window.location.assign(JN(n));return}window.location.assign(`/`)}}},[a,i,t,n,c,l,u,x,d,f]),(0,M.jsx)(ON,{children:o||a?(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:a?e(`auth.register.signingIn`,{defaultValue:`Setting up your account…`}):e(`auth.login.redirecting`,{defaultValue:`Loading…`})})]}):(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`auth.register.title`)}),(0,M.jsx)(CN,{children:e(`auth.register.description`)})]}),(0,M.jsx)(wN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{let i=await r.auth.register({name:p,email:h,password:_}),a=i?.data??i;if(a&&a.token===null&&a.user){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}try{await s()}catch(e){let r=e.message;if(r.includes(`email`)&&(r.toLowerCase().includes(`verif`)||r.toLowerCase().includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}throw e}K({title:e(`auth.register.successToast`)})}catch(r){let i=r.message;if(i.includes(`email`)&&(i.toLowerCase().includes(`verif`)||i.toLowerCase().includes(`sent`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}K({title:e(`auth.register.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(UN,{mode:`sign-up`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`name`,children:e(`auth.nameLabel`)}),(0,M.jsx)(eS,{id:`name`,autoComplete:`name`,required:!0,value:p,onChange:e=>m(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(eS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(eS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.register.submitting`:`auth.register.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.register.haveAccount`),` `,(0,M.jsx)(ra,{to:`/login`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.register.signIn`)})]})]})})})]}),(0,M.jsx)(GN,{termsUrl:f?.termsUrl,privacyUrl:f?.privacyUrl})]})})}var XN=la(`/login`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:$N});function ZN(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function QN(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function $N(){let{t:e}=vt(),t=Hi(),{redirect:n}=XN.useSearch(),r=Zg(),i=null;if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`redirect_uri`);if(e.has(`client_id`)&&t)try{i=new URL(t).host}catch{i=null}}let{session:a,user:o,loading:s,refresh:c,organizations:l,organizationsLoading:u,organizationsFetched:d,setActiveOrganization:f,features:p}=QM(),m=p?.signUpDisabled===!0,[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(o){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!a?.activeOrganizationId){if(!d||u||x)return;if(l.length===1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!p)return;if(l.length===0){if(p.multiOrgEnabled===!1){ZN(n)?window.location.assign(QN(n)):window.location.assign(`/`);return}t({to:`/organizations/new`});return}if(p.multiOrgEnabled===!1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}t({to:`/organizations`});return}if(!x){if(ZN(n)){window.location.assign(QN(n));return}window.location.assign(`/`)}}},[o,a,t,n,l,u,d,x,f,p]),s||o?(0,M.jsx)(ON,{children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})})]})}):(0,M.jsxs)(ON,{children:[y?(0,M.jsx)(rN,{message:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})}):null,(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i?(0,M.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-md border border-primary/30 bg-primary/5 px-4 py-3 text-sm text-foreground`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-block size-2 shrink-0 rounded-full bg-primary`}),(0,M.jsx)(`span`,{children:e(`auth.login.ssoHandoff`,{target:i,defaultValue:`Continue to ${i}`})})]}):null,(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`auth.login.title`)}),(0,M.jsx)(CN,{children:e(`auth.login.description`)})]}),(0,M.jsx)(wN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{await r.auth.login({type:`email`,email:h,password:_}),await c(),K({title:e(`auth.login.welcomeToast`)})}catch(r){let i=r.message,a=r.code,o=(i||``).toLowerCase();if(a===`EMAIL_NOT_VERIFIED`||o.includes(`email`)&&(o.includes(`verif`)||o.includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}K({title:e(`auth.login.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(UN,{mode:`sign-in`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(eS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center`,children:[(0,M.jsx)(LN,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(ra,{to:`/forgot-password`,className:`ml-auto text-sm underline-offset-4 hover:underline`,children:e(`auth.login.forgotPassword`)})]}),(0,M.jsx)(eS,{id:`password`,type:`password`,autoComplete:`current-password`,required:!0,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.login.submitting`:`auth.login.submit`)}),m?null:(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.login.noAccount`),` `,(0,M.jsx)(ra,{to:`/register`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.login.signUp`)})]})]})})})]}),(0,M.jsx)(GN,{termsUrl:p?.termsUrl,privacyUrl:p?.privacyUrl})]})]})}var eP=la(`/forgot-password`)({component:tP});function tP(){let{t:e}=vt(),[t,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(!1);return(0,M.jsx)(ON,{children:(0,M.jsx)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.checkEmailTitle`)}),(0,M.jsx)(CN,{children:e(`auth.forgotPassword.checkEmailDescription`,{email:t})})]}),(0,M.jsx)(wN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.backToSignIn`)})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.title`)}),(0,M.jsx)(CN,{children:e(`auth.forgotPassword.description`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),i(!0);try{let e=window.location.origin+`/_account/`.replace(/\/$/,``)+`/reset-password`,n=await fetch(`/api/v1/auth/forget-password`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:t,redirectTo:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${n.status}`)}o(!0)}catch(t){K({title:e(`auth.forgotPassword.failed`),description:t.message,variant:`destructive`})}finally{i(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(eS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:t,onChange:e=>n(e.target.value)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:r,children:e(r?`auth.forgotPassword.submitting`:`auth.forgotPassword.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.forgotPassword.rememberPassword`),` `,(0,M.jsx)(ra,{to:`/login`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.signIn`)})]})]})})]})})})}var nP=la(`/account`)({component:rP});function rP(){return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsx)(`div`,{className:`page-enter mx-auto flex max-w-4xl flex-col gap-6`,children:(0,M.jsx)(ya,{})})})})}var iP=la(`/`)({component:aP});function aP(){return(0,M.jsx)(Ui,{to:`/login`})}var oP=ry(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function sP({className:e,variant:t,...n}){return(0,M.jsx)(`div`,{className:Z(oP({variant:t}),e),...n})}function cP({title:e,description:t,icon:n,actions:r,className:i,...a}){return(0,M.jsxs)(`div`,{className:Z(`relative overflow-hidden rounded-xl border bg-brand-gradient-subtle`,`px-5 py-5 sm:px-6 sm:py-6`,i),...a,children:[(0,M.jsx)(`div`,{className:`pointer-events-none absolute inset-0 opacity-60`,style:{backgroundImage:`radial-gradient(ellipse 60% 80% at 0% 0%, hsl(var(--brand-from) / 0.12), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between sm:gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[n?(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`,children:(0,M.jsx)(n,{className:`size-5`})}):null,(0,M.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,M.jsx)(`h1`,{className:`truncate text-xl font-semibold tracking-tight sm:text-2xl`,children:e}),t?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t}):null]})]}),r?(0,M.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:r}):null]})]})}var lP=la(`/organizations/`)({component:uP});function uP(){let{t:e}=vt(),{organizations:t,loading:n}=$M(),{session:r,setActiveOrganization:i,features:a}=QM(),o=Hi(),s=r?.activeOrganizationId??void 0,c=a?.multiOrgEnabled!==!1,l=async t=>{try{t!==s&&await i(t),o({to:`/organizations/$orgId`,params:{orgId:t}})}catch(t){K({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}},u=e=>e.split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsxs)(`div`,{className:`page-enter mx-auto flex max-w-3xl flex-col gap-6`,children:[(0,M.jsx)(cP,{icon:my,title:e(`organizations.title`),description:e(`organizations.description`),actions:c?(0,M.jsxs)(Q,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`organizations.newOrganization`)]}):null}),n&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`organizations.loading`)}),!n&&t.length===0&&(0,M.jsxs)($,{className:`p-10 text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-3 flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(my,{className:`h-6 w-6`})}),(0,M.jsx)(`h3`,{className:`text-base font-medium`,children:e(`organizations.emptyTitle`)}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e(`organizations.emptyDescription`)}),c&&(0,M.jsxs)(Q,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`organizations.createOrganization`)]})]}),(0,M.jsx)(`div`,{className:`grid gap-3`,children:t.map(t=>{let n=t.id===s;return(0,M.jsx)($,{role:`button`,tabIndex:0,onClick:()=>l(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(t.id))},className:`group cursor-pointer p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5 focus:outline-none focus:ring-2 focus:ring-ring ${n?`border-primary/50 bg-brand-gradient-subtle ring-1 ring-primary/30`:``}`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,M.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg font-semibold `+(n?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`:`bg-muted text-muted-foreground group-hover:bg-brand-gradient-subtle group-hover:text-primary`),children:u(t.name)||(0,M.jsx)(my,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`h3`,{className:`truncate text-base font-medium`,children:t.name}),n&&(0,M.jsxs)(sP,{className:`gap-1 border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:[(0,M.jsx)(hy,{className:`h-3 w-3`}),e(`organizations.active`)]})]}),t.slug&&(0,M.jsx)(`code`,{className:`mt-0.5 block font-mono text-xs text-muted-foreground`,children:t.slug})]}),(0,M.jsx)(_y,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]})},t.id)})})]})})})}var dP=la(`/account/`)({component:fP});function fP(){let{t:e}=vt(),{user:t}=QM(),{organizations:n}=$M(),r=[!!t?.emailVerified,!!t?.twoFactorEnabled,!!t?.name,!!t?.image].filter(Boolean).length*25,i=r>=75?`success`:r>=50?`warn`:`danger`,a=(t?.name??t?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),o=[{to:`/account/profile`,label:e(`home.tiles.profile.title`,{defaultValue:`Profile`}),description:e(`home.tiles.profile.description`,{defaultValue:`Display name, avatar and contact info.`}),icon:tb},{to:`/account/security`,label:e(`home.tiles.security.title`,{defaultValue:`Security`}),description:e(`home.tiles.security.description`,{defaultValue:`Change your password and review activity.`}),icon:Ky},{to:`/account/two-factor`,label:e(`home.tiles.twoFactor.title`,{defaultValue:`Two-factor auth`}),description:e(`home.tiles.twoFactor.description`,{defaultValue:`Add an authenticator app for stronger sign-in.`}),icon:Gy},{to:`/account/sessions`,label:e(`home.tiles.sessions.title`,{defaultValue:`Active sessions`}),description:e(`home.tiles.sessions.description`,{defaultValue:`See and revoke devices that are signed in.`}),icon:Ry},{to:`/account/linked-accounts`,label:e(`home.tiles.linked.title`,{defaultValue:`Linked accounts`}),description:e(`home.tiles.linked.description`,{defaultValue:`Manage your social and SSO providers.`}),icon:Py},{to:`/account/oauth-applications`,label:e(`home.tiles.oauth.title`,{defaultValue:`OAuth applications`}),description:e(`home.tiles.oauth.description`,{defaultValue:`Apps you have authorised to access your account.`}),icon:jy}];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-0 opacity-40 mix-blend-soft-light`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(0,0,0,0.25), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 p-6 text-white sm:flex-row sm:items-center sm:gap-6 sm:p-8`,children:[(0,M.jsxs)(UM,{className:`size-16 shrink-0 ring-4 ring-white/30 shadow-md sm:size-20`,children:[t?.image?(0,M.jsx)(WM,{src:t.image,alt:t?.name??``}):null,(0,M.jsx)(GM,{className:`bg-white/20 text-base font-semibold text-white backdrop-blur`,children:a})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-xs uppercase tracking-wider text-white/70`,children:e(`home.welcome`,{defaultValue:`Welcome back`})}),(0,M.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight`,children:t?.name||t?.email||`ObjectStack user`}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-white/80`,children:[(0,M.jsx)(Ly,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`truncate`,children:t?.email}),t?.emailVerified?(0,M.jsx)(sP,{className:`border-white/30 bg-white/15 text-[10px] font-medium text-white backdrop-blur hover:bg-white/20`,children:e(`home.verified`,{defaultValue:`Verified`})}):null]})]})]})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,M.jsx)(pP,{icon:Gy,label:e(`home.stats.score`,{defaultValue:`Security score`}),value:`${r}%`,tone:i,extra:(0,M.jsx)(`div`,{className:`mt-2 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,M.jsx)(`div`,{className:`h-full bg-brand-gradient transition-[width] duration-500`,style:{width:`${r}%`}})})}),(0,M.jsx)(pP,{icon:my,label:e(`home.stats.orgs`,{defaultValue:`Organizations`}),value:String(n.length),extra:(0,M.jsxs)(ra,{to:`/organizations`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[e(`home.stats.manage`,{defaultValue:`Manage`}),(0,M.jsx)(py,{className:`size-3`})]})}),(0,M.jsx)(pP,{icon:t?.twoFactorEnabled?Gy:Ky,label:e(`home.stats.twoFactor`,{defaultValue:`Two-factor auth`}),value:t?.twoFactorEnabled?e(`home.stats.enabled`,{defaultValue:`Enabled`}):e(`home.stats.disabled`,{defaultValue:`Disabled`}),tone:t?.twoFactorEnabled?`success`:`warn`,extra:(0,M.jsxs)(ra,{to:`/account/two-factor`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[t?.twoFactorEnabled?e(`home.stats.review`,{defaultValue:`Review`}):e(`home.stats.enable`,{defaultValue:`Enable now`}),(0,M.jsx)(py,{className:`size-3`})]})})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-muted-foreground`,children:e(`home.quickAccess`,{defaultValue:`Quick access`})}),(0,M.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:o.map(({to:e,label:t,description:n,icon:r})=>(0,M.jsxs)(ra,{to:e,className:`group relative flex items-start gap-3 rounded-lg border bg-card p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:[(0,M.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/10 transition-transform group-hover:scale-110`,children:(0,M.jsx)(r,{className:`size-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,M.jsx)(py,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]}),(0,M.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:n})]})]},e))})]})]})}function pP({icon:e,label:t,value:n,tone:r=`neutral`,extra:i}){let a=r===`success`?`text-emerald-600 dark:text-emerald-400`:r===`warn`?`text-amber-600 dark:text-amber-400`:r===`danger`?`text-destructive`:`text-foreground`;return(0,M.jsx)($,{className:`overflow-hidden`,children:(0,M.jsxs)(wN,{className:`p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:t}),(0,M.jsx)(e,{className:`size-4 ${a}`})]}),(0,M.jsx)(`p`,{className:`mt-1 text-2xl font-semibold tracking-tight ${a}`,children:n}),i]})})}var mP=la(`/organizations/new`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:vP});function hP(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function gP(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function _P(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function vP(){let{t:e}=vt(),t=Hi(),{redirect:n}=mP.useSearch(),{create:r,creating:i}=eN(),{setActiveOrganization:a,reloadOrganizations:o,features:s}=QM(),[c,l]=(0,j.useState)(``),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1);(0,j.useEffect)(()=>{s&&s.multiOrgEnabled===!1&&t({to:`/organizations`})},[s,t]);let m=e=>{l(e),f||d(hP(e))};return(0,M.jsx)(ON,{formWidth:`md`,children:(0,M.jsxs)($,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{className:`text-xl tracking-tight`,children:e(`organizations.new.title`)}),(0,M.jsx)(CN,{children:e(`organizations.new.description`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();try{let t=await r({name:c,slug:u||void 0}),i=t?.data??t,s=i?.id??i?.organization?.id;s&&await a(s).catch(()=>{}),await o().catch(()=>{}),K({title:e(`organizations.new.successToast`)}),gP(n)?window.location.assign(_P(n)):window.location.assign(`/`)}catch(t){K({title:e(`organizations.new.failed`),description:t.message,variant:`destructive`})}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`name`,children:e(`organizations.new.name`)}),(0,M.jsx)(eS,{id:`name`,required:!0,autoFocus:!0,value:c,onChange:e=>m(e.target.value),placeholder:e(`organizations.new.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)(LN,{htmlFor:`slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(eS,{id:`slug`,value:u,onChange:e=>{d(e.target.value),p(!0)},placeholder:e(`organizations.new.slugPlaceholder`),pattern:`[a-z0-9-]+`}),(0,M.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`organizations.new.slugHint`)})]}),(0,M.jsx)(Q,{type:`submit`,className:`w-full`,disabled:i||!c,children:e(i?`organizations.new.submitting`:`organizations.new.submit`)}),(0,M.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,M.jsx)(ra,{to:`/organizations`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`organizations.new.cancel`)})})]})})]})})}var yP=la(`/organizations/$orgId`)({component:bP});function bP(){let{t:e}=vt(),{orgId:t}=yP.useParams(),{organizations:n}=$M(),r=n.find(e=>e.id===t);return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-6 py-8`,children:(0,M.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6`,children:[(0,M.jsxs)(`header`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:r?.name??e(`organizations.title`)}),r?.slug&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground font-mono`,children:r.slug})]}),(0,M.jsx)(ya,{})]})})})}function xP(){let e=Zg(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.oauth?.applications){i(!0),o(null);try{n((await e.oauth.applications.list())?.applications??[])}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{applications:t,loading:r,error:a,reload:s}}function SP(){let e=Zg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(null);return{register:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.register)throw Error(`Client not ready`);n(!0),i(null);try{let n=await e.oauth.applications.register(t);return o(n),n}catch(e){throw i(e),e}finally{n(!1)}},[e]),registering:t,error:r,lastResult:a}}function CP(){let e=Zg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.delete)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.applications.delete(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),deleting:t,error:r}}function wP(){let e=Zg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{submit:(0,j.useCallback)(async t=>{if(!e?.oauth?.consent)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.consent(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),submitting:t,error:r}}var TP=la(`/oauth/consent`)({validateSearch:e=>e,component:EP});function EP(){let{t:e}=vt(),t=Hi(),n=Zg(),{user:r,loading:i}=QM(),{submit:a,submitting:o}=wP(),[s,c]=(0,j.useState)(null),l=typeof window<`u`?window.location.search:``,u=l.startsWith(`?`)?l.slice(1):l,d=new URLSearchParams(u),f=d.get(`client_id`)??void 0,p=d.get(`scope`)??``;(0,j.useEffect)(()=>{i||r||t({to:`/login`,search:{redirect:window.location.pathname+window.location.search}})},[r,i,t]),(0,j.useEffect)(()=>{if(!f||!n?.oauth?.applications?.getPublic)return;let e=!1;return n.oauth.applications.getPublic(f).then(t=>{if(e)return;let n=t?.data??t;c({name:n?.name??n?.client_name,icon:n?.icon??n?.logo_uri})},()=>{}),()=>{e=!0}},[n,f]);let m=p.split(/\s+/).filter(Boolean),h=async t=>{try{let n=await a({accept:t,oauth_query:u}),r=n?.redirect_uri??n?.redirectURI??n?.url;if(r){window.location.href=r;return}K({title:e(t?`oauth.consent.granted`:`oauth.consent.denied`),description:e(`oauth.consent.noRedirect`),variant:t?void 0:`destructive`})}catch(t){K({title:e(`oauth.consent.failed`),description:t.message,variant:`destructive`})}},g=s?.name??f??e(`oauth.consent.unknownApp`);return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-1 items-center justify-center bg-background px-4`,children:(0,M.jsxs)($,{className:`w-full max-w-md`,children:[(0,M.jsxs)(xN,{className:`items-center text-center`,children:[(0,M.jsx)(`div`,{className:`mb-3 rounded-full border bg-muted p-3`,children:s?.icon?(0,M.jsx)(`img`,{src:s.icon,alt:``,className:`h-8 w-8 rounded`,onError:e=>e.currentTarget.style.display=`none`}):(0,M.jsx)(jy,{className:`h-7 w-7 text-muted-foreground`})}),(0,M.jsx)(SN,{className:`text-xl`,children:e(`oauth.consent.title`,{appName:g})}),(0,M.jsx)(CN,{children:e(`oauth.consent.request`,{appName:g,suffix:r?.email?` (${r.email})`:``})})]}),(0,M.jsxs)(wN,{className:`space-y-4`,children:[m.length>0&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:e(`oauth.consent.willAllow`)}),(0,M.jsx)(`ul`,{className:`space-y-1.5 rounded-md border bg-muted/40 p-3 text-sm`,children:m.map(t=>(0,M.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,M.jsx)(hy,{className:`mt-0.5 h-4 w-4 text-green-600 dark:text-green-400`}),(0,M.jsx)(`span`,{children:DP(t,e)})]},t))})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-2`,children:[(0,M.jsxs)(Q,{variant:`outline`,onClick:()=>h(!1),disabled:o,children:[(0,M.jsx)(ib,{className:`mr-2 h-4 w-4`}),e(`oauth.consent.deny`)]}),(0,M.jsxs)(Q,{onClick:()=>h(!0),disabled:o,children:[(0,M.jsx)(hy,{className:`mr-2 h-4 w-4`}),e(o?`oauth.consent.submitting`:`oauth.consent.authorize`)]})]}),(0,M.jsx)(`p`,{className:`pt-2 text-center text-xs text-muted-foreground`,children:e(`oauth.consent.footer`)})]})]})})}function DP(e,t){switch(e){case`openid`:return t(`oauth.consent.scope.openid`);case`profile`:return t(`oauth.consent.scope.profile`);case`email`:return t(`oauth.consent.scope.email`);case`offline_access`:return t(`oauth.consent.scope.offlineAccess`);default:return e}}var OP=la(`/auth/device`)({validateSearch:e=>({user_code:e.user_code??e.code??``}),component:AP});function kP({children:e}){return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:[(0,M.jsxs)(`a`,{href:`#`,className:`flex items-center gap-2 self-center font-medium`,children:[(0,M.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded-md bg-primary text-primary-foreground`,children:(0,M.jsx)(Dy,{className:`size-4`})}),`ObjectStack`]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:e})]})})}function AP(){let{t:e}=vt(),{user_code:t}=OP.useSearch(),{user:n,loading:r}=QM(),i=Hi(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``);return t?r?(0,M.jsx)(kP,{children:(0,M.jsx)($,{children:(0,M.jsx)(xN,{className:`text-center`,children:(0,M.jsx)(CN,{children:e(`auth.device.loading`)})})})}):n?l?(0,M.jsx)(kP,{children:(0,M.jsx)($,{children:(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(by,{className:`h-10 w-10 text-green-500 mx-auto mb-2`}),(0,M.jsx)(SN,{children:e(`auth.device.approvedTitle`)}),(0,M.jsx)(CN,{children:e(`auth.device.approvedDescription`)})]})})}):d?(0,M.jsx)(kP,{children:(0,M.jsx)($,{children:(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{children:e(`auth.device.deniedTitle`)}),(0,M.jsx)(CN,{children:e(`auth.device.deniedDescription`)})]})})}):(0,M.jsx)(kP,{children:(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{children:e(`auth.device.title`)}),(0,M.jsx)(CN,{children:e(`auth.device.subtitle`,{email:n.email})})]}),(0,M.jsxs)(wN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:e(`auth.device.userCodeLabel`)}),(0,M.jsx)(`p`,{className:`font-mono font-semibold tracking-widest text-lg`,children:t})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`p`,{className:`text-sm text-center text-muted-foreground`,children:e(`auth.device.loggedInAs`,{email:n.email})}),p&&(0,M.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:p}),(0,M.jsx)(Q,{onClick:async()=>{m(``),o(!0);try{let n=await fetch(`/api/v1/auth/device/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})});if(!n.ok){let t=await n.json().catch(()=>({}));throw Error(t?.message??t?.error?.message??e(`auth.device.approveFailed`))}u(!0),K({title:e(`auth.device.approveSuccess`),description:e(`auth.device.approveSuccessDescription`)})}catch(t){m(t?.message??e(`auth.device.approveFailed`))}finally{o(!1)}},className:`w-full`,disabled:a||s,children:e(a?`auth.device.approving`:`auth.device.approve`)}),(0,M.jsx)(Q,{onClick:async()=>{m(``),c(!0);try{await fetch(`/api/v1/auth/device/deny`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})}),f(!0)}catch(t){m(t?.message??e(`auth.device.denyFailed`))}finally{c(!1)}},variant:`outline`,className:`w-full`,disabled:a||s,children:e(s?`auth.device.denying`:`auth.device.deny`)}),(0,M.jsx)(`div`,{className:`text-center`,children:(0,M.jsx)(`button`,{type:`button`,className:`text-sm text-muted-foreground underline-offset-4 hover:underline`,onClick:()=>i({to:`/`}),children:e(`auth.device.cancel`)})})]})]})]})}):(0,M.jsx)(Ui,{to:`/login`,search:{redirect:`/auth/device?user_code=${encodeURIComponent(t)}`}}):(0,M.jsx)(kP,{children:(0,M.jsx)($,{children:(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{children:e(`auth.device.invalidTitle`)}),(0,M.jsx)(CN,{children:e(`auth.device.invalidDescription`)})]})})})}var jP=la(`/account/two-factor`)({component:MP});function MP(){let{t:e}=vt(),t=Zg(),{user:n,loading:r,refresh:i}=QM(),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(null),[p,m]=(0,j.useState)(null),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(!1),[T,E]=(0,j.useState)(``),[D,O]=(0,j.useState)(!1),[ee,te]=(0,j.useState)(null);(0,j.useEffect)(()=>{r||o(!!n?.twoFactorEnabled)},[r,n?.twoFactorEnabled]);let ne=async n=>{n.preventDefault(),u(!0);try{let e=await t.auth.twoFactor.enable({password:s});f(e?.totpURI??null),m(e?.backupCodes??null),c(``)}catch(t){K({title:e(`twoFactor.enableFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},re=async n=>{n.preventDefault(),b(!0);try{await t.auth.twoFactor.verifyTotp({code:_,trustDevice:h}),K({title:e(`twoFactor.enableSuccess`)}),o(!0),f(null),v(``),await i()}catch(t){K({title:e(`twoFactor.invalidCode`),description:t.message,variant:`destructive`})}finally{b(!1)}},ie=async n=>{n.preventDefault(),w(!0);try{await t.auth.twoFactor.disable({password:x}),K({title:e(`twoFactor.disableSuccess`)}),o(!1),S(``),te(null),await i()}catch(t){K({title:e(`twoFactor.disableFailed`),description:t.message,variant:`destructive`})}finally{w(!1)}},ae=async n=>{n.preventDefault(),O(!0);try{te((await t.auth.twoFactor.generateBackupCodes({password:T}))?.backupCodes??[]),E(``),K({title:e(`twoFactor.backupCodes.regenerated`)})}catch(t){K({title:e(`twoFactor.backupCodes.regenerateFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}},oe=async t=>{try{await navigator.clipboard.writeText(t.join(`
|
|
148
|
-
`)),K({title:e(`twoFactor.backupCodes.copied`)})}catch{K({title:e(`twoFactor.backupCodes.copyFailed`),variant:`destructive`})}},k=(0,M.jsx)(cP,{icon:Gy,title:e(`twoFactor.title`),description:e(`twoFactor.notEnabledDescription`),actions:a===!0?(0,M.jsx)(sP,{className:`border-transparent bg-emerald-500/15 font-medium text-emerald-600 dark:text-emerald-400`,children:e(`twoFactor.enabled`)}):a===!1?(0,M.jsx)(sP,{variant:`outline`,className:`font-medium`,children:e(`twoFactor.notEnabled`)}):null});if(a===null)return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsx)(xN,{children:(0,M.jsx)(SN,{className:`text-base`,children:e(`twoFactor.loadingStatus`)})}),(0,M.jsxs)(wN,{className:`space-y-2`,children:[(0,M.jsx)(Gw,{className:`h-4 w-48`}),(0,M.jsx)(Gw,{className:`h-9 w-full`}),(0,M.jsx)(Gw,{className:`h-9 w-32`})]})]})]});if(d){let t=`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(d)}`;return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`twoFactor.setupTitle`)}),(0,M.jsx)(CN,{children:e(`twoFactor.setupDescription`)})]}),(0,M.jsxs)(wN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,M.jsx)(`img`,{src:t,alt:e(`twoFactor.qrAlt`),width:200,height:200,className:`rounded border bg-white p-2`}),(0,M.jsx)(`div`,{className:`w-full rounded bg-muted p-3 font-mono text-xs break-all`,children:d}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`twoFactor.uriHint`)})]}),p&&p.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.savedTitle`)}),(0,M.jsxs)(Q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(p),children:[(0,M.jsx)(Ty,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:p.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]}),(0,M.jsx)(cS,{}),(0,M.jsxs)(`form`,{onSubmit:re,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`totp-code`,children:e(`twoFactor.verificationCode`)}),(0,M.jsx)(eS,{id:`totp-code`,placeholder:`000000`,maxLength:6,inputMode:`numeric`,autoComplete:`one-time-code`,value:_,onChange:e=>v(e.target.value),required:!0})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked)}),e(`twoFactor.trustDevice`)]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(Q,{type:`submit`,disabled:y||_.length<6,children:e(y?`twoFactor.verifying`:`twoFactor.verify`)}),(0,M.jsx)(Q,{type:`button`,variant:`outline`,onClick:()=>f(null),children:e(`twoFactor.cancel`)})]})]})]})]})]})}return a===!0?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`twoFactor.enabledTitle`,{defaultValue:`Authenticator app`})}),(0,M.jsx)(CN,{children:e(`twoFactor.enabledDescription`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(`form`,{onSubmit:ie,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`disable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(eS,{id:`disable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsx)(Q,{variant:`destructive`,type:`submit`,disabled:C,children:e(C?`twoFactor.disabling`:`twoFactor.disable`)})]})})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsxs)(SN,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(jy,{className:`h-4 w-4`}),e(`twoFactor.backupCodes.title`)]}),(0,M.jsx)(CN,{children:e(`twoFactor.backupCodes.description`)})]}),(0,M.jsxs)(wN,{className:`space-y-4`,children:[(0,M.jsxs)(`form`,{onSubmit:ae,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`backup-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(eS,{id:`backup-password`,type:`password`,autoComplete:`current-password`,required:!0,value:T,onChange:e=>E(e.target.value)})]}),(0,M.jsxs)(Q,{type:`submit`,variant:`outline`,disabled:D,children:[(0,M.jsx)(Hy,{className:`mr-2 h-4 w-4`}),e(D?`common.saving`:`twoFactor.backupCodes.regenerate`)]})]}),ee&&ee.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.newTitle`)}),(0,M.jsxs)(Q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(ee),children:[(0,M.jsx)(Ty,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:ee.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]})]})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`twoFactor.enable`)}),(0,M.jsx)(CN,{children:e(`twoFactor.notEnabledDescription`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(`form`,{onSubmit:ne,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`enable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(eS,{id:`enable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:e(`twoFactor.passwordPlaceholder`)})]}),(0,M.jsx)(Q,{type:`submit`,disabled:l,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(l?`twoFactor.loading`:`twoFactor.enable`)})]})})]})]})}var NP=[[/Edg\//i,`Edge`],[/OPR\//i,`Opera`],[/Chrome\//i,`Chrome`],[/Firefox\//i,`Firefox`],[/Safari\//i,`Safari`]],PP=[[/Windows NT 10/i,`Windows 10/11`],[/Windows/i,`Windows`],[/Mac OS X|Macintosh/i,`macOS`],[/iPhone|iOS/i,`iOS`],[/iPad/i,`iPadOS`],[/Android/i,`Android`],[/Linux/i,`Linux`]];function FP(e){if(!e)return{browser:`Unknown`,os:`Unknown`,device:`desktop`,label:`Unknown device`,icon:Oy};let t=NP.find(([t])=>t.test(e))?.[1]??`Browser`,n=PP.find(([t])=>t.test(e))?.[1]??`Unknown OS`,r=/iPad|Tablet/i.test(e),i=!r&&/Mobile|Android|iPhone|iPod/i.test(e),a=r?`tablet`:i?`mobile`:`desktop`,o=Ry;return o=a===`mobile`?qy:a===`tablet`?Yy:/Linux|Windows|Mac/i.test(e)?Ry:Oy,{browser:t,os:n,device:a,label:`${t} · ${n}`,icon:o}}var IP=la(`/account/sessions`)({component:LP});function LP(){let{t:e}=vt(),t=Zg(),{session:n}=QM(),[r,i]=(0,j.useState)([]),[a,o]=(0,j.useState)(!0),[s,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(!1),d=async()=>{try{i((await t.auth.sessions.list())?.sessions??[])}catch(t){K({title:e(`sessions.loadFailed`),description:t.message,variant:`destructive`})}finally{o(!1)}};(0,j.useEffect)(()=>{d()},[]);let f=async n=>{c(n);try{await t.auth.sessions.revoke(n),K({title:e(`sessions.revoked`)}),await d()}catch(t){K({title:e(`sessions.revokeFailed`),description:t.message,variant:`destructive`})}finally{c(null)}},p=async()=>{u(!0);try{await t.auth.sessions.revokeOthers(),K({title:e(`sessions.othersRevoked`)}),await d()}catch(t){K({title:e(`sessions.revokeOthersFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},m=n?.token,h=r.find(e=>e.token===m),g=r.filter(e=>e.token!==m);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(cP,{icon:Ry,title:e(`sessions.title`),description:e(`sessions.description`),actions:r.length>1?(0,M.jsxs)(Q,{variant:`outline`,size:`sm`,onClick:p,disabled:l,children:[(0,M.jsx)(Fy,{className:`mr-2 h-4 w-4`}),e(l?`sessions.revokingOthers`:`sessions.revokeOthers`)]}):null}),a&&(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)($,{className:`overflow-hidden`,children:(0,M.jsxs)(wN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(Gw,{className:`size-10 rounded-lg`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(Gw,{className:`h-4 w-40`}),(0,M.jsx)(Gw,{className:`h-3 w-64`})]})]})},e))}),!a&&r.length===0&&(0,M.jsx)($,{children:(0,M.jsxs)(wN,{className:`flex flex-col items-center gap-3 p-10 text-center text-sm text-muted-foreground`,children:[(0,M.jsx)(Ry,{className:`size-10 text-muted-foreground/50`}),e(`sessions.empty`)]})}),!a&&h&&(0,M.jsx)(RP,{session:h,isCurrent:!0,revoking:!1,onRevoke:()=>void 0,t:e}),!a&&g.length>0&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:e(`sessions.otherDevices`,{defaultValue:`Other signed-in devices`})}),(0,M.jsx)(`div`,{className:`space-y-2`,children:g.map(t=>(0,M.jsx)(RP,{session:t,isCurrent:!1,revoking:s===t.token,onRevoke:()=>f(t.token),t:e},t.id))})]})]})}function RP({session:e,isCurrent:t,revoking:n,onRevoke:r,t:i}){let a=FP(e.userAgent),o=a.icon;return(0,M.jsx)($,{className:t?`border-primary/40 bg-brand-gradient-subtle shadow-sm shadow-primary/10`:`transition-colors hover:bg-accent/30`,children:(0,M.jsxs)(wN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg `+(t?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30`:`bg-muted text-muted-foreground`),children:(0,M.jsx)(o,{className:`size-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:a.label}),t&&(0,M.jsx)(sP,{className:`border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:i(`sessions.current`)})]}),(0,M.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[e.ipAddress&&(0,M.jsx)(`span`,{className:`font-mono`,children:e.ipAddress}),(0,M.jsx)(`span`,{children:i(`sessions.expires`,{date:new Date(e.expiresAt).toLocaleDateString()})})]})]}),!t&&(0,M.jsxs)(Q,{variant:`ghost`,size:`sm`,onClick:r,disabled:n,className:`ml-3 shrink-0 text-muted-foreground hover:text-destructive`,children:[(0,M.jsx)(Fy,{className:`mr-1.5 h-4 w-4`}),i(`sessions.revoke`,{defaultValue:`Revoke`})]})]})})}var zP=kw,BP=Aw,VP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(jw,{ref:n,className:Z(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));VP.displayName=jw.displayName;var HP=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(BP,{children:[(0,M.jsx)(VP,{}),(0,M.jsxs)(Mw,{ref:r,className:Z(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 sm:rounded-lg`,e),...n,children:[t,(0,M.jsxs)(Fw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,M.jsx)(ib,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));HP.displayName=Mw.displayName;var UP=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});UP.displayName=`DialogHeader`;var WP=({className:e,...t})=>(0,M.jsx)(`div`,{className:Z(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});WP.displayName=`DialogFooter`;var GP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Nw,{ref:n,className:Z(`text-lg font-semibold leading-none tracking-tight`,e),...t}));GP.displayName=Nw.displayName;var KP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Pw,{ref:n,className:Z(`text-sm text-muted-foreground`,e),...t}));KP.displayName=Pw.displayName;var qP=la(`/account/security`)({component:JP});function JP(){let{t:e}=vt(),t=Zg(),n=Hi(),{user:r,logout:i}=QM(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(!0),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(``),[T,E]=(0,j.useState)(!1);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(cP,{icon:Ky,title:e(`security.title`),description:e(`security.description`)}),(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsxs)(SN,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Ky,{className:`h-4 w-4 text-primary`}),e(`security.changePasswordTitle`,{defaultValue:`Change password`})]}),(0,M.jsx)(CN,{children:e(`security.changePasswordDescription`,{defaultValue:`Use at least 8 characters. Mix letters, numbers and symbols for strength.`})})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),s!==l){K({title:e(`security.passwordsMismatch`),variant:`destructive`});return}m(!0);try{await t.auth.changePassword({currentPassword:a,newPassword:s,revokeOtherSessions:d}),K({title:e(`security.changed`)}),o(``),c(``),u(``)}catch(t){K({title:e(`security.changeFailed`),description:t.message,variant:`destructive`})}finally{m(!1)}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`current-password`,children:e(`security.currentPassword`)}),(0,M.jsx)(eS,{id:`current-password`,type:`password`,autoComplete:`current-password`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`new-password`,children:e(`security.newPassword`)}),(0,M.jsx)(eS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`confirm-new-password`,children:e(`security.confirmPassword`)}),(0,M.jsx)(eS,{id:`confirm-new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),e(`security.revokeOtherSessions`)]}),(0,M.jsx)(Q,{type:`submit`,disabled:p,children:e(p?`common.saving`:`security.submit`)})]})})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsxs)(SN,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Ly,{className:`h-4 w-4 text-primary`}),e(`security.email.title`)]}),(0,M.jsx)(CN,{children:e(`security.email.description`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),!(!h||h===r?.email)){v(!0);try{await t.auth.changeEmail({newEmail:h,callbackURL:window.location.origin+`/login`}),K({title:e(`security.email.requested`),description:e(`security.email.checkInbox`,{email:h})}),g(``)}catch(t){K({title:e(`security.email.requestFailed`),description:t.message,variant:`destructive`})}finally{v(!1)}}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`current-email`,children:e(`security.email.current`)}),(0,M.jsx)(eS,{id:`current-email`,value:r?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`new-email`,children:e(`security.email.new`)}),(0,M.jsx)(eS,{id:`new-email`,type:`email`,value:h,onChange:e=>g(e.target.value),placeholder:e(`security.email.placeholder`),required:!0})]}),(0,M.jsx)(Q,{type:`submit`,disabled:_||!h||h===r?.email,children:e(_?`common.saving`:`security.email.submit`)})]})})]}),(0,M.jsxs)($,{className:`border-destructive/40 bg-destructive/5`,children:[(0,M.jsxs)(xN,{children:[(0,M.jsxs)(SN,{className:`text-base flex items-center gap-2 text-destructive`,children:[(0,M.jsx)(Zy,{className:`h-4 w-4`}),e(`security.delete.title`)]}),(0,M.jsx)(CN,{children:e(`security.delete.description`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(Q,{variant:`destructive`,onClick:()=>b(!0),children:[(0,M.jsx)(Xy,{className:`mr-2 h-4 w-4`}),e(`security.delete.cta`)]})})]}),(0,M.jsx)(zP,{open:y,onOpenChange:b,children:(0,M.jsxs)(HP,{children:[(0,M.jsxs)(UP,{children:[(0,M.jsx)(GP,{children:e(`security.delete.dialogTitle`)}),(0,M.jsx)(KP,{children:e(`security.delete.dialogDescription`,{email:r?.email??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`delete-password`,children:e(`security.delete.password`)}),(0,M.jsx)(eS,{id:`delete-password`,type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`delete-confirm`,children:e(`security.delete.typeEmail`,{email:r?.email??``})}),(0,M.jsx)(eS,{id:`delete-confirm`,value:C,onChange:e=>w(e.target.value),placeholder:r?.email??``})]})]}),(0,M.jsxs)(WP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>b(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:async()=>{if(C!==r?.email){K({title:e(`security.delete.confirmationMismatch`),description:e(`security.delete.confirmationHint`,{email:r?.email??``}),variant:`destructive`});return}E(!0);try{await t.auth.deleteUser({password:x}),K({title:e(`security.delete.success`)});try{await i()}catch{}n({to:`/login`,replace:!0})}catch(t){K({title:e(`security.delete.failed`),description:t.message,variant:`destructive`})}finally{E(!1)}},disabled:T||C!==r?.email,children:e(T?`common.saving`:`security.delete.confirm`)})]})]})})]})}var YP=la(`/account/profile`)({component:XP});function XP(){let{t:e}=vt(),t=Zg(),{user:n,refresh:r}=QM(),[i,a]=(0,j.useState)(n?.name??``),[o,s]=(0,j.useState)(n?.image??null),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=(0,j.useRef)(null);(0,j.useEffect)(()=>{a(n?.name??``),s(n?.image??null)},[n?.id,n?.name,n?.image]);let p=async n=>{n.preventDefault(),l(!0);try{await t.auth.updateUser({name:i,image:o}),await r(),K({title:e(`profile.updated`)})}catch(t){K({title:e(`profile.updateFailed`),description:t.message,variant:`destructive`})}finally{l(!1)}},m=()=>f.current?.click(),h=async n=>{let i=n.target.files?.[0];if(n.target.value=``,i){d(!0);try{if(!t?.storage?.upload)throw Error(e(`profile.avatarStorageUnavailable`));let n=await t.storage.upload(i,`user`),a=n?.data?.url??n?.url;if(!a)throw Error(`Upload returned no URL`);s(a),await t.auth.updateUser({image:a}),await r(),K({title:e(`profile.avatarUpdated`)})}catch(t){K({title:e(`profile.avatarUploadFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}}},g=(n?.name??n?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 opacity-30`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%)`},"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`relative px-5 pb-5 pt-12 sm:px-6 sm:pb-6 sm:pt-16`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-end sm:gap-5`,children:[(0,M.jsxs)(UM,{className:`size-20 shrink-0 ring-4 ring-card shadow-md`,children:[o?(0,M.jsx)(WM,{src:o,alt:n?.name??``}):null,(0,M.jsx)(GM,{className:`bg-brand-gradient text-base font-semibold text-primary-foreground`,children:g})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`h2`,{className:`truncate text-xl font-semibold tracking-tight`,children:n?.name||e(`profile.namePlaceholder`)}),(0,M.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:n?.email})]}),(0,M.jsxs)(Q,{type:`button`,variant:`outline`,size:`sm`,onClick:m,disabled:u,className:`self-start sm:self-auto`,children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(u?`profile.avatarUploading`:`profile.changeAvatar`)]}),(0,M.jsx)(`input`,{ref:f,type:`file`,accept:`image/*`,className:`hidden`,onChange:h})]})})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`profile.title`)}),(0,M.jsx)(CN,{children:e(`profile.description`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(`form`,{onSubmit:p,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`profile-email`,children:e(`profile.email`)}),(0,M.jsx)(eS,{id:`profile-email`,value:n?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)(LN,{htmlFor:`profile-name`,children:e(`profile.name`)}),(0,M.jsx)(eS,{id:`profile-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`profile.namePlaceholder`)})]}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`profile.avatarHint`)}),(0,M.jsx)(Q,{type:`submit`,disabled:c,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(c?`common.saving`:`profile.save`)})]})})]})]})}var ZP=la(`/account/linked-accounts`)({component:$P}),QP={google:`Google`,github:`GitHub`,microsoft:`Microsoft`,apple:`Apple`,discord:`Discord`,gitlab:`GitLab`,twitter:`Twitter / X`,facebook:`Facebook`};function $P(){let{t:e}=vt(),t=Zg(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!0),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(t?.auth?.accounts){a(!0);try{let e=await t.auth.accounts.list();r(e?.accounts??e?.data??(Array.isArray(e)?e:[]))}catch{r([])}finally{a(!1)}}},[t]);(0,j.useEffect)(()=>{c()},[c]);let l=async n=>{if(confirm(e(`linkedAccounts.unlinkConfirm`,{provider:QP[n.providerId]??n.providerId}))){s(n.id);try{await t.auth.accounts.unlink({providerId:n.providerId,accountId:n.accountId}),K({title:e(`linkedAccounts.unlinked`)}),await c()}catch(t){K({title:e(`linkedAccounts.unlinkFailed`),description:t.message,variant:`destructive`})}finally{s(null)}}},u=async n=>{try{let r=await t.auth.accounts.linkSocial({provider:n,callbackURL:window.location.href}),i=r?.url??r?.data?.url;i?window.location.assign(i):K({title:e(`linkedAccounts.linkFailed`),variant:`destructive`})}catch(t){K({title:e(`linkedAccounts.linkFailed`),description:t.message,variant:`destructive`})}},d=new Set(n.map(e=>e.providerId)),f=Object.keys(QP).filter(e=>!d.has(e));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(cP,{icon:Py,title:e(`linkedAccounts.title`),description:e(`linkedAccounts.description`)}),(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`linkedAccounts.connectedTitle`,{defaultValue:`Connected providers`})}),(0,M.jsx)(CN,{children:e(`linkedAccounts.connectedDescription`,{defaultValue:`Sign-in providers currently linked to this account.`})})]}),(0,M.jsxs)(wN,{children:[i&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(Gw,{className:`h-12 w-full`}),(0,M.jsx)(Gw,{className:`h-12 w-full`})]}),!i&&n.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(Py,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`linkedAccounts.empty`)})]}),!i&&n.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:n.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(sP,{variant:`secondary`,children:QP[t.providerId]??t.providerId}),t.createdAt&&(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`linkedAccounts.linkedOn`,{date:new Date(t.createdAt).toLocaleDateString()})})]}),(0,M.jsxs)(Q,{variant:`ghost`,size:`sm`,disabled:o===t.id,onClick:()=>l(t),children:[(0,M.jsx)(Ny,{className:`mr-1 h-4 w-4`}),e(`linkedAccounts.unlink`)]})]},t.id))})]})]}),f.length>0&&(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`linkedAccounts.addTitle`)}),(0,M.jsx)(CN,{children:e(`linkedAccounts.addDescription`)})]}),(0,M.jsx)(wN,{children:(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:f.map(e=>(0,M.jsxs)(Q,{variant:`outline`,size:`sm`,onClick:()=>u(e),children:[(0,M.jsx)(Vy,{className:`mr-1 h-3 w-3`}),QP[e]]},e))})})]})]})}function eF(e){let t=Zg(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations)){a(!0),s(null);try{let n=await t.organizations.listMembers(e);r(n?.members??n?.data?.members??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{members:n,loading:i,error:o,reload:c,inviteMember:(0,j.useCallback)(async(n,r=`member`)=>{if(!e||!t?.organizations)throw Error(`Organization ID or client not available`);let i=await t.organizations.invite({email:n,role:r,organizationId:e});return await c(),i},[t,e,c]),removeMember:(0,j.useCallback)(async n=>{if(!e||!t?.organizations?.removeMember)throw Error(`Organization ID or client not available`);let r=await t.organizations.removeMember(e,{memberIdOrEmail:n});return await c(),r},[t,e,c]),updateMemberRole:(0,j.useCallback)(async(n,r)=>{if(!e||!t?.organizations?.updateMemberRole)throw Error(`Organization ID or client not available`);let i=await t.organizations.updateMemberRole(e,{memberId:n,role:r});return await c(),i},[t,e,c])}}function tF(e){let t=Zg(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations?.invitations)){a(!0),s(null);try{let n=await t.organizations.invitations.list(e);r(n?.invitations??n?.data?.invitations??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{invitations:n,loading:i,error:o,reload:c,cancelInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.cancel)throw Error(`Client not available`);let n=await t.organizations.invitations.cancel(e);return await c(),n},[t,c]),resendInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.resend)throw Error(`Client not available`);let n=await t.organizations.invitations.resend({id:e.id,email:e.email,role:e.role,organizationId:e.organizationId,teamId:e.teamId??null});return await c(),n},[t,c])}}function nF(){let e=Zg(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.organizations?.invitations?.listMine){i(!0),o(null);try{let t=await e.organizations.invitations.listMine();n(t?.invitations??t?.data?.invitations??(Array.isArray(t)?t:[]))}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{invitations:t,loading:r,error:a,reload:s,accept:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.accept(t);return await s(),n},[e,s]),reject:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.reject(t);return await s(),n},[e,s])}}var rF=la(`/account/invitations`)({component:iF});function iF(){let{t:e}=vt(),{invitations:t,loading:n,accept:r,reject:i}=nF(),a=t.filter(e=>e.status===`pending`),o=async t=>{try{await r(t),K({title:e(`invitations.accepted`)})}catch(t){K({title:e(`invitations.acceptFailed`),description:t.message,variant:`destructive`})}},s=async t=>{try{await i(t),K({title:e(`invitations.rejected`)})}catch(t){K({title:e(`invitations.rejectFailed`),description:t.message,variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(cP,{icon:Ay,title:e(`invitations.title`),description:e(`invitations.description`),actions:a.length>0?(0,M.jsx)(sP,{variant:`outline`,className:`font-medium`,children:e(`invitations.pendingCount`,{count:a.length,defaultValue:`{{count}} pending`})}):null}),(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`invitations.pendingTitle`,{defaultValue:`Pending invitations`})}),(0,M.jsx)(CN,{children:e(`invitations.pendingDescription`,{defaultValue:`Accept to join an organization, or reject to remove it from your inbox.`})})]}),(0,M.jsxs)(wN,{children:[n&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(Gw,{className:`h-12 w-full`}),(0,M.jsx)(Gw,{className:`h-12 w-full`})]}),!n&&a.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(Ay,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`invitations.empty`)})]}),!n&&a.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:a.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`text-sm font-medium`,children:t.organizationId}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(sP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`invitations.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(Q,{size:`sm`,onClick:()=>o(t.id),children:[(0,M.jsx)(hy,{className:`mr-1 h-4 w-4`}),e(`invitations.accept`)]}),(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:()=>s(t.id),children:[(0,M.jsx)(ib,{className:`mr-1 h-4 w-4`}),e(`invitations.reject`)]})]})]},t.id))})]})]})]})}var aF=la(`/accept-invitation/$invitationId`)({component:oF});function oF(){let{t:e}=vt(),{invitationId:t}=aF.useParams(),n=Hi(),r=Zg(),{user:i,loading:a,reloadOrganizations:o}=QM(),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{a||i||n({to:`/login`,search:{redirect:`/accept-invitation/${t}`},replace:!0})},[a,i,t,n]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{className:`text-center`,children:[(0,M.jsx)(SN,{className:`text-xl`,children:e(`acceptInvitation.title`)}),(0,M.jsx)(CN,{children:e(`acceptInvitation.description`)})]}),(0,M.jsxs)(wN,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(Q,{className:`w-full`,onClick:async()=>{c(!0);try{await r.organizations.invitations.accept(t),await o().catch(()=>{}),K({title:e(`acceptInvitation.accepted`)}),n({to:`/organizations`})}catch(t){K({title:e(`acceptInvitation.acceptFailed`),description:t.message,variant:`destructive`})}finally{c(!1)}},disabled:s||l,children:e(s?`acceptInvitation.accepting`:`acceptInvitation.accept`)}),(0,M.jsx)(Q,{variant:`outline`,className:`w-full`,onClick:async()=>{u(!0);try{await r.organizations.invitations.reject(t),K({title:e(`acceptInvitation.declined`)}),n({to:`/organizations`})}catch(t){K({title:e(`acceptInvitation.declineFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},disabled:s||l,children:e(l?`acceptInvitation.declining`:`acceptInvitation.decline`)})]})]})})})}var sF=la(`/organizations/$orgId/`)({component:()=>{let{orgId:e}=sF.useParams();return(0,M.jsx)(Ui,{to:`/organizations/$orgId/general`,params:{orgId:e},replace:!0})}}),cF=la(`/account/oauth-applications/`)({component:lF});function lF(){let{t:e}=vt(),t=Hi(),{applications:n,loading:r,reload:i}=xP(),{remove:a,deleting:o}=CP(),[s,c]=(0,j.useState)(null);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(cP,{icon:jy,title:e(`oauth.applications.title`),description:e(`oauth.applications.description`),actions:(0,M.jsxs)(Q,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.new`)]})}),r?(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)($,{children:(0,M.jsxs)(wN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(Gw,{className:`size-10 rounded-md`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(Gw,{className:`h-4 w-40`}),(0,M.jsx)(Gw,{className:`h-3 w-64`})]})]})},e))}):n.length===0?(0,M.jsx)($,{children:(0,M.jsxs)(wN,{className:`flex flex-col items-center gap-3 p-12 text-center`,children:[(0,M.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(jy,{className:`h-6 w-6`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:e(`oauth.applications.emptyTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.emptyDescription`)})]}),(0,M.jsxs)(Q,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.register`)]})]})}):(0,M.jsx)(`div`,{className:`grid gap-3`,children:n.map(t=>(0,M.jsx)($,{className:`group transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:(0,M.jsx)(xN,{className:`pb-3`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsxs)(ra,{to:`/account/oauth-applications/$clientId`,params:{clientId:t.client_id},className:`flex flex-1 items-center gap-3`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/15 transition-transform group-hover:scale-105`,children:(0,M.jsx)(jy,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(SN,{className:`text-base`,children:t.name}),(0,M.jsx)(CN,{className:`font-mono text-xs`,children:t.client_id})]}),(0,M.jsx)(sP,{variant:`outline`,className:`capitalize`,children:t.type}),t.disabled&&(0,M.jsx)(sP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]}),(0,M.jsx)(Q,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:e=>{e.preventDefault(),e.stopPropagation(),c(t)},children:(0,M.jsx)(Xy,{className:`h-4 w-4`})})]})})},t.id))}),(0,M.jsx)(zP,{open:!!s,onOpenChange:e=>!e&&c(null),children:(0,M.jsxs)(HP,{children:[(0,M.jsxs)(UP,{children:[(0,M.jsx)(GP,{children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(KP,{children:e(`oauth.applications.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsxs)(WP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>c(null),disabled:o,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:async()=>{if(s)try{await a(s.client_id),K({title:e(`oauth.applications.deleted`)}),c(null),await i()}catch(t){K({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}},disabled:o,children:e(o?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}function uF(e,[t,n]){return Math.min(n,Math.max(t,e))}function dF(e){let t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var fF=[` `,`Enter`,`ArrowUp`,`ArrowDown`],pF=[` `,`Enter`],mF=`Select`,[hF,gF,_F]=S_(mF),[vF,yF]=p_(mF,[_F,uD]),bF=uD(),[xF,SF]=vF(mF),[CF,wF]=vF(mF),TF=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=bF(t),[g,_]=j.useState(null),[v,y]=j.useState(null),[b,x]=j.useState(!1),S=ak(l),[C,w]=Z_({prop:r,defaultProp:i??!1,onChange:a,caller:mF}),[T,E]=Z_({prop:o,defaultProp:s,onChange:c,caller:mF}),D=j.useRef(null),O=g?m||!!g.closest(`form`):!0,[ee,te]=j.useState(new Set),ne=Array.from(ee).map(e=>e.props.value).join(`;`);return(0,M.jsx)(ED,{...h,children:(0,M.jsxs)(xF,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:dS(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,M.jsx)(hF.Provider,{scope:t,children:(0,M.jsx)(CF,{scope:e.__scopeSelect,onNativeOptionAdd:j.useCallback(e=>{te(t=>new Set(t).add(e))},[]),onNativeOptionRemove:j.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,M.jsxs)(bI,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,M.jsx)(`option`,{value:``}):null,Array.from(ee)]},ne):null]})})};TF.displayName=mF;var EF=`SelectTrigger`,DF=j.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=bF(n),o=SF(EF,n),s=o.disabled||r,c=d_(t,o.onTriggerChange),l=gF(n),u=j.useRef(`touch`),[d,f,p]=SI(e=>{let t=l().filter(e=>!e.disabled),n=CI(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,M.jsx)(DD,{asChild:!0,...a,children:(0,M.jsx)(C_.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":xI(o.value)?``:void 0,...i,ref:c,onClick:q(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:q(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:q(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&fF.includes(e.key)&&(m(),e.preventDefault())})})})});DF.displayName=EF;var OF=`SelectValue`,kF=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=SF(OF,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=d_(t,c.onValueNodeChange);return H_(()=>{l(u)},[l,u]),(0,M.jsx)(C_.span,{...s,ref:d,style:{pointerEvents:`none`},children:xI(c.value)?(0,M.jsx)(M.Fragment,{children:o}):a})});kF.displayName=OF;var AF=`SelectIcon`,jF=j.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,M.jsx)(C_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});jF.displayName=AF;var MF=`SelectPortal`,NF=e=>(0,M.jsx)(W_,{asChild:!0,...e});NF.displayName=MF;var PF=`SelectContent`,FF=j.forwardRef((e,t)=>{let n=SF(PF,e.__scopeSelect),[r,i]=j.useState();if(H_(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Gi.createPortal((0,M.jsx)(LF,{scope:e.__scopeSelect,children:(0,M.jsx)(hF.Slot,{scope:e.__scopeSelect,children:(0,M.jsx)(`div`,{children:e.children})})}),t):null}return(0,M.jsx)(VF,{...e,ref:t})});FF.displayName=PF;var IF=10,[LF,RF]=vF(PF),zF=`SelectContentImpl`,BF=h_(`SelectContent.RemoveScroll`),VF=j.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=SF(PF,n),[y,b]=j.useState(null),[x,S]=j.useState(null),C=d_(t,e=>b(e)),[w,T]=j.useState(null),[E,D]=j.useState(null),O=gF(n),[ee,te]=j.useState(!1),ne=j.useRef(!1);j.useEffect(()=>{if(y)return JC(y)},[y]),kS();let re=j.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),ie=j.useCallback(()=>re([w,y]),[re,w,y]);j.useEffect(()=>{ee&&ie()},[ee,ie]);let{onOpenChange:ae,triggerPointerDownPosRef:oe}=v;j.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(oe.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(oe.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||ae(!1),document.removeEventListener(`pointermove`,t),oe.current=null};return oe.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,ae,oe]),j.useEffect(()=>{let e=()=>ae(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ae]);let[k,se]=SI(e=>{let t=O().filter(e=>!e.disabled),n=CI(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ce=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(ne.current=!0))},[v.value]),le=j.useCallback(()=>y?.focus(),[y]),ue=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),A=r===`popper`?GF:UF,de=A===GF?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,M.jsx)(LF,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ce,selectedItem:w,onItemLeave:le,itemTextRefCallback:ue,focusSelectedItem:ie,selectedItemText:E,position:r,isPositioned:ee,searchRef:k,children:(0,M.jsx)(zC,{as:BF,allowPinchZoom:!0,children:(0,M.jsx)(gS,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:q(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,M.jsx)(N_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,M.jsx)(A,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...de,onPlaced:()=>te(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:q(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&se(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>re(t)),e.preventDefault()}})})})})})})});VF.displayName=zF;var HF=`SelectItemAlignedPosition`,UF=j.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=SF(PF,n),o=RF(PF,n),[s,c]=j.useState(null),[l,u]=j.useState(null),d=d_(t,e=>u(e)),f=gF(n),p=j.useRef(!1),m=j.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=j.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-IF,d=uF(a,[IF,Math.max(IF,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-IF,d=uF(a,[IF,Math.max(IF,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-IF*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-IF,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,te=m+v+ee,ne=x-te;if(te<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=te+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ne;s.style.height=t+`px`,h.scrollTop=te-E+h.offsetTop}s.style.margin=`${IF}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);H_(()=>y(),[y]);let[b,x]=j.useState();return H_(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,M.jsx)(KF,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:j.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,M.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,M.jsx)(C_.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});UF.displayName=HF;var WF=`SelectPopperPosition`,GF=j.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=IF,...a}=e,o=bF(n);return(0,M.jsx)(OD,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});GF.displayName=WF;var[KF,qF]=vF(PF,{}),JF=`SelectViewport`,YF=j.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=RF(JF,n),o=qF(JF,n),s=d_(t,a.onViewportChange),c=j.useRef(0);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,M.jsx)(hF.Slot,{scope:n,children:(0,M.jsx)(C_.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:q(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-IF*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});YF.displayName=JF;var XF=`SelectGroup`,[ZF,QF]=vF(XF),$F=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=dS();return(0,M.jsx)(ZF,{scope:n,id:i,children:(0,M.jsx)(C_.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});$F.displayName=XF;var eI=`SelectLabel`,tI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=QF(eI,n);return(0,M.jsx)(C_.div,{id:i.id,...r,ref:t})});tI.displayName=eI;var nI=`SelectItem`,[rI,iI]=vF(nI),aI=j.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=SF(nI,n),c=RF(nI,n),l=s.value===r,[u,d]=j.useState(a??``),[f,p]=j.useState(!1),m=d_(t,e=>c.itemRefCallback?.(e,r,i)),h=dS(),g=j.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,M.jsx)(rI,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:j.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,M.jsx)(hF.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,M.jsx)(C_.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:q(o.onFocus,()=>p(!0)),onBlur:q(o.onBlur,()=>p(!1)),onClick:q(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:q(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:q(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:q(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:q(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:q(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(pF.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});aI.displayName=nI;var oI=`SelectItemText`,sI=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=SF(oI,n),s=RF(oI,n),c=iI(oI,n),l=wF(oI,n),[u,d]=j.useState(null),f=d_(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=j.useMemo(()=>(0,M.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return H_(()=>(h(m),()=>g(m)),[h,g,m]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(C_.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Gi.createPortal(a.children,o.valueNode):null]})});sI.displayName=oI;var cI=`SelectItemIndicator`,lI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return iI(cI,n).isSelected?(0,M.jsx)(C_.span,{"aria-hidden":!0,...r,ref:t}):null});lI.displayName=cI;var uI=`SelectScrollUpButton`,dI=j.forwardRef((e,t)=>{let n=RF(uI,e.__scopeSelect),r=qF(uI,e.__scopeSelect),[i,a]=j.useState(!1),o=d_(t,r.onScrollButtonChange);return H_(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(mI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});dI.displayName=uI;var fI=`SelectScrollDownButton`,pI=j.forwardRef((e,t)=>{let n=RF(fI,e.__scopeSelect),r=qF(fI,e.__scopeSelect),[i,a]=j.useState(!1),o=d_(t,r.onScrollButtonChange);return H_(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(mI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});pI.displayName=fI;var mI=j.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=RF(`SelectScrollButton`,n),o=j.useRef(null),s=gF(n),c=j.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return j.useEffect(()=>()=>c(),[c]),H_(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,M.jsx)(C_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:q(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:q(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:q(i.onPointerLeave,()=>{c()})})}),hI=`SelectSeparator`,gI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,M.jsx)(C_.div,{"aria-hidden":!0,...r,ref:t})});gI.displayName=hI;var _I=`SelectArrow`,vI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=bF(n),a=SF(_I,n),o=RF(_I,n);return a.open&&o.position===`popper`?(0,M.jsx)(kD,{...i,...r,ref:t}):null});vI.displayName=_I;var yI=`SelectBubbleInput`,bI=j.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=j.useRef(null),a=d_(r,i),o=dF(t);return j.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,M.jsx)(C_.select,{...n,style:{...ev,...n.style},ref:a,defaultValue:t})});bI.displayName=yI;function xI(e){return e===``||e===void 0}function SI(e){let t=T_(e),n=j.useRef(``),r=j.useRef(0),i=j.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=j.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function CI(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=wI(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function wI(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var TI=TF,EI=DF,DI=kF,OI=jF,kI=NF,AI=FF,jI=YF,MI=tI,NI=aI,PI=sI,FI=lI,II=dI,LI=pI,RI=gI,zI=TI,BI=DI,VI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(EI,{ref:r,className:Z(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,M.jsx)(OI,{asChild:!0,children:(0,M.jsx)(gy,{className:`h-4 w-4 opacity-50`})})]}));VI.displayName=EI.displayName;var HI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(II,{ref:n,className:Z(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(vy,{className:`h-4 w-4`})}));HI.displayName=II.displayName;var UI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(LI,{ref:n,className:Z(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(gy,{className:`h-4 w-4`})}));UI.displayName=LI.displayName;var WI=j.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,M.jsx)(kI,{children:(0,M.jsxs)(AI,{ref:i,className:Z(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,M.jsx)(HI,{}),(0,M.jsx)(jI,{className:Z(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,M.jsx)(UI,{})]})}));WI.displayName=AI.displayName;var GI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(MI,{ref:n,className:Z(`px-2 py-1.5 text-sm font-semibold`,e),...t}));GI.displayName=MI.displayName;var KI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(NI,{ref:r,className:Z(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(FI,{children:(0,M.jsx)(hy,{className:`h-4 w-4`})})}),(0,M.jsx)(PI,{children:t})]}));KI.displayName=NI.displayName;var qI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(RI,{ref:n,className:Z(`-mx-1 my-1 h-px bg-muted`,e),...t}));qI.displayName=RI.displayName;var JI=la(`/organizations/$orgId/teams`)({component:YI});function YI(){let{t:e}=vt(),{orgId:t}=JI.useParams(),n=Zg(),{members:r}=eF(t),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(null),[g,_]=(0,j.useState)([]),[v,y]=(0,j.useState)(!1),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``),w=(0,j.useCallback)(async()=>{if(n?.organizations?.teams){s(!0);try{a((await n.organizations.teams.list(t))?.teams??[])}catch{a([])}finally{s(!1)}}},[n,t]);(0,j.useEffect)(()=>{w()},[w]);let T=(0,j.useCallback)(async e=>{if(n?.organizations?.teams){y(!0);try{_((await n.organizations.teams.listMembers(e))?.members??[])}catch{_([])}finally{y(!1)}}},[n]);(0,j.useEffect)(()=>{m&&T(m)},[m,T]);let E=async r=>{if(r.preventDefault(),u.trim()){p(!0);try{await n.organizations.teams.create({name:u.trim(),organizationId:t}),K({title:e(`teams.created`)}),l(!1),d(``),await w()}catch(t){K({title:e(`teams.createFailed`),description:t.message,variant:`destructive`})}finally{p(!1)}}},D=async r=>{if(confirm(e(`teams.deleteConfirm`,{name:r.name})))try{await n.organizations.teams.delete({teamId:r.id,organizationId:t}),K({title:e(`teams.deleted`)}),m===r.id&&h(null),await w()}catch(t){K({title:e(`teams.deleteFailed`),description:t.message,variant:`destructive`})}},O=async()=>{if(!(!m||!S))try{await n.organizations.teams.addMember({teamId:m,userId:S}),K({title:e(`teams.memberAdded`)}),x(!1),C(``),await T(m)}catch(t){K({title:e(`teams.addMemberFailed`),description:t.message,variant:`destructive`})}},ee=async(t,r)=>{try{await n.organizations.teams.removeMember({teamId:t,userId:r}),K({title:e(`teams.memberRemoved`)}),await T(t)}catch(t){K({title:e(`teams.removeMemberFailed`),description:t.message,variant:`destructive`})}},te=Object.fromEntries(r.map(e=>[e.userId,e])),ne=new Set(g.map(e=>e.userId)),re=r.filter(e=>!ne.has(e.userId));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)($,{children:[(0,M.jsx)(xN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`teams.title`,{count:i.length})}),(0,M.jsx)(CN,{children:e(`teams.description`)})]}),(0,M.jsxs)(Q,{size:`sm`,onClick:()=>l(!0),children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`teams.create`)]})]})}),(0,M.jsxs)(wN,{children:[o&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(Gw,{className:`h-12 w-full`}),(0,M.jsx)(Gw,{className:`h-12 w-full`})]}),!o&&i.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(nb,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`teams.empty`)})]}),!o&&i.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:i.map(t=>(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`flex-1 text-left`,onClick:()=>h(m===t.id?null:t.id),children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.name}),t.createdAt&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:new Date(t.createdAt).toLocaleDateString()})]}),(0,M.jsxs)(tM,{children:[(0,M.jsx)(nM,{asChild:!0,children:(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(Ey,{className:`h-4 w-4`})})}),(0,M.jsx)(aM,{align:`end`,children:(0,M.jsxs)(oM,{className:`text-destructive`,onClick:()=>D(t),children:[(0,M.jsx)(Xy,{className:`mr-2 h-4 w-4`}),e(`teams.delete`)]})})]})]}),m===t.id&&(0,M.jsxs)(`div`,{className:`pb-3 pl-4 border-l-2 ml-2 space-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e(`teams.members`,{count:g.length})}),(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:()=>x(!0),children:[(0,M.jsx)(eb,{className:`mr-1 h-3 w-3`}),e(`teams.addMember`)]})]}),v&&(0,M.jsx)(Gw,{className:`h-8 w-full`}),!v&&g.length===0&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`teams.noMembers`)}),!v&&g.map(e=>{let n=te[e.userId];return(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,M.jsx)(`span`,{className:`text-sm`,children:n?.user?.name||n?.user?.email||e.userId}),(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>ee(t.id,e.userId),children:(0,M.jsx)($y,{className:`h-3 w-3`})})]},e.id)})]})]},t.id))})]})]}),(0,M.jsx)(zP,{open:c,onOpenChange:l,children:(0,M.jsxs)(HP,{children:[(0,M.jsxs)(UP,{children:[(0,M.jsx)(GP,{children:e(`teams.createTitle`)}),(0,M.jsx)(KP,{children:e(`teams.createDescription`)})]}),(0,M.jsxs)(`form`,{onSubmit:E,children:[(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`team-name`,children:e(`teams.nameLabel`)}),(0,M.jsx)(eS,{id:`team-name`,required:!0,placeholder:e(`teams.namePlaceholder`),value:u,onChange:e=>d(e.target.value)})]})}),(0,M.jsxs)(WP,{children:[(0,M.jsx)(Q,{variant:`outline`,type:`button`,onClick:()=>l(!1),children:e(`common.cancel`)}),(0,M.jsx)(Q,{type:`submit`,disabled:f,children:e(f?`common.saving`:`teams.create`)})]})]})]})}),(0,M.jsx)(zP,{open:b,onOpenChange:x,children:(0,M.jsxs)(HP,{children:[(0,M.jsxs)(UP,{children:[(0,M.jsx)(GP,{children:e(`teams.addMemberTitle`)}),(0,M.jsx)(KP,{children:e(`teams.addMemberDescription`)})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{children:e(`teams.selectMember`)}),(0,M.jsxs)(zI,{value:S,onValueChange:C,children:[(0,M.jsx)(VI,{children:(0,M.jsx)(BI,{placeholder:e(`teams.selectMemberPlaceholder`)})}),(0,M.jsx)(WI,{children:re.map(e=>(0,M.jsx)(KI,{value:e.userId,children:e.user?.name||e.user?.email||e.userId},e.userId))})]})]})}),(0,M.jsxs)(WP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>x(!1),children:e(`common.cancel`)}),(0,M.jsx)(Q,{onClick:O,disabled:!S,children:e(`teams.addMember`)})]})]})})]})}var XI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`textarea`,{className:Z(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));XI.displayName=`Textarea`;var ZI=la(`/organizations/$orgId/members`)({component:QI});function QI(){let{t:e}=vt(),{orgId:t}=ZI.useParams(),{organizations:n}=$M(),{user:r}=QM(),i=Zg(),a=n.find(e=>e.id===t),{members:o,loading:s,inviteMember:c,removeMember:l,updateMemberRole:u}=eF(t),{invitations:d,loading:f,cancelInvitation:p,resendInvitation:m}=tF(t),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(``),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(`member`),[T,E]=(0,j.useState)(!1),[D,O]=(0,j.useState)(!1),ee=d.filter(e=>e.status===`pending`),te=o.find(e=>e.userId===r?.id),ne=te?.role===`owner`||te?.role===`admin`,re=async()=>{let t=_?x.split(/[,;\n]+/).map(e=>e.trim()).filter(Boolean):[y.trim()].filter(Boolean);if(t.length===0){K({title:e(`organizations.members.emailRequired`),variant:`destructive`});return}E(!0);let n=0;try{for(let e of t)try{await c(e,C)}catch{n++}n>0&&n<t.length?K({title:e(`organizations.members.invitePartialSuccess`,{sent:t.length-n,failed:n}),variant:`destructive`}):n===t.length?K({title:e(`organizations.members.inviteFailed`),variant:`destructive`}):K({title:e(`organizations.members.invitationSent`)}),g(!1),b(``),S(``),w(`member`)}finally{E(!1)}},ie=async(t,n)=>{if(confirm(e(`organizations.members.removeConfirm`,{name:n})))try{await l(t),K({title:e(`organizations.members.memberRemoved`)})}catch(t){K({title:e(`organizations.members.removeFailed`),description:t.message,variant:`destructive`})}},ae=async(t,n)=>{try{await u(t,n),K({title:e(`organizations.members.roleUpdated`)})}catch(t){K({title:e(`organizations.members.roleUpdateFailed`),description:t.message,variant:`destructive`})}},oe=async()=>{if(confirm(e(`organizations.members.leaveConfirm`,{org:a?.name??t}))){O(!0);try{await i.organizations.leave(t),K({title:e(`organizations.members.leftOrg`)}),window.location.assign(`/`)}catch(t){K({title:e(`organizations.members.leaveFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}}},k=async(t,n)=>{if(confirm(e(`organizations.members.cancelConfirm`,{email:n})))try{await p(t),K({title:e(`organizations.members.invitationCanceled`)})}catch(t){K({title:e(`organizations.members.cancelFailed`),description:t.message,variant:`destructive`})}},se=async t=>{try{await m(t),K({title:e(`organizations.members.invitationResent`)})}catch(t){K({title:e(`organizations.members.resendFailed`),description:t.message,variant:`destructive`})}},ce=async t=>{let n=`${window.location.origin}/accept-invitation/${t}`;try{await navigator.clipboard.writeText(n),K({title:e(`organizations.members.linkCopied`)})}catch{K({title:e(`organizations.members.linkCopyFailed`),variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)($,{children:[(0,M.jsx)(xN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`organizations.members.title`,{count:o.length})}),(0,M.jsx)(CN,{children:e(`organizations.members.description`)})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[te&&te.role!==`owner`&&(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:oe,disabled:D,children:[(0,M.jsx)(Fy,{className:`mr-2 h-4 w-4`}),e(`organizations.members.leave`)]}),ne&&(0,M.jsxs)(Q,{size:`sm`,onClick:()=>g(!0),children:[(0,M.jsx)(eb,{className:`mr-2 h-4 w-4`}),e(`organizations.members.invite`)]})]})]})}),(0,M.jsxs)(wN,{children:[s&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingMembers`)}),!s&&o.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(rb,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.empty`)})]}),!s&&o.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:o.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsxs)(`div`,{className:`font-medium text-sm`,children:[t.user?.name||t.user?.email||t.userId,t.userId===r?.id&&(0,M.jsx)(sP,{variant:`secondary`,className:`ml-2 text-xs`,children:e(`organizations.members.you`)})]}),t.user?.email&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.user.email})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ne&&t.role!==`owner`&&t.userId!==r?.id?(0,M.jsxs)(zI,{value:t.role,onValueChange:e=>ae(t.id,e),children:[(0,M.jsx)(VI,{className:`h-7 w-24 text-xs`,children:(0,M.jsx)(BI,{})}),(0,M.jsxs)(WI,{children:[(0,M.jsx)(KI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(KI,{value:`member`,children:e(`common.roles.member`)})]})]}):(0,M.jsx)(sP,{variant:`secondary`,className:`text-xs`,children:e(`common.roles.${t.role??`member`}`)}),ne&&t.role!==`owner`&&t.userId!==r?.id&&(0,M.jsxs)(tM,{children:[(0,M.jsx)(nM,{asChild:!0,children:(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(Ey,{className:`h-4 w-4`})})}),(0,M.jsx)(aM,{align:`end`,children:(0,M.jsxs)(oM,{className:`text-destructive`,onClick:()=>ie(t.id,t.user?.name||t.user?.email||t.userId),children:[(0,M.jsx)(Xy,{className:`mr-2 h-4 w-4`}),e(`organizations.members.removeMember`)]})})]})]})]},t.id))})]})]}),(0,M.jsxs)($,{children:[(0,M.jsx)(xN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(SN,{className:`text-base`,children:e(`organizations.members.pendingTitle`,{count:ee.length})}),(0,M.jsx)(CN,{children:e(`organizations.members.pendingDescription`)})]}),ne&&(0,M.jsxs)(Q,{size:`sm`,variant:`outline`,onClick:()=>g(!0),children:[(0,M.jsx)(eb,{className:`mr-2 h-4 w-4`}),e(`organizations.members.sendInvitation`)]})]})}),(0,M.jsxs)(wN,{children:[f&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingInvitations`)}),!f&&ee.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(Ly,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.noPending`)})]}),!f&&ee.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:ee.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.email}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(sP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,M.jsx)(wy,{className:`h-3 w-3`}),e(`organizations.members.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})]})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.copyLink`),onClick:()=>ce(t.id),children:(0,M.jsx)(Ty,{className:`h-4 w-4`})}),(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.resend`),onClick:()=>se(t),children:(0,M.jsx)(Hy,{className:`h-4 w-4`})}),(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.cancel`),onClick:()=>k(t.id,t.email),children:(0,M.jsx)(ib,{className:`h-4 w-4`})})]})]},t.id))})]})]}),(0,M.jsx)(zP,{open:h,onOpenChange:g,children:(0,M.jsxs)(HP,{children:[(0,M.jsxs)(UP,{children:[(0,M.jsx)(GP,{children:e(`organizations.members.inviteDialogTitle`)}),(0,M.jsx)(KP,{children:e(`organizations.members.inviteDialogDescription`,{organization:a?.name??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Q,{type:`button`,variant:_?`outline`:`default`,size:`sm`,onClick:()=>v(!1),children:e(`organizations.members.singleInvite`)}),(0,M.jsx)(Q,{type:`button`,variant:_?`default`:`outline`,size:`sm`,onClick:()=>v(!0),children:e(`organizations.members.bulkInvite`)})]}),_?(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{children:e(`organizations.members.bulkEmails`)}),(0,M.jsx)(XI,{placeholder:e(`organizations.members.bulkEmailsPlaceholder`),rows:5,value:x,onChange:e=>S(e.target.value)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.bulkEmailsHint`)})]}):(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`invite-email`,children:e(`organizations.members.email`)}),(0,M.jsx)(eS,{id:`invite-email`,type:`email`,placeholder:e(`organizations.members.emailPlaceholder`),value:y,onChange:e=>b(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`role`,children:e(`organizations.members.role`)}),(0,M.jsxs)(zI,{value:C,onValueChange:w,children:[(0,M.jsx)(VI,{id:`role`,children:(0,M.jsx)(BI,{})}),(0,M.jsxs)(WI,{children:[(0,M.jsx)(KI,{value:`owner`,children:e(`common.roles.owner`)}),(0,M.jsx)(KI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(KI,{value:`member`,children:e(`common.roles.member`)})]})]})]})]}),(0,M.jsxs)(WP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>g(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Q,{onClick:re,disabled:T,children:e(T?`organizations.members.sending`:`organizations.members.sendInvitation`)})]})]})})]})}var $I=la(`/organizations/$orgId/general`)({component:eL});function eL(){let{t:e}=vt(),{orgId:t}=$I.useParams(),n=Hi(),{organizations:r}=$M(),{session:i,user:a,setActiveOrganization:o}=QM(),s=r.find(e=>e.id===t),{members:c}=eF(t),{invitations:l}=tF(t),{remove:u,deleting:d}=nN(),{update:f,updating:p}=tN(),[m,h]=(0,j.useState)(``),[g,_]=(0,j.useState)(``),[v,y]=(0,j.useState)(``),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``);(0,j.useEffect)(()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},[s?.id,s?.name,s?.slug,s?.logo]);let w=i?.activeOrganizationId===t,T=l.filter(e=>e.status===`pending`),E=(a?c.find(e=>e.userId===a.id):void 0)?.role??null,D=E===`owner`||E===`admin`,O=D&&s!=null&&(m.trim()!==(s.name??``)||g.trim()!==(s.slug??``)||v.trim()!==(s.logo??``));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w&&(0,M.jsx)(sP,{variant:`outline`,children:e(`organizations.active`)}),E&&(0,M.jsx)(sP,{variant:`secondary`,className:`capitalize`,children:e(`common.roles.${E}`)})]}),!w&&(0,M.jsx)(Q,{size:`sm`,variant:`outline`,onClick:async()=>{try{await o(t),K({title:e(`organizations.general.switched`)})}catch(t){K({title:e(`organizations.general.switchFailed`),description:t.message,variant:`destructive`})}},children:e(`organizations.general.setActive`)})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{children:e(`organizations.general.detailsTitle`)}),(0,M.jsx)(CN,{children:e(D?`organizations.general.detailsDescription`:`organizations.general.detailsReadOnly`)})]}),(0,M.jsxs)(wN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`org-name`,children:e(`organizations.new.name`)}),(0,M.jsx)(eS,{id:`org-name`,value:m,onChange:e=>h(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`org-slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(eS,{id:`org-slug`,value:g,onChange:e=>_(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.slugPlaceholder`),className:`font-mono text-sm`}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.general.slugHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`org-logo`,children:e(`organizations.general.logo`)}),(0,M.jsx)(eS,{id:`org-logo`,value:v,onChange:e=>y(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.logoPlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex justify-between border-t pt-4 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.organizationId`)}),(0,M.jsx)(`code`,{className:`font-mono`,children:t})]})]}),D&&(0,M.jsxs)(wN,{className:`flex justify-end gap-2 border-t pt-4`,children:[(0,M.jsx)(Q,{variant:`ghost`,size:`sm`,onClick:()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},disabled:!O||p,children:e(`organizations.general.reset`)}),(0,M.jsxs)(Q,{size:`sm`,onClick:async()=>{if(!s||!D||!O)return;let n=m.trim();if(!n){K({title:e(`organizations.general.nameRequired`),variant:`destructive`});return}try{await f(t,{name:n,slug:g.trim()||void 0,logo:v.trim()||void 0}),K({title:e(`organizations.general.updated`)})}catch(t){K({title:e(`organizations.general.updateFailed`),description:t.message,variant:`destructive`})}},disabled:!O||p,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(p?`common.saving`:`organizations.general.save`)]})]})]}),(0,M.jsxs)($,{children:[(0,M.jsx)(xN,{children:(0,M.jsx)(SN,{className:`text-base`,children:e(`organizations.general.overviewTitle`)})}),(0,M.jsxs)(wN,{className:`space-y-3 text-sm`,children:[(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.members`)}),(0,M.jsx)(`span`,{children:c.length})]}),(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.pendingInvitations`)}),(0,M.jsx)(`span`,{children:T.length})]})]})]}),D&&(0,M.jsxs)($,{className:`border-destructive/40`,children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{className:`text-base text-destructive`,children:e(`organizations.general.dangerTitle`)}),(0,M.jsx)(CN,{children:e(`organizations.general.dangerDescription`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(Q,{variant:`destructive`,size:`sm`,onClick:()=>x(!0),disabled:d,children:[(0,M.jsx)(Xy,{className:`mr-2 h-4 w-4`}),e(`organizations.general.delete`)]})})]}),(0,M.jsx)(zP,{open:b,onOpenChange:e=>{x(e),e||C(``)},children:(0,M.jsxs)(HP,{children:[(0,M.jsxs)(UP,{children:[(0,M.jsx)(GP,{className:`text-destructive`,children:e(`organizations.general.deleteDialogTitle`)}),(0,M.jsx)(KP,{children:e(`organizations.general.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-2`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`delete-confirm`,children:e(`organizations.general.deleteDialogLabel`,{name:s?.name??``})}),(0,M.jsx)(eS,{id:`delete-confirm`,value:S,onChange:e=>C(e.target.value),placeholder:s?.name??``,disabled:d})]})}),(0,M.jsxs)(WP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>x(!1),disabled:d,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:async()=>{if(s){if(S!==s.name){K({title:e(`organizations.general.confirmationMismatch`),description:e(`organizations.general.confirmationHint`,{name:s.name}),variant:`destructive`});return}try{let r=await u(t),i=r?.warnings,a=r?.deletedProjects??0;K({title:e(`organizations.general.deleted`),description:i?.length?e(`organizations.general.deletedWithWarnings`,{deletedProjects:a,warning:i[0],extraCount:Math.max(i.length-1,0)}):e(`organizations.general.deletedDescription`,{name:s.name,deletedProjects:a}),variant:i?.length?`destructive`:void 0}),x(!1),C(``),n({to:`/organizations`})}catch(t){K({title:e(`organizations.general.deleteFailed`),description:t.message,variant:`destructive`})}}},disabled:d||!s||S!==s.name,children:e(d?`organizations.general.deleting`:`organizations.general.delete`)})]})]})})]})}var tL=la(`/account/oauth-applications/new`)({component:nL});function nL(){let{t:e}=vt(),t=Hi(),{register:n,registering:r}=SP(),[i,a]=(0,j.useState)(``),[o,s]=(0,j.useState)(``),[c,l]=(0,j.useState)(`client_secret_basic`),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(``),[m,h]=(0,j.useState)(null),g=async()=>{let t=i.trim(),r=o.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean);if(!t){K({title:e(`oauth.applications.form.nameRequired`),variant:`destructive`});return}if(r.length===0){K({title:e(`oauth.applications.form.redirectRequired`),variant:`destructive`});return}try{let i=await n({client_name:t,redirect_uris:r,token_endpoint_auth_method:c,...u.trim()?{client_uri:u.trim()}:{},...f.trim()?{logo_uri:f.trim()}:{}});h({client_id:i?.client_id??``,client_secret:i?.client_secret}),K({title:e(`oauth.applications.registered`)})}catch(t){K({title:e(`oauth.applications.registerFailed`),description:t.message,variant:`destructive`})}},_=(t,n)=>{navigator.clipboard.writeText(t).then(()=>K({title:e(`oauth.applications.copied`,{label:n})}),()=>K({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))};return m?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.registeredTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.registeredDescription`)})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(CN,{children:e(`oauth.applications.credentialsDescription`)})]}),(0,M.jsxs)(wN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(LN,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_id}),(0,M.jsx)(Q,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(Ty,{className:`h-4 w-4`})})]})]}),m.client_secret&&(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(LN,{children:e(`oauth.applications.clientSecret`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 break-all rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_secret}),(0,M.jsx)(Q,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_secret,e(`oauth.applications.clientSecret`)),children:(0,M.jsx)(Ty,{className:`h-4 w-4`})})]}),(0,M.jsx)(`p`,{className:`text-xs text-destructive`,children:e(`oauth.applications.clientSecretWarning`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>t({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)}),(0,M.jsx)(Q,{onClick:()=>t({to:`/account/oauth-applications/$clientId`,params:{clientId:m.client_id}}),children:e(`oauth.applications.viewApplication`)})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.form.title`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.form.description`)})]}),(0,M.jsxs)($,{children:[(0,M.jsx)(xN,{children:(0,M.jsxs)(SN,{className:`flex items-center gap-2 text-base`,children:[(0,M.jsx)(jy,{className:`h-4 w-4`}),e(`oauth.applications.form.details`)]})}),(0,M.jsxs)(wN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`oauth-name`,children:e(`oauth.applications.form.name`)}),(0,M.jsx)(eS,{id:`oauth-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`oauth.applications.form.namePlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`oauth-redirect`,children:e(`oauth.applications.form.redirectUris`)}),(0,M.jsx)(XI,{id:`oauth-redirect`,value:o,onChange:e=>s(e.target.value),placeholder:e(`oauth.applications.form.redirectPlaceholder`),rows:3,disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.redirectHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{children:e(`oauth.applications.form.authMethod`)}),(0,M.jsxs)(zI,{value:c,onValueChange:e=>l(e),disabled:r,children:[(0,M.jsx)(VI,{children:(0,M.jsx)(BI,{})}),(0,M.jsxs)(WI,{children:[(0,M.jsx)(KI,{value:`client_secret_basic`,children:e(`oauth.applications.form.authMethodBasic`)}),(0,M.jsx)(KI,{value:`client_secret_post`,children:e(`oauth.applications.form.authMethodPost`)}),(0,M.jsx)(KI,{value:`none`,children:e(`oauth.applications.form.authMethodNone`)})]})]})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`oauth-client-uri`,children:e(`oauth.applications.form.clientUri`)}),(0,M.jsx)(eS,{id:`oauth-client-uri`,value:u,onChange:e=>d(e.target.value),placeholder:e(`oauth.applications.form.clientUriPlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(LN,{htmlFor:`oauth-logo`,children:e(`oauth.applications.form.logoUri`)}),(0,M.jsx)(eS,{id:`oauth-logo`,value:f,onChange:e=>p(e.target.value),placeholder:e(`oauth.applications.form.logoUriPlaceholder`),disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.logoHint`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Q,{variant:`ghost`,onClick:()=>t({to:`/account/oauth-applications`}),disabled:r,children:e(`common.cancel`)}),(0,M.jsx)(Q,{onClick:g,disabled:r,children:e(r?`oauth.applications.form.registering`:`oauth.applications.register`)})]})]})}var rL=la(`/account/oauth-applications/$clientId`)({component:iL});function iL(){let{t:e}=vt(),{clientId:t}=rL.useParams(),n=Hi(),{applications:r,loading:i,reload:a}=xP(),{remove:o,deleting:s}=CP(),c=Zg(),l=r.find(e=>e.client_id===t),[u,d]=(0,j.useState)(null);(0,j.useEffect)(()=>{let e=!1;if(!l&&c?.oauth?.applications?.get)return c.oauth.applications.get(t).then(t=>{e||d(t?.data??t)},()=>{}),()=>{e=!0}},[c,t,l]);let f=l??u,[p,m]=(0,j.useState)(!1),h=(t,n)=>{navigator.clipboard.writeText(t).then(()=>K({title:e(`oauth.applications.copied`,{label:n})}),()=>K({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))},g=async()=>{if(f)try{await o(f.client_id),K({title:e(`oauth.applications.deleted`)}),await a(),n({to:`/account/oauth-applications`})}catch(t){K({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}};if(i&&!f)return(0,M.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:e(`common.loading`)});if(!f)return(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.notFoundTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.notFoundDescription`)}),(0,M.jsx)(Q,{onClick:()=>n({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)})]});let _=typeof f.redirect_urls==`string`?f.redirect_urls.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean):Array.isArray(f.redirect_urls)?f.redirect_urls:[];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:f.name}),(0,M.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:f.client_id})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f.type&&(0,M.jsx)(sP,{variant:`outline`,className:`capitalize`,children:f.type}),f.disabled&&(0,M.jsx)(sP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]})]}),(0,M.jsxs)($,{children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(CN,{children:e(`oauth.applications.credentialsDescriptionDetail`)})]}),(0,M.jsxs)(wN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(LN,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:f.client_id}),(0,M.jsx)(Q,{size:`icon`,variant:`outline`,onClick:()=>h(f.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(Ty,{className:`h-4 w-4`})})]})]}),(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)(LN,{children:e(`oauth.applications.redirectUris`)}),_.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.noRedirectUris`)}):(0,M.jsx)(`ul`,{className:`space-y-1`,children:_.map((e,t)=>(0,M.jsx)(`li`,{className:`rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:e},t))})]})]})]}),(0,M.jsxs)($,{className:`border-destructive/40`,children:[(0,M.jsxs)(xN,{children:[(0,M.jsx)(SN,{className:`text-base text-destructive`,children:e(`oauth.applications.dangerTitle`)}),(0,M.jsx)(CN,{children:e(`oauth.applications.dangerDescription`)})]}),(0,M.jsx)(wN,{children:(0,M.jsxs)(Q,{variant:`destructive`,size:`sm`,onClick:()=>m(!0),disabled:s,children:[(0,M.jsx)(Xy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.delete`)]})})]}),(0,M.jsx)(zP,{open:p,onOpenChange:m,children:(0,M.jsxs)(HP,{children:[(0,M.jsxs)(UP,{children:[(0,M.jsx)(GP,{className:`text-destructive`,children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(KP,{children:e(`oauth.applications.deleteDialogDescription`,{name:f.name})})]}),(0,M.jsxs)(WP,{children:[(0,M.jsx)(Q,{variant:`outline`,onClick:()=>m(!1),disabled:s,children:e(`common.cancel`)}),(0,M.jsx)(Q,{variant:`destructive`,onClick:g,disabled:s,children:e(s?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}var aL=kN.update({id:`/verify-email-prompt`,path:`/verify-email-prompt`,getParentRoute:()=>bN}),oL=jN.update({id:`/verify-email`,path:`/verify-email`,getParentRoute:()=>bN}),sL=RN.update({id:`/setup`,path:`/setup`,getParentRoute:()=>bN}),cL=VN.update({id:`/reset-password`,path:`/reset-password`,getParentRoute:()=>bN}),lL=KN.update({id:`/register`,path:`/register`,getParentRoute:()=>bN}),uL=XN.update({id:`/login`,path:`/login`,getParentRoute:()=>bN}),dL=eP.update({id:`/forgot-password`,path:`/forgot-password`,getParentRoute:()=>bN}),fL=nP.update({id:`/account`,path:`/account`,getParentRoute:()=>bN}),pL=iP.update({id:`/`,path:`/`,getParentRoute:()=>bN}),mL=lP.update({id:`/organizations/`,path:`/organizations/`,getParentRoute:()=>bN}),hL=dP.update({id:`/`,path:`/`,getParentRoute:()=>fL}),gL=mP.update({id:`/organizations/new`,path:`/organizations/new`,getParentRoute:()=>bN}),_L=yP.update({id:`/organizations/$orgId`,path:`/organizations/$orgId`,getParentRoute:()=>bN}),vL=TP.update({id:`/oauth/consent`,path:`/oauth/consent`,getParentRoute:()=>bN}),yL=OP.update({id:`/auth/device`,path:`/auth/device`,getParentRoute:()=>bN}),bL=jP.update({id:`/two-factor`,path:`/two-factor`,getParentRoute:()=>fL}),xL=IP.update({id:`/sessions`,path:`/sessions`,getParentRoute:()=>fL}),SL=qP.update({id:`/security`,path:`/security`,getParentRoute:()=>fL}),CL=YP.update({id:`/profile`,path:`/profile`,getParentRoute:()=>fL}),wL=ZP.update({id:`/linked-accounts`,path:`/linked-accounts`,getParentRoute:()=>fL}),TL=rF.update({id:`/invitations`,path:`/invitations`,getParentRoute:()=>fL}),EL=aF.update({id:`/accept-invitation/$invitationId`,path:`/accept-invitation/$invitationId`,getParentRoute:()=>bN}),DL=sF.update({id:`/`,path:`/`,getParentRoute:()=>_L}),OL=cF.update({id:`/oauth-applications/`,path:`/oauth-applications/`,getParentRoute:()=>fL}),kL=JI.update({id:`/teams`,path:`/teams`,getParentRoute:()=>_L}),AL=ZI.update({id:`/members`,path:`/members`,getParentRoute:()=>_L}),jL=$I.update({id:`/general`,path:`/general`,getParentRoute:()=>_L}),ML=tL.update({id:`/oauth-applications/new`,path:`/oauth-applications/new`,getParentRoute:()=>fL}),NL={AccountInvitationsRoute:TL,AccountLinkedAccountsRoute:wL,AccountProfileRoute:CL,AccountSecurityRoute:SL,AccountSessionsRoute:xL,AccountTwoFactorRoute:bL,AccountIndexRoute:hL,AccountOauthApplicationsClientIdRoute:rL.update({id:`/oauth-applications/$clientId`,path:`/oauth-applications/$clientId`,getParentRoute:()=>fL}),AccountOauthApplicationsNewRoute:ML,AccountOauthApplicationsIndexRoute:OL},PL=fL._addFileChildren(NL),FL={OrganizationsOrgIdGeneralRoute:jL,OrganizationsOrgIdMembersRoute:AL,OrganizationsOrgIdTeamsRoute:kL,OrganizationsOrgIdIndexRoute:DL},IL={IndexRoute:pL,AccountRoute:PL,ForgotPasswordRoute:dL,LoginRoute:uL,RegisterRoute:lL,ResetPasswordRoute:cL,SetupRoute:sL,VerifyEmailRoute:oL,VerifyEmailPromptRoute:aL,AcceptInvitationInvitationIdRoute:EL,AuthDeviceRoute:yL,OauthConsentRoute:vL,OrganizationsOrgIdRoute:_L._addFileChildren(FL),OrganizationsNewRoute:gL,OrganizationsIndexRoute:mL},LL=bN._addFileChildren(IL)._addFileTypes();function RL(){let e=`/_account/`;return e.endsWith(`/`)?e.slice(0,-1):e}var zL=wa({routeTree:LL,basepath:RL()});function BL(){return(0,M.jsx)(Da,{router:zL})}var VL=typeof localStorage<`u`&&localStorage.getItem(`account.lang`)||typeof navigator<`u`&&navigator.language||`en`;function HL({children:e}){let{i18n:t,language:n}=yt(),[r,i]=j.useReducer(e=>e+1,0),[a,o]=j.useState(!1);return j.useEffect(()=>{let e=()=>i();t.on(`loaded`,e),t.on(`languageChanged`,e);let n=window.setTimeout(()=>o(!0),1500);return()=>{t.off(`loaded`,e),t.off(`languageChanged`,e),window.clearTimeout(n)}},[t]),a||t.isInitialized&&t.hasResourceBundle?.(n,`translation`)?(0,M.jsx)(M.Fragment,{children:e}):null}Jf.createRoot(document.getElementById(`root`)).render((0,M.jsx)(j.StrictMode,{children:(0,M.jsx)(_t,{config:{defaultLanguage:VL,fallbackLanguage:`en`},loadLanguage:yM,children:(0,M.jsx)(HL,{children:(0,M.jsx)(BL,{})})})}));
|
|
147
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kw=`DialogDescriptionWarning`,Aw=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Dw(kw).contentName}}.`;return j.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},jw=nw,Mw=cw,Nw=uw,Pw=mw,Fw=yw,Iw=xw,Lw=Cw,Rw=jw,zw=Mw,Bw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Nw,{className:X(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));Bw.displayName=Nw.displayName;var Vw=iy(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),Hw=j.forwardRef(({side:e=`right`,className:t,children:n,...r},i)=>(0,M.jsxs)(zw,{children:[(0,M.jsx)(Bw,{}),(0,M.jsxs)(Pw,{ref:i,className:X(Vw({side:e}),t),...r,children:[n,(0,M.jsxs)(Lw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,M.jsx)(ob,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Hw.displayName=Pw.displayName;var Uw=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});Uw.displayName=`SheetHeader`;var Ww=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Ww.displayName=`SheetFooter`;var Gw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Fw,{ref:n,className:X(`text-lg font-semibold text-foreground`,e),...t}));Gw.displayName=Fw.displayName;var Kw=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Iw,{ref:n,className:X(`text-sm text-muted-foreground`,e),...t}));Kw.displayName=Iw.displayName;function qw({className:e,...t}){return(0,M.jsx)(`div`,{className:X(`bg-muted animate-pulse rounded-md`,e),...t})}var Jw=[`top`,`right`,`bottom`,`left`],Yw=Math.min,Xw=Math.max,Zw=Math.round,Qw=Math.floor,$w=e=>({x:e,y:e}),eT={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function tT(e,t,n){return Xw(e,Yw(t,n))}function nT(e,t){return typeof e==`function`?e(t):e}function rT(e){return e.split(`-`)[0]}function iT(e){return e.split(`-`)[1]}function aT(e){return e===`x`?`y`:`x`}function oT(e){return e===`y`?`height`:`width`}function sT(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function cT(e){return aT(sT(e))}function lT(e,t,n){n===void 0&&(n=!1);let r=iT(e),i=cT(e),a=oT(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=vT(o)),[o,vT(o)]}function uT(e){let t=vT(e);return[dT(e),t,dT(t)]}function dT(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var fT=[`left`,`right`],pT=[`right`,`left`],mT=[`top`,`bottom`],hT=[`bottom`,`top`];function gT(e,t,n){switch(e){case`top`:case`bottom`:return n?t?pT:fT:t?fT:pT;case`left`:case`right`:return t?mT:hT;default:return[]}}function _T(e,t,n,r){let i=iT(e),a=gT(rT(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(dT)))),a}function vT(e){let t=rT(e);return eT[t]+e.slice(t.length)}function yT(e){return{top:0,right:0,bottom:0,left:0,...e}}function bT(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:yT(e)}function xT(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ST(e,t,n){let{reference:r,floating:i}=e,a=sT(t),o=cT(t),s=oT(o),c=rT(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(iT(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function CT(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=nT(t,e),p=bT(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=xT(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=xT(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var wT=50,TT=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:CT},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ST(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<wT&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ST(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ET=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=nT(e,t)||{};if(l==null)return{};let d=bT(u),f={x:n,y:r},p=cT(i),m=oT(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Yw(d[_],T),D=Yw(d[v],T),O=E,ee=C-h[m]-D,te=C/2-h[m]/2+w,ne=tT(O,te,ee),re=!c.arrow&&iT(i)!=null&&te!==ne&&a.reference[m]/2-(te<O?E:D)-h[m]/2<0,ie=re?te<O?te-O:te-ee:0;return{[p]:f[p]+ie,data:{[p]:ne,centerOffset:te-ne-ie,...re&&{alignmentOffset:ie}},reset:re}}}),DT=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=nT(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=rT(r),_=sT(o),v=rT(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[vT(o)]:uT(o)),x=p!==`none`;!d&&x&&b.push(..._T(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=lT(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==sT(t))||T.every(e=>sT(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=sT(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function OT(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function kT(e){return Jw.some(t=>e[t]>=0)}var AT=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=nT(e,t);switch(i){case`referenceHidden`:{let e=OT(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:kT(e)}}}case`escaped`:{let e=OT(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:kT(e)}}}default:return{}}}}},jT=new Set([`left`,`top`]);async function MT(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=rT(n),s=iT(n),c=sT(n)===`y`,l=jT.has(o)?-1:1,u=a&&c?-1:1,d=nT(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var NT=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await MT(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},PT=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=nT(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=sT(rT(i)),p=aT(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=tT(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=tT(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},FT=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=nT(e,t),u={x:n,y:r},d=sT(i),f=aT(d),p=u[f],m=u[d],h=nT(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=jT.has(rT(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},IT=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=nT(e,t),u=await o.detectOverflow(t,l),d=rT(i),f=iT(i),p=sT(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Yw(h-u[g],v),x=Yw(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Xw(u.left,0),t=Xw(u.right,0),n=Xw(u.top,0),r=Xw(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Xw(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Xw(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function LT(){return typeof window<`u`}function RT(e){return VT(e)?(e.nodeName||``).toLowerCase():`#document`}function zT(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function BT(e){return((VT(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function VT(e){return LT()?e instanceof Node||e instanceof zT(e).Node:!1}function HT(e){return LT()?e instanceof Element||e instanceof zT(e).Element:!1}function UT(e){return LT()?e instanceof HTMLElement||e instanceof zT(e).HTMLElement:!1}function WT(e){return!LT()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof zT(e).ShadowRoot}function GT(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=nE(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function KT(e){return/^(table|td|th)$/.test(RT(e))}function qT(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var JT=/transform|translate|scale|rotate|perspective|filter/,YT=/paint|layout|strict|content/,XT=e=>!!e&&e!==`none`,ZT;function QT(e){let t=HT(e)?nE(e):e;return XT(t.transform)||XT(t.translate)||XT(t.scale)||XT(t.rotate)||XT(t.perspective)||!eE()&&(XT(t.backdropFilter)||XT(t.filter))||JT.test(t.willChange||``)||YT.test(t.contain||``)}function $T(e){let t=iE(e);for(;UT(t)&&!tE(t);){if(QT(t))return t;if(qT(t))return null;t=iE(t)}return null}function eE(){return ZT??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ZT}function tE(e){return/^(html|body|#document)$/.test(RT(e))}function nE(e){return zT(e).getComputedStyle(e)}function rE(e){return HT(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function iE(e){if(RT(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||WT(e)&&e.host||BT(e);return WT(t)?t.host:t}function aE(e){let t=iE(e);return tE(t)?e.ownerDocument?e.ownerDocument.body:e.body:UT(t)&>(t)?t:aE(t)}function oE(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=aE(e),i=r===e.ownerDocument?.body,a=zT(r);if(i){let e=sE(a);return t.concat(a,a.visualViewport||[],GT(r)?r:[],e&&n?oE(e):[])}else return t.concat(r,oE(r,[],n))}function sE(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cE(e){let t=nE(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=UT(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Zw(n)!==a||Zw(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function lE(e){return HT(e)?e:e.contextElement}function uE(e){let t=lE(e);if(!UT(t))return $w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=cE(t),o=(a?Zw(n.width):n.width)/r,s=(a?Zw(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var dE=$w(0);function fE(e){let t=zT(e);return!eE()||!t.visualViewport?dE:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pE(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==zT(e)?!1:t}function mE(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=lE(e),o=$w(1);t&&(r?HT(r)&&(o=uE(r)):o=uE(e));let s=pE(a,n,r)?fE(a):$w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=zT(a),t=r&&HT(r)?zT(r):r,n=e,i=sE(n);for(;i&&r&&t!==n;){let e=uE(i),t=i.getBoundingClientRect(),r=nE(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=zT(i),i=sE(n)}}return xT({width:u,height:d,x:c,y:l})}function hE(e,t){let n=rE(e).scrollLeft;return t?t.left+n:mE(BT(e)).left+n}function gE(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-hE(e,n),y:n.top+t.scrollTop}}function _E(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=BT(r),s=t?qT(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=$w(1),u=$w(0),d=UT(r);if((d||!d&&!a)&&((RT(r)!==`body`||GT(o))&&(c=rE(r)),d)){let e=mE(r);l=uE(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?gE(o,c):$w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function vE(e){return Array.from(e.getClientRects())}function yE(e){let t=BT(e),n=rE(e),r=e.ownerDocument.body,i=Xw(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Xw(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+hE(e),s=-n.scrollTop;return nE(r).direction===`rtl`&&(o+=Xw(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var bE=25;function xE(e,t){let n=zT(e),r=BT(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=eE();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=hE(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=bE&&(a-=o)}else l<=bE&&(a+=l);return{width:a,height:o,x:s,y:c}}function SE(e,t){let n=mE(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=UT(e)?uE(e):$w(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function CE(e,t,n){let r;if(t===`viewport`)r=xE(e,n);else if(t===`document`)r=yE(BT(e));else if(HT(t))r=SE(t,n);else{let n=fE(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return xT(r)}function wE(e,t){let n=iE(e);return n===t||!HT(n)||tE(n)?!1:nE(n).position===`fixed`||wE(n,t)}function TE(e,t){let n=t.get(e);if(n)return n;let r=oE(e,[],!1).filter(e=>HT(e)&&RT(e)!==`body`),i=null,a=nE(e).position===`fixed`,o=a?iE(e):e;for(;HT(o)&&!tE(o);){let t=nE(o),n=QT(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||GT(o)&&!n&&wE(e,o))?r=r.filter(e=>e!==o):i=t,o=iE(o)}return t.set(e,r),r}function EE(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?qT(t)?[]:TE(t,this._c):[].concat(n),r],o=CE(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=CE(t,a[e],i);s=Xw(n.top,s),c=Yw(n.right,c),l=Yw(n.bottom,l),u=Xw(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function DE(e){let{width:t,height:n}=cE(e);return{width:t,height:n}}function OE(e,t,n){let r=UT(t),i=BT(t),a=n===`fixed`,o=mE(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=$w(0);function l(){c.x=hE(i)}if(r||!r&&!a)if((RT(t)!==`body`||GT(i))&&(s=rE(t)),r){let e=mE(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?gE(i,s):$w(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function kE(e){return nE(e).position===`static`}function AE(e,t){if(!UT(e)||nE(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return BT(e)===n&&(n=n.ownerDocument.body),n}function jE(e,t){let n=zT(e);if(qT(e))return n;if(!UT(e)){let t=iE(e);for(;t&&!tE(t);){if(HT(t)&&!kE(t))return t;t=iE(t)}return n}let r=AE(e,t);for(;r&&KT(r)&&kE(r);)r=AE(r,t);return r&&tE(r)&&kE(r)&&!QT(r)?n:r||$T(e)||n}var ME=async function(e){let t=this.getOffsetParent||jE,n=this.getDimensions,r=await n(e.floating);return{reference:OE(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function NE(e){return nE(e).direction===`rtl`}var PE={convertOffsetParentRelativeRectToViewportRelativeRect:_E,getDocumentElement:BT,getClippingRect:EE,getOffsetParent:jE,getElementRects:ME,getClientRects:vE,getDimensions:DE,getScale:uE,isElement:HT,isRTL:NE};function FE(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function IE(e,t){let n=null,r,i=BT(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Qw(d),h=Qw(i.clientWidth-(u+f)),g=Qw(i.clientHeight-(d+p)),_=Qw(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Xw(0,Yw(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!FE(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function LE(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=lE(e),u=i||a?[...l?oE(l):[],...t?oE(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?IE(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?mE(e):null;c&&g();function g(){let t=mE(e);h&&!FE(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var RE=NT,zE=PT,BE=DT,VE=IT,HE=AT,UE=ET,WE=FT,GE=(e,t,n)=>{let r=new Map,i={platform:PE,...n},a={...i.platform,_c:r};return TT(e,t,{...i,platform:a})},KE=typeof document<`u`?j.useLayoutEffect:function(){};function qE(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qE(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!qE(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function JE(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function YE(e,t){let n=JE(e);return Math.round(t*n)/n}function XE(e){let t=j.useRef(e);return KE(()=>{t.current=e}),t}function ZE(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=j.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=j.useState(r);qE(f,r)||p(r);let[m,h]=j.useState(null),[g,_]=j.useState(null),v=j.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=j.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=j.useRef(null),C=j.useRef(null),w=j.useRef(u),T=c!=null,E=XE(c),D=XE(i),O=XE(l),ee=j.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),GE(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};te.current&&!qE(w.current,t)&&(w.current=t,Gi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);KE(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let te=j.useRef(!1);KE(()=>(te.current=!0,()=>{te.current=!1}),[]),KE(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,ee);ee()}},[b,x,ee,E,T]);let ne=j.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),re=j.useMemo(()=>({reference:b,floating:x}),[b,x]),ie=j.useMemo(()=>{let e={position:n,left:0,top:0};if(!re.floating)return e;let t=YE(re.floating,u.x),r=YE(re.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...JE(re.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,re.floating,u.x,u.y]);return j.useMemo(()=>({...u,update:ee,refs:ne,elements:re,floatingStyles:ie}),[u,ee,ne,re,ie])}var QE=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:UE({element:r.current,padding:i}).fn(n):r?UE({element:r,padding:i}).fn(n):{}}}},$E=(e,t)=>{let n=RE(e);return{name:n.name,fn:n.fn,options:[e,t]}},eD=(e,t)=>{let n=zE(e);return{name:n.name,fn:n.fn,options:[e,t]}},tD=(e,t)=>({fn:WE(e).fn,options:[e,t]}),nD=(e,t)=>{let n=BE(e);return{name:n.name,fn:n.fn,options:[e,t]}},rD=(e,t)=>{let n=VE(e);return{name:n.name,fn:n.fn,options:[e,t]}},iD=(e,t)=>{let n=HE(e);return{name:n.name,fn:n.fn,options:[e,t]}},aD=(e,t)=>{let n=QE(e);return{name:n.name,fn:n.fn,options:[e,t]}},oD=`Arrow`,sD=j.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,M.jsx)(w_.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,M.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});sD.displayName=oD;var cD=sD;function lD(e){let[t,n]=j.useState(void 0);return U_(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var uD=`Popper`,[dD,fD]=m_(uD),[pD,mD]=dD(uD),hD=e=>{let{__scopePopper:t,children:n}=e,[r,i]=j.useState(null);return(0,M.jsx)(pD,{scope:t,anchor:r,onAnchorChange:i,children:n})};hD.displayName=uD;var gD=`PopperAnchor`,_D=j.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=mD(gD,n),o=j.useRef(null),s=f_(t,o),c=j.useRef(null);return j.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,M.jsx)(w_.div,{...i,ref:s})});_D.displayName=gD;var vD=`PopperContent`,[yD,bD]=dD(vD),xD=j.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=mD(vD,n),[_,v]=j.useState(null),y=f_(t,e=>v(e)),[b,x]=j.useState(null),S=lD(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,ee={padding:E,boundary:D.filter(TD),altBoundary:O},{refs:te,floatingStyles:ne,placement:re,isPositioned:ie,middlewareData:ae}=ZE({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>LE(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[$E({mainAxis:i+w,alignmentAxis:o}),c&&eD({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?tD():void 0,...ee}),c&&nD({...ee}),rD({...ee,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&aD({element:b,padding:s}),ED({arrowWidth:C,arrowHeight:w}),f&&iD({strategy:`referenceHidden`,...ee})]}),[oe,k]=DD(re),se=E_(m);U_(()=>{ie&&se?.()},[ie,se]);let ce=ae.arrow?.x,le=ae.arrow?.y,ue=ae.arrow?.centerOffset!==0,[A,de]=j.useState();return U_(()=>{_&&de(window.getComputedStyle(_).zIndex)},[_]),(0,M.jsx)(`div`,{ref:te.setFloating,"data-radix-popper-content-wrapper":``,style:{...ne,transform:ie?ne.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:A,"--radix-popper-transform-origin":[ae.transformOrigin?.x,ae.transformOrigin?.y].join(` `),...ae.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,M.jsx)(yD,{scope:n,placedSide:oe,onArrowChange:x,arrowX:ce,arrowY:le,shouldHideArrow:ue,children:(0,M.jsx)(w_.div,{"data-side":oe,"data-align":k,...h,ref:y,style:{...h.style,animation:ie?void 0:`none`}})})})});xD.displayName=vD;var SD=`PopperArrow`,CD={top:`bottom`,right:`left`,bottom:`top`,left:`right`},wD=j.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=bD(SD,n),a=CD[i.placedSide];return(0,M.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,M.jsx)(cD,{...r,ref:t,style:{...r.style,display:`block`}})})});wD.displayName=SD;function TD(e){return e!==null}var ED=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=DD(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function DD(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var OD=hD,kD=_D,AD=xD,jD=wD,[MD,ND]=m_(`Tooltip`,[fD]),PD=fD(),FD=`TooltipProvider`,ID=700,LD=`tooltip.open`,[RD,zD]=MD(FD),BD=e=>{let{__scopeTooltip:t,delayDuration:n=ID,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=j.useRef(!0),s=j.useRef(!1),c=j.useRef(0);return j.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,M.jsx)(RD,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:j.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:j.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:j.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};BD.displayName=FD;var VD=`Tooltip`,[HD,UD]=MD(VD),WD=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=zD(VD,e.__scopeTooltip),l=PD(t),[u,d]=j.useState(null),f=pS(),p=j.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=j.useRef(!1),[_,v]=Q_({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(LD))):c.onClose(),a?.(e)},caller:VD}),y=j.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=j.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=j.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return j.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,M.jsx)(OD,{...l,children:(0,M.jsx)(HD,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:j.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:j.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};WD.displayName=VD;var GD=`TooltipTrigger`,KD=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=UD(GD,n),a=zD(GD,n),o=PD(n),s=f_(t,j.useRef(null),i.onTriggerChange),c=j.useRef(!1),l=j.useRef(!1),u=j.useCallback(()=>c.current=!1,[]);return j.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,M.jsx)(kD,{asChild:!0,...o,children:(0,M.jsx)(w_.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:q(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:q(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:q(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:q(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:q(e.onBlur,i.onClose),onClick:q(e.onClick,i.onClose)})})});KD.displayName=GD;var qD=`TooltipPortal`,[JD,YD]=MD(qD,{forceMount:void 0}),XD=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=UD(qD,t);return(0,M.jsx)(JD,{scope:t,forceMount:n,children:(0,M.jsx)(q_,{present:n||a.open,children:(0,M.jsx)(G_,{asChild:!0,container:i,children:r})})})};XD.displayName=qD;var ZD=`TooltipContent`,QD=j.forwardRef((e,t)=>{let n=YD(ZD,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=UD(ZD,e.__scopeTooltip);return(0,M.jsx)(q_,{present:r||o.open,children:o.disableHoverableContent?(0,M.jsx)(rO,{side:i,...a,ref:t}):(0,M.jsx)($D,{side:i,...a,ref:t})})}),$D=j.forwardRef((e,t)=>{let n=UD(ZD,e.__scopeTooltip),r=zD(ZD,e.__scopeTooltip),i=j.useRef(null),a=f_(t,i),[o,s]=j.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=j.useCallback(()=>{s(null),d(!1)},[d]),p=j.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=sO(r,oO(r,n.getBoundingClientRect())),a=cO(t.getBoundingClientRect());s(uO([...i,...a])),d(!0)},[d]);return j.useEffect(()=>()=>f(),[f]),j.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),j.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!lO(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,M.jsx)(rO,{...e,ref:a})}),[eO,tO]=MD(VD,{isInside:!1}),nO=y_(`TooltipContent`),rO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=UD(ZD,n),l=PD(n),{onClose:u}=c;return j.useEffect(()=>(document.addEventListener(LD,u),()=>document.removeEventListener(LD,u)),[u]),j.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,M.jsx)(P_,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,M.jsxs)(AD,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,M.jsx)(nO,{children:r}),(0,M.jsx)(eO,{scope:n,isInside:!0,children:(0,M.jsx)(iv,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});QD.displayName=ZD;var iO=`TooltipArrow`,aO=j.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=PD(n);return tO(iO,n).isInside?null:(0,M.jsx)(jD,{...i,...r,ref:t})});aO.displayName=iO;function oO(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function sO(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function cO(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function lO(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function uO(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),dO(t)}function dO(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var fO=BD,pO=WD,mO=KD,hO=QD,gO=fO,_O=pO,vO=mO,yO=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(hO,{ref:r,sideOffset:t,className:X(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));yO.displayName=hO.displayName;var bO=`sidebar_state`,xO=3600*24*7,SO=`16rem`,CO=`18rem`,wO=`3rem`,TO=`b`,EO=j.createContext(null);function DO(){let e=j.useContext(EO);if(!e)throw Error(`useSidebar must be used within a SidebarProvider`);return e}var OO=j.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=eS(),[l,u]=j.useState(!1),[d,f]=j.useState(e),p=t??d,m=j.useCallback(e=>{let t=typeof e==`function`?e(p):e;n?n(t):f(t),document.cookie=`${bO}=${t}; path=/; max-age=${xO}`},[n,p]),h=j.useCallback(()=>c?u(e=>!e):m(e=>!e),[c,m,u]);j.useEffect(()=>{let e=e=>{e.key===TO&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),h())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]);let g=p?`expanded`:`collapsed`,_=j.useMemo(()=>({state:g,open:p,setOpen:m,isMobile:c,openMobile:l,setOpenMobile:u,toggleSidebar:h}),[g,p,m,c,l,u,h]);return(0,M.jsx)(EO.Provider,{value:_,children:(0,M.jsx)(gO,{delayDuration:0,children:(0,M.jsx)(`div`,{style:{"--sidebar-width":SO,"--sidebar-width-icon":wO,...i},className:X(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-0 w-full`,r),ref:s,...o,children:a})})})});OO.displayName=`SidebarProvider`;var kO=j.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,...a},o)=>{let{isMobile:s,state:c,openMobile:l,setOpenMobile:u}=DO();return n===`none`?(0,M.jsx)(`div`,{className:X(`bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col`,r),ref:o,...a,children:i}):s?(0,M.jsx)(Rw,{open:l,onOpenChange:u,...a,children:(0,M.jsx)(Hw,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden`,style:{"--sidebar-width":CO},side:e,children:(0,M.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:i})})}):(0,M.jsx)(`div`,{ref:o,className:X(`bg-sidebar text-sidebar-foreground hidden md:flex h-svh w-[var(--sidebar-width)] shrink-0 flex-col border-r transition-[width] duration-200 ease-linear overflow-hidden`,c===`collapsed`&&n===`offcanvas`&&`w-0 border-0`,c===`collapsed`&&n===`icon`&&`w-[var(--sidebar-width-icon)]`,r),"data-state":c,"data-collapsible":c===`collapsed`?n:``,"data-variant":t,"data-side":e,...a,children:i})});kO.displayName=`Sidebar`;var AO=j.forwardRef(({className:e,onClick:t,...n},r)=>{let{toggleSidebar:i}=DO();return(0,M.jsxs)(Z,{ref:r,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:X(`h-7 w-7`,e),onClick:e=>{t?.(e),i()},...n,children:[(0,M.jsx)(Hy,{}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});AO.displayName=`SidebarTrigger`;var jO=j.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=DO();return(0,M.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:X(`hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});jO.displayName=`SidebarRail`;var MO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`main`,{ref:n,className:X(`relative flex min-h-svh flex-1 flex-col bg-background`,`peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow`,e),...t}));MO.displayName=`SidebarInset`;var NO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(nS,{ref:n,"data-sidebar":`input`,className:X(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));NO.displayName=`SidebarInput`;var PO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:X(`flex flex-col gap-2 p-2`,e),...t}));PO.displayName=`SidebarHeader`;var FO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:X(`flex flex-col gap-2 p-2`,e),...t}));FO.displayName=`SidebarFooter`;var IO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(uS,{ref:n,"data-sidebar":`separator`,className:X(`mx-2 w-auto bg-sidebar-border`,e),...t}));IO.displayName=`SidebarSeparator`;var LO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:X(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto`,e),...t}));LO.displayName=`SidebarContent`;var RO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:X(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));RO.displayName=`SidebarGroup`;var zO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?qx:`div`,{ref:r,"data-sidebar":`group-label`,className:X(`text-xs/6 font-medium text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0 [[data-collapsible=icon]_&]:-mt-8 [[data-collapsible=icon]_&]:opacity-0 [[data-collapsible=icon]_&]:overflow-hidden`,e),...n}));zO.displayName=`SidebarGroupLabel`;var BO=j.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,M.jsx)(t?qx:`button`,{ref:r,"data-sidebar":`group-action`,className:X(`absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));BO.displayName=`SidebarGroupAction`;var VO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:X(`w-full text-sm`,e),...t}));VO.displayName=`SidebarGroupContent`;var HO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:X(`flex w-full min-w-0 flex-col gap-1`,e),...t}));HO.displayName=`SidebarMenu`;var UO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:X(`group/menu-item relative`,e),...t}));UO.displayName=`SidebarMenuItem`;var WO=j.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?qx:`button`,{isMobile:l,state:u}=DO(),d=(0,M.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:X(GO({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,M.jsxs)(_O,{children:[(0,M.jsx)(vO,{asChild:!0,children:d}),(0,M.jsx)(yO,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});WO.displayName=`SidebarMenuButton`;var GO=iy(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),KO=j.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,M.jsx)(t?qx:`button`,{ref:i,"data-sidebar":`menu-action`,className:X(`absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:md:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0`,e),...r}));KO.displayName=`SidebarMenuAction`;var qO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:X(`text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));qO.displayName=`SidebarMenuBadge`;var JO=j.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=j.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,M.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:X(`rounded-md h-8 flex gap-2 px-2 items-center`,e),...n,children:[t&&(0,M.jsx)(qw,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,M.jsx)(qw,{className:`h-4 flex-1 max-w-[var(--skeleton-width)]`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});JO.displayName=`SidebarMenuSkeleton`;var YO=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:X(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));YO.displayName=`SidebarMenuSub`;var XO=j.forwardRef(({...e},t)=>(0,M.jsx)(`li`,{ref:t,...e}));XO.displayName=`SidebarMenuSubItem`;var ZO=j.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,M.jsx)(e?qx:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:X(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,r),...i}));ZO.displayName=`SidebarMenuSubButton`;var QO=iy(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`),$O=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`nav`,{ref:n,"aria-label":`breadcrumb`,className:X(QO(),e),...t}));$O.displayName=`Breadcrumb`;var ek=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`ol`,{ref:n,className:X(`text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5`,e),...t}));ek.displayName=`BreadcrumbList`;var tk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`li`,{ref:n,className:X(`inline-flex items-center gap-1.5`,e),...t}));tk.displayName=`BreadcrumbItem`;var nk=j.forwardRef(({asChild:e,className:t,...n},r)=>(0,M.jsx)(e?qx:`a`,{ref:r,className:X(`hover:text-foreground transition-colors`,t),...n}));nk.displayName=`BreadcrumbLink`;var rk=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`span`,{ref:n,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:X(`text-foreground font-normal`,e),...t}));rk.displayName=`BreadcrumbPage`;var ik=({children:e,className:t,...n})=>(0,M.jsx)(`li`,{role:`presentation`,"aria-hidden":`true`,className:X(`[&>svg]:size-3.5`,t),...n,children:e??(0,M.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:(0,M.jsx)(`path`,{d:`m9 18 6-6-6-6`})})});ik.displayName=`BreadcrumbSeparator`;var ak=({className:e,...t})=>(0,M.jsxs)(`span`,{role:`presentation`,"aria-hidden":`true`,className:X(`flex h-9 w-9 items-center justify-center`,e),...t,children:[(0,M.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`size-4`,children:[(0,M.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1`}),(0,M.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1`})]}),(0,M.jsx)(`span`,{className:`sr-only`,children:`More`})]});ak.displayName=`BreadcrumbElipssis`;var ok=j.createContext(void 0);function sk(e){let t=j.useContext(ok);return e||t||`ltr`}var ck=`rovingFocusGroup.onEntryFocus`,lk={bubbles:!1,cancelable:!0},uk=`RovingFocusGroup`,[dk,fk,pk]=C_(uk),[mk,hk]=m_(uk,[pk]),[gk,_k]=mk(uk),vk=j.forwardRef((e,t)=>(0,M.jsx)(dk.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(dk.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,M.jsx)(yk,{...e,ref:t})})}));vk.displayName=uk;var yk=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=j.useRef(null),p=f_(t,f),m=sk(a),[h,g]=Q_({prop:o,defaultProp:s??null,onChange:c,caller:uk}),[_,v]=j.useState(!1),y=E_(l),b=fk(n),x=j.useRef(!1),[S,C]=j.useState(0);return j.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(ck,y),()=>e.removeEventListener(ck,y)},[y]),(0,M.jsx)(gk,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:j.useCallback(e=>g(e),[g]),onItemShiftTab:j.useCallback(()=>v(!0),[]),onFocusableItemAdd:j.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:j.useCallback(()=>C(e=>e-1),[]),children:(0,M.jsx)(w_.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:q(e.onMouseDown,()=>{x.current=!0}),onFocus:q(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(ck,lk);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Tk([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:q(e.onBlur,()=>v(!1))})})}),bk=`RovingFocusGroupItem`,xk=j.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=pS(),l=a||c,u=_k(bk,n),d=u.currentTabStopId===l,f=fk(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return j.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,M.jsx)(dk.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,M.jsx)(w_.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:q(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:q(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:q(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=wk(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ek(n,r+1):n.slice(r+1)}setTimeout(()=>Tk(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});xk.displayName=bk;var Sk={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Ck(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function wk(e,t,n){let r=Ck(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Sk[r]}function Tk(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Ek(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Dk=vk,Ok=xk,kk=[`Enter`,` `],Ak=[`ArrowDown`,`PageUp`,`Home`],jk=[`ArrowUp`,`PageDown`,`End`],Mk=[...Ak,...jk],Nk={ltr:[...kk,`ArrowRight`],rtl:[...kk,`ArrowLeft`]},Pk={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Fk=`Menu`,[Ik,Lk,Rk]=C_(Fk),[zk,Bk]=m_(Fk,[Rk,fD,hk]),Vk=fD(),Hk=hk(),[Uk,Wk]=zk(Fk),[Gk,Kk]=zk(Fk),qk=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Vk(t),[c,l]=j.useState(null),u=j.useRef(!1),d=E_(a),f=sk(i);return j.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,M.jsx)(OD,{...s,children:(0,M.jsx)(Uk,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,M.jsx)(Gk,{scope:t,onClose:j.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};qk.displayName=Fk;var Jk=`MenuAnchor`,Yk=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Vk(n);return(0,M.jsx)(kD,{...i,...r,ref:t})});Yk.displayName=Jk;var Xk=`MenuPortal`,[Zk,Qk]=zk(Xk,{forceMount:void 0}),$k=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Wk(Xk,t);return(0,M.jsx)(Zk,{scope:t,forceMount:n,children:(0,M.jsx)(q_,{present:n||a.open,children:(0,M.jsx)(G_,{asChild:!0,container:i,children:r})})})};$k.displayName=Xk;var eA=`MenuContent`,[tA,nA]=zk(eA),rA=j.forwardRef((e,t)=>{let n=Qk(eA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Wk(eA,e.__scopeMenu),o=Kk(eA,e.__scopeMenu);return(0,M.jsx)(Ik.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(q_,{present:r||a.open,children:(0,M.jsx)(Ik.Slot,{scope:e.__scopeMenu,children:o.modal?(0,M.jsx)(iA,{...i,ref:t}):(0,M.jsx)(aA,{...i,ref:t})})})})}),iA=j.forwardRef((e,t)=>{let n=Wk(eA,e.__scopeMenu),r=j.useRef(null),i=f_(t,r);return j.useEffect(()=>{let e=r.current;if(e)return XC(e)},[]),(0,M.jsx)(sA,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:q(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),aA=j.forwardRef((e,t)=>{let n=Wk(eA,e.__scopeMenu);return(0,M.jsx)(sA,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),oA=g_(`MenuContent.ScrollLock`),sA=j.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=Wk(eA,n),_=Kk(eA,n),v=Vk(n),y=Hk(n),b=Lk(n),[x,S]=j.useState(null),C=j.useRef(null),w=f_(t,C,g.onContentChange),T=j.useRef(0),E=j.useRef(``),D=j.useRef(0),O=j.useRef(null),ee=j.useRef(`right`),te=j.useRef(0),ne=m?VC:j.Fragment,re=m?{as:oA,allowPinchZoom:!0}:void 0,ie=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=GA(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};j.useEffect(()=>()=>window.clearTimeout(T.current),[]),jS();let ae=j.useCallback(e=>ee.current===O.current?.side&&qA(e,O.current?.area),[]);return(0,M.jsx)(tA,{scope:n,searchRef:E,onItemEnter:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),onItemLeave:j.useCallback(e=>{ae(e)||(C.current?.focus(),S(null))},[ae]),onTriggerLeave:j.useCallback(e=>{ae(e)&&e.preventDefault()},[ae]),pointerGraceTimerRef:D,onPointerGraceIntentChange:j.useCallback(e=>{O.current=e},[]),children:(0,M.jsx)(ne,{...re,children:(0,M.jsx)(vS,{asChild:!0,trapped:i,onMountAutoFocus:q(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,M.jsx)(P_,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,M.jsx)(Dk,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:q(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,M.jsx)(AD,{role:`menu`,"aria-orientation":`vertical`,"data-state":BA(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:q(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ie(e.key));let i=C.current;if(e.target!==i||!Mk.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);jk.includes(e.key)&&a.reverse(),UA(a)}),onBlur:q(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:q(e.onPointerMove,JA(e=>{let t=e.target,n=te.current!==e.clientX;e.currentTarget.contains(t)&&n&&(ee.current=e.clientX>te.current?`right`:`left`,te.current=e.clientX)}))})})})})})})});rA.displayName=eA;var cA=`MenuGroup`,lA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(w_.div,{role:`group`,...r,ref:t})});lA.displayName=cA;var uA=`MenuLabel`,dA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(w_.div,{...r,ref:t})});dA.displayName=uA;var fA=`MenuItem`,pA=`menu.itemSelect`,mA=j.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=j.useRef(null),o=Kk(fA,e.__scopeMenu),s=nA(fA,e.__scopeMenu),c=f_(t,a),l=j.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(pA,{bubbles:!0,cancelable:!0});e.addEventListener(pA,e=>r?.(e),{once:!0}),T_(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,M.jsx)(hA,{...i,ref:c,disabled:n,onClick:q(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:q(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:q(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||kk.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});mA.displayName=fA;var hA=j.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=nA(fA,n),s=Hk(n),c=j.useRef(null),l=f_(t,c),[u,d]=j.useState(!1),[f,p]=j.useState(``);return j.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,M.jsx)(Ik.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,M.jsx)(Ok,{asChild:!0,...s,focusable:!r,children:(0,M.jsx)(w_.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:q(e.onPointerMove,JA(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:q(e.onPointerLeave,JA(e=>o.onItemLeave(e))),onFocus:q(e.onFocus,()=>d(!0)),onBlur:q(e.onBlur,()=>d(!1))})})})}),gA=`MenuCheckboxItem`,_A=j.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,M.jsx)(TA,{scope:e.__scopeMenu,checked:n,children:(0,M.jsx)(mA,{role:`menuitemcheckbox`,"aria-checked":VA(n)?`mixed`:n,...i,ref:t,"data-state":HA(n),onSelect:q(i.onSelect,()=>r?.(VA(n)?!0:!n),{checkForDefaultPrevented:!1})})})});_A.displayName=gA;var vA=`MenuRadioGroup`,[yA,bA]=zk(vA,{value:void 0,onValueChange:()=>{}}),xA=j.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=E_(r);return(0,M.jsx)(yA,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,M.jsx)(lA,{...i,ref:t})})});xA.displayName=vA;var SA=`MenuRadioItem`,CA=j.forwardRef((e,t)=>{let{value:n,...r}=e,i=bA(SA,e.__scopeMenu),a=n===i.value;return(0,M.jsx)(TA,{scope:e.__scopeMenu,checked:a,children:(0,M.jsx)(mA,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":HA(a),onSelect:q(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});CA.displayName=SA;var wA=`MenuItemIndicator`,[TA,EA]=zk(wA,{checked:!1}),DA=j.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=EA(wA,n);return(0,M.jsx)(q_,{present:r||VA(a.checked)||a.checked===!0,children:(0,M.jsx)(w_.span,{...i,ref:t,"data-state":HA(a.checked)})})});DA.displayName=wA;var OA=`MenuSeparator`,kA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,M.jsx)(w_.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});kA.displayName=OA;var AA=`MenuArrow`,jA=j.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=Vk(n);return(0,M.jsx)(jD,{...i,...r,ref:t})});jA.displayName=AA;var MA=`MenuSub`,[NA,PA]=zk(MA),FA=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Wk(MA,t),o=Vk(t),[s,c]=j.useState(null),[l,u]=j.useState(null),d=E_(i);return j.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,M.jsx)(OD,{...o,children:(0,M.jsx)(Uk,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,M.jsx)(NA,{scope:t,contentId:pS(),triggerId:pS(),trigger:s,onTriggerChange:c,children:n})})})};FA.displayName=MA;var IA=`MenuSubTrigger`,LA=j.forwardRef((e,t)=>{let n=Wk(IA,e.__scopeMenu),r=Kk(IA,e.__scopeMenu),i=PA(IA,e.__scopeMenu),a=nA(IA,e.__scopeMenu),o=j.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=j.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return j.useEffect(()=>u,[u]),j.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,M.jsx)(Yk,{asChild:!0,...l,children:(0,M.jsx)(hA,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":BA(n.open),...e,ref:d_(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:q(e.onPointerMove,JA(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:q(e.onPointerLeave,JA(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:q(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Nk[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});LA.displayName=IA;var RA=`MenuSubContent`,zA=j.forwardRef((e,t)=>{let n=Qk(eA,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Wk(eA,e.__scopeMenu),o=Kk(eA,e.__scopeMenu),s=PA(RA,e.__scopeMenu),c=j.useRef(null),l=f_(t,c);return(0,M.jsx)(Ik.Provider,{scope:e.__scopeMenu,children:(0,M.jsx)(q_,{present:r||a.open,children:(0,M.jsx)(Ik.Slot,{scope:e.__scopeMenu,children:(0,M.jsx)(sA,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:q(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:q(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:q(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Pk[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});zA.displayName=RA;function BA(e){return e?`open`:`closed`}function VA(e){return e===`indeterminate`}function HA(e){return VA(e)?`indeterminate`:e?`checked`:`unchecked`}function UA(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function WA(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function GA(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=WA(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function KA(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function qA(e,t){return t?KA({x:e.clientX,y:e.clientY},t):!1}function JA(e){return t=>t.pointerType===`mouse`?e(t):void 0}var YA=qk,XA=Yk,ZA=$k,QA=rA,$A=lA,ej=dA,tj=mA,nj=_A,rj=xA,ij=CA,aj=DA,oj=kA,sj=jA,cj=LA,lj=zA,uj=`DropdownMenu`,[dj,fj]=m_(uj,[Bk]),pj=Bk(),[mj,hj]=dj(uj),gj=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=pj(t),l=j.useRef(null),[u,d]=Q_({prop:i,defaultProp:a??!1,onChange:o,caller:uj});return(0,M.jsx)(mj,{scope:t,triggerId:pS(),triggerRef:l,contentId:pS(),open:u,onOpenChange:d,onOpenToggle:j.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,M.jsx)(YA,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};gj.displayName=uj;var _j=`DropdownMenuTrigger`,vj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=hj(_j,n),o=pj(n);return(0,M.jsx)(XA,{asChild:!0,...o,children:(0,M.jsx)(w_.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:d_(t,a.triggerRef),onPointerDown:q(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:q(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});vj.displayName=_j;var yj=`DropdownMenuPortal`,bj=e=>{let{__scopeDropdownMenu:t,...n}=e,r=pj(t);return(0,M.jsx)(ZA,{...r,...n})};bj.displayName=yj;var xj=`DropdownMenuContent`,Sj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=hj(xj,n),a=pj(n),o=j.useRef(!1);return(0,M.jsx)(QA,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:q(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:q(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Sj.displayName=xj;var Cj=`DropdownMenuGroup`,wj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)($A,{...i,...r,ref:t})});wj.displayName=Cj;var Tj=`DropdownMenuLabel`,Ej=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(ej,{...i,...r,ref:t})});Ej.displayName=Tj;var Dj=`DropdownMenuItem`,Oj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(tj,{...i,...r,ref:t})});Oj.displayName=Dj;var kj=`DropdownMenuCheckboxItem`,Aj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(nj,{...i,...r,ref:t})});Aj.displayName=kj;var jj=`DropdownMenuRadioGroup`,Mj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(rj,{...i,...r,ref:t})});Mj.displayName=jj;var Nj=`DropdownMenuRadioItem`,Pj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(ij,{...i,...r,ref:t})});Pj.displayName=Nj;var Fj=`DropdownMenuItemIndicator`,Ij=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(aj,{...i,...r,ref:t})});Ij.displayName=Fj;var Lj=`DropdownMenuSeparator`,Rj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(oj,{...i,...r,ref:t})});Rj.displayName=Lj;var zj=`DropdownMenuArrow`,Bj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(sj,{...i,...r,ref:t})});Bj.displayName=zj;var Vj=`DropdownMenuSubTrigger`,Hj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(cj,{...i,...r,ref:t})});Hj.displayName=Vj;var Uj=`DropdownMenuSubContent`,Wj=j.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=pj(n);return(0,M.jsx)(lj,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Wj.displayName=Uj;var Gj=gj,Kj=vj,qj=bj,Jj=Sj,Yj=Ej,Xj=Oj,Zj=Aj,Qj=Pj,$j=Ij,eM=Rj,tM=Hj,nM=Wj,rM=Gj,iM=Kj,aM=j.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,M.jsxs)(tM,{ref:i,className:X(`flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...r,children:[n,(0,M.jsx)(yy,{className:`ml-auto`})]}));aM.displayName=tM.displayName;var oM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(nM,{ref:n,className:X(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));oM.displayName=nM.displayName;var sM=j.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,M.jsx)(qj,{children:(0,M.jsx)(Jj,{ref:r,sideOffset:t,className:X(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));sM.displayName=Jj.displayName;var cM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(Xj,{ref:r,className:X(`relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...n}));cM.displayName=Xj.displayName;var lM=j.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,M.jsxs)(Zj,{ref:i,className:X(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)($j,{children:(0,M.jsx)(_y,{className:`h-4 w-4`})})}),t]}));lM.displayName=Zj.displayName;var uM=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(Qj,{ref:r,className:X(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)($j,{children:(0,M.jsx)(Ty,{className:`h-2 w-2 fill-current`})})}),t]}));uM.displayName=Qj.displayName;var dM=j.forwardRef(({className:e,inset:t,...n},r)=>(0,M.jsx)(Yj,{ref:r,className:X(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));dM.displayName=Yj.displayName;var fM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(eM,{ref:n,className:X(`-mx-1 my-1 h-px bg-muted`,e),...t}));fM.displayName=eM.displayName;var pM=({className:e,...t})=>(0,M.jsx)(`span`,{className:X(`ml-auto text-xs tracking-widest opacity-60`,e),...t});pM.displayName=`DropdownMenuShortcut`;var mM=`modulepreload`,hM=function(e){return`/_account/`+e},gM={},_M=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=hM(t,n),t in gM)return;gM[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:mM,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},vM=[`en`,`zh-CN`],yM={en:()=>_M(()=>import(`./en-QM3gmMOi.js`),[]),"zh-CN":()=>_M(()=>import(`./zh-CN-B0Jn4kQl.js`),[])};function bM(e){return vM.includes(e)?e:e.toLowerCase().startsWith(`zh`)?`zh-CN`:`en`}async function xM(e){let t=bM(e);try{return(await yM[t]()).default}catch(t){return console.warn(`[account/i18n] Failed to load language pack '${e}':`,t),{}}}var SM={en:`English`,"zh-CN":`中文`};function CM(){let{t:e,language:t,changeLanguage:n}=vt();async function r(e){await n(e);try{localStorage.setItem(`account.lang`,e)}catch{}}return(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsxs)(Z,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":e(`common.language`),children:[(0,M.jsx)(Py,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.language`)})]})}),(0,M.jsx)(sM,{align:`end`,children:vM.map(e=>(0,M.jsx)(cM,{onSelect:()=>void r(e),className:e===t?`font-medium`:void 0,children:SM[e]},e))})]})}function wM(e){let t=document.documentElement;e===`dark`?t.classList.add(`dark`):t.classList.remove(`dark`)}function TM(){let{t:e}=vt(),[,t]=(0,j.useState)(`light`);(0,j.useEffect)(()=>{let e=localStorage.getItem(`theme`);e?(t(e),wM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)):(t(`system`),wM(window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`))},[]);function n(e){t(e),localStorage.setItem(`theme`,e),wM(e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e)}return(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsxs)(Z,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,children:[(0,M.jsx)(Xy,{className:`h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,M.jsx)(Vy,{className:`absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,M.jsx)(`span`,{className:`sr-only`,children:e(`common.toggleTheme`)})]})}),(0,M.jsxs)(sM,{align:`end`,children:[(0,M.jsxs)(cM,{onClick:()=>n(`light`),children:[(0,M.jsx)(Xy,{className:`mr-2 h-4 w-4`}),e(`common.light`)]}),(0,M.jsxs)(cM,{onClick:()=>n(`dark`),children:[(0,M.jsx)(Vy,{className:`mr-2 h-4 w-4`}),e(`common.dark`)]}),(0,M.jsx)(cM,{onClick:()=>n(`system`),children:e(`common.system`)})]})]})}function EM(e,t=[]){let n=[];function r(t,r){let i=j.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=j.useMemo(()=>o,Object.values(o));return(0,M.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=j.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>j.createContext(e));return function(n){let r=n?.[e]||t;return j.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,DM(i,...t)]}function DM(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function OM(){return(0,ot.useSyncExternalStore)(kM,()=>!0,()=>!1)}function kM(){return()=>{}}var AM=`Avatar`,[jM,MM]=EM(AM),[NM,PM]=jM(AM),FM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,...r}=e,[i,a]=j.useState(`idle`);return(0,M.jsx)(NM,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:a,children:(0,M.jsx)(rS.span,{...r,ref:t})})});FM.displayName=AM;var IM=`AvatarImage`,LM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,src:r,onLoadingStatusChange:i=()=>{},...a}=e,o=PM(IM,n),s=VM(r,a),c=E_(e=>{i(e),o.onImageLoadingStatusChange(e)});return U_(()=>{s!==`idle`&&c(s)},[s,c]),s===`loaded`?(0,M.jsx)(rS.img,{...a,ref:t,src:r}):null});LM.displayName=IM;var RM=`AvatarFallback`,zM=j.forwardRef((e,t)=>{let{__scopeAvatar:n,delayMs:r,...i}=e,a=PM(RM,n),[o,s]=j.useState(r===void 0);return j.useEffect(()=>{if(r!==void 0){let e=window.setTimeout(()=>s(!0),r);return()=>window.clearTimeout(e)}},[r]),o&&a.imageLoadingStatus!==`loaded`?(0,M.jsx)(rS.span,{...i,ref:t}):null});zM.displayName=RM;function BM(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?`loaded`:`loading`):`error`:`idle`}function VM(e,{referrerPolicy:t,crossOrigin:n}){let r=OM(),i=j.useRef(null),a=r?(i.current||=new window.Image,i.current):null,[o,s]=j.useState(()=>BM(a,e));return U_(()=>{s(BM(a,e))},[a,e]),U_(()=>{let e=e=>()=>{s(e)};if(!a)return;let r=e(`loaded`),i=e(`error`);return a.addEventListener(`load`,r),a.addEventListener(`error`,i),t&&(a.referrerPolicy=t),typeof n==`string`&&(a.crossOrigin=n),()=>{a.removeEventListener(`load`,r),a.removeEventListener(`error`,i)}},[a,n,t]),o}var HM=FM,UM=LM,WM=zM,GM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(HM,{ref:n,className:X(`relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full`,e),...t}));GM.displayName=HM.displayName;var KM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(UM,{ref:n,className:X(`aspect-square h-full w-full`,e),...t}));KM.displayName=UM.displayName;var qM=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(WM,{ref:n,className:X(`flex h-full w-full items-center justify-center rounded-full bg-muted`,e),...t}));qM.displayName=WM.displayName;var JM=(0,j.createContext)(null),YM=`auth-session-token`,XM=`auth-active-organization-id`;function ZM(e){if(!(typeof window>`u`))try{e?.token?localStorage.setItem(YM,e.token):localStorage.removeItem(YM),e?.activeOrganizationId?localStorage.setItem(XM,e.activeOrganizationId):localStorage.removeItem(XM)}catch{}}function QM(e){if(!e)return{user:null,session:null};let t=e.data===void 0?e:e.data;return t?{user:t.user??null,session:t.session??null}:{user:null,session:null}}function $M({children:e}){let t=Qg(),[n,r]=(0,j.useState)(null),[i,a]=(0,j.useState)(null),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null),[u,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(!1),[g,_]=(0,j.useState)(null);(0,j.useEffect)(()=>{if(!t?.auth?.getConfig)return;let e=!1;return t.auth.getConfig().then(t=>{if(e)return;let n=t?.data??t??{},r={...n.features??{}};n.emailPassword?.disableSignUp===!0&&(r.signUpDisabled=!0),_(r)}).catch(()=>{e||_(null)}),()=>{e=!0}},[t]);let v=(0,j.useCallback)(async()=>{if(t?.organizations){p(!0);try{d((await t.organizations.list())?.organizations??[])}catch{d([])}finally{p(!1),h(!0)}}},[t]),y=(0,j.useCallback)(async()=>{if(t?.auth){s(!0),l(null);try{let{user:e,session:n}=QM(await t.auth.me());r(e),a(n),ZM(e?n:null)}catch(e){l(e),r(null),a(null),ZM(null)}finally{s(!1)}}},[t]);(0,j.useEffect)(()=>{y()},[y]),(0,j.useEffect)(()=>{n?v():(d([]),h(!1))},[n,v]);let b=(0,j.useCallback)(async()=>{if(t?.auth)try{await t.auth.logout()}finally{r(null),a(null),d([]),h(!1),ZM(null)}},[t]),x=(0,j.useCallback)(async e=>{if(t?.organizations){await t.organizations.setActive(e),await y();try{localStorage.setItem(XM,e)}catch{}}},[t,y]),S=(0,j.useMemo)(()=>({user:n,session:i,loading:o,error:c,refresh:y,logout:b,setActiveOrganization:x,organizations:u,organizationsLoading:f,organizationsFetched:m,reloadOrganizations:v,features:g}),[n,i,o,c,y,b,x,u,f,m,v,g]);return(0,j.createElement)(JM.Provider,{value:S},e)}function eN(){let e=(0,j.useContext)(JM);if(!e)throw Error(`useSession must be used inside <SessionProvider>.`);return e}function tN(){let{organizations:e,organizationsLoading:t,reloadOrganizations:n}=eN();return{organizations:e,loading:t,error:null,reload:n}}function nN(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{create:(0,j.useCallback)(async t=>{if(!e?.organizations)throw Error(`Client not ready`);n(!0),i(null);try{return await e.organizations.create(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),creating:t,error:r}}function rN(){let e=Qg(),{reloadOrganizations:t,refresh:n}=eN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{update:(0,j.useCallback)(async(r,a)=>{if(!e?.organizations?.update)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.update(r,a);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),updating:r,error:a}}function iN(){let e=Qg(),{reloadOrganizations:t,refresh:n}=eN(),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async r=>{if(!e?.organizations?.delete)throw Error(`Client not ready`);i(!0),o(null);try{let i=await e.organizations.delete(r);return await t(),await n(),i}catch(e){throw o(e),e}finally{i(!1)}},[e,t,n]),deleting:r,error:a}}function aN({message:e}){return typeof document>`u`?null:(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e})]})}),document.body)}function oN(e,t){let n=(e||t||`?`).trim(),r=n.split(/\s+/);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():n.slice(0,2).toUpperCase()}function sN(){let{t:e}=vt(),t=Hi(),{user:n,loading:r,logout:i}=eN(),[a,o]=(0,j.useState)(!1);return r&&!n?(0,M.jsx)(`div`,{className:`h-8 w-8 animate-pulse rounded-full bg-muted`,"aria-hidden":!0}):n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsx)(Z,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,children:(0,M.jsxs)(GM,{className:`h-7 w-7`,children:[n.image?(0,M.jsx)(KM,{src:n.image,alt:n.name??n.email??e(`userMenu.user`)}):null,(0,M.jsx)(qM,{className:`text-[11px]`,children:oN(n.name,n.email)})]})})}),(0,M.jsxs)(sM,{align:`end`,className:`w-64`,children:[(0,M.jsx)(dM,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:n.name||n.email}),n.email&&(0,M.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:n.email})]})}),(0,M.jsx)(fM,{}),(0,M.jsxs)(cM,{onSelect:()=>t({to:`/account`}),children:[(0,M.jsx)(rb,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.account`)]}),(0,M.jsxs)(cM,{onSelect:()=>t({to:`/organizations`}),children:[(0,M.jsx)(gy,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.organizations`)]}),(0,M.jsx)(fM,{}),(0,M.jsxs)(cM,{onSelect:async()=>{o(!0);try{await i()}finally{window.location.assign(`/_account/login`)}},disabled:a,children:[(0,M.jsx)(Ly,{className:`mr-2 h-3.5 w-3.5`}),e(`userMenu.signOut`)]})]})]}),a?(0,M.jsx)(aN,{message:e(`auth.userMenu.signingOut`,{defaultValue:`Signing you out…`})}):null]}):(0,M.jsx)(Z,{variant:`outline`,size:`sm`,className:`h-8`,onClick:()=>t({to:`/login`}),children:e(`userMenu.signIn`)})}function cN(){let{t:e}=vt(),t=Hi(),n=Oa(),{organizations:r,loading:i,reload:a}=tN(),{session:o,setActiveOrganization:s}=eN(),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=o?.activeOrganizationId??void 0,p=(0,j.useMemo)(()=>r.find(e=>e.id===f)??null,[r,f]),m=async r=>{if(l(!1),r===f){t({to:`/organizations/$orgId/general`,params:{orgId:r}});return}d(!0);try{await s(r),await a(),K({title:e(`organizations.general.switched`)});let i=n.pathname.match(/^\/organizations\/[^/]+\/(general|members)\/?$/);t({to:(i?i[1]:`general`)===`members`?`/organizations/$orgId/members`:`/organizations/$orgId/general`,params:{orgId:r}})}catch(t){K({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}};return(0,M.jsxs)(rM,{open:c,onOpenChange:l,children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsxs)(Z,{variant:`ghost`,size:`sm`,className:`h-8 gap-2 px-2 text-sm font-medium`,disabled:u,children:[p?(0,M.jsx)(`span`,{className:`max-w-[160px] truncate`,children:p.name}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(i?`organizations.loading`:`organizationSwitcher.select`)}),(0,M.jsx)(xy,{className:`h-3 w-3 opacity-50`})]})}),(0,M.jsxs)(sM,{align:`start`,className:`w-[280px]`,sideOffset:4,children:[(0,M.jsx)(dM,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e(`organizations.title`)}),r.length===0&&!i&&(0,M.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:e(`organizations.emptyTitle`)}),r.map(e=>(0,M.jsxs)(cM,{onSelect:t=>{t.preventDefault(),m(e.id)},className:`flex items-center gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsx)(`div`,{className:`truncate font-medium`,children:e.name}),e.slug&&(0,M.jsx)(`code`,{className:`text-[11px] text-muted-foreground font-mono`,children:e.slug})]}),e.id===f&&(0,M.jsx)(_y,{className:`h-3.5 w-3.5 text-primary`})]},e.id)),(0,M.jsx)(fM,{}),(0,M.jsxs)(cM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations/new`})},className:`gap-2 text-sm`,children:[(0,M.jsx)(Uy,{className:`h-3.5 w-3.5`}),e(`organizationSwitcher.new`)]}),(0,M.jsx)(cM,{onSelect:e=>{e.preventDefault(),l(!1),t({to:`/organizations`})},className:`gap-2 text-sm text-muted-foreground`,children:e(`organizationSwitcher.manage`)})]})]})}function lN({label:e}){return(0,M.jsx)(`a`,{href:`/`,className:`flex h-8 w-8 items-center justify-center rounded-md bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15 transition-transform hover:scale-105`,"aria-label":e,children:(0,M.jsx)(Cy,{className:`h-4 w-4`})})}function uN(){return(0,M.jsx)(yy,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground/50`})}function dN(){let{t:e}=vt(),t=Oa(),n=Bi({strict:!1}),r=(0,j.useMemo)(()=>{let r=t.pathname,i=t=>e(`topBar.breadcrumb.${t}`);if(r.startsWith(`/account`)){let e=[{label:i(`account`)}];return r===`/account/profile`?e.push({label:i(`profile`)}):r===`/account/security`?e.push({label:i(`security`)}):r===`/account/sessions`?e.push({label:i(`sessions`)}):r===`/account/two-factor`?e.push({label:i(`twoFactor`)}):r===`/account/oauth-applications`?e.push({label:i(`oauthApps`)}):r===`/account/oauth-applications/new`?e.push({label:i(`oauthApps`)},{label:i(`new`)}):r.startsWith(`/account/oauth-applications/`)&&e.push({label:i(`oauthApps`)}),e}if(r===`/organizations/new`)return[{label:i(`organizations`)},{label:i(`new`)}];if(n.orgId){let e=r.endsWith(`/general`)?i(`general`):r.endsWith(`/members`)?i(`members`):i(`settings`);return[{label:i(`organizations`)},{label:e}]}return r===`/organizations`||r.startsWith(`/organizations/`)?[{label:i(`organizations`)}]:r.startsWith(`/accept-invitation/`)?[{label:i(`acceptInvitation`)}]:r.startsWith(`/auth/device`)?[{label:i(`deviceAuthorization`)}]:[{label:i(`account`)}]},[t.pathname,n.orgId,e]);return(0,M.jsxs)(`header`,{className:`sticky top-0 z-30 flex h-14 shrink-0 items-center justify-between gap-2 border-b bg-background/80 px-2 backdrop-blur supports-[backdrop-filter]:bg-background/70 sm:px-4`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 sm:gap-2.5`,children:[(0,M.jsx)(`div`,{className:`sm:hidden`,children:(0,M.jsx)(AO,{className:`h-9 w-9`})}),(0,M.jsx)(lN,{label:e(`topBar.accountHome`)}),(0,M.jsx)(`span`,{className:`hidden text-sm font-semibold tracking-tight sm:inline`,children:e(`topBar.brand`)}),(0,M.jsxs)(`div`,{className:`hidden items-center gap-1.5 sm:flex`,children:[(0,M.jsx)(uS,{orientation:`vertical`,className:`mx-1 h-4`}),(0,M.jsx)(cN,{}),(0,M.jsx)(uN,{}),(0,M.jsx)($O,{children:(0,M.jsx)(ek,{children:r.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex items-center`,children:[t>0&&(0,M.jsx)(ik,{}),(0,M.jsx)(tk,{children:(0,M.jsx)(rk,{className:`font-medium`,children:e.label})})]},t))})})]}),(0,M.jsx)(`div`,{className:`min-w-0 flex-1 sm:hidden`,children:r.length>0&&(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:r[r.length-1].label})})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1 sm:gap-2`,children:[(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(CM,{})}),(0,M.jsx)(`div`,{className:`hidden sm:block`,children:(0,M.jsx)(TM,{})}),(0,M.jsx)(sN,{})]})]})}var fN=[{to:`/account`,label:`home`,icon:jy,exact:!0},{to:`/account/profile`,label:`profile`,icon:rb},{to:`/account/security`,label:`security`,icon:Jy},{to:`/account/sessions`,label:`sessions`,icon:By},{to:`/account/two-factor`,label:`twoFactor`,icon:qy},{to:`/account/invitations`,label:`invitations`,icon:My},{to:`/account/linked-accounts`,label:`linkedAccounts`,icon:Iy}],pN=[`group/nav relative transition-all duration-150`,`before:absolute before:left-0 before:top-1/2 before:h-5 before:w-[3px] before:-translate-y-1/2 before:rounded-r-full before:bg-brand-gradient before:opacity-0 before:transition-opacity`,`data-[active=true]:before:opacity-100`,`data-[active=true]:bg-sidebar-accent/80 data-[active=true]:text-sidebar-accent-foreground`,`[&>svg]:transition-transform [&>svg]:duration-150 hover:[&>svg]:scale-110`,`data-[active=true]:[&>svg]:text-primary`].join(` `);function mN(){let{t:e}=vt(),{pathname:t}=Oa(),{organizations:n}=tN(),r=t,i=t.match(/^\/organizations\/([^/]+)(?:\/.*)?$/),a=i&&n.some(e=>e.id===i[1])?i[1]:null;return(0,M.jsxs)(kO,{collapsible:`icon`,className:`h-full`,children:[(0,M.jsxs)(LO,{children:[(0,M.jsxs)(RO,{children:[(0,M.jsx)(zO,{children:e(`sidebar.groups.account`)}),(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{children:fN.map(t=>{let n=t.icon;return(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t.exact?r===t.to||r===`${t.to}/`:r===t.to||r.startsWith(`${t.to}/`),tooltip:e(`sidebar.items.${t.label}`),className:pN,children:(0,M.jsxs)(ra,{to:t.to,children:[(0,M.jsx)(n,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.${t.label}`)})]})})},t.to)})})})]}),(0,M.jsx)(IO,{}),(0,M.jsxs)(RO,{children:[(0,M.jsx)(zO,{children:e(`sidebar.groups.organization`)}),(0,M.jsx)(VO,{children:(0,M.jsxs)(HO,{children:[(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations`,tooltip:e(`sidebar.items.overview`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations`,children:[(0,M.jsx)(gy,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.overview`)})]})})}),a&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations/${a}/general`,tooltip:e(`sidebar.items.general`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/general`,params:{orgId:a},children:[(0,M.jsx)(Ky,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.general`)})]})})}),(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations/${a}/members`,tooltip:e(`sidebar.items.members`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/members`,params:{orgId:a},children:[(0,M.jsx)(ab,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.members`)})]})})}),(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t===`/organizations/${a}/teams`,tooltip:e(`sidebar.items.teams`),className:pN,children:(0,M.jsxs)(ra,{to:`/organizations/$orgId/teams`,params:{orgId:a},children:[(0,M.jsx)(ib,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.teams`)})]})})})]})]})})]}),(0,M.jsx)(IO,{}),(0,M.jsxs)(RO,{children:[(0,M.jsx)(zO,{children:e(`sidebar.groups.developer`)}),(0,M.jsx)(VO,{children:(0,M.jsx)(HO,{children:(0,M.jsx)(UO,{children:(0,M.jsx)(WO,{asChild:!0,isActive:t.startsWith(`/account/oauth-applications`),tooltip:e(`sidebar.items.oauthApps`),className:pN,children:(0,M.jsxs)(ra,{to:`/account/oauth-applications`,children:[(0,M.jsx)(Ny,{className:`size-4`}),(0,M.jsx)(`span`,{children:e(`sidebar.items.oauthApps`)})]})})})})})]})]}),(0,M.jsx)(FO,{children:(0,M.jsx)(HO,{children:(0,M.jsx)(UO,{children:(0,M.jsx)(hN,{})})})})]})}function hN(){let{t:e}=vt(),{state:t,toggleSidebar:n}=DO(),r=e(t===`collapsed`?`sidebar.expand`:`sidebar.collapse`);return(0,M.jsx)(WO,{onClick:n,tooltip:r,"aria-label":r,children:(0,M.jsx)(Hy,{className:`size-4`})})}function gN(){return typeof window<`u`&&window.location.pathname.startsWith(`/_account`)?window.location.origin:`http://localhost:3000`}var _N=new Set([`/login`,`/register`,`/forgot-password`,`/reset-password`,`/verify-email`,`/verify-email-prompt`,`/auth/device`,`/setup`]);function vN(e){return _N.has(e)||e.startsWith(`/accept-invitation/`)}function yN(){let[e,t]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let n=await fetch(`/api/v1/auth/bootstrap-status`);if(!n.ok){e||t(!0);return}let r=await n.json();e||t(r.hasOwner!==!1)}catch{e||t(!0)}})(),()=>{e=!0}},[]),e}function bN({children:e}){let{user:t,loading:n}=eN(),r=Hi(),i=Oa(),a=vN(i.pathname),o=i.pathname.startsWith(`/oauth/`)||i.pathname===`/organizations/new`,s=yN(),c=i.pathname===`/setup`;return(0,j.useEffect)(()=>{s===!1&&!c&&!t&&r({to:`/setup`,replace:!0})},[s,c,t,r]),(0,j.useEffect)(()=>{n||s!==!1&&!t&&!a&&r({to:`/login`,search:{redirect:i.pathname+i.searchStr},replace:!0})},[t,n,a,r,i.pathname,i.searchStr,s]),s===null||n&&!t?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full flex-1 items-center justify-center bg-background`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted border-t-primary`})}):s===!1&&!c||!t&&!a?null:a||o?(0,M.jsx)(`div`,{className:`flex min-h-screen w-full`,children:e}):(0,M.jsxs)(OO,{className:`flex h-svh w-full flex-col`,children:[(0,M.jsx)(dN,{}),(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 w-full`,children:[(0,M.jsx)(mN,{}),(0,M.jsx)(MO,{className:`flex min-w-0 flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-auto bg-background`,children:e})})]})]})}function xN(){let e=gN();return(0,M.jsx)(Zg,{client:(0,j.useMemo)(()=>new Jg({baseUrl:e}),[e]),children:(0,M.jsxs)($M,{children:[(0,M.jsx)(bN,{children:(0,M.jsx)(ya,{})}),(0,M.jsx)(Vx,{})]})})}var SN=ca({component:xN}),Q=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));Q.displayName=`Card`;var CN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`flex flex-col space-y-1.5 p-6`,e),...t}));CN.displayName=`CardHeader`;var wN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`h3`,{ref:n,className:X(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));wN.displayName=`CardTitle`;var TN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`p`,{ref:n,className:X(`text-sm text-muted-foreground`,e),...t}));TN.displayName=`CardDescription`;var EN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`p-6 pt-0`,e),...t}));EN.displayName=`CardContent`;var DN=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`div`,{ref:n,className:X(`flex items-center p-6 pt-0`,e),...t}));DN.displayName=`CardFooter`;function ON(e){let t=e.split(`:`)[0].toLowerCase();return/^cloud\./.test(t)}function kN(){return typeof window>`u`?null:window.location.host||null}function AN({children:e,formWidth:t=`sm`}){let{t:n}=vt(),r=t===`md`?`max-w-md`:`max-w-sm`,i=kN(),a=!!i&&!ON(i);return j.useEffect(()=>{if(typeof document>`u`||!i)return;let e=document.title;return a&&(document.title=i),()=>{document.title=e}},[i,a]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsxs)(`div`,{className:X(`flex w-full flex-col gap-4`,r),children:[a?(0,M.jsx)(`div`,{className:`flex justify-center`,children:(0,M.jsx)(`span`,{className:`rounded-full border border-border/60 bg-background/60 px-2 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-foreground`,title:n(`auth.shell.tenantHostHint`,{defaultValue:`You are signing in to this workspace`}),children:i})}):null,e]})})}var jN=la(`/verify-email-prompt`)({validateSearch:e=>({email:typeof e.email==`string`?e.email:void 0,redirect:typeof e.redirect==`string`?e.redirect:void 0}),component:MN});function MN(){let{t:e}=vt(),t=Hi(),{email:n,redirect:r}=jN.useSearch(),i=Qg(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(AN,{children:(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10`,children:(0,M.jsx)(Ry,{className:`size-8 text-primary`})}),(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.title`,{defaultValue:`Verify your email address`})}),(0,M.jsx)(TN,{children:e(`auth.verifyEmail.description`,{defaultValue:`We sent a verification link to your email address. Please click the link to verify your account.`})})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n?(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.verifyEmail.sentTo`,{defaultValue:`Sent to:`}),` `,(0,M.jsx)(`span`,{className:`font-medium text-foreground`,children:n})]}):null,(0,M.jsx)(Z,{onClick:async()=>{if(!n||!i?.auth){K({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Cannot resend verification email`}),description:e(`auth.verifyEmail.emailMissing`,{defaultValue:`Email address is missing`}),variant:`destructive`});return}o(!0);try{let t=await fetch(`/api/v1/auth/send-verification-email`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:n,callbackURL:r||`/`})});if(!t.ok){let e=await t.json().catch(()=>({message:`Unknown error`}));throw Error(e.message||`Failed to send verification email`)}c(!0),K({title:e(`auth.verifyEmail.resentSuccess`,{defaultValue:`Verification email sent!`}),description:e(`auth.verifyEmail.resentDescription`,{defaultValue:`Please check your inbox and click the verification link.`})})}catch(t){K({title:e(`auth.verifyEmail.resendFailed`,{defaultValue:`Failed to resend verification email`}),description:t.message,variant:`destructive`})}finally{o(!1)}},disabled:a||s,className:`w-full`,variant:s?`outline`:`default`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Wy,{className:`mr-2 size-4 animate-spin`}),e(`auth.verifyEmail.resending`,{defaultValue:`Sending...`})]}):s?e(`auth.verifyEmail.resent`,{defaultValue:`Email sent! Check your inbox`}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Wy,{className:`mr-2 size-4`}),e(`auth.verifyEmail.resendButton`,{defaultValue:`Resend verification email`})]})}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:e(`auth.verifyEmail.or`,{defaultValue:`Or`})})})]}),(0,M.jsx)(Z,{onClick:()=>{t({to:`/login`,search:r?{redirect:r}:void 0})},variant:`ghost`,className:`w-full`,children:e(`auth.verifyEmail.backToLogin`,{defaultValue:`Back to login`})}),(0,M.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:e(`auth.verifyEmail.checkSpam`,{defaultValue:`Didn't receive the email? Check your spam folder or contact support.`})})]})})]})})})}var NN=la(`/verify-email`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:PN});function PN(){let{t:e}=vt(),{token:t}=NN.useSearch(),n=Qg(),[r,i]=(0,j.useState)(`loading`),[a,o]=(0,j.useState)(``);return(0,j.useEffect)(()=>{if(!t){i(`error`),o(e(`auth.verifyEmail.missingToken`));return}let r=!1;return(async()=>{try{await n.auth.verifyEmail({token:t}),r||i(`success`)}catch(t){r||(i(`error`),o(t.message||e(`auth.verifyEmail.errorDescription`)))}})(),()=>{r=!0}},[t,e,n]),(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[r===`loading`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.verifyingTitle`)}),(0,M.jsx)(TN,{children:e(`auth.verifyEmail.verifyingDescription`)})]}),(0,M.jsx)(EN,{className:`flex justify-center py-6`,children:(0,M.jsx)(`div`,{className:`h-10 w-10 animate-spin rounded-full border-4 border-muted border-t-primary`})})]}),r===`success`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-500 ring-1 ring-emerald-500/30`,children:(0,M.jsx)(Sy,{className:`size-6`})}),(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.successTitle`)}),(0,M.jsx)(TN,{children:e(`auth.verifyEmail.successDescription`)})]}),(0,M.jsx)(EN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.signInLink`)})})]}),r===`error`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-2 flex size-12 items-center justify-center rounded-full bg-destructive/10 text-destructive ring-1 ring-destructive/30`,children:(0,M.jsx)(wy,{className:`size-6`})}),(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.verifyEmail.errorTitle`)}),(0,M.jsx)(TN,{children:a||e(`auth.verifyEmail.errorDescription`)})]}),(0,M.jsx)(EN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.verifyEmail.backToSignIn`)})})]})]})})}var FN=`Label`,IN=j.forwardRef((e,t)=>(0,M.jsx)(rS.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));IN.displayName=FN;var LN=IN,RN=iy(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),$=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(LN,{ref:n,className:X(RN(),e),...t}));$.displayName=LN.displayName;var zN=la(`/setup`)({component:VN});function BN(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function VN(){let{t:e}=vt(),t=Hi(),n=Qg(),{user:r,refresh:i}=eN(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(``),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null);return(0,j.useEffect)(()=>{let e=!1;return(async()=>{try{let{hasOwner:t}=await n.auth.bootstrapStatus();e||g(t)}catch{e||g(!1)}})(),()=>{e=!0}},[n]),(0,j.useEffect)(()=>{h===!0&&!r&&t({to:`/login`,replace:!0})},[h,r,t]),(0,j.useEffect)(()=>{r&&window.location.assign(`/`)},[r]),h===null?(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted`,children:(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-4 border-muted-foreground/20 border-t-primary`})}):(0,M.jsx)(`div`,{className:`flex min-h-svh w-full items-center justify-center bg-muted p-6`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-md flex-col gap-6`,children:(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.setup.welcomeTitle`)}),(0,M.jsx)(TN,{children:e(`auth.setup.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),n?.auth){m(!0);try{await n.auth.register({name:a,email:s,password:l}),await i();let e=d.trim();if(e)try{let{organizations:t}=await n.organizations.list(),r=t?.[0],i;if(r?.id)await n.organizations.update(r.id,{name:e,slug:BN(e)}),i=r.id;else{let t=await n.organizations.create({name:e,slug:BN(e)});i=t?.id??t?.data?.id}i&&await n.organizations.setActive(i).catch(()=>{})}catch(e){console.warn(`[setup] organization rename/create failed`,e)}window.location.assign(`/`)}catch(t){K({title:e(`auth.setup.failed`),description:t.message,variant:`destructive`})}finally{m(!1)}}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`name`,children:e(`auth.setup.yourName`)}),(0,M.jsx)(nS,{id:`name`,autoComplete:`name`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`orgName`,children:e(`auth.setup.orgName`)}),(0,M.jsx)(nS,{id:`orgName`,required:!0,placeholder:e(`auth.setup.orgNamePlaceholder`),value:d,onChange:e=>f(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(nS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,placeholder:e(`auth.setup.passwordHint`),value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`mt-2 w-full`,disabled:p,children:e(p?`auth.setup.submitting`:`auth.setup.submit`)})]})})]})})})}var HN=la(`/reset-password`)({validateSearch:e=>{let t=e.token;return typeof t==`string`?{token:t}:{}},component:UN});function UN(){let{t:e}=vt(),t=Hi(),{token:n}=HN.useSearch(),[r,i]=(0,j.useState)(``),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(!1);return(0,M.jsx)(AN,{children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.resetPassword.title`)}),(0,M.jsx)(TN,{children:e(`auth.resetPassword.description`)})]}),(0,M.jsx)(EN,{children:n?(0,M.jsxs)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r!==a){K({title:e(`auth.resetPassword.passwordsMismatch`),variant:`destructive`});return}if(!n){K({title:e(`auth.resetPassword.missingToken`),variant:`destructive`});return}c(!0);try{let i=await fetch(`/api/v1/auth/reset-password`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({token:n,newPassword:r})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${i.status}`)}K({title:e(`auth.resetPassword.success`)}),t({to:`/login`})}catch(t){K({title:e(`auth.resetPassword.failed`),description:t.message,variant:`destructive`})}finally{c(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`new-password`,children:e(`auth.resetPassword.newPassword`)}),(0,M.jsx)(nS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:r,onChange:e=>i(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`confirm-password`,children:e(`auth.resetPassword.confirmPassword`)}),(0,M.jsx)(nS,{id:`confirm-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:s,children:e(s?`auth.resetPassword.submitting`:`auth.resetPassword.submit`)})]}):(0,M.jsxs)(`p`,{className:`text-sm text-muted-foreground text-center`,children:[e(`auth.resetPassword.invalidToken`),` `,(0,M.jsx)(ra,{to:`/forgot-password`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.resetPassword.requestNewLink`)})]})})]})})}function WN({mode:e,redirect:t}){let{t:n}=vt(),r=Qg(),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(null);if((0,j.useEffect)(()=>{r?.auth?.getConfig&&r.auth.getConfig().then(e=>{a((e?.socialProviders??e?.data?.socialProviders??[]).filter(e=>e.enabled))}).catch(e=>{console.warn(`[SocialSignInButtons] failed to load auth config`,e)}).finally(()=>s(!1))},[r]),o||i.length===0)return null;let u=n(e===`sign-in`?`auth.social.continueWith`:`auth.social.signUpWith`),d=window.location.origin+`/_account/login`+(t?`?redirect=${encodeURIComponent(t)}`:``),f=e=>{c||(l(e),Promise.resolve(r.auth.signInWithProvider(e.id,{callbackURL:d,errorCallbackURL:d,type:e.type??`social`})).catch(e=>{console.warn(`[SocialSignInButtons] signInWithProvider failed`,e),l(null)}))};return(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.map(e=>{let t=c?.id===e.id;return(0,M.jsxs)(Z,{type:`button`,variant:`outline`,className:`w-full`,disabled:!!c,onClick:()=>f(e),children:[t?(0,M.jsx)(`span`,{className:`mr-2 inline-block size-4 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}):(0,M.jsx)(`span`,{className:`mr-2 flex h-4 w-4 items-center justify-center rounded-sm bg-muted text-[10px] font-bold uppercase`,children:e.id[0]}),t?n(`auth.social.redirectingTo`,{provider:e.name,defaultValue:`Redirecting to ${e.name}…`}):`${u} ${e.name}`]},e.id)}),(0,M.jsxs)(`div`,{className:`relative my-1`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,M.jsx)(`span`,{className:`w-full border-t`})}),(0,M.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,M.jsx)(`span`,{className:`bg-card px-2 text-muted-foreground`,children:n(`auth.social.orContinueEmail`)})})]}),c&&typeof document<`u`?(0,Gi.createPortal)((0,M.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/80 backdrop-blur-sm`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-8 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:n(`auth.social.redirectingTo`,{provider:c.name,defaultValue:`Redirecting to ${c.name}…`})})]})}),document.body):null]})}function GN(e,t){if(e.metaKey||e.ctrlKey||e.shiftKey||e.button===1)return;e.preventDefault();let n=Math.min(960,window.screen.availWidth-80),r=Math.min(720,window.screen.availHeight-80),i=Math.max(0,Math.round((window.screen.availWidth-n)/2)),a=Math.max(0,Math.round((window.screen.availHeight-r)/2)),o=[`popup=yes`,`width=${n}`,`height=${r}`,`left=${i}`,`top=${a}`,`resizable=yes`,`scrollbars=yes`,`noopener=yes`,`noreferrer=yes`].join(`,`);window.open(t,`objectstack-legal`,o)||window.open(t,`_blank`,`noopener,noreferrer`)}function KN({termsUrl:e,privacyUrl:t}){let{t:n}=vt(`account`),r=typeof e==`string`&&e.length>0,i=typeof t==`string`&&t.length>0;return!r&&!i?null:(0,M.jsxs)(`p`,{className:`px-6 text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary`,children:[n(`legal.agreementPrefix`),` `,r?(0,M.jsx)(`a`,{href:e,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:t=>GN(t,e),children:n(`legal.termsOfService`)}):null,r&&i?(0,M.jsxs)(M.Fragment,{children:[` `,n(`legal.and`),` `]}):null,i?(0,M.jsx)(`a`,{href:t,target:`objectstack-legal`,rel:`noreferrer noopener`,onClick:e=>GN(e,t),children:n(`legal.privacyPolicy`)}):null,`.`]})}var qN=la(`/register`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:XN});function JN(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function YN(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function XN(){let{t:e}=vt(),t=Hi(),{redirect:n}=qN.useSearch(),r=Qg(),{session:i,user:a,loading:o,refresh:s,organizations:c,organizationsLoading:l,organizationsFetched:u,setActiveOrganization:d,features:f}=eN();(0,j.useEffect)(()=>{f?.signUpDisabled===!0&&t({to:`/login`,search:n?{redirect:n}:{},replace:!0})},[f?.signUpDisabled,t,n]);let[p,m]=(0,j.useState)(``),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(a){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!i?.activeOrganizationId){if(!u||l||x)return;if(c.length===1){S(!0),d(c[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!f)return;if(c.length>1){t({to:`/organizations`});return}if(f.multiOrgEnabled===!1){JN(n)?window.location.assign(YN(n)):window.location.assign(`/`);return}t({to:`/organizations/new`,search:n?{redirect:n}:{}});return}if(!x){if(JN(n)){window.location.assign(YN(n));return}window.location.assign(`/`)}}},[a,i,t,n,c,l,u,x,d,f]),(0,M.jsx)(AN,{children:o||a?(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:a?e(`auth.register.signingIn`,{defaultValue:`Setting up your account…`}):e(`auth.login.redirecting`,{defaultValue:`Loading…`})})]}):(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.register.title`)}),(0,M.jsx)(TN,{children:e(`auth.register.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{let i=await r.auth.register({name:p,email:h,password:_}),a=i?.data??i;if(a&&a.token===null&&a.user){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}try{await s()}catch(e){let r=e.message;if(r.includes(`email`)&&(r.toLowerCase().includes(`verif`)||r.toLowerCase().includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}throw e}K({title:e(`auth.register.successToast`)})}catch(r){let i=r.message;if(i.includes(`email`)&&(i.toLowerCase().includes(`verif`)||i.toLowerCase().includes(`sent`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}K({title:e(`auth.register.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(WN,{mode:`sign-up`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`name`,children:e(`auth.nameLabel`)}),(0,M.jsx)(nS,{id:`name`,autoComplete:`name`,required:!0,value:p,onChange:e=>m(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(nS,{id:`password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.register.submitting`:`auth.register.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.register.haveAccount`),` `,(0,M.jsx)(ra,{to:`/login`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.register.signIn`)})]})]})})})]}),(0,M.jsx)(KN,{termsUrl:f?.termsUrl,privacyUrl:f?.privacyUrl})]})})}var ZN=la(`/login`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:eP});function QN(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function $N(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function eP(){let{t:e}=vt(),t=Hi(),{redirect:n}=ZN.useSearch(),r=Qg(),i=null;if(typeof window<`u`){let e=new URLSearchParams(window.location.search),t=e.get(`redirect_uri`);if(e.has(`client_id`)&&t)try{i=new URL(t).host}catch{i=null}}let{session:a,user:o,loading:s,refresh:c,organizations:l,organizationsLoading:u,organizationsFetched:d,setActiveOrganization:f,features:p}=eN(),m=p?.signUpDisabled===!0,[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{if(o){if(typeof window<`u`){let e=new URLSearchParams(window.location.search);if(e.has(`client_id`)&&e.has(`redirect_uri`)){window.location.assign(`/api/v1/auth/oauth2/authorize${window.location.search}`);return}}if(!a?.activeOrganizationId){if(!d||u||x)return;if(l.length===1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}if(!p)return;if(l.length===0){if(p.multiOrgEnabled===!1){QN(n)?window.location.assign($N(n)):window.location.assign(`/`);return}t({to:`/organizations/new`});return}if(p.multiOrgEnabled===!1){S(!0),f(l[0].id).catch(()=>void 0).finally(()=>S(!1));return}t({to:`/organizations`});return}if(!x){if(QN(n)){window.location.assign($N(n));return}window.location.assign(`/`)}}},[o,a,t,n,l,u,d,x,f,p]),s||o?(0,M.jsx)(AN,{children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-10 text-sm text-muted-foreground`,children:[(0,M.jsx)(`div`,{className:`size-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent`}),(0,M.jsx)(`span`,{children:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})})]})}):(0,M.jsxs)(AN,{children:[y?(0,M.jsx)(aN,{message:e(`auth.login.signingIn`,{defaultValue:`Signing you in…`})}):null,(0,M.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i?(0,M.jsxs)(`div`,{role:`status`,className:`flex items-start gap-3 rounded-md border border-primary/30 bg-primary/5 px-4 py-3 text-sm text-foreground`,children:[(0,M.jsx)(`span`,{className:`mt-0.5 inline-block size-2 shrink-0 rounded-full bg-primary`}),(0,M.jsx)(`span`,{children:e(`auth.login.ssoHandoff`,{target:i,defaultValue:`Continue to ${i}`})})]}):null,(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.login.title`)}),(0,M.jsx)(TN,{children:e(`auth.login.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsx)(`form`,{onSubmit:async i=>{if(i.preventDefault(),r?.auth){b(!0);try{await r.auth.login({type:`email`,email:h,password:_}),await c(),K({title:e(`auth.login.welcomeToast`)})}catch(r){let i=r.message,a=r.code,o=(i||``).toLowerCase();if(a===`EMAIL_NOT_VERIFIED`||o.includes(`email`)&&(o.includes(`verif`)||o.includes(`not verified`))){t({to:`/verify-email-prompt`,search:{email:h,redirect:n}});return}K({title:e(`auth.login.failed`),description:i,variant:`destructive`})}finally{b(!1)}}},children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,M.jsx)(WN,{mode:`sign-in`,redirect:n}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:h,onChange:e=>g(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center`,children:[(0,M.jsx)($,{htmlFor:`password`,children:e(`auth.passwordLabel`)}),(0,M.jsx)(ra,{to:`/forgot-password`,className:`ml-auto text-sm underline-offset-4 hover:underline`,children:e(`auth.login.forgotPassword`)})]}),(0,M.jsx)(nS,{id:`password`,type:`password`,autoComplete:`current-password`,required:!0,value:_,onChange:e=>v(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full`,disabled:y,children:e(y?`auth.login.submitting`:`auth.login.submit`)}),m?null:(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.login.noAccount`),` `,(0,M.jsx)(ra,{to:`/register`,search:n?{redirect:n}:void 0,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.login.signUp`)})]})]})})})]}),(0,M.jsx)(KN,{termsUrl:p?.termsUrl,privacyUrl:p?.privacyUrl})]})]})}var tP=la(`/forgot-password`)({component:nP});function nP(){let{t:e}=vt(),[t,n]=(0,j.useState)(``),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(!1);return(0,M.jsx)(AN,{children:(0,M.jsx)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:a?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.checkEmailTitle`)}),(0,M.jsx)(TN,{children:e(`auth.forgotPassword.checkEmailDescription`,{email:t})})]}),(0,M.jsx)(EN,{className:`text-center`,children:(0,M.jsx)(ra,{to:`/login`,className:`text-sm font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.backToSignIn`)})})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`auth.forgotPassword.title`)}),(0,M.jsx)(TN,{children:e(`auth.forgotPassword.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{n.preventDefault(),i(!0);try{let e=window.location.origin+`/_account/`.replace(/\/$/,``)+`/reset-password`,n=await fetch(`/api/v1/auth/forget-password`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({email:t,redirectTo:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e?.message||`Request failed: ${n.status}`)}o(!0)}catch(t){K({title:e(`auth.forgotPassword.failed`),description:t.message,variant:`destructive`})}finally{i(!1)}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`email`,children:e(`auth.emailLabel`)}),(0,M.jsx)(nS,{id:`email`,type:`email`,placeholder:e(`auth.emailPlaceholder`),autoComplete:`email`,required:!0,value:t,onChange:e=>n(e.target.value)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,disabled:r,children:e(r?`auth.forgotPassword.submitting`:`auth.forgotPassword.submit`)}),(0,M.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[e(`auth.forgotPassword.rememberPassword`),` `,(0,M.jsx)(ra,{to:`/login`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`auth.forgotPassword.signIn`)})]})]})})]})})})}var rP=la(`/account`)({component:iP});function iP(){return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsx)(`div`,{className:`page-enter mx-auto flex max-w-4xl flex-col gap-6`,children:(0,M.jsx)(ya,{})})})})}var aP=la(`/`)({component:oP});function oP(){return(0,M.jsx)(Ui,{to:`/login`})}var sP=iy(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function cP({className:e,variant:t,...n}){return(0,M.jsx)(`div`,{className:X(sP({variant:t}),e),...n})}function lP({title:e,description:t,icon:n,actions:r,className:i,...a}){return(0,M.jsxs)(`div`,{className:X(`relative overflow-hidden rounded-xl border bg-brand-gradient-subtle`,`px-5 py-5 sm:px-6 sm:py-6`,i),...a,children:[(0,M.jsx)(`div`,{className:`pointer-events-none absolute inset-0 opacity-60`,style:{backgroundImage:`radial-gradient(ellipse 60% 80% at 0% 0%, hsl(var(--brand-from) / 0.12), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between sm:gap-6`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[n?(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`,children:(0,M.jsx)(n,{className:`size-5`})}):null,(0,M.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,M.jsx)(`h1`,{className:`truncate text-xl font-semibold tracking-tight sm:text-2xl`,children:e}),t?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t}):null]})]}),r?(0,M.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:r}):null]})]})}var uP=la(`/organizations/`)({component:dP});function dP(){let{t:e}=vt(),{organizations:t,loading:n}=tN(),{session:r,setActiveOrganization:i,features:a}=eN(),o=Hi(),s=r?.activeOrganizationId??void 0,c=a?.multiOrgEnabled!==!1,l=async t=>{try{t!==s&&await i(t),o({to:`/organizations/$orgId`,params:{orgId:t}})}catch(t){K({title:e(`organizations.switchFailed`),description:t.message,variant:`destructive`})}},u=e=>e.split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-4 py-6 sm:px-6 sm:py-8`,children:(0,M.jsxs)(`div`,{className:`page-enter mx-auto flex max-w-3xl flex-col gap-6`,children:[(0,M.jsx)(lP,{icon:gy,title:e(`organizations.title`),description:e(`organizations.description`),actions:c?(0,M.jsxs)(Z,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`organizations.newOrganization`)]}):null}),n&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`organizations.loading`)}),!n&&t.length===0&&(0,M.jsxs)(Q,{className:`p-10 text-center`,children:[(0,M.jsx)(`div`,{className:`mx-auto mb-3 flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(gy,{className:`h-6 w-6`})}),(0,M.jsx)(`h3`,{className:`text-base font-medium`,children:e(`organizations.emptyTitle`)}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:e(`organizations.emptyDescription`)}),c&&(0,M.jsxs)(Z,{onClick:()=>o({to:`/organizations/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`organizations.createOrganization`)]})]}),(0,M.jsx)(`div`,{className:`grid gap-3`,children:t.map(t=>{let n=t.id===s;return(0,M.jsx)(Q,{role:`button`,tabIndex:0,onClick:()=>l(t.id),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(t.id))},className:`group cursor-pointer p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5 focus:outline-none focus:ring-2 focus:ring-ring ${n?`border-primary/50 bg-brand-gradient-subtle ring-1 ring-primary/30`:``}`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,M.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg font-semibold `+(n?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30 ring-1 ring-white/15`:`bg-muted text-muted-foreground group-hover:bg-brand-gradient-subtle group-hover:text-primary`),children:u(t.name)||(0,M.jsx)(gy,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`h3`,{className:`truncate text-base font-medium`,children:t.name}),n&&(0,M.jsxs)(cP,{className:`gap-1 border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:[(0,M.jsx)(_y,{className:`h-3 w-3`}),e(`organizations.active`)]})]}),t.slug&&(0,M.jsx)(`code`,{className:`mt-0.5 block font-mono text-xs text-muted-foreground`,children:t.slug})]}),(0,M.jsx)(yy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]})},t.id)})})]})})})}var fP=la(`/account/`)({component:pP});function pP(){let{t:e}=vt(),{user:t}=eN(),{organizations:n}=tN(),r=[!!t?.emailVerified,!!t?.twoFactorEnabled,!!t?.name,!!t?.image].filter(Boolean).length*25,i=r>=75?`success`:r>=50?`warn`:`danger`,a=(t?.name??t?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase(),o=[{to:`/account/profile`,label:e(`home.tiles.profile.title`,{defaultValue:`Profile`}),description:e(`home.tiles.profile.description`,{defaultValue:`Display name, avatar and contact info.`}),icon:rb},{to:`/account/security`,label:e(`home.tiles.security.title`,{defaultValue:`Security`}),description:e(`home.tiles.security.description`,{defaultValue:`Change your password and review activity.`}),icon:Jy},{to:`/account/two-factor`,label:e(`home.tiles.twoFactor.title`,{defaultValue:`Two-factor auth`}),description:e(`home.tiles.twoFactor.description`,{defaultValue:`Add an authenticator app for stronger sign-in.`}),icon:qy},{to:`/account/sessions`,label:e(`home.tiles.sessions.title`,{defaultValue:`Active sessions`}),description:e(`home.tiles.sessions.description`,{defaultValue:`See and revoke devices that are signed in.`}),icon:By},{to:`/account/linked-accounts`,label:e(`home.tiles.linked.title`,{defaultValue:`Linked accounts`}),description:e(`home.tiles.linked.description`,{defaultValue:`Manage your social and SSO providers.`}),icon:Iy},{to:`/account/oauth-applications`,label:e(`home.tiles.oauth.title`,{defaultValue:`OAuth applications`}),description:e(`home.tiles.oauth.description`,{defaultValue:`Apps you have authorised to access your account.`}),icon:Ny}];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-0 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-0 opacity-40 mix-blend-soft-light`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(0,0,0,0.25), transparent 60%)`},"aria-hidden":!0}),(0,M.jsxs)(`div`,{className:`relative flex flex-col gap-4 p-6 text-white sm:flex-row sm:items-center sm:gap-6 sm:p-8`,children:[(0,M.jsxs)(GM,{className:`size-16 shrink-0 ring-4 ring-white/30 shadow-md sm:size-20`,children:[t?.image?(0,M.jsx)(KM,{src:t.image,alt:t?.name??``}):null,(0,M.jsx)(qM,{className:`bg-white/20 text-base font-semibold text-white backdrop-blur`,children:a})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`p`,{className:`text-xs uppercase tracking-wider text-white/70`,children:e(`home.welcome`,{defaultValue:`Welcome back`})}),(0,M.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight`,children:t?.name||t?.email||`ObjectStack user`}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-white/80`,children:[(0,M.jsx)(zy,{className:`size-3.5`,"aria-hidden":!0}),(0,M.jsx)(`span`,{className:`truncate`,children:t?.email}),t?.emailVerified?(0,M.jsx)(cP,{className:`border-white/30 bg-white/15 text-[10px] font-medium text-white backdrop-blur hover:bg-white/20`,children:e(`home.verified`,{defaultValue:`Verified`})}):null]})]})]})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-3`,children:[(0,M.jsx)(mP,{icon:qy,label:e(`home.stats.score`,{defaultValue:`Security score`}),value:`${r}%`,tone:i,extra:(0,M.jsx)(`div`,{className:`mt-2 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,M.jsx)(`div`,{className:`h-full bg-brand-gradient transition-[width] duration-500`,style:{width:`${r}%`}})})}),(0,M.jsx)(mP,{icon:gy,label:e(`home.stats.orgs`,{defaultValue:`Organizations`}),value:String(n.length),extra:(0,M.jsxs)(ra,{to:`/organizations`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[e(`home.stats.manage`,{defaultValue:`Manage`}),(0,M.jsx)(hy,{className:`size-3`})]})}),(0,M.jsx)(mP,{icon:t?.twoFactorEnabled?qy:Jy,label:e(`home.stats.twoFactor`,{defaultValue:`Two-factor auth`}),value:t?.twoFactorEnabled?e(`home.stats.enabled`,{defaultValue:`Enabled`}):e(`home.stats.disabled`,{defaultValue:`Disabled`}),tone:t?.twoFactorEnabled?`success`:`warn`,extra:(0,M.jsxs)(ra,{to:`/account/two-factor`,className:`mt-2 inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline`,children:[t?.twoFactorEnabled?e(`home.stats.review`,{defaultValue:`Review`}):e(`home.stats.enable`,{defaultValue:`Enable now`}),(0,M.jsx)(hy,{className:`size-3`})]})})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-muted-foreground`,children:e(`home.quickAccess`,{defaultValue:`Quick access`})}),(0,M.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:o.map(({to:e,label:t,description:n,icon:r})=>(0,M.jsxs)(ra,{to:e,className:`group relative flex items-start gap-3 rounded-lg border bg-card p-4 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:[(0,M.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/10 transition-transform group-hover:scale-110`,children:(0,M.jsx)(r,{className:`size-4`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,M.jsx)(hy,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary`})]}),(0,M.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:n})]})]},e))})]})]})}function mP({icon:e,label:t,value:n,tone:r=`neutral`,extra:i}){let a=r===`success`?`text-emerald-600 dark:text-emerald-400`:r===`warn`?`text-amber-600 dark:text-amber-400`:r===`danger`?`text-destructive`:`text-foreground`;return(0,M.jsx)(Q,{className:`overflow-hidden`,children:(0,M.jsxs)(EN,{className:`p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:t}),(0,M.jsx)(e,{className:`size-4 ${a}`})]}),(0,M.jsx)(`p`,{className:`mt-1 text-2xl font-semibold tracking-tight ${a}`,children:n}),i]})})}var hP=la(`/organizations/new`)({validateSearch:e=>{let t=e.redirect;return typeof t==`string`?{redirect:t}:{}},component:yP});function gP(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function _P(e){return!!e&&e.startsWith(`/`)&&!e.startsWith(`//`)}function vP(e){return e.startsWith(`/_`)?e:`/_account/`.replace(/\/$/,``)+e}function yP(){let{t:e}=vt(),t=Hi(),{redirect:n}=hP.useSearch(),{create:r,creating:i}=nN(),{setActiveOrganization:a,reloadOrganizations:o,features:s}=eN(),[c,l]=(0,j.useState)(``),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1);(0,j.useEffect)(()=>{s&&s.multiOrgEnabled===!1&&t({to:`/organizations`})},[s,t]);let m=e=>{l(e),f||d(gP(e))};return(0,M.jsx)(AN,{formWidth:`md`,children:(0,M.jsxs)(Q,{className:`border-border/60 shadow-sm shadow-primary/5 backdrop-blur supports-[backdrop-filter]:bg-card/95`,children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl tracking-tight`,children:e(`organizations.new.title`)}),(0,M.jsx)(TN,{children:e(`organizations.new.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault();try{let t=await r({name:c,slug:u||void 0}),i=t?.data??t,s=i?.id??i?.organization?.id;s&&await a(s).catch(()=>{}),await o().catch(()=>{}),K({title:e(`organizations.new.successToast`)}),_P(n)?window.location.assign(vP(n)):window.location.assign(`/`)}catch(t){K({title:e(`organizations.new.failed`),description:t.message,variant:`destructive`})}},className:`flex flex-col gap-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`name`,children:e(`organizations.new.name`)}),(0,M.jsx)(nS,{id:`name`,required:!0,autoFocus:!0,value:c,onChange:e=>m(e.target.value),placeholder:e(`organizations.new.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,M.jsx)($,{htmlFor:`slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(nS,{id:`slug`,value:u,onChange:e=>{d(e.target.value),p(!0)},placeholder:e(`organizations.new.slugPlaceholder`),pattern:`[a-z0-9-]+`}),(0,M.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`organizations.new.slugHint`)})]}),(0,M.jsx)(Z,{type:`submit`,className:`w-full`,disabled:i||!c,children:e(i?`organizations.new.submitting`:`organizations.new.submit`)}),(0,M.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:(0,M.jsx)(ra,{to:`/organizations`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:e(`organizations.new.cancel`)})})]})})]})})}var bP=la(`/organizations/$orgId`)({component:xP});function xP(){let{t:e}=vt(),{orgId:t}=bP.useParams(),{organizations:n}=tN(),r=n.find(e=>e.id===t);return(0,M.jsx)(`div`,{className:`flex flex-1 flex-col overflow-hidden`,children:(0,M.jsx)(`div`,{className:`flex-1 overflow-auto px-6 py-8`,children:(0,M.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6`,children:[(0,M.jsxs)(`header`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:r?.name??e(`organizations.title`)}),r?.slug&&(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground font-mono`,children:r.slug})]}),(0,M.jsx)(ya,{})]})})})}function SP(){let e=Qg(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.oauth?.applications){i(!0),o(null);try{n((await e.oauth.applications.list())?.applications??[])}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{applications:t,loading:r,error:a,reload:s}}function CP(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(null);return{register:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.register)throw Error(`Client not ready`);n(!0),i(null);try{let n=await e.oauth.applications.register(t);return o(n),n}catch(e){throw i(e),e}finally{n(!1)}},[e]),registering:t,error:r,lastResult:a}}function wP(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{remove:(0,j.useCallback)(async t=>{if(!e?.oauth?.applications?.delete)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.applications.delete(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),deleting:t,error:r}}function TP(){let e=Qg(),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(null);return{submit:(0,j.useCallback)(async t=>{if(!e?.oauth?.consent)throw Error(`Client not ready`);n(!0),i(null);try{return await e.oauth.consent(t)}catch(e){throw i(e),e}finally{n(!1)}},[e]),submitting:t,error:r}}var EP=la(`/oauth/consent`)({validateSearch:e=>e,component:DP});function DP(){let{t:e}=vt(),t=Hi(),n=Qg(),{user:r,loading:i}=eN(),{submit:a,submitting:o}=TP(),[s,c]=(0,j.useState)(null),l=typeof window<`u`?window.location.search:``,u=l.startsWith(`?`)?l.slice(1):l,d=new URLSearchParams(u),f=d.get(`client_id`)??void 0,p=d.get(`scope`)??``;(0,j.useEffect)(()=>{i||r||t({to:`/login`,search:{redirect:window.location.pathname+window.location.search}})},[r,i,t]),(0,j.useEffect)(()=>{if(!f||!n?.oauth?.applications?.getPublic)return;let e=!1;return n.oauth.applications.getPublic(f).then(t=>{if(e)return;let n=t?.data??t;c({name:n?.name??n?.client_name,icon:n?.icon??n?.logo_uri})},()=>{}),()=>{e=!0}},[n,f]);let m=p.split(/\s+/).filter(Boolean),h=async t=>{try{let n=await a({accept:t,oauth_query:u}),r=n?.redirect_uri??n?.redirectURI??n?.url;if(r){window.location.href=r;return}K({title:e(t?`oauth.consent.granted`:`oauth.consent.denied`),description:e(`oauth.consent.noRedirect`),variant:t?void 0:`destructive`})}catch(t){K({title:e(`oauth.consent.failed`),description:t.message,variant:`destructive`})}},g=s?.name??f??e(`oauth.consent.unknownApp`);return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-1 items-center justify-center bg-background px-4`,children:(0,M.jsxs)(Q,{className:`w-full max-w-md`,children:[(0,M.jsxs)(CN,{className:`items-center text-center`,children:[(0,M.jsx)(`div`,{className:`mb-3 rounded-full border bg-muted p-3`,children:s?.icon?(0,M.jsx)(`img`,{src:s.icon,alt:``,className:`h-8 w-8 rounded`,onError:e=>e.currentTarget.style.display=`none`}):(0,M.jsx)(Ny,{className:`h-7 w-7 text-muted-foreground`})}),(0,M.jsx)(wN,{className:`text-xl`,children:e(`oauth.consent.title`,{appName:g})}),(0,M.jsx)(TN,{children:e(`oauth.consent.request`,{appName:g,suffix:r?.email?` (${r.email})`:``})})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[m.length>0&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-2 text-sm font-medium`,children:e(`oauth.consent.willAllow`)}),(0,M.jsx)(`ul`,{className:`space-y-1.5 rounded-md border bg-muted/40 p-3 text-sm`,children:m.map(t=>(0,M.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,M.jsx)(_y,{className:`mt-0.5 h-4 w-4 text-green-600 dark:text-green-400`}),(0,M.jsx)(`span`,{children:OP(t,e)})]},t))})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 pt-2`,children:[(0,M.jsxs)(Z,{variant:`outline`,onClick:()=>h(!1),disabled:o,children:[(0,M.jsx)(ob,{className:`mr-2 h-4 w-4`}),e(`oauth.consent.deny`)]}),(0,M.jsxs)(Z,{onClick:()=>h(!0),disabled:o,children:[(0,M.jsx)(_y,{className:`mr-2 h-4 w-4`}),e(o?`oauth.consent.submitting`:`oauth.consent.authorize`)]})]}),(0,M.jsx)(`p`,{className:`pt-2 text-center text-xs text-muted-foreground`,children:e(`oauth.consent.footer`)})]})]})})}function OP(e,t){switch(e){case`openid`:return t(`oauth.consent.scope.openid`);case`profile`:return t(`oauth.consent.scope.profile`);case`email`:return t(`oauth.consent.scope.email`);case`offline_access`:return t(`oauth.consent.scope.offlineAccess`);default:return e}}var kP=la(`/auth/device`)({validateSearch:e=>({user_code:e.user_code??e.code??``}),component:jP});function AP({children:e}){return(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:[(0,M.jsxs)(`a`,{href:`#`,className:`flex items-center gap-2 self-center font-medium`,children:[(0,M.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded-md bg-primary text-primary-foreground`,children:(0,M.jsx)(ky,{className:`size-4`})}),`ObjectStack`]}),(0,M.jsx)(`div`,{className:`flex flex-col gap-6`,children:e})]})})}function jP(){let{t:e}=vt(),{user_code:t}=kP.useSearch(),{user:n,loading:r}=eN(),i=Hi(),[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(!1),[p,m]=(0,j.useState)(``);return t?r?(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsx)(CN,{className:`text-center`,children:(0,M.jsx)(TN,{children:e(`auth.device.loading`)})})})}):n?l?(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(Sy,{className:`h-10 w-10 text-green-500 mx-auto mb-2`}),(0,M.jsx)(wN,{children:e(`auth.device.approvedTitle`)}),(0,M.jsx)(TN,{children:e(`auth.device.approvedDescription`)})]})})}):d?(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.device.deniedTitle`)}),(0,M.jsx)(TN,{children:e(`auth.device.deniedDescription`)})]})})}):(0,M.jsx)(AP,{children:(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.device.title`)}),(0,M.jsx)(TN,{children:e(`auth.device.subtitle`,{email:n.email})})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`rounded-md border bg-background px-4 py-3 text-center`,children:[(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground mb-1`,children:e(`auth.device.userCodeLabel`)}),(0,M.jsx)(`p`,{className:`font-mono font-semibold tracking-widest text-lg`,children:t})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`p`,{className:`text-sm text-center text-muted-foreground`,children:e(`auth.device.loggedInAs`,{email:n.email})}),p&&(0,M.jsx)(`p`,{className:`text-sm text-destructive text-center`,children:p}),(0,M.jsx)(Z,{onClick:async()=>{m(``),o(!0);try{let n=await fetch(`/api/v1/auth/device/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})});if(!n.ok){let t=await n.json().catch(()=>({}));throw Error(t?.message??t?.error?.message??e(`auth.device.approveFailed`))}u(!0),K({title:e(`auth.device.approveSuccess`),description:e(`auth.device.approveSuccessDescription`)})}catch(t){m(t?.message??e(`auth.device.approveFailed`))}finally{o(!1)}},className:`w-full`,disabled:a||s,children:e(a?`auth.device.approving`:`auth.device.approve`)}),(0,M.jsx)(Z,{onClick:async()=>{m(``),c(!0);try{await fetch(`/api/v1/auth/device/deny`,{method:`POST`,headers:{"Content-Type":`application/json`},credentials:`include`,body:JSON.stringify({userCode:t})}),f(!0)}catch(t){m(t?.message??e(`auth.device.denyFailed`))}finally{c(!1)}},variant:`outline`,className:`w-full`,disabled:a||s,children:e(s?`auth.device.denying`:`auth.device.deny`)}),(0,M.jsx)(`div`,{className:`text-center`,children:(0,M.jsx)(`button`,{type:`button`,className:`text-sm text-muted-foreground underline-offset-4 hover:underline`,onClick:()=>i({to:`/`}),children:e(`auth.device.cancel`)})})]})]})]})}):(0,M.jsx)(Ui,{to:`/login`,search:{redirect:`/auth/device?user_code=${encodeURIComponent(t)}`}}):(0,M.jsx)(AP,{children:(0,M.jsx)(Q,{children:(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{children:e(`auth.device.invalidTitle`)}),(0,M.jsx)(TN,{children:e(`auth.device.invalidDescription`)})]})})})}var MP=la(`/account/two-factor`)({component:NP});function NP(){let{t:e}=vt(),t=Qg(),{user:n,loading:r,refresh:i}=eN(),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(!1),[d,f]=(0,j.useState)(null),[p,m]=(0,j.useState)(null),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(``),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(!1),[T,E]=(0,j.useState)(``),[D,O]=(0,j.useState)(!1),[ee,te]=(0,j.useState)(null);(0,j.useEffect)(()=>{r||o(!!n?.twoFactorEnabled)},[r,n?.twoFactorEnabled]);let ne=async n=>{n.preventDefault(),u(!0);try{let e=await t.auth.twoFactor.enable({password:s});f(e?.totpURI??null),m(e?.backupCodes??null),c(``)}catch(t){K({title:e(`twoFactor.enableFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},re=async n=>{n.preventDefault(),b(!0);try{await t.auth.twoFactor.verifyTotp({code:_,trustDevice:h}),K({title:e(`twoFactor.enableSuccess`)}),o(!0),f(null),v(``),await i()}catch(t){K({title:e(`twoFactor.invalidCode`),description:t.message,variant:`destructive`})}finally{b(!1)}},ie=async n=>{n.preventDefault(),w(!0);try{await t.auth.twoFactor.disable({password:x}),K({title:e(`twoFactor.disableSuccess`)}),o(!1),S(``),te(null),await i()}catch(t){K({title:e(`twoFactor.disableFailed`),description:t.message,variant:`destructive`})}finally{w(!1)}},ae=async n=>{n.preventDefault(),O(!0);try{te((await t.auth.twoFactor.generateBackupCodes({password:T}))?.backupCodes??[]),E(``),K({title:e(`twoFactor.backupCodes.regenerated`)})}catch(t){K({title:e(`twoFactor.backupCodes.regenerateFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}},oe=async t=>{try{await navigator.clipboard.writeText(t.join(`
|
|
148
|
+
`)),K({title:e(`twoFactor.backupCodes.copied`)})}catch{K({title:e(`twoFactor.backupCodes.copyFailed`),variant:`destructive`})}},k=(0,M.jsx)(lP,{icon:qy,title:e(`twoFactor.title`),description:e(`twoFactor.notEnabledDescription`),actions:a===!0?(0,M.jsx)(cP,{className:`border-transparent bg-emerald-500/15 font-medium text-emerald-600 dark:text-emerald-400`,children:e(`twoFactor.enabled`)}):a===!1?(0,M.jsx)(cP,{variant:`outline`,className:`font-medium`,children:e(`twoFactor.notEnabled`)}):null});if(a===null)return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsx)(wN,{className:`text-base`,children:e(`twoFactor.loadingStatus`)})}),(0,M.jsxs)(EN,{className:`space-y-2`,children:[(0,M.jsx)(qw,{className:`h-4 w-48`}),(0,M.jsx)(qw,{className:`h-9 w-full`}),(0,M.jsx)(qw,{className:`h-9 w-32`})]})]})]});if(d){let t=`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(d)}`;return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`twoFactor.setupTitle`)}),(0,M.jsx)(TN,{children:e(`twoFactor.setupDescription`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,M.jsx)(`img`,{src:t,alt:e(`twoFactor.qrAlt`),width:200,height:200,className:`rounded border bg-white p-2`}),(0,M.jsx)(`div`,{className:`w-full rounded bg-muted p-3 font-mono text-xs break-all`,children:d}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`twoFactor.uriHint`)})]}),p&&p.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.savedTitle`)}),(0,M.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(p),children:[(0,M.jsx)(Dy,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:p.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]}),(0,M.jsx)(uS,{}),(0,M.jsxs)(`form`,{onSubmit:re,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`totp-code`,children:e(`twoFactor.verificationCode`)}),(0,M.jsx)(nS,{id:`totp-code`,placeholder:`000000`,maxLength:6,inputMode:`numeric`,autoComplete:`one-time-code`,value:_,onChange:e=>v(e.target.value),required:!0})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>g(e.target.checked)}),e(`twoFactor.trustDevice`)]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(Z,{type:`submit`,disabled:y||_.length<6,children:e(y?`twoFactor.verifying`:`twoFactor.verify`)}),(0,M.jsx)(Z,{type:`button`,variant:`outline`,onClick:()=>f(null),children:e(`twoFactor.cancel`)})]})]})]})]})]})}return a===!0?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`twoFactor.enabledTitle`,{defaultValue:`Authenticator app`})}),(0,M.jsx)(TN,{children:e(`twoFactor.enabledDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:ie,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`disable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(nS,{id:`disable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsx)(Z,{variant:`destructive`,type:`submit`,disabled:C,children:e(C?`twoFactor.disabling`:`twoFactor.disable`)})]})})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsxs)(wN,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Ny,{className:`h-4 w-4`}),e(`twoFactor.backupCodes.title`)]}),(0,M.jsx)(TN,{children:e(`twoFactor.backupCodes.description`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`form`,{onSubmit:ae,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`backup-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(nS,{id:`backup-password`,type:`password`,autoComplete:`current-password`,required:!0,value:T,onChange:e=>E(e.target.value)})]}),(0,M.jsxs)(Z,{type:`submit`,variant:`outline`,disabled:D,children:[(0,M.jsx)(Wy,{className:`mr-2 h-4 w-4`}),e(D?`common.saving`:`twoFactor.backupCodes.regenerate`)]})]}),ee&&ee.length>0&&(0,M.jsxs)(`div`,{className:`rounded border bg-muted/40 p-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium`,children:e(`twoFactor.backupCodes.newTitle`)}),(0,M.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>oe(ee),children:[(0,M.jsx)(Dy,{className:`mr-1 h-3 w-3`}),e(`twoFactor.backupCodes.copy`)]})]}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`twoFactor.backupCodes.savedHint`)}),(0,M.jsx)(`div`,{className:`mt-2 grid grid-cols-2 gap-1 font-mono text-xs`,children:ee.map(e=>(0,M.jsx)(`span`,{className:`rounded bg-background px-2 py-1`,children:e},e))})]})]})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[k,(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`twoFactor.enable`)}),(0,M.jsx)(TN,{children:e(`twoFactor.notEnabledDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:ne,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`enable-password`,children:e(`twoFactor.password`)}),(0,M.jsx)(nS,{id:`enable-password`,type:`password`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>c(e.target.value),placeholder:e(`twoFactor.passwordPlaceholder`)})]}),(0,M.jsx)(Z,{type:`submit`,disabled:l,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(l?`twoFactor.loading`:`twoFactor.enable`)})]})})]})]})}var PP=[[/Edg\//i,`Edge`],[/OPR\//i,`Opera`],[/Chrome\//i,`Chrome`],[/Firefox\//i,`Firefox`],[/Safari\//i,`Safari`]],FP=[[/Windows NT 10/i,`Windows 10/11`],[/Windows/i,`Windows`],[/Mac OS X|Macintosh/i,`macOS`],[/iPhone|iOS/i,`iOS`],[/iPad/i,`iPadOS`],[/Android/i,`Android`],[/Linux/i,`Linux`]];function IP(e){if(!e)return{browser:`Unknown`,os:`Unknown`,device:`desktop`,label:`Unknown device`,icon:Ay};let t=PP.find(([t])=>t.test(e))?.[1]??`Browser`,n=FP.find(([t])=>t.test(e))?.[1]??`Unknown OS`,r=/iPad|Tablet/i.test(e),i=!r&&/Mobile|Android|iPhone|iPod/i.test(e),a=r?`tablet`:i?`mobile`:`desktop`,o=By;return o=a===`mobile`?Yy:a===`tablet`?Zy:/Linux|Windows|Mac/i.test(e)?By:Ay,{browser:t,os:n,device:a,label:`${t} · ${n}`,icon:o}}var LP=la(`/account/sessions`)({component:RP});function RP(){let{t:e}=vt(),t=Qg(),{session:n}=eN(),[r,i]=(0,j.useState)([]),[a,o]=(0,j.useState)(!0),[s,c]=(0,j.useState)(null),[l,u]=(0,j.useState)(!1),d=async()=>{try{i((await t.auth.sessions.list())?.sessions??[])}catch(t){K({title:e(`sessions.loadFailed`),description:t.message,variant:`destructive`})}finally{o(!1)}};(0,j.useEffect)(()=>{d()},[]);let f=async n=>{c(n);try{await t.auth.sessions.revoke(n),K({title:e(`sessions.revoked`)}),await d()}catch(t){K({title:e(`sessions.revokeFailed`),description:t.message,variant:`destructive`})}finally{c(null)}},p=async()=>{u(!0);try{await t.auth.sessions.revokeOthers(),K({title:e(`sessions.othersRevoked`)}),await d()}catch(t){K({title:e(`sessions.revokeOthersFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},m=n?.token,h=r.find(e=>e.token===m),g=r.filter(e=>e.token!==m);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:By,title:e(`sessions.title`),description:e(`sessions.description`),actions:r.length>1?(0,M.jsxs)(Z,{variant:`outline`,size:`sm`,onClick:p,disabled:l,children:[(0,M.jsx)(Ly,{className:`mr-2 h-4 w-4`}),e(l?`sessions.revokingOthers`:`sessions.revokeOthers`)]}):null}),a&&(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)(Q,{className:`overflow-hidden`,children:(0,M.jsxs)(EN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(qw,{className:`size-10 rounded-lg`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(qw,{className:`h-4 w-40`}),(0,M.jsx)(qw,{className:`h-3 w-64`})]})]})},e))}),!a&&r.length===0&&(0,M.jsx)(Q,{children:(0,M.jsxs)(EN,{className:`flex flex-col items-center gap-3 p-10 text-center text-sm text-muted-foreground`,children:[(0,M.jsx)(By,{className:`size-10 text-muted-foreground/50`}),e(`sessions.empty`)]})}),!a&&h&&(0,M.jsx)(zP,{session:h,isCurrent:!0,revoking:!1,onRevoke:()=>void 0,t:e}),!a&&g.length>0&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wider text-muted-foreground`,children:e(`sessions.otherDevices`,{defaultValue:`Other signed-in devices`})}),(0,M.jsx)(`div`,{className:`space-y-2`,children:g.map(t=>(0,M.jsx)(zP,{session:t,isCurrent:!1,revoking:s===t.token,onRevoke:()=>f(t.token),t:e},t.id))})]})]})}function zP({session:e,isCurrent:t,revoking:n,onRevoke:r,t:i}){let a=IP(e.userAgent),o=a.icon;return(0,M.jsx)(Q,{className:t?`border-primary/40 bg-brand-gradient-subtle shadow-sm shadow-primary/10`:`transition-colors hover:bg-accent/30`,children:(0,M.jsxs)(EN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg `+(t?`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/30`:`bg-muted text-muted-foreground`),children:(0,M.jsx)(o,{className:`size-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`truncate text-sm font-medium`,children:a.label}),t&&(0,M.jsx)(cP,{className:`border-transparent bg-emerald-500/15 text-[10px] font-medium text-emerald-600 dark:text-emerald-400`,children:i(`sessions.current`)})]}),(0,M.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[e.ipAddress&&(0,M.jsx)(`span`,{className:`font-mono`,children:e.ipAddress}),(0,M.jsx)(`span`,{children:i(`sessions.expires`,{date:new Date(e.expiresAt).toLocaleDateString()})})]})]}),!t&&(0,M.jsxs)(Z,{variant:`ghost`,size:`sm`,onClick:r,disabled:n,className:`ml-3 shrink-0 text-muted-foreground hover:text-destructive`,children:[(0,M.jsx)(Ly,{className:`mr-1.5 h-4 w-4`}),i(`sessions.revoke`,{defaultValue:`Revoke`})]})]})})}var BP=jw,VP=Mw,HP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Nw,{ref:n,className:X(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));HP.displayName=Nw.displayName;var UP=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(VP,{children:[(0,M.jsx)(HP,{}),(0,M.jsxs)(Pw,{ref:r,className:X(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 sm:rounded-lg`,e),...n,children:[t,(0,M.jsxs)(Lw,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,M.jsx)(ob,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));UP.displayName=Pw.displayName;var WP=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});WP.displayName=`DialogHeader`;var GP=({className:e,...t})=>(0,M.jsx)(`div`,{className:X(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});GP.displayName=`DialogFooter`;var KP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Fw,{ref:n,className:X(`text-lg font-semibold leading-none tracking-tight`,e),...t}));KP.displayName=Fw.displayName;var qP=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(Iw,{ref:n,className:X(`text-sm text-muted-foreground`,e),...t}));qP.displayName=Iw.displayName;var JP=la(`/account/security`)({component:YP});function YP(){let{t:e}=vt(),t=Qg(),n=Hi(),{user:r,logout:i}=eN(),[a,o]=(0,j.useState)(``),[s,c]=(0,j.useState)(``),[l,u]=(0,j.useState)(``),[d,f]=(0,j.useState)(!0),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(``),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(!1),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(``),[T,E]=(0,j.useState)(!1);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:Jy,title:e(`security.title`),description:e(`security.description`)}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsxs)(wN,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(Jy,{className:`h-4 w-4 text-primary`}),e(`security.changePasswordTitle`,{defaultValue:`Change password`})]}),(0,M.jsx)(TN,{children:e(`security.changePasswordDescription`,{defaultValue:`Use at least 8 characters. Mix letters, numbers and symbols for strength.`})})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),s!==l){K({title:e(`security.passwordsMismatch`),variant:`destructive`});return}m(!0);try{await t.auth.changePassword({currentPassword:a,newPassword:s,revokeOtherSessions:d}),K({title:e(`security.changed`)}),o(``),c(``),u(``)}catch(t){K({title:e(`security.changeFailed`),description:t.message,variant:`destructive`})}finally{m(!1)}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`current-password`,children:e(`security.currentPassword`)}),(0,M.jsx)(nS,{id:`current-password`,type:`password`,autoComplete:`current-password`,required:!0,value:a,onChange:e=>o(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`new-password`,children:e(`security.newPassword`)}),(0,M.jsx)(nS,{id:`new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:s,onChange:e=>c(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`confirm-new-password`,children:e(`security.confirmPassword`)}),(0,M.jsx)(nS,{id:`confirm-new-password`,type:`password`,autoComplete:`new-password`,required:!0,minLength:8,value:l,onChange:e=>u(e.target.value)})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),e(`security.revokeOtherSessions`)]}),(0,M.jsx)(Z,{type:`submit`,disabled:p,children:e(p?`common.saving`:`security.submit`)})]})})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsxs)(wN,{className:`text-base flex items-center gap-2`,children:[(0,M.jsx)(zy,{className:`h-4 w-4 text-primary`}),e(`security.email.title`)]}),(0,M.jsx)(TN,{children:e(`security.email.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:async n=>{if(n.preventDefault(),!(!h||h===r?.email)){v(!0);try{await t.auth.changeEmail({newEmail:h,callbackURL:window.location.origin+`/login`}),K({title:e(`security.email.requested`),description:e(`security.email.checkInbox`,{email:h})}),g(``)}catch(t){K({title:e(`security.email.requestFailed`),description:t.message,variant:`destructive`})}finally{v(!1)}}},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`current-email`,children:e(`security.email.current`)}),(0,M.jsx)(nS,{id:`current-email`,value:r?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`new-email`,children:e(`security.email.new`)}),(0,M.jsx)(nS,{id:`new-email`,type:`email`,value:h,onChange:e=>g(e.target.value),placeholder:e(`security.email.placeholder`),required:!0})]}),(0,M.jsx)(Z,{type:`submit`,disabled:_||!h||h===r?.email,children:e(_?`common.saving`:`security.email.submit`)})]})})]}),(0,M.jsxs)(Q,{className:`border-destructive/40 bg-destructive/5`,children:[(0,M.jsxs)(CN,{children:[(0,M.jsxs)(wN,{className:`text-base flex items-center gap-2 text-destructive`,children:[(0,M.jsx)($y,{className:`h-4 w-4`}),e(`security.delete.title`)]}),(0,M.jsx)(TN,{children:e(`security.delete.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(Z,{variant:`destructive`,onClick:()=>b(!0),children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`security.delete.cta`)]})})]}),(0,M.jsx)(BP,{open:y,onOpenChange:b,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`security.delete.dialogTitle`)}),(0,M.jsx)(qP,{children:e(`security.delete.dialogDescription`,{email:r?.email??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`delete-password`,children:e(`security.delete.password`)}),(0,M.jsx)(nS,{id:`delete-password`,type:`password`,autoComplete:`current-password`,value:x,onChange:e=>S(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`delete-confirm`,children:e(`security.delete.typeEmail`,{email:r?.email??``})}),(0,M.jsx)(nS,{id:`delete-confirm`,value:C,onChange:e=>w(e.target.value),placeholder:r?.email??``})]})]}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>b(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Z,{variant:`destructive`,onClick:async()=>{if(C!==r?.email){K({title:e(`security.delete.confirmationMismatch`),description:e(`security.delete.confirmationHint`,{email:r?.email??``}),variant:`destructive`});return}E(!0);try{await t.auth.deleteUser({password:x}),K({title:e(`security.delete.success`)});try{await i()}catch{}n({to:`/login`,replace:!0})}catch(t){K({title:e(`security.delete.failed`),description:t.message,variant:`destructive`})}finally{E(!1)}},disabled:T||C!==r?.email,children:e(T?`common.saving`:`security.delete.confirm`)})]})]})})]})}var XP=la(`/account/profile`)({component:ZP});function ZP(){let{t:e}=vt(),t=Qg(),{user:n,refresh:r}=eN(),[i,a]=(0,j.useState)(n?.name??``),[o,s]=(0,j.useState)(n?.image??null),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(!1),f=(0,j.useRef)(null);(0,j.useEffect)(()=>{a(n?.name??``),s(n?.image??null)},[n?.id,n?.name,n?.image]);let p=async n=>{n.preventDefault(),l(!0);try{await t.auth.updateUser({name:i,image:o}),await r(),K({title:e(`profile.updated`)})}catch(t){K({title:e(`profile.updateFailed`),description:t.message,variant:`destructive`})}finally{l(!1)}},m=()=>f.current?.click(),h=async n=>{let i=n.target.files?.[0];if(n.target.value=``,i){d(!0);try{if(!t?.storage?.upload)throw Error(e(`profile.avatarStorageUnavailable`));let n=await t.storage.upload(i,`user`),a=n?.data?.url??n?.url;if(!a)throw Error(`Upload returned no URL`);s(a),await t.auth.updateUser({image:a}),await r(),K({title:e(`profile.avatarUpdated`)})}catch(t){K({title:e(`profile.avatarUploadFailed`),description:t.message,variant:`destructive`})}finally{d(!1)}}},g=(n?.name??n?.email??`?`).split(/\s+/).map(e=>e[0]).join(``).slice(0,2).toUpperCase();return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl border bg-card`,children:[(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 bg-brand-gradient`,"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-24 opacity-30`,style:{backgroundImage:`radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.4), transparent 60%)`},"aria-hidden":!0}),(0,M.jsx)(`div`,{className:`relative px-5 pb-5 pt-12 sm:px-6 sm:pb-6 sm:pt-16`,children:(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-end sm:gap-5`,children:[(0,M.jsxs)(GM,{className:`size-20 shrink-0 ring-4 ring-card shadow-md`,children:[o?(0,M.jsx)(KM,{src:o,alt:n?.name??``}):null,(0,M.jsx)(qM,{className:`bg-brand-gradient text-base font-semibold text-primary-foreground`,children:g})]}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,M.jsx)(`h2`,{className:`truncate text-xl font-semibold tracking-tight`,children:n?.name||e(`profile.namePlaceholder`)}),(0,M.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:n?.email})]}),(0,M.jsxs)(Z,{type:`button`,variant:`outline`,size:`sm`,onClick:m,disabled:u,className:`self-start sm:self-auto`,children:[(0,M.jsx)(eb,{className:`mr-2 h-4 w-4`}),e(u?`profile.avatarUploading`:`profile.changeAvatar`)]}),(0,M.jsx)(`input`,{ref:f,type:`file`,accept:`image/*`,className:`hidden`,onChange:h})]})})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`profile.title`)}),(0,M.jsx)(TN,{children:e(`profile.description`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(`form`,{onSubmit:p,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`profile-email`,children:e(`profile.email`)}),(0,M.jsx)(nS,{id:`profile-email`,value:n?.email??``,disabled:!0})]}),(0,M.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,M.jsx)($,{htmlFor:`profile-name`,children:e(`profile.name`)}),(0,M.jsx)(nS,{id:`profile-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`profile.namePlaceholder`)})]}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`profile.avatarHint`)}),(0,M.jsx)(Z,{type:`submit`,disabled:c,className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:e(c?`common.saving`:`profile.save`)})]})})]})]})}var QP=la(`/account/linked-accounts`)({component:eF}),$P={google:`Google`,github:`GitHub`,microsoft:`Microsoft`,apple:`Apple`,discord:`Discord`,gitlab:`GitLab`,twitter:`Twitter / X`,facebook:`Facebook`};function eF(){let{t:e}=vt(),t=Qg(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!0),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(t?.auth?.accounts){a(!0);try{let e=await t.auth.accounts.list();r(e?.accounts??e?.data??(Array.isArray(e)?e:[]))}catch{r([])}finally{a(!1)}}},[t]);(0,j.useEffect)(()=>{c()},[c]);let l=async n=>{if(confirm(e(`linkedAccounts.unlinkConfirm`,{provider:$P[n.providerId]??n.providerId}))){s(n.id);try{await t.auth.accounts.unlink({providerId:n.providerId,accountId:n.accountId}),K({title:e(`linkedAccounts.unlinked`)}),await c()}catch(t){K({title:e(`linkedAccounts.unlinkFailed`),description:t.message,variant:`destructive`})}finally{s(null)}}},u=async n=>{try{let r=await t.auth.accounts.linkSocial({provider:n,callbackURL:window.location.href}),i=r?.url??r?.data?.url;i?window.location.assign(i):K({title:e(`linkedAccounts.linkFailed`),variant:`destructive`})}catch(t){K({title:e(`linkedAccounts.linkFailed`),description:t.message,variant:`destructive`})}},d=new Set(n.map(e=>e.providerId)),f=Object.keys($P).filter(e=>!d.has(e));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:Iy,title:e(`linkedAccounts.title`),description:e(`linkedAccounts.description`)}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`linkedAccounts.connectedTitle`,{defaultValue:`Connected providers`})}),(0,M.jsx)(TN,{children:e(`linkedAccounts.connectedDescription`,{defaultValue:`Sign-in providers currently linked to this account.`})})]}),(0,M.jsxs)(EN,{children:[i&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(qw,{className:`h-12 w-full`}),(0,M.jsx)(qw,{className:`h-12 w-full`})]}),!i&&n.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(Iy,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`linkedAccounts.empty`)})]}),!i&&n.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:n.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(cP,{variant:`secondary`,children:$P[t.providerId]??t.providerId}),t.createdAt&&(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`linkedAccounts.linkedOn`,{date:new Date(t.createdAt).toLocaleDateString()})})]}),(0,M.jsxs)(Z,{variant:`ghost`,size:`sm`,disabled:o===t.id,onClick:()=>l(t),children:[(0,M.jsx)(Fy,{className:`mr-1 h-4 w-4`}),e(`linkedAccounts.unlink`)]})]},t.id))})]})]}),f.length>0&&(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`linkedAccounts.addTitle`)}),(0,M.jsx)(TN,{children:e(`linkedAccounts.addDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:f.map(e=>(0,M.jsxs)(Z,{variant:`outline`,size:`sm`,onClick:()=>u(e),children:[(0,M.jsx)(Uy,{className:`mr-1 h-3 w-3`}),$P[e]]},e))})})]})]})}function tF(e){let t=Qg(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations)){a(!0),s(null);try{let n=await t.organizations.listMembers(e);r(n?.members??n?.data?.members??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{members:n,loading:i,error:o,reload:c,inviteMember:(0,j.useCallback)(async(n,r=`member`)=>{if(!e||!t?.organizations)throw Error(`Organization ID or client not available`);let i=await t.organizations.invite({email:n,role:r,organizationId:e});return await c(),i},[t,e,c]),removeMember:(0,j.useCallback)(async n=>{if(!e||!t?.organizations?.removeMember)throw Error(`Organization ID or client not available`);let r=await t.organizations.removeMember(e,{memberIdOrEmail:n});return await c(),r},[t,e,c]),updateMemberRole:(0,j.useCallback)(async(n,r)=>{if(!e||!t?.organizations?.updateMemberRole)throw Error(`Organization ID or client not available`);let i=await t.organizations.updateMemberRole(e,{memberId:n,role:r});return await c(),i},[t,e,c])}}function nF(e){let t=Qg(),[n,r]=(0,j.useState)([]),[i,a]=(0,j.useState)(!1),[o,s]=(0,j.useState)(null),c=(0,j.useCallback)(async()=>{if(!(!e||!t?.organizations?.invitations)){a(!0),s(null);try{let n=await t.organizations.invitations.list(e);r(n?.invitations??n?.data?.invitations??(Array.isArray(n)?n:[]))}catch(e){s(e),r([])}finally{a(!1)}}},[t,e]);return(0,j.useEffect)(()=>{c()},[c]),{invitations:n,loading:i,error:o,reload:c,cancelInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.cancel)throw Error(`Client not available`);let n=await t.organizations.invitations.cancel(e);return await c(),n},[t,c]),resendInvitation:(0,j.useCallback)(async e=>{if(!t?.organizations?.invitations?.resend)throw Error(`Client not available`);let n=await t.organizations.invitations.resend({id:e.id,email:e.email,role:e.role,organizationId:e.organizationId,teamId:e.teamId??null});return await c(),n},[t,c])}}function rF(){let e=Qg(),[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),s=(0,j.useCallback)(async()=>{if(e?.organizations?.invitations?.listMine){i(!0),o(null);try{let t=await e.organizations.invitations.listMine();n(t?.invitations??t?.data?.invitations??(Array.isArray(t)?t:[]))}catch(e){o(e),n([])}finally{i(!1)}}},[e]);return(0,j.useEffect)(()=>{s()},[s]),{invitations:t,loading:r,error:a,reload:s,accept:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.accept(t);return await s(),n},[e,s]),reject:(0,j.useCallback)(async t=>{let n=await e.organizations.invitations.reject(t);return await s(),n},[e,s])}}var iF=la(`/account/invitations`)({component:aF});function aF(){let{t:e}=vt(),{invitations:t,loading:n,accept:r,reject:i}=rF(),a=t.filter(e=>e.status===`pending`),o=async t=>{try{await r(t),K({title:e(`invitations.accepted`)})}catch(t){K({title:e(`invitations.acceptFailed`),description:t.message,variant:`destructive`})}},s=async t=>{try{await i(t),K({title:e(`invitations.rejected`)})}catch(t){K({title:e(`invitations.rejectFailed`),description:t.message,variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:My,title:e(`invitations.title`),description:e(`invitations.description`),actions:a.length>0?(0,M.jsx)(cP,{variant:`outline`,className:`font-medium`,children:e(`invitations.pendingCount`,{count:a.length,defaultValue:`{{count}} pending`})}):null}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`invitations.pendingTitle`,{defaultValue:`Pending invitations`})}),(0,M.jsx)(TN,{children:e(`invitations.pendingDescription`,{defaultValue:`Accept to join an organization, or reject to remove it from your inbox.`})})]}),(0,M.jsxs)(EN,{children:[n&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(qw,{className:`h-12 w-full`}),(0,M.jsx)(qw,{className:`h-12 w-full`})]}),!n&&a.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(My,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`invitations.empty`)})]}),!n&&a.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:a.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`text-sm font-medium`,children:t.organizationId}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(cP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`invitations.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsxs)(Z,{size:`sm`,onClick:()=>o(t.id),children:[(0,M.jsx)(_y,{className:`mr-1 h-4 w-4`}),e(`invitations.accept`)]}),(0,M.jsxs)(Z,{size:`sm`,variant:`outline`,onClick:()=>s(t.id),children:[(0,M.jsx)(ob,{className:`mr-1 h-4 w-4`}),e(`invitations.reject`)]})]})]},t.id))})]})]})]})}var oF=la(`/accept-invitation/$invitationId`)({component:sF});function sF(){let{t:e}=vt(),{invitationId:t}=oF.useParams(),n=Hi(),r=Qg(),{user:i,loading:a,reloadOrganizations:o}=eN(),[s,c]=(0,j.useState)(!1),[l,u]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{a||i||n({to:`/login`,search:{redirect:`/accept-invitation/${t}`},replace:!0})},[a,i,t,n]),(0,M.jsx)(`div`,{className:`flex min-h-svh w-full flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10`,children:(0,M.jsx)(`div`,{className:`flex w-full max-w-sm flex-col gap-6`,children:(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{className:`text-center`,children:[(0,M.jsx)(wN,{className:`text-xl`,children:e(`acceptInvitation.title`)}),(0,M.jsx)(TN,{children:e(`acceptInvitation.description`)})]}),(0,M.jsxs)(EN,{className:`flex flex-col gap-3`,children:[(0,M.jsx)(Z,{className:`w-full`,onClick:async()=>{c(!0);try{await r.organizations.invitations.accept(t),await o().catch(()=>{}),K({title:e(`acceptInvitation.accepted`)}),n({to:`/organizations`})}catch(t){K({title:e(`acceptInvitation.acceptFailed`),description:t.message,variant:`destructive`})}finally{c(!1)}},disabled:s||l,children:e(s?`acceptInvitation.accepting`:`acceptInvitation.accept`)}),(0,M.jsx)(Z,{variant:`outline`,className:`w-full`,onClick:async()=>{u(!0);try{await r.organizations.invitations.reject(t),K({title:e(`acceptInvitation.declined`)}),n({to:`/organizations`})}catch(t){K({title:e(`acceptInvitation.declineFailed`),description:t.message,variant:`destructive`})}finally{u(!1)}},disabled:s||l,children:e(l?`acceptInvitation.declining`:`acceptInvitation.decline`)})]})]})})})}var cF=la(`/organizations/$orgId/`)({component:()=>{let{orgId:e}=cF.useParams();return(0,M.jsx)(Ui,{to:`/organizations/$orgId/general`,params:{orgId:e},replace:!0})}}),lF=la(`/account/oauth-applications/`)({component:uF});function uF(){let{t:e}=vt(),t=Hi(),{applications:n,loading:r,reload:i}=SP(),{remove:a,deleting:o}=wP(),[s,c]=(0,j.useState)(null);return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsx)(lP,{icon:Ny,title:e(`oauth.applications.title`),description:e(`oauth.applications.description`),actions:(0,M.jsxs)(Z,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20 transition-all hover:opacity-95 hover:shadow-md hover:shadow-primary/30`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.new`)]})}),r?(0,M.jsx)(`div`,{className:`space-y-3`,children:[0,1,2].map(e=>(0,M.jsx)(Q,{children:(0,M.jsxs)(EN,{className:`flex items-center gap-3 p-4`,children:[(0,M.jsx)(qw,{className:`size-10 rounded-md`}),(0,M.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,M.jsx)(qw,{className:`h-4 w-40`}),(0,M.jsx)(qw,{className:`h-3 w-64`})]})]})},e))}):n.length===0?(0,M.jsx)(Q,{children:(0,M.jsxs)(EN,{className:`flex flex-col items-center gap-3 p-12 text-center`,children:[(0,M.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-lg bg-brand-gradient-subtle text-primary ring-1 ring-primary/15`,children:(0,M.jsx)(Ny,{className:`h-6 w-6`})}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`font-medium`,children:e(`oauth.applications.emptyTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.emptyDescription`)})]}),(0,M.jsxs)(Z,{onClick:()=>t({to:`/account/oauth-applications/new`}),className:`bg-brand-gradient text-primary-foreground shadow-sm shadow-primary/20`,children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.register`)]})]})}):(0,M.jsx)(`div`,{className:`grid gap-3`,children:n.map(t=>(0,M.jsx)(Q,{className:`group transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5`,children:(0,M.jsx)(CN,{className:`pb-3`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsxs)(ra,{to:`/account/oauth-applications/$clientId`,params:{clientId:t.client_id},className:`flex flex-1 items-center gap-3`,children:[(0,M.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-md bg-brand-gradient-subtle text-primary ring-1 ring-primary/15 transition-transform group-hover:scale-105`,children:(0,M.jsx)(Ny,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(wN,{className:`text-base`,children:t.name}),(0,M.jsx)(TN,{className:`font-mono text-xs`,children:t.client_id})]}),(0,M.jsx)(cP,{variant:`outline`,className:`capitalize`,children:t.type}),t.disabled&&(0,M.jsx)(cP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]}),(0,M.jsx)(Z,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-destructive`,onClick:e=>{e.preventDefault(),e.stopPropagation(),c(t)},children:(0,M.jsx)(Qy,{className:`h-4 w-4`})})]})})},t.id))}),(0,M.jsx)(BP,{open:!!s,onOpenChange:e=>!e&&c(null),children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(qP,{children:e(`oauth.applications.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>c(null),disabled:o,children:e(`common.cancel`)}),(0,M.jsx)(Z,{variant:`destructive`,onClick:async()=>{if(s)try{await a(s.client_id),K({title:e(`oauth.applications.deleted`)}),c(null),await i()}catch(t){K({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}},disabled:o,children:e(o?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}function dF(e,[t,n]){return Math.min(n,Math.max(t,e))}function fF(e){let t=j.useRef({value:e,previous:e});return j.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var pF=[` `,`Enter`,`ArrowUp`,`ArrowDown`],mF=[` `,`Enter`],hF=`Select`,[gF,_F,vF]=C_(hF),[yF,bF]=m_(hF,[vF,fD]),xF=fD(),[SF,CF]=yF(hF),[wF,TF]=yF(hF),EF=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=xF(t),[g,_]=j.useState(null),[v,y]=j.useState(null),[b,x]=j.useState(!1),S=sk(l),[C,w]=Q_({prop:r,defaultProp:i??!1,onChange:a,caller:hF}),[T,E]=Q_({prop:o,defaultProp:s,onChange:c,caller:hF}),D=j.useRef(null),O=g?m||!!g.closest(`form`):!0,[ee,te]=j.useState(new Set),ne=Array.from(ee).map(e=>e.props.value).join(`;`);return(0,M.jsx)(OD,{...h,children:(0,M.jsxs)(SF,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:pS(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,M.jsx)(gF.Provider,{scope:t,children:(0,M.jsx)(wF,{scope:e.__scopeSelect,onNativeOptionAdd:j.useCallback(e=>{te(t=>new Set(t).add(e))},[]),onNativeOptionRemove:j.useCallback(e=>{te(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,M.jsxs)(xI,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,M.jsx)(`option`,{value:``}):null,Array.from(ee)]},ne):null]})})};EF.displayName=hF;var DF=`SelectTrigger`,OF=j.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=xF(n),o=CF(DF,n),s=o.disabled||r,c=f_(t,o.onTriggerChange),l=_F(n),u=j.useRef(`touch`),[d,f,p]=CI(e=>{let t=l().filter(e=>!e.disabled),n=wI(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,M.jsx)(kD,{asChild:!0,...a,children:(0,M.jsx)(w_.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":SI(o.value)?``:void 0,...i,ref:c,onClick:q(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:q(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:q(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&pF.includes(e.key)&&(m(),e.preventDefault())})})})});OF.displayName=DF;var kF=`SelectValue`,AF=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=CF(kF,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=f_(t,c.onValueNodeChange);return U_(()=>{l(u)},[l,u]),(0,M.jsx)(w_.span,{...s,ref:d,style:{pointerEvents:`none`},children:SI(c.value)?(0,M.jsx)(M.Fragment,{children:o}):a})});AF.displayName=kF;var jF=`SelectIcon`,MF=j.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,M.jsx)(w_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});MF.displayName=jF;var NF=`SelectPortal`,PF=e=>(0,M.jsx)(G_,{asChild:!0,...e});PF.displayName=NF;var FF=`SelectContent`,IF=j.forwardRef((e,t)=>{let n=CF(FF,e.__scopeSelect),[r,i]=j.useState();if(U_(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Gi.createPortal((0,M.jsx)(RF,{scope:e.__scopeSelect,children:(0,M.jsx)(gF.Slot,{scope:e.__scopeSelect,children:(0,M.jsx)(`div`,{children:e.children})})}),t):null}return(0,M.jsx)(HF,{...e,ref:t})});IF.displayName=FF;var LF=10,[RF,zF]=yF(FF),BF=`SelectContentImpl`,VF=g_(`SelectContent.RemoveScroll`),HF=j.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=CF(FF,n),[y,b]=j.useState(null),[x,S]=j.useState(null),C=f_(t,e=>b(e)),[w,T]=j.useState(null),[E,D]=j.useState(null),O=_F(n),[ee,te]=j.useState(!1),ne=j.useRef(!1);j.useEffect(()=>{if(y)return XC(y)},[y]),jS();let re=j.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),ie=j.useCallback(()=>re([w,y]),[re,w,y]);j.useEffect(()=>{ee&&ie()},[ee,ie]);let{onOpenChange:ae,triggerPointerDownPosRef:oe}=v;j.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(oe.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(oe.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||ae(!1),document.removeEventListener(`pointermove`,t),oe.current=null};return oe.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,ae,oe]),j.useEffect(()=>{let e=()=>ae(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ae]);let[k,se]=CI(e=>{let t=O().filter(e=>!e.disabled),n=wI(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ce=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(ne.current=!0))},[v.value]),le=j.useCallback(()=>y?.focus(),[y]),ue=j.useCallback((e,t,n)=>{let r=!ne.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),A=r===`popper`?KF:WF,de=A===KF?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,M.jsx)(RF,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ce,selectedItem:w,onItemLeave:le,itemTextRefCallback:ue,focusSelectedItem:ie,selectedItemText:E,position:r,isPositioned:ee,searchRef:k,children:(0,M.jsx)(VC,{as:VF,allowPinchZoom:!0,children:(0,M.jsx)(vS,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:q(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,M.jsx)(P_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,M.jsx)(A,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...de,onPlaced:()=>te(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:q(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&se(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>re(t)),e.preventDefault()}})})})})})})});HF.displayName=BF;var UF=`SelectItemAlignedPosition`,WF=j.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=CF(FF,n),o=zF(FF,n),[s,c]=j.useState(null),[l,u]=j.useState(null),d=f_(t,e=>u(e)),f=_F(n),p=j.useRef(!1),m=j.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=j.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-LF,d=dF(a,[LF,Math.max(LF,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-LF,d=dF(a,[LF,Math.max(LF,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-LF*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-LF,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,te=m+v+ee,ne=x-te;if(te<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=te+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+ne;s.style.height=t+`px`,h.scrollTop=te-E+h.offsetTop}s.style.margin=`${LF}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);U_(()=>y(),[y]);let[b,x]=j.useState();return U_(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,M.jsx)(qF,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:j.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,M.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,M.jsx)(w_.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});WF.displayName=UF;var GF=`SelectPopperPosition`,KF=j.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=LF,...a}=e,o=xF(n);return(0,M.jsx)(AD,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});KF.displayName=GF;var[qF,JF]=yF(FF,{}),YF=`SelectViewport`,XF=j.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=zF(YF,n),o=JF(YF,n),s=f_(t,a.onViewportChange),c=j.useRef(0);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,M.jsx)(gF.Slot,{scope:n,children:(0,M.jsx)(w_.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:q(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-LF*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});XF.displayName=YF;var ZF=`SelectGroup`,[QF,$F]=yF(ZF),eI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=pS();return(0,M.jsx)(QF,{scope:n,id:i,children:(0,M.jsx)(w_.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});eI.displayName=ZF;var tI=`SelectLabel`,nI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$F(tI,n);return(0,M.jsx)(w_.div,{id:i.id,...r,ref:t})});nI.displayName=tI;var rI=`SelectItem`,[iI,aI]=yF(rI),oI=j.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=CF(rI,n),c=zF(rI,n),l=s.value===r,[u,d]=j.useState(a??``),[f,p]=j.useState(!1),m=f_(t,e=>c.itemRefCallback?.(e,r,i)),h=pS(),g=j.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,M.jsx)(iI,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:j.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,M.jsx)(gF.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,M.jsx)(w_.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:q(o.onFocus,()=>p(!0)),onBlur:q(o.onBlur,()=>p(!1)),onClick:q(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:q(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:q(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:q(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:q(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:q(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(mF.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});oI.displayName=rI;var sI=`SelectItemText`,cI=j.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=CF(sI,n),s=zF(sI,n),c=aI(sI,n),l=TF(sI,n),[u,d]=j.useState(null),f=f_(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=j.useMemo(()=>(0,M.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return U_(()=>(h(m),()=>g(m)),[h,g,m]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(w_.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Gi.createPortal(a.children,o.valueNode):null]})});cI.displayName=sI;var lI=`SelectItemIndicator`,uI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return aI(lI,n).isSelected?(0,M.jsx)(w_.span,{"aria-hidden":!0,...r,ref:t}):null});uI.displayName=lI;var dI=`SelectScrollUpButton`,fI=j.forwardRef((e,t)=>{let n=zF(dI,e.__scopeSelect),r=JF(dI,e.__scopeSelect),[i,a]=j.useState(!1),o=f_(t,r.onScrollButtonChange);return U_(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(hI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});fI.displayName=dI;var pI=`SelectScrollDownButton`,mI=j.forwardRef((e,t)=>{let n=zF(pI,e.__scopeSelect),r=JF(pI,e.__scopeSelect),[i,a]=j.useState(!1),o=f_(t,r.onScrollButtonChange);return U_(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,M.jsx)(hI,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});mI.displayName=pI;var hI=j.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=zF(`SelectScrollButton`,n),o=j.useRef(null),s=_F(n),c=j.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return j.useEffect(()=>()=>c(),[c]),U_(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,M.jsx)(w_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:q(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:q(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:q(i.onPointerLeave,()=>{c()})})}),gI=`SelectSeparator`,_I=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,M.jsx)(w_.div,{"aria-hidden":!0,...r,ref:t})});_I.displayName=gI;var vI=`SelectArrow`,yI=j.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=xF(n),a=CF(vI,n),o=zF(vI,n);return a.open&&o.position===`popper`?(0,M.jsx)(jD,{...i,...r,ref:t}):null});yI.displayName=vI;var bI=`SelectBubbleInput`,xI=j.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=j.useRef(null),a=f_(r,i),o=fF(t);return j.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,M.jsx)(w_.select,{...n,style:{...tv,...n.style},ref:a,defaultValue:t})});xI.displayName=bI;function SI(e){return e===``||e===void 0}function CI(e){let t=E_(e),n=j.useRef(``),r=j.useRef(0),i=j.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=j.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return j.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function wI(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=TI(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function TI(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var EI=EF,DI=OF,OI=AF,kI=MF,AI=PF,jI=IF,MI=XF,NI=nI,PI=oI,FI=cI,II=uI,LI=fI,RI=mI,zI=_I,BI=EI,VI=OI,HI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(DI,{ref:r,className:X(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,M.jsx)(kI,{asChild:!0,children:(0,M.jsx)(vy,{className:`h-4 w-4 opacity-50`})})]}));HI.displayName=DI.displayName;var UI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(LI,{ref:n,className:X(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(by,{className:`h-4 w-4`})}));UI.displayName=LI.displayName;var WI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(RI,{ref:n,className:X(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,M.jsx)(vy,{className:`h-4 w-4`})}));WI.displayName=RI.displayName;var GI=j.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,M.jsx)(AI,{children:(0,M.jsxs)(jI,{ref:i,className:X(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,M.jsx)(UI,{}),(0,M.jsx)(MI,{className:X(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,M.jsx)(WI,{})]})}));GI.displayName=jI.displayName;var KI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(NI,{ref:n,className:X(`px-2 py-1.5 text-sm font-semibold`,e),...t}));KI.displayName=NI.displayName;var qI=j.forwardRef(({className:e,children:t,...n},r)=>(0,M.jsxs)(PI,{ref:r,className:X(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,M.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,M.jsx)(II,{children:(0,M.jsx)(_y,{className:`h-4 w-4`})})}),(0,M.jsx)(FI,{children:t})]}));qI.displayName=PI.displayName;var JI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(zI,{ref:n,className:X(`-mx-1 my-1 h-px bg-muted`,e),...t}));JI.displayName=zI.displayName;var YI=la(`/organizations/$orgId/teams`)({component:XI});function XI(){let{t:e}=vt(),{orgId:t}=YI.useParams(),n=Qg(),{members:r}=tF(t),[i,a]=(0,j.useState)([]),[o,s]=(0,j.useState)(!0),[c,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(null),[g,_]=(0,j.useState)([]),[v,y]=(0,j.useState)(!1),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``),w=(0,j.useCallback)(async()=>{if(n?.organizations?.teams){s(!0);try{a((await n.organizations.teams.list(t))?.teams??[])}catch{a([])}finally{s(!1)}}},[n,t]);(0,j.useEffect)(()=>{w()},[w]);let T=(0,j.useCallback)(async e=>{if(n?.organizations?.teams){y(!0);try{_((await n.organizations.teams.listMembers(e))?.members??[])}catch{_([])}finally{y(!1)}}},[n]);(0,j.useEffect)(()=>{m&&T(m)},[m,T]);let E=async r=>{if(r.preventDefault(),u.trim()){p(!0);try{await n.organizations.teams.create({name:u.trim(),organizationId:t}),K({title:e(`teams.created`)}),l(!1),d(``),await w()}catch(t){K({title:e(`teams.createFailed`),description:t.message,variant:`destructive`})}finally{p(!1)}}},D=async r=>{if(confirm(e(`teams.deleteConfirm`,{name:r.name})))try{await n.organizations.teams.delete({teamId:r.id,organizationId:t}),K({title:e(`teams.deleted`)}),m===r.id&&h(null),await w()}catch(t){K({title:e(`teams.deleteFailed`),description:t.message,variant:`destructive`})}},O=async()=>{if(!(!m||!S))try{await n.organizations.teams.addMember({teamId:m,userId:S}),K({title:e(`teams.memberAdded`)}),x(!1),C(``),await T(m)}catch(t){K({title:e(`teams.addMemberFailed`),description:t.message,variant:`destructive`})}},ee=async(t,r)=>{try{await n.organizations.teams.removeMember({teamId:t,userId:r}),K({title:e(`teams.memberRemoved`)}),await T(t)}catch(t){K({title:e(`teams.removeMemberFailed`),description:t.message,variant:`destructive`})}},te=Object.fromEntries(r.map(e=>[e.userId,e])),ne=new Set(g.map(e=>e.userId)),re=r.filter(e=>!ne.has(e.userId));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`teams.title`,{count:i.length})}),(0,M.jsx)(TN,{children:e(`teams.description`)})]}),(0,M.jsxs)(Z,{size:`sm`,onClick:()=>l(!0),children:[(0,M.jsx)(Uy,{className:`mr-2 h-4 w-4`}),e(`teams.create`)]})]})}),(0,M.jsxs)(EN,{children:[o&&(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsx)(qw,{className:`h-12 w-full`}),(0,M.jsx)(qw,{className:`h-12 w-full`})]}),!o&&i.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(ib,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`teams.empty`)})]}),!o&&i.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:i.map(t=>(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`button`,{type:`button`,className:`flex-1 text-left`,onClick:()=>h(m===t.id?null:t.id),children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.name}),t.createdAt&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:new Date(t.createdAt).toLocaleDateString()})]}),(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(Oy,{className:`h-4 w-4`})})}),(0,M.jsx)(sM,{align:`end`,children:(0,M.jsxs)(cM,{className:`text-destructive`,onClick:()=>D(t),children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`teams.delete`)]})})]})]}),m===t.id&&(0,M.jsxs)(`div`,{className:`pb-3 pl-4 border-l-2 ml-2 space-y-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e(`teams.members`,{count:g.length})}),(0,M.jsxs)(Z,{size:`sm`,variant:`outline`,onClick:()=>x(!0),children:[(0,M.jsx)(nb,{className:`mr-1 h-3 w-3`}),e(`teams.addMember`)]})]}),v&&(0,M.jsx)(qw,{className:`h-8 w-full`}),!v&&g.length===0&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`teams.noMembers`)}),!v&&g.map(e=>{let n=te[e.userId];return(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-1`,children:[(0,M.jsx)(`span`,{className:`text-sm`,children:n?.user?.name||n?.user?.email||e.userId}),(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,onClick:()=>ee(t.id,e.userId),children:(0,M.jsx)(tb,{className:`h-3 w-3`})})]},e.id)})]})]},t.id))})]})]}),(0,M.jsx)(BP,{open:c,onOpenChange:l,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`teams.createTitle`)}),(0,M.jsx)(qP,{children:e(`teams.createDescription`)})]}),(0,M.jsxs)(`form`,{onSubmit:E,children:[(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`team-name`,children:e(`teams.nameLabel`)}),(0,M.jsx)(nS,{id:`team-name`,required:!0,placeholder:e(`teams.namePlaceholder`),value:u,onChange:e=>d(e.target.value)})]})}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,type:`button`,onClick:()=>l(!1),children:e(`common.cancel`)}),(0,M.jsx)(Z,{type:`submit`,disabled:f,children:e(f?`common.saving`:`teams.create`)})]})]})]})}),(0,M.jsx)(BP,{open:b,onOpenChange:x,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`teams.addMemberTitle`)}),(0,M.jsx)(qP,{children:e(`teams.addMemberDescription`)})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-4`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{children:e(`teams.selectMember`)}),(0,M.jsxs)(BI,{value:S,onValueChange:C,children:[(0,M.jsx)(HI,{children:(0,M.jsx)(VI,{placeholder:e(`teams.selectMemberPlaceholder`)})}),(0,M.jsx)(GI,{children:re.map(e=>(0,M.jsx)(qI,{value:e.userId,children:e.user?.name||e.user?.email||e.userId},e.userId))})]})]})}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>x(!1),children:e(`common.cancel`)}),(0,M.jsx)(Z,{onClick:O,disabled:!S,children:e(`teams.addMember`)})]})]})})]})}var ZI=j.forwardRef(({className:e,...t},n)=>(0,M.jsx)(`textarea`,{className:X(`flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,e),ref:n,...t}));ZI.displayName=`Textarea`;var QI=la(`/organizations/$orgId/members`)({component:$I});function $I(){let{t:e}=vt(),{orgId:t}=QI.useParams(),{organizations:n}=tN(),{user:r}=eN(),i=Qg(),a=n.find(e=>e.id===t),{members:o,loading:s,inviteMember:c,removeMember:l,updateMemberRole:u}=tF(t),{invitations:d,loading:f,cancelInvitation:p,resendInvitation:m}=nF(t),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(!1),[y,b]=(0,j.useState)(``),[x,S]=(0,j.useState)(``),[C,w]=(0,j.useState)(`member`),[T,E]=(0,j.useState)(!1),[D,O]=(0,j.useState)(!1),ee=d.filter(e=>e.status===`pending`),te=o.find(e=>e.userId===r?.id),ne=te?.role===`owner`||te?.role===`admin`,re=async()=>{let t=_?x.split(/[,;\n]+/).map(e=>e.trim()).filter(Boolean):[y.trim()].filter(Boolean);if(t.length===0){K({title:e(`organizations.members.emailRequired`),variant:`destructive`});return}E(!0);let n=0;try{for(let e of t)try{await c(e,C)}catch{n++}n>0&&n<t.length?K({title:e(`organizations.members.invitePartialSuccess`,{sent:t.length-n,failed:n}),variant:`destructive`}):n===t.length?K({title:e(`organizations.members.inviteFailed`),variant:`destructive`}):K({title:e(`organizations.members.invitationSent`)}),g(!1),b(``),S(``),w(`member`)}finally{E(!1)}},ie=async(t,n)=>{if(confirm(e(`organizations.members.removeConfirm`,{name:n})))try{await l(t),K({title:e(`organizations.members.memberRemoved`)})}catch(t){K({title:e(`organizations.members.removeFailed`),description:t.message,variant:`destructive`})}},ae=async(t,n)=>{try{await u(t,n),K({title:e(`organizations.members.roleUpdated`)})}catch(t){K({title:e(`organizations.members.roleUpdateFailed`),description:t.message,variant:`destructive`})}},oe=async()=>{if(confirm(e(`organizations.members.leaveConfirm`,{org:a?.name??t}))){O(!0);try{await i.organizations.leave(t),K({title:e(`organizations.members.leftOrg`)}),window.location.assign(`/`)}catch(t){K({title:e(`organizations.members.leaveFailed`),description:t.message,variant:`destructive`})}finally{O(!1)}}},k=async(t,n)=>{if(confirm(e(`organizations.members.cancelConfirm`,{email:n})))try{await p(t),K({title:e(`organizations.members.invitationCanceled`)})}catch(t){K({title:e(`organizations.members.cancelFailed`),description:t.message,variant:`destructive`})}},se=async t=>{try{await m(t),K({title:e(`organizations.members.invitationResent`)})}catch(t){K({title:e(`organizations.members.resendFailed`),description:t.message,variant:`destructive`})}},ce=async t=>{let n=`${window.location.origin}/accept-invitation/${t}`;try{await navigator.clipboard.writeText(n),K({title:e(`organizations.members.linkCopied`)})}catch{K({title:e(`organizations.members.linkCopyFailed`),variant:`destructive`})}};return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`organizations.members.title`,{count:o.length})}),(0,M.jsx)(TN,{children:e(`organizations.members.description`)})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[te&&te.role!==`owner`&&(0,M.jsxs)(Z,{size:`sm`,variant:`outline`,onClick:oe,disabled:D,children:[(0,M.jsx)(Ly,{className:`mr-2 h-4 w-4`}),e(`organizations.members.leave`)]}),ne&&(0,M.jsxs)(Z,{size:`sm`,onClick:()=>g(!0),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`organizations.members.invite`)]})]})]})}),(0,M.jsxs)(EN,{children:[s&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingMembers`)}),!s&&o.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(ab,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.empty`)})]}),!s&&o.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:o.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsxs)(`div`,{className:`font-medium text-sm`,children:[t.user?.name||t.user?.email||t.userId,t.userId===r?.id&&(0,M.jsx)(cP,{variant:`secondary`,className:`ml-2 text-xs`,children:e(`organizations.members.you`)})]}),t.user?.email&&(0,M.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:t.user.email})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ne&&t.role!==`owner`&&t.userId!==r?.id?(0,M.jsxs)(BI,{value:t.role,onValueChange:e=>ae(t.id,e),children:[(0,M.jsx)(HI,{className:`h-7 w-24 text-xs`,children:(0,M.jsx)(VI,{})}),(0,M.jsxs)(GI,{children:[(0,M.jsx)(qI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(qI,{value:`member`,children:e(`common.roles.member`)})]})]}):(0,M.jsx)(cP,{variant:`secondary`,className:`text-xs`,children:e(`common.roles.${t.role??`member`}`)}),ne&&t.role!==`owner`&&t.userId!==r?.id&&(0,M.jsxs)(rM,{children:[(0,M.jsx)(iM,{asChild:!0,children:(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,children:(0,M.jsx)(Oy,{className:`h-4 w-4`})})}),(0,M.jsx)(sM,{align:`end`,children:(0,M.jsxs)(cM,{className:`text-destructive`,onClick:()=>ie(t.id,t.user?.name||t.user?.email||t.userId),children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`organizations.members.removeMember`)]})})]})]})]},t.id))})]})]}),(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(wN,{className:`text-base`,children:e(`organizations.members.pendingTitle`,{count:ee.length})}),(0,M.jsx)(TN,{children:e(`organizations.members.pendingDescription`)})]}),ne&&(0,M.jsxs)(Z,{size:`sm`,variant:`outline`,onClick:()=>g(!0),children:[(0,M.jsx)(nb,{className:`mr-2 h-4 w-4`}),e(`organizations.members.sendInvitation`)]})]})}),(0,M.jsxs)(EN,{children:[f&&(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.loadingInvitations`)}),!f&&ee.length===0&&(0,M.jsxs)(`div`,{className:`text-center py-8`,children:[(0,M.jsx)(zy,{className:`mx-auto h-12 w-12 text-muted-foreground/50`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:e(`organizations.members.noPending`)})]}),!f&&ee.length>0&&(0,M.jsx)(`div`,{className:`divide-y`,children:ee.map(t=>(0,M.jsxs)(`div`,{className:`flex items-center justify-between py-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`div`,{className:`font-medium text-sm`,children:t.email}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,M.jsx)(cP,{variant:`outline`,className:`text-xs`,children:e(`common.roles.${t.role}`)}),(0,M.jsxs)(`span`,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,M.jsx)(Ey,{className:`h-3 w-3`}),e(`organizations.members.expires`,{date:new Date(t.expiresAt).toLocaleDateString()})]})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.copyLink`),onClick:()=>ce(t.id),children:(0,M.jsx)(Dy,{className:`h-4 w-4`})}),(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.resend`),onClick:()=>se(t),children:(0,M.jsx)(Wy,{className:`h-4 w-4`})}),(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,className:`h-8 w-8 p-0`,title:e(`organizations.members.cancel`),onClick:()=>k(t.id,t.email),children:(0,M.jsx)(ob,{className:`h-4 w-4`})})]})]},t.id))})]})]}),(0,M.jsx)(BP,{open:h,onOpenChange:g,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{children:e(`organizations.members.inviteDialogTitle`)}),(0,M.jsx)(qP,{children:e(`organizations.members.inviteDialogDescription`,{organization:a?.name??``})})]}),(0,M.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Z,{type:`button`,variant:_?`outline`:`default`,size:`sm`,onClick:()=>v(!1),children:e(`organizations.members.singleInvite`)}),(0,M.jsx)(Z,{type:`button`,variant:_?`default`:`outline`,size:`sm`,onClick:()=>v(!0),children:e(`organizations.members.bulkInvite`)})]}),_?(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{children:e(`organizations.members.bulkEmails`)}),(0,M.jsx)(ZI,{placeholder:e(`organizations.members.bulkEmailsPlaceholder`),rows:5,value:x,onChange:e=>S(e.target.value)}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.members.bulkEmailsHint`)})]}):(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`invite-email`,children:e(`organizations.members.email`)}),(0,M.jsx)(nS,{id:`invite-email`,type:`email`,placeholder:e(`organizations.members.emailPlaceholder`),value:y,onChange:e=>b(e.target.value)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`role`,children:e(`organizations.members.role`)}),(0,M.jsxs)(BI,{value:C,onValueChange:w,children:[(0,M.jsx)(HI,{id:`role`,children:(0,M.jsx)(VI,{})}),(0,M.jsxs)(GI,{children:[(0,M.jsx)(qI,{value:`owner`,children:e(`common.roles.owner`)}),(0,M.jsx)(qI,{value:`admin`,children:e(`common.roles.admin`)}),(0,M.jsx)(qI,{value:`member`,children:e(`common.roles.member`)})]})]})]})]}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>g(!1),disabled:T,children:e(`common.cancel`)}),(0,M.jsx)(Z,{onClick:re,disabled:T,children:e(T?`organizations.members.sending`:`organizations.members.sendInvitation`)})]})]})})]})}var eL=la(`/organizations/$orgId/general`)({component:tL});function tL(){let{t:e}=vt(),{orgId:t}=eL.useParams(),n=Hi(),{organizations:r}=tN(),{session:i,user:a,setActiveOrganization:o}=eN(),s=r.find(e=>e.id===t),{members:c}=tF(t),{invitations:l}=nF(t),{remove:u,deleting:d}=iN(),{update:f,updating:p}=rN(),[m,h]=(0,j.useState)(``),[g,_]=(0,j.useState)(``),[v,y]=(0,j.useState)(``),[b,x]=(0,j.useState)(!1),[S,C]=(0,j.useState)(``);(0,j.useEffect)(()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},[s?.id,s?.name,s?.slug,s?.logo]);let w=i?.activeOrganizationId===t,T=l.filter(e=>e.status===`pending`),E=(a?c.find(e=>e.userId===a.id):void 0)?.role??null,D=E===`owner`||E===`admin`,O=D&&s!=null&&(m.trim()!==(s.name??``)||g.trim()!==(s.slug??``)||v.trim()!==(s.logo??``));return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w&&(0,M.jsx)(cP,{variant:`outline`,children:e(`organizations.active`)}),E&&(0,M.jsx)(cP,{variant:`secondary`,className:`capitalize`,children:e(`common.roles.${E}`)})]}),!w&&(0,M.jsx)(Z,{size:`sm`,variant:`outline`,onClick:async()=>{try{await o(t),K({title:e(`organizations.general.switched`)})}catch(t){K({title:e(`organizations.general.switchFailed`),description:t.message,variant:`destructive`})}},children:e(`organizations.general.setActive`)})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{children:e(`organizations.general.detailsTitle`)}),(0,M.jsx)(TN,{children:e(D?`organizations.general.detailsDescription`:`organizations.general.detailsReadOnly`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`org-name`,children:e(`organizations.new.name`)}),(0,M.jsx)(nS,{id:`org-name`,value:m,onChange:e=>h(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.namePlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`org-slug`,children:e(`organizations.new.slug`)}),(0,M.jsx)(nS,{id:`org-slug`,value:g,onChange:e=>_(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.slugPlaceholder`),className:`font-mono text-sm`}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`organizations.general.slugHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`org-logo`,children:e(`organizations.general.logo`)}),(0,M.jsx)(nS,{id:`org-logo`,value:v,onChange:e=>y(e.target.value),disabled:!D||p,placeholder:e(`organizations.general.logoPlaceholder`)})]}),(0,M.jsxs)(`div`,{className:`flex justify-between border-t pt-4 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.organizationId`)}),(0,M.jsx)(`code`,{className:`font-mono`,children:t})]})]}),D&&(0,M.jsxs)(EN,{className:`flex justify-end gap-2 border-t pt-4`,children:[(0,M.jsx)(Z,{variant:`ghost`,size:`sm`,onClick:()=>{h(s?.name??``),_(s?.slug??``),y(s?.logo??``)},disabled:!O||p,children:e(`organizations.general.reset`)}),(0,M.jsxs)(Z,{size:`sm`,onClick:async()=>{if(!s||!D||!O)return;let n=m.trim();if(!n){K({title:e(`organizations.general.nameRequired`),variant:`destructive`});return}try{await f(t,{name:n,slug:g.trim()||void 0,logo:v.trim()||void 0}),K({title:e(`organizations.general.updated`)})}catch(t){K({title:e(`organizations.general.updateFailed`),description:t.message,variant:`destructive`})}},disabled:!O||p,children:[(0,M.jsx)(Gy,{className:`mr-2 h-4 w-4`}),e(p?`common.saving`:`organizations.general.save`)]})]})]}),(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsx)(wN,{className:`text-base`,children:e(`organizations.general.overviewTitle`)})}),(0,M.jsxs)(EN,{className:`space-y-3 text-sm`,children:[(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.members`)}),(0,M.jsx)(`span`,{children:c.length})]}),(0,M.jsxs)(`div`,{className:`flex justify-between`,children:[(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:e(`organizations.general.pendingInvitations`)}),(0,M.jsx)(`span`,{children:T.length})]})]})]}),D&&(0,M.jsxs)(Q,{className:`border-destructive/40`,children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base text-destructive`,children:e(`organizations.general.dangerTitle`)}),(0,M.jsx)(TN,{children:e(`organizations.general.dangerDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(Z,{variant:`destructive`,size:`sm`,onClick:()=>x(!0),disabled:d,children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`organizations.general.delete`)]})})]}),(0,M.jsx)(BP,{open:b,onOpenChange:e=>{x(e),e||C(``)},children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{className:`text-destructive`,children:e(`organizations.general.deleteDialogTitle`)}),(0,M.jsx)(qP,{children:e(`organizations.general.deleteDialogDescription`,{name:s?.name??``})})]}),(0,M.jsx)(`div`,{className:`space-y-4 py-2`,children:(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`delete-confirm`,children:e(`organizations.general.deleteDialogLabel`,{name:s?.name??``})}),(0,M.jsx)(nS,{id:`delete-confirm`,value:S,onChange:e=>C(e.target.value),placeholder:s?.name??``,disabled:d})]})}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>x(!1),disabled:d,children:e(`common.cancel`)}),(0,M.jsx)(Z,{variant:`destructive`,onClick:async()=>{if(s){if(S!==s.name){K({title:e(`organizations.general.confirmationMismatch`),description:e(`organizations.general.confirmationHint`,{name:s.name}),variant:`destructive`});return}try{let r=await u(t),i=r?.warnings,a=r?.deletedProjects??0;K({title:e(`organizations.general.deleted`),description:i?.length?e(`organizations.general.deletedWithWarnings`,{deletedProjects:a,warning:i[0],extraCount:Math.max(i.length-1,0)}):e(`organizations.general.deletedDescription`,{name:s.name,deletedProjects:a}),variant:i?.length?`destructive`:void 0}),x(!1),C(``),n({to:`/organizations`})}catch(t){K({title:e(`organizations.general.deleteFailed`),description:t.message,variant:`destructive`})}}},disabled:d||!s||S!==s.name,children:e(d?`organizations.general.deleting`:`organizations.general.delete`)})]})]})})]})}var nL=la(`/account/oauth-applications/new`)({component:rL});function rL(){let{t:e}=vt(),t=Hi(),{register:n,registering:r}=CP(),[i,a]=(0,j.useState)(``),[o,s]=(0,j.useState)(``),[c,l]=(0,j.useState)(`client_secret_basic`),[u,d]=(0,j.useState)(``),[f,p]=(0,j.useState)(``),[m,h]=(0,j.useState)(null),g=async()=>{let t=i.trim(),r=o.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean);if(!t){K({title:e(`oauth.applications.form.nameRequired`),variant:`destructive`});return}if(r.length===0){K({title:e(`oauth.applications.form.redirectRequired`),variant:`destructive`});return}try{let i=await n({client_name:t,redirect_uris:r,token_endpoint_auth_method:c,...u.trim()?{client_uri:u.trim()}:{},...f.trim()?{logo_uri:f.trim()}:{}});h({client_id:i?.client_id??``,client_secret:i?.client_secret}),K({title:e(`oauth.applications.registered`)})}catch(t){K({title:e(`oauth.applications.registerFailed`),description:t.message,variant:`destructive`})}},_=(t,n)=>{navigator.clipboard.writeText(t).then(()=>K({title:e(`oauth.applications.copied`,{label:n})}),()=>K({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))};return m?(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.registeredTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.registeredDescription`)})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(TN,{children:e(`oauth.applications.credentialsDescription`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)($,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_id}),(0,M.jsx)(Z,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(Dy,{className:`h-4 w-4`})})]})]}),m.client_secret&&(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)($,{children:e(`oauth.applications.clientSecret`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 break-all rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:m.client_secret}),(0,M.jsx)(Z,{size:`icon`,variant:`outline`,onClick:()=>_(m.client_secret,e(`oauth.applications.clientSecret`)),children:(0,M.jsx)(Dy,{className:`h-4 w-4`})})]}),(0,M.jsx)(`p`,{className:`text-xs text-destructive`,children:e(`oauth.applications.clientSecretWarning`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>t({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)}),(0,M.jsx)(Z,{onClick:()=>t({to:`/account/oauth-applications/$clientId`,params:{clientId:m.client_id}}),children:e(`oauth.applications.viewApplication`)})]})]}):(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.form.title`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.form.description`)})]}),(0,M.jsxs)(Q,{children:[(0,M.jsx)(CN,{children:(0,M.jsxs)(wN,{className:`flex items-center gap-2 text-base`,children:[(0,M.jsx)(Ny,{className:`h-4 w-4`}),e(`oauth.applications.form.details`)]})}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`oauth-name`,children:e(`oauth.applications.form.name`)}),(0,M.jsx)(nS,{id:`oauth-name`,value:i,onChange:e=>a(e.target.value),placeholder:e(`oauth.applications.form.namePlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`oauth-redirect`,children:e(`oauth.applications.form.redirectUris`)}),(0,M.jsx)(ZI,{id:`oauth-redirect`,value:o,onChange:e=>s(e.target.value),placeholder:e(`oauth.applications.form.redirectPlaceholder`),rows:3,disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.redirectHint`)})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{children:e(`oauth.applications.form.authMethod`)}),(0,M.jsxs)(BI,{value:c,onValueChange:e=>l(e),disabled:r,children:[(0,M.jsx)(HI,{children:(0,M.jsx)(VI,{})}),(0,M.jsxs)(GI,{children:[(0,M.jsx)(qI,{value:`client_secret_basic`,children:e(`oauth.applications.form.authMethodBasic`)}),(0,M.jsx)(qI,{value:`client_secret_post`,children:e(`oauth.applications.form.authMethodPost`)}),(0,M.jsx)(qI,{value:`none`,children:e(`oauth.applications.form.authMethodNone`)})]})]})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`oauth-client-uri`,children:e(`oauth.applications.form.clientUri`)}),(0,M.jsx)(nS,{id:`oauth-client-uri`,value:u,onChange:e=>d(e.target.value),placeholder:e(`oauth.applications.form.clientUriPlaceholder`),disabled:r})]}),(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)($,{htmlFor:`oauth-logo`,children:e(`oauth.applications.form.logoUri`)}),(0,M.jsx)(nS,{id:`oauth-logo`,value:f,onChange:e=>p(e.target.value),placeholder:e(`oauth.applications.form.logoUriPlaceholder`),disabled:r}),(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`oauth.applications.form.logoHint`)})]})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,M.jsx)(Z,{variant:`ghost`,onClick:()=>t({to:`/account/oauth-applications`}),disabled:r,children:e(`common.cancel`)}),(0,M.jsx)(Z,{onClick:g,disabled:r,children:e(r?`oauth.applications.form.registering`:`oauth.applications.register`)})]})]})}var iL=la(`/account/oauth-applications/$clientId`)({component:aL});function aL(){let{t:e}=vt(),{clientId:t}=iL.useParams(),n=Hi(),{applications:r,loading:i,reload:a}=SP(),{remove:o,deleting:s}=wP(),c=Qg(),l=r.find(e=>e.client_id===t),[u,d]=(0,j.useState)(null);(0,j.useEffect)(()=>{let e=!1;if(!l&&c?.oauth?.applications?.get)return c.oauth.applications.get(t).then(t=>{e||d(t?.data??t)},()=>{}),()=>{e=!0}},[c,t,l]);let f=l??u,[p,m]=(0,j.useState)(!1),h=(t,n)=>{navigator.clipboard.writeText(t).then(()=>K({title:e(`oauth.applications.copied`,{label:n})}),()=>K({title:e(`oauth.applications.copyFailed`,{label:n}),variant:`destructive`}))},g=async()=>{if(f)try{await o(f.client_id),K({title:e(`oauth.applications.deleted`)}),await a(),n({to:`/account/oauth-applications`})}catch(t){K({title:e(`oauth.applications.deleteFailed`),description:t.message,variant:`destructive`})}};if(i&&!f)return(0,M.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:e(`common.loading`)});if(!f)return(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`oauth.applications.notFoundTitle`)}),(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.notFoundDescription`)}),(0,M.jsx)(Z,{onClick:()=>n({to:`/account/oauth-applications`}),children:e(`oauth.applications.backToList`)})]});let _=typeof f.redirect_urls==`string`?f.redirect_urls.split(/\r?\n|,/).map(e=>e.trim()).filter(Boolean):Array.isArray(f.redirect_urls)?f.redirect_urls:[];return(0,M.jsxs)(`div`,{className:`space-y-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-2xl font-semibold`,children:f.name}),(0,M.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:f.client_id})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f.type&&(0,M.jsx)(cP,{variant:`outline`,className:`capitalize`,children:f.type}),f.disabled&&(0,M.jsx)(cP,{variant:`destructive`,children:e(`oauth.applications.disabled`)})]})]}),(0,M.jsxs)(Q,{children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{children:e(`oauth.applications.credentials`)}),(0,M.jsx)(TN,{children:e(`oauth.applications.credentialsDescriptionDetail`)})]}),(0,M.jsxs)(EN,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)($,{children:e(`oauth.applications.clientId`)}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:f.client_id}),(0,M.jsx)(Z,{size:`icon`,variant:`outline`,onClick:()=>h(f.client_id,e(`oauth.applications.clientId`)),children:(0,M.jsx)(Dy,{className:`h-4 w-4`})})]})]}),(0,M.jsxs)(`div`,{className:`space-y-1`,children:[(0,M.jsx)($,{children:e(`oauth.applications.redirectUris`)}),_.length===0?(0,M.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`oauth.applications.noRedirectUris`)}):(0,M.jsx)(`ul`,{className:`space-y-1`,children:_.map((e,t)=>(0,M.jsx)(`li`,{className:`rounded-md border bg-muted px-3 py-2 font-mono text-xs`,children:e},t))})]})]})]}),(0,M.jsxs)(Q,{className:`border-destructive/40`,children:[(0,M.jsxs)(CN,{children:[(0,M.jsx)(wN,{className:`text-base text-destructive`,children:e(`oauth.applications.dangerTitle`)}),(0,M.jsx)(TN,{children:e(`oauth.applications.dangerDescription`)})]}),(0,M.jsx)(EN,{children:(0,M.jsxs)(Z,{variant:`destructive`,size:`sm`,onClick:()=>m(!0),disabled:s,children:[(0,M.jsx)(Qy,{className:`mr-2 h-4 w-4`}),e(`oauth.applications.delete`)]})})]}),(0,M.jsx)(BP,{open:p,onOpenChange:m,children:(0,M.jsxs)(UP,{children:[(0,M.jsxs)(WP,{children:[(0,M.jsx)(KP,{className:`text-destructive`,children:e(`oauth.applications.deleteDialogTitle`)}),(0,M.jsx)(qP,{children:e(`oauth.applications.deleteDialogDescription`,{name:f.name})})]}),(0,M.jsxs)(GP,{children:[(0,M.jsx)(Z,{variant:`outline`,onClick:()=>m(!1),disabled:s,children:e(`common.cancel`)}),(0,M.jsx)(Z,{variant:`destructive`,onClick:g,disabled:s,children:e(s?`oauth.applications.deleting`:`common.delete`)})]})]})})]})}var oL=jN.update({id:`/verify-email-prompt`,path:`/verify-email-prompt`,getParentRoute:()=>SN}),sL=NN.update({id:`/verify-email`,path:`/verify-email`,getParentRoute:()=>SN}),cL=zN.update({id:`/setup`,path:`/setup`,getParentRoute:()=>SN}),lL=HN.update({id:`/reset-password`,path:`/reset-password`,getParentRoute:()=>SN}),uL=qN.update({id:`/register`,path:`/register`,getParentRoute:()=>SN}),dL=ZN.update({id:`/login`,path:`/login`,getParentRoute:()=>SN}),fL=tP.update({id:`/forgot-password`,path:`/forgot-password`,getParentRoute:()=>SN}),pL=rP.update({id:`/account`,path:`/account`,getParentRoute:()=>SN}),mL=aP.update({id:`/`,path:`/`,getParentRoute:()=>SN}),hL=uP.update({id:`/organizations/`,path:`/organizations/`,getParentRoute:()=>SN}),gL=fP.update({id:`/`,path:`/`,getParentRoute:()=>pL}),_L=hP.update({id:`/organizations/new`,path:`/organizations/new`,getParentRoute:()=>SN}),vL=bP.update({id:`/organizations/$orgId`,path:`/organizations/$orgId`,getParentRoute:()=>SN}),yL=EP.update({id:`/oauth/consent`,path:`/oauth/consent`,getParentRoute:()=>SN}),bL=kP.update({id:`/auth/device`,path:`/auth/device`,getParentRoute:()=>SN}),xL=MP.update({id:`/two-factor`,path:`/two-factor`,getParentRoute:()=>pL}),SL=LP.update({id:`/sessions`,path:`/sessions`,getParentRoute:()=>pL}),CL=JP.update({id:`/security`,path:`/security`,getParentRoute:()=>pL}),wL=XP.update({id:`/profile`,path:`/profile`,getParentRoute:()=>pL}),TL=QP.update({id:`/linked-accounts`,path:`/linked-accounts`,getParentRoute:()=>pL}),EL=iF.update({id:`/invitations`,path:`/invitations`,getParentRoute:()=>pL}),DL=oF.update({id:`/accept-invitation/$invitationId`,path:`/accept-invitation/$invitationId`,getParentRoute:()=>SN}),OL=cF.update({id:`/`,path:`/`,getParentRoute:()=>vL}),kL=lF.update({id:`/oauth-applications/`,path:`/oauth-applications/`,getParentRoute:()=>pL}),AL=YI.update({id:`/teams`,path:`/teams`,getParentRoute:()=>vL}),jL=QI.update({id:`/members`,path:`/members`,getParentRoute:()=>vL}),ML=eL.update({id:`/general`,path:`/general`,getParentRoute:()=>vL}),NL=nL.update({id:`/oauth-applications/new`,path:`/oauth-applications/new`,getParentRoute:()=>pL}),PL={AccountInvitationsRoute:EL,AccountLinkedAccountsRoute:TL,AccountProfileRoute:wL,AccountSecurityRoute:CL,AccountSessionsRoute:SL,AccountTwoFactorRoute:xL,AccountIndexRoute:gL,AccountOauthApplicationsClientIdRoute:iL.update({id:`/oauth-applications/$clientId`,path:`/oauth-applications/$clientId`,getParentRoute:()=>pL}),AccountOauthApplicationsNewRoute:NL,AccountOauthApplicationsIndexRoute:kL},FL=pL._addFileChildren(PL),IL={OrganizationsOrgIdGeneralRoute:ML,OrganizationsOrgIdMembersRoute:jL,OrganizationsOrgIdTeamsRoute:AL,OrganizationsOrgIdIndexRoute:OL},LL={IndexRoute:mL,AccountRoute:FL,ForgotPasswordRoute:fL,LoginRoute:dL,RegisterRoute:uL,ResetPasswordRoute:lL,SetupRoute:cL,VerifyEmailRoute:sL,VerifyEmailPromptRoute:oL,AcceptInvitationInvitationIdRoute:DL,AuthDeviceRoute:bL,OauthConsentRoute:yL,OrganizationsOrgIdRoute:vL._addFileChildren(IL),OrganizationsNewRoute:_L,OrganizationsIndexRoute:hL},RL=SN._addFileChildren(LL)._addFileTypes();function zL(){let e=`/_account/`;return e.endsWith(`/`)?e.slice(0,-1):e}var BL=wa({routeTree:RL,basepath:zL()});function VL(){return(0,M.jsx)(Da,{router:BL})}var HL=typeof localStorage<`u`&&localStorage.getItem(`account.lang`)||typeof navigator<`u`&&navigator.language||`en`;function UL({children:e}){let{i18n:t,language:n}=yt(),[r,i]=j.useReducer(e=>e+1,0),[a,o]=j.useState(!1);return j.useEffect(()=>{let e=()=>i();t.on(`loaded`,e),t.on(`languageChanged`,e);let n=window.setTimeout(()=>o(!0),1500);return()=>{t.off(`loaded`,e),t.off(`languageChanged`,e),window.clearTimeout(n)}},[t]),a||t.isInitialized&&t.hasResourceBundle?.(n,`translation`)?(0,M.jsx)(M.Fragment,{children:e}):null}Jf.createRoot(document.getElementById(`root`)).render((0,M.jsx)(j.StrictMode,{children:(0,M.jsx)(_t,{config:{defaultLanguage:HL,fallbackLanguage:`en`},loadLanguage:xM,children:(0,M.jsx)(UL,{children:(0,M.jsx)(VL,{})})})}));
|