
'use strict';require('earlgrey-runtime/6');let $targ$0;let $targ$1;let $targ$2;let $targ$9;let events$0;let EventEmitter$0;let path$0;let dom$0;let jq$0;let elements$0;let BucheElement$0;let BucheData$0;let buche__minus__install$0;events$0=require("events");EventEmitter$0=getProperty(events$0,"EventEmitter","events");if((typeof(document)==="undefined")){$targ$0=undefined;(global["document"]=$targ$0);(void 0);}if((typeof(HTMLElement)==="undefined")){$targ$1=undefined;(global["HTMLElement"]=$targ$1);(void 0);}if((typeof(customElements)==="undefined")){$targ$2=undefined;(global["custom-elements"]=$targ$2);(void 0);}path$0=require("path");dom$0=require("earlgrey-runtime/std/dom");jq$0=require("jquery");elements$0=require("../../elements");BucheElement$0=getProperty(elements$0,"BucheElement","elements");BucheData$0=(class BucheData extends BucheElement$0{ setup(config$0,children$0){let $targ$3;let $targ$4;let $targ$5;let $targ$6;let __at___$0;let self$0;__at___$0=this;self$0=this;if(children$0.length){throw Error("<buche-data> does not allow children.");}$targ$3=(new EventEmitter$0());(__at___$0["events"]=$targ$3);$targ$4=null;(__at___$0["columns"]=$targ$4);$targ$5=[];(__at___$0["data"]=$targ$5);$targ$6=({});(__at___$0["transposed"]=$targ$6);return (void 0);} on_columns(fn$0){let __at___$1;let self$1;__at___$1=this;self$1=this;if(__at___$1.columns){return fn$0(__at___$1.columns);}else{return __at___$1.events.on("columns",fn$0);}} on_row(fn$1){let m$0;let __at___$2;let self$2;__at___$2=this;self$2=this;m$0=null;$0:for(m$0 of __at___$2.data){let row$0;row$0=m$0;fn$1(row$0);}return __at___$2.events.on("row",fn$1);} command_configure(temp$0$0,temp$1$0,data$0){let $targ$7;let __at___$3;let self$3;__at___$3=this;self$3=this;$targ$7=(data$0.columns||null);(__at___$3["columns"]=$targ$7);return __at___$3.events.emit("columns",__at___$3.columns);} command_data(temp$2$0,temp$3$0,temp$4$0){let t0$0;let m$1;let acc$0;let temp$5;let row$2;let rows$0;let t0$1;let ph$0$0;let __at___$4;let self$4;__at___$4=this;self$4=this;t0$0=temp$4$0;if(___hasprop(t0$0,"data")){ph$0$0=t0$0.data;}else{___match_error(temp$4$0);}t0$1=ph$0$0;if(Array.isArray(t0$1)){rows$0=t0$1;acc$0=[];temp$5=null;m$1=null;$1:for(m$1 of rows$0){let row$1;row$1=m$1;temp$5=__at___$4.addRow(row$1);acc$0.push(temp$5);}return acc$0;}else{row$2=ph$0$0;return __at___$4.addRow(row$2);}} command_batch(temp$6$0,temp$7$0,temp$8$0){let t0$2;let m$2;let acc$1;let temp$9;let its$0;let n$0;let data$1;let __at___$5;let self$5;__at___$5=this;self$5=this;t0$2=temp$8$0;if(___hasprop(t0$2,"data")){data$1=t0$2.data;}else{___match_error(temp$8$0);}its$0=items(data$1);n$0=its$0[0][1].length;acc$1=[];temp$9=null;m$2=null;$2:for(m$2 of range(0,(n$0-1))){let m$3;let acc$2;let temp$10;let row$3;let i$0;i$0=m$2;row$3=object(((acc$2=[]),(temp$10=null),(m$3=null),(function(){$3:for(m$3 of its$0){let k$0;let values$0;let t0$3;let t1$0;t0$3=m$3;if((Array.isArray(t0$3)&&((t1$0=t0$3.length),(t1$0===2)))){k$0=t0$3[0];values$0=t0$3[1];temp$10=[k$0,send(values$0,i$0)];acc$2.push(temp$10);}else{___match_error(m$3);}}})(),acc$2));temp$9=__at___$5.addRow(row$3);acc$1.push(temp$9);}return acc$1;} addRow(d$0){let m$4;let acc$3;let temp$11;let $targ$8;let m$6;let __at___$6;let self$6;__at___$6=this;self$6=this;if((__at___$6.columns===null)){$targ$8=object(((acc$3=[]),(temp$11=null),(m$4=null),(function(){$5:for(m$4 of items(d$0)){let m$5$0;let name$0;let value$0;let t0$4;let t1$1;t0$4=m$4;if((Array.isArray(t0$4)&&((t1$1=t0$4.length),(t1$1===2)))){name$0=t0$4[0];value$0=t0$4[1];temp$11=[name$0,((m$5$0=value$0),((typeof(m$5$0)==="number")?({"type":"number"}):((typeof(m$5$0)==="string")?({"type":"string"}):({"type":"string"}))))];acc$3.push(temp$11);}else{___match_error(m$4);}}})(),acc$3));(__at___$6["columns"]=$targ$8);__at___$6.events.emit("columns",__at___$6.columns);}__at___$6.data.push(d$0);m$6=null;$4:for(m$6 of items(d$0)){let k$1;let v$0;let t0$5;let t1$2;t0$5=m$6;if((Array.isArray(t0$5)&&((t1$2=t0$5.length),(t1$2===2)))){k$1=t0$5[0];v$0=t0$5[1];(__at___$6.transposed[k$1]=(send(send(__at___$6,"transposed", true),k$1)||[])).push(v$0);}else{___match_error(m$6);}}return __at___$6.events.emit("row",d$0);}});buche__minus__install$0=(function bucheInstall(){customElements.define("buche-data",BucheData$0);return document.head.appendChild(dom$0(ENode(["link"],({"type":"text/css","rel":"stylesheet","href":path$0.join(__dirname,"style.css")}),[])));});$targ$9=buche__minus__install$0;(exports["bucheInstall"]=$targ$9);(void 0);
//# sourceMappingURL=index.js.map

