const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./slides-component-Ca58bUzf.js","./index-FKnJJang.js","./index-LqLQ7ktu.css","./slides-component-DgTqb5fJ.css"])))=>i.map(i=>d[i]);
var e,t=Object.defineProperty,n=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"symbol"!=typeof n?n+"":n,r);import{b0 as r,cO as o,ar as a,cP as i,av as s,G as l,cQ as c,ag as u,a4 as d,bR as p,cR as f,D as h,a6 as m,a7 as g,K as y,bY as b,R as v,bi as w,cS as x,cT as S,as as _,bj as O,cU as j,cV as E,cW as D,bq as C,cX as N,cY as k,bC as R,bf as P,be as M,cZ as z,c_ as T,c$ as L,d0 as I,bo as H,ap as A,F as W,d1 as q,d2 as B,d3 as G,d4 as F,at as Y,d5 as U,d6 as V,d7 as X,d8 as $,bu as K,a2 as Q,d9 as Z,da as J,db as ee,H as te,dc as ne,dd as re,de as oe,df as ae,dg as ie,dh as se,di as le,dj as ce,dk as ue,P as de,dl as pe,W as fe,dm as he,dn as me,dp as ge,cM as ye,dq as be,dr as ve,ds as we,dt as xe,du as Se,dv as _e,dw as Oe,dx as je,dy as Ee,dz as De,dA as Ce,dB as Ne,dC as ke,dD as Re,dE as Pe,dF as Me,dG as ze,dH as Te,dI as Le,dJ as Ie,dK as He,dL as Ae,dM as We,b6 as qe,dN as Be,dO as Ge,aj as Fe,dP as Ye,dQ as Ue,dR as Ve,dS as Xe,dT as $e,dU as Ke,cd as Qe,bm as Ze,dV as Je,dW as et,a0 as tt,b7 as nt,dX as rt,dY as ot,dZ as at,d_ as it,d$ as st,e0 as lt,e1 as ct,e2 as ut,e3 as dt,e4 as pt,b9 as ft,e5 as ht,e6 as mt,e7 as gt,e8 as yt,e9 as bt,ea as vt,eb as wt}from"./index-FKnJJang.js";
/**
 * @license lucide-react v0.428.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xt=r("AlignEndVertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]),St=r("AlignHorizontalSpaceAround",[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]]),_t=r("AlignStartVertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]),Ot=r("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]),jt=r("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]),Et=r("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),Dt=r("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]),Ct=r("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),Nt=r("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),kt=r("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Rt=r("SquareArrowRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]),Pt=r("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);
/**
 * @license lucide-react v0.428.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */class Mt{static get INSTANCE(){const e="_marimo_private_RuntimeState";return window[e]||(window[e]=new Mt(o)),window[e]}constructor(e){this.uiElementRegistry=e,this.hasStarted=!1,this._sendComponentValues=void 0,this.handleReadyEvent=e=>{const t=e.detail.objectId;if(!this.uiElementRegistry.has(t))return;const n=this.uiElementRegistry.lookupValue(t);void 0!==n&&this.sendComponentValues({objectIds:[t],values:[n]}).catch((e=>{a.warn(e)}))}}get sendComponentValues(){if(!this._sendComponentValues)throw new Error("sendComponentValues is not set");return this._sendComponentValues}start(e){this.hasStarted?a.warn("RuntimeState already started"):(this._sendComponentValues=e,document.addEventListener(i.TYPE,this.handleReadyEvent),this.hasStarted=!0)}stop(){this.hasStarted?(document.removeEventListener(i.TYPE,this.handleReadyEvent),this.hasStarted=!1):a.warn("RuntimeState already stopped")}}var zt={exports:{}},Tt={},Lt={exports:{}};!function(e){function t(e){return function(t,n,r,o,a,i,s){return e(t,n,s)}}function n(e){return function(t,n,r,o){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r,o);var a=o.get(t),i=o.get(n);if(a&&i)return a===n&&i===t;o.set(t,n),o.set(n,t);var s=e(t,n,r,o);return o.delete(t),o.delete(n),s}}function r(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function o(e){return e.constructor===Object||null==e.constructor}function a(e){return"function"==typeof e.then}function i(e,t){return e===t||e!=e&&t!=t}var s="[object Arguments]",l="[object Boolean]",c="[object Date]",u="[object RegExp]",d="[object Map]",p="[object Number]",f="[object Object]",h="[object Set]",m="[object String]",g=Object.prototype.toString;function y(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,y=e.areObjectsEqual,b=e.areRegExpsEqual,v=e.areSetsEqual,w=(0,e.createIsNestedEqual)(x);function x(e,x,S){if(e===x)return!0;if(!e||!x||"object"!=typeof e||"object"!=typeof x)return e!=e&&x!=x;if(o(e)&&o(x))return y(e,x,w,S);var _=Array.isArray(e),O=Array.isArray(x);if(_||O)return _===O&&t(e,x,w,S);var j=g.call(e);return j===g.call(x)&&(j===c?n(e,x,w,S):j===u?b(e,x,w,S):j===d?r(e,x,w,S):j===h?v(e,x,w,S):j===f||j===s?!a(e)&&!a(x)&&y(e,x,w,S):(j===l||j===p||j===m)&&i(e.valueOf(),x.valueOf()))}return x}function b(e,t,n,r){var o=e.length;if(t.length!==o)return!1;for(;o-- >0;)if(!n(e[o],t[o],o,o,e,t,r))return!1;return!0}var v=n(b);function w(e,t){return i(e.valueOf(),t.valueOf())}function x(e,t,n,r){var o=e.size===t.size;if(!o)return!1;if(!e.size)return!0;var a={},i=0;return e.forEach((function(s,l){if(o){var c=!1,u=0;t.forEach((function(o,d){c||a[u]||!(c=n(l,d,i,u,e,t,r)&&n(s,o,l,d,e,t,r))||(a[u]=!0),u++})),i++,o=c}})),o}var S=n(x),_="_owner",O=Object.prototype.hasOwnProperty;function j(e,t,n,r){var o,a=Object.keys(e),i=a.length;if(Object.keys(t).length!==i)return!1;for(;i-- >0;){if((o=a[i])===_){var s=!!e.$$typeof,l=!!t.$$typeof;if((s||l)&&s!==l)return!1}if(!O.call(t,o)||!n(e[o],t[o],o,o,e,t,r))return!1}return!0}var E=n(j);function D(e,t){return e.source===t.source&&e.flags===t.flags}function C(e,t,n,r){var o=e.size===t.size;if(!o)return!1;if(!e.size)return!0;var a={};return e.forEach((function(i,s){if(o){var l=!1,c=0;t.forEach((function(o,u){l||a[c]||!(l=n(i,o,s,u,e,t,r))||(a[c]=!0),c++})),o=l}})),o}var N=n(C),k=Object.freeze({areArraysEqual:b,areDatesEqual:w,areMapsEqual:x,areObjectsEqual:j,areRegExpsEqual:D,areSetsEqual:C,createIsNestedEqual:t}),R=Object.freeze({areArraysEqual:v,areDatesEqual:w,areMapsEqual:S,areObjectsEqual:E,areRegExpsEqual:D,areSetsEqual:N,createIsNestedEqual:t}),P=y(k);function M(e,t){return P(e,t,void 0)}var z=y(r(k,{createIsNestedEqual:function(){return i}}));function T(e,t){return z(e,t,void 0)}var L=y(R);function I(e,t){return L(e,t,new WeakMap)}var H=y(r(R,{createIsNestedEqual:function(){return i}}));function A(e,t){return H(e,t,new WeakMap)}function W(e){return y(r(k,e(k)))}function q(e){var t=y(r(R,e(R)));return function(e,n,r){return void 0===r&&(r=new WeakMap),t(e,n,r)}}e.circularDeepEqual=I,e.circularShallowEqual=A,e.createCustomCircularEqual=q,e.createCustomEqual=W,e.deepEqual=M,e.sameValueZeroEqual=i,e.shallowEqual=T,Object.defineProperty(e,"__esModule",{value:!0})}(Lt.exports);var It=Lt.exports,Ht={exports:{}};function At(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=At(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Wt(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=At(e))&&(r&&(r+=" "),r+=t);return r}Ht.exports=Wt,Ht.exports.clsx=Wt;var qt=Ht.exports,Bt={};Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.bottom=Ut,Bt.childrenEqual=function(e,t){return(0,Ft.deepEqual)(Yt.default.Children.map(e,(e=>null==e?void 0:e.key)),Yt.default.Children.map(t,(e=>null==e?void 0:e.key)))&&(0,Ft.deepEqual)(Yt.default.Children.map(e,(e=>null==e?void 0:e.props["data-grid"])),Yt.default.Children.map(t,(e=>null==e?void 0:e.props["data-grid"])))},Bt.cloneLayout=Vt,Bt.cloneLayoutItem=$t,Bt.collides=Kt,Bt.compact=Qt,Bt.compactItem=en,Bt.compactType=function(e){const{verticalCompact:t,compactType:n}=e||{};return!1===t?null:n},Bt.correctBounds=tn,Bt.fastPositionEqual=function(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height},Bt.fastRGLPropsEqual=void 0,Bt.getAllCollisions=on,Bt.getFirstCollision=rn,Bt.getLayoutItem=nn,Bt.getStatics=an,Bt.modifyLayout=Xt,Bt.moveElement=sn,Bt.moveElementAwayFromCollision=ln,Bt.noop=void 0,Bt.perc=function(e){return 100*e+"%"},Bt.resizeItemInDirection=function(e,t,n,r){const o=yn[e];return o?o(t,{...t,...n},r):n},Bt.setTopLeft=function(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}},Bt.setTransform=function(e){let{top:t,left:n,width:r,height:o}=e;const a=`translate(${n}px,${t}px)`;return{transform:a,WebkitTransform:a,MozTransform:a,msTransform:a,OTransform:a,width:`${r}px`,height:`${o}px`,position:"absolute"}},Bt.sortLayoutItems=bn,Bt.sortLayoutItemsByColRow=wn,Bt.sortLayoutItemsByRowCol=vn,Bt.synchronizeLayoutWithChildren=function(e,t,n,r,o){e=e||[];const a=[];Yt.default.Children.forEach(t,(t=>{if(null==(null==t?void 0:t.key))return;const n=nn(e,String(t.key)),r=t.props["data-grid"];n&&null==r?a.push($t(n)):r?a.push($t({...r,i:t.key})):a.push($t({w:1,h:1,x:0,y:Ut(a),i:String(t.key)}))}));const i=tn(a,{cols:n});return o?i:Qt(i,r,n)},Bt.validateLayout=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const o=e[r];for(let e=0;e<n.length;e++)if("number"!=typeof o[n[e]])throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[e]+" must be a number!")}},Bt.withLayoutItem=function(e,t,n){let r=nn(e,t);return r?(r=n($t(r)),[e=Xt(e,r),r]):[e,null]};var Gt,Ft=It,Yt=(Gt=l)&&Gt.__esModule?Gt:{default:Gt};function Ut(e){let t,n=0;for(let r=0,o=e.length;r<o;r++)t=e[r].y+e[r].h,t>n&&(n=t);return n}function Vt(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=$t(e[n]);return t}function Xt(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function $t(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:Boolean(e.moved),static:Boolean(e.static),isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function Kt(e,t){return e.i!==t.i&&(!(e.x+e.w<=t.x)&&(!(e.x>=t.x+t.w)&&(!(e.y+e.h<=t.y)&&!(e.y>=t.y+t.h))))}function Qt(e,t,n,r){const o=an(e),a=bn(e,t),i=Array(e.length);for(let s=0,l=a.length;s<l;s++){let l=$t(a[s]);l.static||(l=en(o,l,t,n,a,r),o.push(l)),i[e.indexOf(a[s])]=l,l.moved=!1}return i}Bt.fastRGLPropsEqual=function(e,t,n){return e===t||e.className===t.className&&n(e.style,t.style)&&e.width===t.width&&e.autoSize===t.autoSize&&e.cols===t.cols&&e.draggableCancel===t.draggableCancel&&e.draggableHandle===t.draggableHandle&&n(e.verticalCompact,t.verticalCompact)&&n(e.compactType,t.compactType)&&n(e.layout,t.layout)&&n(e.margin,t.margin)&&n(e.containerPadding,t.containerPadding)&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.isBounded===t.isBounded&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.allowOverlap===t.allowOverlap&&e.preventCollision===t.preventCollision&&e.useCSSTransforms===t.useCSSTransforms&&e.transformScale===t.transformScale&&e.isDroppable===t.isDroppable&&n(e.resizeHandles,t.resizeHandles)&&n(e.resizeHandle,t.resizeHandle)&&e.onLayoutChange===t.onLayoutChange&&e.onDragStart===t.onDragStart&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResizeStart===t.onResizeStart&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.onDrop===t.onDrop&&n(e.droppingItem,t.droppingItem)&&n(e.innerRef,t.innerRef)};const Zt={x:"w",y:"h"};function Jt(e,t,n,r){const o=Zt[r];t[r]+=1;for(let a=e.map((e=>e.i)).indexOf(t.i)+1;a<e.length;a++){const i=e[a];if(!i.static){if(i.y>t.y+t.h)break;Kt(t,i)&&Jt(e,i,n+t[o],r)}}t[r]=n}function en(e,t,n,r,o,a){const i="horizontal"===n;if("vertical"===n)for(t.y=Math.min(Ut(e),t.y);t.y>0&&!rn(e,t);)t.y--;else if(i)for(;t.x>0&&!rn(e,t);)t.x--;let s;for(;(s=rn(e,t))&&(null!==n||!a);)if(i?Jt(o,t,s.x+s.w,"x"):Jt(o,t,s.y+s.h,"y"),i&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!rn(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function tn(e,t){const n=an(e);for(let r=0,o=e.length;r<o;r++){const o=e[r];if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),o.static)for(;rn(n,o);)o.y++;else n.push(o)}return e}function nn(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function rn(e,t){for(let n=0,r=e.length;n<r;n++)if(Kt(e[n],t))return e[n]}function on(e,t){return e.filter((e=>Kt(e,t)))}function an(e){return e.filter((e=>e.static))}function sn(e,t,n,r,o,a,i,s,l){if(t.static&&!0!==t.isDraggable)return e;if(t.y===r&&t.x===n)return e;t.i,String(n),String(r),t.x,t.y;const c=t.x,u=t.y;"number"==typeof n&&(t.x=n),"number"==typeof r&&(t.y=r),t.moved=!0;let d=bn(e,i);("vertical"===i&&"number"==typeof r?u>=r:"horizontal"===i&&"number"==typeof n&&c>=n)&&(d=d.reverse());const p=on(d,t),f=p.length>0;if(f&&l)return Vt(e);if(f&&a)return t.i,t.x=c,t.y=u,t.moved=!1,e;for(let h=0,m=p.length;h<m;h++){const n=p[h];t.i,t.x,t.y,n.i,n.x,n.y,n.moved||(e=n.static?ln(e,n,t,o,i):ln(e,t,n,o,i))}return e}function ln(e,t,n,r,o,a){const i="horizontal"===o,s="vertical"===o,l=t.static;if(r){r=!1;const a={x:i?Math.max(t.x-n.w,0):n.x,y:s?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},c=rn(e,a),u=c&&c.y+c.h>t.y,d=c&&t.x+t.w>c.x;if(!c)return n.i,a.x,a.y,sn(e,n,i?a.x:void 0,s?a.y:void 0,r,l,o);if(u&&s)return sn(e,n,void 0,t.y+1,r,l,o);if(u&&null==o)return t.y=n.y,n.y=n.y+n.h,e;if(d&&i)return sn(e,t,n.x,void 0,r,l,o)}const c=i?n.x+1:void 0,u=s?n.y+1:void 0;return null==c&&null==u?e:sn(e,n,i?n.x+1:void 0,s?n.y+1:void 0,r,l,o)}const cn=(e,t,n,r)=>e+n>r?t:n,un=(e,t,n)=>e<0?t:n,dn=e=>Math.max(0,e),pn=e=>Math.max(0,e),fn=(e,t,n)=>{let{left:r,height:o,width:a}=t;const i=e.top-(o-e.height);return{left:r,width:a,height:un(i,e.height,o),top:pn(i)}},hn=(e,t,n)=>{let{top:r,left:o,height:a,width:i}=t;return{top:r,height:a,width:cn(e.left,e.width,i,n),left:dn(o)}},mn=(e,t,n)=>{let{top:r,height:o,width:a}=t;const i=e.left-(a-e.width);return{height:o,width:i<0?e.width:cn(e.left,e.width,a,n),top:pn(r),left:dn(i)}},gn=(e,t,n)=>{let{top:r,left:o,height:a,width:i}=t;return{width:i,left:o,height:un(r,e.height,a),top:pn(r)}},yn={n:fn,ne:function(){return fn(arguments.length<=0?void 0:arguments[0],hn(...arguments))},e:hn,se:function(){return gn(arguments.length<=0?void 0:arguments[0],hn(...arguments))},s:gn,sw:function(){return gn(arguments.length<=0?void 0:arguments[0],mn(...arguments))},w:mn,nw:function(){return fn(arguments.length<=0?void 0:arguments[0],mn(...arguments))}};function bn(e,t){return"horizontal"===t?wn(e):"vertical"===t?vn(e):e}function vn(e){return e.slice(0).sort((function(e,t){return e.y>t.y||e.y===t.y&&e.x>t.x?1:e.y===t.y&&e.x===t.x?0:-1}))}function wn(e){return e.slice(0).sort((function(e,t){return e.x>t.x||e.x===t.x&&e.y>t.y?1:-1}))}Bt.noop=()=>{};var xn={};function Sn(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-2*n[0])/o}function _n(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function On(e,t,n){return Math.max(Math.min(e,n),t)}Object.defineProperty(xn,"__esModule",{value:!0}),xn.calcGridColWidth=Sn,xn.calcGridItemPosition=function(e,t,n,r,o,a){const{margin:i,containerPadding:s,rowHeight:l}=e,c=Sn(e),u={};a&&a.resizing?(u.width=Math.round(a.resizing.width),u.height=Math.round(a.resizing.height)):(u.width=_n(r,c,i[0]),u.height=_n(o,l,i[1]));a&&a.dragging?(u.top=Math.round(a.dragging.top),u.left=Math.round(a.dragging.left)):a&&a.resizing&&"number"==typeof a.resizing.top&&"number"==typeof a.resizing.left?(u.top=Math.round(a.resizing.top),u.left=Math.round(a.resizing.left)):(u.top=Math.round((l+i[1])*n+s[1]),u.left=Math.round((c+i[0])*t+s[0]));return u},xn.calcGridItemWHPx=_n,xn.calcWH=function(e,t,n,r,o,a){const{margin:i,maxRows:s,cols:l,rowHeight:c}=e,u=Sn(e);let d=Math.round((t+i[0])/(u+i[0])),p=Math.round((n+i[1])/(c+i[1])),f=On(d,0,l-r),h=On(p,0,s-o);-1!==["sw","w","nw"].indexOf(a)&&(f=On(d,0,l));-1!==["nw","n","ne"].indexOf(a)&&(h=On(p,0,s));return{w:f,h:h}},xn.calcXY=function(e,t,n,r,o){const{margin:a,cols:i,rowHeight:s,maxRows:l}=e,c=Sn(e);let u=Math.round((n-a[0])/(c+a[0])),d=Math.round((t-a[1])/(s+a[1]));return u=On(u,0,i-r),d=On(d,0,l-o),{x:u,y:d}},xn.clamp=On;var jn={},En={exports:{}},Dn={};function Cn(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Cn(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Nn(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Cn(e))&&(r&&(r+=" "),r+=t);return r}const kn=c(Object.freeze(Object.defineProperty({__proto__:null,clsx:Nn,default:Nn},Symbol.toStringTag,{value:"Module"})));var Rn={},Pn={};Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.dontSetMe=function(e,t,n){if(e[t])return new Error("Invalid prop ".concat(t," passed to ").concat(n," - do not set this, set it on the child."))},Pn.findInArray=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t.apply(t,[e[n],n,e]))return e[n]},Pn.int=function(e){return parseInt(e,10)},Pn.isFunction=function(e){return"function"==typeof e||"[object Function]"===Object.prototype.toString.call(e)},Pn.isNum=function(e){return"number"==typeof e&&!isNaN(e)};var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.browserPrefixToKey=Ln,Mn.browserPrefixToStyle=function(e,t){return t?"-".concat(t.toLowerCase(),"-").concat(e):e},Mn.default=void 0,Mn.getPrefix=Tn;var zn=["Moz","Webkit","O","ms"];function Tn(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window)return"";var r=null===(e=window.document)||void 0===e||null===(t=e.documentElement)||void 0===t?void 0:t.style;if(!r)return"";if(n in r)return"";for(var o=0;o<zn.length;o++)if(Ln(n,zn[o])in r)return zn[o];return""}function Ln(e,t){return t?"".concat(t).concat(function(e){for(var t="",n=!0,r=0;r<e.length;r++)n?(t+=e[r].toUpperCase(),n=!1):"-"===e[r]?n=!0:t+=e[r];return t}(e)):e}var In=Tn();function Hn(e){return(Hn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Mn.default=In,Object.defineProperty(Rn,"__esModule",{value:!0}),Rn.addClassName=Xn,Rn.addEvent=function(e,t,n,r){if(!e)return;var o=Gn({capture:!0},r);e.addEventListener?e.addEventListener(t,n,o):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},Rn.addUserSelectStyles=function(e){if(!e)return;var t=e.getElementById("react-draggable-style-el");t||((t=e.createElement("style")).type="text/css",t.id="react-draggable-style-el",t.innerHTML=".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n",t.innerHTML+=".react-draggable-transparent-selection *::selection {all: inherit;}\n",e.getElementsByTagName("head")[0].appendChild(t));e.body&&Xn(e.body,"react-draggable-transparent-selection")},Rn.createCSSTransform=function(e,t){var n=Vn(e,t,"px");return Fn({},(0,Wn.browserPrefixToKey)("transform",Wn.default),n)},Rn.createSVGTransform=function(e,t){return Vn(e,t,"")},Rn.getTouch=function(e,t){return e.targetTouches&&(0,An.findInArray)(e.targetTouches,(function(e){return t===e.identifier}))||e.changedTouches&&(0,An.findInArray)(e.changedTouches,(function(e){return t===e.identifier}))},Rn.getTouchIdentifier=function(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier},Rn.getTranslation=Vn,Rn.innerHeight=function(e){var t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,An.int)(n.paddingTop),t-=(0,An.int)(n.paddingBottom)},Rn.innerWidth=function(e){var t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=(0,An.int)(n.paddingLeft),t-=(0,An.int)(n.paddingRight)},Rn.matchesSelector=Un,Rn.matchesSelectorAndParentsTo=function(e,t,n){var r=e;do{if(Un(r,t))return!0;if(r===n)return!1;r=r.parentNode}while(r);return!1},Rn.offsetXYFromParent=function(e,t,n){var r=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),o=(e.clientX+t.scrollLeft-r.left)/n,a=(e.clientY+t.scrollTop-r.top)/n;return{x:o,y:a}},Rn.outerHeight=function(e){var t=e.clientHeight,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,An.int)(n.borderTopWidth),t+=(0,An.int)(n.borderBottomWidth)},Rn.outerWidth=function(e){var t=e.clientWidth,n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=(0,An.int)(n.borderLeftWidth),t+=(0,An.int)(n.borderRightWidth)},Rn.removeClassName=$n,Rn.removeEvent=function(e,t,n,r){if(!e)return;var o=Gn({capture:!0},r);e.removeEventListener?e.removeEventListener(t,n,o):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},Rn.removeUserSelectStyles=function(e){if(!e)return;try{if(e.body&&$n(e.body,"react-draggable-transparent-selection"),e.selection)e.selection.empty();else{var t=(e.defaultView||window).getSelection();t&&"Caret"!==t.type&&t.removeAllRanges()}}catch(n){}};var An=Pn,Wn=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==Hn(e)&&"function"!=typeof e)return{default:e};var n=qn(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(Mn);function qn(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(qn=function(e){return e?n:t})(e)}function Bn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Gn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bn(Object(n),!0).forEach((function(t){Fn(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bn(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Yn="";function Un(e,t){return Yn||(Yn=(0,An.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],(function(t){return(0,An.isFunction)(e[t])}))),!!(0,An.isFunction)(e[Yn])&&e[Yn](t)}function Vn(e,t,n){var r=e.x,o=e.y,a="translate(".concat(r).concat(n,",").concat(o).concat(n,")");if(t){var i="".concat("string"==typeof t.x?t.x:t.x+n),s="".concat("string"==typeof t.y?t.y:t.y+n);a="translate(".concat(i,", ").concat(s,")")+a}return a}function Xn(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(e.className+=" ".concat(t))}function $n(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.canDragX=function(e){return"both"===e.props.axis||"x"===e.props.axis},Kn.canDragY=function(e){return"both"===e.props.axis||"y"===e.props.axis},Kn.createCoreData=function(e,t,n){var r=e.state,o=!(0,Qn.isNum)(r.lastX),a=Jn(e);return o?{node:a,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:a,deltaX:t-r.lastX,deltaY:n-r.lastY,lastX:r.lastX,lastY:r.lastY,x:t,y:n}},Kn.createDraggableData=function(e,t){var n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}},Kn.getBoundPosition=function(e,t,n){if(!e.props.bounds)return[t,n];var r=e.props.bounds;r="string"==typeof r?r:function(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}(r);var o=Jn(e);if("string"==typeof r){var a,i=o.ownerDocument,s=i.defaultView;if(!((a="parent"===r?o.parentNode:i.querySelector(r))instanceof s.HTMLElement))throw new Error('Bounds selector "'+r+'" could not find an element.');var l=a,c=s.getComputedStyle(o),u=s.getComputedStyle(l);r={left:-o.offsetLeft+(0,Qn.int)(u.paddingLeft)+(0,Qn.int)(c.marginLeft),top:-o.offsetTop+(0,Qn.int)(u.paddingTop)+(0,Qn.int)(c.marginTop),right:(0,Zn.innerWidth)(l)-(0,Zn.outerWidth)(o)-o.offsetLeft+(0,Qn.int)(u.paddingRight)-(0,Qn.int)(c.marginRight),bottom:(0,Zn.innerHeight)(l)-(0,Zn.outerHeight)(o)-o.offsetTop+(0,Qn.int)(u.paddingBottom)-(0,Qn.int)(c.marginBottom)}}(0,Qn.isNum)(r.right)&&(t=Math.min(t,r.right));(0,Qn.isNum)(r.bottom)&&(n=Math.min(n,r.bottom));(0,Qn.isNum)(r.left)&&(t=Math.max(t,r.left));(0,Qn.isNum)(r.top)&&(n=Math.max(n,r.top));return[t,n]},Kn.getControlPosition=function(e,t,n){var r="number"==typeof t?(0,Zn.getTouch)(e,t):null;if("number"==typeof t&&!r)return null;var o=Jn(n),a=n.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,Zn.offsetXYFromParent)(r||e,a,n.props.scale)},Kn.snapToGrid=function(e,t,n){var r=Math.round(t/e[0])*e[0],o=Math.round(n/e[1])*e[1];return[r,o]};var Qn=Pn,Zn=Rn;function Jn(e){var t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var er={},tr={};function nr(e){return(nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(tr,"__esModule",{value:!0}),tr.default=function(){},Object.defineProperty(er,"__esModule",{value:!0}),er.default=void 0;var rr=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==nr(e)&&"function"!=typeof e)return{default:e};var n=dr(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(l),or=ur(u),ar=ur(d),ir=Rn,sr=Kn,lr=Pn,cr=ur(tr);function ur(e){return e&&e.__esModule?e:{default:e}}function dr(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(dr=function(e){return e?n:t})(e)}function pr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,a=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(l){s=!0,o=l}finally{try{i||null==n.return||n.return()}finally{if(s)throw o}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return fr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fr(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function hr(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function mr(e,t){return(mr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function gr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=br(e);if(t){var o=br(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===nr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return yr(e)}(this,n)}}function yr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function br(e){return(br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function vr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wr={start:"touchstart",move:"touchmove",stop:"touchend"},xr={start:"mousedown",move:"mousemove",stop:"mouseup"},Sr=xr,_r=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&mr(e,t)}(t,rr.Component);var e=gr(t);function t(){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return vr(yr(n=e.call.apply(e,[this].concat(o))),"state",{dragging:!1,lastX:NaN,lastY:NaN,touchIdentifier:null}),vr(yr(n),"mounted",!1),vr(yr(n),"handleDragStart",(function(e){if(n.props.onMouseDown(e),!n.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;var t=n.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");var r=t.ownerDocument;if(!(n.props.disabled||!(e.target instanceof r.defaultView.Node)||n.props.handle&&!(0,ir.matchesSelectorAndParentsTo)(e.target,n.props.handle,t)||n.props.cancel&&(0,ir.matchesSelectorAndParentsTo)(e.target,n.props.cancel,t))){"touchstart"===e.type&&e.preventDefault();var o=(0,ir.getTouchIdentifier)(e);n.setState({touchIdentifier:o});var a=(0,sr.getControlPosition)(e,o,yr(n));if(null!=a){var i=a.x,s=a.y,l=(0,sr.createCoreData)(yr(n),i,s);(0,cr.default)("DraggableCore: handleDragStart: %j",l),(0,cr.default)("calling",n.props.onStart),!1!==n.props.onStart(e,l)&&!1!==n.mounted&&(n.props.enableUserSelectHack&&(0,ir.addUserSelectStyles)(r),n.setState({dragging:!0,lastX:i,lastY:s}),(0,ir.addEvent)(r,Sr.move,n.handleDrag),(0,ir.addEvent)(r,Sr.stop,n.handleDragStop))}}})),vr(yr(n),"handleDrag",(function(e){var t=(0,sr.getControlPosition)(e,n.state.touchIdentifier,yr(n));if(null!=t){var r=t.x,o=t.y;if(Array.isArray(n.props.grid)){var a=r-n.state.lastX,i=o-n.state.lastY,s=pr((0,sr.snapToGrid)(n.props.grid,a,i),2);if(a=s[0],i=s[1],!a&&!i)return;r=n.state.lastX+a,o=n.state.lastY+i}var l=(0,sr.createCoreData)(yr(n),r,o);if((0,cr.default)("DraggableCore: handleDrag: %j",l),!1!==n.props.onDrag(e,l)&&!1!==n.mounted)n.setState({lastX:r,lastY:o});else try{n.handleDragStop(new MouseEvent("mouseup"))}catch(u){var c=document.createEvent("MouseEvents");c.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),n.handleDragStop(c)}}})),vr(yr(n),"handleDragStop",(function(e){if(n.state.dragging){var t=(0,sr.getControlPosition)(e,n.state.touchIdentifier,yr(n));if(null!=t){var r=t.x,o=t.y;if(Array.isArray(n.props.grid)){var a=r-n.state.lastX||0,i=o-n.state.lastY||0,s=pr((0,sr.snapToGrid)(n.props.grid,a,i),2);a=s[0],i=s[1],r=n.state.lastX+a,o=n.state.lastY+i}var l=(0,sr.createCoreData)(yr(n),r,o);if(!1===n.props.onStop(e,l)||!1===n.mounted)return!1;var c=n.findDOMNode();c&&n.props.enableUserSelectHack&&(0,ir.removeUserSelectStyles)(c.ownerDocument),(0,cr.default)("DraggableCore: handleDragStop: %j",l),n.setState({dragging:!1,lastX:NaN,lastY:NaN}),c&&((0,cr.default)("DraggableCore: Removing handlers"),(0,ir.removeEvent)(c.ownerDocument,Sr.move,n.handleDrag),(0,ir.removeEvent)(c.ownerDocument,Sr.stop,n.handleDragStop))}}})),vr(yr(n),"onMouseDown",(function(e){return Sr=xr,n.handleDragStart(e)})),vr(yr(n),"onMouseUp",(function(e){return Sr=xr,n.handleDragStop(e)})),vr(yr(n),"onTouchStart",(function(e){return Sr=wr,n.handleDragStart(e)})),vr(yr(n),"onTouchEnd",(function(e){return Sr=wr,n.handleDragStop(e)})),n}return hr(t,[{key:"componentDidMount",value:function(){this.mounted=!0;var e=this.findDOMNode();e&&(0,ir.addEvent)(e,wr.start,this.onTouchStart,{passive:!1})}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var e=this.findDOMNode();if(e){var t=e.ownerDocument;(0,ir.removeEvent)(t,xr.move,this.handleDrag),(0,ir.removeEvent)(t,wr.move,this.handleDrag),(0,ir.removeEvent)(t,xr.stop,this.handleDragStop),(0,ir.removeEvent)(t,wr.stop,this.handleDragStop),(0,ir.removeEvent)(e,wr.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,ir.removeUserSelectStyles)(t)}}},{key:"findDOMNode",value:function(){var e,t,n;return null!==(e=this.props)&&void 0!==e&&e.nodeRef?null===(t=this.props)||void 0===t||null===(n=t.nodeRef)||void 0===n?void 0:n.current:ar.default.findDOMNode(this)}},{key:"render",value:function(){return rr.cloneElement(rr.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}]),t}();er.default=_r,vr(_r,"displayName","DraggableCore"),vr(_r,"propTypes",{allowAnyClick:or.default.bool,disabled:or.default.bool,enableUserSelectHack:or.default.bool,offsetParent:function(e,t){if(e[t]&&1!==e[t].nodeType)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:or.default.arrayOf(or.default.number),handle:or.default.string,cancel:or.default.string,nodeRef:or.default.object,onStart:or.default.func,onDrag:or.default.func,onStop:or.default.func,onMouseDown:or.default.func,scale:or.default.number,className:lr.dontSetMe,style:lr.dontSetMe,transform:lr.dontSetMe}),vr(_r,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DraggableCore",{enumerable:!0,get:function(){return p.default}}),e.default=void 0;var n=function(e,n){if(e&&e.__esModule)return e;if(null===e||"object"!==t(e)&&"function"!=typeof e)return{default:e};var r=g(n);if(r&&r.has(e))return r.get(e);var o={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=a?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(o,i,s):o[i]=e[i]}o.default=e,r&&r.set(e,o);return o}(l),r=m(u),o=m(d),a=m(kn),i=Rn,s=Kn,c=Pn,p=m(er),f=m(tr),h=["axis","bounds","children","defaultPosition","defaultClassName","defaultClassNameDragging","defaultClassNameDragged","position","positionOffset","scale"];function m(e){return e&&e.__esModule?e:{default:e}}function g(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(g=function(e){return e?n:t})(e)}function y(){return y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},y.apply(this,arguments)}function b(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){C(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,a=[],i=!0,s=!1;try{for(n=n.call(e);!(i=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(l){s=!0,o=l}finally{try{i||null==n.return||n.return()}finally{if(s)throw o}}return a}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=D(e);if(n){var a=D(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return function(e,n){if(n&&("object"===t(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return E(e)}(this,r)}}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}(u,e);var t,r,l,c=j(u);function u(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),C(E(t=c.call(this,e)),"onDragStart",(function(e,n){if((0,f.default)("Draggable: onDragStart: %j",n),!1===t.props.onStart(e,(0,s.createDraggableData)(E(t),n)))return!1;t.setState({dragging:!0,dragged:!0})})),C(E(t),"onDrag",(function(e,n){if(!t.state.dragging)return!1;(0,f.default)("Draggable: onDrag: %j",n);var r=(0,s.createDraggableData)(E(t),n),o={x:r.x,y:r.y};if(t.props.bounds){var a=o.x,i=o.y;o.x+=t.state.slackX,o.y+=t.state.slackY;var l=x((0,s.getBoundPosition)(E(t),o.x,o.y),2),c=l[0],u=l[1];o.x=c,o.y=u,o.slackX=t.state.slackX+(a-o.x),o.slackY=t.state.slackY+(i-o.y),r.x=o.x,r.y=o.y,r.deltaX=o.x-t.state.x,r.deltaY=o.y-t.state.y}if(!1===t.props.onDrag(e,r))return!1;t.setState(o)})),C(E(t),"onDragStop",(function(e,n){if(!t.state.dragging)return!1;if(!1===t.props.onStop(e,(0,s.createDraggableData)(E(t),n)))return!1;(0,f.default)("Draggable: onDragStop: %j",n);var r={dragging:!1,slackX:0,slackY:0};if(Boolean(t.props.position)){var o=t.props.position,a=o.x,i=o.y;r.x=a,r.y=i}t.setState(r)})),t.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:w({},e.position),slackX:0,slackY:0,isElementSVG:!1},!e.position||e.onDrag||e.onStop||console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element."),t}return t=u,l=[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.position,r=t.prevPropsPosition;return!n||r&&n.x===r.x&&n.y===r.y?null:((0,f.default)("Draggable: getDerivedStateFromProps %j",{position:n,prevPropsPosition:r}),{x:n.x,y:n.y,prevPropsPosition:w({},n)})}}],(r=[{key:"componentDidMount",value:function(){void 0!==window.SVGElement&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"findDOMNode",value:function(){var e,t,n;return null!==(e=null===(t=this.props)||void 0===t||null===(n=t.nodeRef)||void 0===n?void 0:n.current)&&void 0!==e?e:o.default.findDOMNode(this)}},{key:"render",value:function(){var e,t=this.props;t.axis,t.bounds;var r=t.children,o=t.defaultPosition,l=t.defaultClassName,c=t.defaultClassNameDragging,u=t.defaultClassNameDragged,d=t.position,f=t.positionOffset;t.scale;var m=b(t,h),g={},v=null,x=!Boolean(d)||this.state.dragging,S=d||o,_={x:(0,s.canDragX)(this)&&x?this.state.x:S.x,y:(0,s.canDragY)(this)&&x?this.state.y:S.y};this.state.isElementSVG?v=(0,i.createSVGTransform)(_,f):g=(0,i.createCSSTransform)(_,f);var O=(0,a.default)(r.props.className||"",l,(C(e={},c,this.state.dragging),C(e,u,this.state.dragged),e));return n.createElement(p.default,y({},m,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),n.cloneElement(n.Children.only(r),{className:O,style:w(w({},r.props.style),g),transform:v}))}}])&&_(t.prototype,r),l&&_(t,l),Object.defineProperty(t,"prototype",{writable:!1}),u}(n.Component);e.default=N,C(N,"displayName","Draggable"),C(N,"propTypes",w(w({},p.default.propTypes),{},{axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:c.dontSetMe,style:c.dontSetMe,transform:c.dontSetMe})),C(N,"defaultProps",w(w({},p.default.defaultProps),{},{axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1}))}(Dn);var Or=Dn.default,jr=Dn.DraggableCore;En.exports=Or,En.exports.default=Or,En.exports.DraggableCore=jr;var Er=En.exports,Dr={exports:{}},Cr={},Nr={__esModule:!0,cloneElement:function(e,t){t.style&&e.props.style&&(t.style=Pr(Pr({},e.props.style),t.style));t.className&&e.props.className&&(t.className=e.props.className+" "+t.className);return kr.default.cloneElement(e,t)}},kr=function(e){return e&&e.__esModule?e:{default:e}}(l);function Rr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Pr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rr(Object(n),!0).forEach((function(t){Mr(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Mr(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var zr={__esModule:!0,resizableProps:void 0},Tr=function(e){return e&&e.__esModule?e:{default:e}}(u);var Lr={axis:Tr.default.oneOf(["both","x","y","none"]),className:Tr.default.string,children:Tr.default.element.isRequired,draggableOpts:Tr.default.shape({allowAnyClick:Tr.default.bool,cancel:Tr.default.string,children:Tr.default.node,disabled:Tr.default.bool,enableUserSelectHack:Tr.default.bool,offsetParent:Tr.default.node,grid:Tr.default.arrayOf(Tr.default.number),handle:Tr.default.string,nodeRef:Tr.default.object,onStart:Tr.default.func,onDrag:Tr.default.func,onStop:Tr.default.func,onMouseDown:Tr.default.func,scale:Tr.default.number}),height:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,o=t[0];return"both"===o.axis||"y"===o.axis?(r=Tr.default.number).isRequired.apply(r,t):Tr.default.number.apply(Tr.default,t)},handle:Tr.default.oneOfType([Tr.default.node,Tr.default.func]),handleSize:Tr.default.arrayOf(Tr.default.number),lockAspectRatio:Tr.default.bool,maxConstraints:Tr.default.arrayOf(Tr.default.number),minConstraints:Tr.default.arrayOf(Tr.default.number),onResizeStop:Tr.default.func,onResizeStart:Tr.default.func,onResize:Tr.default.func,resizeHandles:Tr.default.arrayOf(Tr.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:Tr.default.number,width:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,o=t[0];return"both"===o.axis||"x"===o.axis?(r=Tr.default.number).isRequired.apply(r,t):Tr.default.number.apply(Tr.default,t)}};zr.resizableProps=Lr,Cr.__esModule=!0,Cr.default=void 0;var Ir=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=Br(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(l),Hr=Er,Ar=Nr,Wr=zr,qr=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function Br(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Br=function(e){return e?n:t})(e)}function Gr(){return Gr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Gr.apply(this,arguments)}function Fr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fr(Object(n),!0).forEach((function(t){Ur(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fr(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ur(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vr(e,t){return(Vr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var Xr=function(e){var t,n;function r(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).handleRefs={},t.lastHandleRect=null,t.slack=null,t}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,Vr(t,n);var o=r.prototype;return o.componentWillUnmount=function(){this.resetData()},o.resetData=function(){this.lastHandleRect=this.slack=null},o.runConstraints=function(e,t){var n=this.props,r=n.minConstraints,o=n.maxConstraints,a=n.lockAspectRatio;if(!r&&!o&&!a)return[e,t];if(a){var i=this.props.width/this.props.height,s=e-this.props.width,l=t-this.props.height;Math.abs(s)>Math.abs(l*i)?t=e/i:e=t*i}var c=e,u=t,d=this.slack||[0,0],p=d[0],f=d[1];return e+=p,t+=f,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),o&&(e=Math.min(o[0],e),t=Math.min(o[1],t)),this.slack=[p+(c-e),f+(u-t)],[e,t]},o.resizeHandler=function(e,t){var n=this;return function(r,o){var a=o.node,i=o.deltaX,s=o.deltaY;"onResizeStart"===e&&n.resetData();var l=("both"===n.props.axis||"x"===n.props.axis)&&"n"!==t&&"s"!==t,c=("both"===n.props.axis||"y"===n.props.axis)&&"e"!==t&&"w"!==t;if(l||c){var u=t[0],d=t[t.length-1],p=a.getBoundingClientRect();if(null!=n.lastHandleRect){if("w"===d)i+=p.left-n.lastHandleRect.left;if("n"===u)s+=p.top-n.lastHandleRect.top}n.lastHandleRect=p,"w"===d&&(i=-i),"n"===u&&(s=-s);var f=n.props.width+(l?i/n.props.transformScale:0),h=n.props.height+(c?s/n.props.transformScale:0),m=n.runConstraints(f,h);f=m[0],h=m[1];var g=f!==n.props.width||h!==n.props.height,y="function"==typeof n.props[e]?n.props[e]:null;y&&!("onResize"===e&&!g)&&(null==r.persist||r.persist(),y(r,{node:a,size:{width:f,height:h},handle:t})),"onResizeStop"===e&&n.resetData()}}},o.renderResizeHandle=function(e,t){var n=this.props.handle;if(!n)return Ir.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+e,ref:t});if("function"==typeof n)return n(e,t);var r=Yr({ref:t},"string"==typeof n.type?{}:{handleAxis:e});return Ir.cloneElement(n,r)},o.render=function(){var e=this,t=this.props,n=t.children,r=t.className,o=t.draggableOpts;t.width,t.height,t.handle,t.handleSize,t.lockAspectRatio,t.axis,t.minConstraints,t.maxConstraints,t.onResize,t.onResizeStop,t.onResizeStart;var a=t.resizeHandles;t.transformScale;var i=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(t,qr);return(0,Ar.cloneElement)(n,Yr(Yr({},i),{},{className:(r?r+" ":"")+"react-resizable",children:[].concat(n.props.children,a.map((function(t){var n,r=null!=(n=e.handleRefs[t])?n:e.handleRefs[t]=Ir.createRef();return Ir.createElement(Hr.DraggableCore,Gr({},o,{nodeRef:r,key:"resizableHandle-"+t,onStop:e.resizeHandler("onResizeStop",t),onStart:e.resizeHandler("onResizeStart",t),onDrag:e.resizeHandler("onResize",t)}),e.renderResizeHandle(t,r))})))}))},r}(Ir.Component);Cr.default=Xr,Xr.propTypes=Wr.resizableProps,Xr.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1};var $r={__esModule:!0,default:void 0},Kr=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=no(t);if(n&&n.has(e))return n.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(l),Qr=to(u),Zr=to(Cr),Jr=zr,eo=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function to(e){return e&&e.__esModule?e:{default:e}}function no(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(no=function(e){return e?n:t})(e)}function ro(){return ro=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ro.apply(this,arguments)}function oo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ao(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oo(Object(n),!0).forEach((function(t){io(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oo(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function io(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function so(e,t){return(so=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var lo=function(e){var t,n;function r(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).state={width:t.props.width,height:t.props.height,propsWidth:t.props.width,propsHeight:t.props.height},t.onResize=function(e,n){var r=n.size;t.props.onResize?(null==e.persist||e.persist(),t.setState(r,(function(){return t.props.onResize&&t.props.onResize(e,n)}))):t.setState(r)},t}return n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,so(t,n),r.getDerivedStateFromProps=function(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null},r.prototype.render=function(){var e=this.props,t=e.handle,n=e.handleSize;e.onResize;var r=e.onResizeStart,o=e.onResizeStop,a=e.draggableOpts,i=e.minConstraints,s=e.maxConstraints,l=e.lockAspectRatio,c=e.axis;e.width,e.height;var u=e.resizeHandles,d=e.style,p=e.transformScale,f=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,eo);return Kr.createElement(Zr.default,{axis:c,draggableOpts:a,handle:t,handleSize:n,height:this.state.height,lockAspectRatio:l,maxConstraints:s,minConstraints:i,onResizeStart:r,onResize:this.onResize,onResizeStop:o,resizeHandles:u,transformScale:p,width:this.state.width},Kr.createElement("div",ro({},f,{style:ao(ao({},d),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},r}(Kr.Component);$r.default=lo,lo.propTypes=ao(ao({},Jr.resizableProps),{},{children:Qr.default.element}),Dr.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},Dr.exports.Resizable=Cr.default,Dr.exports.ResizableBox=$r.default;var co=Dr.exports,uo={};Object.defineProperty(uo,"__esModule",{value:!0}),uo.resizeHandleType=uo.resizeHandleAxesType=uo.default=void 0;var po=ho(u),fo=ho(l);function ho(e){return e&&e.__esModule?e:{default:e}}const mo=uo.resizeHandleAxesType=po.default.arrayOf(po.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),go=uo.resizeHandleType=po.default.oneOfType([po.default.node,po.default.func]);uo.default={className:po.default.string,style:po.default.object,width:po.default.number,autoSize:po.default.bool,cols:po.default.number,draggableCancel:po.default.string,draggableHandle:po.default.string,verticalCompact:function(e){e.verticalCompact,0},compactType:po.default.oneOf(["vertical","horizontal"]),layout:function(e){var t=e.layout;void 0!==t&&Bt.validateLayout(t,"layout")},margin:po.default.arrayOf(po.default.number),containerPadding:po.default.arrayOf(po.default.number),rowHeight:po.default.number,maxRows:po.default.number,isBounded:po.default.bool,isDraggable:po.default.bool,isResizable:po.default.bool,allowOverlap:po.default.bool,preventCollision:po.default.bool,useCSSTransforms:po.default.bool,transformScale:po.default.number,isDroppable:po.default.bool,resizeHandles:mo,resizeHandle:go,onLayoutChange:po.default.func,onDragStart:po.default.func,onDrag:po.default.func,onDragStop:po.default.func,onResizeStart:po.default.func,onResize:po.default.func,onResizeStop:po.default.func,onDrop:po.default.func,droppingItem:po.default.shape({i:po.default.string.isRequired,w:po.default.number.isRequired,h:po.default.number.isRequired}),children:function(e,t){const n=e[t],r={};fo.default.Children.forEach(n,(function(e){if(null!=(null==e?void 0:e.key)){if(r[e.key])throw new Error('Duplicate child key "'+e.key+'" found! This will cause problems in ReactGridLayout.');r[e.key]=!0}}))},innerRef:po.default.any},Object.defineProperty(jn,"__esModule",{value:!0}),jn.default=void 0;var yo=jo(l),bo=jo(u),vo=Er,wo=co,xo=Bt,So=xn,_o=uo,Oo=jo(qt);function jo(e){return e&&e.__esModule?e:{default:e}}function Eo(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Do extends yo.default.Component{constructor(){super(...arguments),Eo(this,"state",{resizing:null,dragging:null,className:""}),Eo(this,"elementRef",yo.default.createRef()),Eo(this,"onDragStart",((e,t)=>{let{node:n}=t;const{onDragStart:r,transformScale:o}=this.props;if(!r)return;const a={top:0,left:0},{offsetParent:i}=n;if(!i)return;const s=i.getBoundingClientRect(),l=n.getBoundingClientRect(),c=l.left/o,u=s.left/o,d=l.top/o,p=s.top/o;a.left=c-u+i.scrollLeft,a.top=d-p+i.scrollTop,this.setState({dragging:a});const{x:f,y:h}=(0,So.calcXY)(this.getPositionParams(),a.top,a.left,this.props.w,this.props.h);return r.call(this,this.props.i,f,h,{e:e,node:n,newPosition:a})})),Eo(this,"onDrag",((e,t)=>{let{node:n,deltaX:r,deltaY:o}=t;const{onDrag:a}=this.props;if(!a)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let i=this.state.dragging.top+o,s=this.state.dragging.left+r;const{isBounded:l,i:c,w:u,h:d,containerWidth:p}=this.props,f=this.getPositionParams();if(l){const{offsetParent:e}=n;if(e){const{margin:t,rowHeight:n,containerPadding:r}=this.props,o=e.clientHeight-(0,So.calcGridItemWHPx)(d,n,t[1]);i=(0,So.clamp)(i-r[1],0,o);const a=(0,So.calcGridColWidth)(f),l=p-(0,So.calcGridItemWHPx)(u,a,t[0]);s=(0,So.clamp)(s-r[0],0,l)}}const h={top:i,left:s};this.setState({dragging:h});const{containerPadding:m}=this.props,{x:g,y:y}=(0,So.calcXY)(f,i-m[1],s-m[0],u,d);return a.call(this,c,g,y,{e:e,node:n,newPosition:h})})),Eo(this,"onDragStop",((e,t)=>{let{node:n}=t;const{onDragStop:r}=this.props;if(!r)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:o,h:a,i:i,containerPadding:s}=this.props,{left:l,top:c}=this.state.dragging,u={top:c,left:l};this.setState({dragging:null});const{x:d,y:p}=(0,So.calcXY)(this.getPositionParams(),c-s[1],l-s[0],o,a);return r.call(this,i,d,p,{e:e,node:n,newPosition:u})})),Eo(this,"onResizeStop",((e,t,n)=>this.onResizeHandler(e,t,n,"onResizeStop"))),Eo(this,"onResizeStart",((e,t,n)=>this.onResizeHandler(e,t,n,"onResizeStart"))),Eo(this,"onResize",((e,t,n)=>this.onResizeHandler(e,t,n,"onResize")))}shouldComponentUpdate(e,t){if(this.props.children!==e.children)return!0;if(this.props.droppingPosition!==e.droppingPosition)return!0;const n=(0,So.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),r=(0,So.calcGridItemPosition)(this.getPositionParams(e),e.x,e.y,e.w,e.h,t);return!(0,xo.fastPositionEqual)(n,r)||this.props.useCSSTransforms!==e.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(e){this.moveDroppingItem(e)}moveDroppingItem(e){const{droppingPosition:t}=this.props;if(!t)return;const n=this.elementRef.current;if(!n)return;const r=e.droppingPosition||{left:0,top:0},{dragging:o}=this.state,a=o&&t.left!==r.left||t.top!==r.top;if(o){if(a){const e=t.left-o.left,r=t.top-o.top;this.onDrag(t.e,{node:n,deltaX:e,deltaY:r})}}else this.onDragStart(t.e,{node:n,deltaX:t.left,deltaY:t.top})}getPositionParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return{cols:e.cols,containerPadding:e.containerPadding,containerWidth:e.containerWidth,margin:e.margin,maxRows:e.maxRows,rowHeight:e.rowHeight}}createStyle(e){const{usePercentages:t,containerWidth:n,useCSSTransforms:r}=this.props;let o;return r?o=(0,xo.setTransform)(e):(o=(0,xo.setTopLeft)(e),t&&(o.left=(0,xo.perc)(e.left/n),o.width=(0,xo.perc)(e.width/n))),o}mixinDraggable(e,t){return yo.default.createElement(vo.DraggableCore,{disabled:!t,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},e)}curryResizeHandler(e,t){return(n,r)=>t(n,r,e)}mixinResizable(e,t,n){const{cols:r,minW:o,minH:a,maxW:i,maxH:s,transformScale:l,resizeHandles:c,resizeHandle:u}=this.props,d=this.getPositionParams(),p=(0,So.calcGridItemPosition)(d,0,0,r,0).width,f=(0,So.calcGridItemPosition)(d,0,0,o,a),h=(0,So.calcGridItemPosition)(d,0,0,i,s),m=[f.width,f.height],g=[Math.min(h.width,p),Math.min(h.height,1/0)];return yo.default.createElement(wo.Resizable,{draggableOpts:{disabled:!n},className:n?void 0:"react-resizable-hide",width:t.width,height:t.height,minConstraints:m,maxConstraints:g,onResizeStop:this.curryResizeHandler(t,this.onResizeStop),onResizeStart:this.curryResizeHandler(t,this.onResizeStart),onResize:this.curryResizeHandler(t,this.onResize),transformScale:l,resizeHandles:c,handle:u},e)}onResizeHandler(e,t,n,r){let{node:o,size:a,handle:i}=t;const s=this.props[r];if(!s)return;const{x:l,y:c,i:u,maxH:d,minH:p,containerWidth:f}=this.props,{minW:h,maxW:m}=this.props;let g=a;o&&(g=(0,xo.resizeItemInDirection)(i,n,a,f),this.setState({resizing:"onResizeStop"===r?null:g}));let{w:y,h:b}=(0,So.calcWH)(this.getPositionParams(),g.width,g.height,l,c,i);y=(0,So.clamp)(y,Math.max(h,1),m),b=(0,So.clamp)(b,p,d),s.call(this,u,y,b,{e:e,node:o,size:g,handle:i})}render(){const{x:e,y:t,w:n,h:r,isDraggable:o,isResizable:a,droppingPosition:i,useCSSTransforms:s}=this.props,l=(0,So.calcGridItemPosition)(this.getPositionParams(),e,t,n,r,this.state),c=yo.default.Children.only(this.props.children);let u=yo.default.cloneElement(c,{ref:this.elementRef,className:(0,Oo.default)("react-grid-item",c.props.className,this.props.className,{static:this.props.static,resizing:Boolean(this.state.resizing),"react-draggable":o,"react-draggable-dragging":Boolean(this.state.dragging),dropping:Boolean(i),cssTransforms:s}),style:{...this.props.style,...c.props.style,...this.createStyle(l)}});return u=this.mixinResizable(u,l,a),u=this.mixinDraggable(u,o),u}}jn.default=Do,Eo(Do,"propTypes",{children:bo.default.element,cols:bo.default.number.isRequired,containerWidth:bo.default.number.isRequired,rowHeight:bo.default.number.isRequired,margin:bo.default.array.isRequired,maxRows:bo.default.number.isRequired,containerPadding:bo.default.array.isRequired,x:bo.default.number.isRequired,y:bo.default.number.isRequired,w:bo.default.number.isRequired,h:bo.default.number.isRequired,minW:function(e,t){const n=e[t];return"number"!=typeof n?new Error("minWidth not Number"):n>e.w||n>e.maxW?new Error("minWidth larger than item width/maxWidth"):void 0},maxW:function(e,t){const n=e[t];return"number"!=typeof n?new Error("maxWidth not Number"):n<e.w||n<e.minW?new Error("maxWidth smaller than item width/minWidth"):void 0},minH:function(e,t){const n=e[t];return"number"!=typeof n?new Error("minHeight not Number"):n>e.h||n>e.maxH?new Error("minHeight larger than item height/maxHeight"):void 0},maxH:function(e,t){const n=e[t];return"number"!=typeof n?new Error("maxHeight not Number"):n<e.h||n<e.minH?new Error("maxHeight smaller than item height/minHeight"):void 0},i:bo.default.string.isRequired,resizeHandles:_o.resizeHandleAxesType,resizeHandle:_o.resizeHandleType,onDragStop:bo.default.func,onDragStart:bo.default.func,onDrag:bo.default.func,onResizeStop:bo.default.func,onResizeStart:bo.default.func,onResize:bo.default.func,isDraggable:bo.default.bool.isRequired,isResizable:bo.default.bool.isRequired,isBounded:bo.default.bool.isRequired,static:bo.default.bool,useCSSTransforms:bo.default.bool.isRequired,transformScale:bo.default.number,className:bo.default.string,handle:bo.default.string,cancel:bo.default.string,droppingPosition:bo.default.shape({e:bo.default.object.isRequired,left:bo.default.number.isRequired,top:bo.default.number.isRequired})}),Eo(Do,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.default=void 0;var Co=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=Lo(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(l),No=It,ko=To(qt),Ro=Bt,Po=xn,Mo=To(jn),zo=To(uo);function To(e){return e&&e.__esModule?e:{default:e}}function Lo(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Lo=function(e){return e?n:t})(e)}function Io(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ho="react-grid-layout";let Ao=!1;try{Ao=/firefox/i.test(navigator.userAgent)}catch(Fs){}let Wo=class extends Co.Component{constructor(){super(...arguments),Io(this,"state",{activeDrag:null,layout:(0,Ro.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,Ro.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),Io(this,"dragEnterCounter",0),Io(this,"onDragStart",((e,t,n,r)=>{let{e:o,node:a}=r;const{layout:i}=this.state,s=(0,Ro.getLayoutItem)(i,e);if(!s)return;const l={w:s.w,h:s.h,x:s.x,y:s.y,placeholder:!0,i:e};return this.setState({oldDragItem:(0,Ro.cloneLayoutItem)(s),oldLayout:i,activeDrag:l}),this.props.onDragStart(i,s,s,null,o,a)})),Io(this,"onDrag",((e,t,n,r)=>{let{e:o,node:a}=r;const{oldDragItem:i}=this.state;let{layout:s}=this.state;const{cols:l,allowOverlap:c,preventCollision:u}=this.props,d=(0,Ro.getLayoutItem)(s,e);if(!d)return;const p={w:d.w,h:d.h,x:d.x,y:d.y,placeholder:!0,i:e};s=(0,Ro.moveElement)(s,d,t,n,!0,u,(0,Ro.compactType)(this.props),l,c),this.props.onDrag(s,i,d,p,o,a),this.setState({layout:c?s:(0,Ro.compact)(s,(0,Ro.compactType)(this.props),l),activeDrag:p})})),Io(this,"onDragStop",((e,t,n,r)=>{let{e:o,node:a}=r;if(!this.state.activeDrag)return;const{oldDragItem:i}=this.state;let{layout:s}=this.state;const{cols:l,preventCollision:c,allowOverlap:u}=this.props,d=(0,Ro.getLayoutItem)(s,e);if(!d)return;s=(0,Ro.moveElement)(s,d,t,n,!0,c,(0,Ro.compactType)(this.props),l,u);const p=u?s:(0,Ro.compact)(s,(0,Ro.compactType)(this.props),l);this.props.onDragStop(p,i,d,null,o,a);const{oldLayout:f}=this.state;this.setState({activeDrag:null,layout:p,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(p,f)})),Io(this,"onResizeStart",((e,t,n,r)=>{let{e:o,node:a}=r;const{layout:i}=this.state,s=(0,Ro.getLayoutItem)(i,e);s&&(this.setState({oldResizeItem:(0,Ro.cloneLayoutItem)(s),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(i,s,s,null,o,a))})),Io(this,"onResize",((e,t,n,r)=>{let{e:o,node:a,size:i,handle:s}=r;const{oldResizeItem:l}=this.state,{layout:c}=this.state,{cols:u,preventCollision:d,allowOverlap:p}=this.props;let f,h,m,g=!1;const[y,b]=(0,Ro.withLayoutItem)(c,e,(e=>{let r;if(h=e.x,m=e.y,-1!==["sw","w","nw","n","ne"].indexOf(s)&&(-1!==["sw","nw","w"].indexOf(s)&&(h=e.x+(e.w-t),t=e.x!==h&&h<0?e.w:t,h=h<0?0:h),-1!==["ne","n","nw"].indexOf(s)&&(m=e.y+(e.h-n),n=e.y!==m&&m<0?e.h:n,m=m<0?0:m),g=!0),d&&!p){r=(0,Ro.getAllCollisions)(c,{...e,w:t,h:n,x:h,y:m}).filter((t=>t.i!==e.i)).length>0,r&&(m=e.y,n=e.h,h=e.x,t=e.w,g=!1)}return e.w=t,e.h=n,e}));if(!b)return;if(f=y,g){const e=!0;f=(0,Ro.moveElement)(y,b,h,m,e,this.props.preventCollision,(0,Ro.compactType)(this.props),u,p)}const v={w:b.w,h:b.h,x:b.x,y:b.y,static:!0,i:e};this.props.onResize(f,l,b,v,o,a),this.setState({layout:p?f:(0,Ro.compact)(f,(0,Ro.compactType)(this.props),u),activeDrag:v})})),Io(this,"onResizeStop",((e,t,n,r)=>{let{e:o,node:a}=r;const{layout:i,oldResizeItem:s}=this.state,{cols:l,allowOverlap:c}=this.props,u=(0,Ro.getLayoutItem)(i,e),d=c?i:(0,Ro.compact)(i,(0,Ro.compactType)(this.props),l);this.props.onResizeStop(d,s,u,null,o,a);const{oldLayout:p}=this.state;this.setState({activeDrag:null,layout:d,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(d,p)})),Io(this,"onDragOver",(e=>{var t;if(e.preventDefault(),e.stopPropagation(),Ao&&!(null==(t=e.nativeEvent.target)?void 0:t.classList.contains(Ho)))return!1;const{droppingItem:n,onDropDragOver:r,margin:o,cols:a,rowHeight:i,maxRows:s,width:l,containerPadding:c,transformScale:u}=this.props,d=null==r?void 0:r(e);if(!1===d)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const p={...n,...d},{layout:f}=this.state,h=e.currentTarget.getBoundingClientRect(),m=e.clientX-h.left,g=e.clientY-h.top,y={left:m/u,top:g/u,e:e};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:e,top:t}=this.state.droppingPosition;(e!=m||t!=g)&&this.setState({droppingPosition:y})}}else{const e={cols:a,margin:o,maxRows:s,rowHeight:i,containerWidth:l,containerPadding:c||o},t=(0,Po.calcXY)(e,g,m,p.w,p.h);this.setState({droppingDOMNode:Co.createElement("div",{key:p.i}),droppingPosition:y,layout:[...f,{...p,x:t.x,y:t.y,static:!1,isDraggable:!0}]})}})),Io(this,"removeDroppingPlaceholder",(()=>{const{droppingItem:e,cols:t}=this.props,{layout:n}=this.state,r=(0,Ro.compact)(n.filter((t=>t.i!==e.i)),(0,Ro.compactType)(this.props),t,this.props.allowOverlap);this.setState({layout:r,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})})),Io(this,"onDragLeave",(e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter--,0===this.dragEnterCounter&&this.removeDroppingPlaceholder()})),Io(this,"onDragEnter",(e=>{e.preventDefault(),e.stopPropagation(),this.dragEnterCounter++})),Io(this,"onDrop",(e=>{e.preventDefault(),e.stopPropagation();const{droppingItem:t}=this.props,{layout:n}=this.state,r=n.find((e=>e.i===t.i));this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(n,r,e)}))}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(e,t){let n;if(t.activeDrag)return null;if((0,No.deepEqual)(e.layout,t.propsLayout)&&e.compactType===t.compactType?(0,Ro.childrenEqual)(e.children,t.children)||(n=t.layout):n=e.layout,n){return{layout:(0,Ro.synchronizeLayoutWithChildren)(n,e.children,e.cols,(0,Ro.compactType)(e),e.allowOverlap),compactType:e.compactType,children:e.children,propsLayout:e.layout}}return null}shouldComponentUpdate(e,t){return this.props.children!==e.children||!(0,Ro.fastRGLPropsEqual)(this.props,e,No.deepEqual)||this.state.activeDrag!==t.activeDrag||this.state.mounted!==t.mounted||this.state.droppingPosition!==t.droppingPosition}componentDidUpdate(e,t){if(!this.state.activeDrag){const e=this.state.layout,n=t.layout;this.onLayoutMaybeChanged(e,n)}}containerHeight(){if(!this.props.autoSize)return;const e=(0,Ro.bottom)(this.state.layout),t=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return e*this.props.rowHeight+(e-1)*this.props.margin[1]+2*t+"px"}onLayoutMaybeChanged(e,t){t||(t=this.state.layout),(0,No.deepEqual)(t,e)||this.props.onLayoutChange(e)}placeholder(){const{activeDrag:e}=this.state;if(!e)return null;const{width:t,cols:n,margin:r,containerPadding:o,rowHeight:a,maxRows:i,useCSSTransforms:s,transformScale:l}=this.props;return Co.createElement(Mo.default,{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,className:"react-grid-placeholder "+(this.state.resizing?"placeholder-resizing":""),containerWidth:t,cols:n,margin:r,containerPadding:o||r,maxRows:i,rowHeight:a,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:s,transformScale:l},Co.createElement("div",null))}processGridItem(e,t){if(!e||!e.key)return;const n=(0,Ro.getLayoutItem)(this.state.layout,String(e.key));if(!n)return null;const{width:r,cols:o,margin:a,containerPadding:i,rowHeight:s,maxRows:l,isDraggable:c,isResizable:u,isBounded:d,useCSSTransforms:p,transformScale:f,draggableCancel:h,draggableHandle:m,resizeHandles:g,resizeHandle:y}=this.props,{mounted:b,droppingPosition:v}=this.state,w="boolean"==typeof n.isDraggable?n.isDraggable:!n.static&&c,x="boolean"==typeof n.isResizable?n.isResizable:!n.static&&u,S=n.resizeHandles||g,_=w&&d&&!1!==n.isBounded;return Co.createElement(Mo.default,{containerWidth:r,cols:o,margin:a,containerPadding:i||a,maxRows:l,rowHeight:s,cancel:h,handle:m,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:w,isResizable:x,isBounded:_,useCSSTransforms:p&&b,usePercentages:!b,transformScale:f,w:n.w,h:n.h,x:n.x,y:n.y,i:n.i,minH:n.minH,minW:n.minW,maxH:n.maxH,maxW:n.maxW,static:n.static,droppingPosition:t?v:void 0,resizeHandles:S,resizeHandle:y},e)}render(){const{className:e,style:t,isDroppable:n,innerRef:r}=this.props,o=(0,ko.default)(Ho,e),a={height:this.containerHeight(),...t};return Co.createElement("div",{ref:r,className:o,style:a,onDrop:n?this.onDrop:Ro.noop,onDragLeave:n?this.onDragLeave:Ro.noop,onDragEnter:n?this.onDragEnter:Ro.noop,onDragOver:n?this.onDragOver:Ro.noop},Co.Children.map(this.props.children,(e=>this.processGridItem(e))),n&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};Tt.default=Wo,Io(Wo,"displayName","ReactGridLayout"),Io(Wo,"propTypes",zo.default),Io(Wo,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:Ro.noop,onDragStart:Ro.noop,onDrag:Ro.noop,onDragStop:Ro.noop,onResizeStart:Ro.noop,onResize:Ro.noop,onResizeStop:Ro.noop,onDrop:Ro.noop,onDropDragOver:Ro.noop});var qo={},Bo={};Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.findOrGenerateResponsiveLayout=function(e,t,n,r,o,a){if(e[n])return(0,Go.cloneLayout)(e[n]);let i=e[r];const s=Fo(t),l=s.slice(s.indexOf(n));for(let c=0,u=l.length;c<u;c++){const t=l[c];if(e[t]){i=e[t];break}}return i=(0,Go.cloneLayout)(i||[]),(0,Go.compact)((0,Go.correctBounds)(i,{cols:o}),a,o)},Bo.getBreakpointFromWidth=function(e,t){const n=Fo(e);let r=n[0];for(let o=1,a=n.length;o<a;o++){const a=n[o];t>e[a]&&(r=a)}return r},Bo.getColsFromBreakpoint=function(e,t){if(!t[e])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+e+" is missing!");return t[e]},Bo.sortBreakpoints=Fo;var Go=Bt;function Fo(e){return Object.keys(e).sort((function(t,n){return e[t]-e[n]}))}Object.defineProperty(qo,"__esModule",{value:!0}),qo.default=void 0;var Yo=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=Zo(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(l),Uo=Qo(u),Vo=It,Xo=Bt,$o=Bo,Ko=Qo(Tt);function Qo(e){return e&&e.__esModule?e:{default:e}}function Zo(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Zo=function(e){return e?n:t})(e)}function Jo(){return Jo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Jo.apply(this,arguments)}function ea(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const ta=e=>Object.prototype.toString.call(e);function na(e,t){return null==e?null:Array.isArray(e)?e:e[t]}class ra extends Yo.Component{constructor(){super(...arguments),ea(this,"state",this.generateInitialState()),ea(this,"onLayoutChange",(e=>{this.props.onLayoutChange(e,{...this.props.layouts,[this.state.breakpoint]:e})}))}generateInitialState(){const{width:e,breakpoints:t,layouts:n,cols:r}=this.props,o=(0,$o.getBreakpointFromWidth)(t,e),a=(0,$o.getColsFromBreakpoint)(o,r),i=!1===this.props.verticalCompact?null:this.props.compactType;return{layout:(0,$o.findOrGenerateResponsiveLayout)(n,t,o,o,a,i),breakpoint:o,cols:a}}static getDerivedStateFromProps(e,t){if(!(0,Vo.deepEqual)(e.layouts,t.layouts)){const{breakpoint:n,cols:r}=t;return{layout:(0,$o.findOrGenerateResponsiveLayout)(e.layouts,e.breakpoints,n,n,r,e.compactType),layouts:e.layouts}}return null}componentDidUpdate(e){this.props.width==e.width&&this.props.breakpoint===e.breakpoint&&(0,Vo.deepEqual)(this.props.breakpoints,e.breakpoints)&&(0,Vo.deepEqual)(this.props.cols,e.cols)||this.onWidthChange(e)}onWidthChange(e){const{breakpoints:t,cols:n,layouts:r,compactType:o}=this.props,a=this.props.breakpoint||(0,$o.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),i=this.state.breakpoint,s=(0,$o.getColsFromBreakpoint)(a,n),l={...r};if(i!==a||e.breakpoints!==t||e.cols!==n){i in l||(l[i]=(0,Xo.cloneLayout)(this.state.layout));let e=(0,$o.findOrGenerateResponsiveLayout)(l,t,a,i,s,o);e=(0,Xo.synchronizeLayoutWithChildren)(e,this.props.children,s,o,this.props.allowOverlap),l[a]=e,this.props.onLayoutChange(e,l),this.props.onBreakpointChange(a,s),this.setState({breakpoint:a,layout:e,cols:s})}const c=na(this.props.margin,a),u=na(this.props.containerPadding,a);this.props.onWidthChange(this.props.width,c,s,u)}render(){const{breakpoint:e,breakpoints:t,cols:n,layouts:r,margin:o,containerPadding:a,onBreakpointChange:i,onLayoutChange:s,onWidthChange:l,...c}=this.props;return Yo.createElement(Ko.default,Jo({},c,{margin:na(o,this.state.breakpoint),containerPadding:na(a,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}}qo.default=ra,ea(ra,"propTypes",{breakpoint:Uo.default.string,breakpoints:Uo.default.object,allowOverlap:Uo.default.bool,cols:Uo.default.object,margin:Uo.default.oneOfType([Uo.default.array,Uo.default.object]),containerPadding:Uo.default.oneOfType([Uo.default.array,Uo.default.object]),layouts(e,t){if("[object Object]"!==ta(e[t]))throw new Error("Layout property must be an object. Received: "+ta(e[t]));Object.keys(e[t]).forEach((t=>{if(!(t in e.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,Xo.validateLayout)(e.layouts[t],"layouts."+t)}))},width:Uo.default.number.isRequired,onBreakpointChange:Uo.default.func,onLayoutChange:Uo.default.func,onWidthChange:Uo.default.func}),ea(ra,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:Xo.noop,onLayoutChange:Xo.noop,onWidthChange:Xo.noop});var oa={},aa=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var n=-1;return e.some((function(e,r){return e[0]===t&&(n=r,!0)})),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var n=0,r=this.__entries__;n<r.length;n++){var o=r[n];e.call(t,o[1],o[0])}},t}()}(),ia="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,sa="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),la="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(sa):function(e){return setTimeout((function(){return e(Date.now())}),1e3/60)};var ca=["top","right","bottom","left","width","height","size","weight"],ua="undefined"!=typeof MutationObserver,da=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(e,t){var n=!1,r=!1,o=0;function a(){n&&(n=!1,e()),r&&s()}function i(){la(a)}function s(){var e=Date.now();if(n){if(e-o<2)return;r=!0}else n=!0,r=!1,setTimeout(i,t);o=e}return s}(this.refresh.bind(this),20)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter((function(e){return e.gatherActive(),e.hasActive()}));return e.forEach((function(e){return e.broadcastActive()})),e.length>0},e.prototype.connect_=function(){ia&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ua?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){ia&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,n=void 0===t?"":t;ca.some((function(e){return!!~n.indexOf(e)}))&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),pa=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},fa=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||sa},ha=wa(0,0,0,0);function ma(e){return parseFloat(e)||0}function ga(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce((function(t,n){return t+ma(e["border-"+n+"-width"])}),0)}function ya(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return ha;var r=fa(e).getComputedStyle(e),o=function(e){for(var t={},n=0,r=["top","right","bottom","left"];n<r.length;n++){var o=r[n],a=e["padding-"+o];t[o]=ma(a)}return t}(r),a=o.left+o.right,i=o.top+o.bottom,s=ma(r.width),l=ma(r.height);if("border-box"===r.boxSizing&&(Math.round(s+a)!==t&&(s-=ga(r,"left","right")+a),Math.round(l+i)!==n&&(l-=ga(r,"top","bottom")+i)),!function(e){return e===fa(e).document.documentElement}(e)){var c=Math.round(s+a)-t,u=Math.round(l+i)-n;1!==Math.abs(c)&&(s-=c),1!==Math.abs(u)&&(l-=u)}return wa(o.left,o.top,s,l)}var ba="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof fa(e).SVGGraphicsElement}:function(e){return e instanceof fa(e).SVGElement&&"function"==typeof e.getBBox};function va(e){return ia?ba(e)?function(e){var t=e.getBBox();return wa(0,0,t.width,t.height)}(e):ya(e):ha}function wa(e,t,n,r){return{x:e,y:t,width:n,height:r}}var xa=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=wa(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=va(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),Sa=function(){return function(e,t){var n,r,o,a,i,s,l,c=(r=(n=t).x,o=n.y,a=n.width,i=n.height,s="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,l=Object.create(s.prototype),pa(l,{x:r,y:o,width:a,height:i,top:o,right:r+a,bottom:i+o,left:r}),l);pa(this,{target:e,contentRect:c})}}(),_a=function(){function e(e,t,n){if(this.activeObservations_=[],this.observations_=new aa,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof fa(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new xa(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof fa(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach((function(t){t.isActive()&&e.activeObservations_.push(t)}))},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map((function(e){return new Sa(e.target,e.broadcastRect())}));this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),Oa="undefined"!=typeof WeakMap?new WeakMap:new aa,ja=function(){return function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=da.getInstance(),r=new _a(t,n,this);Oa.set(this,r)}}();["observe","unobserve","disconnect"].forEach((function(e){ja.prototype[e]=function(){var t;return(t=Oa.get(this))[e].apply(t,arguments)}}));var Ea=void 0!==sa.ResizeObserver?sa.ResizeObserver:ja;const Da=c(Object.freeze(Object.defineProperty({__proto__:null,default:Ea},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(oa,"__esModule",{value:!0}),oa.default=function(e){var t;return t=class extends Ca.Component{constructor(){super(...arguments),Ta(this,"state",{width:1280}),Ta(this,"elementRef",Ca.createRef()),Ta(this,"mounted",!1),Ta(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new ka.default((e=>{if(this.elementRef.current instanceof HTMLElement){const t=e[0].contentRect.width;this.setState({width:t})}}));const e=this.elementRef.current;e instanceof HTMLElement&&this.resizeObserver.observe(e)}componentWillUnmount(){this.mounted=!1;const e=this.elementRef.current;e instanceof HTMLElement&&this.resizeObserver.unobserve(e),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:t,...n}=this.props;return t&&!this.mounted?Ca.createElement("div",{className:(0,Ra.default)(this.props.className,La),style:this.props.style,ref:this.elementRef}):Ca.createElement(e,za({innerRef:this.elementRef},n,this.state))}},Ta(t,"defaultProps",{measureBeforeMount:!1}),Ta(t,"propTypes",{measureBeforeMount:Na.default.bool}),t};var Ca=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=Ma(t);if(n&&n.has(e))return n.get(e);var r={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var i=o?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(r,a,i):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}(l),Na=Pa(u),ka=Pa(Da),Ra=Pa(qt);function Pa(e){return e&&e.__esModule?e:{default:e}}function Ma(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Ma=function(e){return e?n:t})(e)}function za(){return za=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},za.apply(this,arguments)}function Ta(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const La="react-grid-layout";var Ia;(Ia=zt).exports=Tt.default,Ia.exports.utils=Bt,Ia.exports.calculateUtils=xn,Ia.exports.Responsive=qo.default,Ia.exports.Responsive.utils=Bo,Ia.exports.WidthProvider=oa.default;var Ha=zt.exports;const Aa=[p(),f({syntaxHighlighting:!0,highlightSpecialChars:!1,history:!1,drawSelection:!1,defaultKeymap:!1,historyKeymap:!1})],Wa=l.memo((e=>{const t=h(8),{code:n,className:r}=e,{theme:o}=m();let a;t[0]!==r?(a=g(r,"text-muted-foreground flex flex-col overflow-hidden"),t[0]=r,t[1]=a):a=t[1];const i="dark"===o?"dark":"light";let s,l;return t[2]!==i||t[3]!==n?(s=y.jsx(b,{minHeight:"10px",theme:i,height:"100%",className:"tiny-code",editable:!1,basicSetup:!1,extensions:Aa,value:n}),t[2]=i,t[3]=n,t[4]=s):s=t[4],t[5]!==a||t[6]!==s?(l=y.jsx("div",{className:a,children:s}),t[5]=a,t[6]=s,t[7]=l):l=t[7],l}));Wa.displayName="TinyCode";const qa=Ha.WidthProvider(Ha.Responsive),Ba=[0,0],Ga="grid-drag-handle",Fa=l.memo((e=>{const t=h(18),{output:n,cellId:r,status:o,mode:a,code:i,hidden:s,isScrollable:l,side:c,className:u}=e,d="running"===o||"queued"===o;if((null==n||""===n.data)&&"read"!==a){let e;return t[0]!==u||t[1]!==i?(e=y.jsx(Wa,{className:u,code:i}),t[0]=u,t[1]=i,t[2]=e):e=t[2],e}const p=s&&"invisible",f=l?"overflow-y-auto":"overflow-y-hidden",m="top"===c&&"flex items-start",b="bottom"===c&&"flex items-end",v="left"===c&&"flex justify-start",w="right"===c&&"flex justify-end";let x,S,_;return t[3]!==u||t[4]!==p||t[5]!==f||t[6]!==m||t[7]!==b||t[8]!==v||t[9]!==w?(x=g(u,"h-full w-full p-2 overflow-x-auto",p,f,m,b,v,w),t[3]=u,t[4]=p,t[5]=f,t[6]=m,t[7]=b,t[8]=v,t[9]=w,t[10]=x):x=t[10],t[11]!==n||t[12]!==r||t[13]!==d?(S=y.jsx(D,{allowExpand:!1,output:n,cellId:r,stale:d}),t[11]=n,t[12]=r,t[13]=d,t[14]=S):S=t[14],t[15]!==x||t[16]!==S?(_=y.jsx("div",{className:x,children:S}),t[15]=x,t[16]=S,t[17]=_):_=t[17],_}));Fa.displayName="GridCell";const Ya=e=>{const t=h(38),{layout:n,setLayout:r,isLocked:o,setIsLocked:a}=e;let i,s,l,c,u,d,p,f,m,g,b,v,w,_,O;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=y.jsx(C,{htmlFor:"columns",children:"Columns"}),t[0]=i):i=t[0],t[1]!==r||t[2]!==n?(s=e=>{r({...n,columns:e})},t[1]=r,t[2]=n,t[3]=s):s=t[3],t[4]!==n.columns||t[5]!==s?(l=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[i,y.jsx(x,{"data-testid":"grid-columns-input",id:"columns",value:n.columns,className:"w-[60px]",placeholder:"# of Columns",minValue:1,onChange:s})]}),t[4]=n.columns,t[5]=s,t[6]=l):l=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(c=y.jsx(C,{htmlFor:"rowHeight",children:"Row Height (px)"}),t[7]=c):c=t[7],t[8]!==r||t[9]!==n?(u=e=>{r({...n,rowHeight:e})},t[8]=r,t[9]=n,t[10]=u):u=t[10],t[11]!==n.rowHeight||t[12]!==u?(d=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[c,y.jsx(x,{"data-testid":"grid-row-height-input",id:"rowHeight",value:n.rowHeight,className:"w-[60px]",placeholder:"Row Height (px)",minValue:1,onChange:u})]}),t[11]=n.rowHeight,t[12]=u,t[13]=d):d=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(p=y.jsx(C,{htmlFor:"maxWidth",children:"Max Width (px)"}),t[14]=p):p=t[14],t[15]!==r||t[16]!==n?(f=e=>{r({...n,maxWidth:Number.isNaN(e)?void 0:e})},t[15]=r,t[16]=n,t[17]=f):f=t[17],t[18]!==n.maxWidth||t[19]!==f?(m=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[p,y.jsx(x,{"data-testid":"grid-max-width-input",id:"maxWidth",value:n.maxWidth,className:"w-[90px]",step:100,placeholder:"Full",onChange:f})]}),t[18]=n.maxWidth,t[19]=f,t[20]=m):m=t[20],t[21]===Symbol.for("react.memo_cache_sentinel")?(g=y.jsxs(C,{className:"flex flex-row items-center gap-1",htmlFor:"lock",children:[y.jsx(N,{className:"h-3 w-3"}),"Bordered"]}),t[21]=g):g=t[21],t[22]!==r||t[23]!==n?(b=e=>{r({...n,bordered:e})},t[22]=r,t[23]=n,t[24]=b):b=t[24],t[25]!==n.bordered||t[26]!==b?(v=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[g,y.jsx(S,{"data-testid":"grid-bordered-switch",id:"lock",checked:n.bordered,size:"sm",onCheckedChange:b})]}),t[25]=n.bordered,t[26]=b,t[27]=v):v=t[27],t[28]===Symbol.for("react.memo_cache_sentinel")?(w=y.jsxs(C,{className:"flex flex-row items-center gap-1",htmlFor:"lock",children:[y.jsx(k,{className:"h-3 w-3"}),"Lock Grid"]}),t[28]=w):w=t[28],t[29]!==o||t[30]!==a?(_=y.jsxs("div",{className:"flex flex-row items-center gap-2",children:[w,y.jsx(S,{"data-testid":"grid-lock-switch",id:"lock",checked:o,size:"sm",onCheckedChange:a})]}),t[29]=o,t[30]=a,t[31]=_):_=t[31],t[32]!==l||t[33]!==d||t[34]!==m||t[35]!==v||t[36]!==_?(O=y.jsxs("div",{className:"flex flex-row absolute pl-5 top-8 gap-4 w-full justify-end pr-[350px] pb-3 border-b z-20",children:[l,d,m,v,_]}),t[32]=l,t[33]=d,t[34]=m,t[35]=v,t[36]=_,t[37]=O):O=t[37],O},Ua=v.forwardRef(((e,t)=>{const n=h(30);let r,o,a,i,s,c,u,d,p,f;n[0]!==e?(({children:f,isDragging:r,className:o,onDelete:a,isScrollable:i,setIsScrollable:s,side:c,setSide:u,display:d,...p}=e),n[0]=e,n[1]=r,n[2]=o,n[3]=a,n[4]=i,n[5]=s,n[6]=c,n[7]=u,n[8]=d,n[9]=p,n[10]=f):(r=n[1],o=n[2],a=n[3],i=n[4],s=n[5],c=n[6],u=n[7],d=n[8],p=n[9],f=n[10]);const[m,b]=l.useState(),v=m&&"border-[var(--sky-8)] z-20",w=!m&&"hover-actions-parent",x=r&&"bg-[var(--slate-2)] border-border z-20";let S,_,O;return n[11]!==o||n[12]!==v||n[13]!==w||n[14]!==x?(S=g(o,"relative z-10 hover:z-20","bg-background border-transparent hover:border-[var(--sky-8)] border",v,w,x),n[11]=o,n[12]=v,n[13]=w,n[14]=x,n[15]=S):S=n[15],n[16]!==a||n[17]!==i||n[18]!==s||n[19]!==c||n[20]!==u||n[21]!==d||n[22]!==m?(_=y.jsx(Va,{onDelete:a,isScrollable:i,setIsScrollable:s,side:c,setSide:u,display:d,setPopoverOpened:b,popoverOpened:m}),n[16]=a,n[17]=i,n[18]=s,n[19]=c,n[20]=u,n[21]=d,n[22]=m,n[23]=_):_=n[23],n[24]!==t||n[25]!==p||n[26]!==S||n[27]!==f||n[28]!==_?(O=y.jsxs("div",{ref:t,...p,className:S,children:[f,_]}),n[24]=t,n[25]=p,n[26]=S,n[27]=f,n[28]=_,n[29]=O):O=n[29],O}));Ua.displayName="EditableGridCell";const Va=e=>{const t=h(43),{display:n,onDelete:r,side:o,setSide:a,isScrollable:i,setIsScrollable:s,popoverOpened:l,setPopoverOpened:c}=e,u="left"===o?_t:"right"===o?xt:void 0,d=!l&&"hover-action",p="top"===n&&"-top-6 rounded-t",f="bottom"===n&&"-bottom-6 rounded-b";let m;t[0]!==d||t[1]!==p||t[2]!==f?(m=g("absolute right-0 p-1 bg-[var(--sky-8)] text-white h-6 z-10 flex gap-2",d,p,f),t[0]=d,t[1]=p,t[2]=f,t[3]=m):m=t[3];const b="side"===l;let v,w,x,D,C;t[4]!==c?(v=e=>c(e?"side":void 0),t[4]=c,t[5]=v):v=t[5],t[6]!==u?(w=y.jsx(R,{asChild:!0,children:u?y.jsx(u,{className:"h-4 w-4 opacity-60 hover:opacity-100"}):y.jsx(St,{className:"h-4 w-4 opacity-60 hover:opacity-100"})}),t[6]=u,t[7]=w):w=t[7],t[8]!==a||t[9]!==o?(x=_.entries(Xa).map((e=>{const[t,n]=e;return y.jsxs(O,{onSelect:()=>a(t),children:[y.jsx(n,{className:"h-4 w-3 mr-2"}),y.jsx("span",{className:"flex-1",children:j(t)}),t===o&&y.jsx(E,{className:"h-4 w-4"})]},t)})),t[8]=a,t[9]=o,t[10]=x):x=t[10],t[11]!==x?(D=y.jsx(P,{side:"bottom",children:x}),t[11]=x,t[12]=D):D=t[12],t[13]!==b||t[14]!==v||t[15]!==w||t[16]!==D?(C=y.jsxs(M,{open:b,onOpenChange:v,children:[w,D]}),t[13]=b,t[14]=v,t[15]=w,t[16]=D,t[17]=C):C=t[17];const N="scroll"===l;let k,T,L,I,H,A,W,q,B,G;return t[18]!==c?(k=e=>c(e?"scroll":void 0),t[18]=c,t[19]=k):k=t[19],t[20]===Symbol.for("react.memo_cache_sentinel")?(T=y.jsx(R,{asChild:!0,children:y.jsx(kt,{className:"h-4 w-4 opacity-60 hover:opacity-100"})}),t[20]=T):T=t[20],t[21]!==s||t[22]!==i?(L=()=>s(!i),t[21]=s,t[22]=i,t[23]=L):L=t[23],t[24]===Symbol.for("react.memo_cache_sentinel")?(I=y.jsx("span",{className:"flex-1",children:"Scrollable"}),t[24]=I):I=t[24],t[25]!==i||t[26]!==s?(H=y.jsx(S,{"data-testid":"grid-scrollable-switch",checked:i,size:"sm",onCheckedChange:s}),t[25]=i,t[26]=s,t[27]=H):H=t[27],t[28]!==L||t[29]!==H?(A=y.jsx(P,{side:"bottom",children:y.jsxs(O,{onSelect:L,children:[I,H]})}),t[28]=L,t[29]=H,t[30]=A):A=t[30],t[31]!==N||t[32]!==k||t[33]!==A?(W=y.jsxs(M,{open:N,onOpenChange:k,children:[T,A]}),t[31]=N,t[32]=k,t[33]=A,t[34]=W):W=t[34],t[35]===Symbol.for("react.memo_cache_sentinel")?(q=y.jsx(Et,{className:g(Ga,"cursor-move","h-4 w-4 opacity-60 hover:opacity-100")}),t[35]=q):q=t[35],t[36]!==r?(B=y.jsx(z,{className:"h-4 w-4 opacity-60 hover:opacity-100",onClick:()=>r()}),t[36]=r,t[37]=B):B=t[37],t[38]!==m||t[39]!==C||t[40]!==W||t[41]!==B?(G=y.jsxs("div",{className:m,children:[C,W,q,B]}),t[38]=m,t[39]=C,t[40]=W,t[41]=B,t[42]=G):G=t[42],G},Xa={left:_t,right:xt};function $a(e){return e.i}function Ka(e){return e.i}function Qa(){window.dispatchEvent(new Event("resize"))}const Za={type:"grid",name:"Grid",validator:T.object({columns:T.number().min(1),rowHeight:T.number().min(1),maxWidth:T.number().optional(),bordered:T.boolean().optional(),cells:T.array(T.object({position:T.tuple([T.number(),T.number(),T.number(),T.number()]).nullable(),scrollable:T.boolean().optional(),alignment:T.enum(["top","bottom","left","right"]).optional()}))}),deserializeLayout:(e,t)=>{if(0===e.cells.length)return{columns:e.columns,rowHeight:e.rowHeight,scrollableCells:new Set,cellSide:new Map,cells:[]};e.cells.length!==t.length&&a.warn("Number of cells in layout does not match number of cells in notebook");const n=new Set,r=new Map,o=e.cells.flatMap(((e,o)=>{const a=e.position;if(!a)return[];const i=t[o];return i?(e.scrollable&&n.add(i.id),e.side&&r.set(i.id,e.side),{i:i.id,x:a[0],y:a[1],w:a[2],h:a[3]}):[]}));return{columns:e.columns,rowHeight:e.rowHeight,maxWidth:e.maxWidth,bordered:e.bordered,cells:o,cellSide:r,scrollableCells:n}},serializeLayout:(e,t)=>{const n=w.keyBy(e.cells,(e=>e.i)),r=t.map((t=>{const r=n.get(t.id);if(!r)return{position:null};const o={position:[r.x,r.y,r.w,r.h]};return e.scrollableCells.has(t.id)&&(o.scrollable=!0),e.cellSide.has(t.id)&&(o.side=e.cellSide.get(t.id)),o}));return{columns:e.columns,rowHeight:e.rowHeight,maxWidth:e.maxWidth,bordered:e.bordered,cells:r}},Component:e=>{const t=h(61),{layout:n,setLayout:r,cells:o,mode:a}=e,i="read"===a,s=new Set(n.cells.map($a)),[c,u]=l.useState(null),[d,p]=l.useState(!1);let f,m;t[0]!==n.columns?(m={lg:n.columns},t[0]=n.columns,t[1]=m):m=t[1],f=m;const b=f;let x,S;t[2]!==n.bordered?(x=()=>{const e=document.getElementById("App");return n.bordered?null==e||e.classList.add("grid-bordered"):null==e||e.classList.remove("grid-bordered"),()=>{null==e||e.classList.remove("grid-bordered")}},S=[n.bordered],t[2]=n.bordered,t[3]=x,t[4]=S):(x=t[3],S=t[4]),l.useEffect(x,S);const _=function(){const e=h(10),[t,n]=l.useState(!1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={x:0,y:0},e[0]=r):r=e[0];const[o,a]=v.useState(r),[i,s]=v.useState(!1);let c;e[1]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{n(!0),a({x:e.clientX,y:e.clientY})},e[1]=c):c=e[1];const u=c;let d;e[2]!==t||e[3]!==o.x||e[4]!==o.y?(d=e=>{if(t){const t=e.clientX-o.x,n=e.clientY-o.y;s(Math.hypot(t,n)>10)}},e[2]=t,e[3]=o.x,e[4]=o.y,e[5]=d):d=e[5];const p=d;let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{n(!1),s(!1)},e[6]=f):f=e[6];const m=f,g=t&&i;let y;return e[7]!==g||e[8]!==p?(y={isDragging:g,onDragStart:u,onDragMove:p,onDragStop:m},e[7]=g,e[8]=p,e[9]=y):y=e[9],y}();let O,j;t[5]!==_?(({isDragging:j,...O}=_),t[5]=_,t[6]=O,t[7]=j):(O=t[6],j=t[7]);const E=!i&&!d,D=w.keyBy(n.cells,Ka);let C;t[8]!==n||t[9]!==r?(C=e=>t=>{const o=new Set(n.scrollableCells);t?o.add(e):o.delete(e),r({...n,scrollableCells:o})},t[8]=n,t[9]=r,t[10]=C):C=t[10];const N=C;let k;t[11]!==n||t[12]!==r?(k=e=>t=>{const o=new Map(n.cellSide);t===o.get(e)?o.delete(e):o.set(e,t),r({...n,cellSide:o})},t[11]=n,t[12]=r,t[13]=k):k=t[13];const R=k;let P,M;t[14]!==n||t[15]!==E?(P={},n.maxWidth&&(P.maxWidth=`${n.maxWidth}px`),E&&(P.backgroundImage="repeating-linear-gradient(var(--gray-4) 0 1px, transparent 1px 100%), repeating-linear-gradient(90deg, var(--gray-4) 0 1px, transparent 1px 100%)",P.backgroundSize=`calc((100% / ${n.columns})) ${n.rowHeight}px`),t[14]=n,t[15]=E,t[16]=P):P=t[16],t[17]!==n.cells?(M={lg:n.cells},t[17]=n.cells,t[18]=M):M=t[18];const z=E&&"bg-[var(--slate-2)] border-r",T=i&&"disable-animation",L=!n.maxWidth&&"min-w-[800px]";let I,H,A,W,q,B,G,F;t[19]!==z||t[20]!==T||t[21]!==L?(I=g("w-full mx-auto bg-background flex-1 min-h-full",z,T,L),t[19]=z,t[20]=T,t[21]=L,t[22]=I):I=t[22],t[23]!==i?(H=i?[20,20]:void 0,t[23]=i,t[24]=H):H=t[24],t[25]!==r||t[26]!==n?(A=e=>r({...n,cells:e}),t[25]=r,t[26]=n,t[27]=A):A=t[27],t[28]!==c?(W=c?{i:c.i,w:c.w||2,h:c.h||2}:void 0,t[28]=c,t[29]=W):W=t[29],t[30]!==O||t[31]!==r||t[32]!==n?(q=(e,t,o)=>{O.onDragStop(),t&&r({...n,cells:[...e,t]})},t[30]=O,t[31]=r,t[32]=n,t[33]=q):q=t[33],t[34]!==O?(B=(e,t,n,r,o)=>{O.onDragStart(o)},G=(e,t,n,r,o)=>{O.onDragMove(o)},F=()=>{O.onDragStop()},t[34]=O,t[35]=B,t[36]=G,t[37]=F):(B=t[35],G=t[36],F=t[37]);let Y=y.jsx(qa,{breakpoint:"lg",layouts:M,style:P,cols:b,allowOverlap:!1,className:I,containerPadding:H,margin:Ba,isBounded:!1,compactType:null,preventCollision:!0,rowHeight:n.rowHeight,onLayoutChange:A,droppingItem:W,onDrop:q,onDragStart:B,onDrag:G,onDragStop:F,onResizeStop:Qa,isDraggable:E,isDroppable:E,isResizable:E,draggableHandle:E?`.${Ga}`:"noop",children:o.filter((e=>s.has(e.id))).map((e=>{const t=D.get(e.id),o=n.scrollableCells.has(e.id)??!1,i=n.cellSide.get(e.id),s=y.jsx(Fa,{code:e.code,mode:a,cellId:e.id,output:e.output,status:e.status,isScrollable:o,side:i,hidden:e.errored||e.interrupted||e.stopped});return E?y.jsx(Ua,{id:e.id,isDragging:j,side:i,setSide:R(e.id),isScrollable:o,setIsScrollable:N(e.id),display:0===(null==t?void 0:t.y)?"bottom":"top",onDelete:()=>{r({...n,cells:n.cells.filter((t=>t.i!==e.id))})},children:s},e.id):y.jsx("div",{children:s},e.id)}))});if(i)return n.bordered&&(Y=y.jsx("div",{className:"flex flex-1 flex-col items-center",children:y.jsx("div",{style:P,className:"bg-background flex-1 border-t border-x rounded-t shadow-sm w-full overflow-hidden",children:Y})})),Y;const U=o.filter((e=>!s.has(e.id)));let V,X,$,K;n.bordered&&(Y=y.jsx("div",{style:P,className:"bg-background border-t border-x rounded-t shadow-sm w-full mx-auto mt-4 h-[calc(100%-1rem)] overflow-hidden",children:y.jsx("div",{className:"h-full overflow-auto",children:Y})})),t[38]!==n||t[39]!==r||t[40]!==d?(V=y.jsx(Ya,{layout:n,setLayout:r,isLocked:d,setIsLocked:p}),t[38]=n,t[39]=r,t[40]=d,t[41]=V):V=t[41],t[42]===Symbol.for("react.memo_cache_sentinel")?(X=g("relative flex z-10 flex-1 overflow-hidden"),$=g("flex-grow overflow-auto transparent-when-disconnected"),t[42]=X,t[43]=$):(X=t[42],$=t[43]),t[44]!==Y?(K=y.jsx("div",{className:$,children:Y}),t[44]=Y,t[45]=K):K=t[45];let Q,Z;t[46]===Symbol.for("react.memo_cache_sentinel")?(Q=y.jsx("div",{className:"text font-bold text-[var(--slate-20)] flex-shrink-0",children:"Outputs"}),t[46]=Q):Q=t[46],t[47]!==n.columns||t[48]!==n.rowHeight||t[49]!==a?(Z=e=>y.jsx("div",{draggable:!0,unselectable:"on","data-cell-id":e.id,onDragStart:t=>{const r=t.currentTarget.offsetHeight;u({i:e.id,w:n.columns/4,h:Math.ceil(r/n.rowHeight)||1}),t.dataTransfer.setData("text/plain","")},className:g(Ga,"droppable-element bg-background border-border border overflow-hidden p-2 rounded flex-shrink-0"),children:y.jsx(Fa,{code:e.code,className:"select-none pointer-events-none",mode:a,cellId:e.id,output:e.output,isScrollable:!1,status:e.status,hidden:!1})},e.id),t[47]=n.columns,t[48]=n.rowHeight,t[49]=a,t[50]=Z):Z=t[50];const J=U.map(Z);let ee,te,ne;return t[51]!==Q||t[52]!==J?(ee=y.jsxs("div",{className:"flex-none flex flex-col w-[300px] p-2 pb-20 gap-2 overflow-auto bg-[var(--slate-2)] border-t border-x rounded-t shadow-sm transparent-when-disconnected mx-2 mt-4",children:[Q,J]}),t[51]=Q,t[52]=J,t[53]=ee):ee=t[53],t[54]!==X||t[55]!==K||t[56]!==ee?(te=y.jsxs("div",{className:X,children:[K,ee]}),t[54]=X,t[55]=K,t[56]=ee,t[57]=te):te=t[57],t[58]!==V||t[59]!==te?(ne=y.jsxs(y.Fragment,{children:[V,te]}),t[58]=V,t[59]=te,t[60]=ne):ne=t[60],ne},getInitialLayout:()=>({columns:24,rowHeight:20,maxWidth:1400,bordered:!0,scrollableCells:new Set,cellSide:new Map,cells:[]})},Ja=e=>{const t=h(15),{invisible:n,appConfig:r,className:o,children:a,innerClassName:i}=e;let s;t[0]!==o?(s=g("px-1 sm:px-16 md:px-20 xl:px-24 print:px-0 print:pb-0",o),t[0]=o,t[1]=s):s=t[1];const l="compact"===r.width&&"max-w-contentWidth min-w-[400px]",c="medium"===r.width&&"max-w-contentWidthMedium min-w-[400px]",u="columns"===r.width&&"w-fit",d="full"===r.width&&"max-w-full",p=n&&"invisible";let f,m,b;return t[2]!==l||t[3]!==c||t[4]!==u||t[5]!==d||t[6]!==p||t[7]!==i?(f=g("m-auto pb-24 sm:pb-12",l,c,u,d,p,i),t[2]=l,t[3]=c,t[4]=u,t[5]=d,t[6]=p,t[7]=i,t[8]=f):f=t[8],t[9]!==f||t[10]!==a?(m=y.jsx("div",{className:f,children:a}),t[9]=f,t[10]=a,t[11]=m):m=t[11],t[12]!==s||t[13]!==m?(b=y.jsx("div",{className:s,children:m}),t[12]=s,t[13]=m,t[14]=b):b=t[14],b};function ei(e,t){const[n,r]=l.useState(!0);return l.useEffect((()=>{const n=Math.max(Math.min(15*(e-1),100),0),o=setTimeout((()=>{r(!1),"read"!==t&&requestAnimationFrame((()=>{!function(){var e;const{cellIds:t,cellData:n,cellHandles:r}=L();for(const o of t.iterateTopLevelIds){const t=r[o];if(!n[o].config.hide_code&&(null==(e=null==t?void 0:t.current)?void 0:e.editorView))return void t.current.editorView.focus()}}()}))}),n);return()=>clearTimeout(o)}),[]),{invisible:n}}const ti=e=>{const t=h(13);let n,r,o,a;t[0]!==e?(({value:n,onChange:r,placeholder:o,...a}=e),t[0]=e,t[1]=n,t[2]=r,t[3]=o,t[4]=a):(n=t[1],r=t[2],o=t[3],a=t[4]);const i=l.useRef(null),s=ri(n,r);let c;t[5]!==s.onBlur?(c=()=>{const e=s.onBlur,t=i.current;if(t)return t.addEventListener("blur",e),()=>{t.removeEventListener("blur",e)}},t[5]=s.onBlur,t[6]=c):c=t[6],I(c);const u=s.value,d=s.onChange;let p,f;return t[7]===Symbol.for("react.memo_cache_sentinel")?(p=A.onEnter(A.stopPropagation()),t[7]=p):p=t[7],t[8]!==s.value||t[9]!==s.onChange||t[10]!==o||t[11]!==a?(f=y.jsx(H,{"data-testid":"cell-name-input",value:u,onChange:d,ref:i,placeholder:o,className:"shadow-none! hover:shadow-none focus:shadow-none focus-visible:shadow-none",onKeyDown:p,...a}),t[8]=s.value,t[9]=s.onChange,t[10]=o,t[11]=a,t[12]=f):f=t[12],f},ni=e=>{const t=h(11),{value:n,cellId:r,className:o}=e,{updateCellName:a}=W();let i;t[0]!==a||t[1]!==r?(i=e=>a({cellId:r,name:e}),t[0]=a,t[1]=r,t[2]=i):i=t[2];const s=ri(n,i);if(n===q)return null;let l;t[3]!==o?(l=g("outline-none border hover:border-cyan-500/40 focus:border-cyan-500/40",o),t[3]=o,t[4]=l):l=t[4];const c=s.onChange,u=s.onBlur;let d,p;return t[5]===Symbol.for("react.memo_cache_sentinel")?(d=A.onEnter(oi),t[5]=d):d=t[5],t[6]!==l||t[7]!==s.onChange||t[8]!==s.onBlur||t[9]!==n?(p=y.jsx(Y,{content:"Click to rename",children:y.jsx("span",{className:l,contentEditable:!0,suppressContentEditableWarning:!0,onChange:c,onBlur:u,onKeyDown:d,children:n})}),t[6]=l,t[7]=s.onChange,t[8]=s.onBlur,t[9]=n,t[10]=p):p=t[10],p};function ri(e,t){const n=h(9),[r,o]=l.useState(e);let a;n[0]!==e||n[1]!==t?(a=n=>{if(n===e)return;if(!n||n===q)return void t(n);const r=B(n,G());t(r)},n[0]=e,n[1]=t,n[2]=a):a=n[2];const i=a,s=r===q?"":r;let c,u,d;return n[3]===Symbol.for("react.memo_cache_sentinel")?(c=e=>{const t=e.target.value,n=F(t);o(n)},n[3]=c):c=n[3],n[4]!==i?(u=e=>{if(e.target instanceof HTMLInputElement){const t=e.target.value;i(F(t))}else if(e.target instanceof HTMLSpanElement){const t=e.target.innerText.trim();i(F(t))}},n[4]=i,n[5]=u):u=n[5],n[6]!==s||n[7]!==u?(d={value:s,onChange:c,onBlur:u},n[6]=s,n[7]=u,n[8]=d):d=n[8],d}function oi(e){e.target instanceof HTMLElement&&e.target.blur()}const ai=new U,ii=e=>{const t=h(31),n=v.useRef(null),{consoleOutputs:r,stale:o,cellName:a,cellId:i,onSubmitDebugger:s,onRefactorWithAI:c,className:u}=e,d=r.length>0;let p;if(t[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{const e=n.current;if(!e)return;const t=e.scrollHeight-e.clientHeight;t-e.scrollTop<120&&(e.scrollTop=t)},t[0]=p):p=t[0],l.useLayoutEffect(p),!d&&a===q)return null;const f=si;let m,b,w,x,S,_,O;if(t[1]!==r||t[2]!==o||t[3]!==n||t[4]!==d||t[5]!==u||t[6]!==s||t[7]!==c){const e=[...r].reverse();m=o?"This console output is stale":void 0,b="console-output-area",w=n;const a=o&&"marimo-output-stale",i=d?"p-5":"p-3";let l;t[13]!==a||t[14]!==i||t[15]!==u?(x=g("console-output-area overflow-hidden rounded-b-lg flex flex-col-reverse w-full",a,i,u),t[13]=a,t[14]=i,t[15]=u,t[16]=x):x=t[16],t[17]!==r.length||t[18]!==s||t[19]!==c?(l=(e,t)=>{if("pdb"===e.channel)return null;const n=r.length-t-1;return"stdin"===e.channel?(V("string"==typeof e.data,"Expected data to be a string"),null==e.response?y.jsxs("div",{className:"flex gap-2 items-center",children:[f(e.data),y.jsx(H,{"data-testid":"console-input",type:"text",autoComplete:"off",autoFocus:!0,className:"m-0",placeholder:"stdin",onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||s(e.currentTarget.value,n)}})]},t):y.jsxs("div",{className:"flex gap-2 items-center",children:[f(e.data),y.jsx("span",{className:"text-[var(--sky-11)]",children:e.response})]},t)):y.jsx(v.Fragment,{children:y.jsx(X,{onRefactorWithAI:c,message:e})},t)},t[17]=r.length,t[18]=s,t[19]=c,t[20]=l):l=t[20],S=e.map(l),t[1]=r,t[2]=o,t[3]=n,t[4]=d,t[5]=u,t[6]=s,t[7]=c,t[8]=m,t[9]=b,t[10]=w,t[11]=x,t[12]=S}else m=t[8],b=t[9],w=t[10],x=t[11],S=t[12];return t[21]!==a||t[22]!==i?(_=y.jsx(ni,{value:a,cellId:i,className:"bg-[var(--slate-4)] border-[var(--slate-4)] hover:bg-[var(--slate-5)] dark:border-[var(--sky-5)] dark:bg-[var(--sky-6)] dark:text-[var(--sky-12)] text-[var(--slate-12)] rounded-tl rounded-br-lg absolute right-0 bottom-0 text-xs px-1.5 py-0.5 font-mono"}),t[21]=a,t[22]=i,t[23]=_):_=t[23],t[24]!==m||t[25]!==b||t[26]!==w||t[27]!==x||t[28]!==S||t[29]!==_?(O=y.jsxs("div",{title:m,"data-testid":b,ref:w,className:x,children:[S,_]}),t[24]=m,t[25]=b,t[26]=w,t[27]=x,t[28]=S,t[29]=_,t[30]=O):O=t[30],O};function si(e){return y.jsx("span",{dangerouslySetInnerHTML:{__html:ai.ansi_to_html(e)}})}const li=/\/@file\/([^\s/]+)\.([\dA-Za-z]+)/g;class ci{static get INSTANCE(){const e="_marimo_private_VirtualFileTracker";return window[e]||(window[e]=new ci),window[e]}constructor(){this.virtualFiles=new Map}track(e){const t=e.output,n=e.cell_id;if(t)switch(t.mimetype){case"application/json":case"text/html":{const e=this.virtualFiles.get(n),r=function(e){if(!e)return new Set;const t=new Set,n=("string"==typeof e?e:JSON.stringify(e)).match(li);if(n)for(const r of n)t.add(r);return t}(t.data);return null==e||e.forEach((e=>r.add(e))),void this.virtualFiles.set(n,r)}default:return}}filenames(){const e=new Set;for(const t of this.virtualFiles.values())t.forEach((t=>e.add(t)));return[...e]}removeForCellId(e){this.virtualFiles.delete(e)}}async function ui(e){const{filename:t,includeCode:n}=e,r=await $({download:!0,includeCode:n,files:ci.INSTANCE.filenames()}),o=K.basename(t)??"notebook.py";Q(new Blob([r],{type:"text/html"}),Z.toHTML(o))}function di(e){const t=h(5),[n,r]=l.useState(void 0),o=l.useRef(null),a=l.useRef(null);let i,s,c;return t[0]!==e?(i=()=>{if(0===e.length)return;return o.current=new IntersectionObserver((e=>{let t;if(t=!1,e.forEach((e=>{const n=e.target;e.isIntersecting?(!a.current||n.getBoundingClientRect().top<a.current.getBoundingClientRect().top)&&(a.current=n,t=!0):n===a.current&&(a.current=null,t=!0)})),t&&a.current){const e=ee(a.current),t="id"in e?e.id:e.path;r(t)}}),{root:"edit"===J?document.getElementById("App"):void 0,rootMargin:"0px",threshold:0}),e.forEach((e=>{var t;e&&(null==(t=o.current)||t.observe(e[0]))})),()=>{o.current&&o.current.disconnect(),a.current=null}},s=[e],t[0]=e,t[1]=i,t[2]=s):(i=t[1],s=t[2]),l.useEffect(i,s),t[3]!==n?(c={activeHeaderId:n},t[3]=n,t[4]=c):c=t[4],c}function pi(e){if(0===e.length)return[];const t=new Map;return e.map((e=>{const n="id"in e.by?e.by.id:e.by.path,r=t.get(n)??0;t.set(n,r+1);const o=hi(e,r);return o?[o,n]:null})).filter(Boolean)}function fi(e,t){const n=hi(e,t);n?(n.scrollIntoView({behavior:"smooth",block:"start"}),n.classList.add("outline-item-highlight"),setTimeout((()=>{n.classList.remove("outline-item-highlight")}),3e3)):a.warn("Could not find element for outline item",e)}function hi(e,t){if("id"in e.by){return document.querySelectorAll(`[id="${CSS.escape(e.by.id)}"]`)[t]}return document.evaluate(e.by.path,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}const mi=()=>{const e=h(17),{items:t}=te(ne);let n;e[0]!==t?(n=pi(t),e[0]=t,e[1]=n):n=e[1];const{activeHeaderId:r}=di(n),[o,a]=v.useState(!1);if(t.length<2)return null;let i,s,l;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=()=>a(!0),s=()=>a(!1),l=g("fixed top-[25vh] right-8 z-[10000]","hidden md:block"),e[2]=i,e[3]=s,e[4]=l):(i=e[2],s=e[3],l=e[4]);const c=o?"-left-[280px] opacity-100":"left-[300px] opacity-0";let u,d,p,f;return e[5]!==c?(u=g("-top-4 max-h-[70vh] bg-background rounded-lg shadow-lg absolute overflow-auto transition-all duration-300 w-[300px] border",c),e[5]=c,e[6]=u):u=e[6],e[7]!==u||e[8]!==t||e[9]!==r?(d=y.jsx(yi,{className:u,items:t,activeHeaderId:r}),e[7]=u,e[8]=t,e[9]=r,e[10]=d):d=e[10],e[11]!==t||e[12]!==r?(p=y.jsx(gi,{items:t,activeHeaderId:r}),e[11]=t,e[12]=r,e[13]=p):p=e[13],e[14]!==d||e[15]!==p?(f=y.jsxs("div",{onMouseEnter:i,onMouseLeave:s,className:l,children:[d,p]}),e[14]=d,e[15]=p,e[16]=f):f=e[16],f},gi=e=>{const t=h(7),{items:n,activeHeaderId:r}=e;let o,a,i;if(t[0]!==r||t[1]!==n){const e=new Map;o="flex flex-col gap-4 items-end max-h-[70vh] overflow-hidden",a=n.map(((t,n)=>{const o="id"in t.by?t.by.id:t.by.path,a=e.get(o)??0;return e.set(o,a+1),y.jsx("div",{className:g("h-[2px] bg-muted-foreground/60",1===t.level&&"w-5",2===t.level&&"w-4",3===t.level&&"w-3",4===t.level&&"w-2",r===o&&"bg-foreground"),onClick:()=>fi(t,a)},`${o}-${n}`)})),t[0]=r,t[1]=n,t[2]=o,t[3]=a}else o=t[2],a=t[3];return t[4]!==o||t[5]!==a?(i=y.jsx("div",{className:o,children:a}),t[4]=o,t[5]=a,t[6]=i):i=t[6],i},yi=e=>{const t=h(10),{items:n,activeHeaderId:r,className:o}=e;let a,i,s;if(t[0]!==o||t[1]!==r||t[2]!==n){const e=new Map;t[5]!==o?(a=g("flex flex-col overflow-auto py-4 pl-2",o),t[5]=o,t[6]=a):a=t[6],i=n.map(((t,n)=>{const o="id"in t.by?t.by.id:t.by.path,a=e.get(o)??0;return e.set(o,a+1),y.jsx("div",{className:g("px-2 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l",1===t.level&&"font-semibold",2===t.level&&"ml-3",3===t.level&&"ml-6",4===t.level&&"ml-9",r===o&&"text-accent-foreground"),onClick:()=>fi(t,a),children:t.name},`${o}-${n}`)})),t[0]=o,t[1]=r,t[2]=n,t[3]=a,t[4]=i}else a=t[3],i=t[4];return t[7]!==a||t[8]!==i?(s=y.jsx("div",{className:a,children:i}),t[7]=a,t[8]=i,t[9]=s):s=t[9],s},bi=e=>{const t=h(10),{canShowCode:n,showCode:r,onToggleShowCode:o}=e,a=xi,i=Si;let s,l,c,u,d,p;return t[0]===Symbol.for("react.memo_cache_sentinel")?(s=g("right-0 top-0 z-50 m-4 no-print flex gap-2 print:hidden",de()?"absolute":"fixed"),t[0]=s):s=t[0],t[1]===Symbol.for("react.memo_cache_sentinel")?(l=y.jsx(R,{asChild:!0,children:y.jsx(fe,{variant:"secondary",size:"xs",children:y.jsx(Ot,{className:"w-4 h-4"})})}),t[1]=l):l=t[1],t[2]!==n||t[3]!==r||t[4]!==o?(c=n&&y.jsxs(y.Fragment,{children:[y.jsxs(O,{onSelect:o,id:"notebook-action-show-code",children:[y.jsx(he,{className:"mr-2",size:14,strokeWidth:1.5}),y.jsx("span",{className:"flex-1",children:"Show code"}),r&&y.jsx(E,{className:"h-4 w-4"})]}),y.jsx(me,{})]}),t[2]=n,t[3]=r,t[4]=o,t[5]=c):c=t[5],t[6]===Symbol.for("react.memo_cache_sentinel")?(u=y.jsxs(O,{onSelect:i,id:"notebook-action-download-html",children:[y.jsx(jt,{className:"mr-2",size:14,strokeWidth:1.5}),"Download as HTML"]}),t[6]=u):u=t[6],t[7]===Symbol.for("react.memo_cache_sentinel")?(d=y.jsxs(O,{onSelect:a,id:"notebook-action-download-png",children:[y.jsx(Ct,{className:"mr-2",size:14,strokeWidth:1.5}),"Download as PNG"]}),t[7]=d):d=t[7],t[8]!==c?(p=y.jsx("div",{id:"notebook-actions-dropdown",className:s,children:y.jsxs(M,{modal:!1,children:[l,y.jsxs(P,{align:"end",className:"no-print w-[220px]",children:[c,u,d]})]})}),t[8]=c,t[9]=p):p=t[9],p},vi=l.memo((e=>{const t=h(47),{output:n,consoleOutputs:r,cellOutputArea:o,cellId:a,status:i,stopped:s,errored:c,config:u,interrupted:d,staleInputs:p,runStartTimestamp:f,code:m,showCode:b,mode:v,name:w,kiosk:x}=e,S=l.useRef(null);let _;t[0]!==i||t[1]!==n||t[2]!==d||t[3]!==f||t[4]!==p?(_=re({status:i,output:n,interrupted:d,runStartTimestamp:f,staleInputs:p},!1),t[0]=i,t[1]=n,t[2]=d,t[3]=f,t[4]=p,t[5]=_):_=t[5];const O=_,j=x&&"present"!==v;let E,C;if(t[6]!==m||t[7]!==b||t[8]!==j||t[9]!==v||t[10]!==c||t[11]!==s){C=(new oe).isSupported(m);const e=!b&&!j;E=g("Cell","hover-actions-parent empty:invisible",{published:e,interactive:"edit"===v,"has-error":c,stopped:s,borderless:C&&!e}),t[6]=m,t[7]=b,t[8]=j,t[9]=v,t[10]=c,t[11]=s,t[12]=E,t[13]=C}else E=t[12],C=t[13];const N=E;let k;t[14]!==a?(k=ae.create(a),t[14]=a,t[15]=k):k=t[15];const R=k;if("read"===v&&b||j){let e;t[16]!==n||t[17]!==a||t[18]!==O?(e=y.jsx(D,{allowExpand:!0,output:n,className:"output-area",cellId:a,stale:O}),t[16]=n,t[17]=a,t[18]=O,t[19]=e):e=t[19];const i=e,s=""===m.trim(),l="above"===o&&i;let c;t[20]!==C||t[21]!==s||t[22]!==u||t[23]!==x||t[24]!==m?(c=!C&&!s&&y.jsx("div",{className:"tray",children:y.jsx(ie,{initiallyHideCode:u.hide_code||x,code:m})}),t[20]=C,t[21]=s,t[22]=u,t[23]=x,t[24]=m,t[25]=c):c=t[25];const d="below"===o&&i;let p,f;return t[26]!==r||t[27]!==O||t[28]!==w||t[29]!==a?(p=y.jsx(ii,{consoleOutputs:r,stale:O,cellName:w,onSubmitDebugger:_i,cellId:a,debuggerActive:!1}),t[26]=r,t[27]=O,t[28]=w,t[29]=a,t[30]=p):p=t[30],t[31]!==R||t[32]!==N||t[33]!==l||t[34]!==c||t[35]!==d||t[36]!==p?(f=y.jsxs("div",{tabIndex:-1,id:R,ref:S,className:N,children:[l,c,d,p]}),t[31]=R,t[32]=N,t[33]=l,t[34]=c,t[35]=d,t[36]=p,t[37]=f):f=t[37],f}const P=se(null==n?void 0:n.mimetype);if(c||d||s||P)return null;const M="edit"===v;let z,T;return t[38]!==M||t[39]!==n||t[40]!==a||t[41]!==O?(z=y.jsx(D,{allowExpand:M,output:n,className:"output-area",cellId:a,stale:O}),t[38]=M,t[39]=n,t[40]=a,t[41]=O,t[42]=z):z=t[42],t[43]!==R||t[44]!==N||t[45]!==z?(T=y.jsx("div",{tabIndex:-1,id:R,ref:S,className:N,children:z}),t[43]=R,t[44]=N,t[45]=z,t[46]=T):T=t[46],T}));vi.displayName="VerticalCell";const wi={type:"vertical",name:"Vertical",validator:T.any(),Component:e=>{const t=h(33),{cells:n,appConfig:r,mode:o}=e,{invisible:a}=ei(n.length,o),i=te(le),[s]=ce(),c=new URLSearchParams(window.location.search),u=c.get(ue.showCode);let d;t[0]!==u||t[1]!==i?(d=()=>null===u?de()||pe()||i:"true"===u,t[0]=u,t[1]=i,t[2]=d):d=t[2];const[p,f]=l.useState(d),m=(()=>{const e=n.some((e=>Boolean(e.code)));if(i)return!0;const t=c.get(ue.includeCode);return"read"===o&&"false"!==t&&e})();let g,b;if(t[3]!==s.display.cell_output||t[4]!==p||t[5]!==m||t[6]!==o||t[7]!==i||t[8]!==n){let e;t[10]!==s.display.cell_output||t[11]!==p||t[12]!==m||t[13]!==o||t[14]!==i?(e=e=>y.jsx(vi,{cellId:e.id,output:e.output,consoleOutputs:e.consoleOutputs,status:e.status,code:e.code,config:e.config,cellOutputArea:s.display.cell_output,stopped:e.stopped,showCode:p&&m,errored:e.errored,mode:o,runStartTimestamp:e.runStartTimestamp,interrupted:e.interrupted,staleInputs:e.staleInputs,name:e.name,kiosk:i},e.id),t[10]=s.display.cell_output,t[11]=p,t[12]=m,t[13]=o,t[14]=i,t[15]=e):e=t[15],g=n.map(e),t[3]=s.display.cell_output,t[4]=p,t[5]=m,t[6]=o,t[7]=i,t[8]=n,t[9]=g}else g=t[9];t[16]!==g?(b=y.jsx(y.Fragment,{children:g}),t[16]=g,t[17]=b):b=t[17];const v=b;let w,x,S,_;return t[18]!==p||t[19]!==m||t[20]!==v?(w=p&&m?y.jsxs("div",{className:"flex flex-col gap-5",children:[" ",v]}):v,t[18]=p,t[19]=m,t[20]=v,t[21]=w):w=t[21],t[22]!==o||t[23]!==f||t[24]!==m||t[25]!==p?(x="read"===o&&y.jsx(bi,{canShowCode:m,showCode:p,onToggleShowCode:()=>f((e=>!e))}),t[22]=o,t[23]=f,t[24]=m,t[25]=p,t[26]=x):x=t[26],t[27]===Symbol.for("react.memo_cache_sentinel")?(S=y.jsx(mi,{}),t[27]=S):S=t[27],t[28]!==a||t[29]!==r||t[30]!==w||t[31]!==x?(_=y.jsxs(Ja,{invisible:a,appConfig:r,children:[w,x,S]}),t[28]=a,t[29]=r,t[30]=w,t[31]=x,t[32]=_):_=t[32],_},deserializeLayout:e=>e,serializeLayout:e=>e,getInitialLayout:()=>null};async function xi(){const e=document.getElementById("App");e&&await ge(e,document.title)}async function Si(){document.getElementById("App")&&await ui({filename:document.title,includeCode:!0})}function _i(){return null}const Oi=v.lazy((()=>ye((()=>import("./slides-component-Ca58bUzf.js")),__vite__mapDeps([0,1,2,3]),import.meta.url))),ji=l.memo((e=>{const t=h(4),{output:n,cellId:r,status:o}=e,a="running"===o||"queued"===o;let i;return t[0]!==n||t[1]!==r||t[2]!==a?(i=y.jsx(D,{className:"contents",allowExpand:!1,output:n,cellId:r,stale:a}),t[0]=n,t[1]=r,t[2]=a,t[3]=i):i=t[3],i}));ji.displayName="Slide";const Ei=[Za,{type:"slides",name:"Slides",validator:T.object({}),deserializeLayout:(e,t)=>({}),serializeLayout:(e,t)=>({}),Component:e=>{const t=h(11),{cells:n,mode:r}=e,o="read"===r;let a,i;if(t[0]!==r||t[1]!==n){let e;t[3]!==r?(e=e=>null==e.output||""===e.output.data?null:y.jsx(ji,{cellId:e.id,code:e.code,status:e.status,output:e.output,mode:r},e.id),t[3]=r,t[4]=e):e=t[4],a=n.map(e),t[0]=r,t[1]=n,t[2]=a}else a=t[2];t[5]!==a?(i=y.jsx(Oi,{forceKeyboardNavigation:!0,children:a}),t[5]=a,t[6]=i):i=t[6];const s=i;if(o){let e;return t[7]!==s?(e=y.jsx("div",{className:"p-4",children:s}),t[7]=s,t[8]=e):e=t[8],e}let l;return t[9]!==s?(l=y.jsx("div",{className:"pr-9",children:s}),t[9]=s,t[10]=l):l=t[10],l},getInitialLayout:()=>({})},wi];function Di(){return{selectedLayout:"vertical",layoutData:{}}}const{valueAtom:Ci,useActions:Ni}=be(Di,{setLayoutView:(e,t)=>({...e,selectedLayout:t}),setLayoutData:(e,t)=>({...e,selectedLayout:t.layoutView,layoutData:{...e.layoutData,[t.layoutView]:t.data}}),setCurrentLayoutData:(e,t)=>({...e,layoutData:{...e.layoutData,[e.selectedLayout]:t}})}),ki=()=>te(Ci),Ri=()=>Ni();function Pi(){const e=L(),{layoutData:t,selectedLayout:n}=ve.get(Ci);if("vertical"===n)return;if(void 0===t)return;const r=t[n],o=Ei.find((e=>e.type===n));if(void 0!==o)return{type:n,data:o.serializeLayout(r,we(e))};a.error(`Unknown layout type: ${n}`)}const Mi=["vertical","grid","slides"],zi=["slides"],Ti=l.memo((e=>{const t=h(21),{appConfig:n,mode:r,children:o}=e,a=xe(),{selectedLayout:i,layoutData:s}=ki(),{setCurrentLayoutData:l}=Ri(),c=te(le);if("edit"===r&&!c)return o;let u;u=i;const d=new URLSearchParams(window.location.search);if("read"===r&&d.has(ue.viewAs)){const e=d.get(ue.viewAs);zi.includes(e)&&(u=e)}let p,f,m,g,b,v,w;if(t[0]!==u||t[1]!==o||t[2]!==a||t[3]!==n||t[4]!==r||t[5]!==s){v=Symbol.for("react.early_return_sentinel");e:{const e=u;let i;t[12]!==e?(i=e=>e.type===u,t[12]=e,t[13]=i):i=t[13];const l=Ei.find(i);if(!l){v=o;break e}const c=Se(a);p=l.Component,f=n,m=r,g=c,b=s[u]||l.getInitialLayout(c)}t[0]=u,t[1]=o,t[2]=a,t[3]=n,t[4]=r,t[5]=s,t[6]=p,t[7]=f,t[8]=m,t[9]=g,t[10]=b,t[11]=v}else p=t[6],f=t[7],m=t[8],g=t[9],b=t[10],v=t[11];if(v!==Symbol.for("react.early_return_sentinel"))return v;t[14]!==p||t[15]!==f||t[16]!==m||t[17]!==g||t[18]!==b||t[19]!==l?(w=y.jsx(p,{appConfig:f,mode:m,cells:g,layout:b,setLayout:l}),t[14]=p,t[15]=f,t[16]=m,t[17]=g,t[18]=b,t[19]=l,t[20]=w):w=t[20];return w}));Ti.displayName="CellsRenderer";let Li=function(e){return e.CONNECTING="CONNECTING",e.OPEN="CONNECTED",e.CLOSING="CLOSING",e.CLOSED="CLOSED",e}({}),Ii=function(e){return e.KERNEL_DISCONNECTED="KERNEL_DISCONNECTED",e.ALREADY_RUNNING="ALREADY_RUNNING",e.MALFORMED_QUERY="MALFORMED_QUERY",e}({});function Hi(){const{cellRuntime:e}=ve.get(_e),t=_.entries(e).find((([e,t])=>"running"===t.status));t&&Oe(t[0],"focus")}const Ai=e=>{const t=h(14),{connection:n,isRunning:r}=e;let o,a,i,s,l;return t[0]!==n.state||t[1]!==r?(o=n.state===Li.OPEN&&r&&y.jsx(Gi,{}),t[0]=n.state,t[1]=r,t[2]=o):o=t[2],t[3]!==n?(a=n.state===Li.CLOSED&&!n.canTakeover&&y.jsx(Fi,{}),t[3]=n,t[4]=a):a=t[4],t[5]!==n?(i=n.state===Li.CLOSED&&!n.canTakeover&&y.jsx(qi,{}),t[5]=n,t[6]=i):i=t[6],t[7]!==n?(s=n.state===Li.CLOSED&&n.canTakeover&&y.jsx(Bi,{}),t[7]=n,t[8]=s):s=t[8],t[9]!==o||t[10]!==a||t[11]!==i||t[12]!==s?(l=y.jsxs(y.Fragment,{children:[o,a,i,s]}),t[9]=o,t[10]=a,t[11]=i,t[12]=s,t[13]=l):l=t[13],l},Wi="absolute top-4 left-4 m-0 flex items-center space-x-3 min-h-[28px] no-print pointer-events-auto z-50 hover:cursor-pointer",qi=()=>y.jsx(Y,{content:"App disconnected",children:y.jsx("div",{className:Wi,children:y.jsx(Pt,{className:"w-[25px] h-[25px] text-[var(--red-11)]"})})}),Bi=()=>y.jsx(Y,{content:"Notebook locked",children:y.jsx("div",{className:Wi,children:y.jsx(k,{className:"w-[25px] h-[25px] text-[var(--blue-11)]"})})}),Gi=()=>y.jsx(Y,{content:"Jump to running cell",side:"right",children:y.jsx("div",{className:Wi,"data-testid":"loading-indicator",onClick:Hi,children:y.jsx(Dt,{className:"running-app-icon",size:30,strokeWidth:1})})}),Fi=()=>y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"noise"}),y.jsx("div",{className:"disconnected-gradient"})]}),Yi=Te,Ui=Le,Vi=je(Ee),Xi=v.forwardRef(((e,t)=>{const n=h(9);let r,o,a,i;return n[0]!==e?(({className:r,...o}=e),n[0]=e,n[1]=r,n[2]=o):(r=n[1],o=n[2]),n[3]!==r?(a=g("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),n[3]=r,n[4]=a):a=n[4],n[5]!==a||n[6]!==o||n[7]!==t?(i=y.jsx(De,{className:a,...o,ref:t}),n[5]=a,n[6]=o,n[7]=t,n[8]=i):i=n[8],i}));Xi.displayName=De.displayName;const $i=Pe("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Ki=v.forwardRef(((e,t)=>{const n=h(15);let r,o,a,i;n[0]!==e?(({side:r,className:o,children:i,...a}=e),n[0]=e,n[1]=r,n[2]=o,n[3]=a,n[4]=i):(r=n[1],o=n[2],a=n[3],i=n[4]);const s=void 0===r?"right":r;let l,c,u,d;return n[5]===Symbol.for("react.memo_cache_sentinel")?(l=y.jsx(Xi,{}),n[5]=l):l=n[5],n[6]!==s||n[7]!==o?(c=g($i({side:s}),o),n[6]=s,n[7]=o,n[8]=c):c=n[8],n[9]===Symbol.for("react.memo_cache_sentinel")?(u=y.jsxs(Me,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[y.jsx(ze,{className:"h-4 w-4"}),y.jsx("span",{className:"sr-only",children:"Close"})]}),n[9]=u):u=n[9],n[10]!==t||n[11]!==c||n[12]!==a||n[13]!==i?(d=y.jsx(Vi,{children:y.jsxs(Ce,{children:[l,y.jsxs(Ne,{ref:t,className:c,...a,children:[i,u]})]})}),n[10]=t,n[11]=c,n[12]=a,n[13]=i,n[14]=d):d=n[14],d}));Ki.displayName=Ne.displayName;v.forwardRef(((e,t)=>{const n=h(9);let r,o,a,i;return n[0]!==e?(({className:r,...o}=e),n[0]=e,n[1]=r,n[2]=o):(r=n[1],o=n[2]),n[3]!==r?(a=g("text-lg font-semibold text-foreground",r),n[3]=r,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==o?(i=y.jsx(ke,{ref:t,className:a,...o}),n[5]=t,n[6]=a,n[7]=o,n[8]=i):i=n[8],i})).displayName=ke.displayName;v.forwardRef(((e,t)=>{const n=h(9);let r,o,a,i;return n[0]!==e?(({className:r,...o}=e),n[0]=e,n[1]=r,n[2]=o):(r=n[1],o=n[2]),n[3]!==r?(a=g("text-sm text-muted-foreground",r),n[3]=r,n[4]=a):a=n[4],n[5]!==t||n[6]!==a||n[7]!==o?(i=y.jsx(Re,{ref:t,className:a,...o}),n[5]=t,n[6]=a,n[7]=o,n[8]=i):i=n[8],i})).displayName=Re.displayName;const Qi=l.memo((()=>{const e=h(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=y.jsx(Ie,{name:He.SIDEBAR}),e[0]=t):t=e[0],t}));Qi.displayName="SidebarSlot";const Zi=()=>{const e=h(2);let t,n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=y.jsx(Ui,{className:"lg:hidden",asChild:!0,children:y.jsx(fe,{variant:"ghost",className:"bg-background",children:y.jsx(Nt,{className:"w-5 h-5"})})}),e[0]=t):t=e[0],e[1]===Symbol.for("react.memo_cache_sentinel")?(n=y.jsxs(Yi,{children:[t,y.jsx(Ki,{className:"w-full max-w-72 px-3 h-full flex flex-col",side:"left",children:y.jsx(Qi,{})})]}),e[1]=n):n=e[1],n},Ji=Ae({isOpen:!0},((e,t)=>t&&"toggle"===t.type?{...e,isOpen:t.isOpen}:e)),es=e=>{const t=h(7),{isOpen:n,toggle:r}=e,o=n?"rotate-0":"rotate-180";let a,i,s;return t[0]!==o?(a=g("h-5 w-5 transition-transform ease-in-out duration-700",o),t[0]=o,t[1]=a):a=t[1],t[2]!==a?(i=y.jsx(We,{className:a}),t[2]=a,t[3]=i):i=t[3],t[4]!==r||t[5]!==i?(s=y.jsx("div",{className:"invisible lg:visible absolute top-[12px] right-[16px] z-20",children:y.jsx(fe,{onClick:r,className:"w-10 h-8",variant:"ghost",size:"icon",children:i})}),t[4]=r,t[5]=i,t[6]=s):s=t[6],s},ts=e=>{const t=h(10),{isOpen:n,toggle:r}=e,o=n?"w-72":"w-[68px]";let a,i,s,l;return t[0]!==o?(a=g("app-sidebar auto-collapse-nav","absolute top-0 left-0 z-20 h-full -translate-x-full lg:translate-x-0 transition-[width] ease-in-out duration-300",o),t[0]=o,t[1]=a):a=t[1],t[2]!==n||t[3]!==r?(i=y.jsx(es,{isOpen:n,toggle:r}),t[2]=n,t[3]=r,t[4]=i):i=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(s=y.jsx("div",{className:"relative h-full flex flex-col px-3 pb-16 pt-14 overflow-y-auto shadow-sm border-l",children:y.jsx(Qi,{})}),t[5]=s):s=t[5],t[6]!==n||t[7]!==a||t[8]!==i?(l=y.jsxs("aside",{"data-expanded":n,className:a,children:[i,s]}),t[6]=n,t[7]=a,t[8]=i,t[9]=l):l=t[9],l},ns=e=>{const t=h(15),{children:n}=e,[r,o]=qe(Ji),{isOpen:a}=r;if(0===Be(He.SIDEBAR).length)return n;let i,s;t[0]!==o||t[1]!==a?(i=()=>o({type:"toggle",isOpen:!a}),t[0]=o,t[1]=a,t[2]=i):i=t[2],t[3]!==a||t[4]!==i?(s=y.jsx(ts,{isOpen:a,toggle:i}),t[3]=a,t[4]=i,t[5]=s):s=t[5];const l=a?"lg:ml-72":"lg:ml-[68px]";let c,u,d,p;return t[6]!==l?(c=g("h-full transition-[margin-left] ease-in-out duration-300 overflow-hidden relative",l),t[6]=l,t[7]=c):c=t[7],t[8]===Symbol.for("react.memo_cache_sentinel")?(u=y.jsx("div",{className:"absolute top-3 left-4 flex items-center z-50",children:y.jsx(Zi,{})}),t[8]=u):u=t[8],t[9]!==c||t[10]!==n?(d=y.jsxs("main",{className:c,children:[u,n]}),t[9]=c,t[10]=n,t[11]=d):d=t[11],t[12]!==s||t[13]!==d?(p=y.jsxs(y.Fragment,{children:[s,d]}),t[12]=s,t[13]=d,t[14]=p):p=t[14],p},rs=e=>{const t=h(10),{title:n}=e,[r,o]=l.useState(n),[a,i]=l.useState(!0);let s,c,u;t[0]!==n||t[1]!==r?(s=()=>{if(n!==r){i(!1);const e=setTimeout((()=>{o(n),i(!0)}),300);return()=>clearTimeout(e)}},c=[n,r],t[0]=n,t[1]=r,t[2]=s,t[3]=c):(s=t[2],c=t[3]),l.useEffect(s,c),t[4]===Symbol.for("react.memo_cache_sentinel")?(u=y.jsx(Ge,{className:"size-20 animate-spin text-primary","data-testid":"large-spinner",strokeWidth:1}),t[4]=u):u=t[4];const d=a?"opacity-100":"opacity-0";let p,f;return t[5]!==d?(p=g("mt-2 text-muted-foreground font-semibold text-lg transition-opacity duration-300",d),t[5]=d,t[6]=p):p=t[6],t[7]!==p||t[8]!==r?(f=y.jsxs("div",{className:"flex flex-col h-full flex-1 items-center justify-center p-4",children:[u,y.jsx("div",{className:p,children:r})]}),t[7]=p,t[8]=r,t[9]=f):f=t[9],f},os=e=>{const t=h(2),{children:n}=e;if(!pe())return n;let r;return t[0]!==n?(r=y.jsx(as,{children:n}),t[0]=n,t[1]=r):r=t[1],r},as=e=>{const t=h(3),{children:n}=e;let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];const{loading:o,error:a}=Fe(ss,r),i=te(Ye);if(o){let e;return t[1]===Symbol.for("react.memo_cache_sentinel")?(e=y.jsx(is,{}),t[1]=e):e=t[1],e}if(!i&&"read"===J&&Ue(ue.showCode,"false")){let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e=y.jsx(is,{}),t[2]=e):e=t[2],e}if(a)throw a;return n},is=e=>{const t=h(2),n=te(Xe);let r;return t[0]!==n?(r=y.jsx(rs,{title:n}),t[0]=n,t[1]=r):r=t[1],r};async function ss(){return await Ve.INSTANCE.initialized.promise,!0}const ls="./favicon.ico",cs="./circle-check.ico",us="./circle-play.ico",ds="./circle-x.ico";const ps=e=>{const t=h(8),{isRunning:n}=e,r=$e();let o;o=document.querySelector("link[rel~='icon']"),o||(o=document.createElement("link"),o.rel="icon",document.getElementsByTagName("head")[0].append(o)),l.useEffect((()=>{if(!n&&o.href.includes("favicon"))return;if(n)return void(o.href=us);if(o.href=0===r.length?cs:ds,!document.hasFocus())return;const e=setTimeout((()=>{o.href=ls}),3e3);return()=>{o.href=ls,clearTimeout(e)}}),[n,r,o]);const a=Ke(n)??n;let i,s;return t[0]!==a||t[1]!==n||t[2]!==r.length?(i=()=>{a&&!n&&function(e){if("visible"===document.visibilityState)return;const t=()=>{0===e?new Notification("Execution completed",{body:"Your notebook run completed successfully.",icon:cs}):new Notification("Execution failed",{body:`Your notebook run encountered ${e} error(s).`,icon:ds})};"Notification"in window&&"denied"!==Notification.permission&&("granted"===Notification.permission?t():"default"===Notification.permission&&Notification.requestPermission().then((e=>{"granted"===e&&t()})))}(r.length)},t[0]=a,t[1]=n,t[2]=r.length,t[3]=i):i=t[3],t[4]!==r||t[5]!==a||t[6]!==n?(s=[r,a,n],t[4]=r,t[5]=a,t[6]=n,t[7]=s):s=t[7],l.useEffect(i,s),Qe(window,"focus",(e=>{n||(o.href=ls)})),null},fs=e=>{const t=h(18),{width:n,connection:r,isRunning:o,children:a}=e,i=r.state;let s,l;t[0]!==o?(s=y.jsx(ps,{isRunning:o}),t[0]=o,t[1]=s):s=t[1],t[2]!==r||t[3]!==o?(l=y.jsx(Ai,{connection:r,isRunning:o}),t[2]=r,t[3]=o,t[4]=l):l=t[4];const c=i===Li.CLOSED&&"disconnected",u="full"===n&&"config-width-full",d="columns"===n?"overflow-x-auto":"overflow-x-hidden";let p,f,m;return t[5]!==c||t[6]!==u||t[7]!==d?(p=g(c,"bg-background w-full h-full text-textColor","flex flex-col overflow-y-auto",u,d,"print:height-fit"),t[5]=c,t[6]=u,t[7]=d,t[8]=p):p=t[8],t[9]!==n||t[10]!==i||t[11]!==p||t[12]!==a?(f=y.jsx(os,{children:y.jsx(ns,{children:y.jsx("div",{id:"App","data-config-width":n,"data-connection-state":i,className:p,children:a})})}),t[9]=n,t[10]=i,t[11]=p,t[12]=a,t[13]=f):f=t[13],t[14]!==s||t[15]!==l||t[16]!==f?(m=y.jsxs(y.Fragment,{children:[s,l,f]}),t[14]=s,t[15]=l,t[16]=f,t[17]=m):m=t[17],m},hs=e=>{const t=h(10),{reason:n,canTakeover:r}=e,o=void 0!==r&&r,a=ms;if(o){let e,r,i,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=y.jsx("div",{className:"flex justify-between",children:y.jsx("span",{className:"font-bold text-xl flex items-center mb-2",children:"Notebook already connected"})}),t[0]=e):e=t[0],t[1]!==n?(r=y.jsx("span",{children:n}),t[1]=n,t[2]=r):r=t[2],t[3]!==o?(i=o&&y.jsxs(fe,{onClick:a,variant:"outline","data-testid":"takeover-button",className:"flex-shrink-0",children:[y.jsx(Rt,{className:"w-4 h-4 mr-2"}),"Take over session"]}),t[3]=o,t[4]=i):i=t[4],t[5]!==r||t[6]!==i?(s=y.jsx("div",{className:"flex justify-center",children:y.jsxs(Ze,{kind:"info",className:"mt-10 flex flex-col rounded p-3 max-w-[800px] mx-4",children:[e,y.jsxs("div",{className:"flex justify-between items-end text-base gap-20",children:[r,i]})]})}),t[5]=r,t[6]=i,t[7]=s):s=t[7],s}let i;return t[8]!==n?(i=y.jsx("div",{className:"font-mono text-center text-base text-[var(--red-11)]",children:y.jsx("p",{children:n})}),t[8]=n,t[9]=i):i=t[9],i};async function ms(){try{const e=new URL(window.location.href).searchParams;await Je.post(`/kernel/takeover?${e.toString()}`,{}),et()}catch(e){tt({title:"Failed to take over session",description:nt(e),variant:"danger"})}}const gs=e=>{const t=h(6),{connection:n,className:r,children:o}=e;let a,i;return t[0]!==n?(a=n.state===Li.CLOSED&&y.jsx(hs,{reason:n.reason,canTakeover:n.canTakeover}),t[0]=n,t[1]=a):a=t[1],t[2]!==r||t[3]!==o||t[4]!==a?(i=y.jsxs("div",{className:r,children:[o,a]}),t[2]=r,t[3]=o,t[4]=a,t[5]=i):i=t[5],i},ys=rt({state:Li.CONNECTING});globalThis.EventTarget&&globalThis.Event||console.error("\n  PartySocket requires a global 'EventTarget' class to be available!\n  You can polyfill this global by adding this to your code before any partysocket imports: \n  \n  ```\n  import 'partysocket/event-target-polyfill';\n  ```\n  Please file an issue at https://github.com/partykit/partykit if you're still having trouble.\n");var bs=class extends Event{constructor(e,t){super("error",t),n(this,"message"),n(this,"error"),this.message=e.message,this.error=e}},vs=class extends Event{constructor(e=1e3,t="",r){super("close",r),n(this,"code"),n(this,"reason"),n(this,"wasClean",!0),this.code=e,this.reason=t}},ws=(Event,bs),xs=vs;var Ss="undefined"!=typeof process&&void 0!==(null==(e=process.versions)?void 0:e.node)&&"undefined"==typeof document?function(e){if("data"in e){return new MessageEvent(e.type,e)}if("code"in e||"reason"in e){return new vs(e.code||1999,e.reason||"unknown reason",e)}if("error"in e){return new bs(e.error,e)}return new Event(e.type,e)}:function(e){return new e.constructor(e.type,e)},_s={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+4e3*Math.random(),minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},Os=!1,js=class e extends EventTarget{constructor(e,t,r={}){super(),n(this,"_ws"),n(this,"_retryCount",-1),n(this,"_uptimeTimeout"),n(this,"_connectTimeout"),n(this,"_shouldReconnect",!0),n(this,"_connectLock",!1),n(this,"_binaryType","blob"),n(this,"_closeCalled",!1),n(this,"_messageQueue",[]),n(this,"_debugLogger",console.log.bind(console)),n(this,"_url"),n(this,"_protocols"),n(this,"_options"),n(this,"onclose",null),n(this,"onerror",null),n(this,"onmessage",null),n(this,"onopen",null),n(this,"_handleOpen",(e=>{this._debug("open event");const{minUptime:t=_s.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout((()=>this._acceptOpen()),t),function(e,t){if(!e)throw new Error(t)}(this._ws,"WebSocket is not defined"),this._ws.binaryType=this._binaryType,this._messageQueue.forEach((e=>{var t;return null==(t=this._ws)?void 0:t.send(e)})),this._messageQueue=[],this.onopen&&this.onopen(e),this.dispatchEvent(Ss(e))})),n(this,"_handleMessage",(e=>{this._debug("message event"),this.onmessage&&this.onmessage(e),this.dispatchEvent(Ss(e))})),n(this,"_handleError",(e=>{this._debug("error event",e.message),this._disconnect(void 0,"TIMEOUT"===e.message?"timeout":void 0),this.onerror&&this.onerror(e),this._debug("exec error listeners"),this.dispatchEvent(Ss(e)),this._connect()})),n(this,"_handleClose",(e=>{this._debug("close event"),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(e),this.dispatchEvent(Ss(e))})),this._url=e,this._protocols=t,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._options.debugLogger&&(this._debugLogger=this._options.debugLogger),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return e.CONNECTING}get OPEN(){return e.OPEN}get CLOSING(){return e.CLOSING}get CLOSED(){return e.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce(((e,t)=>("string"==typeof t?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e)),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:""}get protocol(){return this._ws?this._ws.protocol:""}get readyState(){return this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING}get url(){return this._ws?this._ws.url:""}get shouldReconnect(){return this._shouldReconnect}close(e=1e3,t){this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),this._ws?this._ws.readyState!==this.CLOSED?this._ws.close(e,t):this._debug("close: already closed"):this._debug("close enqueued: no ws instance")}reconnect(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,this._ws&&this._ws.readyState!==this.CLOSED?(this._disconnect(e,t),this._connect()):this._connect()}send(e){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",e),this._ws.send(e);else{const{maxEnqueuedMessages:t=_s.maxEnqueuedMessages}=this._options;this._messageQueue.length<t&&(this._debug("enqueue",e),this._messageQueue.push(e))}}_debug(...e){this._options.debug&&this._debugLogger("RWS>",...e)}_getNextDelay(){const{reconnectionDelayGrowFactor:e=_s.reconnectionDelayGrowFactor,minReconnectionDelay:t=_s.minReconnectionDelay,maxReconnectionDelay:n=_s.maxReconnectionDelay}=this._options;let r=0;return this._retryCount>0&&(r=t*Math.pow(e,this._retryCount-1),r>n&&(r=n)),this._debug("next delay",r),r}_wait(){return new Promise((e=>{setTimeout(e,this._getNextDelay())}))}_getNextProtocols(e){if(!e)return Promise.resolve(null);if("string"==typeof e||Array.isArray(e))return Promise.resolve(e);if("function"==typeof e){const t=e();if(!t)return Promise.resolve(null);if("string"==typeof t||Array.isArray(t))return Promise.resolve(t);if(t.then)return t}throw Error("Invalid protocols")}_getNextUrl(e){if("string"==typeof e)return Promise.resolve(e);if("function"==typeof e){const t=e();if("string"==typeof t)return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;const{maxRetries:e=_s.maxRetries,connectionTimeout:t=_s.connectionTimeout}=this._options;this._retryCount>=e?this._debug("max retries reached",this._retryCount,">=",e):(this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),this._wait().then((()=>Promise.all([this._getNextUrl(this._url),this._getNextProtocols(this._protocols||null)]))).then((([e,n])=>{if(this._closeCalled)return void(this._connectLock=!1);this._options.WebSocket||"undefined"!=typeof WebSocket||Os||(console.error("‼️ No WebSocket implementation available. You should define options.WebSocket. \n\nFor example, if you're using node.js, run `npm install ws`, and then in your code:\n\nimport PartySocket from 'partysocket';\nimport WS from 'ws';\n\nconst partysocket = new PartySocket({\n  host: \"127.0.0.1:1999\",\n  room: \"test-room\",\n  WebSocket: WS\n});\n\n"),Os=!0);const r=this._options.WebSocket||WebSocket;this._debug("connect",{url:e,protocols:n}),this._ws=n?new r(e,n):new r(e),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout((()=>this._handleTimeout()),t)})).catch((e=>{this._connectLock=!1,this._handleError(new ws(Error(e.message),this))})))}_handleTimeout(){this._debug("timeout event"),this._handleError(new ws(Error("TIMEOUT"),this))}_disconnect(e=1e3,t){if(this._clearTimeouts(),this._ws){this._removeListeners();try{this._ws.close(e,t),this._handleClose(new xs(e,t,this))}catch(n){}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};
/*!
 * Reconnecting WebSocket
 * by Pedro Ladaria <pedro.ladaria@gmail.com>
 * https://github.com/pladaria/reconnecting-websocket
 * License MIT
 */
class Es{constructor(){this.CONNECTING=WebSocket.CONNECTING,this.OPEN=WebSocket.OPEN,this.CLOSING=WebSocket.CLOSING,this.CLOSED=WebSocket.CLOSED,this.binaryType="blob",this.bufferedAmount=0,this.extensions="",this.protocol="",this.url="",this.onclose=null,this.onerror=null,this.onmessage=null,this.onopen=null,this.readyState=WebSocket.OPEN,this.retryCount=0,this.shouldReconnect=!1}addEventListener(e,t,n){}removeEventListener(e,t,n){}dispatchEvent(e){return!1}reconnect(e,t){}send(e){}close(){}}const{valueAtom:Ds,useActions:Cs}=be((()=>({banners:[]})),{addBanner:(e,t)=>({...e,banners:[...e.banners,{...t,id:at()}]}),removeBanner:(e,t)=>({...e,banners:e.banners.filter((e=>e.id!==t))}),clearBanners:e=>({...e,banners:[]})}),Ns=()=>te(Ds);function ks(){return Cs()}function Rs(e){return"missing"===e.kind}function Ps(e){return"installing"===e.kind}const{valueAtom:Ms,useActions:zs}=be((()=>({packageAlert:null})),{addPackageAlert:(e,t)=>({...e,packageAlert:{id:at(),...t}}),clearPackageAlert:(e,t)=>null!==e.packageAlert&&e.packageAlert.id===t?{...e,packageAlert:null}:e}),Ts=()=>te(Ms);function Ls(){return zs()}function Is(e){const t=new URLSearchParams(window.location.search);return t.set(ue.sessionId,e),`ws?${t.toString()}`}function Hs(e,t){const{autoInstantiate:n,setCells:r,setLayoutData:a,onError:i,setAppConfig:s,setCapabilities:l}=t,{codes:c,names:u,layout:d,configs:p,resumed:f,ui_values:h,cell_ids:m,last_executed_code:g,last_execution_time:y={},app_config:b,capabilities:v}=e,w=g||{},x=y||{},S=c.map(((e,t)=>{const r=m[t];let o=!1;if(n||f){const t=w[r];t&&(o=t!==e)}else o=!0;return it({id:r,code:e,edited:o,name:u[t],lastCodeRun:w[r]??null,lastExecutionTime:x[r]??null,config:p[t]})})),O={selectedLayout:"vertical",layoutData:{}};if(d){const e=d.type,t=function(e,t,n){const r=Ei.find((t=>t.type===e));if(void 0===r)throw new Error(`Unknown layout type: ${e}`);return r.deserializeLayout(t,n)}(e,d.data,S);O.selectedLayout=e,O.layoutData[e]=t,a({layoutView:e,data:t})}r(S,O);const j=st.safeParse(b);if(j.success&&s(j.data),l({...v,sql:v.sql||pe()}),f){for(const[e,t]of _.entries(h||{}))o.set(e,t);return}const E=[],D=[];o.entries.forEach(((e,t)=>{E.push(t),D.push(e.value)})),n&&lt({objectIds:E,values:D}).catch((e=>{i(new Error("Failed to instantiate",{cause:e}))}))}const As=e=>{const t=new URL(window.location.href);t.searchParams.append(e.key,e.value),window.history.pushState({},"",`${t.pathname}${t.search}`)},Ws=e=>{const t=new URL(window.location.href);Array.isArray(e.value)?(t.searchParams.delete(e.key),e.value.forEach((n=>t.searchParams.append(e.key,n)))):t.searchParams.set(e.key,e.value),window.history.pushState({},"",`${t.pathname}${t.search}`)},qs=e=>{const t=new URL(window.location.href);null==e.value?t.searchParams.delete(e.key):t.searchParams.delete(e.key,e.value),window.history.pushState({},"",`${t.pathname}${t.search}`)},Bs=()=>{const e=new URL(window.location.href);e.search="",window.history.pushState({},"",`${e.pathname}${e.search}`)};function Gs(e){const t=h(22),n=l.useRef(!0),{autoInstantiate:r,sessionId:i,setCells:s}=e,{showBoundary:c}=ct(),{handleCellMessage:u,setCellCodes:d,setCellIds:p}=W(),f=ut(),{setVariables:m,setMetadata:g}=dt(),{addColumnPreview:y}=pt(),{addDatasets:b,filterDatasetsFromVariables:v}=pt(),{setLayoutData:w}=Ri(),[x,S]=qe(ys),{addBanner:_}=ks(),{addPackageAlert:O}=Ls(),j=ft(le),E=ft(ht);let D;t[0]!==r||t[1]!==s||t[2]!==w||t[3]!==f||t[4]!==E||t[5]!==c||t[6]!==j||t[7]!==u||t[8]!==m||t[9]!==v||t[10]!==g||t[11]!==_||t[12]!==O||t[13]!==b||t[14]!==y||t[15]!==d||t[16]!==p?(D=e=>{const t=mt(e.data);switch(t.op){case"reload":return void et();case"kernel-ready":return Hs(t.data,{autoInstantiate:r,setCells:s,setLayoutData:w,setAppConfig:f,setCapabilities:E,onError:c}),void j(t.data.kiosk);case"completed-run":case"interrupted":case"reconnected":return;case"send-ui-element-message":return void o.broadcastMessage(t.data.ui_element,t.data.message,t.data.buffers);case"remove-ui-elements":return void function(e){const t=e.cell_id;o.removeElementsByCell(t),ci.INSTANCE.removeForCellId(t)}(t.data);case"completion-result":return void wt.resolve(t.data.completion_id,t.data);case"function-call-result":return void vt.resolve(t.data.function_call_id,t.data);case"cell-op":return void function(e,t){t(e),ci.INSTANCE.track(e)}(t.data,u);case"variables":return m(t.data.variables.map((e=>({name:e.name,declaredBy:e.declared_by,usedBy:e.used_by})))),void v(t.data.variables.map((e=>e.name)));case"variable-values":return void g(t.data.variables.map((e=>({name:e.name,dataType:e.datatype,value:e.value}))));case"alert":return void tt({title:t.data.title,description:bt({html:t.data.description}),variant:t.data.variant});case"banner":return void _(t.data);case"missing-package-alert":return void O({...t.data,kind:"missing"});case"installing-package-alert":return void O({...t.data,kind:"installing"});case"query-params-append":return void As(t.data);case"query-params-set":return void Ws(t.data);case"query-params-delete":return void qs(t.data);case"query-params-clear":return void Bs();case"datasets":return void b(t.data);case"data-column-preview":return void y(t.data);case"focus-cell":return void yt(t.data.cell_id);case"update-cell-codes":return void d({codes:t.data.codes,ids:t.data.cell_ids});case"update-cell-ids":return void p({cellIds:t.data.cell_ids});default:gt(t)}},t[0]=r,t[1]=s,t[2]=w,t[3]=f,t[4]=E,t[5]=c,t[6]=j,t[7]=u,t[8]=m,t[9]=v,t[10]=g,t[11]=_,t[12]=O,t[13]=b,t[14]=y,t[15]=d,t[16]=p,t[17]=D):D=t[17];const C=D,N=(e,t)=>{n.current&&(n.current=!1,R.reconnect(e,t))};let k;t[18]!==C?(k=e=>{try{C(e)}catch(t){tt({title:"Failed to handle message",description:nt(t),variant:"danger"})}},t[18]=C,t[19]=k):k=t[19];const R=function(e){const{onOpen:t,onMessage:n,onClose:r,onError:o,...i}=e,[s]=l.useState((()=>{const a=pe()?new ot(Ve.INSTANCE):e.static?new Es:new js(i.url,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return t&&a.addEventListener("open",t),r&&a.addEventListener("close",r),o&&a.addEventListener("error",o),n&&a.addEventListener("message",n),a}));return l.useEffect((()=>(s.readyState===WebSocket.CLOSED&&s.reconnect(),()=>{a.warn("useWebSocket is unmounting. This likely means there is a bug."),s.close(),t&&s.removeEventListener("open",t),r&&s.removeEventListener("close",r),o&&s.removeEventListener("error",o),n&&s.removeEventListener("message",n)})),[s]),s}({static:de(),url:Is(i),onOpen:()=>{n.current=!0,S({state:Li.OPEN})},onMessage:k,onClose:e=>{switch(a.warn("WebSocket closed",e.code,e.reason),e.reason){case"MARIMO_ALREADY_CONNECTED":return S({state:Li.CLOSED,code:Ii.ALREADY_RUNNING,reason:"another browser tab is already connected to the kernel",canTakeover:!0}),void R.close();case"MARIMO_WRONG_KERNEL_ID":case"MARIMO_NO_FILE_KEY":case"MARIMO_NO_SESSION_ID":case"MARIMO_NO_SESSION":case"MARIMO_SHUTDOWN":return S({state:Li.CLOSED,code:Ii.KERNEL_DISCONNECTED,reason:"kernel not found"}),void R.close();case"MARIMO_MALFORMED_QUERY":return void S({state:Li.CLOSED,code:Ii.MALFORMED_QUERY,reason:"the kernel did not recognize a request; please file a bug with marimo"});default:S({state:Li.CONNECTING}),N(e.code,e.reason)}},onError:e=>{a.warn("WebSocket error",e),S({state:Li.CLOSED,code:Ii.KERNEL_DISCONNECTED,reason:"kernel not found"}),N()}});let P;return t[20]!==x?(P={connection:x},t[20]=x,t[21]=P):P=t[21],P}export{fs as A,Ti as C,Ot as E,jt as F,Ct as I,Mi as L,Nt as M,ti as N,yi as O,Mt as R,Wa as T,ci as V,Li as W,gs as a,ki as b,Ri as c,ys as d,ui as e,ii as f,Ns as g,ks as h,Ts as i,Ls as j,Rs as k,Ps as l,ei as m,Ja as n,mi as o,Pi as p,pi as q,di as r,Gs as u};
