PageSourceSearch

https://trystan.net/assets/useAppFrom-BYhw6TDB.js

js trystan.net collected 2026-09-26 06:20:28 UTC 141,854 bytes, 8 lines download raw bytes

1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`3fb85819`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`3e41d04e-08fe-4ab0-8880-0106f9a93a4a`,e._sentryDebugIdIdentifier=`sentry-dbid-3e41d04e-08fe-4ab0-8880-0106f9a93a4a`)}catch{}})();import{s as e,t}from"./react-BxJ5vIog.js";import{C as n,_ as r,b as i,m as a,v as o}from"./src-jTF5SSYo.js";import{A as s,C as c,D as l,Jt as u,St as d,T as f,b as p,ft as m,ht as h,it as g,j as _,m as v,mt as y,ot as b,p as x,pt as S,q as C,rt as w,st as T,u as E,w as D,y as O,z as k}from"./persist-state-keys-DIv83xll.js";import{t as A}from"./jsx-runtime-_Lj106d5.js";import{t as j}from"./useSelector-fdPvvsOP.js";import{t as M}from"./compiler-runtime-BQBjb8-F.js";import{t as N}from"./bundle-mjs-fSrAgIZu.js";import{m as P}from"./Menu-yUMWz21M.js";import{A as F,D as I,E as L,I as R,L as ee,M as te,N as ne,O as re,P as ie,_ as z,i as ae,j as oe,k as se,l as ce,n as le,r as ue,v as de}from"./DatePicker-g-kEfdpb.js";import{E as fe,i as pe,r as me,t as he}from"./Tooltip-Diwjx-rU.js";import{c as ge,l as _e,n as ve,r as ye,s as be,t as xe}from"./use-field-context-B3PGkq1o.js";import{n as Se,r as Ce,t as we}from"./Checkbox-BYQ15R2g.js";import{c as Te,i as Ee,l as De,n as Oe,o as ke,t as Ae,u as je}from"./runtime-CTPATlqO.js";import{v as Me,y as Ne}from"./string-DBNuY2qi.js";import{t as Pe}from"./PrimaryButton-DvGW5Paf.js";import{t as Fe}from"./format-BpbNVxsX.js";import{t as Ie}from"./parseISO-iBrzuYfm.js";import{a as Le,i as Re,n as ze,r as Be,t as Ve}from"./Input-DK1QPhd0.js";import{t as He}from"./Calendar-FTLMCHtt.js";function Ue({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function We(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Ge=[],Ke=0,{link:qe,unlink:Je,propagate:Ye,checkDirty:Xe,shallowPropagate:Ze}=Ue({update(e){return e._update()},notify(e){Ge[$e++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,tt(e))}}),Qe=0,$e=0,B,et=0;function V(e){try{++et,e()}finally{--et||nt()}}function tt(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Je(n,e)}function nt(){if(!(et>0)){for(;Qe<$e;){let e=Ge[Qe];Ge[Qe++]=void 0,e.notify()}Qe=0,$e=0}}function rt(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return B!==void 0&&qe(i,B,Ke),i._snapshot},subscribe(e){let t=We(e),n={current:!1},r=it(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=B,o=t?.compare??Object.is;if(n)B=i,++Ke,i.depsTail=void 0;else if(e===void 0)return!1;
1n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{B=a,n&&(i.flags&=-5),tt(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Xe(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Ze(e)}}else e&32&&(i.flags=e&-33);return B!==void 0&&qe(i,B,Ke),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Ye(e),Ze(e),nt())}},i}function it(e){let t=()=>{let t=B;B=n,++Ke,n.depsTail=void 0,n.flags=6;try{return e()}finally{B=t,n.flags&=-5,tt(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Xe(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,tt(this)}};return t(),n}var at=class{constructor(e,t){this.atom=rt(e),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),t&&(this.actions=t(this))}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(We(e))}},ot=class{constructor(e){this.atom=rt(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(We(e))}};function st(e,t){return typeof e==`function`?new ot(e):t?new at(e,t):new at(e)}function ct(e,t){let n=e.body,r=`pointerLockElement`in e||`mozPointerLockElement`in e,i=()=>!!e.pointerLockElement;function a(){t?.(i())}function o(n){i()&&t?.(!1),console.error(`PointerLock error occurred:`,n),e.exitPointerLock()}if(!r)return;try{n.requestPointerLock()}catch{}let s=[p(e,`pointerlockchange`,a,!1),p(e,`pointerlockerror`,o,!1)];return()=>{s.forEach(e=>e()),e.exitPointerLock()}}function lt(e){let t=new WeakMap,n,r=new WeakMap,i=e=>n||(n=new e.ResizeObserver(e=>{for(let n of e){r.set(n.target,n);let e=t.get(n.target);if(e)for(let t of e)t(n)}}),n);return{observe:(n,r)=>{let a=t.get(n)||new Set;a.add(r),t.set(n,a);let o=C(n);return i(o).observe(n,e),()=>{let e=t.get(n);e&&(e.delete(r),e.size===0&&(t.delete(n),i(o).unobserve(n)))}},unobserve:e=>{t.delete(e),n?.unobserve(e)}}}var ut=lt({box:`border-box`}),dt=class{constructor(e,t){this.fn=e,this.options=t,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...e)=>{let t=Date.now()-this.lastExecutionTime;if(this.options.leading&&t>=this.options.wait)this.execute(...e);else if(this.lastArgs=e,!this.timeoutId&&this.options.trailing){let e=this.options.wait-t;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},e)}},this.execute=(...e)=>{this.fn(...e),this.options.onExecute?.(e,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&=(clearTimeout(this.timeoutId),void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function ft(e,t){return new dt(e,t).maybeExecute}var pt=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}
1getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i
1),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},H=new class extends pt{constructor(){super({pluginId:`form-devtools`,reconnectEveryMs:1e3})}};function mt(e,t){return typeof e==`function`?e(t):e}function ht(e,t){return Ct(t).reduce((e,t)=>{if(e===null)return null;if(e!==void 0)return e[t]},e)}function gt(e,t,n){let r=Ct(t);function i(e){if(!r.length)return mt(n,e);let t=r.shift();if(typeof t==`string`||typeof t==`number`&&!Array.isArray(e))return typeof e==`object`?(e===null&&(e={}),{...e,[t]:i(e[t])}):{[t]:i()};if(Array.isArray(e)&&typeof t==`number`){let n=e.slice(0,t);return[...n.length?n:Array(t),i(e[t]),...e.slice(t+1)]}return[...Array(t),i()]}return i(e)}function _t(e,t){let n=Ct(t);function r(e){if(!e)return;if(n.length===1){let t=n[0];if(Array.isArray(e)&&typeof t==`number`)return e.filter((e,n)=>n!==t);let{[t]:r,...i}=e;return i}let t=n.shift();if((typeof t==`string`||typeof t==`number`&&!Array.isArray(e))&&typeof e==`object`)return{...e,[t]:r(e[t])};if(typeof t==`number`&&Array.isArray(e)){if(t>=e.length)return e;let n=e.slice(0,t);return[...n.length?n:Array(t),r(e[t]),...e.slice(t+1)]}throw Error(`It seems we have created an infinite loop in deleteBy. `)}return r(e)}var vt=46,yt=91,bt=93,xt=48,St=57;function Ct(e){if(Array.isArray(e))return[...e];if(typeof e!=`string`)throw Error(`Path must be a string.`);let t=e.length,n=[],r=+(t>0&&e.charCodeAt(0)===yt),i=!0,a=-1;for(let o=r;o<=t;o++){let s=o<t?e.charCodeAt(o):-1;if(o===t||s===vt||s===yt||s===bt){let t=o-r;if(t>0){let a=i&&(t===1||e.charCodeAt(r)!==xt),s=e.slice(r,o);if(a){let e=parseInt(s,10);t<=15||String(e)===s?n.push(e):n.push(s)}else n.push(s)}else a!==bt&&(a!==-1||s!==bt)&&(a!==s||s!==vt&&s!==yt)&&n.push(``);r=o+1,i=!0}else(s<xt||s>St)&&(i=!1);a=s}return n.length||n.push(``),n}function wt(e,t){return e.length===0?t:t.length===0?e:t.startsWith(`[`)||t.startsWith(`.`)?e+t:`${e}.${t}`}function Tt(e){return!(Array.isArray(e)&&e.length===0)}function Et(e,t){return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!1},runValidation:e=>e.validators.filter(Boolean).map(e=>({cause:e.cause,validate:e.fn}))})}function Dt(e,t){let{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:i,onDynamicAsyncDebounceMs:a}=t.validators||{},o=n??0;return t.validationLogic({form:t.form,group:t.group,validators:t.validators,event:{type:e,fieldName:t.fieldName,async:!0},runValidation:t=>t.validators.filter(Boolean).map(t=>{let n=t?.cause||e,s=o;switch(n){case`change`:s=i??o;break;case`blur`:s=r??o;break;case`dynamic`:s=a??o;break;case`submit`:s=0}return e===`submit`&&(s=0),{cause:n,validate:t.fn,debounceMs:s}})})}var Ot=e=>!!e&&typeof e==`object`&&`fields`in e;function U(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}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}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||n.length===0&&!Array.isArray(e)&&!Array.isArray(t)&&(Object.getPrototypeOf(e)!==Object.prototype||Object.getPrototypeOf(t)!==Object.prototype))return!1;for(let i of n)if(!r.includes(i)||!U(e[i],t[i]))return!1;return!0}var kt=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:`form`}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:`field`}:{newErrorValue:void 0,newSource:void 0},At=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:`field`}:e?{newErrorValue:e,newSource:`form`}:{newErrorValue:void 0,newSource:void 0};function W(e,t){return e==null?t:{...e,...t}}for(var jt=256,Mt=[],Nt;jt--;)Mt[jt]=(jt+256).toString(16).substring(1);function Pt(){let e=0,t,n=``;if(!Nt||jt+16>256){for(Nt=Array(256),e=256;e--;)Nt[e]=256*Math.random()|0;e=0,jt=0}for(;e<16;
1e++)t=Nt[jt+e],n+=e===6?Mt[t&15|64]:e===8?Mt[t&63|128]:Mt[t],e&1&&e>1&&e<11&&(n+=`-`);return jt++,n}var Ft=ft(e=>H.emit(`form-state`,{id:e.formId,state:e.store.state}),{wait:300});function It(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++)t[n]=It(e[n]);return t}if(e instanceof Map){let t=new Map;return e.forEach((e,n)=>{t.set(n,It(e))}),t}if(e instanceof Set){let t=new Set;return e.forEach(e=>{t.add(It(e))}),t}let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=It(e[n]));return t}function Lt(e,t){return t===e||t.startsWith(`${e}.`)||t.startsWith(`${e}[`)}var Rt=({mode:e=`submit`,modeAfterSubmission:t=`change`}={})=>n=>{if(Object.keys(n.validators??{}).length===0)return n.runValidation({validators:[],form:n.form});let r={fn:n.event.async?n.validators.onDynamicAsync:n.validators.onDynamic,cause:`dynamic`},i=[];[(n.group?n.group.state.meta.submissionAttempts:n.form.state.submissionAttempts)===0?e:t,`submit`].includes(n.event.type)&&i.push(r);let a=[];return G({...n,runValidation:e=>{a=e.validators}}),i.length===0?n.runValidation({validators:a,form:n.form}):n.runValidation({validators:[...a,...i],form:n.form})},G=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});let t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:`mount`},r={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:`change`},i={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:`blur`},a={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:`submit`},o=t?void 0:{fn:()=>void 0,cause:`server`};switch(e.event.type){case`mount`:return e.runValidation({validators:[n],form:e.form});case`submit`:return e.runValidation({validators:[r,i,a,o],form:e.form});case`server`:return e.runValidation({validators:[],form:e.form});case`blur`:return e.runValidation({validators:[i,o],form:e.form});case`change`:return e.runValidation({validators:[r,o],form:e.form});default:throw Error(`Unknown validation event type: ${e.event.type}`)}};function zt(e,t){let n=new Map;for(let r of e){let e=r.path??[],i=t,a=``;for(let t=0;t<e.length;t++){let n=e[t];if(n===void 0)continue;let r=typeof n==`object`?n.key:n,o=Number(r);a+=Array.isArray(i)&&!Number.isNaN(o)?`[${o}]`:(t>0?`.`:``)+String(r),i=typeof i==`object`&&i?i[r]:void 0}n.set(a,(n.get(a)??[]).concat(r))}return Object.fromEntries(n)}var Bt=(e,t)=>{let n=zt(e,t);return{form:n,fields:n}},Vt={validate({value:e,validationSource:t},n){let r=n[`~standard`].validate(e);if(r instanceof Promise)throw Error(`async function passed to sync validator`);if(r.issues)return t===`field`?r.issues:Bt(r.issues,e)},async validateAsync({value:e,validationSource:t},n){let r=await n[`~standard`].validate(e);if(r.issues)return t===`field`?r.issues:Bt(r.issues,e)}},Ht=e=>!!e&&`~standard`in e,K={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0,_pendingValidationsCount:0};function q(e){function t(t){let n=e.getFieldMeta(t)??K;e.setFieldMeta(t,{...n,_arrayVersion:(n._arrayVersion||0)+1})}function n(n,r,i){t(n);let a=s(n,r,`move`,i),c=Math.min(r,i),u=Math.max(r,i);for(let e=c;e<=u;e++)a.push(o(n,e));let d=Object.keys(e.fieldInfo).reduce((t,i)=>(i.startsWith(o(n,r))&&t.set(i,e.getFieldMeta(i)),t),new Map);l(a,r<i?`up`:`down`),Object.keys(e.fieldInfo).filter(e=>e.startsWith(o(n,i))).forEach(t=>{let a=t.replace(o(n,i),o(n,r)),s=d.get(a);s&&e.setFieldMeta(t,s)})}function r(e,n){t(e),l(s(e,n,`remove`),`up`)}function i(n,r,i){t(n),s(n,r,`swap`,i).forEach(t=>{if(!t.toString().startsWith(o(n,r)))return;let a=t.toString().replace(o(n,r),o(n,i)),[s,c]=[e.getFieldMeta(t),e.getFieldMeta(a)];s&&e.setFieldMeta(a,s),c&&e.setFieldMeta(t,c)})}function a(n,r){t(n);let i=s(n,r,`insert`);l(i,`down`),i.forEach(t=>{t.toString().startsWith(o(n,r))&&e.setFieldMeta(t,u())})}function o(e,t){return`${e}[${t}]`}function s(t,n,r,i){let a=[o(t,n)];switch(r){case`swap`:a.push(o(t,i));break;case`move`:{let[e,r]=[Math.min(n,i),Math.max(n,i)];for(let n=e;n<=r;n++)a.push(o(t,n));break}default:{let r=e.getFieldValue(t),i=Array.isArray(r)?r.length:0;for(let e=n+1;e<i;e++)a.push(o(t,e));break}}return Object.keys(e.fieldInfo).filter(e=>a.some(t=>e.startsWith(t)))}function c(e,t){return e.replace(/\[(\d+)\]/,(e,n)=>{let r=parseInt(n,10);return`[${t===`up`?r+1:Math.max(0,r-1)}]`})}
1function l(t,n){(n===`up`?t:[...t].reverse()).forEach(t=>{let r=c(t.toString(),n),i=e.getFieldMeta(r);i?e.setFieldMeta(t,i):e.setFieldMeta(t,u())})}let u=()=>K;return{bumpArrayVersion:t,handleArrayMove:n,handleArrayRemove:r,handleArraySwap:i,handleArrayInsert:a}}function Ut(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},formGroupStateBase:e.formGroupStateBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var Wt=class{constructor(e){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{let e=this.store.subscribe(()=>{Ft(this)}),t=H.on(`request-form-state`,e=>{e.payload.id===this._formId&&H.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}),n=H.on(`request-form-reset`,e=>{e.payload.id===this._formId&&this.reset()}),r=H.on(`request-form-force-submit`,e=>{e.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),i=()=>{r(),n(),t(),e.unsubscribe(),H.emit(`form-unmounted`,{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});let{onMount:a}=this.options.validators||{};return H.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options}),a&&this.validateSync(`mount`),i},this.update=e=>{if(!e)return;let t=this.options;this.options=e;let n=e.defaultValues&&!U(e.defaultValues,t.defaultValues)&&!this.state.isTouched,r=!U(e.defaultState,t.defaultState)&&!this.state.isTouched;if(n||r){if(V(()=>{this.baseStore.setState(()=>Ut(Object.assign({},this.state,r?e.defaultState:{},n?{values:e.defaultValues}:{})))}),n){let e=q(this);for(let t of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(t))&&e.bumpArrayVersion(t)}H.emit(`form-api`,{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(e,t)=>{let{fieldMeta:n}=this.state,r=this.resetFieldMeta(n);e&&!t?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>{let t=e??this.options.defaultValues??this.options.defaultState?.values;return e||Object.values(this.fieldInfo).forEach(e=>{e.instance&&e.instance.options.defaultValue!==void 0&&(t=gt(t,e.instance.name,e.instance.options.defaultValue))}),Ut({...this.options.defaultState,values:t,fieldMetaBase:r})})},this.validateAllFields=async e=>{let t=[];return V(()=>{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;let r=n.instance;t.push(Promise.resolve().then(()=>r.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.instance.store.state.meta.isTouched||n.instance.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null,a=[`${e}[${t}]`];for(let n=t+1;n<=(i??0);n++)a.push(`${e}[${n}]`);let o=Object.keys(this.fieldInfo).filter(e=>a.some(t=>e.startsWith(t))),s=[];return V(()=>{o.forEach(e=>{s.push(Promise.resolve().then(()=>this.validateField(e,n)))})}),(await Promise.all(s)).flat()},this.validateField=(e,t)=>{let n=this.fieldInfo[e]?.instance;if(!n){let{hasErrored:n}=this.validateSync(t);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(t).then(()=>this.getFieldMeta(e)?.errors??[])}return n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0})),n.validate(t)},this.validateSync=(e,t)=>{let n=Et(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||G}),r=!1,i={};return V(()=>{for(let e of n){if(!e.validate)continue;let{formError:n,fieldErrors:a}=Gt(this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`},type:`validate`})),o=Kt(e.cause),s=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(a||{})]);t?.filterFieldNames&&(s=new Set([...s].filter(t.filterFieldNames)));for(let e of s){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!a?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??K,r=a?.[e],{newErrorValue:s,newSource:c}=kt({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[o]===`form`,previousErrorValue:t?.[o]});c===`form`&&(i[e]={...i[e],[o]:r}),t?.[o]!==s&&this.setFieldMeta(e,(e=K)=>({...e,errorMap:{...e.errorMap,[o]:s}
1,errorSourceMap:{...e.errorSourceMap,[o]:c}}))}t?.dontUpdateFormErrorMap||this.state.errorMap?.[o]!==n&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:n}})),(n||a)&&(r=!0)}if(t?.dontUpdateFormErrorMap)return;let a=Kt(`submit`);this.state.errorMap?.[a]&&e!==`submit`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[a]:void 0}}));let o=Kt(`server`);this.state.errorMap?.[o]&&e!==`server`&&!r&&this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[o]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async(e,t)=>{let n=Dt(e,{...this.options,form:this,group:t?.group,validationLogic:this.options.validationLogic||G});this.state.isFormValidating||this.baseStore.setState(e=>({...e,isFormValidating:!0}));let r=[],i;for(let e of n){if(!e.validate)continue;let n=Kt(e.cause);this.state.validationMetaMap[n]?.lastAbortController.abort();let a=new AbortController;this.state.validationMetaMap[n]={lastAbortController:a},r.push(new Promise(async n=>{let r;try{r=await new Promise((t,n)=>{setTimeout(async()=>{if(a.signal.aborted)return t(void 0);try{t(await this.runValidator({validate:e.validate,value:{value:this.state.values,formApi:this,validationSource:`form`,signal:a.signal},type:`validateAsync`}))}catch(e){n(e)}},e.debounceMs)})}catch(e){r=e}let{formError:o,fieldErrors:s}=Gt(r);s&&(i=i?{...i,...s}:s);let c=Kt(e.cause),l=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(i||{})]),u=Array.from(l);t?.filterFieldNames&&(u=u.filter(t.filterFieldNames));for(let e of u){if(this.baseStore.state.fieldMetaBase[e]===void 0&&!i?.[e])continue;let{errorMap:t,errorSourceMap:n}=this.getFieldMeta(e)??K,r=i?.[e],{newErrorValue:a,newSource:o}=kt({newFormValidatorError:r,isPreviousErrorFromFormValidator:n?.[c]===`form`,previousErrorValue:t?.[c]});t?.[c]!==a&&this.setFieldMeta(e,(e=K)=>({...e,errorMap:{...e.errorMap,[c]:a},errorSourceMap:{...e.errorSourceMap,[c]:o}}))}t?.dontUpdateFormErrorMap||this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[c]:o}})),n(i?{fieldErrors:i,errorMapKey:c}:void 0)}))}let a=[],o={};if(r.length){a=await Promise.all(r);for(let e of a)if(e?.fieldErrors){let{errorMapKey:t}=e;for(let[n,r]of Object.entries(e.fieldErrors))o[n]={...o[n]||{},[t]:r}}}return this.baseStore.setState(e=>({...e,isFormValidating:!1})),o},this.validate=(e,t)=>{let{hasErrored:n,fieldsErrorMap:r}=this.validateSync(e,t);return n&&!this.options.asyncAlways?r:this.validateAsync(e,t)},this._handleSubmit=async e=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),V(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.store.state.meta.isTouched||e.instance.setMeta(e=>({...e,isTouched:!0})))})});let t=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride&&this.baseStore.state.submissionAttempts<=1){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));let n=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.state.isFieldsValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),H.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validateAllFields`,errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate(`submit`),!this.state.isValid){n(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t}),H.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`validate`,errors:this.state.errors});return}V(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),V(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),H.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),n()})}catch(e){throw this.baseStore.setState(e=>({...e,isSubmitSuccessful:!1}
1)),H.emit(`form-submission`,{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:`inflight`,onError:e}),n(),e}},this.getFieldValue=e=>ht(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[e],this.getFormGroupMeta=e=>this.formGroupMetaDerived.state[e],this.getFieldInfo=e=>this.fieldInfo[e]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(e,t)=>{this.baseStore.setState(n=>({...n,fieldMetaBase:{...n.fieldMetaBase,[e]:mt(t,n.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((e,t)=>{let n=t;return e[n]=K,e},{}),this.setFieldValue=(e,t,n)=>{let r=n?.dontUpdateMeta??!1,i=n?.dontRunListeners??!1,a=n?.dontValidate??!1;V(()=>{r||this.setFieldMeta(e,e=>({...e,isTouched:!0,isDirty:!0,errorMap:{...e?.errorMap,onMount:void 0}})),this.baseStore.setState(n=>({...n,values:gt(n.values,e,t)}))}),i||this.getFieldInfo(e).instance?.triggerOnChangeListener(),a||this.validateField(e,`change`)},this.deleteField=e=>{let t=[...Object.keys(this.fieldInfo).filter(t=>{let n=e.toString();return t.startsWith(`${n}.`)||t.startsWith(`${n}[`)}),e];this.baseStore.setState(e=>{let n={...e};return t.forEach(e=>{n.values=_t(n.values,e),delete this.fieldInfo[e],delete n.fieldMetaBase[e]}),n})},this.pushFieldValue=(e,t,n)=>{this.setFieldValue(e,e=>[...Array.isArray(e)?e:[],t],n),q(this).bumpArrayVersion(e)},this.insertFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>[...e.slice(0,t),n,...e.slice(t)],W(r,{dontValidate:!0}));let i=r?.dontValidate??!1;i||await this.validateField(e,`change`),q(this).handleArrayInsert(e,t),i||await this.validateArrayFieldsStartingFrom(e,t,`change`)},this.replaceFieldValue=async(e,t,n,r)=>{this.setFieldValue(e,e=>e.map((e,r)=>r===t?n:e),W(r,{dontValidate:!0})),q(this).bumpArrayVersion(e),(r?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.removeFieldValue=async(e,t,n)=>{let r=this.getFieldValue(e),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(e,e=>e.filter((e,n)=>n!==t),W(n,{dontValidate:!0})),q(this).handleArrayRemove(e,t),i!==null){let t=`${e}[${i}]`;this.deleteField(t)}(n?.dontValidate??!1)||(await this.validateField(e,`change`),await this.validateArrayFieldsStartingFrom(e,t,`change`))},this.swapFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=e[t],i=e[n];return gt(gt(e,`${t}`,i),`${n}`,r)},W(r,{dontValidate:!0})),q(this).handleArraySwap(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.moveFieldValues=(e,t,n,r)=>{this.setFieldValue(e,e=>{let r=[...e];return r.splice(n,0,r.splice(t,1)[0]),r},W(r,{dontValidate:!0})),q(this).handleArrayMove(e,t,n),(r?.dontValidate??!1)||(this.validateField(e,`change`),this.validateField(`${e}[${t}]`,`change`),this.validateField(`${e}[${n}]`,`change`))},this.clearFieldValues=(e,t)=>{let n=this.getFieldValue(e),r=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,[],W(t,{dontValidate:!0})),q(this).bumpArrayVersion(e),r!==null)for(let t=0;t<=r;t++){let n=`${e}[${t}]`;this.deleteField(n)}(t?.dontValidate??!1)||this.validateField(e,`change`)},this.resetField=e=>{this.baseStore.setState(t=>{let n=this.getFieldInfo(e).instance?.options.defaultValue,r=ht(this.options.defaultValues,e),i=n??r;return{...t,fieldMetaBase:{...t.fieldMetaBase,[e]:K},values:i===void 0?t.values:gt(t.values,e,i)}})},this.setErrorMap=e=>{V(()=>{Object.entries(e).forEach(([e,t])=>{let n=e;if(Ot(t)){let{formError:e,fieldErrors:r}=Gt(t);for(let e of Object.keys(this.fieldInfo))this.getFieldMeta(e)&&this.setFieldMeta(e,t=>({...t,errorMap:{...t.errorMap,[n]:r?.[e]},errorSourceMap:{...t.errorSourceMap,[n]:`form`}}));this.baseStore.setState(t=>({...t,errorMap:{...t.errorMap,[n]:e}}))}else this.baseStore.setState(e=>({...e,errorMap:{...e.errorMap,[n]:t}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[t,n])=>(Object.keys(n).length&&n.errors.length&&(e[t]={errors:n.errors,errorMap:n.errorMap}),e),{})}),this.parseValuesWithSchema=e=>Vt.validate({value:this.state.values,validationSource:`form`},e),this.parseValuesWithSchemaAsync=e=>Vt.validateAsync({value:this.state.values,validationSource:`form`},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=e?.formId??Pt(),this._devtoolsSubmissionOverride=!1;let t=Ut({...e?.defaultState,values:e?.defaultValues??e?.defaultState?.values});if(e?.transform){t=e.transform({state:t}).state;for(let e of Object.keys(t.errorMap)){let n=t.errorMap[e];if(n!==void 0&&Ot(n))for(let r of Object.keys(n.fields)){let i=n.fields[r];if(i===void 0)continue;let a=t.fieldMetaBase[r];t.fieldMetaBase[r]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,_pendingValidationsCount:0,...a??{},errorSourceMap:{...a?.errorSourceMap??{},onChange:`form`},errorMap:{...a?.errorMap??{},[e]:i}}}}}this.baseStore=st(t);let n;this.fieldMetaDerived=st(e=>
1{let t=this.baseStore.get(),r=0,i={};for(let a of Object.keys(t.fieldMetaBase)){let o=t.fieldMetaBase[a],s=n?.fieldMetaBase[a],c=e?.[a],l=ht(t.values,a),u=c?.errors;if(!s||o.errorMap!==s.errorMap){u=Object.values(o.errorMap??{}).filter(e=>e!==void 0);let e=this.getFieldInfo(a)?.instance;(!e||!e.options.disableErrorFlat)&&(u=u.flat(1))}let d=!Tt(u),f=!o.isDirty,p=U(l,this.getFieldInfo(a)?.instance?.options.defaultValue??ht(this.options.defaultValues,a));if(c&&c.isPristine===f&&c.isValid===d&&c.isDefaultValue===p&&c.errors===u&&o===s){i[a]=c,r++;continue}i[a]={...o,errors:u??[],isPristine:f,isValid:d,isDefaultValue:p}}return Object.keys(t.fieldMetaBase).length?e&&r===Object.keys(t.fieldMetaBase).length?e:(n=this.baseStore.get(),i):i}),this.formGroupMetaDerived=st(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),r={};for(let i of this.formGroupApis){let a=i.name,o=t.formGroupStateBase[a]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},s=n[a],c=!1,l=!0,u=!1,d=!1,f=!0,p=!1;for(let e in n){if(e===a||!Lt(a,e))continue;let t=n[e];t&&(t.isValidating&&(c=!0),t.isValid||(l=!1),t.isTouched&&(u=!0),t.isBlurred&&(d=!0),t.isDefaultValue||(f=!1),t.isDirty&&(p=!0))}let m=!p,h=!!c||o.isValidating,g=s?.errorMap??{},_=s?.errorSourceMap??{},v=!!(g.onMount||Object.entries(n).some(([e,t])=>t&&e!==a&&Lt(a,e)&&t.errorMap.onMount)),y=e?.[a],b=y?.errors??[];(!y||y.__srcErrorMap!==g)&&(b=Object.values(g).reduce((e,t)=>{if(t===void 0)return e;if(t&&typeof t==`object`&&`fields`in t){let n=t.group;return n!==void 0&&e.push(n),e}return e.push(t),e},[]));let x=b.length===0,S=l&&x,C=i.options.canSubmitWhenInvalid??!1,w=o.submissionAttempts===0&&!u&&!v||!h&&!o.isSubmitting&&S||C;if(y&&y.errorMap===g&&y.errorSourceMap===_&&y.errors===b&&y.isFieldsValidating===c&&y.isFieldsValid===l&&y.isGroupValid===x&&y.isValid===S&&y.canSubmit===w&&y.isTouched===u&&y.isBlurred===d&&y.isPristine===m&&y.isDefaultValue===f&&y.isDirty===p&&y.isValidating===h&&y.isSubmitting===o.isSubmitting&&y.isSubmitted===o.isSubmitted&&y.submissionAttempts===o.submissionAttempts&&y.isSubmitSuccessful===o.isSubmitSuccessful){r[a]=y;continue}let T={...o,errorMap:g,errorSourceMap:_,_arrayVersion:s?._arrayVersion??0,isTouched:u,isBlurred:d,isDirty:p,isPristine:m,isDefaultValue:f,isValid:S,errors:b,isValidating:h,isFieldsValidating:c,isFieldsValid:l,isGroupValid:x,canSubmit:w};Object.defineProperty(T,"__srcErrorMap",{value:g,enumerable:!1,configurable:!0}),r[a]=T}return r});let r;this.store=st(e=>{let t=this.baseStore.get(),n=this.fieldMetaDerived.get(),i=Object.values(n).filter(Boolean),a=i.some(e=>e.isValidating),o=i.every(e=>e.isValid),s=i.some(e=>e.isTouched),c=i.some(e=>e.isBlurred),l=i.every(e=>e.isDefaultValue),u=s&&t.errorMap?.onMount,d=i.some(e=>e.isDirty),f=!d,p=!!(t.errorMap?.onMount||i.some(e=>e?.errorMap?.onMount)),m=!!a,h=e?.errors??[];(!r||t.errorMap!==r.errorMap)&&(h=Object.values(t.errorMap).reduce((e,t)=>t===void 0?e:t&&Ot(t)?(e.push(t.form),e):(e.push(t),e),[]));let g=h.length===0,_=o&&g,v=this.options.canSubmitWhenInvalid??!1,y=t.submissionAttempts===0&&!s&&!p||!m&&!t.isSubmitting&&_||v,b=t.errorMap;if(u&&(h=h.filter(e=>e!==t.errorMap.onMount),b=Object.assign(b,{onMount:void 0})),e&&r&&e.errorMap===b&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===h&&e.isFieldsValidating===a&&e.isFieldsValid===o&&e.isFormValid===g&&e.isValid===_&&e.canSubmit===y&&e.isTouched===s&&e.isBlurred===c&&e.isPristine===f&&e.isDefaultValue===l&&e.isDirty===d&&U(r,t))return e;let x={...t,errorMap:b,fieldMeta:this.fieldMetaDerived.state,errors:h,isFieldsValidating:a,isFieldsValid:o,isFormValid:g,isValid:_,canSubmit:y,isTouched:s,isBlurred:c,isPristine:f,isDefaultValue:l,isDirty:d};return r=this.baseStore.get(),x}),this.handleSubmit=this.handleSubmit.bind(this),this.update(e||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(e){return Ht(e.validate)?Vt[e.type](e.value,e.validate):e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function Gt(e){return e?Ot(e)?{formError:Gt(e.form).formError,fieldErrors:e.fields}:{formError:e}:{formError:void 0}}function Kt(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var qt=class e{constructor(t){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});let e=this.getInfo();e.instance=this,this.update(this.options);let{onMount:t}=this.options.validators||{};if(t){let e=this.runValidator({validate:t,value:{value:this.state.value,fieldApi:this,validationSource:`field`},type:`validate`});e&&this.setMeta(t=>({...t,errorMap:{...t?.errorMap,onMount:e},errorSourceMap:{...t?.errorSourceMap,onMount:`field`}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);let e=this.form.fieldInfo[this.name];if(e&&e.instance===this){for(let[t,n]of Object.entries(e.validationMetaMap))n?.lastAbortController.abort(),e.validationMetaMap[t]=void 0;this.form.baseStore.setState(e=>({...e,fieldMetaBase:{...e.fieldMetaBase,[this.name]:{...K,isTouched:e.fieldMetaBase[this.name]?.isTouched??K.isTouched,isBlurred:e.fieldMetaBase[this.name]?.isBlurred??K.isBlurred,isDirty:e.fieldMetaBase[this.name]?.isDirty??K.isDirty}}})),e.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(U(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>
1{this.form.setFieldValue(this.name,e,W(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,W(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,n)=>{this.form.insertFieldValue(this.name,e,t,W(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,n)=>{this.form.replaceFieldValue(this.name,e,t,W(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,W(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,n)=>{this.form.swapFieldValues(this.name,e,t,W(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,n)=>{this.form.moveFieldValues(this.name,e,t,W(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,W(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=t=>{let n=Object.values(this.form.fieldInfo),r=[];for(let i of n){if(!i.instance||!(i.instance instanceof e))continue;let{onChangeListenTo:n,onBlurListenTo:a}=i.instance.options.validators||{};t===`change`&&n?.includes(this.name)&&r.push(i.instance),t===`blur`&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(e,t)=>{let n=Et(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||G}),r=this.getLinkedFields(e).reduce((t,n)=>{let r=Et(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||G});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),i=!1;V(()=>{let e=(e,n)=>{let r=Yt(n.cause),a=n.validate?Jt(e.runValidator({validate:n.validate,value:{value:e.store.state.value,validationSource:`field`,fieldApi:e},type:`validate`})):void 0,o=t[r],{newErrorValue:s,newSource:c}=At({formLevelError:o,fieldLevelError:a});e.state.meta.errorMap?.[r]!==s&&e.setMeta(e=>({...e,errorMap:{...e.errorMap,[r]:s},errorSourceMap:{...e.errorSourceMap,[r]:c}})),s&&(i=!0)};for(let t of n)e(this,t);for(let t of r)t.validate&&e(t.field,t)});let a=Yt(`submit`);return this.state.meta.errorMap?.[a]&&e!==`submit`&&!i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[a]:void 0},errorSourceMap:{...e.errorSourceMap,[a]:void 0}})),{hasErrored:i}},this.validateAsync=async(e,t)=>{let n=Dt(e,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||G}),r=await t,i=this.getLinkedFields(e).reduce((t,n)=>{let r=Dt(e,{...n.options,form:n.form,fieldName:n.name,validationLogic:n.form.options.validationLogic||G});return r.forEach(e=>{e.field=n}),t.concat(r)},[]),a=[],o=[],s=n.some(e=>e.validate),c=Array.from(new Set(i.filter(e=>e.validate).map(e=>e.field)));V(()=>{s&&this.startValidation();for(let e of c)e.startValidation()});let l=(e,t,n)=>{let i=Yt(t.cause),a=e.getInfo();a.validationMetaMap[i]?.lastAbortController.abort();let o=new AbortController;a.validationMetaMap[i]={lastAbortController:o},n.push(new Promise(async n=>{let a;try{a=await new Promise((n,r)=>{e.timeoutIds.validations[t.cause]&&(clearTimeout(e.timeoutIds.validations[t.cause]),e.endValidation()),e.timeoutIds.validations[t.cause]=setTimeout(async()=>{if(o.signal.aborted)return n(void 0);try{n(await this.runValidator({validate:t.validate,value:{value:e.store.state.value,fieldApi:e,signal:o.signal,validationSource:`field`},type:`validateAsync`}))}catch(e){r(e)}},t.debounceMs)})}catch(e){a=e}if(o.signal.aborted)return n(void 0);let s=Jt(a),c=r[e.name]?.[i],{newErrorValue:l,newSource:u}=At({formLevelError:c,fieldLevelError:s});if(e.getInfo().instance!==e)return n(void 0);e.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:l},errorSourceMap:{...e.errorSourceMap,[i]:u}})),n(l)}))};for(let e of n)e.validate&&l(this,e,a);for(let e of i)e.validate&&l(e.field,e,o);let u=[];return(a.length||o.length)&&(u=await Promise.all(a),await Promise.all(o)),V(()=>{s&&this.endValidation();for(let e of c)e.endValidation()}),u.filter(Boolean)},this.validate=(e,t)=>
1{if(!this.state.meta.isTouched)return[];let n=t?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(e=>this.name.startsWith(e.name)),r=(t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e)).fieldsErrorMap[this.name]??{};if(!t?.skipFormValidation)for(let t of n){if(t.state.meta.submissionAttempts===0)continue;let{fieldsErrorMap:n}=this.form.validateSync(e,{group:t,dontUpdateFormErrorMap:!0,filterFieldNames:e=>Lt(t.name,e)});r={...r,...n[this.name]??{}}}let{hasErrored:i}=this.validateSync(e,r),a=new WeakMap;for(let t of n){let{hasErrored:n}=t.validateSync(e,{},{skipRelatedFieldValidation:!0});a.set(t,n)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[Yt(e)]?.lastAbortController.abort();let t=[];for(let r of n)r.getInfo().validationMetaMap[Yt(e)]?.lastAbortController.abort(),t.push(r.state.meta.errors);return[...this.state.meta.errors,...t.flat()]}let o=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e),s=this.validateAsync(e,o),c=[];for(let t of n)(!a.get(t)||t.options.asyncAlways)&&c.push(t.validateAsync(e,o,{skipRelatedFieldValidation:!0}));return c.length===0?s:Promise.all([s,...c]).then(e=>e.flat())},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(e=>({...e,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(e=>({...e,isBlurred:!0})),this.validate(`blur`),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>Vt.validate({value:this.state.value,validationSource:`field`},e),this.parseValueWithSchemaAsync=e=>Vt.validateAsync({value:this.state.value,validationSource:`field`},e),this.triggerOnBlurListener=()=>{let e=this.form.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(let e of this.form.formGroupApis)Lt(e.name,this.name)&&e.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=st(e=>{this.form.store.get();let n=this.form.getFieldMeta(this.name)??{...K,...t.defaultMeta},r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!U(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}})}get state(){return this.store.state}runValidator(e){return Ht(e.validate)?Vt[e.type](e.value,e.validate):e.validate(e.value)}startValidation(){this.setMeta(e=>{let t=e._pendingValidationsCount+1;return{...e,_pendingValidationsCount:t,isValidating:t>0&&!e.isValidating||e.isValidating}})}endValidation(){this.setMeta(e=>{let t=Math.max(0,e._pendingValidationsCount-1);return{...e,_pendingValidationsCount:t,isValidating:t===0&&e.isValidating?!1:e.isValidating}})}};function Jt(e){if(e)return e}function Yt(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}function Xt(e){return{isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1}}function Zt(e){return{...K,...e,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var Qt=class e{constructor(t){this.options={},this.setFormGroupState=e=>{this.form.baseStore.setState(t=>{let n=t.formGroupStateBase[this.name]??Xt({});return{...t,formGroupStateBase:{...t.formGroupStateBase,[this.name]:e(n)}}})},this._lastDistributedFieldNames={},this.update=e=>{this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0&&(U(this.form.getFieldValue(this.name),e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})),this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...K,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:e.formGroupStateBase[this.name]??Xt({...this.options.defaultState})}}));let{onMount:e}=this.options.validators||{};if(e){let t=this.runValidator({validate:e,value:{value:this.state.value,groupApi:this,validationSource:`form`},type:`validate`}),n=t,r;en(t)&&(n=t.group,r=t.fields);let i=$t(n);i&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,onMount:i},errorSourceMap:{...e.errorSourceMap,onMount:`field`}})),this.distributeFieldErrors(`onMount`,r)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(let[e,t]of Object.entries(this.timeoutIds.validations))t&&(clearTimeout(t),this.timeoutIds.validations[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.listeners))t&&(clearTimeout(t),this.timeoutIds.listeners[e]=null);for(let[e,t]of Object.entries(this.timeoutIds.formListeners))t&&(clearTimeout(t),this.timeoutIds.formListeners[e]=null);if(this.fieldInfo.instance===this){for(let[e,t]of Object.entries(this.fieldInfo.validationMetaMap))t?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[e]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(e=>({...e,formGroupStateBase:{...e.formGroupStateBase,[this.name]:Xt({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(e,t)=>
1{this.form.setFieldValue(this.name,e,W(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate(`change`)},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{let e=Object.values(this.form.fieldInfo),t=[];for(let n of e)n.instance&&n.instance instanceof qt&&n.instance.name.startsWith(this.name)&&t.push(n.instance);return t},this.getRelatedFieldMetasDerived=()=>{let e=Object.entries(this.form.fieldMetaDerived.state),t=[];for(let[n,r]of e)n!==this.name&&Lt(this.name,n)&&t.push({...r,name:n});return t},this.buildChildFieldName=e=>e===``?this.name:e.startsWith(`[`)?`${this.name}${e}`:`${this.name}.${e}`,this.distributeFieldErrors=(e,t)=>{let n=this._lastDistributedFieldNames[e]??new Set,r=new Set;if(t)for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.add(this.buildChildFieldName(e));let i=new Set([...n,...r]),a=!1;for(let n of i){let r=n.startsWith(this.name+`[`)?n.slice(this.name.length):n.slice(this.name.length+1),i=t?.[r],o=this.form.getFieldMeta(n);if(!o&&!i)continue;let s=o?.errorMap[e],{newErrorValue:c,newSource:l}=kt({newFormValidatorError:i,isPreviousErrorFromFormValidator:o?.errorSourceMap[e]===`form`,previousErrorValue:s});c&&(a=!0),(s!==c||o?.errorSourceMap[e]!==l)&&this.form.setFieldMeta(n,(t=K)=>({...t,errorMap:{...t.errorMap,[e]:c},errorSourceMap:{...t.errorSourceMap,[e]:l}}))}return this._lastDistributedFieldNames[e]=r,a},this.validateSync=(t,n,r={})=>{let i=Et(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||G}),a=(r.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((e,n)=>{let r=Et(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||G});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),o=!1;V(()=>{let t=(t,r)=>{let i=nn(r.cause),a=t===this,s;r.validate&&(s=t.runValidator({validate:r.validate,value:{value:t.store.state.value,validationSource:a?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validate`}));let c=s,l;a&&en(s)&&(c=s.group,l=s.fields);let u=$t(c),d=n[i],{newErrorValue:f,newSource:p}=At({formLevelError:d,fieldLevelError:u});t.state.meta.errorMap?.[i]!==f&&t.setMeta(e=>({...e,errorMap:{...e.errorMap,[i]:f},errorSourceMap:{...e.errorSourceMap,[i]:p}})),f&&(o=!0),a&&this.distributeFieldErrors(i,l)&&(o=!0)};for(let e of i)t(this,e);for(let e of a)e.validate&&t(e.field,e)});let s=nn(`submit`);return this.state.meta.errorMap?.[s]&&t!==`submit`&&!o&&this.setMeta(e=>({...e,errorMap:{...e.errorMap,[s]:void 0},errorSourceMap:{...e.errorSourceMap,[s]:void 0}})),{hasErrored:o}},this.validateAsync=async(t,n,r={})=>{let i=Dt(t,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||G}),a=await n,o=r.skipRelatedFieldValidation?[]:this.getRelatedFields(),s=o.reduce((e,n)=>{let r=Dt(t,{...n.options,form:n.form,validationLogic:n.form.options.validationLogic||G});return r.forEach(e=>{e.field=n}),e.concat(r)},[]),c=[],l=[],u=i.some(e=>e.validate)||s.some(e=>e.validate);if(u){this.state.meta.isValidating||this.setMeta(e=>({...e,isValidating:!0}));for(let e of o)e.setMeta(e=>({...e,isValidating:!0}))}let d=(t,n,r)=>{let i=nn(n.cause),o=t.getInfo();o.validationMetaMap[i]?.lastAbortController.abort();let s=new AbortController;o.validationMetaMap[i]={lastAbortController:s};let c=t===this;r.push(new Promise(async r=>{let o;try{o=await new Promise((r,i)=>{t.timeoutIds.validations[n.cause]&&clearTimeout(t.timeoutIds.validations[n.cause]),t.timeoutIds.validations[n.cause]=setTimeout(async()=>{if(s.signal.aborted)return r(void 0);try{r(await this.runValidator({validate:n.validate,value:{value:t.store.state.value,signal:s.signal,validationSource:c?`form`:`field`,...t instanceof e?{groupApi:t}:{fieldApi:t}},type:`validateAsync`}))}catch(e){i(e)}},n.debounceMs)})}catch(e){o=e}if(s.signal.aborted)return r(void 0);let l=o,u;c&&en(o)&&(l=o.group,u=o.fields);let d=$t(l),f=a[t.name]?.[i],{newErrorValue:p,newSource:m}=At({formLevelError:f,fieldLevelError:d});if(t.getInfo().instance!==t)return r(void 0);t.setMeta(e=>({...e,errorMap:{...e?.errorMap,[i]:p},errorSourceMap:{...e.errorSourceMap,[i]:m}})),c&&this.distributeFieldErrors(i,u),r(p)}))};for(let e of i)e.validate&&d(this,e,c);
1for(let e of s)e.validate&&d(e.field,e,l);let f=[];if((c.length||l.length)&&(f=await Promise.all(c),await Promise.all(l)),u){this.setMeta(e=>({...e,isValidating:!1}));for(let e of o)e.setMeta(e=>({...e,isValidating:!1}))}return f.filter(Boolean)},this.validateAllFields=async e=>{let t=[];return V(()=>{Object.values(this.getRelatedFields()).forEach(n=>{t.push(Promise.resolve().then(()=>n.validate(e,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(e=>({...e,isTouched:!0}))})}),(await Promise.all(t)).flat()},this.validateArrayFieldsStartingFrom=(e,t,n)=>this.form.validateArrayFieldsStartingFrom(e,t,n),this.validateField=(e,t)=>this.form.validateField(e,t),this.getFieldValue=e=>this.form.getFieldValue(e),this.getFieldMeta=e=>this.form.getFieldMeta(e),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(e,t),this.setFieldValue=(e,t)=>this.form.setFieldValue(e,t),this.deleteField=e=>this.form.deleteField(e),this.pushFieldValue=(e,t)=>this.form.pushFieldValue(e,t),this.insertFieldValue=(e,t,n)=>this.form.insertFieldValue(e,t,n),this.replaceFieldValue=(e,t,n)=>this.form.replaceFieldValue(e,t,n),this.swapFieldValues=(e,t,n)=>this.form.swapFieldValues(e,t,n),this.moveFieldValues=(e,t,n)=>this.form.moveFieldValues(e,t,n),this.clearFieldValues=e=>this.form.clearFieldValues(e),this.resetField=e=>this.form.resetField(e),this.removeFieldValue=(e,t)=>this.form.removeFieldValue(e,t),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(e=>e.state.meta.isValid),this.validate=(e,t)=>{let{fieldsErrorMap:n}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>Lt(this.name,e)}),{hasErrored:r}=this.validateSync(e,n[this.name]??{},{skipRelatedFieldValidation:t?.skipRelatedFieldValidation});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[nn(e)]?.lastAbortController.abort(),this.state.meta.errors;let i=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e,{dontUpdateFormErrorMap:!0,filterFieldNames:e=>Lt(this.name,e)});return this.validateAsync(e,i,{skipRelatedFieldValidation:t?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{let e=this.form.options.listeners?.onChangeGroupDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},e)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});let t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async e=>{this.setFormGroupState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),V(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.state.meta.isTouched||e.setMeta(e=>({...e,isTouched:!0}))})});let t=e??this.options.onSubmitMeta;this.setFormGroupState(e=>({...e,isSubmitting:!0}));let n=()=>{this.setFormGroupState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields(`submit`),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}if(await this.validate(`submit`,{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:t});return}V(()=>{Object.values(this.getRelatedFields()).forEach(e=>{e.options.listeners?.onGroupSubmit?.({value:e.state.value,fieldApi:e})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:t}),V(()=>{this.setFormGroupState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(e){throw this.setFormGroupState(e=>({...e,isSubmitSuccessful:!1})),n(),e}},this.form=t.form,this.name=t.name,this.options=t,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=st(e=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();let n=this.form.getFormGroupMeta(this.name)??Zt(t.defaultMeta),r=this.form.getFieldValue(this.name);return!n.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!U(r,this.options.defaultValue)&&(r=this.options.defaultValue),e&&e.value===r&&e.meta===n?e:{value:r,meta:n}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(Ht(e.validate)){let t=Vt[e.type](e.value,e.validate);return e.type===`validate`?tn(t):t.then(tn)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function $t(e){if(e)return e}function en(e){return!!e&&typeof e==`object`&&`fields`in e}function tn(e){if(!e||typeof e!=`object`||!(`form`in e)&&!(`fields`in e))return e;let{form:t,fields:n,...r}=e;return{...r,group:t,fields:n}}function nn(e){switch(e){case`submit`:return`onSubmit`;case`blur`:return`onBlur`;case`mount`:return`onMount`;case`server`:return`onServer`;case`dynamic`:return`onDynamic`;default:return`onChange`}}var rn=class e{constructor(t){if(this.getFormFieldName=e=>{if(typeof this.fieldsMap==`string`)return wt(this.fieldsMap,e);let t=Ct(e)[0];if(typeof t!=`string`)return``;let n=e.slice(t.length),r=this.fieldsMap[t];return wt(r,n)},this.getFormFieldOptions=e=>{let t={...e},n=t.validators;if(t.name=this.getFormFieldName(e.name),n&&(n.onChangeListenTo||n.onBlurListenTo)){let e={...n},r=e=>{if(e)return e.map(e=>this.getFormFieldName(e))};e.onChangeListenTo=r(n.onChangeListenTo),e.onBlurListenTo=r(n.onBlurListenTo),t.validators=e}return t},this.mount=()=>()=>{},this.validateArrayFieldsStartingFrom=async(e,t,n)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e),t,n),this.validateField=(e,t)=>this.form.validateField(this.getFormFieldName(e),t),this.getFieldValue=e=>this.form.getFieldValue(this.getFormFieldName(e)),this.getFieldMeta=e=>this.form.getFieldMeta(this.getFormFieldName(e)),this.setFieldMeta=(e,t)=>this.form.setFieldMeta(this.getFormFieldName(e),t),this.setFieldValue=(e,t,n
1)=>this.form.setFieldValue(this.getFormFieldName(e),t,n),this.deleteField=e=>this.form.deleteField(this.getFormFieldName(e)),this.pushFieldValue=(e,t,n)=>this.form.pushFieldValue(this.getFormFieldName(e),t,n),this.insertFieldValue=async(e,t,n,r)=>this.form.insertFieldValue(this.getFormFieldName(e),t,n,r),this.replaceFieldValue=async(e,t,n,r)=>this.form.replaceFieldValue(this.getFormFieldName(e),t,n,r),this.removeFieldValue=async(e,t,n)=>this.form.removeFieldValue(this.getFormFieldName(e),t,n),this.swapFieldValues=(e,t,n,r)=>this.form.swapFieldValues(this.getFormFieldName(e),t,n,r),this.moveFieldValues=(e,t,n,r)=>this.form.moveFieldValues(this.getFormFieldName(e),t,n,r),this.clearFieldValues=(e,t)=>this.form.clearFieldValues(this.getFormFieldName(e),t),this.resetField=e=>this.form.resetField(this.getFormFieldName(e)),this.validateAllFields=e=>this.form.validateAllFields(e),t.form instanceof e){let e=t.form;if(this.form=e.form,typeof t.fields==`string`)this.fieldsMap=e.getFormFieldName(t.fields);else{let n={...t.fields};for(let t in n)n[t]=e.getFormFieldName(n[t]);this.fieldsMap=n}}else this.form=t.form,this.fieldsMap=t.fields;this.store=st(()=>{let e=this.form.store.get(),t;if(typeof this.fieldsMap==`string`)t=ht(e.values,this.fieldsMap);else{t={};let n=this.fieldsMap;for(let r in n)t[r]=ht(e.values,n[r])}return{values:t}})}get state(){return this.store.state}async handleSubmit(e){return this.form.handleSubmit(e)}};function an(e,t){if(!t)return;let n=Object.assign({},e,{state:It(e.state)});t(n),n.fieldInfo!==e.fieldInfo&&(e.fieldInfo=n.fieldInfo),n.options!==e.options&&(e.options=n.options);let r=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((t,r)=>(e.state[r]!==n.state[r]&&(t[r]=n.state[r]),t),{});return V(()=>{Object.keys(r).length&&e.baseStore.setState(e=>({...e,...r})),n.state.errorMap!==e.state.errorMap&&e.setErrorMap(n.state.errorMap)}),n}var J=A(),Y=e(t(),1),X=typeof window<`u`?Y.useLayoutEffect:Y.useEffect;function on(e){let[t,n]=(0,Y.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,Y.useState)(()=>new qt({...e})),a=r;(t.form!==e.form||t.name!==e.name)&&(a=new qt({...e}),i(a),n({form:e.form,name:e.name}));let o=j(a.store,e.mode===`array`?e=>e.meta._arrayVersion||0:e=>e.value),s=j(a.store,e=>e.meta.isTouched),c=j(a.store,e=>e.meta.isBlurred),l=j(a.store,e=>e.meta.isDirty),u=j(a.store,e=>e.meta.errorMap),d=j(a.store,e=>e.meta.errorSourceMap),f=j(a.store,e=>e.meta.isValidating),p=(0,Y.useMemo)(()=>({...a,get state(){return{value:e.mode===`array`?a.state.value:o,get meta(){return{...a.state.meta,isTouched:s,isBlurred:c,isDirty:l,errorMap:u,errorSourceMap:d,isValidating:f}}}}}),[a,e.mode,o,s,c,l,u,d,f]);return X(a.mount,[a]),X(()=>{a.update(e)}),p}var sn=(({children:e,...t})=>{let n=on(t),r=(0,Y.useMemo)(()=>mt(e,n),[e,n]);return(0,J.jsx)(J.Fragment,{children:r})});function cn(){return(0,Y.useState)(()=>Pt())[0]}var ln=Y,un=`19.3.0`.split(`.`)[0]===`17`?cn:ln.useId;function dn(e){let[t,n]=(0,Y.useState)(()=>({form:e.form,name:e.name})),[r,i]=(0,Y.useState)(()=>new Qt({...e}));(t.form!==e.form||t.name!==e.name)&&(i(new Qt({...e})),n({form:e.form,name:e.name}));let a=j(r.store,e=>e.value),o=j(r.store,e=>e.meta.isTouched),s=j(r.store,e=>e.meta.isBlurred),c=j(r.store,e=>e.meta.isDirty),l=j(r.store,e=>e.meta.errorMap),u=j(r.store,e=>e.meta.errorSourceMap),d=j(r.store,e=>e.meta.isValidating),f=j(r.store,e=>e.meta.isSubmitting),p=j(r.store,e=>e.meta.isSubmitted),m=j(r.store,e=>e.meta.submissionAttempts),h=j(r.store,e=>e.meta.isSubmitSuccessful),g=j(r.store,e=>e.meta.canSubmit),_=j(r.store,e=>e.meta.isValid),v=j(r.store,e=>e.meta.isFieldsValid),y=j(r.store,e=>e.meta.isFieldsValidating),b=j(r.store,e=>e.meta.isGroupValid),x=(0,Y.useMemo)(()=>({...r,handleSubmit:((...e)=>r._handleSubmit(...e)),get state(){return{...r.state,value:a,get meta(){return{...r.state.meta,isTouched:o,isBlurred:s,isDirty:c,errorMap:l,errorSourceMap:u,isValidating:d,isSubmitting:f,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:h,canSubmit:g,isValid:_,isFieldsValid:v,isFieldsValidating:y,isGroupValid:b}}}}}),[r,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b]);return X(r.mount,[r]),X(()=>{r.update(e)}),x}var fn=(({children:e,...t})=>{let n=dn(t),r=(0,Y.useMemo)(()=>mt(e,n),[e,n]);return(0,J.jsx)(J.Fragment,{children:r})});function pn({form:e,selector:t=e=>e,children:n}){let r=j(e.store,t);return(0,J.jsx)(J.Fragment,{children:mt(n,r)})}function mn(e){let t=un(),[n,r]=(0,Y.useState)(e?.formId),[i,a]=(0,Y.useState)(()=>new Wt({...e,formId:e?.formId??t}));if(n!==e?.formId){let n=e?.formId??t;a(new Wt({...e,formId:n})),r(n)}let o=(0,Y.useMemo)(()=>{let e={...i,handleSubmit:((...e)=>i._handleSubmit(...e)),get formId(){return i._formId},get state(){return i.store.state}};return e.Field=function(e){return(0,J.jsx)(sn,{...e,form:i})},e.FormGroup=function(e){return(0,J.jsx)(fn,{...e,form:i})},e.Subscribe=function(e){return(0,J.jsx)(pn,{form:i,selector:e.selector,children:e.children})},e},[i]);X(i.mount,[]),X(()=>{i.update(e)});let s=(0,Y.useRef)(!1);return X(()=>{s.current&&e?.transform&&an(i,e.transform)},[i,e?.transform]),X(()=>{s.current=!0}),o}function hn({lens:e,selector:t=e=>e,children:n}){let r=j(e.store,t);return(0,J.jsx)(J.Fragment,{children:mt(n,r)})}function gn(e){let[t]=(0,Y.useState)(()=>{let n=new rn(e),r=e.form instanceof rn?e.form.form:e.form,i=n;return i.AppForm=function(e){return(0,J.jsx)(r.AppForm,{...e})},i.AppField=function(e){return(0,J.jsx)(r.AppField,{...t.getFormFieldOptions(e)})},i.Field=function(e){return(0,J.jsx)(r.Field,{...t.getFormFieldOptions(e)})},i.Subscribe=function(e){return(0,J.jsx)(hn,{lens:t,selector:e.selector,children:e.children})}
1,Object.assign(i,{...e.formComponents})});return X(t.mount,[t]),t}var _n=(0,Y.createContext)(null),vn=(0,Y.createContext)(null);function yn(){let e=(0,Y.useContext)(vn);if(!e)throw Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return e}function bn(){function e(){let e=(0,Y.useContext)(_n);if(!e)throw Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return e}return{fieldContext:_n,useFieldContext:e,useFormContext:yn,formContext:vn}}function xn({fieldComponents:e,fieldContext:t,formContext:n,formComponents:r}){function i(i){let a=mn(i),o=(0,Y.useMemo)(()=>({children:e})=>(0,J.jsx)(n.Provider,{value:a,children:e}),[a]),s=(0,Y.useMemo)(()=>(({children:n,...r})=>(0,J.jsx)(a.Field,{...r,children:r=>(0,J.jsx)(t.Provider,{value:r,children:n(Object.assign(r,e))})})),[a]);return(0,Y.useMemo)(()=>Object.assign(a,{AppField:s,AppForm:o,...r}),[a,s,o])}function a({render:e,props:t}){return function(n){return e({...t,...n})}}function o({render:e,props:t,defaultValues:n}){return function(i){let a=gn((0,Y.useMemo)(()=>({form:i.form,fields:i.fields,defaultValues:n,formComponents:r}),[i.form,i.fields]));return e({...t,...i,group:a})}}function s(e){return yn()}function c(i){return xn({fieldContext:t,formContext:n,fieldComponents:{...e,...i.fieldComponents},formComponents:{...r,...i.formComponents}})}return{useAppForm:i,withForm:a,withFieldGroup:o,useTypedAppFormContext:s,extendForm:c}}var Z=De(`numberInput`).parts(`root`,`label`,`input`,`control`,`valueText`,`incrementTrigger`,`decrementTrigger`,`scrubber`).build();function Sn(e,t){if(e&&t.isActiveElement(e))try{let{selectionStart:t,selectionEnd:n,value:r}=e;return t==null||n==null?void 0:{start:t,end:n,value:r}}catch{return}}function Cn(e,t,n){if(e&&n.isActiveElement(e)){if(!t){let t=e.value.length;e.setSelectionRange(t,t);return}try{let n=e.value,{start:r,end:i,value:a}=t;if(n===a){e.setSelectionRange(r,i);return}let o=wn(a,n,r),s=r===i?o:wn(a,n,i),c=Math.max(0,Math.min(o,n.length)),l=Math.max(c,Math.min(s,n.length));e.setSelectionRange(c,l)}catch{let t=e.value.length;e.setSelectionRange(t,t)}}}function wn(e,t,n){let r=e.slice(0,n),i=e.slice(n),a=0,o=Math.min(r.length,t.length);for(let e=0;e<o&&r[e]===t[e];e++)a=e+1;let s=0,c=Math.min(i.length,t.length-a);for(let e=0;e<c;e++){let n=i.length-1-e,r=t.length-1-e;if(i[n]===t[r])s=e+1;else break}if(r.length>0&&a>=r.length)return a;if(s>=i.length)return t.length-s;if(a>0)return a;if(s>0)return t.length-s;if(n===0&&a===0&&s===0)return t.length;if(e.length>0){let r=n/e.length;return Math.round(r*t.length)}return t.length}var Tn=e=>e.ids?.root??`number-input:${e.id}`,En=e=>e.ids?.input??`number-input:${e.id}:input`,Dn=e=>e.ids?.incrementTrigger??`number-input:${e.id}:inc`,On=e=>e.ids?.decrementTrigger??`number-input:${e.id}:dec`,kn=e=>e.ids?.scrubber??`number-input:${e.id}:scrubber`,An=e=>`number-input:${e.id}:cursor`,jn=e=>e.ids?.label??`number-input:${e.id}:label`,Mn=e=>e.getById(En(e)),Nn=e=>e.getById(Dn(e)),Pn=e=>e.getById(On(e)),Fn=e=>e.getDoc().getElementById(An(e)),In=(e,t)=>{let n=null;return t===`increment`&&(n=Nn(e)),t===`decrement`&&(n=Pn(e)),n},Ln=(e,t)=>{if(!k())return Bn(e,t),()=>{Fn(e)?.remove()}},Rn=e=>{let t=e.getDoc(),n=t.documentElement,r=t.body;return r.style.pointerEvents=`none`,n.style.userSelect=`none`,n.style.cursor=`ew-resize`,()=>{r.style.pointerEvents=``,n.style.userSelect=``,n.style.cursor=``,n.style.length||n.removeAttribute(`style`),r.style.length||r.removeAttribute(`style`)}},zn=(e,t)=>{let{point:n,isRtl:r,event:i}=t,a=e.getWin(),o=ie(i.movementX,a.devicePixelRatio),s=ie(i.movementY,a.devicePixelRatio),c=o>0?`increment`:o<0?`decrement`:null;r&&c===`increment`&&(c=`decrement`),r&&c===`decrement`&&(c=`increment`);let l={x:n.x+o,y:n.y+s},u=a.innerWidth,d=ie(7.5,a.devicePixelRatio);return l.x=ee(l.x+d,u)-d,{hint:c,point:l}},Bn=(e,t)=>{let n=e.getDoc(),r=n.createElement(`div`);r.className=`scrubber--cursor`,r.id=An(e),Object.assign(r.style,{width:`15px`,height:`15px`,position:`fixed`,pointerEvents:`none`,left:`0px`,top:`0px`,zIndex:w,transform:t?`translate3d(${t.x}px, ${t.y}px, 0px)`:void 0,willChange:`transform`}),r.innerHTML=`
2      <svg width="46" height="15" style="left: -15.5px; position: absolute; top: 0; filter: drop-shadow(rgba(0, 0, 0, 0.4) 0px 1px 1.1px);">
3        <g transform="translate(2 3)">
4          <path fill-rule="evenodd" d="M 15 4.5L 15 2L 11.5 5.5L 15 9L 15 6.5L 31 6.5L 31 9L 34.5 5.5L 31 2L 31 4.5Z" style="stroke-width: 2px; stroke: white;"></path>
5          <path fill-rule="evenodd" d="M 15 4.5L 15 2L 11.5 5.5L 15 9L 15 6.5L 31 6.5L 31 9L 34.5 5.5L 31 2L 31 4.5Z"></path>
6        </g>
7      </svg>`,n.body.appendChild(r)};function Vn(e,t){let{state:n,send:r,prop:i,scope:a,computed:o}=e,u=n.hasTag(`focus`),d=o(`isDisabled`),f=!!i(`readOnly`),p=!!i(`required`),m=n.matches(`scrubbing`),h=o(`isValueEmpty`),v=i(`invali
7d`)===void 0?o(`isOutOfRange`):!!i(`invalid`),y=d||!o(`canIncrement`)||f,x=d||!o(`canDecrement`)||f,S=i(`translations`);return{focused:u,invalid:v,empty:h,value:o(`formattedValue`),valueAsNumber:o(`valueAsNumber`),setValue(e){r({type:`VALUE.SET`,value:e})},clearValue(){r({type:`VALUE.CLEAR`})},increment(){r({type:`VALUE.INCREMENT`})},decrement(){r({type:`VALUE.DECREMENT`})},setToMax(){r({type:`VALUE.SET`,value:i(`max`)})},setToMin(){r({type:`VALUE.SET`,value:i(`min`)})},focus(){Mn(a)?.focus()},getRootProps(){return t.element({id:Tn(a),...Z.root.attrs,dir:i(`dir`),"data-disabled":b(d),"data-focus":b(u),"data-invalid":b(v),"data-scrubbing":b(m)})},getLabelProps(){return t.label({...Z.label.attrs,dir:i(`dir`),"data-disabled":b(d),"data-focus":b(u),"data-invalid":b(v),"data-required":b(p),"data-scrubbing":b(m),id:jn(a),htmlFor:En(a),onClick(){O(()=>{L(Mn(a))})}})},getControlProps(){return t.element({...Z.control.attrs,dir:i(`dir`),role:`group`,"aria-disabled":d,"data-focus":b(u),"data-disabled":b(d),"data-invalid":b(v),"data-scrubbing":b(m),"aria-invalid":g(v)})},getValueTextProps(){return t.element({...Z.valueText.attrs,dir:i(`dir`),"data-disabled":b(d),"data-invalid":b(v),"data-focus":b(u),"data-scrubbing":b(m)})},getInputProps(){return t.input({...Z.input.attrs,dir:i(`dir`),name:i(`name`),form:i(`form`),id:En(a),role:`spinbutton`,defaultValue:o(`formattedValue`),pattern:i(`formatOptions`)?void 0:i(`pattern`),inputMode:i(`inputMode`),"aria-invalid":g(v),"data-invalid":b(v),disabled:d,"data-disabled":b(d),readOnly:f,required:i(`required`),autoComplete:`off`,autoCorrect:`off`,spellCheck:`false`,type:`text`,"aria-roledescription":`numberfield`,"aria-valuemin":i(`min`),"aria-valuemax":i(`max`),"aria-valuenow":Number.isNaN(o(`valueAsNumber`))?void 0:o(`valueAsNumber`),"aria-valuetext":o(`valueText`),"data-scrubbing":b(m),onFocus(){r({type:`INPUT.FOCUS`})},onBlur(){r({type:`INPUT.BLUR`})},onInput(e){let t=Sn(e.currentTarget,a);r({type:`INPUT.CHANGE`,target:e.currentTarget,hint:`set`,selection:t})},onBeforeInput(e){try{let{selectionStart:t,selectionEnd:n,value:r}=e.currentTarget,i=r.slice(0,t)+(e.data??``)+r.slice(n);o(`parser`).isValidPartialNumber(i)||e.preventDefault()}catch{}},onKeyDown(e){if(e.defaultPrevented||f||l(e))return;let t=D(e,{step:i(`step`),largeStep:i(`largeStep`),smallStep:i(`smallStep`)}),n={ArrowUp(){r({type:`INPUT.ARROW_UP`,step:t}),e.preventDefault()},ArrowDown(){r({type:`INPUT.ARROW_DOWN`,step:t}),e.preventDefault()},Home(){_(e)||(r({type:`INPUT.HOME`}),e.preventDefault())},End(){_(e)||(r({type:`INPUT.END`}),e.preventDefault())},Enter(e){let t=Sn(e.currentTarget,a);r({type:`INPUT.ENTER`,selection:t})}}[e.key];n?.(e)}})},getDecrementTriggerProps(){return t.button({...Z.decrementTrigger.attrs,dir:i(`dir`),id:On(a),disabled:x,"data-disabled":b(x),"aria-label":S.decrementLabel,type:`button`,tabIndex:-1,"aria-controls":En(a),"data-scrubbing":b(m),onPointerDown(e){x||s(e)&&(r({type:`TRIGGER.PRESS_DOWN`,hint:`decrement`,pointerType:e.pointerType}),e.pointerType===`mouse`&&e.preventDefault(),e.pointerType===`touch`&&e.currentTarget?.focus({preventScroll:!0}))},onPointerUp(e){r({type:`TRIGGER.PRESS_UP`,hint:`decrement`,pointerType:e.pointerType})},onPointerLeave(){x||r({type:`TRIGGER.PRESS_UP`,hint:`decrement`})}})},getIncrementTriggerProps(){return t.button({...Z.incrementTrigger.attrs,dir:i(`dir`),id:Dn(a),disabled:y,"data-disabled":b(y),"aria-label":S.incrementLabel,type:`button`,tabIndex:-1,"aria-controls":En(a),"data-scrubbing":b(m),onPointerDown(e){!y&&s(e)&&(r({type:`TRIGGER.PRESS_DOWN`,hint:`increment`,pointerType:e.pointerType}),e.pointerType===`mouse`&&e.preventDefault(),e.pointerType===`touch`&&e.currentTarget?.focus({preventScroll:!0}))},onPointerUp(e){r({type:`TRIGGER.PRESS_UP`,hint:`increment`,pointerType:e.pointerType})},onPointerLeave(e){r({type:`TRIGGER.PRESS_UP`,hint:`increment`,pointerType:e.pointerType})}})},getScrubberProps(){return t.element({...Z.scrubber.attrs,dir:i(`dir`),"data-disabled":b(d),id:kn(a),role:`presentation`,"data-scrubbing":b(m),onMouseDown(e){if(d||!s(e))return;let t=c(e),n=C(e.currentTarget).devicePixelRatio;t.x-=ie(7.5,n),t.y-=ie(7.5,n),r({type:`SCRUBBER.PRESS_DOWN`,point:t}),e.preventDefault(),O(()=>{L(Mn(a))})},style:{cursor:d?void 0:`ew-resize`}})}}}var Hn=new Map,Un=!1;try{Un=new Intl.NumberFormat(`de-DE`,{signDisplay:`exceptZero`}).resolvedOptions().signDisplay===`exceptZero`}catch{}var Wn=!1;try{Wn=new Intl.NumberFormat(`de-DE`,{style:`unit`,unit:`degree`}).resolvedOptions().style===`unit`}catch{}var Gn={degree:{narrow:{default:`°`,"ja-JP":` 度`,"zh-TW":`度`,"sl-SI":` °`}}},Kn=class{constructor(e,t={}){this.numberFormatter=qn(e,t),this.options=t}format(e){let t=``;if(t=!Un&&this.options.signDisplay!=null?Jn(this.numberFormatter,this.options.signDisplay,e):this.numberFormatter.format(e),this.options.style===`unit`&&!Wn){let{unit:e,unitDisplay:n=`short`,locale:r}=this.resolvedOptions();if(!e)return t;let i=Gn[e]?.[n];t+=i[r]||i.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange==`function`)return this.numberFormatter.formatRange(e,t);if(t<e)throw RangeError(`End date must be >= start date`);return`${this.format(e)} \u{2013} ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts==`function`)return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw RangeError(`End date must be >= start date`);let n=this.numberFormatter.formatToParts(e),r=this.numberFormatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!Un&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!Wn&&this.options.style===`unit`&&(e={...e,style:`unit`,unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}};function qn(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes(`-nu-`)&&(e.includes(`-u-`)||(e+=`-u-`),e+=`-nu-${n}`),t.style===`unit`&&!Wn){let{unit:e,unitDisplay:n=`short`}=t;if(!e)throw Error(`unit option must be provided with style: "unit"`);if(!Gn[e]?.[n])throw Error(`Unsupported unit ${e} with unitDisplay = ${n}`);t={...t,style:`decimal`}}let r=e+(t?Object.entries(t).sort((e,t)=>
vendor: 10,997 bytes, line 7
7e[0]<t[0]?-1:1).join():``);if(Hn.has(r))return Hn.get(r);let i=new Intl.NumberFormat(e,t);return Hn.set(r,i),i}function Jn(e,t,n){if(t===`auto`)return e.format(n);if(t===`never`)return e.format(Math.abs(n));{let r=!1;if(t===`always`?r=n>0||Object.is(n,0):t===`exceptZero`&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let t=e.format(-n),r=e.format(n),i=t.replace(r,``).replace(/\u200e|\u061C/,``);return[...i].length!==1&&console.warn(`@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case`),t.replace(r,`!!!`).replace(i,`+`).replace(`!!!`,r)}return e.format(n)}}var Yn=RegExp(`^.*\\(.*\\).*$`),Xn=[`latn`,`arab`,`hanidec`,`deva`,`beng`,`fullwide`],Zn=class{constructor(e,t={}){this.locale=e,this.options=t}parse(e){return $n(this.locale,this.options,e).parse(e)}isValidPartialNumber(e,t,n){return $n(this.locale,this.options,e).isValidPartialNumber(e,t,n)}getNumberingSystem(e){return $n(this.locale,this.options,e).options.numberingSystem}},Qn=new Map;function $n(e,t,n){let r=er(e,t);if(!e.includes(`-nu-`)&&!r.isValidPartialNumber(n)){for(let i of Xn)if(i!==r.options.numberingSystem){let r=er(e+(e.includes(`-u-`)?`-nu-`:`-u-nu-`)+i,t);if(r.isValidPartialNumber(n))return r}}return r}function er(e,t){let n=e+(t?Object.entries(t).sort((e,t)=>e[0]<t[0]?-1:1).join():``),r=Qn.get(n);return r||(r=new tr(e,t),Qn.set(n,r)),r}var tr=class{constructor(e,t={}){this.locale=e,t.roundingIncrement!==1&&t.roundingIncrement!=null&&(t.maximumFractionDigits==null&&t.minimumFractionDigits==null?(t.maximumFractionDigits=0,t.minimumFractionDigits=0):t.maximumFractionDigits==null?t.maximumFractionDigits=t.minimumFractionDigits:t.minimumFractionDigits??=t.maximumFractionDigits),this.formatter=new Intl.NumberFormat(e,t),this.options=this.formatter.resolvedOptions(),this.symbols=ir(e,this.formatter,this.options,t),this.options.style===`percent`&&((this.options.minimumFractionDigits??0)>18||(this.options.maximumFractionDigits??0)>18)&&console.warn(`NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.`)}parse(e){let t=this.formatter.resolvedOptions().useGrouping,n=this.sanitize(e);if(!t&&this.symbols.group&&n.includes(this.symbols.group))return NaN;if(this.symbols.group&&(n=n.replaceAll(this.symbols.group,``)),this.symbols.decimal&&(n=n.replace(this.symbols.decimal,`.`)),this.symbols.minusSign&&(n=n.replace(this.symbols.minusSign,`-`)),n=n.replace(this.symbols.numeral,this.symbols.index),this.options.style===`percent`){let e=n.indexOf(`-`);n=n.replace(`-`,``),n=n.replace(`+`,``);let t=n.indexOf(`.`);t===-1&&(t=n.length),n=n.replace(`.`,``),n=t-2==0?`0.${n}`:t-2==-1?`0.0${n}`:t-2==-2?`0.00`:`${n.slice(0,t-2)}.${n.slice(t-2)}`,e>-1&&(n=`-${n}`)}let r=n?+n:NaN;if(isNaN(r))return NaN;if(this.options.style===`percent`){let e={...this.options,style:`decimal`,minimumFractionDigits:Math.min((this.options.minimumFractionDigits??0)+2,20),maximumFractionDigits:Math.min((this.options.maximumFractionDigits??0)+2,20)};return new Zn(this.locale,e).parse(new Kn(this.locale,e).format(r))}return this.options.currencySign===`accounting`&&Yn.test(e)&&(r=-1*r),r}sanitize(e){let t=this.formatter.resolvedOptions().useGrouping;return this.symbols.noNumeralUnits.length>0&&this.symbols.noNumeralUnits.find(t=>t.unit===e)?this.symbols.noNumeralUnits.find(t=>t.unit===e).value.toString():(e=e.replace(this.symbols.literals,``),this.symbols.minusSign&&(e=e.replace(`-`,this.symbols.minusSign)),this.options.numberingSystem===`arab`&&(this.symbols.decimal&&(e=ar(e,`,`,this.symbols.decimal),e=ar(e,`،`,this.symbols.decimal)),this.symbols.group&&t&&(e=ar(e,`.`,this.symbols.group))),this.symbols.group===`’`&&e.includes(`'`)&&t&&(e=ar(e,`'`,this.symbols.group)),this.symbols.group===`'`&&e.includes(`’`)&&t&&(e=ar(e,`’`,this.symbols.group)),this.options.locale===`fr-FR`&&this.symbols.group&&t&&(e=ar(e,` `,this.symbols.group),e=ar(e,/\u00A0/g,this.symbols.group)),e)}isValidPartialNumber(e,t=-1/0,n=1/0){let r=this.formatter.resolvedOptions().useGrouping;return e=this.sanitize(e),this.symbols.minusSign&&e.startsWith(this.symbols.minusSign)&&t<0?e=e.slice(this.symbols.minusSign.length):this.symbols.plusSign&&e.startsWith(this.symbols.plusSign)&&n>0&&(e=e.slice(this.symbols.plusSign.length)),this.symbols.decimal&&e.indexOf(this.symbols.decimal)>-1&&this.options.maximumFractionDigits===0?!1:(this.symbols.group&&r&&(e=ar(e,this.symbols.group,``)),e=e.replace(this.symbols.numeral,``),this.symbols.decimal&&(e=e.replace(this.symbols.decimal,``)),e.length===0)}},nr=new Set([`decimal`,`fraction`,`integer`,`minusSign`,`plusSign`,`group`]),rr=[0,4,2,1,11,20,3,7,100,21,.1,1.1];function ir(e,t,n,r){let i=new Intl.NumberFormat(e,{...n,minimumSignificantDigits:1,maximumSignificantDigits:21,roundingIncrement:1,roundingPriority:`auto`,roundingMode:`halfExpand`,useGrouping:!0}),a=i.formatToParts(-10000.111),o=i.formatToParts(10000.111),s=rr.map(e=>i.formatToParts(e)),c=s.map((e,t)=>{let n=e.find(e=>e.type===`unit`);return n&&!e.some(e=>e.type===`integer`||e.type===`fraction`)?{unit:n.value,value:rr[t]}:null}).filter(e=>!!e),l=a.find(e=>e.type===`minusSign`)?.value??`-`,u=o.find(e=>e.type===`plusSign`)?.value;!u&&(r?.signDisplay===`exceptZero`||r?.signDisplay===`always`)&&(u=`+`);let d=new Intl.NumberFormat(e,{...n,minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(.001).find(e=>e.type===`decimal`)?.value,f=a.find(e=>e.type===`group`)?.value,p=a.filter(e=>!nr.has(e.type)).map(e=>or(e.value)),m=s.flatMap(e=>e.filter(e=>!nr.has(e.type)).map(e=>or(e.value))),h=[...new Set([...p,...m])].sort((e,t)=>t.length-e.length),g=h.length===0?RegExp(`\\p{White_Space}|\\p{Cf}`,`gu`):RegExp(`${h.join(`|`)}|\\p{White_Space}|\\p{Cf}`,`gu`),_=[...new Intl.NumberFormat(n.locale,{useGrouping:!1}).format(9876543210)].reverse(),v=new Map(_.map((e,t)=>[e,t])),y=RegExp(`[${_.join(``)}]`,`g`);return{minusSign:l,plusSign:u,decimal:d,group:f,literals:g,numeral:y,numerals:_,index:e=>String(v.get(e)),noNumeralUnits:c}}function ar(e,t,n){return e.replaceAll?e.replaceAll(t,n):e.split(t).join(n)}function or(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var sr=(e,t={})=>new Intl.NumberFormat(e,t),cr=(e,t={})=>new Zn(e,t),lr=(e,t)=>{let{prop:n,computed:r}=t;return n(`formatOptions`)?e===``?NaN:r(`parser`).parse(e):parseFloat(e)},ur=(e,t)=>{let{prop:n,computed:r}=t;return Number.isNaN(e)?``:n(`formatOptions`)?r(`formatter`).format(e):e.toString()},dr=(e,t)=>{let n=e!==void 0&&!Number.isNaN(e)?e:1;return t?.style===`percent`&&(e===void 0||Number.isNaN(e))&&(n=.01),n},{choose:fr,guards:pr,createMachine:mr}=y(),{not:hr,and:gr}=pr,_r=mr({props({props:e}){let t=dr(e.step,e.formatOptions);return{dir:`ltr`,locale:`en-US`,focusInputOnChange:!0,clampValueOnBlur:!e.allowOverflow,allowOverflow:!1,inputMode:`decimal`,pattern:`-?[0-9]*(.[0-9]+)?`,defaultValue:``,step:t,min:-(2**53-1),max:2**53-1,spinOnPress:!0,...e,largeStep:e.largeStep??10*t,smallStep:e.smallStep??t/10,translations:{incrementLabel:`increment value`,decrementLabel:`decrease value`,...e.translations}}},initialState(){return`idle`},context({prop:e,bindable:t,getComputed:n}){return{value:t(()=>({defaultValue:e(`defaultValue`),value:e(`value`),onChange(t){let r=lr(t,{computed:n(),prop:e});e(`onValueChange`)?.({value:t,valueAsNumber:r})}})),hint:t(()=>({defaultValue:null})),scrubberCursorPoint:t(()=>({defaultValue:null,hash(e){return e?`x:${e.x}, y:${e.y}`:``}})),fieldsetDisabled:t(()=>({defaultValue:!1}))}},computed:{isRtl:({prop:e})=>e(`dir`)===`rtl`,valueAsNumber:({context:e,computed:t,prop:n})=>lr(e.get(`value`),{computed:t,prop:n}),formattedValue:({computed:e,prop:t})=>ur(e(`valueAsNumber`),{computed:e,prop:t}),isAtMin:({computed:e,prop:t})=>te(e(`valueAsNumber`),t(`min`)),isAtMax:({computed:e,prop:t})=>oe(e(`valueAsNumber`),t(`max`)),isOutOfRange:({computed:e,prop:t})=>!ne(e(`valueAsNumber`),t(`min`),t(`max`)),isValueEmpty:({context:e})=>e.get(`value`)===``,isDisabled:({prop:e,context:t})=>!!e(`disabled`)||t.get(`fieldsetDisabled`),canIncrement:({prop:e,computed:t})=>e(`allowOverflow`)||!t(`isAtMax`),canDecrement:({prop:e,computed:t})=>e(`allowOverflow`)||!t(`isAtMin`),valueText:({prop:e,context:t})=>e(`translations`).valueText?.(t.get(`value`)),formatter:I(({prop:e})=>[e(`locale`),e(`formatOptions`)],([e,t])=>sr(e,t)),parser:I(({prop:e})=>[e(`locale`),e(`formatOptions`)],([e,t])=>cr(e,t))},watch({track:e,action:t,context:n,computed:r,prop:i}){e([()=>n.get(`value`),()=>i(`locale`),()=>JSON.stringify(i(`formatOptions`))],()=>{t([`syncInputElement`])}),e([()=>r(`isOutOfRange`)],()=>{t([`invokeOnInvalid`])}),e([()=>n.hash(`scrubberCursorPoint`)],()=>{t([`setVirtualCursorPosition`])})},effects:[`trackFormControl`],on:{"VALUE.SET":{actions:[`setRawValue`]},"VALUE.CLEAR":{actions:[`clearValue`]},"VALUE.INCREMENT":{actions:[`increment`]},"VALUE.DECREMENT":{actions:[`decrement`]}},states:{idle:{on:{"TRIGGER.PRESS_DOWN":[{guard:`isTouchPointer`,target:`before:spin`,actions:[`setHint`]},{target:`before:spin`,actions:[`focusInput`,`invokeOnFocus`,`setHint`]}],"SCRUBBER.PRESS_DOWN":{target:`scrubbing`,actions:[`focusInput`,`invokeOnFocus`,`setHint`,`setCursorPoint`]},"INPUT.FOCUS":{target:`focused`,actions:[`focusInput`,`invokeOnFocus`]}}},focused:{tags:[`focus`],effects:[`attachWheelListener`],on:{"TRIGGER.PRESS_DOWN":[{guard:`isTouchPointer`,target:`before:spin`,actions:[`setHint`]},{target:`before:spin`,actions:[`focusInput`,`setHint`]}],"SCRUBBER.PRESS_DOWN":{target:`scrubbing`,actions:[`focusInput`,`setHint`,`setCursorPoint`]},"INPUT.ARROW_UP":{actions:[`increment`]},"INPUT.ARROW_DOWN":{actions:[`decrement`]},"INPUT.HOME":{actions:[`decrementToMin`]},"INPUT.END":{actions:[`incrementToMax`]},"INPUT.CHANGE":{actions:[`setValue`,`setHint`]},"INPUT.BLUR":[{guard:gr(`clampValueOnBlur`,hr(`isValueEmpty`),hr(`isInRange`)),target:`idle`,actions:[`setClampedValue`,`clearHint`,`invokeOnBlur`,`invokeOnValueCommit`]},{guard:hr(`isInRange`),target:`idle`,actions:[`setFormattedValue`,`clearHint`,`invokeOnBlur`,`invokeOnInvalid`,`invokeOnValueCommit`]},{target:`idle`,actions:[`setFormattedValue`,`clearHint`,`invokeOnBlur`,`invokeOnValueCommit`]}],"INPUT.ENTER":{actions:[`setFormattedValue`,`clearHint`,`invokeOnBlur`,`invokeOnValueCommit`]}}},"before:spin":{tags:[`focus`],effects:[`trackButtonDisabled`,`waitForChangeDelay`],entry:fr([{guard:`isIncrementHint`,actions:[`increment`]},{guard:`isDecrementHint`,actions:[`decrement`]}]),on:{CHANGE_DELAY:{target:`spinning`,guard:gr(`isInRange`,`spinOnPress`)},"TRIGGER.PRESS_UP":[{guard:`isTouchPointer`,target:`focused`,actions:[`clearHint`]},{target:`focused`,actions:[`focusInput`,`clearHint`]}]}},spinning:{tags:[`focus`],effects:[`trackButtonDisabled`,`spinValue`],on:{SPIN:[{guard:`isIncrementHint`,actions:[`increment`]},{guard:`isDecrementHint`,actions:[`decrement`]}],"TRIGGER.PRESS_UP":{target:`focused`,actions:[`focusInput`,`clearHint`]}}},scrubbing:{tags:[`focus`],effects:[`activatePointerLock`,`trackMousemove`,`setupVirtualCurs
7or`,`preventTextSelection`],on:{"SCRUBBER.POINTER_UP":{target:`focused`,actions:[`focusInput`,`clearCursorPoint`]},"SCRUBBER.POINTER_MOVE":[{guard:`isIncrementHint`,actions:[`increment`,`setCursorPoint`]},{guard:`isDecrementHint`,actions:[`decrement`,`setCursorPoint`]}]}}},implementations:{guards:{clampValueOnBlur:({prop:e})=>e(`clampValueOnBlur`),spinOnPress:({prop:e})=>!!e(`spinOnPress`),isInRange:({computed:e})=>!e(`isOutOfRange`),isValueEmpty:({computed:e})=>e(`isValueEmpty`),isDecrementHint:({context:e,event:t})=>(t.hint??e.get(`hint`))===`decrement`,isIncrementHint:({context:e,event:t})=>(t.hint??e.get(`hint`))===`increment`,isTouchPointer:({event:e})=>e.pointerType===`touch`},effects:{waitForChangeDelay({send:e}){let t=setTimeout(()=>{e({type:`CHANGE_DELAY`})},300);return()=>clearTimeout(t)},spinValue({send:e}){let t=setInterval(()=>{e({type:`SPIN`})},50);return()=>clearInterval(t)},trackFormControl({context:e,scope:t}){let n=Mn(t);return _e(n,{onFieldsetDisabledChange(t){e.set(`fieldsetDisabled`,t)},onFormReset(){e.set(`value`,e.initial(`value`))}})},setupVirtualCursor({context:e,scope:t}){return Ln(t,e.get(`scrubberCursorPoint`))},preventTextSelection({scope:e}){return Rn(e)},trackButtonDisabled({context:e,scope:t,send:n}){let r=In(t,e.get(`hint`));return P(r,{attributes:[`disabled`],callback(){n({type:`TRIGGER.PRESS_UP`,src:`attr`})}})},attachWheelListener({scope:e,send:t,prop:n}){let r=Mn(e);if(!r||!e.isActiveElement(r)||!n(`allowMouseWheel`))return;function i(e){e.preventDefault();let n=Math.sign(e.deltaY)*-1;n===1?t({type:`VALUE.INCREMENT`}):n===-1&&t({type:`VALUE.DECREMENT`})}return p(r,`wheel`,i,{passive:!1})},activatePointerLock({scope:e}){if(!k())return ct(e.getDoc())},trackMousemove({scope:e,send:t,context:n,computed:r}){let i=e.getDoc();function a(i){let a=zn(e,{point:n.get(`scrubberCursorPoint`),isRtl:r(`isRtl`),event:i});a.hint&&t({type:`SCRUBBER.POINTER_MOVE`,hint:a.hint,point:a.point})}function o(){t({type:`SCRUBBER.POINTER_UP`})}return d(p(i,`mousemove`,a,!1),p(i,`mouseup`,o,!1))}},actions:{focusInput({scope:e,prop:t}){if(!t(`focusInputOnChange`))return;let n=Mn(e);e.isActiveElement(n)||O(()=>n?.focus({preventScroll:!0}))},increment({context:e,event:t,prop:n,computed:r}){let i=F(r(`valueAsNumber`),t.step??n(`step`));n(`allowOverflow`)||(i=re(i,n(`min`),n(`max`))),e.set(`value`,ur(i,{computed:r,prop:n}))},decrement({context:e,event:t,prop:n,computed:r}){let i=se(r(`valueAsNumber`),t.step??n(`step`));n(`allowOverflow`)||(i=re(i,n(`min`),n(`max`))),e.set(`value`,ur(i,{computed:r,prop:n}))},setClampedValue({context:e,prop:t,computed:n}){let r=re(n(`valueAsNumber`),t(`min`),t(`max`));e.set(`value`,ur(r,{computed:n,prop:t}))},setRawValue({context:e,event:t,prop:n,computed:r}){let i=typeof t.value==`number`?t.value:lr(t.value,{computed:r,prop:n});n(`allowOverflow`)||(i=re(i,n(`min`),n(`max`))),e.set(`value`,ur(i,{computed:r,prop:n}))},setValue({context:e,event:t}){let n=t.target?.value??t.value;e.set(`value`,n)},clearValue({context:e}){e.set(`value`,``)},incrementToMax({context:e,prop:t,computed:n}){let r=ur(t(`max`),{computed:n,prop:t});e.set(`value`,r)},decrementToMin({context:e,prop:t,computed:n}){let r=ur(t(`min`),{computed:n,prop:t});e.set(`value`,r)},setHint({context:e,event:t}){e.set(`hint`,t.hint)},clearHint({context:e}){e.set(`hint`,null)},invokeOnFocus({computed:e,prop:t}){t(`onFocusChange`)?.({focused:!0,value:e(`formattedValue`),valueAsNumber:e(`valueAsNumber`)})},invokeOnBlur({computed:e,prop:t}){t(`onFocusChange`)?.({focused:!1,value:e(`formattedValue`),valueAsNumber:e(`valueAsNumber`)})},invokeOnInvalid({computed:e,prop:t,event:n}){if(n.type===`INPUT.CHANGE`)return;let r=e(`valueAsNumber`)>t(`max`)?`rangeOverflow`:`rangeUnderflow`;t(`onValueInvalid`)?.({reason:r,value:e(`formattedValue`),valueAsNumber:e(`valueAsNumber`)})},invokeOnValueCommit({computed:e,prop:t}){t(`onValueCommit`)?.({value:e(`formattedValue`),valueAsNumber:e(`valueAsNumber`)})},syncInputElement({context:e,event:t,computed:n,scope:r}){let i=t.type.endsWith(`CHANGE`)?e.get(`value`):n(`formattedValue`),a=Mn(r),o=t.selection??Sn(a,r);O(()=>{ge(a,i),Cn(a,o,r)})},setFormattedValue({context:e,computed:t,action:n}){e.set(`value`,t(`formattedValue`)),n([`syncInputElement`])},setCursorPoint({context:e,event:t}){e.set(`scrubberCursorPoint`,t.point)},clearCursorPoint({context:e}){e.set(`scrubberCursorPoint`,null)}
7,setVirtualCursorPosition({context:e,scope:t}){let n=Fn(t),r=e.get(`scrubberCursorPoint`);n&&r&&(n.style.transform=`translate3d(${r.x}px, ${r.y}px, 0px)`)}}}}),vr=De(`radio-group`).parts(`root`,`label`,`item`,`itemText`,`itemControl`,`indicator`).build(),yr=e=>e.ids?.root??`radio-group:${e.id}`,br=e=>e.ids?.label??`radio-group:${e.id}:label`,xr=(e,t)=>e.ids?.item?.(t)??`radio-group:${e.id}:radio:${t}`,Sr=(e,t)=>e.ids?.itemHiddenInput?.(t)??`radio-group:${e.id}:radio:input:${t}`,Cr=(e,t)=>e.ids?.itemControl?.(t)??`radio-group:${e.id}:radio:control:${t}`,wr=(e,t)=>e.ids?.itemLabel?.(t)??`radio-group:${e.id}:radio:label:${t}`,Tr=e=>e.ids?.indicator??`radio-group:${e.id}:indicator`,Er=e=>e.getById(yr(e)),Dr=(e,t)=>e.getById(Sr(e,t)),Or=e=>e.getById(Tr(e)),kr=e=>Er(e)?.querySelector(`input:not(:disabled)`),Ar=e=>Er(e)?.querySelector(`input:not(:disabled):checked`),jr=e=>{let t=`input[type=radio]${T(yr(e))}:not([disabled])`;return fe(Er(e),t)},Mr=(e,t)=>{if(t)return e.getById(xr(e,t))},Nr=e=>({x:e?.offsetLeft??0,y:e?.offsetTop??0,width:e?.offsetWidth??0,height:e?.offsetHeight??0});function Pr(e,t){let{context:n,send:r,computed:i,prop:a,scope:o}=e,c=i(`isDisabled`),l=a(`invalid`),u=a(`readOnly`);function d(e){return{value:e.value,invalid:!!e.invalid||!!l,disabled:!!e.disabled||c,checked:n.get(`value`)===e.value,focused:n.get(`focusedValue`)===e.value,focusVisible:n.get(`focusVisibleValue`)===e.value,hovered:n.get(`hoveredValue`)===e.value,active:n.get(`activeValue`)===e.value}}function p(e){let t=d(e);return{"data-focus":b(t.focused),"data-focus-visible":b(t.focusVisible),"data-disabled":b(t.disabled),"data-readonly":b(u),"data-state":t.checked?`checked`:`unchecked`,"data-hover":b(t.hovered),"data-invalid":b(t.invalid),"data-orientation":a(`orientation`),"data-ssr":b(n.get(`ssr`))}}let m=()=>{(Ar(o)??kr(o))?.focus()};return{focus:m,value:n.get(`value`),setValue(e){r({type:`SET_VALUE`,value:e,isTrusted:!1})},clearValue(){r({type:`SET_VALUE`,value:null,isTrusted:!1})},getRootProps(){return t.element({...vr.root.attrs,role:`radiogroup`,id:yr(o),"aria-labelledby":br(o),"aria-required":a(`required`)||void 0,"aria-disabled":c||void 0,"aria-readonly":u||void 0,"data-orientation":a(`orientation`),"data-disabled":b(c),"data-invalid":b(l),"data-required":b(a(`required`)),"aria-orientation":a(`orientation`),dir:a(`dir`),style:{position:`relative`}})},getLabelProps(){return t.element({...vr.label.attrs,dir:a(`dir`),"data-orientation":a(`orientation`),"data-disabled":b(c),"data-invalid":b(l),"data-required":b(a(`required`)),id:br(o),onClick:m})},getItemState:d,getItemProps(e){let n=d(e);return t.label({...vr.item.attrs,dir:a(`dir`),id:xr(o,e.value),htmlFor:Sr(o,e.value),...p(e),onPointerMove(){n.disabled||n.hovered||r({type:`SET_HOVERED`,value:e.value,hovered:!0})},onPointerLeave(){n.disabled||r({type:`SET_HOVERED`,value:null})},onPointerDown(t){n.disabled||s(t)&&(n.focused&&t.pointerType===`mouse`&&t.preventDefault(),r({type:`SET_ACTIVE`,value:e.value,active:!0}))},onPointerUp(){n.disabled||r({type:`SET_ACTIVE`,value:null})},onClick(){!n.disabled&&k()&&Dr(o,e.value)?.focus()}})},getItemTextProps(e){return t.element({...vr.itemText.attrs,dir:a(`dir`),id:wr(o,e.value),...p(e)})},getItemControlProps(e){let n=d(e);return t.element({...vr.itemControl.attrs,dir:a(`dir`),id:Cr(o,e.value),"data-active":b(n.active),"aria-hidden":!0,...p(e)})},getItemHiddenInputProps(e){let n=d(e);return t.input({"data-ownedby":yr(o),id:Sr(o,e.value),type:`radio`,name:a(`name`)||a(`id`),form:a(`form`),value:e.value,required:a(`required`),"aria-labelledby":wr(o,e.value),"aria-invalid":n.invalid||void 0,onClick(t){if(u){t.preventDefault();return}t.currentTarget.checked&&r({type:`SET_VALUE`,value:e.value,isTrusted:!0})},onBlur(){r({type:`SET_FOCUSED`,value:null,focused:!1,focusVisible:!1})},onFocus(){let t=ke();r({type:`SET_FOCUSED`,value:e.value,focused:!0,focusVisible:t})},onKeyDown(t){t.defaultPrevented||t.key===` `&&r({type:`SET_ACTIVE`,value:e.value,active:!0})},onKeyUp(e){e.defaultPrevented||e.key===` `&&r({type:`SET_ACTIVE`,value:null})},disabled:n.disabled||u,defaultChecked:n.checked,style:ve})},getIndicatorProps(){let e=n.get(`indicatorRect`),i=n.get(`animateIndicator`);return t.element({id:Tr(o),...vr.indicator.attrs,dir:a(`dir`),hidden:n.get(`value`)==null||Fr(e),"data-disabled":b(c),"data-orientation":a(`orientation`),onTransitionEnd(e){f(e)===e.currentTarget&&r({type:`INDICATOR_TRANSITION_END`})},style:{"--transition-property":`left, top, width, height`,"--left":R(e?.x),"--top":R(e?.y),"--width":R(e?.width),"--height":R(e?.height),position:`absolute`,willChange:i?`var(--transition-property)`:`auto`,transitionProperty:i?`var(--transition-property)`:`none`,transitionDuration:i?`var(--transition-duration, 150ms)`:`0ms`,transitionTimingFunction:`var(--transition-timing-function)`,[a(`orientation`)===`horizontal`?`left`:`top`]:a(`orientation`)===`horizontal`?`var(--left)`:`var(--top)`}})}}}var Fr=e=>e==null||e.width===0&&e.height===0&&e.x===0&&e.y===0,{not:Ir}=m(),Lr=S({props({props:e}){return{orientation:`vertical`,...e}},initialState(){return`idle`},context({prop:e,bindable:t}){return{value:t(()=>({defaultValue:e(`defaultValue`),value:e(`value`),onChange(t){e(`onValueChange`)?.({value:t})}})),activeValue:t(()=>({defaultValue:null})),focusedValue:t(()=>({defaultValue:null})),focusVisibleValue:t(()=>({defaultValue:null})),hoveredValue:t(()=>({defaultValue:null})),indicatorRect:t(()=>({defaultValue:null})),animateIndicator:t(()=>({defaultValue:!1})),fieldsetDisabled:t(()=>({defaultValue:!1})),ssr:t(()=>({defaultValue:!0}))}},refs(){return{indicatorCleanup:null,focusVisibleValue:null,prevValue:null}},computed:{isDisabled:({prop:e,context:t})=>!!e(`disabled`)||t.get(`fieldsetDisabled`)},entry:[`syncPrevValue`,`syncIndicatorRect`,`syncSsr`],exit:[`cleanupObserver`],effects:[`trackFormControlState`,`trackFocusVisible`],watch({track:e,action:t,context:n}){e([()=>n.get(`value`)],()=>{t([`syncIndicatorAnimation`,`syncIndicatorRect`,`syncInputElements`])})},on:{SET_VALUE:[{guard:Ir(`isTrusted`),actions:[`setValue`,`dispatchChangeEvent`]},{actions:[`setValue`]}],SET_HOVERED:{actions:[`setHovered`]}
7,SET_ACTIVE:{actions:[`setActive`]},SET_FOCUSED:{actions:[`setFocused`]},INDICATOR_TRANSITION_END:{actions:[`clearIndicatorAnimation`]}},states:{idle:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackFormControlState({context:e,scope:t}){return _e(Er(t),{onFieldsetDisabledChange(t){e.set(`fieldsetDisabled`,t)},onFormReset(){e.set(`value`,e.initial(`value`))}})},trackFocusVisible({scope:e}){return Te({root:e.getRootNode?.()})}},actions:{setValue({context:e,event:t}){e.set(`value`,t.value)},setHovered({context:e,event:t}){e.set(`hoveredValue`,t.value)},setActive({context:e,event:t}){e.set(`activeValue`,t.value)},setFocused({context:e,event:t}){e.set(`focusedValue`,t.value);let n=t.value!=null&&t.focusVisible?t.value:null;e.set(`focusVisibleValue`,n)},syncPrevValue({context:e,refs:t}){t.set(`prevValue`,e.get(`value`))},syncIndicatorAnimation({context:e,refs:t}){let n=t.get(`prevValue`),r=e.get(`value`),i=n!=null&&r!=null&&n!==r;e.set(`animateIndicator`,i),t.set(`prevValue`,r)},clearIndicatorAnimation({context:e}){e.set(`animateIndicator`,!1)},syncInputElements({context:e,scope:t}){jr(t).forEach(t=>{t.checked=t.value===e.get(`value`)})},cleanupObserver({refs:e}){e.get(`indicatorCleanup`)?.()},syncSsr({context:e}){e.set(`ssr`,!1)},syncIndicatorRect({context:e,scope:t,refs:n}){if(n.get(`indicatorCleanup`)?.(),!Or(t))return;let r=e.get(`value`),i=Mr(t,r);if(r==null||!i){e.set(`indicatorRect`,null);return}let a=()=>{e.set(`indicatorRect`,Nr(i))};a();let o=ut.observe(i,a);n.set(`indicatorCleanup`,o)},dispatchChangeEvent({context:e,scope:t}){jr(t).forEach(t=>{let n=t.value===e.get(`value`);n!==t.checked&&ye(t,{checked:n})})}}}}),Rr=De(`switch`).parts(`root`,`label`,`control`,`thumb`).build(),zr=e=>e.ids?.root??`switch:${e.id}`,Br=e=>e.ids?.label??`switch:${e.id}:label`,Vr=e=>e.ids?.thumb??`switch:${e.id}:thumb`,Hr=e=>e.ids?.control??`switch:${e.id}:control`,Ur=e=>e.ids?.hiddenInput??`switch:${e.id}:input`,Wr=e=>e.getById(zr(e)),Gr=e=>e.getById(Ur(e));function Kr(e,t){let{context:n,send:r,prop:i,scope:a}=e,o=!!i(`disabled`),s=!!i(`readOnly`),c=!!i(`required`),l=!!n.get(`checked`),u=!o&&n.get(`focused`),d=!o&&n.get(`focusVisible`),p=!o&&n.get(`active`),m={"data-active":b(p),"data-focus":b(u),"data-focus-visible":b(d),"data-readonly":b(s),"data-hover":b(n.get(`hovered`)),"data-disabled":b(o),"data-state":l?`checked`:`unchecked`,"data-invalid":b(i(`invalid`)),"data-required":b(c)};return{checked:l,disabled:o,focused:u,setChecked(e){r({type:`CHECKED.SET`,checked:e,isTrusted:!1})},toggleChecked(){r({type:`CHECKED.TOGGLE`,checked:l,isTrusted:!1})},getRootProps(){return t.label({...Rr.root.attrs,...m,dir:i(`dir`),id:zr(a),htmlFor:Ur(a),onPointerMove(){o||r({type:`CONTEXT.SET`,context:{hovered:!0}})},onPointerLeave(){o||r({type:`CONTEXT.SET`,context:{hovered:!1}})},onClick(e){o||(f(e)===Gr(a)&&e.stopPropagation(),k()&&Gr(a)?.focus())}})},getLabelProps(){return t.element({...Rr.label.attrs,...m,dir:i(`dir`),id:Br(a)})},getThumbProps(){return t.element({...Rr.thumb.attrs,...m,dir:i(`dir`),id:Vr(a),"aria-hidden":!0})},getControlProps(){return t.element({...Rr.control.attrs,...m,dir:i(`dir`),id:Hr(a),"aria-hidden":!0})},getHiddenInputProps(){return t.input({id:Ur(a),type:`checkbox`,required:i(`required`),defaultChecked:l,disabled:o,"aria-labelledby":Br(a),"aria-invalid":i(`invalid`),name:i(`name`),form:i(`form`),value:i(`value`),style:ve,onFocus(){let e=ke();r({type:`CONTEXT.SET`,context:{focused:!0,focusVisible:e}})},onBlur(){r({type:`CONTEXT.SET`,context:{focused:!1,focusVisible:!1}})},onClick(e){if(s){e.preventDefault();return}let t=e.currentTarget.checked;r({type:`CHECKED.SET`,checked:t,isTrusted:!0})}})}}}var{not:qr}=m(),Jr=S({props({props:e}){return{defaultChecked:!1,label:`switch`,value:`on`,...e}},initialState(){return`ready`},context({prop:e,bindable:t}){return{checked:t(()=>({defaultValue:e(`defaultChecked`),value:e(`checked`),onChange(t){e(`onCheckedChange`)?.({checked:t})}})),fieldsetDisabled:t(()=>({defaultValue:!1})),focusVisible:t(()=>({defaultValue:!1})),active:t(()=>({defaultValue:!1})),focused:t(()=>({defaultValue:!1})),hovered:t(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:e,prop:t})=>t(`disabled`)||e.get(`fieldsetDisabled`)},watch({track:e,prop:t,context:n,action:r}){e([()=>t(`disabled`)],()=>{r([`removeFocusIfNeeded`])}),e([()=>n.get(`checked`)],()=>{r([`syncInputElement`])})},effects:[`trackFormControlState`,`trackPressEvent`,`trackFocusVisible`],on:{"CHECKED.TOGGLE":[{guard:qr(`isTrusted`),actions:[`toggleChecked`,`dispatchChangeEvent`]},{actions:[`toggleChecked`]}],"CHECKED.SET":[{guard:qr(`isTrusted`),actions:[`setChecked`,`dispatchChangeEvent`]},{actions:[`setChecked`]}],"CONTEXT.SET":{actions:[`setContext`]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:e})=>!!e.isTrusted},effects:{trackPressEvent({computed:e,scope:t,context:n}){if(!e(`isDisabled`))return Ce({pointerNode:Wr(t),keyboardNode:Gr(t),isValidKey:e=>e.key===` `,onPress:()=>n.set(`active`,!1),onPressStart:()=>n.set(`active`,!0),onPressEnd:()=>n.set(`active`,!1)})},trackFocusVisible({computed:e,scope:t}){if(!e(`isDisabled`))return Te({root:t.getRootNode()})},trackFormControlState({context:e,send:t,scope:n}){return _e(Gr(n),{onFieldsetDisabledChange(t){e.set(`fieldsetDisabled`,t)},onFormReset(){t({type:`CHECKED.SET`,checked:!!e.initial(`checked`),src:`form-reset`})}})}},actions:{setContext({context:e,event:t}){for(let n in t.context)e.set(n,t.context[n])},syncInputElement({context:e,scope:t}){let n=Gr(t);n&&be(n,!!e.get(`checked`))},removeFocusIfNeeded({context:e,prop:t}){t(`disabled`)&&e.set(`focused`,!1)},setChecked({context:e,event:t}){e.set(`checked`,t.checked)},toggleChecked({context:e}){e.set(`checked`,!e.get(`checked`))},dispatchChangeEvent({context:e,scope:t}){queueMicrotask(()=>{let n=Gr(t);ye(n,{checked:e.get(`checked`)})})}}}}),[Yr,Xr]=je({name:`NumberInputContext`,hookName:`useNumberInputContext`,providerName:`<NumberInputProvider />`}),Zr=e=>e.children(Xr()),Qr=(0,Y.forwardRef)((e,t)=>{let n=h(Xr().getControlProps(),e);return(0,J.jsx)(E.div,{...n,ref:t})});Qr.displayName=`NumberInputControl`;var $r=(0,Y.forwardRef)((e,t)=>{let n=h(Xr().getDecrementTriggerProps(),e);return(0,J.jsx)(E.button,{...n,ref:t})});
7$r.displayName=`NumberInputDecrementTrigger`;var ei=(0,Y.forwardRef)((e,t)=>{let n=h(Xr().getIncrementTriggerProps(),e);return(0,J.jsx)(E.button,{...n,ref:t})});ei.displayName=`NumberInputIncrementTrigger`;var ti=(0,Y.forwardRef)((e,t)=>{let n=h(Xr().getInputProps(),e),r=xe();return(0,J.jsx)(E.input,{"aria-describedby":r?.ariaDescribedby,...n,ref:t})});ti.displayName=`NumberInputInput`;var ni=(0,Y.forwardRef)((e,t)=>{let n=h(Xr().getLabelProps(),e);return(0,J.jsx)(E.label,{...n,ref:t})});ni.displayName=`NumberInputLabel`;var ri=e=>{let t=(0,Y.useId)(),{getRootNode:n}=Ee(),{dir:r,locale:i}=Oe(),a=xe(),o={id:t,ids:{label:a?.ids.label,input:a?.ids.control},disabled:a?.disabled,readOnly:a?.readOnly,required:a?.required,invalid:a?.invalid,dir:r,locale:i,getRootNode:n,...e};return Vn(v(_r,o),x)},ii=u(),ai=(0,Y.forwardRef)((e,t)=>{let[n,r]=ii(e,`allowMouseWheel.allowOverflow.clampValueOnBlur.defaultValue.disabled.focusInputOnChange.form.formatOptions.id.ids.inputMode.invalid.largeStep.locale.max.min.name.onFocusChange.onValueChange.onValueCommit.onValueInvalid.pattern.readOnly.required.smallStep.spinOnPress.step.translations.value`.split(`.`)),i=ri(n),a=h(i.getRootProps(),r);return(0,J.jsx)(Yr,{value:i,children:(0,J.jsx)(E.div,{...a,ref:t})})});ai.displayName=`NumberInputRoot`;var oi=u(),si=(0,Y.forwardRef)((e,t)=>{let[{value:n},r]=oi(e,[`value`]),i=h(n.getRootProps(),r);return(0,J.jsx)(Yr,{value:n,children:(0,J.jsx)(E.div,{...i,ref:t})})});si.displayName=`NumberInputRootProvider`;var ci=(0,Y.forwardRef)((e,t)=>{let n=h(Xr().getScrubberProps(),e);return(0,J.jsx)(E.div,{...n,ref:t})});ci.displayName=`NumberInputScrubber`;var li=(0,Y.forwardRef)((e,t)=>{let{children:n,...r}=e,i=Xr(),a=h(i.getValueTextProps(),r);return(0,J.jsx)(E.span,{...a,ref:t,children:n||i.value})});li.displayName=`NumberInputValueText`;var ui=Ae({Context:()=>Zr,Control:()=>Qr,DecrementTrigger:()=>$r,IncrementTrigger:()=>ei,Input:()=>ti,Label:()=>ni,Root:()=>ai,RootProvider:()=>si,Scrubber:()=>ci,ValueText:()=>li}),[di,fi]=je({name:`RadioGroupContext`,hookName:`useRadioGroupContext`,providerName:`<RadioGroupProvider />`}),pi=e=>e.children(fi()),mi=(0,Y.forwardRef)((e,t)=>{let n=h(fi().getIndicatorProps(),e);return(0,J.jsx)(E.div,{...n,ref:t})});mi.displayName=`RadioGroupIndicator`;var[hi,gi]=je({name:`RadioGroupItemContext`,hookName:`useRadioGroupItemContext`,providerName:`<RadioGroupItemProvider />`}),[_i,vi]=je({name:`RadioGroupItemPropsContext`,hookName:`useRadioGroupItemPropsContext`,providerName:`<RadioGroupItemPropsProvider />`}),yi=u(),bi=(0,Y.forwardRef)((e,t)=>{let[n,r]=yi(e,[`value`,`disabled`,`invalid`]),i=fi(),a=h(i.getItemProps(n),r);return(0,J.jsx)(hi,{value:i.getItemState(n),children:(0,J.jsx)(_i,{value:n,children:(0,J.jsx)(E.label,{...a,ref:t})})})});bi.displayName=`RadioGroupItem`;var xi=e=>e.children(gi()),Si=(0,Y.forwardRef)((e,t)=>{let n=fi(),r=vi(),i=h(n.getItemControlProps(r),e);return(0,J.jsx)(E.div,{...i,ref:t})});Si.displayName=`RadioGroupItemControl`;var Ci=(0,Y.forwardRef)((e,t)=>{let n=fi(),r=vi(),i=h(n.getItemHiddenInputProps(r),e);return(0,J.jsx)(E.input,{...i,ref:t})});Ci.displayName=`RadioGroupItemHiddenInput`;var wi=(0,Y.forwardRef)((e,t)=>{let n=fi(),r=vi(),i=h(n.getItemTextProps(r),e);return(0,J.jsx)(E.span,{...i,ref:t})});wi.displayName=`RadioGroupItemText`;var Ti=(0,Y.forwardRef)((e,t)=>{let n=h(fi().getLabelProps(),e);return(0,J.jsx)(E.span,{...n,ref:t})});Ti.displayName=`RadioGroupLabel`;var Ei=e=>{let t=Se(),n=(0,Y.useId)(),{getRootNode:r}=Ee(),{dir:i}=Oe(),a={id:n,ids:{label:t?.ids?.legend},dir:i,disabled:t?.disabled,invalid:t?.invalid,getRootNode:r,...e};return Pr(v(Lr,a),x)},Di=u(),Oi=(0,Y.forwardRef)((e,t)=>{let[n,r]=Di(e,[`defaultValue`,`disabled`,`form`,`id`,`ids`,`invalid`,`name`,`onValueChange`,`orientation`,`readOnly`,`required`,`value`]),i=Ei(n),a=h(i.getRootProps(),r);return(0,J.jsx)(di,{value:i,children:(0,J.jsx)(E.div,{...a,ref:t})})});Oi.displayName=`RadioGroupRoot`;var ki=u(),Ai=(0,Y.forwardRef)((e,t)=>{let[{value:n},r]=ki(e,[`value`]),i=h(n.getRootProps(),r);return(0,J.jsx)(di,{value:n,children:(0,J.jsx)(E.div,{...i,ref:t})})});Ai.displayName=`RadioGroupRootProvider`;var ji=Ae({Context:()=>pi,Indicator:()=>mi,Item:()=>bi,ItemContext:()=>
7xi,ItemControl:()=>Si,ItemHiddenInput:()=>Ci,ItemText:()=>wi,Label:()=>Ti,Root:()=>Oi,RootProvider:()=>Ai}),[Mi,Ni]=je({name:`SwitchContext`,hookName:`useSwitchContext`,providerName:`<SwitchProvider />`}),Pi=e=>e.children(Ni()),Fi=(0,Y.forwardRef)((e,t)=>{let n=h(Ni().getControlProps(),e);return(0,J.jsx)(E.span,{...n,ref:t})});Fi.displayName=`SwitchControl`;var Ii=(0,Y.forwardRef)((e,t)=>{let n=h(Ni().getHiddenInputProps(),e),r=xe();return(0,J.jsx)(E.input,{"aria-describedby":r?.ariaDescribedby,...n,ref:t})});Ii.displayName=`SwitchHiddenInput`;var Li=(0,Y.forwardRef)((e,t)=>{let n=h(Ni().getLabelProps(),e);return(0,J.jsx)(E.span,{...n,ref:t})});Li.displayName=`SwitchLabel`;var Ri=e=>{let t=(0,Y.useId)(),{getRootNode:n}=Ee(),{dir:r}=Oe(),i=xe(),a={id:t,ids:{label:i?.ids.label,hiddenInput:i?.ids.control},dir:r,disabled:i?.disabled,readOnly:i?.readOnly,invalid:i?.invalid,required:i?.required,getRootNode:n,...e};return Kr(v(Jr,a),x)},zi=u(),Bi=(0,Y.forwardRef)((e,t)=>{let[n,r]=zi(e,[`checked`,`defaultChecked`,`disabled`,`form`,`id`,`ids`,`invalid`,`label`,`name`,`onCheckedChange`,`readOnly`,`required`,`value`]),i=Ri(n),a=h(i.getRootProps(),r);return(0,J.jsx)(Mi,{value:i,children:(0,J.jsx)(E.label,{...a,ref:t})})});Bi.displayName=`SwitchRoot`;var Vi=u(),Hi=(0,Y.forwardRef)((e,t)=>{let[{value:n},r]=Vi(e,[`value`]),i=h(n.getRootProps(),r);return(0,J.jsx)(Mi,{value:n,children:(0,J.jsx)(E.label,{...i,ref:t})})});Hi.displayName=`SwitchRootProvider`;var Ui=(0,Y.forwardRef)((e,t)=>{let n=h(Ni().getThumbProps(),e);return(0,J.jsx)(E.span,{...n,ref:t})});Ui.displayName=`SwitchThumb`;var Wi=Ae({Context:()=>Pi,Control:()=>Fi,HiddenInput:()=>Ii,Label:()=>Li,Root:()=>Bi,RootProvider:()=>Hi,Thumb:()=>Ui}),Q=M();function Gi(e){return Fe(Ie(e.toString()),`MMM do, yyyy`)}var Ki=e=>{let t=(0,Q.c)(31),{className:n,errorMessage:r,hideFormattedValue:i,label:a,name:o,placeholder:s}=e,{disabled:c,invalid:l,readOnly:u,valueAsString:d}=de(),f=!!r||l,p=d[0]||``,m=`${e[`data-testid`]}-control`,h;t[0]===n?h=t[1]:(h=N(`data-[placeholder-shown]:text-grey flex w-full min-w-0 cursor-pointer items-center pr-2 data-[placeholder-shown]:italic`,n),t[0]=n,t[1]=h);let g=`${e[`data-testid`]}-trigger`,_=p?a:``,v=p?a:``,y;t[2]!==f||t[3]!==c||t[4]!==u||t[5]!==v?(y=(0,J.jsx)(z.Label,{asChild:!0,children:(0,J.jsx)(Re,{disabled:c,invalid:f,readOnly:u,children:v})}),t[2]=f,t[3]=c,t[4]=u,t[5]=v,t[6]=y):y=t[6];let b;t[7]!==i||t[8]!==s||t[9]!==e?(b=i?(0,J.jsx)(`span`,{className:`text-grey truncate pr-1 pl-4 italic`,children:s}):(0,J.jsx)(z.ValueText,{className:`truncate pr-1 pl-4`,"data-testid":`${e[`data-testid`]}-trigger-display-value`,placeholder:s}),t[7]=i,t[8]=s,t[9]=e,t[10]=b):b=t[10];let x;t[11]===r?x=t[12]:(x=(0,J.jsx)(Le,{children:r}),t[11]=r,t[12]=x);let S;t[13]!==c||t[14]!==l||t[15]!==o||t[16]!==u||t[17]!==h||t[18]!==g||t[19]!==_||t[20]!==y||t[21]!==b||t[22]!==x?(S=(0,J.jsx)(z.Trigger,{asChild:!0,children:(0,J.jsxs)(Be,{className:h,"data-testid":g,disabled:c,invalid:l,label:_,name:o,readOnly:u,children:[y,b,x]})}),t[13]=c,t[14]=l,t[15]=o,t[16]=u,t[17]=h,t[18]=g,t[19]=_,t[20]=y,t[21]=b,t[22]=x,t[23]=S):S=t[23];let C=`${e[`data-testid`]}-trigger-button`,w;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,J.jsx)(He,{}),t[24]=w):w=t[24];let T;t[25]===C?T=t[26]:(T=(0,J.jsx)(me,{className:`pointer-events-none absolute top-1/2 right-1 z-1 -translate-y-1/2`,"data-testid":C,children:w}),t[25]=C,t[26]=T);let E;return t[27]!==m||t[28]!==T||t[29]!==S?(E=(0,J.jsxs)(z.Control,{className:`relative`,"data-testid":m,children:[S,T]}),t[27]=m,t[28]=T,t[29]=S,t[30]=E):E=t[30],E},qi=e=>{let t=(0,Q.c)(48),n,r,i,a,o,s,c,l,u,d,f,p;if(t[0]!==e){let{children:m,disabled:h,errorMessage:g,id:_,invalid:v,label:y,placeholder:b,portalled:x,positionerClassName:S,positioning:C,readOnly:w,withClearButton:T,...E}=e;n=m,c=h,r=g,l=v,i=y,u=b,d=x,a=S,o=C,f=w,p=T,s=E,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12];let m=c!==void 0&&c,h=l!==void 0&&l,g=u===void 0?`Select date`:u,_=d!==void 0&&d,v=f!==void 0&&f,y=p!==void 0&&p,b=!!r||h,x=s.selectionMode===`multiple`?s.hideFormattedValue??!1:!1,S;
7t[13]===o?S=t[14]:(S=o||{placement:`bottom-end`},t[13]=o,t[14]=S);let C=e[`data-testid`],w;t[15]!==r||t[16]!==x||t[17]!==i||t[18]!==g||t[19]!==e.name||t[20]!==C?(w=(0,J.jsx)(Ki,{"data-testid":C,errorMessage:r,hideFormattedValue:x,label:i,name:e.name,placeholder:g}),t[15]=r,t[16]=x,t[17]=i,t[18]=g,t[19]=e.name,t[20]=C,t[21]=w):w=t[21];let T=!_,E=_?``:`z-100!`,D;t[22]!==a||t[23]!==E?(D=N(E,`w-68`,a),t[22]=a,t[23]=E,t[24]=D):D=t[24];let O;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(O={minWidth:0},t[25]=O):O=t[25];let k;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(k=N(`flex flex-col rounded-lg bg-white p-4 shadow-lg`),t[26]=k):k=t[26];let A=`${e[`data-testid`]}-content`,j;t[27]===y?j=t[28]:(j=y?(0,J.jsx)(z.ClearTrigger,{asChild:!0,children:(0,J.jsx)(Pe,{className:`mt-4 w-full`,"data-testid":`clear-button`,variant:`secondary`,children:`Clear Selection`})}):null,t[27]=y,t[28]=j);let M;t[29]!==n||t[30]!==A||t[31]!==j?(M=(0,J.jsxs)(le,{className:k,"data-testid":A,children:[n,j]}),t[29]=n,t[30]=A,t[31]=j,t[32]=M):M=t[32];let P;t[33]!==D||t[34]!==M?(P=(0,J.jsx)(z.Positioner,{className:D,style:O,children:M}),t[33]=D,t[34]=M,t[35]=P):P=t[35];let F;t[36]!==P||t[37]!==T?(F=(0,J.jsx)(pe,{disabled:T,children:P}),t[36]=P,t[37]=T,t[38]=F):F=t[38];let I;return t[39]!==b||t[40]!==m||t[41]!==g||t[42]!==v||t[43]!==s||t[44]!==F||t[45]!==S||t[46]!==w?(I=(0,J.jsxs)(ue,{disabled:m,invalid:b,lazyMount:!0,placeholder:g,positioning:S,readOnly:v,...s,children:[w,F]}),t[39]=b,t[40]=m,t[41]=g,t[42]=v,t[43]=s,t[44]=F,t[45]=S,t[46]=w,t[47]=I):I=t[47],I},Ji=e=>{let t=(0,Q.c)(34),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({controlClassName:n,errorMessage:r,invalid:i,placeholder:s,portalled:c,positionerClassName:a,withClearButton:l,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=s===void 0?`Select date`:s,d=c!==void 0&&c,f=l!==void 0&&l,p=!!(r||i),m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m={placement:`bottom-end`},t[9]=m):m=t[9];let h;t[10]!==n||t[11]!==u||t[12]!==e?(h=(0,J.jsx)(z.Context,{children:t=>{let{disabled:r,invalid:i,readOnly:a,valueAsString:o}=t,[s]=o;return(0,J.jsx)(z.Control,{asChild:!0,children:(0,J.jsx)(z.Trigger,{asChild:!0,children:(0,J.jsx)(`button`,{className:N(`hover:border-active border-regular has-focus:border-active cursor-pointer truncate rounded border px-3 py-1.5 text-left`,a||r?`border-dashed`:``,i?`border-danger`:``,s?`text-black`:`text-grey`,n),"data-testid":`${e[`data-testid`]}-trigger`,name:e.name,type:`button`,children:s||u})})})}}),t[10]=n,t[11]=u,t[12]=e,t[13]=h):h=t[13];let g=!d,_=d?``:`z-100!`,v;t[14]!==a||t[15]!==_?(v=N(_,`w-68`,a),t[14]=a,t[15]=_,t[16]=v):v=t[16];let y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y={minWidth:0},t[17]=y):y=t[17];let b=`${e[`data-testid`]}-content`,x;t[18]===f?x=t[19]:(x=f?(0,J.jsx)(z.Context,{children:Yi}):null,t[18]=f,t[19]=x);let S;t[20]!==x||t[21]!==b?(S=(0,J.jsx)(le,{className:`flex flex-col rounded-lg bg-white p-4 shadow-lg`,"data-testid":b,children:x}),t[20]=x,t[21]=b,t[22]=S):S=t[22];let C;t[23]!==S||t[24]!==v?(C=(0,J.jsx)(z.Positioner,{className:v,style:y,children:S}),t[23]=S,t[24]=v,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==g?(w=(0,J.jsx)(pe,{disabled:g,children:C}),t[26]=C,t[27]=g,t[28]=w):w=t[28];let T;return t[29]!==p||t[30]!==o||t[31]!==w||t[32]!==h?(T=(0,J.jsxs)(ue,{closeOnSelect:!0,format:Gi,invalid:p,positioning:m,...o,children:[h,w]}),t[29]=p,t[30]=o,t[31]=w,t[32]=h,t[33]=T):T=t[33],T};function Yi(e){return(0,J.jsx)(z.ClearTrigger,{asChild:!0,children:(0,J.jsx)(Pe,{className:`mt-4 w-full`,"data-testid":`clear-button`,onClick:()=>e.setOpen(!1),variant:`secondary`,children:`Clear date`})})}var Xi={input:`_input_1f9ao_2`},Zi=e=>{let t=(0,Q.c)(25),n,r,i,a,o,s,c,l;if(t[0]!==e){let{className:u,invalid:d,onBlur:f,onChange:p,onKeyDown:m,onValueChange:h,onValueCommit:g,value:_,...v}=e;n=u,r=d,i=f,a=m,o=g,l=_,s=v,c=function(e){typeof p==`function`&&p(e),typeof h==`function`&&h(e.currentTarget.value)},t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8];let u=c,d;t[9]!==i||t[10]!==o?(d=function(e){typeof i==`function`&&i(e),typeof o==`function`&&o(e.currentTarget.value)},t[9]=i,t[10]=o,t[11]=d):d=t[11];let f=d,p;t[12]===a?p=t[13]:(p=function(e){typeof a==`function`&&a(e),e.key===`Enter`&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.blur())},t[12]=a,t[13]=p);let m=p,h=r||void 0,g=r?`border-danger placeholder:text-danger hover:border-danger focus:border-danger`:``,_;t[14]!==n||t[15]!==g?(_=N(Xi.input,`placeholder:text-black-50 field-sizing-content max-w-full min-w-0 truncate border-0 bg-transparent p-0 text-inherit outline-none placeholder:italic focus:outline-none`,n,g),t[14]=n,t[15]=g,t[16]=_):_=t[16];let v=l===void 0?void 0:String(l??``),y;
7return t[17]!==f||t[18]!==u||t[19]!==m||t[20]!==s||t[21]!==h||t[22]!==_||t[23]!==v?(y=(0,J.jsx)(`input`,{"aria-invalid":h,className:_,onBlur:f,onChange:u,onKeyDown:m,spellCheck:!1,value:v,...s}),t[17]=f,t[18]=u,t[19]=m,t[20]=s,t[21]=h,t[22]=_,t[23]=v,t[24]=y):y=t[24],y},Qi=e=>{let t=(0,Q.c)(51),n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;if(t[0]!==e){let{autoComplete:_,children:v,className:y,Control:b,"data-testid":x,disabled:S,errorMessage:C,id:w,inputClassName:T,invalid:E,label:D,maxLength:O,onValueChange:k,placeholder:A,readOnly:j,...M}=e;r=_,i=v,a=y,n=b,o=x,h=S,s=C,c=T,l=E,u=D,d=O,f=k,p=A,g=j,m=M,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15];let _=h!==void 0&&h,v=g!==void 0&&g,y;t[16]===f?y=t[17]:(y=function(e){typeof f==`function`&&f(e.value)},t[16]=f,t[17]=y);let b=y,x=!!(l||s),S=!!u,C;t[18]!==r||t[19]!==x||t[20]!==o||t[21]!==_||t[22]!==c||t[23]!==d||t[24]!==p||t[25]!==S?(C=(0,J.jsx)(ui.Input,{asChild:!0,children:(0,J.jsx)(ze,{autoComplete:r,className:c,"data-testid":o,disabled:_,hasLabel:S,invalid:x,maxLength:d,placeholder:p})}),t[18]=r,t[19]=x,t[20]=o,t[21]=_,t[22]=c,t[23]=d,t[24]=p,t[25]=S,t[26]=C):C=t[26];let w;t[27]===n?w=t[28]:(w=n?(0,J.jsx)(ui.Control,{children:n}):null,t[27]=n,t[28]=w);let T;t[29]!==x||t[30]!==_||t[31]!==u||t[32]!==v?(T=(0,J.jsx)(ui.Label,{asChild:!0,children:(0,J.jsx)(Re,{disabled:_,invalid:x,readOnly:v,children:u})}),t[29]=x,t[30]=_,t[31]=u,t[32]=v,t[33]=T):T=t[33];let E;t[34]===s?E=t[35]:(E=(0,J.jsx)(Le,{children:s}),t[34]=s,t[35]=E);let D;t[36]!==i||t[37]!==a||t[38]!==x||t[39]!==_||t[40]!==u||t[41]!==v||t[42]!==C||t[43]!==w||t[44]!==T||t[45]!==E?(D=(0,J.jsxs)(Be,{className:a,disabled:_,invalid:x,label:u,readOnly:v,children:[C,w,T,E,i]}),t[36]=i,t[37]=a,t[38]=x,t[39]=_,t[40]=u,t[41]=v,t[42]=C,t[43]=w,t[44]=T,t[45]=E,t[46]=D):D=t[46];let O;return t[47]!==b||t[48]!==m||t[49]!==D?(O=(0,J.jsx)(ui.Root,{asChild:!0,onValueChange:b,...m,children:D}),t[47]=b,t[48]=m,t[49]=D,t[50]=O):O=t[50],O},$i=e=>{let t=(0,Q.c)(18),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({disabled:n,name:o,onChange:r,onValueChange:i,value:s,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=o===void 0?``:o,l;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==i?(l=function(e){n||(typeof r==`function`&&r(c,e.value),typeof i==`function`&&i(e.value))},t[7]=n,t[8]=c,t[9]=r,t[10]=i,t[11]=l):l=t[11];let u=l,d;return t[12]!==n||t[13]!==u||t[14]!==c||t[15]!==a||t[16]!==s?(d=(0,J.jsx)(ji.Root,{disabled:n,name:c,onValueChange:u,value:s,...a}),t[12]=n,t[13]=u,t[14]=c,t[15]=a,t[16]=s,t[17]=d):d=t[17],d},ea=e=>{let t=(0,Q.c)(21),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({checked:n,className:r,disabled:i,invalid:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=n?`bg-black dark:bg-white`:``,c=i?`border-black-15 dark:border-white-15 bg-black-15 dark:bg-white-15`:``,l=i&&n?`bg-black-50 dark:bg-white-50`:``,u=a?`border-danger dark:border-danger`:``,d=a&&n?`bg-red dark:bg-red`:``,f;t[6]!==r||t[7]!==s||t[8]!==c||t[9]!==l||t[10]!==u||t[11]!==d?(f=N(`relative h-5 w-5 shrink-0 rounded-full border`,`border-black-15 dark:border-white-15`,`group-hover/radio:border-black-50 dark:group-hover/radio:border-white-50`,`bg-transparent`,`focus:border-black active:border-black dark:focus:border-white dark:active:border-white`,s,c,l,u,d,r),t[6]=r,t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p=n?``:`hidden`,m;t[13]===p?m=t[14]:(m=N(`absolute top-1/2 left-1/2 h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-white dark:bg-black`,p),t[13]=p,t[14]=m);let h;t[15]===m?h=t[16]:(h=(0,J.jsx)(`i`,{className:m}),t[15]=m,t[16]=h);let g;return t[17]!==o||t[18]!==f||t[19]!==h?(g=(0,J.jsx)(`div`,{className:f,...o,children:h}),t[17]=o,t[18]=f,t[19]=h,t[20]=g):g=t[20],g},ta=e=>{let t=(0,Q.c)(7),{checked:n,disabled:r,invalid:i}=gi(),a;t[0]!==n||t[1]!==r||t[2]!==i?(a=(0,J.jsx)(ea,{checked:n,disabled:r,invalid:i}
7),t[0]=n,t[1]=r,t[2]=i,t[3]=a):a=t[3];let o;return t[4]!==e||t[5]!==a?(o=(0,J.jsx)(ji.ItemControl,{asChild:!0,...e,children:a}),t[4]=e,t[5]=a,t[6]=o):o=t[6],o},na=e=>{let t=(0,Q.c)(37),n,r,i,a,o,s,c,l,u,d;if(t[0]!==e){let{controlClassName:f,disabled:p,groupClassName:m,invalid:h,itemClassName:g,items:_,labelClassName:v,readOnly:y,required:b,value:x,...S}=e;n=f,r=p,i=m,l=h,a=g,o=_,s=v,u=y,d=x,c=S,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10];let f=l!==void 0&&l,p=u!==void 0&&u,m;t[11]===i?m=t[12]:(m=N(`flex items-center gap-6`,i),t[11]=i,t[12]=m);let h;if(t[13]!==n||t[14]!==r||t[15]!==f||t[16]!==a||t[17]!==o||t[18]!==s||t[19]!==e){let i;t[21]!==n||t[22]!==r||t[23]!==f||t[24]!==a||t[25]!==s||t[26]!==e?(i=t=>{let i=t.disabled||r;return(0,J.jsx)(he,{content:t.disabled?t.disabledMessage:``,children:(0,J.jsxs)(ji.Item,{className:N(`group/radio inline-flex cursor-pointer items-center gap-2 font-medium text-black dark:text-white`,i?`cursor-not-allowed`:`cursor-pointer`,f?`text-danger dark:text-danger`:``,a),"data-testid":t[`data-testid`]||`${e[`data-testid`]}-item-${t.value.toLocaleLowerCase()}`.replace(/\s/g,`-`),disabled:i,value:t.value,children:[(0,J.jsx)(ta,{className:n,"data-testid":t[`data-testid`]||`${e[`data-testid`]}-item-control-${t.value.toLocaleLowerCase()}`.replace(/\s/g,`-`)}),(0,J.jsx)(ji.ItemText,{className:s,children:t.label}),(0,J.jsx)(ji.ItemHiddenInput,{})]})},t.value)},t[21]=n,t[22]=r,t[23]=f,t[24]=a,t[25]=s,t[26]=e,t[27]=i):i=t[27],h=o.map(i),t[13]=n,t[14]=r,t[15]=f,t[16]=a,t[17]=o,t[18]=s,t[19]=e,t[20]=h}else h=t[20];let g;t[28]!==m||t[29]!==h?(g=(0,J.jsx)(`div`,{className:m,children:h}),t[28]=m,t[29]=h,t[30]=g):g=t[30];let _;return t[31]!==r||t[32]!==p||t[33]!==c||t[34]!==g||t[35]!==d?(_=(0,J.jsx)($i,{disabled:r,readOnly:p,value:d,...c,children:g}),t[31]=r,t[32]=p,t[33]=c,t[34]=g,t[35]=d,t[36]=_):_=t[36],_},ra=e=>{let t=(0,Q.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=N(`inline-flex cursor-pointer items-center gap-3`,r),t[4]=r,t[5]=a);let o;t[6]===i.name?o=t[7]:(o=(0,J.jsx)(Wi.HiddenInput,{name:i.name}),t[6]=i.name,t[7]=o);let s;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(s=(0,J.jsxs)(Wi.Root,{className:a,...i,children:[n,o]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=s):s=t[12],s},ia=e=>{let t=(0,Q.c)(13),{className:n,invalid:r}=e,{checked:i,disabled:a}=Ni(),o=i&&!a?`bg-green`:``,s=!i&&!a?`bg-light-grey`:``,c=a?`bg-mid-grey cursor-not-allowed`:`cursor-pointer`,l=r?`bg-red`:``,u;t[0]!==n||t[1]!==o||t[2]!==s||t[3]!==c||t[4]!==l?(u=N(`relative inline-flex h-6 w-12 items-center rounded-full transition duration-150`,o,s,c,l,n),t[0]=n,t[1]=o,t[2]=s,t[3]=c,t[4]=l,t[5]=u):u=t[5];let d=i?`translate-x-7`:`translate-x-1`,f;t[6]===d?f=t[7]:(f=N(`block h-4 w-4 transform rounded-full bg-white shadow-md transition duration-200`,d),t[6]=d,t[7]=f);let p;t[8]===f?p=t[9]:(p=(0,J.jsx)(Wi.Thumb,{className:f}),t[8]=f,t[9]=p);let m;return t[10]!==u||t[11]!==p?(m=(0,J.jsx)(Wi.Control,{className:u,children:p}),t[10]=u,t[11]=p,t[12]=m):m=t[12],m},aa=e=>{let t=(0,Q.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{disabled:i}=Ni(),a=i?`cursor-not-allowed`:`cursor-pointer`,o;t[3]!==n||t[4]!==a?(o=N(`font-medium`,a,n),t[3]=n,t[4]=a,t[5]=o):o=t[5];let s;return t[6]!==r||t[7]!==o?(s=(0,J.jsx)(Wi.Label,{className:o,...r}),t[6]=r,t[7]=o,t[8]=s):s=t[8],s},oa=e=>{let t=(0,Q.c)(25),n,r,i,a,o,s,c,l,u;if(t[0]!==e){let{controlClassName:d,invalid:f,label:p,name:m,onChange:h,onValueChange:g,..._}=e;r=d,i=f,a=p;let v=m===void 0?``:m;n=ra,o=i,s=v,c=function(e){g&&g(e.checked),h&&h(v,e.checked),typeof _.onCheckedChange==`function`&&_.onCheckedChange(e)},l=_,u=N(_.disabled?`opacity-50`:``,_.className),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9];let d;t[10]!==r||t[11]!==i?(d=(0,J.jsx)(ia,{className:r,invalid:i}
7),t[10]=r,t[11]=i,t[12]=d):d=t[12];let f;t[13]===a?f=t[14]:(f=a?(0,J.jsx)(aa,{children:a}):null,t[13]=a,t[14]=f);let p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,J.jsx)(Wi.HiddenInput,{}),t[15]=p):p=t[15];let m;return t[16]!==n||t[17]!==o||t[18]!==s||t[19]!==c||t[20]!==l||t[21]!==u||t[22]!==d||t[23]!==f?(m=(0,J.jsxs)(n,{invalid:o,name:s,onCheckedChange:c,...l,className:u,children:[d,f,p]}),t[16]=n,t[17]=o,t[18]=s,t[19]=c,t[20]=l,t[21]=u,t[22]=d,t[23]=f,t[24]=m):m=t[24],m},sa=e=>{let t=(0,Q.c)(55),n,r,i,a,o,s,c,l,u,d,f,p;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12]):({children:n,className:f,disabled:r,errorMessage:i,id:a,invalid:o,label:s,labelClassName:c,placeholder:l,readOnly:u,textareaClassName:p,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p);let m=f===void 0?``:f,h=(0,Y.useId)(),g=a||h,_=i||o?`border-danger text-danger`:``,v=u||r?`border-dashed`:``,y=!i&&!o?`border-black-15 hover:border-black-50`:``,b=!i&&!o?`dark:border-white-15 dark:hover:border-white-50`:``,x=!i&&!o?`has-[:focus]:border-black`:``,S=!i&&!o?`has-[:focus]:dark:border-white`:``,C;t[13]!==m||t[14]!==_||t[15]!==v||t[16]!==y||t[17]!==b||t[18]!==x||t[19]!==S?(C=N(`relative flex rounded-sm border`,_,v,y,b,x,S,m),t[13]=m,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S,t[20]=C):C=t[20];let w=i||o?`true`:`false`,T=s?`placeholder:focus:text-transparent dark:focus:placeholder:text-transparent`:``,E;t[21]!==T||t[22]!==p?(E=N(`h-32 resize-none`,`border-none bg-transparent`,`font-regular peer w-full flex-1 appearance-none rounded-sm px-4 py-3 text-sm outline-hidden transition-colors delay-300 placeholder:italic`,`placeholder:text-black-50 dark:placeholder:text-white-50 text-black dark:text-white`,T,p),t[21]=T,t[22]=p,t[23]=E):E=t[23];let D;t[24]!==r||t[25]!==g||t[26]!==l||t[27]!==u||t[28]!==d||t[29]!==E||t[30]!==w?(D=(0,J.jsx)(`textarea`,{"aria-invalid":w,className:E,disabled:r,placeholder:l,readOnly:u,...d,id:g}),t[24]=r,t[25]=g,t[26]=l,t[27]=u,t[28]=d,t[29]=E,t[30]=w,t[31]=D):D=t[31];let O=s?``:`!px-0`,k;t[32]===O?k=t[33]:(k=N(`pointer-events-none ml-3 h-0 overflow-hidden text-xs text-transparent duration-200`,`px-1 peer-placeholder-shown:px-0 peer-focus:px-1`,`text-xs peer-placeholder-shown:text-[0] peer-focus:text-xs`,`w-auto peer-placeholder-shown:w-0 peer-focus:w-auto`,O),t[32]=O,t[33]=k);let A;t[34]!==s||t[35]!==k?(A=(0,J.jsx)(`legend`,{className:k,children:s}),t[34]=s,t[35]=k,t[36]=A):A=t[36];let j=i||o?`border-danger text-danger`:``,M=s?`opacity-100 peer-placeholder-shown:opacity-0 peer-focus:opacity-100`:``,P=!i&&!o&&!u?`text-black-50 dark:text-white-50 peer-focus:text-black dark:peer-focus:text-white`:``,F;t[37]!==c||t[38]!==j||t[39]!==M||t[40]!==P?(F=N(c,`absolute top-0 left-4 z-10 max-w-[calc(100%-1.25rem)] -translate-y-1/2 cursor-text truncate text-xs not-italic duration-150`,`peer-placeholder-shown:top-5 peer-placeholder-shown:left-4 peer-placeholder-shown:text-sm peer-placeholder-shown:italic`,`peer-focus:top-0 peer-focus:left-4 peer-focus:text-xs peer-focus:not-italic`,j,M,P),t[37]=c,t[38]=j,t[39]=M,t[40]=P,t[41]=F):F=t[41];let I;t[42]!==g||t[43]!==s||t[44]!==F?(I=(0,J.jsx)(`label`,{className:F,htmlFor:g,title:s,children:s}),t[42]=g,t[43]=s,t[44]=F,t[45]=I):I=t[45];let L;t[46]===i?L=t[47]:(L=i?(0,J.jsx)(`p`,{className:`text-danger bg-red-light absolute top-full left-0 mt-1 max-w-full truncate rounded-sm px-1 py-0.5 text-xs`,children:i}):null,t[46]=i,t[47]=L);let R;return t[48]!==n||t[49]!==D||t[50]!==A||t[51]!==I||t[52]!==L||t[53]!==C?(R=(0,J.jsxs)(`fieldset`,{className:C,"data-focused":`false`,children:[D,A,I,L,n]}),t[48]=n,t[49]=D,t[50]=A,t[51]=I,t[52]=L,t[53]=C,t[54]=R):R=t[54],R},{fieldContext:ca,formContext:la,useFieldContext:$,useFormContext:ua}=bn(),da=o([a(),r().transform(e=>{if(Me(e))return Number(e)})]),fa=o([a(),r().transform(e=>Me(e)?Number(e):null)]),pa=o([a().min(0,`Amount must be greater or equal to 0`),r().transform(e=>{let t=Ne(e);if(typeof t==`number`)return t})]),ma=(e=`The field is required`)=>da.pipe(a().refine(e=>e!==void 0,{error:e})),ha=o([a().min(0,`Percentage must be greater or equal to 0`).max(100,`Percentage must be less or equal to 100`),r().regex(/^\d+(?:\.\d+)?%?$/,{message:`Invalid percentage format (e.g., '10%' or '10.5%')`}).refine(e=>{let t=Number(e.replace(`%`,``));return t>=0&&t<=100},{message:`Percentage must be between 0% and 100%`})]),ga=e=>{let t=(0,Q.c)(6),n=$(),r=j(n.store,La).length>0,i;return t[0]!==n.handleChange||t[1]!==n.name||t[2]!==n.state.value||t[3]!==e||t[4]!==r?(i=(0,J.jsx)(we,{checked:n.state.value,invali
7d:r,name:n.name,onCheckedValueChange:n.handleChange,...e}),t[0]=n.handleChange,t[1]=n.name,t[2]=n.state.value,t[3]=e,t[4]=r,t[5]=i):i=t[5],i},_a=(e=`Must be a valid URL`)=>r().transform(e=>e===``?``:e.startsWith(`http`)?e:`https://${e}`).refine(e=>i({hostname:n}).validate(e),{message:e});function va(e){let t=e.lastIndexOf(`.`),n=e.lastIndexOf(`[`),r=Math.max(t,n);if(!(r<=0))return e.slice(0,r)}function ya(e){let t={...e};for(let[n,r]of Object.entries(e)){let e=va(n);if(r.length>0&&e){let n=t[e];(!n||n.length===0)&&(t[e]=r)}}return t}function ba(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`?String(e):``}function xa(e){return({formApi:t})=>{let n=t.parseValuesWithSchema(e);if(!n)return;let r=ya(n.fields),i=Object.values(n.form).find(e=>e.length>0)?.[0];if(Object.keys(r).length!==0||i)return{fields:r,...i&&{form:i}}}}var Sa=e=>{let t=(0,Q.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({onValueChange:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=$(),a=j(i.store,Ra),o=a[0]?.message,s=!!a[0],c;t[3]!==i||t[4]!==n?(c=e=>{i.handleChange(e),n?.(e)},t[3]=i,t[4]=n,t[5]=c):c=t[5];let l;return t[6]!==i.name||t[7]!==i.state.value||t[8]!==r||t[9]!==o||t[10]!==s||t[11]!==c?(l=(0,J.jsx)(qi,{errorMessage:o,invalid:s,name:i.name,onValueChange:c,value:i.state.value,...r}),t[6]=i.name,t[7]=i.state.value,t[8]=r,t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12],l},Ca=e=>{let t=(0,Q.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({onChange:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=$(),a=j(i.store,za),o=a[0]?.message,s=!!a[0],c;t[3]!==i||t[4]!==n?(c=e=>{i.handleChange(e.target.value),n?.(e)},t[3]=i,t[4]=n,t[5]=c):c=t[5];let l=i.state.value??``,u;return t[6]!==i.name||t[7]!==r||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,J.jsx)(Ve,{errorMessage:o,invalid:s,name:i.name,onChange:c,value:l,...r}),t[6]=i.name,t[7]=r,t[8]=o,t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u},wa=e=>{let t=(0,Q.c)(24),n,r;if(t[0]!==e){let{onChange:i,onValueChange:a,...o}=e;n=a,r=o,t[0]=e,t[1]=n,t[2]=r}else n=t[1],r=t[2];let i=$(),a=j(i.store,Ba),o;t[3]===i.state.value?o=t[4]:(o=typeof i.state.value==`number`?i.state.value.toString():i.state.value,t[3]=i.state.value,t[4]=o);let s=o;r.formatOptions?.style;let c;bb0:{if(r.formatOptions?.style===`currency`||r.formatOptions?.style===`percent`){c=!0;break bb0}c=!1}let l=c,u;t[5]!==i||t[6]!==l?(u=function(e){l&&e.target.value===``&&i.handleChange(`0`)},t[5]=i,t[6]=l,t[7]=u):u=t[7];let d=u,f;t[8]!==i||t[9]!==s||t[10]!==l?(f=function(){let e=Ne(s);l&&e===0&&i.handleChange(``)},t[8]=i,t[9]=s,t[10]=l,t[11]=f):f=t[11];let p=f,m=a[0]?.message,h=!!a[0],g;t[12]!==i||t[13]!==n?(g=e=>{i.handleChange(e),n?.(e)},t[12]=i,t[13]=n,t[14]=g):g=t[14];let _=s??``,v;return t[15]!==i.name||t[16]!==d||t[17]!==p||t[18]!==r||t[19]!==m||t[20]!==h||t[21]!==g||t[22]!==_?(v=(0,J.jsx)(Qi,{errorMessage:m,invalid:h,name:i.name,onBlur:d,onFocus:p,onValueChange:g,value:_,...r}),t[15]=i.name,t[16]=d,t[17]=p,t[18]=r,t[19]=m,t[20]=h,t[21]=g,t[22]=_,t[23]=v):v=t[23],v},Ta=e=>{let t=(0,Q.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({onChange:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=$(),a=j(i.store,Va),o=a[0]?.message,s=!!a[0],c;t[3]!==i||t[4]!==n?(c=e=>{i.handleChange(e.target.value),n?.(e)},t[3]=i,t[4]=n,t[5]=c):c=t[5];let l;return t[6]!==i.name||t[7]!==i.state.value||t[8]!==r||t[9]!==o||t[10]!==s||t[11]!==c?(l=(0,J.jsx)(sa,{errorMessage:o,invalid:s,name:i.name,onChange:c,value:i.state.value,...r}),t[6]=i.name,t[7]=i.state.value,t[8]=r,t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12],l},Ea=e=>{let t=(0,Q.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r=$(),i=j(r.store,Ha),a=i[0]?.message,o=!!i[0],s;return t[2]!==r.handleChange||t[3]!==r.name||t[4]!==r.state.value||t[5]!==n||t[6]!==a||t[7]!==o?(s=(0,J.jsx)(ce,{errorMessage:a,invalid:o,name:r.name,onValueChange:r.handleChange,value:r.state.value,...n}),t[2]=r.handleChange,t[3]=r.name,t[4]=r.state.value,t[5]=n,t[6]=a,t[7]=o,t[8]=s):s=t[8],s},Da=e=>{let t=(0,Q.c)(14),n,r;t[0]===e?(n=t[1],r=t[2]):({onValueChange:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=$(),a=j(i.store,Ua).length>0,o=i.name,s;t[3]!==i||t[4]!==n?(s=e=>{i.handleChange(e),n?.(e)},t[3]=i,t[4]=n,t[5]=s):s=t[5];let c;t[6]===i.state.value?c=t[7]:(c=ba(i.state.value),t[6]=i.state.value,t[7]=c);let l;return t[8]!==i.name||t[9]!==r||t[10]!==a||t[11]!==s||t[12]!==c?(l=(0,J.jsx)(ae,{invalid:a,name:o,onValueChange:s,value:c,...r}),t[8]=i.name,t[9]=r,t[10]=a,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}
7,Oa=e=>{let t=(0,Q.c)(10),n;if(t[0]!==e){let{onChange:r,...i}=e;n=i,t[0]=e,t[1]=n}else n=t[1];let r=$(),i=!!j(r.store,Wa)[0],a;t[2]===r?a=t[3]:(a=e=>{r.handleChange(e)},t[2]=r,t[3]=a);let o=r.state.value||``,s;return t[4]!==r.name||t[5]!==n||t[6]!==i||t[7]!==a||t[8]!==o?(s=(0,J.jsx)(Zi,{invalid:i,name:r.name,onValueChange:a,value:o,...n}),t[4]=r.name,t[5]=n,t[6]=i,t[7]=a,t[8]=o,t[9]=s):s=t[9],s},ka=e=>{let t=(0,Q.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({checked:n,onChange:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=$(),o=n??a.state.value,s;t[4]!==a||t[5]!==r?(s=(e,t)=>{a.handleChange(t),r?.(a.name,t)},t[4]=a,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==a.name||t[9]!==i||t[10]!==s?(c=(0,J.jsx)(oa,{checked:o,name:a.name,onChange:s,...i}),t[7]=o,t[8]=a.name,t[9]=i,t[10]=s,t[11]=c):c=t[11],c},Aa=e=>{let t=(0,Q.c)(8),n=$(),r=j(n.store,Ga).length>0,i=n.name,a=n.handleChange,o;t[0]===n.state.value?o=t[1]:(o=ba(n.state.value),t[0]=n.state.value,t[1]=o);let s;return t[2]!==n.handleChange||t[3]!==n.name||t[4]!==e||t[5]!==r||t[6]!==o?(s=(0,J.jsx)(na,{invalid:r,name:i,onValueChange:a,value:o,...e}),t[2]=n.handleChange,t[3]=n.name,t[4]=e,t[5]=r,t[6]=o,t[7]=s):s=t[7],s};function ja(e){return typeof e==`string`?e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`?e.message:String(e)}function Ma(e){let t=Object.entries(e.fields).reduce((e,[t,n])=>(n.errors.length>0&&(e[t]=n.errors.map(ja)),e),{}),n=e.form.errors.map(ja);Object.keys(t).length!==0||n.length}var{useAppForm:Na,withFieldGroup:Pa}=xn({fieldComponents:{CheckboxBoolean:ga,Combobox:Ea,DatePickerInput:Sa,Editable:Oa,Input:Ca,NumberInput:wa,RadioGroup:Aa,Select:Da,Switch:ka,Textarea:Ta},fieldContext:ca,formComponents:{},formContext:la});function Fa(e,t){let n=(0,Q.c)(16),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({onSubmitInvalid:r,validators:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===t?o=n[5]:(o=t?xa(t):void 0,n[4]=t,n[5]=o);let s=o,c;n[6]===r?c=n[7]:(c=e=>{let{formApi:t,value:n}=e,i=t.getAllErrors();console.log(`🚨 ~ form values:`,n),console.log(`🚨 ~ validation errors:`,i),Ma(i);let a=Object.entries(i.fields).find(Ia)?.[0];a&&document.querySelector(`[name="${a}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}),r?.(e)},n[6]=r,n[7]=c);let l;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=Rt({mode:`submit`,modeAfterSubmission:`change`}),n[8]=l):l=n[8];let u;n[9]!==s||n[10]!==a?(u={onDynamic:s,...a},n[9]=s,n[10]=a,n[11]=u):u=n[11];let d;return n[12]!==i||n[13]!==c||n[14]!==u?(d={...i,onSubmitInvalid:c,validationLogic:l,validators:u},n[12]=i,n[13]=c,n[14]=u,n[15]=d):d=n[15],Na(d)}function Ia(e){let[,t]=e;return typeof t==`object`&&!!t&&`errors`in t&&Array.isArray(t.errors)&&t.errors.length>0}function La(e){return e.meta.errors}function Ra(e){return e.meta.errors}function za(e){return e.meta.errors}function Ba(e){return e.meta.errors}function Va(e){return e.meta.errors}function Ha(e){return e.meta.errors}function Ua(e){return e.meta.errors}function Wa(e){return e.meta.errors}function Ga(e){return e.meta.errors}export{ut as C,on as S,rt as T,Zi as _,ua as a,ji as b,da as c,oa as d,na as f,Qi as g,$i as h,Fa as i,ha as l,ea as m,ma as n,Pa as o,ta as p,_a as r,fa as s,pa as t,sa as u,qi as v,V as w,fi as x,Ji as y};
8//# sourceMappingURL=useAppFrom-BYhw6TDB.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.