@perspective-dev/viewer-datagrid 4.4.1 → 4.5.0
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/dist/cdn/perspective-viewer-datagrid.js +4 -4
- package/dist/cdn/perspective-viewer-datagrid.js.map +4 -4
- package/dist/esm/custom_elements/datagrid.d.ts +12 -17
- package/dist/esm/model/meta_columns.d.ts +1 -0
- package/dist/esm/perspective-viewer-datagrid.js +3 -3
- package/dist/esm/perspective-viewer-datagrid.js.map +4 -4
- package/dist/esm/plugin/column_config_schema.d.ts +31 -0
- package/package.json +1 -1
- package/src/ts/color_utils.ts +50 -13
- package/src/ts/custom_elements/datagrid.ts +63 -48
- package/src/ts/data_listener/format_tree_header.ts +2 -2
- package/src/ts/data_listener/formatter_cache.ts +8 -95
- package/src/ts/data_listener/index.ts +9 -3
- package/src/ts/event_handlers/click/edit_click.ts +3 -0
- package/src/ts/event_handlers/dispatch_click.ts +4 -1
- package/src/ts/event_handlers/expand_collapse.ts +4 -1
- package/src/ts/event_handlers/header_click.ts +9 -3
- package/src/ts/event_handlers/keydown/edit_keydown.ts +11 -2
- package/src/ts/event_handlers/select_region.ts +15 -4
- package/src/ts/event_handlers/sort.ts +4 -1
- package/src/ts/get_cell_config.ts +10 -3
- package/src/ts/model/column_overrides.ts +3 -5
- package/src/ts/model/create.ts +22 -5
- package/src/ts/{plugin/column_style_controls.ts → model/meta_columns.ts} +33 -62
- package/src/ts/model/toolbar.ts +11 -2
- package/src/ts/plugin/activate.ts +3 -1
- package/src/ts/plugin/column_config_schema.ts +187 -0
- package/src/ts/plugin/draw.ts +1 -0
- package/src/ts/plugin/restore.ts +6 -2
- package/src/ts/plugin/save.ts +1 -5
- package/src/ts/style_handlers/body.ts +6 -2
- package/src/ts/style_handlers/column_header.ts +6 -2
- package/src/ts/style_handlers/consolidated.ts +1 -0
- package/src/ts/style_handlers/editable.ts +6 -2
- package/src/ts/style_handlers/focus.ts +2 -0
- package/src/ts/style_handlers/group_header.ts +10 -4
- package/dist/esm/plugin/column_style_controls.d.ts +0 -28
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var se=0,$=0,Te=performance.now();function Ct(){let e=performance.now(),t=e-Te,o=se,r=$*1e3/t,s=1e3/o,i=$;return se=0,$=0,Te=e,{avg:o,real_fps:r,virtual_fps:s,num_frames:i,elapsed:t}}function Mt(e){se=(se*$+e)/($+1),$+=1}var N=new Map;async function Tt(e){return await new Promise(requestAnimationFrame),await N.get(e)?.promise}async function Se(e,t){if(N.has(e)&&(await N.get(e)?.promise,N.has(e))){await N.get(e)?.promise;return}N.set(e,Promise.withResolvers());try{return await t()}finally{let o=N.get(e);N.delete(e),o?.resolve(void 0)}}var Lt=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,kt=Lt?5e6:1e7,St=":host{position:absolute;top:0px;left:0px;right:0px;bottom:0px;overflow:scroll;overflow-anchor:none;overscroll-behavior:none;-webkit-overflow-scrolling:touch;}div.rt-virtual-panel{position:absolute;top:0;left:0;right:0;pointer-events:none;}div.rt-scroll-table-clip{position:sticky;contain:strict;overflow-anchor:none;width:100%;height:100%;}slot{position:absolute;overflow:hidden;overflow-anchor:none;}",Rt=":host ::slotted(table){--regular-table--transform-x:0px;--regular-table--transform-y:0px;--regular-table--clip-x:0px;--regular-table--clip-y:0px;}",Dt="--regular-table--clip-x",Pt="--regular-table--clip-y",Ot="--regular-table--transform-x",Ht="--regular-table--transform-y",At='<div class="rt-virtual-panel"></div><div class="rt-scroll-table-clip"><slot></slot></div>',Nt=class extends HTMLElement{m;n;i;d;A;V;z;P;C;K;s;e;t;xe;Le;table_model;o;r;async draw(e={}){return typeof e.throttle<"u"&&!e.throttle?await Le.call(this,e):await Se(this,()=>Le.call(this,e))}async flush(){await Tt(this)}J(){if(!this.r){this.r=[document.createElement("table"),document.createElement("td")],this.r[0].style.visibility="hidden",this.r[0].style.position="absolute";let e=document.createElement("tbody"),t=document.createElement("tr");this.r[1].textContent="X",t.appendChild(this.r[1]),e.appendChild(t),this.r[0].appendChild(e)}this.appendChild(this.r[0]),this.e.row_height=this.r[1].offsetHeight,this.r[0].remove()}Z(){if(this.attachShadow({mode:"open"}),!this.shadowRoot)return;let e=new CSSStyleSheet;e.replaceSync(St);let t=new CSSStyleSheet;t.replaceSync(Rt),this.m=t.cssRules[0],this.shadowRoot.adoptedStyleSheets=[e,t],this.shadowRoot.innerHTML=At;let[o,r]=this.shadowRoot.children;this.s=r,this.n=o,this.D()}D(){this.s&&(this.i==="both"||this.i==="vertical"?this.s.style.top="0px":this.s.style.removeProperty("top"),this.i==="both"||this.i==="horizontal"?this.s.style.left="0px":this.s.style.removeProperty("left"),this.i!=="both"?this.s.style.contain="none":this.s.style.removeProperty("contain"))}Q(e,t){let{start_row:o,end_row:r}=this.ee(e),{start_col:s,end_col:i}=this.T(t);return{start_col:s,end_col:i,start_row:o,end_row:r}}te({start_col:e,end_col:t,start_row:o,end_row:r}){o=Math.floor(o),r=Math.ceil(r),e=Math.floor(e),t=Math.ceil(t);let s=this.z!==e,i=this.A!==o||this.V!==r||this.P!==t;return this.z=e,this.P=t,this.A=o,this.V=r,{invalid_column:s,invalid_row:i}}B(e,t){if(e)if(this.i==="vertical"||this.i==="none"){let o=0;for(let r of this.e.indices)o+=r||0;this.n.style.width=o.toPrecision(10)+"px"}else{let o=this.ie(t);if(o!==0){let r=this.d.width+o+2;this.n.style.width=r.toPrecision(10)+"px"}else this.n.style.width="1px"}}O(e){let{row_height:t=0}=this.e,o=this.t.column_headers_length*t,r;r=Math.min(kt,e*t+o),this.n.style.height=`${r.toPrecision(10)}px`}W(e,t){let o=(this.e.row_height||0)*(e.start_row%1)||0,r=(this.table_model.l||0)+Math.floor(e.start_col);this.e.indices[r]===void 0&&(this.e.indices[r]=t?.[0]?.offsetWidth||0);let s=this.e.indices[r]*(e.start_col%1)||0;this.m.style.setProperty(Dt,`${s}px`),this.m.style.setProperty(Pt,`${o}px`),this.m.style.setProperty(Ot,`${-s}px`),this.m.style.setProperty(Ht,`${-o}px`)}T(e){if(this.i==="none"||this.i==="vertical")return{start_col:0,end_col:1/0};{let t=this.se(),o=this.table_model.num_columns()||Math.min(e,Math.ceil(this.d.width/60)),r=t+o+1;return{start_col:t,end_col:r}}}ee(e){let{height:t,containerHeight:o}=this.d,r=this.e.row_height||0,s=this.t.column_headers_length,i=Math.max(1,this.n.offsetHeight-o),n=Math.max(Math.ceil(this.scrollTop),0)/i,l=t/r-s,c=Math.max(0,(e||0)-l)*n,a=Math.max(0,Math.min(c+l,e));return{start_row:c,end_row:a}}se(){let e=this.t.row_headers_length,t=0,o=0,r=0;for(;o<this.scrollLeft;){let s=this.e.indices[t+e];r=this.scrollLeft-o,t+=1,o+=s!==void 0?s:60}return t+=r/(this.e.indices[t+e-1]||60),Math.max(0,t-1)}oe(e){let t=0;if(this.t.row_headers_length>0)for(let s of this.e.indices.slice(0,this.t.row_headers_length))t+=s||0;let o=this.t.row_headers_length,r=e;for(;t<this.d.width&&r>=0;)r--,t+=this.e.indices[r+o]||60;return Math.min(e-1,r+1)}ie(e){let t=this.t.row_headers_length,o=this.oe(e),r=t,s=0;for(;r<o+t;)s+=this.e.indices[r]||60,r++;if(r<this.e.indices.length){let i=0,n=this.t.row_headers_length;for(let l=0;l<n&&l<this.e.indices.length;l++)i+=this.e.indices[l]||0;s+=Math.max(0,(this.e.indices[r]||0)-(this.d.width-(i||0))||0)}return s}};async function Le(e){let t=performance.now();e.cache||this.table_model.ne();let{invalid_viewport:o=!0,preserve_width:r=!1}=e,{num_columns:s,num_rows:i,num_row_headers:n,num_column_headers:l,row_height:c}=await this.table_model.re(this.t);this.e.row_height=c||this.e.row_height,this.e.row_height||this.J(),n!==void 0&&(this.t.row_headers_length=n),l!==void 0&&(this.t.column_headers_length=l);let a=this.i==="none"||this.i==="horizontal",p=this.i==="none"||this.i==="vertical",d=i||0,m=s||0;this.d={width:p?1/0:this.s.clientWidth,height:a?1/0:this.s.clientHeight,containerHeight:a?1/0:this.clientHeight},this.O(d),r||this.B(o,m);let h=this.Q(d,m),{invalid_row:_,invalid_column:f}=this.te(h),g=this.C||f;if(g||_||o){let u=!0;await this.table_model.draw(this.d,this.t,this.K,r,h,m,async v=>{u&&(this.W(h,v),u=!1);for(let w of this.o)await w({detail:this})});let b=this.e.row_height;this.table_model.header.reset_header_cache(),b!==this.e.row_height&&this.O(d),r||this.B(g,m),this.C=!1}else this.W(h);Mt(performance.now()-t)}var B=new WeakMap,Vt=class{$;b;c;constructor(e){this.$=e,this.b=[],this.c=0}reset(){this.c=0}get(){this.b[this.c]||(this.b[this.c]=document.createElement(this.$));let e=this.b[this.c];return this.c+=1,e}},Re=class{e;le;f;table;cells;rows;constructor(e,t,o){this.e=e,this.le=t,this.f=new Vt("span"),this.table=o,this.cells=[],this.rows=[]}num_columns(){return this.w(Math.max(0,this.rows.length-1)).row_container.length}num_rows(){return this.cells.length}He(e,t){B.set(e,t)}_(e){if(!e)return{value:void 0};let t=B.get(e);return t||(t={value:void 0},B.set(e,t)),t}k(e,t){let{tr:o,row_container:r}=this.w(e),s=r[t];return s&&(o.removeChild(s),r.splice(t,1,void 0)),s}p(e,t){if(!(e<0||t<0))return this.cells[e]?.[t]}w(e){let t=this.rows[e];t||(t=this.rows[e]=document.createElement("tr"),this.table.appendChild(t));let o=this.cells[e];return o||(o=this.cells[e]=[]),{tr:t,row_container:o}}S(e="TD",t,o){let{tr:r,row_container:s}=this.w(t),i=s[o];if(!i)if(o<s.length){i=s[o]=document.createElement(e);let n=s.slice(o+1).find(l=>l);r.insertBefore(i,n||null)}else i=s[o]=document.createElement(e),r.appendChild(i);if(i.tagName!==e){let n=document.createElement(e);r.replaceChild(n,i),this.cells[t].splice(o,1,n),i=n}return i}I(e){for(let t=0;t<this.rows.length;t++){let o=this.rows[t],r=this.cells[t];r.length=(Array.isArray(e)?e[t]:e)||0;let s=this.cells[t].filter(n=>n!==void 0).length,i=[];for(let n=s;n<o.children.length;n++)i.push(o.children[n]);for(let n of i)n.remove()}}E(e){let t=[];for(let o=e;o<this.table.children.length;o++)t.push(this.table.children[o]);for(let o of t)o.remove();this.rows.length=e,this.cells.length=e}},zt=!1,Wt=class extends Nt{F;N;X;G;g;register_listeners(){this.addEventListener("mousedown",this.ae.bind(this)),this.addEventListener("scroll",this.L.bind(this),{passive:!0}),this.he()}async L(e){e.stopPropagation(),await this.draw({invalid_viewport:!1,cache:!0}),this.dispatchEvent(new CustomEvent("regular-table-scroll"))}he(){this.addEventListener("mousewheel",this.de.bind(this),{passive:!0}),zt&&(this.addEventListener("touchmove",this.ce.bind(this)),this.addEventListener("touchstart",this.ue.bind(this),{passive:!0}))}de(e){if(!window.hasOwnProperty("safari"))return;let t=e,{clientWidth:o,clientHeight:r,scrollTop:s,scrollLeft:i}=this;t.preventDefault(),t.returnValue=!1;let n=Math.max(1,this.n.offsetHeight-r),l=Math.max(1,this.n.offsetWidth-o);this.scrollTop=Math.max(0,Math.min(n,s+t.deltaY)),this.scrollLeft=Math.max(0,Math.min(l,i+t.deltaX)),this.L(t)}ce(e){e.stopPropagation(),e.preventDefault(),e.returnValue=!1;let{clientWidth:t,clientHeight:o}=this,r=Math.max(1,this.n.offsetHeight-o),s=Math.max(1,this.n.offsetWidth-t);this.scrollTop=Math.min(r,(this.F||0)+((this.X||0)-e.touches[0].pageY)),this.scrollLeft=Math.min(s,(this.N||0)+((this.G||0)-e.touches[0].pageX)),this.L(e)}ue(e){this.X=e.touches[0].pageY,this.G=e.touches[0].pageX,this.F=this.scrollTop,this.N=this.scrollLeft}async me(e){let t=e.target,o=t.classList.contains("rt-column-resize");for(;t.tagName!=="TD"&&t.tagName!=="TH";)if(t=t.parentElement,!this.contains(t))return;let r=B.get(t);if(o&&r){e.stopImmediatePropagation(),e.shiftKey?(this.e.override={},this.e.auto=[],this.e.indices=[]):(delete this.e.override[r.size_key],this.e.auto[r.size_key]=void 0,this.e.indices[r.size_key]=void 0),this.table_model.updateColumnWidthStyles({start_row:0,end_row:0,...this.T(0)},this.t.row_headers_length);for(let s of e.shiftKey?[this.table_model.header.cells[this.table_model.header.cells.length-1],...this.table_model.body.cells]:this.table_model.body.cells)for(let i of e.shiftKey?s:[s[r.virtual_x]])i&&i.classList.remove("rt-cell-clip");await this.draw({cache:!0})}}async fe(e){if(e.button!==0)return;let t=e.target,o=t.classList.contains("rt-column-resize");for(;t.tagName!=="TD"&&t.tagName!=="TH";)if(t=t.parentElement,!this.contains(t))return;let r=B.get(t);o&&r&&(this._e(e,t,r),e.stopImmediatePropagation())}async ae(e){let t=performance.now();this.g&&t-this.g<500?(this.g=t,await this.me(e)):(this.g=t,await this.fe(e))}_e(e,t,o){let{virtual_x:r,size_key:s}=o,i=e.pageX,n=(r||0)+t.colSpan-1,l=this.table_model.header.get_column_header(n),c=this.e.indices[s||0]||0,a=d=>Se(this,async()=>await this.pe(d,l,i,c,s||0,n)),p=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",p);let d=this.e.override[s||0],m=this.e.indices[s||0]!==d;this.e.indices[s||0]=d,m&&this.draw({cache:!0})};document.addEventListener("mousemove",a),document.addEventListener("mouseup",p)}async pe(e,t,o,r,s,i){await new Promise(requestAnimationFrame);let n=e.pageX-o,l=Math.max(1,r+n);if(this.e.override[s]=l,n<0)await this.draw({preserve_width:!0,throttle:!1,cache:!0});else{this.table_model.updateColumnWidthStyles({start_row:0,end_row:0,...this.T(0)},this.t.row_headers_length);let c=(this.e.auto[s]||0)>l;t.classList.toggle("rt-cell-clip",c);for(let a of this.table_model.body.cells){let p=a[i];p&&p.classList.toggle("rt-cell-clip",c)}}}},It=class extends Re{a;h;constructor(e,t,o){super(e,t,o),this.a=[],this.h=[]}q(e,t,o){let r=this.S("TH",t,e[t]||0);if(e[t]+=1,r.removeAttribute("colspan"),r.textContent="",o instanceof HTMLElement)r.appendChild(o);else{let i=this.f.get();i.textContent=String(o??""),r.appendChild(i)}let s=this.f.get();return s.className="rt-column-resize",r.appendChild(s),r}be(e,t,o){let r=this._(o);return r.column_header=e,r.value=t,r}we(e,t,o,r){let s=this._(o);if(s.column_header=e,s.value=t,s.size_key=Array.isArray(r)?r[0]:r,!Array.isArray(r)||r.length<=1){let i=this.e.override[s.size_key||0],n=this.e.auto[s.size_key||0]||0;i?o.classList.toggle("rt-cell-clip",n>i):o.classList.remove("rt-cell-clip")}return s}get_column_header(e){return this.S("TH",this.num_rows()-1,e)}draw(e,t,o,r,s,i,n,l,c){let a=t?.length;if(a===0)return;let p,d,m,h;l=typeof l>"u"?a-1:l;for(let _=0;_<a;_++){if(m=t[_]?t[_]:"",this.h[_]=this.h[_]||0,_<l)c&&this.a?.[_]?.[0]?.value===m?(p=this.a[_][1],this.a[_][2]+=1,o===1&&(this.a[_][0].row_header_x=Array.isArray(s)?s[0]:s),p.setAttribute("colspan",String(this.a[_][2]))):(p=this.q(this.h,_,m),d=this.be(t,m,p),this.a[_]=[d,p,1]);else{p=this.q(this.h,_,m),d=this.we(e.length>0?e:t,m,p,s),typeof h>"u"&&(h={th:p,metadata:d});for(let[f]of this.a)f.size_key=d.size_key;p.removeAttribute("colspan")}this.w(_).tr.classList.toggle("rt-autosize",_===l),p.classList.toggle("rt-group-corner",r===void 0),d&&(d.x=typeof r>"u"?r:Math.floor(r),d.column_header_y=_,d.x0=Math.floor(i),d.virtual_x=n,o===1?(d.type="corner",d.row_header_x=Array.isArray(s)?s[0]:s):(d.type="column_header",delete d.row_header_x))}return this.E(this.h.length),h=h||{th:p,metadata:d},h}clean(){this.I(this.h)}reset_header_cache(){this.h=[],this.a=[]}},Ft=class extends Re{Y(e,t,o,r,{column_name:s},{ridx_offset:i},n){let l=this.S(e,t,r),c=this._(l);c.y=t+Math.floor(i);let a=c.size_key=n||0;e==="TD"&&(c.column_header=s);let p=this.e.override[a];if(p){let d=(this.e.auto[a]||0)>p;l.classList.contains("rt-cell-clip")!==d&&l.classList.toggle("rt-cell-clip",d)}else l.classList.remove("rt-cell-clip");return c.value!==o&&(o instanceof HTMLElement?(l.textContent="",l.appendChild(o)):l.textContent=String(o??"")),c.value=o,{td:l,metadata:c}}draw(e,t,o,r=!1,s,i,n,l){let{cidx:c,column_data:a,row_headers:p,column_data_listener_metadata:d}=t,{row_height:m}=o,h,_=[],f=[],g=0,u=[],b=r?o.row_headers_length??1:1,v=Math.floor(o.ridx_offset),w=Math.ceil(o.y1),M=Math.ceil(o.x1),k=s===void 0?s:Math.floor(s),x=i===void 0?void 0:Math.floor(i),T=Math.floor((s??0)-(i??0));for(let L=0;L<b;L++){g=0;let D=c+L;for(let S of a){let y;if(r){let E=S,H=E[L],C=_[L]||1,R=this.p(g-C,D),A=this._(R),_e=u[g]||1,I=this.p(g,D-_e),xt=this._(I);if(l&&I&&(xt.value===H||H===void 0)&&!I.hasAttribute("rowspan")){let F=u[g]=_e+1;I.setAttribute("colspan",String(F)),this.k(g,D)}else if(l&&R&&A.value===H&&!R.hasAttribute("colspan")){let F=_[L]=C+1;R.setAttribute("rowspan",String(F)),this.k(g,D)}else{y=this.Y("TH",g,H,D,t,o,L);let F=y.td,U=y.metadata;F.style.display="",F.removeAttribute("rowspan"),F.removeAttribute("colspan"),U.type="row_header",U.row_header=E,U.row_header_x=L,U.y0=v,U.y1=w,U.virtual_x=L,x!==void 0&&(U.x0=x),_[L]=1,u[g]=1,f[L]=y}}else{y=this.Y("TD",g,S,c,t,o,n??0);let E=y.metadata;d&&(E.user=d[g]),E.type="body",E.x=k||0,E.x1=M,E.row_header=p?.[g]||[],E.y0=v,E.y1=w,E.dx=T,E.dy=(E.y??0)-v,E.virtual_x=c,x!==void 0&&(E.x0=x),f[0]=y}if(g++,h=y?y.metadata:h,m=m||y?.td.offsetHeight,g*(m??0)>e)break}}return this.E(g),{tds:f,ridx:g,row_height:m}}clean({ridx:e,cidx:t}){this.E(e),this.I(t)}},Ut=class{e;l=0;header;body;ge(e,t){let{start_row:o=0,start_col:r=0,end_col:s=0,end_row:i=0}=e,n=this.e.indices[(this.l||0)+Math.floor(e.start_col)]??0;return{viewport_width:0,selected_id:t,ridx_offset:o,sub_cell_offset:n,x0:r,x1:s,y1:i,row_height:this.e.row_height,row_headers_length:this.l}}Me(e,t,o,r,s,i,n,l,c,a){let p=[`${t}`],d=[],m={column_name:p,cidx:0,column_data:e,row_headers:e,first_col:!0},h=Math.floor(n),_=this.body.draw(r,m,{...s,x0:0},!0,void 0,void 0,h,a),f=[];for(let u=0;u<t;u++){let b=this.header.draw(p,Array(o).fill(""),1,void 0,u,n,u,l,c);b&&f.push(b)}for(let u=0;u<f.length;u++){let{th:b}=f[u];s.viewport_width+=this.e.indices[u]||b.offsetWidth}s.row_height=s.row_height||_.row_height;let g=e[0].length;if(!i)for(let u=0;u<t;u++){let{td:b,metadata:v}=_.tds[u]||{},{th:w,metadata:M}=f[u]||{};(b||w)&&d.push([w||b,M||v])}return{cont_body:_,first_col:!1,ye:g,last_cells:d}}ve(e,t,o,r,s,i){let n=0,l=0;for(;this.e.indices.length>s+i+n+1&&l+t.viewport_width<o;)n++,l+=this.e.indices[s+i+n]||0;if(l+t.viewport_width<o){let c=Math.min(r,e.start_col+5);e.end_col=Math.max(1,Math.min(r,c))}else e.end_col=Math.max(1,Math.min(r,e.start_col+n))}Ce(e,t,o,r,s,i,n,l,c,a){let p=t.column_headers?.[e]||[],d=t.data[e],m=t.metadata?.[e],h={column_name:p,cidx:o,column_data:d,column_data_listener_metadata:m,row_headers:t.row_headers,first_col:n},_=e+r,f=o+Math.floor(r),g=this.header.draw(p,p,void 0,_,f,r,o,l,c),u=this.body.draw(s,h,i,!1,_,r,f,a);return{cont_head:g,cont_body:u}}async Te(e,t,o,r,s,i,n,l,c){let a=Math.max(r+Math.floor(c),0),p=structuredClone(e);p.start_col=a,this.ve(p,s,i,n,l,c);let d=await t(Math.floor(p.start_col),Math.floor(p.start_row),Math.ceil(p.end_col),Math.ceil(p.end_row)),m,h;if(typeof d.column_header_merge_depth<"u"&&(m=d.column_header_merge_depth),typeof d.merge_headers<"u"&&(h=d.merge_headers),d.data.length===0)return{column_header_merge_depth:m,merge_headers:h};e.end_col=p.start_col+d.data.length;for(let _=0;_<d.data.length;_++)o.data[r+_]=d.data[_],d.metadata&&o.metadata&&(o.metadata[r+_]=d.metadata[_]),o.column_headers&&d.column_headers?.[_]&&(o.column_headers[r+_]=d.column_headers[_]);return{column_header_merge_depth:m,merge_headers:h}}M(e,t){this.body.clean({ridx:e?.ridx||0,cidx:t}),this.header.clean()}H(){this.body.f.reset(),this.header.f.reset()}},ke=class extends Ut{table;u;U;v;Se;constructor(e,t,o){super(),this.e=t,this.clear(o);let[r]=o.children,[s,i]=r.children;this.table=r,this.header=new It(t,e,s),this.body=new Ft(t,e,i)}num_columns(){return this.header.num_columns()}clear(e){e.innerHTML='<table cellspacing="0"><thead></thead><tbody></tbody></table>'}autosize_cells(e,t){let o=this.table.currentCSSZoom??1,r=[];for(let[s,i]of e){let n=s.getBoundingClientRect();r.push({cell:s,metadata:i,box:n})}for(let{metadata:s,box:i}of r)this.e.row_height=t??Math.max(10,Math.min(this.e.row_height??i.height/o,i.height/o)),s?.size_key!==void 0&&(this.e.indices[s.size_key]=i.width/o,i.width/o&&this.e.override[s.size_key]===void 0&&(this.e.auto[s.size_key]=i.width/o))}updateColumnWidthStyles(e,t){let o=[],r;for(r=0;r<t;r++){let s=this.e.override[r],i=this.e.auto[r];if(s!==void 0){let n=r+1;o.push(`thead tr.rt-autosize th:nth-of-type(${n}),`,`tbody th.rt-cell-clip:nth-last-of-type(${t-r})`,`{min-width:${s}px;max-width:${s}px;}`)}else if(i!==void 0){let n=r+1;o.push(`thead tr.rt-autosize th:nth-of-type(${n}),`,`tbody th.rt-cell-clip:nth-last-of-type(${t-r})`,`{min-width:${i}px;}`)}}for(let s=r;s<r+(Math.floor(e.end_col)-Math.floor(e.start_col));s++){let i=this.e.override[s+Math.floor(e.start_col)],n=this.e.auto[s+Math.floor(e.start_col)];if(i!==void 0){let l=s+1;o.push(`thead tr.rt-autosize th:nth-of-type(${l}),`,`tbody td.rt-cell-clip:nth-of-type(${l-r})`,`{min-width:${i}px;max-width:${i}px;}`)}else if(n!==void 0){let l=s+1;o.push(`thead tr.rt-autosize th:nth-of-type(${l}),`,`tbody td.rt-cell-clip:nth-of-type(${l-r})`,`{min-width:${n}px;}`)}}o.length>0?this.Ee(o.join(`
|
|
2
|
-
`)):this.u&&this.u.replaceSync("")}Ee(e){if(e===this.U)return;let t=this.table.getRootNode();!t||!t.adoptedStyleSheets||(this.u||(this.u=new CSSStyleSheet,t.adoptedStyleSheets=[...t.adoptedStyleSheets,this.u]),this.u.replaceSync(e),this.U=e)}async re(e){return this.v?this.v:await e.view(0,0,0,0)}ne(){this.v=void 0,this.Se=void 0}async draw(e,t,o,r,s,i,n){let{width:l,height:c}=e,a=this.v=await t.view(Math.floor(s.start_col),Math.floor(s.start_row),Math.ceil(s.end_col),Math.ceil(s.end_row)),{column_header_merge_depth:p,merge_headers:d="both"}=a,m=d==="both"||d==="row",h=d==="both"||d==="column",_=s.start_col??0;if(a.row_headers){let x=0;for(let T of a.row_headers)T.length>x&&(x=T.length);this.l=x;for(let T=0;T<a.row_headers.length;T++)a.row_headers[T].length=this.l||0}t.row_headers_length=a.num_row_headers??a.row_headers?.[0]?.length??0,t.column_headers_length=a.num_column_headers??a.column_headers?.[0]?.length??0;let{view:f,row_headers_length:g,column_headers_length:u}=t,b=this.ge(s,o),v,w=0,M=[],k=!0;if(a.row_headers?.length){let x=this.Me(a.row_headers,g,u,c,b,r,_,p,h,m);v=x.cont_body,k=x.first_col,w=x.ye,M=x.last_cells}try{let x=0,T=i-s.start_col;for(;x<T;){if(!a.data[x]){this.updateColumnWidthStyles(s,t.row_headers_length),await n(M[this.l]);let y=await this.Te(s,f,a,x,b,l,i,w,_);if(y.column_header_merge_depth!==void 0&&(p=y.column_header_merge_depth),y.merge_headers!==void 0&&(d=y.merge_headers),!a.data[x]){this.M(v,w),this.H(),this.updateColumnWidthStyles(s,t.row_headers_length),await n(M[this.l]),this.autosize_cells(M,this.e.row_height);return}}let{cont_head:L,cont_body:D}=this.Ce(x,a,w,_,c,b,k,p,h,m);if(v=D,k=!1,!r)for(let{td:y,metadata:E}of v.tds)M.push([L?.th||y,L?.metadata||E]);let S=this.e.indices[w+Math.floor(_)]||L?.th?.offsetWidth;if(!S){S=0;for(let{td:y}of v.tds)S+=y?.offsetWidth||0}if(b.viewport_width+=S,b.row_height=b.row_height||v.row_height,w++,x++,this.j(b,l)){this.M(v,w),this.updateColumnWidthStyles(s,t.row_headers_length),await n(M[this.l]),b.viewport_width=0,this.autosize_cells(M,this.e.row_height);for(let y=0;y<M.length;y++)b.viewport_width+=this.e.indices[Math.floor(_)+y]||0;if(this.j(b,l)){this.H();return}}}this.M(v,w),this.H(),this.updateColumnWidthStyles(s,t.row_headers_length),await n(M[this.l]),this.autosize_cells(M,this.e.row_height)}finally{this.M(v,w)}}j(e,t){return e.viewport_width-e.sub_cell_offset>t}},jt=["both","horizontal","vertical","none"],$t=class extends Wt{R;constructor(){super(),this.e={auto:[],override:{},indices:[]},this.o=[],this.R=!1}connectedCallback(){this.R||(this.Z(),this.register_listeners(),this.setAttribute("tabindex","0"),this.R=!0,this.table_model=new ke(this.s,this.e,this))}resetAutoSize(e){(!e||e.auto)&&(this.e.auto=[]),(!e||e.override)&&(this.e.override={}),(!e||e.indices)&&(this.e.indices=[]),(!e||e.row_height)&&(this.e.row_height=void 0)}saveColumnSizes(){return structuredClone(this.e.override)}restoreColumnSizes(e){this.e.override=structuredClone(e)}clear(){this.table_model=new ke(this.s,this.e,this)}addStyleListener(e){this.o.push(e);let t=!0;return()=>{if(!t)return;t=!1,this.o=this.o.slice();let o=this.o.indexOf(e);this.o.splice(o,1)}}removeStyleListener(e){let t=this.o.length;this.o=this.o.filter(o=>o!==e),console.assert(this.o.length===t-1,"No listener found")}getMeta(e){if(e!==void 0){if(e instanceof HTMLElement)return B.get(e);if("row_header_x"in e&&e.row_header_x&&e.row_header_x>=0){if(e.row_header_x<this.t.row_headers_length){let t=this.table_model.body.p(e.y,e.row_header_x);return this.getMeta(t)}}else if("column_header_y"in e&&e.column_header_y>=0){if(e.column_header_y<this.t.column_headers_length){let t=this.table_model.header.p(e.column_header_y,e.x);return this.getMeta(t)}}else if("dx"in e)return this.getMeta(this.table_model.body.p(e.dy,e.dx+(this.table_model.l||0)))}}getDrawFPS(){return Ct()}async scrollToCell(e,t){if(!this.t){console.warn("data listener not configured");return}let o=this.e.row_height||0;this.scrollTop=Math.ceil(o*t);let r=0;for(;e>0;)e--,r+=this.e.indices[e+this.t.row_headers_length]||60;this.scrollLeft=Math.ceil(r),await new Promise(requestAnimationFrame),await this.flush()}setDataListener(e,{virtual_mode:t="both",preserve_state:o=!1}={}){console.assert(jt.indexOf(t)>-1,`Unknown virtual_mode ${t}; valid options are "both" (default), "horizontal", "vertical" or "none"`);let r=this.i!==t;o?(console.assert(!r,"preserve_state called with modified virtual_mode"),this.t.view=e):(this.i=t,this.C=!0,this.t={view:e,row_headers_length:0,column_headers_length:0},r&&this.D())}};document.createElement("regular-table").constructor===HTMLElement&&window.customElements.define("regular-table",$t);var G=class{selected;row;column_names;removeConfigs;insertConfigs;constructor(t,o,r,s,i){this.selected=t,this.row=o,this.column_names=r,this.removeConfigs=s,this.insertConfigs=i}get removeFilters(){return this.removeConfigs.flatMap(t=>t.filter??[])}get insertFilters(){return this.insertConfigs.flatMap(t=>t.filter??[])}};function Y(e,t){return t.type==="body"||t.type==="column_header"||t.type==="corner"?e._column_types[t.x]:e._row_header_types[(t.row_header_x??0)-1]}var P=Symbol("Perspective Column Config");function V(e,t,o=!1){let r=e._config.group_by.length===0&&e._config.split_by.length===0,s=t.children[0],i=o||s?._edit_mode==="EDIT";return r&&i}var he=class{format(t){return t?"true":"false"}},Bt={float:{format:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},datetime:{format:{dateStyle:"short",timeStyle:"medium"}},date:{format:{dateStyle:"short"}}},ie=class{_formatters;constructor(){this._formatters=new Map}create_datetime_formatter(t,o){if(o.date_format?.format!=="custom"){let r={timeZone:o.date_format?.timeZone,dateStyle:o.date_format?.dateStyle==="disabled"?void 0:o.date_format?.dateStyle??"short",timeStyle:o.date_format?.timeStyle==="disabled"?void 0:o.date_format?.timeStyle??"medium"};return new Intl.DateTimeFormat(navigator.languages,r)}else{let r={timeZone:o.date_format?.timeZone,hour12:o.date_format?.hour12??!0,fractionalSecondDigits:o.date_format?.fractionalSecondDigits};return o.date_format?.year!=="disabled"&&(r.year=o.date_format?.year??"2-digit"),o.date_format?.month!=="disabled"&&(r.month=o.date_format?.month??"numeric"),o.date_format?.day!=="disabled"&&(r.day=o.date_format?.day??"numeric"),o.date_format?.weekday&&o.date_format?.weekday!=="disabled"&&(r.weekday=o.date_format.weekday),o.date_format?.hour!=="disabled"&&(r.hour=o.date_format?.hour??"numeric"),o.date_format?.minute!=="disabled"&&(r.minute=o.date_format?.minute??"numeric"),o.date_format?.second!=="disabled"&&(r.second=o.date_format?.second??"numeric"),new Intl.DateTimeFormat(navigator.languages,r)}}create_date_formatter(t,o){let r={timeZone:"utc",dateStyle:o.date_format?.dateStyle==="disabled"?void 0:o.date_format?.dateStyle??"short"};return new Intl.DateTimeFormat(navigator.languages,r)}create_number_formatter(t,o){let r=o.number_format??Bt[t]?.format;return new Intl.NumberFormat(navigator.languages,r)}create_boolean_formatter(t,o){return new he}get(t,o){let r=[t,...Object.values(o.date_format??{}),...Object.values(o.number_format??{})].join("-");return this._formatters.has(r)||(t==="date"?this._formatters.set(r,this.create_date_formatter(t,o)):t==="datetime"?this._formatters.set(r,this.create_datetime_formatter(t,o)):t==="integer"||t==="float"?this._formatters.set(r,this.create_number_formatter(t,o)):t==="boolean"?this._formatters.set(r,this.create_boolean_formatter(t,o)):this._formatters.set(r,!1)),this._formatters.get(r)}};var ue=new ie,De=1;function Pe(e,t){return ue.get(e,t)}function q(e,t,o={},r=!1){if(t===null)return null;let s=r&&this._table_schema[e]||this._schema[e]||"string",i=o[e]||{};if((s==="integer"||s==="float")&&(i?.number_fg_mode==="bar"||i?.number_fg_mode==="label-bar")){let l=Math.max(0,Math.min(De,Math.abs(t/i.fg_gradient)*De)),c=t>=0?"":"justify-self:flex-end;",a=(l*100).toFixed(2);if(i.number_fg_mode==="bar"){let p=this._div_factory.get();return p.className="psp-bar",p.setAttribute("style",`${c}width:${a}%;height:80%;top:10%;pointer-events:none;background:var(--psp-label-bar-color)`),p}else{let p=ue.get(s,i),d=p?p.format(t):t,m=this._div_factory.get();return m.className="psp-bar",m.setAttribute("style",`--label:"${d}";${c}width:${a}%;height:80%;top:10%;pointer-events:none;background:var(--psp-label-bar-color)`),m}}else if(i?.format==="link"&&s==="string"){let l=document.createElement("a");return l.setAttribute("href",t),l.setAttribute("target","_blank"),l.textContent=t,l}else if(i?.format==="bold"&&s==="string"){let l=document.createElement("b");return l.textContent=t,l}else if(i?.format==="italics"&&s==="string"){let l=document.createElement("i");return l.textContent=t,l}else{let l=ue.get(s,i);return l?l.format(t):t}}function*Oe(e=[],t,o){let r=o[P]||{};for(let s of e){let i=["TOTAL",...s],n=i[i.length-1],l=i.slice(0,i.length-1).fill(""),c=q.call(this,t[l.length-1],n,r,!0);c instanceof HTMLElement?l=l.concat(c):l=l.concat({toString:()=>c}),l.length=t.length+1,yield l}}function*He(e=[],t,o){let r=o[P]||{};for(let s of e)yield s.map((i,n)=>q.call(this,t[n],i,r,!0))}function*Ae(e=[],t,o){let r=o[P]||{};for(let s of e){let i=[""];for(let n in s)i.push(q.call(this,t[n],s[n],r,!0));yield s}}function Ne(e){let t,o,r,s,i;return async function(l,c,a,p,d){let m={},h={start_row:a,start_col:c,end_row:d,end_col:p,id:!0},_=null;if(p-c>0&&d-a>0){this._is_old_viewport=this._last_window?.start_row===a&&this._last_window?.end_row===d&&this._last_window?.start_col===c&&this._last_window?.end_col===p;let[D,S]=await Promise.all([this._view.to_columns_string(h),this._view.num_columns()]);_=S,m=JSON.parse(D);let E=Object.keys(m).filter(C=>C!=="__ROW_PATH__"&&C!=="__ID__"),H=!1;for(let C=0;C<E.length;C++)this._column_paths[h.start_col+C]!==E[C]&&(H=!0,this._column_paths[h.start_col+C]=E[C]);if(H){let[C,R]=await Promise.all([this._view.schema(),this._view.expression_schema()]);this._schema={...C,...R};for(let A=0;A<E.length;A++){let I=E[A].split("|")[this._config.split_by.length];this._is_editable[A+h.start_col]=!!this._table_schema[I],this._column_types[A+h.start_col]=this._schema[I]}}this._last_window=h,this._ids=m.__ID__||Array(d-a).fill(null).map((C,R)=>[R+a]),this._reverse_columns=this._column_paths.slice(c,p).reduce((C,R,A)=>(C.set(R,A),C),new Map),this._reverse_ids=this._ids?.reduce((C,R,A)=>(C.set(R?.join("|"),A),C),new Map)}else this._div_factory.clear(),_=await this._view.num_columns();let f=[],g=[],u=[],b=[],v=e.hasAttribute("settings");for(let D=c;D<Math.min(p,this._column_paths.length);++D){let S=this._column_paths[D],y=S.split("|"),E=m[S]||new Array(d-a).fill(null),H=Math.min(l[P]?.[y[this._config.split_by.length]]?.aggregate_depth||0,this._config.group_by.length);f.push(E.map((C,R)=>(m?.__ROW_PATH__?.[R]?.length??0)<H?"":q.call(this,y[this._config.split_by.length],C,l[P]||{}))),g.push(E),v&&y.push(""),u.push(y),b.push(S)}let w=p-c>0&&d-a>0;w&&(this.last_column_paths=o,this.last_meta=t,this.last_ids=r,this.last_reverse_ids=s,this.last_reverse_columns=i,o=b,t=g,r=this._ids,s=this._reverse_ids,i=this._reverse_columns);let M=m.__ROW_PATH__!==void 0,k=this._config.group_rollup_mode==="flat",x=Array.from((M?k?He:Oe:Ae).call(this,m.__ROW_PATH__,this._config.group_by,l)),T=w?x[0]?.length:Gt(this._config);return{num_column_headers:this._config.split_by.length+(v?2:1),num_row_headers:T,num_rows:this._num_rows,num_columns:_,row_headers:x,column_headers:u,data:f,metadata:g,column_header_merge_depth:Math.max(0,this._config.split_by.length)}}}function Gt(e){return e.group_rollup_mode==="flat"?e.group_by.length:e.group_rollup_mode==="total"||e.group_by.length===0?0:e.group_by.length+1}var Ve=new Map,J=null;function ze(e){let t=e.startsWith("#")?e.slice(1):e;if(t.length===3||t.length===4){let o=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),s=parseInt(t[2]+t[2],16);if(!isNaN(o)&&!isNaN(r)&&!isNaN(s))return[o,r,s]}else if(t.length===6||t.length===8){let o=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),s=parseInt(t.slice(4,6),16);if(!isNaN(o)&&!isNaN(r)&&!isNaN(s))return[o,r,s]}return null}function We(e){let t=e.match(/^rgba?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*[, ]\s*([\d.]+)/i);return t?[Math.round(parseFloat(t[1])),Math.round(parseFloat(t[2])),Math.round(parseFloat(t[3]))]:null}function Yt(e){if(!J){let o=document.createElement("canvas");o.width=o.height=1,J=o.getContext("2d")}if(!J)return[0,0,0];J.fillStyle="#000",J.fillStyle=e;let t=J.fillStyle;return ze(t)??We(t)??[0,0,0]}function K(e){let t=e.trim(),o=Ve.get(t);if(o)return o;let r=ze(t)??We(t)??Yt(t);return Ve.set(t,r),r}function ge(e){return Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")}function fe([e,t,o]){return`#${ge(e)}${ge(t)}${ge(o)}`}function be([e,t,o]){let r=e/255,s=t/255,i=o/255,n=Math.max(r,s,i),l=Math.min(r,s,i),c=(n+l)/2,a=n-l,p=0,d=0;return a!==0&&(d=c>.5?a/(2-n-l):a/(n+l),n===r?p=((s-i)/a+(s<i?6:0))*60:n===s?p=((i-r)/a+2)*60:p=((r-s)/a+4)*60),[p,d,c]}function ne([e,t,o]){let r=(e%360+360)%360/360;if(t===0){let l=Math.round(o*255);return[l,l,l]}let s=o<.5?o*(1+t):o+t-o*t,i=2*o-s,n=l=>(l<0&&(l+=1),l>1&&(l-=1),l<1/6?i+(s-i)*6*l:l<1/2?s:l<2/3?i+(s-i)*(2/3-l)*6:i);return[Math.round(n(r+1/3)*255),Math.round(n(r)*255),Math.round(n(r-1/3)*255)]}function qt(e,t,o=.5){return[Math.round(Math.sqrt(e[0]*e[0]*(1-o)+t[0]*t[0]*o)),Math.round(Math.sqrt(e[1]*e[1]*(1-o)+t[1]*t[1]*o)),Math.round(Math.sqrt(e[2]*e[2]*(1-o)+t[2]*t[2]*o))]}function ve(e,t){return fe(qt(K(e),[t[0],t[1],t[2]],.5))}function z([e,t,o,r],s=[255,255,255]){function i(n,l){return((1-r)*(s[n]/255)+r*(l/255))*255}return[i(0,e),i(1,t),i(2,o)]}function W([e,t,o]){return Math.sqrt(e*e*.299+t*t*.587+o*o*.114)>130?"#161616":"#ffffff"}function Jt(e){let[t,o,r]=be(e),[s,i,n]=e,[l,c,a]=ne([t-15,o,r]),[p,d,m]=ne([t+15,o,r]);return`linear-gradient(to right top,rgb(${l},${c},${a}),rgb(${s},${i},${n}) 50%,rgb(${p},${d},${m}))`}function O(e){let t=K(e),o=Jt(t);return[e,t[0],t[1],t[2],o,`rgba(${t[0]},${t[1]},${t[2]},1)`,`rgba(${t[0]},${t[1]},${t[2]},0)`]}function ye(e,t){if(e.length!==t.length)return!0;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!0;return!1}function Ie(e,t){if(e.length!==t.length)return!0;for(let o=0;o<e.length;o++){if(e[o].length!==t[o].length)return!0;for(let r=0;r<e[o].length;r++)if(e[o][r]!==t[o][r])return!0}return!1}function le(e,t,o){let r=window.getComputedStyle(e).getPropertyValue(t).trim();return r.length>0?r:o}var we=class{_name;_elements;_index;constructor(t){this._name=t,this._elements=[],this._index=0}clear(){this._index=0}get(){this._elements[this._index]||(this._elements[this._index]=document.createElement(this._name));let t=this._elements[this._index];return this._index+=1,t}};async function ae(e,t,o,r,s={}){let i=await o.get_config();if(this?.model?._config){let T=this.model._config,L=ye(T.group_by,i.group_by),D=(T.group_by.length===0||i.group_by.length===0)&&L,S=ye(T.split_by,i.split_by),y=ye(T.columns,i.columns),E=Ie(T.filter,i.filter),H=Ie(T.sort,i.sort),C=T.group_rollup_mode!==i.group_rollup_mode,R=this.model._theme!==r;this._reset_scroll_top=L,this._reset_scroll_left=S,this._reset_select=L||S||E||H||y,this._reset_column_size=C||S||L||y||R||D}let[n,l,c,a,p]=await Promise.all([t.schema(),o.num_rows(),o.schema(),o.expression_schema(),this.parentElement.getEditPort()]),d=K(le(e,"--psp--background-color","#FFFFFF")),m=O(le(e,"--psp-datagrid--pos-cell--color","#338DCD")),h=O(le(e,"--psp-datagrid--neg-cell--color","#FF5942")),_=O(ve(m[0],d)),f=O(ve(h[0],d)),g=O(le(e,"--psp-active--color","#ff0000")),u={...c,...a},b={...n,...a},v=[],w=[],M=[],k=this._edit_mode||"READ_ONLY";k==="SELECT_ROW_TREE"&&(i.group_by.length===0||i.group_rollup_mode==="flat")&&(k="READ_ONLY",this._edit_mode=k),this._edit_button.dataset.editMode=k;let x=Object.assign(s,{_edit_port:p,_view:o,_table:t,_table_schema:b,_config:i,_num_rows:l,_schema:u,_ids:[],_plugin_background:d,_color:g,_pos_fg_color:m,_neg_fg_color:h,_pos_bg_color:_,_neg_bg_color:f,_column_paths:v,_column_types:M,_theme:r,_is_editable:w,_edit_mode:k,_selection_state:{selected_areas:[],dirty:!1},_row_header_types:i.group_by.map(T=>b[T]),_series_color_map:new Map,_series_color_seed:new Map,_div_factory:s._div_factory||new we("div")});return e.setDataListener(Ne(this.parentElement).bind(x,e),{virtual_mode:window.getComputedStyle(e).getPropertyValue("--datagrid-virtual-mode")?.trim()||"both"}),x}var X=["READ_ONLY","EDIT","SELECT_ROW","SELECT_COLUMN","SELECT_REGION","SELECT_ROW_TREE"];function Kt(e){return e?e._config.group_by.length>0&&e._config.group_rollup_mode!=="flat":!1}function Q(e){if(typeof e>"u"){let t=X.indexOf(this._edit_mode);do t=(t+1)%X.length;while(X[t]==="SELECT_ROW_TREE"&&!Kt(this.model));e=X[t]}this.parentElement?.setSelection?.(),this._edit_mode=e,this.model&&(this.model._edit_mode=e,this.model._tree_selection_id=void 0,this.model._selection_state={selected_areas:[],dirty:!0}),this._edit_button!==void 0&&(this._edit_button.dataset.editMode=e)}function ee(e){typeof e>"u"&&(e=!this._is_scroll_lock),this._is_scroll_lock=e,this.classList.toggle("sub-cell-scroll-disabled",e),this._scroll_lock!==void 0&&this._scroll_lock.classList.toggle("lock-scroll",e)}function te(e,t=!1){if(!this._initialized)return;t&&(this._cached_column_sizes=e);let o=this.regular_table,r={...o.saveColumnSizes()},{group_by:s}=this.model._config,i=s?.length>0?s.length+1:0;for(let n of Object.keys(e))if(n==="__ROW_PATH__")r[i-1]=e[n];else{let l=this.model._column_paths.indexOf(n);if(l===-1)continue;r[l+i]=e[n]}o.restoreColumnSizes(r)}function oe(){if(!this._initialized)return{};if(this._cached_column_sizes){let s=this._cached_column_sizes;return this._cached_column_sizes=void 0,s}let e=this.regular_table.saveColumnSizes(),{group_by:t}=this.model._config,o=t?.length>0?t.length+1:0,r={};for(let s of Object.keys(e)){let i=Number(s);if(e[i]!==void 0){let n=i-o;n>-1?r[this.model._column_paths[n]]=e[i]:n===-1&&(r.__ROW_PATH__=e[i])}}return r}function Fe(e,t,o,r){let s=Array.from(t.children[0].children[0].children),i=s.length,n=o.hasAttribute("settings");if(i<=1?s[0]?.removeAttribute("id"):s.forEach((l,c)=>{let a=n?1:0,p=c===i-(a+1)?"psp-column-titles":c===i-a?"psp-column-edit-buttons":null;p?l.setAttribute("id",p):l.removeAttribute("id")}),o.classList.toggle("psp-menu-open",!!r),n&&i>=2){let l=Array.from(s[i-2].children),c=Array.from(s[i-1].children);if(l&&c){s.slice(0,i-2).forEach(a=>{Array.from(a.children).forEach(p=>{p.classList.toggle("psp-menu-open",!1)})});for(let a=0;a<l.length;a++){let p=l[a],d=c[a],m=p.textContent===r;if(p.classList.toggle("psp-menu-open",m),d.classList.toggle("psp-menu-open",m),e._config.columns.length>1)for(let h of t.querySelectorAll("td")){let _=t.getMeta(h);if(!_?.column_header)continue;let f=_.column_header[_.column_header.length-2]===r;h.classList.toggle("psp-menu-open",f)}}}}}function Ee(e,t,o,r){let s=e._config.group_by.length-(e._config.group_rollup_mode==="flat"?1:0),i=e._column_settings_selected_column;for(let{element:n,metadata:l}of t.cells){if(!l||l.type==="body"||l.type==="row_header")continue;let c=l.column_header?.[e._config.split_by.length],a=e._config.sort.find(u=>u[0]===c),p=typeof l.x>"u",d=l.type==="corner"&&l.row_header_x===s||!p&&(l.x+1)%e._config.columns.length===0;n.classList.toggle("psp-header-border",d),n.classList.toggle("psp-header-group",!1),n.classList.toggle("psp-header-leaf",!0),n.classList.toggle("psp-is-top",!1),n.classList.toggle("psp-header-corner",p),n.classList.toggle("psp-header-sort-asc",!r&&!!a&&a[1]==="asc"),n.classList.toggle("psp-header-sort-desc",!r&&!!a&&a[1]==="desc"),n.classList.toggle("psp-header-sort-col-asc",!r&&!!a&&a[1]==="col asc"),n.classList.toggle("psp-header-sort-col-desc",!r&&!!a&&a[1]==="col desc"),n.classList.toggle("psp-header-sort-abs-asc",!r&&!!a&&a[1]==="asc abs"),n.classList.toggle("psp-header-sort-abs-desc",!r&&!!a&&a[1]==="desc abs"),n.classList.toggle("psp-header-sort-abs-col-asc",!r&&!!a&&a[1]==="col asc abs"),n.classList.toggle("psp-header-sort-abs-col-desc",!r&&!!a&&a[1]==="col desc abs");let m=Y(e,l),h=m==="integer"||m==="float",_=m==="string",f=m==="date",g=m==="datetime";if(n.classList.toggle("psp-align-right",h),n.classList.toggle("psp-align-left",!h),n.classList.toggle("psp-menu-enabled",(_||h||f||g)&&!p&&l.column_header_y===e._config.split_by.length+1),n.classList.toggle("psp-sort-enabled",(_||h||f||g)&&!p&&l.column_header_y===e._config.split_by.length),n.classList.toggle("psp-is-width-override",o.saveColumnSizes()[l.size_key]!==void 0),e._config.columns.length>1&&i){let u=l.column_header?.[l.column_header.length-2]===i;n.classList.toggle("psp-menu-open",u)}}}var Xt={desc:"asc",asc:void 0,"desc abs":"asc abs","asc abs":void 0},Zt={desc:"asc",asc:void 0,"desc abs":"asc abs","asc abs":void 0};async function Ue(e,t,o,r,s){let i=t.getMeta(s);if(!i?.column_header)return;let n=i.column_header[e._config.split_by.length],l=r.ctrlKey||r.metaKey||r.altKey?Qt:eo,c=r.shiftKey,a=l(e,`${n}`,c);await o.restore({sort:a})}function Qt(e,t,o){let r=[],s=!1;for(let i of e._config.sort){let[n,l]=i;if(n===t){s=!0;let c=je(e,t,l,o);c&&r.push(c)}else r.push(i)}return s||r.push([t,o?"desc abs":"desc"]),r}function eo(e,t,o){for(let[r,s]of e._config.sort)if(r===t){let i=je(e,t,s,o);return i?[i]:[]}return[[t,o?"desc abs":"desc"]]}function je(e,t,o,r){let i=e._config.split_by.length>0?Zt:Xt,n=o?i[o]:"desc";if(n)return[t,n]}async function xe(e,t,o){let r=t.getMeta(o.target);if(!r||r.type!=="row_header")return;let s=o.target.classList.contains("psp-tree-label-collapse");o.shiftKey&&s?e._view.set_depth(r.row_header.filter(i=>i!==void 0).length-2):o.shiftKey?e._view.set_depth(r.row_header.filter(i=>i!==void 0).length-1):s?e._view.collapse(r.y):e._view.expand(r.y),e._num_rows=await e._view.num_rows(),e._num_columns=await e._view.num_columns(),t.draw()}function $e(e,t,o){return async r=>{let s=r;if(s.which!==1)return;let i=s.target;if(i?.tagName!=="A"){for(;i&&i.tagName!=="TD"&&i.tagName!=="TH";)if(i=i.parentElement,!i||!t.contains(i))return;if(i){if(i.classList.contains("psp-tree-label")){e._edit_mode!=="SELECT_ROW_TREE"&&xe(e,t,s);return}if(i.classList.contains("psp-menu-enabled")){let l=t.getMeta(i)?.column_header?.[e._config.split_by.length];await o.toggleColumnSettings(`${l}`)}else i.classList.contains("psp-sort-enabled")&&Ue(e,t,o,s,i)}}}}function Be(e,t,o){return async r=>{let s=r;if(s.which!==1)return;let i=s.target;if(i?.tagName!=="A"){for(;i&&i.tagName!=="TD"&&i.tagName!=="TH";)if(i=i.parentElement,!i||!t.contains(i))return;i&&i.classList.contains("psp-tree-label")&&e._edit_mode==="SELECT_ROW_TREE"&&xe(e,t,s)}}}function Ge(e){return t=>{let o=t;if(o.which!==1)return;let r=o.target;for(;r&&r.tagName!=="TD"&&r.tagName!=="TH";)if(r=r.parentElement,!r||!e.contains(r))return;r&&(r.classList.contains("psp-tree-label")&&o.offsetX<26||r.classList.contains("psp-header-leaf")&&!r.classList.contains("psp-header-corner"))&&o.stopImmediatePropagation()}}function Ce(e,t,o){let r=e.getMeta(o);if(!r)return!1;let s=t._schema[t._column_paths[r.x]],i=o.textContent||"",n=t._ids[r.y-r.y0][0];if(s==="float"||s==="integer"){let c=parseFloat(i.replace(/,/g,""));if(isNaN(c))return!1;i=c}else if(s==="date"||s==="datetime"){let c=Date.parse(i);if(isNaN(c))return!1;i=c}else s==="boolean"&&(i=i==="true"?!1:i==="false"?!0:null);let l={__INDEX__:n,[t._column_paths[r.x]]:i};return t._table.update([l],{port_id:t._edit_port,format:null}),!0}function Ye(e,t,o,r){let s=t.getMeta(r.target);if(s?.type==="body"||s?.type==="column_header"){let i=e._is_editable[s.x],n=Y(e,s)==="boolean",l=r.target.classList.contains("psp-null");i&&n&&!l&&Ce(t,e,r.target)}}function qe(e,t,o,r){return s=>{let i=s;if(V(e,o)&&r.has(t)){let n=i.target;n.classList.remove("psp-error");let l=r.get(t);r.delete(t),l.content!==n.textContent&&(Ce(t,e,n)||(n.textContent=l.content||"",n.classList.add("psp-error"),n.focus()))}}}function Je(e,t,o,r){return s=>{let n=s.target,l=t.getMeta(n);if(l?.type==="body"){let c={x:l.x,y:l.y,content:n.textContent||void 0};r.set(t,c)}}}function Ke(e,t,o,r){let s=r.get(o),i=o.getRootNode();if(s){for(let{element:n,metadata:l}of t)if(l.type==="body"&&l.x===s.x&&l.y===s.y){i.activeElement!==n&&n.focus({preventScroll:!0});return}document.activeElement!==document.body&&o.contains(i.activeElement)&&i.activeElement.blur()}}function Xe(e,t){let o=t.get(e);if(!o)return!1;let r=e.getRootNode(),s=e.children[0]?.children[1];if(s)for(let i of s.children)for(let n of i.children){let l=e.getMeta(n);if(l?.type==="body"&&l.x===o.x&&l.y===o.y)return r.activeElement!==n&&n.focus({preventScroll:!0}),!0}return document.activeElement!==document.body&&e.contains(r.activeElement)&&r.activeElement.blur(),!1}function oo(e){let t;return async function(o,r,s,i,n,l){if(t){await t;return}let c;t=new Promise(p=>c=p);let a=await e(o,r,s,i,n,l);return t=void 0,c(),a}}function Ze(e){if(e.isContentEditable){let t=e.getRootNode().getSelection()?.getRangeAt(0);if(!t)return 0;let o=t.cloneRange();return o.selectNodeContents(e),o.setEnd(t.endContainer,t.endOffset),o.toString().length}else return e.selectionStart||0}var Z=oo(async function(e,t,o,r,s,i){let n=t.getMeta(r);if(!n||n.type!=="body")return;let l=e._column_paths.length,c=e._num_rows,a=o.get(t);if(!a)return;n.x+s<l&&0<=n.x+s&&(a.x=n.x+s),n.y+i<c&&0<=n.y+i&&(a.y=n.y+i);let p=Math.max(n.x0-10,0),d=Math.min(n.x0+10,l),m=Math.max(n.y0-5,0),h=Math.min(n.y0+10,c),_=n.x0+s,f=n.y0+i;for(;!Xe(t,o)&&_>=p&&_<d&&f>=m&&f<h;)await t.scrollToCell(_,f),o.set(t,a),_+=s,f+=i});function ro(e,t,o){let r=t.getMeta(o);return r?.type==="body"&&r.y===e._num_rows-1}function Qe(e,t,o,r,s){let i=t.getRootNode().activeElement;switch(s.target.classList.remove("psp-error"),s.key){case"Enter":s.preventDefault(),ro(e,t,i)?(i.blur(),r.delete(t)):s.shiftKey?Z(e,t,r,i,0,-1):Z(e,t,r,i,0,1);break;case"ArrowLeft":Ze(i)===0&&(s.preventDefault(),Z(e,t,r,i,-1,0));break;case"ArrowUp":s.preventDefault(),Z(e,t,r,i,0,-1);break;case"ArrowRight":Ze(i)===(i.textContent?.length||0)&&(s.preventDefault(),Z(e,t,r,i,1,0));break;case"ArrowDown":s.preventDefault(),Z(e,t,r,i,0,1);break;default:}}function et(e,t,o,r){return s=>{let i=s;if(e._edit_mode==="EDIT"){if(!V(e,o))return;Qe(e,t,o,r,i)}else console.debug(`Mode ${e._edit_mode} for "keydown" event not yet implemented`)}}function tt(e,t,o){return r=>{let s=r;if(e._edit_mode==="EDIT"){if(!V(e,o))return;Ye(e,t,o,s)}}}async function re({_view:e,_config:t},o,r){let s=t.group_by,i=t.split_by,n=o>=0?o:0,l=n+1,c=await e.to_json({start_row:n,end_row:l}),p=c.map(u=>u.__ROW_PATH__)[0]||[],d=s.map((u,b)=>{let v=p[b];return v?[u,"==",v]:void 0}).filter(u=>u!==void 0),m=s.length>0?r+1:r,h=Object.keys(c[0])[m],_={row:c[0],column_names:[],config:{filter:[]}},f=[];if(h){let u=h.split("|");_.column_names=[u[i.length]],f=i.map((b,v)=>{let w=u[v];return w?[b,"==",w]:void 0}).filter(b=>b!==void 0).filter(([,,b])=>b!=="__ROW_PATH__")}let g=t.filter.concat(d).concat(f);return _.config={filter:g},_}function ot(e,t,o){return async r=>{let s=r,i=t.getMeta(s.target);if(!i||i.type!=="body")return;let{x:n,y:l}=i,{row:c,column_names:a,config:p}=await re(e,l,n);o.dispatchEvent(new CustomEvent("perspective-click",{bubbles:!0,composed:!0,detail:{row:c,column_names:a,config:p}}))}}var io="mouse-selected-area",it=(e,t,{className:o=io,selected:r=[],onSelect:s}={})=>(e.model._selection_state={selected_areas:r,dirty:!0},t.addEventListener("mousedown",no(e,t,o)),t.addEventListener("mouseover",lo(e,t,o)),t.addEventListener("mouseup",ao(e,t,o,s)),t.addStyleListener(()=>j(e,t,o)),t);function ce(e){return e==="SELECT_ROW_TREE"}var no=(e,t,o)=>r=>{let s=r;if(s.button===0&&de(e.model._edit_mode)){if(ce(e.model._edit_mode))return;e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={};let i=t.getMeta(s.target);if(i?.type==="body"&&i.x!==void 0&&i.y!==void 0){e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={x:i.x,y:i.y},e.model._selection_state.old_selected_areas=e.model._selection_state.selected_areas,e.model._selection_state.selected_areas=[];let n={x0:i.x,x1:i.x,y0:i.y,y1:i.y};e.model._selection_state.potential_selection=n,j(e,t,o,e.model._selection_state.selected_areas.concat([n]));return}}e.model._selection_state.selected_areas=[]},lo=(e,t,o)=>r=>{let s=r,i=e.model._edit_mode;if(de(i)&&!ce(i)&&e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES&&e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x!==void 0){let n=t.getMeta(s.target);if(n?.type==="body"&&n.x!==void 0&&n.y!==void 0){let l={x0:Math.min(n.x,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x),x1:Math.max(n.x,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x),y0:Math.min(n.y,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.y),y1:Math.max(n.y,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.y)};e.model._selection_state.potential_selection=l,j(e,t,o,e.model._selection_state.selected_areas.concat([l]))}}},ao=(e,t,o,r)=>s=>{let i=s,n=e.model._edit_mode;if(de(n)){let l=t.getMeta(i.target);if(!l)return;if(ce(n)){if((l.type==="body"||l.type==="row_header")&&l.y!==void 0&&l.y>=0){let c=e.model._selection_state.selected_areas;if(c.length>0&&c[0].y0===l.y)e.model._selection_state.selected_areas=[],e.model._selection_state.dirty=!0,j(e,t,o,[]),r?.(c[0],!0);else{let p={x0:0,x1:0,y0:l.y,y1:l.y};e.model._selection_state.selected_areas=[p],e.model._selection_state.dirty=!0,j(e,t,o),r?.(p,!1)}}e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={},e.model._selection_state.potential_selection=void 0;return}if((e.model._selection_state.old_selected_areas?.length??0)>0){let c=e.model._selection_state.old_selected_areas[0];if(c.x0===c.x1&&c.y0===c.y1&&l?.type==="body"&&c.x0===l.x&&c.y0===l.y){e.model._selection_state.selected_areas=[],e.model._selection_state.old_selected_areas=[],e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={},e.model._selection_state.potential_selection=void 0,j(e,t,o,[]);return}}if(e.model._selection_state.old_selected_areas=[],e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES&&e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x!==void 0&&l?.type==="body"&&l.x!==void 0&&l.y!==void 0){let c={x0:Math.min(l.x,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x),x1:Math.max(l.x,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x),y0:Math.min(l.y,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.y),y1:Math.max(l.y,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.y)};e.model._selection_state.selected_areas.push(c),j(e,t,o)}e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={},e.model._selection_state.potential_selection=void 0}};function rt(e){return e==="SELECT_COLUMN"||e==="SELECT_REGION"}function st(e){return e==="SELECT_ROW"||e==="SELECT_REGION"||e==="SELECT_ROW_TREE"}function co(e,t,{x0:o,x1:r,y0:s,y1:i}){let n={},l=t.model._edit_mode;o!==void 0&&rt(l)&&(n.start_col=o),r!==void 0&&rt(l)&&(n.end_col=r+1),s!==void 0&&st(l)&&(n.start_row=s),i!==void 0&&st(l)&&(n.end_row=i+1),e.setSelection(n)}var po={SELECT_REGION:(e,t)=>t.x0<=e.x&&e.x<=t.x1&&t.y0<=e.y&&e.y<=t.y1,SELECT_ROW:(e,t)=>t.y0<=e.y&&e.y<=t.y1,SELECT_ROW_TREE:(e,t)=>t.y0<=e.y&&e.y<=t.y1,SELECT_COLUMN:(e,t)=>t.x0<=e.x&&e.x<=t.x1};function de(e){return e==="SELECT_REGION"||e==="SELECT_ROW"||e==="SELECT_COLUMN"||e==="SELECT_ROW_TREE"}var j=(e,t,o,r)=>{let s=e.model._edit_mode;if(de(s))if(r=e.model._selection_state.selected_areas.slice(0),e.model._selection_state.potential_selection&&r.push(e.model._selection_state.potential_selection),r.length>0)co(e.parentElement,e,r[0]),ce(s)||mo(e,t,r,o);else{e.parentElement.setSelection();let i=t.querySelectorAll("tbody td");for(let n of i)n.classList.remove(o)}else if(e.model._selection_state.dirty){e.model._selection_state.dirty=!1;let i=t.querySelectorAll("tbody td, tbody th");for(let n of i)n.classList.remove(o)}},mo=(e,t,o,r)=>{let s=po[e.model._edit_mode];if(!s||o.length===0)return;let i=t.querySelectorAll("tbody td");for(let n of i){let l=t.getMeta(n);if(!l||l.type!=="body")continue;let c=!1;for(let a of o)a.x0!==void 0&&a.y0!==void 0&&a.x1!==void 0&&a.y1!==void 0&&s(l,a)&&(c=!0,e.model._selection_state.dirty=!0,n.classList.add(r));c||n.classList.remove(r)}};function nt(e,t,o,r){if(t.length===0)return;let s=e._column_settings_selected_column,i=t.length,n=r.hasAttribute("settings");if(i<=1?t[0]?.row.removeAttribute("id"):t.forEach(({row:a},p)=>{let d=n?1:0,m=p===i-(d+1)?"psp-column-titles":p===i-d?"psp-column-edit-buttons":null;m?a.setAttribute("id",m):a.removeAttribute("id")}),r.classList.toggle("psp-menu-open",!!s),n&&i>=2){let a=t[i-2],p=t[i-1];if(a&&p){t.slice(0,i-2).forEach(({cells:d})=>{d.forEach(({element:m})=>{m.classList.toggle("psp-menu-open",!1)})});for(let d=0;d<a.cells.length;d++){let m=a.cells[d]?.element,h=p.cells[d]?.element;if(!m||!h)continue;let _=m.textContent===s;m.classList.toggle("psp-menu-open",_),h.classList.toggle("psp-menu-open",_)}}}let l=e._config.split_by.length;if(l<t.length){let a=t[l];a&&Ee(e,a,o,!1)}let c=e._config.split_by.length+1;if(c<t.length){let a=t[c];a&&Ee(e,a,o,!0)}}function lt(e,t,o){let r=e._config.group_by.length,s=[],i=new Set;for(let n=0;n<t.length;n++){let{row:l,cells:c}=t[n],a=new Set;for(let p=0;p<c.length;p++){let{element:d,metadata:m}=c[p];if(!m)continue;d.style.backgroundColor="";let h=m.type==="corner"&&r>0&&m.row_header_x===r||m.type==="column_header"&&m.x>=0;d.classList.toggle("psp-align-right",!1),d.classList.toggle("psp-align-left",!1),d.classList.toggle("psp-header-group",!0),d.classList.toggle("psp-header-leaf",!1),d.classList.toggle("psp-header-border",h),d.classList.toggle("psp-header-group-corner",m.type==="corner"),d.classList.toggle("psp-color-mode-bar",!1),d.classList.toggle("psp-color-mode-label-bar",!1),d.classList.toggle("psp-header-sort-asc",!1),d.classList.toggle("psp-header-sort-desc",!1),d.classList.toggle("psp-header-sort-col-asc",!1),d.classList.toggle("psp-header-sort-col-desc",!1),d.classList.toggle("psp-sort-enabled",!1);let _=p;for(;s[n]&&s[n][_];++_);a.add(_);let f=d;for(let g=_;g<_+f.colSpan;++g)for(let u=n;u<n+f.rowSpan;++u)s[u]||(s[u]=[]),s[u][g]=!0;f.classList.toggle("psp-is-top",n===0||!i.has(_))}i=a}}function at(e,t,o,[,,,,,r,s],[,,,,,i,n],l){let c=e._ids?.[t.dy??0]?.join("|"),a=(l?(t.column_header??[]).slice(0,-1):t.column_header??[]).join("|");if(e.last_reverse_columns?.has(a)&&e.last_reverse_ids?.has(c)){let p=e.last_reverse_ids?.get(c),d=e.last_reverse_columns.get(a);e._is_old_viewport?d!==void 0&&p!==void 0&&e.last_meta?.[d]?.[p]!==void 0&&e.last_meta[d][p]>(t.user??0)?(o.style.setProperty("--pulse--background-color-start",i),o.style.setProperty("--pulse--background-color-end",n),o.style.animationName==="pulse_neg"?o.style.animation="pulse_neg2 0.5s linear":o.style.animation="pulse_neg 0.5s linear"):d!==void 0&&p!==void 0&&e.last_meta?.[d]?.[p]!==void 0&&e.last_meta[d][p]<(t.user??0)?(o.style.setProperty("--pulse--background-color-start",r),o.style.setProperty("--pulse--background-color-end",s),o.style.animationName==="pulse_pos"?o.style.animation="pulse_pos2 0.5s linear":o.style.animation="pulse_pos 0.5s linear"):p!==t.dy&&(o.style.animation=""):o.style.animation=""}else o.style.animation=""}function ct(e,t,o,r,s){let i=(r.user??0)>0,n=(r.user??0)<0,l;t?.pos_bg_color!==void 0?l=t.pos_bg_color:l=e._pos_bg_color;let c;t?.neg_bg_color!==void 0?c=t.neg_bg_color:c=e._neg_bg_color;let a=i?l:n?c:["",e._plugin_background[0],e._plugin_background[1],e._plugin_background[2],"","",""];{let[h,_,f,g]=a;if(o.style.position="",r._is_hidden_by_aggregate_depth)o.style.animation="",o.style.backgroundColor="";else if(t?.number_bg_mode==="color")o.style.animation="",o.style.backgroundColor=h;else if(t?.number_bg_mode==="gradient"){let u=Math.max(0,Math.min(1,Math.abs((r.user??0)/(t.bg_gradient??1)))),b=e._plugin_background,v=W(z([_,f,g,u],b));o.style.animation="",o.style.color=v,o.style.backgroundColor=`rgba(${_},${f},${g},${u})`}else t?.number_bg_mode==="pulse"?(at(e,r,o,l,c,s),o.style.backgroundColor=""):(t?.number_bg_mode==="disabled"||t?.number_bg_mode,o.style.animation="",o.style.backgroundColor="")}let p=t?.pos_fg_color!==void 0?i?t.pos_fg_color:n?t.neg_fg_color:["",e._plugin_background[0],e._plugin_background[1],e._plugin_background[2],"","",""]:i?e._pos_fg_color:n?e._neg_fg_color:["",e._plugin_background[0],e._plugin_background[1],e._plugin_background[2],"","",""],[d,,,,m]=p;if(r._is_hidden_by_aggregate_depth)o.style.backgroundColor="",o.style.color="";else if(t?.number_fg_mode==="disabled")if(t?.number_bg_mode==="color"){let h=e._plugin_background,_=W(z([a[1],a[2],a[3],1],h));o.style.color=_}else t?.number_bg_mode==="gradient"||(o.style.color="");else t?.number_fg_mode==="bar"?(o.style.color="",o.style.position="relative",o.style.setProperty("--psp-label-bar-color",m),o.style.setProperty("--psp-label-bar-bg",d)):t?.number_fg_mode==="label-bar"?(o.style.color="",o.style.setProperty("--psp-label-bar-color",m),o.style.setProperty("--psp-label-bar-bg",d)):(t?.number_fg_mode==="color"||!t?.number_fg_mode)&&(o.style.color=d)}function dt(e,t,o,r){let s=r.column_header?.[e._config.split_by.length],i=t?.color!==void 0?t.color:e._color,[n,l,c,a]=i;if(r._is_hidden_by_aggregate_depth)o.style.backgroundColor="",o.style.color="";else if(t?.string_color_mode==="foreground"&&r.user!==null)o.style.color=n,o.style.backgroundColor="",t?.format==="link"&&o.children[0]&&(o.children[0].style.color=n);else if(t?.string_color_mode==="background"&&r.user!==null){let p=e._plugin_background,d=W(z([l,c,a,1],p));o.style.color=d,o.style.backgroundColor=n}else if(t?.string_color_mode==="series"&&r.user!==null&&s){e._series_color_map.has(s)||(e._series_color_map.set(s,new Map),e._series_color_seed.set(s,0));let p=e._series_color_map.get(s);if(r.user&&!p.has(r.user)){let k=e._series_color_seed.get(s)??0;p.set(r.user,k),e._series_color_seed.set(s,k+1)}let d=p.get(r.user)??0,[m,h,_]=be(K(n)),f=ne([m+d*150%360,h,_]),[g,u,b]=f,v=fe(f),w=e._plugin_background,M=W(z([g,u,b,1],w));o.style.color=M,o.style.backgroundColor=v}else o.style.backgroundColor="",o.style.color=""}function pt(e,t,o,r){let s=t?.color!==void 0?t.color:e._color,[i,n,l,c]=s;if(r._is_hidden_by_aggregate_depth)o.style.backgroundColor="",o.style.color="";else if(t?.datetime_color_mode==="foreground"&&r.user!==null)o.style.color=i,o.style.backgroundColor="";else if(t?.datetime_color_mode==="background"&&r.user!==null){let a=e._plugin_background,p=W(z([n,l,c,1],a));o.style.color=p,o.style.backgroundColor=i}else o.style.backgroundColor="",o.style.color=""}function mt(e,t,o,r){if(r._is_hidden_by_aggregate_depth)o.style.backgroundColor="",o.style.color="";else{let[s]=r.user===!0?e._pos_fg_color:r.user===!1?e._neg_fg_color:["",0,0,0,""];o.style.backgroundColor="",o.style.color=s}}function _t(e,t,o,r){let s=r.value!==void 0&&r.value!==null&&r.value?.toString()?.trim().length>0,i=(r.row_header_x??0)>=e._config.group_by.length,n=t.getMeta({dx:0,dy:(r.y??0)-(r.y0??0)+1}),l=n&&n.row_header&&typeof n.row_header[(r.row_header_x??0)+1]<"u";o.classList.toggle("psp-tree-label",s&&!i),o.classList.toggle("psp-tree-label-expand",s&&!i&&!l),o.classList.toggle("psp-tree-label-collapse",s&&!i&&l),o.classList.toggle("psp-tree-leaf",s&&i)}function ht(e,t,o,r,s,i,n){let l=s?e._tree_selection_id:void 0;n.classList.toggle("flat-group-rollup-mode",e._config.group_rollup_mode==="flat");for(let{element:c,metadata:a,isHeader:p}of t){let d=a.column_header?.[e._config.split_by.length],m=Y(e,a),h=d?o[d.toString()]:void 0,_=m==="integer"||m==="float";a._is_hidden_by_aggregate_depth=e._config.group_rollup_mode==="rollup"&&(g=>g===0||g===void 0?!1:g-1<Math.min(e._config.group_by.length,h?.aggregate_depth||0))(a.row_header?.filter(g=>g!==void 0)?.length),_?ct(e,h,c,a,r):m==="boolean"?mt(e,h,c,a):m==="string"?dt(e,h,c,a):m==="date"||m==="datetime"?pt(e,h,c,a):(c.style.backgroundColor="",c.style.color=""),c.classList.toggle("psp-bool-type",m==="boolean"&&a.user!==null),c.classList.toggle("psp-null",a.value===null),c.classList.toggle("psp-align-right",!p&&_),c.classList.toggle("psp-align-left",p||!_),e._column_settings_selected_column?c.classList.toggle("psp-menu-open",d===e._column_settings_selected_column):c.classList.toggle("psp-menu-open",!1),c.classList.toggle("psp-color-mode-bar",h?.number_fg_mode==="bar"&&_),c.classList.toggle("psp-color-mode-label-bar",h?.number_fg_mode==="label-bar"&&_),p&&_t(e,n,c,a);let f=c.parentElement;if(f&&(f.dataset.y=String(a.y)),a.type!=="row_header"||a.row_header_x===a.row_header.length-1||a.row_header[a.row_header_x+1]===void 0?(c.dataset.y=String(a.y),a.type!=="row_header"?c.dataset.x=String(a.x):delete c.dataset.x):(delete c.dataset.y,delete c.dataset.x),c.classList.toggle("psp-select-region-inactive",!1),s)if(!l)c.classList.toggle("psp-select-region",!1);else{let g=e._ids[(a.y??0)-(a.y0??0)],u=l.reduce((w,M,k)=>w&&M===g[k],!0),b=g.length===l.length&&u,v=g.length!==l.length&&u;p&&a.type==="row_header"&&a.row_header_x!==void 0&&g[a.row_header_x]?c.classList.toggle("psp-select-region",!1):(c.classList.toggle("psp-select-region",b),c.classList.toggle("psp-select-region-inactive",v))}else c.classList.toggle("psp-select-region",!1);if(!p&&a.type==="body")if(i&&e._is_editable[a.x]){let u=a.column_header?.[e._config.split_by.length]?.toString();u&&m==="string"&&o[u]?.format==="link"?(c.toggleAttribute("contenteditable",!1),c.classList.toggle("boolean-editable",!1)):m==="boolean"?(c.toggleAttribute("contenteditable",!1),c.classList.toggle("boolean-editable",a.user!==null)):(i!==c.hasAttribute("contenteditable")&&c.toggleAttribute("contenteditable",i),c.classList.toggle("boolean-editable",!1))}else c.toggleAttribute("contenteditable",!1),c.classList.toggle("boolean-editable",!1)}}function ut(e,t,o,r,s){return function(){let n=o[P]||{},l=r.hasAttribute("settings"),c=t._edit_mode==="SELECT_ROW_TREE",a=V(t,r),p=V(t,r,!0);e.classList.toggle("edit-mode-allowed",p);let d=[],m=[],h=o.children[0]?.children[1];if(h)for(let f of h.children)for(let g of f.children){let u=o.getMeta(g);if(u&&(u.type==="body"||u.type==="row_header")){let b=g.tagName==="TH";d.push({element:g,metadata:u,isHeader:b})}}let _=o.children[0]?.children[0];if(_)for(let f of _.children){let g={row:f,cells:[]};for(let u of f.children){let b=o.getMeta(u);g.cells.push({element:u,metadata:b})}m.push(g)}ht(t,d,n,l,c,a,o),lt(t,m,o),nt(t,m,o,r),Ke(t,d,o,s)}}async function gt(e){let t=this.parentElement,o=await t.getTable();if(this._initialized)await ae.call(this,this.regular_table,o,e,t.getAttribute("theme"),this.model);else{if(this.innerHTML="",this.shadowRoot?this.shadowRoot.appendChild(this.regular_table):this.appendChild(this.regular_table),this.model=await ae.call(this,this.regular_table,o,e,t.getAttribute("theme")),!this.model)return;let r=this.model,s=this.regular_table,i=async(l,c)=>{if(r._edit_mode!=="SELECT_ROW_TREE")return;if(c)r._tree_selection_id=void 0;else{let h=l.y0-(r._last_window?.start_row??0);h>=0&&h<r._ids.length&&(r._tree_selection_id=r._ids[h])}let{row:a,column_names:p,config:d}=await re(r,l.y0,0),m;if(c){if((r._last_insert_configs?.length||0)>0)m=new G(!1,a,[],r._last_insert_configs??[],[]);else throw new Error("Suprious deselect");r._last_insert_configs=void 0}else m=new G(!0,a,p,r._last_insert_configs??[],[d]),r._last_insert_configs=[d];await s.draw({preserve_width:!0}),t.dispatchEvent(new CustomEvent("perspective-global-filter",{bubbles:!0,composed:!0,detail:m}))};it(this,this.regular_table,{className:"psp-select-region",onSelect:i});let n=new WeakMap;this.regular_table.addStyleListener(ut(this,this.model,this.regular_table,t,n)),this.regular_table.addEventListener("click",Ge(this.regular_table)),this.regular_table.addEventListener("click",ot(this.model,this.regular_table,t)),this.regular_table.addEventListener("mousedown",$e(this.model,this.regular_table,t)),this.regular_table.addEventListener("dblclick",Be(this.model,this.regular_table,t)),this.regular_table.addEventListener("click",tt(this.model,this.regular_table,t)),this.regular_table.addEventListener("focusin",Je(this.model,this.regular_table,t,n)),this.regular_table.addEventListener("focusout",qe(this.model,this.regular_table,t,n)),this.regular_table.addEventListener("keydown",et(this.model,this.regular_table,t,n)),t.addEventListener("perspective-toggle-column-settings",l=>{let c=l;if(this.isConnected){if(Fe(this.model,this.regular_table,t,c.detail.column_name??void 0),!c.detail.open){this.model._column_settings_selected_column=void 0;return}this.model._column_settings_selected_column=c.detail.column_name??void 0}}),this._initialized=!0}}function ft(e,t){e=JSON.parse(JSON.stringify(e)),t=JSON.parse(JSON.stringify(t));let o={};if(e.columns)for(let[i,n]of Object.entries(e.columns))n.column_size_override!==void 0&&(o[i]=n.column_size_override,delete n.column_size_override);let r={};if(t)for(let[i,n]of Object.entries(t))r[i]={...n,pos_fg_color:n.pos_fg_color?O(n.pos_fg_color):void 0,neg_fg_color:n.neg_fg_color?O(n.neg_fg_color):void 0,pos_bg_color:n.pos_bg_color?O(n.pos_bg_color):void 0,neg_bg_color:n.neg_bg_color?O(n.neg_bg_color):void 0,color:n.color?O(n.color):void 0};"edit_mode"in e&&e.edit_mode&&(X.indexOf(e.edit_mode)!==-1?Q.call(this,e.edit_mode):console.error("Unknown edit mode "+e.edit_mode)),"scroll_lock"in e&&ee.call(this,e.scroll_lock);let s=this.regular_table;te.call(this,o,!0),s[P]=r}function bt(){if(this.regular_table){let e={columns:{},scroll_lock:!!this._is_scroll_lock,edit_mode:this._edit_mode},t=oe.call(this);for(let o of Object.keys(t||{}))e.columns?.[o]||(e.columns=e.columns||{},e.columns[o]={}),e.columns[o].column_size_override=t[o];return JSON.parse(JSON.stringify(e))}return{}}async function vt(e){if(this.parentElement&&await this.activate(e),!this.isConnected||this.offsetParent==null||!this.model)return;let t=oe.call(this),o=this.regular_table.draw({invalid_columns:!0});this._reset_scroll_top&&(this.regular_table.scrollTop=0,this._reset_scroll_top=!1),this._reset_scroll_left&&(this.regular_table.scrollLeft=0,this._reset_scroll_left=!1),this._reset_select&&(this.regular_table.dispatchEvent(new CustomEvent("psp-deselect-all",{bubbles:!1})),this._reset_select=!1),this._reset_column_size&&(this.regular_table.resetAutoSize(),this._reset_column_size=!1),te.call(this,t),await o,this._toolbar?.classList.toggle("aggregated",this.model._config.group_by.length>0||this.model._config.split_by.length>0)}function Me(e,t){return e==="integer"||e==="float"?{datagrid_number_style:{fg_gradient:0,pos_fg_color:this.model._pos_fg_color[0],neg_fg_color:this.model._neg_fg_color[0],number_fg_mode:"color",bg_gradient:0,pos_bg_color:this.model._pos_bg_color[0],neg_bg_color:this.model._neg_bg_color[0],number_bg_mode:"disabled"},number_string_format:!0}:e==="date"||e==="datetime"||e==="string"?{[e==="date"||e==="datetime"?"datagrid_datetime_style":"datagrid_string_style"]:{color:this.model._color[0],bg_color:this.model._color[0]}}:null}var yt='regular-table{--psp-datagrid--hover--border-color:var(--psp-inactive--color,#c5c9d080);margin:12px 0 0 12px;padding:0;font-family:inherit;& div[tabindex]{outline:none}&>div{position:absolute;inset:0;overflow:hidden}& th{text-align:center}& thead tr:not(.rt-autosize) th{max-width:0;overflow:hidden}& thead tr:last-child .rt-float,& tbody .rt-float,& thead .rt-integer,& tbody .rt-integer{text-align:right}& tbody th{text-align:left}& span.rt-tree-container{align-items:center;height:100%;display:flex}& thead .rt-string,& tbody .rt-string,& thead .rt-date,& tbody .rt-date,& thead .rt-datetime,& tbody .rt-datetime{text-align:left}& thead tr:last-child th{border-bottom:1px solid #8b868045}& tbody tr:first-child td,& tbody tr:first-child th{border-top:1px solid #0000!important}& th{position:relative}& tr th span.rt-tree-group{border-left:1px solid #eee;height:100%;margin-left:5px;margin-right:15px}& td,& th{white-space:nowrap;height:var(--psp-datagrid--row--height,19px);padding:0 5px}& table *{box-sizing:border-box}& table{color:#666;outline:none;position:absolute}& span.rt-row-header-icon{color:#aaa;font-family:var(--psp-button--font-family);padding-right:4px}& span.rt-column-header-icon{width:10px;font-size:10px;font-family:var(--psp-button--font-family);padding-left:3px;display:inline-block}& span.rt-row-header-icon:hover{color:#1a7da1;text-shadow:0 0 3px #1a7da1}& .rt-selected td{background-color:#eee}& .rt-cell-clip{text-overflow:ellipsis;overflow:hidden}& td span.rt-group-name,& th span.rt-group-name{flex:1;height:100%;margin-right:-5px;padding-left:8px;padding-right:5px}& th span.rt-group-name{text-align:left}& td th span.rt-group-leaf,& th span.rt-group-leaf{height:100%;margin-left:16px}& .rt-column-resize{cursor:col-resize;width:10px;height:100%;position:absolute;top:0;right:0}& a{color:var(--psp-datagrid--pos-cell--color)}& a:visited{color:var(--psp-active--color)}& td.psp-null:after,& th.psp-null:after{content:var(--psp-label--null--content,"-");color:var(--psp-label--null--color,inherit);font-size:var(--psp-label--null--font-size,inherit);vertical-align:middle}}.psp-header-border:not(.psp-is-top):not(.psp-header-leaf){box-shadow:1px 0px var(--psp-inactive--border-color,#8b868045)}.psp-header-group{box-shadow:0px 10px 0 -9px var(--psp-inactive--border-color,#8b868045)}.psp-is-top{box-shadow:5px 4px 0px -4px var(--psp-inactive--border-color,#8b868045)}.psp-is-top.psp-header-group:not(.psp-header-group-corner){box-shadow:5px 4px 0px -4px var(--psp-inactive--border-color,#8b868045), 0px 10px 0 -9px var(--psp-inactive--border-color,#8b868045)}.psp-header-border.psp-header-group{&:not(.psp-is-top):not(.psp-header-group-corner){box-shadow:1px 0px var(--psp-inactive--border-color,#8b868045), 0px 10px 0 -9px var(--psp-inactive--border-color,#8b868045)}}perspective-viewer[settings] tr.rt-autosize .psp-header-leaf.psp-header-border:not(.psp-menu-enabled){box-shadow:1px 0px var(--psp-inactive--border-color,#8b868045)}:host-context(perspective-viewer[settings]) tr.rt-autosize .psp-header-leaf.psp-header-border:not(.psp-menu-enabled){box-shadow:1px 0px var(--psp-inactive--border-color,#8b868045)}.psp-header-leaf.psp-header-border{box-shadow:5px -4px 0px -4px var(--psp-inactive--border-color,#8b868045)}tr:only-child th{box-shadow:none!important}regular-table{& tbody{& tr:hover th.psp-tree-leaf:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover th.psp-tree-label:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover td:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover:after{box-shadow:0px 1px 0px var(--psp-datagrid--hover--border-color,#c5c9d080);border-color:var(--psp-datagrid--hover--border-color,#c5c9d080)!important;&.psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--color), inset 2px 0px 0px var(--psp--color), 0px 1px 0px var(--psp-datagrid--hover--border-color,#c5c9d080)}}& tr:last-child:hover td:not(.psp-select-region):not(.psp-select-region-inactive).psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--color), inset 2px 0px 0px var(--psp--color), inset 0px -2px 0px var(--psp--color), 0px 1px 0px var(--psp-datagrid--hover--border-color,#c5c9d080)}& tr:hover+tr th.psp-tree-leaf:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover+tr th.psp-tree-label:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover+tr td:not(.psp-select-region):not(.psp-select-region-inactive){border-top-color:#0000}& tr{& th:first-child:not(:empty),& th:first-child:empty+th:not(:empty),& th:first-child:empty~th:empty+th:not(:empty),& td:first-child{border-left-width:1px;border-left-color:#0000}& th:last-child,& td:last-child{border-right-width:0;border-right-color:#0000}}& tr:hover{color:inherit;& th:first-child:not(:empty),& th:first-child:empty+th:not(:empty),& th:first-child:empty~th:empty+th:not(:empty),& td:first-child{border-left-color:var(--psp-datagrid--hover--border-color,#c5c9d080)!important}& th:last-child,& td:last-child{border-right-color:var(--psp-datagrid--hover--border-color,#c5c9d080)!important}}}}perspective-viewer-datagrid:not(.sub-cell-scroll-disabled) regular-table table,:host(:not(.sub-cell-scroll-disabled)) regular-table table{& tbody td,& thead th:not(.rt-group-corner){transform:translate(var(--regular-table--transform-x,0px))}& tbody{transform:translate(0, var(--regular-table--transform-y,0px))}& tbody tr:first-child{& td,& th,&:after{clip-path:polygon(0 var(--regular-table--clip-y,0), 0 200%, 200% 200%, 200% var(--regular-table--clip-y,0))}}& tbody tr td:first-of-type{clip-path:polygon(var(--regular-table--clip-x,0) 0, var(--regular-table--clip-x,0) 200%, 200% 200%, 200% 0)}& tbody tr:first-child td:first-of-type{clip-path:polygon(var(--regular-table--clip-x,0) var(--regular-table--clip-y,0), var(--regular-table--clip-x,0) 200%, 200% 200%, 200% var(--regular-table--clip-y,0))}& thead tr:last-child:after,& tbody tr:not(:first-child):after{transform:translate(var(--regular-table--transform-x,0px))}& tbody tr:hover:first-child:after{clip-path:polygon(0 var(--regular-table--clip-y,0), 0 200%, 200% 200%, 200% var(--regular-table--clip-y,0))}& thead tr th.rt-group-corner+th:not(.rt-group-corner){clip-path:polygon(var(--regular-table--clip-x,0) 0, var(--regular-table--clip-x,0) 200%, 200% 200%, 200% 0)}}regular-table{outline:none;&::-webkit-scrollbar,&::-webkit-scrollbar-corner{background-color:#0000;width:12px;height:12px}&::-webkit-scrollbar-thumb{background-clip:content-box;background:var(--psp--color);border:5.5px solid var(--psp--background-color);min-width:10%;max-width:50%;min-height:10%;max-height:50%}}perspective-viewer,:host{& .psp-menu-enabled{border-radius:3px 3px 0 0;padding:0 6px;font-size:8px}& .psp-menu-enabled:hover,& tr:not(.rt-autosize) th.psp-menu-open{color:var(--psp--background-color);background-color:var(--psp--color);border-bottom-color:var(--psp--color);cursor:pointer}& tr:not(.rt-autosize) th.psp-menu-open{&:before{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:10px;height:8px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--column-settings--mask-image);mask-image:var(--psp-icon--column-settings--mask-image);background-color:var(--psp--background-color);margin-right:4px;display:inline-block}}& td.psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--color), inset 2px 0px 0px var(--psp--color)}& tr:first-child td.psp-menu-open{border-top-color:var(--psp--color)!important}& tr:last-child td.psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--color), inset 2px 0px 0px var(--psp--color), inset 0px -2px 0px var(--psp--color)}}perspective-viewer,:host-context(perspective-viewer){& regular-table table thead tr:last-child th{border-bottom-width:1px;border-bottom-color:var(--psp-inactive--border-color,#8b868045)}}.psp-sort-enabled:hover{cursor:pointer}regular-table.flat-group-rollup-mode.vertical-row-headers th.psp-tree-label:not(:last-of-type){writing-mode:vertical-lr}.psp-select-region-inactive,:hover .psp-select-region-inactive,:hover th.psp-tree-leaf.psp-select-region-inactive,:hover th.psp-tree-label.psp-select-region-inactive{background-color:var(--psp-inactive--color)!important;color:var(--psp--background-color)!important;border-color:var(--psp--background-color)!important}.psp-error{color:red}td:focus{outline:1px dotted #666}perspective-viewer.dragging,:host-context(perspective-viewer.dragging){& regular-table{pointer-events:none}}.psp-header-border:last-child{border-right-width:0}.psp-header-sort-desc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-desc--mask-image);mask-image:var(--psp-icon--sort-desc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-asc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-asc--mask-image);mask-image:var(--psp-icon--sort-asc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-col-desc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-col-desc--mask-image);mask-image:var(--psp-icon--sort-col-desc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-col-asc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-col-asc--mask-image);mask-image:var(--psp-icon--sort-col-asc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-abs-desc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-abs-desc--mask-image);mask-image:var(--psp-icon--sort-abs-desc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-abs-asc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-abs-asc--mask-image);mask-image:var(--psp-icon--sort-abs-asc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-abs-col-desc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-abs-col-desc--mask-image);mask-image:var(--psp-icon--sort-abs-col-desc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-abs-col-asc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-abs-col-asc--mask-image);mask-image:var(--psp-icon--sort-abs-col-asc--mask-image);margin-left:4px;display:inline-block}tbody th:last-of-type{border-right:1px solid var(--psp-inactive--border-color,#8b868045);text-overflow:ellipsis;overflow:hidden}tbody th:empty{background-image:linear-gradient(to right, transparent 9px, var(--psp-inactive--border-color,#eee) 10px, transparent 11px);pointer-events:none;background-repeat:no-repeat;min-width:20px;max-width:20px}regular-table:not(.flat-group-rollup-mode){& .psp-tree-label{min-width:0;max-width:0}& .psp-tree-label:before{color:var(--psp--color);font-family:var(--psp-button--font-family,inherit);padding-right:11px}& .psp-tree-label-expand:before{content:var(--psp-label--tree-expand--content,"+")}& .psp-tree-label-collapse:before{content:var(--psp-label--tree-collapse--content,"-")}& .psp-tree-label-expand,& .psp-tree-label-collapse{cursor:pointer}& .psp-tree-label:hover:before{color:var(--psp-active--color);text-shadow:0px 0px 5px var(--psp-active--color)}}.psp-tree-leaf{padding-left:24px}.psp-align-right{text-align:right}.psp-color-mode-bar{padding:0 2px}.psp-color-mode-label-bar{padding:0 2px;position:relative;& .psp-bar{isolation:isolate;position:unset}& .psp-bar:before{color:#0000;pointer-events:none;content:var(--label);justify-content:flex-end;align-items:center;padding:0 3px;display:inline-flex}& .psp-bar:after{color:var(--psp-label-bar-bg);content:var(--label);mix-blend-mode:difference;justify-content:flex-end;align-items:center;padding:0 5px;display:inline-flex;position:absolute;inset:0}}.psp-label-bar{pointer-events:none;justify-content:flex-end;align-items:center;padding:0;display:flex;inset:0}.psp-label-bar-fill{background:var(--psp-label-bar-color);pointer-events:none;height:80%;position:absolute;top:10%}.psp-label-bar-text{color:var(--psp-label-bar-bg);mix-blend-mode:difference;pointer-events:none;position:relative}.psp-align-left{text-align:left}.psp-positive:not(:focus){color:var(--psp-datagrid--pos-cell--color)}.psp-negative:not(:focus){color:var(--psp-datagrid--neg-cell--color)}regular-table table tbody td{min-width:52px!important}.psp-is-width-override .rt-column-resize,.rt-column-resize:hover{border:1px dashed #999;border-width:1px 1px 0 0}.boolean-editable{cursor:pointer}regular-table table{user-select:none;color:inherit;border-collapse:separate;font-size:1em;& th{font-weight:400}& td,& th{border-color:var(--psp-inactive--border-color,#8b868045);height:var(--psp-datagrid--row--height,23px)}& .psp-header-group{text-overflow:ellipsis}& th.psp-header-leaf{border-bottom-width:0;& span{height:var(--psp-datagrid--row--height,23px);min-height:var(--psp-datagrid--row--height,23px)}}& td,& th.psp-tree-label,& th.psp-tree-label,& th.psp-tree-leaf,& tbody tr:first-child th{border-style:solid;border-width:1px 0 0}& tbody th:empty{background-position:0 -10px}& td.psp-select-region,& th.psp-select-region{background-color:var(--psp--color)!important;color:var(--psp--background-color)!important;border-color:var(--psp--background-color)!important}}regular-table tbody tr:hover td.psp-select-region:not(.psp-select-region-inactive),regular-table tbody tr:hover+tr td.psp-select-region:not(.psp-select-region-inactive){border-color:var(--psp--background-color)!important}regular-table tbody tr:hover{& td.psp-select-region.psp-menu-open{&:not(.psp-select-region-inactive){box-shadow:inset -2px 0px 0px var(--psp--background-color), inset 2px 0px 0px var(--psp--background-color)}}}:host-context(perspective-viewer[settings]) td.psp-select-region.psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--background-color), inset 2px 0px 0px var(--psp--background-color)}regular-table #psp-column-edit-buttons th:not(.rt-group-corner) span:not(.rt-column-resize):before{content:var(--psp-datagrid--column-edit-button--content,"Edit")}perspective-viewer:not([settings]),:host-context(perspective-viewer:not([settings])){& regular-table #psp-column-edit-buttons:after{content:none}}regular-table table thead tr:last-child:after{box-sizing:border-box;width:10000px;height:var(--psp-datagrid--row--height,23px);content:" ";border-bottom:1px solid var(--psp-inactive--border-color);display:block}regular-table table tbody tr:after{box-sizing:border-box;width:10000px;height:var(--psp-datagrid--row--height,23px);content:" ";border-top:1px solid #0000;display:block}regular-table table tbody tr:not(:first-child):after{border-top:1px solid var(--psp-inactive--border-color)}regular-table table tbody tr:hover:not(:first-child):after,regular-table table tbody tr:hover+tr:after{border-top:1px solid var(--psp-datagrid--hover--border-color)}@keyframes pulse_pos{0%{background-color:var(--pulse--background-color-start,#0080ff80)}to{background-color:var(--pulse--background-color-end,#0080ff00)}}@keyframes pulse_pos2{0%{background-color:var(--pulse--background-color-start,#0080ff80)}to{background-color:var(--pulse--background-color-end,#0080ff00)}}@keyframes pulse_neg{0%{background-color:var(--pulse--background-color-start,#ff190080)}to{background-color:var(--pulse--background-color-end,#ff190000)}}@keyframes pulse_neg2{0%{background-color:var(--pulse--background-color-start,#ff190080)}to{background-color:var(--pulse--background-color-end,#ff190000)}}';var pe=class e extends HTMLElement{static _global_stylesheet_installed=!1;static _sheet;static renderTarget=window.CSS?.supports&&window.CSS?.supports("selector(:host-context(foo))")?"shadow":"light";regular_table;model;_toolbar;_edit_button;_scroll_lock;_is_scroll_lock;_edit_mode;_initialized;_reset_scroll_top;_reset_scroll_left;_reset_select;_reset_column_size;constructor(){super(),this.regular_table=document.createElement("regular-table"),this.regular_table.part="regular-table",this._is_scroll_lock=!1,this._edit_mode="READ_ONLY";let t=e;t._sheet||(t._sheet=new CSSStyleSheet,t._sheet.replaceSync(yt)),t.renderTarget==="shadow"?this.attachShadow({mode:"open"}).adoptedStyleSheets.push(t._sheet):t.renderTarget==="light"&&!t._global_stylesheet_installed&&(t._global_stylesheet_installed=!0,document.adoptedStyleSheets.push(t._sheet))}connectedCallback(){this._toolbar||(this._toolbar=document.createElement("perspective-viewer-datagrid-toolbar"));let t=this.parentElement;t&&t.appendChild(this._toolbar)}disconnectedCallback(){this._toolbar?.parentElement?.removeChild?.(this._toolbar)}async activate(t){return await gt.call(this,t)}get name(){return"Datagrid"}get category(){return"Basic"}get select_mode(){return"toggle"}get min_config_columns(){}get config_column_names(){return["Columns"]}get group_rollups(){return["rollup","flat","total"]}get priority(){return 1}can_render_column_styles(t,o){return t!=="boolean"}column_style_controls(t,o){return Me.call(this,t,o)}async draw(t){return await vt.call(this,t)}async update(t){if(this.model===void 0)await this.draw(t);else if(this.model._config.split_by?.length>0){let o=await t.dimensions();this.model._num_rows=o.num_view_rows,await this.regular_table.draw()}else this.model._num_rows=await t.num_rows(),await this.regular_table.draw()}async render(t){let r=await this.parentElement.getView(),s=await r.to_columns(t),i=await r.column_paths(t),n=t?.end_row!==void 0&&t?.end_row!==null&&t?.start_row!==void 0&&t?.start_row!==null?t.end_row-t.start_row:await r.num_rows(),l="";for(let c=0;c<n;c++){for(let a of i){let p=s[a],d=this.model._schema[a],m=this.regular_table[P],h=a.split("|").at(-1),_=Pe(d,m?.[h]||{});_?l+=_.format(p[c])+" ":l+=p[c]+" "}l+=`
|
|
3
|
-
`}return
|
|
1
|
+
var se=0,$=0,Te=performance.now();function Rt(){let e=performance.now(),t=e-Te,o=se,r=$*1e3/t,i=1e3/o,s=$;return se=0,$=0,Te=e,{avg:o,real_fps:r,virtual_fps:i,num_frames:s,elapsed:t}}function Dt(e){se=(se*$+e)/($+1),$+=1}var N=new Map;async function Pt(e){return await new Promise(requestAnimationFrame),await N.get(e)?.promise}async function Re(e,t){if(N.has(e)&&(await N.get(e)?.promise,N.has(e))){await N.get(e)?.promise;return}N.set(e,Promise.withResolvers());try{return await t()}finally{let o=N.get(e);N.delete(e),o?.resolve(void 0)}}var Ot=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,Ht=Ot?5e6:1e7,At=":host{position:absolute;top:0px;left:0px;right:0px;bottom:0px;overflow:scroll;overflow-anchor:none;overscroll-behavior:none;-webkit-overflow-scrolling:touch;}div.rt-virtual-panel{position:absolute;top:0;left:0;right:0;pointer-events:none;}div.rt-scroll-table-clip{position:sticky;contain:strict;overflow-anchor:none;width:100%;height:100%;}slot{position:absolute;overflow:hidden;overflow-anchor:none;}",Nt=":host ::slotted(table){--regular-table--transform-x:0px;--regular-table--transform-y:0px;--regular-table--clip-x:0px;--regular-table--clip-y:0px;}",Vt="--regular-table--clip-x",zt="--regular-table--clip-y",It="--regular-table--transform-x",Wt="--regular-table--transform-y",Ft='<div class="rt-virtual-panel"></div><div class="rt-scroll-table-clip"><slot></slot></div>',Ut=class extends HTMLElement{m;n;i;d;A;V;z;P;C;K;s;e;t;xe;Le;table_model;o;r;async draw(e={}){return typeof e.throttle<"u"&&!e.throttle?await Se.call(this,e):await Re(this,()=>Se.call(this,e))}async flush(){await Pt(this)}J(){if(!this.r){this.r=[document.createElement("table"),document.createElement("td")],this.r[0].style.visibility="hidden",this.r[0].style.position="absolute";let e=document.createElement("tbody"),t=document.createElement("tr");this.r[1].textContent="X",t.appendChild(this.r[1]),e.appendChild(t),this.r[0].appendChild(e)}this.appendChild(this.r[0]),this.e.row_height=this.r[1].offsetHeight,this.r[0].remove()}Z(){if(this.attachShadow({mode:"open"}),!this.shadowRoot)return;let e=new CSSStyleSheet;e.replaceSync(At);let t=new CSSStyleSheet;t.replaceSync(Nt),this.m=t.cssRules[0],this.shadowRoot.adoptedStyleSheets=[e,t],this.shadowRoot.innerHTML=Ft;let[o,r]=this.shadowRoot.children;this.s=r,this.n=o,this.D()}D(){this.s&&(this.i==="both"||this.i==="vertical"?this.s.style.top="0px":this.s.style.removeProperty("top"),this.i==="both"||this.i==="horizontal"?this.s.style.left="0px":this.s.style.removeProperty("left"),this.i!=="both"?this.s.style.contain="none":this.s.style.removeProperty("contain"))}Q(e,t){let{start_row:o,end_row:r}=this.ee(e),{start_col:i,end_col:s}=this.T(t);return{start_col:i,end_col:s,start_row:o,end_row:r}}te({start_col:e,end_col:t,start_row:o,end_row:r}){o=Math.floor(o),r=Math.ceil(r),e=Math.floor(e),t=Math.ceil(t);let i=this.z!==e,s=this.A!==o||this.V!==r||this.P!==t;return this.z=e,this.P=t,this.A=o,this.V=r,{invalid_column:i,invalid_row:s}}B(e,t){if(e)if(this.i==="vertical"||this.i==="none"){let o=0;for(let r of this.e.indices)o+=r||0;this.n.style.width=o.toPrecision(10)+"px"}else{let o=this.ie(t);if(o!==0){let r=this.d.width+o+2;this.n.style.width=r.toPrecision(10)+"px"}else this.n.style.width="1px"}}O(e){let{row_height:t=0}=this.e,o=this.t.column_headers_length*t,r;r=Math.min(Ht,e*t+o),this.n.style.height=`${r.toPrecision(10)}px`}W(e,t){let o=(this.e.row_height||0)*(e.start_row%1)||0,r=(this.table_model.l||0)+Math.floor(e.start_col);this.e.indices[r]===void 0&&(this.e.indices[r]=t?.[0]?.offsetWidth||0);let i=this.e.indices[r]*(e.start_col%1)||0;this.m.style.setProperty(Vt,`${i}px`),this.m.style.setProperty(zt,`${o}px`),this.m.style.setProperty(It,`${-i}px`),this.m.style.setProperty(Wt,`${-o}px`)}T(e){if(this.i==="none"||this.i==="vertical")return{start_col:0,end_col:1/0};{let t=this.se(),o=this.table_model.num_columns()||Math.min(e,Math.ceil(this.d.width/60)),r=t+o+1;return{start_col:t,end_col:r}}}ee(e){let{height:t,containerHeight:o}=this.d,r=this.e.row_height||0,i=this.t.column_headers_length,s=Math.max(1,this.n.offsetHeight-o),n=Math.max(Math.ceil(this.scrollTop),0)/s,l=t/r-i,c=Math.max(0,(e||0)-l)*n,a=Math.max(0,Math.min(c+l,e));return{start_row:c,end_row:a}}se(){let e=this.t.row_headers_length,t=0,o=0,r=0;for(;o<this.scrollLeft;){let i=this.e.indices[t+e];r=this.scrollLeft-o,t+=1,o+=i!==void 0?i:60}return t+=r/(this.e.indices[t+e-1]||60),Math.max(0,t-1)}oe(e){let t=0;if(this.t.row_headers_length>0)for(let i of this.e.indices.slice(0,this.t.row_headers_length))t+=i||0;let o=this.t.row_headers_length,r=e;for(;t<this.d.width&&r>=0;)r--,t+=this.e.indices[r+o]||60;return Math.min(e-1,r+1)}ie(e){let t=this.t.row_headers_length,o=this.oe(e),r=t,i=0;for(;r<o+t;)i+=this.e.indices[r]||60,r++;if(r<this.e.indices.length){let s=0,n=this.t.row_headers_length;for(let l=0;l<n&&l<this.e.indices.length;l++)s+=this.e.indices[l]||0;i+=Math.max(0,(this.e.indices[r]||0)-(this.d.width-(s||0))||0)}return i}};async function Se(e){let t=performance.now();e.cache||this.table_model.ne();let{invalid_viewport:o=!0,preserve_width:r=!1}=e,{num_columns:i,num_rows:s,num_row_headers:n,num_column_headers:l,row_height:c}=await this.table_model.re(this.t);this.e.row_height=c||this.e.row_height,this.e.row_height||this.J(),n!==void 0&&(this.t.row_headers_length=n),l!==void 0&&(this.t.column_headers_length=l);let a=this.i==="none"||this.i==="horizontal",d=this.i==="none"||this.i==="vertical",p=s||0,u=i||0;this.d={width:d?1/0:this.s.clientWidth,height:a?1/0:this.s.clientHeight,containerHeight:a?1/0:this.clientHeight},this.O(p),r||this.B(o,u);let _=this.Q(p,u),{invalid_row:m,invalid_column:f}=this.te(_),h=this.C||f;if(h||m||o){let g=!0;await this.table_model.draw(this.d,this.t,this.K,r,_,u,async v=>{g&&(this.W(_,v),g=!1);for(let w of this.o)await w({detail:this})});let b=this.e.row_height;this.table_model.header.reset_header_cache(),b!==this.e.row_height&&this.O(p),r||this.B(h,u),this.C=!1}else this.W(_);Dt(performance.now()-t)}var B=new WeakMap,jt=class{$;b;c;constructor(e){this.$=e,this.b=[],this.c=0}reset(){this.c=0}get(){this.b[this.c]||(this.b[this.c]=document.createElement(this.$));let e=this.b[this.c];return this.c+=1,e}},De=class{e;le;f;table;cells;rows;constructor(e,t,o){this.e=e,this.le=t,this.f=new jt("span"),this.table=o,this.cells=[],this.rows=[]}num_columns(){return this.w(Math.max(0,this.rows.length-1)).row_container.length}num_rows(){return this.cells.length}He(e,t){B.set(e,t)}_(e){if(!e)return{value:void 0};let t=B.get(e);return t||(t={value:void 0},B.set(e,t)),t}k(e,t){let{tr:o,row_container:r}=this.w(e),i=r[t];return i&&(o.removeChild(i),r.splice(t,1,void 0)),i}p(e,t){if(!(e<0||t<0))return this.cells[e]?.[t]}w(e){let t=this.rows[e];t||(t=this.rows[e]=document.createElement("tr"),this.table.appendChild(t));let o=this.cells[e];return o||(o=this.cells[e]=[]),{tr:t,row_container:o}}S(e="TD",t,o){let{tr:r,row_container:i}=this.w(t),s=i[o];if(!s)if(o<i.length){s=i[o]=document.createElement(e);let n=i.slice(o+1).find(l=>l);r.insertBefore(s,n||null)}else s=i[o]=document.createElement(e),r.appendChild(s);if(s.tagName!==e){let n=document.createElement(e);r.replaceChild(n,s),this.cells[t].splice(o,1,n),s=n}return s}I(e){for(let t=0;t<this.rows.length;t++){let o=this.rows[t],r=this.cells[t];r.length=(Array.isArray(e)?e[t]:e)||0;let i=this.cells[t].filter(n=>n!==void 0).length,s=[];for(let n=i;n<o.children.length;n++)s.push(o.children[n]);for(let n of s)n.remove()}}E(e){let t=[];for(let o=e;o<this.table.children.length;o++)t.push(this.table.children[o]);for(let o of t)o.remove();this.rows.length=e,this.cells.length=e}},$t=!1,Bt=class extends Ut{F;N;X;G;g;register_listeners(){this.addEventListener("mousedown",this.ae.bind(this)),this.addEventListener("scroll",this.L.bind(this),{passive:!0}),this.he()}async L(e){e.stopPropagation(),await this.draw({invalid_viewport:!1,cache:!0}),this.dispatchEvent(new CustomEvent("regular-table-scroll"))}he(){this.addEventListener("mousewheel",this.de.bind(this),{passive:!0}),$t&&(this.addEventListener("touchmove",this.ce.bind(this)),this.addEventListener("touchstart",this.ue.bind(this),{passive:!0}))}de(e){if(!window.hasOwnProperty("safari"))return;let t=e,{clientWidth:o,clientHeight:r,scrollTop:i,scrollLeft:s}=this;t.preventDefault(),t.returnValue=!1;let n=Math.max(1,this.n.offsetHeight-r),l=Math.max(1,this.n.offsetWidth-o);this.scrollTop=Math.max(0,Math.min(n,i+t.deltaY)),this.scrollLeft=Math.max(0,Math.min(l,s+t.deltaX)),this.L(t)}ce(e){e.stopPropagation(),e.preventDefault(),e.returnValue=!1;let{clientWidth:t,clientHeight:o}=this,r=Math.max(1,this.n.offsetHeight-o),i=Math.max(1,this.n.offsetWidth-t);this.scrollTop=Math.min(r,(this.F||0)+((this.X||0)-e.touches[0].pageY)),this.scrollLeft=Math.min(i,(this.N||0)+((this.G||0)-e.touches[0].pageX)),this.L(e)}ue(e){this.X=e.touches[0].pageY,this.G=e.touches[0].pageX,this.F=this.scrollTop,this.N=this.scrollLeft}async me(e){let t=e.target,o=t.classList.contains("rt-column-resize");for(;t.tagName!=="TD"&&t.tagName!=="TH";)if(t=t.parentElement,!this.contains(t))return;let r=B.get(t);if(o&&r){e.stopImmediatePropagation(),e.shiftKey?(this.e.override={},this.e.auto=[],this.e.indices=[]):(delete this.e.override[r.size_key],this.e.auto[r.size_key]=void 0,this.e.indices[r.size_key]=void 0),this.table_model.updateColumnWidthStyles({start_row:0,end_row:0,...this.T(0)},this.t.row_headers_length);for(let i of e.shiftKey?[this.table_model.header.cells[this.table_model.header.cells.length-1],...this.table_model.body.cells]:this.table_model.body.cells)for(let s of e.shiftKey?i:[i[r.virtual_x]])s&&s.classList.remove("rt-cell-clip");await this.draw({cache:!0})}}async fe(e){if(e.button!==0)return;let t=e.target,o=t.classList.contains("rt-column-resize");for(;t.tagName!=="TD"&&t.tagName!=="TH";)if(t=t.parentElement,!this.contains(t))return;let r=B.get(t);o&&r&&(this._e(e,t,r),e.stopImmediatePropagation())}async ae(e){let t=performance.now();this.g&&t-this.g<500?(this.g=t,await this.me(e)):(this.g=t,await this.fe(e))}_e(e,t,o){let{virtual_x:r,size_key:i}=o,s=e.pageX,n=(r||0)+t.colSpan-1,l=this.table_model.header.get_column_header(n),c=this.e.indices[i||0]||0,a=p=>Re(this,async()=>await this.pe(p,l,s,c,i||0,n)),d=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",d);let p=this.e.override[i||0],u=this.e.indices[i||0]!==p;this.e.indices[i||0]=p,u&&this.draw({cache:!0})};document.addEventListener("mousemove",a),document.addEventListener("mouseup",d)}async pe(e,t,o,r,i,s){await new Promise(requestAnimationFrame);let n=e.pageX-o,l=Math.max(1,r+n);if(this.e.override[i]=l,n<0)await this.draw({preserve_width:!0,throttle:!1,cache:!0});else{this.table_model.updateColumnWidthStyles({start_row:0,end_row:0,...this.T(0)},this.t.row_headers_length);let c=(this.e.auto[i]||0)>l;t.classList.toggle("rt-cell-clip",c);for(let a of this.table_model.body.cells){let d=a[s];d&&d.classList.toggle("rt-cell-clip",c)}}}},Gt=class extends De{a;h;constructor(e,t,o){super(e,t,o),this.a=[],this.h=[]}q(e,t,o){let r=this.S("TH",t,e[t]||0);if(e[t]+=1,r.removeAttribute("colspan"),r.textContent="",o instanceof HTMLElement)r.appendChild(o);else{let s=this.f.get();s.textContent=String(o??""),r.appendChild(s)}let i=this.f.get();return i.className="rt-column-resize",r.appendChild(i),r}be(e,t,o){let r=this._(o);return r.column_header=e,r.value=t,r}we(e,t,o,r){let i=this._(o);if(i.column_header=e,i.value=t,i.size_key=Array.isArray(r)?r[0]:r,!Array.isArray(r)||r.length<=1){let s=this.e.override[i.size_key||0],n=this.e.auto[i.size_key||0]||0;s?o.classList.toggle("rt-cell-clip",n>s):o.classList.remove("rt-cell-clip")}return i}get_column_header(e){return this.S("TH",this.num_rows()-1,e)}draw(e,t,o,r,i,s,n,l,c){let a=t?.length;if(a===0)return;let d,p,u,_;l=typeof l>"u"?a-1:l;for(let m=0;m<a;m++){if(u=t[m]?t[m]:"",this.h[m]=this.h[m]||0,m<l)c&&this.a?.[m]?.[0]?.value===u?(d=this.a[m][1],this.a[m][2]+=1,o===1&&(this.a[m][0].row_header_x=Array.isArray(i)?i[0]:i),d.setAttribute("colspan",String(this.a[m][2]))):(d=this.q(this.h,m,u),p=this.be(t,u,d),this.a[m]=[p,d,1]);else{d=this.q(this.h,m,u),p=this.we(e.length>0?e:t,u,d,i),typeof _>"u"&&(_={th:d,metadata:p});for(let[f]of this.a)f.size_key=p.size_key;d.removeAttribute("colspan")}this.w(m).tr.classList.toggle("rt-autosize",m===l),d.classList.toggle("rt-group-corner",r===void 0),p&&(p.x=typeof r>"u"?r:Math.floor(r),p.column_header_y=m,p.x0=Math.floor(s),p.virtual_x=n,o===1?(p.type="corner",p.row_header_x=Array.isArray(i)?i[0]:i):(p.type="column_header",delete p.row_header_x))}return this.E(this.h.length),_=_||{th:d,metadata:p},_}clean(){this.I(this.h)}reset_header_cache(){this.h=[],this.a=[]}},Yt=class extends De{Y(e,t,o,r,{column_name:i},{ridx_offset:s},n){let l=this.S(e,t,r),c=this._(l);c.y=t+Math.floor(s);let a=c.size_key=n||0;e==="TD"&&(c.column_header=i);let d=this.e.override[a];if(d){let p=(this.e.auto[a]||0)>d;l.classList.contains("rt-cell-clip")!==p&&l.classList.toggle("rt-cell-clip",p)}else l.classList.remove("rt-cell-clip");return c.value!==o&&(o instanceof HTMLElement?(l.textContent="",l.appendChild(o)):l.textContent=String(o??"")),c.value=o,{td:l,metadata:c}}draw(e,t,o,r=!1,i,s,n,l){let{cidx:c,column_data:a,row_headers:d,column_data_listener_metadata:p}=t,{row_height:u}=o,_,m=[],f=[],h=0,g=[],b=r?o.row_headers_length??1:1,v=Math.floor(o.ridx_offset),w=Math.ceil(o.y1),M=Math.ceil(o.x1),S=i===void 0?i:Math.floor(i),x=s===void 0?void 0:Math.floor(s),k=Math.floor((i??0)-(s??0));for(let T=0;T<b;T++){h=0;let D=c+T;for(let L of a){let y;if(r){let E=L,H=E[T],C=m[T]||1,R=this.p(h-C,D),A=this._(R),_e=g[h]||1,W=this.p(h,D-_e),Lt=this._(W);if(l&&W&&(Lt.value===H||H===void 0)&&!W.hasAttribute("rowspan")){let F=g[h]=_e+1;W.setAttribute("colspan",String(F)),this.k(h,D)}else if(l&&R&&A.value===H&&!R.hasAttribute("colspan")){let F=m[T]=C+1;R.setAttribute("rowspan",String(F)),this.k(h,D)}else{y=this.Y("TH",h,H,D,t,o,T);let F=y.td,U=y.metadata;F.style.display="",F.removeAttribute("rowspan"),F.removeAttribute("colspan"),U.type="row_header",U.row_header=E,U.row_header_x=T,U.y0=v,U.y1=w,U.virtual_x=T,x!==void 0&&(U.x0=x),m[T]=1,g[h]=1,f[T]=y}}else{y=this.Y("TD",h,L,c,t,o,n??0);let E=y.metadata;p&&(E.user=p[h]),E.type="body",E.x=S||0,E.x1=M,E.row_header=d?.[h]||[],E.y0=v,E.y1=w,E.dx=k,E.dy=(E.y??0)-v,E.virtual_x=c,x!==void 0&&(E.x0=x),f[0]=y}if(h++,_=y?y.metadata:_,u=u||y?.td.offsetHeight,h*(u??0)>e)break}}return this.E(h),{tds:f,ridx:h,row_height:u}}clean({ridx:e,cidx:t}){this.E(e),this.I(t)}},qt=class{e;l=0;header;body;ge(e,t){let{start_row:o=0,start_col:r=0,end_col:i=0,end_row:s=0}=e,n=this.e.indices[(this.l||0)+Math.floor(e.start_col)]??0;return{viewport_width:0,selected_id:t,ridx_offset:o,sub_cell_offset:n,x0:r,x1:i,y1:s,row_height:this.e.row_height,row_headers_length:this.l}}Me(e,t,o,r,i,s,n,l,c,a){let d=[`${t}`],p=[],u={column_name:d,cidx:0,column_data:e,row_headers:e,first_col:!0},_=Math.floor(n),m=this.body.draw(r,u,{...i,x0:0},!0,void 0,void 0,_,a),f=[];for(let g=0;g<t;g++){let b=this.header.draw(d,Array(o).fill(""),1,void 0,g,n,g,l,c);b&&f.push(b)}for(let g=0;g<f.length;g++){let{th:b}=f[g];i.viewport_width+=this.e.indices[g]||b.offsetWidth}i.row_height=i.row_height||m.row_height;let h=e[0].length;if(!s)for(let g=0;g<t;g++){let{td:b,metadata:v}=m.tds[g]||{},{th:w,metadata:M}=f[g]||{};(b||w)&&p.push([w||b,M||v])}return{cont_body:m,first_col:!1,ye:h,last_cells:p}}ve(e,t,o,r,i,s){let n=0,l=0;for(;this.e.indices.length>i+s+n+1&&l+t.viewport_width<o;)n++,l+=this.e.indices[i+s+n]||0;if(l+t.viewport_width<o){let c=Math.min(r,e.start_col+5);e.end_col=Math.max(1,Math.min(r,c))}else e.end_col=Math.max(1,Math.min(r,e.start_col+n))}Ce(e,t,o,r,i,s,n,l,c,a){let d=t.column_headers?.[e]||[],p=t.data[e],u=t.metadata?.[e],_={column_name:d,cidx:o,column_data:p,column_data_listener_metadata:u,row_headers:t.row_headers,first_col:n},m=e+r,f=o+Math.floor(r),h=this.header.draw(d,d,void 0,m,f,r,o,l,c),g=this.body.draw(i,_,s,!1,m,r,f,a);return{cont_head:h,cont_body:g}}async Te(e,t,o,r,i,s,n,l,c){let a=Math.max(r+Math.floor(c),0),d=structuredClone(e);d.start_col=a,this.ve(d,i,s,n,l,c);let p=await t(Math.floor(d.start_col),Math.floor(d.start_row),Math.ceil(d.end_col),Math.ceil(d.end_row)),u,_;if(typeof p.column_header_merge_depth<"u"&&(u=p.column_header_merge_depth),typeof p.merge_headers<"u"&&(_=p.merge_headers),p.data.length===0)return{column_header_merge_depth:u,merge_headers:_};e.end_col=d.start_col+p.data.length;for(let m=0;m<p.data.length;m++)o.data[r+m]=p.data[m],p.metadata&&o.metadata&&(o.metadata[r+m]=p.metadata[m]),o.column_headers&&p.column_headers?.[m]&&(o.column_headers[r+m]=p.column_headers[m]);return{column_header_merge_depth:u,merge_headers:_}}M(e,t){this.body.clean({ridx:e?.ridx||0,cidx:t}),this.header.clean()}H(){this.body.f.reset(),this.header.f.reset()}},Le=class extends qt{table;u;U;v;Se;constructor(e,t,o){super(),this.e=t,this.clear(o);let[r]=o.children,[i,s]=r.children;this.table=r,this.header=new Gt(t,e,i),this.body=new Yt(t,e,s)}num_columns(){return this.header.num_columns()}clear(e){e.innerHTML='<table cellspacing="0"><thead></thead><tbody></tbody></table>'}autosize_cells(e,t){let o=this.table.currentCSSZoom??1,r=[];for(let[i,s]of e){let n=i.getBoundingClientRect();r.push({cell:i,metadata:s,box:n})}for(let{metadata:i,box:s}of r)this.e.row_height=t??Math.max(10,Math.min(this.e.row_height??s.height/o,s.height/o)),i?.size_key!==void 0&&(this.e.indices[i.size_key]=s.width/o,s.width/o&&this.e.override[i.size_key]===void 0&&(this.e.auto[i.size_key]=s.width/o))}updateColumnWidthStyles(e,t){let o=[],r;for(r=0;r<t;r++){let i=this.e.override[r],s=this.e.auto[r];if(i!==void 0){let n=r+1;o.push(`thead tr.rt-autosize th:nth-of-type(${n}),`,`tbody th.rt-cell-clip:nth-last-of-type(${t-r})`,`{min-width:${i}px;max-width:${i}px;}`)}else if(s!==void 0){let n=r+1;o.push(`thead tr.rt-autosize th:nth-of-type(${n}),`,`tbody th.rt-cell-clip:nth-last-of-type(${t-r})`,`{min-width:${s}px;}`)}}for(let i=r;i<r+(Math.floor(e.end_col)-Math.floor(e.start_col));i++){let s=this.e.override[i+Math.floor(e.start_col)],n=this.e.auto[i+Math.floor(e.start_col)];if(s!==void 0){let l=i+1;o.push(`thead tr.rt-autosize th:nth-of-type(${l}),`,`tbody td.rt-cell-clip:nth-of-type(${l-r})`,`{min-width:${s}px;max-width:${s}px;}`)}else if(n!==void 0){let l=i+1;o.push(`thead tr.rt-autosize th:nth-of-type(${l}),`,`tbody td.rt-cell-clip:nth-of-type(${l-r})`,`{min-width:${n}px;}`)}}o.length>0?this.Ee(o.join(`
|
|
2
|
+
`)):this.u&&this.u.replaceSync("")}Ee(e){if(e===this.U)return;let t=this.table.getRootNode();!t||!t.adoptedStyleSheets||(this.u||(this.u=new CSSStyleSheet,t.adoptedStyleSheets=[...t.adoptedStyleSheets,this.u]),this.u.replaceSync(e),this.U=e)}async re(e){return this.v?this.v:await e.view(0,0,0,0)}ne(){this.v=void 0,this.Se=void 0}async draw(e,t,o,r,i,s,n){let{width:l,height:c}=e,a=this.v=await t.view(Math.floor(i.start_col),Math.floor(i.start_row),Math.ceil(i.end_col),Math.ceil(i.end_row)),{column_header_merge_depth:d,merge_headers:p="both"}=a,u=p==="both"||p==="row",_=p==="both"||p==="column",m=i.start_col??0;if(a.row_headers){let x=0;for(let k of a.row_headers)k.length>x&&(x=k.length);this.l=x;for(let k=0;k<a.row_headers.length;k++)a.row_headers[k].length=this.l||0}t.row_headers_length=a.num_row_headers??a.row_headers?.[0]?.length??0,t.column_headers_length=a.num_column_headers??a.column_headers?.[0]?.length??0;let{view:f,row_headers_length:h,column_headers_length:g}=t,b=this.ge(i,o),v,w=0,M=[],S=!0;if(a.row_headers?.length){let x=this.Me(a.row_headers,h,g,c,b,r,m,d,_,u);v=x.cont_body,S=x.first_col,w=x.ye,M=x.last_cells}try{let x=0,k=s-i.start_col;for(;x<k;){if(!a.data[x]){this.updateColumnWidthStyles(i,t.row_headers_length),await n(M[this.l]);let y=await this.Te(i,f,a,x,b,l,s,w,m);if(y.column_header_merge_depth!==void 0&&(d=y.column_header_merge_depth),y.merge_headers!==void 0&&(p=y.merge_headers),!a.data[x]){this.M(v,w),this.H(),this.updateColumnWidthStyles(i,t.row_headers_length),await n(M[this.l]),this.autosize_cells(M,this.e.row_height);return}}let{cont_head:T,cont_body:D}=this.Ce(x,a,w,m,c,b,S,d,_,u);if(v=D,S=!1,!r)for(let{td:y,metadata:E}of v.tds)M.push([T?.th||y,T?.metadata||E]);let L=this.e.indices[w+Math.floor(m)]||T?.th?.offsetWidth;if(!L){L=0;for(let{td:y}of v.tds)L+=y?.offsetWidth||0}if(b.viewport_width+=L,b.row_height=b.row_height||v.row_height,w++,x++,this.j(b,l)){this.M(v,w),this.updateColumnWidthStyles(i,t.row_headers_length),await n(M[this.l]),b.viewport_width=0,this.autosize_cells(M,this.e.row_height);for(let y=0;y<M.length;y++)b.viewport_width+=this.e.indices[Math.floor(m)+y]||0;if(this.j(b,l)){this.H();return}}}this.M(v,w),this.H(),this.updateColumnWidthStyles(i,t.row_headers_length),await n(M[this.l]),this.autosize_cells(M,this.e.row_height)}finally{this.M(v,w)}}j(e,t){return e.viewport_width-e.sub_cell_offset>t}},Jt=["both","horizontal","vertical","none"],Kt=class extends Bt{R;constructor(){super(),this.e={auto:[],override:{},indices:[]},this.o=[],this.R=!1}connectedCallback(){this.R||(this.Z(),this.register_listeners(),this.setAttribute("tabindex","0"),this.R=!0,this.table_model=new Le(this.s,this.e,this))}resetAutoSize(e){(!e||e.auto)&&(this.e.auto=[]),(!e||e.override)&&(this.e.override={}),(!e||e.indices)&&(this.e.indices=[]),(!e||e.row_height)&&(this.e.row_height=void 0)}saveColumnSizes(){return structuredClone(this.e.override)}restoreColumnSizes(e){this.e.override=structuredClone(e)}clear(){this.table_model=new Le(this.s,this.e,this)}addStyleListener(e){this.o.push(e);let t=!0;return()=>{if(!t)return;t=!1,this.o=this.o.slice();let o=this.o.indexOf(e);this.o.splice(o,1)}}removeStyleListener(e){let t=this.o.length;this.o=this.o.filter(o=>o!==e),console.assert(this.o.length===t-1,"No listener found")}getMeta(e){if(e!==void 0){if(e instanceof HTMLElement)return B.get(e);if("row_header_x"in e&&e.row_header_x&&e.row_header_x>=0){if(e.row_header_x<this.t.row_headers_length){let t=this.table_model.body.p(e.y,e.row_header_x);return this.getMeta(t)}}else if("column_header_y"in e&&e.column_header_y>=0){if(e.column_header_y<this.t.column_headers_length){let t=this.table_model.header.p(e.column_header_y,e.x);return this.getMeta(t)}}else if("dx"in e)return this.getMeta(this.table_model.body.p(e.dy,e.dx+(this.table_model.l||0)))}}getDrawFPS(){return Rt()}async scrollToCell(e,t){if(!this.t){console.warn("data listener not configured");return}let o=this.e.row_height||0;this.scrollTop=Math.ceil(o*t);let r=0;for(;e>0;)e--,r+=this.e.indices[e+this.t.row_headers_length]||60;this.scrollLeft=Math.ceil(r),await new Promise(requestAnimationFrame),await this.flush()}setDataListener(e,{virtual_mode:t="both",preserve_state:o=!1}={}){console.assert(Jt.indexOf(t)>-1,`Unknown virtual_mode ${t}; valid options are "both" (default), "horizontal", "vertical" or "none"`);let r=this.i!==t;o?(console.assert(!r,"preserve_state called with modified virtual_mode"),this.t.view=e):(this.i=t,this.C=!0,this.t={view:e,row_headers_length:0,column_headers_length:0},r&&this.D())}};document.createElement("regular-table").constructor===HTMLElement&&window.customElements.define("regular-table",Kt);var G=class{selected;row;column_names;removeConfigs;insertConfigs;constructor(t,o,r,i,s){this.selected=t,this.row=o,this.column_names=r,this.removeConfigs=i,this.insertConfigs=s}get removeFilters(){return this.removeConfigs.flatMap(t=>t.filter??[])}get insertFilters(){return this.insertConfigs.flatMap(t=>t.filter??[])}};function Y(e,t){return t.type==="body"||t.type==="column_header"||t.type==="corner"?e._column_types[t.x]:e._row_header_types[(t.row_header_x??0)-1]}var P=Symbol("Perspective Column Config");function V(e,t,o=!1){let r=e._config.group_by.length===0&&e._config.split_by.length===0,i=t.children[0],s=o||i?._edit_mode==="EDIT";return r&&s}var Xt=/^__(?:ROW_PATH(?:_\d+)?|ID|GROUPING_ID)__$/;function te(e){return Xt.test(e)}var Zt={float:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},Pe={dateStyle:"short",timeStyle:"medium"},Qt={dateStyle:"short"};function Oe(e,t){let o=t??Zt[e]??{};return new Intl.NumberFormat(navigator.languages,o)}function He(e){if(!e||e.format!=="custom"){let o={timeZone:e?.timeZone,dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??Pe.dateStyle,timeStyle:e?.timeStyle==="disabled"?void 0:e?.timeStyle??Pe.timeStyle};return new Intl.DateTimeFormat(navigator.languages,o)}let t={timeZone:e.timeZone,hour12:e.hour12??!0,fractionalSecondDigits:e.fractionalSecondDigits};return e.year!=="disabled"&&(t.year=e.year??"2-digit"),e.month!=="disabled"&&(t.month=e.month??"numeric"),e.day!=="disabled"&&(t.day=e.day??"numeric"),e.weekday&&e.weekday!=="disabled"&&(t.weekday=e.weekday),e.hour!=="disabled"&&(t.hour=e.hour??"numeric"),e.minute!=="disabled"&&(t.minute=e.minute??"numeric"),e.second!=="disabled"&&(t.second=e.second??"numeric"),new Intl.DateTimeFormat(navigator.languages,t)}function Ae(e){let t={timeZone:"utc",dateStyle:e?.dateStyle==="disabled"?void 0:e?.dateStyle??Qt.dateStyle};return new Intl.DateTimeFormat(navigator.languages,t)}function Ne(e){return e.split("|").at(-1)??e}var he=class{format(t){return t?"true":"false"}},ne=class{_formatters;constructor(){this._formatters=new Map}create_datetime_formatter(t,o){return He(o.date_format)}create_date_formatter(t,o){return Ae(o.date_format)}create_number_formatter(t,o){return Oe(t,o.number_format)}create_boolean_formatter(t,o){return new he}get(t,o){let r=[t,...Object.values(o.date_format??{}),...Object.values(o.number_format??{})].join("-");return this._formatters.has(r)||(t==="date"?this._formatters.set(r,this.create_date_formatter(t,o)):t==="datetime"?this._formatters.set(r,this.create_datetime_formatter(t,o)):t==="integer"||t==="float"?this._formatters.set(r,this.create_number_formatter(t,o)):t==="boolean"?this._formatters.set(r,this.create_boolean_formatter(t,o)):this._formatters.set(r,!1)),this._formatters.get(r)}};var ge=new ne,Ve=1;function ze(e,t){return ge.get(e,t)}function q(e,t,o={},r=!1){if(t===null)return null;let i=r&&this._table_schema[e]||this._schema[e]||"string",s=o[e]||{};if((i==="integer"||i==="float")&&(s?.number_fg_mode==="bar"||s?.number_fg_mode==="label-bar")){let l=Math.max(0,Math.min(Ve,Math.abs(t/s.fg_gradient)*Ve)),c=t>=0?"":"justify-self:flex-end;",a=(l*100).toFixed(2);if(s.number_fg_mode==="bar"){let d=this._div_factory.get();return d.className="psp-bar",d.setAttribute("style",`${c}width:${a}%;height:80%;top:10%;pointer-events:none;background:var(--psp-label-bar-color)`),d}else{let d=ge.get(i,s),p=d?d.format(t):t,u=this._div_factory.get();return u.className="psp-bar",u.setAttribute("style",`--label:"${p}";${c}width:${a}%;height:80%;top:10%;pointer-events:none;background:var(--psp-label-bar-color)`),u}}else if(s?.format==="link"&&i==="string"){let l=document.createElement("a");return l.setAttribute("href",t),l.setAttribute("target","_blank"),l.textContent=t,l}else if(s?.format==="bold"&&i==="string"){let l=document.createElement("b");return l.textContent=t,l}else if(s?.format==="italics"&&i==="string"){let l=document.createElement("i");return l.textContent=t,l}else{let l=ge.get(i,s);return l?l.format(t):t}}function*Ie(e=[],t,o){let r=o[P]||{};for(let i of e){let s=["TOTAL",...i],n=s[s.length-1],l=s.slice(0,s.length-1).fill(""),c=q.call(this,t[l.length-1],n,r,!0);c instanceof HTMLElement?l=l.concat(c):l=l.concat({toString:()=>c}),l.length=t.length+1,yield l}}function*We(e=[],t,o){let r=o[P]||{};for(let i of e)yield i.map((s,n)=>q.call(this,t[n],s,r,!0))}function*Fe(e=[],t,o){let r=o[P]||{};for(let i of e){let s=[""];for(let n in i)s.push(q.call(this,t[n],i[n],r,!0));yield i}}function Ue(e){let t,o,r,i,s;return async function(l,c,a,d,p){let u={},_={start_row:a,start_col:c,end_row:p,end_col:d,id:!0},m=null;if(d-c>0&&p-a>0){this._is_old_viewport=this._last_window?.start_row===a&&this._last_window?.end_row===p&&this._last_window?.start_col===c&&this._last_window?.end_col===d;let[D,L]=await Promise.all([this._view.to_columns_string(_),this._view.num_columns()]);m=L,u=JSON.parse(D);let E=Object.keys(u).filter(C=>!te(C)),H=!1;for(let C=0;C<E.length;C++)this._column_paths[_.start_col+C]!==E[C]&&(H=!0,this._column_paths[_.start_col+C]=E[C]);if(H){let[C,R]=await Promise.all([this._view.schema(),this._view.expression_schema()]);this._schema={...C,...R};for(let A=0;A<E.length;A++){let W=E[A].split("|")[this._config.split_by.length];this._is_editable[A+_.start_col]=!!this._table_schema[W],this._column_types[A+_.start_col]=this._schema[W]}}this._last_window=_,this._ids=u.__ID__||Array(p-a).fill(null).map((C,R)=>[R+a]),this._reverse_columns=this._column_paths.slice(c,d).reduce((C,R,A)=>(C.set(R,A),C),new Map),this._reverse_ids=this._ids?.reduce((C,R,A)=>(C.set(R?.join("|"),A),C),new Map)}else this._div_factory.clear(),m=await this._view.num_columns();let f=[],h=[],g=[],b=[],v=e.hasAttribute("settings");for(let D=c;D<Math.min(d,this._column_paths.length);++D){let L=this._column_paths[D],y=L.split("|"),E=u[L]||new Array(p-a).fill(null),H=Math.min(l[P]?.[y[this._config.split_by.length]]?.aggregate_depth||0,this._config.group_by.length);f.push(E.map((C,R)=>(u?.__ROW_PATH__?.[R]?.length??0)<H?"":q.call(this,y[this._config.split_by.length],C,l[P]||{}))),h.push(E),v&&y.push(""),g.push(y),b.push(L)}let w=d-c>0&&p-a>0;w&&(this.last_column_paths=o,this.last_meta=t,this.last_ids=r,this.last_reverse_ids=i,this.last_reverse_columns=s,o=b,t=h,r=this._ids,i=this._reverse_ids,s=this._reverse_columns);let M=u.__ROW_PATH__!==void 0,S=this._config.group_rollup_mode==="flat",x=Array.from((M?S?We:Ie:Fe).call(this,u.__ROW_PATH__,this._config.group_by,l)),k=w?x[0]?.length:eo(this._config);return{num_column_headers:this._config.split_by.length+(v?2:1),num_row_headers:k,num_rows:this._num_rows,num_columns:m,row_headers:x,column_headers:g,data:f,metadata:h,column_header_merge_depth:Math.max(0,this._config.split_by.length)}}}function eo(e){return e.group_rollup_mode==="flat"?e.group_by.length:e.group_rollup_mode==="total"||e.group_by.length===0?0:e.group_by.length+1}var je=new Map,J=null;function $e(e){let t=e.startsWith("#")?e.slice(1):e;if(t.length===3||t.length===4){let o=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16);if(!isNaN(o)&&!isNaN(r)&&!isNaN(i))return[o,r,i]}else if(t.length===6||t.length===8){let o=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);if(!isNaN(o)&&!isNaN(r)&&!isNaN(i))return[o,r,i]}return null}function Be(e){let t=e.match(/^rgba?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*[, ]\s*([\d.]+)/i);return t?[Math.round(parseFloat(t[1])),Math.round(parseFloat(t[2])),Math.round(parseFloat(t[3]))]:null}function to(e){if(!J){let o=document.createElement("canvas");o.width=o.height=1,J=o.getContext("2d")}if(!J)return[0,0,0];J.fillStyle="#000",J.fillStyle=e;let t=J.fillStyle;return $e(t)??Be(t)??[0,0,0]}function K(e){let t=e.trim(),o=je.get(t);if(o)return o;let r=$e(t)??Be(t)??to(t);return je.set(t,r),r}function fe(e){return Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")}function be([e,t,o]){return`#${fe(e)}${fe(t)}${fe(o)}`}function ve([e,t,o]){let r=e/255,i=t/255,s=o/255,n=Math.max(r,i,s),l=Math.min(r,i,s),c=(n+l)/2,a=n-l,d=0,p=0;return a!==0&&(p=c>.5?a/(2-n-l):a/(n+l),n===r?d=((i-s)/a+(i<s?6:0))*60:n===i?d=((s-r)/a+2)*60:d=((r-i)/a+4)*60),[d,p,c]}function le([e,t,o]){let r=(e%360+360)%360/360;if(t===0){let l=Math.round(o*255);return[l,l,l]}let i=o<.5?o*(1+t):o+t-o*t,s=2*o-i,n=l=>(l<0&&(l+=1),l>1&&(l-=1),l<1/6?s+(i-s)*6*l:l<1/2?i:l<2/3?s+(i-s)*(2/3-l)*6:s);return[Math.round(n(r+1/3)*255),Math.round(n(r)*255),Math.round(n(r-1/3)*255)]}function oo(e,t,o=.5){return[Math.round(Math.sqrt(e[0]*e[0]*(1-o)+t[0]*t[0]*o)),Math.round(Math.sqrt(e[1]*e[1]*(1-o)+t[1]*t[1]*o)),Math.round(Math.sqrt(e[2]*e[2]*(1-o)+t[2]*t[2]*o))]}function ye(e,t){return be(oo(K(e),[t[0],t[1],t[2]],.5))}function z([e,t,o,r],i=[255,255,255]){function s(n,l){return((1-r)*(i[n]/255)+r*(l/255))*255}return[s(0,e),s(1,t),s(2,o)]}function I([e,t,o]){return Math.sqrt(e*e*.299+t*t*.587+o*o*.114)>130?"#161616":"#ffffff"}function ro(e){let[t,o,r]=ve(e),[i,s,n]=e,[l,c,a]=le([t-15,o,r]),[d,p,u]=le([t+15,o,r]);return`linear-gradient(to right top,rgb(${l},${c},${a}),rgb(${i},${s},${n}) 50%,rgb(${d},${p},${u}))`}function O(e){let t=K(e),o=ro(t);return[e,t[0],t[1],t[2],o,`rgba(${t[0]},${t[1]},${t[2]},1)`,`rgba(${t[0]},${t[1]},${t[2]},0)`]}function we(e,t){if(e.length!==t.length)return!0;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!0;return!1}function Ge(e,t){if(e.length!==t.length)return!0;for(let o=0;o<e.length;o++){if(e[o].length!==t[o].length)return!0;for(let r=0;r<e[o].length;r++)if(e[o][r]!==t[o][r])return!0}return!1}function ae(e,t,o){let r=window.getComputedStyle(e).getPropertyValue(t).trim();return r.length>0?r:o}var Ee=class{_name;_elements;_index;constructor(t){this._name=t,this._elements=[],this._index=0}clear(){this._index=0}get(){this._elements[this._index]||(this._elements[this._index]=document.createElement(this._name));let t=this._elements[this._index];return this._index+=1,t}};async function ce(e,t,o,r,i={}){let s=await o.get_config();if(this?.model?._config){let k=this.model._config,T=we(k.group_by,s.group_by),D=(k.group_by.length===0||s.group_by.length===0)&&T,L=we(k.split_by,s.split_by),y=we(k.columns,s.columns),E=Ge(k.filter,s.filter),H=Ge(k.sort,s.sort),C=k.group_rollup_mode!==s.group_rollup_mode,R=this.model._theme!==r;this._reset_scroll_top=T,this._reset_scroll_left=L,this._reset_select=T||L||E||H||y,this._reset_column_size=C||L||T||y||R||D}let[n,l,c,a,d]=await Promise.all([t.schema(),o.num_rows(),o.schema(),o.expression_schema(),this.parentElement.getEditPort()]),p=K(ae(e,"--psp--background-color","#FFFFFF")),u=O(ae(e,"--psp-datagrid--pos-cell--color","#338DCD")),_=O(ae(e,"--psp-datagrid--neg-cell--color","#FF5942")),m=O(ye(u[0],p)),f=O(ye(_[0],p)),h=O(ae(e,"--psp-active--color","#ff0000")),g={...c,...a},b={...n,...a},v=[],w=[],M=[],S=this._edit_mode||"READ_ONLY";S==="SELECT_ROW_TREE"&&(s.group_by.length===0||s.group_rollup_mode==="flat")&&(S="READ_ONLY",this._edit_mode=S),this._edit_button.dataset.editMode=S;let x=Object.assign(i,{_edit_port:d,_view:o,_table:t,_table_schema:b,_config:s,_num_rows:l,_schema:g,_ids:[],_plugin_background:p,_color:h,_pos_fg_color:u,_neg_fg_color:_,_pos_bg_color:m,_neg_bg_color:f,_column_paths:v,_column_types:M,_theme:r,_is_editable:w,_edit_mode:S,_selection_state:{selected_areas:[],dirty:!1},_row_header_types:s.group_by.map(k=>b[k]),_series_color_map:new Map,_series_color_seed:new Map,_div_factory:i._div_factory||new Ee("div")});return e.setDataListener(Ue(this.parentElement).bind(x,e),{virtual_mode:window.getComputedStyle(e).getPropertyValue("--datagrid-virtual-mode")?.trim()||"both"}),x}var X=["READ_ONLY","EDIT","SELECT_ROW","SELECT_COLUMN","SELECT_REGION","SELECT_ROW_TREE"];function io(e){return e?e._config.group_by.length>0&&e._config.group_rollup_mode!=="flat":!1}function Z(e){if(typeof e>"u"){let t=X.indexOf(this._edit_mode);do t=(t+1)%X.length;while(X[t]==="SELECT_ROW_TREE"&&!io(this.model));e=X[t]}this.parentElement?.setSelection?.(),this._edit_mode=e,this.model&&(this.model._edit_mode=e,this.model._tree_selection_id=void 0,this.model._selection_state={selected_areas:[],dirty:!0}),this.parentElement?.restore?.({plugin_config:{edit_mode:e}}),this._edit_button!==void 0&&(this._edit_button.dataset.editMode=e)}function Q(e){typeof e>"u"&&(e=!this._is_scroll_lock),this._is_scroll_lock=e,this.classList.toggle("sub-cell-scroll-disabled",e),this._scroll_lock!==void 0&&this._scroll_lock.classList.toggle("lock-scroll",e)}function oe(e,t=!1){if(!this._initialized)return;t&&(this._cached_column_sizes=e);let o=this.regular_table,r={...o.saveColumnSizes()},{group_by:i}=this.model._config,s=i?.length>0?i.length+1:0;for(let n of Object.keys(e))if(n==="__ROW_PATH__")r[s-1]=e[n];else{let l=this.model._column_paths.indexOf(n);if(l===-1)continue;r[l+s]=e[n]}o.restoreColumnSizes(r)}function re(){if(!this._initialized)return{};if(this._cached_column_sizes){let i=this._cached_column_sizes;return this._cached_column_sizes=void 0,i}let e=this.regular_table.saveColumnSizes(),{group_by:t}=this.model._config,o=t?.length>0?t.length+1:0,r={};for(let i of Object.keys(e)){let s=Number(i);if(e[s]!==void 0){let n=s-o;n>-1?r[this.model._column_paths[n]]=e[s]:n===-1&&(r.__ROW_PATH__=e[s])}}return r}function Ye(e,t,o,r){let i=Array.from(t.children[0].children[0].children),s=i.length,n=o.hasAttribute("settings");if(s<=1?i[0]?.removeAttribute("id"):i.forEach((l,c)=>{let a=n?1:0,d=c===s-(a+1)?"psp-column-titles":c===s-a?"psp-column-edit-buttons":null;d?l.setAttribute("id",d):l.removeAttribute("id")}),o.classList.toggle("psp-menu-open",!!r),n&&s>=2){let l=Array.from(i[s-2].children),c=Array.from(i[s-1].children);if(l&&c){i.slice(0,s-2).forEach(a=>{Array.from(a.children).forEach(d=>{d.classList.toggle("psp-menu-open",!1)})});for(let a=0;a<l.length;a++){let d=l[a],p=c[a],u=d.textContent===r;if(d.classList.toggle("psp-menu-open",u),p.classList.toggle("psp-menu-open",u),e._config.columns.length>1)for(let _ of t.querySelectorAll("td")){let m=t.getMeta(_);if(!m?.column_header)continue;let f=m.column_header[m.column_header.length-2]===r;_.classList.toggle("psp-menu-open",f)}}}}}function xe(e,t,o,r){let i=e._config.group_by.length-(e._config.group_rollup_mode==="flat"?1:0),s=e._column_settings_selected_column;for(let{element:n,metadata:l}of t.cells){if(!l||l.type==="body"||l.type==="row_header")continue;let c=l.column_header?.[e._config.split_by.length],a=e._config.sort.find(g=>g[0]===c),d=typeof l.x>"u",p=l.type==="corner"&&l.row_header_x===i||!d&&(l.x+1)%e._config.columns.length===0;n.classList.toggle("psp-header-border",p),n.classList.toggle("psp-header-group",!1),n.classList.toggle("psp-header-leaf",!0),n.classList.toggle("psp-is-top",!1),n.classList.toggle("psp-header-corner",d),n.classList.toggle("psp-header-sort-asc",!r&&!!a&&a[1]==="asc"),n.classList.toggle("psp-header-sort-desc",!r&&!!a&&a[1]==="desc"),n.classList.toggle("psp-header-sort-col-asc",!r&&!!a&&a[1]==="col asc"),n.classList.toggle("psp-header-sort-col-desc",!r&&!!a&&a[1]==="col desc"),n.classList.toggle("psp-header-sort-abs-asc",!r&&!!a&&a[1]==="asc abs"),n.classList.toggle("psp-header-sort-abs-desc",!r&&!!a&&a[1]==="desc abs"),n.classList.toggle("psp-header-sort-abs-col-asc",!r&&!!a&&a[1]==="col asc abs"),n.classList.toggle("psp-header-sort-abs-col-desc",!r&&!!a&&a[1]==="col desc abs");let u=Y(e,l),_=u==="integer"||u==="float",m=u==="string",f=u==="date",h=u==="datetime";if(n.classList.toggle("psp-align-right",_),n.classList.toggle("psp-align-left",!_),n.classList.toggle("psp-menu-enabled",(m||_||f||h)&&!d&&l.column_header_y===e._config.split_by.length+1),n.classList.toggle("psp-sort-enabled",(m||_||f||h)&&!d&&l.column_header_y===e._config.split_by.length),n.classList.toggle("psp-is-width-override",o.saveColumnSizes()[l.size_key]!==void 0),e._config.columns.length>1&&s){let g=l.column_header?.[l.column_header.length-2]===s;n.classList.toggle("psp-menu-open",g)}}}var so={desc:"asc",asc:void 0,"desc abs":"asc abs","asc abs":void 0},no={desc:"asc",asc:void 0,"desc abs":"asc abs","asc abs":void 0};async function qe(e,t,o,r,i){let s=t.getMeta(i);if(!s?.column_header)return;let n=s.column_header[e._config.split_by.length],l=r.ctrlKey||r.metaKey||r.altKey?lo:ao,c=r.shiftKey,a=l(e,`${n}`,c);await o.restore({sort:a})}function lo(e,t,o){let r=[],i=!1;for(let s of e._config.sort){let[n,l]=s;if(n===t){i=!0;let c=Je(e,t,l,o);c&&r.push(c)}else r.push(s)}return i||r.push([t,o?"desc abs":"desc"]),r}function ao(e,t,o){for(let[r,i]of e._config.sort)if(r===t){let s=Je(e,t,i,o);return s?[s]:[]}return[[t,o?"desc abs":"desc"]]}function Je(e,t,o,r){let s=e._config.split_by.length>0?no:so,n=o?s[o]:"desc";if(n)return[t,n]}async function Ce(e,t,o){let r=t.getMeta(o.target);if(!r||r.type!=="row_header")return;let i=o.target.classList.contains("psp-tree-label-collapse");o.shiftKey&&i?e._view.set_depth(r.row_header.filter(s=>s!==void 0).length-2):o.shiftKey?e._view.set_depth(r.row_header.filter(s=>s!==void 0).length-1):i?e._view.collapse(r.y):e._view.expand(r.y),e._num_rows=await e._view.num_rows(),e._num_columns=await e._view.num_columns(),t.draw()}function Ke(e,t,o){return async r=>{let i=r;if(i.which!==1)return;let s=i.target;if(s?.tagName!=="A"){for(;s&&s.tagName!=="TD"&&s.tagName!=="TH";)if(s=s.parentElement,!s||!t.contains(s))return;if(s){if(s.classList.contains("psp-tree-label")){e._edit_mode!=="SELECT_ROW_TREE"&&Ce(e,t,i);return}if(s.classList.contains("psp-menu-enabled")){let l=t.getMeta(s)?.column_header?.[e._config.split_by.length];await o.toggleColumnSettings(`${l}`)}else s.classList.contains("psp-sort-enabled")&&qe(e,t,o,i,s)}}}}function Xe(e,t,o){return async r=>{let i=r;if(i.which!==1)return;let s=i.target;if(s?.tagName!=="A"){for(;s&&s.tagName!=="TD"&&s.tagName!=="TH";)if(s=s.parentElement,!s||!t.contains(s))return;s&&s.classList.contains("psp-tree-label")&&e._edit_mode==="SELECT_ROW_TREE"&&Ce(e,t,i)}}}function Ze(e){return t=>{let o=t;if(o.which!==1)return;let r=o.target;for(;r&&r.tagName!=="TD"&&r.tagName!=="TH";)if(r=r.parentElement,!r||!e.contains(r))return;r&&(r.classList.contains("psp-tree-label")&&o.offsetX<26||r.classList.contains("psp-header-leaf")&&!r.classList.contains("psp-header-corner"))&&o.stopImmediatePropagation()}}function Me(e,t,o){let r=e.getMeta(o);if(!r)return!1;let i=t._schema[t._column_paths[r.x]],s=o.textContent||"",n=t._ids[r.y-r.y0][0];if(i==="float"||i==="integer"){let c=parseFloat(s.replace(/,/g,""));if(isNaN(c))return!1;s=c}else if(i==="date"||i==="datetime"){let c=Date.parse(s);if(isNaN(c))return!1;s=c}else i==="boolean"&&(s=s==="true"?!1:s==="false"?!0:null);let l={__INDEX__:n,[t._column_paths[r.x]]:s};return t._table.update([l],{port_id:t._edit_port,format:null}),!0}function Qe(e,t,o,r){let i=t.getMeta(r.target);if(i?.type==="body"||i?.type==="column_header"){let s=e._is_editable[i.x],n=Y(e,i)==="boolean",l=r.target.classList.contains("psp-null");s&&n&&!l&&Me(t,e,r.target)}}function et(e,t,o,r){return i=>{let s=i;if(V(e,o)&&r.has(t)){let n=s.target;n.classList.remove("psp-error");let l=r.get(t);r.delete(t),l.content!==n.textContent&&(Me(t,e,n)||(n.textContent=l.content||"",n.classList.add("psp-error"),n.focus()))}}}function tt(e,t,o,r){return i=>{let n=i.target,l=t.getMeta(n);if(l?.type==="body"){let c={x:l.x,y:l.y,content:n.textContent||void 0};r.set(t,c)}}}function ot(e,t,o,r){let i=r.get(o),s=o.getRootNode();if(i){for(let{element:n,metadata:l}of t)if(l.type==="body"&&l.x===i.x&&l.y===i.y){s.activeElement!==n&&n.focus({preventScroll:!0});return}document.activeElement!==document.body&&o.contains(s.activeElement)&&s.activeElement.blur()}}function rt(e,t){let o=t.get(e);if(!o)return!1;let r=e.getRootNode(),i=e.children[0]?.children[1];if(i)for(let s of i.children)for(let n of s.children){let l=e.getMeta(n);if(l?.type==="body"&&l.x===o.x&&l.y===o.y)return r.activeElement!==n&&n.focus({preventScroll:!0}),!0}return document.activeElement!==document.body&&e.contains(r.activeElement)&&r.activeElement.blur(),!1}function po(e){let t;return async function(o,r,i,s,n,l){if(t){await t;return}let c;t=new Promise(d=>c=d);let a=await e(o,r,i,s,n,l);return t=void 0,c(),a}}function it(e){if(e.isContentEditable){let t=e.getRootNode().getSelection()?.getRangeAt(0);if(!t)return 0;let o=t.cloneRange();return o.selectNodeContents(e),o.setEnd(t.endContainer,t.endOffset),o.toString().length}else return e.selectionStart||0}var ee=po(async function(e,t,o,r,i,s){let n=t.getMeta(r);if(!n||n.type!=="body")return;let l=e._column_paths.length,c=e._num_rows,a=o.get(t);if(!a)return;n.x+i<l&&0<=n.x+i&&(a.x=n.x+i),n.y+s<c&&0<=n.y+s&&(a.y=n.y+s);let d=Math.max(n.x0-10,0),p=Math.min(n.x0+10,l),u=Math.max(n.y0-5,0),_=Math.min(n.y0+10,c),m=n.x0+i,f=n.y0+s;for(;!rt(t,o)&&m>=d&&m<p&&f>=u&&f<_;)await t.scrollToCell(m,f),o.set(t,a),m+=i,f+=s});function mo(e,t,o){let r=t.getMeta(o);return r?.type==="body"&&r.y===e._num_rows-1}function st(e,t,o,r,i){let s=t.getRootNode().activeElement;switch(i.target.classList.remove("psp-error"),i.key){case"Enter":i.preventDefault(),mo(e,t,s)?(s.blur(),r.delete(t)):i.shiftKey?ee(e,t,r,s,0,-1):ee(e,t,r,s,0,1);break;case"ArrowLeft":it(s)===0&&(i.preventDefault(),ee(e,t,r,s,-1,0));break;case"ArrowUp":i.preventDefault(),ee(e,t,r,s,0,-1);break;case"ArrowRight":it(s)===(s.textContent?.length||0)&&(i.preventDefault(),ee(e,t,r,s,1,0));break;case"ArrowDown":i.preventDefault(),ee(e,t,r,s,0,1);break;default:}}function nt(e,t,o,r){return i=>{let s=i;if(e._edit_mode==="EDIT"){if(!V(e,o))return;st(e,t,o,r,s)}else console.debug(`Mode ${e._edit_mode} for "keydown" event not yet implemented`)}}function lt(e,t,o){return r=>{let i=r;if(e._edit_mode==="EDIT"){if(!V(e,o))return;Qe(e,t,o,i)}}}async function ie({_view:e,_config:t},o,r){let i=t.group_by,s=t.split_by,n=o>=0?o:0,l=n+1,c=await e.to_json({start_row:n,end_row:l}),d=c.map(g=>g.__ROW_PATH__)[0]||[],p=i.map((g,b)=>{let v=d[b];return v?[g,"==",v]:void 0}).filter(g=>g!==void 0),_=Object.keys(c[0]).filter(g=>!te(g))[r],m={row:c[0],column_names:[],config:{filter:[]}},f=[];if(_){let g=_.split("|");m.column_names=[g[s.length]],f=s.map((b,v)=>{let w=g[v];return w?[b,"==",w]:void 0}).filter(b=>b!==void 0).filter(([,,b])=>!te(b))}let h=t.filter.concat(p).concat(f);return m.config={filter:h},m}function at(e,t,o){return async r=>{let i=r,s=t.getMeta(i.target);if(!s||s.type!=="body")return;let{x:n,y:l}=s,{row:c,column_names:a,config:d}=await ie(e,l,n);o.dispatchEvent(new CustomEvent("perspective-click",{bubbles:!0,composed:!0,detail:{row:c,column_names:a,config:d}}))}}var _o="mouse-selected-area",pt=(e,t,{className:o=_o,selected:r=[],onSelect:i}={})=>(e.model._selection_state={selected_areas:r,dirty:!0},t.addEventListener("mousedown",ho(e,t,o)),t.addEventListener("mouseover",go(e,t,o)),t.addEventListener("mouseup",fo(e,t,o,i)),t.addStyleListener(()=>j(e,t,o)),t);function de(e){return e==="SELECT_ROW_TREE"}var ho=(e,t,o)=>r=>{let i=r;if(i.button===0&&pe(e.model._edit_mode)){if(de(e.model._edit_mode))return;e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={};let s=t.getMeta(i.target);if(s?.type==="body"&&s.x!==void 0&&s.y!==void 0){e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={x:s.x,y:s.y},e.model._selection_state.old_selected_areas=e.model._selection_state.selected_areas,e.model._selection_state.selected_areas=[];let n={x0:s.x,x1:s.x,y0:s.y,y1:s.y};e.model._selection_state.potential_selection=n,j(e,t,o,e.model._selection_state.selected_areas.concat([n]));return}}e.model._selection_state.selected_areas=[]},go=(e,t,o)=>r=>{let i=r,s=e.model._edit_mode;if(pe(s)&&!de(s)&&e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES&&e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x!==void 0){let n=t.getMeta(i.target);if(n?.type==="body"&&n.x!==void 0&&n.y!==void 0){let l={x0:Math.min(n.x,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x),x1:Math.max(n.x,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x),y0:Math.min(n.y,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.y),y1:Math.max(n.y,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.y)};e.model._selection_state.potential_selection=l,j(e,t,o,e.model._selection_state.selected_areas.concat([l]))}}},fo=(e,t,o,r)=>i=>{let s=i,n=e.model._edit_mode;if(pe(n)){let l=t.getMeta(s.target);if(!l)return;if(de(n)){if((l.type==="body"||l.type==="row_header")&&l.y!==void 0&&l.y>=0){let c=e.model._selection_state.selected_areas;if(c.length>0&&c[0].y0===l.y)e.model._selection_state.selected_areas=[],e.model._selection_state.dirty=!0,j(e,t,o,[]),r?.(c[0],!0);else{let d={x0:0,x1:0,y0:l.y,y1:l.y};e.model._selection_state.selected_areas=[d],e.model._selection_state.dirty=!0,j(e,t,o),r?.(d,!1)}}e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={},e.model._selection_state.potential_selection=void 0;return}if((e.model._selection_state.old_selected_areas?.length??0)>0){let c=e.model._selection_state.old_selected_areas[0];if(c.x0===c.x1&&c.y0===c.y1&&l?.type==="body"&&c.x0===l.x&&c.y0===l.y){e.model._selection_state.selected_areas=[],e.model._selection_state.old_selected_areas=[],e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={},e.model._selection_state.potential_selection=void 0,j(e,t,o,[]);return}}if(e.model._selection_state.old_selected_areas=[],e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES&&e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x!==void 0&&l?.type==="body"&&l.x!==void 0&&l.y!==void 0){let c={x0:Math.min(l.x,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x),x1:Math.max(l.x,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.x),y0:Math.min(l.y,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.y),y1:Math.max(l.y,e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES.y)};e.model._selection_state.selected_areas.push(c),j(e,t,o)}e.model._selection_state.CURRENT_MOUSEDOWN_COORDINATES={},e.model._selection_state.potential_selection=void 0}};function ct(e){return e==="SELECT_COLUMN"||e==="SELECT_REGION"}function dt(e){return e==="SELECT_ROW"||e==="SELECT_REGION"||e==="SELECT_ROW_TREE"}function bo(e,t,{x0:o,x1:r,y0:i,y1:s}){let n={},l=t.model._edit_mode;o!==void 0&&ct(l)&&(n.start_col=o),r!==void 0&&ct(l)&&(n.end_col=r+1),i!==void 0&&dt(l)&&(n.start_row=i),s!==void 0&&dt(l)&&(n.end_row=s+1),e.setSelection(n)}var vo={SELECT_REGION:(e,t)=>t.x0<=e.x&&e.x<=t.x1&&t.y0<=e.y&&e.y<=t.y1,SELECT_ROW:(e,t)=>t.y0<=e.y&&e.y<=t.y1,SELECT_ROW_TREE:(e,t)=>t.y0<=e.y&&e.y<=t.y1,SELECT_COLUMN:(e,t)=>t.x0<=e.x&&e.x<=t.x1};function pe(e){return e==="SELECT_REGION"||e==="SELECT_ROW"||e==="SELECT_COLUMN"||e==="SELECT_ROW_TREE"}var j=(e,t,o,r)=>{let i=e.model._edit_mode;if(pe(i))if(r=e.model._selection_state.selected_areas.slice(0),e.model._selection_state.potential_selection&&r.push(e.model._selection_state.potential_selection),r.length>0)bo(e.parentElement,e,r[0]),de(i)||yo(e,t,r,o);else{e.parentElement.setSelection();let s=t.querySelectorAll("tbody td");for(let n of s)n.classList.remove(o)}else if(e.model._selection_state.dirty){e.model._selection_state.dirty=!1;let s=t.querySelectorAll("tbody td, tbody th");for(let n of s)n.classList.remove(o)}},yo=(e,t,o,r)=>{let i=vo[e.model._edit_mode];if(!i||o.length===0)return;let s=t.querySelectorAll("tbody td");for(let n of s){let l=t.getMeta(n);if(!l||l.type!=="body")continue;let c=!1;for(let a of o)a.x0!==void 0&&a.y0!==void 0&&a.x1!==void 0&&a.y1!==void 0&&i(l,a)&&(c=!0,e.model._selection_state.dirty=!0,n.classList.add(r));c||n.classList.remove(r)}};function mt(e,t,o,r){if(t.length===0)return;let i=e._column_settings_selected_column,s=t.length,n=r.hasAttribute("settings");if(s<=1?t[0]?.row.removeAttribute("id"):t.forEach(({row:a},d)=>{let p=n?1:0,u=d===s-(p+1)?"psp-column-titles":d===s-p?"psp-column-edit-buttons":null;u?a.setAttribute("id",u):a.removeAttribute("id")}),r.classList.toggle("psp-menu-open",!!i),n&&s>=2){let a=t[s-2],d=t[s-1];if(a&&d){t.slice(0,s-2).forEach(({cells:p})=>{p.forEach(({element:u})=>{u.classList.toggle("psp-menu-open",!1)})});for(let p=0;p<a.cells.length;p++){let u=a.cells[p]?.element,_=d.cells[p]?.element;if(!u||!_)continue;let m=u.textContent===i;u.classList.toggle("psp-menu-open",m),_.classList.toggle("psp-menu-open",m)}}}let l=e._config.split_by.length;if(l<t.length){let a=t[l];a&&xe(e,a,o,!1)}let c=e._config.split_by.length+1;if(c<t.length){let a=t[c];a&&xe(e,a,o,!0)}}function ut(e,t,o){let r=e._config.group_by.length,i=[],s=new Set;for(let n=0;n<t.length;n++){let{cells:l}=t[n],c=new Set;for(let a=0;a<l.length;a++){let{element:d,metadata:p}=l[a];if(!p)continue;d.style.backgroundColor="";let u=p.type==="corner"&&r>0&&p.row_header_x===r||p.type==="column_header"&&p.x>=0;d.classList.toggle("psp-align-right",!1),d.classList.toggle("psp-align-left",!1),d.classList.toggle("psp-header-group",!0),d.classList.toggle("psp-header-leaf",!1),d.classList.toggle("psp-header-border",u),d.classList.toggle("psp-header-group-corner",p.type==="corner"),d.classList.toggle("psp-color-mode-bar",!1),d.classList.toggle("psp-color-mode-label-bar",!1),d.classList.toggle("psp-header-sort-asc",!1),d.classList.toggle("psp-header-sort-desc",!1),d.classList.toggle("psp-header-sort-col-asc",!1),d.classList.toggle("psp-header-sort-col-desc",!1),d.classList.toggle("psp-sort-enabled",!1);let _=a;for(;i[n]&&i[n][_];++_);c.add(_);let m=d;for(let f=_;f<_+m.colSpan;++f)for(let h=n;h<n+m.rowSpan;++h)i[h]||(i[h]=[]),i[h][f]=!0;m.classList.toggle("psp-is-top",n===0||!s.has(_))}s=c}}function _t(e,t,o,[,,,,,r,i],[,,,,,s,n],l){let c=e._ids?.[t.dy??0]?.join("|"),a=(l?(t.column_header??[]).slice(0,-1):t.column_header??[]).join("|");if(e.last_reverse_columns?.has(a)&&e.last_reverse_ids?.has(c)){let d=e.last_reverse_ids?.get(c),p=e.last_reverse_columns.get(a);e._is_old_viewport?p!==void 0&&d!==void 0&&e.last_meta?.[p]?.[d]!==void 0&&e.last_meta[p][d]>(t.user??0)?(o.style.setProperty("--pulse--background-color-start",s),o.style.setProperty("--pulse--background-color-end",n),o.style.animationName==="pulse_neg"?o.style.animation="pulse_neg2 0.5s linear":o.style.animation="pulse_neg 0.5s linear"):p!==void 0&&d!==void 0&&e.last_meta?.[p]?.[d]!==void 0&&e.last_meta[p][d]<(t.user??0)?(o.style.setProperty("--pulse--background-color-start",r),o.style.setProperty("--pulse--background-color-end",i),o.style.animationName==="pulse_pos"?o.style.animation="pulse_pos2 0.5s linear":o.style.animation="pulse_pos 0.5s linear"):d!==t.dy&&(o.style.animation=""):o.style.animation=""}else o.style.animation=""}function ht(e,t,o,r,i){let s=(r.user??0)>0,n=(r.user??0)<0,l;t?.pos_bg_color!==void 0?l=t.pos_bg_color:l=e._pos_bg_color;let c;t?.neg_bg_color!==void 0?c=t.neg_bg_color:c=e._neg_bg_color;let a=s?l:n?c:["",e._plugin_background[0],e._plugin_background[1],e._plugin_background[2],"","",""];{let[_,m,f,h]=a;if(o.style.position="",r._is_hidden_by_aggregate_depth)o.style.animation="",o.style.backgroundColor="";else if(t?.number_bg_mode==="color")o.style.animation="",o.style.backgroundColor=_;else if(t?.number_bg_mode==="gradient"){let g=Math.max(0,Math.min(1,Math.abs((r.user??0)/(t.bg_gradient??1)))),b=e._plugin_background,v=I(z([m,f,h,g],b));o.style.animation="",o.style.color=v,o.style.backgroundColor=`rgba(${m},${f},${h},${g})`}else t?.number_bg_mode==="pulse"?(_t(e,r,o,l,c,i),o.style.backgroundColor=""):(t?.number_bg_mode==="disabled"||t?.number_bg_mode,o.style.animation="",o.style.backgroundColor="")}let d=t?.pos_fg_color!==void 0?s?t.pos_fg_color:n?t.neg_fg_color:["",e._plugin_background[0],e._plugin_background[1],e._plugin_background[2],"","",""]:s?e._pos_fg_color:n?e._neg_fg_color:["",e._plugin_background[0],e._plugin_background[1],e._plugin_background[2],"","",""],[p,,,,u]=d;if(r._is_hidden_by_aggregate_depth)o.style.backgroundColor="",o.style.color="";else if(t?.number_fg_mode==="disabled")if(t?.number_bg_mode==="color"){let _=e._plugin_background,m=I(z([a[1],a[2],a[3],1],_));o.style.color=m}else t?.number_bg_mode==="gradient"||(o.style.color="");else t?.number_fg_mode==="bar"?(o.style.color="",o.style.position="relative",o.style.setProperty("--psp-label-bar-color",u),o.style.setProperty("--psp-label-bar-bg",p)):t?.number_fg_mode==="label-bar"?(o.style.color="",o.style.setProperty("--psp-label-bar-color",u),o.style.setProperty("--psp-label-bar-bg",p)):(t?.number_fg_mode==="color"||!t?.number_fg_mode)&&(o.style.color=p)}function gt(e,t,o,r){let i=r.column_header?.[e._config.split_by.length],s=t?.color!==void 0?t.color:e._color,[n,l,c,a]=s;if(r._is_hidden_by_aggregate_depth)o.style.backgroundColor="",o.style.color="";else if(t?.string_color_mode==="foreground"&&r.user!==null)o.style.color=n,o.style.backgroundColor="",t?.format==="link"&&o.children[0]&&(o.children[0].style.color=n);else if(t?.string_color_mode==="background"&&r.user!==null){let d=e._plugin_background,p=I(z([l,c,a,1],d));o.style.color=p,o.style.backgroundColor=n}else if(t?.string_color_mode==="series"&&r.user!==null&&i){e._series_color_map.has(i)||(e._series_color_map.set(i,new Map),e._series_color_seed.set(i,0));let d=e._series_color_map.get(i);if(r.user&&!d.has(r.user)){let S=e._series_color_seed.get(i)??0;d.set(r.user,S),e._series_color_seed.set(i,S+1)}let p=d.get(r.user)??0,[u,_,m]=ve(K(n)),f=le([u+p*150%360,_,m]),[h,g,b]=f,v=be(f),w=e._plugin_background,M=I(z([h,g,b,1],w));o.style.color=M,o.style.backgroundColor=v}else o.style.backgroundColor="",o.style.color=""}function ft(e,t,o,r){let i=t?.color!==void 0?t.color:e._color,[s,n,l,c]=i;if(r._is_hidden_by_aggregate_depth)o.style.backgroundColor="",o.style.color="";else if(t?.datetime_color_mode==="foreground"&&r.user!==null)o.style.color=s,o.style.backgroundColor="";else if(t?.datetime_color_mode==="background"&&r.user!==null){let a=e._plugin_background,d=I(z([n,l,c,1],a));o.style.color=d,o.style.backgroundColor=s}else o.style.backgroundColor="",o.style.color=""}function bt(e,t,o,r){if(r._is_hidden_by_aggregate_depth)o.style.backgroundColor="",o.style.color="";else{let[i]=r.user===!0?e._pos_fg_color:r.user===!1?e._neg_fg_color:["",0,0,0,""];o.style.backgroundColor="",o.style.color=i}}function vt(e,t,o,r){let i=r.value!==void 0&&r.value!==null&&r.value?.toString()?.trim().length>0,s=(r.row_header_x??0)>=e._config.group_by.length,n=t.getMeta({dx:0,dy:(r.y??0)-(r.y0??0)+1}),l=n&&n.row_header&&typeof n.row_header[(r.row_header_x??0)+1]<"u";o.classList.toggle("psp-tree-label",i&&!s),o.classList.toggle("psp-tree-label-expand",i&&!s&&!l),o.classList.toggle("psp-tree-label-collapse",i&&!s&&l),o.classList.toggle("psp-tree-leaf",i&&s)}function yt(e,t,o,r,i,s,n){let l=i?e._tree_selection_id:void 0;n.classList.toggle("flat-group-rollup-mode",e._config.group_rollup_mode==="flat");for(let{element:c,metadata:a,isHeader:d}of t){let p=a.column_header?.[e._config.split_by.length],u=Y(e,a),_=p?o[p.toString()]:void 0,m=u==="integer"||u==="float";a._is_hidden_by_aggregate_depth=e._config.group_rollup_mode==="rollup"&&(h=>h===0||h===void 0?!1:h-1<Math.min(e._config.group_by.length,_?.aggregate_depth||0))(a.row_header?.filter(h=>h!==void 0)?.length),m?ht(e,_,c,a,r):u==="boolean"?bt(e,_,c,a):u==="string"?gt(e,_,c,a):u==="date"||u==="datetime"?ft(e,_,c,a):(c.style.backgroundColor="",c.style.color=""),c.classList.toggle("psp-bool-type",u==="boolean"&&a.user!==null),c.classList.toggle("psp-null",a.value===null),c.classList.toggle("psp-align-right",!d&&m),c.classList.toggle("psp-align-left",d||!m),e._column_settings_selected_column?c.classList.toggle("psp-menu-open",p===e._column_settings_selected_column):c.classList.toggle("psp-menu-open",!1),c.classList.toggle("psp-color-mode-bar",_?.number_fg_mode==="bar"&&m),c.classList.toggle("psp-color-mode-label-bar",_?.number_fg_mode==="label-bar"&&m),d&&vt(e,n,c,a);let f=c.parentElement;if(f&&(f.dataset.y=String(a.y)),a.type!=="row_header"||a.row_header_x===a.row_header.length-1||a.row_header[a.row_header_x+1]===void 0?(c.dataset.y=String(a.y),a.type!=="row_header"?c.dataset.x=String(a.x):delete c.dataset.x):(delete c.dataset.y,delete c.dataset.x),c.classList.toggle("psp-select-region-inactive",!1),i)if(!l)c.classList.toggle("psp-select-region",!1);else{let h=e._ids[(a.y??0)-(a.y0??0)],g=l.reduce((w,M,S)=>w&&M===h[S],!0),b=h.length===l.length&&g,v=h.length!==l.length&&g;d&&a.type==="row_header"&&a.row_header_x!==void 0&&h[a.row_header_x]?c.classList.toggle("psp-select-region",!1):(c.classList.toggle("psp-select-region",b),c.classList.toggle("psp-select-region-inactive",v))}if(!d&&a.type==="body")if(s&&e._is_editable[a.x]){let g=a.column_header?.[e._config.split_by.length]?.toString();g&&u==="string"&&o[g]?.format==="link"?(c.toggleAttribute("contenteditable",!1),c.classList.toggle("boolean-editable",!1)):u==="boolean"?(c.toggleAttribute("contenteditable",!1),c.classList.toggle("boolean-editable",a.user!==null)):(s!==c.hasAttribute("contenteditable")&&c.toggleAttribute("contenteditable",s),c.classList.toggle("boolean-editable",!1))}else c.toggleAttribute("contenteditable",!1),c.classList.toggle("boolean-editable",!1)}}function wt(e,t,o,r,i){return function(){let n=o[P]||{},l=r.hasAttribute("settings"),c=t._edit_mode==="SELECT_ROW_TREE",a=V(t,r),d=V(t,r,!0);e.classList.toggle("edit-mode-allowed",d);let p=[],u=[],_=o.children[0]?.children[1];if(_)for(let f of _.children)for(let h of f.children){let g=o.getMeta(h);if(g&&(g.type==="body"||g.type==="row_header")){let b=h.tagName==="TH";p.push({element:h,metadata:g,isHeader:b})}}let m=o.children[0]?.children[0];if(m)for(let f of m.children){let h={row:f,cells:[]};for(let g of f.children){let b=o.getMeta(g);h.cells.push({element:g,metadata:b})}u.push(h)}yt(t,p,n,l,c,a,o),ut(t,u,o),mt(t,u,o,r),ot(t,p,o,i)}}async function Et(e){let t=this.parentElement,o=await t.getTable();if(this._initialized)await ce.call(this,this.regular_table,o,e,t.getAttribute("theme"),this.model);else{if(this.innerHTML="",this.shadowRoot?this.shadowRoot.appendChild(this.regular_table):this.appendChild(this.regular_table),this.model=await ce.call(this,this.regular_table,o,e,t.getAttribute("theme")),!this.model)return;let r=this.model,i=this.regular_table,s=async(l,c)=>{if(r._edit_mode!=="SELECT_ROW_TREE")return;if(c)r._tree_selection_id=void 0;else{let _=l.y0-(r._last_window?.start_row??0);_>=0&&_<r._ids.length&&(r._tree_selection_id=r._ids[_])}let{row:a,column_names:d,config:p}=await ie(r,l.y0,0),u;if(c){if((r._last_insert_configs?.length||0)>0)u=new G(!1,a,[],r._last_insert_configs??[],[]);else throw new Error("Suprious deselect");r._last_insert_configs=void 0}else u=new G(!0,a,d,r._last_insert_configs??[],[p]),r._last_insert_configs=[p];await i.draw({preserve_width:!0}),t.dispatchEvent(new CustomEvent("perspective-global-filter",{bubbles:!0,composed:!0,detail:u}))};pt(this,this.regular_table,{className:"psp-select-region",onSelect:s});let n=new WeakMap;this.regular_table.addStyleListener(wt(this,this.model,this.regular_table,t,n)),this.regular_table.addEventListener("click",Ze(this.regular_table)),this.regular_table.addEventListener("click",at(this.model,this.regular_table,t)),this.regular_table.addEventListener("mousedown",Ke(this.model,this.regular_table,t)),this.regular_table.addEventListener("dblclick",Xe(this.model,this.regular_table,t)),this.regular_table.addEventListener("click",lt(this.model,this.regular_table,t)),this.regular_table.addEventListener("focusin",tt(this.model,this.regular_table,t,n)),this.regular_table.addEventListener("focusout",et(this.model,this.regular_table,t,n)),this.regular_table.addEventListener("keydown",nt(this.model,this.regular_table,t,n)),t.addEventListener("perspective-toggle-column-settings",l=>{let c=l;if(this.isConnected){if(Ye(this.model,this.regular_table,t,c.detail.column_name??void 0),!c.detail.open){this.model._column_settings_selected_column=void 0;return}this.model._column_settings_selected_column=c.detail.column_name??void 0}}),this._initialized=!0}}function xt(e,t){e=JSON.parse(JSON.stringify(e)),t=JSON.parse(JSON.stringify(t));let o={};if(e.columns)for(let[s,n]of Object.entries(e.columns))n.column_size_override!==void 0&&(o[s]=n.column_size_override,delete n.column_size_override);let r={};if(t)for(let[s,n]of Object.entries(t))r[s]={...n,pos_fg_color:n.pos_fg_color?O(n.pos_fg_color):void 0,neg_fg_color:n.neg_fg_color?O(n.neg_fg_color):void 0,pos_bg_color:n.pos_bg_color?O(n.pos_bg_color):void 0,neg_bg_color:n.neg_bg_color?O(n.neg_bg_color):void 0,color:n.color?O(n.color):void 0};"edit_mode"in e?X.indexOf(e.edit_mode)!==-1?Z.call(this,e.edit_mode):console.error("Unknown edit mode "+e.edit_mode):Z.call(this,"READ_ONLY"),"scroll_lock"in e?Q.call(this,e.scroll_lock):Q.call(this,!1);let i=this.regular_table;oe.call(this,o,!0),i[P]=r}function Ct(){if(this.regular_table){let e={columns:{},scroll_lock:!!this._is_scroll_lock,edit_mode:this._edit_mode},t=re.call(this);for(let o of Object.keys(t||{}))e.columns?.[o]||(e.columns=e.columns||{},e.columns[o]={}),e.columns[o].column_size_override=t[o];return JSON.parse(JSON.stringify(e))}return{}}async function Mt(e){if(this.parentElement&&await this.activate(e),!this.isConnected||this.offsetParent==null||!this.model)return;let t=re.call(this),o=this.regular_table.draw({invalid_columns:!0});this._reset_scroll_top&&(this.regular_table.scrollTop=0,this._reset_scroll_top=!1),this._reset_scroll_left&&(this.regular_table.scrollLeft=0,this._reset_scroll_left=!1),this._reset_select&&(this.regular_table.dispatchEvent(new CustomEvent("psp-deselect-all",{bubbles:!1})),this._reset_select=!1),this._reset_column_size&&(this.regular_table.resetAutoSize(),this._reset_column_size=!1),oe.call(this,t),await o,this._toolbar?.classList.toggle("aggregated",this.model._config.group_by.length>0||this.model._config.split_by.length>0)}function ke(e,t,o,r,i,s){let n=[];if(e==="integer"||e==="float"){let a=this.model._pos_fg_color[0],d=this.model._neg_fg_color[0],p=this.model._pos_bg_color[0],u=this.model._neg_bg_color[0];n.push({kind:"Enum",key:"number_fg_mode",default:"color",variants:[{value:"disabled",label:"Disabled"},{value:"color",label:"Color"},{value:"bar",label:"Bar"},{value:"label-bar",label:"Gradient"}]});let _=r?.number_fg_mode??"color";_!=="disabled"&&n.push({kind:"ColorRange",key_pos:"pos_fg_color",key_neg:"neg_fg_color",default_pos:a,default_neg:d,is_gradient:!1}),(_==="bar"||_==="label-bar")&&n.push({kind:"Number",key:"fg_gradient",default:s?.abs_max??0,include:!0}),n.push({kind:"Enum",key:"number_bg_mode",default:"disabled",variants:[{value:"disabled",label:"Disabled"},{value:"color",label:"Color"},{value:"gradient",label:"Gradient"},{value:"pulse",label:"Pulse"}]});let m=r?.number_bg_mode??"disabled";m!=="disabled"&&n.push({kind:"ColorRange",key_pos:"pos_bg_color",key_neg:"neg_bg_color",default_pos:p,default_neg:u,is_gradient:m==="gradient"||m==="pulse"}),m==="gradient"&&n.push({kind:"Number",key:"bg_gradient",include:!0,default:s?.abs_max??0}),n.push({kind:"NumberFormat"})}else e==="date"||e==="datetime"?(n.push({kind:"DatetimeFormat"}),n.push({kind:"Enum",key:"datetime_color_mode",default:"none",variants:[{value:"none",label:"None"},{value:"foreground",label:"Foreground"},{value:"background",label:"Background"}]}),(r?.datetime_color_mode??"none")!=="none"&&n.push({kind:"Color",key:"color",default:this.model._color[0]})):e==="string"&&(n.push({kind:"StringFormat"}),n.push({kind:"Enum",key:"string_color_mode",default:"none",variants:[{value:"none",label:"None"},{value:"foreground",label:"Foreground"},{value:"background",label:"Background"},{value:"series",label:"Series"}]}),(r?.string_color_mode??"none")!=="none"&&n.push({kind:"Color",key:"color",default:this.model._color[0]}));let l=i?.group_by??[],c=(i?.group_rollup_mode??"rollup")==="rollup";return l.length>0&&c&&n.push({kind:"AggregateDepth"}),{fields:n}}var kt='regular-table{--psp-datagrid--hover--border-color:var(--psp-inactive--color,#c5c9d080);margin:12px 0 0 12px;padding:0;font-family:inherit;& div[tabindex]{outline:none}&>div{position:absolute;inset:0;overflow:hidden}& th{text-align:center}& thead tr:not(.rt-autosize) th{max-width:0;overflow:hidden}& thead tr:last-child .rt-float,& tbody .rt-float,& thead .rt-integer,& tbody .rt-integer{text-align:right}& tbody th{text-align:left}& span.rt-tree-container{align-items:center;height:100%;display:flex}& thead .rt-string,& tbody .rt-string,& thead .rt-date,& tbody .rt-date,& thead .rt-datetime,& tbody .rt-datetime{text-align:left}& thead tr:last-child th{border-bottom:1px solid #8b868045}& tbody tr:first-child td,& tbody tr:first-child th{border-top:1px solid #0000!important}& th{position:relative}& tr th span.rt-tree-group{border-left:1px solid #eee;height:100%;margin-left:5px;margin-right:15px}& td,& th{white-space:nowrap;height:var(--psp-datagrid--row--height,19px);padding:0 5px}& table *{box-sizing:border-box}& table{color:#666;outline:none;position:absolute}& span.rt-row-header-icon{color:#aaa;font-family:var(--psp-button--font-family);padding-right:4px}& span.rt-column-header-icon{width:10px;font-size:10px;font-family:var(--psp-button--font-family);padding-left:3px;display:inline-block}& span.rt-row-header-icon:hover{color:#1a7da1;text-shadow:0 0 3px #1a7da1}& .rt-selected td{background-color:#eee}& .rt-cell-clip{text-overflow:ellipsis;overflow:hidden}& td span.rt-group-name,& th span.rt-group-name{flex:1;height:100%;margin-right:-5px;padding-left:8px;padding-right:5px}& th span.rt-group-name{text-align:left}& td th span.rt-group-leaf,& th span.rt-group-leaf{height:100%;margin-left:16px}& .rt-column-resize{cursor:col-resize;width:10px;height:100%;position:absolute;top:0;right:0}& a{color:var(--psp-datagrid--pos-cell--color)}& a:visited{color:var(--psp-active--color)}& td.psp-null:after,& th.psp-null:after{content:var(--psp-label--null--content,"-");color:var(--psp-label--null--color,inherit);font-size:var(--psp-label--null--font-size,inherit);vertical-align:middle}}.psp-header-border:not(.psp-is-top):not(.psp-header-leaf){box-shadow:1px 0px var(--psp-inactive--border-color,#8b868045)}.psp-header-group{box-shadow:0px 10px 0 -9px var(--psp-inactive--border-color,#8b868045)}.psp-is-top{box-shadow:5px 4px 0px -4px var(--psp-inactive--border-color,#8b868045)}.psp-is-top.psp-header-group:not(.psp-header-group-corner){box-shadow:5px 4px 0px -4px var(--psp-inactive--border-color,#8b868045), 0px 10px 0 -9px var(--psp-inactive--border-color,#8b868045)}.psp-header-border.psp-header-group{&:not(.psp-is-top):not(.psp-header-group-corner){box-shadow:1px 0px var(--psp-inactive--border-color,#8b868045), 0px 10px 0 -9px var(--psp-inactive--border-color,#8b868045)}}perspective-viewer[settings] tr.rt-autosize .psp-header-leaf.psp-header-border:not(.psp-menu-enabled){box-shadow:1px 0px var(--psp-inactive--border-color,#8b868045)}:host-context(perspective-viewer[settings]) tr.rt-autosize .psp-header-leaf.psp-header-border:not(.psp-menu-enabled){box-shadow:1px 0px var(--psp-inactive--border-color,#8b868045)}.psp-header-leaf.psp-header-border{box-shadow:5px -4px 0px -4px var(--psp-inactive--border-color,#8b868045)}tr:only-child th{box-shadow:none!important}regular-table{& tbody{& tr:hover th.psp-tree-leaf:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover th.psp-tree-label:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover td:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover:after{box-shadow:0px 1px 0px var(--psp-datagrid--hover--border-color,#c5c9d080);border-color:var(--psp-datagrid--hover--border-color,#c5c9d080)!important;&.psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--color), inset 2px 0px 0px var(--psp--color), 0px 1px 0px var(--psp-datagrid--hover--border-color,#c5c9d080)}}& tr:last-child:hover td:not(.psp-select-region):not(.psp-select-region-inactive).psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--color), inset 2px 0px 0px var(--psp--color), inset 0px -2px 0px var(--psp--color), 0px 1px 0px var(--psp-datagrid--hover--border-color,#c5c9d080)}& tr:hover+tr th.psp-tree-leaf:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover+tr th.psp-tree-label:not(.psp-select-region):not(.psp-select-region-inactive),& tr:hover+tr td:not(.psp-select-region):not(.psp-select-region-inactive){border-top-color:#0000}& tr{& th:first-child:not(:empty),& th:first-child:empty+th:not(:empty),& th:first-child:empty~th:empty+th:not(:empty),& td:first-child{border-left-width:1px;border-left-color:#0000}& th:last-child,& td:last-child{border-right-width:0;border-right-color:#0000}}& tr:hover{color:inherit;& th:first-child:not(:empty),& th:first-child:empty+th:not(:empty),& th:first-child:empty~th:empty+th:not(:empty),& td:first-child{border-left-color:var(--psp-datagrid--hover--border-color,#c5c9d080)!important}& th:last-child,& td:last-child{border-right-color:var(--psp-datagrid--hover--border-color,#c5c9d080)!important}}}}perspective-viewer-datagrid:not(.sub-cell-scroll-disabled) regular-table table,:host(:not(.sub-cell-scroll-disabled)) regular-table table{& tbody td,& thead th:not(.rt-group-corner){transform:translate(var(--regular-table--transform-x,0px))}& tbody{transform:translate(0, var(--regular-table--transform-y,0px))}& tbody tr:first-child{& td,& th,&:after{clip-path:polygon(0 var(--regular-table--clip-y,0), 0 200%, 200% 200%, 200% var(--regular-table--clip-y,0))}}& tbody tr td:first-of-type{clip-path:polygon(var(--regular-table--clip-x,0) 0, var(--regular-table--clip-x,0) 200%, 200% 200%, 200% 0)}& tbody tr:first-child td:first-of-type{clip-path:polygon(var(--regular-table--clip-x,0) var(--regular-table--clip-y,0), var(--regular-table--clip-x,0) 200%, 200% 200%, 200% var(--regular-table--clip-y,0))}& thead tr:last-child:after,& tbody tr:not(:first-child):after{transform:translate(var(--regular-table--transform-x,0px))}& tbody tr:hover:first-child:after{clip-path:polygon(0 var(--regular-table--clip-y,0), 0 200%, 200% 200%, 200% var(--regular-table--clip-y,0))}& thead tr th.rt-group-corner+th:not(.rt-group-corner){clip-path:polygon(var(--regular-table--clip-x,0) 0, var(--regular-table--clip-x,0) 200%, 200% 200%, 200% 0)}}regular-table{outline:none;&::-webkit-scrollbar,&::-webkit-scrollbar-corner{background-color:#0000;width:12px;height:12px}&::-webkit-scrollbar-thumb{background-clip:content-box;background:var(--psp--color);border:5.5px solid var(--psp--background-color);min-width:10%;max-width:50%;min-height:10%;max-height:50%}}perspective-viewer,:host{& .psp-menu-enabled{border-radius:3px 3px 0 0;padding:0 6px;font-size:8px}& .psp-menu-enabled:hover,& tr:not(.rt-autosize) th.psp-menu-open{color:var(--psp--background-color);background-color:var(--psp--color);border-bottom-color:var(--psp--color);cursor:pointer}& tr:not(.rt-autosize) th.psp-menu-open{&:before{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:10px;height:8px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--column-settings--mask-image);mask-image:var(--psp-icon--column-settings--mask-image);background-color:var(--psp--background-color);margin-right:4px;display:inline-block}}& td.psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--color), inset 2px 0px 0px var(--psp--color)}& tr:first-child td.psp-menu-open{border-top-color:var(--psp--color)!important}& tr:last-child td.psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--color), inset 2px 0px 0px var(--psp--color), inset 0px -2px 0px var(--psp--color)}}perspective-viewer,:host-context(perspective-viewer){& regular-table table thead tr:last-child th{border-bottom-width:1px;border-bottom-color:var(--psp-inactive--border-color,#8b868045)}}.psp-sort-enabled:hover{cursor:pointer}regular-table.flat-group-rollup-mode.vertical-row-headers th.psp-tree-label:not(:last-of-type){writing-mode:vertical-lr}.psp-select-region-inactive,:hover .psp-select-region-inactive,:hover th.psp-tree-leaf.psp-select-region-inactive,:hover th.psp-tree-label.psp-select-region-inactive{background-color:var(--psp-inactive--color)!important;color:var(--psp--background-color)!important;border-color:var(--psp--background-color)!important}.psp-error{color:red}td:focus{outline:1px dotted #666}perspective-viewer.dragging,:host-context(perspective-viewer.dragging){& regular-table{pointer-events:none}}.psp-header-border:last-child{border-right-width:0}.psp-header-sort-desc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-desc--mask-image);mask-image:var(--psp-icon--sort-desc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-asc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-asc--mask-image);mask-image:var(--psp-icon--sort-asc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-col-desc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-col-desc--mask-image);mask-image:var(--psp-icon--sort-col-desc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-col-asc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-col-asc--mask-image);mask-image:var(--psp-icon--sort-col-asc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-abs-desc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-abs-desc--mask-image);mask-image:var(--psp-icon--sort-abs-desc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-abs-asc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-abs-asc--mask-image);mask-image:var(--psp-icon--sort-abs-asc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-abs-col-desc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-abs-col-desc--mask-image);mask-image:var(--psp-icon--sort-abs-col-desc--mask-image);margin-left:4px;display:inline-block}.psp-header-sort-abs-col-asc:after{background-repeat:no-repeat;background-color:var(--psp--color);content:"";width:14px;height:11px;-webkit-mask-size:cover;mask-size:cover;-webkit-mask-image:var(--psp-icon--sort-abs-col-asc--mask-image);mask-image:var(--psp-icon--sort-abs-col-asc--mask-image);margin-left:4px;display:inline-block}tbody th:last-of-type{border-right:1px solid var(--psp-inactive--border-color,#8b868045);text-overflow:ellipsis;overflow:hidden}tbody th:empty{background-image:linear-gradient(to right, transparent 9px, var(--psp-inactive--border-color,#eee) 10px, transparent 11px);pointer-events:none;background-repeat:no-repeat;min-width:20px;max-width:20px}regular-table:not(.flat-group-rollup-mode){& .psp-tree-label{min-width:0;max-width:0}& .psp-tree-label:before{color:var(--psp--color);font-family:var(--psp-button--font-family,inherit);padding-right:11px}& .psp-tree-label-expand:before{content:var(--psp-label--tree-expand--content,"+")}& .psp-tree-label-collapse:before{content:var(--psp-label--tree-collapse--content,"-")}& .psp-tree-label-expand,& .psp-tree-label-collapse{cursor:pointer}& .psp-tree-label:hover:before{color:var(--psp-active--color);text-shadow:0px 0px 5px var(--psp-active--color)}}.psp-tree-leaf{padding-left:24px}.psp-align-right{text-align:right}.psp-color-mode-bar{padding:0 2px}.psp-color-mode-label-bar{padding:0 2px;position:relative;& .psp-bar{isolation:isolate;position:unset}& .psp-bar:before{color:#0000;pointer-events:none;content:var(--label);justify-content:flex-end;align-items:center;padding:0 3px;display:inline-flex}& .psp-bar:after{color:var(--psp-label-bar-bg);content:var(--label);mix-blend-mode:difference;justify-content:flex-end;align-items:center;padding:0 5px;display:inline-flex;position:absolute;inset:0}}.psp-label-bar{pointer-events:none;justify-content:flex-end;align-items:center;padding:0;display:flex;inset:0}.psp-label-bar-fill{background:var(--psp-label-bar-color);pointer-events:none;height:80%;position:absolute;top:10%}.psp-label-bar-text{color:var(--psp-label-bar-bg);mix-blend-mode:difference;pointer-events:none;position:relative}.psp-align-left{text-align:left}.psp-positive:not(:focus){color:var(--psp-datagrid--pos-cell--color)}.psp-negative:not(:focus){color:var(--psp-datagrid--neg-cell--color)}regular-table table tbody td{min-width:52px!important}.psp-is-width-override .rt-column-resize,.rt-column-resize:hover{border:1px dashed #999;border-width:1px 1px 0 0}.boolean-editable{cursor:pointer}regular-table table{user-select:none;color:inherit;border-collapse:separate;font-size:1em;& th{font-weight:400}& td,& th{border-color:var(--psp-inactive--border-color,#8b868045);height:var(--psp-datagrid--row--height,23px)}& .psp-header-group{text-overflow:ellipsis}& th.psp-header-leaf{border-bottom-width:0;& span{height:var(--psp-datagrid--row--height,23px);min-height:var(--psp-datagrid--row--height,23px)}}& td,& th.psp-tree-label,& th.psp-tree-label,& th.psp-tree-leaf,& tbody tr:first-child th{border-style:solid;border-width:1px 0 0}& tbody th:empty{background-position:0 -10px}& td.psp-select-region,& th.psp-select-region{background-color:var(--psp--color)!important;color:var(--psp--background-color)!important;border-color:var(--psp--background-color)!important}}regular-table tbody tr:hover td.psp-select-region:not(.psp-select-region-inactive),regular-table tbody tr:hover+tr td.psp-select-region:not(.psp-select-region-inactive){border-color:var(--psp--background-color)!important}regular-table tbody tr:hover{& td.psp-select-region.psp-menu-open{&:not(.psp-select-region-inactive){box-shadow:inset -2px 0px 0px var(--psp--background-color), inset 2px 0px 0px var(--psp--background-color)}}}:host-context(perspective-viewer[settings]) td.psp-select-region.psp-menu-open{box-shadow:inset -2px 0px 0px var(--psp--background-color), inset 2px 0px 0px var(--psp--background-color)}regular-table #psp-column-edit-buttons th:not(.rt-group-corner) span:not(.rt-column-resize):before{content:var(--psp-datagrid--column-edit-button--content,"Edit")}perspective-viewer:not([settings]),:host-context(perspective-viewer:not([settings])){& regular-table #psp-column-edit-buttons:after{content:none}}regular-table table thead tr:last-child:after{box-sizing:border-box;width:10000px;height:var(--psp-datagrid--row--height,23px);content:" ";border-bottom:1px solid var(--psp-inactive--border-color);display:block}regular-table table tbody tr:after{box-sizing:border-box;width:10000px;height:var(--psp-datagrid--row--height,23px);content:" ";border-top:1px solid #0000;display:block}regular-table table tbody tr:not(:first-child):after{border-top:1px solid var(--psp-inactive--border-color)}regular-table table tbody tr:hover:not(:first-child):after,regular-table table tbody tr:hover+tr:after{border-top:1px solid var(--psp-datagrid--hover--border-color)}@keyframes pulse_pos{0%{background-color:var(--pulse--background-color-start,#0080ff80)}to{background-color:var(--pulse--background-color-end,#0080ff00)}}@keyframes pulse_pos2{0%{background-color:var(--pulse--background-color-start,#0080ff80)}to{background-color:var(--pulse--background-color-end,#0080ff00)}}@keyframes pulse_neg{0%{background-color:var(--pulse--background-color-start,#ff190080)}to{background-color:var(--pulse--background-color-end,#ff190000)}}@keyframes pulse_neg2{0%{background-color:var(--pulse--background-color-start,#ff190080)}to{background-color:var(--pulse--background-color-end,#ff190000)}}';var me=class e extends HTMLElement{static _global_stylesheet_installed=!1;static _sheet;static renderTarget=window.CSS?.supports&&window.CSS?.supports("selector(:host-context(foo))")?"shadow":"light";regular_table;model;_toolbar;_edit_button;_scroll_lock;_is_scroll_lock;_edit_mode;_initialized;_reset_scroll_top;_reset_scroll_left;_reset_select;_reset_column_size;constructor(){super(),this.regular_table=document.createElement("regular-table"),this.regular_table.part="regular-table",this._is_scroll_lock=!1,this._edit_mode="READ_ONLY";let t=e;t._sheet||(t._sheet=new CSSStyleSheet,t._sheet.replaceSync(kt)),t.renderTarget==="shadow"?this.attachShadow({mode:"open"}).adoptedStyleSheets.push(t._sheet):t.renderTarget==="light"&&!t._global_stylesheet_installed&&(t._global_stylesheet_installed=!0,document.adoptedStyleSheets.push(t._sheet))}connectedCallback(){this._toolbar||(this._toolbar=document.createElement("perspective-viewer-datagrid-toolbar"));let t=this.parentElement;t&&t.appendChild(this._toolbar)}disconnectedCallback(){this._toolbar?.parentElement?.removeChild?.(this._toolbar)}async activate(t){return await Et.call(this,t)}get_static_config(){return{name:"Datagrid",category:"Basic",select_mode:"toggle",config_column_names:["Columns"],group_rollup_modes:["rollup","flat","total"],priority:1,can_render_column_styles:!0}}plugin_config_schema(){let t=[];return t.push({kind:"Enum",key:"edit_mode",default:"READ_ONLY",variants:[{value:"EDIT",label:"Edit"},{value:"READ_ONLY",label:"Read-only"},{value:"SELECT_ROW",label:"Row Select"},{value:"SELECT_COLUMN",label:"Column Select"},{value:"SELECT_REGION",label:"Region Select"},{value:"SELECT_ROW_TREE",label:"Tree Select"}]}),t.push({kind:"Bool",key:"scroll_lock",default:!1}),{fields:t}}column_config_schema(t,o,r,i,s,n){return ke.call(this,t,o,r,i,s,n)}async draw(t){return await Mt.call(this,t)}async update(t){if(this.model===void 0)await this.draw(t);else if(this.model._config.split_by?.length>0){let o=await t.dimensions();this.model._num_rows=o.num_view_rows,await this.regular_table.draw()}else this.model._num_rows=await t.num_rows(),await this.regular_table.draw()}async render(t,o){let r=await t.to_columns(o),i=await t.column_paths(o),s=o?.end_row!==void 0&&o?.end_row!==null&&o?.start_row!==void 0&&o?.start_row!==null?o.end_row-o.start_row:await t.num_rows(),n="";for(let l=0;l<s;l++){for(let c of i){let a=r[c],d=this.model._schema[c],p=this.regular_table[P],u=Ne(c),_=ze(d,p?.[u]||{});_?n+=_.format(a[l])+" ":n+=a[l]+" "}n+=`
|
|
3
|
+
`}return n.trim()}async resize(t){!this.isConnected||this.offsetParent==null||this._initialized&&await this.regular_table.draw()}async clear(){this.regular_table.resetAutoSize(),this.regular_table.clear()}save(){return Ct.call(this)}restore(t,o){return xt.call(this,t,o??{})}restyle(){}delete(){this.disconnectedCallback(),this._toolbar=void 0,this.regular_table.table_model&&this.regular_table.resetAutoSize(),this.regular_table.clear()}};var Tt=':host{height:100%;display:block;position:relative}:host #container{flex-direction:column;justify-content:stretch;align-items:stretch;display:flex;position:absolute;inset:0}:host #toolbar{align-items:stretch;height:100%;display:flex}:host #toolbar .hover-target{cursor:pointer;align-items:center;margin:0;display:inline-flex;&:hover{box-shadow:-4px 0 0 var(--psp--color), 4px 0 0 var(--psp--color);background-color:var(--psp--color)}}:host #slot-container{flex:1;position:relative}#scroll_lock.lock-scroll:before{-webkit-mask-image:var(--psp-toolbar-scroll-lock-active--content)}#scroll_lock:before{-webkit-mask-image:var(--psp-toolbar-scroll-lock--content)}#select_mode:before{content:"highlight_alt"}#edit_mode:before{-webkit-mask-image:""}#edit_mode[data-edit-mode=READ_ONLY]:before{-webkit-mask-image:var(--psp-toolbar-edit-mode-read-only--content)}#edit_mode[data-edit-mode=EDIT]:before{-webkit-mask-image:var(--psp-toolbar-edit-mode-edit--content)}:host(.aggregated) #toolbar #edit_mode[data-edit-mode=EDIT]:before{-webkit-mask-image:var(--psp-toolbar-edit-mode-read-only--content)}#edit_mode[data-edit-mode=SELECT_ROW]:before{-webkit-mask-image:var(--psp-toolbar-edit-mode-select-row--content)}#edit_mode[data-edit-mode=SELECT_COLUMN]:before{-webkit-mask-image:var(--psp-toolbar-edit-mode-select-column--content)}#edit_mode[data-edit-mode=SELECT_REGION]:before{-webkit-mask-image:var(--psp-toolbar-edit-mode-select-region--content)}#edit_mode[data-edit-mode=SELECT_ROW_TREE]:before{-webkit-mask-image:var(--psp-toolbar-edit-mode-select-row-tree--content)}#edit_mode[data-edit-mode=READ_ONLY] span:before{content:var(--psp-label--edit-mode-read-only--content,"Read Only")}#edit_mode[data-edit-mode=EDIT] span:before{content:var(--psp-label--edit-mode-edit--content,"Editable")}#edit_mode[data-edit-mode=SELECT_ROW] span:before{content:var(--psp-label--edit-mode-select-row--content,"Row Select")}#edit_mode[data-edit-mode=SELECT_COLUMN] span:before{content:var(--psp-label--edit-mode-select-column--content,"Column Select")}#edit_mode[data-edit-mode=SELECT_REGION] span:before{content:var(--psp-label--edit-mode-select-region--content,"Region Select")}#edit_mode[data-edit-mode=SELECT_ROW_TREE] span:before{content:var(--psp-label--edit-mode-select-row-tree--content,"Tree Select")}#scroll_lock span:before{content:var(--psp-label--scroll-lock-toggle--content,"Free Scroll")}#scroll_lock.lock-scroll span:before{content:var(--psp-label--scroll-lock-alt-toggle--content,"Align Scroll")}.button:before{content:"";background-color:var(--psp--color);width:21px;height:21px;-webkit-mask-size:cover;mask-size:cover}.button.editable:before,.button.lock-scroll:before{color:inherit}.button{user-select:none;box-sizing:border-box;font-size:var(--label--font-size,.75em);white-space:nowrap;border:1px solid #0000;border-radius:3px;justify-content:center;align-items:center;width:37px;height:22px;padding:0 5px;display:inline-flex}.button>span{margin:0;padding:0;display:none}.hover-target:focus-within .button,.hover-target:hover .button{background-color:var(--psp--color);color:var(--psp--background-color);opacity:1;cursor:pointer;align-items:center;display:flex;position:relative}.hover-target:focus-within .button:before,.hover-target:hover .button:before{background-color:var(--psp--background-color)}.hover-target:focus-within .button>span,.hover-target:hover .button>span{white-space:pre-wrap;background-color:var(--psp--color);text-align:center;border-radius:0 0 3px 3px;width:35px;height:auto;margin:0;padding:5px;font-size:9px;line-height:1;display:block;position:absolute;top:calc(100% + 3px);left:50%;translate:-50%}';var St=new CSSStyleSheet;St.replaceSync(Tt);var ue=class extends HTMLElement{_initialized=!1;connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute("slot","statusbar-extra"),this.attachShadow({mode:"open"}),this.shadowRoot.adoptedStyleSheets.push(St),this.shadowRoot.innerHTML=`
|
|
4
4
|
<div id="toolbar">
|
|
5
5
|
<span class="hover-target">
|
|
6
6
|
<span id="scroll_lock" class="button">
|
|
@@ -13,5 +13,5 @@ var se=0,$=0,Te=performance.now();function Ct(){let e=performance.now(),t=e-Te,o
|
|
|
13
13
|
</span>
|
|
14
14
|
</span>
|
|
15
15
|
</div>
|
|
16
|
-
`;let t=this.parentElement,o=this.previousElementSibling;o._scroll_lock=this.shadowRoot.querySelector("#scroll_lock"),o._scroll_lock.addEventListener("click",()=>
|
|
16
|
+
`;let t=this.parentElement,o=this.previousElementSibling;o._scroll_lock=this.shadowRoot.querySelector("#scroll_lock"),o._scroll_lock.addEventListener("click",()=>Q.call(o)),o._edit_button=this.shadowRoot.querySelector("#edit_mode"),o._edit_button.addEventListener("click",()=>{Z.call(o),o.regular_table.draw(),t.dispatchEvent(new Event("perspective-config-update"))})}};async function xo(){customElements.define("perspective-viewer-datagrid-toolbar",ue),customElements.define("perspective-viewer-datagrid",me),await customElements.whenDefined("perspective-viewer"),customElements.get("perspective-viewer").registerPlugin("perspective-viewer-datagrid")}xo();export{me as HTMLPerspectiveViewerDatagridPluginElement,ue as HTMLPerspectiveViewerDatagridToolbarElement,P as PRIVATE_PLUGIN_SYMBOL};
|
|
17
17
|
//# sourceMappingURL=perspective-viewer-datagrid.js.map
|