@guiexpert/solid-table 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -1,20 +1,254 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ce=(l,e)=>l===e,q=Symbol("solid-proxy"),de={equals:Ce};let ue=fe;const L=1,_=2,pe={owned:null,cleanups:null,context:null,owner:null};var A=null;let Y=null,b=null,x=null,F=null,X=0;function xe(l,e){const t=b,s=A,i=l.length===0,o=e===void 0?s:e,r=i?pe:{owned:null,cleanups:null,context:o?o.context:null,owner:o},n=i?l:()=>l(()=>P(()=>K(r)));A=r,b=null;try{return H(n,!0)}finally{b=t,A=s}}function J(l,e,t){const s=te(l,e,!1,L);W(s)}function Ee(l,e,t){ue=Ie;const s=te(l,e,!1,L);(!t||!t.render)&&(s.user=!0),F?F.push(s):W(s)}function Ae(l,e,t){t=t?Object.assign({},de,t):de;const s=te(l,e,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,W(s),Re.bind(s)}function P(l){if(b===null)return l();const e=b;b=null;try{return l()}finally{b=e}}function Me(l){Ee(()=>P(l))}function Re(){if(this.sources&&this.state)if(this.state===L)W(this);else{const l=x;x=null,H(()=>N(this),!1),x=l}if(b){const l=this.observers?this.observers.length:0;b.sources?(b.sources.push(this),b.sourceSlots.push(l)):(b.sources=[this],b.sourceSlots=[l]),this.observers?(this.observers.push(b),this.observerSlots.push(b.sources.length-1)):(this.observers=[b],this.observerSlots=[b.sources.length-1])}return this.value}function Te(l,e,t){let s=l.value;return(!l.comparator||!l.comparator(s,e))&&(l.value=e,l.observers&&l.observers.length&&H(()=>{for(let i=0;i<l.observers.length;i+=1){const o=l.observers[i],r=Y&&Y.running;r&&Y.disposed.has(o),(r?!o.tState:!o.state)&&(o.pure?x.push(o):F.push(o),o.observers&&Se(o)),r||(o.state=L)}if(x.length>1e6)throw x=[],new Error},!1)),e}function W(l){if(!l.fn)return;K(l);const e=A,t=b,s=X;b=A=l,De(l,l.value,s),b=t,A=e}function De(l,e,t){let s;try{s=l.fn(e)}catch(i){return l.pure&&(l.state=L,l.owned&&l.owned.forEach(K),l.owned=null),l.updatedAt=t+1,ge(i)}(!l.updatedAt||l.updatedAt<=t)&&(l.updatedAt!=null&&"observers"in l?Te(l,s):l.value=s,l.updatedAt=t)}function te(l,e,t,s=L,i){const o={fn:l,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:A,context:A?A.context:null,pure:t};return A===null||A!==pe&&(A.owned?A.owned.push(o):A.owned=[o]),o}function k(l){if(l.state===0)return;if(l.state===_)return N(l);if(l.suspense&&P(l.suspense.inFallback))return l.suspense.effects.push(l);const e=[l];for(;(l=l.owner)&&(!l.updatedAt||l.updatedAt<X);)l.state&&e.push(l);for(let t=e.length-1;t>=0;t--)if(l=e[t],l.state===L)W(l);else if(l.state===_){const s=x;x=null,H(()=>N(l,e[0]),!1),x=s}}function H(l,e){if(x)return l();let t=!1;e||(x=[]),F?t=!0:F=[],X++;try{const s=l();return Oe(t),s}catch(s){t||(F=null),x=null,ge(s)}}function Oe(l){if(x&&(fe(x),x=null),l)return;const e=F;F=null,e.length&&H(()=>ue(e),!1)}function fe(l){for(let e=0;e<l.length;e++)k(l[e])}function Ie(l){let e,t=0;for(e=0;e<l.length;e++){const s=l[e];s.user?l[t++]=s:k(s)}for(e=0;e<t;e++)k(l[e])}function N(l,e){l.state=0;for(let t=0;t<l.sources.length;t+=1){const s=l.sources[t];if(s.sources){const i=s.state;i===L?s!==e&&(!s.updatedAt||s.updatedAt<X)&&k(s):i===_&&N(s,e)}}}function Se(l){for(let e=0;e<l.observers.length;e+=1){const t=l.observers[e];t.state||(t.state=_,t.pure?x.push(t):F.push(t),t.observers&&Se(t))}}function K(l){let e;if(l.sources)for(;l.sources.length;){const t=l.sources.pop(),s=l.sourceSlots.pop(),i=t.observers;if(i&&i.length){const o=i.pop(),r=t.observerSlots.pop();s<i.length&&(o.sourceSlots[r]=s,i[s]=o,t.observerSlots[s]=r)}}if(l.owned){for(e=l.owned.length-1;e>=0;e--)K(l.owned[e]);l.owned=null}if(l.cleanups){for(e=l.cleanups.length-1;e>=0;e--)l.cleanups[e]();l.cleanups=null}l.state=0}function Fe(l){return l instanceof Error?l:new Error(typeof l=="string"?l:"Unknown error",{cause:l})}function ge(l,e=A){throw Fe(l)}function G(){return!0}const Le={get(l,e,t){return e===q?t:l.get(e)},has(l,e){return e===q?!0:l.has(e)},set:G,deleteProperty:G,getOwnPropertyDescriptor(l,e){return{configurable:!0,enumerable:!0,get(){return l.get(e)},set:G,deleteProperty:G}},ownKeys(l){return l.keys()}};function U(l){return(l=typeof l=="function"?l():l)?l:{}}function $e(){for(let l=0,e=this.length;l<e;++l){const t=this[l]();if(t!==void 0)return t}}function me(...l){let e=!1;for(let o=0;o<l.length;o++){const r=l[o];e=e||!!r&&q in r,l[o]=typeof r=="function"?(e=!0,Ae(r)):r}if(e)return new Proxy({get(o){for(let r=l.length-1;r>=0;r--){const n=U(l[r])[o];if(n!==void 0)return n}},has(o){for(let r=l.length-1;r>=0;r--)if(o in U(l[r]))return!0;return!1},keys(){const o=[];for(let r=0;r<l.length;r++)o.push(...Object.keys(U(l[r])));return[...new Set(o)]}},Le);const t={},s={},i=new Set;for(let o=l.length-1;o>=0;o--){const r=l[o];if(!r)continue;const n=Object.getOwnPropertyNames(r);for(let a=0,h=n.length;a<h;a++){const d=n[a];if(d==="__proto__"||d==="constructor")continue;const c=Object.getOwnPropertyDescriptor(r,d);if(!i.has(d))c.get?(i.add(d),Object.defineProperty(t,d,{enumerable:!0,configurable:!0,get:$e.bind(s[d]=[c.get.bind(r)])})):(c.value!==void 0&&i.add(d),t[d]=c.value);else{const p=s[d];p?c.get?p.push(c.get.bind(r)):c.value!==void 0&&p.push(()=>c.value):t[d]===void 0&&(t[d]=c.value)}}}return t}function Be(l,e,t){let s=t.length,i=e.length,o=s,r=0,n=0,a=e[i-1].nextSibling,h=null;for(;r<i||n<o;){if(e[r]===t[n]){r++,n++;continue}for(;e[i-1]===t[o-1];)i--,o--;if(i===r){const d=o<s?n?t[n-1].nextSibling:t[o-n]:a;for(;n<o;)l.insertBefore(t[n++],d)}else if(o===n)for(;r<i;)(!h||!h.has(e[r]))&&e[r].remove(),r++;else if(e[r]===t[o-1]&&t[n]===e[i-1]){const d=e[--i].nextSibling;l.insertBefore(t[n++],e[r++].nextSibling),l.insertBefore(t[--o],d),e[i]=t[o]}else{if(!h){h=new Map;let c=n;for(;c<o;)h.set(t[c],c++)}const d=h.get(e[r]);if(d!=null)if(n<d&&d<o){let c=r,p=1,g;for(;++c<i&&c<o&&!((g=h.get(e[c]))==null||g!==d+p);)p++;if(p>d-n){const u=e[r];for(;n<d;)l.insertBefore(t[n++],u)}else l.replaceChild(t[n++],e[r++])}else r++;else e[r++].remove()}}}function Pe(l,e,t,s={}){let i;return xe(o=>{i=o,e===document?l():Ve(e,l(),e.firstChild?null:void 0,t)},s.owner),()=>{i(),e.textContent=""}}function We(l,e,t){let s;const i=()=>{const r=document.createElement("template");return r.innerHTML=l,t?r.content.firstChild.firstChild:r.content.firstChild},o=e?()=>P(()=>document.importNode(s||(s=i()),!0)):()=>(s||(s=i())).cloneNode(!0);return o.cloneNode=o,o}function He(l,e,t){return P(()=>l(e,t))}function Ve(l,e,t,s){if(t!==void 0&&!s&&(s=[]),typeof e!="function")return j(l,e,s,t);J(i=>j(l,e(),i,t),s)}function j(l,e,t,s,i){for(;typeof t=="function";)t=t();if(e===t)return t;const o=typeof e,r=s!==void 0;if(l=r&&t[0]&&t[0].parentNode||l,o==="string"||o==="number")if(o==="number"&&(e=e.toString()),r){let n=t[0];n&&n.nodeType===3?n.data=e:n=document.createTextNode(e),t=B(l,t,s,n)}else t!==""&&typeof t=="string"?t=l.firstChild.data=e:t=l.textContent=e;else if(e==null||o==="boolean")t=B(l,t,s);else{if(o==="function")return J(()=>{let n=e();for(;typeof n=="function";)n=n();t=j(l,n,t,s)}),()=>t;if(Array.isArray(e)){const n=[],a=t&&Array.isArray(t);if(Q(n,e,t,i))return J(()=>t=j(l,n,t,s,!0)),()=>t;if(n.length===0){if(t=B(l,t,s),r)return t}else a?t.length===0?he(l,n,s):Be(l,t,n):(t&&B(l),he(l,n));t=n}else if(e.nodeType){if(Array.isArray(t)){if(r)return t=B(l,t,s,e);B(l,t,null,e)}else t==null||t===""||!l.firstChild?l.appendChild(e):l.replaceChild(e,l.firstChild);t=e}}return t}function Q(l,e,t,s){let i=!1;for(let o=0,r=e.length;o<r;o++){let n=e[o],a=t&&t[o],h;if(!(n==null||n===!0||n===!1))if((h=typeof n)=="object"&&n.nodeType)l.push(n);else if(Array.isArray(n))i=Q(l,n,a)||i;else if(h==="function")if(s){for(;typeof n=="function";)n=n();i=Q(l,Array.isArray(n)?n:[n],Array.isArray(a)?a:[a])||i}else l.push(n),i=!0;else{const d=String(n);a&&a.nodeType===3&&a.data===d?l.push(a):l.push(document.createTextNode(d))}}return i}function he(l,e,t=null){for(let s=0,i=e.length;s<i;s++)l.insertBefore(e[s],t)}function B(l,e,t,s){if(t===void 0)return l.textContent="";const i=s||document.createTextNode("");if(e.length){let o=!1;for(let r=e.length-1;r>=0;r--){const n=e[r];if(i!==n){const a=n.parentNode===l;!o&&!r?a?l.replaceChild(i,n):l.insertBefore(i,t):a&&n.remove()}else o=!0}}else l.insertBefore(i,t);return[i]}class Ge{constructor(e){this.code=e}render(e,t,s,i,o,r,n){const a=me({rowIndex:t,columnIndex:s,areaIdent:i,areaModel:o,cellValue:r});Pe(()=>this.code(a),e)}}const _e=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Z(l){return l&&l.type==="TreeRow"}function ee(l){return l&&l.type==="AreaModelTree"}class se{constructor(e=-1,t=-1,s=-1,i=-1,o,r,n,a=0,h=0,d=0,c=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=i,this.areaIdent=o,this.sideIdent=r,this.originalEvent=n,this.clickCount=a,this.draggingX=h,this.draggingY=d,this.action=c}clone(){return new se(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class ${constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class be{constructor(e=new $(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new $(">","",["ge-table-tree-arrow-collapsed"]),s=new $(">","color:transparent;",["gt-table-tree-arrow-hidden"]),i=new $("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=i}}class ye{constructor(e=new $("↑","",["ge-header-sorted-asc"]),t=new $("↓","",["ge-header-sorted-desc"]),s=new $("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class ke{constructor(e){this.domService=e}setStyle(e,t,s){return this.domService.setStyle(e,t,s),e}applyStyle(e,t){for(const s in t)this.domService.setStyle(e,s,t[s]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([s,i])=>this.domService.setStyle(e,s,i+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",s){return this.domService.setStyle(s,"overflow-x",e),this.domService.setStyle(s,"overflow-y",t),s}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const s=this.domService.createText(t);return this.domService.appendChild(e,s),s}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.addClass(t,s)):this.domService.addClass(t,e),t}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.removeClass(t,s)):this.domService.removeClass(t,e),t}addClasses(e,t){if(e)for(const s of e)this.domService.addClass(t,s);return t}setAttribute(e,t,s){return t&&s&&this.domService.setAttribute(e,t,s),e}createAreaDivWithClass(e,t,s,i){const o=this.domService.createElement("div");return this.addClass(e,o),this.domService.setAttribute(o,"data-area",s),this.domService.setAttribute(o,"data-side",i),this.domService.appendChild(t,o),o}createDivWithClass(e,t){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.appendChild(t,s),s}addRowDiv(e,t,s=-1,i,o,r=""){const n=t.index??-1,a=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(a,"ge-table-row-div"),this.domService.addClass(a,`ge-table-row-div-${t.index}`),i==="body"&&o==="center"){const h=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${h}`)}if(this.domService.setStyle(a,"display","clip"),this.domService.setStyle(a,"position","absolute"),this.domService.setStyle(a,"left",`${t.left}px`),this.domService.setStyle(a,"top",`${t.top}px`),this.domService.setStyle(a,"width",`${t.width}px`),this.domService.setStyle(a,"height",`${t.height}px`),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-area",`${i}`),r){const h=this.domService.createText(r);this.domService.appendChild(a,h)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e,t,s=-1,i=-1,o,r,n="",a,h,d=void 0,c){const p=h==null?void 0:h.treeOptions,g=h==null?void 0:h.showCheckboxWihoutExtraColumn,u=this.domService.createElement("div");this.domService.addClass(u,"ge-table-col-div"),this.domService.addClass(u,`ge-table-col-div-${t.index}`),this.domService.setAttribute(u,"data-col-index",`${t.index}`),this.domService.setAttribute(u,"data-row-index",`${s}`),this.domService.setAttribute(u,"data-area",`${o}`);const m=((t==null?void 0:t.index)??0)%2===0?"even":"odd";if(o==="body"&&r==="center"&&this.domService.addClass(u,`ge-table-column-${m}`),this.domService.setStyle(u,"display","clip"),this.domService.setStyle(u,"position","absolute"),this.domService.setStyle(u,"left",`${t.left}px`),this.domService.setStyle(u,"top",`${t.top}px`),this.domService.setStyle(u,"width",`${t.width}px`),this.domService.setStyle(u,"height",`${t.height}px`),a&&a!=="none"&&(this.domService.addClass(u,"ge-table-col-tree"),this.addArrowDiv(u,a,p,s,i,o)),g&&i===0&&d&&this.addCheckboxToDiv(u,d,o,s),n){const S=a!=="none"&&i===0;this.addLabelDiv(u,n,S,s,i,o)}return c&&this.addSortedIcon(u,c,h==null?void 0:h.sortedOptions,i),this.domService.appendChild(e,u),u}addCheckboxToDiv(e,t,s,i){const o=this.domService.createElement("div"),r=t==="full"?"checked":"";return o.innerHTML=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const De=(r,e)=>r===e,te=Symbol("solid-proxy"),ue={equals:De};let me=ve;const L=1,N=2,ye={owned:null,cleanups:null,context:null,owner:null};var R=null;let Z=null,w=null,M=null,F=null,q=0;function ke(r,e){const t=w,s=R,o=r.length===0,i=e===void 0?s:e,l=o?ye:{owned:null,cleanups:null,context:i?i.context:null,owner:i},n=o?r:()=>r(()=>H(()=>J(l)));R=l,w=null;try{return G(n,!0)}finally{w=t,R=s}}function se(r,e,t){const s=re(r,e,!1,L);W(s)}function Oe(r,e,t){me=He;const s=re(r,e,!1,L);(!t||!t.render)&&(s.user=!0),F?F.push(s):W(s)}function Ie(r,e,t){t=t?Object.assign({},ue,t):ue;const s=re(r,e,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=t.equals||void 0,W(s),Le.bind(s)}function H(r){if(w===null)return r();const e=w;w=null;try{return r()}finally{w=e}}function Fe(r){Oe(()=>H(r))}function Le(){if(this.sources&&this.state)if(this.state===L)W(this);else{const r=M;M=null,G(()=>j(this),!1),M=r}if(w){const r=this.observers?this.observers.length:0;w.sources?(w.sources.push(this),w.sourceSlots.push(r)):(w.sources=[this],w.sourceSlots=[r]),this.observers?(this.observers.push(w),this.observerSlots.push(w.sources.length-1)):(this.observers=[w],this.observerSlots=[w.sources.length-1])}return this.value}function $e(r,e,t){let s=r.value;return(!r.comparator||!r.comparator(s,e))&&(r.value=e,r.observers&&r.observers.length&&G(()=>{for(let o=0;o<r.observers.length;o+=1){const i=r.observers[o],l=Z&&Z.running;l&&Z.disposed.has(i),(l?!i.tState:!i.state)&&(i.pure?M.push(i):F.push(i),i.observers&&we(i)),l||(i.state=L)}if(M.length>1e6)throw M=[],new Error},!1)),e}function W(r){if(!r.fn)return;J(r);const e=q;Be(r,r.value,e)}function Be(r,e,t){let s;const o=R,i=w;w=R=r;try{s=r.fn(e)}catch(l){return r.pure&&(r.state=L,r.owned&&r.owned.forEach(J),r.owned=null),r.updatedAt=t+1,Ce(l)}finally{w=i,R=o}(!r.updatedAt||r.updatedAt<=t)&&(r.updatedAt!=null&&"observers"in r?$e(r,s):r.value=s,r.updatedAt=t)}function re(r,e,t,s=L,o){const i={fn:r,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:R,context:R?R.context:null,pure:t};return R===null||R!==ye&&(R.owned?R.owned.push(i):R.owned=[i]),i}function z(r){if(r.state===0)return;if(r.state===N)return j(r);if(r.suspense&&H(r.suspense.inFallback))return r.suspense.effects.push(r);const e=[r];for(;(r=r.owner)&&(!r.updatedAt||r.updatedAt<q);)r.state&&e.push(r);for(let t=e.length-1;t>=0;t--)if(r=e[t],r.state===L)W(r);else if(r.state===N){const s=M;M=null,G(()=>j(r,e[0]),!1),M=s}}function G(r,e){if(M)return r();let t=!1;e||(M=[]),F?t=!0:F=[],q++;try{const s=r();return Pe(t),s}catch(s){t||(F=null),M=null,Ce(s)}}function Pe(r){if(M&&(ve(M),M=null),r)return;const e=F;F=null,e.length&&G(()=>me(e),!1)}function ve(r){for(let e=0;e<r.length;e++)z(r[e])}function He(r){let e,t=0;for(e=0;e<r.length;e++){const s=r[e];s.user?r[t++]=s:z(s)}for(e=0;e<t;e++)z(r[e])}function j(r,e){r.state=0;for(let t=0;t<r.sources.length;t+=1){const s=r.sources[t];if(s.sources){const o=s.state;o===L?s!==e&&(!s.updatedAt||s.updatedAt<q)&&z(s):o===N&&j(s,e)}}}function we(r){for(let e=0;e<r.observers.length;e+=1){const t=r.observers[e];t.state||(t.state=N,t.pure?M.push(t):F.push(t),t.observers&&we(t))}}function J(r){let e;if(r.sources)for(;r.sources.length;){const t=r.sources.pop(),s=r.sourceSlots.pop(),o=t.observers;if(o&&o.length){const i=o.pop(),l=t.observerSlots.pop();s<o.length&&(i.sourceSlots[l]=s,o[s]=i,t.observerSlots[s]=l)}}if(r.owned){for(e=r.owned.length-1;e>=0;e--)J(r.owned[e]);r.owned=null}if(r.cleanups){for(e=r.cleanups.length-1;e>=0;e--)r.cleanups[e]();r.cleanups=null}r.state=0}function We(r){return r instanceof Error?r:new Error(typeof r=="string"?r:"Unknown error",{cause:r})}function Ce(r,e=R){throw We(r)}function V(){return!0}const Ge={get(r,e,t){return e===te?t:r.get(e)},has(r,e){return e===te?!0:r.has(e)},set:V,deleteProperty:V,getOwnPropertyDescriptor(r,e){return{configurable:!0,enumerable:!0,get(){return r.get(e)},set:V,deleteProperty:V}},ownKeys(r){return r.keys()}};function ee(r){return(r=typeof r=="function"?r():r)?r:{}}function _e(){for(let r=0,e=this.length;r<e;++r){const t=this[r]();if(t!==void 0)return t}}function xe(...r){let e=!1;for(let i=0;i<r.length;i++){const l=r[i];e=e||!!l&&te in l,r[i]=typeof l=="function"?(e=!0,Ie(l)):l}if(e)return new Proxy({get(i){for(let l=r.length-1;l>=0;l--){const n=ee(r[l])[i];if(n!==void 0)return n}},has(i){for(let l=r.length-1;l>=0;l--)if(i in ee(r[l]))return!0;return!1},keys(){const i=[];for(let l=0;l<r.length;l++)i.push(...Object.keys(ee(r[l])));return[...new Set(i)]}},Ge);const t={},s={},o=new Set;for(let i=r.length-1;i>=0;i--){const l=r[i];if(!l)continue;const n=Object.getOwnPropertyNames(l);for(let a=0,c=n.length;a<c;a++){const d=n[a];if(d==="__proto__"||d==="constructor")continue;const h=Object.getOwnPropertyDescriptor(l,d);if(!o.has(d))h.get?(o.add(d),Object.defineProperty(t,d,{enumerable:!0,configurable:!0,get:_e.bind(s[d]=[h.get.bind(l)])})):(h.value!==void 0&&o.add(d),t[d]=h.value);else{const g=s[d];g?h.get?g.push(h.get.bind(l)):h.value!==void 0&&g.push(()=>h.value):t[d]===void 0&&(t[d]=h.value)}}}return t}function Ve(r,e,t){let s=t.length,o=e.length,i=s,l=0,n=0,a=e[o-1].nextSibling,c=null;for(;l<o||n<i;){if(e[l]===t[n]){l++,n++;continue}for(;e[o-1]===t[i-1];)o--,i--;if(o===l){const d=i<s?n?t[n-1].nextSibling:t[i-n]:a;for(;n<i;)r.insertBefore(t[n++],d)}else if(i===n)for(;l<o;)(!c||!c.has(e[l]))&&e[l].remove(),l++;else if(e[l]===t[i-1]&&t[n]===e[o-1]){const d=e[--o].nextSibling;r.insertBefore(t[n++],e[l++].nextSibling),r.insertBefore(t[--i],d),e[o]=t[i]}else{if(!c){c=new Map;let h=n;for(;h<i;)c.set(t[h],h++)}const d=c.get(e[l]);if(d!=null)if(n<d&&d<i){let h=l,g=1,f;for(;++h<o&&h<i&&!((f=c.get(e[h]))==null||f!==d+g);)g++;if(g>d-n){const b=e[l];for(;n<d;)r.insertBefore(t[n++],b)}else r.replaceChild(t[n++],e[l++])}else l++;else e[l++].remove()}}}function Ne(r,e,t,s={}){let o;return ke(i=>{o=i,e===document?r():Xe(e,r(),e.firstChild?null:void 0,t)},s.owner),()=>{o(),e.textContent=""}}function ze(r,e,t){let s;const o=()=>{const l=document.createElement("template");return l.innerHTML=r,t?l.content.firstChild.firstChild:l.content.firstChild},i=e?()=>H(()=>document.importNode(s||(s=o()),!0)):()=>(s||(s=o())).cloneNode(!0);return i.cloneNode=i,i}function je(r,e,t){return H(()=>r(e,t))}function Xe(r,e,t,s){if(t!==void 0&&!s&&(s=[]),typeof e!="function")return X(r,e,s,t);se(o=>X(r,e(),o,t),s)}function X(r,e,t,s,o){for(;typeof t=="function";)t=t();if(e===t)return t;const i=typeof e,l=s!==void 0;if(r=l&&t[0]&&t[0].parentNode||r,i==="string"||i==="number")if(i==="number"&&(e=e.toString()),l){let n=t[0];n&&n.nodeType===3?n.data=e:n=document.createTextNode(e),t=B(r,t,s,n)}else t!==""&&typeof t=="string"?t=r.firstChild.data=e:t=r.textContent=e;else if(e==null||i==="boolean")t=B(r,t,s);else{if(i==="function")return se(()=>{let n=e();for(;typeof n=="function";)n=n();t=X(r,n,t,s)}),()=>t;if(Array.isArray(e)){const n=[],a=t&&Array.isArray(t);if(oe(n,e,t,o))return se(()=>t=X(r,n,t,s,!0)),()=>t;if(n.length===0){if(t=B(r,t,s),l)return t}else a?t.length===0?pe(r,n,s):Ve(r,t,n):(t&&B(r),pe(r,n));t=n}else if(e.nodeType){if(Array.isArray(t)){if(l)return t=B(r,t,s,e);B(r,t,null,e)}else t==null||t===""||!r.firstChild?r.appendChild(e):r.replaceChild(e,r.firstChild);t=e}}return t}function oe(r,e,t,s){let o=!1;for(let i=0,l=e.length;i<l;i++){let n=e[i],a=t&&t[i],c;if(!(n==null||n===!0||n===!1))if((c=typeof n)=="object"&&n.nodeType)r.push(n);else if(Array.isArray(n))o=oe(r,n,a)||o;else if(c==="function")if(s){for(;typeof n=="function";)n=n();o=oe(r,Array.isArray(n)?n:[n],Array.isArray(a)?a:[a])||o}else r.push(n),o=!0;else{const d=String(n);a&&a.nodeType===3&&a.data===d?r.push(a):r.push(document.createTextNode(d))}}return o}function pe(r,e,t=null){for(let s=0,o=e.length;s<o;s++)r.insertBefore(e[s],t)}function B(r,e,t,s){if(t===void 0)return r.textContent="";const o=s||document.createTextNode("");if(e.length){let i=!1;for(let l=e.length-1;l>=0;l--){const n=e[l];if(o!==n){const a=n.parentNode===r;!i&&!l?a?r.replaceChild(o,n):r.insertBefore(o,t):a&&n.remove()}else i=!0}}else r.insertBefore(o,t);return[o]}class Ke{constructor(e){this.code=e}render(e,t,s,o,i,l,n){const a=xe({rowIndex:t,columnIndex:s,areaIdent:o,areaModel:i,cellValue:l});Ne(()=>this.code(a),e)}}const Ye=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class ${constructor(){this.alreadySet=!1}static getInstance(){return $.instance||($.instance=new $),$.instance}setLicenseKey(e){if(e&&!this.alreadySet){const t=document.createElement("meta");t.content="license="+e,t.name="guiexperttable",document.getElementsByTagName("head")[0].appendChild(t),this.alreadySet=!0}}}function ie(r){return r&&r.type==="TreeRow"}function le(r){return r&&r.type==="AreaModelTree"}class ne{constructor(e=-1,t=-1,s=-1,o=-1,i,l,n,a=0,c=0,d=0,h=""){this.rowIndex=e,this.rowTop=t,this.columnIndex=s,this.columnLeft=o,this.areaIdent=i,this.sideIdent=l,this.originalEvent=n,this.clickCount=a,this.draggingX=c,this.draggingY=d,this.action=h}clone(){return new ne(this.rowIndex,this.rowTop,this.columnIndex,this.columnLeft,this.areaIdent,this.sideIdent,this.originalEvent,this.clickCount,this.draggingX,this.draggingY,this.action)}}class I{constructor(e=">",t="",s=[]){this.content=e,this.style=t,this.classes=s}}class Ee{constructor(e=new I(">","transform: rotate(90deg) translate(66%, -66%); transform-origin: 0 0;",["gt-table-tree-arrow-expanded"]),t=new I(">","",["ge-table-tree-arrow-collapsed"]),s=new I(">","color:transparent;",["gt-table-tree-arrow-hidden"]),o=new I("↕","",["gt-table-tree-arrow-expanded-all"])){this.arrowExpanded=e,this.arrowCollapsed=t,this.arrowPlaceholder=s,this.arrowExpandCollapseAll=o}}class Ae{constructor(e=new I("↑","",["ge-header-sorted-asc"]),t=new I("↓","",["ge-header-sorted-desc"]),s=new I("↑","color:transparent;",[])){this.iconAsc=e,this.iconDesc=t,this.iconPlaceholder=s}}class Ue{constructor(e){this.domService=e}setStyle(e,t,s){return this.domService.setStyle(e,t,s),e}applyStyle(e,t){for(const s in t)this.domService.setStyle(e,s,t[s]);return e}applyDisplayNoneStyle(e){return this.domService.setStyle(e,"display","none"),e}applyDisplayBlockStyle(e){return this.domService.setStyle(e,"display","block"),e}applyStyleInPx(e,t){return Object.entries(t).forEach(([s,o])=>this.domService.setStyle(e,s,o+"px")),e}applyStylePosistionRelative(e){return this.domService.setStyle(e,"position","relative"),this.domService.setStyle(e,"overflow","clip"),e}applyStylePosistionAbsolute(e){return this.domService.setStyle(e,"position","absolute"),e}applyStyleFullSize(e){return this.domService.setStyle(e,"width","100%"),this.domService.setStyle(e,"height","100%"),e}applyStyleOverflowAuto(e="auto",t="auto",s){return this.domService.setStyle(s,"overflow-x",e),this.domService.setStyle(s,"overflow-y",t),s}applyStyleNoPadding(e){return this.domService.setStyle(e,"padding","0"),this.domService.setStyle(e,"margin","0"),this.domService.setStyle(e,"border","0"),e}appendRelativeChildDiv(e){const t=this.applyStylePosistionRelative(this.applyStyleFullSize(this.applyStyleNoPadding(this.domService.createElement("div"))));return this.domService.appendChild(e,t),this.applyStylePosistionAbsolute(e),{parent:e,child:t,cache:{}}}appendText(e,t){const s=this.domService.createText(t);return this.domService.appendChild(e,s),s}addClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.addClass(t,s)):this.domService.addClass(t,e),t}removeClass(e,t){return e.includes(" ")?e.split(" ").forEach(s=>this.domService.removeClass(t,s)):this.domService.removeClass(t,e),t}addClasses(e,t){if(e)for(const s of e)this.domService.addClass(t,s);return t}setAttribute(e,t,s){return t&&s&&this.domService.setAttribute(e,t,s),e}createAreaDivWithClass(e,t,s,o){const i=this.domService.createElement("div");return this.addClass(e,i),this.domService.setAttribute(i,"data-area",s),this.domService.setAttribute(i,"data-side",o),this.domService.appendChild(t,i),i}createDivWithClass(e,t){const s=this.domService.createElement("div");return this.addClass(e,s),this.domService.appendChild(t,s),s}addRowDiv(e,t,s=-1,o,i,l=""){const n=t.index??-1,a=this.getDivOrCreateDiv(n,e);if(this.domService.addClass(a,"ge-table-row-div"),this.domService.addClass(a,`ge-table-row-div-${t.index}`),o==="body"&&i==="center"){const c=((t==null?void 0:t.index)??0)%2===0?"even":"odd";this.domService.addClass(a,`ge-table-row-${c}`)}if(this.domService.setStyle(a,"display","clip"),this.domService.setStyle(a,"position","absolute"),this.domService.setStyle(a,"left",`${t.left}px`),this.domService.setStyle(a,"top",`${t.top}px`),this.domService.setStyle(a,"width",`${t.width}px`),this.domService.setStyle(a,"height",`${t.height}px`),this.domService.setAttribute(a,"data-row-index",`${s}`),this.domService.setAttribute(a,"data-area",`${o}`),l){const c=this.domService.createText(l);this.domService.appendChild(a,c)}return this.domService.appendChild(e.child,a),a}addColumnDiv(e){const{parent:t,geo:s,rowIndex:o=-1,columnIndex:i=-1,areaIdent:l,sideIdent:n,text:a="",treeArrow:c,tableOptions:d,checkedType:h=void 0,sortState:g}=e,f=d==null?void 0:d.treeOptions,b=d==null?void 0:d.showCheckboxWihoutExtraColumn,S=this.domService.createElement("div");this.domService.addClass(S,"ge-table-col-div"),this.domService.addClass(S,`ge-table-col-div-${s.index}`),this.domService.setAttribute(S,"data-col-index",`${s.index}`),this.domService.setAttribute(S,"data-row-index",`${o}`),this.domService.setAttribute(S,"data-area",`${l}`);const p=((s==null?void 0:s.index)??0)%2===0?"even":"odd";if(l==="body"&&n==="center"&&this.domService.addClass(S,`ge-table-column-${p}`),this.domService.setStyle(S,"display","clip"),this.domService.setStyle(S,"position","absolute"),this.domService.setStyle(S,"left",`${s.left}px`),this.domService.setStyle(S,"top",`${s.top}px`),this.domService.setStyle(S,"width",`${s.width}px`),this.domService.setStyle(S,"height",`${s.height}px`),c&&c!=="none"&&(this.domService.addClass(S,"ge-table-col-tree"),this.addArrowDiv(S,c,f,o,i,l)),b&&i===0&&h&&this.addCheckboxToDiv(S,h,l,o),a){const u=c!=="none"&&i===0;this.addLabelDiv(S,a,u,o,i,l)}return g&&this.addSortedIcon(S,g,d==null?void 0:d.sortedOptions,i),this.domService.appendChild(t,S),S}addCheckboxToDiv(e,t,s,o){const i=this.domService.createElement("div"),l=t==="full"?"checked":"";return i.innerHTML=`
2
2
  <input
3
3
  type="checkbox"
4
4
  data-area="${s}"
5
- data-row-index="${i}"
5
+ data-row-index="${o}"
6
6
  data-input-type="checkbox"
7
- ${r}
8
- class="ge-table-row-checkbox"> `,this.domService.setStyle(o,"display","inline"),this.domService.setStyle(o,"width","inherit"),this.domService.setAttribute(o,"data-row-index",`${i}`),this.domService.appendChild(e,o),o}addLabelDiv(e,t="",s=!1,i=-1,o=-1,r="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${i}`),this.domService.setAttribute(n,"data-col-index",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`),t)if(s){const a=this.domService.createText(t);this.domService.appendChild(n,a)}else{const a=this.domService.createElement("div");this.domService.appendChild(n,a);const h=this.domService.createText(t);this.domService.addClass(a,"ge-table-label"),this.domService.appendChild(a,h),this.domService.setAttribute(a,"data-row-index",`${i}`),this.domService.setAttribute(a,"data-col-index",`${o}`),this.domService.setAttribute(a,"data-area",`${r}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",s=new ye,i=-1){const o=this.domService.createElement("div");this.domService.addClass(o,"ge-table-sorted-icon-div"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"top","0"),this.domService.setStyle(o,"right","0"),this.domService.setStyle(o,"width","20px"),this.domService.setStyle(o,"background","transparent"),this.domService.setStyle(o,"cursor","pointer"),this.domService.setAttribute(o,"data-col-index",`${i}`),this.domService.setAttribute(o,"data-area","header");let r;t==="asc"?r=s.iconAsc:t==="desc"?r=s.iconDesc:r=s.iconPlaceholder;const n=r.content,a=this.domService.createText(n);this.domService.appendChild(o,a),r.style&&this.applyStyleString(o,r.style);for(const h of r.classes)this.domService.addClass(o,h);return this.domService.appendChild(e,o),o}addArrowDiv(e,t="none",s=new be,i=-1,o=-1,r="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${i}`),this.domService.setAttribute(n,"data-col-index",`${o}`),this.domService.setAttribute(n,"data-area",`${r}`);let a;t==="expanded"?a=s.arrowExpanded:t==="collapsed"?a=s.arrowCollapsed:a=s.arrowPlaceholder;const h=a.content,d=this.domService.createText(h);this.domService.appendChild(n,d),a.style&&this.applyStyleString(n,a.style);for(const c of a.classes)this.domService.addClass(n,c);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,s,i,o){if(e.verticalBorderVisible){const r=`ge-table-${i}-${o}-vertical-border`;this.addVerticalBorder(s,t,r)}if(e.horizontalBorderVisible){const r=`ge-table-${i}-${o}-horizontal-border`;this.addHorizontalBorder(s,t,r)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,s),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${e.left}px`),this.domService.setStyle(i,"top",`${e.top}px`),this.domService.setStyle(i,"width",`${e.width}px`),this.domService.setStyle(i,"height","1px"),this.domService.appendChild(t,i),i}addFocusBorderDivs(e,t,s){let i=this.domService.createElement("div");return this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width","1px"),this.domService.setStyle(i,"height",`${t.height}px`),this.applyStyle(i,s),this.domService.appendChild(e,i),i=this.domService.createElement("div"),this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left+t.width-1}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width","1px"),this.domService.setStyle(i,"height",`${t.height}px`),this.applyStyle(i,s),this.domService.appendChild(e,i),i=this.domService.createElement("div"),this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width",`${t.width}px`),this.domService.setStyle(i,"height","1px"),this.applyStyle(i,s),this.domService.appendChild(e,i),i=this.domService.createElement("div"),this.domService.addClass(i,"ge-table-focus-border"),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top+t.height-1}px`),this.domService.setStyle(i,"width",`${t.width}px`),this.domService.setStyle(i,"height","1px"),this.applyStyle(i,s),this.domService.appendChild(e,i),e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const i=this.domService.createElement("div");return this.domService.addClass(i,s),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${e.left}px`),this.domService.setStyle(i,"top",`${e.top}px`),this.domService.setStyle(i,"width","1px"),this.domService.setStyle(i,"height",`${e.height}px`),this.domService.appendChild(t,i),i}addDiv(e,t,s=""){const i=this.domService.createElement("div");return s&&this.domService.addClass(i,s),this.domService.setStyle(i,"display","clip"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"left",`${t.left}px`),this.domService.setStyle(i,"top",`${t.top}px`),this.domService.setStyle(i,"width",`${t.width}px`),this.domService.setStyle(i,"height",`${t.height}px`),this.domService.appendChild(e,i),i}applyStyleString(e,t){const s=t.split(";").map(i=>i.trim()).filter(i=>i);for(const i of s){const[o,r]=i.split(":");this.domService.setStyle(e,o.trim(),r.trim())}}getDivOrCreateDiv(e,t){let s=t.cache[e];return s?(s.innerText="",s):(s=this.domService.createElement("div"),t.cache[e]=s,s)}}const ie=l=>l==="header"?"header":l==="footer"?"footer":"body";class Ne{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const s=e.getAttribute("data-area");if(s&&(this.areaIdent=ie(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const i=e;this.value=i.value}}}}class je{constructor(e){this.tableScope=e,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=new Ne(e.target,this.tableScope);if(t.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(t.inputType==="checkbox"&&t.areaIdent)this.tableScope.toggleRowCheckbox(t.rowIdx,t.colIdx,t.areaIdent),e.preventDefault(),e.stopPropagation();else if(Z(t.row)&&t.areaModel){const s=t.colIdx===this.getArrowColumnIndex()&&e.altKey,i=t.className.includes("ge-table-tree-arrow-div");if(console.info(i,s),s||i){e.preventDefault(),e.stopPropagation();const o=t.row;o.expanded=!o.expanded,"recalcVisibleTreeRows"in t.areaModel&&t.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(o)}}if(t.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const s=this.tableScope.tableOptions.getFocusModel();s==null||s.clear(),s==null||s.setFocus(t.rowIdx,t.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(e.target instanceof HTMLElement){const t=e.target,s=t.getAttribute("data-area"),i=ie(s),o=Number(t.getAttribute("data-row-index")),r=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(i);if(s&&i==="header")this.tableScope.tableModel.isSortable(r)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,o,r));else if(t.getAttribute("data-row-index")){const a=n.getRowByIndex(o);if(s&&i==="body"&&n.isEditable(o,r)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(o,r)),Z(a)&&r===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const h=a;h.expanded=!h.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(h)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var s;this.mouseEvent=e,this.geMouseEventOld=(s=this.geMouseEvent)==null?void 0:s.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld)}updateCollapsedExpandedState(e){var s,i,o,r,n;const t=(i=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:i.getRowId;if(t){const a=(o=this.tableScope.storeStateCollapsedExpandService)==null?void 0:o.collapsedExpandedStateGet().mode,h=a==="collapsed"&&!e.expanded||a==="expanded"&&e.expanded,d=a==="collapsed"&&e.expanded||a==="expanded"&&!e.expanded,c=t(e.data);h?(r=this.tableScope.storeStateCollapsedExpandService)==null||r.collapsedStateIdsPush(c):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(c))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging=!0,requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class Xe{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){}scrollToIndex(e=0,t=0){}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}}class oe{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const s=e;for(const i of[...s]){const[o,r]=i;t[o]=r}}return t}checkAndPersistItem(e,t){const s=this.getStorageKeyFn;if(s){const i=s();if(i){const o=i+e;if((t+"").includes("Map")){const r=this.autoConvertMapToObject(t);this.persistItem(o,r)}else this.persistItem(o,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class Ke extends oe{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SCROLL_STATE;let i=this.loadFromLocalStorage(s);this.scrollOffset=i||[0,0]}}}}class ze{constructor(e="collapsed",t=[],s=!1,i=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=i}}class Ye extends oe{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new ze,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.COLLAPSED_EXPANDED_STATE,i=this.loadFromLocalStorage(s);i&&(this.collapsedExpandedState=i)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class Ue extends oe{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SORTING_STATE;let i=this.loadFromLocalStorage(s);this.sortItems=i||[]}}}}class I{constructor(e=0,t=0,s=0,i=0,o){this.left=e,this.width=t,this.height=s,this.top=i,this.index=o}}class qe{constructor(e,t,s,i){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=i,this.scrollTop=0,this.areaBodyWestGeo=new I,this.areaBodyCenterGeo=new I,this.areaBodyEastGeo=new I;const o=this.hostElement;o.innerText="",this.dom.setAttribute(o,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",o),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",o)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",o)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",o,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",o,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",o,"body","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",o,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",o,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",o,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",o,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",o,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",o,"body","center")))),this.contentWrapperDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=s.appendRelativeChildDiv(s.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-header-border",o)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",o)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",o)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",o))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,s=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${s-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=s-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=s-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=s-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${s-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class D{constructor(e,t,s,i,o=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=i,this.gammaRange=o}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new D(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new D(e,t,e,t)}static singleRow(e){return new D(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new D(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class Je{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let s=0;s<e;s++)for(let i=0;i<t;i++){let o=this.areaModel.getColspanAt(s,i),r=this.areaModel.getRowspanAt(s,i);if(o>1||r>1){o===0&&(o=1),r===0&&(r=1);const n=this.areaModel.hasOwnProperty("gammaCells");this.colAndRowspanRanges.push(new D(s,i,s+r-1,i+o-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const s of this.colAndRowspanRanges)if(s.isInRange(e,t))return!0}return!1}}class Qe{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class Ze extends qe{constructor(e,t,s,i){var r,n;super(e,t,s,i),this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new Qe,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.editing=!1,this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(r=this.tableOptions)!=null&&r.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),ee(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(a=>{var h;this.colAndRowspanModels[a]=new Je(t,t.getAreaModel(a)),(h=this.colAndRowspanModels[a])==null||h.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(){if(this.getSelectionModel){const e=this.getSelectionModel();e==null||e.clear()}}initRenderEditor(e,t){var i;let s=(i=this.tableModel.getColumnDef(t))==null?void 0:i.getEditRenderer;if(s||(s=this.tableOptions.getEditRenderer),s)if(this.editorRenderer=s(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const o=document.querySelector("input.ge-table-cell-editor-input");o&&o.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new I(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new I(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new I(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new I(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(s=>{this.tableModel.getAreaModel(s.area).setValue(s.rowIndex,s.columnIndex,s.value),t||this.rerenderCellContent(s)}),t&&this.repaint()}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),s=this.getStringByAttr(e,"data-side");if(s&&t)return[t,s]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var s;if(e){const i=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(i)return Number(i)}return-1}getStringByAttr(e,t){var s;if(e){const i=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(i)return i}return""}adjustArea(e,t=0){var S;const s=this.getArea(e,"west"),i=this.getArea(e,"center"),o=this.getArea(e,"east"),r=i.child.clientHeight;s.child.innerText="",i.child.innerText="",o.child.innerText="";const n=0,a=this.areaBodyCenterGeo.width,h=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),c=d.getRowCount();for(;this.cleanupFunctions[e].length;){const f=this.cleanupFunctions[e].shift();f&&f()}let p=t;const g=this.tableModel.getColumnCount(),u=this.tableModel.getFixedRightColumnCount(),m=this.tableModel.getFixedLeftColumnCount();for(let f=0;f<c;f++){const M=p,C=f===c-1,E=this.tableModel.getRowHeight(e,f);if(M+E>0){this.firstVisibleRowIndex=f;let v={left:n,width:a,height:E,top:M,index:f},w=this.dom.addRowDiv(i,v,f,e,"center");const R=m;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:v,parent:w,rowIndex:f,columnIndexStart:R,columnIndexEnd:g-u-1,verticalFixed:!1,lastRowOfModel:C}),h.left>0&&(v={left:n,width:this.areaBodyWestGeo.width,height:E,top:M,index:f},w=this.dom.addRowDiv(s,v,f,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:v,parent:w,rowIndex:f,columnIndexStart:0,columnIndexEnd:R-1,verticalFixed:!0,lastRowOfModel:C})),h.right>0&&(v={left:n,width:this.areaBodyEastGeo.width,height:E,top:M,index:f},w=this.dom.addRowDiv(o,v,f,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:v,parent:w,rowIndex:f,columnIndexStart:g-u,columnIndexEnd:g-1,verticalFixed:!0,lastRowOfModel:C})),e==="header"&&this.tree&&f===c-1){const T=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(w,new I(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),O=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(O){const V=this.dom.domService.createText(O.content);this.dom.domService.appendChild(T,V),O.style&&this.dom.applyStyleString(T,O.style)}}}if(p=p+E,p>r)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const f=((S=this.colAndRowspanModels[e])==null?void 0:S.getRanges())??[];if(f.length)for(const M of f){let C=0,E=i.child,v="center";if(M.c1<m)E=s.child,v="west";else if(u>0&&M.c1>=g-u)E=o.child,v="east";else{const w=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();C=this.scrollFactorX*w-this.areaBodyWestGeo.width,v="center"}this.drawBigCell(M,C,t,d,E,v)}}}drawBigCell(e,t,s,i,o,r){const n=s+this.getRowHeights(0,e.r1-1,i).reduce((S,f)=>S+f,0),a=this.tableModel.getColumnCount(),h=this.tableModel.getFixedRightColumnCount();let d=0;h>0&&e.c1>=a-h&&(d=a-h);const c=t+this.getColumnWidths(d,e.c1-1).reduce((S,f)=>S+f,0),p=this.getRowHeights(e.r1,e.r2,i).reduce((S,f)=>S+f,0),g=this.getColumnWidths(e.c1,e.c2).reduce((S,f)=>S+f,0);let u=!1;const m=this.getSelectionModel?this.getSelectionModel():void 0;m&&(u=m.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?(console.info("TODO here",e),this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:c,top:n,width:g,height:p,parent:o,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange})):this.renderCell({areaModel:i,areaIdent:i.areaIdent,sideIdent:r,rowIndex:e.r1,columnIndex:e.c1,left:c,top:n,width:g,height:p,parent:o,cellSelected:u,lastRowOfModel:!0,gammaRange:e.gammaRange}),i.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:c,cellTop:n,cellWidth:g,cellHeight:p,parent:o})}findRowOfImportantRowspanCell(e,t,s){const i=e.getMaxRowspan();for(let o=t-1;o>-1;o--){const r=e.getRowspanAt(o,s);if(r>1&&o+r+1>=t)return o;if(t-o>i)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:i,parent:o,rowIndex:r,columnIndexStart:n,columnIndexEnd:a,verticalFixed:h=!1,lastRowOfModel:d=!1}){var m;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let c=0;if(!h){const S=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();c=this.scrollFactorX*S}const p=0,g=!!(e==="body"&&t);let u=c;for(let S=n;S<=a;S++){const f=u,M=this.tableModel.getColumnWidth(S);if(M>0&&f+M>0){let C=i.height;const E=s.getRowspanAt(r,S),v=s.getColspanAt(r,S);E>1&&(C=this.getRowHeights(r,r+E-1,s).reduce((T,O)=>T+O,0));let w=M;v>1&&(w=this.getColumnWidths(S,S+v-1).reduce((T,O)=>T+O,0));let R=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(m=this.colAndRowspanModels[e])!=null&&m.isInRange(r,S)&&(R=!0),this.draggingTargetColumnIndex===S&&e!=="header"){this.renderDragTargetDiv(o,f,p,w,C);const T={left:f,top:p,width:w,height:C};this.dom.addColumnBorderDivs(this.tableOptions,o,T,e,t)}else{const T=this.renderSelectedBackgroundDiv(R,g,t,s,r,S,o,f,p,w,C);R||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:r,columnIndex:S,left:f,top:p,width:w,height:C,parent:o,cellSelected:T,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:r,columnIndex:S,cellLeft:f,cellTop:p,cellWidth:w,cellHeight:C,parent:o})}}if(u=u+M,u>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new I(u-1,1,i.height,0),o)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,index:o,left:r,width:n,height:a,top:h,parent:d,lastRowOfModel:c,gammaRange:p}){var ae;const u=this.editorRenderer&&this.editorRendererRow===i&&this.editorRendererColumn===o?this.editorRenderer:e.getCellRenderer(i,o),m={left:r,width:n,height:a,top:h,index:o},S=e.getRowByIndex(i);let f="none";if(o===this.getTreeArrowColumnIndex()&&Z(S)){const y=S;(ae=y.children)!=null&&ae.length?y.expanded?f="expanded":f="collapsed":f="hidden"}let C;if(t==="header"){const y=this.tableModel.getColumnDef(o);(!(y!=null&&y.sortIconVisible)||y!=null&&y.sortIconVisible())&&(C=y==null?void 0:y.sortState)}const E=e.getValueAt(i,o),v=u?"":`${E}`,w=e.isRowChecked(i),R=this.dom.addColumnDiv(d,m,i,o,t,s,v,f,this.tableOptions,w,C),T=e.getTooltipAt(i,o);T&&this.dom.setAttribute(R,"title",T);const O=this.tableModel.getColumnDef(o);O&&O.classes[t]&&this.dom.addClasses(O.classes[t],R);let V;u&&(V=u.render(R,i,o,t,e,E,this.dom.domService));const ne=e.getCustomClassesAt(i,o);if(ne.length&&this.dom.addClasses(ne,R),this.dom.addColumnBorderDivs(this.tableOptions,d,m,t,s),c&&this.dom.addHorizontalBorder({left:r,width:n,height:a,top:h+a},d),this.getFocusModel&&t==="body"){const y=this.getFocusModel();y!=null&&y.hasFocus(i,o)&&this.dom.addFocusBorderDivs(d,m,{})}t==="header"&&this.dom.setAttribute(R,"data-ge-action","drag-column");const z=e.getCustomStyleAt(i,o);if(z)for(const y in z)this.dom.setStyle(R,y,z[y]);return[R,V]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([s,i])=>{i?this.dom.addClass(s,e):this.dom.removeClass(s,e)})}rerenderCellContent({area:e,rowIndex:t,columnIndex:s,value:i,cssClasses:o}){const r=this.tableModel.getAreaModel(e),n='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',a=document.querySelector(n);if(a){let h;const c=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s?this.editorRenderer:r.getCellRenderer(t,s);if(a.innerText="",this.applyCssClasses(a,o),c)h=c.render(a,t,s,e,r,i,this.dom.domService),h&&this.cleanupFunctions[e].push(h);else{const u=`${i}`;this.dom.addLabelDiv(a,u,!1,t,s,e)}const p=r.getCustomClassesAt(t,s);p.length&&this.dom.addClasses(p,a);const g=r.getCustomStyleAt(t,s);if(g)for(const u in g)this.dom.setStyle(a,u,g[u])}}getColumnWidths(e,t){const s=[];for(let i=e;i<=t;i++)s.push(this.tableModel.getColumnWidth(i));return s}getRowHeights(e,t,s){const i=[];for(let o=e;o<=t;o++)i.push(s.getRowHeight(o));return i}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),i=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:i+"px",width:t+"px",height:s+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,s=this.tableModel.getColumnWidth(e.columnIndex),i=this.areaBodyWestGeo.width,o=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-i;this.dom.applyStyle(this.hoverColumn,{left:o+"px",top:"0px",width:s+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}renderDragTargetDiv(e,t,s,i,o){const r=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(r,"left",`${t}px`),this.dom.setStyle(r,"top",`${s}px`),this.dom.setStyle(r,"width",`${i}px`),this.dom.setStyle(r,"height",`${o}px`),r}renderSelectedBackgroundDiv(e,t,s,i,o,r,n,a,h,d,c){let p=!1;if(!e&&t&&i.isSelectable(o,r)&&this.getSelectionModel){const g=this.getSelectionModel();if(g){const u=g.getSelectionCount(o,r);p=u>0;for(let m=0;m<u;m++){const S=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${i.areaIdent}-${s}-selected-range`,n));this.dom.setStyle(S,"left",`${a}px`),this.dom.setStyle(S,"top",`${h}px`),this.dom.setStyle(S,"width",`${d}px`),this.dom.setStyle(S,"height",`${c}px`)}}}return p}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,columnIndex:o,left:r,top:n,width:a,height:h,parent:d,cellSelected:c,lastRowOfModel:p,gammaRange:g}){const[u,m]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:i,index:o,left:r,width:a,height:h,top:n,parent:d,lastRowOfModel:p,gammaRange:g});c&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,u),m&&this.cleanupFunctions[t].push(m)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:i,cellWidth:o,cellHeight:r,parent:n}){const a=this.dom.domService,h=this.tableOptions.columnResizeHandleWidthInPx??2,d=a.createElement("div");a.setAttribute(d,"data-col-index",`${t}`),a.setAttribute(d,"data-row-index",`${e}`),a.setAttribute(d,"data-area","header"),a.setAttribute(d,"data-ge-action","resize-column"),a.addClass(d,"ge-table-column-resize-handle"),a.setStyle(d,"display","clip"),a.setStyle(d,"position","absolute"),a.setStyle(d,"cursor","col-resize"),a.setStyle(d,"left",`${s+o-h}px`),a.setStyle(d,"top",`${i}px`),a.setStyle(d,"width",`${h}px`),a.setStyle(d,"height",`${r}px`),a.appendChild(n,d)}}class et{constructor(e,t){this.columnIndex=e,this.sortState=t}}class tt{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,s=t.getAttribute("data-area"),i=t.getAttribute("data-row-index"),o=t.getAttribute("data-col-index");if(s&&i&&o){const r=ie(s),n=Number(i),a=Number(o);this.tableScope.updateModelValueAfterEdit(r,n,a,t.value)}}}}class st{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class le{constructor(e){this.cells=e}static createSingle(e,t){return new le([new st(e,t)])}}class it{constructor(e){var t,s;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(s=this.tableScope.tableOptions)!=null&&s.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var o,r,n,a,h,d,c;let s=!1,i=!1;if(this.getSelectionModel&&this.getFocusModel){const p=this.getSelectionModel(),g=this.getFocusModel();p&&g&&(g.hasFocus(e.rowIndex,e.columnIndex)||(g.setFocus(e.rowIndex,e.columnIndex),s=!0),(o=e.originalEvent)!=null&&o.shiftKey||p.hasSelection()&&(p.clear(),s=!0),(r=e.originalEvent)!=null&&r.shiftKey&&this.previousEvt?(p.addSelection(this.createRangeByEvents(e,this.previousEvt)),i=!0,s=!0):(n=e.originalEvent)!=null&&n.ctrlKey||(a=e.originalEvent)!=null&&a.metaKey?(p.addSelection(D.singleCell(e.rowIndex,e.columnIndex)),i=!0,s=!0):(h=e.originalEvent)!=null&&h.altKey&&((d=e.originalEvent)!=null&&d.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey)&&(p.removeSelection(D.singleCell(e.rowIndex,e.columnIndex)),i=!0,s=!0))}return i?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),s}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),s=this.getFocusModel();if(t&&s){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[i,o]=s.getFocus();return t.togglePoint(i,o),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),r=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return D.create({rowIndex1:s,columnIndex1:o,rowIndex2:i,columnIndex2:r})}}class ot{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","cmd -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT"}}}class lt{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","cmd+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","cmd+x":"DESELECT_ALL","cmd+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT"}}}class rt{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new lt().get()):Object.assign(this.shortcutActionIdMapping,new ot().get()),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEnty(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit:",e);let t=!1;for(const s of this.listener)s.onActionTriggered(e)&&(t=!0);return t}findEnty(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens:",t);for(const s in this.shortcutActionIdMapping){const i=s.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[\+ ]/g).sort();if(this.areTokensEquals(t,i))return this.shortcutActionIdMapping[s]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}}class ce{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}}class ve{setStyle(e,t,s){return e.style[t]=s,e}appendText(e,t){const s=this.createText(t);return this.appendChild(e,s),s}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.add(s)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.remove(s)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,s){e.setAttribute(t,s)}}class nt{render(e,t,s,i,o,r,n){if(o.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const a=o.getValueAt(t,s);e.innerHTML=`
7
+ ${l}
8
+ class="ge-table-row-checkbox"> `,this.domService.setStyle(i,"display","inline"),this.domService.setStyle(i,"width","inherit"),this.domService.setAttribute(i,"data-row-index",`${o}`),this.domService.appendChild(e,i),i}addLabelDiv(e,t="",s=!1,o=-1,i=-1,l="body"){const n=this.domService.createElement("div");if(this.domService.addClass(n,"ge-table-label-div"),this.domService.setStyle(n,"position","relative"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"width","100%"),this.domService.setStyle(n,"height","100%"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${l}`),t)if(s){const a=this.domService.createText(t);this.domService.appendChild(n,a)}else{const a=this.domService.createElement("div");this.domService.appendChild(n,a);const c=this.domService.createText(t);this.domService.addClass(a,"ge-table-label"),this.domService.appendChild(a,c),this.domService.setAttribute(a,"data-row-index",`${o}`),this.domService.setAttribute(a,"data-col-index",`${i}`),this.domService.setAttribute(a,"data-area",`${l}`)}return this.domService.appendChild(e,n),n}addSortedIcon(e,t="",s=new Ae,o=-1){const i=this.domService.createElement("div");this.domService.addClass(i,"ge-table-sorted-icon-div"),this.domService.setStyle(i,"position","absolute"),this.domService.setStyle(i,"top","0"),this.domService.setStyle(i,"right","0"),this.domService.setStyle(i,"width","20px"),this.domService.setStyle(i,"background","transparent"),this.domService.setStyle(i,"cursor","pointer"),this.domService.setAttribute(i,"data-col-index",`${o}`),this.domService.setAttribute(i,"data-area","header");let l;t==="asc"?l=s.iconAsc:t==="desc"?l=s.iconDesc:l=s.iconPlaceholder;const n=l.content,a=this.domService.createText(n);this.domService.appendChild(i,a),l.style&&this.applyStyleString(i,l.style);for(const c of l.classes)this.domService.addClass(i,c);return this.domService.appendChild(e,i),i}addArrowDiv(e,t="none",s=new Ee,o=-1,i=-1,l="body"){const n=this.domService.createElement("div");this.domService.addClass(n,"ge-table-tree-arrow-div"),this.domService.setStyle(n,"display","inline-block"),this.domService.setStyle(n,"position",""),this.domService.setStyle(n,"width","20px"),this.domService.setStyle(n,"background","transparent"),this.domService.setStyle(n,"cursor","pointer"),this.domService.setAttribute(n,"data-row-index",`${o}`),this.domService.setAttribute(n,"data-col-index",`${i}`),this.domService.setAttribute(n,"data-area",`${l}`);let a;t==="expanded"?a=s.arrowExpanded:t==="collapsed"?a=s.arrowCollapsed:a=s.arrowPlaceholder;const c=a.content,d=this.domService.createText(c);this.domService.appendChild(n,d),a.style&&this.applyStyleString(n,a.style);for(const h of a.classes)this.domService.addClass(n,h);return this.domService.appendChild(e,n),n}addColumnBorderDivs(e,t,s,o,i){if(e.verticalBorderVisible){const l=`ge-table-${o}-${i}-vertical-border`;this.addVerticalBorder(s,t,l)}if(e.horizontalBorderVisible){const l=`ge-table-${o}-${i}-horizontal-border`;this.addHorizontalBorder(s,t,l)}return t}addHorizontalBorder(e,t,s="ge-table-body-center-horizontal-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width",`${e.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.appendChild(t,o),o}addFocusBorderDivs(e,t,s){t={...t,width:t.width+1,height:t.height+1};let o=this.domService.createElement("div");return this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left+t.width-1}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),o=this.domService.createElement("div"),this.domService.addClass(o,"ge-table-focus-border"),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top+t.height-1}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height","1px"),this.domService.setStyle(o,"z-index","9999"),this.applyStyle(o,s),this.domService.appendChild(e,o),e}addVerticalBorder(e,t,s="ge-table-body-center-vertical-border"){const o=this.domService.createElement("div");return this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${e.left}px`),this.domService.setStyle(o,"top",`${e.top}px`),this.domService.setStyle(o,"width","1px"),this.domService.setStyle(o,"height",`${e.height}px`),this.domService.appendChild(t,o),o}addDiv(e,t,s=""){const o=this.domService.createElement("div");return s&&this.domService.addClass(o,s),this.domService.setStyle(o,"display","clip"),this.domService.setStyle(o,"position","absolute"),this.domService.setStyle(o,"left",`${t.left}px`),this.domService.setStyle(o,"top",`${t.top}px`),this.domService.setStyle(o,"width",`${t.width}px`),this.domService.setStyle(o,"height",`${t.height}px`),this.domService.appendChild(e,o),o}applyStyleString(e,t){const s=t.split(";").map(o=>o.trim()).filter(o=>o);for(const o of s){const[i,l]=o.split(":");this.domService.setStyle(e,i.trim(),l.trim())}}getDivOrCreateDiv(e,t){let s=t.cache[e];return s?(s.innerText="",s):(s=this.domService.createElement("div"),t.cache[e]=s,s)}}const ae=r=>r==="header"?"header":r==="footer"?"footer":"body";class qe{constructor(e,t){if(this.rowIdx=-1,this.colIdx=-1,this.action=null,this.inputType=null,this.className="",e!==null&&(e instanceof HTMLDivElement||e instanceof HTMLSpanElement||e instanceof HTMLInputElement)){this.className=e.className,this.action=e.getAttribute("data-ge-action"),this.inputType=e.getAttribute("data-input-type"),this.rowIdx=Number(e.getAttribute("data-row-index")),this.colIdx=Number(e.getAttribute("data-col-index"));const s=e.getAttribute("data-area");if(s&&(this.areaIdent=ae(s),this.areaModel=t.tableModel.getAreaModel(this.areaIdent),this.row=this.areaModel.getRowByIndex(this.rowIdx)),e instanceof HTMLInputElement){const o=e;this.value=o.value}}}}class Je{constructor(e){this.tableScope=e,this.doubleClickDelay=500,this.expandedAll=!0,this.mouseDown=!1,this.dragging=!1,this.lastClicked=0,this.tableScope.hostElement.addEventListener("click",this.onHostElementClicked.bind(this)),this.tableScope.hostElement.addEventListener("dblclick",this.onHostElementDblClicked.bind(this)),this.tableScope.hostElement.addEventListener("mousedown",this.onMouseDown.bind(this)),this.tableScope.hostElement.addEventListener("mousemove",this.onMouseMove.bind(this)),this.tableScope.hostElement.addEventListener("mouseup",this.onMouseUp.bind(this)),this.tableScope.hostElement.addEventListener("contextmenu",this.onContextmenu.bind(this)),this.tableScope.hostElement._MouseHandler="true",this.tableScope.scrollViewport.addEventListener("scroll",this.tableScope.adjustAfterScrolling.bind(this.tableScope)),[window,this.tableScope.hostElement].forEach(t=>t.addEventListener("resize",this.tableScope.adjustContainersAndRows.bind(this.tableScope)))}onContextmenu(e){this.mouseEvent=e;const t=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.contextmenu(t)}onHostElementClicked(e){const t=Date.now();if(t-this.lastClicked<this.doubleClickDelay)return;this.lastClicked=t;const s=new qe(e.target,this.tableScope);if(s.action==="toggleExpandCollapseAll")this.expandedAll=!this.expandedAll,this.tableScope.toggleExpandCollapseAll(this.expandedAll),e.preventDefault(),e.stopPropagation();else if(s.action==="toggleHeaderGroup")this.tableScope.toggleHeaderGroup(s),e.preventDefault(),e.stopPropagation();else if(s.inputType==="checkbox"&&s.areaIdent)this.tableScope.toggleRowCheckbox(s.rowIdx,s.colIdx,s.areaIdent),e.preventDefault(),e.stopPropagation();else if(ie(s.row)&&s.areaModel){const o=s.colIdx===this.getArrowColumnIndex()&&e.altKey,i=s.className.includes("ge-table-tree-arrow-div");if(console.info(i,o),o||i){e.preventDefault(),e.stopPropagation();const l=s.row;l.expanded=!l.expanded,"recalcVisibleTreeRows"in s.areaModel&&s.areaModel.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(l)}}if(s.areaIdent==="body"&&this.tableScope.tableOptions.getFocusModel){const o=this.tableScope.tableOptions.getFocusModel();o==null||o.clear(),o==null||o.setFocus(s.rowIdx,s.colIdx)}this.publishGeMouseEvent(e,1)}onHostElementDblClicked(e){if(this.lastClicked=Date.now(),e.target instanceof HTMLElement){const t=e.target,s=t.getAttribute("data-area"),o=ae(s),i=Number(t.getAttribute("data-row-index")),l=Number(t.getAttribute("data-col-index")),n=this.tableScope.tableModel.getAreaModel(o);if(s&&o==="header")this.tableScope.tableModel.isSortable(l)&&(this.tableScope.clearSelection(),this.tableScope.onHeaderDblClicked(e,i,l));else if(t.getAttribute("data-row-index")){const a=n.getRowByIndex(i);if(s&&o==="body"&&n.isEditable(i,l)&&(this.tableScope.clearSelection(),this.tableScope.initRenderEditor(i,l)),ie(a)&&l===this.getArrowColumnIndex()){e.preventDefault(),e.stopPropagation();const c=a;c.expanded=!c.expanded,"recalcVisibleTreeRows"in n&&n.recalcVisibleTreeRows(),this.tableScope.tableModel.recalcSize(this.tableScope.hostElement.clientWidth),this.tableScope.adjustContainersAndRows(),this.updateCollapsedExpandedState(c)}}}this.publishGeMouseEvent(e,2)}publishGeMouseEvent(e,t){var s;this.mouseEvent=e,this.geMouseEventOld=(s=this.geMouseEvent)==null?void 0:s.clone(),this.geMouseEvent=this.tableScope.createGeMouseEvent(e),this.geMouseEvent&&(this.geMouseEvent.clickCount=t),this.tableScope.onMouseClicked(this.geMouseEvent,this.geMouseEventOld),this.tableScope.publishGeMouseEvent(this.geMouseEvent),t===1&&this.tableScope.debounceRepaint()}updateCollapsedExpandedState(e){var s,o,i,l,n;const t=(o=(s=this.tableScope.tableOptions)==null?void 0:s.autoRestoreOptions)==null?void 0:o.getRowId;if(t){const a=(i=this.tableScope.storeStateCollapsedExpandService)==null?void 0:i.collapsedExpandedStateGet().mode,c=a==="collapsed"&&!e.expanded||a==="expanded"&&e.expanded,d=a==="collapsed"&&e.expanded||a==="expanded"&&!e.expanded,h=t(e.data);c?(l=this.tableScope.storeStateCollapsedExpandService)==null||l.collapsedStateIdsPush(h):d&&((n=this.tableScope.storeStateCollapsedExpandService)==null||n.collapsedStateIdsRemove(h))}}getArrowColumnIndex(){return this.tableScope.tableModel.isRowCheckboxVisible()?1:0}onMouseDown(e){this.dragging||(this.mouseEvent=e,this.startMouseEvent=this.tableScope.createGeMouseEvent(this.mouseEvent),this.tableScope.onMouseDown(this.startMouseEvent),this.mouseDown=!0)}onMouseMove(e){this.mouseEvent=e,this.mouseDown?(this.dragging||(this.dragging=!0,this.tableScope.setDragging(!0)),requestAnimationFrame(this.mouseDraggingOnFrame.bind(this))):requestAnimationFrame(this.mouseMoveOnFrame.bind(this))}onMouseUp(e){this.mouseEvent=e,this.dragging&&requestAnimationFrame(this.mouseDraggingEndOnFrame.bind(this)),this.mouseDown=!1,this.dragging=!1,this.tableScope.setDragging(!1)}mouseDraggingOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingOnFrame(t,this.startMouseEvent)}}mouseDraggingEndOnFrame(){var e;if(this.mouseEvent){const t=this.tableScope.createGeMouseEvent(this.mouseEvent);(e=this.startMouseEvent)!=null&&e.originalEvent&&(t.draggingX=this.mouseEvent.clientX-this.startMouseEvent.originalEvent.clientX,t.draggingY=this.mouseEvent.clientY-this.startMouseEvent.originalEvent.clientY),this.tableScope.mouseDraggingEndOnFrame(t)}}mouseMoveOnFrame(){if(this.mouseEvent){const e=this.tableScope.createGeMouseEvent(this.mouseEvent);this.tableScope.mouseMove(e)}}}class Qe{constructor(e){this.tableScope=e}updateCells(e,t=!1){this.tableScope.updateCells(e,t)}externalFilterChanged(){this.tableScope.externalFilterChanged()}scrollToPixel(e=0,t=0){this.tableScope.scrollToPixel(e,t)}scrollToIndex(e=0,t=0){this.tableScope.scrollToIndex(e,t)}setHeaderVisible(e=!0){}setColumnVisible(e,t=!0){}isColumnVisible(e){return!0}isHeaderVisible(){return!0}setFooterVisible(e=!0){}isFooterVisible(){return!0}repaint(){this.tableScope.repaint()}repaintHard(){this.tableScope.repaintHard()}clearSelection(){this.tableScope.clearSelection(!0)}setSelectionModel(e,t=!0){this.tableScope.setSelectionModel(e,t)}triggerAction(e){this.tableScope.onActionTriggered(e)}getShortcutActionMapping(){return this.tableScope.shortcutService.getShortcutActionMapping()}copyToClipboard(){return this.tableScope.copyService.copyToClipboard(this.tableScope.tableModel,this.tableScope.selectionModel(),this.tableScope.focusModel())}getTableScope(){return this.tableScope}getSelectionModel(){return this.tableScope.selectionModel()}}class de{constructor(e){this.getStorageKeyFn=e}autoConvertMapToObject(e){const t={};if(e instanceof Map){const s=e;for(const o of[...s]){const[i,l]=o;t[i]=l}}return t}checkAndPersistItem(e,t){const s=this.getStorageKeyFn;if(s){const o=s();if(o){const i=o+e;if((t+"").includes("Map")){const l=this.autoConvertMapToObject(t);this.persistItem(i,l)}else this.persistItem(i,t)}}}persistItem(e,t){t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}loadFromLocalStorage(e){const t=localStorage.getItem(e);return t?JSON.parse(t):null}}class Ze extends de{constructor(e){super(e),this.SCROLL_STATE="scrollState",this.scrollOffset=[0,0],this.load()}getScrollOffset(){return this.scrollOffset}updateScrollOffset(e){this.scrollOffset=e,this.checkAndPersistItem(this.SCROLL_STATE,this.scrollOffset)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SCROLL_STATE;let o=this.loadFromLocalStorage(s);this.scrollOffset=o||[0,0]}}}}class et{constructor(e="collapsed",t=[],s=!1,o=!1){this.mode=e,this.rowIds=t,this.allCollapsed=s,this.allExpanded=o}}class tt extends de{constructor(e){super(e),this.COLLAPSED_EXPANDED_STATE="collapsedExpandedState",this.collapsedExpandedState=new et,this.load()}collapsedExpandedStateGet(){return this.collapsedExpandedState}collapsedExpandedStateIncludes(e){return this.collapsedExpandedState.rowIds.includes(e)}collapsedStateIdsPush(e){this.collapsedExpandedState.rowIds.includes(e)||(this.collapsedExpandedState.rowIds.push(e),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateIdsRemove(e){const t=this.collapsedExpandedState.rowIds.indexOf(e);t!==-1&&(this.collapsedExpandedState.rowIds.splice(t,1),this.collapsedExpandedState.allCollapsed=!1,this.collapsedExpandedState.allExpanded=!1,this.persist())}collapsedStateAll(e){this.collapsedExpandedState.rowIds=[],this.collapsedExpandedState.mode=e?"collapsed":"expanded",this.collapsedExpandedState.allCollapsed=!e,this.collapsedExpandedState.allExpanded=e,this.persist()}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.COLLAPSED_EXPANDED_STATE,o=this.loadFromLocalStorage(s);o&&(this.collapsedExpandedState=o)}}}persist(){this.checkAndPersistItem(this.COLLAPSED_EXPANDED_STATE,this.collapsedExpandedState)}}class st extends de{constructor(e){super(e),this.SORTING_STATE="sortingState",this.sortItems=[],this.load()}getSortItems(){return this.sortItems}setSortItems(e){this.sortItems=e,this.checkAndPersistItem(this.SORTING_STATE,this.sortItems)}load(){const e=this.getStorageKeyFn;if(e){const t=e();if(t){const s=t+this.SORTING_STATE,o=this.loadFromLocalStorage(s);this.sortItems=o||[]}}}}class O{constructor(e=0,t=0,s=0,o=0,i){this.left=e,this.width=t,this.height=s,this.top=o,this.index=i}}class ot{constructor(e,t,s,o){this.hostElement=e,this.tableModel=t,this.dom=s,this.tableOptions=o,this.scrollTop=0,this.areaBodyWestGeo=new O,this.areaBodyCenterGeo=new O,this.areaBodyEastGeo=new O;const i=this.hostElement;i.innerText="",this.dom.setAttribute(i,"tabindex","0"),this.dom.setStyle(this.dom.addClass("ge-table",i),"position","relative"),this.hoverRow=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-row",i)),this.hoverColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-hover-column",i)),this.draggingColumn=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-dragging-column",i)),this.areaHeaderWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-west",i,"header","west"))),this.areaHeaderCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-center",i,"header","center"))),this.areaHeaderEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-header ge-table-header-east",i,"body","east"))),this.areaBodyWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-west",i,"body","west"))),this.areaBodyEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-body ge-table-body-east",i,"body","east"))),this.areaFooterWest=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-west",i,"footer","west"))),this.areaFooterCenter=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-center",i,"footer","center"))),this.areaFooterEast=s.appendRelativeChildDiv(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-footer ge-table-footer-east",i,"footer","east"))),this.scrollViewport=s.applyStyleOverflowAuto(this.tableOptions.overflowX??"auto",this.tableOptions.overflowY??"auto",s.applyStyleNoPadding(s.applyStylePosistionAbsolute(s.createAreaDivWithClass("ge-table-scroll-viewport",i,"body","center")))),this.contentWrapperDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content-wrapper",this.scrollViewport))),this.contentDiv=s.applyStyleNoPadding(s.applyStylePosistionRelative(s.createDivWithClass("ge-table-scroll-content",this.contentWrapperDiv))),this.areaBodyCenter=s.appendRelativeChildDiv(s.createDivWithClass("ge-table-body-center",this.contentDiv)),this.borderHeaderBottom=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-header-border",i)),this.borderFixedWest=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-west-fixed-column-border",i)),this.borderFixedEast=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-east-fixed-column-border",i)),this.borderFooterTop=s.applyStylePosistionAbsolute(s.createDivWithClass("ge-table-footer-border",i))}adjustContainersAndRows(){const e=this.tableModel.getPadding(),t=this.hostElement.clientWidth,s=this.hostElement.clientHeight;this.dom.applyStyle(this.scrollViewport,{width:`${t-e.left}px`,height:`${s-e.top}px`,top:`${e.top}px`,left:`${e.left}px`}),this.scrollTop=this.scrollViewport.scrollTop,this.dom.applyStyle(this.contentDiv,{width:`${this.scrollViewport.clientWidth}px`,height:`${this.scrollViewport.clientHeight}px`,top:`${this.scrollTop}px`,left:`${this.scrollViewport.scrollLeft}px`}),this.areaBodyWestGeo.width=e.left,this.areaBodyWestGeo.height=s-e.top-e.bottom,this.areaBodyWestGeo.top=e.top,this.areaBodyWestGeo.left=0,this.dom.applyStyleInPx(this.areaBodyWest.parent,this.areaBodyWestGeo),this.tableOptions.fixedWestSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedWest,{width:"1px",height:`${this.areaBodyWestGeo.height}px`,top:`${this.areaBodyWestGeo.top}px`,left:`${this.areaBodyWestGeo.width}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedWest),this.areaBodyEastGeo.width=e.right,this.areaBodyEastGeo.height=s-e.top-e.bottom,this.areaBodyEastGeo.top=e.top,this.areaBodyEastGeo.left=t-e.right,this.dom.applyStyleInPx(this.areaBodyEast.parent,this.areaBodyEastGeo),this.tableOptions.fixedEastSeparatorBorderVisible&&this.tableModel.getFixedLeftColumnCount()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFixedEast,{width:"1px",height:`${this.areaBodyEastGeo.height}px`,top:`${this.areaBodyEastGeo.top}px`,left:`${this.areaBodyEastGeo.left}px`})):this.dom.applyDisplayNoneStyle(this.borderFixedEast),this.areaBodyCenterGeo.width=t-e.left-e.right,this.areaBodyCenterGeo.height=s-e.top-e.bottom,this.areaBodyCenterGeo.top=0,this.areaBodyCenterGeo.left=0,this.dom.applyStyleInPx(this.areaBodyCenter.parent,this.areaBodyCenterGeo),this.dom.applyStyle(this.areaHeaderCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.top}px`,top:"0",left:`${e.left}px`}),this.dom.applyStyle(this.areaHeaderWest.parent,{width:`${e.left}px`,height:`${e.top}px`,top:"0",left:"0"}),this.dom.applyStyle(this.areaHeaderEast.parent,{width:`${e.right}px`,height:`${e.top}px`,top:"0",left:`${t-e.right}px`}),this.tableOptions.headerSeparatorBorderVisible&&this.tableModel.isHeaderVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderHeaderBottom,{width:`${t}px`,height:"1px",top:`${e.top}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderHeaderBottom),this.dom.applyStyle(this.areaFooterWest.parent,{width:`${e.left}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:"0"}),this.dom.applyStyle(this.areaFooterCenter.parent,{width:`${t-e.left-e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${e.left}px`}),this.dom.applyStyle(this.areaFooterEast.parent,{width:`${e.right}px`,height:`${e.bottom}px`,top:`${s-e.bottom}px`,left:`${t-e.right}px`}),this.tableOptions.footerSeparatorBorderVisible&&this.tableModel.isFooterVisibe()?this.dom.applyDisplayBlockStyle(this.dom.applyStyle(this.borderFooterTop,{width:`${t}px`,height:"1px",top:`${s-e.bottom}px`,left:"0px"})):this.dom.applyDisplayNoneStyle(this.borderFooterTop),this.adjustAfterScrolling()}adjustAfterScrolling(){}resetSizeOfWrapperDiv(){const e=`${this.tableModel.getContentWidthInPixel()}px`,t=`${this.tableModel.getContentHeightInPixel()+1}px`;this.dom.setStyle(this.contentWrapperDiv,"width",e),this.dom.setStyle(this.contentWrapperDiv,"height",t)}}class A{constructor(e,t,s,o,i=!1){this.r1=e,this.c1=t,this.r2=s,this.c2=o,this.gammaRange=i}static create(e){return e.gammaRange===void 0&&(e.gammaRange=!1),new A(e.rowIndex1,e.columnIndex1,e.rowIndex2,e.columnIndex2,e.gammaRange)}static singleCell(e,t){return new A(e,t,e,t)}static singleRow(e){return new A(e,0,e,Number.MAX_SAFE_INTEGER)}static singleColumn(e){return new A(0,e,Number.MAX_SAFE_INTEGER,e)}isInRange(e,t){return e>=this.r1&&e<=this.r2&&t>=this.c1&&t<=this.c2}}class it{constructor(e,t){this.tableModel=e,this.areaModel=t,this.colAndRowspanRanges=void 0}init(){if(this.areaModel.getMaxColspan()<2&&this.areaModel.getMaxRowspan()<2)return;this.colAndRowspanRanges=[];const e=this.areaModel.getRowCount(),t=this.tableModel.getColumnCount();for(let s=0;s<e;s++)for(let o=0;o<t;o++){let i=this.areaModel.getColspanAt(s,o),l=this.areaModel.getRowspanAt(s,o);if(i>1||l>1){i===0&&(i=1),l===0&&(l=1);const n="gammaCells"in this.areaModel;this.colAndRowspanRanges.push(new A(s,o,s+l-1,o+i-1,n))}}}getRanges(){return this.colAndRowspanRanges?this.colAndRowspanRanges:[]}isInRange(e,t){if(this.colAndRowspanRanges){for(const s of this.colAndRowspanRanges)if(s.isInRange(e,t))return!0}return!1}}class lt{constructor(e,t,s){this.header=e,this.body=t,this.footer=s}}class rt extends ot{constructor(e,t,s,o){var l,n;super(e,t,s,o),this.dragging=!1,this.editing=!1,this.storedColumnWidths=[],this.scrollLeft=0,this.scrollViewportLeft=0,this.scrollFactorY=0,this.scrollFactorX=0,this.cleanupFunctions={header:[],body:[],footer:[]},this.tree=!1,this.colAndRowspanModels=new lt,this.firstVisibleRowIndex=-1,this.draggingTargetColumnIndex=-1,this.removables=[],this.tableModel.getSelectionModel?this.getSelectionModel=this.tableModel.getSelectionModel:(l=this.tableOptions)!=null&&l.getSelectionModel&&(this.getSelectionModel=this.tableOptions.getSelectionModel),(n=this.tableOptions)!=null&&n.getFocusModel&&(this.getFocusModel=this.tableOptions.getFocusModel),le(t.getAreaModel("body"))&&(this.tree=!0),["header","body","footer"].forEach(a=>{var c;this.colAndRowspanModels[a]=new it(t,t.getAreaModel(a)),(c=this.colAndRowspanModels[a])==null||c.init()})}isEditing(){return this.editing}resetEditorRenderer(){this.editorRenderer=void 0,this.editorRendererRow=-1,this.editorRendererColumn=-1,this.editing=!1}clearSelection(e=!1){if(this.getSelectionModel){const t=this.getSelectionModel();t==null||t.clear(),e&&this.repaint()}}initRenderEditor(e,t){var o;let s=(o=this.tableModel.getColumnDef(t))==null?void 0:o.getEditRenderer;if(s||(s=this.tableOptions.getEditRenderer),s)if(this.editorRenderer=s(e,t),this.editorRenderer){this.editorRendererRow=e,this.editorRendererColumn=t,this.editing=!0,this.repaint();const i=document.querySelector("input.ge-table-cell-editor-input");i&&i.focus()}else this.resetEditorRenderer()}repaint(){this.adjustAfterScrolling()}repaintHard(){this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.adjustAfterScrolling()}adjustAfterScrolling(){var e;for(const t of this.removables)t.remove();this.hideHoverRow(),this.hideHoverColumn(),this.scrollTop=this.scrollViewport.scrollTop,this.scrollLeft=this.scrollViewport.scrollLeft,this.debounce(this.checkForScrollPosSaving.bind(this)),this.scrollFactorY=this.scrollTop/(this.scrollViewport.scrollHeight-this.scrollViewport.clientHeight),this.scrollFactorX=this.scrollLeft/(this.scrollViewport.scrollWidth-this.scrollViewport.clientWidth),isNaN(this.scrollFactorY)&&(this.scrollFactorY=0),isNaN(this.scrollFactorX)&&(this.scrollFactorX=0),this.adjustBody(),this.adjustArea("footer"),this.adjustArea("header"),this.tableOptions.tableTopBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,0),this.hostElement,"ge-table-border")),this.tableOptions.tableBottomBorderVisible&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.hostElement.clientHeight-1),this.hostElement,"ge-table-border")),this.tableModel.getFixedLeftColumnCount()>0&&this.removables.push(this.dom.addVerticalBorder(new O(this.areaBodyWest.child.clientWidth,1,this.hostElement.clientHeight,0),this.hostElement,"ge-table-body-west-vertical-border")),((e=this.tableModel.getAreaModel("header"))==null?void 0:e.getRowCount())>0&&this.removables.push(this.dom.addHorizontalBorder(new O(0,this.hostElement.clientWidth,1,this.areaHeaderCenter.child.clientHeight),this.hostElement,"ge-table-body-west-vertical-border"))}checkForScrollPosSaving(){var e,t;this.storeScrollPosStateService&&((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreScrollPosition)&&this.storeScrollPosStateService.updateScrollOffset([this.scrollLeft,this.scrollTop])}updateCells(e,t=!1){e.forEach(s=>{this.tableModel.getAreaModel(s.area).setValue(s.rowIndex,s.columnIndex,s.value),t||this.rerenderCellContent(s)}),t&&this.repaint()}rerenderCellContent({area:e,rowIndex:t,columnIndex:s,value:o,cssClasses:i}){const l=this.tableModel.getAreaModel(e),n='div[data-col-index="'+s+'"][data-row-index="'+t+'"][data-area="'+e+'"]',a=document.querySelector(n);if(a){let c;const h=this.editorRenderer&&this.editorRendererRow===t&&this.editorRendererColumn===s?this.editorRenderer:l.getCellRenderer(t,s);if(a.innerText="",this.applyCssClasses(a,i),h)c=h.render(a,t,s,e,l,o,this.dom.domService),c&&this.cleanupFunctions[e].push(c);else{const b=`${o}`;this.dom.addLabelDiv(a,b,!1,t,s,e)}const g=l.getCustomClassesAt(t,s);g.length&&this.dom.addClasses(g,a);const f=l.getCustomStyleAt(t,s);if(f)for(const b in f)this.dom.setStyle(a,b,f[b])}}storeColumnWidths(){const e=this.tableModel.getColumnDefs();e!=null&&e.length&&(this.storedColumnWidths=e.map((t,s)=>this.tableModel.getColumnWidth(s)))}getAreaAndSideIdentByAttr(e){if(e){const t=this.getStringByAttr(e,"data-area"),s=this.getStringByAttr(e,"data-side");if(s&&t)return[t,s]}return[void 0,void 0]}getArea(e,t){if(e==="header"){if(t==="west")return this.areaHeaderWest;if(t==="center")return this.areaHeaderCenter;if(t==="east")return this.areaHeaderEast}else if(e==="body"){if(t==="west")return this.areaBodyWest;if(t==="center")return this.areaBodyCenter;if(t==="east")return this.areaBodyEast}else if(e==="footer"){if(t==="west")return this.areaFooterWest;if(t==="center")return this.areaFooterCenter;if(t==="east")return this.areaFooterEast}throw Error(`Wrong area identifier: row:${e}, col:${t}`)}adjustBody(){const e=this.areaBodyCenterGeo.height-this.tableModel.getContentHeightInPixel(),t=this.scrollFactorY*e;this.dom.setStyle(this.contentDiv,"top",`${this.scrollTop}px`),this.dom.setStyle(this.contentDiv,"left",`${this.scrollViewport.scrollLeft}px`),this.adjustArea("body",t)}getNumberByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return Number(o)}return-1}getStringByAttr(e,t){var s;if(e){const o=(s=e.closest("["+t+"]"))==null?void 0:s.getAttribute(t);if(o)return o}return""}adjustArea(e,t=0){var p;const s=this.getArea(e,"west"),o=this.getArea(e,"center"),i=this.getArea(e,"east"),l=o.child.clientHeight;s.child.innerText="",o.child.innerText="",i.child.innerText="";const n=0,a=this.areaBodyCenterGeo.width,c=this.tableModel.getPadding(),d=this.tableModel.getAreaModel(e),h=d.getRowCount();for(;this.cleanupFunctions[e].length;){const u=this.cleanupFunctions[e].shift();u&&u()}let g=t;const f=this.tableModel.getColumnCount(),b=this.tableModel.getFixedRightColumnCount(),S=this.tableModel.getFixedLeftColumnCount();for(let u=0;u<h;u++){const v=g,C=u===h-1,E=this.tableModel.getRowHeight(e,u);if(v+E>0){this.firstVisibleRowIndex=u;let y={left:n,width:a,height:E,top:v,index:u},m=this.dom.addRowDiv(o,y,u,e,"center");const k=S;if(this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"center",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:k,columnIndexEnd:f-b-1,verticalFixed:!1,lastRowOfModel:C}),c.left>0&&(y={left:n,width:this.areaBodyWestGeo.width,height:E,top:v,index:u},m=this.dom.addRowDiv(s,y,u,e,"west"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"west",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:0,columnIndexEnd:k-1,verticalFixed:!0,lastRowOfModel:C})),c.right>0&&(y={left:n,width:this.areaBodyEastGeo.width,height:E,top:v,index:u},m=this.dom.addRowDiv(i,y,u,e,"east"),this.adjustColumnsToRowParent({areaIdent:e,sideIdent:"east",areaModel:d,geo:y,parent:m,rowIndex:u,columnIndexStart:f-b,columnIndexEnd:f-1,verticalFixed:!0,lastRowOfModel:C})),e==="header"&&this.tree&&u===h-1){const T=this.dom.applyStyle(this.dom.setAttribute(this.dom.addDiv(m,new O(16,20,20,8)),"data-ge-action","toggleExpandCollapseAll"),{cursor:"pointer"}),D=this.tableOptions.treeOptions.arrowExpandCollapseAll;if(D){const _=this.dom.domService.createText(D.content);this.dom.domService.appendChild(T,_),D.style&&this.dom.applyStyleString(T,D.style)}}}if(g=g+E,g>l)break}if(this.colAndRowspanModels&&this.colAndRowspanModels[e]){const u=((p=this.colAndRowspanModels[e])==null?void 0:p.getRanges())??[];if(u.length)for(const v of u){let C=0,E=o.child,y="center";if(v.c1<S)E=s.child,y="west";else if(b>0&&v.c1>=f-b)E=i.child,y="east";else{const m=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();C=this.scrollFactorX*m-this.areaBodyWestGeo.width,y="center"}this.drawBigCell(v,C,t,d,E,y)}}}drawBigCell(e,t,s,o,i,l){const n=s+this.getRowHeights(0,e.r1-1,o).reduce((p,u)=>p+u,0),a=this.tableModel.getColumnCount(),c=this.tableModel.getFixedRightColumnCount();let d=0;c>0&&e.c1>=a-c&&(d=a-c);const h=t+this.getColumnWidths(d,e.c1-1).reduce((p,u)=>p+u,0),g=this.getRowHeights(e.r1,e.r2,o).reduce((p,u)=>p+u,0),f=this.getColumnWidths(e.c1,e.c2).reduce((p,u)=>p+u,0);let b=!1;const S=this.getSelectionModel?this.getSelectionModel():void 0;S&&(b=S.getSelectionCount(e.r1,e.c1)>0),e.gammaRange?this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:l,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:f,height:g,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}):this.renderCell({areaModel:o,areaIdent:o.areaIdent,sideIdent:l,rowIndex:e.r1,columnIndex:e.c1,left:h,top:n,width:f,height:g,parent:i,cellSelected:b,lastRowOfModel:!0,gammaRange:e.gammaRange}),o.areaIdent==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:e.r1,columnIndex:e.c1,cellLeft:h,cellTop:n,cellWidth:f,cellHeight:g,parent:i})}findRowOfImportantRowspanCell(e,t,s){const o=e.getMaxRowspan();for(let i=t-1;i>-1;i--){const l=e.getRowspanAt(i,s);if(l>1&&i+l+1>=t)return i;if(t-i>o)return-1}return-1}adjustColumnsToRowParent({areaIdent:e,sideIdent:t,areaModel:s,geo:o,parent:i,rowIndex:l,columnIndexStart:n,columnIndexEnd:a,verticalFixed:c=!1,lastRowOfModel:d=!1}){var S;this.scrollViewportLeft=this.scrollViewport.scrollLeft;let h=0;if(!c){const p=this.areaBodyCenterGeo.width-this.tableModel.getContentWidthInPixel();h=this.scrollFactorX*p}const g=0,f=!!(e==="body"&&t);let b=h;for(let p=n;p<=a;p++){const u=b,v=this.tableModel.getColumnWidth(p);if(v>0&&u+v>0){let C=o.height;const E=s.getRowspanAt(l,p),y=s.getColspanAt(l,p);E>1&&(C=this.getRowHeights(l,l+E-1,s).reduce((T,D)=>T+D,0));let m=v;y>1&&(m=this.getColumnWidths(p,p+y-1).reduce((T,D)=>T+D,0));let k=!1;if(this.colAndRowspanModels&&this.colAndRowspanModels[e]&&(S=this.colAndRowspanModels[e])!=null&&S.isInRange(l,p)&&(k=!0),this.draggingTargetColumnIndex===p&&e!=="header"){this.renderDragTargetDiv(i,u,g,m,C);const T={left:u,top:g,width:m,height:C};this.dom.addColumnBorderDivs(this.tableOptions,i,T,e,t)}else{const T=this.renderSelectedBackgroundDiv(k,f,t,s,l,p,i,u,g,m,C);"gammaCells"in s&&s.getValueAt(l,p)&&(k=!1),k||this.renderCell({areaModel:s,areaIdent:e,sideIdent:t,rowIndex:l,columnIndex:p,left:u,top:g,width:m,height:C,parent:i,cellSelected:T,lastRowOfModel:d,gammaRange:!0}),e==="header"&&this.tableOptions.columnsResizable&&this.renderHeaderCellResizeHandle({rowIndex:l,columnIndex:p,cellLeft:u,cellTop:g,cellWidth:m,cellHeight:C,parent:i})}}if(b=b+v,b>this.areaBodyCenterGeo.width)break}this.tableOptions.verticalBorderVisible&&this.dom.addVerticalBorder(new O(b-1,1,o.height,0),i)}getTreeArrowColumnIndex(){return this.tableOptions.showCheckboxWihoutExtraColumn?0:this.tableModel.isRowCheckboxVisible()?1:0}addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:l,width:n,height:a,top:c,parent:d,lastRowOfModel:h}){var ge;const f=this.editorRenderer&&this.editorRendererRow===o&&this.editorRendererColumn===i?this.editorRenderer:e.getCellRenderer(o,i),b={left:l,width:n,height:a,top:c,index:i},S=e.getRowByIndex(o);let p="none";if(i===this.getTreeArrowColumnIndex()&&ie(S)){const x=S;(ge=x.children)!=null&&ge.length?x.expanded?p="expanded":p="collapsed":p="hidden"}let v;if(t==="header"){const x=this.tableModel.getColumnDef(i);(!(x!=null&&x.sortIconVisible)||x!=null&&x.sortIconVisible())&&(v=x==null?void 0:x.sortState)}const C=e.getValueAt(o,i),E=f?"":`${C}`,y=e.isRowChecked(o),m=this.dom.addColumnDiv({parent:d,geo:b,rowIndex:o,columnIndex:i,areaIdent:t,sideIdent:s,text:E,treeArrow:p,tableOptions:this.tableOptions,checkedType:y,sortState:v}),k=e.getTooltipAt(o,i);k&&this.dom.setAttribute(m,"title",k);const T=this.tableModel.getColumnDef(i);T&&T.classes[t]&&this.dom.addClasses(T.classes[t],m);let D;f&&(D=f.render(m,o,i,t,e,C,this.dom.domService));const _=e.getCustomClassesAt(o,i);if(_.length&&this.dom.addClasses(_,m),this.dom.addColumnBorderDivs(this.tableOptions,d,b,t,s),h&&this.dom.addHorizontalBorder({left:l,width:n,height:a,top:c+a},d),this.getFocusModel&&t==="body"){const x=this.getFocusModel();x!=null&&x.hasFocus(o,i)&&this.dom.addFocusBorderDivs(d,b,{})}t==="header"&&this.dom.setAttribute(m,"data-ge-action","drag-column");const Q=e.getCustomStyleAt(o,i);if(Q)for(const x in Q)this.dom.setStyle(m,x,Q[x]);return[m,D]}applyCssClasses(e,t={}){e&&Object.entries(t).forEach(([s,o])=>{o?this.dom.addClass(s,e):this.dom.removeClass(s,e)})}getColumnWidths(e,t){const s=[];for(let o=e;o<=t;o++)s.push(this.tableModel.getColumnWidth(o));return s}getRowHeights(e,t,s){const o=[];for(let i=e;i<=t;i++)o.push(s.getRowHeight(i));return o}adjustHoverRows(e){if(this.tableOptions.hoverRowVisible&&e.rowIndex>-1){const t=this.hostElement.clientWidth,s=this.tableModel.getAreaModel("body").getRowHeight(e.rowIndex),o=e.rowTop+this.areaHeaderCenter.parent.clientHeight-this.scrollTop;this.dom.applyStyle(this.hoverRow,{left:"0",top:o+"px",width:t+"px",height:s+"px",display:"block"})}else this.hideHoverRow()}hideHoverRow(){this.dom.applyStyle(this.hoverRow,{display:"none"})}adjustHoverColumns(e){if(this.tableOptions.hoverColumnVisible&&e.rowIndex>-1){const t=this.hostElement.clientHeight,s=this.tableModel.getColumnWidth(e.columnIndex),o=this.areaBodyWestGeo.width,i=e.columnLeft+this.tableModel.getPadding().left-this.scrollLeft-o;this.dom.applyStyle(this.hoverColumn,{left:i+"px",top:"0px",width:s+"px",height:t+"px",display:"block"})}else this.hideHoverColumn()}hideHoverColumn(){this.dom.applyStyle(this.hoverColumn,{display:"none"})}debounce(e,t=1e3){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(e.bind(this),t)}adjustDraggingColumn(e,t,s){var o,i;if(this.dragging){const l=this.hostElement.clientHeight,n=this.storedColumnWidths[t];if((o=e.originalEvent)!=null&&o.clientX){const d={left:((i=e.originalEvent)==null?void 0:i.clientX)-n/2,width:n,height:l,top:0,index:t};this.dom.applyStyle(this.draggingColumn,{background:"rgba(128,128,128,0.2)",display:"block",overfllow:"clip"}),this.dom.applyStyleInPx(this.draggingColumn,d),s&&this.renderContentOfDraggingColumn(d)}}else this.hideDraggingColumn()}renderContentOfDraggingColumn(e){const t=this.renderContentOfDraggingColumnForArea(e,"header",0);this.renderContentOfDraggingColumnForArea(e,"body",t)}renderContentOfDraggingColumnForArea(e,t,s=0){const o="center",i=this.tableModel.getAreaModel(t),l=i==null?void 0:i.getRowCount();if(l){const n=e.index??0,a=this.draggingColumn;for(let c=0;c<l;c++){const d=s,h=i.getRowHeight(c),g={left:0,width:e.width,height:h,top:d,index:c},f=i.getValueAt(c,n),b=i.getCellRenderer(c,n),S=b?"":`${f}`,p={parent:a,geo:g,rowIndex:c,columnIndex:n,areaIdent:t,sideIdent:o,text:S},u=this.dom.addColumnDiv(p);let v;b&&(v=b.render(u,c,n,t,i,f,this.dom.domService),v&&this.cleanupFunctions[t].push(v));const C=i.getCustomClassesAt(c,n);C.length&&this.dom.addClasses(C,u);const E=this.tableModel.getColumnDef(n);E&&E.classes[t]&&this.dom.addClasses(E.classes[t],u),this.dom.addColumnBorderDivs(this.tableOptions,a,g,t,o);const y=i.getCustomStyleAt(c,n);if(y)for(const m in y)this.dom.setStyle(u,m,y[m]);s=s+h}}return s}hideDraggingColumn(){this.dom.applyStyle(this.draggingColumn,{display:"none"})}renderDragTargetDiv(e,t,s,o,i){const l=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass("ge-table-drop-zone",e));return this.dom.setStyle(l,"left",`${t}px`),this.dom.setStyle(l,"top",`${s}px`),this.dom.setStyle(l,"width",`${o}px`),this.dom.setStyle(l,"height",`${i}px`),l}renderSelectedBackgroundDiv(e,t,s,o,i,l,n,a,c,d,h){let g=!1;if(!e&&t&&o.isSelectable(i,l)&&this.getSelectionModel){const f=this.getSelectionModel();if(f){const b=f.getSelectionCount(i,l);g=b>0;for(let S=0;S<b;S++){const p=this.dom.applyStylePosistionAbsolute(this.dom.createDivWithClass(`ge-table-${o.areaIdent}-${s}-selected-range`,n));this.dom.setStyle(p,"left",`${a}px`),this.dom.setStyle(p,"top",`${c}px`),this.dom.setStyle(p,"width",`${d}px`),this.dom.setStyle(p,"height",`${h}px`)}}}return g}renderCell({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,columnIndex:i,left:l,top:n,width:a,height:c,parent:d,cellSelected:h,lastRowOfModel:g}){const[f,b]=this.addAndRenderCellDiv({areaModel:e,areaIdent:t,sideIdent:s,rowIndex:o,index:i,left:l,width:a,height:c,top:n,parent:d,lastRowOfModel:g});h&&this.dom.addClass(`ge-table-${t}-${s}-selected-range`,f),b&&this.cleanupFunctions[t].push(b)}renderHeaderCellResizeHandle({rowIndex:e,columnIndex:t,cellLeft:s,cellTop:o,cellWidth:i,cellHeight:l,parent:n}){const a=this.dom.domService,c=this.tableOptions.columnResizeHandleWidthInPx??2,d=a.createElement("div");a.setAttribute(d,"data-col-index",`${t}`),a.setAttribute(d,"data-row-index",`${e}`),a.setAttribute(d,"data-area","header"),a.setAttribute(d,"data-ge-action","resize-column"),a.addClass(d,"ge-table-column-resize-handle"),a.setStyle(d,"display","clip"),a.setStyle(d,"position","absolute"),a.setStyle(d,"cursor","col-resize"),a.setStyle(d,"left",`${s+i-c}px`),a.setStyle(d,"top",`${o}px`),a.setStyle(d,"width",`${c}px`),a.setStyle(d,"height",`${l}px`),a.appendChild(n,d)}}class nt{constructor(e,t){this.columnIndex=e,this.sortState=t}}class at{constructor(e){this.tableScope=e,this.tableScope.hostElement.addEventListener("change",this.onHostElementChanged.bind(this))}onHostElementChanged(e){if(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement||e.target instanceof HTMLTextAreaElement){const t=e.target,s=t.getAttribute("data-area"),o=t.getAttribute("data-row-index"),i=t.getAttribute("data-col-index");if(s&&o&&i){const l=ae(s),n=Number(o),a=Number(i);this.tableScope.updateModelValueAfterEdit(l,n,a,t.value)}}}}class dt{constructor(e=-1,t=-1){this.rowIndex=e,this.columnIndex=t}}class ce{constructor(e){this.cells=e}static createSingle(e,t){return new ce([new dt(e,t)])}}class ct{constructor(e){var t,s;this.tableScope=e,(t=this.tableScope.tableOptions)!=null&&t.getSelectionModel&&(this.getSelectionModel=this.tableScope.tableOptions.getSelectionModel),(s=this.tableScope.tableOptions)!=null&&s.getFocusModel&&(this.getFocusModel=this.tableScope.tableOptions.getFocusModel)}onMouseClicked(e,t){var i,l,n,a,c,d,h;let s=!1,o=!1;if(this.getSelectionModel&&this.getFocusModel){const g=this.getSelectionModel(),f=this.getFocusModel();g&&f&&(f.hasFocus(e.rowIndex,e.columnIndex)||(f.setFocus(e.rowIndex,e.columnIndex),this.tableScope.onFocusChanged(f),s=!0),(i=e.originalEvent)!=null&&i.shiftKey||g.hasSelection()&&(g.clear(),s=!0),(l=e.originalEvent)!=null&&l.shiftKey&&this.previousEvt?(g.addSelection(this.createRangeByEvents(e,this.previousEvt)),o=!0,s=!0):(n=e.originalEvent)!=null&&n.altKey&&((a=e.originalEvent)!=null&&a.ctrlKey||(c=e.originalEvent)!=null&&c.metaKey)?(g.removeSelection(A.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(d=e.originalEvent)!=null&&d.ctrlKey||(h=e.originalEvent)!=null&&h.metaKey?(g.addSelection(A.singleCell(e.rowIndex,e.columnIndex)),o=!0,s=!0):(g.firstClick(e.rowIndex,e.columnIndex),s=!0),this.tableScope.onSelectionChanged(g))}return o?this.previousEvt=void 0:this.previousEvt=e==null?void 0:e.clone(),s}onActionTriggered(e){if(this.getSelectionModel&&this.getFocusModel){const t=this.getSelectionModel(),s=this.getFocusModel();if(t&&s){if(e==="SELECT_ALL")return t.selectAll(),this.tableScope.repaint(),!0;if(e==="DESELECT_ALL")return t.clear(),this.tableScope.repaint(),!0;if(e==="TOGGLE_SELECTION"){const[o,i]=s.getFocus();return t.togglePoint(o,i),this.tableScope.repaint(),!0}}}return!1}createRangeByEvents(e,t){t||(t=e);const s=Math.min(e.rowIndex,t==null?void 0:t.rowIndex),o=Math.max(e.rowIndex,t==null?void 0:t.rowIndex),i=Math.min(e.columnIndex,t==null?void 0:t.columnIndex),l=Math.max(e.columnIndex,t==null?void 0:t.columnIndex);return A.create({rowIndex1:s,columnIndex1:i,rowIndex2:o,columnIndex2:l})}}class ht{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","ctrl+a":"SELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+x":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","meta -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class gt{get(){return{f2:"START_EDITING",space:"TOGGLE_SELECTION","ctrl+num_add":"SELECT_ALL","meta+a":"SELECT_ALL","ctrl+a":"SELECT_ALL","meta+x":"DESELECT_ALL","meta+shift+a":"DESELECT_ALL","ctrl+shift+a":"DESELECT_ALL","ctrl+num_subtract":"DESELECT_ALL","ctrl -":"DESELECT_ALL",arrowup:"NAVIGATE_UP",arrowdown:"NAVIGATE_DOWN",arrowleft:"NAVIGATE_LEFT",arrowright:"NAVIGATE_RIGHT","meta+c":"COPY_2_CLIPBOARD","ctrl+c":"COPY_2_CLIPBOARD"}}}class ut{constructor(e){this.tableScope=e,this.shortcutActionIdMapping={},this.listener=[],this.listener.push(e),this.init()}addListener(e){this.listener.includes(e)||this.listener.push(e)}init(){this.assignPredefinedSystemShortcutMappings(),Object.assign(this.shortcutActionIdMapping,this.tableScope.tableOptions.shortcutActionIdMapping),this.isDebug()&&console.debug("ShortcutService",this.shortcutActionIdMapping),this.tableScope.hostElement.addEventListener("keydown",this.onKeyDown.bind(this))}assignPredefinedSystemShortcutMappings(){this.isMacintosh()?Object.assign(this.shortcutActionIdMapping,new gt().get()):Object.assign(this.shortcutActionIdMapping,new ht().get())}isMacintosh(){return navigator.platform.indexOf("Mac")>-1}isDebug(){return this.isLocalhost()}isLocalhost(){return location.hostname==="localhost"||location.hostname==="127.0.0.1"}onKeyDown(e){const t=this.findEntity(e);t&&this.emit(t)&&(e.preventDefault(),e.stopPropagation())}emit(e){this.isDebug()&&console.debug("ShortcutService emit :",e);let t=!1;for(const s of this.listener)s.onActionTriggered(e)&&(t=!0);return t}findEntity(e){const t=this.getTokenByEvent(e);this.isDebug()&&console.debug("ShortcutService tokens :",t);for(const s in this.shortcutActionIdMapping){const o=s.replace(/opt/g,"alt").replace(/cmd/g,"meta").split(/[+ ]/g).sort();if(this.areTokensEquals(t,o))return this.shortcutActionIdMapping[s]}}areTokensEquals(e,t){if(e.length!==t.length||e.length===0)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}getTokenByEvent(e){const t=[];return e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),e.code&&t.push(e.code.toLowerCase().replace(/key/g,"")),t.sort()}getShortcutActionMapping(){return this.shortcutActionIdMapping}}class be{onCheckboxChanged(e){}onContextmenu(e){}onModelChanged(e){}onMouseClicked(e){}onMouseDragging(e){}onMouseDraggingEnd(e){}onMouseMoved(e){}onSelectionChanged(e){}onFocusChanged(e){}}class Me{setStyle(e,t,s){return e.style[t]=s,e}appendText(e,t){const s=this.createText(t);return this.appendChild(e,s),s}addClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.add(s)):e.classList.add(t),e}removeClass(e,t){return t.includes(" ")?t.split(" ").forEach(s=>e.classList.remove(s)):e.classList.remove(t),e}appendChild(e,t){e.appendChild(t)}createElement(e){return document.createElement(e)}createText(e){return document.createTextNode(e)}setAttribute(e,t,s){e.setAttribute(t,s)}}class pt{render(e,t,s,o,i,l,n){if(i.isEditable(t,s)){n.addClass(e,"ge-table-row-input-div");const a=i.getValueAt(t,s);e.innerHTML=`
9
9
  <input
10
10
  type="text"
11
11
  value="${a}"
12
12
  autofocus
13
13
  onfocus="this.setSelectionRange(0, this.value.length)"
14
14
  data-listen="change"
15
- data-area="${i}"
15
+ data-area="${o}"
16
16
  data-row-index="${t}"
17
17
  data-col-index="${s}"
18
18
  data-input-type="text"
19
19
  style="width:calc(100% - 8px);height:100%;border:0;padding:0 0 0 8px;"
20
- class="ge-table-cell-editor-input">`}}}class at{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1}getSelectionCount(e,t){let s=0;for(const i of this.ranges)i.isInRange(e,t)&&s++;return this.allSelected&&s++,this.isInNegativeRange(e,t)&&(s=0),s}isInNegativeRange(e,t){for(const s of this.negativeRanges)if(s.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1}hasSelection(){return!!this.ranges.length}selectAll(){this.allSelected=!0}addSelection(e){this.addRange(e)}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=D.singleRow(e.r1):this.selectionType==="column"&&(t=D.singleColumn(e.c1)),this.negativeRanges.push(t)}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(D.singleCell(e,t)):this.addSelection(D.singleCell(e,t))}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[]),this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,this.ranges.push(e))}}class dt{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0)}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}const ht=new at,ct=new dt("cell");class we{constructor(){this.overflowX="auto",this.overflowY="auto",this.horizontalBorderVisible=!0,this.verticalBorderVisible=!0,this.footerSeparatorBorderVisible=!0,this.headerSeparatorBorderVisible=!0,this.fixedEastSeparatorBorderVisible=!0,this.fixedWestSeparatorBorderVisible=!0,this.tableTopBorderVisible=!0,this.tableBottomBorderVisible=!0,this.hoverRowVisible=!0,this.hoverColumnVisible=!0,this.columnsResizable=!0,this.columnsDraggable=!0,this.columnResizeHandleWidthInPx=4,this.defaultRowHeights={header:34,body:34,footer:34},this.footerVerticalSeparator=!1,this.headerToggleExpandCollapseIcons=!1,this.headerVerticalSeparator=!1,this.treeOptions=new be,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new ye,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new nt,this.getSelectionModel=()=>ht,this.getFocusModel=()=>ct}}class re extends Ze{constructor(e,t,s,i,o){var r;if(super(e,t,new ke(s),i),this.eventListener=o,this.selectionService=new it(this),this.api=new Xe(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,o||(this.eventListener=new ce),(r=this.tableOptions)!=null&&r.autoRestoreOptions){const n=this.tableOptions.autoRestoreOptions,a=n.getStorageKeyFn;a&&(n.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new Ke(a)),n.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new Ye(a)),n.autoRestoreSortingState&&(this.storeSortingService=new Ue(a)))}this.mouseHandler=new je(this),this.inputHandler=new tt(this),this.shortcutService=new rt(this),this.shortcutService.addListener(this.selectionService)}static create(e,t,s=new we,i=new ce,o=new ve){return new re(e,t,o,s,i)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[s,i]=t.getFocus();this.tableModel.getBodyModel().isEditable(s,i)&&(this.clearSelection(),this.initRenderEditor(s,i))}return!0}return!1}updateModelValueAfterEdit(e,t,s,i){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,i)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(le.createSingle(t,s)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new se;if(t.originalEvent=e,e){const s=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(s),t.rowIndex=this.getNumberByAttr(s,"data-row-index"),t.columnIndex=this.getNumberByAttr(s,"data-col-index"),t.action=this.getStringByAttr(s,"data-ge-action"),t.areaIdent){const i=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=i.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const i=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,o=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(o,i)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&this.repaint(),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var s;const t=this.tableModel.getBodyModel();ee(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var a;const i=this.tableModel.getAreaModel(s),o=i.isRowChecked(e),r=o===void 0||o==="semi"||o==="none";i.setRowChecked(e,r),this.repaint();const n=(a=i.rowSelectionModel)==null?void 0:a.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){const i=this.getFocusModel();i&&(s=i.hasChanged(),i.clearChanged(),s&&this.resetEditorRenderer())}this.eventListener.onMouseClicked(e),s&&this.debounce(this.repaint.bind(this),10)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,s){var o,r;const i=this.tableModel.getColumnDef(s);if(i!=null&&i.sortable&&i.sortable()){e.preventDefault(),e.stopPropagation();const n=i.sortStatesOrder?i.sortStatesOrder:this.tableOptions.sortOrder,a=i.sortState??"",h=n[(n.indexOf(a)+1)%n.length],d=new et(s,h);this.tableModel.doSort([d])&&((o=this.tableModel.getColumnDefs())==null||o.forEach(p=>p.sortState=""),i.sortState=h),this.repaint(),(r=this.storeSortingService)==null||r.setSortItems([d])}}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const s=this.getFocusModel();if(s){const[i,o]=s.getFocus();return s.setFocus(i+t,o+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var s;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(s=this.mouseHandler.mouseEvent)==null?void 0:s.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const s=this.storeScrollPosStateService.getScrollOffset();s&&this.scrollViewport.scrollTo(...s)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const s=this.storeSortingService.getSortItems();s!=null&&s.length&&this.tableModel.getBodyModel().doSort(s)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const s=this.tableOptions.autoRestoreOptions,i=s.getRowId;if(s.autoRestoreCollapsedExpandedState&&i){const o=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),r=this.tableModel.getAreaModel("body");if(ee(r)){const n=r,a=r.getRowCount();for(let h=0;h<a;h++){const d=r.getRowByIndex(h);if(d)if(o.allExpanded)d.expanded=!0;else if(o.allCollapsed)d.expanded=!1;else{const c=i(d.data);o.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(c):o.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(c))}}n.recalcVisibleTreeRows()}}}}}const ut=We("<div>"),pt=l=>{let e;const t=me({tableModel:null,tableOptions:new we},l);return Me(()=>{const s={onCheckboxChanged:r=>{const n=new CustomEvent("checkboxChanged",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onContextmenu:r=>{const n=new CustomEvent("contextmenu",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onModelChanged:r=>{const n=new CustomEvent("modelChanged",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onMouseClicked:r=>{const n=new CustomEvent("mouseClicked",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onMouseDragging:r=>{const n=new CustomEvent("mouseDragging",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onMouseDraggingEnd:r=>{const n=new CustomEvent("mouseDraggingEnd",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)},onMouseMoved:r=>{const n=new CustomEvent("mouseMoved",{detail:r,bubbles:!0});e&&e.dispatchEvent(n)}},i=new re(e,t.tableModel,new ve,t.tableOptions,s);i.firstInit();const o=new CustomEvent("tableReady",{detail:i.getApi(),bubbles:!0});e&&e.dispatchEvent(o)}),(()=>{const s=ut(),i=e;return typeof i=="function"?He(i,s):e=s,s})()};exports.ComponentRendererWrapper=Ge;exports.GuiexpertTable=pt;exports.GuiexpertTableProps=_e;
20
+ class="ge-table-cell-editor-input">`}}}class bt{constructor(e="none",t="single"){this.selectionType=e,this.selectionMode=t,this.ranges=[],this.negativeRanges=[],this.allSelected=!1}firstClick(e,t){this.selectionType==="row"?this.addRange(A.singleRow(e)):this.selectionType==="column"&&this.addRange(A.singleColumn(t))}getSelectionCount(e,t){let s=0;for(const o of this.ranges)o.isInRange(e,t)&&s++;return this.allSelected&&s++,this.isInNegativeRange(e,t)&&(s=0),s}isInNegativeRange(e,t){for(const s of this.negativeRanges)if(s.isInRange(e,t))return!0;return!1}getRanges(){return this.ranges}clear(){this.ranges=[],this.negativeRanges=[],this.allSelected=!1}hasSelection(){return this.allSelected||!!this.ranges.length}hasNoSelection(){return!this.hasSelection()}getMergedRowIndices(){const e=new Set;for(const t of this.ranges)for(let s=t.r1;s<=t.r2;s++)!e.has(s)&&!this.isInNegativeRange(s,0)&&e.add(s);return Array.from(e)}selectAll(){this.allSelected=!0}isAllSelected(){return this.allSelected}addSelection(e){this.addRange(e)}removeSelection(e){if(this.selectionType==="none")return;let t=e;this.selectionType==="row"?t=A.singleRow(e.r1):this.selectionType==="column"&&(t=A.singleColumn(e.c1)),this.negativeRanges.push(t)}togglePoint(e,t){this.getSelectionCount(e,t)>0?this.removeSelection(A.singleCell(e,t)):this.addSelection(A.singleCell(e,t))}isSelected(e,t){return this.getSelectionCount(e,t)>0}addRange(e){this.selectionType!=="none"&&(this.allSelected=!1,this.selectionMode==="single"&&(this.ranges=[]),this.selectionType==="row"?(e.c1=0,e.c2=Number.MAX_SAFE_INTEGER):this.selectionType==="column"?(e.r1=0,e.r2=Number.MAX_SAFE_INTEGER):this.selectionType==="cell"?(e.r2=e.r1,e.c2=e.c1):this.selectionType,this.ranges.push(e))}}class ft{constructor(e="none"){this.selectionType=e,this.rowIndex=-1,this.columnIndex=-1,this.changed=!1}clearChanged(){this.changed=!1}hasChanged(){return this.changed}clear(){this.rowIndex=-1,this.columnIndex=-1}setFocus(e,t){(this.rowIndex!==e||this.columnIndex!==t)&&(this.rowIndex=e,this.columnIndex=t,this.changed=!0)}hasFocus(e,t){return this.rowIndex===e&&this.columnIndex===t}getFocus(){return[this.rowIndex,this.columnIndex]}}class Re{constructor(e=new I("❯","",["gt-table-icon-expanded"]),t=new I("❯","transform: rotate(180deg) translate(-100%, -100%); transform-origin: 0 0;",["ge-table-icon-collapsed"])){this.iconExpanded=e,this.iconCollapsed=t}}const St=new bt,mt=new ft("cell");class Te{constructor(){this.overflowX="auto",this.overflowY="auto",this.horizontalBorderVisible=!0,this.verticalBorderVisible=!0,this.footerSeparatorBorderVisible=!0,this.headerSeparatorBorderVisible=!0,this.fixedEastSeparatorBorderVisible=!0,this.fixedWestSeparatorBorderVisible=!0,this.tableTopBorderVisible=!0,this.tableBottomBorderVisible=!0,this.hoverRowVisible=!0,this.hoverColumnVisible=!0,this.columnsResizable=!0,this.columnsDraggable=!0,this.columnResizeHandleWidthInPx=4,this.defaultRowHeights={header:34,body:34,footer:34},this.footerVerticalSeparator=!1,this.headerToggleExpandCollapseIcons=!1,this.headerVerticalSeparator=!1,this.treeOptions=new Ee,this.headerGroupOptions=new Re,this.showCheckboxWihoutExtraColumn=!1,this.externalFilterFunction=void 0,this.sortedOptions=new Ae,this.sortOrder=["asc","desc"],this.getEditRenderer=(e,t)=>new pt,this.getSelectionModel=()=>St,this.getFocusModel=()=>mt}}const P=class P{createContent(e,t,s){return new Promise((o,i)=>{if(t!=null&&t.hasSelection()){const l=this.mergeRanges(t.getRanges());if(l){l.c2=Math.min(l.c2,e.getColumnCount()-1),l.r2=Math.min(l.r2,e.getBodyModel().getRowCount()-1);const n=[];for(let a=l.r1;a<=l.r2;a++){const c=[];for(let d=l.c1;d<=l.c2;d++){const h=t.isSelected(a,d)?e.getBodyModel().getTextValueAt(a,d):"";c.push(h)}n.push(c.join(P.columnSeparatorChar))}return o(n.join(P.rowSeparatorChar))}}if(s){const[l,n]=s.getFocus(),a=e.getBodyModel().getTextValueAt(l,n);return o(a)}i("Cannot copy, neither selection nor focus defined.")})}copyContent(e){return navigator.clipboard.writeText(e)}copyToClipboard(e,t,s){return new Promise((o,i)=>{this.createContent(e,t,s).then(l=>{l&&this.copyContent(l).then(n=>{o(l)}).catch(n=>{i()})}).catch(l=>{i()})})}mergeRanges(e){let t;for(const s of e)t?(t.r1=Math.min(t.r1,s.r1),t.c1=Math.min(t.c1,s.c1),t.r2=Math.max(t.r2,s.r2),t.c2=Math.max(t.c2,s.c2)):t=new A(s.r1,s.c1,s.r2,s.c2);return t}};P.columnSeparatorChar=" ",P.rowSeparatorChar=`
21
+ `;let K=P;class he extends rt{constructor(e,t,s,o,i,l=new K){var n;if(super(e,t,new Ue(s),o),this.eventListener=i,this.copyService=l,this.licenseManager=$.getInstance(),this.selectionService=new ct(this),this.api=new Qe(this),this.mouseStartAction="",this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.lastDragFrom=-1,this.lastDragTo=-1,this.firstDraggingRendering=!0,i||(this.eventListener=new be),(n=this.tableOptions)!=null&&n.autoRestoreOptions){const a=this.tableOptions.autoRestoreOptions,c=a.getStorageKeyFn;c&&(a.autoRestoreScrollPosition&&(this.storeScrollPosStateService=new Ze(c)),a.autoRestoreCollapsedExpandedState&&(this.storeStateCollapsedExpandService=new tt(c)),a.autoRestoreSortingState&&(this.storeSortingService=new st(c)))}this.mouseHandler=new Je(this),this.inputHandler=new at(this),this.shortcutService=new ut(this),this.shortcutService.addListener(this.selectionService)}static create(e,t,s=new Te,o=new be,i=new Me,l=new K){return new he(e,t,i,s,o,l)}onActionTriggered(e){if(e==="NAVIGATE_DOWN"&&this.changeFocusCell(0,1)||e==="NAVIGATE_UP"&&this.changeFocusCell(0,-1)||e==="NAVIGATE_LEFT"&&this.changeFocusCell(-1,0)||e==="NAVIGATE_RIGHT"&&this.changeFocusCell(1,0))return!0;if(e==="START_EDITING"&&this.getFocusModel){const t=this.getFocusModel();if(t){const[s,o]=t.getFocus();this.tableModel.getBodyModel().isEditable(s,o)&&(this.clearSelection(),this.initRenderEditor(s,o))}return!0}if(e==="COPY_2_CLIPBOARD"){const t=this.getSelectionModel?this.getSelectionModel():void 0,s=this.getFocusModel?this.getFocusModel():void 0;this.copyService.createContent(this.tableModel,t,s).then(o=>this.copyService.copyContent(o))}return!1}updateModelValueAfterEdit(e,t,s,o){e==="body"&&this.tableModel.getAreaModel(e).setValue(t,s,o)&&(this.resetEditorRenderer(),this.repaint(),this.eventListener.onModelChanged(ce.createSingle(t,s)),this.hostElement.focus())}getApi(){return this.api}firstInit(){var e;return this.tableModel.init(),(e=this.tableOptions)!=null&&e.externalFilterFunction&&this.externalFilterChanged(!1),this.autoRestoreCollapsedExpandedState(),this.autoRestoreSortingState(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows(),this.autoRestoreScrollPosition(),this}createGeMouseEvent(e){const t=new ne;if(t.originalEvent=e,e){const s=e.target;if([t.areaIdent,t.sideIdent]=this.getAreaAndSideIdentByAttr(s),t.rowIndex=this.getNumberByAttr(s,"data-row-index"),t.columnIndex=this.getNumberByAttr(s,"data-col-index"),t.action=this.getStringByAttr(s,"data-ge-action"),t.areaIdent){const o=this.tableModel.getAreaModel(t.areaIdent);t.rowTop=o.getYPosByRowIndex(t.rowIndex)}if(t.columnLeft=this.tableModel.getXPosByColumnIndex(t.columnIndex),e.ctrlKey&&e.altKey){const o=e.clientY-this.hostElement.offsetTop-this.areaHeaderCenter.parent.clientHeight,i=e.clientX-this.hostElement.offsetLeft-this.areaBodyWestGeo.width;this.debugOnce(i,o)}}return t}onMouseDown(e){e.columnIndex>-1&&e.action&&["resize-column","drag-column"].includes(e.action)&&(this.mouseStartWidth=this.tableModel.getColumnWidth(e.columnIndex),this.mouseStartAction=e.action,this.mouseStartColumnIndex=e.columnIndex,this.mouseStartAction==="drag-column"&&(this.firstDraggingRendering=!0,this.dragFrom=this.mouseStartColumnIndex))}mouseDraggingOnFrame(e,t){this.eventListener.onMouseDragging(e),this.mouseEvent=e,this.mouseStartColumnIndex>-1&&this.mouseStartAction==="resize-column"&&this.tableOptions.columnsResizable?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&e.columnIndex>-1&&this.tableOptions.columnsDraggable&&(this.draggingTargetColumnIndex=e.columnIndex,this.dragTo=this.draggingTargetColumnIndex,this.dragFrom>-1&&this.dragTo>-1&&this.dragFrom!==this.dragTo&&(this.lastDragFrom===this.dragTo&&this.lastDragTo===this.dragFrom||(this.tableModel.changeColumnOrder(this.dragFrom,this.dragTo),this.lastDragFrom=this.dragFrom,this.lastDragTo=this.dragTo,this.dragFrom=this.dragTo,this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows())),t&&(this.adjustDraggingColumn(e,t.columnIndex,this.firstDraggingRendering),this.firstDraggingRendering=!1),this.repaint())}mouseDraggingEndOnFrame(e){this.eventListener.onMouseDraggingEnd(e),this.draggingTargetColumnIndex=-1,this.mouseStartAction==="resize-column"?this.resizeColumn(e):this.mouseStartAction==="drag-column"&&(this.hideDraggingColumn(),this.repaint()),this.mouseStartWidth=-1,this.mouseStartColumnIndex=-1,this.dragFrom=-1,this.dragTo=-1,this.firstDraggingRendering=!0,this.mouseStartAction=""}mouseMove(e){this.eventListener.onMouseMoved(e),this.adjustHoverRows(e),this.adjustHoverColumns(e)}contextmenu(e){this.eventListener.onContextmenu(e)}toggleExpandCollapseAll(e=!0){var s;const t=this.tableModel.getBodyModel();le(t)&&(t.toggleExpandCollapseAll(e),this.repaint(),(s=this.storeStateCollapsedExpandService)==null||s.collapsedStateAll(e))}toggleRowCheckbox(e,t,s){var a;const o=this.tableModel.getAreaModel(s),i=o.isRowChecked(e),l=i===void 0||i==="semi"||i==="none";o.setRowChecked(e,l),this.repaint();const n=(a=o.rowSelectionModel)==null?void 0:a.getCheckedRows();this.eventListener.onCheckboxChanged(n||[])}onMouseClicked(e,t){let s=this.selectionService.onMouseClicked(e,t);if(!s&&this.getFocusModel){this.resetEditorRenderer();const o=this.getFocusModel();o&&(s=o.hasChanged(),o.clearChanged())}return s}debounceRepaint(){this.debounce(this.repaint.bind(this),1)}publishGeMouseEvent(e){this.eventListener.onMouseClicked(e)}onFocusChanged(e){this.eventListener.onFocusChanged(e)}onSelectionChanged(e){this.eventListener.onSelectionChanged(e)}externalFilterChanged(e=!0){const t=this.tableOptions.externalFilterFunction;t&&(e&&this.clearSelectionModel(),this.tableModel.externalFilterChanged(t),this.scrollViewport.scrollTo(0,0),this.tableModel.recalcHeightAndPadding(),this.resetSizeOfWrapperDiv(),this.repaint())}onHeaderDblClicked(e,t,s){var i,l;const o=this.tableModel.getColumnDef(s);if(o!=null&&o.sortable&&o.sortable()){e.preventDefault(),e.stopPropagation();const n=o.sortStatesOrder?o.sortStatesOrder:this.tableOptions.sortOrder,a=o.sortState??"",c=n[(n.indexOf(a)+1)%n.length],d=new nt(s,c);this.tableModel.doSort([d])&&((i=this.tableModel.getColumnDefs())==null||i.forEach(g=>g.sortState=""),o.sortState=c),this.repaint(),(l=this.storeSortingService)==null||l.setSortItems([d])}}scrollToPixel(e,t){this.scrollViewport.scrollTo(e,t)}scrollToIndex(e,t){const o=this.tableModel.getAreaModel("body").getYPosByRowIndex(t);this.scrollToPixel(0,o)}setSelectionModel(e,t=!1){const s=()=>e;this.tableOptions.getSelectionModel=s,this.getSelectionModel=s,this.selectionService.getSelectionModel=s,t&&this.repaint()}toggleHeaderGroup(e){const t=this.tableModel.getAreaModel("header");"columnDefs"in this.tableModel&&(this.tableModel.columnDefs=t.toggleHeaderGroup(e),console.info("####### !!!!!! *******, this.tableModel.columnDefs")),this.firstInit()}selectionModel(){if(this!=null&&this.getSelectionModel)return this.getSelectionModel()}focusModel(){if(this!=null&&this.getFocusModel)return this.getFocusModel()}setDragging(e){this.dragging=e,this.dragging?(this.storeColumnWidths(),this.lastDragFrom=-1,this.lastDragTo=-1):this.storedColumnWidths=[]}changeFocusCell(e,t){if(!this.isEditing()&&this.getFocusModel){const s=this.getFocusModel();if(s){const[o,i]=s.getFocus();return s.setFocus(o+t,i+e),this.repaint(),!0}}return!1}resizeColumn(e){this.tableModel.setColumnWidth(this.mouseStartColumnIndex,this.mouseStartWidth+e.draggingX),this.tableModel.recalcPadding(),this.resetSizeOfWrapperDiv(),this.adjustContainersAndRows()}clearSelectionModel(){var e;this.getSelectionModel&&((e=this.getSelectionModel())==null||e.clear())}debugOnce(e,t){var s;console.clear(),console.info("this.hostElement.offsetTop",this.hostElement.offsetTop),console.info("this.hostElement.scrollHeight",this.hostElement.scrollHeight),console.info("this.scrollViewportTop",this.scrollTop),console.info("this.areaHeaderCenter.parent.clientHeight",this.areaHeaderCenter.parent.clientHeight),console.info("bodyY",t),console.info("bodyX",e),console.info("rows",this.firstVisibleRowIndex),console.info(""),console.info("this.tableModel",this.tableModel),console.info(""),console.info("this.mouseMoveEvent.clientX",(s=this.mouseHandler.mouseEvent)==null?void 0:s.clientX),console.info("this.hostElement.offsetLeft",this.hostElement.offsetLeft),console.info("this.areaBodyWestGeo.width",this.areaBodyWestGeo.width)}autoRestoreScrollPosition(){var e;if((e=this.tableOptions)!=null&&e.autoRestoreOptions&&this.storeScrollPosStateService&&this.tableOptions.autoRestoreOptions.autoRestoreScrollPosition){const s=this.storeScrollPosStateService.getScrollOffset();s&&this.scrollViewport.scrollTo(...s)}}autoRestoreSortingState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.autoRestoreSortingState&&this.storeSortingService){const s=this.storeSortingService.getSortItems();s!=null&&s.length&&this.tableModel.getBodyModel().doSort(s)}}autoRestoreCollapsedExpandedState(){var e,t;if((t=(e=this.tableOptions)==null?void 0:e.autoRestoreOptions)!=null&&t.getRowId&&this.storeStateCollapsedExpandService){const s=this.tableOptions.autoRestoreOptions,o=s.getRowId;if(s.autoRestoreCollapsedExpandedState&&o){const i=this.storeStateCollapsedExpandService.collapsedExpandedStateGet(),l=this.tableModel.getAreaModel("body");if(le(l)){const n=l,a=l.getRowCount();for(let c=0;c<a;c++){const d=l.getRowByIndex(c);if(d)if(i.allExpanded)d.expanded=!0;else if(i.allCollapsed)d.expanded=!1;else{const h=o(d.data);i.mode==="expanded"?d.expanded=this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h):i.mode==="collapsed"&&(d.expanded=!this.storeStateCollapsedExpandService.collapsedExpandedStateIncludes(h))}}n.recalcVisibleTreeRows()}}}}}const Y=class Y{};Y.themes=["light","combat","paper","blackboard"],Y.vars={light:`html[data-theme="light"] {
22
+ --ge-table-bg: rgba(255,255,255, 0.5);
23
+ --ge-table-header-west-bg: rgba(233, 233, 233, 0.5);
24
+ --ge-table-header-center-bg: rgba(233, 233, 233, 0.5);
25
+ --ge-table-header-east-bg: rgba(233, 233, 233, 0.5);
26
+ --ge-table-header-west-text: #000;
27
+ --ge-table-header-center-text: #000;
28
+ --ge-table-header-east-text: #000;
29
+ --ge-table-header-west-horizontal-border: #ddd;
30
+ --ge-table-header-west-vertical-border: #ccc;
31
+ --ge-table-header-center-horizontal-border: #ddd;
32
+ --ge-table-header-center-vertical-border: #ccc;
33
+ --ge-table-header-east-horizontal-border: #ddd;
34
+ --ge-table-header-east-vertical-border: #ccc;
35
+ --ge-table-body-west-bg: rgba(233, 233, 233, 0.5);
36
+ --ge-table-body-center-bg: rgba(255,255,255, 0.5);
37
+ --ge-table-body-east-bg: rgba(233, 233, 233, 0.5);
38
+ --ge-table-body-west-text: #000;
39
+ --ge-table-body-center-text: #000;
40
+ --ge-table-body-east-text: #000;
41
+ --ge-table-body-west-horizontal-border: #ddd;
42
+ --ge-table-body-west-vertical-border: #ccc;
43
+ --ge-table-body-center-horizontal-border: #bbb;
44
+ --ge-table-body-center-vertical-border: #ddd;
45
+ --ge-table-body-east-horizontal-border: #ddd;
46
+ --ge-table-body-east-vertical-border: #ccc;
47
+ --ge-table-body-west-selected-range-bg: rgba(0, 152, 219, 0.4);
48
+ --ge-table-body-center-selected-range-bg: rgba(0, 152, 219, 0.4);
49
+ --ge-table-body-east-selected-range-bg: rgba(0, 152, 219, 0.4);
50
+ --ge-table-body-west-selected-range-text: #000;
51
+ --ge-table-body-center-selected-range-text: #000;
52
+ --ge-table-body-east-selected-range-text: #000;
53
+ --ge-table-footer-west-bg: rgba(233, 233, 233, 0.5);
54
+ --ge-table-footer-center-bg: rgba(233, 233, 233, 0.5);
55
+ --ge-table-footer-east-bg: rgba(233, 233, 233, 0.5);
56
+ --ge-table-footer-west-text: #000;
57
+ --ge-table-footer-center-text: #000;
58
+ --ge-table-footer-east-text: #000;
59
+ --ge-table-footer-west-horizontal-border: #ddd;
60
+ --ge-table-footer-west-vertical-border: #ccc;
61
+ --ge-table-footer-center-horizontal-border: #ddd;
62
+ --ge-table-footer-center-vertical-border: #ccc;
63
+ --ge-table-footer-east-horizontal-border: #ddd;
64
+ --ge-table-footer-east-vertical-border: #ccc;
65
+ --ge-table-border: #ccc;
66
+ --ge-table-row-odd-bg: transparent;
67
+ --ge-table-row-even-bg: transparent;
68
+ --ge-table-column-odd-bg: transparent;
69
+ --ge-table-column-even-bg: transparent;
70
+ --ge-table-hover-column-bg: rgba(0, 224, 255, 0.27);
71
+ --ge-table-hover-row-bg: rgba(0, 224, 255, 0.27);
72
+ --ge-table-focus-border: rgb(0, 255, 255);
73
+ --ge-table-color-error-text: #e00034;
74
+ --ge-table-tree-arrow-collapsed-color: #e00034;
75
+ --ge-table-column-resize-handle-border: rgb(0, 255, 255);
76
+ --ge-table-dragged-col-div-bg: lightcyan;
77
+ --ge-table-drop-zone-bg: rgba(244, 255, 242, 0.6);
78
+ }`,combat:`html[data-theme="combat"] {
79
+ --ge-table-bg: #101010;
80
+ --ge-table-header-west-bg: #101010;
81
+ --ge-table-header-center-bg: #101010;
82
+ --ge-table-header-east-bg: #101010;
83
+ --ge-table-header-west-text: oklch(100% 0 0);
84
+ --ge-table-header-center-text: oklch(100% 0 0);
85
+ --ge-table-header-east-text: oklch(100% 0 0);
86
+ --ge-table-header-west-horizontal-border: oklch(100% 0 0 / 0%);
87
+ --ge-table-header-west-vertical-border: oklch(100% 0 0 / 0%);
88
+ --ge-table-header-center-horizontal-border: oklch(100% 0 0 / 0%);
89
+ --ge-table-header-center-vertical-border: oklch(100% 0 0 / 0%);
90
+ --ge-table-header-east-horizontal-border: oklch(100% 0 0 / 0%);
91
+ --ge-table-header-east-vertical-border: oklch(100% 0 0 / 0%);
92
+ --ge-table-body-west-bg: #101010;
93
+ --ge-table-body-center-bg: #101010;
94
+ --ge-table-body-east-bg: #101010;
95
+ --ge-table-body-west-text: #b6b4b4;
96
+ --ge-table-body-center-text: #b6b4b4;
97
+ --ge-table-body-east-text: #b6b4b4;
98
+ --ge-table-body-west-horizontal-border: oklch(100% 0 0 / 0%);
99
+ --ge-table-body-west-vertical-border: oklch(100% 0 0 / 0%);
100
+ --ge-table-body-center-horizontal-border: oklch(100% 0 0 / 0%);
101
+ --ge-table-body-center-vertical-border: oklch(100% 0 0 / 0%);
102
+ --ge-table-body-east-horizontal-border: oklch(100% 0 0 / 0%);
103
+ --ge-table-body-east-vertical-border: oklch(100% 0 0 / 0%);
104
+ --ge-table-body-west-selected-range-bg: oklch(20% 0.2 39.6 / 37%);
105
+ --ge-table-body-center-selected-range-bg: oklch(20% 0.2 39.6 / 37%);
106
+ --ge-table-body-east-selected-range-bg: oklch(20% 0.2 39.6 / 37%);
107
+ --ge-table-body-west-selected-range-text: #f00032;
108
+ --ge-table-body-center-selected-range-text: #f00032;
109
+ --ge-table-body-east-selected-range-text: #f00032;
110
+ --ge-table-footer-west-bg: #101010;
111
+ --ge-table-footer-center-bg: #101010;
112
+ --ge-table-footer-east-bg: #101010;
113
+ --ge-table-footer-west-text: oklch(100% 0 0);
114
+ --ge-table-footer-center-text: oklch(100% 0 0);
115
+ --ge-table-footer-east-text: oklch(100% 0 0);
116
+ --ge-table-footer-west-horizontal-border: oklch(100% 0 0 / 0%);
117
+ --ge-table-footer-west-vertical-border: oklch(100% 0 0 / 0%);
118
+ --ge-table-footer-center-horizontal-border: oklch(100% 0 0 / 0%);
119
+ --ge-table-footer-center-vertical-border: oklch(100% 0 0 / 0%);
120
+ --ge-table-footer-east-horizontal-border: oklch(100% 0 0 / 0%);
121
+ --ge-table-footer-east-vertical-border: oklch(100% 0 0 / 0%);
122
+ --ge-table-border: oklch(100% 0 0 / 0%);
123
+ --ge-table-row-odd-bg: oklch(100% 0 0 / 0%);
124
+ --ge-table-row-even-bg: oklch(100% 0 0 / 0%);
125
+ --ge-table-column-odd-bg: oklch(100% 0 0 / 0%);
126
+ --ge-table-column-even-bg: oklch(100% 0 0 / 0%);
127
+ --ge-table-hover-column-bg: oklch(34% 0.25 3.6 / 27%);
128
+ --ge-table-hover-row-bg: oklch(34% 0.25 3.6 / 27%);
129
+ --ge-table-focus-border: oklch(40% 0.25 3.6);
130
+ --ge-table-color-error-text: oklch(65% 0.31 43.2);
131
+ --ge-table-tree-arrow-collapsed-color: #e00034;
132
+ --ge-table-column-resize-handle-border: oklch(63% 0.31 43.2);
133
+ --ge-table-dragged-col-div-bg: #2c2e33;
134
+ --ge-table-drop-zone-bg: #101010;
135
+ }`,paper:`html[data-theme="paper"] {
136
+ --ge-table-bg: #e7e5df;
137
+ --ge-table-header-west-bg: oklch(80% 0.02 99 / 48%);
138
+ --ge-table-header-center-bg: oklch(80% 0.02 99 / 48%);
139
+ --ge-table-header-east-bg: oklch(80% 0.02 99 / 48%);
140
+ --ge-table-header-west-text: #111;
141
+ --ge-table-header-center-text: #111;
142
+ --ge-table-header-east-text: #111;
143
+ --ge-table-header-west-horizontal-border: oklch(100% 0 0 / 0%);
144
+ --ge-table-header-west-vertical-border: oklch(100% 0 0 / 0%);
145
+ --ge-table-header-center-horizontal-border: oklch(100% 0 0 / 0%);
146
+ --ge-table-header-center-vertical-border: oklch(100% 0 0 / 0%);
147
+ --ge-table-header-east-horizontal-border: oklch(100% 0 0 / 0%);
148
+ --ge-table-header-east-vertical-border: oklch(100% 0 0 / 0%);
149
+ --ge-table-body-west-bg: oklch(80% 0.02 99 / 48%);
150
+ --ge-table-body-center-bg: #e7e5df;
151
+ --ge-table-body-east-bg: oklch(80% 0.02 99 / 48%);
152
+ --ge-table-body-west-text: #000;
153
+ --ge-table-body-center-text: #000;
154
+ --ge-table-body-east-text: #000;
155
+ --ge-table-body-west-horizontal-border: oklch(100% 0 0 / 0%);
156
+ --ge-table-body-west-vertical-border: oklch(100% 0 0 / 0%);
157
+ --ge-table-body-center-horizontal-border: oklch(100% 0 0 / 0%);
158
+ --ge-table-body-center-vertical-border: oklch(100% 0 0 / 0%);
159
+ --ge-table-body-east-horizontal-border: oklch(100% 0 0 / 0%);
160
+ --ge-table-body-east-vertical-border: oklch(100% 0 0 / 0%);
161
+ --ge-table-body-west-selected-range-bg: #cfcdc2;
162
+ --ge-table-body-center-selected-range-bg: #cfcdc2;
163
+ --ge-table-body-east-selected-range-bg: #cfcdc2;
164
+ --ge-table-body-west-selected-range-text: #000;
165
+ --ge-table-body-center-selected-range-text: #000;
166
+ --ge-table-body-east-selected-range-text: #000;
167
+ --ge-table-footer-west-bg: oklch(80% 0.02 99 / 48%);
168
+ --ge-table-footer-center-bg: oklch(80% 0.02 99 / 48%);
169
+ --ge-table-footer-east-bg: oklch(80% 0.02 99 / 48%);
170
+ --ge-table-footer-west-text: #111;
171
+ --ge-table-footer-center-text: #111;
172
+ --ge-table-footer-east-text: #111;
173
+ --ge-table-footer-west-horizontal-border: oklch(100% 0 0 / 0%);
174
+ --ge-table-footer-west-vertical-border: oklch(100% 0 0 / 0%);
175
+ --ge-table-footer-center-horizontal-border: oklch(100% 0 0 / 0%);
176
+ --ge-table-footer-center-vertical-border: oklch(100% 0 0 / 0%);
177
+ --ge-table-footer-east-horizontal-border: oklch(100% 0 0 / 0%);
178
+ --ge-table-footer-east-vertical-border: oklch(100% 0 0 / 0%);
179
+ --ge-table-border: oklch(100% 0 0 / 0%);
180
+ --ge-table-row-odd-bg: oklch(100% 0 0 / 0%);
181
+ --ge-table-row-even-bg: oklch(100% 0 0 / 0%);
182
+ --ge-table-column-odd-bg: oklch(100% 0 0 / 0%);
183
+ --ge-table-column-even-bg: oklch(100% 0 0 / 0%);
184
+ --ge-table-hover-column-bg: oklch(5% 0.2 266.40000000000003 / 9%);
185
+ --ge-table-hover-row-bg: oklch(5% 0.2 266.40000000000003 / 9%);
186
+ --ge-table-focus-border: oklch(100% 0.19 205.20000000000002);
187
+ --ge-table-color-error-text: oklch(45% 0.25 43.2);
188
+ --ge-table-tree-arrow-collapsed-color: #e00034;
189
+ --ge-table-column-resize-handle-border: oklch(100% 0.19 205.20000000000002 / 71%);
190
+ --ge-table-dragged-col-div-bg: #2c2e33;
191
+ --ge-table-drop-zone-bg: #e7e5df;
192
+ }`,blackboard:`html[data-theme="dark"] {
193
+ --ge-table-bg: #0c1021;
194
+ --ge-table-header-west-bg: #0c1021;
195
+ --ge-table-header-center-bg: #0c1021;
196
+ --ge-table-header-east-bg: #0c1021;
197
+ --ge-table-header-west-text: #e0df85;
198
+ --ge-table-header-center-text: #e0df85;
199
+ --ge-table-header-east-text: #e0df85;
200
+ --ge-table-header-west-horizontal-border: transparent;
201
+ --ge-table-header-west-vertical-border: transparent;
202
+ --ge-table-header-center-horizontal-border: transparent;
203
+ --ge-table-header-center-vertical-border: transparent;
204
+ --ge-table-header-east-horizontal-border: transparent;
205
+ --ge-table-header-east-vertical-border: transparent;
206
+ --ge-table-body-west-bg: #0c1021;
207
+ --ge-table-body-center-bg: #0c1021;
208
+ --ge-table-body-east-bg: #0c1021;
209
+ --ge-table-body-west-text: #a7a7a7;
210
+ --ge-table-body-center-text: #a7a7a7;
211
+ --ge-table-body-east-text: #a7a7a7;
212
+ --ge-table-body-west-horizontal-border: transparent;
213
+ --ge-table-body-west-vertical-border: transparent;
214
+ --ge-table-body-center-horizontal-border: transparent;
215
+ --ge-table-body-center-vertical-border: transparent;
216
+ --ge-table-body-east-horizontal-border: transparent;
217
+ --ge-table-body-east-vertical-border: transparent;
218
+ --ge-table-body-west-selected-range-bg: #758129;
219
+ --ge-table-body-center-selected-range-bg: #758129;
220
+ --ge-table-body-east-selected-range-bg: #758129;
221
+ --ge-table-body-west-selected-range-text: oklch(100% 0 0);
222
+ --ge-table-body-center-selected-range-text: oklch(100% 0 0);
223
+ --ge-table-body-east-selected-range-text: oklch(100% 0 0);
224
+ --ge-table-footer-west-bg: #0c1021;
225
+ --ge-table-footer-center-bg: #0c1021;
226
+ --ge-table-footer-east-bg: #0c1021;
227
+ --ge-table-footer-west-text: #e0df85;
228
+ --ge-table-footer-center-text: #e0df85;
229
+ --ge-table-footer-east-text: #e0df85;
230
+ --ge-table-footer-west-horizontal-border: transparent;
231
+ --ge-table-footer-west-vertical-border: transparent;
232
+ --ge-table-footer-center-horizontal-border: transparent;
233
+ --ge-table-footer-center-vertical-border: otransparent;
234
+ --ge-table-footer-east-horizontal-border: transparent;
235
+ --ge-table-footer-east-vertical-border: transparent;
236
+ --ge-table-border: oklch(0% 0 0);
237
+ --ge-table-row-odd-bg: oklch(100% 0 0 / 0%);
238
+ --ge-table-row-even-bg: oklch(100% 0 0 / 0%);
239
+ --ge-table-column-odd-bg: oklch(100% 0 0 / 0%);
240
+ --ge-table-column-even-bg: oklch(100% 0 0 / 0%);
241
+ --ge-table-hover-column-bg: #a9a9a9;
242
+ --ge-table-hover-row-bg: #a9a9a9;
243
+ --ge-table-focus-border: #e1ff00;
244
+ --ge-table-color-error-text: #ff0040;
245
+ --ge-table-tree-arrow-collapsed-color: #e00034;
246
+ --ge-table-column-resize-handle-border: oklch(0% 0 0);
247
+ --ge-table-dragged-col-div-bg: #2c2e33;
248
+ --ge-table-drop-zone-bg: #758129;
249
+ }`};let fe=Y;const U=class U{constructor(e=new Re){this.headerGroupOptions=e}render(e,t,s,o,i,l,n){const a=l!=null&&l.data?l.data:"";if(l){const{toggle:c,visibility:d,closed:h}=l,g=c?U.toggleHeaderGroup:"";this.addText(e,o,t,s,a,g),c&&d!=="always"&&this.addArrowDiv(n,e,!h,t,s,o,g)}else this.addText(e,o,t,s,a,"")}addText(e,t,s,o,i,l){e.innerHTML=`<span
250
+ data-ge-action="${l}"
251
+ data-area="${t}"
252
+ data-row-index="${s}"
253
+ data-col-index="${o}"
254
+ >${i}</span>`}addArrowDiv(e,t,s=!0,o=-1,i=-1,l="header",n){const a=e.createElement("div");e.addClass(a,"ge-table-toggle-icon-div"),e.setStyle(a,"display","inline-block"),e.setStyle(a,"position",""),e.setStyle(a,"width","20px"),e.setStyle(a,"background","transparent"),e.setStyle(a,"cursor","pointer"),e.setAttribute(a,"data-row-index",`${o}`),e.setAttribute(a,"data-col-index",`${i}`),e.setAttribute(a,"data-area",`${l}`),e.setAttribute(a,"data-ge-action",`${n}`);let c;s?c=this.headerGroupOptions.iconExpanded:c=this.headerGroupOptions.iconCollapsed;const d=c.content,h=e.createText(d);e.appendChild(a,h),c.style&&this.applyStyleString(e,a,c.style);for(const g of c.classes)e.addClass(a,g);return e.appendChild(t,a),a}applyStyleString(e,t,s){const o=s.split(";").map(i=>i.trim()).filter(i=>i);for(const i of o){const[l,n]=i.split(":");e.setStyle(t,l.trim(),n.trim())}}};U.toggleHeaderGroup="toggleHeaderGroup";let Se=U;const yt=ze("<div>"),vt=r=>{let e;const t=xe({tableModel:null,tableOptions:new Te},r);return Fe(()=>{const s={onSelectionChanged(l){const n=new CustomEvent("selectionChanged",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onFocusChanged(l){const n=new CustomEvent("focusChanged",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onCheckboxChanged:l=>{const n=new CustomEvent("checkboxChanged",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onContextmenu:l=>{const n=new CustomEvent("contextmenu",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onModelChanged:l=>{const n=new CustomEvent("modelChanged",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onMouseClicked:l=>{const n=new CustomEvent("mouseClicked",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onMouseDragging:l=>{const n=new CustomEvent("mouseDragging",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onMouseDraggingEnd:l=>{const n=new CustomEvent("mouseDraggingEnd",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)},onMouseMoved:l=>{const n=new CustomEvent("mouseMoved",{detail:l,bubbles:!0});e&&e.dispatchEvent(n)}},o=new he(e,t.tableModel,new Me,t.tableOptions,s);o.firstInit();const i=new CustomEvent("tableReady",{detail:o.getApi(),bubbles:!0});e&&e.dispatchEvent(i),t.licenseKey&&$.getInstance().setLicenseKey(t.licenseKey)}),(()=>{const s=yt(),o=e;return typeof o=="function"?je(o,s):e=s,s})()};exports.ComponentRendererWrapper=Ke;exports.GuiexpertTable=vt;exports.GuiexpertTableProps=Ye;