@devtable/dashboard 10.7.0 → 10.8.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.
@@ -3024,7 +3024,7 @@ class Zo {
3024
3024
  }), this.instanceRegistry.clear(), this.factoryRegistry.clear();
3025
3025
  }
3026
3026
  }
3027
- const bc = "10.7.0", wf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3027
+ const bc = "10.8.0", wf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3028
3028
  __proto__: null,
3029
3029
  version: bc
3030
3030
  }, Symbol.toStringTag, { value: "Module" }));
@@ -27359,7 +27359,7 @@ WHERE
27359
27359
  /* @__PURE__ */ i(A, { label: "Name", value: t.name, onChange: (e) => {
27360
27360
  t.setName(e.currentTarget.value);
27361
27361
  } }),
27362
- /* @__PURE__ */ i(V, { label: "Type", withinPortal: !0, value: t.type, onChange: t.setType, data: uM }),
27362
+ /* @__PURE__ */ i(V, { label: "Type", withinPortal: !0, zIndex: 320, value: t.type, onChange: t.setType, data: uM }),
27363
27363
  /* @__PURE__ */ i(dM, { view: t })
27364
27364
  ] }) : null), pM = D(({
27365
27365
  id: t
@@ -116,7 +116,7 @@ Check the top-level render call using <`+P+">.")}return z}}function jl(S,z){{if(
116
116
  SELECT count(*) AS total
117
117
  FROM ${n}.${e}
118
118
  `}})).actions(t=>({setPage(e){t.page=e},resetPage(){t.page=1},setLimit(e){t.limit=e}})).actions(t=>({afterCreate(){b.addDisposer(t,ie.reaction(()=>t.keywordString,t.resetPage,{fireImmediately:!1,delay:0})),b.addDisposer(t,ie.reaction(()=>t.limit,t.resetPage,{fireImmediately:!1,delay:0}))}})),qu=b.types.model("DataSourceModel",{id:b.types.string,type:b.types.enumeration("DataSourceType",[me.HTTP,me.MySQL,me.Postgresql]),key:b.types.string,config:b.types.frozen(),tables:b.types.optional(Vu,{}),columns:b.types.optional(Pu,{}),tableData:b.types.optional(Nu,{}),indexes:b.types.optional(Bu,{}),table_schema:b.types.optional(b.types.string,""),table_name:b.types.optional(b.types.string,"")}).volatile(()=>({controllers:{tables:new AbortController,columns:new AbortController,indexes:new AbortController,tableData:new AbortController}})).actions(t=>({setKeywords(e,n){t.table_schema=e,t.table_name=n}})).actions(t=>({initKeywords(){if(t.tables.empty)return;const e=Object.keys(t.tables.data)[0],n=t.tables.data[e][0].table_name;t.setKeywords(e,n)}})).actions(t=>{const e=b.flow(function*(){var n;(n=t.controllers.tables)==null||n.abort(),t.controllers.tables=new AbortController,t.tables.state="loading";try{const r=yield*b.toGenerator(qe.query(t.controllers.tables.signal)({type:t.type,key:t.key,query:t.tables.sql},{}));t.tables.data=v.groupBy(r,"table_schema"),t.tables.state="idle",t.tables.error=null,t.initKeywords()}catch(r){if(!pt.isCancel(r)){t.tables.data={};const a=v.get(r,"message","unkown error");t.tables.error=v.get(r,"response.data.detail.message",a),t.tables.state="error"}}});return{loadTables:e,loadTablesIfEmpty(){t.tables.empty&&e()},loadColumns:b.flow(function*(){var n;(n=t.controllers.columns)==null||n.abort(),t.controllers.columns=new AbortController,t.columns.state="loading";try{t.columns.data=yield*b.toGenerator(qe.query(t.controllers.columns.signal)({type:t.type,key:t.key,query:t.columns.sql},{})),t.columns.state="idle",t.columns.error=null}catch(r){if(pt.isCancel(r))t.columns.state="idle",t.columns.error=null;else{t.columns.data=[];const a=v.get(r,"message","unkown error");t.columns.error=v.get(r,"response.data.detail.message",a),t.columns.state="error"}}}),loadIndexes:b.flow(function*(){var n;(n=t.controllers.indexes)==null||n.abort(),t.controllers.indexes=new AbortController,t.indexes.state="loading";try{t.indexes.data=yield*b.toGenerator(qe.query(t.controllers.indexes.signal)({type:t.type,key:t.key,query:t.indexes.sql},{})),t.indexes.state="idle",t.indexes.error=null}catch(r){if(pt.isCancel(r))t.indexes.state="idle",t.indexes.error=null;else{t.indexes.data=[];const a=v.get(r,"message","unkown error");t.indexes.error=v.get(r,"response.data.detail.message",a),t.indexes.state="error"}}}),loadTableData:b.flow(function*(){var r;(r=t.controllers.tableData)==null||r.abort(),t.controllers.tableData=new AbortController;const n=t.tableData;n.state="loading";try{n.data=yield*b.toGenerator(qe.query(t.controllers.tableData.signal)({type:t.type,key:t.key,query:n.sql},{}));const[{total:a}]=yield*b.toGenerator(qe.query(t.controllers.tableData.signal)({type:t.type,key:t.key,query:n.countSql},{}));n.total=Number(a),n.state="idle",n.error=null}catch(a){if(pt.isCancel(a))n.state="idle",n.error=null;else{n.data=[];const o=v.get(a,"message","unkown error");n.error=v.get(a,"response.data.detail.message",o),n.state="error"}}})}}).actions(t=>({afterCreate(){b.addDisposer(t,ie.reaction(()=>t.columns.sql,t.loadColumns,{fireImmediately:!1,delay:500}))}})).actions(t=>({afterCreate(){b.addDisposer(t,ie.reaction(()=>t.indexes.sql,t.loadIndexes,{fireImmediately:!1,delay:500})),b.addDisposer(t,ie.reaction(()=>t.tableData.sql,t.loadTableData,{fireImmediately:!1,delay:0}))}})),Fu=b.types.model("DataSourcesModel",{list:b.types.optional(b.types.array(qu),[])}).views(t=>({find({type:e,key:n}){return t.list.find(r=>r.key===n&&r.type===e)},get options(){return t.list.map(e=>({value:e.key,label:e.key}))}})).actions(t=>({replace(e){t.list.length=0,t.list.push(...e)}}));function bn(t){return{label:t,value:t,_type:"ACTION",_action_type:t,Icon:null,children:null}}function Gu(t){switch(t._type){case"GROUP":case"ACTION":return null;case"query_variables":return["_QUERY_VARS_"];case"mock_context":return["_MOCK_CONTEXT_"];case"filter":return["_FILTERS_",t.value];case"sql_snippet":return["_SQL_SNIPPETS_",t.value];case"query":return["_QUERIES_",t.value];case"view":return["_VIEWS_",t.value];case"panel":return t.parentID?["_VIEWS_",t.parentID,"_PANELS_",t.value]:(console.error("[getPathFromOption] parentID is required"),null)}}const Wu=b.types.model("EditorModel",{path:b.types.optional(b.types.frozen(),[]),settings_open:b.types.optional(b.types.boolean,!1)}).views(t=>({get navOptions(){const{content:e}=b.getRoot(t),{filters:n,views:r,sqlSnippets:a,queries:o}=e;return[{label:"Query Variables",value:"_QUERY_VARS_",_type:"query_variables",Icon:L.IconVariable},{label:"Mock Context",value:"_MOCK_CONTEXT_",Icon:L.IconCodeDots,_type:"mock_context"},{label:"Filters",value:"_FILTERS_",Icon:L.IconFilter,children:[...n.options,bn("_Add_A_Filter_")],_type:"GROUP"},{label:"SQL Snippets",value:"_SQL_SNIPPETS_",Icon:L.IconCopy,children:[...a.options,bn("_Add_A_SQL_SNIPPET_")],_type:"GROUP"},{label:"Queries",value:"_QUERIES_",Icon:L.IconDatabase,children:[...o.options,bn("_Add_A_QUERY_")],_type:"GROUP"},{label:"Views",value:"_VIEWS_",Icon:L.IconBoxMultiple,children:[...r.editorOptions,bn("_Add_A_VIEW_")],_type:"GROUP"}]},isOptionActive(e,n){return e.length===0?!1:e[e.length-1]===n.value},isOptionOpened(e){const{path:n}=t;return n.length===0||!e.children||e.children.length===0?!1:n.includes(e.value)}})).actions(t=>({setPath(e){t.path=e},setSettingsOpen(e){t.settings_open=e}})).actions(t=>({open(e){t.setPath(e),t.setSettingsOpen(!0)},close(){t.setSettingsOpen(!1)},navigate(e){const n=Gu(e);n&&t.setPath(n)}})),ju=b.types.model("MockContextModel",{current:b.types.optional(b.types.frozen(),{})}).views(t=>({get keys(){return Object.keys(t.current)},get entries(){return Object.entries(t.current)}})).actions(t=>({replace(e){t.current=e},get(e){return t.current[e]},set(e,n){t.current[e]=n}})),Ru=b.types.model("VariableModel",{name:b.types.string,size:b.types.string,weight:b.types.string,color:b.types.union(b.types.model({type:b.types.literal("static"),staticColor:b.types.string}),b.types.model({type:b.types.literal("continuous"),valueRange:b.types.array(b.types.number),colorRange:b.types.array(b.types.string)}),b.types.model({type:b.types.literal("piecewise")})),formatter:b.types.model({output:b.types.enumeration("Output",["number","percent"]),average:b.types.optional(b.types.boolean,!1),mantissa:b.types.number,trimMantissa:b.types.optional(b.types.boolean,!1)}),data_field:b.types.string,aggregation:b.types.union(b.types.model({type:b.types.enumeration(["none","sum","mean","median","min","max","CV","std"]),config:b.types.frozen()}),b.types.model({type:b.types.literal("quantile"),config:b.types.model({p:b.types.number})}))}).views(t=>({get json(){const{name:e,size:n,weight:r,color:a,formatter:o,data_field:l,aggregation:u}=t;return v.cloneDeep({name:e,size:n,color:a,weight:r,formatter:o,data_field:l,aggregation:u})}}));class Yu{constructor(e){N(this,"origin");N(this,"copy");this.origin=e,this.copy=b.clone(e),ie.makeAutoObservable(this,{},{autoBind:!0,deep:!1})}get changed(){return!v.isEqual(b.getSnapshot(this.origin),b.getSnapshot(this.copy))}commit(){b.applySnapshot(this.origin,b.getSnapshot(this.copy))}update(e){b.applySnapshot(this.copy,e)}}const Qu=t=>new Yu(t);class Ku{constructor(){N(this,"migrations",[])}version(e,n){return this.migrations.push({version:e,handler:n}),this}run(e,n,r){var l;if(e.from===e.to)return n;if(e.from>e.to)throw new Error(`Can not downgrade from version '${e.from}' to (${e.to})`);const a=this.migrations.filter(u=>u.version>e.from&&u.version<=e.to),o=v.orderBy(a,"version","asc");if(((l=v.last(o))==null?void 0:l.version)!==e.to)throw new Error(`Migration to version ${e.to} not found`);return o.reduce((u,c)=>c.handler(u,r),n)}}class ve extends Ku{constructor(){super(),this.configVersions()}version(e,n){return super.version(e,(r,a)=>({version:e,...n(r,a)}))}async migrate({configData:e,panelModel:n}){const r=await e.getItem(null),a=v.get(r,"version",0),o=this.run({from:a,to:this.VERSION},r,{panelModel:n});await e.setItem(null,o)}async needMigration({configData:e}){const n=await e.getItem(null);return v.get(n,"version",0)<this.VERSION}}var Xe=(t=>(t.string="string",t.number="number",t.eloc="eloc",t.percentage="percentage",t.custom="custom",t))(Xe||{});const fs=["function text({ value }) {"," // your code goes here"," return value","}"].join(`
119
- `),vr={columns:[],fontSize:"14px",highlightOnHover:!0,horizontalSpacing:"14px",id_field:"",striped:!0,use_raw_columns:!0,verticalSpacing:"14px"};class Lt{constructor(e,n){this.root=e,this.path=n}async deleteItem(e){e===null&&await this.root.deleteItem(this.path);const n=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,v.omit(n,e))}async getItem(e){const n=await this.root.getItem(this.path);return e===null?n:v.get(n,e)}async setItem(e,n){if(e===null)await this.root.setItem(this.path,n);else{const r=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,{...r,[e]:n})}return await this.getItem(e)}watchItem(e,n,r){return e===null?this.root.watchItem(this.path,(a,o)=>{n(a,o)},r):this.root.watchItem(this.path,(a,o)=>{const l=v.get(a,e),u=v.get(o,e);l!==u&&n(l,u)},r)}}class xr{constructor(e,n,r){N(this,"attachmentStorage");this.instance=e,this.attachmentKey=n,this.constructInstance=r,this.attachmentStorage=new Lt(e.instanceData,n)}async getInstance(e){if(await this.attachmentStorage.getItem(e))return this.constructInstance(new Lt(this.attachmentStorage,e))}async create(e,n){return await this.attachmentStorage.setItem(e,n),this.constructInstance(new Lt(this.attachmentStorage,e))}async remove(e){await this.attachmentStorage.deleteItem(e)}async list(){const e=await this.attachmentStorage.getItem(null);return Promise.all(v.values(e).map(n=>this.constructInstance(new Lt(this.attachmentStorage,n.id))))}}class gs{constructor(e){N(this,"rootRef");this.rootRef=ie.observable({current:e})}async deleteItem(e){ie.runInAction(()=>{v.unset(this.rootRef.current,[e])})}getItem(e){const n=this.getValueFromRoot(e);return Promise.resolve(n)}getValueFromRoot(e){return e===null?ie.toJS(this.rootRef.current):v.get(this.rootRef.current,[e])}setItem(e,n){if(e===null)if(v.isObject(n))ie.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else ie.runInAction(()=>{v.set(this.rootRef.current,[e],n)});return Promise.resolve(this.getItem(e))}watchItem(e,n,r){return ie.reaction(()=>this.getValueFromRoot(e),(a,o)=>{n(a,o)},{requiresObservable:!0,fireImmediately:v.get(r,"fireImmediately",!1)})}}class Uu{constructor(){N(this,"channels",new Map);N(this,"globalChannel",new _a)}getChannel(e){const n=this.channels.get(e);if(n)return n;const r=new _a;return this.channels.set(e,r),r}}class Xu{constructor(e){N(this,"instances",new Map);this.pluginManager=e}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(e=>e.manifest.viz)}resolveComponent(e){return this.pluginManager.factory.viz(e)}getOrCreateInstance(e){const n=this.instances.get(e.id);if(n)return n;const r={id:e.id,name:e.viz.type,type:e.viz.type,messageChannels:new Uu,instanceData:new gs(e.viz.conf)};return this.instances.set(e.id,r),r}}function ms(t,e,n,r){return{vizManager:n,locale:"zh",msgChannels:t.messageChannels,instanceData:t.instanceData,pluginData:new gs({}),colorPalette:{getColor(){return()=>""}},data:e,variables:r}}const Ju=t=>{const{panel:e,vizManager:n,data:r,variables:a}=t,o=n.resolveComponent(e.viz.type),l=n.getOrCreateInstance(e),u={...ms(l,r,n,a),viewport:{width:e.layout.w,height:e.layout.h}},c=o.viewRender;return i(c,{context:u,instance:l,...v.omit(t,["panel","vizManager","data"])})},Zu=t=>{const{vizManager:e,panel:n,panelInfoEditor:r,data:a,variables:o}=t,l=e.resolveComponent(n.viz.type),u=e.getOrCreateInstance(n),c={...ms(u,a,e,o),panelInfoEditor:r},d=l.configRender;return i(d,{context:c,instance:u,...v.omit(t,["panel","vizManager","data","panelInfoEditor"])})},ys=(t,e)=>{const n=st.bezier(t),r=st.bezier(e);return function(a){return a<50?n(a*2/100).hex():r((a-50)*2/100).hex()}},vn=t=>{const e=st.bezier(t);return function(n){return e(n/100).hex()}},Hu={type:"interpolation",displayName:"Red / Green",getColor:ys(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},ec={type:"interpolation",displayName:"Yellow / Blue",getColor:ys(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},tc={type:"interpolation",displayName:"Red",getColor:vn(["#fff7f1","darkred"]),name:"red",category:"sequential"},nc={type:"interpolation",displayName:"Green",getColor:vn(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},rc={type:"interpolation",displayName:"Blue",getColor:vn(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},ic={type:"interpolation",displayName:"Orange",getColor:vn(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class ac{constructor(e){N(this,"symbol");this.symbol=Symbol(e)}}function ot(t){return new ac(t)}class wr{constructor(){N(this,"parent");N(this,"factoryRegistry",new Map);N(this,"instanceRegistry",new Map)}createScoped(){const e=new wr;return e.parent=this,e}getRequired(e){return this.get(e)}get(e){if(this.instanceRegistry.has(e.symbol))return this.instanceRegistry.get(e.symbol);const n=this.factoryRegistry.get(e.symbol);if(n){const r=n(this);return this.instanceRegistry.set(e.symbol,r),r}if(this.parent)return this.parent.get(e)}provideFactory(e,n){return this.factoryRegistry.has(e.symbol)?console.warn(`Token ${e.symbol.toString()} is already registered`):this.factoryRegistry.set(e.symbol,n),this}provideValue(e,n){return this.factoryRegistry.has(e.symbol)?console.warn(`Token ${e.symbol.toString()} is already registered`):this.factoryRegistry.set(e.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(e=>{const n=v.get(e,"dispose");v.isFunction(n)&&n.bind(e)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const bs="10.7.0",sc=Object.freeze(Object.defineProperty({__proto__:null,version:bs},Symbol.toStringTag,{value:"Module"}));class oc{constructor(e){N(this,"staticColors",new Map);N(this,"interpolations",new Map);e.installedPlugins.forEach(n=>{n.manifest.color.forEach(r=>{this.register(r)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(e){const n=this.encodeColor(e);e.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`),this.staticColors.set(n,e)):e.type==="interpolation"&&(this.interpolations.has(n)&&console.warn(`the interpolation '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`,`the interpolation '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`),this.interpolations.set(n,e))}decodeStaticColor(e){return this.staticColors.get(e)}encodeColor(e){return`\${${e.category}}.{${e.name}}`}decodeInterpolation(e){return this.interpolations.get(e)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class lc{constructor(){N(this,"plugins",new Map);N(this,"vizComponents",new Map);N(this,"factory",{viz:e=>{const n=this.vizComponents.get(e);if(n)return n;throw new Error(`Viz Component (${e}) not found`)}})}install(e){if(this.plugins.has(e.id))throw new Error(`Plugin (${e.id}) has been installed before`);this.plugins.set(e.id,e);for(const n of e.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}const W=(t,e)=>{const[n,{setFalse:r}]=X.useBoolean(!0),[a,o]=y.useState();y.useEffect(()=>(t.getItem(e).then(u=>{o(u),r()}),t.watchItem(e,u=>{o(u)})));const l=y.useCallback(async u=>{await t.setItem(e,u),o(u)},[t,e]);return{loading:n,value:a,set:l}},Cr={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function q(t){const[e,n]=t.split(".");return{queryID:e,columnKey:n}}function lt(t,e){var a;const{queryID:n,columnKey:r}=q(e);return n?r?((a=t[n])==null?void 0:a.map(o=>o[r]))??[]:t[n]:[]}function xn(t,e){const{queryID:n}=q(e);return n?t[n]:[]}function uc(t){return Object.values(t)[0]}function wn(t,e){const{queryID:n,columnKey:r}=q(e);return t[r]}le.use([G.GridComponent,G.VisualMapComponent,G.LegendComponent,G.TooltipComponent,Ve.CanvasRenderer]);function cc({context:t}){const{value:e}=W(t.instanceData,"config"),n=t.data,{width:r,height:a}=t.viewport,{x_axis_data_key:o,y_axis_data_key:l,z_axis_data_key:u,xAxis3D:c,yAxis3D:d,zAxis3D:f}=v.defaults({},e,Cr),p=y.useMemo(()=>xn(n,o),[n,o]),{x:g,y:m,z:C}=y.useMemo(()=>({x:q(o),y:q(l),z:q(u)}),[o,l,u]),{min:w,max:_}=y.useMemo(()=>{const I=v.minBy(p,B=>B[C.columnKey]),O=v.maxBy(p,B=>B[C.columnKey]);return{min:v.get(I,C.columnKey),max:v.get(O,C.columnKey)}},[p,C]),T={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:w,max:_,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:c,yAxis3D:d,zAxis3D:f,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:p.map(I=>[I[g.columnKey],I[m.columnKey],I[C.columnKey]])}]};return e?i(Ne,{echarts:le,option:T,style:{width:r,height:a},notMerge:!0,theme:"merico-light"}):null}const vs=y.createContext({panel:null,data:{},loading:!1,errors:[]}),Sr=vs.Provider;function ze(){const t=y.useContext(vs);if(!t.panel)throw new Error("Please use PanelContextProvider");return t}const dc={fullScreenPanelID:"",setFullScreenPanelID:v.noop},_r=y.createContext(dc);function xs(){const t=y.useContext(_r);if(!t)throw new Error("Please use FullScreenPanelContext.Provider");return t}const j=k.observer(y.forwardRef(({label:t,required:e,value:n,onChange:r,clearable:a=!1,sx:o,...l},u)=>{const{panel:c}=ze(),d=y.useMemo(()=>{const f=[...c.dataFieldOptions];return a&&f.unshift({label:"unset",value:"",group:""}),f},[c.dataFieldOptions]);return i(s.Select,{ref:u,label:t,data:d,value:n,onChange:r,required:e,sx:o,...l})}));function pc({context:t}){const{value:e,set:n}=W(t.instanceData,"config"),r=v.defaults({},e,Cr),{control:a,handleSubmit:o,reset:l}=x.useForm({defaultValues:r});return y.useEffect(()=>{l(r)},[e]),e?i(s.Stack,{spacing:"xs",children:h("form",{onSubmit:o(n),children:[i(s.Text,{children:"X Axis"}),h(s.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[i(x.Controller,{name:"x_axis_data_key",control:a,render:({field:u})=>i(j,{label:"Data Field",required:!0,...u})}),i(x.Controller,{name:"xAxis3D.name",control:a,render:({field:u})=>i(s.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...u})})]}),i(s.Text,{mt:"lg",children:"Y Axis"}),h(s.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[i(x.Controller,{name:"y_axis_data_key",control:a,render:({field:u})=>i(j,{label:"Data Field",required:!0,...u})}),i(x.Controller,{name:"yAxis3D.name",control:a,render:({field:u})=>i(s.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...u})})]}),i(s.Text,{mt:"lg",children:"Z Axis"}),h(s.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[i(x.Controller,{name:"z_axis_data_key",control:a,render:({field:u})=>i(j,{label:"Data Field",required:!0,...u})}),i(x.Controller,{name:"zAxis3D.name",control:a,render:({field:u})=>i(s.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...u})})]}),i(s.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:h(s.Button,{color:"blue",type:"submit",children:[i(D.DeviceFloppy,{size:20}),i(s.Text,{ml:"md",children:"Save"})]})})]})}):null}function hc(t,{panelModel:e}){try{const n=e.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const r=c=>c&&`${n}.${c}`,{x_axis_data_key:a,y_axis_data_key:o,z_axis_data_key:l,...u}=t;return{...u,x_axis_data_key:r(a),y_axis_data_key:r(o),z_axis_data_key:r(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class fc extends ve{constructor(){super(...arguments);N(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,r)=>{const{config:a}=n;return{...n,version:2,config:hc(a,r)}})}}const gc={displayName:"Bar Chart (3D)",displayGroup:"ECharts-based charts",migrator:new fc,name:"bar-3d",viewRender:cc,configRender:pc,createConfig(){return{version:2,config:v.cloneDeep(Cr)}}};class Fe extends y.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}render(){var e;if(this.state.error){const n=()=>{this.setState({error:null})};return h(s.Box,{children:[i(s.Text,{size:"xs",children:(e=this.state.error)==null?void 0:e.message}),i(s.Button,{variant:"subtle",size:"xs",mx:"auto",compact:!0,sx:{display:"block"},onClick:n,children:"Retry"})]})}return this.props.children}}const $e={mantissa:0,output:"number",trimMantissa:!1,average:!1};function mc({value:t,onChange:e},n){const r=u=>{e({...t,output:u})},a=u=>{const c=u===0?!1:t.trimMantissa;e({...t,mantissa:u,trimMantissa:c})},o=u=>{e({...t,trimMantissa:u.currentTarget.checked})},l=u=>{e({...t,average:u.currentTarget.checked})};return h(s.Stack,{ref:n,children:[h(s.Group,{grow:!0,children:[i(s.Select,{label:"Format",data:[{label:"1234",value:"number"},{label:"99%",value:"percent"}],value:t.output,onChange:r,sx:{flexGrow:1}}),i(s.Switch,{label:h(s.Stack,{spacing:0,children:[i(s.Text,{children:"Average"}),i(s.Text,{size:12,color:"gray",children:"like 1.234k, 1.234m"})]}),checked:t.average,onChange:l,disabled:t.output!=="number",sx:{flexGrow:1},styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"},label:{display:"block"}}})]}),h(s.Group,{grow:!0,children:[i(s.NumberInput,{label:"Mantissa",defaultValue:0,min:0,step:1,max:4,value:t.mantissa,onChange:a}),i(s.Switch,{label:"Trim mantissa",checked:t.trimMantissa,onChange:o,disabled:t.mantissa===0,styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"}}})]}),h(s.Stack,{spacing:0,children:[i(s.Text,{weight:"bold",children:"Preview"}),i(Fe,{children:h(s.Group,{position:"apart",children:[h(s.Text,{size:12,color:"gray",children:["123456789 ",i(D.ArrowRight,{size:9})," ",te(123456789).format(t)]}),h(s.Text,{size:12,color:"gray",children:["1234 ",i(D.ArrowRight,{size:9})," ",te(1234).format(t)]}),h(s.Text,{size:12,color:"gray",children:["0.1234 ",i(D.ArrowRight,{size:9})," ",te(.1234).format(t)]})]})})]})]})}const Je=y.forwardRef(mc),nt={enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
119
+ `),vr={columns:[],fontSize:"14px",highlightOnHover:!0,horizontalSpacing:"14px",id_field:"",striped:!0,use_raw_columns:!0,verticalSpacing:"14px"};class Lt{constructor(e,n){this.root=e,this.path=n}async deleteItem(e){e===null&&await this.root.deleteItem(this.path);const n=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,v.omit(n,e))}async getItem(e){const n=await this.root.getItem(this.path);return e===null?n:v.get(n,e)}async setItem(e,n){if(e===null)await this.root.setItem(this.path,n);else{const r=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,{...r,[e]:n})}return await this.getItem(e)}watchItem(e,n,r){return e===null?this.root.watchItem(this.path,(a,o)=>{n(a,o)},r):this.root.watchItem(this.path,(a,o)=>{const l=v.get(a,e),u=v.get(o,e);l!==u&&n(l,u)},r)}}class xr{constructor(e,n,r){N(this,"attachmentStorage");this.instance=e,this.attachmentKey=n,this.constructInstance=r,this.attachmentStorage=new Lt(e.instanceData,n)}async getInstance(e){if(await this.attachmentStorage.getItem(e))return this.constructInstance(new Lt(this.attachmentStorage,e))}async create(e,n){return await this.attachmentStorage.setItem(e,n),this.constructInstance(new Lt(this.attachmentStorage,e))}async remove(e){await this.attachmentStorage.deleteItem(e)}async list(){const e=await this.attachmentStorage.getItem(null);return Promise.all(v.values(e).map(n=>this.constructInstance(new Lt(this.attachmentStorage,n.id))))}}class gs{constructor(e){N(this,"rootRef");this.rootRef=ie.observable({current:e})}async deleteItem(e){ie.runInAction(()=>{v.unset(this.rootRef.current,[e])})}getItem(e){const n=this.getValueFromRoot(e);return Promise.resolve(n)}getValueFromRoot(e){return e===null?ie.toJS(this.rootRef.current):v.get(this.rootRef.current,[e])}setItem(e,n){if(e===null)if(v.isObject(n))ie.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else ie.runInAction(()=>{v.set(this.rootRef.current,[e],n)});return Promise.resolve(this.getItem(e))}watchItem(e,n,r){return ie.reaction(()=>this.getValueFromRoot(e),(a,o)=>{n(a,o)},{requiresObservable:!0,fireImmediately:v.get(r,"fireImmediately",!1)})}}class Uu{constructor(){N(this,"channels",new Map);N(this,"globalChannel",new _a)}getChannel(e){const n=this.channels.get(e);if(n)return n;const r=new _a;return this.channels.set(e,r),r}}class Xu{constructor(e){N(this,"instances",new Map);this.pluginManager=e}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(e=>e.manifest.viz)}resolveComponent(e){return this.pluginManager.factory.viz(e)}getOrCreateInstance(e){const n=this.instances.get(e.id);if(n)return n;const r={id:e.id,name:e.viz.type,type:e.viz.type,messageChannels:new Uu,instanceData:new gs(e.viz.conf)};return this.instances.set(e.id,r),r}}function ms(t,e,n,r){return{vizManager:n,locale:"zh",msgChannels:t.messageChannels,instanceData:t.instanceData,pluginData:new gs({}),colorPalette:{getColor(){return()=>""}},data:e,variables:r}}const Ju=t=>{const{panel:e,vizManager:n,data:r,variables:a}=t,o=n.resolveComponent(e.viz.type),l=n.getOrCreateInstance(e),u={...ms(l,r,n,a),viewport:{width:e.layout.w,height:e.layout.h}},c=o.viewRender;return i(c,{context:u,instance:l,...v.omit(t,["panel","vizManager","data"])})},Zu=t=>{const{vizManager:e,panel:n,panelInfoEditor:r,data:a,variables:o}=t,l=e.resolveComponent(n.viz.type),u=e.getOrCreateInstance(n),c={...ms(u,a,e,o),panelInfoEditor:r},d=l.configRender;return i(d,{context:c,instance:u,...v.omit(t,["panel","vizManager","data","panelInfoEditor"])})},ys=(t,e)=>{const n=st.bezier(t),r=st.bezier(e);return function(a){return a<50?n(a*2/100).hex():r((a-50)*2/100).hex()}},vn=t=>{const e=st.bezier(t);return function(n){return e(n/100).hex()}},Hu={type:"interpolation",displayName:"Red / Green",getColor:ys(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},ec={type:"interpolation",displayName:"Yellow / Blue",getColor:ys(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},tc={type:"interpolation",displayName:"Red",getColor:vn(["#fff7f1","darkred"]),name:"red",category:"sequential"},nc={type:"interpolation",displayName:"Green",getColor:vn(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},rc={type:"interpolation",displayName:"Blue",getColor:vn(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},ic={type:"interpolation",displayName:"Orange",getColor:vn(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class ac{constructor(e){N(this,"symbol");this.symbol=Symbol(e)}}function ot(t){return new ac(t)}class wr{constructor(){N(this,"parent");N(this,"factoryRegistry",new Map);N(this,"instanceRegistry",new Map)}createScoped(){const e=new wr;return e.parent=this,e}getRequired(e){return this.get(e)}get(e){if(this.instanceRegistry.has(e.symbol))return this.instanceRegistry.get(e.symbol);const n=this.factoryRegistry.get(e.symbol);if(n){const r=n(this);return this.instanceRegistry.set(e.symbol,r),r}if(this.parent)return this.parent.get(e)}provideFactory(e,n){return this.factoryRegistry.has(e.symbol)?console.warn(`Token ${e.symbol.toString()} is already registered`):this.factoryRegistry.set(e.symbol,n),this}provideValue(e,n){return this.factoryRegistry.has(e.symbol)?console.warn(`Token ${e.symbol.toString()} is already registered`):this.factoryRegistry.set(e.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(e=>{const n=v.get(e,"dispose");v.isFunction(n)&&n.bind(e)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const bs="10.8.0",sc=Object.freeze(Object.defineProperty({__proto__:null,version:bs},Symbol.toStringTag,{value:"Module"}));class oc{constructor(e){N(this,"staticColors",new Map);N(this,"interpolations",new Map);e.installedPlugins.forEach(n=>{n.manifest.color.forEach(r=>{this.register(r)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(e){const n=this.encodeColor(e);e.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`),this.staticColors.set(n,e)):e.type==="interpolation"&&(this.interpolations.has(n)&&console.warn(`the interpolation '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`,`the interpolation '${e.name}' has been registered under '${e.category}', previous registered value will be overridden`),this.interpolations.set(n,e))}decodeStaticColor(e){return this.staticColors.get(e)}encodeColor(e){return`\${${e.category}}.{${e.name}}`}decodeInterpolation(e){return this.interpolations.get(e)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class lc{constructor(){N(this,"plugins",new Map);N(this,"vizComponents",new Map);N(this,"factory",{viz:e=>{const n=this.vizComponents.get(e);if(n)return n;throw new Error(`Viz Component (${e}) not found`)}})}install(e){if(this.plugins.has(e.id))throw new Error(`Plugin (${e.id}) has been installed before`);this.plugins.set(e.id,e);for(const n of e.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}const W=(t,e)=>{const[n,{setFalse:r}]=X.useBoolean(!0),[a,o]=y.useState();y.useEffect(()=>(t.getItem(e).then(u=>{o(u),r()}),t.watchItem(e,u=>{o(u)})));const l=y.useCallback(async u=>{await t.setItem(e,u),o(u)},[t,e]);return{loading:n,value:a,set:l}},Cr={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function q(t){const[e,n]=t.split(".");return{queryID:e,columnKey:n}}function lt(t,e){var a;const{queryID:n,columnKey:r}=q(e);return n?r?((a=t[n])==null?void 0:a.map(o=>o[r]))??[]:t[n]:[]}function xn(t,e){const{queryID:n}=q(e);return n?t[n]:[]}function uc(t){return Object.values(t)[0]}function wn(t,e){const{queryID:n,columnKey:r}=q(e);return t[r]}le.use([G.GridComponent,G.VisualMapComponent,G.LegendComponent,G.TooltipComponent,Ve.CanvasRenderer]);function cc({context:t}){const{value:e}=W(t.instanceData,"config"),n=t.data,{width:r,height:a}=t.viewport,{x_axis_data_key:o,y_axis_data_key:l,z_axis_data_key:u,xAxis3D:c,yAxis3D:d,zAxis3D:f}=v.defaults({},e,Cr),p=y.useMemo(()=>xn(n,o),[n,o]),{x:g,y:m,z:C}=y.useMemo(()=>({x:q(o),y:q(l),z:q(u)}),[o,l,u]),{min:w,max:_}=y.useMemo(()=>{const I=v.minBy(p,B=>B[C.columnKey]),O=v.maxBy(p,B=>B[C.columnKey]);return{min:v.get(I,C.columnKey),max:v.get(O,C.columnKey)}},[p,C]),T={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:w,max:_,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:c,yAxis3D:d,zAxis3D:f,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:p.map(I=>[I[g.columnKey],I[m.columnKey],I[C.columnKey]])}]};return e?i(Ne,{echarts:le,option:T,style:{width:r,height:a},notMerge:!0,theme:"merico-light"}):null}const vs=y.createContext({panel:null,data:{},loading:!1,errors:[]}),Sr=vs.Provider;function ze(){const t=y.useContext(vs);if(!t.panel)throw new Error("Please use PanelContextProvider");return t}const dc={fullScreenPanelID:"",setFullScreenPanelID:v.noop},_r=y.createContext(dc);function xs(){const t=y.useContext(_r);if(!t)throw new Error("Please use FullScreenPanelContext.Provider");return t}const j=k.observer(y.forwardRef(({label:t,required:e,value:n,onChange:r,clearable:a=!1,sx:o,...l},u)=>{const{panel:c}=ze(),d=y.useMemo(()=>{const f=[...c.dataFieldOptions];return a&&f.unshift({label:"unset",value:"",group:""}),f},[c.dataFieldOptions]);return i(s.Select,{ref:u,label:t,data:d,value:n,onChange:r,required:e,sx:o,...l})}));function pc({context:t}){const{value:e,set:n}=W(t.instanceData,"config"),r=v.defaults({},e,Cr),{control:a,handleSubmit:o,reset:l}=x.useForm({defaultValues:r});return y.useEffect(()=>{l(r)},[e]),e?i(s.Stack,{spacing:"xs",children:h("form",{onSubmit:o(n),children:[i(s.Text,{children:"X Axis"}),h(s.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[i(x.Controller,{name:"x_axis_data_key",control:a,render:({field:u})=>i(j,{label:"Data Field",required:!0,...u})}),i(x.Controller,{name:"xAxis3D.name",control:a,render:({field:u})=>i(s.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...u})})]}),i(s.Text,{mt:"lg",children:"Y Axis"}),h(s.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[i(x.Controller,{name:"y_axis_data_key",control:a,render:({field:u})=>i(j,{label:"Data Field",required:!0,...u})}),i(x.Controller,{name:"yAxis3D.name",control:a,render:({field:u})=>i(s.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...u})})]}),i(s.Text,{mt:"lg",children:"Z Axis"}),h(s.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[i(x.Controller,{name:"z_axis_data_key",control:a,render:({field:u})=>i(j,{label:"Data Field",required:!0,...u})}),i(x.Controller,{name:"zAxis3D.name",control:a,render:({field:u})=>i(s.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...u})})]}),i(s.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:h(s.Button,{color:"blue",type:"submit",children:[i(D.DeviceFloppy,{size:20}),i(s.Text,{ml:"md",children:"Save"})]})})]})}):null}function hc(t,{panelModel:e}){try{const n=e.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const r=c=>c&&`${n}.${c}`,{x_axis_data_key:a,y_axis_data_key:o,z_axis_data_key:l,...u}=t;return{...u,x_axis_data_key:r(a),y_axis_data_key:r(o),z_axis_data_key:r(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class fc extends ve{constructor(){super(...arguments);N(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,r)=>{const{config:a}=n;return{...n,version:2,config:hc(a,r)}})}}const gc={displayName:"Bar Chart (3D)",displayGroup:"ECharts-based charts",migrator:new fc,name:"bar-3d",viewRender:cc,configRender:pc,createConfig(){return{version:2,config:v.cloneDeep(Cr)}}};class Fe extends y.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}render(){var e;if(this.state.error){const n=()=>{this.setState({error:null})};return h(s.Box,{children:[i(s.Text,{size:"xs",children:(e=this.state.error)==null?void 0:e.message}),i(s.Button,{variant:"subtle",size:"xs",mx:"auto",compact:!0,sx:{display:"block"},onClick:n,children:"Retry"})]})}return this.props.children}}const $e={mantissa:0,output:"number",trimMantissa:!1,average:!1};function mc({value:t,onChange:e},n){const r=u=>{e({...t,output:u})},a=u=>{const c=u===0?!1:t.trimMantissa;e({...t,mantissa:u,trimMantissa:c})},o=u=>{e({...t,trimMantissa:u.currentTarget.checked})},l=u=>{e({...t,average:u.currentTarget.checked})};return h(s.Stack,{ref:n,children:[h(s.Group,{grow:!0,children:[i(s.Select,{label:"Format",data:[{label:"1234",value:"number"},{label:"99%",value:"percent"}],value:t.output,onChange:r,sx:{flexGrow:1}}),i(s.Switch,{label:h(s.Stack,{spacing:0,children:[i(s.Text,{children:"Average"}),i(s.Text,{size:12,color:"gray",children:"like 1.234k, 1.234m"})]}),checked:t.average,onChange:l,disabled:t.output!=="number",sx:{flexGrow:1},styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"},label:{display:"block"}}})]}),h(s.Group,{grow:!0,children:[i(s.NumberInput,{label:"Mantissa",defaultValue:0,min:0,step:1,max:4,value:t.mantissa,onChange:a}),i(s.Switch,{label:"Trim mantissa",checked:t.trimMantissa,onChange:o,disabled:t.mantissa===0,styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"}}})]}),h(s.Stack,{spacing:0,children:[i(s.Text,{weight:"bold",children:"Preview"}),i(Fe,{children:h(s.Group,{position:"apart",children:[h(s.Text,{size:12,color:"gray",children:["123456789 ",i(D.ArrowRight,{size:9})," ",te(123456789).format(t)]}),h(s.Text,{size:12,color:"gray",children:["1234 ",i(D.ArrowRight,{size:9})," ",te(1234).format(t)]}),h(s.Text,{size:12,color:"gray",children:["0.1234 ",i(D.ArrowRight,{size:9})," ",te(.1234).format(t)]})]})})]})]})}const Je=y.forwardRef(mc),nt={enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
120
120
  `)},ws={id:"builtin:echarts:click-echart:series",displayName:"Click Chart Series",nameRender:bc,configRender:yc,payload:[{name:"type",description:"Always 'click'",valueType:"string"},{name:"seriesType",description:"'boxplot'",valueType:"string"},{name:"name",description:"Name of the series clicked",valueType:"string"},{name:"color",description:"Color",valueType:"string"},{name:"value",description:"Record of 'name', 'min', 'q1', 'median', 'q3', 'max'",valueType:"object"},{name:"rowData",description:"Data of the row",valueType:"object"}]};function yc(t){return i(V,{})}function bc(t){return i(s.Text,{children:"Click chart's series"})}const vc=[{label:"Truncate",value:"truncate"},{label:"Break Line",value:"break"},{label:"Break Word",value:"breakAll"}],Cn=y.forwardRef(({sectionTitle:t,value:e,onChange:n},r)=>{const a=o=>l=>{const u=v.cloneDeep(e);v.set(u,o,l),n(u)};return h(s.Stack,{spacing:0,children:[t&&i(s.Divider,{mb:-5,mt:5,variant:"dotted",label:t,labelPosition:"right",labelProps:{color:"dimmed"}}),h(s.Group,{grow:!0,noWrap:!0,children:[i(s.NumberInput,{label:"Max Width",hideControls:!0,value:e.width,onChange:a("width")}),i(s.Select,{label:"Overflow",data:vc,value:e.overflow,onChange:a("overflow")}),i(s.TextInput,{label:"Ellipsis",value:e.ellipsis,disabled:!0})]})]})}),gt=y.forwardRef(({value:t,onChange:e},n)=>{const r=o=>{e({...t,on_axis:o})},a=o=>{e({...t,in_tooltip:o})};return h(s.Stack,{ref:n,spacing:0,children:[i(Cn,{sectionTitle:"Overflow on Axis",value:t.on_axis,onChange:r}),i(Cn,{sectionTitle:"Overflow in Tooltip",value:t.in_tooltip,onChange:a})]})}),Ze={on_axis:{width:80,overflow:"truncate",ellipsis:"..."},in_tooltip:{width:200,overflow:"break",ellipsis:"..."}};function mt({overflow:t,width:e}){const n={truncate:"initial",break:"break-all",breakAll:"break-word"}[t],r=t==="truncate"?"nowrap":"initial",a={truncate:"ellipsis",break:"clip",breakAll:"clip"}[t];return`
121
121
  max-width: ${e}px;
122
122
  word-break: ${n};
@@ -510,4 +510,4 @@ WHERE
510
510
  `),post:["function process_result(res, utils) {"," // your code goes here"," return data","}"].join(`
511
511
  `)},g_=k.observer(({queryModel:t})=>t.typedAsHTTP?h(s.Tabs,{defaultValue:"pre_process",orientation:"vertical",sx:{flexGrow:1},children:[h(s.Tabs.List,{children:[i(s.Tabs.Tab,{value:"pre_process",children:"Build Request"}),i(s.Tabs.Tab,{value:"post_process",children:"Process Result"}),i(Li,{})]}),i(s.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:i(ar,{label:"",value:t.pre_process,onChange:t.setPreProcess,defaultValue:zl.pre})}),i(s.Tabs.Panel,{value:"post_process",p:"sm",children:i(ar,{label:"",value:t.post_process,onChange:t.setPostProcess,defaultValue:zl.post})})]}):null),m_=k.observer(({queryID:t,usage:e})=>{const n=he().editor,r=o=>{if(o.type==="filter"){n.setPath(["_FILTERS_",o.id]);return}if(o.type==="panel"){const l=o.views[0].id;n.setPath(["_VIEWS_",l,"_PANELS_",o.id]);return}},a=o=>{n.setPath(["_VIEWS_",o])};return i(s.Stack,{py:"sm",px:"md",children:h(s.Table,{highlightOnHover:!0,sx:{tableLayout:"fixed"},children:[i("thead",{children:h("tr",{children:[i("th",{style:{width:100},children:"Type"}),i("th",{style:{width:"calc(50% - 50px)"},children:"Name"}),i("th",{children:"In View(s)"})]})}),i("tbody",{children:e.map(o=>h("tr",{children:[i("td",{children:v.capitalize(o.type)}),i("td",{children:i(s.Anchor,{component:"button",type:"button",onClick:()=>r(o),children:o.label})}),i("td",{children:h(s.Stack,{align:"flex-start",justify:"flex-start",spacing:2,children:[o.views.map(l=>i(s.Anchor,{component:"button",type:"button",onClick:()=>a(l.id),children:i(s.Box,{children:l.label})})),o.views.length===0&&i(s.Box,{children:"--"})]})})]},o.id))})]})})}),Oi=({value:t,onChange:e,height:n="200px",defaultLanguage:r="sql",theme:a="vs-dark"})=>{const o=u=>{console.log("changing"),e==null||e(u??"")},l=!e;return i(Ie,{className:"minimal-monaco-editor",height:n,defaultLanguage:r,value:t,onChange:l?void 0:o,theme:a,options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1},readOnly:l||!e,"semanticHighlighting.enabled":!0}})},y_=({value:t,height:e="200px",defaultLanguage:n="sql"})=>i(Ie,{className:"preview-sql-in-monaco-editor",height:e,defaultLanguage:n,value:t,onChange:void 0,theme:"vs-light",options:{lineNumbers:"on",folding:!0,lineDecorationsWidth:20,wordWrap:"on",minimap:{enabled:!1},readOnly:!0}}),b_=k.observer(({value:t})=>{const n=K().payloadForSQL,r=y.useMemo(()=>hr(t,n),[t,n]);return i(y_,{height:"100%",value:r})}),$l={pre:["function process_request({ context, filters, sql }, utils) {"," // modify and return sql"," return sql","}"].join(`
512
512
  `),post:["function process_result(data, utils) {"," // process data and return the result"," return data","}"].join(`
513
- `)},v_=k.observer(({queryModel:t})=>{const[e,n]=y.useState(t.sql);y.useEffect(()=>{n(o=>o!==t.sql?t.sql:o)},[t.sql]);const r=e!==t.sql,a=()=>{t.setSQL(e)};return t.typedAsSQL?h(s.Tabs,{defaultValue:"Edit",orientation:"vertical",sx:{flexGrow:1},styles:{tabLabel:{width:"100%",height:"28px",lineHeight:"28px"}},keepMounted:!1,children:[h(s.Tabs.List,{children:[i(s.Tabs.Tab,{value:"Edit",children:h(s.Group,{spacing:14,position:"apart",children:["Edit SQL",i(s.ActionIcon,{mr:5,variant:"filled",color:"blue",disabled:!r,onClick:a,children:i(D.DeviceFloppy,{size:20})})]})}),i(s.Tabs.Tab,{value:"Preview",children:"Preview SQL"}),i(s.Tabs.Tab,{value:"pre_process",children:"Process Request"}),i(s.Tabs.Tab,{value:"post_process",children:"Process Result"}),i(Li,{}),t.datasource&&i(El,{dataSource:t.datasource})]}),i(s.Tabs.Panel,{value:"Edit",sx:{position:"relative"},p:"sm",children:i(Oi,{height:"100%",value:e,onChange:n,theme:"sql-dark",defaultLanguage:"sql"})}),i(s.Tabs.Panel,{value:"Preview",p:0,pl:4,children:i(b_,{value:t.sql})}),i(s.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:i(ar,{label:"",value:t.pre_process,onChange:t.setPreProcess,defaultValue:$l.pre})}),i(s.Tabs.Panel,{value:"post_process",p:"sm",children:i(ar,{label:"",value:t.post_process,onChange:t.setPostProcess,defaultValue:$l.post})})]}):null}),sr={height:"calc(100% - 44px)",padding:0},x_=k.observer(({queryModel:t})=>{const e=K(),n=y.useMemo(()=>t.datasource?t.typedAsHTTP?"HTTP":"SQL":"Configurations",[t.datasource,t.typedAsHTTP]),[r,a]=y.useState(n);y.useEffect(()=>{a(u=>u!=="Configurations"&&n==="Configurations"?"Configurations":u)},[n]);const o=e.findQueryUsage(t.id),l=o.length===0;return i(s.Stack,{sx:{flexGrow:1},my:0,p:0,children:h(s.Tabs,{value:r,onTabChange:a,defaultValue:n,orientation:"horizontal",keepMounted:!1,sx:{flexGrow:1},children:[h(s.Tabs.List,{grow:!0,children:[i(s.Tabs.Tab,{value:"Configurations",children:"Configurations"}),t.typedAsSQL&&i(s.Tabs.Tab,{value:"SQL",children:"Request"}),t.typedAsHTTP&&i(s.Tabs.Tab,{value:"HTTP",children:"Request"}),i(s.Tabs.Tab,{value:"Data",disabled:!t.datasource,children:i(s.Tooltip,{label:"Need to pick a Data Source first",disabled:t.datasource,withinPortal:!0,children:i(s.Text,{children:"Data"})})}),i(s.Tabs.Tab,{value:"Usage",disabled:l,children:i(s.Tooltip,{label:"This query is not used for any filter or panel",disabled:!l,withinPortal:!0,children:i(s.Text,{children:"Usage"})})})]}),i(s.Tabs.Panel,{value:"Configurations",pt:0,p:0,children:i(u_,{queryModel:t})}),t.typedAsSQL&&i(s.Tabs.Panel,{value:"SQL",sx:sr,children:i(s.Stack,{sx:{height:"100%"},children:i(v_,{queryModel:t})})}),t.typedAsHTTP&&i(s.Tabs.Panel,{value:"HTTP",sx:sr,children:i(s.Stack,{sx:{height:"100%"},children:i(g_,{queryModel:t})})}),i(s.Tabs.Panel,{value:"Data",sx:{...sr,overflow:"hidden"},children:i(zi,{id:t.id})}),i(s.Tabs.Panel,{value:"Usage",sx:{...sr,overflow:"hidden"},children:i(m_,{queryID:t.id,usage:o})})]})})}),w_=k.observer(({id:t})=>{const n=K().queries.findByID(t);return t===""?null:n?i(s.Stack,{sx:{height:"100%"},spacing:"sm",children:i(x_,{queryModel:n})}):i(s.Text,{size:14,color:"red",children:"Invalid Query ID"})}),C_=k.observer(({value:t})=>{const n=K().payloadForSQL,r=y.useMemo(()=>hr(t,n),[t,n]);return i(Oi,{height:"100%",value:r})}),S_=k.observer(({item:t,remove:e,onKeyChanged:n})=>{const[r,a]=y.useState("SQL"),[o,l]=y.useState(t.key),u=()=>{t.setKey(o),n(o)},c=o!==t.key,d=t.isADuplicatedKey(o),[f,p]=y.useState(t.value),g=()=>{t.setValue(f)};y.useEffect(()=>{l(t.key),p(t.value)},[t]);const m=f!==t.value,C=Ke.useModals(),w=()=>{C.openConfirmModal({title:"Delete this SQL snippet?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:e,confirmProps:{color:"red"},zIndex:320})};return h(s.Stack,{p:20,sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",children:[h(s.Group,{sx:{alignItems:"end"},spacing:40,children:[i(s.TextInput,{label:d?"This key is occupied by another snippet":"Key",value:o,onChange:_=>{l(_.currentTarget.value)},sx:{flexGrow:"1 !important"},rightSection:i(s.ActionIcon,{color:"blue",variant:"subtle",onClick:u,disabled:!c||d,children:i(D.DeviceFloppy,{size:16})}),error:d}),i(s.Button,{leftIcon:i(D.Trash,{size:16}),color:"red",variant:"light",onClick:w,children:"Delete this SQL Snippet"})]}),h(s.Tabs,{value:r,onTabChange:a,sx:{flexGrow:1},styles:{panel:{height:"calc(100% - 50px)"}},children:[h(s.Tabs.List,{sx:{position:"relative"},children:[i(s.Tabs.Tab,{value:"SQL",children:"SQL"}),i(s.Tabs.Tab,{value:"Preview",children:"Preview"}),i(Li,{}),i(s.ActionIcon,{color:"blue",variant:"filled",onClick:g,disabled:!m,sx:{position:"absolute",top:0,right:10},children:i(D.DeviceFloppy,{size:18})})]}),i(s.Tabs.Panel,{value:"SQL",pt:"sm",children:i(Oi,{height:"100%",value:f,onChange:p,defaultLanguage:"sql",theme:"sql-dark"})}),i(s.Tabs.Panel,{value:"Preview",pt:"sm",children:i(C_,{value:f})})]})]})}),__=k.observer(({id:t})=>{const e=he(),n=K(),r=y.useMemo(()=>n.sqlSnippets.findByKey(t),[t]);if(!t)return null;if(!r)return h(s.Text,{size:14,children:["SQL Snippet by key[",t,"] is not found"]});const a=()=>{e.editor.setPath(["_SQL_SNIPPETS_",""])};return i(S_,{item:r,remove:()=>{n.sqlSnippets.removeByKey(t),a()},onKeyChanged:u=>{e.editor.setPath(["_SQL_SNIPPETS_",u])}})}),k_=k.observer(({view:t})=>!t||t.type!==H.Division?null:h(s.Stack,{children:[i(s.Divider,{mt:8,mb:0,label:"Division settings",labelPosition:"center"}),i(s.Text,{align:"center",size:"xs",color:"dimmed",children:"Under construction"})]})),T_=[{value:"default",label:"Default"},{value:"outline",label:"Outline"},{value:"pills",label:"Pills"}],D_=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical"}],M_=k.observer(({view:t})=>{if(!t||t.type!==H.Tabs)return null;const e=t.config;return h(s.Stack,{children:[i(s.Divider,{mt:8,mb:0,label:"Tabs settings",labelPosition:"center"}),i(s.Select,{label:"Variant",value:e.variant,onChange:e.setVariant,data:T_}),i(s.Select,{label:"Orientation",value:e.orientation,onChange:e.setOrientation,data:D_}),i(s.Switch,{label:"Grow Tabs",checked:e.grow,onChange:n=>e.setGrow(n.currentTarget.checked)})]})}),I_=({disabled:t,value:e,onChange:n})=>{const r=a=>{a&&n(a)};return h(s.Box,{sx:{position:"relative"},children:[t&&i(s.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),i(Ie,{height:"500px",defaultLanguage:"javascript",value:e,onChange:r,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:t}})]})},E_=({value:t,onChange:e})=>{const[n,{setTrue:r,setFalse:a}]=X.useBoolean(),[o,l]=y.useState(t??Ci),u=g=>{l({...o,enabled:g})},c=()=>{a();const{enabled:g,func_content:m}=o,C={enabled:g,func_content:m};l(C),e(C)},d=()=>{a(),l(t)},f=g=>{l(m=>({...m,func_content:g}))},p=()=>{f(Ci.func_content)};return h(V,{children:[i(s.ActionIcon,{size:"lg",color:"blue",variant:"filled",mt:26,onClick:r,sx:{flexGrow:0},children:i(D.Settings,{size:14})}),i(s.Modal,{size:800,title:"Customize modal title",opened:n,onClose:a,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:n&&h(s.Stack,{children:[i(s.Checkbox,{mt:10,label:"Enabled",checked:o.enabled,onChange:g=>u(g.currentTarget.checked)}),i(I_,{value:o.func_content,onChange:f,disabled:!o.enabled}),h(s.Group,{position:"apart",children:[i(s.Button,{onClick:p,color:"red",leftIcon:i(D.Recycle,{size:20}),children:"Rest"}),h(s.Group,{position:"right",children:[i(s.Button,{onClick:d,variant:"subtle",children:"Cancel"}),i(s.Button,{onClick:c,children:"OK"})]})]})]})})]})},A_=k.observer(({view:t})=>{if(!t||t.type!==H.Modal)return null;const e=t.config,n=e.custom_modal_title.value;return h(s.Stack,{children:[i(s.Divider,{mt:8,label:"Modal settings",labelPosition:"center"}),h(s.Flex,{gap:10,children:[i(s.TextInput,{label:"Modal Title",value:n,onChange:v.noop,disabled:!0,sx:{flexGrow:1}}),i(E_,{value:e.custom_modal_title,onChange:e.custom_modal_title.replace})]}),h(s.Group,{grow:!0,children:[i(s.TextInput,{label:"Width",value:e.width,onChange:r=>e.setWidth(r.currentTarget.value),placeholder:"600px / 50vw"}),i(s.TextInput,{label:"Height",value:e.height,onChange:r=>e.setHeight(r.currentTarget.value),placeholder:"600px / 50vw"})]})]})}),z_=k.observer(({view:t})=>h(V,{children:[i(k_,{view:t}),i(A_,{view:t}),i(M_,{view:t})]})),$_=[{label:"Division",value:H.Division},{label:"Modal",value:H.Modal},{label:"Tabs",value:H.Tabs}],L_=k.observer(({view:t})=>t?h(s.Stack,{sx:{position:"relative"},children:[i(s.TextInput,{label:"Name",value:t.name,onChange:e=>{t.setName(e.currentTarget.value)}}),i(s.Select,{label:"Type",withinPortal:!0,value:t.type,onChange:t.setType,data:$_}),i(z_,{view:t})]}):null),O_=k.observer(({id:t})=>{const e=Ke.useModals(),n=he(),r=K();if(t==="")return null;const a=r.views.findByID(t);if(!a)return h(s.Text,{size:14,children:["View by ID[",t,"] is not found"]});const o=()=>{n.editor.setPath(["_VIEWS_",""])},l=()=>{e.openConfirmModal({title:"Delete this view?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>{r.views.removeByID(t),o()},zIndex:320})};return h(s.Stack,{sx:{maxWidth:"600px",height:"100%"},spacing:"sm",children:[i(s.Group,{position:"right",pt:10,children:i(s.Button,{size:"xs",color:"red",leftIcon:i(D.Trash,{size:16}),onClick:l,children:"Delete this view"})}),i(s.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:i(L_,{view:a})})]})});function P_(t){return t.length===1&&t[0]==="_QUERY_VARS_"}function B_(t){return t.length===1&&t[0]==="_MOCK_CONTEXT_"}function V_(t){return t.length===2&&t[0]==="_FILTERS_"}function N_(t){return t.length===2&&t[0]==="_SQL_SNIPPETS_"}function q_(t){return t.length===2&&t[0]==="_QUERIES_"}function F_(t){return t.length===2&&t[0]==="_VIEWS_"}function G_(t){return t.length===4&&t[0]==="_VIEWS_"&&t[2]==="_PANELS_"}const W_=k.observer(()=>i(s.Stack,{sx:{height:"100%"},p:"sm",children:i(Al,{})})),j_=k.observer(()=>{const t=he().editor,e=t.path;return P_(e)?i(W_,{}):B_(e)?i(hS,{}):V_(e)?i(s.Box,{p:"xs",pl:20,children:i(pS,{id:e[1]})}):N_(e)?i(__,{id:e[1]}):q_(e)?i(w_,{id:e[1]}):F_(e)?i(s.Box,{p:"xs",pl:20,children:i(O_,{id:e[1]})}):G_(e)?i(GS,{viewID:e[1],panelID:e[3]}):i(s.Box,{children:t.path})}),R_=k.observer(()=>i(j_,{})),Y_=k.observer(()=>{const t=he(),e=()=>{const n=new Date().getTime().toString(),r={id:n,key:n,label:n,order:t.content.filters.current.length+1,type:wi.TextInput,config:ts(),visibleInViewsIDs:["Main"],auto_submit:!1};t.content.filters.append(r),t.editor.setPath(["_FILTERS_",n])};return i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Filter"})}),Q_=k.observer(({parentID:t})=>{const e=K();if(!t)return null;const n=e.views.findByID(t);return n?i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:()=>e.addANewPanel(n.id),sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Panel"}):null}),K_=k.observer(()=>{const t=he(),e=()=>{const n=new Date().getTime().toString(),r={id:n,name:n,type:me.Postgresql,key:"",sql:""};t.content.queries.append(r),t.editor.setPath(["_QUERIES_",n])};return i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Query"})}),U_=k.observer(()=>{const t=he(),e=()=>{const n=new Date().getTime().toString(),r={key:n,value:""};t.content.sqlSnippets.append(r),t.editor.setPath(["_SQL_SNIPPETS_",n])};return i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a SQL Snippet"})}),X_=k.observer(()=>{const t=K();return i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a View"})}),J_=k.observer(({action_type:t,parentID:e})=>(K(),t==="_Add_A_Filter_"?i(Y_,{}):t==="_Add_A_SQL_SNIPPET_"?i(U_,{}):t==="_Add_A_QUERY_"?i(K_,{}):t==="_Add_A_VIEW_"?i(X_,{}):t==="_Add_A_PANEL_"?i(Q_,{parentID:e}):null)),Ll=k.observer(({option:t})=>{var d;const e=he().editor,n=e.isOptionActive,r=n(e.path,t),a=e.isOptionOpened,o=e.navigate,l=a(t),[u,c]=y.useState(l);return y.useEffect(()=>{c(l)},[l]),i(s.NavLink,{active:r,defaultOpened:l,opened:u,onChange:c,label:t.label,onClick:()=>o(t),icon:t.Icon?i(t.Icon,{size:18}):null,children:(d=t.children)==null?void 0:d.map(f=>f._type==="ACTION"?i(J_,{action_type:f._action_type,parentID:f.parentID},`_ADD_${f.value}_`):i(Ll,{option:f},f.value))},t.label)}),Z_=k.observer(()=>{const t=he();return i(s.Box,{sx:{position:"relative"},children:t.editor.navOptions.map(e=>i(Ll,{option:e},e.value))})}),H_=k.observer(()=>{const t=he();return h(s.Navbar,{p:0,width:{base:200,xs:200,sm:220,md:240,lg:280,xl:300},sx:{height:"100vh - 60px - 60px"},children:[i(s.Navbar.Section,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:i(s.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:"Settings"})}),i(s.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:i(Z_,{})}),i(s.Navbar.Section,{children:i(s.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:i(s.Button,{size:"xs",color:"red",leftIcon:i(L.IconX,{size:18}),onClick:()=>t.editor.close(),children:"Close"})})})]})}),ek={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1,nav:{top:0,height:"100vh"}},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:0,height:"100vh"}},tk=k.observer(()=>{const t=he().editor;return i(s.Modal,{onClose:()=>t.setSettingsOpen(!1),closeOnEscape:!1,closeOnClickOutside:!1,opened:t.settings_open,fullScreen:!0,title:null,transitionProps:{duration:0},withCloseButton:!1,withinPortal:!0,zIndex:300,styles:{body:{padding:"0 !important"}},children:i(s.AppShell,{padding:0,navbar:i(H_,{}),styles:ek,children:i(R_,{})})})}),nk=t=>t.replace(/([^:])(\/\/+)/g,"$1/");function rk(t){y.useEffect(()=>{if(Ie.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/dashboard");const n=nk(t);Ie.loader.config({paths:{vs:n}}),Ie.loader.init().then(r=>console.log("monaco instance:",r))},[])}Bs();const ik={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:60+30,height:"100vh"}},ak=({context:t,dashboard:e,content:n,update:r,className:a="dashboard",config:o,onChange:l,headerSlot:u,headerMenuItems:c},d)=>{rk(o.monacoPath),Wa(o);const{data:f=[]}=X.useRequest(fr),{data:p=[]}=X.useRequest(ja),[g,m]=y.useState(!1),C=y.useMemo(()=>_i(e,n,f,p,t),[e,n]);y.useImperativeHandle(d,()=>C,[C]),Qa(C.content,!0),y.useEffect(()=>{C.context.replace(t)},[t]),y.useEffect(()=>{C.datasources.replace(f)},[f]),y.useEffect(()=>{C.globalSQLSnippets.replace(p)},[p]),y.useEffect(()=>ie.reaction(()=>ie.toJS(C.json),I=>{l==null||l(I)}),[C]);const w=async()=>{await r(C.json,C.content.json)},_=X.useCreation(mi,[]),T=Di(_);return i(Ke.ModalsProvider,{children:i(mr,{value:C,children:i(gr,{value:C.content,children:i(ft.Provider,{value:{layoutFrozen:g,freezeLayout:m,inEditMode:!0},children:i(at.Provider,{value:_,children:h(Hn,{configure:T,children:[i(s.AppShell,{padding:0,header:i(_1,{saveDashboardChanges:w,headerSlot:u,headerMenuItems:c}),navbar:i(J1,{}),styles:ik,children:i(s.Box,{className:`${a} dashboard-root`,sx:{position:"relative"},children:C.content.views.visibleViews.map(I=>i(bl,{view:I},I.id))})}),i(tk,{})]})})})})})})},sk=k.observer(y.forwardRef(ak)),pD="";Bs();const ok=k.observer(({context:t,dashboard:e,content:n,className:r="dashboard",config:a,fullScreenPanelID:o,setFullScreenPanelID:l})=>{Wa(a);const{data:u=[]}=X.useRequest(fr),{data:c=[]}=X.useRequest(ja),d=y.useMemo(()=>_i(e,n,u,c,t),[e,n]);Qa(d.content,!1),y.useEffect(()=>{d.context.replace(t)},[t]),y.useEffect(()=>{d.datasources.replace(u)},[u]),y.useEffect(()=>{d.globalSQLSnippets.replace(c)},[c]);const f=X.useCreation(mi,[]),p=Di(f);return i(Ke.ModalsProvider,{children:i(mr,{value:d,children:i(gr,{value:d.content,children:i(_r.Provider,{value:{fullScreenPanelID:o,setFullScreenPanelID:l},children:i(ft.Provider,{value:{layoutFrozen:!0,freezeLayout:v.noop,inEditMode:!1},children:i(s.Box,{className:`${r} dashboard-root`,children:i(at.Provider,{value:f,children:i(Hn,{configure:p,children:d.content.views.visibleViews.map(g=>i(nr,{view:g},g.id))})})})})})})})})});var Pi={},lk={get exports(){return Pi},set exports(t){Pi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype,o=a.format;a.format=function(l){var u=this,c=this.$locale();if(!this.isValid())return o.bind(this)(l);var d=this.$utils(),f=(l||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(p){switch(p){case"Q":return Math.ceil((u.$M+1)/3);case"Do":return c.ordinal(u.$D);case"gggg":return u.weekYear();case"GGGG":return u.isoWeekYear();case"wo":return c.ordinal(u.week(),"W");case"w":case"ww":return d.s(u.week(),p==="w"?1:2,"0");case"W":case"WW":return d.s(u.isoWeek(),p==="W"?1:2,"0");case"k":case"kk":return d.s(String(u.$H===0?24:u.$H),p==="k"?1:2,"0");case"X":return Math.floor(u.$d.getTime()/1e3);case"x":return u.$d.getTime();case"z":return"["+u.offsetName()+"]";case"zzz":return"["+u.offsetName("long")+"]";default:return p}});return o.bind(this)(f)}}})})(lk);const uk=Pi;var Bi={},ck={get exports(){return Bi},set exports(t){Bi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o=r.prototype,l=function(c){var d=c.date,f=c.utc;return Array.isArray(d)?f?d.length?new Date(Date.UTC.apply(null,d)):new Date:d.length===1?a(String(d[0])).toDate():new(Function.prototype.bind.apply(Date,[null].concat(d))):d},u=o.parse;o.parse=function(c){c.date=l.bind(this)(c),u.bind(this)(c)}}})})(ck);const dk=Bi;var Vi={},pk={get exports(){return Vi},set exports(t){Vi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype;a.$g=function(g,m,C){return this.$utils().u(g)?this[m]:this.$set(C,g)},a.set=function(g,m){return this.$set(g,m)};var o=a.startOf;a.startOf=function(g,m){return this.$d=o.bind(this)(g,m).toDate(),this.init(),this};var l=a.add;a.add=function(g,m){return this.$d=l.bind(this)(g,m).toDate(),this.init(),this};var u=a.locale;a.locale=function(g,m){return g?(this.$L=u.bind(this)(g,m).$L,this):this.$L};var c=a.daysInMonth;a.daysInMonth=function(){return c.bind(this.clone())()};var d=a.isSame;a.isSame=function(g,m){return d.bind(this.clone())(g,m)};var f=a.isBefore;a.isBefore=function(g,m){return f.bind(this.clone())(g,m)};var p=a.isAfter;a.isAfter=function(g,m){return p.bind(this.clone())(g,m)}}})})(pk);const hk=Vi;var Ni={},fk={get exports(){return Ni},set exports(t){Ni=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype,o=a.format;a.format=function(l){var u=this,c=(l||"YYYY-MM-DDTHH:mm:ssZ").replace(/(\[[^\]]+])|BBBB|BB/g,function(d,f){var p,g=String(u.$y+543),m=d==="BB"?[g.slice(-2),2]:[g,4];return f||(p=u.$utils()).s.apply(p,m.concat(["0"]))});return o.bind(this)(c)}}})})(fk);const gk=Ni;var qi={},mk={get exports(){return qi},set exports(t){qi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o="h:mm A",l={lastDay:"[Yesterday at] "+o,sameDay:"[Today at] "+o,nextDay:"[Tomorrow at] "+o,nextWeek:"dddd [at] "+o,lastWeek:"[Last] dddd [at] "+o,sameElse:"MM/DD/YYYY"};r.prototype.calendar=function(u,c){var d=c||this.$locale().calendar||l,f=a(u||void 0).startOf("d"),p=this.diff(f,"d",!0),g="sameElse",m=p<-6?g:p<-1?"lastWeek":p<0?"lastDay":p<1?"sameDay":p<2?"nextDay":p<7?"nextWeek":g,C=d[m]||l[m];return typeof C=="function"?C.call(this,a()):this.format(C)}}})})(mk);const yk=qi;var Fi={},bk={get exports(){return Fi},set exports(t){Fi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,a=/\d\d/,o=/\d\d?/,l=/\d*[^-_:/,()\s\d]+/,u={},c=function(w){return(w=+w)+(w>68?1900:2e3)},d=function(w){return function(_){this[w]=+_}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(w){(this.zone||(this.zone={})).offset=function(_){if(!_||_==="Z")return 0;var T=_.match(/([+-]|\d\d)/g),I=60*T[1]+(+T[2]||0);return I===0?0:T[0]==="+"?-I:I}(w)}],p=function(w){var _=u[w];return _&&(_.indexOf?_:_.s.concat(_.f))},g=function(w,_){var T,I=u.meridiem;if(I){for(var O=1;O<=24;O+=1)if(w.indexOf(I(O,0,_))>-1){T=O>12;break}}else T=w===(_?"pm":"PM");return T},m={A:[l,function(w){this.afternoon=g(w,!1)}],a:[l,function(w){this.afternoon=g(w,!0)}],S:[/\d/,function(w){this.milliseconds=100*+w}],SS:[a,function(w){this.milliseconds=10*+w}],SSS:[/\d{3}/,function(w){this.milliseconds=+w}],s:[o,d("seconds")],ss:[o,d("seconds")],m:[o,d("minutes")],mm:[o,d("minutes")],H:[o,d("hours")],h:[o,d("hours")],HH:[o,d("hours")],hh:[o,d("hours")],D:[o,d("day")],DD:[a,d("day")],Do:[l,function(w){var _=u.ordinal,T=w.match(/\d+/);if(this.day=T[0],_)for(var I=1;I<=31;I+=1)_(I).replace(/\[|\]/g,"")===w&&(this.day=I)}],M:[o,d("month")],MM:[a,d("month")],MMM:[l,function(w){var _=p("months"),T=(p("monthsShort")||_.map(function(I){return I.slice(0,3)})).indexOf(w)+1;if(T<1)throw new Error;this.month=T%12||T}],MMMM:[l,function(w){var _=p("months").indexOf(w)+1;if(_<1)throw new Error;this.month=_%12||_}],Y:[/[+-]?\d+/,d("year")],YY:[a,function(w){this.year=c(w)}],YYYY:[/\d{4}/,d("year")],Z:f,ZZ:f};function C(w){var _,T;_=w,T=u&&u.formats;for(var I=(w=_.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(U,Y,Z){var oe=Z&&Z.toUpperCase();return Y||T[Z]||n[Z]||T[oe].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(ue,ye,De){return ye||De.slice(1)})})).match(r),O=I.length,B=0;B<O;B+=1){var $=I[B],A=m[$],E=A&&A[0],F=A&&A[1];I[B]=F?{regex:E,parser:F}:$.replace(/^\[|\]$/g,"")}return function(U){for(var Y={},Z=0,oe=0;Z<O;Z+=1){var ue=I[Z];if(typeof ue=="string")oe+=ue.length;else{var ye=ue.regex,De=ue.parser,ge=U.slice(oe),xe=ye.exec(ge)[0];De.call(Y,xe),U=U.replace(xe,"")}}return function(be){var Oe=be.afternoon;if(Oe!==void 0){var Ye=be.hours;Oe?Ye<12&&(be.hours+=12):Ye===12&&(be.hours=0),delete be.afternoon}}(Y),Y}}return function(w,_,T){T.p.customParseFormat=!0,w&&w.parseTwoDigitYear&&(c=w.parseTwoDigitYear);var I=_.prototype,O=I.parse;I.parse=function(B){var $=B.date,A=B.utc,E=B.args;this.$u=A;var F=E[1];if(typeof F=="string"){var U=E[2]===!0,Y=E[3]===!0,Z=U||Y,oe=E[2];Y&&(oe=E[2]),u=this.$locale(),!U&&oe&&(u=T.Ls[oe]),this.$d=function(ge,xe,be){try{if(["x","X"].indexOf(xe)>-1)return new Date((xe==="X"?1e3:1)*ge);var Oe=C(xe)(ge),Ye=Oe.year,At=Oe.month,or=Oe.day,lr=Oe.hours,ma=Oe.minutes,ya=Oe.seconds,ln=Oe.milliseconds,Ft=Oe.zone,wt=new Date,zt=or||(Ye||At?1:wt.getDate()),Ct=Ye||wt.getFullYear(),Gt=0;Ye&&!At||(Gt=At>0?At-1:wt.getMonth());var Wt=lr||0,un=ma||0,cn=ya||0,St=ln||0;return Ft?new Date(Date.UTC(Ct,Gt,zt,Wt,un,cn,St+60*Ft.offset*1e3)):be?new Date(Date.UTC(Ct,Gt,zt,Wt,un,cn,St)):new Date(Ct,Gt,zt,Wt,un,cn,St)}catch{return new Date("")}}($,F,A),this.init(),oe&&oe!==!0&&(this.$L=this.locale(oe).$L),Z&&$!=this.format(F)&&(this.$d=new Date("")),u={}}else if(F instanceof Array)for(var ue=F.length,ye=1;ye<=ue;ye+=1){E[1]=F[ye-1];var De=T.apply(this,E);if(De.isValid()){this.$d=De.$d,this.$L=De.$L,this.init();break}ye===ue&&(this.$d=new Date(""))}else O.call(this,B)}}})})(bk);const vk=Fi;var Gi={},xk={get exports(){return Gi},set exports(t){Gi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.dayOfYear=function(o){var l=Math.round((a(this).startOf("day")-a(this).startOf("year"))/864e5)+1;return o==null?l:this.add(o-l,"day")}}})})(xk);const wk=Gi;var Wi={},Ck={get exports(){return Wi},set exports(t){Wi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n,r,a=1e3,o=6e4,l=36e5,u=864e5,c=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d=31536e6,f=2592e6,p=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,g={years:d,months:f,days:u,hours:l,minutes:o,seconds:a,milliseconds:1,weeks:6048e5},m=function($){return $ instanceof B},C=function($,A,E){return new B($,E,A.$l)},w=function($){return r.p($)+"s"},_=function($){return $<0},T=function($){return _($)?Math.ceil($):Math.floor($)},I=function($){return Math.abs($)},O=function($,A){return $?_($)?{negative:!0,format:""+I($)+A}:{negative:!1,format:""+$+A}:{negative:!1,format:""}},B=function(){function $(E,F,U){var Y=this;if(this.$d={},this.$l=U,E===void 0&&(this.$ms=0,this.parseFromMilliseconds()),F)return C(E*g[w(F)],this);if(typeof E=="number")return this.$ms=E,this.parseFromMilliseconds(),this;if(typeof E=="object")return Object.keys(E).forEach(function(ue){Y.$d[w(ue)]=E[ue]}),this.calMilliseconds(),this;if(typeof E=="string"){var Z=E.match(p);if(Z){var oe=Z.slice(2).map(function(ue){return ue!=null?Number(ue):0});return this.$d.years=oe[0],this.$d.months=oe[1],this.$d.weeks=oe[2],this.$d.days=oe[3],this.$d.hours=oe[4],this.$d.minutes=oe[5],this.$d.seconds=oe[6],this.calMilliseconds(),this}}return this}var A=$.prototype;return A.calMilliseconds=function(){var E=this;this.$ms=Object.keys(this.$d).reduce(function(F,U){return F+(E.$d[U]||0)*g[U]},0)},A.parseFromMilliseconds=function(){var E=this.$ms;this.$d.years=T(E/d),E%=d,this.$d.months=T(E/f),E%=f,this.$d.days=T(E/u),E%=u,this.$d.hours=T(E/l),E%=l,this.$d.minutes=T(E/o),E%=o,this.$d.seconds=T(E/a),E%=a,this.$d.milliseconds=E},A.toISOString=function(){var E=O(this.$d.years,"Y"),F=O(this.$d.months,"M"),U=+this.$d.days||0;this.$d.weeks&&(U+=7*this.$d.weeks);var Y=O(U,"D"),Z=O(this.$d.hours,"H"),oe=O(this.$d.minutes,"M"),ue=this.$d.seconds||0;this.$d.milliseconds&&(ue+=this.$d.milliseconds/1e3);var ye=O(ue,"S"),De=E.negative||F.negative||Y.negative||Z.negative||oe.negative||ye.negative,ge=Z.format||oe.format||ye.format?"T":"",xe=(De?"-":"")+"P"+E.format+F.format+Y.format+ge+Z.format+oe.format+ye.format;return xe==="P"||xe==="-P"?"P0D":xe},A.toJSON=function(){return this.toISOString()},A.format=function(E){var F=E||"YYYY-MM-DDTHH:mm:ss",U={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return F.replace(c,function(Y,Z){return Z||String(U[Y])})},A.as=function(E){return this.$ms/g[w(E)]},A.get=function(E){var F=this.$ms,U=w(E);return U==="milliseconds"?F%=1e3:F=U==="weeks"?T(F/g[U]):this.$d[U],F===0?0:F},A.add=function(E,F,U){var Y;return Y=F?E*g[w(F)]:m(E)?E.$ms:C(E,this).$ms,C(this.$ms+Y*(U?-1:1),this)},A.subtract=function(E,F){return this.add(E,F,!0)},A.locale=function(E){var F=this.clone();return F.$l=E,F},A.clone=function(){return C(this.$ms,this)},A.humanize=function(E){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!E)},A.milliseconds=function(){return this.get("milliseconds")},A.asMilliseconds=function(){return this.as("milliseconds")},A.seconds=function(){return this.get("seconds")},A.asSeconds=function(){return this.as("seconds")},A.minutes=function(){return this.get("minutes")},A.asMinutes=function(){return this.as("minutes")},A.hours=function(){return this.get("hours")},A.asHours=function(){return this.as("hours")},A.days=function(){return this.get("days")},A.asDays=function(){return this.as("days")},A.weeks=function(){return this.get("weeks")},A.asWeeks=function(){return this.as("weeks")},A.months=function(){return this.get("months")},A.asMonths=function(){return this.as("months")},A.years=function(){return this.get("years")},A.asYears=function(){return this.as("years")},$}();return function($,A,E){n=E,r=E().$utils(),E.duration=function(Y,Z){var oe=E.locale();return C(Y,{$l:oe},Z)},E.isDuration=m;var F=A.prototype.add,U=A.prototype.subtract;A.prototype.add=function(Y,Z){return m(Y)&&(Y=Y.asMilliseconds()),F.bind(this)(Y,Z)},A.prototype.subtract=function(Y,Z){return m(Y)&&(Y=Y.asMilliseconds()),U.bind(this)(Y,Z)}}})})(Ck);const Sk=Wi;var ji={},_k={get exports(){return ji},set exports(t){ji=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.isBetween=function(o,l,u,c){var d=a(o),f=a(l),p=(c=c||"()")[0]==="(",g=c[1]===")";return(p?this.isAfter(d,u):!this.isBefore(d,u))&&(g?this.isBefore(f,u):!this.isAfter(f,u))||(p?this.isBefore(d,u):!this.isAfter(d,u))&&(g?this.isAfter(f,u):!this.isBefore(f,u))}}})})(_k);const kk=ji;var Ri={},Tk={get exports(){return Ri},set exports(t){Ri=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(Tk);const Dk=Ri;var Yi={},Mk={get exports(){return Yi},set exports(t){Yi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){a.isMoment=function(o){return a.isDayjs(o)}}})})(Mk);const Ik=Yi;var Qi={},Ek={get exports(){return Qi},set exports(t){Qi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n="day";return function(r,a,o){var l=function(d){return d.add(4-d.isoWeekday(),n)},u=a.prototype;u.isoWeekYear=function(){return l(this).year()},u.isoWeek=function(d){if(!this.$utils().u(d))return this.add(7*(d-this.isoWeek()),n);var f,p,g,m,C=l(this),w=(f=this.isoWeekYear(),p=this.$u,g=(p?o.utc:o)().year(f).startOf("year"),m=4-g.isoWeekday(),g.isoWeekday()>4&&(m+=7),g.add(m,n));return C.diff(w,"week")+1},u.isoWeekday=function(d){return this.$utils().u(d)?this.day()||7:this.day(this.day()%7?d:d-7)};var c=u.startOf;u.startOf=function(d,f){var p=this.$utils(),g=!!p.u(f)||f;return p.p(d)==="isoweek"?g?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):c.bind(this)(d,f)}}})})(Ek);const Ak=Qi;var Ki={},zk={get exports(){return Ki},set exports(t){Ki=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.isoWeeksInYear=function(){var a=this.isLeapYear(),o=this.endOf("y").day();return o===4||a&&o===5?53:52}}})})(zk);const $k=Ki;var Ui={},Lk={get exports(){return Ui},set exports(t){Ui=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.isSameOrAfter=function(a,o){return this.isSame(a,o)||this.isAfter(a,o)}}})})(Lk);const Ok=Ui;var Xi={},Pk={get exports(){return Xi},set exports(t){Xi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.isSameOrBefore=function(a,o){return this.isSame(a,o)||this.isBefore(a,o)}}})})(Pk);const Bk=Xi;var Ji={},Vk={get exports(){return Ji},set exports(t){Ji=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.isToday=function(){var o="YYYY-MM-DD",l=a();return this.format(o)===l.format(o)}}})})(Vk);const Nk=Ji;var Zi={},qk={get exports(){return Zi},set exports(t){Zi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.isTomorrow=function(){var o="YYYY-MM-DD",l=a().add(1,"day");return this.format(o)===l.format(o)}}})})(qk);const Fk=Zi;var Hi={},Gk={get exports(){return Hi},set exports(t){Hi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.isYesterday=function(){var o="YYYY-MM-DD",l=a().subtract(1,"day");return this.format(o)===l.format(o)}}})})(Gk);const Wk=Hi;var ea={},jk={get exports(){return ea},set exports(t){ea=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o=r.prototype,l=function(p){return p&&(p.indexOf?p:p.s)},u=function(p,g,m,C,w){var _=p.name?p:p.$locale(),T=l(_[g]),I=l(_[m]),O=T||I.map(function($){return $.slice(0,C)});if(!w)return O;var B=_.weekStart;return O.map(function($,A){return O[(A+(B||0))%7]})},c=function(){return a.Ls[a.locale()]},d=function(p,g){return p.formats[g]||function(m){return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(C,w,_){return w||_.slice(1)})}(p.formats[g.toUpperCase()])},f=function(){var p=this;return{months:function(g){return g?g.format("MMMM"):u(p,"months")},monthsShort:function(g){return g?g.format("MMM"):u(p,"monthsShort","months",3)},firstDayOfWeek:function(){return p.$locale().weekStart||0},weekdays:function(g){return g?g.format("dddd"):u(p,"weekdays")},weekdaysMin:function(g){return g?g.format("dd"):u(p,"weekdaysMin","weekdays",2)},weekdaysShort:function(g){return g?g.format("ddd"):u(p,"weekdaysShort","weekdays",3)},longDateFormat:function(g){return d(p.$locale(),g)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return f.bind(this)()},a.localeData=function(){var p=c();return{firstDayOfWeek:function(){return p.weekStart||0},weekdays:function(){return a.weekdays()},weekdaysShort:function(){return a.weekdaysShort()},weekdaysMin:function(){return a.weekdaysMin()},months:function(){return a.months()},monthsShort:function(){return a.monthsShort()},longDateFormat:function(g){return d(p,g)},meridiem:p.meridiem,ordinal:p.ordinal}},a.months=function(){return u(c(),"months")},a.monthsShort=function(){return u(c(),"monthsShort","months",3)},a.weekdays=function(p){return u(c(),"weekdays",null,null,p)},a.weekdaysShort=function(p){return u(c(),"weekdaysShort","weekdays",3,p)},a.weekdaysMin=function(p){return u(c(),"weekdaysMin","weekdays",2,p)}}})})(jk);const Rk=ea;var ta={},Yk={get exports(){return ta},set exports(t){ta=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,a,o){var l=a.prototype,u=l.format;o.en.formats=n,l.format=function(c){c===void 0&&(c="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,f=function(p,g){return p.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(m,C,w){var _=w&&w.toUpperCase();return C||g[w]||n[w]||g[_].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(T,I,O){return I||O.slice(1)})})}(c,d===void 0?{}:d);return u.call(this,f)}}})})(Yk);const Qk=ta;var na={},Kk={get exports(){return na},set exports(t){na=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o=function(l,u){if(!u||!u.length||!u[0]||u.length===1&&!u[0].length)return null;var c;u.length===1&&u[0].length>0&&(u=u[0]),c=u[0];for(var d=1;d<u.length;d+=1)u[d].isValid()&&!u[d][l](c)||(c=u[d]);return c};a.max=function(){var l=[].slice.call(arguments,0);return o("isAfter",l)},a.min=function(){var l=[].slice.call(arguments,0);return o("isBefore",l)}}})})(Kk);const Uk=na;var ra={},Xk={get exports(){return ra},set exports(t){ra=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o=r.prototype,l=function(g){var m,C=g.date,w=g.utc,_={};if(!((m=C)instanceof Date||m instanceof Array||o.$utils().u(m)||m.constructor.name!=="Object")){if(!Object.keys(C).length)return new Date;var T=w?a.utc():a();Object.keys(C).forEach(function(U){var Y,Z;_[Y=U,Z=o.$utils().p(Y),Z==="date"?"day":Z]=C[U]});var I=_.day||(_.year||_.month>=0?1:T.date()),O=_.year||T.year(),B=_.month>=0?_.month:_.year||_.day?0:T.month(),$=_.hour||0,A=_.minute||0,E=_.second||0,F=_.millisecond||0;return w?new Date(Date.UTC(O,B,I,$,A,E,F)):new Date(O,B,I,$,A,E,F)}return C},u=o.parse;o.parse=function(g){g.date=l.bind(this)(g),u.bind(this)(g)};var c=o.set,d=o.add,f=o.subtract,p=function(g,m,C,w){w===void 0&&(w=1);var _=Object.keys(m),T=this;return _.forEach(function(I){T=g.bind(T)(m[I]*w,I)}),T};o.set=function(g,m){return m=m===void 0?g:m,g.constructor.name==="Object"?p.bind(this)(function(C,w){return c.bind(this)(w,C)},m,g):c.bind(this)(g,m)},o.add=function(g,m){return g.constructor.name==="Object"?p.bind(this)(d,g,m):d.bind(this)(g,m)},o.subtract=function(g,m){return g.constructor.name==="Object"?p.bind(this)(d,g,m,-1):f.bind(this)(g,m)}}})})(Xk);const Jk=ra;var ia={},Zk={get exports(){return ia},set exports(t){ia=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype;["milliseconds","seconds","minutes","hours","days","weeks","isoWeeks","months","quarters","years","dates"].forEach(function(o){a[o]=a[o.replace(/s$/,"")]})}})})(Zk);const Hk=ia;var aa={},eT={get exports(){return aa},set exports(t){aa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype.parse;r.prototype.parse=function(u){if(typeof u.date=="string"){var c=this.$locale();u.date=c&&c.preparse?c.preparse(u.date):u.date}return a.bind(this)(u)};var o=r.prototype.format;r.prototype.format=function(){for(var u=arguments.length,c=new Array(u),d=0;d<u;d++)c[d]=arguments[d];var f=o.call.apply(o,[this].concat(c)),p=this.$locale();return p&&p.postformat?p.postformat(f):f};var l=r.prototype.fromToBase;l&&(r.prototype.fromToBase=function(u,c,d,f){var p=this.$locale()||d.$locale();return l.call(this,u,c,d,f,p&&p.postformat)})}})})(eT);const tT=aa;var sa={},nT={get exports(){return sa},set exports(t){sa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n="month",r="quarter";return function(a,o){var l=o.prototype;l.quarter=function(d){return this.$utils().u(d)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(d-1))};var u=l.add;l.add=function(d,f){return d=Number(d),this.$utils().p(f)===r?this.add(3*d,n):u.bind(this)(d,f)};var c=l.startOf;l.startOf=function(d,f){var p=this.$utils(),g=!!p.u(f)||f;if(p.p(d)===r){var m=this.quarter()-1;return g?this.month(3*m).startOf(n).startOf("day"):this.month(3*m+2).endOf(n).endOf("day")}return c.bind(this)(d,f)}}})})(nT);const rT=sa;var oa={},iT={get exports(){return oa},set exports(t){oa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){n=n||{};var o=r.prototype,l={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function u(d,f,p,g){return o.fromToBase(d,f,p,g)}a.en.relativeTime=l,o.fromToBase=function(d,f,p,g,m){for(var C,w,_,T=p.$locale().relativeTime||l,I=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],O=I.length,B=0;B<O;B+=1){var $=I[B];$.d&&(C=g?a(d).diff(p,$.d,!0):p.diff(d,$.d,!0));var A=(n.rounding||Math.round)(Math.abs(C));if(_=C>0,A<=$.r||!$.r){A<=1&&B>0&&($=I[B-1]);var E=T[$.l];m&&(A=m(""+A)),w=typeof E=="string"?E.replace("%d",A):E(A,f,$.l,_);break}}if(f)return w;var F=_?T.future:T.past;return typeof F=="function"?F(w):F.replace("%s",w)},o.to=function(d,f){return u(d,f,this,!0)},o.from=function(d,f){return u(d,f,this)};var c=function(d){return d.$u?a.utc():a()};o.toNow=function(d){return this.to(c(this),d)},o.fromNow=function(d){return this.from(c(this),d)}}})})(iT);const aT=oa;var la={},sT={get exports(){return la},set exports(t){la=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,o,l){var u,c=function(g,m,C){C===void 0&&(C={});var w=new Date(g),_=function(T,I){I===void 0&&(I={});var O=I.timeZoneName||"short",B=T+"|"+O,$=r[B];return $||($=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:T,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:O}),r[B]=$),$}(m,C);return _.formatToParts(w)},d=function(g,m){for(var C=c(g,m),w=[],_=0;_<C.length;_+=1){var T=C[_],I=T.type,O=T.value,B=n[I];B>=0&&(w[B]=parseInt(O,10))}var $=w[3],A=$===24?0:$,E=w[0]+"-"+w[1]+"-"+w[2]+" "+A+":"+w[4]+":"+w[5]+":000",F=+g;return(l.utc(E).valueOf()-(F-=F%1e3))/6e4},f=o.prototype;f.tz=function(g,m){g===void 0&&(g=u);var C=this.utcOffset(),w=this.toDate(),_=w.toLocaleString("en-US",{timeZone:g}),T=Math.round((w-new Date(_))/1e3/60),I=l(_).$set("millisecond",this.$ms).utcOffset(15*-Math.round(w.getTimezoneOffset()/15)-T,!0);if(m){var O=I.utcOffset();I=I.add(C-O,"minute")}return I.$x.$timezone=g,I},f.offsetName=function(g){var m=this.$x.$timezone||l.tz.guess(),C=c(this.valueOf(),m,{timeZoneName:g}).find(function(w){return w.type.toLowerCase()==="timezonename"});return C&&C.value};var p=f.startOf;f.startOf=function(g,m){if(!this.$x||!this.$x.$timezone)return p.call(this,g,m);var C=l(this.format("YYYY-MM-DD HH:mm:ss:SSS"));return p.call(C,g,m).tz(this.$x.$timezone,!0)},l.tz=function(g,m,C){var w=C&&m,_=C||m||u,T=d(+l(),_);if(typeof g!="string")return l(g).tz(_);var I=function(A,E,F){var U=A-60*E*1e3,Y=d(U,F);if(E===Y)return[U,E];var Z=d(U-=60*(Y-E)*1e3,F);return Y===Z?[U,Y]:[A-60*Math.min(Y,Z)*1e3,Math.max(Y,Z)]}(l.utc(g,w).valueOf(),T,_),O=I[0],B=I[1],$=l(O).utcOffset(B);return $.$x.$timezone=_,$},l.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},l.tz.setDefault=function(g){u=g}}})})(sT);const oT=la;var ua={},lT={get exports(){return ua},set exports(t){ua=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]}}})})(lT);const uT=ua;var ca={},cT={get exports(){return ca},set exports(t){ca=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.toObject=function(){return{years:this.$y,months:this.$M,date:this.$D,hours:this.$H,minutes:this.$m,seconds:this.$s,milliseconds:this.$ms}}}})})(cT);const dT=ca;var da={},pT={get exports(){return da},set exports(t){da=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){a.updateLocale=function(o,l){var u=a.Ls[o];if(u)return(l?Object.keys(l):[]).forEach(function(c){u[c]=l[c]}),u}}})})(pT);const hT=da;var pa={},fT={get exports(){return pa},set exports(t){pa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(o,l,u){var c=l.prototype;u.utc=function(w){var _={date:w,utc:!0,args:arguments};return new l(_)},c.utc=function(w){var _=u(this.toDate(),{locale:this.$L,utc:!0});return w?_.add(this.utcOffset(),n):_},c.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var d=c.parse;c.parse=function(w){w.utc&&(this.$u=!0),this.$utils().u(w.$offset)||(this.$offset=w.$offset),d.call(this,w)};var f=c.init;c.init=function(){if(this.$u){var w=this.$d;this.$y=w.getUTCFullYear(),this.$M=w.getUTCMonth(),this.$D=w.getUTCDate(),this.$W=w.getUTCDay(),this.$H=w.getUTCHours(),this.$m=w.getUTCMinutes(),this.$s=w.getUTCSeconds(),this.$ms=w.getUTCMilliseconds()}else f.call(this)};var p=c.utcOffset;c.utcOffset=function(w,_){var T=this.$utils().u;if(T(w))return this.$u?0:T(this.$offset)?p.call(this):this.$offset;if(typeof w=="string"&&(w=function($){$===void 0&&($="");var A=$.match(r);if(!A)return null;var E=(""+A[0]).match(a)||["-",0,0],F=E[0],U=60*+E[1]+ +E[2];return U===0?0:F==="+"?U:-U}(w),w===null))return this;var I=Math.abs(w)<=16?60*w:w,O=this;if(_)return O.$offset=I,O.$u=w===0,O;if(w!==0){var B=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(O=this.local().add(I+B,n)).$offset=I,O.$x.$localOffset=B}else O=this.utc();return O};var g=c.format;c.format=function(w){var _=w||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,_)},c.valueOf=function(){var w=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*w},c.isUTC=function(){return!!this.$u},c.toISOString=function(){return this.toDate().toISOString()},c.toString=function(){return this.toDate().toUTCString()};var m=c.toDate;c.toDate=function(w){return w==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():m.call(this)};var C=c.diff;c.diff=function(w,_,T){if(w&&this.$u===w.$u)return C.call(this,w,_,T);var I=this.local(),O=u(w).local();return C.call(I,O,_,T)}}})})(fT);const gT=pa;var ha={},mT={get exports(){return ha},set exports(t){ha=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.weekday=function(a){var o=this.$locale().weekStart||0,l=this.$W,u=(l<o?l+7:l)-o;return this.$utils().u(a)?u:this.subtract(u,"day").add(a,"day")}}})})(mT);const yT=ha;var fa={},bT={get exports(){return fa},set exports(t){fa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n="week",r="year";return function(a,o,l){var u=o.prototype;u.week=function(c){if(c===void 0&&(c=null),c!==null)return this.add(7*(c-this.week()),"day");var d=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var f=l(this).startOf(r).add(1,r).date(d),p=l(this).endOf(n);if(f.isBefore(p))return 1}var g=l(this).startOf(r).date(d).startOf(n).subtract(1,"millisecond"),m=this.diff(g,n,!0);return m<0?l(this).startOf("week").week():Math.ceil(m)},u.weeks=function(c){return c===void 0&&(c=null),this.week(c)}}})})(bT);const vT=fa;var ga={},xT={get exports(){return ga},set exports(t){ga=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.weekYear=function(){var a=this.month(),o=this.week(),l=this.year();return o===1&&a===11?l+1:a===0&&o>=52?l-1:l}}})})(xT);const wT=ga;R.extend(uk),R.extend(dk),R.extend(hk),R.extend(gk),R.extend(yk),R.extend(vk),R.extend(wk),R.extend(Sk),R.extend(kk),R.extend(Dk),R.extend(Ik),R.extend(Ok),R.extend(Bk),R.extend(Nk),R.extend(Fk),R.extend(Wk),R.extend(Ak),R.extend($k),R.extend(Rk),R.extend(Qk),R.extend(Uk),R.extend(Jk),R.extend(Hk),R.extend(tT),R.extend(rT),R.extend(aT),R.extend(oT),R.extend(uT),R.extend(dT),R.extend(hT),R.extend(gT),R.extend(vT),R.extend(wT),R.extend(yT),R.tz.setDefault("UTC");const CT=()=>Promise.resolve().then(()=>sc).then(({version:t})=>(console.log(`[@devtable/dashboard] version: ${t}`),t));M.ContentModel=Zn,M.ContentModelContextProvider=gr,M.ContextModel=hs,M.DashboardEditor=sk,M.DashboardFilterType=wi,M.DashboardMode=Xo,M.DashboardModel=al,M.DashboardViewEditor=bl,M.DashboardViewRender=nr,M.EViewComponentType=H,M.FilterModel=br,M.FiltersModel=rs,M.FullScreenPanelContext=_r,M.LayoutStateContext=ft,M.ModelContextProvider=mr,M.Panel=tr,M.PanelContextProvider=Sr,M.PanelModel=Qo,M.PanelsModel=Uo,M.QueriesModel=cs,M.QueryModel=us,M.ReadOnlyDashboard=ok,M.SQLSnippetModel=ds,M.SQLSnippetsModel=ps,M.ViewComponentTypeBackground=Jo,M.ViewComponentTypeColor=pC,M.ViewComponentTypeName=dC,M.ViewModel=tl,M.ViewsModel=nl,M.applyPartialDashboard=xC,M.createContentModel=il,M.createDashboardModel=_i,M.createDashboardViewsModel=Si,M.getInitialFiltersPayload=is,M.getNewPanel=Ko,M.getVersion=CT,M.initialDashboardContent=hC,M.useContentModelContext=K,M.useFullScreenPanelContext=xs,M.useModelContext=he,M.usePanelContext=ze,M.useTopLevelServices=Di,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
513
+ `)},v_=k.observer(({queryModel:t})=>{const[e,n]=y.useState(t.sql);y.useEffect(()=>{n(o=>o!==t.sql?t.sql:o)},[t.sql]);const r=e!==t.sql,a=()=>{t.setSQL(e)};return t.typedAsSQL?h(s.Tabs,{defaultValue:"Edit",orientation:"vertical",sx:{flexGrow:1},styles:{tabLabel:{width:"100%",height:"28px",lineHeight:"28px"}},keepMounted:!1,children:[h(s.Tabs.List,{children:[i(s.Tabs.Tab,{value:"Edit",children:h(s.Group,{spacing:14,position:"apart",children:["Edit SQL",i(s.ActionIcon,{mr:5,variant:"filled",color:"blue",disabled:!r,onClick:a,children:i(D.DeviceFloppy,{size:20})})]})}),i(s.Tabs.Tab,{value:"Preview",children:"Preview SQL"}),i(s.Tabs.Tab,{value:"pre_process",children:"Process Request"}),i(s.Tabs.Tab,{value:"post_process",children:"Process Result"}),i(Li,{}),t.datasource&&i(El,{dataSource:t.datasource})]}),i(s.Tabs.Panel,{value:"Edit",sx:{position:"relative"},p:"sm",children:i(Oi,{height:"100%",value:e,onChange:n,theme:"sql-dark",defaultLanguage:"sql"})}),i(s.Tabs.Panel,{value:"Preview",p:0,pl:4,children:i(b_,{value:t.sql})}),i(s.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:i(ar,{label:"",value:t.pre_process,onChange:t.setPreProcess,defaultValue:$l.pre})}),i(s.Tabs.Panel,{value:"post_process",p:"sm",children:i(ar,{label:"",value:t.post_process,onChange:t.setPostProcess,defaultValue:$l.post})})]}):null}),sr={height:"calc(100% - 44px)",padding:0},x_=k.observer(({queryModel:t})=>{const e=K(),n=y.useMemo(()=>t.datasource?t.typedAsHTTP?"HTTP":"SQL":"Configurations",[t.datasource,t.typedAsHTTP]),[r,a]=y.useState(n);y.useEffect(()=>{a(u=>u!=="Configurations"&&n==="Configurations"?"Configurations":u)},[n]);const o=e.findQueryUsage(t.id),l=o.length===0;return i(s.Stack,{sx:{flexGrow:1},my:0,p:0,children:h(s.Tabs,{value:r,onTabChange:a,defaultValue:n,orientation:"horizontal",keepMounted:!1,sx:{flexGrow:1},children:[h(s.Tabs.List,{grow:!0,children:[i(s.Tabs.Tab,{value:"Configurations",children:"Configurations"}),t.typedAsSQL&&i(s.Tabs.Tab,{value:"SQL",children:"Request"}),t.typedAsHTTP&&i(s.Tabs.Tab,{value:"HTTP",children:"Request"}),i(s.Tabs.Tab,{value:"Data",disabled:!t.datasource,children:i(s.Tooltip,{label:"Need to pick a Data Source first",disabled:t.datasource,withinPortal:!0,children:i(s.Text,{children:"Data"})})}),i(s.Tabs.Tab,{value:"Usage",disabled:l,children:i(s.Tooltip,{label:"This query is not used for any filter or panel",disabled:!l,withinPortal:!0,children:i(s.Text,{children:"Usage"})})})]}),i(s.Tabs.Panel,{value:"Configurations",pt:0,p:0,children:i(u_,{queryModel:t})}),t.typedAsSQL&&i(s.Tabs.Panel,{value:"SQL",sx:sr,children:i(s.Stack,{sx:{height:"100%"},children:i(v_,{queryModel:t})})}),t.typedAsHTTP&&i(s.Tabs.Panel,{value:"HTTP",sx:sr,children:i(s.Stack,{sx:{height:"100%"},children:i(g_,{queryModel:t})})}),i(s.Tabs.Panel,{value:"Data",sx:{...sr,overflow:"hidden"},children:i(zi,{id:t.id})}),i(s.Tabs.Panel,{value:"Usage",sx:{...sr,overflow:"hidden"},children:i(m_,{queryID:t.id,usage:o})})]})})}),w_=k.observer(({id:t})=>{const n=K().queries.findByID(t);return t===""?null:n?i(s.Stack,{sx:{height:"100%"},spacing:"sm",children:i(x_,{queryModel:n})}):i(s.Text,{size:14,color:"red",children:"Invalid Query ID"})}),C_=k.observer(({value:t})=>{const n=K().payloadForSQL,r=y.useMemo(()=>hr(t,n),[t,n]);return i(Oi,{height:"100%",value:r})}),S_=k.observer(({item:t,remove:e,onKeyChanged:n})=>{const[r,a]=y.useState("SQL"),[o,l]=y.useState(t.key),u=()=>{t.setKey(o),n(o)},c=o!==t.key,d=t.isADuplicatedKey(o),[f,p]=y.useState(t.value),g=()=>{t.setValue(f)};y.useEffect(()=>{l(t.key),p(t.value)},[t]);const m=f!==t.value,C=Ke.useModals(),w=()=>{C.openConfirmModal({title:"Delete this SQL snippet?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:e,confirmProps:{color:"red"},zIndex:320})};return h(s.Stack,{p:20,sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",children:[h(s.Group,{sx:{alignItems:"end"},spacing:40,children:[i(s.TextInput,{label:d?"This key is occupied by another snippet":"Key",value:o,onChange:_=>{l(_.currentTarget.value)},sx:{flexGrow:"1 !important"},rightSection:i(s.ActionIcon,{color:"blue",variant:"subtle",onClick:u,disabled:!c||d,children:i(D.DeviceFloppy,{size:16})}),error:d}),i(s.Button,{leftIcon:i(D.Trash,{size:16}),color:"red",variant:"light",onClick:w,children:"Delete this SQL Snippet"})]}),h(s.Tabs,{value:r,onTabChange:a,sx:{flexGrow:1},styles:{panel:{height:"calc(100% - 50px)"}},children:[h(s.Tabs.List,{sx:{position:"relative"},children:[i(s.Tabs.Tab,{value:"SQL",children:"SQL"}),i(s.Tabs.Tab,{value:"Preview",children:"Preview"}),i(Li,{}),i(s.ActionIcon,{color:"blue",variant:"filled",onClick:g,disabled:!m,sx:{position:"absolute",top:0,right:10},children:i(D.DeviceFloppy,{size:18})})]}),i(s.Tabs.Panel,{value:"SQL",pt:"sm",children:i(Oi,{height:"100%",value:f,onChange:p,defaultLanguage:"sql",theme:"sql-dark"})}),i(s.Tabs.Panel,{value:"Preview",pt:"sm",children:i(C_,{value:f})})]})]})}),__=k.observer(({id:t})=>{const e=he(),n=K(),r=y.useMemo(()=>n.sqlSnippets.findByKey(t),[t]);if(!t)return null;if(!r)return h(s.Text,{size:14,children:["SQL Snippet by key[",t,"] is not found"]});const a=()=>{e.editor.setPath(["_SQL_SNIPPETS_",""])};return i(S_,{item:r,remove:()=>{n.sqlSnippets.removeByKey(t),a()},onKeyChanged:u=>{e.editor.setPath(["_SQL_SNIPPETS_",u])}})}),k_=k.observer(({view:t})=>!t||t.type!==H.Division?null:h(s.Stack,{children:[i(s.Divider,{mt:8,mb:0,label:"Division settings",labelPosition:"center"}),i(s.Text,{align:"center",size:"xs",color:"dimmed",children:"Under construction"})]})),T_=[{value:"default",label:"Default"},{value:"outline",label:"Outline"},{value:"pills",label:"Pills"}],D_=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical"}],M_=k.observer(({view:t})=>{if(!t||t.type!==H.Tabs)return null;const e=t.config;return h(s.Stack,{children:[i(s.Divider,{mt:8,mb:0,label:"Tabs settings",labelPosition:"center"}),i(s.Select,{label:"Variant",value:e.variant,onChange:e.setVariant,data:T_}),i(s.Select,{label:"Orientation",value:e.orientation,onChange:e.setOrientation,data:D_}),i(s.Switch,{label:"Grow Tabs",checked:e.grow,onChange:n=>e.setGrow(n.currentTarget.checked)})]})}),I_=({disabled:t,value:e,onChange:n})=>{const r=a=>{a&&n(a)};return h(s.Box,{sx:{position:"relative"},children:[t&&i(s.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),i(Ie,{height:"500px",defaultLanguage:"javascript",value:e,onChange:r,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:t}})]})},E_=({value:t,onChange:e})=>{const[n,{setTrue:r,setFalse:a}]=X.useBoolean(),[o,l]=y.useState(t??Ci),u=g=>{l({...o,enabled:g})},c=()=>{a();const{enabled:g,func_content:m}=o,C={enabled:g,func_content:m};l(C),e(C)},d=()=>{a(),l(t)},f=g=>{l(m=>({...m,func_content:g}))},p=()=>{f(Ci.func_content)};return h(V,{children:[i(s.ActionIcon,{size:"lg",color:"blue",variant:"filled",mt:26,onClick:r,sx:{flexGrow:0},children:i(D.Settings,{size:14})}),i(s.Modal,{size:800,title:"Customize modal title",opened:n,onClose:a,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:n&&h(s.Stack,{children:[i(s.Checkbox,{mt:10,label:"Enabled",checked:o.enabled,onChange:g=>u(g.currentTarget.checked)}),i(I_,{value:o.func_content,onChange:f,disabled:!o.enabled}),h(s.Group,{position:"apart",children:[i(s.Button,{onClick:p,color:"red",leftIcon:i(D.Recycle,{size:20}),children:"Rest"}),h(s.Group,{position:"right",children:[i(s.Button,{onClick:d,variant:"subtle",children:"Cancel"}),i(s.Button,{onClick:c,children:"OK"})]})]})]})})]})},A_=k.observer(({view:t})=>{if(!t||t.type!==H.Modal)return null;const e=t.config,n=e.custom_modal_title.value;return h(s.Stack,{children:[i(s.Divider,{mt:8,label:"Modal settings",labelPosition:"center"}),h(s.Flex,{gap:10,children:[i(s.TextInput,{label:"Modal Title",value:n,onChange:v.noop,disabled:!0,sx:{flexGrow:1}}),i(E_,{value:e.custom_modal_title,onChange:e.custom_modal_title.replace})]}),h(s.Group,{grow:!0,children:[i(s.TextInput,{label:"Width",value:e.width,onChange:r=>e.setWidth(r.currentTarget.value),placeholder:"600px / 50vw"}),i(s.TextInput,{label:"Height",value:e.height,onChange:r=>e.setHeight(r.currentTarget.value),placeholder:"600px / 50vw"})]})]})}),z_=k.observer(({view:t})=>h(V,{children:[i(k_,{view:t}),i(A_,{view:t}),i(M_,{view:t})]})),$_=[{label:"Division",value:H.Division},{label:"Modal",value:H.Modal},{label:"Tabs",value:H.Tabs}],L_=k.observer(({view:t})=>t?h(s.Stack,{sx:{position:"relative"},children:[i(s.TextInput,{label:"Name",value:t.name,onChange:e=>{t.setName(e.currentTarget.value)}}),i(s.Select,{label:"Type",withinPortal:!0,zIndex:320,value:t.type,onChange:t.setType,data:$_}),i(z_,{view:t})]}):null),O_=k.observer(({id:t})=>{const e=Ke.useModals(),n=he(),r=K();if(t==="")return null;const a=r.views.findByID(t);if(!a)return h(s.Text,{size:14,children:["View by ID[",t,"] is not found"]});const o=()=>{n.editor.setPath(["_VIEWS_",""])},l=()=>{e.openConfirmModal({title:"Delete this view?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>{r.views.removeByID(t),o()},zIndex:320})};return h(s.Stack,{sx:{maxWidth:"600px",height:"100%"},spacing:"sm",children:[i(s.Group,{position:"right",pt:10,children:i(s.Button,{size:"xs",color:"red",leftIcon:i(D.Trash,{size:16}),onClick:l,children:"Delete this view"})}),i(s.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:i(L_,{view:a})})]})});function P_(t){return t.length===1&&t[0]==="_QUERY_VARS_"}function B_(t){return t.length===1&&t[0]==="_MOCK_CONTEXT_"}function V_(t){return t.length===2&&t[0]==="_FILTERS_"}function N_(t){return t.length===2&&t[0]==="_SQL_SNIPPETS_"}function q_(t){return t.length===2&&t[0]==="_QUERIES_"}function F_(t){return t.length===2&&t[0]==="_VIEWS_"}function G_(t){return t.length===4&&t[0]==="_VIEWS_"&&t[2]==="_PANELS_"}const W_=k.observer(()=>i(s.Stack,{sx:{height:"100%"},p:"sm",children:i(Al,{})})),j_=k.observer(()=>{const t=he().editor,e=t.path;return P_(e)?i(W_,{}):B_(e)?i(hS,{}):V_(e)?i(s.Box,{p:"xs",pl:20,children:i(pS,{id:e[1]})}):N_(e)?i(__,{id:e[1]}):q_(e)?i(w_,{id:e[1]}):F_(e)?i(s.Box,{p:"xs",pl:20,children:i(O_,{id:e[1]})}):G_(e)?i(GS,{viewID:e[1],panelID:e[3]}):i(s.Box,{children:t.path})}),R_=k.observer(()=>i(j_,{})),Y_=k.observer(()=>{const t=he(),e=()=>{const n=new Date().getTime().toString(),r={id:n,key:n,label:n,order:t.content.filters.current.length+1,type:wi.TextInput,config:ts(),visibleInViewsIDs:["Main"],auto_submit:!1};t.content.filters.append(r),t.editor.setPath(["_FILTERS_",n])};return i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Filter"})}),Q_=k.observer(({parentID:t})=>{const e=K();if(!t)return null;const n=e.views.findByID(t);return n?i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:()=>e.addANewPanel(n.id),sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Panel"}):null}),K_=k.observer(()=>{const t=he(),e=()=>{const n=new Date().getTime().toString(),r={id:n,name:n,type:me.Postgresql,key:"",sql:""};t.content.queries.append(r),t.editor.setPath(["_QUERIES_",n])};return i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Query"})}),U_=k.observer(()=>{const t=he(),e=()=>{const n=new Date().getTime().toString(),r={key:n,value:""};t.content.sqlSnippets.append(r),t.editor.setPath(["_SQL_SNIPPETS_",n])};return i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a SQL Snippet"})}),X_=k.observer(()=>{const t=K();return i(s.Button,{variant:"subtle",leftIcon:i(L.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a View"})}),J_=k.observer(({action_type:t,parentID:e})=>(K(),t==="_Add_A_Filter_"?i(Y_,{}):t==="_Add_A_SQL_SNIPPET_"?i(U_,{}):t==="_Add_A_QUERY_"?i(K_,{}):t==="_Add_A_VIEW_"?i(X_,{}):t==="_Add_A_PANEL_"?i(Q_,{parentID:e}):null)),Ll=k.observer(({option:t})=>{var d;const e=he().editor,n=e.isOptionActive,r=n(e.path,t),a=e.isOptionOpened,o=e.navigate,l=a(t),[u,c]=y.useState(l);return y.useEffect(()=>{c(l)},[l]),i(s.NavLink,{active:r,defaultOpened:l,opened:u,onChange:c,label:t.label,onClick:()=>o(t),icon:t.Icon?i(t.Icon,{size:18}):null,children:(d=t.children)==null?void 0:d.map(f=>f._type==="ACTION"?i(J_,{action_type:f._action_type,parentID:f.parentID},`_ADD_${f.value}_`):i(Ll,{option:f},f.value))},t.label)}),Z_=k.observer(()=>{const t=he();return i(s.Box,{sx:{position:"relative"},children:t.editor.navOptions.map(e=>i(Ll,{option:e},e.value))})}),H_=k.observer(()=>{const t=he();return h(s.Navbar,{p:0,width:{base:200,xs:200,sm:220,md:240,lg:280,xl:300},sx:{height:"100vh - 60px - 60px"},children:[i(s.Navbar.Section,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:i(s.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:"Settings"})}),i(s.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:i(Z_,{})}),i(s.Navbar.Section,{children:i(s.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:i(s.Button,{size:"xs",color:"red",leftIcon:i(L.IconX,{size:18}),onClick:()=>t.editor.close(),children:"Close"})})})]})}),ek={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1,nav:{top:0,height:"100vh"}},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:0,height:"100vh"}},tk=k.observer(()=>{const t=he().editor;return i(s.Modal,{onClose:()=>t.setSettingsOpen(!1),closeOnEscape:!1,closeOnClickOutside:!1,opened:t.settings_open,fullScreen:!0,title:null,transitionProps:{duration:0},withCloseButton:!1,withinPortal:!0,zIndex:300,styles:{body:{padding:"0 !important"}},children:i(s.AppShell,{padding:0,navbar:i(H_,{}),styles:ek,children:i(R_,{})})})}),nk=t=>t.replace(/([^:])(\/\/+)/g,"$1/");function rk(t){y.useEffect(()=>{if(Ie.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/dashboard");const n=nk(t);Ie.loader.config({paths:{vs:n}}),Ie.loader.init().then(r=>console.log("monaco instance:",r))},[])}Bs();const ik={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:60+30,height:"100vh"}},ak=({context:t,dashboard:e,content:n,update:r,className:a="dashboard",config:o,onChange:l,headerSlot:u,headerMenuItems:c},d)=>{rk(o.monacoPath),Wa(o);const{data:f=[]}=X.useRequest(fr),{data:p=[]}=X.useRequest(ja),[g,m]=y.useState(!1),C=y.useMemo(()=>_i(e,n,f,p,t),[e,n]);y.useImperativeHandle(d,()=>C,[C]),Qa(C.content,!0),y.useEffect(()=>{C.context.replace(t)},[t]),y.useEffect(()=>{C.datasources.replace(f)},[f]),y.useEffect(()=>{C.globalSQLSnippets.replace(p)},[p]),y.useEffect(()=>ie.reaction(()=>ie.toJS(C.json),I=>{l==null||l(I)}),[C]);const w=async()=>{await r(C.json,C.content.json)},_=X.useCreation(mi,[]),T=Di(_);return i(Ke.ModalsProvider,{children:i(mr,{value:C,children:i(gr,{value:C.content,children:i(ft.Provider,{value:{layoutFrozen:g,freezeLayout:m,inEditMode:!0},children:i(at.Provider,{value:_,children:h(Hn,{configure:T,children:[i(s.AppShell,{padding:0,header:i(_1,{saveDashboardChanges:w,headerSlot:u,headerMenuItems:c}),navbar:i(J1,{}),styles:ik,children:i(s.Box,{className:`${a} dashboard-root`,sx:{position:"relative"},children:C.content.views.visibleViews.map(I=>i(bl,{view:I},I.id))})}),i(tk,{})]})})})})})})},sk=k.observer(y.forwardRef(ak)),pD="";Bs();const ok=k.observer(({context:t,dashboard:e,content:n,className:r="dashboard",config:a,fullScreenPanelID:o,setFullScreenPanelID:l})=>{Wa(a);const{data:u=[]}=X.useRequest(fr),{data:c=[]}=X.useRequest(ja),d=y.useMemo(()=>_i(e,n,u,c,t),[e,n]);Qa(d.content,!1),y.useEffect(()=>{d.context.replace(t)},[t]),y.useEffect(()=>{d.datasources.replace(u)},[u]),y.useEffect(()=>{d.globalSQLSnippets.replace(c)},[c]);const f=X.useCreation(mi,[]),p=Di(f);return i(Ke.ModalsProvider,{children:i(mr,{value:d,children:i(gr,{value:d.content,children:i(_r.Provider,{value:{fullScreenPanelID:o,setFullScreenPanelID:l},children:i(ft.Provider,{value:{layoutFrozen:!0,freezeLayout:v.noop,inEditMode:!1},children:i(s.Box,{className:`${r} dashboard-root`,children:i(at.Provider,{value:f,children:i(Hn,{configure:p,children:d.content.views.visibleViews.map(g=>i(nr,{view:g},g.id))})})})})})})})})});var Pi={},lk={get exports(){return Pi},set exports(t){Pi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype,o=a.format;a.format=function(l){var u=this,c=this.$locale();if(!this.isValid())return o.bind(this)(l);var d=this.$utils(),f=(l||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(p){switch(p){case"Q":return Math.ceil((u.$M+1)/3);case"Do":return c.ordinal(u.$D);case"gggg":return u.weekYear();case"GGGG":return u.isoWeekYear();case"wo":return c.ordinal(u.week(),"W");case"w":case"ww":return d.s(u.week(),p==="w"?1:2,"0");case"W":case"WW":return d.s(u.isoWeek(),p==="W"?1:2,"0");case"k":case"kk":return d.s(String(u.$H===0?24:u.$H),p==="k"?1:2,"0");case"X":return Math.floor(u.$d.getTime()/1e3);case"x":return u.$d.getTime();case"z":return"["+u.offsetName()+"]";case"zzz":return"["+u.offsetName("long")+"]";default:return p}});return o.bind(this)(f)}}})})(lk);const uk=Pi;var Bi={},ck={get exports(){return Bi},set exports(t){Bi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o=r.prototype,l=function(c){var d=c.date,f=c.utc;return Array.isArray(d)?f?d.length?new Date(Date.UTC.apply(null,d)):new Date:d.length===1?a(String(d[0])).toDate():new(Function.prototype.bind.apply(Date,[null].concat(d))):d},u=o.parse;o.parse=function(c){c.date=l.bind(this)(c),u.bind(this)(c)}}})})(ck);const dk=Bi;var Vi={},pk={get exports(){return Vi},set exports(t){Vi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype;a.$g=function(g,m,C){return this.$utils().u(g)?this[m]:this.$set(C,g)},a.set=function(g,m){return this.$set(g,m)};var o=a.startOf;a.startOf=function(g,m){return this.$d=o.bind(this)(g,m).toDate(),this.init(),this};var l=a.add;a.add=function(g,m){return this.$d=l.bind(this)(g,m).toDate(),this.init(),this};var u=a.locale;a.locale=function(g,m){return g?(this.$L=u.bind(this)(g,m).$L,this):this.$L};var c=a.daysInMonth;a.daysInMonth=function(){return c.bind(this.clone())()};var d=a.isSame;a.isSame=function(g,m){return d.bind(this.clone())(g,m)};var f=a.isBefore;a.isBefore=function(g,m){return f.bind(this.clone())(g,m)};var p=a.isAfter;a.isAfter=function(g,m){return p.bind(this.clone())(g,m)}}})})(pk);const hk=Vi;var Ni={},fk={get exports(){return Ni},set exports(t){Ni=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype,o=a.format;a.format=function(l){var u=this,c=(l||"YYYY-MM-DDTHH:mm:ssZ").replace(/(\[[^\]]+])|BBBB|BB/g,function(d,f){var p,g=String(u.$y+543),m=d==="BB"?[g.slice(-2),2]:[g,4];return f||(p=u.$utils()).s.apply(p,m.concat(["0"]))});return o.bind(this)(c)}}})})(fk);const gk=Ni;var qi={},mk={get exports(){return qi},set exports(t){qi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o="h:mm A",l={lastDay:"[Yesterday at] "+o,sameDay:"[Today at] "+o,nextDay:"[Tomorrow at] "+o,nextWeek:"dddd [at] "+o,lastWeek:"[Last] dddd [at] "+o,sameElse:"MM/DD/YYYY"};r.prototype.calendar=function(u,c){var d=c||this.$locale().calendar||l,f=a(u||void 0).startOf("d"),p=this.diff(f,"d",!0),g="sameElse",m=p<-6?g:p<-1?"lastWeek":p<0?"lastDay":p<1?"sameDay":p<2?"nextDay":p<7?"nextWeek":g,C=d[m]||l[m];return typeof C=="function"?C.call(this,a()):this.format(C)}}})})(mk);const yk=qi;var Fi={},bk={get exports(){return Fi},set exports(t){Fi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,a=/\d\d/,o=/\d\d?/,l=/\d*[^-_:/,()\s\d]+/,u={},c=function(w){return(w=+w)+(w>68?1900:2e3)},d=function(w){return function(_){this[w]=+_}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(w){(this.zone||(this.zone={})).offset=function(_){if(!_||_==="Z")return 0;var T=_.match(/([+-]|\d\d)/g),I=60*T[1]+(+T[2]||0);return I===0?0:T[0]==="+"?-I:I}(w)}],p=function(w){var _=u[w];return _&&(_.indexOf?_:_.s.concat(_.f))},g=function(w,_){var T,I=u.meridiem;if(I){for(var O=1;O<=24;O+=1)if(w.indexOf(I(O,0,_))>-1){T=O>12;break}}else T=w===(_?"pm":"PM");return T},m={A:[l,function(w){this.afternoon=g(w,!1)}],a:[l,function(w){this.afternoon=g(w,!0)}],S:[/\d/,function(w){this.milliseconds=100*+w}],SS:[a,function(w){this.milliseconds=10*+w}],SSS:[/\d{3}/,function(w){this.milliseconds=+w}],s:[o,d("seconds")],ss:[o,d("seconds")],m:[o,d("minutes")],mm:[o,d("minutes")],H:[o,d("hours")],h:[o,d("hours")],HH:[o,d("hours")],hh:[o,d("hours")],D:[o,d("day")],DD:[a,d("day")],Do:[l,function(w){var _=u.ordinal,T=w.match(/\d+/);if(this.day=T[0],_)for(var I=1;I<=31;I+=1)_(I).replace(/\[|\]/g,"")===w&&(this.day=I)}],M:[o,d("month")],MM:[a,d("month")],MMM:[l,function(w){var _=p("months"),T=(p("monthsShort")||_.map(function(I){return I.slice(0,3)})).indexOf(w)+1;if(T<1)throw new Error;this.month=T%12||T}],MMMM:[l,function(w){var _=p("months").indexOf(w)+1;if(_<1)throw new Error;this.month=_%12||_}],Y:[/[+-]?\d+/,d("year")],YY:[a,function(w){this.year=c(w)}],YYYY:[/\d{4}/,d("year")],Z:f,ZZ:f};function C(w){var _,T;_=w,T=u&&u.formats;for(var I=(w=_.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(U,Y,Z){var oe=Z&&Z.toUpperCase();return Y||T[Z]||n[Z]||T[oe].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(ue,ye,De){return ye||De.slice(1)})})).match(r),O=I.length,B=0;B<O;B+=1){var $=I[B],A=m[$],E=A&&A[0],F=A&&A[1];I[B]=F?{regex:E,parser:F}:$.replace(/^\[|\]$/g,"")}return function(U){for(var Y={},Z=0,oe=0;Z<O;Z+=1){var ue=I[Z];if(typeof ue=="string")oe+=ue.length;else{var ye=ue.regex,De=ue.parser,ge=U.slice(oe),xe=ye.exec(ge)[0];De.call(Y,xe),U=U.replace(xe,"")}}return function(be){var Oe=be.afternoon;if(Oe!==void 0){var Ye=be.hours;Oe?Ye<12&&(be.hours+=12):Ye===12&&(be.hours=0),delete be.afternoon}}(Y),Y}}return function(w,_,T){T.p.customParseFormat=!0,w&&w.parseTwoDigitYear&&(c=w.parseTwoDigitYear);var I=_.prototype,O=I.parse;I.parse=function(B){var $=B.date,A=B.utc,E=B.args;this.$u=A;var F=E[1];if(typeof F=="string"){var U=E[2]===!0,Y=E[3]===!0,Z=U||Y,oe=E[2];Y&&(oe=E[2]),u=this.$locale(),!U&&oe&&(u=T.Ls[oe]),this.$d=function(ge,xe,be){try{if(["x","X"].indexOf(xe)>-1)return new Date((xe==="X"?1e3:1)*ge);var Oe=C(xe)(ge),Ye=Oe.year,At=Oe.month,or=Oe.day,lr=Oe.hours,ma=Oe.minutes,ya=Oe.seconds,ln=Oe.milliseconds,Ft=Oe.zone,wt=new Date,zt=or||(Ye||At?1:wt.getDate()),Ct=Ye||wt.getFullYear(),Gt=0;Ye&&!At||(Gt=At>0?At-1:wt.getMonth());var Wt=lr||0,un=ma||0,cn=ya||0,St=ln||0;return Ft?new Date(Date.UTC(Ct,Gt,zt,Wt,un,cn,St+60*Ft.offset*1e3)):be?new Date(Date.UTC(Ct,Gt,zt,Wt,un,cn,St)):new Date(Ct,Gt,zt,Wt,un,cn,St)}catch{return new Date("")}}($,F,A),this.init(),oe&&oe!==!0&&(this.$L=this.locale(oe).$L),Z&&$!=this.format(F)&&(this.$d=new Date("")),u={}}else if(F instanceof Array)for(var ue=F.length,ye=1;ye<=ue;ye+=1){E[1]=F[ye-1];var De=T.apply(this,E);if(De.isValid()){this.$d=De.$d,this.$L=De.$L,this.init();break}ye===ue&&(this.$d=new Date(""))}else O.call(this,B)}}})})(bk);const vk=Fi;var Gi={},xk={get exports(){return Gi},set exports(t){Gi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.dayOfYear=function(o){var l=Math.round((a(this).startOf("day")-a(this).startOf("year"))/864e5)+1;return o==null?l:this.add(o-l,"day")}}})})(xk);const wk=Gi;var Wi={},Ck={get exports(){return Wi},set exports(t){Wi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n,r,a=1e3,o=6e4,l=36e5,u=864e5,c=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d=31536e6,f=2592e6,p=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,g={years:d,months:f,days:u,hours:l,minutes:o,seconds:a,milliseconds:1,weeks:6048e5},m=function($){return $ instanceof B},C=function($,A,E){return new B($,E,A.$l)},w=function($){return r.p($)+"s"},_=function($){return $<0},T=function($){return _($)?Math.ceil($):Math.floor($)},I=function($){return Math.abs($)},O=function($,A){return $?_($)?{negative:!0,format:""+I($)+A}:{negative:!1,format:""+$+A}:{negative:!1,format:""}},B=function(){function $(E,F,U){var Y=this;if(this.$d={},this.$l=U,E===void 0&&(this.$ms=0,this.parseFromMilliseconds()),F)return C(E*g[w(F)],this);if(typeof E=="number")return this.$ms=E,this.parseFromMilliseconds(),this;if(typeof E=="object")return Object.keys(E).forEach(function(ue){Y.$d[w(ue)]=E[ue]}),this.calMilliseconds(),this;if(typeof E=="string"){var Z=E.match(p);if(Z){var oe=Z.slice(2).map(function(ue){return ue!=null?Number(ue):0});return this.$d.years=oe[0],this.$d.months=oe[1],this.$d.weeks=oe[2],this.$d.days=oe[3],this.$d.hours=oe[4],this.$d.minutes=oe[5],this.$d.seconds=oe[6],this.calMilliseconds(),this}}return this}var A=$.prototype;return A.calMilliseconds=function(){var E=this;this.$ms=Object.keys(this.$d).reduce(function(F,U){return F+(E.$d[U]||0)*g[U]},0)},A.parseFromMilliseconds=function(){var E=this.$ms;this.$d.years=T(E/d),E%=d,this.$d.months=T(E/f),E%=f,this.$d.days=T(E/u),E%=u,this.$d.hours=T(E/l),E%=l,this.$d.minutes=T(E/o),E%=o,this.$d.seconds=T(E/a),E%=a,this.$d.milliseconds=E},A.toISOString=function(){var E=O(this.$d.years,"Y"),F=O(this.$d.months,"M"),U=+this.$d.days||0;this.$d.weeks&&(U+=7*this.$d.weeks);var Y=O(U,"D"),Z=O(this.$d.hours,"H"),oe=O(this.$d.minutes,"M"),ue=this.$d.seconds||0;this.$d.milliseconds&&(ue+=this.$d.milliseconds/1e3);var ye=O(ue,"S"),De=E.negative||F.negative||Y.negative||Z.negative||oe.negative||ye.negative,ge=Z.format||oe.format||ye.format?"T":"",xe=(De?"-":"")+"P"+E.format+F.format+Y.format+ge+Z.format+oe.format+ye.format;return xe==="P"||xe==="-P"?"P0D":xe},A.toJSON=function(){return this.toISOString()},A.format=function(E){var F=E||"YYYY-MM-DDTHH:mm:ss",U={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return F.replace(c,function(Y,Z){return Z||String(U[Y])})},A.as=function(E){return this.$ms/g[w(E)]},A.get=function(E){var F=this.$ms,U=w(E);return U==="milliseconds"?F%=1e3:F=U==="weeks"?T(F/g[U]):this.$d[U],F===0?0:F},A.add=function(E,F,U){var Y;return Y=F?E*g[w(F)]:m(E)?E.$ms:C(E,this).$ms,C(this.$ms+Y*(U?-1:1),this)},A.subtract=function(E,F){return this.add(E,F,!0)},A.locale=function(E){var F=this.clone();return F.$l=E,F},A.clone=function(){return C(this.$ms,this)},A.humanize=function(E){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!E)},A.milliseconds=function(){return this.get("milliseconds")},A.asMilliseconds=function(){return this.as("milliseconds")},A.seconds=function(){return this.get("seconds")},A.asSeconds=function(){return this.as("seconds")},A.minutes=function(){return this.get("minutes")},A.asMinutes=function(){return this.as("minutes")},A.hours=function(){return this.get("hours")},A.asHours=function(){return this.as("hours")},A.days=function(){return this.get("days")},A.asDays=function(){return this.as("days")},A.weeks=function(){return this.get("weeks")},A.asWeeks=function(){return this.as("weeks")},A.months=function(){return this.get("months")},A.asMonths=function(){return this.as("months")},A.years=function(){return this.get("years")},A.asYears=function(){return this.as("years")},$}();return function($,A,E){n=E,r=E().$utils(),E.duration=function(Y,Z){var oe=E.locale();return C(Y,{$l:oe},Z)},E.isDuration=m;var F=A.prototype.add,U=A.prototype.subtract;A.prototype.add=function(Y,Z){return m(Y)&&(Y=Y.asMilliseconds()),F.bind(this)(Y,Z)},A.prototype.subtract=function(Y,Z){return m(Y)&&(Y=Y.asMilliseconds()),U.bind(this)(Y,Z)}}})})(Ck);const Sk=Wi;var ji={},_k={get exports(){return ji},set exports(t){ji=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.isBetween=function(o,l,u,c){var d=a(o),f=a(l),p=(c=c||"()")[0]==="(",g=c[1]===")";return(p?this.isAfter(d,u):!this.isBefore(d,u))&&(g?this.isBefore(f,u):!this.isAfter(f,u))||(p?this.isBefore(d,u):!this.isAfter(d,u))&&(g?this.isAfter(f,u):!this.isBefore(f,u))}}})})(_k);const kk=ji;var Ri={},Tk={get exports(){return Ri},set exports(t){Ri=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(Tk);const Dk=Ri;var Yi={},Mk={get exports(){return Yi},set exports(t){Yi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){a.isMoment=function(o){return a.isDayjs(o)}}})})(Mk);const Ik=Yi;var Qi={},Ek={get exports(){return Qi},set exports(t){Qi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n="day";return function(r,a,o){var l=function(d){return d.add(4-d.isoWeekday(),n)},u=a.prototype;u.isoWeekYear=function(){return l(this).year()},u.isoWeek=function(d){if(!this.$utils().u(d))return this.add(7*(d-this.isoWeek()),n);var f,p,g,m,C=l(this),w=(f=this.isoWeekYear(),p=this.$u,g=(p?o.utc:o)().year(f).startOf("year"),m=4-g.isoWeekday(),g.isoWeekday()>4&&(m+=7),g.add(m,n));return C.diff(w,"week")+1},u.isoWeekday=function(d){return this.$utils().u(d)?this.day()||7:this.day(this.day()%7?d:d-7)};var c=u.startOf;u.startOf=function(d,f){var p=this.$utils(),g=!!p.u(f)||f;return p.p(d)==="isoweek"?g?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):c.bind(this)(d,f)}}})})(Ek);const Ak=Qi;var Ki={},zk={get exports(){return Ki},set exports(t){Ki=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.isoWeeksInYear=function(){var a=this.isLeapYear(),o=this.endOf("y").day();return o===4||a&&o===5?53:52}}})})(zk);const $k=Ki;var Ui={},Lk={get exports(){return Ui},set exports(t){Ui=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.isSameOrAfter=function(a,o){return this.isSame(a,o)||this.isAfter(a,o)}}})})(Lk);const Ok=Ui;var Xi={},Pk={get exports(){return Xi},set exports(t){Xi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.isSameOrBefore=function(a,o){return this.isSame(a,o)||this.isBefore(a,o)}}})})(Pk);const Bk=Xi;var Ji={},Vk={get exports(){return Ji},set exports(t){Ji=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.isToday=function(){var o="YYYY-MM-DD",l=a();return this.format(o)===l.format(o)}}})})(Vk);const Nk=Ji;var Zi={},qk={get exports(){return Zi},set exports(t){Zi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.isTomorrow=function(){var o="YYYY-MM-DD",l=a().add(1,"day");return this.format(o)===l.format(o)}}})})(qk);const Fk=Zi;var Hi={},Gk={get exports(){return Hi},set exports(t){Hi=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){r.prototype.isYesterday=function(){var o="YYYY-MM-DD",l=a().subtract(1,"day");return this.format(o)===l.format(o)}}})})(Gk);const Wk=Hi;var ea={},jk={get exports(){return ea},set exports(t){ea=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o=r.prototype,l=function(p){return p&&(p.indexOf?p:p.s)},u=function(p,g,m,C,w){var _=p.name?p:p.$locale(),T=l(_[g]),I=l(_[m]),O=T||I.map(function($){return $.slice(0,C)});if(!w)return O;var B=_.weekStart;return O.map(function($,A){return O[(A+(B||0))%7]})},c=function(){return a.Ls[a.locale()]},d=function(p,g){return p.formats[g]||function(m){return m.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(C,w,_){return w||_.slice(1)})}(p.formats[g.toUpperCase()])},f=function(){var p=this;return{months:function(g){return g?g.format("MMMM"):u(p,"months")},monthsShort:function(g){return g?g.format("MMM"):u(p,"monthsShort","months",3)},firstDayOfWeek:function(){return p.$locale().weekStart||0},weekdays:function(g){return g?g.format("dddd"):u(p,"weekdays")},weekdaysMin:function(g){return g?g.format("dd"):u(p,"weekdaysMin","weekdays",2)},weekdaysShort:function(g){return g?g.format("ddd"):u(p,"weekdaysShort","weekdays",3)},longDateFormat:function(g){return d(p.$locale(),g)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return f.bind(this)()},a.localeData=function(){var p=c();return{firstDayOfWeek:function(){return p.weekStart||0},weekdays:function(){return a.weekdays()},weekdaysShort:function(){return a.weekdaysShort()},weekdaysMin:function(){return a.weekdaysMin()},months:function(){return a.months()},monthsShort:function(){return a.monthsShort()},longDateFormat:function(g){return d(p,g)},meridiem:p.meridiem,ordinal:p.ordinal}},a.months=function(){return u(c(),"months")},a.monthsShort=function(){return u(c(),"monthsShort","months",3)},a.weekdays=function(p){return u(c(),"weekdays",null,null,p)},a.weekdaysShort=function(p){return u(c(),"weekdaysShort","weekdays",3,p)},a.weekdaysMin=function(p){return u(c(),"weekdaysMin","weekdays",2,p)}}})})(jk);const Rk=ea;var ta={},Yk={get exports(){return ta},set exports(t){ta=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,a,o){var l=a.prototype,u=l.format;o.en.formats=n,l.format=function(c){c===void 0&&(c="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,f=function(p,g){return p.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(m,C,w){var _=w&&w.toUpperCase();return C||g[w]||n[w]||g[_].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(T,I,O){return I||O.slice(1)})})}(c,d===void 0?{}:d);return u.call(this,f)}}})})(Yk);const Qk=ta;var na={},Kk={get exports(){return na},set exports(t){na=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o=function(l,u){if(!u||!u.length||!u[0]||u.length===1&&!u[0].length)return null;var c;u.length===1&&u[0].length>0&&(u=u[0]),c=u[0];for(var d=1;d<u.length;d+=1)u[d].isValid()&&!u[d][l](c)||(c=u[d]);return c};a.max=function(){var l=[].slice.call(arguments,0);return o("isAfter",l)},a.min=function(){var l=[].slice.call(arguments,0);return o("isBefore",l)}}})})(Kk);const Uk=na;var ra={},Xk={get exports(){return ra},set exports(t){ra=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){var o=r.prototype,l=function(g){var m,C=g.date,w=g.utc,_={};if(!((m=C)instanceof Date||m instanceof Array||o.$utils().u(m)||m.constructor.name!=="Object")){if(!Object.keys(C).length)return new Date;var T=w?a.utc():a();Object.keys(C).forEach(function(U){var Y,Z;_[Y=U,Z=o.$utils().p(Y),Z==="date"?"day":Z]=C[U]});var I=_.day||(_.year||_.month>=0?1:T.date()),O=_.year||T.year(),B=_.month>=0?_.month:_.year||_.day?0:T.month(),$=_.hour||0,A=_.minute||0,E=_.second||0,F=_.millisecond||0;return w?new Date(Date.UTC(O,B,I,$,A,E,F)):new Date(O,B,I,$,A,E,F)}return C},u=o.parse;o.parse=function(g){g.date=l.bind(this)(g),u.bind(this)(g)};var c=o.set,d=o.add,f=o.subtract,p=function(g,m,C,w){w===void 0&&(w=1);var _=Object.keys(m),T=this;return _.forEach(function(I){T=g.bind(T)(m[I]*w,I)}),T};o.set=function(g,m){return m=m===void 0?g:m,g.constructor.name==="Object"?p.bind(this)(function(C,w){return c.bind(this)(w,C)},m,g):c.bind(this)(g,m)},o.add=function(g,m){return g.constructor.name==="Object"?p.bind(this)(d,g,m):d.bind(this)(g,m)},o.subtract=function(g,m){return g.constructor.name==="Object"?p.bind(this)(d,g,m,-1):f.bind(this)(g,m)}}})})(Xk);const Jk=ra;var ia={},Zk={get exports(){return ia},set exports(t){ia=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype;["milliseconds","seconds","minutes","hours","days","weeks","isoWeeks","months","quarters","years","dates"].forEach(function(o){a[o]=a[o.replace(/s$/,"")]})}})})(Zk);const Hk=ia;var aa={},eT={get exports(){return aa},set exports(t){aa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){var a=r.prototype.parse;r.prototype.parse=function(u){if(typeof u.date=="string"){var c=this.$locale();u.date=c&&c.preparse?c.preparse(u.date):u.date}return a.bind(this)(u)};var o=r.prototype.format;r.prototype.format=function(){for(var u=arguments.length,c=new Array(u),d=0;d<u;d++)c[d]=arguments[d];var f=o.call.apply(o,[this].concat(c)),p=this.$locale();return p&&p.postformat?p.postformat(f):f};var l=r.prototype.fromToBase;l&&(r.prototype.fromToBase=function(u,c,d,f){var p=this.$locale()||d.$locale();return l.call(this,u,c,d,f,p&&p.postformat)})}})})(eT);const tT=aa;var sa={},nT={get exports(){return sa},set exports(t){sa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n="month",r="quarter";return function(a,o){var l=o.prototype;l.quarter=function(d){return this.$utils().u(d)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(d-1))};var u=l.add;l.add=function(d,f){return d=Number(d),this.$utils().p(f)===r?this.add(3*d,n):u.bind(this)(d,f)};var c=l.startOf;l.startOf=function(d,f){var p=this.$utils(),g=!!p.u(f)||f;if(p.p(d)===r){var m=this.quarter()-1;return g?this.month(3*m).startOf(n).startOf("day"):this.month(3*m+2).endOf(n).endOf("day")}return c.bind(this)(d,f)}}})})(nT);const rT=sa;var oa={},iT={get exports(){return oa},set exports(t){oa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){n=n||{};var o=r.prototype,l={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function u(d,f,p,g){return o.fromToBase(d,f,p,g)}a.en.relativeTime=l,o.fromToBase=function(d,f,p,g,m){for(var C,w,_,T=p.$locale().relativeTime||l,I=n.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],O=I.length,B=0;B<O;B+=1){var $=I[B];$.d&&(C=g?a(d).diff(p,$.d,!0):p.diff(d,$.d,!0));var A=(n.rounding||Math.round)(Math.abs(C));if(_=C>0,A<=$.r||!$.r){A<=1&&B>0&&($=I[B-1]);var E=T[$.l];m&&(A=m(""+A)),w=typeof E=="string"?E.replace("%d",A):E(A,f,$.l,_);break}}if(f)return w;var F=_?T.future:T.past;return typeof F=="function"?F(w):F.replace("%s",w)},o.to=function(d,f){return u(d,f,this,!0)},o.from=function(d,f){return u(d,f,this)};var c=function(d){return d.$u?a.utc():a()};o.toNow=function(d){return this.to(c(this),d)},o.fromNow=function(d){return this.from(c(this),d)}}})})(iT);const aT=oa;var la={},sT={get exports(){return la},set exports(t){la=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function(a,o,l){var u,c=function(g,m,C){C===void 0&&(C={});var w=new Date(g),_=function(T,I){I===void 0&&(I={});var O=I.timeZoneName||"short",B=T+"|"+O,$=r[B];return $||($=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:T,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:O}),r[B]=$),$}(m,C);return _.formatToParts(w)},d=function(g,m){for(var C=c(g,m),w=[],_=0;_<C.length;_+=1){var T=C[_],I=T.type,O=T.value,B=n[I];B>=0&&(w[B]=parseInt(O,10))}var $=w[3],A=$===24?0:$,E=w[0]+"-"+w[1]+"-"+w[2]+" "+A+":"+w[4]+":"+w[5]+":000",F=+g;return(l.utc(E).valueOf()-(F-=F%1e3))/6e4},f=o.prototype;f.tz=function(g,m){g===void 0&&(g=u);var C=this.utcOffset(),w=this.toDate(),_=w.toLocaleString("en-US",{timeZone:g}),T=Math.round((w-new Date(_))/1e3/60),I=l(_).$set("millisecond",this.$ms).utcOffset(15*-Math.round(w.getTimezoneOffset()/15)-T,!0);if(m){var O=I.utcOffset();I=I.add(C-O,"minute")}return I.$x.$timezone=g,I},f.offsetName=function(g){var m=this.$x.$timezone||l.tz.guess(),C=c(this.valueOf(),m,{timeZoneName:g}).find(function(w){return w.type.toLowerCase()==="timezonename"});return C&&C.value};var p=f.startOf;f.startOf=function(g,m){if(!this.$x||!this.$x.$timezone)return p.call(this,g,m);var C=l(this.format("YYYY-MM-DD HH:mm:ss:SSS"));return p.call(C,g,m).tz(this.$x.$timezone,!0)},l.tz=function(g,m,C){var w=C&&m,_=C||m||u,T=d(+l(),_);if(typeof g!="string")return l(g).tz(_);var I=function(A,E,F){var U=A-60*E*1e3,Y=d(U,F);if(E===Y)return[U,E];var Z=d(U-=60*(Y-E)*1e3,F);return Y===Z?[U,Y]:[A-60*Math.min(Y,Z)*1e3,Math.max(Y,Z)]}(l.utc(g,w).valueOf(),T,_),O=I[0],B=I[1],$=l(O).utcOffset(B);return $.$x.$timezone=_,$},l.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},l.tz.setDefault=function(g){u=g}}})})(sT);const oT=la;var ua={},lT={get exports(){return ua},set exports(t){ua=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]}}})})(lT);const uT=ua;var ca={},cT={get exports(){return ca},set exports(t){ca=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.toObject=function(){return{years:this.$y,months:this.$M,date:this.$D,hours:this.$H,minutes:this.$m,seconds:this.$s,milliseconds:this.$ms}}}})})(cT);const dT=ca;var da={},pT={get exports(){return da},set exports(t){da=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r,a){a.updateLocale=function(o,l){var u=a.Ls[o];if(u)return(l?Object.keys(l):[]).forEach(function(c){u[c]=l[c]}),u}}})})(pT);const hT=da;var pa={},fT={get exports(){return pa},set exports(t){pa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g;return function(o,l,u){var c=l.prototype;u.utc=function(w){var _={date:w,utc:!0,args:arguments};return new l(_)},c.utc=function(w){var _=u(this.toDate(),{locale:this.$L,utc:!0});return w?_.add(this.utcOffset(),n):_},c.local=function(){return u(this.toDate(),{locale:this.$L,utc:!1})};var d=c.parse;c.parse=function(w){w.utc&&(this.$u=!0),this.$utils().u(w.$offset)||(this.$offset=w.$offset),d.call(this,w)};var f=c.init;c.init=function(){if(this.$u){var w=this.$d;this.$y=w.getUTCFullYear(),this.$M=w.getUTCMonth(),this.$D=w.getUTCDate(),this.$W=w.getUTCDay(),this.$H=w.getUTCHours(),this.$m=w.getUTCMinutes(),this.$s=w.getUTCSeconds(),this.$ms=w.getUTCMilliseconds()}else f.call(this)};var p=c.utcOffset;c.utcOffset=function(w,_){var T=this.$utils().u;if(T(w))return this.$u?0:T(this.$offset)?p.call(this):this.$offset;if(typeof w=="string"&&(w=function($){$===void 0&&($="");var A=$.match(r);if(!A)return null;var E=(""+A[0]).match(a)||["-",0,0],F=E[0],U=60*+E[1]+ +E[2];return U===0?0:F==="+"?U:-U}(w),w===null))return this;var I=Math.abs(w)<=16?60*w:w,O=this;if(_)return O.$offset=I,O.$u=w===0,O;if(w!==0){var B=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(O=this.local().add(I+B,n)).$offset=I,O.$x.$localOffset=B}else O=this.utc();return O};var g=c.format;c.format=function(w){var _=w||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return g.call(this,_)},c.valueOf=function(){var w=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*w},c.isUTC=function(){return!!this.$u},c.toISOString=function(){return this.toDate().toISOString()},c.toString=function(){return this.toDate().toUTCString()};var m=c.toDate;c.toDate=function(w){return w==="s"&&this.$offset?u(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():m.call(this)};var C=c.diff;c.diff=function(w,_,T){if(w&&this.$u===w.$u)return C.call(this,w,_,T);var I=this.local(),O=u(w).local();return C.call(I,O,_,T)}}})})(fT);const gT=pa;var ha={},mT={get exports(){return ha},set exports(t){ha=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.weekday=function(a){var o=this.$locale().weekStart||0,l=this.$W,u=(l<o?l+7:l)-o;return this.$utils().u(a)?u:this.subtract(u,"day").add(a,"day")}}})})(mT);const yT=ha;var fa={},bT={get exports(){return fa},set exports(t){fa=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){var n="week",r="year";return function(a,o,l){var u=o.prototype;u.week=function(c){if(c===void 0&&(c=null),c!==null)return this.add(7*(c-this.week()),"day");var d=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var f=l(this).startOf(r).add(1,r).date(d),p=l(this).endOf(n);if(f.isBefore(p))return 1}var g=l(this).startOf(r).date(d).startOf(n).subtract(1,"millisecond"),m=this.diff(g,n,!0);return m<0?l(this).startOf("week").week():Math.ceil(m)},u.weeks=function(c){return c===void 0&&(c=null),this.week(c)}}})})(bT);const vT=fa;var ga={},xT={get exports(){return ga},set exports(t){ga=t}};(function(t,e){(function(n,r){t.exports=r()})(ne,function(){return function(n,r){r.prototype.weekYear=function(){var a=this.month(),o=this.week(),l=this.year();return o===1&&a===11?l+1:a===0&&o>=52?l-1:l}}})})(xT);const wT=ga;R.extend(uk),R.extend(dk),R.extend(hk),R.extend(gk),R.extend(yk),R.extend(vk),R.extend(wk),R.extend(Sk),R.extend(kk),R.extend(Dk),R.extend(Ik),R.extend(Ok),R.extend(Bk),R.extend(Nk),R.extend(Fk),R.extend(Wk),R.extend(Ak),R.extend($k),R.extend(Rk),R.extend(Qk),R.extend(Uk),R.extend(Jk),R.extend(Hk),R.extend(tT),R.extend(rT),R.extend(aT),R.extend(oT),R.extend(uT),R.extend(dT),R.extend(hT),R.extend(gT),R.extend(vT),R.extend(wT),R.extend(yT),R.tz.setDefault("UTC");const CT=()=>Promise.resolve().then(()=>sc).then(({version:t})=>(console.log(`[@devtable/dashboard] version: ${t}`),t));M.ContentModel=Zn,M.ContentModelContextProvider=gr,M.ContextModel=hs,M.DashboardEditor=sk,M.DashboardFilterType=wi,M.DashboardMode=Xo,M.DashboardModel=al,M.DashboardViewEditor=bl,M.DashboardViewRender=nr,M.EViewComponentType=H,M.FilterModel=br,M.FiltersModel=rs,M.FullScreenPanelContext=_r,M.LayoutStateContext=ft,M.ModelContextProvider=mr,M.Panel=tr,M.PanelContextProvider=Sr,M.PanelModel=Qo,M.PanelsModel=Uo,M.QueriesModel=cs,M.QueryModel=us,M.ReadOnlyDashboard=ok,M.SQLSnippetModel=ds,M.SQLSnippetsModel=ps,M.ViewComponentTypeBackground=Jo,M.ViewComponentTypeColor=pC,M.ViewComponentTypeName=dC,M.ViewModel=tl,M.ViewsModel=nl,M.applyPartialDashboard=xC,M.createContentModel=il,M.createDashboardModel=_i,M.createDashboardViewsModel=Si,M.getInitialFiltersPayload=is,M.getNewPanel=Ko,M.getVersion=CT,M.initialDashboardContent=hC,M.useContentModelContext=K,M.useFullScreenPanelContext=xs,M.useModelContext=he,M.usePanelContext=ze,M.useTopLevelServices=Di,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});