(function(e){function t(t){for(var n,r,o=t[0],c=t[1],l=t[2],u=0,M=[];u0&&e.paneBefore.size>0}]},[100===e.after.max&&e.paneAfter.size>0?n("div",{staticClass:"toggle-btn",on:{click:function(t){return e.togglePane(e.paneBefore)}}},[n("img",{staticClass:"direction-icon",style:e.directionBeforeIconStyle,attrs:{src:i("0ca3")}})]):e._e(),100===e.before.max&&e.paneBefore.size>0?n("div",{staticClass:"toggle-btn",on:{click:function(t){return e.togglePane(e.paneAfter)}}},[n("img",{staticClass:"direction-icon",style:e.directionAfterIconStyle,attrs:{src:i("0ca3")}})]):e._e()])]),n("div",{ref:"right",staticClass:"splitpanes-pane",style:e.styles.after},[e._t("right-pane")],2)])}),C=[],b=i("5530"),y=i("ade3"),w={getCurrentMouseDrag:function(e,t){var i=t.getBoundingClientRect(),n="ontouchstart"in window&&e.touches?e.touches[0]:e,a=n.clientX,s=n.clientY;return{x:a-i.left,y:s-i.top}},getCurrentDragPercentage:function(e,t,i){var n=this.getCurrentMouseDrag(e,t);n=n[i?"y":"x"];var a=t[i?"clientHeight":"clientWidth"];return 100*n/a},calculateOffset:function(e,t){var i=t.container,n=t.isHorisontal,a=t.paneBeforeMax,s=t.paneAfterMax,r=this.getCurrentDragPercentage(e,i,n),o=a<100&&r>=a,c=s<100&&r<=100-s;return o||c?o?a:Math.max(100-s,0):Math.min(Math.max(r,0),a)}},z={name:"Splitpanes",props:{horizontal:{type:Boolean,default:!1},before:{type:Object},after:{type:Object}},data:function(){return{container:null,paneBefore:this.before,paneAfter:this.after,beforeMinimising:{before:this.before.size,after:this.after.size},dragging:!1,movableSplitter:{top:0,left:0,visibility:"hidden"}}},computed:{styles:function(){return{before:Object(y["a"])({},this.horizontal?"height":"width","".concat(this.paneBefore.size,"%")),after:Object(y["a"])({},this.horizontal?"height":"width","".concat(this.paneAfter.size,"%"))}},movableSplitterStyle:function(){var e=Object(b["a"])({},this.movableSplitter);return e.top+="%",e.left+="%",e},directionBeforeIconStyle:function(){var e=0!==this.paneBefore.size,t="translate(-50%, -50%) ",i="";return i=this.horizontal?e?"rotate(90deg)":"rotate(-90deg)":e?"rotate(0deg)":"rotate(180deg)",{transform:t+i}},directionAfterIconStyle:function(){var e=0!==this.paneAfter.size,t="translate(-50%, -50%)",i="";return i=this.horizontal?e?"rotate(-90deg)":"rotate(90deg)":e?"rotate(180deg)":"rotate(0deg)",{transform:t+i}}},methods:{bindEvents:function(){document.addEventListener("mousemove",this.onMouseMove,{passive:!1}),document.addEventListener("mouseup",this.onMouseUp),"ontouchstart"in window&&(document.addEventListener("touchmove",this.onMouseMove,{passive:!1}),document.addEventListener("touchend",this.onMouseUp))},unbindEvents:function(){document.removeEventListener("mousemove",this.onMouseMove,{passive:!1}),document.removeEventListener("mouseup",this.onMouseUp),"ontouchstart"in window&&(document.removeEventListener("touchmove",this.onMouseMove,{passive:!1}),document.removeEventListener("touchend",this.onMouseUp))},onMouseMove:function(e){e.preventDefault(),this.dragging=!0,this.movableSplitter.visibility="visible",this.moveSplitter(e)},onMouseUp:function(){if(this.dragging){var e=this.horizontal?this.movableSplitter.top:this.movableSplitter.left;this.paneBefore.size=e,this.paneAfter.size=100-e,this.movableSplitter={top:0,left:0,visibility:"hidden"},this.dragging=!1}this.unbindEvents()},moveSplitter:function(e){var t={container:this.container,paneBeforeMax:this.paneBefore.max,paneAfterMax:this.paneAfter.max,isHorisontal:this.horizontal},i=w.calculateOffset(e,t),n=this.horizontal?"top":"left";this.movableSplitter[n]=i},togglePane:function(e){if(e.size>0){this.beforeMinimising.before=this.paneBefore.size,this.beforeMinimising.after=this.paneAfter.size,e.size=0;var t=e===this.paneBefore?this.paneAfter:this.paneBefore;t.size=100-e.size}else this.paneBefore.size=this.beforeMinimising.before,this.paneAfter.size=this.beforeMinimising.after}},mounted:function(){this.container=this.$refs.container}},T=z,O=(i("a1f0"),Object(u["a"])(T,D,C,!1,null,null,null)),x=O.exports,A=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{attrs:{id:"schema-container"}},[i("div",{attrs:{id:"schema-filter"}},[i("text-field",{attrs:{placeholder:"Search table",width:"100%"},model:{value:e.filter,callback:function(t){e.filter=t},expression:"filter"}})],1),i("div",{attrs:{id:"db"}},[i("div",{staticClass:"db-name",on:{click:function(t){e.schemaVisible=!e.schemaVisible}}},[i("tree-chevron",{directives:[{name:"show",rawName:"v-show",value:e.schema.length>0,expression:"schema.length > 0"}],attrs:{expanded:e.schemaVisible}}),e._v(" "+e._s(e.dbName)+" ")],1),i("db-uploader",{attrs:{id:"db-edit",type:"small"}}),i("export-icon",{attrs:{tooltip:"Export database"},on:{click:e.exportToFile}}),i("add-table-icon",{on:{click:e.addCsv}})],1),i("div",{directives:[{name:"show",rawName:"v-show",value:e.schemaVisible,expression:"schemaVisible"}],staticClass:"schema"},e._l(e.schema,(function(e){return i("table-description",{key:e.name,attrs:{name:e.name,columns:e.columns}})})),1),i("csv-import",{ref:"addCsv",attrs:{file:e.file,db:e.$store.state.db,"dialog-name":"addCsv"}})],1)},L=[],k=(i("4de4"),i("b0c0"),i("ac1f"),i("00b4"),i("5319"),i("2b3d"),i("9861"),i("d9e2"),{isDatabase:function(e){var t=["application/vnd.sqlite3","application/x-sqlite3"];return e.type?t.includes(e.type):/\.(db|sqlite(3)?)+$/.test(e.name)},getFileName:function(e){return e.name.replace(/\.[^.]+$/,"")},downloadFromUrl:function(e,t){var i=document.createElement("a");i.href=e,i.download=t,i.click(),URL.revokeObjectURL(e)},exportToFile:function(e,t){var i=arguments,n=this;return Object(N["a"])(Object(m["a"])().mark((function a(){var s,r,o;return Object(m["a"])().wrap((function(a){while(1)switch(a.prev=a.next){case 0:s=i.length>2&&void 0!==i[2]?i[2]:"octet/stream",r=new Blob([e],{type:s}),o=URL.createObjectURL(r),n.downloadFromUrl(o,t);case 4:case"end":return a.stop()}}),a)})))()},getFileFromUser:function(e){return new Promise((function(t){var i=document.createElement("input");i.type="file",i.accept=e,i.addEventListener("change",(function(){var e=i.files[0];t(e)})),i.click()}))},importFile:function(){var e=new FileReader;return this.getFileFromUser(".json").then((function(t){return new Promise((function(i,n){e.onload=function(e){i(e.target.result)},e.readAsText(t)}))}))},readFile:function(e){return fetch(e)},readAsArrayBuffer:function(e){var t=new FileReader;return new Promise((function(i,n){t.onerror=function(){t.abort(),n(new Error("Problem parsing input file."))},t.onload=function(){i(t.result)},t.readAsArrayBuffer(e)}))}}),S=i("28b7"),E=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("div",{staticClass:"table-name",on:{click:function(t){e.colVisible=!e.colVisible}}},[i("tree-chevron",{attrs:{expanded:e.colVisible}}),e._v(" "+e._s(e.name)+" ")],1),i("div",{directives:[{name:"show",rawName:"v-show",value:e.colVisible,expression:"colVisible"}],staticClass:"columns"},e._l(e.columns,(function(t,n){return i("div",{key:n,staticClass:"column"},[e._v(" "+e._s(t.name)+" "),i("span",{staticClass:"column-type"},[e._v(e._s(t.type))])])})),0)])},Q=[],U=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("svg",{staticClass:"chevron-icon",style:{transform:e.expanded?"rotate(90deg)":"rotate(0)"},attrs:{width:"9",height:"9",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"}},[i("path",{attrs:{d:"M0.721924 9.93097L4.85292 5.79997L0.721924 1.66897L1.99992 0.399973L7.39992\n 5.79997L1.99992 11.2L0.721924 9.93097Z",fill:e.expanded?"#506784":"rgba(80, 103, 132, 0.5)"}})])},Y=[],_={name:"treeChevron",props:{expanded:{type:Boolean,required:!0}}},Z=_,V=(i("5e1a"),Object(u["a"])(Z,U,Y,!1,null,"5879c436",null)),P=V.exports,q={name:"TableDescription",components:{TreeChevron:P},props:["name","columns"],data:function(){return{colVisible:!1}}},H=q,B=(i("dfd4"),Object(u["a"])(H,E,Q,!1,null,"060be7fb",null)),$=B.exports,G=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[e.label?i("div",{class:["text-field-label",{error:e.errorMsg},{disabled:e.disabled}]},[e._v(" "+e._s(e.label)+" "),e.hint?i("hint-icon",{staticClass:"hint",attrs:{hint:e.hint,"max-width":e.maxHintWidth||"149px"}}):e._e()],1):e._e(),i("input",{class:{error:e.errorMsg},style:{width:e.width},attrs:{type:"text",placeholder:e.placeholder,disabled:e.disabled},domProps:{value:e.value},on:{input:function(t){return e.$emit("input",t.target.value)}}}),i("div",{directives:[{name:"show",rawName:"v-show",value:e.errorMsg,expression:"errorMsg"}],staticClass:"text-field-error"},[e._v(e._s(e.errorMsg))])])},R=[],W=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("svg",{staticClass:"hint-icon",attrs:{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},on:{click:function(t){return t.stopPropagation(),e.onClick.apply(null,arguments)},mouseenter:e.showTooltip,mouseleave:e.hideTooltip}},[i("path",{attrs:{d:"M8.75 14.1666H10.4167V12.5H8.75V14.1666ZM9.58333 16.25C5.90833 16.25 2.91667 13.2583\n 2.91667 9.58333C2.91667 5.90833 5.90833 2.91667 9.58333 2.91667C13.2583 2.91667 16.25\n 5.90833 16.25 9.58333C16.25 13.2583 13.2583 16.25 9.58333 16.25ZM9.58333 1.25C8.48898\n 1.25 7.40535 1.46555 6.3943 1.88434C5.38326 2.30313 4.4646 2.91696 3.69078\n 3.69078C2.12797 5.25358 1.25 7.3732 1.25 9.58333C1.25 11.7935 2.12797 13.9131 3.69078\n 15.4759C4.4646 16.2497 5.38326 16.8635 6.3943 17.2823C7.40535 17.7011 8.48898 17.9167\n 9.58333 17.9167C11.7935 17.9167 13.9131 17.0387 15.4759 15.4759C17.0387 13.9131 17.9167\n 11.7935 17.9167 9.58333C17.9167 8.48898 17.7011 7.40535 17.2823 6.3943C16.8635 5.38326\n 16.2497 4.4646 15.4759 3.69078C14.7021 2.91696 13.7834 2.30313 12.7724 1.88434C11.7613\n 1.46555 10.6777 1.25 9.58333 1.25Z",fill:"#A2B1C6"}}),i("path",{attrs:{d:"M9.91601 4.51787C8.98167 4.42606 8.05144 4.69097 7.36309 5.24472C6.68735 5.78828\n 6.2998 6.56661 6.2998 7.38012H7.92488C7.92488 6.97463 8.11059 6.60187 8.44779\n 6.33061C8.79784 6.049 9.25647 5.92005 9.73896 5.96755C10.4832 6.04076 11.0828 6.57277\n 11.1647 7.23265C11.2306 7.764 10.9661 8.28194 10.4744 8.58426C9.38676 9.25303 8.73742\n 10.343 8.73742 11.5H10.3625C10.3625 10.8243 10.7477 10.184 11.3929 9.78733C12.3808\n 9.17985 12.9122 8.13913 12.7798 7.07124C12.6144 5.73863 11.41 4.66476 9.91601 4.51787Z",fill:"#A2B1C6"}})]),i("span",{ref:"tooltip",staticClass:"icon-tooltip",style:Object.assign({},e.tooltipStyle,{maxWidth:e.maxWidth})},[e._v(" "+e._s(e.hint)+" ")])])},F=[],J=(i("1276"),{data:function(){return{tooltipStyle:{visibility:"hidden"}}},computed:{tooltipElement:function(){return this.$refs.tooltip}},methods:{showTooltip:function(e,t){var i=t?t.split("-"):["top","right"],n=12;"top"===i[0]?this.tooltipStyle.top=e.clientY-n+"px":this.tooltipStyle.top=e.clientY+n+"px","right"===i[1]?this.tooltipStyle.left=e.clientX+n+"px":this.tooltipStyle.left=e.clientX-n-this.tooltipElement.offsetWidth+"px",this.tooltipStyle.visibility="visible"},hideTooltip:function(){this.tooltipStyle.visibility="hidden"}}}),X={name:"HintIcon",props:["hint","maxWidth"],mixins:[J],methods:{onClick:function(){this.hideTooltip(),this.$emit("click")}}},K=X,ee=(i("9ceb"),Object(u["a"])(K,W,F,!1,null,"7209667d",null)),te=ee.exports,ie={name:"textField",props:["placeholder","label","errorMsg","value","width","hint","maxHintWidth","disabled"],components:{HintIcon:te}},ne=ie,ae=(i("daef"),Object(u["a"])(ne,G,R,!1,null,"59fd41a8",null)),se=ae.exports,re=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"db-uploader-container",style:{width:e.width}},["small"===e.type?n("change-db-icon",{on:{click:e.browse}}):e._e(),"illustrated"===e.type?n("div",{staticClass:"drop-area-container"},[n("div",{staticClass:"drop-area",on:{dragover:function(t){t.preventDefault(),e.state="dragover"},dragleave:function(t){t.preventDefault(),e.state=""},drop:function(t){return t.preventDefault(),e.drop.apply(null,arguments)},click:e.browse}},[n("div",{staticClass:"text"},[e._v(" Drop the database or CSV file here or click to choose a file from your computer. ")])])]):e._e(),"illustrated"===e.type?n("div",{attrs:{id:"img-container"}},[n("img",{attrs:{id:"drop-file-top-img",src:i("3a016")}}),n("img",{class:{swing:"dragover"===e.state},attrs:{id:"left-arm-img",src:i("9bf4")}}),n("img",{ref:"fileImg",class:{swing:"dragover"===e.state,fly:"dropping"===e.state,hidden:"dropped"===e.state},attrs:{id:"file-img",src:i("87d4")}}),n("img",{attrs:{id:"drop-file-bottom-img",src:i("6a0b")}}),n("img",{attrs:{id:"body-img",src:i("1678")}}),n("img",{class:{swing:"dragover"===e.state},attrs:{id:"right-arm-img",src:i("2335")}})]):e._e(),n("div",{staticClass:"error",attrs:{id:"error"}}),n("csv-import",{ref:"addCsv",attrs:{file:e.file,db:e.newDb,"dialog-name":"importFromCsv"},on:{cancel:e.cancelCsvImport,finish:e.finish}})],1)},oe=[],ce=(i("2ca0"),function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("svg",{staticClass:"db-edit-icon",attrs:{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},on:{click:function(t){return t.stopPropagation(),e.onClick.apply(null,arguments)},mouseenter:e.showTooltip,mouseleave:e.hideTooltip}},[i("path",{attrs:{d:"M3 10.5V12.75C3 14.25 5.2875 15.54 8.25 15.75V13.5825L8.3475 13.5C5.34 13.32 3 12.045 3\n 10.5ZM9 9.75C5.685 9.75 3 8.4075 3 6.75V9C3 10.6575 5.685 12 9 12C9.2925 12 9.5775 12\n 9.87 12L12.75 9.09C11.55 9.54 10.2825 9.75 9 9.75ZM9 2.25C5.685 2.25 3 3.5925 3 5.25C3\n 6.9075 5.685 8.25 9 8.25C12.315 8.25 15 6.9075 15 5.25C15 3.5925 12.315 2.25 9 2.25ZM15.75\n 8.3475C15.6375 8.3475 15.5325 8.3925 15.4575 8.475L14.7075 9.225L16.245 10.725L16.995\n 9.975C17.1525 9.825 17.16 9.57 16.995 9.3975L16.065 8.475C15.99 8.3925 15.885 8.3475 15.78\n 8.3475H15.75ZM14.28 9.66L9.75 14.205V15.75H11.295L15.84 11.1975L14.28 9.66Z",fill:"#A2B1C6"}})]),i("span",{ref:"tooltip",staticClass:"icon-tooltip",style:e.tooltipStyle},[e._v(" Load another database or CSV ")])])}),le=[],ue={name:"changeDbIcon",mixins:[J],methods:{onClick:function(){this.hideTooltip(),this.$emit("click")}}},de=ue,Me=(i("03d9"),Object(u["a"])(de,ce,le,!1,null,"c1beafb4",null)),pe=Me.exports,ge=i("d4ec"),he=i("bee2");function Ie(){return new Worker(i.p+"js/_worker.6822ecb4.worker.js")}var me=i("ebb0"),Ne=i.n(me);function ve(){var e=new Ie;return new De(e)}var fe={getNewDatabase:ve},je=0,De=function(){function e(t){var i=this;Object(ge["a"])(this,e),this.dbName=null,this.schema=null,this.worker=t,this.pw=new Ne.a(t),this.importProgresses={},t.addEventListener("message",(function(e){var t=e.data.progress;if(void 0!==t){var n=e.data.id;i.importProgresses[n].dispatchEvent(new CustomEvent("progress",{detail:t}))}}))}return Object(he["a"])(e,[{key:"shutDown",value:function(){this.worker.terminate()}},{key:"createProgressCounter",value:function(e){var t=je++;return this.importProgresses[t]=new EventTarget,this.importProgresses[t].addEventListener("progress",(function(t){e(t.detail)})),t}},{key:"deleteProgressCounter",value:function(e){delete this.importProgresses[e]}},{key:"addTableFromCsv",value:function(){var e=Object(N["a"])(Object(m["a"])().mark((function e(t,i,n){var a;return Object(m["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.pw.postMessage({action:"import",data:i,progressCounterId:n,tabName:t});case 2:if(a=e.sent,!a.error){e.next=5;break}throw new Error(a.error);case 5:this.dbName=this.dbName||"database",this.refreshSchema();case 7:case"end":return e.stop()}}),e,this)})));function t(t,i,n){return e.apply(this,arguments)}return t}()},{key:"loadDb",value:function(){var e=Object(N["a"])(Object(m["a"])().mark((function e(t){var i,n;return Object(m["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!t){e.next=6;break}return e.next=3,k.readAsArrayBuffer(t);case 3:e.t0=e.sent,e.next=7;break;case 6:e.t0=null;case 7:return i=e.t0,e.next=10,this.pw.postMessage({action:"open",buffer:i});case 10:if(n=e.sent,!n.error){e.next=13;break}throw new Error(n.error);case 13:this.dbName=t?k.getFileName(t):"database",this.refreshSchema(),Object(S["a"])("database.import",t?t.size:0,{from:t?"sqlite":"none",new_db:!0});case 16:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"refreshSchema",value:function(){var e=Object(N["a"])(Object(m["a"])().mark((function e(){var t,i;return Object(m["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t="\n WITH columns as (\n SELECT\n a.tbl_name,\n json_group_array(\n json_object('name', b.name,'type', IIF(b.type = '', 'N/A', b.type))\n ) as column_json\n FROM sqlite_master a, pragma_table_info(a.name) b\n WHERE a.type in ('table','view') AND a.name NOT LIKE 'sqlite_%' group by tbl_name\n )\n SELECT json_group_array(json_object('name',tbl_name, 'columns', json(column_json))) objects\n FROM columns;\n ",e.next=3,this.execute(t);case 3:i=e.sent,this.schema=JSON.parse(i.values.objects[0]);case 5:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"execute",value:function(){var e=Object(N["a"])(Object(m["a"])().mark((function e(t){var i;return Object(m["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.pw.postMessage({action:"reopen"});case 2:return e.next=4,this.pw.postMessage({action:"exec",sql:t});case 4:if(i=e.sent,!i.error){e.next=7;break}throw new Error(i.error);case 7:return e.abrupt("return",i[i.length-1]);case 8:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"export",value:function(){var e=Object(N["a"])(Object(m["a"])().mark((function e(t){var i;return Object(m["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,this.pw.postMessage({action:"export"});case 2:if(i=e.sent,!i.error){e.next=5;break}throw new Error(i.error);case 5:k.exportToFile(i,t),Object(S["a"])("database.export",i.byteLength,{to:"sqlite"});case 7:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"validateTableName",value:function(){var e=Object(N["a"])(Object(m["a"])().mark((function e(t){return Object(m["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!t.startsWith("sqlite_")){e.next=2;break}throw new Error("Table name can't start with sqlite_");case 2:if(!/[^\w]/.test(t)){e.next=4;break}throw new Error("Table name can contain only letters, digits and underscores");case 4:if(!/^(\d)/.test(t)){e.next=6;break}throw new Error("Table name can't start with a digit");case 6:return e.next=8,this.execute('BEGIN; CREATE TABLE "'.concat(t,'"(id); ROLLBACK;'));case 8:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"sanitizeTableName",value:function(e){return e.replace(/[^\w]/g,"_").replace(/^(\d)/,"_$1").replace(/_{2,}/g,"_")}}]),e}(),Ce=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("modal",{attrs:{name:e.dialogName,classes:"dialog",height:"auto",width:"80%",scrollable:"",clickToClose:!1}},[i("div",{staticClass:"dialog-header"},[e._v(" CSV import "),i("close-icon",{attrs:{disabled:e.disableDialog},on:{click:e.cancelCsvImport}})],1),i("div",{staticClass:"dialog-body"},[i("text-field",{attrs:{label:"Table name",width:"484px",disabled:e.disableDialog,"error-msg":e.tableNameError,id:"csv-table-name"},model:{value:e.tableName,callback:function(t){e.tableName=t},expression:"tableName"}}),i("div",{staticClass:"chars"},[i("delimiter-selector",{staticClass:"char-input",attrs:{width:"210px",disabled:e.disableDialog},on:{input:e.previewCsv},model:{value:e.delimiter,callback:function(t){e.delimiter=t},expression:"delimiter"}}),i("text-field",{staticClass:"char-input",attrs:{label:"Quote char",hint:"The character used to quote fields.",width:"93px",disabled:e.disableDialog,id:"quote-char"},model:{value:e.quoteChar,callback:function(t){e.quoteChar=t},expression:"quoteChar"}}),i("text-field",{staticClass:"char-input",attrs:{label:"Escape char",hint:'\n The character used to escape the quote character within a field\n (e.g. "column with ""quotes"" in text").\n ',"max-hint-width":"242px",width:"93px",disabled:e.disableDialog,id:"escape-char"},model:{value:e.escapeChar,callback:function(t){e.escapeChar=t},expression:"escapeChar"}})],1),i("check-box",{attrs:{init:!0,label:"Use first row as column headers",disabled:e.disableDialog},on:{click:function(t){e.header=t}}}),e.previewData&&(e.previewData.rowCount>0||Object.keys(e.previewData).length>0)?i("sql-table",{staticClass:"preview-table",attrs:{"data-set":e.previewData,preview:!0}}):i("div",{staticClass:"no-data"},[e._v("No data")]),i("logs",{staticClass:"import-csv-errors",attrs:{messages:e.importCsvMessages}})],1),i("div",{staticClass:"dialog-buttons-container"},[i("button",{staticClass:"secondary",attrs:{disabled:e.disableDialog,id:"csv-cancel"},on:{click:e.cancelCsvImport}},[e._v(" Cancel ")]),i("button",{directives:[{name:"show",rawName:"v-show",value:!e.importCsvCompleted,expression:"!importCsvCompleted"}],staticClass:"primary",attrs:{disabled:e.disableDialog,id:"csv-import"},on:{click:function(t){return e.loadFromCsv(e.file)}}},[e._v(" Import ")]),i("button",{directives:[{name:"show",rawName:"v-show",value:e.importCsvCompleted,expression:"importCsvCompleted"}],staticClass:"primary",attrs:{disabled:e.disableDialog,id:"csv-finish"},on:{click:e.finish}},[e._v(" Finish ")])])])},be=[],ye=(i("99af"),i("159b"),i("498a"),i("d81d"),i("369b")),we=i.n(ye),ze={MissingQuotes:"Edit your CSV so that the field has a closing quote char.",TooFewFields:"Add fields or try another delimiter.",TooManyFields:"Edit your CSV or try another delimiter."},Te={getResult:function(e){var t={columns:[]},i={};if(e.meta.fields)e.meta.fields.forEach((function(n){var a=n.trim();t.columns.push(a),i[a]=e.data.map((function(e){var t=e[n];return t instanceof Date&&(t=t.toISOString()),t}))}));else for(var n=function(n){var a="col".concat(n+1);t.columns.push(a),i[a]=e.data.map((function(e){var t=e[n];return t instanceof Date&&(t=t.toISOString()),t}))},a=0;a<=e.data[0].length-1;a++)n(a);return t.values=i,t},prepareForExport:function(e){for(var t=e.columns,i=e.values[t[0]].length,n={fields:t,data:[]},a=function(i){n.data.push(t.map((function(t){return e.values[t][i]})))},s=0;s1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){var s={delimiter:"",newline:"",quoteChar:'"',escapeChar:'"',header:!1,transformHeader:void 0,dynamicTyping:!0,preview:0,encoding:"UTF-8",worker:!0,comments:!1,step:void 0,complete:function(e){var i={data:t.getResult(e),delimiter:e.meta.delimiter,hasErrors:!1,rowCount:e.data.length};i.messages=e.errors.map((function(e){return e.type="UndetectableDelimiter"===e.code?"info":"error","error"===e.type&&(i.hasErrors=!0),e.hint=ze[e.code],e})),n(i)},error:function(e,t){a(e)},download:!1,downloadRequestHeaders:void 0,downloadRequestBody:void 0,skipEmptyLines:"greedy",chunk:void 0,chunkSize:void 0,fastMode:void 0,beforeFirstChunk:void 0,withCredentials:void 0,transform:void 0,delimitersToGuess:[",","\t","|",";",we.a.RECORD_SEP,we.a.UNIT_SEP]};we.a.parse(e,Object(b["a"])(Object(b["a"])({},s),i))}))},serialize:function(e){return we.a.unparse(this.prepareForExport(e),{delimiter:"\t"})}},Oe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:{disabled:e.disabled}},[i("div",{staticClass:"text-field-label"},[e._v("Delimiter")]),i("div",{staticClass:"delimiter-selector-container",style:{width:e.width},on:{click:e.onContainerClick}},[i("div",{staticClass:"value"},[i("input",{directives:[{name:"model",rawName:"v-model",value:e.inputValue,expression:"inputValue"}],ref:"delimiterInput",class:{filled:e.filled},attrs:{type:"text",maxlength:"1",disabled:e.disabled},domProps:{value:e.inputValue},on:{click:function(e){e.stopPropagation()},input:function(t){t.target.composing||(e.inputValue=t.target.value)}}}),i("div",{staticClass:"name"},[e._v(e._s(e.getSymbolName(e.value)))])]),i("div",{staticClass:"controls",on:{click:function(e){e.stopPropagation()}}},[i("clear-icon",{attrs:{disabled:e.disabled},nativeOn:{click:function(t){return e.clear.apply(null,arguments)}}}),i("drop-down-chevron",{attrs:{disabled:e.disabled},nativeOn:{click:function(t){!e.disabled&&(e.showOptions=!e.showOptions)}}})],1)]),i("div",{directives:[{name:"show",rawName:"v-show",value:e.showOptions,expression:"showOptions"}],staticClass:"options",style:{width:e.width}},e._l(e.options,(function(t,n){return i("div",{key:n,staticClass:"option",on:{click:function(i){return e.chooseOption(t)}}},[i("pre",[e._v(e._s(t))]),i("div",[e._v(e._s(e.getSymbolName(t)))])])})),0)])},xe=[],Ae=(i("25f0"),{0:{name:"null character"},1:{name:"start of header"},2:{name:"start of text"},3:{name:"end of text"},4:{name:"end of transmission"},5:{name:"enquiry"},6:{name:"acknowledge"},7:{name:"bell (ring)"},8:{name:"backspace"},9:{name:"horizontal tab"},10:{name:"line feed"},11:{name:"vertical tab"},12:{name:"form feed"},13:{name:"carriage return"},14:{name:"shift out"},15:{name:"shift in"},16:{name:"data link escape"},17:{name:"device control 1"},18:{name:"device control 2"},19:{name:"device control 3"},20:{name:"device control 4"},21:{name:"negative acknowledge"},22:{name:"synchronize"},23:{name:"end transmission block"},24:{name:"cancel"},25:{name:"end of medium"},26:{name:"substitute"},27:{name:"escape"},28:{name:"file separator"},29:{name:"group separator"},30:{name:"record separator"},31:{name:"unit separator"},32:{name:"space"},33:{name:"exclamation mark"},34:{name:"quotation mark"},35:{name:"number sign"},36:{name:"dollar sign"},37:{name:"percent sign"},38:{name:"ampersand"},39:{name:"apostrophe"},40:{name:"left parenthesis"},41:{name:"right parenthesis"},42:{name:"asterisk"},43:{name:"plus sign"},44:{name:"comma"},45:{name:"hyphen"},46:{name:"period"},47:{name:"slash"},48:{name:"digit 0"},49:{name:"digit 1"},50:{name:"digit 2"},51:{name:"digit 3"},52:{name:"digit 4"},53:{name:"digit 5"},54:{name:"digit 6"},55:{name:"digit 7"},56:{name:"digit 8"},57:{name:"digit 9"},58:{name:"colon"},59:{name:"semicolon"},60:{name:"less-than"},61:{name:"equals-to"},62:{name:"greater-than"},63:{name:"question mark"},64:{name:"at sign"},65:{name:"uppercase A"},66:{name:"uppercase B"},67:{name:"uppercase C"},68:{name:"uppercase D"},69:{name:"uppercase E"},70:{name:"uppercase F"},71:{name:"uppercase G"},72:{name:"uppercase H"},73:{name:"uppercase I"},74:{name:"uppercase J"},75:{name:"uppercase K"},76:{name:"uppercase L"},77:{name:"uppercase M"},78:{name:"uppercase N"},79:{name:"uppercase O"},80:{name:"uppercase P"},81:{name:"uppercase Q"},82:{name:"uppercase R"},83:{name:"uppercase S"},84:{name:"uppercase T"},85:{name:"uppercase U"},86:{name:"uppercase V"},87:{name:"uppercase W"},88:{name:"uppercase X"},89:{name:"uppercase Y"},90:{name:"uppercase Z"},91:{name:"left square bracket"},92:{name:"backslash"},93:{name:"right square bracket"},94:{name:"caret"},95:{name:"underscore"},96:{name:"grave accent"},97:{name:"lowercase a"},98:{name:"lowercase b"},99:{name:"lowercase c"},100:{name:"lowercase d"},101:{name:"lowercase e"},102:{name:"lowercase f"},103:{name:"lowercase g"},104:{name:"lowercase h"},105:{name:"lowercase i"},106:{name:"lowercase j"},107:{name:"lowercase k"},108:{name:"lowercase l"},109:{name:"lowercase m"},110:{name:"lowercase n"},111:{name:"lowercase o"},112:{name:"lowercase p"},113:{name:"lowercase q"},114:{name:"lowercase r"},115:{name:"lowercase s"},116:{name:"lowercase t"},117:{name:"lowercase u"},118:{name:"lowercase v"},119:{name:"lowercase w"},120:{name:"lowercase x"},121:{name:"lowercase y"},122:{name:"lowercase z"},123:{name:"left curly brace"},124:{name:"vertical bar"},125:{name:"right curly brace"},126:{name:"tilde"},127:{name:"delete (rubout)"}}),Le=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("svg",{class:["chevron-icon",{disabled:e.disabled}],attrs:{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"}},[i("path",{attrs:{d:"M6.175 7.15002L10 10.975L13.825 7.15002L15 8.33336L10 13.3334L5 8.33336L6.175 7.15002Z",fill:"#C8D4E3"}})])},ke=[],Se={name:"DropDownChevron",props:["disabled"]},Ee=Se,Qe=(i("3742"),Object(u["a"])(Ee,Le,ke,!1,null,"07476bf6",null)),Ue=Qe.exports,Ye=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("svg",{class:["clear-icon",{disabled:e.disabled}],attrs:{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"}},[i("path",{attrs:{d:"M14.3481 14.849C13.8791 15.318 13.1191 15.318 12.6511 14.849L10.0001 11.819L7.34907\n 14.848C6.88007 15.317 6.12007 15.317 5.65207 14.848C5.18307 14.379 5.18307 13.619\n 5.65207 13.151L8.41007 10.001L5.65107 6.84898C5.18207 6.37998 5.18207 5.62098 5.65107\n 5.15198C6.12007 4.68298 6.87907 4.68298 7.34807 5.15198L10.0001 8.18298L12.6511\n 5.15198C13.1201 4.68298 13.8791 4.68298 14.3481 5.15198C14.8171 5.62098 14.8171 6.38098\n 14.3481 6.84898L11.5901 10.001L14.3481 13.151C14.8171 13.62 14.8171 14.38 14.3481\n 14.849V14.849Z",fill:"#C8D4E3"}})])},_e=[],Ze={name:"ClearIcon",props:["disabled"]},Ve=Ze,Pe=(i("523c"),Object(u["a"])(Ve,Ye,_e,!1,null,"208c41ca",null)),qe=Pe.exports,He={name:"DelimiterSelector",props:["value","width","disabled"],components:{DropDownChevron:Ue,ClearIcon:qe},data:function(){return{showOptions:!1,options:[",","\t"," ","|",";","",""],filled:!1,inputValue:""}},watch:{inputValue:function(){this.inputValue?(this.filled=!0,this.inputValue!==this.value&&this.$emit("input",this.inputValue)):this.filled=!1}},created:function(){this.inputValue=this.value},methods:{getSymbolName:function(e){return e?Ae[e.charCodeAt(0).toString()].name:""},chooseOption:function(e){this.inputValue=e,this.showOptions=!1},onContainerClick:function(e){this.$refs.delimiterInput.focus()},clear:function(){this.disabled||(this.inputValue="",this.$refs.delimiterInput.focus())}}},Be=He,$e=(i("28f9"),Object(u["a"])(Be,Oe,xe,!1,null,"44b0b048",null)),Ge=$e.exports,Re=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:["checkbox-container",{checked:e.checked},{disabled:e.disabled}],on:{click:function(t){return t.stopPropagation(),e.onClick.apply(null,arguments)}}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!e.checked,expression:"!checked"}],staticClass:"unchecked"}),n("img",{directives:[{name:"show",rawName:"v-show",value:e.checked&&!e.disabled,expression:"checked && !disabled"}],attrs:{src:"light"===e.theme?i("69e6"):i("93dd")}}),n("img",{directives:[{name:"show",rawName:"v-show",value:e.checked&&e.disabled,expression:"checked && disabled"}],attrs:{src:i("3d10")}}),e.label?n("span",{staticClass:"label"},[e._v(e._s(e.label))]):e._e()])},We=[],Fe={name:"CheckBox",props:{theme:{type:String,required:!1,default:"accent",validator:function(e){return["accent","light"].includes(e)}},init:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:""},disabled:{type:Boolean,required:!1,default:!1}},data:function(){return{checked:this.init}},methods:{onClick:function(){this.disabled||(this.checked=!this.checked,this.$emit("click",this.checked))}}},Je=Fe,Xe=(i("a96d"),Object(u["a"])(Je,Re,We,!1,null,"0dd86013",null)),Ke=Xe.exports,et=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",[i("div",{staticClass:"rounded-bg"},[i("div",{ref:"header-container",staticClass:"header-container"},[i("div",e._l(e.header,(function(t,n){return i("div",{key:n,staticClass:"fixed-header",style:{width:t.width+"px"}},[e._v(" "+e._s(t.name)+" ")])})),0)]),i("div",{ref:"table-container",staticClass:"table-container",on:{scroll:e.onScrollTable}},[i("table",{ref:"table",staticClass:"sqliteviz-table"},[i("thead",[i("tr",e._l(e.columns,(function(t,n){return i("th",{key:n,ref:"th",refInFor:!0},[i("div",{staticClass:"cell-data",style:e.cellStyle},[e._v(e._s(t))])])})),0)]),i("tbody",e._l(e.currentPageData.count,(function(t){return i("tr",{key:t},e._l(e.columns,(function(n,a){return i("td",{key:a},[i("div",{staticClass:"cell-data",style:e.cellStyle},[e._v(" "+e._s(e.dataSet.values[n][t-1+e.currentPageData.start])+" ")])])})),0)})),0)])])]),i("div",{staticClass:"table-footer"},[i("div",{staticClass:"table-footer-count"},[e._v(" "+e._s(e.rowCount)+" "+e._s(1===e.rowCount?"row":"rows")+" retrieved "),e.preview?i("span",[e._v("for preview")]):e._e(),e.time?i("span",[e._v("in "+e._s(e.time))]):e._e()]),i("pager",{directives:[{name:"show",rawName:"v-show",value:e.pageCount>1,expression:"pageCount > 1"}],attrs:{"page-count":e.pageCount},model:{value:e.currentPage,callback:function(t){e.currentPage=t},expression:"currentPage"}})],1)])},tt=[],it=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("paginate",{attrs:{"page-count":e.pageCount,"page-range":5,"margin-pages":1,"prev-text":e.chevron,"next-text":e.chevron,"no-li-surround":!0,"container-class":"paginator-continer","page-link-class":"paginator-page-link","active-class":"paginator-active-page","break-view-link-class":"paginator-break","next-link-class":"paginator-next","prev-link-class":"paginator-prev","disabled-class":"paginator-disabled"},model:{value:e.page,callback:function(t){e.page=t},expression:"page"}})},nt=[],at=i("8832"),st=i.n(at),rt={name:"Pager",components:{Paginate:st.a},props:["pageCount","value"],data:function(){return{page:this.value,chevron:'\n \n \n \n '}},watch:{page:function(){this.$emit("input",this.page)},value:function(){this.page=this.value}}},ot=rt,ct=(i("4378"),Object(u["a"])(ot,it,nt,!1,null,"36acc975",null)),lt=ct.exports,ut={name:"SqlTable",components:{Pager:lt},props:{dataSet:Object,time:String,pageSize:{type:Number,default:20},preview:Boolean},data:function(){return{header:null,tableWidth:null,currentPage:1,resizeObserver:null}},computed:{columns:function(){return this.dataSet.columns},rowCount:function(){return this.dataSet.values[this.columns[0]].length},cellStyle:function(){var e=this.tableWidth/this.columns.length;return{maxWidth:"".concat(Math.max(e,100),"px")}},pageCount:function(){return Math.ceil(this.rowCount/this.pageSize)},currentPageData:function(){var e=(this.currentPage-1)*this.pageSize,t=e+this.pageSize;return t>this.rowCount-1&&(t=this.rowCount-1),{start:e,end:t,count:t-e+1}}},methods:{calculateHeadersWidth:function(){var e=this;this.tableWidth=this.$refs["table-container"].offsetWidth,this.$nextTick((function(){e.header=e.$refs.th.map((function(e){return{name:e.innerText,width:e.getBoundingClientRect().width}}))}))},onScrollTable:function(){this.$refs["header-container"].scrollLeft=this.$refs["table-container"].scrollLeft}},mounted:function(){this.resizeObserver=new ResizeObserver(this.calculateHeadersWidth),this.resizeObserver.observe(this.$refs.table),this.calculateHeadersWidth()},beforeDestroy:function(){this.resizeObserver.unobserve(this.$refs.table)},watch:{currentPageData:"calculateHeadersWidth",dataSet:function(){this.currentPage=1}}},dt=ut,Mt=Object(u["a"])(dt,et,tt,!1,null,"79f99032",null),pt=Mt.exports,gt=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{ref:"logsContainer",staticClass:"logs-container"},e._l(e.messages,(function(t,a){return n("div",{key:a,staticClass:"msg"},["error"===t.type?n("img",{attrs:{src:i("7314")}}):e._e(),"info"===t.type?n("img",{attrs:{src:i("db39"),width:"20px"}}):e._e(),"success"===t.type?n("img",{attrs:{src:i("0bf4")}}):e._e(),"loading"===t.type?n("loading-indicator",{attrs:{progress:t.progress}}):e._e(),n("span",{staticClass:"msg-text"},[e._v(e._s(e.serializeMessage(t)))])],1)})),0)},ht=[],It=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("svg",{class:e.animationClass,attrs:{height:e.size,width:e.size,viewBox:"0 0 "+e.size+" "+e.size}},[i("circle",{staticClass:"loader-svg bg",style:{strokeWidth:e.strokeWidth},attrs:{cx:e.size/2,cy:e.size/2,r:e.radius}}),i("circle",{staticClass:"loader-svg front",style:{strokeDasharray:e.circleProgress,strokeDashoffset:e.offset,strokeWidth:e.strokeWidth},attrs:{cx:e.size/2,cy:e.size/2,r:e.radius}})])},mt=[],Nt={name:"LoadingIndicator",props:{progress:{type:Number,required:!1},size:{type:Number,required:!1,default:20}},computed:{circleProgress:function(){var e=3.14*this.radius*2,t=this.progress?e*this.progress/100:1*e/3,i=e-t;return"".concat(t,"px, ").concat(i,"px")},animationClass:function(){return void 0===this.progress?"loading":"progress"},radius:function(){return this.size/2-this.strokeWidth},offset:function(){return 3.14*this.radius/2},strokeWidth:function(){return this.size/10}}},vt=Nt,ft=(i("d9ad"),Object(u["a"])(vt,It,mt,!1,null,"62096452",null)),jt=ft.exports,Dt={name:"logs",props:["messages"],components:{LoadingIndicator:jt},watch:{"messages.length":"scrollToBottom"},mounted:function(){this.scrollToBottom()},methods:{scrollToBottom:function(){var e=this;return Object(N["a"])(Object(m["a"])().mark((function t(){var i;return Object(m["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(i=e.$refs.logsContainer,!i){t.next=5;break}return t.next=4,e.$nextTick();case 4:i.scrollTop=i.scrollHeight;case 5:case"end":return t.stop()}}),t)})))()},serializeMessage:function(e){var t="";return null!==e.row&&void 0!==e.row&&("error"===e.type?t+="Error in row ".concat(e.row,". "):t+="Information about row ".concat(e.row,". ")),t+=e.message,/(\.|!|\?)$/.test(t)||(t+="."),e.hint&&(t+=" ".concat(e.hint)),t}}},Ct=Dt,bt=(i("0582"),Object(u["a"])(Ct,gt,ht,!1,null,"1c9f27dc",null)),yt=bt.exports,wt=(i("b680"),{getPeriod:function(e,t){var i=t.getTime()-e.getTime(),n=i/1e3;return n.toFixed(3)+"s"},debounce:function(e,t){var i;return function(){var n=arguments,a=this;clearTimeout(i),i=setTimeout((function(){return e.apply(a,n)}),t)}},sleep:function(e){return new Promise((function(t){setTimeout((function(){t()}),e)}))}}),zt={name:"CsvImport",components:{CloseIcon:M,TextField:se,DelimiterSelector:Ge,CheckBox:Ke,SqlTable:pt,Logs:yt},props:["file","db","dialogName"],data:function(){return{disableDialog:!1,tableName:"",delimiter:"",quoteChar:'"',escapeChar:'"',header:!0,importCsvCompleted:!1,importCsvMessages:[],previewData:null,addedTable:null,tableNameError:""}},watch:{quoteChar:function(){this.previewCsv()},escapeChar:function(){this.previewCsv()},header:function(){this.previewCsv()},tableName:wt.debounce((function(){var e=this;this.tableNameError="",this.tableName&&this.db.validateTableName(this.tableName).catch((function(t){e.tableNameError=t.message+". Try another table name."}))}),400)},methods:{cancelCsvImport:function(){this.disableDialog||(this.addedTable&&(this.db.execute('DROP TABLE "'.concat(this.addedTable,'"')),this.db.refreshSchema()),this.$modal.hide(this.dialogName),this.$emit("cancel"))},reset:function(){this.header=!0,this.quoteChar='"',this.escapeChar='"',this.delimiter="",this.tableName="",this.disableDialog=!1,this.importCsvCompleted=!1,this.importCsvMessages=[],this.previewData=null,this.addedTable=null,this.tableNameError=""},open:function(){this.tableName=this.db.sanitizeTableName(k.getFileName(this.file)),this.$modal.show(this.dialogName)},previewCsv:function(){var e=this;return Object(N["a"])(Object(m["a"])().mark((function t(){var i,n,a,s;return Object(m["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.importCsvCompleted=!1,i={preview:3,quoteChar:e.quoteChar||'"',escapeChar:e.escapeChar,header:e.header,delimiter:e.delimiter},t.prev=2,n=new Date,t.next=6,Te.parse(e.file,i);case 6:a=t.sent,s=new Date,e.previewData=a.data,e.delimiter=a.delimiter,e.importCsvMessages=a.messages||[],a.hasErrors||e.importCsvMessages.push({message:"Preview parsing is completed in ".concat(wt.getPeriod(n,s),"."),type:"success"}),t.next=17;break;case 14:t.prev=14,t.t0=t["catch"](2),e.importCsvMessages=[{message:t.t0,type:"error"}];case 17:case"end":return t.stop()}}),t,null,[[2,14]])})))()},loadFromCsv:function(e){var t=this;return Object(N["a"])(Object(m["a"])().mark((function e(){var i,n,a,s,r,o,c,l,u,d,M,p;return Object(m["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t.tableName){e.next=3;break}return t.tableNameError="Table name can't be empty",e.abrupt("return");case 3:return t.disableDialog=!0,i={quoteChar:t.quoteChar||'"',escapeChar:t.escapeChar,header:t.header,delimiter:t.delimiter},n={message:"Parsing CSV...",type:"info"},t.importCsvMessages.push(n),a=setTimeout((function(){n.type="loading"}),1e3),s={message:"Importing CSV into a SQLite database...",type:"info"},r=null,o=function(e){t.$set(s,"progress",e)},c=t.db.createProgressCounter(o),e.prev=12,l=new Date,e.next=16,Te.parse(t.file,i);case 16:if(u=e.sent,d=new Date,u.hasErrors){e.next=38;break}return M=u.rowCount,p=wt.getPeriod(l,d),n.type="success",u.messages.length>0?(t.importCsvMessages=t.importCsvMessages.concat(u.messages),n.message="".concat(M," rows are parsed in ").concat(p,".")):n.message="".concat(M," rows are parsed successfully in ").concat(p,"."),clearTimeout(a),t.importCsvMessages.push(s),r=setTimeout((function(){s.type="loading"}),1e3),l=new Date,e.next=29,t.db.addTableFromCsv(t.tableName,u.data,c);case 29:d=new Date,t.addedTable=t.tableName,p=wt.getPeriod(l,d),s.message="Importing CSV into a SQLite database is completed in ".concat(p,"."),s.type="success",clearTimeout(r),t.importCsvCompleted=!0,e.next=41;break;case 38:n.message="Parsing ended with errors.",n.type="info",t.importCsvMessages=t.importCsvMessages.concat(u.messages);case 41:e.next=48;break;case 43:e.prev=43,e.t0=e["catch"](12),"loading"===n.type&&(n.type="info"),"loading"===s.type&&(s.type="info"),t.importCsvMessages.push({message:e.t0,type:"error"});case 48:clearTimeout(a),clearTimeout(r),t.db.deleteProgressCounter(c),t.disableDialog=!1;case 52:case"end":return e.stop()}}),e,null,[[12,43]])})))()},finish:function(){var e=this;return Object(N["a"])(Object(m["a"])().mark((function t(){var i,n;return Object(m["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.$modal.hide(e.dialogName),i=["/*"," * Your CSV file has been imported into ".concat(e.addedTable," table.")," * You can run this SQL query to make all CSV records available for charting."," */",'SELECT * FROM "'.concat(e.addedTable,'"')].join("\n"),t.next=4,e.$store.dispatch("addTab",{query:i});case 4:n=t.sent,e.$store.commit("setCurrentTabId",n),e.importCsvCompleted=!1,e.$emit("finish"),Object(S["a"])("inquiry.create",void 0,{auto:!0});case 9:case"end":return t.stop()}}),t)})))()}}},Tt=zt,Ot=(i("0315"),Object(u["a"])(Tt,Ce,be,!1,null,"4345e898",null)),xt=Ot.exports,At={name:"DbUploader",props:{type:{type:String,required:!1,default:"small",validator:function(e){return["illustrated","small"].includes(e)}},width:{type:String,required:!1,default:"unset"}},components:{ChangeDbIcon:pe,CsvImport:xt},data:function(){return{state:"",animationPromise:Promise.resolve(),file:null,newDb:null}},mounted:function(){var e=this;"illustrated"===this.type&&(this.animationPromise=new Promise((function(t){e.$refs.fileImg.addEventListener("animationend",(function(i){i.animationName.startsWith("fly")&&(e.state="dropped",t())}))})))},methods:{cancelCsvImport:function(){this.newDb&&(this.newDb.shutDown(),this.newDb=null)},finish:function(){var e=this;return Object(N["a"])(Object(m["a"])().mark((function t(){return Object(m["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.$store.commit("setDb",e.newDb),"/workspace"!==e.$route.path&&e.$router.push("/workspace");case 2:case"end":return t.stop()}}),t)})))()},loadDb:function(e){return Promise.all([this.newDb.loadDb(e),this.animationPromise]).then(this.finish)},checkFile:function(e){var t=this;return Object(N["a"])(Object(m["a"])().mark((function i(){var n;return Object(m["a"])().wrap((function(i){while(1)switch(i.prev=i.next){case 0:if(t.state="dropping",t.newDb=fe.getNewDatabase(),!k.isDatabase(e)){i.next=6;break}t.loadDb(e),i.next=13;break;case 6:return Object(S["a"])("database.import",e.size,{from:"csv",new_db:!0}),t.file=e,i.next=10,t.$nextTick();case 10:return n=t.$refs.addCsv,n.reset(),i.abrupt("return",Promise.all([n.previewCsv(),t.animationPromise]).then(n.open));case 13:case"end":return i.stop()}}),i)})))()},browse:function(){k.getFileFromUser(".db,.sqlite,.sqlite3,.csv").then(this.checkFile)},drop:function(e){this.checkFile(e.dataTransfer.files[0])}}},Lt=At,kt=(i("e252"),Object(u["a"])(Lt,re,oe,!1,null,"0db4c886",null)),St=kt.exports,Et=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("span",[i("svg",{staticClass:"icon",attrs:{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},on:{click:function(t){return t.stopPropagation(),e.onClick.apply(null,arguments)},mouseenter:function(t){return e.showTooltip(t,e.tooltipPosition)},mouseleave:e.hideTooltip}},[i("path",{attrs:{d:"M10.5 1.5H4.5C3.675 1.5 3 2.175 3 3V15C3 15.825 3.675 16.5 4.5 16.5H13.5C14.325 16.5\n 15 15.825 15 15V6L10.5 1.5ZM13.5 15H4.5V3H9.75V6.75H13.5V15ZM12 8.25V13.575L10.425\n 12L8.325 14.1L6.225 12L8.325 9.9L6.675 8.25H12Z",fill:"#A2B1C6"}})]),i("span",{ref:"tooltip",staticClass:"icon-tooltip",style:e.tooltipStyle},[e._v(" "+e._s(e.tooltip)+" ")])])},Qt=[],Ut={name:"ExportIcon",mixins:[J],props:["tooltip","tooltipPosition"],methods:{onClick:function(){this.hideTooltip(),this.$emit("click")}}},Yt=Ut,_t=(i("d353"),Object(u["a"])(Yt,Et,Qt,!1,null,"ca7c0840",null)),Zt=_t.exports,Vt=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("span",[i("svg",{staticClass:"icon",attrs:{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},on:{click:function(t){return t.stopPropagation(),e.onClick.apply(null,arguments)},mouseenter:e.showTooltip,mouseleave:e.hideTooltip}},[i("g",{attrs:{"clip-path":"url(#clip0)"}},[i("path",{attrs:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.6573 1.5H2.59985C1.77485 1.5 1.09985 2.175 1.09985 3V13.6649C1.09985 14.4899\n 1.77485 15.1649 2.59985\n 15.1649H9.84V13.6649H8.87866V9.08244H13.6573V9.83777H15.1573V3C15.1573\n 2.17 14.4873 1.5 13.6573 1.5ZM13.6573\n 7.58244V3H8.87866V7.58244H13.6573ZM7.37866 3H2.59985V7.58244H7.37866V3ZM2.59985\n 9.08244V13.6649H7.37866V9.08244H2.59985ZM13.1702\n 10.8434H15.6702V13.1717H18.0001V15.6717H15.6702V18H13.1702V15.6717H10.8401V13.1717H13.1702V10.8434Z",fill:"#A2B1C6"}})]),i("defs",[i("clipPath",{attrs:{id:"clip0"}},[i("rect",{attrs:{width:"18",height:"18",fill:"white"}})])])]),i("span",{ref:"tooltip",staticClass:"icon-tooltip",style:e.tooltipStyle},[e._v(" Add new table from CSV ")])])},Pt=[],qt={name:"AddTableIcon",mixins:[J],props:["tooltip"],methods:{onClick:function(){this.hideTooltip(),this.$emit("click")}}},Ht=qt,Bt=(i("1345"),Object(u["a"])(Ht,Vt,Pt,!1,null,"0ba70d33",null)),$t=Bt.exports,Gt={name:"Schema",components:{TableDescription:$,TextField:se,TreeChevron:P,DbUploader:St,ExportIcon:Zt,AddTableIcon:$t,CsvImport:xt},data:function(){return{schemaVisible:!0,filter:null,file:null}},computed:{schema:function(){var e=this;return this.$store.state.db.schema?this.filter?this.$store.state.db.schema.filter((function(t){return-1!==t.name.toUpperCase().indexOf(e.filter.toUpperCase())})):this.$store.state.db.schema:[]},dbName:function(){return this.$store.state.db.dbName}},methods:{exportToFile:function(){this.$store.state.db.export("".concat(this.dbName,".sqlite"))},addCsv:function(){var e=this;return Object(N["a"])(Object(m["a"])().mark((function t(){var i;return Object(m["a"])().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,k.getFileFromUser(".csv");case 2:return e.file=t.sent,t.next=5,e.$nextTick();case 5:return i=e.$refs.addCsv,i.reset(),t.next=9,i.previewCsv();case 9:i.open(),Object(S["a"])("database.import",e.file.size,{from:"csv",new_db:!1});case 11:case"end":return t.stop()}}),t)})))()}}},Rt=Gt,Wt=(i("eaae"),Object(u["a"])(Rt,A,L,!1,null,"4b15dca0",null)),Ft=Wt.exports,Jt=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{attrs:{id:"tabs"}},[e.tabs.length>0?i("div",{attrs:{id:"tabs-header"}},e._l(e.tabs,(function(t,n){return i("div",{key:n,class:[{"tab-selected":t.id===e.selectedIndex},"tab"],on:{click:function(i){return e.selectTab(t.id)}}},[i("div",{staticClass:"tab-name"},[i("span",{directives:[{name:"show",rawName:"v-show",value:!t.isSaved,expression:"!tab.isSaved"}],staticClass:"star"},[e._v("*")]),t.name?i("span",[e._v(e._s(t.name))]):i("span",{staticClass:"tab-untitled"},[e._v(e._s(t.tempName))])]),i("div",[i("close-icon",{staticClass:"close-icon",attrs:{size:10},on:{click:function(t){return e.beforeCloseTab(n)}}})],1)])})),0):e._e(),e._l(e.tabs,(function(e,t){return i("tab",{key:e.id,attrs:{id:e.id,"init-name":e.name,"init-query":e.query,"init-view-options":e.viewOptions,"init-view-type":e.viewType,"is-predefined":e.isPredefined,"tab-index":t}})})),i("div",{directives:[{name:"show",rawName:"v-show",value:0===e.tabs.length,expression:"tabs.length === 0"}],attrs:{id:"start-guide"}},[i("span",{staticClass:"link",on:{click:function(t){return e.$root.$emit("createNewInquiry")}}},[e._v("Create")]),e._v(" new inquiry from scratch or open one from "),i("router-link",{staticClass:"link",attrs:{to:"/inquiries"}},[e._v("Inquiries")])],1),i("modal",{attrs:{name:"close-warn",classes:"dialog",height:"auto"}},[i("div",{staticClass:"dialog-header"},[e._v(" Close tab "+e._s(null!==e.closingTabIndex?e.tabs[e.closingTabIndex].name||"["+e.tabs[e.closingTabIndex].tempName+"]":"")+" "),i("close-icon",{on:{click:function(t){return e.$modal.hide("close-warn")}}})],1),i("div",{staticClass:"dialog-body"},[e._v(" You have unsaved changes. Save changes in "+e._s(null!==e.closingTabIndex?e.tabs[e.closingTabIndex].name||"["+e.tabs[e.closingTabIndex].tempName+"]":"")+" before closing? ")]),i("div",{staticClass:"dialog-buttons-container"},[i("button",{staticClass:"secondary",on:{click:function(t){return e.closeTab(e.closingTabIndex)}}},[e._v(" Close without saving ")]),i("button",{staticClass:"secondary",on:{click:function(t){return e.$modal.hide("close-warn")}}},[e._v("Cancel")]),i("button",{staticClass:"primary",on:{click:function(t){return e.saveAndClose(e.closingTabIndex)}}},[e._v("Save and close")])])])],2)},Xt=[],Kt=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{directives:[{name:"show",rawName:"v-show",value:e.isActive,expression:"isActive"}],staticClass:"tab-content-container"},[i("splitpanes",{staticClass:"query-results-splitter",attrs:{horizontal:"",before:{size:50,max:100},after:{size:50,max:100}},scopedSlots:e._u([{key:"left-pane",fn:function(){return[i("div",{staticClass:"above",attrs:{id:"above-"+e.tabIndex}})]},proxy:!0},{key:"right-pane",fn:function(){return[i("div",{ref:"bottomPane",staticClass:"bottomPane",attrs:{id:"bottom-"+e.tabIndex}})]},proxy:!0}])}),i("div",{staticClass:"hidden-part",attrs:{id:"hidden-"+e.tabIndex}}),i("teleport",{attrs:{to:"#"+e.layout.sqlEditor+"-"+e.tabIndex}},[i("sql-editor",{ref:"sqlEditor",attrs:{"is-getting-results":e.isGettingResults},on:{switchTo:function(t){return e.onSwitchView("sqlEditor",t)},run:e.execute},model:{value:e.query,callback:function(t){e.query=t},expression:"query"}})],1),i("teleport",{attrs:{to:"#"+e.layout.table+"-"+e.tabIndex}},[i("run-result",{attrs:{result:e.result,"is-getting-results":e.isGettingResults,error:e.error,time:e.time},on:{switchTo:function(t){return e.onSwitchView("table",t)}}})],1),i("teleport",{attrs:{to:"#"+e.layout.dataView+"-"+e.tabIndex}},[i("data-view",{ref:"dataView",attrs:{"data-source":e.result&&e.result.values||null,"init-options":e.initViewOptions,"init-mode":e.initViewType},on:{switchTo:function(t){return e.onSwitchView("dataView",t)},update:e.onDataViewUpdate}})],1)],1)},ei=[],ti=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"sql-editor-panel"},[i("div",{staticClass:"codemirror-container"},[i("codemirror",{ref:"cm",attrs:{options:e.cmOptions},on:{changes:e.onChange},model:{value:e.query,callback:function(t){e.query=t},expression:"query"}})],1),i("side-tool-bar",{attrs:{panel:"sqlEditor"},on:{switchTo:function(t){return e.$emit("switchTo",t)}}},[i("icon-button",{attrs:{disabled:e.runDisabled,loading:e.isGettingResults,tooltip:"Run SQL query","tooltip-position":"top-left"},on:{click:function(t){return e.$emit("run")}}},[i("run-icon",{attrs:{disabled:e.runDisabled}})],1)],1)],1)},ii=[],ni=(i("fb6a"),i("56b3")),ai=i.n(ni),si=(i("9b74"),i("991c"),i("2f62")),ri={tabs:[],currentTab:null,currentTabId:null,untitledLastIndex:0,predefinedInquiries:[],db:null},oi=(i("a434"),{setDb:function(e,t){e.db&&e.db.shutDown(),e.db=t},updateTab:function(e,t){var i=t.index,a=t.name,s=t.id,r=t.query,o=t.viewType,c=t.viewOptions,l=t.isSaved,u=e.tabs[i],d=u.id;s&&e.currentTabId===d&&(e.currentTabId=s),s&&(u.id=s),a&&(u.name=a),r&&(u.query=r),o&&(u.viewType=o),c&&(u.viewOptions=c),void 0!==l&&(u.isSaved=l),l&&delete u.isPredefined,n["default"].set(e.tabs,i,u)},deleteTab:function(e,t){e.tabs[t].id===e.currentTabId&&(t0?e.currentTabId=e.tabs[t-1].id:(e.currentTabId=null,e.currentTab=null,e.untitledLastIndex=0)),e.tabs.splice(t,1)},setCurrentTabId:function(e,t){e.currentTabId=t},setCurrentTab:function(e,t){e.currentTab=t},updatePredefinedInquiries:function(e,t){e.predefinedInquiries=Array.isArray(t)?t:[t]}}),ci=(i("e9c4"),i("e1bd")),li={addTab:function(e,t){return Object(N["a"])(Object(m["a"])().mark((function i(){var n,a;return Object(m["a"])().wrap((function(i){while(1)switch(i.prev=i.next){case 0:return n=e.state,a=t?JSON.parse(JSON.stringify(t)):{},t&&t.id?a.isSaved=!0:(a.id=Object(ci["a"])(),a.name=null,a.tempName=n.untitledLastIndex?"Untitled ".concat(n.untitledLastIndex):"Untitled",a.viewType="chart",a.viewOptions=void 0,a.isSaved=!1),n.tabs.some((function(e){return e.id===a.id}))||(n.tabs.push(a),a.name||(n.untitledLastIndex+=1)),i.abrupt("return",a.id);case 5:case"end":return i.stop()}}),i)})))()}};n["default"].use(si["a"]);var ui=new si["a"].Store({state:ri,mutations:oi,actions:li});function di(e,t){var i=e.getTokenAt(e.getCursor()).string.toUpperCase(),n=ai.a.hint.sql(e,t);return 1===n.list.length&&n.list[0].text.toUpperCase()===i&&(n.list=[]),n}var Mi={get tables(){var e={};return ui.state.db.schema&&ui.state.db.schema.forEach((function(t){e[t.name]=t.columns.map((function(e){return e.name}))})),e},get defaultTable(){var e=ui.state.db.schema;return e&&1===e.length?e[0].name:null},completeSingle:!1,completeOnSingleClick:!0,alignWithWord:!1};function pi(e){ai.a.showHint(e,di,Mi)}function gi(e){var t=e.getTokenAt(e.getCursor()),i=t.string.slice(-1),n=t.type;"string"!==n&&i&&" "!==i&&";"!==i&&ai.a.showHint(e,di,Mi)}var hi=i("8f94"),Ii=(i("a7be"),i("ffda"),i("d5db"),i("f6b6"),i("f4ba"),function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"side-tool-bar"},[i("icon-button",{attrs:{active:"sqlEditor"===e.panel,tooltip:"Switch panel to SQL editor","tooltip-position":"top-left"},nativeOn:{click:function(t){return e.$emit("switchTo","sqlEditor")}}},[i("sql-editor-icon")],1),i("icon-button",{attrs:{active:"table"===e.panel,tooltip:"Switch panel to result set","tooltip-position":"top-left"},nativeOn:{click:function(t){return e.$emit("switchTo","table")}}},[i("table-icon")],1),i("icon-button",{attrs:{active:"dataView"===e.panel,tooltip:"Switch panel to data view","tooltip-position":"top-left"},nativeOn:{click:function(t){return e.$emit("switchTo","dataView")}}},[i("data-view-icon")],1),e.$slots.default?i("div",{staticClass:"side-tool-bar-divider"}):e._e(),e._t("default")],2)}),mi=[],Ni=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{class:["icon-btn",{active:e.active},{disabled:e.disabled}],on:{click:e.onClick,mouseenter:function(t){return e.showTooltip(t,e.tooltipPosition)},mouseleave:e.hideTooltip}},[i("div",{staticClass:"icon"},[e._t("default")],2),i("div",{directives:[{name:"show",rawName:"v-show",value:e.loading,expression:"loading"}],staticClass:"icon-in-progress"},[i("loading-indicator")],1),e.tooltip?i("span",{ref:"tooltip",staticClass:"icon-tooltip",style:e.tooltipStyle},[e._v(" "+e._s(e.tooltip)+" ")]):e._e()])},vi=[],fi={name:"SideBarButton",props:["active","disabled","tooltip","tooltipPosition","loading"],components:{LoadingIndicator:jt},mixins:[J],methods:{onClick:function(){this.hideTooltip(),this.$emit("click")}}},ji=fi,Di=(i("dd9c"),Object(u["a"])(ji,Ni,vi,!1,null,"0c2b486e",null)),Ci=Di.exports,bi=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("svg",{attrs:{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"}},[i("path",{attrs:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.5 2.16512L3.5 2.16999C2.675 2.16999 2 2.84499 2 3.66999V14.3349C2 15.1599 2.675\n 15.8349 3.5 15.8349L14.5 15.83C15.3327 15.83 16 15.1551 16 14.33V3.66512C16 2.83511 15.33\n 2.16512 14.5 2.16512ZM14.5014 3.66512L3.49878 3.66999V14.33L14.5014 14.3251V3.66512Z",fill:"#A2B1C6"}}),i("path",{attrs:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M6.27319 14.7069L6.27319 3.32135L7.77319 3.32135L7.77319 14.7069L6.27319 14.7069Z",fill:"#A2B1C6"}}),i("path",{attrs:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10.2639 14.6932L10.2639 3.30772L11.7639 3.30772L11.7639 14.6932L10.2639 14.6932Z",fill:"#A2B1C6"}}),i("path",{attrs:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.5108 7.48325H2.4895V5.98325H15.5108V7.48325Z",fill:"#A2B1C6"}}),i("path",{attrs:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.5108 11.6056H2.4895V10.1056H15.5108V11.6056Z",fill:"#A2B1C6"}})])},yi=[],wi={name:"TableIcon"},zi=wi,Ti=Object(u["a"])(zi,bi,yi,!1,null,null,null),Oi=Ti.exports,xi=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("svg",{attrs:{width:"18",height:"19",viewBox:"0 0 18 19",fill:"none"}},[i("g",{attrs:{"clip-path":"url(#clip0)"}},[i("path",{attrs:{d:"M4.5 1.51343H10.5L15 6.01343V8.45284H13.5V6.76343H9.75V3.01343H4.5V8.45284H3V3.01343C3\n 2.18843 3.675 1.51343 4.5 1.51343Z",fill:"#A2B1C6"}}),i("path",{attrs:{d:"M4.28369 14.8127C4.28369 14.5872 4.20312 14.4114 4.04199 14.2854C3.88379 14.1594\n 3.604 14.0291 3.20264 13.8943C2.80127 13.7595 2.47314 13.6292 2.21826 13.5032C1.38916\n 13.0959 0.974609 12.5364 0.974609 11.8245C0.974609 11.47 1.07715 11.158 1.28223\n 10.8884C1.49023 10.616 1.7832 10.405 2.16113 10.2556C2.53906 10.1033 2.96387 10.0271\n 3.43555 10.0271C3.89551 10.0271 4.30713 10.1091 4.67041 10.2732C5.03662 10.4373 5.3208\n 10.6716 5.52295 10.9763C5.7251 11.2781 5.82617 11.6238 5.82617 12.0134H4.28809C4.28809\n 11.7527 4.20752 11.5505 4.04639 11.407C3.88818 11.2634 3.67285 11.1917 3.40039\n 11.1917C3.125 11.1917 2.90674 11.2532 2.74561 11.3762C2.5874 11.4963 2.5083\n 11.6501 2.5083 11.8376C2.5083 12.0017 2.59619 12.1511 2.77197 12.2859C2.94775 12.4177\n 3.25684 12.5554 3.69922 12.699C4.1416 12.8396 4.50488 12.9919 4.78906 13.156C5.48047\n 13.5544 5.82617 14.1038 5.82617 14.804C5.82617 15.3635 5.61523 15.803 5.19336\n 16.1223C4.77148 16.4417 4.19287 16.6013 3.45752 16.6013C2.93896 16.6013 2.46875 16.509\n 2.04688 16.3245C1.62793 16.137 1.31152 15.8821 1.09766 15.5598C0.886719 15.2346\n 0.78125 14.8611 0.78125 14.4392H2.32812C2.32812 14.782 2.41602 15.0354 2.5918\n 15.1995C2.77051 15.3606 3.05908 15.4412 3.45752 15.4412C3.7124 15.4412 3.91309\n 15.387 4.05957 15.2786C4.20898 15.1672 4.28369 15.012 4.28369 14.8127ZM12.0444\n 13.446C12.0444 14.0378 11.9463 14.5549 11.75 14.9973C11.5537 15.4368 11.2827 15.7898\n 10.937 16.0564L11.9697 16.8738L11.0161 17.6824L9.64062 16.575C9.51172 16.5925 9.38281\n 16.6013 9.25391 16.6013C8.70898 16.6013 8.22559 16.4753 7.80371 16.2234C7.38184 15.9714\n 7.05225 15.6111 6.81494 15.1423C6.58057 14.6736 6.45898 14.1345 6.4502\n 13.5251V13.1868C6.4502 12.5569 6.56445 12.0032 6.79297 11.5256C7.02441 11.0481 7.35254\n 10.679 7.77734 10.4182C8.20508 10.1575 8.69434 10.0271 9.24512 10.0271C9.78711 10.0271\n 10.2705 10.156 10.6953 10.4138C11.1201 10.6716 11.4497 11.0393 11.6841 11.5168C11.9214\n 11.9915 12.0415 12.5364 12.0444 13.1516V13.446ZM10.4756 13.178C10.4756 12.5422 10.3687\n 12.0603 10.1548 11.7322C9.94385 11.4011 9.64062 11.2356 9.24512 11.2356C8.83789 11.2356\n 8.53174 11.3982 8.32666 11.7234C8.12158 12.0486 8.01758 12.5247 8.01465\n 13.1516V13.446C8.01465 14.0759 8.11865 14.5593 8.32666 14.8962C8.53467 15.2302 8.84375\n 15.3972 9.25391 15.3972C9.64648 15.3972 9.94678 15.2317 10.1548 14.9006C10.3657\n 14.5696 10.4727 14.0935 10.4756 13.4724V13.178ZM14.3735\n 15.3269H17.0586V16.5134H12.8311V10.115H14.3735V15.3269Z",fill:"#A2B1C6"}})]),i("defs",[i("clipPath",{attrs:{id:"clip0"}},[i("rect",{attrs:{width:"18",height:"18",fill:"white",transform:"translate(0 0.0134277)"}})])])])},Ai=[],Li={name:"SqlEditorIcon"},ki=Li,Si=Object(u["a"])(ki,xi,Ai,!1,null,null,null),Ei=Si.exports,Qi=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("svg",{attrs:{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"}},[i("path",{attrs:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.5552 6.91522C13.7584 6.91357 13.9535 6.99442 14.096 7.13926L17.2582 10.3541C17.5486\n 10.6494 17.5447 11.1242 17.2494 11.4147C16.9541 11.7051 16.4793 11.7012 16.1888\n 11.4059L13.57 8.74357L9.29577 13.2318C9.01977 13.5216 8.56484 13.5436 8.2621\n 13.2819L5.35435 10.7677L2.03285 13.7321C1.72382 14.0079 1.24971 13.981 0.973901\n 13.6719C0.69809 13.3629 0.725022 12.8888 1.03406 12.613L4.8471 9.20986C5.12827 8.95892\n 5.55198 8.95559 5.83705 9.20208L8.70249 11.6797L13.0182 7.14796C13.1583 7.00084 13.3521\n 6.91686 13.5552 6.91522Z",fill:"#A2B1C6"}}),i("circle",{attrs:{cx:"5.50049",cy:"6.00339",r:"1.5",fill:"#A2B1C6"}}),i("path",{attrs:{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.036 1.21788L1.96546 1.213C1.14046 1.213 0.465462 1.888 0.465462 2.713L0.464111\n 15.2821C0.464111 16.1071 1.13911 16.7821 1.96411 16.7821L16.0347 16.787C16.8674 16.787\n 17.5347 16.1121 17.5347 15.287L17.536 2.71788C17.536 1.88787 16.866 1.21788 16.036\n 1.21788ZM16.0374 2.71788L1.96424 2.713L1.96289 15.2773L16.036 15.2821L16.0374 2.71788Z",fill:"#A2B1C6"}})])},Ui=[],Yi={name:"DataViewIcon"},_i=Yi,Zi=Object(u["a"])(_i,Qi,Ui,!1,null,null,null),Vi=Zi.exports,Pi={name:"SideToolBar",props:["panel"],components:{IconButton:Ci,SqlEditorIcon:Ei,DataViewIcon:Vi,TableIcon:Oi}},qi=Pi,Hi=(i("f4e5"),Object(u["a"])(qi,Ii,mi,!1,null,"3b6366bb",null)),Bi=Hi.exports,$i=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("svg",{attrs:{width:"12",height:"13",viewBox:"0 0 12 13",fill:"none"}},[i("path",{attrs:{d:"M11.1624 6.94358L0.770043 12.9436L0.770043 0.943573L11.1624 6.94358Z",fill:"#A2B1C6"}})])},Gi=[],Ri={name:"RunIcon"},Wi=Ri,Fi=Object(u["a"])(Wi,$i,Gi,!1,null,null,null),Ji=Fi.exports,Xi={name:"SqlEditor",props:["value","isGettingResults"],components:{codemirror:hi["codemirror"],SideToolBar:Bi,IconButton:Ci,RunIcon:Ji},data:function(){return{query:this.value,cmOptions:{tabSize:4,mode:"text/x-mysql",theme:"neo",lineNumbers:!0,line:!0,autoRefresh:!0,extraKeys:{"Ctrl-Space":pi}}}},computed:{runDisabled:function(){return!this.$store.state.db||!this.query||this.isGettingResults}},watch:{query:function(){this.$emit("input",this.query)}},methods:{onChange:wt.debounce(gi,400),focus:function(){this.$refs.cm.codemirror.focus()}}},Ki=Xi,en=(i("16a3"),Object(u["a"])(Ki,ti,ii,!1,null,"c84dd870",null)),tn=en.exports,nn=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"data-view-panel"},[i("div",{staticClass:"data-view-panel-content"},[i(e.mode,{ref:"viewComponent",tag:"component",attrs:{"init-options":e.mode===e.initMode?e.initOptions:void 0,"data-sources":e.dataSource,"import-to-png-enabled":e.importToPngEnabled,"import-to-svg-enabled":e.importToSvgEnabled},on:{"update:importToPngEnabled":function(t){e.importToPngEnabled=t},"update:import-to-png-enabled":function(t){e.importToPngEnabled=t},"update:importToSvgEnabled":function(t){e.importToSvgEnabled=t},"update:import-to-svg-enabled":function(t){e.importToSvgEnabled=t},loadingImageCompleted:function(t){e.loadingImage=!1},update:function(t){return e.$emit("update")}}})],1),i("side-tool-bar",{attrs:{panel:"dataView"},on:{switchTo:function(t){return e.$emit("switchTo",t)}}},[i("icon-button",{attrs:{active:"chart"===e.mode,tooltip:"Switch to chart","tooltip-position":"top-left"},on:{click:function(t){e.mode="chart"}}},[i("chart-icon")],1),i("icon-button",{attrs:{active:"pivot"===e.mode,tooltip:"Switch to pivot","tooltip-position":"top-left"},on:{click:function(t){e.mode="pivot"}}},[i("pivot-icon")],1),i("div",{staticClass:"side-tool-bar-divider"}),i("icon-button",{attrs:{disabled:!e.importToPngEnabled||e.loadingImage,loading:e.loadingImage,tooltip:"Save as PNG image","tooltip-position":"top-left"},on:{click:e.saveAsPng}},[i("png-icon")],1),i("icon-button",{attrs:{disabled:!e.importToSvgEnabled,tooltip:"Save as SVG","tooltip-position":"top-left"},on:{click:e.saveAsSvg}},[i("export-to-svg-icon")],1),i("icon-button",{attrs:{tooltip:"Save as HTML","tooltip-position":"top-left"},on:{click:e.saveAsHtml}},[i("HtmlIcon")],1),i("icon-button",{attrs:{loading:e.copyingImage,tooltip:"Copy visualisation to clipboard","tooltip-position":"top-left"},on:{click:e.prepareCopy}},[i("clipboard-icon")],1)],1),i("loading-dialog",{attrs:{loadingMsg:"Rendering the visualisation...",successMsg:"Image is ready",actionBtnName:"Copy",name:"prepareCopy",title:"Copy to clipboard",loading:e.preparingCopy},on:{action:e.copyToClipboard,cancel:e.cancelCopy}})],1)},an=[],sn=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{directives:[{name:"show",rawName:"v-show",value:e.visible,expression:"visible"}],ref:"chartContainer",staticClass:"chart-container"},[i("div",{directives:[{name:"show",rawName:"v-show",value:!e.dataSources&&e.visible,expression:"!dataSources && visible"}],staticClass:"warning chart-warning"},[e._v(" There is no data to build a chart. Run your SQL query and make sure the result is not empty. ")]),i("PlotlyEditor",{ref:"plotlyEditor",staticClass:"chart",style:{height:e.dataSources?"100%":"calc(100% - 40px)"},attrs:{data:e.state.data,layout:e.state.layout,frames:e.state.frames,config:{editable:!0,displaylogo:!1,modeBarButtonsToRemove:["toImage"]},dataSources:e.dataSources,dataSourceOptions:e.dataSourceOptions,plotly:e.plotly,useResizeHandler:!0,debug:!0,advancedTraceTypeSelector:!0},on:{onUpdate:e.update,onRender:e.onRender}})],1)},rn=[],on=i("030a"),cn=i.n(on),ln=(i("0848"),i("b1c6")),un=i.n(ln),dn=(i("b64b"),i("662f")),Mn=i.n(dn);function pn(e){return e?Object.keys(e).map((function(e){return{value:e,label:e}})):[]}function gn(e,t){var i=JSON.parse(JSON.stringify(e)),n={};for(var a in t)n[a]=[];return Mn()(i.data,n),i}function hn(e,t){return In.apply(this,arguments)}function In(){return In=Object(N["a"])(Object(m["a"])().mark((function e(t,i){var n;return Object(m["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.querySelector(".js-plotly-plot"),e.next=3,cn.a.toImage(n,{format:i,width:null,height:null});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)}))),In.apply(this,arguments)}function mn(e){var t=e.querySelector(".js-plotly-plot");return{data:t.data,layout:t.layout}}function Nn(e){var t=Object(ci["a"])();return'\n