@devtable/dashboard 13.28.0 → 13.28.1

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.
@@ -67,7 +67,7 @@ Check the top-level render call using <`+q+">.")}return A}}function $g(C,A){{if(
67
67
  `));const t=function(y){const _=y.getModel();if(_._isCursorAtCheckPoint){const k=y.getSelections(),S=k.map(function(T){return{lineNumber:T.positionLineNumber,column:T.positionColumn}});_._isCursorAtCheckPoint(S),_._currentCursorPositions=k}},n={},{isInstanceValid:s,isModelValid:i,isRangesValid:a}=Ey.initWith(e),l=function(y){if(s(y)){let _=y.getDomNode();return p._listener=t.bind(f,y),p._editorInstance=y,p._editorInstance._isInDevMode=!1,_.addEventListener("keydown",p._listener,!0),p._onChangeModelDisposable=y.onDidChangeModel(function(){_&&_.removeEventListener("keydown",p._listener,!0);const k=y.getDomNode();k&&k.addEventListener("keydown",p._listener,!0),_=k}),!0}else throw new Error(Cs("ICodeEditor","editorInstance","This type interface can be found in monaco editor documentation"))},c=function(y,_){if(i(y))if(a(_)){const k=Ay(y,_,e);return n[k.uri.toString()]=k,k}else throw new Error(Cs("Array<RangeRestrictionObject>","ranges","Please refer constrained editor documentation for proper structure"));else throw new Error(Cs("ICodeEditor","editorInstance","This type interface can be found in monaco editor documentation"))},u=function(y){if(i(y)){const _=y.uri.toString(),k=n[_];return k?k.disposeRestrictions():(console.warn("Current Model is not a restricted Model"),!1)}else throw new Error(Cs("ICodeEditor","editorInstance","This type interface can be found in monaco editor documentation"))},d=function(){if(p._editorInstance){const _=p._editorInstance.getDomNode();_&&_.removeEventListener("keydown",p._listener),p._onChangeModelDisposable&&p._onChangeModelDisposable.dispose(),delete p._listener,delete p._editorInstance._isInDevMode,delete p._editorInstance._devModeAction,delete p._editorInstance,delete p._onChangeModelDisposable;for(let k in n)delete n[k];return!0}return!1},h=function(){p._editorInstance._isInDevMode?(p._editorInstance._isInDevMode=!1,p._editorInstance._devModeAction.dispose(),delete p._editorInstance._devModeAction):(p._editorInstance._isInDevMode=!0,p._editorInstance._devModeAction=p._editorInstance.addAction({id:"showRange",label:"Show Range in console",contextMenuGroupId:"navigation",contextMenuOrder:1.5,run:function(y){const k=y.getSelections().reduce(function(S,{startLineNumber:T,endLineNumber:I,startColumn:z,endColumn:E}){return S.push("range : "+JSON.stringify([T,z,I,E])),S},[]).join(`
68
68
  `);console.log(`Selected Ranges :
69
69
  `+JSON.stringify(k,null,2))}}))},p={_listener:null,_editorInstance:null,_uriRestrictionMap:n,_injectedResources:e},f=Object.create(p),m={initializeIn:l,addRestrictionsTo:c,removeRestrictionsIn:u,disposeConstrainer:d,toggleDevMode:h};for(let y in m)Object.defineProperty(f,y,{enumerable:!1,writable:!1,configurable:!1,value:m[y]});return Object.freeze(f)}const Kn=g.forwardRef(({value:e,onChange:t,label:n,defaultValue:s,restrictions:i=[]},a)=>{const{t:l}=j.useTranslation(),[c,u]=g.useState(e),d=()=>{t(c)},h=()=>{u(e)},p=()=>{u(s)};g.useEffect(()=>{u(e)},[e]);const f=g.useCallback((_,k)=>{if(i.length===0)return;const S=Py(k),T=_.getModel();if(S.initializeIn(_),S.addRestrictionsTo(T,i),!!T&&!T._hasHighlight){S.toggleDevMode(),T.toggleHighlightOfEditableAreas();const I=T.getCurrentEditableRanges(),z=T.getValueInEditableRanges();console.debug({model:T,currentRanges:I,currentValue:z})}},[i]),m=c!==e,y=typeof c=="string"&&c.length===0;return r.jsxs(o.Stack,{spacing:4,sx:{height:"100%",".editableArea--multi-line":{backgroundColor:"rgba(255,183,78, 0.1)"},".editableArea--single-line":{backgroundColor:"rgba(255,183,78, 0.1)"}},children:[r.jsxs(o.Group,{mb:6,position:"apart",sx:{flexShrink:0,flexGrow:0},children:[r.jsx(o.Group,{position:"left",children:r.jsx(Pp,{})}),r.jsxs(o.Group,{position:"right",children:[r.jsx(o.Button,{onClick:p,size:"xs",variant:"default",leftIcon:r.jsx(M.IconPlayerSkipBack,{size:16}),children:l("common.actions.reset_to_default")}),r.jsx(o.Button,{onClick:h,color:"red",size:"xs",disabled:!m,leftIcon:r.jsx(M.IconRecycle,{size:16}),children:l("common.actions.revert_changes")}),r.jsx(o.Button,{color:"green",size:"xs",onClick:d,disabled:!m,leftIcon:r.jsx(M.IconDeviceFloppy,{size:16}),children:l("common.actions.save_changes")})]})]}),r.jsx(o.Text,{size:14,children:n}),r.jsxs(o.Box,{sx:{position:"relative",flexGrow:1},children:[y&&r.jsx(o.Overlay,{center:!0,color:"#fff",opacity:.5,children:r.jsx(o.Button,{color:"blue",radius:"xl",onClick:p,children:l("common.actions.init_with_default")})}),r.jsx(zy,{value:c,onChange:u,onMount:f})]})]})}),Ji=g.forwardRef(({title:e,value:t,onChange:n,label:s,description:i=null,triggerLabel:a="Edit",triggerButtonProps:l={},renderTriggerButton:c,defaultValue:u,zIndex:d=320,restrictions:h},p)=>{const[f,{open:m,close:y}]=Se.useDisclosure(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(o.Modal,{opened:f,onClose:y,title:e,withinPortal:!0,zIndex:d,size:"900px",children:[i,r.jsx(o.Box,{h:600,children:r.jsx(Kn,{value:t,onChange:n,defaultValue:u,label:s,restrictions:h})})]}),c==null?void 0:c({onClick:m}),!c&&r.jsx(o.Button,{onClick:m,...l,children:a})]})}),Oy=({onClick:e})=>{const{t}=j.useTranslation();return r.jsx(o.Tooltip,{label:t("rich_text.dynamic_color.label"),children:r.jsx(o.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important",color:"rgb(190, 75, 219)"},onClick:e,children:r.jsx(M.IconMathFunction,{stroke:2,size:16})})})},Ly=({editor:e})=>{const{t}=j.useTranslation(),n=e.getAttributes(hu)[Iy]??"",s=uu(n),i=ky(n);return r.jsxs(r.Fragment,{children:[r.jsx(Ji,{title:t("rich_text.dynamic_color.edit"),label:"",triggerLabel:"",value:s,onChange:a=>{a?e.chain().focus().setDynamicColor(a).run():e.chain().focus().unsetDynamicColor().run()},defaultValue:Sy,renderTriggerButton:Oy,restrictions:i,zIndex:340}),r.jsx(o.Tooltip,{label:t("rich_text.dynamic_color.clear"),children:r.jsx(o.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important",color:"#000"},disabled:!n,onClick:()=>e.chain().focus().unsetDynamicColor().run(),children:r.jsx(M.IconMathFunctionOff,{stroke:1.5,size:16})})})]})},mu=Zt.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replace(/['"]+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}; line-height: 1.2; overflow: auto`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Vy=["8","10","12","14","16","18","20","24","30","36","48","60","72"].map(e=>`${e}px`),By=[{label:"auto",value:""}].concat(Vy.map(e=>({label:e,value:e}))),qy={input:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important"}},Ny=({editor:e})=>{const t=e.getAttributes("textStyle").fontSize;return r.jsx(ee.RichTextEditor.ControlsGroup,{children:r.jsx(o.NativeSelect,{size:"xs",icon:r.jsx(M.IconTextSize,{stroke:1.5,size:16}),data:By,styles:qy,value:t||"",onChange:n=>{const s=n.currentTarget.value;s?e.chain().focus().setFontSize(s).run():e.chain().focus().unsetFontSize().run()}})})},Zi="grad_color_",$y=new RegExp(`^(?!${Zi})(.+)$`);function xu(e){return e&&e.replace($y,`${Zi}$1`)}const Fy=e=>{const n="abcdefghijklmnopqrstuvwxyz",i=`1234567890${n}${n.toUpperCase()}`.split(""),a=new Uint8Array(e);crypto.getRandomValues(a);const l=a.reduce((c,u)=>`${c}${i[u&61]}`,"");return`${Zi}${l}`};function Gy(e,t,n){try{if(!Number.isFinite(t)||!Number.isFinite(n))throw new Error(`[getColorMappingFunc] invalid interval with min[${t}] max[${n}]`);if(e.length<2)throw new Error("[getColorMappingFunc] expected at least 2 colors");const s=(n-t)/(e.length-1),i=wc.range(t,n+s,s);return Bm.scaleLinear(i,e)}catch(s){return console.error(s),()=>"inherit"}}function yu(e,t,n,s){const i=Number(e.getAttribute(n)),a=e.getAttribute(s);if(!a)return i;const l=Number(t[a]);return Number.isFinite(l)?l:i}function Wy(e,t){const n={};return e.querySelectorAll("color-mapping").forEach(i=>{const a=i.getAttribute(yt.color),l=yu(i,t,yt.min_val,yt.min_var),c=yu(i,t,yt.max_val,yt.max_var),u=i.getAttribute(yt.variable);if(!a||!Number.isFinite(l)||!Number.isFinite(c)||!u)return;const d=Number(t[u]);if(!Number.isFinite(d))return;const h=a.split(","),p=Gy(h,l,c);n[`#${xu(i.id)}`]={color:p(d)}}),n}function Ry(e){const t=v.get(e,yt.color,[]),n=v.get(e,yt.min_val,""),s=v.get(e,yt.min_var,""),i=v.get(e,yt.max_val,""),a=v.get(e,yt.max_var,""),l=v.get(e,yt.variable,""),c=t.length===0&&[n,s,i,a,l].every(u=>u==="");return{colors:t,min_val:n,min_var:s,max_val:i,max_var:a,variable:l,empty:c}}const qe={color:"data-colors",min_val:"data-min-val",min_var:"data-min-var",max_val:"data-max-val",max_var:"data-max-var",variable:"data-var"},yt=qe,bu="colorMapping",vu=Tr.create({name:bu,addAttributes(){return{id:{default:Fy(6),parseHTML:e=>{const t=e.getAttribute("id");return xu(t)}},[qe.color]:{default:[],parseHTML:e=>{const t=e.getAttribute(qe.color);return t?t.split(","):[]}},[qe.min_val]:{default:0,parseHTML:e=>e.getAttribute(qe.min_val)},[qe.min_var]:{default:"",parseHTML:e=>e.getAttribute(qe.min_var)},[qe.max_val]:{default:100,parseHTML:e=>e.getAttribute(qe.max_val)},[qe.max_var]:{default:"",parseHTML:e=>e.getAttribute(qe.max_var)},[qe.variable]:{default:"",parseHTML:e=>e.getAttribute(qe.variable)}}},parseHTML(){return[{tag:"color-mapping",getAttrs:e=>typeof e=="string"?(console.debug(e),!1):Object.values(yt).map(t=>e.getAttribute(t))}]},renderHTML({HTMLAttributes:e}){return["color-mapping",e,0]},addCommands(){return{setColorMapping:e=>({commands:t})=>{const{colors:n,min_val:s,min_var:i,max_val:a,max_var:l,variable:c}=e;return t.setMark(this.name,{[qe.color]:n,[qe.min_val]:s,[qe.min_var]:i,[qe.max_val]:a,[qe.max_var]:l,[qe.variable]:c})},unsetColorMapping:()=>({commands:e})=>e.unsetMark(this.name)}}}),cn={grid:{axis:"#97999D",scope:"rgba(47,140,192,0.1)",boundary:"#789AB4",reference:"#CFCFD8"},graphics:{compared:{blueDark:"#3E7CAB",blue:"#6398C7",blueLight:"#7CB0DF",blue10:"#6398C71a",redDark:"#AF5F6B",red:"#CD7C88",redLight:"#E794A0",red10:"#CD7C881a"},gradient:{distributed:"linear-gradient(90deg, #1babe6 0%, #2fc8c8 28.63%, #98d44b 48.86%, #ffd057 67.53%, #f5ae53 80.6%, #e76441 91.18%, #b90000 100%)",protrude:"linear-gradient(180deg, #ec73734d 0%, #ec737300 100%)"},level:{lv0:"#6398C7",lv1:"#61B5BF",lv2:"#54D4BB",lv3:"#F5D277",lv4:"#E8BB7F",lv5:"#DB9E84",lv6:"#CB8089"},depth:{dp0:"#FFF7F8",dp1:"#FFE1E1",dp2:"#FDBCBC",dp3:"#F39494",dp4:"#FA4242",dp5:"#E21212"},multiple:{c1:"#66B4DB",c2:"#E46464",c3:"#EEBA00",c4:"#33A678",c5:"#9D88CB",c6:"#939943",c7:"#E49792",c8:"#09A2B8",c9:"#AF5F6B",c10:"#6CA157",c11:"#3E7CAB",c12:"#6398C7",c13:"#E692BA",c14:"#97B566",c15:"#8CACE2",c16:"#CA79AC",c17:"#6DBC80",c18:"#B08F4B",c19:"#39BFA2",c20:"#826BAF"}}};function Qy(){Ye.registerTheme("merico-light",{color:Object.values(cn.graphics.multiple),visualMap:{color:Object.values(cn.graphics.depth).reverse()},axes:[{type:"all",name:"通用坐标轴",axisLineColor:"#97999D",axisTickColor:"#97999D",axisLabelShow:!0,axisLabelColor:"#818388",splitLineShow:!0,splitLineColor:["#E0E6F1"]}]})}function _u(){Qy()}const ju=g.createContext(null),Hi=ju.Provider;function ea(){const e=g.useContext(ju);if(!e)throw new Error("Please use DashboardModelContextProvider");return e}const le=()=>ea(),wu=()=>ea(),Cu=g.createContext({searchButtonProps:{}}),ta=Cu.Provider;function Su(){return g.useContext(Cu)}const ku=g.createContext(null),na=ku.Provider;function Tu(){const e=g.useContext(ku);if(!e)throw new Error("Please use ContentModelContextProvider");return e}const re=()=>Tu(),Pe=()=>Tu(),Uy={inEditMode:!1},Ss=g.createContext(Uy),Du=g.createContext({panel:null,data:{},loading:!1,errors:[],downloadPanelScreenshot:()=>{}}),ra=Du.Provider;function sa(){const e=g.useContext(Du);if(!e.panel)throw new Error("Please use PanelContextProvider");return e}const Lt=()=>sa(),Je=()=>sa();function Mu(){try{return sa(),!0}catch{return!1}}const Iu=()=>Mu(),zu=()=>Mu(),Yy={fullScreenPanelID:"",setFullScreenPanelID:v.noop},ia=g.createContext(Yy);function Eu(){const e=g.useContext(ia);if(!e)throw new Error("Please use FullScreenPanelContext.Provider");return e}const Ky={en:"en",zh:"zh-cn"};function aa({children:e}){const{i18n:t}=j.useTranslation(),n=g.useMemo(()=>{const s=t.language;return Ky[s]??"en"},[t.language]);return r.jsx(mc.DatesProvider,{settings:{locale:n,firstDayOfWeek:1},children:e})}const Xy=g.forwardRef(({aggValue:e,formattedValue:t,label:n,preview:s,...i},a)=>{const{hovered:l,ref:c}=Se.useHover(),u=s==="aggregated"?e:t,d=s==="aggregated"?t:e;return r.jsx(o.Box,{ref:c,...i,children:r.jsxs(o.Group,{noWrap:!0,position:"apart",ref:a,children:[r.jsx(o.Text,{size:"sm",sx:{flexGrow:1},children:n}),r.jsx(o.Text,{size:"xs",opacity:l?1:.65,sx:{flexShrink:0},children:l?d:u})]})})}),oa=D.observer(g.forwardRef((e,t)=>{const{label:n,value:s,onChange:i,description:a,required:l,clearable:c=!0,sx:u,preview:d="formatted",zIndex:h=340}=e;j.useTranslation();const{panel:p}=Je(),f=g.useMemo(()=>p.variableOptions(s,c),[s,c]);return f.length===0?r.jsx(o.TextInput,{ref:t,label:n,placeholder:s,readOnly:!0,disabled:!0}):r.jsx(o.Select,{ref:t,label:n,description:a,itemComponent:m=>r.jsx(Xy,{preview:d,...m}),data:f,value:s,onChange:i,required:l,sx:u,maxDropdownHeight:500,withinPortal:!0,zIndex:h})}));var Jy=Symbol.for("preact-signals");function ks(){if(jn>1)jn--;else{for(var e,t=!1;Mr!==void 0;){var n=Mr;for(Mr=void 0,la++;n!==void 0;){var s=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Pu(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=s}}if(la=0,jn--,t)throw e}}function un(e){if(jn>0)return e();jn++;try{return e()}finally{ks()}}var ge=void 0;function Xn(e){var t=ge;ge=void 0;try{return e()}finally{ge=t}}var Mr=void 0,jn=0,la=0,Ts=0;function Au(e){if(ge!==void 0){var t=e.n;if(t===void 0||t.t!==ge)return t={i:0,S:e,p:ge.s,n:void 0,t:ge,e:void 0,x:void 0,r:t},ge.s!==void 0&&(ge.s.n=t),ge.s=t,e.n=t,32&ge.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=ge.s,t.n=void 0,ge.s.n=t,ge.s=t),t}}function Ze(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}Ze.prototype.brand=Jy,Ze.prototype.h=function(){return!0},Ze.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)},Ze.prototype.U=function(e){if(this.t!==void 0){var t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n)}},Ze.prototype.subscribe=function(e){var t=this;return at(function(){var n=t.value,s=ge;ge=void 0;try{e(n)}finally{ge=s}})},Ze.prototype.valueOf=function(){return this.value},Ze.prototype.toString=function(){return this.value+""},Ze.prototype.toJSON=function(){return this.value},Ze.prototype.peek=function(){var e=ge;ge=void 0;try{return this.value}finally{ge=e}},Object.defineProperty(Ze.prototype,"value",{get:function(){var e=Au(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(la>100)throw new Error("Cycle detected");this.v=e,this.i++,Ts++,jn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ks()}}}});function Ds(e){return new Ze(e)}function Pu(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Ou(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Lu(e){for(var t=e.s,n=void 0;t!==void 0;){var s=t.p;t.i===-1?(t.S.U(t),s!==void 0&&(s.n=t.n),t.n!==void 0&&(t.n.p=s)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=s}e.s=n}function Jn(e){Ze.call(this,void 0),this.x=e,this.s=void 0,this.g=Ts-1,this.f=4}(Jn.prototype=new Ze).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ts))return!0;if(this.g=Ts,this.f|=1,this.i>0&&!Pu(this))return this.f&=-2,!0;var e=ge;try{Ou(this),ge=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return ge=e,Lu(this),this.f&=-2,!0},Jn.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ze.prototype.S.call(this,e)},Jn.prototype.U=function(e){if(this.t!==void 0&&(Ze.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Jn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Jn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Au(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Vu(e){return new Jn(e)}function Bu(e){var t=e.u;if(e.u=void 0,typeof t=="function"){jn++;var n=ge;ge=void 0;try{t()}catch(s){throw e.f&=-2,e.f|=8,ca(e),s}finally{ge=n,ks()}}}function ca(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Bu(e)}function Zy(e){if(ge!==this)throw new Error("Out-of-order effect");Lu(this),ge=e,this.f&=-2,8&this.f&&ca(this),ks()}function Ir(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Ir.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},Ir.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Bu(this),Ou(this),jn++;var e=ge;return ge=this,Zy.bind(this,e)},Ir.prototype.N=function(){2&this.f||(this.f|=2,this.o=Mr,Mr=this)},Ir.prototype.d=function(){this.f|=8,1&this.f||ca(this)};function at(e){var t=new Ir(e);try{t.c()}catch(n){throw t.d(),n}return t.d.bind(t)}function Ms(e,t){if(t){let n;return Vu(()=>{const s=e();return s&&n&&t(n,s)?n:(n=s,s)})}return Vu(e)}function ua(e,t){if(e===t)return!0;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((s,i)=>!ua(s,t[i]));try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function ke({get:e},t){return{init(n){return Ds(n)},get(){return e.call(this).value},set(n){const s=e.call(this);s.peek()!==n&&(s.value=n)}}}function Is(e,t){const n=new WeakMap;return function(){let s=n.get(this);return s||(s=Ms(e.bind(this)),n.set(this,s)),s.value}}function Hy(...e){const t=e.map(at);return()=>t.forEach(n=>n())}var eb=Object.create,da=Object.defineProperty,tb=Object.getOwnPropertyDescriptor,qu=Object.getOwnPropertySymbols,nb=Object.prototype.hasOwnProperty,rb=Object.prototype.propertyIsEnumerable,Nu=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Zn=e=>{throw TypeError(e)},$u=Math.pow,pa=(e,t,n)=>t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sb=(e,t)=>{for(var n in t||(t={}))nb.call(t,n)&&pa(e,n,t[n]);if(qu)for(var n of qu(t))rb.call(t,n)&&pa(e,n,t[n]);return e},Fu=(e,t)=>da(e,"name",{value:t,configurable:!0}),ib=e=>{var t;return[,,,eb((t=e==null?void 0:e[Nu("metadata")])!=null?t:null)]},Gu=["class","method","getter","setter","accessor","field","value","get","set"],zr=e=>e!==void 0&&typeof e!="function"?Zn("Function expected"):e,ab=(e,t,n,s,i)=>({kind:Gu[e],name:t,metadata:s,addInitializer:a=>n._?Zn("Already initialized"):i.push(zr(a||null))}),Wu=(e,t)=>pa(t,Nu("metadata"),e[3]),qn=(e,t,n,s)=>{for(var i=0,a=e[t>>1],l=a&&a.length;i<l;i++)t&1?a[i].call(n):s=a[i].call(n,s);return s},Er=(e,t,n,s,i,a)=>{var l,c,u,d,h,p=t&7,f=!!(t&8),m=!!(t&16),y=p>3?e.length+1:p?f?1:2:0,_=Gu[p+5],k=p>3&&(e[y-1]=[]),S=e[y]||(e[y]=[]),T=p&&(!m&&!f&&(i=i.prototype),p<5&&(p>3||!m)&&tb(p<4?i:{get[n](){return Ru(this,a)},set[n](z){return Qu(this,a,z)}},n));p?m&&p<4&&Fu(a,(p>2?"set ":p>1?"get ":"")+n):Fu(i,n);for(var I=s.length-1;I>=0;I--)d=ab(p,n,u={},e[3],S),p&&(d.static=f,d.private=m,h=d.access={has:m?z=>ob(i,z):z=>n in z},p^3&&(h.get=m?z=>(p^1?Ru:lb)(z,i,p^4?a:T.get):z=>z[n]),p>2&&(h.set=m?(z,E)=>Qu(z,i,E,p^4?a:T.set):(z,E)=>z[n]=E)),c=(0,s[I])(p?p<4?m?a:T[_]:p>4?void 0:{get:T.get,set:T.set}:i,d),u._=1,p^4||c===void 0?zr(c)&&(p>4?k.unshift(c):p?m?a=c:T[_]=c:i=c):typeof c!="object"||c===null?Zn("Object expected"):(zr(l=c.get)&&(T.get=l),zr(l=c.set)&&(T.set=l),zr(l=c.init)&&k.unshift(l));return p||Wu(e,i),T&&da(i,n,T),m?p^4?a:T:i},ha=(e,t,n)=>t.has(e)||Zn("Cannot "+n),ob=(e,t)=>Object(t)!==t?Zn('Cannot use the "in" operator on this value'):e.has(t),Ru=(e,t,n)=>(ha(e,t,"read from private field"),n?n.call(e):t.get(e)),fa=(e,t,n)=>t.has(e)?Zn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Qu=(e,t,n,s)=>(ha(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),lb=(e,t,n)=>(ha(e,t,"access private method"),n),dn=class Hl{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new Hl(t.x-n.x,t.y-n.y)}static distance(t,n){return Math.hypot(t.x-n.x,t.y-n.y)}static equals(t,n){return t.x===n.x&&t.y===n.y}static from({x:t,y:n}){return new Hl(t,n)}},cb=class Si{constructor(t,n,s,i){this.left=t,this.top=n,this.width=s,this.height=i,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){const{top:s,left:i,width:a,height:l,scale:c}=this,u=new Si(i+t,s+n,a,l);return u.scale=sb({},c),u}get boundingRectangle(){const{width:t,height:n,left:s,top:i,right:a,bottom:l}=this;return{width:t,height:n,left:s,top:i,right:a,bottom:l}}get center(){const{left:t,top:n,right:s,bottom:i}=this;return new dn((t+s)/2,(n+i)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof Si))return!1;const{left:n,top:s,width:i,height:a}=this;return n===t.left&&s===t.top&&i===t.width&&a===t.height}containsPoint(t){const{top:n,left:s,bottom:i,right:a}=this;return n<=t.y&&t.y<=i&&s<=t.x&&t.x<=a}intersectionArea(t){return t instanceof Si?ub(this,t):0}intersectionRatio(t){const{area:n}=this,s=this.intersectionArea(t);return s/(t.area+n-s)}get bottom(){const{top:t,height:n}=this;return t+n}get right(){const{left:t,width:n}=this;return t+n}};function ub(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),l=i-s,c=a-n;return s<i&&n<a?l*c:0}var Uu=10,Yu,Ku,Xu,Ju,Zu,ot,ga,ma,xa;Zu=[ke],Ju=[ke],Xu=[ke],Ku=[Is],Yu=[Is];var Hn=class{constructor(e){qn(ot,5,this),fa(this,ga,qn(ot,8,this)),qn(ot,11,this),fa(this,ma,qn(ot,12,this)),qn(ot,15,this),fa(this,xa,qn(ot,16,this)),qn(ot,19,this);const t=dn.from(e);this.initial=t,this.current=t,this.previous=t}get delta(){return dn.delta(this.current,this.initial)}get direction(){const e={x:this.current.x-this.previous.x,y:this.current.y-this.previous.y};return!e.x&&!e.y?null:Math.abs(e.x)>Math.abs(e.y)?e.x>0?"right":"left":e.y>0?"down":"up"}reset(e){const t=dn.from(e);un(()=>{this.current=t,this.previous=t,this.initial=t})}update(e){const{current:t}=this,n=dn.from(e);if(dn.equals(t,n))return;const s={x:n.x-t.x,y:n.y-t.y};(Math.abs(s.x)<Uu||Math.abs(s.y)<Uu)&&(this.previous=t),this.current=n}};ot=ib(null),ga=new WeakMap,ma=new WeakMap,xa=new WeakMap,Er(ot,4,"initial",Zu,Hn,ga),Er(ot,4,"previous",Ju,Hn,ma),Er(ot,4,"current",Xu,Hn,xa),Er(ot,2,"delta",Ku,Hn),Er(ot,2,"direction",Yu,Hn),Wu(ot,Hn);function ya({x:e,y:t},n){const s=Math.abs(e),i=Math.abs(t);return typeof n=="number"?Math.sqrt($u(s,2)+$u(i,2))>n:"x"in n&&"y"in n?s>n.x&&i>n.y:"x"in n?s>n.x:"y"in n?i>n.y:!1}var Hu=(e=>(e.Horizontal="x",e.Vertical="y",e))(Hu||{}),ed=Object.values(Hu),db=Object.create,ba=Object.defineProperty,pb=Object.getOwnPropertyDescriptor,td=Object.getOwnPropertySymbols,hb=Object.prototype.hasOwnProperty,fb=Object.prototype.propertyIsEnumerable,nd=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),er=e=>{throw TypeError(e)},gb=(e,t,n)=>t in e?ba(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rd=(e,t)=>ba(e,"name",{value:t,configurable:!0}),sd=(e,t)=>{var n={};for(var s in e)hb.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&td)for(var s of td(e))t.indexOf(s)<0&&fb.call(e,s)&&(n[s]=e[s]);return n},zs=e=>{var t;return[,,,db((t=e==null?void 0:e[nd("metadata")])!=null?t:null)]},id=["class","method","getter","setter","accessor","field","value","get","set"],Ar=e=>e!==void 0&&typeof e!="function"?er("Function expected"):e,mb=(e,t,n,s,i)=>({kind:id[e],name:t,metadata:s,addInitializer:a=>n._?er("Already initialized"):i.push(Ar(a||null))}),Pr=(e,t)=>gb(t,nd("metadata"),e[3]),we=(e,t,n,s)=>{for(var i=0,a=e[t>>1],l=a&&a.length;i<l;i++)t&1?a[i].call(n):s=a[i].call(n,s);return s},lt=(e,t,n,s,i,a)=>{var l,c,u,d,h,p=t&7,f=!!(t&8),m=!!(t&16),y=p>3?e.length+1:p?f?1:2:0,_=id[p+5],k=p>3&&(e[y-1]=[]),S=e[y]||(e[y]=[]),T=p&&(!m&&!f&&(i=i.prototype),p<5&&(p>3||!m)&&pb(p<4?i:{get[n](){return Es(this,a)},set[n](z){return _a(this,a,z)}},n));p?m&&p<4&&rd(a,(p>2?"set ":p>1?"get ":"")+n):rd(i,n);for(var I=s.length-1;I>=0;I--)d=mb(p,n,u={},e[3],S),p&&(d.static=f,d.private=m,h=d.access={has:m?z=>xb(i,z):z=>n in z},p^3&&(h.get=m?z=>(p^1?Es:yb)(z,i,p^4?a:T.get):z=>z[n]),p>2&&(h.set=m?(z,E)=>_a(z,i,E,p^4?a:T.set):(z,E)=>z[n]=E)),c=(0,s[I])(p?p<4?m?a:T[_]:p>4?void 0:{get:T.get,set:T.set}:i,d),u._=1,p^4||c===void 0?Ar(c)&&(p>4?k.unshift(c):p?m?a=c:T[_]=c:i=c):typeof c!="object"||c===null?er("Object expected"):(Ar(l=c.get)&&(T.get=l),Ar(l=c.set)&&(T.set=l),Ar(l=c.init)&&k.unshift(l));return p||Pr(e,i),T&&ba(i,n,T),m?p^4?a:T:i},va=(e,t,n)=>t.has(e)||er("Cannot "+n),xb=(e,t)=>Object(t)!==t?er('Cannot use the "in" operator on this value'):e.has(t),Es=(e,t,n)=>(va(e,t,"read from private field"),n?n.call(e):t.get(e)),bt=(e,t,n)=>t.has(e)?er("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),_a=(e,t,n,s)=>(va(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),yb=(e,t,n)=>(va(e,t,"access private method"),n);function ad(e,t){return{plugin:e,options:t}}function bb(e){return t=>ad(e,t)}function od(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var ld,Or,ja;ld=[ke];var St=class{constructor(e,t){this.manager=e,this.options=t,bt(this,ja,we(Or,8,this,!1)),we(Or,11,this)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return Xn(()=>this.disabled)}configure(e){this.options=e}destroy(){}static configure(e){return ad(this,e)}};Or=zs(null),ja=new WeakMap,lt(Or,4,"disabled",ld,St,ja),Pr(Or,St);var vb=class extends St{},Lr=(e=>(e[e.Lowest=0]="Lowest",e[e.Low=1]="Low",e[e.Normal=2]="Normal",e[e.High=3]="High",e[e.Highest=4]="Highest",e))(Lr||{}),cd,ud,dd,pd,ct,wa,Ca,Sa,ka;pd=[ke],dd=[ke],ud=[ke],cd=[ke];var Nn=class{constructor(e,t){bt(this,wa,we(ct,8,this)),we(ct,11,this),bt(this,Ca,we(ct,12,this)),we(ct,15,this),bt(this,Sa,we(ct,16,this)),we(ct,19,this),bt(this,ka,we(ct,20,this)),we(ct,23,this);const{effects:n,id:s,data:i={},disabled:a=!1}=e;let l=s;this.manager=t,this.id=s,this.data=i,this.disabled=a,this.effects=()=>{var c;return[()=>{const{id:u,manager:d}=this;if(s!==l)return d==null||d.registry.register(this),()=>d==null?void 0:d.registry.unregister(this)},...(c=n==null?void 0:n())!=null?c:[]]},this.destroy=this.destroy.bind(this),t&&queueMicrotask(()=>{var c;(c=this.manager)==null||c.registry.register(this)})}register(){var e;return(e=this.manager)==null?void 0:e.registry.register(this)}unregister(){var e;(e=this.manager)==null||e.registry.unregister(this)}destroy(){var e;(e=this.manager)==null||e.registry.unregister(this)}};ct=zs(null),wa=new WeakMap,Ca=new WeakMap,Sa=new WeakMap,ka=new WeakMap,lt(ct,4,"manager",pd,Nn,wa),lt(ct,4,"id",dd,Nn,Ca),lt(ct,4,"data",ud,Nn,Sa),lt(ct,4,"disabled",cd,Nn,ka),Pr(ct,Nn);var hd,fd,gd,Ta,Vr,Ht,Da,Ma,Br=class extends(Ta=Nn,gd=[ke],fd=[ke],hd=[Is],Ta){constructor(t,n){var s=t,{modifiers:i,type:a,sensors:l}=s,c=sd(s,["modifiers","type","sensors"]);super(c,n),we(Ht,5,this),bt(this,Vr),bt(this,Da,we(Ht,8,this)),we(Ht,11,this),bt(this,Ma,we(Ht,12,this,"idle")),we(Ht,15,this),this.type=a,this.sensors=l,this.modifiers=i}set modifiers(t){var n;const{manager:s}=this;(n=Es(this,Vr))==null||n.forEach(i=>i.destroy()),s&&_a(this,Vr,t==null?void 0:t.map(i=>{const{plugin:a,options:l}=od(i);return new a(s,l)}))}get modifiers(){return Es(this,Vr)}get isDragSource(){var t,n;return((n=(t=this.manager)==null?void 0:t.dragOperation.source)==null?void 0:n.id)===this.id}destroy(){var t;super.destroy(),(t=this.modifiers)==null||t.forEach(n=>n.destroy())}};Ht=zs(Ta),Vr=new WeakMap,Da=new WeakMap,Ma=new WeakMap,lt(Ht,4,"type",gd,Br,Da),lt(Ht,4,"status",fd,Br,Ma),lt(Ht,2,"isDragSource",hd,Br),Pr(Ht,Br);var md,xd,yd,bd,vd,_d,Ia,Ne,za,Ea,Aa,Pa,Oa,wn=class extends(Ia=Nn,_d=[ke],vd=[ke],bd=[ke],yd=[ke],xd=[ke],md=[Is],Ia){constructor(t,n){var s=t,{accept:i,collisionDetector:a,collisionPriority:l=2,type:c}=s,u=sd(s,["accept","collisionDetector","collisionPriority","type"]);super(u,n),we(Ne,5,this),bt(this,za,we(Ne,8,this)),we(Ne,11,this),bt(this,Ea,we(Ne,12,this)),we(Ne,15,this),bt(this,Aa,we(Ne,16,this)),we(Ne,19,this),bt(this,Pa,we(Ne,20,this)),we(Ne,23,this),bt(this,Oa,we(Ne,24,this)),we(Ne,27,this),this.accept=i,this.collisionDetector=a,this.collisionPriority=l,this.type=c}accepts(t){const{accept:n}=this;return n?t.type?Array.isArray(n)?n.includes(t.type):typeof n=="function"?n(t):t.type===n:!1:!0}get isDropTarget(){var t,n;return((n=(t=this.manager)==null?void 0:t.dragOperation.target)==null?void 0:n.id)===this.id}refreshShape(){}};Ne=zs(Ia),za=new WeakMap,Ea=new WeakMap,Aa=new WeakMap,Pa=new WeakMap,Oa=new WeakMap,lt(Ne,4,"accept",_d,wn,za),lt(Ne,4,"type",vd,wn,Ea),lt(Ne,4,"collisionDetector",bd,wn,Aa),lt(Ne,4,"collisionPriority",yd,wn,Pa),lt(Ne,4,"shape",xd,wn,Oa),lt(Ne,2,"isDropTarget",md,wn),Pr(Ne,wn);var As=class extends St{constructor(e,t){super(e,t),this.manager=e,this.options=t}},_b=({dragOperation:e,droppable:t})=>{const n=e.position.current;if(!n)return null;const{id:s}=t;if(!t.shape)return null;if(t.shape.containsPoint(n)){const i=dn.distance(t.shape.center,n);return{id:s,value:1/i,priority:Lr.High}}return null},jb=({dragOperation:e,droppable:t})=>{if(!t.shape)return null;const{shape:n}=e;if(n==null?void 0:n.current.intersectionArea(t.shape)){const{position:i}=e,l=1/dn.distance(t.shape.center,i.current);return{id:t.id,value:l,priority:Lr.Normal}}return null},jd=e=>{var t;return(t=_b(e))!=null?t:jb(e)},wb=e=>{var t;const{dragOperation:n,droppable:s}=e,{shape:i,position:a}=n;if(!s.shape)return null;const c=1/dn.distance(s.shape.center,(t=i==null?void 0:i.current.center)!=null?t:a.current);return{id:s.id,value:c,priority:Lr.Low}};function wd(e){const{width:t,height:n,top:s,left:i,bottom:a,right:l}=e.getBoundingClientRect();return{width:t,height:n,top:s,left:i,bottom:a,right:l}}var Cb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function La(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Cd(e){return"nodeType"in e}function tr(e){var t,n;return e?La(e)?e:Cd(e)&&(n=(t=e.ownerDocument)==null?void 0:t.defaultView)!=null?n:window:window}function Sd(e){const{Document:t}=tr(e);return e instanceof t}function kd(e){return La(e)?!1:e instanceof tr(e).HTMLElement}function qr(e){return e?La(e)?e.document:Cd(e)?Sd(e)?e:kd(e)?e.ownerDocument:document:document:document}function Sb(e){const{documentElement:t}=qr(e),n=t.clientWidth,s=t.clientHeight;return{top:0,left:0,right:n,bottom:s,width:n,height:s}}function kb(e){const t="input, textarea, select, canvas, [contenteditable]",n=e.cloneNode(!0),s=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((a,l)=>{const c=s[l];if(Td(a)&&Td(c)&&(a.type!=="file"&&(a.value=c.value),a.type==="radio"&&a.name&&(a.name=`Cloned__${a.name}`)),a instanceof HTMLCanvasElement&&c instanceof HTMLCanvasElement&&c.width>0&&c.height>0){const u=a.getContext("2d");u==null||u.drawImage(c,0,0)}}),n}function Td(e){return"value"in e}function nr(e){return"style"in e&&e.style instanceof tr(e).CSSStyleDeclaration}function Tb(e,t=!1,n){const s=kb(e);if(nr(s)&&(t||s.style.setProperty("opacity","0")),s.setAttribute("inert","true"),s.setAttribute("tab-index","-1"),s.setAttribute("aria-hidden","true"),n)for(const[i,a]of Object.entries(n))s.setAttribute(i,a);return s}var Dd=class{constructor(){this.entries=new Set,this.clear=()=>{for(const e of this.entries){const[t,{type:n,listener:s,options:i}]=e;t.removeEventListener(n,s,i)}this.entries.clear()}}bind(e,t){const n=Array.isArray(t)?t:[t],s=[];for(const i of n){const{type:a,listener:l,options:c}=i,u=[e,i];e.addEventListener(a,l,c),this.entries.add(u),s.push(u)}return function(){for(const[a,{type:l,listener:c,options:u}]of s)a.removeEventListener(l,c,u)}}};function Va(e){return"showPopover"in e&&"hidePopover"in e&&typeof e.showPopover=="function"&&typeof e.hidePopover=="function"}function Ba(e){Va(e)&&e.isConnected&&e.hasAttribute("popover")&&e.showPopover()}function Md(e){return!Cb||!e?!1:e===qr(e).scrollingElement}function Id(e){const t=Md(e)?Sb(e):wd(e),n=Md(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={current:{x:e.scrollLeft,y:e.scrollTop},max:{x:e.scrollWidth-n.width,y:e.scrollHeight-n.height}},i=s.current.y<=0,a=s.current.x<=0,l=s.current.y>=s.max.y,c=s.current.x>=s.max.x;return{rect:t,position:s,isTop:i,isLeft:a,isBottom:l,isRight:c}}function Db(e,t){const{isTop:n,isBottom:s,isLeft:i,isRight:a,position:l}=Id(e),{x:c,y:u}=t??{x:0,y:0},d=!n&&l.current.y+u>0,h=!s&&l.current.y+u<l.max.y,p=!i&&l.current.x+c>0,f=!a&&l.current.x+c<l.max.x;return{top:d,bottom:h,left:p,right:f,x:p||f,y:d||h}}function Mb(e){return e instanceof tr(e).SVGElement}function Cn(e){return tr(e).getComputedStyle(e)}function Ib(e,t=Cn(e)){return t.position==="fixed"||t.position==="sticky"}function zb(e,t=Cn(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(i=>{const a=t[i];return typeof a=="string"?n.test(a):!1})!=null}var Eb={excludeElement:!0};function Ps(e,t=Eb){const{limit:n,excludeElement:s}=t,i=new Set;function a(l){if(n!=null&&i.size>=n||!l)return i;if(Sd(l)&&l.scrollingElement!=null&&!i.has(l.scrollingElement))return i.add(l.scrollingElement),i;if(!kd(l))return Mb(l)?a(l.parentElement):i;if(i.has(l))return i;const c=Cn(l);if(s&&l===e||zb(l,c)&&i.add(l),Ib(l,c)){const{scrollingElement:u}=l.ownerDocument;return u&&i.add(u),i}return a(l.parentNode)}return e?a(e):i}function Ab(e){const[t]=Ps(e,{limit:1});return t??null}var kt=(e=>(e[e.Idle=0]="Idle",e[e.Forward=1]="Forward",e[e.Reverse=-1]="Reverse",e))(kt||{}),Pb={x:.2,y:.2},Ob={x:10,y:10};function Lb(e,t,n,s=25,i=Pb,a=Ob){const{rect:l,isTop:c,isBottom:u,isLeft:d,isRight:h}=Id(e),p={x:0,y:0},f={x:0,y:0},m={height:l.height*i.y,width:l.width*i.x};return!c&&t.y<=l.top+m.height&&(n==null?void 0:n.y)!==1&&t.x>=l.left-a.x&&t.x<=l.right+a.x?(p.y=-1,f.y=s*Math.abs((l.top+m.height-t.y)/m.height)):!u&&t.y>=l.bottom-m.height&&(n==null?void 0:n.y)!==-1&&t.x>=l.left-a.x&&t.x<=l.right+a.x&&(p.y=1,f.y=s*Math.abs((l.bottom-m.height-t.y)/m.height)),!h&&t.x>=l.right-m.width&&(n==null?void 0:n.x)!==-1&&t.y>=l.top-a.y&&t.y<=l.bottom+a.y?(p.x=1,f.x=s*Math.abs((l.right-m.width-t.x)/m.width)):!d&&t.x<=l.left+m.width&&(n==null?void 0:n.x)!==1&&t.y>=l.top-a.y&&t.y<=l.bottom+a.y&&(p.x=-1,f.x=s*Math.abs((l.left+m.width-t.x)/m.width)),{direction:p,speed:f}}function Vb(e){return"scrollIntoViewIfNeeded"in e&&typeof e.scrollIntoViewIfNeeded=="function"}function zd(e,t=!1){if(Vb(e)){e.scrollIntoViewIfNeeded(t);return}if(!(e instanceof HTMLElement))return e.scrollIntoView();var[n]=Ps(e,{limit:1});if(!(n instanceof HTMLElement))return;const s=Cn(n),i=parseInt(s.getPropertyValue("border-top-width")),a=parseInt(s.getPropertyValue("border-left-width")),l=e.offsetTop-n.offsetTop<n.scrollTop,c=e.offsetTop-n.offsetTop+e.clientHeight-i>n.scrollTop+n.clientHeight,u=e.offsetLeft-n.offsetLeft<n.scrollLeft,d=e.offsetLeft-n.offsetLeft+e.clientWidth-a>n.scrollLeft+n.clientWidth,h=l&&!c;(l||c)&&t&&(n.scrollTop=e.offsetTop-n.offsetTop-n.clientHeight/2-i+e.clientHeight/2),(u||d)&&t&&(n.scrollLeft=e.offsetLeft-n.offsetLeft-n.clientWidth/2-a+e.clientWidth/2),(l||c||u||d)&&!t&&e.scrollIntoView(h)}var Bb=class{constructor(){this.tasks=new Set,this.flush=()=>{const e=this.tasks;this.animationFrame=void 0,this.tasks=new Set;for(const t of e)t()}}schedule(e){this.tasks.add(e),this.animationFrame||(this.animationFrame=requestAnimationFrame(this.flush))}},rr=new Bb;function qb(e,t,n){const{scaleX:s,scaleY:i,x:a,y:l}=t,c=e.left-a-(1-s)*parseFloat(n),u=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?e.width/s:e.width,h=i?e.height/i:e.height;return{width:d,height:h,top:u,right:c+d,bottom:u+h,left:c}}var Ed=class{constructor(e){this.element=e,this.initial=new Map}set(e,t=""){const{element:n}=this;if(nr(n))for(const[s,i]of Object.entries(e)){const a=`${t}${s}`;this.initial.has(a)||this.initial.set(a,n.style.getPropertyValue(a)),n.style.setProperty(a,typeof i=="string"?i:`${i}px`)}}remove(e,t=""){const{element:n}=this;if(nr(n))for(const s of e){const i=`${t}${s}`;n.style.removeProperty(i)}}reset(){const{element:e}=this;if(nr(e)){for(const[t,n]of this.initial)e.style.setProperty(t,n);e.getAttribute("style")===""&&e.removeAttribute("style")}}};function Ad({element:e,keyframes:t,options:n,onReady:s,onFinish:i}){const a=new Ed(e),{transitionProperty:l}=Cn(e),c=l.split(", ");a.set({"transition-property":c.length?c.filter(u=>!u.includes("transform")&&!u.includes("translate")).join(", "):"none"}),s==null||s(),e.animate(t,n).finished.then(()=>{i==null||i(),a.reset()})}function Pd(e){const t=e.getAnimations();if(t.length>0){const[n]=t,{effect:s}=n,i=s instanceof KeyframeEffect?s.getKeyframes():[];if(i.length>0)return i==null?void 0:i[i.length-1]}return null}function Os(e){if(e==="none")return null;const[t,n,s="0"]=e.split(" "),i={x:parseFloat(t),y:parseFloat(n),z:parseInt(s,10)};return isNaN(i.x)&&isNaN(i.y)?null:{x:isNaN(i.x)?0:i.x,y:isNaN(i.y)?0:i.y,z:isNaN(i.z)?0:i.z}}function Nb(e){const t=Pd(e);if(t){const{translate:s=""}=t;if(typeof s=="string"){const i=Os(s);if(i)return i}}const{translate:n}=Cn(e);if(n){const s=Os(n);if(s)return s}return{x:0,y:0,z:0}}function $b(e){if(e==="none")return null;const t=e.split(" "),n=parseFloat(t[0]),s=parseFloat(t[1]);return isNaN(n)&&isNaN(s)?null:{x:isNaN(n)?s:n,y:isNaN(s)?n:s}}function Od(e){var t,n,s,i,a,l,c,u,d;const{scale:h,transform:p,translate:f}=e,m=$b(h),y=Os(f),_=Fb(p);if(!_&&!m&&!y)return null;const k={x:(t=m==null?void 0:m.x)!=null?t:1,y:(n=m==null?void 0:m.y)!=null?n:1},S={x:(s=y==null?void 0:y.x)!=null?s:0,y:(i=y==null?void 0:y.y)!=null?i:0},T={x:(a=_==null?void 0:_.x)!=null?a:0,y:(l=_==null?void 0:_.y)!=null?l:0,scaleX:(c=_==null?void 0:_.scaleX)!=null?c:1,scaleY:(u=_==null?void 0:_.scaleY)!=null?u:1};return{x:S.x+T.x,y:S.y+T.y,z:(d=y==null?void 0:y.z)!=null?d:0,scaleX:k.x*T.scaleX,scaleY:k.y*T.scaleY}}function Fb(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}var en=class extends cb{constructor(e,t=!1){var n,s;let{top:i,left:a,right:l,bottom:c,width:u,height:d}=wd(e);const h=Cn(e),p=Od(h),f={x:(n=p==null?void 0:p.scaleX)!=null?n:1,y:(s=p==null?void 0:p.scaleY)!=null?s:1},m=Gb(e);if(p&&(t||m)){const y=qb({top:i,left:a,right:l,bottom:c,width:u,height:d},p,h.transformOrigin);i=y.top,a=y.left,u=y.width,d=y.height}m&&!t&&(i=i+m.y,a=a+m.x,u=u*m.scaleX,d=d*m.scaleY,f.x=m.scaleX,f.y=m.scaleY),super(a,i,u,d),this.scale=f}};function Gb(e){const t=Pd(e);if(t){const{transform:n="",translate:s="",scale:i=""}=t;if(n||s||i)return Od({transform:typeof n=="string"?n:"",translate:typeof s=="string"?s:"",scale:typeof i=="string"?i:""})}return null}function Ls(e){return e instanceof KeyboardEvent}var Wb=Object.create,Ld=Object.defineProperty,Rb=Object.defineProperties,Qb=Object.getOwnPropertyDescriptor,Ub=Object.getOwnPropertyDescriptors,Vs=Object.getOwnPropertySymbols,Vd=Object.prototype.hasOwnProperty,Bd=Object.prototype.propertyIsEnumerable,qd=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Nr=e=>{throw TypeError(e)},qa=(e,t,n)=>t in e?Ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nd=(e,t)=>{for(var n in t||(t={}))Vd.call(t,n)&&qa(e,n,t[n]);if(Vs)for(var n of Vs(t))Bd.call(t,n)&&qa(e,n,t[n]);return e},Yb=(e,t)=>Rb(e,Ub(t)),$d=(e,t)=>{var n={};for(var s in e)Vd.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Vs)for(var s of Vs(e))t.indexOf(s)<0&&Bd.call(e,s)&&(n[s]=e[s]);return n},Bs=e=>{var t;return[,,,Wb((t=e==null?void 0:e[qd("metadata")])!=null?t:null)]},Fd=["class","method","getter","setter","accessor","field","value","get","set"],$r=e=>e!==void 0&&typeof e!="function"?Nr("Function expected"):e,Kb=(e,t,n,s,i)=>({kind:Fd[e],name:t,metadata:s,addInitializer:a=>n._?Nr("Already initialized"):i.push($r(a||null))}),qs=(e,t)=>qa(t,qd("metadata"),e[3]),He=(e,t,n,s)=>{for(var i=0,a=e[t>>1],l=a&&a.length;i<l;i++)t&1?a[i].call(n):s=a[i].call(n,s);return s},Sn=(e,t,n,s,i,a)=>{for(var l,c,u,d,h,p=t&7,f=!!(t&8),m=!!(t&16),y=e.length+1,_=Fd[p+5],k=e[y-1]=[],S=e[y]||(e[y]=[]),T=(i=i.prototype,Qb({get[n](){return tn(this,a)},set[n](z){return sr(this,a,z)}},n)),I=s.length-1;I>=0;I--)d=Kb(p,n,u={},e[3],S),d.static=f,d.private=m,h=d.access={has:z=>n in z},h.get=z=>z[n],h.set=(z,E)=>z[n]=E,c=(0,s[I])({get:T.get,set:T.set},d),u._=1,c===void 0?$r(c)&&(T[_]=c):typeof c!="object"||c===null?Nr("Object expected"):($r(l=c.get)&&(T.get=l),$r(l=c.set)&&(T.set=l),$r(l=c.init)&&k.unshift(l));return T&&Ld(i,n,T),i},Gd=(e,t,n)=>t.has(e)||Nr("Cannot "+n),tn=(e,t,n)=>(Gd(e,t,"read from private field"),t.get(e)),Tt=(e,t,n)=>t.has(e)?Nr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),sr=(e,t,n,s)=>(Gd(e,t,"write to private field"),t.set(e,n),n),Wd={role:"button",roleDescription:"draggable",tabIndex:0},Xb="dnd-kit-description",Jb="dnd-kit-announcement",Zb={draggable:"To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item in a given direction. Press space again to drop the item in its new position, or press escape to cancel."},Hb={dragstart({operation:{source:e}}){if(e)return`Picked up draggable item ${e.id}.`},dragover({operation:{source:e,target:t}}){if(e)return t?`Draggable item ${e.id} was moved over droppable target ${t.id}.`:`Draggable item ${e.id} is no longer over a droppable target.`},dragend({operation:{source:e,target:t},canceled:n}){if(e)return n?`Dragging was cancelled. Draggable item ${e.id} was dropped.`:t?`Draggable item ${e.id} was dropped over droppable target ${t.id}`:`Draggable item ${e.id} was dropped.`}};function ev(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLAnchorElement||e instanceof HTMLButtonElement||e instanceof HTMLAreaElement}var Na={};function Rd(e){const t=Na[e]==null?0:Na[e]+1;return Na[e]=t,`${e}-${t}`}function tv(e,t){const n=document.createElement("div");return n.id=e,n.style.setProperty("display","none"),n.innerText=t,n}function nv(e){const t=document.createElement("div");return t.id=e,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.style.setProperty("position","fixed"),t.style.setProperty("width","1px"),t.style.setProperty("height","1px"),t.style.setProperty("margin","-1px"),t.style.setProperty("border","0"),t.style.setProperty("padding","0"),t.style.setProperty("overflow","hidden"),t.style.setProperty("clip","rect(0 0 0 0)"),t.style.setProperty("clip-path","inset(100%)"),t.style.setProperty("white-space","nowrap"),t}var rv=class extends St{constructor(e,t){super(e);const{id:n,idPrefix:{description:s=Xb,announcement:i=Jb}={},announcements:a=Hb,screenReaderInstructions:l=Zb}=t??{},c=n?`${s}-${n}`:Rd(s),u=n?`${i}-${n}`:Rd(i);let d,h;const p=Object.entries(a).map(([y,_])=>this.manager.monitor.addEventListener(y,(k,S)=>{const T=_==null?void 0:_(k,S);T&&h&&(h.innerText=T)})),f=()=>{d=tv(c,l.draggable),h=nv(u),document.body.append(d,h)},m=Hy(()=>{for(const y of e.registry.draggables.value){const{element:_,handle:k}=y,S=k??_;S&&((!d||!h)&&f(),!ev(S)&&!S.hasAttribute("tabindex")&&S.setAttribute("tabindex","0"),!S.hasAttribute("role")&&!(S instanceof HTMLButtonElement)&&S.setAttribute("role",Wd.role),S.hasAttribute("role-description")||S.setAttribute("aria-roledescription",Wd.roleDescription),S.hasAttribute("aria-describedby")||S.setAttribute("aria-describedby",c),S.setAttribute("aria-pressed",String(y.isDragSource)),S.setAttribute("aria-disabled",String(y.disabled)))}this.destroy=()=>{d==null||d.remove(),h==null||h.remove(),p.forEach(y=>y()),m()}})}},sv=class extends St{constructor(e,t){super(e,t),this.manager=e,this.destroy=at(()=>{var n;const{dragOperation:s}=this.manager,{cursor:i="grabbing"}=(n=this.options)!=null?n:{};if(s.status.initialized){const a=document.createElement("style");return a.innerText=`* { cursor: ${i} !important; }`,document.head.appendChild(a),()=>{a.remove()}}})}},Qd="data-dnd-",et="--dnd-",kn=`${Qd}dragging`,iv=`[${kn}] {position: fixed !important; pointer-events: none !important; touch-action: none !important; z-index: calc(infinity); will-change: transform;top: var(${et}top, 0px) !important;left: var(${et}left, 0px) !important;width: var(${et}width, auto) !important;height: var(${et}height, auto) !important;}[${kn}] *{pointer-events: none !important;}[${kn}][style*="${et}translate"] {translate: var(${et}translate) !important;}[style*="${et}transition"] {transition: var(${et}transition) !important;}*:where([${kn}][popover]){overflow:visible;background:var(${et}background);border:var(${et}border);margin:unset;padding:unset;color:inherit;}[${kn}]::backdrop {display: none}`,Ud=`${Qd}placeholder`,av=[kn,Ud,"popover"],ov=["view-transition-name"],lv=class extends St{constructor(e){super(e);let t,n,s={x:0,y:0},i,a,l=!1;const c=at(()=>{if(!t&&e.dragOperation.status.initialized)return t=document.createElement("style"),t.innerText=iv,document.head.prepend(t),c}),u=at(()=>{var d;const{dragOperation:h}=e,{position:p,source:f,status:m}=h;if(m.idle){n=void 0,i=void 0,a=void 0,s={x:0,y:0};return}if(!f)return;const{element:y,feedback:_}=f;if(!y||_==="none")return;const k=new en(y,!0),{width:S,height:T,top:I,left:z}=k,E=new Ed(y),{background:R,border:K,transition:ye,translate:xe}=Cn(y),V=e.registry.droppables.get(f.id),B=_==="clone",O=_!=="move"?Tb(y,B,{[Ud]:""}):null,F=Xn(()=>Ls(e.dragOperation.activatorEvent));if(xe!=="none"){const $=Os(xe);$&&(s=$)}if(n||(n={x:z,y:I}),!a){const $=Xn(()=>p.current);a={x:($.x-z)/S,y:($.y-I)/T}}const Y={x:n.x-z,y:n.y-I},X={top:I+Y.y,left:z+Y.x};y.setAttribute(kn,"true"),E.set({width:S,height:T,top:X.top,left:X.left,background:R,border:K,translate:i?`${i.x}px ${i.y}px 0`:""},et),O&&y.insertAdjacentElement("afterend",O),Va(y)&&(y.hasAttribute("popover")||y.setAttribute("popover",""),Ba(y));const ne=new en(y,!0),H={top:X.top-ne.top,left:X.left-ne.left};H.left>.01||H.top>.01?E.set({top:X.top+H.top,left:X.left+H.left},et):(H.left=0,H.top=0);const he=new ResizeObserver(()=>{if(!O)return;const $=new en(O,!0),te=a??{x:1,y:1},de=(S-$.width)*te.x+Y.x,Ie=(T-$.height)*te.y+Y.y;if(E.set({width:$.width,height:$.height,top:I+Ie+H.top,left:z+de+H.left},et),y instanceof HTMLTableRowElement&&O instanceof HTMLTableRowElement){const ft=Array.from(y.cells),ze=Array.from(O.cells);for(const[Gt,an]of ft.entries()){const Wt=ze[Gt];an.style.width=`${Wt.offsetWidth}px`}}e.dragOperation.shape=new en(y)});V&&O&&(V.placeholder=O,Xn(V.refreshShape)),h.shape=new en(y),f.status="dragging";let ce,ue;O&&(he.observe(O),ce=new MutationObserver(()=>{for(const $ of Array.from(y.attributes))if(!($.name.startsWith("aria-")||av.includes($.name))){if($.name==="style"){if(nr(y)&&nr(O)){O.setAttribute("style",B?"":"opacity: 0;"),O.style.setProperty("transition","none");for(const te of Object.values(y.style))te.startsWith(et)||ov.includes(te)||O.style.setProperty(te,y.style.getPropertyValue(te))}continue}O.setAttribute($.name,$.value)}B&&(O.innerHTML=y.innerHTML)}),ce.observe(y,{attributes:!0,subtree:!0}),ue=new MutationObserver($=>{for(const te of $)if(Array.from(te.addedNodes).includes(y)){y.insertAdjacentElement("afterend",O),Ba(y);return}}),ue.observe(y.ownerDocument.body,{childList:!0,subtree:!0}));const Qe=at(function(){var te,de;const{transform:Ie,status:ft}=h;if(!(!Ie.x&&!Ie.y&&!l)&&(l||(l=!0),ft.dragging)){const ze=F?"250ms ease":"0ms linear",Gt=Ie.x+s.x,an=Ie.y+s.y,Wt=new en(y);E.set({transition:`${ye}, translate ${ze}`,translate:`${Gt}px ${an}px 0`},et),h.shape=Wt.translate(Gt-((te=i==null?void 0:i.x)!=null?te:0),an-((de=i==null?void 0:i.y)!=null?de:0)),i={x:Gt,y:an,z:0,scaleX:Wt.scale.x,scaleY:Wt.scale.y}}}),Fe=(d=e.dragOperation.source)==null?void 0:d.id,sn=()=>{var $;if(!F||Fe==null)return;const te=e.registry.draggables.get(Fe),de=($=te==null?void 0:te.handle)!=null?$:te==null?void 0:te.element;de instanceof HTMLElement&&de.focus()};let be=()=>{ce==null||ce.disconnect(),ue==null||ue.disconnect(),he.disconnect(),E.reset(),l&&y.isConnected&&(O==null||O.replaceWith(y)),O==null||O.remove(),y.removeAttribute(kn),Va(y)&&y.removeAttribute("popover"),Qe(),_e(),V&&(V.placeholder=void 0),f.status="idle",l=!1};const _e=at(function(){if(h.status.dropped){const te=be;be=void 0,f.status="dropping";const de=i;if(!de){te==null||te();return}e.renderer.rendering.then(()=>{var Ie;Ba(y);const ft=O??y;E.remove(["translate"],et);const ze=new en(ft),Gt=new en(y,!0).translate(de.x,de.y),an={x:Gt.center.x-ze.center.x,y:Gt.center.y-ze.center.y},Wt={x:de.x-an.x,y:de.y-an.y,z:0};Ad({element:y,keyframes:{translate:[`${de.x}px ${de.y}px ${(Ie=de.z)!=null?Ie:0}`,`${Wt.x}px ${Wt.y}px ${Wt.z}`]},options:{duration:l?250:0,easing:"ease"},onFinish(){requestAnimationFrame(sn),te==null||te()}})})}});return()=>be==null?void 0:be()});this.destroy=()=>{c(),u(),t==null||t.remove()}}},Fr=!0,cv=!1,Yd,Kd,Xd,Jd,Tn,$a,Fa;Jd=(Xd=[ke],kt.Forward),Kd=(Yd=[ke],kt.Reverse);var Gr=class{constructor(){Tt(this,$a,He(Tn,8,this,Fr)),He(Tn,11,this),Tt(this,Fa,He(Tn,12,this,Fr)),He(Tn,15,this)}isLocked(e){return e===kt.Idle?!1:e==null?this[kt.Forward]===Fr&&this[kt.Reverse]===Fr:this[e]===Fr}unlock(e){e!==kt.Idle&&(this[e]=cv)}};Tn=Bs(null),$a=new WeakMap,Fa=new WeakMap,Sn(Tn,4,Jd,Xd,Gr,$a),Sn(Tn,4,Kd,Yd,Gr,Fa),qs(Tn,Gr);var uv=[kt.Forward,kt.Reverse],Zd=class{constructor(){this.x=new Gr,this.y=new Gr}isLocked(){return this.x.isLocked()&&this.y.isLocked()}},dv=class extends St{constructor(e){super(e);const t=Ds(new Zd);let n=null;this.signal=t,at(()=>{const{status:s}=e.dragOperation;if(!s.initialized){n=null,t.value=new Zd;return}const{delta:i}=e.dragOperation.position;if(n){const a={x:Hd(i.x,n.x),y:Hd(i.y,n.y)},l=t.peek();un(()=>{for(const c of ed)for(const u of uv)a[c]===u&&l[c].unlock(u);t.value=l})}n=i})}get current(){return this.signal.peek()}};function Hd(e,t){return Math.sign(e-t)}var ep,Ga,Wr,Wa,Dn,Ra,Ns=class extends(Ga=vb,ep=[ke],Ga){constructor(e){super(e),Tt(this,Wa,He(Wr,8,this,!1)),He(Wr,11,this),Tt(this,Dn),Tt(this,Ra,()=>{if(!tn(this,Dn))return;const{element:a,by:l}=tn(this,Dn);a.scrollBy(l.x,l.y)}),this.scroll=a=>{var l;if(this.disabled)return!1;const c=this.getScrollableElements();if(!c)return sr(this,Dn,void 0),!1;const{position:u}=this.manager.dragOperation,d=u==null?void 0:u.current;if(d){const{by:h}=a??{},p=h?{x:tp(h.x),y:tp(h.y)}:void 0,f=p?void 0:this.scrollIntentTracker.current;if(f!=null&&f.isLocked())return!1;for(const m of c){const y=Db(m,h);if(y.x||y.y){const{speed:_,direction:k}=Lb(m,d,p);if(f)for(const S of ed)f[S].isLocked(k[S])&&(_[S]=0,k[S]=0);if(k.x||k.y){const{x:S,y:T}=h??k,I=S*_.x,z=T*_.y;if(I||z){const E=(l=tn(this,Dn))==null?void 0:l.by;if(this.autoScrolling&&E&&(E.x&&!I||E.y&&!z))continue;return sr(this,Dn,{element:m,by:{x:I,y:z}}),rr.schedule(tn(this,Ra)),!0}}}}}return sr(this,Dn,void 0),!1};let t=null,n=null;const s=Ms(()=>{var a;const{position:l}=e.dragOperation;if(!l)return null;const{x:c,y:u}=l.current,d=document.elementFromPoint(c,u);return d&&(t=d),(a=document.elementFromPoint(c,u))!=null?a:t}),i=Ms(()=>{const a=s.value;if(!a||a===document.documentElement){const{target:l}=e.dragOperation,c=l==null?void 0:l.element;if(c){const u=Ps(c,{excludeElement:!1});return n=u,u}}if(a){const l=Ps(a,{excludeElement:!1});return this.autoScrolling&&n&&l.size<(n==null?void 0:n.size)?n:(n=l,l)}return n=null,null},ua);this.getScrollableElements=()=>i.value,this.scrollIntentTracker=new dv(e),this.destroy=e.monitor.addEventListener("dragmove",a=>{this.disabled||a.defaultPrevented||!Ls(e.dragOperation.activatorEvent)||!a.by||this.scroll({by:a.by})&&a.preventDefault()})}};Wr=Bs(Ga),Wa=new WeakMap,Dn=new WeakMap,Ra=new WeakMap,Sn(Wr,4,"autoScrolling",ep,Ns,Wa),qs(Wr,Ns);function tp(e){return e>0?kt.Forward:e<0?kt.Reverse:kt.Idle}var pv=10,np=class extends St{constructor(e,t){super(e);const n=e.registry.plugins.get(Ns);if(!n)throw new Error("AutoScroller plugin depends on Scroller plugin");this.destroy=at(()=>{if(this.disabled)return;const{position:s,status:i}=e.dragOperation;if(i.dragging)if(n.scroll()){n.autoScrolling=!0;const l=setInterval(n.scroll,pv);return()=>{clearInterval(l)}}else n.autoScrolling=!1})}},hv=class extends St{constructor(e){super(e),this.manager=e,this.destroy=at(()=>{const{dragOperation:t}=this.manager;if(t.status.initialized){const n=document.createElement("style");return n.innerText="* { user-select: none !important;, -webkit-user-select: none !important; }",document.head.appendChild(n),document.addEventListener("selectionchange",rp,{capture:!0}),()=>{document.removeEventListener("selectionchange",rp,{capture:!0}),n.remove()}}})}};function rp(){var e;(e=document.getSelection())==null||e.removeAllRanges()}var sp={start:["Space","Enter"],cancel:["Escape"],end:["Space","Enter"],up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]},$s=10,Rr,fv=class extends As{constructor(e,t){super(e),this.manager=e,this.options=t,Tt(this,Rr,[]),this.listeners=new Dd,this.handleSourceKeyDown=(n,s,i)=>{if(this.disabled||n.defaultPrevented||!(n.target instanceof Element)||s.disabled||!s.element)return;const{keyboardCodes:a=sp}=i??{};a.start.includes(n.code)&&this.manager.dragOperation.status.idle&&this.handleStart(n,s,i)}}bind(e,t=this.options){return at(()=>{var s;const i=(s=e.handle)!=null?s:e.element,a=l=>{l instanceof KeyboardEvent&&this.handleSourceKeyDown(l,e,t)};if(i)return i.addEventListener("keydown",a),()=>{i.removeEventListener("keydown",a)}})}handleStart(e,t,n){const{element:s}=t;if(!s)throw new Error("Source draggable does not have an associated element");e.preventDefault(),e.stopImmediatePropagation(),zd(s);const{center:i}=new en(s);un(()=>{this.manager.actions.setDragSource(t.id),this.manager.actions.start({event:e,coordinates:{x:i.x,y:i.y}})}),this.sideEffects();const a=qr(s),l=tr(a),c=[this.listeners.bind(a,[{type:"keydown",listener:u=>this.handleKeyDown(u,t,n),options:{capture:!0}}]),this.listeners.bind(l,[{type:"resize",listener:()=>this.handleEnd(!0)}])];tn(this,Rr).push(...c)}handleKeyDown(e,t,n){const{keyboardCodes:s=sp}=n??{};if(ir(e,[...s.end,...s.cancel])){e.preventDefault();const i=ir(e,s.cancel);this.handleEnd(i);return}ir(e,s.up)?this.handleMove("up",e):ir(e,s.down)&&this.handleMove("down",e),ir(e,s.left)?this.handleMove("left",e):ir(e,s.right)&&this.handleMove("right",e)}handleEnd(e){this.manager.actions.stop({canceled:e}),this.cleanup()}handleMove(e,t){const{shape:n}=this.manager.dragOperation,s=t.shiftKey?5:1;let i={x:0,y:0};if(n){switch(e){case"up":i={x:0,y:-$s*s};break;case"down":i={x:0,y:$s*s};break;case"left":i={x:-$s*s,y:0};break;case"right":i={x:$s*s,y:0};break}(i!=null&&i.x||i!=null&&i.y)&&(t.preventDefault(),this.manager.actions.move({by:i}))}}sideEffects(){const e=this.manager.registry.plugins.get(np);(e==null?void 0:e.disabled)===!1&&(e.disable(),tn(this,Rr).push(()=>{e.enable()}))}cleanup(){tn(this,Rr).forEach(e=>e())}destroy(){this.cleanup(),this.listeners.clear()}};Rr=new WeakMap;function ir(e,t){return t.includes(e.code)}var ar,Qa=class extends As{constructor(t,n){super(t),this.manager=t,this.options=n,this.listeners=new Dd,this.cleanup=new Set,Tt(this,ar),this.handleCancel=this.handleCancel.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}bind(t,n=this.options){return at(()=>{var i;const a=(i=t.handle)!=null?i:t.element,l=c=>{c instanceof PointerEvent&&this.handlePointerDown(c,t,n)};if(a)return xv(a.ownerDocument.defaultView),a.addEventListener("pointerdown",l),()=>{a.removeEventListener("pointerdown",l)}})}handlePointerDown(t,n,s={}){if(this.disabled||!t.isPrimary||t.button!==0||!(t.target instanceof Element)||n.disabled)return;const{target:i}=t,a=i instanceof HTMLElement&&i.draggable&&i.getAttribute("draggable")==="true";this.initialCoordinates={x:t.clientX,y:t.clientY};const{activationConstraints:l}=s,c=typeof l=="function"?l(t,n):l;if(t.stopImmediatePropagation(),!(c!=null&&c.delay)&&!(c!=null&&c.distance))this.handleStart(n,t);else{const{delay:p}=c;if(p){const f=setTimeout(()=>this.handleStart(n,t),p.value);sr(this,ar,()=>{clearTimeout(f),sr(this,ar,void 0)})}}const u=qr(t.target),d=this.listeners.bind(u,[{type:"pointermove",listener:p=>this.handlePointerMove(p,n,s)},{type:"pointerup",listener:this.handlePointerUp,options:{capture:!0}},{type:"touchmove",listener:Ua,options:{passive:!1}},{type:"click",listener:Ua},{type:"dragstart",listener:a?this.handleCancel:Ua},{type:"keydown",listener:this.handleKeyDown}]),h=()=>{var p;setTimeout(d),(p=tn(this,ar))==null||p.call(this),this.initialCoordinates=void 0,this.cleanup.delete(h)};this.cleanup.add(h)}handlePointerMove(t,n,s){const i={x:t.clientX,y:t.clientY};if(this.manager.dragOperation.status.dragging){t.preventDefault(),t.stopPropagation(),this.manager.actions.move({to:i});return}if(!this.initialCoordinates)return;const a={x:i.x-this.initialCoordinates.x,y:i.y-this.initialCoordinates.y},{activationConstraints:l}=s,c=typeof l=="function"?l(t,n):l,{distance:u,delay:d}=c??{};if(u){if(u.tolerance!=null&&ya(a,u.tolerance))return this.handleCancel();if(ya(a,u.value))return this.handleStart(n,t)}if(d&&ya(a,d.tolerance))return this.handleCancel()}handlePointerUp(t){t.preventDefault(),t.stopPropagation();const{status:n}=this.manager.dragOperation;if(!n.idle){const s=!n.initialized;this.manager.actions.stop({canceled:s})}this.cleanup.forEach(s=>s())}handleKeyDown(t){t.key==="Escape"&&(t.preventDefault(),this.handleCancel())}handleStart(t,n){var s;const{manager:i,initialCoordinates:a}=this;(s=tn(this,ar))==null||s.call(this),!(!a||i.dragOperation.status.initialized)&&(n.defaultPrevented||(n.preventDefault(),un(()=>{i.actions.setDragSource(t.id),i.actions.start({coordinates:a,event:n})})))}handleCancel(){const{dragOperation:t}=this.manager;t.status.initialized&&this.manager.actions.stop({canceled:!0}),this.cleanup.forEach(n=>n())}destroy(){this.listeners.clear()}};ar=new WeakMap,Qa.configure=bb(Qa);var gv=Qa;function Ua(e){e.preventDefault()}function mv(){}var ip=new WeakSet;function xv(e){!e||ip.has(e)||(e.addEventListener("touchmove",mv,{capture:!1,passive:!1}),ip.add(e))}gv.configure({activationConstraints(e,t){var n;const{pointerType:s,target:i}=e;if(!(s==="mouse"&&i instanceof Element&&(t.handle===i||(n=t.handle)!=null&&n.contains(i))))return{delay:{value:200,tolerance:10},distance:{value:5}}}});var ap,op,lp,Ya,Vt,Ka,Xa,Ja,Qr=class extends(Ya=Br,lp=[ke],op=[ke],ap=[ke],Ya){constructor(e,t){var n=e,{element:s,effects:i=()=>[],handle:a,feedback:l="default"}=n,c=$d(n,["element","effects","handle","feedback"]);super(Nd({effects:()=>[...i(),()=>{var u,d;const{manager:h}=this;if(!h)return;const f=((d=(u=this.sensors)==null?void 0:u.map(od))!=null?d:[...h.sensors]).map(m=>{const y=m instanceof As?m:h.registry.register(m.plugin),_=m instanceof As?void 0:m.options;return y.bind(this,_)});return function(){f.forEach(y=>y())}}]},c),t),Tt(this,Ka,He(Vt,8,this)),He(Vt,11,this),Tt(this,Xa,He(Vt,12,this)),He(Vt,15,this),Tt(this,Ja,He(Vt,16,this)),He(Vt,19,this),this.element=s,this.handle=a,this.feedback=l}};Vt=Bs(Ya),Ka=new WeakMap,Xa=new WeakMap,Ja=new WeakMap,Sn(Vt,4,"handle",lp,Qr,Ka),Sn(Vt,4,"element",op,Qr,Xa),Sn(Vt,4,"feedback",ap,Qr,Ja),qs(Vt,Qr);var cp,up,Za,Mn,Ha,eo,Fs=class extends(Za=wn,up=[ke],cp=[ke],Za){constructor(e,t){var n=e,{element:s,effects:i=()=>[]}=n,a=$d(n,["element","effects"]),l;const{collisionDetector:c=jd}=a;super(Yb(Nd({},a),{collisionDetector:c,effects:()=>[...i(),()=>{const{element:u,manager:d}=this;if(!d)return;const{dragOperation:h}=d;if(u&&h.status.initialized){const p=Ab(u),f=qr(u),m=p===f.scrollingElement?f:p,y=new IntersectionObserver(S=>{const[T]=S.slice(-1),{width:I,height:z}=T.boundingClientRect;!I&&!z||(this.visible=T.isIntersecting)},{root:m??f,rootMargin:"40%"}),_=new MutationObserver(()=>rr.schedule(this.refreshShape)),k=new ResizeObserver(()=>rr.schedule(this.refreshShape));return u.parentElement&&_.observe(u.parentElement,{childList:!0}),k.observe(u),y.observe(u),()=>{this.shape=void 0,this.visible=void 0,k.disconnect(),_.disconnect(),y.disconnect()}}},()=>{const{manager:u}=this;if(!u)return;const{dragOperation:d}=u,{status:h}=d,p=Xn(()=>d.source);if(h.initialized){if((p==null?void 0:p.type)!=null&&!this.accepts(p))return;rr.schedule(this.refreshShape)}},()=>{var u;if((u=this.manager)!=null&&u.dragOperation.status.initialized)return()=>{this.shape=void 0}}]}),t),Tt(this,Ha,He(Mn,8,this)),He(Mn,11,this),Tt(this,eo,He(Mn,12,this)),He(Mn,15,this),this.internal={element:Ds(s)},this.refreshShape=this.refreshShape.bind(this),(l=this.manager)!=null&&l.dragOperation.status.initialized&&(this.visible=!0)}set element(e){this.internal.element.value=e}get element(){var e,t;return(t=this.placeholder)!=null?t:(e=this.internal)==null?void 0:e.element.value}refreshShape(e){const{element:t,shape:n}=this;if(!t||this.visible===!1){this.shape=void 0;return}const s=new en(t,e);return s&&(n!=null&&n.equals(s))?n:(this.shape=s,s)}};Mn=Bs(Za),Ha=new WeakMap,eo=new WeakMap,Sn(Mn,4,"visible",up,Fs,Ha),Sn(Mn,4,"placeholder",cp,Fs,eo),qs(Mn,Fs);var yv=Object.create,dp=Object.defineProperty,bv=Object.defineProperties,vv=Object.getOwnPropertyDescriptor,_v=Object.getOwnPropertyDescriptors,Gs=Object.getOwnPropertySymbols,pp=Object.prototype.hasOwnProperty,hp=Object.prototype.propertyIsEnumerable,jv=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Ur=e=>{throw TypeError(e)},to=(e,t,n)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wv=(e,t)=>{for(var n in t||(t={}))pp.call(t,n)&&to(e,n,t[n]);if(Gs)for(var n of Gs(t))hp.call(t,n)&&to(e,n,t[n]);return e},Cv=(e,t)=>bv(e,_v(t)),Sv=(e,t)=>{var n={};for(var s in e)pp.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Gs)for(var s of Gs(e))t.indexOf(s)<0&&hp.call(e,s)&&(n[s]=e[s]);return n},kv=e=>{var t;return[,,,yv((t=void 0)!=null?t:null)]},fp=["class","method","getter","setter","accessor","field","value","get","set"],Yr=e=>e!==void 0&&typeof e!="function"?Ur("Function expected"):e,Tv=(e,t,n,s,i)=>({kind:fp[e],name:t,metadata:s,addInitializer:a=>n._?Ur("Already initialized"):i.push(Yr(a||null))}),Dv=(e,t)=>to(t,jv("metadata"),e[3]),Ws=(e,t,n,s)=>{for(var i=0,a=e[t>>1],l=a&&a.length;i<l;i++)t&1?a[i].call(n):s=a[i].call(n,s);return s},gp=(e,t,n,s,i,a)=>{for(var l,c,u,d,h,p=t&7,f=!!(t&8),m=!!(t&16),y=e.length+1,_=fp[p+5],k=e[y-1]=[],S=e[y]||(e[y]=[]),T=(i=i.prototype,vv({get[n](){return Mv(this,a)},set[n](z){return Iv(this,a,z)}},n)),I=s.length-1;I>=0;I--)d=Tv(p,n,u={},e[3],S),d.static=f,d.private=m,h=d.access={has:z=>n in z},h.get=z=>z[n],h.set=(z,E)=>z[n]=E,c=(0,s[I])({get:T.get,set:T.set},d),u._=1,c===void 0?Yr(c)&&(T[_]=c):typeof c!="object"||c===null?Ur("Object expected"):(Yr(l=c.get)&&(T.get=l),Yr(l=c.set)&&(T.set=l),Yr(l=c.init)&&k.unshift(l));return T&&dp(i,n,T),i},mp=(e,t,n)=>t.has(e)||Ur("Cannot "+n),Mv=(e,t,n)=>(mp(e,t,"read from private field"),t.get(e)),xp=(e,t,n)=>t.has(e)?Ur("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Iv=(e,t,n,s)=>(mp(e,t,"write to private field"),t.set(e,n),n);function or(e){return e instanceof so||e instanceof jp}var Rs=10,zv=class extends St{constructor(e){super(e);const t=at(()=>{const{dragOperation:s}=e;if(Ls(s.activatorEvent)&&or(s.source)&&s.status.initialized){const i=e.registry.plugins.get(Ns);if(i)return i.disable(),()=>i.enable()}}),n=e.monitor.addEventListener("dragmove",(s,i)=>{queueMicrotask(()=>{if(this.disabled||s.defaultPrevented)return;const{dragOperation:a}=i;if(!Ls(a.activatorEvent)||!or(a.source)||!a.shape)return;const{actions:l,collisionObserver:c,registry:u}=i,{by:d}=s;if(!d)return;const h=Ev(d),{source:p}=a,{center:f}=a.shape.current,m=[];for(const S of u.droppables){const{shape:T,id:I}=S;if(!(!T||I===(p==null?void 0:p.id)&&or(S)||(p==null?void 0:p.type)!=null&&!S.accepts(p)))switch(h){case"down":f.y+Rs<T.center.y&&m.push(S);break;case"up":f.y-Rs>T.center.y&&m.push(S);break;case"left":f.x-Rs>T.center.x&&m.push(S);break;case"right":f.x+Rs<T.center.x&&m.push(S);break}}s.preventDefault(),c.disable();const y=c.computeCollisions(m,wb),[_]=y;if(!_)return;const{id:k}=_;l.setDropTarget(k).then(()=>{const{source:S}=a;if(!S)return;const T=u.droppables.get(S.id);if(!(T!=null&&T.element))return;const{element:I}=T;zd(I),rr.schedule(()=>{const z=T.refreshShape();z&&(l.move({to:{x:z.center.x,y:z.center.y}}),l.setDropTarget(S.id).then(()=>{a.shape=z,c.enable()}))})})})});this.destroy=()=>{n(),t()}}};function Ev(e){const{x:t,y:n}=e;if(t>0)return"right";if(t<0)return"left";if(n>0)return"down";if(n<0)return"up"}function Av(e,t,n){if(t===n)return e;const s=e.slice();return s.splice(n,0,s.splice(t,1)[0]),s}var Pv=class extends St{constructor(e){super(e);const t=s=>{var i;const a=new Map;for(const l of e.registry.droppables)if(l instanceof so){const{sortable:c}=l;if(c.group!==s)continue;if(a.has(c.index))throw new Error(`Duplicate sortable index found for same sortable group: ${c.droppable.id} and ${(i=a.get(c.index))==null?void 0:i.droppable.id} have the same index (${c.index}). Make sure each sortable item has a unique index. Use the \`group\` attribute to separate sortables into different groups.`);a.set(c.index,c)}return a},n=[e.monitor.addEventListener("dragover",(s,i)=>{queueMicrotask(()=>{if(this.disabled||s.defaultPrevented)return;const{dragOperation:a}=i,{source:l,target:c}=a;if(!or(l)||!or(c)||l.sortable===c.sortable||l.sortable.group!==c.sortable.group)return;const u=t(l.sortable.group);i.renderer.rendering.then(()=>{var d;for(const[k,S]of u.entries())if(S.index!==k)return;const h=Array.from(u.values()).sort((k,S)=>k.index-S.index),p=h.indexOf(l.sortable),f=h.indexOf(c.sortable),m=Av(h,p,f),y=(d=l.sortable.droppable.internal.element.peek())!=null?d:l.sortable.droppable.placeholder,_=c.element;!_||!y||(yp(y,p,_,f),un(()=>{for(const[k,S]of m.entries())S.index=k}))})})}),e.monitor.addEventListener("dragend",(s,i)=>{if(!s.canceled)return;const{dragOperation:a}=i,{source:l}=a;or(l)&&l.sortable.initialIndex!==l.sortable.index&&queueMicrotask(()=>{const c=t(l.sortable.group);i.renderer.rendering.then(()=>{var u;for(const[f,m]of c.entries())if(m.index!==f)return;const d=Array.from(c.values()).sort((f,m)=>f.index-m.index),h=l.sortable.droppable.element,p=(u=d[l.sortable.initialIndex])==null?void 0:u.element;!p||!h||(yp(h,l.sortable.index,p,l.sortable.initialIndex),un(()=>{for(const f of d.values())f.index=f.initialIndex}))})})})];this.destroy=()=>{for(const s of n)s()}}};function yp(e,t,n,s){const i=s<t?"beforebegin":"afterend";n.insertAdjacentElement(i,e)}var Ov=[zv,Pv],bp={duration:250,easing:"cubic-bezier(0.25, 1, 0.5, 1)",idle:!1},vp,_p,In,no,ro;_p=[ke],vp=[ke];var Qs=class{constructor(e,t){xp(this,no,Ws(In,8,this)),Ws(In,11,this),xp(this,ro,Ws(In,12,this)),Ws(In,15,this);var n=e,{effects:s=()=>[],group:i,index:a,sensors:l,type:c,transition:u=bp,plugins:d=Ov}=n,h=Sv(n,["effects","group","index","sensors","type","transition","plugins"]);this.droppable=new so(h,t,this),this.draggable=new jp(Cv(wv({},h),{effects:()=>[()=>{var p;return(p=this.manager)==null?void 0:p.monitor.addEventListener("dragstart",()=>{this.initialIndex=this.index,this.previousIndex=this.index})},()=>{const{index:p,previousIndex:f,manager:m}=this;p!==f&&(this.previousIndex=p,this.animate())},()=>{const{target:p}=this,{feedback:f,isDragSource:m}=this.draggable;f=="move"&&m&&(this.droppable.disabled=!p)},()=>{const{manager:p}=this;for(const f of d)p==null||p.registry.register(f)},...s()],type:c,sensors:l}),t,this),this.manager=t,this.index=a,this.previousIndex=a,this.initialIndex=a,this.group=i,this.type=c,this.transition=u,this.destroy=()=>{this.draggable.destroy(),this.droppable.destroy()}}animate(){Xn(()=>{const{manager:e,transition:t}=this,{shape:n}=this.droppable;if(!e)return;const{idle:s}=e.dragOperation.status;!n||!t||s&&!t.idle||rr.schedule(()=>{const{element:i}=this.droppable;if(!i)return;const a=this.refreshShape();if(!a)return;const l={x:n.boundingRectangle.left-a.boundingRectangle.left,y:n.boundingRectangle.top-a.boundingRectangle.top},{x:c,y:u,z:d}=Nb(i);(l.x||l.y)&&Ad({element:i,keyframes:{translate:[`${c+l.x}px ${u+l.y}px ${d}`,`${c}px ${u}px ${d}`]},options:t,onFinish:()=>{s&&(this.droppable.shape=void 0)}})})})}get manager(){return this.draggable.manager}set manager(e){this.draggable.manager=e,this.droppable.manager=e}set element(e){this.draggable.element=e,this.droppable.element=e}get element(){var e;return(e=this.droppable.element)!=null?e:this.draggable.element}set target(e){this.droppable.element=e}get target(){return this.droppable.element}set source(e){this.draggable.element=e}get source(){return this.draggable.element}get disabled(){return this.draggable.disabled&&this.droppable.disabled}set feedback(e){this.draggable.feedback=e}set disabled(e){un(()=>{this.draggable.disabled=e,this.droppable.disabled=e})}set data(e){un(()=>{this.draggable.data=e,this.droppable.data=e})}set handle(e){this.draggable.handle=e}set id(e){un(()=>{this.draggable.id=e,this.droppable.id=e})}get id(){return this.droppable.id}set sensors(e){this.draggable.sensors=e}set collisionPriority(e){this.droppable.collisionPriority=e??Lr.Normal}set collisionDetector(e){this.droppable.collisionDetector=e??jd}set type(e){this.draggable.type=e,this.droppable.type=e}get type(){return this.draggable.type}set accept(e){this.droppable.accept=e}get accept(){return this.droppable.accept}get isDropTarget(){return this.droppable.isDropTarget}get isDragSource(){return this.draggable.isDragSource}get status(){return this.draggable.status}refreshShape(e=!1){return this.droppable.refreshShape(e)}accepts(e){return this.droppable.accepts(e)}register(){var e,t;return(e=this.manager)==null||e.registry.register(this.draggable),(t=this.manager)==null||t.registry.register(this.droppable),()=>this.unregister()}unregister(){var e,t;(e=this.manager)==null||e.registry.unregister(this.draggable),(t=this.manager)==null||t.registry.unregister(this.droppable)}destroy(){this.draggable.destroy(),this.droppable.destroy()}};In=kv(),no=new WeakMap,ro=new WeakMap,gp(In,4,"index",_p,Qs,no),gp(In,4,"group",vp,Qs,ro),Dv(In,Qs);var jp=class extends Qr{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}},so=class extends Fs{constructor(e,t,n){super(e,t),this.sortable=n}refreshShape(e=!1){return super.refreshShape(e)}get index(){return this.sortable.index}};function wp(e){const t=g.useRef();return t.current||(t.current=e()),t.current}var Lv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Cp=Lv?g.useLayoutEffect:g.useEffect;function Vv(e,t=!1){const n=wp(()=>e instanceof Ze?e:Ds(e));let s=n.peek();const i=g.useState(s)[1];return Cp(()=>at(()=>{s!==(s=n.value)&&(t?Kg.flushSync(()=>i(s)):i(s))}),[t]),n}function io(e,t=!1){return Vv(wp(()=>Ms(e)),t)}function Bv(e,t){e()}function tt(e,t,n=g.useEffect,s=Object.is){const i=g.useRef(e);n(()=>{const a=i.current;s(e,a)||(i.current=e,t(e,a))},[t,e])}function ao(e){var t;if(e!=null)return typeof e=="object"&&"current"in e?(t=e.current)!=null?t:void 0:e}var qv=Object.defineProperty,Nv=Object.defineProperties,$v=Object.getOwnPropertyDescriptors,Sp=Object.getOwnPropertySymbols,Fv=Object.prototype.hasOwnProperty,Gv=Object.prototype.propertyIsEnumerable,kp=(e,t,n)=>t in e?qv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wv=(e,t)=>{for(var n in t||(t={}))Fv.call(t,n)&&kp(e,n,t[n]);if(Sp)for(var n of Sp(t))Gv.call(t,n)&&kp(e,n,t[n]);return e},Rv=(e,t)=>Nv(e,$v(t));function Tp(e){const{accept:t,collisionDetector:n,collisionPriority:s,id:i,data:a,index:l,group:c,disabled:u,feedback:d,sensors:h,transition:p=bp,type:f}=e,m=is.useDragDropManager(),y=ao(e.handle),_=ao(e.element),k=ao(e.target),S=is.useInstance(E=>new Qs(Rv(Wv({},e),{handle:y,element:_,target:k,feedback:d}),E)),T=io(()=>S.isDropTarget),I=io(()=>S.isDragSource),z=io(()=>S.status);return tt(i,()=>S.id=i),tt(l,()=>S.index=l,Cp),tt(f,()=>S.type=f),tt(c,()=>S.group=c),tt(t,()=>S.accept=t,void 0,ua),tt(a,()=>a&&(S.data=a)),tt(l,()=>{m!=null&&m.dragOperation.status.idle&&p&&S.refreshShape()},Bv),tt(y,()=>S.handle=y),tt(_,()=>S.element=_),tt(k,()=>S.target=k),tt(u,()=>S.disabled=u===!0),tt(h,()=>S.sensors=h),tt(n,()=>S.collisionDetector=n),tt(s,()=>S.collisionPriority=s),tt(d,()=>S.feedback=d??"default"),tt(p,()=>S.transition=p),{get isDragSource(){return I.value},get isDropTarget(){return T.value},get status(){return z.value},handleRef:g.useCallback(E=>{S.handle=E??void 0},[S]),ref:g.useCallback(E=>{S.element=E??void 0},[S]),sourceRef:g.useCallback(E=>{S.source=E??void 0},[S]),targetRef:g.useCallback(E=>{S.target=E??void 0},[S])}}const Qv=({value:e,onChange:t})=>{const n=s=>{s&&t(s)};return r.jsx(o.Box,{children:r.jsx(gt,{height:"500px",defaultLanguage:"javascript",value:e,onChange:n,theme:"vs-dark",options:{minimap:{enabled:!1}}})})},Dp={static:{type:"static",value:10},dynamic:{type:"dynamic",value:["function getValue({ variables }, { lodash, interpolate }) {"," // your code goes here"," return 100;","}"].join(`
70
- `)}},Uv=({value:e,onChange:t})=>{const{t:n}=j.useTranslation(),[s,{setTrue:i,setFalse:a}]=J.useBoolean(),[l,c]=g.useState(e),u=()=>{a();const{type:f,value:m}=l,y={type:f,value:m};c(y),t(y)},d=()=>{a(),c(e)},h=f=>{c(m=>({...m,value:f}))},p=()=>{h(Dp.dynamic.value)};return r.jsxs(r.Fragment,{children:[r.jsx(o.Box,{sx:{width:"50%"},children:r.jsx(o.Button,{color:"grape",variant:"filled",leftIcon:r.jsx(M.IconMathFunction,{size:16}),mt:24,onClick:i,sx:{flexGrow:0},children:n("chart.number_or_dynamic_value.dynamic.setup")})}),r.jsx(o.Modal,{size:800,title:n("chart.number_or_dynamic_value.dynamic.setup_title"),opened:s,onClose:a,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:s&&r.jsxs(o.Stack,{children:[r.jsx(o.Divider,{mt:10,mb:-10,label:n("chart.number_or_dynamic_value.dynamic.guide"),labelPosition:"center",variant:"dashed"}),r.jsx(Qv,{value:l.value,onChange:h}),r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Button,{onClick:p,color:"red",leftIcon:r.jsx(W.Recycle,{size:20}),children:n("common.actions.reset_to_default")}),r.jsxs(o.Group,{position:"right",children:[r.jsx(o.Button,{onClick:d,variant:"subtle",children:n("common.actions.cancel")}),r.jsx(o.Button,{color:"green",leftIcon:r.jsx(M.IconDeviceFloppy,{size:16}),onClick:u,children:n("common.actions.save")})]})]})]})})]})},Yv=({value:e,onChange:t})=>e.type!=="dynamic"?null:r.jsx(Uv,{value:e,onChange:t}),Kv=({value:e,onChange:t})=>{if(e.type!=="static")return null;const n=s=>{t({...e,value:s})};return r.jsx(o.NumberInput,{defaultValue:18,label:" ",hideControls:!0,value:e.value,onChange:n})},Mp=g.forwardRef(({label:e="Value",value:t,onChange:n},s)=>{const{t:i,i18n:a}=j.useTranslation(),l=u=>{n({...Dp[u]})},c=g.useMemo(()=>[{label:i("chart.number_or_dynamic_value.type.static"),value:"static"},{label:i("chart.number_or_dynamic_value.type.dynamic"),value:"dynamic"}],[a.language]);return r.jsxs(o.SimpleGrid,{cols:2,children:[r.jsx(o.Select,{ref:s,label:e,data:c,value:t.type,onChange:l,sx:{flexGrow:1}}),r.jsx(Kv,{value:t,onChange:n}),r.jsx(Yv,{value:t,onChange:n})]})});function Ip(e,t,n){if(!e.type)return n;if(e.type==="static"){const{value:i}=e;return Number(i)}const{value:s}=e;try{const i=new Function(`return ${s}`)()({variables:t},{lodash:v,interpolate:xn.interpolate});return Number(i)}catch(i){return console.error(`[getNumberOrDynamicValue] failed parsing custom function, error: ${i.message}`),10}}function zp(e){return{type:"continuous",id:"continuous-example",min:{type:"static",value:0},max:{type:"static",value:100},orient:"horizontal",left:"center",top:"top",text:["",""],calculable:!0,itemWidth:15,itemHeight:140,show:!0,inRange:{color:e??Object.values(cn.graphics.depth)},skipRange:{lt_min:"",min:"",max:"",gt_max:""}}}function Xv(){return{type:"piecewise",piecewise_mode:"pieces",id:"piecewise-visualmap",min:{type:"static",value:0},max:{type:"static",value:100},align:"auto",orient:"horizontal",left:"center",top:"top",itemWidth:15,itemHeight:15,show:!0,precision:0,pieces:[Ep()],categories:[]}}function pn(){return zp()}function Jv(){return{compared:Object.values(cn.graphics.compared),level:Object.values(cn.graphics.level),depth:Object.values(cn.graphics.depth),yellow_blue:["#8f531d","#ffd347","#e3efe3","#eefaee","#4ecbbf","#003f94"],blue:["#f9fcff","#48b3e9","#003f94"],darkgreen_pink:["#0c525a","#f21f99"],spectrum:["#ff0000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000"]}}function Us(e,t){const{min:n,max:s}=e,i=Ip(n,t),a=Ip(s,t);if(e.type==="continuous"){const{skipRange:p,text:f,...m}=e;return{...m,min:i,max:a,text:[...f]}}const{piecewise_mode:l,pieces:c,categories:u,...d}=e,h={...d};return delete h.min,delete h.max,l==="pieces"?h.pieces=c.map(p=>{const f={};p.label&&(f.label=p.label),p.color&&(f.color=p.color);const m=Number(p.lower.value);p.lower.value===""?f[p.lower.symbol]=i:Number.isFinite(m)&&(f[p.lower.symbol]=m);const y=Number(p.upper.value);return p.upper.value===""?f[p.upper.symbol]=a:Number.isFinite(y)&&(f[p.upper.symbol]=y),f}):l==="categories"&&(h.categories=u),h}const lr=e=>({followVisualMap:!e,color:e});function oo(e,t,n,s){if(s.type!=="continuous")return lr("");const{skipRange:i}=s;return e===t?lr(i.min):e===n?lr(i.max):e<t?lr(i.lt_min):e>n?lr(i.gt_max):lr("")}function Ep(){return{lower:{value:"0",symbol:"gt"},upper:{value:"",symbol:"lt"},label:"",color:""}}const Zv=Jv(),Hv=({colors:e,applyPalette:t,zIndex:n=340})=>{const{t:s}=j.useTranslation(),i=`linear-gradient(to right, ${e.join(", ")})`;return r.jsxs(o.Menu,{shadow:"md",width:300,withinPortal:!0,zIndex:n,children:[r.jsx(o.Menu.Target,{children:r.jsxs(o.UnstyledButton,{children:[r.jsx(o.Text,{style:{display:"inline-block",fontSize:"0.875rem",fontWeight:500,color:"#212529",wordBreak:"break-word",cursor:"default"},children:s("chart.color.color_gradient")}),r.jsxs(o.Group,{style:{padding:"0.4375rem 0.625rem",border:"0.0625rem solid #ced4da",borderRadius:"0.25rem",columnGap:10},children:[r.jsx(o.Box,{style:{height:"20px",flexGrow:1,backgroundImage:i,borderRadius:4}}),r.jsx(M.IconSelector,{size:14,color:"rgb(134, 142, 150)"})]})]})}),r.jsxs(o.Menu.Dropdown,{children:[r.jsx(o.Menu.Label,{children:s("chart.visual_map.built_in_palettes")}),r.jsx(o.Menu.Divider,{}),Object.entries(Zv).map(([a,l])=>r.jsx(o.Tooltip,{label:s("chart.visual_map.use_palette_x",{x:a}),children:r.jsx(o.Menu.Item,{children:r.jsx(o.Box,{style:{height:"20px",width:"100%",backgroundImage:`linear-gradient(to right, ${l.join(", ")})`,borderRadius:4,boxShadow:"0 0 3px 0 #eee",cursor:"pointer"},onClick:()=>{t(l)},title:a})})},a))]})]})},e_=({color:e,index:t,handleChange:n,handleRemove:s})=>{const[i,{setTrue:a,setFalse:l}]=J.useBoolean(!1),{ref:c,handleRef:u}=Tp({id:e.id,index:t});return r.jsxs(o.Flex,{ref:c,gap:"sm",justify:"flex-start",align:"center",direction:"row",wrap:"nowrap",onMouseEnter:a,onMouseLeave:l,children:[r.jsx(o.Center,{style:{minWidth:"30px",maxWidth:"30px",flex:0},children:i?r.jsx(o.ActionIcon,{size:"xs",ref:u,children:r.jsx(M.IconGripVertical,{})}):r.jsx(o.Badge,{size:"sm",children:t+1})}),r.jsx("div",{style:{flex:1},children:r.jsx(o.ColorInput,{styles:{root:{flexGrow:1}},withinPortal:!0,dropdownZIndex:340,size:"xs",value:e.value,onChange:n})}),r.jsx("div",{style:{minWidth:"40px",maxWidth:"40px",flex:0},children:r.jsx(o.CloseButton,{onClick:s})})]})},Ap=g.forwardRef(({value:e,onChange:t,zIndex:n=340},s)=>{const{t:i}=j.useTranslation(),a=g.useMemo(()=>e.map(y=>({id:on.v4(),value:y})),[e]),l=y=>{t([...e,y])},c=y=>{const _=[...e];_.splice(y,1),t(_)},u=y=>{t([...y])},d=y=>_=>{const k=[...e];k[y]=_,t(k)},[h,p]=g.useState(""),f=()=>{h&&(l(h),p(""))},m=y=>{const{source:_,target:k}=y.operation,S=Yg.move(a,_,k);t(S.map(T=>T.value))};return r.jsxs(o.Stack,{ref:s,children:[r.jsx(Hv,{colors:e,applyPalette:u,zIndex:n}),r.jsx(is.DragDropProvider,{onDragEnd:m,children:a.map((y,_)=>r.jsx(e_,{color:y,handleChange:d(_),handleRemove:()=>c(_),index:_},y.id))}),r.jsxs(o.Flex,{gap:"sm",justify:"flex-start",align:"center",direction:"row",wrap:"nowrap",children:[r.jsx("div",{style:{minWidth:"30px",maxWidth:"30px",flex:0}}),r.jsx("div",{style:{flex:1},children:r.jsx(o.ColorInput,{withinPortal:!0,dropdownZIndex:n,placeholder:i("chart.color.click_to_add_a_color"),value:h,onChange:p,onBlur:f,size:"xs"})}),r.jsx("div",{style:{minWidth:"40px",maxWidth:"40px",flex:0}})]})]})}),t_=({defaultValues:e,onSubmit:t,unset:n,cancel:s})=>{const{t:i}=j.useTranslation(),a=b.useForm({defaultValues:e}),{control:l,handleSubmit:c,watch:u,getValues:d,reset:h}=a;g.useEffect(()=>{h(e)},[e]);const p=g.useCallback(()=>h(e),[h,e]);return r.jsxs(o.Box,{children:[r.jsx(o.Divider,{color:"rgb(206, 212, 218)",variant:"dotted",my:"1rem"}),r.jsxs(o.Box,{px:"1rem",children:[r.jsx(b.Controller,{control:l,name:"variable",render:({field:f})=>r.jsx(oa,{label:i("rich_text.color_mapping.choose_value_var"),clearable:!1,preview:"aggregated",zIndex:340,...f})}),r.jsxs(o.Group,{grow:!0,position:"apart",children:[r.jsx(b.Controller,{name:"min_var",control:l,render:({field:f})=>r.jsx(oa,{label:i("rich_text.color_mapping.min.var"),clearable:!1,preview:"aggregated",sx:{flexGrow:1,maxWidth:"unset"},...f})}),r.jsx(b.Controller,{name:"min_val",control:l,render:({field:f})=>r.jsx(o.TextInput,{label:i("rich_text.color_mapping.min.val"),...f,sx:{maxWidth:"120px",flexGrow:0}})})]}),r.jsxs(o.Group,{grow:!0,position:"apart",children:[r.jsx(b.Controller,{name:"max_var",control:l,render:({field:f})=>r.jsx(oa,{label:i("rich_text.color_mapping.max.var"),clearable:!1,preview:"aggregated",sx:{flexGrow:1,maxWidth:"unset"},...f})}),r.jsx(b.Controller,{name:"max_val",control:l,render:({field:f})=>r.jsx(o.TextInput,{label:i("rich_text.color_mapping.max.val"),...f,sx:{maxWidth:"120px",flexGrow:0}})})]}),r.jsx(b.Controller,{control:l,name:"colors",render:({field:f})=>r.jsx(Ap,{...f})})]}),r.jsx(o.Divider,{color:"rgb(206, 212, 218)",variant:"dotted",my:"1rem"}),r.jsxs(o.Group,{position:"apart",px:"1rem",pb:"0.75rem",children:[r.jsxs(o.Group,{position:"left",children:[r.jsx(o.Button,{color:"red",size:"xs",onClick:n,leftIcon:r.jsx(M.IconTrash,{size:18}),children:i("common.actions.clear")}),r.jsx(o.Button,{color:"orange",size:"xs",onClick:p,leftIcon:r.jsx(M.IconArrowBackUp,{size:18}),children:i("common.actions.revert")})]}),r.jsx(o.Button,{color:"green",size:"xs",onClick:c(t),leftIcon:r.jsx(M.IconDeviceFloppy,{size:18}),children:i("common.actions.save_changes")})]})]})},n_=()=>{const e=o.useMantineTheme();return r.jsx("div",{style:{width:"20px",height:"13px",borderRadius:"2px",background:e.fn.linearGradient(90,...Object.values(cn.graphics.depth))}})},r_=({disabled:e})=>{const t=o.useMantineTheme();return r.jsx(o.Box,{sx:{width:"16px",height:"10px",borderRadius:"2px",background:t.fn.linearGradient(90,...Object.values(cn.graphics.depth)),opacity:e?"0.5":1,position:"relative","&:after":{position:"absolute",content:"''",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"15px",height:"15px",background:`
70
+ `)}},Uv=({value:e,onChange:t})=>{const{t:n}=j.useTranslation(),[s,{setTrue:i,setFalse:a}]=J.useBoolean(),[l,c]=g.useState(e),u=()=>{a();const{type:f,value:m}=l,y={type:f,value:m};c(y),t(y)},d=()=>{a(),c(e)},h=f=>{c(m=>({...m,value:f}))},p=()=>{h(Dp.dynamic.value)};return r.jsxs(r.Fragment,{children:[r.jsx(o.Box,{sx:{width:"50%"},children:r.jsx(o.Button,{color:"grape",variant:"filled",leftIcon:r.jsx(M.IconMathFunction,{size:16}),mt:24,onClick:i,sx:{flexGrow:0},children:n("chart.number_or_dynamic_value.dynamic.setup")})}),r.jsx(o.Modal,{size:800,title:n("chart.number_or_dynamic_value.dynamic.setup_title"),opened:s,onClose:a,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:s&&r.jsxs(o.Stack,{children:[r.jsx(o.Divider,{mt:10,mb:-10,label:n("chart.number_or_dynamic_value.dynamic.guide"),labelPosition:"center",variant:"dashed"}),r.jsx(Qv,{value:l.value,onChange:h}),r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Button,{onClick:p,color:"red",leftIcon:r.jsx(W.Recycle,{size:20}),children:n("common.actions.reset_to_default")}),r.jsxs(o.Group,{position:"right",children:[r.jsx(o.Button,{onClick:d,variant:"subtle",children:n("common.actions.cancel")}),r.jsx(o.Button,{color:"green",leftIcon:r.jsx(M.IconDeviceFloppy,{size:16}),onClick:u,children:n("common.actions.save")})]})]})]})})]})},Yv=({value:e,onChange:t})=>e.type!=="dynamic"?null:r.jsx(Uv,{value:e,onChange:t}),Kv=({value:e,onChange:t})=>{if(e.type!=="static")return null;const n=s=>{t({...e,value:s})};return r.jsx(o.NumberInput,{defaultValue:18,label:" ",hideControls:!0,value:e.value,onChange:n})},Mp=g.forwardRef(({label:e="Value",value:t,onChange:n},s)=>{const{t:i,i18n:a}=j.useTranslation(),l=u=>{n({...Dp[u]})},c=g.useMemo(()=>[{label:i("chart.number_or_dynamic_value.type.static"),value:"static"},{label:i("chart.number_or_dynamic_value.type.dynamic"),value:"dynamic"}],[a.language]);return r.jsxs(o.SimpleGrid,{cols:2,children:[r.jsx(o.Select,{ref:s,label:e,data:c,value:t.type,onChange:l,sx:{flexGrow:1}}),r.jsx(Kv,{value:t,onChange:n}),r.jsx(Yv,{value:t,onChange:n})]})});function Ip(e,t,n){if(!e.type)return n;if(e.type==="static"){const{value:i}=e;return Number(i)}const{value:s}=e;try{const i=new Function(`return ${s}`)()({variables:t},{lodash:v,interpolate:xn.interpolate});return Number(i)}catch(i){return console.error(`[getNumberOrDynamicValue] failed parsing custom function, error: ${i.message}`),10}}function zp(e){return{type:"continuous",id:"continuous-example",min:{type:"static",value:0},max:{type:"static",value:100},orient:"horizontal",left:"center",top:"top",text:["",""],calculable:!0,itemWidth:15,itemHeight:140,show:!0,inRange:{color:e??Object.values(cn.graphics.depth)},skipRange:{lt_min:"",min:"",max:"",gt_max:""}}}function Xv(){return{type:"piecewise",piecewise_mode:"pieces",id:"piecewise-visualmap",min:{type:"static",value:0},max:{type:"static",value:100},align:"auto",orient:"horizontal",left:"center",top:"top",itemWidth:15,itemHeight:15,show:!0,precision:0,pieces:[Ep()],categories:[]}}function pn(){return zp()}function Jv(){return{compared:Object.values(cn.graphics.compared),level:Object.values(cn.graphics.level),depth:Object.values(cn.graphics.depth),yellow_blue:["#8f531d","#ffd347","#e3efe3","#eefaee","#4ecbbf","#003f94"],blue:["#f9fcff","#48b3e9","#003f94"],darkgreen_pink:["#0c525a","#f21f99"],spectrum:["#ff0000","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000"]}}function Us(e,t){const{min:n,max:s}=e,i=Ip(n,t),a=Ip(s,t);if(e.type==="continuous"){const{skipRange:p,text:f,...m}=e;return{...m,min:i,max:a,text:[...f]}}const{piecewise_mode:l,pieces:c,categories:u,...d}=e,h={...d};return delete h.min,delete h.max,l==="pieces"?h.pieces=c.map(p=>{const f={};p.label&&(f.label=p.label),p.color&&(f.color=p.color);const m=Number(p.lower.value);p.lower.value===""?f[p.lower.symbol]=i:Number.isFinite(m)&&(f[p.lower.symbol]=m);const y=Number(p.upper.value);return p.upper.value===""?f[p.upper.symbol]=a:Number.isFinite(y)&&(f[p.upper.symbol]=y),f}):l==="categories"&&(h.categories=u),h}const lr=e=>({followVisualMap:!e,color:e});function oo(e,t,n,s){if(s.type!=="continuous")return lr("");const{skipRange:i}=s;return e===t?lr(i.min):e===n?lr(i.max):e<t?lr(i.lt_min):e>n?lr(i.gt_max):lr("")}function Ep(){return{lower:{value:"0",symbol:"gt"},upper:{value:"",symbol:"lt"},label:"",color:""}}const Zv=Jv(),Hv=({colors:e,applyPalette:t,zIndex:n=340})=>{const{t:s}=j.useTranslation(),i=`linear-gradient(to right, ${e.join(", ")})`;return r.jsxs(o.Menu,{shadow:"md",width:300,withinPortal:!0,zIndex:n,children:[r.jsx(o.Menu.Target,{children:r.jsxs(o.UnstyledButton,{children:[r.jsx(o.Text,{style:{display:"inline-block",fontSize:"0.875rem",fontWeight:500,color:"#212529",wordBreak:"break-word",cursor:"default"},children:s("chart.color.color_gradient")}),r.jsxs(o.Group,{style:{padding:"0.4375rem 0.625rem",border:"0.0625rem solid #ced4da",borderRadius:"0.25rem",columnGap:10},children:[r.jsx(o.Box,{style:{height:"20px",flexGrow:1,backgroundImage:i,borderRadius:4}}),r.jsx(M.IconSelector,{size:14,color:"rgb(134, 142, 150)"})]})]})}),r.jsxs(o.Menu.Dropdown,{children:[r.jsx(o.Menu.Label,{children:s("chart.visual_map.built_in_palettes")}),r.jsx(o.Menu.Divider,{}),Object.entries(Zv).map(([a,l])=>r.jsx(o.Tooltip,{label:s("chart.visual_map.use_palette_x",{x:a}),children:r.jsx(o.Menu.Item,{children:r.jsx(o.Box,{style:{height:"20px",width:"100%",backgroundImage:`linear-gradient(to right, ${l.join(", ")})`,borderRadius:4,boxShadow:"0 0 3px 0 #eee",cursor:"pointer"},onClick:()=>{t(l)},title:a})})},a))]})]})},e_=({color:e,index:t,handleChange:n,handleRemove:s})=>{const[i,{setTrue:a,setFalse:l}]=J.useBoolean(!1),{ref:c,handleRef:u}=Tp({id:e.id,index:t});return r.jsxs(o.Flex,{ref:c,gap:"sm",justify:"flex-start",align:"center",direction:"row",wrap:"nowrap",onMouseEnter:a,onMouseLeave:l,children:[r.jsx(o.Center,{style:{minWidth:"30px",maxWidth:"30px",flex:0},children:i?r.jsx(o.ActionIcon,{size:"xs",ref:u,children:r.jsx(M.IconGripVertical,{})}):r.jsx(o.Badge,{size:"sm",children:t+1})}),r.jsx("div",{style:{flex:1},children:r.jsx(o.ColorInput,{styles:{root:{flexGrow:1}},withinPortal:!0,dropdownZIndex:340,size:"xs",value:e.value,onChange:n})}),r.jsx("div",{style:{minWidth:"40px",maxWidth:"40px",flex:0},children:r.jsx(o.CloseButton,{onClick:s})})]})},Ap=g.forwardRef(({value:e,onChange:t,zIndex:n=340},s)=>{const{t:i}=j.useTranslation(),a=g.useMemo(()=>e.map(y=>({id:on.v4(),value:y})),[e]),l=y=>{t([...e,y])},c=y=>{const _=[...e];_.splice(y,1),t(_)},u=y=>{t([...y])},d=y=>_=>{const k=[...e];k[y]=_,t(k)},[h,p]=g.useState(""),f=()=>{h&&(l(h),p(""))},m=y=>{const{source:_,target:k}=y.operation,S=Yg.move(a,_,k);t(S.map(T=>T.value))};return r.jsxs(o.Stack,{ref:s,children:[r.jsx(Hv,{colors:e,applyPalette:u,zIndex:n}),r.jsx(is.DragDropProvider,{onDragEnd:m,children:a.map((y,_)=>r.jsx(e_,{color:y,handleChange:d(_),handleRemove:()=>c(_),index:_},y.id))}),r.jsxs(o.Flex,{gap:"sm",justify:"flex-start",align:"center",direction:"row",wrap:"nowrap",children:[r.jsx("div",{style:{minWidth:"30px",maxWidth:"30px",flex:0}}),r.jsx("div",{style:{flex:1},children:r.jsx(o.ColorInput,{withinPortal:!0,dropdownZIndex:n,placeholder:i("chart.color.click_to_add_a_color"),value:h,onChange:p,onBlur:f,size:"xs"})}),r.jsx("div",{style:{minWidth:"40px",maxWidth:"40px",flex:0}})]})]})}),t_=({defaultValues:e,onSubmit:t,unset:n})=>{const{t:s}=j.useTranslation(),i=b.useForm({defaultValues:e}),{control:a,handleSubmit:l,reset:c}=i;g.useEffect(()=>{c(e)},[e]);const u=g.useCallback(()=>c(e),[c,e]);return r.jsxs(o.Box,{children:[r.jsx(o.Divider,{color:"rgb(206, 212, 218)",variant:"dotted",my:"1rem"}),r.jsxs(o.Box,{px:"1rem",children:[r.jsx(b.Controller,{control:a,name:"variable",render:({field:d})=>r.jsx(oa,{label:s("rich_text.color_mapping.choose_value_var"),clearable:!1,preview:"aggregated",zIndex:340,...d})}),r.jsxs(o.Group,{grow:!0,position:"apart",children:[r.jsx(b.Controller,{name:"min_var",control:a,render:({field:d})=>r.jsx(oa,{label:s("rich_text.color_mapping.min.var"),preview:"aggregated",sx:{flexGrow:1,maxWidth:"unset"},...d})}),r.jsx(b.Controller,{name:"min_val",control:a,render:({field:d})=>r.jsx(o.TextInput,{label:s("rich_text.color_mapping.min.val"),...d,sx:{maxWidth:"120px",flexGrow:0}})})]}),r.jsxs(o.Group,{grow:!0,position:"apart",children:[r.jsx(b.Controller,{name:"max_var",control:a,render:({field:d})=>r.jsx(oa,{label:s("rich_text.color_mapping.max.var"),preview:"aggregated",sx:{flexGrow:1,maxWidth:"unset"},...d})}),r.jsx(b.Controller,{name:"max_val",control:a,render:({field:d})=>r.jsx(o.TextInput,{label:s("rich_text.color_mapping.max.val"),...d,sx:{maxWidth:"120px",flexGrow:0}})})]}),r.jsx(b.Controller,{control:a,name:"colors",render:({field:d})=>r.jsx(Ap,{...d})})]}),r.jsx(o.Divider,{color:"rgb(206, 212, 218)",variant:"dotted",my:"1rem"}),r.jsxs(o.Group,{position:"apart",px:"1rem",pb:"0.75rem",children:[r.jsxs(o.Group,{position:"left",children:[r.jsx(o.Button,{color:"red",size:"xs",onClick:n,leftIcon:r.jsx(M.IconTrash,{size:18}),children:s("common.actions.clear")}),r.jsx(o.Button,{color:"orange",size:"xs",onClick:u,leftIcon:r.jsx(M.IconArrowBackUp,{size:18}),children:s("common.actions.revert")})]}),r.jsx(o.Button,{color:"green",size:"xs",onClick:l(t),leftIcon:r.jsx(M.IconDeviceFloppy,{size:18}),children:s("common.actions.save_changes")})]})]})},n_=()=>{const e=o.useMantineTheme();return r.jsx("div",{style:{width:"20px",height:"13px",borderRadius:"2px",background:e.fn.linearGradient(90,...Object.values(cn.graphics.depth))}})},r_=({disabled:e})=>{const t=o.useMantineTheme();return r.jsx(o.Box,{sx:{width:"16px",height:"10px",borderRadius:"2px",background:t.fn.linearGradient(90,...Object.values(cn.graphics.depth)),opacity:e?"0.5":1,position:"relative","&:after":{position:"absolute",content:"''",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"15px",height:"15px",background:`
71
71
  linear-gradient(to top right,
72
72
  rgba(0,0,0,0) 0%,
73
73
  rgba(0,0,0,0) calc(50% - 1.4px),
@@ -77,7 +77,7 @@ Check the top-level render call using <`+q+">.")}return A}}function $g(C,A){{if(
77
77
  rgba(0,0,0,0) calc(50% + 0.8px),
78
78
  rgba(255,255,255,1) calc(50% + 1.4px),
79
79
  rgba(0,0,0,0) calc(50% + 1.4px),
80
- rgba(0,0,0,0) 100%)`}}})},s_=({editor:e})=>{const{t}=j.useTranslation(),[n,{set:s,setTrue:i,setFalse:a,toggle:l}]=J.useBoolean(),c=e.getAttributes(bu),{empty:u,...d}=g.useMemo(()=>Ry(c),[c]),h=g.useCallback(f=>{e.chain().focus().setColorMapping(f).run(),a()},[e]),p=g.useCallback(()=>{e.chain().focus().unsetColorMapping().run()},[e]);return r.jsxs(r.Fragment,{children:[r.jsx(o.Modal,{size:500,opened:n,onClose:a,shadow:"md",withinPortal:!0,zIndex:330,closeOnClickOutside:!1,closeOnEscape:!1,title:t("rich_text.color_mapping.edit"),styles:{header:{paddingBottom:0},body:{padding:0}},children:r.jsx(t_,{defaultValues:d,cancel:a,unset:p,onSubmit:h})}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(o.Tooltip,{label:t("rich_text.color_mapping.label"),children:r.jsx(o.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important",color:"#000"},onClick:i,children:r.jsx(n_,{})})}),r.jsx(o.Tooltip,{label:t("rich_text.color_mapping.clear"),children:r.jsx(o.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important"},disabled:u,onClick:p,children:r.jsx(r_,{disabled:u})})})]})]})},Kr=({value:e,styles:t={},sx:n={},dashboardState:s=uo(),variableAggValueMap:i={}})=>{const a=Iu(),l=g.useMemo(()=>{const f=[fc,pc,ee.Link,ic,sc,nc,ac.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),cc,lc,oc,uc.configure({types:["heading","paragraph"]}),rc.configure({placeholder:"This is placeholder"}),dc,tc.Color,mu,fu];return a&&f.push(vu),f},[a]),c=hc.useEditor({extensions:l,content:e,editable:!1});g.useEffect(()=>{c==null||c.commands.setContent(e)},[e,c]);const u=g.useMemo(()=>new DOMParser().parseFromString(e,"text/html"),[e]),d=g.useMemo(()=>My(u,s,i),[u,s,i]),h=g.useMemo(()=>Wy(u,i),[u,i]),p=g.useMemo(()=>v.defaultsDeep({},{content:{...Ei,...d,...h}},t),[t,d,h]);return r.jsx(ee.RichTextEditor,{editor:c,styles:p,sx:n,children:r.jsx(ee.RichTextEditor.Content,{})})};function Pp(){const{t:e}=j.useTranslation(),[t,{open:n,close:s}]=Se.useDisclosure(!1);return r.jsxs(r.Fragment,{children:[r.jsx(o.Modal,{opened:t,onClose:s,title:e("function_utils.modal_title"),zIndex:330,withinPortal:!0,children:r.jsx(Kr,{value:Gm(e),styles:{root:{border:"none"},content:{padding:0,table:{marginBottom:0}}}})}),r.jsx(o.Button,{variant:"light",color:"violet",size:"xs",onClick:n,leftIcon:r.jsx(M.IconInfoCircle,{size:16}),children:e("function_utils.trigger_text")})]})}const Op=g.forwardRef((e,t)=>{const{label:n,description:s,...i}=e;return r.jsx("div",{ref:t,...i,children:r.jsxs(o.Group,{position:"apart",noWrap:!0,children:[r.jsx(o.Text,{children:n}),r.jsx(o.Text,{size:"xs",color:"dimmed",children:s})]})})}),lo=({value:e,onChange:t,height:n="200px",defaultLanguage:s="sql",theme:i="vs-dark"})=>{const a=c=>{t==null||t(c??"")},l=!t;return r.jsx(gt,{className:"minimal-monaco-editor",height:n,defaultLanguage:s,value:e,onChange:l?void 0:a,theme:i,options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1},readOnly:l||!t,"semanticHighlighting.enabled":!0}})},i_=["gray","red","grape","blue","cyan","green","yellow"],a_=({editor:e})=>{const{t}=j.useTranslation(),n=o.useMantineTheme(),[s,{set:i,setFalse:a,toggle:l}]=J.useBoolean(),c=e.getAttributes("textStyle").color||n.black,u=g.useMemo(()=>Ut(c).hex(),[c]),d=g.useMemo(()=>{const f=[];return i_.forEach(m=>{const y=n.colors[m];y&&y.forEach(_=>{f.push(_)})}),f},[n.colors]),h=(f,m=!0)=>{e.chain().focus().setColor(f).run(),m&&a()},p=()=>{e.chain().focus().unsetColor().run(),a()};return r.jsxs(o.Popover,{opened:s,onChange:i,shadow:"md",withinPortal:!0,zIndex:340,withArrow:!0,children:[r.jsx(o.Popover.Target,{children:r.jsx(ee.RichTextEditor.Control,{onClick:l,children:r.jsx(o.ColorSwatch,{color:u,size:14})})}),r.jsx(o.Popover.Dropdown,{children:r.jsxs(o.Stack,{spacing:"xs",children:[r.jsxs(o.Group,{position:"right",children:[r.jsx(o.ColorInput,{value:u,onChangeEnd:f=>h(f,!1),size:"xs",withPicker:!1,dropdownZIndex:340,styles:{root:{flexGrow:1},input:{fontFamily:"monospace",letterSpacing:2,textAlign:"center"}}}),r.jsx(o.ActionIcon,{variant:"default",onClick:p,title:t("common.actions.clear"),children:r.jsx(M.IconCircleOff,{stroke:1.5,size:"1rem"})}),r.jsx(o.ActionIcon,{variant:"default",onClick:a,title:t("common.actions.close"),children:r.jsx(M.IconX,{stroke:1.5,size:"1rem"})})]}),r.jsxs(o.SimpleGrid,{cols:2,children:[r.jsx(o.ColorPicker,{format:"hex",swatches:d,value:u,onChange:f=>h(f,!1),size:"sm",withPicker:!1,styles:{swatches:{marginTop:"0 !important"}}}),r.jsx(o.ColorPicker,{format:"hex",fullWidth:!0,value:u,onChange:f=>h(f,!1)})]})]})})]})},o_={"dynamic-color":{position:"relative"},"dynamic-color:after":{content:'""',position:"absolute",bottom:"-2px",left:0,width:"100%",height:"1px",border:"double 1px purple"},"color-mapping":{position:"relative"},"color-mapping:after":{content:'""',position:"absolute",bottom:"-2px",left:0,width:"100%",height:"4px",opacity:.8,background:"linear-gradient(90deg, rgb(255, 225, 225) 0%, rgb(253, 188, 188) 40%, rgb(243, 148, 148) 60%, rgb(250, 66, 66) 80%, rgb(226, 18, 18) 100%)"}};function l_(){const{editor:e}=ee.useRichTextEditorContext();return r.jsx(ee.RichTextEditor.Control,{onClick:()=>e==null?void 0:e.commands.insertTable({rows:3,cols:3,withHeaderRow:!0}),"aria-label":"Insert table",title:"Insert table",children:r.jsx(M.IconBorderAll,{stroke:1.5,size:16})})}const Ys=g.forwardRef(({value:e,onChange:t,styles:n={},label:s,autoSubmit:i,onSubmit:a},l)=>{const c=zu(),u=g.useMemo(()=>{const _=[fc,pc,ee.Link,ic,sc,nc,ac.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),cc,lc,oc,uc.configure({types:["heading","paragraph"]}),rc.configure({placeholder:"This is placeholder"}),dc,tc.Color,mu,fu];return c&&_.push(vu),_},[c]),[d,h]=g.useState(e),p=hc.useEditor({extensions:u,content:d,onUpdate:({editor:_})=>{const k=_.getHTML();h(k)},onCreate:({editor:_})=>{_.view.dom.setAttribute("spellcheck","false"),_.view.dom.setAttribute("autocomplete","off"),_.view.dom.setAttribute("autocapitalize","off")}});g.useEffect(()=>{h(_=>e===_?_:(p==null||p.commands.setContent(e),e))},[e]);const f=()=>{t(d),a==null||a()},m=e!==d;g.useEffect(()=>{i&&f()},[i,m]);const y=g.useMemo(()=>v.defaultsDeep({},{content:{...Ei,...o_}},n),[n]);return p?r.jsxs(o.Stack,{spacing:4,sx:{flexGrow:1,position:"relative"},children:[r.jsxs(o.Group,{align:"center",children:[r.jsx(o.Text,{size:14,fw:500,children:s}),!i&&r.jsx(o.ActionIcon,{color:"green",disabled:!m,onClick:f,children:r.jsx(M.IconDeviceFloppy,{size:18})})]}),r.jsxs(ee.RichTextEditor,{editor:p,styles:y,children:[r.jsxs(ee.RichTextEditor.Toolbar,{sticky:!0,stickyOffset:0,children:[r.jsx(a_,{editor:p}),c&&r.jsx(s_,{editor:p}),r.jsx(ee.RichTextEditor.ControlsGroup,{children:r.jsx(Ly,{editor:p})}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.Bold,{}),r.jsx(ee.RichTextEditor.Italic,{}),r.jsx(ee.RichTextEditor.Underline,{}),r.jsx(ee.RichTextEditor.ClearFormatting,{}),r.jsx(ee.RichTextEditor.Highlight,{}),r.jsx(ee.RichTextEditor.Code,{})]}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.H1,{}),r.jsx(ee.RichTextEditor.H2,{}),r.jsx(ee.RichTextEditor.H3,{}),r.jsx(ee.RichTextEditor.H4,{})]}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.Blockquote,{}),r.jsx(ee.RichTextEditor.Hr,{}),r.jsx(ee.RichTextEditor.BulletList,{}),r.jsx(ee.RichTextEditor.OrderedList,{}),r.jsx(ee.RichTextEditor.Subscript,{}),r.jsx(ee.RichTextEditor.Superscript,{})]}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.Link,{}),r.jsx(ee.RichTextEditor.Unlink,{})]}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.AlignLeft,{}),r.jsx(ee.RichTextEditor.AlignCenter,{}),r.jsx(ee.RichTextEditor.AlignJustify,{}),r.jsx(ee.RichTextEditor.AlignRight,{})]}),r.jsx(ee.RichTextEditor.ControlsGroup,{children:r.jsx(l_,{})}),r.jsx(Ny,{editor:p})]}),r.jsx(ee.RichTextEditor.Content,{})]})]}):null}),We={mantissa:0,output:"number",trimMantissa:!1,average:!1,absolute:!1};function se(e,{absolute:t,...n}){if(e===null)return String(e);try{let s=ss(e).value();if(s===void 0||Number.isNaN(s))throw new Error(`[formatNumber]Not a number: ${e}`);return t&&(s=Math.abs(s)),ss(s).format(n)}catch(s){return console.debug(s),String(e)}}function c_(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?`Array(${e.length})`:e.toString()}function nn({data_field:e,aggregation:t},n){return ds(n,e,t)}function vt({formatter:e,aggregation:t},n){if(typeof n!="string"&&typeof n!="number")return c_(n);if(t.type==="custom")return n;try{return se(n,e)}catch(s){return console.error(s),n}}function Lp(e,t){return e.replaceAll(/(\$\{([^{\}]+(?=}))\})/g,(...s)=>{const i=s[2],a=t.variableStyleMap[i];if(!a)return`{{${i}}}`;const{variable:l,...c}=a,u=Object.entries(c).map(([f,m])=>`${f}:${m}`).join(";"),d=l.color;if(d.type!=="continuous")return`<span style="${u}">{{${i}}}</span>`;const h=pu(6),p=`try {
80
+ rgba(0,0,0,0) 100%)`}}})},s_=({editor:e})=>{const{t}=j.useTranslation(),[n,{set:s,setTrue:i,setFalse:a,toggle:l}]=J.useBoolean(),c=e.getAttributes(bu),{empty:u,...d}=g.useMemo(()=>Ry(c),[c]),h=g.useCallback(f=>{e.chain().focus().setColorMapping(f).run(),a()},[e]),p=g.useCallback(()=>{e.chain().focus().unsetColorMapping().run()},[e]);return r.jsxs(r.Fragment,{children:[r.jsx(o.Modal,{size:500,opened:n,onClose:a,shadow:"md",withinPortal:!0,zIndex:330,closeOnClickOutside:!1,closeOnEscape:!1,title:t("rich_text.color_mapping.edit"),styles:{header:{paddingBottom:0},body:{padding:0}},children:r.jsx(t_,{defaultValues:d,unset:p,onSubmit:h})}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(o.Tooltip,{label:t("rich_text.color_mapping.label"),children:r.jsx(o.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important",color:"#000"},onClick:i,children:r.jsx(n_,{})})}),r.jsx(o.Tooltip,{label:t("rich_text.color_mapping.clear"),children:r.jsx(o.ActionIcon,{variant:"default","data-rich-text-editor-control":"true",sx:{height:"26px",minHeight:"26px",lineHeight:"26px",borderColor:"#ced4da !important"},disabled:u,onClick:p,children:r.jsx(r_,{disabled:u})})})]})]})},Kr=({value:e,styles:t={},sx:n={},dashboardState:s=uo(),variableAggValueMap:i={}})=>{const a=Iu(),l=g.useMemo(()=>{const f=[fc,pc,ee.Link,ic,sc,nc,ac.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),cc,lc,oc,uc.configure({types:["heading","paragraph"]}),rc.configure({placeholder:"This is placeholder"}),dc,tc.Color,mu,fu];return a&&f.push(vu),f},[a]),c=hc.useEditor({extensions:l,content:e,editable:!1});g.useEffect(()=>{c==null||c.commands.setContent(e)},[e,c]);const u=g.useMemo(()=>new DOMParser().parseFromString(e,"text/html"),[e]),d=g.useMemo(()=>My(u,s,i),[u,s,i]),h=g.useMemo(()=>Wy(u,i),[u,i]),p=g.useMemo(()=>v.defaultsDeep({},{content:{...Ei,...d,...h}},t),[t,d,h]);return r.jsx(ee.RichTextEditor,{editor:c,styles:p,sx:n,children:r.jsx(ee.RichTextEditor.Content,{})})};function Pp(){const{t:e}=j.useTranslation(),[t,{open:n,close:s}]=Se.useDisclosure(!1);return r.jsxs(r.Fragment,{children:[r.jsx(o.Modal,{opened:t,onClose:s,title:e("function_utils.modal_title"),zIndex:330,withinPortal:!0,children:r.jsx(Kr,{value:Gm(e),styles:{root:{border:"none"},content:{padding:0,table:{marginBottom:0}}}})}),r.jsx(o.Button,{variant:"light",color:"violet",size:"xs",onClick:n,leftIcon:r.jsx(M.IconInfoCircle,{size:16}),children:e("function_utils.trigger_text")})]})}const Op=g.forwardRef((e,t)=>{const{label:n,description:s,...i}=e;return r.jsx("div",{ref:t,...i,children:r.jsxs(o.Group,{position:"apart",noWrap:!0,children:[r.jsx(o.Text,{children:n}),r.jsx(o.Text,{size:"xs",color:"dimmed",children:s})]})})}),lo=({value:e,onChange:t,height:n="200px",defaultLanguage:s="sql",theme:i="vs-dark"})=>{const a=c=>{t==null||t(c??"")},l=!t;return r.jsx(gt,{className:"minimal-monaco-editor",height:n,defaultLanguage:s,value:e,onChange:l?void 0:a,theme:i,options:{lineNumbers:"off",folding:!1,lineDecorationsWidth:20,lineNumbersMinChars:0,wordWrap:"on",minimap:{enabled:!1},readOnly:l||!t,"semanticHighlighting.enabled":!0}})},i_=["gray","red","grape","blue","cyan","green","yellow"],a_=({editor:e})=>{const{t}=j.useTranslation(),n=o.useMantineTheme(),[s,{set:i,setFalse:a,toggle:l}]=J.useBoolean(),c=e.getAttributes("textStyle").color||n.black,u=g.useMemo(()=>Ut(c).hex(),[c]),d=g.useMemo(()=>{const f=[];return i_.forEach(m=>{const y=n.colors[m];y&&y.forEach(_=>{f.push(_)})}),f},[n.colors]),h=(f,m=!0)=>{e.chain().focus().setColor(f).run(),m&&a()},p=()=>{e.chain().focus().unsetColor().run(),a()};return r.jsxs(o.Popover,{opened:s,onChange:i,shadow:"md",withinPortal:!0,zIndex:340,withArrow:!0,children:[r.jsx(o.Popover.Target,{children:r.jsx(ee.RichTextEditor.Control,{onClick:l,children:r.jsx(o.ColorSwatch,{color:u,size:14})})}),r.jsx(o.Popover.Dropdown,{children:r.jsxs(o.Stack,{spacing:"xs",children:[r.jsxs(o.Group,{position:"right",children:[r.jsx(o.ColorInput,{value:u,onChangeEnd:f=>h(f,!1),size:"xs",withPicker:!1,dropdownZIndex:340,styles:{root:{flexGrow:1},input:{fontFamily:"monospace",letterSpacing:2,textAlign:"center"}}}),r.jsx(o.ActionIcon,{variant:"default",onClick:p,title:t("common.actions.clear"),children:r.jsx(M.IconCircleOff,{stroke:1.5,size:"1rem"})}),r.jsx(o.ActionIcon,{variant:"default",onClick:a,title:t("common.actions.close"),children:r.jsx(M.IconX,{stroke:1.5,size:"1rem"})})]}),r.jsxs(o.SimpleGrid,{cols:2,children:[r.jsx(o.ColorPicker,{format:"hex",swatches:d,value:u,onChange:f=>h(f,!1),size:"sm",withPicker:!1,styles:{swatches:{marginTop:"0 !important"}}}),r.jsx(o.ColorPicker,{format:"hex",fullWidth:!0,value:u,onChange:f=>h(f,!1)})]})]})})]})},o_={"dynamic-color":{position:"relative"},"dynamic-color:after":{content:'""',position:"absolute",bottom:"-2px",left:0,width:"100%",height:"1px",border:"double 1px purple"},"color-mapping":{position:"relative"},"color-mapping:after":{content:'""',position:"absolute",bottom:"-2px",left:0,width:"100%",height:"4px",opacity:.8,background:"linear-gradient(90deg, rgb(255, 225, 225) 0%, rgb(253, 188, 188) 40%, rgb(243, 148, 148) 60%, rgb(250, 66, 66) 80%, rgb(226, 18, 18) 100%)"}};function l_(){const{editor:e}=ee.useRichTextEditorContext();return r.jsx(ee.RichTextEditor.Control,{onClick:()=>e==null?void 0:e.commands.insertTable({rows:3,cols:3,withHeaderRow:!0}),"aria-label":"Insert table",title:"Insert table",children:r.jsx(M.IconBorderAll,{stroke:1.5,size:16})})}const Ys=g.forwardRef(({value:e,onChange:t,styles:n={},label:s,autoSubmit:i,onSubmit:a},l)=>{const c=zu(),u=g.useMemo(()=>{const _=[fc,pc,ee.Link,ic,sc,nc,ac.configure({resizable:!1,HTMLAttributes:{class:"rich-text-table-render"}}),cc,lc,oc,uc.configure({types:["heading","paragraph"]}),rc.configure({placeholder:"This is placeholder"}),dc,tc.Color,mu,fu];return c&&_.push(vu),_},[c]),[d,h]=g.useState(e),p=hc.useEditor({extensions:u,content:d,onUpdate:({editor:_})=>{const k=_.getHTML();h(k)},onCreate:({editor:_})=>{_.view.dom.setAttribute("spellcheck","false"),_.view.dom.setAttribute("autocomplete","off"),_.view.dom.setAttribute("autocapitalize","off")}});g.useEffect(()=>{h(_=>e===_?_:(p==null||p.commands.setContent(e),e))},[e]);const f=()=>{t(d),a==null||a()},m=e!==d;g.useEffect(()=>{i&&f()},[i,m]);const y=g.useMemo(()=>v.defaultsDeep({},{content:{...Ei,...o_}},n),[n]);return p?r.jsxs(o.Stack,{spacing:4,sx:{flexGrow:1,position:"relative"},children:[r.jsxs(o.Group,{align:"center",children:[r.jsx(o.Text,{size:14,fw:500,children:s}),!i&&r.jsx(o.ActionIcon,{color:"green",disabled:!m,onClick:f,children:r.jsx(M.IconDeviceFloppy,{size:18})})]}),r.jsxs(ee.RichTextEditor,{editor:p,styles:y,children:[r.jsxs(ee.RichTextEditor.Toolbar,{sticky:!0,stickyOffset:0,children:[r.jsx(a_,{editor:p}),c&&r.jsx(s_,{editor:p}),r.jsx(ee.RichTextEditor.ControlsGroup,{children:r.jsx(Ly,{editor:p})}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.Bold,{}),r.jsx(ee.RichTextEditor.Italic,{}),r.jsx(ee.RichTextEditor.Underline,{}),r.jsx(ee.RichTextEditor.ClearFormatting,{}),r.jsx(ee.RichTextEditor.Highlight,{}),r.jsx(ee.RichTextEditor.Code,{})]}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.H1,{}),r.jsx(ee.RichTextEditor.H2,{}),r.jsx(ee.RichTextEditor.H3,{}),r.jsx(ee.RichTextEditor.H4,{})]}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.Blockquote,{}),r.jsx(ee.RichTextEditor.Hr,{}),r.jsx(ee.RichTextEditor.BulletList,{}),r.jsx(ee.RichTextEditor.OrderedList,{}),r.jsx(ee.RichTextEditor.Subscript,{}),r.jsx(ee.RichTextEditor.Superscript,{})]}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.Link,{}),r.jsx(ee.RichTextEditor.Unlink,{})]}),r.jsxs(ee.RichTextEditor.ControlsGroup,{children:[r.jsx(ee.RichTextEditor.AlignLeft,{}),r.jsx(ee.RichTextEditor.AlignCenter,{}),r.jsx(ee.RichTextEditor.AlignJustify,{}),r.jsx(ee.RichTextEditor.AlignRight,{})]}),r.jsx(ee.RichTextEditor.ControlsGroup,{children:r.jsx(l_,{})}),r.jsx(Ny,{editor:p})]}),r.jsx(ee.RichTextEditor.Content,{})]})]}):null}),We={mantissa:0,output:"number",trimMantissa:!1,average:!1,absolute:!1};function se(e,{absolute:t,...n}){if(e===null)return String(e);try{let s=ss(e).value();if(s===void 0||Number.isNaN(s))throw new Error(`[formatNumber]Not a number: ${e}`);return t&&(s=Math.abs(s)),ss(s).format(n)}catch(s){return console.debug(s),String(e)}}function c_(e){return e===null?"null":e===void 0?"undefined":Array.isArray(e)?`Array(${e.length})`:e.toString()}function nn({data_field:e,aggregation:t},n){return ds(n,e,t)}function vt({formatter:e,aggregation:t},n){if(typeof n!="string"&&typeof n!="number")return c_(n);if(t.type==="custom")return n;try{return se(n,e)}catch(s){return console.error(s),n}}function Lp(e,t){return e.replaceAll(/(\$\{([^{\}]+(?=}))\})/g,(...s)=>{const i=s[2],a=t.variableStyleMap[i];if(!a)return`{{${i}}}`;const{variable:l,...c}=a,u=Object.entries(c).map(([f,m])=>`${f}:${m}`).join(";"),d=l.color;if(d.type!=="continuous")return`<span style="${u}">{{${i}}}</span>`;const h=pu(6),p=`try {
81
81
  return utils.popmotion.interpolate(${JSON.stringify(d.valueRange)}, ${JSON.stringify(d.colorRange)})(variables["${i}"]);
82
82
  } catch (error) {
83
83
  console.error(error);
@@ -89,7 +89,7 @@ Check the top-level render call using <`+q+">.")}return A}}function $g(C,A){{if(
89
89
  ${Object.entries(t).map(([s,i])=>`const ${s} = '${i}';`).join(`
90
90
  `)}
91
91
  return ${e};
92
- `)(n)}catch(s){return console.error(s),console.log(e),e}}function Np(e,t,n,s){const i=w_(t,s);return e.replaceAll(/(\{\{([^{\}]+(?=}))\}\})/g,(...l)=>{const c=l[2];if(!c)return c;const u=i[c];if(u)return u;const d=C_(c);return S_(d,i,n)})}function k_(e,t){const n=xc.decode(t);n!==e&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:e,after:t,v:n}),console.groupEnd())}async function T_({query:e,name:t,payload:n,additionals:s},i){if(!e.sql)return[];const{type:a,key:l,sql:c,pre_process:u,post_process:d}=e,h=Di(c,n),p=Wm({sql:h,pre_process:u}),f=xc.encode(p);k_(p,f);let m=await Kt.query(i)({type:a,key:l,query:f,...s},{params:{name:t}});return m=Rm(d,m,po(n)),m}async function D_({type:e,key:t,configString:n,name:s,additionals:i},a){try{return await Kt.httpDataSourceQuery(a)({type:e,key:t,query:n,...i},{params:{name:s}})}catch(l){if(Rt.isCancel(l))throw l;return console.error(l),l}}async function ho(){try{return(await Kt.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(e){return console.error(e),[]}}async function $p(){try{return(await Kt.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(e){return console.error(e),[]}}class Fp{constructor(t){N(this,"rootRef");this.rootRef=ae.observable({current:t})}async deleteItem(t){ae.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const n=this.getValueFromRoot(t);return Promise.resolve(n)}getValueFromRoot(t){return t===null?ae.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,n){if(t===null)if(v.isObject(n))ae.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else ae.runInAction(()=>{v.set(this.rootRef.current,[t],n)});return Promise.resolve(this.getItem(t))}watchItem(t,n,s){return ae.reaction(()=>this.getValueFromRoot(t),(i,a)=>{n(i,a)},{requiresObservable:!0,fireImmediately:v.get(s,"fireImmediately",!1)})}}class M_{constructor(){N(this,"channels",new Map);N(this,"globalChannel",new yc)}getChannel(t){const n=this.channels.get(t);if(n)return n;const s=new yc;return this.channels.set(t,s),s}}class I_{constructor(t){N(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 n=this.instances.get(t.id);if(n)return n;const s={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new M_,instanceData:new Fp(t.viz.conf)};return this.instances.set(t.id,s),s}}function Gp(e,t,n,s){return{vizManager:n,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Fp({}),colorPalette:{getColor(){return()=>""}},data:t,variables:s}}const z_=e=>{const{panel:t,measure:n,vizManager:s,data:i,variables:a}=e,l=s.resolveComponent(t.viz.type),c=s.getOrCreateInstance(t),u={...Gp(c,i,s,a),viewport:{width:n.w,height:n.h}},d=l.viewRender;return r.jsx(d,{context:u,instance:c,...v.omit(e,["panel","vizManager","data"])})},E_=e=>{const{vizManager:t,panel:n,data:s,variables:i}=e,a=t.resolveComponent(n.viz.type),l=t.getOrCreateInstance(n),c={...Gp(l,s,t,i)},u=a.configRender;return r.jsx(u,{context:c,instance:l,...v.omit(e,["panel","vizManager","data"])})},Wp=(e,t)=>{const n=Ut.bezier(e),s=Ut.bezier(t);return function(i){return i<50?n(i*2/100).hex():s((i-50)*2/100).hex()}},Js=e=>{const t=Ut.bezier(e);return function(n){return t(n/100).hex()}},A_={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:Wp(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},P_={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:Wp(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},O_={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:Js(["#fff7f1","darkred"]),name:"red",category:"sequential"},L_={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:Js(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},V_={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:Js(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},B_={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:Js(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class q_{constructor(t){N(this,"symbol");this.symbol=Symbol(t)}}function hn(e){return new q_(e)}class fo{constructor(){N(this,"parent");N(this,"factoryRegistry",new Map);N(this,"instanceRegistry",new Map)}createScoped(){const t=new fo;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 n=this.factoryRegistry.get(t.symbol);if(n){const s=n(this);return this.instanceRegistry.set(t.symbol,s),s}if(this.parent)return this.parent.get(t)}provideFactory(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,n),this}provideValue(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(t=>{const n=v.get(t,"dispose");v.isFunction(n)&&n.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const Rp="13.28.0",N_=Object.freeze(Object.defineProperty({__proto__:null,version:Rp},Symbol.toStringTag,{value:"Module"}));class $_{constructor(t){N(this,"staticColors",new Map);N(this,"interpolations",new Map);t.installedPlugins.forEach(n=>{n.manifest.color.forEach(s=>{this.register(s)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const n=this.encodeColor(t);t.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(n,t)):t.type==="interpolation"&&(this.interpolations.has(n)&&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(n,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 F_{constructor(){N(this,"plugins",new Map);N(this,"vizComponents",new Map);N(this,"factory",{viz:t=>{const n=this.vizComponents.get(t);if(n)return n;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 n of t.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}class G_{constructor(){N(this,"migrations",[])}version(t,n){return this.migrations.push({version:t,handler:n}),this}run(t,n,s){var l;if(t.from===t.to)return n;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const i=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),a=v.orderBy(i,"version","asc");if(((l=v.last(a))==null?void 0:l.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return a.reduce((c,u)=>u.handler(c,s),n)}}class Me extends G_{constructor(){super(),this.configVersions()}version(t,n){return super.version(t,(s,i)=>({version:t,...n(s,i)}))}async migrate({configData:t,panelModel:n}){const s=await t.getItem(null),i=v.get(s,"version",0),a=this.run({from:i,to:this.VERSION},s,{panelModel:n});await t.setItem(null,a)}async needMigration({configData:t}){const n=await t.getItem(null);return v.get(n,"version",0)<this.VERSION}}const Q=(e,t)=>{const[n,{setFalse:s}]=J.useBoolean(!0),[i,a]=g.useState();g.useEffect(()=>(e.getItem(t).then(c=>{a(c),s()}),e.watchItem(t,c=>{a(c)})));const l=g.useCallback(async c=>{await e.setItem(t,c),a(c)},[e,t]);return{loading:n,value:i,set:l}},ut={top:16,right:16,bottom:16,left:16},Bt=e=>Math.max(0,e-ut.left-ut.right),qt=e=>Math.max(0,e-ut.top-ut.bottom),Jr=(e,t)=>({width:Bt(e),height:qt(t)}),dt=({width:e,height:t,children:n})=>r.jsx(o.Box,{pt:ut.top,pr:ut.right,pb:ut.bottom,pl:ut.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:n}),go={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function W_({context:e}){const{value:t}=Q(e.instanceData,"config"),n=e.data,{width:s,height:i}=e.viewport,{x_axis_data_key:a,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:h}=v.defaults({},t,go),p=g.useMemo(()=>cs(n,a),[n,a]),{x:f,y:m,z:y}=g.useMemo(()=>({x:L(a),y:L(l),z:L(c)}),[a,l,c]),{min:_,max:k}=g.useMemo(()=>{const T=v.minBy(p,z=>z[y.columnKey]),I=v.maxBy(p,z=>z[y.columnKey]);return{min:v.get(T,y.columnKey),max:v.get(I,y.columnKey)}},[p,y]),S={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:_,max:k,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:h,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:p.map(T=>[T[f.columnKey],T[m.columnKey],T[y.columnKey]])}]};return t?r.jsx(dt,{width:s,height:i,children:r.jsx(Ke,{echarts:Ye,option:S,style:Jr(s,i),notMerge:!0,theme:"merico-light"})}):null}const U=D.observer(g.forwardRef(({label:e,required:t,description:n,value:s,onChange:i,queryID:a,clearable:l=!1,sx:c,...u},d)=>{const{panel:h}=Je(),p=g.useMemo(()=>h.dataFieldOptions(s,l,a),[s,l,a]);if(p.length===0){const f=h.explainDataKey(s);return r.jsxs(o.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[r.jsx(o.HoverCard.Target,{children:r.jsx(o.Box,{children:r.jsx(o.TextInput,{label:e,required:t,defaultValue:f.columnKey,readOnly:!0,disabled:!0})})}),r.jsx(o.HoverCard.Dropdown,{children:r.jsxs(o.Group,{position:"left",spacing:0,children:[r.jsx(o.Text,{size:"xs",color:f.queryName?"black":"red",sx:{fontFamily:"monospace"},children:f.queryName??f.queryID}),r.jsx(o.Text,{size:"xs",color:"black",sx:{fontFamily:"monospace"},children:"."}),r.jsx(o.Text,{size:"xs",color:"red",sx:{fontFamily:"monospace"},children:f.columnKey})]})})]})}return r.jsx(o.Select,{ref:d,label:e,description:n,data:p,value:s,onChange:i,required:t,sx:c,maxDropdownHeight:500,...u})}));function R_({context:e}){const{value:t,set:n}=Q(e.instanceData,"config"),s=v.defaults({},t,go),{control:i,handleSubmit:a,reset:l}=b.useForm({defaultValues:s});return g.useEffect(()=>{l(s)},[t]),t?r.jsx(o.Stack,{spacing:"xs",children:r.jsxs("form",{onSubmit:a(n),children:[r.jsx(o.Text,{children:"X Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"x_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Y Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"y_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Z Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"z_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:r.jsxs(o.Button,{color:"blue",type:"submit",children:[r.jsx(W.DeviceFloppy,{size:20}),r.jsx(o.Text,{ml:"md",children:"Save"})]})})]})}):null}const Q_=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function U_(e,{panelModel:t}){try{const n=t.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const s=u=>u&&`${n}.${u}`,{x_axis_data_key:i,y_axis_data_key:a,z_axis_data_key:l,...c}=e;return{...c,x_axis_data_key:s(i),y_axis_data_key:s(a),z_axis_data_key:s(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class Y_ extends Me{constructor(){super(...arguments);N(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,s)=>{const{config:i}=n;return{...n,version:2,config:U_(i,s)}})}}const K_={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new Y_,name:"bar-3d",viewRender:W_,configRender:R_,createConfig(){return{version:2,config:v.cloneDeep(go)}},translation:Q_},X_=({disabled:e,value:t,onChange:n})=>{const s=i=>{i&&n(i)};return r.jsxs(o.Box,{sx:{position:"relative"},children:[e&&r.jsx(o.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),r.jsx(gt,{height:"500px",defaultLanguage:"javascript",value:t,onChange:s,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})};function pt({enabled:e,func_content:t}){return(n,s)=>{if(!e)return n;try{return new Function(`return ${t}`)()(n,s)}catch(i){return console.error(`[getEchartsXAxisLabel] failed parsing custom function, error: ${i.message}`),n}}}function nt(){return{enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
92
+ `)(n)}catch(s){return console.error(s),console.log(e),e}}function Np(e,t,n,s){const i=w_(t,s);return e.replaceAll(/(\{\{([^{\}]+(?=}))\}\})/g,(...l)=>{const c=l[2];if(!c)return c;const u=i[c];if(u)return u;const d=C_(c);return S_(d,i,n)})}function k_(e,t){const n=xc.decode(t);n!==e&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:e,after:t,v:n}),console.groupEnd())}async function T_({query:e,name:t,payload:n,additionals:s},i){if(!e.sql)return[];const{type:a,key:l,sql:c,pre_process:u,post_process:d}=e,h=Di(c,n),p=Wm({sql:h,pre_process:u}),f=xc.encode(p);k_(p,f);let m=await Kt.query(i)({type:a,key:l,query:f,...s},{params:{name:t}});return m=Rm(d,m,po(n)),m}async function D_({type:e,key:t,configString:n,name:s,additionals:i},a){try{return await Kt.httpDataSourceQuery(a)({type:e,key:t,query:n,...i},{params:{name:s}})}catch(l){if(Rt.isCancel(l))throw l;return console.error(l),l}}async function ho(){try{return(await Kt.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(e){return console.error(e),[]}}async function $p(){try{return(await Kt.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(e){return console.error(e),[]}}class Fp{constructor(t){N(this,"rootRef");this.rootRef=ae.observable({current:t})}async deleteItem(t){ae.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const n=this.getValueFromRoot(t);return Promise.resolve(n)}getValueFromRoot(t){return t===null?ae.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,n){if(t===null)if(v.isObject(n))ae.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else ae.runInAction(()=>{v.set(this.rootRef.current,[t],n)});return Promise.resolve(this.getItem(t))}watchItem(t,n,s){return ae.reaction(()=>this.getValueFromRoot(t),(i,a)=>{n(i,a)},{requiresObservable:!0,fireImmediately:v.get(s,"fireImmediately",!1)})}}class M_{constructor(){N(this,"channels",new Map);N(this,"globalChannel",new yc)}getChannel(t){const n=this.channels.get(t);if(n)return n;const s=new yc;return this.channels.set(t,s),s}}class I_{constructor(t){N(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 n=this.instances.get(t.id);if(n)return n;const s={id:t.id,name:t.viz.type,type:t.viz.type,messageChannels:new M_,instanceData:new Fp(t.viz.conf)};return this.instances.set(t.id,s),s}}function Gp(e,t,n,s){return{vizManager:n,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new Fp({}),colorPalette:{getColor(){return()=>""}},data:t,variables:s}}const z_=e=>{const{panel:t,measure:n,vizManager:s,data:i,variables:a}=e,l=s.resolveComponent(t.viz.type),c=s.getOrCreateInstance(t),u={...Gp(c,i,s,a),viewport:{width:n.w,height:n.h}},d=l.viewRender;return r.jsx(d,{context:u,instance:c,...v.omit(e,["panel","vizManager","data"])})},E_=e=>{const{vizManager:t,panel:n,data:s,variables:i}=e,a=t.resolveComponent(n.viz.type),l=t.getOrCreateInstance(n),c={...Gp(l,s,t,i)},u=a.configRender;return r.jsx(u,{context:c,instance:l,...v.omit(e,["panel","vizManager","data"])})},Wp=(e,t)=>{const n=Ut.bezier(e),s=Ut.bezier(t);return function(i){return i<50?n(i*2/100).hex():s((i-50)*2/100).hex()}},Js=e=>{const t=Ut.bezier(e);return function(n){return t(n/100).hex()}},A_={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:Wp(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},P_={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:Wp(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},O_={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:Js(["#fff7f1","darkred"]),name:"red",category:"sequential"},L_={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:Js(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},V_={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:Js(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},B_={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:Js(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class q_{constructor(t){N(this,"symbol");this.symbol=Symbol(t)}}function hn(e){return new q_(e)}class fo{constructor(){N(this,"parent");N(this,"factoryRegistry",new Map);N(this,"instanceRegistry",new Map)}createScoped(){const t=new fo;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 n=this.factoryRegistry.get(t.symbol);if(n){const s=n(this);return this.instanceRegistry.set(t.symbol,s),s}if(this.parent)return this.parent.get(t)}provideFactory(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,n),this}provideValue(t,n){return this.factoryRegistry.has(t.symbol)?console.warn(`Token ${t.symbol.toString()} is already registered`):this.factoryRegistry.set(t.symbol,()=>n),this}dispose(){this.instanceRegistry.forEach(t=>{const n=v.get(t,"dispose");v.isFunction(n)&&n.bind(t)()}),this.instanceRegistry.clear(),this.factoryRegistry.clear()}}const Rp="13.28.1",N_=Object.freeze(Object.defineProperty({__proto__:null,version:Rp},Symbol.toStringTag,{value:"Module"}));class $_{constructor(t){N(this,"staticColors",new Map);N(this,"interpolations",new Map);t.installedPlugins.forEach(n=>{n.manifest.color.forEach(s=>{this.register(s)})})}getStaticColors(){return Array.from(this.staticColors.values())}register(t){const n=this.encodeColor(t);t.type==="single"?(this.staticColors.has(n)&&console.warn(`the color '${t.name}' has been registered under '${t.category}', previous registered value will be overridden`),this.staticColors.set(n,t)):t.type==="interpolation"&&(this.interpolations.has(n)&&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(n,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 F_{constructor(){N(this,"plugins",new Map);N(this,"vizComponents",new Map);N(this,"factory",{viz:t=>{const n=this.vizComponents.get(t);if(n)return n;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 n of t.manifest.viz){if(this.vizComponents.has(n.name))throw new Error(`Viz Component (${n.name}) has been installed before`);this.vizComponents.set(n.name,n)}}get installedPlugins(){return Array.from(this.plugins.values())}}class G_{constructor(){N(this,"migrations",[])}version(t,n){return this.migrations.push({version:t,handler:n}),this}run(t,n,s){var l;if(t.from===t.to)return n;if(t.from>t.to)throw new Error(`Can not downgrade from version '${t.from}' to (${t.to})`);const i=this.migrations.filter(c=>c.version>t.from&&c.version<=t.to),a=v.orderBy(i,"version","asc");if(((l=v.last(a))==null?void 0:l.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return a.reduce((c,u)=>u.handler(c,s),n)}}class Me extends G_{constructor(){super(),this.configVersions()}version(t,n){return super.version(t,(s,i)=>({version:t,...n(s,i)}))}async migrate({configData:t,panelModel:n}){const s=await t.getItem(null),i=v.get(s,"version",0),a=this.run({from:i,to:this.VERSION},s,{panelModel:n});await t.setItem(null,a)}async needMigration({configData:t}){const n=await t.getItem(null);return v.get(n,"version",0)<this.VERSION}}const Q=(e,t)=>{const[n,{setFalse:s}]=J.useBoolean(!0),[i,a]=g.useState();g.useEffect(()=>(e.getItem(t).then(c=>{a(c),s()}),e.watchItem(t,c=>{a(c)})));const l=g.useCallback(async c=>{await e.setItem(t,c),a(c)},[e,t]);return{loading:n,value:i,set:l}},ut={top:16,right:16,bottom:16,left:16},Bt=e=>Math.max(0,e-ut.left-ut.right),qt=e=>Math.max(0,e-ut.top-ut.bottom),Jr=(e,t)=>({width:Bt(e),height:qt(t)}),dt=({width:e,height:t,children:n})=>r.jsx(o.Box,{pt:ut.top,pr:ut.right,pb:ut.bottom,pl:ut.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:n}),go={x_axis_data_key:"",y_axis_data_key:"",z_axis_data_key:"",xAxis3D:{type:"value",name:"X Axis Name"},yAxis3D:{type:"value",name:"Y Axis Name"},zAxis3D:{type:"value",name:"Z Axis Name"}};function W_({context:e}){const{value:t}=Q(e.instanceData,"config"),n=e.data,{width:s,height:i}=e.viewport,{x_axis_data_key:a,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:h}=v.defaults({},t,go),p=g.useMemo(()=>cs(n,a),[n,a]),{x:f,y:m,z:y}=g.useMemo(()=>({x:L(a),y:L(l),z:L(c)}),[a,l,c]),{min:_,max:k}=g.useMemo(()=>{const T=v.minBy(p,z=>z[y.columnKey]),I=v.maxBy(p,z=>z[y.columnKey]);return{min:v.get(T,y.columnKey),max:v.get(I,y.columnKey)}},[p,y]),S={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:_,max:k,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:h,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:p.map(T=>[T[f.columnKey],T[m.columnKey],T[y.columnKey]])}]};return t?r.jsx(dt,{width:s,height:i,children:r.jsx(Ke,{echarts:Ye,option:S,style:Jr(s,i),notMerge:!0,theme:"merico-light"})}):null}const U=D.observer(g.forwardRef(({label:e,required:t,description:n,value:s,onChange:i,queryID:a,clearable:l=!1,sx:c,...u},d)=>{const{panel:h}=Je(),p=g.useMemo(()=>h.dataFieldOptions(s,l,a),[s,l,a]);if(p.length===0){const f=h.explainDataKey(s);return r.jsxs(o.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[r.jsx(o.HoverCard.Target,{children:r.jsx(o.Box,{children:r.jsx(o.TextInput,{label:e,required:t,defaultValue:f.columnKey,readOnly:!0,disabled:!0})})}),r.jsx(o.HoverCard.Dropdown,{children:r.jsxs(o.Group,{position:"left",spacing:0,children:[r.jsx(o.Text,{size:"xs",color:f.queryName?"black":"red",sx:{fontFamily:"monospace"},children:f.queryName??f.queryID}),r.jsx(o.Text,{size:"xs",color:"black",sx:{fontFamily:"monospace"},children:"."}),r.jsx(o.Text,{size:"xs",color:"red",sx:{fontFamily:"monospace"},children:f.columnKey})]})})]})}return r.jsx(o.Select,{ref:d,label:e,description:n,data:p,value:s,onChange:i,required:t,sx:c,maxDropdownHeight:500,...u})}));function R_({context:e}){const{value:t,set:n}=Q(e.instanceData,"config"),s=v.defaults({},t,go),{control:i,handleSubmit:a,reset:l}=b.useForm({defaultValues:s});return g.useEffect(()=>{l(s)},[t]),t?r.jsx(o.Stack,{spacing:"xs",children:r.jsxs("form",{onSubmit:a(n),children:[r.jsx(o.Text,{children:"X Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"x_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Y Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"y_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Text,{mt:"lg",children:"Z Axis"}),r.jsxs(o.Group,{position:"apart",grow:!0,p:"md",sx:{position:"relative",border:"1px solid #eee"},children:[r.jsx(b.Controller,{name:"z_axis_data_key",control:i,render:({field:c})=>r.jsx(U,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>r.jsx(o.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(o.Group,{position:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:r.jsxs(o.Button,{color:"blue",type:"submit",children:[r.jsx(W.DeviceFloppy,{size:20}),r.jsx(o.Text,{ml:"md",children:"Save"})]})})]})}):null}const Q_=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function U_(e,{panelModel:t}){try{const n=t.queryIDs[0];if(!n)throw new Error("cannot migrate when queryID is empty");const s=u=>u&&`${n}.${u}`,{x_axis_data_key:i,y_axis_data_key:a,z_axis_data_key:l,...c}=e;return{...c,x_axis_data_key:s(i),y_axis_data_key:s(a),z_axis_data_key:s(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class Y_ extends Me{constructor(){super(...arguments);N(this,"VERSION",2)}configVersions(){this.version(1,n=>({version:1,config:n})),this.version(2,(n,s)=>{const{config:i}=n;return{...n,version:2,config:U_(i,s)}})}}const K_={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new Y_,name:"bar-3d",viewRender:W_,configRender:R_,createConfig(){return{version:2,config:v.cloneDeep(go)}},translation:Q_},X_=({disabled:e,value:t,onChange:n})=>{const s=i=>{i&&n(i)};return r.jsxs(o.Box,{sx:{position:"relative"},children:[e&&r.jsx(o.Overlay,{opacity:.6,color:"#fff",zIndex:5,blur:2}),r.jsx(gt,{height:"500px",defaultLanguage:"javascript",value:t,onChange:s,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})};function pt({enabled:e,func_content:t}){return(n,s)=>{if(!e)return n;try{return new Function(`return ${t}`)()(n,s)}catch(i){return console.error(`[getEchartsXAxisLabel] failed parsing custom function, error: ${i.message}`),n}}}function nt(){return{enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
93
93
  `)}}const Nt=g.forwardRef(({value:e,onChange:t,triggerButtonText:n},s)=>{const{t:i}=j.useTranslation(),[a,{setTrue:l,setFalse:c}]=J.useBoolean(),[u,d]=g.useState(e);g.useEffect(()=>{d(e)},[e]);const h=k=>{d({...u,enabled:k})},p=()=>{c();const{enabled:k,func_content:S}=u,T={enabled:k,func_content:S};d(T),t(T)},f=()=>{c(),d(e)},m=k=>{d(S=>({...S,func_content:k}))},y=()=>{m(nt().func_content)},_=n??i("chart.axis.customize_label");return r.jsxs(r.Fragment,{children:[r.jsx(o.Button,{variant:"filled",color:"grape",leftIcon:r.jsx(M.IconMathFunction,{size:16}),mt:24,onClick:l,sx:{flexGrow:0},children:_}),r.jsx(o.Modal,{size:800,title:_,opened:a,onClose:c,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:a&&r.jsxs(o.Stack,{children:[r.jsx(o.Checkbox,{mt:10,label:i("common.enabled"),checked:u.enabled,onChange:k=>h(k.currentTarget.checked)}),r.jsx(X_,{value:u.func_content,onChange:m,disabled:!u.enabled}),r.jsxs(o.Group,{position:"apart",children:[r.jsx(o.Button,{onClick:y,color:"red",leftIcon:r.jsx(W.Recycle,{size:20}),children:i("common.actions.reset_to_default")}),r.jsxs(o.Group,{position:"right",children:[r.jsx(o.Button,{onClick:f,variant:"subtle",children:i("common.actions.cancel")}),r.jsx(o.Button,{color:"green",leftIcon:r.jsx(M.IconDeviceFloppy,{size:16}),onClick:p,children:i("common.actions.save")})]})]})]})})]})}),$n={x_axis_scroll:!1,y_axis_scroll:!1,x_axis_slider:!1,y_axis_slider:!1};function Qp(){return v.cloneDeep($n)}const J_=[{lang:"en",resources:{boxplot:{viz_name:"Boxplot Chart",box:"Box",outlier:"Outlier",scatter:"Scatter",click_series:{label:"Click box, scatter or outlier"}}}},{lang:"zh",resources:{boxplot:{viz_name:"箱线图",box:"箱体",outlier:"异常点",scatter:"散点",click_series:{label:"点击箱体、散点或异常点"}}}}],Up={id:"builtin:echarts:click-echart:series",displayName:"viz.boxplot.click_series.label",nameRender:H_,configRender:Z_,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 Z_(e){return r.jsx(r.Fragment,{})}function H_(e){const{t}=j.useTranslation();return r.jsx(o.Text,{children:t("viz.boxplot.click_series.label")})}const Zs=g.forwardRef(({sectionTitle:e,value:t,onChange:n},s)=>{const{t:i,i18n:a}=j.useTranslation(),l=u=>d=>{const h=v.cloneDeep(t);v.set(h,u,d),n(h)},c=g.useMemo(()=>[{label:i("chart.axis.overflow.truncate"),value:"truncate"},{label:i("chart.axis.overflow.break_line"),value:"break"},{label:i("chart.axis.overflow.break_word"),value:"breakAll"}],[a.language]);return r.jsxs(o.Stack,{spacing:0,children:[e&&r.jsx(o.Divider,{mb:-5,mt:5,variant:"dotted",label:e,labelPosition:"right",labelProps:{color:"dimmed"}}),r.jsxs(o.Group,{grow:!0,noWrap:!0,children:[r.jsx(o.NumberInput,{label:i("chart.axis.overflow.max_width"),hideControls:!0,value:t.width,onChange:l("width")}),r.jsx(o.Select,{label:i("chart.axis.overflow.label"),data:c,value:t.overflow,onChange:l("overflow")}),r.jsx(o.TextInput,{label:i("chart.axis.overflow.ellipsis"),value:t.ellipsis,disabled:!0})]})]})}),$t=g.forwardRef(({value:e,onChange:t},n)=>{const{t:s}=j.useTranslation(),i=l=>{t({...e,on_axis:l})},a=l=>{t({...e,in_tooltip:l})};return r.jsxs(o.Stack,{ref:n,spacing:0,children:[r.jsx(Zs,{sectionTitle:s("chart.axis.overflow.section_title.on_axis"),value:e.on_axis,onChange:i}),r.jsx(Zs,{sectionTitle:s("chart.axis.overflow.section_title.in_tooltip"),value:e.in_tooltip,onChange:a})]})});function ht(){return{on_axis:{width:80,overflow:"truncate",ellipsis:"..."},in_tooltip:{width:200,overflow:"break",ellipsis:"..."}}}function Dt({overflow:e,width:t}){const n={truncate:"initial",break:"break-all",breakAll:"break-word"}[e],s=e==="truncate"?"nowrap":"initial",i={truncate:"ellipsis",break:"clip",breakAll:"clip"}[e];return`
94
94
  max-width: ${t}px;
95
95
  word-break: ${n};