@lehnihon/bit-form 2.2.10 → 2.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +17 -0
  2. package/dist/angular/index.cjs +1 -1
  3. package/dist/angular/index.js +1 -1
  4. package/dist/chunk-23IYGRVG.js +2 -0
  5. package/dist/chunk-23IYGRVG.js.map +1 -0
  6. package/dist/{chunk-NVFZ22A7.cjs → chunk-ACEJG5FJ.cjs} +2 -2
  7. package/dist/{chunk-NVFZ22A7.cjs.map → chunk-ACEJG5FJ.cjs.map} +1 -1
  8. package/dist/chunk-DRLFDQ5Z.js +2 -0
  9. package/dist/chunk-DRLFDQ5Z.js.map +1 -0
  10. package/dist/{chunk-LX4GSDUV.js → chunk-HDZV334O.js} +2 -2
  11. package/dist/{chunk-IVPCXKYW.cjs → chunk-IQVY4MNY.cjs} +2 -2
  12. package/dist/{chunk-IVPCXKYW.cjs.map → chunk-IQVY4MNY.cjs.map} +1 -1
  13. package/dist/chunk-KYX4G4YS.cjs +2 -0
  14. package/dist/chunk-KYX4G4YS.cjs.map +1 -0
  15. package/dist/chunk-NYKX3QED.js +2 -0
  16. package/dist/chunk-NYKX3QED.js.map +1 -0
  17. package/dist/{chunk-OPC7HFNN.js → chunk-RMD37PXW.js} +2 -2
  18. package/dist/{chunk-ZKAFHJPU.cjs → chunk-UFJJOXVB.cjs} +2 -2
  19. package/dist/{chunk-ZKAFHJPU.cjs.map → chunk-UFJJOXVB.cjs.map} +1 -1
  20. package/dist/chunk-VAP2C5QV.cjs +2 -0
  21. package/dist/{chunk-4RQFECC7.cjs.map → chunk-VAP2C5QV.cjs.map} +1 -1
  22. package/dist/chunk-W56UISAF.cjs +2 -0
  23. package/dist/chunk-W56UISAF.cjs.map +1 -0
  24. package/dist/{chunk-2AFWJAQG.js → chunk-YWBRZGEI.js} +2 -2
  25. package/dist/core/bindings.cjs +1 -1
  26. package/dist/core/bindings.js +1 -1
  27. package/dist/core/store.cjs +1 -1
  28. package/dist/core/store.js +1 -1
  29. package/dist/core/utils.cjs +1 -1
  30. package/dist/core/utils.d.cts +1 -1
  31. package/dist/core/utils.d.ts +1 -1
  32. package/dist/core/utils.js +1 -1
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.js +1 -1
  35. package/dist/devtools/bridge.cjs +1 -1
  36. package/dist/devtools/bridge.js +1 -1
  37. package/dist/devtools/index.cjs +2 -2
  38. package/dist/devtools/index.js +1 -1
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/react/index.cjs +1 -1
  42. package/dist/react/index.js +1 -1
  43. package/dist/react-native/index.cjs +1 -1
  44. package/dist/react-native/index.js +1 -1
  45. package/dist/utils.cjs +1 -1
  46. package/dist/utils.js +1 -1
  47. package/dist/vue/index.cjs +1 -1
  48. package/dist/vue/index.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunk-4RQFECC7.cjs +0 -2
  51. package/dist/chunk-FLFIOW75.js +0 -2
  52. package/dist/chunk-FLFIOW75.js.map +0 -1
  53. package/dist/chunk-G2FQQDRK.js +0 -2
  54. package/dist/chunk-G2FQQDRK.js.map +0 -1
  55. package/dist/chunk-GPMAT4PT.cjs +0 -2
  56. package/dist/chunk-GPMAT4PT.cjs.map +0 -1
  57. package/dist/chunk-GQ2QJCBF.js +0 -2
  58. package/dist/chunk-GQ2QJCBF.js.map +0 -1
  59. package/dist/chunk-VBX5I5XG.cjs +0 -2
  60. package/dist/chunk-VBX5I5XG.cjs.map +0 -1
  61. /package/dist/{chunk-LX4GSDUV.js.map → chunk-HDZV334O.js.map} +0 -0
  62. /package/dist/{chunk-OPC7HFNN.js.map → chunk-RMD37PXW.js.map} +0 -0
  63. /package/dist/{chunk-2AFWJAQG.js.map → chunk-YWBRZGEI.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var _chunkIVPCXKYWcjs = require('../chunk-IVPCXKYW.cjs');var _chunkQKGTVKBUcjs = require('../chunk-QKGTVKBU.cjs');require('../chunk-W5CLDRRE.cjs');var _chunk4RQFECC7cjs = require('../chunk-4RQFECC7.cjs');require('../chunk-NVFZ22A7.cjs');require('../chunk-BSGJ3T5S.cjs');require('../chunk-RHMJPKNV.cjs');require('../chunk-3KI3GEU3.cjs');require('../chunk-ZKAFHJPU.cjs');require('../chunk-VBX5I5XG.cjs');require('../chunk-PFPGASVZ.cjs');function x(){return`
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var _chunkIQVY4MNYcjs = require('../chunk-IQVY4MNY.cjs');var _chunkQKGTVKBUcjs = require('../chunk-QKGTVKBU.cjs');require('../chunk-W5CLDRRE.cjs');var _chunkVAP2C5QVcjs = require('../chunk-VAP2C5QV.cjs');require('../chunk-ACEJG5FJ.cjs');require('../chunk-BSGJ3T5S.cjs');require('../chunk-RHMJPKNV.cjs');require('../chunk-3KI3GEU3.cjs');require('../chunk-UFJJOXVB.cjs');require('../chunk-KYX4G4YS.cjs');require('../chunk-PFPGASVZ.cjs');function x(){return`
2
2
  .bit-devtools-container {
3
3
  position: fixed;
4
4
  bottom: 20px;
@@ -129,5 +129,5 @@
129
129
  <button class="bit-devtools-trigger" style="transform: ${this.isOpen?"scale(0.9)":"scale(1)"};" title="Abrir DevTools">
130
130
  ${this.isOpen?"\u2716":"Bit"}
131
131
  </button>
132
- `;this.rootElement.innerHTML=i+t}}, _class);function y(n,r=_chunk4RQFECC7cjs.a){let i=new d(n,{onUndo:o=>_optionalChain([_chunkIVPCXKYWcjs.b.call(void 0, r.stores,o), 'optionalAccess', _ => _.undo, 'call', _2 => _2()]),onRedo:o=>_optionalChain([_chunkIVPCXKYWcjs.b.call(void 0, r.stores,o), 'optionalAccess', _3 => _3.redo, 'call', _4 => _4()]),onReset:o=>_optionalChain([_chunkIVPCXKYWcjs.b.call(void 0, r.stores,o), 'optionalAccess', _5 => _5.reset, 'call', _6 => _6()])}),t=()=>_chunkIVPCXKYWcjs.a.call(void 0, r.stores);i.updateState(t());let e=r.subscribe(()=>{i.updateState(t())});return{ui:i,destroy:()=>{e(),n.innerHTML=""}}}function T(n,r="ws://localhost:3000",i){let t=new WebSocket(r),e=s=>{t.readyState===WebSocket.OPEN?t.send(JSON.stringify(s)):console.warn("[bit-form] Tentativa de envio falhou. WebSocket n\xE3o est\xE1 aberto.")},o=(s,l)=>{e({type:"ACTION",protocolVersion:1,payload:{storeId:s,action:l}})},a=new d(n,{onUndo:s=>o(s,"undo"),onRedo:s=>o(s,"redo"),onReset:s=>o(s,"reset")});return t.addEventListener("open",()=>{e({type:"HELLO",protocolVersion:1,payload:{role:"client",protocolVersion:1}}),console.log(`[bit-form] Conectado ao DevTools remoto em ${r}`)}),t.addEventListener("message",s=>{try{let l=JSON.parse(s.data);_chunkQKGTVKBUcjs.d.call(void 0, l)&&a.updateState(l.payload)}catch(l){console.error("[bit-form] Erro ao processar mensagem do WebSocket:",l)}}),t.addEventListener("error",s=>{console.error("[bit-form] Erro na conex\xE3o do DevTools remoto:",s)}),{ui:a,destroy:()=>{(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),n.innerHTML=""}}}function b(n={}){let{mode:r="local",url:i,bus:t}=n,e,o=!1;if(typeof n.container=="string"){let s=document.querySelector(n.container);if(!s)throw new Error(`[bit-form] Container '${n.container}' n\xE3o encontrado na p\xE1gina.`);e=s}else n.container instanceof HTMLElement?e=n.container:(e=document.createElement("div"),e.id="bit-form-devtools-root",e.style.position="fixed",e.style.bottom="20px",e.style.right="20px",e.style.zIndex="9999",e.style.maxHeight="80vh",e.style.overflowY="auto",e.style.boxShadow="0 10px 25px rgba(0,0,0,0.1)",document.body.appendChild(e),o=!0);let a;if(r==="local")console.log("[bit-form] DevTools iniciado em modo Local."),a=y(e,t);else if(r==="remote")console.log("[bit-form] DevTools iniciado em modo Remote."),a=T(e,i,t);else throw new Error(`[bit-form] Modo DevTools inv\xE1lido: ${r}`);return{...a,destroy:()=>{a&&typeof a.destroy=="function"&&a.destroy(),o&&e.parentNode?e.parentNode.removeChild(e):e.innerHTML=""}}}function h(n){return typeof n=="boolean"?{enabled:n,mode:"local"}:{enabled:!!n,mode:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _7 => _7.mode]), () => ("local")),url:_optionalChain([n, 'optionalAccess', _8 => _8.url])}}function D(n){return{name:"bit-devtools",setup:r=>{let i=h(_nullishCoalesce(n, () => (r.getConfig().devTools)));if(!i.enabled)return;let t=null,e=r.getConfig().bus;try{if(i.mode==="remote")t=_chunkIVPCXKYWcjs.c.call(void 0, i.url||"ws://localhost:3000",e);else{let o=b({bus:e});t=o&&typeof o.destroy=="function"?o.destroy:null}}catch (e2){}return()=>{t&&(t(),t=null)}}}}exports.DEVTOOLS_PROTOCOL_VERSION = _chunkQKGTVKBUcjs.a; exports.createDevToolsPlugin = D; exports.initDevTools = b;
132
+ `;this.rootElement.innerHTML=i+t}}, _class);function y(n,r=_chunkVAP2C5QVcjs.a){let i=new d(n,{onUndo:o=>_optionalChain([_chunkIQVY4MNYcjs.b.call(void 0, r.stores,o), 'optionalAccess', _ => _.undo, 'call', _2 => _2()]),onRedo:o=>_optionalChain([_chunkIQVY4MNYcjs.b.call(void 0, r.stores,o), 'optionalAccess', _3 => _3.redo, 'call', _4 => _4()]),onReset:o=>_optionalChain([_chunkIQVY4MNYcjs.b.call(void 0, r.stores,o), 'optionalAccess', _5 => _5.reset, 'call', _6 => _6()])}),t=()=>_chunkIQVY4MNYcjs.a.call(void 0, r.stores);i.updateState(t());let e=r.subscribe(()=>{i.updateState(t())});return{ui:i,destroy:()=>{e(),n.innerHTML=""}}}function T(n,r="ws://localhost:3000",i){let t=new WebSocket(r),e=s=>{t.readyState===WebSocket.OPEN?t.send(JSON.stringify(s)):console.warn("[bit-form] Tentativa de envio falhou. WebSocket n\xE3o est\xE1 aberto.")},o=(s,l)=>{e({type:"ACTION",protocolVersion:1,payload:{storeId:s,action:l}})},a=new d(n,{onUndo:s=>o(s,"undo"),onRedo:s=>o(s,"redo"),onReset:s=>o(s,"reset")});return t.addEventListener("open",()=>{e({type:"HELLO",protocolVersion:1,payload:{role:"client",protocolVersion:1}}),console.log(`[bit-form] Conectado ao DevTools remoto em ${r}`)}),t.addEventListener("message",s=>{try{let l=JSON.parse(s.data);_chunkQKGTVKBUcjs.d.call(void 0, l)&&a.updateState(l.payload)}catch(l){console.error("[bit-form] Erro ao processar mensagem do WebSocket:",l)}}),t.addEventListener("error",s=>{console.error("[bit-form] Erro na conex\xE3o do DevTools remoto:",s)}),{ui:a,destroy:()=>{(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),n.innerHTML=""}}}function b(n={}){let{mode:r="local",url:i,bus:t}=n,e,o=!1;if(typeof n.container=="string"){let s=document.querySelector(n.container);if(!s)throw new Error(`[bit-form] Container '${n.container}' n\xE3o encontrado na p\xE1gina.`);e=s}else n.container instanceof HTMLElement?e=n.container:(e=document.createElement("div"),e.id="bit-form-devtools-root",e.style.position="fixed",e.style.bottom="20px",e.style.right="20px",e.style.zIndex="9999",e.style.maxHeight="80vh",e.style.overflowY="auto",e.style.boxShadow="0 10px 25px rgba(0,0,0,0.1)",document.body.appendChild(e),o=!0);let a;if(r==="local")console.log("[bit-form] DevTools iniciado em modo Local."),a=y(e,t);else if(r==="remote")console.log("[bit-form] DevTools iniciado em modo Remote."),a=T(e,i,t);else throw new Error(`[bit-form] Modo DevTools inv\xE1lido: ${r}`);return{...a,destroy:()=>{a&&typeof a.destroy=="function"&&a.destroy(),o&&e.parentNode?e.parentNode.removeChild(e):e.innerHTML=""}}}function h(n){return typeof n=="boolean"?{enabled:n,mode:"local"}:{enabled:!!n,mode:_nullishCoalesce(_optionalChain([n, 'optionalAccess', _7 => _7.mode]), () => ("local")),url:_optionalChain([n, 'optionalAccess', _8 => _8.url])}}function D(n){return{name:"bit-devtools",setup:r=>{let i=h(_nullishCoalesce(n, () => (r.getConfig().devTools)));if(!i.enabled)return;let t=null,e=r.getConfig().bus;try{if(i.mode==="remote")t=_chunkIQVY4MNYcjs.c.call(void 0, i.url||"ws://localhost:3000",e);else{let o=b({bus:e});t=o&&typeof o.destroy=="function"?o.destroy:null}}catch (e2){}return()=>{t&&(t(),t=null)}}}}exports.DEVTOOLS_PROTOCOL_VERSION = _chunkQKGTVKBUcjs.a; exports.createDevToolsPlugin = D; exports.initDevTools = b;
133
133
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- import{a as g,b as c,c as v}from"../chunk-LX4GSDUV.js";import{a as p,d as u}from"../chunk-K5X37E3U.js";import"../chunk-5NA2TFPG.js";import{a as f}from"../chunk-G2FQQDRK.js";import"../chunk-2AFWJAQG.js";import"../chunk-W2E5UIXT.js";import"../chunk-UIKO6GGW.js";import"../chunk-ICYXODTQ.js";import"../chunk-OPC7HFNN.js";import"../chunk-FLFIOW75.js";import"../chunk-3NUJVIAM.js";function x(){return`
1
+ import{a as g,b as c,c as v}from"../chunk-HDZV334O.js";import{a as p,d as u}from"../chunk-K5X37E3U.js";import"../chunk-5NA2TFPG.js";import{a as f}from"../chunk-23IYGRVG.js";import"../chunk-YWBRZGEI.js";import"../chunk-W2E5UIXT.js";import"../chunk-UIKO6GGW.js";import"../chunk-ICYXODTQ.js";import"../chunk-RMD37PXW.js";import"../chunk-DRLFDQ5Z.js";import"../chunk-3NUJVIAM.js";function x(){return`
2
2
  .bit-devtools-container {
3
3
  position: fixed;
4
4
  bottom: 20px;
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-W5CLDRRE.cjs');var _chunk4RQFECC7cjs = require('./chunk-4RQFECC7.cjs');require('./chunk-NVFZ22A7.cjs');require('./chunk-BSGJ3T5S.cjs');require('./chunk-RHMJPKNV.cjs');require('./chunk-3KI3GEU3.cjs');require('./chunk-ZKAFHJPU.cjs');require('./chunk-VBX5I5XG.cjs');require('./chunk-PFPGASVZ.cjs');exports.createBitStore = _chunk4RQFECC7cjs.e; exports.createFrameworkStoreAdapter = _chunk4RQFECC7cjs.d; exports.resolveBitStoreForHooks = _chunk4RQFECC7cjs.c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-W5CLDRRE.cjs');var _chunkVAP2C5QVcjs = require('./chunk-VAP2C5QV.cjs');require('./chunk-ACEJG5FJ.cjs');require('./chunk-BSGJ3T5S.cjs');require('./chunk-RHMJPKNV.cjs');require('./chunk-3KI3GEU3.cjs');require('./chunk-UFJJOXVB.cjs');require('./chunk-KYX4G4YS.cjs');require('./chunk-PFPGASVZ.cjs');exports.createBitStore = _chunkVAP2C5QVcjs.e; exports.createFrameworkStoreAdapter = _chunkVAP2C5QVcjs.d; exports.resolveBitStoreForHooks = _chunkVAP2C5QVcjs.c;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-5NA2TFPG.js";import{c as r,d as e,e as o}from"./chunk-G2FQQDRK.js";import"./chunk-2AFWJAQG.js";import"./chunk-W2E5UIXT.js";import"./chunk-UIKO6GGW.js";import"./chunk-ICYXODTQ.js";import"./chunk-OPC7HFNN.js";import"./chunk-FLFIOW75.js";import"./chunk-3NUJVIAM.js";export{o as createBitStore,e as createFrameworkStoreAdapter,r as resolveBitStoreForHooks};
1
+ import"./chunk-5NA2TFPG.js";import{c as r,d as e,e as o}from"./chunk-23IYGRVG.js";import"./chunk-YWBRZGEI.js";import"./chunk-W2E5UIXT.js";import"./chunk-UIKO6GGW.js";import"./chunk-ICYXODTQ.js";import"./chunk-RMD37PXW.js";import"./chunk-DRLFDQ5Z.js";import"./chunk-3NUJVIAM.js";export{o as createBitStore,e as createFrameworkStoreAdapter,r as resolveBitStoreForHooks};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkGPMAT4PTcjs = require('../chunk-GPMAT4PT.cjs');var _chunkPA43XYOWcjs = require('../chunk-PA43XYOW.cjs');require('../chunk-W5CLDRRE.cjs');require('../chunk-4RQFECC7.cjs');var _chunkNVFZ22A7cjs = require('../chunk-NVFZ22A7.cjs');require('../chunk-BSGJ3T5S.cjs');var _chunkRHMJPKNVcjs = require('../chunk-RHMJPKNV.cjs');var _chunk3KI3GEU3cjs = require('../chunk-3KI3GEU3.cjs');require('../chunk-ZKAFHJPU.cjs');require('../chunk-VBX5I5XG.cjs');var _chunkPFPGASVZcjs = require('../chunk-PFPGASVZ.cjs');var _react = require('react');function y(e){let{fieldState:t,setBlur:n,store:a}=_chunkGPMAT4PTcjs.d.call(void 0, e),{fieldController:r}=_react.useMemo.call(void 0, ()=>_chunkNVFZ22A7cjs.h.call(void 0, a,e),[a,e]),u=_react.useMemo.call(void 0, ()=>r.displayValue(t.value),[t.value,r]),l=_react.useCallback.call(void 0, i=>{r.setValue(i)},[r]),{value:o}=t,s=_chunk3KI3GEU3cjs.a.call(void 0, t),p=_react.useCallback.call(void 0, i=>{let B=_chunkPFPGASVZcjs.a.call(void 0, i)?_optionalChain([i, 'access', _ => _.target, 'optionalAccess', _2 => _2.value]):i;l(B)},[l]),c=_react.useCallback.call(void 0, ()=>{n()},[n]);return{value:o,displayValue:u,setValue:l,setBlur:n,onChange:p,onBlur:c,props:{value:u,onChange:p,onBlur:c},meta:{error:s.error,touched:s.touched,invalid:s.invalid,isDirty:s.isDirty,isValidating:s.isValidating,isHidden:s.isHidden,isRequired:s.isRequired,hasError:s.hasError}}}function w(){let e=_chunkGPMAT4PTcjs.b.call(void 0, ),t=_react.useRef.call(void 0, null),n=_react.useCallback.call(void 0, ()=>{let o=_chunkRHMJPKNVcjs.f.call(void 0, e);return t.current&&t.current.canUndo===o.canUndo&&t.current.canRedo===o.canRedo&&t.current.historyIndex===o.historyIndex&&t.current.historySize===o.historySize?t.current:(t.current=o,o)},[e]),a=_react.useCallback.call(void 0, o=>e.observe.subscribeHistoryMeta(()=>o()),[e]),r=_react.useSyncExternalStore.call(void 0, a,n,n),u=_react.useCallback.call(void 0, ()=>{e.feature.undo()},[e]),l=_react.useCallback.call(void 0, ()=>{e.feature.redo()},[e]);return{...r,undo:u,redo:l}}function K(e,t,n){let a=_chunkGPMAT4PTcjs.b.call(void 0, ),r=y(e),u=_react.useRef.call(void 0, null),[l,o]=_react.useState.call(void 0, !1),s={setLoading:o,setError:(i,B)=>a.write.setError(i,B),setValue:i=>r.setValue(i),getUploadKey:()=>u.current,setUploadKey:i=>{u.current=i}},p=_react.useCallback.call(void 0, _chunkPA43XYOWcjs.a.call(void 0, e,t,s),[t,r,e,a]),c=_react.useCallback.call(void 0, _chunkPA43XYOWcjs.b.call(void 0, e,n,s),[n,r,e,a]);return{value:r.value,setValue:r.setValue,error:_optionalChain([r, 'access', _3 => _3.meta, 'optionalAccess', _4 => _4.error]),isValidating:!!_optionalChain([r, 'access', _5 => _5.meta, 'optionalAccess', _6 => _6.isValidating])||l,upload:p,remove:c}}exports.BitFormProvider = _chunkGPMAT4PTcjs.a; exports.useBitArray = _chunkGPMAT4PTcjs.e; exports.useBitField = y; exports.useBitForm = _chunkGPMAT4PTcjs.c; exports.useBitHistory = w; exports.useBitPersist = _chunkGPMAT4PTcjs.i; exports.useBitScope = _chunkGPMAT4PTcjs.f; exports.useBitSteps = _chunkGPMAT4PTcjs.g; exports.useBitStore = _chunkGPMAT4PTcjs.b; exports.useBitUpload = K; exports.useBitWatch = _chunkGPMAT4PTcjs.h;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkW56UISAFcjs = require('../chunk-W56UISAF.cjs');var _chunkPA43XYOWcjs = require('../chunk-PA43XYOW.cjs');require('../chunk-W5CLDRRE.cjs');require('../chunk-VAP2C5QV.cjs');var _chunkACEJG5FJcjs = require('../chunk-ACEJG5FJ.cjs');require('../chunk-BSGJ3T5S.cjs');var _chunkRHMJPKNVcjs = require('../chunk-RHMJPKNV.cjs');var _chunk3KI3GEU3cjs = require('../chunk-3KI3GEU3.cjs');require('../chunk-UFJJOXVB.cjs');require('../chunk-KYX4G4YS.cjs');var _chunkPFPGASVZcjs = require('../chunk-PFPGASVZ.cjs');var _react = require('react');function y(e){let{fieldState:t,setBlur:n,store:a}=_chunkW56UISAFcjs.d.call(void 0, e),{fieldController:r}=_react.useMemo.call(void 0, ()=>_chunkACEJG5FJcjs.h.call(void 0, a,e),[a,e]),u=_react.useMemo.call(void 0, ()=>r.displayValue(t.value),[t.value,r]),l=_react.useCallback.call(void 0, i=>{r.setValue(i)},[r]),{value:o}=t,s=_chunk3KI3GEU3cjs.a.call(void 0, t),p=_react.useCallback.call(void 0, i=>{let B=_chunkPFPGASVZcjs.a.call(void 0, i)?_optionalChain([i, 'access', _ => _.target, 'optionalAccess', _2 => _2.value]):i;l(B)},[l]),c=_react.useCallback.call(void 0, ()=>{n()},[n]);return{value:o,displayValue:u,setValue:l,setBlur:n,onChange:p,onBlur:c,props:{value:u,onChange:p,onBlur:c},meta:{error:s.error,touched:s.touched,invalid:s.invalid,isDirty:s.isDirty,isValidating:s.isValidating,isHidden:s.isHidden,isRequired:s.isRequired,hasError:s.hasError}}}function w(){let e=_chunkW56UISAFcjs.b.call(void 0, ),t=_react.useRef.call(void 0, null),n=_react.useCallback.call(void 0, ()=>{let o=_chunkRHMJPKNVcjs.f.call(void 0, e);return t.current&&t.current.canUndo===o.canUndo&&t.current.canRedo===o.canRedo&&t.current.historyIndex===o.historyIndex&&t.current.historySize===o.historySize?t.current:(t.current=o,o)},[e]),a=_react.useCallback.call(void 0, o=>e.observe.subscribeHistoryMeta(()=>o()),[e]),r=_react.useSyncExternalStore.call(void 0, a,n,n),u=_react.useCallback.call(void 0, ()=>{e.feature.undo()},[e]),l=_react.useCallback.call(void 0, ()=>{e.feature.redo()},[e]);return{...r,undo:u,redo:l}}function K(e,t,n){let a=_chunkW56UISAFcjs.b.call(void 0, ),r=y(e),u=_react.useRef.call(void 0, null),[l,o]=_react.useState.call(void 0, !1),s={setLoading:o,setError:(i,B)=>a.write.setError(i,B),setValue:i=>r.setValue(i),getUploadKey:()=>u.current,setUploadKey:i=>{u.current=i}},p=_react.useCallback.call(void 0, _chunkPA43XYOWcjs.a.call(void 0, e,t,s),[t,r,e,a]),c=_react.useCallback.call(void 0, _chunkPA43XYOWcjs.b.call(void 0, e,n,s),[n,r,e,a]);return{value:r.value,setValue:r.setValue,error:_optionalChain([r, 'access', _3 => _3.meta, 'optionalAccess', _4 => _4.error]),isValidating:!!_optionalChain([r, 'access', _5 => _5.meta, 'optionalAccess', _6 => _6.isValidating])||l,upload:p,remove:c}}exports.BitFormProvider = _chunkW56UISAFcjs.a; exports.useBitArray = _chunkW56UISAFcjs.e; exports.useBitField = y; exports.useBitForm = _chunkW56UISAFcjs.c; exports.useBitHistory = w; exports.useBitPersist = _chunkW56UISAFcjs.i; exports.useBitScope = _chunkW56UISAFcjs.f; exports.useBitSteps = _chunkW56UISAFcjs.g; exports.useBitStore = _chunkW56UISAFcjs.b; exports.useBitUpload = K; exports.useBitWatch = _chunkW56UISAFcjs.h;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- import{a as b,b as d,c as h,d as g,e as H,f as M,g as T,h as k,i as E}from"../chunk-GQ2QJCBF.js";import{a as v,b as S}from"../chunk-PG7ZH32Z.js";import"../chunk-5NA2TFPG.js";import"../chunk-G2FQQDRK.js";import{h as x}from"../chunk-2AFWJAQG.js";import"../chunk-W2E5UIXT.js";import{f as U}from"../chunk-UIKO6GGW.js";import{a as R}from"../chunk-ICYXODTQ.js";import"../chunk-OPC7HFNN.js";import"../chunk-FLFIOW75.js";import{a as F}from"../chunk-3NUJVIAM.js";import{useMemo as V,useCallback as f}from"react";function y(e){let{fieldState:t,setBlur:n,store:a}=g(e),{fieldController:r}=V(()=>x(a,e),[a,e]),u=V(()=>r.displayValue(t.value),[t.value,r]),l=f(i=>{r.setValue(i)},[r]),{value:o}=t,s=R(t),p=f(i=>{let B=F(i)?i.target?.value:i;l(B)},[l]),c=f(()=>{n()},[n]);return{value:o,displayValue:u,setValue:l,setBlur:n,onChange:p,onBlur:c,props:{value:u,onChange:p,onBlur:c},meta:{error:s.error,touched:s.touched,invalid:s.invalid,isDirty:s.isDirty,isValidating:s.isValidating,isHidden:s.isHidden,isRequired:s.isRequired,hasError:s.hasError}}}import{useCallback as m,useRef as C,useSyncExternalStore as I}from"react";function w(){let e=d(),t=C(null),n=m(()=>{let o=U(e);return t.current&&t.current.canUndo===o.canUndo&&t.current.canRedo===o.canRedo&&t.current.historyIndex===o.historyIndex&&t.current.historySize===o.historySize?t.current:(t.current=o,o)},[e]),a=m(o=>e.observe.subscribeHistoryMeta(()=>o()),[e]),r=I(a,n,n),u=m(()=>{e.feature.undo()},[e]),l=m(()=>{e.feature.redo()},[e]);return{...r,undo:u,redo:l}}import{useCallback as P,useRef as D,useState as j}from"react";function K(e,t,n){let a=d(),r=y(e),u=D(null),[l,o]=j(!1),s={setLoading:o,setError:(i,B)=>a.write.setError(i,B),setValue:i=>r.setValue(i),getUploadKey:()=>u.current,setUploadKey:i=>{u.current=i}},p=P(v(e,t,s),[t,r,e,a]),c=P(S(e,n,s),[n,r,e,a]);return{value:r.value,setValue:r.setValue,error:r.meta?.error,isValidating:!!r.meta?.isValidating||l,upload:p,remove:c}}export{b as BitFormProvider,H as useBitArray,y as useBitField,h as useBitForm,w as useBitHistory,E as useBitPersist,M as useBitScope,T as useBitSteps,d as useBitStore,K as useBitUpload,k as useBitWatch};
1
+ import{a as b,b as d,c as h,d as g,e as H,f as M,g as T,h as k,i as E}from"../chunk-NYKX3QED.js";import{a as v,b as S}from"../chunk-PG7ZH32Z.js";import"../chunk-5NA2TFPG.js";import"../chunk-23IYGRVG.js";import{h as x}from"../chunk-YWBRZGEI.js";import"../chunk-W2E5UIXT.js";import{f as U}from"../chunk-UIKO6GGW.js";import{a as R}from"../chunk-ICYXODTQ.js";import"../chunk-RMD37PXW.js";import"../chunk-DRLFDQ5Z.js";import{a as F}from"../chunk-3NUJVIAM.js";import{useMemo as V,useCallback as f}from"react";function y(e){let{fieldState:t,setBlur:n,store:a}=g(e),{fieldController:r}=V(()=>x(a,e),[a,e]),u=V(()=>r.displayValue(t.value),[t.value,r]),l=f(i=>{r.setValue(i)},[r]),{value:o}=t,s=R(t),p=f(i=>{let B=F(i)?i.target?.value:i;l(B)},[l]),c=f(()=>{n()},[n]);return{value:o,displayValue:u,setValue:l,setBlur:n,onChange:p,onBlur:c,props:{value:u,onChange:p,onBlur:c},meta:{error:s.error,touched:s.touched,invalid:s.invalid,isDirty:s.isDirty,isValidating:s.isValidating,isHidden:s.isHidden,isRequired:s.isRequired,hasError:s.hasError}}}import{useCallback as m,useRef as C,useSyncExternalStore as I}from"react";function w(){let e=d(),t=C(null),n=m(()=>{let o=U(e);return t.current&&t.current.canUndo===o.canUndo&&t.current.canRedo===o.canRedo&&t.current.historyIndex===o.historyIndex&&t.current.historySize===o.historySize?t.current:(t.current=o,o)},[e]),a=m(o=>e.observe.subscribeHistoryMeta(()=>o()),[e]),r=I(a,n,n),u=m(()=>{e.feature.undo()},[e]),l=m(()=>{e.feature.redo()},[e]);return{...r,undo:u,redo:l}}import{useCallback as P,useRef as D,useState as j}from"react";function K(e,t,n){let a=d(),r=y(e),u=D(null),[l,o]=j(!1),s={setLoading:o,setError:(i,B)=>a.write.setError(i,B),setValue:i=>r.setValue(i),getUploadKey:()=>u.current,setUploadKey:i=>{u.current=i}},p=P(v(e,t,s),[t,r,e,a]),c=P(S(e,n,s),[n,r,e,a]);return{value:r.value,setValue:r.setValue,error:r.meta?.error,isValidating:!!r.meta?.isValidating||l,upload:p,remove:c}}export{b as BitFormProvider,H as useBitArray,y as useBitField,h as useBitForm,w as useBitHistory,E as useBitPersist,M as useBitScope,T as useBitSteps,d as useBitStore,K as useBitUpload,k as useBitWatch};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGPMAT4PTcjs = require('../chunk-GPMAT4PT.cjs');require('../chunk-W5CLDRRE.cjs');require('../chunk-4RQFECC7.cjs');var _chunkNVFZ22A7cjs = require('../chunk-NVFZ22A7.cjs');require('../chunk-BSGJ3T5S.cjs');require('../chunk-RHMJPKNV.cjs');var _chunk3KI3GEU3cjs = require('../chunk-3KI3GEU3.cjs');require('../chunk-ZKAFHJPU.cjs');require('../chunk-VBX5I5XG.cjs');require('../chunk-PFPGASVZ.cjs');var _react = require('react');function g(i){let{fieldState:r,setBlur:o,store:l}=_chunkGPMAT4PTcjs.d.call(void 0, i),{fieldController:t}=_react.useMemo.call(void 0, ()=>_chunkNVFZ22A7cjs.h.call(void 0, l,i),[l,i]),u=_react.useMemo.call(void 0, ()=>t.displayValue(r.value),[r.value,t]),d=_react.useCallback.call(void 0, s=>t.setValue(s),[t]),F=_react.useCallback.call(void 0, s=>t.setValue(s),[t]),{value:f}=r,e=_chunk3KI3GEU3cjs.a.call(void 0, r),n=_react.useCallback.call(void 0, ()=>{o()},[o]);return{value:f,displayValue:u,setValue:F,setBlur:o,onChangeText:d,onBlur:n,meta:{error:e.error,touched:e.touched,invalid:e.invalid,isValidating:e.isValidating,isDirty:e.isDirty,isHidden:e.isHidden,isRequired:e.isRequired,hasError:e.hasError},props:{value:u,onChangeText:d,onBlur:n}}}exports.BitFormProvider = _chunkGPMAT4PTcjs.a; exports.useBitArray = _chunkGPMAT4PTcjs.e; exports.useBitField = g; exports.useBitForm = _chunkGPMAT4PTcjs.c; exports.useBitPersist = _chunkGPMAT4PTcjs.i; exports.useBitScope = _chunkGPMAT4PTcjs.f; exports.useBitSteps = _chunkGPMAT4PTcjs.g; exports.useBitStore = _chunkGPMAT4PTcjs.b; exports.useBitWatch = _chunkGPMAT4PTcjs.h;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkW56UISAFcjs = require('../chunk-W56UISAF.cjs');require('../chunk-W5CLDRRE.cjs');require('../chunk-VAP2C5QV.cjs');var _chunkACEJG5FJcjs = require('../chunk-ACEJG5FJ.cjs');require('../chunk-BSGJ3T5S.cjs');require('../chunk-RHMJPKNV.cjs');var _chunk3KI3GEU3cjs = require('../chunk-3KI3GEU3.cjs');require('../chunk-UFJJOXVB.cjs');require('../chunk-KYX4G4YS.cjs');require('../chunk-PFPGASVZ.cjs');var _react = require('react');function g(i){let{fieldState:r,setBlur:o,store:l}=_chunkW56UISAFcjs.d.call(void 0, i),{fieldController:t}=_react.useMemo.call(void 0, ()=>_chunkACEJG5FJcjs.h.call(void 0, l,i),[l,i]),u=_react.useMemo.call(void 0, ()=>t.displayValue(r.value),[r.value,t]),d=_react.useCallback.call(void 0, s=>t.setValue(s),[t]),F=_react.useCallback.call(void 0, s=>t.setValue(s),[t]),{value:f}=r,e=_chunk3KI3GEU3cjs.a.call(void 0, r),n=_react.useCallback.call(void 0, ()=>{o()},[o]);return{value:f,displayValue:u,setValue:F,setBlur:o,onChangeText:d,onBlur:n,meta:{error:e.error,touched:e.touched,invalid:e.invalid,isValidating:e.isValidating,isDirty:e.isDirty,isHidden:e.isHidden,isRequired:e.isRequired,hasError:e.hasError},props:{value:u,onChangeText:d,onBlur:n}}}exports.BitFormProvider = _chunkW56UISAFcjs.a; exports.useBitArray = _chunkW56UISAFcjs.e; exports.useBitField = g; exports.useBitForm = _chunkW56UISAFcjs.c; exports.useBitPersist = _chunkW56UISAFcjs.i; exports.useBitScope = _chunkW56UISAFcjs.f; exports.useBitSteps = _chunkW56UISAFcjs.g; exports.useBitStore = _chunkW56UISAFcjs.b; exports.useBitWatch = _chunkW56UISAFcjs.h;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- import{a as x,b as P,c as v,d as B,e as y,f as h,g as V,h as T,i as S}from"../chunk-GQ2QJCBF.js";import"../chunk-5NA2TFPG.js";import"../chunk-G2FQQDRK.js";import{h as m}from"../chunk-2AFWJAQG.js";import"../chunk-W2E5UIXT.js";import"../chunk-UIKO6GGW.js";import{a as p}from"../chunk-ICYXODTQ.js";import"../chunk-OPC7HFNN.js";import"../chunk-FLFIOW75.js";import"../chunk-3NUJVIAM.js";import{useMemo as c,useCallback as a}from"react";function g(i){let{fieldState:r,setBlur:o,store:l}=B(i),{fieldController:t}=c(()=>m(l,i),[l,i]),u=c(()=>t.displayValue(r.value),[r.value,t]),d=a(s=>t.setValue(s),[t]),F=a(s=>t.setValue(s),[t]),{value:f}=r,e=p(r),n=a(()=>{o()},[o]);return{value:f,displayValue:u,setValue:F,setBlur:o,onChangeText:d,onBlur:n,meta:{error:e.error,touched:e.touched,invalid:e.invalid,isValidating:e.isValidating,isDirty:e.isDirty,isHidden:e.isHidden,isRequired:e.isRequired,hasError:e.hasError},props:{value:u,onChangeText:d,onBlur:n}}}export{x as BitFormProvider,y as useBitArray,g as useBitField,v as useBitForm,S as useBitPersist,h as useBitScope,V as useBitSteps,P as useBitStore,T as useBitWatch};
1
+ import{a as x,b as P,c as v,d as B,e as y,f as h,g as V,h as T,i as S}from"../chunk-NYKX3QED.js";import"../chunk-5NA2TFPG.js";import"../chunk-23IYGRVG.js";import{h as m}from"../chunk-YWBRZGEI.js";import"../chunk-W2E5UIXT.js";import"../chunk-UIKO6GGW.js";import{a as p}from"../chunk-ICYXODTQ.js";import"../chunk-RMD37PXW.js";import"../chunk-DRLFDQ5Z.js";import"../chunk-3NUJVIAM.js";import{useMemo as c,useCallback as a}from"react";function g(i){let{fieldState:r,setBlur:o,store:l}=B(i),{fieldController:t}=c(()=>m(l,i),[l,i]),u=c(()=>t.displayValue(r.value),[r.value,t]),d=a(s=>t.setValue(s),[t]),F=a(s=>t.setValue(s),[t]),{value:f}=r,e=p(r),n=a(()=>{o()},[o]);return{value:f,displayValue:u,setValue:F,setBlur:o,onChangeText:d,onBlur:n,meta:{error:e.error,touched:e.touched,invalid:e.invalid,isValidating:e.isValidating,isDirty:e.isDirty,isHidden:e.isHidden,isRequired:e.isRequired,hasError:e.hasError},props:{value:u,onChangeText:d,onBlur:n}}}export{x as BitFormProvider,y as useBitArray,g as useBitField,v as useBitForm,S as useBitPersist,h as useBitScope,V as useBitSteps,P as useBitStore,T as useBitWatch};
2
2
  //# sourceMappingURL=index.js.map
package/dist/utils.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVBX5I5XGcjs = require('./chunk-VBX5I5XG.cjs');exports.cleanPrefixedKeys = _chunkVBX5I5XGcjs.j; exports.extractServerErrors = _chunkVBX5I5XGcjs.m; exports.isValidationErrorShape = _chunkVBX5I5XGcjs.l;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKYX4G4YScjs = require('./chunk-KYX4G4YS.cjs');exports.cleanPrefixedKeys = _chunkKYX4G4YScjs.j; exports.extractServerErrors = _chunkKYX4G4YScjs.m; exports.isValidationErrorShape = _chunkKYX4G4YScjs.l;
2
2
  //# sourceMappingURL=utils.cjs.map
package/dist/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- import{j as r,l as e,m as a}from"./chunk-FLFIOW75.js";export{r as cleanPrefixedKeys,a as extractServerErrors,e as isValidationErrorShape};
1
+ import{j as r,l as e,m as a}from"./chunk-DRLFDQ5Z.js";export{r as cleanPrefixedKeys,a as extractServerErrors,e as isValidationErrorShape};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkPA43XYOWcjs = require('../chunk-PA43XYOW.cjs');require('../chunk-W5CLDRRE.cjs');var _chunk4RQFECC7cjs = require('../chunk-4RQFECC7.cjs');var _chunkNVFZ22A7cjs = require('../chunk-NVFZ22A7.cjs');var _chunkBSGJ3T5Scjs = require('../chunk-BSGJ3T5S.cjs');var _chunkRHMJPKNVcjs = require('../chunk-RHMJPKNV.cjs');var _chunk3KI3GEU3cjs = require('../chunk-3KI3GEU3.cjs');require('../chunk-ZKAFHJPU.cjs');var _chunkVBX5I5XGcjs = require('../chunk-VBX5I5XG.cjs');require('../chunk-PFPGASVZ.cjs');var _vue = require('vue');var G=Symbol("BIT_STORE");function te(t){_vue.provide.call(void 0, G,_chunk4RQFECC7cjs.d.call(void 0, t))}function a(){let t=_vue.inject.call(void 0, G);if(!t)throw new Error("BitForm Vue hooks devem ser usados sob um provideBitStore");return t}function se(){let t=a(),e=_vue.shallowRef.call(void 0, {isValid:!0,isDirty:!1,isSubmitting:!1}),o=_vue.ref.call(void 0, null),r=_vue.ref.call(void 0, null),i=_chunkNVFZ22A7cjs.c.call(void 0, t,v=>{e.value=v});_vue.onUnmounted.call(void 0, i);let{controller:s,actions:n}=_chunkNVFZ22A7cjs.i.call(void 0, t,{clearSubmissionState:()=>{o.value=null,r.value=null},setSubmissionResult:v=>{r.value=v},setSubmissionError:v=>{o.value=v}}),d=_vue.computed.call(void 0, ()=>e.value.isValid),u=_vue.computed.call(void 0, ()=>e.value.isSubmitting),p=_vue.computed.call(void 0, ()=>e.value.isDirty),c=s.onSubmit,S=s.reset;return{meta:{isValid:d,isDirty:p,isSubmitting:u,submitError:o,lastResponse:r},getValues:s.getValues,getErrors:s.getErrors,getTouched:s.getTouched,getDirtyValues:s.getDirtyValues,submit:s.submit,onSubmit:c,reset:S,...n}}function T(t){let e=a(),{fieldController:o}=_chunkNVFZ22A7cjs.h.call(void 0, e,t),r=_vue.shallowRef.call(void 0, e.read.getFieldState(t)),i=e.observe.subscribeFieldState(t,f=>{r.value=f});_vue.onUnmounted.call(void 0, ()=>{i(),_chunkNVFZ22A7cjs.j.call(void 0, e,t)});let s=_vue.computed.call(void 0, ()=>r.value.value),n=_vue.computed.call(void 0, ()=>o.displayValue(s.value)),d=_vue.computed.call(void 0, {get:()=>n.value,set:f=>{o.setValue(f)}}),u=_vue.computed.call(void 0, ()=>_chunk3KI3GEU3cjs.a.call(void 0, r.value)),p=_vue.computed.call(void 0, ()=>u.value.error),c=_vue.computed.call(void 0, ()=>u.value.touched),S=_vue.computed.call(void 0, ()=>u.value.invalid),b=_vue.computed.call(void 0, ()=>u.value.isValidating),v=_vue.computed.call(void 0, ()=>u.value.isDirty),P=_vue.computed.call(void 0, ()=>u.value.isHidden),V=_vue.computed.call(void 0, ()=>u.value.isRequired),x=_vue.computed.call(void 0, ()=>u.value.hasError),F=f=>{o.setValue(f)},l=()=>o.setBlur();return{value:s,displayValue:n,modelValue:d,setValue:F,setBlur:l,onInput:f=>{F(f)},onBlur:()=>{l()},meta:{error:p,touched:c,invalid:S,isValidating:b,isDirty:v,isHidden:P,isRequired:V,hasError:x}}}function le(t){let e=a(),o=_chunkNVFZ22A7cjs.g.call(void 0, e,t),r=_vue.shallowRef.call(void 0, o.readItems()),i=e.observe.subscribePath(t,()=>{r.value=o.readItems()});_vue.onUnmounted.call(void 0, ()=>{i(),_chunkNVFZ22A7cjs.k.call(void 0, e,`${t}.`)});let s=_vue.computed.call(void 0, ()=>o.getFields(r.value)),n=_vue.computed.call(void 0, ()=>r.value.length);return{fields:s,length:n,append:o.append,prepend:o.prepend,insert:o.insert,remove:o.remove,move:o.move,swap:o.swap,replace:o.replace,clear:o.clear}}function pe(){let t=a(),e=_vue.shallowRef.call(void 0, _chunkRHMJPKNVcjs.f.call(void 0, t)),o=_chunkRHMJPKNVcjs.g.call(void 0, t,s=>{e.value=s});_vue.onUnmounted.call(void 0, o);let r=()=>t.feature.undo(),i=()=>t.feature.redo();return{canUndo:_vue.computed.call(void 0, ()=>e.value.canUndo),canRedo:_vue.computed.call(void 0, ()=>e.value.canRedo),historyIndex:_vue.computed.call(void 0, ()=>e.value.historyIndex),historySize:_vue.computed.call(void 0, ()=>e.value.historySize),undo:r,redo:i}}function Se(t){let e=a(),o=_vue.ref.call(void 0, e.read.getScopeStatus(t)),r;_vue.onMounted.call(void 0, ()=>{r=_chunkBSGJ3T5Scjs.a.call(void 0, e,t,p=>{o.value=p})}),_vue.onUnmounted.call(void 0, ()=>{_optionalChain([r, 'optionalCall', _2 => _2()])});let i=async()=>{let p=await e.feature.validate({scope:t}),c=e.read.getScopeErrors(t);return{valid:p,errors:c}},s=()=>e.read.getScopeErrors(t),n=_vue.computed.call(void 0, ()=>!o.value.hasErrors),d=_vue.computed.call(void 0, ()=>o.value.isDirty),u=_vue.computed.call(void 0, ()=>o.value.errors);return{scopeName:t,status:o,errors:u,validate:i,getErrors:s,isValid:n,isDirty:d}}function be(t){let e=a(),o=_vue.ref.call(void 0, 0),r=_vue.computed.call(void 0, ()=>_nullishCoalesce(t[o.value], () => (""))),i=_vue.ref.call(void 0, e.read.getScopeStatus(r.value)),s;_vue.watch.call(void 0, r,l=>{i.value=e.read.getScopeStatus(l),_optionalChain([s, 'optionalCall', _3 => _3()]),s=e.observe.subscribeScopeStatus(l,n)});let n=()=>{let l=r.value,B=e.read.getScopeStatus(l);_chunkRHMJPKNVcjs.b.call(void 0, i.value,B)||(i.value=B)};_vue.onMounted.call(void 0, ()=>{s=e.observe.subscribeScopeStatus(r.value,n)}),_vue.onUnmounted.call(void 0, ()=>{_optionalChain([s, 'optionalCall', _4 => _4()])});let d=async()=>{let l=r.value,B=await e.feature.validate({scope:l}),g=e.read.getScopeErrors(l);return{valid:B,errors:g}},u=()=>e.read.getScopeErrors(r.value),p=async()=>{let l=r.value,B=e.read.getScopeFields(l);if(e.feature.hasValidationsInProgress(B))return!1;let g=await e.feature.validate({scope:l});if(g)o.value=Math.min(o.value+1,t.length-1);else{let f=e.read.getScopeErrors(l),E=Object.keys(f);E.length>0&&e.write.markFieldsTouched(E)}return g},c=()=>{o.value=Math.max(o.value-1,0)},S=l=>{o.value=Math.max(0,Math.min(l-1,t.length-1))},b=_vue.computed.call(void 0, ()=>o.value+1),v=_vue.computed.call(void 0, ()=>o.value===0),P=_vue.computed.call(void 0, ()=>o.value>=t.length-1),V=_vue.computed.call(void 0, ()=>!i.value.hasErrors),x=_vue.computed.call(void 0, ()=>i.value.isDirty),F=_vue.computed.call(void 0, ()=>i.value.errors);return{step:b,stepIndex:o,scope:r,next:p,prev:c,goTo:S,isFirst:v,isLast:P,status:i,errors:F,isValid:V,isDirty:x,validate:d,getErrors:u}}function Ve(t){let e=a(),o=_chunkVBX5I5XGcjs.f.call(void 0, e.read.getState().values,t),r=_vue.ref.call(void 0, o),i=e.observe.subscribePath(t,s=>{_chunkVBX5I5XGcjs.c.call(void 0, r.value,s)||(r.value=s)});return _vue.onUnmounted.call(void 0, i),_vue.readonly.call(void 0, r)}function Re(t,e,o){let r=a(),i=T(t),s=null,n=_vue.ref.call(void 0, !1),d={setLoading:c=>{n.value=c},setError:(c,S)=>r.write.setError(c,S),setValue:c=>i.setValue(c),getUploadKey:()=>s,setUploadKey:c=>{s=c}},u=_chunkPA43XYOWcjs.a.call(void 0, t,e,d),p=_chunkPA43XYOWcjs.b.call(void 0, t,o,d);return{value:i.value,setValue:i.setValue,error:_vue.computed.call(void 0, ()=>i.meta.error.value),isValidating:_vue.computed.call(void 0, ()=>!!i.meta.isValidating.value||n.value),upload:u,remove:p}}function we(){let t=a(),e=_vue.ref.call(void 0, t.read.getPersistMetadata()),o=_chunkNVFZ22A7cjs.f.call(void 0, t,n=>{e.value=n});return _vue.onUnmounted.call(void 0, ()=>o()),{restore:async()=>t.feature.restorePersisted(),save:async()=>{await t.feature.forceSave()},clear:async()=>{await t.feature.clearPersisted()},meta:{isSaving:_vue.computed.call(void 0, ()=>e.value.isSaving),isRestoring:_vue.computed.call(void 0, ()=>e.value.isRestoring),error:_vue.computed.call(void 0, ()=>e.value.error)}}}exports.provideBitStore = te; exports.useBitArray = le; exports.useBitField = T; exports.useBitForm = se; exports.useBitHistory = pe; exports.useBitPersist = we; exports.useBitScope = Se; exports.useBitSteps = be; exports.useBitStore = a; exports.useBitUpload = Re; exports.useBitWatch = Ve;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkPA43XYOWcjs = require('../chunk-PA43XYOW.cjs');require('../chunk-W5CLDRRE.cjs');var _chunkVAP2C5QVcjs = require('../chunk-VAP2C5QV.cjs');var _chunkACEJG5FJcjs = require('../chunk-ACEJG5FJ.cjs');var _chunkBSGJ3T5Scjs = require('../chunk-BSGJ3T5S.cjs');var _chunkRHMJPKNVcjs = require('../chunk-RHMJPKNV.cjs');var _chunk3KI3GEU3cjs = require('../chunk-3KI3GEU3.cjs');require('../chunk-UFJJOXVB.cjs');var _chunkKYX4G4YScjs = require('../chunk-KYX4G4YS.cjs');require('../chunk-PFPGASVZ.cjs');var _vue = require('vue');var G=Symbol("BIT_STORE");function te(t){_vue.provide.call(void 0, G,_chunkVAP2C5QVcjs.d.call(void 0, t))}function a(){let t=_vue.inject.call(void 0, G);if(!t)throw new Error("BitForm Vue hooks devem ser usados sob um provideBitStore");return t}function se(){let t=a(),e=_vue.shallowRef.call(void 0, {isValid:!0,isDirty:!1,isSubmitting:!1}),o=_vue.ref.call(void 0, null),r=_vue.ref.call(void 0, null),i=_chunkACEJG5FJcjs.c.call(void 0, t,v=>{e.value=v});_vue.onUnmounted.call(void 0, i);let{controller:s,actions:n}=_chunkACEJG5FJcjs.i.call(void 0, t,{clearSubmissionState:()=>{o.value=null,r.value=null},setSubmissionResult:v=>{r.value=v},setSubmissionError:v=>{o.value=v}}),d=_vue.computed.call(void 0, ()=>e.value.isValid),u=_vue.computed.call(void 0, ()=>e.value.isSubmitting),p=_vue.computed.call(void 0, ()=>e.value.isDirty),c=s.onSubmit,S=s.reset;return{meta:{isValid:d,isDirty:p,isSubmitting:u,submitError:o,lastResponse:r},getValues:s.getValues,getErrors:s.getErrors,getTouched:s.getTouched,getDirtyValues:s.getDirtyValues,submit:s.submit,onSubmit:c,reset:S,...n}}function T(t){let e=a(),{fieldController:o}=_chunkACEJG5FJcjs.h.call(void 0, e,t),r=_vue.shallowRef.call(void 0, e.read.getFieldState(t)),i=e.observe.subscribeFieldState(t,f=>{r.value=f});_vue.onUnmounted.call(void 0, ()=>{i(),_chunkACEJG5FJcjs.j.call(void 0, e,t)});let s=_vue.computed.call(void 0, ()=>r.value.value),n=_vue.computed.call(void 0, ()=>o.displayValue(s.value)),d=_vue.computed.call(void 0, {get:()=>n.value,set:f=>{o.setValue(f)}}),u=_vue.computed.call(void 0, ()=>_chunk3KI3GEU3cjs.a.call(void 0, r.value)),p=_vue.computed.call(void 0, ()=>u.value.error),c=_vue.computed.call(void 0, ()=>u.value.touched),S=_vue.computed.call(void 0, ()=>u.value.invalid),b=_vue.computed.call(void 0, ()=>u.value.isValidating),v=_vue.computed.call(void 0, ()=>u.value.isDirty),P=_vue.computed.call(void 0, ()=>u.value.isHidden),V=_vue.computed.call(void 0, ()=>u.value.isRequired),x=_vue.computed.call(void 0, ()=>u.value.hasError),F=f=>{o.setValue(f)},l=()=>o.setBlur();return{value:s,displayValue:n,modelValue:d,setValue:F,setBlur:l,onInput:f=>{F(f)},onBlur:()=>{l()},meta:{error:p,touched:c,invalid:S,isValidating:b,isDirty:v,isHidden:P,isRequired:V,hasError:x}}}function le(t){let e=a(),o=_chunkACEJG5FJcjs.g.call(void 0, e,t),r=_vue.shallowRef.call(void 0, o.readItems()),i=e.observe.subscribePath(t,()=>{r.value=o.readItems()});_vue.onUnmounted.call(void 0, ()=>{i(),_chunkACEJG5FJcjs.k.call(void 0, e,`${t}.`)});let s=_vue.computed.call(void 0, ()=>o.getFields(r.value)),n=_vue.computed.call(void 0, ()=>r.value.length);return{fields:s,length:n,append:o.append,prepend:o.prepend,insert:o.insert,remove:o.remove,move:o.move,swap:o.swap,replace:o.replace,clear:o.clear}}function pe(){let t=a(),e=_vue.shallowRef.call(void 0, _chunkRHMJPKNVcjs.f.call(void 0, t)),o=_chunkRHMJPKNVcjs.g.call(void 0, t,s=>{e.value=s});_vue.onUnmounted.call(void 0, o);let r=()=>t.feature.undo(),i=()=>t.feature.redo();return{canUndo:_vue.computed.call(void 0, ()=>e.value.canUndo),canRedo:_vue.computed.call(void 0, ()=>e.value.canRedo),historyIndex:_vue.computed.call(void 0, ()=>e.value.historyIndex),historySize:_vue.computed.call(void 0, ()=>e.value.historySize),undo:r,redo:i}}function Se(t){let e=a(),o=_vue.ref.call(void 0, e.read.getScopeStatus(t)),r;_vue.onMounted.call(void 0, ()=>{r=_chunkBSGJ3T5Scjs.a.call(void 0, e,t,p=>{o.value=p})}),_vue.onUnmounted.call(void 0, ()=>{_optionalChain([r, 'optionalCall', _2 => _2()])});let i=async()=>{let p=await e.feature.validate({scope:t}),c=e.read.getScopeErrors(t);return{valid:p,errors:c}},s=()=>e.read.getScopeErrors(t),n=_vue.computed.call(void 0, ()=>!o.value.hasErrors),d=_vue.computed.call(void 0, ()=>o.value.isDirty),u=_vue.computed.call(void 0, ()=>o.value.errors);return{scopeName:t,status:o,errors:u,validate:i,getErrors:s,isValid:n,isDirty:d}}function be(t){let e=a(),o=_vue.ref.call(void 0, 0),r=_vue.computed.call(void 0, ()=>_nullishCoalesce(t[o.value], () => (""))),i=_vue.ref.call(void 0, e.read.getScopeStatus(r.value)),s;_vue.watch.call(void 0, r,l=>{i.value=e.read.getScopeStatus(l),_optionalChain([s, 'optionalCall', _3 => _3()]),s=e.observe.subscribeScopeStatus(l,n)});let n=()=>{let l=r.value,B=e.read.getScopeStatus(l);_chunkRHMJPKNVcjs.b.call(void 0, i.value,B)||(i.value=B)};_vue.onMounted.call(void 0, ()=>{s=e.observe.subscribeScopeStatus(r.value,n)}),_vue.onUnmounted.call(void 0, ()=>{_optionalChain([s, 'optionalCall', _4 => _4()])});let d=async()=>{let l=r.value,B=await e.feature.validate({scope:l}),g=e.read.getScopeErrors(l);return{valid:B,errors:g}},u=()=>e.read.getScopeErrors(r.value),p=async()=>{let l=r.value,B=e.read.getScopeFields(l);if(e.feature.hasValidationsInProgress(B))return!1;let g=await e.feature.validate({scope:l});if(g)o.value=Math.min(o.value+1,t.length-1);else{let f=e.read.getScopeErrors(l),E=Object.keys(f);E.length>0&&e.write.markFieldsTouched(E)}return g},c=()=>{o.value=Math.max(o.value-1,0)},S=l=>{o.value=Math.max(0,Math.min(l-1,t.length-1))},b=_vue.computed.call(void 0, ()=>o.value+1),v=_vue.computed.call(void 0, ()=>o.value===0),P=_vue.computed.call(void 0, ()=>o.value>=t.length-1),V=_vue.computed.call(void 0, ()=>!i.value.hasErrors),x=_vue.computed.call(void 0, ()=>i.value.isDirty),F=_vue.computed.call(void 0, ()=>i.value.errors);return{step:b,stepIndex:o,scope:r,next:p,prev:c,goTo:S,isFirst:v,isLast:P,status:i,errors:F,isValid:V,isDirty:x,validate:d,getErrors:u}}function Ve(t){let e=a(),o=_chunkKYX4G4YScjs.f.call(void 0, e.read.getState().values,t),r=_vue.ref.call(void 0, o),i=e.observe.subscribePath(t,s=>{_chunkKYX4G4YScjs.c.call(void 0, r.value,s)||(r.value=s)});return _vue.onUnmounted.call(void 0, i),_vue.readonly.call(void 0, r)}function Re(t,e,o){let r=a(),i=T(t),s=null,n=_vue.ref.call(void 0, !1),d={setLoading:c=>{n.value=c},setError:(c,S)=>r.write.setError(c,S),setValue:c=>i.setValue(c),getUploadKey:()=>s,setUploadKey:c=>{s=c}},u=_chunkPA43XYOWcjs.a.call(void 0, t,e,d),p=_chunkPA43XYOWcjs.b.call(void 0, t,o,d);return{value:i.value,setValue:i.setValue,error:_vue.computed.call(void 0, ()=>i.meta.error.value),isValidating:_vue.computed.call(void 0, ()=>!!i.meta.isValidating.value||n.value),upload:u,remove:p}}function we(){let t=a(),e=_vue.ref.call(void 0, t.read.getPersistMetadata()),o=_chunkACEJG5FJcjs.f.call(void 0, t,n=>{e.value=n});return _vue.onUnmounted.call(void 0, ()=>o()),{restore:async()=>t.feature.restorePersisted(),save:async()=>{await t.feature.forceSave()},clear:async()=>{await t.feature.clearPersisted()},meta:{isSaving:_vue.computed.call(void 0, ()=>e.value.isSaving),isRestoring:_vue.computed.call(void 0, ()=>e.value.isRestoring),error:_vue.computed.call(void 0, ()=>e.value.error)}}}exports.provideBitStore = te; exports.useBitArray = le; exports.useBitField = T; exports.useBitForm = se; exports.useBitHistory = pe; exports.useBitPersist = we; exports.useBitScope = Se; exports.useBitSteps = be; exports.useBitStore = a; exports.useBitUpload = Re; exports.useBitWatch = Ve;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/vue/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as Y,b as $}from"../chunk-PG7ZH32Z.js";import"../chunk-5NA2TFPG.js";import{d as I}from"../chunk-G2FQQDRK.js";import{c as H,f as K,g as q,h as C,i as O,j as W,k as _}from"../chunk-2AFWJAQG.js";import{a as z}from"../chunk-W2E5UIXT.js";import{b as D,f as A,g as j}from"../chunk-UIKO6GGW.js";import{a as L}from"../chunk-ICYXODTQ.js";import"../chunk-OPC7HFNN.js";import{c as k,f as M}from"../chunk-FLFIOW75.js";import"../chunk-3NUJVIAM.js";import{inject as N,provide as ee}from"vue";var G=Symbol("BIT_STORE");function te(t){ee(G,I(t))}function a(){let t=N(G);if(!t)throw new Error("BitForm Vue hooks devem ser usados sob um provideBitStore");return t}import{computed as R,onUnmounted as oe,shallowRef as re,ref as J}from"vue";function se(){let t=a(),e=re({isValid:!0,isDirty:!1,isSubmitting:!1}),o=J(null),r=J(null),i=H(t,v=>{e.value=v});oe(i);let{controller:s,actions:n}=O(t,{clearSubmissionState:()=>{o.value=null,r.value=null},setSubmissionResult:v=>{r.value=v},setSubmissionError:v=>{o.value=v}}),d=R(()=>e.value.isValid),u=R(()=>e.value.isSubmitting),p=R(()=>e.value.isDirty),c=s.onSubmit,S=s.reset;return{meta:{isValid:d,isDirty:p,isSubmitting:u,submitError:o,lastResponse:r},getValues:s.getValues,getErrors:s.getErrors,getTouched:s.getTouched,getDirtyValues:s.getDirtyValues,submit:s.submit,onSubmit:c,reset:S,...n}}import{computed as m,onUnmounted as ie,shallowRef as ae}from"vue";function T(t){let e=a(),{fieldController:o}=C(e,t),r=ae(e.read.getFieldState(t)),i=e.observe.subscribeFieldState(t,f=>{r.value=f});ie(()=>{i(),W(e,t)});let s=m(()=>r.value.value),n=m(()=>o.displayValue(s.value)),d=m({get:()=>n.value,set:f=>{o.setValue(f)}}),u=m(()=>L(r.value)),p=m(()=>u.value.error),c=m(()=>u.value.touched),S=m(()=>u.value.invalid),b=m(()=>u.value.isValidating),v=m(()=>u.value.isDirty),P=m(()=>u.value.isHidden),V=m(()=>u.value.isRequired),x=m(()=>u.value.hasError),F=f=>{o.setValue(f)},l=()=>o.setBlur();return{value:s,displayValue:n,modelValue:d,setValue:F,setBlur:l,onInput:f=>{F(f)},onBlur:()=>{l()},meta:{error:p,touched:c,invalid:S,isValidating:b,isDirty:v,isHidden:P,isRequired:V,hasError:x}}}import{computed as Q,onUnmounted as ne,shallowRef as ue}from"vue";function le(t){let e=a(),o=q(e,t),r=ue(o.readItems()),i=e.observe.subscribePath(t,()=>{r.value=o.readItems()});ne(()=>{i(),_(e,`${t}.`)});let s=Q(()=>o.getFields(r.value)),n=Q(()=>r.value.length);return{fields:s,length:n,append:o.append,prepend:o.prepend,insert:o.insert,remove:o.remove,move:o.move,swap:o.swap,replace:o.replace,clear:o.clear}}import{computed as h,onUnmounted as ce,shallowRef as me}from"vue";function pe(){let t=a(),e=me(A(t)),o=j(t,s=>{e.value=s});ce(o);let r=()=>t.feature.undo(),i=()=>t.feature.redo();return{canUndo:h(()=>e.value.canUndo),canRedo:h(()=>e.value.canRedo),historyIndex:h(()=>e.value.historyIndex),historySize:h(()=>e.value.historySize),undo:r,redo:i}}import{computed as U,onMounted as de,onUnmounted as ve,ref as fe}from"vue";function Se(t){let e=a(),o=fe(e.read.getScopeStatus(t)),r;de(()=>{r=z(e,t,p=>{o.value=p})}),ve(()=>{r?.()});let i=async()=>{let p=await e.feature.validate({scope:t}),c=e.read.getScopeErrors(t);return{valid:p,errors:c}},s=()=>e.read.getScopeErrors(t),n=U(()=>!o.value.hasErrors),d=U(()=>o.value.isDirty),u=U(()=>o.value.errors);return{scopeName:t,status:o,errors:u,validate:i,getErrors:s,isValid:n,isDirty:d}}import{computed as y,onMounted as Be,onUnmounted as ye,ref as X,watch as ge}from"vue";function be(t){let e=a(),o=X(0),r=y(()=>t[o.value]??""),i=X(e.read.getScopeStatus(r.value)),s;ge(r,l=>{i.value=e.read.getScopeStatus(l),s?.(),s=e.observe.subscribeScopeStatus(l,n)});let n=()=>{let l=r.value,B=e.read.getScopeStatus(l);D(i.value,B)||(i.value=B)};Be(()=>{s=e.observe.subscribeScopeStatus(r.value,n)}),ye(()=>{s?.()});let d=async()=>{let l=r.value,B=await e.feature.validate({scope:l}),g=e.read.getScopeErrors(l);return{valid:B,errors:g}},u=()=>e.read.getScopeErrors(r.value),p=async()=>{let l=r.value,B=e.read.getScopeFields(l);if(e.feature.hasValidationsInProgress(B))return!1;let g=await e.feature.validate({scope:l});if(g)o.value=Math.min(o.value+1,t.length-1);else{let f=e.read.getScopeErrors(l),E=Object.keys(f);E.length>0&&e.write.markFieldsTouched(E)}return g},c=()=>{o.value=Math.max(o.value-1,0)},S=l=>{o.value=Math.max(0,Math.min(l-1,t.length-1))},b=y(()=>o.value+1),v=y(()=>o.value===0),P=y(()=>o.value>=t.length-1),V=y(()=>!i.value.hasErrors),x=y(()=>i.value.isDirty),F=y(()=>i.value.errors);return{step:b,stepIndex:o,scope:r,next:p,prev:c,goTo:S,isFirst:v,isLast:P,status:i,errors:F,isValid:V,isDirty:x,validate:d,getErrors:u}}import{ref as Fe,onUnmounted as he,readonly as Pe}from"vue";function Ve(t){let e=a(),o=M(e.read.getState().values,t),r=Fe(o),i=e.observe.subscribePath(t,s=>{k(r.value,s)||(r.value=s)});return he(i),Pe(r)}import{computed as Z,ref as xe}from"vue";function Re(t,e,o){let r=a(),i=T(t),s=null,n=xe(!1),d={setLoading:c=>{n.value=c},setError:(c,S)=>r.write.setError(c,S),setValue:c=>i.setValue(c),getUploadKey:()=>s,setUploadKey:c=>{s=c}},u=Y(t,e,d),p=$(t,o,d);return{value:i.value,setValue:i.setValue,error:Z(()=>i.meta.error.value),isValidating:Z(()=>!!i.meta.isValidating.value||n.value),upload:u,remove:p}}import{computed as w,onUnmounted as Te,ref as Ue}from"vue";function we(){let t=a(),e=Ue(t.read.getPersistMetadata()),o=K(t,n=>{e.value=n});return Te(()=>o()),{restore:async()=>t.feature.restorePersisted(),save:async()=>{await t.feature.forceSave()},clear:async()=>{await t.feature.clearPersisted()},meta:{isSaving:w(()=>e.value.isSaving),isRestoring:w(()=>e.value.isRestoring),error:w(()=>e.value.error)}}}export{te as provideBitStore,le as useBitArray,T as useBitField,se as useBitForm,pe as useBitHistory,we as useBitPersist,Se as useBitScope,be as useBitSteps,a as useBitStore,Re as useBitUpload,Ve as useBitWatch};
1
+ import{a as Y,b as $}from"../chunk-PG7ZH32Z.js";import"../chunk-5NA2TFPG.js";import{d as I}from"../chunk-23IYGRVG.js";import{c as H,f as K,g as q,h as C,i as O,j as W,k as _}from"../chunk-YWBRZGEI.js";import{a as z}from"../chunk-W2E5UIXT.js";import{b as D,f as A,g as j}from"../chunk-UIKO6GGW.js";import{a as L}from"../chunk-ICYXODTQ.js";import"../chunk-RMD37PXW.js";import{c as k,f as M}from"../chunk-DRLFDQ5Z.js";import"../chunk-3NUJVIAM.js";import{inject as N,provide as ee}from"vue";var G=Symbol("BIT_STORE");function te(t){ee(G,I(t))}function a(){let t=N(G);if(!t)throw new Error("BitForm Vue hooks devem ser usados sob um provideBitStore");return t}import{computed as R,onUnmounted as oe,shallowRef as re,ref as J}from"vue";function se(){let t=a(),e=re({isValid:!0,isDirty:!1,isSubmitting:!1}),o=J(null),r=J(null),i=H(t,v=>{e.value=v});oe(i);let{controller:s,actions:n}=O(t,{clearSubmissionState:()=>{o.value=null,r.value=null},setSubmissionResult:v=>{r.value=v},setSubmissionError:v=>{o.value=v}}),d=R(()=>e.value.isValid),u=R(()=>e.value.isSubmitting),p=R(()=>e.value.isDirty),c=s.onSubmit,S=s.reset;return{meta:{isValid:d,isDirty:p,isSubmitting:u,submitError:o,lastResponse:r},getValues:s.getValues,getErrors:s.getErrors,getTouched:s.getTouched,getDirtyValues:s.getDirtyValues,submit:s.submit,onSubmit:c,reset:S,...n}}import{computed as m,onUnmounted as ie,shallowRef as ae}from"vue";function T(t){let e=a(),{fieldController:o}=C(e,t),r=ae(e.read.getFieldState(t)),i=e.observe.subscribeFieldState(t,f=>{r.value=f});ie(()=>{i(),W(e,t)});let s=m(()=>r.value.value),n=m(()=>o.displayValue(s.value)),d=m({get:()=>n.value,set:f=>{o.setValue(f)}}),u=m(()=>L(r.value)),p=m(()=>u.value.error),c=m(()=>u.value.touched),S=m(()=>u.value.invalid),b=m(()=>u.value.isValidating),v=m(()=>u.value.isDirty),P=m(()=>u.value.isHidden),V=m(()=>u.value.isRequired),x=m(()=>u.value.hasError),F=f=>{o.setValue(f)},l=()=>o.setBlur();return{value:s,displayValue:n,modelValue:d,setValue:F,setBlur:l,onInput:f=>{F(f)},onBlur:()=>{l()},meta:{error:p,touched:c,invalid:S,isValidating:b,isDirty:v,isHidden:P,isRequired:V,hasError:x}}}import{computed as Q,onUnmounted as ne,shallowRef as ue}from"vue";function le(t){let e=a(),o=q(e,t),r=ue(o.readItems()),i=e.observe.subscribePath(t,()=>{r.value=o.readItems()});ne(()=>{i(),_(e,`${t}.`)});let s=Q(()=>o.getFields(r.value)),n=Q(()=>r.value.length);return{fields:s,length:n,append:o.append,prepend:o.prepend,insert:o.insert,remove:o.remove,move:o.move,swap:o.swap,replace:o.replace,clear:o.clear}}import{computed as h,onUnmounted as ce,shallowRef as me}from"vue";function pe(){let t=a(),e=me(A(t)),o=j(t,s=>{e.value=s});ce(o);let r=()=>t.feature.undo(),i=()=>t.feature.redo();return{canUndo:h(()=>e.value.canUndo),canRedo:h(()=>e.value.canRedo),historyIndex:h(()=>e.value.historyIndex),historySize:h(()=>e.value.historySize),undo:r,redo:i}}import{computed as U,onMounted as de,onUnmounted as ve,ref as fe}from"vue";function Se(t){let e=a(),o=fe(e.read.getScopeStatus(t)),r;de(()=>{r=z(e,t,p=>{o.value=p})}),ve(()=>{r?.()});let i=async()=>{let p=await e.feature.validate({scope:t}),c=e.read.getScopeErrors(t);return{valid:p,errors:c}},s=()=>e.read.getScopeErrors(t),n=U(()=>!o.value.hasErrors),d=U(()=>o.value.isDirty),u=U(()=>o.value.errors);return{scopeName:t,status:o,errors:u,validate:i,getErrors:s,isValid:n,isDirty:d}}import{computed as y,onMounted as Be,onUnmounted as ye,ref as X,watch as ge}from"vue";function be(t){let e=a(),o=X(0),r=y(()=>t[o.value]??""),i=X(e.read.getScopeStatus(r.value)),s;ge(r,l=>{i.value=e.read.getScopeStatus(l),s?.(),s=e.observe.subscribeScopeStatus(l,n)});let n=()=>{let l=r.value,B=e.read.getScopeStatus(l);D(i.value,B)||(i.value=B)};Be(()=>{s=e.observe.subscribeScopeStatus(r.value,n)}),ye(()=>{s?.()});let d=async()=>{let l=r.value,B=await e.feature.validate({scope:l}),g=e.read.getScopeErrors(l);return{valid:B,errors:g}},u=()=>e.read.getScopeErrors(r.value),p=async()=>{let l=r.value,B=e.read.getScopeFields(l);if(e.feature.hasValidationsInProgress(B))return!1;let g=await e.feature.validate({scope:l});if(g)o.value=Math.min(o.value+1,t.length-1);else{let f=e.read.getScopeErrors(l),E=Object.keys(f);E.length>0&&e.write.markFieldsTouched(E)}return g},c=()=>{o.value=Math.max(o.value-1,0)},S=l=>{o.value=Math.max(0,Math.min(l-1,t.length-1))},b=y(()=>o.value+1),v=y(()=>o.value===0),P=y(()=>o.value>=t.length-1),V=y(()=>!i.value.hasErrors),x=y(()=>i.value.isDirty),F=y(()=>i.value.errors);return{step:b,stepIndex:o,scope:r,next:p,prev:c,goTo:S,isFirst:v,isLast:P,status:i,errors:F,isValid:V,isDirty:x,validate:d,getErrors:u}}import{ref as Fe,onUnmounted as he,readonly as Pe}from"vue";function Ve(t){let e=a(),o=M(e.read.getState().values,t),r=Fe(o),i=e.observe.subscribePath(t,s=>{k(r.value,s)||(r.value=s)});return he(i),Pe(r)}import{computed as Z,ref as xe}from"vue";function Re(t,e,o){let r=a(),i=T(t),s=null,n=xe(!1),d={setLoading:c=>{n.value=c},setError:(c,S)=>r.write.setError(c,S),setValue:c=>i.setValue(c),getUploadKey:()=>s,setUploadKey:c=>{s=c}},u=Y(t,e,d),p=$(t,o,d);return{value:i.value,setValue:i.setValue,error:Z(()=>i.meta.error.value),isValidating:Z(()=>!!i.meta.isValidating.value||n.value),upload:u,remove:p}}import{computed as w,onUnmounted as Te,ref as Ue}from"vue";function we(){let t=a(),e=Ue(t.read.getPersistMetadata()),o=K(t,n=>{e.value=n});return Te(()=>o()),{restore:async()=>t.feature.restorePersisted(),save:async()=>{await t.feature.forceSave()},clear:async()=>{await t.feature.clearPersisted()},meta:{isSaving:w(()=>e.value.isSaving),isRestoring:w(()=>e.value.isRestoring),error:w(()=>e.value.error)}}}export{te as provideBitStore,le as useBitArray,T as useBitField,se as useBitForm,pe as useBitHistory,we as useBitPersist,Se as useBitScope,be as useBitSteps,a as useBitStore,Re as useBitUpload,Ve as useBitWatch};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lehnihon/bit-form",
3
- "version": "2.2.10",
3
+ "version": "2.2.11",
4
4
  "description": "Gerenciamento de estado de formulários agnóstico e performático",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16; var _class17; var _class18; var _class19; var _class20; var _class21; var _class22;var _chunkRHMJPKNVcjs = require('./chunk-RHMJPKNV.cjs');var _chunkZKAFHJPUcjs = require('./chunk-ZKAFHJPU.cjs');var _chunkVBX5I5XGcjs = require('./chunk-VBX5I5XG.cjs');function qt(r){let{path:t,getFieldConfig:e,masks:i}=r,s=_optionalChain([e, 'call', _2 => _2(t), 'optionalAccess', _3 => _3.mask]);if(s)return typeof s=="string"?_optionalChain([i, 'optionalAccess', _4 => _4[s]]):s}function Ut(r){let{state:t,path:e,value:i,isHidden:s,isRequired:n,isDirty:a,isValidating:o}=r,c=e;return{value:i,error:t.errors[c],touched:!!t.touched[c],isHidden:s,isRequired:n,isDirty:a,isValidating:o}}var I=Symbol.for("bit-form.framework-store-api");var D=Symbol.for("bit-form.hooks-api");var O=class{constructor(t){this.baselineValues=_chunkVBX5I5XGcjs.a.call(void 0, t)}getValues(){return this.baselineSnapshot||(this.baselineSnapshot=Object.freeze(_chunkVBX5I5XGcjs.a.call(void 0, this.baselineValues))),this.baselineSnapshot}setValues(t){this.baselineValues=_chunkVBX5I5XGcjs.a.call(void 0, t),this.baselineSnapshot=void 0}};var j= (_class =class{constructor(t){;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);this.getComputedEntries=t}__init() {this.equalityCache=new Map}__init2() {this.reverseDepsCache=null}__init3() {this.childDepsIndex=null}__init4() {this.validatedEntriesSignature=null}__init5() {this.validatedEntriesRef=null}__init6() {this.orderedAllEntriesCache=null}__init7() {this.orderedIndexByPathCache=null}isCacheableScalar(t){return t===null||typeof t!="object"&&typeof t!="function"}invalidateReverseDeps(){this.reverseDepsCache=null,this.childDepsIndex=null,this.orderedAllEntriesCache=null,this.validatedEntriesSignature=null,this.validatedEntriesRef=null,this.orderedIndexByPathCache=null,this.equalityCache.clear()}apply(t,e){let i=this.getComputedEntries();if(i.length===0)return t;this.ensureEntriesAreValid(i);let s=this.resolveEntriesToRun(i,e);if(s.length===0)return t;let n=t;for(let a of s){let o=a.compute(n),c=_chunkVBX5I5XGcjs.f.call(void 0, n,a.path),u=this.equalityCache.get(a.path),l,d=this.isCacheableScalar(c)&&this.isCacheableScalar(o);d&&u&&u.current===c&&u.next===o?l=u.equal:(l=_chunkVBX5I5XGcjs.d.call(void 0, c,o),d?this.equalityCache.set(a.path,{current:c,next:o,equal:l}):this.equalityCache.delete(a.path)),l||(n=_chunkVBX5I5XGcjs.g.call(void 0, n,a.path,o))}return n}getReverseDependencies(t){if(this.reverseDepsCache)return this.reverseDepsCache;let e=new Map;for(let s of t)for(let n of s.dependsOn){let a=e.get(n);a||(a=new Set,e.set(n,a)),a.add(s.path)}let i=new Map;for(let s of e.keys()){let n=s.split(".");for(let a=1;a<n.length;a++){let o=n.slice(0,a).join("."),c=i.get(o);c||(c=new Set,i.set(o,c)),c.add(s)}}return this.reverseDepsCache=e,this.childDepsIndex=i,e}resolveEntriesToRun(t,e){if(!e||e.length===0||e.includes("*"))return this.getOrderedAllEntries(t);let i=this.getReverseDependencies(t),s=new Set,n=[...e],a=0;for(;a<n.length;){let l=n[a++],d=this.getDependentsForPath(i,l);if(d)for(let p of d)s.has(p)||(s.add(p),n.push(p))}if(s.size===0)return[];let o=this.getOrderedAllEntries(t),c=this.getOrderedIndexByPath(t,o),u=[];return s.forEach(l=>{let d=c.get(l);if(d===void 0)return;let p=o[d];p&&u.push({index:d,entry:p})}),u.sort((l,d)=>l.index-d.index),u.map(l=>l.entry)}orderEntries(t){if(t.length<=1)return t;let e=new Map(t.map(o=>[o.path,o])),i=new Map,s=new Map;t.forEach(o=>i.set(o.path,0)),t.forEach(o=>{o.dependsOn.forEach(c=>{if(!e.has(c))return;let u=_nullishCoalesce(s.get(c), () => (new Set));u.has(o.path)||(u.add(o.path),s.set(c,u),i.set(o.path,(_nullishCoalesce(i.get(o.path), () => (0)))+1))})});let n=t.filter(o=>(_nullishCoalesce(i.get(o.path), () => (0)))===0).map(o=>o.path),a=[];for(;n.length>0;){let o=n.shift();a.push(o);let c=s.get(o);c&&c.forEach(u=>{let l=(_nullishCoalesce(i.get(u), () => (0)))-1;i.set(u,l),l===0&&n.push(u)})}if(a.length!==t.length)throw new Error("BitStore: cyclic computed dependencies detected. Check computedDependsOn definitions.");return a.map(o=>e.get(o))}getOrderedAllEntries(t){let e=this.createEntriesSignature(t);if(this.orderedAllEntriesCache&&this.orderedAllEntriesCache.signature===e)return this.orderedAllEntriesCache.ordered;let i=this.orderEntries(t);return this.orderedAllEntriesCache={signature:e,ordered:i},i}getOrderedIndexByPath(t,e){let i=this.createEntriesSignature(t);if(this.orderedIndexByPathCache&&this.orderedIndexByPathCache.signature===i)return this.orderedIndexByPathCache.indexByPath;let s=new Map;return e.forEach((n,a)=>{s.set(n.path,a)}),this.orderedIndexByPathCache={signature:i,indexByPath:s},s}ensureEntriesAreValid(t){if(this.validatedEntriesRef===t)return;let e=this.createEntriesSignature(t);if(this.validatedEntriesSignature===e){this.validatedEntriesRef=t;return}t.forEach(i=>this.assertDependencies(i)),this.invalidateReverseDeps(),this.validatedEntriesSignature=e,this.validatedEntriesRef=t}createEntriesSignature(t){return t.map(e=>`${e.path}:${e.dependsOn.join(",")}`).join("|")}getDependentsForPath(t,e){let i=new Set,s=o=>{let c=t.get(o);c&&c.forEach(u=>i.add(u))};s(e);let n=e.split(".");for(;n.length>1;)n.pop(),s(n.join("."));let a=_optionalChain([this, 'access', _5 => _5.childDepsIndex, 'optionalAccess', _6 => _6.get, 'call', _7 => _7(e)]);if(a)for(let o of a)s(o);return i}assertDependencies(t){if(t.dependsOn.length===0)throw new Error(`BitStore: computed field \`${t.path}\` requires explicit computedDependsOn in v4.`);if(t.dependsOn.includes(t.path))throw new Error(`BitStore: computed field \`${t.path}\` cannot depend on itself.`)}}, _class);var H= (_class2 =class{constructor() { _class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this); }__init8() {this.dirtyPaths=new Set}__init9() {this.dirtyPathIndex=new Set}__init10() {this.dirtyPrefixRefCount=new Map}__init11() {this.childrenByPrefix=new Map}updateForPath(t,e,i){this.removeDirtyChildren(t);let s=_chunkVBX5I5XGcjs.f.call(void 0, e,t),n=_chunkVBX5I5XGcjs.f.call(void 0, i,t);return _chunkVBX5I5XGcjs.c.call(void 0, s,n)?this.removeDirtyPath(t):this.addDirtyPath(t),this.dirtyPaths.size>0}rebuild(t,e){return this.dirtyPaths=_chunkVBX5I5XGcjs.e.call(void 0, t,e),this.dirtyPrefixRefCount.clear(),this.rebuildIndex(),this.dirtyPaths.size>0}clear(){this.dirtyPaths.clear(),this.dirtyPathIndex.clear(),this.dirtyPrefixRefCount.clear(),this.childrenByPrefix.clear()}get isDirty(){return this.dirtyPaths.size>0}getDirtyPaths(){return this.dirtyPaths}isPathDirty(t){if(this.dirtyPathIndex.has(t))return!0;let e=t.lastIndexOf(".");for(;e>-1;){let i=t.slice(0,e);if((_nullishCoalesce(this.dirtyPrefixRefCount.get(i), () => (0)))>0)return!0;e=t.lastIndexOf(".",e-1)}return!1}buildDirtyValues(t){if(this.dirtyPaths.size===0)return{};let e=[],i=[...this.dirtyPaths].sort(),s=new Set,n=new Set,a=o=>{let c=o.lastIndexOf(".");for(;c>-1;){if(n.has(o.slice(0,c)))return!0;c=o.lastIndexOf(".",c-1)}return!1};for(let o of i){if(a(o))continue;let c=o.match(/^(.+)\.\d+/);if(c){let u=c[1];if(s.has(u))continue;s.add(u);let l=_chunkVBX5I5XGcjs.f.call(void 0, t,u);e.push([u,l]),n.add(u)}else{let u=_chunkVBX5I5XGcjs.f.call(void 0, t,o);e.push([o,u]),n.add(o)}}return e.length===0?{}:_chunkVBX5I5XGcjs.h.call(void 0, {},e)}rebuildIndex(){let t=new Set,e=new Map,i=new Map;for(let s of this.dirtyPaths)this.forEachPathPrefix(s,n=>{t.add(n),e.set(n,(_nullishCoalesce(e.get(n), () => (0)))+1)}),this.forEachAncestorPrefix(s,n=>{let a=i.get(n);a?a.add(s):i.set(n,new Set([s]))});this.dirtyPathIndex=t,this.dirtyPrefixRefCount=e,this.childrenByPrefix=i}removeDirtyChildren(t){let e=this.childrenByPrefix.get(t);if(!(!e||e.size===0))for(let i of[...e])this.removeDirtyPath(i)}addDirtyPath(t){this.dirtyPaths.has(t)||(this.dirtyPaths.add(t),this.forEachPathPrefix(t,e=>{this.dirtyPathIndex.add(e),this.dirtyPrefixRefCount.set(e,(_nullishCoalesce(this.dirtyPrefixRefCount.get(e), () => (0)))+1)}),this.forEachAncestorPrefix(t,e=>{let i=this.childrenByPrefix.get(e);i?i.add(t):this.childrenByPrefix.set(e,new Set([t]))}))}removeDirtyPath(t){this.dirtyPaths.has(t)&&(this.dirtyPaths.delete(t),this.forEachPathPrefix(t,e=>{let i=(_nullishCoalesce(this.dirtyPrefixRefCount.get(e), () => (0)))-1;if(i<=0){this.dirtyPrefixRefCount.delete(e),this.dirtyPathIndex.delete(e);return}this.dirtyPrefixRefCount.set(e,i)}),this.forEachAncestorPrefix(t,e=>{_optionalChain([this, 'access', _8 => _8.childrenByPrefix, 'access', _9 => _9.get, 'call', _10 => _10(e), 'optionalAccess', _11 => _11.delete, 'call', _12 => _12(t)])}))}forEachPathPrefix(t,e){let i=t.split("."),s="";for(let n of i)s=s?`${s}.${n}`:n,e(s)}forEachAncestorPrefix(t,e){let i=t.split("."),s="";for(let n=0;n<i.length-1;n++)s=s?`${s}.${i[n]}`:i[n],e(s)}}, _class2);var z= (_class3 =class{constructor() { _class3.prototype.__init12.call(this); }__init12() {this.masks=new Map}registerMask(t,e){this.masks.set(t,e)}unregisterMask(t){this.masks.has(t)&&this.masks.delete(t)}resolveMask(t){return this.masks.get(t)}getAllMasks(){return Object.fromEntries(this.masks.entries())}clear(){this.masks.clear()}}, _class3);function ei(r){return r.replace(/\.+$/g,"")}function C(r){return ei(r.trim())}function P(r,t){let e=C(t);return e.length===0?!1:r===e||r.startsWith(`${e}.`)}function Pt(r,t){return C(t===void 0?r:`${r}.${t}`)}var q= (_class4 =class{constructor() { _class4.prototype.__init13.call(this);_class4.prototype.__init14.call(this);_class4.prototype.__init15.call(this);_class4.prototype.__init16.call(this);_class4.prototype.__init17.call(this); }__init13() {this.fieldConfigs=new Map}__init14() {this.scopeFieldsIndex=null}__init15() {this.computedEntriesCache=null}__init16() {this.normalizerEntriesCache=null}__init17() {this.transformEntriesCache=null}get(t){return this.fieldConfigs.get(t)}set(t,e){this.fieldConfigs.set(t,e),this.registerCachedIndexes(t,e)}delete(t){let e=this.fieldConfigs.get(t);return this.fieldConfigs.delete(t),this.unregisterCachedIndexes(t,e),e}has(t){return this.fieldConfigs.has(t)}forEach(t){this.fieldConfigs.forEach((e,i)=>t(e,i))}entries(){return Array.from(this.fieldConfigs.entries())}getScopeFields(t){if(!this.scopeFieldsIndex){let e=new Map;this.forEach((i,s)=>{if(!i.scope)return;let n=_nullishCoalesce(e.get(i.scope), () => (new Set));n.add(s),e.set(i.scope,n)}),this.scopeFieldsIndex=e}return Array.from(_nullishCoalesce(this.scopeFieldsIndex.get(t), () => ([])))}getComputedEntries(){if(!this.computedEntriesCache){let t=[];this.forEach((e,i)=>{e.computed&&t.push({path:i,compute:e.computed,dependsOn:e.computedDependsOn})}),this.computedEntriesCache=t}return this.computedEntriesCache}getTransformEntries(){if(!this.transformEntriesCache){let t=[];this.forEach((e,i)=>{e.transform&&t.push([i,e.transform])}),this.transformEntriesCache=t}return this.transformEntriesCache}getNormalizerEntries(){if(!this.normalizerEntriesCache){let t=[];this.forEach((e,i)=>{e.normalize&&t.push({path:i,normalize:e.normalize,dependsOn:_optionalChain([e, 'access', _13 => _13.normalizeDependsOn, 'optionalAccess', _14 => _14.length])?e.normalizeDependsOn:[i]})}),this.normalizerEntriesCache=t}return this.normalizerEntriesCache}invalidateIndexes(){this.scopeFieldsIndex=null,this.computedEntriesCache=null,this.normalizerEntriesCache=null,this.transformEntriesCache=null}registerCachedIndexes(t,e){if(this.scopeFieldsIndex&&e.scope){let i=_nullishCoalesce(this.scopeFieldsIndex.get(e.scope), () => (new Set));i.add(t),this.scopeFieldsIndex.set(e.scope,i)}this.computedEntriesCache&&e.computed&&this.computedEntriesCache.push({path:t,compute:e.computed,dependsOn:e.computedDependsOn}),this.normalizerEntriesCache&&e.normalize&&this.normalizerEntriesCache.push({path:t,normalize:e.normalize,dependsOn:_optionalChain([e, 'access', _15 => _15.normalizeDependsOn, 'optionalAccess', _16 => _16.length])?e.normalizeDependsOn:[t]}),this.transformEntriesCache&&e.transform&&this.transformEntriesCache.push([t,e.transform])}unregisterCachedIndexes(t,e){if(!e){this.invalidateIndexes();return}if(this.scopeFieldsIndex&&e.scope){let i=this.scopeFieldsIndex.get(e.scope);i&&(i.delete(t),i.size>0?this.scopeFieldsIndex.set(e.scope,i):this.scopeFieldsIndex.delete(e.scope))}this.computedEntriesCache&&e.computed&&(this.computedEntriesCache=this.computedEntriesCache.filter(i=>i.path!==t)),this.normalizerEntriesCache&&e.normalize&&(this.normalizerEntriesCache=this.normalizerEntriesCache.filter(i=>i.path!==t)),this.transformEntriesCache&&e.transform&&(this.transformEntriesCache=this.transformEntriesCache.filter(([i])=>i!==t))}}, _class4);var U= (_class5 =class{constructor(t,e){;_class5.prototype.__init18.call(this);_class5.prototype.__init19.call(this);_class5.prototype.__init20.call(this);_class5.prototype.__init21.call(this);_class5.prototype.__init22.call(this);_class5.prototype.__init23.call(this);_class5.prototype.__init24.call(this);this.getFieldConfig=t;this.onConditionError=e}__init18() {this.dependencies=new Map}__init19() {this.hiddenFields=new Set}__init20() {this.conditionalVisibilityPaths=new Set}__init21() {this.requiredPathsByDependency=new Map}__init22() {this.requiredConditionalPaths=new Set}__init23() {this.requiredEvaluationVersion=0}__init24() {this.requiredEvaluationCache=new Map}getHiddenFields(){return this.hiddenFields}onRegister(t,e,i){_optionalChain([e, 'access', _17 => _17.conditional, 'optionalAccess', _18 => _18.showIf])&&this.conditionalVisibilityPaths.add(t);let s=_optionalChain([e, 'access', _19 => _19.conditional, 'optionalAccess', _20 => _20.dependsOn]);s&&s.forEach(n=>{this.dependencies.has(n)||this.dependencies.set(n,new Set),this.dependencies.get(n).add(t)}),s&&_optionalChain([e, 'access', _21 => _21.conditional, 'optionalAccess', _22 => _22.requiredIf])&&(this.requiredConditionalPaths.add(t),s.forEach(n=>{this.requiredPathsByDependency.has(n)||this.requiredPathsByDependency.set(n,new Set),this.requiredPathsByDependency.get(n).add(t)})),this.requiredEvaluationVersion+=1,this.requiredEvaluationCache.clear(),this.evaluateFieldCondition(t,i)}onUnregister(t,e){this.hiddenFields.delete(t),this.conditionalVisibilityPaths.delete(t),this.dependencies.delete(t),this.requiredEvaluationVersion+=1,this.requiredEvaluationCache.clear(),this.requiredConditionalPaths.delete(t),_optionalChain([e, 'optionalAccess', _23 => _23.conditional, 'optionalAccess', _24 => _24.dependsOn, 'optionalAccess', _25 => _25.forEach, 'call', _26 => _26(i=>{let s=this.requiredPathsByDependency.get(i);s&&(s.delete(t),s.size===0&&this.requiredPathsByDependency.delete(i))})]),this.dependencies.forEach(i=>{i.delete(t)})}isHidden(t){return this.hiddenFields.has(t)}hasDependents(t){return(_nullishCoalesce(_optionalChain([this, 'access', _27 => _27.dependencies, 'access', _28 => _28.get, 'call', _29 => _29(t), 'optionalAccess', _30 => _30.size]), () => (0)))>0}isRequired(t,e){let i=this.getFieldConfig(t);if(!i||this.isHidden(t)||!_optionalChain([i, 'access', _31 => _31.conditional, 'optionalAccess', _32 => _32.requiredIf]))return!1;let s=this.requiredEvaluationCache.get(t);if(s&&s.version===this.requiredEvaluationVersion&&s.valuesRef===e)return s.result;let n=!1;try{n=!!i.conditional.requiredIf(e)}catch(a){_optionalChain([this, 'access', _33 => _33.onConditionError, 'optionalCall', _34 => _34({path:t,kind:"requiredIf",error:a})])}return this.requiredEvaluationCache.set(t,{version:this.requiredEvaluationVersion,valuesRef:e,result:n}),n}getRequiredErrors(t){let e={};return this.requiredConditionalPaths.forEach(i=>{let s=this.getFieldConfig(i);if(s&&this.isRequired(i,t)){let n=_chunkVBX5I5XGcjs.f.call(void 0, t,i);this.isEmpty(n)&&(e[i]=_nullishCoalesce(_optionalChain([s, 'access', _35 => _35.conditional, 'optionalAccess', _36 => _36.requiredMessage]), () => ("required field")))}}),e}evaluateAll(t){this.conditionalVisibilityPaths.forEach(e=>{this.evaluateFieldCondition(e,t)})}updateDependencies(t,e,i){let s=new Set,n=new Set,a=new Set,o=[t],c=new Set;for(;o.length>0;){let u=o.shift();if(c.has(u))continue;c.add(u);let l=this.dependencies.get(u);l&&l.forEach(d=>{s.add(d);let p=this.isHidden(d),h=this.isRequired(d,e);this.evaluateFieldCondition(d,i);let m=this.isHidden(d),B=this.isRequired(d,i);p!==m&&n.add(d),h!==B&&a.add(d),o.push(d)})}return{affectedFields:Array.from(s),visibilityChanged:Array.from(n),requiredChanged:Array.from(a)}}evaluateFieldCondition(t,e){let s=_optionalChain([this, 'access', _37 => _37.getFieldConfig, 'call', _38 => _38(t), 'optionalAccess', _39 => _39.conditional, 'optionalAccess', _40 => _40.showIf]);if(s)try{s(e)?this.hiddenFields.delete(t):this.hiddenFields.add(t)}catch(n){_optionalChain([this, 'access', _41 => _41.onConditionError, 'optionalCall', _42 => _42({path:t,kind:"showIf",error:n})])}}isEmpty(t){return t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0}}, _class5);var L= (_class6 =class{__init25() {this.catalog=new q}constructor(t){;_class6.prototype.__init25.call(this);this.conditions=new U(e=>this.catalog.get(e),t)}getFieldConfig(t){return this.catalog.get(t)}forEachFieldConfig(t){this.catalog.forEach((e,i)=>t(e,i))}hasFieldConfig(t){return this.catalog.has(t)}getHiddenFields(){return this.conditions.getHiddenFields()}register(t,e,i){this.catalog.set(t,e),this.conditions.onRegister(t,e,i)}unregister(t){let e=this.catalog.delete(t);this.conditions.onUnregister(t,e)}unregisterPrefix(t){let e=[],i=C(t);return i.length===0||(this.catalog.forEach((s,n)=>{P(n,i)&&e.push([n,s])}),e.forEach(([s,n])=>{this.catalog.delete(s),this.conditions.onUnregister(s,n)})),e}isHidden(t){return this.conditions.isHidden(t)}hasDependents(t){return this.conditions.hasDependents(t)}isRequired(t,e){return this.conditions.isRequired(t,e)}getRequiredErrors(t){return this.conditions.getRequiredErrors(t)}evaluateAll(t){this.conditions.evaluateAll(t)}updateDependencies(t,e,i){return this.conditions.updateDependencies(t,e,i)}getScopeFields(t){return this.catalog.getScopeFields(t)}getComputedEntries(){return this.catalog.getComputedEntries()}getTransformEntries(){return this.catalog.getTransformEntries()}getNormalizerEntries(){return this.catalog.getNormalizerEntries()}invalidateIndexes(){this.catalog.invalidateIndexes()}}, _class6);function ii(){return`bit-form-${Math.random().toString(36).slice(2,9)}`}function ri(r){typeof console<"u"&&typeof console.error=="function"&&console.error(r)}function Lt(r={}){let t=_nullishCoalesce(r.initialValues, () => ({})),e=r.validation,i=r.history,s=r.name?`bit-form:${r.name}:draft`:"bit-form:draft",n=_nullishCoalesce(r.onUnhandledError, () => (ri)),a=_optionalChain([r, 'access', _43 => _43.persist, 'optionalAccess', _44 => _44.onError]),o={enabled:_nullishCoalesce(_optionalChain([r, 'access', _45 => _45.persist, 'optionalAccess', _46 => _46.enabled]), () => (!1)),key:_nullishCoalesce(_optionalChain([r, 'access', _47 => _47.persist, 'optionalAccess', _48 => _48.key]), () => (s)),storage:_optionalChain([r, 'access', _49 => _49.persist, 'optionalAccess', _50 => _50.storage]),autoSave:_nullishCoalesce(_optionalChain([r, 'access', _51 => _51.persist, 'optionalAccess', _52 => _52.autoSave]), () => (!0)),debounceMs:_nullishCoalesce(_optionalChain([r, 'access', _53 => _53.persist, 'optionalAccess', _54 => _54.debounceMs]), () => (300)),mode:_nullishCoalesce(_optionalChain([r, 'access', _55 => _55.persist, 'optionalAccess', _56 => _56.mode]), () => ("values")),serialize:_nullishCoalesce(_optionalChain([r, 'access', _57 => _57.persist, 'optionalAccess', _58 => _58.serialize]), () => (JSON.stringify)),deserialize:_nullishCoalesce(_optionalChain([r, 'access', _59 => _59.persist, 'optionalAccess', _60 => _60.deserialize]), () => ((c=>JSON.parse(c)))),onError:c=>{if(a){a(c);return}n(c,"persist")}};return{name:r.name,initialValues:_chunkVBX5I5XGcjs.a.call(void 0, t),resolver:_optionalChain([e, 'optionalAccess', _61 => _61.resolver]),validationDelay:_nullishCoalesce(_optionalChain([e, 'optionalAccess', _62 => _62.delay]), () => (300)),history:{enabled:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _63 => _63.enabled]), () => (!1)),limit:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _64 => _64.limit]), () => (50))},masks:r.masks,fields:r.fields,devTools:r.devTools,persist:o,idFactory:_nullishCoalesce(r.idFactory, () => (ii)),plugins:_nullishCoalesce(r.plugins, () => ([])),scheduler:r.scheduler,subscriptionCacheSize:r.subscriptionCacheSize,trackedSubscriptions:_nullishCoalesce(r.trackedSubscriptions, () => (!1)),bus:r.bus,onUnhandledError:n}}function _(r,t){if((!r||r.length===0)&&(!t||t.length===0))return;let e=new Set(_nullishCoalesce(r, () => ([])));return _optionalChain([t, 'optionalAccess', _65 => _65.forEach, 'call', _66 => _66(i=>e.add(i))]),Array.from(e)}function _t(r){let{values:t,entries:e,deriveValue:i}=r,s=[];for(let n of e){let a=_chunkVBX5I5XGcjs.f.call(void 0, t,n.path),o=i(n,a);_chunkVBX5I5XGcjs.c.call(void 0, a,o)||s.push([n.path,o])}return s}function si(r){let t=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _67 => _67.includes, 'call', _68 => _68("*")]), () => (!1)),e=new Set(_nullishCoalesce(r, () => ([]))),i=new Set;for(let s of e){i.add(s);let n=s.lastIndexOf(".");for(;n>-1;)i.add(s.slice(0,n)),n=s.lastIndexOf(".",n-1)}return s=>{if(!r||r.length===0||t||e.has(s)||i.has(s))return!0;let n=s.lastIndexOf(".");for(;n>-1;){if(e.has(s.slice(0,n)))return!0;n=s.lastIndexOf(".",n-1)}return!1}}function ni(r,t){if(!t||t.length===0||t.includes("*"))return r;let e=si(t);return r.filter(i=>i.dependsOn.some(s=>e(s)))}function N(r){let{values:t,changedPaths:e,normalizerEntries:i,applyComputed:s}=r,n=ni(i,e);if(n.length===0)return s(t,e);let a=_t({values:t,entries:n,deriveValue:(u,l)=>u.normalize(l,t)}),o=a.length>0?_chunkVBX5I5XGcjs.h.call(void 0, t,a):t,c=_(e,a.map(([u])=>u));return s(o,c)}function Nt(r){let{values:t,sourceValues:e,transformEntries:i}=r;if(i.length===0)return t;let s=_t({values:t,entries:i.map(([n,a])=>({path:n,transform:a})),deriveValue:(n,a)=>n.transform(a,e)});return s.length===0?t:_chunkVBX5I5XGcjs.h.call(void 0, t,s)}var W=class{constructor(t){this.effects=t.getAll()}attachStorePort(t){this.effects.forEach(e=>_optionalChain([e, 'access', _69 => _69.attachStorePort, 'optionalCall', _70 => _70(t)]))}initialize(){this.effects.forEach(t=>_optionalChain([t, 'access', _71 => _71.initialize, 'optionalCall', _72 => _72()]))}onStateUpdated(t,e){this.effects.forEach(i=>_optionalChain([i, 'access', _73 => _73.onStateUpdated, 'optionalCall', _74 => _74(t,e)]))}async restorePersisted(){let t=!1;for(let e of this.effects)e.restorePersisted&&(t=await e.restorePersisted()||t);return t}async savePersistedNow(){for(let t of this.effects)t.savePersistedNow&&await t.savePersistedNow()}async clearPersisted(){for(let t of this.effects)t.clearPersisted&&await t.clearPersisted()}async beforeValidate(t){for(let e of this.effects)if(e.beforeValidate)try{await e.beforeValidate(t)}catch(i){this.logEffectHookError(e.name,"beforeValidate",i)}}async afterValidate(t){for(let e of this.effects)if(e.afterValidate)try{await e.afterValidate(t)}catch(i){this.logEffectHookError(e.name,"afterValidate",i)}}async beforeSubmit(t){for(let e of this.effects)if(e.beforeSubmit)try{await e.beforeSubmit(t)}catch(i){this.logEffectHookError(e.name,"beforeSubmit",i)}}async afterSubmit(t){for(let e of this.effects)if(e.afterSubmit)try{await e.afterSubmit(t)}catch(i){this.logEffectHookError(e.name,"afterSubmit",i)}}onFieldChange(t){this.effects.forEach(e=>_optionalChain([e, 'access', _75 => _75.onFieldChange, 'optionalCall', _76 => _76(t)]))}async reportOperationalError(t){for(let e of this.effects)e.reportOperationalError&&await e.reportOperationalError(t)}logEffectHookError(t,e,i){console.error(`BitStoreEffectEngine: effect "${t}" failed in hook "${e}"`,i)}destroy(){for(let t=this.effects.length-1;t>=0;t-=1)_optionalChain([this, 'access', _77 => _77.effects, 'access', _78 => _78[t], 'access', _79 => _79.destroy, 'optionalCall', _80 => _80()])}};var K=class{constructor(t,e,i=!0,s){this.storeId=t;this.bus=e;this.enableBusDispatch=i;this.storeBusPort=s}attachStorePort(t){this.storeBusPort=t,this.enableBusDispatch&&(this.bus.stores[this.storeId]=t)}initialize(){!this.enableBusDispatch||!this.storeBusPort||(this.bus.stores[this.storeId]=this.storeBusPort)}onStateUpdated(t){this.enableBusDispatch&&this.bus.dispatch(this.storeId,t)}destroy(){this.enableBusDispatch&&delete this.bus.stores[this.storeId]}};var $= (_class7 =class{constructor() { _class7.prototype.__init26.call(this); }__init26() {this.effects=new Map}register(t){this.effects.set(t.name,t)}getAll(){return Array.from(this.effects.values())}}, _class7);var J=class{constructor(t){this.persistManager=t}onStateUpdated(t,e){e&&this.persistManager.queueSave()}restorePersisted(){return this.persistManager.restore()}savePersistedNow(){return this.persistManager.saveNow()}clearPersisted(){return this.persistManager.clear()}destroy(){this.persistManager.destroy()}};var G=class{constructor(t){this.pluginManager=t}initialize(){this.pluginManager.setupAll()}beforeValidate(t){return this.pluginManager.beforeValidate(t)}afterValidate(t){return this.pluginManager.afterValidate(t)}beforeSubmit(t){return this.pluginManager.beforeSubmit(t)}afterSubmit(t){return this.pluginManager.afterSubmit(t)}onFieldChange(t){this.pluginManager.onFieldChange(t)}reportOperationalError(t){return this.pluginManager.reportError(t.source,t.error,t.payload)}destroy(){this.pluginManager.destroy()}};function ai(){if(typeof globalThis>"u")return;let r=globalThis.localStorage;if(r)return{getItem:t=>r.getItem(t),setItem:(t,e)=>r.setItem(t,e),removeItem:t=>r.removeItem(t)}}var Y=class{constructor(t,e,i,s){this.config=t;this.getValues=e;this.getDirtyValues=i;this.applyRestoredValues=s}getStorage(){return this.config.storage||ai()}canPersist(){return!!(this.config.enabled&&this.config.key&&this.getStorage())}handleError(t){_optionalChain([this, 'access', _81 => _81.config, 'access', _82 => _82.onError, 'optionalCall', _83 => _83(t)])}async saveNow(){if(!this.canPersist())return;let t=this.getStorage();if(t)try{let e=this.config.mode==="dirtyValues"?this.getDirtyValues():this.getValues(),i=this.config.serialize(e);await t.setItem(this.config.key,i)}catch(e){throw this.handleError(e),e}}queueSave(){!this.canPersist()||!this.config.autoSave||(this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.saveNow().catch(()=>{})},this.config.debounceMs))}async restore(){if(!this.canPersist())return!1;let t=this.getStorage();if(!t)return!1;try{let e=await t.getItem(this.config.key);if(!e)return!1;let i=this.config.deserialize(e);return!i||typeof i!="object"?!1:(this.applyRestoredValues(i),!0)}catch(e){return this.handleError(e),!1}}async clear(){if(!this.canPersist())return;let t=this.getStorage();if(t)try{await t.removeItem(this.config.key)}catch(e){this.handleError(e)}}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=void 0)}};var X= (_class8 =class{constructor(t,e){;_class8.prototype.__init27.call(this);_class8.prototype.__init28.call(this);_class8.prototype.__init29.call(this);_class8.prototype.__init30.call(this);this.plugins=t;this.contextFactory=e}__init27() {this.teardownFns=[]}__init28() {this.notifyingError=!1}__init29() {this.pendingErrorQueue=[]}__init30() {this.cachedContext=null}setupAll(){let t=this.getContext();this.plugins.forEach(e=>{if(e.setup)try{let i=e.setup(t);typeof i=="function"&&this.teardownFns.push(i)}catch(i){this.reportError("setup",i,void 0,e.name)}})}async beforeValidate(t){await this.emitHook("beforeValidate",t)}async afterValidate(t){await this.emitHook("afterValidate",t)}async beforeSubmit(t){await this.emitHook("beforeSubmit",t)}async afterSubmit(t){await this.emitHook("afterSubmit",t)}onFieldChange(t){let e=this.getContext();this.plugins.forEach(i=>{let s=_optionalChain([i, 'access', _84 => _84.hooks, 'optionalAccess', _85 => _85.onFieldChange]);if(s)try{let n=s(t,e);Promise.resolve(n).catch(a=>{this.reportError("onFieldChange",a,t,i.name)})}catch(n){this.reportError("onFieldChange",n,t,i.name)}})}async reportError(t,e,i,s){let n=this.getContext();if(this.pendingErrorQueue.push({source:t,pluginName:s,error:e,event:i,values:n.getState().values,state:n.getState()}),!this.notifyingError){this.notifyingError=!0;try{for(;this.pendingErrorQueue.length>0;){let a=this.pendingErrorQueue.shift();if(!a)break;for(let o of this.plugins){let c=_optionalChain([o, 'access', _86 => _86.hooks, 'optionalAccess', _87 => _87.onError]);if(c)try{await c(a,n)}catch (e2){}}}}finally{this.notifyingError=!1}}}destroy(){for(let t=this.teardownFns.length-1;t>=0;t-=1){let e=this.teardownFns[t];try{e()}catch(i){this.reportError("teardown",i)}}this.teardownFns=[],this.cachedContext=null}async emitHook(t,e){let i=this.getContext();for(let s of this.plugins){let n=_optionalChain([s, 'access', _88 => _88.hooks, 'optionalAccess', _89 => _89[t]]);if(n)try{await n(e,i)}catch(a){await this.reportError(t,a,e,s.name)}}}getContext(){return this.cachedContext||(this.cachedContext=this.contextFactory()),this.cachedContext}}, _class8);var xt=typeof globalThis<"u"?globalThis:typeof global<"u"?global:window;xt.__BIT_FORM__||(xt.__BIT_FORM__={stores:{},listeners:new Set,dispatch(r,t){this.listeners.forEach(e=>e(r,t))},subscribe(r){return this.listeners.add(r),()=>{this.listeners.delete(r)}}});var Et=xt.__BIT_FORM__,oi={stores:{},listeners:new Set,dispatch:()=>{},subscribe:()=>()=>{}};function Ct(){return oi}function li(){let r=new Set;return{stores:{},listeners:r,dispatch(t,e){r.forEach(i=>i(t,e))},subscribe(t){return r.add(t),()=>r.delete(t)}}}function ci(r){return r.bus?!0:typeof r.devTools=="boolean"?r.devTools:r.devTools&&typeof r.devTools=="object"?r.devTools.enabled!==!1:!1}function Wt(r){let{storeId:t,storeBusPort:e,config:i,getState:s,getConfig:n,getValues:a,getDirtyValues:o,applyPersistedValues:c}=r,u=new Y(i.persist,a,o,c),l=new X([...i.plugins],()=>({storeId:t,getState:()=>s(),getConfig:()=>n()})),d=ci(i),p=typeof process<"u"&&typeof process.env<"u"&&process.env.VITEST==="true",h=d?_nullishCoalesce(i.bus, () => ((p?Ct():Et))):Ct(),m=new $,B=new J(u);m.register({name:"persist",onStateUpdated:(T,ti)=>B.onStateUpdated(T,ti),restorePersisted:()=>B.restorePersisted(),savePersistedNow:()=>B.savePersistedNow(),clearPersisted:()=>B.clearPersisted(),destroy:()=>B.destroy()});let f=new G(l);m.register({name:"plugins",initialize:()=>f.initialize(),beforeValidate:T=>f.beforeValidate(T),afterValidate:T=>f.afterValidate(T),beforeSubmit:T=>f.beforeSubmit(T),afterSubmit:T=>f.afterSubmit(T),onFieldChange:T=>f.onFieldChange(T),reportOperationalError:T=>f.reportOperationalError(T),destroy:()=>f.destroy()});let S=new K(t,h,d,e);m.register({name:"bus",attachStorePort:T=>S.attachStorePort(T),initialize:()=>S.initialize(),onStateUpdated:T=>S.onStateUpdated(T),destroy:()=>S.destroy()});let E=new W(m);return E.initialize(),E}function g(r,t,e){return{kind:"state.patch",partialState:r,changedPaths:t,skipComputed:_optionalChain([e, 'optionalAccess', _90 => _90.skipComputed])}}function Ft(r){return{kind:"field.touchMany",paths:r}}function x(r){return{kind:"form.persistMeta",patch:r}}function Q(r,t){return{kind:"validation.commit",errors:r,isValid:t}}async function Kt(r){let{dispatch:t,effects:e}=r;t(x({isRestoring:!0,error:null}));try{return await e.restorePersisted()}catch(i){return t(x({isRestoring:!1,error:i instanceof Error?i:new Error(String(i))})),!1}finally{t(x({isRestoring:!1}))}}async function $t(r){let{dispatch:t,effects:e}=r;t(x({isSaving:!0,error:null}));try{await e.savePersistedNow()}catch(i){t(x({isSaving:!1,error:i instanceof Error?i:new Error(String(i))}));return}t(x({isSaving:!1}))}async function Jt(r){let{dispatch:t,effects:e}=r;t(x({error:null}));try{await e.clearPersisted()}catch(i){t(x({error:i instanceof Error?i:new Error(String(i))}))}}function Gt(r){let{values:t,state:e,initialValues:i,validation:s,fieldRegistry:n,dirtyManager:a,dispatch:o,saveHistorySnapshot:c}=r,u=_chunkVBX5I5XGcjs.a.call(void 0, _chunkVBX5I5XGcjs.b.call(void 0, i,t));s.cancelAll(),n.evaluateAll(u);let l=a.rebuild(u,i);o(g({values:u,errors:{},touched:{},isValidating:{},persist:{...e.persist,error:null},isValid:!0,isDirty:l,isSubmitting:!1})),c(),s.validate()}function Yt(r){let{state:t,path:e}=r,i={...t.errors},s={...t.touched},n=!1;return i[e]&&(delete i[e],n=!0),s[e]&&(delete s[e],n=!0),n?{errors:i,touched:s}:null}function Xt(r){let{path:t,config:e,state:i,fieldRegistry:s,subscriptions:n,stateReader:a,invalidateFieldIndexes:o}=r;s.register(t,e,i.values),o(),n.invalidatePathExpansionCache(t),a.invalidatePath(t),e.scope&&n.notify(i,[_chunkRHMJPKNVcjs.d.call(void 0, e.scope)]),s.isHidden(t)&&n.notify(i,[t])}function Qt(r){let{path:t,state:e,hasStaticConfig:i,fieldRegistry:s,subscriptions:n,validationCleanupField:a,invalidateFieldIndexes:o,dispatch:c}=r;if(i)return;let u=s.getFieldConfig(t);a(t),s.unregister(t),o(),n.invalidatePathExpansionCache(t),_optionalChain([u, 'optionalAccess', _91 => _91.scope])&&n.notify(e,[_chunkRHMJPKNVcjs.d.call(void 0, u.scope)]);let l=Yt({state:e,path:t});l&&c(g({errors:l.errors,touched:l.touched}))}function Z(r){let{prefix:t,state:e,fieldRegistry:i,subscriptions:s,validationCleanupPrefix:n,invalidateFieldIndexes:a}=r;n(t);let o=i.unregisterPrefix(t);a(),s.invalidatePathExpansionCache(t),new Set(o.map(([,u])=>u.scope).filter(u=>!!u)).forEach(u=>{s.notify(e,[_chunkRHMJPKNVcjs.d.call(void 0, u)])})}var tt= (_class9 =class{constructor(t,e=500){;_class9.prototype.__init31.call(this);_class9.prototype.__init32.call(this);_class9.prototype.__init33.call(this);_class9.prototype.__init34.call(this);_class9.prototype.__init35.call(this);_class9.prototype.__init36.call(this);_class9.prototype.__init37.call(this);_class9.prototype.__init38.call(this);_class9.prototype.__init39.call(this);this.getState=t;this.MAX_PATH_EXPANSION_CACHE_SIZE=e}__init31() {this.listeners=new Set}__init32() {this.pathScopedSubscriptions=new Map}__init33() {this.pathSelectorIndex=new Map}__init34() {this.pathExpansionCache=new Map}__init35() {this.subscriptionSeenVersion=new Map}__init36() {this.notifyVersion=0}__init37() {this.cacheHits=0}__init38() {this.cacheMisses=0}__init39() {this.cacheEvictions=0}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}subscribeSelector(t,e,i,s){let n=t(this.getState()),a={notify:c=>{let u=t(c);s(n,u)||(n=u,e(u))}},o=this.normalizeSubscriptionPaths(i.paths);return this.pathScopedSubscriptions.set(a,o),o.forEach(c=>{this.forEachIndexPath(c,u=>{let l=_nullishCoalesce(this.pathSelectorIndex.get(u), () => (new Set));l.add(a),this.pathSelectorIndex.set(u,l)})}),i.emitImmediately&&e(n),()=>{this.subscriptionSeenVersion.delete(a);let c=this.pathScopedSubscriptions.get(a);c&&(c.forEach(u=>{this.forEachIndexPath(u,l=>{let d=this.pathSelectorIndex.get(l);d&&(d.delete(a),d.size===0&&this.pathSelectorIndex.delete(l))})}),this.pathScopedSubscriptions.delete(a))}}notify(t,e){if(this.listeners.forEach(n=>n()),this.pathScopedSubscriptions.size===0)return;let i=this.normalizeChangedPathIterable(e);if(i.length===0||i.includes("*")){this.pathScopedSubscriptions.forEach((n,a)=>{a.notify(t)});return}if(i.length===1&&this.isSimplePath(i[0])){this.collectSubscribersForSingleChangedPath(i[0]).forEach(a=>{a.notify(t)});return}this.collectSubscribersForChangedPaths(i).forEach(n=>{n.notify(t)})}destroy(){this.listeners.clear(),this.pathScopedSubscriptions.clear(),this.pathSelectorIndex.clear(),this.pathExpansionCache.clear(),this.subscriptionSeenVersion.clear()}getPathExpansionCacheStats(){return{cacheSize:this.pathExpansionCache.size,cacheLimit:this.MAX_PATH_EXPANSION_CACHE_SIZE,cacheHits:this.cacheHits,cacheMisses:this.cacheMisses,cacheEvictions:this.cacheEvictions}}getActiveSubscribersCount(){return this.pathScopedSubscriptions.size}invalidatePathExpansionCache(t){if(!t){this.pathExpansionCache.clear();return}let e=C(t);if(e.length===0){this.pathExpansionCache.clear();return}for(let i of this.pathExpansionCache.keys())(P(i,e)||P(e,i))&&this.pathExpansionCache.delete(i)}normalizeSubscriptionPaths(t){if(!t||t.length===0)return[];let e=new Set,i=[];for(let s of t){let n=s.trim();n.length===0||e.has(n)||(e.add(n),i.push(n))}return i}normalizeChangedPathIterable(t){if(!t)return[];let e=new Set,i=[];for(let s of t){let n=s.trim();n.length===0||e.has(n)||(e.add(n),i.push(n))}return i}collectSubscribersForChangedPaths(t){let e=[],i=++this.notifyVersion,s=n=>{let a=this.pathSelectorIndex.get(n);a&&a.forEach(o=>{(_nullishCoalesce(this.subscriptionSeenVersion.get(o), () => (0)))>=i||(this.subscriptionSeenVersion.set(o,i),e.push(o))})};return t.forEach(n=>{this.forEachLookupPath(n,s)}),e}collectSubscribersForSingleChangedPath(t){let e=[],i=++this.notifyVersion,s=n=>{let a=this.pathSelectorIndex.get(n);a&&a.forEach(o=>{(_nullishCoalesce(this.subscriptionSeenVersion.get(o), () => (0)))>=i||(this.subscriptionSeenVersion.set(o,i),e.push(o))})};return this.forEachLookupPath(t,s),e}expandChangedPathForLookup(t){return this.expandPathGeneric(t)}expandPathForIndexing(t){return this.expandPathGeneric(t)}forEachIndexPath(t,e){if(!this.isSimplePath(t)){this.expandPathForIndexing(t).forEach(e);return}let i=t.split("."),s="";for(let n=0;n<i.length;n+=1)s=s?`${s}.${i[n]}`:i[n],e(s)}forEachLookupPath(t,e){if(!this.isSimplePath(t)){this.expandChangedPathForLookup(t).forEach(e);return}e(t);let i=t.lastIndexOf(".");for(;i>-1;)e(t.slice(0,i)),i=t.lastIndexOf(".",i-1)}isSimplePath(t){return!t.includes("*")&&!t.includes("[")&&!t.includes("]")}expandPathGeneric(t){let e=this.pathExpansionCache.get(t);if(e)return this.cacheHits+=1,e;this.cacheMisses+=1;let i=t.split("."),s=[];for(let n=1;n<=i.length;n++)s.push(i.slice(0,n).join("."));return this.setBoundedCacheEntry(this.pathExpansionCache,t,s,this.MAX_PATH_EXPANSION_CACHE_SIZE),s}setBoundedCacheEntry(t,e,i,s){if(t.size>=s){let n=t.keys().next().value;n!==void 0&&(t.delete(n),this.cacheEvictions+=1)}t.set(e,i)}}, _class9);function Zt(r){let t=[],e=new Map,i=new Set(r.map(o=>o.path));for(let o of r)if(e.has(o.path)||e.set(o.path,new Set),o.dependsOn)for(let c of o.dependsOn)i.has(c)&&e.get(o.path).add(c);let s=new Set,n=new Set,a=(o,c)=>{s.add(o),n.add(o),c.push(o);let u=e.get(o)||new Set;for(let l of u)if(s.has(l)){if(n.has(l)){let d=c.indexOf(l),p=[...c.slice(d),l];return{cycle:p,paths:Array.from(e.keys()).filter(h=>p.includes(h)),message:`Circular dependency detected: ${p.join(" \u2192 ")}. Check your computed field definitions.`}}}else{let d=a(l,[...c]);if(d)return d}return n.delete(o),null};for(let o of e.keys())if(!s.has(o)){let c=a(o,[]);c&&!t.some(u=>u.message===c.message)&&t.push(c)}return t}var et= (_class10 =class{constructor(t){;_class10.prototype.__init40.call(this);this.store=t}__init40() {this.pathIds=new Map}getItemIds(t,e){let i=typeof e=="number"?Math.max(0,e):this.getCurrentArrayLength(t);return[...this.ensureIds(t,i)]}pushItem(t,e){this.withPathIds(t,i=>(i.push(this.store.createArrayItemId(t,i.length)),i)),this.mutateArrayWithSetField(t,i=>[...i,e],{origin:"array",operation:"push"})}prependItem(t,e){this.withPathIds(t,i=>(i.unshift(this.store.createArrayItemId(t,0)),i)),this.mutateArrayWithSetField(t,i=>[e,...i],{origin:"array",operation:"prepend"})}insertItem(t,e,i){let s=this.getCurrentArrayLength(t),n=Math.max(0,Math.min(e,s));this.withPathIds(t,a=>{let o=[...a];return o.splice(n,0,this.store.createArrayItemId(t,n)),o}),this.mutateArrayWithSetField(t,a=>{let o=[...a];return o.splice(n,0,i),o},{origin:"array",operation:"insert",index:n})}removeItem(t,e){let i=this.store.getState(),s=_chunkVBX5I5XGcjs.f.call(void 0, i.values,t);if(!Array.isArray(s)||e<0||e>=s.length)return;this.withPathIds(t,a=>{let o=[...a];return o.splice(e,1),o}),this.store.unregisterPrefix&&this.store.unregisterPrefix(Pt(t,e));let n=s.filter((a,o)=>o!==e);this.commitArrayMutationWithFieldPipeline({path:t,nextArray:n,meta:{origin:"array",operation:"remove",index:e},reindex:a=>a===e?null:a>e?a-1:a})}swapItems(t,e,i){let s=this.store.getState(),n=_chunkVBX5I5XGcjs.f.call(void 0, s.values,t);if(!Array.isArray(n)||e<0||e>=n.length||i<0||i>=n.length)return;this.withPathIds(t,o=>{let c=[...o];return[c[e],c[i]]=[c[i],c[e]],c});let a=[...n];[a[e],a[i]]=[a[i],a[e]],this.commitArrayMutationWithFieldPipeline({path:t,nextArray:a,meta:{origin:"array",operation:"swap",from:e,to:i},reindex:o=>o===e?i:o===i?e:o})}moveItem(t,e,i){let s=this.store.getState(),n=_chunkVBX5I5XGcjs.f.call(void 0, s.values,t);if(!Array.isArray(n)||e<0||e>=n.length||i<0||i>=n.length)return;this.withPathIds(t,c=>{let u=[...c],[l]=u.splice(e,1);return u.splice(i,0,l),u});let a=[...n],[o]=a.splice(e,1);a.splice(i,0,o),this.commitArrayMutationWithFieldPipeline({path:t,nextArray:a,meta:{origin:"array",operation:"move",from:e,to:i},reindex:c=>c===e?i:e<i&&c>e&&c<=i?c-1:e>i&&c>=i&&c<e?c+1:c})}replaceItems(t,e){this.pathIds.set(t,e.map((i,s)=>this.store.createArrayItemId(t,s))),this.commitArrayMutationWithFieldPipeline({path:t,nextArray:e,meta:{origin:"array",operation:"replace"},reindex:i=>i<e.length?i:null})}clearItems(t){this.pathIds.set(t,[]),this.store.unregisterPrefix&&this.store.unregisterPrefix(Pt(t)),this.commitArrayMutationWithFieldPipeline({path:t,nextArray:[],meta:{origin:"array",operation:"clear"},reindex:()=>null})}mutateArrayWithSetField(t,e,i){let s=_chunkVBX5I5XGcjs.f.call(void 0, this.store.getState().values,t)||[];this.store.setFieldWithMeta(t,e(s),i),this.store.internalSaveSnapshot()}withPathIds(t,e){let i=this.getCurrentArrayLength(t),s=this.ensureIds(t,i);this.pathIds.set(t,e(s))}ensureIds(t,e){let i=_nullishCoalesce(this.pathIds.get(t), () => ([]));if(i.length===e)return i;if(i.length<e){let n=[...i];for(let a=i.length;a<e;a+=1)n.push(this.store.createArrayItemId(t,a));return this.pathIds.set(t,n),n}let s=i.slice(0,e);return this.pathIds.set(t,s),s}getCurrentArrayLength(t){let e=_chunkVBX5I5XGcjs.f.call(void 0, this.store.getState().values,t);return Array.isArray(e)?e.length:0}commitArrayMutationWithFieldPipeline(t){let{path:e,nextArray:i,meta:s,reindex:n}=t,a=this.store.getState();this.store.setFieldWithMeta(e,i,s);let o=_chunkVBX5I5XGcjs.k.call(void 0, a,e,n);this.store.dispatch(g({errors:o.errors,touched:o.touched,isValidating:o.isValidating},[e])),this.store.internalSaveSnapshot()}}, _class10);var it=class{constructor(t,e,i){this.getState=t;this.dispatch=e;this.reportError=i}reportInvalidInput(t,e){_optionalChain([this, 'access', _92 => _92.reportError, 'optionalCall', _93 => _93(new Error(e===void 0?t:`${t}: ${String(e)}`))])}setError(t,e){if(!t||typeof t!="string"){this.reportInvalidInput("setError received an invalid path",t);return}if(e!==void 0&&typeof e!="string"){this.reportInvalidInput("setError received an invalid message",e);return}let i={...this.getState().errors,[t]:e};e||delete i[t],this.dispatch(g({errors:i}))}setErrors(t){if(!t||typeof t!="object"){this.reportInvalidInput("setErrors received an invalid payload");return}let e={};Object.entries(t).forEach(([i,s])=>{if(!i){this.reportInvalidInput("setErrors ignored an empty path");return}if(s!==void 0&&typeof s!="string"){this.reportInvalidInput("setErrors ignored a non-string message",i);return}e[i]=s}),this.dispatch(g({errors:{...this.getState().errors,...e}}))}setServerErrors(t,e){let i=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _94 => _94.arrayStrategy]), () => ("first")),s=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _95 => _95.joinSeparator]), () => ("; ")),n={};for(let[a,o]of Object.entries(t)){if(!a){this.reportInvalidInput("setServerErrors ignored an empty path");continue}if(Array.isArray(o)){let c=o.filter(u=>typeof u=="string"&&u.length>0);if(c.length===0)continue;n[a]=i==="join"?c.join(s):c[0];continue}n[a]=o}this.setErrors(n)}};var rt= (_class11 =class{constructor(t,e,i){;_class11.prototype.__init41.call(this);this.fieldMetadataProvider=t;this.getState=e;this.isPathDirty=i}__init41() {this.requiredValuesRef=null}isHidden(t){return this.fieldMetadataProvider.isHidden(t)}isRequired(t){let e=this.getState().values;return this.requiredValuesRef!==e&&(this.requiredValuesRef=e),this.fieldMetadataProvider.isRequired(t,e)}isFieldDirty(t){return this.isPathDirty(t)}isFieldValidating(t){return!!this.getState().isValidating[t]}isTouched(t){return!!this.getState().touched[t]}}, _class11);function te(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp)}function ee(r,t){let e=[],i=new WeakMap,s=(n,a,o,c,u)=>{if(!(c&&u&&_chunkVBX5I5XGcjs.d.call(void 0, n,a))){if(n!==null&&typeof n=="object"&&a!==null&&typeof a=="object"){let l=i.get(n);if(_optionalChain([l, 'optionalAccess', _96 => _96.has, 'call', _97 => _97(a)]))return;l?l.add(a):i.set(n,new WeakSet([a]))}if(te(n)&&te(a)&&c&&u){let l=new Set([...Object.keys(n),...Object.keys(a)]);for(let d of l){let p=o?`${o}.${d}`:d,h=Object.prototype.hasOwnProperty.call(n,d),m=Object.prototype.hasOwnProperty.call(a,d);s(n[d],a[d],p,h,m)}return}e.push({path:o,previousValue:_chunkVBX5I5XGcjs.a.call(void 0, n),nextValue:_chunkVBX5I5XGcjs.a.call(void 0, a),hadPreviousValue:c,hasNextValue:u})}};return s(r,t,"",!0,!0),{operations:e}}function st(r,t,e){let i=r,s=[],n=[];for(let a of t.operations){let o=e==="undo"?a.hadPreviousValue:a.hasNextValue,c=e==="undo"?a.previousValue:a.nextValue;if(!a.path){i=o?c:{},s.length=0,n.length=0;continue}if(o){s.push([a.path,c]);continue}n.push(a.path)}return s.length>0&&(i=_chunkVBX5I5XGcjs.h.call(void 0, i,s)),n.length>0&&(i=_chunkVBX5I5XGcjs.i.call(void 0, i,n)),i}var nt= (_class12 =class{constructor(t,e){;_class12.prototype.__init42.call(this);_class12.prototype.__init43.call(this);_class12.prototype.__init44.call(this);_class12.prototype.__init45.call(this);_class12.prototype.__init46.call(this);this.enableHistory=t;this.maxHistory=e}__init42() {this.baseSnapshot=null}__init43() {this.currentSnapshot=null}__init44() {this.patches=[]}__init45() {this.historyIndex=-1}__init46() {this.historySize=0}saveSnapshot(t){if(!this.enableHistory)return;if(!this.currentSnapshot||this.baseSnapshot===null){this.reset(t);return}this.historyIndex<this.historySize-1&&(this.patches.splice(this.historyIndex),this.historySize=this.historyIndex+1);let e=ee(this.currentSnapshot,t);if(e.operations.length!==0)for(this.patches.push(e),this.currentSnapshot=t,this.historyIndex+=1,this.historySize=this.historyIndex+1;this.historySize>this.getCapacity();)this.compactOldestSnapshot()}get canUndo(){return this.enableHistory?this.historyIndex>0:!1}get canRedo(){return this.enableHistory?this.historyIndex<this.historySize-1:!1}undo(){if(!this.canUndo||!this.currentSnapshot)return null;let t=this.patches[this.historyIndex-1],e=st(this.currentSnapshot,t,"undo");return this.currentSnapshot=e,this.historyIndex-=1,e}redo(){if(!this.canRedo||!this.currentSnapshot)return null;let t=this.patches[this.historyIndex],e=st(this.currentSnapshot,t,"redo");return this.currentSnapshot=e,this.historyIndex+=1,e}reset(t){if(!this.enableHistory){this.baseSnapshot=null,this.currentSnapshot=null,this.patches=[],this.historyIndex=-1,this.historySize=0;return}this.baseSnapshot=_chunkVBX5I5XGcjs.a.call(void 0, t),this.currentSnapshot=this.baseSnapshot,this.patches=[],this.historyIndex=0,this.historySize=1}getMetadata(){return{enabled:this.enableHistory,canUndo:this.canUndo,canRedo:this.canRedo,historyIndex:this.historyIndex,historySize:this.historySize}}compactOldestSnapshot(){let t=this.patches.shift();!t||this.baseSnapshot===null||(this.baseSnapshot=st(this.baseSnapshot,t,"redo"),this.historySize=Math.max(1,this.historySize-1),this.historyIndex=Math.max(0,this.historyIndex-1))}getCapacity(){return Math.max(1,this.maxHistory)}}, _class12);function Vt(r,t,e){if(!Object.prototype.hasOwnProperty.call(r,t))return[r,e];let s=r,n=e;return n||(s={...r},n=!0),delete s[t],[s,n]}var w=class{constructor(t){this.steps=t}async run(t){for(let e of this.steps){if(t.halted)break;await e.run(t)}}},at=class{constructor(t){this.steps=t}run(t){for(let e of this.steps){if(t.halted)break;let i=e.run(t);if(i!=null&&typeof i.then=="function")throw new Error(`BitSyncPipelineRunner: step "${e.name}" returned a Promise. Use BitPipelineRunner for async steps.`)}}};var ot=class{constructor(t){this.store=t;this.fieldUpdatePipeline=new at([{name:"field:clear-current-error",run:e=>this.clearCurrentError(e)},{name:"field:update-dependencies",run:e=>this.updateDependencies(e)},{name:"field:update-dirty",run:e=>this.updateDirtyState(e)},{name:"field:commit-state",run:e=>this.commitFieldState(e)},{name:"field:emit-change",run:e=>this.emitFieldChange(e)},{name:"field:trigger-validate",run:e=>this.triggerResolverValidation(e)},{name:"field:trigger-async-validate",run:e=>this.triggerAsyncValidation(e)}])}updateField(t,e,i={origin:"setField"}){let s=this.store.getState(),n=_chunkVBX5I5XGcjs.f.call(void 0, s.values,t),a={path:t,value:e,meta:i,previousValue:n,nextValues:_chunkVBX5I5XGcjs.g.call(void 0, s.values,t,e),nextErrors:s.errors,hasMutatedErrors:!1,dependencyDiff:{affectedFields:[],visibilityChanged:[],requiredChanged:[]},isDirty:!1};this.fieldUpdatePipeline.run(a)}clearCurrentError(t){[t.nextErrors,t.hasMutatedErrors]=Vt(t.nextErrors,t.path,t.hasMutatedErrors),this.store.clearFieldValidation(t.path)}updateDependencies(t){if(typeof this.store.hasDependentFields=="function"&&!this.store.hasDependentFields(t.path)){t.dependencyDiff.affectedFields.length=0,t.dependencyDiff.visibilityChanged.length=0,t.dependencyDiff.requiredChanged.length=0;return}t.dependencyDiff=this.store.updateDependencies(t.path,this.store.getState().values,t.nextValues),new Set([...t.dependencyDiff.visibilityChanged,...t.dependencyDiff.requiredChanged]).forEach(i=>{[t.nextErrors,t.hasMutatedErrors]=Vt(t.nextErrors,i,t.hasMutatedErrors),this.store.clearFieldValidation(i)})}updateDirtyState(t){t.isDirty=this.store.updateDirtyForPath(t.path,t.nextValues,this.store.getBaselineValues())}commitFieldState(t){let e=Array.from(new Set([t.path,...t.dependencyDiff.visibilityChanged,...t.dependencyDiff.requiredChanged]));this.store.dispatch(g({values:t.nextValues,errors:t.nextErrors,isDirty:t.isDirty},e))}emitFieldChange(t){this.store.emitFieldChange({path:t.path,previousValue:t.previousValue,nextValue:t.value,values:this.store.getState().values,state:this.store.getState(),meta:t.meta})}triggerResolverValidation(t){let e=Array.from(new Set([t.path,...t.dependencyDiff.visibilityChanged,...t.dependencyDiff.requiredChanged]));(this.store.config.resolver||t.dependencyDiff.visibilityChanged.length>0||t.dependencyDiff.requiredChanged.length>0)&&this.store.triggerValidation(e)}triggerAsyncValidation(t){(typeof this.store.getFieldConfig=="function"?_optionalChain([this, 'access', _98 => _98.store, 'access', _99 => _99.getFieldConfig, 'call', _100 => _100(t.path), 'optionalAccess', _101 => _101.validation, 'optionalAccess', _102 => _102.asyncValidateOn]):void 0)==="change"&&this.store.handleFieldAsyncValidation(t.path,t.value)}};var lt= (_class13 =class{constructor() { _class13.prototype.__init47.call(this); }__init47() {this.executors=new Map}register(t,e){let i=_nullishCoalesce(this.executors.get(t), () => ([]));i.push(e),this.executors.set(t,i)}async execute(t){let e=this.getOrderedExecutors(t.kind);for(let i of e)await i.execute(t)}executeSync(t){let e=this.getOrderedExecutors(t.kind);for(let i of e){let s=i.execute(t);if(s&&typeof s.then=="function")throw new Error(`BitLifecycleOrchestrator: executor async em modo sync para kind "${t.kind}".`)}}getOrderedExecutors(t){return[..._nullishCoalesce(this.executors.get(t), () => ([]))].sort((i,s)=>i.phase-s.phase)}}, _class13);var ct=class{constructor(t){this.store=t;this.submitPipeline=new w([{name:"submit:start",run:async e=>this.startSubmit(e)},{name:"submit:invalid",run:async e=>this.handleInvalidSubmit(e)},{name:"submit:prepare",run:e=>this.prepareSubmitValues(e)},{name:"submit:before-hooks",run:async e=>this.runBeforeSubmitHooks(e)},{name:"submit:user-handler",run:async e=>this.runSubmitHandler(e)},{name:"submit:after-hooks",run:async e=>this.runAfterSubmitHooks(e)}])}async submit(t){if(this.store.getState().isSubmitting)return{status:"blocked",reason:"isSubmitting"};if(this.store.hasValidationsInProgress())return{status:"blocked",reason:"validating"};this.store.cancelAllValidations();let i={onSuccess:t,isValid:!1,valuesToSubmit:_chunkVBX5I5XGcjs.a.call(void 0, this.store.getState().values),dirtyValues:{}};try{return await this.submitPipeline.run(i),i.invalid?{status:"invalid"}:{status:"submitted"}}catch(s){return i.error=s,await this.store.emitOperationalError({source:"submit",error:s}),await this.store.emitAfterSubmit({values:this.store.getState().values,dirtyValues:this.store.buildDirtyValues(this.store.getState().values),state:this.store.getState(),success:!1,error:s}),this.store.config.onUnhandledError(s,"submit"),{status:"failed",error:s}}finally{this.store.dispatch(g({isSubmitting:!1}))}}async startSubmit(t){this.store.dispatch(g({isSubmitting:!0})),t.isValid=await this.store.validateNow()}async handleInvalidSubmit(t){if(t.isValid)return;let e=this.store.getState().errors,i={...this.store.getState().touched};Object.keys(e).forEach(s=>{i[s]=!0}),this.store.batchStateUpdates(()=>{this.store.dispatch(g({touched:i}))}),t.dirtyValues=this.store.buildDirtyValues(this.store.getState().values),t.invalid=!0,await this.store.emitAfterSubmit({values:this.store.getState().values,dirtyValues:t.dirtyValues,state:this.store.getState(),success:!1,invalid:!0}),t.halted=!0}prepareSubmitValues(t){let e=[];this.store.getHiddenFields().forEach(i=>{e.push([i,void 0])}),t.valuesToSubmit=Nt({values:t.valuesToSubmit,sourceValues:this.store.getState().values,transformEntries:this.store.getTransformEntries()}),e.length>0&&(t.valuesToSubmit=_chunkVBX5I5XGcjs.h.call(void 0, t.valuesToSubmit,e)),t.dirtyValues=this.store.buildDirtyValues(t.valuesToSubmit)}async runBeforeSubmitHooks(t){await this.store.emitBeforeSubmit({values:t.valuesToSubmit,dirtyValues:t.dirtyValues,state:this.store.getState()})}async runSubmitHandler(t){try{await t.onSuccess(t.valuesToSubmit,t.dirtyValues)}catch(e){if(_chunkVBX5I5XGcjs.l.call(void 0, e)){this.store.setServerErrors(_chunkVBX5I5XGcjs.m.call(void 0, e)),await this.store.emitAfterSubmit({values:t.valuesToSubmit,dirtyValues:t.dirtyValues,state:this.store.getState(),success:!1,invalid:!0}),t.invalid=!0,t.halted=!0;return}throw e}}async runAfterSubmitHooks(t){await this.store.emitAfterSubmit({values:t.valuesToSubmit,dirtyValues:t.dirtyValues,state:this.store.getState(),success:!0})}};var dt=class{constructor(t){this.store=t}collectChangedUpdates(t,e="",i=[]){return Object.entries(t).forEach(([s,n])=>{let a=e?`${e}.${s}`:s;if(n&&typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length>0){this.collectChangedUpdates(n,a,i);return}i.push([a,n])}),i}setValues(t,e){if(_optionalChain([e, 'optionalAccess', _103 => _103.rebase])){this.rebaseValues(t);return}if(_optionalChain([e, 'optionalAccess', _104 => _104.partial])){this.hydrateValues(t);return}this.replaceValuesInternal(t,"replaceValues")}hydrateValues(t){let e=this.collectChangedUpdates(t),i=e.map(([n])=>n),s=e.length>0?_chunkVBX5I5XGcjs.h.call(void 0, this.store.getState().values,e):this.store.getState().values;this.replaceValuesInternal(s,"hydrate",i.length>0?i:["*"])}rebaseValues(t){let e=this.store.getState().values,i=_chunkVBX5I5XGcjs.a.call(void 0, t);this.store.setBaselineValues(t),this.store.cancelAllValidations(),this.store.evaluateAllDependencies(i),this.store.clearDirtyState(),this.store.dispatch(g({values:i,errors:{},touched:{},isValidating:{},isValid:!0,isDirty:!1,isSubmitting:!1},["*"])),this.store.resetHistory(i),this.store.validateNow(),this.store.emitFieldChange({path:"*",previousValue:e,nextValue:i,values:this.store.getState().values,state:this.store.getState(),meta:{origin:"rebase"}})}applyHistoryState(t){let e=this.store.rebuildDirtyState(t,this.store.getBaselineValues());this.store.dispatch(g({values:t,isDirty:e},["*"])),this.store.triggerValidation(void 0,{forceDebounce:!0})}reset(){this.store.cancelAllValidations();let t=_chunkVBX5I5XGcjs.a.call(void 0, this.store.getBaselineValues());this.store.evaluateAllDependencies(t),this.store.clearDirtyState(),this.store.dispatch(g({values:t,errors:{},touched:{},isValidating:{},isValid:!0,isDirty:!1,isSubmitting:!1},["*"])),this.store.resetHistory(t)}replaceValuesInternal(t,e="replaceValues",i=["*"]){let s=this.store.getState().values,n=_chunkVBX5I5XGcjs.a.call(void 0, t);this.store.cancelAllValidations(),this.store.evaluateAllDependencies(n);let a=this.store.rebuildDirtyState(n,this.store.getBaselineValues());this.store.dispatch(g({values:n,errors:{},isValidating:{},isValid:!0,isDirty:a,isSubmitting:!1},i)),this.store.internalSaveSnapshot(),this.store.validateNow(),this.store.emitFieldChange({path:"*",previousValue:s,nextValue:n,values:this.store.getState().values,state:this.store.getState(),meta:{origin:e}})}};var ut= (_class14 =class{constructor(t){;_class14.prototype.__init48.call(this);this.ports=t;this.fieldUpdate=new ot(t.fieldUpdate),this.values=new dt(t.values),this.submitFlow=new ct(t.submit),this.orchestrator.register("updateField",{phase:1,execute:e=>this.fieldUpdate.updateField(e.path,e.value,_nullishCoalesce(e.meta, () => ({origin:"setField"})))}),this.orchestrator.register("setValues",{phase:2,execute:e=>this.values.setValues(e.newValues,e.options)}),this.orchestrator.register("hydrateValues",{phase:2,execute:e=>this.values.hydrateValues(e.newValues)}),this.orchestrator.register("rebaseValues",{phase:2,execute:e=>this.values.rebaseValues(e.newValues)}),this.orchestrator.register("applyHistoryState",{phase:2,execute:e=>this.values.applyHistoryState(e.snapshot)}),this.orchestrator.register("submit",{phase:3,execute:async e=>{e.submitResult=await this.submitFlow.submit(e.onSuccess)}}),this.orchestrator.register("reset",{phase:4,execute:()=>this.values.reset()})}__init48() {this.orchestrator=new lt}updateField(t,e,i={origin:"setField"}){this.orchestrator.executeSync({kind:"updateField",path:t,value:e,meta:i})}setValues(t,e){this.orchestrator.executeSync({kind:"setValues",newValues:t,options:e})}hydrateValues(t){this.orchestrator.executeSync({kind:"hydrateValues",newValues:t})}rebaseValues(t){this.orchestrator.executeSync({kind:"rebaseValues",newValues:t})}applyHistoryState(t){this.orchestrator.executeSync({kind:"applyHistoryState",snapshot:t})}async submit(t){let e={kind:"submit",onSuccess:t};return await this.orchestrator.execute(e),e.submitResult}reset(){this.orchestrator.executeSync({kind:"reset"})}}, _class14);var pt=class{constructor(t,e,i,s){this.getState=t;this.getInitialValues=e;this.getScopeFields=i;this.isPathDirty=s}getScopeStatus(t){let e=this.getScopeFields(t),i=this.getState(),s=e.some(o=>!!i.errors[o]),n=e.some(o=>this.isPathDirty(o)),a=this.getScopeErrors(t);return{hasErrors:s,isDirty:n,errors:a}}getScopeErrors(t){let e=this.getScopeFields(t),i=this.getState(),s={};for(let n of e){let a=i.errors[n];a&&(s[n]=a)}return s}};var ht= (_class15 =class{constructor(t){;_class15.prototype.__init49.call(this);_class15.prototype.__init50.call(this);this.port=t}__init49() {this.abortControllers=new Map}__init50() {this.pendingJobs=new Map}handle(t,e,i,s,n){if(!i){this.cancel(t),this.port.setFieldValidating(t,!1);return}this.cancel(t),this.port.setFieldValidating(t,!0);let a=new AbortController;this.abortControllers.set(t,a),this.pendingJobs.set(t,{value:e,dueAt:Date.now()+s,validate:i,controller:a,timeoutMs:n}),this.schedulePendingJobs()}cancel(t){this.cancelInternal(t,!0)}cancelInternal(t,e){this.pendingJobs.has(t)&&(this.pendingJobs.delete(t),e&&this.schedulePendingJobs());let i=this.abortControllers.get(t);i&&(i.abort(),this.abortControllers.delete(t))}cleanupPrefix(t){let e=!1;for(let i of this.pendingJobs.keys())P(i,t)&&(this.cancelInternal(i,!1),e=!0,this.port.clearAsyncError(i),this.port.setFieldValidating(i,!1));e&&this.schedulePendingJobs()}cancelAll(){this.cancelSchedulerTimeout&&(this.cancelSchedulerTimeout(),this.cancelSchedulerTimeout=void 0),this.pendingJobs.clear(),this.abortControllers.forEach(t=>t.abort()),this.abortControllers.clear()}schedulePendingJobs(){this.cancelSchedulerTimeout&&(this.cancelSchedulerTimeout(),this.cancelSchedulerTimeout=void 0);let t=Number.POSITIVE_INFINITY;for(let e of this.pendingJobs.values())e.dueAt<t&&(t=e.dueAt);Number.isFinite(t)&&(this.cancelSchedulerTimeout=this.port.schedule(()=>{this.cancelSchedulerTimeout=void 0,this.flushPendingJobs().catch(e=>{this.port.onError(e)})},Math.max(0,t-Date.now())))}async flushPendingJobs(){this.cancelSchedulerTimeout=void 0;let t=Date.now(),e=[];for(let[s,n]of this.pendingJobs.entries())n.dueAt<=t&&e.push([s,n]);if(e.length===0){this.schedulePendingJobs();return}e.forEach(([s])=>{this.pendingJobs.delete(s)});let i=await Promise.allSettled(e.map(([s,n])=>this.runJob(s,n)));for(let s of i)s.status==="rejected"&&this.port.onError(s.reason);this.schedulePendingJobs()}async runJob(t,e){if(!e.controller.signal.aborted)try{let i=e.validate(e.value,this.port.getValues());typeof e.timeoutMs=="number"&&e.timeoutMs>0&&(i=Promise.race([i,new Promise(n=>setTimeout(()=>n(void 0),e.timeoutMs))]));let s=await i;if(e.controller.signal.aborted)return;s?this.port.setAsyncError(t,s):(this.port.clearAsyncError(t),await this.port.onValidationPassed(t))}finally{e.controller.signal.aborted||this.port.setFieldValidating(t,!1),this.abortControllers.delete(t)}}}, _class15);function A(r){for(let t in r)return!0;return!1}async function ie(r){let{scopeFields:t,store:e,asyncErrors:i}=r,s=e.getState(),n=e.config.resolver?await e.config.resolver(s.values,{scopeFields:t}):{},a=e.getRequiredErrors(s.values),o={...n,...a};e.getHiddenFields().forEach(u=>{delete o[u],i.delete(u)});let c={...s.errors};t.forEach(u=>{o[u]?c[u]=o[u]:i.has(u)?c[u]=i.get(u):delete c[u]}),e.dispatch(Q(c,!A(c)))}var ft= (_class16 =class{constructor() { _class16.prototype.__init51.call(this);_class16.prototype.__init52.call(this); }__init51() {this.currentValidationId=0}__init52() {this.immediateAbortControllers=new Map}beginValidation(){return this.currentValidationId+=1,this.currentValidationId}getCurrentValidationId(){return this.currentValidationId}isValidationCurrent(t){return t===this.currentValidationId}setImmediateController(t,e){this.immediateAbortControllers.set(t,e)}clearImmediateController(t){this.immediateAbortControllers.delete(t)}cancelImmediate(t){let e=this.immediateAbortControllers.get(t);e&&(e.abort(),this.immediateAbortControllers.delete(t))}cancelImmediatePrefix(t,e){for(let i of this.immediateAbortControllers.keys())P(i,t)&&(this.cancelImmediate(i),e(i))}cancelAllImmediate(){this.immediateAbortControllers.forEach(t=>{t.abort()}),this.immediateAbortControllers.clear()}}, _class16);var gt= (_class17 =class{constructor(t){;_class17.prototype.__init53.call(this);this.port=t}__init53() {this.pendingScopeFields=null}trigger(t,e){this.cancelTimeout&&(this.cancelTimeout(),this.cancelTimeout=void 0);let i=_nullishCoalesce(this.port.validationDelay, () => (300)),s=_optionalChain([e, 'optionalAccess', _105 => _105.forceDebounce])?Math.max(1,i):i;if(s>0){if(t&&t.length>0)if(!this.pendingScopeFields)this.pendingScopeFields=new Set(t);else for(let a of t)this.pendingScopeFields.add(a);else this.pendingScopeFields=null;let n=this.pendingScopeFields?Array.from(this.pendingScopeFields):void 0;this.cancelTimeout=this.port.schedule(()=>{this.pendingScopeFields=null,this.cancelTimeout=void 0,this.validateWithOptionalScopeFields(n)},s)}else this.pendingScopeFields=null,this.validateWithOptionalScopeFields(t)}validateWithOptionalScopeFields(t){return t&&t.length>0?this.port.validate({scopeFields:t}):this.port.validate()}cancelPending(){this.cancelTimeout&&(this.cancelTimeout(),this.cancelTimeout=void 0),this.pendingScopeFields=null}}, _class17);function re(r){let{targetFields:t,currentErrors:e,allErrors:i,asyncErrors:s}=r;if(t&&t.length>0){let a=e,o=!1,c=()=>(o||(a={...e},o=!0),a);t.forEach(l=>{let d=l,p=e[d];if(i[l])p!==i[l]&&(c()[d]=i[l]);else if(s.has(l)){let h=s.get(l);p!==h&&(c()[d]=h)}else p!==void 0&&delete c()[d]});let u=t.every(l=>!i[l]&&!s.has(l));return{committedErrors:o?a:e,result:u,mode:"scoped"}}let n={};return s.forEach((a,o)=>{n[o]=a}),Object.entries(i).forEach(([a,o])=>{n[a]=o}),{committedErrors:n,result:void 0,mode:"global"}}function se(r){let{targetFields:t,hiddenFields:e,getFieldConfig:i,forEachFieldConfig:s}=r,n=[];if(t&&t.length>0){for(let a of t){if(e.has(a))continue;_optionalChain([i, 'call', _106 => _106(a), 'optionalAccess', _107 => _107.validation, 'optionalAccess', _108 => _108.asyncValidate])&&n.push(a)}return n}return s&&s((a,o)=>{!_optionalChain([a, 'access', _109 => _109.validation, 'optionalAccess', _110 => _110.asyncValidate])||e.has(o)||n.push(o)}),n}async function ne(r){let{path:t,values:e,validationId:i,getCurrentValidationId:s,getFieldConfig:n,cancelFieldAsync:a,createAbortController:o,setAbortController:c,clearAbortController:u,setFieldValidating:l,setAsyncError:d,clearAsyncError:p}=r,h=_optionalChain([n, 'call', _111 => _111(t), 'optionalAccess', _112 => _112.validation, 'optionalAccess', _113 => _113.asyncValidate]);if(!h){p(t);return}a(t);let m=o();c(t,m),l(t,!0);try{let B=_optionalChain([n, 'call', _114 => _114(t), 'optionalAccess', _115 => _115.validation, 'optionalAccess', _116 => _116.asyncValidateTimeout]),f=h(_chunkVBX5I5XGcjs.f.call(void 0, e,t),e);typeof B=="number"&&B>0&&(f=Promise.race([f,new Promise(E=>setTimeout(()=>E(void 0),B))]));let S=await f;if(m.signal.aborted||i!==s())return;S?d(t,S):p(t)}finally{!m.signal.aborted&&i===s()&&l(t,!1),u(t)}}function ae(r){let{ctx:t,deps:e}=r,i=t.options;if(_optionalChain([i, 'optionalAccess', _117 => _117.scope])&&_optionalChain([i, 'access', _118 => _118.scopeFields, 'optionalAccess', _119 => _119.length])){e.store.config.onUnhandledError(new Error("validate received both 'scope' and 'scopeFields'. 'scopeFields' takes precedence."),"validation");return}if(!_optionalChain([t, 'access', _120 => _120.options, 'optionalAccess', _121 => _121.scopeFields, 'optionalAccess', _122 => _122.length])&&_optionalChain([t, 'access', _123 => _123.options, 'optionalAccess', _124 => _124.scope])){let s=e.store.getScopeFields(t.options.scope);s.length>0&&(t.targetFields=s)}}async function oe(r){let{ctx:t,deps:e}=r;await e.store.emitBeforeValidate({values:t.currentState.values,state:t.currentState,scope:_optionalChain([t, 'access', _125 => _125.options, 'optionalAccess', _126 => _126.scope]),scopeFields:t.targetFields})}async function le(r){let{ctx:t,deps:e}=r,i=e.store.config.resolver?await e.store.config.resolver(t.currentState.values,{scopeFields:t.targetFields}):{},s=e.store.getRequiredErrors(t.currentState.values);t.allErrors={...i,...s},e.store.getHiddenFields().forEach(n=>{delete t.allErrors[n],e.asyncErrors.delete(n)})}async function ce(r){let{ctx:t,deps:e}=r,i=se({targetFields:t.targetFields,hiddenFields:e.store.getHiddenFields(),getFieldConfig:s=>e.store.getFieldConfig(s),forEachFieldConfig:e.store.forEachFieldConfig});i.length!==0&&await Promise.all(i.map(s=>e.runImmediateAsyncValidation(s,t.currentState.values,t.validationId)))}function de(r){let{ctx:t,deps:e}=r,i=re({targetFields:t.targetFields,currentErrors:t.currentState.errors,allErrors:t.allErrors,asyncErrors:e.asyncErrors});t.committedErrors=i.committedErrors,t.isValid=!A(i.committedErrors),t.result=i.mode==="scoped"?i.result:t.isValid}async function wt(r){let{ctx:t,deps:e}=r;t.validationId!==e.getCurrentValidationId()&&(t.aborted=!0,t.result=t.currentState.isValid,t.halted=!0)}async function ue(r){let{ctx:t,deps:e}=r;e.store.dispatch(Q(t.committedErrors,t.isValid)),await e.store.emitAfterValidate({values:e.store.getState().values,state:e.store.getState(),scope:_optionalChain([t, 'access', _127 => _127.options, 'optionalAccess', _128 => _128.scope]),scopeFields:t.targetFields,errors:t.committedErrors,result:t.result}),t.halted=!0}var mt=class{constructor(t){this.deps=t;this.runner=new w([{name:"validate:resolve-target-fields",run:e=>ae({ctx:e,deps:this.deps})},{name:"validate:before-hooks",run:async e=>oe({ctx:e,deps:this.deps})},{name:"validate:sync-track",run:async e=>le({ctx:e,deps:this.deps})},{name:"validate:abort-check-pre-async",run:async e=>wt({ctx:e,deps:this.deps})},{name:"validate:async-track",run:async e=>ce({ctx:e,deps:this.deps})},{name:"validate:abort-check",run:async e=>wt({ctx:e,deps:this.deps})},{name:"validate:async-track-merge",run:e=>de({ctx:e,deps:this.deps})},{name:"validate:commit",run:async e=>ue({ctx:e,deps:this.deps})}])}async run(t){await this.runner.run(t)}};var yt= (_class18 =class{constructor(t){;_class18.prototype.__init54.call(this);_class18.prototype.__init55.call(this);_class18.prototype.__init56.call(this);this.store=t;this.schedule=_nullishCoalesce(_optionalChain([t, 'access', _129 => _129.config, 'access', _130 => _130.scheduler, 'optionalAccess', _131 => _131.schedule]), () => (((i,s)=>{let n=setTimeout(i,s);return()=>clearTimeout(n)}))),this.debouncer=new gt({schedule:(i,s)=>this.schedule(i,s),validate:i=>this.validate(i),validationDelay:_nullishCoalesce(t.config.validationDelay, () => (300))}),this.pipelineStore={getState:()=>this.store.getState(),dispatch:i=>this.store.dispatch(i),config:this.store.config,getFieldConfig:i=>this.store.getFieldConfig(i),forEachFieldConfig:i=>this.store.forEachFieldConfig(i),getScopeFields:i=>this.store.getScopeFields(i),getRequiredErrors:i=>this.store.getRequiredErrors(i),getHiddenFields:()=>this.store.getHiddenFields(),emitBeforeValidate:i=>this.store.emitBeforeValidate(i),emitAfterValidate:i=>this.store.emitAfterValidate(i)},this.asyncScheduler=new ht({schedule:(i,s)=>this.schedule(i,s),getValues:()=>this.store.getState().values,setFieldValidating:(i,s)=>this.updateFieldValidating(i,s),setAsyncError:(i,s)=>{this.asyncErrors.set(i,s),this.store.setError(i,s)},clearAsyncError:i=>{this.asyncErrors.delete(i)},onValidationPassed:async i=>{await ie({scopeFields:[i],store:this.pipelineStore,asyncErrors:this.asyncErrors})},onError:i=>{this.store.config.onUnhandledError(i,"validation")}});let e={store:this.pipelineStore,asyncErrors:this.asyncErrors,getCurrentValidationId:()=>this.coordinator.getCurrentValidationId(),runImmediateAsyncValidation:(i,s,n)=>this.runImmediateAsyncValidation(i,s,n)};this.validationPipeline=new mt(e)}__init54() {this.validatingCount=0}__init55() {this.asyncErrors=new Map}__init56() {this.coordinator=new ft}updateFieldValidating(t,e){let i=this.store.getState();if(!!i.isValidating[t]===e)return;let n={...i.isValidating};e?(n[t]=!0,this.validatingCount+=1):(delete n[t],this.validatingCount=Math.max(0,this.validatingCount-1)),this.store.dispatch(g({isValidating:n}))}cancelFieldAsync(t){this.asyncScheduler.cancel(t),this.coordinator.cancelImmediate(t)}cleanupField(t){this.cancelFieldAsync(t),this.asyncErrors.delete(t),this.updateFieldValidating(t,!1)}cleanupPrefix(t){this.asyncScheduler.cleanupPrefix(t),this.coordinator.cancelImmediatePrefix(t,e=>{this.asyncErrors.delete(e),this.updateFieldValidating(e,!1)})}beginExternalValidation(t){this.cancelFieldAsync(t),this.updateFieldValidating(t,!0)}endExternalValidation(t){this.updateFieldValidating(t,!1)}async setExternalError(t,e){if(e){this.asyncErrors.set(t,e),this.store.setError(t,e);return}this.cancelFieldAsync(t),this.asyncErrors.delete(t),this.store.setError(t,void 0),await this.validate({scopeFields:[t]})}handleAsync(t,e){let i=this.store.getFieldConfig(t),s=_optionalChain([i, 'optionalAccess', _132 => _132.validation, 'optionalAccess', _133 => _133.asyncValidate]),n=_nullishCoalesce(_optionalChain([i, 'optionalAccess', _134 => _134.validation, 'optionalAccess', _135 => _135.asyncValidateOn]), () => ("blur"));if(!s||n!=="change"){this.cancelFieldAsync(t),this.updateFieldValidating(t,!1);return}let a=_nullishCoalesce(_optionalChain([i, 'access', _136 => _136.validation, 'optionalAccess', _137 => _137.asyncValidateDelay]), () => (500)),o=_optionalChain([i, 'access', _138 => _138.validation, 'optionalAccess', _139 => _139.asyncValidateTimeout]);this.asyncScheduler.handle(t,e,s,a,o)}hasValidationsInProgress(t){let e=this.store.getState();return t&&t.length>0?t.some(i=>!!e.isValidating[i]):this.validatingCount>0}trigger(t,e){this.debouncer.trigger(t,e)}async validate(t){try{_optionalChain([t, 'optionalAccess', _140 => _140.scopeFields, 'optionalAccess', _141 => _141.length])&&t.scopeFields.forEach(i=>this.cancelFieldAsync(i));let e={options:t,validationId:this.coordinator.beginValidation(),currentState:this.store.getState(),targetFields:_optionalChain([t, 'optionalAccess', _142 => _142.scopeFields]),allErrors:{},committedErrors:{},isValid:!0,result:!0,aborted:!1};return await this.validationPipeline.run(e),e.aborted&&await this.store.emitAfterValidate({values:this.store.getState().values,state:this.store.getState(),scope:_optionalChain([e, 'access', _143 => _143.options, 'optionalAccess', _144 => _144.scope]),scopeFields:e.targetFields,errors:this.store.getState().errors,result:e.currentState.isValid,aborted:!0}),e.result}catch(e){return this.store.config.onUnhandledError(e,"validation"),!1}}clear(t){this.cancelFieldAsync(t),this.updateFieldValidating(t,!1),this.asyncErrors.delete(t)}cancelAll(){this.validatingCount=0,this.debouncer.cancelPending(),this.asyncScheduler.cancelAll(),this.asyncErrors.clear(),this.coordinator.cancelAllImmediate(),this.store.dispatch(g({isValidating:{}}))}async runImmediateAsyncValidation(t,e,i){await ne({path:t,values:e,validationId:i,getCurrentValidationId:()=>this.coordinator.getCurrentValidationId(),getFieldConfig:s=>this.store.getFieldConfig(s),cancelFieldAsync:s=>this.cancelFieldAsync(s),createAbortController:()=>new AbortController,setAbortController:(s,n)=>{this.coordinator.setImmediateController(s,n)},clearAbortController:s=>{this.coordinator.clearImmediateController(s)},setFieldValidating:(s,n)=>this.updateFieldValidating(s,n),setAsyncError:(s,n)=>{this.asyncErrors.set(s,n)},clearAsyncError:s=>{this.asyncErrors.delete(s)}})}}, _class18);var At= (_class19 =class{constructor() { _class19.prototype.__init57.call(this); }__init57() {this.entries=new Map}register(t,e){this.entries.set(t,e)}resolve(t){let e=this.entries.get(t);if(!e)throw new Error(`BitStore capability "${String(t)}" n\xE3o foi registrada.`);return e}toCapabilities(){return{validation:this.resolve("validation"),lifecycle:this.resolve("lifecycle"),history:this.resolve("history"),arrays:this.resolve("arrays"),scope:this.resolve("scope"),query:this.resolve("query"),error:this.resolve("error")}}}, _class19);function pe(){return new At}function di(r){let{registry:t,ports:e,fieldRegistry:i}=r;t.register("validation",new yt(e.validationPort)),t.register("lifecycle",new ut(e.lifecyclePorts)),t.register("history",new nt(!!e.config.history.enabled,_nullishCoalesce(e.config.history.limit, () => (50)))),t.register("arrays",new et(e.arrayPort)),t.register("scope",new pt(()=>e.getState(),()=>e.getBaselineValues(),s=>e.getScopeFields(s),s=>e.isPathDirty(s))),t.register("query",new rt(i,()=>e.getState(),s=>e.isPathDirty(s))),t.register("error",new it(()=>e.getState(),s=>e.dispatch(s),s=>e.config.onUnhandledError(s,"errors")))}function he(r){let{ports:t,fieldRegistry:e}=r,i=pe();return di({registry:i,ports:t,fieldRegistry:e}),{registry:i,capabilities:i.toCapabilities()}}function fe(r){let{config:t,fieldRegistry:e,computedManager:i}=r,s=_chunkVBX5I5XGcjs.a.call(void 0, t.initialValues);t.fields&&Object.entries(t.fields).forEach(([o,c])=>{e.register(o,c,s)});let n=Zt(e.getComputedEntries());if(n.length>0)throw new Error(n[0].message);return{values:N({values:s,normalizerEntries:e.getNormalizerEntries(),applyComputed:(o,c)=>i.apply(o,c)}),errors:{},touched:{},isValidating:{},persist:{isSaving:!1,isRestoring:!1,error:null},isValid:!0,isSubmitting:!1,isDirty:!1}}function ge(r){return{getState:r.getState,dispatch:r.dispatch,setError:r.setError,getFieldConfig:r.getFieldConfig,forEachFieldConfig:t=>r.fieldRegistry.forEachFieldConfig((e,i)=>t(e,i)),getScopeFields:r.getScopeFields,config:r.config,getRequiredErrors:t=>r.fieldRegistry.getRequiredErrors(t),getHiddenFields:()=>r.fieldRegistry.getHiddenFields(),emitBeforeValidate:t=>r.getEffects().beforeValidate(t),emitAfterValidate:t=>r.getEffects().afterValidate(t)}}function me(r){let t={getState:r.getState,dispatch:r.dispatch,config:r.config,getFieldConfig:s=>r.fieldRegistry.getFieldConfig(s),updateDependencies:(s,n,a)=>r.fieldRegistry.updateDependencies(s,n,a),hasDependentFields:s=>r.fieldRegistry.hasDependents(s),isFieldHidden:s=>r.fieldRegistry.isHidden(s),clearFieldValidation:s=>r.getValidation().clear(s),triggerValidation:(s,n)=>r.getValidation().trigger(s,n),handleFieldAsyncValidation:(s,n)=>r.getValidation().handleAsync(s,n),updateDirtyForPath:(s,n,a)=>r.dirtyManager.updateForPath(s,n,a),getBaselineValues:r.getBaselineValues,emitFieldChange:s=>r.getEffects().onFieldChange(s)},e={getState:r.getState,dispatch:r.dispatch,internalSaveSnapshot:r.saveHistorySnapshot,evaluateAllDependencies:s=>r.fieldRegistry.evaluateAll(s),cancelAllValidations:()=>r.getValidation().cancelAll(),validateNow:s=>r.getValidation().validate(s),rebuildDirtyState:(s,n)=>r.dirtyManager.rebuild(s,n),clearDirtyState:r.dirtyManager.clear.bind(r.dirtyManager),getBaselineValues:r.getBaselineValues,setBaselineValues:r.setBaselineValues,resetHistory:s=>r.getHistory().reset(s),emitFieldChange:s=>r.getEffects().onFieldChange(s),triggerValidation:(s,n)=>r.getValidation().trigger(s,n)},i={getState:r.getState,dispatch:r.dispatch,batchStateUpdates:r.runStateBatch,config:r.config,getTransformEntries:r.getTransformEntries,getHiddenFields:()=>r.fieldRegistry.getHiddenFields(),cancelAllValidations:()=>r.getValidation().cancelAll(),validateNow:s=>r.getValidation().validate(s),hasValidationsInProgress:s=>r.getValidation().hasValidationsInProgress(s),buildDirtyValues:s=>r.dirtyManager.buildDirtyValues(s),setServerErrors:(s,n)=>r.setServerErrors(s,n),emitBeforeSubmit:s=>r.getEffects().beforeSubmit(s),emitAfterSubmit:s=>r.getEffects().afterSubmit(s),emitOperationalError:s=>r.getEffects().reportOperationalError(s)};return{fieldUpdate:t,values:e,submit:i}}function ye(r){return{getState:r.getState,setFieldWithMeta:r.setFieldWithMeta,dispatch:r.dispatch,internalSaveSnapshot:r.saveHistorySnapshot,unregisterPrefix:r.unregisterPrefix,createArrayItemId:r.createArrayItemId}}function Se(r){let{config:t,fieldRegistry:e,dirtyManager:i,baselineManager:s,runtimeContext:n}=r,{stateAccess:a,fieldAccess:o,featureAccess:c,actions:u}=n,l=ge({config:t,fieldRegistry:e,getState:a.getState,dispatch:a.dispatch,setError:u.setError,getFieldConfig:o.getFieldConfig,getScopeFields:o.getScopeFields,getEffects:c.getEffects}),d=me({config:t,fieldRegistry:e,dirtyManager:i,getState:a.getState,dispatch:a.dispatch,setServerErrors:u.setServerErrors,saveHistorySnapshot:a.saveHistorySnapshot,runStateBatch:a.runStateBatch,getTransformEntries:o.getTransformEntries,getBaselineValues:()=>s.getValues(),setBaselineValues:h=>s.setValues(h),getValidation:c.getValidation,getHistory:c.getHistory,getEffects:c.getEffects}),p=ye({getState:a.getState,dispatch:a.dispatch,setFieldWithMeta:(h,m,B)=>u.setFieldWithMeta(h,m,B),unregisterPrefix:u.unregisterPrefix,saveHistorySnapshot:a.saveHistorySnapshot,createArrayItemId:(h,m)=>t.idFactory({scope:"array",path:h,index:m})});return he({ports:{validationPort:l,lifecyclePorts:d,arrayPort:p,config:t,getScopeFields:o.getScopeFields,getState:a.getState,dispatch:a.dispatch,getBaselineValues:()=>s.getValues(),isPathDirty:h=>i.isPathDirty(h)},fieldRegistry:e})}function be(r){let{config:t,fieldRegistry:e,dirtyManager:i,computedManager:s,rawConfig:n,baselineManager:a,runtimeContext:o}=r,{stateAccess:c,fieldAccess:u,featureAccess:l,actions:d}=o,p=Se({config:t,fieldRegistry:e,dirtyManager:i,baselineManager:a,runtimeContext:{stateAccess:c,fieldAccess:u,featureAccess:l,actions:d}}),h=fe({config:t,fieldRegistry:e,computedManager:s}),m=new tt(c.getState,t.subscriptionCacheSize),B=n.storeId||t.name||t.idFactory({scope:"store",storeName:t.name});return{state:h,subscriptions:m,capabilityRegistry:p.registry,storeId:B}}function Be(){return{depth:0,pendingState:null,changedPathSet:null,changedPathList:null,valuesChanged:!1,pendingHistorySnapshot:!1}}function Te(r){r.depth+=1}function ve(r){return r.depth-=1,r.depth===0}function St(r,t){return _nullishCoalesce(t.pendingState, () => (r))}function Pe(r,t){if(r.pendingState=t.nextState,r.valuesChanged||=t.valuesChanged,t.valuesChanged&&(r.pendingHistorySnapshot=!0),t.changedPaths&&t.changedPaths.length>0){let e=_nullishCoalesce(r.changedPathSet, () => (new Set)),i=_nullishCoalesce(r.changedPathList, () => ([]));t.changedPaths.forEach(s=>{if(e.has("*")||e.has(s))return;if(s==="*"){e.clear(),i.length=0,e.add("*"),i.push("*");return}if(!i.some(a=>a!=="*"&&s.startsWith(`${a}.`))){for(let a=i.length-1;a>=0;a-=1){let o=i[a];o==="*"||!o.startsWith(`${s}.`)||(e.delete(o),i.splice(a,1))}e.add(s),i.push(s)}}),r.changedPathSet=e,r.changedPathList=i}}function xe(r){let{currentState:t,batchState:e,applyValueDerivations:i}=r;if(!e.pendingState)return e.pendingHistorySnapshot=!1,null;let s=e.pendingState,n=_nullishCoalesce(e.changedPathList, () => (void 0)),a=e.valuesChanged;return a&&(s={...s,values:i(s.values,n)}),e.pendingState=null,e.changedPathSet=null,e.changedPathList=null,e.valuesChanged=!1,{nextState:_nullishCoalesce(s, () => (t)),changedPaths:n,valuesChanged:a}}function ui(r){let t=!1;for(let i of Object.values(r))if(i===void 0){t=!0;break}if(!t)return r;let e={};return Object.entries(r).forEach(([i,s])=>{let n=s;n!==void 0&&(e[i]=n)}),e}function Ee(r){let{currentState:t,partialState:e,changedPaths:i,applyValueDerivations:s,applyComputedValues:n}=r,a=_nullishCoalesce(s, () => ((p=>n?n(p):p))),o={...t,...e},c=!!e.values;e.values&&(o.values=a(e.values,i)),e.errors&&(o.errors=ui(e.errors),o.isValid=!A(o.errors));let u=i&&i.length>0?i:void 0,l=pi(e),d=_(u,l);return{nextState:o,changedPaths:d,valuesChanged:c}}function pi(r){let t=new Set,e=[r.errors,r.touched,r.isValidating];for(let i of e)if(i)for(let s in i)t.add(s);return r.persist&&t.add("persist"),"isValid"in r&&t.add("isValid"),"isDirty"in r&&t.add("isDirty"),"isSubmitting"in r&&t.add("isSubmitting"),t.size>0?Array.from(t):void 0}function hi(r){throw new Error(`BitStore: unsupported operation kind: ${String(r.kind)}`)}function fi(r,t){switch(t.kind){case"state.patch":return t;case"field.touchMany":{if(t.paths.length===0)return null;let e={...r.touched};for(let i of t.paths)e[i]=!0;return g({touched:e},t.paths)}case"form.persistMeta":return g({persist:{...r.persist,...t.patch}});case"history.apply":return g({values:t.values,isDirty:t.isDirty},["*"]);case"validation.commit":return g({errors:t.errors,isValid:t.isValid});default:return hi(t)}}function gi(r){let{currentState:t,operation:e,applyValueDerivations:i}=r,s=Object.prototype.hasOwnProperty.call(e.partialState,"values"),n=_nullishCoalesce(e.changedPaths, () => ((s?["*"]:void 0)));return Ee({currentState:t,partialState:e.partialState,changedPaths:n,applyValueDerivations:i})}function Ce(r){let{currentState:t,operation:e,applyValueDerivations:i}=r,s=fi(t,e);return s?gi({currentState:t,operation:s,applyValueDerivations:(n,a)=>s.skipComputed?n:i(n,a)}):null}function Fe(r){let{state:t,batchState:e,operation:i,applyValueDerivations:s,onStateCommitted:n}=r,a=St(t,e);if(e.depth>0){let c=Ce({currentState:a,operation:i,applyValueDerivations:u=>u});return c&&Pe(e,c),t}let o=Ce({currentState:t,operation:i,applyValueDerivations:s});return o?(n({nextState:o.nextState,changedPaths:o.changedPaths,valuesChanged:o.valuesChanged}),o.nextState):t}function Ve(r){let{state:t,batchState:e,applyValueDerivations:i,onStateCommitted:s}=r,n=xe({currentState:t,batchState:e,applyValueDerivations:i});return n?(s({nextState:n.nextState,changedPaths:n.changedPaths,valuesChanged:n.valuesChanged}),n.nextState):t}function we(r){let{batchState:t,callback:e,flushBatchedStateUpdates:i}=r;Te(t);try{return e()}finally{ve(t)&&i()}}function Ae(r){let{payload:t,setState:e,notifySubscriptions:i,notifyEffects:s}=r;e(t.nextState),i(t.nextState,t.changedPaths),s(t.nextState,t.valuesChanged)}function Ie(r){let{state:t,batchState:e,operation:i,applyValueDerivations:s,onStateCommitted:n}=r;return Fe({state:t,batchState:e,operation:i,applyValueDerivations:s,onStateCommitted:n})}function De(r){let{batchState:t,values:e,saveHistory:i}=r;if(t.depth>0){t.pendingHistorySnapshot=!0;return}i(e)}function ke(r){let{state:t,batchState:e,applyValueDerivations:i,onStateCommitted:s,saveHistory:n}=r,a=Ve({state:t,batchState:e,applyValueDerivations:i,onStateCommitted:s});return e.pendingHistorySnapshot&&(e.pendingHistorySnapshot=!1,n(a.values)),a}var bt= (_class20 =class{constructor(t){;_class20.prototype.__init58.call(this);this.args=t;this.state=t.state,this.subscriptions=t.subscriptions,this.effects=t.effects,this.capabilityRegistry=t.capabilityRegistry,this.capabilities=t.capabilityRegistry.toCapabilities()}__init58() {this.batchState=Be()}getCapability(t){return this.capabilityRegistry.resolve(t)}getState(){return St(this.state,this.batchState)}runBatch(t){return we({batchState:this.batchState,callback:t,flushBatchedStateUpdates:()=>this.flushBatchedStateUpdates()})}dispatch(t){this.state=Ie({state:this.state,batchState:this.batchState,operation:t,applyValueDerivations:(e,i)=>this.applyValueDerivations(e,i),onStateCommitted:e=>this.onStateCommitted(e)})}saveHistorySnapshot(){let t=this.capabilities.history.getMetadata();De({batchState:this.batchState,values:this.state.values,saveHistory:i=>this.capabilities.history.saveSnapshot(i)});let e=this.capabilities.history.getMetadata();this.notifyIfHistoryChanged(t,e)}cleanup(){this.subscriptions.destroy(),this.capabilities.validation.cancelAll(),this.effects.destroy()}onStateCommitted(t){Ae({payload:t,setState:e=>{this.state=e},notifySubscriptions:(e,i)=>this.subscriptions.notify(e,i),notifyEffects:(e,i)=>this.effects.onStateUpdated(e,i)})}flushBatchedStateUpdates(){let t=this.capabilities.history.getMetadata();this.state=ke({state:this.state,batchState:this.batchState,applyValueDerivations:(i,s)=>this.applyValueDerivations(i,s),onStateCommitted:i=>this.onStateCommitted(i),saveHistory:i=>this.capabilities.history.saveSnapshot(i)});let e=this.capabilities.history.getMetadata();this.notifyIfHistoryChanged(t,e)}applyValueDerivations(t,e){return this.args.applyValueDerivations?this.args.applyValueDerivations(t,e):t}notifyIfHistoryChanged(t,e){t.canUndo===e.canUndo&&t.canRedo===e.canRedo&&t.historyIndex===e.historyIndex&&t.historySize===e.historySize||this.subscriptions.notify(this.getState(),[_chunkRHMJPKNVcjs.h.call(void 0, )])}}, _class20);function Me(r){let{rawConfig:t,overrides:e}=r,i=Lt(t),s=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _145 => _145.baselineManager]), () => (new O(i.initialValues))),n=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _146 => _146.fieldRegistry]), () => (new L(({error:f})=>{i.onUnhandledError(f,"validation")}))),a=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _147 => _147.computedManager]), () => (new j(()=>n.getComputedEntries()))),o=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _148 => _148.dirtyManager]), () => (new H)),c=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _149 => _149.maskManager]), () => (new z));i.masks&&Object.entries(i.masks).forEach(([f,S])=>{c.registerMask(f,S)});let u=()=>{n.invalidateIndexes(),a.invalidateReverseDeps()},l,d=()=>{if(!l)throw new Error("BitStore runtime kernel is not initialized yet.");return l},p=be({rawConfig:t,config:i,fieldRegistry:n,computedManager:a,dirtyManager:o,baselineManager:s,runtimeContext:{stateAccess:{getState:()=>d().getState(),dispatch:f=>d().dispatch(f),saveHistorySnapshot:()=>d().saveHistorySnapshot(),runStateBatch:f=>d().runBatch(f)},fieldAccess:{getFieldConfig:f=>n.getFieldConfig(f),getScopeFields:f=>n.getScopeFields(f),getNormalizerEntries:()=>n.getNormalizerEntries(),getTransformEntries:()=>n.getTransformEntries()},featureAccess:{getEffects:()=>d().effects,getHistory:()=>d().getCapability("history"),getValidation:()=>d().getCapability("validation")},actions:{setError:(f,S)=>{d().getCapability("error").setError(f,S)},setServerErrors:(f,S)=>{d().getCapability("error").setServerErrors(f,S)},validate:f=>d().getCapability("validation").validate(f),setFieldWithMeta:(f,S,E={origin:"setField"})=>{d().runBatch(()=>{d().getCapability("lifecycle").updateField(f,S,E)})},unregisterPrefix:f=>{Z({prefix:f,state:d().getState(),fieldRegistry:n,subscriptions:d().subscriptions,validationCleanupPrefix:S=>d().getCapability("validation").cleanupPrefix(S),invalidateFieldIndexes:u})},triggerValidation:(f,S)=>{d().getCapability("validation").trigger(f,S)}}}}),h=()=>{let f=d().getState();return o.buildDirtyValues(f.values)},m=f=>{Gt({values:f,state:d().getState(),initialValues:s.getValues(),validation:d().getCapability("validation"),fieldRegistry:n,dirtyManager:o,dispatch:S=>d().dispatch(S),saveHistorySnapshot:()=>d().saveHistorySnapshot()})},B=Wt({storeId:p.storeId,config:i,getState:()=>d().getState(),getConfig:()=>i,getValues:()=>d().getState().values,getDirtyValues:h,applyPersistedValues:m});return l=new bt({state:p.state,subscriptions:p.subscriptions,effects:B,capabilityRegistry:p.capabilityRegistry,applyValueDerivations:(f,S)=>N({values:f,changedPaths:S,normalizerEntries:n.getNormalizerEntries(),applyComputed:(E,T)=>a.apply(E,T)})}),l.saveHistorySnapshot(),{config:i,storeId:p.storeId,runtime:l,fieldRegistry:n,computedManager:a,dirtyManager:o,maskManager:c,baselineManager:s}}function Re(r){let{dispatch:t,effects:e}=r;return Kt({dispatch:t,effects:e})}function Oe(r){let{dispatch:t,effects:e}=r;return $t({dispatch:t,effects:e})}function je(r){let{dispatch:t,effects:e}=r;return Jt({dispatch:t,effects:e})}function He(r){let{history:t,applyHistoryState:e}=r,i=t.undo();i&&e(i)}function ze(r){let{history:t,applyHistoryState:e}=r,i=t.redo();i&&e(i)}function qe(r){return r.history.getMetadata()}function Ue(r,t){let e=new Set,i=(a,o)=>a===null||typeof a!="object"?a:new Proxy(a,{get:(c,u,l)=>{if(typeof u=="symbol")return Reflect.get(c,u,l);let d=String(u),p=o?`${o}.${d}`:d;e.add(p);let h=Reflect.get(c,u,l);return i(h,p)}}),s=i(r,"");t(s);let n=new Set;return e.forEach(a=>{let o=mi(a);o&&n.add(o)}),Array.from(n)}function mi(r){if(r)return r==="values"?"*":r.startsWith("values.")?r.slice(7):r==="errors"||r==="touched"||r==="isValidating"?"*":r.startsWith("errors.")?r.slice(7):r.startsWith("touched.")?r.slice(8):r.startsWith("isValidating.")?r.slice(13):r==="persist"||r.startsWith("persist.")?"persist":r}function yi(r,t){if(r.length!==t.length)return!1;let e=new Set(t);for(let i of r)if(!e.has(i))return!1;return!0}function Si(r,t){return r.length===0?{emitImmediately:_optionalChain([t, 'optionalAccess', _150 => _150.emitImmediately]),equalityFn:_optionalChain([t, 'optionalAccess', _151 => _151.equalityFn]),mode:"scoped",paths:["*"]}:{emitImmediately:_optionalChain([t, 'optionalAccess', _152 => _152.emitImmediately]),equalityFn:_optionalChain([t, 'optionalAccess', _153 => _153.equalityFn]),mode:"scoped",paths:r}}function Le(r){let{getState:t,subscribeSelector:e,selector:i,listener:s,options:n}=r,a=null,o=Ue(t(),i),c=!1,u=!1,l=d=>{a=e(i,p=>{s(p);let h=Ue(t(),i);yi(o,h)||(o=h,!(u||c)&&(u=!0,queueMicrotask(()=>{u=!1,!c&&(_optionalChain([a, 'optionalCall', _154 => _154()]),l(o))})))},Si(d,n))};return l(o),()=>{c=!0,_optionalChain([a, 'optionalCall', _155 => _155()]),a=null}}function _e(r){let{getState:t,subscriptions:e,selector:i,listener:s,options:n,trackedSubscriptionsEnabled:a}=r,o=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _156 => _156.equalityFn]), () => (_chunkVBX5I5XGcjs.c));if(_optionalChain([n, 'optionalAccess', _157 => _157.mode])==="tracked"){if(!a)throw new Error('BitForm: subscribeSelector com mode="tracked" est\xE1 desabilitado por padr\xE3o. Ative config.trackedSubscriptions=true para habilitar o modo avan\xE7ado.');return Le({getState:t,subscribeSelector:(c,u,l)=>e.subscribeSelector(c,u,l,o),selector:i,listener:s,options:n})}return e.subscribeSelector(i,s,n,o)}function Ne(r){let{path:t,listener:e,options:i,subscribeSelector:s}=r,n=[..._nullishCoalesce(_optionalChain([i, 'optionalAccess', _158 => _158.paths]), () => ([])),t];return s(a=>_chunkVBX5I5XGcjs.f.call(void 0, a.values,t),e,{...i,paths:n})}function We(r){let{path:t,listener:e,getFieldState:i,subscribeSelector:s}=r;return s(()=>i(t),e,{paths:[t],equalityFn:_chunkZKAFHJPUcjs.c})}function Ke(r){let{listener:t,subscribeSelector:e}=r;return e(i=>({isValid:i.isValid,isDirty:i.isDirty,isSubmitting:i.isSubmitting}),t,{paths:["isValid","isDirty","isSubmitting"],equalityFn:(i,s)=>i.isValid===s.isValid&&i.isDirty===s.isDirty&&i.isSubmitting===s.isSubmitting})}function $e(r){let{listener:t,subscribeSelector:e}=r;return e(i=>i.persist,t,{paths:["persist"],equalityFn:(i,s)=>i.isSaving===s.isSaving&&i.isRestoring===s.isRestoring&&i.error===s.error})}function Je(r){let{readHistoryMeta:t,subscribeSelector:e,listener:i}=r;return e(()=>t(),i,{paths:[_chunkRHMJPKNVcjs.h.call(void 0, )],equalityFn:(s,n)=>_chunkRHMJPKNVcjs.e.call(void 0, s,n)})}function Ge(r){let{scopeName:t,getScopeFields:e,readScopeStatus:i,subscribeSelector:s,listener:n}=r,a=_chunkRHMJPKNVcjs.d.call(void 0, t),o=i(t),c=()=>{},u=()=>{c();let d=_chunkRHMJPKNVcjs.c.call(void 0, e(t));c=s(()=>i(t),p=>{_chunkRHMJPKNVcjs.b.call(void 0, o,p)||(o=p,n(p))},{paths:[...d,a]})};u();let l=s(()=>e(t).length,()=>{u();let d=i(t);_chunkRHMJPKNVcjs.b.call(void 0, o,d)||(o=d,n(d))},{paths:[a]});return()=>{c(),l()}}function Ye(r){let{runtime:t,config:e,fieldRegistry:i,dirtyManager:s,stateReader:n}=r,a={getState:()=>n.getState(),getFieldState:l=>n.getFieldState(l),getIsValid:()=>n.getFlag("isValid"),getIsSubmitting:()=>n.getFlag("isSubmitting"),getIsDirty:()=>n.getFlag("isDirty"),isHidden:l=>t.capabilities.query.isHidden(l),isRequired:l=>t.capabilities.query.isRequired(l),isFieldDirty:l=>t.capabilities.query.isFieldDirty(l),isFieldValidating:l=>t.capabilities.query.isFieldValidating(l),getDirtyValues:()=>s.buildDirtyValues(n.getState().values),getPersistMetadata:()=>n.getPersistMetadata(),getHistoryMetadata:()=>qe({history:t.capabilities.history}),getScopeStatus:l=>t.capabilities.scope.getScopeStatus(l),getScopeErrors:l=>t.capabilities.scope.getScopeErrors(l),getCanUndo:()=>t.capabilities.history.canUndo,getCanRedo:()=>t.capabilities.history.canRedo,getScopeFields:l=>i.getScopeFields(l)},o={subscribe:l=>t.subscriptions.subscribe(l),subscribePersistMeta:l=>$e({listener:l,subscribeSelector:(d,p,h)=>o.subscribeSelector(d,p,h)}),subscribeHistoryMeta:l=>Je({readHistoryMeta:()=>a.getHistoryMetadata(),subscribeSelector:(d,p,h)=>o.subscribeSelector(d,p,h),listener:l}),subscribeScopeStatus:(l,d)=>Ge({scopeName:l,getScopeFields:p=>a.getScopeFields(p),readScopeStatus:p=>a.getScopeStatus(p),subscribeSelector:(p,h,m)=>o.subscribeSelector(p,h,m),listener:d}),subscribeSelector:(l,d,p)=>_e({getState:()=>a.getState(),subscriptions:t.subscriptions,selector:l,listener:d,options:p,trackedSubscriptionsEnabled:!!e.trackedSubscriptions}),subscribePath:(l,d,p)=>Ne({path:l,listener:d,options:p,subscribeSelector:(h,m,B)=>o.subscribeSelector(h,m,B)}),subscribeFieldState:(l,d)=>We({path:l,listener:d,getFieldState:p=>a.getFieldState(p),subscribeSelector:(p,h,m)=>o.subscribeSelector(p,h,m)}),subscribeFormMeta:l=>Ke({listener:l,subscribeSelector:(d,p,h)=>o.subscribeSelector(d,p,h)})};return{read:a,observe:o,write:{registerField:(l,d)=>{Xt({path:l,config:d,state:t.getState(),fieldRegistry:i,subscriptions:t.subscriptions,stateReader:n,invalidateFieldIndexes:()=>{i.invalidateIndexes()}})},unregisterField:l=>{Qt({path:l,state:t.getState(),hasStaticConfig:!!_optionalChain([e, 'access', _159 => _159.fields, 'optionalAccess', _160 => _160[l]]),fieldRegistry:i,subscriptions:t.subscriptions,validationCleanupField:d=>t.capabilities.validation.cleanupField(d),invalidateFieldIndexes:()=>{i.invalidateIndexes()},dispatch:d=>t.dispatch(d)})},unregisterPrefix:l=>{Z({prefix:l,state:t.getState(),fieldRegistry:i,subscriptions:t.subscriptions,validationCleanupPrefix:d=>t.capabilities.validation.cleanupPrefix(d),invalidateFieldIndexes:()=>{i.invalidateIndexes()}})},setField:(l,d)=>{t.runBatch(()=>{t.capabilities.lifecycle.updateField(l,d,{origin:"setField"})})},blurField:l=>{t.capabilities.query.isTouched(l)||t.runBatch(()=>{t.dispatch(Ft([l]))}),t.capabilities.validation.trigger([l])},markFieldsTouched:l=>{l.length!==0&&t.dispatch(Ft(l))},setValues:(l,d)=>{t.capabilities.lifecycle.setValues(l,d)},setError:(l,d)=>{t.capabilities.error.setError(l,d)},setErrors:l=>{t.capabilities.error.setErrors(l)},setServerErrors:(l,d)=>{t.capabilities.error.setServerErrors(l,d)},reset:()=>{t.runBatch(()=>{t.capabilities.lifecycle.reset()})},transaction:l=>t.runBatch(l),submit:l=>t.capabilities.lifecycle.submit(l),pushItem:(l,d)=>t.capabilities.arrays.pushItem(l,d),prependItem:(l,d)=>t.capabilities.arrays.prependItem(l,d),insertItem:(l,d,p)=>t.capabilities.arrays.insertItem(l,d,p),removeItem:(l,d)=>t.capabilities.arrays.removeItem(l,d),swapItems:(l,d,p)=>t.capabilities.arrays.swapItems(l,d,p),moveItem:(l,d,p)=>t.capabilities.arrays.moveItem(l,d,p),replaceItems:(l,d)=>t.capabilities.arrays.replaceItems(l,d),clearItems:l=>t.capabilities.arrays.clearItems(l)},feature:{undo:()=>{He({history:t.capabilities.history,applyHistoryState:l=>t.capabilities.lifecycle.applyHistoryState(l)})},redo:()=>{ze({history:t.capabilities.history,applyHistoryState:l=>t.capabilities.lifecycle.applyHistoryState(l)})},validate:l=>t.capabilities.validation.validate(l),hasValidationsInProgress:l=>t.capabilities.validation.hasValidationsInProgress(l),triggerValidation:(l,d)=>t.capabilities.validation.trigger(l,d),restorePersisted:()=>Re({dispatch:l=>t.dispatch(l),effects:t.effects}),forceSave:()=>Oe({dispatch:l=>t.dispatch(l),effects:t.effects}),clearPersisted:()=>je({dispatch:l=>t.dispatch(l),effects:t.effects}),getArrayItemIds:(l,d)=>t.capabilities.arrays.getItemIds(l,d),cleanup:()=>t.cleanup()}}}function Xe(r){let t=()=>r.read.getState();return{read:{get storeId(){return r.identity.storeId},get config(){return r.identity.config},get isValid(){return r.read.getIsValid()},get isSubmitting(){return r.read.getIsSubmitting()},get isDirty(){return r.read.getIsDirty()},getState:t,getFieldConfig:a=>r.getFieldConfig(a),getFieldState:a=>r.read.getFieldState(a),isHidden:a=>r.read.isHidden(a),isRequired:a=>r.read.isRequired(a),isFieldDirty:a=>r.read.isFieldDirty(a),isFieldValidating:a=>r.read.isFieldValidating(a),getDirtyValues:()=>r.read.getDirtyValues(),getPersistMetadata:()=>r.read.getPersistMetadata(),getHistoryMetadata:()=>r.read.getHistoryMetadata(),getScopeStatus:a=>r.read.getScopeStatus(a),getScopeErrors:a=>r.read.getScopeErrors(a),getScopeFields:a=>r.read.getScopeFields(a)},observe:{getState:t,subscribe:a=>r.observe.subscribe(a),subscribePersistMeta:a=>r.observe.subscribePersistMeta(a),subscribeHistoryMeta:a=>r.observe.subscribeHistoryMeta(a),subscribeScopeStatus:(a,o)=>r.observe.subscribeScopeStatus(a,o),subscribeFormMeta:a=>r.observe.subscribeFormMeta(a),subscribeSelector:(a,o,c)=>r.observe.subscribeSelector(a,o,c),subscribePath:(a,o,c)=>r.observe.subscribePath(a,o,c),subscribeFieldState:(a,o)=>r.observe.subscribeFieldState(a,o)},write:{setField:(a,o)=>r.write.setField(a,o),blurField:a=>r.write.blurField(a),markFieldsTouched:a=>r.write.markFieldsTouched(a),setValues:(a,o)=>r.write.setValues(a,o),setError:(a,o)=>r.write.setError(a,o),setErrors:a=>r.write.setErrors(a),setServerErrors:(a,o)=>r.write.setServerErrors(a,o),reset:()=>r.write.reset(),transaction:a=>r.write.transaction(a),submit:a=>r.write.submit(a)},feature:{cleanup:()=>r.feature.cleanup(),validate:a=>r.feature.validate(a),triggerValidation:(a,o)=>r.feature.triggerValidation(a,o),restorePersisted:()=>r.feature.restorePersisted(),forceSave:()=>r.feature.forceSave(),clearPersisted:()=>r.feature.clearPersisted(),registerField:(a,o)=>r.write.registerField(a,o),unregisterField:a=>r.write.unregisterField(a),unregisterPrefix:a=>r.write.unregisterPrefix(a),pushItem:(a,o)=>r.write.pushItem(a,o),prependItem:(a,o)=>r.write.prependItem(a,o),insertItem:(a,o,c)=>r.write.insertItem(a,o,c),removeItem:(a,o)=>r.write.removeItem(a,o),moveItem:(a,o,c)=>r.write.moveItem(a,o,c),swapItems:(a,o,c)=>r.write.swapItems(a,o,c),replaceItems:(a,o)=>r.write.replaceItems(a,o),clearItems:a=>r.write.clearItems(a),getArrayItemIds:(a,o)=>r.feature.getArrayItemIds(a,o),get canUndo(){return r.read.getCanUndo()},get canRedo(){return r.read.getCanRedo()},hasValidationsInProgress:a=>r.feature.hasValidationsInProgress(a),resolveMask:a=>r.resolveMask(a),createArrayItemId:(a,o)=>r.createArrayItemId(a,o),undo:()=>r.feature.undo(),redo:()=>r.feature.redo()}}}var Bt= (_class21 =class{constructor(t){;_class21.prototype.__init59.call(this);this.deps=t}__init59() {this.fieldStateCache=new Map}getState(){return this.deps.getState()}getUserLayer(){let t=this.deps.getState();return{values:t.values,touched:t.touched}}getValidationLayer(){let t=this.deps.getState();return{errors:t.errors,isValidating:t.isValidating,isValid:t.isValid}}getDerivedLayer(){return{isDirty:this.deps.getState().isDirty}}getFeatureLayer(){let t=this.deps.getState();return{persist:t.persist,isSubmitting:t.isSubmitting}}getFlag(t){return this.deps.getState()[t]}getPersistMetadata(){return this.deps.getState().persist}getFieldState(t){let e=t,i=this.deps.getState(),s=this.fieldStateCache.get(e),n=_chunkVBX5I5XGcjs.f.call(void 0, i.values,e),a=i.errors[e],o=!!i.touched[e],c=this.deps.isHidden(e),u=this.deps.isRequired(e),l=this.deps.isFieldDirty(e),d=this.deps.isFieldValidating(e);if(s){let h=s.snapshot;if(h.value===n&&h.error===a&&h.touched===o&&h.isHidden===c&&h.isRequired===u&&h.isDirty===l&&h.isValidating===d)return h}let p=Ut({state:i,path:t,value:n,isHidden:c,isRequired:u,isDirty:l,isValidating:d});return this.fieldStateCache.set(e,{state:i,snapshot:p}),p}invalidatePath(t){this.fieldStateCache.delete(t)}}, _class21);var Tt= (_class22 =class{__init60() {this[D]=!0}__init61() {this[I]=!0}constructor(t={}){;_class22.prototype.__init60.call(this);_class22.prototype.__init61.call(this);let e=Me({rawConfig:t});this._config=e.config,this.storeId=e.storeId;let i=new Bt({getState:()=>e.runtime.getState(),isHidden:a=>e.runtime.capabilities.query.isHidden(a),isRequired:a=>e.runtime.capabilities.query.isRequired(a),isFieldDirty:a=>e.runtime.capabilities.query.isFieldDirty(a),isFieldValidating:a=>e.runtime.capabilities.query.isFieldValidating(a)}),s=Ye({runtime:e.runtime,config:this._config,fieldRegistry:e.fieldRegistry,dirtyManager:e.dirtyManager,stateReader:i}),n=Xe({identity:{storeId:this.storeId,config:this._config},read:s.read,observe:s.observe,write:s.write,feature:s.feature,getFieldConfig:a=>e.fieldRegistry.getFieldConfig(a),resolveMask:a=>qt({path:a,getFieldConfig:o=>e.fieldRegistry.getFieldConfig(o),masks:e.maskManager.getAllMasks()}),createArrayItemId:(a,o)=>this._config.idFactory({scope:"array",path:a,index:o})});this.read=n.read,this.observe=n.observe,this.write=n.write,this.feature=n.feature,e.runtime.effects.attachStorePort({getState:()=>this.read.getState(),getHistoryMetadata:()=>this.read.getHistoryMetadata(),undo:()=>this.feature.undo(),redo:()=>this.feature.redo(),reset:()=>this.write.reset()})}}, _class22);function Qe(r={}){return new Tt(r)}function Ze(r){if(!r||typeof r!="object")return!1;let t=r;return t[D]===!0&&!!t.read&&!!t.observe&&!!t.write&&!!t.feature}function bi(r){if(Ze(r))return r;throw new Error("BitForm: o store informado n\xE3o exp\xF5e a API necess\xE1ria para hooks/framework bindings.")}function Bi(r){return!r||typeof r!="object"?!1:r[I]===!0}function Ti(r){if(!Ze(r))throw new Error("BitForm: o store informado n\xE3o possui branding de hooks (BIT_HOOKS_API_SYMBOL).");if(!Bi(r))throw new Error("BitForm: o store informado n\xE3o possui branding de framework (BIT_FRAMEWORK_STORE_SYMBOL).");return r}function vi(r){return Object.defineProperty(r,D,{value:!0,enumerable:!1,configurable:!1,writable:!1}),Object.defineProperty(r,I,{value:!0,enumerable:!1,configurable:!1,writable:!1}),r}function Pi(r={}){let t=Qe(r),e={read:t.read,observe:t.observe,write:t.write,feature:t.feature};return vi(e)}function xi(r){return r.read}function Ei(r){return r.observe}function Ci(r){return r.write}function Fi(r){return r.feature}function Vi(r,t){let e={};for(let i of t)e[i]=r[i];return e}exports.a = Et; exports.b = li; exports.c = bi; exports.d = Ti; exports.e = Pi; exports.f = xi; exports.g = Ei; exports.h = Ci; exports.i = Fi; exports.j = Vi;
2
- //# sourceMappingURL=chunk-4RQFECC7.cjs.map
@@ -1,2 +0,0 @@
1
- function p(e,n=new WeakMap){if(e===null||typeof e!="object")return e;if(typeof structuredClone=="function")try{return structuredClone(e)}catch{}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(n.has(e))return n.get(e);if(Array.isArray(e)){let r=[];n.set(e,r);for(let s of e)r.push(p(s,n));return r}let t={};n.set(e,t);for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=p(e[r],n));return t}function d(e){return p(e)}function R(e,n){if(n===void 0)return d(e);if(n===null||typeof n!="object"||n instanceof Date||n instanceof RegExp||Array.isArray(n))return d(n);let t=e&&typeof e=="object"&&!Array.isArray(e)?d(e):{};for(let r of Object.keys(n)){let s=n[r],i=t[r];if(s!==null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp)){t[r]=R(i,s);continue}t[r]=d(s)}return t}function A(e,n){return e===n?!0:e===null||typeof e!="object"||n===null||typeof n!="object"?!1:m(e,n)}function m(e,n){return w(e,n,new WeakSet)}function w(e,n,t){if(e===n)return!0;if(e===null||typeof e!="object"||n===null||typeof n!="object"||t.has(e))return!1;if(t.add(e),e instanceof Date&&n instanceof Date)return e.getTime()===n.getTime();if(e instanceof RegExp&&n instanceof RegExp)return e.toString()===n.toString();let r=Object.keys(e),s=Object.keys(n);if(r.length!==s.length)return!1;for(let i of r)if(!Object.prototype.hasOwnProperty.call(n,i)||!w(e[i],n[i],t))return!1;return!0}function b(e,n,t="",r=new Set,s=new WeakMap){if(A(e,n))return r;if(e===null||typeof e!="object"||n===null||typeof n!="object")return t&&r.add(t),r;let i=s.get(e);if(i?.has(n))return r;if(i?i.add(n):s.set(e,new WeakSet([n])),Array.isArray(e)||Array.isArray(n))return!A(e,n)&&t&&r.add(t),r;let a=new Set;for(let o of Object.keys(e||{}))a.add(o);for(let o of Object.keys(n||{}))a.add(o);for(let o of a){let c=t?`${t}.${o}`:o;b(e?.[o],n?.[o],c,r,s)}return r}var g=new Map;function T(e,n){if(g.has(e))g.delete(e);else if(g.size>=5e3){let t=g.keys().next().value;t!==void 0&&g.delete(t)}g.set(e,n)}function k(e){let n=g.get(e);if(n)return n;let t=e.split(".");return T(e,t),t}function K(e,n){if(!n)return e;let t=k(n),r=e;for(let s of t){if(r==null)return;r=r[s]}return r}function D(e,n,t){if(!n)return t;let r=k(n),s=Array.isArray(e)?[...e]:{...e},i=s;for(let a=0;a<r.length-1;a++){let o=r[a],c=r[a+1],u=Number(c),y=Number.isInteger(u)&&String(u)===c,f=i[o];f==null?i[o]=y?[]:{}:i[o]=Array.isArray(f)?[...f]:{...f},i=i[o]}return i[r[r.length-1]]=t,s}function E(e,n){if(n.length===0)return e;let t=Array.isArray(e)?[...e]:{...e},r=new WeakSet;t&&typeof t=="object"&&r.add(t);for(let[s,i]of n){let a=k(s),o=t;for(let c=0;c<a.length-1;c++){let u=a[c],y=a[c+1],f=Number(y),x=Number.isInteger(f)&&String(f)===y,l=o[u];l==null?(o[u]=x?[]:{},r.add(o[u])):typeof l=="object"?r.has(l)||(o[u]=Array.isArray(l)?[...l]:{...l},r.add(o[u])):(o[u]=x?[]:{},r.add(o[u])),o=o[u]}o[a[a.length-1]]=i}return t}function S(e,n){if(n.length===0)return e;let t=Array.isArray(e)?[...e]:{...e},r=new WeakSet;t&&typeof t=="object"&&r.add(t);for(let s of n){if(!s)return Array.isArray(e)?[]:{};let i=k(s),a=t;for(let c=0;c<i.length-1;c++){let u=i[c],y=a?.[u];if(y==null){a=void 0;break}if(typeof y=="object")r.has(y)||(a[u]=Array.isArray(y)?[...y]:{...y},r.add(a[u]));else{a=void 0;break}a=a[u]}if(!a)continue;let o=i[i.length-1];Array.isArray(a)?a.splice(Number(o),1):a&&typeof a=="object"&&delete a[o]}return t}function O(e,n){let t={},r=`${n}.`;for(let s in e)s!==n&&!s.startsWith(r)&&(t[s]=e[s]);return t}function $(e,n,t){let r={},s={},i={},a=`${n}.`;for(let o of Object.keys(e.errors)){let c=h(o,a,t);c&&(r[c]=e.errors[o])}for(let o of Object.keys(e.touched)){let c=h(o,a,t);c&&(s[c]=e.touched[o])}for(let o of Object.keys(e.isValidating)){let c=h(o,a,t);c&&(i[c]=e.isValidating[o])}return{errors:r,touched:s,isValidating:i}}function h(e,n,t){if(!e.startsWith(n))return e;let s=e.substring(n.length).split("."),i=parseInt(s[0],10),a=t(i);if(a===null)return null;let o=s.slice(1).join(".");return o?`${n}${a}.${o}`:`${n}${a}`}function V(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e.errors??e;if(typeof n!="object"||n===null||Array.isArray(n))return!1;let t=Object.entries(n);return t.length===0?!1:t.every(([r,s])=>r.length>0&&(typeof s=="string"||Array.isArray(s)&&s.every(i=>typeof i=="string")))}function N(e){return V(e)?e.errors??e:{}}export{d as a,R as b,A as c,m as d,b as e,K as f,D as g,E as h,S as i,O as j,$ as k,V as l,N as m};
2
- //# sourceMappingURL=chunk-FLFIOW75.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/utils/clone.ts","../src/core/utils/structural.ts","../src/core/utils/path-value.ts","../src/core/utils/array-meta.ts","../src/core/utils/server-errors.ts"],"sourcesContent":["export function cloneValue<T>(\n obj: T,\n visited: WeakMap<object, unknown> = new WeakMap(),\n): T {\n if (obj === null || typeof obj !== \"object\") {\n return obj;\n }\n\n if (typeof structuredClone === \"function\") {\n try {\n return structuredClone(obj);\n } catch {\n // Alguns runtimes lançam para payloads não suportados (ex.: funções).\n // Nesses casos, seguimos para o clone recursivo para manter fail-open.\n }\n }\n\n if (obj instanceof Date) {\n return new Date(obj.getTime()) as any as T;\n }\n\n if (obj instanceof RegExp) {\n return new RegExp(obj.source, obj.flags) as any as T;\n }\n\n if (visited.has(obj as object)) {\n return visited.get(obj as object) as T;\n }\n\n if (Array.isArray(obj)) {\n const clone: unknown[] = [];\n visited.set(obj as object, clone);\n\n for (const item of obj) {\n clone.push(cloneValue(item, visited));\n }\n\n return clone as T;\n }\n\n const clone: any = {};\n visited.set(obj as object, clone);\n\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n clone[key] = cloneValue((obj as any)[key], visited);\n }\n }\n\n return clone as T;\n}\n","import { cloneValue } from \"./clone\";\n\nexport function deepClone<T>(obj: T): T {\n return cloneValue(obj);\n}\n\nexport function deepMerge<T>(target: T, source: any): T {\n if (source === undefined) {\n return deepClone(target);\n }\n\n if (\n source === null ||\n typeof source !== \"object\" ||\n source instanceof Date ||\n source instanceof RegExp ||\n Array.isArray(source)\n ) {\n return deepClone(source as T);\n }\n\n const base =\n target && typeof target === \"object\" && !Array.isArray(target)\n ? deepClone(target as any)\n : ({} as Record<string, unknown>);\n\n for (const key of Object.keys(source)) {\n const sourceValue = source[key];\n const baseValue = (base as Record<string, unknown>)[key];\n\n if (\n sourceValue !== null &&\n typeof sourceValue === \"object\" &&\n !Array.isArray(sourceValue) &&\n !(sourceValue instanceof Date) &&\n !(sourceValue instanceof RegExp)\n ) {\n (base as Record<string, unknown>)[key] = deepMerge(\n baseValue,\n sourceValue,\n );\n continue;\n }\n\n (base as Record<string, unknown>)[key] = deepClone(sourceValue);\n }\n\n return base as T;\n}\n\nexport function valueEqual(a: any, b: any): boolean {\n if (a === b) return true;\n if (\n a === null ||\n typeof a !== \"object\" ||\n b === null ||\n typeof b !== \"object\"\n ) {\n return false;\n }\n return deepEqual(a, b);\n}\n\nexport function deepEqual(a: any, b: any): boolean {\n return deepEqualInner(a, b, new WeakSet());\n}\n\nfunction deepEqualInner(a: any, b: any, visited: WeakSet<object>): boolean {\n if (a === b) return true;\n if (\n a === null ||\n typeof a !== \"object\" ||\n b === null ||\n typeof b !== \"object\"\n ) {\n return false;\n }\n\n if (visited.has(a)) return false;\n visited.add(a);\n\n if (a instanceof Date && b instanceof Date)\n return a.getTime() === b.getTime();\n if (a instanceof RegExp && b instanceof RegExp)\n return a.toString() === b.toString();\n\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n if (keysA.length !== keysB.length) return false;\n\n for (const key of keysA) {\n if (\n !Object.prototype.hasOwnProperty.call(b, key) ||\n !deepEqualInner(a[key], b[key], visited)\n ) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function collectDirtyPaths(\n obj: any,\n initial: any,\n prefix = \"\",\n result: Set<string> = new Set(),\n visitedPairs: WeakMap<object, WeakSet<object>> = new WeakMap(),\n): Set<string> {\n if (valueEqual(obj, initial)) return result;\n if (\n obj === null ||\n typeof obj !== \"object\" ||\n initial === null ||\n typeof initial !== \"object\"\n ) {\n if (prefix) result.add(prefix);\n return result;\n }\n\n const visitedInitials = visitedPairs.get(obj as object);\n if (visitedInitials?.has(initial as object)) {\n return result;\n }\n\n if (visitedInitials) {\n visitedInitials.add(initial as object);\n } else {\n visitedPairs.set(obj as object, new WeakSet([initial as object]));\n }\n\n if (Array.isArray(obj) || Array.isArray(initial)) {\n if (!valueEqual(obj, initial) && prefix) result.add(prefix);\n return result;\n }\n const allKeys = new Set<string>();\n for (const key of Object.keys(obj || {})) {\n allKeys.add(key);\n }\n for (const key of Object.keys(initial || {})) {\n allKeys.add(key);\n }\n for (const k of allKeys) {\n const p = prefix ? `${prefix}.${k}` : k;\n collectDirtyPaths(\n (obj as any)?.[k],\n (initial as any)?.[k],\n p,\n result,\n visitedPairs,\n );\n }\n return result;\n}\n","const PATH_CACHE_MAX = 5000;\nconst pathCache = new Map<string, string[]>();\n\nfunction setPathCacheEntry(path: string, keys: string[]) {\n if (pathCache.has(path)) {\n pathCache.delete(path);\n } else if (pathCache.size >= PATH_CACHE_MAX) {\n const oldestKey = pathCache.keys().next().value;\n if (oldestKey !== undefined) {\n pathCache.delete(oldestKey);\n }\n }\n\n pathCache.set(path, keys);\n}\n\nfunction getPathKeys(path: string): string[] {\n const cached = pathCache.get(path);\n if (cached) {\n return cached;\n }\n\n const keys = path.split(\".\");\n setPathCacheEntry(path, keys);\n return keys;\n}\n\nexport function getDeepValue(obj: any, path: string): any {\n if (!path) return obj;\n\n const keys = getPathKeys(path);\n\n let current = obj;\n for (const key of keys) {\n if (current === null || current === undefined) return undefined;\n current = current[key];\n }\n return current;\n}\n\nexport function setDeepValue(obj: any, path: string, value: any): any {\n if (!path) return value;\n\n const keys = getPathKeys(path);\n\n const result = Array.isArray(obj) ? [...obj] : { ...obj };\n let current = result;\n\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i];\n const nextKey = keys[i + 1];\n\n const nextAsNumber = Number(nextKey);\n const isNextNumeric =\n Number.isInteger(nextAsNumber) && String(nextAsNumber) === nextKey;\n const currentValue = current[key];\n\n if (currentValue === null || currentValue === undefined) {\n current[key] = isNextNumeric ? [] : {};\n } else {\n current[key] = Array.isArray(currentValue)\n ? [...currentValue]\n : { ...currentValue };\n }\n\n current = current[key];\n }\n\n current[keys[keys.length - 1]] = value;\n\n return result;\n}\n\nexport function setDeepValues(\n obj: any,\n updates: ReadonlyArray<readonly [path: string, value: any]>,\n): any {\n if (updates.length === 0) {\n return obj;\n }\n\n const root = Array.isArray(obj) ? [...obj] : { ...obj };\n const clonedNodes = new WeakSet<object>();\n if (root && typeof root === \"object\") {\n clonedNodes.add(root);\n }\n\n for (const [path, value] of updates) {\n const keys = getPathKeys(path);\n let current: any = root;\n\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i];\n const nextKey = keys[i + 1];\n\n const nextAsNumber = Number(nextKey);\n const isNextNumeric =\n Number.isInteger(nextAsNumber) && String(nextAsNumber) === nextKey;\n\n const currentValue = current[key];\n\n if (currentValue === null || currentValue === undefined) {\n current[key] = isNextNumeric ? [] : {};\n clonedNodes.add(current[key]);\n } else if (typeof currentValue === \"object\") {\n if (!clonedNodes.has(currentValue)) {\n current[key] = Array.isArray(currentValue)\n ? [...currentValue]\n : { ...currentValue };\n clonedNodes.add(current[key]);\n }\n } else {\n current[key] = isNextNumeric ? [] : {};\n clonedNodes.add(current[key]);\n }\n\n current = current[key];\n }\n\n current[keys[keys.length - 1]] = value;\n }\n\n return root;\n}\n\nexport function unsetDeepValue(obj: any, path: string): any {\n if (!path) {\n return Array.isArray(obj) ? [] : {};\n }\n\n const keys = getPathKeys(path);\n const root = Array.isArray(obj) ? [...obj] : { ...obj };\n let current: any = root;\n\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i];\n const currentValue = current?.[key];\n\n if (currentValue === null || currentValue === undefined) {\n return root;\n }\n\n current[key] = Array.isArray(currentValue)\n ? [...currentValue]\n : { ...currentValue };\n\n current = current[key];\n }\n\n const leafKey = keys[keys.length - 1];\n\n if (Array.isArray(current)) {\n current.splice(Number(leafKey), 1);\n } else if (current && typeof current === \"object\") {\n delete current[leafKey];\n }\n\n return root;\n}\n\nexport function unsetDeepValues(obj: any, paths: ReadonlyArray<string>): any {\n if (paths.length === 0) {\n return obj;\n }\n\n const root = Array.isArray(obj) ? [...obj] : { ...obj };\n const clonedNodes = new WeakSet<object>();\n if (root && typeof root === \"object\") {\n clonedNodes.add(root);\n }\n\n for (const path of paths) {\n if (!path) {\n return Array.isArray(obj) ? [] : {};\n }\n\n const keys = getPathKeys(path);\n let current: any = root;\n\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i];\n const currentValue = current?.[key];\n\n if (currentValue === null || currentValue === undefined) {\n current = undefined;\n break;\n }\n\n if (typeof currentValue === \"object\") {\n if (!clonedNodes.has(currentValue)) {\n current[key] = Array.isArray(currentValue)\n ? [...currentValue]\n : { ...currentValue };\n clonedNodes.add(current[key]);\n }\n } else {\n current = undefined;\n break;\n }\n\n current = current[key];\n }\n\n if (!current) {\n continue;\n }\n\n const leafKey = keys[keys.length - 1];\n\n if (Array.isArray(current)) {\n current.splice(Number(leafKey), 1);\n } else if (current && typeof current === \"object\") {\n delete current[leafKey];\n }\n }\n\n return root;\n}\n","export function cleanPrefixedKeys(\n obj: Record<string, any>,\n prefix: string,\n): Record<string, any> {\n const newObj: Record<string, any> = {};\n const prefixWithDot = `${prefix}.`;\n\n for (const key in obj) {\n if (key !== prefix && !key.startsWith(prefixWithDot)) {\n newObj[key] = obj[key];\n }\n }\n return newObj;\n}\n\nexport const shiftKeys = (\n obj: Record<string, any>,\n path: string,\n removedIndex: number,\n) => {\n return reindexObjectKeys(obj, path, (currentIdx) => {\n if (currentIdx === removedIndex) {\n return null;\n }\n\n return currentIdx > removedIndex ? currentIdx - 1 : currentIdx;\n });\n};\n\nexport const swapKeys = (\n obj: Record<string, any>,\n path: string,\n indexA: number,\n indexB: number,\n) => {\n return reindexObjectKeys(obj, path, (currentIdx) => {\n if (currentIdx === indexA) {\n return indexB;\n }\n\n if (currentIdx === indexB) {\n return indexA;\n }\n\n return currentIdx;\n });\n};\n\nexport const moveKeys = (\n obj: Record<string, any>,\n path: string,\n from: number,\n to: number,\n) => {\n return reindexObjectKeys(obj, path, (currentIdx) => {\n if (currentIdx === from) {\n return to;\n }\n\n if (from < to && currentIdx > from && currentIdx <= to) {\n return currentIdx - 1;\n }\n\n if (from > to && currentIdx >= to && currentIdx < from) {\n return currentIdx + 1;\n }\n\n return currentIdx;\n });\n};\n\nexport function reindexFieldArrayMeta(\n state: {\n errors: Record<string, any>;\n touched: Record<string, any>;\n isValidating: Record<string, any>;\n },\n path: string,\n remapIndex: (index: number) => number | null,\n) {\n const nextErrors: Record<string, any> = {};\n const nextTouched: Record<string, any> = {};\n const nextIsValidating: Record<string, any> = {};\n\n const prefix = `${path}.`;\n\n for (const key of Object.keys(state.errors)) {\n const nextKey = remapIndexedPath(key, prefix, remapIndex);\n if (nextKey) nextErrors[nextKey] = state.errors[key];\n }\n\n for (const key of Object.keys(state.touched)) {\n const nextKey = remapIndexedPath(key, prefix, remapIndex);\n if (nextKey) nextTouched[nextKey] = state.touched[key];\n }\n\n for (const key of Object.keys(state.isValidating)) {\n const nextKey = remapIndexedPath(key, prefix, remapIndex);\n if (nextKey) nextIsValidating[nextKey] = state.isValidating[key];\n }\n\n return {\n errors: nextErrors,\n touched: nextTouched,\n isValidating: nextIsValidating,\n };\n}\n\nfunction remapIndexedPath(\n key: string,\n prefix: string,\n remapIndex: (index: number) => number | null,\n) {\n if (!key.startsWith(prefix)) {\n return key;\n }\n\n const remaining = key.substring(prefix.length);\n const parts = remaining.split(\".\");\n const currentIdx = parseInt(parts[0], 10);\n const nextIdx = remapIndex(currentIdx);\n\n if (nextIdx === null) {\n return null;\n }\n\n const rest = parts.slice(1).join(\".\");\n return rest ? `${prefix}${nextIdx}.${rest}` : `${prefix}${nextIdx}`;\n}\n\nfunction reindexObjectKeys(\n obj: Record<string, any>,\n path: string,\n remapIndex: (index: number) => number | null,\n) {\n const nextObject: Record<string, any> = {};\n const prefix = `${path}.`;\n\n for (const key of Object.keys(obj)) {\n if (!key.startsWith(prefix)) {\n nextObject[key] = obj[key];\n continue;\n }\n\n const remaining = key.substring(prefix.length);\n const parts = remaining.split(\".\");\n const currentIdx = parseInt(parts[0], 10);\n const nextIdx = remapIndex(currentIdx);\n\n if (nextIdx === null) {\n continue;\n }\n\n const rest = parts.slice(1).join(\".\");\n const nextKey = rest\n ? `${prefix}${nextIdx}.${rest}`\n : `${prefix}${nextIdx}`;\n nextObject[nextKey] = obj[key];\n }\n\n return nextObject;\n}\n","export function isValidationErrorShape(\n x: unknown,\n): x is Record<string, string | string[]> {\n if (typeof x !== \"object\" || x === null || Array.isArray(x)) return false;\n\n const obj = (x as Record<string, unknown>).errors ?? x;\n if (typeof obj !== \"object\" || obj === null || Array.isArray(obj)) {\n return false;\n }\n\n const entries = Object.entries(obj as Record<string, unknown>);\n if (entries.length === 0) {\n return false;\n }\n\n return entries.every(\n ([key, v]) =>\n key.length > 0 &&\n (typeof v === \"string\" ||\n (Array.isArray(v) && v.every((i) => typeof i === \"string\"))),\n );\n}\n\nexport function extractServerErrors(\n x: unknown,\n): Record<string, string | string[]> {\n if (!isValidationErrorShape(x)) return {};\n\n const obj = (x as Record<string, unknown>).errors ?? x;\n return obj as Record<string, string | string[]>;\n}\n"],"mappings":"AAAO,SAASA,EACdC,EACAC,EAAoC,IAAI,QACrC,CACH,GAAID,IAAQ,MAAQ,OAAOA,GAAQ,SACjC,OAAOA,EAGT,GAAI,OAAO,iBAAoB,WAC7B,GAAI,CACF,OAAO,gBAAgBA,CAAG,CAC5B,MAAQ,CAGR,CAGF,GAAIA,aAAe,KACjB,OAAO,IAAI,KAAKA,EAAI,QAAQ,CAAC,EAG/B,GAAIA,aAAe,OACjB,OAAO,IAAI,OAAOA,EAAI,OAAQA,EAAI,KAAK,EAGzC,GAAIC,EAAQ,IAAID,CAAa,EAC3B,OAAOC,EAAQ,IAAID,CAAa,EAGlC,GAAI,MAAM,QAAQA,CAAG,EAAG,CACtB,IAAME,EAAmB,CAAC,EAC1BD,EAAQ,IAAID,EAAeE,CAAK,EAEhC,QAAWC,KAAQH,EACjBE,EAAM,KAAKH,EAAWI,EAAMF,CAAO,CAAC,EAGtC,OAAOC,CACT,CAEA,IAAMA,EAAa,CAAC,EACpBD,EAAQ,IAAID,EAAeE,CAAK,EAEhC,QAAWE,KAAOJ,EACZ,OAAO,UAAU,eAAe,KAAKA,EAAKI,CAAG,IAC/CF,EAAME,CAAG,EAAIL,EAAYC,EAAYI,CAAG,EAAGH,CAAO,GAItD,OAAOC,CACT,CChDO,SAASG,EAAaC,EAAW,CACtC,OAAOC,EAAWD,CAAG,CACvB,CAEO,SAASE,EAAaC,EAAWC,EAAgB,CACtD,GAAIA,IAAW,OACb,OAAOL,EAAUI,CAAM,EAGzB,GACEC,IAAW,MACX,OAAOA,GAAW,UAClBA,aAAkB,MAClBA,aAAkB,QAClB,MAAM,QAAQA,CAAM,EAEpB,OAAOL,EAAUK,CAAW,EAG9B,IAAMC,EACJF,GAAU,OAAOA,GAAW,UAAY,CAAC,MAAM,QAAQA,CAAM,EACzDJ,EAAUI,CAAa,EACtB,CAAC,EAER,QAAWG,KAAO,OAAO,KAAKF,CAAM,EAAG,CACrC,IAAMG,EAAcH,EAAOE,CAAG,EACxBE,EAAaH,EAAiCC,CAAG,EAEvD,GACEC,IAAgB,MAChB,OAAOA,GAAgB,UACvB,CAAC,MAAM,QAAQA,CAAW,GAC1B,EAAEA,aAAuB,OACzB,EAAEA,aAAuB,QACzB,CACCF,EAAiCC,CAAG,EAAIJ,EACvCM,EACAD,CACF,EACA,QACF,CAECF,EAAiCC,CAAG,EAAIP,EAAUQ,CAAW,CAChE,CAEA,OAAOF,CACT,CAEO,SAASI,EAAWC,EAAQC,EAAiB,CAClD,OAAID,IAAMC,EAAU,GAElBD,IAAM,MACN,OAAOA,GAAM,UACbC,IAAM,MACN,OAAOA,GAAM,SAEN,GAEFC,EAAUF,EAAGC,CAAC,CACvB,CAEO,SAASC,EAAUF,EAAQC,EAAiB,CACjD,OAAOE,EAAeH,EAAGC,EAAG,IAAI,OAAS,CAC3C,CAEA,SAASE,EAAeH,EAAQC,EAAQG,EAAmC,CACzE,GAAIJ,IAAMC,EAAG,MAAO,GAUpB,GARED,IAAM,MACN,OAAOA,GAAM,UACbC,IAAM,MACN,OAAOA,GAAM,UAKXG,EAAQ,IAAIJ,CAAC,EAAG,MAAO,GAG3B,GAFAI,EAAQ,IAAIJ,CAAC,EAETA,aAAa,MAAQC,aAAa,KACpC,OAAOD,EAAE,QAAQ,IAAMC,EAAE,QAAQ,EACnC,GAAID,aAAa,QAAUC,aAAa,OACtC,OAAOD,EAAE,SAAS,IAAMC,EAAE,SAAS,EAErC,IAAMI,EAAQ,OAAO,KAAKL,CAAC,EACrBM,EAAQ,OAAO,KAAKL,CAAC,EAE3B,GAAII,EAAM,SAAWC,EAAM,OAAQ,MAAO,GAE1C,QAAWV,KAAOS,EAChB,GACE,CAAC,OAAO,UAAU,eAAe,KAAKJ,EAAGL,CAAG,GAC5C,CAACO,EAAeH,EAAEJ,CAAG,EAAGK,EAAEL,CAAG,EAAGQ,CAAO,EAEvC,MAAO,GAIX,MAAO,EACT,CAEO,SAASG,EACdjB,EACAkB,EACAC,EAAS,GACTC,EAAsB,IAAI,IAC1BC,EAAiD,IAAI,QACxC,CACb,GAAIZ,EAAWT,EAAKkB,CAAO,EAAG,OAAOE,EACrC,GACEpB,IAAQ,MACR,OAAOA,GAAQ,UACfkB,IAAY,MACZ,OAAOA,GAAY,SAEnB,OAAIC,GAAQC,EAAO,IAAID,CAAM,EACtBC,EAGT,IAAME,EAAkBD,EAAa,IAAIrB,CAAa,EACtD,GAAIsB,GAAiB,IAAIJ,CAAiB,EACxC,OAAOE,EAST,GANIE,EACFA,EAAgB,IAAIJ,CAAiB,EAErCG,EAAa,IAAIrB,EAAe,IAAI,QAAQ,CAACkB,CAAiB,CAAC,CAAC,EAG9D,MAAM,QAAQlB,CAAG,GAAK,MAAM,QAAQkB,CAAO,EAC7C,MAAI,CAACT,EAAWT,EAAKkB,CAAO,GAAKC,GAAQC,EAAO,IAAID,CAAM,EACnDC,EAET,IAAMG,EAAU,IAAI,IACpB,QAAWjB,KAAO,OAAO,KAAKN,GAAO,CAAC,CAAC,EACrCuB,EAAQ,IAAIjB,CAAG,EAEjB,QAAWA,KAAO,OAAO,KAAKY,GAAW,CAAC,CAAC,EACzCK,EAAQ,IAAIjB,CAAG,EAEjB,QAAWkB,KAAKD,EAAS,CACvB,IAAME,EAAIN,EAAS,GAAGA,CAAM,IAAIK,CAAC,GAAKA,EACtCP,EACGjB,IAAcwB,CAAC,EACfN,IAAkBM,CAAC,EACpBC,EACAL,EACAC,CACF,CACF,CACA,OAAOD,CACT,CCzJA,IAAMM,EAAY,IAAI,IAEtB,SAASC,EAAkBC,EAAcC,EAAgB,CACvD,GAAIH,EAAU,IAAIE,CAAI,EACpBF,EAAU,OAAOE,CAAI,UACZF,EAAU,MAAQ,IAAgB,CAC3C,IAAMI,EAAYJ,EAAU,KAAK,EAAE,KAAK,EAAE,MACtCI,IAAc,QAChBJ,EAAU,OAAOI,CAAS,CAE9B,CAEAJ,EAAU,IAAIE,EAAMC,CAAI,CAC1B,CAEA,SAASE,EAAYH,EAAwB,CAC3C,IAAMI,EAASN,EAAU,IAAIE,CAAI,EACjC,GAAII,EACF,OAAOA,EAGT,IAAMH,EAAOD,EAAK,MAAM,GAAG,EAC3B,OAAAD,EAAkBC,EAAMC,CAAI,EACrBA,CACT,CAEO,SAASI,EAAaC,EAAUN,EAAmB,CACxD,GAAI,CAACA,EAAM,OAAOM,EAElB,IAAML,EAAOE,EAAYH,CAAI,EAEzBO,EAAUD,EACd,QAAWE,KAAOP,EAAM,CACtB,GAAIM,GAAY,KAA+B,OAC/CA,EAAUA,EAAQC,CAAG,CACvB,CACA,OAAOD,CACT,CAEO,SAASE,EAAaH,EAAUN,EAAcU,EAAiB,CACpE,GAAI,CAACV,EAAM,OAAOU,EAElB,IAAMT,EAAOE,EAAYH,CAAI,EAEvBW,EAAS,MAAM,QAAQL,CAAG,EAAI,CAAC,GAAGA,CAAG,EAAI,CAAE,GAAGA,CAAI,EACpDC,EAAUI,EAEd,QAASC,EAAI,EAAGA,EAAIX,EAAK,OAAS,EAAGW,IAAK,CACxC,IAAMJ,EAAMP,EAAKW,CAAC,EACZC,EAAUZ,EAAKW,EAAI,CAAC,EAEpBE,EAAe,OAAOD,CAAO,EAC7BE,EACJ,OAAO,UAAUD,CAAY,GAAK,OAAOA,CAAY,IAAMD,EACvDG,EAAeT,EAAQC,CAAG,EAE5BQ,GAAiB,KACnBT,EAAQC,CAAG,EAAIO,EAAgB,CAAC,EAAI,CAAC,EAErCR,EAAQC,CAAG,EAAI,MAAM,QAAQQ,CAAY,EACrC,CAAC,GAAGA,CAAY,EAChB,CAAE,GAAGA,CAAa,EAGxBT,EAAUA,EAAQC,CAAG,CACvB,CAEA,OAAAD,EAAQN,EAAKA,EAAK,OAAS,CAAC,CAAC,EAAIS,EAE1BC,CACT,CAEO,SAASM,EACdX,EACAY,EACK,CACL,GAAIA,EAAQ,SAAW,EACrB,OAAOZ,EAGT,IAAMa,EAAO,MAAM,QAAQb,CAAG,EAAI,CAAC,GAAGA,CAAG,EAAI,CAAE,GAAGA,CAAI,EAChDc,EAAc,IAAI,QACpBD,GAAQ,OAAOA,GAAS,UAC1BC,EAAY,IAAID,CAAI,EAGtB,OAAW,CAACnB,EAAMU,CAAK,IAAKQ,EAAS,CACnC,IAAMjB,EAAOE,EAAYH,CAAI,EACzBO,EAAeY,EAEnB,QAASP,EAAI,EAAGA,EAAIX,EAAK,OAAS,EAAGW,IAAK,CACxC,IAAMJ,EAAMP,EAAKW,CAAC,EACZC,EAAUZ,EAAKW,EAAI,CAAC,EAEpBE,EAAe,OAAOD,CAAO,EAC7BE,EACJ,OAAO,UAAUD,CAAY,GAAK,OAAOA,CAAY,IAAMD,EAEvDG,EAAeT,EAAQC,CAAG,EAE5BQ,GAAiB,MACnBT,EAAQC,CAAG,EAAIO,EAAgB,CAAC,EAAI,CAAC,EACrCK,EAAY,IAAIb,EAAQC,CAAG,CAAC,GACnB,OAAOQ,GAAiB,SAC5BI,EAAY,IAAIJ,CAAY,IAC/BT,EAAQC,CAAG,EAAI,MAAM,QAAQQ,CAAY,EACrC,CAAC,GAAGA,CAAY,EAChB,CAAE,GAAGA,CAAa,EACtBI,EAAY,IAAIb,EAAQC,CAAG,CAAC,IAG9BD,EAAQC,CAAG,EAAIO,EAAgB,CAAC,EAAI,CAAC,EACrCK,EAAY,IAAIb,EAAQC,CAAG,CAAC,GAG9BD,EAAUA,EAAQC,CAAG,CACvB,CAEAD,EAAQN,EAAKA,EAAK,OAAS,CAAC,CAAC,EAAIS,CACnC,CAEA,OAAOS,CACT,CAqCO,SAASE,EAAgBC,EAAUC,EAAmC,CAC3E,GAAIA,EAAM,SAAW,EACnB,OAAOD,EAGT,IAAME,EAAO,MAAM,QAAQF,CAAG,EAAI,CAAC,GAAGA,CAAG,EAAI,CAAE,GAAGA,CAAI,EAChDG,EAAc,IAAI,QACpBD,GAAQ,OAAOA,GAAS,UAC1BC,EAAY,IAAID,CAAI,EAGtB,QAAWE,KAAQH,EAAO,CACxB,GAAI,CAACG,EACH,OAAO,MAAM,QAAQJ,CAAG,EAAI,CAAC,EAAI,CAAC,EAGpC,IAAMK,EAAOC,EAAYF,CAAI,EACzBG,EAAeL,EAEnB,QAASM,EAAI,EAAGA,EAAIH,EAAK,OAAS,EAAGG,IAAK,CACxC,IAAMC,EAAMJ,EAAKG,CAAC,EACZE,EAAeH,IAAUE,CAAG,EAElC,GAAIC,GAAiB,KAAoC,CACvDH,EAAU,OACV,KACF,CAEA,GAAI,OAAOG,GAAiB,SACrBP,EAAY,IAAIO,CAAY,IAC/BH,EAAQE,CAAG,EAAI,MAAM,QAAQC,CAAY,EACrC,CAAC,GAAGA,CAAY,EAChB,CAAE,GAAGA,CAAa,EACtBP,EAAY,IAAII,EAAQE,CAAG,CAAC,OAEzB,CACLF,EAAU,OACV,KACF,CAEAA,EAAUA,EAAQE,CAAG,CACvB,CAEA,GAAI,CAACF,EACH,SAGF,IAAMI,EAAUN,EAAKA,EAAK,OAAS,CAAC,EAEhC,MAAM,QAAQE,CAAO,EACvBA,EAAQ,OAAO,OAAOI,CAAO,EAAG,CAAC,EACxBJ,GAAW,OAAOA,GAAY,UACvC,OAAOA,EAAQI,CAAO,CAE1B,CAEA,OAAOT,CACT,CCzNO,SAASU,EACdC,EACAC,EACqB,CACrB,IAAMC,EAA8B,CAAC,EAC/BC,EAAgB,GAAGF,CAAM,IAE/B,QAAWG,KAAOJ,EACZI,IAAQH,GAAU,CAACG,EAAI,WAAWD,CAAa,IACjDD,EAAOE,CAAG,EAAIJ,EAAII,CAAG,GAGzB,OAAOF,CACT,CA0DO,SAASG,EACdC,EAKAC,EACAC,EACA,CACA,IAAMC,EAAkC,CAAC,EACnCC,EAAmC,CAAC,EACpCC,EAAwC,CAAC,EAEzCC,EAAS,GAAGL,CAAI,IAEtB,QAAWM,KAAO,OAAO,KAAKP,EAAM,MAAM,EAAG,CAC3C,IAAMQ,EAAUC,EAAiBF,EAAKD,EAAQJ,CAAU,EACpDM,IAASL,EAAWK,CAAO,EAAIR,EAAM,OAAOO,CAAG,EACrD,CAEA,QAAWA,KAAO,OAAO,KAAKP,EAAM,OAAO,EAAG,CAC5C,IAAMQ,EAAUC,EAAiBF,EAAKD,EAAQJ,CAAU,EACpDM,IAASJ,EAAYI,CAAO,EAAIR,EAAM,QAAQO,CAAG,EACvD,CAEA,QAAWA,KAAO,OAAO,KAAKP,EAAM,YAAY,EAAG,CACjD,IAAMQ,EAAUC,EAAiBF,EAAKD,EAAQJ,CAAU,EACpDM,IAASH,EAAiBG,CAAO,EAAIR,EAAM,aAAaO,CAAG,EACjE,CAEA,MAAO,CACL,OAAQJ,EACR,QAASC,EACT,aAAcC,CAChB,CACF,CAEA,SAASI,EACPF,EACAD,EACAJ,EACA,CACA,GAAI,CAACK,EAAI,WAAWD,CAAM,EACxB,OAAOC,EAIT,IAAMG,EADYH,EAAI,UAAUD,EAAO,MAAM,EACrB,MAAM,GAAG,EAC3BK,EAAa,SAASD,EAAM,CAAC,EAAG,EAAE,EAClCE,EAAUV,EAAWS,CAAU,EAErC,GAAIC,IAAY,KACd,OAAO,KAGT,IAAMC,EAAOH,EAAM,MAAM,CAAC,EAAE,KAAK,GAAG,EACpC,OAAOG,EAAO,GAAGP,CAAM,GAAGM,CAAO,IAAIC,CAAI,GAAK,GAAGP,CAAM,GAAGM,CAAO,EACnE,CChIO,SAASE,EACdC,EACwC,CACxC,GAAI,OAAOA,GAAM,UAAYA,IAAM,MAAQ,MAAM,QAAQA,CAAC,EAAG,MAAO,GAEpE,IAAMC,EAAOD,EAA8B,QAAUA,EACrD,GAAI,OAAOC,GAAQ,UAAYA,IAAQ,MAAQ,MAAM,QAAQA,CAAG,EAC9D,MAAO,GAGT,IAAMC,EAAU,OAAO,QAAQD,CAA8B,EAC7D,OAAIC,EAAQ,SAAW,EACd,GAGFA,EAAQ,MACb,CAAC,CAACC,EAAKC,CAAC,IACND,EAAI,OAAS,IACZ,OAAOC,GAAM,UACX,MAAM,QAAQA,CAAC,GAAKA,EAAE,MAAO,GAAM,OAAO,GAAM,QAAQ,EAC/D,CACF,CAEO,SAASC,EACdL,EACmC,CACnC,OAAKD,EAAuBC,CAAC,EAEhBA,EAA8B,QAAUA,EAFd,CAAC,CAI1C","names":["cloneValue","obj","visited","clone","item","key","deepClone","obj","cloneValue","deepMerge","target","source","base","key","sourceValue","baseValue","valueEqual","a","b","deepEqual","deepEqualInner","visited","keysA","keysB","collectDirtyPaths","initial","prefix","result","visitedPairs","visitedInitials","allKeys","k","p","pathCache","setPathCacheEntry","path","keys","oldestKey","getPathKeys","cached","getDeepValue","obj","current","key","setDeepValue","value","result","i","nextKey","nextAsNumber","isNextNumeric","currentValue","setDeepValues","updates","root","clonedNodes","unsetDeepValues","obj","paths","root","clonedNodes","path","keys","getPathKeys","current","i","key","currentValue","leafKey","cleanPrefixedKeys","obj","prefix","newObj","prefixWithDot","key","reindexFieldArrayMeta","state","path","remapIndex","nextErrors","nextTouched","nextIsValidating","prefix","key","nextKey","remapIndexedPath","parts","currentIdx","nextIdx","rest","isValidationErrorShape","x","obj","entries","key","v","extractServerErrors"]}