@devtable/dashboard 13.43.2 → 13.43.3

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.
@@ -903,8 +903,8 @@ class uy {
903
903
  return Sn(c).then((d) => o ? d : d.data).catch((d) => {
904
904
  if (Sn.isCancel(d))
905
905
  return Promise.reject(d);
906
- const u = S.get(d, "response.data.detail.message", d.message);
907
- return Promise.reject(new Error(u));
906
+ const u = d, h = S.get(u, "response.data.detail.message", u.message);
907
+ return Promise.reject(new Error(h));
908
908
  });
909
909
  };
910
910
  }
@@ -6512,7 +6512,7 @@ class hl {
6512
6512
  }), this.instanceRegistry.clear(), this.factoryRegistry.clear();
6513
6513
  }
6514
6514
  }
6515
- const Gp = "13.43.2", Qj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6515
+ const Gp = "13.43.3", Qj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6516
6516
  __proto__: null,
6517
6517
  version: Gp
6518
6518
  }, Symbol.toStringTag, { value: "Module" }));
@@ -56,7 +56,7 @@ React keys must be passed directly to JSX without using spread:
56
56
  ${Cf.map(Sf).join("")}
57
57
  </tbody>
58
58
  </table>
59
- `;function Us(e,t){const n=Object.keys(t),s=Object.values(t);try{return new Function(...n,`return \`${e}\`;`)(...s)}catch(i){throw n.length===0&&e.includes("$")?new Error("[formatSQL] insufficient payload"):i}}function Ys(e,t){try{return Us(e,t)}catch(n){return console.error(n),n.message}}function kf({sql:e,pre_process:t}){if(!t.trim())return e;try{return new Function(`return ${t}`)()({sql:e},Tt)}catch(n){throw console.error(n),n}}function Df(e,t,n){if(!e.trim())return t;try{return new Function(`return ${e}`)()(t,Tt,n)}catch(s){throw console.error(s),s}}function zf(e){e=e||{};const t=Object.keys(e).sort(),n=[];for(let s=0;s<t.length;s++){const i=t[s];if(i!="authentication"&&e[i])n.push(t[s]+"="+(typeof e[i]=="object"?JSON.stringify(e[i]):e[i]));else{const o=Object.keys(e[i]).sort();for(let l=0;l<o.length;l++){const c=o[l];c!="sign"&&e[i][c]&&n.push(o[l]+"="+(typeof e[i][c]=="object"?JSON.stringify(e[i][c]):e[i][c]))}}}return n.sort().join("&")}function If(e,t){let n=zf(e);return n+="&key="+t,yf.MD5(n).toString().toUpperCase()}class Sl{constructor(){this.type="default_api_client",this.baseURL="http://localhost:31200",this.app_id="",this.app_secret=""}getAuthentication(t){if(!this.app_id||!this.app_secret)return;const n=new Date().getTime().toString();return{app_id:this.app_id,nonce_str:n,sign:If({app_id:this.app_id,nonce_str:n,...t},this.app_secret)}}getRequest(t,n){return(s,i,o,l)=>{const c=this.buildHeader(o),u=this.buildAxiosConfig(t,s,i,o,c,n);return Ot(u).then(d=>l?d:d.data).catch(d=>{if(Ot.isCancel(d))return Promise.reject(d);const p=v.get(d,"response.data.detail.message",d.message);return Promise.reject(new Error(p))})}}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}buildAxiosConfig(t,n,s,i,o,l){const c={baseURL:this.baseURL,method:t,url:n,params:t==="GET"?s:i.params,headers:o,signal:l};return["POST","PUT"].includes(t)&&(c.data=i.string?JSON.stringify(s):s,c.data.authentication=this.getAuthentication(c.data)),c}buildHeader(t){const n=window.localStorage.getItem("token");return{"X-Requested-With":"XMLHttpRequest","Content-Type":t.string?"application/x-www-form-urlencoded":"application/json",authorization:n?`bearer ${n}`:"",...t.headers}}}class Mf{constructor(t){this.implementation=t}getRequest(t,n){return this.implementation.getRequest(t,n)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}class Tl extends Sl{constructor(){super(...arguments);N(this,"makeQueryENV",null)}query(n){return async(s,i={})=>{var o;return s.env||(s.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.post(n)("/query",s,i)}}httpDataSourceQuery(n){return async(s,i={})=>{var o;return s.env||(s.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.getRequest("POST",n)("/query",s,i,!0)}}structure(n){return async(s,i={})=>this.post(n)("/query/structure",s,i)}}class kl{constructor(t){this.implementation=t}query(t){return this.implementation.query(t)}httpDataSourceQuery(t){return this.implementation.httpDataSourceQuery(t)}structure(t){return this.implementation.structure(t)}getRequest(t,n){return this.implementation.getRequest(t,n)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}const In=new Tl;function Ks(e){In.baseURL!==e.apiBaseURL&&(In.baseURL=e.apiBaseURL),e.app_id&&(In.app_id=e.app_id),e.app_secret&&(In.app_secret=e.app_secret),e.makeQueryENV&&(In.makeQueryENV=e.makeQueryENV)}const Dl=new kl(In),Bt=Dl;g.forwardRef(function({value:t,onChange:n,...s},i){return r.jsx(a.TextInput,{ref:i,value:t,onChange:n,...s})});class Ef{constructor({valueRange:t,colorRange:n}){N(this,"mapper");this.mapper=nn.interpolate(t,n)}getColor(t){return this.mapper(t)}}function Af(e,t){if(e.type==="static")return e.staticColor;if(e.type==="continuous")try{const n=Number(t);if(Number.isNaN(n))throw new Error(`[getColorByColorConf] Invalid type of aggregated value: ${t}, parsed: ${n}`);return new Ef(e).getColor(n)}catch(n){return console.error(n),"black"}return"black"}const Pf=Af;function O(e){const[t,n]=e.split(".");return{queryID:t,columnKey:n}}function Lf(e){return e.includes(".")?O(e):{queryID:"",columnKey:e}}function kt(e,t){var i;const{queryID:n,columnKey:s}=O(t);return n?s?((i=e[n])==null?void 0:i.map(o=>o[s]))??[]:e[n]:[]}function Br(e,t){const{queryID:n}=O(t);return n?e[n]:[]}function Of(e){return Object.values(e)[0]}function Nr(e,t){const{queryID:n,columnKey:s}=O(t);return e[s]}const zl=["function aggregation({ queryData }, utils) {",' return "Aggregation Result";',"}"].join(`
59
+ `;function Us(e,t){const n=Object.keys(t),s=Object.values(t);try{return new Function(...n,`return \`${e}\`;`)(...s)}catch(i){throw n.length===0&&e.includes("$")?new Error("[formatSQL] insufficient payload"):i}}function Ys(e,t){try{return Us(e,t)}catch(n){return console.error(n),n.message}}function kf({sql:e,pre_process:t}){if(!t.trim())return e;try{return new Function(`return ${t}`)()({sql:e},Tt)}catch(n){throw console.error(n),n}}function Df(e,t,n){if(!e.trim())return t;try{return new Function(`return ${e}`)()(t,Tt,n)}catch(s){throw console.error(s),s}}function zf(e){e=e||{};const t=Object.keys(e).sort(),n=[];for(let s=0;s<t.length;s++){const i=t[s];if(i!="authentication"&&e[i])n.push(t[s]+"="+(typeof e[i]=="object"?JSON.stringify(e[i]):e[i]));else{const o=Object.keys(e[i]).sort();for(let l=0;l<o.length;l++){const c=o[l];c!="sign"&&e[i][c]&&n.push(o[l]+"="+(typeof e[i][c]=="object"?JSON.stringify(e[i][c]):e[i][c]))}}}return n.sort().join("&")}function If(e,t){let n=zf(e);return n+="&key="+t,yf.MD5(n).toString().toUpperCase()}class Sl{constructor(){this.type="default_api_client",this.baseURL="http://localhost:31200",this.app_id="",this.app_secret=""}getAuthentication(t){if(!this.app_id||!this.app_secret)return;const n=new Date().getTime().toString();return{app_id:this.app_id,nonce_str:n,sign:If({app_id:this.app_id,nonce_str:n,...t},this.app_secret)}}getRequest(t,n){return(s,i,o,l)=>{const c=this.buildHeader(o),u=this.buildAxiosConfig(t,s,i,o,c,n);return Ot(u).then(d=>l?d:d.data).catch(d=>{if(Ot.isCancel(d))return Promise.reject(d);const p=d,h=v.get(p,"response.data.detail.message",p.message);return Promise.reject(new Error(h))})}}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}buildAxiosConfig(t,n,s,i,o,l){const c={baseURL:this.baseURL,method:t,url:n,params:t==="GET"?s:i.params,headers:o,signal:l};return["POST","PUT"].includes(t)&&(c.data=i.string?JSON.stringify(s):s,c.data.authentication=this.getAuthentication(c.data)),c}buildHeader(t){const n=window.localStorage.getItem("token");return{"X-Requested-With":"XMLHttpRequest","Content-Type":t.string?"application/x-www-form-urlencoded":"application/json",authorization:n?`bearer ${n}`:"",...t.headers}}}class Mf{constructor(t){this.implementation=t}getRequest(t,n){return this.implementation.getRequest(t,n)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}class Tl extends Sl{constructor(){super(...arguments);N(this,"makeQueryENV",null)}query(n){return async(s,i={})=>{var o;return s.env||(s.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.post(n)("/query",s,i)}}httpDataSourceQuery(n){return async(s,i={})=>{var o;return s.env||(s.env=((o=this.makeQueryENV)==null?void 0:o.call(this))??{error:"failed to run makeQueryENV"}),this.getRequest("POST",n)("/query",s,i,!0)}}structure(n){return async(s,i={})=>this.post(n)("/query/structure",s,i)}}class kl{constructor(t){this.implementation=t}query(t){return this.implementation.query(t)}httpDataSourceQuery(t){return this.implementation.httpDataSourceQuery(t)}structure(t){return this.implementation.structure(t)}getRequest(t,n){return this.implementation.getRequest(t,n)}get(t){return this.getRequest("GET",t)}post(t){return this.getRequest("POST",t)}put(t){return this.getRequest("PUT",t)}}const In=new Tl;function Ks(e){In.baseURL!==e.apiBaseURL&&(In.baseURL=e.apiBaseURL),e.app_id&&(In.app_id=e.app_id),e.app_secret&&(In.app_secret=e.app_secret),e.makeQueryENV&&(In.makeQueryENV=e.makeQueryENV)}const Dl=new kl(In),Bt=Dl;g.forwardRef(function({value:t,onChange:n,...s},i){return r.jsx(a.TextInput,{ref:i,value:t,onChange:n,...s})});class Ef{constructor({valueRange:t,colorRange:n}){N(this,"mapper");this.mapper=nn.interpolate(t,n)}getColor(t){return this.mapper(t)}}function Af(e,t){if(e.type==="static")return e.staticColor;if(e.type==="continuous")try{const n=Number(t);if(Number.isNaN(n))throw new Error(`[getColorByColorConf] Invalid type of aggregated value: ${t}, parsed: ${n}`);return new Ef(e).getColor(n)}catch(n){return console.error(n),"black"}return"black"}const Pf=Af;function O(e){const[t,n]=e.split(".");return{queryID:t,columnKey:n}}function Lf(e){return e.includes(".")?O(e):{queryID:"",columnKey:e}}function kt(e,t){var i;const{queryID:n,columnKey:s}=O(t);return n?s?((i=e[n])==null?void 0:i.map(o=>o[s]))??[]:e[n]:[]}function Br(e,t){const{queryID:n}=O(t);return n?e[n]:[]}function Of(e){return Object.values(e)[0]}function Nr(e,t){const{queryID:n,columnKey:s}=O(t);return e[s]}const zl=["function aggregation({ queryData }, utils) {",' return "Aggregation Result";',"}"].join(`
60
60
  `),Mn={type:"none",config:{},fallback:"0"};function Vf(e){const t=Array.from(e).sort((s,i)=>s-i),n=Math.floor(t.length/2);return t.length%2===0?(t[n-1]+t[n])/2:t[n]}function qf(e,t){switch(t.type){case"sum":return v.sum(e);case"mean":return v.mean(e);case"median":return Vf(e);case"max":return v.max(e);case"min":return v.min(e);case"quantile":return nr.quantile(e,t.config.p);case"CV":if(e.length===0)return Number.NaN;const n=zn.std(...e),s=zn.mean(...e);return s?n/s:Number.NaN;case"std":return e.length===0?Number.NaN:zn.std(...e);default:return e}}function Xs(e,t){const n=e.map(Number),s=qf(n,t);return typeof s=="number"?Number.isFinite(s)?s:t.fallback:s??t.fallback}function Bf(e,t,n){try{const s=Br(e,t);return new Function(`return ${n.config.func}`)()({queryData:s},Tt)}catch(s){return console.error(s),s.message}}function Nf(e,t,n){try{const s=kt(e,t),{method:i}=n.config;return v[i](s)}catch(s){return console.error(s),n.fallback}}function Js(e,t,n){try{return n.type==="custom"?Bf(e,t,n):n.type==="pick_record"?Nf(e,t,n):Xs(kt(e,t),n)}catch(s){return console.error(s),null}}const Il=g.createContext(null),Zs=Il.Provider;function Hs(){const e=g.useContext(Il);if(!e)throw new Error("Please use DashboardModelContextProvider");return e}const oe=()=>Hs(),Ml=()=>Hs(),El=g.createContext({searchButtonProps:{}}),ei=El.Provider;function Al(){return g.useContext(El)}const Pl=g.createContext(null),ti=Pl.Provider;function Ll(){const e=g.useContext(Pl);if(!e)throw new Error("Please use ContentModelContextProvider");return e}const ne=()=>Ll(),Se=()=>Ll(),$f={inEditMode:!1},$r=g.createContext($f),Ol=g.createContext({panel:null,data:{},loading:!1,errors:[],downloadPanelScreenshot:()=>{}}),ni=Ol.Provider;function ri(){const e=g.useContext(Ol);if(!e.panel)throw new Error("Please use PanelContextProvider");return e}const Xe=()=>ri(),Pe=()=>ri();function Vl(){try{return ri(),!0}catch{return!1}}const ql=()=>Vl(),Bl=()=>Vl(),Gf={fullScreenPanelID:"",setFullScreenPanelID:v.noop},si=g.createContext(Gf);function Nl(){const e=g.useContext(si);if(!e)throw new Error("Please use FullScreenPanelContext.Provider");return e}const Ff={en:"en",zh:"zh-cn"};function ii({children:e}){const{i18n:t}=_.useTranslation(),n=g.useMemo(()=>{const s=t.language;return Ff[s]??"en"},[t.language]);return r.jsx(fl.DatesProvider,{settings:{locale:n,firstDayOfWeek:1},children:e})}const ai={fontSize:"14px",lineHeight:"32px",color:"#3D3E45",ul:{paddingLeft:"2em",margin:"6px 0 0"},p:{margin:"0 !important"},a:{WebkitTapHighlightColor:"transparent",color:"rgb(34, 139, 230)",textDecoration:"none","&:hover":{textDecoration:"underline"},"&:active, &:hover":{outlineWidth:0}},table:{tr:{"th, td":{padding:"0 .5em"}}},"table.rich-text-table-render, div.tableWrapper table":{"th, td":{border:"1px solid #eaeaea"},"tr:last-of-type td":{borderBottom:"1px solid #eaeaea"}},".resize-cursor":{cursor:"col-resize"},details:{summary:{listStyle:"none",cursor:"pointer",transition:"color 300ms ease",userSelect:"none"},"summary::-webkit-details-marker":{display:"none"},"summary:hover":{color:"black","&::before":{opacity:1}},"summary::before":{content:'"►"',fontSize:"10px",margin:"0px 5px",opacity:.5,display:"inline-block",transition:"opacity 300ms ease, transform 300ms ease"}},"details[open] summary::before":{transform:"rotate(90deg)"},"details + details":{marginTop:"10px"},blockquote:{fontSize:"14px",lineHeight:"32px",color:"#3D3E45",margin:"0 0 14px"}},oi="grad_color_",Rf=new RegExp(`^(?!${oi})(.+)$`);function $l(e){return e&&e.replace(Rf,`${oi}$1`)}const Wf=e=>{const n="abcdefghijklmnopqrstuvwxyz",i=`1234567890${n}${n.toUpperCase()}`.split(""),o=new Uint8Array(e);crypto.getRandomValues(o);const l=o.reduce((c,u)=>`${c}${i[u&61]}`,"");return`${oi}${l}`};function Qf(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=jl.range(t,n+s,s);return _f.scaleLinear(i,e)}catch(s){return console.error(s),()=>"inherit"}}function Gl(e,t,n,s){const i=Number(e.getAttribute(n)),o=e.getAttribute(s);if(!o)return i;const l=Number(t[o]);return Number.isFinite(l)?l:i}function Uf(e,t){const n={};return e.querySelectorAll("color-mapping").forEach(i=>{const o=i.getAttribute(dt.color),l=Gl(i,t,dt.min_val,dt.min_var),c=Gl(i,t,dt.max_val,dt.max_var),u=i.getAttribute(dt.variable);if(!o||!Number.isFinite(l)||!Number.isFinite(c)||!u)return;const d=Number(t[u]);if(!Number.isFinite(d))return;const p=o.split(","),h=Qf(p,l,c);n[`#${$l(i.id)}`]={color:h(d)}}),n}function Yf(e){const t=v.get(e,dt.color,[]),n=v.get(e,dt.min_val,""),s=v.get(e,dt.min_var,""),i=v.get(e,dt.max_val,""),o=v.get(e,dt.max_var,""),l=v.get(e,dt.variable,""),c=t.length===0&&[n,s,i,o,l].every(u=>u==="");return{colors:t,min_val:n,min_var:s,max_val:i,max_var:o,variable:l,empty:c}}const Le={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"},dt=Le,Fl="colorMapping",Rl=Rs.Mark.create({name:Fl,addAttributes(){return{id:{default:Wf(6),parseHTML:e=>{const t=e.getAttribute("id");return $l(t)}},[Le.color]:{default:[],parseHTML:e=>{const t=e.getAttribute(Le.color);return t?t.split(","):[]}},[Le.min_val]:{default:0,parseHTML:e=>e.getAttribute(Le.min_val)},[Le.min_var]:{default:"",parseHTML:e=>e.getAttribute(Le.min_var)},[Le.max_val]:{default:100,parseHTML:e=>e.getAttribute(Le.max_val)},[Le.max_var]:{default:"",parseHTML:e=>e.getAttribute(Le.max_var)},[Le.variable]:{default:"",parseHTML:e=>e.getAttribute(Le.variable)}}},parseHTML(){return[{tag:"color-mapping",getAttrs:e=>typeof e=="string"?(console.debug(e),!1):Object.values(dt).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:o,max_var:l,variable:c}=e;return t.setMark(this.name,{[Le.color]:n,[Le.min_val]:s,[Le.min_var]:i,[Le.max_val]:o,[Le.max_var]:l,[Le.variable]:c})},unsetColorMapping:()=>({commands:e})=>e.unsetMark(this.name)}}}),Yt={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 Kf(){Fe.registerTheme("merico-light",{color:Object.values(Yt.graphics.multiple),visualMap:{color:Object.values(Yt.graphics.depth).reverse()},axes:[{type:"all",name:"通用坐标轴",axisLineColor:"#97999D",axisTickColor:"#97999D",axisLabelShow:!0,axisLabelColor:"#818388",splitLineShow:!0,splitLineColor:["#E0E6F1"]}]})}function Wl(){Kf()}function Xf(e){return({option:n,...s})=>{const{aggValue:i,formattedValue:o,label:l}=n,{hovered:c,ref:u}=De.useHover(),d=e==="aggregated"?i:o,p=e==="aggregated"?o:i;return r.jsx(a.Box,{ref:u,...s,children:r.jsxs(a.Group,{wrap:"nowrap",justify:"space-between",children:[r.jsx(a.Text,{size:"sm",sx:{flexGrow:1},children:l}),r.jsx(a.Text,{size:"xs",opacity:c?1:.65,sx:{flexShrink:0},children:c?p:d})]})})}}const Ce=e=>(t,n)=>{t!==null&&e(t,n)},li=z.observer(g.forwardRef((e,t)=>{const{label:n,value:s,onChange:i,description:o,required:l,clearable:c=!0,sx:u,preview:d="formatted",zIndex:p=340}=e;_.useTranslation();const{panel:h}=Pe(),x=g.useMemo(()=>h.variableOptions(s,c),[s,c]);return x.length===0?r.jsx(a.TextInput,{ref:t,label:n,placeholder:s,readOnly:!0,disabled:!0}):r.jsx(a.Select,{ref:t,label:n,description:o,renderOption:Xf(d),data:x,value:s,required:l,sx:u,maxDropdownHeight:500,comboboxProps:{withinPortal:!0,zIndex:p},onChange:Ce(i)})}));var Jf=Symbol.for("preact-signals");function Gr(){if(an>1)an--;else{for(var e,t=!1;ir!==void 0;){var n=ir;for(ir=void 0,ci++;n!==void 0;){var s=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Ul(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=s}}if(ci=0,an--,t)throw e}}function Kt(e){if(an>0)return e();an++;try{return e()}finally{Gr()}}var ge=void 0;function En(e){var t=ge;ge=void 0;try{return e()}finally{ge=t}}var ir=void 0,an=0,ci=0,Fr=0;function Ql(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 We(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}We.prototype.brand=Jf,We.prototype.h=function(){return!0},We.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)},We.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)}},We.prototype.subscribe=function(e){var t=this;return He(function(){var n=t.value,s=ge;ge=void 0;try{e(n)}finally{ge=s}})},We.prototype.valueOf=function(){return this.value},We.prototype.toString=function(){return this.value+""},We.prototype.toJSON=function(){return this.value},We.prototype.peek=function(){var e=ge;ge=void 0;try{return this.value}finally{ge=e}},Object.defineProperty(We.prototype,"value",{get:function(){var e=Ql(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ci>100)throw new Error("Cycle detected");this.v=e,this.i++,Fr++,an++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Gr()}}}});function Rr(e){return new We(e)}function Ul(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 Yl(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 Kl(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 An(e){We.call(this,void 0),this.x=e,this.s=void 0,this.g=Fr-1,this.f=4}(An.prototype=new We).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Fr))return!0;if(this.g=Fr,this.f|=1,this.i>0&&!Ul(this))return this.f&=-2,!0;var e=ge;try{Yl(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,Kl(this),this.f&=-2,!0},An.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)}We.prototype.S.call(this,e)},An.prototype.U=function(e){if(this.t!==void 0&&(We.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)}},An.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(An.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ql(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Xl(e){return new An(e)}function Jl(e){var t=e.u;if(e.u=void 0,typeof t=="function"){an++;var n=ge;ge=void 0;try{t()}catch(s){throw e.f&=-2,e.f|=8,ui(e),s}finally{ge=n,Gr()}}}function ui(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Jl(e)}function Zf(e){if(ge!==this)throw new Error("Out-of-order effect");Kl(this),ge=e,this.f&=-2,8&this.f&&ui(this),Gr()}function ar(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}ar.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()}},ar.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Jl(this),Yl(this),an++;var e=ge;return ge=this,Zf.bind(this,e)},ar.prototype.N=function(){2&this.f||(this.f|=2,this.o=ir,ir=this)},ar.prototype.d=function(){this.f|=8,1&this.f||ui(this)};function He(e){var t=new ar(e);try{t.c()}catch(n){throw t.d(),n}return t.d.bind(t)}function Wr(e,t){if(t){let n;return Xl(()=>{const s=e();return s&&n&&t(n,s)?n:(n=s,s)})}return Xl(e)}function di(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)=>!di(s,t[i]));try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function _e({get:e},t){return{init(n){return Rr(n)},get(){return e.call(this).value},set(n){const s=e.call(this);s.peek()!==n&&(s.value=n)}}}function Qr(e,t){const n=new WeakMap;return function(){let s=n.get(this);return s||(s=Wr(e.bind(this)),n.set(this,s)),s.value}}function Hf(...e){const t=e.map(He);return()=>t.forEach(n=>n())}var ex=Object.create,pi=Object.defineProperty,tx=Object.getOwnPropertyDescriptor,Zl=Object.getOwnPropertySymbols,nx=Object.prototype.hasOwnProperty,rx=Object.prototype.propertyIsEnumerable,Hl=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Pn=e=>{throw TypeError(e)},ec=Math.pow,hi=(e,t,n)=>t in e?pi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sx=(e,t)=>{for(var n in t||(t={}))nx.call(t,n)&&hi(e,n,t[n]);if(Zl)for(var n of Zl(t))rx.call(t,n)&&hi(e,n,t[n]);return e},tc=(e,t)=>pi(e,"name",{value:t,configurable:!0}),ix=e=>{var t;return[,,,ex((t=e==null?void 0:e[Hl("metadata")])!=null?t:null)]},nc=["class","method","getter","setter","accessor","field","value","get","set"],or=e=>e!==void 0&&typeof e!="function"?Pn("Function expected"):e,ax=(e,t,n,s,i)=>({kind:nc[e],name:t,metadata:s,addInitializer:o=>n._?Pn("Already initialized"):i.push(or(o||null))}),rc=(e,t)=>hi(t,Hl("metadata"),e[3]),_n=(e,t,n,s)=>{for(var i=0,o=e[t>>1],l=o&&o.length;i<l;i++)t&1?o[i].call(n):s=o[i].call(n,s);return s},lr=(e,t,n,s,i,o)=>{var l,c,u,d,p,h=t&7,x=!!(t&8),y=!!(t&16),m=h>3?e.length+1:h?x?1:2:0,j=nc[h+5],k=h>3&&(e[m-1]=[]),T=e[m]||(e[m]=[]),D=h&&(!y&&!x&&(i=i.prototype),h<5&&(h>3||!y)&&tx(h<4?i:{get[n](){return sc(this,o)},set[n](M){return ic(this,o,M)}},n));h?y&&h<4&&tc(o,(h>2?"set ":h>1?"get ":"")+n):tc(i,n);for(var I=s.length-1;I>=0;I--)d=ax(h,n,u={},e[3],T),h&&(d.static=x,d.private=y,p=d.access={has:y?M=>ox(i,M):M=>n in M},h^3&&(p.get=y?M=>(h^1?sc:lx)(M,i,h^4?o:D.get):M=>M[n]),h>2&&(p.set=y?(M,A)=>ic(M,i,A,h^4?o:D.set):(M,A)=>M[n]=A)),c=(0,s[I])(h?h<4?y?o:D[j]:h>4?void 0:{get:D.get,set:D.set}:i,d),u._=1,h^4||c===void 0?or(c)&&(h>4?k.unshift(c):h?y?o=c:D[j]=c:i=c):typeof c!="object"||c===null?Pn("Object expected"):(or(l=c.get)&&(D.get=l),or(l=c.set)&&(D.set=l),or(l=c.init)&&k.unshift(l));return h||rc(e,i),D&&pi(i,n,D),y?h^4?o:D:i},gi=(e,t,n)=>t.has(e)||Pn("Cannot "+n),ox=(e,t)=>Object(t)!==t?Pn('Cannot use the "in" operator on this value'):e.has(t),sc=(e,t,n)=>(gi(e,t,"read from private field"),n?n.call(e):t.get(e)),fi=(e,t,n)=>t.has(e)?Pn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ic=(e,t,n,s)=>(gi(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),lx=(e,t,n)=>(gi(e,t,"access private method"),n),Xt=class Ho{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new Ho(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 Ho(t,n)}},cx=class Fs{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:o,height:l,scale:c}=this,u=new Fs(i+t,s+n,o,l);return u.scale=sx({},c),u}get boundingRectangle(){const{width:t,height:n,left:s,top:i,right:o,bottom:l}=this;return{width:t,height:n,left:s,top:i,right:o,bottom:l}}get center(){const{left:t,top:n,right:s,bottom:i}=this;return new Xt((t+s)/2,(n+i)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof Fs))return!1;const{left:n,top:s,width:i,height:o}=this;return n===t.left&&s===t.top&&i===t.width&&o===t.height}containsPoint(t){const{top:n,left:s,bottom:i,right:o}=this;return n<=t.y&&t.y<=i&&s<=t.x&&t.x<=o}intersectionArea(t){return t instanceof Fs?ux(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 ux(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),o=Math.min(t.top+t.height,e.top+e.height),l=i-s,c=o-n;return s<i&&n<o?l*c:0}var ac=10,oc,lc,cc,uc,dc,et,xi,mi,bi;dc=[_e],uc=[_e],cc=[_e],lc=[Qr],oc=[Qr];var Ln=class{constructor(e){_n(et,5,this),fi(this,xi,_n(et,8,this)),_n(et,11,this),fi(this,mi,_n(et,12,this)),_n(et,15,this),fi(this,bi,_n(et,16,this)),_n(et,19,this);const t=Xt.from(e);this.initial=t,this.current=t,this.previous=t}get delta(){return Xt.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=Xt.from(e);Kt(()=>{this.current=t,this.previous=t,this.initial=t})}update(e){const{current:t}=this,n=Xt.from(e);if(Xt.equals(t,n))return;const s={x:n.x-t.x,y:n.y-t.y};(Math.abs(s.x)<ac||Math.abs(s.y)<ac)&&(this.previous=t),this.current=n}};et=ix(null),xi=new WeakMap,mi=new WeakMap,bi=new WeakMap,lr(et,4,"initial",dc,Ln,xi),lr(et,4,"previous",uc,Ln,mi),lr(et,4,"current",cc,Ln,bi),lr(et,2,"delta",lc,Ln),lr(et,2,"direction",oc,Ln),rc(et,Ln);function yi({x:e,y:t},n){const s=Math.abs(e),i=Math.abs(t);return typeof n=="number"?Math.sqrt(ec(s,2)+ec(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 pc=(e=>(e.Horizontal="x",e.Vertical="y",e))(pc||{}),hc=Object.values(pc),dx=Object.create,vi=Object.defineProperty,px=Object.getOwnPropertyDescriptor,gc=Object.getOwnPropertySymbols,hx=Object.prototype.hasOwnProperty,gx=Object.prototype.propertyIsEnumerable,fc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),On=e=>{throw TypeError(e)},fx=(e,t,n)=>t in e?vi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xc=(e,t)=>vi(e,"name",{value:t,configurable:!0}),mc=(e,t)=>{var n={};for(var s in e)hx.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&gc)for(var s of gc(e))t.indexOf(s)<0&&gx.call(e,s)&&(n[s]=e[s]);return n},Ur=e=>{var t;return[,,,dx((t=e==null?void 0:e[fc("metadata")])!=null?t:null)]},bc=["class","method","getter","setter","accessor","field","value","get","set"],cr=e=>e!==void 0&&typeof e!="function"?On("Function expected"):e,xx=(e,t,n,s,i)=>({kind:bc[e],name:t,metadata:s,addInitializer:o=>n._?On("Already initialized"):i.push(cr(o||null))}),ur=(e,t)=>fx(t,fc("metadata"),e[3]),ve=(e,t,n,s)=>{for(var i=0,o=e[t>>1],l=o&&o.length;i<l;i++)t&1?o[i].call(n):s=o[i].call(n,s);return s},tt=(e,t,n,s,i,o)=>{var l,c,u,d,p,h=t&7,x=!!(t&8),y=!!(t&16),m=h>3?e.length+1:h?x?1:2:0,j=bc[h+5],k=h>3&&(e[m-1]=[]),T=e[m]||(e[m]=[]),D=h&&(!y&&!x&&(i=i.prototype),h<5&&(h>3||!y)&&px(h<4?i:{get[n](){return Yr(this,o)},set[n](M){return ji(this,o,M)}},n));h?y&&h<4&&xc(o,(h>2?"set ":h>1?"get ":"")+n):xc(i,n);for(var I=s.length-1;I>=0;I--)d=xx(h,n,u={},e[3],T),h&&(d.static=x,d.private=y,p=d.access={has:y?M=>mx(i,M):M=>n in M},h^3&&(p.get=y?M=>(h^1?Yr:bx)(M,i,h^4?o:D.get):M=>M[n]),h>2&&(p.set=y?(M,A)=>ji(M,i,A,h^4?o:D.set):(M,A)=>M[n]=A)),c=(0,s[I])(h?h<4?y?o:D[j]:h>4?void 0:{get:D.get,set:D.set}:i,d),u._=1,h^4||c===void 0?cr(c)&&(h>4?k.unshift(c):h?y?o=c:D[j]=c:i=c):typeof c!="object"||c===null?On("Object expected"):(cr(l=c.get)&&(D.get=l),cr(l=c.set)&&(D.set=l),cr(l=c.init)&&k.unshift(l));return h||ur(e,i),D&&vi(i,n,D),y?h^4?o:D:i},_i=(e,t,n)=>t.has(e)||On("Cannot "+n),mx=(e,t)=>Object(t)!==t?On('Cannot use the "in" operator on this value'):e.has(t),Yr=(e,t,n)=>(_i(e,t,"read from private field"),n?n.call(e):t.get(e)),pt=(e,t,n)=>t.has(e)?On("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ji=(e,t,n,s)=>(_i(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),bx=(e,t,n)=>(_i(e,t,"access private method"),n);function yc(e,t){return{plugin:e,options:t}}function yx(e){return t=>yc(e,t)}function vc(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var _c,dr,wi;_c=[_e];var xt=class{constructor(e,t){this.manager=e,this.options=t,pt(this,wi,ve(dr,8,this,!1)),ve(dr,11,this)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return En(()=>this.disabled)}configure(e){this.options=e}destroy(){}static configure(e){return yc(this,e)}};dr=Ur(null),wi=new WeakMap,tt(dr,4,"disabled",_c,xt,wi),ur(dr,xt);var vx=class extends xt{},pr=(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))(pr||{}),jc,wc,Cc,Sc,nt,Ci,Si,Ti,ki;Sc=[_e],Cc=[_e],wc=[_e],jc=[_e];var jn=class{constructor(e,t){pt(this,Ci,ve(nt,8,this)),ve(nt,11,this),pt(this,Si,ve(nt,12,this)),ve(nt,15,this),pt(this,Ti,ve(nt,16,this)),ve(nt,19,this),pt(this,ki,ve(nt,20,this)),ve(nt,23,this);const{effects:n,id:s,data:i={},disabled:o=!1}=e;let l=s;this.manager=t,this.id=s,this.data=i,this.disabled=o,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)}};nt=Ur(null),Ci=new WeakMap,Si=new WeakMap,Ti=new WeakMap,ki=new WeakMap,tt(nt,4,"manager",Sc,jn,Ci),tt(nt,4,"id",Cc,jn,Si),tt(nt,4,"data",wc,jn,Ti),tt(nt,4,"disabled",jc,jn,ki),ur(nt,jn);var Tc,kc,Dc,Di,hr,Nt,zi,Ii,gr=class extends(Di=jn,Dc=[_e],kc=[_e],Tc=[Qr],Di){constructor(t,n){var s=t,{modifiers:i,type:o,sensors:l}=s,c=mc(s,["modifiers","type","sensors"]);super(c,n),ve(Nt,5,this),pt(this,hr),pt(this,zi,ve(Nt,8,this)),ve(Nt,11,this),pt(this,Ii,ve(Nt,12,this,"idle")),ve(Nt,15,this),this.type=o,this.sensors=l,this.modifiers=i}set modifiers(t){var n;const{manager:s}=this;(n=Yr(this,hr))==null||n.forEach(i=>i.destroy()),s&&ji(this,hr,t==null?void 0:t.map(i=>{const{plugin:o,options:l}=vc(i);return new o(s,l)}))}get modifiers(){return Yr(this,hr)}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())}};Nt=Ur(Di),hr=new WeakMap,zi=new WeakMap,Ii=new WeakMap,tt(Nt,4,"type",Dc,gr,zi),tt(Nt,4,"status",kc,gr,Ii),tt(Nt,2,"isDragSource",Tc,gr),ur(Nt,gr);var zc,Ic,Mc,Ec,Ac,Pc,Mi,Oe,Ei,Ai,Pi,Li,Oi,on=class extends(Mi=jn,Pc=[_e],Ac=[_e],Ec=[_e],Mc=[_e],Ic=[_e],zc=[Qr],Mi){constructor(t,n){var s=t,{accept:i,collisionDetector:o,collisionPriority:l=2,type:c}=s,u=mc(s,["accept","collisionDetector","collisionPriority","type"]);super(u,n),ve(Oe,5,this),pt(this,Ei,ve(Oe,8,this)),ve(Oe,11,this),pt(this,Ai,ve(Oe,12,this)),ve(Oe,15,this),pt(this,Pi,ve(Oe,16,this)),ve(Oe,19,this),pt(this,Li,ve(Oe,20,this)),ve(Oe,23,this),pt(this,Oi,ve(Oe,24,this)),ve(Oe,27,this),this.accept=i,this.collisionDetector=o,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(){}};Oe=Ur(Mi),Ei=new WeakMap,Ai=new WeakMap,Pi=new WeakMap,Li=new WeakMap,Oi=new WeakMap,tt(Oe,4,"accept",Pc,on,Ei),tt(Oe,4,"type",Ac,on,Ai),tt(Oe,4,"collisionDetector",Ec,on,Pi),tt(Oe,4,"collisionPriority",Mc,on,Li),tt(Oe,4,"shape",Ic,on,Oi),tt(Oe,2,"isDropTarget",zc,on),ur(Oe,on);var Kr=class extends xt{constructor(e,t){super(e,t),this.manager=e,this.options=t}},_x=({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=Xt.distance(t.shape.center,n);return{id:s,value:1/i,priority:pr.High}}return null},jx=({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/Xt.distance(t.shape.center,i.current);return{id:t.id,value:l,priority:pr.Normal}}return null},Lc=e=>{var t;return(t=_x(e))!=null?t:jx(e)},wx=e=>{var t;const{dragOperation:n,droppable:s}=e,{shape:i,position:o}=n;if(!s.shape)return null;const c=1/Xt.distance(s.shape.center,(t=i==null?void 0:i.current.center)!=null?t:o.current);return{id:s.id,value:c,priority:pr.Low}};function Oc(e){const{width:t,height:n,top:s,left:i,bottom:o,right:l}=e.getBoundingClientRect();return{width:t,height:n,top:s,left:i,bottom:o,right:l}}var Cx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Vi(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Vc(e){return"nodeType"in e}function Vn(e){var t,n;return e?Vi(e)?e:Vc(e)&&(n=(t=e.ownerDocument)==null?void 0:t.defaultView)!=null?n:window:window}function qc(e){const{Document:t}=Vn(e);return e instanceof t}function Bc(e){return Vi(e)?!1:e instanceof Vn(e).HTMLElement}function fr(e){return e?Vi(e)?e.document:Vc(e)?qc(e)?e:Bc(e)?e.ownerDocument:document:document:document}function Sx(e){const{documentElement:t}=fr(e),n=t.clientWidth,s=t.clientHeight;return{top:0,left:0,right:n,bottom:s,width:n,height:s}}function Tx(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((o,l)=>{const c=s[l];if(Nc(o)&&Nc(c)&&(o.type!=="file"&&(o.value=c.value),o.type==="radio"&&o.name&&(o.name=`Cloned__${o.name}`)),o instanceof HTMLCanvasElement&&c instanceof HTMLCanvasElement&&c.width>0&&c.height>0){const u=o.getContext("2d");u==null||u.drawImage(c,0,0)}}),n}function Nc(e){return"value"in e}function qn(e){return"style"in e&&e.style instanceof Vn(e).CSSStyleDeclaration}function kx(e,t=!1,n){const s=Tx(e);if(qn(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,o]of Object.entries(n))s.setAttribute(i,o);return s}var $c=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:o,listener:l,options:c}=i,u=[e,i];e.addEventListener(o,l,c),this.entries.add(u),s.push(u)}return function(){for(const[o,{type:l,listener:c,options:u}]of s)o.removeEventListener(l,c,u)}}};function qi(e){return"showPopover"in e&&"hidePopover"in e&&typeof e.showPopover=="function"&&typeof e.hidePopover=="function"}function Bi(e){qi(e)&&e.isConnected&&e.hasAttribute("popover")&&e.showPopover()}function Gc(e){return!Cx||!e?!1:e===fr(e).scrollingElement}function Fc(e){const t=Gc(e)?Sx(e):Oc(e),n=Gc(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,o=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:o,isBottom:l,isRight:c}}function Dx(e,t){const{isTop:n,isBottom:s,isLeft:i,isRight:o,position:l}=Fc(e),{x:c,y:u}=t??{x:0,y:0},d=!n&&l.current.y+u>0,p=!s&&l.current.y+u<l.max.y,h=!i&&l.current.x+c>0,x=!o&&l.current.x+c<l.max.x;return{top:d,bottom:p,left:h,right:x,x:h||x,y:d||p}}function zx(e){return e instanceof Vn(e).SVGElement}function ln(e){return Vn(e).getComputedStyle(e)}function Ix(e,t=ln(e)){return t.position==="fixed"||t.position==="sticky"}function Mx(e,t=ln(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})!=null}var Ex={excludeElement:!0};function Xr(e,t=Ex){const{limit:n,excludeElement:s}=t,i=new Set;function o(l){if(n!=null&&i.size>=n||!l)return i;if(qc(l)&&l.scrollingElement!=null&&!i.has(l.scrollingElement))return i.add(l.scrollingElement),i;if(!Bc(l))return zx(l)?o(l.parentElement):i;if(i.has(l))return i;const c=ln(l);if(s&&l===e||Mx(l,c)&&i.add(l),Ix(l,c)){const{scrollingElement:u}=l.ownerDocument;return u&&i.add(u),i}return o(l.parentNode)}return e?o(e):i}function Ax(e){const[t]=Xr(e,{limit:1});return t??null}var mt=(e=>(e[e.Idle=0]="Idle",e[e.Forward=1]="Forward",e[e.Reverse=-1]="Reverse",e))(mt||{}),Px={x:.2,y:.2},Lx={x:10,y:10};function Ox(e,t,n,s=25,i=Px,o=Lx){const{rect:l,isTop:c,isBottom:u,isLeft:d,isRight:p}=Fc(e),h={x:0,y:0},x={x:0,y:0},y={height:l.height*i.y,width:l.width*i.x};return!c&&t.y<=l.top+y.height&&(n==null?void 0:n.y)!==1&&t.x>=l.left-o.x&&t.x<=l.right+o.x?(h.y=-1,x.y=s*Math.abs((l.top+y.height-t.y)/y.height)):!u&&t.y>=l.bottom-y.height&&(n==null?void 0:n.y)!==-1&&t.x>=l.left-o.x&&t.x<=l.right+o.x&&(h.y=1,x.y=s*Math.abs((l.bottom-y.height-t.y)/y.height)),!p&&t.x>=l.right-y.width&&(n==null?void 0:n.x)!==-1&&t.y>=l.top-o.y&&t.y<=l.bottom+o.y?(h.x=1,x.x=s*Math.abs((l.right-y.width-t.x)/y.width)):!d&&t.x<=l.left+y.width&&(n==null?void 0:n.x)!==1&&t.y>=l.top-o.y&&t.y<=l.bottom+o.y&&(h.x=-1,x.x=s*Math.abs((l.left+y.width-t.x)/y.width)),{direction:h,speed:x}}function Vx(e){return"scrollIntoViewIfNeeded"in e&&typeof e.scrollIntoViewIfNeeded=="function"}function Rc(e,t=!1){if(Vx(e)){e.scrollIntoViewIfNeeded(t);return}if(!(e instanceof HTMLElement))return e.scrollIntoView();var[n]=Xr(e,{limit:1});if(!(n instanceof HTMLElement))return;const s=ln(n),i=parseInt(s.getPropertyValue("border-top-width")),o=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-o>n.scrollLeft+n.clientWidth,p=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-o+e.clientWidth/2),(l||c||u||d)&&!t&&e.scrollIntoView(p)}var qx=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))}},Bn=new qx;function Bx(e,t,n){const{scaleX:s,scaleY:i,x:o,y:l}=t,c=e.left-o-(1-s)*parseFloat(n),u=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?e.width/s:e.width,p=i?e.height/i:e.height;return{width:d,height:p,top:u,right:c+d,bottom:u+p,left:c}}var Wc=class{constructor(e){this.element=e,this.initial=new Map}set(e,t=""){const{element:n}=this;if(qn(n))for(const[s,i]of Object.entries(e)){const o=`${t}${s}`;this.initial.has(o)||this.initial.set(o,n.style.getPropertyValue(o)),n.style.setProperty(o,typeof i=="string"?i:`${i}px`)}}remove(e,t=""){const{element:n}=this;if(qn(n))for(const s of e){const i=`${t}${s}`;n.style.removeProperty(i)}}reset(){const{element:e}=this;if(qn(e)){for(const[t,n]of this.initial)e.style.setProperty(t,n);e.getAttribute("style")===""&&e.removeAttribute("style")}}};function Qc({element:e,keyframes:t,options:n,onReady:s,onFinish:i}){const o=new Wc(e),{transitionProperty:l}=ln(e),c=l.split(", ");o.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(),o.reset()})}function Uc(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 Jr(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 Nx(e){const t=Uc(e);if(t){const{translate:s=""}=t;if(typeof s=="string"){const i=Jr(s);if(i)return i}}const{translate:n}=ln(e);if(n){const s=Jr(n);if(s)return s}return{x:0,y:0,z:0}}function $x(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 Yc(e){var t,n,s,i,o,l,c,u,d;const{scale:p,transform:h,translate:x}=e,y=$x(p),m=Jr(x),j=Gx(h);if(!j&&!y&&!m)return null;const k={x:(t=y==null?void 0:y.x)!=null?t:1,y:(n=y==null?void 0:y.y)!=null?n:1},T={x:(s=m==null?void 0:m.x)!=null?s:0,y:(i=m==null?void 0:m.y)!=null?i:0},D={x:(o=j==null?void 0:j.x)!=null?o:0,y:(l=j==null?void 0:j.y)!=null?l:0,scaleX:(c=j==null?void 0:j.scaleX)!=null?c:1,scaleY:(u=j==null?void 0:j.scaleY)!=null?u:1};return{x:T.x+D.x,y:T.y+D.y,z:(d=m==null?void 0:m.z)!=null?d:0,scaleX:k.x*D.scaleX,scaleY:k.y*D.scaleY}}function Gx(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 $t=class extends cx{constructor(e,t=!1){var n,s;let{top:i,left:o,right:l,bottom:c,width:u,height:d}=Oc(e);const p=ln(e),h=Yc(p),x={x:(n=h==null?void 0:h.scaleX)!=null?n:1,y:(s=h==null?void 0:h.scaleY)!=null?s:1},y=Fx(e);if(h&&(t||y)){const m=Bx({top:i,left:o,right:l,bottom:c,width:u,height:d},h,p.transformOrigin);i=m.top,o=m.left,u=m.width,d=m.height}y&&!t&&(i=i+y.y,o=o+y.x,u=u*y.scaleX,d=d*y.scaleY,x.x=y.scaleX,x.y=y.scaleY),super(o,i,u,d),this.scale=x}};function Fx(e){const t=Uc(e);if(t){const{transform:n="",translate:s="",scale:i=""}=t;if(n||s||i)return Yc({transform:typeof n=="string"?n:"",translate:typeof s=="string"?s:"",scale:typeof i=="string"?i:""})}return null}function Zr(e){return e instanceof KeyboardEvent}var Rx=Object.create,Kc=Object.defineProperty,Wx=Object.defineProperties,Qx=Object.getOwnPropertyDescriptor,Ux=Object.getOwnPropertyDescriptors,Hr=Object.getOwnPropertySymbols,Xc=Object.prototype.hasOwnProperty,Jc=Object.prototype.propertyIsEnumerable,Zc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),xr=e=>{throw TypeError(e)},Ni=(e,t,n)=>t in e?Kc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hc=(e,t)=>{for(var n in t||(t={}))Xc.call(t,n)&&Ni(e,n,t[n]);if(Hr)for(var n of Hr(t))Jc.call(t,n)&&Ni(e,n,t[n]);return e},Yx=(e,t)=>Wx(e,Ux(t)),eu=(e,t)=>{var n={};for(var s in e)Xc.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Hr)for(var s of Hr(e))t.indexOf(s)<0&&Jc.call(e,s)&&(n[s]=e[s]);return n},es=e=>{var t;return[,,,Rx((t=e==null?void 0:e[Zc("metadata")])!=null?t:null)]},tu=["class","method","getter","setter","accessor","field","value","get","set"],mr=e=>e!==void 0&&typeof e!="function"?xr("Function expected"):e,Kx=(e,t,n,s,i)=>({kind:tu[e],name:t,metadata:s,addInitializer:o=>n._?xr("Already initialized"):i.push(mr(o||null))}),ts=(e,t)=>Ni(t,Zc("metadata"),e[3]),Qe=(e,t,n,s)=>{for(var i=0,o=e[t>>1],l=o&&o.length;i<l;i++)t&1?o[i].call(n):s=o[i].call(n,s);return s},cn=(e,t,n,s,i,o)=>{for(var l,c,u,d,p,h=t&7,x=!!(t&8),y=!!(t&16),m=e.length+1,j=tu[h+5],k=e[m-1]=[],T=e[m]||(e[m]=[]),D=(i=i.prototype,Qx({get[n](){return Gt(this,o)},set[n](M){return Nn(this,o,M)}},n)),I=s.length-1;I>=0;I--)d=Kx(h,n,u={},e[3],T),d.static=x,d.private=y,p=d.access={has:M=>n in M},p.get=M=>M[n],p.set=(M,A)=>M[n]=A,c=(0,s[I])({get:D.get,set:D.set},d),u._=1,c===void 0?mr(c)&&(D[j]=c):typeof c!="object"||c===null?xr("Object expected"):(mr(l=c.get)&&(D.get=l),mr(l=c.set)&&(D.set=l),mr(l=c.init)&&k.unshift(l));return D&&Kc(i,n,D),i},nu=(e,t,n)=>t.has(e)||xr("Cannot "+n),Gt=(e,t,n)=>(nu(e,t,"read from private field"),t.get(e)),bt=(e,t,n)=>t.has(e)?xr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Nn=(e,t,n,s)=>(nu(e,t,"write to private field"),t.set(e,n),n),ru={role:"button",roleDescription:"draggable",tabIndex:0},Xx="dnd-kit-description",Jx="dnd-kit-announcement",Zx={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."},Hx={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 em(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLAnchorElement||e instanceof HTMLButtonElement||e instanceof HTMLAreaElement}var $i={};function su(e){const t=$i[e]==null?0:$i[e]+1;return $i[e]=t,`${e}-${t}`}function tm(e,t){const n=document.createElement("div");return n.id=e,n.style.setProperty("display","none"),n.innerText=t,n}function nm(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 rm=class extends xt{constructor(e,t){super(e);const{id:n,idPrefix:{description:s=Xx,announcement:i=Jx}={},announcements:o=Hx,screenReaderInstructions:l=Zx}=t??{},c=n?`${s}-${n}`:su(s),u=n?`${i}-${n}`:su(i);let d,p;const h=Object.entries(o).map(([m,j])=>this.manager.monitor.addEventListener(m,(k,T)=>{const D=j==null?void 0:j(k,T);D&&p&&(p.innerText=D)})),x=()=>{d=tm(c,l.draggable),p=nm(u),document.body.append(d,p)},y=Hf(()=>{for(const m of e.registry.draggables.value){const{element:j,handle:k}=m,T=k??j;T&&((!d||!p)&&x(),!em(T)&&!T.hasAttribute("tabindex")&&T.setAttribute("tabindex","0"),!T.hasAttribute("role")&&!(T instanceof HTMLButtonElement)&&T.setAttribute("role",ru.role),T.hasAttribute("role-description")||T.setAttribute("aria-roledescription",ru.roleDescription),T.hasAttribute("aria-describedby")||T.setAttribute("aria-describedby",c),T.setAttribute("aria-pressed",String(m.isDragSource)),T.setAttribute("aria-disabled",String(m.disabled)))}this.destroy=()=>{d==null||d.remove(),p==null||p.remove(),h.forEach(m=>m()),y()}})}},sm=class extends xt{constructor(e,t){super(e,t),this.manager=e,this.destroy=He(()=>{var n;const{dragOperation:s}=this.manager,{cursor:i="grabbing"}=(n=this.options)!=null?n:{};if(s.status.initialized){const o=document.createElement("style");return o.innerText=`* { cursor: ${i} !important; }`,document.head.appendChild(o),()=>{o.remove()}}})}},iu="data-dnd-",Ue="--dnd-",un=`${iu}dragging`,im=`[${un}] {position: fixed !important; pointer-events: none !important; touch-action: none !important; z-index: calc(infinity); will-change: transform;top: var(${Ue}top, 0px) !important;left: var(${Ue}left, 0px) !important;width: var(${Ue}width, auto) !important;height: var(${Ue}height, auto) !important;}[${un}] *{pointer-events: none !important;}[${un}][style*="${Ue}translate"] {translate: var(${Ue}translate) !important;}[style*="${Ue}transition"] {transition: var(${Ue}transition) !important;}*:where([${un}][popover]){overflow:visible;background:var(${Ue}background);border:var(${Ue}border);margin:unset;padding:unset;color:inherit;}[${un}]::backdrop {display: none}`,au=`${iu}placeholder`,am=[un,au,"popover"],om=["view-transition-name"],lm=class extends xt{constructor(e){super(e);let t,n,s={x:0,y:0},i,o,l=!1;const c=He(()=>{if(!t&&e.dragOperation.status.initialized)return t=document.createElement("style"),t.innerText=im,document.head.prepend(t),c}),u=He(()=>{var d;const{dragOperation:p}=e,{position:h,source:x,status:y}=p;if(y.idle){n=void 0,i=void 0,o=void 0,s={x:0,y:0};return}if(!x)return;const{element:m,feedback:j}=x;if(!m||j==="none")return;const k=new $t(m,!0),{width:T,height:D,top:I,left:M}=k,A=new Wc(m),{background:se,border:le,transition:me,translate:we}=ln(m),V=e.registry.droppables.get(x.id),q=j==="clone",L=j!=="move"?kx(m,q,{[au]:""}):null,G=En(()=>Zr(e.dragOperation.activatorEvent));if(we!=="none"){const $=Jr(we);$&&(s=$)}if(n||(n={x:M,y:I}),!o){const $=En(()=>h.current);o={x:($.x-M)/T,y:($.y-I)/D}}const U={x:n.x-M,y:n.y-I},K={top:I+U.y,left:M+U.x};m.setAttribute(un,"true"),A.set({width:T,height:D,top:K.top,left:K.left,background:se,border:le,translate:i?`${i.x}px ${i.y}px 0`:""},Ue),L&&m.insertAdjacentElement("afterend",L),qi(m)&&(m.hasAttribute("popover")||m.setAttribute("popover",""),Bi(m));const ee=new $t(m,!0),J={top:K.top-ee.top,left:K.left-ee.left};J.left>.01||J.top>.01?A.set({top:K.top+J.top,left:K.left+J.left},Ue):(J.left=0,J.top=0);const pe=new ResizeObserver(()=>{if(!L)return;const $=new $t(L,!0),H=o??{x:1,y:1},de=(T-$.width)*H.x+U.x,ke=(D-$.height)*H.y+U.y;if(A.set({width:$.width,height:$.height,top:I+ke+J.top,left:M+de+J.left},Ue),m instanceof HTMLTableRowElement&&L instanceof HTMLTableRowElement){const lt=Array.from(m.cells),ze=Array.from(L.cells);for(const[Pt,Wt]of lt.entries()){const Lt=ze[Pt];Wt.style.width=`${Lt.offsetWidth}px`}}e.dragOperation.shape=new $t(m)});V&&L&&(V.placeholder=L,En(V.refreshShape)),p.shape=new $t(m),x.status="dragging";let ce,ue;L&&(pe.observe(L),ce=new MutationObserver(()=>{for(const $ of Array.from(m.attributes))if(!($.name.startsWith("aria-")||am.includes($.name))){if($.name==="style"){if(qn(m)&&qn(L)){L.setAttribute("style",q?"":"opacity: 0;"),L.style.setProperty("transition","none");for(const H of Object.values(m.style))H.startsWith(Ue)||om.includes(H)||L.style.setProperty(H,m.style.getPropertyValue(H))}continue}L.setAttribute($.name,$.value)}q&&(L.innerHTML=m.innerHTML)}),ce.observe(m,{attributes:!0,subtree:!0}),ue=new MutationObserver($=>{for(const H of $)if(Array.from(H.addedNodes).includes(m)){m.insertAdjacentElement("afterend",L),Bi(m);return}}),ue.observe(m.ownerDocument.body,{childList:!0,subtree:!0}));const $e=He(function(){var H,de;const{transform:ke,status:lt}=p;if(!(!ke.x&&!ke.y&&!l)&&(l||(l=!0),lt.dragging)){const ze=G?"250ms ease":"0ms linear",Pt=ke.x+s.x,Wt=ke.y+s.y,Lt=new $t(m);A.set({transition:`${me}, translate ${ze}`,translate:`${Pt}px ${Wt}px 0`},Ue),p.shape=Lt.translate(Pt-((H=i==null?void 0:i.x)!=null?H:0),Wt-((de=i==null?void 0:i.y)!=null?de:0)),i={x:Pt,y:Wt,z:0,scaleX:Lt.scale.x,scaleY:Lt.scale.y}}}),qe=(d=e.dragOperation.source)==null?void 0:d.id,Rt=()=>{var $;if(!G||qe==null)return;const H=e.registry.draggables.get(qe),de=($=H==null?void 0:H.handle)!=null?$:H==null?void 0:H.element;de instanceof HTMLElement&&de.focus()};let xe=()=>{ce==null||ce.disconnect(),ue==null||ue.disconnect(),pe.disconnect(),A.reset(),l&&m.isConnected&&(L==null||L.replaceWith(m)),L==null||L.remove(),m.removeAttribute(un),qi(m)&&m.removeAttribute("popover"),$e(),be(),V&&(V.placeholder=void 0),x.status="idle",l=!1};const be=He(function(){if(p.status.dropped){const H=xe;xe=void 0,x.status="dropping";const de=i;if(!de){H==null||H();return}e.renderer.rendering.then(()=>{var ke;Bi(m);const lt=L??m;A.remove(["translate"],Ue);const ze=new $t(lt),Pt=new $t(m,!0).translate(de.x,de.y),Wt={x:Pt.center.x-ze.center.x,y:Pt.center.y-ze.center.y},Lt={x:de.x-Wt.x,y:de.y-Wt.y,z:0};Qc({element:m,keyframes:{translate:[`${de.x}px ${de.y}px ${(ke=de.z)!=null?ke:0}`,`${Lt.x}px ${Lt.y}px ${Lt.z}`]},options:{duration:l?250:0,easing:"ease"},onFinish(){requestAnimationFrame(Rt),H==null||H()}})})}});return()=>xe==null?void 0:xe()});this.destroy=()=>{c(),u(),t==null||t.remove()}}},br=!0,cm=!1,ou,lu,cu,uu,dn,Gi,Fi;uu=(cu=[_e],mt.Forward),lu=(ou=[_e],mt.Reverse);var yr=class{constructor(){bt(this,Gi,Qe(dn,8,this,br)),Qe(dn,11,this),bt(this,Fi,Qe(dn,12,this,br)),Qe(dn,15,this)}isLocked(e){return e===mt.Idle?!1:e==null?this[mt.Forward]===br&&this[mt.Reverse]===br:this[e]===br}unlock(e){e!==mt.Idle&&(this[e]=cm)}};dn=es(null),Gi=new WeakMap,Fi=new WeakMap,cn(dn,4,uu,cu,yr,Gi),cn(dn,4,lu,ou,yr,Fi),ts(dn,yr);var um=[mt.Forward,mt.Reverse],du=class{constructor(){this.x=new yr,this.y=new yr}isLocked(){return this.x.isLocked()&&this.y.isLocked()}},dm=class extends xt{constructor(e){super(e);const t=Rr(new du);let n=null;this.signal=t,He(()=>{const{status:s}=e.dragOperation;if(!s.initialized){n=null,t.value=new du;return}const{delta:i}=e.dragOperation.position;if(n){const o={x:pu(i.x,n.x),y:pu(i.y,n.y)},l=t.peek();Kt(()=>{for(const c of hc)for(const u of um)o[c]===u&&l[c].unlock(u);t.value=l})}n=i})}get current(){return this.signal.peek()}};function pu(e,t){return Math.sign(e-t)}var hu,Ri,vr,Wi,pn,Qi,ns=class extends(Ri=vx,hu=[_e],Ri){constructor(e){super(e),bt(this,Wi,Qe(vr,8,this,!1)),Qe(vr,11,this),bt(this,pn),bt(this,Qi,()=>{if(!Gt(this,pn))return;const{element:o,by:l}=Gt(this,pn);o.scrollBy(l.x,l.y)}),this.scroll=o=>{var l;if(this.disabled)return!1;const c=this.getScrollableElements();if(!c)return Nn(this,pn,void 0),!1;const{position:u}=this.manager.dragOperation,d=u==null?void 0:u.current;if(d){const{by:p}=o??{},h=p?{x:gu(p.x),y:gu(p.y)}:void 0,x=h?void 0:this.scrollIntentTracker.current;if(x!=null&&x.isLocked())return!1;for(const y of c){const m=Dx(y,p);if(m.x||m.y){const{speed:j,direction:k}=Ox(y,d,h);if(x)for(const T of hc)x[T].isLocked(k[T])&&(j[T]=0,k[T]=0);if(k.x||k.y){const{x:T,y:D}=p??k,I=T*j.x,M=D*j.y;if(I||M){const A=(l=Gt(this,pn))==null?void 0:l.by;if(this.autoScrolling&&A&&(A.x&&!I||A.y&&!M))continue;return Nn(this,pn,{element:y,by:{x:I,y:M}}),Bn.schedule(Gt(this,Qi)),!0}}}}}return Nn(this,pn,void 0),!1};let t=null,n=null;const s=Wr(()=>{var o;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),(o=document.elementFromPoint(c,u))!=null?o:t}),i=Wr(()=>{const o=s.value;if(!o||o===document.documentElement){const{target:l}=e.dragOperation,c=l==null?void 0:l.element;if(c){const u=Xr(c,{excludeElement:!1});return n=u,u}}if(o){const l=Xr(o,{excludeElement:!1});return this.autoScrolling&&n&&l.size<(n==null?void 0:n.size)?n:(n=l,l)}return n=null,null},di);this.getScrollableElements=()=>i.value,this.scrollIntentTracker=new dm(e),this.destroy=e.monitor.addEventListener("dragmove",o=>{this.disabled||o.defaultPrevented||!Zr(e.dragOperation.activatorEvent)||!o.by||this.scroll({by:o.by})&&o.preventDefault()})}};vr=es(Ri),Wi=new WeakMap,pn=new WeakMap,Qi=new WeakMap,cn(vr,4,"autoScrolling",hu,ns,Wi),ts(vr,ns);function gu(e){return e>0?mt.Forward:e<0?mt.Reverse:mt.Idle}var pm=10,fu=class extends xt{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=He(()=>{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,pm);return()=>{clearInterval(l)}}else n.autoScrolling=!1})}},hm=class extends xt{constructor(e){super(e),this.manager=e,this.destroy=He(()=>{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",xu,{capture:!0}),()=>{document.removeEventListener("selectionchange",xu,{capture:!0}),n.remove()}}})}};function xu(){var e;(e=document.getSelection())==null||e.removeAllRanges()}var mu={start:["Space","Enter"],cancel:["Escape"],end:["Space","Enter"],up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]},rs=10,_r,gm=class extends Kr{constructor(e,t){super(e),this.manager=e,this.options=t,bt(this,_r,[]),this.listeners=new $c,this.handleSourceKeyDown=(n,s,i)=>{if(this.disabled||n.defaultPrevented||!(n.target instanceof Element)||s.disabled||!s.element)return;const{keyboardCodes:o=mu}=i??{};o.start.includes(n.code)&&this.manager.dragOperation.status.idle&&this.handleStart(n,s,i)}}bind(e,t=this.options){return He(()=>{var s;const i=(s=e.handle)!=null?s:e.element,o=l=>{l instanceof KeyboardEvent&&this.handleSourceKeyDown(l,e,t)};if(i)return i.addEventListener("keydown",o),()=>{i.removeEventListener("keydown",o)}})}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(),Rc(s);const{center:i}=new $t(s);Kt(()=>{this.manager.actions.setDragSource(t.id),this.manager.actions.start({event:e,coordinates:{x:i.x,y:i.y}})}),this.sideEffects();const o=fr(s),l=Vn(o),c=[this.listeners.bind(o,[{type:"keydown",listener:u=>this.handleKeyDown(u,t,n),options:{capture:!0}}]),this.listeners.bind(l,[{type:"resize",listener:()=>this.handleEnd(!0)}])];Gt(this,_r).push(...c)}handleKeyDown(e,t,n){const{keyboardCodes:s=mu}=n??{};if($n(e,[...s.end,...s.cancel])){e.preventDefault();const i=$n(e,s.cancel);this.handleEnd(i);return}$n(e,s.up)?this.handleMove("up",e):$n(e,s.down)&&this.handleMove("down",e),$n(e,s.left)?this.handleMove("left",e):$n(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:-rs*s};break;case"down":i={x:0,y:rs*s};break;case"left":i={x:-rs*s,y:0};break;case"right":i={x:rs*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(fu);(e==null?void 0:e.disabled)===!1&&(e.disable(),Gt(this,_r).push(()=>{e.enable()}))}cleanup(){Gt(this,_r).forEach(e=>e())}destroy(){this.cleanup(),this.listeners.clear()}};_r=new WeakMap;function $n(e,t){return t.includes(e.code)}var Gn,Ui=class extends Kr{constructor(t,n){super(t),this.manager=t,this.options=n,this.listeners=new $c,this.cleanup=new Set,bt(this,Gn),this.handleCancel=this.handleCancel.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}bind(t,n=this.options){return He(()=>{var i;const o=(i=t.handle)!=null?i:t.element,l=c=>{c instanceof PointerEvent&&this.handlePointerDown(c,t,n)};if(o)return mm(o.ownerDocument.defaultView),o.addEventListener("pointerdown",l),()=>{o.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,o=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:h}=c;if(h){const x=setTimeout(()=>this.handleStart(n,t),h.value);Nn(this,Gn,()=>{clearTimeout(x),Nn(this,Gn,void 0)})}}const u=fr(t.target),d=this.listeners.bind(u,[{type:"pointermove",listener:h=>this.handlePointerMove(h,n,s)},{type:"pointerup",listener:this.handlePointerUp,options:{capture:!0}},{type:"touchmove",listener:Yi,options:{passive:!1}},{type:"click",listener:Yi},{type:"dragstart",listener:o?this.handleCancel:Yi},{type:"keydown",listener:this.handleKeyDown}]),p=()=>{var h;setTimeout(d),(h=Gt(this,Gn))==null||h.call(this),this.initialCoordinates=void 0,this.cleanup.delete(p)};this.cleanup.add(p)}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 o={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&&yi(o,u.tolerance))return this.handleCancel();if(yi(o,u.value))return this.handleStart(n,t)}if(d&&yi(o,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:o}=this;(s=Gt(this,Gn))==null||s.call(this),!(!o||i.dragOperation.status.initialized)&&(n.defaultPrevented||(n.preventDefault(),Kt(()=>{i.actions.setDragSource(t.id),i.actions.start({coordinates:o,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()}};Gn=new WeakMap,Ui.configure=yx(Ui);var fm=Ui;function Yi(e){e.preventDefault()}function xm(){}var bu=new WeakSet;function mm(e){!e||bu.has(e)||(e.addEventListener("touchmove",xm,{capture:!1,passive:!1}),bu.add(e))}fm.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 yu,vu,_u,Ki,Dt,Xi,Ji,Zi,jr=class extends(Ki=gr,_u=[_e],vu=[_e],yu=[_e],Ki){constructor(e,t){var n=e,{element:s,effects:i=()=>[],handle:o,feedback:l="default"}=n,c=eu(n,["element","effects","handle","feedback"]);super(Hc({effects:()=>[...i(),()=>{var u,d;const{manager:p}=this;if(!p)return;const x=((d=(u=this.sensors)==null?void 0:u.map(vc))!=null?d:[...p.sensors]).map(y=>{const m=y instanceof Kr?y:p.registry.register(y.plugin),j=y instanceof Kr?void 0:y.options;return m.bind(this,j)});return function(){x.forEach(m=>m())}}]},c),t),bt(this,Xi,Qe(Dt,8,this)),Qe(Dt,11,this),bt(this,Ji,Qe(Dt,12,this)),Qe(Dt,15,this),bt(this,Zi,Qe(Dt,16,this)),Qe(Dt,19,this),this.element=s,this.handle=o,this.feedback=l}};Dt=es(Ki),Xi=new WeakMap,Ji=new WeakMap,Zi=new WeakMap,cn(Dt,4,"handle",_u,jr,Xi),cn(Dt,4,"element",vu,jr,Ji),cn(Dt,4,"feedback",yu,jr,Zi),ts(Dt,jr);var ju,wu,Hi,hn,ea,ta,ss=class extends(Hi=on,wu=[_e],ju=[_e],Hi){constructor(e,t){var n=e,{element:s,effects:i=()=>[]}=n,o=eu(n,["element","effects"]),l;const{collisionDetector:c=Lc}=o;super(Yx(Hc({},o),{collisionDetector:c,effects:()=>[...i(),()=>{const{element:u,manager:d}=this;if(!d)return;const{dragOperation:p}=d;if(u&&p.status.initialized){const h=Ax(u),x=fr(u),y=h===x.scrollingElement?x:h,m=new IntersectionObserver(T=>{const[D]=T.slice(-1),{width:I,height:M}=D.boundingClientRect;!I&&!M||(this.visible=D.isIntersecting)},{root:y??x,rootMargin:"40%"}),j=new MutationObserver(()=>Bn.schedule(this.refreshShape)),k=new ResizeObserver(()=>Bn.schedule(this.refreshShape));return u.parentElement&&j.observe(u.parentElement,{childList:!0}),k.observe(u),m.observe(u),()=>{this.shape=void 0,this.visible=void 0,k.disconnect(),j.disconnect(),m.disconnect()}}},()=>{const{manager:u}=this;if(!u)return;const{dragOperation:d}=u,{status:p}=d,h=En(()=>d.source);if(p.initialized){if((h==null?void 0:h.type)!=null&&!this.accepts(h))return;Bn.schedule(this.refreshShape)}},()=>{var u;if((u=this.manager)!=null&&u.dragOperation.status.initialized)return()=>{this.shape=void 0}}]}),t),bt(this,ea,Qe(hn,8,this)),Qe(hn,11,this),bt(this,ta,Qe(hn,12,this)),Qe(hn,15,this),this.internal={element:Rr(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 $t(t,e);return s&&(n!=null&&n.equals(s))?n:(this.shape=s,s)}};hn=es(Hi),ea=new WeakMap,ta=new WeakMap,cn(hn,4,"visible",wu,ss,ea),cn(hn,4,"placeholder",ju,ss,ta),ts(hn,ss);var bm=Object.create,Cu=Object.defineProperty,ym=Object.defineProperties,vm=Object.getOwnPropertyDescriptor,_m=Object.getOwnPropertyDescriptors,is=Object.getOwnPropertySymbols,Su=Object.prototype.hasOwnProperty,Tu=Object.prototype.propertyIsEnumerable,jm=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),wr=e=>{throw TypeError(e)},na=(e,t,n)=>t in e?Cu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wm=(e,t)=>{for(var n in t||(t={}))Su.call(t,n)&&na(e,n,t[n]);if(is)for(var n of is(t))Tu.call(t,n)&&na(e,n,t[n]);return e},Cm=(e,t)=>ym(e,_m(t)),Sm=(e,t)=>{var n={};for(var s in e)Su.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&is)for(var s of is(e))t.indexOf(s)<0&&Tu.call(e,s)&&(n[s]=e[s]);return n},Tm=e=>{var t;return[,,,bm((t=void 0)!=null?t:null)]},ku=["class","method","getter","setter","accessor","field","value","get","set"],Cr=e=>e!==void 0&&typeof e!="function"?wr("Function expected"):e,km=(e,t,n,s,i)=>({kind:ku[e],name:t,metadata:s,addInitializer:o=>n._?wr("Already initialized"):i.push(Cr(o||null))}),Dm=(e,t)=>na(t,jm("metadata"),e[3]),as=(e,t,n,s)=>{for(var i=0,o=e[t>>1],l=o&&o.length;i<l;i++)t&1?o[i].call(n):s=o[i].call(n,s);return s},Du=(e,t,n,s,i,o)=>{for(var l,c,u,d,p,h=t&7,x=!!(t&8),y=!!(t&16),m=e.length+1,j=ku[h+5],k=e[m-1]=[],T=e[m]||(e[m]=[]),D=(i=i.prototype,vm({get[n](){return zm(this,o)},set[n](M){return Im(this,o,M)}},n)),I=s.length-1;I>=0;I--)d=km(h,n,u={},e[3],T),d.static=x,d.private=y,p=d.access={has:M=>n in M},p.get=M=>M[n],p.set=(M,A)=>M[n]=A,c=(0,s[I])({get:D.get,set:D.set},d),u._=1,c===void 0?Cr(c)&&(D[j]=c):typeof c!="object"||c===null?wr("Object expected"):(Cr(l=c.get)&&(D.get=l),Cr(l=c.set)&&(D.set=l),Cr(l=c.init)&&k.unshift(l));return D&&Cu(i,n,D),i},zu=(e,t,n)=>t.has(e)||wr("Cannot "+n),zm=(e,t,n)=>(zu(e,t,"read from private field"),t.get(e)),Iu=(e,t,n)=>t.has(e)?wr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Im=(e,t,n,s)=>(zu(e,t,"write to private field"),t.set(e,n),n);function Fn(e){return e instanceof ia||e instanceof Lu}var os=10,Mm=class extends xt{constructor(e){super(e);const t=He(()=>{const{dragOperation:s}=e;if(Zr(s.activatorEvent)&&Fn(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:o}=i;if(!Zr(o.activatorEvent)||!Fn(o.source)||!o.shape)return;const{actions:l,collisionObserver:c,registry:u}=i,{by:d}=s;if(!d)return;const p=Em(d),{source:h}=o,{center:x}=o.shape.current,y=[];for(const T of u.droppables){const{shape:D,id:I}=T;if(!(!D||I===(h==null?void 0:h.id)&&Fn(T)||(h==null?void 0:h.type)!=null&&!T.accepts(h)))switch(p){case"down":x.y+os<D.center.y&&y.push(T);break;case"up":x.y-os>D.center.y&&y.push(T);break;case"left":x.x-os>D.center.x&&y.push(T);break;case"right":x.x+os<D.center.x&&y.push(T);break}}s.preventDefault(),c.disable();const m=c.computeCollisions(y,wx),[j]=m;if(!j)return;const{id:k}=j;l.setDropTarget(k).then(()=>{const{source:T}=o;if(!T)return;const D=u.droppables.get(T.id);if(!(D!=null&&D.element))return;const{element:I}=D;Rc(I),Bn.schedule(()=>{const M=D.refreshShape();M&&(l.move({to:{x:M.center.x,y:M.center.y}}),l.setDropTarget(T.id).then(()=>{o.shape=M,c.enable()}))})})})});this.destroy=()=>{n(),t()}}};function Em(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 Am(e,t,n){if(t===n)return e;const s=e.slice();return s.splice(n,0,s.splice(t,1)[0]),s}var Pm=class extends xt{constructor(e){super(e);const t=s=>{var i;const o=new Map;for(const l of e.registry.droppables)if(l instanceof ia){const{sortable:c}=l;if(c.group!==s)continue;if(o.has(c.index))throw new Error(`Duplicate sortable index found for same sortable group: ${c.droppable.id} and ${(i=o.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.`);o.set(c.index,c)}return o},n=[e.monitor.addEventListener("dragover",(s,i)=>{queueMicrotask(()=>{if(this.disabled||s.defaultPrevented)return;const{dragOperation:o}=i,{source:l,target:c}=o;if(!Fn(l)||!Fn(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,T]of u.entries())if(T.index!==k)return;const p=Array.from(u.values()).sort((k,T)=>k.index-T.index),h=p.indexOf(l.sortable),x=p.indexOf(c.sortable),y=Am(p,h,x),m=(d=l.sortable.droppable.internal.element.peek())!=null?d:l.sortable.droppable.placeholder,j=c.element;!j||!m||(Mu(m,h,j,x),Kt(()=>{for(const[k,T]of y.entries())T.index=k}))})})}),e.monitor.addEventListener("dragend",(s,i)=>{if(!s.canceled)return;const{dragOperation:o}=i,{source:l}=o;Fn(l)&&l.sortable.initialIndex!==l.sortable.index&&queueMicrotask(()=>{const c=t(l.sortable.group);i.renderer.rendering.then(()=>{var u;for(const[x,y]of c.entries())if(y.index!==x)return;const d=Array.from(c.values()).sort((x,y)=>x.index-y.index),p=l.sortable.droppable.element,h=(u=d[l.sortable.initialIndex])==null?void 0:u.element;!h||!p||(Mu(p,l.sortable.index,h,l.sortable.initialIndex),Kt(()=>{for(const x of d.values())x.index=x.initialIndex}))})})})];this.destroy=()=>{for(const s of n)s()}}};function Mu(e,t,n,s){const i=s<t?"beforebegin":"afterend";n.insertAdjacentElement(i,e)}var Lm=[Mm,Pm],Eu={duration:250,easing:"cubic-bezier(0.25, 1, 0.5, 1)",idle:!1},Au,Pu,gn,ra,sa;Pu=[_e],Au=[_e];var ls=class{constructor(e,t){Iu(this,ra,as(gn,8,this)),as(gn,11,this),Iu(this,sa,as(gn,12,this)),as(gn,15,this);var n=e,{effects:s=()=>[],group:i,index:o,sensors:l,type:c,transition:u=Eu,plugins:d=Lm}=n,p=Sm(n,["effects","group","index","sensors","type","transition","plugins"]);this.droppable=new ia(p,t,this),this.draggable=new Lu(Cm(wm({},p),{effects:()=>[()=>{var h;return(h=this.manager)==null?void 0:h.monitor.addEventListener("dragstart",()=>{this.initialIndex=this.index,this.previousIndex=this.index})},()=>{const{index:h,previousIndex:x,manager:y}=this;h!==x&&(this.previousIndex=h,this.animate())},()=>{const{target:h}=this,{feedback:x,isDragSource:y}=this.draggable;x=="move"&&y&&(this.droppable.disabled=!h)},()=>{const{manager:h}=this;for(const x of d)h==null||h.registry.register(x)},...s()],type:c,sensors:l}),t,this),this.manager=t,this.index=o,this.previousIndex=o,this.initialIndex=o,this.group=i,this.type=c,this.transition=u,this.destroy=()=>{this.draggable.destroy(),this.droppable.destroy()}}animate(){En(()=>{const{manager:e,transition:t}=this,{shape:n}=this.droppable;if(!e)return;const{idle:s}=e.dragOperation.status;!n||!t||s&&!t.idle||Bn.schedule(()=>{const{element:i}=this.droppable;if(!i)return;const o=this.refreshShape();if(!o)return;const l={x:n.boundingRectangle.left-o.boundingRectangle.left,y:n.boundingRectangle.top-o.boundingRectangle.top},{x:c,y:u,z:d}=Nx(i);(l.x||l.y)&&Qc({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){Kt(()=>{this.draggable.disabled=e,this.droppable.disabled=e})}set data(e){Kt(()=>{this.draggable.data=e,this.droppable.data=e})}set handle(e){this.draggable.handle=e}set id(e){Kt(()=>{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??pr.Normal}set collisionDetector(e){this.droppable.collisionDetector=e??Lc}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()}};gn=Tm(),ra=new WeakMap,sa=new WeakMap,Du(gn,4,"index",Pu,ls,ra),Du(gn,4,"group",Au,ls,sa),Dm(gn,ls);var Lu=class extends jr{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}},ia=class extends ss{constructor(e,t,n){super(e,t),this.sortable=n}refreshShape(e=!1){return super.refreshShape(e)}get index(){return this.sortable.index}};function Ou(e){const t=g.useRef();return t.current||(t.current=e()),t.current}var Om=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Vu=Om?g.useLayoutEffect:g.useEffect;function Vm(e,t=!1){const n=Ou(()=>e instanceof We?e:Rr(e));let s=n.peek();const i=g.useState(s)[1];return Vu(()=>He(()=>{s!==(s=n.value)&&(t?Mg.flushSync(()=>i(s)):i(s))}),[t]),n}function aa(e,t=!1){return Vm(Ou(()=>Wr(e)),t)}function qm(e,t){e()}function Ye(e,t,n=g.useEffect,s=Object.is){const i=g.useRef(e);n(()=>{const o=i.current;s(e,o)||(i.current=e,t(e,o))},[t,e])}function oa(e){var t;if(e!=null)return typeof e=="object"&&"current"in e?(t=e.current)!=null?t:void 0:e}var Bm=Object.defineProperty,Nm=Object.defineProperties,$m=Object.getOwnPropertyDescriptors,qu=Object.getOwnPropertySymbols,Gm=Object.prototype.hasOwnProperty,Fm=Object.prototype.propertyIsEnumerable,Bu=(e,t,n)=>t in e?Bm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rm=(e,t)=>{for(var n in t||(t={}))Gm.call(t,n)&&Bu(e,n,t[n]);if(qu)for(var n of qu(t))Fm.call(t,n)&&Bu(e,n,t[n]);return e},Wm=(e,t)=>Nm(e,$m(t));function Nu(e){const{accept:t,collisionDetector:n,collisionPriority:s,id:i,data:o,index:l,group:c,disabled:u,feedback:d,sensors:p,transition:h=Eu,type:x}=e,y=Or.useDragDropManager(),m=oa(e.handle),j=oa(e.element),k=oa(e.target),T=Or.useInstance(A=>new ls(Wm(Rm({},e),{handle:m,element:j,target:k,feedback:d}),A)),D=aa(()=>T.isDropTarget),I=aa(()=>T.isDragSource),M=aa(()=>T.status);return Ye(i,()=>T.id=i),Ye(l,()=>T.index=l,Vu),Ye(x,()=>T.type=x),Ye(c,()=>T.group=c),Ye(t,()=>T.accept=t,void 0,di),Ye(o,()=>o&&(T.data=o)),Ye(l,()=>{y!=null&&y.dragOperation.status.idle&&h&&T.refreshShape()},qm),Ye(m,()=>T.handle=m),Ye(j,()=>T.element=j),Ye(k,()=>T.target=k),Ye(u,()=>T.disabled=u===!0),Ye(p,()=>T.sensors=p),Ye(n,()=>T.collisionDetector=n),Ye(s,()=>T.collisionPriority=s),Ye(d,()=>T.feedback=d??"default"),Ye(h,()=>T.transition=h),{get isDragSource(){return I.value},get isDropTarget(){return D.value},get status(){return M.value},handleRef:g.useCallback(A=>{T.handle=A??void 0},[T]),ref:g.useCallback(A=>{T.element=A??void 0},[T]),sourceRef:g.useCallback(A=>{T.source=A??void 0},[T]),targetRef:g.useCallback(A=>{T.target=A??void 0},[T])}}const $u={static:{type:"static",value:10},dynamic:{type:"dynamic",value:["function getValue({ variables }, { lodash, interpolate }) {"," // your code goes here"," return 100;","}"].join(`
61
61
  `)}},Qm=({value:e,onChange:t})=>{const n=s=>{s&&t(s)};return r.jsx(a.Box,{children:r.jsx(ut,{height:"500px",defaultLanguage:"javascript",value:e,onChange:n,theme:"vs-dark",options:{minimap:{enabled:!1}}})})},Um=({value:e,onChange:t})=>{const{t:n}=_.useTranslation(),[s,{setTrue:i,setFalse:o}]=Y.useBoolean(),[l,c]=g.useState(e),u=()=>{o();const{type:x,value:y}=l,m={type:x,value:y};c(m),t(m)},d=()=>{o(),c(e)},p=x=>{c(y=>({...y,value:x}))},h=()=>{p($u.dynamic.value)};return r.jsxs(r.Fragment,{children:[r.jsx(a.Box,{sx:{width:"50%"},children:r.jsx(a.Button,{color:"grape",variant:"filled",leftSection:r.jsx(C.IconMathFunction,{size:16}),mt:24,onClick:i,sx:{flexGrow:0},children:n("chart.number_or_dynamic_value.dynamic.setup")})}),r.jsx(a.Modal,{size:800,title:n("chart.number_or_dynamic_value.dynamic.setup_title"),opened:s,onClose:o,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:s&&r.jsxs(a.Stack,{children:[r.jsx(a.Divider,{mt:10,mb:-10,label:n("chart.number_or_dynamic_value.dynamic.guide"),labelPosition:"center",variant:"dashed"}),r.jsx(Qm,{value:l.value,onChange:p}),r.jsxs(a.Group,{justify:"space-between",children:[r.jsx(a.Button,{onClick:h,color:"red",leftSection:r.jsx(C.IconRecycle,{size:20}),children:n("common.actions.reset_to_default")}),r.jsxs(a.Group,{justify:"right",children:[r.jsx(a.Button,{onClick:d,variant:"subtle",children:n("common.actions.cancel")}),r.jsx(a.Button,{color:"green",leftSection:r.jsx(C.IconDeviceFloppy,{size:16}),onClick:u,children:n("common.actions.save")})]})]})]})})]})},Ym=({value:e,onChange:t})=>e.type!=="dynamic"?null:r.jsx(Um,{value:e,onChange:t}),Km=({value:e,onChange:t})=>{if(e.type!=="static")return null;const n=s=>{t({...e,value:typeof s=="string"?"":s})};return r.jsx(a.NumberInput,{defaultValue:18,label:" ",hideControls:!0,value:e.value,onChange:n})},Gu=g.forwardRef(({label:e="Value",value:t,onChange:n},s)=>{const{t:i,i18n:o}=_.useTranslation(),l=u=>{u!=="static"&&u!=="dynamic"||n({...$u[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"}],[o.language]);return r.jsxs(a.SimpleGrid,{cols:2,children:[r.jsx(a.Select,{ref:s,label:e,data:c,value:t.type,onChange:l,sx:{flexGrow:1}}),r.jsx(Km,{value:t,onChange:n}),r.jsx(Ym,{value:t,onChange:n})]})});function Fu(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:nn.interpolate});return Number(i)}catch(i){return console.error(`[getNumberOrDynamicValue] failed parsing custom function, error: ${i.message}`),10}}function Ru(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(Yt.graphics.depth)},skipRange:{lt_min:"",min:"",max:"",gt_max:""}}}function Xm(){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:[Wu()],categories:[]}}function Jt(){return Ru()}function Jm(){return{compared:Object.values(Yt.graphics.compared),level:Object.values(Yt.graphics.level),depth:Object.values(Yt.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 cs(e,t){const{min:n,max:s}=e,i=Fu(n,t),o=Fu(s,t);if(e.type==="continuous"){const{skipRange:h,text:x,...y}=e;return{...y,min:i,max:o,text:[...x]}}const{piecewise_mode:l,pieces:c,categories:u,...d}=e,p={...d};return delete p.min,delete p.max,l==="pieces"?p.pieces=c.map(h=>{const x={};h.label&&(x.label=h.label),h.color&&(x.color=h.color);const y=Number(h.lower.value);h.lower.value===""?x[h.lower.symbol]=i:Number.isFinite(y)&&(x[h.lower.symbol]=y);const m=Number(h.upper.value);return h.upper.value===""?x[h.upper.symbol]=o:Number.isFinite(m)&&(x[h.upper.symbol]=m),x}):l==="categories"&&(p.categories=u),p}const Rn=e=>({followVisualMap:!e,color:e});function la(e,t,n,s){if(s.type!=="continuous")return Rn("");const{skipRange:i}=s;return e===t?Rn(i.min):e===n?Rn(i.max):e<t?Rn(i.lt_min):e>n?Rn(i.gt_max):Rn("")}function Wu(){return{lower:{value:"0",symbol:"gt"},upper:{value:"",symbol:"lt"},label:"",color:""}}const Zm=Jm(),Hm=({colors:e,applyPalette:t,zIndex:n=340})=>{const{t:s}=_.useTranslation(),i=`linear-gradient(to right, ${e.join(", ")})`;return r.jsxs(a.Menu,{shadow:"md",width:300,withinPortal:!0,zIndex:n,children:[r.jsx(a.Menu.Target,{children:r.jsxs(a.UnstyledButton,{children:[r.jsx(a.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(a.Group,{style:{padding:"0.4375rem 0.625rem",border:"0.0625rem solid #ced4da",borderRadius:"0.25rem",columnGap:10},children:[r.jsx(a.Box,{style:{height:"20px",flexGrow:1,backgroundImage:i,borderRadius:4}}),r.jsx(C.IconSelector,{size:14,color:"rgb(134, 142, 150)"})]})]})}),r.jsxs(a.Menu.Dropdown,{children:[r.jsx(a.Menu.Label,{children:s("chart.visual_map.built_in_palettes")}),r.jsx(a.Menu.Divider,{}),Object.entries(Zm).map(([o,l])=>r.jsx(a.Tooltip,{label:s("chart.visual_map.use_palette_x",{x:o}),children:r.jsx(a.Menu.Item,{children:r.jsx(a.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:o})})},o))]})]})},eb=({color:e,index:t,handleChange:n,handleRemove:s})=>{const[i,{setTrue:o,setFalse:l}]=Y.useBoolean(!1),{ref:c,handleRef:u}=Nu({id:e.id,index:t});return r.jsxs(a.Flex,{ref:c,gap:"sm",justify:"flex-start",align:"center",direction:"row",wrap:"nowrap",onMouseEnter:o,onMouseLeave:l,children:[r.jsx(a.Center,{style:{minWidth:"30px",maxWidth:"30px",flex:0},children:i?r.jsx(a.ActionIcon,{size:"xs",ref:u,variant:"subtle",children:r.jsx(C.IconGripVertical,{})}):r.jsx(a.Badge,{size:"sm",variant:"light",children:t+1})}),r.jsx("div",{style:{flex:1},children:r.jsx(a.ColorInput,{styles:{root:{flexGrow:1}},popoverProps:{withinPortal:!0,zIndex:340},size:"xs",value:e.value,onChange:n})}),r.jsx("div",{style:{minWidth:"40px",maxWidth:"40px",flex:0},children:r.jsx(a.CloseButton,{onClick:s,size:"sm"})})]})},Qu=g.forwardRef(({value:e,onChange:t,zIndex:n=340},s)=>{const{t:i}=_.useTranslation(),o=g.useMemo(()=>e.map(m=>({id:Qt.v4(),value:m})),[e]),l=m=>{t([...e,m])},c=m=>{const j=[...e];j.splice(m,1),t(j)},u=m=>{t([...m])},d=m=>j=>{const k=[...e];k[m]=j,t(k)},[p,h]=g.useState(""),x=()=>{p&&(l(p),h(""))},y=m=>{const{source:j,target:k}=m.operation,T=Ig.move(o,j,k);t(T.map(D=>D.value))};return r.jsxs(a.Stack,{ref:s,children:[r.jsx(Hm,{colors:e,applyPalette:u,zIndex:n}),r.jsx(Or.DragDropProvider,{onDragEnd:y,children:o.map((m,j)=>r.jsx(eb,{color:m,handleChange:d(j),handleRemove:()=>c(j),index:j},m.id))}),r.jsxs(a.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(a.ColorInput,{popoverProps:{withinPortal:!0,zIndex:n},placeholder:i("chart.color.click_to_add_a_color"),value:p,onChange:h,onBlur:x,size:"xs"})}),r.jsx("div",{style:{minWidth:"40px",maxWidth:"40px",flex:0}})]})]})}),tb=({defaultValues:e,onSubmit:t,unset:n})=>{const{t:s}=_.useTranslation(),i=b.useForm({defaultValues:e}),{control:o,handleSubmit:l,reset:c}=i;g.useEffect(()=>{c(e)},[e]);const u=g.useCallback(()=>c(e),[c,e]);return r.jsxs(a.Box,{children:[r.jsx(a.Divider,{color:"rgb(206, 212, 218)",variant:"dotted",my:"1rem"}),r.jsxs(a.Box,{px:"1rem",children:[r.jsx(b.Controller,{control:o,name:"variable",render:({field:d})=>r.jsx(li,{label:s("rich_text.color_mapping.choose_value_var"),clearable:!1,preview:"aggregated",zIndex:340,...d})}),r.jsxs(a.Group,{grow:!0,justify:"space-between",children:[r.jsx(b.Controller,{name:"min_var",control:o,render:({field:d})=>r.jsx(li,{label:s("rich_text.color_mapping.min.var"),preview:"aggregated",sx:{flexGrow:1,maxWidth:"unset"},...d})}),r.jsx(b.Controller,{name:"min_val",control:o,render:({field:d})=>r.jsx(a.TextInput,{label:s("rich_text.color_mapping.min.val"),...d,sx:{maxWidth:"120px",flexGrow:0}})})]}),r.jsxs(a.Group,{grow:!0,justify:"space-between",children:[r.jsx(b.Controller,{name:"max_var",control:o,render:({field:d})=>r.jsx(li,{label:s("rich_text.color_mapping.max.var"),preview:"aggregated",sx:{flexGrow:1,maxWidth:"unset"},...d})}),r.jsx(b.Controller,{name:"max_val",control:o,render:({field:d})=>r.jsx(a.TextInput,{label:s("rich_text.color_mapping.max.val"),...d,sx:{maxWidth:"120px",flexGrow:0}})})]}),r.jsx(b.Controller,{control:o,name:"colors",render:({field:d})=>r.jsx(Qu,{...d})})]}),r.jsx(a.Divider,{color:"rgb(206, 212, 218)",variant:"dotted",my:"1rem"}),r.jsxs(a.Group,{justify:"space-between",px:"1rem",pb:"0.75rem",children:[r.jsxs(a.Group,{justify:"flex-start",children:[r.jsx(a.Button,{color:"red",size:"xs",onClick:n,leftSection:r.jsx(C.IconTrash,{size:18}),children:s("common.actions.clear")}),r.jsx(a.Button,{color:"orange",size:"xs",onClick:u,leftSection:r.jsx(C.IconArrowBackUp,{size:18}),children:s("common.actions.revert")})]}),r.jsx(a.Button,{color:"green",size:"xs",onClick:l(t),leftSection:r.jsx(C.IconDeviceFloppy,{size:18}),children:s("common.actions.save_changes")})]})]})};function nb(e){if(e.length===0)return"";const t=n=>`${n/(e.length-1)*100}%`;return e.map((n,s)=>`${n} ${t(s)}`).join(", ")}function Uu(e,...t){return`linear-gradient(${e}deg, ${nb(t)})`}const rb=()=>r.jsx("div",{style:{width:"20px",height:"13px",borderRadius:"2px",background:Uu(90,...Object.values(Yt.graphics.depth))}}),sb=({disabled:e})=>r.jsx(a.Box,{sx:{width:"16px",height:"10px",borderRadius:"2px",background:Uu(90,...Object.values(Yt.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:`
62
62
  linear-gradient(to top right,
@@ -89,7 +89,7 @@ React keys must be passed directly to JSX without using spread:
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 hs(e,t,n,s){const i=$b(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=Gb(c);return Fb(d,i,n)})}function Rb(e,t){const n=ml.decode(t);n!==e&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:e,after:t,v:n}),console.groupEnd())}async function Wb({query:e,name:t,payload:n,additionals:s},i){if(!e.sql)return[];const{type:o,key:l,sql:c,pre_process:u,post_process:d}=e,p=Us(c,n),h=kf({sql:p,pre_process:u}),x=ml.encode(h);Rb(h,x);let y=await Bt.query(i)({type:o,key:l,query:x,...s},{params:{name:t}});return y=Df(d,y,ga(n)),y}async function Qb({type:e,key:t,configString:n,name:s,additionals:i},o){try{return await Bt.httpDataSourceQuery(o)({type:e,key:t,query:n,...i},{params:{name:s}})}catch(l){if(Ot.isCancel(l))throw l;return console.error(l),l}}async function fa(){try{return(await Bt.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(e){return console.error(e),[]}}async function dd(){try{return(await Bt.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(e){return console.error(e),[]}}class pd{constructor(t){N(this,"rootRef");this.rootRef=te.observable({current:t})}async deleteItem(t){te.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const n=this.getValueFromRoot(t);return Promise.resolve(n)}getValueFromRoot(t){return t===null?te.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,n){if(t===null)if(v.isObject(n))te.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else te.runInAction(()=>{v.set(this.rootRef.current,[t],n)});return Promise.resolve(this.getItem(t))}watchItem(t,n,s){return te.reaction(()=>this.getValueFromRoot(t),(i,o)=>{n(i,o)},{requiresObservable:!0,fireImmediately:v.get(s,"fireImmediately",!1)})}}class Ub{constructor(){N(this,"channels",new Map);N(this,"globalChannel",new bl)}getChannel(t){const n=this.channels.get(t);if(n)return n;const s=new bl;return this.channels.set(t,s),s}}class Yb{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 Ub,instanceData:new pd(t.viz.conf)};return this.instances.set(t.id,s),s}}function hd(e,t,n,s){return{vizManager:n,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new pd({}),colorPalette:{getColor(){return()=>""}},data:t,variables:s}}const Kb=e=>{const{panel:t,measure:n,vizManager:s,data:i,variables:o}=e,l=s.resolveComponent(t.viz.type),c=s.getOrCreateInstance(t),u={...hd(c,i,s,o),viewport:{width:n.w,height:n.h}},d=l.viewRender;return r.jsx(d,{context:u,instance:c,...v.omit(e,["panel","vizManager","data"])})},Xb=e=>{const{vizManager:t,panel:n,data:s,variables:i}=e,o=t.resolveComponent(n.viz.type),l=t.getOrCreateInstance(n),c={...hd(l,s,t,i)},u=o.configRender;return r.jsx(u,{context:c,instance:l,...v.omit(e,["panel","vizManager","data"])})},gd=(e,t)=>{const n=Ct.bezier(e),s=Ct.bezier(t);return function(i){return i<50?n(i*2/100).hex():s((i-50)*2/100).hex()}},gs=e=>{const t=Ct.bezier(e);return function(n){return t(n/100).hex()}},Jb={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:gd(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},Zb={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:gd(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},Hb={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:gs(["#fff7f1","darkred"]),name:"red",category:"sequential"},ey={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:gs(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},ty={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:gs(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},ny={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:gs(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class ry{constructor(t){N(this,"symbol");this.symbol=Symbol(t)}}function Zt(e){return new ry(e)}class xa{constructor(){N(this,"parent");N(this,"factoryRegistry",new Map);N(this,"instanceRegistry",new Map)}createScoped(){const t=new xa;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 fd="13.43.2",sy=Object.freeze(Object.defineProperty({__proto__:null,version:fd},Symbol.toStringTag,{value:"Module"}));class iy{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 ay{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 oy{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),o=v.orderBy(i,"version","asc");if(((l=v.last(o))==null?void 0:l.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return o.reduce((c,u)=>u.handler(c,s),n)}}class Te extends oy{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),o=this.run({from:i,to:this.VERSION},s,{panelModel:n});await t.setItem(null,o)}async needMigration({configData:t}){const n=await t.getItem(null);return v.get(n,"version",0)<this.VERSION}}const W=(e,t)=>{const[n,{setFalse:s}]=Y.useBoolean(!0),[i,o]=g.useState();g.useEffect(()=>(e.getItem(t).then(c=>{o(c),s()}),e.watchItem(t,c=>{o(c)})));const l=g.useCallback(async c=>{await e.setItem(t,c),o(c)},[e,t]);return{loading:n,value:i,set:l}},rt={top:16,right:16,bottom:16,left:16},zt=e=>Math.max(0,e-rt.left-rt.right),It=e=>Math.max(0,e-rt.top-rt.bottom),kr=(e,t)=>({width:zt(e),height:It(t)}),st=({width:e,height:t,children:n})=>r.jsx(a.Box,{pt:rt.top,pr:rt.right,pb:rt.bottom,pl:rt.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:n}),ma={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 ly({context:e}){const{value:t}=W(e.instanceData,"config"),n=e.data,{width:s,height:i}=e.viewport,{x_axis_data_key:o,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:p}=v.defaults({},t,ma),h=g.useMemo(()=>Br(n,o),[n,o]),{x,y,z:m}=g.useMemo(()=>({x:O(o),y:O(l),z:O(c)}),[o,l,c]),{min:j,max:k}=g.useMemo(()=>{const D=v.minBy(h,M=>M[m.columnKey]),I=v.maxBy(h,M=>M[m.columnKey]);return{min:v.get(D,m.columnKey),max:v.get(I,m.columnKey)}},[h,m]),T={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:j,max:k,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:p,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:h.map(D=>[D[x.columnKey],D[y.columnKey],D[m.columnKey]])}]};return t?r.jsx(st,{width:s,height:i,children:r.jsx(Re,{echarts:Fe,option:T,style:kr(s,i),notMerge:!0,theme:"merico-light"})}):null}const Q=z.observer(g.forwardRef(({label:e,required:t,description:n,value:s,onChange:i,queryID:o,clearable:l=!1,sx:c,...u},d)=>{const{panel:p}=Pe(),h=g.useMemo(()=>p.dataFieldOptionGroups(s,l,o),[s,l,o]);if(h.length===0){const x=p.explainDataKey(s);return r.jsxs(a.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[r.jsx(a.HoverCard.Target,{children:r.jsx(a.Box,{children:r.jsx(a.TextInput,{label:e,required:t,defaultValue:x.columnKey,readOnly:!0,disabled:!0})})}),r.jsx(a.HoverCard.Dropdown,{children:r.jsxs(a.Group,{justify:"flex-start",gap:0,children:[r.jsx(a.Text,{size:"xs",c:x.queryName?"black":"red",ff:"monospace",children:x.queryName??x.queryID}),r.jsx(a.Text,{size:"xs",c:"black",ff:"monospace",children:"."}),r.jsx(a.Text,{size:"xs",c:"red",ff:"monospace",children:x.columnKey})]})})]})}return r.jsx(a.Select,{ref:d,label:e,description:n,data:h,value:s,onChange:Ce(i),required:t,sx:c,maxDropdownHeight:500,...u})}));function cy({context:e}){const{value:t,set:n}=W(e.instanceData,"config"),s=v.defaults({},t,ma),{control:i,handleSubmit:o,reset:l}=b.useForm({defaultValues:s});return g.useEffect(()=>{l(s)},[t]),t?r.jsx(a.Stack,{gap:"xs",children:r.jsxs("form",{onSubmit:o(n),children:[r.jsx(a.Text,{size:"sm",children:"X Axis"}),r.jsxs(a.Group,{justify:"space-between",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(Q,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>r.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(a.Text,{mt:"lg",size:"sm",children:"Y Axis"}),r.jsxs(a.Group,{justify:"space-between",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(Q,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>r.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(a.Text,{mt:"lg",size:"sm",children:"Z Axis"}),r.jsxs(a.Group,{justify:"space-between",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(Q,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>r.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(a.Group,{justify:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:r.jsxs(a.Button,{color:"blue",type:"submit",children:[r.jsx(C.IconDeviceFloppy,{size:20}),r.jsx(a.Text,{ml:"md",size:"sm",children:"Save"})]})})]})}):null}const uy=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function dy(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:o,z_axis_data_key:l,...c}=e;return{...c,x_axis_data_key:s(i),y_axis_data_key:s(o),z_axis_data_key:s(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class py extends Te{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:dy(i,s)}})}}const hy={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new py,name:"bar-3d",viewRender:ly,configRender:cy,createConfig(){return{version:2,config:v.cloneDeep(ma)}},translation:uy},gy=({disabled:e,value:t,onChange:n})=>{const s=i=>{i&&n(i)};return r.jsxs(a.Box,{sx:{position:"relative"},children:[e&&r.jsx(a.Overlay,{backgroundOpacity:.6,color:"#fff",zIndex:5,blur:2}),r.jsx(ut,{height:"500px",defaultLanguage:"javascript",value:t,onChange:s,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})};function at({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 Ke(){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 hs(e,t,n,s){const i=$b(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=Gb(c);return Fb(d,i,n)})}function Rb(e,t){const n=ml.decode(t);n!==e&&(console.error("Inconsistent sql"),console.groupCollapsed("Inconsistent sql"),console.table({before:e,after:t,v:n}),console.groupEnd())}async function Wb({query:e,name:t,payload:n,additionals:s},i){if(!e.sql)return[];const{type:o,key:l,sql:c,pre_process:u,post_process:d}=e,p=Us(c,n),h=kf({sql:p,pre_process:u}),x=ml.encode(h);Rb(h,x);let y=await Bt.query(i)({type:o,key:l,query:x,...s},{params:{name:t}});return y=Df(d,y,ga(n)),y}async function Qb({type:e,key:t,configString:n,name:s,additionals:i},o){try{return await Bt.httpDataSourceQuery(o)({type:e,key:t,query:n,...i},{params:{name:s}})}catch(l){if(Ot.isCancel(l))throw l;return console.error(l),l}}async function fa(){try{return(await Bt.post()("/datasource/list",{filter:{},sort:[{field:"create_time",order:"ASC"}],pagination:{page:1,pagesize:100}},{})).data}catch(e){return console.error(e),[]}}async function dd(){try{return(await Bt.post()("/sql_snippet/list",{filter:{},sort:[{field:"id",order:"ASC"}],pagination:{page:1,pagesize:1e3}},{})).data}catch(e){return console.error(e),[]}}class pd{constructor(t){N(this,"rootRef");this.rootRef=te.observable({current:t})}async deleteItem(t){te.runInAction(()=>{v.unset(this.rootRef.current,[t])})}getItem(t){const n=this.getValueFromRoot(t);return Promise.resolve(n)}getValueFromRoot(t){return t===null?te.toJS(this.rootRef.current):v.get(this.rootRef.current,[t])}setItem(t,n){if(t===null)if(v.isObject(n))te.runInAction(()=>{this.rootRef.current=n});else throw new Error("Cannot set root value to non-object");else te.runInAction(()=>{v.set(this.rootRef.current,[t],n)});return Promise.resolve(this.getItem(t))}watchItem(t,n,s){return te.reaction(()=>this.getValueFromRoot(t),(i,o)=>{n(i,o)},{requiresObservable:!0,fireImmediately:v.get(s,"fireImmediately",!1)})}}class Ub{constructor(){N(this,"channels",new Map);N(this,"globalChannel",new bl)}getChannel(t){const n=this.channels.get(t);if(n)return n;const s=new bl;return this.channels.set(t,s),s}}class Yb{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 Ub,instanceData:new pd(t.viz.conf)};return this.instances.set(t.id,s),s}}function hd(e,t,n,s){return{vizManager:n,locale:"zh",msgChannels:e.messageChannels,instanceData:e.instanceData,pluginData:new pd({}),colorPalette:{getColor(){return()=>""}},data:t,variables:s}}const Kb=e=>{const{panel:t,measure:n,vizManager:s,data:i,variables:o}=e,l=s.resolveComponent(t.viz.type),c=s.getOrCreateInstance(t),u={...hd(c,i,s,o),viewport:{width:n.w,height:n.h}},d=l.viewRender;return r.jsx(d,{context:u,instance:c,...v.omit(e,["panel","vizManager","data"])})},Xb=e=>{const{vizManager:t,panel:n,data:s,variables:i}=e,o=t.resolveComponent(n.viz.type),l=t.getOrCreateInstance(n),c={...hd(l,s,t,i)},u=o.configRender;return r.jsx(u,{context:c,instance:l,...v.omit(e,["panel","vizManager","data"])})},gd=(e,t)=>{const n=Ct.bezier(e),s=Ct.bezier(t);return function(i){return i<50?n(i*2/100).hex():s((i-50)*2/100).hex()}},gs=e=>{const t=Ct.bezier(e);return function(n){return t(n/100).hex()}},Jb={type:"interpolation",displayName:"style.color.interpolation.palette.red_green",getColor:gd(["darkred","deeppink","lightyellow"],["lightyellow","lightgreen","teal"]),name:"red-green",category:"diverging"},Zb={type:"interpolation",displayName:"style.color.interpolation.palette.yellow_blue",getColor:gd(["#8f531d","#ffd347","#e3efe3"],["#eefaee","#4ecbbf","#003f94"]),name:"yellow-blue",category:"diverging"},Hb={type:"interpolation",displayName:"style.color.interpolation.palette.red",getColor:gs(["#fff7f1","darkred"]),name:"red",category:"sequential"},ey={type:"interpolation",displayName:"style.color.interpolation.palette.green",getColor:gs(["#f0ffed","darkgreen"]),name:"green",category:"sequential"},ty={type:"interpolation",displayName:"style.color.interpolation.palette.blue",getColor:gs(["#f9fcff","#48b3e9","darkblue"]),name:"blue",category:"sequential"},ny={type:"interpolation",displayName:"style.color.interpolation.palette.orange",getColor:gs(["#fff7f1","darkorange","#b60000"]),name:"orange",category:"sequential"};class ry{constructor(t){N(this,"symbol");this.symbol=Symbol(t)}}function Zt(e){return new ry(e)}class xa{constructor(){N(this,"parent");N(this,"factoryRegistry",new Map);N(this,"instanceRegistry",new Map)}createScoped(){const t=new xa;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 fd="13.43.3",sy=Object.freeze(Object.defineProperty({__proto__:null,version:fd},Symbol.toStringTag,{value:"Module"}));class iy{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 ay{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 oy{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),o=v.orderBy(i,"version","asc");if(((l=v.last(o))==null?void 0:l.version)!==t.to)throw new Error(`Migration to version ${t.to} not found`);return o.reduce((c,u)=>u.handler(c,s),n)}}class Te extends oy{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),o=this.run({from:i,to:this.VERSION},s,{panelModel:n});await t.setItem(null,o)}async needMigration({configData:t}){const n=await t.getItem(null);return v.get(n,"version",0)<this.VERSION}}const W=(e,t)=>{const[n,{setFalse:s}]=Y.useBoolean(!0),[i,o]=g.useState();g.useEffect(()=>(e.getItem(t).then(c=>{o(c),s()}),e.watchItem(t,c=>{o(c)})));const l=g.useCallback(async c=>{await e.setItem(t,c),o(c)},[e,t]);return{loading:n,value:i,set:l}},rt={top:16,right:16,bottom:16,left:16},zt=e=>Math.max(0,e-rt.left-rt.right),It=e=>Math.max(0,e-rt.top-rt.bottom),kr=(e,t)=>({width:zt(e),height:It(t)}),st=({width:e,height:t,children:n})=>r.jsx(a.Box,{pt:rt.top,pr:rt.right,pb:rt.bottom,pl:rt.left,sx:{width:e,height:t,overflow:"hidden",position:"relative"},children:n}),ma={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 ly({context:e}){const{value:t}=W(e.instanceData,"config"),n=e.data,{width:s,height:i}=e.viewport,{x_axis_data_key:o,y_axis_data_key:l,z_axis_data_key:c,xAxis3D:u,yAxis3D:d,zAxis3D:p}=v.defaults({},t,ma),h=g.useMemo(()=>Br(n,o),[n,o]),{x,y,z:m}=g.useMemo(()=>({x:O(o),y:O(l),z:O(c)}),[o,l,c]),{min:j,max:k}=g.useMemo(()=>{const D=v.minBy(h,M=>M[m.columnKey]),I=v.maxBy(h,M=>M[m.columnKey]);return{min:v.get(D,m.columnKey),max:v.get(I,m.columnKey)}},[h,m]),T={tooltip:{},backgroundColor:"#fff",visualMap:{show:!0,dimension:2,min:j,max:k,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}},xAxis3D:u,yAxis3D:d,zAxis3D:p,grid3D:{viewControl:{projection:"orthographic",autoRotate:!1},light:{main:{shadow:!0,quality:"ultra",intensity:1.5}}},series:[{type:"bar3D",wireframe:{},data:h.map(D=>[D[x.columnKey],D[y.columnKey],D[m.columnKey]])}]};return t?r.jsx(st,{width:s,height:i,children:r.jsx(Re,{echarts:Fe,option:T,style:kr(s,i),notMerge:!0,theme:"merico-light"})}):null}const Q=z.observer(g.forwardRef(({label:e,required:t,description:n,value:s,onChange:i,queryID:o,clearable:l=!1,sx:c,...u},d)=>{const{panel:p}=Pe(),h=g.useMemo(()=>p.dataFieldOptionGroups(s,l,o),[s,l,o]);if(h.length===0){const x=p.explainDataKey(s);return r.jsxs(a.HoverCard,{shadow:"md",position:"bottom-start",withinPortal:!0,zIndex:320,children:[r.jsx(a.HoverCard.Target,{children:r.jsx(a.Box,{children:r.jsx(a.TextInput,{label:e,required:t,defaultValue:x.columnKey,readOnly:!0,disabled:!0})})}),r.jsx(a.HoverCard.Dropdown,{children:r.jsxs(a.Group,{justify:"flex-start",gap:0,children:[r.jsx(a.Text,{size:"xs",c:x.queryName?"black":"red",ff:"monospace",children:x.queryName??x.queryID}),r.jsx(a.Text,{size:"xs",c:"black",ff:"monospace",children:"."}),r.jsx(a.Text,{size:"xs",c:"red",ff:"monospace",children:x.columnKey})]})})]})}return r.jsx(a.Select,{ref:d,label:e,description:n,data:h,value:s,onChange:Ce(i),required:t,sx:c,maxDropdownHeight:500,...u})}));function cy({context:e}){const{value:t,set:n}=W(e.instanceData,"config"),s=v.defaults({},t,ma),{control:i,handleSubmit:o,reset:l}=b.useForm({defaultValues:s});return g.useEffect(()=>{l(s)},[t]),t?r.jsx(a.Stack,{gap:"xs",children:r.jsxs("form",{onSubmit:o(n),children:[r.jsx(a.Text,{size:"sm",children:"X Axis"}),r.jsxs(a.Group,{justify:"space-between",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(Q,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"xAxis3D.name",control:i,render:({field:c})=>r.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(a.Text,{mt:"lg",size:"sm",children:"Y Axis"}),r.jsxs(a.Group,{justify:"space-between",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(Q,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"yAxis3D.name",control:i,render:({field:c})=>r.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(a.Text,{mt:"lg",size:"sm",children:"Z Axis"}),r.jsxs(a.Group,{justify:"space-between",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(Q,{label:"Data Field",required:!0,...c})}),r.jsx(b.Controller,{name:"zAxis3D.name",control:i,render:({field:c})=>r.jsx(a.TextInput,{sx:{flexGrow:1},size:"md",label:"Name",...c})})]}),r.jsx(a.Group,{justify:"center",mt:"xl",grow:!0,sx:{width:"60%"},mx:"auto",children:r.jsxs(a.Button,{color:"blue",type:"submit",children:[r.jsx(C.IconDeviceFloppy,{size:20}),r.jsx(a.Text,{ml:"md",size:"sm",children:"Save"})]})})]})}):null}const uy=[{lang:"en",resources:{bar_chart_3d:{viz_name:"Bar Chart(3D)"}}},{lang:"zh",resources:{bar_chart_3d:{viz_name:"柱图(3D)"}}}];function dy(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:o,z_axis_data_key:l,...c}=e;return{...c,x_axis_data_key:s(i),y_axis_data_key:s(o),z_axis_data_key:s(l)}}catch(n){throw console.error("[Migration failed]",n),n}}class py extends Te{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:dy(i,s)}})}}const hy={displayName:"viz.bar_chart_3d.viz_name",displayGroup:"chart.groups.echarts_based_charts",migrator:new py,name:"bar-3d",viewRender:ly,configRender:cy,createConfig(){return{version:2,config:v.cloneDeep(ma)}},translation:uy},gy=({disabled:e,value:t,onChange:n})=>{const s=i=>{i&&n(i)};return r.jsxs(a.Box,{sx:{position:"relative"},children:[e&&r.jsx(a.Overlay,{backgroundOpacity:.6,color:"#fff",zIndex:5,blur:2}),r.jsx(ut,{height:"500px",defaultLanguage:"javascript",value:t,onChange:s,theme:"vs-dark",options:{minimap:{enabled:!1},readOnly:e}})]})};function at({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 Ke(){return{enabled:!1,func_content:["function label(value, index) {"," // your code goes here"," // return value","}"].join(`
93
93
  `)}}const Mt=g.forwardRef(({value:e,onChange:t,triggerButtonText:n},s)=>{const{t:i}=_.useTranslation(),[o,{setTrue:l,setFalse:c}]=Y.useBoolean(),[u,d]=g.useState(e);g.useEffect(()=>{d(e)},[e]);const p=k=>{d({...u,enabled:k})},h=()=>{c();const{enabled:k,func_content:T}=u,D={enabled:k,func_content:T};d(D),t(D)},x=()=>{c(),d(e)},y=k=>{d(T=>({...T,func_content:k}))},m=()=>{y(Ke().func_content)},j=n??i("chart.axis.customize_label");return r.jsxs(r.Fragment,{children:[r.jsx(a.Button,{variant:"filled",color:"grape",leftSection:r.jsx(C.IconMathFunction,{size:16}),mt:24,onClick:l,sx:{flexGrow:0},children:j}),r.jsx(a.Modal,{size:800,title:j,opened:o,onClose:c,closeOnClickOutside:!1,withCloseButton:!1,zIndex:320,children:o&&r.jsxs(a.Stack,{children:[r.jsx(a.Checkbox,{mt:10,label:i("common.enabled"),checked:u.enabled,onChange:k=>p(k.currentTarget.checked)}),r.jsx(gy,{value:u.func_content,onChange:y,disabled:!u.enabled}),r.jsxs(a.Group,{justify:"space-between",children:[r.jsx(a.Button,{onClick:m,color:"red",leftSection:r.jsx(C.IconRecycle,{size:20}),children:i("common.actions.reset_to_default")}),r.jsxs(a.Group,{justify:"flex-end",children:[r.jsx(a.Button,{onClick:x,variant:"subtle",children:i("common.actions.cancel")}),r.jsx(a.Button,{color:"green",leftSection:r.jsx(C.IconDeviceFloppy,{size:16}),onClick:h,children:i("common.actions.save")})]})]})]})})]})}),wn={x_axis_scroll:!1,y_axis_scroll:!1,x_axis_slider:!1,y_axis_slider:!1};function xd(){return v.cloneDeep(wn)}const fy=[{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:"点击箱体、散点或异常点"}}}}],md={id:"builtin:echarts:click-echart:series",displayName:"viz.boxplot.click_series.label",nameRender:my,configRender:xy,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 xy(e){return r.jsx(r.Fragment,{})}function my(e){const{t}=_.useTranslation();return r.jsx(a.Text,{size:"sm",children:t("viz.boxplot.click_series.label")})}const fs=g.forwardRef(({sectionTitle:e,value:t,onChange:n},s)=>{const{t:i,i18n:o}=_.useTranslation(),l=u=>d=>{const p=v.cloneDeep(t);v.set(p,u,d),n(p)},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"}],[o.language]);return r.jsxs(a.Stack,{gap:0,children:[e&&r.jsx(a.Divider,{mb:-5,mt:5,variant:"dotted",label:e,labelPosition:"right",styles:{label:{color:"dimmed"}}}),r.jsxs(a.Group,{grow:!0,wrap:"nowrap",children:[r.jsx(a.NumberInput,{label:i("chart.axis.overflow.max_width"),hideControls:!0,value:t.width,onChange:l("width")}),r.jsx(a.Select,{label:i("chart.axis.overflow.label"),data:c,value:t.overflow,onChange:l("overflow")}),r.jsx(a.TextInput,{label:i("chart.axis.overflow.ellipsis"),value:t.ellipsis,disabled:!0})]})]})}),Et=g.forwardRef(({value:e,onChange:t},n)=>{const{t:s}=_.useTranslation(),i=l=>{t({...e,on_axis:l})},o=l=>{t({...e,in_tooltip:l})};return r.jsxs(a.Stack,{ref:n,gap:0,children:[r.jsx(fs,{sectionTitle:s("chart.axis.overflow.section_title.on_axis"),value:e.on_axis,onChange:i}),r.jsx(fs,{sectionTitle:s("chart.axis.overflow.section_title.in_tooltip"),value:e.in_tooltip,onChange:o})]})});function ot(){return{on_axis:{width:80,overflow:"truncate",ellipsis:"..."},in_tooltip:{width:200,overflow:"break",ellipsis:"..."}}}function vt({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};