@gsc-basic/components 1.0.1 → 1.0.3

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 (164) hide show
  1. package/README.md +59 -0
  2. package/dist/es/index.js +48 -30
  3. package/dist/es/node_modules/@codemirror/autocomplete/dist/index.js +15 -15
  4. package/dist/es/node_modules/@codemirror/commands/dist/index.js +31 -25
  5. package/dist/es/node_modules/@codemirror/lang-java/dist/index.js +3 -3
  6. package/dist/es/node_modules/@codemirror/lang-javascript/dist/index.js +8 -8
  7. package/dist/es/node_modules/@codemirror/lang-json/dist/index.js +1 -1
  8. package/dist/es/node_modules/@codemirror/lang-python/dist/index.js +1 -1
  9. package/dist/es/node_modules/@codemirror/lang-sql/dist/index.js +6 -6
  10. package/dist/es/node_modules/@codemirror/lang-xml/dist/index.js +3 -3
  11. package/dist/es/node_modules/@codemirror/lang-yaml/dist/index.js +1 -1
  12. package/dist/es/node_modules/@codemirror/language/dist/index.js +77 -77
  13. package/dist/es/node_modules/@codemirror/lint/dist/index.js +7 -7
  14. package/dist/es/node_modules/@codemirror/search/dist/index.js +432 -465
  15. package/dist/es/node_modules/@codemirror/state/dist/index.js +272 -268
  16. package/dist/es/node_modules/@codemirror/view/dist/index.js +1732 -1647
  17. package/dist/es/node_modules/@lezer/common/dist/index.js +191 -190
  18. package/dist/es/node_modules/@lezer/lr/dist/index.js +5 -3
  19. package/dist/es/node_modules/@tanstack/devtools-event-client/dist/esm/plugin.js +178 -0
  20. package/dist/es/node_modules/@tanstack/form-core/dist/esm/EventClient.js +13 -0
  21. package/dist/es/node_modules/@tanstack/form-core/dist/esm/FieldApi.js +406 -0
  22. package/dist/es/node_modules/@tanstack/form-core/dist/esm/FormApi.js +772 -0
  23. package/dist/es/node_modules/@tanstack/form-core/dist/esm/ValidationLogic.js +55 -0
  24. package/dist/es/node_modules/@tanstack/form-core/dist/esm/metaHelper.js +109 -0
  25. package/dist/es/node_modules/@tanstack/form-core/dist/esm/standardSchemaValidator.js +45 -0
  26. package/dist/es/node_modules/@tanstack/form-core/dist/esm/utils.js +213 -0
  27. package/dist/es/node_modules/@tanstack/pacer-lite/dist/lite-throttler.js +29 -0
  28. package/dist/es/node_modules/@tanstack/store/dist/esm/derived.js +74 -0
  29. package/dist/es/node_modules/@tanstack/store/dist/esm/scheduler.js +79 -0
  30. package/dist/es/node_modules/@tanstack/store/dist/esm/store.js +21 -0
  31. package/dist/es/node_modules/@tanstack/store/dist/esm/types.js +6 -0
  32. package/dist/es/node_modules/@tanstack/table-core/build/lib/index.js +1885 -0
  33. package/dist/es/node_modules/@tanstack/vue-form/dist/esm/useField.js +38 -0
  34. package/dist/es/node_modules/@tanstack/vue-form/dist/esm/useForm.js +33 -0
  35. package/dist/es/node_modules/@tanstack/vue-store/dist/esm/index.js +48 -0
  36. package/dist/es/node_modules/@tanstack/vue-table/build/lib/index.js +159 -0
  37. package/dist/es/node_modules/@vueuse/core/dist/index.js +1 -1
  38. package/dist/es/node_modules/codemirror/dist/index.js +3 -3
  39. package/dist/es/src/Button/index.js +6 -0
  40. package/dist/es/src/Button/src/Button.css +1 -0
  41. package/dist/es/src/Button/src/Button.vue.js +41 -0
  42. package/dist/es/src/Button/src/Button2.css +1 -0
  43. package/dist/es/src/CodeEditor/src/index.css +1 -1
  44. package/dist/es/src/CodeEditor/src/index.vue.js +54 -51
  45. package/dist/es/src/CodeEditor/src/index2.css +1 -1
  46. package/dist/es/src/ConfigProvider/index.js +1 -2
  47. package/dist/es/src/ConfigProvider/src/useGlobalConfig.js +9 -9
  48. package/dist/es/src/Form/index.js +6 -0
  49. package/dist/es/src/Form/src/Form.css +1 -0
  50. package/dist/es/src/Form/src/Form.vue.js +208 -0
  51. package/dist/es/src/Form/src/styles/form.css +1 -0
  52. package/dist/es/src/Grid/index.js +6 -0
  53. package/dist/es/src/Grid/src/Grid.css +1 -0
  54. package/dist/es/src/Grid/src/Grid.vue.js +180 -0
  55. package/dist/es/src/Grid/src/components/ActionBar.css +1 -0
  56. package/dist/es/src/Grid/src/components/ActionBar.vue.js +65 -0
  57. package/dist/es/src/Grid/src/components/CellEditor.css +1 -0
  58. package/dist/es/src/Grid/src/components/CellEditor.vue.js +132 -0
  59. package/dist/es/src/Grid/src/components/CellEditor2.css +1 -0
  60. package/dist/es/src/Grid/src/components/ColumnFilter.css +1 -0
  61. package/dist/es/src/Grid/src/components/ColumnFilter.vue.js +72 -0
  62. package/dist/es/src/Grid/src/components/ColumnSettings.css +1 -0
  63. package/dist/es/src/Grid/src/components/ColumnSettings.vue.js +109 -0
  64. package/dist/es/src/Grid/src/components/DataTable.css +1 -0
  65. package/dist/es/src/Grid/src/components/DataTable.vue.js +556 -0
  66. package/dist/es/src/Grid/src/components/Pager.css +1 -0
  67. package/dist/es/src/Grid/src/components/Pager.vue.js +64 -0
  68. package/dist/es/src/Grid/src/components/QueryBar.css +1 -0
  69. package/dist/es/src/Grid/src/components/QueryBar.vue.js +156 -0
  70. package/dist/es/src/Grid/src/composables/useCellEditor.js +20 -0
  71. package/dist/es/src/Grid/src/composables/useGridTable.js +213 -0
  72. package/dist/es/src/Grid/src/styles/table.css +1 -0
  73. package/dist/es/src/Overlay/index.js +61 -0
  74. package/dist/es/src/Overlay/src/Message.css +1 -0
  75. package/dist/es/src/Overlay/src/Message.vue.js +36 -0
  76. package/dist/es/src/Overlay/src/Message2.css +1 -0
  77. package/dist/es/src/Overlay/src/Modal.css +1 -0
  78. package/dist/es/src/Overlay/src/Modal.vue.js +67 -0
  79. package/dist/es/src/Overlay/src/Modal2.css +1 -0
  80. package/dist/es/src/Overlay/src/Notice.css +1 -0
  81. package/dist/es/src/Overlay/src/Notice.vue.js +37 -0
  82. package/dist/es/src/Overlay/src/Notice2.css +1 -0
  83. package/dist/es/src/ScaleScreen/src/index.vue.js +2 -2
  84. package/dist/es/src/VideoBackground/src/index.vue.js +8 -8
  85. package/dist/es/src/index.js +35 -19
  86. package/dist/es/src/locale/lang/en-US.js +40 -0
  87. package/dist/es/src/locale/lang/ja-JP.js +42 -2
  88. package/dist/es/src/locale/lang/zh-CN.js +42 -2
  89. package/dist/es/src/styles/tokens.css +1 -1
  90. package/dist/lib/index.js +1 -1
  91. package/dist/lib/node_modules/@codemirror/commands/dist/index.js +1 -1
  92. package/dist/lib/node_modules/@codemirror/language/dist/index.js +1 -1
  93. package/dist/lib/node_modules/@codemirror/search/dist/index.js +2 -2
  94. package/dist/lib/node_modules/@codemirror/state/dist/index.js +4 -4
  95. package/dist/lib/node_modules/@codemirror/view/dist/index.js +5 -5
  96. package/dist/lib/node_modules/@lezer/common/dist/index.js +1 -1
  97. package/dist/lib/node_modules/@lezer/lr/dist/index.js +1 -1
  98. package/dist/lib/node_modules/@tanstack/devtools-event-client/dist/esm/plugin.js +1 -0
  99. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/EventClient.js +1 -0
  100. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/FieldApi.js +1 -0
  101. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/FormApi.js +1 -0
  102. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/ValidationLogic.js +1 -0
  103. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/metaHelper.js +1 -0
  104. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/standardSchemaValidator.js +1 -0
  105. package/dist/lib/node_modules/@tanstack/form-core/dist/esm/utils.js +1 -0
  106. package/dist/lib/node_modules/@tanstack/pacer-lite/dist/lite-throttler.js +1 -0
  107. package/dist/lib/node_modules/@tanstack/store/dist/esm/derived.js +1 -0
  108. package/dist/lib/node_modules/@tanstack/store/dist/esm/scheduler.js +1 -0
  109. package/dist/lib/node_modules/@tanstack/store/dist/esm/store.js +1 -0
  110. package/dist/lib/node_modules/@tanstack/store/dist/esm/types.js +1 -0
  111. package/dist/lib/node_modules/@tanstack/table-core/build/lib/index.js +4 -0
  112. package/dist/lib/node_modules/@tanstack/vue-form/dist/esm/useField.js +1 -0
  113. package/dist/lib/node_modules/@tanstack/vue-form/dist/esm/useForm.js +1 -0
  114. package/dist/lib/node_modules/@tanstack/vue-store/dist/esm/index.js +1 -0
  115. package/dist/lib/node_modules/@tanstack/vue-table/build/lib/index.js +1 -0
  116. package/dist/lib/src/Button/index.js +1 -0
  117. package/dist/lib/src/Button/src/Button.css +1 -0
  118. package/dist/lib/src/Button/src/Button.vue.js +1 -0
  119. package/dist/lib/src/Button/src/Button2.css +1 -0
  120. package/dist/lib/src/CodeEditor/src/index.css +1 -1
  121. package/dist/lib/src/CodeEditor/src/index.vue.js +1 -1
  122. package/dist/lib/src/CodeEditor/src/index2.css +1 -1
  123. package/dist/lib/src/ConfigProvider/index.js +1 -1
  124. package/dist/lib/src/Form/index.js +1 -0
  125. package/dist/lib/src/Form/src/Form.css +1 -0
  126. package/dist/lib/src/Form/src/Form.vue.js +1 -0
  127. package/dist/lib/src/Form/src/styles/form.css +1 -0
  128. package/dist/lib/src/Grid/index.js +1 -0
  129. package/dist/lib/src/Grid/src/Grid.css +1 -0
  130. package/dist/lib/src/Grid/src/Grid.vue.js +1 -0
  131. package/dist/lib/src/Grid/src/components/ActionBar.css +1 -0
  132. package/dist/lib/src/Grid/src/components/ActionBar.vue.js +1 -0
  133. package/dist/lib/src/Grid/src/components/CellEditor.css +1 -0
  134. package/dist/lib/src/Grid/src/components/CellEditor.vue.js +1 -0
  135. package/dist/lib/src/Grid/src/components/CellEditor2.css +1 -0
  136. package/dist/lib/src/Grid/src/components/ColumnFilter.css +1 -0
  137. package/dist/lib/src/Grid/src/components/ColumnFilter.vue.js +1 -0
  138. package/dist/lib/src/Grid/src/components/ColumnSettings.css +1 -0
  139. package/dist/lib/src/Grid/src/components/ColumnSettings.vue.js +1 -0
  140. package/dist/lib/src/Grid/src/components/DataTable.css +1 -0
  141. package/dist/lib/src/Grid/src/components/DataTable.vue.js +1 -0
  142. package/dist/lib/src/Grid/src/components/Pager.css +1 -0
  143. package/dist/lib/src/Grid/src/components/Pager.vue.js +1 -0
  144. package/dist/lib/src/Grid/src/components/QueryBar.css +1 -0
  145. package/dist/lib/src/Grid/src/components/QueryBar.vue.js +1 -0
  146. package/dist/lib/src/Grid/src/composables/useCellEditor.js +1 -0
  147. package/dist/lib/src/Grid/src/composables/useGridTable.js +1 -0
  148. package/dist/lib/src/Grid/src/styles/table.css +1 -0
  149. package/dist/lib/src/Overlay/index.js +1 -0
  150. package/dist/lib/src/Overlay/src/Message.css +1 -0
  151. package/dist/lib/src/Overlay/src/Message.vue.js +1 -0
  152. package/dist/lib/src/Overlay/src/Message2.css +1 -0
  153. package/dist/lib/src/Overlay/src/Modal.css +1 -0
  154. package/dist/lib/src/Overlay/src/Modal.vue.js +1 -0
  155. package/dist/lib/src/Overlay/src/Modal2.css +1 -0
  156. package/dist/lib/src/Overlay/src/Notice.css +1 -0
  157. package/dist/lib/src/Overlay/src/Notice.vue.js +1 -0
  158. package/dist/lib/src/Overlay/src/Notice2.css +1 -0
  159. package/dist/lib/src/index.js +1 -1
  160. package/dist/lib/src/locale/lang/en-US.js +1 -1
  161. package/dist/lib/src/locale/lang/ja-JP.js +1 -1
  162. package/dist/lib/src/locale/lang/zh-CN.js +1 -1
  163. package/dist/lib/src/styles/tokens.css +1 -1
  164. package/package.json +11 -8
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ae=1024;let ge=0;class ee{constructor(e,t){this.from=e,this.to=t}}class w{constructor(e={}){this.id=ge++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=M.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}w.closedBy=new w({deserialize:l=>l.split(" ")});w.openedBy=new w({deserialize:l=>l.split(" ")});w.group=new w({deserialize:l=>l.split(" ")});w.isolate=new w({deserialize:l=>{if(l&&l!="rtl"&&l!="ltr"&&l!="auto")throw new RangeError("Invalid value for isolate: "+l);return l||"auto"}});w.contextHash=new w({perNode:!0});w.lookAhead=new w({perNode:!0});w.mounted=new w({perNode:!0});class J{constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}static get(e){return e&&e.props&&e.props[w.mounted.id]}}const xe=Object.create(null);class M{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):xe,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new M(e.name||"",t,e.id,r);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(w.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(w.group),n=-1;n<(i?i.length:0);n++){let s=t[n<0?r.name:i[n]];if(s)return s}}}}M.none=new M("",Object.create(null),0,8);class re{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let i=null;for(let n of e){let s=n(r);if(s){i||(i=Object.assign({},r.props));let h=s[1],o=s[0];o.combine&&o.id in i&&(h=o.combine(i[o.id],h)),i[o.id]=h}}t.push(i?new M(r.name,i,r.id,r.flags):r)}return new re(t)}}const K=new WeakMap,fe=new WeakMap;exports.IterMode=void 0;(function(l){l[l.ExcludeBuffers=1]="ExcludeBuffers",l[l.IncludeAnonymous=2]="IncludeAnonymous",l[l.IgnoreMounts=4]="IgnoreMounts",l[l.IgnoreOverlays=8]="IgnoreOverlays"})(exports.IterMode||(exports.IterMode={}));class z{constructor(e,t,r,i,n){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,n&&n.length){this.props=Object.create(null);for(let[s,h]of n)this.props[typeof s=="number"?s:s.id]=h}}toString(){let e=J.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new X(this.topNode,e)}cursorAt(e,t=0,r=0){let i=K.get(this)||this.topNode,n=new X(i);return n.moveTo(e,t),K.set(this,n._tree),n}get topNode(){return new I(this,0,0,null)}resolve(e,t=0){let r=V(K.get(this)||this.topNode,e,t,!1);return K.set(this,r),r}resolveInner(e,t=0){let r=V(fe.get(this)||this.topNode,e,t,!0);return fe.set(this,r),r}resolveStack(e,t=0){return me(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:n=this.length}=e,s=e.mode||0,h=(s&exports.IterMode.IncludeAnonymous)>0;for(let o=this.cursor(s|exports.IterMode.IncludeAnonymous);;){let C=!1;if(o.from<=n&&o.to>=i&&(!h&&o.type.isAnonymous||t(o)!==!1)){if(o.firstChild())continue;C=!0}for(;C&&r&&(h||!o.type.isAnonymous)&&r(o),!o.nextSibling();){if(!o.parent())return;C=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:se(M.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new z(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new z(M.none,t,r,i)))}static build(e){return we(e)}}z.empty=new z(M.none,[],[],0);class ie{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ie(this.buffer,this.index)}}class T{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return M.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],i=this.set.types[t],n=i.name;if(/\W/.test(n)&&!i.isError&&(n=JSON.stringify(n)),e+=4,r==e)return n;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return n+"("+s.join(",")+")"}findChild(e,t,r,i,n){let{buffer:s}=this,h=-1;for(let o=e;o!=t&&!(de(n,i,s[o+1],s[o+2])&&(h=o,r>0));o=s[o+3]);return h}slice(e,t,r){let i=this.buffer,n=new Uint16Array(t-e),s=0;for(let h=e,o=0;h<t;){n[o++]=i[h++],n[o++]=i[h++]-r;let C=n[o++]=i[h++]-r;n[o++]=i[h++]-e,s=Math.max(s,C)}return new T(n,s,this.set)}}function de(l,e,t,r){switch(l){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function V(l,e,t,r){for(var i;l.from==l.to||(t<1?l.from>=e:l.from>e)||(t>-1?l.to<=e:l.to<e);){let s=!r&&l instanceof I&&l.index<0?null:l.parent;if(!s)return l;l=s}let n=r?0:exports.IterMode.IgnoreOverlays;if(r)for(let s=l,h=s.parent;h;s=h,h=s.parent)s instanceof I&&s.index<0&&((i=h.enter(e,t,n))===null||i===void 0?void 0:i.from)!=s.from&&(l=h);for(;;){let s=l.enter(e,t,n);if(!s)return l;l=s}}class pe{cursor(e=0){return new X(this,e)}getChild(e,t=null,r=null){let i=ue(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return ue(this,e,t,r)}resolve(e,t=0){return V(this,e,t,!1)}resolveInner(e,t=0){return V(this,e,t,!0)}matchContext(e){return te(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class I extends pe{constructor(e,t,r,i){super(),this._tree=e,this.from=t,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,i,n=0){for(let s=this;;){for(let{children:h,positions:o}=s._tree,C=t>0?h.length:-1;e!=C;e+=t){let p=h[e],S=o[e]+s.from;if(de(i,r,S,S+p.length)){if(p instanceof T){if(n&exports.IterMode.ExcludeBuffers)continue;let k=p.findChild(0,p.buffer.length,t,r-S,i);if(k>-1)return new E(new ye(s,p,e,S),null,k)}else if(n&exports.IterMode.IncludeAnonymous||!p.type.isAnonymous||ne(p)){let k;if(!(n&exports.IterMode.IgnoreMounts)&&(k=J.get(p))&&!k.overlay)return new I(k.tree,S,e,s);let B=new I(p,S,e,s);return n&exports.IterMode.IncludeAnonymous||!B.type.isAnonymous?B:B.nextChild(t<0?p.children.length-1:0,t,r,i)}}}if(n&exports.IterMode.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+t:e=t<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,r=0){let i;if(!(r&exports.IterMode.IgnoreOverlays)&&(i=J.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:s,to:h}of i.overlay)if((t>0?s<=n:s<n)&&(t<0?h>=n:h>n))return new I(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ue(l,e,t,r){let i=l.cursor(),n=[];if(!i.firstChild())return n;if(t!=null){for(let s=!1;!s;)if(s=i.type.is(t),!i.nextSibling())return n}for(;;){if(r!=null&&i.type.is(r))return n;if(i.type.is(e)&&n.push(i.node),!i.nextSibling())return r==null?n:[]}}function te(l,e,t=e.length-1){for(let r=l;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class ye{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class E extends pe{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return n<0?null:new E(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,r=0){if(r&exports.IterMode.ExcludeBuffers)return null;let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return n<0?null:new E(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new E(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new E(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,i=this.index+4,n=r.buffer[this.index+3];if(n>i){let s=r.buffer[this.index+1];e.push(r.slice(i,n,s)),t.push(0)}return new z(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ce(l){if(!l.length)return null;let e=0,t=l[0];for(let n=1;n<l.length;n++){let s=l[n];(s.from>t.from||s.to<t.to)&&(t=s,e=n)}let r=t instanceof I&&t.index<0?null:t.parent,i=l.slice();return r?i[e]=r:i.splice(e,1),new be(i,t)}class be{constructor(e,t){this.heads=e,this.node=t}get next(){return ce(this.heads)}}function me(l,e,t){let r=l.resolveInner(e,t),i=null;for(let n=r instanceof I?r:r.context.parent;n;n=n.parent)if(n.index<0){let s=n.parent;(i||(i=[r])).push(s.resolve(e,t)),n=s}else{let s=J.get(n.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let h=new I(s.tree,s.overlay[0].from+n.from,-1,n);(i||(i=[r])).push(V(h,e,t,!1))}}return i?ce(i):r}class X{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof I)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof I?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,n=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,r);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&exports.IterMode.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&exports.IterMode.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&exports.IterMode.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(i.buffer.buffer[n+3]<this.index)return!1;({index:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let n=t+e,s=e<0?-1:r._tree.children.length;n!=s;n+=e){let h=r._tree.children[n];if(this.mode&exports.IterMode.IncludeAnonymous||h instanceof T||!h.type.isAnonymous||ne(h))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,n=this.stack.length;n>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;t=s,r=n+1;break e}i=this.stack[--n]}for(let i=r;i<this.stack.length;i++)t=new E(this.buffer,t,this.stack[i]);return this.bufferNode=new E(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return te(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,n=this.stack.length-1;i>=0;n--){if(n<0)return te(this._tree,e,i);let s=r[t.buffer[this.stack[n]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function ne(l){return l.children.some(e=>e instanceof T||!e.type.isAnonymous||ne(e))}function we(l){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=ae,reused:n=[],minRepeatType:s=r.types.length}=l,h=Array.isArray(t)?new ie(t,t.length):t,o=r.types,C=0,p=0;function S(c,x,f,b,d,m){let{id:a,start:u,end:g,size:y}=h,_=p,R=C;if(y<0)if(h.next(),y==-1){let O=n[a];f.push(O),b.push(u-c);return}else if(y==-3){C=a;return}else if(y==-4){p=a;return}else throw new RangeError(`Unrecognized record size: ${y}`);let G=o[a],$,U,le=u-c;if(g-u<=i&&(U=Z(h.pos-x,d))){let O=new Uint16Array(U.size-U.skip),N=h.pos-U.size,P=O.length;for(;h.pos>N;)P=H(U.start,O,P);$=new T(O,g-U.start,r),le=U.start-c}else{let O=h.pos-y;h.next();let N=[],P=[],D=a>=s?a:-1,F=0,q=g;for(;h.pos>O;)D>=0&&h.id==D&&h.size>=0?(h.end<=q-i&&(A(N,P,u,F,h.end,q,D,_,R),F=N.length,q=h.end),h.next()):m>2500?k(u,O,N,P):S(u,O,N,P,D,m+1);if(D>=0&&F>0&&F<N.length&&A(N,P,u,F,u,q,D,_,R),N.reverse(),P.reverse(),D>-1&&F>0){let he=B(G,R);$=se(G,N,P,0,N.length,0,g-u,he,he)}else $=j(G,N,P,g-u,_-g,R)}f.push($),b.push(le)}function k(c,x,f,b){let d=[],m=0,a=-1;for(;h.pos>x;){let{id:u,start:g,end:y,size:_}=h;if(_>4)h.next();else{if(a>-1&&g<a)break;a<0&&(a=y-i),d.push(u,g,y),m++,h.next()}}if(m){let u=new Uint16Array(m*4),g=d[d.length-2];for(let y=d.length-3,_=0;y>=0;y-=3)u[_++]=d[y],u[_++]=d[y+1]-g,u[_++]=d[y+2]-g,u[_++]=_;f.push(new T(u,d[2]-g,r)),b.push(g-c)}}function B(c,x){return(f,b,d)=>{let m=0,a=f.length-1,u,g;if(a>=0&&(u=f[a])instanceof z){if(!a&&u.type==c&&u.length==d)return u;(g=u.prop(w.lookAhead))&&(m=b[a]+u.length+g)}return j(c,f,b,d,m,x)}}function A(c,x,f,b,d,m,a,u,g){let y=[],_=[];for(;c.length>b;)y.push(c.pop()),_.push(x.pop()+f-d);c.push(j(r.types[a],y,_,m-d,u-m,g)),x.push(d-f)}function j(c,x,f,b,d,m,a){if(m){let u=[w.contextHash,m];a=a?[u].concat(a):[u]}if(d>25){let u=[w.lookAhead,d];a=a?[u].concat(a):[u]}return new z(c,x,f,b,a)}function Z(c,x){let f=h.fork(),b=0,d=0,m=0,a=f.end-i,u={size:0,start:0,skip:0};e:for(let g=f.pos-c;f.pos>g;){let y=f.size;if(f.id==x&&y>=0){u.size=b,u.start=d,u.skip=m,m+=4,b+=4,f.next();continue}let _=f.pos-y;if(y<0||_<g||f.start<a)break;let R=f.id>=s?4:0,G=f.start;for(f.next();f.pos>_;){if(f.size<0)if(f.size==-3||f.size==-4)R+=4;else break e;else f.id>=s&&(R+=4);f.next()}d=G,b+=y,m+=R}return(x<0||b==c)&&(u.size=b,u.start=d,u.skip=m),u.size>4?u:void 0}function H(c,x,f){let{id:b,start:d,end:m,size:a}=h;if(h.next(),a>=0&&b<s){let u=f;if(a>4){let g=h.pos-(a-4);for(;h.pos>g;)f=H(c,x,f)}x[--f]=u,x[--f]=m-c,x[--f]=d-c,x[--f]=b}else a==-3?C=b:a==-4&&(p=b);return f}let W=[],v=[];for(;h.pos>0;)S(l.start||0,l.bufferStart||0,W,v,-1,0);let L=(e=l.length)!==null&&e!==void 0?e:W.length?v[0]+W[0].length:0;return new z(o[l.topID],W.reverse(),v.reverse(),L)}const oe=new WeakMap;function Q(l,e){if(!l.isAnonymous||e instanceof T||e.type!=l)return 1;let t=oe.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=l||!(r instanceof z)){t=1;break}t+=Q(l,r)}oe.set(e,t)}return t}function se(l,e,t,r,i,n,s,h,o){let C=0;for(let A=r;A<i;A++)C+=Q(l,e[A]);let p=Math.ceil(C*1.5/8),S=[],k=[];function B(A,j,Z,H,W){for(let v=Z;v<H;){let L=v,c=j[v],x=Q(l,A[v]);for(v++;v<H;v++){let f=Q(l,A[v]);if(x+f>=p)break;x+=f}if(v==L+1){if(x>p){let f=A[L];B(f.children,f.positions,0,f.children.length,j[L]+W);continue}S.push(A[L])}else{let f=j[v-1]+A[v-1].length-c;S.push(se(l,A,j,L,v,c,f,null,o))}k.push(c+W-n)}}return B(e,t,r,i,0),(h||o)(S,k,s)}class ke{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof E?this.setBuffer(e.context.buffer,e.index,t):e instanceof I&&this.map.set(e.tree,t)}get(e){return e instanceof E?this.getBuffer(e.context.buffer,e.index):e instanceof I?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Y{constructor(e,t,r,i,n=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(n?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let i=[new Y(0,e.length,e,0,!1,r)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],n=1,s=e.length?e[0]:null;for(let h=0,o=0,C=0;;h++){let p=h<t.length?t[h]:null,S=p?p.fromA:1e9;if(S-o>=r)for(;s&&s.from<S;){let k=s;if(o>=k.from||S<=k.to||C){let B=Math.max(k.from,o)-C,A=Math.min(k.to,S)-C;k=B>=A?null:new Y(B,A,k.tree,k.offset+C,h>0,!!p)}if(k&&i.push(k),s.to>S)break;s=n<e.length?e[n++]:null}if(!p)break;o=p.toA,C=p.toA-p.toB}return i}}class Ce{startParse(e,t,r){return typeof e=="string"&&(e=new Se(e)),r=r?r.length?r.map(i=>new ee(i.from,i.to)):[new ee(0,0)]:[new ee(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let n=i.advance();if(n)return n}}}class Se{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new w({perNode:!0});exports.DefaultBufferLength=ae;exports.MountedTree=J;exports.NodeProp=w;exports.NodeSet=re;exports.NodeType=M;exports.NodeWeakMap=ke;exports.Parser=Ce;exports.Tree=z;exports.TreeBuffer=T;exports.TreeCursor=X;exports.TreeFragment=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ae=1024;let ge=0;class ee{constructor(e,t){this.from=e,this.to=t}}class k{constructor(e={}){this.id=ge++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=M.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}}k.closedBy=new k({deserialize:l=>l.split(" ")});k.openedBy=new k({deserialize:l=>l.split(" ")});k.group=new k({deserialize:l=>l.split(" ")});k.isolate=new k({deserialize:l=>{if(l&&l!="rtl"&&l!="ltr"&&l!="auto")throw new RangeError("Invalid value for isolate: "+l);return l||"auto"}});k.contextHash=new k({perNode:!0});k.lookAhead=new k({perNode:!0});k.mounted=new k({perNode:!0});class H{constructor(e,t,r,i=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=i}static get(e){return e&&e.props&&e.props[k.mounted.id]}}const xe=Object.create(null);class M{constructor(e,t,r,i=0){this.name=e,this.props=t,this.id=r,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):xe,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new M(e.name||"",t,e.id,r);if(e.props){for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(k.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let i of r.split(" "))t[i]=e[r];return r=>{for(let i=r.prop(k.group),n=-1;n<(i?i.length:0);n++){let s=t[n<0?r.name:i[n]];if(s)return s}}}}M.none=new M("",Object.create(null),0,8);class re{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let i=null;for(let n of e){let s=n(r);if(s){i||(i=Object.assign({},r.props));let h=s[1],u=s[0];u.combine&&u.id in i&&(h=u.combine(i[u.id],h)),i[u.id]=h}}t.push(i?new M(r.name,i,r.id,r.flags):r)}return new re(t)}}const K=new WeakMap,fe=new WeakMap;exports.IterMode=void 0;(function(l){l[l.ExcludeBuffers=1]="ExcludeBuffers",l[l.IncludeAnonymous=2]="IncludeAnonymous",l[l.IgnoreMounts=4]="IgnoreMounts",l[l.IgnoreOverlays=8]="IgnoreOverlays",l[l.EnterBracketed=16]="EnterBracketed"})(exports.IterMode||(exports.IterMode={}));class z{constructor(e,t,r,i,n){if(this.type=e,this.children=t,this.positions=r,this.length=i,this.props=null,n&&n.length){this.props=Object.create(null);for(let[s,h]of n)this.props[typeof s=="number"?s:s.id]=h}}toString(){let e=H.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let i=r.toString();i&&(t&&(t+=","),t+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new X(this.topNode,e)}cursorAt(e,t=0,r=0){let i=K.get(this)||this.topNode,n=new X(i);return n.moveTo(e,t),K.set(this,n._tree),n}get topNode(){return new B(this,0,0,null)}resolve(e,t=0){let r=V(K.get(this)||this.topNode,e,t,!1);return K.set(this,r),r}resolveInner(e,t=0){let r=V(fe.get(this)||this.topNode,e,t,!0);return fe.set(this,r),r}resolveStack(e,t=0){return me(this,e,t)}iterate(e){let{enter:t,leave:r,from:i=0,to:n=this.length}=e,s=e.mode||0,h=(s&exports.IterMode.IncludeAnonymous)>0;for(let u=this.cursor(s|exports.IterMode.IncludeAnonymous);;){let C=!1;if(u.from<=n&&u.to>=i&&(!h&&u.type.isAnonymous||t(u)!==!1)){if(u.firstChild())continue;C=!0}for(;C&&r&&(h||!u.type.isAnonymous)&&r(u),!u.nextSibling();){if(!u.parent())return;C=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:se(M.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,i)=>new z(this.type,t,r,i,this.propValues),e.makeTree||((t,r,i)=>new z(M.none,t,r,i)))}static build(e){return we(e)}}z.empty=new z(M.none,[],[],0);class ie{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ie(this.buffer,this.index)}}class T{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return M.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],i=this.set.types[t],n=i.name;if(/\W/.test(n)&&!i.isError&&(n=JSON.stringify(n)),e+=4,r==e)return n;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return n+"("+s.join(",")+")"}findChild(e,t,r,i,n){let{buffer:s}=this,h=-1;for(let u=e;u!=t&&!(de(n,i,s[u+1],s[u+2])&&(h=u,r>0));u=s[u+3]);return h}slice(e,t,r){let i=this.buffer,n=new Uint16Array(t-e),s=0;for(let h=e,u=0;h<t;){n[u++]=i[h++],n[u++]=i[h++]-r;let C=n[u++]=i[h++]-r;n[u++]=i[h++]-e,s=Math.max(s,C)}return new T(n,s,this.set)}}function de(l,e,t,r){switch(l){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function V(l,e,t,r){for(var i;l.from==l.to||(t<1?l.from>=e:l.from>e)||(t>-1?l.to<=e:l.to<e);){let s=!r&&l instanceof B&&l.index<0?null:l.parent;if(!s)return l;l=s}let n=r?0:exports.IterMode.IgnoreOverlays;if(r)for(let s=l,h=s.parent;h;s=h,h=s.parent)s instanceof B&&s.index<0&&((i=h.enter(e,t,n))===null||i===void 0?void 0:i.from)!=s.from&&(l=h);for(;;){let s=l.enter(e,t,n);if(!s)return l;l=s}}class pe{cursor(e=0){return new X(this,e)}getChild(e,t=null,r=null){let i=ue(this,e,t,r);return i.length?i[0]:null}getChildren(e,t=null,r=null){return ue(this,e,t,r)}resolve(e,t=0){return V(this,e,t,!1)}resolveInner(e,t=0){return V(this,e,t,!0)}matchContext(e){return te(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(r=t,t=i.prevSibling):t=i}return r}get node(){return this}get next(){return this.parent}}class B extends pe{constructor(e,t,r,i){super(),this._tree=e,this.from=t,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,i,n=0){var s;for(let h=this;;){for(let{children:u,positions:C}=h._tree,A=t>0?u.length:-1;e!=A;e+=t){let d=u[e],x=C[e]+h.from;if(!(!(n&exports.IterMode.EnterBracketed&&d instanceof z&&((s=H.get(d))===null||s===void 0?void 0:s.overlay)===null&&(x>=r||x+d.length<=r))&&!de(i,r,x,x+d.length))){if(d instanceof T){if(n&exports.IterMode.ExcludeBuffers)continue;let I=d.findChild(0,d.buffer.length,t,r-x,i);if(I>-1)return new E(new ye(h,d,e,x),null,I)}else if(n&exports.IterMode.IncludeAnonymous||!d.type.isAnonymous||ne(d)){let I;if(!(n&exports.IterMode.IgnoreMounts)&&(I=H.get(d))&&!I.overlay)return new B(I.tree,x,e,h);let S=new B(d,x,e,h);return n&exports.IterMode.IncludeAnonymous||!S.type.isAnonymous?S:S.nextChild(t<0?d.children.length-1:0,t,r,i,n)}}}if(n&exports.IterMode.IncludeAnonymous||!h.type.isAnonymous||(h.index>=0?e=h.index+t:e=t<0?-1:h._parent._tree.children.length,h=h._parent,!h))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,r=0){let i;if(!(r&exports.IterMode.IgnoreOverlays)&&(i=H.get(this._tree))&&i.overlay){let n=e-this.from,s=r&exports.IterMode.EnterBracketed&&i.bracketed;for(let{from:h,to:u}of i.overlay)if((t>0||s?h<=n:h<n)&&(t<0||s?u>=n:u>n))return new B(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ue(l,e,t,r){let i=l.cursor(),n=[];if(!i.firstChild())return n;if(t!=null){for(let s=!1;!s;)if(s=i.type.is(t),!i.nextSibling())return n}for(;;){if(r!=null&&i.type.is(r))return n;if(i.type.is(e)&&n.push(i.node),!i.nextSibling())return r==null?n:[]}}function te(l,e,t=e.length-1){for(let r=l;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}class ye{constructor(e,t,r,i){this.parent=e,this.buffer=t,this.index=r,this.start=i}}class E extends pe{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,r);return n<0?null:new E(this.context,this,n)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,r=0){if(r&exports.IterMode.ExcludeBuffers)return null;let{buffer:i}=this.context,n=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return n<0?null:new E(this.context,this,n)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new E(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new E(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,i=this.index+4,n=r.buffer[this.index+3];if(n>i){let s=r.buffer[this.index+1];e.push(r.slice(i,n,s)),t.push(0)}return new z(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ce(l){if(!l.length)return null;let e=0,t=l[0];for(let n=1;n<l.length;n++){let s=l[n];(s.from>t.from||s.to<t.to)&&(t=s,e=n)}let r=t instanceof B&&t.index<0?null:t.parent,i=l.slice();return r?i[e]=r:i.splice(e,1),new be(i,t)}class be{constructor(e,t){this.heads=e,this.node=t}get next(){return ce(this.heads)}}function me(l,e,t){let r=l.resolveInner(e,t),i=null;for(let n=r instanceof B?r:r.context.parent;n;n=n.parent)if(n.index<0){let s=n.parent;(i||(i=[r])).push(s.resolve(e,t)),n=s}else{let s=H.get(n.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let h=new B(s.tree,s.overlay[0].from+n.from,-1,n);(i||(i=[r])).push(V(h,e,t,!1))}}return i?ce(i):r}class X{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~exports.IterMode.EnterBracketed,e instanceof B)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof B?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:i}=this.buffer,n=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,r);return n<0?!1:(this.stack.push(this.index),this.yieldBuf(n))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&exports.IterMode.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&exports.IterMode.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&exports.IterMode.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let n=0;n<this.index;n++)if(i.buffer.buffer[n+3]<this.index)return!1;({index:t,parent:r}=i)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let n=t+e,s=e<0?-1:r._tree.children.length;n!=s;n+=e){let h=r._tree.children[n];if(this.mode&exports.IterMode.IncludeAnonymous||h instanceof T||!h.type.isAnonymous||ne(h))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let i=this.index,n=this.stack.length;n>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;t=s,r=n+1;break e}i=this.stack[--n]}for(let i=r;i<this.stack.length;i++)t=new E(this.buffer,t,this.stack[i]);return this.bufferNode=new E(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(e){if(!this.buffer)return te(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let i=e.length-1,n=this.stack.length-1;i>=0;n--){if(n<0)return te(this._tree,e,i);let s=r[t.buffer[this.stack[n]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function ne(l){return l.children.some(e=>e instanceof T||!e.type.isAnonymous||ne(e))}function we(l){var e;let{buffer:t,nodeSet:r,maxBufferLength:i=ae,reused:n=[],minRepeatType:s=r.types.length}=l,h=Array.isArray(t)?new ie(t,t.length):t,u=r.types,C=0,A=0;function d(c,y,f,m,p,w){let{id:a,start:o,end:g,size:b}=h,_=A,R=C;if(b<0)if(h.next(),b==-1){let O=n[a];f.push(O),m.push(o-c);return}else if(b==-3){C=a;return}else if(b==-4){A=a;return}else throw new RangeError(`Unrecognized record size: ${b}`);let J=u[a],$,U,le=o-c;if(g-o<=i&&(U=Z(h.pos-y,p))){let O=new Uint16Array(U.size-U.skip),N=h.pos-U.size,P=O.length;for(;h.pos>N;)P=G(U.start,O,P);$=new T(O,g-U.start,r),le=U.start-c}else{let O=h.pos-b;h.next();let N=[],P=[],D=a>=s?a:-1,F=0,q=g;for(;h.pos>O;)D>=0&&h.id==D&&h.size>=0?(h.end<=q-i&&(S(N,P,o,F,h.end,q,D,_,R),F=N.length,q=h.end),h.next()):w>2500?x(o,O,N,P):d(o,O,N,P,D,w+1);if(D>=0&&F>0&&F<N.length&&S(N,P,o,F,o,q,D,_,R),N.reverse(),P.reverse(),D>-1&&F>0){let he=I(J,R);$=se(J,N,P,0,N.length,0,g-o,he,he)}else $=j(J,N,P,g-o,_-g,R)}f.push($),m.push(le)}function x(c,y,f,m){let p=[],w=0,a=-1;for(;h.pos>y;){let{id:o,start:g,end:b,size:_}=h;if(_>4)h.next();else{if(a>-1&&g<a)break;a<0&&(a=b-i),p.push(o,g,b),w++,h.next()}}if(w){let o=new Uint16Array(w*4),g=p[p.length-2];for(let b=p.length-3,_=0;b>=0;b-=3)o[_++]=p[b],o[_++]=p[b+1]-g,o[_++]=p[b+2]-g,o[_++]=_;f.push(new T(o,p[2]-g,r)),m.push(g-c)}}function I(c,y){return(f,m,p)=>{let w=0,a=f.length-1,o,g;if(a>=0&&(o=f[a])instanceof z){if(!a&&o.type==c&&o.length==p)return o;(g=o.prop(k.lookAhead))&&(w=m[a]+o.length+g)}return j(c,f,m,p,w,y)}}function S(c,y,f,m,p,w,a,o,g){let b=[],_=[];for(;c.length>m;)b.push(c.pop()),_.push(y.pop()+f-p);c.push(j(r.types[a],b,_,w-p,o-w,g)),y.push(p-f)}function j(c,y,f,m,p,w,a){if(w){let o=[k.contextHash,w];a=a?[o].concat(a):[o]}if(p>25){let o=[k.lookAhead,p];a=a?[o].concat(a):[o]}return new z(c,y,f,m,a)}function Z(c,y){let f=h.fork(),m=0,p=0,w=0,a=f.end-i,o={size:0,start:0,skip:0};e:for(let g=f.pos-c;f.pos>g;){let b=f.size;if(f.id==y&&b>=0){o.size=m,o.start=p,o.skip=w,w+=4,m+=4,f.next();continue}let _=f.pos-b;if(b<0||_<g||f.start<a)break;let R=f.id>=s?4:0,J=f.start;for(f.next();f.pos>_;){if(f.size<0)if(f.size==-3||f.size==-4)R+=4;else break e;else f.id>=s&&(R+=4);f.next()}p=J,m+=b,w+=R}return(y<0||m==c)&&(o.size=m,o.start=p,o.skip=w),o.size>4?o:void 0}function G(c,y,f){let{id:m,start:p,end:w,size:a}=h;if(h.next(),a>=0&&m<s){let o=f;if(a>4){let g=h.pos-(a-4);for(;h.pos>g;)f=G(c,y,f)}y[--f]=o,y[--f]=w-c,y[--f]=p-c,y[--f]=m}else a==-3?C=m:a==-4&&(A=m);return f}let W=[],v=[];for(;h.pos>0;)d(l.start||0,l.bufferStart||0,W,v,-1,0);let L=(e=l.length)!==null&&e!==void 0?e:W.length?v[0]+W[0].length:0;return new z(u[l.topID],W.reverse(),v.reverse(),L)}const oe=new WeakMap;function Q(l,e){if(!l.isAnonymous||e instanceof T||e.type!=l)return 1;let t=oe.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=l||!(r instanceof z)){t=1;break}t+=Q(l,r)}oe.set(e,t)}return t}function se(l,e,t,r,i,n,s,h,u){let C=0;for(let S=r;S<i;S++)C+=Q(l,e[S]);let A=Math.ceil(C*1.5/8),d=[],x=[];function I(S,j,Z,G,W){for(let v=Z;v<G;){let L=v,c=j[v],y=Q(l,S[v]);for(v++;v<G;v++){let f=Q(l,S[v]);if(y+f>=A)break;y+=f}if(v==L+1){if(y>A){let f=S[L];I(f.children,f.positions,0,f.children.length,j[L]+W);continue}d.push(S[L])}else{let f=j[v-1]+S[v-1].length-c;d.push(se(l,S,j,L,v,c,f,null,u))}x.push(c+W-n)}}return I(e,t,r,i,0),(h||u)(d,x,s)}class ke{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof E?this.setBuffer(e.context.buffer,e.index,t):e instanceof B&&this.map.set(e.tree,t)}get(e){return e instanceof E?this.getBuffer(e.context.buffer,e.index):e instanceof B?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Y{constructor(e,t,r,i,n=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=i,this.open=(n?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let i=[new Y(0,e.length,e,0,!1,r)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,r=128){if(!t.length)return e;let i=[],n=1,s=e.length?e[0]:null;for(let h=0,u=0,C=0;;h++){let A=h<t.length?t[h]:null,d=A?A.fromA:1e9;if(d-u>=r)for(;s&&s.from<d;){let x=s;if(u>=x.from||d<=x.to||C){let I=Math.max(x.from,u)-C,S=Math.min(x.to,d)-C;x=I>=S?null:new Y(I,S,x.tree,x.offset+C,h>0,!!A)}if(x&&i.push(x),s.to>d)break;s=n<e.length?e[n++]:null}if(!A)break;u=A.toA,C=A.toA-A.toB}return i}}class Ce{startParse(e,t,r){return typeof e=="string"&&(e=new Se(e)),r=r?r.length?r.map(i=>new ee(i.from,i.to)):[new ee(0,0)]:[new ee(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let i=this.startParse(e,t,r);for(;;){let n=i.advance();if(n)return n}}}class Se{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new k({perNode:!0});exports.DefaultBufferLength=ae;exports.MountedTree=H;exports.NodeProp=k;exports.NodeSet=re;exports.NodeType=M;exports.NodeWeakMap=ke;exports.Parser=Ce;exports.Tree=z;exports.TreeBuffer=T;exports.TreeCursor=X;exports.TreeFragment=Y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../../common/dist/index.js");class S{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new S(t,[],e,s,s,0,[],0,i?new y(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from,u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,p=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,p+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this,n=this.buffer.length;if(n==0&&r.parent&&(n=r.bufferBase-r.parent.bufferBase,r=r.parent),n>0&&r.buffer[n-4]==0&&r.buffer[n-1]>-1){if(e==s)return;if(r.buffer[n-2]>=e){r.buffer[n-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;(i>this.pos||e<=r.maxNode)&&(this.pos=i,r.stateFlag(h,1)||(this.reducePos=i)),this.pushState(h,s),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new S(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new M(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new y(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class y{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class M{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class T{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new T(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new T(this.stack,this.pos,this.index)}}function b(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class v{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const N=new v;class B{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=N,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=N,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class x{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;F(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}x.prototype.contextual=x.prototype.fallback=x.prototype.extend=!1;class O{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?b(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(F(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}O.prototype.contextual=x.prototype.fallback=x.prototype.extend=!1;class ${constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function F(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let d=l[c];if(o.allows(d)&&(t.token.value==-1||t.token.value==d||E(d,t.token.value,i,h))){t.acceptToken(d);break}}let u=t.next,f=0,p=l[r+2];if(t.next<0&&p>f&&l[a+p*3-3]==65535){r=l[a+p*3-1];continue t}for(;f<p;){let c=f+p>>1,d=a+c+(c<<1),P=l[d],L=l[d+1]||65536;if(u<P)p=c;else if(u>=L)f=c+1;else{r=l[d+2],t.advance();continue t}}break}}function R(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function E(l,t,e,s){let i=R(e,s,t);return i<0||R(e,s,l)<i}const g=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let C=null;function z(l,t,e){let s=l.cursor(k.IterMode.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class j{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?z(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?z(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof k.Tree){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(k.NodeProp.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class G{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new v)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let p=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>p))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new v,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new v,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=m(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(m(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(m(n,a+1),e,s,i))}return i}}class U{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new B(e,i),this.tokens=new G(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[S.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new j(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&q(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let p=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(p>-1&&f.length&&(!a||(f.prop(k.NodeProp.contextHash)||0)==u))return t.useNode(f,p),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof k.Tree)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof k.Tree&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],p=o[a++],c=a==o.length||!s,d=c?t:t.split(),P=this.tokens.mainToken;if(d.apply(u,f,P?P.start:d.pos,p),g&&console.log(r+this.stackID(d)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${d==t?"":", split"})`),c)return!0;d.pos>i?e.push(d):s.push(d)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return I(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),p=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(p+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(p=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),I(n,s)):(!i||i.score<n.score)&&(i=n)}return i}stackToTree(t){return t.close(),k.Tree.build({buffer:T.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(C||(C=new WeakMap)).get(t);return e||C.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function I(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class H{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const w=l=>l;class W{constructor(t){this.start=t.start,this.shift=t.shift||w,this.reduce=t.reduce||w,this.reuse=t.reuse||w,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class A extends k.Parser{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=k.NodeProp[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let p=-u;p>0;p--)h(n[a++],o,f);a++}}}this.nodeSet=new k.NodeSet(e.map((n,o)=>k.NodeType.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=k.DefaultBufferLength;let r=b(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(D),this.states=b(t.states,Uint32Array),this.data=b(t.stateData),this.goto=b(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new x(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new U(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=m(s,h+2)];else{if(s[h+1]==2)return m(s,h+2);break}if(r==e||r==0)return m(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=m(this.data,h+2);else break;i=e(m(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=m(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(A.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=D(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new H(t,s,i)}static deserialize(t){return new A(t)}}function m(l,t){return l[t]|l[t+1]<<16}function q(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function D(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}exports.ContextTracker=W;exports.ExternalTokenizer=$;exports.InputStream=B;exports.LRParser=A;exports.LocalTokenGroup=O;exports.Stack=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../../common/dist/index.js");class S{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new S(t,[],e,s,s,0,[],0,i?new y(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from,u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this,n=this.buffer.length;if(n==0&&r.parent&&(n=r.bufferBase-r.parent.bufferBase,r=r.parent),n>0&&r.buffer[n-4]==0&&r.buffer[n-1]>-1){if(e==s)return;if(r.buffer[n-2]>=e){r.buffer[n-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new S(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new L(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new y(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class y{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class L{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class T{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new T(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new T(this.stack,this.pos,this.index)}}function b(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class v{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const N=new v;class B{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=N,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=N,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class x{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;F(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}x.prototype.contextual=x.prototype.fallback=x.prototype.extend=!1;class O{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?b(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(F(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}O.prototype.contextual=x.prototype.fallback=x.prototype.extend=!1;class ${constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function F(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let p=l[c];if(o.allows(p)&&(t.token.value==-1||t.token.value==p||E(p,t.token.value,i,h))){t.acceptToken(p);break}}let u=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f<d;){let c=f+d>>1,p=a+c+(c<<1),P=l[p],M=l[p+1]||65536;if(u<P)d=c;else if(u>=M)f=c+1;else{r=l[p+2],t.advance();continue t}}break}}function R(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function E(l,t,e,s){let i=R(e,s,t);return i<0||R(e,s,l)<i}const g=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let C=null;function z(l,t,e){let s=l.cursor(k.IterMode.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class j{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?z(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?z(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof k.Tree){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(k.NodeProp.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class G{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new v)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new v,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new v,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=m(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(m(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(m(n,a+1),e,s,i))}return i}}class U{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new B(e,i),this.tokens=new G(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[S.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new j(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&q(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(k.NodeProp.contextHash)||0)==u))return t.useNode(f,d),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof k.Tree)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof k.Tree&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],d=o[a++],c=a==o.length||!s,p=c?t:t.split(),P=this.tokens.mainToken;if(p.apply(u,f,P?P.start:p.pos,d),g&&console.log(r+this.stackID(p)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${p==t?"":", split"})`),c)return!0;p.pos>i?e.push(p):s.push(p)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return I(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),d=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(d=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),I(n,s)):(!i||i.score<f.score)&&(i=f)}return i}stackToTree(t){return t.close(),k.Tree.build({buffer:T.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(C||(C=new WeakMap)).get(t);return e||C.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function I(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class H{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const w=l=>l;class W{constructor(t){this.start=t.start,this.shift=t.shift||w,this.reduce=t.reduce||w,this.reuse=t.reuse||w,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class A extends k.Parser{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=k.NodeProp[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let d=-u;d>0;d--)h(n[a++],o,f);a++}}}this.nodeSet=new k.NodeSet(e.map((n,o)=>k.NodeType.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=k.DefaultBufferLength;let r=b(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(D),this.states=b(t.states,Uint32Array),this.data=b(t.stateData),this.goto=b(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new x(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new U(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=m(s,h+2)];else{if(s[h+1]==2)return m(s,h+2);break}if(r==e||r==0)return m(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=m(this.data,h+2);else break;i=e(m(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=m(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(A.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=D(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new H(t,s,i)}static deserialize(t){return new A(t)}}function m(l,t){return l[t]|l[t+1]<<16}function q(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function D(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}exports.ContextTracker=W;exports.ExternalTokenizer=$;exports.InputStream=B;exports.LRParser=A;exports.LocalTokenGroup=O;exports.Stack=S;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class r{#o=!0;#e;#t;#u;#n;#r;#i;#a;#g=0;#v=5;#h=!1;#d=!1;#s=null;#c=()=>{this.debugLog("Connected to event bus"),this.#r=!0,this.#h=!1,this.debugLog("Emitting queued events",this.#n),this.#n.forEach(t=>this.emitEventToBus(t)),this.#n=[],this.stopConnectLoop(),this.#t().removeEventListener("tanstack-connect-success",this.#c)};#l=()=>{if(this.#g<this.#v){this.#g++,this.dispatchCustomEvent("tanstack-connect",{});return}this.#t().removeEventListener("tanstack-connect",this.#l),this.#d=!0,this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()};#E=()=>{this.#h||(this.#h=!0,this.#t().addEventListener("tanstack-connect-success",this.#c),this.#l())};constructor({pluginId:t,debug:e=!1,enabled:n=!0,reconnectEveryMs:i=300}){this.#e=t,this.#o=n,this.#t=this.getGlobalTarget,this.#u=e,this.debugLog(" Initializing event subscription for plugin",this.#e),this.#n=[],this.#r=!1,this.#d=!1,this.#i=null,this.#a=i}startConnectLoop(){this.#i!==null||this.#r||(this.debugLog(`Starting connect loop (every ${this.#a}ms)`),this.#i=setInterval(this.#l,this.#a))}stopConnectLoop(){this.#h=!1,this.#i!==null&&(clearInterval(this.#i),this.#i=null,this.#n=[],this.debugLog("Stopped connect loop"))}debugLog(...t){this.#u&&console.log(`🌴 [tanstack-devtools:${this.#e}-plugin]`,...t)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const t=typeof EventTarget<"u"?new EventTarget:void 0;return typeof t>"u"||typeof t.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),t)}getPluginId(){return this.#e}dispatchCustomEventShim(t,e){try{const n=new Event(t,{detail:e});this.#t().dispatchEvent(n)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(t,e){try{this.#t().dispatchEvent(new CustomEvent(t,{detail:e}))}catch{this.dispatchCustomEventShim(t,e)}}emitEventToBus(t){this.debugLog("Emitting event to client bus",t),this.dispatchCustomEvent("tanstack-dispatch-event",t)}createEventPayload(t,e){return{type:`${this.#e}:${t}`,payload:e,pluginId:this.#e}}emit(t,e){if(!this.#o){this.debugLog("Event bus client is disabled, not emitting event",t,e);return}if(this.#s&&(this.debugLog("Emitting event to internal event target",t,e),this.#s.dispatchEvent(new CustomEvent(`${this.#e}:${t}`,{detail:this.createEventPayload(t,e)}))),this.#d){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!this.#r){this.debugLog("Bus not available, will be pushed as soon as connected"),this.#n.push(this.createEventPayload(t,e)),typeof CustomEvent<"u"&&!this.#h&&(this.#E(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(t,e))}on(t,e,n){const i=n?.withEventTarget??!1,s=`${this.#e}:${t}`;if(i&&(this.#s||(this.#s=new EventTarget),this.#s.addEventListener(s,o=>{e(o.detail)})),!this.#o)return this.debugLog("Event bus client is disabled, not registering event",s),()=>{};const h=o=>{this.debugLog("Received event from bus",o.detail),e(o.detail)};return this.#t().addEventListener(s,h),this.debugLog("Registered event to bus",s),()=>{i&&this.#s?.removeEventListener(s,h),this.#t().removeEventListener(s,h)}}onAll(t){if(!this.#o)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=n=>{const i=n.detail;t(i)};return this.#t().addEventListener("tanstack-devtools-global",e),()=>this.#t().removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(t){if(!this.#o)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=n=>{const i=n.detail;this.#e&&i.pluginId!==this.#e||t(i)};return this.#t().addEventListener("tanstack-devtools-global",e),()=>this.#t().removeEventListener("tanstack-devtools-global",e)}}exports.EventClient=r;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../devtools-event-client/dist/esm/plugin.js");class t extends e.EventClient{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}}const n=new t;exports.formEventClient=n;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../../../store/dist/esm/derived.js"),B=require("../../../store/dist/esm/scheduler.js"),F=require("./standardSchemaValidator.js"),D=require("./metaHelper.js"),n=require("./utils.js"),y=require("./ValidationLogic.js");class P{constructor(l){this.options={},this.mount=()=>{const e=this.store.mount();this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const t=this.getInfo();t.instance=this,this.update(this.options);const{onMount:i}=this.options.validators||{};if(i){const r=this.runValidator({validate:i,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});r&&this.setMeta(u=>({...u,errorMap:{...u?.errorMap,onMount:r},errorSourceMap:{...u?.errorSourceMap,onMount:"field"}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),e},this.update=e=>{if(this.options=e,this.name=e.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const t=this.form.getFieldValue(this.name);n.evaluate(t,e.defaultValue)||this.form.setFieldValue(this.name,e.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(e,t)=>{this.form.setFieldValue(this.name,e,n.mergeOpts(t,{dontRunListeners:!0,dontValidate:!0})),t?.dontRunListeners||this.triggerOnChangeListener(),t?.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=e=>this.form.setFieldMeta(this.name,e),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(e,t)=>{this.form.pushFieldValue(this.name,e,n.mergeOpts(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(e,t,i)=>{this.form.insertFieldValue(this.name,e,t,n.mergeOpts(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(e,t,i)=>{this.form.replaceFieldValue(this.name,e,t,n.mergeOpts(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(e,t)=>{this.form.removeFieldValue(this.name,e,n.mergeOpts(t,{dontRunListeners:!0})),t?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(e,t,i)=>{this.form.swapFieldValues(this.name,e,t,n.mergeOpts(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(e,t,i)=>{this.form.moveFieldValues(this.name,e,t,n.mergeOpts(i,{dontRunListeners:!0})),i?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=e=>{this.form.clearFieldValues(this.name,n.mergeOpts(e,{dontRunListeners:!0})),e?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=e=>{const t=Object.values(this.form.fieldInfo),i=[];for(const r of t){if(!r.instance)continue;const{onChangeListenTo:u,onBlurListenTo:m}=r.instance.options.validators||{};e==="change"&&u?.includes(this.name)&&i.push(r.instance),e==="blur"&&m?.includes(this.name)&&i.push(r.instance)}return i},this.validateSync=(e,t)=>{const i=n.getSyncValidatorArray(e,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||y.defaultValidationLogic}),u=this.getLinkedFields(e).reduce((d,a)=>{const h=n.getSyncValidatorArray(e,{...a.options,form:a.form,validationLogic:a.form.options.validationLogic||y.defaultValidationLogic});return h.forEach(c=>{c.field=a}),d.concat(h)},[]);let m=!1;B.batch(()=>{const d=(a,h)=>{const c=A(h.cause),s=h.validate?C(a.runValidator({validate:h.validate,value:{value:a.store.state.value,validationSource:"field",fieldApi:a},type:"validate"})):void 0,o=t[c],{newErrorValue:g,newSource:f}=n.determineFieldLevelErrorSourceAndValue({formLevelError:o,fieldLevelError:s});a.state.meta.errorMap?.[c]!==g&&a.setMeta(M=>({...M,errorMap:{...M.errorMap,[c]:g},errorSourceMap:{...M.errorSourceMap,[c]:f}})),g&&(m=!0)};for(const a of i)d(this,a);for(const a of u)a.validate&&d(a.field,a)});const p=A("submit");return this.state.meta.errorMap?.[p]&&e!=="submit"&&!m&&this.setMeta(d=>({...d,errorMap:{...d.errorMap,[p]:void 0},errorSourceMap:{...d.errorSourceMap,[p]:void 0}})),{hasErrored:m}},this.validateAsync=async(e,t)=>{const i=n.getAsyncValidatorArray(e,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||y.defaultValidationLogic}),r=await t,u=this.getLinkedFields(e),m=u.reduce((s,o)=>{const g=n.getAsyncValidatorArray(e,{...o.options,form:o.form,validationLogic:o.form.options.validationLogic||y.defaultValidationLogic});return g.forEach(f=>{f.field=o}),s.concat(g)},[]),p=[],d=[],a=i.some(s=>s.validate)||m.some(s=>s.validate);if(a){this.state.meta.isValidating||this.setMeta(s=>({...s,isValidating:!0}));for(const s of u)s.setMeta(o=>({...o,isValidating:!0}))}const h=(s,o,g)=>{const f=A(o.cause);s.getInfo().validationMetaMap[f]?.lastAbortController.abort();const L=new AbortController;this.getInfo().validationMetaMap[f]={lastAbortController:L},g.push(new Promise(async b=>{let S;try{S=await new Promise((v,R)=>{this.timeoutIds.validations[o.cause]&&clearTimeout(this.timeoutIds.validations[o.cause]),this.timeoutIds.validations[o.cause]=setTimeout(async()=>{if(L.signal.aborted)return v(void 0);try{v(await this.runValidator({validate:o.validate,value:{value:s.store.state.value,fieldApi:s,signal:L.signal,validationSource:"field"},type:"validateAsync"}))}catch(w){R(w)}},o.debounceMs)})}catch(v){S=v}if(L.signal.aborted)return b(void 0);const T=C(S),E=r[this.name]?.[f],{newErrorValue:I,newSource:O}=n.determineFieldLevelErrorSourceAndValue({formLevelError:E,fieldLevelError:T});s.setMeta(v=>({...v,errorMap:{...v?.errorMap,[f]:I},errorSourceMap:{...v.errorSourceMap,[f]:O}})),b(I)}))};for(const s of i)s.validate&&h(this,s,p);for(const s of m)s.validate&&h(s.field,s,d);let c=[];if((p.length||d.length)&&(c=await Promise.all(p),await Promise.all(d)),a){this.setMeta(s=>({...s,isValidating:!1}));for(const s of u)s.setMeta(o=>({...o,isValidating:!1}))}return c.filter(Boolean)},this.validate=(e,t)=>{if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:i}=t?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(e),{hasErrored:r}=this.validateSync(e,i[this.name]??{});if(r&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[A(e)]?.lastAbortController.abort(),this.state.meta.errors;const u=t?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(e);return this.validateAsync(e,u)},this.handleChange=e=>{this.setValue(e)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(t=>({...t,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(t=>({...t,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=e=>{this.setMeta(t=>({...t,errorMap:{...t.errorMap,...e}}))},this.parseValueWithSchema=e=>F.standardSchemaValidators.validate({value:this.state.value,validationSource:"field"},e),this.parseValueWithSchemaAsync=e=>F.standardSchemaValidators.validateAsync({value:this.state.value,validationSource:"field"},e),this.triggerOnChangeListener=()=>{const e=this.form.options.listeners?.onChangeDebounceMs;e&&e>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},e)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});const t=this.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},this.form=l.form,this.name=l.name,this.options=l,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=new k.Derived({deps:[this.form.store],fn:({prevVal:e})=>{const t=e,i=this.form.getFieldMeta(this.name)??{...D.defaultFieldMeta,...l.defaultMeta};let r=this.form.getFieldValue(this.name);return!i.isTouched&&r===void 0&&this.options.defaultValue!==void 0&&!n.evaluate(r,this.options.defaultValue)&&(r=this.options.defaultValue),t&&t.value===r&&t.meta===i?t:{value:r,meta:i}}})}get state(){return this.store.state}runValidator(l){return F.isStandardSchemaValidator(l.validate)?F.standardSchemaValidators[l.type](l.value,l.validate):l.validate(l.value)}triggerOnBlurListener(){const l=this.form.options.listeners?.onBlurDebounceMs;l&&l>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},l)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});const e=this.options.listeners?.onBlurDebounceMs;e&&e>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},e)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}}function C(V){if(V)return V}function A(V){switch(V){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";default:return"onChange"}}exports.FieldApi=P;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("../../../store/dist/esm/derived.js"),K=require("../../../store/dist/esm/store.js"),A=require("../../../store/dist/esm/scheduler.js"),l=require("./utils.js"),q=require("./ValidationLogic.js"),T=require("./standardSchemaValidator.js"),I=require("./metaHelper.js"),g=require("./EventClient.js");function L(m){return{values:m.values??{},errorMap:m.errorMap??{},fieldMetaBase:m.fieldMetaBase??{},isSubmitted:m.isSubmitted??!1,isSubmitting:m.isSubmitting??!1,isValidating:m.isValidating??!1,submissionAttempts:m.submissionAttempts??0,isSubmitSuccessful:m.isSubmitSuccessful??!1,validationMetaMap:m.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class U{constructor(b){this.options={},this.fieldInfo={},this.prevTransformArray=[],this.mount=()=>{const t=this.fieldMetaDerived.mount(),s=this.store.mount(),i=this.store.subscribe(()=>{l.throttleFormState(this)}),e=g.formEventClient.on("request-form-state",n=>{n.payload.id===this._formId&&g.formEventClient.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),o=g.formEventClient.on("request-form-reset",n=>{n.payload.id===this._formId&&this.reset()}),a=g.formEventClient.on("request-form-force-submit",n=>{n.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),r=()=>{a(),o(),e(),i(),t(),s(),g.formEventClient.emit("form-unmounted",{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});const{onMount:d}=this.options.validators||{};return g.formEventClient.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}),d&&this.validateSync("mount"),r},this.update=t=>{if(!t)return;const s=this.options;this.options=t;const i=!!t.transform?.deps?.some((a,r)=>a!==this.prevTransformArray[r]),e=t.defaultValues&&!l.evaluate(t.defaultValues,s.defaultValues)&&!this.state.isTouched,o=!l.evaluate(t.defaultState,s.defaultState)&&!this.state.isTouched;!e&&!o&&!i||(A.batch(()=>{this.baseStore.setState(()=>L(Object.assign({},this.state,o?t.defaultState:{},e?{values:t.defaultValues}:{},i?{_force_re_eval:!this.state._force_re_eval}:{})))}),g.formEventClient.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}))},this.reset=(t,s)=>{const{fieldMeta:i}=this.state,e=this.resetFieldMeta(i);t&&!s?.keepDefaultValues&&(this.options={...this.options,defaultValues:t}),this.baseStore.setState(()=>L({...this.options.defaultState,values:t??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:e}))},this.validateAllFields=async t=>{const s=[];return A.batch(()=>{Object.values(this.fieldInfo).forEach(e=>{if(!e.instance)return;const o=e.instance;s.push(Promise.resolve().then(()=>o.validate(t,{skipFormValidation:!0}))),e.instance.state.meta.isTouched||e.instance.setMeta(a=>({...a,isTouched:!0}))})}),(await Promise.all(s)).flat()},this.validateArrayFieldsStartingFrom=async(t,s,i)=>{const e=this.getFieldValue(t),o=Array.isArray(e)?Math.max(e.length-1,0):null,a=[`${t}[${s}]`];for(let u=s+1;u<=(o??0);u++)a.push(`${t}[${u}]`);const r=Object.keys(this.fieldInfo).filter(u=>a.some(h=>u.startsWith(h))),d=[];return A.batch(()=>{r.forEach(u=>{d.push(Promise.resolve().then(()=>this.validateField(u,i)))})}),(await Promise.all(d)).flat()},this.validateField=(t,s)=>{const i=this.fieldInfo[t]?.instance;if(!i){const{hasErrored:e}=this.validateSync(s);return e&&!this.options.asyncAlways?this.getFieldMeta(t)?.errors??[]:this.validateAsync(s).then(()=>this.getFieldMeta(t)?.errors??[])}return i.state.meta.isTouched||i.setMeta(e=>({...e,isTouched:!0})),i.validate(s)},this.validateSync=t=>{const s=l.getSyncValidatorArray(t,{...this.options,form:this,validationLogic:this.options.validationLogic||q.defaultValidationLogic});let i=!1;const e={};return A.batch(()=>{for(const r of s){if(!r.validate)continue;const d=this.runValidator({validate:r.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:n,fieldErrors:u}=_(d),h=j(r.cause),v=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(u||{})]);for(const M of v){if(this.baseStore.state.fieldMetaBase[M]===void 0&&!u?.[M])continue;const S=this.getFieldMeta(M)??I.defaultFieldMeta,{errorMap:p,errorSourceMap:f}=S,F=u?.[M],{newErrorValue:y,newSource:V}=l.determineFormLevelErrorSourceAndValue({newFormValidatorError:F,isPreviousErrorFromFormValidator:f?.[h]==="form",previousErrorValue:p?.[h]});V==="form"&&(e[M]={...e[M],[h]:F}),p?.[h]!==y&&this.setFieldMeta(M,(E=I.defaultFieldMeta)=>({...E,errorMap:{...E.errorMap,[h]:y},errorSourceMap:{...E.errorSourceMap,[h]:V}}))}this.state.errorMap?.[h]!==n&&this.baseStore.setState(M=>({...M,errorMap:{...M.errorMap,[h]:n}})),(n||u)&&(i=!0)}const o=j("submit");this.state.errorMap?.[o]&&t!=="submit"&&!i&&this.baseStore.setState(r=>({...r,errorMap:{...r.errorMap,[o]:void 0}}));const a=j("server");this.state.errorMap?.[a]&&t!=="server"&&!i&&this.baseStore.setState(r=>({...r,errorMap:{...r.errorMap,[a]:void 0}}))}),{hasErrored:i,fieldsErrorMap:e}},this.validateAsync=async t=>{const s=l.getAsyncValidatorArray(t,{...this.options,form:this,validationLogic:this.options.validationLogic||q.defaultValidationLogic});this.state.isFormValidating||this.baseStore.setState(r=>({...r,isFormValidating:!0}));const i=[];let e;for(const r of s){if(!r.validate)continue;const d=j(r.cause);this.state.validationMetaMap[d]?.lastAbortController.abort();const u=new AbortController;this.state.validationMetaMap[d]={lastAbortController:u},i.push(new Promise(async h=>{let v;try{v=await new Promise((f,F)=>{setTimeout(async()=>{if(u.signal.aborted)return f(void 0);try{f(await this.runValidator({validate:r.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:u.signal},type:"validateAsync"}))}catch(y){F(y)}},r.debounceMs)})}catch(f){v=f}const{formError:M,fieldErrors:S}=_(v);S&&(e=e?{...e,...S}:S);const p=j(r.cause);for(const f of Object.keys(this.state.fieldMeta)){if(this.baseStore.state.fieldMetaBase[f]===void 0)continue;const F=this.getFieldMeta(f);if(!F)continue;const{errorMap:y,errorSourceMap:V}=F,E=e?.[f],{newErrorValue:B,newSource:C}=l.determineFormLevelErrorSourceAndValue({newFormValidatorError:E,isPreviousErrorFromFormValidator:V?.[p]==="form",previousErrorValue:y?.[p]});y?.[p]!==B&&this.setFieldMeta(f,w=>({...w,errorMap:{...w.errorMap,[p]:B},errorSourceMap:{...w.errorSourceMap,[p]:C}}))}this.baseStore.setState(f=>({...f,errorMap:{...f.errorMap,[p]:M}})),h(e?{fieldErrors:e,errorMapKey:p}:void 0)}))}let o=[];const a={};if(i.length){o=await Promise.all(i);for(const r of o)if(r?.fieldErrors){const{errorMapKey:d}=r;for(const[n,u]of Object.entries(r.fieldErrors)){const v={...a[n]||{},[d]:u};a[n]=v}}}return this.baseStore.setState(r=>({...r,isFormValidating:!1})),a},this.validate=t=>{const{hasErrored:s,fieldsErrorMap:i}=this.validateSync(t);return s&&!this.options.asyncAlways?i:this.validateAsync(t)},this._handleSubmit=async t=>{this.baseStore.setState(e=>({...e,isSubmitted:!1,submissionAttempts:e.submissionAttempts+1,isSubmitSuccessful:!1})),A.batch(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance&&(e.instance.state.meta.isTouched||e.instance.setMeta(o=>({...o,isTouched:!0})))})});const s=t??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:s});return}this.baseStore.setState(e=>({...e,isSubmitting:!0}));const i=()=>{this.baseStore.setState(e=>({...e,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){i(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:s}),g.formEventClient.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(e=>e.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){i(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:s}),g.formEventClient.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}A.batch(()=>{Object.values(this.fieldInfo).forEach(e=>{e.instance?.options.listeners?.onSubmit?.({value:e.instance.state.value,fieldApi:e.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:s});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:s}),A.batch(()=>{this.baseStore.setState(e=>({...e,isSubmitted:!0,isSubmitSuccessful:!0})),g.formEventClient.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),i()})}catch(e){throw this.baseStore.setState(o=>({...o,isSubmitSuccessful:!1})),g.formEventClient.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:e}),i(),e}},this.getFieldValue=t=>l.getBy(this.state.values,t),this.getFieldMeta=t=>this.state.fieldMeta[t],this.getFieldInfo=t=>this.fieldInfo[t]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(t,s)=>{this.baseStore.setState(i=>({...i,fieldMetaBase:{...i.fieldMetaBase,[t]:l.functionalUpdate(s,i.fieldMetaBase[t])}}))},this.resetFieldMeta=t=>Object.keys(t).reduce((s,i)=>{const e=i;return s[e]=I.defaultFieldMeta,s},{}),this.setFieldValue=(t,s,i)=>{const e=i?.dontUpdateMeta??!1,o=i?.dontRunListeners??!1,a=i?.dontValidate??!1;A.batch(()=>{e||this.setFieldMeta(t,r=>({...r,isTouched:!0,isDirty:!0,errorMap:{...r?.errorMap,onMount:void 0}})),this.baseStore.setState(r=>({...r,values:l.setBy(r.values,t,s)}))}),o||this.getFieldInfo(t).instance?.triggerOnChangeListener(),a||this.validateField(t,"change")},this.deleteField=t=>{const i=[...Object.keys(this.fieldInfo).filter(e=>{const o=t.toString();return e!==o&&e.startsWith(o)}),t];this.baseStore.setState(e=>{const o={...e};return i.forEach(a=>{o.values=l.deleteBy(o.values,a),delete this.fieldInfo[a],delete o.fieldMetaBase[a]}),o})},this.pushFieldValue=(t,s,i)=>{this.setFieldValue(t,e=>[...Array.isArray(e)?e:[],s],i)},this.insertFieldValue=async(t,s,i,e)=>{this.setFieldValue(t,a=>[...a.slice(0,s),i,...a.slice(s)],l.mergeOpts(e,{dontValidate:!0}));const o=e?.dontValidate??!1;o||await this.validateField(t,"change"),I.metaHelper(this).handleArrayInsert(t,s),o||await this.validateArrayFieldsStartingFrom(t,s,"change")},this.replaceFieldValue=async(t,s,i,e)=>{this.setFieldValue(t,a=>a.map((r,d)=>d===s?i:r),l.mergeOpts(e,{dontValidate:!0})),(e?.dontValidate??!1)||(await this.validateField(t,"change"),await this.validateArrayFieldsStartingFrom(t,s,"change"))},this.removeFieldValue=async(t,s,i)=>{const e=this.getFieldValue(t),o=Array.isArray(e)?Math.max(e.length-1,0):null;if(this.setFieldValue(t,r=>r.filter((d,n)=>n!==s),l.mergeOpts(i,{dontValidate:!0})),I.metaHelper(this).handleArrayRemove(t,s),o!==null){const r=`${t}[${o}]`;this.deleteField(r)}(i?.dontValidate??!1)||(await this.validateField(t,"change"),await this.validateArrayFieldsStartingFrom(t,s,"change"))},this.swapFieldValues=(t,s,i,e)=>{this.setFieldValue(t,a=>{const r=a[s],d=a[i];return l.setBy(l.setBy(a,`${s}`,d),`${i}`,r)},l.mergeOpts(e,{dontValidate:!0})),I.metaHelper(this).handleArraySwap(t,s,i),(e?.dontValidate??!1)||(this.validateField(t,"change"),this.validateField(`${t}[${s}]`,"change"),this.validateField(`${t}[${i}]`,"change"))},this.moveFieldValues=(t,s,i,e)=>{this.setFieldValue(t,a=>{const r=[...a];return r.splice(i,0,r.splice(s,1)[0]),r},l.mergeOpts(e,{dontValidate:!0})),I.metaHelper(this).handleArrayMove(t,s,i),(e?.dontValidate??!1)||(this.validateField(t,"change"),this.validateField(`${t}[${s}]`,"change"),this.validateField(`${t}[${i}]`,"change"))},this.clearFieldValues=(t,s)=>{const i=this.getFieldValue(t),e=Array.isArray(i)?Math.max(i.length-1,0):null;if(this.setFieldValue(t,[],l.mergeOpts(s,{dontValidate:!0})),e!==null)for(let a=0;a<=e;a++){const r=`${t}[${a}]`;this.deleteField(r)}(s?.dontValidate??!1)||this.validateField(t,"change")},this.resetField=t=>{this.baseStore.setState(s=>({...s,fieldMetaBase:{...s.fieldMetaBase,[t]:I.defaultFieldMeta},values:this.options.defaultValues?l.setBy(s.values,t,l.getBy(this.options.defaultValues,t)):s.values}))},this.setErrorMap=t=>{A.batch(()=>{Object.entries(t).forEach(([s,i])=>{const e=s;if(l.isGlobalFormValidationError(i)){const{formError:o,fieldErrors:a}=_(i);for(const r of Object.keys(this.fieldInfo))this.getFieldMeta(r)&&this.setFieldMeta(r,n=>({...n,errorMap:{...n.errorMap,[e]:a?.[r]},errorSourceMap:{...n.errorSourceMap,[e]:"form"}}));this.baseStore.setState(r=>({...r,errorMap:{...r.errorMap,[e]:o}}))}else this.baseStore.setState(o=>({...o,errorMap:{...o.errorMap,[e]:i}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((t,[s,i])=>(Object.keys(i).length&&i.errors.length&&(t[s]={errors:i.errors,errorMap:i.errorMap}),t),{})}),this.parseValuesWithSchema=t=>T.standardSchemaValidators.validate({value:this.state.values,validationSource:"form"},t),this.parseValuesWithSchemaAsync=t=>T.standardSchemaValidators.validateAsync({value:this.state.values,validationSource:"form"},t),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=b?.formId??l.uuid(),this._devtoolsSubmissionOverride=!1,this.baseStore=new K.Store(L({...b?.defaultState,values:b?.defaultValues??b?.defaultState?.values})),this.fieldMetaDerived=new k.Derived({deps:[this.baseStore],fn:({prevDepVals:t,currDepVals:s,prevVal:i})=>{const e=i,o=t?.[0],a=s[0];let r=0;const d={};for(const n of Object.keys(a.fieldMetaBase)){const u=a.fieldMetaBase[n],h=o?.fieldMetaBase[n],v=e?.[n],M=l.getBy(a.values,n);let S=v?.errors;if(!h||u.errorMap!==h.errorMap){S=Object.values(u.errorMap??{}).filter(V=>V!==void 0);const y=this.getFieldInfo(n)?.instance;(!y||!y.options.disableErrorFlat)&&(S=S.flat(1))}const p=!l.isNonEmptyArray(S),f=!u.isDirty,F=l.evaluate(M,l.getBy(this.options.defaultValues,n))||l.evaluate(M,this.getFieldInfo(n)?.instance?.options.defaultValue);if(v&&v.isPristine===f&&v.isValid===p&&v.isDefaultValue===F&&v.errors===S&&u===h){d[n]=v,r++;continue}d[n]={...u,errors:S??[],isPristine:f,isValid:p,isDefaultValue:F}}return Object.keys(a.fieldMetaBase).length&&e&&r===Object.keys(a.fieldMetaBase).length?e:d}}),this.store=new k.Derived({deps:[this.baseStore,this.fieldMetaDerived],fn:({prevDepVals:t,currDepVals:s,prevVal:i})=>{const e=i,o=t?.[0],a=s[0],r=s[1],d=Object.values(r).filter(Boolean),n=d.some(c=>c.isValidating),u=d.every(c=>c.isValid),h=d.some(c=>c.isTouched),v=d.some(c=>c.isBlurred),M=d.every(c=>c.isDefaultValue),S=h&&a.errorMap?.onMount,p=d.some(c=>c.isDirty),f=!p,F=!!(a.errorMap?.onMount||d.some(c=>c?.errorMap?.onMount)),y=!!n;let V=e?.errors??[];(!o||a.errorMap!==o.errorMap)&&(V=Object.values(a.errorMap).reduce((c,O)=>O===void 0?c:O&&l.isGlobalFormValidationError(O)?(c.push(O.form),c):(c.push(O),c),[]));const E=V.length===0,B=u&&E,C=this.options.canSubmitWhenInvalid??!1,w=a.submissionAttempts===0&&!h&&!F||!y&&!a.isSubmitting&&B||C;let D=a.errorMap;if(S&&(V=V.filter(c=>c!==a.errorMap.onMount),D=Object.assign(D,{onMount:void 0})),e&&o&&e.errorMap===D&&e.fieldMeta===this.fieldMetaDerived.state&&e.errors===V&&e.isFieldsValidating===n&&e.isFieldsValid===u&&e.isFormValid===E&&e.isValid===B&&e.canSubmit===w&&e.isTouched===h&&e.isBlurred===v&&e.isPristine===f&&e.isDefaultValue===M&&e.isDirty===p&&l.evaluate(o,a))return e;let P={...a,errorMap:D,fieldMeta:this.fieldMetaDerived.state,errors:V,isFieldsValidating:n,isFieldsValid:u,isFormValid:E,isValid:B,canSubmit:w,isTouched:h,isBlurred:v,isPristine:f,isDefaultValue:M,isDirty:p};const $=this.options.transform?.deps??[];if($.length!==this.prevTransformArray.length||$.some((c,O)=>c!==this.prevTransformArray[O])){const c=Object.assign({},this,{state:P});this.options.transform?.fn(c),P=c.state,this.prevTransformArray=$}return P}}),this.handleSubmit=this.handleSubmit.bind(this),this.update(b||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(b){return T.isStandardSchemaValidator(b.validate)?T.standardSchemaValidators[b.type](b.value,b.validate):b.validate(b.value)}handleSubmit(b){return this._handleSubmit(b)}}function _(m){if(m){if(l.isGlobalFormValidationError(m)){const b=_(m.form).formError,t=m.fields;return{formError:b,fieldErrors:t}}return{formError:m}}return{formError:void 0}}function j(m){switch(m){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";default:return"onChange"}}exports.FormApi=U;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=a=>{if(!a.validators)return a.runValidation({validators:[],form:a.form});const n=a.event.async,e=n?void 0:{fn:a.validators.onMount,cause:"mount"},i={fn:n?a.validators.onChangeAsync:a.validators.onChange,cause:"change"},o={fn:n?a.validators.onBlurAsync:a.validators.onBlur,cause:"blur"},r={fn:n?a.validators.onSubmitAsync:a.validators.onSubmit,cause:"submit"},t=n?void 0:{fn:()=>{},cause:"server"};switch(a.event.type){case"mount":return a.runValidation({validators:[e],form:a.form});case"submit":return a.runValidation({validators:[i,o,r,t],form:a.form});case"server":return a.runValidation({validators:[],form:a.form});case"blur":return a.runValidation({validators:[o,t],form:a.form});case"change":return a.runValidation({validators:[i,t],form:a.form});default:throw new Error(`Unknown validation event type: ${a.event.type}`)}};exports.defaultValidationLogic=l;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function S(u){function g(t,e,s){const r=h(t,e,"move",s),n=Math.min(e,s),c=Math.max(e,s);for(let a=n;a<=c;a++)r.push(l(t,a));const o=Object.keys(u.fieldInfo).reduce((a,i)=>(i.startsWith(l(t,e))&&a.set(i,u.getFieldMeta(i)),a),new Map);F(r,e<s?"up":"down"),Object.keys(u.fieldInfo).filter(a=>a.startsWith(l(t,s))).forEach(a=>{const i=a.replace(l(t,s),l(t,e)),d=o.get(i);d&&u.setFieldMeta(a,d)})}function p(t,e){const s=h(t,e,"remove");F(s,"up")}function w(t,e,s){h(t,e,"swap",s).forEach(n=>{if(!n.toString().startsWith(l(t,e)))return;const c=n.toString().replace(l(t,e),l(t,s)),[o,a]=[u.getFieldMeta(n),u.getFieldMeta(c)];o&&u.setFieldMeta(c,o),a&&u.setFieldMeta(n,a)})}function b(t,e){const s=h(t,e,"insert");F(s,"down"),s.forEach(r=>{r.toString().startsWith(l(t,e))&&u.setFieldMeta(r,M())})}function l(t,e){return`${t}[${e}]`}function h(t,e,s,r){const n=[l(t,e)];switch(s){case"swap":n.push(l(t,r));break;case"move":{const[c,o]=[Math.min(e,r),Math.max(e,r)];for(let a=c;a<=o;a++)n.push(l(t,a));break}default:{const c=u.getFieldValue(t),o=Array.isArray(c)?c.length:0;for(let a=e+1;a<o;a++)n.push(l(t,a));break}}return Object.keys(u.fieldInfo).filter(c=>n.some(o=>c.startsWith(o)))}function y(t,e){return t.replace(/\[(\d+)\]/,(s,r)=>{const n=parseInt(r,10);return`[${e==="up"?n+1:Math.max(0,n-1)}]`})}function F(t,e){(e==="up"?t:[...t].reverse()).forEach(r=>{const n=y(r.toString(),e),c=u.getFieldMeta(n);c?u.setFieldMeta(r,c):u.setFieldMeta(r,M())})}const M=()=>f;return{handleArrayMove:g,handleArrayRemove:p,handleArraySwap:w,handleArrayInsert:b}}exports.defaultFieldMeta=f;exports.metaHelper=S;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(e,r){const t=new Map;for(const s of e){const d=s.path??[];let a=r,n="";for(let i=0;i<d.length;i++){const o=d[i];if(o===void 0)continue;const c=typeof o=="object"?o.key:o,u=Number(c);Array.isArray(a)&&!Number.isNaN(u)?n+=`[${u}]`:n+=(i>0?".":"")+String(c),typeof a=="object"&&a!==null?a=a[c]:a=void 0}t.set(n,(t.get(n)??[]).concat(s))}return Object.fromEntries(t)}const f=(e,r)=>{const t=l(e,r);return{form:t,fields:t}},m={validate({value:e,validationSource:r},t){const s=t["~standard"].validate(e);if(s instanceof Promise)throw new Error("async function passed to sync validator");if(s.issues)return r==="field"?s.issues:f(s.issues,e)},async validateAsync({value:e,validationSource:r},t){const s=await t["~standard"].validate(e);if(s.issues)return r==="field"?s.issues:f(s.issues,e)}},h=e=>!!e&&"~standard"in e;exports.isStandardSchemaValidator=h;exports.standardSchemaValidators=m;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../../../pacer-lite/dist/lite-throttler.js"),D=require("./EventClient.js");function w(e,t){return typeof e=="function"?e(t):e}function E(e,t){return m(t).reduce((u,r)=>{if(u===null)return null;if(typeof u<"u")return u[r]},e)}function V(e,t,n){const u=m(t);function r(i){if(!u.length)return w(n,i);const o=u.shift();if(typeof o=="string"||typeof o=="number"&&!Array.isArray(i))return typeof i=="object"?(i===null&&(i={}),{...i,[o]:r(i[o])}):{[o]:r()};if(Array.isArray(i)&&typeof o=="number"){const c=i.slice(0,o);return[...c.length?c:new Array(o),r(i[o]),...i.slice(o+1)]}return[...new Array(o),r()]}return r(e)}function k(e,t){const n=m(t);function u(r){if(!r)return;if(n.length===1){const o=n[0];if(Array.isArray(r)&&typeof o=="number")return r.filter((h,l)=>l!==o);const{[o]:c,...g}=r;return g}const i=n.shift();if((typeof i=="string"||typeof i=="number"&&!Array.isArray(r))&&typeof r=="object")return{...r,[i]:u(r[i])};if(typeof i=="number"&&Array.isArray(r)){if(i>=r.length)return r;const o=r.slice(0,i);return[...o.length?o:new Array(i),u(r[i]),...r.slice(i+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return u(e)}const p=/^(\d+)$/gm,M=/\.(\d+)(?=\.)/gm,b=/^(\d+)\./gm,F=/\.(\d+$)/gm,O=/\.{2,}/gm,v="__int__",f=`${v}$1`;function m(e){if(Array.isArray(e))return[...e];if(typeof e!="string")throw new Error("Path must be a string.");return e.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(p,f).replace(M,`.${f}.`).replace(b,`${f}.`).replace(F,`.${f}`).replace(O,".").split(".").map(t=>{if(t.startsWith(v)){const n=t.substring(v.length),u=parseInt(n,10);return String(u)===n?u:n}return t})}function T(e){return!(Array.isArray(e)&&e.length===0)}function $(e,t){const n=u=>u.validators.filter(Boolean).map(r=>({cause:r.cause,validate:r.fn}));return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!1},runValidation:n})}function P(e,t){const{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:u,onChangeAsyncDebounceMs:r,onDynamicAsyncDebounceMs:i}=t.validators||{},o=n??0,c=g=>g.validators.filter(Boolean).map(h=>{const l=h?.cause||e;let s=o;switch(l){case"change":s=r??o;break;case"blur":s=u??o;break;case"dynamic":s=i??o;break;case"submit":s=0;break}return e==="submit"&&(s=0),{cause:l,validate:h.fn,debounceMs:s}});return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!0},runValidation:c})}const L=e=>!!e&&typeof e=="object"&&"fields"in e;function A(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!t.has(r)||!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e),u=Object.keys(t);if(n.length!==u.length)return!1;for(const r of n)if(!u.includes(r)||!A(e[r],t[r]))return!1;return!0}const _=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:"form"}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},z=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:"field"}:e?{newErrorValue:e,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function C(e,t){return e==null?t:{...e,...t}}let a=256;const d=[];let y;for(;a--;)d[a]=(a+256).toString(16).substring(1);function I(){let e=0,t,n="";if(!y||a+16>256){for(y=new Array(256),e=256;e--;)y[e]=256*Math.random()|0;e=0,a=0}for(;e<16;e++)t=y[a+e],e===6?n+=d[t&15|64]:e===8?n+=d[t&63|128]:n+=d[t],e&1&&e>1&&e<11&&(n+="-");return a++,n}const x=S.liteThrottle(e=>D.formEventClient.emit("form-state",{id:e.formId,state:e.store.state}),{wait:300});exports.deleteBy=k;exports.determineFieldLevelErrorSourceAndValue=z;exports.determineFormLevelErrorSourceAndValue=_;exports.evaluate=A;exports.functionalUpdate=w;exports.getAsyncValidatorArray=P;exports.getBy=E;exports.getSyncValidatorArray=$;exports.isGlobalFormValidationError=L;exports.isNonEmptyArray=T;exports.makePathArray=m;exports.mergeOpts=C;exports.setBy=V;exports.throttleFormState=x;exports.uuid=I;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var o=class{constructor(i,s){this.fn=i,this.options=s,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...t)=>{const e=Date.now()-this.lastExecutionTime;if(this.options.leading&&e>=this.options.wait)this.execute(...t);else if(this.lastArgs=t,!this.timeoutId&&this.options.trailing){const h=this.options.wait-e;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},h)}},this.execute=(...t)=>{this.fn(...t),this.options.onExecute?.(t,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function n(i,s){return new o(i,s).maybeExecute}exports.LiteThrottler=o;exports.liteThrottle=n;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./store.js"),o=require("./scheduler.js");class n{constructor(r){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const e=this.options.deps.length,s=new Array(e),t=new Array(e);for(let i=0;i<e;i++){const a=this.options.deps[i];s[i]=a.prevState,t[i]=a.state}return this.lastSeenDepValues=t,{prevDepVals:s,currDepVals:t,prevVal:this.prevState??void 0}},this.recompute=()=>{var e,s;this.prevState=this.state;const t=this.getDepVals();this.state=this.options.fn(t),(s=(e=this.options).onUpdate)==null||s.call(e)},this.checkIfRecalculationNeededDeeply=()=>{for(const i of this.options.deps)i instanceof n&&i.checkIfRecalculationNeededDeeply();let e=!1;const s=this.lastSeenDepValues,{currDepVals:t}=this.getDepVals();for(let i=0;i<t.length;i++)if(t[i]!==s[i]){e=!0;break}e&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const e of this._subscriptions)e()}),this.subscribe=e=>{var s,t;this.listeners.add(e);const i=(t=(s=this.options).onSubscribe)==null?void 0:t.call(s,e,this);return()=>{this.listeners.delete(e),i?.()}},this.options=r,this.state=r.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(r=this.options.deps){for(const e of r)if(e instanceof n)e.registerOnGraph(),this.registerOnGraph(e.options.deps);else if(e instanceof l.Store){let s=o.__storeToDerived.get(e);s||(s=new Set,o.__storeToDerived.set(e,s)),s.add(this);let t=o.__derivedToStore.get(this);t||(t=new Set,o.__derivedToStore.set(this,t)),t.add(e)}}unregisterFromGraph(r=this.options.deps){for(const e of r)if(e instanceof n)this.unregisterFromGraph(e.options.deps);else if(e instanceof l.Store){const s=o.__storeToDerived.get(e);s&&s.delete(this);const t=o.__derivedToStore.get(this);t&&t.delete(e)}}}exports.Derived=n;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./derived.js"),a=new WeakMap,_=new WeakMap,i={current:[]};let u=!1,o=0;const s=new Set,c=new Map;function p(t){const r=Array.from(t).sort((e,n)=>e instanceof d.Derived&&e.options.deps.includes(n)?1:n instanceof d.Derived&&n.options.deps.includes(e)?-1:0);for(const e of r){if(i.current.includes(e))continue;i.current.push(e),e.recompute();const n=_.get(e);if(n)for(const f of n){const l=a.get(f);l&&p(l)}}}function h(t){const r={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(r)}function T(t){const r={prevVal:t.prevState,currentVal:t.state};for(const e of t.listeners)e(r)}function v(t){if(o>0&&!c.has(t)&&c.set(t,t.prevState),s.add(t),!(o>0)&&!u)try{for(u=!0;s.size>0;){const r=Array.from(s);s.clear();for(const e of r){const n=c.get(e)??e.prevState;e.prevState=n,h(e)}for(const e of r){const n=a.get(e);n&&(i.current.push(e),p(n))}for(const e of r){const n=a.get(e);if(n)for(const f of n)T(f)}}}finally{u=!1,i.current=[],c.clear()}}function S(t){o++;try{t()}finally{if(o--,o===0){const r=s.values().next().value;r&&v(r)}}}exports.__depsThatHaveWrittenThisTick=i;exports.__derivedToStore=_;exports.__flush=v;exports.__storeToDerived=a;exports.batch=S;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./scheduler.js"),h=require("./types.js");class r{constructor(t,i){this.listeners=new Set,this.subscribe=s=>{var e,o;this.listeners.add(s);const n=(o=(e=this.options)==null?void 0:e.onSubscribe)==null?void 0:o.call(e,s,this);return()=>{this.listeners.delete(s),n?.()}},this.prevState=t,this.state=t,this.options=i}setState(t){var i,s,e;this.prevState=this.state,(i=this.options)!=null&&i.updateFn?this.state=this.options.updateFn(this.prevState)(t):h.isUpdaterFunction(t)?this.state=t(this.prevState):this.state=t,(e=(s=this.options)==null?void 0:s.onUpdate)==null||e.call(s),l.__flush(this)}}exports.Store=r;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(t){return typeof t=="function"}exports.isUpdaterFunction=e;
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function I(e,o){return typeof e=="function"?e(o):e}function F(e,o){return t=>{o.setState(n=>({...n,[e]:I(t,n[e])}))}}function L(e){return e instanceof Function}function ie(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function re(e,o){const t=[],n=i=>{i.forEach(r=>{t.push(r);const l=o(r);l!=null&&l.length&&n(l)})};return n(e),t}function S(e,o,t){let n=[],i;return r=>{let l;t.key&&t.debug&&(l=Date.now());const u=e(r);if(!(u.length!==n.length||u.some((f,m)=>n[m]!==f)))return i;n=u;let a;if(t.key&&t.debug&&(a=Date.now()),i=o(...u),t==null||t.onChange==null||t.onChange(i),t.key&&t.debug&&t!=null&&t.debug()){const f=Math.round((Date.now()-l)*100)/100,m=Math.round((Date.now()-a)*100)/100,d=m/16,s=(c,p)=>{for(c=String(c);c.length<p;)c=" "+c;return c};console.info(`%c⏱ ${s(m,5)} /${s(f,5)} ms`,`
2
+ font-size: .6rem;
3
+ font-weight: bold;
4
+ color: hsl(${Math.max(0,Math.min(120-120*d,120))}deg 100% 31%);`,t?.key)}return i}}function C(e,o,t,n){return{debug:()=>{var i;return(i=e?.debugAll)!=null?i:e[o]},key:process.env.NODE_ENV==="development"&&t,onChange:n}}function le(e,o,t,n){const i=()=>{var l;return(l=r.getValue())!=null?l:e.options.renderFallbackValue},r={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:i,getContext:S(()=>[e,t,o,r],(l,u,g,a)=>({table:l,column:u,row:g,cell:a,getValue:a.getValue,renderValue:a.renderValue}),C(e.options,"debugCells","cell.getContext"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(r,t,o,e)},{}),r}function se(e,o,t,n){var i,r;const u={...e._getDefaultColumnDef(),...o},g=u.accessorKey;let a=(i=(r=u.id)!=null?r:g?typeof String.prototype.replaceAll=="function"?g.replaceAll(".","_"):g.replace(/\./g,"_"):void 0)!=null?i:typeof u.header=="string"?u.header:void 0,f;if(u.accessorFn?f=u.accessorFn:g&&(g.includes(".")?f=d=>{let s=d;for(const p of g.split(".")){var c;s=(c=s)==null?void 0:c[p],process.env.NODE_ENV!=="production"&&s===void 0&&console.warn(`"${p}" in deeply nested key "${g}" returned undefined.`)}return s}:f=d=>d[u.accessorKey]),!a)throw process.env.NODE_ENV!=="production"?new Error(u.accessorFn?"Columns require an id when using an accessorFn":"Columns require an id when using a non-string header"):new Error;let m={id:`${String(a)}`,accessorFn:f,parent:n,depth:t,columnDef:u,columns:[],getFlatColumns:S(()=>[!0],()=>{var d;return[m,...(d=m.columns)==null?void 0:d.flatMap(s=>s.getFlatColumns())]},C(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:S(()=>[e._getOrderColumnsFn()],d=>{var s;if((s=m.columns)!=null&&s.length){let c=m.columns.flatMap(p=>p.getLeafColumns());return d(c)}return[m]},C(e.options,"debugColumns","column.getLeafColumns"))};for(const d of e._features)d.createColumn==null||d.createColumn(m,e);return m}const _="debugHeaders";function oe(e,o,t){var n;let r={id:(n=t.id)!=null?n:o.id,column:o,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],u=g=>{g.subHeaders&&g.subHeaders.length&&g.subHeaders.map(u),l.push(g)};return u(r),l},getContext:()=>({table:e,header:r,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(r,e)}),r}const ue={createTable:e=>{e.getHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,i)=>{var r,l;const u=(r=n?.map(m=>t.find(d=>d.id===m)).filter(Boolean))!=null?r:[],g=(l=i?.map(m=>t.find(d=>d.id===m)).filter(Boolean))!=null?l:[],a=t.filter(m=>!(n!=null&&n.includes(m.id))&&!(i!=null&&i.includes(m.id)));return G(o,[...u,...a,...g],e)},C(e.options,_,"getHeaderGroups")),e.getCenterHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,i)=>(t=t.filter(r=>!(n!=null&&n.includes(r.id))&&!(i!=null&&i.includes(r.id))),G(o,t,e,"center")),C(e.options,_,"getCenterHeaderGroups")),e.getLeftHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var i;const r=(i=n?.map(l=>t.find(u=>u.id===l)).filter(Boolean))!=null?i:[];return G(o,r,e,"left")},C(e.options,_,"getLeftHeaderGroups")),e.getRightHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var i;const r=(i=n?.map(l=>t.find(u=>u.id===l)).filter(Boolean))!=null?i:[];return G(o,r,e,"right")},C(e.options,_,"getRightHeaderGroups")),e.getFooterGroups=S(()=>[e.getHeaderGroups()],o=>[...o].reverse(),C(e.options,_,"getFooterGroups")),e.getLeftFooterGroups=S(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),C(e.options,_,"getLeftFooterGroups")),e.getCenterFooterGroups=S(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),C(e.options,_,"getCenterFooterGroups")),e.getRightFooterGroups=S(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),C(e.options,_,"getRightFooterGroups")),e.getFlatHeaders=S(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,_,"getFlatHeaders")),e.getLeftFlatHeaders=S(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,_,"getLeftFlatHeaders")),e.getCenterFlatHeaders=S(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,_,"getCenterFlatHeaders")),e.getRightFlatHeaders=S(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,_,"getRightFlatHeaders")),e.getCenterLeafHeaders=S(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,_,"getCenterLeafHeaders")),e.getLeftLeafHeaders=S(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,_,"getLeftLeafHeaders")),e.getRightLeafHeaders=S(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,_,"getRightLeafHeaders")),e.getLeafHeaders=S(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var i,r,l,u,g,a;return[...(i=(r=o[0])==null?void 0:r.headers)!=null?i:[],...(l=(u=t[0])==null?void 0:u.headers)!=null?l:[],...(g=(a=n[0])==null?void 0:a.headers)!=null?g:[]].map(f=>f.getLeafHeaders()).flat()},C(e.options,_,"getLeafHeaders"))}};function G(e,o,t,n){var i,r;let l=0;const u=function(d,s){s===void 0&&(s=1),l=Math.max(l,s),d.filter(c=>c.getIsVisible()).forEach(c=>{var p;(p=c.columns)!=null&&p.length&&u(c.columns,s+1)},0)};u(e);let g=[];const a=(d,s)=>{const c={depth:s,id:[n,`${s}`].filter(Boolean).join("_"),headers:[]},p=[];d.forEach(R=>{const w=[...p].reverse()[0],h=R.column.depth===c.depth;let v,M=!1;if(h&&R.column.parent?v=R.column.parent:(v=R.column,M=!0),w&&w?.column===v)w.subHeaders.push(R);else{const $=oe(t,v,{id:[n,s,v.id,R?.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${p.filter(E=>E.column===v).length}`:void 0,depth:s,index:p.length});$.subHeaders.push(R),p.push($)}c.headers.push(R),R.headerGroup=c}),g.push(c),s>0&&a(p,s-1)},f=o.map((d,s)=>oe(t,d,{depth:l,index:s}));a(f,l-1),g.reverse();const m=d=>d.filter(c=>c.column.getIsVisible()).map(c=>{let p=0,R=0,w=[0];c.subHeaders&&c.subHeaders.length?(w=[],m(c.subHeaders).forEach(v=>{let{colSpan:M,rowSpan:$}=v;p+=M,w.push($)})):p=1;const h=Math.min(...w);return R=R+h,c.colSpan=p,c.rowSpan=R,{colSpan:p,rowSpan:R}});return m((i=(r=g[0])==null?void 0:r.headers)!=null?i:[]),g}const N=(e,o,t,n,i,r,l)=>{let u={id:o,index:n,original:t,depth:i,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:g=>{if(u._valuesCache.hasOwnProperty(g))return u._valuesCache[g];const a=e.getColumn(g);if(a!=null&&a.accessorFn)return u._valuesCache[g]=a.accessorFn(u.original,n),u._valuesCache[g]},getUniqueValues:g=>{if(u._uniqueValuesCache.hasOwnProperty(g))return u._uniqueValuesCache[g];const a=e.getColumn(g);if(a!=null&&a.accessorFn)return a.columnDef.getUniqueValues?(u._uniqueValuesCache[g]=a.columnDef.getUniqueValues(u.original,n),u._uniqueValuesCache[g]):(u._uniqueValuesCache[g]=[u.getValue(g)],u._uniqueValuesCache[g])},renderValue:g=>{var a;return(a=u.getValue(g))!=null?a:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>re(u.subRows,g=>g.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let g=[],a=u;for(;;){const f=a.getParentRow();if(!f)break;g.push(f),a=f}return g.reverse()},getAllCells:S(()=>[e.getAllLeafColumns()],g=>g.map(a=>le(e,u,a,a.id)),C(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:S(()=>[u.getAllCells()],g=>g.reduce((a,f)=>(a[f.column.id]=f,a),{}),C(e.options,"debugRows","getAllCellsByColumnId"))};for(let g=0;g<e._features.length;g++){const a=e._features[g];a==null||a.createRow==null||a.createRow(u,e)}return u},ge={createColumn:(e,o)=>{e._getFacetedRowModel=o.options.getFacetedRowModel&&o.options.getFacetedRowModel(o,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():o.getPreFilteredRowModel(),e._getFacetedUniqueValues=o.options.getFacetedUniqueValues&&o.options.getFacetedUniqueValues(o,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=o.options.getFacetedMinMaxValues&&o.options.getFacetedMinMaxValues(o,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},ae=(e,o,t)=>{var n,i;const r=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((i=e.getValue(o))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(r))};ae.autoRemove=e=>V(e);const de=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};de.autoRemove=e=>V(e);const fe=(e,o,t)=>{var n;return((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===t?.toLowerCase()};fe.autoRemove=e=>V(e);const ce=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};ce.autoRemove=e=>V(e);const pe=(e,o,t)=>!t.some(n=>{var i;return!((i=e.getValue(o))!=null&&i.includes(n))});pe.autoRemove=e=>V(e)||!(e!=null&&e.length);const me=(e,o,t)=>t.some(n=>{var i;return(i=e.getValue(o))==null?void 0:i.includes(n)});me.autoRemove=e=>V(e)||!(e!=null&&e.length);const Se=(e,o,t)=>e.getValue(o)===t;Se.autoRemove=e=>V(e);const Ce=(e,o,t)=>e.getValue(o)==t;Ce.autoRemove=e=>V(e);const Z=(e,o,t)=>{let[n,i]=t;const r=e.getValue(o);return r>=n&&r<=i};Z.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,i=typeof t!="number"?parseFloat(t):t,r=o===null||Number.isNaN(n)?-1/0:n,l=t===null||Number.isNaN(i)?1/0:i;if(r>l){const u=r;r=l,l=u}return[r,l]};Z.autoRemove=e=>V(e)||V(e[0])&&V(e[1]);const P={includesString:ae,includesStringSensitive:de,equalsString:fe,arrIncludes:ce,arrIncludesAll:pe,arrIncludesSome:me,equals:Se,weakEquals:Ce,inNumberRange:Z};function V(e){return e==null||e===""}const Re={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:F("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t?.getValue(e.id);return typeof n=="string"?P.includesString:typeof n=="number"?P.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?P.equals:Array.isArray(n)?P.arrIncludes:P.weakEquals},e.getFilterFn=()=>{var t,n;return L(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=o.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:P[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,i;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=o.options.enableColumnFilters)!=null?n:!0)&&((i=o.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=o.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=o.getState().columnFilters)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const i=e.getFilterFn(),r=n?.find(f=>f.id===e.id),l=I(t,r?r.value:void 0);if(J(i,l,e)){var u;return(u=n?.filter(f=>f.id!==e.id))!=null?u:[]}const g={id:e.id,value:l};if(r){var a;return(a=n?.map(f=>f.id===e.id?g:f))!=null?a:[]}return n!=null&&n.length?[...n,g]:[g]})}},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=i=>{var r;return(r=I(o,i))==null?void 0:r.filter(l=>{const u=t.find(g=>g.id===l.id);if(u){const g=u.getFilterFn();if(J(g,l.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=o=>{var t,n;e.setColumnFilters(o?[]:(t=(n=e.initialState)==null?void 0:n.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function J(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const ze=(e,o,t)=>t.reduce((n,i)=>{const r=i.getValue(e);return n+(typeof r=="number"?r:0)},0),Oe=(e,o,t)=>{let n;return t.forEach(i=>{const r=i.getValue(e);r!=null&&(n>r||n===void 0&&r>=r)&&(n=r)}),n},Be=(e,o,t)=>{let n;return t.forEach(i=>{const r=i.getValue(e);r!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}),n},Te=(e,o,t)=>{let n,i;return t.forEach(r=>{const l=r.getValue(e);l!=null&&(n===void 0?l>=l&&(n=i=l):(n>l&&(n=l),i<l&&(i=l)))}),[n,i]},Ne=(e,o)=>{let t=0,n=0;if(o.forEach(i=>{let r=i.getValue(e);r!=null&&(r=+r)>=r&&(++t,n+=r)}),t)return n/t},qe=(e,o)=>{if(!o.length)return;const t=o.map(r=>r.getValue(e));if(!ie(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),i=t.sort((r,l)=>r-l);return t.length%2!==0?i[n]:(i[n-1]+i[n])/2},ke=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),Ue=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,je=(e,o)=>o.length,z={sum:ze,min:Oe,max:Be,extent:Te,mean:Ne,median:qe,unique:ke,uniqueCount:Ue,count:je},we={getDefaultColumnDef:()=>({aggregatedCell:e=>{var o,t;return(o=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?o:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:F("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,o)=>{e.toggleGrouping=()=>{o.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=o.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t?.getValue(e.id);if(typeof n=="number")return z.sum;if(Object.prototype.toString.call(n)==="[object Date]")return z.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return L(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(n=o.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?t:z[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=o=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(o),e.resetGrouping=o=>{var t,n;e.setGrouping(o?[]:(t=(n=e.initialState)==null?void 0:n.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,o)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=o.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,o,t,n)=>{e.getIsGrouped=()=>o.getIsGrouped()&&o.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&o.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=t.subRows)!=null&&i.length)}}};function he(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(r=>!o.includes(r.id));return t==="remove"?n:[...o.map(r=>e.find(l=>l.id===r)).filter(Boolean),...n]}const ve={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:F("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=S(t=>[D(o,t)],t=>t.findIndex(n=>n.id===e.id),C(o.options,"debugColumns","getIndex")),e.getIsFirstColumn=t=>{var n;return((n=D(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const i=D(o,t);return((n=i[i.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=o=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(o),e.resetColumnOrder=o=>{var t;e.setColumnOrder(o?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=S(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>i=>{let r=[];if(!(o!=null&&o.length))r=i;else{const l=[...o],u=[...i];for(;u.length&&l.length;){const g=l.shift(),a=u.findIndex(f=>f.id===g);a>-1&&r.push(u.splice(a,1)[0])}r=[...r,...u]}return he(r,t,n)},C(e.options,"debugTable","_getOrderColumnsFn"))}},k=()=>({left:[],right:[]}),_e={getInitialState:e=>({columnPinning:k(),...e}),getDefaultOptions:e=>({onColumnPinningChange:F("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns().map(i=>i.id).filter(Boolean);o.setColumnPinning(i=>{var r,l;if(t==="right"){var u,g;return{left:((u=i?.left)!=null?u:[]).filter(m=>!(n!=null&&n.includes(m))),right:[...((g=i?.right)!=null?g:[]).filter(m=>!(n!=null&&n.includes(m))),...n]}}if(t==="left"){var a,f;return{left:[...((a=i?.left)!=null?a:[]).filter(m=>!(n!=null&&n.includes(m))),...n],right:((f=i?.right)!=null?f:[]).filter(m=>!(n!=null&&n.includes(m)))}}return{left:((r=i?.left)!=null?r:[]).filter(m=>!(n!=null&&n.includes(m))),right:((l=i?.right)!=null?l:[]).filter(m=>!(n!=null&&n.includes(m)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var i,r,l;return((i=n.columnDef.enablePinning)!=null?i:!0)&&((r=(l=o.options.enableColumnPinning)!=null?l:o.options.enablePinning)!=null?r:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(u=>u.id),{left:n,right:i}=o.getState().columnPinning,r=t.some(u=>n?.includes(u)),l=t.some(u=>i?.includes(u));return r?"left":l?"right":!1},e.getPinnedIndex=()=>{var t,n;const i=e.getIsPinned();return i?(t=(n=o.getState().columnPinning)==null||(n=n[i])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,o)=>{e.getCenterVisibleCells=S(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,i)=>{const r=[...n??[],...i??[]];return t.filter(l=>!r.includes(l.column.id))},C(o.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=S(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(l=>l.column.id===r)).filter(Boolean).map(r=>({...r,position:"left"})),C(o.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=S(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(l=>l.column.id===r)).filter(Boolean).map(r=>({...r,position:"right"})),C(o.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=o=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(o),e.resetColumnPinning=o=>{var t,n;return e.setColumnPinning(o?k():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:k())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var i,r;return!!((i=n.left)!=null&&i.length||(r=n.right)!=null&&r.length)}return!!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(i=>i.id===n)).filter(Boolean),C(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(i=>i.id===n)).filter(Boolean),C(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const i=[...t??[],...n??[]];return o.filter(r=>!i.includes(r.id))},C(e.options,"debugColumns","getCenterLeafColumns"))}};function Xe(e){return e||(typeof document<"u"?document:null)}const H={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},U=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Fe={getDefaultColumnDef:()=>H,getInitialState:e=>({columnSizing:{},columnSizingInfo:U(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:F("columnSizing",e),onColumnSizingInfoChange:F("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,i;const r=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:H.minSize,(n=r??e.columnDef.size)!=null?n:H.size),(i=e.columnDef.maxSize)!=null?i:H.maxSize)},e.getStart=S(t=>[t,D(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((i,r)=>i+r.getSize(),0),C(o.options,"debugColumns","getStart")),e.getAfter=S(t=>[t,D(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((i,r)=>i+r.getSize(),0),C(o.options,"debugColumns","getAfter")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...i}=t;return i})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=o.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=i=>{if(i.subHeaders.length)i.subHeaders.forEach(n);else{var r;t+=(r=i.column.getSize())!=null?r:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=o.getColumn(e.column.id),i=n?.getCanResize();return r=>{if(!n||!i||(r.persist==null||r.persist(),j(r)&&r.touches&&r.touches.length>1))return;const l=e.getSize(),u=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[n.id,n.getSize()]],g=j(r)?Math.round(r.touches[0].clientX):r.clientX,a={},f=(w,h)=>{typeof h=="number"&&(o.setColumnSizingInfo(v=>{var M,$;const E=o.options.columnResizeDirection==="rtl"?-1:1,ee=(h-((M=v?.startOffset)!=null?M:0))*E,te=Math.max(ee/(($=v?.startSize)!=null?$:0),-.999999);return v.columnSizingStart.forEach(Le=>{let[Ae,ne]=Le;a[Ae]=Math.round(Math.max(ne+ne*te,0)*100)/100}),{...v,deltaOffset:ee,deltaPercentage:te}}),(o.options.columnResizeMode==="onChange"||w==="end")&&o.setColumnSizing(v=>({...v,...a})))},m=w=>f("move",w),d=w=>{f("end",w),o.setColumnSizingInfo(h=>({...h,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},s=Xe(t),c={moveHandler:w=>m(w.clientX),upHandler:w=>{s?.removeEventListener("mousemove",c.moveHandler),s?.removeEventListener("mouseup",c.upHandler),d(w.clientX)}},p={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),m(w.touches[0].clientX),!1),upHandler:w=>{var h;s?.removeEventListener("touchmove",p.moveHandler),s?.removeEventListener("touchend",p.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),d((h=w.touches[0])==null?void 0:h.clientX)}},R=$e()?{passive:!1}:!1;j(r)?(s?.addEventListener("touchmove",p.moveHandler,R),s?.addEventListener("touchend",p.upHandler,R)):(s?.addEventListener("mousemove",c.moveHandler,R),s?.addEventListener("mouseup",c.upHandler,R)),o.setColumnSizingInfo(w=>({...w,startOffset:g,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=o=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(o),e.setColumnSizingInfo=o=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(o),e.resetColumnSizing=o=>{var t;e.setColumnSizing(o?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=o=>{var t;e.setColumnSizingInfo(o?U():(t=e.initialState.columnSizingInfo)!=null?t:U())},e.getTotalSize=()=>{var o,t;return(o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return(o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return(o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return(o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0}}};let A=null;function $e(){if(typeof A=="boolean")return A;let e=!1;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t)}catch{e=!1}return A=e,A}function j(e){return e.type==="touchstart"}const Ve={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:F("columnVisibility",e)}),createColumn:(e,o)=>{e.toggleVisibility=t=>{e.getCanHide()&&o.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const i=e.columns;return(t=i.length?i.some(r=>r.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=o.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,o)=>{e._getAllVisibleCells=S(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),C(o.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=S(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,i)=>[...t,...n,...i],C(o.options,"debugRows","getVisibleCells"))},createTable:e=>{const o=(t,n)=>S(()=>[n(),n().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(r=>r.getIsVisible==null?void 0:r.getIsVisible()),C(e.options,"debugColumns",t));e.getVisibleFlatColumns=o("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=o("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=o("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=o("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=o("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,r)=>({...i,[r.id]:t||!(r.getCanHide!=null&&r.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function D(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Me={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Pe={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:F("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:o=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[o.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,o)=>{e.getCanGlobalFilter=()=>{var t,n,i,r;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=o.options.enableGlobalFilter)!=null?n:!0)&&((i=o.options.enableFilters)!=null?i:!0)&&((r=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?r:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>P.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return L(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:P[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},Ie={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:F("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let o=!1,t=!1;e._autoResetExpanded=()=>{var n,i;if(!o){e._queue(()=>{o=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var i,r;e.setExpanded(n?{}:(i=(r=e.initialState)==null?void 0:r.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(r=>{const l=r.split(".");n=Math.max(n,l.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,o)=>{e.toggleExpanded=t=>{o.setExpanded(n=>{var i;const r=n===!0?!0:!!(n!=null&&n[e.id]);let l={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(u=>{l[u]=!0}):l=n,t=(i=t)!=null?i:!r,!r&&t)return{...l,[e.id]:!0};if(r&&!t){const{[e.id]:u,...g}=l;return g}return n})},e.getIsExpanded=()=>{var t;const n=o.getState().expanded;return!!((t=o.options.getIsRowExpanded==null?void 0:o.options.getIsRowExpanded(e))!=null?t:n===!0||n?.[e.id])},e.getCanExpand=()=>{var t,n,i;return(t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Q=0,W=10,X=()=>({pageIndex:Q,pageSize:W}),xe={getInitialState:e=>({...e,pagination:{...X(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:F("pagination",e)}),createTable:e=>{let o=!1,t=!1;e._autoResetPageIndex=()=>{var n,i;if(!o){e._queue(()=>{o=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const i=r=>I(n,r);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=n=>{var i;e.setPagination(n?X():(i=e.initialState.pagination)!=null?i:X())},e.setPageIndex=n=>{e.setPagination(i=>{let r=I(n,i.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,l)),{...i,pageIndex:r}})},e.resetPageIndex=n=>{var i,r;e.setPageIndex(n?Q:(i=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageIndex)!=null?i:Q)},e.resetPageSize=n=>{var i,r;e.setPageSize(n?W:(i=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageSize)!=null?i:W)},e.setPageSize=n=>{e.setPagination(i=>{const r=Math.max(1,I(n,i.pageSize)),l=i.pageSize*i.pageIndex,u=Math.floor(l/r);return{...i,pageIndex:u,pageSize:r}})},e.setPageCount=n=>e.setPagination(i=>{var r;let l=I(n,(r=e.options.pageCount)!=null?r:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...i,pageCount:l}}),e.getPageOptions=S(()=>[e.getPageCount()],n=>{let i=[];return n&&n>0&&(i=[...new Array(n)].fill(null).map((r,l)=>l)),i},C(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:n<i-1},e.previousPage=()=>e.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},K=()=>({top:[],bottom:[]}),Ee={getInitialState:e=>({rowPinning:K(),...e}),getDefaultOptions:e=>({onRowPinningChange:F("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,i)=>{const r=n?e.getLeafRows().map(g=>{let{id:a}=g;return a}):[],l=i?e.getParentRows().map(g=>{let{id:a}=g;return a}):[],u=new Set([...l,e.id,...r]);o.setRowPinning(g=>{var a,f;if(t==="bottom"){var m,d;return{top:((m=g?.top)!=null?m:[]).filter(p=>!(u!=null&&u.has(p))),bottom:[...((d=g?.bottom)!=null?d:[]).filter(p=>!(u!=null&&u.has(p))),...Array.from(u)]}}if(t==="top"){var s,c;return{top:[...((s=g?.top)!=null?s:[]).filter(p=>!(u!=null&&u.has(p))),...Array.from(u)],bottom:((c=g?.bottom)!=null?c:[]).filter(p=>!(u!=null&&u.has(p)))}}return{top:((a=g?.top)!=null?a:[]).filter(p=>!(u!=null&&u.has(p))),bottom:((f=g?.bottom)!=null?f:[]).filter(p=>!(u!=null&&u.has(p)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:i}=o.options;return typeof n=="function"?n(e):(t=n??i)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:i}=o.getState().rowPinning,r=t.some(u=>n?.includes(u)),l=t.some(u=>i?.includes(u));return r?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const i=e.getIsPinned();if(!i)return-1;const r=(t=i==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t.map(l=>{let{id:u}=l;return u});return(n=r?.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=o=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(o),e.resetRowPinning=o=>{var t,n;return e.setRowPinning(o?K():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:K())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var i,r;return!!((i=n.top)!=null&&i.length||(r=n.bottom)!=null&&r.length)}return!!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(t??[]).map(l=>{const u=e.getRow(l,!0);return u.getIsAllParentsExpanded()?u:null}):(t??[]).map(l=>o.find(u=>u.id===l))).filter(Boolean).map(l=>({...l,position:n}))},e.getTopRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),C(e.options,"debugRows","getTopRows")),e.getBottomRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),C(e.options,"debugRows","getBottomRows")),e.getCenterRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const i=new Set([...t??[],...n??[]]);return o.filter(r=>!i.has(r.id))},C(e.options,"debugRows","getCenterRows"))}},ye={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:F("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=o=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(o),e.resetRowSelection=o=>{var t;return e.setRowSelection(o?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=o=>{e.setRowSelection(t=>{o=typeof o<"u"?o:!e.getIsAllRowsSelected();const n={...t},i=e.getPreGroupedRowModel().flatRows;return o?i.forEach(r=>{r.getCanSelect()&&(n[r.id]=!0)}):i.forEach(r=>{delete n[r.id]}),n})},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),i={...t};return e.getRowModel().rows.forEach(r=>{Y(i,r.id,n,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=S(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?O(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=S(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?O(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=S(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?O(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o.some(i=>i.getCanSelect()&&!t[i.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o.some(i=>!t[i.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var o;const t=Object.keys((o=e.getState().rowSelection)!=null?o:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:o.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>o=>{e.toggleAllRowsSelected(o.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>o=>{e.toggleAllPageRowsSelected(o.target.checked)}},createRow:(e,o)=>{e.toggleSelected=(t,n)=>{const i=e.getIsSelected();o.setRowSelection(r=>{var l;if(t=typeof t<"u"?t:!i,e.getCanSelect()&&i===t)return r;const u={...r};return Y(u,e.id,t,(l=n?.selectChildren)!=null?l:!0,o),u})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return q(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return B(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return B(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var i;t&&e.toggleSelected((i=n.target)==null?void 0:i.checked)}}}},Y=(e,o,t,n,i)=>{var r;const l=i.getRow(o,!0);t?(l.getCanMultiSelect()||Object.keys(e).forEach(u=>delete e[u]),l.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(r=l.subRows)!=null&&r.length&&l.getCanSelectSubRows()&&l.subRows.forEach(u=>Y(e,u.id,t,n,i))};function O(e,o){const t=e.getState().rowSelection,n=[],i={},r=function(l,u){return l.map(g=>{var a;const f=q(g,t);if(f&&(n.push(g),i[g.id]=g),(a=g.subRows)!=null&&a.length&&(g={...g,subRows:r(g.subRows)}),f)return g}).filter(Boolean)};return{rows:r(o.rows),flatRows:n,rowsById:i}}function q(e,o){var t;return(t=o[e.id])!=null?t:!1}function B(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let i=!0,r=!1;return e.subRows.forEach(l=>{if(!(r&&!i)&&(l.getCanSelect()&&(q(l,o)?r=!0:i=!1),l.subRows&&l.subRows.length)){const u=B(l,o);u==="all"?r=!0:(u==="some"&&(r=!0),i=!1)}}),i?"all":r?"some":!1}const T=/([0-9]+)/gm,Ke=(e,o,t)=>De(x(e.getValue(t)).toLowerCase(),x(o.getValue(t)).toLowerCase()),Je=(e,o,t)=>De(x(e.getValue(t)),x(o.getValue(t))),Qe=(e,o,t)=>b(x(e.getValue(t)).toLowerCase(),x(o.getValue(t)).toLowerCase()),We=(e,o,t)=>b(x(e.getValue(t)),x(o.getValue(t))),Ye=(e,o,t)=>{const n=e.getValue(t),i=o.getValue(t);return n>i?1:n<i?-1:0},Ze=(e,o,t)=>b(e.getValue(t),o.getValue(t));function b(e,o){return e===o?0:e>o?1:-1}function x(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function De(e,o){const t=e.split(T).filter(Boolean),n=o.split(T).filter(Boolean);for(;t.length&&n.length;){const i=t.shift(),r=n.shift(),l=parseInt(i,10),u=parseInt(r,10),g=[l,u].sort();if(isNaN(g[0])){if(i>r)return 1;if(r>i)return-1;continue}if(isNaN(g[1]))return isNaN(l)?-1:1;if(l>u)return 1;if(u>l)return-1}return t.length-n.length}const y={alphanumeric:Ke,alphanumericCaseSensitive:Je,text:Qe,textCaseSensitive:We,datetime:Ye,basic:Ze},Ge={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:F("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const i of t){const r=i?.getValue(e.id);if(Object.prototype.toString.call(r)==="[object Date]")return y.datetime;if(typeof r=="string"&&(n=!0,r.split(T).length>1))return y.alphanumeric}return n?y.text:y.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return L(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=o.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:y[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const i=e.getNextSortingOrder(),r=typeof t<"u"&&t!==null;o.setSorting(l=>{const u=l?.find(s=>s.id===e.id),g=l?.findIndex(s=>s.id===e.id);let a=[],f,m=r?t:i==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&n?u?f="toggle":f="add":l!=null&&l.length&&g!==l.length-1?f="replace":u?f="toggle":f="replace",f==="toggle"&&(r||i||(f="remove")),f==="add"){var d;a=[...l,{id:e.id,desc:m}],a.splice(0,a.length-((d=o.options.maxMultiSortColCount)!=null?d:Number.MAX_SAFE_INTEGER))}else f==="toggle"?a=l.map(s=>s.id===e.id?{...s,desc:m}:s):f==="remove"?a=l.filter(s=>s.id!==e.id):a=[{id:e.id,desc:m}];return a})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:o.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,i;const r=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==r&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(i=o.options.enableMultiRemove)!=null)||i)?!1:l==="desc"?"asc":"desc":r},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=o.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:o.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=o.getState().sorting)==null?void 0:t.find(i=>i.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=o.getState().sorting)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?t:-1},e.clearSorting=()=>{o.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{t&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?o.options.isMultiSortEvent==null?void 0:o.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=o=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(o),e.resetSorting=o=>{var t,n;e.setSorting(o?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},be=[ue,Ve,ve,_e,ge,Re,Me,Pe,Ge,we,Ie,xe,Ee,ye,Fe];function et(e){var o,t;process.env.NODE_ENV!=="production"&&(e.debugAll||e.debugTable)&&console.info("Creating Table Instance...");const n=[...be,...(o=e._features)!=null?o:[]];let i={_features:n};const r=i._features.reduce((d,s)=>Object.assign(d,s.getDefaultOptions==null?void 0:s.getDefaultOptions(i)),{}),l=d=>i.options.mergeOptions?i.options.mergeOptions(r,d):{...r,...d};let g={...{},...(t=e.initialState)!=null?t:{}};i._features.forEach(d=>{var s;g=(s=d.getInitialState==null?void 0:d.getInitialState(g))!=null?s:g});const a=[];let f=!1;const m={_features:n,options:{...r,...e},initialState:g,_queue:d=>{a.push(d),f||(f=!0,Promise.resolve().then(()=>{for(;a.length;)a.shift()();f=!1}).catch(s=>setTimeout(()=>{throw s})))},reset:()=>{i.setState(i.initialState)},setOptions:d=>{const s=I(d,i.options);i.options=l(s)},getState:()=>i.options.state,setState:d=>{i.options.onStateChange==null||i.options.onStateChange(d)},_getRowId:(d,s,c)=>{var p;return(p=i.options.getRowId==null?void 0:i.options.getRowId(d,s,c))!=null?p:`${c?[c.id,s].join("."):s}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(d,s)=>{let c=(s?i.getPrePaginationRowModel():i.getRowModel()).rowsById[d];if(!c&&(c=i.getCoreRowModel().rowsById[d],!c))throw process.env.NODE_ENV!=="production"?new Error(`getRow could not find row with ID: ${d}`):new Error;return c},_getDefaultColumnDef:S(()=>[i.options.defaultColumn],d=>{var s;return d=(s=d)!=null?s:{},{header:c=>{const p=c.header.column.columnDef;return p.accessorKey?p.accessorKey:p.accessorFn?p.id:null},cell:c=>{var p,R;return(p=(R=c.renderValue())==null||R.toString==null?void 0:R.toString())!=null?p:null},...i._features.reduce((c,p)=>Object.assign(c,p.getDefaultColumnDef==null?void 0:p.getDefaultColumnDef()),{}),...d}},C(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>i.options.columns,getAllColumns:S(()=>[i._getColumnDefs()],d=>{const s=function(c,p,R){return R===void 0&&(R=0),c.map(w=>{const h=se(i,w,R,p),v=w;return h.columns=v.columns?s(v.columns,h,R+1):[],h})};return s(d)},C(e,"debugColumns","getAllColumns")),getAllFlatColumns:S(()=>[i.getAllColumns()],d=>d.flatMap(s=>s.getFlatColumns()),C(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:S(()=>[i.getAllFlatColumns()],d=>d.reduce((s,c)=>(s[c.id]=c,s),{}),C(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:S(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(d,s)=>{let c=d.flatMap(p=>p.getLeafColumns());return s(c)},C(e,"debugColumns","getAllLeafColumns")),getColumn:d=>{const s=i._getAllFlatColumnsById()[d];return process.env.NODE_ENV!=="production"&&!s&&console.error(`[Table] Column with id '${d}' does not exist.`),s}};Object.assign(i,m);for(let d=0;d<i._features.length;d++){const s=i._features[d];s==null||s.createTable==null||s.createTable(i)}return i}function tt(){return e=>S(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(i,r,l){r===void 0&&(r=0);const u=[];for(let a=0;a<i.length;a++){const f=N(e,e._getRowId(i[a],a,l),i[a],a,r,void 0,l?.id);if(t.flatRows.push(f),t.rowsById[f.id]=f,u.push(f),e.options.getSubRows){var g;f.originalSubRows=e.options.getSubRows(i[a],a),(g=f.originalSubRows)!=null&&g.length&&(f.subRows=n(f.originalSubRows,r+1,f))}}return u};return t.rows=n(o),t},C(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function He(e){const o=[],t=n=>{var i;o.push(n),(i=n.subRows)!=null&&i.length&&n.getIsExpanded()&&n.subRows.forEach(t)};return e.rows.forEach(t),{rows:o,flatRows:e.flatRows,rowsById:e.rowsById}}function nt(e,o,t){return t.options.filterFromLeafRows?ot(e,o,t):it(e,o,t)}function ot(e,o,t){var n;const i=[],r={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,u=function(g,a){a===void 0&&(a=0);const f=[];for(let d=0;d<g.length;d++){var m;let s=g[d];const c=N(t,s.id,s.original,s.index,s.depth,void 0,s.parentId);if(c.columnFilters=s.columnFilters,(m=s.subRows)!=null&&m.length&&a<l){if(c.subRows=u(s.subRows,a+1),s=c,o(s)&&!c.subRows.length){f.push(s),r[s.id]=s,i.push(s);continue}if(o(s)||c.subRows.length){f.push(s),r[s.id]=s,i.push(s);continue}}else s=c,o(s)&&(f.push(s),r[s.id]=s,i.push(s))}return f};return{rows:u(e),flatRows:i,rowsById:r}}function it(e,o,t){var n;const i=[],r={},l=(n=t.options.maxLeafRowFilterDepth)!=null?n:100,u=function(g,a){a===void 0&&(a=0);const f=[];for(let d=0;d<g.length;d++){let s=g[d];if(o(s)){var m;if((m=s.subRows)!=null&&m.length&&a<l){const p=N(t,s.id,s.original,s.index,s.depth,void 0,s.parentId);p.subRows=u(s.subRows,a+1),s=p}f.push(s),i.push(s),r[s.id]=s}}return f};return{rows:u(e),flatRows:i,rowsById:r}}function rt(){return e=>S(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(o,t,n)=>{if(!o.rows.length||!(t!=null&&t.length)&&!n){for(let d=0;d<o.flatRows.length;d++)o.flatRows[d].columnFilters={},o.flatRows[d].columnFiltersMeta={};return o}const i=[],r=[];(t??[]).forEach(d=>{var s;const c=e.getColumn(d.id);if(!c)return;const p=c.getFilterFn();if(!p){process.env.NODE_ENV!=="production"&&console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${c.id}.`);return}i.push({id:d.id,filterFn:p,resolvedValue:(s=p.resolveFilterValue==null?void 0:p.resolveFilterValue(d.value))!=null?s:d.value})});const l=(t??[]).map(d=>d.id),u=e.getGlobalFilterFn(),g=e.getAllLeafColumns().filter(d=>d.getCanGlobalFilter());n&&u&&g.length&&(l.push("__global__"),g.forEach(d=>{var s;r.push({id:d.id,filterFn:u,resolvedValue:(s=u.resolveFilterValue==null?void 0:u.resolveFilterValue(n))!=null?s:n})}));let a,f;for(let d=0;d<o.flatRows.length;d++){const s=o.flatRows[d];if(s.columnFilters={},i.length)for(let c=0;c<i.length;c++){a=i[c];const p=a.id;s.columnFilters[p]=a.filterFn(s,p,a.resolvedValue,R=>{s.columnFiltersMeta[p]=R})}if(r.length){for(let c=0;c<r.length;c++){f=r[c];const p=f.id;if(f.filterFn(s,p,f.resolvedValue,R=>{s.columnFiltersMeta[p]=R})){s.columnFilters.__global__=!0;break}}s.columnFilters.__global__!==!0&&(s.columnFilters.__global__=!1)}}const m=d=>{for(let s=0;s<l.length;s++)if(d.columnFilters[l[s]]===!1)return!1;return!0};return nt(o.rows,m,e)},C(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function lt(e){return o=>S(()=>[o.getState().pagination,o.getPrePaginationRowModel(),o.options.paginateExpandedRows?void 0:o.getState().expanded],(t,n)=>{if(!n.rows.length)return n;const{pageSize:i,pageIndex:r}=t;let{rows:l,flatRows:u,rowsById:g}=n;const a=i*r,f=a+i;l=l.slice(a,f);let m;o.options.paginateExpandedRows?m={rows:l,flatRows:u,rowsById:g}:m=He({rows:l,flatRows:u,rowsById:g}),m.flatRows=[];const d=s=>{m.flatRows.push(s),s.subRows.length&&s.subRows.forEach(d)};return m.rows.forEach(d),m},C(o.options,"debugTable","getPaginationRowModel"))}function st(){return e=>S(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,i=[],r=n.filter(g=>{var a;return(a=e.getColumn(g.id))==null?void 0:a.getCanSort()}),l={};r.forEach(g=>{const a=e.getColumn(g.id);a&&(l[g.id]={sortUndefined:a.columnDef.sortUndefined,invertSorting:a.columnDef.invertSorting,sortingFn:a.getSortingFn()})});const u=g=>{const a=g.map(f=>({...f}));return a.sort((f,m)=>{for(let s=0;s<r.length;s+=1){var d;const c=r[s],p=l[c.id],R=p.sortUndefined,w=(d=c?.desc)!=null?d:!1;let h=0;if(R){const v=f.getValue(c.id),M=m.getValue(c.id),$=v===void 0,E=M===void 0;if($||E){if(R==="first")return $?-1:1;if(R==="last")return $?1:-1;h=$&&E?0:$?R:-R}}if(h===0&&(h=p.sortingFn(f,m,c.id)),h!==0)return w&&(h*=-1),p.invertSorting&&(h*=-1),h}return f.index-m.index}),a.forEach(f=>{var m;i.push(f),(m=f.subRows)!=null&&m.length&&(f.subRows=u(f.subRows))}),a};return{rows:u(t.rows),flatRows:i,rowsById:t.rowsById}},C(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}exports.ColumnFaceting=ge;exports.ColumnFiltering=Re;exports.ColumnGrouping=we;exports.ColumnOrdering=ve;exports.ColumnPinning=_e;exports.ColumnSizing=Fe;exports.ColumnVisibility=Ve;exports.GlobalFaceting=Me;exports.GlobalFiltering=Pe;exports.Headers=ue;exports.RowExpanding=Ie;exports.RowPagination=xe;exports.RowPinning=Ee;exports.RowSelection=ye;exports.RowSorting=Ge;exports._getVisibleLeafColumns=D;exports.aggregationFns=z;exports.buildHeaderGroups=G;exports.createCell=le;exports.createColumn=se;exports.createRow=N;exports.createTable=et;exports.defaultColumnSizing=H;exports.expandRows=He;exports.filterFns=P;exports.flattenBy=re;exports.functionalUpdate=I;exports.getCoreRowModel=tt;exports.getFilteredRowModel=rt;exports.getMemoOptions=C;exports.getPaginationRowModel=lt;exports.getSortedRowModel=st;exports.isFunction=L;exports.isNumberArray=ie;exports.isRowSelected=q;exports.isSubRowSelected=B;exports.makeStateUpdater=F;exports.memo=S;exports.orderColumns=he;exports.passiveEventSupported=$e;exports.reSplitAlphaNumeric=T;exports.selectRowsFn=O;exports.shouldAutoRemoveFilter=J;exports.sortingFns=y;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../../form-core/dist/esm/FieldApi.js"),s=require("../../../vue-store/dist/esm/index.js"),n=require("vue");function l(e){const t=(()=>{const o=new a.FieldApi({...e,form:e.form,name:e.name});return o.Field=u,o})(),i=s.useStore(t.store,d=>d);let r;return n.onMounted(()=>{r=t.mount()}),n.onUnmounted(()=>{r()}),n.watch(()=>e,()=>{t.update({...e,form:e.form})}),{api:t,state:i}}const u=n.defineComponent((e,t)=>{const i=l({...e,...t.attrs});return()=>t.slots.default({field:i.api,state:i.state.value})},{name:"Field",inheritAttrs:!1});exports.Field=u;exports.useField=l;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../../../form-core/dist/esm/FormApi.js"),u=require("../../../vue-store/dist/esm/index.js"),s=require("vue"),l=require("./useField.js");function f(i){const n=(()=>{const t=new m.FormApi(i),o=t;return o.Field=s.defineComponent((e,r)=>()=>s.h(l.Field,{...e,...r.attrs,form:t},r.slots),{name:"APIField",inheritAttrs:!1}),o.useField=e=>l.useField({...e,form:t}),o.useStore=e=>u.useStore(t.store,e),o.Subscribe=s.defineComponent((e,r)=>{const d={...e,...r.attrs}.selector??(c=>c),a=u.useStore(t.store,d);return()=>r.slots.default(a.value)},{name:"Subscribe",inheritAttrs:!1}),o})();return s.onMounted(n.mount),n.update(i),n}exports.useForm=f;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue");function c(t,e=n=>n){const n=s.ref(e(t.state));return s.watch(()=>t,(r,i,a)=>{const l=r.subscribe(()=>{const f=e(r.state);u(s.toRaw(n.value),f)||(n.value=f)});a(()=>{l()})},{immediate:!0}),s.readonly(n)}function u(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,i]of t)if(!e.has(r)||!Object.is(i,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!Object.is(t[n[r]],e[n[r]]))return!1;return!0}exports.shallow=u;exports.useStore=c;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../table-core/build/lib/index.js"),i=require("vue");function d(){return!0}const w=Symbol("merge-proxy"),S={get(t,n,l){return n===w?l:t.get(n)},has(t,n){return t.has(n)},set:d,deleteProperty:d,getOwnPropertyDescriptor(t,n){return{configurable:!0,enumerable:!0,get(){return t.get(n)},set:d,deleteProperty:d}},ownKeys(t){return t.keys()}};function c(t){return"value"in t?t.value:t}function s(){for(var t=arguments.length,n=new Array(t),l=0;l<t;l++)n[l]=arguments[l];return new Proxy({get(o){for(let r=n.length-1;r>=0;r--){const a=c(n[r])[o];if(a!==void 0)return a}},has(o){for(let r=n.length-1;r>=0;r--)if(o in c(n[r]))return!0;return!1},keys(){const o=[];for(let r=0;r<n.length;r++)o.push(...Object.keys(c(n[r])));return[...Array.from(new Set(o))]}},S)}const C=i.defineComponent({props:["render","props"],setup:t=>()=>typeof t.render=="function"||typeof t.render=="object"?i.h(t.render,t.props):t.render});function m(t){return s(t,{data:i.unref(t.data)})}function b(t){const n=i.isRef(t.data),l=s({state:{},onStateChange:()=>{},renderFallbackValue:null,mergeOptions(a,u){return n?{...a,...u}:s(a,u)}},n?m(t):t),o=e.createTable(l);if(n){const a=i.shallowRef(t.data);i.watch(a,()=>{o.setState(u=>({...u,data:a.value}))},{immediate:!0})}const r=i.ref(o.initialState);return i.watchEffect(()=>{o.setOptions(a=>{var u;const f=new Proxy({},{get:(g,R)=>r.value[R]});return s(a,n?m(t):t,{state:s(f,(u=t.state)!=null?u:{}),onStateChange:g=>{g instanceof Function?r.value=g(r.value):r.value=g,t.onStateChange==null||t.onStateChange(g)}})})}),o}exports.ColumnFaceting=e.ColumnFaceting;exports.ColumnFiltering=e.ColumnFiltering;exports.ColumnGrouping=e.ColumnGrouping;exports.ColumnOrdering=e.ColumnOrdering;exports.ColumnPinning=e.ColumnPinning;exports.ColumnSizing=e.ColumnSizing;exports.ColumnVisibility=e.ColumnVisibility;exports.GlobalFaceting=e.GlobalFaceting;exports.GlobalFiltering=e.GlobalFiltering;exports.Headers=e.Headers;exports.RowExpanding=e.RowExpanding;exports.RowPagination=e.RowPagination;exports.RowPinning=e.RowPinning;exports.RowSelection=e.RowSelection;exports.RowSorting=e.RowSorting;exports._getVisibleLeafColumns=e._getVisibleLeafColumns;exports.aggregationFns=e.aggregationFns;exports.buildHeaderGroups=e.buildHeaderGroups;exports.createCell=e.createCell;exports.createColumn=e.createColumn;exports.createRow=e.createRow;exports.createTable=e.createTable;exports.defaultColumnSizing=e.defaultColumnSizing;exports.expandRows=e.expandRows;exports.filterFns=e.filterFns;exports.flattenBy=e.flattenBy;exports.functionalUpdate=e.functionalUpdate;exports.getCoreRowModel=e.getCoreRowModel;exports.getFilteredRowModel=e.getFilteredRowModel;exports.getMemoOptions=e.getMemoOptions;exports.getPaginationRowModel=e.getPaginationRowModel;exports.getSortedRowModel=e.getSortedRowModel;exports.isFunction=e.isFunction;exports.isNumberArray=e.isNumberArray;exports.isRowSelected=e.isRowSelected;exports.isSubRowSelected=e.isSubRowSelected;exports.makeStateUpdater=e.makeStateUpdater;exports.memo=e.memo;exports.orderColumns=e.orderColumns;exports.passiveEventSupported=e.passiveEventSupported;exports.reSplitAlphaNumeric=e.reSplitAlphaNumeric;exports.selectRowsFn=e.selectRowsFn;exports.shouldAutoRemoveFilter=e.shouldAutoRemoveFilter;exports.sortingFns=e.sortingFns;exports.FlexRender=C;exports.useVueTable=b;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@gsc-basic/utils"),e=require("./src/Button.vue.js"),o=t.withInstall(e.default);exports.GscButton=o;
@@ -0,0 +1 @@
1
+ .gsc-btn[data-v-ceb757ec]{height:32px;padding:4px 15px;border-radius:6px;font-size:14px;line-height:22px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;transition:border-color .2s,background-color .2s,color .2s,box-shadow .2s}.gsc-btn[data-v-ceb757ec]:disabled{cursor:not-allowed;opacity:.5}.gsc-btn-default[data-v-ceb757ec]{border:1px solid var(--gsc-basic-border);background:var(--gsc-basic-bg);color:var(--gsc-basic-text-primary)}.gsc-btn-link[data-v-ceb757ec]{border:0;background:transparent;color:var(--gsc-basic-primary);padding:0 4px}.gsc-btn-primary[data-v-ceb757ec]{border:1px solid var(--gsc-basic-primary);background:var(--gsc-basic-primary);color:var(--gsc-basic-bg)}.gsc-btn-danger[data-v-ceb757ec]{border:1px solid var(--gsc-basic-danger);background:var(--gsc-basic-danger);color:var(--gsc-basic-bg)}.gsc-btn-text[data-v-ceb757ec]{border:1px solid transparent;background:transparent;color:var(--gsc-basic-text-secondary);padding:0 8px;height:24px;border-radius:6px;font-size:12px;line-height:22px}.gsc-btn-sm[data-v-ceb757ec]{height:28px;padding:0 10px;font-size:14px;line-height:22px}.gsc-btn-icon[data-v-ceb757ec]{width:32px;padding:0;display:inline-flex;align-items:center;justify-content:center}.gsc-btn-icon-sm[data-v-ceb757ec]{width:24px;padding:0;display:inline-flex;align-items:center;justify-content:center}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./Button2.css');require('./Button.css');const e=require("vue");;/* empty css */;/* empty css */const l=require("../../../_virtual/_plugin-vue_export-helper.js"),o=["disabled","type"],c={__name:"Button",props:{variant:{type:String,default:"default"},size:{type:String,default:""},disabled:{type:Boolean,default:!1},type:{type:String,default:"button"}},emits:["click"],setup(n){const t=n,a=e.computed(()=>{switch(t.variant){case"primary":return"gsc-btn-primary";case"link":return"gsc-btn-link";case"danger":return"gsc-btn-danger";case"text":return"gsc-btn-text";default:return"gsc-btn-default"}}),i=e.computed(()=>t.size?t.size==="sm"?"gsc-btn-sm":t.size==="icon"?"gsc-btn-icon":"":"");return(r,s)=>(e.openBlock(),e.createElementBlock("button",e.mergeProps(r.$attrs,{class:["gsc-btn",a.value,i.value].filter(Boolean).join(" "),disabled:n.disabled||r.$attrs.disabled,type:n.type,onClick:s[0]||(s[0]=u=>r.$emit("click",u))}),[e.renderSlot(r.$slots,"default",{},void 0,!0)],16,o))}},d=l.default(c,[["__scopeId","data-v-ceb757ec"]]);exports.default=d;