1import{bX as O,bY as X,r as L,j,bZ as C,bO as ft}from"./main-43ZfK9y9.js";var mt=class{constructor(t,r){this.fn=t,this.options=r,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...i)=>{const a=Date.now()-this.lastExecutionTime;if(this.options.leading&&a>=this.options.wait)this.execute(...i);else if(this.lastArgs=i,!this.timeoutId&&this.options.trailing){const u=this.options.wait-a;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},u)}},this.execute=(...i)=>{this.fn(...i),this.options.onExecute?.(i,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function vt(t,r){return new mt(t,r).maybeExecute}class gt{#a=!0;#e;#t;#c;#i;#o;#s;#l;#h=0;#m=5;#n=!1;#u=!1;#r=null;#f=()=>{this.debugLog("Connected to event bus"),this.#o=!0,this.#n=!1,this.debugLog("Emitting queued events",this.#i),this.#i.forEach(r=>this.emitEventToBus(r)),this.#i=[],this.stopConnectLoop(),this.#t().removeEventListener("tanstack-connect-success",this.#f)};#d=()=>{if(this.#h<this.#m){this.#h++,this.dispatchCustomEvent("tanstack-connect",{});return}this.#t().removeEventListener("tanstack-connect",this.#d),this.#u=!0,this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()};#v=()=>{this.#n||(this.#n=!0,this.#t().addEventListener("tanstack-connect-success",this.#f),this.#d())};constructor({pluginId:r,debug:i=!1,enabled:a=!0,reconnectEveryMs:u=300}){this.#e=r,this.#a=a,this.#t=this.getGlobalTarget,this.#c=i,this.debugLog(" Initializing event subscription for plugin",this.#e),this.#i=[],this.#o=!1,this.#u=!1,this.#s=null,this.#l=u}startConnectLoop(){this.#s!==null||this.#o||(this.debugLog(`Starting connect loop (every ${this.#l}ms)`),this.#s=setInterval(this.#d,this.#l))}stopConnectLoop(){this.#n=!1,this.#s!==null&&(clearInterval(this.#s),this.#s=null,this.#i=[],this.debugLog("Stopped connect loop"))}debugLog(...r){this.#c&&console.log(`ð´ [tanstack-devtools:${this.#e}-plugin]`,...r)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const r=typeof EventTarget<"u"?new EventTarget:void 0;return typeof r>"u"||typeof r.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),r)}getPluginId(){return this.#e}dispatchCustomEventShim(r,i){try{const a=new Event(r,{detail:i});this.#t().dispatchEvent(a)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(r,i){try{this.#t().dispatchEvent(new CustomEvent(r,{detail:i}))}catch{this.dispatchCustomEventShim(r,i)}}emitEventToBus(r){this.debugLog("Emitting event to client bus",r),this.dispatchCustomEvent("tanstack-dispatch-event",r)}createEventPayload(r,i){return{type:`${this.#e}:${r}`,payload:i,pluginId:this.#e}}emit(r,i){if(!this.#a){this.debugLog("Event bus client is disabled, not emitting event",r,i);return}if(this.#r&&(this.debugLog("Emitting event to internal event target",r,i),this.#r.dispatchEvent(new CustomEvent(`${this.#e}:${r}`,{detail:this.createEventPayload(r,i)}))),this.#u){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!this.#o){this.debugLog("Bus not available, will be pushed as soon as connected"),this.#i.push(this.createEventPayload(r,i)),typeof CustomEvent<"u"&&!this.#n&&(this.#v(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(r,i))}on(r,i,a){const u=a?.withEventTarget??!1,e=`${this.#e}:${r}`;if(u&&(this.#r||(this.#r=new EventTarget),this.#r.addEventListener(e,l=>{i(l.detail)})),!this.#a)return this.debugLog("Event bus client is disabled, not registering event",e),()=>{};const s=l=>{this.debugLog("Received event from bus",l.detail),i(l.detail)};return this.#t().addEventListener(e,s),this.debugLog("Registered event to bus",e),()=>{u&&this.#r?.removeEventListener(e,s),this.#t().removeEventListener(e,s)}}onAll(r){if(!this.#a)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const i=a=>{const u=a.detail;r(u)};return this.#t().addEventListener("tanstack-devtools-global",i),()=>this.#t().removeEventListener("tanstack-devtools-global",i)}onAllPluginEvents(r){if(!this.#a)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const i=a=>{const u=a.detail;this.#e&&u.pluginId!==this.#e||r(u)};return this.#t().addEventListener("tanstack-devtools-global",i),()=>this.#t().removeEventListener("tanstack-devtools-global",i)}}class Mt extends gt{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const w=new Mt;function J(t,r){return typeof t=="function"?t(r):t}function U(t,r){return st(r).reduce((a,u)=>{if(a===null)return null;if(typeof a<"u")return a[u]},t)}function W(t,r,i){const a=st(r);function u(e){if(!a.length)return J(i,e);const s=a.shift();if(typeof s=="string"||typeof s=="number"&&!Array.isArray(e))return typeof e=="object"?(e===null&&(e={}),{...e,[s]:u(e[s])}):{[s]:u()};if(Array.isArray(e)&&typeof s=="number"){const l=e.slice(0,s);return[...l.length?l:new Array(s),u(e[s]),...e.slice(s+1)]}return[...new Array(s),u()]}return u(t)}function bt(t,r){const i=st(r);function a(u){if(!u)return;if(i.length===1){const s=i[0];if(Array.isArray(u)&&typeof s=="number")return u.filter((c,d)=>d!==s);const{[s]:l,...n}=u;return n}const e=i.shift();if((typeof e=="string"||typeof e=="number"&&!Array.isArray(u))&&typeof u=="object")return{...u,[e]:a(u[e])};if(typeof e=="number"&&Array.isArray(u)){if(e>=u.length)return u;const s=u.slice(0,e);return[...s.length?s:new Array(e),a(u[e]),...u.slice(e+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return a(t)}const pt=/^(\d+)$/gm,yt=/\.(\d+)(?=\.)/gm,St=/^(\d+)\./gm,Ft=/\.(\d+$)/gm,Vt=/\.{2,}/gm,tt="__int__",x=`${tt}$1`;function st(t){if(Array.isArray(t))return[...t];if(typeof t!="string")throw new Error("Path must be a string.");return t.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(pt,x).replace(yt,`.${x}.`).replace(St,`${x}.`).replace(Ft,`.${x}`).replace(Vt,".").split(".").map(r=>{if(r.startsWith(tt)){const i=r.substring(tt.length),a=parseInt(i,10);return String(a)===i?a:i}return r})}function Et(t){return!(Array.isArray(t)&&t.length===0)}function et(t,r){const i=a=>
1a.validators.filter(Boolean).map(u=>({cause:u.cause,validate:u.fn}));return r.validationLogic({form:r.form,validators:r.validators,event:{type:t,async:!1},runValidation:i})}function it(t,r){const{asyncDebounceMs:i}=r,{onBlurAsyncDebounceMs:a,onChangeAsyncDebounceMs:u,onDynamicAsyncDebounceMs:e}=r.validators||{},s=i??0,l=n=>n.validators.filter(Boolean).map(c=>{const d=c?.cause||t;let o=s;switch(d){case"change":o=u??s;break;case"blur":o=a??s;break;case"dynamic":o=e??s;break;case"submit":o=0;break}return t==="submit"&&(o=0),{cause:d,validate:c.fn,debounceMs:o}});return r.validationLogic({form:r.form,validators:r.validators,event:{type:t,async:!0},runValidation:l})}const H=t=>!!t&&typeof t=="object"&&"fields"in t;function D(t,r){if(Object.is(t,r))return!0;if(typeof t!="object"||t===null||typeof r!="object"||r===null)return!1;if(t instanceof Date&&r instanceof Date)return t.getTime()===r.getTime();if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(const[u,e]of t)if(!r.has(u)||!Object.is(e,r.get(u)))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(const u of t)if(!r.has(u))return!1;return!0}const i=Object.keys(t),a=Object.keys(r);if(i.length!==a.length)return!1;for(const u of i)if(!a.includes(u)||!D(t[u],r[u]))return!1;return!0}const rt=({newFormValidatorError:t,isPreviousErrorFromFormValidator:r,previousErrorValue:i})=>t?{newErrorValue:t,newSource:"form"}:r?{newErrorValue:void 0,newSource:void 0}:i?{newErrorValue:i,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},at=({formLevelError:t,fieldLevelError:r})=>r?{newErrorValue:r,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function F(t,r){return t==null?r:{...t,...r}}let B=256;const Y=[];let z;for(;B--;)Y[B]=(B+256).toString(16).substring(1);function dt(){let t=0,r,i="";if(!z||B+16>256){for(z=new Array(256),t=256;t--;)z[t]=256*Math.random()|0;t=0,B=0}for(;t<16;t++)r=z[B+t],t===6?i+=Y[r&15|64]:t===8?i+=Y[r&63|128]:i+=Y[r],t&1&&t>1&&t<11&&(i+="-");return B++,i}const At=vt(t=>w.emit("form-state",{id:t.formId,state:t.store.state}),{wait:300});function N(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){const i=[];for(let a=0;a<t.length;a++)i[a]=N(t[a]);return i}if(t instanceof Map){const i=new Map;return t.forEach((a,u)=>{i.set(u,N(a))}),i}if(t instanceof Set){const i=new Set;return t.forEach(a=>{i.add(N(a))}),i}const r={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=N(t[i]));return r}const P=t=>{if(!t.validators)return t.runValidation({validators:[],form:t.form});const r=t.event.async,i=r?void 0:{fn:t.validators.onMount,cause:"mount"},a={fn:r?t.validators.onChangeAsync:t.validators.onChange,cause:"change"},u={fn:r?t.validators.onBlurAsync:t.validators.onBlur,cause:"blur"},e={fn:r?t.validators.onSubmitAsync:t.validators.onSubmit,cause:"submit"},s=r?void 0:{fn:()=>{},cause:"server"};switch(t.event.type){case"mount":return t.runValidation({validators:[i],form:t.form});case"submit":return t.runValidation({validators:[a,u,e,s],form:t.form});case"server":return t.runValidation({validators:[],form:t.form});case"blur":return t.runValidation({validators:[u,s],form:t.form});case"change":return t.runValidation({validators:[a,s],form:t.form});default:throw new Error(`Unknown validation event type: ${t.event.type}`)}};function wt(t,r){const i=new Map;for(const a of t){const u=a.path??[];let e=r,s="";for(let l=0;l<u.length;l++){const n=u[l];
1if(n===void 0)continue;const c=typeof n=="object"?n.key:n,d=Number(c);Array.isArray(e)&&!Number.isNaN(d)?s+=`[${d}]`:s+=(l>0?".":"")+String(c),typeof e=="object"&&e!==null?e=e[c]:e=void 0}i.set(s,(i.get(s)??[]).concat(a))}return Object.fromEntries(i)}const nt=(t,r)=>{const i=wt(t,r);return{form:i,fields:i}},R={validate({value:t,validationSource:r},i){const a=i["~standard"].validate(t);if(a instanceof Promise)throw new Error("async function passed to sync validator");if(a.issues)return r==="field"?a.issues:nt(a.issues,t)},async validateAsync({value:t,validationSource:r},i){const a=await i["~standard"].validate(t);if(a.issues)return r==="field"?a.issues:nt(a.issues,t)}},ct=t=>!!t&&"~standard"in t,_={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function q(t){function r(d,o,m){const h=s(d,o,"move",m),f=Math.min(o,m),v=Math.max(o,m);for(let g=f;g<=v;g++)h.push(e(d,g));const M=Object.keys(t.fieldInfo).reduce((g,S)=>(S.startsWith(e(d,o))&&g.set(S,t.getFieldMeta(S)),g),new Map);n(h,o<m?"up":"down"),Object.keys(t.fieldInfo).filter(g=>g.startsWith(e(d,m))).forEach(g=>{const S=g.replace(e(d,m),e(d,o)),b=M.get(S);b&&t.setFieldMeta(g,b)})}function i(d,o){const m=s(d,o,"remove");n(m,"up")}function a(d,o,m){s(d,o,"swap",m).forEach(f=>{if(!f.toString().startsWith(e(d,o)))return;const v=f.toString().replace(e(d,o),e(d,m)),[M,g]=[t.getFieldMeta(f),t.getFieldMeta(v)];M&&t.setFieldMeta(v,M),g&&t.setFieldMeta(f,g)})}function u(d,o){const m=s(d,o,"insert");n(m,"down"),m.forEach(h=>{h.toString().startsWith(e(d,o))&&t.setFieldMeta(h,c())})}function e(d,o){return`${d}[${o}]`}function s(d,o,m,h){const f=[e(d,o)];switch(m){case"swap":f.push(e(d,h));break;case"move":{const[v,M]=[Math.min(o,h),Math.max(o,h)];for(let g=v;g<=M;g++)f.push(e(d,g));break}default:{const v=t.getFieldValue(d),M=Array.isArray(v)?v.length:0;for(let g=o+1;g<M;g++)f.push(e(d,g));break}}return Object.keys(t.fieldInfo).filter(v=>f.some(M=>v.startsWith(M)))}function l(d,o){return d.replace(/\[(\d+)\]/,(m,h)=>{const f=parseInt(h,10);return`[${o==="up"?f+1:Math.max(0,f-1)}]`})}function n(d,o){(o==="up"?d:[...d].reverse()).forEach(h=>{const f=l(h.toString(),o),v=t.getFieldMeta(f);v?t.setFieldMeta(h,v):t.setFieldMeta(h,c())})}const c=()=>_;return{handleArrayMove:r,handleArrayRemove:i,handleArraySwap:a,handleArrayInsert:u}}function Q(t){return{values:t.values??{},errorMap:t.errorMap??{},fieldMetaBase:t.fieldMetaBase??{},isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1,validationMetaMap:t.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class ot{constructor(r){this.options={},this.fieldInfo={},this.mount=()=>{const e=this.store.subscribe(()=>{At(this)}),s=w.on("request-form-state",o=>{o.payload.id===this._formId&&w.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),l=w.on("request-form-reset",o=>{o.payload.id===this._formId&&this.reset()}),n=w.on("request-form-force-submit",o=>{o.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),c=()=>{n(),l(),s(),e.unsubscribe(),w.emit("form-unmounted",{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});const{onMount:d}=this.options.validators||{};return w.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),d&&this.validateSync("mount"),c},this.update=e=>{if(!e)return;const s=this.options;this.options=e;const l=e.defaultValues&&!D(e.defaultValues,s.defaultValues)&&!this.state.isTouched,n=!D(e.defaultState,s.defaultState)&&!this.state.isTouched;!l&&!n||(O(()=>{this.baseStore.setState(()=>Q(Object.assign({},this.state,n?e.defaultState:{},l?{values:e.defaultValues}:{})))}),w.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(e,s)=>{const{fieldMeta:l}=this.state,n=this.resetFieldMeta(l);e&&!s?.keepDefaultValues&&(this.options={...this.options,defaultValues:e}),this.baseStore.setState(()=>Q({...this.options.defaultState,values:e??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:n}))},this.validateAllFields=async e=>{const s=[];return O(()=>
1{Object.values(this.fieldInfo).forEach(n=>{if(!n.instance)return;const c=n.instance;s.push(Promise.resolve().then(()=>c.validate(e,{skipFormValidation:!0}))),n.instance.state.meta.isTouched||n.instance.setMeta(d=>({...d,isTouched:!0}))})}),(await Promise.all(s)).flat()},this.validateArrayFieldsStartingFrom=async(e,s,l)=>{const n=this.getFieldValue(e),c=Array.isArray(n)?Math.max(n.length-1,0):null,d=[`${e}[${s}]`];for(let f=s+1;f<=(c??0);f++)d.push(`${e}[${f}]`);const o=Object.keys(this.fieldInfo).filter(f=>d.some(v=>f.startsWith(v))),m=[];return O(()=>{o.forEach(f=>{m.push(Promise.resolve().then(()=>this.validateField(f,l)))})}),(await Promise.all(m)).flat()},this.validateField=(e,s)=>{const l=this.fieldInfo[e]?.instance;if(!l){const{hasErrored:n}=this.validateSync(s);return n&&!this.options.asyncAlways?this.getFieldMeta(e)?.errors??[]:this.validateAsync(s).then(()=>this.getFieldMeta(e)?.errors??[])}return l.state.meta.isTouched||l.setMeta(n=>({...n,isTouched:!0})),l.validate(s)},this.validateSync=e=>{const s=et(e,{...this.options,form:this,validationLogic:this.options.validationLogic||P});let l=!1;const n={};return O(()=>{for(const o of s){if(!o.validate)continue;const m=this.runValidator({validate:o.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:h,fieldErrors:f}=Z(m),v=K(o.cause),M=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(f||{})]);for(const g of M){if(this.baseStore.state.fieldMetaBase[g]===void 0&&!f?.[g])continue;const S=this.getFieldMeta(g)??_,{errorMap:b,errorSourceMap:y}=S,V=f?.[g],{newErrorValue:I,newSource:k}=rt({newFormValidatorError:V,isPreviousErrorFromFormValidator:y?.[v]==="form",previousErrorValue:b?.[v]});k==="form"&&(n[g]={...n[g],[v]:V}),b?.[v]!==I&&this.setFieldMeta(g,(A=_)=>({...A,errorMap:{...A.errorMap,[v]:I},errorSourceMap:{...A.errorSourceMap,[v]:k}}))}this.state.errorMap?.[v]!==h&&this.baseStore.setState(g=>({...g,errorMap:{...g.errorMap,[v]:h}})),(h||f)&&(l=!0)}const c=K("submit");this.state.errorMap?.[c]&&e!=="submit"&&!l&&this.baseStore.setState(o=>({...o,errorMap:{...o.errorMap,[c]:void 0}}));const d=K("server");this.state.errorMap?.[d]&&e!=="server"&&!l&&this.baseStore.setState(o=>({...o,errorMap:{...o.errorMap,[d]:void 0}}))}),{hasErrored:l,fieldsErrorMap:n}},this.validateAsync=async e=>{const s=it(e,{...this.options,form:this,validationLogic:this.options.validationLogic||P});this.state.isFormValidating||this.baseStore.setState(o=>({...o,isFormValidating:!0}));const l=[];let n;for(const o of s){if(!o.validate)continue;const m=K(o.cause);this.state.validationMetaMap[m]?.lastAbortController.abort();const f=new AbortController;this.state.validationMetaMap[m]={lastAbortController:f},l.push(new Promise(async v=>{let M;try{M=await new Promise((y,V)=>{setTimeout(async()=>{if(f.signal.aborted)return y(void 0);try{y(await this.runValidator({validate:o.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:f.signal},type:"validateAsync"}))}catch(I){V(I)}},o.debounceMs)})}catch(y){M=y}const{formError:g,fieldErrors:S}=Z(M);S&&(n=n?{...n,...S}:S);const b=K(o.cause);for(const y of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[y]===void 0)continue;const V=this.getFieldMeta(y);if(!V)continue;const{errorMap:I,errorSourceMap:k}=V,A=n?.[y],{newErrorValue:E,newSource:p}=rt({newFormValidatorError:A,isPreviousErrorFromFormValidator:k?.[b]==="form",previousErrorValue:I?.[b]});I?.[b]!==E&&this.setFieldMeta(y,T=>({...T,errorMap:{...T.errorMap,[b]:E},errorSourceMap:{...T.errorSourceMap,[b]:p}}))}this.baseStore.setState(y=>({...y,errorMap:{...y.errorMap,[b]:g}})),v(n?{fieldErrors:n,errorMapKey:b}:void 0)}))}let c=[];const d={};if(l.length){c=await Promise.all(l);for(const o of c)if(o?.fieldErrors){const{errorMapKey:m}=o;for(const[h,f]of Object.entries(o.fieldErrors)){const M={...d[h]||{},[m]:f};d[h]=M}}}return this.baseStore.setState(o=>({...o,isFormValidating:!1})),d},this.validate=e=>{const{hasErrored:s,fieldsErrorMap:l}=this.validateSync(e);return s&&!this.options.asyncAlways?l:this.validateAsync(e)},this._handleSubmit=async e=>{this.baseStore.setState(n=>({...n,isSubmitted:!1,submissionAttempts:n.submissionAttempts+1,isSubmitSuccessful:!1})),O(()=>
1{Object.values(this.fieldInfo).forEach(n=>{n.instance&&(n.instance.state.meta.isTouched||n.instance.setMeta(c=>({...c,isTouched:!0})))})});const s=e??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:s});return}this.baseStore.setState(n=>({...n,isSubmitting:!0}));const l=()=>{this.baseStore.setState(n=>({...n,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){l(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:s}),w.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(n=>n.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){l(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:s}),w.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}O(()=>{Object.values(this.fieldInfo).forEach(n=>{n.instance?.options.listeners?.onSubmit?.({value:n.instance.state.value,fieldApi:n.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:s});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:s}),O(()=>{this.baseStore.setState(n=>({...n,isSubmitted:!0,isSubmitSuccessful:!0})),w.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),l()})}catch(n){throw this.baseStore.setState(c=>({...c,isSubmitSuccessful:!1})),w.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:n}),l(),n}},this.getFieldValue=e=>U(this.state.values,e),this.getFieldMeta=e=>this.state.fieldMeta[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,s)=>{this.baseStore.setState(l=>({...l,fieldMetaBase:{...l.fieldMetaBase,[e]:J(s,l.fieldMetaBase[e])}}))},this.resetFieldMeta=e=>Object.keys(e).reduce((s,l)=>{const n=l;return s[n]=_,s},{}),this.setFieldValue=(e,s,l)=>{const n=l?.dontUpdateMeta??!1,c=l?.dontRunListeners??!1,d=l?.dontValidate??!1;O(()=>{n||this.setFieldMeta(e,o=>({...o,isTouched:!0,isDirty:!0,errorMap:{...o?.errorMap,onMount:void 0}})),this.baseStore.setState(o=>({...o,values:W(o.values,e,s)}))}),c||this.getFieldInfo(e).instance?.triggerOnChangeListener(),d||this.validateField(e,"change")},this.deleteField=e=>{const l=[...Object.keys(this.fieldInfo).filter(n=>{const c=e.toString();return n!==c&&n.startsWith(c)}),e];this.baseStore.setState(n=>{const c={...n};return l.forEach(d=>{c.values=bt(c.values,d),delete this.fieldInfo[d],delete c.fieldMetaBase[d]}),c})},this.pushFieldValue=(e,s,l)=>{this.setFieldValue(e,n=>[...Array.isArray(n)?n:[],s],l)},this.insertFieldValue=async(e,s,l,n)=>{this.setFieldValue(e,d=>[...d.slice(0,s),l,...d.slice(s)],F(n,{dontValidate:!0}));const c=n?.dontValidate??!1;c||await this.validateField(e,"change"),q(this).handleArrayInsert(e,s),c||await this.validateArrayFieldsStartingFrom(e,s,"change")},this.replaceFieldValue=async(e,s,l,n)=>{this.setFieldValue(e,d=>d.map((o,m)=>m===s?l:o),F(n,{dontValidate:!0})),(n?.dontValidate??!1)||(await this.validateField(e,"change"),await this.validateArrayFieldsStartingFrom(e,s,"change"))},this.removeFieldValue=async(e,s,l)=>{const n=this.getFieldValue(e),c=Array.isArray(n)?Math.max(n.length-1,0):null;if(this.setFieldValue(e,o=>o.filter((m,h)=>h!==s),F(l,{dontValidate:!0})),q(this).handleArrayRemove(e,s),c!==null){const o=`${e}[${c}]`;this.deleteField(o)}(l?.dontValidate??!1)||(await this.validateField(e,"change"),await this.validateArrayFieldsStartingFrom(e,s,"change"))},this.swapFieldValues=(e,s,l,n)=>{this.setFieldValue(e,d=>{const o=d[s],m=d[l];return W(W(d,`${s}`,m),`${l}`,o)},F(n,{dontValidate:!0})),q(this).handleArraySwap(e,s,l),(n?.dontValidate??!1)||(this.validateField(e,"change"),this.validateField(`${e}[${s}]`,"change"),this.validateField(`${e}[${l}]`,"change"))},this.moveFieldValues=(e,s,l,n)=>{this.setFieldValue(e,d=>{const o=[...d];return o.splice(l,0,o.splice(s,1)[0]),o},F(n,{dontValidate:!0})),q(this).handleArrayMove(e,s,l),(n?.dontValidate??!1)||(this.validateField(e,"change"),this.validateField(`${e}[${s}]`,"change"),this.validateField(`${e}[${l}]`,"change"))},this.clearFieldValues=(e,s)=>{const l=this.getFieldValue(e),n=Array.isArray(l)?Math.max(l.length-1,0):null;if(this.setFieldValue(e,[],F(s,{dontValidate:!0})),n!==null)for(let d=0;d<=n;d++){const o=`${e}[${d}]`;this.deleteField(o)}(s?.dontValidate??!1)||this.validateField(e,"change")},this.resetField=e=>{this.baseStore.setState(s=>({...s,fieldMetaBase:{...s.fieldMetaBase,[e]:_},values:this.options.defaultValues?W(s.values,e,U(this.options.defaultValues,e)):s.values}))},this.setErrorMap=e=>{O(()=>{Object.entries(e).forEach(([s,l])=>{const n=s;
1if(H(l)){const{formError:c,fieldErrors:d}=Z(l);for(const o of Object.keys(this.fieldInfo))this.getFieldMeta(o)&&this.setFieldMeta(o,h=>({...h,errorMap:{...h.errorMap,[n]:d?.[o]},errorSourceMap:{...h.errorSourceMap,[n]:"form"}}));this.baseStore.setState(o=>({...o,errorMap:{...o.errorMap,[n]:c}}))}else this.baseStore.setState(c=>({...c,errorMap:{...c.errorMap,[n]:l}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((e,[s,l])=>(Object.keys(l).length&&l.errors.length&&(e[s]={errors:l.errors,errorMap:l.errorMap}),e),{})}),this.parseValuesWithSchema=e=>R.validate({value:this.state.values,validationSource:"form"},e),this.parseValuesWithSchemaAsync=e=>R.validateAsync({value:this.state.values,validationSource:"form"},e),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=r?.formId??dt(),this._devtoolsSubmissionOverride=!1;let i=Q({...r?.defaultState,values:r?.defaultValues??r?.defaultState?.values});if(r?.transform){i=r.transform({state:i}).state;for(const e of Object.keys(i.errorMap)){const s=i.errorMap[e];if(!(s===void 0||!H(s)))for(const l of Object.keys(s.fields)){const n=s.fields[l];if(n===void 0)continue;const c=i.fieldMetaBase[l];i.fieldMetaBase[l]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,...c??{},errorSourceMap:{...c?.errorSourceMap??{},onChange:"form"},errorMap:{...c?.errorMap??{},[e]:n}}}}}this.baseStore=X(i);let a;this.fieldMetaDerived=X(e=>{const s=this.baseStore.get();let l=0;const n={};for(const c of Object.keys(s.fieldMetaBase)){const d=s.fieldMetaBase[c],o=a?.fieldMetaBase[c],m=e?.[c],h=U(s.values,c);let f=m?.errors;if(!o||d.errorMap!==o.errorMap){f=Object.values(d.errorMap??{}).filter(b=>b!==void 0);const S=this.getFieldInfo(c)?.instance;(!S||!S.options.disableErrorFlat)&&(f=f.flat(1))}const v=!Et(f),M=!d.isDirty,g=D(h,U(this.options.defaultValues,c))||D(h,this.getFieldInfo(c)?.instance?.options.defaultValue);if(m&&m.isPristine===M&&m.isValid===v&&m.isDefaultValue===g&&m.errors===f&&d===o){n[c]=m,l++;continue}n[c]={...d,errors:f??[],isPristine:M,isValid:v,isDefaultValue:g}}return Object.keys(s.fieldMetaBase).length?e&&l===Object.keys(s.fieldMetaBase).length?e:(a=this.baseStore.get(),n):n});let u;this.store=X(e=>{const s=this.baseStore.get(),l=this.fieldMetaDerived.get(),n=Object.values(l).filter(Boolean),c=n.some(p=>p.isValidating),d=n.every(p=>p.isValid),o=n.some(p=>p.isTouched),m=n.some(p=>p.isBlurred),h=n.every(p=>p.isDefaultValue),f=o&&s.errorMap?.onMount,v=n.some(p=>p.isDirty),M=!v,g=!!(s.errorMap?.onMount||n.some(p=>p?.errorMap?.onMount)),S=!!c;let b=e?.errors??[];(!u||s.errorMap!==u.errorMap)&&(b=Object.values(s.errorMap).reduce((p,T)=>T===void 0?p:T&&H(T)?(p.push(T.form),p):(p.push(T),p),[]));const y=b.length===0,V=d&&y,I=this.options.canSubmitWhenInvalid??!1,k=s.submissionAttempts===0&&!o&&!g||!S&&!s.isSubmitting&&V||I;let A=s.errorMap;if(f&&(b=b.filter(p=>p!==s.errorMap.onMount),A=Object.assign(A,{onMount:void 0})),e&&u&&e.errorMap===A&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===b&&e.isFieldsValidating===c&&e.isFieldsValid===d&&e.isFormValid===y&&e.isValid===V&&e.canSubmit===k&&e.isTouched===o&&e.isBlurred===m&&e.isPristine===M&&e.isDefaultValue===h&&e.isDirty===v&&D(u,s))return e;const E={...s,errorMap:A,fieldMeta:this.fieldMetaDerived.state,errors:b,isFieldsValidating:c,isFieldsValid:d,isFormValid:y,isValid:V,canSubmit:k,isTouched:o,isBlurred:m,isPristine:M,isDefaultValue:h,isDirty:v};return u=this.baseStore.get(),E}),this.handleSubmit=this.handleSubmit.bind(this),this.update(r||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(r){return ct(r.validate)?R[r.type](r.value,r.validate):r.validate(r.value)}handleSubmit(r){return this._handleSubmit(r)}}function Z(t){if(t){if(H(t)){const r=Z(t.form).formError,i=t.fields;return{formError:r,fieldErrors:i}}return{formError:t}}return{formError:void 0}}function K(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";default:return"onChange"}}class lt{constructor(r){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const i=this.getInfo();i.instance=this,this.update(this.options);const{onMount:a}=this.options.validators||{};if(a){const u=this.runValidator({validate:a,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});u&&this.setMeta(e=>({...e,errorMap:{...e?.errorMap,onMount:u},errorSourceMap:{...e?.errorSourceMap,onMount:"field"}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{}},this.update=i=>{if(this.options=i,this.name=i.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const a=this.form.getFieldValue(this.name);D(a,i.defaultValue)||this.form.setFieldValue(this.name,i.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(i,a)=>{this.form.setFieldValue(this.name,i,F(a,{dontRunListeners:!0,dontValidate:!0})),a?.dontRunListeners||this.triggerOnChangeListener(),a?.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=i=>
1this.form.setFieldMeta(this.name,i),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(i,a)=>{this.form.pushFieldValue(this.name,i,F(a,{dontRunListeners:!0})),a?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(i,a,u)=>{this.form.insertFieldValue(this.name,i,a,F(u,{dontRunListeners:!0})),u?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(i,a,u)=>{this.form.replaceFieldValue(this.name,i,a,F(u,{dontRunListeners:!0})),u?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(i,a)=>{this.form.removeFieldValue(this.name,i,F(a,{dontRunListeners:!0})),a?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(i,a,u)=>{this.form.swapFieldValues(this.name,i,a,F(u,{dontRunListeners:!0})),u?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(i,a,u)=>{this.form.moveFieldValues(this.name,i,a,F(u,{dontRunListeners:!0})),u?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=i=>{this.form.clearFieldValues(this.name,F(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=i=>{const a=Object.values(this.form.fieldInfo),u=[];for(const e of a){if(!e.instance)continue;const{onChangeListenTo:s,onBlurListenTo:l}=e.instance.options.validators||{};i==="change"&&s?.includes(this.name)&&u.push(e.instance),i==="blur"&&l?.includes(this.name)&&u.push(e.instance)}return u},this.validateSync=(i,a)=>{const u=et(i,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||P}),s=this.getLinkedFields(i).reduce((c,d)=>{const o=et(i,{...d.options,form:d.form,validationLogic:d.form.options.validationLogic||P});return o.forEach(m=>{m.field=d}),c.concat(o)},[]);let l=!1;O(()=>{const c=(d,o)=>{const m=G(o.cause),h=o.validate?ut(d.runValidator({validate:o.validate,value:{value:d.store.state.value,validationSource:"field",fieldApi:d},type:"validate"})):void 0,f=a[m],{newErrorValue:v,newSource:M}=at({formLevelError:f,fieldLevelError:h});d.state.meta.errorMap?.[m]!==v&&d.setMeta(g=>({...g,errorMap:{...g.errorMap,[m]:v},errorSourceMap:{...g.errorSourceMap,[m]:M}})),v&&(l=!0)};for(const d of u)c(this,d);for(const d of s)d.validate&&c(d.field,d)});const n=G("submit");return this.state.meta.errorMap?.[n]&&i!=="submit"&&!l&&this.setMeta(c=>({...c,errorMap:{...c.errorMap,[n]:void 0},errorSourceMap:{...c.errorSourceMap,[n]:void 0}})),{hasErrored:l}},this.validateAsync=async(i,a)=>{const u=it(i,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||P}),e=await a,s=this.getLinkedFields(i),l=s.reduce((h,f)=>{const v=it(i,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||P});return v.forEach(M=>{M.field=f}),h.concat(v)},[]),n=[],c=[],d=u.some(h=>h.validate)||l.some(h=>h.validate);if(d){this.state.meta.isValidating||this.setMeta(h=>({...h,isValidating:!0}));for(const h of s)h.setMeta(f=>({...f,isValidating:!0}))}const o=(h,f,v)=>{const M=G(f.cause);h.getInfo().validationMetaMap[M]?.lastAbortController.abort();const S=new AbortController;this.getInfo().validationMetaMap[M]={lastAbortController:S},v.push(new Promise(async b=>{let y;try{y=await new Promise((E,p)=>{this.timeoutIds.validations[f.cause]&&clearTimeout(this.timeoutIds.validations[f.cause]),this.timeoutIds.validations[f.cause]=setTimeout(async()=>{if(S.signal.aborted)return E(void 0);try{E(await this.runValidator({validate:f.validate,value:{value:h.store.state.value,fieldApi:h,signal:S.signal,validationSource:"field"},type:"validateAsync"}))}catch(T){p(T)}},f.debounceMs)})}catch(E){y=E}if(S.signal.aborted)return b(void 0);const V=ut(y),I=e[this.name]?.[M],{newErrorValue:k,newSource:A}=at({formLevelError:I,fieldLevelError:V});h.setMeta(E=>({...E,errorMap:{...E?.errorMap,[M]:k},errorSourceMap:{...E.errorSourceMap,[M]:A}})),b(k)}))};for(const h of u)h.validate&&o(this,h,n);for(const h of l)h.validate&&o(h.field,h,c);let m=[];if((n.length||c.length)&&(m=await Promise.all(n),await Promise.all(c)),d){this.setMeta(h=>({...h,isValidating:!1}));for(const h of s)h.setMeta(f=>({...f,isValidating:!1}))}return m.filter(Boolean)},this.validate=(i,a)=>
1{if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:u}=a?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(i),{hasErrored:e}=this.validateSync(i,u[this.name]??{});if(e&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[G(i)]?.lastAbortController.abort(),this.state.meta.errors;const s=a?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(i);return this.validateAsync(i,s)},this.handleChange=i=>{this.setValue(i)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(a=>({...a,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(a=>({...a,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=i=>{this.setMeta(a=>({...a,errorMap:{...a.errorMap,...i}}))},this.parseValueWithSchema=i=>R.validate({value:this.state.value,validationSource:"field"},i),this.parseValueWithSchemaAsync=i=>R.validateAsync({value:this.state.value,validationSource:"field"},i),this.triggerOnChangeListener=()=>{const i=this.form.options.listeners?.onChangeDebounceMs;i&&i>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})},i)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});const a=this.options.listeners?.onChangeDebounceMs;a&&a>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})},a)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},this.form=r.form,this.name=r.name,this.options=r,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=X(i=>{this.form.store.get();const a=this.form.getFieldMeta(this.name)??{..._,...r.defaultMeta};let u=this.form.getFieldValue(this.name);return!a.isTouched&&u===void 0&&this.options.defaultValue!==void 0&&!D(u,this.options.defaultValue)&&(u=this.options.defaultValue),i&&i.value===u&&i.meta===a?i:{value:u,meta:a}})}get state(){return this.store.state}runValidator(r){return ct(r.validate)?R[r.type](r.value,r.validate):r.validate(r.value)}triggerOnBlurListener(){const r=this.form.options.listeners?.onBlurDebounceMs;r&&r>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})},r)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});const i=this.options.listeners?.onBlurDebounceMs;i&&i>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})},i)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}}function ut(t){if(t)return t}function G(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";default:return"onChange"}}function Lt(t,r){if(!r)return;const i=Object.assign({},t,{state:N(t.state)});r(i),i.fieldInfo!==t.fieldInfo&&(t.fieldInfo=i.fieldInfo),i.options!==t.options&&(t.options=i.options);const u=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((e,s)=>(t.state[s]!==i.state[s]&&(e[s]=i.state[s]),e),{});return O(()=>{Object.keys(u).length&&t.baseStore.setState(e=>({...e,...u})),i.state.errorMap!==t.state.errorMap&&t.setErrorMap(i.state.errorMap)}),i}const $=typeof window<"u"?L.useLayoutEffect:L.useEffect;function It(t){const[r,i]=L.useState(()=>({form:t.form,name:t.name})),[a,u]=L.useState(()=>new lt({...t}));(r.form!==t.form||r.name!==t.name)&&(u(new lt({...t})),i({form:t.form,name:t.name}));const e=C(a.store,t.mode==="array"?h=>Object.keys(h.value??[]).length:h=>h.value),s=C(a.store,h=>h.meta.isTouched),l=C(a.store,h=>h.meta.isBlurred),n=C(a.store,h=>h.meta.isDirty),c=C(a.store,h=>h.meta.errorMap),d=C(a.store,h=>h.meta.errorSourceMap),o=C(a.store,h=>h.meta.isValidating),m=L.useMemo(()=>{const f={...a,get state(){return{value:t.mode==="array"?a.state.value:e,get meta(){return{...a.state.meta,isTouched:s,isBlurred:l,isDirty:n,errorMap:c,errorSourceMap:d,isValidating:o}}}}};return f.Field=ht,f},[a,t.mode,e,s,l,n,c,d,o]);return $(a.mount,[a]),$(()=>{a.update(t)}),m}const ht=(({children:t,...r})=>{const i=It(r),a=L.useMemo(()=>J(t,i),[t,i]);return j.jsx(j.Fragment,{children:a})});function Tt(){return L.useState(()=>dt())[0]}const Ot=ft,kt=L.version.split(".")[0]==="17"?Tt:Ot.useId;function Ct({form:t,selector:r,children:i}){const a=C(t.store,r);return j.jsx(j.Fragment,{children:J(i,a)})}function Bt(t){const r=kt(),[i,a]=L.useState(t?.formId),[u,e]=L.useState(()=>new ot({...t,formId:t?.formId??r}));if(i!==t?.formId){const n=t?.formId??r;e(new ot({...t,formId:n})),a(n)}const s=L.useMemo(()=>{const n={...u,handleSubmit:((...c)=>u._handleSubmit(...c)),get formId(){return u._formId},get state(){return u.store.state}};return n.Field=function(d){return j.jsx(ht,{...d,form:u})},n.Subscribe=function(d){return j.jsx(Ct,{form:u,selector:d.selector,children:d.children})},n},[u]);$(u.mount,[]),$(()=>{u.update(t)});const l=L.useRef(!1);return $(()=>{l.current&&t?.transform&&Lt(u,t.transform)},[u,t?.transform]),$(()=>{l.current=!0}),s}export{Bt as u};
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.