@devtable/dashboard 9.9.0 → 9.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-caller/index.d.ts +4 -12
- package/dist/dashboard.es.js +1138 -1137
- package/dist/dashboard.umd.js +3 -3
- package/dist/main/use-panel-full-screen.d.ts +4 -0
- package/dist/model/panels/index.d.ts +14 -0
- package/dist/model/panels/panel.d.ts +2 -0
- package/dist/model/queries/index.d.ts +3 -0
- package/dist/model/queries/query.d.ts +1 -0
- package/dist/plugins/plugin-context.d.ts +4 -0
- package/package.json +1 -1
package/dist/dashboard.umd.js
CHANGED
|
@@ -24,7 +24,7 @@ Check the render method of \``+_+"`."}return""}}function E1(_){{if(_!==void 0){v
|
|
|
24
24
|
|
|
25
25
|
Check your code at `+I+":"+E+"."}return""}}var io={};function L1(_){{var I=ro();if(!I){var E=typeof _=="string"?_:_.displayName||_.name;E&&(I=`
|
|
26
26
|
|
|
27
|
-
Check the top-level render call using <`+E+">.")}return I}}function ao(_,I){{if(!_._store||_._store.validated||_.key!=null)return;_._store.validated=!0;var E=L1(I);if(io[E])return;io[E]=!0;var R="";_&&_._owner&&_._owner!==ui.current&&(R=" It was passed a child from "+oe(_._owner.type)+"."),bt(_),$('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',E,R),bt(null)}}function so(_,I){{if(typeof _!="object")return;if(oi(_))for(var E=0;E<_.length;E++){var R=_[E];ci(R)&&ao(R,I)}else if(ci(_))_._store&&(_._store.validated=!0);else if(_){var ae=S(_);if(typeof ae=="function"&&ae!==_.entries)for(var ue=ae.call(_),ee;!(ee=ue.next()).done;)ci(ee.value)&&ao(ee.value,I)}}}function P1(_){{var I=_.type;if(I==null||typeof I=="string")return;var E;if(typeof I=="function")E=I.propTypes;else if(typeof I=="object"&&(I.$$typeof===d||I.$$typeof===g))E=I.propTypes;else return;if(E){var R=oe(I);C1(E,_.props,"prop",R,_)}else if(I.PropTypes!==void 0&&!di){di=!0;var ae=oe(I);$("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ae||"Unknown")}typeof I.getDefaultProps=="function"&&!I.getDefaultProps.isReactClassApproved&&$("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function O1(_){{for(var I=Object.keys(_.props),E=0;E<I.length;E++){var R=I[E];if(R!=="children"&&R!=="key"){bt(_),$("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",R),bt(null);break}}_.ref!==null&&(bt(_),$("Invalid attribute `ref` supplied to `React.Fragment`."),bt(null))}}function oo(_,I,E,R,ae,ue){{var ee=Q(_);if(!ee){var J="";(_===void 0||typeof _=="object"&&_!==null&&Object.keys(_).length===0)&&(J+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ie=E1(ae);Ie?J+=Ie:J+=ro();var me;_===null?me="null":oi(_)?me="array":_!==void 0&&_.$$typeof===t?(me="<"+(oe(_.type)||"Unknown")+" />",J=" Did you accidentally export a JSX literal instead of a component?"):me=typeof _,$("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",me,J)}var ye=z1(_,I,E,ae,ue);if(ye==null)return ye;if(ee){var Ee=I.children;if(Ee!==void 0)if(R)if(oi(Ee)){for(var yt=0;yt<Ee.length;yt++)so(Ee[yt],_);Object.freeze&&Object.freeze(Ee)}else $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else so(Ee,_)}return _===i?O1(ye):P1(ye),ye}}function V1(_,I,E){return oo(_,I,E,!0)}function B1(_,I,E){return oo(_,I,E,!1)}var N1=B1,G1=V1;wt.Fragment=i,wt.jsx=N1,wt.jsxs=G1}()),wt}(function(e){process.env.NODE_ENV==="production"?e.exports=Co():e.exports=wo()})(xo);const B=xt.Fragment,n=xt.jsx,c=xt.jsxs;function zi(e,t){m.useEffect(()=>{const r=i=>{console.log(i);const{viewID:s}=i.detail;if(!s){console.error(new Error("[Open View] Needs to pick a view first"));return}e.views.appendToVisibles(s),t&&e.views.setIDOfVIE(s)};return window.addEventListener("open-view",r),()=>{window.removeEventListener("open-view",r)}},[e,t]),m.useEffect(()=>{const r=i=>{console.log(i);const{dictionary:s,payload:o}=i.detail;if(!o||Object.keys(o).length===0){console.error(new Error("[Set Filter Values] payload is empty"));return}Object.entries(s).forEach(([u,l])=>{e.filters.setValueByKey(u,v.get(o,l))})};return window.addEventListener("set-filter-values",r),()=>{window.removeEventListener("set-filter-values",r)}},[e]),m.useEffect(()=>{function r(s){return Array.isArray(s)?[]:typeof s=="object"?{}:typeof s=="boolean"?!1:typeof s=="string"?"":typeof s=="number"?0:s}const i=s=>{console.log(s);const{filter_keys:o}=s.detail;o.forEach(u=>{const l=v.get(e.filters.values,u),d=r(l);console.log(`${u}: ${d}`),e.filters.setValueByKey(u,d)})};return window.addEventListener("clear-filter-values",i),()=>{window.removeEventListener("clear-filter-values",i)}},[e]),m.useEffect(()=>{const r=i=>{console.log(i);const{urlTemplate:s,openInNewTab:o,enableEncoding:u=!1,payload:l}=i.detail;if(!s){console.error(new Error("[Open Link] URL is empty"));return}function d(g){return v.cloneDeepWith(g,b=>{if(u&&typeof b=="string")return encodeURIComponent(b)})}const f=v.template(s||"")(d({...l,filters:e.payloadForSQL.filterValues,context:e.payloadForSQL.context}));window.open(f,o?"_blank":"_self","noopener")};return window.addEventListener("open-link",r),()=>{window.removeEventListener("open-link",r)}},[e])}class _o{constructor(t){O(this,"symbol");this.symbol=Symbol(t)}}function Ye(e){return new _o(e)}class mn{constructor(){O(this,"parent");O(this,"factoryRegistry",new Map);O(this,"instanceRegistry",new Map)}createScoped(){const t=new mn;return t.parent=this,t}getRequired(t){return this.get(t)}get(t){if(this.instanceRegistry.has(t.symbol))return this.instanceRegistry.get(t.symbol);const r=this.factoryRegistry.get(t.symbol);if(r){const i=r(this);return this.instanceRegistry.set(t.symbol,i),i}if(this.parent)return this.parent.get(t)}provideFactory(t,r){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,r),this}provideValue(t,r){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>r),this}dispose(){this.instanceRegistry.forEach(t=>{const r=v.get(t,"dispose");v.isFunction(r)&&r.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const bn=m.createContext(null);function Gt(e){const t=m.useContext(bn),r=Z.useCreation(()=>e.configure(t||new mn),[e.configure]),i=Z.usePrevious(r);return i&&i!==r&&i.dispose(),n(bn.Provider,{value:r,children:e.children})}function Ei(){return m.useContext(bn)}const So={viewPanelInFullScreen:v.noop,inFullScreen:!1},yn=m.createContext(So),Li=m.createContext(null),vn=Li.Provider;function ce(){const e=m.useContext(Li);if(!e)throw new Error("Please use ModelContextProvider");return e}const Pi=m.createContext(null),xn=Pi.Provider;function Y(){const e=m.useContext(Pi);if(!e)throw new Error("Please use ContentModelContextProvider");return e}const To={layoutFrozen:!1,freezeLayout:v.noop,inEditMode:!1},Ke=m.createContext(To),Oi=m.createContext({panel:null,data:[],loading:!1}),Cn=Oi.Provider;function Ce(){const e=m.useContext(Oi);if(!e.panel)throw new Error("Please use PanelContextProvider");return e}const ko={fullScreenPanelID:"",setFullScreenPanelID:v.noop},wn=m.createContext(ko);function Vi(){const e=m.useContext(wn);if(!e)throw new Error("Please use FullScreenPanelContext.Provider");return e}class ke extends m.Component{constructor(t){super(t),this.state={error:null}}componentDidCatch(t){this.setState({error:t})}render(){var t;if(this.state.error){const r=()=>{this.setState({error:null})};return c(a.Box,{children:[n(a.Text,{size:"xs",children:(t=this.state.error)==null?void 0:t.message}),n(a.Button,{variant:"subtle",size:"xs",mx:"auto",compact:!0,sx:{display:"block"},onClick:r,children:"Retry"})]})}return this.props.children}}const _n={fontSize:"14px",lineHeight:"32px",color:"#3D3E45",ul:{paddingLeft:"2em",margin:"6px 0 0"},p:{margin:0},a:{WebkitTapHighlightColor:"transparent",color:"rgb(34, 139, 230)",textDecoration:"none","&:hover":{textDecoration:"underline"},"&:active, &:hover":{outlineWidth:0}},table:{tr:{"th, td":{padding:"0 .5em"}}},"table.rich-text-table-render, div.tableWrapper table":{"th, td":{border:"1px solid #eaeaea"},"tr:last-of-type td":{borderBottom:"1px solid #eaeaea"}},".resize-cursor":{cursor:"col-resize"},details:{summary:{listStyle:"none",cursor:"pointer",transition:"color 300ms ease",userSelect:"none"},"summary::-webkit-details-marker":{display:"none"},"summary:hover":{color:"black","&::before":{opacity:1}},"summary::before":{content:'"►"',fontSize:"10px",margin:"0px 5px",opacity:.5,display:"inline-block",transition:"opacity 300ms ease, transform 300ms ease"}},"details[open] summary::before":{transform:"rotate(90deg)"},"details + details":{marginTop:"10px"}},qt=({value:e,styles:t={}})=>{const r=Si.useEditor({extensions:[Ti,_i,X.Link,mi,gi,hi,vi.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),wi,Ci,xi,bi.configure({types:["heading","paragraph"]}),fi.configure({placeholder:"This is placeholder"}),yi,pi.Color],content:e,editable:!1});m.useEffect(()=>{r==null||r.commands.setContent(e)},[e,r]);const i=m.useMemo(()=>v.defaultsDeep({},{content:_n},t),[t]);return n(X.RichTextEditor,{editor:r,styles:i,children:n(X.RichTextEditor.Content,{})})},Do=({description:e,isDescriptionEmpty:t})=>t?null:n(a.Tooltip,{color:"white",label:n(qt,{value:e,styles:{root:{border:"none"},content:{padding:0}}}),styles:{tooltip:{border:"0.0625rem solid rgb(233, 236, 239)",boxShadow:"rgb(0 0 0 / 5%) 0px 0.0625rem 0.1875rem, rgb(0 0 0 / 5%) 0px 1.25rem 1.5625rem -0.3125rem, rgb(0 0 0 / 4%) 0px 0.625rem 0.625rem -0.3125rem"}},withArrow:!0,children:n(a.Box,{sx:{height:"16px",alignSelf:"center"},children:n(V.IconInfoCircle,{size:16,color:"gray"})})}),Io=T.observer(({label:e,config:{default_value:t,description:r,isDescriptionEmpty:i,...s},value:o,onChange:u})=>c(a.Box,{children:[n(a.Text,{children:" "}),n(a.Checkbox,{label:c(a.Group,{noWrap:!0,position:"apart",align:"middle",spacing:6,children:[n(a.Box,{sx:{flexGrow:1},children:e}),n(Do,{description:r,isDescriptionEmpty:i})]}),checked:o||!1,onChange:l=>u(l.currentTarget.checked),...s,pt:".4em",styles:{input:{borderColor:"#e9ecef"}}})]})),Bi=T.observer(({label:e,config:t,value:r=[null,null],onChange:i})=>{const s=Array.isArray(r)?r.map(d=>d?j(d).toDate():null):[null,null],o=d=>{i(d.map(p=>p&&j(p).format(t.inputFormat)))},u=t.getMinDate(s[0]),l=t.getMaxDate(s[0]);return n(uo.DateRangePicker,{label:e,value:s,onChange:o,icon:n(k.Calendar,{size:16}),sx:{minWidth:"16em"},minDate:u,maxDate:l,styles:{input:{borderColor:"#e9ecef"}},...t})}),Mo=a.createStyles((e,{radius:t=4})=>({root:{borderRadius:e.fn.radius(t),display:"flex",flexWrap:"nowrap",border:"1px solid #ced4da",paddingLeft:"0px",paddingRight:"30px",backgroundColor:"#fff",transition:"border-color 100ms ease",borderColor:"#e9ecef","&.rc-select.rc-select-open":{borderColor:"#228be6 !important",".rc-select-selection-overflow-item-rest":{display:"none"},".rc-select-selection-overflow-item-suffix":{display:"block"}},".rc-select-selector":{height:"auto",lineHeight:1.55,paddingLeft:"12px",resize:"none",boxSizing:"border-box",fontSize:"14px",width:"100%",color:"#000",display:"block",textAlign:"left",minHeight:"36px",cursor:"pointer",flexGrow:1},".rc-select-selection-search-mirror":{display:"none"},".rc-select-selection-search":{flexGrow:1,width:"auto !important"},".rc-select-selection-overflow":{display:"flex",minHeight:"34px",alignItems:"center",flexWrap:"nowrap",marginLeft:"calc(-10px / 2)",boxSizing:"border-box"},".rc-select-selection-overflow-item":{display:"flex",alignItems:"center",backgroundColor:"#f1f3f5",color:"#495057",height:"24px",paddingLeft:"12px",paddingRight:"12px",fontWeight:500,fontSize:"12px",borderRadius:"4px",cursor:"default",userSelect:"none",maxWidth:"calc(100% - 20px)",margin:"calc(10px / 2 - 2px) calc(10px / 2)"},".rc-select-selection-overflow-item-rest":{cursor:"pointer"},".rc-select-selection-overflow-item-suffix":{display:"none",backgroundColor:"transparent",width:"100%",maxWidth:"100%",height:"28px",margin:0,paddingLeft:0,paddingRight:0},input:{flex:1,minWidth:"60px",backgroundColor:"transparent",border:0,outline:0,fontSize:"14px",padding:0,marginLeft:0,color:"inherit",height:"28px",lineHeight:"32px",cursor:"pointer",width:"100%","&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{display:"none"}},".rc-select-clear":{marginRight:"-24px",alignSelf:"center",cursor:"pointer"},"&.rc-select-disabled":{backgroundColor:"rgb(241, 243, 245)",color:"rgb(144, 146, 150)",opacity:.6,"&, .rc-select-selector, input":{cursor:"not-allowed"}}},label:{fontSize:e.fontSizes.sm,fontWeight:500,color:"#212529"},dropdown:{fontSize:e.fontSizes.xs,zIndex:300,backgroundColor:"#fff",border:"1px solid #e9ecef",marginTop:6,padding:0,boxShadow:"0 1px 3px rgb(0 0 0 / 5%), rgb(0 0 0 / 5%) 0px 10px 15px -5px, rgb(0 0 0 / 4%) 0px 7px 7px -5px",borderRadius:"4px","&.rc-select-dropdown-slide-up-leave-active":{display:"none"},".rc-select-item-empty":{padding:"8px 12px"},".rc-select-item-option":{boxSizing:"border-box",textAlign:"left",width:"100%",padding:"8px 12px 8px 2px",cursor:"pointer",fontSize:"14px",color:"#000",borderRadius:"4px",display:"flex",flexWrap:"nowrap",overflow:"hidden","&:hover":{backgroundColor:"#f1f3f5"},flexDirection:"row-reverse",".rc-select-item-option-state":{flexGrow:0,flexShrink:0,width:"30px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},".rc-select-item-option-content":{flexGrow:1}}}})),Ao=({disabled:e,classNames:t,styles:r,unstyled:i,radius:s,style:o,label:u,value:l,onChange:d,options:p})=>{const{classes:f,cx:g}=Mo({radius:s},{name:"MultiSelectWidget",classNames:t,styles:r,unstyled:i}),[h,b]=m.useState(!1),w=P=>{b(P)},C=h&&(l==null?void 0:l.length)>0,[S,M]=m.useState(""),$=m.useMemo(()=>{if(!S)return p;const P=S.toLowerCase(),q=L=>L.description.toLowerCase().includes(P)||L.label.toLowerCase().includes(P);return p.filter(q)},[S,p]);return c(a.Stack,{spacing:3,children:[c(a.Group,{position:"apart",children:[n(a.Text,{className:f.label,children:u}),C&&n(a.Tooltip,{label:`${l.length} selected`,children:n(a.Badge,{children:l.length})})]}),n(ki,{disabled:e,allowClear:!0,className:g(f.root,"check-select"),dropdownClassName:g(f.dropdown,""),onDropdownVisibleChange:w,transitionName:"rc-select-dropdown-slide-up",choiceTransitionName:"rc-select-selection__choice-zoom",style:o,clearIcon:()=>n(a.CloseButton,{}),value:l,onChange:d,onSelect:console.log,mode:"multiple",maxTagCount:0,maxTagTextLength:10,maxTagPlaceholder:P=>`${P.length} selected`,searchValue:S,onSearch:M,filterOption:!1,children:$.map(P=>n(ki.Option,{children:n(a.Group,{noWrap:!0,children:c("div",{children:[n(a.Text,{size:"sm","data-role":"label",children:P.label}),n(a.Text,{size:"xs",color:"dimmed","data-role":"description",children:P.description})]})})},P.value))})]})},$o=T.observer(({label:e,config:t,value:r,onChange:i})=>{const s=Y(),o=!!t.options_query_id,{state:u}=s.getDataStuffByID(t.options_query_id),l=u==="loading",d=t.min_width?t.min_width:"200px",p=o?l:!1;return n(Ao,{label:e,options:t.options,style:{minWidth:"160px",width:d,maxWidth:p?d:"unset",borderColor:"#e9ecef"},disabled:p,value:r,onChange:i})}),zo=m.forwardRef(({label:e,description:t,...r},i)=>n("div",{ref:i,...r,children:n(a.Group,{noWrap:!0,children:c("div",{children:[n(a.Text,{size:"sm","data-role":"label",children:e}),n(a.Text,{size:"xs",color:"dimmed","data-role":"description",children:t})]})})})),Eo=T.observer(({label:e,config:t,value:r,onChange:i})=>{const s=Y(),o=!!t.options_query_id,{state:u}=s.getDataStuffByID(t.options_query_id),l=u==="loading";return m.useEffect(()=>{var f;const{default_selection_count:d}=t;if(!d)return;const p=((f=t.options[0])==null?void 0:f.value)??"";console.log("Selecting the first option by default. New value: ",p),i(p,!0)},[t.default_selection_count,t.options]),n(a.Select,{label:e,data:t.options,disabled:o?l:!1,value:r,onChange:i,styles:{root:{width:t.width?t.width:"200px"},input:{borderColor:"#e9ecef"}},sx:{".mantine-Select-item[data-selected] .mantine-Text-root[data-role=description]":{color:"rgba(255,255,255,.7)"}},itemComponent:zo})});function Lo({label:e,config:t,value:r,onChange:i}){return n(a.TextInput,{label:e,value:r||"",onChange:s=>i(s.currentTarget.value),...t,styles:{input:{borderColor:"#e9ecef"}}})}const Po=({rotate:e,onClick:t})=>n("svg",{onClick:t,className:"caret-icon",viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"14px",height:"14px",fill:"currentColor","aria-hidden":"true",transform:`rotate(${e})`,children:n("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})}),Oo=({expanded:e,isLeaf:t,value:r,onClick:i,...s})=>(r==="0-0-value"&&console.log(s),t?n("span",{style:{width:"14px",display:"inline-block"}}):n(Po,{rotate:e?"0":"-90",onClick:i,...s})),Vo=({onClick:e})=>c("svg",{onClick:e,className:"checkbox-icon",width:"16",height:"16",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[n("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),n("rect",{className:"border",x:"4",y:"4",width:"16",height:"16",rx:"2"}),n("rect",{className:"checkmark-indeterminate",x:"8",y:"8",width:"8",height:"8",rx:"2",stroke:"none"}),n("path",{className:"checkmark-checked",d:"M9 12l2 2l4 -4"})]}),Bo=({onClick:e,...t})=>n(Vo,{onClick:e,...t}),No=a.createStyles((e,{radius:t=4})=>({root:{borderRadius:e.fn.radius(t),display:"flex",flexWrap:"nowrap",border:"1px solid #ced4da",paddingLeft:"0px",paddingRight:"30px",backgroundColor:"#fff",transition:"border-color 100ms ease",borderColor:"#e9ecef","&.rc-tree-select.rc-tree-select-open":{borderColor:"#228be6 !important",".rc-tree-select-selection-overflow-item-rest":{display:"none"},".rc-tree-select-selection-overflow-item-suffix":{display:"block"}},".rc-tree-select-selector":{height:"auto",lineHeight:1.55,paddingLeft:"12px",resize:"none",boxSizing:"border-box",fontSize:"14px",width:"100%",color:"#000",display:"block",textAlign:"left",minHeight:"36px",cursor:"pointer",flexGrow:1},".rc-tree-select-selection-search-mirror":{display:"none"},".rc-tree-select-selection-search":{flexGrow:1,width:"auto !important"},".rc-tree-select-selection-overflow":{display:"flex",minHeight:"34px",alignItems:"center",flexWrap:"nowrap",marginLeft:"calc(-10px / 2)",boxSizing:"border-box"},".rc-tree-select-selection-overflow-item":{display:"flex",alignItems:"center",backgroundColor:"#f1f3f5",color:"#495057",height:"24px",paddingLeft:"12px",paddingRight:"12px",fontWeight:500,fontSize:"12px",borderRadius:"4px",cursor:"default",userSelect:"none",maxWidth:"calc(100% - 20px)",margin:"calc(10px / 2 - 2px) calc(10px / 2)"},".rc-tree-select-selection-overflow-item-rest":{cursor:"pointer"},".rc-tree-select-selection-overflow-item-suffix":{display:"none",backgroundColor:"transparent",width:"100%",maxWidth:"100%",height:"28px",margin:0,paddingLeft:0,paddingRight:0},input:{flex:1,minWidth:"60px",backgroundColor:"transparent",border:0,outline:0,fontSize:"14px",padding:0,marginLeft:0,color:"inherit",height:"28px",lineHeight:"32px",cursor:"pointer",width:"100%","&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{display:"none"}},".rc-tree-select-clear":{marginRight:"-24px",alignSelf:"center",cursor:"pointer"},"&.rc-tree-select-disabled":{backgroundColor:"rgb(241, 243, 245)",color:"rgb(144, 146, 150)",opacity:.6,"&, .rc-tree-select-selector, input":{cursor:"not-allowed"}}},label:{fontSize:e.fontSizes.sm,fontWeight:500,color:"#212529"},dropdown:{fontSize:e.fontSizes.xs,zIndex:300,paddingTop:"6px","&.rc-tree-select-dropdown-slide-up-leave-active":{display:"none"},".rc-tree-select-tree-list .rc-tree-select-tree-list-holder":{},".rc-tree-select-tree-list, .rc-tree-select-empty":{backgroundColor:"#fff",border:"1px solid #e9ecef",padding:0,boxShadow:"0 1px 3px rgb(0 0 0 / 5%), rgb(0 0 0 / 5%) 0px 10px 15px -5px, rgb(0 0 0 / 4%) 0px 7px 7px -5px",borderRadius:"4px"},".rc-tree-select-empty":{padding:"8px 12px"},".rc-tree-select-tree-treenode":{boxSizing:"border-box",textAlign:"left",width:"100%",padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#000",borderRadius:"4px",display:"flex",flexWrap:"nowrap",overflow:"hidden","&:hover":{backgroundColor:"#f1f3f5"},"&.rc-tree-select-tree-treenode-checkbox-checked":{".rc-tree-select-tree-iconEle .checkbox-icon .checkmark-checked":{stroke:"rgb(64, 192, 87)",animation:"check 200ms linear forwards"}},"&.rc-tree-select-tree-treenode-checkbox-indeterminate":{".rc-tree-select-tree-iconEle .checkbox-icon .checkmark-indeterminate":{fill:"rgb(64, 192, 87)"}},".rc-tree-select-tree-switcher":{height:"16px",alignSelf:"center",paddingRight:"2px",transition:"color 200ms ease","&:hover":{color:"#228be6","svg.caret-icon":{color:"#228be6"}},"svg.caret-icon":{color:"#ced4da",transition:"all 200ms ease"}},".rc-tree-select-tree-node-content-wrapper":{display:"flex",flexWrap:"nowrap",overflow:"hidden",alignItems:"center",gap:"8px",transition:"color 200ms ease","&:hover":{color:"#228be6"}},".rc-tree-select-tree-iconEle":{height:"16px","svg .border":{stroke:"#ced4da"},".checkbox-icon .checkmark-indeterminate":{fill:"transparent",transition:"fill 200ms ease"},".checkbox-icon .checkmark-checked":{transform:"scale(1.2)",transformOrigin:"center center",strokeDasharray:10,strokeDashoffset:-10},"@keyframes check":{"0%":{strokeDashoffset:10},"100%":{strokeDashoffset:0}}},".rc-tree-select-tree-title":{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",".rc-tree-select-tree-title-desc":{fontSize:"12px",maxWidth:"100%",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},".rc-tree-select-tree-indent":{flexGrow:0,height:0,verticalAlign:"bottom"},".rc-tree-select-tree-indent-unit":{display:"inline-block",width:"1em"}}}})),Go=({disabled:e,classNames:t,styles:r,unstyled:i,radius:s,style:o,label:u,value:l,onChange:d,treeData:p})=>{const{classes:f,cx:g}=No({radius:s},{name:"FilterTreeSelectWidget",classNames:t,styles:r,unstyled:i}),[h,b]=m.useState(!1),w=S=>{b(S)},C=h&&(l==null?void 0:l.length)>0;return c(a.Stack,{spacing:3,children:[c(a.Group,{position:"apart",children:[n(a.Text,{className:f.label,children:u}),C&&n(a.Tooltip,{label:`${l.length} selected`,children:n(a.Badge,{children:l.length})})]}),n(Di,{disabled:e,allowClear:!0,className:g(f.root,"check-select"),dropdownClassName:g(f.dropdown,""),onDropdownVisibleChange:w,transitionName:"rc-tree-select-dropdown-slide-up",choiceTransitionName:"rc-tree-select-selection__choice-zoom",style:o,treeLine:!0,clearIcon:()=>n(a.CloseButton,{}),switcherIcon:Oo,treeIcon:Bo,maxTagTextLength:10,value:l,treeData:p,treeNodeFilterProp:"filterBasis",treeCheckable:!0,showCheckedStrategy:Di.SHOW_PARENT,onChange:d,onSelect:console.log,maxTagCount:0,maxTagPlaceholder:S=>`${S.length} selected`})]})},qo=T.observer(({label:e,config:t,value:r,onChange:i})=>{const{treeData:s,treeDataLoading:o}=t,u=t.min_width?t.min_width:"200px",d=!!t.options_query_id?o:!1;return n(Go,{disabled:d,style:{minWidth:"160px",width:u,maxWidth:d?u:"unset",borderColor:"#e9ecef"},value:r,onChange:p=>i(p,!1),treeData:s,label:e})}),Fo=T.observer(({filter:{type:e,config:t,key:r,...i},formFieldProps:s})=>{switch(e){case"select":return n(Eo,{...i,...s,config:t});case"multi-select":return n($o,{...i,...s,config:t});case"tree-select":return n(qo,{...i,...s,config:t});case"text-input":return n(Lo,{...i,...s,config:t});case"date-range":return n(Bi,{...i,...s,config:t});case"checkbox":return n(Io,{...i,...s,config:t});default:return null}}),Ni=T.observer(m.forwardRef(({filter:e,...t},r)=>n("div",{className:"filter-root",ref:r,children:n(ke,{children:n(Fo,{filter:e,formFieldProps:t})})}))),Gi=T.observer(function({view:t}){const r=Y(),{control:i,handleSubmit:s,reset:o}=x.useForm({defaultValues:r.filters.values,reValidateMode:"onBlur"}),u=x.useWatch({control:i});m.useEffect(()=>{o(r.filters.values)},[r.filters.values,o]),m.useEffect(()=>{r.filters.updatePreviewValues(u)},[u]);const l=r.filters.visibleInView(t.id),d=m.useMemo(()=>l.every(h=>h.should_auto_submit),[l]),p=m.useMemo(()=>l.filter(h=>v.get(h,"config.required",!1)),[l]),f=m.useMemo(()=>p.length===0?!1:p.some(h=>!h.requiredAndPass(u[h.key])),[u,p]);if(l.length===0)return null;const g=(h,b)=>(w,C)=>{b(w),(h.should_auto_submit||C)&&r.filters.setValueByKey(h.key,w)};return n("form",{onSubmit:s(r.filters.setValues),children:c(a.Group,{className:"dashboard-filters",position:"apart",noWrap:!0,sx:d?{}:{border:"1px solid #e9ecef",borderRadius:"4px",padding:"16px"},children:[n(a.Group,{align:"flex-start",children:l.map(h=>n(x.Controller,{name:h.key,control:i,render:({field:b})=>n(Ni,{filter:h,value:b.value,onChange:g(h,b.onChange)})},h.id))}),!d&&n(a.Group,{sx:{alignSelf:"flex-end"},children:n(a.Button,{color:"blue",size:"sm",type:"submit",disabled:f,children:"Search"})})]})})}),j1="";function Wo(e){return e?["<p><br></p>","<p></p>"].includes(e):!0}const qi=T.observer(()=>{const{freezeLayout:e}=m.useContext(Ke),[t,r]=m.useState(!1),{panel:i}=Ce();return m.useEffect(()=>{e(t)},[t]),Wo(i.description)?null:c(B,{children:[n(a.Modal,{opened:t,onClose:()=>r(!1),title:i.title,withCloseButton:!1,withinPortal:!0,zIndex:310,children:n(qt,{value:i.description,styles:{root:{border:"none"},content:{padding:0}}})}),n(a.Tooltip,{label:"Click to see description",position:"top-start",withinPortal:!0,children:n(a.ActionIcon,{variant:"subtle",color:"blue",onClick:()=>r(s=>!s),sx:{verticalAlign:"baseline",cursor:"pointer"},children:n(k.InfoCircle,{size:20})})})]})}),jo=T.observer(({view:e})=>{const t=ce(),r=Y(),i=Le.useModals(),{panel:s}=Ce(),{id:o,query:u}=s,{inEditMode:l}=m.useContext(Ke),d=()=>u==null?void 0:u.fetchData(),{viewPanelInFullScreen:p,inFullScreen:f}=m.useContext(yn),g=()=>{r.duplicatePanelByID(o,e.id)},h=()=>{t.editor.open(["_VIEWS_",e.id,"_PANELS_",o])},b=()=>i.openConfirmModal({title:"Delete this panel?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>r.removePanelByID(o,e.id),confirmProps:{color:"red"},zIndex:320}),w=m.useCallback(()=>{p(o)},[o,p]),C=!f&&e.type!==K.Modal;return n(B,{children:n(a.Box,{sx:{position:"absolute",top:0,left:0,right:0,zIndex:300},children:c(a.Menu,{withinPortal:!0,children:[n(a.Menu.Target,{children:n(a.Box,{className:"panel-dropdown-target",sx:{width:"100%",height:"25px"}})}),c(a.Menu.Dropdown,{children:[n(a.Menu.Item,{onClick:d,icon:n(k.Refresh,{size:14}),children:"Refresh"}),n(a.Menu.Item,{onClick:()=>r.queries.downloadDataByQueryID((u==null?void 0:u.id)??""),icon:n(k.Download,{size:14}),children:"Download Data"}),C&&n(a.Menu.Item,{onClick:w,icon:n(k.ArrowsMaximize,{size:14}),disabled:l,children:"Full Screen"}),l&&c(B,{children:[n(a.Divider,{label:"Edit",labelPosition:"center"}),n(a.Menu.Item,{onClick:h,icon:n(k.Settings,{size:14}),children:"Settings"}),n(a.Menu.Item,{onClick:g,icon:n(k.Copy,{size:14}),children:"Duplicate"}),n(a.Menu.Item,{color:"red",onClick:b,icon:n(k.Trash,{size:14}),children:"Delete"})]})]})]})})})}),Y1="",Yo=T.observer(function(){const{panel:t}=Ce(),{title:r}=t;return r?n(a.Group,{grow:!0,position:"center",px:20,className:"panel-title-wrapper",sx:{flexGrow:1},children:n(a.Text,{align:"center",lineClamp:1,weight:"bold",children:r})}):null}),Ne=(e,t)=>{const[r,i]=m.useState([]);return m.useEffect(()=>e.watchTriggerSnapshotList(s=>i(s.filter(o=>o.schemaRef===t))),[]),r};class lt{constructor(t,r){this.root=t,this.path=r}async deleteItem(t){t===null&&await this.root.deleteItem(this.path);const r=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,v.omit(r,t))}async getItem(t){const r=await this.root.getItem(this.path);return t===null?r:v.get(r,t)}async setItem(t,r){if(t===null)await this.root.setItem(this.path,r);else{const i=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,{...i,[t]:r})}return await this.getItem(t)}watchItem(t,r,i){return t===null?this.root.watchItem(this.path,(s,o)=>{r(s,o)},i):this.root.watchItem(this.path,(s,o)=>{const u=v.get(s,t),l=v.get(o,t);u!==l&&r(u,l)},i)}}class Sn{constructor(t,r,i){O(this,"attachmentStorage");this.instance=t,this.attachmentKey=r,this.constructInstance=i,this.attachmentStorage=new lt(t.instanceData,r)}async getInstance(t){if(await this.attachmentStorage.getItem(t))return this.constructInstance(new lt(this.attachmentStorage,t))}async create(t,r){return await this.attachmentStorage.setItem(t,r),this.constructInstance(new lt(this.attachmentStorage,t))}async remove(t){await this.attachmentStorage.deleteItem(t)}async list(){const t=await this.attachmentStorage.getItem(null);return Promise.all(v.values(t).map(r=>this.constructInstance(new lt(this.attachmentStorage,r.id))))}}class Fi{constructor(t){O(this,"rootRef");this.rootRef=se.observable({current:t})}async deleteItem(t){se.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const r=this.getValueFromRoot(t);return Promise.resolve(r)}getValueFromRoot(t){return t===null?se.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,r){if(t===null)if(v.isObject(r))se.runInAction(()=>{this.rootRef.current=r});else throw new Error("Cannot set root value to non-object");else se.runInAction(()=>{v.set(this.rootRef.current,[t],r)});return Promise.resolve(this.getItem(t))}watchItem(t,r,i){return se.reaction(()=>this.getValueFromRoot(t),(s,o)=>{r(s,o)},{requiresObservable:!0,fireImmediately:v.get(i,"fireImmediately",!1)})}}class Ro{constructor(){O(this,"channels",new Map);O(this,"globalChannel",new Ii)}getChannel(t){const r=this.channels.get(t);if(r)return r;const i=new Ii;return this.channels.set(t,i),i}}class Qo{constructor(t){O(this,"instances",new Map);this.pluginManager=t}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(t=>t.manifest.viz)}resolveComponent(t){return this.pluginManager.factory.viz(t)}getOrCreateInstance(t){const r=this.instances.get(t.id);if(r)return r;const i={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new Ro,instanceData:new Fi(t.viz.conf)};return this.instances.set(t.id,i),i}}function Wi(e,t,r,i){return{vizManager:r,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Fi({}),colorPalette:{getColor(){return()=>""}},data:t,variables:i}}const Uo=e=>{const{panel:t,vizManager:r,data:i,variables:s}=e,o=r.resolveComponent(t.viz.type),u=r.getOrCreateInstance(t),l={...Wi(u,i,r,s),viewport:{width:t.layout.w,height:t.layout.h}},d=o.viewRender;return n(d,{context:l,instance:u,...v.omit(e,["panel","vizManager","data"])})},Xo=e=>{const{vizManager:t,panel:r,panelInfoEditor:i,data:s,variables:o}=e,u=t.resolveComponent(r.viz.type),l=t.getOrCreateInstance(r),d={...Wi(l,s,t,o),panelInfoEditor:i},p=u.configRender;return n(p,{context:d,instance:l,...v.omit(e,["panel","vizManager","data","panelInfoEditor"])})},ji=(e,t)=>{const r=je.bezier(e),i=je.bezier(t);return function(s){return s<50?r(s*2/100).hex():i((s-50)*2/100).hex()}},Ft=e=>{const t=je.bezier(e);return function(r){return t(r/100).hex()}},Zo={type:"interpolation",displayName:"Red / Green",getColor:ji(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},Ko={type:"interpolation",displayName:"Yellow / Blue",getColor:ji(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},Jo={type:"interpolation",displayName:"Red",getColor:Ft(["#fff7f1","darkred"]),name:"red",category:"sequential"},Ho={type:"interpolation",displayName:"Green",getColor:Ft(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},el={type:"interpolation",displayName:"Blue",getColor:Ft(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},tl={type:"interpolation",displayName:"Orange",getColor:Ft(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"},Yi="@devtable/dashboard",Tn="9.9.0",Ri="Apache-2.0",Qi={access:"public",registry:"https://registry.npmjs.org/"},Ui=["dist"],Xi="./dist/dashboard.umd.js",Zi="./dist/dashboard.es.js",Ki="./dist/index.d.ts",Ji={".":{import:"./dist/dashboard.es.js",require:"./dist/dashboard.umd.js"},"./dist/style.css":{import:"./dist/style.css",require:"./dist/style.css"}},Hi={"dev-build":"tsc && vite build --watch",build:"tsc && vite build",preview:"vite preview",test:"vitest","test:ui":"vitest --ui",coverage:"vitest --coverage"},ea={"@monaco-editor/react":"4.4.6","@types/chroma-js":"^2.1.4","file-saver":"2.0.5",mathjs:"11.8.0","monaco-editor":"0.36.0","performant-array-to-tree":"1.11.0",popmotion:"^11.0.3","rc-select":"14.1.0","rc-tree-select":"5.5.5",reactflow:"^11.5.3"},ta={"@emotion/babel-plugin":"11.10.6","@faker-js/faker":"7.6.0","@mantine/core":"5.9.5","@mantine/dates":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5","@mantine/prism":"5.9.5","@mantine/tiptap":"5.9.5","@tabler/icons":"1.119.0","@testing-library/cypress":"^9.0.0","@testing-library/jest-dom":"^5.16.4","@testing-library/react":"^13.3.0","@testing-library/react-hooks":"^8.0.1","@testing-library/user-event":"^14.3.0","@tiptap/extension-code-block-lowlight":"2.0.3","@tiptap/extension-color":"2.0.3","@tiptap/extension-highlight":"2.0.3","@tiptap/extension-link":"2.0.3","@tiptap/extension-placeholder":"2.0.3","@tiptap/extension-subscript":"2.0.3","@tiptap/extension-superscript":"2.0.3","@tiptap/extension-table":"2.0.3","@tiptap/extension-table-cell":"2.0.3","@tiptap/extension-table-header":"2.0.3","@tiptap/extension-table-row":"2.0.3","@tiptap/extension-text-align":"2.0.3","@tiptap/extension-text-style":"2.0.3","@tiptap/extension-underline":"2.0.3","@tiptap/pm":"2.0.3","@tiptap/react":"2.0.3","@tiptap/starter-kit":"2.0.3","@types/crypto-js":"v4.1.1","@types/d3-array":"3.0.4","@types/eventemitter2":"^4.1.0","@types/file-saver":"2.0.5","@types/lodash":"^4.14.182","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@types/react-grid-layout":"^1.3.2",ahooks:"^3.3.11",ajv:"8.12.0",axios:"^0.27.2","crypto-js":"^4.1.1",cypress:"^12.9.0","cypress-wait-until":"^1.7.2",echarts:"^5.3.2","echarts-for-react":"^3.0.2","echarts-gl":"^2.0.9",jsdom:"^20.0.0","jsdom-testing-mocks":"^1.5.0",lodash:"^4.17.21",lowlight:"^2.8.0",numbro:"^2.3.6","prosemirror-commands":"^1.5.0","prosemirror-dropcursor":"^1.6.1","prosemirror-gapcursor":"^1.3.1","prosemirror-history":"^1.3.0","prosemirror-keymap":"^1.2.0","prosemirror-schema-list":"^1.2.2","react-grid-layout":"^1.3.4","react-hook-form":"^7.31.2","rollup-plugin-visualizer":"5.6.0","tabler-icons-react":"^1.48.0",typescript:"^4.6.3","vite-plugin-static-copy":"0.13.1"},na={"@emotion/react":"11.10.6","@faker-js/faker":"7.6.0","@mantine/core":"5.9.5","@mantine/dates":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5","@mantine/prism":"5.9.5","@mantine/tiptap":"5.9.5","@tabler/icons":"1.119.0","@tanstack/react-table":"^8.5.13","@tiptap/extension-code-block-lowlight":"2.0.3","@tiptap/extension-color":"2.0.3","@tiptap/extension-highlight":"2.0.3","@tiptap/extension-link":"2.0.3","@tiptap/extension-placeholder":"2.0.3","@tiptap/extension-subscript":"2.0.3","@tiptap/extension-superscript":"2.0.3","@tiptap/extension-table":"2.0.3","@tiptap/extension-table-cell":"2.0.3","@tiptap/extension-table-header":"2.0.3","@tiptap/extension-table-row":"2.0.3","@tiptap/extension-text-align":"2.0.3","@tiptap/extension-text-style":"2.0.3","@tiptap/extension-underline":"2.0.3","@tiptap/pm":"2.0.3","@tiptap/react":"2.0.3","@tiptap/starter-kit":"2.0.3",ahooks:"^3.3.11",axios:"^0.27.2","chroma-js":"^2.4.2","crypto-js":"^4.1.1","d3-array":"3.2.3","d3-regression":"1.3.10",dayjs:"1.11.7",echarts:"^5.3.2","echarts-for-react":"^3.0.2","echarts-gl":"^2.0.9",eventemitter2:"^6.4.6",jszip:"3.10.1",lodash:"^4.17.21",lowlight:"^2.8.0",mobx:"^6.6.1","mobx-react-lite":"^3.4.0","mobx-state-tree":"^5.1.5",numbro:"^2.3.6","prosemirror-commands":"^1.5.0","prosemirror-dropcursor":"^1.6.1","prosemirror-gapcursor":"^1.3.1","prosemirror-history":"^1.3.0","prosemirror-keymap":"^1.2.0","prosemirror-schema-list":"^1.2.2",react:"^16.8.0 || 17.x || 18.x","react-dom":"^16.8.0 || 17.x || 18.x","react-grid-layout":"^1.3.4","react-hook-form":"^7.31.2","react-router-dom":"^6.3.0","react-virtual":"^2.10.4","tabler-icons-react":"^1.48.0"},nl=Object.freeze(Object.defineProperty({__proto__:null,default:{name:Yi,version:Tn,license:Ri,publishConfig:Qi,files:Ui,main:Xi,module:Zi,types:Ki,exports:Ji,scripts:Hi,dependencies:ea,devDependencies:ta,peerDependencies:na},dependencies:ea,devDependencies:ta,exports:Ji,files:Ui,license:Ri,main:Xi,module:Zi,name:Yi,peerDependencies:na,publishConfig:Qi,scripts:Hi,types:Ki,version:Tn},Symbol.toStringTag,{value:"Module"}));class rl{constructor(t){O(this,"staticColors",new Map);O(this,"interpolations",new Map);t.installedPlugins.forEach(r=>{r.manifest.color.forEach(i=>{this.register(i)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const r=this.encodeColor(t);t.type==="single"?(this.staticColors.has(r)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(r,t)):t.type==="interpolation"&&(this.interpolations.has(r)&&console.warn(`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`,`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.interpolations.set(r,t))}decodeStaticColor(t){return this.staticColors.get(t)}encodeColor(t){return`\${${t.category}}.{${t.name}}`}decodeInterpolation(t){return this.interpolations.get(t)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class il{constructor(){O(this,"plugins",new Map);O(this,"vizComponents",new Map);O(this,"factory",{viz:t=>{const r=this.vizComponents.get(t);if(r)return r;throw new Error(`Viz Component (${t}) not found`)}})}install(t){if(this.plugins.has(t.id))throw new Error(`Plugin (${t.id}) has been installed before`);this.plugins.set(t.id,t);for(const r of t.manifest.viz){if(this.vizComponents.has(r.name))throw new Error(`Viz Component (${r.name}) has been installed before`);this.vizComponents.set(r.name,r)}}get installedPlugins(){return Array.from(this.plugins.values())}}class al{constructor(){O(this,"migrations",[])}version(t,r){return this.migrations.push({version:t,handler:r}),this}run(t,r,i){var u;if(t.from===t.to)return r;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const s=this.migrations.filter(l=>l.version>t.from&&l.version<=t.to),o=v.orderBy(s,"version","asc");if(((u=v.last(o))==null?void 0:u.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return o.reduce((l,d)=>d.handler(l,i),r)}}class fe extends al{constructor(){super(),this.configVersions()}version(t,r){return super.version(t,(i,s)=>({version:t,...r(i,s)}))}async migrate({configData:t,panelModel:r}){const i=await t.getItem(null),s=v.get(i,"version",0),o=this.run({from:s,to:this.VERSION},i,{panelModel:r});await t.setItem(null,o)}async needMigration({configData:t}){const r=await t.getItem(null);return v.get(r,"version",0)<this.VERSION}}const F=(e,t)=>{const[r,{setFalse:i}]=Z.useBoolean(!0),[s,o]=m.useState();m.useEffect(()=>(e.getItem(t).then(l=>{o(l),i()}),e.watchItem(t,l=>{o(l)})));const u=m.useCallback(async l=>{await e.setItem(t,l),o(l)},[e,t]);return{loading:r,value:s,set:u}},kn={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"}};le.use([N.GridComponent,N.VisualMapComponent,N.LegendComponent,N.TooltipComponent,Me.CanvasRenderer]);function sl({context:e}){const{value:t}=F(e.instanceData,"config"),r=e.data,{width:i,height:s}=e.viewport,{x_axis_data_key:o,y_axis_data_key:u,z_axis_data_key:l,xAxis3D:d,yAxis3D:p,zAxis3D:f}=v.defaults({},t,kn),g=m.useMemo(()=>{const w=v.minBy(r,C=>C[l]);return v.get(w,l)},[r,l]),h=m.useMemo(()=>{const w=v.maxBy(r,C=>C[l]);return v.get(w,l)},[r,l]),b={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:g,max:h,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:d,yAxis3D:p,zAxis3D:f,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:r.map(w=>[w[o],w[u],w[l]])}]};return t?n(Ae,{echarts:le,option:b,style:{width:i,height:s},notMerge:!0,theme:"merico-light"}):null}function ol({label:e,required:t,value:r,onChange:i,data:s,clearable:o=!1,sx:u,...l},d){const p=m.useMemo(()=>{if(!Array.isArray(s)||s.length===0)return[];const g=Object.keys(s[0]).map(h=>({label:h,value:h}));return o?g.concat([{label:"unset",value:""}]):g},[s]);return n(a.Select,{ref:d,label:e,data:p,value:r,onChange:i,required:t,sx:u,...l})}const W=m.forwardRef(ol);function ll({context:e}){const{value:t,set:r}=F(e.instanceData,"config"),i=e.data,s=v.defaults({},t,kn),{control:o,handleSubmit:u,reset:l}=x.useForm({defaultValues:s});return m.useEffect(()=>{l(s)},[t]),t?n(a.Stack,{spacing:"xs",children:c("form",{onSubmit:u(r),children:[n(a.Text,{children:"X Axis"}),c(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[n(x.Controller,{name:"x_axis_data_key",control:o,render:({field:d})=>n(W,{label:"Data Field",required:!0,data:i,...d})}),n(x.Controller,{name:"xAxis3D.name",control:o,render:({field:d})=>n(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...d})})]}),n(a.Text,{mt:"lg",children:"Y Axis"}),c(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[n(x.Controller,{name:"y_axis_data_key",control:o,render:({field:d})=>n(W,{label:"Data Field",required:!0,data:i,...d})}),n(x.Controller,{name:"yAxis3D.name",control:o,render:({field:d})=>n(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...d})})]}),n(a.Text,{mt:"lg",children:"Z Axis"}),c(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[n(x.Controller,{name:"z_axis_data_key",control:o,render:({field:d})=>n(W,{label:"Data Field",required:!0,data:i,...d})}),n(x.Controller,{name:"zAxis3D.name",control:o,render:({field:d})=>n(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...d})})]}),n(a.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:c(a.Button,{color:"blue",type:"submit",children:[n(k.DeviceFloppy,{size:20}),n(a.Text,{ml:"md",children:"Save"})]})})]})}):null}class ul extends fe{constructor(){super(...arguments);O(this,"VERSION",1)}configVersions(){this.version(1,r=>({version:1,config:r}))}}const dl={displayName:"Bar Chart (3D)",displayGroup:"ECharts-based charts",migrator:new ul,name:"bar-3d",viewRender:sl,configRender:ll,createConfig(){return{version:1,config:v.cloneDeep(kn)}}},Se={mantissa:0,output:"number",trimMantissa:!1,average:!1};function cl({value:e,onChange:t},r){const i=l=>{t({...e,output:l})},s=l=>{const d=l===0?!1:e.trimMantissa;t({...e,mantissa:l,trimMantissa:d})},o=l=>{t({...e,trimMantissa:l.currentTarget.checked})},u=l=>{t({...e,average:l.currentTarget.checked})};return c(a.Stack,{ref:r,children:[c(a.Group,{grow:!0,children:[n(a.Select,{label:"Format",data:[{label:"1234",value:"number"},{label:"99%",value:"percent"}],value:e.output,onChange:i,sx:{flexGrow:1}}),n(a.Switch,{label:c(a.Stack,{spacing:0,children:[n(a.Text,{children:"Average"}),n(a.Text,{size:12,color:"gray",children:"like 1.234k, 1.234m"})]}),checked:e.average,onChange:u,disabled:e.output!=="number",sx:{flexGrow:1},styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"},label:{display:"block"}}})]}),c(a.Group,{grow:!0,children:[n(a.NumberInput,{label:"Mantissa",defaultValue:0,min:0,step:1,max:4,value:e.mantissa,onChange:s}),n(a.Switch,{label:"Trim mantissa",checked:e.trimMantissa,onChange:o,disabled:e.mantissa===0,styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"}}})]}),c(a.Stack,{spacing:0,children:[n(a.Text,{weight:"bold",children:"Preview"}),n(ke,{children:c(a.Group,{position:"apart",children:[c(a.Text,{size:12,color:"gray",children:["123456789 ",n(k.ArrowRight,{size:9})," ",te(123456789).format(e)]}),c(a.Text,{size:12,color:"gray",children:["1234 ",n(k.ArrowRight,{size:9})," ",te(1234).format(e)]}),c(a.Text,{size:12,color:"gray",children:["0.1234 ",n(k.ArrowRight,{size:9})," ",te(.1234).format(e)]})]})})]})]})}const Oe=m.forwardRef(cl),Ge={enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
|
|
27
|
+
Check the top-level render call using <`+E+">.")}return I}}function ao(_,I){{if(!_._store||_._store.validated||_.key!=null)return;_._store.validated=!0;var E=L1(I);if(io[E])return;io[E]=!0;var R="";_&&_._owner&&_._owner!==ui.current&&(R=" It was passed a child from "+oe(_._owner.type)+"."),bt(_),$('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',E,R),bt(null)}}function so(_,I){{if(typeof _!="object")return;if(oi(_))for(var E=0;E<_.length;E++){var R=_[E];ci(R)&&ao(R,I)}else if(ci(_))_._store&&(_._store.validated=!0);else if(_){var ae=S(_);if(typeof ae=="function"&&ae!==_.entries)for(var ue=ae.call(_),ee;!(ee=ue.next()).done;)ci(ee.value)&&ao(ee.value,I)}}}function P1(_){{var I=_.type;if(I==null||typeof I=="string")return;var E;if(typeof I=="function")E=I.propTypes;else if(typeof I=="object"&&(I.$$typeof===d||I.$$typeof===g))E=I.propTypes;else return;if(E){var R=oe(I);C1(E,_.props,"prop",R,_)}else if(I.PropTypes!==void 0&&!di){di=!0;var ae=oe(I);$("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ae||"Unknown")}typeof I.getDefaultProps=="function"&&!I.getDefaultProps.isReactClassApproved&&$("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function O1(_){{for(var I=Object.keys(_.props),E=0;E<I.length;E++){var R=I[E];if(R!=="children"&&R!=="key"){bt(_),$("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",R),bt(null);break}}_.ref!==null&&(bt(_),$("Invalid attribute `ref` supplied to `React.Fragment`."),bt(null))}}function oo(_,I,E,R,ae,ue){{var ee=Q(_);if(!ee){var J="";(_===void 0||typeof _=="object"&&_!==null&&Object.keys(_).length===0)&&(J+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Ie=E1(ae);Ie?J+=Ie:J+=ro();var me;_===null?me="null":oi(_)?me="array":_!==void 0&&_.$$typeof===t?(me="<"+(oe(_.type)||"Unknown")+" />",J=" Did you accidentally export a JSX literal instead of a component?"):me=typeof _,$("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",me,J)}var ye=z1(_,I,E,ae,ue);if(ye==null)return ye;if(ee){var Ee=I.children;if(Ee!==void 0)if(R)if(oi(Ee)){for(var yt=0;yt<Ee.length;yt++)so(Ee[yt],_);Object.freeze&&Object.freeze(Ee)}else $("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else so(Ee,_)}return _===i?O1(ye):P1(ye),ye}}function V1(_,I,E){return oo(_,I,E,!0)}function B1(_,I,E){return oo(_,I,E,!1)}var N1=B1,G1=V1;wt.Fragment=i,wt.jsx=N1,wt.jsxs=G1}()),wt}(function(e){process.env.NODE_ENV==="production"?e.exports=Co():e.exports=wo()})(xo);const B=xt.Fragment,n=xt.jsx,c=xt.jsxs;function zi(e,t){m.useEffect(()=>{const r=i=>{console.log(i);const{viewID:s}=i.detail;if(!s){console.error(new Error("[Open View] Needs to pick a view first"));return}e.views.appendToVisibles(s),t&&e.views.setIDOfVIE(s)};return window.addEventListener("open-view",r),()=>{window.removeEventListener("open-view",r)}},[e,t]),m.useEffect(()=>{const r=i=>{console.log(i);const{dictionary:s,payload:o}=i.detail;if(!o||Object.keys(o).length===0){console.error(new Error("[Set Filter Values] payload is empty"));return}Object.entries(s).forEach(([u,l])=>{e.filters.setValueByKey(u,v.get(o,l))})};return window.addEventListener("set-filter-values",r),()=>{window.removeEventListener("set-filter-values",r)}},[e]),m.useEffect(()=>{function r(s){return Array.isArray(s)?[]:typeof s=="object"?{}:typeof s=="boolean"?!1:typeof s=="string"?"":typeof s=="number"?0:s}const i=s=>{console.log(s);const{filter_keys:o}=s.detail;o.forEach(u=>{const l=v.get(e.filters.values,u),d=r(l);console.log(`${u}: ${d}`),e.filters.setValueByKey(u,d)})};return window.addEventListener("clear-filter-values",i),()=>{window.removeEventListener("clear-filter-values",i)}},[e]),m.useEffect(()=>{const r=i=>{console.log(i);const{urlTemplate:s,openInNewTab:o,enableEncoding:u=!1,payload:l}=i.detail;if(!s){console.error(new Error("[Open Link] URL is empty"));return}function d(g){return v.cloneDeepWith(g,b=>{if(u&&typeof b=="string")return encodeURIComponent(b)})}const f=v.template(s||"")(d({...l,filters:e.payloadForSQL.filterValues,context:e.payloadForSQL.context}));window.open(f,o?"_blank":"_self","noopener")};return window.addEventListener("open-link",r),()=>{window.removeEventListener("open-link",r)}},[e])}class _o{constructor(t){O(this,"symbol");this.symbol=Symbol(t)}}function Ye(e){return new _o(e)}class mn{constructor(){O(this,"parent");O(this,"factoryRegistry",new Map);O(this,"instanceRegistry",new Map)}createScoped(){const t=new mn;return t.parent=this,t}getRequired(t){return this.get(t)}get(t){if(this.instanceRegistry.has(t.symbol))return this.instanceRegistry.get(t.symbol);const r=this.factoryRegistry.get(t.symbol);if(r){const i=r(this);return this.instanceRegistry.set(t.symbol,i),i}if(this.parent)return this.parent.get(t)}provideFactory(t,r){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,r),this}provideValue(t,r){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>r),this}dispose(){this.instanceRegistry.forEach(t=>{const r=v.get(t,"dispose");v.isFunction(r)&&r.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const bn=m.createContext(null);function Gt(e){const t=m.useContext(bn),r=Z.useCreation(()=>e.configure(t||new mn),[e.configure]),i=Z.usePrevious(r);return i&&i!==r&&i.dispose(),n(bn.Provider,{value:r,children:e.children})}function Ei(){return m.useContext(bn)}const So={viewPanelInFullScreen:v.noop,inFullScreen:!1},yn=m.createContext(So),Li=m.createContext(null),vn=Li.Provider;function ce(){const e=m.useContext(Li);if(!e)throw new Error("Please use ModelContextProvider");return e}const Pi=m.createContext(null),xn=Pi.Provider;function Y(){const e=m.useContext(Pi);if(!e)throw new Error("Please use ContentModelContextProvider");return e}const To={layoutFrozen:!1,freezeLayout:v.noop,inEditMode:!1},Ke=m.createContext(To),Oi=m.createContext({panel:null,data:[],loading:!1}),Cn=Oi.Provider;function Ce(){const e=m.useContext(Oi);if(!e.panel)throw new Error("Please use PanelContextProvider");return e}const ko={fullScreenPanelID:"",setFullScreenPanelID:v.noop},wn=m.createContext(ko);function Vi(){const e=m.useContext(wn);if(!e)throw new Error("Please use FullScreenPanelContext.Provider");return e}class ke extends m.Component{constructor(t){super(t),this.state={error:null}}componentDidCatch(t){this.setState({error:t})}render(){var t;if(this.state.error){const r=()=>{this.setState({error:null})};return c(a.Box,{children:[n(a.Text,{size:"xs",children:(t=this.state.error)==null?void 0:t.message}),n(a.Button,{variant:"subtle",size:"xs",mx:"auto",compact:!0,sx:{display:"block"},onClick:r,children:"Retry"})]})}return this.props.children}}const _n={fontSize:"14px",lineHeight:"32px",color:"#3D3E45",ul:{paddingLeft:"2em",margin:"6px 0 0"},p:{margin:0},a:{WebkitTapHighlightColor:"transparent",color:"rgb(34, 139, 230)",textDecoration:"none","&:hover":{textDecoration:"underline"},"&:active, &:hover":{outlineWidth:0}},table:{tr:{"th, td":{padding:"0 .5em"}}},"table.rich-text-table-render, div.tableWrapper table":{"th, td":{border:"1px solid #eaeaea"},"tr:last-of-type td":{borderBottom:"1px solid #eaeaea"}},".resize-cursor":{cursor:"col-resize"},details:{summary:{listStyle:"none",cursor:"pointer",transition:"color 300ms ease",userSelect:"none"},"summary::-webkit-details-marker":{display:"none"},"summary:hover":{color:"black","&::before":{opacity:1}},"summary::before":{content:'"►"',fontSize:"10px",margin:"0px 5px",opacity:.5,display:"inline-block",transition:"opacity 300ms ease, transform 300ms ease"}},"details[open] summary::before":{transform:"rotate(90deg)"},"details + details":{marginTop:"10px"}},qt=({value:e,styles:t={}})=>{const r=Si.useEditor({extensions:[Ti,_i,X.Link,mi,gi,hi,vi.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),wi,Ci,xi,bi.configure({types:["heading","paragraph"]}),fi.configure({placeholder:"This is placeholder"}),yi,pi.Color],content:e,editable:!1});m.useEffect(()=>{r==null||r.commands.setContent(e)},[e,r]);const i=m.useMemo(()=>v.defaultsDeep({},{content:_n},t),[t]);return n(X.RichTextEditor,{editor:r,styles:i,children:n(X.RichTextEditor.Content,{})})},Do=({description:e,isDescriptionEmpty:t})=>t?null:n(a.Tooltip,{color:"white",label:n(qt,{value:e,styles:{root:{border:"none"},content:{padding:0}}}),styles:{tooltip:{border:"0.0625rem solid rgb(233, 236, 239)",boxShadow:"rgb(0 0 0 / 5%) 0px 0.0625rem 0.1875rem, rgb(0 0 0 / 5%) 0px 1.25rem 1.5625rem -0.3125rem, rgb(0 0 0 / 4%) 0px 0.625rem 0.625rem -0.3125rem"}},withArrow:!0,children:n(a.Box,{sx:{height:"16px",alignSelf:"center"},children:n(V.IconInfoCircle,{size:16,color:"gray"})})}),Io=T.observer(({label:e,config:{default_value:t,description:r,isDescriptionEmpty:i,...s},value:o,onChange:u})=>c(a.Box,{children:[n(a.Text,{children:" "}),n(a.Checkbox,{label:c(a.Group,{noWrap:!0,position:"apart",align:"middle",spacing:6,children:[n(a.Box,{sx:{flexGrow:1},children:e}),n(Do,{description:r,isDescriptionEmpty:i})]}),checked:o||!1,onChange:l=>u(l.currentTarget.checked),...s,pt:".4em",styles:{input:{borderColor:"#e9ecef"}}})]})),Bi=T.observer(({label:e,config:t,value:r=[null,null],onChange:i})=>{const s=Array.isArray(r)?r.map(d=>d?j(d).toDate():null):[null,null],o=d=>{i(d.map(p=>p&&j(p).format(t.inputFormat)))},u=t.getMinDate(s[0]),l=t.getMaxDate(s[0]);return n(uo.DateRangePicker,{label:e,value:s,onChange:o,icon:n(k.Calendar,{size:16}),sx:{minWidth:"16em"},minDate:u,maxDate:l,styles:{input:{borderColor:"#e9ecef"}},...t})}),Mo=a.createStyles((e,{radius:t=4})=>({root:{borderRadius:e.fn.radius(t),display:"flex",flexWrap:"nowrap",border:"1px solid #ced4da",paddingLeft:"0px",paddingRight:"30px",backgroundColor:"#fff",transition:"border-color 100ms ease",borderColor:"#e9ecef","&.rc-select.rc-select-open":{borderColor:"#228be6 !important",".rc-select-selection-overflow-item-rest":{display:"none"},".rc-select-selection-overflow-item-suffix":{display:"block"}},".rc-select-selector":{height:"auto",lineHeight:1.55,paddingLeft:"12px",resize:"none",boxSizing:"border-box",fontSize:"14px",width:"100%",color:"#000",display:"block",textAlign:"left",minHeight:"36px",cursor:"pointer",flexGrow:1},".rc-select-selection-search-mirror":{display:"none"},".rc-select-selection-search":{flexGrow:1,width:"auto !important"},".rc-select-selection-overflow":{display:"flex",minHeight:"34px",alignItems:"center",flexWrap:"nowrap",marginLeft:"calc(-10px / 2)",boxSizing:"border-box"},".rc-select-selection-overflow-item":{display:"flex",alignItems:"center",backgroundColor:"#f1f3f5",color:"#495057",height:"24px",paddingLeft:"12px",paddingRight:"12px",fontWeight:500,fontSize:"12px",borderRadius:"4px",cursor:"default",userSelect:"none",maxWidth:"calc(100% - 20px)",margin:"calc(10px / 2 - 2px) calc(10px / 2)"},".rc-select-selection-overflow-item-rest":{cursor:"pointer"},".rc-select-selection-overflow-item-suffix":{display:"none",backgroundColor:"transparent",width:"100%",maxWidth:"100%",height:"28px",margin:0,paddingLeft:0,paddingRight:0},input:{flex:1,minWidth:"60px",backgroundColor:"transparent",border:0,outline:0,fontSize:"14px",padding:0,marginLeft:0,color:"inherit",height:"28px",lineHeight:"32px",cursor:"pointer",width:"100%","&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{display:"none"}},".rc-select-clear":{marginRight:"-24px",alignSelf:"center",cursor:"pointer"},"&.rc-select-disabled":{backgroundColor:"rgb(241, 243, 245)",color:"rgb(144, 146, 150)",opacity:.6,"&, .rc-select-selector, input":{cursor:"not-allowed"}}},label:{fontSize:e.fontSizes.sm,fontWeight:500,color:"#212529"},dropdown:{fontSize:e.fontSizes.xs,zIndex:300,backgroundColor:"#fff",border:"1px solid #e9ecef",marginTop:6,padding:0,boxShadow:"0 1px 3px rgb(0 0 0 / 5%), rgb(0 0 0 / 5%) 0px 10px 15px -5px, rgb(0 0 0 / 4%) 0px 7px 7px -5px",borderRadius:"4px","&.rc-select-dropdown-slide-up-leave-active":{display:"none"},".rc-select-item-empty":{padding:"8px 12px"},".rc-select-item-option":{boxSizing:"border-box",textAlign:"left",width:"100%",padding:"8px 12px 8px 2px",cursor:"pointer",fontSize:"14px",color:"#000",borderRadius:"4px",display:"flex",flexWrap:"nowrap",overflow:"hidden","&:hover":{backgroundColor:"#f1f3f5"},flexDirection:"row-reverse",".rc-select-item-option-state":{flexGrow:0,flexShrink:0,width:"30px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},".rc-select-item-option-content":{flexGrow:1}}}})),Ao=({disabled:e,classNames:t,styles:r,unstyled:i,radius:s,style:o,label:u,value:l,onChange:d,options:p})=>{const{classes:f,cx:g}=Mo({radius:s},{name:"MultiSelectWidget",classNames:t,styles:r,unstyled:i}),[h,b]=m.useState(!1),w=P=>{b(P)},C=h&&(l==null?void 0:l.length)>0,[S,M]=m.useState(""),$=m.useMemo(()=>{if(!S)return p;const P=S.toLowerCase(),q=L=>L.description.toLowerCase().includes(P)||L.label.toLowerCase().includes(P);return p.filter(q)},[S,p]);return c(a.Stack,{spacing:3,children:[c(a.Group,{position:"apart",children:[n(a.Text,{className:f.label,children:u}),C&&n(a.Tooltip,{label:`${l.length} selected`,children:n(a.Badge,{children:l.length})})]}),n(ki,{disabled:e,allowClear:!0,className:g(f.root,"check-select"),dropdownClassName:g(f.dropdown,""),onDropdownVisibleChange:w,transitionName:"rc-select-dropdown-slide-up",choiceTransitionName:"rc-select-selection__choice-zoom",style:o,clearIcon:()=>n(a.CloseButton,{}),value:l,onChange:d,onSelect:console.log,mode:"multiple",maxTagCount:0,maxTagTextLength:10,maxTagPlaceholder:P=>`${P.length} selected`,searchValue:S,onSearch:M,filterOption:!1,children:$.map(P=>n(ki.Option,{children:n(a.Group,{noWrap:!0,children:c("div",{children:[n(a.Text,{size:"sm","data-role":"label",children:P.label}),n(a.Text,{size:"xs",color:"dimmed","data-role":"description",children:P.description})]})})},P.value))})]})},$o=T.observer(({label:e,config:t,value:r,onChange:i})=>{const s=Y(),o=!!t.options_query_id,{state:u}=s.getDataStuffByID(t.options_query_id),l=u==="loading",d=t.min_width?t.min_width:"200px",p=o?l:!1;return n(Ao,{label:e,options:t.options,style:{minWidth:"160px",width:d,maxWidth:p?d:"unset",borderColor:"#e9ecef"},disabled:p,value:r,onChange:i})}),zo=m.forwardRef(({label:e,description:t,...r},i)=>n("div",{ref:i,...r,children:n(a.Group,{noWrap:!0,children:c("div",{children:[n(a.Text,{size:"sm","data-role":"label",children:e}),n(a.Text,{size:"xs",color:"dimmed","data-role":"description",children:t})]})})})),Eo=T.observer(({label:e,config:t,value:r,onChange:i})=>{const s=Y(),o=!!t.options_query_id,{state:u}=s.getDataStuffByID(t.options_query_id),l=u==="loading";return m.useEffect(()=>{var f;const{default_selection_count:d}=t;if(!d)return;const p=((f=t.options[0])==null?void 0:f.value)??"";console.log("Selecting the first option by default. New value: ",p),i(p,!0)},[t.default_selection_count,t.options]),n(a.Select,{label:e,data:t.options,disabled:o?l:!1,value:r,onChange:i,styles:{root:{width:t.width?t.width:"200px"},input:{borderColor:"#e9ecef"}},sx:{".mantine-Select-item[data-selected] .mantine-Text-root[data-role=description]":{color:"rgba(255,255,255,.7)"}},itemComponent:zo})});function Lo({label:e,config:t,value:r,onChange:i}){return n(a.TextInput,{label:e,value:r||"",onChange:s=>i(s.currentTarget.value),...t,styles:{input:{borderColor:"#e9ecef"}}})}const Po=({rotate:e,onClick:t})=>n("svg",{onClick:t,className:"caret-icon",viewBox:"0 0 1024 1024",focusable:"false","data-icon":"caret-down",width:"14px",height:"14px",fill:"currentColor","aria-hidden":"true",transform:`rotate(${e})`,children:n("path",{d:"M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"})}),Oo=({expanded:e,isLeaf:t,value:r,onClick:i,...s})=>(r==="0-0-value"&&console.log(s),t?n("span",{style:{width:"14px",display:"inline-block"}}):n(Po,{rotate:e?"0":"-90",onClick:i,...s})),Vo=({onClick:e})=>c("svg",{onClick:e,className:"checkbox-icon",width:"16",height:"16",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",children:[n("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),n("rect",{className:"border",x:"4",y:"4",width:"16",height:"16",rx:"2"}),n("rect",{className:"checkmark-indeterminate",x:"8",y:"8",width:"8",height:"8",rx:"2",stroke:"none"}),n("path",{className:"checkmark-checked",d:"M9 12l2 2l4 -4"})]}),Bo=({onClick:e,...t})=>n(Vo,{onClick:e,...t}),No=a.createStyles((e,{radius:t=4})=>({root:{borderRadius:e.fn.radius(t),display:"flex",flexWrap:"nowrap",border:"1px solid #ced4da",paddingLeft:"0px",paddingRight:"30px",backgroundColor:"#fff",transition:"border-color 100ms ease",borderColor:"#e9ecef","&.rc-tree-select.rc-tree-select-open":{borderColor:"#228be6 !important",".rc-tree-select-selection-overflow-item-rest":{display:"none"},".rc-tree-select-selection-overflow-item-suffix":{display:"block"}},".rc-tree-select-selector":{height:"auto",lineHeight:1.55,paddingLeft:"12px",resize:"none",boxSizing:"border-box",fontSize:"14px",width:"100%",color:"#000",display:"block",textAlign:"left",minHeight:"36px",cursor:"pointer",flexGrow:1},".rc-tree-select-selection-search-mirror":{display:"none"},".rc-tree-select-selection-search":{flexGrow:1,width:"auto !important"},".rc-tree-select-selection-overflow":{display:"flex",minHeight:"34px",alignItems:"center",flexWrap:"nowrap",marginLeft:"calc(-10px / 2)",boxSizing:"border-box"},".rc-tree-select-selection-overflow-item":{display:"flex",alignItems:"center",backgroundColor:"#f1f3f5",color:"#495057",height:"24px",paddingLeft:"12px",paddingRight:"12px",fontWeight:500,fontSize:"12px",borderRadius:"4px",cursor:"default",userSelect:"none",maxWidth:"calc(100% - 20px)",margin:"calc(10px / 2 - 2px) calc(10px / 2)"},".rc-tree-select-selection-overflow-item-rest":{cursor:"pointer"},".rc-tree-select-selection-overflow-item-suffix":{display:"none",backgroundColor:"transparent",width:"100%",maxWidth:"100%",height:"28px",margin:0,paddingLeft:0,paddingRight:0},input:{flex:1,minWidth:"60px",backgroundColor:"transparent",border:0,outline:0,fontSize:"14px",padding:0,marginLeft:0,color:"inherit",height:"28px",lineHeight:"32px",cursor:"pointer",width:"100%","&::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{display:"none"}},".rc-tree-select-clear":{marginRight:"-24px",alignSelf:"center",cursor:"pointer"},"&.rc-tree-select-disabled":{backgroundColor:"rgb(241, 243, 245)",color:"rgb(144, 146, 150)",opacity:.6,"&, .rc-tree-select-selector, input":{cursor:"not-allowed"}}},label:{fontSize:e.fontSizes.sm,fontWeight:500,color:"#212529"},dropdown:{fontSize:e.fontSizes.xs,zIndex:300,paddingTop:"6px","&.rc-tree-select-dropdown-slide-up-leave-active":{display:"none"},".rc-tree-select-tree-list .rc-tree-select-tree-list-holder":{},".rc-tree-select-tree-list, .rc-tree-select-empty":{backgroundColor:"#fff",border:"1px solid #e9ecef",padding:0,boxShadow:"0 1px 3px rgb(0 0 0 / 5%), rgb(0 0 0 / 5%) 0px 10px 15px -5px, rgb(0 0 0 / 4%) 0px 7px 7px -5px",borderRadius:"4px"},".rc-tree-select-empty":{padding:"8px 12px"},".rc-tree-select-tree-treenode":{boxSizing:"border-box",textAlign:"left",width:"100%",padding:"8px 12px",cursor:"pointer",fontSize:"14px",color:"#000",borderRadius:"4px",display:"flex",flexWrap:"nowrap",overflow:"hidden","&:hover":{backgroundColor:"#f1f3f5"},"&.rc-tree-select-tree-treenode-checkbox-checked":{".rc-tree-select-tree-iconEle .checkbox-icon .checkmark-checked":{stroke:"rgb(64, 192, 87)",animation:"check 200ms linear forwards"}},"&.rc-tree-select-tree-treenode-checkbox-indeterminate":{".rc-tree-select-tree-iconEle .checkbox-icon .checkmark-indeterminate":{fill:"rgb(64, 192, 87)"}},".rc-tree-select-tree-switcher":{height:"16px",alignSelf:"center",paddingRight:"2px",transition:"color 200ms ease","&:hover":{color:"#228be6","svg.caret-icon":{color:"#228be6"}},"svg.caret-icon":{color:"#ced4da",transition:"all 200ms ease"}},".rc-tree-select-tree-node-content-wrapper":{display:"flex",flexWrap:"nowrap",overflow:"hidden",alignItems:"center",gap:"8px",transition:"color 200ms ease","&:hover":{color:"#228be6"}},".rc-tree-select-tree-iconEle":{height:"16px","svg .border":{stroke:"#ced4da"},".checkbox-icon .checkmark-indeterminate":{fill:"transparent",transition:"fill 200ms ease"},".checkbox-icon .checkmark-checked":{transform:"scale(1.2)",transformOrigin:"center center",strokeDasharray:10,strokeDashoffset:-10},"@keyframes check":{"0%":{strokeDashoffset:10},"100%":{strokeDashoffset:0}}},".rc-tree-select-tree-title":{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",".rc-tree-select-tree-title-desc":{fontSize:"12px",maxWidth:"100%",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},".rc-tree-select-tree-indent":{flexGrow:0,height:0,verticalAlign:"bottom"},".rc-tree-select-tree-indent-unit":{display:"inline-block",width:"1em"}}}})),Go=({disabled:e,classNames:t,styles:r,unstyled:i,radius:s,style:o,label:u,value:l,onChange:d,treeData:p})=>{const{classes:f,cx:g}=No({radius:s},{name:"FilterTreeSelectWidget",classNames:t,styles:r,unstyled:i}),[h,b]=m.useState(!1),w=S=>{b(S)},C=h&&(l==null?void 0:l.length)>0;return c(a.Stack,{spacing:3,children:[c(a.Group,{position:"apart",children:[n(a.Text,{className:f.label,children:u}),C&&n(a.Tooltip,{label:`${l.length} selected`,children:n(a.Badge,{children:l.length})})]}),n(Di,{disabled:e,allowClear:!0,className:g(f.root,"check-select"),dropdownClassName:g(f.dropdown,""),onDropdownVisibleChange:w,transitionName:"rc-tree-select-dropdown-slide-up",choiceTransitionName:"rc-tree-select-selection__choice-zoom",style:o,treeLine:!0,clearIcon:()=>n(a.CloseButton,{}),switcherIcon:Oo,treeIcon:Bo,maxTagTextLength:10,value:l,treeData:p,treeNodeFilterProp:"filterBasis",treeCheckable:!0,showCheckedStrategy:Di.SHOW_PARENT,onChange:d,onSelect:console.log,maxTagCount:0,maxTagPlaceholder:S=>`${S.length} selected`})]})},qo=T.observer(({label:e,config:t,value:r,onChange:i})=>{const{treeData:s,treeDataLoading:o}=t,u=t.min_width?t.min_width:"200px",d=!!t.options_query_id?o:!1;return n(Go,{disabled:d,style:{minWidth:"160px",width:u,maxWidth:d?u:"unset",borderColor:"#e9ecef"},value:r,onChange:p=>i(p,!1),treeData:s,label:e})}),Fo=T.observer(({filter:{type:e,config:t,key:r,...i},formFieldProps:s})=>{switch(e){case"select":return n(Eo,{...i,...s,config:t});case"multi-select":return n($o,{...i,...s,config:t});case"tree-select":return n(qo,{...i,...s,config:t});case"text-input":return n(Lo,{...i,...s,config:t});case"date-range":return n(Bi,{...i,...s,config:t});case"checkbox":return n(Io,{...i,...s,config:t});default:return null}}),Ni=T.observer(m.forwardRef(({filter:e,...t},r)=>n("div",{className:"filter-root",ref:r,children:n(ke,{children:n(Fo,{filter:e,formFieldProps:t})})}))),Gi=T.observer(function({view:t}){const r=Y(),{control:i,handleSubmit:s,reset:o}=x.useForm({defaultValues:r.filters.values,reValidateMode:"onBlur"}),u=x.useWatch({control:i});m.useEffect(()=>{o(r.filters.values)},[r.filters.values,o]),m.useEffect(()=>{r.filters.updatePreviewValues(u)},[u]);const l=r.filters.visibleInView(t.id),d=m.useMemo(()=>l.every(h=>h.should_auto_submit),[l]),p=m.useMemo(()=>l.filter(h=>v.get(h,"config.required",!1)),[l]),f=m.useMemo(()=>p.length===0?!1:p.some(h=>!h.requiredAndPass(u[h.key])),[u,p]);if(l.length===0)return null;const g=(h,b)=>(w,C)=>{b(w),(h.should_auto_submit||C)&&r.filters.setValueByKey(h.key,w)};return n("form",{onSubmit:s(r.filters.setValues),children:c(a.Group,{className:"dashboard-filters",position:"apart",noWrap:!0,sx:d?{}:{border:"1px solid #e9ecef",borderRadius:"4px",padding:"16px"},children:[n(a.Group,{align:"flex-start",children:l.map(h=>n(x.Controller,{name:h.key,control:i,render:({field:b})=>n(Ni,{filter:h,value:b.value,onChange:g(h,b.onChange)})},h.id))}),!d&&n(a.Group,{sx:{alignSelf:"flex-end"},children:n(a.Button,{color:"blue",size:"sm",type:"submit",disabled:f,children:"Search"})})]})})}),j1="";function Wo(e){return e?["<p><br></p>","<p></p>"].includes(e):!0}const qi=T.observer(()=>{const{freezeLayout:e}=m.useContext(Ke),[t,r]=m.useState(!1),{panel:i}=Ce();return m.useEffect(()=>{e(t)},[t]),Wo(i.description)?null:c(B,{children:[n(a.Modal,{opened:t,onClose:()=>r(!1),title:i.title,withCloseButton:!1,withinPortal:!0,zIndex:310,children:n(qt,{value:i.description,styles:{root:{border:"none"},content:{padding:0}}})}),n(a.Tooltip,{label:"Click to see description",position:"top-start",withinPortal:!0,children:n(a.ActionIcon,{variant:"subtle",color:"blue",onClick:()=>r(s=>!s),sx:{verticalAlign:"baseline",cursor:"pointer"},children:n(k.InfoCircle,{size:20})})})]})}),jo=T.observer(({view:e})=>{const t=ce(),r=Y(),i=Le.useModals(),{panel:s}=Ce(),{id:o,query:u}=s,{inEditMode:l}=m.useContext(Ke),d=()=>u==null?void 0:u.fetchData(),{viewPanelInFullScreen:p,inFullScreen:f}=m.useContext(yn),g=()=>{r.duplicatePanelByID(o,e.id)},h=()=>{t.editor.open(["_VIEWS_",e.id,"_PANELS_",o])},b=()=>i.openConfirmModal({title:"Delete this panel?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>r.removePanelByID(o,e.id),confirmProps:{color:"red"},zIndex:320}),w=m.useCallback(()=>{p(o)},[o,p]),C=!f&&e.type!==K.Modal;return n(B,{children:n(a.Box,{sx:{position:"absolute",top:0,left:0,right:0,zIndex:300},children:c(a.Menu,{withinPortal:!0,children:[n(a.Menu.Target,{children:n(a.Box,{className:"panel-dropdown-target",sx:{width:"100%",height:"25px"}})}),c(a.Menu.Dropdown,{children:[n(a.Menu.Item,{onClick:d,icon:n(k.Refresh,{size:14}),children:"Refresh"}),n(a.Menu.Item,{onClick:()=>r.queries.downloadDataByQueryID((u==null?void 0:u.id)??""),icon:n(k.Download,{size:14}),children:"Download Data"}),C&&n(a.Menu.Item,{onClick:w,icon:n(k.ArrowsMaximize,{size:14}),disabled:l,children:"Full Screen"}),l&&c(B,{children:[n(a.Divider,{label:"Edit",labelPosition:"center"}),n(a.Menu.Item,{onClick:h,icon:n(k.Settings,{size:14}),children:"Settings"}),n(a.Menu.Item,{onClick:g,icon:n(k.Copy,{size:14}),children:"Duplicate"}),n(a.Menu.Item,{color:"red",onClick:b,icon:n(k.Trash,{size:14}),children:"Delete"})]})]})]})})})}),Y1="",Yo=T.observer(function(){const{panel:t}=Ce(),{title:r}=t;return r?n(a.Group,{grow:!0,position:"center",px:20,className:"panel-title-wrapper",sx:{flexGrow:1},children:n(a.Text,{align:"center",lineClamp:1,weight:"bold",children:r})}):null}),Ne=(e,t)=>{const[r,i]=m.useState([]);return m.useEffect(()=>e.watchTriggerSnapshotList(s=>i(s.filter(o=>o.schemaRef===t))),[]),r};class lt{constructor(t,r){this.root=t,this.path=r}async deleteItem(t){t===null&&await this.root.deleteItem(this.path);const r=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,v.omit(r,t))}async getItem(t){const r=await this.root.getItem(this.path);return t===null?r:v.get(r,t)}async setItem(t,r){if(t===null)await this.root.setItem(this.path,r);else{const i=await this.root.getItem(this.path)||{};await this.root.setItem(this.path,{...i,[t]:r})}return await this.getItem(t)}watchItem(t,r,i){return t===null?this.root.watchItem(this.path,(s,o)=>{r(s,o)},i):this.root.watchItem(this.path,(s,o)=>{const u=v.get(s,t),l=v.get(o,t);u!==l&&r(u,l)},i)}}class Sn{constructor(t,r,i){O(this,"attachmentStorage");this.instance=t,this.attachmentKey=r,this.constructInstance=i,this.attachmentStorage=new lt(t.instanceData,r)}async getInstance(t){if(await this.attachmentStorage.getItem(t))return this.constructInstance(new lt(this.attachmentStorage,t))}async create(t,r){return await this.attachmentStorage.setItem(t,r),this.constructInstance(new lt(this.attachmentStorage,t))}async remove(t){await this.attachmentStorage.deleteItem(t)}async list(){const t=await this.attachmentStorage.getItem(null);return Promise.all(v.values(t).map(r=>this.constructInstance(new lt(this.attachmentStorage,r.id))))}}class Fi{constructor(t){O(this,"rootRef");this.rootRef=se.observable({current:t})}async deleteItem(t){se.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const r=this.getValueFromRoot(t);return Promise.resolve(r)}getValueFromRoot(t){return t===null?se.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,r){if(t===null)if(v.isObject(r))se.runInAction(()=>{this.rootRef.current=r});else throw new Error("Cannot set root value to non-object");else se.runInAction(()=>{v.set(this.rootRef.current,[t],r)});return Promise.resolve(this.getItem(t))}watchItem(t,r,i){return se.reaction(()=>this.getValueFromRoot(t),(s,o)=>{r(s,o)},{requiresObservable:!0,fireImmediately:v.get(i,"fireImmediately",!1)})}}class Ro{constructor(){O(this,"channels",new Map);O(this,"globalChannel",new Ii)}getChannel(t){const r=this.channels.get(t);if(r)return r;const i=new Ii;return this.channels.set(t,i),i}}class Qo{constructor(t){O(this,"instances",new Map);this.pluginManager=t}get availableVizList(){return this.pluginManager.installedPlugins.flatMap(t=>t.manifest.viz)}resolveComponent(t){return this.pluginManager.factory.viz(t)}getOrCreateInstance(t){const r=this.instances.get(t.id);if(r)return r;const i={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new Ro,instanceData:new Fi(t.viz.conf)};return this.instances.set(t.id,i),i}}function Wi(e,t,r,i){return{vizManager:r,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Fi({}),colorPalette:{getColor(){return()=>""}},data:t,variables:i}}const Uo=e=>{const{panel:t,vizManager:r,data:i,variables:s}=e,o=r.resolveComponent(t.viz.type),u=r.getOrCreateInstance(t),l={...Wi(u,i,r,s),viewport:{width:t.layout.w,height:t.layout.h}},d=o.viewRender;return n(d,{context:l,instance:u,...v.omit(e,["panel","vizManager","data"])})},Xo=e=>{const{vizManager:t,panel:r,panelInfoEditor:i,data:s,variables:o}=e,u=t.resolveComponent(r.viz.type),l=t.getOrCreateInstance(r),d={...Wi(l,s,t,o),panelInfoEditor:i},p=u.configRender;return n(p,{context:d,instance:l,...v.omit(e,["panel","vizManager","data","panelInfoEditor"])})},ji=(e,t)=>{const r=je.bezier(e),i=je.bezier(t);return function(s){return s<50?r(s*2/100).hex():i((s-50)*2/100).hex()}},Ft=e=>{const t=je.bezier(e);return function(r){return t(r/100).hex()}},Zo={type:"interpolation",displayName:"Red / Green",getColor:ji(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},Ko={type:"interpolation",displayName:"Yellow / Blue",getColor:ji(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},Jo={type:"interpolation",displayName:"Red",getColor:Ft(["#fff7f1","darkred"]),name:"red",category:"sequential"},Ho={type:"interpolation",displayName:"Green",getColor:Ft(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},el={type:"interpolation",displayName:"Blue",getColor:Ft(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},tl={type:"interpolation",displayName:"Orange",getColor:Ft(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"},Yi="@devtable/dashboard",Tn="9.10.0",Ri="Apache-2.0",Qi={access:"public",registry:"https://registry.npmjs.org/"},Ui=["dist"],Xi="./dist/dashboard.umd.js",Zi="./dist/dashboard.es.js",Ki="./dist/index.d.ts",Ji={".":{import:"./dist/dashboard.es.js",require:"./dist/dashboard.umd.js"},"./dist/style.css":{import:"./dist/style.css",require:"./dist/style.css"}},Hi={"dev-build":"tsc && vite build --watch",build:"tsc && vite build",preview:"vite preview",test:"vitest","test:ui":"vitest --ui",coverage:"vitest --coverage"},ea={"@monaco-editor/react":"4.4.6","@types/chroma-js":"^2.1.4","file-saver":"2.0.5",mathjs:"11.8.0","monaco-editor":"0.36.0","performant-array-to-tree":"1.11.0",popmotion:"^11.0.3","rc-select":"14.1.0","rc-tree-select":"5.5.5",reactflow:"^11.5.3"},ta={"@emotion/babel-plugin":"11.10.6","@faker-js/faker":"7.6.0","@mantine/core":"5.9.5","@mantine/dates":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5","@mantine/prism":"5.9.5","@mantine/tiptap":"5.9.5","@tabler/icons":"1.119.0","@testing-library/cypress":"^9.0.0","@testing-library/jest-dom":"^5.16.4","@testing-library/react":"^13.3.0","@testing-library/react-hooks":"^8.0.1","@testing-library/user-event":"^14.3.0","@tiptap/extension-code-block-lowlight":"2.0.3","@tiptap/extension-color":"2.0.3","@tiptap/extension-highlight":"2.0.3","@tiptap/extension-link":"2.0.3","@tiptap/extension-placeholder":"2.0.3","@tiptap/extension-subscript":"2.0.3","@tiptap/extension-superscript":"2.0.3","@tiptap/extension-table":"2.0.3","@tiptap/extension-table-cell":"2.0.3","@tiptap/extension-table-header":"2.0.3","@tiptap/extension-table-row":"2.0.3","@tiptap/extension-text-align":"2.0.3","@tiptap/extension-text-style":"2.0.3","@tiptap/extension-underline":"2.0.3","@tiptap/pm":"2.0.3","@tiptap/react":"2.0.3","@tiptap/starter-kit":"2.0.3","@types/crypto-js":"v4.1.1","@types/d3-array":"3.0.4","@types/eventemitter2":"^4.1.0","@types/file-saver":"2.0.5","@types/lodash":"^4.14.182","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","@types/react-grid-layout":"^1.3.2",ahooks:"^3.3.11",ajv:"8.12.0",axios:"^0.27.2","crypto-js":"^4.1.1",cypress:"^12.9.0","cypress-wait-until":"^1.7.2",echarts:"^5.3.2","echarts-for-react":"^3.0.2","echarts-gl":"^2.0.9",jsdom:"^20.0.0","jsdom-testing-mocks":"^1.5.0",lodash:"^4.17.21",lowlight:"^2.8.0",numbro:"^2.3.6","prosemirror-commands":"^1.5.0","prosemirror-dropcursor":"^1.6.1","prosemirror-gapcursor":"^1.3.1","prosemirror-history":"^1.3.0","prosemirror-keymap":"^1.2.0","prosemirror-schema-list":"^1.2.2","react-grid-layout":"^1.3.4","react-hook-form":"^7.31.2","rollup-plugin-visualizer":"5.6.0","tabler-icons-react":"^1.48.0",typescript:"^4.6.3","vite-plugin-static-copy":"0.13.1"},na={"@emotion/react":"11.10.6","@faker-js/faker":"7.6.0","@mantine/core":"5.9.5","@mantine/dates":"5.9.5","@mantine/hooks":"5.9.5","@mantine/modals":"5.9.5","@mantine/notifications":"5.9.5","@mantine/prism":"5.9.5","@mantine/tiptap":"5.9.5","@tabler/icons":"1.119.0","@tanstack/react-table":"^8.5.13","@tiptap/extension-code-block-lowlight":"2.0.3","@tiptap/extension-color":"2.0.3","@tiptap/extension-highlight":"2.0.3","@tiptap/extension-link":"2.0.3","@tiptap/extension-placeholder":"2.0.3","@tiptap/extension-subscript":"2.0.3","@tiptap/extension-superscript":"2.0.3","@tiptap/extension-table":"2.0.3","@tiptap/extension-table-cell":"2.0.3","@tiptap/extension-table-header":"2.0.3","@tiptap/extension-table-row":"2.0.3","@tiptap/extension-text-align":"2.0.3","@tiptap/extension-text-style":"2.0.3","@tiptap/extension-underline":"2.0.3","@tiptap/pm":"2.0.3","@tiptap/react":"2.0.3","@tiptap/starter-kit":"2.0.3",ahooks:"^3.3.11",axios:"^0.27.2","chroma-js":"^2.4.2","crypto-js":"^4.1.1","d3-array":"3.2.3","d3-regression":"1.3.10",dayjs:"1.11.7",echarts:"^5.3.2","echarts-for-react":"^3.0.2","echarts-gl":"^2.0.9",eventemitter2:"^6.4.6",jszip:"3.10.1",lodash:"^4.17.21",lowlight:"^2.8.0",mobx:"^6.6.1","mobx-react-lite":"^3.4.0","mobx-state-tree":"^5.1.5",numbro:"^2.3.6","prosemirror-commands":"^1.5.0","prosemirror-dropcursor":"^1.6.1","prosemirror-gapcursor":"^1.3.1","prosemirror-history":"^1.3.0","prosemirror-keymap":"^1.2.0","prosemirror-schema-list":"^1.2.2",react:"^16.8.0 || 17.x || 18.x","react-dom":"^16.8.0 || 17.x || 18.x","react-grid-layout":"^1.3.4","react-hook-form":"^7.31.2","react-router-dom":"^6.3.0","react-virtual":"^2.10.4","tabler-icons-react":"^1.48.0"},nl=Object.freeze(Object.defineProperty({__proto__:null,default:{name:Yi,version:Tn,license:Ri,publishConfig:Qi,files:Ui,main:Xi,module:Zi,types:Ki,exports:Ji,scripts:Hi,dependencies:ea,devDependencies:ta,peerDependencies:na},dependencies:ea,devDependencies:ta,exports:Ji,files:Ui,license:Ri,main:Xi,module:Zi,name:Yi,peerDependencies:na,publishConfig:Qi,scripts:Hi,types:Ki,version:Tn},Symbol.toStringTag,{value:"Module"}));class rl{constructor(t){O(this,"staticColors",new Map);O(this,"interpolations",new Map);t.installedPlugins.forEach(r=>{r.manifest.color.forEach(i=>{this.register(i)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const r=this.encodeColor(t);t.type==="single"?(this.staticColors.has(r)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(r,t)):t.type==="interpolation"&&(this.interpolations.has(r)&&console.warn(`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`,`the interpolation '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.interpolations.set(r,t))}decodeStaticColor(t){return this.staticColors.get(t)}encodeColor(t){return`\${${t.category}}.{${t.name}}`}decodeInterpolation(t){return this.interpolations.get(t)}getColorInterpolations(){return Array.from(this.interpolations.values())}}class il{constructor(){O(this,"plugins",new Map);O(this,"vizComponents",new Map);O(this,"factory",{viz:t=>{const r=this.vizComponents.get(t);if(r)return r;throw new Error(`Viz Component (${t}) not found`)}})}install(t){if(this.plugins.has(t.id))throw new Error(`Plugin (${t.id}) has been installed before`);this.plugins.set(t.id,t);for(const r of t.manifest.viz){if(this.vizComponents.has(r.name))throw new Error(`Viz Component (${r.name}) has been installed before`);this.vizComponents.set(r.name,r)}}get installedPlugins(){return Array.from(this.plugins.values())}}class al{constructor(){O(this,"migrations",[])}version(t,r){return this.migrations.push({version:t,handler:r}),this}run(t,r,i){var u;if(t.from===t.to)return r;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const s=this.migrations.filter(l=>l.version>t.from&&l.version<=t.to),o=v.orderBy(s,"version","asc");if(((u=v.last(o))==null?void 0:u.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return o.reduce((l,d)=>d.handler(l,i),r)}}class fe extends al{constructor(){super(),this.configVersions()}version(t,r){return super.version(t,(i,s)=>({version:t,...r(i,s)}))}async migrate({configData:t,panelModel:r}){const i=await t.getItem(null),s=v.get(i,"version",0),o=this.run({from:s,to:this.VERSION},i,{panelModel:r});await t.setItem(null,o)}async needMigration({configData:t}){const r=await t.getItem(null);return v.get(r,"version",0)<this.VERSION}}const F=(e,t)=>{const[r,{setFalse:i}]=Z.useBoolean(!0),[s,o]=m.useState();m.useEffect(()=>(e.getItem(t).then(l=>{o(l),i()}),e.watchItem(t,l=>{o(l)})));const u=m.useCallback(async l=>{await e.setItem(t,l),o(l)},[e,t]);return{loading:r,value:s,set:u}},kn={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"}};le.use([N.GridComponent,N.VisualMapComponent,N.LegendComponent,N.TooltipComponent,Me.CanvasRenderer]);function sl({context:e}){const{value:t}=F(e.instanceData,"config"),r=e.data,{width:i,height:s}=e.viewport,{x_axis_data_key:o,y_axis_data_key:u,z_axis_data_key:l,xAxis3D:d,yAxis3D:p,zAxis3D:f}=v.defaults({},t,kn),g=m.useMemo(()=>{const w=v.minBy(r,C=>C[l]);return v.get(w,l)},[r,l]),h=m.useMemo(()=>{const w=v.maxBy(r,C=>C[l]);return v.get(w,l)},[r,l]),b={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:g,max:h,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:d,yAxis3D:p,zAxis3D:f,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:r.map(w=>[w[o],w[u],w[l]])}]};return t?n(Ae,{echarts:le,option:b,style:{width:i,height:s},notMerge:!0,theme:"merico-light"}):null}function ol({label:e,required:t,value:r,onChange:i,data:s,clearable:o=!1,sx:u,...l},d){const p=m.useMemo(()=>{if(!Array.isArray(s)||s.length===0)return[];const g=Object.keys(s[0]).map(h=>({label:h,value:h}));return o?g.concat([{label:"unset",value:""}]):g},[s]);return n(a.Select,{ref:d,label:e,data:p,value:r,onChange:i,required:t,sx:u,...l})}const W=m.forwardRef(ol);function ll({context:e}){const{value:t,set:r}=F(e.instanceData,"config"),i=e.data,s=v.defaults({},t,kn),{control:o,handleSubmit:u,reset:l}=x.useForm({defaultValues:s});return m.useEffect(()=>{l(s)},[t]),t?n(a.Stack,{spacing:"xs",children:c("form",{onSubmit:u(r),children:[n(a.Text,{children:"X Axis"}),c(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[n(x.Controller,{name:"x_axis_data_key",control:o,render:({field:d})=>n(W,{label:"Data Field",required:!0,data:i,...d})}),n(x.Controller,{name:"xAxis3D.name",control:o,render:({field:d})=>n(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...d})})]}),n(a.Text,{mt:"lg",children:"Y Axis"}),c(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[n(x.Controller,{name:"y_axis_data_key",control:o,render:({field:d})=>n(W,{label:"Data Field",required:!0,data:i,...d})}),n(x.Controller,{name:"yAxis3D.name",control:o,render:({field:d})=>n(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...d})})]}),n(a.Text,{mt:"lg",children:"Z Axis"}),c(a.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[n(x.Controller,{name:"z_axis_data_key",control:o,render:({field:d})=>n(W,{label:"Data Field",required:!0,data:i,...d})}),n(x.Controller,{name:"zAxis3D.name",control:o,render:({field:d})=>n(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...d})})]}),n(a.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:c(a.Button,{color:"blue",type:"submit",children:[n(k.DeviceFloppy,{size:20}),n(a.Text,{ml:"md",children:"Save"})]})})]})}):null}class ul extends fe{constructor(){super(...arguments);O(this,"VERSION",1)}configVersions(){this.version(1,r=>({version:1,config:r}))}}const dl={displayName:"Bar Chart (3D)",displayGroup:"ECharts-based charts",migrator:new ul,name:"bar-3d",viewRender:sl,configRender:ll,createConfig(){return{version:1,config:v.cloneDeep(kn)}}},Se={mantissa:0,output:"number",trimMantissa:!1,average:!1};function cl({value:e,onChange:t},r){const i=l=>{t({...e,output:l})},s=l=>{const d=l===0?!1:e.trimMantissa;t({...e,mantissa:l,trimMantissa:d})},o=l=>{t({...e,trimMantissa:l.currentTarget.checked})},u=l=>{t({...e,average:l.currentTarget.checked})};return c(a.Stack,{ref:r,children:[c(a.Group,{grow:!0,children:[n(a.Select,{label:"Format",data:[{label:"1234",value:"number"},{label:"99%",value:"percent"}],value:e.output,onChange:i,sx:{flexGrow:1}}),n(a.Switch,{label:c(a.Stack,{spacing:0,children:[n(a.Text,{children:"Average"}),n(a.Text,{size:12,color:"gray",children:"like 1.234k, 1.234m"})]}),checked:e.average,onChange:u,disabled:e.output!=="number",sx:{flexGrow:1},styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"},label:{display:"block"}}})]}),c(a.Group,{grow:!0,children:[n(a.NumberInput,{label:"Mantissa",defaultValue:0,min:0,step:1,max:4,value:e.mantissa,onChange:s}),n(a.Switch,{label:"Trim mantissa",checked:e.trimMantissa,onChange:o,disabled:e.mantissa===0,styles:{root:{alignSelf:"flex-end"},body:{alignItems:"center"}}})]}),c(a.Stack,{spacing:0,children:[n(a.Text,{weight:"bold",children:"Preview"}),n(ke,{children:c(a.Group,{position:"apart",children:[c(a.Text,{size:12,color:"gray",children:["123456789 ",n(k.ArrowRight,{size:9})," ",te(123456789).format(e)]}),c(a.Text,{size:12,color:"gray",children:["1234 ",n(k.ArrowRight,{size:9})," ",te(1234).format(e)]}),c(a.Text,{size:12,color:"gray",children:["0.1234 ",n(k.ArrowRight,{size:9})," ",te(.1234).format(e)]})]})})]})]})}const Oe=m.forwardRef(cl),Ge={enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
|
|
28
28
|
`)},ra={id:"builtin:echarts:click-echart:series",displayName:"Click Chart Series",nameRender:hl,configRender:pl,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 pl(e){return n(B,{})}function hl(e){return n(a.Text,{children:"Click chart's series"})}const fl=[{label:"Truncate",value:"truncate"},{label:"Break Line",value:"break"},{label:"Break Word",value:"breakAll"}],Wt=m.forwardRef(({sectionTitle:e,value:t,onChange:r},i)=>{const s=o=>u=>{const l=v.cloneDeep(t);v.set(l,o,u),r(l)};return c(a.Stack,{spacing:0,children:[e&&n(a.Divider,{mb:-5,mt:5,variant:"dotted",label:e,labelPosition:"right",labelProps:{color:"dimmed"}}),c(a.Group,{grow:!0,noWrap:!0,children:[n(a.NumberInput,{label:"Max Width",hideControls:!0,value:t.width,onChange:s("width")}),n(a.Select,{label:"Overflow",data:fl,value:t.overflow,onChange:s("overflow")}),n(a.TextInput,{label:"Ellipsis",value:t.ellipsis,disabled:!0})]})]})}),Je=m.forwardRef(({value:e,onChange:t},r)=>{const i=o=>{t({...e,on_axis:o})},s=o=>{t({...e,in_tooltip:o})};return c(a.Stack,{ref:r,spacing:0,children:[n(Wt,{sectionTitle:"Overflow on Axis",value:e.on_axis,onChange:i}),n(Wt,{sectionTitle:"Overflow in Tooltip",value:e.in_tooltip,onChange:s})]})}),Ve={on_axis:{width:80,overflow:"truncate",ellipsis:"..."},in_tooltip:{width:200,overflow:"break",ellipsis:"..."}};function He({overflow:e,width:t}){const r={truncate:"initial",break:"break-all",breakAll:"break-word"}[e],i=e==="truncate"?"nowrap":"initial",s={truncate:"ellipsis",break:"clip",breakAll:"clip"}[e];return`
|
|
29
29
|
max-width: ${t}px;
|
|
30
30
|
word-break: ${r};
|
|
@@ -398,7 +398,7 @@ Check the top-level render call using <`+E+">.")}return I}}function ao(_,I){{if(
|
|
|
398
398
|
${Lv.map(Pv).join("")}
|
|
399
399
|
</tbody>
|
|
400
400
|
</table>
|
|
401
|
-
`;function Vv(e,t
|
|
401
|
+
`;function Vv(e,t,r,i){const s=pr(t,r,[],i),o=Object.keys(s),u=Object.values(s);try{return new Function(...o,`return \`${e}\`;`)(...u)}catch(l){return console.info(l),l.message}}function cr(e,t={}){const r=Object.keys(t),i=Object.values(t);try{return new Function(...r,`return \`${e}\`;`)(...i)}catch(s){throw r.length===0&&e.includes("$")?new Error("[formatSQL] insufficient params"):s}}function pr(e,t,r,i){const s={...t,...e},o={context:s,filters:i},u=r.reduce((l,d)=>(l[d.key]=cr(d.value,o),l),{});return v.merge({},{context:s,filters:i,sql_snippets:u})}function bs(e,t,r,i,s){try{const o=pr(t,r,i,s);return cr(e,o)}catch(o){return console.error(o),o.message}}function Bv({sql:e,pre_process:t}){if(!t.trim())return e;try{return new Function(`return ${t}`)()({sql:e},ht)}catch(r){return console.error(r),e}}function Nv(e,t){if(!e.trim())return t;try{return new Function(`return ${e}`)()(t,ht)}catch(r){return console.error(r),t}}async function Gv({context:e,mock_context:t,sqlSnippets:r,query:i,filterValues:s},o){if(!i.sql)return[];const{type:u,key:l,sql:d,pre_process:p,post_process:f}=i,g=pr(e,t,r,s),h=cr(d,g),b=Bv({sql:h,pre_process:p});let w=await ze.query(o)({type:u,key:l,query:b},{});return w=Nv(f,w),w}async function qv({type:e,key:t,configString:r},i){return await ze.query(i)({type:e,key:t,query:r},{})}async function hr(){try{return(await ze.getRequest("POST")("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}})).data}catch(e){return console.error(e),[]}}const Fv=y.types.model("QueryModel",{id:y.types.string,name:y.types.string,type:y.types.enumeration("DataSourceType",[pe.Postgresql,pe.MySQL,pe.HTTP]),key:y.types.string,sql:y.types.string,pre_process:y.types.optional(y.types.string,""),post_process:y.types.optional(y.types.string,""),run_by:y.types.optional(y.types.array(y.types.string),[])}).views(e=>({get valid(){return e.id&&e.type&&e.key&&e.name?e.type===pe.HTTP?!!e.pre_process:!!e.sql:!1},get json(){const{id:t,name:r,type:i,key:s,sql:o,run_by:u,pre_process:l,post_process:d}=e;return sn({id:t,key:s,sql:o,name:r,type:i,run_by:u,pre_process:l,post_process:d})},get conditionOptions(){if(!y.isAlive(e))return[];const{context:t,mock_context:r,filterValues:i}=y.getRoot(e).content.payloadForSQL,s=Object.keys({...r,...t}).map(l=>`context.${l}`),o=Object.keys(i).map(l=>`filters.${l}`);return[...s,...o].map(l=>({label:l.split(".")[1],value:l,group:v.capitalize(l.split(".")[0])}))},get unmetRunByConditions(){if(!y.isAlive(e))return[];const{run_by:t}=e;if(t.length===0)return[];const{context:r,mock_context:i,filterValues:s}=y.getRoot(e).content.payloadForSQL,o={context:{...i,...r},filters:s};return t.filter(u=>{const l=v.get(o,u);return Array.isArray(l)?l.length===0:typeof l=="number"?Number.isNaN(l):!l})}})).views(e=>({get runByConditionsMet(){return e.unmetRunByConditions.length===0},get conditionNames(){if(e.unmetRunByConditions.length===0)return{context:[],filters:[]};const{keyLabelMap:t}=y.getRoot(e).content.filters,r=e.unmetRunByConditions.filter(s=>s.startsWith("context.")).map(s=>s.split("context.")[0]),i=e.unmetRunByConditions.filter(s=>s.startsWith("filters.")).map(s=>v.get({filters:t},s)).filter(s=>!!s);return{context:r,filters:i}}})).actions(e=>({setName(t){e.name=t},setKey(t){e.key=t},setType(t){e.type=t},setSQL(t){e.sql=t},setRunBy(t){e.run_by.length=0,e.run_by.push(...t)},setPreProcess(t){e.pre_process=t},setPostProcess(t){e.post_process=t}}));function Wv(e,t){return new Function(`return ${e}`)()(t,ht)}function jv(e,t,r){return{context:{...t,...e},filters:r}}function Yv(e,t,r,i){const s=jv(t,r,i);return Wv(e,s)}function Rv(e,t){try{return new Function(`return ${e.config.processing.pre}`)()(t,ht)}catch(r){return console.error(r),t}}function Qv(e,t){try{return new Function(`return ${e.config.processing.post}`)()(t,ht)}catch(r){return console.error(r),t}}function Uv(e,t){try{return new Function(`return ${e}`)()(t,ht)}catch(r){return console.error(r),t}}const ys=y.types.compose("QueryModel",Fv,y.types.model({state:y.types.optional(y.types.enumeration(["idle","loading","error"]),"idle"),data:y.types.optional(y.types.array(y.types.frozen()),[]),error:y.types.frozen()})).views(e=>({get formattedSQL(){const{context:t,mock_context:r,sqlSnippets:i,filterValues:s}=y.getRoot(e).content.payloadForSQL;return bs(e.sql,t,r,i,s)},get typedAsSQL(){return[pe.Postgresql,pe.MySQL].includes(e.type)},get typedAsHTTP(){return[pe.HTTP].includes(e.type)},get datasource(){const{key:t,type:r}=e;return y.getRoot(e).datasources.find({type:r,key:t})},get httpConfigString(){const{context:t,mock_context:r,filterValues:i}=y.getRoot(e).content.payloadForSQL,{name:s,pre_process:o}=e.json,u=Yv(o,t,r,i);return console.groupCollapsed(`Request config for: ${s}`),console.log(u),console.groupEnd(),JSON.stringify(u)}})).views(e=>({get stateMessage(){if(e.state!=="idle")return"";if(!e.runByConditionsMet){const{context:t,filters:r}=e.conditionNames;if(t.length===0&&r.length===0)return"Waiting";const i=[];return t.length>0&&i.push(`context: ${t.join(", ")}`),r.length>0&&i.push(`filter${r.length>1?"s":""}: ${r.join(", ")}`),i.length===2&&i.splice(1,0,"and"),i.unshift("Waiting for"),i.join(" ")}return e.data.length>0?"":"Empty Data"}})).volatile(()=>({controller:new AbortController})).actions(e=>({runSQL:y.flow(function*(){var t;if(e.valid&&((t=e.controller)==null||t.abort(),!!e.runByConditionsMet)){e.controller=new AbortController,e.state="loading";try{const{context:r,mock_context:i,sqlSnippets:s,filterValues:o}=y.getRoot(e).content.payloadForSQL;e.data=yield*y.toGenerator(Gv({context:r,mock_context:i,sqlSnippets:s,title:e.name,query:e.json,filterValues:o},e.controller.signal)),e.state="idle",e.error=null}catch(r){if(!Xe.isCancel(r)){e.data.length=0;const i=v.get(r,"message","unkown error");e.error=v.get(r,"response.data.detail.message",i),e.state="error"}}}}),runHTTP:y.flow(function*(){var t;if(console.log("runHTTP, ",e.datasource),!(!e.valid||!e.datasource)&&((t=e.controller)==null||t.abort(),!!e.runByConditionsMet)){e.controller=new AbortController,e.state="loading";try{const{type:r,key:i,post_process:s}=e.json;let o=JSON.parse(e.httpConfigString);o=Rv(e.datasource,o);const u=yield*y.toGenerator(qv({type:r,key:i,configString:JSON.stringify(o)},e.controller.signal));let l=Qv(e.datasource,u);l=Uv(s,l),e.data=l,e.state="idle",e.error=null}catch(r){if(console.error(r),!Xe.isCancel(r)){e.data.length=0;const i=v.get(r,"message","unkown error");e.error=v.get(r,"response.data.detail.message",i),e.state="error"}}}})})).actions(e=>({fetchData:()=>e.typedAsHTTP?e.runHTTP():e.runSQL(),beforeDestroy(){var t;(t=e.controller)==null||t.abort()}})).actions(e=>({afterCreate(){y.addDisposer(e,se.reaction(()=>{var t,r;return e.typedAsHTTP?`${e.id}--${e.key}--${e.httpConfigString}--${(t=e.datasource)==null?void 0:t.id}`:`${e.id}--${e.key}--${e.formattedSQL}--${e.pre_process}--${e.post_process}--${(r=e.datasource)==null?void 0:r.id}`},e.fetchData,{fireImmediately:!0,delay:0}))}})),vs=y.types.model("QueriesModel",{current:y.types.optional(y.types.array(ys),[])}).views(e=>({get firstID(){if(e.current.length!==0)return e.current[0].id},findByID(t){return e.current.find(r=>r.id===t)},get options(){const t=e.current.map(r=>({value:r.id,label:r.name,_type:"query"}));return v.sortBy(t,r=>r.label.toLowerCase())}})).views(e=>({get json(){return e.current.filter(t=>t.id).map(t=>t.json)}})).actions(e=>({replace(t){e.current=y.cast(t)},append(t){e.current.push(t)},remove(t){e.current.splice(t,1)},replaceByIndex(t,r){e.current.splice(t,1,r)},downloadAllData(){const t=e.current.map(({name:r,data:i})=>({id:r,data:i.toJSON()}));Ev(t)},downloadDataByQueryID(t){const r=e.findByID(t);if(!r){console.log("[downloadDataByQueryID] query not found");return}const{name:i,data:s}=r,o=ms(s);$v(i,o)},refetchDataByQueryID(t){const r=e.findByID(t);if(!r){console.error(new Error(`[downloadDataByQueryID] query by ID[${t}] not found`));return}return r.fetchData()},removeQuery(t){const r=e.current.find(i=>i.id===t);r&&(y.detach(r),e.current.remove(r))}})),xs=y.types.model("SQLSnippetModel",{key:y.types.string,value:y.types.string}).views(e=>({get json(){const{key:t,value:r}=e;return{key:t,value:r}},isADuplicatedKey(t){return!t||t===e.key?!1:!!y.getParent(e,2).findByKey(t)}})).actions(e=>({setKey(t){e.key=t},setValue(t){e.value=t}})),Cs=y.types.model("SQLSnippetsModel",{current:y.types.optional(y.types.array(xs),[])}).views(e=>({get json(){return e.current.map(t=>t.json)},get options(){const t=e.current.map(r=>({label:r.key,value:r.key,_type:"sql_snippet"}));return v.sortBy(t,r=>r.label.toLowerCase())},get record(){return e.current.reduce((t,r)=>(t[r.key]=r.value,t),{})},get firstKey(){if(e.current.length!==0)return e.current[0].key},findByKey(t){return e.current.find(r=>r.key===t)}})).actions(e=>({replace(t){e.current=y.cast(t)},append(t){e.current.push(t)},remove(t){e.current.splice(t,1)},removeByKey(t){const r=e.current.findIndex(i=>i.key===t);r>=0&&e.current.splice(r,1)},replaceByIndex(t,r){e.current.splice(t,1,r)}})),ws=y.types.model("ContextModel",{current:y.types.optional(y.types.frozen(),{})}).views(e=>({get keys(){return Object.keys(e.current)},get entries(){return Object.entries(e.current)}})).actions(e=>({replace(t){e.current=t},get(t){return e.current[t]},set(t,r){e.current[t]=r}})),Xv=y.types.model({data:y.types.optional(y.types.frozen(),[]),state:y.types.optional(y.types.enumeration(["idle","loading","error"]),"idle"),error:y.types.frozen()}).views(e=>({get loading(){return e.state==="loading"},get empty(){return e.data.length===0},get sql(){const t=y.getParent(e,1),{type:r,table_name:i,table_schema:s}=t;if(r===pe.MySQL)return`
|
|
402
402
|
SELECT ordinal_position, column_key, column_name, column_type, is_nullable, column_default, column_comment
|
|
403
403
|
FROM information_schema.columns
|
|
404
404
|
WHERE table_name = '${i}' AND table_schema = '${s}'
|
|
@@ -493,4 +493,4 @@ WHERE
|
|
|
493
493
|
`),post:["function process_result(res, utils) {"," // your code goes here"," return data","}"].join(`
|
|
494
494
|
`)},hC=T.observer(({queryModel:e})=>e.typedAsHTTP?c(a.Tabs,{defaultValue:"pre_process",orientation:"vertical",sx:{flexGrow:1},children:[c(a.Tabs.List,{children:[n(a.Tabs.Tab,{value:"pre_process",children:"Build Request"}),n(a.Tabs.Tab,{value:"post_process",children:"Process Result"}),n(_r,{})]}),n(a.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:n(dn,{label:"",value:e.pre_process,onChange:e.setPreProcess,defaultValue:Qs.pre})}),n(a.Tabs.Panel,{value:"post_process",p:"sm",children:n(dn,{label:"",value:e.post_process,onChange:e.setPostProcess,defaultValue:Qs.post})})]}):null),fC=T.observer(({queryID:e,usage:t})=>{const r=ce().editor,i=o=>{if(o.type==="filter"){r.setPath(["_FILTERS_",o.id]);return}if(o.type==="panel"){const u=o.views[0].id;r.setPath(["_VIEWS_",u,"_PANELS_",o.id]);return}},s=o=>{r.setPath(["_VIEWS_",o])};return n(a.Stack,{py:"sm",px:"md",children:c(a.Table,{highlightOnHover:!0,sx:{tableLayout:"fixed"},children:[n("thead",{children:c("tr",{children:[n("th",{style:{width:100},children:"Type"}),n("th",{style:{width:"calc(50% - 50px)"},children:"Name"}),n("th",{children:"In View(s)"})]})}),n("tbody",{children:t.map(o=>c("tr",{children:[n("td",{children:v.capitalize(o.type)}),n("td",{children:n(a.Anchor,{component:"button",type:"button",onClick:()=>i(o),children:o.label})}),n("td",{children:c(a.Stack,{align:"flex-start",justify:"flex-start",spacing:2,children:[o.views.map(u=>n(a.Anchor,{component:"button",type:"button",onClick:()=>s(u.id),children:n(a.Box,{children:u.label})})),o.views.length===0&&n(a.Box,{children:"--"})]})})]},o.id))})]})})}),Sr=({value:e,onChange:t,height:r="200px",defaultLanguage:i="sql"})=>{const s=u=>{console.log("changing"),t==null||t(u??"")},o=!t;return n(_e,{className:"minimal-monaco-editor",height:r,defaultLanguage:i,value:e,onChange:o?void 0:s,theme:"vs-dark",options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1},readOnly:o||!t}})},gC=({value:e,height:t="200px",defaultLanguage:r="sql"})=>n(_e,{className:"preview-sql-in-monaco-editor",height:t,defaultLanguage:r,value:e,onChange:void 0,theme:"vs-light",options:{lineNumbers:"on",folding:!0,lineDecorationsWidth:20,wordWrap:"on",minimap:{enabled:!1},readOnly:!0}}),mC=T.observer(({value:e})=>{const r=Y().payloadForSQL,i=m.useMemo(()=>{const{context:s,mock_context:o,sqlSnippets:u,filterValues:l}=r;return bs(e,s,o,u,l)},[e,r]);return n(gC,{height:"100%",value:i})}),Us={pre:["function process_request({ context, filters, sql }, utils) {"," // modify and return sql"," return sql","}"].join(`
|
|
495
495
|
`),post:["function process_result(data, utils) {"," // process data and return the result"," return data","}"].join(`
|
|
496
|
-
`)},bC=T.observer(({queryModel:e})=>{const[t,r]=m.useState(e.sql);m.useEffect(()=>{r(o=>o!==e.sql?e.sql:o)},[e.sql]);const i=t!==e.sql,s=()=>{e.setSQL(t)};return e.typedAsSQL?c(a.Tabs,{defaultValue:"Edit",orientation:"vertical",sx:{flexGrow:1},styles:{tabLabel:{width:"100%",height:"28px",lineHeight:"28px"}},keepMounted:!1,children:[c(a.Tabs.List,{children:[n(a.Tabs.Tab,{value:"Edit",children:c(a.Group,{spacing:14,position:"apart",children:["Edit SQL",n(a.ActionIcon,{mr:5,variant:"filled",color:"blue",disabled:!i,onClick:s,children:n(k.DeviceFloppy,{size:20})})]})}),n(a.Tabs.Tab,{value:"Preview",children:"Preview SQL"}),n(a.Tabs.Tab,{value:"pre_process",children:"Process Request"}),n(a.Tabs.Tab,{value:"post_process",children:"Process Result"}),n(_r,{}),e.datasource&&n(Ys,{dataSource:e.datasource})]}),n(a.Tabs.Panel,{value:"Edit",sx:{position:"relative"},p:"sm",children:n(Sr,{height:"100%",value:t,onChange:r})}),n(a.Tabs.Panel,{value:"Preview",p:0,pl:4,children:n(mC,{value:e.sql})}),n(a.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:n(dn,{label:"",value:e.pre_process,onChange:e.setPreProcess,defaultValue:Us.pre})}),n(a.Tabs.Panel,{value:"post_process",p:"sm",children:n(dn,{label:"",value:e.post_process,onChange:e.setPostProcess,defaultValue:Us.post})})]}):null}),cn={height:"calc(100% - 44px)",padding:0},yC=T.observer(({queryModel:e})=>{const t=Y(),r=m.useMemo(()=>e.datasource?e.typedAsHTTP?"HTTP":"SQL":"Configurations",[e.datasource,e.typedAsHTTP]),[i,s]=m.useState(r);m.useEffect(()=>{s(l=>l!=="Configurations"&&r==="Configurations"?"Configurations":l)},[r]);const o=t.findQueryUsage(e.id),u=o.length===0;return n(a.Stack,{sx:{flexGrow:1},my:0,p:0,children:c(a.Tabs,{value:i,onTabChange:s,defaultValue:r,orientation:"horizontal",keepMounted:!1,sx:{flexGrow:1},children:[c(a.Tabs.List,{grow:!0,children:[n(a.Tabs.Tab,{value:"Configurations",children:"Configurations"}),e.typedAsSQL&&n(a.Tabs.Tab,{value:"SQL",children:"Request"}),e.typedAsHTTP&&n(a.Tabs.Tab,{value:"HTTP",children:"Request"}),n(a.Tabs.Tab,{value:"Data",disabled:!e.datasource,children:n(a.Tooltip,{label:"Need to pick a Data Source first",disabled:e.datasource,withinPortal:!0,children:n(a.Text,{children:"Data"})})}),n(a.Tabs.Tab,{value:"Usage",disabled:u,children:n(a.Tooltip,{label:"This query is not used for any filter or panel",disabled:!u,withinPortal:!0,children:n(a.Text,{children:"Usage"})})})]}),n(a.Tabs.Panel,{value:"Configurations",pt:0,p:0,children:n(uC,{queryModel:e})}),e.typedAsSQL&&n(a.Tabs.Panel,{value:"SQL",sx:cn,children:n(a.Stack,{sx:{height:"100%"},children:n(bC,{queryModel:e})})}),e.typedAsHTTP&&n(a.Tabs.Panel,{value:"HTTP",sx:cn,children:n(a.Stack,{sx:{height:"100%"},children:n(hC,{queryModel:e})})}),n(a.Tabs.Panel,{value:"Data",sx:{...cn,overflow:"hidden"},children:n(Gs,{id:e.id})}),n(a.Tabs.Panel,{value:"Usage",sx:{...cn,overflow:"hidden"},children:n(fC,{queryID:e.id,usage:o})})]})})}),vC=T.observer(({id:e})=>{const r=Y().queries.findByID(e);return e===""?null:r?n(a.Stack,{sx:{height:"100%"},spacing:"sm",children:n(yC,{queryModel:r})}):n(a.Text,{size:14,color:"red",children:"Invalid Query ID"})}),xC=T.observer(({value:e})=>{const t=Y(),{context:r,mock_context:i,filterValues:s}=t.payloadForSQL,o=Wv(e,r,i,s);return n(Sr,{height:"100%",value:o})}),CC=T.observer(({item:e,remove:t,onKeyChanged:r})=>{const[i,s]=m.useState("SQL"),[o,u]=m.useState(e.key),l=()=>{e.setKey(o),r(o)},d=o!==e.key,p=e.isADuplicatedKey(o),[f,g]=m.useState(e.value),h=()=>{e.setValue(f)};m.useEffect(()=>{u(e.key),g(e.value)},[e]);const b=f!==e.value,w=Le.useModals(),C=()=>{w.openConfirmModal({title:"Delete this SQL snippet?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:t,confirmProps:{color:"red"},zIndex:320})};return c(a.Stack,{p:20,sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",children:[c(a.Group,{sx:{alignItems:"end"},spacing:40,children:[n(a.TextInput,{label:p?"This key is occupied by another snippet":"Key",value:o,onChange:S=>{u(S.currentTarget.value)},sx:{flexGrow:"1 !important"},rightSection:n(a.ActionIcon,{color:"blue",variant:"subtle",onClick:l,disabled:!d||p,children:n(k.DeviceFloppy,{size:16})}),error:p}),n(a.Button,{leftIcon:n(k.Trash,{size:16}),color:"red",variant:"light",onClick:C,children:"Delete this SQL Snippet"})]}),c(a.Tabs,{value:i,onTabChange:s,sx:{flexGrow:1},styles:{panel:{height:"calc(100% - 50px)"}},children:[c(a.Tabs.List,{sx:{position:"relative"},children:[n(a.Tabs.Tab,{value:"SQL",children:"SQL"}),n(a.Tabs.Tab,{value:"Preview",children:"Preview"}),n(_r,{}),n(a.ActionIcon,{color:"blue",variant:"filled",onClick:h,disabled:!b,sx:{position:"absolute",top:0,right:10},children:n(k.DeviceFloppy,{size:18})})]}),n(a.Tabs.Panel,{value:"SQL",pt:"sm",children:n(Sr,{height:"100%",value:f,onChange:g})}),n(a.Tabs.Panel,{value:"Preview",pt:"sm",children:n(xC,{value:f})})]})]})}),wC=T.observer(({id:e})=>{const t=ce(),r=Y(),i=m.useMemo(()=>r.sqlSnippets.findByKey(e),[e]);if(!e)return null;if(!i)return c(a.Text,{size:14,children:["SQL Snippet by key[",e,"] is not found"]});const s=()=>{t.editor.setPath(["_SQL_SNIPPETS_",""])};return n(CC,{item:i,remove:()=>{r.sqlSnippets.removeByKey(e),s()},onKeyChanged:l=>{t.editor.setPath(["_SQL_SNIPPETS_",l])}})}),_C=T.observer(({view:e})=>!e||e.type!==K.Division?null:c(a.Stack,{children:[n(a.Divider,{mt:8,mb:0,label:"Division settings",labelPosition:"center"}),n(a.Text,{align:"center",size:"xs",color:"dimmed",children:"Under construction"})]})),SC=[{value:"default",label:"Default"},{value:"outline",label:"Outline"},{value:"pills",label:"Pills"}],TC=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical"}],kC=T.observer(({view:e})=>{if(!e||e.type!==K.Tabs)return null;const t=e.config;return c(a.Stack,{children:[n(a.Divider,{mt:8,mb:0,label:"Tabs settings",labelPosition:"center"}),n(a.Select,{label:"Variant",value:t.variant,onChange:t.setVariant,data:SC}),n(a.Select,{label:"Orientation",value:t.orientation,onChange:t.setOrientation,data:TC}),n(a.Switch,{label:"Grow Tabs",checked:t.grow,onChange:r=>t.setGrow(r.currentTarget.checked)})]})}),DC=({disabled:e,value:t,onChange:r})=>{const i=s=>{s&&r(s)};return c(a.Box,{sx:{position:"relative"},children:[e&&n(a.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),n(_e,{height:"500px",defaultLanguage:"javascript",value:t,onChange:i,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})},IC=({value:e,onChange:t})=>{const[r,{setTrue:i,setFalse:s}]=Z.useBoolean(),[o,u]=m.useState(e??fr),l=h=>{u({...o,enabled:h})},d=()=>{s();const{enabled:h,func_content:b}=o,w={enabled:h,func_content:b};u(w),t(w)},p=()=>{s(),u(e)},f=h=>{u(b=>({...b,func_content:h}))},g=()=>{f(fr.func_content)};return c(B,{children:[n(a.ActionIcon,{size:"lg",color:"blue",variant:"filled",mt:26,onClick:i,sx:{flexGrow:0},children:n(k.Settings,{size:14})}),n(a.Modal,{size:800,title:"Customize modal title",opened:r,onClose:s,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:r&&c(a.Stack,{children:[n(a.Checkbox,{mt:10,label:"Enabled",checked:o.enabled,onChange:h=>l(h.currentTarget.checked)}),n(DC,{value:o.func_content,onChange:f,disabled:!o.enabled}),c(a.Group,{position:"apart",children:[n(a.Button,{onClick:g,color:"red",leftIcon:n(k.Recycle,{size:20}),children:"Rest"}),c(a.Group,{position:"right",children:[n(a.Button,{onClick:p,variant:"subtle",children:"Cancel"}),n(a.Button,{onClick:d,children:"OK"})]})]})]})})]})},MC=T.observer(({view:e})=>{if(!e||e.type!==K.Modal)return null;const t=e.config,r=t.custom_modal_title.value;return c(a.Stack,{children:[n(a.Divider,{mt:8,label:"Modal settings",labelPosition:"center"}),c(a.Flex,{gap:10,children:[n(a.TextInput,{label:"Modal Title",value:r,onChange:v.noop,disabled:!0,sx:{flexGrow:1}}),n(IC,{value:t.custom_modal_title,onChange:t.custom_modal_title.replace})]}),c(a.Group,{grow:!0,children:[n(a.TextInput,{label:"Width",value:t.width,onChange:i=>t.setWidth(i.currentTarget.value),placeholder:"600px / 50vw"}),n(a.TextInput,{label:"Height",value:t.height,onChange:i=>t.setHeight(i.currentTarget.value),placeholder:"600px / 50vw"})]})]})}),AC=T.observer(({view:e})=>c(B,{children:[n(_C,{view:e}),n(MC,{view:e}),n(kC,{view:e})]})),$C=[{label:"Division",value:K.Division},{label:"Modal",value:K.Modal},{label:"Tabs",value:K.Tabs}],zC=T.observer(({view:e})=>e?c(a.Stack,{sx:{position:"relative"},children:[n(a.TextInput,{label:"Name",value:e.name,onChange:t=>{e.setName(t.currentTarget.value)}}),n(a.Select,{label:"Type",withinPortal:!0,value:e.type,onChange:e.setType,data:$C}),n(AC,{view:e})]}):null),EC=T.observer(({id:e})=>{const t=Le.useModals(),r=ce(),i=Y();if(e==="")return null;const s=i.views.findByID(e);if(!s)return c(a.Text,{size:14,children:["View by ID[",e,"] is not found"]});const o=()=>{r.editor.setPath(["_VIEWS_",""])},u=()=>{t.openConfirmModal({title:"Delete this view?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>{i.views.removeByID(e),o()},zIndex:320})};return c(a.Stack,{sx:{maxWidth:"600px",height:"100%"},spacing:"sm",children:[n(a.Group,{position:"right",pt:10,children:n(a.Button,{size:"xs",color:"red",leftIcon:n(k.Trash,{size:16}),onClick:u,children:"Delete this view"})}),n(a.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:n(zC,{view:s})})]})});function LC(e){return e.length===1&&e[0]==="_GLOBAL_VARS_"}function PC(e){return e.length===1&&e[0]==="_MOCK_CONTEXT_"}function OC(e){return e.length===2&&e[0]==="_FILTERS_"}function VC(e){return e.length===2&&e[0]==="_SQL_SNIPPETS_"}function BC(e){return e.length===2&&e[0]==="_QUERIES_"}function NC(e){return e.length===2&&e[0]==="_VIEWS_"}function GC(e){return e.length===4&&e[0]==="_VIEWS_"&&e[2]==="_PANELS_"}const qC=T.observer(()=>n(a.Stack,{sx:{height:"100%"},p:"sm",children:n(Rs,{})})),FC=T.observer(()=>{const e=ce().editor,t=e.path;return LC(t)?n(qC,{}):PC(t)?n(p0,{}):OC(t)?n(a.Box,{p:"xs",pl:20,children:n(c0,{id:t[1]})}):VC(t)?n(wC,{id:t[1]}):BC(t)?n(vC,{id:t[1]}):NC(t)?n(a.Box,{p:"xs",pl:20,children:n(EC,{id:t[1]})}):GC(t)?n(F0,{viewID:t[1],panelID:t[3]}):n(a.Box,{children:e.path})}),WC=T.observer(()=>n(FC,{})),jC=T.observer(()=>{const e=ce(),t=()=>{const r=new Date().getTime().toString(),i={id:r,key:r,label:r,order:e.content.filters.current.length+1,type:lr.TextInput,config:ds(),visibleInViewsIDs:["Main"],auto_submit:!1};e.content.filters.append(i),e.editor.setPath(["_FILTERS_",r])};return n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Filter"})}),YC=T.observer(({parentID:e})=>{const t=Y();if(!e)return null;const r=t.views.findByID(e);return r?n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:()=>t.addANewPanel(r.id),sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Panel"}):null}),RC=T.observer(()=>{const e=ce(),t=()=>{const r=new Date().getTime().toString(),i={id:r,name:r,type:pe.Postgresql,key:"",sql:""};e.content.queries.append(i),e.editor.setPath(["_QUERIES_",r])};return n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Query"})}),QC=T.observer(()=>{const e=ce(),t=()=>{const r=new Date().getTime().toString(),i={key:r,value:""};e.content.sqlSnippets.append(i),e.editor.setPath(["_SQL_SNIPPETS_",r])};return n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a SQL Snippet"})}),UC=T.observer(()=>{const e=Y();return n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a View"})}),XC=T.observer(({action_type:e,parentID:t})=>(Y(),e==="_Add_A_Filter_"?n(jC,{}):e==="_Add_A_SQL_SNIPPET_"?n(QC,{}):e==="_Add_A_QUERY_"?n(RC,{}):e==="_Add_A_VIEW_"?n(UC,{}):e==="_Add_A_PANEL_"?n(YC,{parentID:t}):null)),Xs=T.observer(({option:e})=>{var p;const t=ce().editor,r=t.isOptionActive,i=r(t.path,e),s=t.isOptionOpened,o=t.navigate,u=s(e),[l,d]=m.useState(u);return m.useEffect(()=>{d(u)},[u]),n(a.NavLink,{active:i,defaultOpened:u,opened:l,onChange:d,label:e.label,onClick:()=>o(e),icon:e.Icon?n(e.Icon,{size:18}):null,children:(p=e.children)==null?void 0:p.map(f=>f._type==="ACTION"?n(XC,{action_type:f._action_type,parentID:f.parentID},`_ADD_${f.value}_`):n(Xs,{option:f},f.value))},e.label)}),ZC=T.observer(()=>{const e=ce();return n(a.Box,{sx:{position:"relative"},children:e.editor.navOptions.map(t=>n(Xs,{option:t},t.value))})}),KC=T.observer(()=>{const e=ce();return c(a.Navbar,{p:0,width:{base:200,xs:200,sm:220,md:240,lg:280,xl:300},sx:{height:"100vh - 60px - 60px"},children:[n(a.Navbar.Section,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:n(a.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:"Settings"})}),n(a.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:n(ZC,{})}),n(a.Navbar.Section,{children:n(a.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:n(a.Button,{size:"xs",color:"red",leftIcon:n(V.IconX,{size:18}),onClick:()=>e.editor.close(),children:"Close"})})})]})}),JC={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"}},HC=T.observer(()=>{const e=ce().editor;return n(a.Modal,{onClose:()=>e.setSettingsOpen(!1),closeOnEscape:!1,closeOnClickOutside:!1,opened:e.settings_open,fullScreen:!0,title:null,transitionDuration:0,withCloseButton:!1,withinPortal:!0,zIndex:300,styles:{modal:{padding:"0 !important"}},children:n(a.AppShell,{padding:0,navbar:n(KC,{}),styles:JC,children:n(WC,{})})})}),ew=e=>e.replace(/([^:])(\/\/+)/g,"$1/");function tw(e){m.useEffect(()=>{if(_e.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/dashboard");const r=ew(e);_e.loader.config({paths:{vs:r}}),_e.loader.init().then(i=>console.log("monaco instance:",i))},[])}ma();const nw={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:60+30,height:"100vh"}},rw=({context:e,dashboard:t,content:r,update:i,className:s="dashboard",config:o,onChange:u,headerSlot:l,headerMenuItems:d},p)=>{tw(o.monacoPath),ns(o);const{data:f=[]}=Z.useRequest(hr),[g,h]=m.useState(!1),b=m.useMemo(()=>mr(t,r,f,e),[t,r]);m.useImperativeHandle(p,()=>b,[b]),zi(b.content,!0),m.useEffect(()=>{b.context.replace(e)},[e]),m.useEffect(()=>{b.datasources.replace(f)},[f]),m.useEffect(()=>se.reaction(()=>se.toJS(b.json),M=>{u==null||u(M)}),[b]);const w=async()=>{await i(b.json,b.content.json)},C=Z.useCreation(sr,[]),S=br(C);return n(Le.ModalsProvider,{children:n(vn,{value:b,children:n(xn,{value:b.content,children:n(Ke.Provider,{value:{layoutFrozen:g,freezeLayout:h,inEditMode:!0},children:n(qe.Provider,{value:C,children:c(Gt,{configure:S,children:[n(a.AppShell,{padding:0,header:n(_x,{saveDashboardChanges:w,headerSlot:l,headerMenuItems:d}),navbar:n(Zx,{}),styles:nw,children:n(a.Box,{className:`${s} dashboard-root`,sx:{position:"relative"},children:b.content.views.visibleViews.map(M=>n(ts,{view:M},M.id))})}),n(HC,{})]})})})})})})},iw=T.observer(m.forwardRef(rw)),e_="";ma();const aw=T.observer(({context:e,dashboard:t,content:r,className:i="dashboard",config:s,fullScreenPanelID:o,setFullScreenPanelID:u})=>{ns(s);const{data:l=[]}=Z.useRequest(hr),d=m.useMemo(()=>mr(t,r,l,e),[t,r]);zi(d.content,!1),m.useEffect(()=>{d.context.replace(e)},[e]),m.useEffect(()=>{d.datasources.replace(l)},[l]);const p=Z.useCreation(sr,[]),f=br(p);return n(Le.ModalsProvider,{children:n(vn,{value:d,children:n(xn,{value:d.content,children:n(wn.Provider,{value:{fullScreenPanelID:o,setFullScreenPanelID:u},children:n(Ke.Provider,{value:{layoutFrozen:!0,freezeLayout:v.noop,inEditMode:!1},children:n(a.Box,{className:`${i} dashboard-root`,children:n(qe.Provider,{value:p,children:n(Gt,{configure:f,children:d.content.views.visibleViews.map(g=>n(an,{view:g},g.id))})})})})})})})})});var Tr={},sw={get exports(){return Tr},set exports(e){Tr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=i.prototype,u=o.format;s.en.ordinal=function(l){var d=["th","st","nd","rd"],p=l%100;return"["+l+(d[(p-20)%10]||d[p]||d[0])+"]"},o.format=function(l){var d=this,p=this.$locale();if(!this.isValid())return u.bind(this)(l);var f=this.$utils(),g=(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(h){switch(h){case"Q":return Math.ceil((d.$M+1)/3);case"Do":return p.ordinal(d.$D);case"gggg":return d.weekYear();case"GGGG":return d.isoWeekYear();case"wo":return p.ordinal(d.week(),"W");case"w":case"ww":return f.s(d.week(),h==="w"?1:2,"0");case"W":case"WW":return f.s(d.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return f.s(String(d.$H===0?24:d.$H),h==="k"?1:2,"0");case"X":return Math.floor(d.$d.getTime()/1e3);case"x":return d.$d.getTime();case"z":return"["+d.offsetName()+"]";case"zzz":return"["+d.offsetName("long")+"]";default:return h}});return u.bind(this)(g)}}})})(sw);const ow=Tr;var kr={},lw={get exports(){return kr},set exports(e){kr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=i.prototype,u=function(d){var p=d.date,f=d.utc;return Array.isArray(p)?f?p.length?new Date(Date.UTC.apply(null,p)):new Date:p.length===1?s(String(p[0])).toDate():new(Function.prototype.bind.apply(Date,[null].concat(p))):p},l=o.parse;o.parse=function(d){d.date=u.bind(this)(d),l.bind(this)(d)}}})})(lw);const uw=kr;var Dr={},dw={get exports(){return Dr},set exports(e){Dr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){var s=i.prototype;s.$g=function(h,b,w){return this.$utils().u(h)?this[b]:this.$set(w,h)},s.set=function(h,b){return this.$set(h,b)};var o=s.startOf;s.startOf=function(h,b){return this.$d=o.bind(this)(h,b).toDate(),this.init(),this};var u=s.add;s.add=function(h,b){return this.$d=u.bind(this)(h,b).toDate(),this.init(),this};var l=s.locale;s.locale=function(h,b){return h?(this.$L=l.bind(this)(h,b).$L,this):this.$L};var d=s.daysInMonth;s.daysInMonth=function(){return d.bind(this.clone())()};var p=s.isSame;s.isSame=function(h,b){return p.bind(this.clone())(h,b)};var f=s.isBefore;s.isBefore=function(h,b){return f.bind(this.clone())(h,b)};var g=s.isAfter;s.isAfter=function(h,b){return g.bind(this.clone())(h,b)}}})})(dw);const cw=Dr;var Ir={},pw={get exports(){return Ir},set exports(e){Ir=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){var s=i.prototype,o=s.format;s.format=function(u){var l=this,d=(u||"YYYY-MM-DDTHH:mm:ssZ").replace(/(\[[^\]]+])|BBBB|BB/g,function(p,f){var g,h=String(l.$y+543),b=p==="BB"?[h.slice(-2),2]:[h,4];return f||(g=l.$utils()).s.apply(g,b.concat(["0"]))});return o.bind(this)(d)}}})})(pw);const hw=Ir;var Mr={},fw={get exports(){return Mr},set exports(e){Mr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o="h:mm A",u={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"};i.prototype.calendar=function(l,d){var p=d||this.$locale().calendar||u,f=s(l||void 0).startOf("d"),g=this.diff(f,"d",!0),h="sameElse",b=g<-6?h:g<-1?"lastWeek":g<0?"lastDay":g<1?"sameDay":g<2?"nextDay":g<7?"nextWeek":h,w=p[b]||u[b];return typeof w=="function"?w.call(this,s()):this.format(w)}}})})(fw);const gw=Mr;var Ar={},mw={get exports(){return Ar},set exports(e){Ar=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r={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"},i=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d\d/,o=/\d\d?/,u=/\d*[^-_:/,()\s\d]+/,l={},d=function(C){return(C=+C)+(C>68?1900:2e3)},p=function(C){return function(S){this[C]=+S}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(C){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var M=S.match(/([+-]|\d\d)/g),$=60*M[1]+(+M[2]||0);return $===0?0:M[0]==="+"?-$:$}(C)}],g=function(C){var S=l[C];return S&&(S.indexOf?S:S.s.concat(S.f))},h=function(C,S){var M,$=l.meridiem;if($){for(var P=1;P<=24;P+=1)if(C.indexOf($(P,0,S))>-1){M=P>12;break}}else M=C===(S?"pm":"PM");return M},b={A:[u,function(C){this.afternoon=h(C,!1)}],a:[u,function(C){this.afternoon=h(C,!0)}],S:[/\d/,function(C){this.milliseconds=100*+C}],SS:[s,function(C){this.milliseconds=10*+C}],SSS:[/\d{3}/,function(C){this.milliseconds=+C}],s:[o,p("seconds")],ss:[o,p("seconds")],m:[o,p("minutes")],mm:[o,p("minutes")],H:[o,p("hours")],h:[o,p("hours")],HH:[o,p("hours")],hh:[o,p("hours")],D:[o,p("day")],DD:[s,p("day")],Do:[u,function(C){var S=l.ordinal,M=C.match(/\d+/);if(this.day=M[0],S)for(var $=1;$<=31;$+=1)S($).replace(/\[|\]/g,"")===C&&(this.day=$)}],M:[o,p("month")],MM:[s,p("month")],MMM:[u,function(C){var S=g("months"),M=(g("monthsShort")||S.map(function($){return $.slice(0,3)})).indexOf(C)+1;if(M<1)throw new Error;this.month=M%12||M}],MMMM:[u,function(C){var S=g("months").indexOf(C)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,p("year")],YY:[s,function(C){this.year=d(C)}],YYYY:[/\d{4}/,p("year")],Z:f,ZZ:f};function w(C){var S,M;S=C,M=l&&l.formats;for(var $=(C=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(U,Q,ne){var ie=ne&&ne.toUpperCase();return Q||M[ne]||r[ne]||M[ie].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(oe,re,he){return re||he.slice(1)})})).match(i),P=$.length,q=0;q<P;q+=1){var L=$[q],z=b[L],A=z&&z[0],G=z&&z[1];$[q]=G?{regex:A,parser:G}:L.replace(/^\[|\]$/g,"")}return function(U){for(var Q={},ne=0,ie=0;ne<P;ne+=1){var oe=$[ne];if(typeof oe=="string")ie+=oe.length;else{var re=oe.regex,he=oe.parser,ge=U.slice(ie),Te=re.exec(ge)[0];he.call(Q,Te),U=U.replace(Te,"")}}return function(We){var $e=We.afternoon;if($e!==void 0){var Qe=We.hours;$e?Qe<12&&(We.hours+=12):Qe===12&&(We.hours=0),delete We.afternoon}}(Q),Q}}return function(C,S,M){M.p.customParseFormat=!0,C&&C.parseTwoDigitYear&&(d=C.parseTwoDigitYear);var $=S.prototype,P=$.parse;$.parse=function(q){var L=q.date,z=q.utc,A=q.args;this.$u=z;var G=A[1];if(typeof G=="string"){var U=A[2]===!0,Q=A[3]===!0,ne=U||Q,ie=A[2];Q&&(ie=A[2]),l=this.$locale(),!U&&ie&&(l=M.Ls[ie]),this.$d=function(ge,Te,We){try{if(["x","X"].indexOf(Te)>-1)return new Date((Te==="X"?1e3:1)*ge);var $e=w(Te)(ge),Qe=$e.year,it=$e.month,pn=$e.day,hn=$e.hours,ai=$e.minutes,si=$e.seconds,$t=$e.milliseconds,ft=$e.zone,tt=new Date,at=pn||(Qe||it?1:tt.getDate()),nt=Qe||tt.getFullYear(),gt=0;Qe&&!it||(gt=it>0?it-1:tt.getMonth());var mt=hn||0,zt=ai||0,Et=si||0,rt=$t||0;return ft?new Date(Date.UTC(nt,gt,at,mt,zt,Et,rt+60*ft.offset*1e3)):We?new Date(Date.UTC(nt,gt,at,mt,zt,Et,rt)):new Date(nt,gt,at,mt,zt,Et,rt)}catch{return new Date("")}}(L,G,z),this.init(),ie&&ie!==!0&&(this.$L=this.locale(ie).$L),ne&&L!=this.format(G)&&(this.$d=new Date("")),l={}}else if(G instanceof Array)for(var oe=G.length,re=1;re<=oe;re+=1){A[1]=G[re-1];var he=M.apply(this,A);if(he.isValid()){this.$d=he.$d,this.$L=he.$L,this.init();break}re===oe&&(this.$d=new Date(""))}else P.call(this,q)}}})})(mw);const bw=Ar;var $r={},yw={get exports(){return $r},set exports(e){$r=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.dayOfYear=function(o){var u=Math.round((s(this).startOf("day")-s(this).startOf("year"))/864e5)+1;return o==null?u:this.add(o-u,"day")}}})})(yw);const vw=$r;var zr={},xw={get exports(){return zr},set exports(e){zr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r,i,s=1e3,o=6e4,u=36e5,l=864e5,d=/\[([^\]]+)]|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,p=31536e6,f=2592e6,g=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,h={years:p,months:f,days:l,hours:u,minutes:o,seconds:s,milliseconds:1,weeks:6048e5},b=function(L){return L instanceof q},w=function(L,z,A){return new q(L,A,z.$l)},C=function(L){return i.p(L)+"s"},S=function(L){return L<0},M=function(L){return S(L)?Math.ceil(L):Math.floor(L)},$=function(L){return Math.abs(L)},P=function(L,z){return L?S(L)?{negative:!0,format:""+$(L)+z}:{negative:!1,format:""+L+z}:{negative:!1,format:""}},q=function(){function L(A,G,U){var Q=this;if(this.$d={},this.$l=U,A===void 0&&(this.$ms=0,this.parseFromMilliseconds()),G)return w(A*h[C(G)],this);if(typeof A=="number")return this.$ms=A,this.parseFromMilliseconds(),this;if(typeof A=="object")return Object.keys(A).forEach(function(oe){Q.$d[C(oe)]=A[oe]}),this.calMilliseconds(),this;if(typeof A=="string"){var ne=A.match(g);if(ne){var ie=ne.slice(2).map(function(oe){return oe!=null?Number(oe):0});return this.$d.years=ie[0],this.$d.months=ie[1],this.$d.weeks=ie[2],this.$d.days=ie[3],this.$d.hours=ie[4],this.$d.minutes=ie[5],this.$d.seconds=ie[6],this.calMilliseconds(),this}}return this}var z=L.prototype;return z.calMilliseconds=function(){var A=this;this.$ms=Object.keys(this.$d).reduce(function(G,U){return G+(A.$d[U]||0)*h[U]},0)},z.parseFromMilliseconds=function(){var A=this.$ms;this.$d.years=M(A/p),A%=p,this.$d.months=M(A/f),A%=f,this.$d.days=M(A/l),A%=l,this.$d.hours=M(A/u),A%=u,this.$d.minutes=M(A/o),A%=o,this.$d.seconds=M(A/s),A%=s,this.$d.milliseconds=A},z.toISOString=function(){var A=P(this.$d.years,"Y"),G=P(this.$d.months,"M"),U=+this.$d.days||0;this.$d.weeks&&(U+=7*this.$d.weeks);var Q=P(U,"D"),ne=P(this.$d.hours,"H"),ie=P(this.$d.minutes,"M"),oe=this.$d.seconds||0;this.$d.milliseconds&&(oe+=this.$d.milliseconds/1e3);var re=P(oe,"S"),he=A.negative||G.negative||Q.negative||ne.negative||ie.negative||re.negative,ge=ne.format||ie.format||re.format?"T":"",Te=(he?"-":"")+"P"+A.format+G.format+Q.format+ge+ne.format+ie.format+re.format;return Te==="P"||Te==="-P"?"P0D":Te},z.toJSON=function(){return this.toISOString()},z.format=function(A){var G=A||"YYYY-MM-DDTHH:mm:ss",U={Y:this.$d.years,YY:i.s(this.$d.years,2,"0"),YYYY:i.s(this.$d.years,4,"0"),M:this.$d.months,MM:i.s(this.$d.months,2,"0"),D:this.$d.days,DD:i.s(this.$d.days,2,"0"),H:this.$d.hours,HH:i.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:i.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:i.s(this.$d.seconds,2,"0"),SSS:i.s(this.$d.milliseconds,3,"0")};return G.replace(d,function(Q,ne){return ne||String(U[Q])})},z.as=function(A){return this.$ms/h[C(A)]},z.get=function(A){var G=this.$ms,U=C(A);return U==="milliseconds"?G%=1e3:G=U==="weeks"?M(G/h[U]):this.$d[U],G===0?0:G},z.add=function(A,G,U){var Q;return Q=G?A*h[C(G)]:b(A)?A.$ms:w(A,this).$ms,w(this.$ms+Q*(U?-1:1),this)},z.subtract=function(A,G){return this.add(A,G,!0)},z.locale=function(A){var G=this.clone();return G.$l=A,G},z.clone=function(){return w(this.$ms,this)},z.humanize=function(A){return r().add(this.$ms,"ms").locale(this.$l).fromNow(!A)},z.milliseconds=function(){return this.get("milliseconds")},z.asMilliseconds=function(){return this.as("milliseconds")},z.seconds=function(){return this.get("seconds")},z.asSeconds=function(){return this.as("seconds")},z.minutes=function(){return this.get("minutes")},z.asMinutes=function(){return this.as("minutes")},z.hours=function(){return this.get("hours")},z.asHours=function(){return this.as("hours")},z.days=function(){return this.get("days")},z.asDays=function(){return this.as("days")},z.weeks=function(){return this.get("weeks")},z.asWeeks=function(){return this.as("weeks")},z.months=function(){return this.get("months")},z.asMonths=function(){return this.as("months")},z.years=function(){return this.get("years")},z.asYears=function(){return this.as("years")},L}();return function(L,z,A){r=A,i=A().$utils(),A.duration=function(Q,ne){var ie=A.locale();return w(Q,{$l:ie},ne)},A.isDuration=b;var G=z.prototype.add,U=z.prototype.subtract;z.prototype.add=function(Q,ne){return b(Q)&&(Q=Q.asMilliseconds()),G.bind(this)(Q,ne)},z.prototype.subtract=function(Q,ne){return b(Q)&&(Q=Q.asMilliseconds()),U.bind(this)(Q,ne)}}})})(xw);const Cw=zr;var Er={},ww={get exports(){return Er},set exports(e){Er=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.isBetween=function(o,u,l,d){var p=s(o),f=s(u),g=(d=d||"()")[0]==="(",h=d[1]===")";return(g?this.isAfter(p,l):!this.isBefore(p,l))&&(h?this.isBefore(f,l):!this.isAfter(f,l))||(g?this.isBefore(p,l):!this.isAfter(p,l))&&(h?this.isAfter(f,l):!this.isBefore(f,l))}}})})(ww);const _w=Er;var Lr={},Sw={get exports(){return Lr},set exports(e){Lr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(Sw);const Tw=Lr;var Pr={},kw={get exports(){return Pr},set exports(e){Pr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){s.isMoment=function(o){return s.isDayjs(o)}}})})(kw);const Dw=Pr;var Or={},Iw={get exports(){return Or},set exports(e){Or=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r="day";return function(i,s,o){var u=function(p){return p.add(4-p.isoWeekday(),r)},l=s.prototype;l.isoWeekYear=function(){return u(this).year()},l.isoWeek=function(p){if(!this.$utils().u(p))return this.add(7*(p-this.isoWeek()),r);var f,g,h,b,w=u(this),C=(f=this.isoWeekYear(),g=this.$u,h=(g?o.utc:o)().year(f).startOf("year"),b=4-h.isoWeekday(),h.isoWeekday()>4&&(b+=7),h.add(b,r));return w.diff(C,"week")+1},l.isoWeekday=function(p){return this.$utils().u(p)?this.day()||7:this.day(this.day()%7?p:p-7)};var d=l.startOf;l.startOf=function(p,f){var g=this.$utils(),h=!!g.u(f)||f;return g.p(p)==="isoweek"?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):d.bind(this)(p,f)}}})})(Iw);const Mw=Or;var Vr={},Aw={get exports(){return Vr},set exports(e){Vr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.isoWeeksInYear=function(){var s=this.isLeapYear(),o=this.endOf("y").day();return o===4||s&&o===5?53:52}}})})(Aw);const $w=Vr;var Br={},zw={get exports(){return Br},set exports(e){Br=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.isSameOrAfter=function(s,o){return this.isSame(s,o)||this.isAfter(s,o)}}})})(zw);const Ew=Br;var Nr={},Lw={get exports(){return Nr},set exports(e){Nr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.isSameOrBefore=function(s,o){return this.isSame(s,o)||this.isBefore(s,o)}}})})(Lw);const Pw=Nr;var Gr={},Ow={get exports(){return Gr},set exports(e){Gr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.isToday=function(){var o="YYYY-MM-DD",u=s();return this.format(o)===u.format(o)}}})})(Ow);const Vw=Gr;var qr={},Bw={get exports(){return qr},set exports(e){qr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.isTomorrow=function(){var o="YYYY-MM-DD",u=s().add(1,"day");return this.format(o)===u.format(o)}}})})(Bw);const Nw=qr;var Fr={},Gw={get exports(){return Fr},set exports(e){Fr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.isYesterday=function(){var o="YYYY-MM-DD",u=s().subtract(1,"day");return this.format(o)===u.format(o)}}})})(Gw);const qw=Fr;var Wr={},Fw={get exports(){return Wr},set exports(e){Wr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=i.prototype,u=function(g){return g&&(g.indexOf?g:g.s)},l=function(g,h,b,w,C){var S=g.name?g:g.$locale(),M=u(S[h]),$=u(S[b]),P=M||$.map(function(L){return L.slice(0,w)});if(!C)return P;var q=S.weekStart;return P.map(function(L,z){return P[(z+(q||0))%7]})},d=function(){return s.Ls[s.locale()]},p=function(g,h){return g.formats[h]||function(b){return b.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(w,C,S){return C||S.slice(1)})}(g.formats[h.toUpperCase()])},f=function(){var g=this;return{months:function(h){return h?h.format("MMMM"):l(g,"months")},monthsShort:function(h){return h?h.format("MMM"):l(g,"monthsShort","months",3)},firstDayOfWeek:function(){return g.$locale().weekStart||0},weekdays:function(h){return h?h.format("dddd"):l(g,"weekdays")},weekdaysMin:function(h){return h?h.format("dd"):l(g,"weekdaysMin","weekdays",2)},weekdaysShort:function(h){return h?h.format("ddd"):l(g,"weekdaysShort","weekdays",3)},longDateFormat:function(h){return p(g.$locale(),h)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return f.bind(this)()},s.localeData=function(){var g=d();return{firstDayOfWeek:function(){return g.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(h){return p(g,h)},meridiem:g.meridiem,ordinal:g.ordinal}},s.months=function(){return l(d(),"months")},s.monthsShort=function(){return l(d(),"monthsShort","months",3)},s.weekdays=function(g){return l(d(),"weekdays",null,null,g)},s.weekdaysShort=function(g){return l(d(),"weekdaysShort","weekdays",3,g)},s.weekdaysMin=function(g){return l(d(),"weekdaysMin","weekdays",2,g)}}})})(Fw);const Ww=Wr;var jr={},jw={get exports(){return jr},set exports(e){jr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r={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(i,s,o){var u=s.prototype,l=u.format;o.en.formats=r,u.format=function(d){d===void 0&&(d="YYYY-MM-DDTHH:mm:ssZ");var p=this.$locale().formats,f=function(g,h){return g.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(b,w,C){var S=C&&C.toUpperCase();return w||h[C]||r[C]||h[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(M,$,P){return $||P.slice(1)})})}(d,p===void 0?{}:p);return l.call(this,f)}}})})(jw);const Yw=jr;var Yr={},Rw={get exports(){return Yr},set exports(e){Yr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=function(u,l){if(!l||!l.length||!l[0]||l.length===1&&!l[0].length)return null;var d;l.length===1&&l[0].length>0&&(l=l[0]),d=l[0];for(var p=1;p<l.length;p+=1)l[p].isValid()&&!l[p][u](d)||(d=l[p]);return d};s.max=function(){var u=[].slice.call(arguments,0);return o("isAfter",u)},s.min=function(){var u=[].slice.call(arguments,0);return o("isBefore",u)}}})})(Rw);const Qw=Yr;var Rr={},Uw={get exports(){return Rr},set exports(e){Rr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=i.prototype,u=function(g){var h,b=g.date,w=g.utc,C={};if(!((h=b)instanceof Date)&&!(h instanceof Array)&&h instanceof Object){if(!Object.keys(b).length)return new Date;var S=w?s.utc():s();Object.keys(b).forEach(function(G){var U,Q;C[U=G,Q=o.$utils().p(U),Q==="date"?"day":Q]=b[G]});var M=C.day||(C.year||C.month>=0?1:S.date()),$=C.year||S.year(),P=C.month>=0?C.month:C.year||C.day?0:S.month(),q=C.hour||0,L=C.minute||0,z=C.second||0,A=C.millisecond||0;return w?new Date(Date.UTC($,P,M,q,L,z,A)):new Date($,P,M,q,L,z,A)}return b},l=o.parse;o.parse=function(g){g.date=u.bind(this)(g),l.bind(this)(g)};var d=o.set,p=o.add,f=function(g,h,b,w){if(w===void 0&&(w=1),h instanceof Object){var C=Object.keys(h),S=this;return C.forEach(function(M){S=g.bind(S)(h[M]*w,M)}),S}return g.bind(this)(h*w,b)};o.set=function(g,h){return h=h===void 0?g:h,f.bind(this)(function(b,w){return d.bind(this)(w,b)},h,g)},o.add=function(g,h){return f.bind(this)(p,g,h)},o.subtract=function(g,h){return f.bind(this)(p,g,h,-1)}}})})(Uw);const Xw=Rr;var Qr={},Zw={get exports(){return Qr},set exports(e){Qr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){var s=i.prototype;["milliseconds","seconds","minutes","hours","days","weeks","isoWeeks","months","quarters","years","dates"].forEach(function(o){s[o]=s[o.replace(/s$/,"")]})}})})(Zw);const Kw=Qr;var Ur={},Jw={get exports(){return Ur},set exports(e){Ur=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){var s=i.prototype.parse;i.prototype.parse=function(l){if(typeof l.date=="string"){var d=this.$locale();l.date=d&&d.preparse?d.preparse(l.date):l.date}return s.bind(this)(l)};var o=i.prototype.format;i.prototype.format=function(){for(var l=arguments.length,d=new Array(l),p=0;p<l;p++)d[p]=arguments[p];var f=o.call.apply(o,[this].concat(d)),g=this.$locale();return g&&g.postformat?g.postformat(f):f};var u=i.prototype.fromToBase;u&&(i.prototype.fromToBase=function(l,d,p,f){var g=this.$locale()||p.$locale();return u.call(this,l,d,p,f,g&&g.postformat)})}})})(Jw);const Hw=Ur;var Xr={},e1={get exports(){return Xr},set exports(e){Xr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r="month",i="quarter";return function(s,o){var u=o.prototype;u.quarter=function(p){return this.$utils().u(p)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(p-1))};var l=u.add;u.add=function(p,f){return p=Number(p),this.$utils().p(f)===i?this.add(3*p,r):l.bind(this)(p,f)};var d=u.startOf;u.startOf=function(p,f){var g=this.$utils(),h=!!g.u(f)||f;if(g.p(p)===i){var b=this.quarter()-1;return h?this.month(3*b).startOf(r).startOf("day"):this.month(3*b+2).endOf(r).endOf("day")}return d.bind(this)(p,f)}}})})(e1);const t1=Xr;var Zr={},n1={get exports(){return Zr},set exports(e){Zr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){r=r||{};var o=i.prototype,u={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 l(p,f,g,h){return o.fromToBase(p,f,g,h)}s.en.relativeTime=u,o.fromToBase=function(p,f,g,h,b){for(var w,C,S,M=g.$locale().relativeTime||u,$=r.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"}],P=$.length,q=0;q<P;q+=1){var L=$[q];L.d&&(w=h?s(p).diff(g,L.d,!0):g.diff(p,L.d,!0));var z=(r.rounding||Math.round)(Math.abs(w));if(S=w>0,z<=L.r||!L.r){z<=1&&q>0&&(L=$[q-1]);var A=M[L.l];b&&(z=b(""+z)),C=typeof A=="string"?A.replace("%d",z):A(z,f,L.l,S);break}}if(f)return C;var G=S?M.future:M.past;return typeof G=="function"?G(C):G.replace("%s",C)},o.to=function(p,f){return l(p,f,this,!0)},o.from=function(p,f){return l(p,f,this)};var d=function(p){return p.$u?s.utc():s()};o.toNow=function(p){return this.to(d(this),p)},o.fromNow=function(p){return this.from(d(this),p)}}})})(n1);const r1=Zr;var Kr={},i1={get exports(){return Kr},set exports(e){Kr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r={year:0,month:1,day:2,hour:3,minute:4,second:5},i={};return function(s,o,u){var l,d=function(h,b,w){w===void 0&&(w={});var C=new Date(h),S=function(M,$){$===void 0&&($={});var P=$.timeZoneName||"short",q=M+"|"+P,L=i[q];return L||(L=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:M,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:P}),i[q]=L),L}(b,w);return S.formatToParts(C)},p=function(h,b){for(var w=d(h,b),C=[],S=0;S<w.length;S+=1){var M=w[S],$=M.type,P=M.value,q=r[$];q>=0&&(C[q]=parseInt(P,10))}var L=C[3],z=L===24?0:L,A=C[0]+"-"+C[1]+"-"+C[2]+" "+z+":"+C[4]+":"+C[5]+":000",G=+h;return(u.utc(A).valueOf()-(G-=G%1e3))/6e4},f=o.prototype;f.tz=function(h,b){h===void 0&&(h=l);var w=this.utcOffset(),C=this.toDate(),S=C.toLocaleString("en-US",{timeZone:h}),M=Math.round((C-new Date(S))/1e3/60),$=u(S).$set("millisecond",this.$ms).utcOffset(15*-Math.round(C.getTimezoneOffset()/15)-M,!0);if(b){var P=$.utcOffset();$=$.add(w-P,"minute")}return $.$x.$timezone=h,$},f.offsetName=function(h){var b=this.$x.$timezone||u.tz.guess(),w=d(this.valueOf(),b,{timeZoneName:h}).find(function(C){return C.type.toLowerCase()==="timezonename"});return w&&w.value};var g=f.startOf;f.startOf=function(h,b){if(!this.$x||!this.$x.$timezone)return g.call(this,h,b);var w=u(this.format("YYYY-MM-DD HH:mm:ss:SSS"));return g.call(w,h,b).tz(this.$x.$timezone,!0)},u.tz=function(h,b,w){var C=w&&b,S=w||b||l,M=p(+u(),S);if(typeof h!="string")return u(h).tz(S);var $=function(z,A,G){var U=z-60*A*1e3,Q=p(U,G);if(A===Q)return[U,A];var ne=p(U-=60*(Q-A)*1e3,G);return Q===ne?[U,Q]:[z-60*Math.min(Q,ne)*1e3,Math.max(Q,ne)]}(u.utc(h,C).valueOf(),M,S),P=$[0],q=$[1],L=u(P).utcOffset(q);return L.$x.$timezone=S,L},u.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},u.tz.setDefault=function(h){l=h}}})})(i1);const a1=Kr;var Jr={},s1={get exports(){return Jr},set exports(e){Jr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]}}})})(s1);const o1=Jr;var Hr={},l1={get exports(){return Hr},set exports(e){Hr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.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}}}})})(l1);const u1=Hr;var ei={},d1={get exports(){return ei},set exports(e){ei=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){s.updateLocale=function(o,u){var l=s.Ls[o];if(l)return(u?Object.keys(u):[]).forEach(function(d){l[d]=u[d]}),l}}})})(d1);const c1=ei;var ti={},p1={get exports(){return ti},set exports(e){ti=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r="minute",i=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(o,u,l){var d=u.prototype;l.utc=function(C){var S={date:C,utc:!0,args:arguments};return new u(S)},d.utc=function(C){var S=l(this.toDate(),{locale:this.$L,utc:!0});return C?S.add(this.utcOffset(),r):S},d.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var p=d.parse;d.parse=function(C){C.utc&&(this.$u=!0),this.$utils().u(C.$offset)||(this.$offset=C.$offset),p.call(this,C)};var f=d.init;d.init=function(){if(this.$u){var C=this.$d;this.$y=C.getUTCFullYear(),this.$M=C.getUTCMonth(),this.$D=C.getUTCDate(),this.$W=C.getUTCDay(),this.$H=C.getUTCHours(),this.$m=C.getUTCMinutes(),this.$s=C.getUTCSeconds(),this.$ms=C.getUTCMilliseconds()}else f.call(this)};var g=d.utcOffset;d.utcOffset=function(C,S){var M=this.$utils().u;if(M(C))return this.$u?0:M(this.$offset)?g.call(this):this.$offset;if(typeof C=="string"&&(C=function(L){L===void 0&&(L="");var z=L.match(i);if(!z)return null;var A=(""+z[0]).match(s)||["-",0,0],G=A[0],U=60*+A[1]+ +A[2];return U===0?0:G==="+"?U:-U}(C),C===null))return this;var $=Math.abs(C)<=16?60*C:C,P=this;if(S)return P.$offset=$,P.$u=C===0,P;if(C!==0){var q=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(P=this.local().add($+q,r)).$offset=$,P.$x.$localOffset=q}else P=this.utc();return P};var h=d.format;d.format=function(C){var S=C||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,S)},d.valueOf=function(){var C=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*C},d.isUTC=function(){return!!this.$u},d.toISOString=function(){return this.toDate().toISOString()},d.toString=function(){return this.toDate().toUTCString()};var b=d.toDate;d.toDate=function(C){return C==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():b.call(this)};var w=d.diff;d.diff=function(C,S,M){if(C&&this.$u===C.$u)return w.call(this,C,S,M);var $=this.local(),P=l(C).local();return w.call($,P,S,M)}}})})(p1);const h1=ti;var ni={},f1={get exports(){return ni},set exports(e){ni=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.weekday=function(s){var o=this.$locale().weekStart||0,u=this.$W,l=(u<o?u+7:u)-o;return this.$utils().u(s)?l:this.subtract(l,"day").add(s,"day")}}})})(f1);const g1=ni;var ri={},m1={get exports(){return ri},set exports(e){ri=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r="week",i="year";return function(s,o,u){var l=o.prototype;l.week=function(d){if(d===void 0&&(d=null),d!==null)return this.add(7*(d-this.week()),"day");var p=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var f=u(this).startOf(i).add(1,i).date(p),g=u(this).endOf(r);if(f.isBefore(g))return 1}var h=u(this).startOf(i).date(p).startOf(r).subtract(1,"millisecond"),b=this.diff(h,r,!0);return b<0?u(this).startOf("week").week():Math.ceil(b)},l.weeks=function(d){return d===void 0&&(d=null),this.week(d)}}})})(m1);const b1=ri;var ii={},y1={get exports(){return ii},set exports(e){ii=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.weekYear=function(){var s=this.month(),o=this.week(),u=this.year();return o===1&&s===11?u+1:s===0&&o>=52?u-1:u}}})})(y1);const v1=ii;j.extend(ow),j.extend(uw),j.extend(cw),j.extend(hw),j.extend(gw),j.extend(bw),j.extend(vw),j.extend(Cw),j.extend(_w),j.extend(Tw),j.extend(Dw),j.extend(Ew),j.extend(Pw),j.extend(Vw),j.extend(Nw),j.extend(qw),j.extend(Mw),j.extend($w),j.extend(Ww),j.extend(Yw),j.extend(Qw),j.extend(Xw),j.extend(Kw),j.extend(Hw),j.extend(t1),j.extend(r1),j.extend(a1),j.extend(o1),j.extend(u1),j.extend(c1),j.extend(h1),j.extend(b1),j.extend(v1),j.extend(g1),j.tz.setDefault("UTC");const x1=()=>Promise.resolve().then(()=>nl).then(({version:e})=>(console.log(`[@devtable/dashboard] version: ${e}`),e));D.ContentModel=Mt,D.ContentModelContextProvider=xn,D.ContextModel=ws,D.DashboardEditor=iw,D.DashboardFilterType=lr,D.DashboardMode=Ha,D.DashboardModel=zs,D.DashboardViewEditor=ts,D.DashboardViewRender=an,D.EViewComponentType=K,D.FilterModel=dr,D.FiltersModel=ps,D.FullScreenPanelContext=wn,D.LayoutStateContext=Ke,D.ModelContextProvider=vn,D.Panel=rn,D.PanelContextProvider=Cn,D.PanelModel=_s,D.PanelsModel=Ts,D.QueriesModel=vs,D.QueryModel=ys,D.ReadOnlyDashboard=aw,D.SQLSnippetModel=xs,D.SQLSnippetsModel=Cs,D.ViewComponentTypeBackground=es,D.ViewComponentTypeColor=nv,D.ViewComponentTypeName=tv,D.ViewModel=Ms,D.ViewsModel=As,D.applyPartialDashboard=bx,D.createContentModel=$s,D.createDashboardModel=mr,D.createDashboardViewsModel=gr,D.getInitialFiltersPayload=hs,D.getNewPanel=Ss,D.getVersion=x1,D.initialDashboardContent=rv,D.useContentModelContext=Y,D.useFullScreenPanelContext=Vi,D.useModelContext=ce,D.usePanelContext=Ce,D.useTopLevelServices=br,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|
|
496
|
+
`)},bC=T.observer(({queryModel:e})=>{const[t,r]=m.useState(e.sql);m.useEffect(()=>{r(o=>o!==e.sql?e.sql:o)},[e.sql]);const i=t!==e.sql,s=()=>{e.setSQL(t)};return e.typedAsSQL?c(a.Tabs,{defaultValue:"Edit",orientation:"vertical",sx:{flexGrow:1},styles:{tabLabel:{width:"100%",height:"28px",lineHeight:"28px"}},keepMounted:!1,children:[c(a.Tabs.List,{children:[n(a.Tabs.Tab,{value:"Edit",children:c(a.Group,{spacing:14,position:"apart",children:["Edit SQL",n(a.ActionIcon,{mr:5,variant:"filled",color:"blue",disabled:!i,onClick:s,children:n(k.DeviceFloppy,{size:20})})]})}),n(a.Tabs.Tab,{value:"Preview",children:"Preview SQL"}),n(a.Tabs.Tab,{value:"pre_process",children:"Process Request"}),n(a.Tabs.Tab,{value:"post_process",children:"Process Result"}),n(_r,{}),e.datasource&&n(Ys,{dataSource:e.datasource})]}),n(a.Tabs.Panel,{value:"Edit",sx:{position:"relative"},p:"sm",children:n(Sr,{height:"100%",value:t,onChange:r})}),n(a.Tabs.Panel,{value:"Preview",p:0,pl:4,children:n(mC,{value:e.sql})}),n(a.Tabs.Panel,{value:"pre_process",sx:{position:"relative"},p:"sm",children:n(dn,{label:"",value:e.pre_process,onChange:e.setPreProcess,defaultValue:Us.pre})}),n(a.Tabs.Panel,{value:"post_process",p:"sm",children:n(dn,{label:"",value:e.post_process,onChange:e.setPostProcess,defaultValue:Us.post})})]}):null}),cn={height:"calc(100% - 44px)",padding:0},yC=T.observer(({queryModel:e})=>{const t=Y(),r=m.useMemo(()=>e.datasource?e.typedAsHTTP?"HTTP":"SQL":"Configurations",[e.datasource,e.typedAsHTTP]),[i,s]=m.useState(r);m.useEffect(()=>{s(l=>l!=="Configurations"&&r==="Configurations"?"Configurations":l)},[r]);const o=t.findQueryUsage(e.id),u=o.length===0;return n(a.Stack,{sx:{flexGrow:1},my:0,p:0,children:c(a.Tabs,{value:i,onTabChange:s,defaultValue:r,orientation:"horizontal",keepMounted:!1,sx:{flexGrow:1},children:[c(a.Tabs.List,{grow:!0,children:[n(a.Tabs.Tab,{value:"Configurations",children:"Configurations"}),e.typedAsSQL&&n(a.Tabs.Tab,{value:"SQL",children:"Request"}),e.typedAsHTTP&&n(a.Tabs.Tab,{value:"HTTP",children:"Request"}),n(a.Tabs.Tab,{value:"Data",disabled:!e.datasource,children:n(a.Tooltip,{label:"Need to pick a Data Source first",disabled:e.datasource,withinPortal:!0,children:n(a.Text,{children:"Data"})})}),n(a.Tabs.Tab,{value:"Usage",disabled:u,children:n(a.Tooltip,{label:"This query is not used for any filter or panel",disabled:!u,withinPortal:!0,children:n(a.Text,{children:"Usage"})})})]}),n(a.Tabs.Panel,{value:"Configurations",pt:0,p:0,children:n(uC,{queryModel:e})}),e.typedAsSQL&&n(a.Tabs.Panel,{value:"SQL",sx:cn,children:n(a.Stack,{sx:{height:"100%"},children:n(bC,{queryModel:e})})}),e.typedAsHTTP&&n(a.Tabs.Panel,{value:"HTTP",sx:cn,children:n(a.Stack,{sx:{height:"100%"},children:n(hC,{queryModel:e})})}),n(a.Tabs.Panel,{value:"Data",sx:{...cn,overflow:"hidden"},children:n(Gs,{id:e.id})}),n(a.Tabs.Panel,{value:"Usage",sx:{...cn,overflow:"hidden"},children:n(fC,{queryID:e.id,usage:o})})]})})}),vC=T.observer(({id:e})=>{const r=Y().queries.findByID(e);return e===""?null:r?n(a.Stack,{sx:{height:"100%"},spacing:"sm",children:n(yC,{queryModel:r})}):n(a.Text,{size:14,color:"red",children:"Invalid Query ID"})}),xC=T.observer(({value:e})=>{const t=Y(),{context:r,mock_context:i,filterValues:s}=t.payloadForSQL,o=Vv(e,r,i,s);return n(Sr,{height:"100%",value:o})}),CC=T.observer(({item:e,remove:t,onKeyChanged:r})=>{const[i,s]=m.useState("SQL"),[o,u]=m.useState(e.key),l=()=>{e.setKey(o),r(o)},d=o!==e.key,p=e.isADuplicatedKey(o),[f,g]=m.useState(e.value),h=()=>{e.setValue(f)};m.useEffect(()=>{u(e.key),g(e.value)},[e]);const b=f!==e.value,w=Le.useModals(),C=()=>{w.openConfirmModal({title:"Delete this SQL snippet?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:t,confirmProps:{color:"red"},zIndex:320})};return c(a.Stack,{p:20,sx:{maxWidth:"1100px",height:"100vh"},spacing:"sm",children:[c(a.Group,{sx:{alignItems:"end"},spacing:40,children:[n(a.TextInput,{label:p?"This key is occupied by another snippet":"Key",value:o,onChange:S=>{u(S.currentTarget.value)},sx:{flexGrow:"1 !important"},rightSection:n(a.ActionIcon,{color:"blue",variant:"subtle",onClick:l,disabled:!d||p,children:n(k.DeviceFloppy,{size:16})}),error:p}),n(a.Button,{leftIcon:n(k.Trash,{size:16}),color:"red",variant:"light",onClick:C,children:"Delete this SQL Snippet"})]}),c(a.Tabs,{value:i,onTabChange:s,sx:{flexGrow:1},styles:{panel:{height:"calc(100% - 50px)"}},children:[c(a.Tabs.List,{sx:{position:"relative"},children:[n(a.Tabs.Tab,{value:"SQL",children:"SQL"}),n(a.Tabs.Tab,{value:"Preview",children:"Preview"}),n(_r,{}),n(a.ActionIcon,{color:"blue",variant:"filled",onClick:h,disabled:!b,sx:{position:"absolute",top:0,right:10},children:n(k.DeviceFloppy,{size:18})})]}),n(a.Tabs.Panel,{value:"SQL",pt:"sm",children:n(Sr,{height:"100%",value:f,onChange:g})}),n(a.Tabs.Panel,{value:"Preview",pt:"sm",children:n(xC,{value:f})})]})]})}),wC=T.observer(({id:e})=>{const t=ce(),r=Y(),i=m.useMemo(()=>r.sqlSnippets.findByKey(e),[e]);if(!e)return null;if(!i)return c(a.Text,{size:14,children:["SQL Snippet by key[",e,"] is not found"]});const s=()=>{t.editor.setPath(["_SQL_SNIPPETS_",""])};return n(CC,{item:i,remove:()=>{r.sqlSnippets.removeByKey(e),s()},onKeyChanged:l=>{t.editor.setPath(["_SQL_SNIPPETS_",l])}})}),_C=T.observer(({view:e})=>!e||e.type!==K.Division?null:c(a.Stack,{children:[n(a.Divider,{mt:8,mb:0,label:"Division settings",labelPosition:"center"}),n(a.Text,{align:"center",size:"xs",color:"dimmed",children:"Under construction"})]})),SC=[{value:"default",label:"Default"},{value:"outline",label:"Outline"},{value:"pills",label:"Pills"}],TC=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical"}],kC=T.observer(({view:e})=>{if(!e||e.type!==K.Tabs)return null;const t=e.config;return c(a.Stack,{children:[n(a.Divider,{mt:8,mb:0,label:"Tabs settings",labelPosition:"center"}),n(a.Select,{label:"Variant",value:t.variant,onChange:t.setVariant,data:SC}),n(a.Select,{label:"Orientation",value:t.orientation,onChange:t.setOrientation,data:TC}),n(a.Switch,{label:"Grow Tabs",checked:t.grow,onChange:r=>t.setGrow(r.currentTarget.checked)})]})}),DC=({disabled:e,value:t,onChange:r})=>{const i=s=>{s&&r(s)};return c(a.Box,{sx:{position:"relative"},children:[e&&n(a.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),n(_e,{height:"500px",defaultLanguage:"javascript",value:t,onChange:i,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})},IC=({value:e,onChange:t})=>{const[r,{setTrue:i,setFalse:s}]=Z.useBoolean(),[o,u]=m.useState(e??fr),l=h=>{u({...o,enabled:h})},d=()=>{s();const{enabled:h,func_content:b}=o,w={enabled:h,func_content:b};u(w),t(w)},p=()=>{s(),u(e)},f=h=>{u(b=>({...b,func_content:h}))},g=()=>{f(fr.func_content)};return c(B,{children:[n(a.ActionIcon,{size:"lg",color:"blue",variant:"filled",mt:26,onClick:i,sx:{flexGrow:0},children:n(k.Settings,{size:14})}),n(a.Modal,{size:800,title:"Customize modal title",opened:r,onClose:s,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:r&&c(a.Stack,{children:[n(a.Checkbox,{mt:10,label:"Enabled",checked:o.enabled,onChange:h=>l(h.currentTarget.checked)}),n(DC,{value:o.func_content,onChange:f,disabled:!o.enabled}),c(a.Group,{position:"apart",children:[n(a.Button,{onClick:g,color:"red",leftIcon:n(k.Recycle,{size:20}),children:"Rest"}),c(a.Group,{position:"right",children:[n(a.Button,{onClick:p,variant:"subtle",children:"Cancel"}),n(a.Button,{onClick:d,children:"OK"})]})]})]})})]})},MC=T.observer(({view:e})=>{if(!e||e.type!==K.Modal)return null;const t=e.config,r=t.custom_modal_title.value;return c(a.Stack,{children:[n(a.Divider,{mt:8,label:"Modal settings",labelPosition:"center"}),c(a.Flex,{gap:10,children:[n(a.TextInput,{label:"Modal Title",value:r,onChange:v.noop,disabled:!0,sx:{flexGrow:1}}),n(IC,{value:t.custom_modal_title,onChange:t.custom_modal_title.replace})]}),c(a.Group,{grow:!0,children:[n(a.TextInput,{label:"Width",value:t.width,onChange:i=>t.setWidth(i.currentTarget.value),placeholder:"600px / 50vw"}),n(a.TextInput,{label:"Height",value:t.height,onChange:i=>t.setHeight(i.currentTarget.value),placeholder:"600px / 50vw"})]})]})}),AC=T.observer(({view:e})=>c(B,{children:[n(_C,{view:e}),n(MC,{view:e}),n(kC,{view:e})]})),$C=[{label:"Division",value:K.Division},{label:"Modal",value:K.Modal},{label:"Tabs",value:K.Tabs}],zC=T.observer(({view:e})=>e?c(a.Stack,{sx:{position:"relative"},children:[n(a.TextInput,{label:"Name",value:e.name,onChange:t=>{e.setName(t.currentTarget.value)}}),n(a.Select,{label:"Type",withinPortal:!0,value:e.type,onChange:e.setType,data:$C}),n(AC,{view:e})]}):null),EC=T.observer(({id:e})=>{const t=Le.useModals(),r=ce(),i=Y();if(e==="")return null;const s=i.views.findByID(e);if(!s)return c(a.Text,{size:14,children:["View by ID[",e,"] is not found"]});const o=()=>{r.editor.setPath(["_VIEWS_",""])},u=()=>{t.openConfirmModal({title:"Delete this view?",labels:{confirm:"Confirm",cancel:"Cancel"},onCancel:()=>console.log("Cancel"),onConfirm:()=>{i.views.removeByID(e),o()},zIndex:320})};return c(a.Stack,{sx:{maxWidth:"600px",height:"100%"},spacing:"sm",children:[n(a.Group,{position:"right",pt:10,children:n(a.Button,{size:"xs",color:"red",leftIcon:n(k.Trash,{size:16}),onClick:u,children:"Delete this view"})}),n(a.Box,{sx:{flexGrow:1,maxHeight:"calc(100% - 52px)",overflow:"auto"},children:n(zC,{view:s})})]})});function LC(e){return e.length===1&&e[0]==="_GLOBAL_VARS_"}function PC(e){return e.length===1&&e[0]==="_MOCK_CONTEXT_"}function OC(e){return e.length===2&&e[0]==="_FILTERS_"}function VC(e){return e.length===2&&e[0]==="_SQL_SNIPPETS_"}function BC(e){return e.length===2&&e[0]==="_QUERIES_"}function NC(e){return e.length===2&&e[0]==="_VIEWS_"}function GC(e){return e.length===4&&e[0]==="_VIEWS_"&&e[2]==="_PANELS_"}const qC=T.observer(()=>n(a.Stack,{sx:{height:"100%"},p:"sm",children:n(Rs,{})})),FC=T.observer(()=>{const e=ce().editor,t=e.path;return LC(t)?n(qC,{}):PC(t)?n(p0,{}):OC(t)?n(a.Box,{p:"xs",pl:20,children:n(c0,{id:t[1]})}):VC(t)?n(wC,{id:t[1]}):BC(t)?n(vC,{id:t[1]}):NC(t)?n(a.Box,{p:"xs",pl:20,children:n(EC,{id:t[1]})}):GC(t)?n(F0,{viewID:t[1],panelID:t[3]}):n(a.Box,{children:e.path})}),WC=T.observer(()=>n(FC,{})),jC=T.observer(()=>{const e=ce(),t=()=>{const r=new Date().getTime().toString(),i={id:r,key:r,label:r,order:e.content.filters.current.length+1,type:lr.TextInput,config:ds(),visibleInViewsIDs:["Main"],auto_submit:!1};e.content.filters.append(i),e.editor.setPath(["_FILTERS_",r])};return n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Filter"})}),YC=T.observer(({parentID:e})=>{const t=Y();if(!e)return null;const r=t.views.findByID(e);return r?n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:()=>t.addANewPanel(r.id),sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Panel"}):null}),RC=T.observer(()=>{const e=ce(),t=()=>{const r=new Date().getTime().toString(),i={id:r,name:r,type:pe.Postgresql,key:"",sql:""};e.content.queries.append(i),e.editor.setPath(["_QUERIES_",r])};return n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a Query"})}),QC=T.observer(()=>{const e=ce(),t=()=>{const r=new Date().getTime().toString(),i={key:r,value:""};e.content.sqlSnippets.append(i),e.editor.setPath(["_SQL_SNIPPETS_",r])};return n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:t,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a SQL Snippet"})}),UC=T.observer(()=>{const e=Y();return n(a.Button,{variant:"subtle",leftIcon:n(V.IconPlus,{size:14}),size:"sm",px:"xs",mb:10,color:"blue",onClick:e.views.addARandomNewView,sx:{width:"100%",borderRadius:0},styles:{inner:{justifyContent:"flex-start"}},children:"Add a View"})}),XC=T.observer(({action_type:e,parentID:t})=>(Y(),e==="_Add_A_Filter_"?n(jC,{}):e==="_Add_A_SQL_SNIPPET_"?n(QC,{}):e==="_Add_A_QUERY_"?n(RC,{}):e==="_Add_A_VIEW_"?n(UC,{}):e==="_Add_A_PANEL_"?n(YC,{parentID:t}):null)),Xs=T.observer(({option:e})=>{var p;const t=ce().editor,r=t.isOptionActive,i=r(t.path,e),s=t.isOptionOpened,o=t.navigate,u=s(e),[l,d]=m.useState(u);return m.useEffect(()=>{d(u)},[u]),n(a.NavLink,{active:i,defaultOpened:u,opened:l,onChange:d,label:e.label,onClick:()=>o(e),icon:e.Icon?n(e.Icon,{size:18}):null,children:(p=e.children)==null?void 0:p.map(f=>f._type==="ACTION"?n(XC,{action_type:f._action_type,parentID:f.parentID},`_ADD_${f.value}_`):n(Xs,{option:f},f.value))},e.label)}),ZC=T.observer(()=>{const e=ce();return n(a.Box,{sx:{position:"relative"},children:e.editor.navOptions.map(t=>n(Xs,{option:t},t.value))})}),KC=T.observer(()=>{const e=ce();return c(a.Navbar,{p:0,width:{base:200,xs:200,sm:220,md:240,lg:280,xl:300},sx:{height:"100vh - 60px - 60px"},children:[n(a.Navbar.Section,{pt:9,pb:8,sx:{borderBottom:"1px solid #eee"},children:n(a.Text,{align:"center",sx:{userSelect:"none",cursor:"default"},children:"Settings"})}),n(a.Navbar.Section,{grow:!0,sx:{overflow:"auto"},children:n(ZC,{})}),n(a.Navbar.Section,{children:n(a.Group,{grow:!0,p:"md",pt:"sm",sx:{borderTop:"1px solid #eee"},children:n(a.Button,{size:"xs",color:"red",leftIcon:n(V.IconX,{size:18}),onClick:()=>e.editor.close(),children:"Close"})})})]})}),JC={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"}},HC=T.observer(()=>{const e=ce().editor;return n(a.Modal,{onClose:()=>e.setSettingsOpen(!1),closeOnEscape:!1,closeOnClickOutside:!1,opened:e.settings_open,fullScreen:!0,title:null,transitionDuration:0,withCloseButton:!1,withinPortal:!0,zIndex:300,styles:{modal:{padding:"0 !important"}},children:n(a.AppShell,{padding:0,navbar:n(KC,{}),styles:JC,children:n(WC,{})})})}),ew=e=>e.replace(/([^:])(\/\/+)/g,"$1/");function tw(e){m.useEffect(()=>{if(_e.loader.__getMonacoInstance())return;console.log("loading monaco for @devtable/dashboard");const r=ew(e);_e.loader.config({paths:{vs:r}}),_e.loader.init().then(i=>console.log("monaco instance:",i))},[])}ma();const nw={root:{height:"100vh",display:"flex",flexDirection:"column",overflow:"hidden"},body:{flexGrow:1},main:{flexGrow:1,display:"flex",flexDirection:"column",paddingTop:60+30,height:"100vh"}},rw=({context:e,dashboard:t,content:r,update:i,className:s="dashboard",config:o,onChange:u,headerSlot:l,headerMenuItems:d},p)=>{tw(o.monacoPath),ns(o);const{data:f=[]}=Z.useRequest(hr),[g,h]=m.useState(!1),b=m.useMemo(()=>mr(t,r,f,e),[t,r]);m.useImperativeHandle(p,()=>b,[b]),zi(b.content,!0),m.useEffect(()=>{b.context.replace(e)},[e]),m.useEffect(()=>{b.datasources.replace(f)},[f]),m.useEffect(()=>se.reaction(()=>se.toJS(b.json),M=>{u==null||u(M)}),[b]);const w=async()=>{await i(b.json,b.content.json)},C=Z.useCreation(sr,[]),S=br(C);return n(Le.ModalsProvider,{children:n(vn,{value:b,children:n(xn,{value:b.content,children:n(Ke.Provider,{value:{layoutFrozen:g,freezeLayout:h,inEditMode:!0},children:n(qe.Provider,{value:C,children:c(Gt,{configure:S,children:[n(a.AppShell,{padding:0,header:n(_x,{saveDashboardChanges:w,headerSlot:l,headerMenuItems:d}),navbar:n(Zx,{}),styles:nw,children:n(a.Box,{className:`${s} dashboard-root`,sx:{position:"relative"},children:b.content.views.visibleViews.map(M=>n(ts,{view:M},M.id))})}),n(HC,{})]})})})})})})},iw=T.observer(m.forwardRef(rw)),e_="";ma();const aw=T.observer(({context:e,dashboard:t,content:r,className:i="dashboard",config:s,fullScreenPanelID:o,setFullScreenPanelID:u})=>{ns(s);const{data:l=[]}=Z.useRequest(hr),d=m.useMemo(()=>mr(t,r,l,e),[t,r]);zi(d.content,!1),m.useEffect(()=>{d.context.replace(e)},[e]),m.useEffect(()=>{d.datasources.replace(l)},[l]);const p=Z.useCreation(sr,[]),f=br(p);return n(Le.ModalsProvider,{children:n(vn,{value:d,children:n(xn,{value:d.content,children:n(wn.Provider,{value:{fullScreenPanelID:o,setFullScreenPanelID:u},children:n(Ke.Provider,{value:{layoutFrozen:!0,freezeLayout:v.noop,inEditMode:!1},children:n(a.Box,{className:`${i} dashboard-root`,children:n(qe.Provider,{value:p,children:n(Gt,{configure:f,children:d.content.views.visibleViews.map(g=>n(an,{view:g},g.id))})})})})})})})})});var Tr={},sw={get exports(){return Tr},set exports(e){Tr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=i.prototype,u=o.format;s.en.ordinal=function(l){var d=["th","st","nd","rd"],p=l%100;return"["+l+(d[(p-20)%10]||d[p]||d[0])+"]"},o.format=function(l){var d=this,p=this.$locale();if(!this.isValid())return u.bind(this)(l);var f=this.$utils(),g=(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(h){switch(h){case"Q":return Math.ceil((d.$M+1)/3);case"Do":return p.ordinal(d.$D);case"gggg":return d.weekYear();case"GGGG":return d.isoWeekYear();case"wo":return p.ordinal(d.week(),"W");case"w":case"ww":return f.s(d.week(),h==="w"?1:2,"0");case"W":case"WW":return f.s(d.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return f.s(String(d.$H===0?24:d.$H),h==="k"?1:2,"0");case"X":return Math.floor(d.$d.getTime()/1e3);case"x":return d.$d.getTime();case"z":return"["+d.offsetName()+"]";case"zzz":return"["+d.offsetName("long")+"]";default:return h}});return u.bind(this)(g)}}})})(sw);const ow=Tr;var kr={},lw={get exports(){return kr},set exports(e){kr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=i.prototype,u=function(d){var p=d.date,f=d.utc;return Array.isArray(p)?f?p.length?new Date(Date.UTC.apply(null,p)):new Date:p.length===1?s(String(p[0])).toDate():new(Function.prototype.bind.apply(Date,[null].concat(p))):p},l=o.parse;o.parse=function(d){d.date=u.bind(this)(d),l.bind(this)(d)}}})})(lw);const uw=kr;var Dr={},dw={get exports(){return Dr},set exports(e){Dr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){var s=i.prototype;s.$g=function(h,b,w){return this.$utils().u(h)?this[b]:this.$set(w,h)},s.set=function(h,b){return this.$set(h,b)};var o=s.startOf;s.startOf=function(h,b){return this.$d=o.bind(this)(h,b).toDate(),this.init(),this};var u=s.add;s.add=function(h,b){return this.$d=u.bind(this)(h,b).toDate(),this.init(),this};var l=s.locale;s.locale=function(h,b){return h?(this.$L=l.bind(this)(h,b).$L,this):this.$L};var d=s.daysInMonth;s.daysInMonth=function(){return d.bind(this.clone())()};var p=s.isSame;s.isSame=function(h,b){return p.bind(this.clone())(h,b)};var f=s.isBefore;s.isBefore=function(h,b){return f.bind(this.clone())(h,b)};var g=s.isAfter;s.isAfter=function(h,b){return g.bind(this.clone())(h,b)}}})})(dw);const cw=Dr;var Ir={},pw={get exports(){return Ir},set exports(e){Ir=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){var s=i.prototype,o=s.format;s.format=function(u){var l=this,d=(u||"YYYY-MM-DDTHH:mm:ssZ").replace(/(\[[^\]]+])|BBBB|BB/g,function(p,f){var g,h=String(l.$y+543),b=p==="BB"?[h.slice(-2),2]:[h,4];return f||(g=l.$utils()).s.apply(g,b.concat(["0"]))});return o.bind(this)(d)}}})})(pw);const hw=Ir;var Mr={},fw={get exports(){return Mr},set exports(e){Mr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o="h:mm A",u={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"};i.prototype.calendar=function(l,d){var p=d||this.$locale().calendar||u,f=s(l||void 0).startOf("d"),g=this.diff(f,"d",!0),h="sameElse",b=g<-6?h:g<-1?"lastWeek":g<0?"lastDay":g<1?"sameDay":g<2?"nextDay":g<7?"nextWeek":h,w=p[b]||u[b];return typeof w=="function"?w.call(this,s()):this.format(w)}}})})(fw);const gw=Mr;var Ar={},mw={get exports(){return Ar},set exports(e){Ar=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r={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"},i=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d\d/,o=/\d\d?/,u=/\d*[^-_:/,()\s\d]+/,l={},d=function(C){return(C=+C)+(C>68?1900:2e3)},p=function(C){return function(S){this[C]=+S}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(C){(this.zone||(this.zone={})).offset=function(S){if(!S||S==="Z")return 0;var M=S.match(/([+-]|\d\d)/g),$=60*M[1]+(+M[2]||0);return $===0?0:M[0]==="+"?-$:$}(C)}],g=function(C){var S=l[C];return S&&(S.indexOf?S:S.s.concat(S.f))},h=function(C,S){var M,$=l.meridiem;if($){for(var P=1;P<=24;P+=1)if(C.indexOf($(P,0,S))>-1){M=P>12;break}}else M=C===(S?"pm":"PM");return M},b={A:[u,function(C){this.afternoon=h(C,!1)}],a:[u,function(C){this.afternoon=h(C,!0)}],S:[/\d/,function(C){this.milliseconds=100*+C}],SS:[s,function(C){this.milliseconds=10*+C}],SSS:[/\d{3}/,function(C){this.milliseconds=+C}],s:[o,p("seconds")],ss:[o,p("seconds")],m:[o,p("minutes")],mm:[o,p("minutes")],H:[o,p("hours")],h:[o,p("hours")],HH:[o,p("hours")],hh:[o,p("hours")],D:[o,p("day")],DD:[s,p("day")],Do:[u,function(C){var S=l.ordinal,M=C.match(/\d+/);if(this.day=M[0],S)for(var $=1;$<=31;$+=1)S($).replace(/\[|\]/g,"")===C&&(this.day=$)}],M:[o,p("month")],MM:[s,p("month")],MMM:[u,function(C){var S=g("months"),M=(g("monthsShort")||S.map(function($){return $.slice(0,3)})).indexOf(C)+1;if(M<1)throw new Error;this.month=M%12||M}],MMMM:[u,function(C){var S=g("months").indexOf(C)+1;if(S<1)throw new Error;this.month=S%12||S}],Y:[/[+-]?\d+/,p("year")],YY:[s,function(C){this.year=d(C)}],YYYY:[/\d{4}/,p("year")],Z:f,ZZ:f};function w(C){var S,M;S=C,M=l&&l.formats;for(var $=(C=S.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(U,Q,ne){var ie=ne&&ne.toUpperCase();return Q||M[ne]||r[ne]||M[ie].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(oe,re,he){return re||he.slice(1)})})).match(i),P=$.length,q=0;q<P;q+=1){var L=$[q],z=b[L],A=z&&z[0],G=z&&z[1];$[q]=G?{regex:A,parser:G}:L.replace(/^\[|\]$/g,"")}return function(U){for(var Q={},ne=0,ie=0;ne<P;ne+=1){var oe=$[ne];if(typeof oe=="string")ie+=oe.length;else{var re=oe.regex,he=oe.parser,ge=U.slice(ie),Te=re.exec(ge)[0];he.call(Q,Te),U=U.replace(Te,"")}}return function(We){var $e=We.afternoon;if($e!==void 0){var Qe=We.hours;$e?Qe<12&&(We.hours+=12):Qe===12&&(We.hours=0),delete We.afternoon}}(Q),Q}}return function(C,S,M){M.p.customParseFormat=!0,C&&C.parseTwoDigitYear&&(d=C.parseTwoDigitYear);var $=S.prototype,P=$.parse;$.parse=function(q){var L=q.date,z=q.utc,A=q.args;this.$u=z;var G=A[1];if(typeof G=="string"){var U=A[2]===!0,Q=A[3]===!0,ne=U||Q,ie=A[2];Q&&(ie=A[2]),l=this.$locale(),!U&&ie&&(l=M.Ls[ie]),this.$d=function(ge,Te,We){try{if(["x","X"].indexOf(Te)>-1)return new Date((Te==="X"?1e3:1)*ge);var $e=w(Te)(ge),Qe=$e.year,it=$e.month,pn=$e.day,hn=$e.hours,ai=$e.minutes,si=$e.seconds,$t=$e.milliseconds,ft=$e.zone,tt=new Date,at=pn||(Qe||it?1:tt.getDate()),nt=Qe||tt.getFullYear(),gt=0;Qe&&!it||(gt=it>0?it-1:tt.getMonth());var mt=hn||0,zt=ai||0,Et=si||0,rt=$t||0;return ft?new Date(Date.UTC(nt,gt,at,mt,zt,Et,rt+60*ft.offset*1e3)):We?new Date(Date.UTC(nt,gt,at,mt,zt,Et,rt)):new Date(nt,gt,at,mt,zt,Et,rt)}catch{return new Date("")}}(L,G,z),this.init(),ie&&ie!==!0&&(this.$L=this.locale(ie).$L),ne&&L!=this.format(G)&&(this.$d=new Date("")),l={}}else if(G instanceof Array)for(var oe=G.length,re=1;re<=oe;re+=1){A[1]=G[re-1];var he=M.apply(this,A);if(he.isValid()){this.$d=he.$d,this.$L=he.$L,this.init();break}re===oe&&(this.$d=new Date(""))}else P.call(this,q)}}})})(mw);const bw=Ar;var $r={},yw={get exports(){return $r},set exports(e){$r=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.dayOfYear=function(o){var u=Math.round((s(this).startOf("day")-s(this).startOf("year"))/864e5)+1;return o==null?u:this.add(o-u,"day")}}})})(yw);const vw=$r;var zr={},xw={get exports(){return zr},set exports(e){zr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r,i,s=1e3,o=6e4,u=36e5,l=864e5,d=/\[([^\]]+)]|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,p=31536e6,f=2592e6,g=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,h={years:p,months:f,days:l,hours:u,minutes:o,seconds:s,milliseconds:1,weeks:6048e5},b=function(L){return L instanceof q},w=function(L,z,A){return new q(L,A,z.$l)},C=function(L){return i.p(L)+"s"},S=function(L){return L<0},M=function(L){return S(L)?Math.ceil(L):Math.floor(L)},$=function(L){return Math.abs(L)},P=function(L,z){return L?S(L)?{negative:!0,format:""+$(L)+z}:{negative:!1,format:""+L+z}:{negative:!1,format:""}},q=function(){function L(A,G,U){var Q=this;if(this.$d={},this.$l=U,A===void 0&&(this.$ms=0,this.parseFromMilliseconds()),G)return w(A*h[C(G)],this);if(typeof A=="number")return this.$ms=A,this.parseFromMilliseconds(),this;if(typeof A=="object")return Object.keys(A).forEach(function(oe){Q.$d[C(oe)]=A[oe]}),this.calMilliseconds(),this;if(typeof A=="string"){var ne=A.match(g);if(ne){var ie=ne.slice(2).map(function(oe){return oe!=null?Number(oe):0});return this.$d.years=ie[0],this.$d.months=ie[1],this.$d.weeks=ie[2],this.$d.days=ie[3],this.$d.hours=ie[4],this.$d.minutes=ie[5],this.$d.seconds=ie[6],this.calMilliseconds(),this}}return this}var z=L.prototype;return z.calMilliseconds=function(){var A=this;this.$ms=Object.keys(this.$d).reduce(function(G,U){return G+(A.$d[U]||0)*h[U]},0)},z.parseFromMilliseconds=function(){var A=this.$ms;this.$d.years=M(A/p),A%=p,this.$d.months=M(A/f),A%=f,this.$d.days=M(A/l),A%=l,this.$d.hours=M(A/u),A%=u,this.$d.minutes=M(A/o),A%=o,this.$d.seconds=M(A/s),A%=s,this.$d.milliseconds=A},z.toISOString=function(){var A=P(this.$d.years,"Y"),G=P(this.$d.months,"M"),U=+this.$d.days||0;this.$d.weeks&&(U+=7*this.$d.weeks);var Q=P(U,"D"),ne=P(this.$d.hours,"H"),ie=P(this.$d.minutes,"M"),oe=this.$d.seconds||0;this.$d.milliseconds&&(oe+=this.$d.milliseconds/1e3);var re=P(oe,"S"),he=A.negative||G.negative||Q.negative||ne.negative||ie.negative||re.negative,ge=ne.format||ie.format||re.format?"T":"",Te=(he?"-":"")+"P"+A.format+G.format+Q.format+ge+ne.format+ie.format+re.format;return Te==="P"||Te==="-P"?"P0D":Te},z.toJSON=function(){return this.toISOString()},z.format=function(A){var G=A||"YYYY-MM-DDTHH:mm:ss",U={Y:this.$d.years,YY:i.s(this.$d.years,2,"0"),YYYY:i.s(this.$d.years,4,"0"),M:this.$d.months,MM:i.s(this.$d.months,2,"0"),D:this.$d.days,DD:i.s(this.$d.days,2,"0"),H:this.$d.hours,HH:i.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:i.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:i.s(this.$d.seconds,2,"0"),SSS:i.s(this.$d.milliseconds,3,"0")};return G.replace(d,function(Q,ne){return ne||String(U[Q])})},z.as=function(A){return this.$ms/h[C(A)]},z.get=function(A){var G=this.$ms,U=C(A);return U==="milliseconds"?G%=1e3:G=U==="weeks"?M(G/h[U]):this.$d[U],G===0?0:G},z.add=function(A,G,U){var Q;return Q=G?A*h[C(G)]:b(A)?A.$ms:w(A,this).$ms,w(this.$ms+Q*(U?-1:1),this)},z.subtract=function(A,G){return this.add(A,G,!0)},z.locale=function(A){var G=this.clone();return G.$l=A,G},z.clone=function(){return w(this.$ms,this)},z.humanize=function(A){return r().add(this.$ms,"ms").locale(this.$l).fromNow(!A)},z.milliseconds=function(){return this.get("milliseconds")},z.asMilliseconds=function(){return this.as("milliseconds")},z.seconds=function(){return this.get("seconds")},z.asSeconds=function(){return this.as("seconds")},z.minutes=function(){return this.get("minutes")},z.asMinutes=function(){return this.as("minutes")},z.hours=function(){return this.get("hours")},z.asHours=function(){return this.as("hours")},z.days=function(){return this.get("days")},z.asDays=function(){return this.as("days")},z.weeks=function(){return this.get("weeks")},z.asWeeks=function(){return this.as("weeks")},z.months=function(){return this.get("months")},z.asMonths=function(){return this.as("months")},z.years=function(){return this.get("years")},z.asYears=function(){return this.as("years")},L}();return function(L,z,A){r=A,i=A().$utils(),A.duration=function(Q,ne){var ie=A.locale();return w(Q,{$l:ie},ne)},A.isDuration=b;var G=z.prototype.add,U=z.prototype.subtract;z.prototype.add=function(Q,ne){return b(Q)&&(Q=Q.asMilliseconds()),G.bind(this)(Q,ne)},z.prototype.subtract=function(Q,ne){return b(Q)&&(Q=Q.asMilliseconds()),U.bind(this)(Q,ne)}}})})(xw);const Cw=zr;var Er={},ww={get exports(){return Er},set exports(e){Er=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.isBetween=function(o,u,l,d){var p=s(o),f=s(u),g=(d=d||"()")[0]==="(",h=d[1]===")";return(g?this.isAfter(p,l):!this.isBefore(p,l))&&(h?this.isBefore(f,l):!this.isAfter(f,l))||(g?this.isBefore(p,l):!this.isAfter(p,l))&&(h?this.isAfter(f,l):!this.isBefore(f,l))}}})})(ww);const _w=Er;var Lr={},Sw={get exports(){return Lr},set exports(e){Lr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(Sw);const Tw=Lr;var Pr={},kw={get exports(){return Pr},set exports(e){Pr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){s.isMoment=function(o){return s.isDayjs(o)}}})})(kw);const Dw=Pr;var Or={},Iw={get exports(){return Or},set exports(e){Or=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r="day";return function(i,s,o){var u=function(p){return p.add(4-p.isoWeekday(),r)},l=s.prototype;l.isoWeekYear=function(){return u(this).year()},l.isoWeek=function(p){if(!this.$utils().u(p))return this.add(7*(p-this.isoWeek()),r);var f,g,h,b,w=u(this),C=(f=this.isoWeekYear(),g=this.$u,h=(g?o.utc:o)().year(f).startOf("year"),b=4-h.isoWeekday(),h.isoWeekday()>4&&(b+=7),h.add(b,r));return w.diff(C,"week")+1},l.isoWeekday=function(p){return this.$utils().u(p)?this.day()||7:this.day(this.day()%7?p:p-7)};var d=l.startOf;l.startOf=function(p,f){var g=this.$utils(),h=!!g.u(f)||f;return g.p(p)==="isoweek"?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):d.bind(this)(p,f)}}})})(Iw);const Mw=Or;var Vr={},Aw={get exports(){return Vr},set exports(e){Vr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.isoWeeksInYear=function(){var s=this.isLeapYear(),o=this.endOf("y").day();return o===4||s&&o===5?53:52}}})})(Aw);const $w=Vr;var Br={},zw={get exports(){return Br},set exports(e){Br=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.isSameOrAfter=function(s,o){return this.isSame(s,o)||this.isAfter(s,o)}}})})(zw);const Ew=Br;var Nr={},Lw={get exports(){return Nr},set exports(e){Nr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.isSameOrBefore=function(s,o){return this.isSame(s,o)||this.isBefore(s,o)}}})})(Lw);const Pw=Nr;var Gr={},Ow={get exports(){return Gr},set exports(e){Gr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.isToday=function(){var o="YYYY-MM-DD",u=s();return this.format(o)===u.format(o)}}})})(Ow);const Vw=Gr;var qr={},Bw={get exports(){return qr},set exports(e){qr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.isTomorrow=function(){var o="YYYY-MM-DD",u=s().add(1,"day");return this.format(o)===u.format(o)}}})})(Bw);const Nw=qr;var Fr={},Gw={get exports(){return Fr},set exports(e){Fr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){i.prototype.isYesterday=function(){var o="YYYY-MM-DD",u=s().subtract(1,"day");return this.format(o)===u.format(o)}}})})(Gw);const qw=Fr;var Wr={},Fw={get exports(){return Wr},set exports(e){Wr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=i.prototype,u=function(g){return g&&(g.indexOf?g:g.s)},l=function(g,h,b,w,C){var S=g.name?g:g.$locale(),M=u(S[h]),$=u(S[b]),P=M||$.map(function(L){return L.slice(0,w)});if(!C)return P;var q=S.weekStart;return P.map(function(L,z){return P[(z+(q||0))%7]})},d=function(){return s.Ls[s.locale()]},p=function(g,h){return g.formats[h]||function(b){return b.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(w,C,S){return C||S.slice(1)})}(g.formats[h.toUpperCase()])},f=function(){var g=this;return{months:function(h){return h?h.format("MMMM"):l(g,"months")},monthsShort:function(h){return h?h.format("MMM"):l(g,"monthsShort","months",3)},firstDayOfWeek:function(){return g.$locale().weekStart||0},weekdays:function(h){return h?h.format("dddd"):l(g,"weekdays")},weekdaysMin:function(h){return h?h.format("dd"):l(g,"weekdaysMin","weekdays",2)},weekdaysShort:function(h){return h?h.format("ddd"):l(g,"weekdaysShort","weekdays",3)},longDateFormat:function(h){return p(g.$locale(),h)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};o.localeData=function(){return f.bind(this)()},s.localeData=function(){var g=d();return{firstDayOfWeek:function(){return g.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(h){return p(g,h)},meridiem:g.meridiem,ordinal:g.ordinal}},s.months=function(){return l(d(),"months")},s.monthsShort=function(){return l(d(),"monthsShort","months",3)},s.weekdays=function(g){return l(d(),"weekdays",null,null,g)},s.weekdaysShort=function(g){return l(d(),"weekdaysShort","weekdays",3,g)},s.weekdaysMin=function(g){return l(d(),"weekdaysMin","weekdays",2,g)}}})})(Fw);const Ww=Wr;var jr={},jw={get exports(){return jr},set exports(e){jr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r={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(i,s,o){var u=s.prototype,l=u.format;o.en.formats=r,u.format=function(d){d===void 0&&(d="YYYY-MM-DDTHH:mm:ssZ");var p=this.$locale().formats,f=function(g,h){return g.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(b,w,C){var S=C&&C.toUpperCase();return w||h[C]||r[C]||h[S].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(M,$,P){return $||P.slice(1)})})}(d,p===void 0?{}:p);return l.call(this,f)}}})})(jw);const Yw=jr;var Yr={},Rw={get exports(){return Yr},set exports(e){Yr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=function(u,l){if(!l||!l.length||!l[0]||l.length===1&&!l[0].length)return null;var d;l.length===1&&l[0].length>0&&(l=l[0]),d=l[0];for(var p=1;p<l.length;p+=1)l[p].isValid()&&!l[p][u](d)||(d=l[p]);return d};s.max=function(){var u=[].slice.call(arguments,0);return o("isAfter",u)},s.min=function(){var u=[].slice.call(arguments,0);return o("isBefore",u)}}})})(Rw);const Qw=Yr;var Rr={},Uw={get exports(){return Rr},set exports(e){Rr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){var o=i.prototype,u=function(g){var h,b=g.date,w=g.utc,C={};if(!((h=b)instanceof Date)&&!(h instanceof Array)&&h instanceof Object){if(!Object.keys(b).length)return new Date;var S=w?s.utc():s();Object.keys(b).forEach(function(G){var U,Q;C[U=G,Q=o.$utils().p(U),Q==="date"?"day":Q]=b[G]});var M=C.day||(C.year||C.month>=0?1:S.date()),$=C.year||S.year(),P=C.month>=0?C.month:C.year||C.day?0:S.month(),q=C.hour||0,L=C.minute||0,z=C.second||0,A=C.millisecond||0;return w?new Date(Date.UTC($,P,M,q,L,z,A)):new Date($,P,M,q,L,z,A)}return b},l=o.parse;o.parse=function(g){g.date=u.bind(this)(g),l.bind(this)(g)};var d=o.set,p=o.add,f=function(g,h,b,w){if(w===void 0&&(w=1),h instanceof Object){var C=Object.keys(h),S=this;return C.forEach(function(M){S=g.bind(S)(h[M]*w,M)}),S}return g.bind(this)(h*w,b)};o.set=function(g,h){return h=h===void 0?g:h,f.bind(this)(function(b,w){return d.bind(this)(w,b)},h,g)},o.add=function(g,h){return f.bind(this)(p,g,h)},o.subtract=function(g,h){return f.bind(this)(p,g,h,-1)}}})})(Uw);const Xw=Rr;var Qr={},Zw={get exports(){return Qr},set exports(e){Qr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){var s=i.prototype;["milliseconds","seconds","minutes","hours","days","weeks","isoWeeks","months","quarters","years","dates"].forEach(function(o){s[o]=s[o.replace(/s$/,"")]})}})})(Zw);const Kw=Qr;var Ur={},Jw={get exports(){return Ur},set exports(e){Ur=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){var s=i.prototype.parse;i.prototype.parse=function(l){if(typeof l.date=="string"){var d=this.$locale();l.date=d&&d.preparse?d.preparse(l.date):l.date}return s.bind(this)(l)};var o=i.prototype.format;i.prototype.format=function(){for(var l=arguments.length,d=new Array(l),p=0;p<l;p++)d[p]=arguments[p];var f=o.call.apply(o,[this].concat(d)),g=this.$locale();return g&&g.postformat?g.postformat(f):f};var u=i.prototype.fromToBase;u&&(i.prototype.fromToBase=function(l,d,p,f){var g=this.$locale()||p.$locale();return u.call(this,l,d,p,f,g&&g.postformat)})}})})(Jw);const Hw=Ur;var Xr={},e1={get exports(){return Xr},set exports(e){Xr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r="month",i="quarter";return function(s,o){var u=o.prototype;u.quarter=function(p){return this.$utils().u(p)?Math.ceil((this.month()+1)/3):this.month(this.month()%3+3*(p-1))};var l=u.add;u.add=function(p,f){return p=Number(p),this.$utils().p(f)===i?this.add(3*p,r):l.bind(this)(p,f)};var d=u.startOf;u.startOf=function(p,f){var g=this.$utils(),h=!!g.u(f)||f;if(g.p(p)===i){var b=this.quarter()-1;return h?this.month(3*b).startOf(r).startOf("day"):this.month(3*b+2).endOf(r).endOf("day")}return d.bind(this)(p,f)}}})})(e1);const t1=Xr;var Zr={},n1={get exports(){return Zr},set exports(e){Zr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){r=r||{};var o=i.prototype,u={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 l(p,f,g,h){return o.fromToBase(p,f,g,h)}s.en.relativeTime=u,o.fromToBase=function(p,f,g,h,b){for(var w,C,S,M=g.$locale().relativeTime||u,$=r.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"}],P=$.length,q=0;q<P;q+=1){var L=$[q];L.d&&(w=h?s(p).diff(g,L.d,!0):g.diff(p,L.d,!0));var z=(r.rounding||Math.round)(Math.abs(w));if(S=w>0,z<=L.r||!L.r){z<=1&&q>0&&(L=$[q-1]);var A=M[L.l];b&&(z=b(""+z)),C=typeof A=="string"?A.replace("%d",z):A(z,f,L.l,S);break}}if(f)return C;var G=S?M.future:M.past;return typeof G=="function"?G(C):G.replace("%s",C)},o.to=function(p,f){return l(p,f,this,!0)},o.from=function(p,f){return l(p,f,this)};var d=function(p){return p.$u?s.utc():s()};o.toNow=function(p){return this.to(d(this),p)},o.fromNow=function(p){return this.from(d(this),p)}}})})(n1);const r1=Zr;var Kr={},i1={get exports(){return Kr},set exports(e){Kr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r={year:0,month:1,day:2,hour:3,minute:4,second:5},i={};return function(s,o,u){var l,d=function(h,b,w){w===void 0&&(w={});var C=new Date(h),S=function(M,$){$===void 0&&($={});var P=$.timeZoneName||"short",q=M+"|"+P,L=i[q];return L||(L=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:M,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:P}),i[q]=L),L}(b,w);return S.formatToParts(C)},p=function(h,b){for(var w=d(h,b),C=[],S=0;S<w.length;S+=1){var M=w[S],$=M.type,P=M.value,q=r[$];q>=0&&(C[q]=parseInt(P,10))}var L=C[3],z=L===24?0:L,A=C[0]+"-"+C[1]+"-"+C[2]+" "+z+":"+C[4]+":"+C[5]+":000",G=+h;return(u.utc(A).valueOf()-(G-=G%1e3))/6e4},f=o.prototype;f.tz=function(h,b){h===void 0&&(h=l);var w=this.utcOffset(),C=this.toDate(),S=C.toLocaleString("en-US",{timeZone:h}),M=Math.round((C-new Date(S))/1e3/60),$=u(S).$set("millisecond",this.$ms).utcOffset(15*-Math.round(C.getTimezoneOffset()/15)-M,!0);if(b){var P=$.utcOffset();$=$.add(w-P,"minute")}return $.$x.$timezone=h,$},f.offsetName=function(h){var b=this.$x.$timezone||u.tz.guess(),w=d(this.valueOf(),b,{timeZoneName:h}).find(function(C){return C.type.toLowerCase()==="timezonename"});return w&&w.value};var g=f.startOf;f.startOf=function(h,b){if(!this.$x||!this.$x.$timezone)return g.call(this,h,b);var w=u(this.format("YYYY-MM-DD HH:mm:ss:SSS"));return g.call(w,h,b).tz(this.$x.$timezone,!0)},u.tz=function(h,b,w){var C=w&&b,S=w||b||l,M=p(+u(),S);if(typeof h!="string")return u(h).tz(S);var $=function(z,A,G){var U=z-60*A*1e3,Q=p(U,G);if(A===Q)return[U,A];var ne=p(U-=60*(Q-A)*1e3,G);return Q===ne?[U,Q]:[z-60*Math.min(Q,ne)*1e3,Math.max(Q,ne)]}(u.utc(h,C).valueOf(),M,S),P=$[0],q=$[1],L=u(P).utcOffset(q);return L.$x.$timezone=S,L},u.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},u.tz.setDefault=function(h){l=h}}})})(i1);const a1=Kr;var Jr={},s1={get exports(){return Jr},set exports(e){Jr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.toArray=function(){return[this.$y,this.$M,this.$D,this.$H,this.$m,this.$s,this.$ms]}}})})(s1);const o1=Jr;var Hr={},l1={get exports(){return Hr},set exports(e){Hr=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.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}}}})})(l1);const u1=Hr;var ei={},d1={get exports(){return ei},set exports(e){ei=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i,s){s.updateLocale=function(o,u){var l=s.Ls[o];if(l)return(u?Object.keys(u):[]).forEach(function(d){l[d]=u[d]}),l}}})})(d1);const c1=ei;var ti={},p1={get exports(){return ti},set exports(e){ti=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r="minute",i=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(o,u,l){var d=u.prototype;l.utc=function(C){var S={date:C,utc:!0,args:arguments};return new u(S)},d.utc=function(C){var S=l(this.toDate(),{locale:this.$L,utc:!0});return C?S.add(this.utcOffset(),r):S},d.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var p=d.parse;d.parse=function(C){C.utc&&(this.$u=!0),this.$utils().u(C.$offset)||(this.$offset=C.$offset),p.call(this,C)};var f=d.init;d.init=function(){if(this.$u){var C=this.$d;this.$y=C.getUTCFullYear(),this.$M=C.getUTCMonth(),this.$D=C.getUTCDate(),this.$W=C.getUTCDay(),this.$H=C.getUTCHours(),this.$m=C.getUTCMinutes(),this.$s=C.getUTCSeconds(),this.$ms=C.getUTCMilliseconds()}else f.call(this)};var g=d.utcOffset;d.utcOffset=function(C,S){var M=this.$utils().u;if(M(C))return this.$u?0:M(this.$offset)?g.call(this):this.$offset;if(typeof C=="string"&&(C=function(L){L===void 0&&(L="");var z=L.match(i);if(!z)return null;var A=(""+z[0]).match(s)||["-",0,0],G=A[0],U=60*+A[1]+ +A[2];return U===0?0:G==="+"?U:-U}(C),C===null))return this;var $=Math.abs(C)<=16?60*C:C,P=this;if(S)return P.$offset=$,P.$u=C===0,P;if(C!==0){var q=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(P=this.local().add($+q,r)).$offset=$,P.$x.$localOffset=q}else P=this.utc();return P};var h=d.format;d.format=function(C){var S=C||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,S)},d.valueOf=function(){var C=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*C},d.isUTC=function(){return!!this.$u},d.toISOString=function(){return this.toDate().toISOString()},d.toString=function(){return this.toDate().toUTCString()};var b=d.toDate;d.toDate=function(C){return C==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():b.call(this)};var w=d.diff;d.diff=function(C,S,M){if(C&&this.$u===C.$u)return w.call(this,C,S,M);var $=this.local(),P=l(C).local();return w.call($,P,S,M)}}})})(p1);const h1=ti;var ni={},f1={get exports(){return ni},set exports(e){ni=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.weekday=function(s){var o=this.$locale().weekStart||0,u=this.$W,l=(u<o?u+7:u)-o;return this.$utils().u(s)?l:this.subtract(l,"day").add(s,"day")}}})})(f1);const g1=ni;var ri={},m1={get exports(){return ri},set exports(e){ri=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){var r="week",i="year";return function(s,o,u){var l=o.prototype;l.week=function(d){if(d===void 0&&(d=null),d!==null)return this.add(7*(d-this.week()),"day");var p=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var f=u(this).startOf(i).add(1,i).date(p),g=u(this).endOf(r);if(f.isBefore(g))return 1}var h=u(this).startOf(i).date(p).startOf(r).subtract(1,"millisecond"),b=this.diff(h,r,!0);return b<0?u(this).startOf("week").week():Math.ceil(b)},l.weeks=function(d){return d===void 0&&(d=null),this.week(d)}}})})(m1);const b1=ri;var ii={},y1={get exports(){return ii},set exports(e){ii=e}};(function(e,t){(function(r,i){e.exports=i()})(H,function(){return function(r,i){i.prototype.weekYear=function(){var s=this.month(),o=this.week(),u=this.year();return o===1&&s===11?u+1:s===0&&o>=52?u-1:u}}})})(y1);const v1=ii;j.extend(ow),j.extend(uw),j.extend(cw),j.extend(hw),j.extend(gw),j.extend(bw),j.extend(vw),j.extend(Cw),j.extend(_w),j.extend(Tw),j.extend(Dw),j.extend(Ew),j.extend(Pw),j.extend(Vw),j.extend(Nw),j.extend(qw),j.extend(Mw),j.extend($w),j.extend(Ww),j.extend(Yw),j.extend(Qw),j.extend(Xw),j.extend(Kw),j.extend(Hw),j.extend(t1),j.extend(r1),j.extend(a1),j.extend(o1),j.extend(u1),j.extend(c1),j.extend(h1),j.extend(b1),j.extend(v1),j.extend(g1),j.tz.setDefault("UTC");const x1=()=>Promise.resolve().then(()=>nl).then(({version:e})=>(console.log(`[@devtable/dashboard] version: ${e}`),e));D.ContentModel=Mt,D.ContentModelContextProvider=xn,D.ContextModel=ws,D.DashboardEditor=iw,D.DashboardFilterType=lr,D.DashboardMode=Ha,D.DashboardModel=zs,D.DashboardViewEditor=ts,D.DashboardViewRender=an,D.EViewComponentType=K,D.FilterModel=dr,D.FiltersModel=ps,D.FullScreenPanelContext=wn,D.LayoutStateContext=Ke,D.ModelContextProvider=vn,D.Panel=rn,D.PanelContextProvider=Cn,D.PanelModel=_s,D.PanelsModel=Ts,D.QueriesModel=vs,D.QueryModel=ys,D.ReadOnlyDashboard=aw,D.SQLSnippetModel=xs,D.SQLSnippetsModel=Cs,D.ViewComponentTypeBackground=es,D.ViewComponentTypeColor=nv,D.ViewComponentTypeName=tv,D.ViewModel=Ms,D.ViewsModel=As,D.applyPartialDashboard=bx,D.createContentModel=$s,D.createDashboardModel=mr,D.createDashboardViewsModel=gr,D.getInitialFiltersPayload=hs,D.getNewPanel=Ss,D.getVersion=x1,D.initialDashboardContent=rv,D.useContentModelContext=Y,D.useFullScreenPanelContext=Vi,D.useModelContext=ce,D.usePanelContext=Ce,D.useTopLevelServices=br,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|