vde-open 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/dist/cli.js +319 -9
- package/dist/daemon.js +2 -2
- package/dist/{main-BaV6ocLQ.js → main-D-ZX3nEP.js} +814 -141
- package/dist/{search-index-ed_S_eI7.js → search-index-B0xpVDwG.js} +111 -2
- package/dist/web/assets/main-DcvVu7FQ.js +123 -0
- package/dist/web/assets/mobile-HCpMXT2S.js +1 -0
- package/dist/web/assets/rolldown-runtime-CbXtAM7H.js +1 -0
- package/dist/web/assets/src--PpHwH7V.js +41 -0
- package/dist/web/assets/src-DinzSLDA.css +2 -0
- package/dist/web/index.html +4 -2
- package/dist/web/mobile.html +15 -0
- package/dist/workers/search-worker.js +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-B9HgIqYy.css +0 -2
- package/dist/web/assets/index-ClhOwv9m.js +0 -163
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-CbXtAM7H.js";import{At as t,B as n,Bt as r,C as i,Cn as a,Ct as o,D as s,Dt as c,E as l,Et as u,F as d,Ft as f,G as p,Gt as m,H as h,Ht as g,I as _,It as v,J as y,Jt as b,K as x,Kt as S,L as C,Lt as w,M as T,Mt as E,N as D,Nt as O,O as ee,Ot as te,P as ne,Pt as re,Q as ie,R as ae,Rt as oe,S as se,Sn as k,St as ce,Tt as A,U as le,Ut as j,V as M,Vt as N,W as P,Wt as ue,X as de,Xt as fe,Y as pe,Yt as me,Z as he,_ as ge,_n as _e,_t as ve,a as ye,an as be,at as xe,b as Se,bn as Ce,bt as we,c as Te,cn as Ee,ct as De,d as Oe,dn as ke,dt as Ae,et as je,f as Me,fn as Ne,ft as Pe,g as Fe,gn as Ie,gt as F,hn as Le,ht as Re,i as ze,in as Be,it as Ve,j as He,jt as Ue,k as We,kt as Ge,l as Ke,ln as qe,lt as Je,m as Ye,mn as Xe,mt as Ze,n as Qe,nn as $e,nt as et,o as tt,on as nt,ot as rt,p as it,pn as at,pt as ot,q as st,qt as ct,r as lt,rn as ut,rt as dt,s as ft,sn as pt,st as mt,t as ht,tn as gt,tt as _t,u as vt,un as yt,ut as bt,v as xt,vn as St,vt as Ct,w as wt,wn as Tt,wt as Et,x as Dt,xn as Ot,xt as kt,y as At,yn as jt,yt as Mt,z as Nt,zt as Pt}from"./src--PpHwH7V.js";var I=e(Tt(),1),Ft=k(),It=`vde-bridge-port`;function Lt(e){return Rt(e)}function Rt(e){if(e===null)return`null`;switch(typeof e){case`string`:return JSON.stringify(e);case`boolean`:return e?`true`:`false`;case`number`:if(!Number.isFinite(e))throw TypeError(`A non-finite number cannot be used in canonical JSON.`);return JSON.stringify(e);case`object`:return Array.isArray(e)?`[${e.map(e=>Rt(e)).join(`,`)}]`:zt(e);default:throw TypeError(`A ${typeof e} cannot be used in canonical JSON.`)}}function zt(e){let t=[];for(let n of Object.keys(e).toSorted()){let r=e[n];if(r===void 0)throw TypeError(`undefined cannot be used in canonical JSON (key: ${n}).`);t.push(`${JSON.stringify(n)}:${Rt(r)}`)}return`{${t.join(`,`)}}`}function Bt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Vt(e,t=`|`){return e.map(e=>pn(e)).join(t)}function Ht(e,t){return typeof t==`bigint`?t.toString():t}var Ut=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Wt(e){return new Ut(e)}function Gt(e){return e==null}function Kt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function qt(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Jt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Yt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Xt(e){return Yt(e._zod.def)??e._zod.def.shape}function Zt(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Jt(this,t,e),e},enumerable:!0,configurable:!0})}function Qt(e,t,n){t in e?Jt(e,t,n):e[t]=n}function $t(e,t,n,r){let i=Xt(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Zt(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Qt(e,a,r?r(n.value,a):n.value))}}function en(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Zt(e,n,()=>t[n]):Qt(e,n,r.value))}}function tn(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function nn(e){return JSON.stringify(e)}function rn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var an=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function on(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var sn=Wt(()=>{if(tr.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function cn(e){if(on(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return on(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ln(e){return cn(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var un=new Set([`string`,`number`,`symbol`]);function dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function pn(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function mn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var hn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},gn={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function _n(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return $t(i,e,vn(e,t)),fn(e,tn(n,{shape:i,checks:[]}))}function vn(e,t){let n=Xt(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function yn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(vn(e,t)),a={};return $t(a,e,Reflect.ownKeys(Xt(e)).filter(e=>!i.has(e))),fn(e,tn(n,{shape:a,checks:[]}))}function bn(e,t){if(!cn(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Xt(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return fn(e,tn(e._zod.def,{shape:xn(e,t)}))}function xn(e,t){let n={};return $t(n,e,Reflect.ownKeys(Xt(e))),en(n,t),n}function Sn(e,t){if(!cn(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return fn(e,tn(e._zod.def,{shape:xn(e,t)}))}function Cn(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return $t(n,e,Reflect.ownKeys(Xt(e))),$t(n,t,Reflect.ownKeys(Xt(t))),fn(e,tn(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function wn(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(vn(t,n)):void 0,o={};return $t(o,t,Reflect.ownKeys(Xt(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),fn(t,tn(t._zod.def,{shape:o,checks:[]}))}function Tn(e,t,n){let r=n?new Set(vn(t,n)):void 0,i={};return $t(i,t,Reflect.ownKeys(Xt(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),fn(t,tn(t._zod.def,{shape:i}))}function En(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Dn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function On(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function kn(e){return typeof e==`string`?e:e?.message}function An(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function jn(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:kn(e.inst?._zod.def?.error?.(e))??kn(a?.(e))??kn(t?.error?.(e))??kn(n.customError?.(e))??kn(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Mn=/[\uD800-\uDBFF]/;function Nn(e){let t=e.length;if(!Mn.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Pn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Fn(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function In(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Ln(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Vn(e,n,r.value)}}function Rn(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function zn(e,t,n){return Rn(e,t,n,!1)}function Bn(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Rn(this,n,r(this))},set(e){Rn(this,n,e)}})}return t}function Vn(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Rn(this,t,n.bind(this))},set(e){Rn(this,t,e)}})}function Hn(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Un,Wn=!1,Gn={configurable:!0,get(){Wn=!0}};function R(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Un!==e._zod){Un=void 0;return}Un=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Gn);let e=Wn;Wn=!1;try{let r=n(this);return Wn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Wn||=e,r}catch(n){throw delete this[t],Wn||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Kn(e,t,n,r){let i=Hn(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var qn=`~constantCatch`;function Jn(e){let t=()=>e;return t[qn]=!0,t}var Yn,Xn={value:void 0,enumerable:!1},Zn=`captureStackTrace`in Error?Error:null;function Qn(e){let t=Zn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Zn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function z(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Xn.value=new a(r);try{Object.defineProperty(n,"_zod",Xn)}finally{Xn.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Ln(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Qn(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var $n=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},er=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Yn=globalThis).__zod_globalConfig??(Yn.__zod_globalConfig={});var tr=globalThis.__zod_globalConfig;function nr(e){return e&&Object.assign(tr,e),tr}function rr(){let e=this._zod;return e.message??=JSON.stringify(e.def,Ht,2),e.message}function ir(e){this._zod.message=e}var ar={get:rr,set:ir,enumerable:!0,configurable:!0},or={value:void 0,enumerable:!1},sr=new WeakSet([Object.prototype,Error.prototype]),cr=(e,t)=>{e.name=`$ZodError`,or.value=t,Object.defineProperty(e,"issues",or),or.value=void 0,Object.defineProperty(e,"message",ar);let n=Object.getPrototypeOf(e);sr.has(n)||(sr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},lr=z(`$ZodError`,cr);z(`$ZodError`,cr,void 0,{Parent:Error});function ur(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function dr(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?ur(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function fr(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function pr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var mr=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new $n;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>jn(e,o,nr())));throw an(n,a?.callee??t),n}return s.value};return t},hr=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>jn(e,o,nr())));throw an(n,a?.callee??t),n}return s.value};return t},gr=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $n;return a.issues.length?_r(e,a.issues,i):{success:!0,data:a.value}};function _r(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>jn(e,n,nr()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var vr=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?_r(e,a.issues,i):{success:!0,data:a.value}},yr=Symbol.for(`zod.compile.invalid`),br=Symbol.for(`zod.compile.fallback`),xr=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==yr)return!0;if(r.definite===!0&&n===void 0)return!1}return Sr(e,t,n)});function Sr(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[br]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new $n;return a.issues.length===0}var Cr=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},wr=e=>{let t=mr(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,pr(n,a))};return n},Tr=e=>{let t=mr(e),n=(e,r,i,a)=>t(e,r,i,pr(n,a));return n},Er=e=>{let t=hr(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,pr(n,a))};return n},Dr=e=>{let t=hr(e),n=async(e,r,i,a)=>await t(e,r,i,pr(n,a));return n},Or=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return gr(e)(t,n,i)},kr=e=>(t,n,r)=>gr(e)(t,n,r),Ar=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return vr(e)(t,n,i)},jr=e=>async(t,n,r)=>vr(e)(t,n,r),Mr=/^[cC][0-9a-z]{6,}$/,Nr=/^[0-9a-z]+$/,Pr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Fr=/^[0-9a-vA-V]{20}$/,Ir=/^[A-Za-z0-9]{27}$/,Lr=/^[a-zA-Z0-9_-]{21}$/;function Rr(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var zr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Br=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Vr=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Hr=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ur=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Wr(){return new RegExp(Ur,`u`)}var Gr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Kr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,qr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Jr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Zr=/^https?$/,Qr=/^\+[1-9]\d{6,14}$/,$r=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function ei(e){return RegExp(`^${e}$`)}var ti=ei($r);function ni(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ri(e){return RegExp(`^${ni(e)}$`)}function ii(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${ni({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${ni({precision:e.precision})}`:n;return RegExp(`^${$r}T(?:${r})$`)}var ai=/^[\s\S]{0,}$/,oi=/^-?\d+$/,si=/^-?\d+(?:\.\d+)?$/,ci=/^(?:true|false)$/i,li=/^[^A-Z]*$/,ui=/^[^a-z]*$/,di=z(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),fi=e=>{let t=e.value;return!Gt(t)&&t.length!==void 0},pi={number:`number`,bigint:`bigint`,object:`date`},mi=z(`$ZodCheckLessThan`,(e,t)=>{di.init(e,t);let n=pi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:pi[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hi=z(`$ZodCheckGreaterThan`,(e,t)=>{di.init(e,t);let n=pi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:pi[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gi=z(`$ZodCheckMultipleOf`,(e,t)=>{di.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):qt(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),_i=z(`$ZodCheckNumberFormat`,(e,t)=>{di.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=hn[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),vi=z(`$ZodCheckMaxLength`,(e,t)=>{var n;di.init(e,t),(n=e._zod.def).when??(n.when=fi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Nn(r):i)<=t.maximum)return;let a=Pn(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yi=z(`$ZodCheckMinLength`,(e,t)=>{var n;di.init(e,t),(n=e._zod.def).when??(n.when=fi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Nn(r):i)>=t.minimum)return;let a=Pn(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),bi=z(`$ZodCheckLengthEquals`,(e,t)=>{var n;di.init(e,t),(n=e._zod.def).when??(n.when=fi),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Nn(r):i;if(a===t.length)return;let o=Pn(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),xi=z(`$ZodCheckStringFormat`,(e,t)=>{var n,r;di.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Si=z(`$ZodCheckRegex`,(e,t)=>{xi.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ci=z(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=li,xi.init(e,t)}),wi=z(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ui,xi.init(e,t)}),Ti=z(`$ZodCheckIncludes`,(e,t)=>{di.init(e,t);let n=dn(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ei=z(`$ZodCheckStartsWith`,(e,t)=>{di.init(e,t);let n=RegExp(`^${dn(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Di=z(`$ZodCheckEndsWith`,(e,t)=>{di.init(e,t);let n=RegExp(`.*${dn(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Oi=z(`$ZodCheckOverwrite`,(e,t)=>{di.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),ki=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
3
|
+
`)}\n};`)(...Object.values(this.closed))}},Ai={major:4,minor:6,patch:5},ji=z(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ai;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=En(t),a;for(let o of n){if(o._zod.def.when){if(Dn(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new $n;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(An(t.issues,n,e),i||=En(t,n))});else{if(t.issues.length===n)continue;An(t.issues,n,e),i||=En(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(En(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new $n;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new $n;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return zn(this,`~standard`,Pi(this))},set"~standard"(e){Rn(this,`~standard`,e)}}),Mi=(e,t)=>e.issues.length?{issues:e.issues.map(e=>jn(e,t,nr()))}:{value:e.value};async function Ni(e,t){let n={async:!0};return Mi(await e._zod.run({value:t,issues:[]},n),n)}function Pi(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Mi(r,n)}catch{}return Ni(e,t)},vendor:`zod`,version:1}}var Fi=z(`$ZodString`,(e,t)=>{ji.init(e,t),e._zod.pattern=t.pattern??ai,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Ii=z(`$ZodStringFormat`,(e,t)=>{xi.init(e,t),Fi.init(e,t)}),Li=z(`$ZodGUID`,(e,t)=>{t.pattern??=Br,Ii.init(e,t)}),Ri=z(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Vr(e)}else t.pattern??=Vr();Ii.init(e,t)}),zi=z(`$ZodEmail`,(e,t)=>{t.pattern??=Hr,Ii.init(e,t)});function Bi(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Vi(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Bi(e)||2:Hi(e,t)}function Hi(e,t){if(!t.normalize&&t.protocol?.source===Zr.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Ui=/[\t\n\r]/g;function Wi(e){return e.replace(Ui,``)}function Gi(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ki(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var qi=z(`$ZodURL`,(e,t)=>{Ii.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Vi(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Wi(r);return}t.hostname&&!Gi(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Ki(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Wi(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ji=z(`$ZodEmoji`,(e,t)=>{t.pattern??=Wr(),Ii.init(e,t)}),Yi=z(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Lr:Rr(t.length),Ii.init(e,t)}),Xi=z(`$ZodCUID`,(e,t)=>{t.pattern??=Mr,Ii.init(e,t)}),Zi=z(`$ZodCUID2`,(e,t)=>{t.pattern??=Nr,Ii.init(e,t)}),Qi=z(`$ZodULID`,(e,t)=>{t.pattern??=Pr,Ii.init(e,t)}),$i=z(`$ZodXID`,(e,t)=>{t.pattern??=Fr,Ii.init(e,t)}),ea=z(`$ZodKSUID`,(e,t)=>{t.pattern??=Ir,Ii.init(e,t)}),ta=z(`$ZodISODateTime`,(e,t)=>{t.pattern??=ii(t),Ii.init(e,t)}),na=z(`$ZodISODate`,(e,t)=>{t.pattern??=ti,Ii.init(e,t)}),ra=z(`$ZodISOTime`,(e,t)=>{t.pattern??=ri(t),Ii.init(e,t)}),ia=z(`$ZodISODuration`,(e,t)=>{t.pattern??=zr,Ii.init(e,t)}),aa=z(`$ZodIPv4`,(e,t)=>{t.pattern??=Gr,Ii.init(e,t)}),oa=/^[0-9a-fA-F:.]+$/;function sa(e){return oa.test(e)?Bi(`http://[${e}]`):!1}var ca=z(`$ZodIPv6`,(e,t)=>{t.pattern??=Kr,Ii.init(e,t),e._zod.check=n=>{sa(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),la=z(`$ZodCIDRv4`,(e,t)=>{t.pattern??=qr,Ii.init(e,t)});function ua(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:sa(n)}var da=z(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Jr,Ii.init(e,t),e._zod.check=n=>{ua(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function fa(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var pa=/^[0-9a-zA-Z+/]*={0,2}$/,ma=z(`$ZodBase64`,(e,t)=>{t.pattern??=pa,Ii.init(e,t),e._zod.check=n=>{fa(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),ha=/^[A-Za-z0-9_-]*$/;function ga(e){if(!ha.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return fa(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var _a=z(`$ZodBase64URL`,(e,t)=>{t.pattern??=ha,Ii.init(e,t),e._zod.check=n=>{ga(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),va=z(`$ZodE164`,(e,t)=>{t.pattern??=Qr,Ii.init(e,t)});function ya(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ba=z(`$ZodJWT`,(e,t)=>{Ii.init(e,t),e._zod.check=n=>{ya(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),xa=z(`$ZodNumber`,(e,t)=>{ji.init(e,t),e._zod.pattern=si,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Sa=z(`$ZodNumberFormat`,(e,t)=>{_i.init(e,t),xa.init(e,t)}),Ca=z(`$ZodBoolean`,(e,t)=>{ji.init(e,t),e._zod.pattern=ci,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),wa=z(`$ZodUnknown`,(e,t)=>{ji.init(e,t),e._zod.parse=e=>e}),Ta=z(`$ZodNever`,(e,t)=>{ji.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Ea(e,t,n){e.issues.length&&t.issues.push(...On(n,e.issues)),t.value[n]=e.value}var Da=z(`$ZodArray`,(e,t)=>{ji.init(e,t);let n=tr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Ea(t,r,e)));else if(Ea(c,r,e),s&&c.issues.length!==0&&En(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Oa(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...On(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var ka=[];function Aa(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ka,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=mn(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ja(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(En(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Oa(e,n,i,t,d,f))):Oa(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Ma=z(`$ZodObject`,(e,t)=>{ji.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Wt(()=>Aa(t));R(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Jt(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=on,o=t.catchall,s,c=tr.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(En(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Oa(n,t,e,r,a,o))):Oa(s,t,e,r,a,o)}return o?ja(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Na=z(`$ZodObjectJIT`,(e,t)=>{Ma.init(e,t);let n=e._zod.parse,r=Wt(()=>Aa(t)),i=tr.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new ki([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
4
|
+
let ${e}_ab = false;
|
|
5
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
6
|
+
const iss = ${e}.issues[i];
|
|
7
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
8
|
+
payload.issues.push(iss);
|
|
9
|
+
if (iss.continue !== true) ${e}_ab = true;
|
|
10
|
+
}
|
|
11
|
+
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
12
|
+
payload.value = newResult;
|
|
13
|
+
return payload;
|
|
14
|
+
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:nn(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
15
|
+
const ${n}_present = ${i};
|
|
16
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
17
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (${e}) {
|
|
21
|
+
newResult[${r}] = ${n}.value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
`)}else f?(o.write(`
|
|
26
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
27
|
+
}
|
|
28
|
+
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
|
|
29
|
+
if (${n}.value !== undefined || ${i}) {
|
|
30
|
+
newResult[${r}] = ${n}.value;
|
|
31
|
+
}
|
|
32
|
+
`)):o.write(`
|
|
33
|
+
const ${n}_present = ${i};
|
|
34
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
35
|
+
}
|
|
36
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
37
|
+
payload.issues.push({
|
|
38
|
+
code: "invalid_type",
|
|
39
|
+
expected: "nonoptional",
|
|
40
|
+
input: undefined,
|
|
41
|
+
path: [${r}]
|
|
42
|
+
});
|
|
43
|
+
if (ctx && ctx.abortEarly) {
|
|
44
|
+
payload.value = newResult;
|
|
45
|
+
return payload;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (${n}_present) {
|
|
50
|
+
newResult[${r}] = ${n}.value;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=on,c=!tr.jitless,l=c&&sn.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?ja([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Pa(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=>!En(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=>jn(e,r,nr())))}),t)}var Fa=z(`$ZodUnion`,(e,t)=>{ji.init(e,t),R(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),R(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),R(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),R(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Kt(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=>Pa(t,r,e,i)):Pa(o,r,e,i)}});function Ia(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var La=z(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Fa.init(e,t);let n=e._zod.parse;R(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||Jt(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=Yt(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Wt(()=>Ia(t));e._zod.parse=(i,a)=>{let o=i.value;if(!on(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._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()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Ra=z(`$ZodIntersection`,(e,t)=>{ji.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])=>Ba(e,t,n)):Ba(e,i,a)}});function za(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(cn(e)&&cn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=za(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=za(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 Ba(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=za(t.value,n.value);if(!c.valid){if(En(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Va=z(`$ZodRecord`,(e,t)=>{ji.init(e,t);let n=tr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!cn(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>jn(e,i,nr())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...On(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...On(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&si.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>jn(e,i,nr())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...On(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...On(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Ha=z(`$ZodEnum`,(e,t)=>{ji.init(e,t);let n=Bt(t.entries),r=new Set(n);e._zod.values=r,R(e,`pattern`,e=>{let t=Bt(e.def.entries).filter(e=>un.has(typeof e));return RegExp(t.length?`^(${t.map(e=>dn(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Ua=z(`$ZodLiteral`,(e,t)=>{ji.init(e,t);let n=new Set(t.values);e._zod.values=n,R(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?dn(e):e?dn(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),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}}),Wa=z(`$ZodTransform`,(e,t)=>{ji.init(e,t),e._zod.optin=`optional`,tr.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new er(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new $n;return n.value=i,n}});function Ga(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ka=z(`$ZodOptional`,(e,t)=>{ji.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,R(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),R(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Kt(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Ga(e,t)):Ga(e,r)}return t.innerType._zod.run(e,n)}}),qa=z(`$ZodExactOptional`,(e,t)=>{Ka.init(e,t),R(e,`values`,e=>e.def.innerType._zod.values),R(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ja=z(`$ZodNullable`,(e,t)=>{ji.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin),R(e,`optout`,e=>e.def.innerType._zod.optout),R(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Kt(t.source)}|null)$`):void 0}),R(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ya=z(`$ZodDefault`,(e,t)=>{ji.init(e,t),e._zod.optin=`defaulted`,R(e,`values`,e=>e.def.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=>Xa(e,t)):Xa(r,t)}});function Xa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Za=z(`$ZodPrefault`,(e,t)=>{ji.init(e,t),e._zod.optin=`defaulted`,R(e,`values`,e=>e.def.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))}),Qa=z(`$ZodNonOptional`,(e,t)=>{ji.init(e,t),R(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].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=>$a(t,e)):$a(i,e)}});function $a(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function eo(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>jn(e,r,nr()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var to=z(`$ZodCatch`,(e,t)=>{ji.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),R(e,`optout`,e=>e.def.innerType._zod.optout),R(e,`values`,e=>e.def.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({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>eo(e,r,t,n)):eo(e,r,t,n)}}),no=z(`$ZodPipe`,(e,t)=>{ji.init(e,t),R(e,`values`,e=>e.def.in._zod.values),R(e,`optin`,e=>e.def.in._zod.optin),R(e,`optout`,e=>e.def.out._zod.optout),R(e,`propValues`,e=>e.def.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=>ro(e,t.in,n)):ro(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ro(e,t.out,n)):ro(r,t.out,n)}});function ro(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var io=z(`$ZodReadonly`,(e,t)=>{ji.init(e,t),R(e,`propValues`,e=>e.def.innerType._zod.propValues),R(e,`values`,e=>e.def.innerType._zod.values),R(e,`optin`,e=>e.def.innerType?._zod?.optin),R(e,`optout`,e=>e.def.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(ao):ao(r)}});function ao(e){return e.memo||(e.value=Object.freeze(e.value)),e}var oo=z(`$ZodCustom`,(e,t)=>{di.init(e,t),ji.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=>so(t,n,r,e));so(i,n,r,e)}});function so(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(In(e))}}var co=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},lo=`~memo`,uo=[];function fo(e){return typeof e==`object`&&!!e}function po(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var mo=new WeakMap,ho=0,go=1,_o=2;function vo(e,t,n){let r=mo.get(e);if(r!==void 0)return r?_o:ho;if(t.has(e))return _o;t.add(e);let i=ho,a=e=>{if(i!==_o&&e?._zod){let r=vo(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=ho;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?go:o.value?._zod?vo(o.value,t,n):ho;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Yt(c);s(e?o(e,!0):go),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?vo(r,t,!1):go);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),yo(e,i)}function yo(e,t){return t!==go&&mo.set(e,t===_o),t}function bo(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var xo,So=[],Co={alloc(e,t,n){let r=xo;if(!r)return n;xo=void 0;let i={value:n,issues:null};return r.set(t.value,i),So.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&To(n,e.value))throw new co;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=vo(e,new Set,!1);if(i===ho)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===_o||r?n=!0:r=!0}let l=s.value;if(!fo(l))return t(s,c);let u=c[lo];u||(u={buckets:new WeakMap,backEdges:void 0},c[lo]=u);let d;i===c?d=a:(d=bo(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...po(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;xo=d;let p=So.length,m=t(s,c);xo=void 0;let h=So.length>p?So.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?po(e.issues):uo),e)):(h&&(h.issues=m.issues.length?po(m.issues):uo),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function wo(){return Co}function To(e,t){let n=e[lo]?.backEdges;return n!==void 0&&fo(t)&&n.has(t)}var Eo=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Fn(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${pn(e.values[0])}`:`Invalid option: expected one of ${Vt(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Vt(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Do(){return{localeError:Eo()}}var Oo,ko=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 Ao(){return new ko}(Oo=globalThis).__zod_globalRegistry??(Oo.__zod_globalRegistry=Ao());var jo=globalThis.__zod_globalRegistry;function Mo(e){return e.checks&&=[...e.checks],e}function No(e,t){return new e(Mo({type:`string`,...L(t)}))}function Po(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...L(t)})}function Fo(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...L(t)})}function Io(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...L(t)})}function Lo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...L(t)})}function Ro(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...L(t)})}function zo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...L(t)})}function Bo(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...L(t)})}function Vo(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...L(t)})}function Ho(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...L(t)})}function Uo(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...L(t)})}function Wo(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...L(t)})}function Go(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...L(t)})}function Ko(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...L(t)})}function qo(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...L(t)})}function Jo(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...L(t)})}function Yo(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...L(t)})}function Xo(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...L(t)})}function Zo(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...L(t)})}function Qo(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...L(t)})}function $o(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...L(t)})}function es(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...L(t)})}function ts(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...L(t)})}function ns(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...L(t)})}function rs(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...L(t)})}function is(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...L(t)})}function as(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...L(t)})}function os(e,t){return new e(Mo({type:`number`,checks:[],...L(t)}))}function ss(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...L(t)})}function cs(e,t){return new e({type:`boolean`,...L(t)})}function ls(e){return new e({type:`unknown`})}function us(e,t){return new e({type:`never`,...L(t)})}function ds(e,t){return new mi({check:`less_than`,...L(t),value:e,inclusive:!1})}function fs(e,t){return new mi({check:`less_than`,...L(t),value:e,inclusive:!0})}function ps(e,t){return new hi({check:`greater_than`,...L(t),value:e,inclusive:!1})}function ms(e,t){return new hi({check:`greater_than`,...L(t),value:e,inclusive:!0})}function hs(e,t){return new gi({check:`multiple_of`,...L(t),value:e})}function gs(e,t){return new vi({check:`max_length`,...L(t),maximum:e})}function _s(e,t){return new yi({check:`min_length`,...L(t),minimum:e})}function vs(e,t){return new bi({check:`length_equals`,...L(t),length:e})}function ys(e,t){return new Si({check:`string_format`,format:`regex`,...L(t),pattern:e})}function bs(e){return new Ci({check:`string_format`,format:`lowercase`,...L(e)})}function xs(e){return new wi({check:`string_format`,format:`uppercase`,...L(e)})}function Ss(e,t){return new Ti({check:`string_format`,format:`includes`,...L(t),includes:e})}function Cs(e,t){return new Ei({check:`string_format`,format:`starts_with`,...L(t),prefix:e})}function ws(e,t){return new Di({check:`string_format`,format:`ends_with`,...L(t),suffix:e})}function Ts(e){return new Oi({check:`overwrite`,tx:e})}function Es(e){return Ts(t=>t.normalize(e))}function Ds(){return Ts(e=>e.trim())}function Os(){return Ts(e=>e.toLowerCase())}function ks(){return Ts(e=>e.toUpperCase())}function As(){return Ts(e=>rn(e))}function js(e,t,n){return new e({type:`array`,element:t,...L(n)})}function Ms(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...L(n)})}function Ns(e,t){let n=Ps(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(In(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(In(r))}},e(t.value,t)),t);return n}function Ps(e,t){let n=new di({check:`custom`,...L(t)});return n._zod.check=e,n}function Fs(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Jt(e,t,n[t]);return e}function Is(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??jo,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ls(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function Rs(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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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,Rs(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Fs(o.schema,c),t.io===`input`&&Js(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 zs(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Bs(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;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}/${zs(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+zs(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>
|
|
54
|
+
|
|
55
|
+
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}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Vs(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Vs(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Hs=new Set([`type`,`properties`,`required`,`additionalProperties`]),Us=[`oneOf`,`anyOf`];function Ws(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Gs(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Hs.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ws(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Jt(n,r,e.length===1?e[0]:Gs(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ws(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Ks(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Hs)if(t in e)return;let n=t.filter(e=>Us.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Gs(t);else{let e=n[0],i=Us.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Gs([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Fs(e,r))}function qs(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)):Fs(i,s),Fs(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??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Vs(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Ks(e)}}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)}Fs(i,n.defId?n.schema: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??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Jt(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),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:Xs(t,`input`,e.processors),output:Xs(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Js(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 Js(r.element,n);if(r.type===`set`)return Js(r.valueType,n);if(r.type===`lazy`)return Js(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`||r.type===`catch`)return Js(r.innerType,n);if(r.type===`intersection`)return Js(r.left,n)||Js(r.right,n);if(r.type===`record`||r.type===`map`)return Js(r.keyType,n)||Js(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Js(r.in,n)||Js(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Js(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Js(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Js(e,n))return!0;return!!(r.rest&&Js(r.rest,n))}return!1}var Ys=(e,t={})=>n=>{let r=Is({...n,processors:t});return Rs(e,r),Bs(r,e),qs(r,e)},Xs=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Is({...i??{},target:a,io:t,processors:n});return Rs(e,o),Bs(o,e),qs(o,e)},Zs=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Qs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},$s=(e,t)=>{Zs(e,`minimum`,t),Qs(e,`maximum`,t)},ec=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},tc=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},nc=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},rc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},ic=(e,t)=>Zs(e,`minimum`,t.minimum),ac=(e,t)=>Qs(e,`maximum`,t.maximum),oc=e=>(t,n)=>{rc(t,n.format);let[r,i]=e[n.format];Zs(t,`minimum`,r),Qs(t,`maximum`,i)},sc={greater_than:(e,t)=>Zs(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Qs(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>ec(e,t.value),number_format:oc(hn),bigint_format:oc(gn),min_length:ic,max_length:ac,length_equals:(e,t)=>$s(e,t.length),min_size:ic,max_size:ac,size_equals:(e,t)=>$s(e,t.size),string_format:(e,t)=>{rc(e,t.format),t.pattern&&tc(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>nc(e,t.mime)};function cc(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)sc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Zs(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Zs(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Qs(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Qs(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&ec(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&nc(t,i.mime);for(let e of i.patterns??[])tc(t,e);return t}var lc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},uc=new Map([[pa,Yr],[ha,Xr]]),dc=e=>uc.get(e)??e,fc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=cc(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=lc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(dc);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}))])}},pc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=cc(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ls(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},mc=(e,t,n,r)=>{n.type=`boolean`},hc=(e,t,n,r)=>{n.not={}},gc=(e,t,n,r)=>{let i=e._zod.def,a=Bt(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},_c=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ls(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ls(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);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}},vc=(e,t,n,r)=>{Ls(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},yc=(e,t,n,r)=>{Ls(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},bc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=cc(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Rs(a.element,t,{...r,path:[...r.path,`items`]})};function xc(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?xc(t.out):t.type===`catch`?xc(t.innerType):e._zod.optin}var Sc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ls(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Jt(i.properties,e,Rs(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?xc(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Rs(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Cc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Rs(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},wc=(e,t,n,r)=>{let i=e._zod.def,a=Rs(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Rs(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Tc(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Tc(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Tc(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?si:oi).source),p):p}var Ec=new WeakMap;function Dc(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Ec.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Tc(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Oc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=cc(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Rs(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Jt(i.patternProperties,dc(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=Rs(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ec.get(t);n||(n=[],Ec.set(t,n),t.deferred.push(()=>Dc(t))),n.push(e)}i.additionalProperties=Rs(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&xc(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},kc=(e,t,n,r)=>{let i=e._zod.def,a=Rs(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`}]},Ac=(e,t,n,r)=>{let i=e._zod.def;Rs(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},jc=Symbol();function Mc(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ls(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),jc):JSON.parse(o)}var Nc=(e,t,n,r)=>{let i=e._zod.def;Rs(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Mc(i.defaultValue,e,t,n,r);o!==jc&&(n.default=o)},Pc=(e,t,n,r)=>{let i=e._zod.def;Rs(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Mc(i.defaultValue,e,t,n,r);o!==jc&&(n._prefault=o)},Fc=(e,t,n,r)=>{let i=e._zod.def;Rs(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ls(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ic=(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;Rs(o,t,r);let s=t.seen.get(e);s.ref=o},Lc=(e,t,n,r)=>{let i=e._zod.def;Rs(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Rc=(e,t,n,r)=>{let i=e._zod.def;Rs(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},zc=new WeakSet([Object.prototype,Error.prototype]);function Bc(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Vc=z(`ZodError`,(e,t)=>{lr.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);zc.has(n)||(zc.add(n),Bc(n,`format`,e=>t=>fr(e,t)),Bc(n,`flatten`,e=>t=>dr(e,t)),Bc(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ht,2)}),Bc(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ht,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Hc=mr(Vc),Uc=hr(Vc),Wc=gr(Vc),Gc=vr(Vc),Kc=wr(Vc),qc=Tr(Vc),Jc=Er(Vc),Yc=Dr(Vc),Xc=Or(Vc),Zc=kr(Vc),Qc=Ar(Vc),$c=jr(Vc);function el(){tr.localeError||nr(Do())}function tl(){tr.memoizer||nr({memoizer:wo()})}var nl=z(`ZodType`,(e,t)=>(el(),ji.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(tn(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 fn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(bu(e,t))},superRefine(e,t){return this.check(xu(e,t))},overwrite(e){return this.check(Ts(e))},optional(){return nu(this)},exactOptional(){return iu(this)},nullable(){return ou(this)},nullish(){return nu(ou(this))},nonoptional(e){return fu(this,e)},array(){return H(this)},or(e){return Hl([this,e])},and(e){return Kl(this,e)},transform(e){return gu(this,eu(e))},default(e){return cu(this,e)},prefault(e){return uu(this,e)},catch(e){return mu(this,e)},pipe(e){return gu(this,e)},readonly(){return vu(this)},describe(e){let t=this.clone();return jo.add(t,{description:e}),t},meta(...e){if(e.length===0)return jo.get(this);let t=this.clone();return jo.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return zn(this,`~standard`,{...Pi(this),jsonSchema:{input:Xs(this,`input`),output:Xs(this,`output`)}})},set"~standard"(e){Rn(this,`~standard`,e)},parse:function e(t,n){return Hc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Uc(this,t,n,{callee:e})},safeParse(e,t){return Wc(this,e,t)},async safeParseAsync(e,t){return Gc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Rn(this,`spa`,e)},validate(e,t){return xr(this,e,t)},validateAsync(e,t){return Cr(this,e,t)},encode:function e(t,n){return Kc(this,t,n,{callee:e})},decode:function e(t,n){return qc(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Jc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Yc(this,t,n,{callee:e})},safeEncode(e,t){return Xc(this,e,t)},safeDecode(e,t){return Zc(this,e,t)},async safeEncodeAsync(e,t){return Qc(this,e,t)},async safeDecodeAsync(e,t){return $c(this,e,t)},toJSONSchema(e){return Ys(this,{})(e)},get description(){return jo.get(this)?.description},get _def(){return this._zod.def}}),rl=z(`_ZodString`,(e,t)=>{Fi.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fc(e,t,n,r)},Bn({format:e=>cc(e).format??null,minLength:e=>cc(e).minimum??null,maxLength:e=>cc(e).maximum??null},{regex(...e){return this.check(ys(...e))},includes(...e){return this.check(Ss(...e))},startsWith(...e){return this.check(Cs(...e))},endsWith(...e){return this.check(ws(...e))},min(...e){return this.check(_s(...e))},max(...e){return this.check(gs(...e))},length(...e){return this.check(vs(...e))},nonempty(...e){return this.check(_s(1,...e))},lowercase(e){return this.check(bs(e))},uppercase(e){return this.check(xs(e))},trim(){return this.check(Ds())},normalize(...e){return this.check(Es(...e))},toLowerCase(){return this.check(Os())},toUpperCase(){return this.check(ks())},slugify(){return this.check(As())}})),il=z(`ZodString`,(e,t)=>{Fi.init(e,t),rl.init(e,t)},{email(e){return this.check(Po(ul,e))},url(e){return this.check(Bo(ml,e))},jwt(e){return this.check(ts(kl,e))},emoji(e){return this.check(Vo(hl,e))},guid(e){return this.check(Fo(dl,e))},uuid(e){return this.check(Io(fl,e))},uuidv4(e){return this.check(Lo(fl,e))},uuidv6(e){return this.check(Ro(fl,e))},uuidv7(e){return this.check(zo(fl,e))},nanoid(e){return this.check(Ho(gl,e))},cuid(e){return this.check(Uo(_l,e))},cuid2(e){return this.check(Wo(vl,e))},ulid(e){return this.check(Go(yl,e))},base64(e){return this.check(Qo(El,e))},base64url(e){return this.check($o(Dl,e))},xid(e){return this.check(Ko(bl,e))},ksuid(e){return this.check(qo(xl,e))},ipv4(e){return this.check(Jo(Sl,e))},ipv6(e){return this.check(Yo(Cl,e))},cidrv4(e){return this.check(Xo(wl,e))},cidrv6(e){return this.check(Zo(Tl,e))},e164(e){return this.check(es(Ol,e))},datetime(e){return this.check(ns(ol,e))},date(e){return this.check(rs(sl,e))},time(e){return this.check(is(cl,e))},duration(e){return this.check(as(ll,e))}});function B(e){return No(il,e)}var al=z(`ZodStringFormat`,(e,t)=>{Ii.init(e,t),rl.init(e,t)}),ol=z(`ZodISODateTime`,(e,t)=>{ta.init(e,t),al.init(e,t)}),sl=z(`ZodISODate`,(e,t)=>{na.init(e,t),al.init(e,t)}),cl=z(`ZodISOTime`,(e,t)=>{ra.init(e,t),al.init(e,t)}),ll=z(`ZodISODuration`,(e,t)=>{ia.init(e,t),al.init(e,t)}),ul=z(`ZodEmail`,(e,t)=>{zi.init(e,t),al.init(e,t)}),dl=z(`ZodGUID`,(e,t)=>{Li.init(e,t),al.init(e,t)}),fl=z(`ZodUUID`,(e,t)=>{Ri.init(e,t),al.init(e,t)});function pl(e){return Io(fl,e)}var ml=z(`ZodURL`,(e,t)=>{qi.init(e,t),al.init(e,t)}),hl=z(`ZodEmoji`,(e,t)=>{Ji.init(e,t),al.init(e,t)}),gl=z(`ZodNanoID`,(e,t)=>{Yi.init(e,t),al.init(e,t)}),_l=z(`ZodCUID`,(e,t)=>{Xi.init(e,t),al.init(e,t)}),vl=z(`ZodCUID2`,(e,t)=>{Zi.init(e,t),al.init(e,t)}),yl=z(`ZodULID`,(e,t)=>{Qi.init(e,t),al.init(e,t)}),bl=z(`ZodXID`,(e,t)=>{$i.init(e,t),al.init(e,t)}),xl=z(`ZodKSUID`,(e,t)=>{ea.init(e,t),al.init(e,t)}),Sl=z(`ZodIPv4`,(e,t)=>{aa.init(e,t),al.init(e,t)}),Cl=z(`ZodIPv6`,(e,t)=>{ca.init(e,t),al.init(e,t)}),wl=z(`ZodCIDRv4`,(e,t)=>{la.init(e,t),al.init(e,t)}),Tl=z(`ZodCIDRv6`,(e,t)=>{da.init(e,t),al.init(e,t)}),El=z(`ZodBase64`,(e,t)=>{ma.init(e,t),al.init(e,t)}),Dl=z(`ZodBase64URL`,(e,t)=>{_a.init(e,t),al.init(e,t)}),Ol=z(`ZodE164`,(e,t)=>{va.init(e,t),al.init(e,t)}),kl=z(`ZodJWT`,(e,t)=>{ba.init(e,t),al.init(e,t)}),Al=z(`ZodNumber`,(e,t)=>{xa.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pc(e,t,n,r),e.isFinite=!0},Bn({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=cc(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=cc(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=cc(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>cc(e).format??null},{gt(e,t){return this.check(ps(e,t))},gte(e,t){return this.check(ms(e,t))},min(e,t){return this.check(ms(e,t))},lt(e,t){return this.check(ds(e,t))},lte(e,t){return this.check(fs(e,t))},max(e,t){return this.check(fs(e,t))},int(e){return this.check(Ml(e))},safe(e){return this.check(Ml(e))},positive(e){return this.check(ps(0,e))},nonnegative(e){return this.check(ms(0,e))},negative(e){return this.check(ds(0,e))},nonpositive(e){return this.check(fs(0,e))},multipleOf(e,t){return this.check(hs(e,t))},step(e,t){return this.check(hs(e,t))},finite(){return this}}));function V(e){return os(Al,e)}var jl=z(`ZodNumberFormat`,(e,t)=>{Sa.init(e,t),Al.init(e,t)});function Ml(e){return ss(jl,e)}var Nl=z(`ZodBoolean`,(e,t)=>{Ca.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mc(e,t,n,r)});function Pl(e){return cs(Nl,e)}var Fl=z(`ZodUnknown`,(e,t)=>{wa.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Il(){return ls(Fl)}var Ll=z(`ZodNever`,(e,t)=>{Ta.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hc(e,t,n,r)});function Rl(e){return us(Ll,e)}var zl=z(`ZodArray`,(e,t)=>{tl(),Da.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(_s(e,t))},nonempty(e){return this.check(_s(1,e))},max(e,t){return this.check(gs(e,t))},length(e,t){return this.check(vs(e,t))},unwrap(){return this.element}});function H(e,t){return js(zl,e,t)}var Bl=z(`ZodObject`,(e,t)=>{tl(),Na.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sc(e,t,n,r),Kn(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Xl(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(tn(this._zod.def,{catchall:e}))},passthrough(){return this.clone(tn(this._zod.def,{catchall:Il()}))},loose(){return this.clone(tn(this._zod.def,{catchall:Il()}))},strict(){return this.clone(tn(this._zod.def,{catchall:Rl()}))},strip(){return this.clone(tn(this._zod.def,{catchall:void 0}))},extend(e){return bn(this,e)},safeExtend(e){return Sn(this,e)},merge(e){return Cn(this,e)},pick(e){return _n(this,e)},omit(e){return yn(this,e)},partial(...e){return wn(tu,this,e[0])},exactPartial(...e){return wn(ru,this,e[0],`exactPartial`)},required(...e){return Tn(du,this,e[0])}});function U(e,t){return new Bl({type:`object`,shape:e,catchall:Rl(),...L(t)})}var Vl=z(`ZodUnion`,(e,t)=>{Fa.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cc(e,t,n,r),e.options=t.options});function Hl(e,t){return new Vl({type:`union`,options:e,...L(t)})}var Ul=z(`ZodDiscriminatedUnion`,(e,t)=>{Vl.init(e,t),La.init(e,t)});function Wl(e,t,n){return new Ul({type:`union`,options:t,discriminator:e,...L(n)})}var Gl=z(`ZodIntersection`,(e,t)=>{Ra.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wc(e,t,n,r)});function Kl(e,t){return new Gl({type:`intersection`,left:e,right:t})}var ql=z(`ZodRecord`,(e,t)=>{tl(),Va.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Jl(e,t,n){return!t||!t._zod?new ql({type:`record`,keyType:B(),valueType:e,...L(t)}):new ql({type:`record`,keyType:e,valueType:t,...L(n)})}var Yl=z(`ZodEnum`,(e,t)=>{Ha.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];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 Yl({...t,checks:[],...L(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 Yl({...t,checks:[],...L(r),entries:i})}});function Xl(e,t){return new Yl({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}var Zl=z(`ZodLiteral`,(e,t)=>{Ua.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_c(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 Ql(e,t){return new Zl({type:`literal`,values:Array.isArray(e)?e:[e],...L(t)})}var $l=z(`ZodTransform`,(e,t)=>{tl(),Wa.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new er(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(In(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(In(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function eu(e){return new $l({type:`transform`,transform:e})}var tu=z(`ZodOptional`,(e,t)=>{Ka.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nu(e){return new tu({type:`optional`,innerType:e})}var ru=z(`ZodExactOptional`,(e,t)=>{qa.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function iu(e){return new ru({type:`optional`,innerType:e})}var au=z(`ZodNullable`,(e,t)=>{Ja.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ou(e){return new au({type:`nullable`,innerType:e})}var su=z(`ZodDefault`,(e,t)=>{Ya.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cu(e,t){return new su({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ln(t)}})}var lu=z(`ZodPrefault`,(e,t)=>{Za.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uu(e,t){return new lu({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ln(t)}})}var du=z(`ZodNonOptional`,(e,t)=>{Qa.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ac(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fu(e,t){return new du({type:`nonoptional`,innerType:e,...L(t)})}var pu=z(`ZodCatch`,(e,t)=>{to.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function mu(e,t){return new pu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Jn(t)})}var hu=z(`ZodPipe`,(e,t)=>{no.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ic(e,t,n,r),e.in=t.in,e.out=t.out});function gu(e,t){return new hu({type:`pipe`,in:e,out:t})}var _u=z(`ZodReadonly`,(e,t)=>{io.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vu(e){return new _u({type:`readonly`,innerType:e})}var yu=z(`ZodCustom`,(e,t)=>{oo.init(e,t),nl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vc(e,t,n,r)});function bu(e,t={}){return Ms(yu,e,t)}function xu(e,t){return Ns(e,t)}var Su=1024,Cu=1024*Su,wu=1024*Cu,W={openDocuments:2e3,documentBytes:50*Cu,openSourceBytes:128*Cu,metadataStateBytes:32*Cu,blobStoreBytes:1*wu,titleLength:160,keyLength:128,ipcFrameBytes:64*Cu,ipcPreAuthFrameBytes:4*Su,listLimitDefault:100,listLimitMax:500,readMaxBytesDefault:16*Su,readMaxBytesMin:256,readMaxBytesMax:1*Cu,cursorTtlMs:3e5,retainedRevisions:2,revisionGraceMs:3e5,parseTimeoutMs:2e3,printRenderTimeoutMs:1e4,pdfExportTimeoutMs:6e4,watchDebounceMs:200,sseHeartbeatMs:15e3,ssePendingEvents:256,sseStallMs:6e4,assetBytes:20*Cu,documentAssetBytes:100*Cu,documentAssets:500,cssReferenceDepth:8,renderGrants:64,searchLimitDefault:5,searchLimitMax:50,searchQueryCodePoints:512,searchTerms:32,searchExcerptCodePoints:240,searchHitsPerDocument:2,searchIndexWaitMs:2e3,questionnaireBytes:64*Su,answerBytes:64*Su,questionFields:32,answerStringLength:4e3,feedbackWaitDefaultSeconds:120,feedbackWaitMaxSeconds:3600,bridgeInboundFrameBytes:128*Su,bridgeOutboundFrameBytes:256*Su,bridgeMessagesPerSecond:20,renderMissingPerGrant:32},Tu=B().regex(/^doc_[0-9a-f-]{36}$/),Eu=B().regex(/^rev_[0-9a-f]{64}$/),Du=B().regex(/^[0-9a-f]{64}$/),Ou=Xl([`markdown`,`html`,`image`]),ku=Xl([`file`,`stdin`,`generated`]),Au=Xl([`ready`,`missing`,`unreadable`,`updating`,`error`]),ju=Xl([`ready`,`indexing`,`excluded`]),Mu=Xl([`static`,`interactive`]),Nu=Xl([`image`,`svg`,`style`,`font`,`script`,`data`]);U({logicalPath:B().min(1),mime:B().min(1),role:Nu,sha256:Du,byteLength:V().int().nonnegative()});var Pu=Wl(`kind`,[U({id:B(),kind:Ql(`main`)}),U({id:B(),kind:Ql(`linked`),name:B(),branch:B().nullable()})]),Fu=Xl([`invalid-git-file`,`invalid-git-dir`,`link-mismatch`,`unreadable`,`limit-exceeded`,`blocked-path`]),Iu=Wl(`state`,[U({state:Ql(`resolved`),id:B(),nameSegments:H(B()),checkout:Pu.nullable(),pathInCheckout:H(B())}),U({state:Ql(`unresolved`),id:B(),nameSegments:H(B()),pathInCheckout:H(B()),reason:Fu}),U({state:Ql(`pending`)})]).nullable(),Lu=U({documentId:Tu,key:B().nullable(),format:Ou,sourceKind:ku,title:B(),displayPath:B().nullable(),pathSegments:H(B()),canonicalPath:B().nullable(),repository:Iu,revision:Eu.nullable(),sourceState:Au,searchState:ju,openedAt:B(),updatedAt:B(),order:V().int().nonnegative(),pendingRequestIds:H(B()),htmlMode:Mu.nullable(),interactiveAllowed:Pl()});function Ru(e){let t;for(let n of e)(t===void 0||n.openedAt>t.openedAt||n.openedAt===t.openedAt&&n.documentId>t.documentId)&&(t=n);return t}var zu=U({startByte:V().int().nonnegative(),endByteExclusive:V().int().nonnegative(),lineStart:V().int().positive(),lineEnd:V().int().positive()}),Bu=B().min(1).max(W.titleLength),Vu=B().min(1).max(W.keyLength);U({cwd:B().min(1),paths:H(B().min(1)),stdin:U({content:B()}).optional(),format:Xl([`auto`,`markdown`,`html`]).default(`auto`),title:Bu.optional(),key:Vu.optional(),recursive:Pl().default(!1),watch:Pl().default(!1),htmlMode:Mu.optional(),assetsRoot:B().min(1).optional(),assets:H(B().min(1)).max(W.documentAssets).default([])});var Hu=U({watchId:B().regex(/^watch_[0-9a-f-]{36}$/),kind:Xl([`directory`,`glob`]),root:B(),pattern:B().nullable(),recursive:Pl(),suppressedPaths:H(B()),createdAt:B(),assetsRoot:B().nullable()});U({documents:H(Lu),watchRules:H(Hu),created:V().int().nonnegative(),updated:V().int().nonnegative(),unchanged:V().int().nonnegative()}),U({limit:V().int().min(1).max(W.listLimitMax).default(W.listLimitDefault),cursor:B().min(1).optional()}),U({documents:H(Lu),totalDocuments:V().int().nonnegative(),nextCursor:B().nullable()}),U({documentId:Tu,revision:Eu.optional(),lines:U({start:V().int().positive(),end:V().int().positive()}).optional(),maxBytes:V().int().min(W.readMaxBytesMin).max(W.readMaxBytesMax).default(W.readMaxBytesDefault),cursor:B().min(1).optional(),outline:Pl().default(!1),section:B().regex(/^sec_\d{4,}$/).optional()});var Uu=U({sectionId:B().regex(/^sec_\d{4,}$/),level:V().int().min(1).max(6),title:B(),headingPath:H(B()),anchor:B()});U({documentId:Tu,revision:Eu,mode:Xl([`source`,`section`,`outline`]),content:B().optional(),outline:H(Uu).optional(),sectionId:B().optional(),sourceRange:zu.nullable(),extraction:Xl([`source`,`markdown`,`static-html`]),truncated:Pl(),nextCursor:B().nullable()}),U({cwd:B().min(1),targets:H(B().min(1)),all:Pl().default(!1)}),U({closed:H(Tu),alreadyClosed:H(Tu)});var Wu=Wl(`state`,[U({state:Ql(`disabled`)}),U({state:Ql(`ready`),uiUrl:B()}),U({state:Ql(`error`),listener:Xl([`ui`,`preview`]).nullable(),port:V().int().nullable(),reason:B()})]);U({state:Xl([`running`,`stopped`]),daemonId:B().nullable(),pid:V().int().nullable(),version:B().nullable(),protocolVersion:V().int().nullable(),startedAt:B().nullable(),stateRoot:B(),openDocuments:V().int().nonnegative().nullable(),catalogVersion:V().int().nonnegative().nullable(),uiUrl:B().nullable(),mobile:Wu.nullable()}),U({order:H(Tu),expectedCatalogVersion:V().int().nonnegative()}),U({documents:H(Lu),changed:H(Tu)}),U({watchRules:H(Hu)}),U({type:Xl([`hello`,`catalog-changed`,`document-changed`,`document-status`,`focus-requested`,`daemon-stopping`,`resync-required`,`feedback-changed`,`render-diagnostics`]),daemonId:B(),sequence:V().int().nonnegative(),catalogVersion:V().int().nonnegative(),documentId:Tu.optional(),revision:Eu.nullable().optional(),requestId:B().optional(),status:Xl([`pending`,`submitted`,`cancelled`]).optional(),draftVersion:V().int().nonnegative().optional(),acknowledged:Pl().optional()}),U({version:B(),daemonId:B(),catalogVersion:V().int().nonnegative(),activeDocumentId:Tu.nullable(),openDocuments:V().int().nonnegative(),previewOrigin:B()}),U({documentId:Tu,revision:Eu.optional(),mode:Mu.default(`static`)});var Gu=U({linkId:B().regex(/^lnk_\d{4,}$/),href:B(),text:B(),kind:Xl([`external`,`document`,`other`])}),Ku=U({code:B(),target:B().nullable(),count:V().int().positive()});U({grant:B(),documentId:Tu,revision:Eu,format:Ou,mode:Mu,documentUrl:B().nullable(),filesBaseUrl:B(),documentLogicalPath:B(),assets:H(U({logicalPath:B(),role:Nu})),links:H(Gu),diagnostics:H(Ku),headingTargets:H(U({sectionId:B().regex(/^sec_\d{4,}$/),anchor:B()})),bridge:U({instanceId:B(),requestId:B()}).nullable()}),U({missing:H(B())}),U({documentId:Tu,mode:Mu,confirmed:Pl().default(!1)}),U({documentId:Tu,revision:Eu,mode:Mu,linkId:B().regex(/^lnk_\d{4,}$/),confirmation:B().min(1).max(64).optional()}),U({status:Xl([`focused`,`opened`]),documentId:Tu});var qu=Xl([`text`,`exact`,`path`]);U({query:B().min(1),mode:qu.default(`text`),limit:V().int().min(1).max(W.searchLimitMax).default(W.searchLimitDefault),documents:H(Tu).max(W.openDocuments).default([]),maxBytes:V().int().min(W.readMaxBytesMin).max(W.readMaxBytesMax).default(W.readMaxBytesDefault),cursor:B().min(1).optional()});var Ju=U({documentId:Tu,revision:Eu,title:B(),displayPath:B().nullable(),sectionId:B(),headingPath:H(B()),excerpt:B(),matchKind:Xl([`path-exact`,`phrase`,`text`,`prefix`,`fuzzy`]),score:V(),sourceRange:zu.nullable(),extraction:Xl([`markdown`,`static-html`,`image`])});U({query:B(),mode:qu,catalogVersion:V().int().nonnegative(),registeredDocuments:V().int().nonnegative(),searchedDocuments:V().int().nonnegative(),indexedAt:B(),incomplete:Pl(),failedDocuments:H(U({documentId:Tu,code:B()})),indexingDocuments:H(Tu),hits:H(Ju),truncated:Pl(),nextCursor:B().nullable()});var Yu=Jl(B(),Il()),Xu=U({code:B().min(1),message:B(),details:Yu.optional()}),Zu=U({code:B().min(1),message:B(),retryable:Pl(),details:Yu}),Qu=U({command:B().min(1),catalogVersion:V().int().nonnegative().optional()});Wl(`ok`,[U({schemaVersion:Ql(1),ok:Ql(!0),data:Il(),warnings:H(Xu),meta:Qu}),U({schemaVersion:Ql(1),ok:Ql(!1),error:Zu,warnings:H(Xu)})]);var G={success:0,usage:2,notFound:3,conflict:4,forbidden:5,timeout:6,limit:7,daemon:8,internal:9,interrupted:130};G.usage,G.usage,G.usage,G.usage,G.usage,G.usage,G.usage,G.notFound,G.notFound,G.notFound,G.notFound,G.notFound,G.notFound,G.notFound,G.notFound,G.notFound,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.conflict,G.forbidden,G.forbidden,G.forbidden,G.forbidden,G.forbidden,G.limit,G.limit,G.timeout,G.interrupted,G.daemon,G.daemon,G.daemon,G.daemon,G.daemon,G.daemon,G.daemon,G.internal,G.internal,G.internal,G.internal,G.internal,G.internal,G.internal,G.internal;var $u=B().regex(/^req_[0-9a-f-]{36}$/),ed=B().regex(/^sub_[0-9a-f-]{36}$/),td=/^[A-Za-z][A-Za-z0-9_]{0,63}$/,nd=new Set([`__proto__`,`constructor`,`prototype`,...Object.getOwnPropertyNames(Object.prototype)]),rd=B().regex(td).refine(e=>!nd.has(e),{message:`This field name cannot be used.`}),id=B().min(1).max(160),ad=B().max(2e3),od=H(B().max(160)).min(1).max(32).refine(e=>new Set(e).size===e.length,{message:`The choices contain duplicates.`}),sd=V().int().min(0).max(W.answerStringLength),cd=V().refine(Number.isFinite,{message:`The number must be finite.`}),ld=Wl(`type`,[U({type:Ql(`string`),title:id,description:ad.optional(),minLength:sd.optional(),maxLength:sd.optional(),enum:od.optional()}),U({type:Ql(`boolean`),title:id,description:ad.optional()}),U({type:Xl([`number`,`integer`]),title:id,description:ad.optional(),minimum:cd.optional(),maximum:cd.optional()}),U({type:Ql(`array`),title:id,description:ad.optional(),minItems:V().int().min(0).max(32).optional(),maxItems:V().int().min(0).max(32),uniqueItems:Ql(!0),items:U({type:Ql(`string`),enum:od})})]),ud=U({schemaVersion:Ql(1),title:id,instructions:B().max(4e3).optional(),fieldOrder:H(rd).min(1).max(W.questionFields),answerSchema:U({type:Ql(`object`),properties:Jl(rd,ld).refine(e=>{let t=Object.keys(e).length;return t>=1&&t<=W.questionFields},{message:`There must be 1 to ${String(W.questionFields)} fields.`}),required:H(rd).max(W.questionFields),additionalProperties:Ql(!1)})}).superRefine((e,t)=>{let n=Object.keys(e.answerSchema.properties),r=e.fieldOrder;new Set(r).size!==r.length&&t.addIssue({code:`custom`,path:[`fieldOrder`],message:`There are duplicates.`}),(r.length!==n.length||!n.every(e=>r.includes(e)))&&t.addIssue({code:`custom`,path:[`fieldOrder`],message:`The fields in fieldOrder and properties do not match.`});let{required:i}=e.answerSchema;new Set(i).size!==i.length&&t.addIssue({code:`custom`,path:[`answerSchema`,`required`],message:`There are duplicates.`});for(let e of i)n.includes(e)||t.addIssue({code:`custom`,path:[`answerSchema`,`required`],message:`The field ${e} does not exist.`});for(let[n,r]of Object.entries(e.answerSchema.properties)){let e=[`answerSchema`,`properties`,n];(r.type===`string`&&r.minLength!==void 0&&r.maxLength!==void 0&&r.minLength>r.maxLength||(r.type===`number`||r.type===`integer`)&&r.minimum!==void 0&&r.maximum!==void 0&&r.minimum>r.maximum||r.type===`array`&&r.minItems!==void 0&&r.minItems>r.maxItems)&&t.addIssue({code:`custom`,path:e,message:`The lower bound is greater than the upper bound.`}),r.type===`array`&&r.minItems!==void 0&&r.minItems>r.items.enum.length&&t.addIssue({code:`custom`,path:e,message:`minItems is greater than the number of choices.`})}}),dd=Jl(rd,Hl([B(),Pl(),V(),H(B())]));function fd(e){let t=0;for(let n of e)t+=1;return t}function pd(e){let t=0;for(let n of e){let e=n.codePointAt(0);t+=e<128?1:e<2048?2:e<65536?3:4}return t}function md(e){return pd(Lt(e))}function hd(e,t,n){if(typeof t!=`object`||!t||Array.isArray(t))return[{field:``,code:`not-object`}];let r;try{r=md(t)}catch{return[{field:``,code:`type`}]}if(r>W.answerBytes)return[{field:``,code:`too-large`}];let i=[],{properties:a,required:o}=e.answerSchema;for(let e of Object.keys(t))Object.hasOwn(a,e)||i.push({field:e,code:`unknown-field`});for(let[e,r]of Object.entries(a)){if(!Object.hasOwn(t,e)){n.complete&&o.includes(e)&&i.push({field:e,code:`required`});continue}let a=t[e],s=t=>i.push({field:e,code:t});switch(r.type){case`string`:{if(typeof a!=`string`){s(`type`);break}r.enum!==void 0&&!r.enum.includes(a)&&s(`enum`);let e=fd(a);e>(r.maxLength??W.answerStringLength)?s(`too-long`):n.complete&&r.minLength!==void 0&&e<r.minLength&&s(`too-short`);break}case`boolean`:typeof a!=`boolean`&&s(`type`);break;case`number`:case`integer`:if(typeof a!=`number`||!Number.isFinite(a)||r.type===`integer`&&!Number.isInteger(a)){s(`type`);break}(r.minimum!==void 0&&a<r.minimum||r.maximum!==void 0&&a>r.maximum)&&s(`out-of-range`);break;case`array`:if(!Array.isArray(a)||!a.every(e=>typeof e==`string`)){s(`type`);break}a.every(e=>r.items.enum.includes(e))||s(`enum`),new Set(a).size!==a.length&&s(`duplicate`),a.length>r.maxItems?s(`too-many`):n.complete&&r.minItems!==void 0&&a.length<r.minItems&&s(`too-few`)}}return i}var gd=Xl([`pending`,`submitted`,`cancelled`]),_d=Xl([`document_closed`,`agent_cancelled`,`user_cancelled`]),vd=U({submissionId:ed,answers:dd,submittedAt:B(),revision:Eu,confirmedAgainstOlderRevision:Pl(),currentRevisionAtSubmit:Eu.nullable()}),yd=U({cancelledAt:B(),reason:_d}),bd=U({requestId:$u,documentId:Tu,revision:Eu,title:B(),status:gd,createdAt:B(),submission:vd.nullable(),cancellation:yd.nullable(),acknowledgedAt:B().nullable()});bd.extend({questionnaire:ud,renderMode:Mu,draftVersion:V().int().nonnegative(),draftAnswers:dd,currentRevision:Eu.nullable(),documentOpen:Pl()}),U({cwd:B().min(1),questionnaire:B(),documentId:Tu.optional(),revision:Eu.optional(),view:B().min(1).optional(),htmlMode:Mu.optional(),assetsRoot:B().min(1).optional(),assets:H(B().min(1)).max(W.documentAssets).default([]),operationId:pl().optional()}).superRefine((e,t)=>{e.documentId!==void 0&&e.view!==void 0&&t.addIssue({code:`custom`,message:`--document and --view cannot be used together.`}),e.revision!==void 0&&e.documentId===void 0&&t.addIssue({code:`custom`,message:`--revision requires --document.`}),(e.htmlMode!==void 0||e.assetsRoot!==void 0||e.assets.length>0)&&e.view===void 0&&t.addIssue({code:`custom`,message:`--html-mode, --assets-root and --asset apply only to a document newly opened with --view.`})}),U({request:bd,replayed:Pl()}),U({status:gd.optional()}),U({requests:H(bd)}),U({requestId:$u}),U({requestId:$u,timeoutMs:V().int().min(1).max(W.feedbackWaitMaxSeconds*1e3)}),U({requestId:$u,submissionId:ed}),U({requestId:$u,confirmed:Pl()}),U({expectedDraftVersion:V().int().nonnegative(),answers:Il()}),U({submissionId:ed,expectedDraftVersion:V().int().nonnegative(),revision:Eu,currentRevision:Eu.nullable(),confirmOlderRevision:Pl().default(!1)}),U({confirmed:Ql(!0)});var xd=B().regex(/^\d+\.\d+$/),Sd=U({documentId:Tu,title:B(),format:Ou,openedAt:B(),revision:Eu.nullable(),sourceState:Au,effectiveMode:Mu.nullable(),viewEpoch:xd});U({daemonId:B(),catalogVersion:V().int().nonnegative(),documents:H(Sd),nextCursor:B().nullable()}),U({documentId:Tu,revision:Eu,content:B(),nextCursor:B().nullable()}),U({revision:Eu,viewEpoch:xd}),U({grant:B(),documentId:Tu,revision:Eu,viewEpoch:xd,format:Ou,mode:Mu,documentUrl:B().nullable(),filesBaseUrl:B(),documentLogicalPath:B(),assets:H(U({logicalPath:B(),role:Nu})),links:H(Gu),headingTargets:H(U({sectionId:B().regex(/^sec_\d{4,}$/),anchor:B()}))}),B().regex(/^[A-Za-z0-9_-]{43}$/),U({grants:H(B().min(1).max(128)).max(256)}),U({grant:B().min(1).max(128)}),U({grant:B().min(1).max(128),linkId:B().regex(/^lnk_\d{4,}$/)}),Wl(`status`,[U({status:Ql(`open`),documentId:Tu}),U({status:Ql(`not-open`)})]),U({type:Xl([`hello`,`changed`,`resync-required`,`daemon-stopping`]),daemonId:B(),documentId:Tu.optional()});var Cd=/[\\/:*?"<>|\p{Cc}]/gu,wd=200;function Td(e){let t=e.codePointAt(0)??0;return t<128?1:t<2048?2:t<65536?3:4}function Ed(e){let{displayPath:t,title:n}=e,r=n;if(t!==null){let e=t.slice(Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`))+1),n=e.lastIndexOf(`.`);r=n>0?e.slice(0,n):e}let i=``,a=0;for(let e of r.replace(Cd,`_`).trim()){if(a+=Td(e),a>wd)break;i+=e}return i=i.replace(/^[.\s]+|[.\s]+$/g,``),`${i===``?`document`:i}.pdf`}var Dd={name:`chevrons-left-right`,size:24,node:[[`path`,{d:`m9 7-5 5 5 5`,key:`j5w590`}],[`path`,{d:`m15 7 5 5-5 5`,key:`1bl6da`}]]};Dd.node;var Od=Ot(Dd),kd={name:`file-down`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}],[`path`,{d:`m9 15 3 3 3-3`,key:`1npd3o`}]]};kd.node;var Ad=Ot(kd),jd={name:`file-lock`,size:24,node:[[`path`,{d:`M4 9.8V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3`,key:`1432pc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 17v-2a2 2 0 0 0-4 0v2`,key:`168m41`}],[`rect`,{width:`8`,height:`5`,x:`3`,y:`17`,rx:`1`,key:`o8vfew`}]],aliases:[`file-lock-2`]};jd.node;var Md=Ot(jd),Nd={name:`file-x`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]};Nd.node;var Pd=Ot(Nd),Fd={name:`folder-git-2`,size:24,node:[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]};Fd.node;var Id=Ot(Fd),Ld={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Ld.node;var Rd=Ot(Ld),zd={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};zd.node;var Bd=Ot(zd),Vd={name:`list-tree`,size:24,node:[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]};Vd.node;var Hd=Ot(Vd),Ud={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};Ud.node;var Wd=Ot(Ud),Gd={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};Gd.node;var Kd=Ot(Gd),qd={name:`monitor`,size:24,node:[[`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`}]]};qd.node;var Jd=Ot(qd),Yd={name:`moon`,size:24,node:[[`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`}]]};Yd.node;var Xd=Ot(Yd),Zd={name:`palette`,size:24,node:[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]};Zd.node;var Qd=Ot(Zd),$d={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};$d.node;var ef=Ot($d),tf={name:`square-dashed`,size:24,node:[[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M21 14v1`,key:`169vum`}]],aliases:[`box-select`]};tf.node;var nf=Ot(tf),rf={name:`sun`,size:24,node:[[`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`}]]};rf.node;var af=Ot(rf),of={name:`table-of-contents`,size:24,node:[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M16 12H3`,key:`1a2rj7`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M21 5h.01`,key:`wa75ra`}],[`path`,{d:`M21 12h.01`,key:`msek7k`}],[`path`,{d:`M21 19h.01`,key:`qvbq2j`}]]};of.node;var sf=Ot(of);function cf(e,t){let n=I.useRef(e),r=g(t);nt(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function lf({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=I.useState(0),[u,d]=I.useState(0),f=c===0,p=te(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=Be(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||ut(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return Ve(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),nt(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),ce(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var uf=I.createContext(void 0);function df(e){let t=I.useContext(uf);if(!e&&t===void 0)throw Error(O(27));return t}var ff={...Ze,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},pf=class extends c{constructor(e,t,n){let r=new Re,i=mf(e,r,t,n);super(i,hf(r),ff)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(Mt(this.state,e,t.trigger)))}};function mf(e,t,n,r=!1){return{...ot(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function hf(e){return{popupRef:I.createRef(),backdropRef:I.createRef(),internalBackdropRef:I.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}var K=ue();function gf(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:s,disablePointerDismissal:c=!1,modal:l=!0,actionsRef:u,handle:d,triggerId:f,defaultTriggerId:p=null}=t,h=e===`drawer`,g=e===`alert-dialog`,_=g?!0:l,v=g||c,y=g?`alertdialog`:`dialog`,b=df(!0),x={modal:_,disablePointerDismissal:v,nested:b!=null,role:y},S=o((e,t)=>new pf({open:i,openProp:r,activeTriggerId:p,triggerIdProp:f,...x},e,t),!0);S.useControlledProp(`openProp`,r),S.useControlledProp(`triggerIdProp`,f),S.useSyncedValues(x),S.useContextCallback(`onOpenChange`,a),S.useContextCallback(`onOpenChangeComplete`,s);let C=S.useState(`open`),w=S.useState(`mounted`),T=S.useState(`payload`);Et(S,C),we(S);let{forceUnmount:E}=kt(C,S);I.useImperativeHandle(u,()=>({unmount:E,close:()=>S.setOpen(!1,m(ct))}),[E,S]);let D=C||w;return(0,K.jsxs)(uf.Provider,{value:S,children:[d&&(0,K.jsx)(ve,{handle:d,store:S}),D&&(0,K.jsx)(lf,{store:S,parentContext:b?.context,isDrawer:h}),typeof n==`function`?n({payload:T}):n]})}function _f(e){return gf(`alert-dialog`,e)}var vf=I.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=df(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d={open:c,transitionStatus:s.useState(`transitionStatus`)};return Ue(`div`,e,{state:d,ref:[s.context.backdropRef,t],stateAttributesMapping:fe,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),yf=I.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=df(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Je({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,m(S,e.nativeEvent))}return Ue(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),bf=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=df(),c=De(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Ue(`p`,e,{ref:t,props:[{id:c},o]})}),xf=I.createContext(void 0);function Sf(){let e=I.useContext(xf);if(e===void 0)throw Error(O(26));return e}var Cf=`--nested-dialogs`,wf=`data-nested-dialog-open`,Tf={...me,...gt,nestedDialogOpen(e){return e?{[wf]:``}:null}},Ef=I.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=df(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);Sf(),A({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?Ct(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=Ue(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...F,hidden:!m,onKeyDown(e){ie.has(e.key)&&e.stopPropagation()},style:{[Cf]:g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:Tf});return(0,K.jsx)(Ge,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})}),Df=I.forwardRef(function(e,n){let{keepMounted:r=!1,...i}=e,a=df(),o=a.useState(`mounted`),s=a.useState(`modal`),c=a.useState(`open`);return o||r?(0,K.jsx)(xf.Provider,{value:r,children:(0,K.jsxs)(t,{ref:n,...i,children:[o&&s===!0&&(0,K.jsx)(xe,{ref:a.context.internalBackdropRef,inert:mt(!c)}),e.children]})}):null}),Of=I.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=df(),c=De(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Ue(`h2`,e,{ref:t,props:[{id:c},o]})});function kf({...e}){return(0,K.jsx)(_f,{"data-slot":`alert-dialog`,...e})}function Af({...e}){return(0,K.jsx)(Df,{"data-slot":`alert-dialog-portal`,...e})}function jf({className:e,...t}){return(0,K.jsx)(vf,{"data-slot":`alert-dialog-overlay`,className:p(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Mf({className:e,size:t=`default`,...n}){return(0,K.jsxs)(Af,{children:[(0,K.jsx)(jf,{}),(0,K.jsx)(Ef,{"data-slot":`alert-dialog-content`,"data-size":t,className:p(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function Nf({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:p(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Pf({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:p(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Ff({className:e,...t}){return(0,K.jsx)(Of,{"data-slot":`alert-dialog-title`,className:p(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function If({className:e,...t}){return(0,K.jsx)(bf,{"data-slot":`alert-dialog-description`,className:p(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Lf({className:e,...t}){return(0,K.jsx)(P,{"data-slot":`alert-dialog-action`,className:p(e),...t})}function Rf({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,K.jsx)(yf,{"data-slot":`alert-dialog-cancel`,className:p(e),render:(0,K.jsx)(P,{variant:t,size:n}),...r})}function zf({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=I.useRef(e!==void 0),[a,o]=I.useState(t);return[i&&e!==void 0?e:a,I.useCallback(e=>{i||o(e)},[])]}function Bf(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}var Vf=`data-valid`,Hf=`data-invalid`,Uf={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Wf={disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Gf={valid(e){return e===null?null:e?{[Vf]:``}:{[Hf]:``}}},Kf=`data-checked`,qf=`data-unchecked`;function Jf(e){return{checked(t){return e.indeterminate?{}:t?{[Kf]:``}:{[qf]:``}},...Gf}}var Yf={invalid:void 0,name:void 0,validityData:{state:Uf,errors:[],error:``,value:``,initialValue:null},setValidityData:yt,disabled:void 0,setTouched:yt,setDirty:yt,setFilled:yt,setFocused:yt,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:Wf,registerFieldControl:yt,validation:{getValidationProps:(e,t=qe)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:yt,getInputControl:()=>null,commit:async()=>{},change:yt}},Xf=I.createContext(Yf);function Zf(e=!0){let t=I.useContext(Xf);if(t.setValidityData===yt&&!e)throw Error(O(28));return t}function Qf(e,t,n,r,i=!0,a){let{registerFieldControl:o}=Zf(),s=Ne(()=>Symbol());nt(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),nt(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var $f=I.createContext({disabled:!1});function ep(){return I.useContext($f)}var tp=I.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:yt,validationMode:`onSubmit`,submitCountRef:{current:0}});function np(){return I.useContext(tp)}var rp=I.createContext({controlId:void 0,registerControlId:yt,resetControlId:yt,labelId:void 0,setLabelId:yt,messageIds:[],setMessageIds:yt,getDescriptionProps:e=>e});function ip(){return I.useContext(rp)}function ap(e,t,n,r=!0,i){let[a,o]=I.useState(),s=De(i?`${i}-label`:void 0),c=e??t??a;return nt(()=>{let i=e||t||!r?void 0:op(n.current,s);a!==i&&o(i)}),c}function op(e,t){let n=sp(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function sp(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function cp(e={}){let{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:i,resetControlId:a}=ip(),o=De(),s=Ne(()=>Symbol()),c=I.useRef(!1),l=I.useRef(!1),u=g(()=>{c.current&&i!==yt&&(c.current=!1,i(s.current,void 0))});return nt(()=>{if(!n||i===yt){u();return}let e;if(t!==void 0)l.current=!0,e=t;else if(l.current)e=o;else{a();return}if(e===void 0){u();return}c.current=!0,i(s.current,e)},[t,n,i,a,o,s,u]),nt(()=>u,[u]),(n?r:void 0)??t??o}var lp=I.createContext(void 0);function up(){return I.useContext(lp)}var dp=I.createContext(void 0);function fp(){let e=I.useContext(dp);if(e===void 0)throw Error(O(14));return e}var pp=`data-parent`,mp=I.forwardRef(function(e,t){let{checked:n,className:i,defaultChecked:a=!1,"aria-labelledby":o,disabled:s=!1,form:c,id:l,indeterminate:u=!1,inputRef:d,name:f,onCheckedChange:p,parent:h=!1,readOnly:g=!1,render:_,required:v=!1,uncheckedValue:y,value:x,nativeButton:S=!1,style:C,...w}=e,{clearErrors:T}=np(),{disabled:D,name:O,setDirty:ee,setFilled:te,setFocused:ne,setTouched:re,state:ie,validationMode:ae,validityData:oe,validation:se}=Zf(),k=ep(),{labelId:ce,registerControlId:A,getDescriptionProps:le}=ip(),M=up(),N=M?.allValues===void 0?void 0:M.parent,P=N!==void 0,ue=D||k.disabled||M?.disabled||s,de=O??f,fe=x??de,pe=De(),me=M?.registerControlId!==A,he=cp({id:l||void 0,enabled:me}),ge=S?he:pe,_e={};P&&(h?_e=N.getParentProps():fe!==void 0&&(_e=N.getChildProps(fe)));let{checked:ve=n,indeterminate:ye=u,onCheckedChange:xe,...Se}=_e,Ce=M?.value,we=I.useRef(null),{getButtonProps:Te,buttonRef:Ee}=Je({disabled:ue,native:S}),Oe=M?.validation??se,[ke,Ae]=zf({controlled:fe!==void 0&&Ce!==void 0&&!h?Ce.includes(fe):ve,default:a,name:`Checkbox`,state:`checked`}),je=P?!!ve:ke,Me=P&&ye||u;Qf(we,pe,ke,void 0,!M&&!ue,f);let Ne=N?.registerChildId,Pe=I.useRef(null),Fe=Oe.registerInput,Ie=M?fe:void 0,F=I.useCallback(e=>Fe(e,{controlRef:we,value:Ie}),[Fe,Ie]),Le=j(d,Pe,h?void 0:F),Re=ap(o,ce,Pe,!S,he);nt(()=>{Pe.current&&(Pe.current.indeterminate=Me),M||te(ke)},[ke,Me,M,te]),cf(ke,()=>{M||(T(de),ee(ke!==oe.initialValue),Oe.change(ke))});let ze=E({checked:ke,disabled:ue,form:c,name:h?void 0:de,id:S?void 0:he,required:v,ref:Le,style:de?r:Pt,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(g){e.preventDefault();return}let t=e.currentTarget.checked,n=m(b,e.nativeEvent);if(p?.(t,n),!n.isCanceled&&(xe?.(t,n),!n.isCanceled&&(Ae(t),fe!==void 0&&M!==void 0&&!h&&!P))){let e=t?[...M.value,fe]:M.value.filter(e=>e!==fe);M.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){we.current?.focus()}},x===void 0?qe:{value:(M?ke&&x:x)||``},le,e=>Oe.getValidationProps(ue,e));I.useEffect(()=>{if(!N||fe===void 0)return;let e=N.disabledStatesRef.current;return e.set(fe,ue),()=>{e.delete(fe)}},[N,ue,fe]);let Be=I.useMemo(()=>({...ie,checked:je,disabled:ue,readOnly:g,required:v,indeterminate:Me}),[ie,je,ue,g,v,Me]),Ve=Jf(Be),He=Ue(`span`,e,{state:Be,ref:[Ee,we,t],props:[{id:ge,role:`checkbox`,"aria-checked":Me?`mixed`:je,"aria-readonly":g||void 0,"aria-required":v||void 0,"aria-labelledby":Re,[pp]:h?``:void 0,onFocus(){ue||ne(!0)},onBlur(){let e=Pe.current;e&&(re(!0),ne(!1),ae===`onBlur`&&Oe.commit(M?Ce:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Pe.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),be(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||Bf(t)?.click()})},onClick(e){if(g||ue)return;e.preventDefault();let t=Pe.current;t&&bt(t,e)}},w,Se,Te,le,e=>Oe.getValidationProps(ue,e)],stateAttributesMapping:Ve}),We=He.props.id;return nt(()=>{if(Ne&&!h&&fe!==void 0&&We!==void 0)return Ne(fe,We)},[Ne,h,fe,We]),(0,K.jsxs)(dp.Provider,{value:Be,children:[He,!ke&&!M&&de&&!h&&y!==void 0&&(0,K.jsx)(`input`,{type:`hidden`,form:c,name:de,value:y,disabled:ue}),(0,K.jsx)(`input`,{...ze,suppressHydrationWarning:!0})]})}),hp=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=fp(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:d,setMounted:f}=u(c),p=I.useRef(null),m={...s,transitionStatus:d};A({batch:!0,enabled:!c,open:c,ref:p,onComplete(){c||f(!1)}});let h={...Jf(s),...gt},g=a||l,_=Ue(`span`,e,{ref:[t,p],state:m,stateAttributesMapping:h,props:o});return g?_:null});function gp({className:e,...t}){return(0,K.jsx)(mp,{"data-slot":`checkbox`,className:p(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,K.jsx)(hp,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,K.jsx)(Ce,{})})})}var _p=I.createContext(void 0);function vp(e=!1){let t=I.useContext(_p);if(!t&&!e)throw Error(O(86));return t}Object.keys(Uf);function yp(e,t){return e.matches(`:disabled`)?!1:!t||e.form===t||e.form===null&&!e.hasAttribute(`form`)}var bp=I.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:h,disabled:_,setTouched:v,setDirty:y,validityData:x,setFocused:S,setFilled:C,validationMode:w,validation:T}=Zf(),{clearErrors:E,elementRef:D,submitCountRef:O}=np(),ee=_||s,te=h??a,ne={...p,disabled:ee},{labelId:re}=ip(),ie=cp({id:i}),[ae]=zf({controlled:o,default:l,name:`FieldControl`,state:`value`}),oe=o!==void 0,se=oe?ae:void 0,k=se==null?void 0:String(se),ce=g(()=>T.inputRef.current?.value);Qf(T.inputRef,ie,k,ce,!ee,a),nt(()=>{let e=k??T.inputRef.current?.value;e!==void 0&&C(e!==``)},[k,T.inputRef,C]),cf(k,()=>{k!==void 0&&(E(te),y(k!==(x.initialValue??``)),T.change(k))});let A=I.useRef(null),le=pt();return nt(()=>{u&&A.current===$e(N(A.current))&&S(!0)},[u,S]),Ue(`input`,e,{ref:[t,A],state:ne,props:[{id:ie,disabled:ee,name:te,ref:T.inputRef,"aria-labelledby":re,autoFocus:u,...oe?{value:se}:{defaultValue:l},onChange(e){let t=e.currentTarget.value,n=m(b,e.nativeEvent);c?.(t,n),!oe&&(y(t!==(x.initialValue??``)),C(t!==``),!e.nativeEvent.defaultPrevented&&!n.isCanceled&&(E(te),T.change(t)))},onFocus(){S(!0)},onBlur(e){if(v(!0),S(!1),w===`onBlur`){let t=e.currentTarget.value;T.commit(t),oe&&queueMicrotask(()=>{let e=T.inputRef.current?.value;e!==void 0&&e!==t&&e!==(x.initialValue??``)&&T.commit(e)})}},onKeyDown(e){if(e.currentTarget.tagName===`INPUT`&&e.key===`Enter`){v(!0);let t=e.currentTarget.value,n=e.currentTarget.form;if(n&&n===D.current&&!e.defaultPrevented){let t=e.currentTarget,n=O.current;le.start(0,()=>{O.current===n&&T.commit(t.value)})}else T.commit(t)}}},f,e=>T.getValidationProps(ee,e)],stateAttributesMapping:Gf})}),xp=I.forwardRef(function(e,t){return(0,K.jsx)(bp,{ref:t,...e})});function Sp({className:e,type:t,...n}){return(0,K.jsx)(xp,{type:t,"data-slot":`input`,className:p(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function Cp({className:e,...t}){return(0,K.jsx)(`label`,{"data-slot":`label`,className:p(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var wp=`data-checked`,Tp=`data-unchecked`,Ep={checked(e){return e?{[wp]:``}:{[Tp]:``}},...gt,...Gf},Dp=`data-composite-item-active`,Op=I.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function kp(){return I.useContext(Op)}function Ap(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=kp(),u=I.useRef(-1),[d,f]=I.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=I.useRef(null),h=I.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return nt(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}function jp(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Pe(),{ref:i,index:a}=Ap(e),o=n===a,s=I.useRef(null),c=j(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function Mp(e){let{render:t,className:n,style:r,state:i=qe,props:a=Ee,refs:o=Ee,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=jp({metadata:s});return Ue(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}var Np=I.createContext(void 0);function Pp(){return I.useContext(Np)}function Fp(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Ip=I.createContext(void 0);function Lp(){let e=I.useContext(Ip);if(e===void 0)throw Error(O(52));return e}var Rp=I.forwardRef(function(e,t){let{render:n,className:i,disabled:a=!1,readOnly:o=!1,required:s=!1,"aria-labelledby":c,value:l,inputRef:u,nativeButton:d=!1,id:f,style:p,...h}=e,g=Pp(),{disabled:_,readOnly:v,required:y,form:x,checkedValue:S,touched:C=!1,validation:w,name:T,setCheckedValue:E=yt,setTouched:D=yt,registerInputRef:O=yt}=g??{},{setTouched:ee,setFilled:te,state:ne,disabled:re}=Zf(),ie=ep(),{labelId:ae,getDescriptionProps:oe}=ip(),se=re||ie.disabled||_||a,k=v||o,ce=y||s,A=x,le=g?S===l:l===``,M=I.useRef(null),N=I.useRef(null),P=w?.registerInput,ue=I.useCallback(e=>P?.(e,{controlRef:M,value:void 0}),[P]),de=j(u,N,O,ue);nt(()=>{N.current?.checked&&te(!0)},[te]),nt(()=>{if(N.current){if(se&&le){O(null);return}O(N.current)}},[le,se,O]);let fe=De(),pe=cp({id:f}),me=d?void 0:pe,he={role:`radio`,"aria-checked":le,"aria-labelledby":ap(c,ae,N,!d,me),[Dp]:le?``:void 0,id:d?pe:fe,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||se||k)return;e.preventDefault();let t=N.current;t&&bt(t,e)},onFocus(e){e.defaultPrevented||se||k||!C||(N.current?.click(),D(!1))}},{getButtonProps:ge,buttonRef:_e}=Je({disabled:se,native:d,composite:!1}),ve={type:`radio`,ref:de,form:A,id:me,name:T,tabIndex:-1,style:T?r:Pt,"aria-hidden":!0,...l===void 0?qe:{value:Fp(l)},disabled:se,checked:le,required:ce,readOnly:k,onChange(e){if(e.nativeEvent.defaultPrevented||se||k||l===void 0)return;let t=m(b,e.nativeEvent);E(l,t),!t.isCanceled&&ee(!0)},onClick(e){e.stopPropagation()},onFocus(){M.current?.focus()}},ye=I.useMemo(()=>({...ne,required:ce,disabled:se,readOnly:k,checked:le}),[ne,se,k,le,ce]),be=ye,xe=g!==void 0,Se=[t,M,_e],Ce=[he,h,ge,oe,w?e=>w.getValidationProps(se,e):qe],we=Ue(`span`,e,{enabled:!xe,state:ye,ref:Se,props:Ce,stateAttributesMapping:Ep});return(0,K.jsxs)(Ip.Provider,{value:be,children:[xe?(0,K.jsx)(Mp,{tag:`span`,render:n,className:i,style:p,state:ye,refs:Se,props:Ce,stateAttributesMapping:Ep}):we,(0,K.jsx)(`input`,{...ve,suppressHydrationWarning:!0})]})}),zp=I.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Lp(),c=s.checked,{mounted:l,transitionStatus:d,setMounted:f}=u(c),p={...s,transitionStatus:d},m=I.useRef(null),h=a||l,g=Ue(`span`,e,{ref:[t,m],state:p,props:o,stateAttributesMapping:Ep});return A({batch:!0,enabled:!c,open:c,ref:m,onComplete(){c||f(!1)}}),h?g:null});function Bp(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=g(i),[,o]=I.useState(!1),s=Ne(Hp).current,c=Ne(Vp).current,l=I.useRef(0),u=I.useRef(!0),d=I.useRef(null),f=I.useRef(null),p=g(()=>{u.current||(u.current=!0,o(e=>!e))}),m=g((e,t)=>{c.set(e,t),p()}),h=g(e=>{c.delete(e),p()}),_=g(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function v(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Gp(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&Kp(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=Wp(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let y=g(()=>{let[e,t]=Up(c),n=_(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});v(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});nt(()=>(!u.current&&d.current&&_(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,_]),nt(()=>{u.current&&y()}),nt(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let b=g(e=>(s.add(e),()=>{s.delete(e)})),x=I.useMemo(()=>({register:m,unregister:h,subscribeMapChange:b,nextIndexRef:l}),[m,h,b,l]);return(0,K.jsx)(Op.Provider,{value:x,children:t})}function Vp(){return new Map}function Hp(){return new Set}function Up(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>Kp(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function Wp(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Gp(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function Kp(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function qp(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function Jp(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:p=Ee}=e,[m,h]=I.useState(0),_=r!=null,b=I.useRef(null),x=j(b,c),S=I.useRef([]),C=I.useRef(!1),T=I.useRef(null),E=o??m,D=g((e,t=!1)=>{if(T.current=S.current[e]??null,(s??h)(e),t){let t=S.current[e];dt(b.current,t,a,n)}}),O=g(e=>{if(e.size===0)return;if(C.current){let e=S.current,t=e.indexOf(T.current);if(t===-1){let t=e[E];!t||oe(e,E,d)?D(Yp(e,d)):T.current=t}else t!==E&&D(t);return}C.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)D(i);else if(oe(t,E,d)){let e=re(t,{disabledIndices:d});w(t,e)||D(e)}dt(b.current,r,a,n)});nt(()=>{if(d==null||o!=null||!C.current)return;let e=S.current;if(oe(e,E,d)){let t=re(e,{disabledIndices:d});w(e,t)||D(t)}},[d,o,E,S,D]);let ee=g((e,t,n)=>i?i(e,t,n,S):n),te=g(e=>{let o=e.key===`Home`||e.key===`End`;if(!ie.has(e.key)||!l&&o||Xp(e,p)||!b.current)return;let s=a===`rtl`,c=s?pe:de,m=s?de:pe,h=n===`vertical`?y:c,g=n===`vertical`?he:m,x=Be(e.nativeEvent);if(x!=null&&et(x)&&!qp(x)){let t=x.selectionStart,n=x.selectionEnd,r=x.value;if(t==null||e.shiftKey||t!==n||e.key!==g&&t<r.length||e.key!==h&&t>0)return}let C=E,T=v(S,d),O=f(S,d);r!=null&&(C=r({disabledIndices:d,elementsRef:S,event:e,highlightedIndex:E,loopFocus:t,maxIndex:O,minIndex:T,onLoop:ee,orientation:n,rtl:s}));let te=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,ne=n!==`vertical`&&e.key===m||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?C=T:e.key===`End`&&(C=O)),C===E&&(te||ne)&&(t&&C===O&&te?(C=T,i&&(C=i(e,E,C,S))):t&&C===T&&ne?(C=O,i&&(C=i(e,E,C,S))):C=re(S.current,{startingIndex:C,decrement:ne,disabledIndices:d})),C!==E&&!w(S.current,C)&&(u&&e.stopPropagation(),(_||o||te||ne)&&e.preventDefault(),D(C,!0),queueMicrotask(()=>{S.current[C]?.focus()}))});return{props:{ref:x,onFocus(e){let t=b.current,n=Be(e.nativeEvent);t&&n!=null&&et(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:te},highlightedIndex:E,onHighlightedIndexChange:D,elementsRef:S,onMapChange:O,relayKeyboardEvent:te}}function Yp(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!oe(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function Xp(e,t){for(let n of je)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Zp(e){let{render:t,className:n,style:r,refs:i=Ee,props:a=Ee,state:o=qe,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=Jp({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:rt(),disabledIndices:v,modifierKeys:y}),ee=Ue(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),te=I.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,K.jsx)(Ae.Provider,{value:te,children:(0,K.jsx)(Bp,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:ee})})}var Qp=[_t],$p=I.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:_,setFocused:v,validationMode:y,name:b,disabled:x,state:S,validation:C,setDirty:w,setFilled:T,validityData:E}=Zf(),{labelId:D}=ip(),{clearErrors:O,elementRef:ee}=np(),te=vp(!0),ne=x||i,re=b??d,ie=De(p),[ae,oe]=zf({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[se,k]=I.useState(!1),ce=g((e,t)=>{s?.(e,t),!t.isCanceled&&oe(e)}),A=C.getInputControl,le=I.useMemo(()=>({get current(){return A()}}),[A]),j=I.useRef(null),M=I.useRef(null);function N(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),j.current=e,t}let P=g(e=>{if(!e||e.disabled)return;M.current||=e;let t=j.current,n=e.checked||t==null||t.disabled?N(e):void 0;return()=>{M.current===e&&(M.current=null),j.current===e?n?(n(),j.current=null):N(null):n?.()}}),ue=g(()=>{let e=ee.current;if(!e)return ae??null;for(let t of C.registeredInputs.keys())if(t.checked&&yp(t,e))return ae??null;return null});Qf(le,ie,ae??null,ue,!ne,d),cf(ae,()=>{O(re),w(ae!==E.initialValue),T(ae!=null),C.change(ae);let e=M.current;ae==null&&e&&!e.disabled&&N(e)});let de=D??te?.legendId,fe={...S,disabled:ne??!1,required:o??!1,readOnly:a??!1},pe=I.useMemo(()=>({checkedValue:ae,disabled:ne,form:u,validation:C,name:re,readOnly:a,registerInputRef:P,required:o,setCheckedValue:ce,setTouched:k,touched:se}),[ae,ne,u,C,re,a,P,o,ce,k,se]),me={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":ne||void 0,"aria-readonly":a||void 0,"aria-labelledby":de,onFocus(){v(!0)},onBlur(e){ut(e.currentTarget,e.relatedTarget)||(_(!0),v(!1),y===`onBlur`&&C.commit(ae))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(k(!0),v(!0))}};return(0,K.jsx)(Np.Provider,{value:pe,children:(0,K.jsx)(Zp,{render:n,className:r,style:m,state:fe,props:[me,h,e=>C.getValidationProps(ne??!1,e)],refs:[t],stateAttributesMapping:Gf,enableHomeAndEndKeys:!1,modifierKeys:Qp})})});function em({className:e,...t}){return(0,K.jsx)($p,{"data-slot":`radio-group`,className:p(`grid w-full gap-2`,e),...t})}function tm({className:e,...t}){return(0,K.jsx)(Rp,{"data-slot":`radio-group-item`,className:p(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,K.jsx)(zp,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,K.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})})})}function nm({className:e,...t}){return(0,K.jsx)(`textarea`,{"data-slot":`textarea`,className:p(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function rm(e,t,n){let r={};for(let[n,i]of Object.entries(e))n!==t&&(r[n]=i);return n!==void 0&&(r[t]=n),r}function im(e,t){if(t){if(e.type===`string`&&e.enum===void 0&&(e.minLength??0)===0)return``;if(e.type===`array`&&(e.minItems??0)===0)return[]}}var am=e=>e===``?`(empty)`:e;function om(e,t){return t===void 0?`Not answered`:e.type===`boolean`?t===!0?`Yes`:`No`:Array.isArray(t)?t.length===0?`(none selected)`:t.join(`, `):t===``?`(empty)`:String(t)}function sm(e,t){let{properties:n,required:r}=e.answerSchema;return e.fieldOrder.flatMap(e=>{let i=n[e];return i?[{name:e,title:i.title,value:om(i,t[e]),required:r.includes(e)}]:[]})}var cm={"not-object":`The answers are not in the right shape`,"too-large":`The answers are too large`,"unknown-field":`Not a field of this question`,required:`An answer is required`,type:`Wrong value type`,enum:`Not one of the options`,"too-long":`Too long`,"too-short":`Too short`,"out-of-range":`Out of range`,duplicate:`The same option is selected more than once`,"too-many":`Too many selected`,"too-few":`Too few selected`};function lm(e,t){return t.map(t=>{let n=e.answerSchema.properties[t.field]?.title??`Whole answer`;return{name:t.field,text:`${n}: ${cm[t.code]}`}})}var um=6,dm=200,fm=300,pm=()=>`sub_${crypto.randomUUID()}`;function mm(e){let{name:t,field:n,required:r,value:i,disabled:a,onChange:o}=e,s=im(n,r);if(s===void 0)return(0,K.jsx)(hm,{...e});let c=Array.isArray(s)?Array.isArray(i)&&i.length===0:i===``;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(hm,{...e}),(0,K.jsxs)(Cp,{className:`text-xs font-normal text-muted-foreground`,children:[(0,K.jsx)(gp,{checked:c,disabled:a,onCheckedChange:e=>o(e?s:void 0),"data-testid":`feedback-${t}-empty`}),n.type===`array`?`Answer with none selected`:`Answer with an empty value`]})]})}function hm({name:e,field:t,value:n,disabled:r,onChange:i}){let a=`feedback-${e}`;switch(t.type){case`boolean`:return(0,K.jsxs)(Cp,{htmlFor:a,className:`font-normal`,children:[(0,K.jsx)(gp,{id:a,checked:n===!0,disabled:r,onCheckedChange:e=>i(e)}),`Yes`]});case`number`:case`integer`:return(0,K.jsx)(Sp,{id:a,type:`number`,inputMode:t.type===`integer`?`numeric`:`decimal`,step:t.type===`integer`?1:`any`,min:t.minimum,max:t.maximum,disabled:r,value:typeof n==`number`?String(n):``,onChange:e=>{let t=e.target.value,n=Number(t);i(t===``||!Number.isFinite(n)?void 0:n)}});case`array`:{let e=Array.isArray(n)?n:[];return(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,role:`group`,"aria-labelledby":`${a}-label`,children:t.items.enum.map(t=>(0,K.jsxs)(Cp,{className:`font-normal`,children:[(0,K.jsx)(gp,{checked:e.includes(t),disabled:r,onCheckedChange:n=>{let r=n?[...e,t]:e.filter(e=>e!==t);i(r.length===0?void 0:r)}}),am(t)]},t))})}case`string`:{if(t.enum!==void 0&&t.enum.length<=um)return(0,K.jsx)(em,{"aria-labelledby":`${a}-label`,value:typeof n==`string`?n:null,disabled:r,onValueChange:e=>i(typeof e==`string`?e:void 0),children:t.enum.map(e=>(0,K.jsxs)(Cp,{className:`font-normal`,children:[(0,K.jsx)(tm,{value:e}),am(e)]},e))});if(t.enum!==void 0){let e=t.enum,o=typeof n==`string`?e.indexOf(n):-1;return(0,K.jsxs)(`select`,{id:a,className:`h-9 rounded-md border bg-transparent px-2 text-sm`,disabled:r,value:o===-1?`none`:String(o),onChange:t=>{let n=Number(t.target.value);i(t.target.value===`none`?void 0:e[n])},children:[(0,K.jsx)(`option`,{value:`none`,children:`Select an option`}),e.map((e,t)=>(0,K.jsx)(`option`,{value:String(t),children:am(e)},e))]})}let e=t.maxLength===void 0||t.maxLength>dm,o={id:a,disabled:r,maxLength:t.maxLength,value:typeof n==`string`?n:``,onChange:e=>i(e.target.value===``?void 0:e.target.value)};return e?(0,K.jsx)(nm,{rows:4,...o}):(0,K.jsx)(Sp,{...o})}}}function gm({id:e,api:t,request:n,reload:r}){let{requestId:i,questionnaire:a}=n,o=n.status===`pending`,[s,c]=(0,I.useState)({version:n.draftVersion,answers:n.draftAnswers}),[l,u]=(0,I.useState)(n.draftAnswers),[d,f]=(0,I.useState)(!1),[m,h]=(0,I.useState)(`idle`),[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(null),[b,x]=(0,I.useState)(pm),[S,C]=(0,I.useState)(!1),w=(0,I.useRef)(0);n.draftVersion>s.version&&!d&&m===`idle`&&(c({version:n.draftVersion,answers:n.draftAnswers}),u(n.draftAnswers));let T=o&&n.currentRevision!==n.revision,E=T&&v===n.currentRevision,D=o?l:n.submission?.answers??n.draftAnswers,O=hd(a,D,{complete:!0}),te=sm(a,D),ne=new Set(O.filter(e=>e.code===`required`).map(e=>e.field)),re=O.filter(e=>e.code!==`required`),ie=(e,t)=>{if(!(e instanceof ee)){_(t);return}switch(e.code){case`E_DRAFT_CONFLICT`:f(!1),u(s.answers),_(`The draft answer was updated in another window. Showing the latest content. Enter your answers again if needed.`),x(pm()),r();return;case`E_NEWER_REVISION`:y(null),x(pm()),_(`The document revision changed. Confirm again that this answer is for the revision shown.`),r();return;case`E_REQUEST_NOT_PENDING`:case`E_SUBMISSION_CONFLICT`:x(pm()),_(e.message),r();return;default:_(e.message)}};(0,I.useEffect)(()=>{if(!d||m!==`idle`||!o)return;let e=setTimeout(()=>{let e=w.current,n=l;h(`saving`),t.saveDraft(i,s.version,n).then(t=>{c({version:t.draftVersion,answers:n}),w.current===e&&f(!1),h(`idle`)},e=>{h(`idle`),ie(e,`Could not save the draft answer.`)})},fm);return()=>clearTimeout(e)});let ae=(e,t)=>{w.current+=1,u(n=>rm(n,e,t)),f(!0),_(null)},oe=()=>{h(`submitting`),_(null),t.submitFeedback(i,{submissionId:b,expectedDraftVersion:s.version,revision:n.revision,currentRevision:T?v:n.currentRevision,confirmOlderRevision:E}).then(()=>{h(`idle`),r()},e=>{h(`idle`),ie(e,`Could not confirm whether the submission succeeded. Submit again.`)})},se=()=>{C(!1),t.cancelFeedback(i).then(r,e=>ie(e,`Could not cancel.`))},k=n.status===`cancelled`?`Cancelled`:n.status===`submitted`?n.acknowledgedAt===null?`Submitted. Waiting for the agent to retrieve it`:`The agent retrieved the answers`:m===`submitting`?`Submitting…`:m===`saving`?`Saving draft answer…`:d?`Unsaved changes`:s.version>0?`Draft answer saved`:`Not answered`,ce=!o||m!==`idle`||d||O.length>0||T&&!E;return(0,K.jsxs)(`aside`,{id:e,"aria-label":`Answer the question`,className:`flex max-h-[50svh] w-full shrink-0 flex-col border-t bg-background min-[900px]:max-h-none min-[900px]:w-(--answer-width) min-[900px]:border-t-0`,"data-testid":`feedback-panel`,children:[(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto min-[900px]:contents`,children:[(0,K.jsxs)(`div`,{className:`min-[900px]:min-h-0 min-[900px]:flex-1 min-[900px]:overflow-y-auto`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-11 items-start gap-2 border-b bg-chrome px-3 py-2.5`,children:[(0,K.jsx)(Kd,{className:`mt-px size-4 shrink-0 text-link`,"aria-hidden":`true`}),(0,K.jsx)(`p`,{className:`sr-only`,children:`Question from the agent`}),(0,K.jsx)(`h2`,{className:`text-sm font-semibold break-words`,children:a.title})]}),(0,K.jsxs)(`div`,{className:`px-3 py-3`,children:[a.instructions&&(0,K.jsx)(`p`,{className:`mb-4 text-sm whitespace-pre-wrap text-muted-foreground`,children:a.instructions}),T&&(0,K.jsxs)(`div`,{role:`alert`,className:`mb-4 rounded-md border border-warning/50 p-2.5 text-sm`,children:[(0,K.jsx)(`p`,{children:`A newer revision is available. This answer is for the older revision shown.`}),v!==null&&!E&&(0,K.jsx)(`p`,{className:`mt-1`,children:`The document was updated again after you confirmed. Confirm again.`}),(0,K.jsxs)(Cp,{className:`mt-2 font-normal`,children:[(0,K.jsx)(gp,{checked:E,onCheckedChange:e=>y(e?n.currentRevision:null)}),`I confirm that this answer is for the older revision`]})]}),(0,K.jsx)(`div`,{className:`flex flex-col gap-4`,children:a.fieldOrder.map(e=>{let t=a.answerSchema.properties[e];if(!t)return null;let n=a.answerSchema.required.includes(e);return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-field":e,children:[(0,K.jsxs)(`p`,{id:`feedback-${e}-label`,className:`text-sm font-medium`,children:[(0,K.jsx)(`label`,{htmlFor:`feedback-${e}`,children:t.title}),n&&(0,K.jsx)(`span`,{className:`ml-1 text-xs font-normal text-muted-foreground`,children:`(required)`})]}),t.description&&(0,K.jsx)(`p`,{className:`text-xs whitespace-pre-wrap text-muted-foreground`,children:t.description}),(0,K.jsx)(mm,{name:e,field:t,required:n,value:D[e],disabled:!o||m===`submitting`,onChange:t=>ae(e,t)})]},e)})})]})]}),(0,K.jsxs)(`div`,{className:`border-t bg-chrome px-3 pt-2.5`,"data-testid":`feedback-footer`,children:[(0,K.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:`Answers to send`}),(0,K.jsxs)(`p`,{className:`text-muted-foreground`,title:n.revision,children:[`For revision `,(0,K.jsx)(`code`,{className:`font-mono`,children:n.revision.slice(4,12)})]})]}),(0,K.jsx)(`dl`,{className:`mt-1 text-xs min-[900px]:max-h-28 min-[900px]:overflow-y-auto`,"aria-label":`Answer summary`,children:te.map(e=>{let t=o&&ne.has(e.name);return(0,K.jsxs)(`div`,{className:`flex gap-2 py-px`,children:[(0,K.jsx)(`dt`,{className:`w-24 shrink-0 truncate text-muted-foreground`,children:e.title}),(0,K.jsx)(`dd`,{className:p(`min-w-0 break-words`,t?`text-destructive`:e.value===`Not answered`&&`text-muted-foreground`),children:t?`Required`:e.value})]},e.name)})}),o&&re.length>0&&(0,K.jsx)(`ul`,{className:`mt-1 text-xs text-destructive`,"aria-label":`Required before submitting`,children:lm(a,re).map(e=>(0,K.jsx)(`li`,{children:e.text},`${e.name}:${e.text}`))})]})]}),(0,K.jsxs)(`div`,{className:`shrink-0 border-t bg-chrome px-3 pt-2.5 pb-2.5 min-[900px]:border-t-0`,children:[o&&(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(P,{type:`button`,className:`grow`,disabled:ce,onClick:oe,children:`Send answers to the agent`}),(0,K.jsx)(P,{type:`button`,variant:`ghost`,onClick:()=>C(!0),children:`Cancel question`})]}),(0,K.jsxs)(`div`,{className:p(`flex min-h-5 flex-wrap items-center gap-x-2`,o&&`mt-1.5`),children:[(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,"data-testid":`feedback-status`,children:k}),g&&(0,K.jsx)(le,{title:`Answer needs attention`,trigger:(0,K.jsxs)(P,{variant:`ghost`,size:`xs`,className:`text-destructive`,children:[(0,K.jsx)(jt,{"aria-hidden":`true`}),`Details`]}),children:(0,K.jsx)(`p`,{children:g})}),g&&(0,K.jsx)(`span`,{role:`alert`,className:`sr-only`,children:g})]})]}),(0,K.jsx)(kf,{open:S,onOpenChange:C,children:(0,K.jsxs)(Mf,{children:[(0,K.jsxs)(Nf,{children:[(0,K.jsx)(Ff,{children:`Cancel this question?`}),(0,K.jsx)(If,{children:`After cancelling, this question can no longer be answered. The agent is told that it was cancelled.`})]}),(0,K.jsxs)(Pf,{children:[(0,K.jsx)(Rf,{children:`Back`}),(0,K.jsx)(Lf,{onClick:se,children:`Cancel question`})]})]})})]})}function _m({label:e,controls:t,width:n,min:r,max:i,onResize:a,className:o,style:s}){let c=(0,I.useRef)(null);return(0,K.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":e,"aria-controls":t,"aria-valuemin":r,"aria-valuemax":i,"aria-valuenow":n,tabIndex:0,style:s,className:p(`relative w-2 shrink-0 touch-none cursor-col-resize before:absolute before:inset-y-0 before:left-1/2 before:w-px before:bg-border hover:bg-muted hover:before:bg-primary/60 focus-visible:bg-primary/10 focus-visible:before:bg-primary focus-visible:outline-none active:bg-primary/10 active:before:bg-primary`,o),onPointerDown:e=>{e.button===0&&e.isPrimary&&(e.preventDefault(),e.currentTarget.focus(),c.current={pointerId:e.pointerId,x:e.clientX,width:n},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=c.current;t&&t.pointerId===e.pointerId&&e.currentTarget.hasPointerCapture(e.pointerId)&&a(t.width+t.x-e.clientX)},onLostPointerCapture:()=>{c.current=null},onKeyDown:e=>{let t=e.key===`ArrowLeft`?n+16:e.key===`ArrowRight`?n-16:e.key===`Home`?r:e.key===`End`?i:null;t!==null&&(e.preventDefault(),a(t))}})}function vm(){return(0,K.jsx)(K.Fragment,{children:`Scripts can load only the files registered for this document and cannot reach this app, its management API, or unregistered files. Some outbound requests, including navigation inside the view, are not blocked.`})}var ym={navigated:`View reloaded`,"request-closed":`Question closed`,expired:`Render permission expired`,replaced:`Draft connection ended`};function bm(e){return e.status===`connected`?`Drafts linked (not sent)`:e.status===`closed`?ym[e.reason]??`Invalid draft message`:null}function xm({mode:e,bridge:t,needsPermission:n,pinnedStatic:r,modeError:i,onRunScripts:a,onStopScripts:o,onReload:s,children:c}){let l=e===`interactive`,u=t.status===`closed`,d=bm(t);return(0,K.jsxs)(`div`,{className:`flex min-h-7 flex-wrap items-center gap-x-3 gap-y-0.5 border-b bg-chrome px-3 py-0.5 text-xs`,"data-testid":`html-view-bar`,children:[(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-1.5 [&>*]:whitespace-nowrap`,children:[(0,K.jsx)(nf,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`font-medium`,children:`Document content`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,"data-testid":`html-mode`,children:l?`Scripts running`:r?`Scripts off for this question`:`Scripts off`})]}),n&&(0,K.jsx)(`span`,{className:`text-destructive`,children:`Permission cleared`}),d!==null&&(0,K.jsx)(`span`,{role:`status`,className:u?`text-destructive`:`text-muted-foreground`,"data-testid":`bridge-status`,children:d}),i&&(0,K.jsx)(`span`,{role:`alert`,className:`text-destructive`,children:`Script change failed`}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-0.5`,children:[u&&t.reason!==`request-closed`&&(0,K.jsx)(P,{size:`xs`,variant:`ghost`,onClick:s,children:`Reload view`}),c,(0,K.jsx)(le,{title:`Document view`,trigger:(0,K.jsx)(P,{size:`icon-xs`,variant:`ghost`,"aria-label":`Details`,title:`About this view`,className:u||i?`text-destructive`:void 0,children:u||i?(0,K.jsx)(jt,{"aria-hidden":`true`}):(0,K.jsx)(Bd,{"aria-hidden":`true`})}),children:(0,K.jsx)(Sm,{mode:e,bridge:t,needsPermission:n,pinnedStatic:r,modeError:i,connection:d})}),l&&(0,K.jsx)(P,{size:`xs`,variant:`ghost`,onClick:o,children:`Turn off scripts`}),n&&(0,K.jsx)(P,{size:`xs`,variant:`outline`,onClick:a,children:`Run scripts…`})]})]})}function Sm({mode:e,bridge:t,needsPermission:n,pinnedStatic:r,modeError:i,connection:a}){let o=e===`interactive`,s=t.status===`closed`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{children:`Buttons and text inside the view belong to the opened document, rather than this app.`}),(0,K.jsx)(`p`,{children:`Links to local documents and headings work in the preview. Open external links from “Links in this document”. Forms are display-only.`}),o?(0,K.jsx)(`p`,{children:(0,K.jsx)(vm,{})}):(0,K.jsx)(`p`,{children:`Scripts from the document are off in this view.`}),r&&(0,K.jsx)(`p`,{children:`This question was created in the Static view, so scripts stay off until it is answered.`}),n&&(0,K.jsx)(`p`,{children:`The permission to run scripts was cleared, for example by a daemon restart. Use “Run scripts…” to allow them again.`}),t.status===`connected`&&(0,K.jsx)(`p`,{children:`The document can read and replace draft answers. It cannot submit them. Only “Send answers to the agent” in the answer panel submits answers.`}),s&&(0,K.jsxs)(`p`,{children:[`Draft answers from this view are no longer accepted. `,a,`.`,` `,t.reason===`request-closed`?`Reloading cannot reopen the question.`:`Reload the view to reconnect.`]}),s&&!ym[t.reason]&&(0,K.jsx)(`p`,{children:`The document sent a message that breaks the rules, such as a malformed or oversized message or too many messages.`}),i&&(0,K.jsx)(`p`,{className:`text-destructive`,children:i})]})}var Cm=I.createContext(void 0);function wm(){return I.useContext(Cm)}var Tm=I.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:o,pressed:s,render:c,type:l,value:u,nativeButton:d=!0,style:f,...p}=e,h=De(u||void 0),g=wm(),_=g?.value??[],v=(i||g?.disabled)??!1,[y,x]=zf({controlled:g?h!==void 0&&_.indexOf(h)>-1:s,default:r,name:`Toggle`,state:`pressed`}),{getButtonProps:S,buttonRef:C}=Je({disabled:v,native:d}),w={disabled:v,pressed:y},T=[C,t],E=[{"aria-pressed":y,onClick(e){let t=!y,n=m(b,e.nativeEvent);o?.(t,n),!n.isCanceled&&(h&&g?.setGroupValue?.(h,t,n),!n.isCanceled&&x(t))}},p,S],D=Ue(`button`,e,{enabled:!g,state:w,ref:T,props:E}),O=I.useMemo(()=>({disabled:v,focusableWhenDisabled:!1}),[v]);return g?(0,K.jsx)(Mp,{tag:`button`,render:c,className:n,style:f,metadata:O,state:w,refs:T,props:E}):D}),Em=I.createContext(void 0);function Dm(){return I.useContext(Em)}var Om=I.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:o=`horizontal`,multiple:s=!1,value:c,className:l,render:u,style:d,...f}=e,p=st(!0),m=Dm(),h=n??Ee,_=c!==void 0||n!==void 0,v=(p?.disabled??!1)||(m?.disabled??!1)||r,[y,b]=zf({controlled:c,default:h,name:`ToggleGroup`,state:`value`}),x=g((e,t,n)=>{let r;s?(r=y.slice(),t?r.push(e):r.splice(y.indexOf(e),1)):r=t?[e]:[],a?.(r,n),!n.isCanceled&&b(r)}),S={disabled:v,multiple:s,orientation:o},C=I.useMemo(()=>({disabled:v,setGroupValue:x,value:y,isValueInitialized:_}),[v,x,y,_]),w={role:`group`},T=Ue(`div`,e,{enabled:!!p,state:S,ref:t,props:[w,f]});return(0,K.jsx)(Cm.Provider,{value:C,children:p?T:(0,K.jsx)(Zp,{render:u,className:l,style:d,state:S,refs:[t],props:[w,f],loopFocus:i,enableHomeAndEndKeys:!0,orientation:o})})}),km=x(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),Am=I.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function jm({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,K.jsx)(Om,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:p(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,K.jsx)(Am.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function Mm({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=I.useContext(Am);return(0,K.jsx)(Tm,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:p(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,km({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}var Nm=`rounded-md bg-foreground/[0.06] p-0.5`,Pm=`h-6 min-w-6 rounded-[5px] px-2 text-xs font-medium text-muted-foreground hover:bg-transparent hover:text-foreground aria-pressed:bg-background aria-pressed:text-foreground aria-pressed:shadow-xs dark:aria-pressed:bg-foreground/15`,Fm=(e,t)=>`${String(e)} ${t}${e===1?``:`s`}`,Im={"asset-scan-failed":()=>`Scanning the files this document references did not finish in time or exceeded the structure limits, so images and CSS were not registered. Run vo refresh <document ID> to scan again.`,"script-removed":(e,t)=>`Removed ${Fm(t,`script`)}. Content created by the document's scripts is unavailable in Static.`,"script-not-loaded":(e,t)=>`Removed ${Fm(t,`script`)} that could not be loaded (referencing unregistered files or external URLs).`,"noscript-removed":(e,t)=>`Removed ${Fm(t,`noscript element`)}. In the Interactive view, noscript content is not shown.`,"asset-requested":e=>`The view tried to load ${e}, but it is not registered, so it could not be loaded. Register it with vo open <document> --assets-root <dir> --asset ${e} to make it loadable (files that scripts load at run time are not registered automatically).`,"event-handler-removed":(e,t)=>`Removed event attributes such as onclick from ${Fm(t,`element`)}.`,"embed-removed":(e,t)=>`Removed ${Fm(t,`embedded element`)} (iframe, object, embed, and similar). Other pages and plugins cannot be embedded.`,"inline-svg-removed":(e,t)=>`Removed ${Fm(t,`inline SVG`)}. Save the SVG as a file (.svg) and reference it with <img> to show it.`,"mathml-removed":(e,t)=>`Removed ${Fm(t,`MathML element`)}.`,"meta-refresh-removed":()=>`Removed the automatic redirect (meta refresh).`,"base-removed":()=>`Removed the base element. Relative references resolve against the document location.`,"network-hint-removed":(e,t)=>`Removed ${Fm(t,`resource hint`)} (prefetch, preconnect, and similar).`,"form-action-removed":()=>`Removed the form action. Form controls are display-only and cannot submit.`,"element-removed":(e,t)=>`Removed ${Fm(t,`legacy element`)} that treats the rest of the document as text (such as plaintext).`,"media-blocked":e=>`Video and audio (${e}) cannot be shown.`,"remote-asset-blocked":e=>`External URL (${e}) is not loaded. Put the file under the document's directory and reference it with a relative path to show it.`,"asset-not-registered":e=>`${e} was not found. Make sure the file is under the assets-root used when the document was opened (the document's directory if none was given).`,"asset-rejected":e=>`${e} cannot be loaded. References outside the assets-root, file: URLs, and encoded separators are not allowed. To widen the range, reopen with vo open <document> --assets-root <dir>.`,"asset-hidden":e=>`${e} is not loaded. Files and directories whose names start with "." (such as .env and .git) cannot be referenced from documents.`,"asset-unsupported":e=>`${e} is a file type that cannot be used here. Allowed types are images (PNG, JPEG, WebP, GIF, AVIF, SVG), CSS, fonts (WOFF, WOFF2), and, in the Interactive view, scripts (.js, .mjs) and JSON registered with --asset.`,"data-url-blocked":e=>`data URL (${e}) cannot be used. Only PNG, JPEG, WebP, GIF, and AVIF images are allowed as data URLs.`,"css-invalid":e=>`${e===``?`The CSS in the document`:e} has parts that could not be parsed, and those parts were disabled.`,"link-disabled":(e,t)=>`${Fm(t,`link`)} unavailable in the preview. See "Links in this document" for available actions.`};function Lm(e){let t=Im[e.code],n=e.target??``;if(!t)return`${e.code}${n===``?``:`: ${n}`}`;let r=t(n,e.count);return e.target!==null&&e.count>1?`${r} (${String(e.count)} occurrences)`:r}function Rm(e){if(!(e instanceof ee))return`Could not export the PDF.`;switch(e.code){case`E_BROWSER_NOT_FOUND`:return e.message;case`E_REVISION_UNAVAILABLE`:return`This revision is no longer kept. Show the latest revision and export again.`;case`E_PARSE_FAILED`:return`The document could not be prepared for printing (it is too large or too deeply nested).`;case`E_LIMIT_EXCEEDED`:return e.details.reason===`page-size`?`The document is too large to print (including images, fonts, and stylesheets).`:`Other PDF exports are still waiting. Try again after they finish.`;case`E_EXPORT_FAILED`:return e.details.reason===`timeout`?`The browser did not finish printing the PDF in time.`:`The browser could not print the PDF.`;default:return`Could not export the PDF. ${e.message}`}}var zm={exporting:!1,error:null};function Bm(e,t){let n=URL.createObjectURL(e),r=window.document.createElement(`a`);r.href=n,r.download=t,window.document.body.append(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),6e4)}function Vm(e=Bm){let t=new Map,n=new Set,r=(e,r)=>{r===zm?t.delete(e):t.set(e,r);for(let e of n)e()};return{state:e=>t.get(e)??zm,subscribe(e){return n.add(e),()=>n.delete(e)},start(n,i,a){let{documentId:o}=i;t.get(o)?.exporting!==!0&&(r(o,{exporting:!0,error:null}),n.exportPdf(o,a).then(t=>{r(o,zm),e(t,Ed(i))},e=>{r(o,{exporting:!1,error:Rm(e)})}))},dismiss(e){t.get(e)?.exporting===!1&&r(e,zm)}}}var Hm=Vm();function Um(e){return(0,I.useSyncExternalStore)(Hm.subscribe,()=>Hm.state(e))}var Wm=1e3,Gm=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),Km=(e,t)=>Object.keys(e).every(e=>t.includes(e));function qm(e){try{let t=JSON.stringify(e);return t===void 0?null:pd(t)}catch{return null}}function Jm(e){return e instanceof ee?{code:e.code,message:e.message}:{code:`E_BRIDGE_FAILED`,message:`Could not handle the draft answer.`}}function Ym(e){let{instanceId:t,port:n,handlers:r}=e,i=e.now??Date.now,a=!1,o=0,s=[],c=new Set,l=-1,u=0,d=null,f=e=>{if(a)return;let t=qm(e);if(t===null||t>W.bridgeOutboundFrameBytes){e.type===`response`&&n.postMessage({type:`response`,sequence:e.sequence,ok:!1,error:{code:`E_LIMIT_EXCEEDED`,message:`The response is too large.`}});return}n.postMessage(e)},p=(e,t)=>t.then(t=>f({type:`response`,sequence:e,ok:!0,result:t}),t=>f({type:`response`,sequence:e,ok:!1,error:Jm(t)})),m=(e,t,n)=>f({type:`response`,sequence:e,ok:!1,error:{code:t,message:n}}),h=e=>{a||e.draftVersion<=l||c.has(e.draftVersion)||(l=e.draftVersion,f({type:`event`,method:`draftChanged`,payload:e}))},g=({sequence:e,method:t,payload:n})=>{if(t===`ready`){if(!Km(n,[])){m(e,`E_INVALID_ARGUMENT`,`ready takes no arguments.`);return}p(e,r.ready().then(e=>(l=Math.max(l,e.draftVersion),e)));return}if(t===`updateDraft`){let{answers:t,baseDraftVersion:i}=n;if(!Km(n,[`answers`,`baseDraftVersion`])||!Gm(t)||typeof i!=`number`||!Number.isSafeInteger(i)||i<0){m(e,`E_INVALID_ARGUMENT`,`updateDraft requires a draft-answer object and baseDraftVersion.`);return}let a=qm(t);if(a===null||a>W.answerBytes){m(e,`E_LIMIT_EXCEEDED`,`The draft answer is too large.`);return}if(Object.hasOwn(t,`__proto__`)||!dd.safeParse(t).success){m(e,`E_ANSWER_INVALID`,`Draft answer values must be strings, finite numbers, booleans, or arrays of strings, keyed by field name.`);return}u+=1,p(e,r.updateDraft(t,i).then(e=>(c.add(e.draftVersion),l=Math.max(l,e.draftVersion),e)).finally(()=>{if(--u,u===0&&d!==null){let e=d;d=null,h(e)}}));return}m(e,`E_METHOD_NOT_ALLOWED`,`${t.slice(0,64)} cannot be called from HTML.`)},_={get closed(){return a},notifyDraft(e){if(!a){if(u>0){d=e;return}h(e)}},close(t){if(!a){try{n.postMessage({type:`closed`,reason:t})}catch{}a=!0,n.removeEventListener(`message`,v),n.close(),e.onClose?.(t)}}};function v(e){if(a)return;let n=i();if(s=s.filter(e=>n-e<Wm),s.push(n),s.length>W.bridgeMessagesPerSecond){_.close(`rate`);return}let r=e.data,c=qm(r);if(c===null){_.close(`malformed`);return}if(c>W.bridgeInboundFrameBytes){_.close(`too-large`);return}if(!Gm(r)||r.protocolVersion!==1||typeof r.sequence!=`number`||!Number.isSafeInteger(r.sequence)||typeof r.method!=`string`||!Gm(r.payload)){_.close(`malformed`);return}if(r.instanceId!==t){_.close(`instance`);return}if(r.sequence<=o){_.close(`sequence`);return}o=r.sequence,g({sequence:r.sequence,method:r.method,payload:r.payload})}return n.addEventListener(`message`,v),n.start(),_}var Xm=(e,t)=>typeof e==`object`&&!!e&&e.type===`vde-bridge-hello`&&e.protocolVersion===1&&e.instanceId===t;function Zm(e,t,n,r,i){let a=n?.bridge?.instanceId??null,o=n?.bridge?.requestId??null,s=n?.grant??null,c=n?.documentUrl??null,[l,u]=(0,I.useState)(null),d=(0,I.useRef)(null);return(0,I.useEffect)(()=>{if(a===null||o===null||s===null)return;let n=t.current,r=i.current?.url===c?i.current.count:0,l=r>1,f=null,p=e=>u({instanceId:a,status:{status:`closed`,reason:e}}),m=t=>{let r=n?.contentWindow;if(!r||t.source!==r||!Xm(t.data,a)||l)return;l=!0;let i=new MessageChannel,o=async e=>{try{return await e}catch(e){throw e instanceof ee&&e.code===`E_RENDER_GRANT_INVALID`&&setTimeout(()=>f?.close(`expired`),0),e}};f=Ym({instanceId:a,port:i.port1,handlers:{async ready(){let t=await o(e.bridgeReady(s));return{protocolVersion:1,requestId:t.requestId,documentId:t.documentId,revision:t.revision,questionnaire:t.questionnaire,draftVersion:t.draftVersion,answers:t.draftAnswers}},updateDraft:(t,n)=>o(e.bridgeDraft(s,n,t))},onClose:p}),d.current=f,r.postMessage({type:It,instanceId:a},`*`,[i.port2]),u({instanceId:a,status:{status:`connected`}})},h=()=>{r+=1,!(r<2)&&(l=!0,f?f.close(`navigated`):p(`navigated`))};return window.addEventListener(`message`,m),n?.addEventListener(`load`,h),()=>{window.removeEventListener(`message`,m),n?.removeEventListener(`load`,h),f?.close(`replaced`),d.current=null}},[e,t,a,o,s,c,i]),(0,I.useEffect)(()=>{let t=d.current;if(t===null||r===null||r.requestId!==o||s===null)return;if(r.status!==`pending`){t.close(`request-closed`);return}let n=!1;return e.bridgeReady(s).then(e=>{n||e.status!==`pending`||t.notifyDraft({answers:e.draftAnswers,draftVersion:e.draftVersion})},e=>{e instanceof ee&&e.code===`E_RENDER_GRANT_INVALID`&&t.close(`expired`)}),()=>{n=!0}},[e,r,o,s]),a===null?{status:`none`}:i.current?.url===c&&i.current.count>1?{status:`closed`,reason:`navigated`}:l?.instanceId===a?l.status:{status:`waiting`}}function Qm(e,t,n){let[r,i]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(t===null)return;let r=!1;return e.renderMissing(t).then(e=>{r||i({grant:t,fetchedFor:n,missing:e})},()=>void 0),()=>{r=!0}},[e,t,n]),r!==null&&r.grant===t?r.missing:[]}var $m=`aria-pressed:bg-muted aria-pressed:text-foreground`,eh=160,th=480,nh=200,rh=480,ih=8,ah=e=>typeof e==`number`&&Number.isInteger(e)&&e>=eh&&e<=th,oh={timeout:`Parsing did not finish within 2 seconds, so the source is shown.`,"limit-nodes":`The document has more than 100,000 elements, so the source is shown.`,"limit-depth":`The document is nested deeper than 64 levels, so the source is shown.`,"parse-error":`The document could not be parsed, so the source is shown.`},sh={missing:`The file was not found. Showing the last content that could be read.`,unreadable:`No permission to read the file. Showing the last content that could be read.`,error:`The file cannot be read as a document. Showing the last content that could be read.`};function ch(e,t){if(e===null)return null;for(let n of e.querySelectorAll(`[id]`))if(n.id===t)return n;return null}function lh(e){return e.document.format===`image`?(0,K.jsx)(Fe,{...e}):(0,K.jsx)(uh,{...e})}function uh({api:e,document:t,daemonId:n=null,fixedRevision:r=null,request:a=null,renderSignal:o=0,waitingForRequest:c=!1,sectionTarget:u=null,restoreHeading:d=null,onHeadingShown:f,displayed:m=!0,onReady:g}){let[_,v]=Ye(`view-mode`,`preview`,Me),[y,b]=Ye(`markdown-width`,`standard`,Te),[x,S]=Ye(`outline-width`,nh,ah),C=(0,I.useId)(),w=(0,I.useRef)(null),[T,E]=(0,I.useState)(0),[D,O]=Ye(`outline`,`shown`,Ke),te=Math.max(eh,Math.min(th,T-ih-rh)),ne=Math.min(x,te),re=T>=648;(0,I.useLayoutEffect)(()=>{let e=w.current;if(!e)return;let t=()=>E(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let ie=e=>{S(Math.round(Math.min(te,Math.max(eh,e))))},[ae,oe]=(0,I.useState)(null),k=ae!==null,ce=r!==null,A=c?null:r??ae??t.revision,[j,M]=(0,I.useState)(null),[N,ue]=(0,I.useState)(null),[de,fe]=(0,I.useState)(null),[pe,me]=(0,I.useState)(null),he=(0,I.useRef)(null),ve=(0,I.useRef)(0);(0,I.useEffect)(()=>{if(A===null)return;let n=!1;return ve.current=he.current?.scrollTop??0,Promise.all([e.content(t.documentId,A),e.outline(t.documentId,A).then(e=>({items:e,error:null}),e=>({items:[],error:e instanceof Error?e.message:`Could not be fetched.`}))]).then(([e,t])=>{n||(M({revision:A,text:e,outline:t.items,outlineError:t.error}),ue(null))},e=>{n||ue({revision:A,message:e instanceof Error?e.message:`Could not be loaded.`})}),()=>{n=!0}},[e,t.documentId,A]);let ye=j?.text??null,be=j?.outline??[],xe=j?.outlineError??null,Ce=N!==null&&N.revision===A?N.message:null,we=be.length>1||xe!==null,Ee=t.format===`markdown`,De=_===`preview`,Oe=ze(Ee&&De?ye:null),ke=r!==null&&a?.status===`pending`&&a.revision===r?a.requestId:null,Ae=ke!==null&&a?.renderMode===`static`,je=!Ee&&t.htmlMode===`interactive`&&t.interactiveAllowed,[Ne,Pe]=(0,I.useState)(0),Fe=ge(e,t.documentId,A,t.updatedAt,{mode:je?`interactive`:`static`,requestId:ke,nonce:Ne,daemonId:n}),F=Fe.status===`ready`?Fe.grant:null,Re=Qm(e,F?.grant??null,o),[Be,Ve]=(0,I.useState)(!1),[He,Ue]=(0,I.useState)(null),We=Um(t.documentId),Ge=n=>{Ve(!1),Ue(null),e.setHtmlMode(t.documentId,n).catch(e=>Ue(e instanceof Error?e.message:`Could not change the view mode.`))},qe=Ee&&De&&Oe.status===`ready`,Je=!Ee&&De?F?.documentUrl??null:null,Ze=Je!==null&&F?.links.some(e=>e.kind===`document`),Qe=(0,I.useRef)(null),$e=(0,I.useRef)(null),[et,tt]=(0,I.useState)(null),nt=Zm(e,Qe,m&&Je!==null?F:null,a,$e),rt=ye!==null&&(!De||(Ee?Oe.status===`failed`||Oe.status===`ready`&&Fe.status!==`loading`:Fe.status===`failed`)),it=!c&&(A===null||(Je===null?Ce!==null||rt:et===Je)),at=(0,I.useCallback)(e=>{e!==null&&it&&g?.()},[it,g]);(0,I.useLayoutEffect)(()=>{he.current&&(ye!==null||qe)&&(he.current.scrollTop=ve.current)},[ye,qe]);let ot=(0,I.useMemo)(()=>{if(!F)return;let e=new Set(F.assets.filter(e=>e.role===`image`||e.role===`svg`).map(e=>e.logicalPath));return t=>{let n=wt(t,F.documentLogicalPath);return n===null||!e.has(n)?null:`${F.filesBaseUrl}${s(n)}`}},[F]),st=(0,I.useCallback)(async n=>{me(null);try{await e.openLink(t.documentId,n),fe(null)}catch(e){if(e instanceof ee&&e.code===`E_CONFIRMATION_REQUIRED`){fe({...n,path:String(e.details.path??``),confirmation:String(e.details.confirmation??``),changed:e.details.changed===!0});return}fe(null),me(e instanceof Error?e.message:`Could not open the link.`)}},[e,t.documentId]),ct=(0,I.useCallback)(e=>{let t=F?.links.find(t=>t.href===e);F&&t?.kind===`document`&&st({linkId:t.linkId,revision:F.revision,mode:F.mode})},[F,st]),lt=(0,I.useEffectEvent)(e=>{m&&de===null&&st(e)});(0,I.useLayoutEffect)(()=>{let e=Qe.current;if(!e||!Ze||!F)return;let t,n=({data:t})=>{if(e.closest(`[inert]`)||typeof t!=`string`)return;let n=F.links.find(e=>e.kind===`document`&&e.linkId===t);n&<({linkId:n.linkId,revision:F.revision,mode:F.mode})},r=r=>{if(r.source===null||r.source!==e.contentWindow||r.origin!==`null`||r.data!==`vde-open:document-links`||r.ports.length!==1)return;let[i]=r.ports;if(i){if(t&&F.mode===`interactive`){i.close();return}t?.(),i.addEventListener(`message`,n),i.start(),t=()=>{i.removeEventListener(`message`,n),i.close()}}};return window.addEventListener(`message`,r),()=>{window.removeEventListener(`message`,r),t?.()}},[Ze,F]);let ut=(0,I.useMemo)(()=>(0,K.jsx)(h,{code:!0,label:`code`,text:i}),[]),dt=k&&!ce&&t.revision!==A,ft=(0,I.useMemo)(()=>new Map(F?.headingTargets.map(e=>[e.sectionId,e.anchor])??[]),[F]),pt=qe?null:Je===null?Ee?`Available in the Markdown preview`:`Available in the HTML preview`:F?.mode===`static`?j?.revision===F.revision?null:`Available once the outline of the shown revision has loaded`:`Not available in the Interactive view (jumping reloads the view and restarts its scripts)`,mt=e=>pt===null&&(qe||ft.get(e.sectionId)===e.anchor),ht=(0,I.useCallback)(e=>{if(qe){ch(he.current,e.anchor)?.scrollIntoView({block:`start`});return}Je!==null&&Qe.current?.contentWindow?.location.replace(`${Je}#${l(e.anchor)}`)},[qe,Je]),gt=u?.nonce??0,[_t,vt]=(0,I.useState)(0),yt=u!==null&&A!==null&&j?.revision===A,bt=yt&&u.revision===A,St=bt&&qe?be.find(e=>e.sectionId===u.sectionId)??null:null,Ct=u===null||gt===_t?null:yt?bt?qe?null:`This view does not jump to sections (only the Markdown preview does).`:ce?`The search result is in a different revision than the one shown. The view is showing the question's revision while awaiting an answer, so it did not jump.`:k?`The search result is in a different revision than the one shown. Updates are paused, so the view did not jump.`:`The document was updated after the search, so the view did not jump to the section. Search again.`:Ce===null?null:`The revision to show could not be loaded, so the view did not jump to the section.`;(0,I.useEffect)(()=>{St!==null&>!==0&&(ht(St),f?.({sectionId:St.sectionId,title:St.title}))},[St,gt,ht,f]);let Tt=d!==null&&pt===null&&A!==null&&j?.revision===A&&xe===null,Et=Tt?be.find(e=>e.sectionId===d.sectionId&&e.title===d.title)??be.find(e=>e.title===d.title)??null:null,Dt=Et!==null&&mt(Et),Ot=d?.id??null,kt=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(Tt&&Ot!==null&&kt.current!==Ot){if(kt.current=Ot,Et===null||!Dt){f?.(null);return}ht(Et),f?.({sectionId:Et.sectionId,title:Et.title})}},[Tt,Ot,Et,Dt,ht,f]);let Mt=[...F?.diagnostics??[],...Re.map(e=>({code:`asset-requested`,target:e,count:1}))],Nt=F?.mode??`static`,Pt=Ee?[]:F?.links??[],Ft=[...Ct?[{label:`Section not reached`,message:Ct,dismiss:()=>vt(gt),testId:`section-target-notice`}]:[],...t.sourceState!==`ready`&&sh[t.sourceState]?[{label:t.sourceState===`missing`?`File missing`:`File unreadable`,message:sh[t.sourceState]}]:[],...!Ee&&De&&Fe.status===`failed`?[{label:`Showing source`,message:`The HTML could not be converted for display, so the source is shown (${Fe.message}).`}]:[],...Ee&&De&&Oe.status===`failed`?[{label:`Showing source`,message:oh[Oe.reason]??oh[`parse-error`]}]:[],...Ce?[{label:`Could not load document`,message:Ce}]:[],...pe?[{label:`Could not open link`,message:pe,dismiss:()=>me(null)}]:[],...Je===null&&He?[{label:`Script change failed`,message:He,dismiss:()=>Ue(null)}]:[]],It=Je===null&&(Mt.length>0||Pt.length>0),Lt=(0,K.jsxs)(K.Fragment,{children:[Mt.length>0&&(0,K.jsx)(le,{title:`Differences from the original document`,trigger:(0,K.jsxs)(P,{variant:`ghost`,size:`xs`,"data-testid":`render-diagnostics`,children:[`Differences (`,Mt.length,`)`]}),children:(0,K.jsx)(`ul`,{className:`flex list-disc flex-col gap-1 pl-5 text-muted-foreground`,children:Mt.map(e=>(0,K.jsx)(`li`,{className:`break-words`,children:Lm(e)},`${e.code}:${e.target??``}`))})}),Pt.length>0&&(0,K.jsx)(le,{title:`Links in this document`,trigger:(0,K.jsxs)(P,{variant:`ghost`,size:`xs`,"data-testid":`render-links`,children:[`Links (`,Pt.length,`)`]}),children:(0,K.jsx)(`ul`,{className:`flex flex-col gap-1`,children:Pt.map(e=>(0,K.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[e.kind===`external`&&(0,K.jsx)(`a`,{className:`underline underline-offset-2`,href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:e.text||e.href}),e.kind===`document`&&(0,K.jsx)(P,{variant:`link`,size:`xs`,className:`h-auto p-0`,onClick:()=>{F&&st({linkId:e.linkId,revision:F.revision,mode:F.mode})},children:e.text||e.href}),e.kind===`other`&&(0,K.jsx)(`span`,{children:e.text||e.href}),(0,K.jsxs)(`span`,{className:`text-xs break-all text-muted-foreground`,children:[e.href,e.kind===`other`&&` (this kind of link cannot be opened)`]})]},e.linkId))})})]});return(0,K.jsxs)(`section`,{ref:at,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col`,"aria-label":`Document view`,children:[(0,K.jsxs)(At,{document:t,children:[ce?(0,K.jsx)(xt,{variant:`secondary`,title:`Showing revision ${A?.slice(4,12)??``}, which the question is about`,children:`Question's revision`}):k&&(dt?(0,K.jsxs)(le,{title:`A newer revision is available`,trigger:(0,K.jsxs)(P,{variant:`ghost`,size:`xs`,className:`text-link`,children:[(0,K.jsx)(jt,{"aria-hidden":`true`}),`Update available`]}),children:[(0,K.jsx)(`p`,{children:`Updates are paused. The view stays on the revision from when they were paused.`}),(0,K.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>oe(null),children:`Resume updates`})]}):(0,K.jsx)(xt,{variant:`secondary`,children:`Updates paused`})),(0,K.jsxs)(jm,{value:[_],onValueChange:e=>{let t=e[0];Me(t)&&(t===`preview`&&_!==`preview`&&!Ee&&Pe(e=>e+1),v(t))},spacing:.5,className:Nm,"aria-label":`View`,children:[(0,K.jsx)(Mm,{value:`preview`,className:Pm,children:`Preview`}),(0,K.jsx)(Mm,{value:`source`,className:Pm,children:`Source`})]}),(0,K.jsx)(Se,{}),Ee&&De&&(0,K.jsx)(P,{variant:`ghost`,size:`icon-sm`,className:$m,"aria-pressed":y===`wide`,"aria-label":`Wide view`,title:y===`wide`?`Return to standard Markdown width`:`Use the full available width for Markdown`,onClick:()=>b(y===`wide`?`standard`:`wide`),children:(0,K.jsx)(Od,{"aria-hidden":`true`})}),we&&re&&(0,K.jsx)(P,{variant:`ghost`,size:`icon-sm`,className:$m,"aria-pressed":D===`shown`,"aria-label":`Outline`,title:D===`shown`?`Hide the outline`:`Show the outline`,onClick:()=>O(D===`shown`?`hidden`:`shown`),children:(0,K.jsx)(sf,{"aria-hidden":`true`})}),(0,K.jsx)(P,{variant:`ghost`,size:`icon-sm`,className:$m,"aria-pressed":k,"aria-label":k?`Resume updates`:`Pause updates`,disabled:ce,title:ce?`A question is awaiting an answer, so the question's revision is shown`:k?`Resume updates`:`Pause updates (keep showing this revision)`,onClick:()=>oe(k?null:t.revision),children:k?(0,K.jsx)(Le,{"aria-hidden":`true`}):(0,K.jsx)(Ie,{"aria-hidden":`true`})}),(0,K.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh`,title:`Read the file again`,onClick:()=>void e.refresh(t.documentId).catch(()=>void 0),children:(0,K.jsx)(Xe,{"aria-hidden":`true`})}),(0,K.jsxs)(le,{title:`PDF export failed`,enabled:We.error!==null,trigger:(0,K.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":`Export PDF`,"aria-busy":We.exporting,className:We.error?`text-destructive`:void 0,disabled:We.exporting||j===null,title:We.exporting?`Exporting…`:Ee?`Export PDF`:`Export PDF (static HTML; scripts and interactive changes are not included)`,onClick:()=>{We.error===null&&j!==null&&Hm.start(e,t,j.revision)},children:We.error?(0,K.jsx)(jt,{"aria-hidden":`true`}):We.exporting?(0,K.jsx)(_e,{"aria-hidden":`true`,className:`animate-spin`}):(0,K.jsx)(Ad,{"aria-hidden":`true`})}),children:[(0,K.jsx)(`p`,{children:We.error}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>{j&&Hm.start(e,t,j.revision)},children:`Try again`}),(0,K.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>Hm.dismiss(t.documentId),children:`Dismiss`})]})]})]}),(We.error||pe)&&(0,K.jsxs)(`span`,{role:`alert`,className:`sr-only`,children:[We.error,pe]}),(Ft.length>0||It)&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 border-b px-3 py-1`,"data-testid":`document-notices`,children:[Ft.map(e=>(0,K.jsxs)(le,{title:e.label,trigger:(0,K.jsxs)(P,{variant:`ghost`,size:`xs`,className:`text-destructive`,"data-testid":`testId`in e?e.testId:void 0,children:[(0,K.jsx)(jt,{"aria-hidden":`true`}),e.label]}),children:[(0,K.jsx)(`p`,{children:e.message}),`dismiss`in e&&(0,K.jsx)(P,{variant:`outline`,size:`sm`,onClick:e.dismiss,children:`Dismiss`})]},e.label)),It&&Lt,(0,K.jsx)(`span`,{role:`status`,className:`sr-only`,children:Ft.map(e=>e.message).join(` `)})]}),(0,K.jsxs)(`div`,{ref:w,className:`flex min-h-0 min-w-0 flex-1`,children:[Je?(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,K.jsx)(xm,{mode:Nt,bridge:nt,pinnedStatic:Ae,needsPermission:t.htmlMode===`interactive`&&!t.interactiveAllowed&&!Ae,modeError:He,onRunScripts:()=>Ve(!0),onStopScripts:()=>Ge(`static`),onReload:()=>Pe(e=>e+1),children:Lt}),(0,K.jsx)(`iframe`,{ref:Qe,title:`View of ${t.title}`,src:Je,onLoad:()=>{let e=$e.current;$e.current={url:Je,count:e?.url===Je?e.count+1:1},tt(Je)},sandbox:Nt===`interactive`||Ze?`allow-scripts`:``,referrerPolicy:`no-referrer`,className:`min-h-0 w-full flex-1 border-0 bg-white`,"data-testid":`document-frame`},Je)]}):(0,K.jsx)(`div`,{ref:he,className:`min-w-0 flex-1 overflow-y-auto px-6 py-5`,"data-testid":`document-body`,children:ye===null?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:Ce===null?`Loading…`:`Could not load this document.`}):qe?(0,K.jsx)(`article`,{className:`markdown-body mx-auto`,"data-width":y,children:(0,K.jsx)(se,{document:Oe.document,...ot?{resolveImage:ot}:{},onOpenLink:ct,codeActions:ut})}):De&&(Ee?Oe.status===`parsing`:Fe.status===`loading`)?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Preparing the view…`}):(0,K.jsx)(`pre`,{className:`font-mono text-sm leading-relaxed break-words whitespace-pre-wrap`,children:ye})}),we&&D===`shown`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_m,{label:`Resize outline`,controls:C,width:ne,min:eh,max:te,onResize:ie,style:re?void 0:{display:`none`}}),(0,K.jsxs)(`aside`,{id:C,style:{width:ne,display:re?void 0:`none`},className:`shrink-0 overflow-y-auto py-3 pr-2`,"aria-label":`Outline`,children:[xe!==null&&(0,K.jsxs)(`p`,{className:`px-2 text-xs text-destructive`,role:`alert`,children:[`Could not fetch the outline (`,xe,`).`]}),(0,K.jsx)(`ul`,{className:`flex flex-col text-sm`,children:be.map(e=>{let t=mt(e);return(0,K.jsx)(`li`,{style:{paddingLeft:`${String((e.level-1)*.75)}rem`},children:(0,K.jsx)(`button`,{type:`button`,className:p(`w-full truncate rounded px-2 py-1 text-left hover:bg-foreground/5 disabled:opacity-50`,e.level>1&&`text-muted-foreground hover:text-foreground`),disabled:!t,title:t?e.title:pt??`This heading is not in the view (removed from the display, or an earlier element has the same id)`,onClick:()=>{ht(e),f?.({sectionId:e.sectionId,title:e.title})},children:e.title})},e.sectionId)})})]})]})]}),(0,K.jsx)(kf,{open:Be,onOpenChange:Ve,children:(0,K.jsxs)(Mf,{children:[(0,K.jsxs)(Nf,{children:[(0,K.jsx)(Ff,{children:`Run the scripts in this document?`}),(0,K.jsxs)(If,{children:[`This runs the scripts in this HTML inside your browser. `,(0,K.jsx)(vm,{}),` This is not a mechanism for running arbitrary scripts safely. Enable it only for trusted HTML that you or your agent prepared.`]})]}),(0,K.jsxs)(Pf,{children:[(0,K.jsx)(Rf,{children:`Back`}),(0,K.jsx)(Lf,{onClick:()=>Ge(`interactive`),children:`Run scripts`})]})]})}),(0,K.jsx)(kf,{open:de!==null,onOpenChange:e=>{e||fe(null)},children:(0,K.jsxs)(Mf,{children:[(0,K.jsxs)(Nf,{children:[(0,K.jsx)(Ff,{children:`Add this document to the list and open it?`}),(0,K.jsx)(If,{className:`break-all`,children:de?.path})]}),de?.changed&&(0,K.jsx)(`p`,{className:`text-sm font-medium`,children:`While you were confirming, the link target changed or the confirmation expired. Check the path above again.`}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This is the file that a link in the document points to. It is not open yet. Opening it adds it to the document list and to search.`}),(0,K.jsxs)(Pf,{children:[(0,K.jsx)(Rf,{children:`Don't open`}),(0,K.jsx)(Lf,{onClick:()=>{de&&st(de)},children:`Add to list and open`})]})]})})]})}function dh(e,t,n,r){let[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(0),c=(0,I.useCallback)(()=>s(e=>e+1),[]),l=`${String(n)}\n${r??``}\n${String(o)}`;(0,I.useEffect)(()=>{if(t===null)return;let n=!1;return e.feedback(t).then(e=>{n||a({requestId:t,fetchedFor:l,request:e,error:null})},e=>{n||a(n=>({requestId:t,fetchedFor:l,request:n?.requestId===t?n.request:null,error:e instanceof Error?e.message:`Could not fetch the question.`}))}),()=>{n=!0}},[e,t,l]);let u=i!==null&&i.requestId===t?i:null;return{request:u?.request??null,error:u?.error??null,reload:c}}function fh({documents:e,...t}){let[n,r]=(0,I.useState)(t.document.documentId),i=e.find(e=>e.documentId===n),a=i!==void 0&&i.documentId!==t.document.documentId,o=a?[i,t.document]:[t.document],s=(0,I.useCallback)(()=>r(t.document.documentId),[t.document.documentId]);return(0,K.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1`,"aria-busy":a,children:o.map(e=>{let n=e.documentId===t.document.documentId,r=!a||!n;return(0,K.jsx)(`div`,{className:r?`flex min-h-0 min-w-0 flex-1`:`invisible absolute inset-0 flex min-h-0 min-w-0`,"aria-hidden":!r,inert:a,"data-testid":`document-workspace`,children:(0,K.jsx)(yh,{...t,document:e,displayed:r,onReady:n?s:void 0,sectionTarget:n&&r?t.sectionTarget:null,restoreHeading:n&&r?t.restoreHeading:null,onHeadingShown:n&&r?t.onHeadingShown:void 0})},e.documentId)})})}var ph=280,mh=640,hh=360,gh=320,_h=8,vh=e=>typeof e==`number`&&Number.isInteger(e)&&e>=ph&&e<=mh;function yh({api:e,document:t,daemonId:n=null,feedbackSignal:r,renderSignal:i,sectionTarget:a=null,restoreHeading:o=null,onHeadingShown:s,displayed:c=!0,onReady:l}){let u=t.pendingRequestIds[0]??null,[d,f]=(0,I.useState)(u);u!==null&&u!==d&&f(u);let p=u??d,{request:m,error:h,reload:g}=dh(e,p,r,t.revision),_=m?.status===`pending`?m.revision:null,v=u!==null&&m===null&&h===null,[y,b]=Ye(`answer-width`,hh,vh),x=(0,I.useId)(),S=(0,I.useRef)(null),[C,w]=(0,I.useState)(0);(0,I.useLayoutEffect)(()=>{let e=S.current;if(!e)return;let t=()=>w(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let T=Math.max(ph,Math.min(mh,C-_h-gh)),E=Math.min(y,T);return(0,K.jsxs)(`div`,{ref:S,className:`flex min-w-0 flex-1 flex-col min-[900px]:flex-row`,style:{"--answer-width":`${String(E)}px`},children:[(0,K.jsx)(lh,{api:e,document:t,daemonId:n,fixedRevision:_,request:m,renderSignal:i,waitingForRequest:v,sectionTarget:a,restoreHeading:o,displayed:c,...l?{onReady:l}:{},...s?{onHeadingShown:s}:{}}),m?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(_m,{label:`Resize answer panel`,controls:x,width:E,min:ph,max:T,onResize:e=>b(Math.round(Math.min(T,Math.max(ph,e)))),className:`hidden min-[900px]:block`}),(0,K.jsx)(gm,{id:x,api:e,request:m,reload:g},m.requestId)]}):h!==null&&p!==null&&(0,K.jsx)(`aside`,{"aria-label":`Answer the question`,className:`w-full shrink-0 border-t px-3 py-3 min-[900px]:w-(--answer-width) min-[900px]:border-t-0 min-[900px]:border-l`,children:(0,K.jsxs)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:[`Could not fetch the question (`,h,`).`]})})]})}var bh=ke(function(e){return gf(`dialog`,e)});function xh({...e}){return(0,K.jsx)(bh,{"data-slot":`dialog`,...e})}function Sh({...e}){return(0,K.jsx)(Df,{"data-slot":`dialog-portal`,...e})}function Ch({className:e,...t}){return(0,K.jsx)(vf,{"data-slot":`dialog-overlay`,className:p(`fixed inset-0 isolate z-50 bg-black/20 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function wh({className:e,children:t,showCloseButton:n=!0,...r}){return(0,K.jsxs)(Sh,{children:[(0,K.jsx)(Ch,{}),(0,K.jsxs)(Ef,{"data-slot":`dialog-content`,className:p(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,K.jsxs)(yf,{"data-slot":`dialog-close`,render:(0,K.jsx)(P,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,K.jsx)(at,{}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Th({className:e,...t}){return(0,K.jsx)(`div`,{"data-slot":`dialog-header`,className:p(`flex flex-col gap-2`,e),...t})}function Eh({className:e,...t}){return(0,K.jsx)(Of,{"data-slot":`dialog-title`,className:p(`font-heading text-base leading-none font-medium`,e),...t})}function Dh({className:e,...t}){return(0,K.jsx)(bf,{"data-slot":`dialog-description`,className:p(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}var Oh=200,kh=20;function Ah({api:e,open:t,onOpenChange:n,onSelect:r}){let[i,a]=(0,I.useState)(``),[o,s]=(0,I.useState)(null),[c,l]=(0,I.useState)(0),u=(0,I.useId)(),d=i.trim();(0,I.useEffect)(()=>{if(!t||d===``)return;let n=!1,r=setTimeout(()=>{e.search(d,kh).then(e=>{n||s({query:d,result:e,error:null})},e=>{n||s({query:d,result:null,error:e instanceof Error?e.message:`Search failed.`})})},Oh);return()=>{n=!0,clearTimeout(r)}},[e,t,d]);let f=o!==null&&o.query===d?o:null,p=f?.result?.hits??[],m=e=>Math.max(0,Math.min(e,p.length-1)),h=m(c);(0,I.useEffect)(()=>{p.length!==0&&window.document.getElementById(`${u}-${String(h)}`)?.scrollIntoView?.({block:`nearest`})},[h,p.length,u]);let g=e=>{e&&(n(!1),r(e))};return(0,K.jsx)(xh,{open:t,onOpenChange:e=>{n(e),e||(a(``),l(0))},children:(0,K.jsxs)(wh,{className:`top-[12%] translate-y-0 gap-0 overflow-hidden p-0 sm:max-w-xl`,children:[(0,K.jsxs)(Th,{className:`sr-only`,children:[(0,K.jsx)(Eh,{children:`Search open documents`}),(0,K.jsx)(Dh,{children:`Only documents that are currently open are searched. Closed documents and other files are not.`})]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-b pr-10 pl-3`,children:[(0,K.jsx)(ef,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,K.jsx)(Sp,{"aria-label":`Search query`,"aria-controls":u,"aria-activedescendant":p.length>0?`${u}-${String(h)}`:void 0,placeholder:`Search open documents`,className:`h-11 border-0 bg-transparent px-0 shadow-none focus-visible:ring-0 dark:bg-transparent`,value:i,onChange:e=>{a(e.target.value),l(0)},onKeyDown:e=>{e.nativeEvent.isComposing||p.length!==0&&(e.key===`ArrowDown`?(e.preventDefault(),l(e=>m(m(e)+1))):e.key===`ArrowUp`?(e.preventDefault(),l(e=>m(m(e)-1))):e.key===`Enter`&&(e.preventDefault(),g(p[h])))}})]}),(0,K.jsx)(`div`,{id:u,role:`listbox`,"aria-label":`Search results`,className:`flex max-h-[min(24rem,60svh)] flex-col overflow-y-auto p-1.5 empty:hidden`,children:p.map((e,t)=>{let n=e.headingPath[0]===e.title?e.headingPath.slice(1):e.headingPath;return(0,K.jsxs)(`div`,{id:`${u}-${String(t)}`,role:`option`,"aria-selected":t===h,className:`cursor-pointer rounded-md px-2.5 py-1.5 aria-selected:bg-selection`,tabIndex:-1,onMouseEnter:()=>l(t),onClick:()=>g(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),g(e))},children:[(0,K.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,K.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:e.title}),n.length>0&&(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[` › `,n.join(` › `)]})]}),e.displayPath&&(0,K.jsx)(`p`,{className:`max-w-[45%] shrink-0 truncate text-xs text-muted-foreground`,children:e.displayPath})]}),(0,K.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.excerpt})]},`${e.documentId}:${e.sectionId}`)})}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t bg-chrome px-3 py-1.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`min-w-0`,children:d===``?`Searches open documents only`:f===null?`Searching…`:f.error===null?`${String(p.length)} ${p.length===1?`result`:`results`}${f.result?.incomplete===!0?`, some documents are still being indexed`:``}`:`Search failed (${f.error})`}),(0,K.jsxs)(`p`,{className:`hidden shrink-0 gap-3 sm:flex`,"aria-hidden":`true`,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{className:`font-sans`,children:`↑↓`}),` Select`]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{className:`font-sans`,children:`↵`}),` Open`]}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`kbd`,{className:`font-sans`,children:`Esc`}),` Close`]})]})]})]})})}var jh=Symbol.for(`preact-signals`);function Mh(){if(Lh>1)Lh--;else{var e,t=!1;for((function(){var e=Vh;for(Vh=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();Ih!==void 0;){var n=Ih;for(Ih=void 0,Rh++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Kh(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Rh=0,Lh--,t)throw e}}function Nh(e){if(Lh>0)return e();Bh=++zh,Lh++;try{return e()}finally{Mh()}}var Ph,Fh=void 0;function q(e){var t=Fh,n=Ph;Fh=void 0,Ph=void 0;try{return e()}finally{Fh=t,Ph=n}}var Ih=void 0,Lh=0,Rh=0,zh=0,Bh=0,Vh=void 0,Hh=0;function Uh(e){if(Fh!==void 0){var t=e.n;if(t===void 0||t.t!==Fh)return t={i:0,S:e,p:Fh.s,n:void 0,t:Fh,e:void 0,x:void 0,r:t},Fh.s!==void 0&&(Fh.s.n=t),Fh.s=t,e.n=t,32&Fh.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Fh.s,t.n=void 0,Fh.s.n=t,Fh.s=t),t}}function Wh(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Wh.prototype.brand=jh,Wh.prototype.h=function(){return!0},Wh.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?q(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},Wh.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&q(function(){var e;(e=t.Z)==null||e.call(t)}))}},Wh.prototype.subscribe=function(e){var t=this;return tg(function(){var n=t.value;q(function(){return e(n)})},{name:`sub`})},Wh.prototype.valueOf=function(){return this.value},Wh.prototype.toString=function(){return this.value+``},Wh.prototype.toJSON=function(){return this.value},Wh.prototype.peek=function(){var e=this;return q(function(){return e.value})},Object.defineProperty(Wh.prototype,"value",{get:function(){var e=Uh(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Rh>100)throw Error(`Cycle detected`);(function(e){Lh!==0&&Rh===0&&e.l!==Bh&&(e.l=Bh,Vh={S:e,v:e.v,i:e.i,o:Vh})})(this),this.v=e,this.i++,Hh++,Lh++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Mh()}}}});function Gh(e,t){return new Wh(e,t)}function Kh(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function qh(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Jh(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Yh(e,t){Wh.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Hh-1,this.f=4}Yh.prototype=new Wh,Yh.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Hh))return!0;if(this.g=Hh,this.f|=1,this.i>0&&!Kh(this))return this.f&=-2,!0;var e=Fh;try{qh(this),Fh=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Fh=e,Jh(this),this.f&=-2,!0},Yh.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Wh.prototype.S.call(this,e)},Yh.prototype.U=function(e){if(this.t!==void 0&&(Wh.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Yh.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Yh.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=Uh(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Xh(e,t){return new Yh(e,t)}function Zh(e){var t=e.m;if(e.m=void 0,typeof t==`function`){Lh++;var n=Fh;Fh=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Qh(e),t}finally{Fh=n,Mh()}}}function Qh(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Zh(e)}function $h(e){if(Fh!==this)throw Error(`Out-of-order effect`);Jh(this),Fh=e,this.f&=-2,8&this.f&&Qh(this),Mh()}function eg(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Ph&&Ph.push(this)}eg.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},eg.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Zh(this),qh(this),Lh++;var e=Fh;return Fh=this,$h.bind(this,e)},eg.prototype.N=function(){2&this.f||(this.f|=2,this.u=Ih,Ih=this)},eg.prototype.d=function(){this.f|=8,1&this.f||Qh(this)},eg.prototype.dispose=function(){this.d()};function tg(e,t){var n=new eg(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var ng=Object.create,rg=Object.defineProperty,ig=Object.defineProperties,ag=Object.getOwnPropertyDescriptor,og=Object.getOwnPropertyDescriptors,sg=Object.getOwnPropertySymbols,cg=Object.prototype.hasOwnProperty,lg=Object.prototype.propertyIsEnumerable,ug=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),dg=e=>{throw TypeError(e)},fg=(e,t,n)=>t in e?rg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pg=(e,t)=>{for(var n in t||={})cg.call(t,n)&&fg(e,n,t[n]);if(sg)for(var n of sg(t))lg.call(t,n)&&fg(e,n,t[n]);return e},mg=(e,t)=>ig(e,og(t)),hg=(e,t)=>rg(e,`name`,{value:t,configurable:!0}),gg=e=>[,,,ng(e?.[ug(`metadata`)]??null)],_g=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],vg=e=>e!==void 0&&typeof e!=`function`?dg(`Function expected`):e,yg=(e,t,n,r,i)=>({kind:_g[e],name:t,metadata:r,addInitializer:e=>n._?dg(`Already initialized`):i.push(vg(e||null))}),bg=(e,t)=>fg(t,ug(`metadata`),e[3]),xg=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},Sg=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=_g[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&ag(d<4?i:{get[n](){return Tg(this,a)},set[n](e){return Dg(this,a,e)}},n));d?p&&d<4&&hg(a,(d>2?`set `:d>1?`get `:``)+n):hg(i,n);for(var y=r.length-1;y>=0;y--)l=yg(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>wg(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?Tg:Og)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>Dg(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?vg(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?dg(`Object expected`):(vg(o=s.get)&&(v.get=o),vg(o=s.set)&&(v.set=o),vg(o=s.init)&&g.unshift(o));return d||bg(e,i),v&&rg(i,n,v),p?d^4?a:v:i},Cg=(e,t,n)=>t.has(e)||dg(`Cannot `+n),wg=(e,t)=>Object(t)===t?e.has(t):dg(`Cannot use the "in" operator on this value`),Tg=(e,t,n)=>(Cg(e,t,`read from private field`),n?n.call(e):t.get(e)),Eg=(e,t,n)=>t.has(e)?dg(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Dg=(e,t,n,r)=>(Cg(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),Og=(e,t,n)=>(Cg(e,t,`access private method`),n);function kg(e,t){if(t){let n;return Xh(()=>{let r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return Xh(e)}function Ag(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e==`function`&&typeof t==`function`)return e===t;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((e,n)=>!Ag(e,t[n]));if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&!n.some(n=>!Ag(e[n],t[n]))}return!1}function J({get:e},t){return{init(e){return Gh(e)},get(){return e.call(this).value},set(t){let n=e.call(this);n.peek()!==t&&(n.value=t)}}}function jg(e,t){let n=new WeakMap;return function(){let t=n.get(this);return t||(t=kg(e.bind(this)),n.set(this,t)),t.value}}function Mg(e=!0){return function(t,n){n.addInitializer(function(){let t=n.kind===`field`||n.static?this:Object.getPrototypeOf(this),r=Object.getOwnPropertyDescriptor(t,n.name);r&&Object.defineProperty(t,n.name,mg(pg({},r),{enumerable:e}))})}}function Ng(...e){let t=e.map(e=>tg(e));return()=>t.forEach(e=>e())}var Pg,Fg,Ig,Lg,Rg,zg=[J],Bg,Vg,Hg,Ug,Wg,Gg,Kg,qg,Jg,Yg,Xg,Zg,Qg,$g;Rg=[J],Lg=[J],Ig=[Mg()],Fg=[Mg()],Pg=[Mg()];var e_=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,xg(Bg,5,this),Eg(this,Gg),Eg(this,Vg,xg(Bg,8,this)),xg(Bg,11,this),Eg(this,Kg,xg(Bg,12,this)),xg(Bg,15,this),Eg(this,Xg,xg(Bg,16,this)),xg(Bg,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return Tg(this,Gg,Qg)}get initial(){return Tg(this,Gg,Ug)}get previous(){return Tg(this,Gg,Jg)}set current(e){let t=q(()=>Tg(this,Gg,Qg));e&&t&&this.equals(t,e)||Nh(()=>{Tg(this,Gg,Ug)||Dg(this,Gg,e,Wg),Dg(this,Gg,t,Yg),Dg(this,Gg,e,$g)})}reset(e=this.defaultValue){Nh(()=>{Dg(this,Gg,void 0,Yg),Dg(this,Gg,e,Wg),Dg(this,Gg,e,$g)})}};Bg=gg(null),Vg=new WeakMap,Gg=new WeakSet,Kg=new WeakMap,Xg=new WeakMap,Hg=Sg(Bg,20,`#initial`,zg,Gg,Vg),Ug=Hg.get,Wg=Hg.set,qg=Sg(Bg,20,`#previous`,Rg,Gg,Kg),Jg=qg.get,Yg=qg.set,Zg=Sg(Bg,20,`#current`,Lg,Gg,Xg),Qg=Zg.get,$g=Zg.set,Sg(Bg,2,`current`,Ig,e_),Sg(Bg,2,`initial`,Fg,e_),Sg(Bg,2,`previous`,Pg,e_),bg(Bg,e_);function t_(e){return q(()=>{let t={};for(let n in e)t[n]=e[n];return t})}var n_,r_=class{constructor(){Eg(this,n_,new WeakMap)}get(e,t){return e?Tg(this,n_).get(e)?.get(t):void 0}set(e,t,n){if(e)return Tg(this,n_).has(e)||Tg(this,n_).set(e,new Map),Tg(this,n_).get(e)?.set(t,n)}clear(e){return e?Tg(this,n_).get(e)?.clear():void 0}};n_=new WeakMap;var i_=Object.create,a_=Object.defineProperty,o_=Object.getOwnPropertyDescriptor,s_=Object.getOwnPropertySymbols,c_=Object.prototype.hasOwnProperty,l_=Object.prototype.propertyIsEnumerable,u_=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),d_=e=>{throw TypeError(e)},f_=Math.pow,p_=(e,t,n)=>t in e?a_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m_=(e,t)=>{for(var n in t||={})c_.call(t,n)&&p_(e,n,t[n]);if(s_)for(var n of s_(t))l_.call(t,n)&&p_(e,n,t[n]);return e},h_=(e,t)=>a_(e,`name`,{value:t,configurable:!0}),g_=e=>[,,,i_(e?.[u_(`metadata`)]??null)],__=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],v_=e=>e!==void 0&&typeof e!=`function`?d_(`Function expected`):e,y_=(e,t,n,r,i)=>({kind:__[e],name:t,metadata:r,addInitializer:e=>n._?d_(`Already initialized`):i.push(v_(e||null))}),b_=(e,t)=>p_(t,u_(`metadata`),e[3]),x_=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},S_=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=__[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&o_(d<4?i:{get[n](){return T_(this,a)},set[n](e){return D_(this,a,e)}},n));d?p&&d<4&&h_(a,(d>2?`set `:d>1?`get `:``)+n):h_(i,n);for(var y=r.length-1;y>=0;y--)l=y_(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>w_(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?T_:O_)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>D_(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?v_(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?d_(`Object expected`):(v_(o=s.get)&&(v.get=o),v_(o=s.set)&&(v.set=o),v_(o=s.init)&&g.unshift(o));return d||b_(e,i),v&&a_(i,n,v),p?d^4?a:v:i},C_=(e,t,n)=>t.has(e)||d_(`Cannot `+n),w_=(e,t)=>Object(t)===t?e.has(t):d_(`Cannot use the "in" operator on this value`),T_=(e,t,n)=>(C_(e,t,`read from private field`),n?n.call(e):t.get(e)),E_=(e,t,n)=>t.has(e)?d_(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),D_=(e,t,n,r)=>(C_(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),O_=(e,t,n)=>(C_(e,t,`access private method`),n),k_=class e{constructor(e,t){this.x=e,this.y=t}static delta(t,n){return new e(t.x-n.x,t.y-n.y)}static distance(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}static equals(e,t){return e.x===t.x&&e.y===t.y}static from({x:t,y:n}){return new e(t,n)}},A_=class e{constructor(e,t,n,r){this.left=e,this.top=t,this.width=n,this.height=r,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){let{top:r,left:i,width:a,height:o,scale:s}=this,c=new e(i+t,r+n,a,o);return c.scale=m_({},s),c}get boundingRectangle(){let{width:e,height:t,left:n,top:r,right:i,bottom:a}=this;return{width:e,height:t,left:n,top:r,right:i,bottom:a}}get center(){let{left:e,top:t,right:n,bottom:r}=this;return new k_((e+n)/2,(t+r)/2)}get area(){let{width:e,height:t}=this;return e*t}equals(t){if(!(t instanceof e))return!1;let{left:n,top:r,width:i,height:a}=this;return n===t.left&&r===t.top&&i===t.width&&a===t.height}containsPoint(e){let{top:t,left:n,bottom:r,right:i}=this;return t<=e.y&&e.y<=r&&n<=e.x&&e.x<=i}intersectionArea(t){return t instanceof e?j_(this,t):0}intersectionRatio(e){let{area:t}=this,n=this.intersectionArea(e);return n/(e.area+t-n)}get bottom(){let{top:e,height:t}=this;return e+t}get right(){let{left:e,width:t}=this;return e+t}get aspectRatio(){let{width:e,height:t}=this;return e/t}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:i}){return new e(n,t,r,i)}static delta(e,t,n={x:`center`,y:`center`}){let r=(e,t)=>{let r=n[t],i=t===`x`?e.left:e.top,a=t===`x`?e.width:e.height;return r==`start`?i:r==`end`?i+a:i+a/2};return k_.delta({x:r(e,`x`),y:r(e,`y`)},{x:r(t,`x`),y:r(t,`y`)})}static intersectionRatio(t,n){return e.from(t).intersectionRatio(e.from(n))}};function j_(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;return r<i&&n<a?o*s:0}var M_,N_,P_,F_,I_,L_=class extends (P_=e_,N_=[jg],M_=[jg],P_){constructor(e){let t=k_.from(e);super(t,(e,t)=>k_.equals(e,t)),x_(I_,5,this),E_(this,F_,0),this.velocity={x:0,y:0}}get delta(){return k_.delta(this.current,this.initial)}get direction(){let{current:e,previous:t}=this;if(!t)return null;let n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?`right`:`left`:n.y>0?`down`:`up`}get current(){return super.current}set current(e){let{current:t}=this,n=k_.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),a=i-T_(this,F_),o=e=>Math.round(e/a*100);Nh(()=>{D_(this,F_,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(k_.from(e)),this.velocity={x:0,y:0}}};I_=g_(P_),F_=new WeakMap,S_(I_,2,`delta`,N_,L_),S_(I_,2,`direction`,M_,L_),b_(I_,L_);function R_({x:e,y:t},n){let r=Math.abs(e),i=Math.abs(t);return typeof n==`number`?Math.sqrt(f_(r,2)+f_(i,2))>n:`x`in n&&`y`in n?r>n.x&&i>n.y:`x`in n?r>n.x:`y`in n&&i>n.y}var z_=(e=>(e.Horizontal=`x`,e.Vertical=`y`,e))(z_||{}),B_=Object.values(z_),V_=Object.create,H_=Object.defineProperty,U_=Object.defineProperties,W_=Object.getOwnPropertyDescriptor,G_=Object.getOwnPropertyDescriptors,K_=Object.getOwnPropertySymbols,q_=Object.prototype.hasOwnProperty,J_=Object.prototype.propertyIsEnumerable,Y_=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),X_=e=>{throw TypeError(e)},Z_=(e,t,n)=>t in e?H_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q_=(e,t)=>{for(var n in t||={})q_.call(t,n)&&Z_(e,n,t[n]);if(K_)for(var n of K_(t))J_.call(t,n)&&Z_(e,n,t[n]);return e},$_=(e,t)=>U_(e,G_(t)),ev=(e,t)=>H_(e,`name`,{value:t,configurable:!0}),tv=(e,t)=>{var n={};for(var r in e)q_.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&K_)for(var r of K_(e))t.indexOf(r)<0&&J_.call(e,r)&&(n[r]=e[r]);return n},nv=e=>[,,,V_(e?.[Y_(`metadata`)]??null)],rv=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],iv=e=>e!==void 0&&typeof e!=`function`?X_(`Function expected`):e,av=(e,t,n,r,i)=>({kind:rv[e],name:t,metadata:r,addInitializer:e=>n._?X_(`Already initialized`):i.push(iv(e||null))}),ov=(e,t)=>Z_(t,Y_(`metadata`),e[3]),Y=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},X=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=rv[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&W_(d<4?i:{get[n](){return lv(this,a)},set[n](e){return uv(this,a,e)}},n));d?p&&d<4&&ev(a,(d>2?`set `:d>1?`get `:``)+n):ev(i,n);for(var y=r.length-1;y>=0;y--)l=av(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>cv(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?lv:dv)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>uv(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?iv(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?X_(`Object expected`):(iv(o=s.get)&&(v.get=o),iv(o=s.set)&&(v.set=o),iv(o=s.init)&&g.unshift(o));return d||ov(e,i),v&&H_(i,n,v),p?d^4?a:v:i},sv=(e,t,n)=>t.has(e)||X_(`Cannot `+n),cv=(e,t)=>Object(t)===t?e.has(t):X_(`Cannot use the "in" operator on this value`),lv=(e,t,n)=>(sv(e,t,`read from private field`),n?n.call(e):t.get(e)),Z=(e,t,n)=>t.has(e)?X_(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),uv=(e,t,n,r)=>(sv(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),dv=(e,t,n)=>(sv(e,t,`access private method`),n);function fv(e,t){return{plugin:e,options:t}}function pv(e){return t=>fv(e,t)}function mv(e){return typeof e==`function`?{plugin:e,options:void 0}:e}var hv=[J],gv,_v,vv,yv=class{constructor(e,t){this.manager=e,this.options=t,Z(this,_v,Y(gv,8,this,!1)),Y(gv,11,this),Z(this,vv,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return q(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){let t=tg(e.bind(this));return lv(this,vv).add(t),t}destroy(){lv(this,vv).forEach(e=>e())}static configure(e){return fv(this,e)}};gv=nv(null),_v=new WeakMap,vv=new WeakMap,X(gv,4,`disabled`,hv,yv,_v),ov(gv,yv);var bv=class extends yv{},xv,Sv=class{constructor(e){this.manager=e,this.instances=new Map,Z(this,xv,[])}get values(){return Array.from(this.instances.values())}set values(e){let t=e.map(mv).reduce((e,t)=>{let n=e.find(({plugin:e})=>e===t.plugin);return n?(n.options=t.options,e):[...e,t]},[]),n=t.map(({plugin:e})=>e);for(let e of lv(this,xv))if(!n.includes(e)){if(e.prototype instanceof bv)continue;this.unregister(e)}for(let{plugin:e,options:n}of t)this.register(e,n);uv(this,xv,n)}get(e){return this.instances.get(e)}register(e,t){let n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;let r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){let t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(let e of this.instances.values())e.destroy();this.instances.clear()}};xv=new WeakMap;function Cv(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var wv=[],Tv,Ev,Dv=class extends yv{constructor(e){super(e),Z(this,Tv),Z(this,Ev),this.computeCollisions=this.computeCollisions.bind(this),uv(this,Ev,Gh(wv)),this.destroy=Ng(()=>{let e=this.computeCollisions(),t=q(()=>this.manager.dragOperation.position.current);if(e!==wv){let e=lv(this,Tv);if(uv(this,Tv,t),e&&t.x==e.x&&t.y==e.y)return}else uv(this,Tv,void 0);lv(this,Ev).value=e},()=>{let{dragOperation:e}=this.manager;e.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){q(()=>{e?lv(this,Ev).value=this.computeCollisions():uv(this,Tv,void 0)})}computeCollisions(e,t){let{registry:n,dragOperation:r}=this.manager,{source:i,shape:a,status:o}=r;if(!o.initialized||!a)return wv;let s=[],c=[];for(let a of e??n.droppables){if(a.disabled||i&&!a.accepts(i))continue;let e=t??a.collisionDetector;if(!e)continue;c.push(a),a.shape;let n=q(()=>e({droppable:a,dragOperation:r}));n&&(a.collisionPriority!=null&&(n.priority=a.collisionPriority),s.push(n))}return c.length===0?wv:(s.sort(Cv),s)}get collisions(){return lv(this,Ev).value}};Tv=new WeakMap,Ev=new WeakMap;var Ov,kv,Av=[J],jv,Mv,Nv,Pv,Fv,Iv,Lv;kv=[J],Ov=[J];var Rv=class e{constructor(e,t){Z(this,Pv,Y(Nv,8,this)),Y(Nv,11,this),Z(this,Fv),Z(this,Iv,Y(Nv,12,this)),Y(Nv,15,this),Z(this,Lv,Y(Nv,16,this)),Y(Nv,19,this);let{effects:n,id:r,data:i={},disabled:a=!1,register:o=!0}=e,s=r;uv(this,Fv,Gh(r)),this.manager=t,this.data=i,this.disabled=a,this.effects=()=>[()=>{let{id:e,manager:t}=this;if(e!==s)return s=e,t?.registry.register(this),()=>t?.registry.unregister(this)},...n?.()??[]],this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),t&&o&&queueMicrotask(this.register)}get id(){let t=lv(this,Fv).value;return e.pendingIdChanges?.get(this)??t}set id(t){t!==(e.pendingIdChanges?.get(this)??lv(this,Fv).peek())&&(e.pendingIdChanges||(e.pendingIdChanges=new Map,queueMicrotask(()=>{var t;return dv(t=e,jv,Mv).call(t)})),e.pendingIdChanges.set(this,t))}register(){return this.manager?.registry.register(this)}unregister(){var e;(e=this.manager)==null||e.registry.unregister(this)}destroy(){var e;(e=this.manager)==null||e.registry.unregister(this)}};Nv=nv(null),jv=new WeakSet,Mv=function(){let e=Rv.pendingIdChanges;Rv.pendingIdChanges=null,e&&Nh(()=>{for(let[t,n]of e)lv(t,Fv).value=n})},Pv=new WeakMap,Fv=new WeakMap,Iv=new WeakMap,Lv=new WeakMap,X(Nv,4,`manager`,Av,Rv,Pv),X(Nv,4,`data`,kv,Rv,Iv),X(Nv,4,`disabled`,Ov,Rv,Lv),Z(Rv,jv),ov(Nv,Rv),Rv.pendingIdChanges=null;var zv=Rv,Bv=class{constructor(){this.map=Gh(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{let n=this.map.peek(),r=n.get(e),i=()=>this.unregister(e,t);if(r===t)return i;r&&r.id===e&&(this.cleanupFunctions.get(r)?.(),this.cleanupFunctions.delete(r));let a=new Map(n);for(let[r,i]of n)if(i===t&&r!==e){a.delete(r);break}a.set(e,t),this.map.value=a;let o=Ng(...t.effects());return this.cleanupFunctions.set(t,o),i},this.unregister=(e,t)=>{let n=this.map.peek();if(n.get(e)!==t)return;this.cleanupFunctions.get(t)?.(),this.cleanupFunctions.delete(t);let r=new Map(n);r.delete(e),this.map.value=r}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(let e of this)this.cleanupFunctions.get(e)?.(),e.destroy();this.map.value=new Map}},Vv,Hv,Uv,Wv,Gv,Kv,qv,Jv,Yv,Xv,Zv,Qv=class extends (qv=zv,Kv=[J],Gv=[J],Wv=[J],Uv=[jg],Hv=[jg],Vv=[jg],qv){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:a,plugins:o,effects:s}=n,c=tv(n,[`modifiers`,`type`,`sensors`,`plugins`,`effects`]);super($_(Q_({},c),{effects:()=>[...s?.()??[],()=>{let{manager:e,plugins:t}=this;if(e&&t)for(let n of t){let{plugin:t}=mv(n);e.registry.plugins.register(t)}}]}),t),Y(Jv,5,this),Z(this,Yv,Y(Jv,8,this)),Y(Jv,11,this),Z(this,Xv,Y(Jv,12,this)),Y(Jv,15,this),Z(this,Zv,Y(Jv,16,this,this.isDragSource?`dragging`:`idle`)),Y(Jv,19,this),this.type=i,this.sensors=a,this.modifiers=r,this.alignment=c.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(let t of this.plugins){let n=mv(t);if(n.plugin===e)return n.options}}get isDropping(){return this.status===`dropping`&&this.isDragSource}get isDragging(){return this.status===`dragging`&&this.isDragSource}get isDragSource(){return this.manager?.dragOperation.source?.id===this.id}};Jv=nv(qv),Yv=new WeakMap,Xv=new WeakMap,Zv=new WeakMap,X(Jv,4,`type`,Kv,Qv,Yv),X(Jv,4,`modifiers`,Gv,Qv,Xv),X(Jv,4,`status`,Wv,Qv,Zv),X(Jv,2,`isDropping`,Uv,Qv),X(Jv,2,`isDragging`,Hv,Qv),X(Jv,2,`isDragSource`,Vv,Qv),ov(Jv,Qv);var $v,ey,ty,ny,ry,iy,ay,oy,sy,cy,ly,uy,dy,fy=class extends (ay=zv,iy=[J],ry=[J],ny=[J],ty=[J],ey=[J],$v=[jg],ay){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:a,type:o}=n,s=tv(n,[`accept`,`collisionDetector`,`collisionPriority`,`type`]);super(s,t),Y(oy,5,this),Z(this,sy,Y(oy,8,this)),Y(oy,11,this),Z(this,cy,Y(oy,12,this)),Y(oy,15,this),Z(this,ly,Y(oy,16,this)),Y(oy,19,this),Z(this,uy,Y(oy,20,this)),Y(oy,23,this),Z(this,dy,Y(oy,24,this)),Y(oy,27,this),this.accept=r,this.collisionDetector=i,this.collisionPriority=a,this.type=o}accepts(e){let{accept:t}=this;return t?typeof t==`function`?t(e):e.type?Array.isArray(t)?t.includes(e.type):e.type===t:!1:!0}get isDropTarget(){return this.manager?.dragOperation.target?.id===this.id}};oy=nv(ay),sy=new WeakMap,cy=new WeakMap,ly=new WeakMap,uy=new WeakMap,dy=new WeakMap,X(oy,4,`accept`,iy,fy,sy),X(oy,4,`type`,ry,fy,cy),X(oy,4,`collisionDetector`,ny,fy,ly),X(oy,4,`collisionPriority`,ty,fy,uy),X(oy,4,`shape`,ey,fy,dy),X(oy,2,`isDropTarget`,$v,fy),ov(oy,fy);var py=class{constructor(){this.registry=new Map}addEventListener(e,t){let{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){let{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){let{registry:n}=this,r=n.get(e);if(r)for(let e of r)e(...t)}},my=class extends py{constructor(e){super(),this.manager=e}dispatch(e,t){let n=[t,this.manager];super.dispatch(e,...n)}};function hy(e,t=!0){let n=!1;return $_(Q_({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var gy=class extends bv{constructor(e){super(e);let t=(e,t)=>e.map(({id:e})=>e).join(``)===t.map(({id:e})=>e).join(``),n=[];this.destroy=Ng(()=>{let{dragOperation:t,collisionObserver:r}=e;t.status.initializing&&(n=[],r.enable())},()=>{let{collisionObserver:r,monitor:i}=e,{collisions:a}=r;if(r.isDisabled()||zv.pendingIdChanges)return;let o=hy({collisions:a});if(i.dispatch(`collision`,o),o.defaultPrevented||t(a,n))return;n=a;let[s]=a;q(()=>{s?.id!==e.dragOperation.target?.id&&(r.disable(),e.actions.setDropTarget(s?.id).then(()=>{r.enable()}))})})}},_y=(e=>(e[e.Lowest=0]=`Lowest`,e[e.Low=1]=`Low`,e[e.Normal=2]=`Normal`,e[e.High=3]=`High`,e[e.Highest=4]=`Highest`,e))(_y||{}),vy=(e=>(e[e.Collision=0]=`Collision`,e[e.ShapeIntersection=1]=`ShapeIntersection`,e[e.PointerIntersection=2]=`PointerIntersection`,e))(vy||{}),yy,by,xy,Sy,Cy,wy,Ty=[J],Ey,Dy;wy=[jg],Cy=[jg],Sy=[jg],xy=[jg],by=[jg],yy=[jg];var Oy=class{constructor(){Y(Ey,5,this),Z(this,Dy,Y(Ey,8,this,`idle`)),Y(Ey,11,this)}get current(){return this.value}get idle(){return this.value===`idle`}get initializing(){return this.value===`initializing`}get initialized(){let{value:e}=this;return e!==`idle`&&e!==`initialization-pending`}get dragging(){return this.value===`dragging`}get dropped(){return this.value===`dropped`}set(e){this.value=e}};Ey=nv(null),Dy=new WeakMap,X(Ey,4,`value`,Ty,Oy,Dy),X(Ey,2,`current`,wy,Oy),X(Ey,2,`idle`,Cy,Oy),X(Ey,2,`initializing`,Sy,Oy),X(Ey,2,`initialized`,xy,Oy),X(Ey,2,`dragging`,by,Oy),X(Ey,2,`dropped`,yy,Oy),ov(Ey,Oy);var ky=class{constructor(e){this.manager=e}setDragSource(e){let{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e==`string`||typeof e==`number`?e:e.id}setDropTarget(e){return q(()=>{let{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;let r=hy({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch(`dragover`,r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return q(()=>{let{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw Error(`Cannot start a drag operation without a drag source`);if(!t.status.idle)throw Error(`Cannot start a drag operation while another is active`);let n=new AbortController,{event:r,coordinates:i}=e;Nh(()=>{t.status.set(`initialization-pending`),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});let a=hy({operation:t.snapshot()});return this.manager.monitor.dispatch(`beforedragstart`,a),a.defaultPrevented?(t.reset(),n.abort(),n):(t.status.set(`initializing`),t.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;let{status:e}=t;e.current===`initializing`&&Nh(()=>{t.status.set(`dragging`),this.manager.monitor.dispatch(`dragstart`,{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return q(()=>{let{dragOperation:t}=this.manager,{status:n,controller:r}=t;if(!n.dragging||!r||r.signal.aborted)return;let i=hy({nativeEvent:e.event,operation:t.snapshot(),by:e.by,to:e.to},e.cancelable??!0);(e.propagate??!0)&&this.manager.monitor.dispatch(`dragmove`,i),queueMicrotask(()=>{if(i.defaultPrevented)return;let n=e.to??{x:t.position.current.x+(e.by?.x??0),y:t.position.current.y+(e.by?.y??0)};t.position.current=n})})}stop(e={}){return q(()=>{let{dragOperation:t}=this.manager,{controller:n}=t;if(!n||n.signal.aborted)return;let r,i=()=>{let e={resume:()=>{},abort:()=>{}};return r=new Promise((t,n)=>{e.resume=t,e.abort=n}),e};n.abort();let a=()=>{this.manager.renderer.rendering.then(()=>{t.status.set(`dropped`);let e=q(()=>t.source?.status===`dropping`),r=()=>{t.controller===n&&(t.controller=void 0),t.reset()};if(e){let{source:e}=t,n=tg(()=>{e?.status===`idle`&&(n(),r())})}else this.manager.renderer.rendering.then(r)})};t.canceled=e.canceled??!1,this.manager.monitor.dispatch(`dragend`,{nativeEvent:e.event,operation:t.snapshot(),canceled:e.canceled??!1,suspend:i}),r?r.then(a).catch(()=>t.reset()):a()})}},Ay=class extends yv{constructor(e,t){super(e,t),this.manager=e,this.options=t}},jy=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(let t of e??[])t.controller=this}onEvent(e){if(!this.activated){if(this.constraints?.length)for(let t of this.constraints)t.onEvent(e);else this.activate(e)}}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},My,Ny=class{constructor(e){this.options=e,Z(this,My)}set controller(e){uv(this,My,e),e.signal.addEventListener(`abort`,()=>this.abort())}activate(e){var t;(t=lv(this,My))==null||t.activate(e)}};My=new WeakMap;var Py=class extends yv{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},Fy=class{constructor(e){this.draggables=new Bv,this.droppables=new Bv,this.plugins=new Sv(e),this.sensors=new Sv(e),this.modifiers=new Sv(e)}register(e,t){if(e instanceof Qv)return this.draggables.register(e.id,e);if(e instanceof fy)return this.droppables.register(e.id,e);if(e.prototype instanceof Py)return this.modifiers.register(e,t);if(e.prototype instanceof Ay)return this.sensors.register(e,t);if(e.prototype instanceof yv)return this.plugins.register(e,t);throw Error(`Invalid instance type`)}unregister(e){if(e instanceof zv)return e instanceof Qv?this.draggables.unregister(e.id,e):e instanceof fy?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof Py)return this.modifiers.unregister(e);if(e.prototype instanceof Ay)return this.sensors.unregister(e);if(e.prototype instanceof yv)return this.plugins.unregister(e);throw Error(`Invalid instance type`)}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},Iy,Ly,Ry,zy,By,Vy,Hy,Uy,Wy=[jg],Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb;Uy=[J],Hy=[J],Vy=[J],By=[J],zy=[J],Ry=[jg],Ly=[jg],Iy=[jg];var tb=class{constructor(e){Y(Jy,5,this),Z(this,Gy),Z(this,Ky),Z(this,qy,new e_(void 0,(e,t)=>e&&t?e.equals(t):e===t)),this.status=new Oy,Z(this,Yy,Y(Jy,8,this,!1)),Y(Jy,11,this),Z(this,Xy,Y(Jy,12,this,null)),Y(Jy,15,this),Z(this,Zy,Y(Jy,16,this,null)),Y(Jy,19,this),Z(this,Qy,Y(Jy,20,this,null)),Y(Jy,23,this),Z(this,$y,Y(Jy,24,this,[])),Y(Jy,27,this),this.position=new L_({x:0,y:0}),Z(this,eb,{x:0,y:0}),uv(this,Gy,e)}get shape(){let{current:e,initial:t,previous:n}=lv(this,qy);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?lv(this,qy).current=e:lv(this,qy).reset()}get source(){let e=this.sourceIdentifier;if(e==null)return null;let t=lv(this,Gy).registry.draggables.get(e);return t&&uv(this,Ky,t),t??lv(this,Ky)??null}get target(){let e=this.targetIdentifier;return e==null?null:lv(this,Gy).registry.droppables.get(e)??null}get transform(){let{x:e,y:t}=this.position.delta,n={x:e,y:t};for(let e of this.modifiers)n=e.apply($_(Q_({},this.snapshot()),{transform:n}));return uv(this,eb,n),n}snapshot(){return q(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:lv(this,eb),shape:this.shape?t_(this.shape):null,position:t_(this.position),status:t_(this.status),canceled:this.canceled}))}reset(){Nh(()=>{this.status.set(`idle`),this.sourceIdentifier=null,this.targetIdentifier=null,lv(this,qy).reset(),this.position.reset({x:0,y:0}),uv(this,eb,{x:0,y:0}),this.modifiers=[]})}};Jy=nv(null),Gy=new WeakMap,Ky=new WeakMap,qy=new WeakMap,Yy=new WeakMap,Xy=new WeakMap,Zy=new WeakMap,Qy=new WeakMap,$y=new WeakMap,eb=new WeakMap,X(Jy,2,`shape`,Wy,tb),X(Jy,4,`canceled`,Uy,tb,Yy),X(Jy,4,`activatorEvent`,Hy,tb,Xy),X(Jy,4,`sourceIdentifier`,Vy,tb,Zy),X(Jy,4,`targetIdentifier`,By,tb,Qy),X(Jy,4,`modifiers`,zy,tb,$y),X(Jy,2,`source`,Ry,tb),X(Jy,2,`target`,Ly,tb),X(Jy,2,`transform`,Iy,tb),ov(Jy,tb);var nb={get rendering(){return Promise.resolve()}};function rb(e,t){return typeof e==`function`?e(t):e??t}var ib=class{constructor(e){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(e=>e.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};let t=e??{},n=rb(t.plugins,[]),r=rb(t.sensors,[]),i=rb(t.modifiers,[]),a=t.renderer??nb,o=new my(this),s=new Fy(this);this.registry=s,this.monitor=o,this.renderer=a,this.actions=new ky(this),this.dragOperation=new tb(this),this.collisionObserver=new Dv(this),this.plugins=[gy,...n],this.modifiers=i,this.sensors=r;let{destroy:c}=this,l=Ng(()=>{let e=q(()=>this.dragOperation.modifiers),t=this.modifiers;for(let n of e)t.includes(n)||n.destroy();this.dragOperation.modifiers=(this.dragOperation.source?.modifiers)?.map(e=>{let{plugin:t,options:n}=mv(e);return new t(this,n)})??t});this.destroy=()=>{l(),c()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},ab=e=>{throw TypeError(e)},ob=(e,t,n)=>t.has(e)||ab(`Cannot `+n),Q=(e,t,n)=>(ob(e,t,`read from private field`),t.get(e)),sb=(e,t,n)=>t.has(e)?ab(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),cb=(e,t,n,r)=>(ob(e,t,`write to private field`),t.set(e,n),n),lb=(e,t,n)=>(ob(e,t,`access private method`),n);function ub(e){return e?e instanceof KeyframeEffect||`getKeyframes`in e&&typeof e.getKeyframes==`function`:!1}function db(e,t){let n=e.getAnimations(),r=null;for(let e of n){if(e.playState!==`running`)continue;let{effect:n}=e,i=(ub(n)?n.getKeyframes():[]).filter(t);i.length>0&&(r=[i[i.length-1],e])}return r}function fb(e){let{width:t,height:n,top:r,left:i,bottom:a,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:i,bottom:a,right:o}}function pb(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function mb(e){return`nodeType`in e}function hb(e){return e?pb(e)?e:mb(e)?`defaultView`in e?e.defaultView??window:e.ownerDocument?.defaultView??window:window:window}function gb(e){let{Document:t}=hb(e);return e instanceof t||`nodeType`in e&&e.nodeType===Node.DOCUMENT_NODE}function _b(e){return!e||pb(e)?!1:e instanceof hb(e).HTMLElement||`namespaceURI`in e&&typeof e.namespaceURI==`string`&&e.namespaceURI.endsWith(`html`)}function vb(e){return e instanceof hb(e).SVGElement||`namespaceURI`in e&&typeof e.namespaceURI==`string`&&e.namespaceURI.endsWith(`svg`)}function yb(e){return e?pb(e)?e.document:mb(e)?gb(e)?e:_b(e)||vb(e)?e.ownerDocument:document:document:document}function bb(e){let{documentElement:t}=yb(e),n=hb(e).visualViewport,r=n?.width??t.clientWidth,i=n?.height??t.clientHeight,a=n?.offsetTop??0,o=n?.offsetLeft??0;return{top:a,left:o,right:o+r,bottom:a+i,width:r,height:i}}function xb(e,t){if(Sb(e)&&e.open===!1)return!1;let{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n===`visible`&&r===`visible`&&i===`visible`}function Sb(e){return e.tagName===`DETAILS`}function Cb(e,t=e.getBoundingClientRect(),n=0){let r=t,{ownerDocument:i}=e,a=i.defaultView??window,o=e.parentElement;for(;o&&o!==i.documentElement;){if(!xb(o)){let e=o.getBoundingClientRect(),t=n*(e.bottom-e.top),i=n*(e.right-e.left),a=n*(e.bottom-e.top),s=n*(e.right-e.left);r={top:Math.max(r.top,e.top-t),right:Math.min(r.right,e.right+i),bottom:Math.min(r.bottom,e.bottom+a),left:Math.max(r.left,e.left-s),width:0,height:0},r.width=r.right-r.left,r.height=r.bottom-r.top}o=o.parentElement}let s=a.visualViewport,c=s?.offsetTop??0,l=s?.offsetLeft??0,u=s?.width??a.innerWidth,d=s?.height??a.innerHeight,f=n*d,p=n*u;return r={top:Math.max(r.top,c-f),right:Math.min(r.right,l+u+p),bottom:Math.min(r.bottom,c+d+f),left:Math.max(r.left,l-p),width:0,height:0},r.width=r.right-r.left,r.height=r.bottom-r.top,r.width<0&&(r.width=0),r.height<0&&(r.height=0),r}function wb(e){return{x:e.clientX,y:e.clientY}}var Tb=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Eb(e=document,t=new Set){if(t.has(e))return[];t.add(e);let n=[e];for(let r of Array.from(e.querySelectorAll(`iframe, frame`)))try{let e=r.contentDocument;e&&!t.has(e)&&n.push(...Eb(e,t))}catch{}try{let r=e.defaultView;if(r&&r!==window.top){let i=r.parent;i&&i.document&&i.document!==e&&n.push(...Eb(i.document,t))}}catch{}return n}function Db(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Ob(){let e=Db()?window.visualViewport:null;return{x:e?.offsetLeft??0,y:e?.offsetTop??0}}function kb(e){return!e||!mb(e)?!1:e instanceof hb(e).ShadowRoot}function Ab(e){if(e&&mb(e)){let t=e.getRootNode();if(kb(t)||t instanceof Document)return t}return yb(e)}function jb(e){return e.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Mb(e){let t=`input, textarea, select, canvas, [contenteditable]`,n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((e,t)=>{let n=r[t];Nb(e)&&Nb(n)&&(e.type!==`file`&&(e.value=n.value),e.type===`radio`&&e.name&&(e.name=`Cloned__${e.name}`)),Pb(e)&&Pb(n)&&n.width>0&&n.height>0&&e.getContext(`2d`)?.drawImage(n,0,0)}),n}function Nb(e){return`value`in e}function Pb(e){return e.tagName===`CANVAS`}function Fb(e,{x:t,y:n}){let r=e.elementFromPoint(t,n);if(Ib(r)){let{contentDocument:e}=r;if(e){let{left:i,top:a}=r.getBoundingClientRect();return Fb(e,{x:t-i,y:n-a})}}return r}function Ib(e){return e?.tagName===`IFRAME`}var Lb=new WeakMap;function Rb(e){return e.closest(`
|
|
56
|
+
input:not([disabled]),
|
|
57
|
+
select:not([disabled]),
|
|
58
|
+
textarea:not([disabled]),
|
|
59
|
+
button:not([disabled]),
|
|
60
|
+
a[href],
|
|
61
|
+
[contenteditable]:not([contenteditable="false"])
|
|
62
|
+
`)}var zb=class{constructor(){this.entries=new Set,this.clear=()=>{for(let e of this.entries){let[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i)}this.entries.clear()}}bind(e,t){let n=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t],i=[];for(let e of n)for(let t of r){let{type:n,listener:r,options:a}=t,o=[e,t];e.addEventListener(n,r,a),this.entries.add(o),i.push(o)}let a=this.entries;return function(){for(let e of i){let[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i),a.delete(e)}}}};function Bb(e){let t=e?.ownerDocument.defaultView;if(t&&t.self!==t.parent)return t.frameElement}function Vb(e){let t=new Set,n=Bb(e);for(;n;)t.add(n),n=Bb(n);return t}function Hb(e,t){let n=setTimeout(e,t);return()=>clearTimeout(n)}function Ub(e,t){let n=()=>performance.now(),r,i;return function(...a){let o=this;i?(r?.(),r=Hb(()=>{e.apply(o,a),i=n()},t-(n()-i))):(e.apply(o,a),i=n())}}function Wb(e,t){return e===t?!0:!e||!t?!1:e.top==t.top&&e.left==t.left&&e.right==t.right&&e.bottom==t.bottom}function Gb(e,t=e.getBoundingClientRect()){let{width:n,height:r}=Cb(e,t);return n>0&&r>0}var Kb=Tb?ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},qb,Jb=class extends Kb{constructor(e){super(t=>{if(!Q(this,qb)){cb(this,qb,!0);return}e(t,this)}),sb(this,qb,!1)}};qb=new WeakMap;var Yb=Array.from({length:100},(e,t)=>t/100),Xb=75,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx=class{constructor(e,t,n={debug:!1,skipInitial:!1}){this.element=e,this.callback=t,sb(this,ax),this.disconnect=()=>{var e,t,n;cb(this,rx,!0),(e=Q(this,$b))==null||e.disconnect(),(t=Q(this,ex))==null||t.disconnect(),Q(this,tx).disconnect(),(n=Q(this,nx))==null||n.remove()},sb(this,Zb,!0),sb(this,Qb),sb(this,$b),sb(this,ex),sb(this,tx),sb(this,nx),sb(this,rx,!1),sb(this,ix,Ub(()=>{var e;let{element:t}=this;if((e=Q(this,ex))==null||e.disconnect(),Q(this,rx)||!Q(this,Zb)||!t.isConnected)return;let n=t.ownerDocument??document,{innerHeight:r,innerWidth:i}=n.defaultView??window,a=t.getBoundingClientRect(),{top:o,left:s,bottom:c,right:l}=Cb(t,a),u=-Math.floor(o),d=-Math.floor(s),f=`${u}px ${-Math.floor(i-l)}px ${-Math.floor(r-c)}px ${d}px`;this.boundingClientRect=a,cb(this,ex,new IntersectionObserver(e=>{let[n]=e,{intersectionRect:r}=n;(n.intersectionRatio===1?A_.intersectionRatio(r,Cb(t)):n.intersectionRatio)!==1&&Q(this,ix).call(this)},{threshold:Yb,rootMargin:f,root:n})),Q(this,ex).observe(t),lb(this,ax,ox).call(this)},Xb)),this.boundingClientRect=e.getBoundingClientRect(),cb(this,Zb,Gb(e,this.boundingClientRect));let r=!0;this.callback=e=>{r&&(r=!1,n.skipInitial)||t(e)};let i=e.ownerDocument;n?.debug&&(cb(this,nx,document.createElement(`div`)),Q(this,nx).style.background=`rgba(0,0,0,0.15)`,Q(this,nx).style.position=`fixed`,Q(this,nx).style.pointerEvents=`none`,i.body.appendChild(Q(this,nx))),cb(this,tx,new IntersectionObserver(t=>{var n,r;let{boundingClientRect:i,isIntersecting:a}=t[t.length-1],{width:o,height:s}=i,c=Q(this,Zb);cb(this,Zb,a),(o||s)&&(c&&!a?((n=Q(this,ex))==null||n.disconnect(),this.callback(null),(r=Q(this,$b))==null||r.disconnect(),cb(this,$b,void 0),Q(this,nx)&&(Q(this,nx).style.visibility=`hidden`)):Q(this,ix).call(this),a&&!Q(this,$b)&&(cb(this,$b,new Jb(Q(this,ix))),Q(this,$b).observe(e)))},{threshold:Yb,root:i})),Q(this,Zb)&&!n.skipInitial&&this.callback(this.boundingClientRect),Q(this,tx).observe(e)}};Zb=new WeakMap,Qb=new WeakMap,$b=new WeakMap,ex=new WeakMap,tx=new WeakMap,nx=new WeakMap,rx=new WeakMap,ix=new WeakMap,ax=new WeakSet,ox=function(){Q(this,rx)||(lb(this,ax,sx).call(this),!Wb(this.boundingClientRect,Q(this,Qb))&&(this.callback(this.boundingClientRect),cb(this,Qb,this.boundingClientRect)))},sx=function(){if(Q(this,nx)){let{top:e,left:t,width:n,height:r}=Cb(this.element);Q(this,nx).style.overflow=`hidden`,Q(this,nx).style.visibility=`visible`,Q(this,nx).style.top=`${Math.floor(e)}px`,Q(this,nx).style.left=`${Math.floor(t)}px`,Q(this,nx).style.width=`${Math.floor(n)}px`,Q(this,nx).style.height=`${Math.floor(r)}px`}};var lx=new WeakMap,ux=new WeakMap;function dx(e,t){let n=lx.get(e);return n||={disconnect:new cx(e,t=>{let n=lx.get(e);n&&n.callbacks.forEach(e=>e(t))},{skipInitial:!0}).disconnect,callbacks:new Set},n.callbacks.add(t),lx.set(e,n),()=>{n.callbacks.delete(t),n.callbacks.size===0&&(lx.delete(e),n.disconnect())}}function fx(e,t){let n=new Set;for(let r of e){let e=dx(r,t);n.add(e)}return()=>n.forEach(e=>e())}function px(e,t){let n=e.ownerDocument;if(!ux.has(n)){let e=new AbortController,t=new Set;document.addEventListener(`scroll`,e=>t.forEach(t=>t(e)),{capture:!0,passive:!0,signal:e.signal}),ux.set(n,{disconnect:()=>e.abort(),listeners:t})}let{listeners:r,disconnect:i}=ux.get(n)??{};return!r||!i?()=>{}:(r.add(t),()=>{r.delete(t),r.size===0&&(i(),ux.delete(n))})}var mx,hx,gx,_x,vx=class{constructor(e,t,n){this.callback=t,sb(this,mx),sb(this,hx,!1),sb(this,gx),sb(this,_x,Ub(e=>{if(!Q(this,hx)&&e.target&&`contains`in e.target&&typeof e.target.contains==`function`){for(let t of Q(this,gx))if(e.target.contains(t)){this.callback(Q(this,mx).boundingClientRect);break}}},Xb));let r=Vb(e),i=fx(r,t),a=px(e,Q(this,_x));cb(this,gx,r),cb(this,mx,new cx(e,t,n)),this.disconnect=()=>{Q(this,hx)||(cb(this,hx,!0),i(),a(),Q(this,mx).disconnect())}}};mx=new WeakMap,hx=new WeakMap,gx=new WeakMap,_x=new WeakMap;function yx(e){return`showPopover`in e&&`hidePopover`in e&&typeof e.showPopover==`function`&&typeof e.hidePopover==`function`}function bx(e){try{yx(e)&&e.isConnected&&e.hasAttribute(`popover`)&&!e.matches(`:popover-open`)&&e.showPopover()}catch{}}function xx(e){return!Tb||!e?!1:e===yb(e).scrollingElement}function Sx(e){let t=hb(e),n=xx(e)?bb(e):fb(e),r=t.visualViewport,i=xx(e)?{height:r?.height??t.innerHeight,width:r?.width??t.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={current:{x:e.scrollLeft,y:e.scrollTop},max:{x:e.scrollWidth-i.width,y:e.scrollHeight-i.height}};return{rect:n,position:a,isTop:a.current.y<=0,isLeft:a.current.x<=0,isBottom:a.current.y>=a.max.y,isRight:a.current.x>=a.max.x}}function Cx(e,t){let{isTop:n,isBottom:r,isLeft:i,isRight:a,position:o}=Sx(e),{x:s,y:c}=t??{x:0,y:0},l=!n&&o.current.y+c>0,u=!r&&o.current.y+c<o.max.y,d=!i&&o.current.x+s>0,f=!a&&o.current.x+s<o.max.x;return{top:l,bottom:u,left:d,right:f,x:d||f,y:l||u}}var wx=class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:t}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(let t of e)t();for(let e of t)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}},Tx=new wx(e=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}),Ex=new wx(e=>setTimeout(e,50)),Dx=new Map,Ox=Dx.clear.bind(Dx);function kx(e,t=!1){if(!t)return Ax(e);let n=Dx.get(e);return n||(n=Ax(e),Dx.set(e,n),Ex.schedule(Ox),n)}function Ax(e){return hb(e).getComputedStyle(e)}function jx(e,t=kx(e,!0)){return t.position===`fixed`||t.position===`sticky`}function Mx(e,t=kx(e,!0)){let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}var Nx={excludeElement:!0,escapeShadowDOM:!0};function Px(e,t=Nx){let{limit:n,excludeElement:r,escapeShadowDOM:i}=t,a=new Set;function o(t){if(n!=null&&a.size>=n||!t)return a;if(gb(t)&&t.scrollingElement!=null&&!a.has(t.scrollingElement))return a.add(t.scrollingElement),a;if(i&&kb(t))return o(t.host);if(!_b(t))return vb(t)?o(t.parentElement):a;if(a.has(t))return a;let s=kx(t,!0);if(r&&t===e||Mx(t,s)&&a.add(t),jx(t,s)){let{scrollingElement:e}=t.ownerDocument;return e&&a.add(e),a}return o(t.parentNode)}return e?o(e):a}function Fx(e,t=window.frameElement){let n={x:0,y:0,scaleX:1,scaleY:1};if(!e)return n;let r=Bb(e);for(;r;){if(r===t)return n;let e=fb(r),{x:i,y:a}=Ix(r,e);n.x+=e.left,n.y+=e.top,n.scaleX*=i,n.scaleY*=a,r=Bb(r)}return n}function Ix(e,t=fb(e)){let n=Math.round(t.width),r=Math.round(t.height);if(_b(e))return{x:n/e.offsetWidth,y:r/e.offsetHeight};let i=kx(e,!0);return{x:(parseFloat(i.width)||n)/n,y:(parseFloat(i.height)||r)/r}}function Lx(e){if(!e||e===`none`)return null;let t=e.split(` `),n=parseFloat(t[0]),r=parseFloat(t[1]);return isNaN(n)&&isNaN(r)?null:{x:isNaN(n)?r:n,y:isNaN(r)?n:r}}function Rx(e){if(!e||e===`none`)return null;let[t,n,r=`0`]=e.split(` `),i={x:parseFloat(t),y:parseFloat(n),z:parseInt(r,10)};return isNaN(i.x)&&isNaN(i.y)?null:{x:isNaN(i.x)?0:i.x,y:isNaN(i.y)?0:i.y,z:isNaN(i.z)?0:i.z}}function zx(e){let{scale:t,transform:n,translate:r}=e,i=Lx(t),a=Rx(r),o=Bx(n);if(!o&&!i&&!a)return null;let s={x:i?.x??1,y:i?.y??1},c={x:a?.x??0,y:a?.y??0},l={x:o?.x??0,y:o?.y??0,scaleX:o?.scaleX??1,scaleY:o?.scaleY??1};return{x:c.x+l.x,y:c.y+l.y,z:a?.z??0,scaleX:s.x*l.scaleX,scaleY:s.y*l.scaleY}}function Bx(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}var Vx=(e=>(e[e.Idle=0]=`Idle`,e[e.Forward=1]=`Forward`,e[e.Reverse=-1]=`Reverse`,e))(Vx||{}),Hx={x:.2,y:.2},Ux={x:10,y:10};function Wx(e,t,n,r=25,i=Hx,a=Ux){let{x:o,y:s}=t,{rect:c,isTop:l,isBottom:u,isLeft:d,isRight:f}=Sx(e),p=Fx(e),m=zx(kx(e,!0)),h=m!==null&&m?.scaleX<0,g=m!==null&&m?.scaleY<0,_=new A_(c.left*p.scaleX+p.x,c.top*p.scaleY+p.y,c.width*p.scaleX,c.height*p.scaleY),v={x:0,y:0},y={x:0,y:0},b={height:_.height*i.y,width:_.width*i.x};return b.height>0&&(!l||g&&!u)&&s<=_.top+b.height&&n?.y!==1&&o>=_.left-a.x&&o<=_.right+a.x?(v.y=g?1:-1,y.y=r*Math.abs((_.top+b.height-s)/b.height)):b.height>0&&(!u||g&&!l)&&s>=_.bottom-b.height&&n?.y!==-1&&o>=_.left-a.x&&o<=_.right+a.x&&(v.y=g?-1:1,y.y=r*Math.abs((_.bottom-b.height-s)/b.height)),b.width>0&&(!f||h&&!d)&&o>=_.right-b.width&&n?.x!==-1&&s>=_.top-a.y&&s<=_.bottom+a.y?(v.x=h?-1:1,y.x=r*Math.abs((_.right-b.width-o)/b.width)):b.width>0&&(!d||h&&!f)&&o<=_.left+b.width&&n?.x!==1&&s>=_.top-a.y&&s<=_.bottom+a.y&&(v.x=h?1:-1,y.x=r*Math.abs((_.left+b.width-o)/b.width)),{direction:v,speed:y}}function Gx(e,{block:t=`nearest`,inline:n=`nearest`}={}){if(!_b(e))return;let r=Px(e),i=[];for(let a of r){if(!_b(a))continue;let{top:r,left:o}=qx(e,a),s=r,c=o;for(let e of i)s-=e.scrollTop,c-=e.scrollLeft;if(t!==`none`){let n=s<a.scrollTop;n!==s+e.offsetHeight>a.scrollTop+a.clientHeight&&(a.scrollTop=t===`center`?s-a.clientHeight/2+e.offsetHeight/2:n?s:s+e.offsetHeight-a.clientHeight)}if(n!==`none`){let t=c<a.scrollLeft;t!==c+e.offsetWidth>a.scrollLeft+a.clientWidth&&(a.scrollLeft=n===`center`?c-a.clientWidth/2+e.offsetWidth/2:t?c:c+e.offsetWidth-a.clientWidth)}i.push(a)}}function Kx(e){let t=0,n=0,r=e;for(;r;){t+=r.offsetTop,n+=r.offsetLeft;let e=r.offsetParent;if(!_b(e))break;t+=e.clientTop,n+=e.clientLeft,r=e}return{top:t,left:n}}function qx(e,t){let n=Kx(e),r=Kx(t);return{top:n.top-r.top-t.clientTop,left:n.left-r.left-t.clientLeft}}function Jx(e,t,n){let{scaleX:r,scaleY:i,x:a,y:o}=t,s=e.left+a+(1-r)*parseFloat(n),c=e.top+o+(1-i)*parseFloat(n.slice(n.indexOf(` `)+1)),l=r?e.width*r:e.width,u=i?e.height*i:e.height;return{width:l,height:u,top:c,right:s+l,bottom:c+u,left:s}}function Yx(e,t,n){let{scaleX:r,scaleY:i,x:a,y:o}=t,s=e.left-a-(1-r)*parseFloat(n),c=e.top-o-(1-i)*parseFloat(n.slice(n.indexOf(` `)+1)),l=r?e.width/r:e.width,u=i?e.height/i:e.height;return{width:l,height:u,top:c,right:s+l,bottom:c+u,left:s}}function Xx({element:e,keyframes:t,options:n}){return e.animate(t,n).finished}function Zx(e,t=kx(e).translate,n=!0){if(n){let t=db(e,e=>`translate`in e);if(t){let{translate:e=``}=t[0];if(typeof e==`string`){let t=Rx(e);if(t)return t}}}if(t){let e=Rx(t);if(e)return e}return{x:0,y:0,z:0}}var Qx=new wx(e=>setTimeout(e,0)),$x=new Map,eS=$x.clear.bind($x);function tS(e){let t=e.ownerDocument,n=$x.get(t);if(n)return n;n=t.getAnimations(),$x.set(t,n),Qx.schedule(eS);let r=n.filter(t=>ub(t.effect)&&t.effect.target===e);return $x.set(e,r),n}function nS(e,t){let n=tS(e).filter(e=>{if(ub(e.effect)){let{target:n}=e.effect;if((n&&t.isValidTarget?.call(t,n))??!0)return e.effect.getKeyframes().some(e=>{for(let n of t.properties)if(e[n])return!0})}}).map(e=>{let{effect:t,currentTime:n}=e,r=t?.getComputedTiming().duration;if(!(e.pending||e.playState===`finished`)&&typeof r==`number`&&typeof n==`number`&&n<r)return e.currentTime=r,()=>{e.currentTime=n}});if(n.length>0)return()=>n.forEach(e=>e?.())}var rS=class extends A_{constructor(e,t={}){let{frameTransform:n=Fx(e),ignoreTransforms:r,getBoundingClientRect:i=fb}=t,a=nS(e,{properties:[`transform`,`translate`,`scale`,`width`,`height`],isValidTarget:t=>(t!==e||Db())&&t.contains(e)}),o=i(e),{top:s,left:c,width:l,height:u}=o,d,f=kx(e),p=zx(f),m={x:p?.scaleX??1,y:p?.scaleY??1},h=iS(e,f);a?.(),p&&(d=Yx(o,p,f.transformOrigin),(r||h)&&(s=d.top,c=d.left,l=d.width,u=d.height));let g={width:d?.width??l,height:d?.height??u};if(h&&!r&&d){let e=Jx(d,h,f.transformOrigin);s=e.top,c=e.left,l=e.width,u=e.height,m.x=h.scaleX,m.y=h.scaleY}n&&(r||(c*=n.scaleX,l*=n.scaleX,s*=n.scaleY,u*=n.scaleY),c+=n.x,s+=n.y),super(c,s,l,u),this.scale=m,this.intrinsicWidth=g.width,this.intrinsicHeight=g.height}};function iS(e,t){let n=e.getAnimations();if(!n.length)return null;let r,i,a,o=!1;for(let e of n){if(e.playState!==`running`)continue;let t=ub(e.effect)?e.effect.getKeyframes():[],n=t[t.length-1];if(!n)continue;let{transform:s,translate:c,scale:l}=n;typeof s==`string`&&s&&(r=s,o=!0),typeof c==`string`&&c&&(i=c,o=!0),typeof l==`string`&&l&&(a=l,o=!0)}return o?zx({transform:r??t.transform,translate:i??t.translate,scale:a??t.scale}):null}function aS(e){return`style`in e&&typeof e.style==`object`&&e.style!==null&&`setProperty`in e.style&&`removeProperty`in e.style&&typeof e.style.setProperty==`function`&&typeof e.style.removeProperty==`function`}var oS=class{constructor(e){this.element=e,this.initial=new Map}set(e,t=``){let{element:n}=this;if(aS(n))for(let[r,i]of Object.entries(e)){let e=`${t}${r}`;this.initial.has(e)||this.initial.set(e,n.style.getPropertyValue(e)),n.style.setProperty(e,typeof i==`string`?i:`${i}px`)}}remove(e,t=``){let{element:n}=this;if(aS(n))for(let r of e){let e=`${t}${r}`;n.style.removeProperty(e)}}reset(){let{element:e}=this;if(aS(e)){for(let[t,n]of this.initial)e.style.setProperty(t,n);e.getAttribute(`style`)===``&&e.removeAttribute(`style`)}}};function sS(e){return e?e instanceof hb(e).Element||mb(e)&&e.nodeType===Node.ELEMENT_NODE:!1}function cS(e){if(!e)return!1;let{KeyboardEvent:t}=hb(e.target);return e instanceof t}function lS(e){if(!e)return!1;let{PointerEvent:t}=hb(e.target);return e instanceof t}function uS(e){if(!sS(e))return!1;let{tagName:t}=e;return t===`INPUT`||t===`TEXTAREA`||dS(e)}function dS(e){return e.hasAttribute(`contenteditable`)&&e.getAttribute(`contenteditable`)!==`false`}var fS={};function pS(e){let t=fS[e]==null?0:fS[e]+1;return fS[e]=t,`${e}-${t}`}var mS=({dragOperation:e,droppable:t})=>{let n=e.position.current;if(!n)return null;let{id:r}=t;return t.shape&&t.shape.containsPoint(n)?{id:r,value:1/k_.distance(t.shape.center,n),type:vy.PointerIntersection,priority:_y.High}:null},hS=({dragOperation:e,droppable:t})=>{let{shape:n}=e;if(!t.shape||!n?.current)return null;let r=n.current.intersectionArea(t.shape);if(r){let{position:i}=e,a=k_.distance(t.shape.center,i.current),o=r/(n.current.area+t.shape.area-r)/a;return{id:t.id,value:o,type:vy.ShapeIntersection,priority:_y.Normal}}return null},gS=e=>mS(e)??hS(e),_S=e=>{let{dragOperation:t,droppable:n}=e,{shape:r,position:i}=t;if(!n.shape)return null;let a=r?A_.from(r.current.boundingRectangle).corners:void 0,o=A_.from(n.shape.boundingRectangle).corners.reduce((e,t,n)=>e+k_.distance(k_.from(t),a?.[n]??i.current),0)/4;return{id:n.id,value:1/o,type:vy.Collision,priority:_y.Normal}},vS=Object.create,yS=Object.defineProperty,bS=Object.defineProperties,xS=Object.getOwnPropertyDescriptor,SS=Object.getOwnPropertyDescriptors,CS=Object.getOwnPropertySymbols,wS=Object.prototype.hasOwnProperty,TS=Object.prototype.propertyIsEnumerable,ES=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),DS=e=>{throw TypeError(e)},OS=(e,t,n)=>t in e?yS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kS=(e,t)=>{for(var n in t||={})wS.call(t,n)&&OS(e,n,t[n]);if(CS)for(var n of CS(t))TS.call(t,n)&&OS(e,n,t[n]);return e},AS=(e,t)=>bS(e,SS(t)),jS=(e,t)=>yS(e,`name`,{value:t,configurable:!0}),MS=(e,t)=>{var n={};for(var r in e)wS.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&CS)for(var r of CS(e))t.indexOf(r)<0&&TS.call(e,r)&&(n[r]=e[r]);return n},NS=e=>[,,,vS(e?.[ES(`metadata`)]??null)],PS=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],FS=e=>e!==void 0&&typeof e!=`function`?DS(`Function expected`):e,IS=(e,t,n,r,i)=>({kind:PS[e],name:t,metadata:r,addInitializer:e=>n._?DS(`Already initialized`):i.push(FS(e||null))}),LS=(e,t)=>OS(t,ES(`metadata`),e[3]),RS=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},zS=(e,t,n,r,i,a)=>{var o,s,c,l,u,d=t&7,f=!!(t&8),p=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,h=PS[d+5],g=d>3&&(e[m-1]=[]),_=e[m]||(e[m]=[]),v=d&&(!p&&!f&&(i=i.prototype),d<5&&(d>3||!p)&&xS(d<4?i:{get[n](){return $(this,a)},set[n](e){return US(this,a,e)}},n));d?p&&d<4&&jS(a,(d>2?`set `:d>1?`get `:``)+n):jS(i,n);for(var y=r.length-1;y>=0;y--)l=IS(d,n,c={},e[3],_),d&&(l.static=f,l.private=p,u=l.access={has:p?e=>VS(i,e):e=>n in e},d^3&&(u.get=p?e=>(d^1?$:WS)(e,i,d^4?a:v.get):e=>e[n]),d>2&&(u.set=p?(e,t)=>US(e,i,t,d^4?a:v.set):(e,t)=>e[n]=t)),s=(0,r[y])(d?d<4?p?a:v[h]:d>4?void 0:{get:v.get,set:v.set}:i,l),c._=1,d^4||s===void 0?FS(s)&&(d>4?g.unshift(s):d?p?a=s:v[h]=s:i=s):typeof s!=`object`||!s?DS(`Object expected`):(FS(o=s.get)&&(v.get=o),FS(o=s.set)&&(v.set=o),FS(o=s.init)&&g.unshift(o));return d||LS(e,i),v&&yS(i,n,v),p?d^4?a:v:i},BS=(e,t,n)=>t.has(e)||DS(`Cannot `+n),VS=(e,t)=>Object(t)===t?e.has(t):DS(`Cannot use the "in" operator on this value`),$=(e,t,n)=>(BS(e,t,`read from private field`),n?n.call(e):t.get(e)),HS=(e,t,n)=>t.has(e)?DS(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),US=(e,t,n,r)=>(BS(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),WS=(e,t,n)=>(BS(e,t,`access private method`),n),GS={role:`button`,roleDescription:`draggable`},KS=`dnd-kit-description`,qS=`dnd-kit-announcement`,JS={draggable:`To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item in a given direction. Press space again to drop the item in its new position, or press escape to cancel.`},YS={dragstart({operation:{source:e}}){if(e)return`Picked up draggable item ${e.id}.`},dragover({operation:{source:e,target:t}}){if(e&&e.id!==t?.id)return t?`Draggable item ${e.id} was moved over droppable target ${t.id}.`:`Draggable item ${e.id} is no longer over a droppable target.`},dragend({operation:{source:e,target:t},canceled:n}){if(e)return n?`Dragging was cancelled. Draggable item ${e.id} was dropped.`:t?`Draggable item ${e.id} was dropped over droppable target ${t.id}`:`Draggable item ${e.id} was dropped.`}};function XS(e){let t=e.tagName.toLowerCase();return[`input`,`select`,`textarea`,`a`,`button`].includes(t)}function ZS(e,t){let n=document.createElement(`div`);return n.id=e,n.style.setProperty(`display`,`none`),n.textContent=t,n}function QS(e){let t=document.createElement(`div`);return t.id=e,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),t.style.setProperty(`position`,`fixed`),t.style.setProperty(`width`,`1px`),t.style.setProperty(`height`,`1px`),t.style.setProperty(`margin`,`-1px`),t.style.setProperty(`border`,`0`),t.style.setProperty(`padding`,`0`),t.style.setProperty(`overflow`,`hidden`),t.style.setProperty(`clip`,`rect(0 0 0 0)`),t.style.setProperty(`clip-path`,`inset(100%)`),t.style.setProperty(`white-space`,`nowrap`),t}var $S=[`dragover`,`dragmove`],eC=class extends yv{constructor(e,t){super(e);let{id:n,idPrefix:{description:r=KS,announcement:i=qS}={},announcements:a=YS,screenReaderInstructions:o=JS,debounce:s=500}=t??{},c=n?`${r}-${n}`:pS(r),l=n?`${i}-${n}`:pS(i),u,d,f,p,m=(e=p)=>{f&&e&&f?.nodeValue!==e&&(f.nodeValue=e)},h=()=>Tx.schedule(m),g=tC(h,s),_=Object.entries(a).map(([e,t])=>this.manager.monitor.addEventListener(e,(n,r)=>{let i=f;if(!i)return;let a=t?.(n,r);a&&i.nodeValue!==a&&(p=a,$S.includes(e)?g():(h(),g.cancel()))})),v=()=>{let e=[];u?.isConnected||(u=ZS(c,o.draggable),e.push(u)),d?.isConnected||(d=QS(l),f=document.createTextNode(``),d.appendChild(f),e.push(d)),e.length>0&&document.body.append(...e)},y=new Set;function b(){for(let e of y)e()}this.registerEffect(()=>{y.clear();for(let e of this.manager.registry.draggables.value){let t=e.handle??e.element;if(t){(!u||!d)&&y.add(v),(!XS(t)||Db())&&!t.hasAttribute(`tabindex`)&&y.add(()=>t.setAttribute(`tabindex`,`0`)),!t.hasAttribute(`role`)&&t.tagName.toLowerCase()!==`button`&&y.add(()=>t.setAttribute(`role`,GS.role)),t.hasAttribute(`aria-roledescription`)||y.add(()=>t.setAttribute(`aria-roledescription`,GS.roleDescription)),t.hasAttribute(`aria-describedby`)||y.add(()=>t.setAttribute(`aria-describedby`,c));for(let n of[`aria-pressed`,`aria-grabbed`]){let r=String(e.isDragging);t.getAttribute(n)!==r&&y.add(()=>t.setAttribute(n,r))}let n=String(e.disabled);t.getAttribute(`aria-disabled`)!==n&&y.add(()=>t.setAttribute(`aria-disabled`,n))}}y.size>0&&Tx.schedule(b)}),this.destroy=()=>{super.destroy(),u?.remove(),d?.remove(),_.forEach(e=>e())}}};function tC(e,t){let n,r=()=>{clearTimeout(n),n=setTimeout(e,t)};return r.cancel=()=>clearTimeout(n),r}var nC=new Map,rC,iC,aC,oC,sC,cC,lC,uC,dC,fC,pC,mC,hC,gC=class extends (sC=bv,oC=[J],aC=[jg],iC=[jg],rC=[jg],sC){constructor(e,t){super(e,t),RS(lC,5,this),HS(this,dC),HS(this,cC,new Set),HS(this,uC,RS(lC,8,this,new Set)),RS(lC,11,this),this.registerEffect(WS(this,dC,fC))}register(e){return $(this,cC).add(e),()=>{$(this,cC).delete(e)}}addRoot(e){return q(()=>{let t=new Set(this.additionalRoots);t.add(e),this.additionalRoots=t}),()=>{q(()=>{let t=new Set(this.additionalRoots);t.delete(e),this.additionalRoots=t})}}get sourceRoot(){let{source:e}=this.manager.dragOperation;return Ab(e?.element??null)}get targetRoot(){let{target:e}=this.manager.dragOperation;return Ab(e?.element??null)}get roots(){let{status:e}=this.manager.dragOperation;if(e.initializing||e.initialized){let e=[this.sourceRoot,this.targetRoot].filter(e=>e!=null);return new Set([...e,...this.additionalRoots])}return new Set}};lC=NS(sC),cC=new WeakMap,uC=new WeakMap,dC=new WeakSet,fC=function(){let{roots:e}=this,t=[];for(let n of e)for(let e of $(this,cC))t.push(WS(this,dC,pC).call(this,n,e));return()=>{for(let e of t)e()}},pC=function(e,t){let n=nC.get(e);n||(n=new Map,nC.set(e,n));let r=n.get(t);if(!r){let i=gb(e)?WS(this,dC,mC).call(this,e,n,t):WS(this,dC,hC).call(this,e,n,t);if(!i)return()=>{};r=i,n.set(t,r)}r.refCount++;let i=!1;return()=>{i||(i=!0,r.refCount--,r.refCount===0&&r.cleanup())}},mC=function(e,t,n){let r=e.createElement(`style`),{nonce:i}=this.options??{};i&&r.setAttribute(`nonce`,i),r.textContent=n,e.head.prepend(r);let a=new MutationObserver(t=>{for(let n of t)for(let t of Array.from(n.removedNodes))if(t===r){e.head.prepend(r);return}});return a.observe(e.head,{childList:!0}),{refCount:0,cleanup:()=>{a.disconnect(),r.remove(),t.delete(n),t.size===0&&nC.delete(e)}}},hC=function(e,t,n){`adoptedStyleSheets`in e&&Array.isArray(e.adoptedStyleSheets);let{CSSStyleSheet:r}=e.ownerDocument.defaultView??{};if(!r)return null;let i=new r;return i.replaceSync(n),e.adoptedStyleSheets.push(i),{refCount:0,cleanup:()=>{if(kb(e)&&e.host?.isConnected){let t=e.adoptedStyleSheets.indexOf(i);t!==-1&&e.adoptedStyleSheets.splice(t,1)}t.delete(n),t.size===0&&nC.delete(e)}}},zS(lC,4,`additionalRoots`,oC,gC,uC),zS(lC,2,`sourceRoot`,aC,gC),zS(lC,2,`targetRoot`,iC,gC),zS(lC,2,`roots`,rC,gC),LS(lC,gC),gC.configure=pv(gC);var _C=gC,vC=class extends yv{constructor(e,t){super(e,t),this.manager=e;let{cursor:n=`grabbing`}=t??{},r=e.registry.plugins.get(_C)?.register(`* { cursor: ${n} !important; }`);if(r){let e=this.destroy.bind(this);this.destroy=()=>{r(),e()}}}},yC=`data-dnd-`,bC=`${yC}dropping`,xC=`--dnd-`,SC=`${yC}dragging`,CC=`${yC}placeholder`,wC=[SC,CC,`popover`,`aria-pressed`,`aria-grabbing`],TC=[`view-transition-name`],EC=`
|
|
63
|
+
:is(:root,:host) [${SC}] {
|
|
64
|
+
position: fixed !important;
|
|
65
|
+
pointer-events: none !important;
|
|
66
|
+
touch-action: none;
|
|
67
|
+
z-index: calc(infinity);
|
|
68
|
+
will-change: translate;
|
|
69
|
+
top: var(${xC}top, 0px) !important;
|
|
70
|
+
left: var(${xC}left, 0px) !important;
|
|
71
|
+
right: unset !important;
|
|
72
|
+
bottom: unset !important;
|
|
73
|
+
width: var(${xC}width, auto);
|
|
74
|
+
max-width: var(${xC}width, auto);
|
|
75
|
+
height: var(${xC}height, auto);
|
|
76
|
+
max-height: var(${xC}height, auto);
|
|
77
|
+
transform: var(${xC}transform, none) !important;
|
|
78
|
+
transition: var(${xC}transition) !important;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:is(:root,:host) [${CC}] {
|
|
82
|
+
transition: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:is(:root,:host) [${CC}='hidden'] {
|
|
86
|
+
visibility: hidden;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[${SC}] * {
|
|
90
|
+
pointer-events: none !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
[${SC}]:not([${bC}]) {
|
|
94
|
+
translate: var(${xC}translate) !important;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
[${SC}][style*='${xC}scale'] {
|
|
98
|
+
scale: var(${xC}scale) !important;
|
|
99
|
+
transform-origin: var(${xC}transform-origin) !important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@layer dnd-kit {
|
|
103
|
+
:where([${SC}][popover]) {
|
|
104
|
+
overflow: visible;
|
|
105
|
+
background: unset;
|
|
106
|
+
border: unset;
|
|
107
|
+
margin: unset;
|
|
108
|
+
padding: unset;
|
|
109
|
+
color: inherit;
|
|
110
|
+
|
|
111
|
+
&:is(input, button) {
|
|
112
|
+
border: revert;
|
|
113
|
+
background: revert;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
[${SC}]::backdrop, [${yC}overlay]:not([${SC}]) {
|
|
118
|
+
display: none;
|
|
119
|
+
visibility: hidden;
|
|
120
|
+
}
|
|
121
|
+
`.replace(/\n+/g,` `).replace(/\s+/g,` `).trim();function DC(e,t=`hidden`){return q(()=>{let{element:n,manager:r}=e;if(!n||!r)return;let i=OC(n,r.registry.droppables),a=[],o=Mb(n),{remove:s}=o;return kC(i,o,a),AC(o,t),o.remove=()=>{a.forEach(e=>e()),s.call(o)},o})}function OC(e,t){let n=new Map;for(let r of t)if(r.element&&(e===r.element||e.contains(r.element))){let e=`${yC}${pS(`dom-id`)}`;r.element.setAttribute(e,``),n.set(r,e)}return n}function kC(e,t,n){for(let[r,i]of e){if(!r.element)continue;let e=`[${i}]`,a=t.matches(e)?t:t.querySelector(e);if(r.element.removeAttribute(i),!a)continue;let o=r.element;r.proxy=a,a.removeAttribute(i),Lb.set(o,a),n.push(()=>{Lb.delete(o),r.proxy=void 0})}}function AC(e,t=`hidden`){e.setAttribute(`inert`,`true`),e.setAttribute(`tab-index`,`-1`),e.setAttribute(`aria-hidden`,`true`),e.setAttribute(CC,t)}function jC(e,t){return e===t||Bb(e)===Bb(t)}function MC(e){let{target:t}=e;`newState`in e&&e.newState===`closed`&&sS(t)&&t.hasAttribute(`popover`)&&requestAnimationFrame(()=>bx(t))}function NC(e){return e.tagName===`TR`}function PC(e,t,n){let r=new MutationObserver(r=>{let i=!1;for(let n of r){if(n.target!==e){i=!0;continue}if(n.type!==`attributes`)continue;let r=n.attributeName;if(r.startsWith(`aria-`)||wC.includes(r))continue;let a=e.getAttribute(r);if(r===`style`){if(aS(e)&&aS(t)){let n=e.style;for(let e of Array.from(t.style))n.getPropertyValue(e)===``&&t.style.removeProperty(e);for(let e of Array.from(n)){if(TC.includes(e)||e.startsWith(xC))continue;let r=n.getPropertyValue(e);t.style.setProperty(e,r)}}}else a===null?t.removeAttribute(r):t.setAttribute(r,a)}i&&n&&t.replaceChildren(...e.cloneNode(!0).childNodes)});return r.observe(e,{attributes:!0,subtree:!0,childList:!0}),r}function FC(e,t,n){let r=new MutationObserver(r=>{for(let i of r)if(i.addedNodes.length!==0)for(let r of Array.from(i.addedNodes)){if(r.contains(e)&&e.nextElementSibling!==t){e.insertAdjacentElement(`afterend`,t),bx(n);return}if(r.contains(t)&&t.previousElementSibling!==e){t.insertAdjacentElement(`beforebegin`,e),bx(n);return}}e.isConnected&&t.isConnected&&e.nextElementSibling!==t&&(e.insertAdjacentElement(`afterend`,t),bx(n))});return r.observe(e.ownerDocument.body,{childList:!0,subtree:!0}),r}function IC(e){return new ResizeObserver(()=>{var t;let n=new rS(e.placeholder,{frameTransform:e.frameTransform,ignoreTransforms:!0}),r=e.transformOrigin??{x:1,y:1},i=(e.width-n.width)*r.x+e.delta.x,a=(e.height-n.height)*r.y+e.delta.y,o=Ob();if(e.styles.set({width:n.width-e.widthOffset,height:n.height-e.heightOffset,top:e.top+a+o.y,left:e.left+i+o.x},xC),(t=e.getElementMutationObserver())==null||t.takeRecords(),NC(e.element)&&NC(e.placeholder)){let t=Array.from(e.element.cells),n=Array.from(e.placeholder.cells);e.getSavedCellWidths()||e.setSavedCellWidths(t.map(e=>e.style.width));for(let[e,r]of t.entries()){let t=n[e];r.style.width=`${t.getBoundingClientRect().width}px`}}let s=e.getTranslate()??{x:0,y:0},c=e.left+i+o.x+s.x,l=e.top+a+o.y+s.y,u=n.width-e.widthOffset,d=n.height-e.heightOffset,f=e.frameTransform;e.dragOperation.shape=new A_(c*f.scaleX+f.x,l*f.scaleY+f.y,u*f.scaleX,d*f.scaleY)})}var LC=250,RC=`ease`;function zC(e){var t;let{animation:n}=e;if(typeof n==`function`){let t=n({source:e.source,element:e.element,feedbackElement:e.feedbackElement,placeholder:e.placeholder,translate:e.translate,moved:e.moved});Promise.resolve(t).then(()=>{e.cleanup(),requestAnimationFrame(e.restoreFocus)});return}let{duration:r=LC,easing:i=RC}=n??{};bx(e.feedbackElement);let[,a]=db(e.feedbackElement,e=>`translate`in e)??[];a?.pause();let o=e.placeholder??e.element,s={frameTransform:jC(e.feedbackElement,o)?null:void 0},c=new rS(e.feedbackElement,s),l=Rx(kx(e.feedbackElement).translate)??e.translate,u=new rS(o,s),d=A_.delta(c,u,e.alignment),f={x:l.x-d.x,y:l.y-d.y},p=Math.round(c.intrinsicHeight)===Math.round(u.intrinsicHeight)?{}:{minHeight:[`${c.intrinsicHeight}px`,`${u.intrinsicHeight}px`],maxHeight:[`${c.intrinsicHeight}px`,`${u.intrinsicHeight}px`]},m=Math.round(c.intrinsicWidth)===Math.round(u.intrinsicWidth)?{}:{minWidth:[`${c.intrinsicWidth}px`,`${u.intrinsicWidth}px`],maxWidth:[`${c.intrinsicWidth}px`,`${u.intrinsicWidth}px`]};e.styles.set({transition:e.transition},xC),e.feedbackElement.setAttribute(bC,``),(t=e.getElementMutationObserver())==null||t.takeRecords(),Xx({element:e.feedbackElement,keyframes:AS(kS(kS({},p),m),{translate:[`${l.x}px ${l.y}px 0`,`${f.x}px ${f.y}px 0`]}),options:{duration:jb(hb(e.feedbackElement))?0:e.moved||e.feedbackElement!==e.element?r:0,easing:i}}).then(()=>{e.feedbackElement.removeAttribute(bC),a?.finish(),e.cleanup(),requestAnimationFrame(e.restoreFocus)})}var BC,VC,HC,UC,WC,GC,KC,qC=class extends (VC=yv,BC=[J],VC){constructor(e,t){super(e,t),HS(this,WC),HS(this,UC,RS(HC,8,this)),RS(HC,11,this),this.state={initial:{},current:{}};let n=e.registry.plugins.get(_C),r=n?.register(EC);if(r){let e=this.destroy.bind(this);this.destroy=()=>{r(),e()}}this.registerEffect(WS(this,WC,GC).bind(this,n)),this.registerEffect(WS(this,WC,KC))}};HC=NS(VC),UC=new WeakMap,WC=new WeakSet,GC=function(e){let{overlay:t}=this;if(!t||!e)return;let n=Ab(t);if(n)return e.addRoot(n)},KC=function(){let{state:e,manager:t,options:n}=this,{dragOperation:r}=t,{position:i,source:a,status:o}=r;if(o.idle){e.current={},e.initial={};return}if(!a)return;let{element:s}=a,c=a.pluginConfig(qC),l=c?.feedback??n?.feedback??`default`,u=typeof l==`function`?l(a,t):l;if(!s||u===`none`||!o.initialized||o.initializing)return;let{initial:d}=e,f=this.overlay??s,p=Fx(f),m=Fx(s),h=!jC(s,f),g=new rS(s,{frameTransform:h?m:null,ignoreTransforms:!h}),_={x:m.scaleX/p.scaleX,y:m.scaleY/p.scaleY},{width:v,height:y,top:b,left:x}=g;h&&(v/=_.x,y/=_.y);let S=new oS(f),C=kx(s),{transition:w,translate:T,boxSizing:E,paddingBlockStart:D,paddingBlockEnd:O,paddingInlineStart:ee,paddingInlineEnd:te,borderInlineStartWidth:ne,borderInlineEndWidth:re,borderBlockStartWidth:ie,borderBlockEndWidth:ae}=C,oe=w.split(`,`).filter(e=>!/^\s*(transform|translate|scale)\b/.test(e)).join(`,`),se=zx(C),k=C.transform,ce=u===`clone`,A=E===`content-box`,le=A?parseInt(ee)+parseInt(te)+parseInt(ne)+parseInt(re):0,j=A?parseInt(D)+parseInt(O)+parseInt(ie)+parseInt(ae):0,M=u!==`move`&&!this.overlay?DC(a,ce?`clone`:`hidden`):null,N=q(()=>cS(t.dragOperation.activatorEvent));if(!d.translate){if(this.overlay&&se)d.translate={x:se.x,y:se.y};else if(T!==`none`){let e=Rx(T);e&&(d.translate=e)}}if(!d.transformOrigin){let e=q(()=>i.current),t=x+(se?.x??0),n=b+(se?.y??0);d.transformOrigin={x:(e.x-t*p.scaleX-p.x)/(v*p.scaleX),y:(e.y-n*p.scaleY-p.y)/(y*p.scaleY)}}let{transformOrigin:P}=d,ue=b*p.scaleY+p.y,de=x*p.scaleX+p.x;if(!d.coordinates&&(d.coordinates={x:de,y:ue},_.x!==1||_.y!==1)){let{scaleX:e,scaleY:t}=m,{x:n,y:r}=P;d.coordinates.x+=(v*e-v)*n,d.coordinates.y+=(y*t-y)*r}d.dimensions||={width:v,height:y},d.frameTransform||=p;let fe={x:d.coordinates.x-de,y:d.coordinates.y-ue},pe={width:(d.dimensions.width*d.frameTransform.scaleX-v*p.scaleX)*P.x,height:(d.dimensions.height*d.frameTransform.scaleY-y*p.scaleY)*P.y},me={x:fe.x/p.scaleX+pe.width,y:fe.y/p.scaleY+pe.height},he={left:x+me.x,top:b+me.y};f.setAttribute(SC,`true`);let ge=q(()=>r.transform),_e=d.translate??{x:0,y:0},ve=ge.x*p.scaleX+_e.x,ye=ge.y*p.scaleY+_e.y,be=Ob();S.set({width:v-le,height:y-j,top:he.top+be.y,left:he.left+be.x,translate:`${ve}px ${ye}px 0`,transform:this.overlay?`none`:k,transition:oe?`${oe}, translate 0ms linear`:`translate 0ms linear`,scale:h?`${_.x} ${_.y}`:``,"transform-origin":`${P.x*100}% ${P.y*100}%`},xC),M&&(s.insertAdjacentElement(`afterend`,M),n?.rootElement&&(typeof n.rootElement==`function`?n.rootElement(a):n.rootElement).appendChild(s)),yx(f)&&(f.hasAttribute(`popover`)||f.setAttribute(`popover`,`manual`),bx(f),f.addEventListener(`beforetoggle`,MC));let xe,Se,Ce,we=IC({placeholder:M,element:s,feedbackElement:f,frameTransform:p,transformOrigin:P,width:v,height:y,top:b,left:x,widthOffset:le,heightOffset:j,delta:me,styles:S,dragOperation:r,getTranslate:()=>e.current.translate,getElementMutationObserver:()=>xe,getSavedCellWidths:()=>Ce,setSavedCellWidths:e=>{Ce=e}}),Te=new rS(f);q(()=>r.shape=Te);let Ee=hb(f),De=e=>{this.manager.actions.stop({event:e})},Oe=jb(Ee);N&&Ee.addEventListener(`resize`,De),q(()=>a.status)===`idle`&&requestAnimationFrame(()=>a.status=`dragging`),M&&(we.observe(M),xe=PC(s,M,ce),Se=FC(s,M,f));let ke=t.dragOperation.source?.id,Ae=()=>{if(!N||ke==null)return;let e=t.registry.draggables.get(ke),n=e?.handle??e?.element;_b(n)&&n.focus()},je=()=>{xe?.disconnect(),Se?.disconnect(),we.disconnect(),Ee.removeEventListener(`resize`,De),yx(f)&&(f.removeEventListener(`beforetoggle`,MC),f.removeAttribute(`popover`)),f.removeAttribute(SC),S.reset();let t=()=>{if(Ce&&NC(s)){let e=Array.from(s.cells);for(let[t,n]of e.entries())n.style.width=Ce[t]??``}a.status=`idle`;let t=e.current.translate!=null,n=r.status.dragging;M&&(!n&&t||M.parentElement!==f.parentElement)&&f.isConnected&&M.replaceWith(f),M?.remove()};f===this.overlay?setTimeout(t,0):t()},Me=n?.dropAnimation,Ne=this,Pe=Ng(()=>{let{transform:t,status:i}=r;if((t.x||t.y||e.current.translate)&&i.dragging){let i=d.translate??{x:0,y:0},a={x:t.x/p.scaleX+i.x,y:t.y/p.scaleY+i.y},o=e.current.translate,s=q(()=>r.modifiers),c=q(()=>r.shape?.current),l=n?.keyboardTransition,u=N&&!Oe&&l!==null?`${l?.duration??250}ms ${l?.easing??`cubic-bezier(0.25, 1, 0.5, 1)`}`:`0ms linear`;if(S.set({transition:oe?`${oe}, translate ${u}`:`translate ${u}`,translate:`${a.x}px ${a.y}px 0`},xC),xe?.takeRecords(),c&&c!==Te&&o&&!s.length){let e=k_.delta(a,o);r.shape=A_.from(c.boundingRectangle).translate(e.x*p.scaleX,e.y*p.scaleY)}else r.shape=new rS(f);e.current.translate=a}},function(){if(r.status.dropped){this.dispose(),a.status=`dropping`;let n=c?.dropAnimation===void 0?Ne.dropAnimation===void 0?Me:Ne.dropAnimation:c.dropAnimation,r=e.current.translate,i=r!=null;if(!r&&s!==f&&(r={x:0,y:0}),!r||n===null){je();return}t.renderer.rendering.then(()=>{zC({source:a,element:s,feedbackElement:f,placeholder:M,translate:r,moved:i,transition:w,alignment:a.alignment,styles:S,animation:n??void 0,getElementMutationObserver:()=>xe,cleanup:je,restoreFocus:Ae})})}});return()=>{je(),Pe()}},zS(HC,4,`overlay`,BC,qC,UC),LS(HC,qC),qC.configure=pv(qC);var JC=qC,YC=!0,XC=!1,ZC,QC,$C=[J],ew=Vx.Forward,tw,nw,rw;QC=(ZC=[J],Vx.Reverse);var iw=class{constructor(){HS(this,nw,RS(tw,8,this,YC)),RS(tw,11,this),HS(this,rw,RS(tw,12,this,YC)),RS(tw,15,this)}isLocked(e){return e===Vx.Idle?!1:e==null?this[Vx.Forward]===YC&&this[Vx.Reverse]===YC:this[e]===YC}unlock(e){e!==Vx.Idle&&(this[e]=XC)}};tw=NS(null),nw=new WeakMap,rw=new WeakMap,zS(tw,4,ew,$C,iw,nw),zS(tw,4,QC,ZC,iw,rw),LS(tw,iw);var aw=[Vx.Forward,Vx.Reverse],ow=class{constructor(){this.x=new iw,this.y=new iw}isLocked(){return this.x.isLocked()&&this.y.isLocked()}},sw=class extends yv{constructor(e){super(e);let t=Gh(new ow),n=null;this.signal=t,tg(()=>{let{status:r}=e.dragOperation;if(!r.initialized){n=null,t.value=new ow;return}let{delta:i}=e.dragOperation.position;if(n){let e={x:cw(i.x,n.x),y:cw(i.y,n.y)},r=t.peek();Nh(()=>{for(let t of B_)for(let n of aw)e[t]===n&&r[t].unlock(n);t.value=r})}n=i})}get current(){return this.signal.peek()}};function cw(e,t){return Math.sign(e-t)}var lw,uw,dw,fw,pw,mw,hw=class extends (uw=bv,lw=[J],uw){constructor(e){super(e),HS(this,fw,RS(dw,8,this,!1)),RS(dw,11,this),HS(this,pw),HS(this,mw,()=>{if(!$(this,pw))return;let{element:e,by:t}=$(this,pw);t.y&&(e.scrollTop+=t.y),t.x&&(e.scrollLeft+=t.x)}),this.scroll=(e,t)=>{if(this.disabled)return!1;let n=this.getScrollableElements();if(!n)return US(this,pw,void 0),!1;let{position:r}=this.manager.dragOperation,i=r?.current;if(i){let{by:r}=e??{},a=r?{x:gw(r.x),y:gw(r.y)}:void 0,o=a?void 0:this.scrollIntentTracker.current;if(o?.isLocked())return!1;for(let e of n){let n=Cx(e,r);if(n.x||n.y){let{speed:n,direction:s}=Wx(e,i,a,t?.acceleration,t?.threshold);if(o)for(let e of B_)o[e].isLocked(s[e])&&(n[e]=0,s[e]=0);if(s.x||s.y){let{x:t,y:i}=r??s,a=t*n.x,o=i*n.y;if(a||o){let t=$(this,pw)?.by;if(this.autoScrolling&&t&&(t.x&&!a||t.y&&!o))continue;return US(this,pw,{element:e,by:{x:a,y:o}}),Tx.schedule($(this,mw)),!0}}}}}return US(this,pw,void 0),!1};let t=null,n=null,r=kg(()=>{let{position:n,source:r}=e.dragOperation;if(!n)return null;let i=Fb(Ab(r?.element),n.current);return i&&(t=i),i??t}),i=kg(()=>{let t=r.value,{documentElement:i}=yb(t);if(!t||t===i){let{target:t}=e.dragOperation,r=t?.element;if(r){let e=Px(r,{excludeElement:!1});return n=e,e}}if(t){let e=Px(t,{excludeElement:!1});return this.autoScrolling&&n&&e.size<n?.size?n:(n=e,e)}return n=null,null},Ag);this.getScrollableElements=()=>i.value,this.scrollIntentTracker=new sw(e),this.destroy=e.monitor.addEventListener(`dragmove`,t=>{!this.disabled&&!t.defaultPrevented&&cS(e.dragOperation.activatorEvent)&&t.by&&this.scroll({by:t.by})&&t.preventDefault()})}};dw=NS(uw),fw=new WeakMap,pw=new WeakMap,mw=new WeakMap,zS(dw,4,`autoScrolling`,lw,hw,fw),LS(dw,hw);function gw(e){return e>0?Vx.Forward:e<0?Vx.Reverse:Vx.Idle}var _w=new class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{let{tasks:e,resolvers:t}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(let t of e)t();for(let e of t)e()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(e=>this.resolvers.add(e))}}(e=>{typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}),vw=10,yw=class extends yv{constructor(e,t){super(e,t);let n=e.registry.plugins.get(hw);if(!n)throw Error(`AutoScroller plugin depends on Scroller plugin`);this.destroy=tg(()=>{if(this.disabled)return;let{position:t,status:r}=e.dragOperation;if(r.dragging){let e={acceleration:this.options?.acceleration,threshold:typeof this.options?.threshold==`number`?{x:this.options.threshold,y:this.options.threshold}:this.options?.threshold};if(n.scroll(void 0,e)){n.autoScrolling=!0;let t=setInterval(()=>_w.schedule(()=>n.scroll(void 0,e)),vw);return()=>{clearInterval(t)}}n.autoScrolling=!1}})}};yw.configure=pv(yw);var bw=yw,xw={capture:!0,passive:!0},Sw,Cw=class extends bv{constructor(e){super(e),HS(this,Sw),this.handleScroll=()=>{$(this,Sw)??US(this,Sw,setTimeout(()=>{this.manager.collisionObserver.forceUpdate(!1),US(this,Sw,void 0)},50))};let{dragOperation:t}=this.manager;this.destroy=tg(()=>{if(t.status.dragging){let e=t.source?.element?.ownerDocument??document;return e.addEventListener(`scroll`,this.handleScroll,xw),()=>{e.removeEventListener(`scroll`,this.handleScroll,xw)}}})}};Sw=new WeakMap;var ww=`* { user-select: none !important; -webkit-user-select: none !important; }`,Tw=class extends yv{constructor(e){super(e),this.manager=e;let t=e.registry.plugins.get(_C)?.register(ww);if(this.destroy=tg(()=>{let{dragOperation:e}=this.manager;if(e.status.initialized)return Ew(),document.addEventListener(`selectionchange`,Ew,{capture:!0}),()=>{document.removeEventListener(`selectionchange`,Ew,{capture:!0})}}),t){let e=this.destroy.bind(this);this.destroy=()=>{t(),e()}}}};function Ew(){var e;(e=document.getSelection())==null||e.removeAllRanges()}var Dw=Object.freeze({offset:10,keyboardCodes:{start:[`Space`,`Enter`],cancel:[`Escape`],end:[`Space`,`Enter`,`Tab`],up:[`ArrowUp`],down:[`ArrowDown`],left:[`ArrowLeft`],right:[`ArrowRight`]},preventActivation(e,t){let n=t.handle??t.element;return e.target!==n}}),Ow,kw=class extends Ay{constructor(e,t){super(e),this.manager=e,this.options=t,HS(this,Ow,[]),this.listeners=new zb,this.handleSourceKeyDown=(e,t,n)=>{if(this.disabled||e.defaultPrevented||!sS(e.target)||t.disabled)return;let{keyboardCodes:r=Dw.keyboardCodes,preventActivation:i=Dw.preventActivation}=n??{};r.start.includes(e.code)&&this.manager.dragOperation.status.idle&&(i?.(e,t)||this.handleStart(e,t,n))}}bind(e,t=this.options){return tg(()=>{let n=e.handle??e.element,r=n=>{cS(n)&&this.handleSourceKeyDown(n,e,t)};if(n)return n.addEventListener(`keydown`,r),()=>{n.removeEventListener(`keydown`,r)}})}handleStart(e,t,n){let{element:r}=t;if(!r)throw Error(`Source draggable does not have an associated element`);e.preventDefault(),e.stopImmediatePropagation(),Gx(r);let{center:i}=new rS(r);if(this.manager.actions.start({event:e,coordinates:{x:i.x,y:i.y},source:t}).signal.aborted)return this.cleanup();this.sideEffects();let a=yb(r),o=[this.listeners.bind(a,[{type:`keydown`,listener:e=>this.handleKeyDown(e,t,n),options:{capture:!0}}])];$(this,Ow).push(...o)}handleKeyDown(e,t,n){let{keyboardCodes:r=Dw.keyboardCodes}=n??{};if(jw(e,[...r.end,...r.cancel])){e.preventDefault();let t=jw(e,r.cancel);this.handleEnd(e,t);return}jw(e,r.up)?this.handleMove(`up`,e):jw(e,r.down)&&this.handleMove(`down`,e),jw(e,r.left)?this.handleMove(`left`,e):jw(e,r.right)&&this.handleMove(`right`,e)}handleEnd(e,t){this.manager.actions.stop({event:e,canceled:t}),this.cleanup()}handleMove(e,t){let{shape:n}=this.manager.dragOperation,r=t.shiftKey?5:1,i={x:0,y:0},a=this.options?.offset??Dw.offset;if(typeof a==`number`&&(a={x:a,y:a}),n){switch(e){case`up`:i={x:0,y:-a.y*r};break;case`down`:i={x:0,y:a.y*r};break;case`left`:i={x:-a.x*r,y:0};break;case`right`:i={x:a.x*r,y:0}}(i.x||i.y)&&(t.preventDefault(),this.manager.actions.move({event:t,by:i}))}}sideEffects(){let e=this.manager.registry.plugins.get(bw);e?.disabled===!1&&(e.disable(),$(this,Ow).push(()=>{e.enable()}))}cleanup(){$(this,Ow).forEach(e=>e()),US(this,Ow,[])}destroy(){this.cleanup(),this.listeners.clear()}};Ow=new WeakMap,kw.configure=pv(kw),kw.defaults=Dw;var Aw=kw;function jw(e,t){return t.includes(e.code)}var Mw,Nw=class extends Ny{constructor(){super(...arguments),HS(this,Mw)}onEvent(e){switch(e.type){case`pointerdown`:US(this,Mw,wb(e));break;case`pointermove`:if(!$(this,Mw))return;let{x:t,y:n}=wb(e),r={x:t-$(this,Mw).x,y:n-$(this,Mw).y},{tolerance:i}=this.options;if(i&&R_(r,i)){this.abort();return}R_(r,this.options.value)&&this.activate(e);break;case`pointerup`:this.abort()}}abort(){US(this,Mw,void 0)}};Mw=new WeakMap;var Pw,Fw,Iw=class extends Ny{constructor(){super(...arguments),HS(this,Pw),HS(this,Fw)}onEvent(e){switch(e.type){case`pointerdown`:US(this,Fw,wb(e)),US(this,Pw,setTimeout(()=>this.activate(e),this.options.value));break;case`pointermove`:if(!$(this,Fw))return;let{x:t,y:n}=wb(e);R_({x:t-$(this,Fw).x,y:n-$(this,Fw).y},this.options.tolerance)&&this.abort();break;case`pointerup`:this.abort()}}abort(){$(this,Pw)&&(clearTimeout($(this,Pw)),US(this,Fw,void 0),US(this,Pw,void 0))}};Pw=new WeakMap,Fw=new WeakMap;var Lw=class{};Lw.Delay=Iw,Lw.Distance=Nw;var Rw=Object.freeze({activationConstraints(e,t){let{pointerType:n,target:r}=e;if(n!==`mouse`||!sS(r)||t.handle!==r&&!t.handle?.contains(r))return n===`touch`?[new Lw.Delay({value:250,tolerance:5})]:uS(r)&&!e.defaultPrevented?[new Lw.Delay({value:200,tolerance:0})]:[new Lw.Delay({value:200,tolerance:10}),new Lw.Distance({value:5})]},preventActivation(e,t){let{target:n}=e;if(n===t.element||n===t.handle||!sS(n)||t.handle?.contains(n))return!1;let r=Rb(n);return r!==t.element&&!!r}}),zw,Bw=class extends Ay{constructor(e,t){super(e),this.manager=e,this.options=t,HS(this,zw,new Set),this.listeners=new zb,this.latest={event:void 0,coordinates:void 0},this.handleMove=()=>{let{event:e,coordinates:t}=this.latest;e&&t&&this.manager.actions.move({event:e,to:t})},this.handleCancel=this.handleCancel.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}activationConstraints(e,t,n=this.options){let{activationConstraints:r=Rw.activationConstraints}=n??{};return typeof r==`function`?r(e,t):r}bind(e,t=this.options){return tg(()=>{let n=new AbortController,{signal:r}=n,i=n=>{lS(n)&&this.handlePointerDown(n,e,t)},a=[e.handle??e.element];t?.activatorElements&&(a=Array.isArray(t.activatorElements)?t.activatorElements:t.activatorElements(e));for(let e of a)e&&(Kw(e.ownerDocument.defaultView),e.addEventListener(`pointerdown`,i,{signal:r}));return()=>n.abort()})}handlePointerDown(e,t,n){if(this.disabled||!e.isPrimary||e.button!==0||!sS(e.target)||t.disabled||Hw(e)||!this.manager.dragOperation.status.idle)return;let{preventActivation:r=Rw.preventActivation}=n??{};if(r?.(e,t))return;let{target:i}=e,a=_b(i)&&i.draggable&&i.getAttribute(`draggable`)===`true`,o=Fx(t.element),{x:s,y:c}=wb(e);this.initialCoordinates={x:s*o.scaleX+o.x,y:c*o.scaleY+o.y};let l=this.activationConstraints(e,t,n);e.sensor=this;let u=new jy(l,e=>this.handleStart(t,e));u.signal.onabort=()=>this.handleCancel(e),u.onEvent(e),this.controller=u;let d=Eb(),f=this.listeners.bind(d,[{type:`pointermove`,listener:e=>this.handlePointerMove(e,t)},{type:`pointerup`,listener:this.handlePointerUp,options:{capture:!0}},{type:`pointercancel`,listener:this.handleCancel},{type:`dragstart`,listener:a?this.handleCancel:Uw,options:{capture:!0}}]);$(this,zw).add(()=>{f(),this.initialCoordinates=void 0})}handlePointerMove(e,t){var n;if(this.controller?.activated===!1){(n=this.controller)==null||n.onEvent(e);return}if(this.manager.dragOperation.status.dragging){let n=wb(e),r=Fx(t.element);n.x=n.x*r.scaleX+r.x,n.y=n.y*r.scaleY+r.y,e.preventDefault(),e.stopPropagation(),this.latest.event=e,this.latest.coordinates=n,Tx.schedule(this.handleMove)}}handlePointerUp(e){let{status:t}=this.manager.dragOperation;if(!t.idle){e.preventDefault(),e.stopPropagation();let n=!t.initialized;this.manager.actions.stop({event:e,canceled:n})}this.cleanup()}handleKeyDown(e){e.key===`Escape`&&(e.preventDefault(),this.handleCancel(e))}handleStart(e,t){let{manager:n,initialCoordinates:r}=this;if(!r||!n.dragOperation.status.idle||t.defaultPrevented)return;if(n.actions.start({coordinates:r,event:t,source:e}).signal.aborted)return this.cleanup();t.preventDefault();let i=yb(t.target).body;try{i.setPointerCapture(t.pointerId)}catch{this.handleCancel(t);return}let a=sS(t.target)?[t.target,i]:i,o=this.listeners.bind(a,[{type:`touchmove`,listener:Uw,options:{passive:!1}},{type:`click`,listener:Uw},{type:`contextmenu`,listener:Uw},{type:`keydown`,listener:this.handleKeyDown}]);$(this,zw).add(o)}handleCancel(e){let{dragOperation:t}=this.manager;t.status.initialized&&this.manager.actions.stop({event:e,canceled:!0}),this.cleanup()}cleanup(){let{controller:e}=this;this.controller=void 0,e&&!e.signal.aborted&&e.abort(),this.latest={event:void 0,coordinates:void 0},$(this,zw).forEach(e=>e()),$(this,zw).clear()}destroy(){this.cleanup(),this.listeners.clear()}};zw=new WeakMap,Bw.configure=pv(Bw),Bw.defaults=Rw;var Vw=Bw;function Hw(e){return`sensor`in e}function Uw(e){e.preventDefault()}function Ww(){}var Gw=new WeakSet;function Kw(e){e&&!Gw.has(e)&&(e.addEventListener(`touchmove`,Ww,{capture:!1,passive:!1}),Gw.add(e))}var qw={modifiers:[],plugins:[eC,bw,vC,JC,Tw],sensors:[Vw,Aw]},Jw=class extends ib{constructor(e={}){let t=rb(e.plugins,qw.plugins),n=rb(e.sensors,qw.sensors),r=rb(e.modifiers,qw.modifiers);super(AS(kS({},e),{plugins:[Cw,hw,_C,...t],sensors:n,modifiers:r}))}},Yw,Xw,Zw,Qw,$w,eT,tT=class extends (Zw=Qv,Xw=[J],Yw=[J],Zw){constructor(e,t){var n=e,{element:r,effects:i=()=>[],handle:a}=n,o=MS(n,[`element`,`effects`,`handle`]);super(kS({effects:()=>[...i(),()=>{let{manager:e}=this;if(!e)return;let t=(this.sensors?.map(mv)??[...e.sensors]).map(t=>{let n=t instanceof Ay?t:e.registry.register(t.plugin),r=t instanceof Ay?void 0:t.options;return n.bind(this,r)});return function(){t.forEach(e=>e())}}]},o),t),HS(this,$w,RS(Qw,8,this)),RS(Qw,11,this),HS(this,eT,RS(Qw,12,this)),RS(Qw,15,this),this.element=r,this.handle=a}};Qw=NS(Zw),$w=new WeakMap,eT=new WeakMap,zS(Qw,4,`handle`,Xw,tT,$w),zS(Qw,4,`element`,Yw,tT,eT),LS(Qw,tT);var nT,rT,iT,aT,oT,sT,cT,lT,uT,dT,fT=class extends (iT=fy,rT=[J],nT=[J],iT){constructor(e,t){var n=e,{element:r,effects:i=()=>[]}=n,a=MS(n,[`element`,`effects`]);let{collisionDetector:o=gS}=a,s=e=>{let{manager:t,element:n}=this;if(!n||e===null){this.shape=void 0;return}if(!t)return;let r=new rS(n),i=q(()=>this.shape);return r&&i?.equals(r)?i:(this.shape=r,r)},c=Gh(!1);super(AS(kS({},a),{collisionDetector:o,effects:()=>[...i(),()=>{let{element:e,manager:t}=this;if(!t)return;let{dragOperation:n}=t,{source:r}=n;c.value=!!(r&&n.status.initialized&&e&&!this.disabled&&this.accepts(r))},()=>{let{element:e}=this;if(c.value&&e){let t=new vx(e,s);return()=>{t.disconnect(),this.shape=void 0}}},()=>{if(this.manager?.dragOperation.status.initialized)return()=>{this.shape=void 0}}]}),t),HS(this,uT),HS(this,oT,RS(aT,8,this)),RS(aT,11,this),HS(this,dT,RS(aT,12,this)),RS(aT,15,this),this.element=r,this.refreshShape=()=>s()}set element(e){US(this,uT,e,lT)}get element(){return this.proxy??$(this,uT,cT)}};aT=NS(iT),oT=new WeakMap,uT=new WeakSet,dT=new WeakMap,sT=zS(aT,20,`#element`,rT,uT,oT),cT=sT.get,lT=sT.set,zS(aT,4,`proxy`,nT,fT,dT),LS(aT,fT);var pT=e(a(),1);function mT(e){return typeof e==`object`&&!!e&&`current`in e}function hT(e){if(e!=null)return mT(e)?e.current??void 0:e}var gT=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?I.useLayoutEffect:I.useEffect;function _T(){let e=(0,I.useState)(0)[1];return(0,I.useCallback)(()=>{e(e=>e+1)},[e])}function vT(e,t=!1){let n=(0,I.useRef)(e.peek()),r=(0,I.useRef)(!1),i=_T();return gT(()=>tg(()=>{let a=n.current,o=e.value;if(a!==o){if(n.current=o,!r.current)return;t?(0,pT.flushSync)(i):i()}}),[e,t,i]),{get value(){return r.current=!0,e.peek()}}}function yT(e,t=[],n=!1){let r=(0,I.useRef)(e);return r.current=e,vT((0,I.useMemo)(()=>kg(()=>r.current()),t),n)}function bT(e,t){let n=(0,I.useRef)(new Map),r=_T();return gT(()=>{if(!e){n.current.clear();return}return tg(()=>{let i=!1,a=!1;for(let r of n.current){let[o]=r,s=q(()=>r[1]),c=e[o];s!==c&&(i=!0,n.current.set(o,c),a=t?.(o,s,c)??!1)}i&&(a?queueMicrotask(()=>(0,pT.flushSync)(r)):r())})},[e]),(0,I.useMemo)(()=>e&&new Proxy(e,{get(e,t){let r=e[t];return n.current.set(t,r),r}}),[e])}function xT(e,t){e()}function ST(e){let t=(0,I.useRef)(e);return gT(()=>{t.current=e},[e]),t}function CT(e,t,n=I.useEffect,r=Object.is){let i=(0,I.useRef)(e);n(()=>{let n=i.current;r(e,n)||(i.current=e,t(e,n))},[t,e])}function wT(e,t){let n=(0,I.useRef)(hT(e));gT(()=>{let r=hT(e);r!==n.current&&(n.current=r,t(r))})}var TT=Object.getOwnPropertySymbols,ET=Object.prototype.hasOwnProperty,DT=Object.prototype.propertyIsEnumerable,OT=(e,t)=>{var n={};for(var r in e)ET.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&TT)for(var r of TT(e))t.indexOf(r)<0&&DT.call(e,r)&&(n[r]=e[r]);return n},kT=new Jw,AT=(0,I.createContext)(kT),jT=(0,I.memo)((0,I.forwardRef)(({children:e},t)=>{let[n,r]=(0,I.useState)(0),i=(0,I.useRef)(null),a=(0,I.useRef)(null),o=(0,I.useMemo)(()=>({renderer:{get rendering(){return i.current??Promise.resolve()}},trackRendering(e){i.current||=new Promise(e=>{a.current=e}),(0,I.startTransition)(()=>{e(),r(e=>e+1)})}}),[]);return gT(()=>{var e;(e=a.current)==null||e.call(a),i.current=null},[e,n]),(0,I.useImperativeHandle)(t,()=>o),null})),MT=[void 0,Ag];function NT(e){var t=e,{children:n,onCollision:r,onBeforeDragStart:i,onDragStart:a,onDragMove:o,onDragOver:s,onDragEnd:c}=t,l=OT(t,[`children`,`onCollision`,`onBeforeDragStart`,`onDragStart`,`onDragMove`,`onDragOver`,`onDragEnd`]);let u=(0,I.useRef)(null),{plugins:d,modifiers:f,sensors:p}=l,m=rb(d,qw.plugins),h=rb(p,qw.sensors),g=rb(f,qw.modifiers),_=ST(i),v=ST(a),y=ST(s),b=ST(o),x=ST(c),S=ST(r),C=PT(()=>l.manager??new Jw(l));return(0,I.useEffect)(()=>{if(!u.current)throw Error(`Renderer not found`);let{renderer:e,trackRendering:t}=u.current,{monitor:n}=C;C.renderer=e;let r=[n.addEventListener(`beforedragstart`,e=>{let n=_.current;n&&t(()=>n(e,C))}),n.addEventListener(`dragstart`,e=>v.current?.call(v,e,C)),n.addEventListener(`dragover`,e=>{let n=y.current;n&&t(()=>n(e,C))}),n.addEventListener(`dragmove`,e=>{let n=b.current;n&&t(()=>n(e,C))}),n.addEventListener(`dragend`,e=>{let n=x.current;n&&t(()=>n(e,C))}),n.addEventListener(`collision`,e=>S.current?.call(S,e,C))];return()=>r.forEach(e=>e())},[C]),CT(m,()=>C&&(C.plugins=m),...MT),CT(h,()=>C&&(C.sensors=h),...MT),CT(g,()=>C&&(C.modifiers=g),...MT),(0,K.jsxs)(AT.Provider,{value:C,children:[(0,K.jsx)(jT,{ref:u,children:n}),n]})}function PT(e){let t=(0,I.useRef)(null);return t.current||=e(),(0,I.useInsertionEffect)(()=>()=>t.current?.destroy(),[]),t.current}function FT(){return(0,I.useContext)(AT)}function IT(e){let t=FT()??void 0,[n]=(0,I.useState)(()=>e(t));return n.manager!==t&&(n.manager=t),gT(n.register,[t,n]),n}function LT({children:e,className:t,dropAnimation:n,style:r,tag:i,disabled:a}){let o=(0,I.useRef)(null),s=FT(),c=yT(()=>s?.dragOperation.source,[s]).value??null,l=typeof a==`function`?a(c):a;(0,I.useEffect)(()=>{if(!o.current||!s||l)return;let e=s.plugins.find(e=>e instanceof JC);if(e)return e.overlay=o.current,()=>{e.overlay=void 0}},[s,l]),(0,I.useEffect)(()=>{if(!s)return;let e=s.plugins.find(e=>e instanceof JC);if(e)return e.dropAnimation=n,()=>{e.dropAnimation=void 0}},[s,n]);let u=(0,I.useMemo)(()=>{if(!s)return null;let e=new Proxy(s.registry,{get(e,t){return t===`register`||t===`unregister`?RT:e[t]}});return new Proxy(s,{get(t,n){return n===`registry`?e:t[n]}})},[s]);return(0,K.jsx)(AT.Provider,{value:u,children:(0,I.createElement)(i||`div`,{ref:o,className:t,style:r,"data-dnd-overlay":!0},d())});function d(){return!c||l?null:typeof e==`function`?(0,K.jsx)(zT,{source:c,children:e}):e}}function RT(){return()=>{}}function zT({children:e,source:t}){return e(bT(t))}var BT=Object.create,VT=Object.defineProperty,HT=Object.getOwnPropertyDescriptor,UT=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),WT=e=>{throw TypeError(e)},GT=(e,t,n)=>t in e?VT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,KT=e=>[,,,BT(e?.[UT(`metadata`)]??null)],qT=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],JT=e=>e!==void 0&&typeof e!=`function`?WT(`Function expected`):e,YT=(e,t,n,r,i)=>({kind:qT[e],name:t,metadata:r,addInitializer:e=>n._?WT(`Already initialized`):i.push(JT(e||null))}),XT=(e,t)=>GT(t,UT(`metadata`),e[3]),ZT=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)a[i].call(n);return r},QT=(e,t,n,r,i,a)=>{for(var o,s,c,l,u=t&7,d=!1,f=!1,p=2,m=qT[u+5],h=e[p]||(e[p]=[]),g=(i=i.prototype,HT(i,n)),_=r.length-1;_>=0;_--)c=YT(u,n,s={},e[3],h),c.static=d,c.private=f,l=c.access={has:e=>n in e},l.get=e=>e[n],o=(0,r[_])(g[m],c),s._=1,JT(o)&&(g[m]=o);return g&&VT(i,n,g),i},$T=(e,t,n)=>t.has(e)||WT(`Cannot `+n),eE=(e,t,n)=>($T(e,t,`read from private field`),t.get(e)),tE=(e,t,n)=>t.has(e)?WT(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),nE=(e,t,n,r)=>($T(e,t,`write to private field`),t.set(e,n),n),rE=class e{constructor(e,t){this.x=e,this.y=t}static delta(t,n){return new e(t.x-n.x,t.y-n.y)}static distance(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}static equals(e,t){return e.x===t.x&&e.y===t.y}static from({x:t,y:n}){return new e(t,n)}},iE,aE,oE,sE,cE,lE=class extends (oE=e_,aE=[jg],iE=[jg],oE){constructor(e){let t=rE.from(e);super(t,(e,t)=>rE.equals(e,t)),ZT(cE,5,this),tE(this,sE,0),this.velocity={x:0,y:0}}get delta(){return rE.delta(this.current,this.initial)}get direction(){let{current:e,previous:t}=this;if(!t)return null;let n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?`right`:`left`:n.y>0?`down`:`up`}get current(){return super.current}set current(e){let{current:t}=this,n=rE.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),a=i-eE(this,sE),o=e=>Math.round(e/a*100);Nh(()=>{nE(this,sE,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(rE.from(e)),this.velocity={x:0,y:0}}};cE=KT(oE),sE=new WeakMap,QT(cE,2,`delta`,aE,lE),QT(cE,2,`direction`,iE,lE),XT(cE,lE);var uE=(e=>(e.Horizontal=`x`,e.Vertical=`y`,e))(uE||{});Object.values(uE);function dE(){let e=FT(),t=yT(()=>e?.dragOperation.source,[e]),n=yT(()=>e?.dragOperation.target,[e]);return{get source(){return t.value},get target(){return n.value}}}var fE=Object.create,pE=Object.defineProperty,mE=Object.defineProperties,hE=Object.getOwnPropertyDescriptor,gE=Object.getOwnPropertyDescriptors,_E=Object.getOwnPropertySymbols,vE=Object.prototype.hasOwnProperty,yE=Object.prototype.propertyIsEnumerable,bE=(e,t)=>(t=Symbol[e])?t:Symbol.for(`Symbol.`+e),xE=e=>{throw TypeError(e)},SE=(e,t,n)=>t in e?pE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,CE=(e,t)=>{for(var n in t||={})vE.call(t,n)&&SE(e,n,t[n]);if(_E)for(var n of _E(t))yE.call(t,n)&&SE(e,n,t[n]);return e},wE=(e,t)=>mE(e,gE(t)),TE=(e,t)=>{var n={};for(var r in e)vE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_E)for(var r of _E(e))t.indexOf(r)<0&&yE.call(e,r)&&(n[r]=e[r]);return n},EE=e=>[,,,fE(null)],DE=[`class`,`method`,`getter`,`setter`,`accessor`,`field`,`value`,`get`,`set`],OE=e=>e!==void 0&&typeof e!=`function`?xE(`Function expected`):e,kE=(e,t,n,r,i)=>({kind:DE[e],name:t,metadata:r,addInitializer:e=>n._?xE(`Already initialized`):i.push(OE(e||null))}),AE=(e,t)=>SE(t,bE(`metadata`),e[3]),jE=(e,t,n,r)=>{for(var i=0,a=e[t>>1],o=a&&a.length;i<o;i++)t&1?a[i].call(n):r=a[i].call(n,r);return r},ME=(e,t,n,r,i,a)=>{for(var o,s,c,l,u,d=t&7,f=!1,p=!1,m=e.length+1,h=DE[d+5],g=e[m-1]=[],_=e[m]||(e[m]=[]),v=(i=i.prototype,hE({get[n](){return PE(this,a)},set[n](e){return IE(this,a,e)}},n)),y=r.length-1;y>=0;y--)l=kE(d,n,c={},e[3],_),l.static=f,l.private=p,u=l.access={has:e=>n in e},u.get=e=>e[n],u.set=(e,t)=>e[n]=t,s=(0,r[y])({get:v.get,set:v.set},l),c._=1,s===void 0?OE(s)&&(v[h]=s):typeof s!=`object`||!s?xE(`Object expected`):(OE(o=s.get)&&(v.get=o),OE(o=s.set)&&(v.set=o),OE(o=s.init)&&g.unshift(o));return v&&pE(i,n,v),i},NE=(e,t,n)=>t.has(e)||xE(`Cannot `+n),PE=(e,t,n)=>(NE(e,t,`read from private field`),t.get(e)),FE=(e,t,n)=>t.has(e)?xE(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),IE=(e,t,n,r)=>(NE(e,t,`write to private field`),t.set(e,n),n);function LE(e){return e instanceof CD||e instanceof SD}var RE=10,zE=class extends yv{constructor(e){super(e);let t=tg(()=>{let{dragOperation:t}=e;if(cS(t.activatorEvent)&&LE(t.source)&&t.status.initialized){let t=e.registry.plugins.get(hw);if(t)return t.disable(),()=>t.enable()}}),n=e.monitor.addEventListener(`dragmove`,(e,t)=>{queueMicrotask(()=>{if(this.disabled||e.defaultPrevented||!e.nativeEvent)return;let{dragOperation:n}=t;if(!cS(e.nativeEvent)||!LE(n.source)||!n.shape)return;let{actions:r,collisionObserver:i,registry:a}=t,{by:o}=e;if(!o)return;let s=BE(o),{source:c,target:l}=n,{center:u}=n.shape.current,d=[],f=[];Nh(()=>{for(let e of a.droppables){let{id:t}=e;if(!e.accepts(c)||t===l?.id&&LE(e)||!e.element)continue;let n=e.shape,r=new rS(e.element,{getBoundingClientRect:e=>Cb(e,void 0,.2)});r.height&&r.width&&(s==`down`&&u.y+RE<r.center.y||s==`up`&&u.y-RE>r.center.y||s==`left`&&u.x-RE>r.center.x||s==`right`&&u.x+RE<r.center.x)&&(d.push(e),e.shape=r,f.push(()=>e.shape=n))}}),e.preventDefault(),i.disable();let p=i.computeCollisions(d,_S);Nh(()=>f.forEach(e=>e()));let[m]=p;if(!m)return;let{id:h}=m,{index:g,group:_}=c.sortable;r.setDropTarget(h).then(()=>{let{source:e,target:t,shape:a}=n;if(!e||!LE(e)||!a)return;let{index:o,group:s,target:c}=e.sortable,l=g!==o||_!==s,u=l?c:t?.element;if(!u)return;Gx(u);let d=new rS(u);if(!d)return;let f=A_.delta(d,A_.from(a.current.boundingRectangle),e.alignment);r.move({by:f}),l?r.setDropTarget(e.id).then(()=>i.enable()):i.enable()})})});this.destroy=()=>{n(),t()}}};function BE(e){let{x:t,y:n}=e;if(t>0)return`right`;if(t<0)return`left`;if(n>0)return`down`;if(n<0)return`up`}var VE=Object.defineProperty,HE=Object.defineProperties,UE=Object.getOwnPropertyDescriptors,WE=Object.getOwnPropertySymbols,GE=Object.prototype.hasOwnProperty,KE=Object.prototype.propertyIsEnumerable,qE=(e,t,n)=>t in e?VE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,JE=(e,t)=>{for(var n in t||={})GE.call(t,n)&&qE(e,n,t[n]);if(WE)for(var n of WE(t))KE.call(t,n)&&qE(e,n,t[n]);return e},YE=(e,t)=>HE(e,UE(t));function XE(e,t,n){if(t===n)return e;let r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function ZE(e,t){let n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}function QE(e){return`initialIndex`in e&&typeof e.initialIndex==`number`&&`index`in e&&typeof e.index==`number`}function $E(e,t,n){let{source:r,target:i,canceled:a}=t.operation;if(!r||!i||a)return`preventDefault`in t&&t.preventDefault(),e;let o=(e,t)=>e===t||typeof e==`object`&&!!e&&`id`in e&&e.id===t;if(Array.isArray(e)){let s=e.findIndex(e=>o(e,r.id)),c=e.findIndex(e=>o(e,i.id));if(s===-1||c===-1){if(QE(r)){let i=r.initialIndex,a=r.index;return i===a||i<0||i>=e.length?(`preventDefault`in t&&t.preventDefault(),e):n(e,i,a)}return e}if(!a&&`index`in r&&typeof r.index==`number`){let t=r.index;if(t!==s)return n(e,s,t)}return n(e,s,c)}let s=Object.entries(e),c=-1,l,u=-1,d;for(let[e,t]of s)if(c===-1&&(c=t.findIndex(e=>o(e,r.id)),c!==-1&&(l=e)),u===-1&&(u=t.findIndex(e=>o(e,i.id)),u!==-1&&(d=e)),c!==-1&&u!==-1)break;if(c===-1&&QE(r)){let i=r.initialGroup==null?void 0:ZE(e,r.initialGroup),a=r.initialIndex,o=r.group==null?void 0:ZE(e,r.group),s=r.index;if(i==null||o==null||i===o&&a===s)return`preventDefault`in t&&t.preventDefault(),e;if(i===o)return YE(JE({},e),{[i]:n(e[i],a,s)});let c=e[i][a];return YE(JE({},e),{[i]:[...e[i].slice(0,a),...e[i].slice(a+1)],[o]:[...e[o].slice(0,s),c,...e[o].slice(s)]})}if(!r.manager)return e;let{dragOperation:f}=r.manager,p=f.shape?.current.center??f.position.current;if(d==null){let t=ZE(e,i.id);if(t!=null){let n=i.shape&&p.y>i.shape.center.y?e[t].length:0;d=t,u=n}}if(l==null||d==null||l===d&&c===u){if(l!=null&&l===d&&c===u&&QE(r)){let t=r.group==null?void 0:ZE(e,r.group),i=r.group!=null&&t!==l,a=r.index!==c;if(i||a){let i=r.group==null?l:t;if(i!=null){if(l===i)return YE(JE({},e),{[l]:n(e[l],c,r.index)});let t=e[l][c];return YE(JE({},e),{[l]:[...e[l].slice(0,c),...e[l].slice(c+1)],[i]:[...e[i].slice(0,r.index),t,...e[i].slice(r.index)]})}}}return`preventDefault`in t&&t.preventDefault(),e}if(l===d)return YE(JE({},e),{[l]:n(e[l],c,u)});let m=i.shape&&Math.round(p.y)>Math.round(i.shape.center.y)?1:0,h=e[l][c];return YE(JE({},e),{[l]:[...e[l].slice(0,c),...e[l].slice(c+1)],[d]:[...e[d].slice(0,u+m),h,...e[d].slice(u+m)]})}function eD(e,t){return $E(e,t,XE)}function tD(e){let t=new Map;for(let[,n]of e)for(let e of n)t.set(e.id,e.index);return t}function nD(e,t,n){for(let[r,i]of t)for(let t of i){let i=e.get(t.id);if(t.index!==i||t.group!==r||!n.get(r)?.has(t))return!0}return!1}var rD=`__default__`,iD=class extends yv{constructor(e){super(e);let t=()=>{let t=new Map;for(let n of e.registry.droppables)if(n instanceof CD){let{sortable:e}=n,{group:r}=e,i=t.get(r);i||(i=new Set,t.set(r,i)),i.add(e)}return t},n=[e.monitor.addEventListener(`dragover`,(e,n)=>{if(this.disabled)return;let{dragOperation:r}=n,{source:i,target:a}=r;if(!LE(i)||!LE(a)||i.sortable===a.sortable)return;let o=t(),s=tD(o),c=i.sortable.group===a.sortable.group,l=o.get(i.sortable.group),u=c?l:o.get(a.sortable.group);l&&u&&queueMicrotask(()=>{e.defaultPrevented||n.renderer.rendering.then(()=>{let r=t();if(nD(s,o,r))return;let d=i.sortable.element,f=a.sortable.element;if(!f||!d||!c&&a.id===i.sortable.group)return;let p=cD(l),m=c?p:cD(u),h=i.sortable.group??rD,g=a.sortable.group??rD,_={[h]:p,[g]:m},v=eD(_,e);if(_===v)return;let y=v[g].indexOf(i.sortable),b=v[g].indexOf(a.sortable);n.collisionObserver.disable(),aD(d,y,f,b),Nh(()=>{for(let[e,t]of v[h].entries())t.index=e;if(!c)for(let[e,t]of v[g].entries())t.group=a.sortable.group,t.index=e}),n.actions.setDropTarget(i.id).then(()=>n.collisionObserver.enable())})})}),e.monitor.addEventListener(`dragend`,(e,n)=>{if(!e.canceled)return;let{dragOperation:r}=n,{source:i}=r;LE(i)&&(i.sortable.initialIndex!==i.sortable.index||i.sortable.initialGroup!==i.sortable.group)&&queueMicrotask(()=>{let e=t(),r=tD(e),a=e.get(i.sortable.initialGroup);a&&n.renderer.rendering.then(()=>{let n=t();if(nD(r,e,n))return;let o=cD(a),s=cD(a,sD),c=i.sortable.element,l=o[s.indexOf(i.sortable)],u=l?.element;l&&u&&c&&(aD(c,l.index,u,i.index),Nh(()=>{for(let t of e.values()){let e=Array.from(t).values();for(let t of e)t.index=t.initialIndex,t.group=t.initialGroup}}))})})})];this.destroy=()=>{for(let e of n)e()}}};function aD(e,t,n,r){let i=r<t?`afterend`:`beforebegin`;n.insertAdjacentElement(i,e)}function oD(e,t){return e.index-t.index}function sD(e,t){return e.initialIndex-t.initialIndex}function cD(e,t=oD){return Array.from(e).sort(t)}var lD=[zE,iD],uD={duration:250,easing:`cubic-bezier(0.25, 1, 0.5, 1)`,idle:!1};function dD(e){return typeof e==`boolean`?{draggable:e,droppable:e}:{draggable:e?.draggable??!1,droppable:e?.droppable??!1}}var fD=new r_,pD,mD=[J],hD,gD,_D,vD,yD,bD;pD=[J];var xD=class{constructor(e,t){FE(this,gD,jE(hD,8,this)),jE(hD,11,this),FE(this,_D),FE(this,vD),FE(this,yD,jE(hD,12,this)),jE(hD,15,this),FE(this,bD),this.register=()=>(Nh(()=>{var e,t;(e=this.manager)==null||e.registry.register(this.droppable),(t=this.manager)==null||t.registry.register(this.draggable)}),()=>this.unregister()),this.unregister=()=>{Nh(()=>{var e,t;(e=this.manager)==null||e.registry.unregister(this.droppable),(t=this.manager)==null||t.registry.unregister(this.draggable)})},this.destroy=()=>{Nh(()=>{this.droppable.destroy(),this.draggable.destroy()})};var n=e,{effects:r=()=>[],disabled:i,group:a,index:o,sensors:s,type:c,transition:l=uD,plugins:u}=n,d=TE(n,[`effects`,`disabled`,`group`,`index`,`sensors`,`type`,`transition`,`plugins`]);let f=rb(u,lD),p=dD(i);this.droppable=new CD(wE(CE({},d),{disabled:p.droppable}),t,this),this.draggable=new SD(wE(CE({},d),{disabled:p.draggable,plugins:f,effects:()=>[()=>{let e=this.manager?.dragOperation.status;e?.initializing&&this.id===this.manager?.dragOperation.source?.id&&fD.clear(this.manager),e?.dragging&&fD.set(this.manager,this.id,q(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{let{index:e,group:t,manager:n}=this,r=PE(this,vD),i=PE(this,_D);(e!==r||t!==i)&&(IE(this,vD,e),IE(this,_D,t),this.animate())},()=>{let{target:e}=this,{isDragSource:t}=this.draggable;(this.draggable.pluginConfig(JC)?.feedback??`default`)===`move`&&t&&(this.droppable.disabled=!e)},...r()],type:c,sensors:s}),t,this),IE(this,bD,d.element),this.manager=t,this.index=o,IE(this,vD,o),this.group=a,IE(this,_D,a),this.type=c,this.transition=l}get initialIndex(){return fD.get(this.manager,this.id)?.initialIndex??this.index}get initialGroup(){return fD.get(this.manager,this.id)?.initialGroup??this.group}animate(){q(()=>{let{manager:e,transition:t}=this,{shape:n}=this.droppable;if(!e)return;let{idle:r}=e.dragOperation.status;n&&t&&(!r||t.idle)&&e.renderer.rendering.then(()=>{let{element:r}=this;if(!r)return;for(let e of r.getAnimations())`transitionProperty`in e&&(e.transitionProperty===`transform`||e.transitionProperty===`translate`||e.transitionProperty===`scale`)&&e.cancel();let i=this.refreshShape();if(!i)return;let a={x:n.boundingRectangle.left-i.boundingRectangle.left,y:n.boundingRectangle.top-i.boundingRectangle.top},{translate:o}=kx(r),s=Zx(r,o,!1),c=Zx(r,o);if(a.x||a.y){let n=jb(hb(r))?wE(CE({},t),{duration:0}):t;Xx({element:r,keyframes:{translate:[`${s.x+a.x}px ${s.y+a.y}px ${s.z}`,`${c.x}px ${c.y}px ${c.z}`]},options:n}).then(()=>{e.dragOperation.status.dragging||(this.droppable.shape=void 0)})}})})}get manager(){return this.draggable.manager}set manager(e){Nh(()=>{this.draggable.manager=e,this.droppable.manager=e})}set element(e){Nh(()=>{let t=PE(this,bD),n=this.droppable.element,r=this.draggable.element;(!n||n===t)&&(this.droppable.element=e),(!r||r===t)&&(this.draggable.element=e),IE(this,bD,e)})}get element(){let e=PE(this,bD);if(e)return Lb.get(e)??e??this.droppable.element}set target(e){this.droppable.element=e}get target(){return this.droppable.element}set source(e){this.draggable.element=e}get source(){return this.draggable.element}get disabled(){let{disabled:e}=this.draggable,{disabled:t}=this.droppable;return e===t?e:{draggable:e,droppable:t}}set plugins(e){this.draggable.plugins=rb(e,lD)}set disabled(e){let t=dD(e);Nh(()=>{this.droppable.disabled=t.droppable,this.draggable.disabled=t.draggable})}set data(e){Nh(()=>{this.droppable.data=e,this.draggable.data=e})}set handle(e){this.draggable.handle=e}set id(e){this.droppable.id=e,this.draggable.id=e}get id(){return this.droppable.id}set sensors(e){this.draggable.sensors=e}set modifiers(e){this.draggable.modifiers=e}set collisionPriority(e){this.droppable.collisionPriority=e}set collisionDetector(e){this.droppable.collisionDetector=e??gS}set alignment(e){this.draggable.alignment=e}get alignment(){return this.draggable.alignment}set type(e){Nh(()=>{this.droppable.type=e,this.draggable.type=e})}get type(){return this.draggable.type}set accept(e){this.droppable.accept=e}get accept(){return this.droppable.accept}get isDropTarget(){return this.droppable.isDropTarget}get isDragSource(){return this.draggable.isDragSource}get isDragging(){return this.draggable.isDragging}get isDropping(){return this.draggable.isDropping}get status(){return this.draggable.status}refreshShape(){return this.droppable.refreshShape()}accepts(e){return this.droppable.accepts(e)}};hD=EE(),gD=new WeakMap,_D=new WeakMap,vD=new WeakMap,yD=new WeakMap,bD=new WeakMap,ME(hD,4,`index`,mD,xD,gD),ME(hD,4,`group`,pD,xD,yD),AE(hD,xD);var SD=class extends tT{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get initialIndex(){return this.sortable.initialIndex}get group(){return this.sortable.group}get initialGroup(){return this.sortable.initialGroup}},CD=class extends fT{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get group(){return this.sortable.group}},wD=Object.defineProperty,TD=Object.defineProperties,ED=Object.getOwnPropertyDescriptors,DD=Object.getOwnPropertySymbols,OD=Object.prototype.hasOwnProperty,kD=Object.prototype.propertyIsEnumerable,AD=(e,t,n)=>t in e?wD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jD=(e,t)=>{for(var n in t||={})OD.call(t,n)&&AD(e,n,t[n]);if(DD)for(var n of DD(t))kD.call(t,n)&&AD(e,n,t[n]);return e},MD=(e,t)=>TD(e,ED(t));function ND(e){let{accept:t,collisionDetector:n,collisionPriority:r,id:i,data:a,element:o,handle:s,index:c,group:l,disabled:u,modifiers:d,sensors:f,target:p,type:m,plugins:h}=e,g=jD(jD({},uD),e.transition),_=IT(t=>new xD(MD(jD({},e),{transition:g,register:!1,handle:hT(s),element:hT(o),target:hT(p)}),t)),v=bT(_,PD);return CT(i,()=>_.id=i),gT(()=>{Nh(()=>{_.group=l,_.index=c})},[_,l,c]),CT(m,()=>_.type=m),CT(t,()=>_.accept=t,void 0,Ag),CT(a,()=>a&&(_.data=a)),CT(c,()=>{_.manager?.dragOperation.status.idle&&g?.idle&&_.refreshShape()},xT),wT(s,e=>_.handle=e),wT(o,e=>_.element=e),wT(p,e=>_.target=e),CT(u,()=>_.disabled=u??!1,void 0,Ag),CT(f,()=>_.sensors=f,void 0,Ag),CT(n,()=>_.collisionDetector=n),CT(r,()=>_.collisionPriority=r),CT(h,()=>_.plugins=h,void 0,Ag),CT(g,()=>_.transition=g,void 0,Ag),CT(d,()=>_.modifiers=d,void 0,Ag),CT(e.alignment,()=>_.alignment=e.alignment),{sortable:v,get isDragging(){return v.isDragging},get isDropping(){return v.isDropping},get isDragSource(){return v.isDragSource},get isDropTarget(){return v.isDropTarget},handleRef:(0,I.useCallback)(e=>{_.handle=e??void 0},[_]),ref:(0,I.useCallback)(e=>{(e||!_.element?.isConnected||_.manager?.dragOperation.status.idle)&&(_.element=e??void 0)},[_]),sourceRef:(0,I.useCallback)(e=>{(e||!_.source?.isConnected||_.manager?.dragOperation.status.idle)&&(_.source=e??void 0)},[_]),targetRef:(0,I.useCallback)(e=>{(e||!_.target?.isConnected||_.manager?.dragOperation.status.idle)&&(_.target=e??void 0)},[_])}}function PD(e,t,n){return!(e!==`isDragSource`||n||!t)}var FD=`Input and generated documents`,ID=`Outside a repository`,LD=`Checking repositories`,RD=`Unknown checkout`;function zD(){return{directories:new Map,documents:[]}}function BD(e,t,n,r){let i=e;for(let e of t){let t=i.directories.get(e);t||(t=zD(),i.directories.set(e,t)),i=t}i.documents.push({document:n,name:r})}function VD(e,t){let n=[];for(let[r,i]of e.directories){let e=r,a=i;for(;a.documents.length===0&&a.directories.size===1;){let[t,n]=[...a.directories.entries()][0];e=`${e}/${t}`,a=n}let o=`${t}/${e}`;n.push({kind:`directory`,key:o,name:e,children:VD(a,o)})}for(let{document:t,name:r}of e.documents)n.push({kind:`document`,key:t.documentId,name:r,document:t});return n}function HD(e){return e.replace(/[\\/]\.git$/,``)}function UD(e,t=ne(e)){let n=new Map,r=zD(),i=zD(),a=[],o=!1,s=!1;for(let c of e){let e=ae(c);if(e.kind===`input`){a.push(c);continue}if(e.kind===`pending`||e.kind===`outside`){BD(e.kind===`pending`?r:i,c.pathSegments.slice(0,-1),c,_(c)),e.kind===`pending`?o=!0:s=!0;continue}let l=n.get(e.key);l||(l={key:e.key,name:t.repository.get(e.key)??e.repository.nameSegments.at(-1)??``,location:HD(e.repository.id),reason:e.kind===`unresolved`?e.repository.reason:null,main:zD(),unknown:null,worktrees:new Map},n.set(e.key,l));let u=d(c),f=_(c),p=e.kind===`repository`?e.repository.checkout:void 0;if(p===null)l.unknown??=zD(),BD(l.unknown,u,c,f);else if(p?.kind===`linked`){let e=l.worktrees.get(p.id);e||(e={name:t.worktree.get(p.id)??p.name,location:p.id,branch:zD()},l.worktrees.set(p.id,e)),BD(e.branch,u,c,f)}else BD(l.main,u,c,f)}let c=[];for(let e of n.values()){let t=VD(e.main,e.key);if(e.unknown){let n=`${e.key}\0unknown`;t.push({kind:`group`,key:n,name:RD,children:VD(e.unknown,n)})}let n=e.main.documents.length===0&&e.main.directories.size===0&&e.unknown===null&&e.worktrees.size===1;for(let[r,i]of e.worktrees){let a=`${e.key}\0worktree:${r}`;t.push({kind:`worktree`,key:a,name:i.name,location:i.location,hidden:n,children:VD(i.branch,a)})}c.push({kind:`repository`,key:e.key,name:e.name,location:e.location,reason:e.reason,merged:n?[...e.worktrees.values()][0]?.name??null:null,children:t})}return o&&c.push({kind:`group`,key:`group:pending`,name:LD,children:VD(r,`group:pending`)}),s&&c.push({kind:`group`,key:`group:outside`,name:ID,children:VD(i,`group:outside`)}),a.length>0&&c.push({kind:`group`,key:`group:input`,name:FD,children:a.map(e=>({kind:`document`,key:e.documentId,name:e.title,document:e}))}),c}var WD={missing:{label:`File missing`,icon:Pd},unreadable:{label:`Unreadable`,icon:Md},updating:{label:`Updating`,icon:Xe},error:{label:`error`,icon:jt}};function GD({document:e}){let t=e.sourceState===`ready`?null:WD[e.sourceState],n=t?.icon??jt,r=t?.label??e.sourceState;return(0,K.jsxs)(K.Fragment,{children:[e.sourceState!==`ready`&&(0,K.jsxs)(`span`,{className:p(`-my-px flex size-5 shrink-0 items-center justify-center`,e.sourceState===`updating`?`text-muted-foreground`:`text-destructive`),title:r,children:[(0,K.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:r})]}),e.pendingRequestIds.length>0&&(0,K.jsxs)(`span`,{className:`-my-px flex size-5 shrink-0 items-center justify-center rounded-full bg-link text-background`,"data-testid":`pending-question`,title:`A question is awaiting your answer`,children:[(0,K.jsx)(Kd,{className:`size-3.5`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:`Question`})]})]})}function KD(e,t,n){let r=[...e],[i]=r.splice(t,1);return i!==void 0&&r.splice(n,0,i),r}function qD(e,t){let n=ae(e),r=[M(C(e,t)),T[e.format]];return n.kind===`unresolved`&&r.push(D[n.repository.reason]),r.join(`. `)}function JD(e,t,n=!1){let r=[e.title,M(C(e,t))];return e.canonicalPath!==null&&r.push(e.canonicalPath),n&&(r.push(`Drag to reorder. Space picks up, ↑↓ moves, Space drops, Escape cancels.`),r.push(`Alt+↑ / Alt+↓ moves it in the list`)),[...new Set(r)].join(`
|
|
122
|
+
`)}function YD({document:e,labels:t,short:r}){let i=ae(e);if(i.kind===`input`)return(0,K.jsxs)(`span`,{className:`truncate`,children:[e.sourceKind===`stdin`?`Standard input`:`Generated`,` ·`,` `,T[e.format]]});let{stem:a,extension:o}=n(M(_(e))),s=r===void 0||r.shown.length===0?``:`${r.elided?`…/`:``}${r.shown.map(M).join(`/`)}/`,c=(0,K.jsxs)(`span`,{className:`flex min-w-0 shrink`,children:[s!==``&&(0,K.jsx)(`span`,{className:`min-w-3 shrink-[100000] truncate`,children:s}),(0,K.jsx)(`span`,{className:`min-w-0 shrink truncate`,children:a}),(0,K.jsx)(`span`,{className:`shrink-0`,"data-part":`extension`,children:o})]});if(i.kind===`outside`)return c;if(i.kind===`pending`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`shrink-0`,children:`Checking repository…`}),c]});let l=M(t.repository.get(i.key)??``),u=i.kind===`repository`?i.repository.checkout:void 0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`flex max-w-[50%] shrink-0 items-center gap-1 font-medium @min-[13rem]/list:max-w-[60%]`,"data-part":`repository`,children:[i.kind===`unresolved`&&(0,K.jsx)(jt,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`bdi`,{className:`min-w-0 truncate`,"data-part":`repository-name`,children:l})]}),u?.kind===`linked`&&(0,K.jsxs)(`span`,{className:`flex min-w-3 shrink-[100000] items-center gap-0.5 overflow-hidden`,"data-part":`worktree`,children:[(0,K.jsx)(St,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`bdi`,{className:`min-w-0 truncate`,children:M(t.worktree.get(u.id)??u.name)})]}),u===null&&(0,K.jsx)(`span`,{className:`min-w-0 shrink-[100000] truncate`,children:`(unknown checkout)`}),c]})}var XD=`[content-visibility:auto]`,ZD=`focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`,QD=[Vw.configure({activatorElements:e=>[e.element],preventActivation:(e,t)=>t.data.canReorder!==!0||e.target instanceof Element&&e.target.closest(`[data-row-action]`)!==null,activationConstraints:e=>e.pointerType===`touch`?[new Lw.Delay({value:250,tolerance:5})]:[new Lw.Distance({value:8})]}),Aw.configure({keyboardCodes:{...Aw.defaults.keyboardCodes,start:[`Space`]},preventActivation:(e,t)=>t.data.canReorder!==!0||e.target!==t.handle})];function $D({document:e,index:t,count:n,labels:r,short:i,active:a,pressedOn:o,onSelect:s,onClose:c,onMove:l}){let u=(0,I.useId)(),d=t>0,f=t<n-1,{ref:m,handleRef:h,isDragSource:g}=ND({id:e.documentId,index:t,disabled:{droppable:n<2},data:{canReorder:n>1},sensors:QD,transition:{duration:180,easing:`ease-out`}});return(0,K.jsxs)(`li`,{ref:m,"data-drag-source":g||void 0,className:p(`group/row relative rounded-md [contain-intrinsic-size:auto_2.75rem]`,XD,n>1&&`cursor-grab active:cursor-grabbing`,a?`bg-selection`:`hover:bg-foreground/5`,g&&`bg-primary/10 outline-2 -outline-offset-2 outline-dashed outline-primary [&>button]:opacity-0 [&>span]:opacity-0`),children:[g&&(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 flex items-center justify-center text-sm font-medium text-primary`,"data-testid":`drop-position`,children:`Drop here`}),(0,K.jsxs)(`button`,{ref:h,type:`button`,className:p(`group/button flex w-full min-w-0 flex-col gap-0.5 rounded-md py-1 pr-2 pl-2 text-left text-sm`,n>1&&`cursor-grab active:cursor-grabbing`,ZD),"aria-current":a?`true`:void 0,"aria-describedby":u,"aria-keyshortcuts":n>1?`Alt+ArrowUp Alt+ArrowDown Space`:void 0,title:JD(e,r,n>1),"data-document-id":e.documentId,onClick:s,onKeyDown:e=>{g||!e.altKey||e.metaKey||e.ctrlKey||(e.key===`ArrowUp`&&d?(e.preventDefault(),l(t-1)):e.key===`ArrowDown`&&f&&(e.preventDefault(),l(t+1)))},children:[(0,K.jsxs)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5 row-open:pr-6`,children:[(0,K.jsx)(Dt,{format:e.format}),(0,K.jsx)(`span`,{className:`min-w-12 flex-1 truncate`,"data-part":`title`,children:e.title}),(0,K.jsx)(GD,{document:e})]}),(0,K.jsx)(`span`,{className:`flex w-full min-w-0 items-center gap-1.5 overflow-hidden pl-6 text-xs text-muted-foreground group-focus-visible/button:hidden`,"aria-hidden":`true`,"data-part":`location`,children:(0,K.jsx)(YD,{document:e,labels:r,short:i})}),(0,K.jsx)(`span`,{className:`hidden pl-6 text-xs break-all text-muted-foreground group-focus-visible/button:block`,"aria-hidden":`true`,"data-part":`location-full`,children:M(C(e,r))})]}),(0,K.jsx)(`span`,{id:u,hidden:!0,children:qD(e,r)}),(0,K.jsx)(`span`,{className:`pointer-events-none absolute top-1 right-1 flex items-center gap-0.5 row-open:pointer-events-auto`,children:(0,K.jsx)(P,{variant:`ghost`,size:`icon-xs`,className:`opacity-0 row-open:opacity-100`,"aria-label":`Remove ${e.title} from the list`,title:`Remove from the list (the file is not deleted)`,"data-row-action":`remove`,onClick:(e=>t=>{t.detail>0&&o.current!==t.currentTarget||e()})(c),children:(0,K.jsx)(at,{"aria-hidden":`true`})})})]})}function eO({document:e,name:t,labels:n,active:r,depth:i,onSelect:a,onClose:o}){let s=(0,I.useId)();return(0,K.jsx)(`li`,{role:`treeitem`,className:p(`[contain-intrinsic-size:auto_1.625rem]`,XD),style:{paddingLeft:`${String(i*.75)}rem`},children:(0,K.jsxs)(`div`,{className:p(`group/row flex items-center gap-1 rounded-md pr-1`,r?`bg-selection`:`hover:bg-foreground/5`),children:[(0,K.jsxs)(`button`,{type:`button`,className:p(`flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1 text-left text-sm`,ZD),"aria-current":r?`true`:void 0,"aria-describedby":s,title:JD(e,n),"data-document-id":e.documentId,onClick:a,children:[(0,K.jsx)(Dt,{format:e.format}),(0,K.jsx)(`bdi`,{className:`min-w-12 flex-1 truncate`,children:M(t)}),(0,K.jsx)(GD,{document:e})]}),(0,K.jsx)(`span`,{id:s,hidden:!0,children:qD(e,n)}),(0,K.jsx)(P,{variant:`ghost`,size:`icon-xs`,className:`opacity-0 row-open:opacity-100`,"aria-label":`Remove ${e.title} from the list`,title:`Remove from the list (the file is not deleted)`,onClick:o,children:(0,K.jsx)(at,{"aria-hidden":`true`})})]})})}var tO=`sticky flex h-7 items-center gap-2 bg-chrome px-2 text-xs`;function nO({nodes:e,depth:t,labels:n,props:r}){let i=e=>({paddingLeft:`${String(.5+e*.75)}rem`});return(0,K.jsx)(`ul`,{className:`flex flex-col gap-0.5`,role:t===0?`tree`:`group`,children:e.map(e=>{switch(e.kind){case`document`:return(0,K.jsx)(eO,{document:e.document,name:e.name,labels:n,active:e.document.documentId===r.activeId,depth:t,onSelect:()=>r.onSelect(e.document.documentId),onClose:()=>r.onClose(e.document.documentId)},e.key);case`repository`:{let a=e.merged===null?e.name:`${e.name}, worktree ${e.merged}`,o=e.reason===null?null:D[e.reason];return(0,K.jsxs)(`li`,{role:`treeitem`,"aria-expanded":`true`,"aria-label":M(a),"data-node":`repository`,children:[(0,K.jsxs)(`div`,{className:p(tO,`top-0 z-20 font-medium`),style:i(t),title:[e.location,o].filter(Boolean).join(`
|
|
123
|
+
`),children:[e.reason===null?(0,K.jsx)(Id,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}):(0,K.jsx)(jt,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,K.jsx)(`bdi`,{className:`max-w-[60%] shrink-0 truncate`,children:M(e.name)}),e.merged!==null&&(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 font-normal text-muted-foreground`,children:[(0,K.jsx)(St,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`bdi`,{className:`truncate`,children:M(e.merged)})]}),o!==null&&(0,K.jsx)(`span`,{className:`sr-only`,children:o})]}),(0,K.jsx)(nO,{nodes:e.children,depth:t+1,labels:n,props:r})]},e.key)}case`worktree`:return(0,K.jsxs)(`li`,{role:`treeitem`,"aria-expanded":`true`,"aria-label":`Worktree ${M(e.name)}`,"data-node":`worktree`,children:[(0,K.jsxs)(`div`,{className:e.hidden?`sr-only`:p(tO,`top-7 z-10`),style:e.hidden?void 0:i(t),title:e.location,children:[(0,K.jsx)(St,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,K.jsx)(`bdi`,{className:`truncate`,children:M(e.name)})]}),(0,K.jsx)(nO,{nodes:e.children,depth:e.hidden?t:t+1,labels:n,props:r})]},e.key);case`group`:case`directory`:return(0,K.jsxs)(`li`,{role:`treeitem`,"aria-expanded":`true`,"aria-label":M(e.name),children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 text-xs text-muted-foreground`,style:i(t),children:[(0,K.jsx)(Rd,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`bdi`,{className:`truncate`,children:M(e.name)})]}),(0,K.jsx)(nO,{nodes:e.children,depth:t+1,labels:n,props:r})]},e.key);default:return null}})})}function rO(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return r.bottom>n.top&&r.top<n.bottom}function iO(e,t){return e.querySelector(`[data-document-id="${CSS.escape(t)}"]`)}function aO(e){let t=(0,I.useRef)(null);(0,I.useEffect)(()=>{let n=e.current;if(!n)return;let r=e=>{let r=e.target.closest(`li`)?.querySelector(`[data-document-id]`),i=r?.dataset.documentId;t.current=r&&i!==void 0?{documentId:i,visible:rO(n,r)}:null},i=e=>{let r=e.target;setTimeout(()=>{r.isConnected&&(n.contains(globalThis.document.activeElement)||(t.current=null))},0)},a=()=>{let e=t.current;if(!e)return;let r=iO(n,e.documentId);e.visible=r!==null&&rO(n,r)};return n.addEventListener(`focusin`,r),n.addEventListener(`focusout`,i),n.addEventListener(`scroll`,a,{passive:!0}),()=>{n.removeEventListener(`focusin`,r),n.removeEventListener(`focusout`,i),n.removeEventListener(`scroll`,a)}},[e]),(0,I.useLayoutEffect)(()=>{let n=e.current,r=t.current;if(!n||!r)return;let i=iO(n,r.documentId);if(!i){t.current=null;return}let a=globalThis.document.activeElement;(a===null||a===globalThis.document.body)&&i.focus({preventScroll:!0}),r.visible&&!rO(n,i)&&i.scrollIntoView({block:`nearest`}),r.visible=rO(n,i)})}function oO({documents:e,snapshot:t,onChanged:n,onFinished:r}){let i=FT(),{source:a}=dE();return(0,I.useEffect)(()=>{t&&(a?!i?.dragOperation.controller?.signal.aborted&&(t.length!==e.length||t.some((t,n)=>t.documentId!==e[n]?.documentId))&&(n(),i?.actions.stop({canceled:!0})):r())},[e,t,a,i,n,r]),null}function sO(e){let{documents:t,activeId:n,view:r,onViewChange:i,onSelect:a,onClose:o,onReorder:s,search:c,settings:l}=e,[u,d]=(0,I.useState)(null),[f,m]=(0,I.useState)(null),h=t.map(e=>e.documentId),g=e.labels,_=(0,I.useMemo)(()=>g??ne(t),[g,t]),v=(0,I.useRef)(null),y=(0,I.useMemo)(()=>Nt(t),[t]),b=(0,I.useMemo)(()=>r===`tree`?UD(t,_):[],[t,_,r]),x=(0,I.useRef)(null);return aO(x),(0,K.jsxs)(`nav`,{"aria-label":`Open documents`,className:`flex h-full min-h-0 flex-col`,onPointerDownCapture:e=>{v.current=e.target.closest(`button`)},children:[(0,K.jsxs)(`h2`,{className:`sr-only`,children:[`Open documents (`,t.length,`)`]}),(0,K.jsxs)(`div`,{className:`@container/top flex h-11 shrink-0 items-center gap-1 border-b px-2`,children:[c,f&&(0,K.jsx)(le,{title:`Order not changed`,trigger:(0,K.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":`Order not changed`,className:`text-destructive`,children:(0,K.jsx)(jt,{"aria-hidden":`true`})}),children:(0,K.jsx)(`p`,{children:f})}),(0,K.jsx)(`span`,{role:`status`,className:`sr-only`,children:f}),(0,K.jsxs)(jm,{value:[r],onValueChange:e=>{let t=e[0];(t===`flat`||t===`tree`)&&i(t)},size:`sm`,spacing:.5,className:Nm,"aria-label":`List layout`,children:[(0,K.jsx)(Mm,{value:`flat`,"aria-label":`Flat`,title:`Flat list`,className:p(Pm,`px-1`),children:(0,K.jsx)(Wd,{"aria-hidden":`true`})}),(0,K.jsx)(Mm,{value:`tree`,"aria-label":`Tree`,title:`Group by repository`,className:p(Pm,`px-1`),children:(0,K.jsx)(Hd,{"aria-hidden":`true`})})]}),l]}),(0,K.jsx)(`div`,{ref:x,className:p(`@container/list min-h-0 flex-1 overflow-y-auto p-1.5`,r===`tree`&&`scroll-pt-14`),children:t.length===0?(0,K.jsxs)(`p`,{className:`px-2 py-4 text-sm text-muted-foreground`,children:[`No documents are open. Run `,(0,K.jsx)(`code`,{children:`vo <file>`}),` to open one.`]}):r===`tree`?(0,K.jsx)(nO,{nodes:b,depth:0,labels:_,props:{activeId:n,onSelect:a,onClose:o}}):(0,K.jsxs)(NT,{onDragStart:()=>{d(t),m(null)},onDragEnd:e=>{if(e.canceled||!e.operation.target||!LE(e.operation.source))return;let n=e.operation.source;if(n.initialIndex===n.index)return;let r=(u??t).map(e=>e.documentId);if(r.length!==h.length||r.some((e,t)=>e!==h[t])){m(`The document list changed while dragging. Drag again to reorder the current list.`);return}s(KD(h,n.initialIndex,n.index))},children:[(0,K.jsx)(oO,{documents:t,snapshot:u,onChanged:()=>m(`The document list changed while dragging. Drag again to reorder the current list.`),onFinished:()=>d(null)}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(u??t).map((e,r)=>(0,K.jsx)($D,{document:e,index:r,count:(u??t).length,labels:_,short:y.get(e.documentId),active:e.documentId===n,pressedOn:v,onSelect:()=>a(e.documentId),onClose:()=>o(e.documentId),onMove:e=>s(KD(h,r,e))},e.documentId))}),(0,K.jsx)(LT,{dropAnimation:{duration:180,easing:`ease-out`},children:e=>{let n=(u??t).find(t=>t.documentId===e.id);return n?(0,K.jsxs)(`div`,{"aria-hidden":`true`,"data-testid":`drag-card`,className:`rounded-md border border-primary bg-background p-3 text-sm shadow-lg`,children:[(0,K.jsxs)(`p`,{className:`flex items-center gap-2 font-medium`,children:[(0,K.jsx)(Dt,{format:n.format}),n.title]}),(0,K.jsx)(`p`,{className:`mt-1 truncate text-xs text-muted-foreground`,children:M(C(n,_))})]}):null}})]})})]})}var cO=`document`,lO=`section`,uO=`heading`;function dO(){return new URLSearchParams(window.location.search).get(cO)}function fO(){let e=new URLSearchParams(window.location.search),t=e.get(lO),n=e.get(uO);return t===null||n===null?null:{sectionId:t,title:n}}function pO(e,t){let n=new URL(window.location.href);n.searchParams.get(cO)!==e&&(n.searchParams.delete(lO),n.searchParams.delete(uO)),e===null?n.searchParams.delete(cO):n.searchParams.set(cO,e),n.href!==window.location.href&&(t===`push`?window.history.pushState(null,``,n):window.history.replaceState(null,``,n))}function mO(e,t){let n=new URL(window.location.href);n.searchParams.get(cO)===e&&(t===null?(n.searchParams.delete(lO),n.searchParams.delete(uO)):(n.searchParams.set(lO,t.sectionId),n.searchParams.set(uO,t.title)),n.href!==window.location.href&&window.history.replaceState(null,``,n))}var hO=180,gO=480,_O=260;function vO(e,t){if(t===null)return e;let n=new Map(e.map(e=>[e.documentId,e])),r=t.flatMap(e=>n.get(e)??[]),i=new Set(t),a=e.filter(e=>!i.has(e.documentId));return[...r,...a]}var yO=e=>typeof e==`number`&&e>=hO&&e<=gO;function bO(){let[e,t]=Ye(`theme`,`system`,Oe),[n,r]=Ye(`color-palette`,`standard`,ft);return(0,I.useEffect)(()=>{let t=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>ye(e,n);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e,n]),{theme:e,setTheme:t,palette:n,setPalette:r}}function xO({api:e}){let[t,n]=(0,I.useState)({documents:[],version:0,daemonId:null}),[r,i]=(0,I.useState)({activeId:null,initialized:!1,history:`replace`,requestedAt:0,restore:null,restores:0}),[a,o]=(0,I.useState)(null),s=(0,I.useMemo)(()=>vO(t.documents,a),[t.documents,a]),{activeId:c}=r,l=(0,I.useCallback)((e,t=0)=>{i(n=>n.activeId===e?t>n.requestedAt?{...n,requestedAt:t}:n:{...n,activeId:e,history:`push`,requestedAt:t,restore:null})},[]),u=(0,I.useCallback)(e=>{c!==null&&mO(c,e)},[c]),d=(0,I.useRef)(s);(0,I.useEffect)(()=>{d.current=s},[s]);let f=(0,I.useRef)(!1);(0,I.useEffect)(()=>{r.initialized&&(pO(r.activeId,f.current?r.history:`replace`),f.current=!0)},[r]),(0,I.useEffect)(()=>{let e=()=>{let e=dO(),t=fO();i(n=>{if(!n.initialized)return n;if(!(e===n.activeId||d.current.some(t=>t.documentId===e))||e===null)return{...n,history:`replace`};let r=n.restores+1;return{...n,activeId:e,history:`replace`,requestedAt:e===n.activeId?n.requestedAt:0,restore:t===null?null:{...t,id:r},restores:r}})};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let[p,m]=(0,I.useState)(null),[h,g]=Ye(`sidebar-view`,`flat`,vt),[_,v]=Ye(`sidebar-width`,_O,yO),{theme:y,setTheme:b,palette:x,setPalette:S}=bO(),C=(0,I.useRef)(null),[w,T]=(0,I.useState)(0),[E,D]=(0,I.useState)(0),[O,ee]=(0,I.useState)(!1),[te,re]=(0,I.useState)(!1),[ie,ae]=(0,I.useState)(null);(0,I.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),ee(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let oe=e=>{l(e.documentId),i(e=>e.restore===null?e:{...e,restore:null}),ae(t=>({documentId:e.documentId,sectionId:e.sectionId,revision:e.revision,nonce:(t?.nonce??0)+1}))},se=(0,I.useCallback)(async()=>{let[t,r]=await Promise.all([e.documents(),e.status()]);n(e=>({documents:t.documents,version:t.catalogVersion,daemonId:e.daemonId??r.daemonId})),i(e=>{let n=e=>e!==null&&t.documents.some(t=>t.documentId===e),i=t.catalogVersion<e.requestedAt;if(n(e.activeId)||i&&e.activeId!==null)return e.initialized?e:{...e,initialized:!0,history:`replace`};let a=dO(),o=e.initialized?null:[a,r.activeDocumentId].find(n)??null,s=o!==null&&o===a?fO():null,c=e.restores+1,l=e.initialized&&e.activeId!==null&&(e.requestedAt===0||t.catalogVersion>e.requestedAt)?Ru(t.documents):t.documents[0];return{...e,activeId:o??l?.documentId??null,initialized:!0,history:`replace`,requestedAt:0,restore:s===null?null:{...s,id:c},restores:c}})},[e]),k=(0,I.useMemo)(()=>ht(se),[se]),ce=(0,I.useRef)({chain:Promise.resolve(),pending:0,drained:0}),A=(0,I.useCallback)(async()=>{let e=ce.current,t=e.pending===0,n=e.drained;await k()&&t&&e.pending===0&&e.drained===n&&o(null)},[k]);(0,I.useEffect)(()=>{let t=e.events({onEvent:e=>{let t=C.current;if(C.current={daemonId:e.daemonId,sequence:e.sequence},t?.daemonId!==e.daemonId&&n(t=>t.daemonId===e.daemonId?t:{...t,daemonId:e.daemonId}),e.type===`daemon-stopping`){m(`The daemon stopped. Run vo to start it again.`);return}e.type===`focus-requested`&&e.documentId&&l(e.documentId,e.catalogVersion);let r=t!==null&&(t.daemonId!==e.daemonId||e.sequence>t.sequence+1);(e.type===`feedback-changed`||e.type===`resync-required`||r)&&T(e=>e+1),e.type===`render-diagnostics`&&D(e=>e+1),(e.type!==`hello`||r)&&A()},onConnect:()=>{m(null),T(e=>e+1),A()}});return()=>t.close()},[e,A,l]);let j=(0,I.useMemo)(()=>s.find(e=>e.documentId===c)??null,[s,c]),M=j===null?`vo`:`vo - ${j.title}`;(0,I.useEffect)(()=>{document.title=M},[M]);let N=(0,I.useMemo)(()=>ne(s),[s]),ue=(0,I.useRef)(0);(0,I.useEffect)(()=>{ue.current=Math.max(ue.current,t.version)},[t.version]);let de=t=>{o(t);let n=ce.current;n.pending+=1,n.chain=n.chain.then(async()=>{try{let n=await e.reorder(t,ue.current);ue.current=Math.max(ue.current,n)}catch{}--n.pending,n.pending===0&&(n.drained+=1,A())})},fe=e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId)},pe=e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&v(Math.min(gO,Math.max(hO,e.clientX)))},me=()=>ee(!0),he=(0,K.jsxs)(le,{title:`Appearance`,className:`w-72`,trigger:(0,K.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":`Appearance`,title:`Appearance`,children:(0,K.jsx)(Qd,{"aria-hidden":`true`})}),children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:`Theme`}),(0,K.jsxs)(jm,{value:[y],onValueChange:e=>{let t=e[0];Oe(t)&&b(t)},size:`sm`,"aria-label":`Color scheme`,children:[(0,K.jsx)(Mm,{value:`light`,"aria-label":`Light`,title:`Light`,children:(0,K.jsx)(af,{"aria-hidden":`true`})}),(0,K.jsx)(Mm,{value:`dark`,"aria-label":`Dark`,title:`Dark`,children:(0,K.jsx)(Xd,{"aria-hidden":`true`})}),(0,K.jsx)(Mm,{value:`system`,"aria-label":`Match OS setting`,title:`Match OS setting`,children:(0,K.jsx)(Jd,{"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`label`,{htmlFor:`color-palette`,className:`font-medium`,children:`Palette`}),(0,K.jsx)(`select`,{id:`color-palette`,value:x,onChange:e=>{ft(e.target.value)&&S(e.target.value)},className:`h-8 min-w-0 flex-1 rounded-md border border-input bg-background px-2 text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:tt.map(e=>(0,K.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]});return(0,K.jsxs)(`div`,{className:`flex h-svh flex-col bg-background text-foreground`,children:[(0,K.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-1 border-b bg-chrome px-2 min-[900px]:hidden`,children:[(0,K.jsx)(lt,{open:te,controls:`document-list`,onToggle:()=>re(e=>!e),label:`Document list`}),(0,K.jsx)(P,{variant:`ghost`,size:`icon-sm`,className:`ml-auto`,"aria-label":`Search open documents`,title:`Search open documents (⌘K)`,"aria-keyshortcuts":`Meta+K Control+K`,onClick:me,children:(0,K.jsx)(ef,{"aria-hidden":`true`})})]}),p&&(0,K.jsx)(`p`,{role:`status`,className:`border-b bg-muted px-3 py-1.5 text-sm`,children:p}),(0,K.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,K.jsx)(Qe,{id:`document-list`,open:te,docked:!0,style:{width:te?void 0:_},children:(0,K.jsx)(sO,{documents:s,labels:N,activeId:c,view:h,onViewChange:g,onSelect:e=>{l(e),re(!1)},onClose:t=>void e.close(t).then(k,k),onReorder:de,search:(0,K.jsxs)(P,{variant:`outline`,size:`sm`,className:`min-w-0 flex-1 justify-start bg-background font-normal`,"aria-label":`Search open documents`,"aria-keyshortcuts":`Meta+K Control+K`,onClick:me,children:[(0,K.jsx)(ef,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,K.jsx)(`span`,{className:`hidden truncate text-muted-foreground @min-[13rem]/top:inline`,children:`Search`}),(0,K.jsx)(`kbd`,{className:`ml-auto hidden font-sans text-xs text-muted-foreground @min-[14rem]/top:inline`,children:`⌘K`})]}),settings:he})}),(0,K.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize document list`,className:`hidden w-1 shrink-0 cursor-col-resize hover:bg-ring/40 min-[900px]:block`,onPointerDown:fe,onPointerMove:pe}),j?(0,K.jsx)(He,{value:N,children:(0,K.jsx)(fh,{documents:s,api:e,document:j,daemonId:t.daemonId,feedbackSignal:w,renderSignal:E,sectionTarget:ie?.documentId===j.documentId?ie:null,restoreHeading:r.restore,onHeadingShown:u})}):(0,K.jsx)(`main`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-muted-foreground`,children:`Choose a document from the list to show it here`})]}),(0,K.jsx)(Ah,{api:e,open:O,onOpenChange:ee,onSelect:oe})]})}function SO(){let[e]=(0,I.useState)(We);return(0,K.jsx)(xO,{api:e})}ye(it(`theme`,`system`,Oe),it(`color-palette`,`standard`,ft));var CO=document.getElementById(`root`);if(!CO)throw Error(`#root not found`);(0,Ft.createRoot)(CO).render((0,K.jsx)(I.StrictMode,{children:(0,K.jsx)(SO,{})}));
|