@marimo-team/frontend 0.24.1-dev32 → 0.24.1-dev36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/assets/{CellStatus-DdKYN88d.js → CellStatus-XBYtudpk.js} +1 -1
  2. package/dist/assets/{JsonOutput-htT793Wj.js → JsonOutput-CbpX5Kgt.js} +12 -12
  3. package/dist/assets/MarimoErrorOutput-DX8DBZiw.js +11 -0
  4. package/dist/assets/{RenderHTML-Cu5JtYZJ.js → RenderHTML-DsxkHR2d.js} +1 -1
  5. package/dist/assets/{RunButton-BOnl_Dk8.js → RunButton-DBtIzlFD.js} +1 -1
  6. package/dist/assets/{add-cell-with-ai-Chy4ITIT.js → add-cell-with-ai-BrrI8i5Q.js} +1 -1
  7. package/dist/assets/{add-connection-dialog-DGYhyXo6.js → add-connection-dialog-DYkpW2NI.js} +1 -1
  8. package/dist/assets/{agent-panel--Nt4UmNj.js → agent-panel-CA8lil4S.js} +5 -5
  9. package/dist/assets/{ai-model-dropdown-BUCPZ0ND.js → ai-model-dropdown-Divs-dGW.js} +1 -1
  10. package/dist/assets/{app-config-button-BOxbrv3L.js → app-config-button-BipXNxWD.js} +1 -1
  11. package/dist/assets/{blob-BVQSODqn.js → blob-DCmp9MuM.js} +1 -1
  12. package/dist/assets/{cell-editor-DgOfL9Xv.js → cell-editor-BfrmXiOh.js} +5 -5
  13. package/dist/assets/{cell-link-Bx8FWjns.js → cell-link-CvOBew-Z.js} +1 -1
  14. package/dist/assets/{cells-Biwqg0z6.js → cells-BIt-E5vq.js} +57 -57
  15. package/dist/assets/{chat-display-B2qUbgnh.js → chat-display-B27UEebd.js} +1 -1
  16. package/dist/assets/{chat-panel-gxL2S-HQ.js → chat-panel-C4jJ8gOg.js} +1 -1
  17. package/dist/assets/{chat-ui-BhnwgDpa.js → chat-ui-DJ41RveI.js} +1 -1
  18. package/dist/assets/{column-preview-BaRqZ9P8.js → column-preview-BVzFL_8v.js} +1 -1
  19. package/dist/assets/{command-palette-Cbie8JV9.js → command-palette-SErocd73.js} +1 -1
  20. package/dist/assets/{common-sBRwGAKy.js → common-BGAfLk4T.js} +1 -1
  21. package/dist/assets/{components-DsJAWbBR.js → components-DMNnJpT_.js} +1 -1
  22. package/dist/assets/{data-source-discovery-DCNYJylO.js → data-source-discovery-DdefgaOP.js} +1 -1
  23. package/dist/assets/{datasource-DxCwZdAq.js → datasource-0Urr2OFR.js} +2 -2
  24. package/dist/assets/{dependency-graph-panel-CLOQ_RvL.js → dependency-graph-panel-CQSSUBtY.js} +1 -1
  25. package/dist/assets/{documentation-panel-D9w8PAT9.js → documentation-panel-Mo3B93Dq.js} +1 -1
  26. package/dist/assets/{download-CfUkZlw7.js → download-DYiwRe8_.js} +1 -1
  27. package/dist/assets/{edit-page-DKAg2YW9.js → edit-page-xv_028Km.js} +4 -4
  28. package/dist/assets/{error-entries-DpvSrZSw.js → error-entries-BTA-sOIB.js} +1 -1
  29. package/dist/assets/{error-panel-uRl1_l47.js → error-panel-BMpvsfkK.js} +1 -1
  30. package/dist/assets/{file-explorer-panel-DwA9Lprz.js → file-explorer-panel-BATjfG7j.js} +1 -1
  31. package/dist/assets/{file-icons-DpREEjwW.js → file-icons-7V36_u0o.js} +1 -1
  32. package/dist/assets/{file-name-input-C7AQKuoU.js → file-name-input-BCi-JD7l.js} +1 -1
  33. package/dist/assets/{floating-outline-4I6DvqaR.js → floating-outline-CmgEk2gZ.js} +1 -1
  34. package/dist/assets/{focus-CeTtpVjV.js → focus-agtnrA0w.js} +1 -1
  35. package/dist/assets/{form-B10bgcbQ.js → form-DbRAwKK1.js} +1 -1
  36. package/dist/assets/{form-Cj9BLARR.js → form-sf0A_nV4.js} +1 -1
  37. package/dist/assets/{home-page-BNJihtii.js → home-page-DbqvhmFo.js} +1 -1
  38. package/dist/assets/{html-to-image-ChfBVn8-.js → html-to-image-BvGsu9Nz.js} +1 -1
  39. package/dist/assets/index-BBAof751.css +2 -0
  40. package/dist/assets/{index-DemYxG9z.js → index-CSJwPAAg.js} +5 -5
  41. package/dist/assets/{layout-YPBtS2D6.js → layout-BBB9DQha.js} +3 -3
  42. package/dist/assets/{logs-panel-ClE58_4G.js → logs-panel-CtZ-76hx.js} +1 -1
  43. package/dist/assets/{markdown-renderer-BOS4jZLt.js → markdown-renderer-CP1Up_3K.js} +1 -1
  44. package/dist/assets/{name-cell-input-UMsLssMV.js → name-cell-input-7EVAIGJb.js} +1 -1
  45. package/dist/assets/{outline-panel-DweKocZK.js → outline-panel-BUPKUip_.js} +1 -1
  46. package/dist/assets/{packages-panel-Cbw5J5QD.js → packages-panel-DMfz7YUA.js} +1 -1
  47. package/dist/assets/{panel-accordion-state-CgvX-ElJ.js → panel-accordion-state-Rl5fu2O3.js} +1 -1
  48. package/dist/assets/{panels-DRv39UwA.js → panels-v1_Bo-9b.js} +1 -1
  49. package/dist/assets/{process-output-BMxr8Z3g.js → process-output-CwYvnqai.js} +1 -1
  50. package/dist/assets/{radio-group-YNmbPL7y.js → radio-group-CFoizYY0.js} +1 -1
  51. package/dist/assets/{readonly-code-display-N9tCXdCz.js → readonly-code-display-evFzJqo3.js} +1 -1
  52. package/dist/assets/{readonly-python-code-BHrAhtGV.js → readonly-python-code-DeHfRkyx.js} +1 -1
  53. package/dist/assets/{reveal-component-Cl6cd65E.js → reveal-component-Xpt5ATiU.js} +1 -1
  54. package/dist/assets/{run-page-Phwq7OJt.js → run-page-CyrHzfTi.js} +1 -1
  55. package/dist/assets/{scratchpad-panel-CvihhlAP.js → scratchpad-panel-CwLyjPgK.js} +1 -1
  56. package/dist/assets/{session-panel-BmQ0PDHO.js → session-panel-wwlutzcx.js} +1 -1
  57. package/dist/assets/{skeleton-BsZq3Vmq.js → skeleton-CqtoHThq.js} +1 -1
  58. package/dist/assets/{snippets-panel-cYP0GMUf.js → snippets-panel-CmNQL12H.js} +1 -1
  59. package/dist/assets/{state-DJon00Ew.js → state-D2PXKlv7.js} +1 -1
  60. package/dist/assets/{state-Dc5AjWPq.js → state-D9aD2R5_.js} +1 -1
  61. package/dist/assets/{tracing-dGSNt8Nm.js → tracing-D-Pv6KLc.js} +1 -1
  62. package/dist/assets/{tracing-panel-CQCgx3e4.js → tracing-panel-CE9SGDWn.js} +2 -2
  63. package/dist/assets/{tree-actions-pW_UgP3m.js → tree-actions-B7cSMuSB.js} +1 -1
  64. package/dist/assets/{useCellActionButton-De17Z9R3.js → useCellActionButton-CDwMe7L6.js} +1 -1
  65. package/dist/assets/{useDeleteCell-BgFMPTmg.js → useDeleteCell-C6_GiKMv.js} +1 -1
  66. package/dist/assets/{useDependencyPanelTab-w8VLtsK3.js → useDependencyPanelTab-DL7ebTCt.js} +1 -1
  67. package/dist/assets/{useNotebookActions-BI53NQV3.js → useNotebookActions-DNf7n1OO.js} +1 -1
  68. package/dist/assets/{useRunCells-CAfRBo7h.js → useRunCells-SSVpCuNe.js} +1 -1
  69. package/dist/assets/{useSplitCell-N8Ohs-Pp.js → useSplitCell-ChS6iNjW.js} +1 -1
  70. package/dist/index.html +24 -24
  71. package/package.json +1 -1
  72. package/src/components/data-table/__tests__/columns.test.tsx +166 -2
  73. package/src/components/data-table/columns.tsx +87 -10
  74. package/src/utils/__tests__/url-parser.test.ts +26 -0
  75. package/src/utils/json/__tests__/json-parser.test.ts +33 -0
  76. package/src/utils/json/json-parser.ts +5 -3
  77. package/src/utils/url-parser.ts +4 -3
  78. package/dist/assets/MarimoErrorOutput-Db7coyFA.js +0 -11
  79. package/dist/assets/index-CxZ6uZaz.css +0 -2
@@ -1,4 +1,4 @@
1
- var jl=Object.defineProperty;var ql=(Le,de,T)=>de in Le?jl(Le,de,{enumerable:!0,configurable:!0,writable:!0,value:T}):Le[de]=T;var I=(Le,de,T)=>ql(Le,typeof de!="symbol"?de+"":de,T);import{o as bn}from"./chunk-C4rtOYze.js";import{n as ke,u as Ri}from"./useEvent-GCVIknuR.js";import{t as Ol}from"./react-C60yClUi.js";import{E as Fl,bi as Vl,st as Ai,wi as Ul,yi as Wl,__tla as Kl}from"./cells-Biwqg0z6.js";import"./react-dom-Ba2zmJWD.js";import{t as Dt}from"./compiler-runtime-DnimoHo0.js";import{g as Zl,t as Ql}from"./useEventListener-DpNnLPuE.js";import{T as kn,c as Xl,t as Gl}from"./utils-C8Yt16Y7.js";import{O as Yl,v as Jl}from"./config-DFK5eCC3.js";import{t as eo}from"./readonly-python-code-BHrAhtGV.js";import{t as Ue}from"./cn-DCUzRj2J.js";import{t as to}from"./jsx-runtime-3wZU7vFS.js";import{n as io}from"./fullscreen-CrevbcR_.js";import"./popover-B96fOqfH.js";import{It as so,__tla as no}from"./JsonOutput-htT793Wj.js";import"./download-CfUkZlw7.js";import{t as yn}from"./tooltip-C9LWGQ7Y.js";import{r as Ti,t as wn}from"./button-W__YVea9.js";import"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{t as ro}from"./createLucideIcon-B8oVfJNp.js";import{g as Ci,h as ao,l as Li,u as lo,__tla as oo}from"./layout-YPBtS2D6.js";import{r as co}from"./x-4y-nyVDU.js";import{__tla as uo}from"./markdown-renderer-BOS4jZLt.js";import"./add-cell-with-ai-Chy4ITIT.js";import{t as ho}from"./code-DzY0vbKf.js";import{t as po}from"./eye-off-DfXRjba3.js";import{n as go,t as mo,__tla as fo}from"./cell-editor-DgOfL9Xv.js";import{n as vo,t as bo}from"./RunButton-BOnl_Dk8.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import{r as ko}from"./useTheme-CwCyrmDf.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import{t as yo}from"./CellStatus-DdKYN88d.js";import{n as wo}from"./useDebounce-BlgD22u_.js";import{i as xo}from"./useRunCells-CAfRBo7h.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import{__tla as So}from"./chunk-5FQGJX7Z-BIDn9QG0.js";import{r as Eo}from"./html-to-image-ChfBVn8-.js";import{n as Ro,r as Ao,t as xn}from"./react-resizable-panels.browser.esm-CLaR27oP.js";import"./esm-RBKN8Dn2.js";import"./name-cell-input-UMsLssMV.js";import"./multi-icon-C-boGjpw.js";import{__tla as To}from"./loro_wasm_bg-wiZiHqmd.js";import"./ws-B3l5rS71.js";import"./Inputs-S6F4fq1S.js";import"./dist-CiELQ2ik.js";import"./dist-CtsSPT78.js";import"./dist-BpyRMlx3.js";import"./dist-Cnb7x5X_.js";import"./dist-B_Q1ayL4.js";import"./dist-CnESRnx2.js";import"./dist-M9OI1ywz.js";import"./dist-DcwGajoh.js";import"./dist-DXl-iyI_.js";import"./esm-B7G79VOo.js";import{t as Co}from"./readonly-code-display-N9tCXdCz.js";let _t,Pi,Sn,jt,Ii,Ni,Lo=Promise.all([(()=>{try{return Kl}catch{}})(),(()=>{try{return no}catch{}})(),(()=>{try{return oo}catch{}})(),(()=>{try{return uo}catch{}})(),(()=>{try{return fo}catch{}})(),(()=>{try{return So}catch{}})(),(()=>{try{return To}catch{}})()]).then(async()=>{var xt,St;var Le=ro("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),de=Dt(),T=bn(Ol(),1),En=Object.defineProperty,Rn=Object.defineProperties,An=Object.getOwnPropertyDescriptors,Hi=Object.getOwnPropertySymbols,Tn=Object.prototype.hasOwnProperty,Cn=Object.prototype.propertyIsEnumerable,qt=(t,e,i)=>e in t?En(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ye=(t,e)=>{for(var i in e||(e={}))Tn.call(e,i)&&qt(t,i,e[i]);if(Hi)for(var i of Hi(e))Cn.call(e,i)&&qt(t,i,e[i]);return t},Di=(t,e)=>Rn(t,An(e)),_i=(t,e,i)=>qt(t,typeof e=="symbol"?e:e+"",i),Ln=(t,e,i)=>new Promise((s,n)=>{var r=c=>{try{a(i.next(c))}catch(o){n(o)}},l=c=>{try{a(i.throw(c))}catch(o){n(o)}},a=c=>c.done?s(c.value):Promise.resolve(c.value).then(r,l);a((i=i.apply(t,e)).next())}),_e=(t,e)=>{for(let i in e)t[i]=e[i];return t},P=(t,e)=>Array.from(t.querySelectorAll(e)),Ot=(t,e,i)=>{i?t.classList.add(e):t.classList.remove(e)},je=t=>{if(typeof t=="string"){if(t==="null")return null;if(t==="true")return!0;if(t==="false")return!1;if(t.match(/^-?[\d\.]+$/))return parseFloat(t)}return t},Ee=(t,e)=>{t.style.transform=e},ot=(t,e)=>{let i=t.matches||t.matchesSelector||t.msMatchesSelector;return!!(i&&i.call(t,e))},ee=(t,e)=>{if(t&&typeof t.closest=="function")return t.closest(e);for(;t;){if(ot(t,e))return t;t=t.parentElement}return null},ji=t=>{t||(t=document.documentElement);let e=t.requestFullscreen||t.webkitRequestFullscreen||t.webkitRequestFullScreen||t.mozRequestFullScreen||t.msRequestFullscreen;e&&e.apply(t)},Pn=(t,e,i,s="")=>{let n=t.querySelectorAll("."+i);for(let l=0;l<n.length;l++){let a=n[l];if(a.parentNode===t)return a}let r=document.createElement(e);return r.className=i,r.innerHTML=s,t.appendChild(r),r},Ft=t=>{let e=document.createElement("style");return t&&t.length>0&&e.appendChild(document.createTextNode(t)),document.head.appendChild(e),e},qi=()=>{let t={};for(let e in location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,i=>{let s=i.split("=").shift(),n=i.split("=").pop();return s&&n!==void 0&&(t[s]=n),i}),t){let i=t[e];t[e]=je(unescape(i))}return t.dependencies!==void 0&&delete t.dependencies,t},In=(t,e=0)=>{var i;if(t){let s,n=t.style.height;return t.style.height="0px",t.parentElement&&(t.parentElement.style.height="auto"),s=e-(((i=t.parentElement)==null?void 0:i.offsetHeight)||0),t.style.height=n+"px",t.parentElement&&t.parentElement.style.removeProperty("height"),s}return e},Nn={mp4:"video/mp4",m4a:"video/mp4",ogv:"video/ogg",mpeg:"video/mpeg",webm:"video/webm"},Mn=(t="")=>{let e=t.split(".").pop();return e?Nn[e]:void 0},zn=(t="")=>encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Oi=navigator.userAgent,Pe=/(iphone|ipod|ipad|android)/gi.test(Oi)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,Fi=/android/gi.test(Oi),$n=(function(t){if(t){var e=function(v){return[].slice.call(v)},i=0,s=1,n=2,r=3,l=[],a=null,c="requestAnimationFrame"in t?function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};t.cancelAnimationFrame(a);var R=function(){return d(l.filter((function(z){return z.dirty&&z.active})))};if(v.sync)return R();a=t.requestAnimationFrame(R)}:function(){},o=function(v){return function(R){l.forEach((function(z){return z.dirty=v})),c(R)}},d=function(v){v.filter((function(z){return!z.styleComputed})).forEach((function(z){z.styleComputed=u(z)})),v.filter(b).forEach(k);var R=v.filter(p);R.forEach(g),R.forEach((function(z){k(z),h(z)})),R.forEach(N)},h=function(v){return v.dirty=i},g=function(v){v.availableWidth=v.element.parentNode.clientWidth,v.currentWidth=v.element.scrollWidth,v.previousFontSize=v.currentFontSize,v.currentFontSize=Math.min(Math.max(v.minSize,v.availableWidth/v.currentWidth*v.previousFontSize),v.maxSize),v.whiteSpace=v.multiLine&&v.currentFontSize===v.minSize?"normal":"nowrap"},p=function(v){return v.dirty!==n||v.dirty===n&&v.element.parentNode.clientWidth!==v.availableWidth},u=function(v){var R=t.getComputedStyle(v.element,null);return v.currentFontSize=parseFloat(R.getPropertyValue("font-size")),v.display=R.getPropertyValue("display"),v.whiteSpace=R.getPropertyValue("white-space"),!0},b=function(v){var R=!1;return!v.preStyleTestCompleted&&(/inline-/.test(v.display)||(R=!0,v.display="inline-block"),v.whiteSpace!=="nowrap"&&(R=!0,v.whiteSpace="nowrap"),v.preStyleTestCompleted=!0,R)},k=function(v){v.element.style.whiteSpace=v.whiteSpace,v.element.style.display=v.display,v.element.style.fontSize=v.currentFontSize+"px"},N=function(v){v.element.dispatchEvent(new CustomEvent("fit",{detail:{oldValue:v.previousFontSize,newValue:v.currentFontSize,scaleFactor:v.currentFontSize/v.previousFontSize}}))},$=function(v,R){return function(z){v.dirty=R,v.active&&c(z)}},L=function(v){return function(){l=l.filter((function(R){return R.element!==v.element})),v.observeMutations&&v.observer.disconnect(),v.element.style.whiteSpace=v.originalStyle.whiteSpace,v.element.style.display=v.originalStyle.display,v.element.style.fontSize=v.originalStyle.fontSize}},A=function(v){return function(){v.active||(v.active=!0,c())}},S=function(v){return function(){return v.active=!1}},B=function(v){v.observeMutations&&(v.observer=new MutationObserver($(v,s)),v.observer.observe(v.element,v.observeMutations))},C={minSize:16,maxSize:512,multiLine:!0,observeMutations:"MutationObserver"in t&&{subtree:!0,childList:!0,characterData:!0}},_=null,O=function(){t.clearTimeout(_),_=t.setTimeout(o(n),H.observeWindowDelay)},M=["resize","orientationchange"];return Object.defineProperty(H,"observeWindow",{set:function(v){var R=`${v?"add":"remove"}EventListener`;M.forEach((function(z){t[R](z,O)}))}}),H.observeWindow=!0,H.observeWindowDelay=100,H.fitAll=o(r),H}function Y(v,R){var z=Object.assign({},C,R),Z=v.map((function(te){var se=Object.assign({},z,{element:te,active:!0});return(function(Q){Q.originalStyle={whiteSpace:Q.element.style.whiteSpace,display:Q.element.style.display,fontSize:Q.element.style.fontSize},B(Q),Q.newbie=!0,Q.dirty=!0,l.push(Q)})(se),{element:te,fit:$(se,r),unfreeze:A(se),freeze:S(se),unsubscribe:L(se)}}));return c(),Z}function H(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof v=="string"?Y(e(document.querySelectorAll(v)),R):Y([v],R)[0]}})(typeof window>"u"?null:window),Bn=class{constructor(t){_i(this,"allowedToPlayAudio",null),this.Reveal=t,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement("button"),this.mediaPlayButton.className="r-overlay-button r-media-play-button",this.mediaPlayButton.addEventListener("click",()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(t=>{this.startEmbeddedMedia({target:t})}),this.clearMediaPlaybackErrors()})}shouldPreload(t){if(this.Reveal.isScrollView())return!0;let e=this.Reveal.getConfig().preloadIframes;return typeof e!="boolean"&&(e=t.hasAttribute("data-preload")),e}load(t,e={}){let i=this.Reveal.getConfig().display;if(i.includes("!important")){let n=i.replace(/\s*!important\s*$/,"").trim();t.style.setProperty("display",n,"important")}else t.style.display=i;P(t,"img[data-src], video[data-src], audio[data-src], iframe[data-src]").forEach(n=>{let r=n.tagName==="IFRAME";(!r||this.shouldPreload(n))&&(n.setAttribute("src",n.getAttribute("data-src")),n.setAttribute("data-lazy-loaded",""),n.removeAttribute("data-src"),r&&n.addEventListener("load",this.preventIframeAutoFocus))}),P(t,"video, audio").forEach(n=>{let r=0;P(n,"source[data-src]").forEach(l=>{l.setAttribute("src",l.getAttribute("data-src")),l.removeAttribute("data-src"),l.setAttribute("data-lazy-loaded",""),r+=1}),Pe&&n.tagName==="VIDEO"&&n.setAttribute("playsinline",""),r>0&&n.load()});let s=t.slideBackgroundElement;if(s){s.style.display="block";let n=t.slideBackgroundContentElement,r=t.getAttribute("data-background-iframe");if(s.hasAttribute("data-loaded")===!1){s.setAttribute("data-loaded","true");let a=t.getAttribute("data-background-image"),c=t.getAttribute("data-background-video"),o=t.hasAttribute("data-background-video-loop"),d=t.hasAttribute("data-background-video-muted");if(a)/^data:/.test(a.trim())?n.style.backgroundImage=`url(${a.trim()})`:n.style.backgroundImage=a.split(",").map(h=>`url(${zn(decodeURI(h.trim()))})`).join(",");else if(c){let h=document.createElement("video");o&&h.setAttribute("loop",""),(d||this.Reveal.isSpeakerNotes())&&(h.muted=!0),Pe&&h.setAttribute("playsinline",""),c.split(",").forEach(g=>{let p=document.createElement("source");p.setAttribute("src",g);let u=Mn(g);u&&p.setAttribute("type",u),h.appendChild(p)}),n.appendChild(h)}else if(r&&e.excludeIframes!==!0){let h=document.createElement("iframe");h.setAttribute("allowfullscreen",""),h.setAttribute("mozallowfullscreen",""),h.setAttribute("webkitallowfullscreen",""),h.setAttribute("allow","autoplay"),h.setAttribute("data-src",r),h.style.width="100%",h.style.height="100%",h.style.maxHeight="100%",h.style.maxWidth="100%",n.appendChild(h)}}let l=n.querySelector("iframe[data-src]");l&&this.shouldPreload(s)&&!/autoplay=(1|true|yes)/gi.test(r)&&l.getAttribute("src")!==r&&l.setAttribute("src",r)}this.layout(t)}layout(t){Array.from(t.querySelectorAll(".r-fit-text")).forEach(e=>{$n(e,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(t){t.style.display="none";let e=this.Reveal.getSlideBackground(t);e&&(e.style.display="none",P(e,"iframe[src]").forEach(i=>{i.removeAttribute("src")})),P(t,"video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]").forEach(i=>{i.setAttribute("data-src",i.getAttribute("src")),i.removeAttribute("src")}),P(t,"video[data-lazy-loaded] source[src], audio source[src]").forEach(i=>{i.setAttribute("data-src",i.getAttribute("src")),i.removeAttribute("src")})}formatEmbeddedContent(){let t=(e,i,s)=>{P(this.Reveal.getSlidesElement(),"iframe["+e+'*="'+i+'"]').forEach(n=>{let r=n.getAttribute(e);r&&r.indexOf(s)===-1&&n.setAttribute(e,r+(/\?/.test(r)?"&":"?")+s)})};t("src","youtube.com/embed/","enablejsapi=1"),t("data-src","youtube.com/embed/","enablejsapi=1"),t("src","player.vimeo.com/","api=1"),t("data-src","player.vimeo.com/","api=1")}startEmbeddedContent(t){if(t){let e=this.Reveal.isSpeakerNotes();P(t,'img[src$=".gif"]').forEach(i=>{i.setAttribute("src",i.getAttribute("src"))}),P(t,"video, audio").forEach(i=>{if(ee(i,".fragment")&&!ee(i,".fragment.visible"))return;let s=this.Reveal.getConfig().autoPlayMedia;if(typeof s!="boolean"&&(s=i.hasAttribute("data-autoplay")||!!ee(i,".slide-background")),s&&typeof i.play=="function"){if(e&&!i.muted)return;i.readyState>1?this.startEmbeddedMedia({target:i}):Pe?(i.addEventListener("canplay",this.ensureMobileMediaPlaying),this.playMediaElement(i)):(i.removeEventListener("loadeddata",this.startEmbeddedMedia),i.addEventListener("loadeddata",this.startEmbeddedMedia))}}),e||(P(t,"iframe[src]").forEach(i=>{ee(i,".fragment")&&!ee(i,".fragment.visible")||this.startEmbeddedIframe({target:i})}),P(t,"iframe[data-src]").forEach(i=>{ee(i,".fragment")&&!ee(i,".fragment.visible")||i.getAttribute("src")!==i.getAttribute("data-src")&&(i.removeEventListener("load",this.startEmbeddedIframe),i.addEventListener("load",this.startEmbeddedIframe),i.setAttribute("src",i.getAttribute("data-src")))}))}}ensureMobileMediaPlaying(t){let e=t.target;typeof e.getVideoPlaybackQuality=="function"&&setTimeout(()=>{let i=e.paused===!1,s=e.getVideoPlaybackQuality().totalVideoFrames;i&&s===0&&(e.load(),e.play())},1e3)}startEmbeddedMedia(t){let e=!!ee(t.target,"html"),i=!!ee(t.target,".present");e&&i&&(t.target.paused||t.target.ended)&&(t.target.currentTime=0,this.playMediaElement(t.target)),t.target.removeEventListener("loadeddata",this.startEmbeddedMedia)}playMediaElement(t){let e=t.play();e&&typeof e.catch=="function"&&e.then(()=>{t.muted||(this.allowedToPlayAudio=!0)}).catch(i=>{if(i.name==="NotAllowedError")if(this.allowedToPlayAudio=!1,t.tagName==="VIDEO"){this.onVideoPlaybackNotAllowed(t);let s=!!ee(t,"html"),n=!!ee(t,".present"),r=t.muted;s&&n&&!r&&(t.setAttribute("data-muted-by-reveal","true"),t.muted=!0,t.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(t)}))}else t.tagName==="AUDIO"&&this.onAudioPlaybackNotAllowed(t)})}startEmbeddedIframe(t){let e=t.target;if(this.preventIframeAutoFocus(t),e&&e.contentWindow){let i=!!ee(t.target,"html"),s=!!ee(t.target,".present");if(i&&s){let n=this.Reveal.getConfig().autoPlayMedia;typeof n!="boolean"&&(n=e.hasAttribute("data-autoplay")||!!ee(e,".slide-background")),/youtube\.com\/embed\//.test(e.getAttribute("src"))&&n?e.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*"):/player\.vimeo\.com\//.test(e.getAttribute("src"))&&n?e.contentWindow.postMessage('{"method":"play"}',"*"):e.contentWindow.postMessage("slide:start","*")}}}stopEmbeddedContent(t,e={}){e=_e({unloadIframes:!0},e),t&&t.parentNode&&(P(t,"video, audio").forEach(i=>{!i.hasAttribute("data-ignore")&&typeof i.pause=="function"&&(i.setAttribute("data-paused-by-reveal",""),i.pause(),Pe&&i.removeEventListener("canplay",this.ensureMobileMediaPlaying))}),P(t,"iframe").forEach(i=>{i.contentWindow&&i.contentWindow.postMessage("slide:stop","*"),i.removeEventListener("load",this.preventIframeAutoFocus),i.removeEventListener("load",this.startEmbeddedIframe)}),P(t,'iframe[src*="youtube.com/embed/"]').forEach(i=>{!i.hasAttribute("data-ignore")&&i.contentWindow&&typeof i.contentWindow.postMessage=="function"&&i.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}),P(t,'iframe[src*="player.vimeo.com/"]').forEach(i=>{!i.hasAttribute("data-ignore")&&i.contentWindow&&typeof i.contentWindow.postMessage=="function"&&i.contentWindow.postMessage('{"method":"pause"}',"*")}),e.unloadIframes===!0&&P(t,"iframe[data-src]").forEach(i=>{i.setAttribute("src","about:blank"),i.removeAttribute("src")}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let t=this.failedAudioPlaybackTargets.size,e=this.failedVideoPlaybackTargets.size,i=this.failedMutedVideoPlaybackTargets.size,s="Play media";i>0?s="Play video":e>0?s="Unmute video":t>0&&(s="Play audio"),this.mediaPlayButton.textContent=s,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(t){this.failedAudioPlaybackTargets.add(t),this.showPlayOrUnmuteButton(t)}onVideoPlaybackNotAllowed(t){this.failedVideoPlaybackTargets.add(t),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(t){this.failedMutedVideoPlaybackTargets.add(t),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(t=>{t.hasAttribute("data-muted-by-reveal")&&(t.muted=!1,t.removeAttribute("data-muted-by-reveal"))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton.remove()}preventIframeAutoFocus(t){let e=t.target;if(e&&this.Reveal.getConfig().preventIframeAutoFocus){let i=0,s=()=>{document.activeElement===e?document.activeElement.blur():i<1e3&&(i+=100,setTimeout(s,100))};setTimeout(s,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},Ie=".slides section",we=".slides>section",Vt=".slides>section.present>section",Hn=".backgrounds>.slide-background",Dn=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview/,_n="h.v",jn="h/v",Ut="c",Vi="c/t",qn=class{constructor(t){this.Reveal=t}render(){this.element=document.createElement("div"),this.element.className="slide-number",this.Reveal.getRevealElement().appendChild(this.element)}configure(t,e){let i="none";t.slideNumber&&!this.Reveal.isPrintView()&&(t.showSlideNumber==="all"||t.showSlideNumber==="speaker"&&this.Reveal.isSpeakerNotes())&&(i="block"),this.element.style.display=i}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(t=this.Reveal.getCurrentSlide()){let e=this.Reveal.getConfig(),i,s=_n;if(typeof e.slideNumber=="function")i=e.slideNumber(t);else{typeof e.slideNumber=="string"&&(s=e.slideNumber),!/c/.test(s)&&this.Reveal.getHorizontalSlides().length===1&&(s=Ut);let r=t&&t.dataset.visibility==="uncounted"?0:1;switch(i=[],s){case Ut:i.push(this.Reveal.getSlidePastCount(t)+r);break;case Vi:i.push(this.Reveal.getSlidePastCount(t)+r,"/",this.Reveal.getTotalSlides());break;default:let l=this.Reveal.getIndices(t);i.push(l.h+r);let a=s===jn?"/":".";this.Reveal.isVerticalSlide(t)&&i.push(a,l.v+1)}}let n="#"+this.Reveal.location.getHash(t);return this.formatNumber(i[0],i[1],i[2],n)}formatNumber(t,e,i,s="#"+this.Reveal.location.getHash()){return typeof i=="number"&&!isNaN(i)?`<a href="${s}">
1
+ var jl=Object.defineProperty;var ql=(Le,de,T)=>de in Le?jl(Le,de,{enumerable:!0,configurable:!0,writable:!0,value:T}):Le[de]=T;var I=(Le,de,T)=>ql(Le,typeof de!="symbol"?de+"":de,T);import{o as bn}from"./chunk-C4rtOYze.js";import{n as ke,u as Ri}from"./useEvent-GCVIknuR.js";import{t as Ol}from"./react-C60yClUi.js";import{E as Fl,bi as Vl,st as Ai,wi as Ul,yi as Wl,__tla as Kl}from"./cells-BIt-E5vq.js";import"./react-dom-Ba2zmJWD.js";import{t as Dt}from"./compiler-runtime-DnimoHo0.js";import{g as Zl,t as Ql}from"./useEventListener-DpNnLPuE.js";import{T as kn,c as Xl,t as Gl}from"./utils-C8Yt16Y7.js";import{O as Yl,v as Jl}from"./config-DFK5eCC3.js";import{t as eo}from"./readonly-python-code-DeHfRkyx.js";import{t as Ue}from"./cn-DCUzRj2J.js";import{t as to}from"./jsx-runtime-3wZU7vFS.js";import{n as io}from"./fullscreen-CrevbcR_.js";import"./popover-B96fOqfH.js";import{It as so,__tla as no}from"./JsonOutput-CbpX5Kgt.js";import"./download-DYiwRe8_.js";import{t as yn}from"./tooltip-C9LWGQ7Y.js";import{r as Ti,t as wn}from"./button-W__YVea9.js";import"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{t as ro}from"./createLucideIcon-B8oVfJNp.js";import{g as Ci,h as ao,l as Li,u as lo,__tla as oo}from"./layout-BBB9DQha.js";import{r as co}from"./x-4y-nyVDU.js";import{__tla as uo}from"./markdown-renderer-CP1Up_3K.js";import"./add-cell-with-ai-BrrI8i5Q.js";import{t as ho}from"./code-DzY0vbKf.js";import{t as po}from"./eye-off-DfXRjba3.js";import{n as go,t as mo,__tla as fo}from"./cell-editor-BfrmXiOh.js";import{n as vo,t as bo}from"./RunButton-DBtIzlFD.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import{r as ko}from"./useTheme-CwCyrmDf.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import{t as yo}from"./CellStatus-XBYtudpk.js";import{n as wo}from"./useDebounce-BlgD22u_.js";import{i as xo}from"./useRunCells-SSVpCuNe.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import{__tla as So}from"./chunk-5FQGJX7Z-BIDn9QG0.js";import{r as Eo}from"./html-to-image-BvGsu9Nz.js";import{n as Ro,r as Ao,t as xn}from"./react-resizable-panels.browser.esm-CLaR27oP.js";import"./esm-RBKN8Dn2.js";import"./name-cell-input-7EVAIGJb.js";import"./multi-icon-C-boGjpw.js";import{__tla as To}from"./loro_wasm_bg-wiZiHqmd.js";import"./ws-B3l5rS71.js";import"./Inputs-S6F4fq1S.js";import"./dist-CiELQ2ik.js";import"./dist-CtsSPT78.js";import"./dist-BpyRMlx3.js";import"./dist-Cnb7x5X_.js";import"./dist-B_Q1ayL4.js";import"./dist-CnESRnx2.js";import"./dist-M9OI1ywz.js";import"./dist-DcwGajoh.js";import"./dist-DXl-iyI_.js";import"./esm-B7G79VOo.js";import{t as Co}from"./readonly-code-display-evFzJqo3.js";let _t,Pi,Sn,jt,Ii,Ni,Lo=Promise.all([(()=>{try{return Kl}catch{}})(),(()=>{try{return no}catch{}})(),(()=>{try{return oo}catch{}})(),(()=>{try{return uo}catch{}})(),(()=>{try{return fo}catch{}})(),(()=>{try{return So}catch{}})(),(()=>{try{return To}catch{}})()]).then(async()=>{var xt,St;var Le=ro("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),de=Dt(),T=bn(Ol(),1),En=Object.defineProperty,Rn=Object.defineProperties,An=Object.getOwnPropertyDescriptors,Hi=Object.getOwnPropertySymbols,Tn=Object.prototype.hasOwnProperty,Cn=Object.prototype.propertyIsEnumerable,qt=(t,e,i)=>e in t?En(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ye=(t,e)=>{for(var i in e||(e={}))Tn.call(e,i)&&qt(t,i,e[i]);if(Hi)for(var i of Hi(e))Cn.call(e,i)&&qt(t,i,e[i]);return t},Di=(t,e)=>Rn(t,An(e)),_i=(t,e,i)=>qt(t,typeof e=="symbol"?e:e+"",i),Ln=(t,e,i)=>new Promise((s,n)=>{var r=c=>{try{a(i.next(c))}catch(o){n(o)}},l=c=>{try{a(i.throw(c))}catch(o){n(o)}},a=c=>c.done?s(c.value):Promise.resolve(c.value).then(r,l);a((i=i.apply(t,e)).next())}),_e=(t,e)=>{for(let i in e)t[i]=e[i];return t},P=(t,e)=>Array.from(t.querySelectorAll(e)),Ot=(t,e,i)=>{i?t.classList.add(e):t.classList.remove(e)},je=t=>{if(typeof t=="string"){if(t==="null")return null;if(t==="true")return!0;if(t==="false")return!1;if(t.match(/^-?[\d\.]+$/))return parseFloat(t)}return t},Ee=(t,e)=>{t.style.transform=e},ot=(t,e)=>{let i=t.matches||t.matchesSelector||t.msMatchesSelector;return!!(i&&i.call(t,e))},ee=(t,e)=>{if(t&&typeof t.closest=="function")return t.closest(e);for(;t;){if(ot(t,e))return t;t=t.parentElement}return null},ji=t=>{t||(t=document.documentElement);let e=t.requestFullscreen||t.webkitRequestFullscreen||t.webkitRequestFullScreen||t.mozRequestFullScreen||t.msRequestFullscreen;e&&e.apply(t)},Pn=(t,e,i,s="")=>{let n=t.querySelectorAll("."+i);for(let l=0;l<n.length;l++){let a=n[l];if(a.parentNode===t)return a}let r=document.createElement(e);return r.className=i,r.innerHTML=s,t.appendChild(r),r},Ft=t=>{let e=document.createElement("style");return t&&t.length>0&&e.appendChild(document.createTextNode(t)),document.head.appendChild(e),e},qi=()=>{let t={};for(let e in location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,i=>{let s=i.split("=").shift(),n=i.split("=").pop();return s&&n!==void 0&&(t[s]=n),i}),t){let i=t[e];t[e]=je(unescape(i))}return t.dependencies!==void 0&&delete t.dependencies,t},In=(t,e=0)=>{var i;if(t){let s,n=t.style.height;return t.style.height="0px",t.parentElement&&(t.parentElement.style.height="auto"),s=e-(((i=t.parentElement)==null?void 0:i.offsetHeight)||0),t.style.height=n+"px",t.parentElement&&t.parentElement.style.removeProperty("height"),s}return e},Nn={mp4:"video/mp4",m4a:"video/mp4",ogv:"video/ogg",mpeg:"video/mpeg",webm:"video/webm"},Mn=(t="")=>{let e=t.split(".").pop();return e?Nn[e]:void 0},zn=(t="")=>encodeURI(t).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Oi=navigator.userAgent,Pe=/(iphone|ipod|ipad|android)/gi.test(Oi)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,Fi=/android/gi.test(Oi),$n=(function(t){if(t){var e=function(v){return[].slice.call(v)},i=0,s=1,n=2,r=3,l=[],a=null,c="requestAnimationFrame"in t?function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};t.cancelAnimationFrame(a);var R=function(){return d(l.filter((function(z){return z.dirty&&z.active})))};if(v.sync)return R();a=t.requestAnimationFrame(R)}:function(){},o=function(v){return function(R){l.forEach((function(z){return z.dirty=v})),c(R)}},d=function(v){v.filter((function(z){return!z.styleComputed})).forEach((function(z){z.styleComputed=u(z)})),v.filter(b).forEach(k);var R=v.filter(p);R.forEach(g),R.forEach((function(z){k(z),h(z)})),R.forEach(N)},h=function(v){return v.dirty=i},g=function(v){v.availableWidth=v.element.parentNode.clientWidth,v.currentWidth=v.element.scrollWidth,v.previousFontSize=v.currentFontSize,v.currentFontSize=Math.min(Math.max(v.minSize,v.availableWidth/v.currentWidth*v.previousFontSize),v.maxSize),v.whiteSpace=v.multiLine&&v.currentFontSize===v.minSize?"normal":"nowrap"},p=function(v){return v.dirty!==n||v.dirty===n&&v.element.parentNode.clientWidth!==v.availableWidth},u=function(v){var R=t.getComputedStyle(v.element,null);return v.currentFontSize=parseFloat(R.getPropertyValue("font-size")),v.display=R.getPropertyValue("display"),v.whiteSpace=R.getPropertyValue("white-space"),!0},b=function(v){var R=!1;return!v.preStyleTestCompleted&&(/inline-/.test(v.display)||(R=!0,v.display="inline-block"),v.whiteSpace!=="nowrap"&&(R=!0,v.whiteSpace="nowrap"),v.preStyleTestCompleted=!0,R)},k=function(v){v.element.style.whiteSpace=v.whiteSpace,v.element.style.display=v.display,v.element.style.fontSize=v.currentFontSize+"px"},N=function(v){v.element.dispatchEvent(new CustomEvent("fit",{detail:{oldValue:v.previousFontSize,newValue:v.currentFontSize,scaleFactor:v.currentFontSize/v.previousFontSize}}))},$=function(v,R){return function(z){v.dirty=R,v.active&&c(z)}},L=function(v){return function(){l=l.filter((function(R){return R.element!==v.element})),v.observeMutations&&v.observer.disconnect(),v.element.style.whiteSpace=v.originalStyle.whiteSpace,v.element.style.display=v.originalStyle.display,v.element.style.fontSize=v.originalStyle.fontSize}},A=function(v){return function(){v.active||(v.active=!0,c())}},S=function(v){return function(){return v.active=!1}},B=function(v){v.observeMutations&&(v.observer=new MutationObserver($(v,s)),v.observer.observe(v.element,v.observeMutations))},C={minSize:16,maxSize:512,multiLine:!0,observeMutations:"MutationObserver"in t&&{subtree:!0,childList:!0,characterData:!0}},_=null,O=function(){t.clearTimeout(_),_=t.setTimeout(o(n),H.observeWindowDelay)},M=["resize","orientationchange"];return Object.defineProperty(H,"observeWindow",{set:function(v){var R=`${v?"add":"remove"}EventListener`;M.forEach((function(z){t[R](z,O)}))}}),H.observeWindow=!0,H.observeWindowDelay=100,H.fitAll=o(r),H}function Y(v,R){var z=Object.assign({},C,R),Z=v.map((function(te){var se=Object.assign({},z,{element:te,active:!0});return(function(Q){Q.originalStyle={whiteSpace:Q.element.style.whiteSpace,display:Q.element.style.display,fontSize:Q.element.style.fontSize},B(Q),Q.newbie=!0,Q.dirty=!0,l.push(Q)})(se),{element:te,fit:$(se,r),unfreeze:A(se),freeze:S(se),unsubscribe:L(se)}}));return c(),Z}function H(v){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof v=="string"?Y(e(document.querySelectorAll(v)),R):Y([v],R)[0]}})(typeof window>"u"?null:window),Bn=class{constructor(t){_i(this,"allowedToPlayAudio",null),this.Reveal=t,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement("button"),this.mediaPlayButton.className="r-overlay-button r-media-play-button",this.mediaPlayButton.addEventListener("click",()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(t=>{this.startEmbeddedMedia({target:t})}),this.clearMediaPlaybackErrors()})}shouldPreload(t){if(this.Reveal.isScrollView())return!0;let e=this.Reveal.getConfig().preloadIframes;return typeof e!="boolean"&&(e=t.hasAttribute("data-preload")),e}load(t,e={}){let i=this.Reveal.getConfig().display;if(i.includes("!important")){let n=i.replace(/\s*!important\s*$/,"").trim();t.style.setProperty("display",n,"important")}else t.style.display=i;P(t,"img[data-src], video[data-src], audio[data-src], iframe[data-src]").forEach(n=>{let r=n.tagName==="IFRAME";(!r||this.shouldPreload(n))&&(n.setAttribute("src",n.getAttribute("data-src")),n.setAttribute("data-lazy-loaded",""),n.removeAttribute("data-src"),r&&n.addEventListener("load",this.preventIframeAutoFocus))}),P(t,"video, audio").forEach(n=>{let r=0;P(n,"source[data-src]").forEach(l=>{l.setAttribute("src",l.getAttribute("data-src")),l.removeAttribute("data-src"),l.setAttribute("data-lazy-loaded",""),r+=1}),Pe&&n.tagName==="VIDEO"&&n.setAttribute("playsinline",""),r>0&&n.load()});let s=t.slideBackgroundElement;if(s){s.style.display="block";let n=t.slideBackgroundContentElement,r=t.getAttribute("data-background-iframe");if(s.hasAttribute("data-loaded")===!1){s.setAttribute("data-loaded","true");let a=t.getAttribute("data-background-image"),c=t.getAttribute("data-background-video"),o=t.hasAttribute("data-background-video-loop"),d=t.hasAttribute("data-background-video-muted");if(a)/^data:/.test(a.trim())?n.style.backgroundImage=`url(${a.trim()})`:n.style.backgroundImage=a.split(",").map(h=>`url(${zn(decodeURI(h.trim()))})`).join(",");else if(c){let h=document.createElement("video");o&&h.setAttribute("loop",""),(d||this.Reveal.isSpeakerNotes())&&(h.muted=!0),Pe&&h.setAttribute("playsinline",""),c.split(",").forEach(g=>{let p=document.createElement("source");p.setAttribute("src",g);let u=Mn(g);u&&p.setAttribute("type",u),h.appendChild(p)}),n.appendChild(h)}else if(r&&e.excludeIframes!==!0){let h=document.createElement("iframe");h.setAttribute("allowfullscreen",""),h.setAttribute("mozallowfullscreen",""),h.setAttribute("webkitallowfullscreen",""),h.setAttribute("allow","autoplay"),h.setAttribute("data-src",r),h.style.width="100%",h.style.height="100%",h.style.maxHeight="100%",h.style.maxWidth="100%",n.appendChild(h)}}let l=n.querySelector("iframe[data-src]");l&&this.shouldPreload(s)&&!/autoplay=(1|true|yes)/gi.test(r)&&l.getAttribute("src")!==r&&l.setAttribute("src",r)}this.layout(t)}layout(t){Array.from(t.querySelectorAll(".r-fit-text")).forEach(e=>{$n(e,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(t){t.style.display="none";let e=this.Reveal.getSlideBackground(t);e&&(e.style.display="none",P(e,"iframe[src]").forEach(i=>{i.removeAttribute("src")})),P(t,"video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]").forEach(i=>{i.setAttribute("data-src",i.getAttribute("src")),i.removeAttribute("src")}),P(t,"video[data-lazy-loaded] source[src], audio source[src]").forEach(i=>{i.setAttribute("data-src",i.getAttribute("src")),i.removeAttribute("src")})}formatEmbeddedContent(){let t=(e,i,s)=>{P(this.Reveal.getSlidesElement(),"iframe["+e+'*="'+i+'"]').forEach(n=>{let r=n.getAttribute(e);r&&r.indexOf(s)===-1&&n.setAttribute(e,r+(/\?/.test(r)?"&":"?")+s)})};t("src","youtube.com/embed/","enablejsapi=1"),t("data-src","youtube.com/embed/","enablejsapi=1"),t("src","player.vimeo.com/","api=1"),t("data-src","player.vimeo.com/","api=1")}startEmbeddedContent(t){if(t){let e=this.Reveal.isSpeakerNotes();P(t,'img[src$=".gif"]').forEach(i=>{i.setAttribute("src",i.getAttribute("src"))}),P(t,"video, audio").forEach(i=>{if(ee(i,".fragment")&&!ee(i,".fragment.visible"))return;let s=this.Reveal.getConfig().autoPlayMedia;if(typeof s!="boolean"&&(s=i.hasAttribute("data-autoplay")||!!ee(i,".slide-background")),s&&typeof i.play=="function"){if(e&&!i.muted)return;i.readyState>1?this.startEmbeddedMedia({target:i}):Pe?(i.addEventListener("canplay",this.ensureMobileMediaPlaying),this.playMediaElement(i)):(i.removeEventListener("loadeddata",this.startEmbeddedMedia),i.addEventListener("loadeddata",this.startEmbeddedMedia))}}),e||(P(t,"iframe[src]").forEach(i=>{ee(i,".fragment")&&!ee(i,".fragment.visible")||this.startEmbeddedIframe({target:i})}),P(t,"iframe[data-src]").forEach(i=>{ee(i,".fragment")&&!ee(i,".fragment.visible")||i.getAttribute("src")!==i.getAttribute("data-src")&&(i.removeEventListener("load",this.startEmbeddedIframe),i.addEventListener("load",this.startEmbeddedIframe),i.setAttribute("src",i.getAttribute("data-src")))}))}}ensureMobileMediaPlaying(t){let e=t.target;typeof e.getVideoPlaybackQuality=="function"&&setTimeout(()=>{let i=e.paused===!1,s=e.getVideoPlaybackQuality().totalVideoFrames;i&&s===0&&(e.load(),e.play())},1e3)}startEmbeddedMedia(t){let e=!!ee(t.target,"html"),i=!!ee(t.target,".present");e&&i&&(t.target.paused||t.target.ended)&&(t.target.currentTime=0,this.playMediaElement(t.target)),t.target.removeEventListener("loadeddata",this.startEmbeddedMedia)}playMediaElement(t){let e=t.play();e&&typeof e.catch=="function"&&e.then(()=>{t.muted||(this.allowedToPlayAudio=!0)}).catch(i=>{if(i.name==="NotAllowedError")if(this.allowedToPlayAudio=!1,t.tagName==="VIDEO"){this.onVideoPlaybackNotAllowed(t);let s=!!ee(t,"html"),n=!!ee(t,".present"),r=t.muted;s&&n&&!r&&(t.setAttribute("data-muted-by-reveal","true"),t.muted=!0,t.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(t)}))}else t.tagName==="AUDIO"&&this.onAudioPlaybackNotAllowed(t)})}startEmbeddedIframe(t){let e=t.target;if(this.preventIframeAutoFocus(t),e&&e.contentWindow){let i=!!ee(t.target,"html"),s=!!ee(t.target,".present");if(i&&s){let n=this.Reveal.getConfig().autoPlayMedia;typeof n!="boolean"&&(n=e.hasAttribute("data-autoplay")||!!ee(e,".slide-background")),/youtube\.com\/embed\//.test(e.getAttribute("src"))&&n?e.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*"):/player\.vimeo\.com\//.test(e.getAttribute("src"))&&n?e.contentWindow.postMessage('{"method":"play"}',"*"):e.contentWindow.postMessage("slide:start","*")}}}stopEmbeddedContent(t,e={}){e=_e({unloadIframes:!0},e),t&&t.parentNode&&(P(t,"video, audio").forEach(i=>{!i.hasAttribute("data-ignore")&&typeof i.pause=="function"&&(i.setAttribute("data-paused-by-reveal",""),i.pause(),Pe&&i.removeEventListener("canplay",this.ensureMobileMediaPlaying))}),P(t,"iframe").forEach(i=>{i.contentWindow&&i.contentWindow.postMessage("slide:stop","*"),i.removeEventListener("load",this.preventIframeAutoFocus),i.removeEventListener("load",this.startEmbeddedIframe)}),P(t,'iframe[src*="youtube.com/embed/"]').forEach(i=>{!i.hasAttribute("data-ignore")&&i.contentWindow&&typeof i.contentWindow.postMessage=="function"&&i.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}),P(t,'iframe[src*="player.vimeo.com/"]').forEach(i=>{!i.hasAttribute("data-ignore")&&i.contentWindow&&typeof i.contentWindow.postMessage=="function"&&i.contentWindow.postMessage('{"method":"pause"}',"*")}),e.unloadIframes===!0&&P(t,"iframe[data-src]").forEach(i=>{i.setAttribute("src","about:blank"),i.removeAttribute("src")}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let t=this.failedAudioPlaybackTargets.size,e=this.failedVideoPlaybackTargets.size,i=this.failedMutedVideoPlaybackTargets.size,s="Play media";i>0?s="Play video":e>0?s="Unmute video":t>0&&(s="Play audio"),this.mediaPlayButton.textContent=s,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(t){this.failedAudioPlaybackTargets.add(t),this.showPlayOrUnmuteButton(t)}onVideoPlaybackNotAllowed(t){this.failedVideoPlaybackTargets.add(t),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(t){this.failedMutedVideoPlaybackTargets.add(t),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(t=>{t.hasAttribute("data-muted-by-reveal")&&(t.muted=!1,t.removeAttribute("data-muted-by-reveal"))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton.remove()}preventIframeAutoFocus(t){let e=t.target;if(e&&this.Reveal.getConfig().preventIframeAutoFocus){let i=0,s=()=>{document.activeElement===e?document.activeElement.blur():i<1e3&&(i+=100,setTimeout(s,100))};setTimeout(s,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},Ie=".slides section",we=".slides>section",Vt=".slides>section.present>section",Hn=".backgrounds>.slide-background",Dn=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview/,_n="h.v",jn="h/v",Ut="c",Vi="c/t",qn=class{constructor(t){this.Reveal=t}render(){this.element=document.createElement("div"),this.element.className="slide-number",this.Reveal.getRevealElement().appendChild(this.element)}configure(t,e){let i="none";t.slideNumber&&!this.Reveal.isPrintView()&&(t.showSlideNumber==="all"||t.showSlideNumber==="speaker"&&this.Reveal.isSpeakerNotes())&&(i="block"),this.element.style.display=i}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(t=this.Reveal.getCurrentSlide()){let e=this.Reveal.getConfig(),i,s=_n;if(typeof e.slideNumber=="function")i=e.slideNumber(t);else{typeof e.slideNumber=="string"&&(s=e.slideNumber),!/c/.test(s)&&this.Reveal.getHorizontalSlides().length===1&&(s=Ut);let r=t&&t.dataset.visibility==="uncounted"?0:1;switch(i=[],s){case Ut:i.push(this.Reveal.getSlidePastCount(t)+r);break;case Vi:i.push(this.Reveal.getSlidePastCount(t)+r,"/",this.Reveal.getTotalSlides());break;default:let l=this.Reveal.getIndices(t);i.push(l.h+r);let a=s===jn?"/":".";this.Reveal.isVerticalSlide(t)&&i.push(a,l.v+1)}}let n="#"+this.Reveal.location.getHash(t);return this.formatNumber(i[0],i[1],i[2],n)}formatNumber(t,e,i,s="#"+this.Reveal.location.getHash()){return typeof i=="number"&&!isNaN(i)?`<a href="${s}">
2
2
  <span class="slide-number-a">${t}</span>
3
3
  <span class="slide-number-delimiter">${e}</span>
4
4
  <span class="slide-number-b">${i}</span>
@@ -1 +1 @@
1
- import{o as P}from"./chunk-C4rtOYze.js";import{p as L,u as T}from"./useEvent-GCVIknuR.js";import{t as U}from"./react-C60yClUi.js";import{$i as D,E as F,b as W,h as q}from"./cells-Biwqg0z6.js";import"./react-dom-Ba2zmJWD.js";import{t as E}from"./compiler-runtime-DnimoHo0.js";import{C as M}from"./utils-C8Yt16Y7.js";import{n as z}from"./constants-DifUxsbZ.js";import{N as V,l as A,m as G,v as H}from"./config-DFK5eCC3.js";import"./readonly-python-code-BHrAhtGV.js";import{t as J}from"./cn-DCUzRj2J.js";import{t as K}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import"./popover-B96fOqfH.js";import{F as Q,Lt as X}from"./JsonOutput-htT793Wj.js";import{n as Y}from"./download-CfUkZlw7.js";import{n as Z,t as R}from"./button-W__YVea9.js";import"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{r as ee}from"./requests-B9zEd_sW.js";import"./layout-YPBtS2D6.js";import{t as te}from"./arrow-left-bDqa4sSj.js";import"./markdown-renderer-BOS4jZLt.js";import{t as re}from"./copy-DlR5UiIE.js";import{d as se,i as oe,l as ae,n as ie,r as O,t as ne,u as me}from"./panels-DRv39UwA.js";import{t as le}from"./spinner-Cj3eM5bt.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import{t as ce}from"./use-toast-DjpWVza6.js";import{t as de}from"./session-D-SddyN0.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import{n as pe}from"./copy-HCSOwOwk.js";import{a as he,c as fe,l as xe,n as be,r as je,t as ue}from"./dialog-WU4x2UpK.js";import{t as ge}from"./share-c5Zh8BM8.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import{a as ye}from"./cell-link-Bx8FWjns.js";import"./chunk-5FQGJX7Z-BIDn9QG0.js";import"./html-to-image-ChfBVn8-.js";import{n as ke,t as _e}from"./react-resizable-panels.browser.esm-CLaR27oP.js";import"./esm-RBKN8Dn2.js";import"./name-cell-input-UMsLssMV.js";import{n as Ne,t as ve}from"./marimo-icons-BT3Q9hP-.js";import"./ws-B3l5rS71.js";import"./dist-CiELQ2ik.js";import"./dist-CtsSPT78.js";import"./dist-BpyRMlx3.js";import"./dist-Cnb7x5X_.js";import"./dist-B_Q1ayL4.js";import"./dist-CnESRnx2.js";import"./dist-M9OI1ywz.js";import"./dist-DcwGajoh.js";import"./dist-DXl-iyI_.js";import"./esm-B7G79VOo.js";var we=E(),Se=P(U(),1),t=P(K(),1),Ce=L(o=>o(q)||!G(o(H).state));const ze=o=>{let e=(0,we.c)(22),{appConfig:s}=o,{setCells:r}=F(),{sendComponentValues:l}=ee(),a;e[0]===l?a=e[1]:(a=()=>(O.INSTANCE.start(l),Re),e[0]=l,e[1]=a);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[2]=i):i=e[2],(0,Se.useEffect)(a,i);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=de(),e[3]=c):c=e[3];let g;e[4]===r?g=e[5]:(g={autoInstantiate:!0,setCells:r,sessionId:c},e[4]=r,e[5]=g);let{connection:j,reconnect:k}=ie(g),u=T(W),d;e:{if(typeof window>"u"){d=null;break e}let b,m;if(e[6]===Symbol.for("react.memo_cache_sentinel")){if(m=new URL(window.location.href),!m.searchParams.has("file")){d=null;break e}m.searchParams.delete("file"),b=m.searchParams.toString(),e[6]=b,e[7]=m,e[8]=d}else b=e[6],m=e[7],d=e[8];let y=b;d=y?`${m.pathname}?${y}`:m.pathname}let _=d,p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=_&&(0,t.jsx)("div",{className:"flex items-center px-6 pt-4 sm:-mt-8",children:(0,t.jsxs)("a",{href:_,"aria-label":"Back to gallery",className:J(Z({variant:"text",size:"sm"}),"gap-2 px-0 text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(te,{className:"size-4","aria-hidden":!0}),(0,t.jsx)("span",{children:"Back"})]})}),e[9]=p):p=e[9];let h;e[10]===j?h=e[11]:(h=(0,t.jsx)(se,{connection:j,className:"sm:pt-8",children:p}),e[10]=j,e[11]=h);let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(le,{className:"mx-auto"}),(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground mt-2",children:"Connecting..."})]}),e[12]=f):f=e[12];let n;e[13]===s?n=e[14]:(n=(0,t.jsx)(me,{requires:Ce,delay:2e3,fallback:f,children:(0,t.jsx)(oe,{appConfig:s,mode:"read"})}),e[13]=s,e[14]=n);let x;return e[15]!==s.width||e[16]!==j||e[17]!==u||e[18]!==k||e[19]!==h||e[20]!==n?(x=(0,t.jsxs)(ae,{connection:j,isRunning:u,width:s.width,onReconnect:k,children:[h,n]}),e[15]=s.width,e[16]=j,e[17]=u,e[18]=k,e[19]=h,e[20]=n,e[21]=x):x=e[21],x};function Re(){O.INSTANCE.stop()}var $=E();const Ee=()=>{let o=(0,$.c)(3),e=T(D);if(!A()||!e)return null;let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("span",{children:["Static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) font-medium underline",children:"marimo"})," ","notebook - Run or edit for full interactivity"]}),o[0]=s):s=o[0];let r;return o[1]===e?r=o[2]:(r=(0,t.jsxs)("div",{className:"px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm","data-testid":"static-notebook-banner",children:[s,(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(Ie,{code:e})})]}),o[1]=e,o[2]=r),r};var Ie=o=>{var I;let e=(0,$.c)(36),{code:s}=o,r=ye()||"notebook.py",l=r.lastIndexOf("/");l!==-1&&(r=r.slice(l+1));let[a]=M(),i=((I=a.sharing)==null?void 0:I.molab)!==!1,c=window.location.href,g;e[0]===s?g=e[1]:(g=ge({code:s,baseUrl:`${z.molab}/new`}),e[0]=s,e[1]=g);let j=g,k;e[2]===Symbol.for("react.memo_cache_sentinel")?(k=(0,t.jsx)(xe,{asChild:!0,children:(0,t.jsx)(R,{"data-testid":"static-notebook-dialog-trigger",variant:"outline",size:"xs",children:"Run or Edit"})}),e[2]=k):k=e[2];let u;e[3]===r?u=e[4]:(u=(0,t.jsx)(fe,{children:r}),e[3]=r,e[4]=u);let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsxs)("p",{children:["This is a static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) hover:underline font-medium",children:"marimo"})," ","notebook. To run interactively:"]}),e[5]=d):d=e[5];let _;e[6]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)("br",{}),e[6]=_):_=e[6];let p;e[7]===r?p=e[8]:(p=(0,t.jsx)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) leading-relaxed",children:["pip install marimo",_,"marimo edit ",r]})}),e[7]=r,e[8]=p);let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=!c.endsWith(".html")&&(0,t.jsxs)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:[(0,t.jsx)("div",{className:"text-sm text-(--sky-12) mb-1",children:"Or run directly from URL:"}),(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) break-all",children:["marimo edit ",window.location.href]})]}),e[9]=h):h=e[9];let f;e[10]!==i||e[11]!==j?(f=i&&(0,t.jsxs)("div",{className:"pt-3 border-t flex gap-2 items-center",children:[(0,t.jsx)(R,{asChild:!0,variant:"outline",size:"xs",className:"shrink-0",children:(0,t.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(Ne,{size:12,strokeWidth:1.5,className:"mr-1.5 mt-px text-(--grass-11)"}),"Open in molab"]})}),(0,t.jsxs)("p",{className:"text-sm text-(--sky-12)",children:["Run this notebook in"," ",(0,t.jsx)("span",{className:"font-semibold",children:"molab"}),", marimo's cloud-hosted notebook platform."]})]}),e[10]=i,e[11]=j,e[12]=f):f=e[12];let n;e[13]!==p||e[14]!==f?(n=(0,t.jsxs)(je,{className:"pt-3 text-left space-y-3",children:[d,p,h,f]}),e[13]=p,e[14]=f,e[15]=n):n=e[15];let x;e[16]!==u||e[17]!==n?(x=(0,t.jsxs)(he,{children:[u,n]}),e[16]=u,e[17]=n,e[18]=x):x=e[18];let b;e[19]===s?b=e[20]:(b=async()=>{await pe(s),ce({title:"Copied to clipboard"})},e[19]=s,e[20]=b);let m;e[21]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(re,{className:"w-3 h-3 mr-2"}),e[21]=m):m=e[21];let y;e[22]===b?y=e[23]:(y=(0,t.jsxs)(R,{"data-testid":"copy-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:b,children:[m,"Copy code"]}),e[22]=b,e[23]=y);let N;e[24]!==s||e[25]!==r?(N=()=>{Y(new Blob([s],{type:"text/plain"}),r)},e[24]=s,e[25]=r,e[26]=N):N=e[26];let S;e[27]===Symbol.for("react.memo_cache_sentinel")?(S=(0,t.jsx)(X,{className:"w-3 h-3 mr-2"}),e[27]=S):S=e[27];let v;e[28]===N?v=e[29]:(v=(0,t.jsxs)(R,{"data-testid":"download-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:N,children:[S,"Download"]}),e[28]=N,e[29]=v);let w;e[30]!==y||e[31]!==v?(w=(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[y,v]}),e[30]=y,e[31]=v,e[32]=w):w=e[32];let C;return e[33]!==x||e[34]!==w?(C=(0,t.jsxs)(ue,{children:[k,(0,t.jsxs)(be,{children:[x,w]})]}),e[33]=x,e[34]=w,e[35]=C):C=e[35],C},B=E(),Pe=V()||A(),Te=o=>{let e=(0,B.c)(9),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(Ee,{}),e[0]=s):s=e[0];let r;e[1]===o.appConfig?r=e[2]:(r=(0,t.jsx)(ze,{appConfig:o.appConfig}),e[1]=o.appConfig,e[2]=r);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=Pe&&(0,t.jsx)(Ae,{}),e[3]=l):l=e[3];let a;e[4]===r?a=e[5]:(a=(0,t.jsxs)(_e,{children:[s,r,l]}),e[4]=r,e[5]=a);let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(Q,{}),e[6]=i):i=e[6];let c;return e[7]===a?c=e[8]:(c=(0,t.jsx)(ne,{children:(0,t.jsxs)(ke,{direction:"horizontal",autoSaveId:"marimo:chrome:v1:run1",children:[a,i]})}),e[7]=a,e[8]=c),c},Ae=()=>{let o=(0,B.c)(1),e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"fixed bottom-0 right-0 z-50 print:hidden","data-testid":"watermark",children:(0,t.jsxs)("a",{href:z.githubPage,target:"_blank",className:"text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2",children:[(0,t.jsx)("span",{children:"made with marimo"}),(0,t.jsx)(ve,{className:"h-4 w-auto"})]})}),o[0]=e):e=o[0],e},Oe=Te;export{Oe as default};
1
+ import{o as P}from"./chunk-C4rtOYze.js";import{p as L,u as T}from"./useEvent-GCVIknuR.js";import{t as U}from"./react-C60yClUi.js";import{$i as D,E as F,b as W,h as q}from"./cells-BIt-E5vq.js";import"./react-dom-Ba2zmJWD.js";import{t as E}from"./compiler-runtime-DnimoHo0.js";import{C as M}from"./utils-C8Yt16Y7.js";import{n as z}from"./constants-DifUxsbZ.js";import{N as V,l as A,m as G,v as H}from"./config-DFK5eCC3.js";import"./readonly-python-code-DeHfRkyx.js";import{t as J}from"./cn-DCUzRj2J.js";import{t as K}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import"./popover-B96fOqfH.js";import{F as Q,Lt as X}from"./JsonOutput-CbpX5Kgt.js";import{n as Y}from"./download-DYiwRe8_.js";import{n as Z,t as R}from"./button-W__YVea9.js";import"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{r as ee}from"./requests-B9zEd_sW.js";import"./layout-BBB9DQha.js";import{t as te}from"./arrow-left-bDqa4sSj.js";import"./markdown-renderer-CP1Up_3K.js";import{t as re}from"./copy-DlR5UiIE.js";import{d as se,i as oe,l as ae,n as ie,r as O,t as ne,u as me}from"./panels-v1_Bo-9b.js";import{t as le}from"./spinner-Cj3eM5bt.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import{t as ce}from"./use-toast-DjpWVza6.js";import{t as de}from"./session-D-SddyN0.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import{n as pe}from"./copy-HCSOwOwk.js";import{a as he,c as fe,l as xe,n as be,r as je,t as ue}from"./dialog-WU4x2UpK.js";import{t as ge}from"./share-c5Zh8BM8.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import{a as ye}from"./cell-link-CvOBew-Z.js";import"./chunk-5FQGJX7Z-BIDn9QG0.js";import"./html-to-image-BvGsu9Nz.js";import{n as ke,t as _e}from"./react-resizable-panels.browser.esm-CLaR27oP.js";import"./esm-RBKN8Dn2.js";import"./name-cell-input-7EVAIGJb.js";import{n as Ne,t as ve}from"./marimo-icons-BT3Q9hP-.js";import"./ws-B3l5rS71.js";import"./dist-CiELQ2ik.js";import"./dist-CtsSPT78.js";import"./dist-BpyRMlx3.js";import"./dist-Cnb7x5X_.js";import"./dist-B_Q1ayL4.js";import"./dist-CnESRnx2.js";import"./dist-M9OI1ywz.js";import"./dist-DcwGajoh.js";import"./dist-DXl-iyI_.js";import"./esm-B7G79VOo.js";var we=E(),Se=P(U(),1),t=P(K(),1),Ce=L(o=>o(q)||!G(o(H).state));const ze=o=>{let e=(0,we.c)(22),{appConfig:s}=o,{setCells:r}=F(),{sendComponentValues:l}=ee(),a;e[0]===l?a=e[1]:(a=()=>(O.INSTANCE.start(l),Re),e[0]=l,e[1]=a);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],e[2]=i):i=e[2],(0,Se.useEffect)(a,i);let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=de(),e[3]=c):c=e[3];let g;e[4]===r?g=e[5]:(g={autoInstantiate:!0,setCells:r,sessionId:c},e[4]=r,e[5]=g);let{connection:j,reconnect:k}=ie(g),u=T(W),d;e:{if(typeof window>"u"){d=null;break e}let b,m;if(e[6]===Symbol.for("react.memo_cache_sentinel")){if(m=new URL(window.location.href),!m.searchParams.has("file")){d=null;break e}m.searchParams.delete("file"),b=m.searchParams.toString(),e[6]=b,e[7]=m,e[8]=d}else b=e[6],m=e[7],d=e[8];let y=b;d=y?`${m.pathname}?${y}`:m.pathname}let _=d,p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=_&&(0,t.jsx)("div",{className:"flex items-center px-6 pt-4 sm:-mt-8",children:(0,t.jsxs)("a",{href:_,"aria-label":"Back to gallery",className:J(Z({variant:"text",size:"sm"}),"gap-2 px-0 text-muted-foreground hover:text-foreground"),children:[(0,t.jsx)(te,{className:"size-4","aria-hidden":!0}),(0,t.jsx)("span",{children:"Back"})]})}),e[9]=p):p=e[9];let h;e[10]===j?h=e[11]:(h=(0,t.jsx)(se,{connection:j,className:"sm:pt-8",children:p}),e[10]=j,e[11]=h);let f;e[12]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(le,{className:"mx-auto"}),(0,t.jsx)("p",{className:"text-center text-sm text-muted-foreground mt-2",children:"Connecting..."})]}),e[12]=f):f=e[12];let n;e[13]===s?n=e[14]:(n=(0,t.jsx)(me,{requires:Ce,delay:2e3,fallback:f,children:(0,t.jsx)(oe,{appConfig:s,mode:"read"})}),e[13]=s,e[14]=n);let x;return e[15]!==s.width||e[16]!==j||e[17]!==u||e[18]!==k||e[19]!==h||e[20]!==n?(x=(0,t.jsxs)(ae,{connection:j,isRunning:u,width:s.width,onReconnect:k,children:[h,n]}),e[15]=s.width,e[16]=j,e[17]=u,e[18]=k,e[19]=h,e[20]=n,e[21]=x):x=e[21],x};function Re(){O.INSTANCE.stop()}var $=E();const Ee=()=>{let o=(0,$.c)(3),e=T(D);if(!A()||!e)return null;let s;o[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("span",{children:["Static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) font-medium underline",children:"marimo"})," ","notebook - Run or edit for full interactivity"]}),o[0]=s):s=o[0];let r;return o[1]===e?r=o[2]:(r=(0,t.jsxs)("div",{className:"px-4 py-2 bg-(--sky-2) border-b border-(--sky-7) text-(--sky-11) flex justify-between items-center gap-4 print:hidden text-sm","data-testid":"static-notebook-banner",children:[s,(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(Ie,{code:e})})]}),o[1]=e,o[2]=r),r};var Ie=o=>{var I;let e=(0,$.c)(36),{code:s}=o,r=ye()||"notebook.py",l=r.lastIndexOf("/");l!==-1&&(r=r.slice(l+1));let[a]=M(),i=((I=a.sharing)==null?void 0:I.molab)!==!1,c=window.location.href,g;e[0]===s?g=e[1]:(g=ge({code:s,baseUrl:`${z.molab}/new`}),e[0]=s,e[1]=g);let j=g,k;e[2]===Symbol.for("react.memo_cache_sentinel")?(k=(0,t.jsx)(xe,{asChild:!0,children:(0,t.jsx)(R,{"data-testid":"static-notebook-dialog-trigger",variant:"outline",size:"xs",children:"Run or Edit"})}),e[2]=k):k=e[2];let u;e[3]===r?u=e[4]:(u=(0,t.jsx)(fe,{children:r}),e[3]=r,e[4]=u);let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsxs)("p",{children:["This is a static"," ",(0,t.jsx)("a",{href:z.githubPage,target:"_blank",className:"text-(--sky-11) hover:underline font-medium",children:"marimo"})," ","notebook. To run interactively:"]}),e[5]=d):d=e[5];let _;e[6]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)("br",{}),e[6]=_):_=e[6];let p;e[7]===r?p=e[8]:(p=(0,t.jsx)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) leading-relaxed",children:["pip install marimo",_,"marimo edit ",r]})}),e[7]=r,e[8]=p);let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=!c.endsWith(".html")&&(0,t.jsxs)("div",{className:"rounded-lg p-3 border bg-(--sky-2) border-(--sky-7)",children:[(0,t.jsx)("div",{className:"text-sm text-(--sky-12) mb-1",children:"Or run directly from URL:"}),(0,t.jsxs)("div",{className:"font-mono text-(--sky-11) break-all",children:["marimo edit ",window.location.href]})]}),e[9]=h):h=e[9];let f;e[10]!==i||e[11]!==j?(f=i&&(0,t.jsxs)("div",{className:"pt-3 border-t flex gap-2 items-center",children:[(0,t.jsx)(R,{asChild:!0,variant:"outline",size:"xs",className:"shrink-0",children:(0,t.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(Ne,{size:12,strokeWidth:1.5,className:"mr-1.5 mt-px text-(--grass-11)"}),"Open in molab"]})}),(0,t.jsxs)("p",{className:"text-sm text-(--sky-12)",children:["Run this notebook in"," ",(0,t.jsx)("span",{className:"font-semibold",children:"molab"}),", marimo's cloud-hosted notebook platform."]})]}),e[10]=i,e[11]=j,e[12]=f):f=e[12];let n;e[13]!==p||e[14]!==f?(n=(0,t.jsxs)(je,{className:"pt-3 text-left space-y-3",children:[d,p,h,f]}),e[13]=p,e[14]=f,e[15]=n):n=e[15];let x;e[16]!==u||e[17]!==n?(x=(0,t.jsxs)(he,{children:[u,n]}),e[16]=u,e[17]=n,e[18]=x):x=e[18];let b;e[19]===s?b=e[20]:(b=async()=>{await pe(s),ce({title:"Copied to clipboard"})},e[19]=s,e[20]=b);let m;e[21]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(re,{className:"w-3 h-3 mr-2"}),e[21]=m):m=e[21];let y;e[22]===b?y=e[23]:(y=(0,t.jsxs)(R,{"data-testid":"copy-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:b,children:[m,"Copy code"]}),e[22]=b,e[23]=y);let N;e[24]!==s||e[25]!==r?(N=()=>{Y(new Blob([s],{type:"text/plain"}),r)},e[24]=s,e[25]=r,e[26]=N):N=e[26];let S;e[27]===Symbol.for("react.memo_cache_sentinel")?(S=(0,t.jsx)(X,{className:"w-3 h-3 mr-2"}),e[27]=S):S=e[27];let v;e[28]===N?v=e[29]:(v=(0,t.jsxs)(R,{"data-testid":"download-static-notebook-dialog-button",variant:"outline",size:"sm",onClick:N,children:[S,"Download"]}),e[28]=N,e[29]=v);let w;e[30]!==y||e[31]!==v?(w=(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[y,v]}),e[30]=y,e[31]=v,e[32]=w):w=e[32];let C;return e[33]!==x||e[34]!==w?(C=(0,t.jsxs)(ue,{children:[k,(0,t.jsxs)(be,{children:[x,w]})]}),e[33]=x,e[34]=w,e[35]=C):C=e[35],C},B=E(),Pe=V()||A(),Te=o=>{let e=(0,B.c)(9),s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(Ee,{}),e[0]=s):s=e[0];let r;e[1]===o.appConfig?r=e[2]:(r=(0,t.jsx)(ze,{appConfig:o.appConfig}),e[1]=o.appConfig,e[2]=r);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=Pe&&(0,t.jsx)(Ae,{}),e[3]=l):l=e[3];let a;e[4]===r?a=e[5]:(a=(0,t.jsxs)(_e,{children:[s,r,l]}),e[4]=r,e[5]=a);let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(Q,{}),e[6]=i):i=e[6];let c;return e[7]===a?c=e[8]:(c=(0,t.jsx)(ne,{children:(0,t.jsxs)(ke,{direction:"horizontal",autoSaveId:"marimo:chrome:v1:run1",children:[a,i]})}),e[7]=a,e[8]=c),c},Ae=()=>{let o=(0,B.c)(1),e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"fixed bottom-0 right-0 z-50 print:hidden","data-testid":"watermark",children:(0,t.jsxs)("a",{href:z.githubPage,target:"_blank",className:"text-sm text-(--grass-11) font-bold tracking-wide transition-colors bg-(--grass-4) hover:bg-(--grass-5) border-t border-l border-(--grass-8) px-3 py-1 rounded-tl-md flex items-center gap-2",children:[(0,t.jsx)("span",{children:"made with marimo"}),(0,t.jsx)(ve,{className:"h-4 w-auto"})]})}),o[0]=e):e=o[0],e},Oe=Te;export{Oe as default};
@@ -1 +1 @@
1
- import{o as ae}from"./chunk-C4rtOYze.js";import{d as be,l as ye,n as V,p as oe,u as we}from"./useEvent-GCVIknuR.js";import{t as Ne}from"./react-C60yClUi.js";import{E as ke,F as ze,Kn as Ce,aa as Se,ma as n,pa as Oe,__tla as Ae}from"./cells-Biwqg0z6.js";import"./react-dom-Ba2zmJWD.js";import{t as se}from"./compiler-runtime-DnimoHo0.js";import{_ as ie}from"./useEventListener-DpNnLPuE.js";import{C as Ie}from"./utils-C8Yt16Y7.js";import{t as Ee}from"./constants-DifUxsbZ.js";import"./readonly-python-code-BHrAhtGV.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as Le}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import"./popover-B96fOqfH.js";import{n as Me,__tla as Pe}from"./JsonOutput-htT793Wj.js";import"./download-CfUkZlw7.js";import{t as z}from"./tooltip-C9LWGQ7Y.js";import{t as C}from"./button-W__YVea9.js";import"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{r as Re}from"./requests-B9zEd_sW.js";import{t as me}from"./createLucideIcon-B8oVfJNp.js";import{d as De,__tla as He}from"./layout-YPBtS2D6.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-Bx0i_n8B.js";import{__tla as Fe}from"./markdown-renderer-BOS4jZLt.js";import{u as Ge}from"./toDate-QOk09NqD.js";import"./add-cell-with-ai-Chy4ITIT.js";import{t as Ke,__tla as Ue}from"./cell-editor-DgOfL9Xv.js";import{t as Be}from"./spinner-Cj3eM5bt.js";import{i as Je}from"./useDeleteCell-BgFMPTmg.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import{r as Qe}from"./useTheme-CwCyrmDf.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import{__tla as We}from"./chunk-5FQGJX7Z-BIDn9QG0.js";import"./html-to-image-ChfBVn8-.js";import{o as Xe}from"./focus-CeTtpVjV.js";import{n as Ye,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-CLaR27oP.js";import{a as $e}from"./renderShortcut-C6HKXhBl.js";import"./esm-RBKN8Dn2.js";import"./name-cell-input-UMsLssMV.js";import{n as et,r as tt}from"./panel-context-CkhpgwrR.js";import{__tla as rt}from"./loro_wasm_bg-wiZiHqmd.js";import"./ws-B3l5rS71.js";import"./Inputs-S6F4fq1S.js";import"./dist-CiELQ2ik.js";import"./dist-CtsSPT78.js";import"./dist-BpyRMlx3.js";import"./dist-Cnb7x5X_.js";import"./dist-B_Q1ayL4.js";import"./dist-CnESRnx2.js";import"./dist-M9OI1ywz.js";import"./dist-DcwGajoh.js";import"./dist-DXl-iyI_.js";import"./esm-B7G79VOo.js";import{t as at}from"./kiosk-mode-CNguD0K4.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return Ue}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}catch{}})()]).then(async()=>{var de=me("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),pe=me("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),he=se(),q=ae(Ne(),1),ue=15;const T=Se("marimo:scratchpadHistory:v1",[],Ce),fe=oe(!1),xe=oe(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(T);s(T,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=ae(Le(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ze(),[i]=Ie(),{theme:m}=Qe(),c=(0,q.useRef)(null),F=Xe(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:p}=Re(),S=et(),K=tt(),l=s.cellRuntime[n],U=l==null?void 0:l.output,O=l==null?void 0:l.status,B=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[o,h]=ye(fe),u=we(T),A;e[0]!==J||e[1]!==r||e[2]!==p?(A=()=>{p({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=p,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==G||e[6]!==F?(I=()=>{r.trim()&&G({code:r,before:!1,cellId:F??"__end__"})},e[4]=r,e[5]=G,e[6]=F,e[7]=I):I=e[7];let Q=V(I),E;e[8]!==p||e[9]!==d?(E=()=>{d({cellId:n,code:"",formattingChange:!1}),p({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=p,e[9]=d,e[10]=E):E=e[10];let W=V(E),L;e[11]!==h||e[12]!==d?(L=a=>{h(!1),d({cellId:n,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=h,e[12]=d,e[13]=L):L=e[13];let X=V(L),[Y,ge]=(0,q.useState)(),M;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==m?(M=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=m,e[18]=M):M=e[18];let Z=M,P;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==h||e[25]!==O?(P=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Je,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Be,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>h(!o),disabled:u.length===0,children:(0,t.jsx)(pe,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=h,e[25]=O,e[26]=P):P=e[26];let $=P,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Oe.create(n),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=a=>{c.current=a},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ke,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===U?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Me,{allowExpand:!1,output:U,className:Ee.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=U,e[48]=y);let w;e[49]===B?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:B,className:"overflow-auto",stale:!1,interrupted:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=B,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==K||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,b,N]},K)}),e[54]=S,e[55]=K,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
1
+ import{o as ae}from"./chunk-C4rtOYze.js";import{d as be,l as ye,n as V,p as oe,u as we}from"./useEvent-GCVIknuR.js";import{t as Ne}from"./react-C60yClUi.js";import{E as ke,F as ze,Kn as Ce,aa as Se,ma as n,pa as Oe,__tla as Ae}from"./cells-BIt-E5vq.js";import"./react-dom-Ba2zmJWD.js";import{t as se}from"./compiler-runtime-DnimoHo0.js";import{_ as ie}from"./useEventListener-DpNnLPuE.js";import{C as Ie}from"./utils-C8Yt16Y7.js";import{t as Ee}from"./constants-DifUxsbZ.js";import"./readonly-python-code-DeHfRkyx.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as Le}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import"./popover-B96fOqfH.js";import{n as Me,__tla as Pe}from"./JsonOutput-CbpX5Kgt.js";import"./download-DYiwRe8_.js";import{t as z}from"./tooltip-C9LWGQ7Y.js";import{t as C}from"./button-W__YVea9.js";import"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{r as Re}from"./requests-B9zEd_sW.js";import{t as me}from"./createLucideIcon-B8oVfJNp.js";import{d as De,__tla as He}from"./layout-BBB9DQha.js";import{n as Ve,t as qe,__tla as Te}from"./LazyAnyLanguageCodeMirror-Bx0i_n8B.js";import{__tla as Fe}from"./markdown-renderer-CP1Up_3K.js";import{u as Ge}from"./toDate-QOk09NqD.js";import"./add-cell-with-ai-BrrI8i5Q.js";import{t as Ke,__tla as Ue}from"./cell-editor-BfrmXiOh.js";import{t as Be}from"./spinner-Cj3eM5bt.js";import{i as Je}from"./useDeleteCell-C6_GiKMv.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import{r as Qe}from"./useTheme-CwCyrmDf.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import{__tla as We}from"./chunk-5FQGJX7Z-BIDn9QG0.js";import"./html-to-image-BvGsu9Nz.js";import{o as Xe}from"./focus-agtnrA0w.js";import{n as Ye,r as Ze,t as ne}from"./react-resizable-panels.browser.esm-CLaR27oP.js";import{a as $e}from"./renderShortcut-C6HKXhBl.js";import"./esm-RBKN8Dn2.js";import"./name-cell-input-7EVAIGJb.js";import{n as et,r as tt}from"./panel-context-CkhpgwrR.js";import{__tla as rt}from"./loro_wasm_bg-wiZiHqmd.js";import"./ws-B3l5rS71.js";import"./Inputs-S6F4fq1S.js";import"./dist-CiELQ2ik.js";import"./dist-CtsSPT78.js";import"./dist-BpyRMlx3.js";import"./dist-Cnb7x5X_.js";import"./dist-B_Q1ayL4.js";import"./dist-CnESRnx2.js";import"./dist-M9OI1ywz.js";import"./dist-DcwGajoh.js";import"./dist-DXl-iyI_.js";import"./esm-B7G79VOo.js";import{t as at}from"./kiosk-mode-CNguD0K4.js";let ce,ot=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Pe}catch{}})(),(()=>{try{return He}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return Ue}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return rt}catch{}})()]).then(async()=>{var de=me("eraser",[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]),pe=me("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),he=se(),q=ae(Ne(),1),ue=15;const T=Se("marimo:scratchpadHistory:v1",[],Ce),fe=oe(!1),xe=oe(null,(e,s,i)=>{if(i=i.trim(),!i)return;let m=e(T);s(T,[i,...m.filter(c=>c!==i)].slice(0,ue))});var t=ae(Le(),1),_e={hide_code:!1,disabled:!1};const ve=()=>{var re;let e=(0,he.c)(60),s=ze(),[i]=Ie(),{theme:m}=Qe(),c=(0,q.useRef)(null),F=Xe(),{createNewCell:G,updateCellCode:d}=ke(),{sendRunScratchpad:p}=Re(),S=et(),K=tt(),l=s.cellRuntime[n],U=l==null?void 0:l.output,O=l==null?void 0:l.status,B=l==null?void 0:l.consoleOutputs,r=((re=s.cellData.__scratch__)==null?void 0:re.code)??"",J=be(xe),[o,h]=ye(fe),u=we(T),A;e[0]!==J||e[1]!==r||e[2]!==p?(A=()=>{p({code:r}),J(r)},e[0]=J,e[1]=r,e[2]=p,e[3]=A):A=e[3];let f=V(A),I;e[4]!==r||e[5]!==G||e[6]!==F?(I=()=>{r.trim()&&G({code:r,before:!1,cellId:F??"__end__"})},e[4]=r,e[5]=G,e[6]=F,e[7]=I):I=e[7];let Q=V(I),E;e[8]!==p||e[9]!==d?(E=()=>{d({cellId:n,code:"",formattingChange:!1}),p({code:""});let a=c.current;a&&a.dispatch({changes:{from:0,to:a.state.doc.length,insert:""}})},e[8]=p,e[9]=d,e[10]=E):E=e[10];let W=V(E),L;e[11]!==h||e[12]!==d?(L=a=>{h(!1),d({cellId:n,code:a,formattingChange:!1});let k=c.current;k&&k.dispatch({changes:{from:0,to:k.state.doc.length,insert:a}})},e[11]=h,e[12]=d,e[13]=L):L=e[13];let X=V(L),[Y,ge]=(0,q.useState)(),M;e[14]!==X||e[15]!==u||e[16]!==o||e[17]!==m?(M=()=>o?(0,t.jsx)("div",{className:"absolute inset-0 z-100 bg-background p-3 border-none overflow-auto",children:(0,t.jsx)("div",{className:"overflow-auto flex flex-col gap-3",children:u.map((a,k)=>(0,t.jsx)("div",{className:"border rounded-md hover:shadow-sm cursor-pointer hover:border-input overflow-hidden",onClick:()=>X(a),children:(0,t.jsx)(q.Suspense,{children:(0,t.jsx)(qe,{language:"python",theme:m,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},value:a.trim(),editable:!1,readOnly:!0})})},k))})}):null,e[14]=X,e[15]=u,e[16]=o,e[17]=m,e[18]=M):M=e[18];let Z=M,P;e[19]!==W||e[20]!==Q||e[21]!==f||e[22]!==u.length||e[23]!==o||e[24]!==h||e[25]!==O?(P=()=>(0,t.jsxs)("div",{className:"flex items-center shrink-0 border-b",children:[(0,t.jsx)(z,{content:$e("cell.run"),children:(0,t.jsx)(C,{"data-testid":"scratchpad-run-button",onClick:f,disabled:o,variant:"text",size:"xs",children:(0,t.jsx)(Je,{color:"var(--grass-11)",size:16})})}),(0,t.jsx)(z,{content:"Clear code and outputs",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:W,children:(0,t.jsx)(de,{size:16})})}),(0,t.jsx)(at,{children:(0,t.jsx)(z,{content:"Insert code",children:(0,t.jsx)(C,{disabled:o,size:"xs",variant:"text",onClick:Q,children:(0,t.jsx)(Ve,{size:16})})})}),(O==="running"||O==="queued")&&(0,t.jsx)(Be,{className:"inline",size:"small"}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsx)(z,{content:"Toggle history",children:(0,t.jsx)(C,{size:"xs",variant:"text",className:le(o&&"bg-(--sky-3) rounded-none"),onClick:()=>h(!o),disabled:u.length===0,children:(0,t.jsx)(pe,{size:16})})}),(0,t.jsx)(z,{content:(0,t.jsx)("span",{className:"block max-w-prose",children:"Use this scratchpad to experiment with code without restrictions on variable names. Variables defined here aren't saved to notebook memory, and the code is not saved in the notebook file."}),children:(0,t.jsx)(C,{size:"xs",variant:"text",children:(0,t.jsx)(Ge,{size:16})})})]}),e[19]=W,e[20]=Q,e[21]=f,e[22]=u.length,e[23]=o,e[24]=h,e[25]=O,e[26]=P):P=e[26];let $=P,je=S==="vertical",R;e[27]===Symbol.for("react.memo_cache_sentinel")?(R=Oe.create(n),e[27]=R):R=e[27];let x;e[28]===$?x=e[29]:(x=$(),e[28]=$,e[29]=x);let D;e[30]===Symbol.for("react.memo_cache_sentinel")?(D=a=>{c.current=a},e[30]=D):D=e[30];let _;e[31]!==r||e[32]!==f||e[33]!==Y||e[34]!==m||e[35]!==i?(_=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Ke,{theme:m,showPlaceholder:!1,id:n,code:r,config:_e,status:"idle",serializedEditorState:null,runCell:f,userConfig:i,editorViewRef:c,setEditorView:D,hidden:!1,showHiddenCode:ie.NOOP,languageAdapter:Y,setLanguageAdapter:ge})}),e[31]=r,e[32]=f,e[33]=Y,e[34]=m,e[35]=i,e[36]=_):_=e[36];let v;e[37]===Z?v=e[38]:(v=Z(),e[37]=Z,e[38]=v);let g;e[39]!==v||e[40]!==x||e[41]!==_?(g=(0,t.jsx)(ne,{defaultSize:40,minSize:20,maxSize:70,children:(0,t.jsxs)("div",{className:"h-full flex flex-col overflow-hidden relative",children:[x,_,v]})}),e[39]=v,e[40]=x,e[41]=_,e[42]=g):g=e[42];let ee=je?"h-1":"w-1",j;e[43]===ee?j=e[44]:(j=le("bg-border hover:bg-primary/50 transition-colors",ee),e[43]=ee,e[44]=j);let b;e[45]===j?b=e[46]:(b=(0,t.jsx)(Ze,{className:j}),e[45]=j,e[46]=b);let y;e[47]===U?y=e[48]:(y=(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsx)(Me,{allowExpand:!1,output:U,className:Ee.outputArea,cellId:n,stale:!1,loading:!1})}),e[47]=U,e[48]=y);let w;e[49]===B?w=e[50]:(w=(0,t.jsx)("div",{className:"overflow-auto shrink-0 max-h-[50%]",children:(0,t.jsx)(De,{consoleOutputs:B,className:"overflow-auto",stale:!1,interrupted:!1,cellName:"_",onSubmitDebugger:ie.NOOP,cellId:n,debuggerActive:!1})}),e[49]=B,e[50]=w);let N;e[51]!==y||e[52]!==w?(N=(0,t.jsx)(ne,{defaultSize:60,minSize:20,children:(0,t.jsxs)("div",{className:"h-full flex flex-col divide-y overflow-hidden",children:[y,w]})}),e[51]=y,e[52]=w,e[53]=N):N=e[53];let H;return e[54]!==S||e[55]!==K||e[56]!==g||e[57]!==b||e[58]!==N?(H=(0,t.jsx)("div",{className:"flex flex-col h-full overflow-hidden",id:R,children:(0,t.jsxs)(Ye,{direction:S,className:"h-full",children:[g,b,N]},K)}),e[54]=S,e[55]=K,e[56]=g,e[57]=b,e[58]=N,e[59]=H):H=e[59],H};let te;te=se(),ce=()=>{let e=(0,te.c)(1),s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)(ve,{}),e[0]=s):s=e[0],s}});export{ot as __tla,ce as default};
@@ -1 +1 @@
1
- import{o as ge}from"./chunk-C4rtOYze.js";import{d as je,l as ye,p as Ke,u as J}from"./useEvent-GCVIknuR.js";import{t as We}from"./react-C60yClUi.js";import{Bt as Xe,Ct as Je,Dr as Ye,E as Qe,Fr as Ze,Kn as ea,N as aa,Rr as ta,Rt as sa,Tr as la,Xr as ve,Yn as na,aa as ra,ci as oe,d as oa,di as ca,ei as ce,fi as ia,hi as ma,i as da,ii as ha,j as ua,jt as xa,mi as pa,ni as Ne,oi as ie,pi as we,pn as fa,qn as ba,ri as ga,si as Se,ti as _e,ui as ja,wr as ya,zr as me,zt as va}from"./cells-Biwqg0z6.js";import"./react-dom-Ba2zmJWD.js";import{t as Ce}from"./compiler-runtime-DnimoHo0.js";import{c as Na}from"./utils-C8Yt16Y7.js";import{t as wa}from"./ErrorBoundary-B392qglD.js";import{t as Y}from"./cn-DCUzRj2J.js";import{t as Sa}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import{r as _a}from"./config-DjP9S1hr.js";import"./popover-B96fOqfH.js";import{_ as Ie,at as Ca,d as Ia,g as de,h as he,it as Ta,m as se,nt as Te,ot as ka,p as ke,rt as Pa,tt as ue}from"./JsonOutput-htT793Wj.js";import"./download-CfUkZlw7.js";import{r as Pe}from"./radio-group-YNmbPL7y.js";import{t as xe}from"./tooltip-C9LWGQ7Y.js";import{r as Fa,t as le}from"./button-W__YVea9.js";import"./dist-CeF1Em5L.js";import{l as ne}from"./arrays-UzzAzxsG.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{i as Ra}from"./strings-DmKKoXrM.js";import{r as $a}from"./requests-B9zEd_sW.js";import{t as Da}from"./createLucideIcon-B8oVfJNp.js";import{t as Va}from"./x-4y-nyVDU.js";import{a as qa,r as Ba}from"./tree-actions-pW_UgP3m.js";import"./markdown-renderer-BOS4jZLt.js";import{t as Fe}from"./plus-r1QITpsJ.js";import{a as Ea}from"./input-BN98e517.js";import{n as La,o as Oa}from"./column-preview-BaRqZ9P8.js";import{t as Ma}from"./workflow-CAJ8rXSh.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import{t as za}from"./copy-icon-Cn8LzPNx.js";import{t as Aa}from"./context-BJMN4ll3.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import{t as Re}from"./cell-link-Bx8FWjns.js";import"./chunk-5FQGJX7Z-BIDn9QG0.js";import{r as Ua}from"./html-to-image-ChfBVn8-.js";import{o as Ga}from"./focus-CeTtpVjV.js";import{n as pe}from"./useAsyncData-BcvSvTUt.js";import{a as Ha,i as Ka,n as Wa,o as $e,r as Xa,t as Ja}from"./table-xPvP31p3.js";import"./react-resizable-panels.browser.esm-CLaR27oP.js";import{a as Ya,f as Qa,o as re,t as Za}from"./command-D5LtSvbN.js";import{n as et}from"./icons-BwSNDWAP.js";import{t as at}from"./useDeepCompareMemoize-CbFVGT0j.js";import{t as tt}from"./empty-state-CBq3j1LH.js";import{n as st,t as lt}from"./common-sBRwGAKy.js";import{a as nt,i as De,n as Ve,o as rt,r as qe,t as ot}from"./components-DsJAWbBR.js";import{r as ct,t as Be}from"./add-connection-dialog-DGYhyXo6.js";import{r as it}from"./panel-accordion-state-CgvX-ElJ.js";var mt=Da("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),U=Ce(),F=ge(We(),1),s=ge(Sa(),1),fe=1;function Ee(a){return 1.75+a*fe}function dt(a){return 3+a*fe}function Le(a){return 3.25+a*fe}var A={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function O(a){return{paddingLeft:`${a}rem`}}var ht=Ke(a=>{let e=a(Ne),t=a(na),l=a(da);return ne(e,n=>{if(!n.variable_name)return-1;let m=Object.values(t).find(u=>u.name===n.variable_name);if(!m)return 0;let r=l.inOrderIds.indexOf(m.declaredBy[0]);return r===-1?0:r})});const ut=ra("marimo:datasources:hideEmpty",!1,ea,{getOnInit:!0});function Oe(a){let e=!1,t=[];for(let l of a){if(!oe(l)||!ie(l)){t.push(l);continue}let n=l.child_schemas??[],m=Oe(n);if(l.tables.length===0&&m.length===0){e=!0;continue}if(m===n){t.push(l);continue}e=!0,t.push({...l,child_schemas:m})}return e?t:a}function xt(a){let e=!1,t=[];for(let l of a){if(Se(l)&&l.schemas.length===0){e=!0;continue}if(l.schemas.length===0){t.push(l);continue}let n=Oe(l.schemas);if(n.length===0){e=!0;continue}if(n===l.schemas){t.push(l);continue}e=!0,t.push({...l,schemas:n})}return e?t:a}const pt=()=>{let a=(0,U.c)(40),[e,t]=F.useState(""),[l,n]=ye(ut),m=je(_e),r=J(ht),u=J(ve),o;e:{if(!l){o=u;break e}let x,w;a[0]===u?(x=a[1],w=a[2]):(x=!1,w=u.map(C=>{let T=xt(C.databases);return T===C.databases?C:(x=!0,{...C,databases:T})}),a[0]=u,a[1]=x,a[2]=w),o=x?w:u}let p=o;if(r.length===0&&p.length===0){let x;return a[3]===Symbol.for("react.memo_cache_sentinel")?(x=(0,s.jsx)(tt,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:(0,s.jsx)(Be,{children:(0,s.jsxs)(le,{variant:"outline",size:"sm",children:["Add database or catalog",(0,s.jsx)(Fe,{className:"h-4 w-4 ml-2"})]})}),icon:(0,s.jsx)(me,{})}),a[3]=x):x=a[3],x}let h=!!e.trim(),c;a[4]===m?c=a[5]:(c=x=>{m(x.length>0),t(x)},a[4]=m,a[5]=c);let i;a[6]!==e||a[7]!==c?(i=(0,s.jsx)(Ya,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:c,rootClassName:"flex-1 border-r border-b-0"}),a[6]=e,a[7]=c,a[8]=i):i=a[8];let f;a[9]===h?f=a[10]:(f=h&&(0,s.jsx)("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>t(""),children:(0,s.jsx)(Va,{className:"h-4 w-4"})}),a[9]=h,a[10]=f);let I=!l,b;a[11]!==l||a[12]!==n?(b=()=>n(!l),a[11]=l,a[12]=n,a[13]=b):b=a[13];let y;a[14]!==I||a[15]!==b?(y=(0,s.jsx)(qa,{"data-testid":"datasources-hide-empty-button",isVisible:I,onToggle:b,showTooltip:"Show empty schemas and databases",hideTooltip:"Hide empty schemas and databases",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden"}),a[14]=I,a[15]=b,a[16]=y):y=a[16];let v;a[17]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsx)(Be,{children:(0,s.jsx)(le,{variant:"ghost",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden",children:(0,s.jsx)(Fe,{className:"h-4 w-4"})})}),a[17]=v):v=a[17];let g;a[18]!==i||a[19]!==f||a[20]!==y?(g=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[i,f,y,v]}),a[18]=i,a[19]=f,a[20]=y,a[21]=g):g=a[21];let j;if(a[22]!==p||a[23]!==e){let x;a[25]===e?x=a[26]:(x=w=>(0,s.jsx)(ft,{connection:w,hasChildren:w.databases.length>0,children:w.databases.map(C=>(0,s.jsx)(bt,{connection:w,database:C,searchValue:e},C.name))},w.name),a[25]=e,a[26]=x),j=p.map(x),a[22]=p,a[23]=e,a[24]=j}else j=a[24];let S;a[27]!==p.length||a[28]!==r.length?(S=p.length>0&&r.length>0&&(0,s.jsxs)(ke,{className:"pr-2",style:O(A.engine),children:[(0,s.jsx)(et,{className:"h-4 w-4 text-muted-foreground"}),(0,s.jsx)("span",{className:"text-xs",children:"Python"})]}),a[27]=p.length,a[28]=r.length,a[29]=S):S=a[29];let d;a[30]!==e||a[31]!==r?(d=r.length>0&&(0,s.jsx)(be,{tables:r,searchValue:e}),a[30]=e,a[31]=r,a[32]=d):d=a[32];let N;a[33]!==S||a[34]!==d||a[35]!==j?(N=(0,s.jsxs)(Qa,{className:"flex flex-col",children:[j,S,d]}),a[33]=S,a[34]=d,a[35]=j,a[36]=N):N=a[36];let _;return a[37]!==N||a[38]!==g?(_=(0,s.jsxs)(Za,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[g,N]}),a[37]=N,a[38]=g,a[39]=_):_=a[39],_};var ft=a=>{let e=(0,U.c)(26),{connection:t,children:l,hasChildren:n}=a,m=t.name===ma,r=m?"In-Memory":t.name,{previewDataSourceConnection:u}=$a(),o;e[0]!==t.name||e[1]!==u?(o=async()=>{await u({engine:t.name})},e[0]=t.name,e[1]=u,e[2]=o):o=e[2];let p=o,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=O(A.engine),e[3]=h):h=e[3];let c;e[4]===t.dialect?c=e[5]:(c=(0,s.jsx)(Je,{className:"h-4 w-4 text-muted-foreground",name:t.dialect}),e[4]=t.dialect,e[5]=c);let i;e[6]===t.dialect?i=e[7]:(i=ya(t.dialect),e[6]=t.dialect,e[7]=i);let f;e[8]===i?f=e[9]:(f=(0,s.jsx)("span",{className:"text-xs",children:i}),e[8]=i,e[9]=f);let I=r,b;e[10]===I?b=e[11]:(b=(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(0,s.jsx)(rt,{variableName:I}),")"]}),e[10]=I,e[11]=b);let y;e[12]!==p||e[13]!==m?(y=!m&&(0,s.jsx)(Ba,{onClick:p,tooltip:"Refresh connection",className:"ml-auto h-4 p-0",iconClassName:"h-3.5 w-3.5"}),e[12]=p,e[13]=m,e[14]=y):y=e[14];let v;e[15]!==c||e[16]!==f||e[17]!==b||e[18]!==y?(v=(0,s.jsxs)(ke,{className:"pr-2",style:h,children:[c,f,b,y]}),e[15]=c,e[16]=f,e[17]=b,e[18]=y,e[19]=v):v=e[19];let g;e[20]!==l||e[21]!==n?(g=n?l:(0,s.jsx)(se,{content:"No databases available",style:O(A.engineEmpty)}),e[20]=l,e[21]=n,e[22]=g):g=e[22];let j;return e[23]!==g||e[24]!==v?(j=(0,s.jsxs)(s.Fragment,{children:[v,g]}),e[23]=g,e[24]=v,e[25]=j):j=e[25],j},Me=F.createContext(null);function ze(){let a=F.useContext(Me);if(a==null)throw Error("useDataSourceTree must be used within a DataSourceTreeContext.Provider");return a}function Ae(a,{schema:e,schemaPath:t}){return{engine:a.engineName,database:a.databaseName,schema:e,schemaPath:t,defaultSchema:a.defaultSchema,defaultDatabase:a.defaultDatabase,dialect:a.dialect}}var bt=a=>{let e=(0,U.c)(21),{connection:t,database:l,searchValue:n}=a,m;e[0]!==t.default_database||e[1]!==t.default_schema||e[2]!==t.dialect||e[3]!==t.name||e[4]!==l.name||e[5]!==n?(m={engineName:t.name,databaseName:l.name,dialect:t.dialect,defaultSchema:t.default_schema,defaultDatabase:t.default_database,searchValue:n},e[0]=t.default_database,e[1]=t.default_schema,e[2]=t.dialect,e[3]=t.name,e[4]=l.name,e[5]=n,e[6]=m):m=e[6];let r=m,u=t.name,o=l.schemas,p;e[7]===l?p=e[8]:(p=Se(l),e[7]=l,e[8]=p);let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[9]=h):h=e[9];let c;e[10]!==l.schemas||e[11]!==p?(c=(0,s.jsx)(Ue,{schemas:o,schemasResolved:p,schemaPath:h,depth:0}),e[10]=l.schemas,e[11]=p,e[12]=c):c=e[12];let i;e[13]!==c||e[14]!==r?(i=(0,s.jsx)(Me.Provider,{value:r,children:c}),e[13]=c,e[14]=r,e[15]=i):i=e[15];let f;return e[16]!==t.name||e[17]!==l||e[18]!==n||e[19]!==i?(f=(0,s.jsx)(gt,{engineName:u,database:l,searchValue:n,children:i}),e[16]=t.name,e[17]=l,e[18]=n,e[19]=i,e[20]=f):f=e[20],f},gt=a=>{let e=(0,U.c)(29),{searchValue:t,engineName:l,database:n,children:m}=a,r;e[0]!==n||e[1]!==t?(r=ia(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let u=r,[o,p]=F.useState(u),[h,c]=F.useState(!1),[i,f]=F.useState(t),[I,b]=F.useState(u);(i!==t||I!==u)&&(f(t),b(u),p(u));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=O(A.database),e[3]=y):y=e[3];let v;e[4]!==o||e[5]!==h?(v=()=>{p(!o),c(!h)},e[4]=o,e[5]=h,e[6]=v):v=e[6];let g=`${l}:${n.name}`,j;e[7]===o?j=e[8]:(j=(0,s.jsx)(Ie,{isExpanded:o}),e[7]=o,e[8]=j);let S=h&&o?"text-foreground":"text-muted-foreground",d;e[9]===S?d=e[10]:(d=Y("h-4 w-4",S),e[9]=S,e[10]=d);let N;e[11]===d?N=e[12]:(N=(0,s.jsx)(me,{className:d}),e[11]=d,e[12]=N);let _=h&&o&&"font-semibold",x;e[13]===_?x=e[14]:(x=Y(_),e[13]=_,e[14]=x);let w;e[15]===n.name?w=e[16]:(w=n.name===""?(0,s.jsx)("i",{children:"Not connected"}):n.name,e[15]=n.name,e[16]=w);let C;e[17]!==x||e[18]!==w?(C=(0,s.jsx)("span",{className:x,children:w}),e[17]=x,e[18]=w,e[19]=C):C=e[19];let T;e[20]!==C||e[21]!==v||e[22]!==g||e[23]!==j||e[24]!==N?(T=(0,s.jsxs)(re,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",style:y,onSelect:v,value:g,children:[j,N,C]}),e[20]=C,e[21]=v,e[22]=g,e[23]=j,e[24]=N,e[25]=T):T=e[25];let k=o&&m,P;return e[26]!==T||e[27]!==k?(P=(0,s.jsxs)(s.Fragment,{children:[T,k]}),e[26]=T,e[27]=k,e[28]=P):P=e[28],P},Ue=a=>{let{schemas:e,schemasResolved:t,depth:l}=a,n=ze(),{engineName:m,databaseName:r,searchValue:u}=n,{addSchemaList:o}=ce(),p=at(a.schemaPath),[h,c]=F.useState(!1),{isPending:i,error:f}=pe(async()=>{if(!t&&m){c(!0);try{o({schemas:(await sa.request({engine:m,database:r,schemaPath:p})).schemas??[],sqlSchemaContext:{engine:m,database:r,schemaPath:p}})}finally{c(!1)}}},[t,m,r,p]),I=O(Ee(l));return i||h?(0,s.jsx)(de,{message:"Loading schemas...",style:I}):f?(0,s.jsx)(he,{error:f,style:I}):e.length===0?(0,s.jsx)(se,{content:"No schemas available",style:I}):(0,s.jsx)(s.Fragment,{children:e.map(b=>ja(b.name)?(0,s.jsx)(be,{tables:b.tables,tablesResolved:oe(b),searchValue:u,sqlTableContext:Ae(n,{schema:b.name,schemaPath:p})},b.name):(0,s.jsx)(jt,{schema:b,schemaPath:[...p,b.name],depth:l},b.name))})},jt=a=>{let e=(0,U.c)(39),{schema:t,schemaPath:l,depth:n}=a,m=ze(),{databaseName:r,searchValue:u}=m,o;e[0]!==t||e[1]!==u?(o=ca(t,u),e[0]=t,e[1]=u,e[2]=o):o=e[2];let p=o,[h,c]=F.useState(p),[i,f]=F.useState(!1),[I,b]=F.useState(u),[y,v]=F.useState(p),g=`${r}:${l.join(".")}`,j;e[3]===t.child_schemas?j=e[4]:(j=t.child_schemas??[],e[3]=t.child_schemas,e[4]=j);let S=j;(I!==u||y!==p)&&(b(u),v(p),c(p));let d;e[5]===n?d=e[6]:(d=O(Ee(n)),e[5]=n,e[6]=d);let N;e[7]!==h||e[8]!==i?(N=()=>{c(!h),f(!i)},e[7]=h,e[8]=i,e[9]=N):N=e[9];let _;e[10]===h?_=e[11]:(_=(0,s.jsx)(Ie,{isExpanded:h}),e[10]=h,e[11]=_);let x=i&&h&&"text-foreground",w;e[12]===x?w=e[13]:(w=Y("h-4 w-4 text-muted-foreground",x),e[12]=x,e[13]=w);let C;e[14]===w?C=e[15]:(C=(0,s.jsx)(Ze,{className:w}),e[14]=w,e[15]=C);let T=i&&h&&"font-semibold",k;e[16]===T?k=e[17]:(k=Y(T),e[16]=T,e[17]=k);let P;e[18]!==t.name||e[19]!==k?(P=(0,s.jsx)("span",{className:k,children:t.name}),e[18]=t.name,e[19]=k,e[20]=P):P=e[20];let $;e[21]!==P||e[22]!==d||e[23]!==N||e[24]!==_||e[25]!==C||e[26]!==g?($=(0,s.jsxs)(re,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",style:d,onSelect:N,value:g,children:[_,C,P]}),e[21]=P,e[22]=d,e[23]=N,e[24]=_,e[25]=C,e[26]=g,e[27]=$):$=e[27];let D;e[28]!==S||e[29]!==n||e[30]!==h||e[31]!==t||e[32]!==l||e[33]!==u||e[34]!==m?(D=h&&(0,s.jsxs)(s.Fragment,{children:[(S.length>0||!ie(t))&&(0,s.jsx)(Ue,{schemas:S,schemasResolved:ie(t),schemaPath:l,depth:n+1}),(0,s.jsx)(be,{tables:t.tables,tablesResolved:oe(t),searchValue:u,tableIndentRem:dt(n),columnIndentRem:Le(n),sqlTableContext:Ae(m,{schema:t.name,schemaPath:l})})]}),e[28]=S,e[29]=n,e[30]=h,e[31]=t,e[32]=l,e[33]=u,e[34]=m,e[35]=D):D=e[35];let R;return e[36]!==$||e[37]!==D?(R=(0,s.jsxs)(s.Fragment,{children:[$,D]}),e[36]=$,e[37]=D,e[38]=R):R=e[38],R},be=a=>{let e=(0,U.c)(31),{tables:t,sqlTableContext:l,searchValue:n,tablesResolved:m,tableIndentRem:r,columnIndentRem:u}=a,o=m===void 0?!0:m,{addTableList:p}=ce(),[h,c]=F.useState(!1),i;e[0]!==p||e[1]!==l||e[2]!==o?(i=async()=>{if(!o&&l){c(!0);let{engine:d,database:N,schema:_,schemaPath:x}=l,w=await Xe.request({engine:d,database:N,schema:_,schemaPath:x??[]});if(!(w!=null&&w.tables))throw c(!1),Error("No tables available");p({tables:w.tables,sqlTableContext:l}),c(!1)}},e[0]=p,e[1]=l,e[2]=o,e[3]=i):i=e[3];let f;e[4]!==l||e[5]!==o?(f=[o,l],e[4]=l,e[5]=o,e[6]=f):f=e[6];let{isPending:I,error:b}=pe(i,f),y=r??A.tableLoading,v;e[7]===y?v=e[8]:(v=O(y),e[7]=y,e[8]=v);let g=v;if(I||h){let d;return e[9]===g?d=e[10]:(d=(0,s.jsx)(de,{message:"Loading tables...",style:g}),e[9]=g,e[10]=d),d}if(b){let d;return e[11]!==b||e[12]!==g?(d=(0,s.jsx)(he,{error:b,style:g}),e[11]=b,e[12]=g,e[13]=d):d=e[13],d}if(t.length===0){let d;return e[14]===g?d=e[15]:(d=(0,s.jsx)(se,{content:"No tables found",style:g}),e[14]=g,e[15]=d),d}let j;if(e[16]!==u||e[17]!==n||e[18]!==l||e[19]!==r||e[20]!==t){let d;e[22]===n?d=e[23]:(d=x=>n?x.name.toLowerCase().includes(n.toLowerCase()):!0,e[22]=n,e[23]=d);let N=t.filter(d),_;e[24]!==u||e[25]!==n||e[26]!==l||e[27]!==r?(_=x=>(0,s.jsx)(yt,{table:x,sqlTableContext:l,isSearching:!!n,tableIndentRem:r,columnIndentRem:u},x.name),e[24]=u,e[25]=n,e[26]=l,e[27]=r,e[28]=_):_=e[28],j=N.map(_),e[16]=u,e[17]=n,e[18]=l,e[19]=r,e[20]=t,e[21]=j}else j=e[21];let S;return e[29]===j?S=e[30]:(S=(0,s.jsx)(s.Fragment,{children:j}),e[29]=j,e[30]=S),S},yt=a=>{let e=(0,U.c)(69),{table:t,sqlTableContext:l,isSearching:n,tableIndentRem:m,columnIndentRem:r}=a,{addTable:u}=ce(),[o,p]=F.useState(!1),h=t.columns.length>0,c;e[0]!==u||e[1]!==o||e[2]!==l||e[3]!==t.name||e[4]!==h?(c=async()=>{if(o&&!h&&l){let{engine:E,database:ee,schema:ae,schemaPath:He}=l,te=await va.request({engine:E,database:ee,schema:ae,tableName:t.name,schemaPath:He??[]});if(!(te!=null&&te.table))throw Error("No table details available");u({table:te.table,sqlTableContext:l})}},e[0]=u,e[1]=o,e[2]=l,e[3]=t.name,e[4]=h,e[5]=c):c=e[5];let i;e[6]!==o||e[7]!==h?(i=[o,h],e[6]=o,e[7]=h,e[8]=i):i=e[8];let{isFetching:f,isPending:I,error:b}=pe(c,i),y=J(Na),v=Ga(),{createNewCell:g}=Qe(),j=Pe(),S;e[9]!==j||e[10]!==y||e[11]!==g||e[12]!==v||e[13]!==l||e[14]!==t?(S=()=>{Ua({autoInstantiate:y,createNewCell:g,fromCellId:v}),j((()=>{if(t.source_type==="catalog"){let E=l!=null&&l.database?[l.database,...l.schemaPath??[],t.name].join("."):t.name;return`${t.engine}.load_table("${E}")`}if(l)return we({table:t,columnName:"*",sqlTableContext:l});switch(t.source_type){case"local":return`mo.ui.table(${t.name})`;case"duckdb":case"connection":return we({table:t,columnName:"*",sqlTableContext:l});default:return Ra(t.source_type),""}})())},e[9]=j,e[10]=y,e[11]=g,e[12]=v,e[13]=l,e[14]=t,e[15]=S):S=e[15];let d=S,N;e[16]!==t.num_columns||e[17]!==t.num_rows?(N=()=>{let E=[];return t.num_rows!=null&&E.push(`${t.num_rows} rows`),t.num_columns!=null&&E.push(`${t.num_columns} columns`),E.length===0?null:(0,s.jsx)("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:E.join(", ")})})},e[16]=t.num_columns,e[17]=t.num_rows,e[18]=N):N=e[18];let _=N,x;e[19]!==r||e[20]!==b||e[21]!==f||e[22]!==I||e[23]!==l||e[24]!==t?(x=()=>{let E=O(r??A.tableLoading);if(I||f)return(0,s.jsx)(de,{message:"Loading columns...",style:E});if(b)return(0,s.jsx)(he,{error:b,style:E});let ee=t.columns;return ee.length===0?(0,s.jsx)(se,{content:"No columns found",style:E}):ee.map(ae=>(0,s.jsx)(vt,{table:t,column:ae,sqlTableContext:l,columnIndentRem:r},ae.name))},e[19]=r,e[20]=b,e[21]=f,e[22]=I,e[23]=l,e[24]=t,e[25]=x):x=e[25];let w=x,C;e[26]!==o||e[27]!==n||e[28]!==t.source_type||e[29]!==t.type?(C=()=>{if(t.source_type!=="local")return(0,s.jsx)(t.type==="table"?Ye:ta,{className:"h-3 w-3",strokeWidth:o||n?2.5:void 0})},e[26]=o,e[27]=n,e[28]=t.source_type,e[29]=t.type,e[30]=C):C=e[30];let T=C,k;e[31]!==l||e[32]!==t.name?(k=pa(l,t.name),e[31]=l,e[32]=t.name,e[33]=k):k=e[33];let P=k,$=m??(l?A.tableSchemaless:0),D=(o||n)&&"font-semibold",R;e[34]===D?R=e[35]:(R=Y("rounded-none group h-8 cursor-pointer",D),e[34]=D,e[35]=R);let V;e[36]===$?V=e[37]:(V=O($),e[36]=$,e[37]=V);let q;e[38]===o?q=e[39]:(q=()=>p(!o),e[38]=o,e[39]=q);let L;e[40]===T?L=e[41]:(L=T(),e[40]=T,e[41]=L);let M;e[42]===t.name?M=e[43]:(M=(0,s.jsx)("span",{className:"text-sm",children:t.name}),e[42]=t.name,e[43]=M);let z;e[44]!==L||e[45]!==M?(z=(0,s.jsxs)("div",{className:"flex gap-2 items-center flex-1 pl-1",children:[L,M]}),e[44]=L,e[45]=M,e[46]=z):z=e[46];let B;e[47]===_?B=e[48]:(B=_(),e[47]=_,e[48]=B);let H;e[49]===d?H=e[50]:(H=Fa.stopPropagation(()=>d()),e[49]=d,e[50]=H);let Q;e[51]===Symbol.for("react.memo_cache_sentinel")?(Q=(0,s.jsx)(Oa,{className:"h-3 w-3"}),e[51]=Q):Q=e[51];let K;e[52]===H?K=e[53]:(K=(0,s.jsx)(xe,{content:"Add table to notebook",delayDuration:400,children:(0,s.jsx)(le,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:H,children:Q})}),e[52]=H,e[53]=K);let W;e[54]!==o||e[55]!==V||e[56]!==q||e[57]!==z||e[58]!==B||e[59]!==K||e[60]!==R||e[61]!==P?(W=(0,s.jsxs)(re,{className:R,style:V,value:P,"aria-selected":o,forceMount:!0,onSelect:q,children:[z,B,K]}),e[54]=o,e[55]=V,e[56]=q,e[57]=z,e[58]=B,e[59]=K,e[60]=R,e[61]=P,e[62]=W):W=e[62];let X;e[63]!==o||e[64]!==w?(X=o&&w(),e[63]=o,e[64]=w,e[65]=X):X=e[65];let Z;return e[66]!==W||e[67]!==X?(Z=(0,s.jsxs)(s.Fragment,{children:[W,X]}),e[66]=W,e[67]=X,e[68]=Z):Z=e[68],Z},vt=a=>{var M,z;let e=(0,U.c)(51),{table:t,column:l,sqlTableContext:n,columnIndentRem:m}=a,[r,u]=F.useState(!1),o=J(_e),p=je(ga);o&&r&&u(!1),p(r?B=>new Set([...B,`${t.name}:${l.name}`]):B=>(B.delete(`${t.name}:${l.name}`),new Set(B)));let h=Pe(),{columnsPreviews:c}=ha(),i;e[0]!==l.name||e[1]!==t.primary_keys?(i=((M=t.primary_keys)==null?void 0:M.includes(l.name))||!1,e[0]=l.name,e[1]=t.primary_keys,e[2]=i):i=e[2];let f=i,I;e[3]!==l.name||e[4]!==t.indexes?(I=((z=t.indexes)==null?void 0:z.includes(l.name))||!1,e[3]=l.name,e[4]=t.indexes,e[5]=I):I=e[5];let b=I,y;e[6]===h?y=e[7]:(y=B=>{h(B)},e[6]=h,e[7]=y);let v=y,g=Nt,j=r?"font-semibold":"",S;e[8]!==l.name||e[9]!==j?(S=(0,s.jsx)("span",{className:j,children:l.name}),e[8]=l.name,e[9]=j,e[10]=S):S=e[10];let d=S,N=`${t.name}.${l.name}`,_=`${t.name}.${l.name}`,x;e[11]===r?x=e[12]:(x=()=>u(!r),e[11]=r,e[12]=x);let w;e[13]!==m||e[14]!==n?(w=m??(n?Le(0):A.columnLocal),e[13]=m,e[14]=n,e[15]=w):w=e[15];let C;e[16]===w?C=e[17]:(C=O(w),e[16]=w,e[17]=C);let T;e[18]!==l.type||e[19]!==d?(T=(0,s.jsx)(Ia,{columnName:d,dataType:l.type}),e[18]=l.type,e[19]=d,e[20]=T):T=e[20];let k;e[21]===f?k=e[22]:(k=f&&g({tooltipContent:"Primary key",content:"PK"}),e[21]=f,e[22]=k);let P;e[23]===b?P=e[24]:(P=b&&g({tooltipContent:"Indexed",content:"IDX"}),e[23]=b,e[24]=P);let $;e[25]!==C||e[26]!==T||e[27]!==k||e[28]!==P?($=(0,s.jsxs)("div",{className:"flex flex-row gap-2 items-center flex-1",style:C,children:[T,k,P]}),e[25]=C,e[26]=T,e[27]=k,e[28]=P,e[29]=$):$=e[29];let D;e[30]===l.name?D=e[31]:(D=(0,s.jsx)(xe,{content:"Copy column name",delayDuration:400,children:(0,s.jsx)(le,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,s.jsx)(za,{tooltip:!1,value:l.name,className:"h-3 w-3"})})}),e[30]=l.name,e[31]=D);let R;e[32]===l.external_type?R=e[33]:(R=(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:l.external_type}),e[32]=l.external_type,e[33]=R);let V;e[34]!==$||e[35]!==D||e[36]!==R||e[37]!==N||e[38]!==_||e[39]!==x?(V=(0,s.jsxs)(re,{className:"rounded-none py-1 group cursor-pointer",value:_,onSelect:x,children:[$,D,R]},N),e[34]=$,e[35]=D,e[36]=R,e[37]=N,e[38]=_,e[39]=x,e[40]=V):V=e[40];let q;e[41]!==l||e[42]!==c||e[43]!==v||e[44]!==r||e[45]!==n||e[46]!==t?(q=r&&(0,s.jsx)("div",{className:"pr-2 py-2 bg-(--slate-1) shadow-inner border-b",style:O(A.columnPreview),children:(0,s.jsx)(wa,{children:(0,s.jsx)(La,{table:t,column:l,onAddColumnChart:v,preview:c.get(n?`${n.database}.${n.schema}.${t.name}:${l.name}`:`${t.name}:${l.name}`),sqlTableContext:n})})}),e[41]=l,e[42]=c,e[43]=v,e[44]=r,e[45]=n,e[46]=t,e[47]=q):q=e[47];let L;return e[48]!==V||e[49]!==q?(L=(0,s.jsxs)(s.Fragment,{children:[V,q]}),e[48]=V,e[49]=q,e[50]=L):L=e[50],L};function Nt(a){let{tooltipContent:e,content:t}=a;return(0,s.jsx)(xe,{content:e,delayDuration:100,children:(0,s.jsx)("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:t})})}function Ds(a){return a}var G={name:"name",type:"type-value",defs:"defs-refs"},wt=[{id:G.name,accessorFn:a=>[a.name,a.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,s.jsx)(ue,{header:"Name",column:a}),cell:({getValue:a})=>{let[e,t]=a();return(0,s.jsx)(lt,{name:e,declaredBy:t})}},{id:G.type,accessorFn:a=>[a.dataType,a.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,s.jsx)(ue,{header:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{children:"Type"}),(0,s.jsx)("span",{children:"Value"})]}),column:a}),cell:({getValue:a})=>{let[e,t]=a();return(0,s.jsxs)("div",{className:"max-w-[150px]",children:[(0,s.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),(0,s.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:t??"",children:t})]})}},{id:G.defs,accessorFn:a=>[a.declaredBy,a.usedBy,a.name,a.declaredByNames,a.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:a})=>(0,s.jsx)(ue,{header:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{children:"Declared By"}),(0,s.jsx)("span",{children:"Used By"})]}),column:a}),cell:({getValue:a})=>{let[e,t,l]=a(),n=m=>{let r=oa(m);r&&fa(r,l)};return(0,s.jsxs)("div",{className:"flex flex-col gap-1 py-1",children:[(0,s.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[(0,s.jsx)("span",{title:"Declared by",children:(0,s.jsx)(mt,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?(0,s.jsx)(Re,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>n(e[0])}):(0,s.jsx)("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((m,r)=>(0,s.jsxs)("span",{className:"flex",children:[(0,s.jsx)(Re,{variant:"focus",cellId:m,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>n(m)},m),r<e.length-1&&", "]},m))})]}),(0,s.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[(0,s.jsx)("span",{title:"Used by",children:(0,s.jsx)(Ma,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,s.jsx)(st,{maxCount:3,cellIds:t,skipScroll:!0,onClick:n})]})]})}}];function St({variables:a,sort:e,cellIdToIndex:t}){e||(e={id:G.defs,desc:!1});let l=[];switch(e.id){case G.name:l=ne(a,n=>n.name);break;case G.type:l=ne(a,n=>n.dataType);break;case G.defs:l=ne(a,n=>t.get(n.declaredBy[0]));break}return e.desc?l.toReversed():l}const Ge=(0,F.memo)(({className:a,cellIds:e,variables:t})=>{let[l,n]=F.useState([]),[m,r]=F.useState(""),u=aa(),{locale:o}=Aa(),p=(0,F.useMemo)(()=>{let c=i=>{let f=u[i];return xa(f)?`cell-${e.indexOf(i)}`:f??`cell-${e.indexOf(i)}`};return Object.values(t).map(i=>({...i,declaredByNames:i.declaredBy.map(c),usedByNames:i.usedBy.map(c)}))},[t,u,e]),h=Pa({data:(0,F.useMemo)(()=>{let c=new Map;return e.forEach((i,f)=>c.set(i,f)),St({variables:p,sort:l[0],cellIdToIndex:c})},[p,l,e]),columns:wt,getCoreRowModel:Ta(),onGlobalFilterChange:r,getFilteredRowModel:Ca(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(c){return c.columnDef.enableGlobalFilter??!0},globalFilterFn:"auto",manualSorting:!0,locale:o,onSortingChange:n,getSortedRowModel:ka(),state:{sorting:l,globalFilter:m}});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Ea,{className:"w-full",placeholder:"Search",value:m,onChange:c=>r(c.target.value)}),(0,s.jsxs)(Ja,{className:Y("w-full text-sm flex-1 border-separate border-spacing-0",a),children:[(0,s.jsx)(Ha,{children:(0,s.jsx)($e,{className:"whitespace-nowrap text-xs",children:h.getFlatHeaders().map(c=>(0,s.jsx)(Ka,{className:"sticky top-0 bg-background border-b",children:Te(c.column.columnDef.header,c.getContext())},c.id))})}),(0,s.jsx)(Wa,{children:h.getRowModel().rows.map(c=>(0,s.jsx)($e,{className:"hover:bg-accent",children:c.getVisibleCells().map(i=>(0,s.jsx)(Xa,{className:"border-b",children:Te(i.column.columnDef.cell,i.getContext())},i.id))},c.id))})]})]})});Ge.displayName="VariableTable";var _t=Ce(),Ct=()=>{let a=(0,_t.c)(28),e=ba(),t=ua(),l=J(Ne),n=J(ve),m=ct("database"),[r,u]=ye(it),o=l.length+n.length,p;a[0]!==o||a[1]!==r.hasUserInteracted||a[2]!==r.openSections?(p=!r.hasUserInteracted&&o>0?[...new Set([...r.openSections,"datasources"])]:r.openSections,a[0]=o,a[1]=r.hasUserInteracted,a[2]=r.openSections,a[3]=p):p=a[3];let h=p,c;a[4]===u?c=a[5]:(c=x=>{u({openSections:x,hasUserInteracted:!0})},a[4]=u,a[5]=c);let i=c,f=!h.includes("datasources")&&o>0,I=m.length>0,b;a[6]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(me,{className:"w-4 h-4"}),a[6]=b):b=a[6];let y;a[7]!==o||a[8]!==f?(y=f&&(0,s.jsx)(nt,{children:o}),a[7]=o,a[8]=f,a[9]=y):y=a[9];let v;a[10]!==m.length||a[11]!==I?(v=I&&(0,s.jsx)(ot,{count:m.length,type:"database"}),a[10]=m.length,a[11]=I,a[12]=v):v=a[12];let g;a[13]!==y||a[14]!==v?(g=(0,s.jsxs)(De,{children:[b,"Data sources",y,v]}),a[13]=y,a[14]=v,a[15]=g):g=a[15];let j;a[16]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsx)(Ve,{children:(0,s.jsx)(pt,{})}),a[16]=j):j=a[16];let S;a[17]===g?S=a[18]:(S=(0,s.jsxs)(qe,{value:"datasources",children:[g,j]}),a[17]=g,a[18]=S);let d;a[19]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsxs)(De,{children:[(0,s.jsx)(la,{className:"w-4 h-4"}),"Variables"]}),a[19]=d):d=a[19];let N;a[20]!==t||a[21]!==e?(N=(0,s.jsxs)(qe,{value:"variables",lastItem:!0,children:[d,(0,s.jsx)(Ve,{children:Object.keys(e).length===0?(0,s.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No variables defined"}):(0,s.jsx)(Ge,{cellIds:t.inOrderIds,variables:e})})]}),a[20]=t,a[21]=e,a[22]=N):N=a[22];let _;return a[23]!==i||a[24]!==h||a[25]!==S||a[26]!==N?(_=(0,s.jsxs)(_a,{type:"multiple",value:h,onValueChange:i,className:"flex flex-col h-full overflow-auto",children:[S,N]}),a[23]=i,a[24]=h,a[25]=S,a[26]=N,a[27]=_):_=a[27],_};export{Ct as default};
1
+ import{o as ge}from"./chunk-C4rtOYze.js";import{d as je,l as ye,p as Ke,u as J}from"./useEvent-GCVIknuR.js";import{t as We}from"./react-C60yClUi.js";import{Bt as Xe,Ct as Je,Dr as Ye,E as Qe,Fr as Ze,Kn as ea,N as aa,Rr as ta,Rt as sa,Tr as la,Xr as ve,Yn as na,aa as ra,ci as oe,d as oa,di as ca,ei as ce,fi as ia,hi as ma,i as da,ii as ha,j as ua,jt as xa,mi as pa,ni as Ne,oi as ie,pi as we,pn as fa,qn as ba,ri as ga,si as Se,ti as _e,ui as ja,wr as ya,zr as me,zt as va}from"./cells-BIt-E5vq.js";import"./react-dom-Ba2zmJWD.js";import{t as Ce}from"./compiler-runtime-DnimoHo0.js";import{c as Na}from"./utils-C8Yt16Y7.js";import{t as wa}from"./ErrorBoundary-B392qglD.js";import{t as Y}from"./cn-DCUzRj2J.js";import{t as Sa}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import{r as _a}from"./config-DjP9S1hr.js";import"./popover-B96fOqfH.js";import{_ as Ie,at as Ca,d as Ia,g as de,h as he,it as Ta,m as se,nt as Te,ot as ka,p as ke,rt as Pa,tt as ue}from"./JsonOutput-CbpX5Kgt.js";import"./download-DYiwRe8_.js";import{r as Pe}from"./radio-group-CFoizYY0.js";import{t as xe}from"./tooltip-C9LWGQ7Y.js";import{r as Fa,t as le}from"./button-W__YVea9.js";import"./dist-CeF1Em5L.js";import{l as ne}from"./arrays-UzzAzxsG.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{i as Ra}from"./strings-DmKKoXrM.js";import{r as $a}from"./requests-B9zEd_sW.js";import{t as Da}from"./createLucideIcon-B8oVfJNp.js";import{t as Va}from"./x-4y-nyVDU.js";import{a as qa,r as Ba}from"./tree-actions-B7cSMuSB.js";import"./markdown-renderer-CP1Up_3K.js";import{t as Fe}from"./plus-r1QITpsJ.js";import{a as Ea}from"./input-BN98e517.js";import{n as La,o as Oa}from"./column-preview-BVzFL_8v.js";import{t as Ma}from"./workflow-CAJ8rXSh.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import"./purify.es-Bwm8T4QC.js";import"./dates-CZTDC2tF.js";import{t as za}from"./copy-icon-Cn8LzPNx.js";import{t as Aa}from"./context-BJMN4ll3.js";import"./tooltip-BUmTS76K.js";import"./vega-loader.browser-DLY285WP.js";import"./defaultLocale-CGJY8D9C.js";import"./defaultLocale-DzliDDTm.js";import{t as Re}from"./cell-link-CvOBew-Z.js";import"./chunk-5FQGJX7Z-BIDn9QG0.js";import{r as Ua}from"./html-to-image-BvGsu9Nz.js";import{o as Ga}from"./focus-agtnrA0w.js";import{n as pe}from"./useAsyncData-BcvSvTUt.js";import{a as Ha,i as Ka,n as Wa,o as $e,r as Xa,t as Ja}from"./table-xPvP31p3.js";import"./react-resizable-panels.browser.esm-CLaR27oP.js";import{a as Ya,f as Qa,o as re,t as Za}from"./command-D5LtSvbN.js";import{n as et}from"./icons-BwSNDWAP.js";import{t as at}from"./useDeepCompareMemoize-CbFVGT0j.js";import{t as tt}from"./empty-state-CBq3j1LH.js";import{n as st,t as lt}from"./common-BGAfLk4T.js";import{a as nt,i as De,n as Ve,o as rt,r as qe,t as ot}from"./components-DMNnJpT_.js";import{r as ct,t as Be}from"./add-connection-dialog-DYkpW2NI.js";import{r as it}from"./panel-accordion-state-Rl5fu2O3.js";var mt=Da("square-equal",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]),U=Ce(),F=ge(We(),1),s=ge(Sa(),1),fe=1;function Ee(a){return 1.75+a*fe}function dt(a){return 3+a*fe}function Le(a){return 3.25+a*fe}var A={engineEmpty:.75,engine:.75,database:1,tableLoading:2.75,tableSchemaless:2,columnLocal:1.25,columnPreview:2.5};function O(a){return{paddingLeft:`${a}rem`}}var ht=Ke(a=>{let e=a(Ne),t=a(na),l=a(da);return ne(e,n=>{if(!n.variable_name)return-1;let m=Object.values(t).find(u=>u.name===n.variable_name);if(!m)return 0;let r=l.inOrderIds.indexOf(m.declaredBy[0]);return r===-1?0:r})});const ut=ra("marimo:datasources:hideEmpty",!1,ea,{getOnInit:!0});function Oe(a){let e=!1,t=[];for(let l of a){if(!oe(l)||!ie(l)){t.push(l);continue}let n=l.child_schemas??[],m=Oe(n);if(l.tables.length===0&&m.length===0){e=!0;continue}if(m===n){t.push(l);continue}e=!0,t.push({...l,child_schemas:m})}return e?t:a}function xt(a){let e=!1,t=[];for(let l of a){if(Se(l)&&l.schemas.length===0){e=!0;continue}if(l.schemas.length===0){t.push(l);continue}let n=Oe(l.schemas);if(n.length===0){e=!0;continue}if(n===l.schemas){t.push(l);continue}e=!0,t.push({...l,schemas:n})}return e?t:a}const pt=()=>{let a=(0,U.c)(40),[e,t]=F.useState(""),[l,n]=ye(ut),m=je(_e),r=J(ht),u=J(ve),o;e:{if(!l){o=u;break e}let x,w;a[0]===u?(x=a[1],w=a[2]):(x=!1,w=u.map(C=>{let T=xt(C.databases);return T===C.databases?C:(x=!0,{...C,databases:T})}),a[0]=u,a[1]=x,a[2]=w),o=x?w:u}let p=o;if(r.length===0&&p.length===0){let x;return a[3]===Symbol.for("react.memo_cache_sentinel")?(x=(0,s.jsx)(tt,{title:"No tables found",description:"Any datasets/dataframes in the global scope will be shown here.",action:(0,s.jsx)(Be,{children:(0,s.jsxs)(le,{variant:"outline",size:"sm",children:["Add database or catalog",(0,s.jsx)(Fe,{className:"h-4 w-4 ml-2"})]})}),icon:(0,s.jsx)(me,{})}),a[3]=x):x=a[3],x}let h=!!e.trim(),c;a[4]===m?c=a[5]:(c=x=>{m(x.length>0),t(x)},a[4]=m,a[5]=c);let i;a[6]!==e||a[7]!==c?(i=(0,s.jsx)(Ya,{placeholder:"Search tables...",className:"h-6 m-1",value:e,onValueChange:c,rootClassName:"flex-1 border-r border-b-0"}),a[6]=e,a[7]=c,a[8]=i):i=a[8];let f;a[9]===h?f=a[10]:(f=h&&(0,s.jsx)("button",{type:"button",className:"float-right border-b px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",onClick:()=>t(""),children:(0,s.jsx)(Va,{className:"h-4 w-4"})}),a[9]=h,a[10]=f);let I=!l,b;a[11]!==l||a[12]!==n?(b=()=>n(!l),a[11]=l,a[12]=n,a[13]=b):b=a[13];let y;a[14]!==I||a[15]!==b?(y=(0,s.jsx)(qa,{"data-testid":"datasources-hide-empty-button",isVisible:I,onToggle:b,showTooltip:"Show empty schemas and databases",hideTooltip:"Hide empty schemas and databases",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden"}),a[14]=I,a[15]=b,a[16]=y):y=a[16];let v;a[17]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsx)(Be,{children:(0,s.jsx)(le,{variant:"ghost",size:"sm",className:"px-2 rounded-none focus-visible:outline-hidden",children:(0,s.jsx)(Fe,{className:"h-4 w-4"})})}),a[17]=v):v=a[17];let g;a[18]!==i||a[19]!==f||a[20]!==y?(g=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[i,f,y,v]}),a[18]=i,a[19]=f,a[20]=y,a[21]=g):g=a[21];let j;if(a[22]!==p||a[23]!==e){let x;a[25]===e?x=a[26]:(x=w=>(0,s.jsx)(ft,{connection:w,hasChildren:w.databases.length>0,children:w.databases.map(C=>(0,s.jsx)(bt,{connection:w,database:C,searchValue:e},C.name))},w.name),a[25]=e,a[26]=x),j=p.map(x),a[22]=p,a[23]=e,a[24]=j}else j=a[24];let S;a[27]!==p.length||a[28]!==r.length?(S=p.length>0&&r.length>0&&(0,s.jsxs)(ke,{className:"pr-2",style:O(A.engine),children:[(0,s.jsx)(et,{className:"h-4 w-4 text-muted-foreground"}),(0,s.jsx)("span",{className:"text-xs",children:"Python"})]}),a[27]=p.length,a[28]=r.length,a[29]=S):S=a[29];let d;a[30]!==e||a[31]!==r?(d=r.length>0&&(0,s.jsx)(be,{tables:r,searchValue:e}),a[30]=e,a[31]=r,a[32]=d):d=a[32];let N;a[33]!==S||a[34]!==d||a[35]!==j?(N=(0,s.jsxs)(Qa,{className:"flex flex-col",children:[j,S,d]}),a[33]=S,a[34]=d,a[35]=j,a[36]=N):N=a[36];let _;return a[37]!==N||a[38]!==g?(_=(0,s.jsxs)(Za,{className:"border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden",shouldFilter:!1,children:[g,N]}),a[37]=N,a[38]=g,a[39]=_):_=a[39],_};var ft=a=>{let e=(0,U.c)(26),{connection:t,children:l,hasChildren:n}=a,m=t.name===ma,r=m?"In-Memory":t.name,{previewDataSourceConnection:u}=$a(),o;e[0]!==t.name||e[1]!==u?(o=async()=>{await u({engine:t.name})},e[0]=t.name,e[1]=u,e[2]=o):o=e[2];let p=o,h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=O(A.engine),e[3]=h):h=e[3];let c;e[4]===t.dialect?c=e[5]:(c=(0,s.jsx)(Je,{className:"h-4 w-4 text-muted-foreground",name:t.dialect}),e[4]=t.dialect,e[5]=c);let i;e[6]===t.dialect?i=e[7]:(i=ya(t.dialect),e[6]=t.dialect,e[7]=i);let f;e[8]===i?f=e[9]:(f=(0,s.jsx)("span",{className:"text-xs",children:i}),e[8]=i,e[9]=f);let I=r,b;e[10]===I?b=e[11]:(b=(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(0,s.jsx)(rt,{variableName:I}),")"]}),e[10]=I,e[11]=b);let y;e[12]!==p||e[13]!==m?(y=!m&&(0,s.jsx)(Ba,{onClick:p,tooltip:"Refresh connection",className:"ml-auto h-4 p-0",iconClassName:"h-3.5 w-3.5"}),e[12]=p,e[13]=m,e[14]=y):y=e[14];let v;e[15]!==c||e[16]!==f||e[17]!==b||e[18]!==y?(v=(0,s.jsxs)(ke,{className:"pr-2",style:h,children:[c,f,b,y]}),e[15]=c,e[16]=f,e[17]=b,e[18]=y,e[19]=v):v=e[19];let g;e[20]!==l||e[21]!==n?(g=n?l:(0,s.jsx)(se,{content:"No databases available",style:O(A.engineEmpty)}),e[20]=l,e[21]=n,e[22]=g):g=e[22];let j;return e[23]!==g||e[24]!==v?(j=(0,s.jsxs)(s.Fragment,{children:[v,g]}),e[23]=g,e[24]=v,e[25]=j):j=e[25],j},Me=F.createContext(null);function ze(){let a=F.useContext(Me);if(a==null)throw Error("useDataSourceTree must be used within a DataSourceTreeContext.Provider");return a}function Ae(a,{schema:e,schemaPath:t}){return{engine:a.engineName,database:a.databaseName,schema:e,schemaPath:t,defaultSchema:a.defaultSchema,defaultDatabase:a.defaultDatabase,dialect:a.dialect}}var bt=a=>{let e=(0,U.c)(21),{connection:t,database:l,searchValue:n}=a,m;e[0]!==t.default_database||e[1]!==t.default_schema||e[2]!==t.dialect||e[3]!==t.name||e[4]!==l.name||e[5]!==n?(m={engineName:t.name,databaseName:l.name,dialect:t.dialect,defaultSchema:t.default_schema,defaultDatabase:t.default_database,searchValue:n},e[0]=t.default_database,e[1]=t.default_schema,e[2]=t.dialect,e[3]=t.name,e[4]=l.name,e[5]=n,e[6]=m):m=e[6];let r=m,u=t.name,o=l.schemas,p;e[7]===l?p=e[8]:(p=Se(l),e[7]=l,e[8]=p);let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[9]=h):h=e[9];let c;e[10]!==l.schemas||e[11]!==p?(c=(0,s.jsx)(Ue,{schemas:o,schemasResolved:p,schemaPath:h,depth:0}),e[10]=l.schemas,e[11]=p,e[12]=c):c=e[12];let i;e[13]!==c||e[14]!==r?(i=(0,s.jsx)(Me.Provider,{value:r,children:c}),e[13]=c,e[14]=r,e[15]=i):i=e[15];let f;return e[16]!==t.name||e[17]!==l||e[18]!==n||e[19]!==i?(f=(0,s.jsx)(gt,{engineName:u,database:l,searchValue:n,children:i}),e[16]=t.name,e[17]=l,e[18]=n,e[19]=i,e[20]=f):f=e[20],f},gt=a=>{let e=(0,U.c)(29),{searchValue:t,engineName:l,database:n,children:m}=a,r;e[0]!==n||e[1]!==t?(r=ia(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let u=r,[o,p]=F.useState(u),[h,c]=F.useState(!1),[i,f]=F.useState(t),[I,b]=F.useState(u);(i!==t||I!==u)&&(f(t),b(u),p(u));let y;e[3]===Symbol.for("react.memo_cache_sentinel")?(y=O(A.database),e[3]=y):y=e[3];let v;e[4]!==o||e[5]!==h?(v=()=>{p(!o),c(!h)},e[4]=o,e[5]=h,e[6]=v):v=e[6];let g=`${l}:${n.name}`,j;e[7]===o?j=e[8]:(j=(0,s.jsx)(Ie,{isExpanded:o}),e[7]=o,e[8]=j);let S=h&&o?"text-foreground":"text-muted-foreground",d;e[9]===S?d=e[10]:(d=Y("h-4 w-4",S),e[9]=S,e[10]=d);let N;e[11]===d?N=e[12]:(N=(0,s.jsx)(me,{className:d}),e[11]=d,e[12]=N);let _=h&&o&&"font-semibold",x;e[13]===_?x=e[14]:(x=Y(_),e[13]=_,e[14]=x);let w;e[15]===n.name?w=e[16]:(w=n.name===""?(0,s.jsx)("i",{children:"Not connected"}):n.name,e[15]=n.name,e[16]=w);let C;e[17]!==x||e[18]!==w?(C=(0,s.jsx)("span",{className:x,children:w}),e[17]=x,e[18]=w,e[19]=C):C=e[19];let T;e[20]!==C||e[21]!==v||e[22]!==g||e[23]!==j||e[24]!==N?(T=(0,s.jsxs)(re,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",style:y,onSelect:v,value:g,children:[j,N,C]}),e[20]=C,e[21]=v,e[22]=g,e[23]=j,e[24]=N,e[25]=T):T=e[25];let k=o&&m,P;return e[26]!==T||e[27]!==k?(P=(0,s.jsxs)(s.Fragment,{children:[T,k]}),e[26]=T,e[27]=k,e[28]=P):P=e[28],P},Ue=a=>{let{schemas:e,schemasResolved:t,depth:l}=a,n=ze(),{engineName:m,databaseName:r,searchValue:u}=n,{addSchemaList:o}=ce(),p=at(a.schemaPath),[h,c]=F.useState(!1),{isPending:i,error:f}=pe(async()=>{if(!t&&m){c(!0);try{o({schemas:(await sa.request({engine:m,database:r,schemaPath:p})).schemas??[],sqlSchemaContext:{engine:m,database:r,schemaPath:p}})}finally{c(!1)}}},[t,m,r,p]),I=O(Ee(l));return i||h?(0,s.jsx)(de,{message:"Loading schemas...",style:I}):f?(0,s.jsx)(he,{error:f,style:I}):e.length===0?(0,s.jsx)(se,{content:"No schemas available",style:I}):(0,s.jsx)(s.Fragment,{children:e.map(b=>ja(b.name)?(0,s.jsx)(be,{tables:b.tables,tablesResolved:oe(b),searchValue:u,sqlTableContext:Ae(n,{schema:b.name,schemaPath:p})},b.name):(0,s.jsx)(jt,{schema:b,schemaPath:[...p,b.name],depth:l},b.name))})},jt=a=>{let e=(0,U.c)(39),{schema:t,schemaPath:l,depth:n}=a,m=ze(),{databaseName:r,searchValue:u}=m,o;e[0]!==t||e[1]!==u?(o=ca(t,u),e[0]=t,e[1]=u,e[2]=o):o=e[2];let p=o,[h,c]=F.useState(p),[i,f]=F.useState(!1),[I,b]=F.useState(u),[y,v]=F.useState(p),g=`${r}:${l.join(".")}`,j;e[3]===t.child_schemas?j=e[4]:(j=t.child_schemas??[],e[3]=t.child_schemas,e[4]=j);let S=j;(I!==u||y!==p)&&(b(u),v(p),c(p));let d;e[5]===n?d=e[6]:(d=O(Ee(n)),e[5]=n,e[6]=d);let N;e[7]!==h||e[8]!==i?(N=()=>{c(!h),f(!i)},e[7]=h,e[8]=i,e[9]=N):N=e[9];let _;e[10]===h?_=e[11]:(_=(0,s.jsx)(Ie,{isExpanded:h}),e[10]=h,e[11]=_);let x=i&&h&&"text-foreground",w;e[12]===x?w=e[13]:(w=Y("h-4 w-4 text-muted-foreground",x),e[12]=x,e[13]=w);let C;e[14]===w?C=e[15]:(C=(0,s.jsx)(Ze,{className:w}),e[14]=w,e[15]=C);let T=i&&h&&"font-semibold",k;e[16]===T?k=e[17]:(k=Y(T),e[16]=T,e[17]=k);let P;e[18]!==t.name||e[19]!==k?(P=(0,s.jsx)("span",{className:k,children:t.name}),e[18]=t.name,e[19]=k,e[20]=P):P=e[20];let $;e[21]!==P||e[22]!==d||e[23]!==N||e[24]!==_||e[25]!==C||e[26]!==g?($=(0,s.jsxs)(re,{className:"text-sm flex flex-row gap-1 items-center cursor-pointer rounded-none",style:d,onSelect:N,value:g,children:[_,C,P]}),e[21]=P,e[22]=d,e[23]=N,e[24]=_,e[25]=C,e[26]=g,e[27]=$):$=e[27];let D;e[28]!==S||e[29]!==n||e[30]!==h||e[31]!==t||e[32]!==l||e[33]!==u||e[34]!==m?(D=h&&(0,s.jsxs)(s.Fragment,{children:[(S.length>0||!ie(t))&&(0,s.jsx)(Ue,{schemas:S,schemasResolved:ie(t),schemaPath:l,depth:n+1}),(0,s.jsx)(be,{tables:t.tables,tablesResolved:oe(t),searchValue:u,tableIndentRem:dt(n),columnIndentRem:Le(n),sqlTableContext:Ae(m,{schema:t.name,schemaPath:l})})]}),e[28]=S,e[29]=n,e[30]=h,e[31]=t,e[32]=l,e[33]=u,e[34]=m,e[35]=D):D=e[35];let R;return e[36]!==$||e[37]!==D?(R=(0,s.jsxs)(s.Fragment,{children:[$,D]}),e[36]=$,e[37]=D,e[38]=R):R=e[38],R},be=a=>{let e=(0,U.c)(31),{tables:t,sqlTableContext:l,searchValue:n,tablesResolved:m,tableIndentRem:r,columnIndentRem:u}=a,o=m===void 0?!0:m,{addTableList:p}=ce(),[h,c]=F.useState(!1),i;e[0]!==p||e[1]!==l||e[2]!==o?(i=async()=>{if(!o&&l){c(!0);let{engine:d,database:N,schema:_,schemaPath:x}=l,w=await Xe.request({engine:d,database:N,schema:_,schemaPath:x??[]});if(!(w!=null&&w.tables))throw c(!1),Error("No tables available");p({tables:w.tables,sqlTableContext:l}),c(!1)}},e[0]=p,e[1]=l,e[2]=o,e[3]=i):i=e[3];let f;e[4]!==l||e[5]!==o?(f=[o,l],e[4]=l,e[5]=o,e[6]=f):f=e[6];let{isPending:I,error:b}=pe(i,f),y=r??A.tableLoading,v;e[7]===y?v=e[8]:(v=O(y),e[7]=y,e[8]=v);let g=v;if(I||h){let d;return e[9]===g?d=e[10]:(d=(0,s.jsx)(de,{message:"Loading tables...",style:g}),e[9]=g,e[10]=d),d}if(b){let d;return e[11]!==b||e[12]!==g?(d=(0,s.jsx)(he,{error:b,style:g}),e[11]=b,e[12]=g,e[13]=d):d=e[13],d}if(t.length===0){let d;return e[14]===g?d=e[15]:(d=(0,s.jsx)(se,{content:"No tables found",style:g}),e[14]=g,e[15]=d),d}let j;if(e[16]!==u||e[17]!==n||e[18]!==l||e[19]!==r||e[20]!==t){let d;e[22]===n?d=e[23]:(d=x=>n?x.name.toLowerCase().includes(n.toLowerCase()):!0,e[22]=n,e[23]=d);let N=t.filter(d),_;e[24]!==u||e[25]!==n||e[26]!==l||e[27]!==r?(_=x=>(0,s.jsx)(yt,{table:x,sqlTableContext:l,isSearching:!!n,tableIndentRem:r,columnIndentRem:u},x.name),e[24]=u,e[25]=n,e[26]=l,e[27]=r,e[28]=_):_=e[28],j=N.map(_),e[16]=u,e[17]=n,e[18]=l,e[19]=r,e[20]=t,e[21]=j}else j=e[21];let S;return e[29]===j?S=e[30]:(S=(0,s.jsx)(s.Fragment,{children:j}),e[29]=j,e[30]=S),S},yt=a=>{let e=(0,U.c)(69),{table:t,sqlTableContext:l,isSearching:n,tableIndentRem:m,columnIndentRem:r}=a,{addTable:u}=ce(),[o,p]=F.useState(!1),h=t.columns.length>0,c;e[0]!==u||e[1]!==o||e[2]!==l||e[3]!==t.name||e[4]!==h?(c=async()=>{if(o&&!h&&l){let{engine:E,database:ee,schema:ae,schemaPath:He}=l,te=await va.request({engine:E,database:ee,schema:ae,tableName:t.name,schemaPath:He??[]});if(!(te!=null&&te.table))throw Error("No table details available");u({table:te.table,sqlTableContext:l})}},e[0]=u,e[1]=o,e[2]=l,e[3]=t.name,e[4]=h,e[5]=c):c=e[5];let i;e[6]!==o||e[7]!==h?(i=[o,h],e[6]=o,e[7]=h,e[8]=i):i=e[8];let{isFetching:f,isPending:I,error:b}=pe(c,i),y=J(Na),v=Ga(),{createNewCell:g}=Qe(),j=Pe(),S;e[9]!==j||e[10]!==y||e[11]!==g||e[12]!==v||e[13]!==l||e[14]!==t?(S=()=>{Ua({autoInstantiate:y,createNewCell:g,fromCellId:v}),j((()=>{if(t.source_type==="catalog"){let E=l!=null&&l.database?[l.database,...l.schemaPath??[],t.name].join("."):t.name;return`${t.engine}.load_table("${E}")`}if(l)return we({table:t,columnName:"*",sqlTableContext:l});switch(t.source_type){case"local":return`mo.ui.table(${t.name})`;case"duckdb":case"connection":return we({table:t,columnName:"*",sqlTableContext:l});default:return Ra(t.source_type),""}})())},e[9]=j,e[10]=y,e[11]=g,e[12]=v,e[13]=l,e[14]=t,e[15]=S):S=e[15];let d=S,N;e[16]!==t.num_columns||e[17]!==t.num_rows?(N=()=>{let E=[];return t.num_rows!=null&&E.push(`${t.num_rows} rows`),t.num_columns!=null&&E.push(`${t.num_columns} columns`),E.length===0?null:(0,s.jsx)("div",{className:"flex flex-row gap-2 items-center pl-6 group-hover:hidden",children:(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:E.join(", ")})})},e[16]=t.num_columns,e[17]=t.num_rows,e[18]=N):N=e[18];let _=N,x;e[19]!==r||e[20]!==b||e[21]!==f||e[22]!==I||e[23]!==l||e[24]!==t?(x=()=>{let E=O(r??A.tableLoading);if(I||f)return(0,s.jsx)(de,{message:"Loading columns...",style:E});if(b)return(0,s.jsx)(he,{error:b,style:E});let ee=t.columns;return ee.length===0?(0,s.jsx)(se,{content:"No columns found",style:E}):ee.map(ae=>(0,s.jsx)(vt,{table:t,column:ae,sqlTableContext:l,columnIndentRem:r},ae.name))},e[19]=r,e[20]=b,e[21]=f,e[22]=I,e[23]=l,e[24]=t,e[25]=x):x=e[25];let w=x,C;e[26]!==o||e[27]!==n||e[28]!==t.source_type||e[29]!==t.type?(C=()=>{if(t.source_type!=="local")return(0,s.jsx)(t.type==="table"?Ye:ta,{className:"h-3 w-3",strokeWidth:o||n?2.5:void 0})},e[26]=o,e[27]=n,e[28]=t.source_type,e[29]=t.type,e[30]=C):C=e[30];let T=C,k;e[31]!==l||e[32]!==t.name?(k=pa(l,t.name),e[31]=l,e[32]=t.name,e[33]=k):k=e[33];let P=k,$=m??(l?A.tableSchemaless:0),D=(o||n)&&"font-semibold",R;e[34]===D?R=e[35]:(R=Y("rounded-none group h-8 cursor-pointer",D),e[34]=D,e[35]=R);let V;e[36]===$?V=e[37]:(V=O($),e[36]=$,e[37]=V);let q;e[38]===o?q=e[39]:(q=()=>p(!o),e[38]=o,e[39]=q);let L;e[40]===T?L=e[41]:(L=T(),e[40]=T,e[41]=L);let M;e[42]===t.name?M=e[43]:(M=(0,s.jsx)("span",{className:"text-sm",children:t.name}),e[42]=t.name,e[43]=M);let z;e[44]!==L||e[45]!==M?(z=(0,s.jsxs)("div",{className:"flex gap-2 items-center flex-1 pl-1",children:[L,M]}),e[44]=L,e[45]=M,e[46]=z):z=e[46];let B;e[47]===_?B=e[48]:(B=_(),e[47]=_,e[48]=B);let H;e[49]===d?H=e[50]:(H=Fa.stopPropagation(()=>d()),e[49]=d,e[50]=H);let Q;e[51]===Symbol.for("react.memo_cache_sentinel")?(Q=(0,s.jsx)(Oa,{className:"h-3 w-3"}),e[51]=Q):Q=e[51];let K;e[52]===H?K=e[53]:(K=(0,s.jsx)(xe,{content:"Add table to notebook",delayDuration:400,children:(0,s.jsx)(le,{className:"group-hover:inline-flex hidden",variant:"text",size:"icon",onClick:H,children:Q})}),e[52]=H,e[53]=K);let W;e[54]!==o||e[55]!==V||e[56]!==q||e[57]!==z||e[58]!==B||e[59]!==K||e[60]!==R||e[61]!==P?(W=(0,s.jsxs)(re,{className:R,style:V,value:P,"aria-selected":o,forceMount:!0,onSelect:q,children:[z,B,K]}),e[54]=o,e[55]=V,e[56]=q,e[57]=z,e[58]=B,e[59]=K,e[60]=R,e[61]=P,e[62]=W):W=e[62];let X;e[63]!==o||e[64]!==w?(X=o&&w(),e[63]=o,e[64]=w,e[65]=X):X=e[65];let Z;return e[66]!==W||e[67]!==X?(Z=(0,s.jsxs)(s.Fragment,{children:[W,X]}),e[66]=W,e[67]=X,e[68]=Z):Z=e[68],Z},vt=a=>{var M,z;let e=(0,U.c)(51),{table:t,column:l,sqlTableContext:n,columnIndentRem:m}=a,[r,u]=F.useState(!1),o=J(_e),p=je(ga);o&&r&&u(!1),p(r?B=>new Set([...B,`${t.name}:${l.name}`]):B=>(B.delete(`${t.name}:${l.name}`),new Set(B)));let h=Pe(),{columnsPreviews:c}=ha(),i;e[0]!==l.name||e[1]!==t.primary_keys?(i=((M=t.primary_keys)==null?void 0:M.includes(l.name))||!1,e[0]=l.name,e[1]=t.primary_keys,e[2]=i):i=e[2];let f=i,I;e[3]!==l.name||e[4]!==t.indexes?(I=((z=t.indexes)==null?void 0:z.includes(l.name))||!1,e[3]=l.name,e[4]=t.indexes,e[5]=I):I=e[5];let b=I,y;e[6]===h?y=e[7]:(y=B=>{h(B)},e[6]=h,e[7]=y);let v=y,g=Nt,j=r?"font-semibold":"",S;e[8]!==l.name||e[9]!==j?(S=(0,s.jsx)("span",{className:j,children:l.name}),e[8]=l.name,e[9]=j,e[10]=S):S=e[10];let d=S,N=`${t.name}.${l.name}`,_=`${t.name}.${l.name}`,x;e[11]===r?x=e[12]:(x=()=>u(!r),e[11]=r,e[12]=x);let w;e[13]!==m||e[14]!==n?(w=m??(n?Le(0):A.columnLocal),e[13]=m,e[14]=n,e[15]=w):w=e[15];let C;e[16]===w?C=e[17]:(C=O(w),e[16]=w,e[17]=C);let T;e[18]!==l.type||e[19]!==d?(T=(0,s.jsx)(Ia,{columnName:d,dataType:l.type}),e[18]=l.type,e[19]=d,e[20]=T):T=e[20];let k;e[21]===f?k=e[22]:(k=f&&g({tooltipContent:"Primary key",content:"PK"}),e[21]=f,e[22]=k);let P;e[23]===b?P=e[24]:(P=b&&g({tooltipContent:"Indexed",content:"IDX"}),e[23]=b,e[24]=P);let $;e[25]!==C||e[26]!==T||e[27]!==k||e[28]!==P?($=(0,s.jsxs)("div",{className:"flex flex-row gap-2 items-center flex-1",style:C,children:[T,k,P]}),e[25]=C,e[26]=T,e[27]=k,e[28]=P,e[29]=$):$=e[29];let D;e[30]===l.name?D=e[31]:(D=(0,s.jsx)(xe,{content:"Copy column name",delayDuration:400,children:(0,s.jsx)(le,{variant:"text",size:"icon",className:"group-hover:opacity-100 opacity-0 hover:bg-muted text-muted-foreground hover:text-foreground",children:(0,s.jsx)(za,{tooltip:!1,value:l.name,className:"h-3 w-3"})})}),e[30]=l.name,e[31]=D);let R;e[32]===l.external_type?R=e[33]:(R=(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:l.external_type}),e[32]=l.external_type,e[33]=R);let V;e[34]!==$||e[35]!==D||e[36]!==R||e[37]!==N||e[38]!==_||e[39]!==x?(V=(0,s.jsxs)(re,{className:"rounded-none py-1 group cursor-pointer",value:_,onSelect:x,children:[$,D,R]},N),e[34]=$,e[35]=D,e[36]=R,e[37]=N,e[38]=_,e[39]=x,e[40]=V):V=e[40];let q;e[41]!==l||e[42]!==c||e[43]!==v||e[44]!==r||e[45]!==n||e[46]!==t?(q=r&&(0,s.jsx)("div",{className:"pr-2 py-2 bg-(--slate-1) shadow-inner border-b",style:O(A.columnPreview),children:(0,s.jsx)(wa,{children:(0,s.jsx)(La,{table:t,column:l,onAddColumnChart:v,preview:c.get(n?`${n.database}.${n.schema}.${t.name}:${l.name}`:`${t.name}:${l.name}`),sqlTableContext:n})})}),e[41]=l,e[42]=c,e[43]=v,e[44]=r,e[45]=n,e[46]=t,e[47]=q):q=e[47];let L;return e[48]!==V||e[49]!==q?(L=(0,s.jsxs)(s.Fragment,{children:[V,q]}),e[48]=V,e[49]=q,e[50]=L):L=e[50],L};function Nt(a){let{tooltipContent:e,content:t}=a;return(0,s.jsx)(xe,{content:e,delayDuration:100,children:(0,s.jsx)("span",{className:"text-xs text-black bg-gray-100 dark:invert rounded px-1",children:t})})}function Ds(a){return a}var G={name:"name",type:"type-value",defs:"defs-refs"},wt=[{id:G.name,accessorFn:a=>[a.name,a.declaredBy],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,s.jsx)(ue,{header:"Name",column:a}),cell:({getValue:a})=>{let[e,t]=a();return(0,s.jsx)(lt,{name:e,declaredBy:t})}},{id:G.type,accessorFn:a=>[a.dataType,a.value],enableSorting:!0,sortingFn:"alphanumeric",header:({column:a})=>(0,s.jsx)(ue,{header:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{children:"Type"}),(0,s.jsx)("span",{children:"Value"})]}),column:a}),cell:({getValue:a})=>{let[e,t]=a();return(0,s.jsxs)("div",{className:"max-w-[150px]",children:[(0,s.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap text-muted-foreground font-mono text-xs",children:e}),(0,s.jsx)("div",{className:"text-ellipsis overflow-hidden whitespace-nowrap",title:t??"",children:t})]})}},{id:G.defs,accessorFn:a=>[a.declaredBy,a.usedBy,a.name,a.declaredByNames,a.usedByNames],enableSorting:!0,sortingFn:"basic",header:({column:a})=>(0,s.jsx)(ue,{header:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,s.jsx)("span",{children:"Declared By"}),(0,s.jsx)("span",{children:"Used By"})]}),column:a}),cell:({getValue:a})=>{let[e,t,l]=a(),n=m=>{let r=oa(m);r&&fa(r,l)};return(0,s.jsxs)("div",{className:"flex flex-col gap-1 py-1",children:[(0,s.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-center",children:[(0,s.jsx)("span",{title:"Declared by",children:(0,s.jsx)(mt,{className:"w-3.5 h-3.5 text-muted-foreground"})}),e.length===1?(0,s.jsx)(Re,{variant:"focus",cellId:e[0],skipScroll:!0,onClick:()=>n(e[0])}):(0,s.jsx)("div",{className:"text-destructive flex flex-row gap-2",children:e.slice(0,3).map((m,r)=>(0,s.jsxs)("span",{className:"flex",children:[(0,s.jsx)(Re,{variant:"focus",cellId:m,skipScroll:!0,className:"whitespace-nowrap text-destructive",onClick:()=>n(m)},m),r<e.length-1&&", "]},m))})]}),(0,s.jsxs)("div",{className:"flex flex-row overflow-auto gap-2 items-baseline",children:[(0,s.jsx)("span",{title:"Used by",children:(0,s.jsx)(Ma,{className:"w-3.5 h-3.5 text-muted-foreground"})}),(0,s.jsx)(st,{maxCount:3,cellIds:t,skipScroll:!0,onClick:n})]})]})}}];function St({variables:a,sort:e,cellIdToIndex:t}){e||(e={id:G.defs,desc:!1});let l=[];switch(e.id){case G.name:l=ne(a,n=>n.name);break;case G.type:l=ne(a,n=>n.dataType);break;case G.defs:l=ne(a,n=>t.get(n.declaredBy[0]));break}return e.desc?l.toReversed():l}const Ge=(0,F.memo)(({className:a,cellIds:e,variables:t})=>{let[l,n]=F.useState([]),[m,r]=F.useState(""),u=aa(),{locale:o}=Aa(),p=(0,F.useMemo)(()=>{let c=i=>{let f=u[i];return xa(f)?`cell-${e.indexOf(i)}`:f??`cell-${e.indexOf(i)}`};return Object.values(t).map(i=>({...i,declaredByNames:i.declaredBy.map(c),usedByNames:i.usedBy.map(c)}))},[t,u,e]),h=Pa({data:(0,F.useMemo)(()=>{let c=new Map;return e.forEach((i,f)=>c.set(i,f)),St({variables:p,sort:l[0],cellIdToIndex:c})},[p,l,e]),columns:wt,getCoreRowModel:Ta(),onGlobalFilterChange:r,getFilteredRowModel:Ca(),enableFilters:!0,enableGlobalFilter:!0,enableColumnPinning:!1,getColumnCanGlobalFilter(c){return c.columnDef.enableGlobalFilter??!0},globalFilterFn:"auto",manualSorting:!0,locale:o,onSortingChange:n,getSortedRowModel:ka(),state:{sorting:l,globalFilter:m}});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(Ea,{className:"w-full",placeholder:"Search",value:m,onChange:c=>r(c.target.value)}),(0,s.jsxs)(Ja,{className:Y("w-full text-sm flex-1 border-separate border-spacing-0",a),children:[(0,s.jsx)(Ha,{children:(0,s.jsx)($e,{className:"whitespace-nowrap text-xs",children:h.getFlatHeaders().map(c=>(0,s.jsx)(Ka,{className:"sticky top-0 bg-background border-b",children:Te(c.column.columnDef.header,c.getContext())},c.id))})}),(0,s.jsx)(Wa,{children:h.getRowModel().rows.map(c=>(0,s.jsx)($e,{className:"hover:bg-accent",children:c.getVisibleCells().map(i=>(0,s.jsx)(Xa,{className:"border-b",children:Te(i.column.columnDef.cell,i.getContext())},i.id))},c.id))})]})]})});Ge.displayName="VariableTable";var _t=Ce(),Ct=()=>{let a=(0,_t.c)(28),e=ba(),t=ua(),l=J(Ne),n=J(ve),m=ct("database"),[r,u]=ye(it),o=l.length+n.length,p;a[0]!==o||a[1]!==r.hasUserInteracted||a[2]!==r.openSections?(p=!r.hasUserInteracted&&o>0?[...new Set([...r.openSections,"datasources"])]:r.openSections,a[0]=o,a[1]=r.hasUserInteracted,a[2]=r.openSections,a[3]=p):p=a[3];let h=p,c;a[4]===u?c=a[5]:(c=x=>{u({openSections:x,hasUserInteracted:!0})},a[4]=u,a[5]=c);let i=c,f=!h.includes("datasources")&&o>0,I=m.length>0,b;a[6]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(me,{className:"w-4 h-4"}),a[6]=b):b=a[6];let y;a[7]!==o||a[8]!==f?(y=f&&(0,s.jsx)(nt,{children:o}),a[7]=o,a[8]=f,a[9]=y):y=a[9];let v;a[10]!==m.length||a[11]!==I?(v=I&&(0,s.jsx)(ot,{count:m.length,type:"database"}),a[10]=m.length,a[11]=I,a[12]=v):v=a[12];let g;a[13]!==y||a[14]!==v?(g=(0,s.jsxs)(De,{children:[b,"Data sources",y,v]}),a[13]=y,a[14]=v,a[15]=g):g=a[15];let j;a[16]===Symbol.for("react.memo_cache_sentinel")?(j=(0,s.jsx)(Ve,{children:(0,s.jsx)(pt,{})}),a[16]=j):j=a[16];let S;a[17]===g?S=a[18]:(S=(0,s.jsxs)(qe,{value:"datasources",children:[g,j]}),a[17]=g,a[18]=S);let d;a[19]===Symbol.for("react.memo_cache_sentinel")?(d=(0,s.jsxs)(De,{children:[(0,s.jsx)(la,{className:"w-4 h-4"}),"Variables"]}),a[19]=d):d=a[19];let N;a[20]!==t||a[21]!==e?(N=(0,s.jsxs)(qe,{value:"variables",lastItem:!0,children:[d,(0,s.jsx)(Ve,{children:Object.keys(e).length===0?(0,s.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground",children:"No variables defined"}):(0,s.jsx)(Ge,{cellIds:t.inOrderIds,variables:e})})]}),a[20]=t,a[21]=e,a[22]=N):N=a[22];let _;return a[23]!==i||a[24]!==h||a[25]!==S||a[26]!==N?(_=(0,s.jsxs)(_a,{type:"multiple",value:h,onValueChange:i,className:"flex flex-col h-full overflow-auto",children:[S,N]}),a[23]=i,a[24]=h,a[25]=S,a[26]=N,a[27]=_):_=a[27],_};export{Ct as default};
@@ -1 +1 @@
1
- var A=Object.defineProperty;var N=(t,e,r)=>e in t?A(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var b=(t,e,r)=>N(t,typeof e!="symbol"?e+"":e,r);import{o as T}from"./chunk-C4rtOYze.js";import{u as I}from"./useEvent-GCVIknuR.js";import{a as V}from"./cells-Biwqg0z6.js";import{t as M}from"./compiler-runtime-DnimoHo0.js";import{g as k}from"./useEventListener-DpNnLPuE.js";import{t as E}from"./objects-CrbstYTV.js";import{o as P}from"./utils-C8Yt16Y7.js";import{T as _,v as z}from"./config-DFK5eCC3.js";import{t as D}from"./cn-DCUzRj2J.js";import{t as $}from"./jsx-runtime-3wZU7vFS.js";import{s as B,u as H}from"./download-CfUkZlw7.js";import{r as L}from"./requests-B9zEd_sW.js";import{P as R}from"./layout-YPBtS2D6.js";import{t as Y}from"./Deferred-CP7vq682.js";import{t as q}from"./use-toast-DjpWVza6.js";import{t as x}from"./useInterval-WeprorQN.js";var G=class{constructor(){b(this,"capturedInputs",new Map);b(this,"inFlight",new Map)}cancelEntry(t){t.controller.abort(),t.deferred.status==="pending"&&t.deferred.resolve(void 0)}needsCapture(t,e){if(this.capturedInputs.get(t)===e)return!1;let r=this.inFlight.get(t);return!(r&&r.inputValue===e)}waitForInFlight(t,e){let r=this.inFlight.get(t);return r&&r.inputValue===e?r.deferred.promise:null}startCapture(t,e){let r=this.inFlight.get(t);r&&this.cancelEntry(r);let a=new AbortController,i=new Y,s={controller:a,inputValue:e,deferred:i};return this.inFlight.set(t,s),{signal:a.signal,markCaptured:p=>{this.inFlight.get(t)===s&&(i.resolve(p),this.capturedInputs.set(t,e),this.inFlight.delete(t))},markFailed:()=>{this.inFlight.get(t)===s&&(i.resolve(void 0),this.inFlight.delete(t))}}}prune(t){for(let e of this.capturedInputs.keys())t.has(e)||this.capturedInputs.delete(e);for(let[e,r]of this.inFlight)t.has(e)||(this.cancelEntry(r),this.inFlight.delete(e))}get isCapturing(){return this.inFlight.size>0}abort(){for(let t of this.inFlight.values())this.cancelEntry(t);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},J=M(),S=5e3;function K(){let t=(0,J.c)(14),e=I(P),{state:r}=I(z),a=e.auto_download.includes("markdown"),i=e.auto_download.includes("html"),s=e.auto_download.includes("ipynb"),p=r===_.OPEN,m=!a||!p,d=!i||!p,c=!s||!p,{autoExportAsHTML:l,autoExportAsIPYNB:o,autoExportAsMarkdown:n,updateCellOutputs:u}=L(),h=O(),f;t[0]===n?f=t[1]:(f=async()=>{await n({download:!1})},t[0]=n,t[1]=f);let g;t[2]===m?g=t[3]:(g={delayMs:S,whenVisible:!0,disabled:m},t[2]=m,t[3]=g),x(f,g);let w;t[4]===l?w=t[5]:(w=async()=>{await l({download:!1,includeCode:!0,files:R.INSTANCE.filenames()})},t[4]=l,t[5]=w);let v;t[6]===d?v=t[7]:(v={delayMs:S,whenVisible:!0,disabled:d},t[6]=d,t[7]=v),x(w,v);let F;t[8]!==o||t[9]!==h||t[10]!==u?(F=async()=>{await j({takeScreenshots:()=>h({progress:H.indeterminate()}),updateCellOutputs:u}),await o({download:!1})},t[8]=o,t[9]=h,t[10]=u,t[11]=F):F=t[11];let y;t[12]===c?y=t[13]:(y={delayMs:S,whenVisible:!0,disabled:c,skipIfRunning:!0},t[12]=c,t[13]=y),x(F,y)}var Q=new Set(["text/html","application/vnd.vegalite.v5+json","application/vnd.vega.v5+json","application/vnd.vegalite.v6+json","application/vnd.vega.v6+json"]);const C=new G;function O(){let t=I(V);return async e=>{var d,c;let{progress:r}=e,a=new Set(E.keys(t));C.prune(a);let i=[],s=[];for(let[l,o]of E.entries(t)){let n=(d=o.output)==null?void 0:d.data;if((c=o.output)!=null&&c.mimetype&&Q.has(o.output.mimetype)&&n)if(C.needsCapture(l,n))i.push([l,n]);else{let u=C.waitForInFlight(l,n);u&&s.push({cellId:l,promise:u})}}if(i.length===0&&s.length===0)return{};i.length>0&&r.addTotal(i.length);let p={};for(let[l,o]of i){let n=C.startCapture(l,o);try{let u=await B(l);if(n.signal.aborted)continue;if(!u){k.error(`Failed to capture screenshot for cell ${l}`),n.markFailed();continue}let h=["image/png",u];p[l]=h,n.markCaptured(h)}catch(u){k.error(`Error screenshotting cell ${l}:`,u),n.markFailed()}finally{r.increment(1)}}let m=await Promise.allSettled(s.map(({promise:l})=>l));for(let[l,{cellId:o}]of s.entries()){let n=m[l];n.status==="fulfilled"&&n.value&&(p[o]=n.value)}return p}}async function j(t){let{takeScreenshots:e,updateCellOutputs:r}=t;try{let a=await e();E.size(a)>0&&await r({cellIdsToOutput:a})}catch(a){k.error("Error updating cell outputs with screenshots:",a),q({title:"Failed to capture cell outputs",description:"Some outputs may be missing from the export. Continuing.",variant:"danger"})}}var U=M(),W=T($(),1),X=t=>{let e=(0,U.c)(8),r,a;e[0]===t?(r=e[1],a=e[2]):({className:r,...a}=t,e[0]=t,e[1]=r,e[2]=a);let i;e[3]===r?i=e[4]:(i=D("animate-pulse rounded-md bg-muted",r),e[3]=r,e[4]=i);let s;return e[5]!==a||e[6]!==i?(s=(0,W.jsx)("div",{className:i,...a}),e[5]=a,e[6]=i,e[7]=s):s=e[7],s};export{O as i,j as n,K as r,X as t};
1
+ var A=Object.defineProperty;var N=(t,e,r)=>e in t?A(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var b=(t,e,r)=>N(t,typeof e!="symbol"?e+"":e,r);import{o as T}from"./chunk-C4rtOYze.js";import{u as I}from"./useEvent-GCVIknuR.js";import{a as V}from"./cells-BIt-E5vq.js";import{t as M}from"./compiler-runtime-DnimoHo0.js";import{g as k}from"./useEventListener-DpNnLPuE.js";import{t as E}from"./objects-CrbstYTV.js";import{o as P}from"./utils-C8Yt16Y7.js";import{T as _,v as z}from"./config-DFK5eCC3.js";import{t as D}from"./cn-DCUzRj2J.js";import{t as $}from"./jsx-runtime-3wZU7vFS.js";import{s as B,u as H}from"./download-DYiwRe8_.js";import{r as L}from"./requests-B9zEd_sW.js";import{P as R}from"./layout-BBB9DQha.js";import{t as Y}from"./Deferred-CP7vq682.js";import{t as q}from"./use-toast-DjpWVza6.js";import{t as x}from"./useInterval-WeprorQN.js";var G=class{constructor(){b(this,"capturedInputs",new Map);b(this,"inFlight",new Map)}cancelEntry(t){t.controller.abort(),t.deferred.status==="pending"&&t.deferred.resolve(void 0)}needsCapture(t,e){if(this.capturedInputs.get(t)===e)return!1;let r=this.inFlight.get(t);return!(r&&r.inputValue===e)}waitForInFlight(t,e){let r=this.inFlight.get(t);return r&&r.inputValue===e?r.deferred.promise:null}startCapture(t,e){let r=this.inFlight.get(t);r&&this.cancelEntry(r);let a=new AbortController,i=new Y,s={controller:a,inputValue:e,deferred:i};return this.inFlight.set(t,s),{signal:a.signal,markCaptured:p=>{this.inFlight.get(t)===s&&(i.resolve(p),this.capturedInputs.set(t,e),this.inFlight.delete(t))},markFailed:()=>{this.inFlight.get(t)===s&&(i.resolve(void 0),this.inFlight.delete(t))}}}prune(t){for(let e of this.capturedInputs.keys())t.has(e)||this.capturedInputs.delete(e);for(let[e,r]of this.inFlight)t.has(e)||(this.cancelEntry(r),this.inFlight.delete(e))}get isCapturing(){return this.inFlight.size>0}abort(){for(let t of this.inFlight.values())this.cancelEntry(t);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},J=M(),S=5e3;function K(){let t=(0,J.c)(14),e=I(P),{state:r}=I(z),a=e.auto_download.includes("markdown"),i=e.auto_download.includes("html"),s=e.auto_download.includes("ipynb"),p=r===_.OPEN,m=!a||!p,d=!i||!p,c=!s||!p,{autoExportAsHTML:l,autoExportAsIPYNB:o,autoExportAsMarkdown:n,updateCellOutputs:u}=L(),h=O(),f;t[0]===n?f=t[1]:(f=async()=>{await n({download:!1})},t[0]=n,t[1]=f);let g;t[2]===m?g=t[3]:(g={delayMs:S,whenVisible:!0,disabled:m},t[2]=m,t[3]=g),x(f,g);let w;t[4]===l?w=t[5]:(w=async()=>{await l({download:!1,includeCode:!0,files:R.INSTANCE.filenames()})},t[4]=l,t[5]=w);let v;t[6]===d?v=t[7]:(v={delayMs:S,whenVisible:!0,disabled:d},t[6]=d,t[7]=v),x(w,v);let F;t[8]!==o||t[9]!==h||t[10]!==u?(F=async()=>{await j({takeScreenshots:()=>h({progress:H.indeterminate()}),updateCellOutputs:u}),await o({download:!1})},t[8]=o,t[9]=h,t[10]=u,t[11]=F):F=t[11];let y;t[12]===c?y=t[13]:(y={delayMs:S,whenVisible:!0,disabled:c,skipIfRunning:!0},t[12]=c,t[13]=y),x(F,y)}var Q=new Set(["text/html","application/vnd.vegalite.v5+json","application/vnd.vega.v5+json","application/vnd.vegalite.v6+json","application/vnd.vega.v6+json"]);const C=new G;function O(){let t=I(V);return async e=>{var d,c;let{progress:r}=e,a=new Set(E.keys(t));C.prune(a);let i=[],s=[];for(let[l,o]of E.entries(t)){let n=(d=o.output)==null?void 0:d.data;if((c=o.output)!=null&&c.mimetype&&Q.has(o.output.mimetype)&&n)if(C.needsCapture(l,n))i.push([l,n]);else{let u=C.waitForInFlight(l,n);u&&s.push({cellId:l,promise:u})}}if(i.length===0&&s.length===0)return{};i.length>0&&r.addTotal(i.length);let p={};for(let[l,o]of i){let n=C.startCapture(l,o);try{let u=await B(l);if(n.signal.aborted)continue;if(!u){k.error(`Failed to capture screenshot for cell ${l}`),n.markFailed();continue}let h=["image/png",u];p[l]=h,n.markCaptured(h)}catch(u){k.error(`Error screenshotting cell ${l}:`,u),n.markFailed()}finally{r.increment(1)}}let m=await Promise.allSettled(s.map(({promise:l})=>l));for(let[l,{cellId:o}]of s.entries()){let n=m[l];n.status==="fulfilled"&&n.value&&(p[o]=n.value)}return p}}async function j(t){let{takeScreenshots:e,updateCellOutputs:r}=t;try{let a=await e();E.size(a)>0&&await r({cellIdsToOutput:a})}catch(a){k.error("Error updating cell outputs with screenshots:",a),q({title:"Failed to capture cell outputs",description:"Some outputs may be missing from the export. Continuing.",variant:"danger"})}}var U=M(),W=T($(),1),X=t=>{let e=(0,U.c)(8),r,a;e[0]===t?(r=e[1],a=e[2]):({className:r,...a}=t,e[0]=t,e[1]=r,e[2]=a);let i;e[3]===r?i=e[4]:(i=D("animate-pulse rounded-md bg-muted",r),e[3]=r,e[4]=i);let s;return e[5]!==a||e[6]!==i?(s=(0,W.jsx)("div",{className:i,...a}),e[5]=a,e[6]=i,e[7]=s):s=e[7],s};export{O as i,j as n,K as r,X as t};
@@ -1 +1 @@
1
- import{o as I}from"./chunk-C4rtOYze.js";import"./useEvent-GCVIknuR.js";import{t as D}from"./react-C60yClUi.js";import{E as F}from"./cells-Biwqg0z6.js";import"./react-dom-Ba2zmJWD.js";import{t as $}from"./compiler-runtime-DnimoHo0.js";import{n as G}from"./useEventListener-DpNnLPuE.js";import{n as R}from"./constants-DifUxsbZ.js";import{t as T}from"./cn-DCUzRj2J.js";import{t as W}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import{t as A}from"./tooltip-C9LWGQ7Y.js";import{t as w}from"./button-W__YVea9.js";import{st as B}from"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{r as J}from"./requests-B9zEd_sW.js";import{n as E,t as K}from"./LazyAnyLanguageCodeMirror-Bx0i_n8B.js";import{t as L}from"./x-4y-nyVDU.js";import{t as U}from"./spinner-Cj3eM5bt.js";import{t as V}from"./plus-r1QITpsJ.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import{r as X}from"./useTheme-CwCyrmDf.js";import"./purify.es-Bwm8T4QC.js";import{t as Y}from"./RenderHTML-Cu5JtYZJ.js";import{a as Z,c as Q,i as ee,n as te,r as se}from"./dialog-WU4x2UpK.js";import{n as re}from"./ImperativeModal-Dxj31V4A.js";import{n as le}from"./error-banner-d0-XOKtd.js";import{o as oe}from"./focus-CeTtpVjV.js";import{n as ie}from"./useAsyncData-BcvSvTUt.js";import{n as ae,r as ne,t as M}from"./react-resizable-panels.browser.esm-CLaR27oP.js";import{a as me,f as ce,o as de,r as pe,t as fe}from"./command-D5LtSvbN.js";import{t as he}from"./empty-state-CBq3j1LH.js";import{n as xe,r as ue}from"./panel-context-CkhpgwrR.js";import{t as je}from"./readonly-code-display-N9tCXdCz.js";import{t as H}from"./kiosk-mode-CNguD0K4.js";var O=$(),C=I(D(),1),s=I(W(),1),be=G;const ve=t=>{let e=(0,O.c)(6),{children:r}=t,{openModal:i,closeModal:o}=re(),l;e[0]!==o||e[1]!==i?(l=()=>i((0,s.jsx)(Ne,{onClose:o})),e[0]=o,e[1]=i,e[2]=l):l=e[2];let a;return e[3]!==r||e[4]!==l?(a=(0,s.jsx)(be,{onClick:l,children:r}),e[3]=r,e[4]=l,e[5]=a):a=e[5],a};var Ne=t=>{let e=(0,O.c)(4),{onClose:r}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Q,{children:"Contribute a Snippet"}),e[0]=i):i=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.jsxs)(Z,{children:[i,(0,s.jsxs)(se,{children:["Have a useful snippet you want to share with the community? Make a pull request"," ",(0,s.jsx)("a",{href:R.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[1]=o):o=e[1];let l;return e[2]===r?l=e[3]:(l=(0,s.jsxs)(te,{className:"max-w-md",children:[o,(0,s.jsx)(ee,{children:(0,s.jsx)(w,{"data-testid":"snippet-close-button",variant:"default",onClick:r,children:"Close"})})]}),e[2]=r,e[3]=l),l},k=$(),_e=[B.lineWrapping],ge=()=>{let t=(0,k.c)(24),{readSnippets:e}=J(),[r,i]=C.useState(),o=xe(),l=ue(),a;t[0]===e?a=t[1]:(a=()=>e(),t[0]=e,t[1]=a);let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=[],t[2]=c):c=t[2];let{data:N,error:j,isPending:g}=ie(a,c);if(j){let m;return t[3]===j?m=t[4]:(m=(0,s.jsx)(le,{error:j}),t[3]=j,t[4]=m),m}if(g||!N){let m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(m=(0,s.jsx)(U,{size:"medium",centered:!0}),t[5]=m):m=t[5],m}let _=o==="vertical",b;t[6]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(me,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=b):b=t[6];let f,h;t[7]===Symbol.for("react.memo_cache_sentinel")?(f=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[b,(0,s.jsx)(ve,{children:(0,s.jsx)("button",{className:"float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:(0,s.jsx)(V,{className:"h-4 w-4"})})})]}),h=(0,s.jsx)(pe,{children:"No results"}),t[7]=f,t[8]=h):(f=t[7],h=t[8]);let v;t[9]===Symbol.for("react.memo_cache_sentinel")?(v=m=>i(m),t[9]=v):v=t[9];let d;t[10]===N.snippets?d=t[11]:(d=(0,s.jsx)(M,{defaultSize:40,minSize:20,maxSize:70,children:(0,s.jsxs)(fe,{className:"h-full rounded-none",children:[f,h,(0,s.jsx)(we,{onSelect:v,snippets:N.snippets})]})}),t[10]=N.snippets,t[11]=d);let u=_?"h-1":"w-1",p;t[12]===u?p=t[13]:(p=T("bg-border hover:bg-primary/50 transition-colors",u),t[12]=u,t[13]=p);let x;t[14]===p?x=t[15]:(x=(0,s.jsx)(ne,{className:p}),t[14]=p,t[15]=x);let n;t[16]===r?n=t[17]:(n=(0,s.jsx)(M,{defaultSize:60,minSize:20,children:(0,s.jsx)(C.Suspense,{children:(0,s.jsx)("div",{className:"h-full snippet-viewer flex flex-col overflow-hidden",children:r?(0,s.jsx)(Se,{snippet:r,onClose:()=>i(void 0)},r.title):(0,s.jsx)(he,{title:"",description:"Click on a snippet to view its content."})})})}),t[16]=r,t[17]=n);let S;return t[18]!==o||t[19]!==l||t[20]!==n||t[21]!==d||t[22]!==x?(S=(0,s.jsx)("div",{className:"flex-1 overflow-hidden h-full",children:(0,s.jsxs)(ae,{direction:o,className:"h-full",children:[d,x,n]},l)}),t[18]=o,t[19]=l,t[20]=n,t[21]=d,t[22]=x,t[23]=S):S=t[23],S},Se=t=>{let e=(0,k.c)(33),{snippet:r,onClose:i}=t,{theme:o}=X(),{createNewCell:l}=F(),a=oe(),c;e[0]!==l||e[1]!==a||e[2]!==r.sections?(c=()=>{for(let n of r.sections.toReversed())n.code&&l({code:n.code,before:!1,cellId:a??"__end__",skipIfCodeExists:!0})},e[0]=l,e[1]=a,e[2]=r.sections,e[3]=c):c=e[3];let N=c,j;e[4]!==l||e[5]!==a?(j=n=>{l({code:n,before:!1,cellId:a??"__end__"})},e[4]=l,e[5]=a,e[6]=j):j=e[6];let g=j,_;e[7]===r.title?_=e[8]:(_=(0,s.jsx)("span",{children:r.title}),e[7]=r.title,e[8]=_);let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(L,{className:"h-4 w-4"}),e[9]=b):b=e[9];let f;e[10]===i?f=e[11]:(f=(0,s.jsx)(w,{size:"sm",variant:"ghost",onClick:i,className:"h-6 w-6 p-0 hover:bg-muted-foreground/10",children:b}),e[10]=i,e[11]=f);let h;e[12]!==_||e[13]!==f?(h=(0,s.jsxs)("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center",children:[_,f]}),e[12]=_,e[13]=f,e[14]=h):h=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsx)(E,{className:"ml-2 h-4 w-4"}),e[15]=v):v=e[15];let d;e[16]===N?d=e[17]:(d=(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)(H,{children:(0,s.jsxs)(w,{className:"float-right",size:"xs",variant:"outline",onClick:N,children:["Insert snippet",v]})})}),e[16]=N,e[17]=d);let u;if(e[18]!==g||e[19]!==r.sections||e[20]!==r.title||e[21]!==o){let n;e[23]!==g||e[24]!==r.title||e[25]!==o?(n=S=>{let{code:m,html:z,id:y}=S;if(z)return(0,s.jsx)("div",{children:Y({html:z})},`${r.title}-${y}`);if(!m)return null;let{language:P,code:q}=je(m);return(0,s.jsxs)("div",{className:"relative hover-actions-parent pr-2",children:[(0,s.jsx)(H,{children:(0,s.jsx)(A,{content:"Insert snippet",children:(0,s.jsx)(w,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{g(m)},children:(0,s.jsx)(E,{className:"h-5 w-5"})})})}),(0,s.jsx)(C.Suspense,{children:(0,s.jsx)(K,{theme:o==="dark"?"dark":"light",language:P,className:"cm border rounded overflow-hidden",extensions:_e,value:q,readOnly:!0},`${r.title}-${y}`)})]},`${r.title}-${y}`)},e[23]=g,e[24]=r.title,e[25]=o,e[26]=n):n=e[26],u=r.sections.map(n),e[18]=g,e[19]=r.sections,e[20]=r.title,e[21]=o,e[22]=u}else u=e[22];let p;e[27]!==d||e[28]!==u?(p=(0,s.jsxs)("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[d,u]}),e[27]=d,e[28]=u,e[29]=p):p=e[29];let x;return e[30]!==p||e[31]!==h?(x=(0,s.jsxs)(s.Fragment,{children:[h,p]}),e[30]=p,e[31]=h,e[32]=x):x=e[32],x},we=t=>{let e=(0,k.c)(7),{snippets:r,onSelect:i}=t,o;if(e[0]!==i||e[1]!==r){let a;e[3]===i?a=e[4]:(a=c=>(0,s.jsx)(de,{className:"rounded-none",onSelect:()=>i(c),children:(0,s.jsx)("div",{className:"flex flex-row gap-2 items-center",children:(0,s.jsx)("span",{className:"mt-1 text-accent-foreground",children:c.title})})},c.title),e[3]=i,e[4]=a),o=r.map(a),e[0]=i,e[1]=r,e[2]=o}else o=e[2];let l;return e[5]===o?l=e[6]:(l=(0,s.jsx)(ce,{className:"flex flex-col overflow-auto",children:o}),e[5]=o,e[6]=l),l};export{ge as default};
1
+ import{o as I}from"./chunk-C4rtOYze.js";import"./useEvent-GCVIknuR.js";import{t as D}from"./react-C60yClUi.js";import{E as F}from"./cells-BIt-E5vq.js";import"./react-dom-Ba2zmJWD.js";import{t as $}from"./compiler-runtime-DnimoHo0.js";import{n as G}from"./useEventListener-DpNnLPuE.js";import{n as R}from"./constants-DifUxsbZ.js";import{t as T}from"./cn-DCUzRj2J.js";import{t as W}from"./jsx-runtime-3wZU7vFS.js";import"./fullscreen-CrevbcR_.js";import{t as A}from"./tooltip-C9LWGQ7Y.js";import{t as w}from"./button-W__YVea9.js";import{st as B}from"./dist-CeF1Em5L.js";import"./cjs-DCKmcMBz.js";import"./useNonce-C2dwX-sI.js";import{r as J}from"./requests-B9zEd_sW.js";import{n as E,t as K}from"./LazyAnyLanguageCodeMirror-Bx0i_n8B.js";import{t as L}from"./x-4y-nyVDU.js";import{t as U}from"./spinner-Cj3eM5bt.js";import{t as V}from"./plus-r1QITpsJ.js";import"./dist-BPoMypmC.js";import"./dist-5bwTcyKs.js";import"./dist-BVNaV53g.js";import"./dist-BrqkjqDe.js";import"./dist-Bm9PT5P9.js";import"./session-D-SddyN0.js";import{r as X}from"./useTheme-CwCyrmDf.js";import"./purify.es-Bwm8T4QC.js";import{t as Y}from"./RenderHTML-DsxkHR2d.js";import{a as Z,c as Q,i as ee,n as te,r as se}from"./dialog-WU4x2UpK.js";import{n as re}from"./ImperativeModal-Dxj31V4A.js";import{n as le}from"./error-banner-d0-XOKtd.js";import{o as oe}from"./focus-agtnrA0w.js";import{n as ie}from"./useAsyncData-BcvSvTUt.js";import{n as ae,r as ne,t as M}from"./react-resizable-panels.browser.esm-CLaR27oP.js";import{a as me,f as ce,o as de,r as pe,t as fe}from"./command-D5LtSvbN.js";import{t as he}from"./empty-state-CBq3j1LH.js";import{n as xe,r as ue}from"./panel-context-CkhpgwrR.js";import{t as je}from"./readonly-code-display-evFzJqo3.js";import{t as H}from"./kiosk-mode-CNguD0K4.js";var O=$(),C=I(D(),1),s=I(W(),1),be=G;const ve=t=>{let e=(0,O.c)(6),{children:r}=t,{openModal:i,closeModal:o}=re(),l;e[0]!==o||e[1]!==i?(l=()=>i((0,s.jsx)(Ne,{onClose:o})),e[0]=o,e[1]=i,e[2]=l):l=e[2];let a;return e[3]!==r||e[4]!==l?(a=(0,s.jsx)(be,{onClick:l,children:r}),e[3]=r,e[4]=l,e[5]=a):a=e[5],a};var Ne=t=>{let e=(0,O.c)(4),{onClose:r}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,s.jsx)(Q,{children:"Contribute a Snippet"}),e[0]=i):i=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,s.jsxs)(Z,{children:[i,(0,s.jsxs)(se,{children:["Have a useful snippet you want to share with the community? Make a pull request"," ",(0,s.jsx)("a",{href:R.githubPage,target:"_blank",className:"underline",children:"on GitHub"}),"."]})]}),e[1]=o):o=e[1];let l;return e[2]===r?l=e[3]:(l=(0,s.jsxs)(te,{className:"max-w-md",children:[o,(0,s.jsx)(ee,{children:(0,s.jsx)(w,{"data-testid":"snippet-close-button",variant:"default",onClick:r,children:"Close"})})]}),e[2]=r,e[3]=l),l},k=$(),_e=[B.lineWrapping],ge=()=>{let t=(0,k.c)(24),{readSnippets:e}=J(),[r,i]=C.useState(),o=xe(),l=ue(),a;t[0]===e?a=t[1]:(a=()=>e(),t[0]=e,t[1]=a);let c;t[2]===Symbol.for("react.memo_cache_sentinel")?(c=[],t[2]=c):c=t[2];let{data:N,error:j,isPending:g}=ie(a,c);if(j){let m;return t[3]===j?m=t[4]:(m=(0,s.jsx)(le,{error:j}),t[3]=j,t[4]=m),m}if(g||!N){let m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(m=(0,s.jsx)(U,{size:"medium",centered:!0}),t[5]=m):m=t[5],m}let _=o==="vertical",b;t[6]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(me,{placeholder:"Search snippets...",className:"h-6 m-1",rootClassName:"flex-1 border-r"}),t[6]=b):b=t[6];let f,h;t[7]===Symbol.for("react.memo_cache_sentinel")?(f=(0,s.jsxs)("div",{className:"flex items-center w-full border-b",children:[b,(0,s.jsx)(ve,{children:(0,s.jsx)("button",{className:"float-right px-2 m-0 h-full hover:bg-accent hover:text-accent-foreground",children:(0,s.jsx)(V,{className:"h-4 w-4"})})})]}),h=(0,s.jsx)(pe,{children:"No results"}),t[7]=f,t[8]=h):(f=t[7],h=t[8]);let v;t[9]===Symbol.for("react.memo_cache_sentinel")?(v=m=>i(m),t[9]=v):v=t[9];let d;t[10]===N.snippets?d=t[11]:(d=(0,s.jsx)(M,{defaultSize:40,minSize:20,maxSize:70,children:(0,s.jsxs)(fe,{className:"h-full rounded-none",children:[f,h,(0,s.jsx)(we,{onSelect:v,snippets:N.snippets})]})}),t[10]=N.snippets,t[11]=d);let u=_?"h-1":"w-1",p;t[12]===u?p=t[13]:(p=T("bg-border hover:bg-primary/50 transition-colors",u),t[12]=u,t[13]=p);let x;t[14]===p?x=t[15]:(x=(0,s.jsx)(ne,{className:p}),t[14]=p,t[15]=x);let n;t[16]===r?n=t[17]:(n=(0,s.jsx)(M,{defaultSize:60,minSize:20,children:(0,s.jsx)(C.Suspense,{children:(0,s.jsx)("div",{className:"h-full snippet-viewer flex flex-col overflow-hidden",children:r?(0,s.jsx)(Se,{snippet:r,onClose:()=>i(void 0)},r.title):(0,s.jsx)(he,{title:"",description:"Click on a snippet to view its content."})})})}),t[16]=r,t[17]=n);let S;return t[18]!==o||t[19]!==l||t[20]!==n||t[21]!==d||t[22]!==x?(S=(0,s.jsx)("div",{className:"flex-1 overflow-hidden h-full",children:(0,s.jsxs)(ae,{direction:o,className:"h-full",children:[d,x,n]},l)}),t[18]=o,t[19]=l,t[20]=n,t[21]=d,t[22]=x,t[23]=S):S=t[23],S},Se=t=>{let e=(0,k.c)(33),{snippet:r,onClose:i}=t,{theme:o}=X(),{createNewCell:l}=F(),a=oe(),c;e[0]!==l||e[1]!==a||e[2]!==r.sections?(c=()=>{for(let n of r.sections.toReversed())n.code&&l({code:n.code,before:!1,cellId:a??"__end__",skipIfCodeExists:!0})},e[0]=l,e[1]=a,e[2]=r.sections,e[3]=c):c=e[3];let N=c,j;e[4]!==l||e[5]!==a?(j=n=>{l({code:n,before:!1,cellId:a??"__end__"})},e[4]=l,e[5]=a,e[6]=j):j=e[6];let g=j,_;e[7]===r.title?_=e[8]:(_=(0,s.jsx)("span",{children:r.title}),e[7]=r.title,e[8]=_);let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=(0,s.jsx)(L,{className:"h-4 w-4"}),e[9]=b):b=e[9];let f;e[10]===i?f=e[11]:(f=(0,s.jsx)(w,{size:"sm",variant:"ghost",onClick:i,className:"h-6 w-6 p-0 hover:bg-muted-foreground/10",children:b}),e[10]=i,e[11]=f);let h;e[12]!==_||e[13]!==f?(h=(0,s.jsxs)("div",{className:"text-sm font-semibold bg-muted border-y px-2 py-1 flex justify-between items-center",children:[_,f]}),e[12]=_,e[13]=f,e[14]=h):h=e[14];let v;e[15]===Symbol.for("react.memo_cache_sentinel")?(v=(0,s.jsx)(E,{className:"ml-2 h-4 w-4"}),e[15]=v):v=e[15];let d;e[16]===N?d=e[17]:(d=(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)(H,{children:(0,s.jsxs)(w,{className:"float-right",size:"xs",variant:"outline",onClick:N,children:["Insert snippet",v]})})}),e[16]=N,e[17]=d);let u;if(e[18]!==g||e[19]!==r.sections||e[20]!==r.title||e[21]!==o){let n;e[23]!==g||e[24]!==r.title||e[25]!==o?(n=S=>{let{code:m,html:z,id:y}=S;if(z)return(0,s.jsx)("div",{children:Y({html:z})},`${r.title}-${y}`);if(!m)return null;let{language:P,code:q}=je(m);return(0,s.jsxs)("div",{className:"relative hover-actions-parent pr-2",children:[(0,s.jsx)(H,{children:(0,s.jsx)(A,{content:"Insert snippet",children:(0,s.jsx)(w,{className:"absolute -top-2 -right-1 z-10 hover-action px-2 bg-background",size:"sm",variant:"outline",onClick:()=>{g(m)},children:(0,s.jsx)(E,{className:"h-5 w-5"})})})}),(0,s.jsx)(C.Suspense,{children:(0,s.jsx)(K,{theme:o==="dark"?"dark":"light",language:P,className:"cm border rounded overflow-hidden",extensions:_e,value:q,readOnly:!0},`${r.title}-${y}`)})]},`${r.title}-${y}`)},e[23]=g,e[24]=r.title,e[25]=o,e[26]=n):n=e[26],u=r.sections.map(n),e[18]=g,e[19]=r.sections,e[20]=r.title,e[21]=o,e[22]=u}else u=e[22];let p;e[27]!==d||e[28]!==u?(p=(0,s.jsxs)("div",{className:"px-2 py-2 space-y-4 overflow-auto flex-1",children:[d,u]}),e[27]=d,e[28]=u,e[29]=p):p=e[29];let x;return e[30]!==p||e[31]!==h?(x=(0,s.jsxs)(s.Fragment,{children:[h,p]}),e[30]=p,e[31]=h,e[32]=x):x=e[32],x},we=t=>{let e=(0,k.c)(7),{snippets:r,onSelect:i}=t,o;if(e[0]!==i||e[1]!==r){let a;e[3]===i?a=e[4]:(a=c=>(0,s.jsx)(de,{className:"rounded-none",onSelect:()=>i(c),children:(0,s.jsx)("div",{className:"flex flex-row gap-2 items-center",children:(0,s.jsx)("span",{className:"mt-1 text-accent-foreground",children:c.title})})},c.title),e[3]=i,e[4]=a),o=r.map(a),e[0]=i,e[1]=r,e[2]=o}else o=e[2];let l;return e[5]===o?l=e[6]:(l=(0,s.jsx)(ce,{className:"flex flex-col overflow-auto",children:o}),e[5]=o,e[6]=l),l};export{ge as default};
@@ -1 +1 @@
1
- import{p as i}from"./useEvent-GCVIknuR.js";import{Gn as h,Kn as c,aa as r}from"./cells-Biwqg0z6.js";import{d as m}from"./arrays-UzzAzxsG.js";var d="marimo:ai:chatState:v5";const u=i(null),v=i(null),f=r("marimo:ai:chatOptions",{webSearch:!1},c),p=r("marimo:ai:includeOtherCells",!0,c);function C(a){let t=new Map;for(let[s,e]of a.entries()){if(e.messages.length===0)continue;let l=m(e.messages,o=>o.id);t.set(s,{...e,messages:l})}return t}const n=r(d,{chats:new Map,activeChatId:null},h({toSerializable:a=>({chats:[...C(a.chats).entries()],activeChatId:a.activeChatId}),fromSerializable:a=>({chats:new Map(a.chats),activeChatId:a.activeChatId})})),I=i(a=>{let t=a(n);return t.activeChatId?t.chats.get(t.activeChatId):null},(a,t,s)=>{t(n,e=>({...e,activeChatId:s}))});export{p as a,n as i,u as n,v as o,f as r,I as t};
1
+ import{p as i}from"./useEvent-GCVIknuR.js";import{Gn as h,Kn as c,aa as r}from"./cells-BIt-E5vq.js";import{d as m}from"./arrays-UzzAzxsG.js";var d="marimo:ai:chatState:v5";const u=i(null),v=i(null),f=r("marimo:ai:chatOptions",{webSearch:!1},c),p=r("marimo:ai:includeOtherCells",!0,c);function C(a){let t=new Map;for(let[s,e]of a.entries()){if(e.messages.length===0)continue;let l=m(e.messages,o=>o.id);t.set(s,{...e,messages:l})}return t}const n=r(d,{chats:new Map,activeChatId:null},h({toSerializable:a=>({chats:[...C(a.chats).entries()],activeChatId:a.activeChatId}),fromSerializable:a=>({chats:new Map(a.chats),activeChatId:a.activeChatId})})),I=i(a=>{let t=a(n);return t.activeChatId?t.chats.get(t.activeChatId):null},(a,t,s)=>{t(n,e=>({...e,activeChatId:s}))});export{p as a,n as i,u as n,v as o,f as r,I as t};