@malloy-publisher/server 0.8.1 → 0.8.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.
Files changed (27) hide show
  1. package/dist/app/api-doc.yaml +84 -19
  2. package/dist/app/assets/EnvironmentPage-D7q_mnLa.js +1 -0
  3. package/dist/app/assets/HomePage-CuE7CQ6D.js +1 -0
  4. package/dist/app/assets/{LightMode-emBuHCdz.js → LightMode-8tTlWDaS.js} +1 -1
  5. package/dist/app/assets/{MainPage-BVqdH0TB.js → MainPage-Bh0ouhmb.js} +2 -2
  6. package/dist/app/assets/ModelPage-RZ9sXvLC.js +2 -0
  7. package/dist/app/assets/PackagePage-DBdb47ZN.js +1 -0
  8. package/dist/app/assets/{RenderedResult-CDA9mN_6.es-C4f_ZzvB.js → RenderedResult-BfayOSk1.es-PT9iz4RF.js} +3 -3
  9. package/dist/app/assets/{RouteError-CtRFTa_q.js → RouteError-CZMzHtwS.js} +1 -1
  10. package/dist/app/assets/{ThemeEditorPage-Bnd5dgI0.js → ThemeEditorPage-D8rQ1UJ_.js} +1 -1
  11. package/dist/app/assets/{ToggleButtonGroup-CxU1OIGN.js → ToggleButtonGroup-CPFcR4JM.js} +1 -1
  12. package/dist/app/assets/{index-BWGMOIxQ.js → index-BDtgOesj.js} +1 -1
  13. package/dist/app/assets/{index-xgxo45Xn.js → index-BS2OPPD1.js} +1 -1
  14. package/dist/app/assets/{index-aXk5ykLp.js → index-BxPJ-qDv.js} +1 -1
  15. package/dist/app/assets/{index-OsUlLBi_.js → index-Cac5moUn.js} +1 -1
  16. package/dist/app/assets/index-zr-x34Gt.js +442 -0
  17. package/dist/app/assets/{index.es-BCvB2VgL.js → index.es-CsApNQ2l.js} +4 -4
  18. package/dist/app/index.html +1 -1
  19. package/dist/instrumentation.mjs +3572 -3375
  20. package/dist/package_load_worker.mjs +6852 -173
  21. package/dist/server.mjs +15885 -4166
  22. package/package.json +5 -4
  23. package/dist/app/assets/EnvironmentPage-dgZIJhMw.js +0 -1
  24. package/dist/app/assets/HomePage-D2FGM4cV.js +0 -1
  25. package/dist/app/assets/ModelPage-DAJxkTmk.js +0 -2
  26. package/dist/app/assets/PackagePage-BGGcyDeJ.js +0 -1
  27. package/dist/app/assets/index-CNQ_NxFx.js +0 -442
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-xgxo45Xn.js","assets/index-CNQ_NxFx.js","assets/index-DUqldpo0.css","assets/index-w_0OQJgZ.js","assets/index-CRAwrhYM.js","assets/index-aXk5ykLp.js"])))=>i.map(i=>d[i]);
2
- import{r as S,aM as ku,aN as yn,j as b,aa as he,aO as Su,at as Wt,N as pe,aP as ju,aQ as $u,U as kl,ar as Ou,aR as Mu,aS as ri,aT as ya,aU as Cu,a4 as Sl,a0 as Eu,ay as ke,a5 as jl,aV as Pu,a8 as $l,aW as Du,aX as ii,G as tt,aY as Ol,aZ as Zt,a_ as xs,H as kn,I as ws,O as go,T as ne,a$ as Tu,b0 as Au,ax as zi,am as De,aq as bt,b1 as ks,an as Ml,Y as Cl,b2 as Iu,b3 as Ru,Q as Wu,W as zu,b4 as Lu,b5 as Nu,b6 as _u,b7 as Fu,b8 as qu,b9 as Ss,ba as Hu,bb as Uu,aI as Yu}from"./index-CNQ_NxFx.js";import{T as Gu,a as xa}from"./ToggleButtonGroup-CxU1OIGN.js";var wa={},Vu=Symbol.for("preact-signals");function Li(){if(yt>1)yt--;else{var e,t=!1;for((function(){var i=xi;for(xi=void 0;i!==void 0;){var s=i.S;if(s.v===i.v)for(var o=s.t;o!==void 0;o=o.x)o.i===i.i&&(o.i=s.i);i=i.o}})();pr!==void 0;){var n=pr;for(pr=void 0,yi++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Pl(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=r}}if(yi=0,yt--,t)throw e}}function de(e){if(yt>0)return e();js=++Ku,yt++;try{return e()}finally{Li()}}var fr,ie=void 0;function H(e){var t=ie,n=fr;ie=void 0,fr=void 0;try{return e()}finally{ie=t,fr=n}}var pr=void 0,yt=0,yi=0,Ku=0,js=0,xi=void 0,wi=0;function El(e){if(ie!==void 0){var t=e.n;if(t===void 0||t.t!==ie)return t={i:0,S:e,p:ie.s,n:void 0,t:ie,e:void 0,x:void 0,r:t},ie.s!==void 0&&(ie.s.n=t),ie.s=t,e.n=t,32&ie.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=ie.s,t.n=void 0,ie.s.n=t,ie.s=t),t}}function Le(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Le.prototype.brand=Vu;Le.prototype.h=function(){return!0};Le.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:H(function(){var r;(r=t.W)==null||r.call(t)}))};Le.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&H(function(){var i;(i=t.Z)==null||i.call(t)}))}};Le.prototype.subscribe=function(e){var t=this;return nt(function(){var n=t.value;H(function(){return e(n)})},{name:"sub"})};Le.prototype.valueOf=function(){return this.value};Le.prototype.toString=function(){return this.value+""};Le.prototype.toJSON=function(){return this.value};Le.prototype.peek=function(){var e=this;return H(function(){return e.value})};Object.defineProperty(Le.prototype,"value",{get:function(){var e=El(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(yi>100)throw new Error("Cycle detected");(function(n){yt!==0&&yi===0&&n.l!==js&&(n.l=js,xi={S:n,v:n.v,i:n.i,o:xi})})(this),this.v=e,this.i++,wi++,yt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Li()}}}});function An(e,t){return new Le(e,t)}function Pl(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 Dl(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 Tl(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Jt(e,t){Le.call(this,void 0,t),this.x=e,this.s=void 0,this.g=wi-1,this.f=4}Jt.prototype=new Le;Jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===wi))return!0;if(this.g=wi,this.f|=1,this.i>0&&!Pl(this))return this.f&=-2,!0;var e=ie;try{Dl(this),ie=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 ie=e,Tl(this),this.f&=-2,!0};Jt.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)}Le.prototype.S.call(this,e)};Jt.prototype.U=function(e){if(this.t!==void 0&&(Le.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)}};Jt.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(Jt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=El(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ka(e,t){return new Jt(e,t)}function Al(e){var t=e.m;if(e.m=void 0,typeof t=="function"){yt++;var n=ie;ie=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,mo(e),r}finally{ie=n,Li()}}}function mo(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Al(e)}function Xu(e){if(ie!==this)throw new Error("Out-of-order effect");Tl(this),ie=e,this.f&=-2,8&this.f&&mo(this),Li()}function In(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,fr&&fr.push(this)}In.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.m=t)}finally{e()}};In.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Al(this),Dl(this),yt++;var e=ie;return ie=this,Xu.bind(this,e)};In.prototype.N=function(){2&this.f||(this.f|=2,this.u=pr,pr=this)};In.prototype.d=function(){this.f|=8,1&this.f||mo(this)};In.prototype.dispose=function(){this.d()};function nt(e,t){var n=new In(e,t);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Bu=Object.create,vo=Object.defineProperty,Zu=Object.defineProperties,Ju=Object.getOwnPropertyDescriptor,Qu=Object.getOwnPropertyDescriptors,Sa=Object.getOwnPropertySymbols,eh=Object.prototype.hasOwnProperty,th=Object.prototype.propertyIsEnumerable,nh=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Rn=e=>{throw TypeError(e)},$s=(e,t,n)=>t in e?vo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rh=(e,t)=>{for(var n in t||(t={}))eh.call(t,n)&&$s(e,n,t[n]);if(Sa)for(var n of Sa(t))th.call(t,n)&&$s(e,n,t[n]);return e},ih=(e,t)=>Zu(e,Qu(t)),ja=(e,t)=>vo(e,"name",{value:t,configurable:!0}),sh=e=>{var t;return[,,,Bu((t=void 0)!=null?t:null)]},Il=["class","method","getter","setter","accessor","field","value","get","set"],Zn=e=>e!==void 0&&typeof e!="function"?Rn("Function expected"):e,oh=(e,t,n,r,i)=>({kind:Il[e],name:t,metadata:r,addInitializer:s=>n._?Rn("Already initialized"):i.push(Zn(s||null))}),Rl=(e,t)=>$s(t,nh("metadata"),e[3]),Rt=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},Wn=(e,t,n,r,i,s)=>{var o,a,l,u,c,d=t&7,f=!!(t&8),h=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,g=Il[d+5],w=d>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),p=d&&(!h&&!f&&(i=i.prototype),d<5&&(d>3||!h)&&Ju(d<4?i:{get[n](){return Ze(this,s)},set[n](v){return Ot(this,s,v)}},n));d?h&&d<4&&ja(s,(d>2?"set ":d>1?"get ":"")+n):ja(i,n);for(var x=r.length-1;x>=0;x--)u=oh(d,n,l={},e[3],y),d&&(u.static=f,u.private=h,c=u.access={has:h?v=>ah(i,v):v=>n in v},d^3&&(c.get=h?v=>(d^1?Ze:lh)(v,i,d^4?s:p.get):v=>v[n]),d>2&&(c.set=h?(v,k)=>Ot(v,i,k,d^4?s:p.set):(v,k)=>v[n]=k)),a=(0,r[x])(d?d<4?h?s:p[g]:d>4?void 0:{get:p.get,set:p.set}:i,u),l._=1,d^4||a===void 0?Zn(a)&&(d>4?w.unshift(a):d?h?s=a:p[g]=a:i=a):typeof a!="object"||a===null?Rn("Object expected"):(Zn(o=a.get)&&(p.get=o),Zn(o=a.set)&&(p.set=o),Zn(o=a.init)&&w.unshift(o));return d||Rl(e,i),p&&vo(i,n,p),h?d^4?s:p:i},bo=(e,t,n)=>t.has(e)||Rn("Cannot "+n),ah=(e,t)=>Object(t)!==t?Rn('Cannot use the "in" operator on this value'):e.has(t),Ze=(e,t,n)=>(bo(e,t,"read from private field"),n?n.call(e):t.get(e)),Jn=(e,t,n)=>t.has(e)?Rn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ot=(e,t,n,r)=>(bo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),lh=(e,t,n)=>(bo(e,t,"access private method"),n);function Os(e,t){if(t){let n;return ka(()=>{const r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return ka(e)}function st(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e=="function"&&typeof t=="function")return e===t;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((n,r)=>!st(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:!n.some(i=>!st(e[i],t[i]))}return!1}function U({get:e},t){return{init(n){return An(n)},get(){return e.call(this).value},set(n){const r=e.call(this);r.peek()!==n&&(r.value=n)}}}function fe(e,t){const n=new WeakMap;return function(){let r=n.get(this);return r||(r=Os(e.bind(this)),n.set(this,r)),r.value}}function ns(e=!0){return function(t,n){n.addInitializer(function(){const r=n.kind==="field"?this:n.static?this:Object.getPrototypeOf(this),i=Object.getOwnPropertyDescriptor(r,n.name);i&&Object.defineProperty(r,n.name,ih(rh({},i),{enumerable:e}))})}}function Pr(...e){const t=e.map(n=>nt(n));return()=>t.forEach(n=>n())}var Wl,zl,Ll,Nl,_l,Fl,Re,yo,rs,Ms,Cs,Pe,xo,is,ql,Es,wo,ss,Ps,Ds;Fl=[U],_l=[U],Nl=[U],Ll=[ns()],zl=[ns()],Wl=[ns()];var Qt=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,Rt(Re,5,this),Jn(this,Pe),Jn(this,yo,Rt(Re,8,this)),Rt(Re,11,this),Jn(this,xo,Rt(Re,12,this)),Rt(Re,15,this),Jn(this,wo,Rt(Re,16,this)),Rt(Re,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return Ze(this,Pe,Ps)}get initial(){return Ze(this,Pe,Ms)}get previous(){return Ze(this,Pe,ql)}set current(e){const t=H(()=>Ze(this,Pe,Ps));e&&t&&this.equals(t,e)||de(()=>{Ze(this,Pe,Ms)||Ot(this,Pe,e,Cs),Ot(this,Pe,t,Es),Ot(this,Pe,e,Ds)})}reset(e=this.defaultValue){de(()=>{Ot(this,Pe,void 0,Es),Ot(this,Pe,e,Cs),Ot(this,Pe,e,Ds)})}};Re=sh();yo=new WeakMap;Pe=new WeakSet;xo=new WeakMap;wo=new WeakMap;rs=Wn(Re,20,"#initial",Fl,Pe,yo),Ms=rs.get,Cs=rs.set;is=Wn(Re,20,"#previous",_l,Pe,xo),ql=is.get,Es=is.set;ss=Wn(Re,20,"#current",Nl,Pe,wo),Ps=ss.get,Ds=ss.set;Wn(Re,2,"current",Ll,Qt);Wn(Re,2,"initial",zl,Qt);Wn(Re,2,"previous",Wl,Qt);Rl(Re,Qt);function os(e){return H(()=>{const t={};for(const n in e)t[n]=e[n];return t})}var zt,ch=class{constructor(){Jn(this,zt,new WeakMap)}get(e,t){var n;return e?(n=Ze(this,zt).get(e))==null?void 0:n.get(t):void 0}set(e,t,n){var r;if(e)return Ze(this,zt).has(e)||Ze(this,zt).set(e,new Map),(r=Ze(this,zt).get(e))==null?void 0:r.set(t,n)}clear(e){var t;return e?(t=Ze(this,zt).get(e))==null?void 0:t.clear():void 0}};zt=new WeakMap;var dh=Object.create,Hl=Object.defineProperty,uh=Object.getOwnPropertyDescriptor,$a=Object.getOwnPropertySymbols,hh=Object.prototype.hasOwnProperty,fh=Object.prototype.propertyIsEnumerable,Ul=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Ni=e=>{throw TypeError(e)},Oa=Math.pow,Ts=(e,t,n)=>t in e?Hl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ph=(e,t)=>{for(var n in t||(t={}))hh.call(t,n)&&Ts(e,n,t[n]);if($a)for(var n of $a(t))fh.call(t,n)&&Ts(e,n,t[n]);return e},gh=e=>{var t;return[,,,dh((t=e?.[Ul("metadata")])!=null?t:null)]},Yl=["class","method","getter","setter","accessor","field","value","get","set"],Gl=e=>e!==void 0&&typeof e!="function"?Ni("Function expected"):e,mh=(e,t,n,r,i)=>({kind:Yl[e],name:t,metadata:r,addInitializer:s=>n._?Ni("Already initialized"):i.push(Gl(s||null))}),vh=(e,t)=>Ts(t,Ul("metadata"),e[3]),bh=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Vl=(e,t,n,r,i,s)=>{for(var o,a,l,u,c=t&7,d=!1,f=!1,h=2,m=Yl[c+5],g=e[h]||(e[h]=[]),w=(i=i.prototype,uh(i,n)),y=r.length-1;y>=0;y--)l=mh(c,n,a={},e[3],g),l.static=d,l.private=f,u=l.access={has:p=>n in p},u.get=p=>p[n],o=(0,r[y])(w[m],l),a._=1,Gl(o)&&(w[m]=o);return w&&Hl(i,n,w),i},Kl=(e,t,n)=>t.has(e)||Ni("Cannot "+n),yh=(e,t,n)=>(Kl(e,t,"read from private field"),t.get(e)),xh=(e,t,n)=>t.has(e)?Ni("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),wh=(e,t,n,r)=>(Kl(e,t,"write to private field"),t.set(e,n),n),Je=class As{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new As(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 As(t,n)}},ht=class Lt{constructor(t,n,r,i){this.left=t,this.top=n,this.width=r,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:r,left:i,width:s,height:o,scale:a}=this,l=new Lt(i+t,r+n,s,o);return l.scale=ph({},a),l}get boundingRectangle(){const{width:t,height:n,left:r,top:i,right:s,bottom:o}=this;return{width:t,height:n,left:r,top:i,right:s,bottom:o}}get center(){const{left:t,top:n,right:r,bottom:i}=this;return new Je((t+r)/2,(n+i)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof Lt))return!1;const{left:n,top:r,width:i,height:s}=this;return n===t.left&&r===t.top&&i===t.width&&s===t.height}containsPoint(t){const{top:n,left:r,bottom:i,right:s}=this;return n<=t.y&&t.y<=i&&r<=t.x&&t.x<=s}intersectionArea(t){return t instanceof Lt?kh(this,t):0}intersectionRatio(t){const{area:n}=this,r=this.intersectionArea(t);return r/(t.area+n-r)}get bottom(){const{top:t,height:n}=this;return t+n}get right(){const{left:t,width:n}=this;return t+n}get aspectRatio(){const{width:t,height:n}=this;return t/n}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:i}){return new Lt(n,t,r,i)}static delta(t,n,r={x:"center",y:"center"}){const i=(s,o)=>{const a=r[o],l=o==="x"?s.left:s.top,u=o==="x"?s.width:s.height;return a=="start"?l:a=="end"?l+u:l+u/2};return Je.delta({x:i(t,"x"),y:i(t,"y")},{x:i(n,"x"),y:i(n,"y")})}static intersectionRatio(t,n){return Lt.from(t).intersectionRatio(Lt.from(n))}};function kh(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,a=s-n;return r<i&&n<s?o*a:0}var Xl,Bl,Is,si,Dr,_i=class extends(Is=Qt,Bl=[fe],Xl=[fe],Is){constructor(e){const t=Je.from(e);super(t,(n,r)=>Je.equals(n,r)),bh(Dr,5,this),xh(this,si,0),this.velocity={x:0,y:0}}get delta(){return Je.delta(this.current,this.initial)}get direction(){const{current:e,previous:t}=this;if(!t)return null;const n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?"right":"left":n.y>0?"down":"up"}get current(){return super.current}set current(e){const{current:t}=this,n=Je.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),s=i-yh(this,si),o=a=>Math.round(a/s*100);de(()=>{wh(this,si,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(Je.from(e)),this.velocity={x:0,y:0}}};Dr=gh(Is);si=new WeakMap;Vl(Dr,2,"delta",Bl,_i);Vl(Dr,2,"direction",Xl,_i);vh(Dr,_i);function Rs({x:e,y:t},n){const r=Math.abs(e),i=Math.abs(t);return typeof n=="number"?Math.sqrt(Oa(r,2)+Oa(i,2))>n:"x"in n&&"y"in n?r>n.x&&i>n.y:"x"in n?r>n.x:"y"in n?i>n.y:!1}var Zl=(e=>(e.Horizontal="x",e.Vertical="y",e))(Zl||{}),Jl=Object.values(Zl),Sh=Object.create,ko=Object.defineProperty,jh=Object.defineProperties,$h=Object.getOwnPropertyDescriptor,Oh=Object.getOwnPropertyDescriptors,ki=Object.getOwnPropertySymbols,Ql=Object.prototype.hasOwnProperty,ec=Object.prototype.propertyIsEnumerable,tc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),zn=e=>{throw TypeError(e)},Ws=(e,t,n)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,So=(e,t)=>{for(var n in t||(t={}))Ql.call(t,n)&&Ws(e,n,t[n]);if(ki)for(var n of ki(t))ec.call(t,n)&&Ws(e,n,t[n]);return e},jo=(e,t)=>jh(e,Oh(t)),Ma=(e,t)=>ko(e,"name",{value:t,configurable:!0}),nc=(e,t)=>{var n={};for(var r in e)Ql.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ki)for(var r of ki(e))t.indexOf(r)<0&&ec.call(e,r)&&(n[r]=e[r]);return n},Ln=e=>{var t;return[,,,Sh((t=e?.[tc("metadata")])!=null?t:null)]},rc=["class","method","getter","setter","accessor","field","value","get","set"],Qn=e=>e!==void 0&&typeof e!="function"?zn("Function expected"):e,Mh=(e,t,n,r,i)=>({kind:rc[e],name:t,metadata:r,addInitializer:s=>n._?zn("Already initialized"):i.push(Qn(s||null))}),en=(e,t)=>Ws(t,tc("metadata"),e[3]),N=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},Y=(e,t,n,r,i,s)=>{var o,a,l,u,c,d=t&7,f=!!(t&8),h=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,g=rc[d+5],w=d>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),p=d&&(!h&&!f&&(i=i.prototype),d<5&&(d>3||!h)&&$h(d<4?i:{get[n](){return ue(this,s)},set[n](v){return Ve(this,s,v)}},n));d?h&&d<4&&Ma(s,(d>2?"set ":d>1?"get ":"")+n):Ma(i,n);for(var x=r.length-1;x>=0;x--)u=Mh(d,n,l={},e[3],y),d&&(u.static=f,u.private=h,c=u.access={has:h?v=>Ch(i,v):v=>n in v},d^3&&(c.get=h?v=>(d^1?ue:ic)(v,i,d^4?s:p.get):v=>v[n]),d>2&&(c.set=h?(v,k)=>Ve(v,i,k,d^4?s:p.set):(v,k)=>v[n]=k)),a=(0,r[x])(d?d<4?h?s:p[g]:d>4?void 0:{get:p.get,set:p.set}:i,u),l._=1,d^4||a===void 0?Qn(a)&&(d>4?w.unshift(a):d?h?s=a:p[g]=a:i=a):typeof a!="object"||a===null?zn("Object expected"):(Qn(o=a.get)&&(p.get=o),Qn(o=a.set)&&(p.set=o),Qn(o=a.init)&&w.unshift(o));return d||en(e,i),p&&ko(i,n,p),h?d^4?s:p:i},$o=(e,t,n)=>t.has(e)||zn("Cannot "+n),Ch=(e,t)=>Object(t)!==t?zn('Cannot use the "in" operator on this value'):e.has(t),ue=(e,t,n)=>($o(e,t,"read from private field"),n?n.call(e):t.get(e)),Z=(e,t,n)=>t.has(e)?zn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ve=(e,t,n,r)=>($o(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ic=(e,t,n)=>($o(e,t,"access private method"),n);function sc(e,t){return{plugin:e,options:t}}function Tr(e){return t=>sc(e,t)}function xr(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var oc,wr,Oo,oi;oc=[U];var Te=class{constructor(e,t){this.manager=e,this.options=t,Z(this,Oo,N(wr,8,this,!1)),N(wr,11,this),Z(this,oi,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return H(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){const t=nt(e.bind(this));return ue(this,oi).add(t),t}destroy(){ue(this,oi).forEach(e=>e())}static configure(e){return sc(this,e)}};wr=Ln(null);Oo=new WeakMap;oi=new WeakMap;Y(wr,4,"disabled",oc,Te,Oo);en(wr,Te);var Ar=class extends Te{},ai,as=class{constructor(e){this.manager=e,this.instances=new Map,Z(this,ai,[])}get values(){return Array.from(this.instances.values())}set values(e){const t=e.map(xr).reduce((r,i)=>{const s=r.find(({plugin:o})=>o===i.plugin);return s?(s.options=i.options,r):[...r,i]},[]),n=t.map(({plugin:r})=>r);for(const r of ue(this,ai))if(!n.includes(r)){if(r.prototype instanceof Ar)continue;this.unregister(r)}for(const{plugin:r,options:i}of t)this.register(r,i);Ve(this,ai,n)}get(e){return this.instances.get(e)}register(e,t){const n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;const r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){const t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(const e of this.instances.values())e.destroy();this.instances.clear()}};ai=new WeakMap;function Eh(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var Yr=[],hn,fn,Ph=class extends Te{constructor(e){super(e),Z(this,hn),Z(this,fn),this.computeCollisions=this.computeCollisions.bind(this),Ve(this,fn,An(Yr)),this.destroy=Pr(()=>{const t=this.computeCollisions(),n=H(()=>this.manager.dragOperation.position.current);if(t!==Yr){const r=ue(this,hn);if(Ve(this,hn,n),r&&n.x==r.x&&n.y==r.y)return}else Ve(this,hn,void 0);ue(this,fn).value=t},()=>{const{dragOperation:t}=this.manager;t.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){H(()=>{e?ue(this,fn).value=this.computeCollisions():Ve(this,hn,void 0)})}computeCollisions(e,t){const{registry:n,dragOperation:r}=this.manager,{source:i,shape:s,status:o}=r;if(!o.initialized||!s)return Yr;const a=[],l=[];for(const u of e??n.droppables){if(u.disabled||i&&!u.accepts(i))continue;const c=t??u.collisionDetector;if(!c)continue;l.push(u),u.shape;const d=H(()=>c({droppable:u,dragOperation:r}));d&&(u.collisionPriority!=null&&(d.priority=u.collisionPriority),a.push(d))}return l.length===0?Yr:(a.sort(Eh),a)}get collisions(){return ue(this,fn).value}};hn=new WeakMap;fn=new WeakMap;var ac,lc,cc,Mo,dc,ot,Co,xn,Eo,Po;cc=[U],lc=[U],ac=[U];var wt=class Nt{constructor(t,n){Z(this,Co,N(ot,8,this)),N(ot,11,this),Z(this,xn),Z(this,Eo,N(ot,12,this)),N(ot,15,this),Z(this,Po,N(ot,16,this)),N(ot,19,this);const{effects:r,id:i,data:s={},disabled:o=!1,register:a=!0}=t;let l=i;Ve(this,xn,An(i)),this.manager=n,this.data=s,this.disabled=o,this.effects=()=>{var u;return[()=>{const{id:c,manager:d}=this;if(c!==l)return l=c,d?.registry.register(this),()=>d?.registry.unregister(this)},...(u=r?.())!=null?u:[]]},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),n&&a&&queueMicrotask(this.register)}get id(){var t,n;const r=ue(this,xn).value;return(n=(t=Nt.pendingIdChanges)==null?void 0:t.get(this))!=null?n:r}set id(t){var n,r;const i=(r=(n=Nt.pendingIdChanges)==null?void 0:n.get(this))!=null?r:ue(this,xn).peek();t!==i&&(Nt.pendingIdChanges||(Nt.pendingIdChanges=new Map,queueMicrotask(()=>{var s;return ic(s=Nt,Mo,dc).call(s)})),Nt.pendingIdChanges.set(this,t))}register(){var t;return(t=this.manager)==null?void 0:t.registry.register(this)}unregister(){var t;(t=this.manager)==null||t.registry.unregister(this)}destroy(){var t;(t=this.manager)==null||t.registry.unregister(this)}};ot=Ln(null);Mo=new WeakSet;dc=function(){const e=wt.pendingIdChanges;wt.pendingIdChanges=null,e&&de(()=>{for(const[t,n]of e)ue(t,xn).value=n})};Co=new WeakMap;xn=new WeakMap;Eo=new WeakMap;Po=new WeakMap;Y(ot,4,"manager",cc,wt,Co);Y(ot,4,"data",lc,wt,Eo);Y(ot,4,"disabled",ac,wt,Po);Z(wt,Mo);en(ot,wt);wt.pendingIdChanges=null;var Fi=wt,Ca=class{constructor(){this.map=An(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{const n=this.map.peek(),r=n.get(e),i=()=>this.unregister(e,t);if(r===t)return i;r&&r.id===e&&(this.cleanupFunctions.get(r)?.(),this.cleanupFunctions.delete(r));const s=new Map(n);for(const[a,l]of n)if(l===t&&a!==e){s.delete(a);break}s.set(e,t),this.map.value=s;const o=Pr(...t.effects());return this.cleanupFunctions.set(t,o),i},this.unregister=(e,t)=>{const n=this.map.peek();if(n.get(e)!==t)return;this.cleanupFunctions.get(t)?.(),this.cleanupFunctions.delete(t);const i=new Map(n);i.delete(e),this.map.value=i}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(const e of this)this.cleanupFunctions.get(e)?.(),e.destroy();this.map.value=new Map}},uc,hc,fc,pc,gc,mc,zs,We,Do,To,Ao,ft=class extends(zs=Fi,mc=[U],gc=[U],pc=[U],fc=[fe],hc=[fe],uc=[fe],zs){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:s,plugins:o,effects:a}=n,l=nc(n,["modifiers","type","sensors","plugins","effects"]);super(jo(So({},l),{effects:()=>{var u;return[...(u=a?.())!=null?u:[],()=>{const{manager:c,plugins:d}=this;if(!(!c||!d))for(const f of d){const{plugin:h}=xr(f);c.registry.plugins.register(h)}}]}}),t),N(We,5,this),Z(this,Do,N(We,8,this)),N(We,11,this),Z(this,To,N(We,12,this)),N(We,15,this),Z(this,Ao,N(We,16,this,this.isDragSource?"dragging":"idle")),N(We,19,this),this.type=i,this.sensors=s,this.modifiers=r,this.alignment=l.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(const t of this.plugins){const n=xr(t);if(n.plugin===e)return n.options}}get isDropping(){return this.status==="dropping"&&this.isDragSource}get isDragging(){return this.status==="dragging"&&this.isDragSource}get isDragSource(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.source)==null?void 0:t.id)===this.id}};We=Ln(zs);Do=new WeakMap;To=new WeakMap;Ao=new WeakMap;Y(We,4,"type",mc,ft,Do);Y(We,4,"modifiers",gc,ft,To);Y(We,4,"status",pc,ft,Ao);Y(We,2,"isDropping",fc,ft);Y(We,2,"isDragging",hc,ft);Y(We,2,"isDragSource",uc,ft);en(We,ft);var vc,bc,yc,xc,wc,kc,Ls,we,Io,Ro,Wo,zo,Lo,pt=class extends(Ls=Fi,kc=[U],wc=[U],xc=[U],yc=[U],bc=[U],vc=[fe],Ls){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:s,type:o}=n,a=nc(n,["accept","collisionDetector","collisionPriority","type"]);super(a,t),N(we,5,this),Z(this,Io,N(we,8,this)),N(we,11,this),Z(this,Ro,N(we,12,this)),N(we,15,this),Z(this,Wo,N(we,16,this)),N(we,19,this),Z(this,zo,N(we,20,this)),N(we,23,this),Z(this,Lo,N(we,24,this)),N(we,27,this),this.accept=r,this.collisionDetector=i,this.collisionPriority=s,this.type=o}accepts(e){const{accept:t}=this;return t?typeof t=="function"?t(e):e.type?Array.isArray(t)?t.includes(e.type):e.type===t:!1:!0}get isDropTarget(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.target)==null?void 0:t.id)===this.id}};we=Ln(Ls);Io=new WeakMap;Ro=new WeakMap;Wo=new WeakMap;zo=new WeakMap;Lo=new WeakMap;Y(we,4,"accept",kc,pt,Io);Y(we,4,"type",wc,pt,Ro);Y(we,4,"collisionDetector",xc,pt,Wo);Y(we,4,"collisionPriority",yc,pt,zo);Y(we,4,"shape",bc,pt,Lo);Y(we,2,"isDropTarget",vc,pt);en(we,pt);var Dh=class{constructor(){this.registry=new Map}addEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){const{registry:n}=this,r=n.get(e);if(r)for(const i of r)i(...t)}},Th=class extends Dh{constructor(e){super(),this.manager=e}dispatch(e,t){const n=[t,this.manager];super.dispatch(e,...n)}};function li(e,t=!0){let n=!1;return jo(So({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var Ah=class extends Ar{constructor(e){super(e);const t=(r,i)=>r.map(({id:s})=>s).join("")===i.map(({id:s})=>s).join("");let n=[];this.destroy=Pr(()=>{const{dragOperation:r,collisionObserver:i}=e;r.status.initializing&&(n=[],i.enable())},()=>{const{collisionObserver:r,monitor:i}=e,{collisions:s}=r;if(r.isDisabled()||Fi.pendingIdChanges)return;const o=li({collisions:s});if(i.dispatch("collision",o),o.defaultPrevented||t(s,n))return;n=s;const[a]=s;H(()=>{var l;a?.id!==((l=e.dragOperation.target)==null?void 0:l.id)&&(r.disable(),e.actions.setDropTarget(a?.id).then(()=>{r.enable()}))})})}},Nn=(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))(Nn||{}),_n=(e=>(e[e.Collision=0]="Collision",e[e.ShapeIntersection=1]="ShapeIntersection",e[e.PointerIntersection=2]="PointerIntersection",e))(_n||{}),Sc,jc,$c,Oc,Mc,Cc,Ec,et,No;Ec=[U],Cc=[fe],Mc=[fe],Oc=[fe],$c=[fe],jc=[fe],Sc=[fe];var kt=class{constructor(){N(et,5,this),Z(this,No,N(et,8,this,"idle")),N(et,11,this)}get current(){return this.value}get idle(){return this.value==="idle"}get initializing(){return this.value==="initializing"}get initialized(){const{value:e}=this;return e!=="idle"&&e!=="initialization-pending"}get dragging(){return this.value==="dragging"}get dropped(){return this.value==="dropped"}set(e){this.value=e}};et=Ln(null);No=new WeakMap;Y(et,4,"value",Ec,kt,No);Y(et,2,"current",Cc,kt);Y(et,2,"idle",Mc,kt);Y(et,2,"initializing",Oc,kt);Y(et,2,"initialized",$c,kt);Y(et,2,"dragging",jc,kt);Y(et,2,"dropped",Sc,kt);en(et,kt);var Ih=class{constructor(e){this.manager=e}setDragSource(e){const{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e=="string"||typeof e=="number"?e:e.id}setDropTarget(e){return H(()=>{const{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;const r=li({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch("dragover",r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return H(()=>{const{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw new Error("Cannot start a drag operation without a drag source");if(!t.status.idle)throw new Error("Cannot start a drag operation while another is active");const n=new AbortController,{event:r,coordinates:i}=e;de(()=>{t.status.set("initialization-pending"),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});const s=li({operation:t.snapshot()});return this.manager.monitor.dispatch("beforedragstart",s),s.defaultPrevented?(t.reset(),n.abort(),n):(t.status.set("initializing"),t.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;const{status:o}=t;o.current==="initializing"&&de(()=>{t.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return H(()=>{var t,n;const{dragOperation:r}=this.manager,{status:i,controller:s}=r;if(!i.dragging||!s||s.signal.aborted)return;const o=li({nativeEvent:e.event,operation:r.snapshot(),by:e.by,to:e.to},(t=e.cancelable)!=null?t:!0);((n=e.propagate)==null||n)&&this.manager.monitor.dispatch("dragmove",o),queueMicrotask(()=>{var a,l,u,c,d;if(o.defaultPrevented)return;const f=(d=e.to)!=null?d:{x:r.position.current.x+((l=(a=e.by)==null?void 0:a.x)!=null?l:0),y:r.position.current.y+((c=(u=e.by)==null?void 0:u.y)!=null?c:0)};r.position.current=f})})}stop(e={}){return H(()=>{var t,n;const{dragOperation:r}=this.manager,{controller:i}=r;if(!i||i.signal.aborted)return;let s;const o=()=>{const l={resume:()=>{},abort:()=>{}};return s=new Promise((u,c)=>{l.resume=u,l.abort=c}),l};i.abort();const a=()=>{this.manager.renderer.rendering.then(()=>{r.status.set("dropped");const l=H(()=>{var c;return((c=r.source)==null?void 0:c.status)==="dropping"}),u=()=>{r.controller===i&&(r.controller=void 0),r.reset()};if(l){const{source:c}=r,d=nt(()=>{c?.status==="idle"&&(d(),u())})}else this.manager.renderer.rendering.then(u)})};r.canceled=(t=e.canceled)!=null?t:!1,this.manager.monitor.dispatch("dragend",{nativeEvent:e.event,operation:r.snapshot(),canceled:(n=e.canceled)!=null?n:!1,suspend:o}),s?s.then(a).catch(()=>r.reset()):a()})}},On=class extends Te{constructor(e,t){super(e,t),this.manager=e,this.options=t}},Rh=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(const n of e??[])n.controller=this}onEvent(e){var t;if(!this.activated)if((t=this.constraints)!=null&&t.length)for(const n of this.constraints)n.onEvent(e);else this.activate(e)}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},ci,Pc=class{constructor(e){this.options=e,Z(this,ci)}set controller(e){Ve(this,ci,e),e.signal.addEventListener("abort",()=>this.abort())}activate(e){var t;(t=ue(this,ci))==null||t.activate(e)}};ci=new WeakMap;var Ea=class extends Te{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},Wh=class{constructor(e){this.draggables=new Ca,this.droppables=new Ca,this.plugins=new as(e),this.sensors=new as(e),this.modifiers=new as(e)}register(e,t){if(e instanceof ft)return this.draggables.register(e.id,e);if(e instanceof pt)return this.droppables.register(e.id,e);if(e.prototype instanceof Ea)return this.modifiers.register(e,t);if(e.prototype instanceof On)return this.sensors.register(e,t);if(e.prototype instanceof Te)return this.plugins.register(e,t);throw new Error("Invalid instance type")}unregister(e){if(e instanceof Fi)return e instanceof ft?this.draggables.unregister(e.id,e):e instanceof pt?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof Ea)return this.modifiers.unregister(e);if(e.prototype instanceof On)return this.sensors.unregister(e);if(e.prototype instanceof Te)return this.plugins.unregister(e);throw new Error("Invalid instance type")}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},Dc,Tc,Ac,Ic,Rc,Wc,zc,Lc,Nc,er,di,pn,le,_o,Fo,qo,Ho,Uo,tr;Nc=[fe],Lc=[U],zc=[U],Wc=[U],Rc=[U],Ic=[U],Ac=[fe],Tc=[fe],Dc=[fe];var lt=class{constructor(e){N(le,5,this),Z(this,er),Z(this,di),Z(this,pn,new Qt(void 0,(t,n)=>t&&n?t.equals(n):t===n)),this.status=new kt,Z(this,_o,N(le,8,this,!1)),N(le,11,this),Z(this,Fo,N(le,12,this,null)),N(le,15,this),Z(this,qo,N(le,16,this,null)),N(le,19,this),Z(this,Ho,N(le,20,this,null)),N(le,23,this),Z(this,Uo,N(le,24,this,[])),N(le,27,this),this.position=new _i({x:0,y:0}),Z(this,tr,{x:0,y:0}),Ve(this,er,e)}get shape(){const{current:e,initial:t,previous:n}=ue(this,pn);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?ue(this,pn).current=e:ue(this,pn).reset()}get source(){var e;const t=this.sourceIdentifier;if(t==null)return null;const n=ue(this,er).registry.draggables.get(t);return n&&Ve(this,di,n),(e=n??ue(this,di))!=null?e:null}get target(){var e;const t=this.targetIdentifier;return t!=null&&(e=ue(this,er).registry.droppables.get(t))!=null?e:null}get transform(){const{x:e,y:t}=this.position.delta;let n={x:e,y:t};for(const r of this.modifiers)n=r.apply(jo(So({},this.snapshot()),{transform:n}));return Ve(this,tr,n),n}snapshot(){return H(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:ue(this,tr),shape:this.shape?os(this.shape):null,position:os(this.position),status:os(this.status),canceled:this.canceled}))}reset(){de(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,ue(this,pn).reset(),this.position.reset({x:0,y:0}),Ve(this,tr,{x:0,y:0}),this.modifiers=[]})}};le=Ln(null);er=new WeakMap;di=new WeakMap;pn=new WeakMap;_o=new WeakMap;Fo=new WeakMap;qo=new WeakMap;Ho=new WeakMap;Uo=new WeakMap;tr=new WeakMap;Y(le,2,"shape",Nc,lt);Y(le,4,"canceled",Lc,lt,_o);Y(le,4,"activatorEvent",zc,lt,Fo);Y(le,4,"sourceIdentifier",Wc,lt,qo);Y(le,4,"targetIdentifier",Rc,lt,Ho);Y(le,4,"modifiers",Ic,lt,Uo);Y(le,2,"source",Ac,lt);Y(le,2,"target",Tc,lt);Y(le,2,"transform",Dc,lt);en(le,lt);var zh={get rendering(){return Promise.resolve()}};function at(e,t){return typeof e=="function"?e(t):e??t}var Lh=class{constructor(e){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(d=>d.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};var t;const n=e??{},r=at(n.plugins,[]),i=at(n.sensors,[]),s=at(n.modifiers,[]),o=(t=n.renderer)!=null?t:zh,a=new Th(this),l=new Wh(this);this.registry=l,this.monitor=a,this.renderer=o,this.actions=new Ih(this),this.dragOperation=new lt(this),this.collisionObserver=new Ph(this),this.plugins=[Ah,...r],this.modifiers=s,this.sensors=i;const{destroy:u}=this,c=Pr(()=>{var d,f,h;const m=H(()=>this.dragOperation.modifiers),g=this.modifiers;for(const w of m)g.includes(w)||w.destroy();this.dragOperation.modifiers=(h=(f=(d=this.dragOperation.source)==null?void 0:d.modifiers)==null?void 0:f.map(w=>{const{plugin:y,options:p}=xr(w);return new y(this,p)}))!=null?h:g});this.destroy=()=>{c(),u()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},_c=e=>{throw TypeError(e)},Yo=(e,t,n)=>t.has(e)||_c("Cannot "+n),L=(e,t,n)=>(Yo(e,t,"read from private field"),t.get(e)),He=(e,t,n)=>t.has(e)?_c("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ge=(e,t,n,r)=>(Yo(e,t,"write to private field"),t.set(e,n),n),Fc=(e,t,n)=>(Yo(e,t,"access private method"),n);function qi(e){return e?e instanceof KeyframeEffect?!0:"getKeyframes"in e&&typeof e.getKeyframes=="function":!1}function qc(e,t){const n=e.getAnimations();let r=null;for(const i of n){if(i.playState!=="running")continue;const{effect:s}=i,o=(qi(s)?s.getKeyframes():[]).filter(t);o.length>0&&(r=[o[o.length-1],i])}return r}function Hi(e){const{width:t,height:n,top:r,left:i,bottom:s,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:i,bottom:s,right:o}}function Go(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ir(e){return"nodeType"in e}function Ke(e){var t,n,r;return e?Go(e)?e:Ir(e)?"defaultView"in e?(t=e.defaultView)!=null?t:window:(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window:window:window}function Vo(e){const{Document:t}=Ke(e);return e instanceof t||"nodeType"in e&&e.nodeType===Node.DOCUMENT_NODE}function Dt(e){return!e||Go(e)?!1:e instanceof Ke(e).HTMLElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("html")}function Hc(e){return e instanceof Ke(e).SVGElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("svg")}function Fn(e){return e?Go(e)?e.document:Ir(e)?Vo(e)?e:Dt(e)||Hc(e)?e.ownerDocument:document:document:document}function Nh(e){var t,n,r,i;const{documentElement:s}=Fn(e),o=Ke(e).visualViewport,a=(t=o?.width)!=null?t:s.clientWidth,l=(n=o?.height)!=null?n:s.clientHeight,u=(r=o?.offsetTop)!=null?r:0,c=(i=o?.offsetLeft)!=null?i:0;return{top:u,left:c,right:c+a,bottom:u+l,width:a,height:l}}function _h(e,t){if(Fh(e)&&e.open===!1)return!1;const{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n==="visible"&&r==="visible"&&i==="visible"}function Fh(e){return e.tagName==="DETAILS"}function kr(e,t=e.getBoundingClientRect(),n=0){var r,i,s,o,a;let l=t;const{ownerDocument:u}=e,c=(r=u.defaultView)!=null?r:window;let d=e.parentElement;for(;d&&d!==u.documentElement;){if(!_h(d)){const x=d.getBoundingClientRect(),v=n*(x.bottom-x.top),k=n*(x.right-x.left),j=n*(x.bottom-x.top),O=n*(x.right-x.left);l={top:Math.max(l.top,x.top-v),right:Math.min(l.right,x.right+k),bottom:Math.min(l.bottom,x.bottom+j),left:Math.max(l.left,x.left-O),width:0,height:0},l.width=l.right-l.left,l.height=l.bottom-l.top}d=d.parentElement}const f=c.visualViewport,h=(i=f?.offsetTop)!=null?i:0,m=(s=f?.offsetLeft)!=null?s:0,g=(o=f?.width)!=null?o:c.innerWidth,w=(a=f?.height)!=null?a:c.innerHeight,y=n*w,p=n*g;return l={top:Math.max(l.top,h-y),right:Math.min(l.right,m+g+p),bottom:Math.min(l.bottom,h+w+y),left:Math.max(l.left,m-p),width:0,height:0},l.width=l.right-l.left,l.height=l.bottom-l.top,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l}function Mn(e){return{x:e.clientX,y:e.clientY}}var Uc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ns(e=document,t=new Set){if(t.has(e))return[];t.add(e);const n=[e];for(const r of Array.from(e.querySelectorAll("iframe, frame")))try{const i=r.contentDocument;i&&!t.has(i)&&n.push(...Ns(i,t))}catch{}try{const r=e.defaultView;if(r&&r!==window.top){const i=r.parent;i&&i.document&&i.document!==e&&n.push(...Ns(i.document,t))}}catch{}return n}function Ko(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Yc(){var e,t;const n=Ko()?window.visualViewport:null;return{x:(e=n?.offsetLeft)!=null?e:0,y:(t=n?.offsetTop)!=null?t:0}}function Xo(e){return!e||!Ir(e)?!1:e instanceof Ke(e).ShadowRoot}function Si(e){if(e&&Ir(e)){let t=e.getRootNode();if(Xo(t)||t instanceof Document)return t}return Fn(e)}function Bo(e){return e.matchMedia("(prefers-reduced-motion: reduce)").matches}function qh(e){const t="input, textarea, select, canvas, [contenteditable]",n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((i,s)=>{const o=r[s];Pa(i)&&Pa(o)&&(i.type!=="file"&&(i.value=o.value),i.type==="radio"&&i.name&&(i.name=`Cloned__${i.name}`)),Da(i)&&Da(o)&&o.width>0&&o.height>0&&i.getContext("2d")?.drawImage(o,0,0)}),n}function Pa(e){return"value"in e}function Da(e){return e.tagName==="CANVAS"}function Gc(e,{x:t,y:n}){const r=e.elementFromPoint(t,n);if(Hh(r)){const{contentDocument:i}=r;if(i){const{left:s,top:o}=r.getBoundingClientRect();return Gc(i,{x:t-s,y:n-o})}}return r}function Hh(e){return e?.tagName==="IFRAME"}var _s=new WeakMap;function Uh(e){return e.closest(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BS2OPPD1.js","assets/index-zr-x34Gt.js","assets/index-DUqldpo0.css","assets/index-w_0OQJgZ.js","assets/index-CRAwrhYM.js","assets/index-BxPJ-qDv.js"])))=>i.map(i=>d[i]);
2
+ import{r as S,aM as ku,aN as yn,j as b,aa as he,aO as Su,at as Wt,N as pe,aP as ju,aQ as $u,U as kl,ar as Ou,aR as Mu,aS as ri,aT as ya,aU as Cu,a4 as Sl,a0 as Eu,ay as ke,a5 as jl,aV as Pu,a8 as $l,aW as Du,aX as ii,G as tt,aY as Ol,aZ as Zt,a_ as xs,H as kn,I as ws,O as go,T as ne,a$ as Tu,b0 as Au,ax as zi,am as De,aq as bt,b1 as ks,an as Ml,Z as Cl,b2 as Iu,b3 as Ru,Q as Wu,X as zu,b4 as Lu,b5 as Nu,b6 as _u,b7 as Fu,b8 as qu,b9 as Ss,ba as Hu,bb as Uu,aI as Yu}from"./index-zr-x34Gt.js";import{T as Gu,a as xa}from"./ToggleButtonGroup-CPFcR4JM.js";var wa={},Vu=Symbol.for("preact-signals");function Li(){if(yt>1)yt--;else{var e,t=!1;for((function(){var i=xi;for(xi=void 0;i!==void 0;){var s=i.S;if(s.v===i.v)for(var o=s.t;o!==void 0;o=o.x)o.i===i.i&&(o.i=s.i);i=i.o}})();pr!==void 0;){var n=pr;for(pr=void 0,yi++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Pl(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=r}}if(yi=0,yt--,t)throw e}}function de(e){if(yt>0)return e();js=++Ku,yt++;try{return e()}finally{Li()}}var fr,ie=void 0;function H(e){var t=ie,n=fr;ie=void 0,fr=void 0;try{return e()}finally{ie=t,fr=n}}var pr=void 0,yt=0,yi=0,Ku=0,js=0,xi=void 0,wi=0;function El(e){if(ie!==void 0){var t=e.n;if(t===void 0||t.t!==ie)return t={i:0,S:e,p:ie.s,n:void 0,t:ie,e:void 0,x:void 0,r:t},ie.s!==void 0&&(ie.s.n=t),ie.s=t,e.n=t,32&ie.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=ie.s,t.n=void 0,ie.s.n=t,ie.s=t),t}}function Le(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Le.prototype.brand=Vu;Le.prototype.h=function(){return!0};Le.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:H(function(){var r;(r=t.W)==null||r.call(t)}))};Le.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&H(function(){var i;(i=t.Z)==null||i.call(t)}))}};Le.prototype.subscribe=function(e){var t=this;return nt(function(){var n=t.value;H(function(){return e(n)})},{name:"sub"})};Le.prototype.valueOf=function(){return this.value};Le.prototype.toString=function(){return this.value+""};Le.prototype.toJSON=function(){return this.value};Le.prototype.peek=function(){var e=this;return H(function(){return e.value})};Object.defineProperty(Le.prototype,"value",{get:function(){var e=El(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(yi>100)throw new Error("Cycle detected");(function(n){yt!==0&&yi===0&&n.l!==js&&(n.l=js,xi={S:n,v:n.v,i:n.i,o:xi})})(this),this.v=e,this.i++,wi++,yt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Li()}}}});function An(e,t){return new Le(e,t)}function Pl(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 Dl(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 Tl(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Jt(e,t){Le.call(this,void 0,t),this.x=e,this.s=void 0,this.g=wi-1,this.f=4}Jt.prototype=new Le;Jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===wi))return!0;if(this.g=wi,this.f|=1,this.i>0&&!Pl(this))return this.f&=-2,!0;var e=ie;try{Dl(this),ie=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 ie=e,Tl(this),this.f&=-2,!0};Jt.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)}Le.prototype.S.call(this,e)};Jt.prototype.U=function(e){if(this.t!==void 0&&(Le.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)}};Jt.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(Jt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=El(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ka(e,t){return new Jt(e,t)}function Al(e){var t=e.m;if(e.m=void 0,typeof t=="function"){yt++;var n=ie;ie=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,mo(e),r}finally{ie=n,Li()}}}function mo(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Al(e)}function Xu(e){if(ie!==this)throw new Error("Out-of-order effect");Tl(this),ie=e,this.f&=-2,8&this.f&&mo(this),Li()}function In(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,fr&&fr.push(this)}In.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.m=t)}finally{e()}};In.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Al(this),Dl(this),yt++;var e=ie;return ie=this,Xu.bind(this,e)};In.prototype.N=function(){2&this.f||(this.f|=2,this.u=pr,pr=this)};In.prototype.d=function(){this.f|=8,1&this.f||mo(this)};In.prototype.dispose=function(){this.d()};function nt(e,t){var n=new In(e,t);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Bu=Object.create,vo=Object.defineProperty,Zu=Object.defineProperties,Ju=Object.getOwnPropertyDescriptor,Qu=Object.getOwnPropertyDescriptors,Sa=Object.getOwnPropertySymbols,eh=Object.prototype.hasOwnProperty,th=Object.prototype.propertyIsEnumerable,nh=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Rn=e=>{throw TypeError(e)},$s=(e,t,n)=>t in e?vo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rh=(e,t)=>{for(var n in t||(t={}))eh.call(t,n)&&$s(e,n,t[n]);if(Sa)for(var n of Sa(t))th.call(t,n)&&$s(e,n,t[n]);return e},ih=(e,t)=>Zu(e,Qu(t)),ja=(e,t)=>vo(e,"name",{value:t,configurable:!0}),sh=e=>{var t;return[,,,Bu((t=void 0)!=null?t:null)]},Il=["class","method","getter","setter","accessor","field","value","get","set"],Zn=e=>e!==void 0&&typeof e!="function"?Rn("Function expected"):e,oh=(e,t,n,r,i)=>({kind:Il[e],name:t,metadata:r,addInitializer:s=>n._?Rn("Already initialized"):i.push(Zn(s||null))}),Rl=(e,t)=>$s(t,nh("metadata"),e[3]),Rt=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},Wn=(e,t,n,r,i,s)=>{var o,a,l,u,c,d=t&7,f=!!(t&8),h=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,g=Il[d+5],w=d>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),p=d&&(!h&&!f&&(i=i.prototype),d<5&&(d>3||!h)&&Ju(d<4?i:{get[n](){return Ze(this,s)},set[n](v){return Ot(this,s,v)}},n));d?h&&d<4&&ja(s,(d>2?"set ":d>1?"get ":"")+n):ja(i,n);for(var x=r.length-1;x>=0;x--)u=oh(d,n,l={},e[3],y),d&&(u.static=f,u.private=h,c=u.access={has:h?v=>ah(i,v):v=>n in v},d^3&&(c.get=h?v=>(d^1?Ze:lh)(v,i,d^4?s:p.get):v=>v[n]),d>2&&(c.set=h?(v,k)=>Ot(v,i,k,d^4?s:p.set):(v,k)=>v[n]=k)),a=(0,r[x])(d?d<4?h?s:p[g]:d>4?void 0:{get:p.get,set:p.set}:i,u),l._=1,d^4||a===void 0?Zn(a)&&(d>4?w.unshift(a):d?h?s=a:p[g]=a:i=a):typeof a!="object"||a===null?Rn("Object expected"):(Zn(o=a.get)&&(p.get=o),Zn(o=a.set)&&(p.set=o),Zn(o=a.init)&&w.unshift(o));return d||Rl(e,i),p&&vo(i,n,p),h?d^4?s:p:i},bo=(e,t,n)=>t.has(e)||Rn("Cannot "+n),ah=(e,t)=>Object(t)!==t?Rn('Cannot use the "in" operator on this value'):e.has(t),Ze=(e,t,n)=>(bo(e,t,"read from private field"),n?n.call(e):t.get(e)),Jn=(e,t,n)=>t.has(e)?Rn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ot=(e,t,n,r)=>(bo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),lh=(e,t,n)=>(bo(e,t,"access private method"),n);function Os(e,t){if(t){let n;return ka(()=>{const r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return ka(e)}function st(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e=="function"&&typeof t=="function")return e===t;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((n,r)=>!st(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:!n.some(i=>!st(e[i],t[i]))}return!1}function U({get:e},t){return{init(n){return An(n)},get(){return e.call(this).value},set(n){const r=e.call(this);r.peek()!==n&&(r.value=n)}}}function fe(e,t){const n=new WeakMap;return function(){let r=n.get(this);return r||(r=Os(e.bind(this)),n.set(this,r)),r.value}}function ns(e=!0){return function(t,n){n.addInitializer(function(){const r=n.kind==="field"?this:n.static?this:Object.getPrototypeOf(this),i=Object.getOwnPropertyDescriptor(r,n.name);i&&Object.defineProperty(r,n.name,ih(rh({},i),{enumerable:e}))})}}function Pr(...e){const t=e.map(n=>nt(n));return()=>t.forEach(n=>n())}var Wl,zl,Ll,Nl,_l,Fl,Re,yo,rs,Ms,Cs,Pe,xo,is,ql,Es,wo,ss,Ps,Ds;Fl=[U],_l=[U],Nl=[U],Ll=[ns()],zl=[ns()],Wl=[ns()];var Qt=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,Rt(Re,5,this),Jn(this,Pe),Jn(this,yo,Rt(Re,8,this)),Rt(Re,11,this),Jn(this,xo,Rt(Re,12,this)),Rt(Re,15,this),Jn(this,wo,Rt(Re,16,this)),Rt(Re,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return Ze(this,Pe,Ps)}get initial(){return Ze(this,Pe,Ms)}get previous(){return Ze(this,Pe,ql)}set current(e){const t=H(()=>Ze(this,Pe,Ps));e&&t&&this.equals(t,e)||de(()=>{Ze(this,Pe,Ms)||Ot(this,Pe,e,Cs),Ot(this,Pe,t,Es),Ot(this,Pe,e,Ds)})}reset(e=this.defaultValue){de(()=>{Ot(this,Pe,void 0,Es),Ot(this,Pe,e,Cs),Ot(this,Pe,e,Ds)})}};Re=sh();yo=new WeakMap;Pe=new WeakSet;xo=new WeakMap;wo=new WeakMap;rs=Wn(Re,20,"#initial",Fl,Pe,yo),Ms=rs.get,Cs=rs.set;is=Wn(Re,20,"#previous",_l,Pe,xo),ql=is.get,Es=is.set;ss=Wn(Re,20,"#current",Nl,Pe,wo),Ps=ss.get,Ds=ss.set;Wn(Re,2,"current",Ll,Qt);Wn(Re,2,"initial",zl,Qt);Wn(Re,2,"previous",Wl,Qt);Rl(Re,Qt);function os(e){return H(()=>{const t={};for(const n in e)t[n]=e[n];return t})}var zt,ch=class{constructor(){Jn(this,zt,new WeakMap)}get(e,t){var n;return e?(n=Ze(this,zt).get(e))==null?void 0:n.get(t):void 0}set(e,t,n){var r;if(e)return Ze(this,zt).has(e)||Ze(this,zt).set(e,new Map),(r=Ze(this,zt).get(e))==null?void 0:r.set(t,n)}clear(e){var t;return e?(t=Ze(this,zt).get(e))==null?void 0:t.clear():void 0}};zt=new WeakMap;var dh=Object.create,Hl=Object.defineProperty,uh=Object.getOwnPropertyDescriptor,$a=Object.getOwnPropertySymbols,hh=Object.prototype.hasOwnProperty,fh=Object.prototype.propertyIsEnumerable,Ul=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Ni=e=>{throw TypeError(e)},Oa=Math.pow,Ts=(e,t,n)=>t in e?Hl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ph=(e,t)=>{for(var n in t||(t={}))hh.call(t,n)&&Ts(e,n,t[n]);if($a)for(var n of $a(t))fh.call(t,n)&&Ts(e,n,t[n]);return e},gh=e=>{var t;return[,,,dh((t=e?.[Ul("metadata")])!=null?t:null)]},Yl=["class","method","getter","setter","accessor","field","value","get","set"],Gl=e=>e!==void 0&&typeof e!="function"?Ni("Function expected"):e,mh=(e,t,n,r,i)=>({kind:Yl[e],name:t,metadata:r,addInitializer:s=>n._?Ni("Already initialized"):i.push(Gl(s||null))}),vh=(e,t)=>Ts(t,Ul("metadata"),e[3]),bh=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Vl=(e,t,n,r,i,s)=>{for(var o,a,l,u,c=t&7,d=!1,f=!1,h=2,m=Yl[c+5],g=e[h]||(e[h]=[]),w=(i=i.prototype,uh(i,n)),y=r.length-1;y>=0;y--)l=mh(c,n,a={},e[3],g),l.static=d,l.private=f,u=l.access={has:p=>n in p},u.get=p=>p[n],o=(0,r[y])(w[m],l),a._=1,Gl(o)&&(w[m]=o);return w&&Hl(i,n,w),i},Kl=(e,t,n)=>t.has(e)||Ni("Cannot "+n),yh=(e,t,n)=>(Kl(e,t,"read from private field"),t.get(e)),xh=(e,t,n)=>t.has(e)?Ni("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),wh=(e,t,n,r)=>(Kl(e,t,"write to private field"),t.set(e,n),n),Je=class As{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new As(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 As(t,n)}},ht=class Lt{constructor(t,n,r,i){this.left=t,this.top=n,this.width=r,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:r,left:i,width:s,height:o,scale:a}=this,l=new Lt(i+t,r+n,s,o);return l.scale=ph({},a),l}get boundingRectangle(){const{width:t,height:n,left:r,top:i,right:s,bottom:o}=this;return{width:t,height:n,left:r,top:i,right:s,bottom:o}}get center(){const{left:t,top:n,right:r,bottom:i}=this;return new Je((t+r)/2,(n+i)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof Lt))return!1;const{left:n,top:r,width:i,height:s}=this;return n===t.left&&r===t.top&&i===t.width&&s===t.height}containsPoint(t){const{top:n,left:r,bottom:i,right:s}=this;return n<=t.y&&t.y<=i&&r<=t.x&&t.x<=s}intersectionArea(t){return t instanceof Lt?kh(this,t):0}intersectionRatio(t){const{area:n}=this,r=this.intersectionArea(t);return r/(t.area+n-r)}get bottom(){const{top:t,height:n}=this;return t+n}get right(){const{left:t,width:n}=this;return t+n}get aspectRatio(){const{width:t,height:n}=this;return t/n}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:i}){return new Lt(n,t,r,i)}static delta(t,n,r={x:"center",y:"center"}){const i=(s,o)=>{const a=r[o],l=o==="x"?s.left:s.top,u=o==="x"?s.width:s.height;return a=="start"?l:a=="end"?l+u:l+u/2};return Je.delta({x:i(t,"x"),y:i(t,"y")},{x:i(n,"x"),y:i(n,"y")})}static intersectionRatio(t,n){return Lt.from(t).intersectionRatio(Lt.from(n))}};function kh(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,a=s-n;return r<i&&n<s?o*a:0}var Xl,Bl,Is,si,Dr,_i=class extends(Is=Qt,Bl=[fe],Xl=[fe],Is){constructor(e){const t=Je.from(e);super(t,(n,r)=>Je.equals(n,r)),bh(Dr,5,this),xh(this,si,0),this.velocity={x:0,y:0}}get delta(){return Je.delta(this.current,this.initial)}get direction(){const{current:e,previous:t}=this;if(!t)return null;const n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?"right":"left":n.y>0?"down":"up"}get current(){return super.current}set current(e){const{current:t}=this,n=Je.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),s=i-yh(this,si),o=a=>Math.round(a/s*100);de(()=>{wh(this,si,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(Je.from(e)),this.velocity={x:0,y:0}}};Dr=gh(Is);si=new WeakMap;Vl(Dr,2,"delta",Bl,_i);Vl(Dr,2,"direction",Xl,_i);vh(Dr,_i);function Rs({x:e,y:t},n){const r=Math.abs(e),i=Math.abs(t);return typeof n=="number"?Math.sqrt(Oa(r,2)+Oa(i,2))>n:"x"in n&&"y"in n?r>n.x&&i>n.y:"x"in n?r>n.x:"y"in n?i>n.y:!1}var Zl=(e=>(e.Horizontal="x",e.Vertical="y",e))(Zl||{}),Jl=Object.values(Zl),Sh=Object.create,ko=Object.defineProperty,jh=Object.defineProperties,$h=Object.getOwnPropertyDescriptor,Oh=Object.getOwnPropertyDescriptors,ki=Object.getOwnPropertySymbols,Ql=Object.prototype.hasOwnProperty,ec=Object.prototype.propertyIsEnumerable,tc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),zn=e=>{throw TypeError(e)},Ws=(e,t,n)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,So=(e,t)=>{for(var n in t||(t={}))Ql.call(t,n)&&Ws(e,n,t[n]);if(ki)for(var n of ki(t))ec.call(t,n)&&Ws(e,n,t[n]);return e},jo=(e,t)=>jh(e,Oh(t)),Ma=(e,t)=>ko(e,"name",{value:t,configurable:!0}),nc=(e,t)=>{var n={};for(var r in e)Ql.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ki)for(var r of ki(e))t.indexOf(r)<0&&ec.call(e,r)&&(n[r]=e[r]);return n},Ln=e=>{var t;return[,,,Sh((t=e?.[tc("metadata")])!=null?t:null)]},rc=["class","method","getter","setter","accessor","field","value","get","set"],Qn=e=>e!==void 0&&typeof e!="function"?zn("Function expected"):e,Mh=(e,t,n,r,i)=>({kind:rc[e],name:t,metadata:r,addInitializer:s=>n._?zn("Already initialized"):i.push(Qn(s||null))}),en=(e,t)=>Ws(t,tc("metadata"),e[3]),N=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},Y=(e,t,n,r,i,s)=>{var o,a,l,u,c,d=t&7,f=!!(t&8),h=!!(t&16),m=d>3?e.length+1:d?f?1:2:0,g=rc[d+5],w=d>3&&(e[m-1]=[]),y=e[m]||(e[m]=[]),p=d&&(!h&&!f&&(i=i.prototype),d<5&&(d>3||!h)&&$h(d<4?i:{get[n](){return ue(this,s)},set[n](v){return Ve(this,s,v)}},n));d?h&&d<4&&Ma(s,(d>2?"set ":d>1?"get ":"")+n):Ma(i,n);for(var x=r.length-1;x>=0;x--)u=Mh(d,n,l={},e[3],y),d&&(u.static=f,u.private=h,c=u.access={has:h?v=>Ch(i,v):v=>n in v},d^3&&(c.get=h?v=>(d^1?ue:ic)(v,i,d^4?s:p.get):v=>v[n]),d>2&&(c.set=h?(v,k)=>Ve(v,i,k,d^4?s:p.set):(v,k)=>v[n]=k)),a=(0,r[x])(d?d<4?h?s:p[g]:d>4?void 0:{get:p.get,set:p.set}:i,u),l._=1,d^4||a===void 0?Qn(a)&&(d>4?w.unshift(a):d?h?s=a:p[g]=a:i=a):typeof a!="object"||a===null?zn("Object expected"):(Qn(o=a.get)&&(p.get=o),Qn(o=a.set)&&(p.set=o),Qn(o=a.init)&&w.unshift(o));return d||en(e,i),p&&ko(i,n,p),h?d^4?s:p:i},$o=(e,t,n)=>t.has(e)||zn("Cannot "+n),Ch=(e,t)=>Object(t)!==t?zn('Cannot use the "in" operator on this value'):e.has(t),ue=(e,t,n)=>($o(e,t,"read from private field"),n?n.call(e):t.get(e)),Z=(e,t,n)=>t.has(e)?zn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ve=(e,t,n,r)=>($o(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ic=(e,t,n)=>($o(e,t,"access private method"),n);function sc(e,t){return{plugin:e,options:t}}function Tr(e){return t=>sc(e,t)}function xr(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var oc,wr,Oo,oi;oc=[U];var Te=class{constructor(e,t){this.manager=e,this.options=t,Z(this,Oo,N(wr,8,this,!1)),N(wr,11,this),Z(this,oi,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return H(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){const t=nt(e.bind(this));return ue(this,oi).add(t),t}destroy(){ue(this,oi).forEach(e=>e())}static configure(e){return sc(this,e)}};wr=Ln(null);Oo=new WeakMap;oi=new WeakMap;Y(wr,4,"disabled",oc,Te,Oo);en(wr,Te);var Ar=class extends Te{},ai,as=class{constructor(e){this.manager=e,this.instances=new Map,Z(this,ai,[])}get values(){return Array.from(this.instances.values())}set values(e){const t=e.map(xr).reduce((r,i)=>{const s=r.find(({plugin:o})=>o===i.plugin);return s?(s.options=i.options,r):[...r,i]},[]),n=t.map(({plugin:r})=>r);for(const r of ue(this,ai))if(!n.includes(r)){if(r.prototype instanceof Ar)continue;this.unregister(r)}for(const{plugin:r,options:i}of t)this.register(r,i);Ve(this,ai,n)}get(e){return this.instances.get(e)}register(e,t){const n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;const r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){const t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(const e of this.instances.values())e.destroy();this.instances.clear()}};ai=new WeakMap;function Eh(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var Yr=[],hn,fn,Ph=class extends Te{constructor(e){super(e),Z(this,hn),Z(this,fn),this.computeCollisions=this.computeCollisions.bind(this),Ve(this,fn,An(Yr)),this.destroy=Pr(()=>{const t=this.computeCollisions(),n=H(()=>this.manager.dragOperation.position.current);if(t!==Yr){const r=ue(this,hn);if(Ve(this,hn,n),r&&n.x==r.x&&n.y==r.y)return}else Ve(this,hn,void 0);ue(this,fn).value=t},()=>{const{dragOperation:t}=this.manager;t.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){H(()=>{e?ue(this,fn).value=this.computeCollisions():Ve(this,hn,void 0)})}computeCollisions(e,t){const{registry:n,dragOperation:r}=this.manager,{source:i,shape:s,status:o}=r;if(!o.initialized||!s)return Yr;const a=[],l=[];for(const u of e??n.droppables){if(u.disabled||i&&!u.accepts(i))continue;const c=t??u.collisionDetector;if(!c)continue;l.push(u),u.shape;const d=H(()=>c({droppable:u,dragOperation:r}));d&&(u.collisionPriority!=null&&(d.priority=u.collisionPriority),a.push(d))}return l.length===0?Yr:(a.sort(Eh),a)}get collisions(){return ue(this,fn).value}};hn=new WeakMap;fn=new WeakMap;var ac,lc,cc,Mo,dc,ot,Co,xn,Eo,Po;cc=[U],lc=[U],ac=[U];var wt=class Nt{constructor(t,n){Z(this,Co,N(ot,8,this)),N(ot,11,this),Z(this,xn),Z(this,Eo,N(ot,12,this)),N(ot,15,this),Z(this,Po,N(ot,16,this)),N(ot,19,this);const{effects:r,id:i,data:s={},disabled:o=!1,register:a=!0}=t;let l=i;Ve(this,xn,An(i)),this.manager=n,this.data=s,this.disabled=o,this.effects=()=>{var u;return[()=>{const{id:c,manager:d}=this;if(c!==l)return l=c,d?.registry.register(this),()=>d?.registry.unregister(this)},...(u=r?.())!=null?u:[]]},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),n&&a&&queueMicrotask(this.register)}get id(){var t,n;const r=ue(this,xn).value;return(n=(t=Nt.pendingIdChanges)==null?void 0:t.get(this))!=null?n:r}set id(t){var n,r;const i=(r=(n=Nt.pendingIdChanges)==null?void 0:n.get(this))!=null?r:ue(this,xn).peek();t!==i&&(Nt.pendingIdChanges||(Nt.pendingIdChanges=new Map,queueMicrotask(()=>{var s;return ic(s=Nt,Mo,dc).call(s)})),Nt.pendingIdChanges.set(this,t))}register(){var t;return(t=this.manager)==null?void 0:t.registry.register(this)}unregister(){var t;(t=this.manager)==null||t.registry.unregister(this)}destroy(){var t;(t=this.manager)==null||t.registry.unregister(this)}};ot=Ln(null);Mo=new WeakSet;dc=function(){const e=wt.pendingIdChanges;wt.pendingIdChanges=null,e&&de(()=>{for(const[t,n]of e)ue(t,xn).value=n})};Co=new WeakMap;xn=new WeakMap;Eo=new WeakMap;Po=new WeakMap;Y(ot,4,"manager",cc,wt,Co);Y(ot,4,"data",lc,wt,Eo);Y(ot,4,"disabled",ac,wt,Po);Z(wt,Mo);en(ot,wt);wt.pendingIdChanges=null;var Fi=wt,Ca=class{constructor(){this.map=An(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{const n=this.map.peek(),r=n.get(e),i=()=>this.unregister(e,t);if(r===t)return i;r&&r.id===e&&(this.cleanupFunctions.get(r)?.(),this.cleanupFunctions.delete(r));const s=new Map(n);for(const[a,l]of n)if(l===t&&a!==e){s.delete(a);break}s.set(e,t),this.map.value=s;const o=Pr(...t.effects());return this.cleanupFunctions.set(t,o),i},this.unregister=(e,t)=>{const n=this.map.peek();if(n.get(e)!==t)return;this.cleanupFunctions.get(t)?.(),this.cleanupFunctions.delete(t);const i=new Map(n);i.delete(e),this.map.value=i}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(const e of this)this.cleanupFunctions.get(e)?.(),e.destroy();this.map.value=new Map}},uc,hc,fc,pc,gc,mc,zs,We,Do,To,Ao,ft=class extends(zs=Fi,mc=[U],gc=[U],pc=[U],fc=[fe],hc=[fe],uc=[fe],zs){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:s,plugins:o,effects:a}=n,l=nc(n,["modifiers","type","sensors","plugins","effects"]);super(jo(So({},l),{effects:()=>{var u;return[...(u=a?.())!=null?u:[],()=>{const{manager:c,plugins:d}=this;if(!(!c||!d))for(const f of d){const{plugin:h}=xr(f);c.registry.plugins.register(h)}}]}}),t),N(We,5,this),Z(this,Do,N(We,8,this)),N(We,11,this),Z(this,To,N(We,12,this)),N(We,15,this),Z(this,Ao,N(We,16,this,this.isDragSource?"dragging":"idle")),N(We,19,this),this.type=i,this.sensors=s,this.modifiers=r,this.alignment=l.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(const t of this.plugins){const n=xr(t);if(n.plugin===e)return n.options}}get isDropping(){return this.status==="dropping"&&this.isDragSource}get isDragging(){return this.status==="dragging"&&this.isDragSource}get isDragSource(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.source)==null?void 0:t.id)===this.id}};We=Ln(zs);Do=new WeakMap;To=new WeakMap;Ao=new WeakMap;Y(We,4,"type",mc,ft,Do);Y(We,4,"modifiers",gc,ft,To);Y(We,4,"status",pc,ft,Ao);Y(We,2,"isDropping",fc,ft);Y(We,2,"isDragging",hc,ft);Y(We,2,"isDragSource",uc,ft);en(We,ft);var vc,bc,yc,xc,wc,kc,Ls,we,Io,Ro,Wo,zo,Lo,pt=class extends(Ls=Fi,kc=[U],wc=[U],xc=[U],yc=[U],bc=[U],vc=[fe],Ls){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:s,type:o}=n,a=nc(n,["accept","collisionDetector","collisionPriority","type"]);super(a,t),N(we,5,this),Z(this,Io,N(we,8,this)),N(we,11,this),Z(this,Ro,N(we,12,this)),N(we,15,this),Z(this,Wo,N(we,16,this)),N(we,19,this),Z(this,zo,N(we,20,this)),N(we,23,this),Z(this,Lo,N(we,24,this)),N(we,27,this),this.accept=r,this.collisionDetector=i,this.collisionPriority=s,this.type=o}accepts(e){const{accept:t}=this;return t?typeof t=="function"?t(e):e.type?Array.isArray(t)?t.includes(e.type):e.type===t:!1:!0}get isDropTarget(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.target)==null?void 0:t.id)===this.id}};we=Ln(Ls);Io=new WeakMap;Ro=new WeakMap;Wo=new WeakMap;zo=new WeakMap;Lo=new WeakMap;Y(we,4,"accept",kc,pt,Io);Y(we,4,"type",wc,pt,Ro);Y(we,4,"collisionDetector",xc,pt,Wo);Y(we,4,"collisionPriority",yc,pt,zo);Y(we,4,"shape",bc,pt,Lo);Y(we,2,"isDropTarget",vc,pt);en(we,pt);var Dh=class{constructor(){this.registry=new Map}addEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){const{registry:n}=this,r=n.get(e);if(r)for(const i of r)i(...t)}},Th=class extends Dh{constructor(e){super(),this.manager=e}dispatch(e,t){const n=[t,this.manager];super.dispatch(e,...n)}};function li(e,t=!0){let n=!1;return jo(So({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var Ah=class extends Ar{constructor(e){super(e);const t=(r,i)=>r.map(({id:s})=>s).join("")===i.map(({id:s})=>s).join("");let n=[];this.destroy=Pr(()=>{const{dragOperation:r,collisionObserver:i}=e;r.status.initializing&&(n=[],i.enable())},()=>{const{collisionObserver:r,monitor:i}=e,{collisions:s}=r;if(r.isDisabled()||Fi.pendingIdChanges)return;const o=li({collisions:s});if(i.dispatch("collision",o),o.defaultPrevented||t(s,n))return;n=s;const[a]=s;H(()=>{var l;a?.id!==((l=e.dragOperation.target)==null?void 0:l.id)&&(r.disable(),e.actions.setDropTarget(a?.id).then(()=>{r.enable()}))})})}},Nn=(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))(Nn||{}),_n=(e=>(e[e.Collision=0]="Collision",e[e.ShapeIntersection=1]="ShapeIntersection",e[e.PointerIntersection=2]="PointerIntersection",e))(_n||{}),Sc,jc,$c,Oc,Mc,Cc,Ec,et,No;Ec=[U],Cc=[fe],Mc=[fe],Oc=[fe],$c=[fe],jc=[fe],Sc=[fe];var kt=class{constructor(){N(et,5,this),Z(this,No,N(et,8,this,"idle")),N(et,11,this)}get current(){return this.value}get idle(){return this.value==="idle"}get initializing(){return this.value==="initializing"}get initialized(){const{value:e}=this;return e!=="idle"&&e!=="initialization-pending"}get dragging(){return this.value==="dragging"}get dropped(){return this.value==="dropped"}set(e){this.value=e}};et=Ln(null);No=new WeakMap;Y(et,4,"value",Ec,kt,No);Y(et,2,"current",Cc,kt);Y(et,2,"idle",Mc,kt);Y(et,2,"initializing",Oc,kt);Y(et,2,"initialized",$c,kt);Y(et,2,"dragging",jc,kt);Y(et,2,"dropped",Sc,kt);en(et,kt);var Ih=class{constructor(e){this.manager=e}setDragSource(e){const{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e=="string"||typeof e=="number"?e:e.id}setDropTarget(e){return H(()=>{const{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;const r=li({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch("dragover",r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return H(()=>{const{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw new Error("Cannot start a drag operation without a drag source");if(!t.status.idle)throw new Error("Cannot start a drag operation while another is active");const n=new AbortController,{event:r,coordinates:i}=e;de(()=>{t.status.set("initialization-pending"),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});const s=li({operation:t.snapshot()});return this.manager.monitor.dispatch("beforedragstart",s),s.defaultPrevented?(t.reset(),n.abort(),n):(t.status.set("initializing"),t.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;const{status:o}=t;o.current==="initializing"&&de(()=>{t.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return H(()=>{var t,n;const{dragOperation:r}=this.manager,{status:i,controller:s}=r;if(!i.dragging||!s||s.signal.aborted)return;const o=li({nativeEvent:e.event,operation:r.snapshot(),by:e.by,to:e.to},(t=e.cancelable)!=null?t:!0);((n=e.propagate)==null||n)&&this.manager.monitor.dispatch("dragmove",o),queueMicrotask(()=>{var a,l,u,c,d;if(o.defaultPrevented)return;const f=(d=e.to)!=null?d:{x:r.position.current.x+((l=(a=e.by)==null?void 0:a.x)!=null?l:0),y:r.position.current.y+((c=(u=e.by)==null?void 0:u.y)!=null?c:0)};r.position.current=f})})}stop(e={}){return H(()=>{var t,n;const{dragOperation:r}=this.manager,{controller:i}=r;if(!i||i.signal.aborted)return;let s;const o=()=>{const l={resume:()=>{},abort:()=>{}};return s=new Promise((u,c)=>{l.resume=u,l.abort=c}),l};i.abort();const a=()=>{this.manager.renderer.rendering.then(()=>{r.status.set("dropped");const l=H(()=>{var c;return((c=r.source)==null?void 0:c.status)==="dropping"}),u=()=>{r.controller===i&&(r.controller=void 0),r.reset()};if(l){const{source:c}=r,d=nt(()=>{c?.status==="idle"&&(d(),u())})}else this.manager.renderer.rendering.then(u)})};r.canceled=(t=e.canceled)!=null?t:!1,this.manager.monitor.dispatch("dragend",{nativeEvent:e.event,operation:r.snapshot(),canceled:(n=e.canceled)!=null?n:!1,suspend:o}),s?s.then(a).catch(()=>r.reset()):a()})}},On=class extends Te{constructor(e,t){super(e,t),this.manager=e,this.options=t}},Rh=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(const n of e??[])n.controller=this}onEvent(e){var t;if(!this.activated)if((t=this.constraints)!=null&&t.length)for(const n of this.constraints)n.onEvent(e);else this.activate(e)}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},ci,Pc=class{constructor(e){this.options=e,Z(this,ci)}set controller(e){Ve(this,ci,e),e.signal.addEventListener("abort",()=>this.abort())}activate(e){var t;(t=ue(this,ci))==null||t.activate(e)}};ci=new WeakMap;var Ea=class extends Te{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},Wh=class{constructor(e){this.draggables=new Ca,this.droppables=new Ca,this.plugins=new as(e),this.sensors=new as(e),this.modifiers=new as(e)}register(e,t){if(e instanceof ft)return this.draggables.register(e.id,e);if(e instanceof pt)return this.droppables.register(e.id,e);if(e.prototype instanceof Ea)return this.modifiers.register(e,t);if(e.prototype instanceof On)return this.sensors.register(e,t);if(e.prototype instanceof Te)return this.plugins.register(e,t);throw new Error("Invalid instance type")}unregister(e){if(e instanceof Fi)return e instanceof ft?this.draggables.unregister(e.id,e):e instanceof pt?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof Ea)return this.modifiers.unregister(e);if(e.prototype instanceof On)return this.sensors.unregister(e);if(e.prototype instanceof Te)return this.plugins.unregister(e);throw new Error("Invalid instance type")}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},Dc,Tc,Ac,Ic,Rc,Wc,zc,Lc,Nc,er,di,pn,le,_o,Fo,qo,Ho,Uo,tr;Nc=[fe],Lc=[U],zc=[U],Wc=[U],Rc=[U],Ic=[U],Ac=[fe],Tc=[fe],Dc=[fe];var lt=class{constructor(e){N(le,5,this),Z(this,er),Z(this,di),Z(this,pn,new Qt(void 0,(t,n)=>t&&n?t.equals(n):t===n)),this.status=new kt,Z(this,_o,N(le,8,this,!1)),N(le,11,this),Z(this,Fo,N(le,12,this,null)),N(le,15,this),Z(this,qo,N(le,16,this,null)),N(le,19,this),Z(this,Ho,N(le,20,this,null)),N(le,23,this),Z(this,Uo,N(le,24,this,[])),N(le,27,this),this.position=new _i({x:0,y:0}),Z(this,tr,{x:0,y:0}),Ve(this,er,e)}get shape(){const{current:e,initial:t,previous:n}=ue(this,pn);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?ue(this,pn).current=e:ue(this,pn).reset()}get source(){var e;const t=this.sourceIdentifier;if(t==null)return null;const n=ue(this,er).registry.draggables.get(t);return n&&Ve(this,di,n),(e=n??ue(this,di))!=null?e:null}get target(){var e;const t=this.targetIdentifier;return t!=null&&(e=ue(this,er).registry.droppables.get(t))!=null?e:null}get transform(){const{x:e,y:t}=this.position.delta;let n={x:e,y:t};for(const r of this.modifiers)n=r.apply(jo(So({},this.snapshot()),{transform:n}));return Ve(this,tr,n),n}snapshot(){return H(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:ue(this,tr),shape:this.shape?os(this.shape):null,position:os(this.position),status:os(this.status),canceled:this.canceled}))}reset(){de(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,ue(this,pn).reset(),this.position.reset({x:0,y:0}),Ve(this,tr,{x:0,y:0}),this.modifiers=[]})}};le=Ln(null);er=new WeakMap;di=new WeakMap;pn=new WeakMap;_o=new WeakMap;Fo=new WeakMap;qo=new WeakMap;Ho=new WeakMap;Uo=new WeakMap;tr=new WeakMap;Y(le,2,"shape",Nc,lt);Y(le,4,"canceled",Lc,lt,_o);Y(le,4,"activatorEvent",zc,lt,Fo);Y(le,4,"sourceIdentifier",Wc,lt,qo);Y(le,4,"targetIdentifier",Rc,lt,Ho);Y(le,4,"modifiers",Ic,lt,Uo);Y(le,2,"source",Ac,lt);Y(le,2,"target",Tc,lt);Y(le,2,"transform",Dc,lt);en(le,lt);var zh={get rendering(){return Promise.resolve()}};function at(e,t){return typeof e=="function"?e(t):e??t}var Lh=class{constructor(e){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(d=>d.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};var t;const n=e??{},r=at(n.plugins,[]),i=at(n.sensors,[]),s=at(n.modifiers,[]),o=(t=n.renderer)!=null?t:zh,a=new Th(this),l=new Wh(this);this.registry=l,this.monitor=a,this.renderer=o,this.actions=new Ih(this),this.dragOperation=new lt(this),this.collisionObserver=new Ph(this),this.plugins=[Ah,...r],this.modifiers=s,this.sensors=i;const{destroy:u}=this,c=Pr(()=>{var d,f,h;const m=H(()=>this.dragOperation.modifiers),g=this.modifiers;for(const w of m)g.includes(w)||w.destroy();this.dragOperation.modifiers=(h=(f=(d=this.dragOperation.source)==null?void 0:d.modifiers)==null?void 0:f.map(w=>{const{plugin:y,options:p}=xr(w);return new y(this,p)}))!=null?h:g});this.destroy=()=>{c(),u()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},_c=e=>{throw TypeError(e)},Yo=(e,t,n)=>t.has(e)||_c("Cannot "+n),L=(e,t,n)=>(Yo(e,t,"read from private field"),t.get(e)),He=(e,t,n)=>t.has(e)?_c("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ge=(e,t,n,r)=>(Yo(e,t,"write to private field"),t.set(e,n),n),Fc=(e,t,n)=>(Yo(e,t,"access private method"),n);function qi(e){return e?e instanceof KeyframeEffect?!0:"getKeyframes"in e&&typeof e.getKeyframes=="function":!1}function qc(e,t){const n=e.getAnimations();let r=null;for(const i of n){if(i.playState!=="running")continue;const{effect:s}=i,o=(qi(s)?s.getKeyframes():[]).filter(t);o.length>0&&(r=[o[o.length-1],i])}return r}function Hi(e){const{width:t,height:n,top:r,left:i,bottom:s,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:i,bottom:s,right:o}}function Go(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ir(e){return"nodeType"in e}function Ke(e){var t,n,r;return e?Go(e)?e:Ir(e)?"defaultView"in e?(t=e.defaultView)!=null?t:window:(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window:window:window}function Vo(e){const{Document:t}=Ke(e);return e instanceof t||"nodeType"in e&&e.nodeType===Node.DOCUMENT_NODE}function Dt(e){return!e||Go(e)?!1:e instanceof Ke(e).HTMLElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("html")}function Hc(e){return e instanceof Ke(e).SVGElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("svg")}function Fn(e){return e?Go(e)?e.document:Ir(e)?Vo(e)?e:Dt(e)||Hc(e)?e.ownerDocument:document:document:document}function Nh(e){var t,n,r,i;const{documentElement:s}=Fn(e),o=Ke(e).visualViewport,a=(t=o?.width)!=null?t:s.clientWidth,l=(n=o?.height)!=null?n:s.clientHeight,u=(r=o?.offsetTop)!=null?r:0,c=(i=o?.offsetLeft)!=null?i:0;return{top:u,left:c,right:c+a,bottom:u+l,width:a,height:l}}function _h(e,t){if(Fh(e)&&e.open===!1)return!1;const{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n==="visible"&&r==="visible"&&i==="visible"}function Fh(e){return e.tagName==="DETAILS"}function kr(e,t=e.getBoundingClientRect(),n=0){var r,i,s,o,a;let l=t;const{ownerDocument:u}=e,c=(r=u.defaultView)!=null?r:window;let d=e.parentElement;for(;d&&d!==u.documentElement;){if(!_h(d)){const x=d.getBoundingClientRect(),v=n*(x.bottom-x.top),k=n*(x.right-x.left),j=n*(x.bottom-x.top),O=n*(x.right-x.left);l={top:Math.max(l.top,x.top-v),right:Math.min(l.right,x.right+k),bottom:Math.min(l.bottom,x.bottom+j),left:Math.max(l.left,x.left-O),width:0,height:0},l.width=l.right-l.left,l.height=l.bottom-l.top}d=d.parentElement}const f=c.visualViewport,h=(i=f?.offsetTop)!=null?i:0,m=(s=f?.offsetLeft)!=null?s:0,g=(o=f?.width)!=null?o:c.innerWidth,w=(a=f?.height)!=null?a:c.innerHeight,y=n*w,p=n*g;return l={top:Math.max(l.top,h-y),right:Math.min(l.right,m+g+p),bottom:Math.min(l.bottom,h+w+y),left:Math.max(l.left,m-p),width:0,height:0},l.width=l.right-l.left,l.height=l.bottom-l.top,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l}function Mn(e){return{x:e.clientX,y:e.clientY}}var Uc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ns(e=document,t=new Set){if(t.has(e))return[];t.add(e);const n=[e];for(const r of Array.from(e.querySelectorAll("iframe, frame")))try{const i=r.contentDocument;i&&!t.has(i)&&n.push(...Ns(i,t))}catch{}try{const r=e.defaultView;if(r&&r!==window.top){const i=r.parent;i&&i.document&&i.document!==e&&n.push(...Ns(i.document,t))}}catch{}return n}function Ko(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Yc(){var e,t;const n=Ko()?window.visualViewport:null;return{x:(e=n?.offsetLeft)!=null?e:0,y:(t=n?.offsetTop)!=null?t:0}}function Xo(e){return!e||!Ir(e)?!1:e instanceof Ke(e).ShadowRoot}function Si(e){if(e&&Ir(e)){let t=e.getRootNode();if(Xo(t)||t instanceof Document)return t}return Fn(e)}function Bo(e){return e.matchMedia("(prefers-reduced-motion: reduce)").matches}function qh(e){const t="input, textarea, select, canvas, [contenteditable]",n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((i,s)=>{const o=r[s];Pa(i)&&Pa(o)&&(i.type!=="file"&&(i.value=o.value),i.type==="radio"&&i.name&&(i.name=`Cloned__${i.name}`)),Da(i)&&Da(o)&&o.width>0&&o.height>0&&i.getContext("2d")?.drawImage(o,0,0)}),n}function Pa(e){return"value"in e}function Da(e){return e.tagName==="CANVAS"}function Gc(e,{x:t,y:n}){const r=e.elementFromPoint(t,n);if(Hh(r)){const{contentDocument:i}=r;if(i){const{left:s,top:o}=r.getBoundingClientRect();return Gc(i,{x:t-s,y:n-o})}}return r}function Hh(e){return e?.tagName==="IFRAME"}var _s=new WeakMap;function Uh(e){return e.closest(`
3
3
  input:not([disabled]),
4
4
  select:not([disabled]),
5
5
  textarea:not([disabled]),
@@ -69,9 +69,9 @@ import{r as S,aM as ku,aN as yn,j as b,aa as he,aO as Su,at as Wt,N as pe,aP as
69
69
  `),r=t.split(`
70
70
  `);if(n.length>Ba||r.length>Ba)return[...n.map(l=>({kind:"del",text:l})),...r.map(l=>({kind:"add",text:l}))];const i=Array.from({length:n.length+1},()=>new Uint32Array(r.length+1));for(let l=n.length-1;l>=0;l--)for(let u=r.length-1;u>=0;u--)i[l][u]=n[l]===r[u]?i[l+1][u+1]+1:Math.max(i[l+1][u],i[l][u+1]);const s=[];let o=0,a=0;for(;o<n.length&&a<r.length;)n[o]===r[a]?(s.push({kind:"same",text:n[o]}),o++,a++):i[o+1][a]>=i[o][a+1]?s.push({kind:"del",text:n[o++]}):s.push({kind:"add",text:r[a++]});for(;o<n.length;)s.push({kind:"del",text:n[o++]});for(;a<r.length;)s.push({kind:"add",text:r[a++]});return s}function bg(e,t=3){const n=new Array(e.length).fill(!1);e.forEach((s,o)=>{if(s.kind!=="same")for(let a=Math.max(0,o-t);a<=Math.min(e.length-1,o+t);a++)n[a]=!0});const r=[];let i=0;return e.forEach((s,o)=>{n[o]?(i>0&&r.push({kind:"fold",count:i}),i=0,r.push(s)):i++}),i>0&&r.push({kind:"fold",count:i}),r}function yg({open:e,before:t,after:n,onConfirm:r,onClose:i}){const{theme:s}=tt(),o=S.useMemo(()=>e?bg(vg(t,n)):[],[e,t,n]),a=o.filter(u=>u.kind==="add").length,l=o.filter(u=>u.kind==="del").length;return b.jsx(zi,{open:e,onClose:i,maxWidth:"md",title:"Review the change to the file",description:b.jsxs(b.Fragment,{children:["A tile was added or removed, which moves declarations. Lines the builder does not own — comments, other Malloy — are left where they were; check they still read right."," ",b.jsxs(pe,{component:"span",sx:{fontVariantNumeric:"tabular-nums"},children:["+",a," −",l]})]}),actions:b.jsxs(b.Fragment,{children:[b.jsx(ke,{onClick:i,children:"Keep editing"}),b.jsx(ke,{variant:"contained",onClick:r,children:"Save this"})]}),children:b.jsx(pe,{component:"pre","aria-label":"File changes",sx:{m:0,px:2,py:1,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12,lineHeight:1.6,overflowX:"auto",bgcolor:s.background,color:s.foreground},children:o.map((u,c)=>u.kind==="fold"?b.jsx(pe,{component:"span",sx:{display:"block",opacity:.55,py:.25},children:`⋯ ${u.count} unchanged line${u.count===1?"":"s"}`},c):b.jsxs(pe,{component:"span",sx:{display:"block",mx:-2,px:2,whiteSpace:"pre",bgcolor:u.kind==="add"?"rgba(46, 125, 91, 0.16)":u.kind==="del"?"rgba(168, 41, 31, 0.14)":"transparent",textDecoration:u.kind==="del"?"line-through":"none",opacity:u.kind==="del"?.8:1},children:[u.kind==="add"?"+ ":u.kind==="del"?"− ":" ",u.text]},c))})})}const fs="self";function xg({open:e,document:t,source:n,givenNames:r,dashboards:i,onClose:s,onApply:o}){const{theme:a}=tt(),[l,u]=S.useState([]);S.useEffect(()=>{if(!e||!n)return;const h=(t.drills??[]).filter(m=>m.source===n.name);u((n.dimensions??[]).map(m=>{const g=h.find(w=>w.name===m.name);return{name:m.name,expression:m.expression,to:g?.to??[],given:g?.given??""}}))},[e,n,t]);const c=(h,m)=>u(g=>g.map((w,y)=>{if(y!==h)return w;const p={...w};return m(p),p})),d=[fs,...i.filter(h=>h!==fs)],f=h=>h===fs?"This dashboard":h;return b.jsx(zi,{open:e,onClose:s,title:"Clickable cells",description:"A cell in a column that groups by one of these dimensions becomes a link. Clicking it writes the value into a control — here, or on the dashboard it opens.",actions:b.jsxs(b.Fragment,{children:[b.jsx(ke,{onClick:s,children:"Cancel"}),b.jsx(ke,{variant:"contained",onClick:()=>{n&&(o(l.filter(h=>h.to.length>0).map(h=>({source:n.name,name:h.name,expression:h.expression,to:h.to,...h.given?{given:h.given}:{}}))),s())},disabled:l.length===0,children:"Apply"})]}),children:b.jsx(he,{sx:{gap:2,pt:1},children:l.length===0?b.jsx(ne,{variant:"body2",sx:{color:a.tileTitle},children:n?b.jsxs(b.Fragment,{children:[b.jsx(pe,{component:"code",children:n.name})," declares no dimensions of its own in this file. A drill is a tag on the dimension's declaration, so a dimension the model declares is made clickable in the model; to make one clickable here, declare it in"," ",b.jsx(pe,{component:"code",children:n.name})," and group by it."]}):"This tile's source is not declared in this file."}):l.map((h,m)=>b.jsxs(pe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr)"},gap:1.5,alignItems:"start"},children:[b.jsxs(pe,{sx:{minWidth:0,pt:.75},children:[b.jsx(ne,{variant:"body2",sx:{fontFamily:"ui-monospace, monospace",fontSize:13},children:h.name}),b.jsxs(ne,{variant:"caption",sx:{color:a.tileTitle,display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:h.expression,children:["is ",h.expression]})]}),b.jsx(De,{select:!0,size:"small",label:"Clicks go to",value:h.to,inputProps:{"aria-label":`Where ${h.name} goes`},SelectProps:{multiple:!0,renderValue:g=>g.length===0?"Not clickable":g.map(f).join(", "),displayEmpty:!0},InputLabelProps:{shrink:!0},onChange:g=>c(m,w=>{const y=g.target.value;w.to=Array.isArray(y)?y:String(y).split(",").filter(Boolean)}),children:d.map(g=>b.jsxs(bt,{value:g,children:[b.jsx(ks,{size:"small",checked:h.to.includes(g),sx:{p:0,mr:1}}),b.jsx(Cl,{primary:f(g)})]},g))}),b.jsxs(De,{select:!0,size:"small",label:"Sets the control",value:h.given,disabled:h.to.length===0,inputProps:{"aria-label":`Control ${h.name} sets`},SelectProps:{displayEmpty:!0},InputLabelProps:{shrink:!0},helperText:h.given===""?`Named ${h.name}, like the dimension`:void 0,onChange:g=>c(m,w=>{w.given=g.target.value}),children:[b.jsx(bt,{value:"",children:b.jsx("em",{children:"Same name as the dimension"})}),r.map(g=>b.jsx(bt,{value:g,children:g},g))]})]},h.name))})})}const Bd=e=>e.charAt(0)+e.slice(1).toLowerCase().replace(/_/g," ");function wg({open:e,document:t,control:n,available:r,fieldsFor:i,onApply:s}){const o=S.useRef(n);e&&(o.current=n);const a=e?n:o.current,l=a!==void 0,[u,c]=S.useState({kind:"new"}),[d,f]=S.useState(""),[h,m]=S.useState("select"),[g,w]=S.useState(""),[y,p]=S.useState(""),[x,v]=S.useState([]),[k,j]=S.useState(!1),O=C=>t.sources.find(A=>A.name===C.source)?.base??C.source;S.useEffect(()=>{if(e)if(n){c({kind:"existing",name:n.name}),f(n.label??"");const C=Jp(t,n);v(C);const A=C.filter($=>$.include),q=new Set(A.map($=>$.field));p(q.size===1?A[0].field:n.field??""),j(q.size>1)}else c({kind:"new"}),f(""),m("select"),p(""),w(new Date().toISOString().slice(0,10)),v(t.tiles.map(C=>({include:so(C),field:""}))),j(!1)},[e,n,t]);const M=S.useMemo(()=>[...(t.localGivens??[]).map(C=>C.name),...r.map(C=>C.name)],[t,r]),D=S.useMemo(()=>y.trim()?Zp(y.trim(),M):"",[y,M]),T=u.kind==="existing"?n??r.find(C=>C.name===u.name):D?{name:D,type:Xr({name:D,label:d,kind:h,field:y}).type}:void 0,G=T?.type!==void 0&&!T.type.startsWith("filter<"),I=x.find(C=>C.include)?.op??Ii(T?.type),E=(C,A)=>v(q=>q.map(($,P)=>P===C?{...$,...A}:$)),F=C=>v(A=>A.map(q=>({...q,op:C}))),V=C=>{const A=Ii(C);v(q=>q.map(({op:$,...P})=>A?{...P,op:A}:P))},me=C=>{c({kind:"existing",name:C.name}),p(C.field??""),V(C.type)},Ae=C=>{m(C),V(Xr({name:"X",label:d,kind:C,field:y}).type)},oe=t.tiles.map(so),Ne=oe.filter(Boolean).length,Ue=x.filter((C,A)=>C.include&&oe[A]).length,Ee=t.tiles.filter((C,A)=>(x[A]?.include??!1)&&oe[A]),Xe=Ee.length>0?Ee:t.tiles.filter((C,A)=>oe[A]),Ye=S.useMemo(()=>{const C=new Map;let A=!1;for(const q of Xe){const $=i?.(q);if($){A=!0;for(const P of $)C.has(P.name)||C.set(P.name,P)}}return A?[...C.values()]:void 0},[x,t.tiles,i]),_e=(()=>{const C=y.trim();for(const A of Ee){const q=i?.(A);if(!q||q.some($=>$.name===C))return O(A)}return Ee[0]?O(Ee[0]):t.sources[0]?.base})(),Be=C=>v(A=>A.map((q,$)=>({...q,include:C&&oe[$]}))),Oe=S.useMemo(()=>k?x:x.map(C=>({...C,field:y})),[k,x,y]),xe=C=>{for(const A of Xe){const q=i?.(A)?.find($=>$.name===C.trim());if(q?.type)return q.type}},R=C=>mi(T?.type,C.type),_=(C,A)=>{if(C.trim()==="")return"Pick the field this filter compares.";const q=A?i?.(A):void 0;if(!q)return;const $=q.find(P=>P.name===C.trim());if(!$)return`Not a field of ${A?O(A):"the tiles' source"}.`;if($.type&&!mi(T?.type,$.type))return`${C.trim()} is ${Ga($.type)}; this filter compares ${Ga(T?.type?.replace(/^filter<(.+)>$/,"$1"))}.`},je=C=>{if(p(C),l||u.kind!=="new")return;const A=xe(C),q=Xr({name:"X",label:d,kind:h,field:C}).type;A&&!mi(q,A)&&Ae(Xp(A))},B=Oe.map((C,A)=>C.include&&oe[A]?_(C.field,t.tiles[A]):void 0),Fe=B.every(C=>C===void 0),ee=!k&&Ue>0?Ee.map(C=>_(y,C)).find(Boolean):void 0,ct=T!==void 0&&Fe&&(u.kind==="existing"||y.trim()!==""&&D!==""),qe=()=>{if(!(!T||!ct))if(u.kind==="new")s(T.name,Oe,Xr({name:T.name,label:d.trim()||Bd(T.name),kind:h,field:y.trim(),..._e?{source:_e}:{},...g?{dateDefault:g}:{}}));else if(n?.origin==="dashboard"&&n.local){const C=d.trim(),A=C!==(n.local.label??"");s(T.name,Oe,A?{...n.local,...C?{label:C}:{}}:void 0)}else s(T.name,Oe)},St=l&&a.origin==="model";return{editing:l,shown:a,fromModel:St,source:u,setSource:c,label:d,setLabel:f,kind:h,dateDefault:g,setDateDefault:w,field:y,rows:x,setRows:v,perTile:k,setPerTile:j,newName:D,target:T,valueTyped:G,commonOp:I,setRow:E,setCommonOp:F,pickExisting:me,pickKind:Ae,bindable:oe,bindableCount:Ne,included:Ue,commonFields:Ye,setAll:Be,accepts:R,pickField:je,rowProblems:B,commonProblem:ee,canApply:ct,apply:qe}}function Za({value:e,onChange:t,fields:n,accepts:r,label:i,ariaLabel:s,error:o,helperText:a,disabled:l,autoFocus:u,placeholder:c,sx:d}){const f=S.useMemo(()=>(n??[]).filter(m=>r?.(m)??!0).map(m=>m.name),[n,r]),h=S.useMemo(()=>new Map((n??[]).map(m=>[m.name,m.type])),[n]);return b.jsx(Hu,{freeSolo:!0,size:"small",options:f,inputValue:e,onInputChange:(m,g)=>t(g),value:e,onChange:(m,g)=>t(typeof g=="string"?g:""),disabled:l,disableClearable:!0,renderOption:(m,g)=>S.createElement("li",{...m,key:g},b.jsx(ne,{variant:"body2",sx:{flex:1},children:g}),h.get(g)&&b.jsx(ne,{variant:"caption",sx:{opacity:.6},children:h.get(g)?.replace(/_type$/,"")})),renderInput:m=>b.jsx(De,{...m,label:i,placeholder:c,autoFocus:u,error:o,helperText:a,inputProps:{...m.inputProps,"aria-label":s}}),sx:d})}const Ja=e=>e?.declaration.kind==="opaque"?{label:"Not bindable",reason:`Its body is ${e.declaration.why}, so a filter has no single place to go.`}:{label:"From the model",reason:"Declared on its source, which this dashboard does not write."};function kg({open:e,document:t,control:n,available:r,fieldsFor:i,onClose:s,onApply:o,onRemove:a}){const{theme:l}=tt(),{editing:u,shown:c,fromModel:d,source:f,setSource:h,label:m,setLabel:g,kind:w,dateDefault:y,setDateDefault:p,field:x,rows:v,setRows:k,perTile:j,setPerTile:O,newName:M,target:D,valueTyped:T,commonOp:G,setRow:I,setCommonOp:E,pickExisting:F,pickKind:V,bindable:me,bindableCount:Ae,included:oe,commonFields:Ne,setAll:Ue,accepts:Ee,pickField:Xe,rowProblems:Ye,commonProblem:_e,canApply:Be,apply:Oe}=wg({open:e,document:t,control:n,available:r,fieldsFor:i,onApply:o}),xe=(R,_,je)=>b.jsx(De,{select:!0,size:"small",label:"Compares",value:R??">=",onChange:B=>_(B.target.value),inputProps:{"aria-label":je},sx:{width:130},children:Bp.filter(B=>B.op!=="~").map(B=>b.jsx(bt,{value:B.op,children:B.label},B.op))});return b.jsx(zi,{open:e,onClose:s,title:u?c.label??c.name:"Add a filter",description:u?b.jsxs(b.Fragment,{children:[b.jsxs(pe,{component:"span",sx:{fontFamily:"ui-monospace, monospace"},children:["$",c.name]}),d?" · declared in the model, so its label and options are set there":" · declared in this dashboard"]}):"A control on the page, and the tiles it filters.",actions:b.jsxs(b.Fragment,{children:[u&&b.jsx(ke,{color:"error",onClick:()=>a(c.name),"aria-label":`Remove control ${c.name}`,sx:{mr:"auto"},children:"Remove from dashboard"}),b.jsx(ke,{onClick:s,children:"Cancel"}),b.jsx(kn,{title:Be||D===void 0?"":"A ticked tile has no field, or names one its source does not have.",children:b.jsx("span",{children:b.jsx(ke,{variant:"contained",onClick:Oe,disabled:!Be,children:u?"Apply":"Add filter"})})})]}),children:b.jsxs(he,{sx:{gap:2.5,pt:1},children:[!u&&r.length>0&&b.jsxs(Gu,{exclusive:!0,size:"small",value:f.kind,onChange:(R,_)=>{_==="new"?h({kind:"new"}):_==="existing"&&r[0]&&F(r[0])},"aria-label":"Where the filter comes from",children:[b.jsx(xa,{value:"new",children:"New in this dashboard"}),b.jsx(xa,{value:"existing",children:"From the model"})]}),!u&&f.kind==="existing"?b.jsx(De,{select:!0,size:"small",label:"Control",value:f.name,onChange:R=>{const _=r.find(je=>je.name===R.target.value);_&&F(_)},children:r.map(R=>b.jsxs(bt,{value:R.name,children:[R.label??R.name,b.jsxs(ne,{component:"span",variant:"caption",sx:{ml:1,opacity:.6},children:["$",R.name]})]},R.name))}):null,b.jsxs(he,{direction:"row",sx:{gap:1.5,flexWrap:"wrap"},children:[!j&&b.jsx(Za,{value:x,onChange:Xe,fields:Ne,accepts:Ee,label:"Field to filter",ariaLabel:"Field to filter",placeholder:"category",autoFocus:!u,error:_e!==void 0,helperText:_e??(!u&&M?`Declared as $${M}`:void 0),sx:{flex:1,minWidth:200}}),!d&&b.jsx(De,{size:"small",label:"Label",placeholder:M?Bd(M):"",value:m,onChange:R=>g(R.target.value),inputProps:{"aria-label":"Control label"},sx:{flex:1,minWidth:160}}),T&&!j&&xe(G,E,"Comparison")]}),!u&&f.kind==="new"&&b.jsxs(he,{direction:"row",sx:{gap:1.5},children:[b.jsx(De,{select:!0,size:"small",label:"Control",value:w,onChange:R=>V(R.target.value),inputProps:{"aria-label":"Kind of control"},slotProps:{select:{renderValue:R=>Va.find(_=>_.kind===R)?.label??String(R)}},sx:{flex:1},children:Va.map(R=>b.jsxs(bt,{value:R.kind,children:[R.label,b.jsx(ne,{component:"span",variant:"caption",sx:{ml:1,opacity:.6},children:R.hint})]},R.kind))}),w==="date"&&b.jsx(De,{size:"small",type:"date",label:"Starts at",value:y,onChange:R=>p(R.target.value),InputLabelProps:{shrink:!0},sx:{flex:1}})]}),b.jsxs(pe,{children:[b.jsxs(he,{direction:"row",sx:{alignItems:"center",gap:.5},children:[b.jsx(ks,{size:"small",checked:Ae>0&&oe===Ae,indeterminate:oe>0&&oe<Ae,disabled:Ae===0,onChange:R=>Ue(R.target.checked),inputProps:{"aria-label":"All tiles"}}),b.jsxs(ne,{variant:"subtitle2",sx:{flex:1},children:["Applies to ",oe," of ",t.tiles.length," tiles"]}),b.jsx(ke,{size:"small",onClick:()=>{j||k(R=>R.map(_=>({..._,field:x}))),O(R=>!R)},children:j?"Same field for all":"Adjust per tile"})]}),b.jsx(he,{sx:{gap:j?1:0},children:t.tiles.map((R,_)=>{const je=v[_],B=R.label??R.name,Fe=j?Ye[_]:void 0;return b.jsxs(he,{direction:"row",sx:{gap:1,alignItems:j?"flex-start":"center",opacity:me[_]?1:.6},children:[b.jsx(ks,{size:"small",disabled:!me[_],checked:(je?.include??!1)&&me[_],inputProps:{"aria-label":`Filter ${B}`},onChange:ee=>I(_,{include:ee.target.checked})}),b.jsx(ne,{variant:"body2",sx:{flex:1,minWidth:0,pt:j?1:0},noWrap:!0,children:B}),me[_]?j&&b.jsxs(b.Fragment,{children:[T&&xe(je?.op,ee=>I(_,{op:ee}),`Comparison for ${B}`),b.jsx(Za,{value:je?.field??"",onChange:ee=>I(_,{field:ee}),fields:i?.(R),accepts:Ee,label:"Field",ariaLabel:`Field for ${B}`,disabled:!je?.include,error:Fe!==void 0,helperText:Fe,sx:{width:220}})]}):b.jsx(kn,{title:Ja(t.tiles[_]).reason,children:b.jsx(ne,{variant:"caption",sx:{color:l.tileTitle},children:Ja(t.tiles[_]).label})})]},`${R.source}.${R.name}`)})}),oe===0&&b.jsx(ne,{variant:"caption",sx:{color:"warning.main",display:"block",mt:1},children:"No tile is ticked, so this control will not appear on the dashboard."})]})]})})}function Zd(e,t,n,r){const[i,s]=S.useState(void 0);return S.useEffect(()=>{t&&e!==void 0&&s(structuredClone(e))},[t,e]),{draft:i,patch:o=>s(a=>{if(a===void 0)return a;const l=structuredClone(a);return o(l),l}),close:()=>{i!==void 0&&e!==void 0&&JSON.stringify(i)!==JSON.stringify(e)&&n(i),r()},discard:()=>s(void 0)}}const Sg=e=>({title:e.title,...e.description===void 0?{}:{description:e.description},...e.columns===void 0?{}:{columns:e.columns},...e.autorun===void 0?{}:{autorun:e.autorun}}),ps=[2,3,4,6,8,12,16,24];function jg({anchor:e,settings:t,onClose:n,onCommit:r}){const{theme:i}=tt(),{draft:s,patch:o,close:a}=Zd(t,e!==null,r,n),l=s?.columns!==void 0&&!ps.includes(s.columns)?[...ps,s.columns].sort((u,c)=>u-c):ps;return b.jsx(Ml,{open:e!==null&&s!==void 0,anchorEl:e,onClose:a,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:380,p:2}}},children:s&&b.jsxs(he,{sx:{gap:1.5},children:[b.jsx(ne,{variant:"overline",sx:{color:i.tileTitle,lineHeight:1.5},children:"Dashboard"}),b.jsx(De,{size:"small",label:"Title",value:s.title,autoFocus:!0,inputProps:{"aria-label":"Dashboard title"},onChange:u=>o(c=>{c.title=u.target.value})}),b.jsx(De,{size:"small",label:"Description",multiline:!0,minRows:3,maxRows:10,value:s.description??"",helperText:"Markdown. A blank line starts a new paragraph.",inputProps:{"aria-label":"Dashboard description"},onChange:u=>o(c=>{const d=u.target.value;d.trim()===""?delete c.description:c.description=d})}),b.jsxs(De,{select:!0,size:"small",label:"Grid width",value:s.columns??"",helperText:"Columns across the page. Tiles are placed in these.",inputProps:{"aria-label":"Grid width"},onChange:u=>o(c=>{const d=Number(u.target.value);d?c.columns=d:delete c.columns}),children:[b.jsx(bt,{value:"",children:"Default (2)"}),l.map(u=>b.jsx(bt,{value:u,children:u},u))]}),b.jsx(Iu,{control:b.jsx(Ru,{size:"small",checked:s.autorun!==!1,slotProps:{input:{"aria-label":"Run as controls change"}},onChange:u=>o(c=>{u.target.checked?delete c.autorun:c.autorun=!1})}),label:b.jsxs(ne,{variant:"body2",children:["Run as controls change",b.jsx(ne,{component:"span",variant:"caption",sx:{display:"block",opacity:.7},children:"Off, readers press Apply. For a page whose queries are slow."})]})})]})})}const $g=Zt(b.jsx("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}));function Og({controls:e,tileCount:t,unknownFieldsOf:n,onEdit:r,onAdd:i,children:s}){const{theme:o}=tt();return b.jsx(b.Fragment,{children:b.jsxs(he,{sx:{gap:1},children:[b.jsxs(he,{direction:"row","aria-label":"Filters",sx:{gap:1,alignItems:"center",flexWrap:"wrap",minHeight:32},children:[b.jsx($g,{sx:{fontSize:18,color:o.tileTitle,opacity:.7}}),b.jsx(ne,{variant:"subtitle2",sx:{color:o.tileTitle,mr:.5},children:"Filters"}),e.length===0&&b.jsx(ne,{variant:"body2",sx:{color:o.tileTitle,opacity:.8},children:"None yet."}),e.map(a=>{const l=n(a.name,a.type);return b.jsx(kn,{title:l.length>0?`$${a.name} · cannot filter on: ${l.join(", ")}`:`$${a.name} · ${a.origin==="dashboard"?"declared here":"from the model"} · ${a.boundTiles} of ${t} tiles`,children:b.jsx(go,{size:"small",label:a.label??a.name,"aria-label":`Edit filter ${a.name}`,color:l.length>0?"warning":"default",variant:a.origin==="dashboard"?"filled":"outlined",onClick:()=>r(a),sx:{opacity:a.boundTiles===0?.6:1,cursor:"pointer",transition:"opacity 120ms"}})},a.name)}),b.jsx(pe,{sx:{ml:"auto"},children:b.jsx(jl,{label:"Filter",icon:b.jsx(Ol,{}),onClick:()=>i(),ariaLabel:"Add filter",ariaHasPopup:"dialog"})})]}),s]})})}const Mg=(e,t)=>e.map((n,r)=>{const i=t[r]??!1;if(i===(n.break??!1))return n;const s={...n};return i?s.break=!0:delete s.break,s}),Cg=(e,t,n)=>{const r=[...e],[i]=r.splice(t,1);if(!i)return[...e];const s=r[t];i.break&&s&&!s.break&&(r[t]={...s,break:!0});const o={...i};return delete o.break,r.splice(n,0,o),r},Jd=(e,t)=>({kind:"tile",tile:e,index:t,colspan:e.colspan,break:e.break}),Qd=e=>`gap.${e}`,Eg=(e,t)=>{const n=[];let r=0;e.forEach((s,o)=>{const a=Math.min(s.colspan??1,t),l=o===0||s.break===!0||r+a>t;l&&o>0&&r<t&&n.push({kind:"gap",after:mt(e[o-1]),colspan:t-r}),l&&(r=0),n.push(Jd(s,o)),r+=a});const i=e.at(-1);return i&&r<t&&n.push({kind:"gap",after:mt(i),colspan:t-r}),n};var Pg=Object.create,eu=Object.defineProperty,Dg=Object.defineProperties,Tg=Object.getOwnPropertyDescriptor,Ag=Object.getOwnPropertyDescriptors,Ri=Object.getOwnPropertySymbols,tu=Object.prototype.hasOwnProperty,nu=Object.prototype.propertyIsEnumerable,Ig=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Lr=e=>{throw TypeError(e)},ao=(e,t,n)=>t in e?eu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gs=(e,t)=>{for(var n in t||(t={}))tu.call(t,n)&&ao(e,n,t[n]);if(Ri)for(var n of Ri(t))nu.call(t,n)&&ao(e,n,t[n]);return e},ms=(e,t)=>Dg(e,Ag(t)),Rg=(e,t)=>{var n={};for(var r in e)tu.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ri)for(var r of Ri(e))t.indexOf(r)<0&&nu.call(e,r)&&(n[r]=e[r]);return n},Wg=e=>{var t;return[,,,Pg((t=void 0)!=null?t:null)]},ru=["class","method","getter","setter","accessor","field","value","get","set"],cr=e=>e!==void 0&&typeof e!="function"?Lr("Function expected"):e,zg=(e,t,n,r,i)=>({kind:ru[e],name:t,metadata:r,addInitializer:s=>n._?Lr("Already initialized"):i.push(cr(s||null))}),Lg=(e,t)=>ao(t,Ig("metadata"),e[3]),Zr=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},iu=(e,t,n,r,i,s)=>{for(var o,a,l,u,c,d=t&7,f=!1,h=!1,m=e.length+1,g=ru[d+5],w=e[m-1]=[],y=e[m]||(e[m]=[]),p=(i=i.prototype,Tg({get[n](){return dr(this,s)},set[n](v){return Ut(this,s,v)}},n)),x=r.length-1;x>=0;x--)u=zg(d,n,l={},e[3],y),u.static=f,u.private=h,c=u.access={has:v=>n in v},c.get=v=>v[n],c.set=(v,k)=>v[n]=k,a=(0,r[x])({get:p.get,set:p.set},u),l._=1,a===void 0?cr(a)&&(p[g]=a):typeof a!="object"||a===null?Lr("Object expected"):(cr(o=a.get)&&(p.get=o),cr(o=a.set)&&(p.set=o),cr(o=a.init)&&w.unshift(o));return p&&eu(i,n,p),i},su=(e,t,n)=>t.has(e)||Lr("Cannot "+n),dr=(e,t,n)=>(su(e,t,"read from private field"),t.get(e)),Bn=(e,t,n)=>t.has(e)?Lr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ut=(e,t,n,r)=>(su(e,t,"write to private field"),t.set(e,n),n);function Gt(e){return e instanceof ga||e instanceof cu}var Jr=10,Ng=class extends Te{constructor(e){super(e);const t=nt(()=>{const{dragOperation:r}=e;if(jr(r.activatorEvent)&&Gt(r.source)&&r.status.initialized){const i=e.registry.plugins.get(Wr);if(i)return i.disable(),()=>i.enable()}}),n=e.monitor.addEventListener("dragmove",(r,i)=>{queueMicrotask(()=>{if(this.disabled||r.defaultPrevented||!r.nativeEvent)return;const{dragOperation:s}=i;if(!jr(r.nativeEvent)||!Gt(s.source)||!s.shape)return;const{actions:o,collisionObserver:a,registry:l}=i,{by:u}=r;if(!u)return;const c=_g(u),{source:d,target:f}=s,{center:h}=s.shape.current,m=[],g=[];de(()=>{for(const k of l.droppables){const{id:j}=k;if(!k.accepts(d)||j===f?.id&&Gt(k)||!k.element)continue;let O=k.shape;const M=new ut(k.element,{getBoundingClientRect:D=>kr(D,void 0,.2)});!M.height||!M.width||(c=="down"&&h.y+Jr<M.center.y||c=="up"&&h.y-Jr>M.center.y||c=="left"&&h.x-Jr>M.center.x||c=="right"&&h.x+Jr<M.center.x)&&(m.push(k),k.shape=M,g.push(()=>k.shape=O))}}),r.preventDefault(),a.disable();const w=a.computeCollisions(m,Mf);de(()=>g.forEach(k=>k()));const[y]=w;if(!y)return;const{id:p}=y,{index:x,group:v}=d.sortable;o.setDropTarget(p).then(()=>{const{source:k,target:j,shape:O}=s;if(!k||!Gt(k)||!O)return;const{index:M,group:D,target:T}=k.sortable,G=x!==M||v!==D,I=G?T:j?.element;if(!I)return;ed(I);const E=new ut(I);if(!E)return;const F=ht.delta(E,ht.from(O.current.boundingRectangle),k.alignment);o.move({by:F}),G?o.setDropTarget(k.id).then(()=>a.enable()):a.enable()})})});this.destroy=()=>{n(),t()}}};function _g(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"}var Fg=Object.defineProperty,qg=Object.defineProperties,Hg=Object.getOwnPropertyDescriptors,Qa=Object.getOwnPropertySymbols,Ug=Object.prototype.hasOwnProperty,Yg=Object.prototype.propertyIsEnumerable,el=(e,t,n)=>t in e?Fg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ln=(e,t)=>{for(var n in t||(t={}))Ug.call(t,n)&&el(e,n,t[n]);if(Qa)for(var n of Qa(t))Yg.call(t,n)&&el(e,n,t[n]);return e},cn=(e,t)=>qg(e,Hg(t));function Gg(e,t,n){if(t===n)return e;const r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function Qr(e,t){const n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}function vs(e){return"initialIndex"in e&&typeof e.initialIndex=="number"&&"index"in e&&typeof e.index=="number"}function Vg(e,t,n){var r,i;const{source:s,target:o,canceled:a}=t.operation;if(!s||!o||a)return"preventDefault"in t&&t.preventDefault(),e;const l=(p,x)=>p===x||p!==null&&typeof p=="object"&&"id"in p&&p.id===x;if(Array.isArray(e)){const p=e.findIndex(v=>l(v,s.id)),x=e.findIndex(v=>l(v,o.id));if(p===-1||x===-1){if(vs(s)){const v=s.initialIndex,k=s.index;return v===k||v<0||v>=e.length?("preventDefault"in t&&t.preventDefault(),e):n(e,v,k)}return e}if(!a&&"index"in s&&typeof s.index=="number"){const v=s.index;if(v!==p)return n(e,p,v)}return n(e,p,x)}const u=Object.entries(e);let c=-1,d,f=-1,h;for(const[p,x]of u)if(c===-1&&(c=x.findIndex(v=>l(v,s.id)),c!==-1&&(d=p)),f===-1&&(f=x.findIndex(v=>l(v,o.id)),f!==-1&&(h=p)),c!==-1&&f!==-1)break;if(c===-1&&vs(s)){const p=s.initialGroup==null?void 0:Qr(e,s.initialGroup),x=s.initialIndex,v=s.group==null?void 0:Qr(e,s.group),k=s.index;if(p==null||v==null||p===v&&x===k)return"preventDefault"in t&&t.preventDefault(),e;if(p===v)return cn(ln({},e),{[p]:n(e[p],x,k)});const j=e[p][x];return cn(ln({},e),{[p]:[...e[p].slice(0,x),...e[p].slice(x+1)],[v]:[...e[v].slice(0,k),j,...e[v].slice(k)]})}if(!s.manager)return e;const{dragOperation:m}=s.manager,g=(i=(r=m.shape)==null?void 0:r.current.center)!=null?i:m.position.current;if(h==null){const p=Qr(e,o.id);if(p!=null){const x=o.shape&&g.y>o.shape.center.y?e[p].length:0;h=p,f=x}}if(d==null||h==null||d===h&&c===f){if(d!=null&&d===h&&c===f&&vs(s)){const p=s.group==null?void 0:Qr(e,s.group),x=s.group!=null&&p!==d,v=s.index!==c;if(x||v){const k=s.group==null?d:p;if(k!=null){if(d===k)return cn(ln({},e),{[d]:n(e[d],c,s.index)});const j=e[d][c];return cn(ln({},e),{[d]:[...e[d].slice(0,c),...e[d].slice(c+1)],[k]:[...e[k].slice(0,s.index),j,...e[k].slice(s.index)]})}}}return"preventDefault"in t&&t.preventDefault(),e}if(d===h)return cn(ln({},e),{[d]:n(e[d],c,f)});const w=o.shape&&Math.round(g.y)>Math.round(o.shape.center.y)?1:0,y=e[d][c];return cn(ln({},e),{[d]:[...e[d].slice(0,c),...e[d].slice(c+1)],[h]:[...e[h].slice(0,f+w),y,...e[h].slice(f+w)]})}function Kg(e,t){return Vg(e,t,Gg)}function tl(e){const t=new Map;for(const[,n]of e)for(const r of n)t.set(r.id,r.index);return t}function nl(e,t,n){var r;for(const[i,s]of t)for(const o of s){const a=e.get(o.id);if(o.index!==a||o.group!==i||!((r=n.get(i))!=null&&r.has(o)))return!0}return!1}var rl="__default__",Xg=class extends Te{constructor(e){super(e);const t=()=>{const r=new Map;for(const i of e.registry.droppables)if(i instanceof ga){const{sortable:s}=i,{group:o}=s;let a=r.get(o);a||(a=new Set,r.set(o,a)),a.add(s)}return r},n=[e.monitor.addEventListener("dragover",(r,i)=>{if(this.disabled)return;const{dragOperation:s}=i,{source:o,target:a}=s;if(!Gt(o)||!Gt(a)||o.sortable===a.sortable)return;const l=t(),u=tl(l),c=o.sortable.group===a.sortable.group,d=l.get(o.sortable.group),f=c?d:l.get(a.sortable.group);!d||!f||queueMicrotask(()=>{r.defaultPrevented||i.renderer.rendering.then(()=>{var h,m;const g=t();if(nl(u,l,g))return;const w=o.sortable.element,y=a.sortable.element;if(!y||!w||!c&&a.id===o.sortable.group)return;const p=ei(d),x=c?p:ei(f),v=(h=o.sortable.group)!=null?h:rl,k=(m=a.sortable.group)!=null?m:rl,j={[v]:p,[k]:x},O=Kg(j,r);if(j===O)return;const M=O[k].indexOf(o.sortable),D=O[k].indexOf(a.sortable);i.collisionObserver.disable(),il(w,M,y,D),de(()=>{for(const[T,G]of O[v].entries())G.index=T;if(!c)for(const[T,G]of O[k].entries())G.group=a.sortable.group,G.index=T}),i.actions.setDropTarget(o.id).then(()=>i.collisionObserver.enable())})})}),e.monitor.addEventListener("dragend",(r,i)=>{if(!r.canceled)return;const{dragOperation:s}=i,{source:o}=s;Gt(o)&&(o.sortable.initialIndex===o.sortable.index&&o.sortable.initialGroup===o.sortable.group||queueMicrotask(()=>{const a=t(),l=tl(a),u=a.get(o.sortable.initialGroup);u&&i.renderer.rendering.then(()=>{const c=t();if(nl(l,a,c))return;const d=ei(u),f=ei(u,Zg),h=o.sortable.element,m=f.indexOf(o.sortable),g=d[m],w=g?.element;!g||!w||!h||(il(h,g.index,w,o.index),de(()=>{for(const y of a.values()){const p=Array.from(y).values();for(const x of p)x.index=x.initialIndex,x.group=x.initialGroup}}))})}))})];this.destroy=()=>{for(const r of n)r()}}};function il(e,t,n,r){const i=r<t?"afterend":"beforebegin";n.insertAdjacentElement(i,e)}function Bg(e,t){return e.index-t.index}function Zg(e,t){return e.initialIndex-t.initialIndex}function ei(e,t=Bg){return Array.from(e).sort(t)}var sl=[Ng,Xg],ou={duration:250,easing:"cubic-bezier(0.25, 1, 0.5, 1)",idle:!1};function ol(e){var t,n;return typeof e=="boolean"?{draggable:e,droppable:e}:{draggable:(t=e?.draggable)!=null?t:!1,droppable:(n=e?.droppable)!=null?n:!1}}var ti=new ch,au,lu,Pt,fa,ur,hr,pa,bn;lu=[U],au=[U];var Xi=class{constructor(e,t){Bn(this,fa,Zr(Pt,8,this)),Zr(Pt,11,this),Bn(this,ur),Bn(this,hr),Bn(this,pa,Zr(Pt,12,this)),Zr(Pt,15,this),Bn(this,bn),this.register=()=>(de(()=>{var m,g;(m=this.manager)==null||m.registry.register(this.droppable),(g=this.manager)==null||g.registry.register(this.draggable)}),()=>this.unregister()),this.unregister=()=>{de(()=>{var m,g;(m=this.manager)==null||m.registry.unregister(this.droppable),(g=this.manager)==null||g.registry.unregister(this.draggable)})},this.destroy=()=>{de(()=>{this.droppable.destroy(),this.draggable.destroy()})};var n=e,{effects:r=()=>[],disabled:i,group:s,index:o,sensors:a,type:l,transition:u=ou,plugins:c}=n,d=Rg(n,["effects","disabled","group","index","sensors","type","transition","plugins"]);const f=at(c,sl),h=ol(i);this.droppable=new ga(ms(gs({},d),{disabled:h.droppable}),t,this),this.draggable=new cu(ms(gs({},d),{disabled:h.draggable,plugins:f,effects:()=>[()=>{var m,g,w;const y=(m=this.manager)==null?void 0:m.dragOperation.status;y?.initializing&&this.id===((w=(g=this.manager)==null?void 0:g.dragOperation.source)==null?void 0:w.id)&&ti.clear(this.manager),y?.dragging&&ti.set(this.manager,this.id,H(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{const{index:m,group:g,manager:w}=this,y=dr(this,hr),p=dr(this,ur);(m!==y||g!==p)&&(Ut(this,hr,m),Ut(this,ur,g),this.animate())},()=>{var m,g;const{target:w}=this,{isDragSource:y}=this.draggable;((g=(m=this.draggable.pluginConfig(ia))==null?void 0:m.feedback)!=null?g:"default")==="move"&&y&&(this.droppable.disabled=!w)},...r()],type:l,sensors:a}),t,this),Ut(this,bn,d.element),this.manager=t,this.index=o,Ut(this,hr,o),this.group=s,Ut(this,ur,s),this.type=l,this.transition=u}get initialIndex(){var e,t;return(t=(e=ti.get(this.manager,this.id))==null?void 0:e.initialIndex)!=null?t:this.index}get initialGroup(){var e,t;return(t=(e=ti.get(this.manager,this.id))==null?void 0:e.initialGroup)!=null?t:this.group}animate(){H(()=>{const{manager:e,transition:t}=this,{shape:n}=this.droppable;if(!e)return;const{idle:r}=e.dragOperation.status;!n||!t||r&&!t.idle||e.renderer.rendering.then(()=>{const{element:i}=this;if(!i)return;for(const c of i.getAnimations())"transitionProperty"in c&&(c.transitionProperty==="transform"||c.transitionProperty==="translate"||c.transitionProperty==="scale")&&c.cancel();const s=this.refreshShape();if(!s)return;const o={x:n.boundingRectangle.left-s.boundingRectangle.left,y:n.boundingRectangle.top-s.boundingRectangle.top},{translate:a}=gt(i),l=Wa(i,a,!1),u=Wa(i,a);if(o.x||o.y){const c=Bo(Ke(i))?ms(gs({},t),{duration:0}):t;td({element:i,keyframes:{translate:[`${l.x+o.x}px ${l.y+o.y}px ${l.z}`,`${u.x}px ${u.y}px ${u.z}`]},options:c}).then(()=>{e.dragOperation.status.dragging||(this.droppable.shape=void 0)})}})})}get manager(){return this.draggable.manager}set manager(e){de(()=>{this.draggable.manager=e,this.droppable.manager=e})}set element(e){de(()=>{const t=dr(this,bn),n=this.droppable.element,r=this.draggable.element;(!n||n===t)&&(this.droppable.element=e),(!r||r===t)&&(this.draggable.element=e),Ut(this,bn,e)})}get element(){var e,t;const n=dr(this,bn);if(n)return(t=(e=_s.get(n))!=null?e:n)!=null?t:this.droppable.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(){const{disabled:e}=this.draggable,{disabled:t}=this.droppable;return e===t?e:{draggable:e,droppable:t}}set plugins(e){this.draggable.plugins=at(e,sl)}set disabled(e){const t=ol(e);de(()=>{this.droppable.disabled=t.droppable,this.draggable.disabled=t.draggable})}set data(e){de(()=>{this.droppable.data=e,this.draggable.data=e})}set handle(e){this.draggable.handle=e}set id(e){this.droppable.id=e,this.draggable.id=e}get id(){return this.droppable.id}set sensors(e){this.draggable.sensors=e}set modifiers(e){this.draggable.modifiers=e}set collisionPriority(e){this.droppable.collisionPriority=e}set collisionDetector(e){this.droppable.collisionDetector=e??nd}set alignment(e){this.draggable.alignment=e}get alignment(){return this.draggable.alignment}set type(e){de(()=>{this.droppable.type=e,this.draggable.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 isDragging(){return this.draggable.isDragging}get isDropping(){return this.draggable.isDropping}get status(){return this.draggable.status}refreshShape(){return this.droppable.refreshShape()}accepts(e){return this.droppable.accepts(e)}};Pt=Wg();fa=new WeakMap;ur=new WeakMap;hr=new WeakMap;pa=new WeakMap;bn=new WeakMap;iu(Pt,4,"index",lu,Xi,fa);iu(Pt,4,"group",au,Xi,pa);Lg(Pt,Xi);var cu=class extends Gi{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get initialIndex(){return this.sortable.initialIndex}get group(){return this.sortable.group}get initialGroup(){return this.sortable.initialGroup}},ga=class extends Vi{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get group(){return this.sortable.group}},Jg=Object.defineProperty,Qg=Object.defineProperties,em=Object.getOwnPropertyDescriptors,al=Object.getOwnPropertySymbols,tm=Object.prototype.hasOwnProperty,nm=Object.prototype.propertyIsEnumerable,ll=(e,t,n)=>t in e?Jg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bs=(e,t)=>{for(var n in t||(t={}))tm.call(t,n)&&ll(e,n,t[n]);if(al)for(var n of al(t))nm.call(t,n)&&ll(e,n,t[n]);return e},rm=(e,t)=>Qg(e,em(t));function im(e){const{accept:t,collisionDetector:n,collisionPriority:r,id:i,data:s,element:o,handle:a,index:l,group:u,disabled:c,modifiers:d,sensors:f,target:h,type:m,plugins:g}=e,w=bs(bs({},ou),e.transition),y=Ld(x=>new Xi(rm(bs({},e),{transition:w,register:!1,handle:$n(a),element:$n(o),target:$n(h)}),x)),p=Id(y,sm);return ae(i,()=>y.id=i),Un(()=>{de(()=>{y.group=u,y.index=l})},[y,u,l]),ae(m,()=>y.type=m),ae(t,()=>y.accept=t,void 0,st),ae(s,()=>s&&(y.data=s)),ae(l,()=>{var x;(x=y.manager)!=null&&x.dragOperation.status.idle&&w?.idle&&y.refreshShape()},wp),pi(a,x=>y.handle=x),pi(o,x=>y.element=x),pi(h,x=>y.target=x),ae(c,()=>y.disabled=c??!1,void 0,st),ae(f,()=>y.sensors=f,void 0,st),ae(n,()=>y.collisionDetector=n),ae(r,()=>y.collisionPriority=r),ae(g,()=>y.plugins=g,void 0,st),ae(w,()=>y.transition=w,void 0,st),ae(d,()=>y.modifiers=d,void 0,st),ae(e.alignment,()=>y.alignment=e.alignment),{sortable:p,get isDragging(){return p.isDragging},get isDropping(){return p.isDropping},get isDragSource(){return p.isDragSource},get isDropTarget(){return p.isDropTarget},handleRef:S.useCallback(x=>{y.handle=x??void 0},[y]),ref:S.useCallback(x=>{var v,k;!x&&(v=y.element)!=null&&v.isConnected&&!((k=y.manager)!=null&&k.dragOperation.status.idle)||(y.element=x??void 0)},[y]),sourceRef:S.useCallback(x=>{var v,k;!x&&(v=y.source)!=null&&v.isConnected&&!((k=y.manager)!=null&&k.dragOperation.status.idle)||(y.source=x??void 0)},[y]),targetRef:S.useCallback(x=>{var v,k;!x&&(v=y.target)!=null&&v.isConnected&&!((k=y.manager)!=null&&k.dragOperation.status.idle)||(y.target=x??void 0)},[y])}}function sm(e,t,n){return!!(e==="isDragSource"&&!n&&t)}const lo="tile",du="gap",om='[role="separator"]',am=[eo.configure({activatorElements:e=>[e.element],preventActivation:(e,t)=>(eo.defaults.preventActivation?.(e,t)??!1)||e.target instanceof Element&&e.target.closest(om)!==null}),Od],lm=e=>[...e,ia.configure({feedback:"clone"})];function cm({id:e,index:t,children:n}){const{ref:r,handleRef:i,isDragSource:s}=im({id:e,index:t,type:lo,accept:lo,collisionDetector:Jo,plugins:lm});return b.jsx(b.Fragment,{children:n({ref:r,handleRef:i,isDragSource:s})})}function dm({id:e,after:t,children:n}){const{ref:r,isDropTarget:i}=Gp({id:e,type:du,accept:lo,collisionDetector:Jo,data:{after:t}});return b.jsx(b.Fragment,{children:n({ref:r,isDropTarget:i})})}const um=Zt(b.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),hm=Zt(b.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}));function fm({tile:e,index:t,selected:n,menuOpen:r,resizeSpan:i,columns:s,onSelect:o,onOpenMenu:a,onResizeStart:l,onResizeMove:u,onResizeEnd:c,children:d}){const{theme:f}=tt();return b.jsx(cm,{id:mt(e),index:t,children:({ref:h,handleRef:m,isDragSource:g})=>b.jsxs(pe,{ref:h,onClick:o,onPointerDown:w=>{w.button===0&&o()},"aria-label":`Tile ${e.name}`,"aria-current":n,sx:{position:"relative",display:"grid",minWidth:0,cursor:"grab",borderRadius:1,outline:n?`2px solid ${f.drillLink}`:"2px solid transparent",outlineOffset:2,transition:"outline-color 120ms, opacity 120ms, box-shadow 120ms","&&[data-dnd-dragging]":{opacity:1,outline:"none",boxShadow:"0 12px 32px rgba(0, 0, 0, 0.22)"},"&&[data-dnd-placeholder]":{opacity:.45,outline:`2px dashed ${f.drillLink}`,boxShadow:"none"},"&:hover .builder-affordance, &:focus-within .builder-affordance":{opacity:1},"&:hover":{outlineColor:n?f.drillLink:f.cardBorder,boxShadow:"0 2px 10px rgba(0, 0, 0, 0.10)"}},children:[d,b.jsx(pe,{ref:m,className:"builder-affordance","aria-label":`Move ${e.label??e.name}`,sx:{position:"absolute",top:"2px",left:"2px",display:"grid",placeItems:"center",width:"22px",height:"22px",borderRadius:"4px",cursor:"grab",touchAction:"none",zIndex:2,color:f.tileTitle,bgcolor:f.tile,opacity:g||n?.9:0,transition:"opacity 120ms","&:hover":{opacity:1},"&:active":{cursor:"grabbing"},"&:focus-visible":{opacity:1,outline:`2px solid ${f.drillLink}`,outlineOffset:1}},children:b.jsx(um,{sx:{fontSize:16}})}),i===void 0&&b.jsx(ws,{className:"builder-affordance",size:"small","aria-label":`Settings for ${e.label??e.name}`,onClick:w=>{w.stopPropagation(),a(w.currentTarget)},sx:{position:"absolute",top:"2px",right:"2px",width:22,height:22,zIndex:2,color:f.tileTitle,bgcolor:f.tile,opacity:n||r?.9:0,transition:"opacity 120ms","&:hover":{opacity:1,bgcolor:f.tile}},children:b.jsx(hm,{sx:{fontSize:16}})}),i!==void 0&&b.jsxs(pe,{"aria-hidden":!0,sx:{position:"absolute",top:"6px",right:"6px",px:.75,py:.25,borderRadius:"4px",bgcolor:f.drillLink,color:f.tile,fontSize:11,fontVariantNumeric:"tabular-nums",zIndex:4,pointerEvents:"none"},children:[i," of ",s," ·"," ",Math.round(i/s*100),"%"]}),e.declaration.kind!=="inherited"&&b.jsx(pe,{className:"builder-affordance",role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e.label??e.name}`,onPointerDown:l,onPointerMove:u,onPointerUp:c,onPointerCancel:c,sx:{position:"absolute",top:0,bottom:0,right:"-5px",width:"10px",cursor:"col-resize",touchAction:"none",zIndex:1,opacity:i!==void 0||n?1:0,transition:"opacity 120ms","&:hover":{opacity:1},"&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"4px",height:"28px",borderRadius:"2px",bgcolor:f.drillLink}}})]})})}function pm({tile:e}){const{theme:t}=tt();return b.jsxs(Tu,{sx:{minHeight:140},children:[b.jsx(Au,{title:e.label??e.name,subtitle:e.subtitle}),b.jsxs(ne,{variant:"caption",sx:{display:"block",color:t.tileTitle,opacity:.7},children:[e.source," → ",e.name]})]})}function gm({after:e}){const{theme:t}=tt();return b.jsx(dm,{id:Qd(e),after:e,children:({ref:n,isDropTarget:r})=>b.jsx(pe,{ref:n,"aria-hidden":!0,sx:{minHeight:48,borderRadius:1,border:`1px dashed ${t.drillLink}`,bgcolor:r?`color-mix(in srgb, ${t.drillLink} 12%, transparent)`:"transparent",opacity:r?.95:.4,transition:"opacity 120ms, background-color 120ms"}})})}function mm({columns:e}){const{theme:t}=tt();return b.jsx(pe,{"aria-hidden":!0,sx:{position:"absolute",inset:0,pointerEvents:"none",zIndex:3,display:"grid",gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`,gap:`${ii}px`},children:Array.from({length:e},(n,r)=>b.jsx(pe,{sx:{borderLeft:`1px dashed ${t.drillLink}`,borderRight:r===e-1?`1px dashed ${t.drillLink}`:"none",opacity:.35}},r))})}var vm=Object.defineProperty,bm=Object.defineProperties,ym=Object.getOwnPropertyDescriptors,cl=Object.getOwnPropertySymbols,xm=Object.prototype.hasOwnProperty,wm=Object.prototype.propertyIsEnumerable,dl=(e,t,n)=>t in e?vm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dn=(e,t)=>{for(var n in t||(t={}))xm.call(t,n)&&dl(e,n,t[n]);if(cl)for(var n of cl(t))wm.call(t,n)&&dl(e,n,t[n]);return e},un=(e,t)=>bm(e,ym(t));function km(e,t,n){if(t===n)return e;const r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function ni(e,t){const n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}function ys(e){return"initialIndex"in e&&typeof e.initialIndex=="number"&&"index"in e&&typeof e.index=="number"}function Sm(e,t,n){var r,i;const{source:s,target:o,canceled:a}=t.operation;if(!s||!o||a)return"preventDefault"in t&&t.preventDefault(),e;const l=(p,x)=>p===x||p!==null&&typeof p=="object"&&"id"in p&&p.id===x;if(Array.isArray(e)){const p=e.findIndex(v=>l(v,s.id)),x=e.findIndex(v=>l(v,o.id));if(p===-1||x===-1){if(ys(s)){const v=s.initialIndex,k=s.index;return v===k||v<0||v>=e.length?("preventDefault"in t&&t.preventDefault(),e):n(e,v,k)}return e}if(!a&&"index"in s&&typeof s.index=="number"){const v=s.index;if(v!==p)return n(e,p,v)}return n(e,p,x)}const u=Object.entries(e);let c=-1,d,f=-1,h;for(const[p,x]of u)if(c===-1&&(c=x.findIndex(v=>l(v,s.id)),c!==-1&&(d=p)),f===-1&&(f=x.findIndex(v=>l(v,o.id)),f!==-1&&(h=p)),c!==-1&&f!==-1)break;if(c===-1&&ys(s)){const p=s.initialGroup==null?void 0:ni(e,s.initialGroup),x=s.initialIndex,v=s.group==null?void 0:ni(e,s.group),k=s.index;if(p==null||v==null||p===v&&x===k)return"preventDefault"in t&&t.preventDefault(),e;if(p===v)return un(dn({},e),{[p]:n(e[p],x,k)});const j=e[p][x];return un(dn({},e),{[p]:[...e[p].slice(0,x),...e[p].slice(x+1)],[v]:[...e[v].slice(0,k),j,...e[v].slice(k)]})}if(!s.manager)return e;const{dragOperation:m}=s.manager,g=(i=(r=m.shape)==null?void 0:r.current.center)!=null?i:m.position.current;if(h==null){const p=ni(e,o.id);if(p!=null){const x=o.shape&&g.y>o.shape.center.y?e[p].length:0;h=p,f=x}}if(d==null||h==null||d===h&&c===f){if(d!=null&&d===h&&c===f&&ys(s)){const p=s.group==null?void 0:ni(e,s.group),x=s.group!=null&&p!==d,v=s.index!==c;if(x||v){const k=s.group==null?d:p;if(k!=null){if(d===k)return un(dn({},e),{[d]:n(e[d],c,s.index)});const j=e[d][c];return un(dn({},e),{[d]:[...e[d].slice(0,c),...e[d].slice(c+1)],[k]:[...e[k].slice(0,s.index),j,...e[k].slice(s.index)]})}}}return"preventDefault"in t&&t.preventDefault(),e}if(d===h)return un(dn({},e),{[d]:n(e[d],c,f)});const w=o.shape&&Math.round(g.y)>Math.round(o.shape.center.y)?1:0,y=e[d][c];return un(dn({},e),{[d]:[...e[d].slice(0,c),...e[d].slice(c+1)],[h]:[...e[h].slice(0,f+w),y,...e[h].slice(f+w)]})}function jm(e,t){return Sm(e,t,km)}function $m({tiles:e,commit:t,onLanded:n}){const[r,i]=S.useState(void 0),s=S.useRef(void 0),[o,a]=S.useState(!1);return{dragging:o,preview:r,onDragStart:()=>{a(!0),s.current=e},onDragOver:l=>{const{source:u,target:c}=l.operation;if(!u||!c)return;const d=s.current??e;let f;if(c.type===du){const{after:h}=c.data,m=d.findIndex(w=>mt(w)===u.id);if(m<0||h===u.id)return;const g=d.filter((w,y)=>y!==m).findIndex(w=>mt(w)===h)+1;f=Cg(d,m,g)}else{const h=d.map(mt),m=jm(h,l);if(m.every((w,y)=>w===h[y]))return;const g=new Map(d.map(w=>[mt(w),w]));f=Mg(m.map(w=>g.get(w)),e.map(w=>w.break??!1))}s.current=f,i(f)},onDragEnd:l=>{a(!1);const u=s.current;if(s.current=void 0,i(void 0),l.canceled||!u)return;t(u);const c=u.findIndex(d=>mt(d)===l.operation.source?.id);c>=0&&n(c)}}}const ul=e=>{const t=window.document.body;t.style.userSelect=e?"none":"",t.style.cursor=e?"grabbing":""};function Om({tiles:e,columns:t,onStart:n,commit:r}){const[i,s]=S.useState(void 0),o=S.useRef(null);return{resize:i,gridBox:o,startResize:(a,l)=>{const u=o.current?.getBoundingClientRect(),c=a.currentTarget.parentElement?.getBoundingClientRect();!u||!c||(a.stopPropagation(),a.preventDefault(),a.currentTarget.setPointerCapture(a.pointerId),ul(!0),n(l),s({index:l,span:e[l]?.colspan??1,left:c.left,track:(u.width-ii*(t-1))/t}))},onResize:a=>{if(!i)return;const l=a.clientX-i.left,u=Math.round((l+ii)/(i.track+ii)),c=Math.min(Math.max(u,1),t);c!==i.span&&s({...i,span:c})},endResize:a=>{if(a.currentTarget.hasPointerCapture(a.pointerId)&&a.currentTarget.releasePointerCapture(a.pointerId),ul(!1),!i)return;const{index:l,span:u}=i;s(void 0),r(l,u)}}}function Mm({anchor:e,tile:t,onClose:n,onCommit:r,onRemove:i,columns:s,onDrills:o}){const{theme:a}=tt(),{draft:l,patch:u,close:c,discard:d}=Zd(t,e!==null,r,n),f=l!==void 0&&l.declaration.kind!=="inherited";return b.jsx(Ml,{open:e!==null&&l!==void 0,anchorEl:e,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:320,p:2}}},children:l&&b.jsxs(he,{sx:{gap:1.5},children:[b.jsxs(ne,{variant:"overline",sx:{color:a.tileTitle,lineHeight:1.5},children:[l.source," → ",l.name]}),f?b.jsxs(b.Fragment,{children:[b.jsx(De,{size:"small",label:"Title",value:l.label??"",autoFocus:!0,inputProps:{"aria-label":"Tile title"},onChange:h=>u(m=>{const g=h.target.value;g===""?delete m.label:m.label=g})}),b.jsx(De,{size:"small",label:"Subtitle",value:l.subtitle??"",inputProps:{"aria-label":"Tile subtitle"},onChange:h=>u(m=>{const g=h.target.value;g===""?delete m.subtitle:m.subtitle=g})}),b.jsxs(he,{direction:"row",sx:{gap:.5,alignItems:"center"},children:[b.jsx(ne,{variant:"caption",sx:{color:a.tileTitle,mr:.5},children:"Width"}),[["Full",1],["½",2],["⅓",3],["¼",4]].map(([h,m])=>{const g=Math.max(1,Math.round(s/m)),w=(l.colspan??1)===g;return b.jsx(ke,{size:"small",variant:w?"contained":"outlined","aria-label":`Width ${h}`,"aria-pressed":w,onClick:()=>u(y=>{y.colspan=g}),sx:{minWidth:40,px:1},children:h},h)})]})]}):b.jsx(ne,{variant:"body2",sx:{color:a.tileTitle},children:"Declared on its source, so its title and layout are set in the model. It can still be moved."}),l?.declaration.kind==="opaque"&&b.jsxs(ne,{variant:"body2",sx:{color:a.tileTitle},children:["Its body is ",l.declaration.why,", so a filter has no single place to go. Everything else here is editable."]}),b.jsx(xs,{}),b.jsxs(he,{direction:"row",sx:{justifyContent:"space-between"},children:[f?b.jsx(ke,{size:"small",onClick:()=>{c(),o()},children:"Clickable cells…"}):b.jsx("span",{}),b.jsx(ke,{color:"error",size:"small",onClick:()=>{d(),i()},children:"Remove tile"})]})]})})}const uu=e=>e.ok===!1,ve=(e,...t)=>t.every(n=>typeof e?.[n]=="function"),Bi=e=>e!==void 0&&e.ruleIndex!==void 0&&(e.childCount??0)>0,ce={sourceDefinition:e=>ve(e,"sourceNameDef","isDefine","sqExplore"),exploreQueryDef:e=>ve(e,"exploreQueryNameDef","isDefine","vExpr"),defExploreQuery:e=>ve(e,"VIEW","subQueryDefList"),defDimension:e=>ve(e,"defList","DIMENSION"),exploreProperties:e=>ve(e,"exploreStatement","OCURLY","CCURLY"),queryProperties:e=>ve(e,"queryStatement","OCURLY","CCURLY"),queryStatement:e=>ve(e,"whereStatement","aggregateStatement","nestStatement"),whereStatement:e=>ve(e,"WHERE","filterClauseList"),givenDef:e=>ve(e,"givenNameDef"),givenStatement:e=>ve(e,"GIVEN","givenDefList"),importStatement:e=>ve(e,"IMPORT","importURL"),vArrow:e=>ve(e,"ARROW","vExpr","segExpr"),segRefine:e=>ve(e,"PLUS","segExpr"),segOps:e=>ve(e,"queryProperties"),segField:e=>ve(e,"fieldPath")&&!ve(e,"segExpr"),segParen:e=>ve(e,"OPAREN","CPAREN","vExpr"),compare:e=>ve(e,"fieldExpr","compareOp"),givenRef:e=>ve(e,"GIVEN_REF")};function Cm(e){const t=new Int32Array([...e].length+1);let n=0;for(let r=0;r<e.length;)t[n++]=r,r+=e.codePointAt(r)>65535?2:1;return t[n]=e.length,t}function Em(e){const t=[0];for(let n=0;n<e.length;n++)e[n]===`
71
71
  `&&t.push(n+1);return t}class Pm{constructor(t){this.text=t,this.map=Cm(t),this.lineStarts=Em(t)}map;lineStarts;commentLines=new Set;span(t){if(!Bi(t))return;const n=t.start,r=t.stop;if(!n||!r)return;const i=this.map[n.startIndex],s=this.map[r.stopIndex+1];if(!(i===void 0||s===void 0||s<i))return{start:i,end:s}}terminal(t){const n=t?.symbol;if(!n)return;const r=this.map[n.startIndex],i=this.map[n.stopIndex+1];if(!(r===void 0||i===void 0||i<r))return{start:r,end:i}}utf16(t){return this.map[t]}text_(t){const n=this.span(t);return n&&this.text.slice(n.start,n.end)}line(t){let n=0,r=this.lineStarts.length-1;for(;n<r;){const i=n+r+1>>1;this.lineStarts[i]<=t?n=i:r=i-1}return n}positioned(t){const n=this.span(t);return n&&{span:n,line:this.line(n.start)}}indentAt(t){const n=this.lineStarts[this.line(t)];return/^[ \t]*/.exec(this.text.slice(n))?.[0]??""}}function Nr(e,t,n=[]){Bi(e)&&t(e)&&n.push(e);for(let r=0;r<(e.childCount??0);r++)Nr(e.getChild(r),t,n);return n}const Dm=e=>ve(e,"OCURLY","CCURLY");function Er(e,t){const n=[],r=i=>{if(Bi(i)){if(t(i)){n.push(i);return}if(!Dm(i))for(let s=0;s<(i.childCount??0);s++)r(i.getChild(s))}};for(let i=0;i<(e.childCount??0);i++)r(e.getChild(i));return n}const be=(e,t)=>e[t]?.call(e),Xt=(e,t)=>e[t]?.call(e)??[];function Tm(e,t){if(!ce.compare(t)||(t.childCount??0)!==3)return;const n=t.getChild(2);if(!ce.givenRef(n))return;const r=e.text_(t.getChild(0)),i=e.text_(t.getChild(1)),s=e.text_(n)??"";if(!(r===void 0||i===void 0))return{field:r,op:i.trim(),given:s.replace(/^\$/,"")}}function hu(e,t){const n=e.positioned(t);if(!n)return;const r=be(t,"filterClauseList"),i=[];for(const s of r?Xt(r,"fieldExpr"):[]){const o=e.positioned(s);if(!o)continue;const a=Nr(s,ce.givenRef).map(l=>e.text_(l)).filter(l=>l!==void 0).map(l=>l.replace(/^\$/,""));i.push({...o,givens:a,binding:Tm(e,s)})}return{...n,clauses:i}}function co(e,t){const n=e.span(t);if(!n)return;const r=[],i=[];for(const u of Er(t,ce.queryStatement)){const c=e.positioned(u);c&&r.push(c);const d=be(u,"whereStatement");if(d&&ce.whereStatement(d)){const f=hu(e,d);f&&i.push(f)}}const s=n.start+1,o=n.end-1,a=!e.text.slice(n.start,n.end).includes(`
72
- `),l=r.length?e.indentAt(r[0].span.start):e.indentAt(n.start)+" ";return{span:n,openEnd:s,closeStart:o,statements:r,wheres:i,indent:l,oneLine:a}}function ma(e,t,n){const r=[],i=e.line(t.start),s=e.line(n);for(let o=i;o<s;o++){if(e.commentLines.has(o))continue;const a=e.text.slice(e.lineStarts[o],e.lineStarts[o+1]??e.text.length).trim();a.startsWith("#")&&!a.startsWith("##")&&r.push({line:o,text:a})}return r}function Am(e,t){const n=be(t,"segExpr");if(!n)return{kind:"unsupported",why:"an unreadable expression"};const r=ce.vArrow(t);if(ce.segOps(n)){const i=be(n,"queryProperties"),s=i&&co(e,i);return s?{kind:"inline",stage:s,...r?{pipeline:!0}:{}}:{kind:"unsupported",why:"an unreadable body"}}if(r)return{kind:"unsupported",why:"a `->` pipeline from a named view"};if(ce.segField(n)){const i=e.span(n);return i?{kind:"reference",from:e.text.slice(i.start,i.end),fromSpan:i}:{kind:"unsupported",why:"an unreadable name"}}if(ce.segRefine(n)){const i=Xt(n,"segExpr"),s=i[0],o=i[i.length-1];let a=s;for(;ce.segRefine(a);){const f=Xt(a,"segExpr");if(f.some(h=>ce.segOps(h)||ce.segParen(h)))return{kind:"unsupported",why:"a chained refinement"};a=f[0]}if(!a||!ce.segField(a))return{kind:"unsupported",why:"a `{ … } + { … }` compound refinement"};const l=e.span(s);if(!l||!o)return{kind:"unsupported",why:"an unreadable refinement"};if(!ce.segOps(o)){const f=e.span(n);return f?{kind:"reference",from:e.text.slice(f.start,f.end),fromSpan:f}:{kind:"unsupported",why:"an unreadable refinement"}}const u=e.text.slice(l.start,l.end),c=be(o,"queryProperties"),d=c&&co(e,c);return d?{kind:"reference",from:u,fromSpan:l,refinement:d}:{kind:"reference",from:u,fromSpan:l}}return{kind:"unsupported",why:"a parenthesized expression"}}function Im(e,t){const n=[];for(const r of Er(t,ce.defExploreQuery)){const i=e.span(r),s=be(r,"subQueryDefList");if(!i||!s)continue;const o=Xt(s,"exploreQueryDef").filter(ce.exploreQueryDef),a=e.terminal(be(r,"VIEW"));for(const l of o){const u=e.span(l),c=be(l,"exploreQueryNameDef"),d=e.text_(c),f=be(l,"vExpr");!u||!d||!f||n.push({name:d,span:u,line:e.line(u.start),statement:i,tags:ma(e,i,a?.start??u.start),siblings:o.length,body:Am(e,f)})}}return n}function Rm(e,t){const n=[];for(const r of Er(t,ce.defDimension)){const i=e.span(r),s=be(r,"defList");if(!i||!s)continue;const o=e.terminal(be(r,"DIMENSION"));for(const a of Xt(s,"fieldDef")){const l=e.span(a),u=e.text_(be(a,"fieldNameDef"))?.trim(),c=e.text_(be(a,"fieldExpr"))?.trim();!l||!u||c===void 0||n.push({name:u,expression:c,span:l,line:e.line(l.start),statement:i,tags:ma(e,i,o?.start??l.start)})}}return n}function Wm(e,t){const n=[];for(const r of Nr(t,ce.sourceDefinition)){const i=e.span(r),s=e.text_(be(r,"sourceNameDef")),o=be(r,"sqExplore");if(!i||!s||!o)continue;const a=e.span(o),l=a?e.text.slice(a.start,a.end):"",u=(/^\s*(`[^`]*`|[A-Za-z_][A-Za-z0-9_.]*)/.exec(l)?.[1]??"").trim(),c=Er(o,ce.exploreProperties)[0],d=c&&co(e,c),f={start:e.lineStarts[e.line(i.start)],end:i.end},h=[];if(c)for(const m of Er(c,ce.whereStatement)){const g=hu(e,m);g&&h.push(g)}n.push({name:s,base:u,span:i,line:e.line(i.start),statement:f,...d?{properties:d}:{},views:c?Im(e,c):[],dimensions:c?Rm(e,c):[],wheres:h})}return n}function zm(e,t){const n=[];for(const r of Nr(t,ce.givenStatement)){const i=e.terminal(be(r,"GIVEN")),s=be(r,"givenDefList"),o=i?e.line(i.start):void 0;for(const a of s?Xt(s,"givenDef"):[]){const l=e.span(a),u=e.span(be(a,"givenNameDef")),c=u&&e.text.slice(u.start,u.end);if(!l||!u||!c)continue;const d={start:u.start,end:l.end},f=e.line(d.start);n.push({name:c,declaration:e.text.slice(d.start,d.end),span:d,line:f,statement:{start:e.lineStarts[f],end:d.end},tags:ma(e,l,d.start),...o!==void 0&&o!==f?{blockHeader:o}:{}})}}return n}function Lm(e,t){const n=[];for(const r of Nr(t,ce.importStatement)){const i=e.span(r),s=e.text_(be(r,"importURL"));if(!i||s===void 0)continue;const o=be(r,"importSelect"),a=o?Xt(o,"importItem").map(l=>e.text_(l)).filter(l=>l!==void 0).map(l=>l.trim()):void 0;n.push({from:s.replace(/^['"]|['"]$/g,""),...a&&a.length>0?{names:a}:{},span:i,line:e.line(i.start),statement:i})}return n}async function fu(e){let t;try{t=await pu(e,"file://dashboard-builder.malloy")}catch(c){return{ok:!1,reason:`Malloy could not read this file: ${c}`}}const n=t.problems.filter(c=>c.code==="syntax-error");if(n.length>0)return{ok:!1,reason:`This file has a Malloy syntax error, so it cannot be edited here: ${n[0].message??"unknown"}`};const r=t.parse,i=r?.root;if(!i||!Bi(i)||typeof i.getChild!="function")return{ok:!1,reason:`This build of Malloy does not expose a parse tree the builder can read (malloy ${r?.malloyVersion??"unknown"}), so editing is off.`};const s=r?.tokenStream??{},o=typeof s.getTokens=="function"?s.getTokens():void 0;if(!o||typeof s.tokenSource?.vocabulary?.getSymbolicName!="function"||o.length===0&&e.trim()!=="")return{ok:!1,reason:`This build of Malloy does not expose a token stream the builder can read (malloy ${r?.malloyVersion??"unknown"}), so it cannot tell a comment from code and editing is off.`};const a=new Pm(e),l=Nm(a,s);a.commentLines=l.lines;const u=Wm(a,i);return u.length===0&&/^\s*source:/m.test(e)?{ok:!1,reason:`The builder could not locate this file's sources in Malloy's parse tree (malloy ${r?.malloyVersion??"unknown"}), so editing is off.`}:{ok:!0,parsed:{text:e,lineStarts:a.lineStarts,imports:Lm(a,i),sources:u,givens:zm(a,i),trailingComment:c=>l.trailing.get(c),comments:l.all,commentLine:c=>l.lines.has(c),commentIn:c=>l.all.find(d=>d.start>=c.start&&d.start<c.end),blockStart:c=>_m(a,l.lines,c)}}}async function pu(e,t){const{MalloyTranslator:n}=await $l(async()=>{const{MalloyTranslator:i}=await import("./index-xgxo45Xn.js").then(s=>s.i);return{MalloyTranslator:i}},__vite__mapDeps([0,1,2,3,4])),r=new n(t,null,{urls:{[t]:e}});return{problems:r.translate().problems??[],parse:r.parseStep?.response?.parse}}function Nm(e,t){const n=new Map,r=new Set,i=[],s=t.tokenSource?.vocabulary;for(const c of t.getTokens?.()??[]){const d=s?.getSymbolicName(c.type);if(d!=="COMMENT_TO_EOL"&&d!=="BLOCK_COMMENT")continue;const f=e.utf16(c.startIndex);let h=e.utf16(c.stopIndex+1);if(!(f===void 0||h===void 0||h<f)){for(;h>f&&(e.text[h-1]===`
72
+ `),l=r.length?e.indentAt(r[0].span.start):e.indentAt(n.start)+" ";return{span:n,openEnd:s,closeStart:o,statements:r,wheres:i,indent:l,oneLine:a}}function ma(e,t,n){const r=[],i=e.line(t.start),s=e.line(n);for(let o=i;o<s;o++){if(e.commentLines.has(o))continue;const a=e.text.slice(e.lineStarts[o],e.lineStarts[o+1]??e.text.length).trim();a.startsWith("#")&&!a.startsWith("##")&&r.push({line:o,text:a})}return r}function Am(e,t){const n=be(t,"segExpr");if(!n)return{kind:"unsupported",why:"an unreadable expression"};const r=ce.vArrow(t);if(ce.segOps(n)){const i=be(n,"queryProperties"),s=i&&co(e,i);return s?{kind:"inline",stage:s,...r?{pipeline:!0}:{}}:{kind:"unsupported",why:"an unreadable body"}}if(r)return{kind:"unsupported",why:"a `->` pipeline from a named view"};if(ce.segField(n)){const i=e.span(n);return i?{kind:"reference",from:e.text.slice(i.start,i.end),fromSpan:i}:{kind:"unsupported",why:"an unreadable name"}}if(ce.segRefine(n)){const i=Xt(n,"segExpr"),s=i[0],o=i[i.length-1];let a=s;for(;ce.segRefine(a);){const f=Xt(a,"segExpr");if(f.some(h=>ce.segOps(h)||ce.segParen(h)))return{kind:"unsupported",why:"a chained refinement"};a=f[0]}if(!a||!ce.segField(a))return{kind:"unsupported",why:"a `{ … } + { … }` compound refinement"};const l=e.span(s);if(!l||!o)return{kind:"unsupported",why:"an unreadable refinement"};if(!ce.segOps(o)){const f=e.span(n);return f?{kind:"reference",from:e.text.slice(f.start,f.end),fromSpan:f}:{kind:"unsupported",why:"an unreadable refinement"}}const u=e.text.slice(l.start,l.end),c=be(o,"queryProperties"),d=c&&co(e,c);return d?{kind:"reference",from:u,fromSpan:l,refinement:d}:{kind:"reference",from:u,fromSpan:l}}return{kind:"unsupported",why:"a parenthesized expression"}}function Im(e,t){const n=[];for(const r of Er(t,ce.defExploreQuery)){const i=e.span(r),s=be(r,"subQueryDefList");if(!i||!s)continue;const o=Xt(s,"exploreQueryDef").filter(ce.exploreQueryDef),a=e.terminal(be(r,"VIEW"));for(const l of o){const u=e.span(l),c=be(l,"exploreQueryNameDef"),d=e.text_(c),f=be(l,"vExpr");!u||!d||!f||n.push({name:d,span:u,line:e.line(u.start),statement:i,tags:ma(e,i,a?.start??u.start),siblings:o.length,body:Am(e,f)})}}return n}function Rm(e,t){const n=[];for(const r of Er(t,ce.defDimension)){const i=e.span(r),s=be(r,"defList");if(!i||!s)continue;const o=e.terminal(be(r,"DIMENSION"));for(const a of Xt(s,"fieldDef")){const l=e.span(a),u=e.text_(be(a,"fieldNameDef"))?.trim(),c=e.text_(be(a,"fieldExpr"))?.trim();!l||!u||c===void 0||n.push({name:u,expression:c,span:l,line:e.line(l.start),statement:i,tags:ma(e,i,o?.start??l.start)})}}return n}function Wm(e,t){const n=[];for(const r of Nr(t,ce.sourceDefinition)){const i=e.span(r),s=e.text_(be(r,"sourceNameDef")),o=be(r,"sqExplore");if(!i||!s||!o)continue;const a=e.span(o),l=a?e.text.slice(a.start,a.end):"",u=(/^\s*(`[^`]*`|[A-Za-z_][A-Za-z0-9_.]*)/.exec(l)?.[1]??"").trim(),c=Er(o,ce.exploreProperties)[0],d=c&&co(e,c),f={start:e.lineStarts[e.line(i.start)],end:i.end},h=[];if(c)for(const m of Er(c,ce.whereStatement)){const g=hu(e,m);g&&h.push(g)}n.push({name:s,base:u,span:i,line:e.line(i.start),statement:f,...d?{properties:d}:{},views:c?Im(e,c):[],dimensions:c?Rm(e,c):[],wheres:h})}return n}function zm(e,t){const n=[];for(const r of Nr(t,ce.givenStatement)){const i=e.terminal(be(r,"GIVEN")),s=be(r,"givenDefList"),o=i?e.line(i.start):void 0;for(const a of s?Xt(s,"givenDef"):[]){const l=e.span(a),u=e.span(be(a,"givenNameDef")),c=u&&e.text.slice(u.start,u.end);if(!l||!u||!c)continue;const d={start:u.start,end:l.end},f=e.line(d.start);n.push({name:c,declaration:e.text.slice(d.start,d.end),span:d,line:f,statement:{start:e.lineStarts[f],end:d.end},tags:ma(e,l,d.start),...o!==void 0&&o!==f?{blockHeader:o}:{}})}}return n}function Lm(e,t){const n=[];for(const r of Nr(t,ce.importStatement)){const i=e.span(r),s=e.text_(be(r,"importURL"));if(!i||s===void 0)continue;const o=be(r,"importSelect"),a=o?Xt(o,"importItem").map(l=>e.text_(l)).filter(l=>l!==void 0).map(l=>l.trim()):void 0;n.push({from:s.replace(/^['"]|['"]$/g,""),...a&&a.length>0?{names:a}:{},span:i,line:e.line(i.start),statement:i})}return n}async function fu(e){let t;try{t=await pu(e,"file://dashboard-builder.malloy")}catch(c){return{ok:!1,reason:`Malloy could not read this file: ${c}`}}const n=t.problems.filter(c=>c.code==="syntax-error");if(n.length>0)return{ok:!1,reason:`This file has a Malloy syntax error, so it cannot be edited here: ${n[0].message??"unknown"}`};const r=t.parse,i=r?.root;if(!i||!Bi(i)||typeof i.getChild!="function")return{ok:!1,reason:`This build of Malloy does not expose a parse tree the builder can read (malloy ${r?.malloyVersion??"unknown"}), so editing is off.`};const s=r?.tokenStream??{},o=typeof s.getTokens=="function"?s.getTokens():void 0;if(!o||typeof s.tokenSource?.vocabulary?.getSymbolicName!="function"||o.length===0&&e.trim()!=="")return{ok:!1,reason:`This build of Malloy does not expose a token stream the builder can read (malloy ${r?.malloyVersion??"unknown"}), so it cannot tell a comment from code and editing is off.`};const a=new Pm(e),l=Nm(a,s);a.commentLines=l.lines;const u=Wm(a,i);return u.length===0&&/^\s*source:/m.test(e)?{ok:!1,reason:`The builder could not locate this file's sources in Malloy's parse tree (malloy ${r?.malloyVersion??"unknown"}), so editing is off.`}:{ok:!0,parsed:{text:e,lineStarts:a.lineStarts,imports:Lm(a,i),sources:u,givens:zm(a,i),trailingComment:c=>l.trailing.get(c),comments:l.all,commentLine:c=>l.lines.has(c),commentIn:c=>l.all.find(d=>d.start>=c.start&&d.start<c.end),blockStart:c=>_m(a,l.lines,c)}}}async function pu(e,t){const{MalloyTranslator:n}=await $l(async()=>{const{MalloyTranslator:i}=await import("./index-BS2OPPD1.js").then(s=>s.i);return{MalloyTranslator:i}},__vite__mapDeps([0,1,2,3,4])),r=new n(t,null,{urls:{[t]:e}});return{problems:r.translate().problems??[],parse:r.parseStep?.response?.parse}}function Nm(e,t){const n=new Map,r=new Set,i=[],s=t.tokenSource?.vocabulary;for(const c of t.getTokens?.()??[]){const d=s?.getSymbolicName(c.type);if(d!=="COMMENT_TO_EOL"&&d!=="BLOCK_COMMENT")continue;const f=e.utf16(c.startIndex);let h=e.utf16(c.stopIndex+1);if(!(f===void 0||h===void 0||h<f)){for(;h>f&&(e.text[h-1]===`
73
73
  `||e.text[h-1]==="\r");)h--;i.push({start:f,end:h})}}const o=[...i].sort((c,d)=>c.start-d.start);let a="",l=0;for(const c of o)a+=e.text.slice(l,Math.max(l,c.start)),a+=e.text.slice(Math.max(l,c.start),Math.max(l,c.end)).replace(/[^\n\r]/g," "),l=Math.max(l,c.end);a+=e.text.slice(l);const u=c=>a.slice(e.lineStarts[c],e.lineStarts[c+1]??a.length);for(const c of i){const d=e.line(c.start),f=e.line(c.end-1);for(let g=d;g<=f;g++)u(g).trim()===""&&r.add(g);const h=a.slice(e.lineStarts[d],c.start).trim(),m=a.slice(c.end,e.lineStarts[f+1]??a.length).trim();h!==""&&m===""&&n.set(f,c)}return{trailing:n,lines:r,all:i}}function _m(e,t,n){let r=n;for(let i=n-1;i>=0;i--){const s=e.text.slice(e.lineStarts[i],e.lineStarts[i+1]??e.text.length).trim();if(s===""&&!t.has(i))break;if(s.startsWith("#")||t.has(i))r=i;else break}return r}const uo=e=>e.ok===!1;function _r(e,t,n){const r=e.blockStart(n),i=[];for(let s=r;s<n;s++){if(e.commentLine(s))continue;const o=t[s].trim();o.startsWith("#")&&!o.startsWith("##")&&i.push({line:s,text:o})}return{start:r,tags:i}}const ho=e=>e.map(t=>t.text);function Fm(e){const t=[],n=[];for(const r of e){const i=r.trim();if(i.startsWith('##"'))t.push(i.slice(3).trim());else{if(i.startsWith("##!"))continue;i.startsWith("##")&&n.push(i)}}return{description:t.length>0?t.join(`
74
- `):void 0,artifact:n}}function qm(e){if(!e)return;const t=[];for(const n of e.wheres)for(const r of n.clauses){if(!r.binding)continue;const{field:i,op:s,given:o}=r.binding;t.push({field:i,given:o,...s==="~"?{}:{op:s}})}return t.length>0?t:void 0}function Hm(e,t,n){const r=[];for(const i of e.givens){const s=/^([A-Za-z_][A-Za-z0-9_]*)\s*::\s*(\S+)\s+is\s+([\s\S]+)$/.exec(i.declaration);s&&r.push({name:s[1],type:s[2],default:s[3].trim(),...Um(n(ho(_r(e,t,i.line).tags)).tag)})}return r.length>0?r:void 0}function Um(e){if(!e)return{};const t=e.tag("suggest"),n=t?.text("dimension"),r=e.numeric("range_min"),i=e.numeric("range_max");return{...e.text("label")===void 0?{}:{label:e.text("label")},...e.text("description")===void 0?{}:{description:e.text("description")},...e.text("control")===void 0?{}:{control:e.text("control")},...t&&n?{suggest:{...t.text("source")===void 0?{}:{source:t.text("source")},...t.text("query")===void 0?{}:{query:t.text("query")},dimension:n}}:{},...r===void 0?{}:{rangeMin:r},...i===void 0?{}:{rangeMax:i}}}function Ym(e){const t=e.search(/tiles\s*=\s*\[/);if(t<0)return[];const n=e.indexOf("[",t),r=e.indexOf("]",n);return r<0?[]:[...e.slice(n+1,r).matchAll(/"([^"]+)"/g)].map(i=>i[1])}async function fo(e){const{parseAnnotation:t}=await $l(async()=>{const{parseAnnotation:v}=await import("./index-aXk5ykLp.js").then(k=>k.i);return{parseAnnotation:v}},__vite__mapDeps([5,1,2,3])),n=e.split(`
74
+ `):void 0,artifact:n}}function qm(e){if(!e)return;const t=[];for(const n of e.wheres)for(const r of n.clauses){if(!r.binding)continue;const{field:i,op:s,given:o}=r.binding;t.push({field:i,given:o,...s==="~"?{}:{op:s}})}return t.length>0?t:void 0}function Hm(e,t,n){const r=[];for(const i of e.givens){const s=/^([A-Za-z_][A-Za-z0-9_]*)\s*::\s*(\S+)\s+is\s+([\s\S]+)$/.exec(i.declaration);s&&r.push({name:s[1],type:s[2],default:s[3].trim(),...Um(n(ho(_r(e,t,i.line).tags)).tag)})}return r.length>0?r:void 0}function Um(e){if(!e)return{};const t=e.tag("suggest"),n=t?.text("dimension"),r=e.numeric("range_min"),i=e.numeric("range_max");return{...e.text("label")===void 0?{}:{label:e.text("label")},...e.text("description")===void 0?{}:{description:e.text("description")},...e.text("control")===void 0?{}:{control:e.text("control")},...t&&n?{suggest:{...t.text("source")===void 0?{}:{source:t.text("source")},...t.text("query")===void 0?{}:{query:t.text("query")},dimension:n}}:{},...r===void 0?{}:{rangeMin:r},...i===void 0?{}:{rangeMax:i}}}function Ym(e){const t=e.search(/tiles\s*=\s*\[/);if(t<0)return[];const n=e.indexOf("[",t),r=e.indexOf("]",n);return r<0?[]:[...e.slice(n+1,r).matchAll(/"([^"]+)"/g)].map(i=>i[1])}async function fo(e){const{parseAnnotation:t}=await $l(async()=>{const{parseAnnotation:v}=await import("./index-BxPJ-qDv.js").then(k=>k.i);return{parseAnnotation:v}},__vite__mapDeps([5,1,2,3])),n=e.split(`
75
75
  `),r=await fu(e);if(uu(r))return{ok:!1,reason:r.reason,...r.line?{line:r.line}:{}};const i=r.parsed,{description:s,artifact:o}=Fm(n),a=o.find(v=>v.includes("artifact"));if(a===void 0)return{ok:!1,reason:"No `## artifact { … }` tag, so this file is not a composite dashboard."};const l=t([a.replace(/^##\s*/,"# ")]).tag,u=l?.tag("artifact"),c=Ym(a);if(c.length===0)return{ok:!1,reason:"The `## artifact` tag names no tiles, so there is nothing to lay out."};const d=i.imports.map(v=>v.names?{kind:"names",names:v.names,from:v.from}:{kind:"all",from:v.from}),f=[],h=[],m=new Map;for(const v of i.sources){const k={name:v.name,base:v.base};v.dimensions.length>0&&(k.dimensions=v.dimensions.map(j=>({name:j.name,expression:j.expression}))),f.push(k);for(const j of v.dimensions){const O=t(ho(_r(i,n,j.line).tags)).tag?.tag("drill");if(!O)continue;const M=O.textArray("to")??[O.text("to")??""];h.push({source:v.name,name:j.name,expression:j.expression,to:M.filter(Boolean),...O.text("given")?{given:O.text("given")}:{}})}m.set(v.name,new Map(v.views.map(j=>[j.name,j])))}const g=[];for(const v of c){const k=Du(v);if(!k)return{ok:!1,reason:`The tile \`${v}\` is not a \`source -> view\` expression, which is the only form the builder can lay out.`};const{source:j,view:O}=k,M=m.get(j)?.get(O);if(M===void 0){g.push({name:O,source:j,declaration:{kind:"inherited"}});continue}const D=t(ho(M.tags)).tag,T=M.body.kind==="reference"?{kind:"reference",from:M.body.from}:M.body.kind==="inline"?{kind:"inline"}:void 0;if(T===void 0){g.push({name:O,source:j,declaration:{kind:"opaque",why:M.body.kind==="unsupported"?M.body.why:"unreadable"},...D?.text("label")?{label:D.text("label")}:{},...D?.text("subtitle")?{subtitle:D.text("subtitle")}:{},...D?.numeric("colspan")!==void 0?{colspan:D.numeric("colspan")}:{},...D?.has("break")?{break:!0}:{},...D?.has("borderless")?{borderless:!0}:{}});continue}const G=qm(M.body.kind==="reference"?M.body.refinement:M.body.kind==="inline"?M.body.stage:void 0);g.push({name:O,source:j,declaration:T,...G?{filters:G}:{},...D?.text("label")?{label:D.text("label")}:{},...D?.text("subtitle")?{subtitle:D.text("subtitle")}:{},...D?.numeric("colspan")!==void 0?{colspan:D.numeric("colspan")}:{},...D?.has("break")?{break:!0}:{},...D?.has("borderless")?{borderless:!0}:{}})}const w=Hm(i,n,t),y={},p=u?.tag("givens");for(const v of Object.keys(p?.dict??{})){const k=p?.text(v);k!==void 0&&(y[v]=k)}const x=l?.tag("dashboard")?.numeric("columns");return{ok:!0,document:{title:u?.text("title")??"",...s?{description:s}:{},...x===void 0?{}:{columns:x},...u?.has("autorun")?{autorun:u.isTrue("autorun")}:{},imports:d,sources:f,...w?{localGivens:w}:{},...Object.keys(y).length>0?{startingGivens:y}:{},...h.length>0?{drills:h}:{},tiles:g}}}async function hl(e){const{problems:t}=await pu(e,"file://splice-check.malloy");return t.filter(n=>n.code==="syntax-error").map(n=>n.message??"").sort()}const fl=e=>e.ok===!1;function ye(e){const t=n=>{if(Array.isArray(n))return n.map(t);if(n&&typeof n=="object"){const r={};for(const i of Object.keys(n).sort())r[i]=t(n[i]);return r}return n};return JSON.stringify(t(e))}function Gm(e){const t=[0];for(let n=0;n<e.length;n++)e[n]===`
76
76
  `&&t.push(n+1);return t}function Vm(e,t){let n=e;for(const r of[...t].sort((i,s)=>s.start-i.start||s.end-i.end))n=n.slice(0,r.start)+r.text+n.slice(r.end);return n}function gu(e){const t=[];return e.colspan!==void 0&&t.push(`# colspan=${e.colspan}`),e.break&&t.push("# break"),e.borderless&&t.push("# borderless"),e.label!==void 0&&t.push(`# label=${Tn(e.label)}`),e.subtitle!==void 0&&t.push(`# subtitle=${Tn(e.subtitle)}`),t}function vi(e){return/^#\s*([a-z_]+)/.exec(e)?.[1]}const Km=new Set(["colspan","break","borderless","label","subtitle"]),Xm=new Set(["label","description","control","suggest","range_min","range_max"]),Bm=(e,t)=>ye(e.imports)===ye(t.imports);function pl(e){const t=[];if(e.label!==void 0&&t.push(`label=${Tn(e.label)}`),e.description!==void 0&&t.push(`description=${Tn(e.description)}`),e.control!==void 0&&t.push(`control=${e.control}`),e.suggest){const n=e.suggest.source!==void 0?`source=${e.suggest.source}`:e.suggest.query!==void 0?`query=${e.suggest.query}`:void 0;t.push(`suggest { ${n?`${n} `:""}dimension=${e.suggest.dimension} }`)}return e.rangeMin!==void 0&&t.push(`range_min=${e.rangeMin}`),e.rangeMax!==void 0&&t.push(`range_max=${e.rangeMax}`),t.length>0?`# ${t.join(" ")}`:void 0}const gl=e=>`given: ${e.name} :: ${e.type} is ${e.default}`;function Zm(e,t,n){const r=e.sources.find(i=>i.name===t)?.views.find(i=>i.name===n);return r?r.line:-1}function ml(e){return`# drill { to=${e.to.length===1?e.to[0]:`[${e.to.map(t=>`"${t}"`).join(", ")}]`}${e.given?` given=${e.given}`:""} }`}const Wi=e=>`${e.source}.${e.name}`,Tn=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,po=e=>ye([e.name,e.source,e.declaration]),vt=po,vl=e=>ye(e.tiles.map(vt));function Jm(e,t){const n=new Set(e.tiles.map(vt)),r=new Set(t.tiles.map(vt)),i=e.tiles.filter(c=>!r.has(vt(c))),s=t.tiles.filter(c=>!n.has(vt(c))),o=i.length>0||s.length>0||vl(e)!==vl(t);for(const c of s)if(c.declaration.kind!=="reference")return{ok:!1,reason:`A new tile names a view of a source; \`${c.name}\` is ${c.declaration.kind==="inline"?"an inline query":"not declared here"}, which the builder cannot write.`};const a=new Map(e.sources.map(c=>[c.name,c])),l=new Set(e.imports.flatMap(c=>c.kind==="names"?c.names:[]));for(const c of e.sources)l.add(c.base);const u=t.sources.filter(c=>!a.has(c.name));for(const c of e.sources){const d=t.sources.find(f=>f.name===c.name);if(!d||d.base!==c.base)return{ok:!1,reason:`The source \`${c.name}\` cannot be changed or removed here.`}}for(const c of u){if(!s.some(d=>d.source===c.name))return{ok:!1,reason:`A new source \`${c.name}\` needs a tile on it.`};if(!l.has(c.base))return{ok:!1,reason:`\`${c.base}\` is not imported by name in this file, so a tile cannot be put on it. The builder does not add imports: import { ${c.base} } from the model first.`}}return Bm(e,t)?{currentKeys:n,nextKeys:r,removedTiles:i,addedTiles:s,newSources:u,currentSources:a,reordered:o}:{ok:!1,reason:"The dashboard's imports cannot be changed here."}}function Qm(e){const{lines:t,wholeLine:n,next:r,reordered:i,currentKeys:s,nextKeys:o,edits:a}=e;if(i){const l=Ss(t);if(l<0)return{ok:!1,reason:"Could not find the `## artifact` tag to reorder."};const u=[...t[l].matchAll(/"([^"]+)"/g)].map(m=>m[1]),c=new Map;for(const m of u){const g=m.split("->").map(w=>w.trim());g.length===2&&c.set(`${g[0]}->${g[1]}`,m)}const d=r.tiles.map(m=>c.get(`${m.source}->${m.name}`)??(o.has(vt(m))&&!s.has(vt(m))?`${m.source} -> ${m.name}`:void 0));if(d.some(m=>m===void 0))return{ok:!1,reason:"A tile in the new order is not one the `## artifact` tag names."};const f=`tiles=[${d.map(m=>`"${m}"`).join(", ")}]`,h=t[l].replace(/tiles\s*=\s*\[[\s\S]*?\]/,f);h!==t[l]&&a.push({...n(l),text:`${h}
77
77
  `})}}function ev(e){const{lines:t,wholeLine:n,current:r,next:i,edits:s}=e;if(r.title!==i.title||r.autorun!==i.autorun||r.columns!==i.columns||ye(r.startingGivens)!==ye(i.startingGivens)){const o=Ss(t);if(o<0)return{ok:!1,reason:"Could not find the `## artifact` tag to change the page's settings."};const a=s.find(g=>g.start===n(o).start&&g.end===n(o).end);let l=a?a.text.replace(/\n$/,""):t[o];const u=l.indexOf("artifact"),c=l.indexOf("{",u);let d=0,f=-1;for(let g=c;g<l.length;g++)if(l[g]==="{")d++;else if(l[g]==="}"&&--d===0){f=g;break}if(c<0||f<0)return{ok:!1,reason:"Could not read the `## artifact { … }` tag."};let h=l.slice(c+1,f);const m=(g,w)=>{const y=new RegExp(`\\s*\\b${g}=(?:"(?:[^"\\\\]|\\\\.)*"|[^\\s}]+)`);w===void 0?h=h.replace(y,""):y.test(h)?h=h.replace(y,` ${g}=${w}`):h=`${h.replace(/\s+$/,"")} ${g}=${w} `};if(r.title!==i.title&&m("title",i.title?Tn(i.title):void 0),r.autorun!==i.autorun&&m("autorun",i.autorun===void 0?void 0:String(i.autorun)),ye(r.startingGivens)!==ye(i.startingGivens)){h=h.replace(/\s*\bgivens\s*\{[^}]*\}/,"");const g=Object.entries(i.startingGivens??{});g.length>0&&(h=`${h.replace(/\s+$/,"")} givens { ${g.map(([w,y])=>`${w}=${Tn(y)}`).join(" ")} }`)}h=h.replace(/\s{2,}/g," "),l=`${l.slice(0,c+1)}${h.startsWith(" ")?h:` ${h}`}${h.endsWith(" ")?"":" "}${l.slice(f)}`,r.columns!==i.columns&&(l=l.replace(/\s*dashboard\s*\{[^}]*\}/,""),i.columns!==void 0&&(l=`${l.trimEnd()} dashboard { columns=${i.columns} }`)),a?a.text=`${l}
@@ -16,7 +16,7 @@ SPDX-License-Identifier: MIT
16
16
  href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
17
17
  />
18
18
  <title>Malloy Publisher</title>
19
- <script type="module" crossorigin src="/assets/index-CNQ_NxFx.js"></script>
19
+ <script type="module" crossorigin src="/assets/index-zr-x34Gt.js"></script>
20
20
  <link rel="stylesheet" crossorigin href="/assets/index-DUqldpo0.css">
21
21
  </head>
22
22
  <body>