@marimo-team/frontend 0.25.3-dev134 → 0.25.3-dev135

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 (82) hide show
  1. package/dist/assets/{CellStatus-DC6FFQOg.js → CellStatus-Bu_cFOaf.js} +1 -1
  2. package/dist/assets/{ErrorBoundary-Ce-Ujlwj.js → ErrorBoundary-Cy4lxM4U.js} +2 -2
  3. package/dist/assets/{JsonOutput-CfEBzaqW.js → JsonOutput-Dnd0uzN4.js} +5 -5
  4. package/dist/assets/{MarimoErrorOutput-Bh6o9zle.js → MarimoErrorOutput-DWgmERpO.js} +4 -4
  5. package/dist/assets/{RenderHTML-COGZsXQV.js → RenderHTML-BuZ8DdVv.js} +2 -2
  6. package/dist/assets/{RunButton-DQ51plUv.js → RunButton-BXXDV5w-.js} +1 -1
  7. package/dist/assets/{add-cell-with-ai-D7gtGUsg.js → add-cell-with-ai-DYahRMb_.js} +26 -26
  8. package/dist/assets/{add-connection-dialog-CpMCc97S.js → add-connection-dialog-CjRaQbDW.js} +51 -51
  9. package/dist/assets/{agent-panel-BSFYqJ9B.js → agent-panel-Cb9PZdDM.js} +3 -3
  10. package/dist/assets/ai-model-dropdown-Bbr2oylS.js +13 -0
  11. package/dist/assets/{app-config-button-Cfcg_5Bz.js → app-config-button-CPNc_---.js} +1 -1
  12. package/dist/assets/{blob-CszMu60N.js → blob-CQAkRxR1.js} +1 -1
  13. package/dist/assets/cell-editor-CjvWSYDB.js +42 -0
  14. package/dist/assets/{cell-link-Cj0gGaMV.js → cell-link-DIOanEQB.js} +1 -1
  15. package/dist/assets/{cells-SvbLY10y.js → cells-lwP9-xsQ.js} +41 -41
  16. package/dist/assets/{chat-display-D43_g3TX.js → chat-display-DpCQoui-.js} +1 -1
  17. package/dist/assets/{chat-panel-B_HAJMwx.js → chat-panel-C79_pWxF.js} +2 -2
  18. package/dist/assets/{chat-ui-BEcYCphu.js → chat-ui-DOOiaOcb.js} +1 -1
  19. package/dist/assets/{column-preview-CrzaJKk8.js → column-preview-DIvrCqra.js} +1 -1
  20. package/dist/assets/{command-palette-Bm9yIVcD.js → command-palette-BYgBVslq.js} +1 -1
  21. package/dist/assets/{common-BJyUxCzv.js → common-B7U2CeDc.js} +1 -1
  22. package/dist/assets/{components-D1f_Cz4i.js → components-Vz1pD133.js} +1 -1
  23. package/dist/assets/{datasource-C8KSVfSD.js → datasource-Bp8TnG7a.js} +2 -2
  24. package/dist/assets/{dependency-graph-panel-BhmyJbUl.js → dependency-graph-panel-B31-YcSF.js} +3 -3
  25. package/dist/assets/{documentation-panel-DcVG0Q0d.js → documentation-panel-C2MJwSef.js} +1 -1
  26. package/dist/assets/{download-Bx52VRE4.js → download-J6sWXUJR.js} +1 -1
  27. package/dist/assets/{edit-page-DUrwOHR-.js → edit-page-DfxHDnWP.js} +6 -6
  28. package/dist/assets/{error-entries-11OuHzUF.js → error-entries-BcRbOxwK.js} +1 -1
  29. package/dist/assets/{error-panel-XJy5S25F.js → error-panel-jZlFCjdy.js} +1 -1
  30. package/dist/assets/feedback-button-94vZrmBy.js +1 -0
  31. package/dist/assets/{feedback-button-B7jh_B4w.js → feedback-button-C2XmZw_y.js} +2 -2
  32. package/dist/assets/{file-explorer-panel-CnVxbF4A.js → file-explorer-panel-Cg9UovsS.js} +1 -1
  33. package/dist/assets/{file-name-input-BJuqjQqH.js → file-name-input-y9ggAMGJ.js} +1 -1
  34. package/dist/assets/{floating-outline-8yyZ-MOJ.js → floating-outline-CE1olGl0.js} +1 -1
  35. package/dist/assets/{gallery-page-DJvGHePf.js → gallery-page-ClEnoAT-.js} +1 -1
  36. package/dist/assets/{glide-data-editor-Cyc8DHZx.js → glide-data-editor-Cp0q28Zz.js} +1 -1
  37. package/dist/assets/{home-page-tRZJmSU6.js → home-page-DJsI6Od_.js} +1 -1
  38. package/dist/assets/{hooks-CxGwybGw.js → hooks-DGSryuSD.js} +1 -1
  39. package/dist/assets/{index-CoxbqhGH.js → index-BjNf54kO.js} +7 -7
  40. package/dist/assets/{layout-DvXJxBiL.js → layout-DRVIFud8.js} +5 -5
  41. package/dist/assets/{logs-panel-KtsY7TrR.js → logs-panel-Db38azhc.js} +1 -1
  42. package/dist/assets/{markdown-renderer-DUgV7_fm.js → markdown-renderer-D2td9eFc.js} +1 -1
  43. package/dist/assets/{name-cell-input-C3-Cj-Ek.js → name-cell-input-CJpi0Kvu.js} +1 -1
  44. package/dist/assets/{outline-panel-BzyY4JA6.js → outline-panel-DxQKP4eN.js} +1 -1
  45. package/dist/assets/{packages-panel-DxosbWko.js → packages-panel-BFzN4mNb.js} +1 -1
  46. package/dist/assets/{panel-accordion-state-BRbTib2B.js → panel-accordion-state-D3RiRniG.js} +1 -1
  47. package/dist/assets/panels-CpUpLOy4.js +1 -0
  48. package/dist/assets/{process-output-CSwx7rvo.js → process-output-B6v1FE29.js} +1 -1
  49. package/dist/assets/{readonly-code-display-B9y9423Y.js → readonly-code-display-Deg2hzFh.js} +1 -1
  50. package/dist/assets/{readonly-python-code-Dgw6trlk.js → readonly-python-code-DPGknu49.js} +1 -1
  51. package/dist/assets/{reveal-component-B9A4wkG-.js → reveal-component-CXkDpGxy.js} +2 -2
  52. package/dist/assets/{run-page-C1MQ5b_A.js → run-page-qp2KKYgs.js} +1 -1
  53. package/dist/assets/{runtime-details-state-D_hOQL9T.js → runtime-details-state-BiGF299n.js} +1 -1
  54. package/dist/assets/{scratchpad-panel-CBCsPmMW.js → scratchpad-panel-QV0lacAe.js} +1 -1
  55. package/dist/assets/session-panel-CrWluawa.js +1 -0
  56. package/dist/assets/{snippets-panel-C0VDE_4i.js → snippets-panel-CM7g9b6c.js} +1 -1
  57. package/dist/assets/{state-DrraMmqz.js → state-DhMztz1E.js} +1 -1
  58. package/dist/assets/{state-DvU2AiFx.js → state-lEPoZS4k.js} +4 -4
  59. package/dist/assets/{tracing-C5d51Nmi.js → tracing-DRA8maZB.js} +1 -1
  60. package/dist/assets/{tracing-panel-B89R8dWE.js → tracing-panel-DLxPRadV.js} +2 -2
  61. package/dist/assets/{tree-actions-Cph8FVzh.js → tree-actions-COtU5qy_.js} +1 -1
  62. package/dist/assets/{useAddCell-VPkB72pn.js → useAddCell-BAEOA87M.js} +1 -1
  63. package/dist/assets/{useCellActionButton--zI3GFnt.js → useCellActionButton-BobjsJfu.js} +1 -1
  64. package/dist/assets/{useDeleteCell-CjewKeSr.js → useDeleteCell-gedazkBF.js} +1 -1
  65. package/dist/assets/{useDependencyPanelTab-Bt_ka-wl.js → useDependencyPanelTab-DAJ6BOUm.js} +1 -1
  66. package/dist/assets/useNotebookActions-CnLArLoz.js +1 -0
  67. package/dist/assets/{useRunCells-BupCZpzk.js → useRunCells-CUknep7p.js} +1 -1
  68. package/dist/assets/{useSplitCell-CaLIR0TS.js → useSplitCell-DeXniINv.js} +1 -1
  69. package/dist/index.html +20 -20
  70. package/package.json +1 -1
  71. package/src/components/datasources/__tests__/column-preview.test.tsx +35 -3
  72. package/src/components/datasources/__tests__/datasources-interactions.test.tsx +181 -0
  73. package/src/components/datasources/__tests__/utils.test.ts +57 -6
  74. package/src/components/datasources/column-preview.tsx +5 -2
  75. package/src/components/datasources/datasources.tsx +3 -4
  76. package/src/components/datasources/utils.ts +32 -23
  77. package/dist/assets/ai-model-dropdown-D575Vid8.js +0 -13
  78. package/dist/assets/cell-editor-BLpOlLnM.js +0 -42
  79. package/dist/assets/feedback-button-C-eKtxXE.js +0 -1
  80. package/dist/assets/panels-Da3071Q4.js +0 -1
  81. package/dist/assets/session-panel-CiHCKPlx.js +0 -1
  82. package/dist/assets/useNotebookActions-DV2S6KaG.js +0 -1
@@ -6,8 +6,8 @@ import{a as e,i as t,n,r,t as i}from"./rolldown-runtime-B0Z9INg1.js";import{c as
6
6
  `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
7
7
  `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ee=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Te(n):``}function Oe(e,t){switch(e.tag){case 26:case 27:case 5:return Te(e.type);case 16:return Te(`Lazy`);case 13:return e.child!==t&&t!==null?Te(`Suspense Fallback`):Te(`Suspense`);case 19:return Te(`SuspenseList`);case 0:case 15:return De(e.type,!1);case 11:return De(e.type.render,!1);case 1:return De(e.type,!0);case 31:return Te(`Activity`);case 30:return Te(`ViewTransition`);default:return``}}function ke(e){try{var t=``,n=null;do t+=Oe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
8
  Error generating stack: `+e.message+`
9
- `+e.stack}}var Ae=Object.prototype.hasOwnProperty,je=t.unstable_scheduleCallback,Me=t.unstable_cancelCallback,Ne=t.unstable_shouldYield,Pe=t.unstable_requestPaint,Fe=t.unstable_now,Ie=t.unstable_getCurrentPriorityLevel,Le=t.unstable_ImmediatePriority,Re=t.unstable_UserBlockingPriority,ze=t.unstable_NormalPriority,Be=t.unstable_LowPriority,Ve=t.unstable_IdlePriority,He=t.log,Ue=t.unstable_setDisableYieldValue,We=null,Ge=null;function Ke(e){if(typeof He==`function`&&Ue(e),Ge&&typeof Ge.setStrictMode==`function`)try{Ge.setStrictMode(We,e)}catch{}}var qe=Math.clz32?Math.clz32:Xe,Je=Math.log,Ye=Math.LN2;function Xe(e){return e>>>=0,e===0?32:31-(Je(e)/Ye|0)|0}var Ze=256,Qe=262144,$e=4194304;function et(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function tt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=et(n))):i=et(o):i=et(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=et(n))):i=et(o)):i=et(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function nt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function rt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-qe(n),i=1<<r;t|=e[r],n&=~i}return t}function it(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function at(){var e=$e;return $e<<=1,!($e&62914560)&&($e=4194304),e}function ot(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function st(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ct(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-qe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&lt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function lt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-qe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ut(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-qe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function dt(e,t){var n=t&-t;return n=n&42?1:ft(n),(n&(e.suspendedLanes|t))===0?n:0}function ft(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function pt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function mt(){var e=B.p;return e===0?(e=window.event,e===void 0?32:Th(e.type)):e}function ht(e,t){var n=B.p;try{return B.p=e,t()}finally{B.p=n}}var gt=Math.random().toString(36).slice(2),_t=`__reactFiber$`+gt,vt=`__reactProps$`+gt,yt=`__reactContainer$`+gt,bt=`__reactEvents$`+gt,xt=`__reactListeners$`+gt,St=`__reactHandles$`+gt,Ct=`__reactResources$`+gt,wt=`__reactMarker$`+gt,Tt=`__reactLoad$`+gt;function Et(e){delete e[_t],delete e[vt],delete e[xt],delete e[St]}function Dt(e){var t;if(t=e[_t])return t;for(var n=e.parentNode;n;){if(t=n[yt]||n[_t]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=mm(e);e!==null;){if(n=e[_t])return n;e=mm(e)}return t}e=n,n=e.parentNode}return null}function Ot(e){if(e=e[_t]||e[yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function U(e){var t=e[Ct];return t||=e[Ct]={hoistableStyles:new Map,hoistableScripts:new Map},t}function At(e){e[wt]=!0}function jt(e){e[Tt]=void 0}var Mt=new Set,Nt={};function Pt(e,t){Ft(e,t),Ft(e+`Capture`,t)}function Ft(e,t){for(Nt[e]=t,e=0;e<t.length;e++)Mt.add(t[e])}var It=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Lt={},Rt={};function zt(e){return Ae.call(Rt,e)?!0:Ae.call(Lt,e)?!1:It.test(e)?Rt[e]=!0:(Lt[e]=!0,!1)}var Bt=!1;function Vt(){var e=Bt;return Bt=!1,e}function Ht(e,t,n){if(zt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Ut(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Wt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function Gt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Kt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function qt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Jt(e){if(!e._valueTracker){var t=Kt(e)?`checked`:`value`;e._valueTracker=qt(e,t,``+e[t])}}function Yt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Kt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Xt=/[\n"\\]/g;function Zt(e){return e.replace(Xt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Qt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Gt(t)):e.value!==``+Gt(t)&&(e.value=``+Gt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):en(e,Gt(n)):o===`number`&&e.value==t?en(e,Gt(e.value)):en(e,Gt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Gt(s):e.removeAttribute(`name`)}function $t(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Jt(e);return}n=n==null?``:``+Gt(n),t=t==null?n:``+Gt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Jt(e)}function en(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function tn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Gt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function nn(e,t,n){if(t!=null&&(t=``+Gt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Gt(n)}function rn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ue(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Gt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Jt(e)}function an(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var on=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function sn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||on.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function W(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,Bt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(sn(e,a,r),Bt=!0)}else for(var o in t)t.hasOwnProperty(o)&&sn(e,o,t[o])}function cn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var ln=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),un=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function dn(e){return un.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function fn(){}var pn=null;function mn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hn=null,gn=null;function _n(e){var t=Ot(e);if(t&&(e=t.stateNode)){var n=e[vt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Qt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Zt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[vt]||null;if(!a)throw Error(i(90));Qt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Yt(r)}break a;case`textarea`:nn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&tn(e,!!n.multiple,t,!1)}}}var vn=!1;function yn(e,t,n){if(vn)return e(t,n);vn=!0;try{return e(t)}finally{if(vn=!1,(hn!==null||gn!==null)&&(Bd(),hn&&(t=hn,e=gn,gn=hn=null,_n(t),e)))for(t=0;t<e.length;t++)_n(e[t])}}function bn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[vt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var xn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),Sn=!1;if(xn)try{var Cn={};Object.defineProperty(Cn,"passive",{get:function(){Sn=!0}}),window.addEventListener(`test`,Cn,Cn),window.removeEventListener(`test`,Cn,Cn)}catch{Sn=!1}var wn=null,Tn=null,En=null;function Dn(){if(En)return En;var e,t=Tn,n=t.length,r,i=`value`in wn?wn.value:wn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return En=i.slice(e,1<r?1-r:void 0)}function On(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function kn(){return!0}function An(){return!1}function jn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?kn:An,this.isPropagationStopped=An,this}return E(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=kn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=kn)},persist:function(){},isPersistent:kn}),t}var Mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nn=jn(Mn),Pn=E({},Mn,{view:0,detail:0}),Fn=jn(Pn),In,Ln,Rn,zn=E({},Pn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Rn&&(Rn&&e.type===`mousemove`?(In=e.screenX-Rn.screenX,Ln=e.screenY-Rn.screenY):Ln=In=0,Rn=e),In)},movementY:function(e){return`movementY`in e?e.movementY:Ln}}),Bn=jn(zn),Vn=jn(E({},zn,{dataTransfer:0})),Hn=jn(E({},Pn,{relatedTarget:0})),G=jn(E({},Mn,{animationName:0,elapsedTime:0,pseudoElement:0})),Un=jn(E({},Mn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Wn=jn(E({},Mn,{data:0})),Gn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Kn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},qn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=qn[e])?!!t[e]:!1}function Yn(){return Jn}var Xn=jn(E({},Pn,{key:function(e){if(e.key){var t=Gn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=On(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yn,charCode:function(e){return e.type===`keypress`?On(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?On(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Zn=jn(E({},zn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Qn=jn(E({},Mn,{submitter:0})),$n=jn(E({},Pn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yn})),er=jn(E({},Mn,{propertyName:0,elapsedTime:0,pseudoElement:0})),tr=jn(E({},zn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),nr=jn(E({},Mn,{newState:0,oldState:0,source:0})),rr=[9,13,27,32],ir=xn&&`CompositionEvent`in window,ar=null;xn&&`documentMode`in document&&(ar=document.documentMode);var or=xn&&`TextEvent`in window&&!ar,sr=xn&&(!ir||ar&&8<ar&&11>=ar),cr=` `,lr=!1;function ur(e,t){switch(e){case`keyup`:return rr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function dr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var fr=!1;function pr(e,t){switch(e){case`compositionend`:return dr(t);case`keypress`:return t.which===32?(lr=!0,cr):null;case`textInput`:return e=t.data,e===cr&&lr?null:e;default:return null}}function mr(e,t){if(fr)return e===`compositionend`||!ir&&ur(e,t)?(e=Dn(),En=Tn=wn=null,fr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return sr&&t.locale!==`ko`?null:t.data;default:return null}}var hr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function gr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!hr[e.type]:t===`textarea`}function _r(e,t,n,r){hn?gn?gn.push(r):gn=[r]:hn=r,t=Zf(t,`onChange`),0<t.length&&(n=new Nn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var vr=null,yr=null;function br(e){Uf(e,0)}function xr(e){if(Yt(kt(e)))return e}function Sr(e,t){if(e===`change`)return t}var Cr=!1;if(xn){var wr;if(xn){var Tr=`oninput`in document;if(!Tr){var Er=document.createElement(`div`);Er.setAttribute(`oninput`,`return;`),Tr=typeof Er.oninput==`function`}wr=Tr}else wr=!1;Cr=wr&&(!document.documentMode||9<document.documentMode)}function Dr(){vr&&(vr.detachEvent(`onpropertychange`,Or),yr=vr=null)}function Or(e){if(e.propertyName===`value`&&xr(yr)){var t=[];_r(t,yr,e,mn(e)),yn(br,t)}}function kr(e,t,n){e===`focusin`?(Dr(),vr=t,yr=n,vr.attachEvent(`onpropertychange`,Or)):e===`focusout`&&Dr()}function Ar(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return xr(yr)}function jr(e,t){if(e===`click`)return xr(t)}function Mr(e,t){if(e===`input`||e===`change`)return xr(t)}function Nr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Pr=typeof Object.is==`function`?Object.is:Nr;function Fr(e,t){if(Pr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Ae.call(t,i)||!Pr(e[i],t[i]))return!1}return!0}function Ir(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Lr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Rr(e,t){var n=Lr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Lr(n)}}function zr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?zr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ir(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ir(e.document)}return t}function Vr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Hr=xn&&`documentMode`in document&&11>=document.documentMode,Ur=null,Wr=null,Gr=null,Kr=!1;function qr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Kr||Ur==null||Ur!==Ir(r)||(r=Ur,`selectionStart`in r&&Vr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Gr&&Fr(Gr,r)||(Gr=r,r=Zf(Wr,`onSelect`),0<r.length&&(t=new Nn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ur)))}function Jr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Yr={animationend:Jr(`Animation`,`AnimationEnd`),animationiteration:Jr(`Animation`,`AnimationIteration`),animationstart:Jr(`Animation`,`AnimationStart`),transitionrun:Jr(`Transition`,`TransitionRun`),transitionstart:Jr(`Transition`,`TransitionStart`),transitioncancel:Jr(`Transition`,`TransitionCancel`),transitionend:Jr(`Transition`,`TransitionEnd`)},Xr={},Zr={};xn&&(Zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Yr.animationend.animation,delete Yr.animationiteration.animation,delete Yr.animationstart.animation),`TransitionEvent`in window||delete Yr.transitionend.transition);function Qr(e){if(Xr[e])return Xr[e];if(!Yr[e])return e;var t=Yr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Zr)return Xr[e]=t[n];return e}var $r=Qr(`animationend`),ei=Qr(`animationiteration`),ti=Qr(`animationstart`),ni=Qr(`transitionrun`),ri=Qr(`transitionstart`),ii=Qr(`transitioncancel`),ai=Qr(`transitionend`),oi=new Map,si=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);si.push(`scrollEnd`);function ci(e,t){oi.set(e,t),Pt(t,[e])}var li=0;function ui(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=xd.identifierPrefix;var n=li++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function di(e){if(e==null||typeof e==`string`)return e;var t=null,n=kd;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function fi(e,t){return e=di(e),t=di(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var pi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},mi=[],gi=0,_i=0;function vi(){for(var e=gi,t=_i=gi=0;t<e;){var n=mi[t];mi[t++]=null;var r=mi[t];mi[t++]=null;var i=mi[t];mi[t++]=null;var a=mi[t];if(mi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Si(n,i,a)}}function yi(e,t,n,r){mi[gi++]=e,mi[gi++]=t,mi[gi++]=n,mi[gi++]=r,_i|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function bi(e,t,n,r){return yi(e,t,n,r),Ci(e)}function xi(e,t){return yi(e,null,null,t),Ci(e)}function Si(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-qe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Ci(e){if(50<Ad)throw Ad=0,jd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var wi={};function Ti(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ei(e,t,n,r){return new Ti(e,t,n,r)}function Di(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Oi(e,t){var n=e.alternate;return n===null?(n=Ei(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ki(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ai(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Di(r)&&(s=1);else if(typeof r==`string`)s=Ym(e,n,ge.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ie:return e=Ei(31,n,t,a),e.elementType=ie,e.lanes=o,e;case A:return ji(n.children,a,o,t);case j:s=8,a|=24;break;case M:return e=Ei(12,n,t,a|2),e.elementType=M,e.lanes=o,e;case te:return e=Ei(13,n,t,a),e.elementType=te,e.lanes=o,e;case ne:return e=Ei(19,n,t,a),e.elementType=ne,e.lanes=o,e;case I:case L:return e=a|32,e=Ei(30,n,t,e),e.elementType=L,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case P:s=10;break a;case N:s=9;break a;case ee:s=11;break a;case re:s=14;break a;case F:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Ei(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ji(e,t,n,r){return e=Ei(7,e,r,t),e.lanes=n,e}function Mi(e,t,n){return e=Ei(6,e,null,t),e.lanes=n,e}function Ni(e){var t=Ei(18,null,null,0);return t.stateNode=e,t}function Pi(e,t,n){return t=Ei(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Fi=new WeakMap;function Ii(e,t){if(typeof e==`object`&&e){var n=Fi.get(e);return n===void 0?(t={value:e,source:t,stack:ke(t)},Fi.set(e,t),t):n}return{value:e,source:t,stack:ke(t)}}var Li=[],Ri=0,zi=null,Bi=0,Vi=[],Hi=0,Ui=null,Wi=1,Gi=``;function K(e,t){Li[Ri++]=Bi,Li[Ri++]=zi,zi=e,Bi=t}function q(e,t,n){Vi[Hi++]=Wi,Vi[Hi++]=Gi,Vi[Hi++]=Ui,Ui=e;var r=Wi;e=Gi;var i=32-qe(r)-1;r&=~(1<<i),n+=1;var a=32-qe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Wi=1<<32-qe(t)+i|n<<i|r,Gi=a+e}else Wi=1<<a|n<<i|r,Gi=e}function Ki(e){e.return!==null&&(K(e,1),q(e,1,0))}function qi(e){for(;e===zi;)zi=Li[--Ri],Li[Ri]=null,Bi=Li[--Ri],Li[Ri]=null;for(;e===Ui;)Ui=Vi[--Hi],Vi[Hi]=null,Gi=Vi[--Hi],Vi[Hi]=null,Wi=Vi[--Hi],Vi[Hi]=null}function Ji(e,t){Vi[Hi++]=Wi,Vi[Hi++]=Gi,Vi[Hi++]=Ui,Wi=t.id,Gi=t.overflow,Ui=e}var Yi=null,Xi=null,Zi=!1,Qi=null,$i=!1,ea=Error(i(519));function ta(e){throw sa(Ii(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ea}function na(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[_t]=e,t[vt]=r,n){case`dialog`:Wf(`cancel`,t),Wf(`close`,t);break;case`iframe`:case`object`:case`embed`:Wf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Vf.length;n++)Wf(Vf[n],t);break;case`source`:Wf(`error`,t);break;case`img`:case`image`:case`link`:Wf(`error`,t),Wf(`load`,t);break;case`details`:Wf(`toggle`,t);break;case`input`:Wf(`invalid`,t),$t(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Wf(`invalid`,t);break;case`textarea`:Wf(`invalid`,t),rn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||rp(t.textContent,n)?(r.popover!=null&&(Wf(`beforetoggle`,t),Wf(`toggle`,t)),r.onScroll!=null&&Wf(`scroll`,t),r.onScrollEnd!=null&&Wf(`scrollend`,t),r.onClick!=null&&(t.onclick=fn),t=!0):t=!1,t||ta(e,!0)}function ra(e){for(Yi=e.return;Yi;)switch(Yi.tag){case 5:case 31:case 13:$i=!1;return;case 27:case 3:$i=!0;return;default:Yi=Yi.return}}function ia(e){if(e!==Yi)return!1;if(!Zi)return ra(e),Zi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||_p(e.type,e.memoizedProps)),n=!n),n&&Xi&&ta(e),ra(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Xi=pm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Xi=pm(e)}else t===27?(t=Xi,Ep(e.type)?(e=Z,Z=null,Xi=e):Xi=t):Xi=Yi?fm(e.stateNode.nextSibling):null;return!0}function aa(){Xi=Yi=null,Zi=!1}function oa(){var e=Qi;return e!==null&&(pd===null?pd=e:pd.push.apply(pd,e),Qi=null),e}function sa(e){Qi===null?Qi=[e]:Qi.push(e)}var ca=me(null),la=null,ua=null;function da(e,t,n){V(ca,t._currentValue),t._currentValue=n}function fa(e){e._currentValue=ca.current,he(ca)}function pa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ma(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),pa(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),pa(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),pa(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ha(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Pr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ye.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[lh]:e.push(lh))}a=a.return}return e!==null&&ma(t,e,n,r),t.flags|=262144,e!==null}function ga(e){for(e=e.firstContext;e!==null;){if(!Pr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function _a(e){la=e,ua=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function va(e){return ba(la,e)}function ya(e,t){return la===null&&_a(e),ba(e,t)}function ba(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ua===null){if(e===null)throw Error(i(308));ua=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ua=ua.next=t;return n}var xa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Sa=t.unstable_scheduleCallback,Ca=t.unstable_NormalPriority,wa={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ta(){return{controller:new xa,data:new Map,refCount:0}}function Ea(e){e.refCount--,e.refCount===0&&Sa(Ca,function(){e.controller.abort()})}function Da(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Oa=null;function ka(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Aa=null,ja=0,Ma=0,Na=null;function Pa(e,t){if(Aa===null){var n=Aa=[];ja=0,Ma=If(),Na={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ja++,t.then(Fa,Fa),t}function Fa(){if(--ja===0&&(Oa=null,Aa!==null)){Na!==null&&(Na.status=`fulfilled`);var e=Aa;Aa=null,Ma=0,Na=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ia(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var La=z.S;z.S=function(e,t){if(gd=Fe(),typeof t==`object`&&t&&typeof t.then==`function`&&Pa(e,t),Oa!==null)for(var n=Sf;n!==null;)Da(n,Oa),n=n.next;if(n=e.types,n!==null){for(var r=Sf;r!==null;)Da(r,n),r=r.next;if(Ma!==0){r=Oa,r===null&&(r=Oa=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}La!==null&&La(e,t)};var Ra=me(null);function za(){var e=Ra.current;return e===null?Zu.pooledCache:e}function Ba(e,t){t===null?V(Ra,Ra.current):V(Ra,t.pool)}function Va(){var e=za();return e===null?null:{parent:wa._currentValue,pool:e}}var Ha=Error(i(460)),Ua=Error(i(474)),Wa=Error(i(542)),Ga={then:function(){}};function Ka(e){return e=e.status,e===`fulfilled`||e===`rejected`}function qa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(fn,fn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Za(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(fn,fn);else{if(e=Zu,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Za(e),e}throw Ya=t,Ha}}function Ja(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ya=e,Ha):e}}var Ya=null;function Xa(){if(Ya===null)throw Error(i(459));var e=Ya;return Ya=null,e}function Za(e){if(e===Ha||e===Wa)throw Error(i(483))}var Qa=null,$a=0;function eo(e){var t=$a;return $a+=1,Qa===null&&(Qa=[]),qa(Qa,e,t)}function to(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function no(e,t){throw t.$$typeof===D?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ro(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Oi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Mi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===A?(e=d(e,t,n.props.children,r,n.key),to(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===F&&Ja(i)===t.type)?(t=a(t,n.props),to(t,n),t.return=e,t):(t=Ai(n.type,n.key,n.props,null,e.mode,r),to(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Pi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ji(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case O:return n=Ai(t.type,t.key,t.props,null,e.mode,n),to(n,t),n.return=e,n;case k:return t=Pi(t,e.mode,n),t.return=e,t;case F:return t=Ja(t),f(e,t,n)}if(ue(t)||R(t))return t=ji(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,eo(t),n);if(t.$$typeof===P)return f(e,ya(e,t),n);no(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case O:return n.key===i?l(e,t,n,r):null;case k:return n.key===i?u(e,t,n,r):null;case F:return n=Ja(n),p(e,t,n,r)}if(ue(n)||R(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,eo(n),r);if(n.$$typeof===P)return p(e,t,ya(e,n),r);no(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case O:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case k:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case F:return r=Ja(r),m(e,t,n,r,i)}if(ue(r)||R(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,eo(r),i);if(r.$$typeof===P)return m(e,t,n,ya(t,r),i);no(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Zi&&K(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Zi&&K(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Zi&&K(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Zi&&K(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Zi&&K(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Zi&&K(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===A&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case O:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===A){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),to(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===F&&Ja(l)===r.type){n(e,r.sibling),c=a(r,o.props),to(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===A?(c=ji(o.props.children,e.mode,c,o.key),to(c,o),c.return=e,e=c):(c=Ai(o.type,o.key,o.props,null,e.mode,c),to(c,o),c.return=e,e=c)}return s(e);case k:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Pi(o,e.mode,c),c.return=e,e=c}return s(e);case F:return o=Ja(o),_(e,r,o,c)}if(ue(o))return h(e,r,o,c);if(R(o)){if(l=R(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,eo(o),c);if(o.$$typeof===P)return _(e,r,ya(e,o),c);no(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{$a=0;var i=_(e,t,n,r);return Qa=null,i}catch(t){if(t===Ha||t===Wa)throw t;var a=Ei(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var io=ro(!0),ao=ro(!1),oo=!1;function so(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function co(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function lo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function uo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Xu&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Ci(e),Si(e,null,n),t}return yi(e,r,t,n),Ci(e)}function fo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ut(e,n)}}function po(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var mo=!1;function ho(){if(mo){var e=Na;if(e!==null)throw e}}function go(e,t,n,r){mo=!1;var i=e.updateQueue;oo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?($u&f)===f:(r&f)===f){f!==0&&f===Ma&&(mo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=E({},d,f);break a;case 2:oo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),sd|=o,e.lanes=o,e.memoizedState=d}}function _o(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function vo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)_o(n[e],t)}var yo=me(null),bo=me(0);function xo(e,t){e=ad,V(bo,e),V(yo,t),ad=e|t.baseLanes}function So(){V(bo,ad),V(yo,yo.current)}function Co(){ad=bo.current,he(yo),he(bo)}var wo=me(null),To=null;function Eo(e){var t=e.alternate;V(jo,jo.current&1),V(wo,e),To===null&&(t===null||yo.current!==null||t.memoizedState!==null)&&(To=e)}function Do(e){V(jo,jo.current),V(wo,e),To===null&&(To=e)}function Oo(e){e.tag===22?(V(jo,jo.current),V(wo,e),To===null&&(To=e)):ko()}function ko(){V(jo,jo.current),V(wo,wo.current)}function Ao(e){he(wo),To===e&&(To=null),he(jo)}var jo=me(0);function Mo(e,t){V(wo,wo.current),V(jo,t)}function No(e){he(jo),he(wo),To===e&&(To=null)}function Po(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lm(n)||um(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Fo=0,J=null,Io=null,Lo=null,Ro=!1,zo=!1,Bo=!1,Vo=0,Ho=0,Uo=null,Wo=0;function Go(){throw Error(i(321))}function Ko(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Pr(e[n],t[n]))return!1;return!0}function qo(e,t,n,r,i,a){return Fo=a,J=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?uc:dc,Bo=!1,a=n(r,i),Bo=!1,zo&&(a=Yo(t,n,r,i)),Jo(e),a}function Jo(e){z.H=lc;var t=Io!==null&&Io.next!==null;if(Fo=0,Lo=Io=J=null,Ro=!1,Ho=0,Uo=null,t)throw Error(i(300));e===null||Oc||(e=e.dependencies,e!==null&&ga(e)&&(Oc=!0))}function Yo(e,t,n,r){J=e;var a=0;do{if(zo&&(Uo=null),Ho=0,zo=!1,25<=a)throw Error(i(301));if(a+=1,Lo=Io=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}z.H=fc,o=t(n,r)}while(zo);return o}function Xo(){var e=z.H,t=e.useState()[0];return t=typeof t.then==`function`?rs(t):t,e=e.useState()[0],(Io===null?null:Io.memoizedState)!==e&&(J.flags|=1024),t}function Zo(){var e=Vo!==0;return Vo=0,e}function Qo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function $o(e){if(Ro){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ro=!1}Fo=0,Lo=Io=J=null,zo=!1,Ho=Vo=0,Uo=null}function es(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lo===null?J.memoizedState=Lo=e:Lo=Lo.next=e,Lo}function ts(){if(Io===null){var e=J.alternate;e=e===null?null:e.memoizedState}else e=Io.next;var t=Lo===null?J.memoizedState:Lo.next;if(t!==null)Lo=t,Io=e;else{if(e===null)throw J.alternate===null?Error(i(467)):Error(i(310));Io=e,e={memoizedState:Io.memoizedState,baseState:Io.baseState,baseQueue:Io.baseQueue,queue:Io.queue,next:null},Lo===null?J.memoizedState=Lo=e:Lo=Lo.next=e}return Lo}function ns(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rs(e){var t=Ho;return Ho+=1,Uo===null&&(Uo=[]),e=qa(Uo,e,t),t=J,(Lo===null?t.memoizedState:Lo.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?uc:dc),e}function is(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return rs(e);if(e.$$typeof===oe)return;if(e.$$typeof===P)return va(e)}throw Error(i(438,String(e)))}function as(e){var t=null,n=J.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=J.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ns(),J.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ae;return t.index++,n}function os(e,t){return typeof t==`function`?t(e):t}function ss(e){return cs(ts(),Io,e)}function cs(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Fo&f)===f:($u&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Ma&&(d=!0);else if((Fo&p)===p){u=u.next,p===Ma&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,J.lanes|=p,sd|=p;f=u.action,Bo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,J.lanes|=f,sd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Pr(o,e.memoizedState)&&(Oc=!0,d&&(n=Na,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function ls(e){var t=ts(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Pr(o,t.memoizedState)||(Oc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function us(e,t,n){var r=J,a=ts(),o=Zi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Pr((Io||a).memoizedState,n);if(s&&(a.memoizedState=n,Oc=!0),a=a.queue,Fs(ps.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Lo!==null&&!!(Lo.memoizedState.tag&1),As(e?9:8,{destroy:void 0},fs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,Zu===null)throw Error(i(349));o||Fo&127||ds(r,t,n)}return n}function ds(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=J.updateQueue,t===null?(t=ns(),J.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function fs(e,t,n,r){t.value=n,t.getSnapshot=r,ms(t)&&hs(e)}function ps(e,t,n){return n(function(){ms(t)&&hs(e)})}function ms(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Pr(e,n)}catch{return!0}}function hs(e){var t=xi(e,2);t!==null&&Fd(t,e,2)}function gs(e){var t=es();if(typeof e==`function`){var n=e;if(e=n(),Bo){Ke(!0);try{n()}finally{Ke(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:e},t}function _s(e,t,n,r){return e.baseState=n,cs(e,Io,typeof r==`function`?r:os)}function vs(e,t,n,r,a){if(oc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};z.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,ys(t,o)):(o.next=n.next,t.pending=n.next=o)}}function ys(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=z.T,o={};o.types=a===null?null:a.types,z.T=o;try{var s=n(i,r),c=z.S;c!==null&&c(o,s),bs(e,t,s)}catch(n){Ss(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),z.T=a}}else try{a=n(i,r),bs(e,t,a)}catch(n){Ss(e,t,n)}}function bs(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){xs(e,t,n)},function(n){return Ss(e,t,n)}):xs(e,t,n)}function xs(e,t,n){t.status=`fulfilled`,t.value=n,Cs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ys(e,n)))}function Ss(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Cs(t),t=t.next;while(t!==r)}e.action=null}function Cs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ws(e,t){return t}function Ts(e,t){if(Zi){var n=Zu.formState;if(n!==null){a:{var r=J;if(Zi){if(Xi){b:{for(var i=Xi,a=$i;i.nodeType!==8;){if(!a){i=null;break b}if(i=fm(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Xi=fm(i.nextSibling),r=i.data===`F!`;break a}}ta(r)}r=!1}r&&(t=n[0])}}return n=es(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ws,lastRenderedState:t},n.queue=r,n=rc.bind(null,J,r),r.dispatch=n,r=gs(!1),a=ac.bind(null,J,!1,r.queue),r=es(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=vs.bind(null,J,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Es(e){return Ds(ts(),Io,e)}function Ds(e,t,n){if(t=cs(e,t,ws)[0],e=ss(os)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=rs(t)}catch(e){throw e===Ha?Wa:e}else r=t;t=ts();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(J.flags|=2048,As(9,{destroy:void 0},Os.bind(null,i,n),null)),[r,a,e]}function Os(e,t){e.action=t}function ks(e){var t=ts(),n=Io;if(n!==null)return Ds(t,n,e);ts(),t=t.memoizedState,n=ts();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function As(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=J.updateQueue,t===null&&(t=ns(),J.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function js(){return ts().memoizedState}function Ms(e,t,n,r){var i=es();J.flags|=e,i.memoizedState=As(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ns(e,t,n,r){var i=ts();r=r===void 0?null:r;var a=i.memoizedState.inst;Io!==null&&r!==null&&Ko(r,Io.memoizedState.deps)?i.memoizedState=As(t,a,n,r):(J.flags|=e,i.memoizedState=As(1|t,a,n,r))}function Ps(e,t){Ms(8390656,8,e,t)}function Fs(e,t){Ns(2048,8,e,t)}function Is(e){J.flags|=4;var t=J.updateQueue;if(t===null)t=ns(),J.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ls(e){var t=ts().memoizedState;return Is({ref:t,nextImpl:e}),function(){if(Xu&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Rs(e,t){return Ns(4,2,e,t)}function zs(e,t){return Ns(4,4,e,t)}function Bs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Vs(e,t,n){n=n==null?null:n.concat([e]),Ns(4,4,Bs.bind(null,t,e),n)}function Hs(){}function Us(e,t){var n=ts();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Ko(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ws(e,t){var n=ts();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Ko(t,r[1]))return r[0];if(r=e(),Bo){Ke(!0);try{e()}finally{Ke(!1)}}return n.memoizedState=[r,t],r}function Gs(e,t,n){return n===void 0||Fo&1073741824&&!($u&261930)?e.memoizedState=t:(e.memoizedState=n,e=Nd(),J.lanes|=e,sd|=e,n)}function Ks(e,t,n,r){return Pr(n,t)?n:yo.current===null?!(Fo&106)||Fo&1073741824&&!($u&261930)?(Oc=!0,e.memoizedState=n):(e=Nd(),J.lanes|=e,sd|=e,t):(e=Gs(e,n,r),Pr(e,t)||(Oc=!0),e)}function qs(e,t,n,r,i){var a=B.p;B.p=a!==0&&8>a?a:8;var o=z.T,s={};s.types=o===null?null:o.types,z.T=s,ac(e,!1,t,n);try{var c=i(),l=z.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ic(e,t,Ia(c,r),Md(e)):ic(e,t,r,Md(e))}catch(n){ic(e,t,{then:function(){},status:`rejected`,reason:n},Md())}finally{B.p=a,o!==null&&s.types!==null&&(o.types=s.types),z.T=o}}function Js(){}function Ys(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Xs(e).queue;qs(e,a,t,de,n===null?Js:function(){return Zs(e),n(r)})}function Xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:de},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Zs(e){var t=Xs(e);t.next===null&&(t=e.alternate.memoizedState),ic(e,t.next.queue,{},Md())}function Qs(){return va(lh)}function $s(){return ts().memoizedState}function ec(){return ts().memoizedState}function tc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Md();e=lo(n);var r=uo(t,e,n);r!==null&&(Fd(r,t,n),fo(r,t,n)),t={cache:Ta()},e.payload=t;return}t=t.return}}function nc(e,t,n){var r=Md();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},oc(e)?sc(t,n):(n=bi(e,t,n,r),n!==null&&(Fd(n,e,r),cc(n,t,r)))}function rc(e,t,n){ic(e,t,n,Md())}function ic(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(oc(e))sc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Pr(s,o))return yi(e,t,i,0),Zu===null&&vi(),!1}catch{}if(n=bi(e,t,i,r),n!==null)return Fd(n,e,r),cc(n,t,r),!0}return!1}function ac(e,t,n,r){if(r={lane:2,revertLane:If(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},oc(e)){if(t)throw Error(i(479))}else t=bi(e,n,r,2),t!==null&&Fd(t,e,2)}function oc(e){var t=e.alternate;return e===J||t!==null&&t===J}function sc(e,t){zo=Ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ut(e,n)}}var lc={readContext:va,use:is,useCallback:Go,useContext:Go,useEffect:Go,useImperativeHandle:Go,useLayoutEffect:Go,useInsertionEffect:Go,useMemo:Go,useReducer:Go,useRef:Go,useState:Go,useDebugValue:Go,useDeferredValue:Go,useTransition:Go,useSyncExternalStore:Go,useId:Go,useHostTransitionStatus:Go,useFormState:Go,useActionState:Go,useOptimistic:Go,useMemoCache:Go,useCacheRefresh:Go,useEffectEvent:Go},uc={readContext:va,use:is,useCallback:function(e,t){return es().memoizedState=[e,t===void 0?null:t],e},useContext:va,useEffect:Ps,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Ms(4194308,4,Bs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ms(4194308,4,e,t)},useInsertionEffect:function(e,t){Ms(4,2,e,t)},useMemo:function(e,t){var n=es();t=t===void 0?null:t;var r=e();if(Bo){Ke(!0);try{e()}finally{Ke(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=es();if(n!==void 0){var i=n(t);if(Bo){Ke(!0);try{n(t)}finally{Ke(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=nc.bind(null,J,e),[r.memoizedState,e]},useRef:function(e){var t=es();return e={current:e},t.memoizedState=e},useState:function(e){e=gs(e);var t=e.queue,n=rc.bind(null,J,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Hs,useDeferredValue:function(e,t){return Gs(es(),e,t)},useTransition:function(){var e=gs(!1);return e=qs.bind(null,J,e.queue,!0,!1),es().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=J,a=es();if(Zi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Zu===null)throw Error(i(349));$u&127||ds(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Ps(ps.bind(null,r,o,e),[e]),r.flags|=2048,As(9,{destroy:void 0},fs.bind(null,r,o,n,t),null),n},useId:function(){var e=es(),t=Zu.identifierPrefix;if(Zi){var n=Gi,r=Wi;n=(r&~(1<<32-qe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Vo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Wo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Qs,useFormState:Ts,useActionState:Ts,useOptimistic:function(e){var t=es();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ac.bind(null,J,!0,n),n.dispatch=t,[e,t]},useMemoCache:as,useCacheRefresh:function(){return es().memoizedState=tc.bind(null,J)},useEffectEvent:function(e){var t=es(),n={impl:e};return t.memoizedState=n,function(){if(Xu&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},dc={readContext:va,use:is,useCallback:Us,useContext:va,useEffect:Fs,useImperativeHandle:Vs,useInsertionEffect:Rs,useLayoutEffect:zs,useMemo:Ws,useReducer:ss,useRef:js,useState:function(){return ss(os)},useDebugValue:Hs,useDeferredValue:function(e,t){return Ks(ts(),Io.memoizedState,e,t)},useTransition:function(){var e=ss(os)[0],t=ts().memoizedState;return[typeof e==`boolean`?e:rs(e),t]},useSyncExternalStore:us,useId:$s,useHostTransitionStatus:Qs,useFormState:Es,useActionState:Es,useOptimistic:function(e,t){return _s(ts(),Io,e,t)},useMemoCache:as,useCacheRefresh:ec,useEffectEvent:Ls},fc={readContext:va,use:is,useCallback:Us,useContext:va,useEffect:Fs,useImperativeHandle:Vs,useInsertionEffect:Rs,useLayoutEffect:zs,useMemo:Ws,useReducer:ls,useRef:js,useState:function(){return ls(os)},useDebugValue:Hs,useDeferredValue:function(e,t){var n=ts();return Io===null?Gs(n,e,t):Ks(n,Io.memoizedState,e,t)},useTransition:function(){var e=ls(os)[0],t=ts().memoizedState;return[typeof e==`boolean`?e:rs(e),t]},useSyncExternalStore:us,useId:$s,useHostTransitionStatus:Qs,useFormState:ks,useActionState:ks,useOptimistic:function(e,t){var n=ts();return Io===null?(n.baseState=e,[e,n.queue.dispatch]):_s(n,Io,e,t)},useMemoCache:as,useCacheRefresh:ec,useEffectEvent:Ls};function pc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:E({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var mc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Md(),i=lo(r);i.payload=t,n!=null&&(i.callback=n),t=uo(e,i,r),t!==null&&(Fd(t,e,r),fo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Md(),i=lo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=uo(e,i,r),t!==null&&(Fd(t,e,r),fo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Md(),r=lo(n);r.tag=2,t!=null&&(r.callback=t),t=uo(e,r,n),t!==null&&(Fd(t,e,n),fo(t,e,n))}};function hc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Fr(n,r)||!Fr(i,a):!0}function gc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&mc.enqueueReplaceState(t,t.state,null)}function _c(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=E({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function vc(e){pi(e)}function yc(e){console.error(e)}function bc(e){pi(e)}function xc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Sc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Cc(e,t,n){return n=lo(n),n.tag=3,n.payload={element:null},n.callback=function(){xc(e,t)},n}function wc(e){return e=lo(e),e.tag=3,e}function Tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Sc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Sc(t,n,r),typeof i!=`function`&&(yd===null?yd=new Set([this]):yd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ec(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ha(t,n,a,!0),n=wo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return To===null?qd():n.alternate===null&&od===0&&(od=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ga?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),gf(e,r,a)),!1;case 22:return n.flags|=65536,r===Ga?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),gf(e,r,a)),!1}throw Error(i(435,n.tag))}return gf(e,r,a),qd(),!1}if(Zi)return t=wo.current,t===null?(r!==ea&&(t=Error(i(423),{cause:r}),sa(Ii(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Ii(r,n),a=Cc(e.stateNode,r,a),po(e,a),od!==4&&(od=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ea&&(e=Error(i(422),{cause:r}),sa(Ii(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Ii(o,n),fd===null?fd=[o]:fd.push(o),od!==4&&(od=2),t===null)return!0;r=Ii(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Cc(n.stateNode,r,e),po(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(yd===null||!yd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=wc(a),Tc(a,e,n,r),po(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Dc=Error(i(461)),Oc=!1;function kc(e,t,n,r){t.child=e===null?ao(t,null,n,r):io(t,e.child,n,r)}function Ac(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return _a(t),r=qo(e,t,n,o,a,i),s=Zo(),e!==null&&!Oc?(Qo(e,t,i),il(e,t,i)):(Zi&&s&&Ki(t),t.flags|=1,kc(e,t,r,i),t.child)}function jc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Di(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Mc(e,t,a,r,i)):(e=Ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!al(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Fr:n,n(o,r)&&e.ref===t.ref)return il(e,t,i)}return t.flags|=1,e=Oi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Mc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Fr(a,r)&&e.ref===t.ref){if(Oc=!1,t.pendingProps=r=a,al(e,i))e.flags&131072&&(Oc=!0);else return t.lanes=e.lanes,il(e,t,i)}}return Bc(e,t,n,r,i)}function Nc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Fc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ba(t,a===null?null:a.cachePool),a===null?So():xo(t,a),Oo(t);else return r=t.lanes=536870912,Fc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ba(t,null),So(),ko()):(Ba(t,a.cachePool),xo(t,a),ko(),t.memoizedState=null);return kc(e,t,i,n),t.child}function Pc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Fc(e,t,n,r,i){var a=za();return a=a===null?null:{parent:wa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ba(t,null),So(),Oo(t),e!==null&&ha(e,t,r,!0),t.childLanes=i,null}function Ic(e,t){return t=Yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Lc(e,t,n){return io(t,e.child,null,n),e=Ic(t,t.pendingProps),e.flags|=2,Ao(t),t.memoizedState=null,e}function Rc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Zi){if(r.mode===`hidden`)return e=Ic(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Pc(null,e);if(Do(t),(e=Xi)?(e=cm(e,$i),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ui===null?null:{id:Wi,overflow:Gi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Yi=t,Xi=null)):e=null,e===null)throw ta(t);return t.lanes=536870912,null}return Ic(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Do(t),a){if(t.flags&256)t.flags&=-257,t=Lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Oc||ha(e,t,n,!1),a=(n&e.childLanes)!==0,Oc||a){if(yo.current===null){if(r=Zu,r!==null&&(s=dt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,xi(e,s),Fd(r,e,s),Dc;qd()}t=Lc(e,t,n)}else e=o.treeContext,Xi=fm(s.nextSibling),Yi=t,Zi=!0,Qi=null,$i=!1,e!==null&&Ji(t,e),t=Ic(t,r),t.flags|=134221824;return t}return e=Oi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function zc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Bc(e,t,n,r,i){return _a(t),n=qo(e,t,n,r,void 0,i),r=Zo(),e!==null&&!Oc?(Qo(e,t,i),il(e,t,i)):(Zi&&r&&Ki(t),t.flags|=1,kc(e,t,n,i),t.child)}function Vc(e,t,n,r,i,a){return _a(t),t.updateQueue=null,n=Yo(t,r,n,i),Jo(e),r=Zo(),e!==null&&!Oc?(Qo(e,t,a),il(e,t,a)):(Zi&&r&&Ki(t),t.flags|=1,kc(e,t,n,a),t.child)}function Hc(e,t,n,r,i){if(_a(t),t.stateNode===null){var a=wi,o=n.contextType;typeof o==`object`&&o&&(a=va(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=mc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},so(t),o=n.contextType,a.context=typeof o==`object`&&o?va(o):wi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(pc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&mc.enqueueReplaceState(a,a.state,null),go(t,r,a,i),ho(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=_c(n,s);a.props=c;var l=a.context,u=n.contextType;o=wi,typeof u==`object`&&u&&(o=va(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&gc(t,a,r,o),oo=!1;var f=t.memoizedState;a.state=f,go(t,r,a,i),ho(),l=t.memoizedState,s||f!==l||oo?(typeof d==`function`&&(pc(t,n,d,r),l=t.memoizedState),(c=oo||hc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,co(e,t),o=t.memoizedProps,u=_c(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=wi,typeof l==`object`&&l&&(c=va(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&gc(t,a,r,c),oo=!1,f=t.memoizedState,a.state=f,go(t,r,a,i),ho();var p=t.memoizedState;o!==d||f!==p||oo||e!==null&&e.dependencies!==null&&ga(e.dependencies)?(typeof s==`function`&&(pc(t,n,s,r),p=t.memoizedState),(u=oo||hc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ga(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,zc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=io(t,e.child,null,i),t.child=io(t,null,n,i)):kc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=il(e,t,i),e}function Uc(e,t,n,r){return aa(),t.flags|=256,kc(e,t,n,r),t.child}var Wc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gc(e){return{baseLanes:e,cachePool:Va()}}function Kc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ud),e}function qc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(jo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(Zi){if(i?Eo(t):ko(),(e=Xi)?(e=cm(e,$i),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ui===null?null:{id:Wi,overflow:Gi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Yi=t,Xi=null)):e=null,e===null)throw ta(t);return t.lanes=um(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(ko(),i=t.mode,a=Yc({mode:`hidden`,children:a},i),r=ji(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Gc(n),r.childLanes=Kc(e,o,n),t.memoizedState=Wc,Pc(null,r)):(Eo(t),Jc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return Zc(e,t,a,o,r,c,s,n)}return i?(ko(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Oi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=ji(i,a,n,null),i.flags|=2):i=Oi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Pc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Gc(n):(a=i.cachePool,a===null?a=Va():(s=wa._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Kc(e,o,n),t.memoizedState=Wc,Pc(e.child,r)):(Eo(t),n=e.child,e=n.sibling,n=Oi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Jc(e,t){return t=Yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Yc(e,t){return e=Ei(22,e,null,t),e.lanes=0,e}function Xc(e,t,n){return io(t,e.child,null,n),e=Jc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zc(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Eo(t),t.flags&=-257,Xc(e,t,c)):t.memoizedState===null?(ko(),o=a.fallback,s=t.mode,a=Yc({mode:`visible`,children:a.children},s),o=ji(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,io(t,e.child,null,c),a=t.child,a.memoizedState=Gc(c),a.childLanes=Kc(e,r,c),t.memoizedState=Wc,Pc(null,a)):(ko(),t.child=e.child,t.flags|=128,null);if(Eo(t),um(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,sa({value:a,source:null,stack:null})),Xc(e,t,c)}if(Oc||ha(e,t,c,!1),r=(c&e.childLanes)!==0,Oc||r){if(yo.current!==null)return Xc(e,t,c);if(r=Zu,r!==null&&(a=dt(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,xi(e,a),Fd(r,e,a),Dc;return lm(o)||qd(),Xc(e,t,c)}return lm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,Xi=fm(o.nextSibling),Yi=t,Zi=!0,Qi=null,$i=!1,e!==null&&Ji(t,e),t=Jc(t,a.children),t.flags|=134221824,t)}function Qc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),pa(e.return,t,n)}function $c(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Po(n)===null&&(t=e),e=e.sibling}return t}function el(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function tl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function nl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=jo.current;if(t.flags&128)return Mo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Mo(t,o),i===`backwards`&&e!==null?(tl(e),kc(e,t,r,n),tl(e)):kc(e,t,r,n),r=Zi?Bi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Qc(e,n,t);else if(e.tag===19)Qc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=$c(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,tl(t)),el(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Po(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}el(t,!0,n,null,a,r);break;case`together`:el(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=$c(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),el(t,!1,i,n,a,r)}return t.child}function rl(e,t,n){var r=t.pendingProps;return da(t,t.type,r.value),kc(e,t,r.children,n),t.child}function il(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),sd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ha(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function al(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ga(e)))}function ol(e,t,n){switch(t.tag){case 3:be(t,t.stateNode.containerInfo),da(t,wa,e.memoizedState.cache),aa();break;case 27:case 5:Se(t);break;case 4:be(t,t.stateNode.containerInfo);break;case 10:da(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Do(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Eo(t),t.flags|=128,null;r=ha(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?qc(e,t,n):(Eo(t),e=il(e,t,n),e===null?null:e.sibling)}Eo(t);break;case 19:if(t.flags&128)return nl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(ha(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return nl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Mo(t,jo.current),r)break;return null;case 22:return t.lanes=0,Nc(e,t,n,t.pendingProps);case 24:da(t,wa,e.memoizedState.cache)}return il(e,t,n)}function sl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Oc=!0;else{if(!al(e,n)&&!(t.flags&128))return Oc=!1,ol(e,t,n);Oc=!!(e.flags&131072)}}else Oc=!1,Zi&&t.flags&1048576&&q(t,Bi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ja(t.elementType),t.type=e,typeof e==`function`)Di(e)?(r=_c(e,r),t.tag=1,t=Hc(null,t,e,r,n)):(t.tag=0,t=Bc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===ee){t.tag=11,t=Ac(null,t,e,r,n);break a}if(a===re){t.tag=14,t=jc(null,t,e,r,n);break a}if(a===P){t.tag=10,t.type=e,t=rl(null,t,n);break a}}throw t=le(e)||e,Error(i(306,t,``))}}return t;case 0:return Bc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=_c(r,t.pendingProps),Hc(e,t,r,a,n);case 3:a:{if(be(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,co(e,t),go(t,r,null,n);var s=t.memoizedState;if(r=s.cache,da(t,wa,r),r!==o.cache&&ma(t,[wa],n,!0),ho(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Uc(e,t,r,n);break a}if(r!==a){a=Ii(Error(i(424)),t),sa(a),t=Uc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Xi=fm(e.firstChild),Yi=t,Zi=!0,Qi=null,$i=!0,n=ao(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(aa(),r===a){t=il(e,t,n);break a}kc(e,t,r,n)}t=t.child}return t;case 26:return zc(e,t),e===null?(n=Fm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Zi||(t.stateNode=gp(t.type,t.pendingProps,ve.current,t)):t.memoizedState=Fm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Se(t),e===null&&Zi&&(r=t.stateNode=_m(t.type,t.pendingProps,ve.current),Yi=t,$i=!0,a=Xi,Ep(t.type)?(Z=a,Xi=fm(r.firstChild)):Xi=a),kc(e,t,t.pendingProps.children,n),zc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Zi&&((a=r=Xi)&&(r=om(r,t.type,t.pendingProps,$i),r===null?a=!1:(t.stateNode=r,Yi=t,Xi=fm(r.firstChild),$i=!1,a=!0)),a||ta(t)),Se(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,_p(a,o)?r=null:s!==null&&_p(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=qo(e,t,Xo,null,null,n),lh._currentValue=a),zc(e,t),kc(e,t,r,n),t.child;case 6:return e===null&&Zi&&((e=n=Xi)&&(n=sm(n,t.pendingProps,$i),n===null?e=!1:(t.stateNode=n,Yi=t,Xi=null,e=!0)),e||ta(t)),null;case 13:return qc(e,t,n);case 4:return be(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=io(t,null,r,n):kc(e,t,r,n),t.child;case 11:return Ac(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,zc(e,t),kc(e,t,r,n),t.child;case 8:return kc(e,t,t.pendingProps.children,n),t.child;case 12:return kc(e,t,t.pendingProps.children,n),t.child;case 10:return rl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,_a(t),a=va(a),r=r(a),t.flags|=1,kc(e,t,r,n),t.child;case 14:return jc(e,t,t.type,t.pendingProps,n);case 15:return Mc(e,t,t.type,t.pendingProps,n);case 19:return nl(e,t,n);case 31:return Rc(e,t,n);case 22:return Nc(e,t,n,t.pendingProps);case 24:return _a(t),r=va(wa),e===null?(a=za(),a===null&&(a=Zu,o=Ta(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},so(t),da(t,wa,a)):((e.lanes&n)!==0&&(co(e,t),go(t,null,null,n),ho()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,da(t,wa,r),r!==a.cache&&ma(t,[wa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),da(t,wa,r))),kc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:Zi&&Ki(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:zc(e,t),kc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function cl(e){e.flags|=4}function ll(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Xm(t,r):Xm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Wd())e.flags|=8192;else throw Ya=Ga,Ua}}else e.flags&=-16777217}function ul(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Zm(t)){if(Wd())e.flags|=8192;else throw Ya=Ga,Ua}}function dl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:at(),e.lanes|=t,dd|=t)}function fl(e,t){if(!Zi)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function pl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ml(e,t,n){var r=t.pendingProps;switch(qi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pl(t),null;case 1:return pl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),fa(wa),xe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ia(t)?cl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,oa())),pl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(cl(t),o===null?(pl(t),ll(t,a,null,r,n)):(pl(t),ul(t,o))):o?o===e.memoizedState?(pl(t),t.flags&=-16777217):(cl(t),pl(t),ul(t,o)):(e=e.memoizedProps,e!==r&&cl(t),pl(t),ll(t,a,e,r,n)),null;case 27:if(Ce(t),n=ve.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return pl(t),t.subtreeFlags&=-33554433,null}e=ge.current,ia(t)?na(t,e):(e=_m(a,r,n),t.stateNode=e,cl(t))}return pl(t),t.subtreeFlags&=-33554433,null;case 5:if(Ce(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return pl(t),t.subtreeFlags&=-33554433,null}if(o=ge.current,ia(t))na(t,o);else{var s=pp(ve.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[_t]=t,o[vt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(op(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&cl(t)}}return pl(t),t.subtreeFlags&=-33554433,ll(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ve.current,ia(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Yi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[_t]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||rp(e.nodeValue,n)),e||ta(t,!0)}else e=pp(e).createTextNode(r),e[_t]=t,t.stateNode=e}return pl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ia(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[_t]=t}else aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pl(t),e=!1}else n=oa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ao(t),t):(Ao(t),null);if(t.flags&128)throw Error(i(558))}return pl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ia(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[_t]=t}else aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pl(t),a=!1}else a=oa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Ao(t),t):(Ao(t),null)}return Ao(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),dl(t,t.updateQueue),pl(t),null);case 4:return xe(),e===null&&qf(t.stateNode.containerInfo),t.flags|=67108864,pl(t),null;case 10:return fa(t.type),pl(t),null;case 19:if(No(t),r=t.memoizedState,r===null)return pl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)fl(r,!1);else{if(od!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Po(e),o!==null){for(t.flags|=128,fl(r,!1),e=o.updateQueue,t.updateQueue=e,dl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ki(n,e),n=n.sibling;return Mo(t,jo.current&1|2),Zi&&K(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Fe()>_d&&(t.flags|=128,a=!0,fl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Po(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,dl(t,e),fl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!Zi)return pl(t),null}else 2*Fe()-r.renderingStartTime>_d&&n!==536870912&&(t.flags|=128,a=!0,fl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Fe(),e.sibling=null,o=jo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||Zi?Mo(t,o):(n=o,V(wo,t),V(jo,n),To===null&&(To=t)),Zi&&K(t,r.treeForkCount),e}return pl(t),null;case 22:case 23:return Ao(t),Co(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(pl(t),t.subtreeFlags&6&&(t.flags|=8192)):pl(t),n=t.updateQueue,n!==null&&dl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&he(Ra),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),fa(wa),pl(t),null;case 25:return null;case 30:return t.flags|=33554432,pl(t),null}throw Error(i(156,t.tag))}function hl(e,t){switch(qi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return fa(wa),xe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ce(t),null;case 31:if(t.memoizedState!==null){if(Ao(t),t.alternate===null)throw Error(i(340));aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return No(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return xe(),null;case 10:return fa(t.type),null;case 22:case 23:return Ao(t),Co(),e!==null&&he(Ra),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return fa(wa),null;case 25:return null;default:return null}}function gl(e,t){switch(qi(t),t.tag){case 3:fa(wa),xe();break;case 26:case 27:case 5:Ce(t);break;case 4:xe();break;case 31:t.memoizedState!==null&&Ao(t);break;case 13:Ao(t);break;case 19:No(t);break;case 10:fa(t.type);break;case 22:case 23:Ao(t),Co(),e!==null&&he(Ra);break;case 24:fa(wa)}}function _l(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){hf(t,t.return,e)}}function vl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){hf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){hf(t,t.return,e)}}function yl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{vo(t,n)}catch(t){hf(e,e.return,t)}}}function bl(e,t,n){n.props=_c(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){hf(e,t,n)}}function xl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=ui(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Lp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Rp(e);m(e.child,!1,tm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){hf(e,t,n)}}function Sl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){hf(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){hf(e,t,n)}else n.current=null}}function Cl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)rm(e.stateNode,t[n])}function wl(e){for(var t=e.return;t!==null&&(Dl(t)&&rm(e.stateNode,t.stateNode),!El(t));)t=t.return}function Tl(e){for(var t=e.return;t!==null&&(Dl(t)&&im(e.stateNode,t.stateNode),!El(t));)t=t.return}function El(e){return e.tag===5||e.tag===3||e.tag===27}function Dl(e){return e&&e.tag===7&&e.stateNode!==null}function Ol(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){hf(e,e.return,t)}}function kl(e,t,n){try{var r=e.stateNode;cp(r,e.type,n,t),r[vt]=t}catch(t){hf(e,e.return,t)}}function Al(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ep(e.type)||e.tag===4}function jl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Al(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ep(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ml(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=fn)),Cl(e,r),Bt=!0;else if(i!==4&&(i===27&&(Cl(e,r),r=null,Ep(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Ml(e,t,n,r),e=e.sibling;e!==null;)Ml(e,t,n,r),e=e.sibling}function Nl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Cl(e,r),Bt=!0;else if(i!==4&&(i===27&&(Cl(e,r),r=null,Ep(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Nl(e,t,n,r),e=e.sibling;e!==null;)Nl(e,t,n,r),e=e.sibling}function Pl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);op(t,r,n),t[_t]=e,t[vt]=n}catch(t){hf(e,e.return,t)}}var Fl=!1,Il=null;function Ll(e){(e.tag===30||e.subtreeFlags&33554432)&&(Fl=!0)}var Y=null;function Rl(){var e=Y;return Y=null,e}var zl=0;function Bl(e,t,n,r,i){return zl=0,Vl(e.child,t,n,r,i)}function Vl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=jp(o);r.push(s),s.view&&(a=!0)}else a||jp(o).view&&(a=!0);Fl=!0,Op(o,zl===0?t:t+`_`+zl,n),zl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Vl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Hl(e,t){for(;e!==null;)e.tag===5?kp(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Hl(e.child,t)),e=e.sibling}function Ul(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Ul(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=fi(t.default,t.share),t!==`none`&&(Bl(e,n,t,null,!1)||Hl(e.child,!1))}e=e.sibling}}function Wl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=ui(r,n),a=fi(r.default,n.paired?r.share:r.enter);a===`none`?Ul(e):Bl(e,i,a,null,!1)?(Ul(e),n.paired||t||Pd(e,r.onEnter)):Hl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Wl(e,t),e=e.sibling;else Ul(e)}function Gl(e){if(Il!==null&&Il.size!==0){var t=Il;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=fi(n.default,n.share);if(a!==`none`&&(Bl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Pd(e,n.onShare)):Hl(e.child,!1)),t.delete(r),t.size===0)break}}}Gl(e)}e=e.sibling}}}function Kl(e){if(e.tag===30){var t=e.memoizedProps,n=ui(t,e.stateNode),r=Il===null?void 0:Il.get(n),i=fi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Bl(e,n,i,null,!1)?r===void 0?Pd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Il.delete(n),Pd(e,t.onShare)):Hl(e.child,!1)),Il!==null&&Gl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Kl(e),e=e.sibling;else Il!==null&&Gl(e)}function ql(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=ui(t,e.stateNode);t=fi(t.default,t.update),e.flags&=-5,t!==`none`&&Bl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&ql(e);e=e.sibling}}function Jl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Hl(e.child,!1))}Jl(e)}e=e.sibling}}function Yl(e){if(e.tag===30)e.stateNode.paired=null,Hl(e.child,!1),Jl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Yl(e),e=e.sibling;else Jl(e)}function Xl(e){for(e=e.child;e!==null;)e.tag===30?Hl(e.child,!1):e.subtreeFlags&33554432&&Xl(e),e=e.sibling}function Zl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&zl<a.length){var l=a[zl],u=jp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Op(c,zl===0?n:n+`_`+zl,i),s&&e.flags&4||(Y===null&&(Y=[]),Y.push(c,zl===0?r:r+`_`+zl,t.memoizedProps)),zl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Zl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Ql(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=ui(n,r),a=fi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Mp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;zl=0,i=Zl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Pd(e,n.onUpdate))}else e.subtreeFlags&33554432&&Ql(e,t);e=e.sibling}}var $l=!1,eu=!1,tu=!1,nu=!1,ru=typeof WeakSet==`function`?WeakSet:Set,iu=null,au=!1,ou=!1,su=!1,cu=!1;function lu(e,t,n){if(e=e.containerInfo,dp=vh,e=Br(e),Vr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(fp={focusedElem:e,selectionRange:r},vh=!1,n=(n&335544064)===n,iu=t,t=n?9270:1024;iu!==null;){if(e=iu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Kl(r[a]);if(e.alternate===null&&e.flags&2)n&&Ll(e),uu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Kl(r),uu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Ll(e),uu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,iu=r):(n&&ql(e),uu(n))}}Il=null}function uu(e){for(;iu!==null;){var t=iu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=_c(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){hf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)am(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:am(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=ui(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=fi(a.default,a.update),a!==`none`&&Bl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,iu=r;break}iu=t.return}}function du(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ju(e,n),r&4&&_l(5,n);break;case 1:if(ju(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){hf(n,n.return,e)}else{var i=_c(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){hf(n,n.return,e)}}}r&64&&yl(n),r&512&&xl(n,n.return);break;case 3:if(ju(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{vo(e,t)}catch(e){hf(n,n.return,e)}}break;case 27:t===null&&r&4&&Pl(n);case 26:case 5:ju(e,n),t===null&&r&4&&Ol(n),r&512&&xl(n,n.return);break;case 12:ju(e,n);break;case 31:ju(e,n),r&4&&bu(e,n);break;case 13:ju(e,n),r&4&&xu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=yf.bind(null,n),dm(e,n))));break;case 22:if(r=n.memoizedState!==null||$l,!r){var a=t!==null&&t.memoizedState!==null||eu;t=$l,i=eu,$l=r,(eu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Nu(e,n,r)):ju(e,n),$l=t,eu=i}break;case 30:ju(e,n),r&512&&xl(n,n.return);break;case 7:r&512&&xl(n,n.return);default:ju(e,n)}}function fu(e,t){for(e=e.child;e!==null;)pu(e,t),e=e.sibling}function pu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){hf(e,e.return,t)}mu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Bt=!0}catch(t){hf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?X(s,!0):X(e.stateNode,!1)}catch(t){hf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&fu(e,t);break;default:fu(e,t)}}function mu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:pu(n,r);break a;case 22:n.memoizedState===null&&mu(n,r);break a;default:mu(n,r)}}e=e.sibling}}function hu(e){var t=e.alternate;t!==null&&(e.alternate=null,hu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Et(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var gu=null,_u=!1;function vu(e,t,n){for(n=n.child;n!==null;)yu(e,t,n),n=n.sibling}function yu(e,t,n){if(Ge&&typeof Ge.onCommitFiberUnmount==`function`)try{Ge.onCommitFiberUnmount(We,n)}catch{}switch(n.tag){case 26:eu||Sl(n,t),vu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!eu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:eu||Sl(n,t),Tl(n);var r=gu,i=_u;Ep(n.type)&&(gu=n.stateNode,_u=!1),vu(e,t,n),vm(n.stateNode,n.type,n.memoizedProps),gu=r,_u=i;break;case 5:eu||Sl(n,t),Tl(n);case 6:if(n.tag===6&&Tl(n),r=gu,i=_u,gu=null,vu(e,t,n),gu=r,_u=i,gu!==null){if(_u)try{(gu.nodeType===9?gu.body:gu.nodeName===`HTML`?gu.ownerDocument.body:gu).removeChild(n.stateNode),Bt=!0}catch(e){hf(n,t,e)}else try{gu.removeChild(n.stateNode),Bt=!0}catch(e){hf(n,t,e)}}break;case 18:gu!==null&&(_u?(e=gu,Dp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Wh(e)):Dp(gu,n.stateNode));break;case 4:r=gu,i=_u,gu=n.stateNode.containerInfo,_u=!0,vu(e,t,n),gu=r,_u=i;break;case 0:case 11:case 14:case 15:vl(2,n,t),eu||vl(4,n,t),vu(e,t,n);break;case 1:eu||(Sl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&bl(n,t,r)),vu(e,t,n);break;case 21:vu(e,t,n);break;case 22:eu=(r=eu)||n.memoizedState!==null,vu(e,t,n),eu=r;break;case 30:Sl(n,t),vu(e,t,n);break;case 7:eu||Sl(n,t),vu(e,t,n);break;default:vu(e,t,n)}}function bu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Wh(e)}catch(e){hf(t,t.return,e)}}}function xu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Wh(e)}catch(e){hf(t,t.return,e)}}function Su(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ru),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ru),t;default:throw Error(i(435,e.tag))}}function Cu(e,t){var n=Su(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=bf.bind(null,e,t);t.then(r,r)}})}function wu(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Ep(l.type)){gu=l.stateNode,_u=!1;break a}break;case 5:gu=l.stateNode,_u=!1;break a;case 3:case 4:gu=l.stateNode.containerInfo,_u=!0;break a}l=l.return}if(gu===null)throw Error(i(160));yu(s,c,o),gu=null,_u=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Eu(t,e,n),t=t.sibling}var Tu=null;function Eu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}wu(t,e,n),Du(e),a&4&&(vl(3,e,e.return),_l(3,e),vl(5,e,e.return));break;case 1:wu(t,e,n),Du(e),a&512&&(eu||r===null||Sl(r,r.return)),a&64&&$l&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Tu,wu(t,e,n),Du(e),a&512&&(eu||r===null||Sl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if($l)e.stateNode=gp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[wt]||r[_t]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),op(r,t,n),r[_t]=e,At(r),t=r;break a;case`link`:if(o=qm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),op(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=qm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),op(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[_t]=e,At(r),t=r}e.stateNode=t}}else $l||Jm(o,e.type,e.stateNode)}else e.stateNode=Hm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&kl(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||eu||t.parentNode.removeChild(t)):a.count--,n===null?$l||Jm(o,e.type,e.stateNode):Hm(o,n,e.memoizedProps))}break;case 27:wu(t,e,n),Du(e),a&512&&(eu||r===null||Sl(r,r.return)),r!==null&&a&4&&kl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=tu,tu=!1,wu(t,e,n),tu=o,Du(e),a&512&&(eu||r===null||Sl(r,r.return)),e.flags&32){t=e.stateNode;try{an(t,``),Bt=!0}catch(t){hf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,kl(e,t,r===null?t:r.memoizedProps)),a&1024&&(nu=!0);break;case 6:if(wu(t,e,n),Du(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Bt=!0}catch(t){hf(e,e.return,t)}}break;case 3:if(Bt=!1,Km=null,o=Tu,Tu=Sm(t.containerInfo),wu(t,e,n),Tu=o,Du(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Wh(t.containerInfo)}catch(t){hf(e,e.return,t)}nu&&(nu=!1,Ou(e)),Bt=!1;break;case 4:a=tu,tu=$l,r=Vt(),o=Tu,Tu=Sm(e.stateNode.containerInfo),wu(t,e,n),Du(e),Tu=o,Bt&&ou&&(su=!0),Bt=r,tu=a;break;case 12:wu(t,e,n),Du(e);break;case 31:wu(t,e,n),Du(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Cu(e,t)));break;case 13:wu(t,e,n),Du(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(hd=Fe()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Cu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=$l,l=eu,u=tu;$l=c||o,tu=u||o,eu=l||s,wu(t,e,n),eu=l,tu=u,$l=c,Du(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||$l||eu||(t=s||eu,n=$l,r=eu,$l=o||$l,eu=t,Mu(e,2),$l=n,eu=r),!o&&tu||fu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Cu(e,n))));break;case 19:wu(t,e,n),Du(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Cu(e,t)));break;case 30:a&512&&(eu||r===null||Sl(r,r.return)),a=Vt(),o=ou,s=(n&335544064)===n,c=e.memoizedProps,ou=s&&fi(c.default,c.update)!==`none`,wu(t,e,n),Du(e),s&&r!==null&&Bt&&(e.flags|=4),ou=o,Bt=a;break;case 21:break;case 7:a&512&&(eu||r===null||Sl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:wu(t,e,n),Du(e)}}function Du(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Al(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Dl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(El(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Nl(e,jl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(an(l,``),n.flags&=-33),Nl(e,jl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Ml(e,jl(e),u,s);break;default:throw Error(i(161))}}catch(t){hf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ou(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ou(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,vh=!0,t.reset(),vh=!1),e=e.sibling}}function ku(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Au(t,e),t=t.sibling;else Ql(t,!1)}function Au(e,t){var n=e.alternate;if(n===null)Wl(e,!1);else switch(e.tag){case 3:if(cu=au=!1,Rl(),ku(t,e),!au&&!su){if(e=Y,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];kp(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),cu=!0}Y=null;break;case 5:ku(t,e);break;case 4:r=au,au=!1,ku(t,e),au&&(su=!0),au=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?ku(t,e):Wl(e,!1));break;case 30:r=au,i=Rl(),au=!1,ku(t,e),au&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=ui(a,o),o=ui(n.memoizedProps,o);var s=fi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,zl=0,t=Zl(e,n,t,o,s,a,!0),zl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Pd(e,e.memoizedProps.onUpdate),Y=i):i!==null&&(i.push.apply(i,Y),Y=i),au=e.flags&32?!0:r;break;default:ku(t,e)}}function ju(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)du(e,t.alternate,t),t=t.sibling}function Mu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:vl(4,n,n.return),Mu(n,r);break;case 1:Sl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&bl(n,n.return,i),Mu(n,r);break;case 27:r&2&&vm(n.stateNode,n.type,n.memoizedProps);case 5:Sl(n,n.return),n.tag!==5&&n.tag!==27||Tl(n),Mu(n,r);break;case 6:Tl(n);break;case 26:Sl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||eu||i.parentNode.removeChild(i),Mu(n,r);break;case 22:n.memoizedState===null&&Mu(n,r);break;case 30:Sl(n,n.return),Mu(n,r);break;case 7:Sl(n,n.return);default:Mu(n,r)}e=e.sibling}}function Nu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Nu(i,a,n),_l(4,a);break;case 1:if(Nu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){hf(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)_o(l[i],c)}catch(e){hf(r,r.return,e)}}s&&o&64&&yl(a),xl(a,a.return);break;case 27:n&2&&Pl(a);case 5:a.tag!==5&&a.tag!==27||wl(a),Nu(i,a,n),s&&r===null&&o&4&&Ol(a),xl(a,a.return);break;case 6:wl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||$l||Jm(Sm(c.ownerDocument),a.type,c),Nu(i,a,n),s&&r===null&&o&4&&Ol(a),xl(a,a.return);break;case 12:Nu(i,a,n);break;case 31:Nu(i,a,n),s&&o&4&&bu(i,a);break;case 13:Nu(i,a,n),s&&o&4&&xu(i,a);break;case 22:a.memoizedState===null&&Nu(i,a,n),xl(a,a.return);break;case 30:Nu(i,a,n),xl(a,a.return);break;case 7:xl(a,a.return);default:Nu(i,a,n)}t=t.sibling}}function Pu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ea(n))}function Fu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ea(e))}function Iu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Lu(e,t,n,r),t=t.sibling;else i&&Xl(t)}function Lu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Yl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Iu(e,t,n,r),a&2048&&_l(9,t);break;case 1:Iu(e,t,n,r);break;case 3:Iu(e,t,n,r),i&&cu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ea(a)));break;case 12:if(a&2048){Iu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){hf(t,t.return,e)}}else Iu(e,t,n,r);break;case 31:Iu(e,t,n,r);break;case 13:Iu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Yl(t),o._visibility&2?Iu(e,t,n,r):(o._visibility|=2,Ru(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Yl(s),o._visibility&2?Iu(e,t,n,r):zu(e,t)),a&2048&&Pu(s,t);break;case 24:Iu(e,t,n,r),a&2048&&Fu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Hl(a.child,!0),Hl(t.child,!0))),Iu(e,t,n,r);break;default:Iu(e,t,n,r)}}function Ru(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Ru(a,o,s,c,i),_l(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ru(a,o,s,c,i)):u._visibility&2?Ru(a,o,s,c,i):zu(a,o),i&&l&2048&&Pu(o.alternate,o);break;case 24:Ru(a,o,s,c,i),i&&l&2048&&Fu(o.alternate,o);break;default:Ru(a,o,s,c,i)}t=t.sibling}}function zu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:zu(n,r),i&2048&&Pu(r.alternate,r);break;case 24:zu(n,r),i&2048&&Fu(r.alternate,r);break;default:zu(n,r)}t=t.sibling}}var Bu=8192;function Vu(e,t,n){if(e.subtreeFlags&Bu)for(e=e.child;e!==null;)Hu(e,t,n),e=e.sibling}function Hu(e,t,n){switch(e.tag){case 26:Vu(e,t,n),e.flags&Bu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&$m(n,e)):eh(n,Tu,e.memoizedState,e.memoizedProps));break;case 5:Vu(e,t,n),e.flags&Bu&&(e=e.stateNode,(t&335544128)===t&&$m(n,e));break;case 3:case 4:var r=Tu;Tu=Sm(e.stateNode.containerInfo),Vu(e,t,n),Tu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Bu,Bu=16777216,Vu(e,t,n),Bu=r):Vu(e,t,n));break;case 30:if((e.flags&Bu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Il===null&&(Il=new Map),Il.set(r,i)}Vu(e,t,n);break;default:Vu(e,t,n)}}function Uu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Wu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];iu=r,qu(r,e)}Uu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Gu(e),e=e.sibling}function Gu(e){switch(e.tag){case 0:case 11:case 15:Wu(e),e.flags&2048&&vl(9,e,e.return);break;case 3:Wu(e);break;case 12:Wu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ku(e)):Wu(e);break;default:Wu(e)}}function Ku(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];iu=r,qu(r,e)}Uu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:vl(8,t,t.return),Ku(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ku(t));break;default:Ku(t)}e=e.sibling}}function qu(e,t){for(;iu!==null;){var n=iu;switch(n.tag){case 0:case 11:case 15:vl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ea(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,iu=r;else a:for(n=e;iu!==null;){r=iu;var i=r.sibling,a=r.return;if(hu(r),r===n){iu=null;break a}if(i!==null){i.return=a,iu=i;break a}iu=a}}}var Ju={getCacheForType:function(e){var t=va(wa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return va(wa).controller.signal}},Yu=typeof WeakMap==`function`?WeakMap:Map,Xu=0,Zu=null,Qu=null,$u=0,ed=0,td=null,nd=!1,rd=!1,id=!1,ad=0,od=0,sd=0,cd=0,ld=0,ud=0,dd=0,fd=null,pd=null,md=!1,hd=0,gd=0,_d=1/0,vd=null,yd=null,bd=0,xd=null,Sd=null,Cd=0,wd=0,Td=null,Ed=null,Dd=null,Od=null,kd=null,Ad=0,jd=null;function Md(){return Xu&2&&$u!==0?$u&-$u:z.T===null?mt():If()}function Nd(){if(ud===0){if(!($u&536870912)||Zi){var e=Qe;Qe<<=1,!(Qe&3932160)&&(Qe=262144),ud=e}else ud=536870912}return e=wo.current,e!==null&&(e.flags|=32),ud}function Pd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Lp(ui(e.memoizedProps,n))),Od===null&&(Od=[]),Od.push(t.bind(null,r))}}function Fd(e,t,n){(e===Zu&&(ed===2||ed===9)||e.cancelPendingCommit!==null)&&(Hd(e,0),zd(e,$u,ud,!1)),st(e,n),(!(Xu&2)||e!==Zu)&&(e===Zu&&(!(Xu&2)&&(cd|=n),od===4&&zd(e,$u,ud,!1)),Of(e))}function Id(e,t,n){if(Xu&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||nt(e,t),a=r?Xd(e,t):Jd(e,t,!0),o=r;do{if(a===0){rd&&!r&&zd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Rd(n)){a=Jd(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=fd;var l=c.current.memoizedState.isDehydrated;if(l&&(Hd(c,s).flags|=256),s=Jd(c,s,!1),s!==2&&s!==6){if(id&&!l){c.errorRecoveryDisabledLanes|=o,cd|=o,a=4;break a}o=pd,pd=a,o!==null&&(pd===null?pd=o:pd.push.apply(pd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Hd(e,0),zd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:zd(r,t,ud,!nd);break a;case 2:pd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=hd+300-Fe(),10<a)){if(zd(r,t,ud,!nd),tt(r,0,!0)!==0)break a;Cd=t,r.timeoutHandle=bp(Ld.bind(null,r,n,pd,vd,md,t,ud,cd,dd,nd,o,`Throttled`,-0,0),a);break a}Ld(r,n,pd,vd,md,t,ud,cd,dd,nd,o,null,-0,0)}break}while(1);Of(e)}function Ld(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;if(d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:fn},Il=null,Hu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=ih.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?hd-Fe():(a&4194048)===a?gd-Fe():0,m=nh(d,m),m!==null)){Cd=a,e.cancelPendingCommit=m(rf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),zd(e,a,o,!l);return}rf(e,t,a,n,r,i,o,s,c,l,u,d)}function Rd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Pr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zd(e,t,n,r){t=rt(e,t),t&=~ld,t&=~cd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-qe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&lt(e,n,t)}function Bd(){return Xu&6?!0:(kf(0,!1),!1)}function Vd(){if(Qu!==null){if(ed===0)var e=Qu.return;else e=Qu,ua=la=null,$o(e),Qa=null,$a=0,e=Qu;for(;e!==null;)gl(e.alternate,e),e=e.return;Qu=null}}function Hd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,xp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Cd=0,Vd(),Zu=e,Qu=n=Oi(e.current,null),$u=t,ed=0,td=null,nd=!1,rd=nt(e,t),id=!1,dd=ud=ld=cd=sd=od=0,pd=fd=null,md=!1,ad=rt(e,t),vi(),n}function Ud(e,t){J=null,z.H=lc,t===Ha||t===Wa?(t=Xa(),ed=3):t===Ua?(t=Xa(),ed=4):ed=t===Dc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,td=t,Qu===null&&(od=1,xc(e,Ii(t,e.current)))}function Wd(){var e=wo.current;return e===null?!0:($u&4194048)===$u?To===null:($u&62914560)===$u||$u&536870912?e===To:!1}function Gd(){var e=z.H;return z.H=lc,e===null?lc:e}function Kd(){var e=z.A;return z.A=Ju,e}function qd(){od=4,nd||($u&4194048)!==$u&&wo.current!==null||(rd=!0),!(sd&134217727)&&!(cd&134217727)||Zu===null||zd(Zu,$u,ud,!1)}function Jd(e,t,n){var r=Xu;Xu|=2;var i=Gd(),a=Kd();(Zu!==e||$u!==t)&&(vd=null,Hd(e,t)),t=!1;var o=od;a:do try{if(ed!==0&&Qu!==null){var s=Qu,c=td;switch(ed){case 8:Vd(),o=6;break a;case 3:case 2:case 9:case 6:wo.current===null&&(t=!0);var l=ed;if(ed=0,td=null,ef(e,s,c,l),n&&rd){o=0;break a}break;default:l=ed,ed=0,td=null,ef(e,s,c,l)}}Yd(),o=od;break}catch(t){Ud(e,t)}while(1);return t&&e.shellSuspendCounter++,ua=la=null,Xu=r,z.H=i,z.A=a,Qu===null&&(Zu=null,$u=0,vi()),o}function Yd(){for(;Qu!==null;)Qd(Qu)}function Xd(e,t){var n=Xu;Xu|=2;var r=Gd(),a=Kd();Zu!==e||$u!==t?(vd=null,_d=Fe()+500,Hd(e,t)):rd=nt(e,t);a:do try{if(ed!==0&&Qu!==null){t=Qu;var o=td;b:switch(ed){case 1:ed=0,td=null,ef(e,t,o,1);break;case 2:case 9:if(Ka(o)){ed=0,td=null,$d(t);break}t=function(){ed!==2&&ed!==9||Zu!==e||(ed=7),Of(e)},o.then(t,t);break a;case 3:ed=7;break a;case 4:ed=5;break a;case 7:Ka(o)?(ed=0,td=null,$d(t)):(ed=0,td=null,ef(e,t,o,7));break;case 5:var s=null;switch(Qu.tag){case 26:s=Qu.memoizedState;case 5:case 27:var c=Qu;if(s?Zm(s):c.stateNode.complete){ed=0,td=null;var l=c.sibling;if(l!==null)Qu=l;else{var u=c.return;u===null?Qu=null:(Qu=u,tf(u))}break b}}ed=0,td=null,ef(e,t,o,5);break;case 6:ed=0,td=null,ef(e,t,o,6);break;case 8:Vd(),od=6;break a;default:throw Error(i(462))}}Zd();break}catch(t){Ud(e,t)}while(1);return ua=la=null,z.H=r,z.A=a,Xu=n,Qu===null?(Zu=null,$u=0,vi(),od):0}function Zd(){for(;Qu!==null&&!Ne();)Qd(Qu)}function Qd(e){var t=sl(e.alternate,e,ad);e.memoizedProps=e.pendingProps,t===null?tf(e):Qu=t}function $d(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Vc(n,t,t.pendingProps,t.type,void 0,$u);break;case 11:t=Vc(n,t,t.pendingProps,t.type.render,t.ref,$u);break;case 5:$o(t);var r=t;r===Yi&&(Zi?(ra(r),r.tag===5&&r.stateNode!=null&&(Xi=r.stateNode)):(ra(r),Zi=!0));default:gl(n,t),t=Qu=ki(t,ad),t=sl(n,t,ad)}e.memoizedProps=e.pendingProps,t===null?tf(e):Qu=t}function ef(e,t,n,r){ua=la=null,$o(t),Qa=null,$a=0;var i=t.return;try{if(Ec(e,i,t,n,$u)){od=1,xc(e,Ii(n,e.current)),Qu=null;return}}catch(t){if(i!==null)throw Qu=i,t;od=1,xc(e,Ii(n,e.current)),Qu=null;return}t.flags&32768?(Zi||r===1?e=!0:rd||$u&536870912?e=!1:(nd=e=!0,(r===2||r===9||r===3||r===6)&&(r=wo.current,r!==null&&r.tag===13&&(r.flags|=16384))),nf(t,e)):tf(t)}function tf(e){var t=e;do{if(t.flags&32768){nf(t,nd);return}e=t.return;var n=ml(t.alternate,t,ad);if(n!==null){Qu=n;return}if(t=t.sibling,t!==null){Qu=t;return}Qu=t=e}while(t!==null);od===0&&(od=5)}function nf(e,t){do{var n=hl(e.alternate,e);if(n!==null){n.flags&=32767,Qu=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Qu=e;return}Qu=e=n}while(e!==null);od=6,Qu=null}function rf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do ff();while(bd!==0);if(Xu&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===Zu&&(Qu=Zu=null,$u=0),Sd=t,xd=e,Cd=n,Td=a,Ed=r,af(e,t,n,s,c,l,f)}}function af(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(wd=s,s|=_i,ct(e,n,s,r,i,a),Od=null,(n&335544064)===n?(kd=ka(e),r=10262):(kd=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,xf(ze,function(){return pf(),null})):(e.callbackNode=null,e.callbackPriority=0),Fl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=z.T,z.T=null,i=B.p,B.p=2,a=Xu,Xu|=4;try{lu(e,t,n)}finally{Xu=a,B.p=i,z.T=r}}bd=1,Fl?Dd=Fp(o,e.containerInfo,kd,cf,lf,sf,uf,pf,of,null,null):(cf(),lf(),uf())}function of(e){if(bd!==0){var t=xd.onRecoverableError;t(e,{componentStack:null})}}function sf(){bd===3&&(bd=0,Au(Sd,xd),bd=4)}function cf(){if(bd===1){bd=0;var e=xd,t=Sd,n=Cd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=z.T,z.T=null;var i=B.p;B.p=2;var a=Xu;Xu|=4;try{ou=su=!1,Eu(t,e,n),n=fp;var o=Br(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&zr(s.ownerDocument.documentElement,s)){if(c!==null&&Vr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Rr(s,h),v=Rr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}vh=!!dp,fp=dp=null}finally{Xu=a,B.p=i,z.T=r}}e.current=t,bd=2}}function lf(){if(bd===2){bd=0;var e=xd,t=Sd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=z.T,z.T=null;var r=B.p;B.p=2;var i=Xu;Xu|=4;try{du(e,t.alternate,t)}finally{Xu=i,B.p=r,z.T=n}}bd=3}}function uf(){if(bd===4||bd===3){bd=0;var e=Dd;Dd=null,Pe();var t=xd,n=Sd,r=Cd,i=Ed,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?bd=5:(bd=0,Sd=xd=null,df(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(yd=null),pt(r),n=n.stateNode,Ge&&typeof Ge.onCommitFiberRoot==`function`)try{Ge.onCommitFiberRoot(We,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=z.T,a=B.p,B.p=2,z.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{z.T=n,B.p=a}}if(i=Od,o=kd,kd=null,i!==null&&(Od=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Cd&3&&ff(),Of(t),a=t.pendingLanes,r&261930&&a&42?t===jd?Ad++:(Ad=0,jd=t):(Ad=0,jd=null),kf(0,!1)}}function df(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ea(t)))}function ff(){return Dd!==null&&(Dd.skipTransition(),Dd=null),cf(),lf(),uf(),pf()}function pf(){if(bd!==5)return!1;var e=xd,t=wd;wd=0;var n=pt(Cd),r=z.T,a=B.p;try{B.p=32>n?32:n,z.T=null,n=Td,Td=null;var o=xd,s=Cd;if(bd=0,Sd=xd=null,Cd=0,Xu&6)throw Error(i(331));var c=Xu;if(Xu|=4,Gu(o.current),Lu(o,o.current,s,n),Xu=c,kf(0,!1),Ge&&typeof Ge.onPostCommitFiberRoot==`function`)try{Ge.onPostCommitFiberRoot(We,o)}catch{}return!0}finally{B.p=a,z.T=r,df(e,t)}}function mf(e,t,n){t=Ii(n,t),t=Cc(e.stateNode,t,2),e=uo(e,t,2),e!==null&&(st(e,2),Of(e))}function hf(e,t,n){if(e.tag===3)mf(e,e,n);else for(;t!==null;){if(t.tag===3){mf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(yd===null||!yd.has(r))){e=Ii(n,e),n=wc(2),r=uo(t,n,2),r!==null&&(Tc(n,r,t,e),st(r,2),Of(r));break}}t=t.return}}function gf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Yu;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(id=!0,i.add(n),e=_f.bind(null,e,t,n),t.then(e,e))}function _f(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Zu===e&&($u&n)===n&&(od===4||od===3&&($u&62914560)===$u&&300>Fe()-hd?Xu&2?ld|=n:Hd(e,0):ld|=n,dd===$u&&(dd=0)),Of(e)}function vf(e,t){t===0&&(t=at()),e=xi(e,t),e!==null&&(st(e,t),Of(e))}function yf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vf(e,n)}function bf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),vf(e,n)}function xf(e,t){return je(e,t)}var Sf=null,Cf=null,wf=!1,Tf=!1,Ef=!1,Df=0;function Of(e){e!==Cf&&e.next===null&&(Cf===null?Sf=Cf=e:Cf=Cf.next=e),Tf=!0,wf||(wf=!0,Ff())}function kf(e,t){if(!Ef&&Tf){Ef=!0;do for(var n=!1,r=Sf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-qe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Pf(r,a))}else a=$u,a=tt(r,r===Zu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||nt(r,a)||(n=!0,Pf(r,a))}r=r.next}while(n);Ef=!1}}function Af(){jf()}function jf(){Tf=wf=!1;var e=0;Df!==0&&yp()&&(e=Df);for(var t=Fe(),n=null,r=Sf;r!==null;){var i=r.next,a=Mf(r,t);a===0?(r.next=null,n===null?Sf=i:n.next=i,i===null&&(Cf=n)):(n=r,(e!==0||a&3)&&(Tf=!0)),r=i}bd!==0&&bd!==5||kf(e,!1),Df!==0&&(Df=0)}function Mf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-qe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=it(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Zu,n=$u,n=tt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(ed===2||ed===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Me(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||nt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Me(r),pt(n)){case 2:case 8:n=Re;break;case 32:n=ze;break;case 268435456:n=Ve;break;default:n=ze}return r=Nf.bind(null,e),n=je(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Me(r),e.callbackPriority=2,e.callbackNode=null,2}function Nf(e,t){if(bd!==0&&bd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ff()&&e.callbackNode!==n)return null;var r=$u;return r=tt(e,e===Zu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Id(e,r,t),Mf(e,Fe()),e.callbackNode!=null&&e.callbackNode===n?Nf.bind(null,e):null)}function Pf(e,t){if(ff())return null;Id(e,t,!0)}function Ff(){wp(function(){Xu&6?je(Le,Af):jf()})}function If(){if(Df===0){var e=Ma;e===0&&(e=Ze,Ze<<=1,!(Ze&261888)&&(Ze=256)),Df=e}return Df}function Lf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:dn(e)}function Rf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Lf((i[vt]||null).action),o=r.submitter;o&&(t=(t=o[vt]||null)?Lf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Nn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Df!==0){var e=new FormData(i,o);Ys(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var zf=0;zf<si.length;zf++){var Bf=si[zf];ci(Bf.toLowerCase(),`on`+(Bf[0].toUpperCase()+Bf.slice(1)))}ci($r,`onAnimationEnd`),ci(ei,`onAnimationIteration`),ci(ti,`onAnimationStart`),ci(`dblclick`,`onDoubleClick`),ci(`focusin`,`onFocus`),ci(`focusout`,`onBlur`),ci(ni,`onTransitionRun`),ci(ri,`onTransitionStart`),ci(ii,`onTransitionCancel`),ci(ai,`onTransitionEnd`),Ft(`onMouseEnter`,[`mouseout`,`mouseover`]),Ft(`onMouseLeave`,[`mouseout`,`mouseover`]),Ft(`onPointerEnter`,[`pointerout`,`pointerover`]),Ft(`onPointerLeave`,[`pointerout`,`pointerover`]),Pt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Pt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Pt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Pt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Pt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Pt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Vf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Hf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Vf));function Uf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){pi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){pi(e)}i.currentTarget=null,a=c}}}}function Wf(e,t){var n=t[bt];n===void 0&&(n=t[bt]=new Set);var r=e+`__bubble`;n.has(r)||(Jf(t,e,2,!1),n.add(r))}function Gf(e,t,n){var r=0;t&&(r|=4),Jf(n,e,r,t)}var Kf=`_reactListening`+Math.random().toString(36).slice(2);function qf(e){if(!e[Kf]){e[Kf]=!0,Mt.forEach(function(t){t!==`selectionchange`&&(Hf.has(t)||Gf(t,!1,e),Gf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Kf]||(t[Kf]=!0,Gf(`selectionchange`,!1,t))}}function Jf(e,t,n,r){switch(Th(t)){case 2:var i=yh;break;case 8:i=bh;break;default:i=xh}n=i.bind(null,t,n,e),i=void 0,!Sn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Yf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Dt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}yn(function(){var r=a,i=mn(n),s=[];a:{var c=oi.get(e);if(c!==void 0){var l=Nn,u=e;switch(e){case`keypress`:if(On(n)===0)break a;case`keydown`:case`keyup`:l=Xn;break;case`focusin`:u=`focus`,l=Hn;break;case`focusout`:u=`blur`,l=Hn;break;case`beforeblur`:case`afterblur`:l=Hn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Bn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Vn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=$n;break;case $r:case ei:case ti:l=G;break;case ai:l=er;break;case`scroll`:case`scrollend`:l=Fn;break;case`wheel`:l=tr;break;case`copy`:case`cut`:case`paste`:l=Un;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Zn;break;case`submit`:l=Qn;break;case`toggle`:case`beforetoggle`:l=nr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=bn(m,p),g!=null&&d.push(Xf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==pn&&(u=n.relatedTarget||n.fromElement)&&(Dt(u)||u[yt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Dt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Bn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Zn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:kt(c),h=l==null?u:kt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Dt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?T(c,l,Qf):null,c!==null&&$f(s,u,c,d,!1),l!==null&&f!==null&&$f(s,f,l,d,!0)))}a:{if(c=r?kt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Sr;else if(gr(c)){if(Cr)_=Mr;else{_=Ar;var v=kr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&cn(r.elementType)&&(_=Sr):_=jr;if(_&&=_(e,r)){_r(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?kt(r):window,e){case`focusin`:(gr(v)||v.contentEditable===`true`)&&(Ur=v,Wr=r,Gr=null);break;case`focusout`:Gr=Wr=Ur=null;break;case`mousedown`:Kr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Kr=!1,qr(s,n,i);break;case`selectionchange`:if(Hr)break;case`keydown`:case`keyup`:qr(s,n,i)}var y;if(ir)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else fr?ur(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(sr&&n.locale!==`ko`&&(fr||b!==`onCompositionStart`?b===`onCompositionEnd`&&fr&&(y=Dn()):(wn=i,Tn=`value`in wn?wn.value:wn.textContent,fr=!0)),v=Zf(r,b),0<v.length&&(b=new Wn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=dr(n),y!==null&&(b.data=y)))),(y=or?pr(e,n):mr(e,n))&&(b=Zf(r,`onBeforeInput`),0<b.length&&(v=new Wn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Rf(s,e,r,n,i)}Uf(s,t)})}function Xf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Zf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=bn(e,n),i!=null&&r.unshift(Xf(e,i,a)),i=bn(e,t),i!=null&&r.push(Xf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Qf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function $f(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=bn(n,a),l!=null&&o.unshift(Xf(n,l,c))):i||(l=bn(n,a),l!=null&&o.push(Xf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var ep=/\r\n?/g,tp=/\u0000|\uFFFD/g;function np(e){return(typeof e==`string`?e:``+e).replace(ep,`
10
- `).replace(tp,``)}function rp(e,t){return t=np(t),np(e)===t}function ip(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||an(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&an(e,``+r);else return;break;case`className`:Ut(e,`class`,r);break;case`tabIndex`:Ut(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ut(e,n,r);break;case`style`:W(e,r,o);return;case`data`:if(t!==`object`){Ut(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=dn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&ip(e,t,`name`,a.name,a,null),ip(e,t,`formEncType`,a.formEncType,a,null),ip(e,t,`formMethod`,a.formMethod,a,null),ip(e,t,`formTarget`,a.formTarget,a,null)):(ip(e,t,`encType`,a.encType,a,null),ip(e,t,`method`,a.method,a,null),ip(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=dn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=fn);return;case`onScroll`:r!=null&&Wf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Wf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=dn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Wf(`beforetoggle`,e),Wf(`toggle`,e),Ht(e,`popover`,r);break;case`xlinkActuate`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ht(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=ln.get(n)||n,Ht(e,n,r);else return}Bt=!0}function ap(e,t,n,r,a,o){switch(n){case`style`:W(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)an(e,r);else if(typeof r==`number`||typeof r==`bigint`)an(e,``+r);else return;break;case`onScroll`:r!=null&&Wf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Wf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=fn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Nt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[vt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Bt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ht(e,n,r)}return}Bt=!0}function op(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Wf(`error`,e),Wf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ip(e,t,o,s,n,null)}}a&&ip(e,t,`srcSet`,n.srcSet,n,null),r&&ip(e,t,`src`,n.src,n,null);return;case`input`:Wf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:ip(e,t,r,d,n,null)}}$t(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Wf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ip(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&tn(e,!!r,n,!0):tn(e,!!r,t,!1);return;case`textarea`:for(s in Wf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:ip(e,t,s,c,n,null)}rn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ip(e,t,l,r,n,null)}return;case`dialog`:Wf(`beforetoggle`,e),Wf(`toggle`,e),Wf(`cancel`,e),Wf(`close`,e);break;case`iframe`:case`object`:Wf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Vf.length;r++)Wf(Vf[r],e);break;case`image`:Wf(`error`,e),Wf(`load`,e);break;case`details`:Wf(`toggle`,e);break;case`embed`:case`source`:case`link`:Wf(`error`,e),Wf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ip(e,t,u,r,n,null)}return;default:if(cn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&ap(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ip(e,t,c,r,n,null))}var sp={};function cp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ip(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Bt=!0),o=m;break;case`name`:m!==f&&(Bt=!0),a=m;break;case`checked`:m!==f&&(Bt=!0),u=m;break;case`defaultChecked`:m!==f&&(Bt=!0),d=m;break;case`value`:m!==f&&(Bt=!0),s=m;break;case`defaultValue`:m!==f&&(Bt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&ip(e,t,p,m,r,f)}}Qt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||ip(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Bt=!0),p=o;break;case`defaultValue`:o!==l&&(Bt=!0),c=o;break;case`multiple`:o!==l&&(Bt=!0),s=o;default:o!==l&&ip(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?tn(e,!!n,n?[]:``,!1):tn(e,!!n,t,!0)):tn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ip(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Bt=!0),p=a;break;case`defaultValue`:a!==o&&(Bt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&ip(e,t,s,a,r,o)}nn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ip(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Bt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ip(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ip(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:ip(e,t,u,p,r,m)}return;default:if(cn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&ap(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||ap(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ip(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ip(e,t,f,p,r,m)}function lp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function up(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&lp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&lp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var dp=null,fp=null;function pp(e){return e.nodeType===9?e:e.ownerDocument}function mp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function hp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function gp(e,t,n,r){return n=pp(n).createElement(e),n[_t]=r,n[vt]=t,op(n,e,t),At(n),n}function _p(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var vp=null;function yp(){var e=window.event;return e&&e.type===`popstate`?e!==vp&&(vp=e,!0):(vp=null,!1)}var bp=typeof setTimeout==`function`?setTimeout:void 0,xp=typeof clearTimeout==`function`?clearTimeout:void 0,Sp=typeof Promise==`function`?Promise:void 0,Cp=typeof requestAnimationFrame==`function`?requestAnimationFrame:bp,wp=typeof queueMicrotask==`function`?queueMicrotask:Sp===void 0?bp:function(e){return Sp.resolve(null).then(e).catch(Tp)};function Tp(e){setTimeout(function(){throw e})}function Ep(e){return e===`head`}function Dp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Wh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)ym(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,ym(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[wt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&ym(e.ownerDocument.body)}n=i}while(n);Wh(t)}function X(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Op(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function kp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Ap(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function jp(e){return Ap(e.getBoundingClientRect(),getComputedStyle(e),e)}function Mp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Ap(t,n,e)}function Np(e){return e.documentElement.clientHeight}function Pp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Fp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Np(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Qm(f),u>th){s.length=o;break}f=new Promise(Pp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Ip(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Ip.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:E({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Ip.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Ip.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Lp(e){return{name:e,group:new Ip(`group`,e),imagePair:new Ip(`image-pair`,e),old:new Ip(`old`,e),new:new Ip(`new`,e)}}function Rp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Rp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Up(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Vp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),m(this._fragmentFiber.child,!1,zp,e,s,r)}this._eventListeners=a}};function zp(e,t,n,r){return y(e).addEventListener(t,n,r),!1}Rp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Up(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Vp(i.optionsOrUseCapture),m(this._fragmentFiber.child,!1,Bp,e,n,i),r.splice(t,1),a!==null&&a()}};function Bp(e,t,n,r){return y(e).removeEventListener(t,n,r),!1}function Vp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Hp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Up(e,t,n,r){if(e.length===0)return-1;r=Hp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Hp(a.optionsOrUseCapture)===r)return i}return-1}Rp.prototype.dispatchEvent=function(e){var t=h(this._fragmentFiber);if(t===null)return!0;t=y(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Vp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Vp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Rp.prototype.focus=function(e){m(this._fragmentFiber.child,!0,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag!==6&&(e=y(e),hm(e,t))}Rp.prototype.focusLast=function(e){var t=[];m(this._fragmentFiber.child,!0,Gp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Wp(t[n],e);n--);};function Gp(e,t){return t.push(e),!1}Rp.prototype.blur=function(){var e=h(this._fragmentFiber);e!==null&&(e=y(e),e=pp(e).activeElement,e!==null&&m(this._fragmentFiber.child,!1,Kp,e,void 0,void 0))};function Kp(e,t){return e.tag!==6&&(e=y(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Rp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),m(this._fragmentFiber.child,!1,qp,e,void 0,void 0)};function qp(e,t){return e.tag!==6&&(e=y(e),t.observe(e),!1)}Rp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),m(this._fragmentFiber.child,!1,Jp,e,void 0,void 0);for(var n=t=0;n<Yp.length;n++){var r=Yp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Yp[t++]=r}Yp.length=t}};function Jp(e,t){return e.tag!==6&&(e=y(e),t.unobserve(e),!1)}var Yp=[],Xp=!1;function Zp(e,t,n){Yp.push({fragmentInstance:e,observer:t,instance:n}),Xp||(Xp=!0,gm(function(){Xp=!1;var e=Yp;Yp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Rp.prototype.getClientRects=function(){var e=[];return m(this._fragmentFiber.child,!1,Qp,e,void 0,void 0),e};function Qp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=y(e),t.push.apply(t,e.getClientRects());return!1}Rp.prototype.getRootNode=function(e){var t=h(this._fragmentFiber);return t===null?this:y(t).getRootNode(e)},Rp.prototype.compareDocumentPosition=function(e){var t=h(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];m(this._fragmentFiber.child,!1,Gp,n,void 0,void 0);var r=y(t);if(n.length===0){if(n=r,g(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=_(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=y(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=y(n[0]),i=y(n[n.length-1]);var a=g(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||$p(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function $p(e,t,n,r,i){var a=Dt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=h(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=T(n,a,w),t===null?t=!1:(m(t,!0,S,a,n),a=b,b=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=T(r,a,w),t===null?t=!1:(m(t,!0,C,a,r),a=b,x=b=null,t=a!==null)),t):!1}function em(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Rp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];m(this._fragmentFiber.child,!1,Gp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=_(this._fragmentFiber);if(r=n?r[1]||r[0]||h(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=y(r),em(e,n);return}if(r=y(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=y(a),em(a,n)):y(a).scrollIntoView(e),r+=n?-1:1}};function tm(e,t){return e=y(e),nm(e,t),!1}function nm(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function rm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Vp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Yp.length;i++){var a=Yp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Yp[r++]=a)}Yp.length=r,n.observe(e)}),nm(e,t))}function im(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Vp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Zp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function am(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:am(n),Et(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function om(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[wt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=fm(e.nextSibling),e===null)break}return null}function sm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=fm(e.nextSibling),e===null))return null;return e}function cm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=fm(e.nextSibling),e===null))return null;return e}function lm(e){return e.data===`$?`||e.data===`$~`}function um(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function dm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function fm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var Z=null;function pm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return fm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function mm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function hm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function gm(e){Cp(function(){Cp(function(t){return e(t)})})}function _m(e,t,n){switch(t=pp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function vm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ip(e,t,r,null,sp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===fn&&(e.onclick=null),Et(e)}function ym(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Et(e)}var bm=new Map,xm=new Set;function Sm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Cm=B.d;B.d={f:wm,r:Tm,D:Om,C:km,L:Am,m:jm,X:Nm,S:Mm,M:Pm};function wm(){var e=Cm.f(),t=Bd();return e||t}function Tm(e){var t=Ot(e);t!==null&&t.tag===5&&t.type===`form`?Zs(t):Cm.r(e)}var Em=typeof document>`u`?null:document;function Dm(e,t,n){var r=Em;if(r&&typeof t==`string`&&t){var i=Zt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),xm.has(i)||(xm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),op(t,`link`,e),At(t),r.head.appendChild(t)))}}function Om(e){Cm.D(e),Dm(`dns-prefetch`,e,null)}function km(e,t){Cm.C(e,t),Dm(`preconnect`,e,t)}function Am(e,t,n){Cm.L(e,t,n);var r=Em;if(r&&e&&t){var i=`link[rel="preload"][as="`+Zt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Zt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Zt(n.imageSizes)+`"]`)):i+=`[href="`+Zt(e)+`"]`;var a=i;switch(t){case`style`:a=Im(e);break;case`script`:a=Bm(e)}if(!(bm.has(a)||(e=E({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),bm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lm(a))||t===`script`&&r.querySelector(Vm(a))))){var o=r.createElement(`link`);op(o,`link`,e),t===`style`&&(o[Tt]=!0,o.onload=o.onerror=function(){jt(o)}),At(o),r.head.appendChild(o)}}}function jm(e,t){Cm.m(e,t);var n=Em;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Zt(r)+`"][href="`+Zt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bm(e)}if(!bm.has(a)&&(e=E({rel:`modulepreload`,href:e},t),bm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vm(a)))return}r=n.createElement(`link`),op(r,`link`,e),At(r),n.head.appendChild(r)}}}function Mm(e,t,n){Cm.S(e,t,n);var r=Em;if(r&&e){var i=U(r).hoistableStyles,a=Im(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lm(a)))s.loading=5;else{e=E({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=bm.get(a))&&Wm(e,n);var c=o=r.createElement(`link`);At(c),op(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Um(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nm(e,t){Cm.X(e,t);var n=Em;if(n&&e){var r=U(n).hoistableScripts,i=Bm(e),a=r.get(i);a||(a=n.querySelector(Vm(i)),a||(e=E({src:e,async:!0},t),(t=bm.get(i))&&Gm(e,t),a=n.createElement(`script`),At(a),op(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pm(e,t){Cm.M(e,t);var n=Em;if(n&&e){var r=U(n).hoistableScripts,i=Bm(e),a=r.get(i);a||(a=n.querySelector(Vm(i)),a||(e=E({src:e,async:!0,type:`module`},t),(t=bm.get(i))&&Gm(e,t),a=n.createElement(`script`),At(a),op(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Fm(e,t,n,r){var a=(a=ve.current)?Sm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Im(n.href),t=U(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Im(n.href);var o=U(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Lm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=bm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},bm.set(e,o)),zm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Bm(n),t=U(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Im(e){return`href="`+Zt(e)+`"`}function Lm(e){return`link[rel="stylesheet"][`+e+`]`}function Rm(e){return E({},e,{"data-precedence":e.precedence,precedence:null})}function zm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Tt]){r.loading=1;return}}else t=e.createElement(`link`),t[Tt]=!0,t.onload=t.onerror=jt.bind(null,t),op(t,`link`,n),At(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Bm(e){return`[src="`+Zt(e)+`"]`}function Vm(e){return`script[async]`+e}function Hm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Zt(n.href)+`"]`);if(r)return t.instance=r,At(r),r;var a=E({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),At(r),op(r,`style`,a),Um(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Im(n.href);var o=e.querySelector(Lm(a));if(o)return t.state.loading|=4,t.instance=o,At(o),o;r=Rm(n),(a=bm.get(a))&&Wm(r,a),o=(e.ownerDocument||e).createElement(`link`),At(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),op(o,`link`,r),t.state.loading|=4,Um(o,n.precedence,e),t.instance=o;case`script`:return o=Bm(n.src),(a=e.querySelector(Vm(o)))?(t.instance=a,At(a),a):(r=n,(a=bm.get(o))&&(r=E({},n),Gm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),At(a),op(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Um(r,n.precedence,e));return t.instance}function Um(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Wm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Gm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Km=null;function qm(e,t,n){if(Km===null){var r=new Map,i=Km=new Map;i.set(n,r)}else i=Km,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[wt]||a[_t]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Jm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Ym(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Xm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Zm(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Qm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function $m(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Qm(t),e.suspenseyImages.push(t)),e=ah.bind(e),t.decode().then(e,e))}function eh(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Im(r.href),a=t.querySelector(Lm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ih.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,At(a);return}a=t.ownerDocument||t,r=Rm(r),(i=bm.get(i))&&Wm(r,i),a=a.createElement(`link`),At(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),op(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ih.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var th=0;function nh(e,t){return e.stylesheets&&e.count===0&&sh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&sh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&th===0&&(th=62500*up());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&sh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>th?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)sh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ih(){this.count--,rh(this)}function ah(){this.imgCount--,rh(this)}var oh=null;function sh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,oh=new Map,t.forEach(ch,e),oh=null,ih.call(e))}function ch(e,t){if(!(t.state.loading&4)){var n=oh.get(e);if(n)var r=n.get(null);else{n=new Map,oh.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ih.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var lh={$$typeof:P,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function uh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ot(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ot(0),this.hiddenUpdates=ot(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function dh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new uh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Ei(3,null,null,t),e.current=a,a.stateNode=e,t=Ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},so(a),e}function fh(e){return e?(e=wi,e):wi}function ph(e,t,n,r,i,a){i=fh(i),r.context===null?r.context=i:r.pendingContext=i,r=lo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=uo(e,r,t),n!==null&&(Fd(n,e,t),fo(n,e,t))}function mh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hh(e,t){mh(e,t),(e=e.alternate)&&mh(e,t)}function gh(e){if(e.tag===13||e.tag===31){var t=xi(e,67108864);t!==null&&Fd(t,e,67108864),hh(e,67108864)}}function _h(e){if(e.tag===13||e.tag===31){var t=Md();t=ft(t);var n=xi(e,t);n!==null&&Fd(n,e,t),hh(e,t)}}var vh=!0;function yh(e,t,n,r){var i=z.T;z.T=null;var a=B.p;try{B.p=2,xh(e,t,n,r)}finally{B.p=a,z.T=i}}function bh(e,t,n,r){var i=z.T;z.T=null;var a=B.p;try{B.p=8,xh(e,t,n,r)}finally{B.p=a,z.T=i}}function xh(e,t,n,r){if(vh){var i=Sh(r);if(i===null)Yf(e,t,r,Ch,n),Ph(e,r);else if(Ih(i,e,t,n,r))r.stopPropagation();else if(Ph(e,r),t&4&&-1<Nh.indexOf(e)){for(;i!==null;){var a=Ot(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=et(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-qe(o);s.entanglements[1]|=c,o&=~c}Of(a),!(Xu&6)&&(_d=Fe()+500,kf(0,!1))}}break;case 31:case 13:s=xi(a,2),s!==null&&Fd(s,a,2),Bd(),hh(a,2)}if(a=Sh(r),a===null&&Yf(e,t,r,Ch,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Yf(e,t,r,null,n)}}function Sh(e){return e=mn(e),wh(e)}var Ch=null;function wh(e){if(Ch=null,e=Dt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ch=e,null}function Th(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ie()){case Le:return 2;case Re:return 8;case ze:case Be:return 32;case Ve:return 268435456;default:return 32}default:return 32}}var Eh=!1,Dh=null,Oh=null,kh=null,Ah=new Map,jh=new Map,Mh=[],Nh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ph(e,t){switch(e){case`focusin`:case`focusout`:Dh=null;break;case`dragenter`:case`dragleave`:Oh=null;break;case`mouseover`:case`mouseout`:kh=null;break;case`pointerover`:case`pointerout`:Ah.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:jh.delete(t.pointerId)}}function Fh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ot(t),t!==null&&gh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ih(e,t,n,r,i){switch(t){case`focusin`:return Dh=Fh(Dh,e,t,n,r,i),!0;case`dragenter`:return Oh=Fh(Oh,e,t,n,r,i),!0;case`mouseover`:return kh=Fh(kh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ah.set(a,Fh(Ah.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,jh.set(a,Fh(jh.get(a)||null,e,t,n,r,i)),!0}return!1}function Lh(e){var t=Dt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,ht(e.priority,function(){_h(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ht(e.priority,function(){_h(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Rh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Sh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);pn=r,n.target.dispatchEvent(r),pn=null}else return t=Ot(n),t!==null&&gh(t),e.blockedOn=n,!1;t.shift()}return!0}function zh(e,t,n){Rh(e)&&n.delete(t)}function Bh(){Eh=!1,Dh!==null&&Rh(Dh)&&(Dh=null),Oh!==null&&Rh(Oh)&&(Oh=null),kh!==null&&Rh(kh)&&(kh=null),Ah.forEach(zh),jh.forEach(zh)}function Vh(e,n){e.blockedOn===n&&(e.blockedOn=null,Eh||(Eh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Bh)))}var Hh=null;function Uh(e){Hh!==e&&(Hh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Hh===e&&(Hh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(wh(r||n)===null)continue;break}var a=Ot(n);a!==null&&(e.splice(t,3),t-=3,Ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Wh(e){function t(t){return Vh(t,e)}Dh!==null&&Vh(Dh,e),Oh!==null&&Vh(Oh,e),kh!==null&&Vh(kh,e),Ah.forEach(t),jh.forEach(t);for(var n=0;n<Mh.length;n++){var r=Mh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Mh.length&&(n=Mh[0],n.blockedOn===null);)Lh(n),n.blockedOn===null&&Mh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[vt]||null;if(typeof a==`function`)o||Uh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[vt]||null)s=o.formAction;else if(wh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Uh(n)}}}function Gh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Kh(e){this._internalRoot=e}qh.prototype.render=Kh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ph(n,Md(),e,t,null,null)},qh.prototype.unmount=Kh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ph(e.current,2,null,e,null,null),Bd(),t[yt]=null}};function qh(e){this._internalRoot=e}qh.prototype.unstable_scheduleHydration=function(e){if(e){var t=mt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Mh.length&&t!==0&&t<Mh[n].priority;n++);Mh.splice(n,0,e),n===0&&Lh(e)}};var Jh=n.version;if(Jh!==`19.3.0`)throw Error(i(527,Jh,`19.3.0`));B.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Yh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:z,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Xh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xh.isDisabled&&Xh.supportsFiber)try{We=Xh.inject(Yh),Ge=Xh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=vc,s=yc,c=bc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=dh(e,1,!1,null,null,n,r,null,o,s,c,Gh),e[yt]=t.current,qf(e),new Kh(t)}})),_i=i(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=gi()})),vi=/(https?:\/\/[^\s"<>`{}|\\^]+)/,yi=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,bi=/^data:image\//i,xi=[`avatars.githubusercontent.com`];function Si(e){return bi.test(e)?[{type:`image`,url:e}]:e.split(vi).filter(e=>e!==``).map(e=>vi.test(e)?yi.test(e)||bi.test(e)||xi.some(t=>e.includes(t))?{type:`image`,url:e}:{type:`url`,url:e}:{type:`text`,value:e})}var Ci=new RegExp(vi.source,`g`);BigInt.prototype.toJSON=function(){return JSON.rawJSON(this.toString())};function wi(e){try{return JSON.parse(e,(e,t)=>Oi(t))}catch{}if(e==null||e===``)return{};try{return e??=``,e=e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g,`"◐$1◐"`),JSON.parse(e,(e,t)=>typeof t==`string`?t===`◐NaN◐`?NaN:t===`◐Infinity◐`?1/0:t===`◐-Infinity◐`?-1/0:Oi(t):Oi(t))}catch{return{}}}function Ti(e){if(e.length===0)return``;let t=Object.keys(e[0]);return[`| ${t.join(` | `)} |`,`|${t.map(()=>`---`).join(`|`)}|`,...e.map(e=>`| ${t.map(t=>Ei(e[t])).join(` | `)} |`)].join(`
9
+ `+e.stack}}var Ae=Object.prototype.hasOwnProperty,je=t.unstable_scheduleCallback,Me=t.unstable_cancelCallback,Ne=t.unstable_shouldYield,Pe=t.unstable_requestPaint,Fe=t.unstable_now,Ie=t.unstable_getCurrentPriorityLevel,Le=t.unstable_ImmediatePriority,Re=t.unstable_UserBlockingPriority,ze=t.unstable_NormalPriority,Be=t.unstable_LowPriority,Ve=t.unstable_IdlePriority,He=t.log,Ue=t.unstable_setDisableYieldValue,We=null,Ge=null;function Ke(e){if(typeof He==`function`&&Ue(e),Ge&&typeof Ge.setStrictMode==`function`)try{Ge.setStrictMode(We,e)}catch{}}var qe=Math.clz32?Math.clz32:Xe,Je=Math.log,Ye=Math.LN2;function Xe(e){return e>>>=0,e===0?32:31-(Je(e)/Ye|0)|0}var Ze=256,Qe=262144,$e=4194304;function et(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function tt(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=et(n))):i=et(o):i=et(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=et(n))):i=et(o)):i=et(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function nt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function rt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-qe(n),i=1<<r;t|=e[r],n&=~i}return t}function it(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function at(){var e=$e;return $e<<=1,!($e&62914560)&&($e=4194304),e}function ot(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function st(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ct(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-qe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&lt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function lt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-qe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ut(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-qe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function dt(e,t){var n=t&-t;return n=n&42?1:ft(n),(n&(e.suspendedLanes|t))===0?n:0}function ft(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function pt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function mt(){var e=B.p;return e===0?(e=window.event,e===void 0?32:Th(e.type)):e}function ht(e,t){var n=B.p;try{return B.p=e,t()}finally{B.p=n}}var gt=Math.random().toString(36).slice(2),_t=`__reactFiber$`+gt,vt=`__reactProps$`+gt,yt=`__reactContainer$`+gt,bt=`__reactEvents$`+gt,xt=`__reactListeners$`+gt,St=`__reactHandles$`+gt,Ct=`__reactResources$`+gt,wt=`__reactMarker$`+gt,Tt=`__reactLoad$`+gt;function Et(e){delete e[_t],delete e[vt],delete e[xt],delete e[St]}function Dt(e){var t;if(t=e[_t])return t;for(var n=e.parentNode;n;){if(t=n[yt]||n[_t]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hm(e);e!==null;){if(n=e[_t])return n;e=hm(e)}return t}e=n,n=e.parentNode}return null}function Ot(e){if(e=e[_t]||e[yt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function U(e){var t=e[Ct];return t||=e[Ct]={hoistableStyles:new Map,hoistableScripts:new Map},t}function At(e){e[wt]=!0}function jt(e){e[Tt]=void 0}var Mt=new Set,Nt={};function Pt(e,t){Ft(e,t),Ft(e+`Capture`,t)}function Ft(e,t){for(Nt[e]=t,e=0;e<t.length;e++)Mt.add(t[e])}var It=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Lt={},Rt={};function zt(e){return Ae.call(Rt,e)?!0:Ae.call(Lt,e)?!1:It.test(e)?Rt[e]=!0:(Lt[e]=!0,!1)}var Bt=!1;function Vt(){var e=Bt;return Bt=!1,e}function Ht(e,t,n){if(zt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Ut(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Wt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function Gt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Kt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function qt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Jt(e){if(!e._valueTracker){var t=Kt(e)?`checked`:`value`;e._valueTracker=qt(e,t,``+e[t])}}function Yt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Kt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Xt=/[\n"\\]/g;function Zt(e){return e.replace(Xt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Qt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Gt(t)):e.value!==``+Gt(t)&&(e.value=``+Gt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):en(e,Gt(n)):o===`number`&&e.value==t?en(e,Gt(e.value)):en(e,Gt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Gt(s):e.removeAttribute(`name`)}function $t(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Jt(e);return}n=n==null?``:``+Gt(n),t=t==null?n:``+Gt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Jt(e)}function en(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function tn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Gt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function nn(e,t,n){if(t!=null&&(t=``+Gt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Gt(n)}function rn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ue(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Gt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Jt(e)}function an(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var on=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function sn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||on.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function W(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,Bt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(sn(e,a,r),Bt=!0)}else for(var o in t)t.hasOwnProperty(o)&&sn(e,o,t[o])}function cn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var ln=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),un=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function dn(e){return un.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function fn(){}var pn=null;function mn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var hn=null,gn=null;function _n(e){var t=Ot(e);if(t&&(e=t.stateNode)){var n=e[vt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Qt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Zt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[vt]||null;if(!a)throw Error(i(90));Qt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Yt(r)}break a;case`textarea`:nn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&tn(e,!!n.multiple,t,!1)}}}var vn=!1;function yn(e,t,n){if(vn)return e(t,n);vn=!0;try{return e(t)}finally{if(vn=!1,(hn!==null||gn!==null)&&(Bd(),hn&&(t=hn,e=gn,gn=hn=null,_n(t),e)))for(t=0;t<e.length;t++)_n(e[t])}}function bn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[vt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var xn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),Sn=!1;if(xn)try{var Cn={};Object.defineProperty(Cn,"passive",{get:function(){Sn=!0}}),window.addEventListener(`test`,Cn,Cn),window.removeEventListener(`test`,Cn,Cn)}catch{Sn=!1}var wn=null,Tn=null,En=null;function Dn(){if(En)return En;var e,t=Tn,n=t.length,r,i=`value`in wn?wn.value:wn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return En=i.slice(e,1<r?1-r:void 0)}function On(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function kn(){return!0}function An(){return!1}function jn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?kn:An,this.isPropagationStopped=An,this}return E(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=kn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=kn)},persist:function(){},isPersistent:kn}),t}var Mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Nn=jn(Mn),Pn=E({},Mn,{view:0,detail:0}),Fn=jn(Pn),In,Ln,Rn,zn=E({},Pn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Rn&&(Rn&&e.type===`mousemove`?(In=e.screenX-Rn.screenX,Ln=e.screenY-Rn.screenY):Ln=In=0,Rn=e),In)},movementY:function(e){return`movementY`in e?e.movementY:Ln}}),Bn=jn(zn),Vn=jn(E({},zn,{dataTransfer:0})),Hn=jn(E({},Pn,{relatedTarget:0})),G=jn(E({},Mn,{animationName:0,elapsedTime:0,pseudoElement:0})),Un=jn(E({},Mn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Wn=jn(E({},Mn,{data:0})),Gn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Kn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},qn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=qn[e])?!!t[e]:!1}function Yn(){return Jn}var Xn=jn(E({},Pn,{key:function(e){if(e.key){var t=Gn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=On(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yn,charCode:function(e){return e.type===`keypress`?On(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?On(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Zn=jn(E({},zn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Qn=jn(E({},Mn,{submitter:0})),$n=jn(E({},Pn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yn})),er=jn(E({},Mn,{propertyName:0,elapsedTime:0,pseudoElement:0})),tr=jn(E({},zn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),nr=jn(E({},Mn,{newState:0,oldState:0,source:0})),rr=[9,13,27,32],ir=xn&&`CompositionEvent`in window,ar=null;xn&&`documentMode`in document&&(ar=document.documentMode);var or=xn&&`TextEvent`in window&&!ar,sr=xn&&(!ir||ar&&8<ar&&11>=ar),cr=` `,lr=!1;function ur(e,t){switch(e){case`keyup`:return rr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function dr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var fr=!1;function pr(e,t){switch(e){case`compositionend`:return dr(t);case`keypress`:return t.which===32?(lr=!0,cr):null;case`textInput`:return e=t.data,e===cr&&lr?null:e;default:return null}}function mr(e,t){if(fr)return e===`compositionend`||!ir&&ur(e,t)?(e=Dn(),En=Tn=wn=null,fr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return sr&&t.locale!==`ko`?null:t.data;default:return null}}var hr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function gr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!hr[e.type]:t===`textarea`}function _r(e,t,n,r){hn?gn?gn.push(r):gn=[r]:hn=r,t=Zf(t,`onChange`),0<t.length&&(n=new Nn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var vr=null,yr=null;function br(e){Uf(e,0)}function xr(e){if(Yt(kt(e)))return e}function Sr(e,t){if(e===`change`)return t}var Cr=!1;if(xn){var wr;if(xn){var Tr=`oninput`in document;if(!Tr){var Er=document.createElement(`div`);Er.setAttribute(`oninput`,`return;`),Tr=typeof Er.oninput==`function`}wr=Tr}else wr=!1;Cr=wr&&(!document.documentMode||9<document.documentMode)}function Dr(){vr&&(vr.detachEvent(`onpropertychange`,Or),yr=vr=null)}function Or(e){if(e.propertyName===`value`&&xr(yr)){var t=[];_r(t,yr,e,mn(e)),yn(br,t)}}function kr(e,t,n){e===`focusin`?(Dr(),vr=t,yr=n,vr.attachEvent(`onpropertychange`,Or)):e===`focusout`&&Dr()}function Ar(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return xr(yr)}function jr(e,t){if(e===`click`)return xr(t)}function Mr(e,t){if(e===`input`||e===`change`)return xr(t)}function Nr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Pr=typeof Object.is==`function`?Object.is:Nr;function Fr(e,t){if(Pr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Ae.call(t,i)||!Pr(e[i],t[i]))return!1}return!0}function Ir(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Lr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Rr(e,t){var n=Lr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Lr(n)}}function zr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?zr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ir(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ir(e.document)}return t}function Vr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Hr=xn&&`documentMode`in document&&11>=document.documentMode,Ur=null,Wr=null,Gr=null,Kr=!1;function qr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Kr||Ur==null||Ur!==Ir(r)||(r=Ur,`selectionStart`in r&&Vr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Gr&&Fr(Gr,r)||(Gr=r,r=Zf(Wr,`onSelect`),0<r.length&&(t=new Nn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ur)))}function Jr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Yr={animationend:Jr(`Animation`,`AnimationEnd`),animationiteration:Jr(`Animation`,`AnimationIteration`),animationstart:Jr(`Animation`,`AnimationStart`),transitionrun:Jr(`Transition`,`TransitionRun`),transitionstart:Jr(`Transition`,`TransitionStart`),transitioncancel:Jr(`Transition`,`TransitionCancel`),transitionend:Jr(`Transition`,`TransitionEnd`)},Xr={},Zr={};xn&&(Zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Yr.animationend.animation,delete Yr.animationiteration.animation,delete Yr.animationstart.animation),`TransitionEvent`in window||delete Yr.transitionend.transition);function Qr(e){if(Xr[e])return Xr[e];if(!Yr[e])return e;var t=Yr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Zr)return Xr[e]=t[n];return e}var $r=Qr(`animationend`),ei=Qr(`animationiteration`),ti=Qr(`animationstart`),ni=Qr(`transitionrun`),ri=Qr(`transitionstart`),ii=Qr(`transitioncancel`),ai=Qr(`transitionend`),oi=new Map,si=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);si.push(`scrollEnd`);function ci(e,t){oi.set(e,t),Pt(t,[e])}var li=0;function ui(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=xd.identifierPrefix;var n=li++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function di(e){if(e==null||typeof e==`string`)return e;var t=null,n=kd;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function fi(e,t){return e=di(e),t=di(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var pi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},mi=[],gi=0,_i=0;function vi(){for(var e=gi,t=_i=gi=0;t<e;){var n=mi[t];mi[t++]=null;var r=mi[t];mi[t++]=null;var i=mi[t];mi[t++]=null;var a=mi[t];if(mi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Si(n,i,a)}}function yi(e,t,n,r){mi[gi++]=e,mi[gi++]=t,mi[gi++]=n,mi[gi++]=r,_i|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function bi(e,t,n,r){return yi(e,t,n,r),Ci(e)}function xi(e,t){return yi(e,null,null,t),Ci(e)}function Si(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-qe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Ci(e){if(50<Ad)throw Ad=0,jd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var wi={};function Ti(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ei(e,t,n,r){return new Ti(e,t,n,r)}function Di(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Oi(e,t){var n=e.alternate;return n===null?(n=Ei(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ki(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ai(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Di(r)&&(s=1);else if(typeof r==`string`)s=Ym(e,n,ge.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ie:return e=Ei(31,n,t,a),e.elementType=ie,e.lanes=o,e;case A:return ji(n.children,a,o,t);case j:s=8,a|=24;break;case M:return e=Ei(12,n,t,a|2),e.elementType=M,e.lanes=o,e;case te:return e=Ei(13,n,t,a),e.elementType=te,e.lanes=o,e;case ne:return e=Ei(19,n,t,a),e.elementType=ne,e.lanes=o,e;case I:case L:return e=a|32,e=Ei(30,n,t,e),e.elementType=L,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case P:s=10;break a;case N:s=9;break a;case ee:s=11;break a;case re:s=14;break a;case F:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Ei(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ji(e,t,n,r){return e=Ei(7,e,r,t),e.lanes=n,e}function Mi(e,t,n){return e=Ei(6,e,null,t),e.lanes=n,e}function Ni(e){var t=Ei(18,null,null,0);return t.stateNode=e,t}function Pi(e,t,n){return t=Ei(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Fi=new WeakMap;function Ii(e,t){if(typeof e==`object`&&e){var n=Fi.get(e);return n===void 0?(t={value:e,source:t,stack:ke(t)},Fi.set(e,t),t):n}return{value:e,source:t,stack:ke(t)}}var Li=[],Ri=0,zi=null,Bi=0,Vi=[],Hi=0,Ui=null,Wi=1,Gi=``;function K(e,t){Li[Ri++]=Bi,Li[Ri++]=zi,zi=e,Bi=t}function q(e,t,n){Vi[Hi++]=Wi,Vi[Hi++]=Gi,Vi[Hi++]=Ui,Ui=e;var r=Wi;e=Gi;var i=32-qe(r)-1;r&=~(1<<i),n+=1;var a=32-qe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Wi=1<<32-qe(t)+i|n<<i|r,Gi=a+e}else Wi=1<<a|n<<i|r,Gi=e}function Ki(e){e.return!==null&&(K(e,1),q(e,1,0))}function qi(e){for(;e===zi;)zi=Li[--Ri],Li[Ri]=null,Bi=Li[--Ri],Li[Ri]=null;for(;e===Ui;)Ui=Vi[--Hi],Vi[Hi]=null,Gi=Vi[--Hi],Vi[Hi]=null,Wi=Vi[--Hi],Vi[Hi]=null}function Ji(e,t){Vi[Hi++]=Wi,Vi[Hi++]=Gi,Vi[Hi++]=Ui,Wi=t.id,Gi=t.overflow,Ui=e}var Yi=null,Xi=null,Zi=!1,Qi=null,$i=!1,ea=Error(i(519));function ta(e){throw sa(Ii(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ea}function na(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[_t]=e,t[vt]=r,n){case`dialog`:Wf(`cancel`,t),Wf(`close`,t);break;case`iframe`:case`object`:case`embed`:Wf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Vf.length;n++)Wf(Vf[n],t);break;case`source`:Wf(`error`,t);break;case`img`:case`image`:case`link`:Wf(`error`,t),Wf(`load`,t);break;case`details`:Wf(`toggle`,t);break;case`input`:Wf(`invalid`,t),$t(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Wf(`invalid`,t);break;case`textarea`:Wf(`invalid`,t),rn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||rp(t.textContent,n)?(r.popover!=null&&(Wf(`beforetoggle`,t),Wf(`toggle`,t)),r.onScroll!=null&&Wf(`scroll`,t),r.onScrollEnd!=null&&Wf(`scrollend`,t),r.onClick!=null&&(t.onclick=fn),t=!0):t=!1,t||ta(e,!0)}function ra(e){for(Yi=e.return;Yi;)switch(Yi.tag){case 5:case 31:case 13:$i=!1;return;case 27:case 3:$i=!0;return;default:Yi=Yi.return}}function ia(e){if(e!==Yi)return!1;if(!Zi)return ra(e),Zi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||_p(e.type,e.memoizedProps)),n=!n),n&&Xi&&ta(e),ra(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Xi=mm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Xi=mm(e)}else t===27?(t=Xi,Ep(e.type)?(e=pm,pm=null,Xi=e):Xi=t):Xi=Yi?fm(e.stateNode.nextSibling):null;return!0}function aa(){Xi=Yi=null,Zi=!1}function oa(){var e=Qi;return e!==null&&(pd===null?pd=e:pd.push.apply(pd,e),Qi=null),e}function sa(e){Qi===null?Qi=[e]:Qi.push(e)}var ca=me(null),la=null,ua=null;function da(e,t,n){V(ca,t._currentValue),t._currentValue=n}function fa(e){e._currentValue=ca.current,he(ca)}function pa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ma(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),pa(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),pa(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),pa(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ha(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Pr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ye.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[lh]:e.push(lh))}a=a.return}return e!==null&&ma(t,e,n,r),t.flags|=262144,e!==null}function ga(e){for(e=e.firstContext;e!==null;){if(!Pr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function _a(e){la=e,ua=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function va(e){return ba(la,e)}function ya(e,t){return la===null&&_a(e),ba(e,t)}function ba(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ua===null){if(e===null)throw Error(i(308));ua=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ua=ua.next=t;return n}var xa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Sa=t.unstable_scheduleCallback,Ca=t.unstable_NormalPriority,wa={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ta(){return{controller:new xa,data:new Map,refCount:0}}function Ea(e){e.refCount--,e.refCount===0&&Sa(Ca,function(){e.controller.abort()})}function Da(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Oa=null;function ka(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Aa=null,ja=0,Ma=0,Na=null;function Pa(e,t){if(Aa===null){var n=Aa=[];ja=0,Ma=If(),Na={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ja++,t.then(Fa,Fa),t}function Fa(){if(--ja===0&&(Oa=null,Aa!==null)){Na!==null&&(Na.status=`fulfilled`);var e=Aa;Aa=null,Ma=0,Na=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ia(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var La=z.S;z.S=function(e,t){if(gd=Fe(),typeof t==`object`&&t&&typeof t.then==`function`&&Pa(e,t),Oa!==null)for(var n=Sf;n!==null;)Da(n,Oa),n=n.next;if(n=e.types,n!==null){for(var r=Sf;r!==null;)Da(r,n),r=r.next;if(Ma!==0){r=Oa,r===null&&(r=Oa=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}La!==null&&La(e,t)};var Ra=me(null);function za(){var e=Ra.current;return e===null?Zu.pooledCache:e}function Ba(e,t){t===null?V(Ra,Ra.current):V(Ra,t.pool)}function Va(){var e=za();return e===null?null:{parent:wa._currentValue,pool:e}}var Ha=Error(i(460)),Ua=Error(i(474)),Wa=Error(i(542)),Ga={then:function(){}};function Ka(e){return e=e.status,e===`fulfilled`||e===`rejected`}function qa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(fn,fn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Za(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(fn,fn);else{if(e=Zu,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Za(e),e}throw Ya=t,Ha}}function Ja(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ya=e,Ha):e}}var Ya=null;function Xa(){if(Ya===null)throw Error(i(459));var e=Ya;return Ya=null,e}function Za(e){if(e===Ha||e===Wa)throw Error(i(483))}var Qa=null,$a=0;function eo(e){var t=$a;return $a+=1,Qa===null&&(Qa=[]),qa(Qa,e,t)}function to(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function no(e,t){throw t.$$typeof===D?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ro(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Oi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Mi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===A?(e=d(e,t,n.props.children,r,n.key),to(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===F&&Ja(i)===t.type)?(t=a(t,n.props),to(t,n),t.return=e,t):(t=Ai(n.type,n.key,n.props,null,e.mode,r),to(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Pi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ji(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case O:return n=Ai(t.type,t.key,t.props,null,e.mode,n),to(n,t),n.return=e,n;case k:return t=Pi(t,e.mode,n),t.return=e,t;case F:return t=Ja(t),f(e,t,n)}if(ue(t)||R(t))return t=ji(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,eo(t),n);if(t.$$typeof===P)return f(e,ya(e,t),n);no(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case O:return n.key===i?l(e,t,n,r):null;case k:return n.key===i?u(e,t,n,r):null;case F:return n=Ja(n),p(e,t,n,r)}if(ue(n)||R(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,eo(n),r);if(n.$$typeof===P)return p(e,t,ya(e,n),r);no(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case O:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case k:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case F:return r=Ja(r),m(e,t,n,r,i)}if(ue(r)||R(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,eo(r),i);if(r.$$typeof===P)return m(e,t,n,ya(t,r),i);no(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Zi&&K(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Zi&&K(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Zi&&K(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Zi&&K(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Zi&&K(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Zi&&K(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===A&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case O:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===A){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),to(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===F&&Ja(l)===r.type){n(e,r.sibling),c=a(r,o.props),to(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===A?(c=ji(o.props.children,e.mode,c,o.key),to(c,o),c.return=e,e=c):(c=Ai(o.type,o.key,o.props,null,e.mode,c),to(c,o),c.return=e,e=c)}return s(e);case k:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Pi(o,e.mode,c),c.return=e,e=c}return s(e);case F:return o=Ja(o),_(e,r,o,c)}if(ue(o))return h(e,r,o,c);if(R(o)){if(l=R(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,eo(o),c);if(o.$$typeof===P)return _(e,r,ya(e,o),c);no(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{$a=0;var i=_(e,t,n,r);return Qa=null,i}catch(t){if(t===Ha||t===Wa)throw t;var a=Ei(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var io=ro(!0),ao=ro(!1),oo=!1;function so(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function co(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function lo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function uo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Xu&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Ci(e),Si(e,null,n),t}return yi(e,r,t,n),Ci(e)}function fo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ut(e,n)}}function po(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var mo=!1;function ho(){if(mo){var e=Na;if(e!==null)throw e}}function go(e,t,n,r){mo=!1;var i=e.updateQueue;oo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?($u&f)===f:(r&f)===f){f!==0&&f===Ma&&(mo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=E({},d,f);break a;case 2:oo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),sd|=o,e.lanes=o,e.memoizedState=d}}function _o(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function vo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)_o(n[e],t)}var yo=me(null),bo=me(0);function xo(e,t){e=ad,V(bo,e),V(yo,t),ad=e|t.baseLanes}function So(){V(bo,ad),V(yo,yo.current)}function Co(){ad=bo.current,he(yo),he(bo)}var wo=me(null),To=null;function Eo(e){var t=e.alternate;V(jo,jo.current&1),V(wo,e),To===null&&(t===null||yo.current!==null||t.memoizedState!==null)&&(To=e)}function Do(e){V(jo,jo.current),V(wo,e),To===null&&(To=e)}function Oo(e){e.tag===22?(V(jo,jo.current),V(wo,e),To===null&&(To=e)):ko()}function ko(){V(jo,jo.current),V(wo,wo.current)}function Ao(e){he(wo),To===e&&(To=null),he(jo)}var jo=me(0);function Mo(e,t){V(wo,wo.current),V(jo,t)}function No(e){he(jo),he(wo),To===e&&(To=null)}function Po(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lm(n)||um(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Fo=0,J=null,Io=null,Lo=null,Ro=!1,zo=!1,Bo=!1,Vo=0,Ho=0,Uo=null,Wo=0;function Go(){throw Error(i(321))}function Ko(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Pr(e[n],t[n]))return!1;return!0}function qo(e,t,n,r,i,a){return Fo=a,J=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?uc:dc,Bo=!1,a=n(r,i),Bo=!1,zo&&(a=Yo(t,n,r,i)),Jo(e),a}function Jo(e){z.H=lc;var t=Io!==null&&Io.next!==null;if(Fo=0,Lo=Io=J=null,Ro=!1,Ho=0,Uo=null,t)throw Error(i(300));e===null||Oc||(e=e.dependencies,e!==null&&ga(e)&&(Oc=!0))}function Yo(e,t,n,r){J=e;var a=0;do{if(zo&&(Uo=null),Ho=0,zo=!1,25<=a)throw Error(i(301));if(a+=1,Lo=Io=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}z.H=fc,o=t(n,r)}while(zo);return o}function Xo(){var e=z.H,t=e.useState()[0];return t=typeof t.then==`function`?rs(t):t,e=e.useState()[0],(Io===null?null:Io.memoizedState)!==e&&(J.flags|=1024),t}function Zo(){var e=Vo!==0;return Vo=0,e}function Qo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function $o(e){if(Ro){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ro=!1}Fo=0,Lo=Io=J=null,zo=!1,Ho=Vo=0,Uo=null}function es(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lo===null?J.memoizedState=Lo=e:Lo=Lo.next=e,Lo}function ts(){if(Io===null){var e=J.alternate;e=e===null?null:e.memoizedState}else e=Io.next;var t=Lo===null?J.memoizedState:Lo.next;if(t!==null)Lo=t,Io=e;else{if(e===null)throw J.alternate===null?Error(i(467)):Error(i(310));Io=e,e={memoizedState:Io.memoizedState,baseState:Io.baseState,baseQueue:Io.baseQueue,queue:Io.queue,next:null},Lo===null?J.memoizedState=Lo=e:Lo=Lo.next=e}return Lo}function ns(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rs(e){var t=Ho;return Ho+=1,Uo===null&&(Uo=[]),e=qa(Uo,e,t),t=J,(Lo===null?t.memoizedState:Lo.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?uc:dc),e}function is(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return rs(e);if(e.$$typeof===oe)return;if(e.$$typeof===P)return va(e)}throw Error(i(438,String(e)))}function as(e){var t=null,n=J.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=J.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ns(),J.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ae;return t.index++,n}function os(e,t){return typeof t==`function`?t(e):t}function ss(e){return cs(ts(),Io,e)}function cs(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Fo&f)===f:($u&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Ma&&(d=!0);else if((Fo&p)===p){u=u.next,p===Ma&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,J.lanes|=p,sd|=p;f=u.action,Bo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,J.lanes|=f,sd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Pr(o,e.memoizedState)&&(Oc=!0,d&&(n=Na,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function ls(e){var t=ts(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Pr(o,t.memoizedState)||(Oc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function us(e,t,n){var r=J,a=ts(),o=Zi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Pr((Io||a).memoizedState,n);if(s&&(a.memoizedState=n,Oc=!0),a=a.queue,Fs(ps.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Lo!==null&&!!(Lo.memoizedState.tag&1),As(e?9:8,{destroy:void 0},fs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,Zu===null)throw Error(i(349));o||Fo&127||ds(r,t,n)}return n}function ds(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=J.updateQueue,t===null?(t=ns(),J.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function fs(e,t,n,r){t.value=n,t.getSnapshot=r,ms(t)&&hs(e)}function ps(e,t,n){return n(function(){ms(t)&&hs(e)})}function ms(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Pr(e,n)}catch{return!0}}function hs(e){var t=xi(e,2);t!==null&&Fd(t,e,2)}function gs(e){var t=es();if(typeof e==`function`){var n=e;if(e=n(),Bo){Ke(!0);try{n()}finally{Ke(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:e},t}function _s(e,t,n,r){return e.baseState=n,cs(e,Io,typeof r==`function`?r:os)}function vs(e,t,n,r,a){if(oc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};z.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,ys(t,o)):(o.next=n.next,t.pending=n.next=o)}}function ys(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=z.T,o={};o.types=a===null?null:a.types,z.T=o;try{var s=n(i,r),c=z.S;c!==null&&c(o,s),bs(e,t,s)}catch(n){Ss(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),z.T=a}}else try{a=n(i,r),bs(e,t,a)}catch(n){Ss(e,t,n)}}function bs(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){xs(e,t,n)},function(n){return Ss(e,t,n)}):xs(e,t,n)}function xs(e,t,n){t.status=`fulfilled`,t.value=n,Cs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ys(e,n)))}function Ss(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Cs(t),t=t.next;while(t!==r)}e.action=null}function Cs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ws(e,t){return t}function Ts(e,t){if(Zi){var n=Zu.formState;if(n!==null){a:{var r=J;if(Zi){if(Xi){b:{for(var i=Xi,a=$i;i.nodeType!==8;){if(!a){i=null;break b}if(i=fm(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Xi=fm(i.nextSibling),r=i.data===`F!`;break a}}ta(r)}r=!1}r&&(t=n[0])}}return n=es(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ws,lastRenderedState:t},n.queue=r,n=rc.bind(null,J,r),r.dispatch=n,r=gs(!1),a=ac.bind(null,J,!1,r.queue),r=es(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=vs.bind(null,J,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Es(e){return Ds(ts(),Io,e)}function Ds(e,t,n){if(t=cs(e,t,ws)[0],e=ss(os)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=rs(t)}catch(e){throw e===Ha?Wa:e}else r=t;t=ts();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(J.flags|=2048,As(9,{destroy:void 0},Os.bind(null,i,n),null)),[r,a,e]}function Os(e,t){e.action=t}function ks(e){var t=ts(),n=Io;if(n!==null)return Ds(t,n,e);ts(),t=t.memoizedState,n=ts();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function As(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=J.updateQueue,t===null&&(t=ns(),J.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function js(){return ts().memoizedState}function Ms(e,t,n,r){var i=es();J.flags|=e,i.memoizedState=As(1|t,{destroy:void 0},n,r===void 0?null:r)}function Ns(e,t,n,r){var i=ts();r=r===void 0?null:r;var a=i.memoizedState.inst;Io!==null&&r!==null&&Ko(r,Io.memoizedState.deps)?i.memoizedState=As(t,a,n,r):(J.flags|=e,i.memoizedState=As(1|t,a,n,r))}function Ps(e,t){Ms(8390656,8,e,t)}function Fs(e,t){Ns(2048,8,e,t)}function Is(e){J.flags|=4;var t=J.updateQueue;if(t===null)t=ns(),J.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ls(e){var t=ts().memoizedState;return Is({ref:t,nextImpl:e}),function(){if(Xu&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Rs(e,t){return Ns(4,2,e,t)}function zs(e,t){return Ns(4,4,e,t)}function Bs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Vs(e,t,n){n=n==null?null:n.concat([e]),Ns(4,4,Bs.bind(null,t,e),n)}function Hs(){}function Us(e,t){var n=ts();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Ko(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ws(e,t){var n=ts();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Ko(t,r[1]))return r[0];if(r=e(),Bo){Ke(!0);try{e()}finally{Ke(!1)}}return n.memoizedState=[r,t],r}function Gs(e,t,n){return n===void 0||Fo&1073741824&&!($u&261930)?e.memoizedState=t:(e.memoizedState=n,e=Nd(),J.lanes|=e,sd|=e,n)}function Ks(e,t,n,r){return Pr(n,t)?n:yo.current===null?!(Fo&106)||Fo&1073741824&&!($u&261930)?(Oc=!0,e.memoizedState=n):(e=Nd(),J.lanes|=e,sd|=e,t):(e=Gs(e,n,r),Pr(e,t)||(Oc=!0),e)}function qs(e,t,n,r,i){var a=B.p;B.p=a!==0&&8>a?a:8;var o=z.T,s={};s.types=o===null?null:o.types,z.T=s,ac(e,!1,t,n);try{var c=i(),l=z.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ic(e,t,Ia(c,r),Md(e)):ic(e,t,r,Md(e))}catch(n){ic(e,t,{then:function(){},status:`rejected`,reason:n},Md())}finally{B.p=a,o!==null&&s.types!==null&&(o.types=s.types),z.T=o}}function Js(){}function Ys(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Xs(e).queue;qs(e,a,t,de,n===null?Js:function(){return Zs(e),n(r)})}function Xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:de},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Zs(e){var t=Xs(e);t.next===null&&(t=e.alternate.memoizedState),ic(e,t.next.queue,{},Md())}function Qs(){return va(lh)}function $s(){return ts().memoizedState}function ec(){return ts().memoizedState}function tc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Md();e=lo(n);var r=uo(t,e,n);r!==null&&(Fd(r,t,n),fo(r,t,n)),t={cache:Ta()},e.payload=t;return}t=t.return}}function nc(e,t,n){var r=Md();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},oc(e)?sc(t,n):(n=bi(e,t,n,r),n!==null&&(Fd(n,e,r),cc(n,t,r)))}function rc(e,t,n){ic(e,t,n,Md())}function ic(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(oc(e))sc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Pr(s,o))return yi(e,t,i,0),Zu===null&&vi(),!1}catch{}if(n=bi(e,t,i,r),n!==null)return Fd(n,e,r),cc(n,t,r),!0}return!1}function ac(e,t,n,r){if(r={lane:2,revertLane:If(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},oc(e)){if(t)throw Error(i(479))}else t=bi(e,n,r,2),t!==null&&Fd(t,e,2)}function oc(e){var t=e.alternate;return e===J||t!==null&&t===J}function sc(e,t){zo=Ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ut(e,n)}}var lc={readContext:va,use:is,useCallback:Go,useContext:Go,useEffect:Go,useImperativeHandle:Go,useLayoutEffect:Go,useInsertionEffect:Go,useMemo:Go,useReducer:Go,useRef:Go,useState:Go,useDebugValue:Go,useDeferredValue:Go,useTransition:Go,useSyncExternalStore:Go,useId:Go,useHostTransitionStatus:Go,useFormState:Go,useActionState:Go,useOptimistic:Go,useMemoCache:Go,useCacheRefresh:Go,useEffectEvent:Go},uc={readContext:va,use:is,useCallback:function(e,t){return es().memoizedState=[e,t===void 0?null:t],e},useContext:va,useEffect:Ps,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Ms(4194308,4,Bs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ms(4194308,4,e,t)},useInsertionEffect:function(e,t){Ms(4,2,e,t)},useMemo:function(e,t){var n=es();t=t===void 0?null:t;var r=e();if(Bo){Ke(!0);try{e()}finally{Ke(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=es();if(n!==void 0){var i=n(t);if(Bo){Ke(!0);try{n(t)}finally{Ke(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=nc.bind(null,J,e),[r.memoizedState,e]},useRef:function(e){var t=es();return e={current:e},t.memoizedState=e},useState:function(e){e=gs(e);var t=e.queue,n=rc.bind(null,J,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Hs,useDeferredValue:function(e,t){return Gs(es(),e,t)},useTransition:function(){var e=gs(!1);return e=qs.bind(null,J,e.queue,!0,!1),es().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=J,a=es();if(Zi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Zu===null)throw Error(i(349));$u&127||ds(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Ps(ps.bind(null,r,o,e),[e]),r.flags|=2048,As(9,{destroy:void 0},fs.bind(null,r,o,n,t),null),n},useId:function(){var e=es(),t=Zu.identifierPrefix;if(Zi){var n=Gi,r=Wi;n=(r&~(1<<32-qe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Vo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Wo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Qs,useFormState:Ts,useActionState:Ts,useOptimistic:function(e){var t=es();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ac.bind(null,J,!0,n),n.dispatch=t,[e,t]},useMemoCache:as,useCacheRefresh:function(){return es().memoizedState=tc.bind(null,J)},useEffectEvent:function(e){var t=es(),n={impl:e};return t.memoizedState=n,function(){if(Xu&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},dc={readContext:va,use:is,useCallback:Us,useContext:va,useEffect:Fs,useImperativeHandle:Vs,useInsertionEffect:Rs,useLayoutEffect:zs,useMemo:Ws,useReducer:ss,useRef:js,useState:function(){return ss(os)},useDebugValue:Hs,useDeferredValue:function(e,t){return Ks(ts(),Io.memoizedState,e,t)},useTransition:function(){var e=ss(os)[0],t=ts().memoizedState;return[typeof e==`boolean`?e:rs(e),t]},useSyncExternalStore:us,useId:$s,useHostTransitionStatus:Qs,useFormState:Es,useActionState:Es,useOptimistic:function(e,t){return _s(ts(),Io,e,t)},useMemoCache:as,useCacheRefresh:ec,useEffectEvent:Ls},fc={readContext:va,use:is,useCallback:Us,useContext:va,useEffect:Fs,useImperativeHandle:Vs,useInsertionEffect:Rs,useLayoutEffect:zs,useMemo:Ws,useReducer:ls,useRef:js,useState:function(){return ls(os)},useDebugValue:Hs,useDeferredValue:function(e,t){var n=ts();return Io===null?Gs(n,e,t):Ks(n,Io.memoizedState,e,t)},useTransition:function(){var e=ls(os)[0],t=ts().memoizedState;return[typeof e==`boolean`?e:rs(e),t]},useSyncExternalStore:us,useId:$s,useHostTransitionStatus:Qs,useFormState:ks,useActionState:ks,useOptimistic:function(e,t){var n=ts();return Io===null?(n.baseState=e,[e,n.queue.dispatch]):_s(n,Io,e,t)},useMemoCache:as,useCacheRefresh:ec,useEffectEvent:Ls};function pc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:E({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var mc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Md(),i=lo(r);i.payload=t,n!=null&&(i.callback=n),t=uo(e,i,r),t!==null&&(Fd(t,e,r),fo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Md(),i=lo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=uo(e,i,r),t!==null&&(Fd(t,e,r),fo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Md(),r=lo(n);r.tag=2,t!=null&&(r.callback=t),t=uo(e,r,n),t!==null&&(Fd(t,e,n),fo(t,e,n))}};function hc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Fr(n,r)||!Fr(i,a):!0}function gc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&mc.enqueueReplaceState(t,t.state,null)}function _c(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=E({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function vc(e){pi(e)}function yc(e){console.error(e)}function bc(e){pi(e)}function xc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Sc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Cc(e,t,n){return n=lo(n),n.tag=3,n.payload={element:null},n.callback=function(){xc(e,t)},n}function wc(e){return e=lo(e),e.tag=3,e}function Tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Sc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Sc(t,n,r),typeof i!=`function`&&(yd===null?yd=new Set([this]):yd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ec(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ha(t,n,a,!0),n=wo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return To===null?qd():n.alternate===null&&od===0&&(od=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ga?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),gf(e,r,a)),!1;case 22:return n.flags|=65536,r===Ga?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),gf(e,r,a)),!1}throw Error(i(435,n.tag))}return gf(e,r,a),qd(),!1}if(Zi)return t=wo.current,t===null?(r!==ea&&(t=Error(i(423),{cause:r}),sa(Ii(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Ii(r,n),a=Cc(e.stateNode,r,a),po(e,a),od!==4&&(od=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==ea&&(e=Error(i(422),{cause:r}),sa(Ii(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Ii(o,n),fd===null?fd=[o]:fd.push(o),od!==4&&(od=2),t===null)return!0;r=Ii(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Cc(n.stateNode,r,e),po(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(yd===null||!yd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=wc(a),Tc(a,e,n,r),po(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Dc=Error(i(461)),Oc=!1;function kc(e,t,n,r){t.child=e===null?ao(t,null,n,r):io(t,e.child,n,r)}function Ac(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return _a(t),r=qo(e,t,n,o,a,i),s=Zo(),e!==null&&!Oc?(Qo(e,t,i),il(e,t,i)):(Zi&&s&&Ki(t),t.flags|=1,kc(e,t,r,i),t.child)}function jc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Di(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Mc(e,t,a,r,i)):(e=Ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!al(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Fr:n,n(o,r)&&e.ref===t.ref)return il(e,t,i)}return t.flags|=1,e=Oi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Mc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Fr(a,r)&&e.ref===t.ref){if(Oc=!1,t.pendingProps=r=a,al(e,i))e.flags&131072&&(Oc=!0);else return t.lanes=e.lanes,il(e,t,i)}}return Bc(e,t,n,r,i)}function Nc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Fc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ba(t,a===null?null:a.cachePool),a===null?So():xo(t,a),Oo(t);else return r=t.lanes=536870912,Fc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ba(t,null),So(),ko()):(Ba(t,a.cachePool),xo(t,a),ko(),t.memoizedState=null);return kc(e,t,i,n),t.child}function Pc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Fc(e,t,n,r,i){var a=za();return a=a===null?null:{parent:wa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ba(t,null),So(),Oo(t),e!==null&&ha(e,t,r,!0),t.childLanes=i,null}function Ic(e,t){return t=Yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Lc(e,t,n){return io(t,e.child,null,n),e=Ic(t,t.pendingProps),e.flags|=2,Ao(t),t.memoizedState=null,e}function Rc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Zi){if(r.mode===`hidden`)return e=Ic(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Pc(null,e);if(Do(t),(e=Xi)?(e=cm(e,$i),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ui===null?null:{id:Wi,overflow:Gi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Yi=t,Xi=null)):e=null,e===null)throw ta(t);return t.lanes=536870912,null}return Ic(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Do(t),a){if(t.flags&256)t.flags&=-257,t=Lc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Oc||ha(e,t,n,!1),a=(n&e.childLanes)!==0,Oc||a){if(yo.current===null){if(r=Zu,r!==null&&(s=dt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,xi(e,s),Fd(r,e,s),Dc;qd()}t=Lc(e,t,n)}else e=o.treeContext,Xi=fm(s.nextSibling),Yi=t,Zi=!0,Qi=null,$i=!1,e!==null&&Ji(t,e),t=Ic(t,r),t.flags|=134221824;return t}return e=Oi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function zc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Bc(e,t,n,r,i){return _a(t),n=qo(e,t,n,r,void 0,i),r=Zo(),e!==null&&!Oc?(Qo(e,t,i),il(e,t,i)):(Zi&&r&&Ki(t),t.flags|=1,kc(e,t,n,i),t.child)}function Vc(e,t,n,r,i,a){return _a(t),t.updateQueue=null,n=Yo(t,r,n,i),Jo(e),r=Zo(),e!==null&&!Oc?(Qo(e,t,a),il(e,t,a)):(Zi&&r&&Ki(t),t.flags|=1,kc(e,t,n,a),t.child)}function Hc(e,t,n,r,i){if(_a(t),t.stateNode===null){var a=wi,o=n.contextType;typeof o==`object`&&o&&(a=va(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=mc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},so(t),o=n.contextType,a.context=typeof o==`object`&&o?va(o):wi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(pc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&mc.enqueueReplaceState(a,a.state,null),go(t,r,a,i),ho(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=_c(n,s);a.props=c;var l=a.context,u=n.contextType;o=wi,typeof u==`object`&&u&&(o=va(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&gc(t,a,r,o),oo=!1;var f=t.memoizedState;a.state=f,go(t,r,a,i),ho(),l=t.memoizedState,s||f!==l||oo?(typeof d==`function`&&(pc(t,n,d,r),l=t.memoizedState),(c=oo||hc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,co(e,t),o=t.memoizedProps,u=_c(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=wi,typeof l==`object`&&l&&(c=va(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&gc(t,a,r,c),oo=!1,f=t.memoizedState,a.state=f,go(t,r,a,i),ho();var p=t.memoizedState;o!==d||f!==p||oo||e!==null&&e.dependencies!==null&&ga(e.dependencies)?(typeof s==`function`&&(pc(t,n,s,r),p=t.memoizedState),(u=oo||hc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&ga(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,zc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=io(t,e.child,null,i),t.child=io(t,null,n,i)):kc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=il(e,t,i),e}function Uc(e,t,n,r){return aa(),t.flags|=256,kc(e,t,n,r),t.child}var Wc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Gc(e){return{baseLanes:e,cachePool:Va()}}function Kc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ud),e}function qc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(jo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(Zi){if(i?Eo(t):ko(),(e=Xi)?(e=cm(e,$i),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ui===null?null:{id:Wi,overflow:Gi},retryLane:536870912,hydrationErrors:null},n=Ni(e),n.return=t,t.child=n,Yi=t,Xi=null)):e=null,e===null)throw ta(t);return t.lanes=um(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(ko(),i=t.mode,a=Yc({mode:`hidden`,children:a},i),r=ji(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Gc(n),r.childLanes=Kc(e,o,n),t.memoizedState=Wc,Pc(null,r)):(Eo(t),Jc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return Zc(e,t,a,o,r,c,s,n)}return i?(ko(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Oi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=ji(i,a,n,null),i.flags|=2):i=Oi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Pc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Gc(n):(a=i.cachePool,a===null?a=Va():(s=wa._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Kc(e,o,n),t.memoizedState=Wc,Pc(e.child,r)):(Eo(t),n=e.child,e=n.sibling,n=Oi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Jc(e,t){return t=Yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Yc(e,t){return e=Ei(22,e,null,t),e.lanes=0,e}function Xc(e,t,n){return io(t,e.child,null,n),e=Jc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zc(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Eo(t),t.flags&=-257,Xc(e,t,c)):t.memoizedState===null?(ko(),o=a.fallback,s=t.mode,a=Yc({mode:`visible`,children:a.children},s),o=ji(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,io(t,e.child,null,c),a=t.child,a.memoizedState=Gc(c),a.childLanes=Kc(e,r,c),t.memoizedState=Wc,Pc(null,a)):(ko(),t.child=e.child,t.flags|=128,null);if(Eo(t),um(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,sa({value:a,source:null,stack:null})),Xc(e,t,c)}if(Oc||ha(e,t,c,!1),r=(c&e.childLanes)!==0,Oc||r){if(yo.current!==null)return Xc(e,t,c);if(r=Zu,r!==null&&(a=dt(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,xi(e,a),Fd(r,e,a),Dc;return lm(o)||qd(),Xc(e,t,c)}return lm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,Xi=fm(o.nextSibling),Yi=t,Zi=!0,Qi=null,$i=!1,e!==null&&Ji(t,e),t=Jc(t,a.children),t.flags|=134221824,t)}function Qc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),pa(e.return,t,n)}function $c(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Po(n)===null&&(t=e),e=e.sibling}return t}function el(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function tl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function nl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=jo.current;if(t.flags&128)return Mo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Mo(t,o),i===`backwards`&&e!==null?(tl(e),kc(e,t,r,n),tl(e)):kc(e,t,r,n),r=Zi?Bi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Qc(e,n,t);else if(e.tag===19)Qc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=$c(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,tl(t)),el(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Po(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}el(t,!0,n,null,a,r);break;case`together`:el(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=$c(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),el(t,!1,i,n,a,r)}return t.child}function rl(e,t,n){var r=t.pendingProps;return da(t,t.type,r.value),kc(e,t,r.children,n),t.child}function il(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),sd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ha(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function al(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&ga(e)))}function ol(e,t,n){switch(t.tag){case 3:be(t,t.stateNode.containerInfo),da(t,wa,e.memoizedState.cache),aa();break;case 27:case 5:Se(t);break;case 4:be(t,t.stateNode.containerInfo);break;case 10:da(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Do(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Eo(t),t.flags|=128,null;r=ha(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?qc(e,t,n):(Eo(t),e=il(e,t,n),e===null?null:e.sibling)}Eo(t);break;case 19:if(t.flags&128)return nl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(ha(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return nl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Mo(t,jo.current),r)break;return null;case 22:return t.lanes=0,Nc(e,t,n,t.pendingProps);case 24:da(t,wa,e.memoizedState.cache)}return il(e,t,n)}function sl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Oc=!0;else{if(!al(e,n)&&!(t.flags&128))return Oc=!1,ol(e,t,n);Oc=!!(e.flags&131072)}}else Oc=!1,Zi&&t.flags&1048576&&q(t,Bi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ja(t.elementType),t.type=e,typeof e==`function`)Di(e)?(r=_c(e,r),t.tag=1,t=Hc(null,t,e,r,n)):(t.tag=0,t=Bc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===ee){t.tag=11,t=Ac(null,t,e,r,n);break a}if(a===re){t.tag=14,t=jc(null,t,e,r,n);break a}if(a===P){t.tag=10,t.type=e,t=rl(null,t,n);break a}}throw t=le(e)||e,Error(i(306,t,``))}}return t;case 0:return Bc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=_c(r,t.pendingProps),Hc(e,t,r,a,n);case 3:a:{if(be(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,co(e,t),go(t,r,null,n);var s=t.memoizedState;if(r=s.cache,da(t,wa,r),r!==o.cache&&ma(t,[wa],n,!0),ho(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Uc(e,t,r,n);break a}if(r!==a){a=Ii(Error(i(424)),t),sa(a),t=Uc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Xi=fm(e.firstChild),Yi=t,Zi=!0,Qi=null,$i=!0,n=ao(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(aa(),r===a){t=il(e,t,n);break a}kc(e,t,r,n)}t=t.child}return t;case 26:return zc(e,t),e===null?(n=Fm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Zi||(t.stateNode=gp(t.type,t.pendingProps,ve.current,t)):t.memoizedState=Fm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Se(t),e===null&&Zi&&(r=t.stateNode=_m(t.type,t.pendingProps,ve.current),Yi=t,$i=!0,a=Xi,Ep(t.type)?(pm=a,Xi=fm(r.firstChild)):Xi=a),kc(e,t,t.pendingProps.children,n),zc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Zi&&((a=r=Xi)&&(r=om(r,t.type,t.pendingProps,$i),r===null?a=!1:(t.stateNode=r,Yi=t,Xi=fm(r.firstChild),$i=!1,a=!0)),a||ta(t)),Se(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,_p(a,o)?r=null:s!==null&&_p(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=qo(e,t,Xo,null,null,n),lh._currentValue=a),zc(e,t),kc(e,t,r,n),t.child;case 6:return e===null&&Zi&&((e=n=Xi)&&(n=sm(n,t.pendingProps,$i),n===null?e=!1:(t.stateNode=n,Yi=t,Xi=null,e=!0)),e||ta(t)),null;case 13:return qc(e,t,n);case 4:return be(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=io(t,null,r,n):kc(e,t,r,n),t.child;case 11:return Ac(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,zc(e,t),kc(e,t,r,n),t.child;case 8:return kc(e,t,t.pendingProps.children,n),t.child;case 12:return kc(e,t,t.pendingProps.children,n),t.child;case 10:return rl(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,_a(t),a=va(a),r=r(a),t.flags|=1,kc(e,t,r,n),t.child;case 14:return jc(e,t,t.type,t.pendingProps,n);case 15:return Mc(e,t,t.type,t.pendingProps,n);case 19:return nl(e,t,n);case 31:return Rc(e,t,n);case 22:return Nc(e,t,n,t.pendingProps);case 24:return _a(t),r=va(wa),e===null?(a=za(),a===null&&(a=Zu,o=Ta(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},so(t),da(t,wa,a)):((e.lanes&n)!==0&&(co(e,t),go(t,null,null,n),ho()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,da(t,wa,r),r!==a.cache&&ma(t,[wa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),da(t,wa,r))),kc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:Zi&&Ki(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:zc(e,t),kc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function cl(e){e.flags|=4}function ll(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Xm(t,r):Xm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Wd())e.flags|=8192;else throw Ya=Ga,Ua}}else e.flags&=-16777217}function ul(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Zm(t)){if(Wd())e.flags|=8192;else throw Ya=Ga,Ua}}function dl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:at(),e.lanes|=t,dd|=t)}function fl(e,t){if(!Zi)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function pl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ml(e,t,n){var r=t.pendingProps;switch(qi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pl(t),null;case 1:return pl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),fa(wa),xe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ia(t)?cl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,oa())),pl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(cl(t),o===null?(pl(t),ll(t,a,null,r,n)):(pl(t),ul(t,o))):o?o===e.memoizedState?(pl(t),t.flags&=-16777217):(cl(t),pl(t),ul(t,o)):(e=e.memoizedProps,e!==r&&cl(t),pl(t),ll(t,a,e,r,n)),null;case 27:if(Ce(t),n=ve.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return pl(t),t.subtreeFlags&=-33554433,null}e=ge.current,ia(t)?na(t,e):(e=_m(a,r,n),t.stateNode=e,cl(t))}return pl(t),t.subtreeFlags&=-33554433,null;case 5:if(Ce(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return pl(t),t.subtreeFlags&=-33554433,null}if(o=ge.current,ia(t))na(t,o);else{var s=pp(ve.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[_t]=t,o[vt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(op(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&cl(t)}}return pl(t),t.subtreeFlags&=-33554433,ll(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&cl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ve.current,ia(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Yi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[_t]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||rp(e.nodeValue,n)),e||ta(t,!0)}else e=pp(e).createTextNode(r),e[_t]=t,t.stateNode=e}return pl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ia(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[_t]=t}else aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pl(t),e=!1}else n=oa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ao(t),t):(Ao(t),null);if(t.flags&128)throw Error(i(558))}return pl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ia(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[_t]=t}else aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pl(t),a=!1}else a=oa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Ao(t),t):(Ao(t),null)}return Ao(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),dl(t,t.updateQueue),pl(t),null);case 4:return xe(),e===null&&qf(t.stateNode.containerInfo),t.flags|=67108864,pl(t),null;case 10:return fa(t.type),pl(t),null;case 19:if(No(t),r=t.memoizedState,r===null)return pl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)fl(r,!1);else{if(od!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Po(e),o!==null){for(t.flags|=128,fl(r,!1),e=o.updateQueue,t.updateQueue=e,dl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ki(n,e),n=n.sibling;return Mo(t,jo.current&1|2),Zi&&K(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Fe()>_d&&(t.flags|=128,a=!0,fl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Po(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,dl(t,e),fl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!Zi)return pl(t),null}else 2*Fe()-r.renderingStartTime>_d&&n!==536870912&&(t.flags|=128,a=!0,fl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Fe(),e.sibling=null,o=jo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||Zi?Mo(t,o):(n=o,V(wo,t),V(jo,n),To===null&&(To=t)),Zi&&K(t,r.treeForkCount),e}return pl(t),null;case 22:case 23:return Ao(t),Co(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(pl(t),t.subtreeFlags&6&&(t.flags|=8192)):pl(t),n=t.updateQueue,n!==null&&dl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&he(Ra),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),fa(wa),pl(t),null;case 25:return null;case 30:return t.flags|=33554432,pl(t),null}throw Error(i(156,t.tag))}function hl(e,t){switch(qi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return fa(wa),xe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ce(t),null;case 31:if(t.memoizedState!==null){if(Ao(t),t.alternate===null)throw Error(i(340));aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return No(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return xe(),null;case 10:return fa(t.type),null;case 22:case 23:return Ao(t),Co(),e!==null&&he(Ra),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return fa(wa),null;case 25:return null;default:return null}}function gl(e,t){switch(qi(t),t.tag){case 3:fa(wa),xe();break;case 26:case 27:case 5:Ce(t);break;case 4:xe();break;case 31:t.memoizedState!==null&&Ao(t);break;case 13:Ao(t);break;case 19:No(t);break;case 10:fa(t.type);break;case 22:case 23:Ao(t),Co(),e!==null&&he(Ra);break;case 24:fa(wa)}}function _l(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){hf(t,t.return,e)}}function vl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){hf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){hf(t,t.return,e)}}function yl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{vo(t,n)}catch(t){hf(e,e.return,t)}}}function bl(e,t,n){n.props=_c(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){hf(e,t,n)}}function xl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=ui(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Lp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Rp(e);m(e.child,!1,tm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){hf(e,t,n)}}function Sl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){hf(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){hf(e,t,n)}else n.current=null}}function Cl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)rm(e.stateNode,t[n])}function wl(e){for(var t=e.return;t!==null&&(Dl(t)&&rm(e.stateNode,t.stateNode),!El(t));)t=t.return}function Tl(e){for(var t=e.return;t!==null&&(Dl(t)&&im(e.stateNode,t.stateNode),!El(t));)t=t.return}function El(e){return e.tag===5||e.tag===3||e.tag===27}function Dl(e){return e&&e.tag===7&&e.stateNode!==null}function Ol(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){hf(e,e.return,t)}}function kl(e,t,n){try{var r=e.stateNode;cp(r,e.type,n,t),r[vt]=t}catch(t){hf(e,e.return,t)}}function Al(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ep(e.type)||e.tag===4}function jl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Al(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ep(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ml(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=fn)),Cl(e,r),Bt=!0;else if(i!==4&&(i===27&&(Cl(e,r),r=null,Ep(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Ml(e,t,n,r),e=e.sibling;e!==null;)Ml(e,t,n,r),e=e.sibling}function Nl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Cl(e,r),Bt=!0;else if(i!==4&&(i===27&&(Cl(e,r),r=null,Ep(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Nl(e,t,n,r),e=e.sibling;e!==null;)Nl(e,t,n,r),e=e.sibling}function Pl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);op(t,r,n),t[_t]=e,t[vt]=n}catch(t){hf(e,e.return,t)}}var Fl=!1,Il=null;function Ll(e){(e.tag===30||e.subtreeFlags&33554432)&&(Fl=!0)}var Y=null;function Rl(){var e=Y;return Y=null,e}var zl=0;function Bl(e,t,n,r,i){return zl=0,Vl(e.child,t,n,r,i)}function Vl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=jp(o);r.push(s),s.view&&(a=!0)}else a||jp(o).view&&(a=!0);Fl=!0,kp(o,zl===0?t:t+`_`+zl,n),zl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Vl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Hl(e,t){for(;e!==null;)e.tag===5?Ap(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Hl(e.child,t)),e=e.sibling}function Ul(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Ul(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=fi(t.default,t.share),t!==`none`&&(Bl(e,n,t,null,!1)||Hl(e.child,!1))}e=e.sibling}}function Wl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=ui(r,n),a=fi(r.default,n.paired?r.share:r.enter);a===`none`?Ul(e):Bl(e,i,a,null,!1)?(Ul(e),n.paired||t||Pd(e,r.onEnter)):Hl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Wl(e,t),e=e.sibling;else Ul(e)}function Gl(e){if(Il!==null&&Il.size!==0){var t=Il;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=fi(n.default,n.share);if(a!==`none`&&(Bl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Pd(e,n.onShare)):Hl(e.child,!1)),t.delete(r),t.size===0)break}}}Gl(e)}e=e.sibling}}}function Kl(e){if(e.tag===30){var t=e.memoizedProps,n=ui(t,e.stateNode),r=Il===null?void 0:Il.get(n),i=fi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Bl(e,n,i,null,!1)?r===void 0?Pd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Il.delete(n),Pd(e,t.onShare)):Hl(e.child,!1)),Il!==null&&Gl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Kl(e),e=e.sibling;else Il!==null&&Gl(e)}function ql(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=ui(t,e.stateNode);t=fi(t.default,t.update),e.flags&=-5,t!==`none`&&Bl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&ql(e);e=e.sibling}}function Jl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Hl(e.child,!1))}Jl(e)}e=e.sibling}}function Yl(e){if(e.tag===30)e.stateNode.paired=null,Hl(e.child,!1),Jl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Yl(e),e=e.sibling;else Jl(e)}function Xl(e){for(e=e.child;e!==null;)e.tag===30?Hl(e.child,!1):e.subtreeFlags&33554432&&Xl(e),e=e.sibling}function Zl(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&zl<a.length){var l=a[zl],u=jp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&kp(c,zl===0?n:n+`_`+zl,i),s&&e.flags&4||(Y===null&&(Y=[]),Y.push(c,zl===0?r:r+`_`+zl,t.memoizedProps)),zl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:Zl(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Ql(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=ui(n,r),a=fi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Mp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;zl=0,i=Zl(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Pd(e,n.onUpdate))}else e.subtreeFlags&33554432&&Ql(e,t);e=e.sibling}}var $l=!1,eu=!1,tu=!1,nu=!1,ru=typeof WeakSet==`function`?WeakSet:Set,iu=null,au=!1,ou=!1,su=!1,cu=!1;function lu(e,t,n){if(e=e.containerInfo,dp=vh,e=Br(e),Vr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(fp={focusedElem:e,selectionRange:r},vh=!1,n=(n&335544064)===n,iu=t,t=n?9270:1024;iu!==null;){if(e=iu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Kl(r[a]);if(e.alternate===null&&e.flags&2)n&&Ll(e),uu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Kl(r),uu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Ll(e),uu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,iu=r):(n&&ql(e),uu(n))}}Il=null}function uu(e){for(;iu!==null;){var t=iu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=_c(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){hf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)am(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:am(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=ui(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=fi(a.default,a.update),a!==`none`&&Bl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,iu=r;break}iu=t.return}}function du(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:ju(e,n),r&4&&_l(5,n);break;case 1:if(ju(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){hf(n,n.return,e)}else{var i=_c(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){hf(n,n.return,e)}}}r&64&&yl(n),r&512&&xl(n,n.return);break;case 3:if(ju(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{vo(e,t)}catch(e){hf(n,n.return,e)}}break;case 27:t===null&&r&4&&Pl(n);case 26:case 5:ju(e,n),t===null&&r&4&&Ol(n),r&512&&xl(n,n.return);break;case 12:ju(e,n);break;case 31:ju(e,n),r&4&&bu(e,n);break;case 13:ju(e,n),r&4&&xu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=yf.bind(null,n),dm(e,n))));break;case 22:if(r=n.memoizedState!==null||$l,!r){var a=t!==null&&t.memoizedState!==null||eu;t=$l,i=eu,$l=r,(eu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Nu(e,n,r)):ju(e,n),$l=t,eu=i}break;case 30:ju(e,n),r&512&&xl(n,n.return);break;case 7:r&512&&xl(n,n.return);default:ju(e,n)}}function fu(e,t){for(e=e.child;e!==null;)pu(e,t),e=e.sibling}function pu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){hf(e,e.return,t)}mu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Bt=!0}catch(t){hf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Op(s,!0):Op(e.stateNode,!1)}catch(t){hf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&fu(e,t);break;default:fu(e,t)}}function mu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:pu(n,r);break a;case 22:n.memoizedState===null&&mu(n,r);break a;default:mu(n,r)}}e=e.sibling}}function hu(e){var t=e.alternate;t!==null&&(e.alternate=null,hu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Et(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var gu=null,_u=!1;function vu(e,t,n){for(n=n.child;n!==null;)yu(e,t,n),n=n.sibling}function yu(e,t,n){if(Ge&&typeof Ge.onCommitFiberUnmount==`function`)try{Ge.onCommitFiberUnmount(We,n)}catch{}switch(n.tag){case 26:eu||Sl(n,t),vu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!eu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:eu||Sl(n,t),Tl(n);var r=gu,i=_u;Ep(n.type)&&(gu=n.stateNode,_u=!1),vu(e,t,n),vm(n.stateNode,n.type,n.memoizedProps),gu=r,_u=i;break;case 5:eu||Sl(n,t),Tl(n);case 6:if(n.tag===6&&Tl(n),r=gu,i=_u,gu=null,vu(e,t,n),gu=r,_u=i,gu!==null){if(_u)try{(gu.nodeType===9?gu.body:gu.nodeName===`HTML`?gu.ownerDocument.body:gu).removeChild(n.stateNode),Bt=!0}catch(e){hf(n,t,e)}else try{gu.removeChild(n.stateNode),Bt=!0}catch(e){hf(n,t,e)}}break;case 18:gu!==null&&(_u?(e=gu,Dp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Wh(e)):Dp(gu,n.stateNode));break;case 4:r=gu,i=_u,gu=n.stateNode.containerInfo,_u=!0,vu(e,t,n),gu=r,_u=i;break;case 0:case 11:case 14:case 15:vl(2,n,t),eu||vl(4,n,t),vu(e,t,n);break;case 1:eu||(Sl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&bl(n,t,r)),vu(e,t,n);break;case 21:vu(e,t,n);break;case 22:eu=(r=eu)||n.memoizedState!==null,vu(e,t,n),eu=r;break;case 30:Sl(n,t),vu(e,t,n);break;case 7:eu||Sl(n,t),vu(e,t,n);break;default:vu(e,t,n)}}function bu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Wh(e)}catch(e){hf(t,t.return,e)}}}function xu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Wh(e)}catch(e){hf(t,t.return,e)}}function Su(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ru),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ru),t;default:throw Error(i(435,e.tag))}}function Cu(e,t){var n=Su(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=bf.bind(null,e,t);t.then(r,r)}})}function wu(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Ep(l.type)){gu=l.stateNode,_u=!1;break a}break;case 5:gu=l.stateNode,_u=!1;break a;case 3:case 4:gu=l.stateNode.containerInfo,_u=!0;break a}l=l.return}if(gu===null)throw Error(i(160));yu(s,c,o),gu=null,_u=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Eu(t,e,n),t=t.sibling}var Tu=null;function Eu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}wu(t,e,n),Du(e),a&4&&(vl(3,e,e.return),_l(3,e),vl(5,e,e.return));break;case 1:wu(t,e,n),Du(e),a&512&&(eu||r===null||Sl(r,r.return)),a&64&&$l&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Tu,wu(t,e,n),Du(e),a&512&&(eu||r===null||Sl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if($l)e.stateNode=gp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[wt]||r[_t]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),op(r,t,n),r[_t]=e,At(r),t=r;break a;case`link`:if(o=qm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),op(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=qm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),op(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[_t]=e,At(r),t=r}e.stateNode=t}}else $l||Jm(o,e.type,e.stateNode)}else e.stateNode=Hm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&kl(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||eu||t.parentNode.removeChild(t)):a.count--,n===null?$l||Jm(o,e.type,e.stateNode):Hm(o,n,e.memoizedProps))}break;case 27:wu(t,e,n),Du(e),a&512&&(eu||r===null||Sl(r,r.return)),r!==null&&a&4&&kl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=tu,tu=!1,wu(t,e,n),tu=o,Du(e),a&512&&(eu||r===null||Sl(r,r.return)),e.flags&32){t=e.stateNode;try{an(t,``),Bt=!0}catch(t){hf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,kl(e,t,r===null?t:r.memoizedProps)),a&1024&&(nu=!0);break;case 6:if(wu(t,e,n),Du(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Bt=!0}catch(t){hf(e,e.return,t)}}break;case 3:if(Bt=!1,Km=null,o=Tu,Tu=Sm(t.containerInfo),wu(t,e,n),Tu=o,Du(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Wh(t.containerInfo)}catch(t){hf(e,e.return,t)}nu&&(nu=!1,Ou(e)),Bt=!1;break;case 4:a=tu,tu=$l,r=Vt(),o=Tu,Tu=Sm(e.stateNode.containerInfo),wu(t,e,n),Du(e),Tu=o,Bt&&ou&&(su=!0),Bt=r,tu=a;break;case 12:wu(t,e,n),Du(e);break;case 31:wu(t,e,n),Du(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Cu(e,t)));break;case 13:wu(t,e,n),Du(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(hd=Fe()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Cu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=$l,l=eu,u=tu;$l=c||o,tu=u||o,eu=l||s,wu(t,e,n),eu=l,tu=u,$l=c,Du(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||$l||eu||(t=s||eu,n=$l,r=eu,$l=o||$l,eu=t,Mu(e,2),$l=n,eu=r),!o&&tu||fu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Cu(e,n))));break;case 19:wu(t,e,n),Du(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Cu(e,t)));break;case 30:a&512&&(eu||r===null||Sl(r,r.return)),a=Vt(),o=ou,s=(n&335544064)===n,c=e.memoizedProps,ou=s&&fi(c.default,c.update)!==`none`,wu(t,e,n),Du(e),s&&r!==null&&Bt&&(e.flags|=4),ou=o,Bt=a;break;case 21:break;case 7:a&512&&(eu||r===null||Sl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:wu(t,e,n),Du(e)}}function Du(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Al(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Dl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(El(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Nl(e,jl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(an(l,``),n.flags&=-33),Nl(e,jl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Ml(e,jl(e),u,s);break;default:throw Error(i(161))}}catch(t){hf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ou(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ou(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,vh=!0,t.reset(),vh=!1),e=e.sibling}}function ku(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Au(t,e),t=t.sibling;else Ql(t,!1)}function Au(e,t){var n=e.alternate;if(n===null)Wl(e,!1);else switch(e.tag){case 3:if(cu=au=!1,Rl(),ku(t,e),!au&&!su){if(e=Y,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ap(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),cu=!0}Y=null;break;case 5:ku(t,e);break;case 4:r=au,au=!1,ku(t,e),au&&(su=!0),au=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?ku(t,e):Wl(e,!1));break;case 30:r=au,i=Rl(),au=!1,ku(t,e),au&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=ui(a,o),o=ui(n.memoizedProps,o);var s=fi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,zl=0,t=Zl(e,n,t,o,s,a,!0),zl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Pd(e,e.memoizedProps.onUpdate),Y=i):i!==null&&(i.push.apply(i,Y),Y=i),au=e.flags&32?!0:r;break;default:ku(t,e)}}function ju(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)du(e,t.alternate,t),t=t.sibling}function Mu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:vl(4,n,n.return),Mu(n,r);break;case 1:Sl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&bl(n,n.return,i),Mu(n,r);break;case 27:r&2&&vm(n.stateNode,n.type,n.memoizedProps);case 5:Sl(n,n.return),n.tag!==5&&n.tag!==27||Tl(n),Mu(n,r);break;case 6:Tl(n);break;case 26:Sl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||eu||i.parentNode.removeChild(i),Mu(n,r);break;case 22:n.memoizedState===null&&Mu(n,r);break;case 30:Sl(n,n.return),Mu(n,r);break;case 7:Sl(n,n.return);default:Mu(n,r)}e=e.sibling}}function Nu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Nu(i,a,n),_l(4,a);break;case 1:if(Nu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){hf(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)_o(l[i],c)}catch(e){hf(r,r.return,e)}}s&&o&64&&yl(a),xl(a,a.return);break;case 27:n&2&&Pl(a);case 5:a.tag!==5&&a.tag!==27||wl(a),Nu(i,a,n),s&&r===null&&o&4&&Ol(a),xl(a,a.return);break;case 6:wl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||$l||Jm(Sm(c.ownerDocument),a.type,c),Nu(i,a,n),s&&r===null&&o&4&&Ol(a),xl(a,a.return);break;case 12:Nu(i,a,n);break;case 31:Nu(i,a,n),s&&o&4&&bu(i,a);break;case 13:Nu(i,a,n),s&&o&4&&xu(i,a);break;case 22:a.memoizedState===null&&Nu(i,a,n),xl(a,a.return);break;case 30:Nu(i,a,n),xl(a,a.return);break;case 7:xl(a,a.return);default:Nu(i,a,n)}t=t.sibling}}function Pu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ea(n))}function Fu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ea(e))}function Iu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Lu(e,t,n,r),t=t.sibling;else i&&Xl(t)}function Lu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Yl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Iu(e,t,n,r),a&2048&&_l(9,t);break;case 1:Iu(e,t,n,r);break;case 3:Iu(e,t,n,r),i&&cu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ea(a)));break;case 12:if(a&2048){Iu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){hf(t,t.return,e)}}else Iu(e,t,n,r);break;case 31:Iu(e,t,n,r);break;case 13:Iu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Yl(t),o._visibility&2?Iu(e,t,n,r):(o._visibility|=2,Ru(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Yl(s),o._visibility&2?Iu(e,t,n,r):zu(e,t)),a&2048&&Pu(s,t);break;case 24:Iu(e,t,n,r),a&2048&&Fu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Hl(a.child,!0),Hl(t.child,!0))),Iu(e,t,n,r);break;default:Iu(e,t,n,r)}}function Ru(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Ru(a,o,s,c,i),_l(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ru(a,o,s,c,i)):u._visibility&2?Ru(a,o,s,c,i):zu(a,o),i&&l&2048&&Pu(o.alternate,o);break;case 24:Ru(a,o,s,c,i),i&&l&2048&&Fu(o.alternate,o);break;default:Ru(a,o,s,c,i)}t=t.sibling}}function zu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:zu(n,r),i&2048&&Pu(r.alternate,r);break;case 24:zu(n,r),i&2048&&Fu(r.alternate,r);break;default:zu(n,r)}t=t.sibling}}var Bu=8192;function Vu(e,t,n){if(e.subtreeFlags&Bu)for(e=e.child;e!==null;)Hu(e,t,n),e=e.sibling}function Hu(e,t,n){switch(e.tag){case 26:Vu(e,t,n),e.flags&Bu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&$m(n,e)):eh(n,Tu,e.memoizedState,e.memoizedProps));break;case 5:Vu(e,t,n),e.flags&Bu&&(e=e.stateNode,(t&335544128)===t&&$m(n,e));break;case 3:case 4:var r=Tu;Tu=Sm(e.stateNode.containerInfo),Vu(e,t,n),Tu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Bu,Bu=16777216,Vu(e,t,n),Bu=r):Vu(e,t,n));break;case 30:if((e.flags&Bu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Il===null&&(Il=new Map),Il.set(r,i)}Vu(e,t,n);break;default:Vu(e,t,n)}}function Uu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Wu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];iu=r,qu(r,e)}Uu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Gu(e),e=e.sibling}function Gu(e){switch(e.tag){case 0:case 11:case 15:Wu(e),e.flags&2048&&vl(9,e,e.return);break;case 3:Wu(e);break;case 12:Wu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ku(e)):Wu(e);break;default:Wu(e)}}function Ku(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];iu=r,qu(r,e)}Uu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:vl(8,t,t.return),Ku(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ku(t));break;default:Ku(t)}e=e.sibling}}function qu(e,t){for(;iu!==null;){var n=iu;switch(n.tag){case 0:case 11:case 15:vl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ea(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,iu=r;else a:for(n=e;iu!==null;){r=iu;var i=r.sibling,a=r.return;if(hu(r),r===n){iu=null;break a}if(i!==null){i.return=a,iu=i;break a}iu=a}}}var Ju={getCacheForType:function(e){var t=va(wa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return va(wa).controller.signal}},Yu=typeof WeakMap==`function`?WeakMap:Map,Xu=0,Zu=null,Qu=null,$u=0,ed=0,td=null,nd=!1,rd=!1,id=!1,ad=0,od=0,sd=0,cd=0,ld=0,ud=0,dd=0,fd=null,pd=null,md=!1,hd=0,gd=0,_d=1/0,vd=null,yd=null,bd=0,xd=null,Sd=null,Cd=0,wd=0,Td=null,Ed=null,Dd=null,Od=null,kd=null,Ad=0,jd=null;function Md(){return Xu&2&&$u!==0?$u&-$u:z.T===null?mt():If()}function Nd(){if(ud===0){if(!($u&536870912)||Zi){var e=Qe;Qe<<=1,!(Qe&3932160)&&(Qe=262144),ud=e}else ud=536870912}return e=wo.current,e!==null&&(e.flags|=32),ud}function Pd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Lp(ui(e.memoizedProps,n))),Od===null&&(Od=[]),Od.push(t.bind(null,r))}}function Fd(e,t,n){(e===Zu&&(ed===2||ed===9)||e.cancelPendingCommit!==null)&&(Hd(e,0),zd(e,$u,ud,!1)),st(e,n),(!(Xu&2)||e!==Zu)&&(e===Zu&&(!(Xu&2)&&(cd|=n),od===4&&zd(e,$u,ud,!1)),Of(e))}function Id(e,t,n){if(Xu&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||nt(e,t),a=r?Xd(e,t):Jd(e,t,!0),o=r;do{if(a===0){rd&&!r&&zd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Rd(n)){a=Jd(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=fd;var l=c.current.memoizedState.isDehydrated;if(l&&(Hd(c,s).flags|=256),s=Jd(c,s,!1),s!==2&&s!==6){if(id&&!l){c.errorRecoveryDisabledLanes|=o,cd|=o,a=4;break a}o=pd,pd=a,o!==null&&(pd===null?pd=o:pd.push.apply(pd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Hd(e,0),zd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:zd(r,t,ud,!nd);break a;case 2:pd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=hd+300-Fe(),10<a)){if(zd(r,t,ud,!nd),tt(r,0,!0)!==0)break a;Cd=t,r.timeoutHandle=bp(Ld.bind(null,r,n,pd,vd,md,t,ud,cd,dd,nd,o,`Throttled`,-0,0),a);break a}Ld(r,n,pd,vd,md,t,ud,cd,dd,nd,o,null,-0,0)}break}while(1);Of(e)}function Ld(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;if(d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:fn},Il=null,Hu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=ih.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?hd-Fe():(a&4194048)===a?gd-Fe():0,m=nh(d,m),m!==null)){Cd=a,e.cancelPendingCommit=m(rf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),zd(e,a,o,!l);return}rf(e,t,a,n,r,i,o,s,c,l,u,d)}function Rd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Pr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zd(e,t,n,r){t=rt(e,t),t&=~ld,t&=~cd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-qe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&lt(e,n,t)}function Bd(){return Xu&6?!0:(kf(0,!1),!1)}function Vd(){if(Qu!==null){if(ed===0)var e=Qu.return;else e=Qu,ua=la=null,$o(e),Qa=null,$a=0,e=Qu;for(;e!==null;)gl(e.alternate,e),e=e.return;Qu=null}}function Hd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,xp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Cd=0,Vd(),Zu=e,Qu=n=Oi(e.current,null),$u=t,ed=0,td=null,nd=!1,rd=nt(e,t),id=!1,dd=ud=ld=cd=sd=od=0,pd=fd=null,md=!1,ad=rt(e,t),vi(),n}function Ud(e,t){J=null,z.H=lc,t===Ha||t===Wa?(t=Xa(),ed=3):t===Ua?(t=Xa(),ed=4):ed=t===Dc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,td=t,Qu===null&&(od=1,xc(e,Ii(t,e.current)))}function Wd(){var e=wo.current;return e===null?!0:($u&4194048)===$u?To===null:($u&62914560)===$u||$u&536870912?e===To:!1}function Gd(){var e=z.H;return z.H=lc,e===null?lc:e}function Kd(){var e=z.A;return z.A=Ju,e}function qd(){od=4,nd||($u&4194048)!==$u&&wo.current!==null||(rd=!0),!(sd&134217727)&&!(cd&134217727)||Zu===null||zd(Zu,$u,ud,!1)}function Jd(e,t,n){var r=Xu;Xu|=2;var i=Gd(),a=Kd();(Zu!==e||$u!==t)&&(vd=null,Hd(e,t)),t=!1;var o=od;a:do try{if(ed!==0&&Qu!==null){var s=Qu,c=td;switch(ed){case 8:Vd(),o=6;break a;case 3:case 2:case 9:case 6:wo.current===null&&(t=!0);var l=ed;if(ed=0,td=null,ef(e,s,c,l),n&&rd){o=0;break a}break;default:l=ed,ed=0,td=null,ef(e,s,c,l)}}Yd(),o=od;break}catch(t){Ud(e,t)}while(1);return t&&e.shellSuspendCounter++,ua=la=null,Xu=r,z.H=i,z.A=a,Qu===null&&(Zu=null,$u=0,vi()),o}function Yd(){for(;Qu!==null;)Qd(Qu)}function Xd(e,t){var n=Xu;Xu|=2;var r=Gd(),a=Kd();Zu!==e||$u!==t?(vd=null,_d=Fe()+500,Hd(e,t)):rd=nt(e,t);a:do try{if(ed!==0&&Qu!==null){t=Qu;var o=td;b:switch(ed){case 1:ed=0,td=null,ef(e,t,o,1);break;case 2:case 9:if(Ka(o)){ed=0,td=null,$d(t);break}t=function(){ed!==2&&ed!==9||Zu!==e||(ed=7),Of(e)},o.then(t,t);break a;case 3:ed=7;break a;case 4:ed=5;break a;case 7:Ka(o)?(ed=0,td=null,$d(t)):(ed=0,td=null,ef(e,t,o,7));break;case 5:var s=null;switch(Qu.tag){case 26:s=Qu.memoizedState;case 5:case 27:var c=Qu;if(s?Zm(s):c.stateNode.complete){ed=0,td=null;var l=c.sibling;if(l!==null)Qu=l;else{var u=c.return;u===null?Qu=null:(Qu=u,tf(u))}break b}}ed=0,td=null,ef(e,t,o,5);break;case 6:ed=0,td=null,ef(e,t,o,6);break;case 8:Vd(),od=6;break a;default:throw Error(i(462))}}Zd();break}catch(t){Ud(e,t)}while(1);return ua=la=null,z.H=r,z.A=a,Xu=n,Qu===null?(Zu=null,$u=0,vi(),od):0}function Zd(){for(;Qu!==null&&!Ne();)Qd(Qu)}function Qd(e){var t=sl(e.alternate,e,ad);e.memoizedProps=e.pendingProps,t===null?tf(e):Qu=t}function $d(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Vc(n,t,t.pendingProps,t.type,void 0,$u);break;case 11:t=Vc(n,t,t.pendingProps,t.type.render,t.ref,$u);break;case 5:$o(t);var r=t;r===Yi&&(Zi?(ra(r),r.tag===5&&r.stateNode!=null&&(Xi=r.stateNode)):(ra(r),Zi=!0));default:gl(n,t),t=Qu=ki(t,ad),t=sl(n,t,ad)}e.memoizedProps=e.pendingProps,t===null?tf(e):Qu=t}function ef(e,t,n,r){ua=la=null,$o(t),Qa=null,$a=0;var i=t.return;try{if(Ec(e,i,t,n,$u)){od=1,xc(e,Ii(n,e.current)),Qu=null;return}}catch(t){if(i!==null)throw Qu=i,t;od=1,xc(e,Ii(n,e.current)),Qu=null;return}t.flags&32768?(Zi||r===1?e=!0:rd||$u&536870912?e=!1:(nd=e=!0,(r===2||r===9||r===3||r===6)&&(r=wo.current,r!==null&&r.tag===13&&(r.flags|=16384))),nf(t,e)):tf(t)}function tf(e){var t=e;do{if(t.flags&32768){nf(t,nd);return}e=t.return;var n=ml(t.alternate,t,ad);if(n!==null){Qu=n;return}if(t=t.sibling,t!==null){Qu=t;return}Qu=t=e}while(t!==null);od===0&&(od=5)}function nf(e,t){do{var n=hl(e.alternate,e);if(n!==null){n.flags&=32767,Qu=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Qu=e;return}Qu=e=n}while(e!==null);od=6,Qu=null}function rf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do ff();while(bd!==0);if(Xu&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===Zu&&(Qu=Zu=null,$u=0),Sd=t,xd=e,Cd=n,Td=a,Ed=r,af(e,t,n,s,c,l,f)}}function af(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(wd=s,s|=_i,ct(e,n,s,r,i,a),Od=null,(n&335544064)===n?(kd=ka(e),r=10262):(kd=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,xf(ze,function(){return pf(),null})):(e.callbackNode=null,e.callbackPriority=0),Fl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=z.T,z.T=null,i=B.p,B.p=2,a=Xu,Xu|=4;try{lu(e,t,n)}finally{Xu=a,B.p=i,z.T=r}}bd=1,Fl?Dd=Fp(o,e.containerInfo,kd,cf,lf,sf,uf,pf,of,null,null):(cf(),lf(),uf())}function of(e){if(bd!==0){var t=xd.onRecoverableError;t(e,{componentStack:null})}}function sf(){bd===3&&(bd=0,Au(Sd,xd),bd=4)}function cf(){if(bd===1){bd=0;var e=xd,t=Sd,n=Cd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=z.T,z.T=null;var i=B.p;B.p=2;var a=Xu;Xu|=4;try{ou=su=!1,Eu(t,e,n),n=fp;var o=Br(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&zr(s.ownerDocument.documentElement,s)){if(c!==null&&Vr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Rr(s,h),v=Rr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}vh=!!dp,fp=dp=null}finally{Xu=a,B.p=i,z.T=r}}e.current=t,bd=2}}function lf(){if(bd===2){bd=0;var e=xd,t=Sd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=z.T,z.T=null;var r=B.p;B.p=2;var i=Xu;Xu|=4;try{du(e,t.alternate,t)}finally{Xu=i,B.p=r,z.T=n}}bd=3}}function uf(){if(bd===4||bd===3){bd=0;var e=Dd;Dd=null,Pe();var t=xd,n=Sd,r=Cd,i=Ed,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?bd=5:(bd=0,Sd=xd=null,df(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(yd=null),pt(r),n=n.stateNode,Ge&&typeof Ge.onCommitFiberRoot==`function`)try{Ge.onCommitFiberRoot(We,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=z.T,a=B.p,B.p=2,z.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{z.T=n,B.p=a}}if(i=Od,o=kd,kd=null,i!==null&&(Od=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Cd&3&&ff(),Of(t),a=t.pendingLanes,r&261930&&a&42?t===jd?Ad++:(Ad=0,jd=t):(Ad=0,jd=null),kf(0,!1)}}function df(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ea(t)))}function ff(){return Dd!==null&&(Dd.skipTransition(),Dd=null),cf(),lf(),uf(),pf()}function pf(){if(bd!==5)return!1;var e=xd,t=wd;wd=0;var n=pt(Cd),r=z.T,a=B.p;try{B.p=32>n?32:n,z.T=null,n=Td,Td=null;var o=xd,s=Cd;if(bd=0,Sd=xd=null,Cd=0,Xu&6)throw Error(i(331));var c=Xu;if(Xu|=4,Gu(o.current),Lu(o,o.current,s,n),Xu=c,kf(0,!1),Ge&&typeof Ge.onPostCommitFiberRoot==`function`)try{Ge.onPostCommitFiberRoot(We,o)}catch{}return!0}finally{B.p=a,z.T=r,df(e,t)}}function mf(e,t,n){t=Ii(n,t),t=Cc(e.stateNode,t,2),e=uo(e,t,2),e!==null&&(st(e,2),Of(e))}function hf(e,t,n){if(e.tag===3)mf(e,e,n);else for(;t!==null;){if(t.tag===3){mf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(yd===null||!yd.has(r))){e=Ii(n,e),n=wc(2),r=uo(t,n,2),r!==null&&(Tc(n,r,t,e),st(r,2),Of(r));break}}t=t.return}}function gf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Yu;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(id=!0,i.add(n),e=_f.bind(null,e,t,n),t.then(e,e))}function _f(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Zu===e&&($u&n)===n&&(od===4||od===3&&($u&62914560)===$u&&300>Fe()-hd?Xu&2?ld|=n:Hd(e,0):ld|=n,dd===$u&&(dd=0)),Of(e)}function vf(e,t){t===0&&(t=at()),e=xi(e,t),e!==null&&(st(e,t),Of(e))}function yf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vf(e,n)}function bf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),vf(e,n)}function xf(e,t){return je(e,t)}var Sf=null,Cf=null,wf=!1,Tf=!1,Ef=!1,Df=0;function Of(e){e!==Cf&&e.next===null&&(Cf===null?Sf=Cf=e:Cf=Cf.next=e),Tf=!0,wf||(wf=!0,Ff())}function kf(e,t){if(!Ef&&Tf){Ef=!0;do for(var n=!1,r=Sf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-qe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Pf(r,a))}else a=$u,a=tt(r,r===Zu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||nt(r,a)||(n=!0,Pf(r,a))}r=r.next}while(n);Ef=!1}}function Af(){jf()}function jf(){Tf=wf=!1;var e=0;Df!==0&&yp()&&(e=Df);for(var t=Fe(),n=null,r=Sf;r!==null;){var i=r.next,a=Mf(r,t);a===0?(r.next=null,n===null?Sf=i:n.next=i,i===null&&(Cf=n)):(n=r,(e!==0||a&3)&&(Tf=!0)),r=i}bd!==0&&bd!==5||kf(e,!1),Df!==0&&(Df=0)}function Mf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-qe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=it(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Zu,n=$u,n=tt(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(ed===2||ed===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Me(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||nt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Me(r),pt(n)){case 2:case 8:n=Re;break;case 32:n=ze;break;case 268435456:n=Ve;break;default:n=ze}return r=Nf.bind(null,e),n=je(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Me(r),e.callbackPriority=2,e.callbackNode=null,2}function Nf(e,t){if(bd!==0&&bd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ff()&&e.callbackNode!==n)return null;var r=$u;return r=tt(e,e===Zu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Id(e,r,t),Mf(e,Fe()),e.callbackNode!=null&&e.callbackNode===n?Nf.bind(null,e):null)}function Pf(e,t){if(ff())return null;Id(e,t,!0)}function Ff(){wp(function(){Xu&6?je(Le,Af):jf()})}function If(){if(Df===0){var e=Ma;e===0&&(e=Ze,Ze<<=1,!(Ze&261888)&&(Ze=256)),Df=e}return Df}function Lf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:dn(e)}function Rf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Lf((i[vt]||null).action),o=r.submitter;o&&(t=(t=o[vt]||null)?Lf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Nn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Df!==0){var e=new FormData(i,o);Ys(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var zf=0;zf<si.length;zf++){var Bf=si[zf];ci(Bf.toLowerCase(),`on`+(Bf[0].toUpperCase()+Bf.slice(1)))}ci($r,`onAnimationEnd`),ci(ei,`onAnimationIteration`),ci(ti,`onAnimationStart`),ci(`dblclick`,`onDoubleClick`),ci(`focusin`,`onFocus`),ci(`focusout`,`onBlur`),ci(ni,`onTransitionRun`),ci(ri,`onTransitionStart`),ci(ii,`onTransitionCancel`),ci(ai,`onTransitionEnd`),Ft(`onMouseEnter`,[`mouseout`,`mouseover`]),Ft(`onMouseLeave`,[`mouseout`,`mouseover`]),Ft(`onPointerEnter`,[`pointerout`,`pointerover`]),Ft(`onPointerLeave`,[`pointerout`,`pointerover`]),Pt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Pt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Pt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Pt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Pt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Pt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Vf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Hf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Vf));function Uf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){pi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){pi(e)}i.currentTarget=null,a=c}}}}function Wf(e,t){var n=t[bt];n===void 0&&(n=t[bt]=new Set);var r=e+`__bubble`;n.has(r)||(Jf(t,e,2,!1),n.add(r))}function Gf(e,t,n){var r=0;t&&(r|=4),Jf(n,e,r,t)}var Kf=`_reactListening`+Math.random().toString(36).slice(2);function qf(e){if(!e[Kf]){e[Kf]=!0,Mt.forEach(function(t){t!==`selectionchange`&&(Hf.has(t)||Gf(t,!1,e),Gf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Kf]||(t[Kf]=!0,Gf(`selectionchange`,!1,t))}}function Jf(e,t,n,r){switch(Th(t)){case 2:var i=yh;break;case 8:i=bh;break;default:i=xh}n=i.bind(null,t,n,e),i=void 0,!Sn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Yf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Dt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}yn(function(){var r=a,i=mn(n),s=[];a:{var c=oi.get(e);if(c!==void 0){var l=Nn,u=e;switch(e){case`keypress`:if(On(n)===0)break a;case`keydown`:case`keyup`:l=Xn;break;case`focusin`:u=`focus`,l=Hn;break;case`focusout`:u=`blur`,l=Hn;break;case`beforeblur`:case`afterblur`:l=Hn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Bn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Vn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=$n;break;case $r:case ei:case ti:l=G;break;case ai:l=er;break;case`scroll`:case`scrollend`:l=Fn;break;case`wheel`:l=tr;break;case`copy`:case`cut`:case`paste`:l=Un;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Zn;break;case`submit`:l=Qn;break;case`toggle`:case`beforetoggle`:l=nr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=bn(m,p),g!=null&&d.push(Xf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==pn&&(u=n.relatedTarget||n.fromElement)&&(Dt(u)||u[yt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Dt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Bn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Zn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:kt(c),h=l==null?u:kt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Dt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?T(c,l,Qf):null,c!==null&&$f(s,u,c,d,!1),l!==null&&f!==null&&$f(s,f,l,d,!0)))}a:{if(c=r?kt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Sr;else if(gr(c)){if(Cr)_=Mr;else{_=Ar;var v=kr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&cn(r.elementType)&&(_=Sr):_=jr;if(_&&=_(e,r)){_r(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?kt(r):window,e){case`focusin`:(gr(v)||v.contentEditable===`true`)&&(Ur=v,Wr=r,Gr=null);break;case`focusout`:Gr=Wr=Ur=null;break;case`mousedown`:Kr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Kr=!1,qr(s,n,i);break;case`selectionchange`:if(Hr)break;case`keydown`:case`keyup`:qr(s,n,i)}var y;if(ir)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else fr?ur(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(sr&&n.locale!==`ko`&&(fr||b!==`onCompositionStart`?b===`onCompositionEnd`&&fr&&(y=Dn()):(wn=i,Tn=`value`in wn?wn.value:wn.textContent,fr=!0)),v=Zf(r,b),0<v.length&&(b=new Wn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=dr(n),y!==null&&(b.data=y)))),(y=or?pr(e,n):mr(e,n))&&(b=Zf(r,`onBeforeInput`),0<b.length&&(v=new Wn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Rf(s,e,r,n,i)}Uf(s,t)})}function Xf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Zf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=bn(e,n),i!=null&&r.unshift(Xf(e,i,a)),i=bn(e,t),i!=null&&r.push(Xf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Qf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function $f(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=bn(n,a),l!=null&&o.unshift(Xf(n,l,c))):i||(l=bn(n,a),l!=null&&o.push(Xf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var ep=/\r\n?/g,tp=/\u0000|\uFFFD/g;function np(e){return(typeof e==`string`?e:``+e).replace(ep,`
10
+ `).replace(tp,``)}function rp(e,t){return t=np(t),np(e)===t}function ip(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||an(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&an(e,``+r);else return;break;case`className`:Ut(e,`class`,r);break;case`tabIndex`:Ut(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ut(e,n,r);break;case`style`:W(e,r,o);return;case`data`:if(t!==`object`){Ut(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=dn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&ip(e,t,`name`,a.name,a,null),ip(e,t,`formEncType`,a.formEncType,a,null),ip(e,t,`formMethod`,a.formMethod,a,null),ip(e,t,`formTarget`,a.formTarget,a,null)):(ip(e,t,`encType`,a.encType,a,null),ip(e,t,`method`,a.method,a,null),ip(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=dn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=fn);return;case`onScroll`:r!=null&&Wf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Wf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=dn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Wf(`beforetoggle`,e),Wf(`toggle`,e),Ht(e,`popover`,r);break;case`xlinkActuate`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Ht(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=ln.get(n)||n,Ht(e,n,r);else return}Bt=!0}function ap(e,t,n,r,a,o){switch(n){case`style`:W(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)an(e,r);else if(typeof r==`number`||typeof r==`bigint`)an(e,``+r);else return;break;case`onScroll`:r!=null&&Wf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Wf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=fn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Nt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[vt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Bt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Ht(e,n,r)}return}Bt=!0}function op(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Wf(`error`,e),Wf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ip(e,t,o,s,n,null)}}a&&ip(e,t,`srcSet`,n.srcSet,n,null),r&&ip(e,t,`src`,n.src,n,null);return;case`input`:Wf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:ip(e,t,r,d,n,null)}}$t(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Wf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ip(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&tn(e,!!r,n,!0):tn(e,!!r,t,!1);return;case`textarea`:for(s in Wf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:ip(e,t,s,c,n,null)}rn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ip(e,t,l,r,n,null)}return;case`dialog`:Wf(`beforetoggle`,e),Wf(`toggle`,e),Wf(`cancel`,e),Wf(`close`,e);break;case`iframe`:case`object`:Wf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Vf.length;r++)Wf(Vf[r],e);break;case`image`:Wf(`error`,e),Wf(`load`,e);break;case`details`:Wf(`toggle`,e);break;case`embed`:case`source`:case`link`:Wf(`error`,e),Wf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ip(e,t,u,r,n,null)}return;default:if(cn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&ap(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ip(e,t,c,r,n,null))}var sp={};function cp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ip(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Bt=!0),o=m;break;case`name`:m!==f&&(Bt=!0),a=m;break;case`checked`:m!==f&&(Bt=!0),u=m;break;case`defaultChecked`:m!==f&&(Bt=!0),d=m;break;case`value`:m!==f&&(Bt=!0),s=m;break;case`defaultValue`:m!==f&&(Bt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&ip(e,t,p,m,r,f)}}Qt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||ip(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Bt=!0),p=o;break;case`defaultValue`:o!==l&&(Bt=!0),c=o;break;case`multiple`:o!==l&&(Bt=!0),s=o;default:o!==l&&ip(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?tn(e,!!n,n?[]:``,!1):tn(e,!!n,t,!0)):tn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ip(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Bt=!0),p=a;break;case`defaultValue`:a!==o&&(Bt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&ip(e,t,s,a,r,o)}nn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ip(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Bt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ip(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ip(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:ip(e,t,u,p,r,m)}return;default:if(cn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&ap(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||ap(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ip(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ip(e,t,f,p,r,m)}function lp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function up(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&lp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&lp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var dp=null,fp=null;function pp(e){return e.nodeType===9?e:e.ownerDocument}function mp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function hp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function gp(e,t,n,r){return n=pp(n).createElement(e),n[_t]=r,n[vt]=t,op(n,e,t),At(n),n}function _p(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var vp=null;function yp(){var e=window.event;return e&&e.type===`popstate`?e!==vp&&(vp=e,!0):(vp=null,!1)}var bp=typeof setTimeout==`function`?setTimeout:void 0,xp=typeof clearTimeout==`function`?clearTimeout:void 0,Sp=typeof Promise==`function`?Promise:void 0,Cp=typeof requestAnimationFrame==`function`?requestAnimationFrame:bp,wp=typeof queueMicrotask==`function`?queueMicrotask:Sp===void 0?bp:function(e){return Sp.resolve(null).then(e).catch(Tp)};function Tp(e){setTimeout(function(){throw e})}function Ep(e){return e===`head`}function Dp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Wh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)ym(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,ym(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[wt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&ym(e.ownerDocument.body)}n=i}while(n);Wh(t)}function Op(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function kp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ap(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function X(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function jp(e){return X(e.getBoundingClientRect(),getComputedStyle(e),e)}function Mp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return X(t,n,e)}function Np(e){return e.documentElement.clientHeight}function Pp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Fp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Np(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Qm(f),u>th){s.length=o;break}f=new Promise(Pp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Ip(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Ip.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:E({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Ip.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Ip.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Lp(e){return{name:e,group:new Ip(`group`,e),imagePair:new Ip(`image-pair`,e),old:new Ip(`old`,e),new:new Ip(`new`,e)}}function Rp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Rp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Up(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Vp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),m(this._fragmentFiber.child,!1,zp,e,s,r)}this._eventListeners=a}};function zp(e,t,n,r){return y(e).addEventListener(t,n,r),!1}Rp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Up(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Vp(i.optionsOrUseCapture),m(this._fragmentFiber.child,!1,Bp,e,n,i),r.splice(t,1),a!==null&&a()}};function Bp(e,t,n,r){return y(e).removeEventListener(t,n,r),!1}function Vp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Hp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Up(e,t,n,r){if(e.length===0)return-1;r=Hp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Hp(a.optionsOrUseCapture)===r)return i}return-1}Rp.prototype.dispatchEvent=function(e){var t=h(this._fragmentFiber);if(t===null)return!0;t=y(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Vp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Vp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Rp.prototype.focus=function(e){m(this._fragmentFiber.child,!0,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag!==6&&(e=y(e),Z(e,t))}Rp.prototype.focusLast=function(e){var t=[];m(this._fragmentFiber.child,!0,Gp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Wp(t[n],e);n--);};function Gp(e,t){return t.push(e),!1}Rp.prototype.blur=function(){var e=h(this._fragmentFiber);e!==null&&(e=y(e),e=pp(e).activeElement,e!==null&&m(this._fragmentFiber.child,!1,Kp,e,void 0,void 0))};function Kp(e,t){return e.tag!==6&&(e=y(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Rp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),m(this._fragmentFiber.child,!1,qp,e,void 0,void 0)};function qp(e,t){return e.tag!==6&&(e=y(e),t.observe(e),!1)}Rp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),m(this._fragmentFiber.child,!1,Jp,e,void 0,void 0);for(var n=t=0;n<Yp.length;n++){var r=Yp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Yp[t++]=r}Yp.length=t}};function Jp(e,t){return e.tag!==6&&(e=y(e),t.unobserve(e),!1)}var Yp=[],Xp=!1;function Zp(e,t,n){Yp.push({fragmentInstance:e,observer:t,instance:n}),Xp||(Xp=!0,gm(function(){Xp=!1;var e=Yp;Yp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Rp.prototype.getClientRects=function(){var e=[];return m(this._fragmentFiber.child,!1,Qp,e,void 0,void 0),e};function Qp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=y(e),t.push.apply(t,e.getClientRects());return!1}Rp.prototype.getRootNode=function(e){var t=h(this._fragmentFiber);return t===null?this:y(t).getRootNode(e)},Rp.prototype.compareDocumentPosition=function(e){var t=h(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];m(this._fragmentFiber.child,!1,Gp,n,void 0,void 0);var r=y(t);if(n.length===0){if(n=r,g(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=_(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=y(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=y(n[0]),i=y(n[n.length-1]);var a=g(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||$p(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function $p(e,t,n,r,i){var a=Dt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=h(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=T(n,a,w),t===null?t=!1:(m(t,!0,S,a,n),a=b,b=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=T(r,a,w),t===null?t=!1:(m(t,!0,C,a,r),a=b,x=b=null,t=a!==null)),t):!1}function em(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Rp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];m(this._fragmentFiber.child,!1,Gp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=_(this._fragmentFiber);if(r=n?r[1]||r[0]||h(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=y(r),em(e,n);return}if(r=y(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=y(a),em(a,n)):y(a).scrollIntoView(e),r+=n?-1:1}};function tm(e,t){return e=y(e),nm(e,t),!1}function nm(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function rm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Vp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Yp.length;i++){var a=Yp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Yp[r++]=a)}Yp.length=r,n.observe(e)}),nm(e,t))}function im(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Vp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Zp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function am(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:am(n),Et(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function om(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[wt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=fm(e.nextSibling),e===null)break}return null}function sm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=fm(e.nextSibling),e===null))return null;return e}function cm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=fm(e.nextSibling),e===null))return null;return e}function lm(e){return e.data===`$?`||e.data===`$~`}function um(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function dm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function fm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var pm=null;function mm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return fm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Z(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function gm(e){Cp(function(){Cp(function(t){return e(t)})})}function _m(e,t,n){switch(t=pp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function vm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ip(e,t,r,null,sp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===fn&&(e.onclick=null),Et(e)}function ym(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Et(e)}var bm=new Map,xm=new Set;function Sm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Cm=B.d;B.d={f:wm,r:Tm,D:Om,C:km,L:Am,m:jm,X:Nm,S:Mm,M:Pm};function wm(){var e=Cm.f(),t=Bd();return e||t}function Tm(e){var t=Ot(e);t!==null&&t.tag===5&&t.type===`form`?Zs(t):Cm.r(e)}var Em=typeof document>`u`?null:document;function Dm(e,t,n){var r=Em;if(r&&typeof t==`string`&&t){var i=Zt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),xm.has(i)||(xm.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),op(t,`link`,e),At(t),r.head.appendChild(t)))}}function Om(e){Cm.D(e),Dm(`dns-prefetch`,e,null)}function km(e,t){Cm.C(e,t),Dm(`preconnect`,e,t)}function Am(e,t,n){Cm.L(e,t,n);var r=Em;if(r&&e&&t){var i=`link[rel="preload"][as="`+Zt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Zt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Zt(n.imageSizes)+`"]`)):i+=`[href="`+Zt(e)+`"]`;var a=i;switch(t){case`style`:a=Im(e);break;case`script`:a=Bm(e)}if(!(bm.has(a)||(e=E({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),bm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lm(a))||t===`script`&&r.querySelector(Vm(a))))){var o=r.createElement(`link`);op(o,`link`,e),t===`style`&&(o[Tt]=!0,o.onload=o.onerror=function(){jt(o)}),At(o),r.head.appendChild(o)}}}function jm(e,t){Cm.m(e,t);var n=Em;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Zt(r)+`"][href="`+Zt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bm(e)}if(!bm.has(a)&&(e=E({rel:`modulepreload`,href:e},t),bm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vm(a)))return}r=n.createElement(`link`),op(r,`link`,e),At(r),n.head.appendChild(r)}}}function Mm(e,t,n){Cm.S(e,t,n);var r=Em;if(r&&e){var i=U(r).hoistableStyles,a=Im(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lm(a)))s.loading=5;else{e=E({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=bm.get(a))&&Wm(e,n);var c=o=r.createElement(`link`);At(c),op(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Um(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nm(e,t){Cm.X(e,t);var n=Em;if(n&&e){var r=U(n).hoistableScripts,i=Bm(e),a=r.get(i);a||(a=n.querySelector(Vm(i)),a||(e=E({src:e,async:!0},t),(t=bm.get(i))&&Gm(e,t),a=n.createElement(`script`),At(a),op(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pm(e,t){Cm.M(e,t);var n=Em;if(n&&e){var r=U(n).hoistableScripts,i=Bm(e),a=r.get(i);a||(a=n.querySelector(Vm(i)),a||(e=E({src:e,async:!0,type:`module`},t),(t=bm.get(i))&&Gm(e,t),a=n.createElement(`script`),At(a),op(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Fm(e,t,n,r){var a=(a=ve.current)?Sm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Im(n.href),t=U(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Im(n.href);var o=U(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Lm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=bm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},bm.set(e,o)),zm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Bm(n),t=U(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Im(e){return`href="`+Zt(e)+`"`}function Lm(e){return`link[rel="stylesheet"][`+e+`]`}function Rm(e){return E({},e,{"data-precedence":e.precedence,precedence:null})}function zm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Tt]){r.loading=1;return}}else t=e.createElement(`link`),t[Tt]=!0,t.onload=t.onerror=jt.bind(null,t),op(t,`link`,n),At(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Bm(e){return`[src="`+Zt(e)+`"]`}function Vm(e){return`script[async]`+e}function Hm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Zt(n.href)+`"]`);if(r)return t.instance=r,At(r),r;var a=E({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),At(r),op(r,`style`,a),Um(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Im(n.href);var o=e.querySelector(Lm(a));if(o)return t.state.loading|=4,t.instance=o,At(o),o;r=Rm(n),(a=bm.get(a))&&Wm(r,a),o=(e.ownerDocument||e).createElement(`link`),At(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),op(o,`link`,r),t.state.loading|=4,Um(o,n.precedence,e),t.instance=o;case`script`:return o=Bm(n.src),(a=e.querySelector(Vm(o)))?(t.instance=a,At(a),a):(r=n,(a=bm.get(o))&&(r=E({},n),Gm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),At(a),op(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Um(r,n.precedence,e));return t.instance}function Um(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Wm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Gm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Km=null;function qm(e,t,n){if(Km===null){var r=new Map,i=Km=new Map;i.set(n,r)}else i=Km,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[wt]||a[_t]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Jm(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Ym(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Xm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Zm(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Qm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function $m(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Qm(t),e.suspenseyImages.push(t)),e=ah.bind(e),t.decode().then(e,e))}function eh(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Im(r.href),a=t.querySelector(Lm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ih.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,At(a);return}a=t.ownerDocument||t,r=Rm(r),(i=bm.get(i))&&Wm(r,i),a=a.createElement(`link`),At(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),op(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ih.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var th=0;function nh(e,t){return e.stylesheets&&e.count===0&&sh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&sh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&th===0&&(th=62500*up());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&sh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>th?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)sh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ih(){this.count--,rh(this)}function ah(){this.imgCount--,rh(this)}var oh=null;function sh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,oh=new Map,t.forEach(ch,e),oh=null,ih.call(e))}function ch(e,t){if(!(t.state.loading&4)){var n=oh.get(e);if(n)var r=n.get(null);else{n=new Map,oh.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ih.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var lh={$$typeof:P,Provider:null,Consumer:null,_currentValue:de,_currentValue2:de,_threadCount:0};function uh(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ot(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ot(0),this.hiddenUpdates=ot(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function dh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new uh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Ei(3,null,null,t),e.current=a,a.stateNode=e,t=Ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},so(a),e}function fh(e){return e?(e=wi,e):wi}function ph(e,t,n,r,i,a){i=fh(i),r.context===null?r.context=i:r.pendingContext=i,r=lo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=uo(e,r,t),n!==null&&(Fd(n,e,t),fo(n,e,t))}function mh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hh(e,t){mh(e,t),(e=e.alternate)&&mh(e,t)}function gh(e){if(e.tag===13||e.tag===31){var t=xi(e,67108864);t!==null&&Fd(t,e,67108864),hh(e,67108864)}}function _h(e){if(e.tag===13||e.tag===31){var t=Md();t=ft(t);var n=xi(e,t);n!==null&&Fd(n,e,t),hh(e,t)}}var vh=!0;function yh(e,t,n,r){var i=z.T;z.T=null;var a=B.p;try{B.p=2,xh(e,t,n,r)}finally{B.p=a,z.T=i}}function bh(e,t,n,r){var i=z.T;z.T=null;var a=B.p;try{B.p=8,xh(e,t,n,r)}finally{B.p=a,z.T=i}}function xh(e,t,n,r){if(vh){var i=Sh(r);if(i===null)Yf(e,t,r,Ch,n),Ph(e,r);else if(Ih(i,e,t,n,r))r.stopPropagation();else if(Ph(e,r),t&4&&-1<Nh.indexOf(e)){for(;i!==null;){var a=Ot(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=et(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-qe(o);s.entanglements[1]|=c,o&=~c}Of(a),!(Xu&6)&&(_d=Fe()+500,kf(0,!1))}}break;case 31:case 13:s=xi(a,2),s!==null&&Fd(s,a,2),Bd(),hh(a,2)}if(a=Sh(r),a===null&&Yf(e,t,r,Ch,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Yf(e,t,r,null,n)}}function Sh(e){return e=mn(e),wh(e)}var Ch=null;function wh(e){if(Ch=null,e=Dt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ch=e,null}function Th(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ie()){case Le:return 2;case Re:return 8;case ze:case Be:return 32;case Ve:return 268435456;default:return 32}default:return 32}}var Eh=!1,Dh=null,Oh=null,kh=null,Ah=new Map,jh=new Map,Mh=[],Nh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Ph(e,t){switch(e){case`focusin`:case`focusout`:Dh=null;break;case`dragenter`:case`dragleave`:Oh=null;break;case`mouseover`:case`mouseout`:kh=null;break;case`pointerover`:case`pointerout`:Ah.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:jh.delete(t.pointerId)}}function Fh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ot(t),t!==null&&gh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ih(e,t,n,r,i){switch(t){case`focusin`:return Dh=Fh(Dh,e,t,n,r,i),!0;case`dragenter`:return Oh=Fh(Oh,e,t,n,r,i),!0;case`mouseover`:return kh=Fh(kh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ah.set(a,Fh(Ah.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,jh.set(a,Fh(jh.get(a)||null,e,t,n,r,i)),!0}return!1}function Lh(e){var t=Dt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,ht(e.priority,function(){_h(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ht(e.priority,function(){_h(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Rh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Sh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);pn=r,n.target.dispatchEvent(r),pn=null}else return t=Ot(n),t!==null&&gh(t),e.blockedOn=n,!1;t.shift()}return!0}function zh(e,t,n){Rh(e)&&n.delete(t)}function Bh(){Eh=!1,Dh!==null&&Rh(Dh)&&(Dh=null),Oh!==null&&Rh(Oh)&&(Oh=null),kh!==null&&Rh(kh)&&(kh=null),Ah.forEach(zh),jh.forEach(zh)}function Vh(e,n){e.blockedOn===n&&(e.blockedOn=null,Eh||(Eh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Bh)))}var Hh=null;function Uh(e){Hh!==e&&(Hh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Hh===e&&(Hh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(wh(r||n)===null)continue;break}var a=Ot(n);a!==null&&(e.splice(t,3),t-=3,Ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Wh(e){function t(t){return Vh(t,e)}Dh!==null&&Vh(Dh,e),Oh!==null&&Vh(Oh,e),kh!==null&&Vh(kh,e),Ah.forEach(t),jh.forEach(t);for(var n=0;n<Mh.length;n++){var r=Mh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Mh.length&&(n=Mh[0],n.blockedOn===null);)Lh(n),n.blockedOn===null&&Mh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[vt]||null;if(typeof a==`function`)o||Uh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[vt]||null)s=o.formAction;else if(wh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Uh(n)}}}function Gh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Kh(e){this._internalRoot=e}qh.prototype.render=Kh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;ph(n,Md(),e,t,null,null)},qh.prototype.unmount=Kh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ph(e.current,2,null,e,null,null),Bd(),t[yt]=null}};function qh(e){this._internalRoot=e}qh.prototype.unstable_scheduleHydration=function(e){if(e){var t=mt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Mh.length&&t!==0&&t<Mh[n].priority;n++);Mh.splice(n,0,e),n===0&&Lh(e)}};var Jh=n.version;if(Jh!==`19.3.0`)throw Error(i(527,Jh,`19.3.0`));B.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Yh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:z,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Xh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xh.isDisabled&&Xh.supportsFiber)try{We=Xh.inject(Yh),Ge=Xh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=vc,s=yc,c=bc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=dh(e,1,!1,null,null,n,r,null,o,s,c,Gh),e[yt]=t.current,qf(e),new Kh(t)}})),_i=i(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=gi()})),vi=/(https?:\/\/[^\s"<>`{}|\\^]+)/,yi=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,bi=/^data:image\//i,xi=[`avatars.githubusercontent.com`];function Si(e){return bi.test(e)?[{type:`image`,url:e}]:e.split(vi).filter(e=>e!==``).map(e=>vi.test(e)?yi.test(e)||bi.test(e)||xi.some(t=>e.includes(t))?{type:`image`,url:e}:{type:`url`,url:e}:{type:`text`,value:e})}var Ci=new RegExp(vi.source,`g`);BigInt.prototype.toJSON=function(){return JSON.rawJSON(this.toString())};function wi(e){try{return JSON.parse(e,(e,t)=>Oi(t))}catch{}if(e==null||e===``)return{};try{return e??=``,e=e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g,`"◐$1◐"`),JSON.parse(e,(e,t)=>typeof t==`string`?t===`◐NaN◐`?NaN:t===`◐Infinity◐`?1/0:t===`◐-Infinity◐`?-1/0:Oi(t):Oi(t))}catch{return{}}}function Ti(e){if(e.length===0)return``;let t=Object.keys(e[0]);return[`| ${t.join(` | `)} |`,`|${t.map(()=>`---`).join(`|`)}|`,...e.map(e=>`| ${t.map(t=>Ei(e[t])).join(` | `)} |`)].join(`
11
11
  `)}function Ei(e){if(e==null)return``;if(Array.isArray(e)||typeof e==`object`)return Di(JSON.stringify(e));let t=String(e),n=/\[([^\]]+)]\((https?:\/\/[^)]+)\)/g,r=new Map,i=0;t=t.replaceAll(n,e=>{let t=`__MDLINK_${i++}__`;return r.set(t,e),t}),t=t.replaceAll(Ci,`[$1]($1)`);for(let[e,n]of r)t=t.replace(e,n);return Di(t)}function Di(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`|`,`\\|`).replaceAll(`
12
12
  `,` `).replaceAll(`\r`,``)}function Oi(e){return typeof e==`object`&&e&&`$bigint`in e&&typeof e.$bigint==`string`?BigInt(e.$bigint):e}var ki=`object-id`,Ai=`random-id`,ji=`abcdefghijklmnopqrstuvwxyz`,Mi=ji+ji.toUpperCase(),Ni=new Set,Pi=`__scratch__`,Fi=`setup`,Ii={create(){let e=0,t;do{let n=``;for(let e=0;e<4;e++)n+=Mi[Math.floor(Math.random()*52)];t=n,e++}while(Ni.has(t)&&e<100);if(e>=100)throw Error(`Failed to generate unique CellId after 100 attempts`);return Ni.add(t),t}},Li={create(e){return B(e!=null,`cellId is required`),`cell-${e}`},parse(e){return e.slice(5)},findElement(e){return e.closest(`div[id^="cell-"]`)},findElementThroughShadowDOMs(e){let t=e;for(;t;){let e=Li.findElement(t);if(e)return e;let n=t.getRootNode();if(t=n instanceof ShadowRoot?n.host:t.parentElement,t===n)break}return null}};function Ri(e){let t=null,n=Li.findElementThroughShadowDOMs(e);return n&&(t=Li.parse(n.id)),t}var zi={parse(e){return e.getAttribute(ki)},parseOrThrow(e){let t=zi.parse(e);return B(t,`<marimo-ui-element/> missing object-id attribute`),t}},Bi={create(e){return`output-${e}`}},Vi=new class{getFilename(){return this.getSearchParam(`filename`)}setFilename(e){this.setSearchParam(`filename`,e)}getCodeFromSearchParam(){return this.getSearchParam(`code`)}getCodeFromHash(){let e=window.location.hash;return e.startsWith(`#code/`)?e.slice(6):null}setCodeForHash(e){window.location.hash=`#code/${e}`}setSearchParam(e,t){let n=new URL(window.location.href);n.searchParams.set(e,t),window.history.replaceState({},``,n.toString())}getSearchParam(e){return new URL(window.location.href).searchParams.get(e)}};function Hi(e){return wi(e??``)}function Ui(e){return z.mapValues(e.dataset,e=>typeof e==`string`?Hi(e):e)}function Wi(e,t){let n=e.parentElement?zi.parse(e.parentElement):void 0;return n&&t.has(n)?t.lookupValue(n):Hi(e.dataset.initialValue)}function Gi(){if(de())return document.title||null;if(_e()){let e=Vi.getFilename();if(e)return e}let e=document.querySelector(`marimo-filename`);me(e,`marimo-filename tag not found`);let t=e.innerHTML;return t.length===0?null:t}var K=e(f(),1),q=we(),Ki=Object.defineProperty,qi=(e,t)=>Ki(e,`name`,{value:t,configurable:!0}),Ji=`Checkbox`,[Yi,Xi]=De(Ji),[Zi,Qi]=Yi(Ji);function $i(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Te({prop:n,defaultProp:i??!1,onChange:c,caller:Ji}),[m,h]=K.useState(null),[g,_]=K.useState(null),[v,y]=K.useState(null),b=!m||!!o||!!m.closest(`form`),x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,userClick:v,onUserClick:y,required:l,defaultChecked:!ca(i)&&i,isFormControl:b,bubbleInput:g,setBubbleInput:_};return(0,q.jsx)(Zi,{scope:t,...x,children:sa(d)?d(x):r})}qi($i,`CheckboxProvider`);var ea=`CheckboxTrigger`,ta=K.forwardRef(qi(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,onUserClick:f,isFormControl:p,bubbleInput:m}=Qi(ea,e),h=le(i,u),g=K.useRef(c);return K.useEffect(()=>{let e=a?.form;if(e){let t=qi(()=>d(g.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,q.jsx)(Ee.button,{type:`button`,role:`checkbox`,"aria-checked":ca(c)?`mixed`:c,"aria-required":l,"data-state":la(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:He(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:He(n,e=>{let t=e.isPropagationStopped();f({requestedChecked:ca(c)?!0:!c,hasConsumerStoppedPropagation:t}),d(e=>ca(e)?!0:!e),m&&p&&(t||e.stopPropagation())})})},`CheckboxTrigger`)),na=K.forwardRef(qi(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,q.jsx)($i,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ta,{...d,ref:t,__scopeCheckbox:n}),e&&(0,q.jsx)(oa,{__scopeCheckbox:n})]})})},`Checkbox`)),ra=`CheckboxIndicator`,ia=K.forwardRef(qi(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Qi(ra,n);return(0,q.jsx)(Oe,{present:r||ca(a.checked)||a.checked===!0,children:(0,q.jsx)(Ee.span,{"data-state":la(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),aa=`CheckboxBubbleInput`,oa=K.forwardRef(qi(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,userClick:a,checked:o,defaultChecked:s,required:c,disabled:l,name:u,value:d,form:f,bubbleInput:p,setBubbleInput:m}=Qi(aa,e),h=le(r,m),g=We(i),_=K.useRef(!1),v=K.useRef(o),y=K.useRef(a),b=K.useRef(null);K.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=v.current!==o;v.current=o;let i=a!==null&&a!==y.current;if(y.current=a,i)b.current=r?null:a,r&&(e.indeterminate=ca(o),n.call(e,!ca(o)&&o)),e.dispatchEvent(new Event(`click`,{bubbles:!a.hasConsumerStoppedPropagation}));else if(r){let t=b.current;b.current=null;let r=t?.requestedChecked===o;_.current=!0,e.indeterminate=ca(o),n.call(e,!ca(o)&&o),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),_.current=!1}},[p,o,a]);let x=K.useRef(!ca(o)&&o);return(0,q.jsx)(Ee.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??x.current,required:c,disabled:l,name:u,value:d,form:f,...n,tabIndex:-1,ref:h,onClick:He(t,e=>{_.current&&e.stopPropagation()}),style:{...n.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function sa(e){return typeof e==`function`}qi(sa,`isFunction`);function ca(e){return e===`indeterminate`}qi(ca,`isIndeterminate`);function la(e){return ca(e)?`indeterminate`:e?`checked`:`unchecked`}qi(la,`getState`);var ua=Object.defineProperty,da=(e,t)=>ua(e,`name`,{value:t,configurable:!0}),fa=`Popover`,[pa,ma]=De(fa,[Ge]),ha=Ge(),[ga,_a]=pa(fa),va=da(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=ha(t),c=K.useRef(null),[l,u]=K.useState(!1),[d,f]=K.useState(0),[p,m]=K.useState(0),[h,g]=Te({prop:r,defaultProp:i??!1,onChange:a,caller:fa});return(0,q.jsx)(Je,{...s,children:(0,q.jsx)(ga,{scope:t,contentId:Ue(),titleId:Ue(),descriptionId:Ue(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:K.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:K.useCallback(()=>u(!0),[]),onCustomAnchorRemove:K.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),ya=`PopoverAnchor`,ba=K.forwardRef(da(function(e,t){let{__scopePopover:n,...r}=e,i=_a(ya,n),a=ha(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return K.useEffect(()=>(o(),()=>s()),[o,s]),(0,q.jsx)(Ke,{...a,...r,ref:t})},`PopoverAnchor`)),xa=`PopoverTrigger`,Sa=K.forwardRef(da(function(e,t){let{__scopePopover:n,...r}=e,i=_a(xa,n),a=ha(n),o=le(t,i.triggerRef),s=(0,q.jsx)(Ee.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Fa(i.open),...r,ref:o,onClick:He(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,q.jsx)(Ke,{asChild:!0,...a,children:s})},`PopoverTrigger`)),Ca=`PopoverPortal`,[wa,Ta]=pa(Ca,{forceMount:void 0}),Ea=da(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=_a(Ca,t);return(0,q.jsx)(wa,{scope:t,forceMount:n,children:(0,q.jsx)(Oe,{present:n||a.open,children:(0,q.jsx)(Ne,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Da=`PopoverContent`,Oa=K.forwardRef(da(function(e,t){let n=Ta(Da,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=_a(Da,e.__scopePopover);return(0,q.jsx)(Oe,{present:r||a.open,children:a.modal?(0,q.jsx)(Aa,{...i,ref:t}):(0,q.jsx)(ja,{...i,ref:t})})},`PopoverContent`)),ka=ue(`PopoverContent.RemoveScroll`),Aa=K.forwardRef(da(function(e,t){let n=_a(Da,e.__scopePopover),r=K.useRef(null),i=le(t,r),a=K.useRef(!1),{nodes:o,registry:s}=Pe();return K.useEffect(()=>{let e=r.current;if(e)return je(e)},[]),(0,q.jsx)(Le,{as:ka,allowPinchZoom:!0,shards:K.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,q.jsx)(Ma,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:He(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:He(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:He(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),ja=K.forwardRef(da(function(e,t){let n=_a(Da,e.__scopePopover),r=K.useRef(!1),i=K.useRef(!1);return(0,q.jsx)(Ma,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),Ma=K.forwardRef(da(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,"aria-describedby":d,branchNodes:f,branchRegistry:p,...m}=e,h=_a(Da,n),g=ha(n),[_,v]=K.useState(null),y=le(t,v);return Fe(_),Me(),(0,q.jsx)(Re,{registry:p,children:(0,q.jsx)(ze,{asChild:!0,loop:!0,trapped:r,branches:f,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,q.jsx)(ke,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,q.jsx)(qe,{"data-state":Fa(h.open),role:`dialog`,id:h.contentId,"aria-labelledby":h.titlePresent?h.titleId:void 0,"aria-describedby":h.descriptionPresent?Ia(d,h.descriptionId):d,...g,...m,ref:y,style:{...m.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`)),Na=`PopoverClose`,Pa=K.forwardRef(da(function(e,t){let{__scopePopover:n,...r}=e,i=_a(Na,n);return(0,q.jsx)(Ee.button,{type:`button`,...r,ref:t,onClick:He(e.onClick,()=>i.onOpenChange(!1))})},`PopoverClose`));function Fa(e){return e?`open`:`closed`}da(Fa,`getState`);function Ia(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}da(Ia,`concatAriaDescribedby`);var La=Object.defineProperty,Ra=(e,t)=>La(e,`name`,{value:t,configurable:!0}),za=`Radio`,[Ba,Va]=De(za),[Ha,Ua]=Ba(za);function Wa(e){let{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:a,name:o,onCheck:s,required:c,value:l=`on`,internal_do_not_use_render:u}=e,[d,f]=K.useState(null),[p,m]=K.useState(null),[h,g]=K.useState(null),_={checked:n,disabled:i,required:c,name:o,form:a,value:l,control:d,setControl:f,userClick:h,onUserClick:g,isFormControl:!d||!!a||!!d.closest(`form`),bubbleInput:p,setBubbleInput:m,onCheck:Ra(()=>s?.(),`onCheck`)};return(0,q.jsx)(Ha,{scope:t,..._,children:Za(u)?u(_):r})}Ra(Wa,`RadioProvider`);var Ga=`RadioTrigger`,Ka=K.forwardRef(Ra(function({__scopeRadio:e,onClick:t,...n},r){let{checked:i,disabled:a,value:o,setControl:s,onCheck:c,onUserClick:l,isFormControl:u,bubbleInput:d}=Ua(Ga,e),f=le(r,s);return(0,q.jsx)(Ee.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Qa(i),"data-disabled":a?``:void 0,disabled:a,value:o,...n,ref:f,onClick:He(t,e=>{let t=e.isPropagationStopped();i||(l({hasConsumerStoppedPropagation:t}),c()),d&&u&&(t||e.stopPropagation())})})},`RadioTrigger`)),qa=`RadioIndicator`,Ja=K.forwardRef(Ra(function(e,t){let{__scopeRadio:n,forceMount:r,...i}=e,a=Ua(qa,n);return(0,q.jsx)(Oe,{present:r||a.checked,children:(0,q.jsx)(Ee.span,{"data-state":Qa(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})},`RadioIndicator`)),Ya=`RadioBubbleInput`,Xa=K.forwardRef(Ra(function({__scopeRadio:e,onClick:t,...n},r){let{control:i,checked:a,required:o,disabled:s,name:c,value:l,form:u,bubbleInput:d,setBubbleInput:f,userClick:p}=Ua(Ya,e),m=le(r,f),h=We(i),g=K.useRef(!1),_=K.useRef(a),v=K.useRef(p),y=K.useRef(null);K.useEffect(()=>{let e=d;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=_.current!==a;_.current=a;let i=p!==null&&p!==v.current;if(v.current=p,i)y.current=r?null:p,r&&n.call(e,a),e.dispatchEvent(new Event(`click`,{bubbles:!p.hasConsumerStoppedPropagation}));else if(r){let t=y.current;y.current=null;let r=a&&t!==null;g.current=!0,n.call(e,a),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),g.current=!1}},[d,a,p]);let b=K.useRef(a);return(0,q.jsx)(Ee.input,{type:`radio`,"aria-hidden":!0,defaultChecked:b.current,required:o,disabled:s,name:c,value:l,form:u,...n,tabIndex:-1,ref:m,onClick:He(t,e=>{g.current&&e.stopPropagation()}),style:{...n.style,...h,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`RadioBubbleInput`));function Za(e){return typeof e==`function`}Ra(Za,`isFunction`);function Qa(e){return e?`checked`:`unchecked`}Ra(Qa,`getState`);var $a=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],eo=`RadioGroup`,[to,no]=De(eo,[it,Va]),ro=it(),io=Va(),[ao,oo]=to(eo),so=K.forwardRef(Ra(function(e,t){let{__scopeRadioGroup:n,name:r,form:i,defaultValue:a,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...p}=e,m=ro(n),h=$e(u),[g,_]=Te({prop:o,defaultProp:a??null,onChange:f,caller:eo}),[v,y]=K.useState(null),b=le(t,y),x=K.useRef(g);return K.useEffect(()=>{let e=i?v?.ownerDocument.getElementById(i):v?.closest(`form`);if(e instanceof HTMLFormElement){let t=Ra(()=>_(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[v,i,_]),(0,q.jsx)(ao,{scope:n,name:r,form:i,required:s,disabled:c,value:g,onValueChange:_,children:(0,q.jsx)(at,{asChild:!0,...m,orientation:l,dir:h,loop:d,children:(0,q.jsx)(Ee.div,{role:`radiogroup`,"aria-required":s,"aria-orientation":l,"data-disabled":c?``:void 0,dir:h,...p,ref:b})})})},`RadioGroup`)),co=`RadioGroupItemProvider`,lo=`RadioGroupItemTrigger`;function uo(e){let{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:a}=e,o=oo(co,t),s=io(t),c=o.disabled||r;return(0,q.jsx)(Wa,{...s,checked:o.value===n,disabled:c,required:o.required,name:o.name,form:o.form,value:n,onCheck:()=>o.onValueChange(n),internal_do_not_use_render:a,children:i})}Ra(uo,`RadioGroupItemProvider`);var fo=K.forwardRef(Ra(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=ro(n),a=io(n),{checked:o,disabled:s}=Ua(lo,a.__scopeRadio),c=K.useRef(null),l=le(t,c),u=K.useRef(!1);return K.useEffect(()=>{let e=Ra(e=>{$a.includes(e.key)&&(u.current=!0)},`handleKeyDown`),t=Ra(()=>u.current=!1,`handleKeyUp`);return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,q.jsx)(ot,{asChild:!0,...i,focusable:!s,active:o,children:(0,q.jsx)(Ka,{...a,...r,ref:l,onKeyDown:He(r.onKeyDown,e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:He(r.onFocus,()=>{u.current&&c.current?.click()})})})},`RadioGroupItemTrigger`)),po=K.forwardRef(Ra(function(e,t){let{__scopeRadioGroup:n,value:r,disabled:i,...a}=e;return(0,q.jsx)(uo,{__scopeRadioGroup:n,value:r,disabled:i,internal_do_not_use_render:({isFormControl:e})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(fo,{...a,ref:t,__scopeRadioGroup:n}),e&&(0,q.jsx)(mo,{__scopeRadioGroup:n})]})})},`RadioGroupItem`)),mo=K.forwardRef(Ra(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=io(n);return(0,q.jsx)(Xa,{...i,...r,ref:t})},`RadioGroupItemBubbleInput`)),ho=K.forwardRef(Ra(function(e,t){let{__scopeRadioGroup:n,...r}=e,i=io(n);return(0,q.jsx)(Ja,{...i,...r,ref:t})},`RadioGroupIndicator`)),go=Object.defineProperty,_o=(e,t)=>go(e,`name`,{value:t,configurable:!0}),vo=`Toggle`,yo=K.forwardRef(_o(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=Te({prop:n,onChange:i,defaultProp:r??!1,caller:vo});return(0,q.jsx)(Ee.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:He(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),bo=Ct(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),xo=Ct(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),So=Ct(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Co=Ct(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),wo=Ct(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),To=Ct(`circle-plus`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),Eo=Ct(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Do=Ct(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Oo=Ct(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),ko=Ct(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),Ao=Ct(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),jo=Ct(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Mo=Ct(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),No=Ct(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Po=Ct(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Fo=Ct(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),J=Ct(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Io=Ct(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Lo=Ct(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),Ro=Ct(`paint-roller`,[[`rect`,{width:`16`,height:`6`,x:`2`,y:`2`,rx:`2`,key:`jcyz7m`}],[`path`,{d:`M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2`,key:`1b9h7c`}],[`rect`,{width:`4`,height:`6`,x:`8`,y:`16`,rx:`1`,key:`d6e7yl`}]]),zo=Ct(`refresh-ccw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),Bo=Ct(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Vo=Ct(`search-check`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),Ho=Ct(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Uo=Ct(`square-dashed-bottom-code`,[[`path`,{d:`M10 9.5 8 12l2 2.5`,key:`3mjy60`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`m14 9.5 2 2.5-2 2.5`,key:`1bir2l`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2`,key:`as5y1o`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}]]),Wo=Ct(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Go=Ct(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Ko=Ct(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),qo=Ct(`text-search`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M10 12H3`,key:`1ulcyk`}],[`path`,{d:`M10 19H3`,key:`108z41`}],[`circle`,{cx:`17`,cy:`15`,r:`3`,key:`1upz2a`}],[`path`,{d:`m21 19-1.9-1.9`,key:`dwi7p8`}]]),Jo=Ct(`variable`,[[`path`,{d:`M8 21s-4-3-4-9 4-9 4-9`,key:`uto9ud`}],[`path`,{d:`M16 3s4 3 4 9-4 9-4 9`,key:`4w2vsq`}],[`line`,{x1:`15`,x2:`9`,y1:`9`,y2:`15`,key:`f7djnv`}],[`line`,{x1:`9`,x2:`15`,y1:`9`,y2:`15`,key:`1shsy8`}]]);function Yo(e){let t,n,r;return typeof e==`object`?(t=e.hashFunction,n=e.expiring,r=e.tags):t=e,(e,i,a)=>{if(a.value!=null)a.value=Zo(a.value,t,n,r);else if(a.get!=null)a.get=Zo(a.get,t,n,r);else throw`Only put a Memoize() decorator on a method or get accessor.`}}var Xo=new Map;function Zo(e,t,n=0,r){let i=Symbol(`__memoized_map__`);return function(...a){let o;this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let s=this[i];if(Array.isArray(r))for(let e of r)Xo.has(e)?Xo.get(e).push(s):Xo.set(e,[s]);if(t||a.length>0||n>0){let r;r=t===!0?a.map(e=>e.toString()).join(`!`):t?t.apply(this,a):a[0];let i=`${r}__timestamp`,c=!1;if(n>0){if(!s.has(i))c=!0;else{let e=s.get(i);c=Date.now()-e>n}}s.has(r)&&!c?o=s.get(r):(o=e.apply(this,a),s.set(r,o),n>0&&s.set(i,Date.now()))}else{let t=this;s.has(t)?o=s.get(t):(o=e.apply(this,a),s.set(t,o))}return o}}var Qo=o(Gi()),$o=o(null),es=o(null),ts=o(void 0),ns=class{store=new Map;get length(){return this.store.size}clear(){this.store.clear()}getItem(e){return this.store.get(e)||null}key(e){return[...this.store.keys()][e]||null}removeItem(e){this.store.delete(e)}setItem(e,t){this.store.set(e,t)}};function rs(){let{hasLocalStorage:e,hasSessionStorage:t}=kr();return e?window.localStorage:t?window.sessionStorage:new ns}var is=rs(),as=class{defaultValue;storage;constructor(e,t=is){this.defaultValue=e,this.storage=t}get(e){try{let t=this.storage.getItem(e);return t?JSON.parse(t):this.defaultValue}catch{return this.defaultValue}}set(e,t){this.storage.setItem(e,JSON.stringify(t))}remove(e){this.storage.removeItem(e)}},os=class{schema;getDefaultValue;storage;constructor(e,t,n=is){this.schema=e,this.getDefaultValue=t,this.storage=n}get(e){try{let t=this.storage.getItem(e);if(t==null)return this.getDefaultValue();let n=this.schema.safeParse(JSON.parse(t));return n.success?n.data:(R.warn(`Error parsing zod local storage`,n.error),this.getDefaultValue())}catch(e){return R.warn(`Error getting zod local storage`,e),this.getDefaultValue()}}set(e,t){this.storage.setItem(e,JSON.stringify(t))}remove(e){this.storage.removeItem(e)}},ss=class extends os{filename;unsubscribeFromFilename;constructor(e,t,n){let r=u.get(Qo);super(t,n),this.filename=r;try{this.unsubscribeFromFilename=u.sub(Qo,()=>{let t=u.get(Qo);this.handleFilenameChange(e,t)})}catch{this.unsubscribeFromFilename=null}}get(e){return super.get(this.createScopedKey(e,this.filename))}set(e,t){super.set(this.createScopedKey(e,this.filename),t)}remove(e){super.remove(this.createScopedKey(e,this.filename))}createScopedKey(e,t){return t?`${e}:${t}`:e}handleFilenameChange(e,t){if(t&&t!==this.filename){let n=this.get(e);this.remove(e),this.filename=t,this.set(e,n)}}dispose(){this.unsubscribeFromFilename&&=(this.unsubscribeFromFilename(),null)}},cs=`marimo:notebook-col-sizes`;function ls(){return{widths:[]}}var us=new ss(cs,_({widths:b(y([g(),v(`contentWidth`)]).default(`contentWidth`))}),ls),ds={getColumnWidth:e=>us.get(cs).widths[e]??`contentWidth`,saveColumnWidth:(e,t)=>{let n=us.get(cs).widths;if(n[e])n[e]=t;else{for(;n.length<=e;)n.push(`contentWidth`);n[e]=t}us.set(cs,{widths:n})},clearStorage:()=>{us.remove(cs)}};function fs(e,t){let n=us.get(cs).widths,r=Sr(n,e,t);us.set(cs,{widths:r})}function ps(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var ms=class{value;isCollapsed;children;constructor(e,t,n){this.value=e,this.isCollapsed=t,this.children=n}geDescendantCount(){let e=0,t=[...this.children];for(;t.length>0;){let n=t.pop();e++;for(let e=n.children.length-1;e>=0;e--)t.push(n.children[e])}return e}getDescendants(){let e=[],t=[...this.children];for(;t.length>0;){let n=t.pop();e.push(n.value);for(let e=n.children.length-1;e>=0;e--)t.push(n.children[e])}return e}get inOrderIds(){let e=[],t=n=>{e.push(n.value);for(let e of n.children)t(e)};for(let e of this.children)t(e);return e}toString(){return this.isCollapsed?`${this.value} (collapsed)`:String(this.value)}equals(e){return this.value===e.value}};ps([Yo()],ms.prototype,`geDescendantCount`,null),ps([Yo()],ms.prototype,`getDescendants`,null),ps([Yo()],ms.prototype,`inOrderIds`,null);var hs=0,gs=class e{nodes;id;constructor(e,t){this.nodes=e,this.id=t}static from(t){let n=`tree_${hs++}`;return new e(t.map(e=>new ms(e,!1,[])),n)}static fromWithPreviousShape(t,n){if(!n)return e.from(t);let r=n.id,i=new e(t.map(e=>new ms(e,!1,[])),r);for(let e of t)if(n.isCollapsed(e)){let t=n._nodeMap.get(e)?.children??[];for(let n=t.length-1;n>=0;n--){let r=t[n];if(i._nodeMap.has(r.value)){i=i.collapse(e,r.value);break}}}return i}withNodes(t){return new e(t,this.id)}get topLevelIds(){return this.nodes.map(e=>e.value)}get inOrderIds(){return this.nodes.flatMap(e=>[e.value,...e.inOrderIds])}get idSet(){return new Set(this.inOrderIds)}get length(){return this.nodes.length}get _nodeMap(){let e=new Map;for(let t of this.nodes)e.set(t.value,t);return e}getDescendants(e){let t=this._nodeMap.get(e);return t?t.getDescendants():(R.warn(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`),[])}isCollapsed(e){let t=this._nodeMap.get(e);return t?t.isCollapsed:(R.warn(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`),!1)}indexOfOrThrow(e){let t=this.nodes.findIndex(t=>t.value===e);if(t===-1)throw Error(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`);return t}slice(e,t){return this.nodes.slice(e,t).map(e=>e.value)}moveToFront(e){let t=this.indexOfOrThrow(e);return this.withNodes(Sr(this.nodes,t,0))}moveToBack(e){let t=this.indexOfOrThrow(e);return this.withNodes(Sr(this.nodes,t,this.nodes.length-1))}collapse(e,t){let n=this.nodes.findIndex(t=>t.value===e);if(n===-1)throw Error(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`);let r=t===void 0?this.nodes.length:this.nodes.findIndex(e=>e.value===t);if(r===-1)throw Error(`Node ${t} not found in tree`);if(r<n)throw Error(`Node ${t} is before node ${e}`);let i=[...this.nodes],a=i[n];if(a.isCollapsed)throw Error(`Node ${e} is already collapsed`);let o=i.splice(n+1,r-n);return i[n]=new ms(a.value,!0,o),this.withNodes(i)}collapseAll(e){let t=[...this.nodes];if(e.length===0)throw Error(`No collapse ranges provided`);if(e.length!==t.length)throw Error(`Collapse ranges length ${e.length} does not match tree length ${t.length}`);let n=t.length-1;for(;n>=0;){let r=t[n],i=e[n];if(!r.isCollapsed&&i){let{id:e,until:a}=i;if(e!==r.value)throw Error(`Node ${r.value} does not match collapse range id ${e}`);let o=a===void 0?t.length:t.findIndex(e=>e.value===a);if(o===-1)throw Error(`Node ${a} not found in tree`);if(o<n)throw Error(`Node ${a} is before node ${e}`);let s=t.splice(n+1,o-n);t[n]=new ms(r.value,!0,s),n--}else n--}return this.withNodes(t)}expand(e){let t=this.nodes.findIndex(t=>t.value===e);if(t===-1)throw Error(`Node ${e} not found in tree. Valid ids: ${this.topLevelIds}`);let n=[...this.nodes],r=n[t];return r.isCollapsed?(n[t]=new ms(r.value,!1,[]),n=Cr(n,t+1,r.children),this.withNodes(n)):this}expandAll(){let e=[...this.nodes],t=0;for(;t<e.length;){let n=e[t];n.isCollapsed?(e[t]=new ms(n.value,!1,[]),e=Cr(e,t+1,n.children),t++):t++}return this.withNodes(e)}move(e,t){return this.withNodes(Sr(this.nodes,e,t))}at(e){return this.nodes.at(e)?.value}atOrThrow(e){let t=this.nodes.at(e);if(t===void 0)throw Error(`Node at index ${e} not found in tree`);return t.value}first(){return this.atOrThrow(0)}last(){return this.atOrThrow(this.nodes.length-1)}after(e){let t=this.indexOfOrThrow(e);if(t!==this.nodes.length-1)return this.at(t+1)}before(e){let t=this.indexOfOrThrow(e);if(t!==0)return this.at(t-1)}insert(e,t){return this.withNodes(Dr(this.nodes,t,new ms(e,!1,[])))}insertAtEnd(e){return this.insert(e,this.nodes.length)}insertAtStart(e){return this.insert(e,0)}deleteAtIndex(e){let t=this.atOrThrow(e),n=this.expand(t);return n.withNodes(Tr(n.nodes,e))}delete(e){let t=this.indexOfOrThrow(e);return this.deleteAtIndex(t)}getCount(e){return this._nodeMap.get(e)?.geDescendantCount()??0}findAndExpandDeep(e){let t=this.find(e);return t.length===0?this:t.reduce((e,t)=>e.expand(t),this)}find(e){function t(n,r){for(let i of n){if(i.value===e)return[...r,e];let n=t(i.children,[...r,i.value]);if(n.length>0)return n}return[]}return t(this.nodes,[])}split(t){let n=this.nodes.findIndex(e=>e.value===t);if(n===-1)throw Error(`Node ${t} not found in tree`);let r=this.nodes.slice(0,n),i=this.nodes.slice(n);return r.length===0?[e.from([]),this.withNodes(i)]:[this.withNodes(r),e.from([]).withNodes(i)]}equals(e){return this.nodes.length===e.nodes.length&&this.nodes.every((t,n)=>t.value===e.nodes[n].value)}toString(){let e=0,t=``,n=r=>{for(let i of r)t+=`${` `.repeat(e*2)}${i.toString()}\n`,e+=1,n(i.children),--e};return n(this.nodes),t}};ps([Yo()],gs.prototype,`topLevelIds`,null),ps([Yo()],gs.prototype,`inOrderIds`,null),ps([Yo()],gs.prototype,`idSet`,null),ps([Yo()],gs.prototype,`_nodeMap`,null);var _s=class e{columns;constructor(e){this.columns=e,e.length===0&&(this.columns=[gs.from([])])}static from(t){return new e(t.map(e=>gs.from(e)))}static fromWithPreviousShape(t,n){if(!n)return e.from([t]);let r=n.getColumns(),i=Array.from({length:r.length},()=>[]),a=0;for(let e of t){let t=r.findIndex(t=>t.idSet.has(e));t===-1?i[a].push(e):(a=t,i[t].push(e))}let o=i.map((e,t)=>gs.fromWithPreviousShape(e,r[t]));return new e(o)}isEmpty(){return this.columns.length===0||this.columns.every(e=>e.nodes.length===0)}static fromIdsAndColumns(t){let n=Math.max(1,...t.map(([,e])=>(e??0)+1)),r=Array.from({length:n},()=>[]),i=0;for(let[e,n]of t)n==null||n<0?r[i].push(e):(r[n].push(e),i=n);return e.from(r)}get topLevelIds(){return this.columns.map(e=>e.topLevelIds)}get iterateTopLevelIds(){let e=this.columns;function*t(){for(let t of e)for(let e of t.topLevelIds)yield e}return t()}get inOrderIds(){return this.columns.flatMap(e=>e.inOrderIds)}get colLength(){return this.columns.length}get idLength(){return this.columns.reduce((e,t)=>e+t.nodes.length,0)}get _columnMap(){return new Map(this.columns.map(e=>[e.id,e]))}at(e){return this.columns[e]}get(e){return this._columnMap.get(e)}atOrThrow(e){let t=this.columns[e];if(!t)throw Error(`Column ${e} not found`);return t}hasOnlyOneColumn(){return this.columns.length===1}getColumns(){return this.columns}hasOnlyOneId(){return this.idLength===1}getColumnIds(){return this.columns.map(e=>e.id)}indexOf(e){return this.columns.indexOf(e)}addColumn(t,n=[]){return new e(this.columns.flatMap(e=>e.id===t?[e,gs.from(n)]:[e]))}insertBreakpoint(t){let n=this.findWithId(t),[r,i]=n.split(t),a=this.columns.flatMap(e=>e===n?[r,i].filter(Boolean):[e]);return new e(a)}delete(t){if(this.columns.length<=1)return this;let n=this.indexOfOrThrow(t),r=n===0?1:n-1,i=[...this.columns],a=i[n];return i[r]=a.withNodes([...i[r].nodes,...a.nodes]),i.splice(n,1),new e(i)}mergeAllColumns(){if(this.columns.length<=1)return this;let t=this.columns.flatMap(e=>e.nodes),n=this.columns[0];return new e([n.withNodes(t)])}moveWithinColumn(e,t,n){return this.transform(e,e=>e.move(t,n))}moveAcrossColumns(t,n,r,i){let a=this.indexOfOrThrow(t),o=this.indexOfOrThrow(r),s=[...this.columns],c=s[a],l=c.nodes.findIndex(e=>e.value===n);if(l===-1)throw Error(`Node ${n} not found in column ${t}`);let u=c.nodes[l];s[a]=c.withNodes(c.nodes.filter((e,t)=>t!==l));let d=s[o];if(i){let e=d.indexOfOrThrow(i);s[o]=d.withNodes(Dr(d.nodes,e,u))}else s[o]=d.withNodes([u,...d.nodes]);return new e(s)}moveCellsRelativeTo(t,n,r){if(t.length===0)return this;let i=new Set(t),a=this.findWithId(n),o=this.indexOfOrThrow(a.id),s=[];for(let e of t){let t=this.findWithId(e),n=t.nodes.find(t=>t.value===e);if(!n)throw Error(`Node ${e} not found in column ${t.id}`);s.push(n)}let c=this.columns.map(e=>e.withNodes(e.nodes.filter(e=>!i.has(e.value)))),l=c[o],u=l.nodes.findIndex(e=>e.value===n);u===-1?u=l.nodes.length:r===`after`&&(u+=1);let d=Cr(l.nodes,u,s);return c[o]=l.withNodes(d),new e(c)}indexOfOrThrow(e){let t=this.columns.findIndex(t=>t.id===e);if(t===-1)throw Error(`Column ${e} not found. Possible values: ${this.getColumnIds().join(`, `)}`);return t}moveColumn(t,n){if(t===n)return this;let r=this.indexOfOrThrow(t),i=n===`_left_`?r-1:n===`_right_`?r+1:this.indexOfOrThrow(n);return fs(r,i),new e(Sr([...this.columns],r,i))}moveToNewColumn(t){let n=this.findWithId(t),r=this.columns.map(e=>e.id===n.id?e.delete(t):e),i=gs.from([t]);return new e([...r,i])}findWithId(e){let t=this.columns.find(t=>t.inOrderIds.includes(e));if(!t)throw R.log(`Possible values: ${this.columns.map(e=>e.inOrderIds).join(`, `)}`),Error(`Cell ${e} not found in any column`);return t}transformWithCellId(t,n){let r=!1,i=this.columns.map(e=>{if(e.inOrderIds.includes(t)){let t=n(e);return e!==t&&(r=!0),t}return e});return r?new e(i):this}setupCellExists(){return this.columns.some(e=>e.topLevelIds.includes(Fi))}insertId(e,t,n){return this.transform(t,t=>t.insert(e,n))}deleteById(e){return this.transformWithCellId(e,t=>t.delete(e))}placeCells(e){if(e.length===0)return this;let t=this.deleteById(e[0].id);for(let{id:n}of e.slice(1))t=t.deleteById(n);let n=[...e].toSorted((e,t)=>e.columnId===t.columnId?e.index-t.index:e.columnId.localeCompare(t.columnId));for(let{id:e,columnId:r,index:i}of n)t=t.insertId(e,r,i);return t}compact(){return this.columns.length===1||!this.columns.some(e=>e.nodes.length===0)?this:new e(this.columns.filter(e=>e.nodes.length>0))}transform(t,n){let r=this._columnMap.get(t);if(!r)return R.warn(`Column ${t} not found`),this;let i=n(r);if(r===i)return this;let a=this.columns.map(e=>e.id===t?i:e);return new e(a)}transformAll(t){let n=!1,r=this.columns.map(e=>{let r=t(e);return e.equals(r)||(n=!0),r});return n?new e(r):this}};ps([Yo()],_s.prototype,`isEmpty`,null),ps([Yo()],_s.prototype,`topLevelIds`,null),ps([Yo()],_s.prototype,`inOrderIds`,null),ps([Yo()],_s.prototype,`idLength`,null),ps([Yo()],_s.prototype,`_columnMap`,null),ps([Yo()],_s.prototype,`getColumnIds`,null);var vs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var t;(function(e){e.Root=`root`,e.Text=`text`,e.Directive=`directive`,e.Comment=`comment`,e.Script=`script`,e.Style=`style`,e.Tag=`tag`,e.CDATA=`cdata`,e.Doctype=`doctype`})(t=e.ElementType||={});function n(e){return e.type===t.Tag||e.type===t.Script||e.type===t.Style}e.isTag=n,e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype})),ys=i((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),n=e&&e.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.cloneNode=e.hasChildren=e.isDocument=e.isDirective=e.isComment=e.isText=e.isCDATA=e.isTag=e.Element=e.Document=e.CDATA=e.NodeWithChildren=e.ProcessingInstruction=e.Comment=e.Text=e.DataNode=e.Node=void 0;var r=vs(),i=function(){function e(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent},set:function(e){this.parent=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return this.prev},set:function(e){this.prev=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return this.next},set:function(e){this.next=e},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(e){return e===void 0&&(e=!1),b(this,e)},e}();e.Node=i;var a=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.data=t,n}return Object.defineProperty(n.prototype,"nodeValue",{get:function(){return this.data},set:function(e){this.data=e},enumerable:!1,configurable:!0}),n}(i);e.DataNode=a;var o=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.Text,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),n}(a);e.Text=o;var s=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.Comment,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),n}(a);e.Comment=s;var c=function(e){t(n,e);function n(t,n){var i=e.call(this,n)||this;return i.name=t,i.type=r.ElementType.Directive,i}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),n}(a);e.ProcessingInstruction=c;var l=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.children=t,n}return Object.defineProperty(n.prototype,"firstChild",{get:function(){return this.children[0]??null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"childNodes",{get:function(){return this.children},set:function(e){this.children=e},enumerable:!1,configurable:!0}),n}(i);e.NodeWithChildren=l;var u=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.CDATA,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),n}(l);e.CDATA=u;var d=function(e){t(n,e);function n(){var t=e!==null&&e.apply(this,arguments)||this;return t.type=r.ElementType.Root,t}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),n}(l);e.Document=d;var f=function(e){t(n,e);function n(t,n,i,a){i===void 0&&(i=[]),a===void 0&&(a=t===`script`?r.ElementType.Script:t===`style`?r.ElementType.Style:r.ElementType.Tag);var o=e.call(this,i)||this;return o.name=t,o.attribs=n,o.type=a,o}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tagName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"attributes",{get:function(){var e=this;return Object.keys(this.attribs).map(function(t){return{name:t,value:e.attribs[t],namespace:e[`x-attribsNamespace`]?.[t],prefix:e[`x-attribsPrefix`]?.[t]}})},enumerable:!1,configurable:!0}),n}(l);e.Element=f;function p(e){return(0,r.isTag)(e)}e.isTag=p;function m(e){return e.type===r.ElementType.CDATA}e.isCDATA=m;function h(e){return e.type===r.ElementType.Text}e.isText=h;function g(e){return e.type===r.ElementType.Comment}e.isComment=g;function _(e){return e.type===r.ElementType.Directive}e.isDirective=_;function v(e){return e.type===r.ElementType.Root}e.isDocument=v;function y(e){return Object.prototype.hasOwnProperty.call(e,`children`)}e.hasChildren=y;function b(e,t){t===void 0&&(t=!1);var r;if(h(e))r=new o(e.data);else if(g(e))r=new s(e.data);else if(p(e)){var i=t?x(e.children):[],a=new f(e.name,n({},e.attribs),i);i.forEach(function(e){return e.parent=a}),e.namespace!=null&&(a.namespace=e.namespace),e[`x-attribsNamespace`]&&(a[`x-attribsNamespace`]=n({},e[`x-attribsNamespace`])),e[`x-attribsPrefix`]&&(a[`x-attribsPrefix`]=n({},e[`x-attribsPrefix`])),r=a}else if(m(e)){var i=t?x(e.children):[],l=new u(i);i.forEach(function(e){return e.parent=l}),r=l}else if(v(e)){var i=t?x(e.children):[],y=new d(i);i.forEach(function(e){return e.parent=y}),e[`x-mode`]&&(y[`x-mode`]=e[`x-mode`]),r=y}else if(_(e)){var b=new c(e.name,e.data);e[`x-name`]!=null&&(b[`x-name`]=e[`x-name`],b[`x-publicId`]=e[`x-publicId`],b[`x-systemId`]=e[`x-systemId`]),r=b}else throw Error(`Not implemented yet: ${e.type}`);return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}e.cloneNode=b;function x(e){for(var t=e.map(function(e){return b(e,!0)}),n=1;n<t.length;n++)t[n].prev=t[n-1],t[n-1].next=t[n];return t}})),bs=i((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var r=vs(),i=ys();n(ys(),e);var a={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},o=function(){function e(e,t,n){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof t==`function`&&(n=t,t=a),typeof e==`object`&&(t=e,e=void 0),this.callback=e??null,this.options=t??a,this.elementCB=n??null}return e.prototype.onparserinit=function(e){this.parser=e},e.prototype.onreset=function(){this.dom=[],this.root=new i.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},e.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},e.prototype.onerror=function(e){this.handleCallback(e)},e.prototype.onclosetag=function(){this.lastNode=null;var e=this.tagStack.pop();this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(e)},e.prototype.onopentag=function(e,t){var n=this.options.xmlMode?r.ElementType.Tag:void 0,a=new i.Element(e,t,void 0,n);this.addNode(a),this.tagStack.push(a)},e.prototype.ontext=function(e){var t=this.lastNode;if(t&&t.type===r.ElementType.Text)t.data+=e,this.options.withEndIndices&&(t.endIndex=this.parser.endIndex);else{var n=new i.Text(e);this.addNode(n),this.lastNode=n}},e.prototype.oncomment=function(e){if(this.lastNode&&this.lastNode.type===r.ElementType.Comment){this.lastNode.data+=e;return}var t=new i.Comment(e);this.addNode(t),this.lastNode=t},e.prototype.oncommentend=function(){this.lastNode=null},e.prototype.oncdatastart=function(){var e=new i.Text(``),t=new i.CDATA([e]);this.addNode(t),e.parent=t,this.lastNode=e},e.prototype.oncdataend=function(){this.lastNode=null},e.prototype.onprocessinginstruction=function(e,t){var n=new i.ProcessingInstruction(e,t);this.addNode(n)},e.prototype.handleCallback=function(e){if(typeof this.callback==`function`)this.callback(e,this.dom);else if(e)throw e},e.prototype.addNode=function(e){var t=this.tagStack[this.tagStack.length-1],n=t.children[t.children.length-1];this.options.withStartIndices&&(e.startIndex=this.parser.startIndex),this.options.withEndIndices&&(e.endIndex=this.parser.endIndex),t.children.push(e),n&&(e.prev=n,n.next=e),e.parent=t,this.lastNode=null},e}();e.DomHandler=o,e.default=o})),xs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=e.CARRIAGE_RETURN_PLACEHOLDER=e.CARRIAGE_RETURN_REGEX=e.CARRIAGE_RETURN=e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES=void 0,e.CASE_SENSITIVE_TAG_NAMES=`animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.linearGradient.radialGradient.textPath`.split(`.`),e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES.reduce(function(e,t){return e[t.toLowerCase()]=t,e},{}),e.CARRIAGE_RETURN=`\r`,e.CARRIAGE_RETURN_REGEX=new RegExp(e.CARRIAGE_RETURN,`g`),e.CARRIAGE_RETURN_PLACEHOLDER=`__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_${Date.now().toString()}__`,e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(e.CARRIAGE_RETURN_PLACEHOLDER,`g`)})),Ss=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatAttributes=i,e.hasOpenTag=o,e.escapeSpecialCharacters=s,e.revertEscapedCharacters=c,e.formatDOM=l;var t=bs(),n=xs();function r(e){return n.CASE_SENSITIVE_TAG_NAMES_MAP[e]}function i(e){for(var t={},n=0,r=e.length;n<r;n++){var i=e[n];t[i.name]=i.value}return t}function a(e){return e=e.toLowerCase(),r(e)||e}function o(e,t){var n=`<`+t,r=e.toLowerCase().indexOf(n);if(r===-1)return!1;var i=e[r+n.length];return i===`>`||i===` `||i===` `||i===`
13
13
  `||i===`\r`||i===`/`}function s(e){return e.replace(n.CARRIAGE_RETURN_REGEX,n.CARRIAGE_RETURN_PLACEHOLDER)}function c(e){return e.replace(n.CARRIAGE_RETURN_PLACEHOLDER_REGEX,n.CARRIAGE_RETURN)}function l(e,n,r){n===void 0&&(n=null);for(var o=[],s,u=0,d=e.length;u<d;u++){var f=e[u];switch(f.nodeType){case 1:var p=a(f.nodeName);s=new t.Element(p,i(f.attributes)),s.children=l(p===`template`?f.content.childNodes:f.childNodes,s);break;case 3:s=new t.Text(c(f.nodeValue??``));break;case 8:s=new t.Comment(f.nodeValue??``);break;default:continue}var m=o[u-1]??null;m&&(m.next=s),s.parent=n,s.prev=m,s.next=null,o.push(s)}return r&&(s=new t.ProcessingInstruction(r.substring(0,r.indexOf(` `)).toLowerCase(),r),s.next=o[0]??null,s.parent=n,o.unshift(s),o[1]&&(o[1].prev=o[0])),o}})),Cs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=h;var t=Ss(),n=`html`,r=`head`,i=`body`,a=/<([a-zA-Z]+[0-9]?)/,o=function(e,t){throw Error("This browser does not support `document.implementation.createHTMLDocument`")},s=function(e,t){throw Error("This browser does not support `DOMParser.prototype.parseFromString`")},c=typeof window==`object`&&window.DOMParser;if(typeof c==`function`){var l=new c,u=`text/html`;s=function(e,t){return t&&(e=`<${t}>${e}</${t}>`),l.parseFromString(e,u)},o=s}if(typeof document==`object`&&document.implementation){var d=document.implementation.createHTMLDocument();o=function(e,t){if(t){var n=d.documentElement.querySelector(t);return n&&(n.innerHTML=e),d}return d.documentElement.innerHTML=e,d}}var f=typeof document==`object`&&document.createElement(`template`),p;f&&f.content&&(p=function(e){return f.innerHTML=e,f.content.childNodes});var m=function(){return document.createDocumentFragment().childNodes};function h(e){var c,l;e=(0,t.escapeSpecialCharacters)(e);var u=(a.exec(e)?.[1])?.toLowerCase();switch(u){case n:var d=s(e);if(!(0,t.hasOpenTag)(e,r)){var f=d.querySelector(r);(c=f?.parentNode)==null||c.removeChild(f)}if(!(0,t.hasOpenTag)(e,i)){var f=d.querySelector(i);(l=f?.parentNode)==null||l.removeChild(f)}return d.querySelectorAll(n);case r:case i:var h=o(e).querySelectorAll(u);return(0,t.hasOpenTag)(e,i)&&(0,t.hasOpenTag)(e,r)?h[0].parentNode?.childNodes??m():h;default:if(p)return p(e);var f=o(e,i).querySelector(i);return f?.childNodes??m()}}})),ws=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var n=t(Cs()),r=Ss(),i=/<(![a-zA-Z\s]+)>/;function a(e){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];var t=i.exec(e),a=t?t[1]:void 0;return(0,r.formatDOM)((0,n.default)(e),null,a)}})),Ts=i((e=>{e.SAME=0,e.CAMELCASE=1,e.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":`acceptCharset`,accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:`className`,classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:`htmlFor`,form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":`httpEquiv`,icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":`accentHeight`,accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":`alignmentBaseline`,allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":`arabicForm`,ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":`baselineShift`,baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":`capHeight`,clip:0,clipPath:1,"clip-path":`clipPath`,clipPathUnits:1,clipRule:1,"clip-rule":`clipRule`,color:0,colorInterpolation:1,"color-interpolation":`colorInterpolation`,colorInterpolationFilters:1,"color-interpolation-filters":`colorInterpolationFilters`,colorProfile:1,"color-profile":`colorProfile`,colorRendering:1,"color-rendering":`colorRendering`,contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":`dominantBaseline`,dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":`enableBackground`,end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":`fillOpacity`,fillRule:1,"fill-rule":`fillRule`,filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":`floodOpacity`,floodColor:1,"flood-color":`floodColor`,focusable:0,fontFamily:1,"font-family":`fontFamily`,fontSize:1,"font-size":`fontSize`,fontSizeAdjust:1,"font-size-adjust":`fontSizeAdjust`,fontStretch:1,"font-stretch":`fontStretch`,fontStyle:1,"font-style":`fontStyle`,fontVariant:1,"font-variant":`fontVariant`,fontWeight:1,"font-weight":`fontWeight`,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":`glyphName`,glyphOrientationHorizontal:1,"glyph-orientation-horizontal":`glyphOrientationHorizontal`,glyphOrientationVertical:1,"glyph-orientation-vertical":`glyphOrientationVertical`,glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":`horizAdvX`,horizOriginX:1,"horiz-origin-x":`horizOriginX`,ideographic:0,imageRendering:1,"image-rendering":`imageRendering`,in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":`letterSpacing`,lightingColor:1,"lighting-color":`lightingColor`,limitingConeAngle:1,local:0,markerEnd:1,"marker-end":`markerEnd`,markerHeight:1,markerMid:1,"marker-mid":`markerMid`,markerStart:1,"marker-start":`markerStart`,markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":`overlinePosition`,overlineThickness:1,"overline-thickness":`overlineThickness`,paintOrder:1,"paint-order":`paintOrder`,panose1:0,"panose-1":`panose1`,pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":`pointerEvents`,points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":`renderingIntent`,repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":`shapeRendering`,slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":`stopColor`,stopOpacity:1,"stop-opacity":`stopOpacity`,strikethroughPosition:1,"strikethrough-position":`strikethroughPosition`,strikethroughThickness:1,"strikethrough-thickness":`strikethroughThickness`,string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":`strokeDasharray`,strokeDashoffset:1,"stroke-dashoffset":`strokeDashoffset`,strokeLinecap:1,"stroke-linecap":`strokeLinecap`,strokeLinejoin:1,"stroke-linejoin":`strokeLinejoin`,strokeMiterlimit:1,"stroke-miterlimit":`strokeMiterlimit`,strokeWidth:1,"stroke-width":`strokeWidth`,strokeOpacity:1,"stroke-opacity":`strokeOpacity`,suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":`textAnchor`,textDecoration:1,"text-decoration":`textDecoration`,textLength:1,textRendering:1,"text-rendering":`textRendering`,to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":`underlinePosition`,underlineThickness:1,"underline-thickness":`underlineThickness`,unicode:0,unicodeBidi:1,"unicode-bidi":`unicodeBidi`,unicodeRange:1,"unicode-range":`unicodeRange`,unitsPerEm:1,"units-per-em":`unitsPerEm`,unselectable:0,vAlphabetic:1,"v-alphabetic":`vAlphabetic`,values:0,vectorEffect:1,"vector-effect":`vectorEffect`,version:0,vertAdvY:1,"vert-adv-y":`vertAdvY`,vertOriginX:1,"vert-origin-x":`vertOriginX`,vertOriginY:1,"vert-origin-y":`vertOriginY`,vHanging:1,"v-hanging":`vHanging`,vIdeographic:1,"v-ideographic":`vIdeographic`,viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":`vMathematical`,vocab:0,widths:0,wordSpacing:1,"word-spacing":`wordSpacing`,writingMode:1,"writing-mode":`writingMode`,x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":`xHeight`,xlinkActuate:1,"xlink:actuate":`xlinkActuate`,xlinkArcrole:1,"xlink:arcrole":`xlinkArcrole`,xlinkHref:1,"xlink:href":`xlinkHref`,xlinkRole:1,"xlink:role":`xlinkRole`,xlinkShow:1,"xlink:show":`xlinkShow`,xlinkTitle:1,"xlink:title":`xlinkTitle`,xlinkType:1,"xlink:type":`xlinkType`,xmlBase:1,"xml:base":`xmlBase`,xmlLang:1,"xml:lang":`xmlLang`,xmlns:0,"xml:space":`xmlSpace`,xmlnsXlink:1,"xmlns:xlink":`xmlnsXlink`,xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1}})),Es=i((e=>{var t=0,n=1,r=2,i=3,a=4,o=5,s=6;function c(e){return u.hasOwnProperty(e)?u[e]:null}function l(e,t,n,o,s,c,l){this.acceptsBooleans=t===r||t===i||t===a,this.attributeName=o,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=c,this.removeEmptyString=l}var u={};[`children`,`dangerouslySetInnerHTML`,`defaultValue`,`defaultChecked`,`innerHTML`,`suppressContentEditableWarning`,`suppressHydrationWarning`,`style`].forEach(e=>{u[e]=new l(e,t,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(([e,t])=>{u[e]=new l(e,n,!1,t,null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(e=>{u[e]=new l(e,r,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(e=>{u[e]=new l(e,r,!1,e,null,!1,!1)}),[`allowFullScreen`,`async`,`autoFocus`,`autoPlay`,`controls`,`default`,`defer`,`disabled`,`disablePictureInPicture`,`disableRemotePlayback`,`formNoValidate`,`hidden`,`loop`,`noModule`,`noValidate`,`open`,`playsInline`,`readOnly`,`required`,`reversed`,`scoped`,`seamless`,`itemScope`].forEach(e=>{u[e]=new l(e,i,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(e=>{u[e]=new l(e,i,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(e=>{u[e]=new l(e,a,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(e=>{u[e]=new l(e,s,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(e=>{u[e]=new l(e,o,!1,e.toLowerCase(),null,!1,!1)});var d=/[\-\:]([a-z])/g,f=e=>e[1].toUpperCase();`accent-height.alignment-baseline.arabic-form.baseline-shift.cap-height.clip-path.clip-rule.color-interpolation.color-interpolation-filters.color-profile.color-rendering.dominant-baseline.enable-background.fill-opacity.fill-rule.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.glyph-name.glyph-orientation-horizontal.glyph-orientation-vertical.horiz-adv-x.horiz-origin-x.image-rendering.letter-spacing.lighting-color.marker-end.marker-mid.marker-start.overline-position.overline-thickness.paint-order.panose-1.pointer-events.rendering-intent.shape-rendering.stop-color.stop-opacity.strikethrough-position.strikethrough-thickness.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.text-anchor.text-decoration.text-rendering.underline-position.underline-thickness.unicode-bidi.unicode-range.units-per-em.v-alphabetic.v-hanging.v-ideographic.v-mathematical.vector-effect.vert-adv-y.vert-origin-x.vert-origin-y.word-spacing.writing-mode.xmlns:xlink.x-height`.split(`.`).forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,null,!1,!1)}),[`xlink:actuate`,`xlink:arcrole`,`xlink:role`,`xlink:show`,`xlink:title`,`xlink:type`].forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(e=>{let t=e.replace(d,f);u[t]=new l(t,n,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(e=>{u[e]=new l(e,n,!1,e.toLowerCase(),null,!1,!1)});var p=`xlinkHref`;u[p]=new l(`xlinkHref`,n,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(e=>{u[e]=new l(e,n,!1,e.toLowerCase(),null,!0,!0)});var{CAMELCASE:m,SAME:h,possibleStandardNames:g}=Ts(),_=RegExp.prototype.test.bind(RegExp(`^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`)),v=Object.keys(g).reduce((e,t)=>{let n=g[t];return n===h?e[t]=t:n===m?e[t.toLowerCase()]=t:e[t]=n,e},{});e.BOOLEAN=i,e.BOOLEANISH_STRING=r,e.NUMERIC=o,e.OVERLOADED_BOOLEAN=a,e.POSITIVE_NUMERIC=s,e.RESERVED=t,e.STRING=n,e.getPropertyInfo=c,e.isCustomAttribute=_,e.possibleStandardNames=v})),Ds=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=a,e.setStyleProp=s;var n=f(),r=t(Ar()),i=new Set([`annotation-xml`,`color-profile`,`font-face`,`font-face-src`,`font-face-uri`,`font-face-format`,`font-face-name`,`missing-glyph`]);function a(e,t){return e.includes(`-`)?!i.has(e):!!(t&&typeof t.is==`string`)}var o={reactCompat:!0};function s(e,t){if(typeof e==`string`){if(!e.trim()){t.style={};return}try{t.style=(0,r.default)(e,o)}catch{t.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(`.`)[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set([`tr`,`tbody`,`thead`,`tfoot`,`colgroup`,`table`,`head`,`html`,`frameset`]),e.canTextBeChildOfNode=function(t){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(t.name)},e.returnFirstArg=function(e){return e}})),Os=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var t=Es(),n=Ds(),r=[`checked`,`value`],i=[`input`,`select`,`textarea`],a={reset:!0,submit:!0};function o(e,o){e===void 0&&(e={});var c={},l=!!(e.type&&a[e.type]);for(var u in e){var d=e[u];if((0,t.isCustomAttribute)(u)){c[u]=d;continue}var f=u.toLowerCase(),p=s(f);if(p){var m=(0,t.getPropertyInfo)(p);switch(r.includes(p)&&i.includes(o)&&!l&&(p=s(`default`+f)),c[p]=d,m?.type){case t.BOOLEAN:c[p]=!0;break;case t.OVERLOADED_BOOLEAN:d===``&&(c[p]=!0)}continue}n.PRESERVE_CUSTOM_ATTRIBUTES&&(c[u]=d)}return(0,n.setStyleProp)(e.style,c),c}function s(e){return t.possibleStandardNames[e]}})),ks=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var n=f(),r=t(Os()),i=Ds(),a={cloneElement:n.cloneElement,createElement:n.createElement,isValidElement:n.isValidElement};function o(e,t){t===void 0&&(t={});for(var n=[],c=typeof t.replace==`function`,l=t.transform??i.returnFirstArg,u=t.library??a,d=u.cloneElement,f=u.createElement,p=u.isValidElement,m=e.length,h=0;h<m;h++){var g=e[h];if(c){var _=t.replace?.call(t,g,h);if(p(_)){m>1&&(_=d(_,{key:_.key??h})),n.push(l(_,g,h));continue}}if(g.type===`text`){var v=!g.data.trim().length;if(v&&g.parent&&!(0,i.canTextBeChildOfNode)(g.parent)||t.trim&&v)continue;n.push(l(g.data,g,h));continue}var y=g,b={};s(y)?((0,i.setStyleProp)(y.attribs.style,y.attribs),b=y.attribs):y.attribs&&(b=(0,r.default)(y.attribs,y.name));var x=void 0;switch(g.type){case`script`:case`style`:g.children[0]&&(b.dangerouslySetInnerHTML={__html:g.children[0].data});break;case`tag`:g.name===`textarea`&&g.children[0]?b.defaultValue=g.children[0].data:g.children?.length&&(x=o(g.children,t));break;default:continue}m>1&&(b.key=h),n.push(l(f(g.name,b,x),g,h))}return n.length===1?n[0]:n}function s(e){return i.PRESERVE_CUSTOM_ATTRIBUTES&&e.type===`tag`&&(0,i.isCustomComponent)(e.name,e.attribs)}})),As=e(i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=o;var n=t(ws());e.htmlToDOM=n.default,e.attributesToProps=t(Os()).default;var r=t(ks());e.domToReact=r.default;var i=bs();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return i.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return i.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return i.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return i.Text}});var a={lowerCaseAttributeNames:!1};function o(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);return e?(0,r.default)((0,n.default)(e,t?.htmlparser2??a),t):[]}}))(),1),js=As.default.default||As.default,Ms=(e,t)=>{let[n,...r]=t.split(`.`),i=(e.attribs.class||``).split(` `);return e.tagName===n&&r.every(e=>i.includes(e))},Ns=e=>e&&Ms(e,`span.nb`)&&e.firstChild instanceof As.Text&&e.firstChild.nodeValue?.includes(`__marimo__`);function Ps(e){if(e instanceof As.Element&&e.firstChild instanceof As.Text&&Ms(e,`span.nb`)){let t=e.next;if(t&&t instanceof As.Text){let n=t.next;if(n&&n instanceof As.Element&&n.firstChild instanceof As.Text&&Ms(n,`span.m`)){let t=Number.parseInt(n.firstChild.nodeValue||`0`,10);if(e.firstChild.nodeValue?.includes(`__marimo__`)){let n=/__marimo__cell_(\w+)_/.exec(e.firstChild.nodeValue)?.[1];if(n&&t)return{kind:`cell`,cellId:n,lineNumber:t}}else{let n=/"(.+?)"/.exec(e.firstChild.nodeValue)?.[1];if(n&&t)return{kind:`file`,filePath:n,lineNumber:t}}}}}return null}function Fs(e){let t=[];return js(e,{replace:e=>{let n=Ps(e);if(n)return t.push(n),`dummy`}}),t}function Is(e){return t=>{let n=!1;for(let r of t)r&&(n=e(r)||n);return n}}var Ls=Is(wn),Rs=Is(Dn);function zs(){let e=globalThis.scheduler;if(typeof e?.postTask==`function`)return t=>{e.postTask(t,{priority:`user-visible`}).catch(e=>{setTimeout(()=>{throw e})})};if(typeof MessageChannel==`function`){let e=[],t=new MessageChannel;return t.port1.onmessage=()=>{e.shift()?.()},n=>{e.push(n),t.port2.postMessage(null)}}return e=>{setTimeout(e,0)}}var Bs=zs();function Vs(e=Bs){let t=new Map,n=new Set,r=!1;function i(){r||t.size===0||(r=!0,e(o))}function a(){for(let e of n){if(t.has(e))return e;n.delete(e)}return t.keys().next().value}function o(){r=!1;try{let e=a();if(e!==void 0){let r=t.get(e);t.delete(e),n.delete(e),r?.()}}finally{i()}}return{request(e,n){t.set(e,n),i()},promote(e){let r=t.get(e);r&&(t.delete(e),n.delete(e),r())},prioritize(e){t.has(e)&&n.add(e)},deprioritize(e){n.delete(e)},cancel(e){t.delete(e),n.delete(e)}}}var Hs=Vs(),Us=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolean=t,e.string=n,e.number=r,e.error=i,e.func=a,e.array=o,e.stringArray=s;function t(e){return e===!0||e===!1}function n(e){return typeof e==`string`||e instanceof String}function r(e){return typeof e==`number`||e instanceof Number}function i(e){return e instanceof Error}function a(e){return typeof e==`function`}function o(e){return Array.isArray(e)}function s(e){return o(e)&&e.every(e=>n(e))}})),Ws=i((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})();Object.defineProperty(e,"__esModule",{value:!0}),e.Message=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType=e.RequestType0=e.AbstractMessageSignature=e.ParameterStructures=e.ResponseError=e.ErrorCodes=void 0;var i=r(Us()),a;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(a||(e.ErrorCodes=a={})),e.ResponseError=class e extends Error{code;data;constructor(t,n,r){super(n),this.code=i.number(t)?t:a.UnknownErrorCode,this.data=r,Object.setPrototypeOf(this,e.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};var o=class e{kind;static auto=new e(`auto`);static byPosition=new e(`byPosition`);static byName=new e(`byName`);constructor(e){this.kind=e}static is(t){return t===e.auto||t===e.byName||t===e.byPosition}toString(){return this.kind}};e.ParameterStructures=o;var s=class{method;numberOfParams;constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return o.auto}};e.AbstractMessageSignature=s,e.RequestType0=class extends s{_;constructor(e){super(e,0)}},e.RequestType=class extends s{_parameterStructures;_;constructor(e,t=o.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.RequestType1=class extends s{_parameterStructures;_;constructor(e,t=o.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.RequestType2=class extends s{_;constructor(e){super(e,2)}},e.RequestType3=class extends s{_;constructor(e){super(e,3)}},e.RequestType4=class extends s{_;constructor(e){super(e,4)}},e.RequestType5=class extends s{_;constructor(e){super(e,5)}},e.RequestType6=class extends s{_;constructor(e){super(e,6)}},e.RequestType7=class extends s{_;constructor(e){super(e,7)}},e.RequestType8=class extends s{_;constructor(e){super(e,8)}},e.RequestType9=class extends s{_;constructor(e){super(e,9)}},e.NotificationType=class extends s{_parameterStructures;_;constructor(e,t=o.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.NotificationType0=class extends s{_;constructor(e){super(e,0)}},e.NotificationType1=class extends s{_parameterStructures;_;constructor(e,t=o.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.NotificationType2=class extends s{_;constructor(e){super(e,2)}},e.NotificationType3=class extends s{_;constructor(e){super(e,3)}},e.NotificationType4=class extends s{_;constructor(e){super(e,4)}},e.NotificationType5=class extends s{_;constructor(e){super(e,5)}},e.NotificationType6=class extends s{_;constructor(e){super(e,6)}},e.NotificationType7=class extends s{_;constructor(e){super(e,7)}},e.NotificationType8=class extends s{_;constructor(e){super(e,8)}},e.NotificationType9=class extends s{_;constructor(e){super(e,9)}};var c;(function(e){function t(e){let t=e;return t&&i.string(t.method)&&(i.string(t.id)||i.number(t.id))}e.isRequest=t;function n(e){let t=e;return t&&i.string(t.method)&&e.id===void 0}e.isNotification=n;function r(e){let t=e;return t&&(t.result!==void 0||!!t.error)&&(i.string(t.id)||i.number(t.id)||t.id===null)}e.isResponse=r})(c||(e.Message=c={}))})),Gs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LRUCache=e.LinkedMap=e.Touch=void 0;var t;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(t||(e.Touch=t={}));var n=class{[Symbol.toStringTag]=`LinkedMap`;_map;_head;_tail;_size;_state;constructor(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}before(e){let t=this._map.get(e);return t?t.previous?.value:void 0}after(e){let t=this._map.get(e);return t?t.next?.value:void 0}has(e){return this._map.has(e)}get(e,n=t.None){let r=this._map.get(e);if(r)return n!==t.None&&this.touch(r,n),r.value}set(e,n,r=t.None){let i=this._map.get(e);if(i)i.value=n,r!==t.None&&this.touch(i,r);else{switch(i={key:e,value:n,next:void 0,previous:void 0},r){case t.None:this.addItemLast(i);break;case t.First:this.addItemFirst(i);break;case t.Last:this.addItemLast(i);break;default:this.addItemLast(i)}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw Error(`Invalid list`);let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let n=this._state,r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==n)throw Error(`LinkedMap got modified during iteration.`);r=r.next}}keys(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:t.key,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}values(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:t.value,done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}entries(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:[t.key,t.value],done:!1};return t=t.next,e}return{value:void 0,done:!0}}};return n}[Symbol.iterator](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw Error(`Invalid list`);this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw Error(`Invalid list`);this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw Error(`Invalid list`);e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw Error(`Invalid list`);e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,n=e.previous;if(!t||!n)throw Error(`Invalid list`);t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,n){if(!this._head||!this._tail)throw Error(`Invalid list`);if(n===t.First||n===t.Last){if(n===t.First){if(e===this._head)return;let t=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(n===t.Last){if(e===this._tail)return;let t=e.next,n=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}};e.LinkedMap=n,e.LRUCache=class extends n{_limit;_ratio;constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,n=t.AsNew){return super.get(e,n)}peek(e){return super.get(e,t.None)}set(e,n){return super.set(e,n,t.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}}})),Ks=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Disposable=void 0;var t;(function(e){function t(e){return{dispose:e}}e.create=t})(t||(e.Disposable=t={}))})),qs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t;function n(){if(t===void 0)throw Error(`No runtime abstraction layer installed`);return t}(function(e){function n(e){if(e===void 0)throw Error(`No runtime abstraction layer provided`);t=e}e.install=n})(n||={}),e.default=n})),Js=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.Emitter=e.Event=void 0;var n=t(qs()),r;(function(e){let t={dispose(){}};e.None=function(){return t}})(r||(e.Event=r={}));var i=class{_callbacks;_contexts;add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let r=0,i=this._callbacks.length;r<i;r++)if(this._callbacks[r]===e){if(this._contexts[r]===t){this._callbacks.splice(r,1),this._contexts.splice(r,1);return}n=!0}if(n)throw Error(`When adding a listener with a context, you should remove it with the same context`)}invoke(...e){if(!this._callbacks)return[];let t=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let a=0,o=r.length;a<o;a++)try{t.push(r[a].apply(i[a],e))}catch(e){(0,n.default)().console.error(e)}return t}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}};e.Emitter=class e{_options;static _noop=function(){};_event;_callbacks;constructor(e){this._options=e}get event(){return this._event||=(t,n,r)=>{this._callbacks||=new i,this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let a={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),a.dispose=e._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(a),a},this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&=(this._callbacks.dispose(),void 0)}}})),Ys=i((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;var a=i(qs()),o=r(Us()),s=Js(),c;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:s.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:s.Event.None});function t(t){let n=t;return n&&(n===e.None||n===e.Cancelled||o.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}e.is=t})(c||(e.CancellationToken=c={}));var l=Object.freeze(function(e,t){let n=(0,a.default)().timer.setTimeout(e.bind(t),0);return{dispose(){n.dispose()}}}),u=class{_isCancelled=!1;_emitter;cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?l:(this._emitter||=new s.Emitter,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),void 0)}};e.CancellationTokenSource=class{_token;get token(){return this._token||=new u,this._token}cancel(){this._token?this._token.cancel():this._token=c.Cancelled}dispose(){this._token?this._token instanceof u&&this._token.dispose():this._token=c.None}}})),Xs=i((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=void 0;var t=Ys(),n;(function(e){e.Continue=0,e.Cancelled=1})(n||={}),e.SharedArraySenderStrategy=class{buffers;constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let t=new SharedArrayBuffer(4),r=new Int32Array(t,0,1);r[0]=n.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){let r=this.buffers.get(t);if(r===void 0)return;let i=new Int32Array(r,0,1);Atomics.store(i,0,n.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};var r=class{data;constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===n.Cancelled}get onCancellationRequested(){throw Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`)}},i=class{token;constructor(e){this.token=new r(e)}cancel(){}dispose(){}};e.SharedArrayReceiverStrategy=class{kind=`request`;createCancellationTokenSource(e){let n=e.$cancellationData;return n===void 0?new t.CancellationTokenSource:new i(n)}}})),Zs=i((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.Semaphore=void 0;var n=t(qs());e.Semaphore=class{_capacity;_active;_waiting;constructor(e=1){if(e<=0)throw Error(`Capacity must be greater than 0`);this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length!==0&&this._active!==this._capacity&&(0,n.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw Error(`Too many thunks active`);try{let t=e.thunk();t instanceof Promise?t.then(t=>{this._active--,e.resolve(t),this.runNext()},t=>{this._active--,e.reject(t),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}}})),Qs=i((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;var a=i(qs()),o=r(Us()),s=Js(),c=Zs(),l;(function(e){function t(e){let t=e;return t&&o.func(t.listen)&&o.func(t.dispose)&&o.func(t.onError)&&o.func(t.onClose)&&o.func(t.onPartialMessage)}e.is=t})(l||(e.MessageReader=l={}));var u=class{errorEmitter;closeEmitter;partialMessageEmitter;constructor(){this.errorEmitter=new s.Emitter,this.closeEmitter=new s.Emitter,this.partialMessageEmitter=new s.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose(),this.partialMessageEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:Error(`Reader received error. Reason: ${o.string(e.message)?e.message:`unknown`}`)}};e.AbstractMessageReader=u;var d;(function(e){function t(e){let t,n,r=new Map,i,o=new Map;if(e===void 0||typeof e==`string`)t=e??`utf-8`;else{if(t=e.charset??`utf-8`,e.contentDecoder!==void 0&&(n=e.contentDecoder,r.set(n.name,n)),e.contentDecoders!==void 0)for(let t of e.contentDecoders)r.set(t.name,t);if(e.contentTypeDecoder!==void 0&&(i=e.contentTypeDecoder,o.set(i.name,i)),e.contentTypeDecoders!==void 0)for(let t of e.contentTypeDecoders)o.set(t.name,t)}return i===void 0&&(i=(0,a.default)().applicationJson.decoder,o.set(i.name,i)),{charset:t,contentDecoder:n,contentDecoders:r,contentTypeDecoder:i,contentTypeDecoders:o}}e.fromOptions=t})(d||={}),e.ReadableStreamMessageReader=class extends u{readable;options;callback;nextMessageLength;messageToken;buffer;partialMessageTimer;_partialMessageTimeout;readSemaphore;constructor(e,t){super(),this.readable=e,this.options=d.fromOptions(t),this.buffer=(0,a.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new c.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let t=this.readable.onData(e=>{this.onData(e)});return this.readable.onError(e=>this.fireError(e)),this.readable.onClose(()=>this.fireClose()),t}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let e=this.buffer.tryReadHeaders(!0);if(!e)return;let t=e.get(`content-length`);if(!t){this.fireError(Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));return}let n=parseInt(t);if(isNaN(n)){this.fireError(Error(`Content-Length value must be a number. Got ${t}`));return}this.nextMessageLength=n}let e=this.buffer.tryReadBody(this.nextMessageLength);if(e===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let t=this.options.contentDecoder===void 0?e:await this.options.contentDecoder.decode(e),n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)}).catch(e=>{this.fireError(e)})}}catch(e){this.fireError(e)}}clearPartialMessageTimer(){this.partialMessageTimer&&=(this.partialMessageTimer.dispose(),void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,a.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}}})),$s=i((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;var a=i(qs()),o=r(Us()),s=Zs(),c=Js(),l=`Content-Length: `,u=`\r
@@ -31,19 +31,19 @@ Error generating stack: `+e.message+`
31
31
  z-index: 100;
32
32
  max-width: 300px;
33
33
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
34
- `,n.textContent=t;let r=e.coordsAtPos(e.state.selection.main.head);r&&(n.style.left=`${r.left}px`,n.style.top=`${r.bottom+5}px`),document.body.appendChild(n),setTimeout(()=>{n.style.opacity=`0`,n.style.transition=`opacity 0.2s`,setTimeout(()=>n.remove(),200)},3e3)}function Iu(e){return Lu(e,new WeakSet)}function Lu(e,t){if(e==null)return!0;if(Array.isArray(e))return t.has(e)?!0:(t.add(e),e.length===0||e.every(e=>Lu(e,t)));if(typeof e==`string`)return Ru(e);let n=e.value;return typeof n!=`string`||Ru(n)}function Ru(e){return e==null?!0:typeof e==`string`?e.trim()===``||/^[\s\n`]*$/.test(e):!1}function zu(e,t){let n=[];return t.iterChanges((t,r,i,a,o)=>{let s=o.toString();if(t===0&&r===e.length){n.push({text:s});return}let c=mu(e,t),l=mu(e,r);n.push({range:{start:c,end:l},text:s})}),n.sort((e,t)=>{if(!e.range)return 1;if(!t.range)return-1;let n=e.range.start.line??-1,r=t.range.start.line??-1;if(n!==r)return r-n;let i=e.range.start.character??-1;return(t.range.start.character??-1)-i}),n}var Bu=Object.fromEntries(Object.entries(fu.CompletionItemKind).map(([e,t])=>[t,e]));function Vu(e){return!!(e.deprecated||e.tags?.includes(fu.CompletionItemTag.Deprecated))}function Hu(e){return e.deprecated?`cm-deprecated`:``}function Uu(e){return`insert`in e}function Wu(e,t){if(!t)return e;let n={...e};if(n.commitCharacters??=t.commitCharacters,n.insertTextFormat??=t.insertTextFormat,n.insertTextMode??=t.insertTextMode,n.data===void 0&&(n.data=t.data),n.textEdit==null&&t.editRange){let e=n.textEditText??n.insertText??n.label;n.textEdit=Uu(t.editRange)?{newText:e,insert:t.editRange.insert,replace:t.editRange.replace}:{newText:e,range:t.editRange}}return n}function Gu(e,t,n,r){let{textEdit:i,insertText:a,label:o}=t,s=n,c=r,l=a||o;if(i){let t=ku(i)?i.range:ju(i)?i.replace:void 0;if(t){l=i.newText;let n=pu(e,t.start),r=pu(e,t.end);n!=null&&r!=null&&n<=r&&(s=n,c=r)}}return{from:s,to:c,newText:l}}function Ku(e,t,n,r){let i=[];for(let a of t){let t=pu(e,a.range.start),o=pu(e,a.range.end);t==null||o==null||t>o||o>n&&t<r||i.push({from:t,to:o,insert:a.newText})}return i}function qu(e,t,n){return r=>r<=e?r:r-(t-e)+n}function Ju(e){let{view:t,originalDoc:n,mainFrom:r,mainTo:i,insertedLength:a,resolveItem:o}=e,s=t.state.doc,c=qu(r,i,a);o().then(e=>{let a=e?.additionalTextEdits;if(!a?.length||t.state.doc!==s)return;let o=Ku(n,a,r,i).map(e=>({...e,from:c(e.from),to:c(e.to)}));o.length!==0&&t.dispatch({changes:o,userEvent:`input.complete`})}).catch(e=>{console.error(`Failed to resolve completion item:`,e)})}var Yu;(function(e){e.PlainText=1,e.Snippet=2})(Yu||={});var Xu=/^\$\{(\d+)\|((?:\\.|[^\\}])*)\|\}/,Zu=/^\$\{([A-Za-z_][A-Za-z0-9_]*)(?::([^}]*))?\}/,Qu=/^\$[A-Za-z_][A-Za-z0-9_]*/,$u=/^(?:\\.|[^,])*/,ed=/^\{0(?=[:}])/;function td(e,t){let n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`\\`&&r+1<e.length){n+=e.slice(r,r+2),r+=2;continue}if(i===`$`){let i=e.slice(r),a=Xu.exec(i);if(a){let e=$u.exec(a[2]??``)?.[0]??``;n+=t(a[1]??``,e),r+=a[0].length;continue}let o=Zu.exec(i);if(o){n+=o[2]??``,r+=o[0].length;continue}let s=Qu.exec(i);if(s){r+=s[0].length;continue}}n+=i,r+=1}return n}function nd(e){let t=0;for(let n of e.matchAll(/\$\{?(\d+)/g))t=Math.max(t,Number(n[1]));return String(t+1)}function rd(e){let t=td(e,(e,t)=>`\${${e}:${t}}`),n=nd(t),r=``,i=0;for(;i<t.length;){let e=t[i];if(e===`\\`&&i+1<t.length){let e=t[i+1];e===`$`?t[i+2]===`{`?(r+=`$\\{`,i+=3):(r+=`$`,i+=2):e===`{`||e===`}`?(r+=`\\${e}`,i+=2):e===`\\`?(r+=`\\`,i+=2):(r+=e,i+=2)}else if(e===`$`){let a=t.slice(i+1),o=ed.exec(a),s=/^\d+/.exec(a);if(o)r+=`\${${n}`,i+=1+o[0].length;else if(s){let e=s[0]===`0`?n:s[0];r+=`\${${e}}`,i+=1+s[0].length}else r+=e,i+=1}else e===`#`&&t[i+1]===`{`?(r+=`#\\{`,i+=2):(r+=e,i+=1)}return r}function id(e){let t=td(e,(e,t)=>t),n=``,r=0;for(;r<t.length;){let e=t[r];if(e===`\\`&&r+1<t.length)n+=t[r+1],r+=2;else if(e===`$`){let i=/^\{(\d+)(?::([^}]*))?\}/.exec(t.slice(r+1));if(i)n+=i[2]??``,r+=1+i[0].length;else{let i=/^\d+/.exec(t.slice(r+1));i?r+=1+i[0].length:(n+=e,r+=1)}}else n+=e,r+=1}return n}function ad(e,t){let{detail:n,labelDetails:r,label:i,kind:a,documentation:o,additionalTextEdits:s,insertTextFormat:c,commitCharacters:l,filterText:u}=e,d=typeof i==`string`?i:``,f=null,p=()=>(f??=t.resolveItem(e),f),m={label:d,detail:r?.detail||n,apply(n,r,i,a){let o=n.state,{from:l,to:u,newText:d}=Gu(o.doc,e,i,a);(l>a||u<a)&&(l=i,u=a);let f=d,m=Ku(o.doc,s??[],l,u),h=e=>{s||!t.hasResolveProvider||Ju({view:n,originalDoc:o.doc,mainFrom:l,mainTo:u,insertedLength:e,resolveItem:p})};if(c===Yu.Snippet&&t.useSnippetOnCompletion){let e=l,t=u;if(m.length>0){let r=o.changes(m);n.dispatch({changes:r}),e=r.mapPos(e,1),t=r.mapPos(t,1)}let r=n.state.doc.length;Ir(rd(f))(n,null,e,t),h(n.state.doc.length-r+(t-e));return}if(c===Yu.Snippet&&(f=id(f)),m.length===0){n.dispatch(Mr(o,f,l,u)),h(f.length);return}let g=o.changes([{from:l,to:u,insert:f},...m]);n.dispatch({changes:g,selection:{anchor:g.mapPos(l,-1)+f.length},userEvent:`input.complete`})},type:a?Bu[a]?.toLowerCase():void 0};u!=null&&u!==d&&(m.label=u,m.displayLabel=d),l?.length&&(m.commitCharacters=l),Vu(e)&&(m.deprecated=!0);let h=e=>{let n=document.createElement(`div`);return n.classList.add(`documentation`),Eu(n,e,{allowHTMLContent:t.allowHTMLContent,markdownRenderer:t.markdownRenderer}),n};return t.hasResolveProvider?m.info=async()=>{try{let e=(await p())?.documentation||o;return!e||Iu(e)?null:h(e)}catch(e){return console.error(`Failed to resolve completion item:`,e),!o||Iu(o)?null:h(o)}}:o&&(m.info=()=>h(o)),m}function od(e,t,n,r=!0){let i=[t?sd(t):cd,n===`python`?ld:void 0].filter(Boolean),a=[...e];if(t&&r){let e=t.toLowerCase();/^\w+$/.test(e)&&(a=a.filter(({label:t,filterText:n})=>(typeof n==`string`?n:dd(t)).toLowerCase().startsWith(e)))}for(let e of i)a.sort(e);return a}function sd(e){return(t,n)=>{let r=ud(t).startsWith(e),i=ud(n).startsWith(e);if(r&&!i)return-1;if(!r&&i)return 1;let a=typeof t.sortText==`string`?t.sortText:dd(t.label),o=typeof n.sortText==`string`?n.sortText:dd(n.label);return a.localeCompare(o)}}function cd(e,t){let n=typeof e.sortText==`string`?e.sortText:dd(e.label),r=typeof t.sortText==`string`?t.sortText:dd(t.label);return n.localeCompare(r)}function ld(e,t){let n=dd(e.label).endsWith(`=`),r=dd(t.label).endsWith(`=`);return n&&!r?-1:!n&&r?1:0}function ud(e){return typeof e.filterText==`string`?e.filterText:dd(e.label)}function dd(e){return typeof e==`string`?e:``}function fd(e){let t=new Proxy({},{get(){throw Error(e)}});return function(e){return e[0]??t}}var pd=fd(`No document URI provided. Pass one to the extension or use documentUri.of().`),md=fd(`No language ID provided. Pass one to the extension or use languageId.of().`);function hd(e){if(e!==e.trim())return!1;try{return!!new URL(e).protocol}catch{return!1}}var gd=bn.define({combine(e){if(e.length===0)return pd(e);let t=pd(e);if(!(t&&hd(t)))throw Error(`Document URI must be a non-empty absolute URI`);return t}}),_d=bn.define({combine(e){if(e.length===0)return md(e);let t=md(e);if(!t.trim())throw Error(`Language ID must be a non-empty string`);return t}}),vd={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,RequestTimeout:-32001},yd=class extends Error{code;data;constructor(e,t,n){super(t),this.name=`RPCError`,this.code=e,this.data=n}},bd=1e4;function xd(e){return e.id!=null}function Sd(e){return e instanceof Error?e:new yd(vd.InternalError,String(e))}var Cd=class{transport;pending=new Map;disconnect;disconnectClose;connected;nextId=0;closed=!1;isConnected=!1;closeError;notificationHandler;requestHandler;constructor(e){this.transport=e,this.disconnect=e.onMessage(e=>this.receive(e)),this.disconnectClose=e.onClose?.(e=>{this.closeError??=e;for(let t of[...this.pending.keys()])this.settle(t,t=>t.reject(e))}),this.connected=e.connect(),this.connected.then(()=>{this.isConnected=!0},()=>{}),this.connected.catch(()=>{})}onNotification(e){this.notificationHandler=e}onRequest(e){this.requestHandler=e}request(e,t,n=bd,r){if(r?.aborted)return Promise.reject(new DOMException(`Request aborted`,`AbortError`));if(this.closed)return Promise.reject(new yd(vd.InternalError,`Client closed`));if(this.closeError)return Promise.reject(this.closeError);let i=this.nextId++;return new Promise((a,o)=>{let s=!1,c=e=>{this.pending.has(i)&&(this.settle(i,t=>t.reject(e)),s&&this.notify(`$/cancelRequest`,{id:i}).catch(()=>{}))},l=()=>c(new DOMException(`Request aborted`,`AbortError`));this.pending.set(i,{resolve:a,reject:o,cleanup:()=>r?.removeEventListener(`abort`,l)}),r?.addEventListener(`abort`,l,{once:!0});let u=()=>{let r=this.pending.get(i);if(r){r.timer=setTimeout(()=>{c(new yd(vd.RequestTimeout,`Request "${e}" timed out after ${n}ms`))},n);try{s=!0,this.transport.send({jsonrpc:`2.0`,id:i,method:e,params:t})}catch(e){this.settle(i,t=>t.reject(Sd(e)))}}};if(this.isConnected){u();return}this.connected.then(u,e=>this.settle(i,t=>t.reject(Sd(e))))})}notify(e,t){let n=this.dispatch({jsonrpc:`2.0`,method:e,params:t});return n.catch(()=>{}),n}respond(e){return this.dispatch(e)}close(){if(!this.closed){this.closed=!0;for(let e of[...this.pending.keys()])this.settle(e,e=>e.reject(new yd(vd.InternalError,`Client closed`)));this.disconnect(),this.disconnectClose?.(),this.transport.close()}}dispatch(e){if(this.closed)return Promise.resolve();if(this.isConnected)try{return this.transport.send(e),Promise.resolve()}catch(e){return Promise.reject(Sd(e))}return this.connected.then(()=>{this.closed||this.transport.send(e)})}settle(e,t){let n=this.pending.get(e);n&&(n.timer!==void 0&&clearTimeout(n.timer),n.cleanup(),this.pending.delete(e),t(n))}receive(e){if(this.closed||typeof e!=`object`||!e||Array.isArray(e)||e.jsonrpc!==`2.0`)return;if(typeof e.method==`string`){xd(e)?this.requestHandler?.(e):this.notificationHandler?.(e);return}if(!xd(e))return;let t=e,n=t.id;if(typeof n==`string`&&!this.pending.has(n)&&/^\d+$/.test(n)){let e=Number(n);this.pending.has(e)&&(n=e)}this.settle(n,e=>{if(`error`in t){let n=t.error;if(typeof n!=`object`||!n||typeof n.code!=`number`||typeof n.message!=`string`){e.reject(new yd(vd.InvalidRequest,`Malformed JSON-RPC error response`,n));return}e.reject(new yd(n.code,n.message,n.data))}else`result`in t?e.resolve(t.result):e.reject(new yd(vd.InvalidRequest,`Malformed JSON-RPC response: missing result or error`))})}},wd=1e4,Td=`Language server: `,Ed={"textDocument/hover":`hoverProvider`,"textDocument/completion":`completionProvider`,"textDocument/definition":`definitionProvider`,"textDocument/declaration":`declarationProvider`,"textDocument/typeDefinition":`typeDefinitionProvider`,"textDocument/implementation":`implementationProvider`,"textDocument/references":`referencesProvider`,"textDocument/documentHighlight":`documentHighlightProvider`,"textDocument/documentSymbol":`documentSymbolProvider`,"textDocument/codeAction":`codeActionProvider`,"textDocument/codeLens":`codeLensProvider`,"textDocument/documentLink":`documentLinkProvider`,"textDocument/formatting":`documentFormattingProvider`,"textDocument/rangeFormatting":`documentRangeFormattingProvider`,"textDocument/onTypeFormatting":`documentOnTypeFormattingProvider`,"textDocument/rename":`renameProvider`,"textDocument/prepareRename":`renameProvider`,"textDocument/signatureHelp":`signatureHelpProvider`,"textDocument/foldingRange":`foldingRangeProvider`,"textDocument/selectionRange":`selectionRangeProvider`,"workspace/symbol":`workspaceSymbolProvider`,"workspace/executeCommand":`executeCommandProvider`},Dd=class{ready;capabilities;advertisedCapabilities;initializePromise;rootUri;workspaceFolders;timeout;client;initializationOptions;clientCapabilities;notificationListeners=new Set;documentOpenCounts=new Map;serverRequestHandlers=new Map;dynamicCapabilities=new Map;isClosed=!1;constructor({rootUri:e,workspaceFolders:t,transport:n,initializationOptions:r,capabilities:i,timeout:a=wd,getWorkspaceConfiguration:o}){if(!e)throw Error(`rootUri must be a non-empty URI`);this.rootUri=e,this.workspaceFolders=t,this.initializationOptions=r,this.clientCapabilities=i,this.timeout=a,this.ready=!1,this.capabilities=null,this.client=new Cd(n),this.client.onNotification(e=>{this.processNotification(e)}),this.client.onRequest(e=>{this.handleServerRequest(e)}),this.onRequest(`workspace/configuration`,e=>o?o(e):(e?.items??[]).map(()=>null)),this.onRequest(`client/registerCapability`,e=>{let t=e?.registrations;if(!Array.isArray(t))return null;for(let e of t)!e||typeof e.id!=`string`||e.id.length===0||typeof e.method!=`string`||this.dynamicCapabilities.has(e.id)||this.dynamicCapabilities.set(e.id,e);return null}),this.onRequest(`client/unregisterCapability`,e=>{let t=e?.unregisterations;if(!Array.isArray(t))return null;for(let e of t)this.dynamicCapabilities.delete(e.id);return null}),this.onRequest(`workspace/applyEdit`,()=>({applied:!1,failureReason:`workspace/applyEdit is not supported`})),this.onRequest(`window/showMessageRequest`,e=>{if(e?.message){let t=String(e.message).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,``).slice(0,2031);console.info(`${Td}${t}`)}return null}),this.onRequest(`window/workDoneProgress/create`,()=>null),this.initializePromise=this.initialize(),this.initializePromise.catch(e=>{console.error(`Language server initialization failed`,e)})}getInitializationOptions(){let e={textDocument:{hover:{dynamicRegistration:!0,contentFormat:[`markdown`,`plaintext`]},moniker:{},synchronization:{dynamicRegistration:!1,willSave:!0,didSave:!0,willSaveWaitUntil:!0},codeAction:{dynamicRegistration:!0,codeActionLiteralSupport:{codeActionKind:{valueSet:[``,`quickfix`,`refactor`,`refactor.extract`,`refactor.inline`,`refactor.rewrite`,`source`,`source.organizeImports`]}},resolveSupport:{properties:[`edit`]}},completion:{dynamicRegistration:!1,completionItem:{snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[`markdown`,`plaintext`],deprecatedSupport:!0,preselectSupport:!1,insertReplaceSupport:!0,tagSupport:{valueSet:[1]},resolveSupport:{properties:[`documentation`,`detail`,`additionalTextEdits`]}},completionList:{itemDefaults:[`commitCharacters`,`editRange`,`insertTextFormat`,`insertTextMode`,`data`]},contextSupport:!1},signatureHelp:{dynamicRegistration:!1,signatureInformation:{documentationFormat:[`markdown`,`plaintext`]}},declaration:{dynamicRegistration:!1,linkSupport:!0},definition:{dynamicRegistration:!0,linkSupport:!0},typeDefinition:{dynamicRegistration:!1,linkSupport:!0},implementation:{dynamicRegistration:!1,linkSupport:!0},rename:{dynamicRegistration:!0,prepareSupport:!0},publishDiagnostics:{relatedInformation:!0,tagSupport:{valueSet:[1,2]},versionSupport:!0,codeDescriptionSupport:!0,dataSupport:!0}},workspace:{didChangeConfiguration:{dynamicRegistration:!1}}};return{capabilities:this.clientCapabilities?typeof this.clientCapabilities==`function`?this.clientCapabilities(e):this.clientCapabilities:e,initializationOptions:this.initializationOptions,processId:null,rootUri:this.rootUri,workspaceFolders:this.workspaceFolders}}async initialize(){let e=this.getInitializationOptions();this.advertisedCapabilities=e?.capabilities;let t=await this.request(`initialize`,e,this.timeout*3);if(!t||typeof t!=`object`||!(`capabilities`in t)||typeof t.capabilities!=`object`||t.capabilities===null)throw Error(`Invalid initialize response: missing server capabilities`);this.isClosed||(this.capabilities=t.capabilities,this.notify(`initialized`,{}),this.ready=!0)}close(){if(!this.isClosed){if(this.isClosed=!0,this.ready=!1,this.notificationListeners.clear(),this.serverRequestHandlers.clear(),this.dynamicCapabilities.clear(),this.documentOpenCounts.clear(),this.capabilities){this.client.request(`shutdown`,null,this.timeout).catch(()=>{}).then(()=>{this.client.notify(`exit`,void 0).catch(()=>{}),this.client.close()});return}this.client.close()}}onRequest(e,t){return this.serverRequestHandlers.set(e,t),()=>{this.serverRequestHandlers.get(e)===t&&this.serverRequestHandlers.delete(e)}}mayRegisterDynamically(e){let[t,n]=e.split(`/`);return t!==`textDocument`||!n?!1:(this.advertisedCapabilities?.textDocument)?.[n]?.dynamicRegistration===!0}hasCapability(e){for(let t of this.dynamicCapabilities.values())if(t.method===e)return!0;let t=Ed[e];return t?!!this.capabilities?.[t]:!1}async handleServerRequest(e){let t=this.serverRequestHandlers.get(e.method),n;if(!t)n={jsonrpc:`2.0`,id:e.id,error:{code:vd.MethodNotFound,message:`Method not found: ${e.method}`}};else try{let r=await t(e.params);n={jsonrpc:`2.0`,id:e.id,result:r===void 0?null:r}}catch(t){n={jsonrpc:`2.0`,id:e.id,error:{code:vd.InternalError,message:t instanceof Error?t.message:String(t)}}}this.isClosed||this.client.respond(n).catch(()=>{})}textDocumentDidOpen(e){let t=e.textDocument.uri,n=this.documentOpenCounts.get(t)??0;return this.documentOpenCounts.set(t,n+1),n>0?Promise.resolve(!1):this.notify(`textDocument/didOpen`,e).then(()=>!0)}textDocumentDidChange(e){return this.notify(`textDocument/didChange`,e)}textDocumentDidClose(e){let t=e.textDocument.uri,n=this.documentOpenCounts.get(t)??0;return n>1?(this.documentOpenCounts.set(t,n-1),Promise.resolve(void 0)):(this.documentOpenCounts.delete(t),this.notify(`textDocument/didClose`,e))}textDocumentWillSave(e){return this.notify(`textDocument/willSave`,e)}async textDocumentWillSaveWaitUntil(e){return await this.request(`textDocument/willSaveWaitUntil`,e,this.timeout)}textDocumentDidSave(e){return this.notify(`textDocument/didSave`,e)}async textDocumentHover(e){return await this.request(`textDocument/hover`,e,this.timeout)}async textDocumentCompletion(e){return await this.request(`textDocument/completion`,e,this.timeout)}async completionItemResolve(e){return await this.request(`completionItem/resolve`,e,this.timeout)}async textDocumentDefinition(e){return await this.request(`textDocument/definition`,e,this.timeout)}async textDocumentCodeAction(e){return await this.request(`textDocument/codeAction`,e,this.timeout)}async codeActionResolve(e){return await this.request(`codeAction/resolve`,e,this.timeout)}async textDocumentRename(e){return await this.request(`textDocument/rename`,e,this.timeout)}async textDocumentPrepareRename(e){return await this.request(`textDocument/prepareRename`,e,this.timeout)}async textDocumentSignatureHelp(e){return await this.request(`textDocument/signatureHelp`,e,this.timeout)}onNotification(e){return this.notificationListeners.add(e),()=>this.notificationListeners.delete(e)}waitForInitialization(e){if(!e)return this.initializePromise;if(e.aborted)return Promise.reject(new DOMException(`Request aborted`,`AbortError`));let t,n=new Promise((n,r)=>{t=()=>r(new DOMException(`Request aborted`,`AbortError`)),e.addEventListener(`abort`,t,{once:!0})});return Promise.race([this.initializePromise,n]).finally(()=>{e.removeEventListener(`abort`,t)})}request(e,t,n,r){if(e===`initialize`)return this.client.request(e,t,n,r);let i=this.hasCapability(e),a=!(this.ready||this.capabilities)&&this.mayRegisterDynamically(e);return this.waitForInitialization(r).then(()=>{if(this.isClosed)throw Error(`Language server client is closed`);if(Ed[e]&&!a&&!(i||this.hasCapability(e)))throw Error(`Language server does not support method ${e}`);return this.client.request(e,t,n,r)})}notify(e,t){return this.client.notify(e,t)}processNotification(e){for(let t of this.notificationListeners)try{Promise.resolve(t(e)).catch(e=>{console.error(`Notification listener failed`,e)})}catch(e){console.error(`Notification listener failed`,e)}}},Od=class e{static OUTBOX_LIMIT=1e3;url;protocols;socket;opened=!1;closed=!1;rejectConnect;handlers=new Set;closeHandlers=new Set;outbox=[];constructor(e,t){this.url=e,this.protocols=t}connect(){return/^wss?:\/\//i.test(this.url)?(this.url.toLowerCase().startsWith(`ws://`)&&typeof location<`u`&&location.protocol===`https:`&&console.warn(`Insecure WebSocket ${this.url} may be blocked from an HTTPS page`),this.rejectConnect?.(Error(`WebSocket connection to ${this.url} was replaced`)),this.rejectConnect=void 0,this.socket?.close(),this.opened=!1,this.closed=!1,new Promise((e,t)=>{let n=new WebSocket(this.url,this.protocols);this.socket=n,this.rejectConnect=t,n.addEventListener(`open`,()=>{if(this.socket===n){this.opened=!0,this.rejectConnect=void 0;for(let e of this.outbox)n.send(e);this.outbox=[],e()}}),n.addEventListener(`message`,e=>{this.socket===n&&this.receiveFrame(e.data,n)}),n.addEventListener(`error`,()=>{if(this.socket!==n)return;let e=Error(`WebSocket connection to ${this.url} failed`);this.opened?this.emitClose(e):t(e)}),n.addEventListener(`close`,()=>{this.socket===n&&(this.opened?this.closed||this.emitClose(Error(`WebSocket connection to ${this.url} closed`)):t(Error(`WebSocket to ${this.url} closed before opening`)))})})):Promise.reject(Error(`Invalid WebSocket URL: ${this.url||`(empty)`}`))}send(t){if(this.closed)return;let n=JSON.stringify(t);this.socket&&this.socket.readyState===WebSocket.OPEN?this.socket.send(n):this.outbox.length<e.OUTBOX_LIMIT&&this.outbox.push(n)}onMessage(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}onClose(e){return this.closeHandlers.add(e),()=>{this.closeHandlers.delete(e)}}close(){this.rejectConnect?.(Error(`WebSocket to ${this.url} closed`)),this.rejectConnect=void 0,this.closed=!0,this.opened=!1,this.handlers.clear(),this.closeHandlers.clear(),this.outbox=[],this.socket?.close(),this.socket=void 0}receiveFrame(e,t){if(e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`){this.dispatchFrame(new TextDecoder().decode(e));return}if(typeof Blob<`u`&&e instanceof Blob){e.text().then(e=>{this.socket===t&&this.dispatchFrame(e)});return}this.dispatchFrame(String(e))}dispatchFrame(e){if(this.closed)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t;for(let e of this.handlers)try{e(n)}catch(e){console.error(`WebSocket message handler failed`,e)}}emitClose(e){this.opened=!1,this.closed=!0;for(let t of this.closeHandlers)try{t(e)}catch(e){console.error(`WebSocket close handler failed`,e)}}},kd=console.log,Ad=2**31-1;function jd(){return String(Date.now()+Math.random())}function Md(e){return e!=null&&typeof e.command==`string`}function Nd(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Pd(e,t){let n=Nd(e.start,e.end)===0,r=Nd(t.start,t.end)===0;return n||r?Nd(e.start,t.end)<=0&&Nd(t.start,e.end)<=0:Nd(e.start,t.end)<0&&Nd(t.start,e.end)<0}function Fd(e,t){if(Md(e))return!0;let n=e.diagnostics;return!n||n.length===0||n.some(e=>Pd(e.range,t.range))}function Id(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`||t.protocol===`mailto:`}var Ld=Cn.define(),Rd=cn.define({create:()=>new Map,update(e,t){let n=e;for(let r of t.effects)if(r.is(Ld)){n===e&&(n=new Map(e));for(let e of[...n.keys()])e.startsWith(`${r.value.pluginId}:`)&&n.delete(e);for(let[e,t]of r.value.anchors)n.set(e,t)}if(t.docChanged&&n.size>0){n===e&&(n=new Map(e));for(let[e,r]of n)n.set(e,{from:t.changes.mapPos(r.from,1),to:t.changes.mapPos(r.to,r.from===r.to?1:-1)})}return n}}),zd=Cn.define(),Bd=cn.define({create:()=>null,update(e,t){for(let e of t.effects)if(e.is(zd))return e.value;if(e&&t.docChanged){let n=t.changes.mapPos(e.pos),r=e.end==null?void 0:t.changes.mapPos(e.end);return{...e,pos:n,end:r}}return e},provide:e=>mn.from(e)}),Vd=tr.define(),Hd=20,Ud=new WeakMap;function Wd(e,t){let n=Ud.get(e);n?n.push(t):Ud.set(e,[t])}function Gd(e,t){let n=Ud.get(e);if(!n)return;let r=n.indexOf(t);r!==-1&&n.splice(r,1),n.length===0&&Ud.delete(e)}var Kd=class{documentVersion;pluginId;pendingDocumentChanges=new Set;client;documentUri;languageId;view;allowHTMLContent;useSnippetOnCompletion;clientSideFiltering;sendIncrementalChanges;featureOptions;onGoToDefinition;onShowLocation;markdownRenderer;codeActionsConfig;disposeListener;destroyed=!1;documentOpened=!1;documentTextSnapshotted=!1;documentOpenCarriedText=!0;documentReady;signatureHelpRequestId=0;closeCodeActionMenu;closeRenamePopup;constructor(e){let{client:t,documentUri:n,languageId:r,view:i,featureOptions:a,sendIncrementalChanges:o=!0,allowHTMLContent:s=!1,useSnippetOnCompletion:c=!1,clientSideFiltering:l=!1,onGoToDefinition:u,onShowLocation:d,markdownRenderer:f=_u,codeActionsConfig:p}=e;this.documentVersion=0,this.pluginId=jd(),this.client=t,this.documentUri=n,this.languageId=r,this.view=i,this.allowHTMLContent=s,this.useSnippetOnCompletion=c,this.clientSideFiltering=l,this.sendIncrementalChanges=o,this.featureOptions=a,this.onGoToDefinition=u,this.onShowLocation=d,this.markdownRenderer=f,this.codeActionsConfig=p,Wd(i,this),this.disposeListener=t.onNotification(this.processNotification.bind(this)),this.documentReady=this.initialize().catch(e=>{console.error(`Language server initialization failed`,e)})}update({state:e,docChanged:t,startState:{doc:n},changes:r}){if(!t)return;let i=this.resolveTextDocumentSyncKind();i!==fu.TextDocumentSyncKind.None&&(this.sendIncrementalChanges&&i===fu.TextDocumentSyncKind.Incremental?this.trackDocumentChanges(zu(n,r)):this.trackDocumentChanges([{text:e.doc.toString()}]))}trackDocumentChanges(e){let t=this.sendChanges(e);this.pendingDocumentChanges.add(t),t.finally(()=>this.pendingDocumentChanges.delete(t))}destroy(){this.destroyed=!0,this.disposeListener?.(),this.disposeListener=void 0,this.closeCodeActionMenu?.(),this.closeRenamePopup?.(),this.view.state.field(Rd,!1)&&this.view.dispatch({effects:Ld.of({pluginId:this.pluginId,anchors:new Map})}),Gd(this.view,this),this.closeDocument()}closeDocument(){this.documentOpened&&this.client.ready&&(this.documentOpened=!1,Promise.resolve(this.client.textDocumentDidClose({textDocument:{uri:this.documentUri}})).catch(e=>{console.error(`Failed to send didClose`,e)}))}async initialize({documentText:e}={}){if(this.client.initializePromise&&await this.client.initializePromise,this.destroyed)return;let t=e??this.view.state.doc.toString();this.documentTextSnapshotted=!0;let n=await this.client.textDocumentDidOpen({textDocument:{uri:this.documentUri,languageId:this.languageId,text:t,version:this.documentVersion}});this.documentOpenCarriedText=n!==!1,this.documentOpened=!0,this.destroyed&&this.closeDocument()}resolveTextDocumentSyncKind(){let e=this.client.capabilities?.textDocumentSync;return e==null?this.sendIncrementalChanges?fu.TextDocumentSyncKind.Incremental:fu.TextDocumentSyncKind.Full:typeof e==`number`?e:e.change??fu.TextDocumentSyncKind.None}async sendChanges(e){let t=this.documentTextSnapshotted;if(!(!this.documentOpened&&(await this.documentReady,!t&&this.documentOpenCarriedText))&&this.client.ready)try{await this.client.textDocumentDidChange({textDocument:{uri:this.documentUri,version:++this.documentVersion},contentChanges:e})}catch(e){console.error(e)}}async documentDidSave(e=fu.TextDocumentSaveReason.Manual){if(!this.client.ready||(await Promise.all(this.pendingDocumentChanges),this.destroyed||!this.client.ready))return;let t=this.client.capabilities?.textDocumentSync,n=typeof t==`object`&&t?t:void 0;if(n?.willSave){try{await this.client.textDocumentWillSave({textDocument:{uri:this.documentUri},reason:e})}catch(e){console.error(`Failed to send willSave`,e)}if(this.destroyed||!this.client.ready)return}if(n?.willSaveWaitUntil){try{let t=await this.client.textDocumentWillSaveWaitUntil({textDocument:{uri:this.documentUri},reason:e});t&&t.length>0&&!this.destroyed&&(this.applyEdits(this.view,t),await Promise.all(this.pendingDocumentChanges))}catch(e){console.error(`Failed during willSaveWaitUntil`,e)}if(this.destroyed||!this.client.ready)return}let r=n?.save;if(r==null||r===!1)return;let i=typeof r==`object`&&r.includeText;try{await this.client.textDocumentDidSave({textDocument:{uri:this.documentUri},text:i?this.view.state.doc.toString():void 0})}catch(e){console.error(`Failed to send didSave`,e)}}requestDiagnostics(e){this.sendChanges([{text:e.state.doc.toString()}])}async requestHoverTooltip(e,{line:t,character:n}){if(!this.featureOptions.hoverEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/hover`)))return null;let r;try{r=await this.client.textDocumentHover({textDocument:{uri:this.documentUri},position:{line:t,character:n}})}catch{return null}if(!r)return null;let{contents:i,range:a}=r,o=pu(e.state.doc,{line:t,character:n}),s;if(a&&(o=pu(e.state.doc,a.start),s=pu(e.state.doc,a.end)),o==null||Iu(i))return null;let c=document.createElement(`div`);return c.classList.add(`documentation`,`cm-lsp-hover-tooltip`),Eu(c,i,{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),{pos:o,end:s,create:e=>({dom:c}),above:!0}}async requestCompletion(e,{line:t,character:n},{triggerKind:r,triggerCharacter:i}){if(!this.featureOptions.completionEnabled||(await Promise.all(this.pendingDocumentChanges),!(this.client.ready&&this.client.hasCapability(`textDocument/completion`))))return null;let a;try{a=await this.client.textDocumentCompletion({textDocument:{uri:this.documentUri},position:{line:t,character:n},context:{triggerKind:r,triggerCharacter:i}})}catch{return null}if(!a)return null;let o=Au(a)?a:{isIncomplete:!1,items:a};if(!Array.isArray(o.items))return null;let s=o.items.map(e=>Wu(e,o.itemDefaults)),c=this.clientSideFiltering&&!o.isIncomplete,l=Ou(s),u=l?e.matchBefore(l)??e.matchBefore(/[a-zA-Z0-9_]+/):e.matchBefore(/[a-zA-Z0-9_]+/),{pos:d}=e,f=od(s,u?.text,this.languageId,!c);u&&(d=u.from);let p=f.map(e=>ad(e,{allowHTMLContent:this.allowHTMLContent,useSnippetOnCompletion:this.useSnippetOnCompletion,hasResolveProvider:this.client.capabilities?.completionProvider?.resolveProvider??!1,resolveItem:this.client.completionItemResolve.bind(this.client)}));return c?{from:d,options:p,validFor:/^\w*$/}:{from:d,options:p,filter:!1}}async requestDefinition(e,{line:t,character:n}){if(!this.featureOptions.definitionEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/definition`)))return;let r;try{r=await this.client.textDocumentDefinition({textDocument:{uri:this.documentUri},position:{line:t,character:n}})}catch{return}if(!r||this.destroyed)return;let i=Array.isArray(r)?r:[r];if(i.length===0)return;let a=i[0];if(!a||typeof a!=`object`)return;let o=`uri`in a&&typeof a.uri==`string`?a.uri:`targetUri`in a&&typeof a.targetUri==`string`?a.targetUri:void 0,s=`range`in a?a.range:`targetRange`in a?a.targetRange:void 0;if(!(o&&s?.start&&s.end))return;let c=o!==this.documentUri,l={uri:o,range:s,isExternalDocument:c};if(!c){let t=pu(e.state.doc,s.start),n=pu(e.state.doc,s.end);if(t==null||n==null||t>n)return;e.dispatch(e.state.update({selection:{anchor:t,head:n}}))}return this.onGoToDefinition&&this.onGoToDefinition(l),l}processNotification(e){try{e.method===`textDocument/publishDiagnostics`&&e.params&&this.processDiagnostics(e.params).catch(e=>kd(e))}catch(e){kd(e)}}lastSeenDiagnosticsVersion=null;async processDiagnostics(e){if(!e||e.uri!==this.documentUri||!Array.isArray(e.diagnostics))return;if(e.version!=null){if(typeof e.version!=`number`||!Number.isInteger(e.version)||e.version<0||e.version>Ad||this.lastSeenDiagnosticsVersion!=null&&e.version<this.lastSeenDiagnosticsVersion)return;this.lastSeenDiagnosticsVersion=e.version}else if(this.lastSeenDiagnosticsVersion!=null)return;if(!this.featureOptions.diagnosticsEnabled){this.clearDiagnostics();return}let t={[fu.DiagnosticSeverity.Error]:`error`,[fu.DiagnosticSeverity.Warning]:`warning`,[fu.DiagnosticSeverity.Information]:`info`,[fu.DiagnosticSeverity.Hint]:`hint`},n=this.view.state.doc,r=e.diagnostics.filter(e=>{if(!e||typeof e!=`object`||!e.range||typeof e.message!=`string`&&(typeof e.message!=`object`||e.message===null||typeof e.message.value!=`string`))return!1;let t=pu(n,e.range.start),r=pu(n,e.range.end);return t!=null&&r!=null&&t<=r});if(e.diagnostics.length>0&&r.length===0)return;let i=[];try{i=await this.requestCodeActionsForDiagnostics(r)??[]}catch(e){console.error(`Failed to fetch code actions`,e)}if(this.destroyed||e.version!=null&&this.lastSeenDiagnosticsVersion!=null&&e.version<this.lastSeenDiagnosticsVersion||this.view.state.doc!==n)return;let a=new Map,o=r.map((e,r)=>{let{range:o,message:s,severity:c,code:l,source:u,tags:d}=e,f=pu(n,o.start),p=pu(n,o.end);if(f==null||p==null||f>p)return null;e.relatedInformation?.forEach((e,t)=>{if(e.location.uri!==this.documentUri)return;let i=pu(n,e.location.range.start),o=pu(n,e.location.range.end);i!=null&&o!=null&&a.set(`${this.pluginId}:${r}:${t}`,{from:i,to:o})});let m=i.filter(t=>Fd(t,e)).map(e=>({name:`command`in e&&typeof e.command==`object`&&e.command?.title||e.title,apply:()=>{this.applyCodeAction(e)}})),h=u||this.languageId,g=l!=null&&l!==``?`${h}(${l})`:h,_=[this.pluginId];return d?.includes(fu.DiagnosticTag.Unnecessary)&&_.push(`cm-lsp-unnecessary`),d?.includes(fu.DiagnosticTag.Deprecated)&&_.push(`cm-lsp-deprecated`),{from:f,to:p,severity:t[c??fu.DiagnosticSeverity.Error]??`error`,message:Nu(s),renderMessage:t=>this.renderDiagnosticMessage(t,e,r),source:g,markClass:_.join(` `),actions:m.length>0?m:void 0,lspDiagnostic:e}});this.setOwnDiagnostics(o.filter(e=>e!=null),a)}setOwnDiagnostics(e,t=new Map){let n=this.view.state,r=[];_r(n,(e,t,n)=>{this.ownsDiagnostic(e)||r.push({...e,from:t,to:n})});let i=ur(n,[...r,...e]),a=i.effects,o=Array.isArray(a)?[...a]:a?[a]:[];o.push(Ld.of({pluginId:this.pluginId,anchors:t})),this.view.dispatch({...i,effects:o})}ownsDiagnostic(e){return e.markClass?.split(` `).includes(this.pluginId)??!1}renderDiagnosticMessage(e,t,n){let{message:r,code:i,source:a,codeDescription:o,relatedInformation:s}=t,c=document.createElement(`div`);c.classList.add(`cm-lsp-diagnostic-message`);let l=document.createElement(`div`);if(Eu(l,{kind:`markdown`,value:Nu(r)},{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),c.appendChild(l),o?.href&&Id(o.href)){let e=a||this.languageId,t=i!=null&&i!==``?`${e}(${i})`:e,n=document.createElement(`a`);n.className=`cm-diagnostic-code-link`,n.href=o.href,n.target=`_blank`,n.rel=`noopener noreferrer`,n.textContent=t,c.appendChild(n)}if(s&&s.length>0){let t=document.createElement(`div`);t.className=`cm-diagnostic-related`,s.forEach((r,i)=>{t.appendChild(this.renderRelatedInformation(e,r,`${this.pluginId}:${n}:${i}`))}),c.appendChild(t)}return c}renderRelatedInformation(e,t,n){let{location:r,message:i}=t,{uri:a,range:o}=r,s=a!==this.documentUri,c=()=>{if(s)return null;let t=e.state.field(Rd,!1)?.get(n);if(t)return t;let r=pu(e.state.doc,o.start);return r==null?null:{from:r,to:pu(e.state.doc,o.end)??r}},l=document.createElement(`div`);l.className=`cm-diagnostic-related-item`;let u=document.createElement(`span`);u.className=`cm-diagnostic-related-message`,u.textContent=i,l.appendChild(u);let d=c(),f=d&&!s?mu(e.state.doc,d.from):o.start,p=document.createElement(`span`);if(p.className=`cm-diagnostic-related-location`,p.textContent=` ${a}:${f.line+1}:${f.character+1}`,l.appendChild(p),!s||this.onShowLocation){l.classList.add(`cm-diagnostic-related-clickable`),l.setAttribute(`role`,`button`),l.tabIndex=0;let t=()=>{if(s){this.onShowLocation?.({uri:a,range:o,isExternalDocument:s});return}let t=c();t!=null&&e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0})};l.addEventListener(`click`,t),l.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())})}return l}clearDiagnostics(){this.setOwnDiagnostics([])}async requestCodeActionsForDiagnostics(e){let t=e[0];if(!t||!this.featureOptions.codeActionsEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/codeAction`)))return null;let n=t.range.start,r=t.range.end;for(let t of e)Nd(t.range.start,n)<0&&(n=t.range.start),Nd(t.range.end,r)>0&&(r=t.range.end);return await this.client.textDocumentCodeAction({textDocument:{uri:this.documentUri},range:{start:n,end:r},context:{diagnostics:e}})}async requestCodeActions(e,t,n){return!this.featureOptions.codeActionsEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/codeAction`))?null:await this.client.textDocumentCodeAction({textDocument:{uri:this.documentUri},range:t,context:{diagnostics:this.diagnosticsInRange(e,t),...n?{only:n}:{}}})}async requestCodeActionsAtSelection(e){let{from:t,to:n}=e.state.selection.main;return await this.requestCodeActions(e,{start:mu(e.state.doc,t),end:mu(e.state.doc,n)})}diagnosticsInRange(e,t){let n=e.state.doc,r=pu(n,t.start),i=pu(n,t.end);if(r==null||i==null)return[];let a={error:fu.DiagnosticSeverity.Error,warning:fu.DiagnosticSeverity.Warning,info:fu.DiagnosticSeverity.Information,hint:fu.DiagnosticSeverity.Hint},o=[];return _r(e.state,(e,t,s)=>{if(t>i||s<r)return;let c={start:mu(n,t),end:mu(n,s)},l=e.lspDiagnostic;l?o.push({...l,range:c}):o.push({range:c,message:e.message,severity:a[e.severity],source:e.source})}),o}async applyCodeAction(e){let t=await this.resolveCodeAction(e);if(!this.destroyed){if(Md(t)){kd(`Executing command:`,t);return}t.edit&&await this.applyWorkspaceEdit(this.view,t.edit),t.command?kd(`Executing command:`,t.command):t.edit||Fu(this.view,`Code action "${e.title}" has nothing to apply`)}}async resolveCodeAction(e){if(Md(e)||e.edit||e.command||!this.serverSupportsCodeActionResolve())return e;try{return await this.client.codeActionResolve(e)??e}catch(t){return console.error(`Failed to resolve code action`,t),e}}serverSupportsCodeActionResolve(){let e=this.client.capabilities?.codeActionProvider;if(typeof e==`object`&&e.resolveProvider)return!0;for(let e of this.client.dynamicCapabilities.values())if(e.method===`textDocument/codeAction`&&e.registerOptions?.resolveProvider)return!0;return!1}async showCodeActionsMenu(e){let t=e.state,n=await this.requestCodeActionsAtSelection(e);if(this.destroyed||e.state.doc!==t.doc||!e.state.selection.main.eq(t.selection.main))return!1;if(!n||n.length===0)return Fu(e,`No code actions available`),!1;let r=async e=>{await this.applyCodeAction(e)};return this.codeActionsConfig?.renderMenu?(this.codeActionsConfig.renderMenu(n,r),!0):(this.showDefaultCodeActionsMenu(e,n,r),!0)}showDefaultCodeActionsMenu(e,t,n){this.closeCodeActionMenu?.();let r=document.createElement(`div`);r.className=`cm-code-action-menu`,r.setAttribute(`role`,`listbox`),r.style.cssText=`position: absolute; display: flex; flex-direction: column; padding: 2px; background: white; border: 1px solid #ddd; box-shadow: 0 2px 8px rgba(0,0,0,.15); z-index: 99;`;let i=e=>{r.contains(e.target)||a()},a=()=>{this.closeCodeActionMenu===a&&(this.closeCodeActionMenu=void 0),r.remove(),document.removeEventListener(`mousedown`,i)};this.closeCodeActionMenu=a;let o=t.map(t=>{let i=document.createElement(`button`);i.type=`button`,i.className=`cm-code-action-item`,i.style.cssText=`display: flex; gap: 8px; align-items: baseline; padding: 4px 8px; border: none; background: none; text-align: left; cursor: pointer; font: inherit;`;let o=document.createElement(`span`);if(o.textContent=t.title,i.appendChild(o),!Md(t)&&t.kind){let e=document.createElement(`span`);e.className=`cm-code-action-kind`,e.style.cssText=`color: #888; font-size: 85%; margin-left: auto;`,e.textContent=t.kind,i.appendChild(e)}return!Md(t)&&t.disabled&&(i.disabled=!0,i.title=t.disabled.reason,i.style.opacity=`0.5`,i.style.cursor=`default`),i.addEventListener(`click`,()=>{a(),e.focus(),n(t)}),r.appendChild(i),i}),s=o.findIndex(e=>!e.disabled),c=e=>{s=e,o[e]?.focus()},l=e=>{for(let t=s+e;t>=0&&t<o.length;t+=e)if(!o[t]?.disabled){c(t);return}};r.tabIndex=-1,r.addEventListener(`keydown`,t=>{if(t.key===`Escape`)a(),e.focus();else if(t.key===`ArrowDown`)l(1);else if(t.key===`ArrowUp`)l(-1);else if(t.key===`Enter`){let e=o[s];e&&!e.disabled&&e.click()}else return;t.preventDefault(),t.stopPropagation()});let u=e.coordsAtPos(e.state.selection.main.from);u&&(r.style.left=`${u.left+window.scrollX}px`,r.style.top=`${u.bottom+window.scrollY+5}px`),document.addEventListener(`mousedown`,i),document.body.appendChild(r),s===-1?r.focus():c(s)}async requestRename(e,{line:t,character:n}){if(this.featureOptions.renameEnabled){if(!this.client.ready){Fu(e,`Language server not ready`);return}if(!this.client.hasCapability(`textDocument/rename`)){Fu(e,`Rename not supported by language server`);return}try{let r=await this.client.textDocumentPrepareRename({textDocument:{uri:this.documentUri},position:{line:t,character:n}}).catch(()=>this.prepareRenameFallback(e,{line:t,character:n}));if(!r){Fu(e,`Cannot rename this symbol`);return}let i;if(`defaultBehavior`in r){if(!r.defaultBehavior){Fu(e,`Cannot rename this symbol`);return}let a=this.prepareRenameFallback(e,{line:t,character:n});if(!a){Fu(e,`Cannot rename this symbol`);return}i=a}else i=r;let a=document.createElement(`div`);a.className=`cm-rename-popup`,a.style.cssText=`position: absolute; padding: 4px; background: white; border: 1px solid #ddd; box-shadow: 0 2px 8px rgba(0,0,0,.15); z-index: 99;`;let o=document.createElement(`input`);o.type=`text`,o.style.cssText=`width: 200px; padding: 4px; border: 1px solid #ddd;`;let s=`range`in i?i.range:i,c=pu(e.state.doc,s.start);if(c==null)return;let l=pu(e.state.doc,s.end);o.value=`placeholder`in i?i.placeholder:l==null?``:e.state.doc.sliceString(c,l);let u=o.value;a.appendChild(o);let d=e.coordsAtPos(c);if(!d)return;a.style.left=`${d.left}px`,a.style.top=`${d.bottom+5}px`;let f=e=>{a.contains(e.target)||p()},p=()=>{a.remove(),document.removeEventListener(`mousedown`,f),this.closeRenamePopup===p&&(this.closeRenamePopup=void 0)},m=async()=>{let r=o.value.trim();if(!r){Fu(e,`New name cannot be empty`),p();return}if(/[\r\n]/.test(r)){Fu(e,`New name must be a single line`),p();return}if(r===u){p();return}try{let i=e.state.doc,a=await this.client.textDocumentRename({textDocument:{uri:this.documentUri},position:{line:t,character:n},newName:r});if(this.destroyed||e.state.doc!==i)return;await this.applyRenameEdit(e,a)}catch(t){Fu(e,`Rename failed: ${t instanceof Error?t.message:`Unknown error`}`)}finally{p()}};o.addEventListener(`keydown`,e=>{e.key===`Enter`?m():e.key===`Escape`&&p(),e.stopPropagation()}),this.closeRenamePopup?.(),this.closeRenamePopup=p,document.addEventListener(`mousedown`,f),document.body.appendChild(a),o.focus(),o.select()}catch(t){Fu(e,`Rename failed: ${t instanceof Error?t.message:`Unknown error`}`)}}}async requestSignatureHelp(e,{line:t,character:n},r=void 0){if(!(this.featureOptions.signatureHelpEnabled&&this.client.ready&&this.client.hasCapability(`textDocument/signatureHelp`)))return null;try{let i=await this.client.textDocumentSignatureHelp({textDocument:{uri:this.documentUri},position:{line:t,character:n},context:{isRetrigger:!1,triggerKind:1,triggerCharacter:r}});if(!i?.signatures||i.signatures.length===0)return null;let a=this.createTooltipContainer(),o=i.activeSignature??0,s=i.signatures[o]||i.signatures[0];if(!s)return null;let c=i.activeParameter??s.activeParameter??0,l=this.createSignatureElement(s,c);a.appendChild(l),s.documentation&&a.appendChild(this.createDocumentationElement(s.documentation));let u=s.parameters?.[c];u?.documentation&&a.appendChild(this.createParameterDocElement(u.documentation));let d=pu(e.state.doc,{line:t,character:n});return d==null?null:{pos:d,end:d,create:e=>({dom:a}),above:this.featureOptions.signatureHelpOptions?.position===`above`}}catch(e){return console.error(`Signature help error:`,e),null}}async showSignatureHelpTooltip(e,t,n){let r=++this.signatureHelpRequestId,i=await this.requestSignatureHelp(e,mu(e.state.doc,t),n);this.destroyed||r!==this.signatureHelpRequestId||e.dispatch({effects:zd.of(i)})}createTooltipContainer(){let e=document.createElement(`div`);return e.classList.add(`cm-signature-help`),e.style.cssText=`padding: 6px; max-width: 400px;`,e}createSignatureElement(e,t){let n=document.createElement(`div`);if(n.classList.add(`cm-signature`),n.style.cssText=`font-family: monospace; margin-bottom: 4px;`,!e.label||typeof e.label!=`string`)return n.textContent=`Signature information unavailable`,n;let r=e.label,i=e.parameters||[];if(i.length===0||!i[t])return n.textContent=r,n;let a=i[t].label;if(typeof a==`string`){let e=r.indexOf(`(`)+1;for(let n=0;n<t;n++){let t=i[n]?.label;if(typeof t==`string`){let n=r.indexOf(t,e);n!==-1&&(e=n+t.length)}}let o=r.indexOf(a,e);o===-1?n.textContent=r:this.applyRangeHighlighting(n,r,o,o+a.length)}else Array.isArray(a)&&a.length===2?this.applyRangeHighlighting(n,r,a[0],a[1]):n.textContent=r;return n}applyRangeHighlighting(e,t,n,r){if(!(Number.isInteger(n)&&Number.isInteger(r))||n<0||r<0||n>t.length||r>t.length){e.textContent=t;return}let i=Math.min(n,r),a=Math.max(n,r);if(i===a){e.textContent=t;return}e.textContent=``;let o=t.substring(0,i),s=t.substring(i,a),c=t.substring(a);e.appendChild(document.createTextNode(o));let l=document.createElement(`span`);l.classList.add(`cm-signature-active-param`),l.style.cssText=`font-weight: bold; text-decoration: underline;`,l.textContent=s,e.appendChild(l),e.appendChild(document.createTextNode(c))}createDocumentationElement(e){let t=document.createElement(`div`);return t.classList.add(`cm-signature-docs`),t.style.cssText=`margin-top: 4px; color: #666;`,Eu(t,e,{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),t}createParameterDocElement(e){let t=document.createElement(`div`);return t.classList.add(`cm-parameter-docs`),t.style.cssText=`margin-top: 4px; font-style: italic; border-top: 1px solid #eee; padding-top: 4px;`,Eu(t,e,{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),t}prepareRenameFallback(e,{line:t,character:n}){let r=e.state.doc.line(t+1).text,i=/\w+/g,a,o=n,s=n;for(;(a=i.exec(r))!==null;){let e=a.index,t=a.index+a[0].length;if(n>=e&&n<=t){o=e,s=t;break}}return o===n&&s===n?null:{range:{start:{line:t,character:o},end:{line:t,character:s}},placeholder:r.slice(o,s)}}applyEdits(e,t){let n=e.state.doc,r=[];for(let e of t){if(!e||typeof e!=`object`||!e.range||typeof e.newText!=`string`)return!1;let t=pu(n,e.range.start),i=pu(n,e.range.end);if(t==null||i==null||t>i)return!1;r.push({from:t,to:i,insert:e.newText})}if(r.length===0)return!1;let i=[...r].sort((e,t)=>e.from-t.from||e.to-t.to);for(let t=1;t<i.length;t++){let n=i[t-1],r=i[t];if(n&&r&&(r.from<n.to||r.from===r.to&&n.from===n.to&&r.from===n.from))return Fu(e,`Workspace edit ranges overlap`),!1}return e.dispatch(e.state.update({changes:r})),!0}async applyWorkspaceEdit(e,t){if(!t)return Fu(e,`No edit returned from language server`),!1;let n=t.changes&&typeof t.changes==`object`?t.changes:{},r=Array.isArray(t.documentChanges)?t.documentChanges:[];if(Object.keys(n).length===0&&r.length===0)return Fu(e,`No changes to apply`),!1;if(r.length>0){let t=[];for(let n of r){if(typeof n!=`object`||!n||!(`textDocument`in n))return Fu(e,`File creation, deletion, or renaming operations not supported yet`),!1;if(typeof n.textDocument!=`object`||n.textDocument===null)return Fu(e,`Malformed workspace edit`),!1;if(n.textDocument.uri!==this.documentUri)return Fu(e,`Multi-file edits not supported yet`),!1;if(n.textDocument.version!=null&&n.textDocument.version!==this.documentVersion)return Fu(e,`Workspace edit is stale because the document changed`),!1;if(!Array.isArray(n.edits))return!1;for(let r of n.edits){if(typeof r!=`object`||!r||!(`newText`in r))return Fu(e,`Snippet edits not supported yet`),!1;t.push(r)}}return t.length!==0&&this.applyEdits(e,t)}let i=Object.entries(n);if(i.some(([e])=>e!==this.documentUri))return Fu(e,`Multi-file edits not supported yet`),!1;let a=i[0]?.[1];return Array.isArray(a)?this.applyEdits(e,a):!1}async applyRenameEdit(e,t){return this.applyWorkspaceEdit(e,t)}};function qd(e){let t={rename:`F2`,goToDefinition:`F12`,signatureHelp:`Mod-Shift-Space`,codeActions:`Mod-.`,...e.keyboardShortcuts},n=e.client,r={diagnosticsEnabled:!0,hoverEnabled:!0,completionEnabled:!0,definitionEnabled:!0,renameEnabled:!0,codeActionsEnabled:!0,signatureHelpEnabled:!0,signatureActivateOnTyping:!1,signatureHelpOptions:{position:`below`},...e},i=Zn.define(t=>new Kd({client:n,documentUri:e.documentUri??t.state.facet(gd),languageId:e.languageId??t.state.facet(_d),view:t,featureOptions:r,sendIncrementalChanges:e.sendIncrementalChanges,allowHTMLContent:e.allowHTMLContent,useSnippetOnCompletion:e.useSnippetOnCompletion,clientSideFiltering:e.clientSideFiltering,onGoToDefinition:e.onGoToDefinition,onShowLocation:e.onShowLocation,markdownRenderer:e.markdownRenderer,codeActionsConfig:e.codeActionsConfig})),a=e=>e.plugin(i),o=[i];if(r.diagnosticsEnabled&&o.push(Rd,Jn.baseTheme({".cm-lsp-unnecessary":{opacity:`0.6`},".cm-lsp-deprecated":{textDecoration:`line-through`},".cm-diagnostic-related":{marginTop:`4px`,display:`flex`,flexDirection:`column`,gap:`2px`},".cm-diagnostic-related-clickable":{cursor:`pointer`},".cm-diagnostic-related-location":{opacity:`0.7`},".cm-diagnostic-code-link":{display:`inline-block`,marginTop:`4px`}})),o.push(pn.of([{key:t.signatureHelp,run:e=>{let t=a(e);if(!(t&&r.signatureHelpEnabled))return!1;let n=e.state.selection.main.head;return t.showSignatureHelpTooltip(e,n),!0}},{key:t.rename,run:e=>{let t=a(e);if(!(t&&r.renameEnabled))return!1;let n=e.state.selection.main.head;return t.requestRename(e,mu(e.state.doc,n)),!0}},{key:t.codeActions,run:e=>{let t=a(e);return t&&r.codeActionsEnabled?(t.showCodeActionsMenu(e).catch(t=>Fu(e,`Code actions failed: ${t instanceof Error?t.message:`Unknown error`}`)),!0):!1}},{key:t.goToDefinition,run:e=>{let t=a(e);if(!(t&&r.definitionEnabled))return!1;let n=e.state.selection.main.head;return t.requestDefinition(e,mu(e.state.doc,n)).catch(t=>Fu(e,`Go to definition failed: ${t instanceof Error?t.message:`Unknown error`}`)),!0}}])),r.hoverEnabled&&o.push(En((e,t)=>{let n=a(e);return n==null?null:n.requestHoverTooltip(e,mu(e.state.doc,t))},e.hoverConfig)),r.signatureHelpEnabled){o.push(Bd);let e=e=>e.state.field(Bd)?(e.dispatch({effects:zd.of(null)}),!0):!1;o.push(Jn.domEventHandlers({mousedown:(t,n)=>(e(n),!1)})),o.push(pn.of([{key:`)`,run:t=>(e(t),!1)},{key:`Escape`,run:t=>e(t)}])),o.push(Jn.updateListener.of(t=>{if(!(a(t.view)&&r.signatureActivateOnTyping)||!t.state.field(Bd)||!(t.selectionSet||t.docChanged))return;let n=t.state.selection.main.head;Zd(t.state.doc,n)||queueMicrotask(()=>{e(t.view)})})),o.push(Jn.updateListener.of(async e=>{let t=a(e.view);if(!(t&&e.docChanged)||e.transactions.some(e=>e.annotation(Vd))||!t.client.hasCapability(`textDocument/signatureHelp`)||!r.signatureActivateOnTyping)return;let n=t.client.capabilities?.signatureHelpProvider?.triggerCharacters||[`(`,`,`],i=e.changes,o=-1,s;i.iterChanges((e,t,r,i,a)=>{if(o>=0)return;let c=Yd(a.toString(),r,n);c&&(o=c.triggerPos,s=c.triggerCharacter)}),o>=0&&t.showSignatureHelpTooltip(e.view,o,s)}))}if(r.completionEnabled){let t=e.completionConfig?.optionClass;o.push(Jn.baseTheme({".cm-tooltip-autocomplete li.cm-deprecated .cm-completionLabel":{textDecoration:`line-through`}}),Lr({...e.completionConfig,optionClass:e=>[Hu(e),t?.(e)??``].filter(Boolean).join(` `),override:[async t=>{let n=t.view?a(t.view):null;if(n==null)return null;let{state:r,pos:i}=t,o=Jd(t,n.client.capabilities?.completionProvider?.triggerCharacters??[],e.completionMatchBefore);return o==null?null:await n.requestCompletion(t,mu(r.doc,i),o)},...e.completionConfig?.override||[]]}))}return o.push(Jn.domEventHandlers({click:(e,n)=>{if(r.definitionEnabled&&t.goToDefinition===`ctrlcmd`&&(e.ctrlKey||e.metaKey)){let t=n.posAtCoords({x:e.clientX,y:e.clientY}),r=a(n);t&&r&&(r.requestDefinition(n,mu(n.state.doc,t)).catch(e=>Fu(n,`Go to definition failed: ${e instanceof Error?e.message:`Unknown error`}`)),e.preventDefault())}}})),o}function Jd(e,t,n){let{state:r,pos:i,explicit:a}=e,o=r.doc.lineAt(i),s=fu.CompletionTriggerKind.Invoked,c,l=o.text[i-o.from-1]||``,u=t?.includes(l);return!a&&u&&(s=fu.CompletionTriggerKind.TriggerCharacter,c=l),!a&&s===fu.CompletionTriggerKind.Invoked&&!e.matchBefore(n||/(\w+|\w+\.|\/|,)$/)?null:{triggerKind:s,triggerCharacter:c}}function Yd(e,t,n){if(!e)return null;for(let r of n){let n=e.indexOf(r);if(n!==-1)return{triggerPos:t+n+1,triggerCharacter:r}}return null}function Xd(e){let t=0;for(let n of e)n===`(`?t++:n===`)`&&t--;return t}function Zd(e,t,n=Hd){let r=e.lineAt(t),i=Math.max(1,r.number-n),a=e.line(i).from;return Xd(e.sliceString(a,t))>0}function Qd(e,t,n={}){let{preserveCursor:r=!0,effects:i,userEvent:a}=n,o=e.state.doc;if(o.toString()!==t){if(r&&e.hasFocus){let n=e.state.selection.main.head,r=o.lineAt(n),s=r.number,c=n-r.from,l=e.state.update({changes:{from:0,to:o.length,insert:t}}).state.doc,u;if(s<=l.lines){let e=l.line(s),t=e.length;u=e.from+Math.min(c,t)}else u=l.line(l.lines).to;e.dispatch({changes:{from:0,to:o.length,insert:t},annotations:Vd.of(!0),selection:{anchor:u},effects:i,userEvent:a})}else e.dispatch({changes:{from:0,to:o.length,insert:t},effects:i,userEvent:a})}}function $d(){return bn.define({combine:e=>e.find(e=>e!==void 0)})}var ef=$d(),tf=$d(),nf=$d(),rf=$d(),af=$d();function of({cellId:e,completionConfig:t,hotkeys:n,placeholderType:r,lspConfig:i,diagnosticsConfig:a}){return[rf.of(e),ef.of(t),tf.of(n),nf.of(r),af.of({...i,diagnostics:a})]}var sf=new On;function cf(e){return e===`application/vnd.marimo+error`}function lf(e){return e===`application/vnd.marimo+traceback`}function uf(e){return cf(e)||lf(e)}function df(e){return Object.values(e.cellRuntime).some(e=>e.status===`running`)}function ff(e){return Object.values(e.cellRuntime).filter(e=>e.status===`running`||e.status===`queued`).length}function pf(e){return xf(e).length>0}function mf(e){return e.cellIds.inOrderIds.map(t=>e.cellData[t])}function hf({cellHandles:e}){let t={};for(let[n,r]of z.entries(e))r.current?.editorView&&(t[n]=r.current.editorView);return t}function gf(e){let{cellIds:t,cellData:n}=e,r=[];for(let e of t.inOrderIds)n[e].config.disabled&&r.push(e);return r}function _f(e){let{cellIds:t,cellData:n}=e,r=[];for(let e of t.inOrderIds)n[e].config.disabled||r.push(e);return r}function vf(e){return e.history.length>0}function yf(e){let t=e.history[e.history.length-1];return t&&t.type===`move`?`Undo move`:`Undo cell deletion`}function bf(e,t){let n=e.cellIds.findWithId(t).getDescendants(t);return{stale:n.some(t=>e.cellRuntime[t]?.staleInputs||e.cellData[t]?.edited),errored:n.some(t=>e.cellRuntime[t]?.errored),runningOrQueued:n.some(t=>e.cellRuntime[t]?.status===`running`||e.cellRuntime[t]?.status===`queued`)}}function xf(e){let{cellIds:t,cellData:n,cellRuntime:r}=e;return t.inOrderIds.filter(e=>Sf({executionTime:r[e].runElapsedTimeMs??n[e].lastExecutionTime,status:r[e].status,errored:r[e].errored,interrupted:r[e].interrupted,stopped:r[e].stopped})||n[e].edited||r[e].interrupted||r[e].staleInputs&&!(r[e].status===`disabled-transitively`||n[e].config.disabled))}function Sf({executionTime:e,status:t,errored:n,interrupted:r,stopped:i}){return e===null&&t!==`queued`&&t!==`running`&&!(n||r||i)}function Cf({edited:e,interrupted:t,staleInputs:n,disabled:r,status:i}){return e||t||n&&!(r||i===`disabled-transitively`)}function wf({needsRun:e,errored:t,stopped:n,disabled:r,status:i}){return{"needs-run":e,"has-error":t,stopped:n,disabled:r??!1,stale:i===`disabled-transitively`}}function Tf({errored:e,stopped:t}){return{published:!0,"has-error":e,stopped:t}}function Ef({errored:e,interrupted:t,stopped:n,output:r,showErrorTracebacks:i}){let a=uf(r?.mimetype),o=i&&a&&Array.isArray(r?.data)&&r.data.some(e=>e.type===`exception`&&`traceback`in e&&e.traceback);return(e||t||n||a)&&!o}var Df=bn.define({combine:e=>e[0]}),Of=bn.define({combine:e=>e[0]}),kf={...Xr,caseInsensitiveIdentifiers:!0,identifierQuotes:"`"},Af=Qr.define(kf),jf=Qr.define({doubleQuotedStrings:!1,hashComments:!1,spaceAfterDashes:!1,identifierQuotes:`"`,caseInsensitiveIdentifiers:!0,keywords:`abs access acos aes_decrypt aggregate all allocate allow alter analyze and any approx_count_distinct approx_percentile are array array_avg array_cat array_compact array_contains array_generate_range array_max array_max_cardinality array_min array_position array_remove array_remove_at array_size array_sum array_to_string arrow as ascii asensitive asin assign asymmetric at atan atan2 atomic authorization auto avg avoid base64 batch begin begin_frame begin_partition between bigint bin bin_pack binary binary_string bit bit_and bit_length bit_or bitwise_and bitwise_not bitwise_or bitwise_xor blob bool_and bool_or boolean both branch bround btrim by cache call called cardinality cascaded case cast catalog cbrt ceil ceiling change char char_length character character_length check chr classifier clob close cloud coalesce col_like collate collect column columns commit commits_older_than compute concat concat_ws condition connect constraint contains convert convert_from convert_replaceutf8 convert_timezone convert_to copy corr corresponding cos cosh cot count covar_pop covar_samp crc32 create cross cube cume_dist current current_catalog current_date current_date_utc current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cycle data databases datasets date date_add date_diff date_format date_part date_sub date_trunc datediff datetype day dayofmonth dayofweek dayofyear deallocate dec decimal declare dedupe_lookback_period default define degrees delete dense_rank deref describe deterministic dimensions disallow disconnect display distinct double drop dynamic e each element else empty empty_as_null encode end end-exec end_frame end_partition ends_with engine equals escape escape_char every except exec execute exists exp expire explain extend external extract factorial false fetch field field_delimiter file_format files filter first_value flatten float floor folder for foreign frame_row free from from_hex full function fusion geo_beyond geo_distance geo_nearby get global grant grants greatest group grouping groups hash hash64 having hex history hold hour identity if ilike imindir import in include indicator initcap initial inner inout insensitive insert instr int integer intersect intersection interval into is is_bigint is_int is_member is_substr is_utf8 is_varchar isdate isnumeric job join json_array json_arrayagg json_exists json_object json_objectagg json_query json_value lag language large last_day last_query_id last_value lateral lazy lcase lead leading least left length levenshtein like like_regex limit listagg ln local localsort localtime localtimestamp locate log log10 logs lower lpad lshift ltrim manifests map_keys map_values mask mask_first_n mask_hash mask_last_n mask_show_first_n mask_show_last_n masking match match_number match_recognize matches max max_file_size_mb maxdir md5 measures median member merge metadata method min min_file_size_mb min_input_files mindir minus minute missing mod modifies module monitor month months_between more multiset national natural nchar nclob ndv new next next_day no none normalize normalize_string not notification_provider notification_queue_reference now nth_value ntile null null_if nullif numeric nvl occurrences_regex octet_length of offset old older_than omit on one only open operate optimize or order orphan out outer over overlaps overlay ownership parameter parse_url partition partitions pattern per percent percent_rank percentile_cont percentile_disc period permute pi pivot pmod policy portion position position_regex pow power precedes precision prepare prev primary procedure project promotion qualify quarter query query_user quote quote_char radians random range rank raw reads real record_delimiter recursive ref reference references referencing reflection reflections refresh regex regexp_col_like regexp_extract regexp_like regexp_matches regexp_replace regexp_split regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxy regr_syy release remove rename repeat repeatstr replace reset result retain_last retain_last_commits retain_last_snapshots return returns reverse revoke rewrite right role rollback rollup round route row row_number rows rpad rshift rtrim running savepoint schemas scope scroll search second seek select sensitive session_user set sha sha1 sha256 sha512 show sign similar similar_to sin sinh size skip smallint snapshot snapshots snapshots_older_than some soundex specific specifictype split_part sql sqlexception sqlstate sqlwarning sqrt st_fromgeohash st_geohash start starts_with static statistics stddev stddev_pop stddev_samp stream string_binary strpos submultiset subset substr substring substring_index substring_regex succeeds sum symmetric system system_time system_user table tables tablesample tag tan tanh target_file_size_mb tblproperties then time time_format timestamp timestamp_format timestampadd timestampdiff timestamptype timezone_hour timezone_minute tinyint to to_char to_date to_hex to_number to_time to_timestamp toascii trailing transaction_timestamp translate translate_regex translation treat trigger trim trim_array trim_space true truncate typeof ucase uescape unbase64 unhex union unique unix_timestamp unknown unnest unpivot unset update upper upsert usage use user using vacuum value value_of values var_pop var_samp varbinary varchar varying versioning view views week weekofyear when whenever where width_bucket window with within without write xor year`,types:`array bigint binary boolean char character date dec decimal double float int integer interval map numeric struct time timestamp uuid varbinary varchar variant`}),Mf=Qr.define({charSetCasts:!0,doubleQuotedStrings:!1,unquotedBitLiterals:!0,hashComments:!1,spaceAfterDashes:!1,specialVar:`@?`,identifierQuotes:`"`,caseInsensitiveIdentifiers:!0,keywords:`percentile_cont row_number rank dense_rank rank_dense percent_rank cume_dist ntile lag lead first_value last_value nth_value !__postfix !~~ !~~* % & && * ** + - ->> / // <-> << <=> <@ >> @ @> Calendar JSON TimeZone ^ ^@ abort abs absolute access access_mode acos acosh action add add_parquet_key admin after age aggregate alias all all_profiling_output allow_community_extensions allow_extensions_metadata_mismatch allow_persistent_secrets allow_unredacted_secrets allow_unsigned_extensions allowed_directories allowed_paths also alter always analyse analyze and anti any any_value apply approx_count_distinct approx_quantile approx_top_k arbitrary arg_max arg_max_null arg_min arg_min_null argmax argmin array array_agg array_aggr array_aggregate array_append array_apply array_cat array_concat array_contains array_cosine_distance array_cosine_similarity array_cross_product array_distance array_distinct array_dot_product array_extract array_filter array_grade_up array_has array_has_all array_has_any array_indexof array_inner_product array_intersect array_length array_negative_dot_product array_negative_inner_product array_pop_back array_pop_front array_position array_prepend array_push_back array_push_front array_reduce array_resize array_reverse array_reverse_sort array_select array_slice array_sort array_to_json array_to_string array_to_string_comma_default array_transform array_unique array_value array_where array_zip arrow_large_buffer_size arrow_lossless_conversion arrow_output_list_view arrow_output_version arrow_scan arrow_scan_dumb as asc ascii asin asinh asof asof_loop_join_threshold assertion assignment asymmetric at atan atan2 atanh attach attribute authorization autoinstall_extension_repository autoinstall_known_extensions autoload_known_extensions avg backward bar base64 before begin between bigint bin binary binary_as_string bit bit_and bit_count bit_length bit_or bit_position bit_xor bitstring bitstring_agg blob bool bool_and bool_or boolean both bpchar by bytea cache call called can_cast_implicitly cardinality cascade cascaded case cast cast_to_type catalog catalog_error_max_schemas cbrt ceil ceiling centuries century chain char char_length character character_length characteristics check checkpoint checkpoint_threshold chr class close cluster coalesce col_description collate collation collations column columns combine comment comments commit committed compression concat concat_ws concurrently configuration conflict connection constant_or_null constraint constraints contains content continue conversion copy copy_database corr cos cosh cost cot count count_if count_star countif covar_pop covar_samp create create_sort_key cross csv cube current current_catalog current_connection_id current_database current_date current_localtime current_localtimestamp current_query current_query_id current_role current_schema current_schemas current_setting current_transaction_id current_user currval cursor custom_extension_repository custom_profiling_settings custom_user_agent cycle damerau_levenshtein data database database_list database_size date date_add date_diff date_part date_sub date_trunc datediff datepart datesub datetime datetrunc day dayname dayofmonth dayofweek dayofyear days deallocate debug_asof_iejoin debug_checkpoint_abort debug_force_external debug_force_no_cross_product debug_skip_checkpoint_on_commit debug_verify_vector debug_window_mode dec decade decades decimal declare decode default default_block_size default_collation default_null_order default_order default_secret_storage defaults deferrable deferred definer degrees delete delimiter delimiters depends desc describe detach dictionary disable disable_checkpoint_on_shutdown disable_logging disable_object_cache disable_optimizer disable_parquet_prefetching disable_print_progress_bar disable_profile disable_profiling disable_progress_bar disable_timestamptz_casts disable_verification disable_verify_external disable_verify_fetch_row disable_verify_parallelism disable_verify_serializer disabled_compression_methods disabled_filesystems disabled_log_types disabled_optimizers discard distinct divide do document domain double drop duckdb_api duckdb_columns duckdb_constraints duckdb_databases duckdb_dependencies duckdb_extensions duckdb_external_file_cache duckdb_functions duckdb_indexes duckdb_keywords duckdb_log_contexts duckdb_logs duckdb_logs_parsed duckdb_memory duckdb_optimizers duckdb_prepared_statements duckdb_schemas duckdb_secret_types duckdb_secrets duckdb_sequences duckdb_settings duckdb_table_sample duckdb_tables duckdb_temporary_files duckdb_types duckdb_variables duckdb_views dynamic_or_filter_threshold each editdist3 element_at else enable enable_checkpoint_on_shutdown enable_external_access enable_external_file_cache enable_fsst_vectors enable_geoparquet_conversion enable_http_logging enable_http_metadata_cache enable_logging enable_macro_dependencies enable_object_cache enable_optimizer enable_print_progress_bar enable_profile enable_profiling enable_progress_bar enable_progress_bar_print enable_verification enable_view_dependencies enabled_log_types encode encoding encrypted end ends_with entropy enum enum_code enum_first enum_last enum_range enum_range_boundary epoch epoch_ms epoch_ns epoch_us equi_width_bins era error errors_as_json escape even event except exclude excluding exclusive execute exists exp explain explain_output export export_state extension extension_directory extension_versions extensions external external_threads extract factorial false family favg fdiv fetch file_search_path filter finalize first flatten float float4 float8 floor fmod following for force force_bitpacking_mode force_checkpoint force_compression foreign format formatReadableDecimalSize formatReadableSize format_bytes format_pg_type format_type forward freeze from from_base64 from_binary from_hex from_json from_json_strict fsum full function functions gamma gcd gen_random_uuid generate_series generate_subscripts generated geomean geometric_mean get_bit get_block_size get_current_time get_current_timestamp getvariable glob global grade_up grant granted greatest greatest_common_divisor group group_concat grouping grouping_id groups guid hamming handler having header hex histogram histogram_exact histogram_values hold home_directory hour hours http_logging_output http_proxy http_proxy_password http_proxy_username hugeint identity ieee_floating_point_ops if ignore ilike ilike_escape immediate immediate_transaction_mode immutable implicit import import_database in in_search_path include including increment index index_scan_max_count index_scan_percentage indexes inet_client_addr inet_client_port inet_server_addr inet_server_port inherit inherits initially inline inner inout input insensitive insert install instead instr int int1 int128 int16 int2 int32 int4 int64 int8 integer integer_division integral intersect interval into invoker is is_histogram_other_bin isfinite isinf isnan isnull isodow isolation isoyear jaccard jaro_similarity jaro_winkler_similarity join json json_array json_array_length json_contains json_deserialize_sql json_each json_execute_serialized_sql json_exists json_extract json_extract_path json_extract_path_text json_extract_string json_group_array json_group_object json_group_structure json_keys json_merge_patch json_object json_pretty json_quote json_serialize_plan json_serialize_sql json_structure json_transform json_transform_strict json_tree json_type json_valid json_value julian kahan_sum key kurtosis kurtosis_pop label lambda lambda_syntax language large last last_day late_materialization_max_rows lateral lcase lcm leading leakproof least least_common_multiple left left_grapheme len length length_grapheme level levenshtein lgamma like like_escape limit list list_aggr list_aggregate list_any_value list_append list_apply list_approx_count_distinct list_avg list_bit_and list_bit_or list_bit_xor list_bool_and list_bool_or list_cat list_concat list_contains list_cosine_distance list_cosine_similarity list_count list_distance list_distinct list_dot_product list_element list_entropy list_extract list_filter list_first list_grade_up list_has list_has_all list_has_any list_histogram list_indexof list_inner_product list_intersect list_kurtosis list_kurtosis_pop list_last list_mad list_max list_median list_min list_mode list_negative_dot_product list_negative_inner_product list_pack list_position list_prepend list_product list_reduce list_resize list_reverse list_reverse_sort list_select list_sem list_skewness list_slice list_sort list_stddev_pop list_stddev_samp list_string_agg list_sum list_transform list_unique list_value list_var_pop list_var_samp list_where list_zip listagg listen ln load local location lock lock_configuration locked log log10 log2 log_query_path logged logging_level logging_mode logging_storage logical long lower lpad ltrim macro mad make_date make_time make_timestamp make_timestamp_ns make_timestamptz map map_concat map_contains map_contains_entry map_contains_value map_entries map_extract map_extract_value map_from_entries map_keys map_to_pg_oid map_values mapping match materialized max max_by max_expression_depth max_memory max_temp_directory_size max_vacuum_tasks maxvalue md5 md5_number md5_number_lower md5_number_upper mean median memory_limit merge_join_threshold metadata_info method microsecond microseconds millennia millennium millisecond milliseconds min min_by minute minutes minvalue mismatches mod mode month monthname months move multiply name names nanosecond national natural nchar nested_loop_join_threshold new next nextafter nextval nfc_normalize no none normalized_interval not not_ilike_escape not_like_escape nothing notify notnull now nowait null null_order nullif nulls numeric nvarchar obj_description object octet_length of off offset oid oids old old_implicit_casting on only operator option options or ord order order_by_non_integer_literal ordered_aggregate_threshold ordinality others out outer over overlaps overlay overriding owned owner pandas_analyze_sample pandas_scan parallel parquet_bloom_probe parquet_file_metadata parquet_kv_metadata parquet_metadata parquet_metadata_cache parquet_scan parquet_schema parse_dirname parse_dirpath parse_duckdb_log_message parse_filename parse_path parser partial partition partitioned partitioned_write_flush_threshold partitioned_write_max_open_files passing password percent perfect_ht_threshold persistent pi pivot pivot_filter_threshold pivot_limit pivot_longer pivot_wider placing plans platform policy position positional pow power pragma pragma_collations pragma_database_size pragma_metadata_info pragma_platform pragma_show pragma_storage_info pragma_table_info pragma_user_agent pragma_version preceding precision prefer_range_joins prefetch_all_parquet_files prefix prepare prepared preserve preserve_identifier_case preserve_insertion_order primary printf prior privileges procedural procedure produce_arrow_string_view product profile_output profiling_mode profiling_output program progress_bar_time publication python_enable_replacements python_map_function python_scan_all_frames qualify quantile quantile_cont quantile_disc quarter quarters query query_table quote radians random range read read_blob read_csv read_csv_auto read_json read_json_auto read_json_objects read_json_objects_auto read_ndjson read_ndjson_auto read_ndjson_objects read_parquet read_text real reassign recheck recursive reduce ref references referencing refresh regexp_escape regexp_extract regexp_extract_all regexp_full_match regexp_matches regexp_replace regexp_split_to_array regexp_split_to_table regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release remap_struct rename repeat repeat_row repeatable replace replica reservoir_quantile reset respect restart restrict returning returns reverse revoke right right_grapheme role rollback rollup round round_even roundbankers row row_to_json rows rpad rtrim rule sample savepoint scalar_subquery_error_on_multiple_rows scheduler_process_partial schema schemas scope scroll search search_path second seconds secret secret_directory security select sem semi seq_scan sequence sequences serializable server session session_user set set_bit setof sets setseed sha1 sha256 share shobj_description short show show_databases show_tables show_tables_expanded sign signbit signed similar simple sin sinh skewness skip smallint snapshot sniff_csv some sorted split split_part sql sqrt stable standalone start starts_with statement statistics stats stddev stddev_pop stddev_samp stdin stdout storage storage_compatibility_version storage_info stored str_split str_split_regex streaming_buffer_size strftime strict string string_agg string_split string_split_regex string_to_array strip strip_accents strlen strpos strptime struct struct_concat struct_extract struct_extract_at struct_insert struct_pack subscription substr substring substring_grapheme subtract suffix sum sum_no_overflow sumkahan summarize summary symmetric sysid system table table_info tables tablesample tablespace tan tanh temp temp_directory template temporary test_all_types test_vector_types text then threads ties time time_bucket timestamp timestamp_ms timestamp_ns timestamp_s timestamp_us timestamptz timetz timetz_byte_comparable timezone timezone_hour timezone_minute tinyint to to_base to_base64 to_binary to_centuries to_days to_decades to_hex to_hours to_json to_microseconds to_millennia to_milliseconds to_minutes to_months to_quarters to_seconds to_timestamp to_weeks to_years today trailing transaction transaction_timestamp transform translate treat trigger trim true trunc truncate truncate_duckdb_logs trusted try_cast try_strptime txid_current type typeof types ubigint ucase uhugeint uint128 uint16 uint32 uint64 uint8 uinteger unbin unbounded uncommitted unencrypted unhex unicode union union_extract union_tag union_value unique unknown unlisten unlogged unnest unpack unpivot unpivot_list until update upper url_decode url_encode use user user_agent username using usmallint utinyint uuid uuid_extract_timestamp uuid_extract_version uuidv4 uuidv7 vacuum valid validate validator value values var_pop var_samp varbinary varchar variable variadic variance varint varying vector_type verbose verify_external verify_fetch_row verify_parallelism verify_serializer version view views virtual volatile wal_autocheckpoint wavg week weekday weekofyear weeks weighted_avg when where which_secret whitespace window with within without work worker_threads wrapper write write_log xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlnamespaces xmlparse xmlpi xmlroot xmlserialize xmltable xor year years yearweek yes zone zstd_min_string_length | || ~ ~~ ~~* ~~~`,types:`JSON bigint binary bit bitstring blob bool boolean bpchar bytea char date datetime dec decimal double enum float float4 float8 guid hugeint int int1 int128 int16 int2 int32 int4 int64 int8 integer integral interval list logical long map null numeric nvarchar oid real row short signed smallint string struct text time timestamp timestamp_ms timestamp_ns timestamp_s timestamp_us timestamptz timetz tinyint ubigint uhugeint uint128 uint16 uint32 uint64 uint8 uinteger union usmallint utinyint uuid varbinary varchar varint`}),Nf=new Set(`postgresql.postgres.couchbase.db2.db2i.tidb.mysql.sqlite.mssql.sqlserver.duckdb.mariadb.cassandra.noql.spark.awsathena.athena.bigquery.hive.redshift.snowflake.flink.mongodb.trino.oracle.oracledb.singlestoredb.timescaledb.databricks.datafusion.microsoft sql server.dremio`.split(`.`));function Pf(e){return Nf.has(e)}function Ff(e){let t=e.dialect;if(!Pf(t))return R.debug(`Unknown dialect`,{dialect:t}),Lf;switch(t){case`postgresql`:case`postgres`:return Xr;case`mysql`:return qr;case`sqlite`:return Wr;case`mssql`:case`sqlserver`:case`microsoft sql server`:return Yr;case`duckdb`:return Mf;case`mariadb`:return Zr;case`cassandra`:return $r;case`oracledb`:case`oracle`:return Ur;case`bigquery`:return Af;case`dremio`:return jf;case`timescaledb`:return Xr;case`awsathena`:case`athena`:case`db2i`:case`db2`:case`hive`:case`redshift`:case`snowflake`:case`flink`:case`mongodb`:case`noql`:case`couchbase`:case`trino`:case`tidb`:case`singlestoredb`:case`spark`:case`databricks`:case`datafusion`:return R.debug(`Unsupported dialect`,{dialect:t}),Lf;default:return zr(t),Lf}}var If={...Jr,caseInsensitiveIdentifiers:!0,identifierQuotes:`'`},Lf=Qr.define(If),Rf=`__marimo_duckdb`,zf=new Set([Rf]);function Bf(e,t){if(!e)return t;let n=(e.schemaPath?.length?e.schemaPath:[e.schema]).filter(Boolean);return[e.database,...n,t].join(`.`)}function Vf(e){return e===``}function Hf(e){return e.schemas_resolved!==!1}function Uf(e){return e.tables_resolved!==!1}function Wf(e){return e.child_schemas_resolved!==!1}function Gf(e,t){let n=t?.trim().toLowerCase();return n?Uf(e)&&e.tables.some(e=>e.name.toLowerCase().includes(n))?!0:Wf(e)?(e.child_schemas??[]).some(e=>Gf(e,n)):!1:!1}function Kf(e,t){return!t?.trim()||!Hf(e)?!1:e.schemas.some(e=>Gf(e,t))}var qf={formatTablePath:e=>e.join(`.`),formatSelectClause:(e,t)=>`SELECT ${e} FROM ${t} LIMIT 100`};function Jf(e){if(e=e.toLowerCase(),!Pf(e))return qf;switch(e){case`bigquery`:{let e=Af.spec.identifierQuotes;return{formatTablePath:t=>`${e}${t.join(`.`)}${e}`,formatSelectClause:qf.formatSelectClause}}case`mssql`:case`sqlserver`:case`microsoft sql server`:return{formatTablePath:qf.formatTablePath,formatSelectClause:(e,t)=>`SELECT TOP 100 ${e} FROM ${t}`};case`timescaledb`:case`postgres`:case`postgresql`:case`duckdb`:case`dremio`:return{formatTablePath:e=>e.map(e=>`"${e}"`).join(`.`),formatSelectClause:(e,t)=>`SELECT ${e===`*`?`*`:`"${e}"`} FROM ${t} LIMIT 100`};case`db2`:case`db2i`:case`mysql`:case`sqlite`:case`mariadb`:case`cassandra`:case`noql`:case`awsathena`:case`athena`:case`hive`:case`redshift`:case`snowflake`:case`flink`:case`mongodb`:case`oracle`:case`oracledb`:case`couchbase`:case`tidb`:case`spark`:case`trino`:case`singlestoredb`:case`databricks`:case`datafusion`:return qf;default:return zr(e),qf}}function Yf({table:e,columnName:t,sqlTableContext:n}){if(n){let{engine:r,schema:i,defaultSchema:a,defaultDatabase:o,database:s,dialect:c}=n,l=[e.name];Vf(i)||i!==a&&l.unshift(i),s!==o&&l.unshift(s);let u=Jf(c),d=u.formatTablePath(l),f=u.formatSelectClause(t,d);return r===`__marimo_duckdb`?`_df = mo.sql(f"""\n${f}\n""")`:`_df = mo.sql(f"""\n${f}\n""", engine=${r})`}return`_df = mo.sql(f'SELECT "${t}" FROM ${e.name} LIMIT 100')`}function Xf(e,t){if(t===`date`||t===`datetime`||t===`time`){if(e===`min`)return`Earliest`;if(e===`max`)return`Latest`}return e}function Zf(){return{tables:[],expandedTables:new Set,expandedColumns:new Set,columnsPreviews:new Map}}var{reducer:Qf,createActions:$f,valueAtom:ep,useActions:tp}=jr(Zf,{addDatasets:(e,t)=>{let{previewDatasetColumn:n}=Hr();for(let r of t.tables)for(let t of r.columns){let i=`${r.name}:${t.name}`;e.expandedColumns.has(i)&&n({tableName:r.name,columnName:t.name,source:r.source,sourceType:r.source_type})}let r=e.tables;t.clear_channel&&(r=r.filter(e=>e.source!==t.clear_channel));let i=[...t.tables,...r],a=new Set,o=i.filter(e=>{let t=`${e.name}:${e.source}`;return!a.has(t)&&(a.add(t),!0)}).toSorted((e,t)=>e.name.localeCompare(t.name));return{...e,tables:o}},filterDatasetsFromVariables:(e,t)=>{let n=new Set(t),r=e.tables.filter(e=>!e.variable_name||n.has(e.variable_name));return{...e,tables:r}},toggleTable:(e,t)=>{let n=new Set(e.expandedTables);return n.has(t)?n.delete(t):n.add(t),{...e,expandedTables:n}},toggleColumn:(e,t)=>{let n=`${t.table}:${t.column}`,r=new Set(e.expandedColumns);return r.has(n)?r.delete(n):r.add(n),{...e,expandedColumns:r}},closeAllColumns:e=>({...e,expandedColumns:new Set}),addColumnPreview:(e,t)=>{let n=`${t.table_name}:${t.column_name}`,r=new Map(e.columnsPreviews);return r.set(n,t),{...e,columnsPreviews:r}}}),np=()=>s(ep),rp=o(e=>e(ep).tables),ip=o(new Set),ap=o(!1);function op(){return tp()}var sp=new Map([[Rf,{name:Rf,dialect:`duckdb`,source:`duckdb`,display_name:`DuckDB (In-Memory)`,databases:[]}]]);function cp(e,t,n){if(t.length===0)return e;let[r,...i]=t;return e.map(e=>e.name===r?i.length===0?n(e):{...e,child_schemas:cp(e.child_schemas??[],i,n)}:e)}function lp(e){let{schemaPath:t,schema:n}=e;return t&&t.length>0?t:[n]}function up(){return{latestEngineSelected:null,connectionsMap:sp}}var{reducer:dp,createActions:fp,valueAtom:pp,useActions:mp}=jr(up,{addDataSourceConnection:(e,t)=>{if(t.connections.length===0)return e;let{latestEngineSelected:n,connectionsMap:r}=e,i=new Map(r);for(let e of t.connections)i.delete(e.name),i.set(e.name,e);return{latestEngineSelected:n,connectionsMap:i}},filterDataSourcesFromVariables:(e,t)=>{let{latestEngineSelected:n,connectionsMap:r}=e,i=new Set(t),a=new Map([...r].filter(([e])=>zf.has(e)?!0:i.has(e)));return{latestEngineSelected:n&&a.has(n)?n:null,connectionsMap:a}},clearDataSourceConnections:()=>({latestEngineSelected:null,connectionsMap:new Map}),removeDataSourceConnection:(e,t)=>{let{latestEngineSelected:n,connectionsMap:r}=e,i=new Map(r);return i.delete(t),{latestEngineSelected:n&&i.has(n)?n:null,connectionsMap:i}},addSchemaList:(e,t)=>{let{schemas:n,sqlSchemaContext:r}=t,{connectionsMap:i,latestEngineSelected:a}=e,o=r.engine,s=i.get(o);if(!s)return e;let c=r.schemaPath??[],l=new Map(i),u={...s,databases:s.databases.map(e=>e.name===r.database?c.length===0?{...e,schemas:n,schemas_resolved:!0}:{...e,schemas:cp(e.schemas,c,e=>({...e,child_schemas:n,child_schemas_resolved:!0}))}:e)};return l.set(o,u),{latestEngineSelected:a,connectionsMap:l}},addTableList:(e,t)=>{let{tables:n,sqlTableContext:r}=t,{connectionsMap:i,latestEngineSelected:a}=e,o=r.engine,s=i.get(o);if(!s)return e;let c=lp(r),l=new Map(i),u={...s,databases:s.databases.map(e=>e.name===r.database?{...e,schemas:cp(e.schemas,c,e=>({...e,tables:n,tables_resolved:!0}))}:e)};return l.set(o,u),{latestEngineSelected:a,connectionsMap:l}},addTable:(e,t)=>{let{table:n,sqlTableContext:r}=t,{connectionsMap:i,latestEngineSelected:a}=e,o=r.engine,s=n.name,c=i.get(o);if(!c)return e;let l=lp(r),u=new Map(i),d={...c,databases:c.databases.map(e=>e.name===r.database?{...e,schemas:cp(e.schemas,l,e=>{let t=e.tables.length===0?[n]:e.tables.map(e=>e.name===s?n:e);return{...e,tables:t}})}:e)};return u.set(o,d),{latestEngineSelected:a,connectionsMap:u}}}),hp=o(e=>e(pp).connectionsMap),gp=o(e=>{let t=new Map(e(hp));for(let e of zf){let n=t.get(e);n&&(n.databases.length===0&&t.delete(e),n.databases.length===1&&n.databases[0].name===`memory`&&n.databases[0].schemas.length===0&&t.delete(e))}return wr([...t.values()],e=>+!!zf.has(e.name))});function _p(e){let t=u.get(pp);t.connectionsMap.has(e)&&u.set(pp,{...t,latestEngineSelected:e})}var vp=o(e=>{let t=u.get(rp),n=e(pp).connectionsMap,r=new Map;for(let e of t)r.set(e.name,e);for(let e of n.values())for(let t of e.databases){let n=t.name===e.default_database||e.databases.length===1,i=(a,o)=>{let s=o.length===0,c=o.length===1&&o[0]===e.default_schema,l=o.join(`.`);for(let e of a.tables){let i;if(i=e.name,s){i=n?e.name:`${t.name}.${e.name}`,r.has(i)?R.warn(`Table name collision for ${i}. Skipping.`):r.set(i,e);continue}if(n&&c&&!r.has(i)){r.set(i,e);continue}if(i=`${l}.${e.name}`,n&&!r.has(i)){r.set(i,e);continue}i=`${t.name}.${l}.${e.name}`,r.has(i)?R.warn(`Table name collision for ${i}. Skipping.`):r.set(i,e)}for(let e of a.child_schemas??[])i(e,[...o,e.name])};for(let e of t.schemas)i(e,Vf(e.name)?[]:[e.name])}return r});function yp(e){return e.variable_name?`dataframe`:`table`}var bp=class{maxSize;cache=new Map;options;constructor(e,t={}){this.maxSize=e,this.options=t}getOrCreate(e){B(this.options.create,`create function is required`);let t=this.cache.get(e);if(t!==void 0)return t;let n=this.options.create(e);return this.cache.set(e,n),n}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e)&&this.cache.delete(e),this.cache.set(e,t),this.cache.size>this.maxSize){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}}keys(){return this.cache.keys()}values(){return this.cache.values()}entries(){return this.cache.entries()}delete(e){this.cache.delete(e)}};function xp(e){switch(e){case`duckdb`:return`DuckDB`;case`motherduck`:return`MotherDuck`;case`sqlite`:return`SQLite`;case`postgres`:case`postgresql`:return`PostgreSQL`;case`mysql`:return`MySQL`;case`mariadb`:return`MariaDB`;case`mssql`:case`microsoft sql server`:return`Microsoft SQL Server`;case`oracle`:return`Oracle`;case`redshift`:return`Amazon Redshift`;case`snowflake`:return`Snowflake`;case`bigquery`:return`Google BigQuery`;case`clickhouse`:return`ClickHouse`;case`timeplus`:return`Timeplus`;case`databricks`:return`Databricks`;case`db2`:return`IBM Db2`;case`hive`:return`Apache Hive`;case`impala`:return`Apache Impala`;case`presto`:return`Presto`;case`trino`:return`Trino`;case`cockroachdb`:return`CockroachDB`;case`timescaledb`:return`TimescaleDB`;case`singlestore`:return`SingleStore`;case`cassandra`:return`Apache Cassandra`;case`mongodb`:return`MongoDB`;case`iceberg`:return`Apache Iceberg`;case`dremio`:return`Dremio`;default:return e}}function Sp(e){let[t,n]=e.split(` `);return n?`${xp(t)} ${n}`:xp(e)}var Cp={boolean:U,date:At,time:Do,datetime:Co,temporal:Co,number:kt,string:jt,integer:kt,geometry:Fo,unknown:So};function wp(e){return Object.hasOwn(Cp,e)?e:`unknown`}function Tp(e){switch(e){case`boolean`:return`bg-(--orange-4)`;case`date`:case`time`:case`datetime`:case`temporal`:return`bg-(--grass-4) dark:bg-(--grass-5)`;case`number`:case`integer`:return`bg-(--purple-4)`;case`string`:return`bg-(--blue-4)`;case`geometry`:return`bg-(--cyan-4) dark:bg-(--cyan-5)`;case`unknown`:return`bg-(--slate-4) dark:bg-(--slate-6)`;default:return zr(e),`bg-(--slate-4) dark:bg-(--slate-6)`}}var Ep=class{singular;_plural;constructor(e,t){this.singular=e,this._plural=t}pluralize(e){return e===1?this.singular:this.plural}get plural(){return this._plural??`${this.singular}s`}},Dp=class e{words;constructor(e){this.words=e}static of(...t){return new e(t.map(e=>typeof e==`string`?new Ep(e):e))}join(e,t){return this.words.map(e=>e.pluralize(t)).join(e)}},X=te(),Op=5,kp={boolean:`bg-(--orange-4) text-(--orange-11)`,date:`bg-(--grass-4) text-(--grass-11)`,time:`bg-(--grass-4) text-(--grass-11)`,datetime:`bg-(--grass-4) text-(--grass-11)`,number:`bg-(--purple-4) text-(--purple-11)`,integer:`bg-(--purple-4) text-(--purple-11)`,string:`bg-(--blue-4) text-(--blue-11)`,geometry:`bg-(--cyan-4) text-(--cyan-11)`,unknown:`bg-(--slate-4) text-(--slate-11)`},Ap={local:`bg-(--blue-4) text-(--blue-11)`,duckdb:`bg-(--amber-4) text-(--amber-11)`,connection:`bg-(--green-4) text-(--green-11)`,catalog:`bg-(--purple-4) text-(--purple-11)`},jp=`p-3 min-w-[250px] flex flex-col divide-y`,Mp=new Ep(`column`,`columns`),Np=new Ep(`row`,`rows`),Pp=new Ep(`schema`,`schemas`),Fp=new Ep(`table`,`tables`),Ip=new Ep(`database`,`databases`),Lp=e=>{let t=(0,X.c)(6),{icon:n,title:r,badge:i}=e,a;t[0]===r?a=t[1]:(a=(0,q.jsx)(`h3`,{className:`font-semibold text-sm`,children:r}),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==n||t[4]!==a?(o=(0,q.jsxs)(`div`,{className:`flex items-center gap-2 pb-2`,children:[n,a,i]}),t[2]=i,t[3]=n,t[4]=a,t[5]=o):o=t[5],o},Rp=e=>{let t=(0,X.c)(5),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,q.jsxs)(`span`,{className:`text-(--slate-11)`,children:[n,`:`]}),t[0]=n,t[1]=i);let a;return t[2]!==i||t[3]!==r?(a=(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[i,r]}),t[2]=i,t[3]=r,t[4]=a):a=t[4],a},zp=e=>{let t=(0,X.c)(5),{icon:n,text:r}=e,i;t[0]===r?i=t[1]:(i=(0,q.jsx)(`span`,{className:`text-xs text-(--slate-11)`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},Bp=e=>{let t=(0,X.c)(15),{title:n,items:r,totalCount:i,limit:a}=e,o=n===void 0?``:n,s=a===void 0?Op:a;if(r.length===0)return null;let c;t[0]!==r||t[1]!==s?(c=r.slice(0,s),t[0]=r,t[1]=s,t[2]=c):c=t[2];let l=c,u=i>s,d;t[3]===o?d=t[4]:(d=o&&(0,q.jsxs)(`h4`,{className:`text-xs font-medium text-(--slate-11) mb-2`,children:[o,`:`]}),t[3]=o,t[4]=d);let f;t[5]!==u||t[6]!==s||t[7]!==i?(f=u&&(0,q.jsxs)(`div`,{className:`text-xs text-(--slate-10) text-center py-1`,children:[`... and `,i-s,` more`]}),t[5]=u,t[6]=s,t[7]=i,t[8]=f):f=t[8];let p;t[9]!==f||t[10]!==l?(p=(0,q.jsxs)(`div`,{className:`flex flex-col gap-1 overflow-y-auto`,children:[l,f]}),t[9]=f,t[10]=l,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==p?(m=(0,q.jsxs)(`div`,{className:`py-2`,children:[d,p]}),t[12]=d,t[13]=p,t[14]=m):m=t[14],m},Vp=e=>kp[e]||kp.unknown,Hp=e=>{let t=e.type===`view`?(0,q.jsx)(Ao,{className:`w-4 h-4 text-(--blue-9)`}):(0,q.jsx)(Ko,{className:`w-4 h-4 text-(--green-9)`}),n=(0,q.jsx)(ti,{variant:`secondary`,className:`text-xs ${e.type===`view`?`bg-(--blue-4) text-(--blue-11)`:`bg-(--green-4) text-(--green-11)`}`,children:e.type}),r=e.columns.map(e=>{let t=Cp[wp(e.type)];return(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs rounded`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(t,{className:`w-3 h-3 text-(--slate-9)`}),(0,q.jsx)(`span`,{className:`font-mono`,children:e.name})]}),(0,q.jsx)(ti,{variant:`outline`,className:`text-xs ${Vp(e.type)}`,children:e.type})]},e.name)}),i=e.primary_keys&&e.primary_keys.length>0,a=e.indexes&&e.indexes.length>0;return(0,q.jsxs)(`div`,{className:`${jp} min-w-[300px]`,children:[(0,q.jsx)(Lp,{icon:t,title:e.name,badge:n}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,q.jsx)(Rp,{label:`Source`,value:(0,q.jsx)(ti,{variant:`outline`,className:`text-xs ${Ap[e.source_type]}`,children:e.source})}),e.variable_name&&(0,q.jsx)(Rp,{label:`Variable`,value:(0,q.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.variable_name})}),e.engine&&(0,q.jsx)(Rp,{label:`Engine`,value:(0,q.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.engine})})]}),(e.num_columns!=null||e.num_rows!=null)&&(0,q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 py-2`,children:[e.num_columns!=null&&(0,q.jsx)(zp,{icon:(0,q.jsx)(ko,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.num_columns} ${Mp.pluralize(e.num_columns)}`}),e.num_rows!=null&&(0,q.jsx)(zp,{icon:(0,q.jsx)(kt,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.num_rows} ${Np.pluralize(e.num_rows)}`})]}),e.columns.length===0&&Xp(`column`),(i||a)&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[i&&(0,q.jsxs)(`div`,{className:`flex flex-row gap-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Bt,{className:`w-3 h-3 text-(--amber-9)`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-(--slate-11)`,children:`Primary Keys:`})]}),e.primary_keys?.map(e=>(0,q.jsx)(ti,{variant:`outline`,className:`text-xs text-(--slate-11)`,children:e},e))]}),a&&(0,q.jsxs)(`div`,{className:`flex flex-row gap-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1 mb-1`,children:[(0,q.jsx)(wt,{className:`w-3 h-3 text-(--purple-9)`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-(--slate-11)`,children:`Indexes:`})]}),e.indexes?.map(e=>(0,q.jsx)(ti,{variant:`outline`,className:`text-xs text-(--slate-11)`,children:e},e))]})]}),e.columns.length>0&&(0,q.jsx)(Bp,{items:r,totalCount:e.columns.length})]})},Up=e=>{let t=Cp[wp(e.type)],n=(0,q.jsx)(ti,{variant:`outline`,className:`text-xs ${Vp(e.type)}`,children:e.type}),r=e.sample_values?.map((e,t)=>(0,q.jsx)(`div`,{className:`text-xs bg-(--slate-3) rounded font-mono`,children:e==null?`null`:String(e)},t))||[];return(0,q.jsxs)(`div`,{className:jp,children:[(0,q.jsx)(Lp,{icon:(0,q.jsx)(t,{className:`w-4 h-4 text-(--slate-9)`}),title:e.name,badge:n}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 mt-2`,children:[(0,q.jsx)(Rp,{label:`Type`,value:(0,q.jsx)(`span`,{className:`font-medium`,children:e.type})}),(0,q.jsx)(Rp,{label:`External Type`,value:(0,q.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.external_type})})]}),e.sample_values&&e.sample_values.length>0&&(0,q.jsx)(Bp,{title:`Sample Values`,items:r,totalCount:e.sample_values.length})]})},Wp=e=>{let t=(0,q.jsx)(ti,{variant:`outline`,className:`text-xs bg-(--blue-4) text-(--blue-11)`,children:e.dialect}),n=e.schemas.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs rounded hover:bg-(--slate-3)`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Po,{className:`w-3 h-3 text-(--slate-9)`}),(0,q.jsx)(`span`,{children:e.name})]}),(0,q.jsxs)(ti,{variant:`outline`,className:`text-xs`,children:[e.tables.length,` `,Fp.pluralize(e.tables.length)]})]},e.name));return(0,q.jsxs)(`div`,{className:jp,children:[(0,q.jsx)(Lp,{icon:(0,q.jsx)(Tt,{className:`w-4 h-4 text-(--blue-9)`}),title:e.name,badge:t}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,q.jsx)(Rp,{label:`Dialect`,value:(0,q.jsx)(`span`,{className:`font-medium`,children:e.dialect})}),e.engine&&(0,q.jsx)(Rp,{label:`Engine`,value:(0,q.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.engine})})]}),(0,q.jsx)(`div`,{className:`py-2`,children:(0,q.jsx)(zp,{icon:(0,q.jsx)(Po,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.schemas.length} schema${e.schemas.length===1?``:`s`}`})}),e.schemas.length===0&&Xp(`schema`),e.schemas.length>0&&(0,q.jsx)(Bp,{title:`Schemas`,items:n,totalCount:e.schemas.length})]})},Gp=e=>{let t=(0,q.jsx)(ti,{variant:`outline`,className:`text-xs bg-(--green-4) text-(--green-11)`,children:`Schema`}),n=e.tables.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs rounded hover:bg-(--slate-3)`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type===`view`?(0,q.jsx)(Ao,{className:`w-3 h-3 text-(--blue-9)`}):(0,q.jsx)(Ko,{className:`w-3 h-3 text-(--green-9)`}),(0,q.jsx)(`span`,{children:e.name})]}),(0,q.jsx)(ti,{variant:`outline`,className:`text-xs ${e.type===`view`?`bg-(--blue-4) text-(--blue-11)`:`bg-(--green-4) text-(--green-11)`}`,children:e.type})]},e.name));return(0,q.jsxs)(`div`,{className:jp,children:[(0,q.jsx)(Lp,{icon:(0,q.jsx)(Po,{className:`w-4 h-4 text-(--green-9)`}),title:e.name,badge:t}),(0,q.jsx)(`div`,{className:`py-2`,children:(0,q.jsx)(zp,{icon:(0,q.jsx)(Ko,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.tables.length} table${e.tables.length===1?``:`s`}`})}),e.tables.length===0&&Xp(`table`),e.tables.length>0&&(0,q.jsx)(Bp,{title:`Tables`,items:n,totalCount:e.tables.length})]})},Kp=(0,q.jsx)(ti,{variant:`outline`,children:`default`}),qp=8,Jp=3,Yp=(e,t)=>{let n=e.databases.length,r=e.databases.reduce((e,t)=>e+t.schemas.length,0),i=(t,n)=>{if(t.tables.length===0)return null;let i=t.name===e.default_schema&&n,a=[];return r<qp&&(a=t.tables.slice(0,4).map(e=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,q.jsx)(Ko,{className:`w-3 h-3 text-(--green-9)`}),(0,q.jsx)(`span`,{className:`text-xs`,children:e.name})]},e.name))),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs rounded hover:bg-(--slate-3) ml-2`,children:[(0,q.jsx)(Po,{className:`w-3 h-3 text-(--slate-9)`}),(0,q.jsx)(`span`,{children:t.name}),i&&Kp,(0,q.jsxs)(ti,{variant:`outline`,className:`text-xs ml-auto`,children:[t.tables.length,` tables`]})]}),(0,q.jsx)(Bp,{items:a,totalCount:t.tables.length,limit:Jp})]},t.name)},a=e.databases.map(t=>{let n=t.name===e.default_database||e.databases.length===1,r=t.schemas.map(e=>i(e,n));return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Tt,{className:`w-3 h-3 text-(--blue-9)`}),(0,q.jsx)(`span`,{className:`text-xs`,children:t.name}),n&&Kp]}),r&&(0,q.jsx)(Bp,{items:r,totalCount:t.schemas.length})]},t.name)}),o=e.name;zf.has(e.name)&&(o=`In-Memory`);let s=t?.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Ko,{className:`w-3 h-3 text-(--blue-9)`}),(0,q.jsx)(`span`,{className:`text-xs`,children:e.name})]},e.name));return(0,q.jsxs)(`div`,{className:`${jp} px-1`,children:[(0,q.jsx)(Lp,{icon:(0,q.jsx)(Oo,{className:`w-4 h-4 text-(--purple-9)`}),title:o}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,q.jsx)(Rp,{label:`Dialect`,value:(0,q.jsx)(`span`,{className:`font-medium`,children:xp(e.dialect)})}),(0,q.jsx)(Rp,{label:`Source`,value:(0,q.jsx)(ti,{variant:`outline`,className:`text-xs bg-(--green-4) text-(--green-11)`,children:e.source})})]}),(0,q.jsxs)(`div`,{className:`flex flex-row justify-between py-2`,children:[(0,q.jsx)(zp,{icon:(0,q.jsx)(Tt,{className:`w-3 h-3 text-(--slate-9)`}),text:`${n} ${Ip.pluralize(n)}`}),(0,q.jsx)(zp,{icon:(0,q.jsx)(Po,{className:`w-3 h-3 text-(--slate-9)`}),text:`${r} ${Pp.pluralize(r)}`})]}),n>0&&(0,q.jsx)(Bp,{items:a,totalCount:n}),s&&s.length>0&&(0,q.jsx)(Bp,{title:`Dataframes`,items:s,totalCount:s.length})]})},Xp=e=>(0,q.jsxs)(`div`,{className:`flex items-start gap-2 mt-3`,children:[(0,q.jsx)(Mo,{size:10,className:`mt-1 text-(--slate-10) shrink-0`}),(0,q.jsxs)(`span`,{className:`text-xs text-(--slate-11)`,children:[`No `,e,` information available.`,`
35
- `,(0,q.jsx)(`span`,{className:`text-(--blue-10)`,children:`Introspect to see more details.`})]})]}),Zp=e(_i(),1),Qp=class{schema={};addTable(e,t){let n={self:em({table:t}),children:t.columns.map(e=>$p({column:e}))};return this.setAt([...e,t.name],n),this}addSchema(e,t){let n={self:tm({namespace:t,path:e}),children:{}};return this.setAt(e,n),this}addDatabase(e,t){let n={self:nm({namespace:t,path:e}),children:{}};return this.setAt(e,n),this}setAt(e,t){let n=this.schema;for(let t of e.slice(0,-1))n[t]||(n[t]={children:{}}),n=n[t].children;n[e[e.length-1]]=t}build(){return this.schema}reset(){return this.schema={},this}};function $p(e){return{label:e.column.name,type:`column`,info:()=>{let t=document.createElement(`div`);return(0,Zp.createRoot)(t).render(Up(e.column)),{dom:t}}}}function em(e){return{label:e.table.name,type:`table`,info:()=>{let t=document.createElement(`div`);return(0,Zp.createRoot)(t).render(Hp(e.table)),{dom:t}}}}function tm(e){return{label:e.namespace.name,detail:e.path.join(`.`),type:`schema`,info:()=>{let t=document.createElement(`div`);return(0,Zp.createRoot)(t).render(Gp(e.namespace)),{dom:t}}}}function nm(e){return{label:e.namespace.name,detail:e.path.join(`.`),type:`database`,info:()=>{let t=document.createElement(`div`);return(0,Zp.createRoot)(t).render(Wp(e.namespace)),{dom:t}}}}var rm=o(e=>{let t=e(rp),n=new Qp;for(let e of t)n.addTable([],e);return n.build()}),im=class{cache;constructor(){this.cache=new bp(10,{create:e=>this.getConnectionSchema(e)})}getConnection(e){return u.get(hp).get(e)}getConnectionSchema(e){let{default_database:t,databases:n,default_schema:r}=e,i=new Qp,a=n.find(e=>e.name===t||n.length===1);if((a??n[0])?.schemas.some(e=>Vf(e.name))??!1){for(let e of n){let t=e.name===a?.name,n=e.schemas.flatMap(e=>e.tables);i.addDatabase([e.name],e);for(let r of n)t?i.addTable([],r):i.addTable([e.name],r)}return{shouldAddLocalTables:!1,schema:i.build(),defaultSchema:a?.name}}if(a)for(let e of a.schemas){i.addSchema([e.name],e);for(let t of e.tables)i.addTable([e.name],t)}for(let e of n){i.addDatabase([e.name],e);for(let t of e.schemas){i.addSchema([e.name,t.name],t);for(let n of t.tables)i.addTable([e.name,t.name],n)}}return{shouldAddLocalTables:!0,schema:i.build(),defaultSchema:r??(a?.schemas.length===1?a.schemas[0]?.name:void 0)}}getInternalDialect(e){let t=this.getConnection(e);return t?t.dialect.toLowerCase():null}getDialect(e){let t=this.getConnection(e);return t?Ff(t):Lf}getCompletionSource(e){let t=this.getConnection(e);if(!t)return null;let n=()=>u.get(rm),r=this.cache.getOrCreate(t);return{dialect:Ff(t),schema:r.shouldAddLocalTables?{...r.schema,...n()}:r.schema,defaultSchema:r.defaultSchema,defaultTable:am(t)}}};function am(e){if(e.databases.length!==1)return;let t=e.databases[0];if(t.schemas.length!==1)return;let n=t.schemas[0];if(n.tables.length===1)return n.tables[0].name}var om=new im,sm=Cn.define();async function cm(e){let{sendFormat:t}=Hr(),n=z.mapValues(e,e=>OA(e)),r=await t({codes:n,lineLength:ie().formatting.line_length});for(let[t,i]of z.entries(r.codes)){let r=t,a=n[r],o=e[r];o&&i!==a&&(o.state.facet(Df).updateCellCode({cellId:r,code:i,formattingChange:!0}),kA(o,i))}}function lm(){return cm(hf(WM()))}async function um(e,t){let{formatDialect:n}=await W(async()=>{let{formatDialect:e}=await import(`./esm-D-owkyO9.js`);return{formatDialect:e}},__vite__mapDeps([0,1]),import.meta.url),r=await dm(om.getInternalDialect(t)),i=e.state.field(bA),a=ln(e.state);if(i.type!==`sql`){R.error(`Language adapter is not SQL`);return}let o=e.state.doc.toString(),s;try{s=n(o,{dialect:r,tabWidth:a,useTabs:!1})}catch(e){R.error(`Error formatting SQL`,{error:e});return}let c=i.transformIn(s)[0],l=e.state.facet(Df),u=e.state.facet(rf);l.updateCellCode({cellId:u,code:c,formattingChange:!0}),Qd(e,s,{effects:[sm.of(!0)]})}async function dm(e){let{bigquery:t,db2:n,db2i:r,duckdb:i,hive:a,mariadb:o,mysql:s,tidb:c,n1ql:l,plsql:u,postgresql:d,redshift:f,spark:p,sqlite:m,sql:h,trino:g,transactsql:_,singlestoredb:v,snowflake:y}=await W(async()=>{let{bigquery:e,db2:t,db2i:n,duckdb:r,hive:i,mariadb:a,mysql:o,tidb:s,n1ql:c,plsql:l,postgresql:u,redshift:d,spark:f,sqlite:p,sql:m,trino:h,transactsql:g,singlestoredb:_,snowflake:v}=await import(`./esm-D-owkyO9.js`);return{bigquery:e,db2:t,db2i:n,duckdb:r,hive:i,mariadb:a,mysql:o,tidb:s,n1ql:c,plsql:l,postgresql:u,redshift:d,spark:f,sqlite:p,sql:m,trino:h,transactsql:g,singlestoredb:_,snowflake:v}},__vite__mapDeps([0,1]),import.meta.url),b=h;if(!e||!Pf(e))return b;switch(e){case`mysql`:return s;case`mariadb`:return o;case`postgres`:case`postgresql`:return d;case`sqlite`:return m;case`db2`:return n;case`db2i`:return r;case`hive`:return a;case`redshift`:return f;case`snowflake`:return y;case`trino`:return g;case`tidb`:return c;case`oracle`:case`oracledb`:return u;case`spark`:return p;case`singlestoredb`:return v;case`couchbase`:return l;case`bigquery`:return t;case`duckdb`:return i;case`mssql`:case`sqlserver`:case`microsoft sql server`:return _;case`athena`:case`awsathena`:case`cassandra`:case`noql`:case`flink`:case`mongodb`:case`timescaledb`:case`datafusion`:case`dremio`:return h;case`databricks`:return p;default:return zr(e),b}}function fm(e,t){let n=document.createElement(`div`),r;return{dom:n,mount(){r=(0,Zp.createRoot)(n),r.render((0,q.jsx)(d,{store:u,children:(0,q.jsx)(t,{view:e})}))},update(){r?.render((0,q.jsx)(d,{store:u,children:(0,q.jsx)(t,{view:e})}))},destroy(){r?.unmount()}}}function Z(e){return new Xn(Bn.define(e))}function pm(e){return W(()=>import(`./dist-CibNXpH2.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([2,3,4,5]),import.meta.url)}var mm=[G.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return W(()=>import(`./dist-DcvY27K9.js`).then(e=>e.cpp()),__vite__mapDeps([6,7,4]),import.meta.url)}}),G.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return W(()=>import(`./dist-DcvY27K9.js`).then(e=>e.cpp()),__vite__mapDeps([6,7,4]),import.meta.url)}}),G.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return pm(`Cassandra`)}}),G.of({name:`CSS`,extensions:[`css`],load(){return W(()=>import(`./dist-C43s7KMp.js`).then(e=>e.css()),__vite__mapDeps([8,9,4]),import.meta.url)}}),G.of({name:`Go`,extensions:[`go`],load(){return W(()=>import(`./dist-DfGC5qxC.js`).then(e=>e.go()),__vite__mapDeps([10,11,4,5]),import.meta.url)}}),G.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return W(()=>import(`./dist-BxKJ9CUC.js`).then(e=>e.html()),__vite__mapDeps([12,13,4,9,14,5]),import.meta.url)}}),G.of({name:`Java`,extensions:[`java`],load(){return W(()=>import(`./dist-DewjJKIE.js`).then(e=>e.java()),__vite__mapDeps([15,16,4]),import.meta.url)}}),G.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return W(()=>import(`./dist-DoYtnejk.js`).then(e=>e.javascript()),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),G.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return W(()=>import(`./dist-BZAAgYK3.js`).then(e=>e.jinja()),__vite__mapDeps([18,19,4,13,9,14,5]),import.meta.url)}}),G.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return W(()=>import(`./dist-4SpsNdg9.js`).then(e=>e.json()),__vite__mapDeps([20,21,4]),import.meta.url)}}),G.of({name:`JSX`,extensions:[`jsx`],load(){return W(()=>import(`./dist-DoYtnejk.js`).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),G.of({name:`LESS`,extensions:[`less`],load(){return W(()=>import(`./dist-DfRK-QAy.js`).then(e=>e.less()),__vite__mapDeps([22,23,4,9]),import.meta.url)}}),G.of({name:`Liquid`,extensions:[`liquid`],load(){return W(()=>import(`./dist-Cw0_qzU5.js`).then(e=>e.liquid()),__vite__mapDeps([24,25,4,13,9,14,5]),import.meta.url)}}),G.of({name:`MariaDB SQL`,load(){return pm(`MariaSQL`)}}),G.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return W(()=>import(`./dist-Cllq-3AX.js`).then(e=>e.markdown()),__vite__mapDeps([26,27,4,5,13,9,14]),import.meta.url)}}),G.of({name:`MS SQL`,load(){return pm(`MSSQL`)}}),G.of({name:`MySQL`,load(){return pm(`MySQL`)}}),G.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return W(()=>import(`./dist-D0Fg9FgU.js`).then(e=>e.php()),__vite__mapDeps([28,29,4,13,9,14,5]),import.meta.url)}}),G.of({name:`PLSQL`,extensions:[`pls`],load(){return pm(`PLSQL`)}}),G.of({name:`PostgreSQL`,load(){return pm(`PostgreSQL`)}}),G.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return W(()=>import(`./dist-BXTY2Z6u.js`).then(e=>e.python()),__vite__mapDeps([30,31,4,5]),import.meta.url)}}),G.of({name:`Rust`,extensions:[`rs`],load(){return W(()=>import(`./dist-DG2TCPkT.js`).then(e=>e.rust()),__vite__mapDeps([32,33,4]),import.meta.url)}}),G.of({name:`Sass`,extensions:[`sass`],load(){return W(()=>import(`./dist-BeKmSRy3.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([34,35,4,9]),import.meta.url)}}),G.of({name:`SCSS`,extensions:[`scss`],load(){return W(()=>import(`./dist-BeKmSRy3.js`).then(e=>e.sass()),__vite__mapDeps([34,35,4,9]),import.meta.url)}}),G.of({name:`SQL`,extensions:[`sql`],load(){return pm(`StandardSQL`)}}),G.of({name:`SQLite`,load(){return pm(`SQLite`)}}),G.of({name:`TSX`,extensions:[`tsx`],load(){return W(()=>import(`./dist-DoYtnejk.js`).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),G.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return W(()=>import(`./dist-DoYtnejk.js`).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),G.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return W(()=>import(`./dist-C1ZMbzEY.js`).then(e=>e.wast()),__vite__mapDeps([36,37,4]),import.meta.url)}}),G.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return W(()=>import(`./dist-PsHgCCpB.js`).then(e=>e.xml()),__vite__mapDeps([38,39,4]),import.meta.url)}}),G.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return W(()=>import(`./dist-CcKu0kT5.js`).then(e=>e.yaml()),__vite__mapDeps([40,41,4]),import.meta.url)}}),G.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return W(()=>import(`./apl-gw27yJ2n.js`).then(e=>Z(e.apl)),__vite__mapDeps([42,43]),import.meta.url)}}),G.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return W(()=>import(`./asciiarmor-Cor5STs8.js`).then(e=>Z(e.asciiArmor)),__vite__mapDeps([44,45]),import.meta.url)}}),G.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return W(()=>import(`./asn1-CPEENLyz.js`).then(e=>Z(e.asn1({}))),__vite__mapDeps([46,47]),import.meta.url)}}),G.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return W(()=>import(`./asterisk-BEn0Cwpx.js`).then(e=>Z(e.asterisk)),[],import.meta.url)}}),G.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return W(()=>import(`./brainfuck-a_fzgFtj.js`).then(e=>Z(e.brainfuck)),__vite__mapDeps([48,49]),import.meta.url)}}),G.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return W(()=>import(`./cobol-BYACvGhO.js`).then(e=>Z(e.cobol)),__vite__mapDeps([50,51]),import.meta.url)}}),G.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.csharp)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return W(()=>import(`./clojure-sW2N62b5.js`).then(e=>Z(e.clojure)),__vite__mapDeps([54,55]),import.meta.url)}}),G.of({name:`ClojureScript`,extensions:[`cljs`],load(){return W(()=>import(`./clojure-sW2N62b5.js`).then(e=>Z(e.clojure)),__vite__mapDeps([54,55]),import.meta.url)}}),G.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return W(()=>import(`./css-CbZNFbVv.js`).then(e=>Z(e.gss)),__vite__mapDeps([56,57]),import.meta.url)}}),G.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return W(()=>import(`./cmake-DA9yMhzJ.js`).then(e=>Z(e.cmake)),__vite__mapDeps([58,59]),import.meta.url)}}),G.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return W(()=>import(`./coffeescript-73GxLNLH.js`).then(e=>Z(e.coffeeScript)),__vite__mapDeps([60,61]),import.meta.url)}}),G.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return W(()=>import(`./commonlisp-BAY0IMda.js`).then(e=>Z(e.commonLisp)),__vite__mapDeps([62,63]),import.meta.url)}}),G.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return W(()=>import(`./cypher-CpQ0ACJl.js`).then(e=>Z(e.cypher)),__vite__mapDeps([64,65]),import.meta.url)}}),G.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return W(()=>import(`./python-xiYauDc4.js`).then(e=>Z(e.cython)),__vite__mapDeps([66,67]),import.meta.url)}}),G.of({name:`Crystal`,extensions:[`cr`],load(){return W(()=>import(`./crystal-DLlr59il.js`).then(e=>Z(e.crystal)),__vite__mapDeps([68,69]),import.meta.url)}}),G.of({name:`D`,extensions:[`d`],load(){return W(()=>import(`./d-BFwRCF-p.js`).then(e=>Z(e.d)),__vite__mapDeps([70,71]),import.meta.url)}}),G.of({name:`Dart`,extensions:[`dart`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.dart)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`diff`,extensions:[`diff`,`patch`],load(){return W(()=>import(`./diff-Ib_BKd8h.js`).then(e=>Z(e.diff)),__vite__mapDeps([72,73]),import.meta.url)}}),G.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return W(()=>import(`./dockerfile-DJkHQgkl.js`).then(e=>Z(e.dockerFile)),__vite__mapDeps([74,75]),import.meta.url)}}),G.of({name:`DTD`,extensions:[`dtd`],load(){return W(()=>import(`./dtd-DgBHwr-e.js`).then(e=>Z(e.dtd)),__vite__mapDeps([76,77]),import.meta.url)}}),G.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return W(()=>import(`./dylan-fdbf6J3T.js`).then(e=>Z(e.dylan)),__vite__mapDeps([78,79]),import.meta.url)}}),G.of({name:`EBNF`,load(){return W(()=>import(`./ebnf-D4c0_ac3.js`).then(e=>Z(e.ebnf)),[],import.meta.url)}}),G.of({name:`ECL`,extensions:[`ecl`],load(){return W(()=>import(`./ecl-K_KNI3_u.js`).then(e=>Z(e.ecl)),__vite__mapDeps([80,81]),import.meta.url)}}),G.of({name:`edn`,extensions:[`edn`],load(){return W(()=>import(`./clojure-sW2N62b5.js`).then(e=>Z(e.clojure)),__vite__mapDeps([54,55]),import.meta.url)}}),G.of({name:`Eiffel`,extensions:[`e`],load(){return W(()=>import(`./eiffel-DatcW1fL.js`).then(e=>Z(e.eiffel)),__vite__mapDeps([82,83]),import.meta.url)}}),G.of({name:`Elm`,extensions:[`elm`],load(){return W(()=>import(`./elm-DbcUgz-o.js`).then(e=>Z(e.elm)),__vite__mapDeps([84,85]),import.meta.url)}}),G.of({name:`Erlang`,extensions:[`erl`],load(){return W(()=>import(`./erlang-BistxQAs.js`).then(e=>Z(e.erlang)),__vite__mapDeps([86,87]),import.meta.url)}}),G.of({name:`Esper`,load(){return W(()=>import(`./sql-DuQMFDvy.js`).then(e=>Z(e.esper)),[],import.meta.url)}}),G.of({name:`Factor`,extensions:[`factor`],load(){return W(()=>import(`./factor-DwQNJbiW.js`).then(e=>Z(e.factor)),__vite__mapDeps([88,89,75]),import.meta.url)}}),G.of({name:`FCL`,load(){return W(()=>import(`./fcl-ClOhbFR7.js`).then(e=>Z(e.fcl)),[],import.meta.url)}}),G.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return W(()=>import(`./forth-B-tqi4f_.js`).then(e=>Z(e.forth)),__vite__mapDeps([90,91]),import.meta.url)}}),G.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return W(()=>import(`./fortran-C9M6nI39.js`).then(e=>Z(e.fortran)),__vite__mapDeps([92,93]),import.meta.url)}}),G.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return W(()=>import(`./mllike-DHDLWZl9.js`).then(e=>Z(e.fSharp)),__vite__mapDeps([94,95]),import.meta.url)}}),G.of({name:`Gas`,extensions:[`s`],load(){return W(()=>import(`./gas-DJ-ntEw0.js`).then(e=>Z(e.gas)),__vite__mapDeps([96,97]),import.meta.url)}}),G.of({name:`Gherkin`,extensions:[`feature`],load(){return W(()=>import(`./gherkin-Co7qm0Mt.js`).then(e=>Z(e.gherkin)),__vite__mapDeps([98,99]),import.meta.url)}}),G.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return W(()=>import(`./groovy-DkYAhc5g.js`).then(e=>Z(e.groovy)),__vite__mapDeps([100,101]),import.meta.url)}}),G.of({name:`Haskell`,extensions:[`hs`],load(){return W(()=>import(`./haskell-QbTWCmtk.js`).then(e=>Z(e.haskell)),__vite__mapDeps([102,103]),import.meta.url)}}),G.of({name:`Haxe`,extensions:[`hx`],load(){return W(()=>import(`./haxe-CmR2u-6B.js`).then(e=>Z(e.haxe)),__vite__mapDeps([104,105]),import.meta.url)}}),G.of({name:`HXML`,extensions:[`hxml`],load(){return W(()=>import(`./haxe-CmR2u-6B.js`).then(e=>Z(e.hxml)),__vite__mapDeps([104,105]),import.meta.url)}}),G.of({name:`HTTP`,load(){return W(()=>import(`./http-CLVgA2GD.js`).then(e=>Z(e.http)),[],import.meta.url)}}),G.of({name:`IDL`,extensions:[`pro`],load(){return W(()=>import(`./idl-DY5VfUGL.js`).then(e=>Z(e.idl)),__vite__mapDeps([106,107]),import.meta.url)}}),G.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return W(()=>import(`./javascript-BWjar7HY.js`).then(e=>Z(e.jsonld)),__vite__mapDeps([108,109]),import.meta.url)}}),G.of({name:`Julia`,extensions:[`jl`],load(){return W(()=>import(`./julia-CBfVM-ng.js`).then(e=>Z(e.julia)),__vite__mapDeps([110,111]),import.meta.url)}}),G.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.kotlin)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return W(()=>import(`./livescript-CC7i4CEo.js`).then(e=>Z(e.liveScript)),__vite__mapDeps([112,113]),import.meta.url)}}),G.of({name:`Lua`,extensions:[`lua`],load(){return W(()=>import(`./lua-1tNpM92n.js`).then(e=>Z(e.lua)),__vite__mapDeps([114,115]),import.meta.url)}}),G.of({name:`mIRC`,extensions:[`mrc`],load(){return W(()=>import(`./mirc-BASUkO3C.js`).then(e=>Z(e.mirc)),__vite__mapDeps([116,117]),import.meta.url)}}),G.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return W(()=>import(`./mathematica-DWMBVyLs.js`).then(e=>Z(e.mathematica)),__vite__mapDeps([118,119]),import.meta.url)}}),G.of({name:`Modelica`,extensions:[`mo`],load(){return W(()=>import(`./modelica-C2NfUrdY.js`).then(e=>Z(e.modelica)),__vite__mapDeps([120,121]),import.meta.url)}}),G.of({name:`MUMPS`,extensions:[`mps`],load(){return W(()=>import(`./mumps-DwVYUX8b.js`).then(e=>Z(e.mumps)),__vite__mapDeps([122,123]),import.meta.url)}}),G.of({name:`Mbox`,extensions:[`mbox`],load(){return W(()=>import(`./mbox-DvNfx9hX.js`).then(e=>Z(e.mbox)),__vite__mapDeps([124,125]),import.meta.url)}}),G.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return W(()=>import(`./nginx-BMaDbqW3.js`).then(e=>Z(e.nginx)),[],import.meta.url)}}),G.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return W(()=>import(`./nsis-B6H_Q9YJ.js`).then(e=>Z(e.nsis)),__vite__mapDeps([126,127,75]),import.meta.url)}}),G.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return W(()=>import(`./ntriples-CSqEHNgf.js`).then(e=>Z(e.ntriples)),__vite__mapDeps([128,129]),import.meta.url)}}),G.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.objectiveC)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.objectiveCpp)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return W(()=>import(`./mllike-DHDLWZl9.js`).then(e=>Z(e.oCaml)),__vite__mapDeps([94,95]),import.meta.url)}}),G.of({name:`Octave`,extensions:[`m`],load(){return W(()=>import(`./octave-ImTMIie9.js`).then(e=>Z(e.octave)),__vite__mapDeps([130,131]),import.meta.url)}}),G.of({name:`Oz`,extensions:[`oz`],load(){return W(()=>import(`./oz-BuYcBdKy.js`).then(e=>Z(e.oz)),__vite__mapDeps([132,133]),import.meta.url)}}),G.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return W(()=>import(`./pascal-B50DmceL.js`).then(e=>Z(e.pascal)),__vite__mapDeps([134,135]),import.meta.url)}}),G.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return W(()=>import(`./perl-DmFVAwdF.js`).then(e=>Z(e.perl)),__vite__mapDeps([136,137]),import.meta.url)}}),G.of({name:`Pig`,extensions:[`pig`],load(){return W(()=>import(`./pig-BnQuru9N.js`).then(e=>Z(e.pig)),__vite__mapDeps([138,139]),import.meta.url)}}),G.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return W(()=>import(`./powershell-B1pJyAAD.js`).then(e=>Z(e.powerShell)),__vite__mapDeps([140,141]),import.meta.url)}}),G.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return W(()=>import(`./properties-Ci7guRqV.js`).then(e=>Z(e.properties)),__vite__mapDeps([142,143]),import.meta.url)}}),G.of({name:`ProtoBuf`,extensions:[`proto`],load(){return W(()=>import(`./protobuf-CoqP8wM5.js`).then(e=>Z(e.protobuf)),__vite__mapDeps([144,145]),import.meta.url)}}),G.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return W(()=>import(`./pug-CJsoo9v0.js`).then(e=>Z(e.pug)),__vite__mapDeps([146,147,109]),import.meta.url)}}),G.of({name:`Puppet`,extensions:[`pp`],load(){return W(()=>import(`./puppet-C9UYpvtZ.js`).then(e=>Z(e.puppet)),__vite__mapDeps([148,149]),import.meta.url)}}),G.of({name:`Q`,extensions:[`q`],load(){return W(()=>import(`./q-CKkOe1xA.js`).then(e=>Z(e.q)),__vite__mapDeps([150,151]),import.meta.url)}}),G.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return W(()=>import(`./r-Bwc-y-iL.js`).then(e=>Z(e.r)),__vite__mapDeps([152,153]),import.meta.url)}}),G.of({name:`RPM Changes`,load(){return W(()=>import(`./rpm-UQSdNQr2.js`).then(e=>Z(e.rpmChanges)),__vite__mapDeps([154,155]),import.meta.url)}}),G.of({name:`RPM Spec`,extensions:[`spec`],load(){return W(()=>import(`./rpm-UQSdNQr2.js`).then(e=>Z(e.rpmSpec)),__vite__mapDeps([154,155]),import.meta.url)}}),G.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return W(()=>import(`./ruby-CrY8zrT8.js`).then(e=>Z(e.ruby)),__vite__mapDeps([156,157]),import.meta.url)}}),G.of({name:`SAS`,extensions:[`sas`],load(){return W(()=>import(`./sas-CssadkTB.js`).then(e=>Z(e.sas)),__vite__mapDeps([158,159]),import.meta.url)}}),G.of({name:`Scala`,extensions:[`scala`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.scala)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return W(()=>import(`./scheme-CkJWoRmu.js`).then(e=>Z(e.scheme)),__vite__mapDeps([160,161]),import.meta.url)}}),G.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return W(()=>import(`./shell-FgUEpLdy.js`).then(e=>Z(e.shell)),__vite__mapDeps([162,163]),import.meta.url)}}),G.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return W(()=>import(`./sieve-BLxcNk7A.js`).then(e=>Z(e.sieve)),__vite__mapDeps([164,165]),import.meta.url)}}),G.of({name:`Smalltalk`,extensions:[`st`],load(){return W(()=>import(`./smalltalk-d1Dbk6V4.js`).then(e=>Z(e.smalltalk)),__vite__mapDeps([166,167]),import.meta.url)}}),G.of({name:`Solr`,load(){return W(()=>import(`./solr-BBopId9w.js`).then(e=>Z(e.solr)),[],import.meta.url)}}),G.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return W(()=>import(`./mllike-DHDLWZl9.js`).then(e=>Z(e.sml)),__vite__mapDeps([94,95]),import.meta.url)}}),G.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return W(()=>import(`./sparql-CUZhKeRb.js`).then(e=>Z(e.sparql)),__vite__mapDeps([168,169]),import.meta.url)}}),G.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return W(()=>import(`./spreadsheet-CTIncYxj.js`).then(e=>Z(e.spreadsheet)),[],import.meta.url)}}),G.of({name:`Squirrel`,extensions:[`nut`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.squirrel)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`Stylus`,extensions:[`styl`],load(){return W(()=>import(`./stylus-BvudHrj4.js`).then(e=>Z(e.stylus)),__vite__mapDeps([170,171]),import.meta.url)}}),G.of({name:`Swift`,extensions:[`swift`],load(){return W(()=>import(`./swift-CUIczYYb.js`).then(e=>Z(e.swift)),__vite__mapDeps([172,173]),import.meta.url)}}),G.of({name:`sTeX`,load(){return W(()=>import(`./stex-3SJlFZg3.js`).then(e=>Z(e.stex)),__vite__mapDeps([174,175]),import.meta.url)}}),G.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return W(()=>import(`./stex-3SJlFZg3.js`).then(e=>Z(e.stex)),__vite__mapDeps([174,175]),import.meta.url)}}),G.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return W(()=>import(`./verilog-DH7aBYt7.js`).then(e=>Z(e.verilog)),__vite__mapDeps([176,177]),import.meta.url)}}),G.of({name:`Tcl`,extensions:[`tcl`],load(){return W(()=>import(`./tcl-SjROh4xB.js`).then(e=>Z(e.tcl)),__vite__mapDeps([178,179]),import.meta.url)}}),G.of({name:`Textile`,extensions:[`textile`],load(){return W(()=>import(`./textile-DgW6fC9R.js`).then(e=>Z(e.textile)),__vite__mapDeps([180,181]),import.meta.url)}}),G.of({name:`TiddlyWiki`,load(){return W(()=>import(`./tiddlywiki-VlUiK86J.js`).then(e=>Z(e.tiddlyWiki)),[],import.meta.url)}}),G.of({name:`Tiki wiki`,load(){return W(()=>import(`./tiki-AK6FwT8q.js`).then(e=>Z(e.tiki)),[],import.meta.url)}}),G.of({name:`TOML`,extensions:[`toml`],load(){return W(()=>import(`./toml-BcC_uO4q.js`).then(e=>Z(e.toml)),__vite__mapDeps([182,183]),import.meta.url)}}),G.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return W(()=>import(`./troff-BMlKH74u.js`).then(e=>Z(e.troff)),__vite__mapDeps([184,185]),import.meta.url)}}),G.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return W(()=>import(`./ttcn-P2iYmK_j.js`).then(e=>Z(e.ttcn)),__vite__mapDeps([186,187]),import.meta.url)}}),G.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return W(()=>import(`./ttcn-cfg-2bl9aE98.js`).then(e=>Z(e.ttcnCfg)),__vite__mapDeps([188,189]),import.meta.url)}}),G.of({name:`Turtle`,extensions:[`ttl`],load(){return W(()=>import(`./turtle-DDf6uD3p.js`).then(e=>Z(e.turtle)),__vite__mapDeps([190,191]),import.meta.url)}}),G.of({name:`Web IDL`,extensions:[`webidl`],load(){return W(()=>import(`./webidl-dw5if_Lv.js`).then(e=>Z(e.webIDL)),__vite__mapDeps([192,193]),import.meta.url)}}),G.of({name:`VB.NET`,extensions:[`vb`],load(){return W(()=>import(`./vb-CrfmF706.js`).then(e=>Z(e.vb)),__vite__mapDeps([194,195]),import.meta.url)}}),G.of({name:`VBScript`,extensions:[`vbs`],load(){return W(()=>import(`./vbscript-Cpiv2llq.js`).then(e=>Z(e.vbScript)),__vite__mapDeps([196,197]),import.meta.url)}}),G.of({name:`Velocity`,extensions:[`vtl`],load(){return W(()=>import(`./velocity-5N54agTA.js`).then(e=>Z(e.velocity)),__vite__mapDeps([198,199]),import.meta.url)}}),G.of({name:`Verilog`,extensions:[`v`],load(){return W(()=>import(`./verilog-DH7aBYt7.js`).then(e=>Z(e.verilog)),__vite__mapDeps([176,177]),import.meta.url)}}),G.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return W(()=>import(`./vhdl-BmegRbqn.js`).then(e=>Z(e.vhdl)),__vite__mapDeps([200,201]),import.meta.url)}}),G.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return W(()=>import(`./xquery-CuDTgW6S.js`).then(e=>Z(e.xQuery)),__vite__mapDeps([202,203]),import.meta.url)}}),G.of({name:`Yacas`,extensions:[`ys`],load(){return W(()=>import(`./yacas-Dn2coKff.js`).then(e=>Z(e.yacas)),__vite__mapDeps([204,205]),import.meta.url)}}),G.of({name:`Z80`,extensions:[`z80`],load(){return W(()=>import(`./z80-ByJO5ysu.js`).then(e=>Z(e.z80)),__vite__mapDeps([206,207]),import.meta.url)}}),G.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return W(()=>import(`./mscgen-C7woTLsY.js`).then(e=>Z(e.mscgen)),__vite__mapDeps([208,209]),import.meta.url)}}),G.of({name:`Xù`,extensions:[`xu`],load(){return W(()=>import(`./mscgen-C7woTLsY.js`).then(e=>Z(e.xu)),__vite__mapDeps([208,209]),import.meta.url)}}),G.of({name:`MsGenny`,extensions:[`msgenny`],load(){return W(()=>import(`./mscgen-C7woTLsY.js`).then(e=>Z(e.msgenny)),__vite__mapDeps([208,209]),import.meta.url)}}),G.of({name:`Vue`,extensions:[`vue`],load(){return W(()=>import(`./dist-DH7Tm1i8.js`).then(e=>e.vue()),__vite__mapDeps([210,211,4,13,9,14,5]),import.meta.url)}}),G.of({name:`Angular Template`,load(){return W(()=>import(`./dist-DLwSLd_v.js`).then(e=>e.angular()),__vite__mapDeps([212,4,13,9,14,5]),import.meta.url)}})],hm=new WeakMap,gm=/(\n|\r\n?|\u2028|\u2029)/g,_m=/^\s*/,vm=/\S/,ym=Array.prototype.slice,bm=48,xm=57,Sm=97,Cm=102,wm=65,Tm=70;function Em(e){if(typeof e==`string`)return km([e])[0];if(typeof e==`function`)return function(){let t=ym.call(arguments);return t[0]=Om(t[0]),e.apply(this,t)};let t=Om(e),n=Dm(t,0);for(let e=1;e<t.length;e++)n+=arguments[e]+Dm(t,e);return n}function Dm(e,t){let n=e[t];if(n===void 0)throw TypeError(`invalid cooked string at index ${t}`);return n}function Om(e){let t=hm.get(e);if(t)return t;let n=km(e.raw),r=n.map(jm);return Object.defineProperty(r,"raw",{value:Object.freeze(n)}),Object.freeze(r),hm.set(e,r),r}function km(e){let t=e.map(e=>e.split(gm)),n;for(let e=0;e<t.length;e++){let r=t[e],i=e===0,a=e+1===t.length;if(i){if(r.length===1||r[0].length>0)throw Error(`invalid content on opening line`);r[1]=``}if(a){if(r.length===1||vm.test(r[r.length-1]))throw Error(`invalid content on closing line`);r[r.length-2]=``,r[r.length-1]=``}for(let e=2;e<r.length;e+=2){let t=r[e],i=e+1===r.length&&!a,o=_m.exec(t)[0];if(!i&&o.length===t.length){r[e]=``;continue}n=Am(o,n)}}let r=n?n.length:0;return t.map(e=>{let t=e[0];for(let n=1;n<e.length;n+=2){let i=e[n],a=e[n+1];t+=i+a.slice(r)}return t})}function Am(e,t){if(t===void 0||e===t)return e;let n=0;for(let r=Math.min(e.length,t.length);n<r&&e[n]===t[n];n++);return e.slice(0,n)}function jm(e){let t=``,n=0,r=0;for(;(r=e.indexOf(`\\`,r))>-1;){if(t+=e.slice(n,r),++r===e.length)return;let i=e[r++];switch(i){case`b`:t+=`\b`;break;case`t`:t+=` `;break;case`n`:t+=`
34
+ `,n.textContent=t;let r=e.coordsAtPos(e.state.selection.main.head);r&&(n.style.left=`${r.left}px`,n.style.top=`${r.bottom+5}px`),document.body.appendChild(n),setTimeout(()=>{n.style.opacity=`0`,n.style.transition=`opacity 0.2s`,setTimeout(()=>n.remove(),200)},3e3)}function Iu(e){return Lu(e,new WeakSet)}function Lu(e,t){if(e==null)return!0;if(Array.isArray(e))return t.has(e)?!0:(t.add(e),e.length===0||e.every(e=>Lu(e,t)));if(typeof e==`string`)return Ru(e);let n=e.value;return typeof n!=`string`||Ru(n)}function Ru(e){return e==null?!0:typeof e==`string`?e.trim()===``||/^[\s\n`]*$/.test(e):!1}function zu(e,t){let n=[];return t.iterChanges((t,r,i,a,o)=>{let s=o.toString();if(t===0&&r===e.length){n.push({text:s});return}let c=mu(e,t),l=mu(e,r);n.push({range:{start:c,end:l},text:s})}),n.sort((e,t)=>{if(!e.range)return 1;if(!t.range)return-1;let n=e.range.start.line??-1,r=t.range.start.line??-1;if(n!==r)return r-n;let i=e.range.start.character??-1;return(t.range.start.character??-1)-i}),n}var Bu=Object.fromEntries(Object.entries(fu.CompletionItemKind).map(([e,t])=>[t,e]));function Vu(e){return!!(e.deprecated||e.tags?.includes(fu.CompletionItemTag.Deprecated))}function Hu(e){return e.deprecated?`cm-deprecated`:``}function Uu(e){return`insert`in e}function Wu(e,t){if(!t)return e;let n={...e};if(n.commitCharacters??=t.commitCharacters,n.insertTextFormat??=t.insertTextFormat,n.insertTextMode??=t.insertTextMode,n.data===void 0&&(n.data=t.data),n.textEdit==null&&t.editRange){let e=n.textEditText??n.insertText??n.label;n.textEdit=Uu(t.editRange)?{newText:e,insert:t.editRange.insert,replace:t.editRange.replace}:{newText:e,range:t.editRange}}return n}function Gu(e,t,n,r){let{textEdit:i,insertText:a,label:o}=t,s=n,c=r,l=a||o;if(i){let t=ku(i)?i.range:ju(i)?i.replace:void 0;if(t){l=i.newText;let n=pu(e,t.start),r=pu(e,t.end);n!=null&&r!=null&&n<=r&&(s=n,c=r)}}return{from:s,to:c,newText:l}}function Ku(e,t,n,r){let i=[];for(let a of t){let t=pu(e,a.range.start),o=pu(e,a.range.end);t==null||o==null||t>o||o>n&&t<r||i.push({from:t,to:o,insert:a.newText})}return i}function qu(e,t,n){return r=>r<=e?r:r-(t-e)+n}function Ju(e){let{view:t,originalDoc:n,mainFrom:r,mainTo:i,insertedLength:a,resolveItem:o}=e,s=t.state.doc,c=qu(r,i,a);o().then(e=>{let a=e?.additionalTextEdits;if(!a?.length||t.state.doc!==s)return;let o=Ku(n,a,r,i).map(e=>({...e,from:c(e.from),to:c(e.to)}));o.length!==0&&t.dispatch({changes:o,userEvent:`input.complete`})}).catch(e=>{console.error(`Failed to resolve completion item:`,e)})}var Yu;(function(e){e.PlainText=1,e.Snippet=2})(Yu||={});var Xu=/^\$\{(\d+)\|((?:\\.|[^\\}])*)\|\}/,Zu=/^\$\{([A-Za-z_][A-Za-z0-9_]*)(?::([^}]*))?\}/,Qu=/^\$[A-Za-z_][A-Za-z0-9_]*/,$u=/^(?:\\.|[^,])*/,ed=/^\{0(?=[:}])/;function td(e,t){let n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`\\`&&r+1<e.length){n+=e.slice(r,r+2),r+=2;continue}if(i===`$`){let i=e.slice(r),a=Xu.exec(i);if(a){let e=$u.exec(a[2]??``)?.[0]??``;n+=t(a[1]??``,e),r+=a[0].length;continue}let o=Zu.exec(i);if(o){n+=o[2]??``,r+=o[0].length;continue}let s=Qu.exec(i);if(s){r+=s[0].length;continue}}n+=i,r+=1}return n}function nd(e){let t=0;for(let n of e.matchAll(/\$\{?(\d+)/g))t=Math.max(t,Number(n[1]));return String(t+1)}function rd(e){let t=td(e,(e,t)=>`\${${e}:${t}}`),n=nd(t),r=``,i=0;for(;i<t.length;){let e=t[i];if(e===`\\`&&i+1<t.length){let e=t[i+1];e===`$`?t[i+2]===`{`?(r+=`$\\{`,i+=3):(r+=`$`,i+=2):e===`{`||e===`}`?(r+=`\\${e}`,i+=2):e===`\\`?(r+=`\\`,i+=2):(r+=e,i+=2)}else if(e===`$`){let a=t.slice(i+1),o=ed.exec(a),s=/^\d+/.exec(a);if(o)r+=`\${${n}`,i+=1+o[0].length;else if(s){let e=s[0]===`0`?n:s[0];r+=`\${${e}}`,i+=1+s[0].length}else r+=e,i+=1}else e===`#`&&t[i+1]===`{`?(r+=`#\\{`,i+=2):(r+=e,i+=1)}return r}function id(e){let t=td(e,(e,t)=>t),n=``,r=0;for(;r<t.length;){let e=t[r];if(e===`\\`&&r+1<t.length)n+=t[r+1],r+=2;else if(e===`$`){let i=/^\{(\d+)(?::([^}]*))?\}/.exec(t.slice(r+1));if(i)n+=i[2]??``,r+=1+i[0].length;else{let i=/^\d+/.exec(t.slice(r+1));i?r+=1+i[0].length:(n+=e,r+=1)}}else n+=e,r+=1}return n}function ad(e,t){let{detail:n,labelDetails:r,label:i,kind:a,documentation:o,additionalTextEdits:s,insertTextFormat:c,commitCharacters:l,filterText:u}=e,d=typeof i==`string`?i:``,f=null,p=()=>(f??=t.resolveItem(e),f),m={label:d,detail:r?.detail||n,apply(n,r,i,a){let o=n.state,{from:l,to:u,newText:d}=Gu(o.doc,e,i,a);(l>a||u<a)&&(l=i,u=a);let f=d,m=Ku(o.doc,s??[],l,u),h=e=>{s||!t.hasResolveProvider||Ju({view:n,originalDoc:o.doc,mainFrom:l,mainTo:u,insertedLength:e,resolveItem:p})};if(c===Yu.Snippet&&t.useSnippetOnCompletion){let e=l,t=u;if(m.length>0){let r=o.changes(m);n.dispatch({changes:r}),e=r.mapPos(e,1),t=r.mapPos(t,1)}let r=n.state.doc.length;Ir(rd(f))(n,null,e,t),h(n.state.doc.length-r+(t-e));return}if(c===Yu.Snippet&&(f=id(f)),m.length===0){n.dispatch(Mr(o,f,l,u)),h(f.length);return}let g=o.changes([{from:l,to:u,insert:f},...m]);n.dispatch({changes:g,selection:{anchor:g.mapPos(l,-1)+f.length},userEvent:`input.complete`})},type:a?Bu[a]?.toLowerCase():void 0};u!=null&&u!==d&&(m.label=u,m.displayLabel=d),l?.length&&(m.commitCharacters=l),Vu(e)&&(m.deprecated=!0);let h=e=>{let n=document.createElement(`div`);return n.classList.add(`documentation`),Eu(n,e,{allowHTMLContent:t.allowHTMLContent,markdownRenderer:t.markdownRenderer}),n};return t.hasResolveProvider?m.info=async()=>{try{let e=(await p())?.documentation||o;return!e||Iu(e)?null:h(e)}catch(e){return console.error(`Failed to resolve completion item:`,e),!o||Iu(o)?null:h(o)}}:o&&(m.info=()=>h(o)),m}function od(e,t,n,r=!0){let i=[t?sd(t):cd,n===`python`?ld:void 0].filter(Boolean),a=[...e];if(t&&r){let e=t.toLowerCase();/^\w+$/.test(e)&&(a=a.filter(({label:t,filterText:n})=>(typeof n==`string`?n:dd(t)).toLowerCase().startsWith(e)))}for(let e of i)a.sort(e);return a}function sd(e){return(t,n)=>{let r=ud(t).startsWith(e),i=ud(n).startsWith(e);if(r&&!i)return-1;if(!r&&i)return 1;let a=typeof t.sortText==`string`?t.sortText:dd(t.label),o=typeof n.sortText==`string`?n.sortText:dd(n.label);return a.localeCompare(o)}}function cd(e,t){let n=typeof e.sortText==`string`?e.sortText:dd(e.label),r=typeof t.sortText==`string`?t.sortText:dd(t.label);return n.localeCompare(r)}function ld(e,t){let n=dd(e.label).endsWith(`=`),r=dd(t.label).endsWith(`=`);return n&&!r?-1:!n&&r?1:0}function ud(e){return typeof e.filterText==`string`?e.filterText:dd(e.label)}function dd(e){return typeof e==`string`?e:``}function fd(e){let t=new Proxy({},{get(){throw Error(e)}});return function(e){return e[0]??t}}var pd=fd(`No document URI provided. Pass one to the extension or use documentUri.of().`),md=fd(`No language ID provided. Pass one to the extension or use languageId.of().`);function hd(e){if(e!==e.trim())return!1;try{return!!new URL(e).protocol}catch{return!1}}var gd=bn.define({combine(e){if(e.length===0)return pd(e);let t=pd(e);if(!(t&&hd(t)))throw Error(`Document URI must be a non-empty absolute URI`);return t}}),_d=bn.define({combine(e){if(e.length===0)return md(e);let t=md(e);if(!t.trim())throw Error(`Language ID must be a non-empty string`);return t}}),vd={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603,RequestTimeout:-32001},yd=class extends Error{code;data;constructor(e,t,n){super(t),this.name=`RPCError`,this.code=e,this.data=n}},bd=1e4;function xd(e){return e.id!=null}function Sd(e){return e instanceof Error?e:new yd(vd.InternalError,String(e))}var Cd=class{transport;pending=new Map;disconnect;disconnectClose;connected;nextId=0;closed=!1;isConnected=!1;closeError;notificationHandler;requestHandler;constructor(e){this.transport=e,this.disconnect=e.onMessage(e=>this.receive(e)),this.disconnectClose=e.onClose?.(e=>{this.closeError??=e;for(let t of[...this.pending.keys()])this.settle(t,t=>t.reject(e))}),this.connected=e.connect(),this.connected.then(()=>{this.isConnected=!0},()=>{}),this.connected.catch(()=>{})}onNotification(e){this.notificationHandler=e}onRequest(e){this.requestHandler=e}request(e,t,n=bd,r){if(r?.aborted)return Promise.reject(new DOMException(`Request aborted`,`AbortError`));if(this.closed)return Promise.reject(new yd(vd.InternalError,`Client closed`));if(this.closeError)return Promise.reject(this.closeError);let i=this.nextId++;return new Promise((a,o)=>{let s=!1,c=e=>{this.pending.has(i)&&(this.settle(i,t=>t.reject(e)),s&&this.notify(`$/cancelRequest`,{id:i}).catch(()=>{}))},l=()=>c(new DOMException(`Request aborted`,`AbortError`));this.pending.set(i,{resolve:a,reject:o,cleanup:()=>r?.removeEventListener(`abort`,l)}),r?.addEventListener(`abort`,l,{once:!0});let u=()=>{let r=this.pending.get(i);if(r){r.timer=setTimeout(()=>{c(new yd(vd.RequestTimeout,`Request "${e}" timed out after ${n}ms`))},n);try{s=!0,this.transport.send({jsonrpc:`2.0`,id:i,method:e,params:t})}catch(e){this.settle(i,t=>t.reject(Sd(e)))}}};if(this.isConnected){u();return}this.connected.then(u,e=>this.settle(i,t=>t.reject(Sd(e))))})}notify(e,t){let n=this.dispatch({jsonrpc:`2.0`,method:e,params:t});return n.catch(()=>{}),n}respond(e){return this.dispatch(e)}close(){if(!this.closed){this.closed=!0;for(let e of[...this.pending.keys()])this.settle(e,e=>e.reject(new yd(vd.InternalError,`Client closed`)));this.disconnect(),this.disconnectClose?.(),this.transport.close()}}dispatch(e){if(this.closed)return Promise.resolve();if(this.isConnected)try{return this.transport.send(e),Promise.resolve()}catch(e){return Promise.reject(Sd(e))}return this.connected.then(()=>{this.closed||this.transport.send(e)})}settle(e,t){let n=this.pending.get(e);n&&(n.timer!==void 0&&clearTimeout(n.timer),n.cleanup(),this.pending.delete(e),t(n))}receive(e){if(this.closed||typeof e!=`object`||!e||Array.isArray(e)||e.jsonrpc!==`2.0`)return;if(typeof e.method==`string`){xd(e)?this.requestHandler?.(e):this.notificationHandler?.(e);return}if(!xd(e))return;let t=e,n=t.id;if(typeof n==`string`&&!this.pending.has(n)&&/^\d+$/.test(n)){let e=Number(n);this.pending.has(e)&&(n=e)}this.settle(n,e=>{if(`error`in t){let n=t.error;if(typeof n!=`object`||!n||typeof n.code!=`number`||typeof n.message!=`string`){e.reject(new yd(vd.InvalidRequest,`Malformed JSON-RPC error response`,n));return}e.reject(new yd(n.code,n.message,n.data))}else`result`in t?e.resolve(t.result):e.reject(new yd(vd.InvalidRequest,`Malformed JSON-RPC response: missing result or error`))})}},wd=1e4,Td=`Language server: `,Ed={"textDocument/hover":`hoverProvider`,"textDocument/completion":`completionProvider`,"textDocument/definition":`definitionProvider`,"textDocument/declaration":`declarationProvider`,"textDocument/typeDefinition":`typeDefinitionProvider`,"textDocument/implementation":`implementationProvider`,"textDocument/references":`referencesProvider`,"textDocument/documentHighlight":`documentHighlightProvider`,"textDocument/documentSymbol":`documentSymbolProvider`,"textDocument/codeAction":`codeActionProvider`,"textDocument/codeLens":`codeLensProvider`,"textDocument/documentLink":`documentLinkProvider`,"textDocument/formatting":`documentFormattingProvider`,"textDocument/rangeFormatting":`documentRangeFormattingProvider`,"textDocument/onTypeFormatting":`documentOnTypeFormattingProvider`,"textDocument/rename":`renameProvider`,"textDocument/prepareRename":`renameProvider`,"textDocument/signatureHelp":`signatureHelpProvider`,"textDocument/foldingRange":`foldingRangeProvider`,"textDocument/selectionRange":`selectionRangeProvider`,"workspace/symbol":`workspaceSymbolProvider`,"workspace/executeCommand":`executeCommandProvider`},Dd=class{ready;capabilities;advertisedCapabilities;initializePromise;rootUri;workspaceFolders;timeout;client;initializationOptions;clientCapabilities;notificationListeners=new Set;documentOpenCounts=new Map;serverRequestHandlers=new Map;dynamicCapabilities=new Map;isClosed=!1;constructor({rootUri:e,workspaceFolders:t,transport:n,initializationOptions:r,capabilities:i,timeout:a=wd,getWorkspaceConfiguration:o}){if(!e)throw Error(`rootUri must be a non-empty URI`);this.rootUri=e,this.workspaceFolders=t,this.initializationOptions=r,this.clientCapabilities=i,this.timeout=a,this.ready=!1,this.capabilities=null,this.client=new Cd(n),this.client.onNotification(e=>{this.processNotification(e)}),this.client.onRequest(e=>{this.handleServerRequest(e)}),this.onRequest(`workspace/configuration`,e=>o?o(e):(e?.items??[]).map(()=>null)),this.onRequest(`client/registerCapability`,e=>{let t=e?.registrations;if(!Array.isArray(t))return null;for(let e of t)!e||typeof e.id!=`string`||e.id.length===0||typeof e.method!=`string`||this.dynamicCapabilities.has(e.id)||this.dynamicCapabilities.set(e.id,e);return null}),this.onRequest(`client/unregisterCapability`,e=>{let t=e?.unregisterations;if(!Array.isArray(t))return null;for(let e of t)this.dynamicCapabilities.delete(e.id);return null}),this.onRequest(`workspace/applyEdit`,()=>({applied:!1,failureReason:`workspace/applyEdit is not supported`})),this.onRequest(`window/showMessageRequest`,e=>{if(e?.message){let t=String(e.message).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,``).slice(0,2031);console.info(`${Td}${t}`)}return null}),this.onRequest(`window/workDoneProgress/create`,()=>null),this.initializePromise=this.initialize(),this.initializePromise.catch(e=>{console.error(`Language server initialization failed`,e)})}getInitializationOptions(){let e={textDocument:{hover:{dynamicRegistration:!0,contentFormat:[`markdown`,`plaintext`]},moniker:{},synchronization:{dynamicRegistration:!1,willSave:!0,didSave:!0,willSaveWaitUntil:!0},codeAction:{dynamicRegistration:!0,codeActionLiteralSupport:{codeActionKind:{valueSet:[``,`quickfix`,`refactor`,`refactor.extract`,`refactor.inline`,`refactor.rewrite`,`source`,`source.organizeImports`]}},resolveSupport:{properties:[`edit`]}},completion:{dynamicRegistration:!1,completionItem:{snippetSupport:!0,commitCharactersSupport:!0,documentationFormat:[`markdown`,`plaintext`],deprecatedSupport:!0,preselectSupport:!1,insertReplaceSupport:!0,tagSupport:{valueSet:[1]},resolveSupport:{properties:[`documentation`,`detail`,`additionalTextEdits`]}},completionList:{itemDefaults:[`commitCharacters`,`editRange`,`insertTextFormat`,`insertTextMode`,`data`]},contextSupport:!1},signatureHelp:{dynamicRegistration:!1,signatureInformation:{documentationFormat:[`markdown`,`plaintext`]}},declaration:{dynamicRegistration:!1,linkSupport:!0},definition:{dynamicRegistration:!0,linkSupport:!0},typeDefinition:{dynamicRegistration:!1,linkSupport:!0},implementation:{dynamicRegistration:!1,linkSupport:!0},rename:{dynamicRegistration:!0,prepareSupport:!0},publishDiagnostics:{relatedInformation:!0,tagSupport:{valueSet:[1,2]},versionSupport:!0,codeDescriptionSupport:!0,dataSupport:!0}},workspace:{didChangeConfiguration:{dynamicRegistration:!1}}};return{capabilities:this.clientCapabilities?typeof this.clientCapabilities==`function`?this.clientCapabilities(e):this.clientCapabilities:e,initializationOptions:this.initializationOptions,processId:null,rootUri:this.rootUri,workspaceFolders:this.workspaceFolders}}async initialize(){let e=this.getInitializationOptions();this.advertisedCapabilities=e?.capabilities;let t=await this.request(`initialize`,e,this.timeout*3);if(!t||typeof t!=`object`||!(`capabilities`in t)||typeof t.capabilities!=`object`||t.capabilities===null)throw Error(`Invalid initialize response: missing server capabilities`);this.isClosed||(this.capabilities=t.capabilities,this.notify(`initialized`,{}),this.ready=!0)}close(){if(!this.isClosed){if(this.isClosed=!0,this.ready=!1,this.notificationListeners.clear(),this.serverRequestHandlers.clear(),this.dynamicCapabilities.clear(),this.documentOpenCounts.clear(),this.capabilities){this.client.request(`shutdown`,null,this.timeout).catch(()=>{}).then(()=>{this.client.notify(`exit`,void 0).catch(()=>{}),this.client.close()});return}this.client.close()}}onRequest(e,t){return this.serverRequestHandlers.set(e,t),()=>{this.serverRequestHandlers.get(e)===t&&this.serverRequestHandlers.delete(e)}}mayRegisterDynamically(e){let[t,n]=e.split(`/`);return t!==`textDocument`||!n?!1:(this.advertisedCapabilities?.textDocument)?.[n]?.dynamicRegistration===!0}hasCapability(e){for(let t of this.dynamicCapabilities.values())if(t.method===e)return!0;let t=Ed[e];return t?!!this.capabilities?.[t]:!1}async handleServerRequest(e){let t=this.serverRequestHandlers.get(e.method),n;if(!t)n={jsonrpc:`2.0`,id:e.id,error:{code:vd.MethodNotFound,message:`Method not found: ${e.method}`}};else try{let r=await t(e.params);n={jsonrpc:`2.0`,id:e.id,result:r===void 0?null:r}}catch(t){n={jsonrpc:`2.0`,id:e.id,error:{code:vd.InternalError,message:t instanceof Error?t.message:String(t)}}}this.isClosed||this.client.respond(n).catch(()=>{})}textDocumentDidOpen(e){let t=e.textDocument.uri,n=this.documentOpenCounts.get(t)??0;return this.documentOpenCounts.set(t,n+1),n>0?Promise.resolve(!1):this.notify(`textDocument/didOpen`,e).then(()=>!0)}textDocumentDidChange(e){return this.notify(`textDocument/didChange`,e)}textDocumentDidClose(e){let t=e.textDocument.uri,n=this.documentOpenCounts.get(t)??0;return n>1?(this.documentOpenCounts.set(t,n-1),Promise.resolve(void 0)):(this.documentOpenCounts.delete(t),this.notify(`textDocument/didClose`,e))}textDocumentWillSave(e){return this.notify(`textDocument/willSave`,e)}async textDocumentWillSaveWaitUntil(e){return await this.request(`textDocument/willSaveWaitUntil`,e,this.timeout)}textDocumentDidSave(e){return this.notify(`textDocument/didSave`,e)}async textDocumentHover(e){return await this.request(`textDocument/hover`,e,this.timeout)}async textDocumentCompletion(e){return await this.request(`textDocument/completion`,e,this.timeout)}async completionItemResolve(e){return await this.request(`completionItem/resolve`,e,this.timeout)}async textDocumentDefinition(e){return await this.request(`textDocument/definition`,e,this.timeout)}async textDocumentCodeAction(e){return await this.request(`textDocument/codeAction`,e,this.timeout)}async codeActionResolve(e){return await this.request(`codeAction/resolve`,e,this.timeout)}async textDocumentRename(e){return await this.request(`textDocument/rename`,e,this.timeout)}async textDocumentPrepareRename(e){return await this.request(`textDocument/prepareRename`,e,this.timeout)}async textDocumentSignatureHelp(e){return await this.request(`textDocument/signatureHelp`,e,this.timeout)}onNotification(e){return this.notificationListeners.add(e),()=>this.notificationListeners.delete(e)}waitForInitialization(e){if(!e)return this.initializePromise;if(e.aborted)return Promise.reject(new DOMException(`Request aborted`,`AbortError`));let t,n=new Promise((n,r)=>{t=()=>r(new DOMException(`Request aborted`,`AbortError`)),e.addEventListener(`abort`,t,{once:!0})});return Promise.race([this.initializePromise,n]).finally(()=>{e.removeEventListener(`abort`,t)})}request(e,t,n,r){if(e===`initialize`)return this.client.request(e,t,n,r);let i=this.hasCapability(e),a=!(this.ready||this.capabilities)&&this.mayRegisterDynamically(e);return this.waitForInitialization(r).then(()=>{if(this.isClosed)throw Error(`Language server client is closed`);if(Ed[e]&&!a&&!(i||this.hasCapability(e)))throw Error(`Language server does not support method ${e}`);return this.client.request(e,t,n,r)})}notify(e,t){return this.client.notify(e,t)}processNotification(e){for(let t of this.notificationListeners)try{Promise.resolve(t(e)).catch(e=>{console.error(`Notification listener failed`,e)})}catch(e){console.error(`Notification listener failed`,e)}}},Od=class e{static OUTBOX_LIMIT=1e3;url;protocols;socket;opened=!1;closed=!1;rejectConnect;handlers=new Set;closeHandlers=new Set;outbox=[];constructor(e,t){this.url=e,this.protocols=t}connect(){return/^wss?:\/\//i.test(this.url)?(this.url.toLowerCase().startsWith(`ws://`)&&typeof location<`u`&&location.protocol===`https:`&&console.warn(`Insecure WebSocket ${this.url} may be blocked from an HTTPS page`),this.rejectConnect?.(Error(`WebSocket connection to ${this.url} was replaced`)),this.rejectConnect=void 0,this.socket?.close(),this.opened=!1,this.closed=!1,new Promise((e,t)=>{let n=new WebSocket(this.url,this.protocols);this.socket=n,this.rejectConnect=t,n.addEventListener(`open`,()=>{if(this.socket===n){this.opened=!0,this.rejectConnect=void 0;for(let e of this.outbox)n.send(e);this.outbox=[],e()}}),n.addEventListener(`message`,e=>{this.socket===n&&this.receiveFrame(e.data,n)}),n.addEventListener(`error`,()=>{if(this.socket!==n)return;let e=Error(`WebSocket connection to ${this.url} failed`);this.opened?this.emitClose(e):t(e)}),n.addEventListener(`close`,()=>{this.socket===n&&(this.opened?this.closed||this.emitClose(Error(`WebSocket connection to ${this.url} closed`)):t(Error(`WebSocket to ${this.url} closed before opening`)))})})):Promise.reject(Error(`Invalid WebSocket URL: ${this.url||`(empty)`}`))}send(t){if(this.closed)return;let n=JSON.stringify(t);this.socket&&this.socket.readyState===WebSocket.OPEN?this.socket.send(n):this.outbox.length<e.OUTBOX_LIMIT&&this.outbox.push(n)}onMessage(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}onClose(e){return this.closeHandlers.add(e),()=>{this.closeHandlers.delete(e)}}close(){this.rejectConnect?.(Error(`WebSocket to ${this.url} closed`)),this.rejectConnect=void 0,this.closed=!0,this.opened=!1,this.handlers.clear(),this.closeHandlers.clear(),this.outbox=[],this.socket?.close(),this.socket=void 0}receiveFrame(e,t){if(e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`){this.dispatchFrame(new TextDecoder().decode(e));return}if(typeof Blob<`u`&&e instanceof Blob){e.text().then(e=>{this.socket===t&&this.dispatchFrame(e)});return}this.dispatchFrame(String(e))}dispatchFrame(e){if(this.closed)return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t;for(let e of this.handlers)try{e(n)}catch(e){console.error(`WebSocket message handler failed`,e)}}emitClose(e){this.opened=!1,this.closed=!0;for(let t of this.closeHandlers)try{t(e)}catch(e){console.error(`WebSocket close handler failed`,e)}}},kd=console.log,Ad=2**31-1;function jd(){return String(Date.now()+Math.random())}function Md(e){return e!=null&&typeof e.command==`string`}function Nd(e,t){return e.line===t.line?e.character-t.character:e.line-t.line}function Pd(e,t){let n=Nd(e.start,e.end)===0,r=Nd(t.start,t.end)===0;return n||r?Nd(e.start,t.end)<=0&&Nd(t.start,e.end)<=0:Nd(e.start,t.end)<0&&Nd(t.start,e.end)<0}function Fd(e,t){if(Md(e))return!0;let n=e.diagnostics;return!n||n.length===0||n.some(e=>Pd(e.range,t.range))}function Id(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`||t.protocol===`mailto:`}var Ld=Cn.define(),Rd=cn.define({create:()=>new Map,update(e,t){let n=e;for(let r of t.effects)if(r.is(Ld)){n===e&&(n=new Map(e));for(let e of[...n.keys()])e.startsWith(`${r.value.pluginId}:`)&&n.delete(e);for(let[e,t]of r.value.anchors)n.set(e,t)}if(t.docChanged&&n.size>0){n===e&&(n=new Map(e));for(let[e,r]of n)n.set(e,{from:t.changes.mapPos(r.from,1),to:t.changes.mapPos(r.to,r.from===r.to?1:-1)})}return n}}),zd=Cn.define(),Bd=cn.define({create:()=>null,update(e,t){for(let e of t.effects)if(e.is(zd))return e.value;if(e&&t.docChanged){let n=t.changes.mapPos(e.pos),r=e.end==null?void 0:t.changes.mapPos(e.end);return{...e,pos:n,end:r}}return e},provide:e=>mn.from(e)}),Vd=tr.define(),Hd=20,Ud=new WeakMap;function Wd(e,t){let n=Ud.get(e);n?n.push(t):Ud.set(e,[t])}function Gd(e,t){let n=Ud.get(e);if(!n)return;let r=n.indexOf(t);r!==-1&&n.splice(r,1),n.length===0&&Ud.delete(e)}var Kd=class{documentVersion;pluginId;pendingDocumentChanges=new Set;client;documentUri;languageId;view;allowHTMLContent;useSnippetOnCompletion;clientSideFiltering;sendIncrementalChanges;featureOptions;onGoToDefinition;onShowLocation;markdownRenderer;codeActionsConfig;disposeListener;destroyed=!1;documentOpened=!1;documentTextSnapshotted=!1;documentOpenCarriedText=!0;documentReady;signatureHelpRequestId=0;closeCodeActionMenu;closeRenamePopup;constructor(e){let{client:t,documentUri:n,languageId:r,view:i,featureOptions:a,sendIncrementalChanges:o=!0,allowHTMLContent:s=!1,useSnippetOnCompletion:c=!1,clientSideFiltering:l=!1,onGoToDefinition:u,onShowLocation:d,markdownRenderer:f=_u,codeActionsConfig:p}=e;this.documentVersion=0,this.pluginId=jd(),this.client=t,this.documentUri=n,this.languageId=r,this.view=i,this.allowHTMLContent=s,this.useSnippetOnCompletion=c,this.clientSideFiltering=l,this.sendIncrementalChanges=o,this.featureOptions=a,this.onGoToDefinition=u,this.onShowLocation=d,this.markdownRenderer=f,this.codeActionsConfig=p,Wd(i,this),this.disposeListener=t.onNotification(this.processNotification.bind(this)),this.documentReady=this.initialize().catch(e=>{console.error(`Language server initialization failed`,e)})}update({state:e,docChanged:t,startState:{doc:n},changes:r}){if(!t)return;let i=this.resolveTextDocumentSyncKind();i!==fu.TextDocumentSyncKind.None&&(this.sendIncrementalChanges&&i===fu.TextDocumentSyncKind.Incremental?this.trackDocumentChanges(zu(n,r)):this.trackDocumentChanges([{text:e.doc.toString()}]))}trackDocumentChanges(e){let t=this.sendChanges(e);this.pendingDocumentChanges.add(t),t.finally(()=>this.pendingDocumentChanges.delete(t))}destroy(){this.destroyed=!0,this.disposeListener?.(),this.disposeListener=void 0,this.closeCodeActionMenu?.(),this.closeRenamePopup?.(),this.view.state.field(Rd,!1)&&this.view.dispatch({effects:Ld.of({pluginId:this.pluginId,anchors:new Map})}),Gd(this.view,this),this.closeDocument()}closeDocument(){this.documentOpened&&this.client.ready&&(this.documentOpened=!1,Promise.resolve(this.client.textDocumentDidClose({textDocument:{uri:this.documentUri}})).catch(e=>{console.error(`Failed to send didClose`,e)}))}async initialize({documentText:e}={}){if(this.client.initializePromise&&await this.client.initializePromise,this.destroyed)return;let t=e??this.view.state.doc.toString();this.documentTextSnapshotted=!0;let n=await this.client.textDocumentDidOpen({textDocument:{uri:this.documentUri,languageId:this.languageId,text:t,version:this.documentVersion}});this.documentOpenCarriedText=n!==!1,this.documentOpened=!0,this.destroyed&&this.closeDocument()}resolveTextDocumentSyncKind(){let e=this.client.capabilities?.textDocumentSync;return e==null?this.sendIncrementalChanges?fu.TextDocumentSyncKind.Incremental:fu.TextDocumentSyncKind.Full:typeof e==`number`?e:e.change??fu.TextDocumentSyncKind.None}async sendChanges(e){let t=this.documentTextSnapshotted;if(!(!this.documentOpened&&(await this.documentReady,!t&&this.documentOpenCarriedText))&&this.client.ready)try{await this.client.textDocumentDidChange({textDocument:{uri:this.documentUri,version:++this.documentVersion},contentChanges:e})}catch(e){console.error(e)}}async documentDidSave(e=fu.TextDocumentSaveReason.Manual){if(!this.client.ready||(await Promise.all(this.pendingDocumentChanges),this.destroyed||!this.client.ready))return;let t=this.client.capabilities?.textDocumentSync,n=typeof t==`object`&&t?t:void 0;if(n?.willSave){try{await this.client.textDocumentWillSave({textDocument:{uri:this.documentUri},reason:e})}catch(e){console.error(`Failed to send willSave`,e)}if(this.destroyed||!this.client.ready)return}if(n?.willSaveWaitUntil){try{let t=await this.client.textDocumentWillSaveWaitUntil({textDocument:{uri:this.documentUri},reason:e});t&&t.length>0&&!this.destroyed&&(this.applyEdits(this.view,t),await Promise.all(this.pendingDocumentChanges))}catch(e){console.error(`Failed during willSaveWaitUntil`,e)}if(this.destroyed||!this.client.ready)return}let r=n?.save;if(r==null||r===!1)return;let i=typeof r==`object`&&r.includeText;try{await this.client.textDocumentDidSave({textDocument:{uri:this.documentUri},text:i?this.view.state.doc.toString():void 0})}catch(e){console.error(`Failed to send didSave`,e)}}requestDiagnostics(e){this.sendChanges([{text:e.state.doc.toString()}])}async requestHoverTooltip(e,{line:t,character:n}){if(!this.featureOptions.hoverEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/hover`)))return null;let r;try{r=await this.client.textDocumentHover({textDocument:{uri:this.documentUri},position:{line:t,character:n}})}catch{return null}if(!r)return null;let{contents:i,range:a}=r,o=pu(e.state.doc,{line:t,character:n}),s;if(a&&(o=pu(e.state.doc,a.start),s=pu(e.state.doc,a.end)),o==null||Iu(i))return null;let c=document.createElement(`div`);return c.classList.add(`documentation`,`cm-lsp-hover-tooltip`),Eu(c,i,{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),{pos:o,end:s,create:e=>({dom:c}),above:!0}}async requestCompletion(e,{line:t,character:n},{triggerKind:r,triggerCharacter:i}){if(!this.featureOptions.completionEnabled||(await Promise.all(this.pendingDocumentChanges),!(this.client.ready&&this.client.hasCapability(`textDocument/completion`))))return null;let a;try{a=await this.client.textDocumentCompletion({textDocument:{uri:this.documentUri},position:{line:t,character:n},context:{triggerKind:r,triggerCharacter:i}})}catch{return null}if(!a)return null;let o=Au(a)?a:{isIncomplete:!1,items:a};if(!Array.isArray(o.items))return null;let s=o.items.map(e=>Wu(e,o.itemDefaults)),c=this.clientSideFiltering&&!o.isIncomplete,l=Ou(s),u=l?e.matchBefore(l)??e.matchBefore(/[a-zA-Z0-9_]+/):e.matchBefore(/[a-zA-Z0-9_]+/),{pos:d}=e,f=od(s,u?.text,this.languageId,!c);u&&(d=u.from);let p=f.map(e=>ad(e,{allowHTMLContent:this.allowHTMLContent,useSnippetOnCompletion:this.useSnippetOnCompletion,hasResolveProvider:this.client.capabilities?.completionProvider?.resolveProvider??!1,resolveItem:this.client.completionItemResolve.bind(this.client)}));return c?{from:d,options:p,validFor:/^\w*$/}:{from:d,options:p,filter:!1}}async requestDefinition(e,{line:t,character:n}){if(!this.featureOptions.definitionEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/definition`)))return;let r;try{r=await this.client.textDocumentDefinition({textDocument:{uri:this.documentUri},position:{line:t,character:n}})}catch{return}if(!r||this.destroyed)return;let i=Array.isArray(r)?r:[r];if(i.length===0)return;let a=i[0];if(!a||typeof a!=`object`)return;let o=`uri`in a&&typeof a.uri==`string`?a.uri:`targetUri`in a&&typeof a.targetUri==`string`?a.targetUri:void 0,s=`range`in a?a.range:`targetRange`in a?a.targetRange:void 0;if(!(o&&s?.start&&s.end))return;let c=o!==this.documentUri,l={uri:o,range:s,isExternalDocument:c};if(!c){let t=pu(e.state.doc,s.start),n=pu(e.state.doc,s.end);if(t==null||n==null||t>n)return;e.dispatch(e.state.update({selection:{anchor:t,head:n}}))}return this.onGoToDefinition&&this.onGoToDefinition(l),l}processNotification(e){try{e.method===`textDocument/publishDiagnostics`&&e.params&&this.processDiagnostics(e.params).catch(e=>kd(e))}catch(e){kd(e)}}lastSeenDiagnosticsVersion=null;async processDiagnostics(e){if(!e||e.uri!==this.documentUri||!Array.isArray(e.diagnostics))return;if(e.version!=null){if(typeof e.version!=`number`||!Number.isInteger(e.version)||e.version<0||e.version>Ad||this.lastSeenDiagnosticsVersion!=null&&e.version<this.lastSeenDiagnosticsVersion)return;this.lastSeenDiagnosticsVersion=e.version}else if(this.lastSeenDiagnosticsVersion!=null)return;if(!this.featureOptions.diagnosticsEnabled){this.clearDiagnostics();return}let t={[fu.DiagnosticSeverity.Error]:`error`,[fu.DiagnosticSeverity.Warning]:`warning`,[fu.DiagnosticSeverity.Information]:`info`,[fu.DiagnosticSeverity.Hint]:`hint`},n=this.view.state.doc,r=e.diagnostics.filter(e=>{if(!e||typeof e!=`object`||!e.range||typeof e.message!=`string`&&(typeof e.message!=`object`||e.message===null||typeof e.message.value!=`string`))return!1;let t=pu(n,e.range.start),r=pu(n,e.range.end);return t!=null&&r!=null&&t<=r});if(e.diagnostics.length>0&&r.length===0)return;let i=[];try{i=await this.requestCodeActionsForDiagnostics(r)??[]}catch(e){console.error(`Failed to fetch code actions`,e)}if(this.destroyed||e.version!=null&&this.lastSeenDiagnosticsVersion!=null&&e.version<this.lastSeenDiagnosticsVersion||this.view.state.doc!==n)return;let a=new Map,o=r.map((e,r)=>{let{range:o,message:s,severity:c,code:l,source:u,tags:d}=e,f=pu(n,o.start),p=pu(n,o.end);if(f==null||p==null||f>p)return null;e.relatedInformation?.forEach((e,t)=>{if(e.location.uri!==this.documentUri)return;let i=pu(n,e.location.range.start),o=pu(n,e.location.range.end);i!=null&&o!=null&&a.set(`${this.pluginId}:${r}:${t}`,{from:i,to:o})});let m=i.filter(t=>Fd(t,e)).map(e=>({name:`command`in e&&typeof e.command==`object`&&e.command?.title||e.title,apply:()=>{this.applyCodeAction(e)}})),h=u||this.languageId,g=l!=null&&l!==``?`${h}(${l})`:h,_=[this.pluginId];return d?.includes(fu.DiagnosticTag.Unnecessary)&&_.push(`cm-lsp-unnecessary`),d?.includes(fu.DiagnosticTag.Deprecated)&&_.push(`cm-lsp-deprecated`),{from:f,to:p,severity:t[c??fu.DiagnosticSeverity.Error]??`error`,message:Nu(s),renderMessage:t=>this.renderDiagnosticMessage(t,e,r),source:g,markClass:_.join(` `),actions:m.length>0?m:void 0,lspDiagnostic:e}});this.setOwnDiagnostics(o.filter(e=>e!=null),a)}setOwnDiagnostics(e,t=new Map){let n=this.view.state,r=[];_r(n,(e,t,n)=>{this.ownsDiagnostic(e)||r.push({...e,from:t,to:n})});let i=ur(n,[...r,...e]),a=i.effects,o=Array.isArray(a)?[...a]:a?[a]:[];o.push(Ld.of({pluginId:this.pluginId,anchors:t})),this.view.dispatch({...i,effects:o})}ownsDiagnostic(e){return e.markClass?.split(` `).includes(this.pluginId)??!1}renderDiagnosticMessage(e,t,n){let{message:r,code:i,source:a,codeDescription:o,relatedInformation:s}=t,c=document.createElement(`div`);c.classList.add(`cm-lsp-diagnostic-message`);let l=document.createElement(`div`);if(Eu(l,{kind:`markdown`,value:Nu(r)},{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),c.appendChild(l),o?.href&&Id(o.href)){let e=a||this.languageId,t=i!=null&&i!==``?`${e}(${i})`:e,n=document.createElement(`a`);n.className=`cm-diagnostic-code-link`,n.href=o.href,n.target=`_blank`,n.rel=`noopener noreferrer`,n.textContent=t,c.appendChild(n)}if(s&&s.length>0){let t=document.createElement(`div`);t.className=`cm-diagnostic-related`,s.forEach((r,i)=>{t.appendChild(this.renderRelatedInformation(e,r,`${this.pluginId}:${n}:${i}`))}),c.appendChild(t)}return c}renderRelatedInformation(e,t,n){let{location:r,message:i}=t,{uri:a,range:o}=r,s=a!==this.documentUri,c=()=>{if(s)return null;let t=e.state.field(Rd,!1)?.get(n);if(t)return t;let r=pu(e.state.doc,o.start);return r==null?null:{from:r,to:pu(e.state.doc,o.end)??r}},l=document.createElement(`div`);l.className=`cm-diagnostic-related-item`;let u=document.createElement(`span`);u.className=`cm-diagnostic-related-message`,u.textContent=i,l.appendChild(u);let d=c(),f=d&&!s?mu(e.state.doc,d.from):o.start,p=document.createElement(`span`);if(p.className=`cm-diagnostic-related-location`,p.textContent=` ${a}:${f.line+1}:${f.character+1}`,l.appendChild(p),!s||this.onShowLocation){l.classList.add(`cm-diagnostic-related-clickable`),l.setAttribute(`role`,`button`),l.tabIndex=0;let t=()=>{if(s){this.onShowLocation?.({uri:a,range:o,isExternalDocument:s});return}let t=c();t!=null&&e.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0})};l.addEventListener(`click`,t),l.addEventListener(`keydown`,e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())})}return l}clearDiagnostics(){this.setOwnDiagnostics([])}async requestCodeActionsForDiagnostics(e){let t=e[0];if(!t||!this.featureOptions.codeActionsEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/codeAction`)))return null;let n=t.range.start,r=t.range.end;for(let t of e)Nd(t.range.start,n)<0&&(n=t.range.start),Nd(t.range.end,r)>0&&(r=t.range.end);return await this.client.textDocumentCodeAction({textDocument:{uri:this.documentUri},range:{start:n,end:r},context:{diagnostics:e}})}async requestCodeActions(e,t,n){return!this.featureOptions.codeActionsEnabled||!(this.client.ready&&this.client.hasCapability(`textDocument/codeAction`))?null:await this.client.textDocumentCodeAction({textDocument:{uri:this.documentUri},range:t,context:{diagnostics:this.diagnosticsInRange(e,t),...n?{only:n}:{}}})}async requestCodeActionsAtSelection(e){let{from:t,to:n}=e.state.selection.main;return await this.requestCodeActions(e,{start:mu(e.state.doc,t),end:mu(e.state.doc,n)})}diagnosticsInRange(e,t){let n=e.state.doc,r=pu(n,t.start),i=pu(n,t.end);if(r==null||i==null)return[];let a={error:fu.DiagnosticSeverity.Error,warning:fu.DiagnosticSeverity.Warning,info:fu.DiagnosticSeverity.Information,hint:fu.DiagnosticSeverity.Hint},o=[];return _r(e.state,(e,t,s)=>{if(t>i||s<r)return;let c={start:mu(n,t),end:mu(n,s)},l=e.lspDiagnostic;l?o.push({...l,range:c}):o.push({range:c,message:e.message,severity:a[e.severity],source:e.source})}),o}async applyCodeAction(e){let t=await this.resolveCodeAction(e);if(!this.destroyed){if(Md(t)){kd(`Executing command:`,t);return}t.edit&&await this.applyWorkspaceEdit(this.view,t.edit),t.command?kd(`Executing command:`,t.command):t.edit||Fu(this.view,`Code action "${e.title}" has nothing to apply`)}}async resolveCodeAction(e){if(Md(e)||e.edit||e.command||!this.serverSupportsCodeActionResolve())return e;try{return await this.client.codeActionResolve(e)??e}catch(t){return console.error(`Failed to resolve code action`,t),e}}serverSupportsCodeActionResolve(){let e=this.client.capabilities?.codeActionProvider;if(typeof e==`object`&&e.resolveProvider)return!0;for(let e of this.client.dynamicCapabilities.values())if(e.method===`textDocument/codeAction`&&e.registerOptions?.resolveProvider)return!0;return!1}async showCodeActionsMenu(e){let t=e.state,n=await this.requestCodeActionsAtSelection(e);if(this.destroyed||e.state.doc!==t.doc||!e.state.selection.main.eq(t.selection.main))return!1;if(!n||n.length===0)return Fu(e,`No code actions available`),!1;let r=async e=>{await this.applyCodeAction(e)};return this.codeActionsConfig?.renderMenu?(this.codeActionsConfig.renderMenu(n,r),!0):(this.showDefaultCodeActionsMenu(e,n,r),!0)}showDefaultCodeActionsMenu(e,t,n){this.closeCodeActionMenu?.();let r=document.createElement(`div`);r.className=`cm-code-action-menu`,r.setAttribute(`role`,`listbox`),r.style.cssText=`position: absolute; display: flex; flex-direction: column; padding: 2px; background: white; border: 1px solid #ddd; box-shadow: 0 2px 8px rgba(0,0,0,.15); z-index: 99;`;let i=e=>{r.contains(e.target)||a()},a=()=>{this.closeCodeActionMenu===a&&(this.closeCodeActionMenu=void 0),r.remove(),document.removeEventListener(`mousedown`,i)};this.closeCodeActionMenu=a;let o=t.map(t=>{let i=document.createElement(`button`);i.type=`button`,i.className=`cm-code-action-item`,i.style.cssText=`display: flex; gap: 8px; align-items: baseline; padding: 4px 8px; border: none; background: none; text-align: left; cursor: pointer; font: inherit;`;let o=document.createElement(`span`);if(o.textContent=t.title,i.appendChild(o),!Md(t)&&t.kind){let e=document.createElement(`span`);e.className=`cm-code-action-kind`,e.style.cssText=`color: #888; font-size: 85%; margin-left: auto;`,e.textContent=t.kind,i.appendChild(e)}return!Md(t)&&t.disabled&&(i.disabled=!0,i.title=t.disabled.reason,i.style.opacity=`0.5`,i.style.cursor=`default`),i.addEventListener(`click`,()=>{a(),e.focus(),n(t)}),r.appendChild(i),i}),s=o.findIndex(e=>!e.disabled),c=e=>{s=e,o[e]?.focus()},l=e=>{for(let t=s+e;t>=0&&t<o.length;t+=e)if(!o[t]?.disabled){c(t);return}};r.tabIndex=-1,r.addEventListener(`keydown`,t=>{if(t.key===`Escape`)a(),e.focus();else if(t.key===`ArrowDown`)l(1);else if(t.key===`ArrowUp`)l(-1);else if(t.key===`Enter`){let e=o[s];e&&!e.disabled&&e.click()}else return;t.preventDefault(),t.stopPropagation()});let u=e.coordsAtPos(e.state.selection.main.from);u&&(r.style.left=`${u.left+window.scrollX}px`,r.style.top=`${u.bottom+window.scrollY+5}px`),document.addEventListener(`mousedown`,i),document.body.appendChild(r),s===-1?r.focus():c(s)}async requestRename(e,{line:t,character:n}){if(this.featureOptions.renameEnabled){if(!this.client.ready){Fu(e,`Language server not ready`);return}if(!this.client.hasCapability(`textDocument/rename`)){Fu(e,`Rename not supported by language server`);return}try{let r=await this.client.textDocumentPrepareRename({textDocument:{uri:this.documentUri},position:{line:t,character:n}}).catch(()=>this.prepareRenameFallback(e,{line:t,character:n}));if(!r){Fu(e,`Cannot rename this symbol`);return}let i;if(`defaultBehavior`in r){if(!r.defaultBehavior){Fu(e,`Cannot rename this symbol`);return}let a=this.prepareRenameFallback(e,{line:t,character:n});if(!a){Fu(e,`Cannot rename this symbol`);return}i=a}else i=r;let a=document.createElement(`div`);a.className=`cm-rename-popup`,a.style.cssText=`position: absolute; padding: 4px; background: white; border: 1px solid #ddd; box-shadow: 0 2px 8px rgba(0,0,0,.15); z-index: 99;`;let o=document.createElement(`input`);o.type=`text`,o.style.cssText=`width: 200px; padding: 4px; border: 1px solid #ddd;`;let s=`range`in i?i.range:i,c=pu(e.state.doc,s.start);if(c==null)return;let l=pu(e.state.doc,s.end);o.value=`placeholder`in i?i.placeholder:l==null?``:e.state.doc.sliceString(c,l);let u=o.value;a.appendChild(o);let d=e.coordsAtPos(c);if(!d)return;a.style.left=`${d.left}px`,a.style.top=`${d.bottom+5}px`;let f=e=>{a.contains(e.target)||p()},p=()=>{a.remove(),document.removeEventListener(`mousedown`,f),this.closeRenamePopup===p&&(this.closeRenamePopup=void 0)},m=async()=>{let r=o.value.trim();if(!r){Fu(e,`New name cannot be empty`),p();return}if(/[\r\n]/.test(r)){Fu(e,`New name must be a single line`),p();return}if(r===u){p();return}try{let i=e.state.doc,a=await this.client.textDocumentRename({textDocument:{uri:this.documentUri},position:{line:t,character:n},newName:r});if(this.destroyed||e.state.doc!==i)return;await this.applyRenameEdit(e,a)}catch(t){Fu(e,`Rename failed: ${t instanceof Error?t.message:`Unknown error`}`)}finally{p()}};o.addEventListener(`keydown`,e=>{e.key===`Enter`?m():e.key===`Escape`&&p(),e.stopPropagation()}),this.closeRenamePopup?.(),this.closeRenamePopup=p,document.addEventListener(`mousedown`,f),document.body.appendChild(a),o.focus(),o.select()}catch(t){Fu(e,`Rename failed: ${t instanceof Error?t.message:`Unknown error`}`)}}}async requestSignatureHelp(e,{line:t,character:n},r=void 0){if(!(this.featureOptions.signatureHelpEnabled&&this.client.ready&&this.client.hasCapability(`textDocument/signatureHelp`)))return null;try{let i=await this.client.textDocumentSignatureHelp({textDocument:{uri:this.documentUri},position:{line:t,character:n},context:{isRetrigger:!1,triggerKind:1,triggerCharacter:r}});if(!i?.signatures||i.signatures.length===0)return null;let a=this.createTooltipContainer(),o=i.activeSignature??0,s=i.signatures[o]||i.signatures[0];if(!s)return null;let c=i.activeParameter??s.activeParameter??0,l=this.createSignatureElement(s,c);a.appendChild(l),s.documentation&&a.appendChild(this.createDocumentationElement(s.documentation));let u=s.parameters?.[c];u?.documentation&&a.appendChild(this.createParameterDocElement(u.documentation));let d=pu(e.state.doc,{line:t,character:n});return d==null?null:{pos:d,end:d,create:e=>({dom:a}),above:this.featureOptions.signatureHelpOptions?.position===`above`}}catch(e){return console.error(`Signature help error:`,e),null}}async showSignatureHelpTooltip(e,t,n){let r=++this.signatureHelpRequestId,i=await this.requestSignatureHelp(e,mu(e.state.doc,t),n);this.destroyed||r!==this.signatureHelpRequestId||e.dispatch({effects:zd.of(i)})}createTooltipContainer(){let e=document.createElement(`div`);return e.classList.add(`cm-signature-help`),e.style.cssText=`padding: 6px; max-width: 400px;`,e}createSignatureElement(e,t){let n=document.createElement(`div`);if(n.classList.add(`cm-signature`),n.style.cssText=`font-family: monospace; margin-bottom: 4px;`,!e.label||typeof e.label!=`string`)return n.textContent=`Signature information unavailable`,n;let r=e.label,i=e.parameters||[];if(i.length===0||!i[t])return n.textContent=r,n;let a=i[t].label;if(typeof a==`string`){let e=r.indexOf(`(`)+1;for(let n=0;n<t;n++){let t=i[n]?.label;if(typeof t==`string`){let n=r.indexOf(t,e);n!==-1&&(e=n+t.length)}}let o=r.indexOf(a,e);o===-1?n.textContent=r:this.applyRangeHighlighting(n,r,o,o+a.length)}else Array.isArray(a)&&a.length===2?this.applyRangeHighlighting(n,r,a[0],a[1]):n.textContent=r;return n}applyRangeHighlighting(e,t,n,r){if(!(Number.isInteger(n)&&Number.isInteger(r))||n<0||r<0||n>t.length||r>t.length){e.textContent=t;return}let i=Math.min(n,r),a=Math.max(n,r);if(i===a){e.textContent=t;return}e.textContent=``;let o=t.substring(0,i),s=t.substring(i,a),c=t.substring(a);e.appendChild(document.createTextNode(o));let l=document.createElement(`span`);l.classList.add(`cm-signature-active-param`),l.style.cssText=`font-weight: bold; text-decoration: underline;`,l.textContent=s,e.appendChild(l),e.appendChild(document.createTextNode(c))}createDocumentationElement(e){let t=document.createElement(`div`);return t.classList.add(`cm-signature-docs`),t.style.cssText=`margin-top: 4px; color: #666;`,Eu(t,e,{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),t}createParameterDocElement(e){let t=document.createElement(`div`);return t.classList.add(`cm-parameter-docs`),t.style.cssText=`margin-top: 4px; font-style: italic; border-top: 1px solid #eee; padding-top: 4px;`,Eu(t,e,{allowHTMLContent:this.allowHTMLContent,markdownRenderer:this.markdownRenderer}),t}prepareRenameFallback(e,{line:t,character:n}){let r=e.state.doc.line(t+1).text,i=/\w+/g,a,o=n,s=n;for(;(a=i.exec(r))!==null;){let e=a.index,t=a.index+a[0].length;if(n>=e&&n<=t){o=e,s=t;break}}return o===n&&s===n?null:{range:{start:{line:t,character:o},end:{line:t,character:s}},placeholder:r.slice(o,s)}}applyEdits(e,t){let n=e.state.doc,r=[];for(let e of t){if(!e||typeof e!=`object`||!e.range||typeof e.newText!=`string`)return!1;let t=pu(n,e.range.start),i=pu(n,e.range.end);if(t==null||i==null||t>i)return!1;r.push({from:t,to:i,insert:e.newText})}if(r.length===0)return!1;let i=[...r].sort((e,t)=>e.from-t.from||e.to-t.to);for(let t=1;t<i.length;t++){let n=i[t-1],r=i[t];if(n&&r&&(r.from<n.to||r.from===r.to&&n.from===n.to&&r.from===n.from))return Fu(e,`Workspace edit ranges overlap`),!1}return e.dispatch(e.state.update({changes:r})),!0}async applyWorkspaceEdit(e,t){if(!t)return Fu(e,`No edit returned from language server`),!1;let n=t.changes&&typeof t.changes==`object`?t.changes:{},r=Array.isArray(t.documentChanges)?t.documentChanges:[];if(Object.keys(n).length===0&&r.length===0)return Fu(e,`No changes to apply`),!1;if(r.length>0){let t=[];for(let n of r){if(typeof n!=`object`||!n||!(`textDocument`in n))return Fu(e,`File creation, deletion, or renaming operations not supported yet`),!1;if(typeof n.textDocument!=`object`||n.textDocument===null)return Fu(e,`Malformed workspace edit`),!1;if(n.textDocument.uri!==this.documentUri)return Fu(e,`Multi-file edits not supported yet`),!1;if(n.textDocument.version!=null&&n.textDocument.version!==this.documentVersion)return Fu(e,`Workspace edit is stale because the document changed`),!1;if(!Array.isArray(n.edits))return!1;for(let r of n.edits){if(typeof r!=`object`||!r||!(`newText`in r))return Fu(e,`Snippet edits not supported yet`),!1;t.push(r)}}return t.length!==0&&this.applyEdits(e,t)}let i=Object.entries(n);if(i.some(([e])=>e!==this.documentUri))return Fu(e,`Multi-file edits not supported yet`),!1;let a=i[0]?.[1];return Array.isArray(a)?this.applyEdits(e,a):!1}async applyRenameEdit(e,t){return this.applyWorkspaceEdit(e,t)}};function qd(e){let t={rename:`F2`,goToDefinition:`F12`,signatureHelp:`Mod-Shift-Space`,codeActions:`Mod-.`,...e.keyboardShortcuts},n=e.client,r={diagnosticsEnabled:!0,hoverEnabled:!0,completionEnabled:!0,definitionEnabled:!0,renameEnabled:!0,codeActionsEnabled:!0,signatureHelpEnabled:!0,signatureActivateOnTyping:!1,signatureHelpOptions:{position:`below`},...e},i=Zn.define(t=>new Kd({client:n,documentUri:e.documentUri??t.state.facet(gd),languageId:e.languageId??t.state.facet(_d),view:t,featureOptions:r,sendIncrementalChanges:e.sendIncrementalChanges,allowHTMLContent:e.allowHTMLContent,useSnippetOnCompletion:e.useSnippetOnCompletion,clientSideFiltering:e.clientSideFiltering,onGoToDefinition:e.onGoToDefinition,onShowLocation:e.onShowLocation,markdownRenderer:e.markdownRenderer,codeActionsConfig:e.codeActionsConfig})),a=e=>e.plugin(i),o=[i];if(r.diagnosticsEnabled&&o.push(Rd,Jn.baseTheme({".cm-lsp-unnecessary":{opacity:`0.6`},".cm-lsp-deprecated":{textDecoration:`line-through`},".cm-diagnostic-related":{marginTop:`4px`,display:`flex`,flexDirection:`column`,gap:`2px`},".cm-diagnostic-related-clickable":{cursor:`pointer`},".cm-diagnostic-related-location":{opacity:`0.7`},".cm-diagnostic-code-link":{display:`inline-block`,marginTop:`4px`}})),o.push(pn.of([{key:t.signatureHelp,run:e=>{let t=a(e);if(!(t&&r.signatureHelpEnabled))return!1;let n=e.state.selection.main.head;return t.showSignatureHelpTooltip(e,n),!0}},{key:t.rename,run:e=>{let t=a(e);if(!(t&&r.renameEnabled))return!1;let n=e.state.selection.main.head;return t.requestRename(e,mu(e.state.doc,n)),!0}},{key:t.codeActions,run:e=>{let t=a(e);return t&&r.codeActionsEnabled?(t.showCodeActionsMenu(e).catch(t=>Fu(e,`Code actions failed: ${t instanceof Error?t.message:`Unknown error`}`)),!0):!1}},{key:t.goToDefinition,run:e=>{let t=a(e);if(!(t&&r.definitionEnabled))return!1;let n=e.state.selection.main.head;return t.requestDefinition(e,mu(e.state.doc,n)).catch(t=>Fu(e,`Go to definition failed: ${t instanceof Error?t.message:`Unknown error`}`)),!0}}])),r.hoverEnabled&&o.push(En((e,t)=>{let n=a(e);return n==null?null:n.requestHoverTooltip(e,mu(e.state.doc,t))},e.hoverConfig)),r.signatureHelpEnabled){o.push(Bd);let e=e=>e.state.field(Bd)?(e.dispatch({effects:zd.of(null)}),!0):!1;o.push(Jn.domEventHandlers({mousedown:(t,n)=>(e(n),!1)})),o.push(pn.of([{key:`)`,run:t=>(e(t),!1)},{key:`Escape`,run:t=>e(t)}])),o.push(Jn.updateListener.of(t=>{if(!(a(t.view)&&r.signatureActivateOnTyping)||!t.state.field(Bd)||!(t.selectionSet||t.docChanged))return;let n=t.state.selection.main.head;Zd(t.state.doc,n)||queueMicrotask(()=>{e(t.view)})})),o.push(Jn.updateListener.of(async e=>{let t=a(e.view);if(!(t&&e.docChanged)||e.transactions.some(e=>e.annotation(Vd))||!t.client.hasCapability(`textDocument/signatureHelp`)||!r.signatureActivateOnTyping)return;let n=t.client.capabilities?.signatureHelpProvider?.triggerCharacters||[`(`,`,`],i=e.changes,o=-1,s;i.iterChanges((e,t,r,i,a)=>{if(o>=0)return;let c=Yd(a.toString(),r,n);c&&(o=c.triggerPos,s=c.triggerCharacter)}),o>=0&&t.showSignatureHelpTooltip(e.view,o,s)}))}if(r.completionEnabled){let t=e.completionConfig?.optionClass;o.push(Jn.baseTheme({".cm-tooltip-autocomplete li.cm-deprecated .cm-completionLabel":{textDecoration:`line-through`}}),Lr({...e.completionConfig,optionClass:e=>[Hu(e),t?.(e)??``].filter(Boolean).join(` `),override:[async t=>{let n=t.view?a(t.view):null;if(n==null)return null;let{state:r,pos:i}=t,o=Jd(t,n.client.capabilities?.completionProvider?.triggerCharacters??[],e.completionMatchBefore);return o==null?null:await n.requestCompletion(t,mu(r.doc,i),o)},...e.completionConfig?.override||[]]}))}return o.push(Jn.domEventHandlers({click:(e,n)=>{if(r.definitionEnabled&&t.goToDefinition===`ctrlcmd`&&(e.ctrlKey||e.metaKey)){let t=n.posAtCoords({x:e.clientX,y:e.clientY}),r=a(n);t&&r&&(r.requestDefinition(n,mu(n.state.doc,t)).catch(e=>Fu(n,`Go to definition failed: ${e instanceof Error?e.message:`Unknown error`}`)),e.preventDefault())}}})),o}function Jd(e,t,n){let{state:r,pos:i,explicit:a}=e,o=r.doc.lineAt(i),s=fu.CompletionTriggerKind.Invoked,c,l=o.text[i-o.from-1]||``,u=t?.includes(l);return!a&&u&&(s=fu.CompletionTriggerKind.TriggerCharacter,c=l),!a&&s===fu.CompletionTriggerKind.Invoked&&!e.matchBefore(n||/(\w+|\w+\.|\/|,)$/)?null:{triggerKind:s,triggerCharacter:c}}function Yd(e,t,n){if(!e)return null;for(let r of n){let n=e.indexOf(r);if(n!==-1)return{triggerPos:t+n+1,triggerCharacter:r}}return null}function Xd(e){let t=0;for(let n of e)n===`(`?t++:n===`)`&&t--;return t}function Zd(e,t,n=Hd){let r=e.lineAt(t),i=Math.max(1,r.number-n),a=e.line(i).from;return Xd(e.sliceString(a,t))>0}function Qd(e,t,n={}){let{preserveCursor:r=!0,effects:i,userEvent:a}=n,o=e.state.doc;if(o.toString()!==t){if(r&&e.hasFocus){let n=e.state.selection.main.head,r=o.lineAt(n),s=r.number,c=n-r.from,l=e.state.update({changes:{from:0,to:o.length,insert:t}}).state.doc,u;if(s<=l.lines){let e=l.line(s),t=e.length;u=e.from+Math.min(c,t)}else u=l.line(l.lines).to;e.dispatch({changes:{from:0,to:o.length,insert:t},annotations:Vd.of(!0),selection:{anchor:u},effects:i,userEvent:a})}else e.dispatch({changes:{from:0,to:o.length,insert:t},effects:i,userEvent:a})}}function $d(){return bn.define({combine:e=>e.find(e=>e!==void 0)})}var ef=$d(),tf=$d(),nf=$d(),rf=$d(),af=$d();function of({cellId:e,completionConfig:t,hotkeys:n,placeholderType:r,lspConfig:i,diagnosticsConfig:a}){return[rf.of(e),ef.of(t),tf.of(n),nf.of(r),af.of({...i,diagnostics:a})]}var sf=new On;function cf(e){return e===`application/vnd.marimo+error`}function lf(e){return e===`application/vnd.marimo+traceback`}function uf(e){return cf(e)||lf(e)}function df(e){return Object.values(e.cellRuntime).some(e=>e.status===`running`)}function ff(e){return Object.values(e.cellRuntime).filter(e=>e.status===`running`||e.status===`queued`).length}function pf(e){return xf(e).length>0}function mf(e){return e.cellIds.inOrderIds.map(t=>e.cellData[t])}function hf({cellHandles:e}){let t={};for(let[n,r]of z.entries(e))r.current?.editorView&&(t[n]=r.current.editorView);return t}function gf(e){let{cellIds:t,cellData:n}=e,r=[];for(let e of t.inOrderIds)n[e].config.disabled&&r.push(e);return r}function _f(e){let{cellIds:t,cellData:n}=e,r=[];for(let e of t.inOrderIds)n[e].config.disabled||r.push(e);return r}function vf(e){return e.history.length>0}function yf(e){let t=e.history[e.history.length-1];return t&&t.type===`move`?`Undo move`:`Undo cell deletion`}function bf(e,t){let n=e.cellIds.findWithId(t).getDescendants(t);return{stale:n.some(t=>e.cellRuntime[t]?.staleInputs||e.cellData[t]?.edited),errored:n.some(t=>e.cellRuntime[t]?.errored),runningOrQueued:n.some(t=>e.cellRuntime[t]?.status===`running`||e.cellRuntime[t]?.status===`queued`)}}function xf(e){let{cellIds:t,cellData:n,cellRuntime:r}=e;return t.inOrderIds.filter(e=>Sf({executionTime:r[e].runElapsedTimeMs??n[e].lastExecutionTime,status:r[e].status,errored:r[e].errored,interrupted:r[e].interrupted,stopped:r[e].stopped})||n[e].edited||r[e].interrupted||r[e].staleInputs&&!(r[e].status===`disabled-transitively`||n[e].config.disabled))}function Sf({executionTime:e,status:t,errored:n,interrupted:r,stopped:i}){return e===null&&t!==`queued`&&t!==`running`&&!(n||r||i)}function Cf({edited:e,interrupted:t,staleInputs:n,disabled:r,status:i}){return e||t||n&&!(r||i===`disabled-transitively`)}function wf({needsRun:e,errored:t,stopped:n,disabled:r,status:i}){return{"needs-run":e,"has-error":t,stopped:n,disabled:r??!1,stale:i===`disabled-transitively`}}function Tf({errored:e,stopped:t}){return{published:!0,"has-error":e,stopped:t}}function Ef({errored:e,interrupted:t,stopped:n,output:r,showErrorTracebacks:i}){let a=uf(r?.mimetype),o=i&&a&&Array.isArray(r?.data)&&r.data.some(e=>e.type===`exception`&&`traceback`in e&&e.traceback);return(e||t||n||a)&&!o}var Df=bn.define({combine:e=>e[0]}),Of=bn.define({combine:e=>e[0]}),kf={...Xr,caseInsensitiveIdentifiers:!0,identifierQuotes:"`"},Af=Qr.define(kf),jf=Qr.define({doubleQuotedStrings:!1,hashComments:!1,spaceAfterDashes:!1,identifierQuotes:`"`,caseInsensitiveIdentifiers:!0,keywords:`abs access acos aes_decrypt aggregate all allocate allow alter analyze and any approx_count_distinct approx_percentile are array array_avg array_cat array_compact array_contains array_generate_range array_max array_max_cardinality array_min array_position array_remove array_remove_at array_size array_sum array_to_string arrow as ascii asensitive asin assign asymmetric at atan atan2 atomic authorization auto avg avoid base64 batch begin begin_frame begin_partition between bigint bin bin_pack binary binary_string bit bit_and bit_length bit_or bitwise_and bitwise_not bitwise_or bitwise_xor blob bool_and bool_or boolean both branch bround btrim by cache call called cardinality cascaded case cast catalog cbrt ceil ceiling change char char_length character character_length check chr classifier clob close cloud coalesce col_like collate collect column columns commit commits_older_than compute concat concat_ws condition connect constraint contains convert convert_from convert_replaceutf8 convert_timezone convert_to copy corr corresponding cos cosh cot count covar_pop covar_samp crc32 create cross cube cume_dist current current_catalog current_date current_date_utc current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cycle data databases datasets date date_add date_diff date_format date_part date_sub date_trunc datediff datetype day dayofmonth dayofweek dayofyear deallocate dec decimal declare dedupe_lookback_period default define degrees delete dense_rank deref describe deterministic dimensions disallow disconnect display distinct double drop dynamic e each element else empty empty_as_null encode end end-exec end_frame end_partition ends_with engine equals escape escape_char every except exec execute exists exp expire explain extend external extract factorial false fetch field field_delimiter file_format files filter first_value flatten float floor folder for foreign frame_row free from from_hex full function fusion geo_beyond geo_distance geo_nearby get global grant grants greatest group grouping groups hash hash64 having hex history hold hour identity if ilike imindir import in include indicator initcap initial inner inout insensitive insert instr int integer intersect intersection interval into is is_bigint is_int is_member is_substr is_utf8 is_varchar isdate isnumeric job join json_array json_arrayagg json_exists json_object json_objectagg json_query json_value lag language large last_day last_query_id last_value lateral lazy lcase lead leading least left length levenshtein like like_regex limit listagg ln local localsort localtime localtimestamp locate log log10 logs lower lpad lshift ltrim manifests map_keys map_values mask mask_first_n mask_hash mask_last_n mask_show_first_n mask_show_last_n masking match match_number match_recognize matches max max_file_size_mb maxdir md5 measures median member merge metadata method min min_file_size_mb min_input_files mindir minus minute missing mod modifies module monitor month months_between more multiset national natural nchar nclob ndv new next next_day no none normalize normalize_string not notification_provider notification_queue_reference now nth_value ntile null null_if nullif numeric nvl occurrences_regex octet_length of offset old older_than omit on one only open operate optimize or order orphan out outer over overlaps overlay ownership parameter parse_url partition partitions pattern per percent percent_rank percentile_cont percentile_disc period permute pi pivot pmod policy portion position position_regex pow power precedes precision prepare prev primary procedure project promotion qualify quarter query query_user quote quote_char radians random range rank raw reads real record_delimiter recursive ref reference references referencing reflection reflections refresh regex regexp_col_like regexp_extract regexp_like regexp_matches regexp_replace regexp_split regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxy regr_syy release remove rename repeat repeatstr replace reset result retain_last retain_last_commits retain_last_snapshots return returns reverse revoke rewrite right role rollback rollup round route row row_number rows rpad rshift rtrim running savepoint schemas scope scroll search second seek select sensitive session_user set sha sha1 sha256 sha512 show sign similar similar_to sin sinh size skip smallint snapshot snapshots snapshots_older_than some soundex specific specifictype split_part sql sqlexception sqlstate sqlwarning sqrt st_fromgeohash st_geohash start starts_with static statistics stddev stddev_pop stddev_samp stream string_binary strpos submultiset subset substr substring substring_index substring_regex succeeds sum symmetric system system_time system_user table tables tablesample tag tan tanh target_file_size_mb tblproperties then time time_format timestamp timestamp_format timestampadd timestampdiff timestamptype timezone_hour timezone_minute tinyint to to_char to_date to_hex to_number to_time to_timestamp toascii trailing transaction_timestamp translate translate_regex translation treat trigger trim trim_array trim_space true truncate typeof ucase uescape unbase64 unhex union unique unix_timestamp unknown unnest unpivot unset update upper upsert usage use user using vacuum value value_of values var_pop var_samp varbinary varchar varying versioning view views week weekofyear when whenever where width_bucket window with within without write xor year`,types:`array bigint binary boolean char character date dec decimal double float int integer interval map numeric struct time timestamp uuid varbinary varchar variant`}),Mf=Qr.define({charSetCasts:!0,doubleQuotedStrings:!1,unquotedBitLiterals:!0,hashComments:!1,spaceAfterDashes:!1,specialVar:`@?`,identifierQuotes:`"`,caseInsensitiveIdentifiers:!0,keywords:`percentile_cont row_number rank dense_rank rank_dense percent_rank cume_dist ntile lag lead first_value last_value nth_value !__postfix !~~ !~~* % & && * ** + - ->> / // <-> << <=> <@ >> @ @> Calendar JSON TimeZone ^ ^@ abort abs absolute access access_mode acos acosh action add add_parquet_key admin after age aggregate alias all all_profiling_output allow_community_extensions allow_extensions_metadata_mismatch allow_persistent_secrets allow_unredacted_secrets allow_unsigned_extensions allowed_directories allowed_paths also alter always analyse analyze and anti any any_value apply approx_count_distinct approx_quantile approx_top_k arbitrary arg_max arg_max_null arg_min arg_min_null argmax argmin array array_agg array_aggr array_aggregate array_append array_apply array_cat array_concat array_contains array_cosine_distance array_cosine_similarity array_cross_product array_distance array_distinct array_dot_product array_extract array_filter array_grade_up array_has array_has_all array_has_any array_indexof array_inner_product array_intersect array_length array_negative_dot_product array_negative_inner_product array_pop_back array_pop_front array_position array_prepend array_push_back array_push_front array_reduce array_resize array_reverse array_reverse_sort array_select array_slice array_sort array_to_json array_to_string array_to_string_comma_default array_transform array_unique array_value array_where array_zip arrow_large_buffer_size arrow_lossless_conversion arrow_output_list_view arrow_output_version arrow_scan arrow_scan_dumb as asc ascii asin asinh asof asof_loop_join_threshold assertion assignment asymmetric at atan atan2 atanh attach attribute authorization autoinstall_extension_repository autoinstall_known_extensions autoload_known_extensions avg backward bar base64 before begin between bigint bin binary binary_as_string bit bit_and bit_count bit_length bit_or bit_position bit_xor bitstring bitstring_agg blob bool bool_and bool_or boolean both bpchar by bytea cache call called can_cast_implicitly cardinality cascade cascaded case cast cast_to_type catalog catalog_error_max_schemas cbrt ceil ceiling centuries century chain char char_length character character_length characteristics check checkpoint checkpoint_threshold chr class close cluster coalesce col_description collate collation collations column columns combine comment comments commit committed compression concat concat_ws concurrently configuration conflict connection constant_or_null constraint constraints contains content continue conversion copy copy_database corr cos cosh cost cot count count_if count_star countif covar_pop covar_samp create create_sort_key cross csv cube current current_catalog current_connection_id current_database current_date current_localtime current_localtimestamp current_query current_query_id current_role current_schema current_schemas current_setting current_transaction_id current_user currval cursor custom_extension_repository custom_profiling_settings custom_user_agent cycle damerau_levenshtein data database database_list database_size date date_add date_diff date_part date_sub date_trunc datediff datepart datesub datetime datetrunc day dayname dayofmonth dayofweek dayofyear days deallocate debug_asof_iejoin debug_checkpoint_abort debug_force_external debug_force_no_cross_product debug_skip_checkpoint_on_commit debug_verify_vector debug_window_mode dec decade decades decimal declare decode default default_block_size default_collation default_null_order default_order default_secret_storage defaults deferrable deferred definer degrees delete delimiter delimiters depends desc describe detach dictionary disable disable_checkpoint_on_shutdown disable_logging disable_object_cache disable_optimizer disable_parquet_prefetching disable_print_progress_bar disable_profile disable_profiling disable_progress_bar disable_timestamptz_casts disable_verification disable_verify_external disable_verify_fetch_row disable_verify_parallelism disable_verify_serializer disabled_compression_methods disabled_filesystems disabled_log_types disabled_optimizers discard distinct divide do document domain double drop duckdb_api duckdb_columns duckdb_constraints duckdb_databases duckdb_dependencies duckdb_extensions duckdb_external_file_cache duckdb_functions duckdb_indexes duckdb_keywords duckdb_log_contexts duckdb_logs duckdb_logs_parsed duckdb_memory duckdb_optimizers duckdb_prepared_statements duckdb_schemas duckdb_secret_types duckdb_secrets duckdb_sequences duckdb_settings duckdb_table_sample duckdb_tables duckdb_temporary_files duckdb_types duckdb_variables duckdb_views dynamic_or_filter_threshold each editdist3 element_at else enable enable_checkpoint_on_shutdown enable_external_access enable_external_file_cache enable_fsst_vectors enable_geoparquet_conversion enable_http_logging enable_http_metadata_cache enable_logging enable_macro_dependencies enable_object_cache enable_optimizer enable_print_progress_bar enable_profile enable_profiling enable_progress_bar enable_progress_bar_print enable_verification enable_view_dependencies enabled_log_types encode encoding encrypted end ends_with entropy enum enum_code enum_first enum_last enum_range enum_range_boundary epoch epoch_ms epoch_ns epoch_us equi_width_bins era error errors_as_json escape even event except exclude excluding exclusive execute exists exp explain explain_output export export_state extension extension_directory extension_versions extensions external external_threads extract factorial false family favg fdiv fetch file_search_path filter finalize first flatten float float4 float8 floor fmod following for force force_bitpacking_mode force_checkpoint force_compression foreign format formatReadableDecimalSize formatReadableSize format_bytes format_pg_type format_type forward freeze from from_base64 from_binary from_hex from_json from_json_strict fsum full function functions gamma gcd gen_random_uuid generate_series generate_subscripts generated geomean geometric_mean get_bit get_block_size get_current_time get_current_timestamp getvariable glob global grade_up grant granted greatest greatest_common_divisor group group_concat grouping grouping_id groups guid hamming handler having header hex histogram histogram_exact histogram_values hold home_directory hour hours http_logging_output http_proxy http_proxy_password http_proxy_username hugeint identity ieee_floating_point_ops if ignore ilike ilike_escape immediate immediate_transaction_mode immutable implicit import import_database in in_search_path include including increment index index_scan_max_count index_scan_percentage indexes inet_client_addr inet_client_port inet_server_addr inet_server_port inherit inherits initially inline inner inout input insensitive insert install instead instr int int1 int128 int16 int2 int32 int4 int64 int8 integer integer_division integral intersect interval into invoker is is_histogram_other_bin isfinite isinf isnan isnull isodow isolation isoyear jaccard jaro_similarity jaro_winkler_similarity join json json_array json_array_length json_contains json_deserialize_sql json_each json_execute_serialized_sql json_exists json_extract json_extract_path json_extract_path_text json_extract_string json_group_array json_group_object json_group_structure json_keys json_merge_patch json_object json_pretty json_quote json_serialize_plan json_serialize_sql json_structure json_transform json_transform_strict json_tree json_type json_valid json_value julian kahan_sum key kurtosis kurtosis_pop label lambda lambda_syntax language large last last_day late_materialization_max_rows lateral lcase lcm leading leakproof least least_common_multiple left left_grapheme len length length_grapheme level levenshtein lgamma like like_escape limit list list_aggr list_aggregate list_any_value list_append list_apply list_approx_count_distinct list_avg list_bit_and list_bit_or list_bit_xor list_bool_and list_bool_or list_cat list_concat list_contains list_cosine_distance list_cosine_similarity list_count list_distance list_distinct list_dot_product list_element list_entropy list_extract list_filter list_first list_grade_up list_has list_has_all list_has_any list_histogram list_indexof list_inner_product list_intersect list_kurtosis list_kurtosis_pop list_last list_mad list_max list_median list_min list_mode list_negative_dot_product list_negative_inner_product list_pack list_position list_prepend list_product list_reduce list_resize list_reverse list_reverse_sort list_select list_sem list_skewness list_slice list_sort list_stddev_pop list_stddev_samp list_string_agg list_sum list_transform list_unique list_value list_var_pop list_var_samp list_where list_zip listagg listen ln load local location lock lock_configuration locked log log10 log2 log_query_path logged logging_level logging_mode logging_storage logical long lower lpad ltrim macro mad make_date make_time make_timestamp make_timestamp_ns make_timestamptz map map_concat map_contains map_contains_entry map_contains_value map_entries map_extract map_extract_value map_from_entries map_keys map_to_pg_oid map_values mapping match materialized max max_by max_expression_depth max_memory max_temp_directory_size max_vacuum_tasks maxvalue md5 md5_number md5_number_lower md5_number_upper mean median memory_limit merge_join_threshold metadata_info method microsecond microseconds millennia millennium millisecond milliseconds min min_by minute minutes minvalue mismatches mod mode month monthname months move multiply name names nanosecond national natural nchar nested_loop_join_threshold new next nextafter nextval nfc_normalize no none normalized_interval not not_ilike_escape not_like_escape nothing notify notnull now nowait null null_order nullif nulls numeric nvarchar obj_description object octet_length of off offset oid oids old old_implicit_casting on only operator option options or ord order order_by_non_integer_literal ordered_aggregate_threshold ordinality others out outer over overlaps overlay overriding owned owner pandas_analyze_sample pandas_scan parallel parquet_bloom_probe parquet_file_metadata parquet_kv_metadata parquet_metadata parquet_metadata_cache parquet_scan parquet_schema parse_dirname parse_dirpath parse_duckdb_log_message parse_filename parse_path parser partial partition partitioned partitioned_write_flush_threshold partitioned_write_max_open_files passing password percent perfect_ht_threshold persistent pi pivot pivot_filter_threshold pivot_limit pivot_longer pivot_wider placing plans platform policy position positional pow power pragma pragma_collations pragma_database_size pragma_metadata_info pragma_platform pragma_show pragma_storage_info pragma_table_info pragma_user_agent pragma_version preceding precision prefer_range_joins prefetch_all_parquet_files prefix prepare prepared preserve preserve_identifier_case preserve_insertion_order primary printf prior privileges procedural procedure produce_arrow_string_view product profile_output profiling_mode profiling_output program progress_bar_time publication python_enable_replacements python_map_function python_scan_all_frames qualify quantile quantile_cont quantile_disc quarter quarters query query_table quote radians random range read read_blob read_csv read_csv_auto read_json read_json_auto read_json_objects read_json_objects_auto read_ndjson read_ndjson_auto read_ndjson_objects read_parquet read_text real reassign recheck recursive reduce ref references referencing refresh regexp_escape regexp_extract regexp_extract_all regexp_full_match regexp_matches regexp_replace regexp_split_to_array regexp_split_to_table regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release remap_struct rename repeat repeat_row repeatable replace replica reservoir_quantile reset respect restart restrict returning returns reverse revoke right right_grapheme role rollback rollup round round_even roundbankers row row_to_json rows rpad rtrim rule sample savepoint scalar_subquery_error_on_multiple_rows scheduler_process_partial schema schemas scope scroll search search_path second seconds secret secret_directory security select sem semi seq_scan sequence sequences serializable server session session_user set set_bit setof sets setseed sha1 sha256 share shobj_description short show show_databases show_tables show_tables_expanded sign signbit signed similar simple sin sinh skewness skip smallint snapshot sniff_csv some sorted split split_part sql sqrt stable standalone start starts_with statement statistics stats stddev stddev_pop stddev_samp stdin stdout storage storage_compatibility_version storage_info stored str_split str_split_regex streaming_buffer_size strftime strict string string_agg string_split string_split_regex string_to_array strip strip_accents strlen strpos strptime struct struct_concat struct_extract struct_extract_at struct_insert struct_pack subscription substr substring substring_grapheme subtract suffix sum sum_no_overflow sumkahan summarize summary symmetric sysid system table table_info tables tablesample tablespace tan tanh temp temp_directory template temporary test_all_types test_vector_types text then threads ties time time_bucket timestamp timestamp_ms timestamp_ns timestamp_s timestamp_us timestamptz timetz timetz_byte_comparable timezone timezone_hour timezone_minute tinyint to to_base to_base64 to_binary to_centuries to_days to_decades to_hex to_hours to_json to_microseconds to_millennia to_milliseconds to_minutes to_months to_quarters to_seconds to_timestamp to_weeks to_years today trailing transaction transaction_timestamp transform translate treat trigger trim true trunc truncate truncate_duckdb_logs trusted try_cast try_strptime txid_current type typeof types ubigint ucase uhugeint uint128 uint16 uint32 uint64 uint8 uinteger unbin unbounded uncommitted unencrypted unhex unicode union union_extract union_tag union_value unique unknown unlisten unlogged unnest unpack unpivot unpivot_list until update upper url_decode url_encode use user user_agent username using usmallint utinyint uuid uuid_extract_timestamp uuid_extract_version uuidv4 uuidv7 vacuum valid validate validator value values var_pop var_samp varbinary varchar variable variadic variance varint varying vector_type verbose verify_external verify_fetch_row verify_parallelism verify_serializer version view views virtual volatile wal_autocheckpoint wavg week weekday weekofyear weeks weighted_avg when where which_secret whitespace window with within without work worker_threads wrapper write write_log xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlnamespaces xmlparse xmlpi xmlroot xmlserialize xmltable xor year years yearweek yes zone zstd_min_string_length | || ~ ~~ ~~* ~~~`,types:`JSON bigint binary bit bitstring blob bool boolean bpchar bytea char date datetime dec decimal double enum float float4 float8 guid hugeint int int1 int128 int16 int2 int32 int4 int64 int8 integer integral interval list logical long map null numeric nvarchar oid real row short signed smallint string struct text time timestamp timestamp_ms timestamp_ns timestamp_s timestamp_us timestamptz timetz tinyint ubigint uhugeint uint128 uint16 uint32 uint64 uint8 uinteger union usmallint utinyint uuid varbinary varchar varint`}),Nf=new Set(`postgresql.postgres.couchbase.db2.db2i.tidb.mysql.sqlite.mssql.sqlserver.duckdb.mariadb.cassandra.noql.spark.awsathena.athena.bigquery.hive.redshift.snowflake.flink.mongodb.trino.oracle.oracledb.singlestoredb.timescaledb.databricks.datafusion.microsoft sql server.dremio`.split(`.`));function Pf(e){return Nf.has(e)}function Ff(e){let t=e.dialect;if(!Pf(t))return R.debug(`Unknown dialect`,{dialect:t}),Lf;switch(t){case`postgresql`:case`postgres`:return Xr;case`mysql`:return qr;case`sqlite`:return Wr;case`mssql`:case`sqlserver`:case`microsoft sql server`:return Yr;case`duckdb`:return Mf;case`mariadb`:return Zr;case`cassandra`:return $r;case`oracledb`:case`oracle`:return Ur;case`bigquery`:return Af;case`dremio`:return jf;case`timescaledb`:return Xr;case`awsathena`:case`athena`:case`db2i`:case`db2`:case`hive`:case`redshift`:case`snowflake`:case`flink`:case`mongodb`:case`noql`:case`couchbase`:case`trino`:case`tidb`:case`singlestoredb`:case`spark`:case`databricks`:case`datafusion`:return R.debug(`Unsupported dialect`,{dialect:t}),Lf;default:return zr(t),Lf}}var If={...Jr,caseInsensitiveIdentifiers:!0,identifierQuotes:`'`},Lf=Qr.define(If),Rf=`__marimo_duckdb`,zf=new Set([Rf]);function Bf(e,t){let n=e.schemaPath?.length?e.schemaPath:[e.schema];return[e.database,...n.filter(Boolean),t]}function Vf(e,t){return e?JSON.stringify(Bf(e,t)):t}function Hf(e,t){return e?Zf(e.dialect).formatTablePath(Bf(e,t)):t}function Uf(e){return e===``}function Wf(e){return e.schemas_resolved!==!1}function Gf(e){return e.tables_resolved!==!1}function Kf(e){return e.child_schemas_resolved!==!1}function qf(e,t){let n=t?.trim().toLowerCase();return n?Gf(e)&&e.tables.some(e=>e.name.toLowerCase().includes(n))?!0:Kf(e)?(e.child_schemas??[]).some(e=>qf(e,n)):!1:!1}function Jf(e,t){return!t?.trim()||!Wf(e)?!1:e.schemas.some(e=>qf(e,t))}var Yf={formatTablePath:e=>e.join(`.`),formatSelectClause:(e,t)=>`SELECT ${e} FROM ${t} LIMIT 100`};function Xf(e){return`"${e.replaceAll(`"`,`""`)}"`}function Zf(e){if(e=e.toLowerCase(),!Pf(e))return Yf;switch(e){case`bigquery`:{let e=Af.spec.identifierQuotes;return{formatTablePath:t=>`${e}${t.join(`.`)}${e}`,formatSelectClause:Yf.formatSelectClause}}case`mssql`:case`sqlserver`:case`microsoft sql server`:return{formatTablePath:Yf.formatTablePath,formatSelectClause:(e,t)=>`SELECT TOP 100 ${e} FROM ${t}`};case`timescaledb`:case`postgres`:case`postgresql`:case`duckdb`:case`dremio`:return{formatTablePath:e=>e.map(Xf).join(`.`),formatSelectClause:(e,t)=>`SELECT ${e===`*`?`*`:Xf(e)} FROM ${t} LIMIT 100`};case`db2`:case`db2i`:case`mysql`:case`sqlite`:case`mariadb`:case`cassandra`:case`noql`:case`awsathena`:case`athena`:case`hive`:case`redshift`:case`snowflake`:case`flink`:case`mongodb`:case`oracle`:case`oracledb`:case`couchbase`:case`tidb`:case`spark`:case`trino`:case`singlestoredb`:case`databricks`:case`datafusion`:return Yf;default:return zr(e),Yf}}function Qf({table:e,columnName:t,sqlTableContext:n}){if(n){let{engine:r,schema:i,defaultSchema:a,schemaPath:o,defaultDatabase:s,database:c,dialect:l}=n,u=[e.name];if(Uf(i))c!==s&&u.unshift(c);else{let e=o?.length?o:[i];(e.length>1||e[0]!==a)&&u.unshift(...e),(e.length>1||c!==s)&&u.unshift(c)}let d=Zf(l),f=d.formatTablePath(u),p=d.formatSelectClause(t,f);return r===`__marimo_duckdb`?`_df = mo.sql(f"""\n${p}\n""")`:`_df = mo.sql(f"""\n${p}\n""", engine=${r})`}return`_df = mo.sql(f'SELECT "${t}" FROM ${e.name} LIMIT 100')`}function $f(e,t){if(t===`date`||t===`datetime`||t===`time`){if(e===`min`)return`Earliest`;if(e===`max`)return`Latest`}return e}function ep(){return{tables:[],expandedTables:new Set,expandedColumns:new Set,columnsPreviews:new Map}}var{reducer:tp,createActions:np,valueAtom:rp,useActions:ip}=jr(ep,{addDatasets:(e,t)=>{let{previewDatasetColumn:n}=Hr();for(let r of t.tables)for(let t of r.columns){let i=`${r.name}:${t.name}`;e.expandedColumns.has(i)&&n({tableName:r.name,columnName:t.name,source:r.source,sourceType:r.source_type})}let r=e.tables;t.clear_channel&&(r=r.filter(e=>e.source!==t.clear_channel));let i=[...t.tables,...r],a=new Set,o=i.filter(e=>{let t=`${e.name}:${e.source}`;return!a.has(t)&&(a.add(t),!0)}).toSorted((e,t)=>e.name.localeCompare(t.name));return{...e,tables:o}},filterDatasetsFromVariables:(e,t)=>{let n=new Set(t),r=e.tables.filter(e=>!e.variable_name||n.has(e.variable_name));return{...e,tables:r}},toggleTable:(e,t)=>{let n=new Set(e.expandedTables);return n.has(t)?n.delete(t):n.add(t),{...e,expandedTables:n}},toggleColumn:(e,t)=>{let n=`${t.table}:${t.column}`,r=new Set(e.expandedColumns);return r.has(n)?r.delete(n):r.add(n),{...e,expandedColumns:r}},closeAllColumns:e=>({...e,expandedColumns:new Set}),addColumnPreview:(e,t)=>{let n=`${t.table_name}:${t.column_name}`,r=new Map(e.columnsPreviews);return r.set(n,t),{...e,columnsPreviews:r}}}),ap=()=>s(rp),op=o(e=>e(rp).tables),sp=o(new Set),cp=o(!1);function lp(){return ip()}var up=new Map([[Rf,{name:Rf,dialect:`duckdb`,source:`duckdb`,display_name:`DuckDB (In-Memory)`,databases:[]}]]);function dp(e,t,n){if(t.length===0)return e;let[r,...i]=t;return e.map(e=>e.name===r?i.length===0?n(e):{...e,child_schemas:dp(e.child_schemas??[],i,n)}:e)}function fp(e){let{schemaPath:t,schema:n}=e;return t&&t.length>0?t:[n]}function pp(){return{latestEngineSelected:null,connectionsMap:up}}var{reducer:mp,createActions:hp,valueAtom:gp,useActions:_p}=jr(pp,{addDataSourceConnection:(e,t)=>{if(t.connections.length===0)return e;let{latestEngineSelected:n,connectionsMap:r}=e,i=new Map(r);for(let e of t.connections)i.delete(e.name),i.set(e.name,e);return{latestEngineSelected:n,connectionsMap:i}},filterDataSourcesFromVariables:(e,t)=>{let{latestEngineSelected:n,connectionsMap:r}=e,i=new Set(t),a=new Map([...r].filter(([e])=>zf.has(e)?!0:i.has(e)));return{latestEngineSelected:n&&a.has(n)?n:null,connectionsMap:a}},clearDataSourceConnections:()=>({latestEngineSelected:null,connectionsMap:new Map}),removeDataSourceConnection:(e,t)=>{let{latestEngineSelected:n,connectionsMap:r}=e,i=new Map(r);return i.delete(t),{latestEngineSelected:n&&i.has(n)?n:null,connectionsMap:i}},addSchemaList:(e,t)=>{let{schemas:n,sqlSchemaContext:r}=t,{connectionsMap:i,latestEngineSelected:a}=e,o=r.engine,s=i.get(o);if(!s)return e;let c=r.schemaPath??[],l=new Map(i),u={...s,databases:s.databases.map(e=>e.name===r.database?c.length===0?{...e,schemas:n,schemas_resolved:!0}:{...e,schemas:dp(e.schemas,c,e=>({...e,child_schemas:n,child_schemas_resolved:!0}))}:e)};return l.set(o,u),{latestEngineSelected:a,connectionsMap:l}},addTableList:(e,t)=>{let{tables:n,sqlTableContext:r}=t,{connectionsMap:i,latestEngineSelected:a}=e,o=r.engine,s=i.get(o);if(!s)return e;let c=fp(r),l=new Map(i),u={...s,databases:s.databases.map(e=>e.name===r.database?{...e,schemas:dp(e.schemas,c,e=>({...e,tables:n,tables_resolved:!0}))}:e)};return l.set(o,u),{latestEngineSelected:a,connectionsMap:l}},addTable:(e,t)=>{let{table:n,sqlTableContext:r}=t,{connectionsMap:i,latestEngineSelected:a}=e,o=r.engine,s=n.name,c=i.get(o);if(!c)return e;let l=fp(r),u=new Map(i),d={...c,databases:c.databases.map(e=>e.name===r.database?{...e,schemas:dp(e.schemas,l,e=>{let t=e.tables.length===0?[n]:e.tables.map(e=>e.name===s?n:e);return{...e,tables:t}})}:e)};return u.set(o,d),{latestEngineSelected:a,connectionsMap:u}}}),vp=o(e=>e(gp).connectionsMap),yp=o(e=>{let t=new Map(e(vp));for(let e of zf){let n=t.get(e);n&&(n.databases.length===0&&t.delete(e),n.databases.length===1&&n.databases[0].name===`memory`&&n.databases[0].schemas.length===0&&t.delete(e))}return wr([...t.values()],e=>+!!zf.has(e.name))});function bp(e){let t=u.get(gp);t.connectionsMap.has(e)&&u.set(gp,{...t,latestEngineSelected:e})}var xp=o(e=>{let t=u.get(op),n=e(gp).connectionsMap,r=new Map;for(let e of t)r.set(e.name,e);for(let e of n.values())for(let t of e.databases){let n=t.name===e.default_database||e.databases.length===1,i=(a,o)=>{let s=o.length===0,c=o.length===1&&o[0]===e.default_schema,l=o.join(`.`);for(let e of a.tables){let i;if(i=e.name,s){i=n?e.name:`${t.name}.${e.name}`,r.has(i)?R.warn(`Table name collision for ${i}. Skipping.`):r.set(i,e);continue}if(n&&c&&!r.has(i)){r.set(i,e);continue}if(i=`${l}.${e.name}`,n&&!r.has(i)){r.set(i,e);continue}i=`${t.name}.${l}.${e.name}`,r.has(i)?R.warn(`Table name collision for ${i}. Skipping.`):r.set(i,e)}for(let e of a.child_schemas??[])i(e,[...o,e.name])};for(let e of t.schemas)i(e,Uf(e.name)?[]:[e.name])}return r});function Sp(e){return e.variable_name?`dataframe`:`table`}var Cp=class{maxSize;cache=new Map;options;constructor(e,t={}){this.maxSize=e,this.options=t}getOrCreate(e){B(this.options.create,`create function is required`);let t=this.cache.get(e);if(t!==void 0)return t;let n=this.options.create(e);return this.cache.set(e,n),n}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e)&&this.cache.delete(e),this.cache.set(e,t),this.cache.size>this.maxSize){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}}keys(){return this.cache.keys()}values(){return this.cache.values()}entries(){return this.cache.entries()}delete(e){this.cache.delete(e)}};function wp(e){switch(e){case`duckdb`:return`DuckDB`;case`motherduck`:return`MotherDuck`;case`sqlite`:return`SQLite`;case`postgres`:case`postgresql`:return`PostgreSQL`;case`mysql`:return`MySQL`;case`mariadb`:return`MariaDB`;case`mssql`:case`microsoft sql server`:return`Microsoft SQL Server`;case`oracle`:return`Oracle`;case`redshift`:return`Amazon Redshift`;case`snowflake`:return`Snowflake`;case`bigquery`:return`Google BigQuery`;case`clickhouse`:return`ClickHouse`;case`timeplus`:return`Timeplus`;case`databricks`:return`Databricks`;case`db2`:return`IBM Db2`;case`hive`:return`Apache Hive`;case`impala`:return`Apache Impala`;case`presto`:return`Presto`;case`trino`:return`Trino`;case`cockroachdb`:return`CockroachDB`;case`timescaledb`:return`TimescaleDB`;case`singlestore`:return`SingleStore`;case`cassandra`:return`Apache Cassandra`;case`mongodb`:return`MongoDB`;case`iceberg`:return`Apache Iceberg`;case`dremio`:return`Dremio`;default:return e}}function Tp(e){let[t,n]=e.split(` `);return n?`${wp(t)} ${n}`:wp(e)}var Ep={boolean:U,date:At,time:Do,datetime:Co,temporal:Co,number:kt,string:jt,integer:kt,geometry:Fo,unknown:So};function Dp(e){return Object.hasOwn(Ep,e)?e:`unknown`}function Op(e){switch(e){case`boolean`:return`bg-(--orange-4)`;case`date`:case`time`:case`datetime`:case`temporal`:return`bg-(--grass-4) dark:bg-(--grass-5)`;case`number`:case`integer`:return`bg-(--purple-4)`;case`string`:return`bg-(--blue-4)`;case`geometry`:return`bg-(--cyan-4) dark:bg-(--cyan-5)`;case`unknown`:return`bg-(--slate-4) dark:bg-(--slate-6)`;default:return zr(e),`bg-(--slate-4) dark:bg-(--slate-6)`}}var kp=class{singular;_plural;constructor(e,t){this.singular=e,this._plural=t}pluralize(e){return e===1?this.singular:this.plural}get plural(){return this._plural??`${this.singular}s`}},Ap=class e{words;constructor(e){this.words=e}static of(...t){return new e(t.map(e=>typeof e==`string`?new kp(e):e))}join(e,t){return this.words.map(e=>e.pluralize(t)).join(e)}},X=te(),jp=5,Mp={boolean:`bg-(--orange-4) text-(--orange-11)`,date:`bg-(--grass-4) text-(--grass-11)`,time:`bg-(--grass-4) text-(--grass-11)`,datetime:`bg-(--grass-4) text-(--grass-11)`,number:`bg-(--purple-4) text-(--purple-11)`,integer:`bg-(--purple-4) text-(--purple-11)`,string:`bg-(--blue-4) text-(--blue-11)`,geometry:`bg-(--cyan-4) text-(--cyan-11)`,unknown:`bg-(--slate-4) text-(--slate-11)`},Np={local:`bg-(--blue-4) text-(--blue-11)`,duckdb:`bg-(--amber-4) text-(--amber-11)`,connection:`bg-(--green-4) text-(--green-11)`,catalog:`bg-(--purple-4) text-(--purple-11)`},Pp=`p-3 min-w-[250px] flex flex-col divide-y`,Fp=new kp(`column`,`columns`),Ip=new kp(`row`,`rows`),Lp=new kp(`schema`,`schemas`),Rp=new kp(`table`,`tables`),zp=new kp(`database`,`databases`),Bp=e=>{let t=(0,X.c)(6),{icon:n,title:r,badge:i}=e,a;t[0]===r?a=t[1]:(a=(0,q.jsx)(`h3`,{className:`font-semibold text-sm`,children:r}),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==n||t[4]!==a?(o=(0,q.jsxs)(`div`,{className:`flex items-center gap-2 pb-2`,children:[n,a,i]}),t[2]=i,t[3]=n,t[4]=a,t[5]=o):o=t[5],o},Vp=e=>{let t=(0,X.c)(5),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,q.jsxs)(`span`,{className:`text-(--slate-11)`,children:[n,`:`]}),t[0]=n,t[1]=i);let a;return t[2]!==i||t[3]!==r?(a=(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[i,r]}),t[2]=i,t[3]=r,t[4]=a):a=t[4],a},Hp=e=>{let t=(0,X.c)(5),{icon:n,text:r}=e,i;t[0]===r?i=t[1]:(i=(0,q.jsx)(`span`,{className:`text-xs text-(--slate-11)`,children:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n,i]}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},Up=e=>{let t=(0,X.c)(15),{title:n,items:r,totalCount:i,limit:a}=e,o=n===void 0?``:n,s=a===void 0?jp:a;if(r.length===0)return null;let c;t[0]!==r||t[1]!==s?(c=r.slice(0,s),t[0]=r,t[1]=s,t[2]=c):c=t[2];let l=c,u=i>s,d;t[3]===o?d=t[4]:(d=o&&(0,q.jsxs)(`h4`,{className:`text-xs font-medium text-(--slate-11) mb-2`,children:[o,`:`]}),t[3]=o,t[4]=d);let f;t[5]!==u||t[6]!==s||t[7]!==i?(f=u&&(0,q.jsxs)(`div`,{className:`text-xs text-(--slate-10) text-center py-1`,children:[`... and `,i-s,` more`]}),t[5]=u,t[6]=s,t[7]=i,t[8]=f):f=t[8];let p;t[9]!==f||t[10]!==l?(p=(0,q.jsxs)(`div`,{className:`flex flex-col gap-1 overflow-y-auto`,children:[l,f]}),t[9]=f,t[10]=l,t[11]=p):p=t[11];let m;return t[12]!==d||t[13]!==p?(m=(0,q.jsxs)(`div`,{className:`py-2`,children:[d,p]}),t[12]=d,t[13]=p,t[14]=m):m=t[14],m},Wp=e=>Mp[e]||Mp.unknown,Gp=e=>{let t=e.type===`view`?(0,q.jsx)(Ao,{className:`w-4 h-4 text-(--blue-9)`}):(0,q.jsx)(Ko,{className:`w-4 h-4 text-(--green-9)`}),n=(0,q.jsx)(ti,{variant:`secondary`,className:`text-xs ${e.type===`view`?`bg-(--blue-4) text-(--blue-11)`:`bg-(--green-4) text-(--green-11)`}`,children:e.type}),r=e.columns.map(e=>{let t=Ep[Dp(e.type)];return(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs rounded`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(t,{className:`w-3 h-3 text-(--slate-9)`}),(0,q.jsx)(`span`,{className:`font-mono`,children:e.name})]}),(0,q.jsx)(ti,{variant:`outline`,className:`text-xs ${Wp(e.type)}`,children:e.type})]},e.name)}),i=e.primary_keys&&e.primary_keys.length>0,a=e.indexes&&e.indexes.length>0;return(0,q.jsxs)(`div`,{className:`${Pp} min-w-[300px]`,children:[(0,q.jsx)(Bp,{icon:t,title:e.name,badge:n}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,q.jsx)(Vp,{label:`Source`,value:(0,q.jsx)(ti,{variant:`outline`,className:`text-xs ${Np[e.source_type]}`,children:e.source})}),e.variable_name&&(0,q.jsx)(Vp,{label:`Variable`,value:(0,q.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.variable_name})}),e.engine&&(0,q.jsx)(Vp,{label:`Engine`,value:(0,q.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.engine})})]}),(e.num_columns!=null||e.num_rows!=null)&&(0,q.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 py-2`,children:[e.num_columns!=null&&(0,q.jsx)(Hp,{icon:(0,q.jsx)(ko,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.num_columns} ${Fp.pluralize(e.num_columns)}`}),e.num_rows!=null&&(0,q.jsx)(Hp,{icon:(0,q.jsx)(kt,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.num_rows} ${Ip.pluralize(e.num_rows)}`})]}),e.columns.length===0&&$p(`column`),(i||a)&&(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[i&&(0,q.jsxs)(`div`,{className:`flex flex-row gap-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Bt,{className:`w-3 h-3 text-(--amber-9)`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-(--slate-11)`,children:`Primary Keys:`})]}),e.primary_keys?.map(e=>(0,q.jsx)(ti,{variant:`outline`,className:`text-xs text-(--slate-11)`,children:e},e))]}),a&&(0,q.jsxs)(`div`,{className:`flex flex-row gap-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1 mb-1`,children:[(0,q.jsx)(wt,{className:`w-3 h-3 text-(--purple-9)`}),(0,q.jsx)(`span`,{className:`text-xs font-medium text-(--slate-11)`,children:`Indexes:`})]}),e.indexes?.map(e=>(0,q.jsx)(ti,{variant:`outline`,className:`text-xs text-(--slate-11)`,children:e},e))]})]}),e.columns.length>0&&(0,q.jsx)(Up,{items:r,totalCount:e.columns.length})]})},Kp=e=>{let t=Ep[Dp(e.type)],n=(0,q.jsx)(ti,{variant:`outline`,className:`text-xs ${Wp(e.type)}`,children:e.type}),r=e.sample_values?.map((e,t)=>(0,q.jsx)(`div`,{className:`text-xs bg-(--slate-3) rounded font-mono`,children:e==null?`null`:String(e)},t))||[];return(0,q.jsxs)(`div`,{className:Pp,children:[(0,q.jsx)(Bp,{icon:(0,q.jsx)(t,{className:`w-4 h-4 text-(--slate-9)`}),title:e.name,badge:n}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 mt-2`,children:[(0,q.jsx)(Vp,{label:`Type`,value:(0,q.jsx)(`span`,{className:`font-medium`,children:e.type})}),(0,q.jsx)(Vp,{label:`External Type`,value:(0,q.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.external_type})})]}),e.sample_values&&e.sample_values.length>0&&(0,q.jsx)(Up,{title:`Sample Values`,items:r,totalCount:e.sample_values.length})]})},qp=e=>{let t=(0,q.jsx)(ti,{variant:`outline`,className:`text-xs bg-(--blue-4) text-(--blue-11)`,children:e.dialect}),n=e.schemas.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs rounded hover:bg-(--slate-3)`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Po,{className:`w-3 h-3 text-(--slate-9)`}),(0,q.jsx)(`span`,{children:e.name})]}),(0,q.jsxs)(ti,{variant:`outline`,className:`text-xs`,children:[e.tables.length,` `,Rp.pluralize(e.tables.length)]})]},e.name));return(0,q.jsxs)(`div`,{className:Pp,children:[(0,q.jsx)(Bp,{icon:(0,q.jsx)(Tt,{className:`w-4 h-4 text-(--blue-9)`}),title:e.name,badge:t}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,q.jsx)(Vp,{label:`Dialect`,value:(0,q.jsx)(`span`,{className:`font-medium`,children:e.dialect})}),e.engine&&(0,q.jsx)(Vp,{label:`Engine`,value:(0,q.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:e.engine})})]}),(0,q.jsx)(`div`,{className:`py-2`,children:(0,q.jsx)(Hp,{icon:(0,q.jsx)(Po,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.schemas.length} schema${e.schemas.length===1?``:`s`}`})}),e.schemas.length===0&&$p(`schema`),e.schemas.length>0&&(0,q.jsx)(Up,{title:`Schemas`,items:n,totalCount:e.schemas.length})]})},Jp=e=>{let t=(0,q.jsx)(ti,{variant:`outline`,className:`text-xs bg-(--green-4) text-(--green-11)`,children:`Schema`}),n=e.tables.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center justify-between text-xs rounded hover:bg-(--slate-3)`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type===`view`?(0,q.jsx)(Ao,{className:`w-3 h-3 text-(--blue-9)`}):(0,q.jsx)(Ko,{className:`w-3 h-3 text-(--green-9)`}),(0,q.jsx)(`span`,{children:e.name})]}),(0,q.jsx)(ti,{variant:`outline`,className:`text-xs ${e.type===`view`?`bg-(--blue-4) text-(--blue-11)`:`bg-(--green-4) text-(--green-11)`}`,children:e.type})]},e.name));return(0,q.jsxs)(`div`,{className:Pp,children:[(0,q.jsx)(Bp,{icon:(0,q.jsx)(Po,{className:`w-4 h-4 text-(--green-9)`}),title:e.name,badge:t}),(0,q.jsx)(`div`,{className:`py-2`,children:(0,q.jsx)(Hp,{icon:(0,q.jsx)(Ko,{className:`w-3 h-3 text-(--slate-9)`}),text:`${e.tables.length} table${e.tables.length===1?``:`s`}`})}),e.tables.length===0&&$p(`table`),e.tables.length>0&&(0,q.jsx)(Up,{title:`Tables`,items:n,totalCount:e.tables.length})]})},Yp=(0,q.jsx)(ti,{variant:`outline`,children:`default`}),Xp=8,Zp=3,Qp=(e,t)=>{let n=e.databases.length,r=e.databases.reduce((e,t)=>e+t.schemas.length,0),i=(t,n)=>{if(t.tables.length===0)return null;let i=t.name===e.default_schema&&n,a=[];return r<Xp&&(a=t.tables.slice(0,4).map(e=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2 ml-4`,children:[(0,q.jsx)(Ko,{className:`w-3 h-3 text-(--green-9)`}),(0,q.jsx)(`span`,{className:`text-xs`,children:e.name})]},e.name))),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs rounded hover:bg-(--slate-3) ml-2`,children:[(0,q.jsx)(Po,{className:`w-3 h-3 text-(--slate-9)`}),(0,q.jsx)(`span`,{children:t.name}),i&&Yp,(0,q.jsxs)(ti,{variant:`outline`,className:`text-xs ml-auto`,children:[t.tables.length,` tables`]})]}),(0,q.jsx)(Up,{items:a,totalCount:t.tables.length,limit:Zp})]},t.name)},a=e.databases.map(t=>{let n=t.name===e.default_database||e.databases.length===1,r=t.schemas.map(e=>i(e,n));return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Tt,{className:`w-3 h-3 text-(--blue-9)`}),(0,q.jsx)(`span`,{className:`text-xs`,children:t.name}),n&&Yp]}),r&&(0,q.jsx)(Up,{items:r,totalCount:t.schemas.length})]},t.name)}),o=e.name;zf.has(e.name)&&(o=`In-Memory`);let s=t?.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(Ko,{className:`w-3 h-3 text-(--blue-9)`}),(0,q.jsx)(`span`,{className:`text-xs`,children:e.name})]},e.name));return(0,q.jsxs)(`div`,{className:`${Pp} px-1`,children:[(0,q.jsx)(Bp,{icon:(0,q.jsx)(Oo,{className:`w-4 h-4 text-(--purple-9)`}),title:o}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,q.jsx)(Vp,{label:`Dialect`,value:(0,q.jsx)(`span`,{className:`font-medium`,children:wp(e.dialect)})}),(0,q.jsx)(Vp,{label:`Source`,value:(0,q.jsx)(ti,{variant:`outline`,className:`text-xs bg-(--green-4) text-(--green-11)`,children:e.source})})]}),(0,q.jsxs)(`div`,{className:`flex flex-row justify-between py-2`,children:[(0,q.jsx)(Hp,{icon:(0,q.jsx)(Tt,{className:`w-3 h-3 text-(--slate-9)`}),text:`${n} ${zp.pluralize(n)}`}),(0,q.jsx)(Hp,{icon:(0,q.jsx)(Po,{className:`w-3 h-3 text-(--slate-9)`}),text:`${r} ${Lp.pluralize(r)}`})]}),n>0&&(0,q.jsx)(Up,{items:a,totalCount:n}),s&&s.length>0&&(0,q.jsx)(Up,{title:`Dataframes`,items:s,totalCount:s.length})]})},$p=e=>(0,q.jsxs)(`div`,{className:`flex items-start gap-2 mt-3`,children:[(0,q.jsx)(Mo,{size:10,className:`mt-1 text-(--slate-10) shrink-0`}),(0,q.jsxs)(`span`,{className:`text-xs text-(--slate-11)`,children:[`No `,e,` information available.`,`
35
+ `,(0,q.jsx)(`span`,{className:`text-(--blue-10)`,children:`Introspect to see more details.`})]})]}),em=e(_i(),1),tm=class{schema={};addTable(e,t){let n={self:rm({table:t}),children:t.columns.map(e=>nm({column:e}))};return this.setAt([...e,t.name],n),this}addSchema(e,t){let n={self:im({namespace:t,path:e}),children:{}};return this.setAt(e,n),this}addDatabase(e,t){let n={self:am({namespace:t,path:e}),children:{}};return this.setAt(e,n),this}setAt(e,t){let n=this.schema;for(let t of e.slice(0,-1))n[t]||(n[t]={children:{}}),n=n[t].children;n[e[e.length-1]]=t}build(){return this.schema}reset(){return this.schema={},this}};function nm(e){return{label:e.column.name,type:`column`,info:()=>{let t=document.createElement(`div`);return(0,em.createRoot)(t).render(Kp(e.column)),{dom:t}}}}function rm(e){return{label:e.table.name,type:`table`,info:()=>{let t=document.createElement(`div`);return(0,em.createRoot)(t).render(Gp(e.table)),{dom:t}}}}function im(e){return{label:e.namespace.name,detail:e.path.join(`.`),type:`schema`,info:()=>{let t=document.createElement(`div`);return(0,em.createRoot)(t).render(Jp(e.namespace)),{dom:t}}}}function am(e){return{label:e.namespace.name,detail:e.path.join(`.`),type:`database`,info:()=>{let t=document.createElement(`div`);return(0,em.createRoot)(t).render(qp(e.namespace)),{dom:t}}}}var om=o(e=>{let t=e(op),n=new tm;for(let e of t)n.addTable([],e);return n.build()}),sm=class{cache;constructor(){this.cache=new Cp(10,{create:e=>this.getConnectionSchema(e)})}getConnection(e){return u.get(vp).get(e)}getConnectionSchema(e){let{default_database:t,databases:n,default_schema:r}=e,i=new tm,a=n.find(e=>e.name===t||n.length===1);if((a??n[0])?.schemas.some(e=>Uf(e.name))??!1){for(let e of n){let t=e.name===a?.name,n=e.schemas.flatMap(e=>e.tables);i.addDatabase([e.name],e);for(let r of n)t?i.addTable([],r):i.addTable([e.name],r)}return{shouldAddLocalTables:!1,schema:i.build(),defaultSchema:a?.name}}if(a)for(let e of a.schemas){i.addSchema([e.name],e);for(let t of e.tables)i.addTable([e.name],t)}for(let e of n){i.addDatabase([e.name],e);for(let t of e.schemas){i.addSchema([e.name,t.name],t);for(let n of t.tables)i.addTable([e.name,t.name],n)}}return{shouldAddLocalTables:!0,schema:i.build(),defaultSchema:r??(a?.schemas.length===1?a.schemas[0]?.name:void 0)}}getInternalDialect(e){let t=this.getConnection(e);return t?t.dialect.toLowerCase():null}getDialect(e){let t=this.getConnection(e);return t?Ff(t):Lf}getCompletionSource(e){let t=this.getConnection(e);if(!t)return null;let n=()=>u.get(om),r=this.cache.getOrCreate(t);return{dialect:Ff(t),schema:r.shouldAddLocalTables?{...r.schema,...n()}:r.schema,defaultSchema:r.defaultSchema,defaultTable:cm(t)}}};function cm(e){if(e.databases.length!==1)return;let t=e.databases[0];if(t.schemas.length!==1)return;let n=t.schemas[0];if(n.tables.length===1)return n.tables[0].name}var lm=new sm,um=Cn.define();async function dm(e){let{sendFormat:t}=Hr(),n=z.mapValues(e,e=>jA(e)),r=await t({codes:n,lineLength:ie().formatting.line_length});for(let[t,i]of z.entries(r.codes)){let r=t,a=n[r],o=e[r];o&&i!==a&&(o.state.facet(Df).updateCellCode({cellId:r,code:i,formattingChange:!0}),MA(o,i))}}function fm(){return dm(hf(qM()))}async function pm(e,t){let{formatDialect:n}=await W(async()=>{let{formatDialect:e}=await import(`./esm-D-owkyO9.js`);return{formatDialect:e}},__vite__mapDeps([0,1]),import.meta.url),r=await mm(lm.getInternalDialect(t)),i=e.state.field(CA),a=ln(e.state);if(i.type!==`sql`){R.error(`Language adapter is not SQL`);return}let o=e.state.doc.toString(),s;try{s=n(o,{dialect:r,tabWidth:a,useTabs:!1})}catch(e){R.error(`Error formatting SQL`,{error:e});return}let c=i.transformIn(s)[0],l=e.state.facet(Df),u=e.state.facet(rf);l.updateCellCode({cellId:u,code:c,formattingChange:!0}),Qd(e,s,{effects:[um.of(!0)]})}async function mm(e){let{bigquery:t,db2:n,db2i:r,duckdb:i,hive:a,mariadb:o,mysql:s,tidb:c,n1ql:l,plsql:u,postgresql:d,redshift:f,spark:p,sqlite:m,sql:h,trino:g,transactsql:_,singlestoredb:v,snowflake:y}=await W(async()=>{let{bigquery:e,db2:t,db2i:n,duckdb:r,hive:i,mariadb:a,mysql:o,tidb:s,n1ql:c,plsql:l,postgresql:u,redshift:d,spark:f,sqlite:p,sql:m,trino:h,transactsql:g,singlestoredb:_,snowflake:v}=await import(`./esm-D-owkyO9.js`);return{bigquery:e,db2:t,db2i:n,duckdb:r,hive:i,mariadb:a,mysql:o,tidb:s,n1ql:c,plsql:l,postgresql:u,redshift:d,spark:f,sqlite:p,sql:m,trino:h,transactsql:g,singlestoredb:_,snowflake:v}},__vite__mapDeps([0,1]),import.meta.url),b=h;if(!e||!Pf(e))return b;switch(e){case`mysql`:return s;case`mariadb`:return o;case`postgres`:case`postgresql`:return d;case`sqlite`:return m;case`db2`:return n;case`db2i`:return r;case`hive`:return a;case`redshift`:return f;case`snowflake`:return y;case`trino`:return g;case`tidb`:return c;case`oracle`:case`oracledb`:return u;case`spark`:return p;case`singlestoredb`:return v;case`couchbase`:return l;case`bigquery`:return t;case`duckdb`:return i;case`mssql`:case`sqlserver`:case`microsoft sql server`:return _;case`athena`:case`awsathena`:case`cassandra`:case`noql`:case`flink`:case`mongodb`:case`timescaledb`:case`datafusion`:case`dremio`:return h;case`databricks`:return p;default:return zr(e),b}}function hm(e,t){let n=document.createElement(`div`),r;return{dom:n,mount(){r=(0,em.createRoot)(n),r.render((0,q.jsx)(d,{store:u,children:(0,q.jsx)(t,{view:e})}))},update(){r?.render((0,q.jsx)(d,{store:u,children:(0,q.jsx)(t,{view:e})}))},destroy(){r?.unmount()}}}function Z(e){return new Xn(Bn.define(e))}function gm(e){return W(()=>import(`./dist-CibNXpH2.js`).then(t=>t.sql({dialect:t[e]})),__vite__mapDeps([2,3,4,5]),import.meta.url)}var _m=[G.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return W(()=>import(`./dist-DcvY27K9.js`).then(e=>e.cpp()),__vite__mapDeps([6,7,4]),import.meta.url)}}),G.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return W(()=>import(`./dist-DcvY27K9.js`).then(e=>e.cpp()),__vite__mapDeps([6,7,4]),import.meta.url)}}),G.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return gm(`Cassandra`)}}),G.of({name:`CSS`,extensions:[`css`],load(){return W(()=>import(`./dist-C43s7KMp.js`).then(e=>e.css()),__vite__mapDeps([8,9,4]),import.meta.url)}}),G.of({name:`Go`,extensions:[`go`],load(){return W(()=>import(`./dist-DfGC5qxC.js`).then(e=>e.go()),__vite__mapDeps([10,11,4,5]),import.meta.url)}}),G.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return W(()=>import(`./dist-BxKJ9CUC.js`).then(e=>e.html()),__vite__mapDeps([12,13,4,9,14,5]),import.meta.url)}}),G.of({name:`Java`,extensions:[`java`],load(){return W(()=>import(`./dist-DewjJKIE.js`).then(e=>e.java()),__vite__mapDeps([15,16,4]),import.meta.url)}}),G.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return W(()=>import(`./dist-DoYtnejk.js`).then(e=>e.javascript()),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),G.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return W(()=>import(`./dist-BZAAgYK3.js`).then(e=>e.jinja()),__vite__mapDeps([18,19,4,13,9,14,5]),import.meta.url)}}),G.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return W(()=>import(`./dist-4SpsNdg9.js`).then(e=>e.json()),__vite__mapDeps([20,21,4]),import.meta.url)}}),G.of({name:`JSX`,extensions:[`jsx`],load(){return W(()=>import(`./dist-DoYtnejk.js`).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),G.of({name:`LESS`,extensions:[`less`],load(){return W(()=>import(`./dist-DfRK-QAy.js`).then(e=>e.less()),__vite__mapDeps([22,23,4,9]),import.meta.url)}}),G.of({name:`Liquid`,extensions:[`liquid`],load(){return W(()=>import(`./dist-Cw0_qzU5.js`).then(e=>e.liquid()),__vite__mapDeps([24,25,4,13,9,14,5]),import.meta.url)}}),G.of({name:`MariaDB SQL`,load(){return gm(`MariaSQL`)}}),G.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return W(()=>import(`./dist-Cllq-3AX.js`).then(e=>e.markdown()),__vite__mapDeps([26,27,4,5,13,9,14]),import.meta.url)}}),G.of({name:`MS SQL`,load(){return gm(`MSSQL`)}}),G.of({name:`MySQL`,load(){return gm(`MySQL`)}}),G.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return W(()=>import(`./dist-D0Fg9FgU.js`).then(e=>e.php()),__vite__mapDeps([28,29,4,13,9,14,5]),import.meta.url)}}),G.of({name:`PLSQL`,extensions:[`pls`],load(){return gm(`PLSQL`)}}),G.of({name:`PostgreSQL`,load(){return gm(`PostgreSQL`)}}),G.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return W(()=>import(`./dist-BXTY2Z6u.js`).then(e=>e.python()),__vite__mapDeps([30,31,4,5]),import.meta.url)}}),G.of({name:`Rust`,extensions:[`rs`],load(){return W(()=>import(`./dist-DG2TCPkT.js`).then(e=>e.rust()),__vite__mapDeps([32,33,4]),import.meta.url)}}),G.of({name:`Sass`,extensions:[`sass`],load(){return W(()=>import(`./dist-BeKmSRy3.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([34,35,4,9]),import.meta.url)}}),G.of({name:`SCSS`,extensions:[`scss`],load(){return W(()=>import(`./dist-BeKmSRy3.js`).then(e=>e.sass()),__vite__mapDeps([34,35,4,9]),import.meta.url)}}),G.of({name:`SQL`,extensions:[`sql`],load(){return gm(`StandardSQL`)}}),G.of({name:`SQLite`,load(){return gm(`SQLite`)}}),G.of({name:`TSX`,extensions:[`tsx`],load(){return W(()=>import(`./dist-DoYtnejk.js`).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),G.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return W(()=>import(`./dist-DoYtnejk.js`).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([17,14,4,5]),import.meta.url)}}),G.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return W(()=>import(`./dist-C1ZMbzEY.js`).then(e=>e.wast()),__vite__mapDeps([36,37,4]),import.meta.url)}}),G.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return W(()=>import(`./dist-PsHgCCpB.js`).then(e=>e.xml()),__vite__mapDeps([38,39,4]),import.meta.url)}}),G.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return W(()=>import(`./dist-CcKu0kT5.js`).then(e=>e.yaml()),__vite__mapDeps([40,41,4]),import.meta.url)}}),G.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return W(()=>import(`./apl-gw27yJ2n.js`).then(e=>Z(e.apl)),__vite__mapDeps([42,43]),import.meta.url)}}),G.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return W(()=>import(`./asciiarmor-Cor5STs8.js`).then(e=>Z(e.asciiArmor)),__vite__mapDeps([44,45]),import.meta.url)}}),G.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return W(()=>import(`./asn1-CPEENLyz.js`).then(e=>Z(e.asn1({}))),__vite__mapDeps([46,47]),import.meta.url)}}),G.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return W(()=>import(`./asterisk-BEn0Cwpx.js`).then(e=>Z(e.asterisk)),[],import.meta.url)}}),G.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return W(()=>import(`./brainfuck-a_fzgFtj.js`).then(e=>Z(e.brainfuck)),__vite__mapDeps([48,49]),import.meta.url)}}),G.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return W(()=>import(`./cobol-BYACvGhO.js`).then(e=>Z(e.cobol)),__vite__mapDeps([50,51]),import.meta.url)}}),G.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.csharp)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return W(()=>import(`./clojure-sW2N62b5.js`).then(e=>Z(e.clojure)),__vite__mapDeps([54,55]),import.meta.url)}}),G.of({name:`ClojureScript`,extensions:[`cljs`],load(){return W(()=>import(`./clojure-sW2N62b5.js`).then(e=>Z(e.clojure)),__vite__mapDeps([54,55]),import.meta.url)}}),G.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return W(()=>import(`./css-CbZNFbVv.js`).then(e=>Z(e.gss)),__vite__mapDeps([56,57]),import.meta.url)}}),G.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return W(()=>import(`./cmake-DA9yMhzJ.js`).then(e=>Z(e.cmake)),__vite__mapDeps([58,59]),import.meta.url)}}),G.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return W(()=>import(`./coffeescript-73GxLNLH.js`).then(e=>Z(e.coffeeScript)),__vite__mapDeps([60,61]),import.meta.url)}}),G.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return W(()=>import(`./commonlisp-BAY0IMda.js`).then(e=>Z(e.commonLisp)),__vite__mapDeps([62,63]),import.meta.url)}}),G.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return W(()=>import(`./cypher-CpQ0ACJl.js`).then(e=>Z(e.cypher)),__vite__mapDeps([64,65]),import.meta.url)}}),G.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return W(()=>import(`./python-xiYauDc4.js`).then(e=>Z(e.cython)),__vite__mapDeps([66,67]),import.meta.url)}}),G.of({name:`Crystal`,extensions:[`cr`],load(){return W(()=>import(`./crystal-DLlr59il.js`).then(e=>Z(e.crystal)),__vite__mapDeps([68,69]),import.meta.url)}}),G.of({name:`D`,extensions:[`d`],load(){return W(()=>import(`./d-BFwRCF-p.js`).then(e=>Z(e.d)),__vite__mapDeps([70,71]),import.meta.url)}}),G.of({name:`Dart`,extensions:[`dart`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.dart)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`diff`,extensions:[`diff`,`patch`],load(){return W(()=>import(`./diff-Ib_BKd8h.js`).then(e=>Z(e.diff)),__vite__mapDeps([72,73]),import.meta.url)}}),G.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return W(()=>import(`./dockerfile-DJkHQgkl.js`).then(e=>Z(e.dockerFile)),__vite__mapDeps([74,75]),import.meta.url)}}),G.of({name:`DTD`,extensions:[`dtd`],load(){return W(()=>import(`./dtd-DgBHwr-e.js`).then(e=>Z(e.dtd)),__vite__mapDeps([76,77]),import.meta.url)}}),G.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return W(()=>import(`./dylan-fdbf6J3T.js`).then(e=>Z(e.dylan)),__vite__mapDeps([78,79]),import.meta.url)}}),G.of({name:`EBNF`,load(){return W(()=>import(`./ebnf-D4c0_ac3.js`).then(e=>Z(e.ebnf)),[],import.meta.url)}}),G.of({name:`ECL`,extensions:[`ecl`],load(){return W(()=>import(`./ecl-K_KNI3_u.js`).then(e=>Z(e.ecl)),__vite__mapDeps([80,81]),import.meta.url)}}),G.of({name:`edn`,extensions:[`edn`],load(){return W(()=>import(`./clojure-sW2N62b5.js`).then(e=>Z(e.clojure)),__vite__mapDeps([54,55]),import.meta.url)}}),G.of({name:`Eiffel`,extensions:[`e`],load(){return W(()=>import(`./eiffel-DatcW1fL.js`).then(e=>Z(e.eiffel)),__vite__mapDeps([82,83]),import.meta.url)}}),G.of({name:`Elm`,extensions:[`elm`],load(){return W(()=>import(`./elm-DbcUgz-o.js`).then(e=>Z(e.elm)),__vite__mapDeps([84,85]),import.meta.url)}}),G.of({name:`Erlang`,extensions:[`erl`],load(){return W(()=>import(`./erlang-BistxQAs.js`).then(e=>Z(e.erlang)),__vite__mapDeps([86,87]),import.meta.url)}}),G.of({name:`Esper`,load(){return W(()=>import(`./sql-DuQMFDvy.js`).then(e=>Z(e.esper)),[],import.meta.url)}}),G.of({name:`Factor`,extensions:[`factor`],load(){return W(()=>import(`./factor-DwQNJbiW.js`).then(e=>Z(e.factor)),__vite__mapDeps([88,89,75]),import.meta.url)}}),G.of({name:`FCL`,load(){return W(()=>import(`./fcl-ClOhbFR7.js`).then(e=>Z(e.fcl)),[],import.meta.url)}}),G.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return W(()=>import(`./forth-B-tqi4f_.js`).then(e=>Z(e.forth)),__vite__mapDeps([90,91]),import.meta.url)}}),G.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return W(()=>import(`./fortran-C9M6nI39.js`).then(e=>Z(e.fortran)),__vite__mapDeps([92,93]),import.meta.url)}}),G.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return W(()=>import(`./mllike-DHDLWZl9.js`).then(e=>Z(e.fSharp)),__vite__mapDeps([94,95]),import.meta.url)}}),G.of({name:`Gas`,extensions:[`s`],load(){return W(()=>import(`./gas-DJ-ntEw0.js`).then(e=>Z(e.gas)),__vite__mapDeps([96,97]),import.meta.url)}}),G.of({name:`Gherkin`,extensions:[`feature`],load(){return W(()=>import(`./gherkin-Co7qm0Mt.js`).then(e=>Z(e.gherkin)),__vite__mapDeps([98,99]),import.meta.url)}}),G.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return W(()=>import(`./groovy-DkYAhc5g.js`).then(e=>Z(e.groovy)),__vite__mapDeps([100,101]),import.meta.url)}}),G.of({name:`Haskell`,extensions:[`hs`],load(){return W(()=>import(`./haskell-QbTWCmtk.js`).then(e=>Z(e.haskell)),__vite__mapDeps([102,103]),import.meta.url)}}),G.of({name:`Haxe`,extensions:[`hx`],load(){return W(()=>import(`./haxe-CmR2u-6B.js`).then(e=>Z(e.haxe)),__vite__mapDeps([104,105]),import.meta.url)}}),G.of({name:`HXML`,extensions:[`hxml`],load(){return W(()=>import(`./haxe-CmR2u-6B.js`).then(e=>Z(e.hxml)),__vite__mapDeps([104,105]),import.meta.url)}}),G.of({name:`HTTP`,load(){return W(()=>import(`./http-CLVgA2GD.js`).then(e=>Z(e.http)),[],import.meta.url)}}),G.of({name:`IDL`,extensions:[`pro`],load(){return W(()=>import(`./idl-DY5VfUGL.js`).then(e=>Z(e.idl)),__vite__mapDeps([106,107]),import.meta.url)}}),G.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return W(()=>import(`./javascript-BWjar7HY.js`).then(e=>Z(e.jsonld)),__vite__mapDeps([108,109]),import.meta.url)}}),G.of({name:`Julia`,extensions:[`jl`],load(){return W(()=>import(`./julia-CBfVM-ng.js`).then(e=>Z(e.julia)),__vite__mapDeps([110,111]),import.meta.url)}}),G.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.kotlin)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return W(()=>import(`./livescript-CC7i4CEo.js`).then(e=>Z(e.liveScript)),__vite__mapDeps([112,113]),import.meta.url)}}),G.of({name:`Lua`,extensions:[`lua`],load(){return W(()=>import(`./lua-1tNpM92n.js`).then(e=>Z(e.lua)),__vite__mapDeps([114,115]),import.meta.url)}}),G.of({name:`mIRC`,extensions:[`mrc`],load(){return W(()=>import(`./mirc-BASUkO3C.js`).then(e=>Z(e.mirc)),__vite__mapDeps([116,117]),import.meta.url)}}),G.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return W(()=>import(`./mathematica-DWMBVyLs.js`).then(e=>Z(e.mathematica)),__vite__mapDeps([118,119]),import.meta.url)}}),G.of({name:`Modelica`,extensions:[`mo`],load(){return W(()=>import(`./modelica-C2NfUrdY.js`).then(e=>Z(e.modelica)),__vite__mapDeps([120,121]),import.meta.url)}}),G.of({name:`MUMPS`,extensions:[`mps`],load(){return W(()=>import(`./mumps-DwVYUX8b.js`).then(e=>Z(e.mumps)),__vite__mapDeps([122,123]),import.meta.url)}}),G.of({name:`Mbox`,extensions:[`mbox`],load(){return W(()=>import(`./mbox-DvNfx9hX.js`).then(e=>Z(e.mbox)),__vite__mapDeps([124,125]),import.meta.url)}}),G.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return W(()=>import(`./nginx-BMaDbqW3.js`).then(e=>Z(e.nginx)),[],import.meta.url)}}),G.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return W(()=>import(`./nsis-B6H_Q9YJ.js`).then(e=>Z(e.nsis)),__vite__mapDeps([126,127,75]),import.meta.url)}}),G.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return W(()=>import(`./ntriples-CSqEHNgf.js`).then(e=>Z(e.ntriples)),__vite__mapDeps([128,129]),import.meta.url)}}),G.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.objectiveC)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.objectiveCpp)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return W(()=>import(`./mllike-DHDLWZl9.js`).then(e=>Z(e.oCaml)),__vite__mapDeps([94,95]),import.meta.url)}}),G.of({name:`Octave`,extensions:[`m`],load(){return W(()=>import(`./octave-ImTMIie9.js`).then(e=>Z(e.octave)),__vite__mapDeps([130,131]),import.meta.url)}}),G.of({name:`Oz`,extensions:[`oz`],load(){return W(()=>import(`./oz-BuYcBdKy.js`).then(e=>Z(e.oz)),__vite__mapDeps([132,133]),import.meta.url)}}),G.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return W(()=>import(`./pascal-B50DmceL.js`).then(e=>Z(e.pascal)),__vite__mapDeps([134,135]),import.meta.url)}}),G.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return W(()=>import(`./perl-DmFVAwdF.js`).then(e=>Z(e.perl)),__vite__mapDeps([136,137]),import.meta.url)}}),G.of({name:`Pig`,extensions:[`pig`],load(){return W(()=>import(`./pig-BnQuru9N.js`).then(e=>Z(e.pig)),__vite__mapDeps([138,139]),import.meta.url)}}),G.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return W(()=>import(`./powershell-B1pJyAAD.js`).then(e=>Z(e.powerShell)),__vite__mapDeps([140,141]),import.meta.url)}}),G.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return W(()=>import(`./properties-Ci7guRqV.js`).then(e=>Z(e.properties)),__vite__mapDeps([142,143]),import.meta.url)}}),G.of({name:`ProtoBuf`,extensions:[`proto`],load(){return W(()=>import(`./protobuf-CoqP8wM5.js`).then(e=>Z(e.protobuf)),__vite__mapDeps([144,145]),import.meta.url)}}),G.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return W(()=>import(`./pug-CJsoo9v0.js`).then(e=>Z(e.pug)),__vite__mapDeps([146,147,109]),import.meta.url)}}),G.of({name:`Puppet`,extensions:[`pp`],load(){return W(()=>import(`./puppet-C9UYpvtZ.js`).then(e=>Z(e.puppet)),__vite__mapDeps([148,149]),import.meta.url)}}),G.of({name:`Q`,extensions:[`q`],load(){return W(()=>import(`./q-CKkOe1xA.js`).then(e=>Z(e.q)),__vite__mapDeps([150,151]),import.meta.url)}}),G.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return W(()=>import(`./r-Bwc-y-iL.js`).then(e=>Z(e.r)),__vite__mapDeps([152,153]),import.meta.url)}}),G.of({name:`RPM Changes`,load(){return W(()=>import(`./rpm-UQSdNQr2.js`).then(e=>Z(e.rpmChanges)),__vite__mapDeps([154,155]),import.meta.url)}}),G.of({name:`RPM Spec`,extensions:[`spec`],load(){return W(()=>import(`./rpm-UQSdNQr2.js`).then(e=>Z(e.rpmSpec)),__vite__mapDeps([154,155]),import.meta.url)}}),G.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return W(()=>import(`./ruby-CrY8zrT8.js`).then(e=>Z(e.ruby)),__vite__mapDeps([156,157]),import.meta.url)}}),G.of({name:`SAS`,extensions:[`sas`],load(){return W(()=>import(`./sas-CssadkTB.js`).then(e=>Z(e.sas)),__vite__mapDeps([158,159]),import.meta.url)}}),G.of({name:`Scala`,extensions:[`scala`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.scala)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return W(()=>import(`./scheme-CkJWoRmu.js`).then(e=>Z(e.scheme)),__vite__mapDeps([160,161]),import.meta.url)}}),G.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return W(()=>import(`./shell-FgUEpLdy.js`).then(e=>Z(e.shell)),__vite__mapDeps([162,163]),import.meta.url)}}),G.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return W(()=>import(`./sieve-BLxcNk7A.js`).then(e=>Z(e.sieve)),__vite__mapDeps([164,165]),import.meta.url)}}),G.of({name:`Smalltalk`,extensions:[`st`],load(){return W(()=>import(`./smalltalk-d1Dbk6V4.js`).then(e=>Z(e.smalltalk)),__vite__mapDeps([166,167]),import.meta.url)}}),G.of({name:`Solr`,load(){return W(()=>import(`./solr-BBopId9w.js`).then(e=>Z(e.solr)),[],import.meta.url)}}),G.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return W(()=>import(`./mllike-DHDLWZl9.js`).then(e=>Z(e.sml)),__vite__mapDeps([94,95]),import.meta.url)}}),G.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return W(()=>import(`./sparql-CUZhKeRb.js`).then(e=>Z(e.sparql)),__vite__mapDeps([168,169]),import.meta.url)}}),G.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return W(()=>import(`./spreadsheet-CTIncYxj.js`).then(e=>Z(e.spreadsheet)),[],import.meta.url)}}),G.of({name:`Squirrel`,extensions:[`nut`],load(){return W(()=>import(`./clike-DZROJv43.js`).then(e=>Z(e.squirrel)),__vite__mapDeps([52,53]),import.meta.url)}}),G.of({name:`Stylus`,extensions:[`styl`],load(){return W(()=>import(`./stylus-BvudHrj4.js`).then(e=>Z(e.stylus)),__vite__mapDeps([170,171]),import.meta.url)}}),G.of({name:`Swift`,extensions:[`swift`],load(){return W(()=>import(`./swift-CUIczYYb.js`).then(e=>Z(e.swift)),__vite__mapDeps([172,173]),import.meta.url)}}),G.of({name:`sTeX`,load(){return W(()=>import(`./stex-3SJlFZg3.js`).then(e=>Z(e.stex)),__vite__mapDeps([174,175]),import.meta.url)}}),G.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return W(()=>import(`./stex-3SJlFZg3.js`).then(e=>Z(e.stex)),__vite__mapDeps([174,175]),import.meta.url)}}),G.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return W(()=>import(`./verilog-DH7aBYt7.js`).then(e=>Z(e.verilog)),__vite__mapDeps([176,177]),import.meta.url)}}),G.of({name:`Tcl`,extensions:[`tcl`],load(){return W(()=>import(`./tcl-SjROh4xB.js`).then(e=>Z(e.tcl)),__vite__mapDeps([178,179]),import.meta.url)}}),G.of({name:`Textile`,extensions:[`textile`],load(){return W(()=>import(`./textile-DgW6fC9R.js`).then(e=>Z(e.textile)),__vite__mapDeps([180,181]),import.meta.url)}}),G.of({name:`TiddlyWiki`,load(){return W(()=>import(`./tiddlywiki-VlUiK86J.js`).then(e=>Z(e.tiddlyWiki)),[],import.meta.url)}}),G.of({name:`Tiki wiki`,load(){return W(()=>import(`./tiki-AK6FwT8q.js`).then(e=>Z(e.tiki)),[],import.meta.url)}}),G.of({name:`TOML`,extensions:[`toml`],load(){return W(()=>import(`./toml-BcC_uO4q.js`).then(e=>Z(e.toml)),__vite__mapDeps([182,183]),import.meta.url)}}),G.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return W(()=>import(`./troff-BMlKH74u.js`).then(e=>Z(e.troff)),__vite__mapDeps([184,185]),import.meta.url)}}),G.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return W(()=>import(`./ttcn-P2iYmK_j.js`).then(e=>Z(e.ttcn)),__vite__mapDeps([186,187]),import.meta.url)}}),G.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return W(()=>import(`./ttcn-cfg-2bl9aE98.js`).then(e=>Z(e.ttcnCfg)),__vite__mapDeps([188,189]),import.meta.url)}}),G.of({name:`Turtle`,extensions:[`ttl`],load(){return W(()=>import(`./turtle-DDf6uD3p.js`).then(e=>Z(e.turtle)),__vite__mapDeps([190,191]),import.meta.url)}}),G.of({name:`Web IDL`,extensions:[`webidl`],load(){return W(()=>import(`./webidl-dw5if_Lv.js`).then(e=>Z(e.webIDL)),__vite__mapDeps([192,193]),import.meta.url)}}),G.of({name:`VB.NET`,extensions:[`vb`],load(){return W(()=>import(`./vb-CrfmF706.js`).then(e=>Z(e.vb)),__vite__mapDeps([194,195]),import.meta.url)}}),G.of({name:`VBScript`,extensions:[`vbs`],load(){return W(()=>import(`./vbscript-Cpiv2llq.js`).then(e=>Z(e.vbScript)),__vite__mapDeps([196,197]),import.meta.url)}}),G.of({name:`Velocity`,extensions:[`vtl`],load(){return W(()=>import(`./velocity-5N54agTA.js`).then(e=>Z(e.velocity)),__vite__mapDeps([198,199]),import.meta.url)}}),G.of({name:`Verilog`,extensions:[`v`],load(){return W(()=>import(`./verilog-DH7aBYt7.js`).then(e=>Z(e.verilog)),__vite__mapDeps([176,177]),import.meta.url)}}),G.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return W(()=>import(`./vhdl-BmegRbqn.js`).then(e=>Z(e.vhdl)),__vite__mapDeps([200,201]),import.meta.url)}}),G.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return W(()=>import(`./xquery-CuDTgW6S.js`).then(e=>Z(e.xQuery)),__vite__mapDeps([202,203]),import.meta.url)}}),G.of({name:`Yacas`,extensions:[`ys`],load(){return W(()=>import(`./yacas-Dn2coKff.js`).then(e=>Z(e.yacas)),__vite__mapDeps([204,205]),import.meta.url)}}),G.of({name:`Z80`,extensions:[`z80`],load(){return W(()=>import(`./z80-ByJO5ysu.js`).then(e=>Z(e.z80)),__vite__mapDeps([206,207]),import.meta.url)}}),G.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return W(()=>import(`./mscgen-C7woTLsY.js`).then(e=>Z(e.mscgen)),__vite__mapDeps([208,209]),import.meta.url)}}),G.of({name:`Xù`,extensions:[`xu`],load(){return W(()=>import(`./mscgen-C7woTLsY.js`).then(e=>Z(e.xu)),__vite__mapDeps([208,209]),import.meta.url)}}),G.of({name:`MsGenny`,extensions:[`msgenny`],load(){return W(()=>import(`./mscgen-C7woTLsY.js`).then(e=>Z(e.msgenny)),__vite__mapDeps([208,209]),import.meta.url)}}),G.of({name:`Vue`,extensions:[`vue`],load(){return W(()=>import(`./dist-DH7Tm1i8.js`).then(e=>e.vue()),__vite__mapDeps([210,211,4,13,9,14,5]),import.meta.url)}}),G.of({name:`Angular Template`,load(){return W(()=>import(`./dist-DLwSLd_v.js`).then(e=>e.angular()),__vite__mapDeps([212,4,13,9,14,5]),import.meta.url)}})],vm=new WeakMap,ym=/(\n|\r\n?|\u2028|\u2029)/g,bm=/^\s*/,xm=/\S/,Sm=Array.prototype.slice,Cm=48,wm=57,Tm=97,Em=102,Dm=65,Om=70;function km(e){if(typeof e==`string`)return Mm([e])[0];if(typeof e==`function`)return function(){let t=Sm.call(arguments);return t[0]=jm(t[0]),e.apply(this,t)};let t=jm(e),n=Am(t,0);for(let e=1;e<t.length;e++)n+=arguments[e]+Am(t,e);return n}function Am(e,t){let n=e[t];if(n===void 0)throw TypeError(`invalid cooked string at index ${t}`);return n}function jm(e){let t=vm.get(e);if(t)return t;let n=Mm(e.raw),r=n.map(Pm);return Object.defineProperty(r,"raw",{value:Object.freeze(n)}),Object.freeze(r),vm.set(e,r),r}function Mm(e){let t=e.map(e=>e.split(ym)),n;for(let e=0;e<t.length;e++){let r=t[e],i=e===0,a=e+1===t.length;if(i){if(r.length===1||r[0].length>0)throw Error(`invalid content on opening line`);r[1]=``}if(a){if(r.length===1||xm.test(r[r.length-1]))throw Error(`invalid content on closing line`);r[r.length-2]=``,r[r.length-1]=``}for(let e=2;e<r.length;e+=2){let t=r[e],i=e+1===r.length&&!a,o=bm.exec(t)[0];if(!i&&o.length===t.length){r[e]=``;continue}n=Nm(o,n)}}let r=n?n.length:0;return t.map(e=>{let t=e[0];for(let n=1;n<e.length;n+=2){let i=e[n],a=e[n+1];t+=i+a.slice(r)}return t})}function Nm(e,t){if(t===void 0||e===t)return e;let n=0;for(let r=Math.min(e.length,t.length);n<r&&e[n]===t[n];n++);return e.slice(0,n)}function Pm(e){let t=``,n=0,r=0;for(;(r=e.indexOf(`\\`,r))>-1;){if(t+=e.slice(n,r),++r===e.length)return;let i=e[r++];switch(i){case`b`:t+=`\b`;break;case`t`:t+=` `;break;case`n`:t+=`
36
36
  `;break;case`v`:t+=`\v`;break;case`f`:t+=`\f`;break;case`r`:t+=`\r`;break;case`\r`:r<e.length&&e[r]===`
37
37
  `&&++r;case`
38
- `:case`\u2028`:case`\u2029`:break;case`0`:if(Mm(e,r))return;t+=`\0`;break;case`x`:{let n=Nm(e,r,r+2);if(n===-1)return;r+=2,t+=String.fromCharCode(n);break}case`u`:{let n;if(r<e.length&&e[r]===`{`){let t=e.indexOf(`}`,++r);if(t===-1)return;n=Nm(e,r,t),r=t+1}else n=Nm(e,r,r+4),r+=4;if(n===-1||n>1114111)return;t+=String.fromCodePoint(n);break}default:if(Mm(i,0))return;t+=i}n=r}return t+e.slice(n)}function Mm(e,t){let n=e.charCodeAt(t);return n>=bm&&n<=xm}function Nm(e,t,n){if(n>=e.length)return-1;let r=0;for(;t<n;t++){let n=Pm(e.charCodeAt(t));if(n===-1)return-1;r=r*16+n}return r}function Pm(e){return e>=bm&&e<=xm?e-bm:e>=Sm&&e<=Cm?e-Sm+10:e>=wm&&e<=Tm?e-wm+10:-1}var Fm=[``,`f`,`r`,`fr`,`rf`];function Im(e){try{return Em(`\n${e}\n`).trim()}catch{return e}}function Lm(e){return ii.parse(e)}var Rm=new Set([`(`,`[`,`{`,`,`,`)`,`]`,`}`]);function zm(e,t){return e.name===`ArgList`?{args:Bm(e),kwargs:Vm(e,t)}:(console.warn(`Not an ArgList, name: ${e.name}`),{args:[],kwargs:[]})}function Bm(e){e.firstChild();let t=[],n=e.name;do if(n=e.name,!Rm.has(n)){if(n===`VariableName`&&e.node.nextSibling?.name===`AssignOp`){e.prev();break}t.push(e.node)}while(e.nextSibling());return t}function Vm(e,t){let n=[],r=e.name;do if(r=e.name,r===`VariableName`){let r=t.slice(e.from,e.to),i=e.node.nextSibling;if(!i||i.name!==`AssignOp`)continue;let a=i.nextSibling;if(!a)continue;let o=t.slice(a.from,a.to).trim();n.push({key:r,value:o})}while(e.nextSibling());return n}function Hm(e,t){if(e.name===`String`){let n=t.slice(e.from,e.to);return n.startsWith(`r"""`)||n.startsWith(`r'''`)?n.slice(4,-3):n.startsWith(`"""`)||n.startsWith(`'''`)?n.slice(3,-3):n.startsWith(`r"`)||n.startsWith(`r'`)?n.slice(2,-1):n.slice(1,-1)}if(e.name===`FormatString`){let n=t.slice(e.from,e.to);return n.startsWith(`f"""`)||n.startsWith(`f'''`)?n.slice(4,-3):n.startsWith(`rf"""`)||n.startsWith(`rf'''`)||n.startsWith(`fr"""`)||n.startsWith(`fr'''`)?n.slice(5,-3):n.startsWith(`r"""`)||n.startsWith(`r'''`)?n.slice(4,-3):n.startsWith(`f"`)||n.startsWith(`f'`)?n.slice(2,-1):n.startsWith(`rf"`)||n.startsWith(`rf'`)||n.startsWith(`fr"`)||n.startsWith(`fr'`)?n.slice(3,-1):(n.startsWith(`r"`)||n.startsWith(`r'`),n.slice(2,-1))}return null}function Um(e){return e===``?0:e.startsWith(`rf"""`)||e.startsWith(`rf'''`)||e.startsWith(`fr"""`)||e.startsWith(`fr'''`)?5:e.startsWith(`f"""`)||e.startsWith(`f'''`)||e.startsWith(`r"""`)||e.startsWith(`r'''`)?4:e.startsWith(`"""`)||e.startsWith(`'''`)||e.startsWith(`rf'`)||e.startsWith(`rf"`)||e.startsWith(`fr'`)||e.startsWith(`fr"`)?3:e.startsWith(`f'`)||e.startsWith(`f"`)||e.startsWith(`r'`)||e.startsWith(`r"`)?2:e.startsWith(`'`)||e.startsWith(`"`)?1:0}function Wm(e){let t=[...Fm].sort((e,t)=>t.length-e.length);for(let n of t)if(e.startsWith(n))return[n,e.slice(n.length)];return[``,e]}function Gm(e,t){return e.replaceAll(`\\${t}`,t)}var Km=[[`"""`,`"""`],[`'''`,`'''`],[`"`,`"`],[`'`,`'`]],qm=Fm.flatMap(e=>Km.map(([t,n])=>[e+t,n])).map(([e,t])=>[e,RegExp(`^mo\\.md\\(\\s*${Jm(e)}(.*)${Jm(t)}\\s*\\)$`,`s`)]);function Jm(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var Ym=class{type=`markdown`;defaultCode=`mo.md(r"""
39
- """)`;defaultMetadata={quotePrefix:`r`};static fromMarkdown(e){return`mo.md(r"""\n${e}\n""")`}transformIn(e){e=e.trim();let t={...this.defaultMetadata};if(e===``)return{code:``,offset:0,metadata:t};for(let[n,r]of qm){let i=e.match(r);if(i){let r=i[1],[a,o]=Wm(n);t.quotePrefix=a;let s=Gm(r,o),c=e.indexOf(r);return{code:Em(`\n${s}\n`).trim(),offset:c,metadata:t}}}return{code:e,offset:0,metadata:t}}transformOut(e,t){e===``&&(e=` `);let{quotePrefix:n}=t,r=e.replaceAll(`""`,String.raw`"\"`),i=`mo.md(${n}"""\n`;return{code:i+r+`
40
- """)`,offset:i.length+1}}isSupported(e){if(e=e.trim(),e===``)return!0;if(!e.startsWith(`mo.md(`))return!1;if(e===`mo.md()`)return!0;let t=ai.parser.parse(e),n=[{match:`Script`},{match:`ExpressionStatement`},{match:`CallExpression`},{match:`MemberExpression`},{match:`VariableName`},{match:`.`},{match:`PropertyName`},{match:`ArgList`},{match:`(`},{match:/String|FormatString/,stop:!0},{match:`)`}],r=!0;return t.iterate({enter:e=>{let t=n.shift();if(t===void 0)return r=!1,!1;let i=t.match;return typeof i==`string`?(r&&=i===e.name,r&&!t.stop):(i.test(e.name)||(r=!1),r&&!t.stop)}}),r}},Xm=class{type=`python`;defaultCode=``;defaultMetadata={};transformIn(e){return{code:e,offset:0,metadata:{}}}transformOut(e,t){return{code:e,offset:0}}isSupported(e){return!0}},Zm=`__marimo_duckdb`,Qm=class{type=`sql`;defaultMetadata={dataframeName:`_df`,quotePrefix:`f`,commentLines:[],showOutput:!0,engine:Zm};get defaultCode(){return`_df = mo.sql(f"""SELECT * FROM """)`}static fromQuery(e){return`_df = mo.sql(f"""${e.trim()}""")`}transformIn(e){e=e.trim();let t={...this.defaultMetadata,commentLines:this.extractCommentLines(e)};if(!this.isSupported(e))return{code:e,offset:0,metadata:t};if(e===``)return{code:``,offset:0,metadata:t};let n=eh(e);return n?(t.dataframeName=n.dfName,t.showOutput=n.output??!0,t.engine=n.engine??Zm,{code:Em(`\n${n.sqlString}\n`).trim(),offset:n.startPosition,metadata:t}):{code:e,offset:0,metadata:t}}transformOut(e,t){let{quotePrefix:n,commentLines:r,showOutput:i,engine:a,dataframeName:o}=t,s=`${o} = mo.sql(\n ${n}"""\n`,c=e.replaceAll(`"""`,String.raw`\"""`),l=`\n """${i?``:`,
41
- output=False`}${a===Zm?``:`,\n engine=${a}`}\n)`;return{code:[...r,s].join(`
42
- `)+th(c)+l,offset:s.length+1}}isSupported(e){return e.trim()===``?!0:!e.includes(`mo.sql`)||e.split(`mo.sql`).length>2?!1:eh(e)!==null}extractCommentLines(e){let t=e.split(`
43
- `),n=[];for(let e of t)if(e?.startsWith(`#`))n.push(e);else break;return n}};function $m(e){do{if(e.name===`AssignStatement`)return e.node;if(e.name!==`Comment`)return null}while(e.next());return null}function eh(e){try{let t=Lm(e).cursor();t.name===`Script`&&t.next();let n=$m(t);if(!n||e.slice(n.to).trim().length>0)return null;let r=null,i=null,a,o,s=0,c=n.cursor();if(c.firstChild(),c.name===`VariableName`&&(r=e.slice(c.from,c.to)),!r)return null;let l=!1,u=null;for(;c.nextSibling();)if(c.name===`AssignOp`)l=!0;else if(l&&!u){u=c.node;break}if(!u||u.name===`ConditionalExpression`||u.name===`BinaryExpression`||u.name===`UnaryExpression`)return null;let d=u.cursor(),f=null;if(d.name===`CallExpression`)f=d.node;else{d.firstChild();do if(d.name===`CallExpression`){f=d.node;break}while(d.nextSibling())}if(f){let t=f.cursor(),n=!1;if(t.firstChild(),t.name===`MemberExpression`&&(n=e.slice(t.from,t.to)===`mo.sql`),n){for(;t.next();)if(t.name===`ArgList`){let{args:n,kwargs:c}=zm(t.node.cursor(),e);n.length===1&&(i=Hm(n[0],e),s=n[0].from+Um(e.slice(n[0].from,n[0].to)));for(let{key:e,value:t}of c)switch(e){case`engine`:a=t;break;case`output`:o=t===`True`}if(i===``)return{dfName:r,sqlString:``,engine:a,output:o,startPosition:s};break}}}return!r||!i?null:{dfName:r,sqlString:Im(i),engine:a,output:o,startPosition:s}}catch(e){return console.warn(`Failed to parse SQL statement`,e),null}}function th(e){return e.split(`
38
+ `:case`\u2028`:case`\u2029`:break;case`0`:if(Fm(e,r))return;t+=`\0`;break;case`x`:{let n=Im(e,r,r+2);if(n===-1)return;r+=2,t+=String.fromCharCode(n);break}case`u`:{let n;if(r<e.length&&e[r]===`{`){let t=e.indexOf(`}`,++r);if(t===-1)return;n=Im(e,r,t),r=t+1}else n=Im(e,r,r+4),r+=4;if(n===-1||n>1114111)return;t+=String.fromCodePoint(n);break}default:if(Fm(i,0))return;t+=i}n=r}return t+e.slice(n)}function Fm(e,t){let n=e.charCodeAt(t);return n>=Cm&&n<=wm}function Im(e,t,n){if(n>=e.length)return-1;let r=0;for(;t<n;t++){let n=Lm(e.charCodeAt(t));if(n===-1)return-1;r=r*16+n}return r}function Lm(e){return e>=Cm&&e<=wm?e-Cm:e>=Tm&&e<=Em?e-Tm+10:e>=Dm&&e<=Om?e-Dm+10:-1}var Rm=[``,`f`,`r`,`fr`,`rf`];function zm(e){try{return km(`\n${e}\n`).trim()}catch{return e}}function Bm(e){return ii.parse(e)}var Vm=new Set([`(`,`[`,`{`,`,`,`)`,`]`,`}`]);function Hm(e,t){return e.name===`ArgList`?{args:Um(e),kwargs:Wm(e,t)}:(console.warn(`Not an ArgList, name: ${e.name}`),{args:[],kwargs:[]})}function Um(e){e.firstChild();let t=[],n=e.name;do if(n=e.name,!Vm.has(n)){if(n===`VariableName`&&e.node.nextSibling?.name===`AssignOp`){e.prev();break}t.push(e.node)}while(e.nextSibling());return t}function Wm(e,t){let n=[],r=e.name;do if(r=e.name,r===`VariableName`){let r=t.slice(e.from,e.to),i=e.node.nextSibling;if(!i||i.name!==`AssignOp`)continue;let a=i.nextSibling;if(!a)continue;let o=t.slice(a.from,a.to).trim();n.push({key:r,value:o})}while(e.nextSibling());return n}function Gm(e,t){if(e.name===`String`){let n=t.slice(e.from,e.to);return n.startsWith(`r"""`)||n.startsWith(`r'''`)?n.slice(4,-3):n.startsWith(`"""`)||n.startsWith(`'''`)?n.slice(3,-3):n.startsWith(`r"`)||n.startsWith(`r'`)?n.slice(2,-1):n.slice(1,-1)}if(e.name===`FormatString`){let n=t.slice(e.from,e.to);return n.startsWith(`f"""`)||n.startsWith(`f'''`)?n.slice(4,-3):n.startsWith(`rf"""`)||n.startsWith(`rf'''`)||n.startsWith(`fr"""`)||n.startsWith(`fr'''`)?n.slice(5,-3):n.startsWith(`r"""`)||n.startsWith(`r'''`)?n.slice(4,-3):n.startsWith(`f"`)||n.startsWith(`f'`)?n.slice(2,-1):n.startsWith(`rf"`)||n.startsWith(`rf'`)||n.startsWith(`fr"`)||n.startsWith(`fr'`)?n.slice(3,-1):(n.startsWith(`r"`)||n.startsWith(`r'`),n.slice(2,-1))}return null}function Km(e){return e===``?0:e.startsWith(`rf"""`)||e.startsWith(`rf'''`)||e.startsWith(`fr"""`)||e.startsWith(`fr'''`)?5:e.startsWith(`f"""`)||e.startsWith(`f'''`)||e.startsWith(`r"""`)||e.startsWith(`r'''`)?4:e.startsWith(`"""`)||e.startsWith(`'''`)||e.startsWith(`rf'`)||e.startsWith(`rf"`)||e.startsWith(`fr'`)||e.startsWith(`fr"`)?3:e.startsWith(`f'`)||e.startsWith(`f"`)||e.startsWith(`r'`)||e.startsWith(`r"`)?2:e.startsWith(`'`)||e.startsWith(`"`)?1:0}function qm(e){let t=[...Rm].sort((e,t)=>t.length-e.length);for(let n of t)if(e.startsWith(n))return[n,e.slice(n.length)];return[``,e]}function Jm(e,t){return e.replaceAll(`\\${t}`,t)}var Ym=[[`"""`,`"""`],[`'''`,`'''`],[`"`,`"`],[`'`,`'`]],Xm=Rm.flatMap(e=>Ym.map(([t,n])=>[e+t,n])).map(([e,t])=>[e,RegExp(`^mo\\.md\\(\\s*${Zm(e)}(.*)${Zm(t)}\\s*\\)$`,`s`)]);function Zm(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var Qm=class{type=`markdown`;defaultCode=`mo.md(r"""
39
+ """)`;defaultMetadata={quotePrefix:`r`};static fromMarkdown(e){return`mo.md(r"""\n${e}\n""")`}transformIn(e){e=e.trim();let t={...this.defaultMetadata};if(e===``)return{code:``,offset:0,metadata:t};for(let[n,r]of Xm){let i=e.match(r);if(i){let r=i[1],[a,o]=qm(n);t.quotePrefix=a;let s=Jm(r,o),c=e.indexOf(r);return{code:km(`\n${s}\n`).trim(),offset:c,metadata:t}}}return{code:e,offset:0,metadata:t}}transformOut(e,t){e===``&&(e=` `);let{quotePrefix:n}=t,r=e.replaceAll(`""`,String.raw`"\"`),i=`mo.md(${n}"""\n`;return{code:i+r+`
40
+ """)`,offset:i.length+1}}isSupported(e){if(e=e.trim(),e===``)return!0;if(!e.startsWith(`mo.md(`))return!1;if(e===`mo.md()`)return!0;let t=ai.parser.parse(e),n=[{match:`Script`},{match:`ExpressionStatement`},{match:`CallExpression`},{match:`MemberExpression`},{match:`VariableName`},{match:`.`},{match:`PropertyName`},{match:`ArgList`},{match:`(`},{match:/String|FormatString/,stop:!0},{match:`)`}],r=!0;return t.iterate({enter:e=>{let t=n.shift();if(t===void 0)return r=!1,!1;let i=t.match;return typeof i==`string`?(r&&=i===e.name,r&&!t.stop):(i.test(e.name)||(r=!1),r&&!t.stop)}}),r}},$m=class{type=`python`;defaultCode=``;defaultMetadata={};transformIn(e){return{code:e,offset:0,metadata:{}}}transformOut(e,t){return{code:e,offset:0}}isSupported(e){return!0}},eh=`__marimo_duckdb`,th=class{type=`sql`;defaultMetadata={dataframeName:`_df`,quotePrefix:`f`,commentLines:[],showOutput:!0,engine:eh};get defaultCode(){return`_df = mo.sql(f"""SELECT * FROM """)`}static fromQuery(e){return`_df = mo.sql(f"""${e.trim()}""")`}transformIn(e){e=e.trim();let t={...this.defaultMetadata,commentLines:this.extractCommentLines(e)};if(!this.isSupported(e))return{code:e,offset:0,metadata:t};if(e===``)return{code:``,offset:0,metadata:t};let n=rh(e);return n?(t.dataframeName=n.dfName,t.showOutput=n.output??!0,t.engine=n.engine??eh,{code:km(`\n${n.sqlString}\n`).trim(),offset:n.startPosition,metadata:t}):{code:e,offset:0,metadata:t}}transformOut(e,t){let{quotePrefix:n,commentLines:r,showOutput:i,engine:a,dataframeName:o}=t,s=`${o} = mo.sql(\n ${n}"""\n`,c=e.replaceAll(`"""`,String.raw`\"""`),l=`\n """${i?``:`,
41
+ output=False`}${a===eh?``:`,\n engine=${a}`}\n)`;return{code:[...r,s].join(`
42
+ `)+ih(c)+l,offset:s.length+1}}isSupported(e){return e.trim()===``?!0:!e.includes(`mo.sql`)||e.split(`mo.sql`).length>2?!1:rh(e)!==null}extractCommentLines(e){let t=e.split(`
43
+ `),n=[];for(let e of t)if(e?.startsWith(`#`))n.push(e);else break;return n}};function nh(e){do{if(e.name===`AssignStatement`)return e.node;if(e.name!==`Comment`)return null}while(e.next());return null}function rh(e){try{let t=Bm(e).cursor();t.name===`Script`&&t.next();let n=nh(t);if(!n||e.slice(n.to).trim().length>0)return null;let r=null,i=null,a,o,s=0,c=n.cursor();if(c.firstChild(),c.name===`VariableName`&&(r=e.slice(c.from,c.to)),!r)return null;let l=!1,u=null;for(;c.nextSibling();)if(c.name===`AssignOp`)l=!0;else if(l&&!u){u=c.node;break}if(!u||u.name===`ConditionalExpression`||u.name===`BinaryExpression`||u.name===`UnaryExpression`)return null;let d=u.cursor(),f=null;if(d.name===`CallExpression`)f=d.node;else{d.firstChild();do if(d.name===`CallExpression`){f=d.node;break}while(d.nextSibling())}if(f){let t=f.cursor(),n=!1;if(t.firstChild(),t.name===`MemberExpression`&&(n=e.slice(t.from,t.to)===`mo.sql`),n){for(;t.next();)if(t.name===`ArgList`){let{args:n,kwargs:c}=Hm(t.node.cursor(),e);n.length===1&&(i=Gm(n[0],e),s=n[0].from+Km(e.slice(n[0].from,n[0].to)));for(let{key:e,value:t}of c)switch(e){case`engine`:a=t;break;case`output`:o=t===`True`}if(i===``)return{dfName:r,sqlString:``,engine:a,output:o,startPosition:s};break}}}return!r||!i?null:{dfName:r,sqlString:zm(i),engine:a,output:o,startPosition:s}}catch(e){return console.warn(`Failed to parse SQL statement`,e),null}}function ih(e){return e.split(`
44
44
  `).map(e=>e?.trim()?` ${e}`:e).join(`
45
- `)}var nh=()=>({cellIds:new Set}),{valueAtom:rh,useActions:ih}=jr(nh,{markForCut:(e,t)=>({cellIds:new Set(t.cellIds)}),clear:()=>nh()}),ah=o(e=>e(rh).cellIds),oh=o(null,(e,t)=>{t(rh,nh())});function sh(){return ih()}function ch(e){let t=(0,X.c)(3),n=s(ah),r;return t[0]!==e||t[1]!==n?(r=n.has(e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function lh(){return s(rh)}var uh=(e,t,n)=>Zn.define(r=>new fh(r,e,t,n)),dh=tr.define(),fh=class{sub;isInitDispatch=!1;view;doc;docPath;getTextFromDoc;constructor(e,t,n,r){this.view=e,this.doc=t,this.docPath=n,this.getTextFromDoc=r,this.sub=t.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;let t=this.view.state.doc.toString(),n=this.getTextFromDoc(this.doc);t!==n.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:n.toString()}],annotations:[dh.of(this)]})})}onRemoteUpdate=e=>{if(e.by!==`local`){if(e.by===`checkout`){this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[dh.of(this)]});return}if(e.by===`import`){let t=[],n=0;for(let{diff:r,path:i}of e.events){if(i.join(`/`)!==this.docPath.join(`/`)||r.type!==`text`)continue;let e=r.diff;for(let r of e)r.insert?t.push({from:n,to:n,insert:r.insert}):r.delete?(t.push({from:n,to:n+r.delete}),n+=r.delete):r.retain!=null&&(n+=r.retain);t.length>0&&this.view.dispatch({changes:t,annotations:[dh.of(this)]})}}}};update(e){if(this.isInitDispatch){this.isInitDispatch=!1;return}if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(dh)===this||e.transactions[0].annotation(dh)===`undo`))return;let t=0;e.changes.iterChanges((e,n,r,i,a)=>{let o=a.sliceString(0,a.length,`
46
- `);e!==n&&this.getTextFromDoc(this.doc).delete(e+t,n-e),o.length>0&&this.getTextFromDoc(this.doc).insert(e+t,o),t+=o.length-(n-e)}),this.doc.commit()}destroy(){this.sub?.(),this.sub=void 0}};function ph(e,t){if(typeof window>`u`)return;let n=`__marimo__${t}`;window[n]&&R.warn(`Overwriting existing debug object ${n}`),window[n]=e}var mh={markdown:!0,wasm_layouts:!1,rtc_v2:!1,cache_panel:!1,external_agents:!1,debugger:!1,line_timing:!1};function hh(e){return ie()?.experimental?.[e]??mh[e]}function gh(e,t){Hr().saveUserConfig({config:{experimental:{[e]:t}}})}ph(gh,`setFeatureFlag`);function _h(e,t){return{get:()=>t.get(e),sub:n=>t.sub(e,()=>n(t.get(e)))}}function vh(e,{offset:t,body:n=window,behavior:r=`smooth`}){let i=t?.top??0,a=t?.bottom??0,o=e.getBoundingClientRect();if(o.top<i){n.scrollBy({top:o.top-i,behavior:r});return}if(o.bottom>window.innerHeight-a){n.scrollBy({top:o.bottom-window.innerHeight+a,behavior:r});return}}function yh(e){return e?e.state.field(bA).type:`python`}function bh(e,t){return!e||yh(e)===t?!1:e.state.doc.toString().trim()===``||Cw[t].isSupported(OA(e))}function xh(e,t,n={}){return!n.force&&!bh(e,t)?!1:(EA(e,{language:t}),t)}function Sh(e){return pn.of([{key:e.getHotkey(`cell.format`).key,preventDefault:!0,run:e=>(cm({[e.state.facet(Of)]:e}),!0)},{key:e.getHotkey(`cell.viewAsMarkdown`).key,preventDefault:!0,run:e=>{let t=xh(e,yh(e)===`markdown`?`python`:`markdown`,{force:!0});return t===`markdown`&&e.state.facet(Df).afterToggleMarkdown(),t!==!1}},{key:e.getHotkey(`cell.viewAsSQL`).key,preventDefault:!0,run:e=>{let t=xh(e,yh(e)===`sql`?`python`:`sql`,{force:!0});return t===`sql`&&e.state.facet(Df).afterToggleSQL(),t!==!1}}])}function Ch(){return Jn.updateListener.of(e=>{if(e.view.hasFocus&&e.heightChanged&&e.docChanged){if(e.transactions.some(e=>e.effects.some(e=>e.is(sm))))return;wh(e.view,{behavior:`smooth`})}})}function wh(e,t){let n=e.dom.getElementsByClassName(`cm-activeLine cm-line`);if(n.length===1){let e=n[0],r=document.getElementById(`App`);B(r,`App not found`),vh(e,{offset:{top:30,bottom:150},body:r,behavior:t.behavior})}}function Th(){return{}}var{reducer:Eh,createActions:Dh,valueAtom:Oh,useActions:kh}=jr(Th,{setVariables:(e,t)=>{let n={...e},r={};for(let e of t)r[e.name]={...n[e.name],...e};return r},addVariables:(e,t)=>{let n={...e};for(let e of t)n[e.name]={...n[e.name],...e};return n},setMetadata:(e,t)=>{let n={...e};for(let{name:e,value:r,dataType:i}of t)n[e]&&(n[e]={...n[e],value:r,dataType:i});return n}}),Ah=()=>s(Oh);function jh(){return kh()}function Mh(e){let t=e.storage||is;return{getItem(n,r){try{let i=t.getItem(n);if(!i)return r;let a=JSON.parse(i);return e.fromSerializable(a)}catch(e){return R.warn(`Error getting ${n} from storage`,e),r}},setItem:(n,r)=>{t.setItem(n,JSON.stringify(e.toSerializable(r)))},removeItem:e=>{t.removeItem(e)}}}var Nh=xe(()=>is),Ph=[{type:`files`,Icon:jo,label:`Files`,tooltip:`View files and remote storage`,defaultSection:`sidebar`,additionalKeywords:[`explorer`,`browser`,`directory`]},{type:`variables`,Icon:Jo,label:`Variables`,tooltip:`Explore variables and data sources`,defaultSection:`sidebar`,additionalKeywords:[`state`,`scope`,`inspector`]},{type:`packages`,Icon:xo,label:`Packages`,tooltip:`Manage packages`,defaultSection:`sidebar`,additionalKeywords:[`dependencies`,`pip`,`install`]},{type:`ai`,Icon:bo,label:`AI`,tooltip:`Chat & Agents`,defaultSection:`sidebar`,additionalKeywords:[`chat`,`copilot`,`assistant`]},{type:`outline`,Icon:Bo,label:`Outline`,tooltip:`View outline`,defaultSection:`sidebar`,additionalKeywords:[`toc`,`structure`,`headings`]},{type:`documentation`,Icon:qo,label:`Docs`,tooltip:`View live docs`,defaultSection:`sidebar`,additionalKeywords:[`reference`,`api`]},{type:`dependencies`,Icon:Io,label:`Dependencies`,tooltip:`Explore dependencies`,defaultSection:`sidebar`,additionalKeywords:[`graph`,`imports`]},{type:`errors`,Icon:Eo,label:`Errors`,tooltip:`View errors`,defaultSection:`developer-panel`,additionalKeywords:[`exceptions`,`problems`,`diagnostics`]},{type:`scratchpad`,Icon:Lo,label:`Scratchpad`,tooltip:`Scratchpad`,defaultSection:`developer-panel`,additionalKeywords:[`scratch`,`draft`,`playground`]},{type:`tracing`,Icon:Dt,label:`Tracing`,tooltip:`View tracing`,defaultSection:`developer-panel`,additionalKeywords:[`profiling`,`performance`]},{type:`secrets`,Icon:No,label:`Secrets`,tooltip:`Manage secrets`,defaultSection:`developer-panel`,hidden:_e(),additionalKeywords:[`env`,`environment`,`keys`,`credentials`]},{type:`logs`,Icon:Ot,label:`Logs`,tooltip:`View logs`,defaultSection:`developer-panel`,additionalKeywords:[`console`,`stdout`]},{type:`terminal`,Icon:Go,label:`Terminal`,tooltip:`Terminal`,hidden:_e(),defaultSection:`developer-panel`,requiredCapability:`terminal`,additionalKeywords:[`shell`,`console`,`bash`,`command`]},{type:`snippets`,Icon:Uo,label:`Snippets`,tooltip:`Snippets`,defaultSection:`developer-panel`,additionalKeywords:[`templates`,`examples`]},{type:`cache`,Icon:Rt,label:`Cache`,tooltip:`View cache`,defaultSection:`developer-panel`,hidden:!hh(`cache_panel`),additionalKeywords:[`memory`,`memoize`]}],Fh=new Map(Ph.map(e=>[e.type,e]));function Ih({panel:e,capabilities:t,aiEnabled:n}){return!!(e.hidden||e.type===`ai`&&!n||e.requiredCapability&&!t[e.requiredCapability])}var Lh={sidebar:Ph.filter(e=>!e.hidden&&e.defaultSection===`sidebar`).map(e=>e.type),developerPanel:Ph.filter(e=>!e.hidden&&e.defaultSection===`developer-panel`).map(e=>e.type)};function Rh(e){let t=new Set([...e.sidebar,...e.developerPanel]);return{sidebar:[...e.sidebar,...Lh.sidebar.filter(e=>!t.has(e))],developerPanel:[...e.developerPanel,...Lh.developerPanel.filter(e=>!t.has(e))]}}var zh=Mh({toSerializable:e=>e,fromSerializable:e=>Rh(e)}),Bh=ve(`marimo:panel-layout`,Lh,zh,{getOnInit:!0});function Vh(e){let t=u.get(Bh);return t.sidebar.includes(e)?`sidebar`:t.developerPanel.includes(e)?`developer-panel`:null}var Hh=`marimo:sidebar`,Uh=new os(_({selectedPanel:h().optional().transform(e=>e),isSidebarOpen:m(),isDeveloperPanelOpen:m().optional().default(!1),selectedDeveloperPanelTab:h().optional().default(`errors`).transform(e=>e)}),Wh);function Wh(){return{selectedPanel:`variables`,isSidebarOpen:!1,isDeveloperPanelOpen:!1,selectedDeveloperPanelTab:`errors`}}var{reducer:Gh,createActions:Kh,valueAtom:qh,useActions:Jh}=jr(()=>Uh.get(Hh),{openApplication:(e,t)=>{let n=Vh(t);return n===`sidebar`?{...e,selectedPanel:t,isSidebarOpen:!0}:n===`developer-panel`?{...e,selectedDeveloperPanelTab:t,isDeveloperPanelOpen:!0}:e},toggleApplication:(e,t)=>{let n=Vh(t);return n===`sidebar`?{...e,selectedPanel:t,isSidebarOpen:!e.isSidebarOpen||e.selectedPanel!==t}:n===`developer-panel`?{...e,selectedDeveloperPanelTab:t,isDeveloperPanelOpen:!e.isDeveloperPanelOpen||e.selectedDeveloperPanelTab!==t}:e},toggleSidebarPanel:e=>({...e,isSidebarOpen:!e.isSidebarOpen}),setIsSidebarOpen:(e,t)=>({...e,isSidebarOpen:t}),toggleDeveloperPanel:e=>({...e,isDeveloperPanelOpen:!e.isDeveloperPanelOpen}),setIsDeveloperPanelOpen:(e,t)=>({...e,isDeveloperPanelOpen:t})},[(e,t)=>Uh.set(Hh,t)]),Yh=()=>{let e=(0,X.c)(2),t=s(qh);if(t.isSidebarOpen)return t;let n;return e[0]===t?n=e[1]:(n={...t,selectedPanel:void 0},e[0]=t,e[1]=n),n};function Xh(){return Jh()}function Zh(e){u.set(qh,t=>Gh(t,{type:`openApplication`,payload:e}))}var Qh=o({terminal:!1,pylsp:!1,basedpyright:!1,ty:!1,pyrefly:!1});function $h(e){return u.get(Qh)?.[e]??!1}var eg=o({documentation:null}),Q={VariableName:`VariableName`,FunctionDefinition:`FunctionDefinition`,ClassDefinition:`ClassDefinition`,LambdaExpression:`LambdaExpression`,ParamList:`ParamList`,Decorator:`Decorator`,AssignStatement:`AssignStatement`,ForStatement:`ForStatement`,ImportStatement:`ImportStatement`,TryStatement:`TryStatement`,WithStatement:`WithStatement`,TupleExpression:`TupleExpression`,ArrayExpression:`ArrayExpression`,ParenthesizedExpression:`ParenthesizedExpression`,CallExpression:`CallExpression`,ArgList:`ArgList`,AssignOp:`AssignOp`,ArrayComprehensionExpression:`ArrayComprehensionExpression`,SetComprehensionExpression:`SetComprehensionExpression`,DictionaryComprehensionExpression:`DictionaryComprehensionExpression`,ComprehensionExpression:`ComprehensionExpression`,Comment:`Comment`,String:`String`,FormatString:`FormatString`},tg={For:`for`,In:`in`,As:`as`,Import:`import`},ng=new Set([Q.FunctionDefinition,Q.LambdaExpression,Q.ArrayComprehensionExpression,Q.SetComprehensionExpression,Q.DictionaryComprehensionExpression,Q.ComprehensionExpression,Q.ClassDefinition]),rg=new Set([Q.Comment,Q.String,Q.FormatString]);function ig(e){let t=gn(e.state);if(!t||cg(t))return[];let n=new Set(Object.keys(e.variables).filter(t=>{let n=e.variables[t];return n.dataType!==`module`&&!n.declaredBy.includes(`setup`)&&!n.declaredBy.includes(e.cellId)}));if(n.size===0)return[];let r=[],i=new Map,a=new Map,o=new Map;function s(t,n){let r=t.cursor(),c=r.name,l=r.from,u=ng.has(c),d=n;switch(u&&(d=[...n,l],i.set(l,new Set),a.set(l,c)),c){case Q.FunctionDefinition:{let r=t.cursor();r.firstChild();do if(r.name===Q.VariableName){let t=e.state.doc.sliceString(r.from,r.to),a=n[n.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t);break}while(r.nextSibling());let a=t.cursor();a.firstChild();do if(a.name===Q.ParamList){let t=a.node.cursor();t.firstChild();do if(t.name===Q.VariableName){let n=e.state.doc.sliceString(t.from,t.to);i.get(l)?.add(n)}while(t.nextSibling())}while(a.nextSibling());break}case Q.LambdaExpression:{let n=t.cursor();n.firstChild();do if(n.name===Q.ParamList){let t=n.node.cursor();t.firstChild();do if(t.name===Q.VariableName){let n=e.state.doc.sliceString(t.from,t.to);i.get(l)?.add(n)}while(t.nextSibling())}while(n.nextSibling());break}case Q.ArrayComprehensionExpression:case Q.DictionaryComprehensionExpression:case Q.SetComprehensionExpression:case Q.ComprehensionExpression:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===tg.For)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to);i.get(l)?.add(t)}else if(r&&n.name===Q.TupleExpression){let t=n.node.cursor();t.firstChild();do if(t.name===Q.VariableName){let n=e.state.doc.sliceString(t.from,t.to);i.get(l)?.add(n)}while(t.nextSibling())}else r&&n.name===tg.In&&(r=!1);while(n.nextSibling());break}case Q.ClassDefinition:{let r=t.cursor();r.firstChild();do if(r.name===Q.VariableName){let t=e.state.doc.sliceString(r.from,r.to),a=n[n.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t);break}while(r.nextSibling());o.set(l,[]);break}case Q.AssignStatement:{let n=t.cursor(),s=[];n.firstChild();do n.name===Q.AssignOp&&s.push(n.from);while(n.nextSibling());let c=s[s.length-1],l=t.cursor();l.firstChild();let u=d[d.length-1]??-1;do l.from<c&&lg(l,{currentScope:u,state:e.state,allDeclarations:i,scopeTypes:a,classLevelDeclarations:o,assignmentPosition:r.to});while(l.nextSibling());break}case Q.ForStatement:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===tg.For)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to),r=d[d.length-1]??-1;i.has(r)||i.set(r,new Set),i.get(r)?.add(t)}else r&&n.name===tg.In&&(r=!1);while(n.nextSibling());break}case Q.ImportStatement:{let n=t.cursor();n.firstChild();let r=d[d.length-1]??-1;i.has(r)||i.set(r,new Set);let a=i.get(r),o=!1,s=null,c=()=>{s!==null&&a?.add(s),s=null};do{if(n.name===tg.Import){o=!0;continue}if(o){if(n.name===tg.As){s=null;continue}n.name===Q.VariableName?(c(),s=e.state.doc.sliceString(n.from,n.to)):n.name===`,`&&c()}}while(n.nextSibling());c();break}case Q.TryStatement:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===tg.As)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to),a=d[d.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t),r=!1}while(n.nextSibling());break}case Q.WithStatement:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===tg.As)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to),a=d[d.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t),r=!1}while(n.nextSibling());break}}f(r,e=>{s(e,d)})}function c(e,t,n){let r=o.get(t);return r?r.some(([t,r])=>t===e&&r<n):!1}function l(e,t,n){for(let r of t)if(a.get(r)===Q.ClassDefinition){if(c(e,r,n))return!0}else if(i.get(r)?.has(e))return!0;return i.get(-1)?.has(e)??!1}function u(t,n){let i=t.cursor(),a=i.name,o=i.from;if(a===Q.ImportStatement)return;let s=ng.has(a),c=n;if(s&&(c=[...n,o]),a===Q.VariableName){let t=e.state.doc.sliceString(i.from,i.to);d(t,i)&&(l(t,c,i.from)||r.push({from:i.from,to:i.to,variableName:t}))}f(i,e=>{u(e,c)})}function d(e,t){return n.has(e)&&!sg(t)&&!ag(t)&&!og(t)}function f(e,t){if(e.firstChild())do t(e.node);while(e.nextSibling())}return s(t,[]),u(t,[]),r}function ag(e){let t=e.node.cursor();if(t.moveTo(e.from),t.parent()&&t.name===Q.CallExpression&&t.firstChild())do if(t.name===Q.ArgList&&t.firstChild()){do if(t.from===e.from&&t.to===e.to)return t.nextSibling()&&t.name===Q.AssignOp;while(t.nextSibling());break}while(t.nextSibling());return!1}function og(e){let t=e.node.cursor();if(t.parent()&&t.name===Q.AssignStatement){let n=t.node.cursor();n.firstChild();let r=-1;do if(n.name===Q.AssignOp){r=n.from;break}while(n.nextSibling());return r!==-1&&e.from<r}return!1}function sg(e){let t=e.node.cursor();return!!(t.prevSibling()&&t.name===`.`)}function cg(e){let t=e.cursor();do if(t.name===`⚠`||t.type.isError)return!0;while(t.next());return!1}function lg(e,t){switch(e.name){case Q.VariableName:{let n=t.state.doc.sliceString(e.from,e.to);if(t.currentScope!==-1&&t.scopeTypes.get(t.currentScope)===Q.ClassDefinition){let e=t.classLevelDeclarations.get(t.currentScope);e&&e.push([n,t.assignmentPosition])}else t.allDeclarations.has(t.currentScope)||t.allDeclarations.set(t.currentScope,new Set),t.allDeclarations.get(t.currentScope)?.add(n);break}case Q.TupleExpression:{let n=e.node.cursor();n.firstChild();do lg(n,t);while(n.nextSibling());break}case Q.ArrayExpression:{let n=e.node.cursor();n.firstChild();do lg(n,t);while(n.nextSibling());break}}}var ug=Fn.mark({class:`mo-cm-reactive-reference`}),dg=Fn.mark({class:`mo-cm-reactive-reference-hover`}),fg=Cn.define(),pg=class{view;cellId;variablesUnsubscribe;highlightDebounceMs=300;scheduleHighlighting;constructor(e,t){this.view=e,this.cellId=t,this.scheduleHighlighting=ne(()=>{this.runHighlighting()},this.highlightDebounceMs),this.variablesUnsubscribe=u.sub(Oh,()=>{this.scheduleHighlighting()}),this.scheduleHighlighting()}update(e){(e.docChanged||e.focusChanged)&&this.scheduleHighlighting()}destroy(){this.scheduleHighlighting.cancel(),this.variablesUnsubscribe()}runHighlighting(){let e=ig({state:this.view.state,cellId:this.cellId,variables:u.get(Oh)});e.length>0&&R.debug(`Found ${e.length} reactive variables in cell ${this.cellId}`),queueMicrotask(()=>{this.view.dispatch({effects:fg.of(e)})})}},mg=cn.define({create(){return{decorations:Fn.none,ranges:[]}},update(e,t){let n={decorations:e.decorations.map(t.changes),ranges:e.ranges};for(let e of t.effects)e.is(fg)&&(n={decorations:Fn.set(e.value.map(e=>ug.range(e.from,e.to))),ranges:e.value});return n},provide:e=>Jn.decorations.from(e,e=>e.decorations)});function hg(e){return[mg,Zn.define(t=>new pg(t,e))]}function gg(e,t){return t?hg(e):[]}function _g(e,t=!1){if(!e)return null;let n=document.createElement(`span`);if(n.classList.add(`mo-cm-tooltip`),n.classList.add(`docs-documentation`),t&&n.classList.add(`cm-tooltip-section`),n.style.display=`flex`,n.style.flexDirection=`column`,n.style.gap=`.8rem`,n.innerHTML=e,t){let e=document.createElement(`div`);e.classList.add(`text-xs`,`text-muted-foreground`,`font-medium`,`pt-1`,`-mt-2`,`border-t`,`border-border`);let t=document.createElement(`kbd`);t.className=`ml-1 rounded-md bg-muted/40 px-2 text-[0.75rem] font-prose center border border-foreground/20 text-muted-foreground inline whitespace-nowrap`,t.textContent=se()?`⌘`:`Ctrl`,e.append(document.createTextNode(`Jump to defining cell `)),e.append(t),e.append(document.createTextNode(` + Click`)),n.append(e)}return n}var vg=new Qt(`autocomplete-result`,async(e,t)=>{let{sendCodeCompletionRequest:n}=Hr();await n({id:e,...t})}),yg={param:3,property:2},bg={asCompletionResult(e,t){return{from:e-t.prefix_length,options:t.options.map(e=>({label:e.name,type:e.type,boost:yg[e.type]??1,info:()=>_g(e.completion_info)})),validFor:/^\w*$/}},asHoverTooltip({position:e,message:t,limitToType:n,excludeTypes:r,exactName:i,showGoToDefinitionHint:a=!1}){let o=xg(t.options,i);if(!o)return;let s=e-t.prefix_length,c=_g(o.completion_info,a);if(c&&!(n&&o.type!==n)&&!r?.includes(o.type))return{pos:s,html:o.completion_info,end:s+o.name.length,above:!0,create:()=>({dom:c,resize:!1})}}};function xg(e,t){if(e.length!==0){if(e.length===1)return e[0];if(t)return e.find(e=>e.name===t)}}function Sg(e){return[e?.pylsp?.enabled&&$h(`pylsp`)||e?.ty?.enabled&&$h(`ty`)||e?.pyrefly?.enabled&&$h(`pyrefly`)||e?.basedpyright?.enabled&&$h(`basedpyright`)?[]:En(async(e,t)=>{let n=await Cg({view:e,pos:t,excludeTypes:[`tooltip`]});return n===null||n===`cancelled`?null:n},{hideOnChange:!0}),Dg]}async function Cg({view:e,pos:t,excludeTypes:n}){let r=Li.findElement(e.dom);if(!r)return R.error(`Failed to find active cell.`),null;let i=Li.parse(r.id),{startToken:a,endToken:o}=wg(e.state.doc,t),s=e.state.field(mg,!1)?.ranges.some(e=>t>=e.from&&t<=e.to)??!1,c=await vg.request({document:e.state.doc.slice(0,o).toString(),cellId:i});if(!c)return`cancelled`;let l=e.state.doc.slice(a,o).toString();return bg.asHoverTooltip({position:o,message:c,exactName:l,excludeTypes:n,showGoToDefinitionHint:s})??null}function wg(e,t){let n=t,r=n>0?e.sliceString(n-1,n):``,i=n<e.length?e.sliceString(n,n+1):``;r===`(`&&i===`)`&&--n;let a=n,o=n;for(;a>0;){let t=e.sliceString(a-1,a);if(!/\w/.test(t))break;a--}for(;o<e.length;){let t=e.sliceString(o,o+1);if(!/\w/.test(t))break;o++}return{startToken:a,endToken:o}}function Tg(e){let{head:t}=e.selection.main,n=e.doc.sliceString(t-1,t);return/\w/.test(n)}var Eg=ne(async(e,t)=>{if(u.get(qh).selectedPanel!==`documentation`)return;let n=await Cg({view:e,pos:t});n!==`cancelled`&&u.set(eg,{documentation:n?.html??null})},300),Dg=Jn.updateListener.of(e=>{if(e.selectionSet&&Tg(e.state)){let t=e.state.selection.main.head;Eg(e.view,t)}});function Og(e){var t=e.Pos;function n(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line).charCodeAt(t.ch);55296<=r&&r<=55551&&(n.ch+=1)}return{start:t,end:n}}var r=[{keys:`<Left>`,type:`keyToKey`,toKeys:`h`},{keys:`<Right>`,type:`keyToKey`,toKeys:`l`},{keys:`<Up>`,type:`keyToKey`,toKeys:`k`},{keys:`<Down>`,type:`keyToKey`,toKeys:`j`},{keys:`g<Up>`,type:`keyToKey`,toKeys:`gk`},{keys:`g<Down>`,type:`keyToKey`,toKeys:`gj`},{keys:`<Space>`,type:`keyToKey`,toKeys:`l`},{keys:`<BS>`,type:`keyToKey`,toKeys:`h`},{keys:`<Del>`,type:`keyToKey`,toKeys:`x`},{keys:`<C-Space>`,type:`keyToKey`,toKeys:`W`},{keys:`<C-BS>`,type:`keyToKey`,toKeys:`B`},{keys:`<S-Space>`,type:`keyToKey`,toKeys:`w`},{keys:`<S-BS>`,type:`keyToKey`,toKeys:`b`},{keys:`<C-n>`,type:`keyToKey`,toKeys:`j`},{keys:`<C-p>`,type:`keyToKey`,toKeys:`k`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`s`,type:`keyToKey`,toKeys:`cl`,context:`normal`},{keys:`s`,type:`keyToKey`,toKeys:`c`,context:`visual`},{keys:`S`,type:`keyToKey`,toKeys:`cc`,context:`normal`},{keys:`S`,type:`keyToKey`,toKeys:`VdO`,context:`visual`},{keys:`<Home>`,type:`keyToKey`,toKeys:`0`},{keys:`<End>`,type:`keyToKey`,toKeys:`$`},{keys:`<PageUp>`,type:`keyToKey`,toKeys:`<C-b>`},{keys:`<PageDown>`,type:`keyToKey`,toKeys:`<C-f>`},{keys:`<CR>`,type:`keyToKey`,toKeys:`j^`,context:`normal`},{keys:`<Ins>`,type:`keyToKey`,toKeys:`i`,context:`normal`},{keys:`<Ins>`,type:`action`,action:`toggleOverwrite`,context:`insert`},{keys:`H`,type:`motion`,motion:`moveToTopLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`M`,type:`motion`,motion:`moveToMiddleLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`L`,type:`motion`,motion:`moveToBottomLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`h`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!1}},{keys:`l`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!0}},{keys:`j`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,linewise:!0}},{keys:`k`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,linewise:!0}},{keys:`gj`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!0}},{keys:`gk`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!1}},{keys:`w`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1}},{keys:`W`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:`e`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:`E`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`b`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1}},{keys:`B`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:`ge`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:`gE`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`{`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`}`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`(`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!1}},{keys:`)`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!0}},{keys:`<C-f>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!0}},{keys:`<C-b>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!1}},{keys:`<C-d>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!0,explicitRepeat:!0}},{keys:`<C-u>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!1,explicitRepeat:!0}},{keys:`gg`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`G`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`g$`,type:`motion`,motion:`moveToEndOfDisplayLine`},{keys:`g^`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`g0`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`0`,type:`motion`,motion:`moveToStartOfLine`},{keys:`^`,type:`motion`,motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`+`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0}},{keys:`-`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,toFirstChar:!0}},{keys:`_`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:`$`,type:`motion`,motion:`moveToEol`,motionArgs:{inclusive:!0}},{keys:`%`,type:`motion`,motion:`moveToMatchedSymbol`,motionArgs:{inclusive:!0,toJumplist:!0}},{keys:`f<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`F<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!1}},{keys:`t<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`T<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!1}},{keys:`;`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!0}},{keys:`,`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!1}},{keys:`'<register>`,type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0}},{keys:"]`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0}},{keys:"[`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1}},{keys:`]'`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0,linewise:!0}},{keys:`['`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1,linewise:!0}},{keys:`]p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:`[p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:`]<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`[<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`|`,type:`motion`,motion:`moveToColumn`},{keys:`o`,type:`motion`,motion:`moveToOtherHighlightedEnd`,context:`visual`},{keys:`O`,type:`motion`,motion:`moveToOtherHighlightedEnd`,motionArgs:{sameLine:!0},context:`visual`},{keys:`d`,type:`operator`,operator:`delete`},{keys:`y`,type:`operator`,operator:`yank`},{keys:`c`,type:`operator`,operator:`change`},{keys:`=`,type:`operator`,operator:`indentAuto`},{keys:`>`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!0}},{keys:`<`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!1}},{keys:`g~`,type:`operator`,operator:`changeCase`},{keys:`gu`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},isEdit:!0},{keys:`gU`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},isEdit:!0},{keys:`gc`,type:`operator`,operator:`toggleComment`,isEdit:!0},{keys:`n`,type:`motion`,motion:`findNext`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`N`,type:`motion`,motion:`findNext`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`gn`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!0}},{keys:`gN`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!1}},{keys:`gq`,type:`operator`,operator:`hardWrap`},{keys:`gw`,type:`operator`,operator:`hardWrap`,operatorArgs:{keepCursor:!0}},{keys:`g?`,type:`operator`,operator:`rot13`},{keys:`x`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:`X`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:`D`,type:`operatorMotion`,operator:`delete`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`D`,type:`operator`,operator:`delete`,operatorArgs:{linewise:!0},context:`visual`},{keys:`Y`,type:`operatorMotion`,operator:`yank`,motion:`expandToLine`,motionArgs:{linewise:!0},context:`normal`},{keys:`Y`,type:`operator`,operator:`yank`,operatorArgs:{linewise:!0},context:`visual`},{keys:`C`,type:`operatorMotion`,operator:`change`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`C`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0},context:`visual`},{keys:`~`,type:`operatorMotion`,operator:`changeCase`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:`normal`},{keys:`~`,type:`operator`,operator:`changeCase`,context:`visual`},{keys:`<C-u>`,type:`operatorMotion`,operator:`delete`,motion:`moveToStartOfLine`,context:`insert`},{keys:`<C-w>`,type:`operatorMotion`,operator:`delete`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1},context:`insert`},{keys:`<C-w>`,type:`idle`,context:`normal`},{keys:`<C-i>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!0}},{keys:`<C-o>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!1}},{keys:`<C-e>`,type:`action`,action:`scroll`,actionArgs:{forward:!0,linewise:!0}},{keys:`<C-y>`,type:`action`,action:`scroll`,actionArgs:{forward:!1,linewise:!0}},{keys:`a`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`charAfter`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`eol`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`endOfSelectedArea`},context:`visual`},{keys:`i`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`inplace`},context:`normal`},{keys:`gi`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`lastEdit`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`firstNonBlank`},context:`normal`},{keys:`gI`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`bol`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`startOfSelectedArea`},context:`visual`},{keys:`o`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:`normal`},{keys:`O`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:`normal`},{keys:`v`,type:`action`,action:`toggleVisualMode`},{keys:`V`,type:`action`,action:`toggleVisualMode`,actionArgs:{linewise:!0}},{keys:`<C-v>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`<C-q>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`gv`,type:`action`,action:`reselectLastSelection`},{keys:`J`,type:`action`,action:`joinLines`,isEdit:!0},{keys:`gJ`,type:`action`,action:`joinLines`,actionArgs:{keepSpaces:!0},isEdit:!0},{keys:`p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:`P`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:`r<character>`,type:`action`,action:`replace`,isEdit:!0},{keys:`@<register>`,type:`action`,action:`replayMacro`},{keys:`q<register>`,type:`action`,action:`enterMacroRecordMode`},{keys:`R`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{replace:!0},context:`normal`},{keys:`R`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0,fullLine:!0},context:`visual`,exitVisualBlock:!0},{keys:`u`,type:`action`,action:`undo`,context:`normal`},{keys:`u`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},context:`visual`,isEdit:!0},{keys:`U`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},context:`visual`,isEdit:!0},{keys:`<C-r>`,type:`action`,action:`redo`},{keys:`m<register>`,type:`action`,action:`setMark`},{keys:`"<register>`,type:`action`,action:`setRegister`},{keys:`<C-r><register>`,type:`action`,action:`insertRegister`,context:`insert`,isEdit:!0},{keys:`<C-o>`,type:`action`,action:`oneNormalCommand`,context:`insert`},{keys:`zz`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`}},{keys:`z.`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zt`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`}},{keys:`z<CR>`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zb`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`}},{keys:`z-`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`.`,type:`action`,action:`repeatLastEdit`},{keys:`<C-a>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:`<C-x>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:`<C-t>`,type:`action`,action:`indent`,actionArgs:{indentRight:!0},context:`insert`},{keys:`<C-d>`,type:`action`,action:`indent`,actionArgs:{indentRight:!1},context:`insert`},{keys:`a<register>`,type:`motion`,motion:`textObjectManipulation`},{keys:`i<register>`,type:`motion`,motion:`textObjectManipulation`,motionArgs:{textObjectInner:!0}},{keys:`/`,type:`search`,searchArgs:{forward:!0,querySrc:`prompt`,toJumplist:!0}},{keys:`?`,type:`search`,searchArgs:{forward:!1,querySrc:`prompt`,toJumplist:!0}},{keys:`*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`g*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`g#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`:`,type:`ex`}],i=Object.create(null),a=r.length,o=[{name:`colorscheme`,shortName:`colo`},{name:`map`},{name:`imap`,shortName:`im`},{name:`nmap`,shortName:`nm`},{name:`vmap`,shortName:`vm`},{name:`omap`,shortName:`om`},{name:`noremap`,shortName:`no`},{name:`nnoremap`,shortName:`nn`},{name:`vnoremap`,shortName:`vn`},{name:`inoremap`,shortName:`ino`},{name:`onoremap`,shortName:`ono`},{name:`unmap`},{name:`mapclear`,shortName:`mapc`},{name:`nmapclear`,shortName:`nmapc`},{name:`vmapclear`,shortName:`vmapc`},{name:`imapclear`,shortName:`imapc`},{name:`omapclear`,shortName:`omapc`},{name:`write`,shortName:`w`},{name:`undo`,shortName:`u`},{name:`redo`,shortName:`red`},{name:`set`,shortName:`se`},{name:`setlocal`,shortName:`setl`},{name:`setglobal`,shortName:`setg`},{name:`sort`,shortName:`sor`},{name:`substitute`,shortName:`s`,possiblyAsync:!0},{name:`startinsert`,shortName:`start`},{name:`nohlsearch`,shortName:`noh`},{name:`yank`,shortName:`y`},{name:`put`,shortName:`pu`},{name:`delmarks`,shortName:`delm`},{name:`marks`,excludeFromCommandHistory:!0},{name:`registers`,shortName:`reg`,excludeFromCommandHistory:!0},{name:`vglobal`,shortName:`v`},{name:`delete`,shortName:`d`},{name:`join`,shortName:`j`},{name:`normal`,shortName:`norm`},{name:`global`,shortName:`g`}],s=ue(``);function c(t){t.setOption(`disableInput`,!0),t.setOption(`showCursorWhenSelecting`,!1),e.signal(t,`vim-mode-change`,{mode:`normal`}),t.on(`cursorActivity`,an),N(t),e.on(t.getInputField(),`paste`,u(t))}function l(t){t.setOption(`disableInput`,!1),t.off(`cursorActivity`,an),e.off(t.getInputField(),`paste`,u(t)),t.state.vim=null,Ft&&clearTimeout(Ft)}function u(e){var t=e.state.vim;return t.onPasteFn||=function(){t.insertMode||(e.setCursor(we(e.getCursor(),0,1)),xe.enterInsertMode(e,{},t))},t.onPasteFn}var d=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],p=[function(e){return/\S/.test(e)}],m=[`<`,`>`],h=[`-`,`"`,`.`,`:`,`_`,`/`,`+`],g=/^\w$/,_=/^[A-Z]$/;try{_=RegExp(`^[\\p{Lu}]$`,`u`)}catch{}function v(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function y(e){return/^[a-z]$/.test(e)}function b(e){return`()[]{}`.indexOf(e)!=-1}function x(e){return d.test(e)}function S(e){return _.test(e)}function C(e){return/^\s*$/.test(e)}function w(e){return`.?!`.indexOf(e)!=-1}function T(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var E={};function D(e,t,n,r,i){if(t===void 0&&!i)throw Error(`defaultValue is required unless callback is provided`);if(n||=`string`,E[e]={type:n,defaultValue:t,callback:i},r)for(var a=0;a<r.length;a++)E[r[a]]=E[e];t&&O(e,t)}function O(e,t,n,r){var i=E[e];r||={};var a=r.scope;if(!i)return Error(`Unknown option: `+e);if(i.type==`boolean`){if(t&&t!==!0)return Error(`Invalid argument: `+e+`=`+t);t!==!1&&(t=!0)}i.callback?(a!==`local`&&i.callback(t,void 0),a!==`global`&&n&&i.callback(t,n)):(a!==`local`&&(i.value=i.type==`boolean`?!!t:t),a!==`global`&&n&&(n.state.vim.options[e]={value:t}))}function k(e,t,n){var r=E[e];n||={};var i=n.scope;if(!r)return Error(`Unknown option: `+e);if(r.callback){let e=t&&r.callback(void 0,t);return i!==`global`&&e!==void 0?e:i===`local`?void 0:r.callback()}return(i!==`global`&&t&&t.state.vim.options[e]||i!==`local`&&r||{}).value}D(`filetype`,void 0,`string`,[`ft`],function(e,t){if(t!==void 0){if(e===void 0){let e=t.getOption(`mode`);return e==`null`?``:e}{let n=e==``?`null`:e;t.setOption(`mode`,n)}}}),D(`textwidth`,80,`number`,[`tw`],function(e,t){if(t!==void 0){if(e===void 0)return t.getOption(`textwidth`);var n=Math.round(e);n>1&&t.setOption(`textwidth`,n)}});var A=function(){var e=100,t=-1,n=0,r=0,i=Array(e);function a(a,o,s){var c=i[t%e];function l(n){var r=++t%e,o=i[r];o&&o.clear(),i[r]=a.setBookmark(n)}if(c){var u=c.find();u&&!Ae(u,o)&&l(o)}else l(o);l(s),n=t,r=t-e+1,r<0&&(r=0)}function o(a,o){t+=o,t>n?t=n:t<r&&(t=r);var s=i[(e+t)%e];if(s&&!s.find()){var c=o>0?1:-1,l,u=a.getCursor();do if(t+=c,s=i[(e+t)%e],s&&(l=s.find())&&!Ae(u,l))break;while(t<n&&t>r)}return s}function s(e,n){var r=t,i=o(e,n);return t=r,i&&i.find()}return{cachedCursor:void 0,add:a,find:s,move:o}},j=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class M{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=j()}exitMacroRecordMode(){var e=P.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1}enterMacroRecordMode(e,t){var n=P.registerController.getRegister(t);if(n){if(n.clear(),this.latestRegister=t,e.openDialog){var r=kt(`span`,{class:`cm-vim-message`},`recording @`+t);this.onRecordingDone=e.openDialog(r,function(){},{bottom:!0})}this.isRecording=!0}}}function N(e){return e.state.vim||(e.state.vim={inputState:new z,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new t(0,0),head:new t(0,0)},options:{},expectLiteralNext:!1,status:``}),e.state.vim}var P;function ee(){for(var e in P={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:A(),macroModeState:new M,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:``},registerController:new me({}),searchHistoryController:new he,exCommandHistoryController:new he},E){var t=E[e];t.value=t.defaultValue}}class te{constructor(e,t){this.keyName=e,this.key=t.key,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey}}var ne,re={enterVimMode:c,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return P.registerController},resetVimGlobalState_:ee,getVimGlobalState_:function(){return P},maybeInitVimState_:N,suppressErrorLogging:!1,InsertModeKey:te,map:function(e,t,n){Kt.map(e,t,n)},unmap:function(e,t){return Kt.unmap(e,t)},noremap:function(e,t,n){Kt.map(e,t,n,!0)},mapclear:function(e){var t=r.length,n=a,i=r.slice(0,t-n);if(r=r.slice(t-n),e)for(var o=i.length-1;o>=0;o--){var s=i[o];if(e!==s.context){if(s.context)this._mapCommand(s);else{var c=[`normal`,`insert`,`visual`];for(var l in c)if(c[l]!==e){var u=Object.assign({},s);u.context=c[l],this._mapCommand(u)}}}}},langmap:le,vimKeyFromEvent:ce,setOption:O,getOption:k,defineOption:D,defineEx:function(e,t,n){if(!t)t=e;else if(e.indexOf(t)!==0)throw Error(`(Vim.defineEx) "`+t+`" is not a prefix of "`+e+`", command not registered`);Gt[e]=n,Kt.commandMap_[t]={name:e,shortName:t,type:`api`}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if(typeof r==`function`)return r()},multiSelectHandleKey:dn,findKey:function(t,n,i){var a=N(t),o=t;function s(){var e=P.macroModeState;if(e.isRecording){if(n==`q`)return e.exitMacroRecordMode(),B(o),!0;i!=`mapping`&&en(e,n)}}function c(){if(n==`<Esc>`){if(a.visualMode)Je(o);else if(a.insertMode)Jt(o);else return;return B(o),!0}}function l(){if(c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``),t=n.length==1,i=V.matchCommand(e,r,a.inputState,`insert`),s=a.inputState.changeQueue;if(i.type==`none`)return B(o),!1;if(i.type==`partial`){if(i.expectLiteralNext&&(a.expectLiteralNext=!0),ne&&window.clearTimeout(ne),ne=t&&window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer.length&&B(o)},k(`insertModeEscKeysTimeout`)),t){var l=o.listSelections();(!s||s.removed.length!=l.length)&&(s=a.inputState.changeQueue=new de),s.inserted+=n;for(var u=0;u<l.length;u++){var d=Me(l[u].anchor,l[u].head),f=Ne(l[u].anchor,l[u].head),p=o.getRange(d,o.state.overwrite?we(f,0,1):f);s.removed[u]=(s.removed[u]||``)+p}}return!t}if(i.type==`full`&&(a.inputState.keyBuffer.length=0),a.expectLiteralNext=!1,ne&&window.clearTimeout(ne),i.command&&s){for(var l=o.listSelections(),u=0;u<l.length;u++){var m=l[u].head;o.replaceRange(s.removed[u]||``,we(m,0,-s.inserted.length),m,`+input`)}P.macroModeState.lastInsertModeChanges.changes.pop()}return i.command||B(o),i.command}function u(){if(s()||c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``);if(/^[1-9]\d*$/.test(e))return!0;var t=/^(\d*)(.*)$/.exec(e);if(!t)return B(o),!1;var i=a.visualMode?`visual`:`normal`,l=t[2]||t[1];a.inputState.operatorShortcut&&a.inputState.operatorShortcut.slice(-1)==l&&(l=a.inputState.operatorShortcut);var u=V.matchCommand(l,r,a.inputState,i);return u.type==`none`?(B(o),!1):u.type==`partial`?(u.expectLiteralNext&&(a.expectLiteralNext=!0),!0):u.type==`clear`?(B(o),!0):(a.expectLiteralNext=!1,a.inputState.keyBuffer.length=0,t=/^(\d*)(.*)$/.exec(e),t&&t[1]&&t[1]!=`0`&&a.inputState.pushRepeatDigit(t[1]),u.command)}var d=a.insertMode?l():u();if(d===!1)return!a.insertMode&&(n.length===1||e.isMac&&/<A-.>/.test(n))?function(){return!0}:void 0;if(d===!0)return function(){return!0};if(d)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof d!=`object`)return;d.type==`keyToKey`?L(o,d.toKeys,d):V.processCommand(o,a,d)}catch(e){throw o.state.vim=void 0,N(o),re.suppressErrorLogging||console.log(e),e}return!0})}},handleEx:function(e,t){Kt.processCommand(e,t)},defineMotion:_e,defineAction:Se,defineOperator:be,mapCommand:Qt,_mapCommand:Yt,defineRegister:pe,exitVisualMode:Je,exitInsertMode:Jt},F=[],ie=!1,I;function ae(e){if(!I)throw Error(`No prompt to send key to`);if(e[0]==`<`){var t=e.toLowerCase().slice(1,-1);if(t=t.split(`-`).pop()||``,t==`lt`)e=`<`;else if(t==`space`)e=` `;else if(t==`cr`)e=`
45
+ `)}var ah=()=>({cellIds:new Set}),{valueAtom:oh,useActions:sh}=jr(ah,{markForCut:(e,t)=>({cellIds:new Set(t.cellIds)}),clear:()=>ah()}),ch=o(e=>e(oh).cellIds),lh=o(null,(e,t)=>{t(oh,ah())});function uh(){return sh()}function dh(e){let t=(0,X.c)(3),n=s(ch),r;return t[0]!==e||t[1]!==n?(r=n.has(e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function fh(){return s(oh)}var ph=(e,t,n)=>Zn.define(r=>new hh(r,e,t,n)),mh=tr.define(),hh=class{sub;isInitDispatch=!1;view;doc;docPath;getTextFromDoc;constructor(e,t,n,r){this.view=e,this.doc=t,this.docPath=n,this.getTextFromDoc=r,this.sub=t.subscribe(this.onRemoteUpdate),Promise.resolve().then(()=>{this.isInitDispatch=!0;let t=this.view.state.doc.toString(),n=this.getTextFromDoc(this.doc);t!==n.toString()&&e.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:n.toString()}],annotations:[mh.of(this)]})})}onRemoteUpdate=e=>{if(e.by!==`local`){if(e.by===`checkout`){this.view.dispatch({changes:[{from:0,to:this.view.state.doc.length,insert:this.getTextFromDoc(this.doc).toString()}],annotations:[mh.of(this)]});return}if(e.by===`import`){let t=[],n=0;for(let{diff:r,path:i}of e.events){if(i.join(`/`)!==this.docPath.join(`/`)||r.type!==`text`)continue;let e=r.diff;for(let r of e)r.insert?t.push({from:n,to:n,insert:r.insert}):r.delete?(t.push({from:n,to:n+r.delete}),n+=r.delete):r.retain!=null&&(n+=r.retain);t.length>0&&this.view.dispatch({changes:t,annotations:[mh.of(this)]})}}}};update(e){if(this.isInitDispatch){this.isInitDispatch=!1;return}if(!e.docChanged||e.transactions.length>0&&(e.transactions[0].annotation(mh)===this||e.transactions[0].annotation(mh)===`undo`))return;let t=0;e.changes.iterChanges((e,n,r,i,a)=>{let o=a.sliceString(0,a.length,`
46
+ `);e!==n&&this.getTextFromDoc(this.doc).delete(e+t,n-e),o.length>0&&this.getTextFromDoc(this.doc).insert(e+t,o),t+=o.length-(n-e)}),this.doc.commit()}destroy(){this.sub?.(),this.sub=void 0}};function gh(e,t){if(typeof window>`u`)return;let n=`__marimo__${t}`;window[n]&&R.warn(`Overwriting existing debug object ${n}`),window[n]=e}var _h={markdown:!0,wasm_layouts:!1,rtc_v2:!1,cache_panel:!1,external_agents:!1,debugger:!1,line_timing:!1};function vh(e){return ie()?.experimental?.[e]??_h[e]}function yh(e,t){Hr().saveUserConfig({config:{experimental:{[e]:t}}})}gh(yh,`setFeatureFlag`);function bh(e,t){return{get:()=>t.get(e),sub:n=>t.sub(e,()=>n(t.get(e)))}}function xh(e,{offset:t,body:n=window,behavior:r=`smooth`}){let i=t?.top??0,a=t?.bottom??0,o=e.getBoundingClientRect();if(o.top<i){n.scrollBy({top:o.top-i,behavior:r});return}if(o.bottom>window.innerHeight-a){n.scrollBy({top:o.bottom-window.innerHeight+a,behavior:r});return}}function Sh(e){return e?e.state.field(CA).type:`python`}function Ch(e,t){return!e||Sh(e)===t?!1:e.state.doc.toString().trim()===``||Ew[t].isSupported(jA(e))}function wh(e,t,n={}){return!n.force&&!Ch(e,t)?!1:(kA(e,{language:t}),t)}function Th(e){return pn.of([{key:e.getHotkey(`cell.format`).key,preventDefault:!0,run:e=>(dm({[e.state.facet(Of)]:e}),!0)},{key:e.getHotkey(`cell.viewAsMarkdown`).key,preventDefault:!0,run:e=>{let t=wh(e,Sh(e)===`markdown`?`python`:`markdown`,{force:!0});return t===`markdown`&&e.state.facet(Df).afterToggleMarkdown(),t!==!1}},{key:e.getHotkey(`cell.viewAsSQL`).key,preventDefault:!0,run:e=>{let t=wh(e,Sh(e)===`sql`?`python`:`sql`,{force:!0});return t===`sql`&&e.state.facet(Df).afterToggleSQL(),t!==!1}}])}function Eh(){return Jn.updateListener.of(e=>{if(e.view.hasFocus&&e.heightChanged&&e.docChanged){if(e.transactions.some(e=>e.effects.some(e=>e.is(um))))return;Dh(e.view,{behavior:`smooth`})}})}function Dh(e,t){let n=e.dom.getElementsByClassName(`cm-activeLine cm-line`);if(n.length===1){let e=n[0],r=document.getElementById(`App`);B(r,`App not found`),xh(e,{offset:{top:30,bottom:150},body:r,behavior:t.behavior})}}function Oh(){return{}}var{reducer:kh,createActions:Ah,valueAtom:jh,useActions:Mh}=jr(Oh,{setVariables:(e,t)=>{let n={...e},r={};for(let e of t)r[e.name]={...n[e.name],...e};return r},addVariables:(e,t)=>{let n={...e};for(let e of t)n[e.name]={...n[e.name],...e};return n},setMetadata:(e,t)=>{let n={...e};for(let{name:e,value:r,dataType:i}of t)n[e]&&(n[e]={...n[e],value:r,dataType:i});return n}}),Nh=()=>s(jh);function Ph(){return Mh()}function Fh(e){let t=e.storage||is;return{getItem(n,r){try{let i=t.getItem(n);if(!i)return r;let a=JSON.parse(i);return e.fromSerializable(a)}catch(e){return R.warn(`Error getting ${n} from storage`,e),r}},setItem:(n,r)=>{t.setItem(n,JSON.stringify(e.toSerializable(r)))},removeItem:e=>{t.removeItem(e)}}}var Ih=xe(()=>is),Lh=[{type:`files`,Icon:jo,label:`Files`,tooltip:`View files and remote storage`,defaultSection:`sidebar`,additionalKeywords:[`explorer`,`browser`,`directory`]},{type:`variables`,Icon:Jo,label:`Variables`,tooltip:`Explore variables and data sources`,defaultSection:`sidebar`,additionalKeywords:[`state`,`scope`,`inspector`]},{type:`packages`,Icon:xo,label:`Packages`,tooltip:`Manage packages`,defaultSection:`sidebar`,additionalKeywords:[`dependencies`,`pip`,`install`]},{type:`ai`,Icon:bo,label:`AI`,tooltip:`Chat & Agents`,defaultSection:`sidebar`,additionalKeywords:[`chat`,`copilot`,`assistant`]},{type:`outline`,Icon:Bo,label:`Outline`,tooltip:`View outline`,defaultSection:`sidebar`,additionalKeywords:[`toc`,`structure`,`headings`]},{type:`documentation`,Icon:qo,label:`Docs`,tooltip:`View live docs`,defaultSection:`sidebar`,additionalKeywords:[`reference`,`api`]},{type:`dependencies`,Icon:Io,label:`Dependencies`,tooltip:`Explore dependencies`,defaultSection:`sidebar`,additionalKeywords:[`graph`,`imports`]},{type:`errors`,Icon:Eo,label:`Errors`,tooltip:`View errors`,defaultSection:`developer-panel`,additionalKeywords:[`exceptions`,`problems`,`diagnostics`]},{type:`scratchpad`,Icon:Lo,label:`Scratchpad`,tooltip:`Scratchpad`,defaultSection:`developer-panel`,additionalKeywords:[`scratch`,`draft`,`playground`]},{type:`tracing`,Icon:Dt,label:`Tracing`,tooltip:`View tracing`,defaultSection:`developer-panel`,additionalKeywords:[`profiling`,`performance`]},{type:`secrets`,Icon:No,label:`Secrets`,tooltip:`Manage secrets`,defaultSection:`developer-panel`,hidden:_e(),additionalKeywords:[`env`,`environment`,`keys`,`credentials`]},{type:`logs`,Icon:Ot,label:`Logs`,tooltip:`View logs`,defaultSection:`developer-panel`,additionalKeywords:[`console`,`stdout`]},{type:`terminal`,Icon:Go,label:`Terminal`,tooltip:`Terminal`,hidden:_e(),defaultSection:`developer-panel`,requiredCapability:`terminal`,additionalKeywords:[`shell`,`console`,`bash`,`command`]},{type:`snippets`,Icon:Uo,label:`Snippets`,tooltip:`Snippets`,defaultSection:`developer-panel`,additionalKeywords:[`templates`,`examples`]},{type:`cache`,Icon:Rt,label:`Cache`,tooltip:`View cache`,defaultSection:`developer-panel`,hidden:!vh(`cache_panel`),additionalKeywords:[`memory`,`memoize`]}],Rh=new Map(Lh.map(e=>[e.type,e]));function zh({panel:e,capabilities:t,aiEnabled:n}){return!!(e.hidden||e.type===`ai`&&!n||e.requiredCapability&&!t[e.requiredCapability])}var Bh={sidebar:Lh.filter(e=>!e.hidden&&e.defaultSection===`sidebar`).map(e=>e.type),developerPanel:Lh.filter(e=>!e.hidden&&e.defaultSection===`developer-panel`).map(e=>e.type)};function Vh(e){let t=new Set([...e.sidebar,...e.developerPanel]);return{sidebar:[...e.sidebar,...Bh.sidebar.filter(e=>!t.has(e))],developerPanel:[...e.developerPanel,...Bh.developerPanel.filter(e=>!t.has(e))]}}var Hh=Fh({toSerializable:e=>e,fromSerializable:e=>Vh(e)}),Uh=ve(`marimo:panel-layout`,Bh,Hh,{getOnInit:!0});function Wh(e){let t=u.get(Uh);return t.sidebar.includes(e)?`sidebar`:t.developerPanel.includes(e)?`developer-panel`:null}var Gh=`marimo:sidebar`,Kh=new os(_({selectedPanel:h().optional().transform(e=>e),isSidebarOpen:m(),isDeveloperPanelOpen:m().optional().default(!1),selectedDeveloperPanelTab:h().optional().default(`errors`).transform(e=>e)}),qh);function qh(){return{selectedPanel:`variables`,isSidebarOpen:!1,isDeveloperPanelOpen:!1,selectedDeveloperPanelTab:`errors`}}var{reducer:Jh,createActions:Yh,valueAtom:Xh,useActions:Zh}=jr(()=>Kh.get(Gh),{openApplication:(e,t)=>{let n=Wh(t);return n===`sidebar`?{...e,selectedPanel:t,isSidebarOpen:!0}:n===`developer-panel`?{...e,selectedDeveloperPanelTab:t,isDeveloperPanelOpen:!0}:e},toggleApplication:(e,t)=>{let n=Wh(t);return n===`sidebar`?{...e,selectedPanel:t,isSidebarOpen:!e.isSidebarOpen||e.selectedPanel!==t}:n===`developer-panel`?{...e,selectedDeveloperPanelTab:t,isDeveloperPanelOpen:!e.isDeveloperPanelOpen||e.selectedDeveloperPanelTab!==t}:e},toggleSidebarPanel:e=>({...e,isSidebarOpen:!e.isSidebarOpen}),setIsSidebarOpen:(e,t)=>({...e,isSidebarOpen:t}),toggleDeveloperPanel:e=>({...e,isDeveloperPanelOpen:!e.isDeveloperPanelOpen}),setIsDeveloperPanelOpen:(e,t)=>({...e,isDeveloperPanelOpen:t})},[(e,t)=>Kh.set(Gh,t)]),Qh=()=>{let e=(0,X.c)(2),t=s(Xh);if(t.isSidebarOpen)return t;let n;return e[0]===t?n=e[1]:(n={...t,selectedPanel:void 0},e[0]=t,e[1]=n),n};function $h(){return Zh()}function eg(e){u.set(Xh,t=>Jh(t,{type:`openApplication`,payload:e}))}var tg=o({terminal:!1,pylsp:!1,basedpyright:!1,ty:!1,pyrefly:!1});function ng(e){return u.get(tg)?.[e]??!1}var rg=o({documentation:null}),Q={VariableName:`VariableName`,FunctionDefinition:`FunctionDefinition`,ClassDefinition:`ClassDefinition`,LambdaExpression:`LambdaExpression`,ParamList:`ParamList`,Decorator:`Decorator`,AssignStatement:`AssignStatement`,ForStatement:`ForStatement`,ImportStatement:`ImportStatement`,TryStatement:`TryStatement`,WithStatement:`WithStatement`,TupleExpression:`TupleExpression`,ArrayExpression:`ArrayExpression`,ParenthesizedExpression:`ParenthesizedExpression`,CallExpression:`CallExpression`,ArgList:`ArgList`,AssignOp:`AssignOp`,ArrayComprehensionExpression:`ArrayComprehensionExpression`,SetComprehensionExpression:`SetComprehensionExpression`,DictionaryComprehensionExpression:`DictionaryComprehensionExpression`,ComprehensionExpression:`ComprehensionExpression`,Comment:`Comment`,String:`String`,FormatString:`FormatString`},ig={For:`for`,In:`in`,As:`as`,Import:`import`},ag=new Set([Q.FunctionDefinition,Q.LambdaExpression,Q.ArrayComprehensionExpression,Q.SetComprehensionExpression,Q.DictionaryComprehensionExpression,Q.ComprehensionExpression,Q.ClassDefinition]),og=new Set([Q.Comment,Q.String,Q.FormatString]);function sg(e){let t=gn(e.state);if(!t||dg(t))return[];let n=new Set(Object.keys(e.variables).filter(t=>{let n=e.variables[t];return n.dataType!==`module`&&!n.declaredBy.includes(`setup`)&&!n.declaredBy.includes(e.cellId)}));if(n.size===0)return[];let r=[],i=new Map,a=new Map,o=new Map;function s(t,n){let r=t.cursor(),c=r.name,l=r.from,u=ag.has(c),d=n;switch(u&&(d=[...n,l],i.set(l,new Set),a.set(l,c)),c){case Q.FunctionDefinition:{let r=t.cursor();r.firstChild();do if(r.name===Q.VariableName){let t=e.state.doc.sliceString(r.from,r.to),a=n[n.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t);break}while(r.nextSibling());let a=t.cursor();a.firstChild();do if(a.name===Q.ParamList){let t=a.node.cursor();t.firstChild();do if(t.name===Q.VariableName){let n=e.state.doc.sliceString(t.from,t.to);i.get(l)?.add(n)}while(t.nextSibling())}while(a.nextSibling());break}case Q.LambdaExpression:{let n=t.cursor();n.firstChild();do if(n.name===Q.ParamList){let t=n.node.cursor();t.firstChild();do if(t.name===Q.VariableName){let n=e.state.doc.sliceString(t.from,t.to);i.get(l)?.add(n)}while(t.nextSibling())}while(n.nextSibling());break}case Q.ArrayComprehensionExpression:case Q.DictionaryComprehensionExpression:case Q.SetComprehensionExpression:case Q.ComprehensionExpression:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===ig.For)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to);i.get(l)?.add(t)}else if(r&&n.name===Q.TupleExpression){let t=n.node.cursor();t.firstChild();do if(t.name===Q.VariableName){let n=e.state.doc.sliceString(t.from,t.to);i.get(l)?.add(n)}while(t.nextSibling())}else r&&n.name===ig.In&&(r=!1);while(n.nextSibling());break}case Q.ClassDefinition:{let r=t.cursor();r.firstChild();do if(r.name===Q.VariableName){let t=e.state.doc.sliceString(r.from,r.to),a=n[n.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t);break}while(r.nextSibling());o.set(l,[]);break}case Q.AssignStatement:{let n=t.cursor(),s=[];n.firstChild();do n.name===Q.AssignOp&&s.push(n.from);while(n.nextSibling());let c=s[s.length-1],l=t.cursor();l.firstChild();let u=d[d.length-1]??-1;do l.from<c&&fg(l,{currentScope:u,state:e.state,allDeclarations:i,scopeTypes:a,classLevelDeclarations:o,assignmentPosition:r.to});while(l.nextSibling());break}case Q.ForStatement:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===ig.For)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to),r=d[d.length-1]??-1;i.has(r)||i.set(r,new Set),i.get(r)?.add(t)}else r&&n.name===ig.In&&(r=!1);while(n.nextSibling());break}case Q.ImportStatement:{let n=t.cursor();n.firstChild();let r=d[d.length-1]??-1;i.has(r)||i.set(r,new Set);let a=i.get(r),o=!1,s=null,c=()=>{s!==null&&a?.add(s),s=null};do{if(n.name===ig.Import){o=!0;continue}if(o){if(n.name===ig.As){s=null;continue}n.name===Q.VariableName?(c(),s=e.state.doc.sliceString(n.from,n.to)):n.name===`,`&&c()}}while(n.nextSibling());c();break}case Q.TryStatement:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===ig.As)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to),a=d[d.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t),r=!1}while(n.nextSibling());break}case Q.WithStatement:{let n=t.cursor();n.firstChild();let r=!1;do if(n.name===ig.As)r=!0;else if(r&&n.name===Q.VariableName){let t=e.state.doc.sliceString(n.from,n.to),a=d[d.length-1]??-1;i.has(a)||i.set(a,new Set),i.get(a)?.add(t),r=!1}while(n.nextSibling());break}}f(r,e=>{s(e,d)})}function c(e,t,n){let r=o.get(t);return r?r.some(([t,r])=>t===e&&r<n):!1}function l(e,t,n){for(let r of t)if(a.get(r)===Q.ClassDefinition){if(c(e,r,n))return!0}else if(i.get(r)?.has(e))return!0;return i.get(-1)?.has(e)??!1}function u(t,n){let i=t.cursor(),a=i.name,o=i.from;if(a===Q.ImportStatement)return;let s=ag.has(a),c=n;if(s&&(c=[...n,o]),a===Q.VariableName){let t=e.state.doc.sliceString(i.from,i.to);d(t,i)&&(l(t,c,i.from)||r.push({from:i.from,to:i.to,variableName:t}))}f(i,e=>{u(e,c)})}function d(e,t){return n.has(e)&&!ug(t)&&!cg(t)&&!lg(t)}function f(e,t){if(e.firstChild())do t(e.node);while(e.nextSibling())}return s(t,[]),u(t,[]),r}function cg(e){let t=e.node.cursor();if(t.moveTo(e.from),t.parent()&&t.name===Q.CallExpression&&t.firstChild())do if(t.name===Q.ArgList&&t.firstChild()){do if(t.from===e.from&&t.to===e.to)return t.nextSibling()&&t.name===Q.AssignOp;while(t.nextSibling());break}while(t.nextSibling());return!1}function lg(e){let t=e.node.cursor();if(t.parent()&&t.name===Q.AssignStatement){let n=t.node.cursor();n.firstChild();let r=-1;do if(n.name===Q.AssignOp){r=n.from;break}while(n.nextSibling());return r!==-1&&e.from<r}return!1}function ug(e){let t=e.node.cursor();return!!(t.prevSibling()&&t.name===`.`)}function dg(e){let t=e.cursor();do if(t.name===`⚠`||t.type.isError)return!0;while(t.next());return!1}function fg(e,t){switch(e.name){case Q.VariableName:{let n=t.state.doc.sliceString(e.from,e.to);if(t.currentScope!==-1&&t.scopeTypes.get(t.currentScope)===Q.ClassDefinition){let e=t.classLevelDeclarations.get(t.currentScope);e&&e.push([n,t.assignmentPosition])}else t.allDeclarations.has(t.currentScope)||t.allDeclarations.set(t.currentScope,new Set),t.allDeclarations.get(t.currentScope)?.add(n);break}case Q.TupleExpression:{let n=e.node.cursor();n.firstChild();do fg(n,t);while(n.nextSibling());break}case Q.ArrayExpression:{let n=e.node.cursor();n.firstChild();do fg(n,t);while(n.nextSibling());break}}}var pg=Fn.mark({class:`mo-cm-reactive-reference`}),mg=Fn.mark({class:`mo-cm-reactive-reference-hover`}),hg=Cn.define(),gg=class{view;cellId;variablesUnsubscribe;highlightDebounceMs=300;scheduleHighlighting;constructor(e,t){this.view=e,this.cellId=t,this.scheduleHighlighting=ne(()=>{this.runHighlighting()},this.highlightDebounceMs),this.variablesUnsubscribe=u.sub(jh,()=>{this.scheduleHighlighting()}),this.scheduleHighlighting()}update(e){(e.docChanged||e.focusChanged)&&this.scheduleHighlighting()}destroy(){this.scheduleHighlighting.cancel(),this.variablesUnsubscribe()}runHighlighting(){let e=sg({state:this.view.state,cellId:this.cellId,variables:u.get(jh)});e.length>0&&R.debug(`Found ${e.length} reactive variables in cell ${this.cellId}`),queueMicrotask(()=>{this.view.dispatch({effects:hg.of(e)})})}},_g=cn.define({create(){return{decorations:Fn.none,ranges:[]}},update(e,t){let n={decorations:e.decorations.map(t.changes),ranges:e.ranges};for(let e of t.effects)e.is(hg)&&(n={decorations:Fn.set(e.value.map(e=>pg.range(e.from,e.to))),ranges:e.value});return n},provide:e=>Jn.decorations.from(e,e=>e.decorations)});function vg(e){return[_g,Zn.define(t=>new gg(t,e))]}function yg(e,t){return t?vg(e):[]}function bg(e,t=!1){if(!e)return null;let n=document.createElement(`span`);if(n.classList.add(`mo-cm-tooltip`),n.classList.add(`docs-documentation`),t&&n.classList.add(`cm-tooltip-section`),n.style.display=`flex`,n.style.flexDirection=`column`,n.style.gap=`.8rem`,n.innerHTML=e,t){let e=document.createElement(`div`);e.classList.add(`text-xs`,`text-muted-foreground`,`font-medium`,`pt-1`,`-mt-2`,`border-t`,`border-border`);let t=document.createElement(`kbd`);t.className=`ml-1 rounded-md bg-muted/40 px-2 text-[0.75rem] font-prose center border border-foreground/20 text-muted-foreground inline whitespace-nowrap`,t.textContent=se()?`⌘`:`Ctrl`,e.append(document.createTextNode(`Jump to defining cell `)),e.append(t),e.append(document.createTextNode(` + Click`)),n.append(e)}return n}var xg=new Qt(`autocomplete-result`,async(e,t)=>{let{sendCodeCompletionRequest:n}=Hr();await n({id:e,...t})}),Sg={param:3,property:2},Cg={asCompletionResult(e,t){return{from:e-t.prefix_length,options:t.options.map(e=>({label:e.name,type:e.type,boost:Sg[e.type]??1,info:()=>bg(e.completion_info)})),validFor:/^\w*$/}},asHoverTooltip({position:e,message:t,limitToType:n,excludeTypes:r,exactName:i,showGoToDefinitionHint:a=!1}){let o=wg(t.options,i);if(!o)return;let s=e-t.prefix_length,c=bg(o.completion_info,a);if(c&&!(n&&o.type!==n)&&!r?.includes(o.type))return{pos:s,html:o.completion_info,end:s+o.name.length,above:!0,create:()=>({dom:c,resize:!1})}}};function wg(e,t){if(e.length!==0){if(e.length===1)return e[0];if(t)return e.find(e=>e.name===t)}}function Tg(e){return[e?.pylsp?.enabled&&ng(`pylsp`)||e?.ty?.enabled&&ng(`ty`)||e?.pyrefly?.enabled&&ng(`pyrefly`)||e?.basedpyright?.enabled&&ng(`basedpyright`)?[]:En(async(e,t)=>{let n=await Eg({view:e,pos:t,excludeTypes:[`tooltip`]});return n===null||n===`cancelled`?null:n},{hideOnChange:!0}),Ag]}async function Eg({view:e,pos:t,excludeTypes:n}){let r=Li.findElement(e.dom);if(!r)return R.error(`Failed to find active cell.`),null;let i=Li.parse(r.id),{startToken:a,endToken:o}=Dg(e.state.doc,t),s=e.state.field(_g,!1)?.ranges.some(e=>t>=e.from&&t<=e.to)??!1,c=await xg.request({document:e.state.doc.slice(0,o).toString(),cellId:i});if(!c)return`cancelled`;let l=e.state.doc.slice(a,o).toString();return Cg.asHoverTooltip({position:o,message:c,exactName:l,excludeTypes:n,showGoToDefinitionHint:s})??null}function Dg(e,t){let n=t,r=n>0?e.sliceString(n-1,n):``,i=n<e.length?e.sliceString(n,n+1):``;r===`(`&&i===`)`&&--n;let a=n,o=n;for(;a>0;){let t=e.sliceString(a-1,a);if(!/\w/.test(t))break;a--}for(;o<e.length;){let t=e.sliceString(o,o+1);if(!/\w/.test(t))break;o++}return{startToken:a,endToken:o}}function Og(e){let{head:t}=e.selection.main,n=e.doc.sliceString(t-1,t);return/\w/.test(n)}var kg=ne(async(e,t)=>{if(u.get(Xh).selectedPanel!==`documentation`)return;let n=await Eg({view:e,pos:t});n!==`cancelled`&&u.set(rg,{documentation:n?.html??null})},300),Ag=Jn.updateListener.of(e=>{if(e.selectionSet&&Og(e.state)){let t=e.state.selection.main.head;kg(e.view,t)}});function jg(e){var t=e.Pos;function n(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line).charCodeAt(t.ch);55296<=r&&r<=55551&&(n.ch+=1)}return{start:t,end:n}}var r=[{keys:`<Left>`,type:`keyToKey`,toKeys:`h`},{keys:`<Right>`,type:`keyToKey`,toKeys:`l`},{keys:`<Up>`,type:`keyToKey`,toKeys:`k`},{keys:`<Down>`,type:`keyToKey`,toKeys:`j`},{keys:`g<Up>`,type:`keyToKey`,toKeys:`gk`},{keys:`g<Down>`,type:`keyToKey`,toKeys:`gj`},{keys:`<Space>`,type:`keyToKey`,toKeys:`l`},{keys:`<BS>`,type:`keyToKey`,toKeys:`h`},{keys:`<Del>`,type:`keyToKey`,toKeys:`x`},{keys:`<C-Space>`,type:`keyToKey`,toKeys:`W`},{keys:`<C-BS>`,type:`keyToKey`,toKeys:`B`},{keys:`<S-Space>`,type:`keyToKey`,toKeys:`w`},{keys:`<S-BS>`,type:`keyToKey`,toKeys:`b`},{keys:`<C-n>`,type:`keyToKey`,toKeys:`j`},{keys:`<C-p>`,type:`keyToKey`,toKeys:`k`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`s`,type:`keyToKey`,toKeys:`cl`,context:`normal`},{keys:`s`,type:`keyToKey`,toKeys:`c`,context:`visual`},{keys:`S`,type:`keyToKey`,toKeys:`cc`,context:`normal`},{keys:`S`,type:`keyToKey`,toKeys:`VdO`,context:`visual`},{keys:`<Home>`,type:`keyToKey`,toKeys:`0`},{keys:`<End>`,type:`keyToKey`,toKeys:`$`},{keys:`<PageUp>`,type:`keyToKey`,toKeys:`<C-b>`},{keys:`<PageDown>`,type:`keyToKey`,toKeys:`<C-f>`},{keys:`<CR>`,type:`keyToKey`,toKeys:`j^`,context:`normal`},{keys:`<Ins>`,type:`keyToKey`,toKeys:`i`,context:`normal`},{keys:`<Ins>`,type:`action`,action:`toggleOverwrite`,context:`insert`},{keys:`H`,type:`motion`,motion:`moveToTopLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`M`,type:`motion`,motion:`moveToMiddleLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`L`,type:`motion`,motion:`moveToBottomLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`h`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!1}},{keys:`l`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!0}},{keys:`j`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,linewise:!0}},{keys:`k`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,linewise:!0}},{keys:`gj`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!0}},{keys:`gk`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!1}},{keys:`w`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1}},{keys:`W`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:`e`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:`E`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`b`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1}},{keys:`B`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:`ge`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:`gE`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`{`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`}`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`(`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!1}},{keys:`)`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!0}},{keys:`<C-f>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!0}},{keys:`<C-b>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!1}},{keys:`<C-d>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!0,explicitRepeat:!0}},{keys:`<C-u>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!1,explicitRepeat:!0}},{keys:`gg`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`G`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`g$`,type:`motion`,motion:`moveToEndOfDisplayLine`},{keys:`g^`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`g0`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`0`,type:`motion`,motion:`moveToStartOfLine`},{keys:`^`,type:`motion`,motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`+`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0}},{keys:`-`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,toFirstChar:!0}},{keys:`_`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:`$`,type:`motion`,motion:`moveToEol`,motionArgs:{inclusive:!0}},{keys:`%`,type:`motion`,motion:`moveToMatchedSymbol`,motionArgs:{inclusive:!0,toJumplist:!0}},{keys:`f<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`F<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!1}},{keys:`t<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`T<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!1}},{keys:`;`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!0}},{keys:`,`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!1}},{keys:`'<register>`,type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0}},{keys:"]`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0}},{keys:"[`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1}},{keys:`]'`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0,linewise:!0}},{keys:`['`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1,linewise:!0}},{keys:`]p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:`[p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:`]<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`[<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`|`,type:`motion`,motion:`moveToColumn`},{keys:`o`,type:`motion`,motion:`moveToOtherHighlightedEnd`,context:`visual`},{keys:`O`,type:`motion`,motion:`moveToOtherHighlightedEnd`,motionArgs:{sameLine:!0},context:`visual`},{keys:`d`,type:`operator`,operator:`delete`},{keys:`y`,type:`operator`,operator:`yank`},{keys:`c`,type:`operator`,operator:`change`},{keys:`=`,type:`operator`,operator:`indentAuto`},{keys:`>`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!0}},{keys:`<`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!1}},{keys:`g~`,type:`operator`,operator:`changeCase`},{keys:`gu`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},isEdit:!0},{keys:`gU`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},isEdit:!0},{keys:`gc`,type:`operator`,operator:`toggleComment`,isEdit:!0},{keys:`n`,type:`motion`,motion:`findNext`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`N`,type:`motion`,motion:`findNext`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`gn`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!0}},{keys:`gN`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!1}},{keys:`gq`,type:`operator`,operator:`hardWrap`},{keys:`gw`,type:`operator`,operator:`hardWrap`,operatorArgs:{keepCursor:!0}},{keys:`g?`,type:`operator`,operator:`rot13`},{keys:`x`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:`X`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:`D`,type:`operatorMotion`,operator:`delete`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`D`,type:`operator`,operator:`delete`,operatorArgs:{linewise:!0},context:`visual`},{keys:`Y`,type:`operatorMotion`,operator:`yank`,motion:`expandToLine`,motionArgs:{linewise:!0},context:`normal`},{keys:`Y`,type:`operator`,operator:`yank`,operatorArgs:{linewise:!0},context:`visual`},{keys:`C`,type:`operatorMotion`,operator:`change`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`C`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0},context:`visual`},{keys:`~`,type:`operatorMotion`,operator:`changeCase`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:`normal`},{keys:`~`,type:`operator`,operator:`changeCase`,context:`visual`},{keys:`<C-u>`,type:`operatorMotion`,operator:`delete`,motion:`moveToStartOfLine`,context:`insert`},{keys:`<C-w>`,type:`operatorMotion`,operator:`delete`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1},context:`insert`},{keys:`<C-w>`,type:`idle`,context:`normal`},{keys:`<C-i>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!0}},{keys:`<C-o>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!1}},{keys:`<C-e>`,type:`action`,action:`scroll`,actionArgs:{forward:!0,linewise:!0}},{keys:`<C-y>`,type:`action`,action:`scroll`,actionArgs:{forward:!1,linewise:!0}},{keys:`a`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`charAfter`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`eol`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`endOfSelectedArea`},context:`visual`},{keys:`i`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`inplace`},context:`normal`},{keys:`gi`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`lastEdit`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`firstNonBlank`},context:`normal`},{keys:`gI`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`bol`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`startOfSelectedArea`},context:`visual`},{keys:`o`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:`normal`},{keys:`O`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:`normal`},{keys:`v`,type:`action`,action:`toggleVisualMode`},{keys:`V`,type:`action`,action:`toggleVisualMode`,actionArgs:{linewise:!0}},{keys:`<C-v>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`<C-q>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`gv`,type:`action`,action:`reselectLastSelection`},{keys:`J`,type:`action`,action:`joinLines`,isEdit:!0},{keys:`gJ`,type:`action`,action:`joinLines`,actionArgs:{keepSpaces:!0},isEdit:!0},{keys:`p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:`P`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:`r<character>`,type:`action`,action:`replace`,isEdit:!0},{keys:`@<register>`,type:`action`,action:`replayMacro`},{keys:`q<register>`,type:`action`,action:`enterMacroRecordMode`},{keys:`R`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{replace:!0},context:`normal`},{keys:`R`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0,fullLine:!0},context:`visual`,exitVisualBlock:!0},{keys:`u`,type:`action`,action:`undo`,context:`normal`},{keys:`u`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},context:`visual`,isEdit:!0},{keys:`U`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},context:`visual`,isEdit:!0},{keys:`<C-r>`,type:`action`,action:`redo`},{keys:`m<register>`,type:`action`,action:`setMark`},{keys:`"<register>`,type:`action`,action:`setRegister`},{keys:`<C-r><register>`,type:`action`,action:`insertRegister`,context:`insert`,isEdit:!0},{keys:`<C-o>`,type:`action`,action:`oneNormalCommand`,context:`insert`},{keys:`zz`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`}},{keys:`z.`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zt`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`}},{keys:`z<CR>`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zb`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`}},{keys:`z-`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`.`,type:`action`,action:`repeatLastEdit`},{keys:`<C-a>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:`<C-x>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:`<C-t>`,type:`action`,action:`indent`,actionArgs:{indentRight:!0},context:`insert`},{keys:`<C-d>`,type:`action`,action:`indent`,actionArgs:{indentRight:!1},context:`insert`},{keys:`a<register>`,type:`motion`,motion:`textObjectManipulation`},{keys:`i<register>`,type:`motion`,motion:`textObjectManipulation`,motionArgs:{textObjectInner:!0}},{keys:`/`,type:`search`,searchArgs:{forward:!0,querySrc:`prompt`,toJumplist:!0}},{keys:`?`,type:`search`,searchArgs:{forward:!1,querySrc:`prompt`,toJumplist:!0}},{keys:`*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`g*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`g#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`:`,type:`ex`}],i=Object.create(null),a=r.length,o=[{name:`colorscheme`,shortName:`colo`},{name:`map`},{name:`imap`,shortName:`im`},{name:`nmap`,shortName:`nm`},{name:`vmap`,shortName:`vm`},{name:`omap`,shortName:`om`},{name:`noremap`,shortName:`no`},{name:`nnoremap`,shortName:`nn`},{name:`vnoremap`,shortName:`vn`},{name:`inoremap`,shortName:`ino`},{name:`onoremap`,shortName:`ono`},{name:`unmap`},{name:`mapclear`,shortName:`mapc`},{name:`nmapclear`,shortName:`nmapc`},{name:`vmapclear`,shortName:`vmapc`},{name:`imapclear`,shortName:`imapc`},{name:`omapclear`,shortName:`omapc`},{name:`write`,shortName:`w`},{name:`undo`,shortName:`u`},{name:`redo`,shortName:`red`},{name:`set`,shortName:`se`},{name:`setlocal`,shortName:`setl`},{name:`setglobal`,shortName:`setg`},{name:`sort`,shortName:`sor`},{name:`substitute`,shortName:`s`,possiblyAsync:!0},{name:`startinsert`,shortName:`start`},{name:`nohlsearch`,shortName:`noh`},{name:`yank`,shortName:`y`},{name:`put`,shortName:`pu`},{name:`delmarks`,shortName:`delm`},{name:`marks`,excludeFromCommandHistory:!0},{name:`registers`,shortName:`reg`,excludeFromCommandHistory:!0},{name:`vglobal`,shortName:`v`},{name:`delete`,shortName:`d`},{name:`join`,shortName:`j`},{name:`normal`,shortName:`norm`},{name:`global`,shortName:`g`}],s=ue(``);function c(t){t.setOption(`disableInput`,!0),t.setOption(`showCursorWhenSelecting`,!1),e.signal(t,`vim-mode-change`,{mode:`normal`}),t.on(`cursorActivity`,an),N(t),e.on(t.getInputField(),`paste`,u(t))}function l(t){t.setOption(`disableInput`,!1),t.off(`cursorActivity`,an),e.off(t.getInputField(),`paste`,u(t)),t.state.vim=null,Ft&&clearTimeout(Ft)}function u(e){var t=e.state.vim;return t.onPasteFn||=function(){t.insertMode||(e.setCursor(we(e.getCursor(),0,1)),xe.enterInsertMode(e,{},t))},t.onPasteFn}var d=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],p=[function(e){return/\S/.test(e)}],m=[`<`,`>`],h=[`-`,`"`,`.`,`:`,`_`,`/`,`+`],g=/^\w$/,_=/^[A-Z]$/;try{_=RegExp(`^[\\p{Lu}]$`,`u`)}catch{}function v(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function y(e){return/^[a-z]$/.test(e)}function b(e){return`()[]{}`.indexOf(e)!=-1}function x(e){return d.test(e)}function S(e){return _.test(e)}function C(e){return/^\s*$/.test(e)}function w(e){return`.?!`.indexOf(e)!=-1}function T(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var E={};function D(e,t,n,r,i){if(t===void 0&&!i)throw Error(`defaultValue is required unless callback is provided`);if(n||=`string`,E[e]={type:n,defaultValue:t,callback:i},r)for(var a=0;a<r.length;a++)E[r[a]]=E[e];t&&O(e,t)}function O(e,t,n,r){var i=E[e];r||={};var a=r.scope;if(!i)return Error(`Unknown option: `+e);if(i.type==`boolean`){if(t&&t!==!0)return Error(`Invalid argument: `+e+`=`+t);t!==!1&&(t=!0)}i.callback?(a!==`local`&&i.callback(t,void 0),a!==`global`&&n&&i.callback(t,n)):(a!==`local`&&(i.value=i.type==`boolean`?!!t:t),a!==`global`&&n&&(n.state.vim.options[e]={value:t}))}function k(e,t,n){var r=E[e];n||={};var i=n.scope;if(!r)return Error(`Unknown option: `+e);if(r.callback){let e=t&&r.callback(void 0,t);return i!==`global`&&e!==void 0?e:i===`local`?void 0:r.callback()}return(i!==`global`&&t&&t.state.vim.options[e]||i!==`local`&&r||{}).value}D(`filetype`,void 0,`string`,[`ft`],function(e,t){if(t!==void 0){if(e===void 0){let e=t.getOption(`mode`);return e==`null`?``:e}{let n=e==``?`null`:e;t.setOption(`mode`,n)}}}),D(`textwidth`,80,`number`,[`tw`],function(e,t){if(t!==void 0){if(e===void 0)return t.getOption(`textwidth`);var n=Math.round(e);n>1&&t.setOption(`textwidth`,n)}});var A=function(){var e=100,t=-1,n=0,r=0,i=Array(e);function a(a,o,s){var c=i[t%e];function l(n){var r=++t%e,o=i[r];o&&o.clear(),i[r]=a.setBookmark(n)}if(c){var u=c.find();u&&!Ae(u,o)&&l(o)}else l(o);l(s),n=t,r=t-e+1,r<0&&(r=0)}function o(a,o){t+=o,t>n?t=n:t<r&&(t=r);var s=i[(e+t)%e];if(s&&!s.find()){var c=o>0?1:-1,l,u=a.getCursor();do if(t+=c,s=i[(e+t)%e],s&&(l=s.find())&&!Ae(u,l))break;while(t<n&&t>r)}return s}function s(e,n){var r=t,i=o(e,n);return t=r,i&&i.find()}return{cachedCursor:void 0,add:a,find:s,move:o}},j=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class M{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=j()}exitMacroRecordMode(){var e=P.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1}enterMacroRecordMode(e,t){var n=P.registerController.getRegister(t);if(n){if(n.clear(),this.latestRegister=t,e.openDialog){var r=kt(`span`,{class:`cm-vim-message`},`recording @`+t);this.onRecordingDone=e.openDialog(r,function(){},{bottom:!0})}this.isRecording=!0}}}function N(e){return e.state.vim||(e.state.vim={inputState:new z,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new t(0,0),head:new t(0,0)},options:{},expectLiteralNext:!1,status:``}),e.state.vim}var P;function ee(){for(var e in P={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:A(),macroModeState:new M,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:``},registerController:new me({}),searchHistoryController:new he,exCommandHistoryController:new he},E){var t=E[e];t.value=t.defaultValue}}class te{constructor(e,t){this.keyName=e,this.key=t.key,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey}}var ne,re={enterVimMode:c,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return P.registerController},resetVimGlobalState_:ee,getVimGlobalState_:function(){return P},maybeInitVimState_:N,suppressErrorLogging:!1,InsertModeKey:te,map:function(e,t,n){Kt.map(e,t,n)},unmap:function(e,t){return Kt.unmap(e,t)},noremap:function(e,t,n){Kt.map(e,t,n,!0)},mapclear:function(e){var t=r.length,n=a,i=r.slice(0,t-n);if(r=r.slice(t-n),e)for(var o=i.length-1;o>=0;o--){var s=i[o];if(e!==s.context){if(s.context)this._mapCommand(s);else{var c=[`normal`,`insert`,`visual`];for(var l in c)if(c[l]!==e){var u=Object.assign({},s);u.context=c[l],this._mapCommand(u)}}}}},langmap:le,vimKeyFromEvent:ce,setOption:O,getOption:k,defineOption:D,defineEx:function(e,t,n){if(!t)t=e;else if(e.indexOf(t)!==0)throw Error(`(Vim.defineEx) "`+t+`" is not a prefix of "`+e+`", command not registered`);Gt[e]=n,Kt.commandMap_[t]={name:e,shortName:t,type:`api`}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if(typeof r==`function`)return r()},multiSelectHandleKey:dn,findKey:function(t,n,i){var a=N(t),o=t;function s(){var e=P.macroModeState;if(e.isRecording){if(n==`q`)return e.exitMacroRecordMode(),B(o),!0;i!=`mapping`&&en(e,n)}}function c(){if(n==`<Esc>`){if(a.visualMode)Je(o);else if(a.insertMode)Jt(o);else return;return B(o),!0}}function l(){if(c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``),t=n.length==1,i=V.matchCommand(e,r,a.inputState,`insert`),s=a.inputState.changeQueue;if(i.type==`none`)return B(o),!1;if(i.type==`partial`){if(i.expectLiteralNext&&(a.expectLiteralNext=!0),ne&&window.clearTimeout(ne),ne=t&&window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer.length&&B(o)},k(`insertModeEscKeysTimeout`)),t){var l=o.listSelections();(!s||s.removed.length!=l.length)&&(s=a.inputState.changeQueue=new de),s.inserted+=n;for(var u=0;u<l.length;u++){var d=Me(l[u].anchor,l[u].head),f=Ne(l[u].anchor,l[u].head),p=o.getRange(d,o.state.overwrite?we(f,0,1):f);s.removed[u]=(s.removed[u]||``)+p}}return!t}if(i.type==`full`&&(a.inputState.keyBuffer.length=0),a.expectLiteralNext=!1,ne&&window.clearTimeout(ne),i.command&&s){for(var l=o.listSelections(),u=0;u<l.length;u++){var m=l[u].head;o.replaceRange(s.removed[u]||``,we(m,0,-s.inserted.length),m,`+input`)}P.macroModeState.lastInsertModeChanges.changes.pop()}return i.command||B(o),i.command}function u(){if(s()||c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``);if(/^[1-9]\d*$/.test(e))return!0;var t=/^(\d*)(.*)$/.exec(e);if(!t)return B(o),!1;var i=a.visualMode?`visual`:`normal`,l=t[2]||t[1];a.inputState.operatorShortcut&&a.inputState.operatorShortcut.slice(-1)==l&&(l=a.inputState.operatorShortcut);var u=V.matchCommand(l,r,a.inputState,i);return u.type==`none`?(B(o),!1):u.type==`partial`?(u.expectLiteralNext&&(a.expectLiteralNext=!0),!0):u.type==`clear`?(B(o),!0):(a.expectLiteralNext=!1,a.inputState.keyBuffer.length=0,t=/^(\d*)(.*)$/.exec(e),t&&t[1]&&t[1]!=`0`&&a.inputState.pushRepeatDigit(t[1]),u.command)}var d=a.insertMode?l():u();if(d===!1)return!a.insertMode&&(n.length===1||e.isMac&&/<A-.>/.test(n))?function(){return!0}:void 0;if(d===!0)return function(){return!0};if(d)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof d!=`object`)return;d.type==`keyToKey`?L(o,d.toKeys,d):V.processCommand(o,a,d)}catch(e){throw o.state.vim=void 0,N(o),re.suppressErrorLogging||console.log(e),e}return!0})}},handleEx:function(e,t){Kt.processCommand(e,t)},defineMotion:_e,defineAction:Se,defineOperator:be,mapCommand:Qt,_mapCommand:Yt,defineRegister:pe,exitVisualMode:Je,exitInsertMode:Jt},F=[],ie=!1,I;function ae(e){if(!I)throw Error(`No prompt to send key to`);if(e[0]==`<`){var t=e.toLowerCase().slice(1,-1);if(t=t.split(`-`).pop()||``,t==`lt`)e=`<`;else if(t==`space`)e=` `;else if(t==`cr`)e=`
47
47
  `;else if(R[t]){var n=I.value||``,r={key:R[t],target:{value:n,selectionEnd:n.length,selectionStart:n.length}};I.onKeyDown&&I.onKeyDown(r,I.value,a),I&&I.onKeyUp&&I.onKeyUp(r,I.value,a);return}}if(e==`
48
48
  `){var i=I;I=null,i.onClose&&i.onClose(i.value)}else I.value=(I.value||``)+e;function a(e){I&&(typeof e==`string`?I.value=e:I=null)}}function L(e,t,n){var r=ie;if(n){if(F.indexOf(n)!=-1)return;F.push(n),ie=n.noremap!=0}try{for(var i=N(e),a=/<(?:[CSMA]-)*\w+>|./gi,o;o=a.exec(t);){var s=o[0],c=i.insertMode;if(I){ae(s);continue}if(!re.handleKey(e,s,`mapping`)&&c&&i.insertMode){if(s[0]==`<`){var l=s.toLowerCase().slice(1,-1);if(l=l.split(`-`).pop()||``,l==`lt`)s=`<`;else if(l==`space`)s=` `;else if(l==`cr`)s=`
49
49
  `;else if(R.hasOwnProperty(l)){s=R[l],cn(e,s);continue}else s=s[0],a.lastIndex=o.index+1}e.replaceSelection(s)}}}finally{if(F.pop(),ie=F.length?r:!1,!F.length&&I){var u=I;I=null,jt(e,u)}}}var oe={Return:`CR`,Backspace:`BS`,Delete:`Del`,Escape:`Esc`,Insert:`Ins`,ArrowLeft:`Left`,ArrowRight:`Right`,ArrowUp:`Up`,ArrowDown:`Down`,Enter:`CR`," ":`Space`},se={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},R={};`Left|Right|Up|Down|End|Home`.split(`|`).concat(Object.keys(oe)).forEach(function(e){R[(oe[e]||``).toLowerCase()]=R[e.toLowerCase()]=e});function ce(t,n){var r=t.key;if(!se[r]){r.length>1&&r[0]==`n`&&(r=r.replace(`Numpad`,``)),r=oe[r]||r;var a=``;if(t.ctrlKey&&(a+=`C-`),t.altKey&&(a+=`A-`),t.metaKey&&(a+=`M-`),e.isMac&&a==`A-`&&r.length==1&&(a=a.slice(2)),(a||r.length>1)&&t.shiftKey&&(a+=`S-`),n&&!n.expectLiteralNext&&r.length==1){if(s.keymap&&r in s.keymap)(s.remapCtrl!=0||!a)&&(r=s.keymap[r]);else if(r.charCodeAt(0)>128&&!i[r]){var o=t.code?.slice(-1)||``;t.shiftKey||(o=o.toLowerCase()),o&&(r=o,!a&&t.altKey&&(a=`A-`))}}return a+=r,a.length>1&&(a=`<`+a+`>`),a}}function le(e,t){s.string!==e&&(s=ue(e)),s.remapCtrl=t}function ue(e){let t={};if(!e)return{keymap:t,string:``};function n(e){return e.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map(e=>{if(!e)return;let r=e.split(/((?:[^\\;]|\\.)+);/);if(r.length==3){let e=n(r[1]),i=n(r[2]);if(e.length!==i.length)return;for(let n=0;n<e.length;++n)t[e[n]]=i[n]}else if(r.length==1){let r=n(e);if(r.length%2!=0)return;for(let e=0;e<r.length;e+=2)t[r[e]]=r[e+1]}}),{keymap:t,string:e}}D(`langmap`,void 0,`string`,[`lmap`],function(e,t){if(e===void 0)return s.string;le(e)});class z{constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=void 0,this.changeQueue=null}pushRepeatDigit(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)}getRepeat(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(``),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(``),10))),e}}function B(t,n){t.state.vim.inputState=new z,t.state.vim.expectLiteralNext=!1,e.signal(t,`vim-command-done`,n)}function de(){this.removed=[],this.inserted=``}class fe{constructor(e,t,n){this.clear(),this.keyBuffer=[e||``],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}setText(e,t,n){this.keyBuffer=[e||``],this.linewise=!!t,this.blockwise=!!n}pushText(e,t){t&&(this.linewise||this.keyBuffer.push(`
@@ -76,49 +76,49 @@ mark line col
76
76
  `),_=s==`decimal`?/(-?)([\d]+)/:s==`hex`?/(-?)(?:0x)?([0-9a-f]+)/i:s==`octal`?/([0-7]+)/:null,v=s==`decimal`?10:s==`hex`?16:s==`octal`?8:void 0,y=[],b=[];if(s||c)for(var x=0;x<g.length;x++){var S=c?g[x].match(c):null;S&&S.index!=null&&!l&&(S[0]=g[x].slice(S.index+S[0].length)),S&&S[0]!=``?y.push(S):_&&_.exec(g[x])?y.push(g[x]):b.push(g[x])}else b=g;function C(e,t){if(i){var n=e;e=t,t=n}a&&(e=e.toLowerCase(),t=t.toLowerCase());var r=_&&_.exec(e),o=_&&_.exec(t);return!r||!o?e<t?-1:1:parseInt((r[1]+r[2]).toLowerCase(),v)-parseInt((o[1]+o[2]).toLowerCase(),v)}function w(e,t){if(i){var n=e;e=t,t=n}return a&&(e[0]=e[0].toLowerCase(),t[0]=t[0].toLowerCase()),e[0]<t[0]?-1:1}if(y.sort(c?w:C),c)for(var x=0;x<y.length;x++)y[x]=y[x].input;else s||b.sort(C);if(g=i?y.concat(b):b.concat(y),o){var T=g,E;g=[];for(var x=0;x<T.length;x++)T[x]!=E&&g.push(T[x]),E=T[x]}n.replaceRange(g.join(`
77
77
  `),m,h)},vglobal:function(e,t){this.global(e,t)},normal:function(e,t){var n=!1,r=t.argString;if(r&&r[0]==`!`&&(r=r.slice(1),n=!0),r=r.trimStart(),!r){U(e,`Argument is required.`);return}var i=t.line;if(typeof i==`number`)for(var a=isNaN(t.lineEnd)?i:t.lineEnd,o=i;o<=a;o++)e.setCursor(o,0),L(e,t.argString.trimStart(),{noremap:n}),e.state.vim.insertMode&&Jt(e,!0);else L(e,t.argString.trimStart(),{noremap:n}),e.state.vim.insertMode&&Jt(e,!0)},global:function(e,t){var n=t.argString;if(!n){U(e,`Regular Expression missing from global`);return}var r=t.commandName[0]===`v`;n[0]===`!`&&t.commandName[0]===`g`&&(r=!0,n=n.slice(1));var i=t.line===void 0?e.firstLine():t.line,a=t.lineEnd||t.line||e.lastLine(),o=yt(n),s=n,c=``;if(o&&o.length&&(s=o[0],c=o.slice(1,o.length).join(`/`)),s)try{Nt(e,s,!0,!0)}catch{U(e,`Invalid regex: `+s);return}for(var l=vt(e).getQuery(),u=[],d=i;d<=a;d++){var f=e.getLine(d);l.test(f)!==r&&u.push(c?e.getLineHandle(d):f)}if(!c){U(e,u.join(`
78
78
  `));return}var p=0,m=function(){if(p<u.length){var t=u[p++],n=e.getLineNumber(t);if(n==null){m();return}var r=n+1+c;Kt.processCommand(e,r,{callback:m})}else e.releaseLineHandles&&e.releaseLineHandles()};m()},substitute:function(e,n){if(!e.getSearchCursor)throw Error(`Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.`);var r=n.argString,i=r?xt(r,r[0]):[],a=``,o=``,s,c,l,u=!1,d=!1;if(i&&i.length)a=i[0],k(`pcre`)&&a!==``&&(a=new RegExp(a).source),o=i[1],o!==void 0&&(o=k(`pcre`)?Dt(o.replace(/([^\\])&/g,`$1$$&`)):Tt(o),P.lastSubstituteReplacePart=o),s=i[2]?i[2].split(` `):[];else if(r&&r.length){U(e,`Substitutions should be of the form :s/pattern/replace/`);return}if(s&&(c=s[0],l=parseInt(s[1]),c&&(c.indexOf(`c`)!=-1&&(u=!0),c.indexOf(`g`)!=-1&&(d=!0),a=k(`pcre`)?a+`/`+c:a.replace(/\//g,`\\/`)+`/`+c)),a)try{Nt(e,a,!0,!0)}catch{U(e,`Invalid regex: `+a);return}if(o||=P.lastSubstituteReplacePart,o===void 0){U(e,`No previous substitute regular expression`);return}var f=vt(e).getQuery(),p=n.line===void 0?e.getCursor().line:n.line,m=n.lineEnd||p;p==e.firstLine()&&m==e.lastLine()&&(m=1/0),l&&(p=m,m=p+l-1);var h=Ce(e,new t(p,0)),g=e.getSearchCursor(f,h);qt(e,u,d,p,m,g,f,o,n.callback)},startinsert:function(e,t){L(e,t.argString==`!`?`A`:`i`,{})},redo:e.commands.redo,undo:e.commands.undo,write:function(t){e.commands.save?e.commands.save(t):t.save&&t.save()},nohlsearch:function(e){zt(e)},yank:function(e,n){var r=n.selectionLine,i=isNaN(n.selectionLineEnd)?r:n.selectionLineEnd;if(i<r){var a=i;i=r,r=a}var o=e.getRange(new t(r,0),new t(i+1,0)),s=n.args&&n.args[0]?n.args[0]:`0`;P.registerController.pushText(s,`yank`,o,!0,!1),U(e,i+1-r+` lines yanked`+(s?` into "`+s:``),!1,1500)},put:function(e,n,r){var i={after:!0,isEdit:!0,matchIndent:!!r,repeat:1,lineWise:!0,registerName:``},a=n.args||[];a[0]==`!`&&(i.after=!1,a.shift()),a[0]&&(i.registerName=a[0]);var o=n.selectionLine;o!=null&&e.setCursor(new t(o,0)),xe.paste(e,i,e.state.vim)},iput:function(e,t){this.put(e,t,!0)},delete:function(e,n){var r=n.selectionLine,i=isNaN(n.selectionLineEnd)?r:n.selectionLineEnd;ye.delete(e,{linewise:!0},[{anchor:new t(r,0),head:new t(i+1,0)}])},join:function(e,n){var r=n.selectionLine,i=isNaN(n.selectionLineEnd)?r:n.selectionLineEnd;e.setCursor(new t(r,0)),xe.joinLines(e,{repeat:i-r},e.state.vim)},delmarks:function(t,n){if(!n.argString||!Ie(n.argString)){U(t,`Argument required`);return}for(var r=t.state.vim,i=new e.StringStream(Ie(n.argString));!i.eol();){i.eatSpace();var a=i.pos;if(!i.match(/[a-zA-Z]/,!1)){U(t,`Invalid argument: `+n.argString.substring(a));return}var o=i.next();if(i.match(`-`,!0)){if(!i.match(/[a-zA-Z]/,!1)){U(t,`Invalid argument: `+n.argString.substring(a));return}var s=o,c=i.next();if(s&&c&&y(s)==y(c)){var l=s.charCodeAt(0),u=c.charCodeAt(0);if(l>=u){U(t,`Invalid argument: `+n.argString.substring(a));return}for(var d=0;d<=u-l;d++){var f=String.fromCharCode(l+d);delete r.marks[f]}}else{U(t,`Invalid argument: `+s+`-`);return}}else o&&delete r.marks[o]}}},Kt=new Wt;re.defineEx(`version`,`ve`,e=>{U(e,`Codemirror-vim version: <DEV>`)});function qt(t,n,r,i,a,o,s,c,l){t.state.vim.exMode=!0;var u=!1,d=0,f,p,m;function h(){t.operation(function(){for(;!u;)g(),v();y()})}function g(){var e=``,n=o.match||o.pos&&o.pos.match;e=n?c.replace(/\$(\d{1,3}|[$&])/g,function(e,t){if(t==`$`)return`$`;if(t==`&`)return n[0];for(var r=t;parseInt(r)>=n.length&&r.length>0;)r=r.slice(0,r.length-1);return r?n[r]+t.slice(r.length,t.length):e}):t.getRange(o.from(),o.to()).replace(s,c);var r=o.to().line;o.replace(e),p=o.to().line,a+=p-r,m=p<r}function _(){var e=f&&ke(o.to()),t=o.findNext();return t&&!t[0]&&e&&Ae(o.from(),e)&&(t=o.findNext()),t&&d++,t}function v(){for(;_()&&Bt(o.from(),i,a);)if(!(!r&&o.from().line==p&&!m)){t.scrollIntoView(o.from(),30),t.setSelection(o.from(),o.to()),f=o.from(),u=!1;return}u=!0}function y(e){if(e&&e(),t.focus(),f){t.setCursor(f);var n=t.state.vim;n.exMode=!1,n.lastHPos=n.lastHSPos=f.ch}l?l():u&&U(t,(d?`Found `+d+` matches`:`No matches found`)+` for pattern: `+s+(k(`pcre`)?` (set nopcre to use Vim regexps)`:``))}function b(n,r,i){switch(e.e_stop(n),ce(n)){case`y`:g(),v();break;case`n`:v();break;case`a`:var a=l;l=void 0,t.operation(h),l=a;break;case`l`:g();case`q`:case`<Esc>`:case`<C-c>`:case`<C-[>`:y(i)}return u&&y(i),!0}if(v(),u){U(t,`No matches for `+s+(k(`pcre`)?` (set nopcre to use vim regexps)`:``));return}if(!n){h(),l&&l();return}jt(t,{prefix:kt(`span`,`replace with `,kt(`strong`,c),` (y/n/a/q/l)`),onKeyDown:b})}function Jt(t,n){var r=t.state.vim,i=P.macroModeState,a=P.registerController.getRegister(`.`),o=i.isPlaying,s=i.lastInsertModeChanges;o||(t.off(`change`,rn),r.insertEnd&&r.insertEnd.clear(),r.insertEnd=void 0,e.off(t.getInputField(),`keydown`,sn)),!o&&r.insertModeRepeat&&r.insertModeRepeat>1&&(W(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,n||t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption(`keyMap`,`vim`),t.setOption(`disableInput`,!0),t.toggleOverwrite(!1),a.setText(s.changes.join(``)),e.signal(t,`vim-mode-change`,{mode:`normal`}),i.isRecording&&tn(i)}function Yt(e){r.unshift(e),e.keys&&Xt(e.keys)}function Xt(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(e){e&&(i[e]||(i[e]=0),i[e]++)})}function Zt(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(e){i[e]&&i[e]--})}function Qt(e,t,n,r,i){var a={keys:e,type:t};for(var o in a[t]=n,a[t+`Args`]=r,i)a[o]=i[o];Yt(a)}D(`insertModeEscKeysTimeout`,200,`number`);function $t(e,t,n,r){var i=P.registerController.getRegister(r);if(r==`:`){i.keyBuffer[0]&&Kt.processCommand(e,i.keyBuffer[0]),n.isPlaying=!1;return}var a=i.keyBuffer,o=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var s=0;s<a.length;s++)for(var c=a[s],l,u,d=/<(?:[CSMA]-)*\w+>|./gi;l=d.exec(c);)if(u=l[0],re.handleKey(e,u,`macro`),t.insertMode){var f=i.insertModeChanges[o++].changes;P.macroModeState.lastInsertModeChanges.changes=f,ln(e,f,1),Jt(e)}n.isPlaying=!1}function en(e,t){if(!e.isPlaying){var n=e.latestRegister,r=P.registerController.getRegister(n);r&&r.pushText(t)}}function tn(e){if(!e.isPlaying){var t=e.latestRegister,n=P.registerController.getRegister(t);n&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)}}function nn(e,t){if(!e.isPlaying){var n=e.latestRegister,r=P.registerController.getRegister(n);r&&r.pushSearchQuery&&r.pushSearchQuery(t)}}function rn(e,t){var n=P.macroModeState,r=n.lastInsertModeChanges;if(!n.isPlaying)for(var i=e.state.vim;t;){if(r.expectCursorActivityForChange=!0,r.ignoreCount>1)r.ignoreCount--;else if(t.origin==`+input`||t.origin==`paste`||t.origin===void 0){var a=e.listSelections().length;a>1&&(r.ignoreCount=a);var o=t.text.join(`
79
- `);if(r.maybeReset&&=(r.changes=[],!1),o){if(e.state.overwrite&&!/\n/.test(o))r.changes.push([o]);else{if(o.length>1){var s=i&&i.insertEnd&&i.insertEnd.find(),c=e.getCursor();if(s&&s.line==c.line){var l=s.ch-c.ch;l>0&&l<o.length&&(r.changes.push([o,l]),o=``)}}o&&r.changes.push(o)}}}t=t.next}}function an(e){var t=e.state.vim;if(t.insertMode){var n=P.macroModeState;if(n.isPlaying)return;var r=n.lastInsertModeChanges;r.expectCursorActivityForChange?r.expectCursorActivityForChange=!1:(r.maybeReset=!0,t.insertEnd&&t.insertEnd.clear(),t.insertEnd=e.setBookmark(e.getCursor(),{insertLeft:!0}))}else e.curOp?.isVimOp||on(e,t)}function on(t,n){var r=t.getCursor(`anchor`),i=t.getCursor(`head`);if(n.visualMode&&!t.somethingSelected()?Je(t,!1):!n.visualMode&&!n.insertMode&&t.somethingSelected()&&(n.visualMode=!0,n.visualLine=!1,e.signal(t,`vim-mode-change`,{mode:`visual`})),n.visualMode){var a=je(i,r)?0:-1,o=je(i,r)?-1:0;i=we(i,0,a),r=we(r,0,o),n.sel={anchor:r,head:i},ut(t,n,`<`,Me(i,r)),ut(t,n,`>`,Ne(i,r))}else n.insertMode||(n.lastHPos=t.getCursor().ch)}function sn(t){var n=P.macroModeState.lastInsertModeChanges,r=e.keyName?e.keyName(t):t.key;r&&(r.indexOf(`Delete`)!=-1||r.indexOf(`Backspace`)!=-1)&&(n.maybeReset&&=(n.changes=[],!1),n.changes.push(new te(r,t)))}function W(e,t,n,r){var i=P.macroModeState;i.isPlaying=!0;var a=t.lastEditActionCommand,o=t.inputState;function s(){a?V.processAction(e,t,a):V.evalInput(e,t)}function c(n){if(i.lastInsertModeChanges.changes.length>0){n=t.lastEditActionCommand?n:1;var r=i.lastInsertModeChanges;ln(e,r.changes,n)}}if(t.inputState=t.lastEditInputState,a&&a.interlaceInsertRepeat)for(var l=0;l<n;l++)s(),c(1);else r||s(),c(n);t.inputState=o,t.insertMode&&!r&&Jt(e),i.isPlaying=!1}function cn(t,n){e.lookupKey(n,`vim-insert`,function(n){return typeof n==`string`?e.commands[n](t):n(t),!0})}function ln(e,t,n){var r=e.getCursor(`head`),i=P.macroModeState.lastInsertModeChanges.visualBlock;i&&(Be(e,r,i+1),n=e.listSelections().length,e.setCursor(r));for(var a=0;a<n;a++){i&&e.setCursor(we(r,a,0));for(var o=0;o<t.length;o++){var s=t[o];if(s instanceof te)cn(e,s.keyName);else if(typeof s==`string`)e.replaceSelection(s);else{var c=e.getCursor(),l=we(c,0,s[0].length-(s[1]||0));e.replaceRange(s[0],c,s[1]?c:l),e.setCursor(l)}}}i&&e.setCursor(we(r,0,1))}function un(e){var t=new e.constructor;return Object.keys(e).forEach(function(n){if(n!=`insertEnd`){var r=e[n];Array.isArray(r)?r=r.slice():r&&typeof r==`object`&&r.constructor!=Object&&(r=un(r)),t[n]=r}}),e.sel&&(t.sel={head:e.sel.head&&ke(e.sel.head),anchor:e.sel.anchor&&ke(e.sel.anchor)}),t}function dn(e,t,n){var r=N(e),i=e,a=!1,r=re.maybeInitVimState_(i),o=r.visualBlock||r.wasInVisualBlock;if(i.state.closeVimNotification){var s=i.state.closeVimNotification;if(i.state.closeVimNotification=null,s(),t==`<CR>`)return B(i),!0}var c=i.isInMultiSelectMode();if(r.wasInVisualBlock&&!c?r.wasInVisualBlock=!1:c&&r.visualBlock&&(r.wasInVisualBlock=!0),t==`<Esc>`&&!r.insertMode&&!r.visualMode&&c&&r.status==`<Esc>`)B(i);else if(o||!c||i.inVirtualSelectionMode)a=re.handleKey(i,t,n);else{var l=un(r),u=r.inputState.changeQueueList||[];i.operation(function(){i.curOp&&(i.curOp.isVimOp=!0);var e=0;i.forEachSelection(function(){i.state.vim.inputState.changeQueue=u[e];var r=i.getCursor(`head`),o=i.getCursor(`anchor`),s=je(r,o)?0:-1,c=je(r,o)?-1:0;r=we(r,0,s),o=we(o,0,c),i.state.vim.sel.head=r,i.state.vim.sel.anchor=o,a=re.handleKey(i,t,n),i.virtualSelection&&(u[e]=i.state.vim.inputState.changeQueue,i.state.vim=un(l)),e++}),i.curOp?.cursorActivity&&!a&&(i.curOp.cursorActivity=!1),i.state.vim=r,r.inputState.changeQueueList=u,r.inputState.changeQueue=null},!0)}return a&&!r.visualMode&&!r.insertMode&&r.visualMode!=i.somethingSelected()&&on(i,r),a}return ee(),re}function kg(e,t){var n=t.ch,r=t.line+1;r<1&&(r=1,n=0),r>e.lines&&(r=e.lines,n=Number.MAX_VALUE);var i=e.line(r);return Math.min(i.from+Math.max(0,n),i.to)}function Ag(e,t){let n=e.lineAt(t);return{line:n.number-1,ch:t-n.from}}var jg=class{constructor(e,t){this.line=e,this.ch=t}};function Mg(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else{var r=e._handlers||={};r[t]=(r[t]||[]).concat(n)}}function Ng(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else{var r=e._handlers,i=r&&r[t];if(i){var a=i.indexOf(n);a>-1&&(r[t]=i.slice(0,a).concat(i.slice(a+1)))}}}function Pg(e,t,...n){var r=e._handlers?.[t];if(r)for(var i=0;i<r.length;++i)r[i](...n)}function Fg(e,...t){if(e)for(var n=0;n<e.length;++n)e[n](...t)}var Ig;try{Ig=RegExp(`[\\w\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{Ig=/[\w]/}function Lg(e,t){var n=e.cm6;if(!n.state.readOnly){var r=`input.type.compose`;if(e.curOp&&(e.curOp.lastChange||(r=`input.type.compose.start`)),t.annotations)try{t.annotations.some(function(e){e.value==`input`&&(e.value=r)})}catch(e){console.error(e)}else t.userEvent=r;return n.dispatch(t)}}function Rg(e,t){e.curOp&&(e.curOp.$changeStart=void 0),(t?rr:fr)(e.cm6);let n=e.curOp?.$changeStart;n!=null&&e.cm6.dispatch({selection:{anchor:n}})}var zg={Left:e=>xn(e.cm6,{key:`Left`},`editor`),Right:e=>xn(e.cm6,{key:`Right`},`editor`),Up:e=>xn(e.cm6,{key:`Up`},`editor`),Down:e=>xn(e.cm6,{key:`Down`},`editor`),Backspace:e=>xn(e.cm6,{key:`Backspace`},`editor`),Delete:e=>xn(e.cm6,{key:`Delete`},`editor`)},Bg=class e{openDialog(e,t,n){return Kg(this,e,t,n)}openNotification(e,t){return Ug(this,e,t)}constructor(e){this.state={},this.marks=Object.create(null),this.$mid=0,this.options={},this._handlers={},this.$lastChangeEndOffset=0,this.virtualSelection=null,this.cm6=e,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this)}on(e,t){Mg(this,e,t)}off(e,t){Ng(this,e,t)}signal(e,t,n){Pg(this,e,t,n)}indexFromPos(e){return kg(this.cm6.state.doc,e)}posFromIndex(e){return Ag(this.cm6.state.doc,e)}foldCode(e){let t=this.cm6,n=t.state.selection.ranges,r=this.cm6.state.doc,i=kg(r,e),a=An.create([An.range(i,i)],0).ranges;t.state.selection.ranges=a,dn(t),t.state.selection.ranges=n}firstLine(){return 0}lastLine(){return this.cm6.state.doc.lines-1}lineCount(){return this.cm6.state.doc.lines}setCursor(e,t){typeof e==`object`&&(t=e.ch,e=e.line);var n=kg(this.cm6.state.doc,{line:e,ch:t||0});this.cm6.dispatch({selection:{anchor:n}},{scrollIntoView:!this.curOp}),this.curOp&&!this.curOp.isVimOp&&this.onBeforeEndOperation()}getCursor(e){var t=this.cm6.state.selection.main,n=e==`head`||!e?t.head:e==`anchor`?t.anchor:e==`start`?t.from:e==`end`?t.to:null;if(n==null)throw Error(`Invalid cursor type`);return this.posFromIndex(n)}listSelections(){var e=this.cm6.state.doc;return this.cm6.state.selection.ranges.map(t=>({anchor:Ag(e,t.anchor),head:Ag(e,t.head)}))}setSelections(e,t){var n=this.cm6.state.doc,r=e.map(e=>{var t=kg(n,e.head),r=kg(n,e.anchor);return t==r?An.cursor(t,1):An.range(r,t)});this.cm6.dispatch({selection:An.create(r,t)})}setSelection(e,t,n){this.setSelections([{anchor:e,head:t}],0),n&&n.origin==`*mouse`&&this.onBeforeEndOperation()}getLine(e){var t=this.cm6.state.doc;return e<0||e>=t.lines?``:this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||=[],{row:e,index:this.indexFromPos(new jg(e,0))}}getLineNumber(e){var t=this.$lineHandleChanges;if(!t)return null;for(var n=e.index,r=0;r<t.length;r++)if(n=t[r].changes.mapPos(n,1,qn.TrackAfter),n==null)return null;var i=this.posFromIndex(n);return i.ch==0?i.line:null}releaseLineHandles(){this.$lineHandleChanges=void 0}getRange(e,t){var n=this.cm6.state.doc;return this.cm6.state.sliceDoc(kg(n,e),kg(n,t))}replaceRange(e,t,n,r){n||=t;var i=this.cm6.state.doc,a=kg(i,t),o=kg(i,n);Lg(this,{changes:{from:a,to:o,insert:e}})}replaceSelection(e){Lg(this,this.cm6.state.replaceSelection(e))}replaceSelections(e){var t=this.cm6.state.selection.ranges.map((t,n)=>({from:t.from,to:t.to,insert:e[n]||``}));Lg(this,{changes:t})}getSelection(){return this.getSelections().join(`
80
- `)}getSelections(){var e=this.cm6;return e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(e=>!e.empty)}getInputField(){return this.cm6.contentDOM}clipPos(e){var t=this.cm6.state.doc,n=e.ch,r=e.line+1;r<1&&(r=1,n=0),r>t.lines&&(r=t.lines,n=Number.MAX_VALUE);var i=t.line(r);return n=Math.min(Math.max(0,n),i.to-i.from),new jg(r-1,n)}getValue(){return this.cm6.state.doc.toString()}setValue(e){var t=this.cm6;return t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e},selection:An.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(e,t){var n=this.cm6.state,r=kg(n.doc,e),i=er(n,r+1,-1);return i&&i.end||(i=er(n,r,1),i&&i.end)?{to:Ag(n.doc,i.end.from)}:{to:void 0}}scanForBracket(e,t,n,r){return Yg(this,e,t,n,r)}indentLine(e,t){t?this.indentMore():this.indentLess()}indentMore(){or(this.cm6)}indentLess(){cr(this.cm6)}execCommand(t){if(e.commands.hasOwnProperty(t))e.commands[t](this);else if(t==`goLineLeft`)lr(this.cm6);else if(t==`goLineRight`){br(this.cm6);let e=this.cm6.state,t=e.selection.main.head;t<e.doc.length&&e.sliceDoc(t,t+1)!==`
81
- `&&mr(this.cm6)}else console.log(t+` is not implemented`)}setBookmark(e,t){var n=t?.insertLeft?1:-1,r=this.indexFromPos(e);return new $g(this,r,n)}addOverlay({query:e}){let t=new hr({regexp:!0,search:e.source,caseSensitive:!/i/.test(e.flags)});if(t.valid){t.forVim=!0,this.cm6Query=t;let e=gr.of(t);return this.cm6.dispatch({effects:e}),t}}removeOverlay(e){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let t=gr.of(this.cm6Query);this.cm6.dispatch({effects:t})}getSearchCursor(e,t){var n=this,r=null,i=null,a=!1;t.ch??=Number.MAX_VALUE;var o=kg(n.cm6.state.doc,t),s=e.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,function(e,t){return t||`\\`+e});function c(t,n=0,r=t.length){return new vr(t,s,{ignoreCase:e.ignoreCase},n,r)}function l(e){var t=n.cm6.state.doc;if(e>t.length)return null;let r=c(t,e).next();return r.done?null:r.value}var u=1e4;function d(e,t){var r=n.cm6.state.doc;for(let n=1;;n++){let i=Math.max(e,t-n*u),a=c(r,i,t),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==e||o.from>i+10))return o;if(i==e)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){var t=n.cm6.state.doc;return r=e?d(0,r?a?r.to-1:r.from:o):l(r?a?r.to+1:r.to:o),i=r&&{from:Ag(t,r.from),to:Ag(t,r.to),match:r.match},a=r?r.from==r.to:!1,r&&r.match},from:function(){return i?.from},to:function(){return i?.to},replace:function(e){r&&(Lg(n,{changes:{from:r.from,to:r.to,insert:e}}),r.to=r.from+e.length,i&&(i.to=Ag(n.cm6.state.doc,r.to)))},get match(){return i&&i.match}}}findPosV(e,t,n,r){let{cm6:i}=this,a=i.state.doc,o=n==`page`?i.dom.clientHeight:0,s=kg(a,e),c=An.cursor(s,1,void 0,r),l=Math.round(Math.abs(t));for(let e=0;e<l;e++)n==`page`?c=i.moveVertically(c,t>0,o):n==`line`&&(c=i.moveVertically(c,t>0));let u=Ag(a,c.head);return(t<0&&c.head==0&&r!=0&&e.line==0&&e.ch!=0||t>0&&c.head==a.length&&u.ch!=r&&e.line==u.line)&&(u.hitSide=!0),u}charCoords(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=kg(this.cm6.state.doc,e),i=this.cm6.coordsAtPos(r),a=-n.top;return{left:(i?.left||0)-n.left,top:(i?.top||0)+a,bottom:(i?.bottom||0)+a}}coordsChar(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=this.cm6.posAtCoords({x:e.left+n.left,y:e.top+n.top})||0;return Ag(this.cm6.state.doc,r)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,t){e!=null&&(this.cm6.scrollDOM.scrollLeft=e),t!=null&&(this.cm6.scrollDOM.scrollTop=t)}scrollIntoView(e,t){if(e){var n=this.indexFromPos(e);this.cm6.dispatch({effects:Jn.scrollIntoView(n)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:`scroll`})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption(`mode`)}}setSize(e,t){this.cm6.dom.style.width=e+4+`px`,this.cm6.dom.style.height=t+`px`,this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){this.$lineHandleChanges&&this.$lineHandleChanges.push(e);for(let t in this.marks)this.marks[t].update(e.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(t=>t.map(e.changes)));var t=this.curOp=this.curOp||{};e.changes.iterChanges((e,n,r,i,a)=>{(t.$changeStart==null||t.$changeStart>r)&&(t.$changeStart=r),this.$lastChangeEndOffset=i;var o={text:a.toJSON()};t.lastChange?t.lastChange.next=t.lastChange=o:t.lastChange=t.change=o},!0),t.changeHandlers||=this._handlers.change&&this._handlers.change.slice()}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice(),this.curOp.cursorActivity=!0}operation(e,t){this.curOp||={$d:0},this.curOp.$d++;try{var n=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return n}onBeforeEndOperation(){var e=this.curOp,t=!1;e&&(e.change&&Fg(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(Fg(e.cursorActivityHandlers,this,null),e.isVimOp&&(t=!0)),this.curOp=null),t&&this.scrollIntoView()}moveH(e,t){if(t==`char`){var n=this.getCursor();this.setCursor(n.line,n.ch+e)}}setOption(e,t){switch(e){case`keyMap`:this.state.keyMap=t;break;case`textwidth`:this.state.textwidth=t}}getOption(e){switch(e){case`firstLineNumber`:return 1;case`tabSize`:return this.cm6.state.tabSize||4;case`readOnly`:return this.cm6.state.readOnly;case`indentWithTabs`:return this.cm6.state.facet(_n)==` `;case`indentUnit`:return this.cm6.state.facet(_n).length||2;case`textwidth`:return this.state.textwidth;case`keyMap`:return this.state.keyMap||`vim`}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(e){var t=this.indexFromPos(e),n=(In(this.cm6.state,t)?.resolve(t))?.type?.name||``;return/comment/i.test(n)?`comment`:/string/i.test(n)?`string`:``}overWriteSelection(e){var t=this.cm6.state.doc,n=this.cm6.state.selection,r=n.ranges.map(e=>{if(e.empty){var n=e.to<t.length?t.sliceString(e.from,e.to+1):``;if(n&&!/\n/.test(n))return An.range(e.from,e.to+1)}return e});this.cm6.dispatch({selection:An.create(r,n.mainIndex)}),this.replaceSelection(e)}isInMultiSelectMode(){return this.cm6.state.selection.ranges.length>1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(e){var t=this.cm6.state.selection;this.virtualSelection=An.create(t.ranges,t.mainIndex);for(var n=0;n<this.virtualSelection.ranges.length;n++){var r=this.virtualSelection.ranges[n];r&&(this.cm6.dispatch({selection:An.create([r])}),e(),this.virtualSelection.ranges[n]=this.cm6.state.selection.ranges[0])}this.cm6.dispatch({selection:this.virtualSelection}),this.virtualSelection=null}hardWrap(e){return e_(this,e)}};Bg.isMac=typeof navigator<`u`&&/Mac/.test(navigator.platform),Bg.Pos=jg,Bg.StringStream=Wn,Bg.commands={toggleLineComment:function(e){xr(e.cm6)},cursorCharLeft:function(e){dr(e.cm6)},redo:function(e){Rg(e,!1)},undo:function(e){Rg(e,!0)},newlineAndIndent:function(e){pr({state:e.cm6.state,dispatch:t=>Lg(e,t)})},indentAuto:function(e){ar(e.cm6)},newlineAndIndentContinueComment:void 0,save:void 0},Bg.isWordChar=function(e){return Ig.test(e)},Bg.keys=zg,Bg.addClass=function(e,t){},Bg.rmClass=function(e,t){},Bg.e_preventDefault=function(e){e.preventDefault()},Bg.e_stop=function(e){var t,n;(t=e?.stopPropagation)==null||t.call(e),(n=e?.preventDefault)==null||n.call(e)},Bg.lookupKey=function(e,t,n){var r=Bg.keys[e];!r&&/^Arrow/.test(e)&&(r=Bg.keys[e.slice(5)]),r&&n(r)},Bg.on=Mg,Bg.off=Ng,Bg.signal=Pg,Bg.findMatchingTag=Xg,Bg.findEnclosingTag=Zg,Bg.keyName=void 0;function Vg(e,t,n){var r=document.createElement(`div`);return r.appendChild(t),r}function Hg(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}function Ug(e,t,n){Hg(e,s);var r=Vg(e,t,n&&n.bottom),i=!1,a,o=n&&n.duration!==void 0?n.duration:5e3;function s(){i||(i=!0,clearTimeout(a),r.remove(),Gg(e,r))}return r.onclick=function(e){e.preventDefault(),s()},Wg(e,r),o&&(a=setTimeout(s,o)),s}function Wg(e,t){var n=e.state.dialog;e.state.dialog=t,t.style.flex=`1`,t&&n!==t&&(n&&n.contains(document.activeElement)&&e.focus(),n&&n.parentElement?n.parentElement.replaceChild(t,n):n&&n.remove(),Bg.signal(e,`dialog`))}function Gg(e,t){e.state.dialog==t&&(e.state.dialog=null,Bg.signal(e,`dialog`))}function Kg(e,t,n,r){r||={},Hg(e,void 0);var i=Vg(e,t,r.bottom),a=!1;Wg(e,i);function o(t){if(typeof t==`string`)s.value=t;else{if(a)return;a=!0,Gg(e,i),e.state.dialog||e.focus(),r.onClose&&r.onClose(i)}}var s=i.getElementsByTagName(`input`)[0];return s&&(r.value&&(s.value=r.value,r.selectValueOnOpen!==!1&&s.select()),r.onInput&&Bg.on(s,`input`,function(e){r.onInput(e,s.value,o)}),r.onKeyUp&&Bg.on(s,`keyup`,function(e){r.onKeyUp(e,s.value,o)}),Bg.on(s,`keydown`,function(e){r&&r.onKeyDown&&r.onKeyDown(e,s.value,o)||(e.keyCode==13&&n&&n(s.value),(e.keyCode==27||r.closeOnEnter!==!1&&e.keyCode==13)&&(s.blur(),Bg.e_stop(e),o()))}),r.closeOnBlur!==!1&&Bg.on(s,`blur`,function(){setTimeout(function(){document.activeElement!==s&&o()})}),s.focus()),o}var qg={"(":`)>`,")":`(<`,"[":`]>`,"]":`[<`,"{":`}>`,"}":`{<`,"<":`>>`,">":`<<`};function Jg(e){return e&&e.bracketRegex||/[(){}[\]]/}function Yg(e,t,n,r,i){for(var a=i&&i.maxScanLineLength||1e4,o=i&&i.maxScanLines||1e3,s=[],c=Jg(i),l=n>0?Math.min(t.line+o,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-o),u=t.line;u!=l;u+=n){var d=e.getLine(u);if(d){var f=n>0?0:d.length-1,p=n>0?d.length:-1;if(!(d.length>a))for(u==t.line&&(f=t.ch-+(n<0));f!=p;f+=n){var m=d.charAt(f);if(c.test(m)){var h=qg[m];if(h&&h.charAt(1)==`>`==n>0)s.push(m);else if(s.length)s.pop();else return{pos:new jg(u,f),ch:m}}}}}return u-n!=(n>0?e.lastLine():e.firstLine())&&null}function Xg(e,t){return null}function Zg(e,t){var n=e.cm6.state,r=e.indexFromPos(t);r<n.doc.length&&n.sliceDoc(r,r+1)==`<`&&r++;for(var i=In(n,r)?.resolve(r)||null;i;){if(i.firstChild?.type.name==`OpenTag`&&i.lastChild?.type.name==`CloseTag`)return{open:Qg(n.doc,i.firstChild),close:Qg(n.doc,i.lastChild)};i=i.parent}}function Qg(e,t){return{from:Ag(e,t.from),to:Ag(e,t.to)}}var $g=class{constructor(e,t,n){this.cm=e,this.id=e.$mid++,this.offset=t,this.assoc=n,e.marks[this.id]=this}clear(){delete this.cm.marks[this.id]}find(){return this.offset==null?null:this.cm.posFromIndex(this.offset)}update(e){this.offset!=null&&(this.offset=e.mapPos(this.offset,this.assoc,qn.TrackDel))}};function e_(e,t){for(var n=t.column||e.getOption(`textwidth`)||80,r=t.allowMerge!=0,i=Math.min(t.from,t.to),a=Math.max(t.from,t.to);i<=a;){var o=e.getLine(i);if(o.length>n){var s=p(o,n,5);if(s){var c=/^\s*/.exec(o)?.[0];e.replaceRange(`
82
- `+c,new jg(i,s.start),new jg(i,s.end))}a++}else if(r&&/\S/.test(o)&&i!=a){var l=e.getLine(i+1);if(l&&/\S/.test(l)){var u=o.replace(/\s+$/,``),d=l.replace(/^\s+/,``),f=u+` `+d,s=p(f,n,5);s&&s.start>u.length||f.length<n?(e.replaceRange(` `,new jg(i,u.length),new jg(i+1,l.length-d.length)),i--,a--):u.length<o.length&&e.replaceRange(``,new jg(i,u.length),new jg(i,o.length))}}i++}return i;function p(e,t,n){if(!(e.length<t)){var r=e.slice(0,t),i=e.slice(t),a=/^(?:(\s+)|(\S+)(\s+))/.exec(i),o=/(?:(\s+)|(\s+)(\S+))$/.exec(r),s=0,c=0;if(o&&!o[2]&&(s=t-o[1].length,c=t),a&&!a[2]&&(s||=t,c=t+a[1].length),s)return{start:s,end:c};if(o&&o[2]&&o.index>n)return{start:o.index,end:o.index+o[2].length};if(a&&a[2])return s=t+a[2].length,{start:s,end:s+a[3].length}}}}var t_=Qn||function(){let e={cursorBlinkRate:1200};return function(){return e}}(),n_=class{constructor(e,t,n,r,i,a,o,s,c,l){this.left=e,this.top=t,this.height=n,this.fontFamily=r,this.fontSize=i,this.fontWeight=a,this.color=o,this.className=s,this.letter=c,this.partial=l}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,e.style.height=this.height+`px`,e.style.lineHeight=this.height+`px`,e.style.fontFamily=this.fontFamily,e.style.fontSize=this.fontSize,e.style.fontWeight=this.fontWeight,e.style.color=this.partial?`transparent`:this.color,e.className=this.className,e.textContent=this.letter}eq(e){return this.left==e.left&&this.top==e.top&&this.height==e.height&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.fontWeight==e.fontWeight&&this.color==e.color&&this.className==e.className&&this.letter==e.letter}},r_=class{constructor(e,t){this.view=e,this.rangePieces=[],this.cursors=[],this.cm=t,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=e.scrollDOM.appendChild(document.createElement(`div`)),this.cursorLayer.className=`cm-cursorLayer cm-vimCursorLayer`,this.cursorLayer.setAttribute(`aria-hidden`,`true`),e.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){let e=t_(this.cm.cm6.state).cursorBlinkRate;this.cursorLayer.style.animationDuration=e+`ms`}update(e){(e.selectionSet||e.geometryChanged||e.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName=this.cursorLayer.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`),i_(e)&&this.setBlinkRate()}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:e}=this.view,t=[];for(let n of e.selection.ranges){let r=n==e.selection.main,i=s_(this.cm,this.view,n,r);i&&t.push(i)}return{cursors:t}}drawSel({cursors:e}){if(e.length!=this.cursors.length||e.some((e,t)=>!e.eq(this.cursors[t]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent=``;for(let t of e)this.cursorLayer.appendChild(t.draw())}else e.forEach((e,n)=>e.adjust(t[n]));this.cursors=e}}destroy(){this.cursorLayer.remove()}};function i_(e){return t_(e.startState)!=t_(e.state)}var a_=vn.highest(Jn.theme({".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:`transparent !important`},"&::selection":{backgroundColor:`transparent !important`},caretColor:`transparent !important`},".cm-fat-cursor":{position:`absolute`,background:`#ff9696`,border:`none`,whiteSpace:`pre`},"&:not(.cm-focused) .cm-fat-cursor":{background:`none`,outline:`solid 1px #ff9696`,color:`transparent !important`}}));function o_(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Un.LTR?t.left:t.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function s_(e,t,n,r){var i;let a=n.head,o=!1,s=1,c=e.state.vim;if(c&&(!c.insertMode||e.state.overwrite)){if(o=!0,c.visualBlock&&!r)return null;n.anchor<n.head&&(a<t.state.doc.length&&t.state.sliceDoc(a,a+1))!=`
83
- `&&a--,e.state.overwrite?s=.2:c.status&&(s=.5)}if(o){let e=a<t.state.doc.length&&t.state.sliceDoc(a,a+1);e&&/[\uDC00-\uDFFF]/.test(e)&&a>1&&(a--,e=t.state.sliceDoc(a,a+1));let n=t.coordsAtPos(a,1);if(!n)return null;let o=o_(t),c=t.domAtPos(a),u=c?c.node:t.contentDOM;for(u instanceof Text&&c.offset>=u.data.length&&u.parentElement?.nextSibling&&(u=u.parentElement?.nextSibling,c={node:u,offset:0});c&&c.node instanceof HTMLElement;)u=c.node,c={node:c.node.childNodes[c.offset],offset:0};if(!(u instanceof HTMLElement)){if(!u.parentNode)return null;u=u.parentNode}let d=getComputedStyle(u),f=n.left,p=(i=t).coordsForChar?.call(i,a);if(p&&(f=p.left),!e||e==`
84
- `||e==`\r`)e=`\xA0`;else if(e==` `){e=`\xA0`;var l=t.coordsAtPos(a+1,-1);l&&(f=l.left-(l.left-n.left)/parseInt(d.tabSize))}else/[\uD800-\uDBFF]/.test(e)&&a<t.state.doc.length-1&&(e+=t.state.sliceDoc(a+1,a+2));let m=n.bottom-n.top;return new n_((f-o.left)/t.scaleX,(n.top-o.top+m*(1-s))/t.scaleY,m*s/t.scaleY,d.fontFamily,d.fontSize,d.fontWeight,d.color,r?`cm-fat-cursor cm-cursor-primary`:`cm-fat-cursor cm-cursor-secondary`,e,s!=1)}return null}var c_=typeof navigator<`u`&&/linux/i.test(navigator.platform)&&/ Gecko\/\d+/.exec(navigator.userAgent),l_=Og(Bg),u_=Jn.baseTheme({".cm-vimMode .cm-cursorLayer:not(.cm-vimCursorLayer)":{display:`none`},".cm-vim-panel":{padding:`0px 10px`,fontFamily:`monospace`,minHeight:`1.3em`,display:`flex`},".cm-vim-panel input":{border:`none`,outline:`none`,backgroundColor:`inherit`},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`}}),d_=Zn.fromClass(class{constructor(e){this.status=``,this.query=null,this.decorations=Fn.none,this.waitForCopy=!1,this.lastKeydown=``,this.useNextTextInput=!1,this.compositionText=``,this.view=e;let t=this.cm=new Bg(e);l_.enterVimMode(this.cm),this.view.cm=this.cm,this.cm.state.vimPlugin=this,this.blockCursor=new r_(e,t),this.updateClass(),this.cm.on(`vim-command-done`,()=>{t.state.vim&&(t.state.vim.status=``),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on(`vim-mode-change`,e=>{t.state.vim&&(t.state.vim.mode=e.mode,e.subMode&&(t.state.vim.mode+=e.subMode===`linewise`?` line`:` block`),t.state.vim.status=``,this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus())}),this.cm.on(`dialog`,()=>{this.cm.state.statusbar?this.updateStatus():e.dispatch({effects:m_.of(!!this.cm.state.dialog)})}),this.dom=document.createElement(`span`),this.spacer=document.createElement(`span`),this.spacer.style.flex=`1`,this.statusButton=document.createElement(`span`),this.statusButton.onclick=e=>{l_.handleKey(this.cm,`<Esc>`,`user`),this.cm.focus()},this.statusButton.style.cssText=`cursor: pointer`}update(e){if((e.viewportChanged||e.docChanged)&&this.query&&this.highlight(this.query),e.docChanged&&this.cm.onChange(e),e.selectionSet&&this.cm.onSelectionChange(),e.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),e.transactions){for(let t of e.transactions)for(let e of t.effects)if(e.is(gr)){if(!e.value?.forVim)this.highlight(null);else{let t=e.value.create();this.highlight(t)}}}this.blockCursor.update(e)}updateClass(){let e=this.cm.state;!e.vim||e.vim.insertMode&&!e.overwrite?this.view.scrollDOM.classList.remove(`cm-vimMode`):this.view.scrollDOM.classList.add(`cm-vimMode`)}updateStatus(){let e=this.cm.state.statusbar,t=this.cm.state.vim;if(!e||!t)return;let n=this.cm.state.dialog;if(n)n.parentElement!=e&&(e.textContent=``,e.appendChild(n));else{e.textContent=``;var r=(t.mode||`normal`).toUpperCase();t.insertModeReturn&&(r+=`(C-O)`),this.statusButton.textContent=`--${r}--`,e.appendChild(this.statusButton),e.appendChild(this.spacer)}this.dom.textContent=t.status,e.appendChild(this.dom)}destroy(){l_.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(e){if(this.query=e,!e)return this.decorations=Fn.none;let{view:t}=this,n=new Mn;for(let r=0,i=t.visibleRanges,a=i.length;r<a;r++){let{from:o,to:s}=i[r];for(;r<a-1&&s>i[r+1].from-500;)s=i[++r].to;e.highlight(t.state,o,s,(e,t)=>{n.add(e,t,p_)})}return this.decorations=n.finish()}handleKey(e,t){let n=this.cm,r=n.state.vim;if(!r)return;let i=l_.vimKeyFromEvent(e,r);if(Bg.signal(this.cm,`inputEvent`,{type:`handleKey`,key:i}),!i)return;if(i==`<Esc>`&&!r.insertMode&&!r.visualMode&&this.query){let e=r.searchState_;e&&(n.removeOverlay(e.getOverlay()),e.setOverlay(null))}if(i===`<C-c>`&&!Bg.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;r.status=(r.status||``)+i;let a=l_.multiSelectHandleKey(n,i,`user`);return r=l_.maybeInitVimState_(n),!a&&r.insertMode&&n.state.overwrite&&(e.key&&e.key.length==1&&!/\n/.test(e.key)?(a=!0,n.overWriteSelection(e.key)):e.key==`Backspace`&&(a=!0,Bg.commands.cursorCharLeft(n))),a&&(Bg.signal(this.cm,`vim-keypress`,i),e.preventDefault(),e.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!a}},{eventHandlers:{copy:function(e,t){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var e=this.cm,t=e.state.vim;t&&(t.insertMode?e.setSelection(e.getCursor(),e.getCursor()):e.operation(()=>{e.curOp&&(e.curOp.isVimOp=!0),l_.handleKey(e,`<Esc>`,`user`)}))}))},compositionstart:function(e,t){this.useNextTextInput=!0,Bg.signal(this.cm,`inputEvent`,e)},compositionupdate:function(e,t){Bg.signal(this.cm,`inputEvent`,e)},compositionend:function(e,t){Bg.signal(this.cm,`inputEvent`,e)},keypress:function(e,t){Bg.signal(this.cm,`inputEvent`,e),this.lastKeydown==`Dead`&&this.handleKey(e,t)},keydown:function(e,t){Bg.signal(this.cm,`inputEvent`,e),this.lastKeydown=e.key,this.lastKeydown==`Unidentified`||this.lastKeydown==`Process`||this.lastKeydown==`Dead`?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(e,t))}},provide:()=>[Jn.inputHandler.of((e,t,n,r)=>{var i=y_(e);if(!i)return!1;var a=i.state?.vim,o=i.state.vimPlugin;if(a&&!a.insertMode&&!i.curOp?.isVimOp){if(r===`\0\0`)return!0;if(Bg.signal(i,`inputEvent`,{type:`text`,text:r,from:t,to:n}),r.length==1&&o.useNextTextInput){if(a.expectLiteralNext&&e.composing)return o.compositionText=r,!1;if(o.compositionText){var s=o.compositionText;o.compositionText=``;var c=e.state.selection.main.head;if(s===e.state.sliceDoc(c-s.length,c)){var l=i.getCursor();i.replaceRange(``,i.posFromIndex(c-s.length),l)}}return o.handleKey({key:r,preventDefault:()=>{},stopPropagation:()=>{}}),f_(e),!0}}return!1})],decorations:e=>e.decorations});function f_(e){var t=e.scrollDOM.parentElement;if(t){if(c_){e.contentDOM.textContent=`\0\0`,e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`));return}var n=e.scrollDOM.nextSibling,r=window.getSelection(),i=r&&{anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset};e.scrollDOM.remove(),t.insertBefore(e.scrollDOM,n);try{i&&r&&(r.setPosition(i.anchorNode,i.anchorOffset),i.focusNode&&r.extend(i.focusNode,i.focusOffset))}catch(e){console.error(e)}e.focus(),e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`))}}var p_=Fn.mark({class:`cm-searchMatch`}),m_=Cn.define(),h_=cn.define({create:()=>!1,update(e,t){for(let n of t.effects)n.is(m_)&&(e=n.value);return e},provide:e=>Sn.from(e,e=>e?g_:null)});function g_(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.dialog&&t.appendChild(n.state.dialog),{top:!1,dom:t}}function __(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.statusbar=t,n.state.vimPlugin.updateStatus(),{dom:t}}function v_(e={}){return[u_,d_,a_,e.status?Sn.of(__):h_]}function y_(e){return e.cm||null}function b_(e){let t=e.state.selection.main;return t.from===0&&t.to===0}function x_(e,t=!1){let n=e.state.selection.main,r=e.state.doc.length;return t&&n.from===r-1&&n.to===r-1?!0:n.from===r&&n.to===r}function S_(e){e&&e.dispatch({selection:{anchor:e.state.doc.length,head:e.state.doc.length}})}function C_(e){requestAnimationFrame(()=>{let t=e.current?.view;t&&(t.focus(),S_(t))})}function w_(e){let t=e.dom.closest(`.marimo-cell`);t&&requestAnimationFrame(()=>{t.scrollIntoView({behavior:`instant`,block:`nearest`,inline:`nearest`})})}function T_(e){return y_(e)?.state.vim!=null}function E_(e){let t=y_(e)?.state.vim;return t?!t.mode&&!t.insertMode&&!t.visualMode||t.mode===`normal`:!1}function D_(e){e&&e.dispatch({selection:{anchor:0,head:e.state.doc.length}})}var O_=new Set([Q.ClassDefinition]);function k_(e,t){requestAnimationFrame(()=>{e.focus(),e.dispatch({selection:{anchor:t,head:t},effects:Jn.scrollIntoView(t,{y:`center`})})}),w_(e)}function A_(e,t){let n=gn(e),r=null;return n.iterate({enter:n=>{if(r!==null)return!1;if(n.name===Q.VariableName&&e.doc.sliceString(n.from,n.to)===t)return r=n.from,!1;if(n.name===Q.Comment||n.name===Q.String)return!1}}),r}function j_(e,t){let n=[],r=e.resolveInner(t,0);for(;r;)ng.has(r.name)&&(n.some(e=>e.type===Q.FunctionDefinition||e.type===Q.LambdaExpression)&&r.name===Q.ClassDefinition||n.push({id:r.from,type:r.name})),r=r.parent;return n.push({id:-1,type:`global`}),n}function M_(e,t,n){e.push({scopeId:t,from:n})}function N_(e,t){if(e.firstChild())do t(e.node);while(e.nextSibling())}function P_(e,t){let{state:n,variableName:r,scopeId:i,declarations:a}=t;switch(e.name){case Q.VariableName:n.doc.sliceString(e.from,e.to)===r&&M_(a,i,e.from);break;case Q.TupleExpression:case Q.ArrayExpression:{let n=e.node.cursor();n.firstChild();do P_(n,t);while(n.nextSibling());break}}}function F_(e,t){let{state:n,variableName:r,scopeId:i,declarations:a}=t,o=e.cursor();o.firstChild();do{if(o.name!==Q.ParamList)continue;let e=o.node.cursor();e.firstChild();do e.name===Q.VariableName&&n.doc.sliceString(e.from,e.to)===r&&M_(a,i,e.from);while(e.nextSibling())}while(o.nextSibling())}function I_(e,t){let n=e.cursor();n.firstChild();let r=!1;do if(n.name===tg.For)r=!0;else if(r&&n.name===tg.In)break;else r&&P_(n,t);while(n.nextSibling())}function L_(e,t){let{state:n,variableName:r,scopeStack:i,declarations:a}=t,o=e.cursor(),s=o.name,c=o.from,l=ng.has(s)?[...i,c]:i,u=l[l.length-1]??-1;switch(s){case Q.FunctionDefinition:case Q.ClassDefinition:{let t=e.cursor();t.firstChild();do if(t.name===Q.VariableName&&n.doc.sliceString(t.from,t.to)===r){M_(a,i[i.length-1]??-1,t.from);break}while(t.nextSibling());s===Q.FunctionDefinition&&F_(e,{state:n,variableName:r,scopeId:c,declarations:a});break}case Q.LambdaExpression:F_(e,{state:n,variableName:r,scopeId:c,declarations:a});break;case Q.ArrayComprehensionExpression:case Q.DictionaryComprehensionExpression:case Q.SetComprehensionExpression:case Q.ComprehensionExpression:case Q.ForStatement:I_(e,{state:n,variableName:r,scopeId:u,declarations:a});break;case Q.AssignStatement:{let t=[],i=e.cursor();i.firstChild();do i.name===Q.AssignOp&&t.push(i.from);while(i.nextSibling());let o=t[t.length-1];if(o===void 0)break;let s=e.cursor();s.firstChild();do s.from<o&&P_(s,{state:n,variableName:r,scopeId:u,declarations:a});while(s.nextSibling());break}case Q.ImportStatement:{let t=e.cursor();t.firstChild();let i=!1,o=null,s=()=>{o?.matches&&M_(a,u,o.from),o=null};do{if(t.name===tg.Import){i=!0;continue}if(i){if(t.name===tg.As){o=null;continue}t.name===Q.VariableName?(s(),o={from:t.from,matches:n.doc.sliceString(t.from,t.to)===r}):t.name===`,`&&s()}}while(t.nextSibling());s();break}case Q.TryStatement:case Q.WithStatement:{let t=e.cursor();t.firstChild();let i=!1;do t.name===tg.As?i=!0:i&&t.name===Q.VariableName&&n.doc.sliceString(t.from,t.to)===r&&(M_(a,u,t.from),i=!1);while(t.nextSibling());break}}N_(o,e=>{L_(e,{state:n,variableName:r,scopeStack:l,declarations:a})})}function R_(e,t,n){let r=gn(e),i=[];L_(r,{state:e,variableName:t,scopeStack:[],declarations:i});let a=Math.max(0,Math.min(n,e.doc.length));for(let e of j_(r,a)){let t=i.filter(t=>t.scopeId===e.id).filter(t=>!O_.has(e.type)||t.from<=a).toSorted((e,t)=>e.from-t.from)[0];if(t)return t.from}return null}function z_(e,t,n){let{state:r}=e,i=n===void 0?A_(r,t):R_(r,t,n);return i!==null&&(k_(e,i),!0)}function B_(e,t){return k_(e,e.state.doc.line(t).from),!0}function V_(e,t){let n=u.get(re);return(n===`mac`?e.mac??e.key:n===`windows`?e.win??e.key:e.linux??e.key)===t}function H_(e){let{from:t,to:n}=e.selection.main;if(t===n){let{startToken:n,endToken:r}=wg(e.doc,t);return{position:n,word:e.doc.sliceString(n,r)}}return{position:t,word:e.doc.sliceString(t,n)}}function U_(e,t){if(!t)return null;let n=e[t];return!n||n.declaredBy.length===0?null:n.declaredBy[0]}function W_(e){return e.startsWith(`_`)}function G_(e){let{state:t}=e,{position:n,word:r}=H_(t);return r?(Fr(e),e.dispatch({effects:Gn}),J_(e,r,n)):!1}function K_(e,t=u.get(F).getHotkey(`cell.goToDefinition`).key){for(let n of e.state.facet(pn).flat())if(V_(n,t)&&n.run?.(e))return!0;return!1}function q_(e){return G_(e)?!0:K_(e)}function J_(e,t,n){if(n!==void 0&&z_(e,t,n))return!0;let r=X_(e,t);return r?z_(r,t):!1}function Y_(e,t){let n=Z_(e);return n?B_(n,t):!1}function X_(e,t){if(W_(t))return e;let n=U_(u.get(Oh),t);return n?Z_(n):null}function Z_(e){return dN(e)??null}var Q_=o(null);function $_(e){let t=u.get(Q_);if(e===null){u.set(Q_,null);return}(t?.cellId!==e.cellId||t.line!==e.line)&&u.set(Q_,{...e,startedAtMs:Date.now()})}var ev=o(new Map),tv=new Set;function nv(e){return o(t=>{let n=t(Q_);return n?.cellId===e?n.line:null})}function rv(e){return o(t=>{let n=t(Q_);return n?.cellId===e?{line:n.line,startedAtMs:n.startedAtMs}:null})}function iv(e){return o(t=>t(ev).get(e)??tv)}function av(e){let t={};for(let[n,r]of e)r.size>0&&(t[n]=[...r].toSorted((e,t)=>e-t));Hr().sendSetBreakpoints({breakpoints:t}).catch(e=>{R.debug(`Failed to sync breakpoints to kernel`,{error:e})})}function ov(e){let t=u.get(ev);if(!t.has(e))return;let n=new Map(t);n.delete(e),u.set(ev,n),av(n)}function sv(){let e=u.get(ev);e.size>0&&av(e)}function cv(e,t){let n=u.get(ev),r=new Map(n),i=new Set(r.get(e)??[]);i.has(t)?i.delete(t):i.add(t),i.size>0?r.set(e,i):r.delete(e),u.set(ev,r),av(r)}function lv(e,t){if(t==null||t<1||t>e.doc.lines)return Fn.none;let n=new Mn;try{let r=e.doc.line(t);n.add(r.from,r.from,Fn.line({class:`cm-debugger-current-line`}))}catch(e){R.debug(`Invalid debugger line`,{error:e})}return n.finish()}var uv=class{unsubscribe;decorations;constructor(e,t){this.decorations=lv(e.state,t.get()),this.unsubscribe=t.sub(t=>{this.decorations=lv(e.state,t),e.dispatch({userEvent:`marimo.debugger-line-update`})})}update(e){this.decorations=this.decorations.map(e.changes)}destroy(){this.unsubscribe()}};function dv(e){return[Zn.define(t=>new uv(t,e),{decorations:e=>e.decorations}),Jn.theme({".cm-debugger-current-line":{backgroundColor:`color-mix(in srgb, var(--amber-4) 50%, transparent)`}})]}var fv=new class extends Ln{toDOM(){let e=document.createElement(`div`);return e.className=`cm-breakpoint-marker`,e}},pv=Cn.define(),mv=cn.define({create:()=>new Set,update(e,t){for(let e of t.effects)if(e.is(pv))return e.value;return e}});function hv(e){let t=e.field(mv);if(t.size===0)return Nn.empty;let n=new Mn;for(let r of[...t].toSorted((e,t)=>e-t))if(r>=1&&r<=e.doc.lines){let t=e.doc.line(r);n.add(t.from,t.from,fv)}return n.finish()}var gv=class{unsubscribe;constructor(e,t){let n=t=>{e.dispatch({effects:pv.of(t)})};t.get().size>0&&queueMicrotask(()=>n(t.get())),this.unsubscribe=t.sub(n)}destroy(){this.unsubscribe()}};function _v(e,t){return[mv,Zn.define(e=>new gv(e,t)),$n({class:`cm-breakpoint-gutter`,markers:e=>hv(e.state),initialSpacer:()=>fv,domEventHandlers:{mousedown:(t,n)=>{let r=t.state.doc.lineAt(n.from).number;return cv(e,r),!0}}}),Jn.theme({".cm-breakpoint-gutter":{width:`14px`,cursor:`pointer`},".cm-breakpoint-marker":{width:`8px`,height:`8px`,borderRadius:`50%`,backgroundColor:`var(--red-9)`,margin:`4px auto`}})]}var vv=class e{ms;static fromMilliseconds(t){return t==null?null:new e(t)}static fromSeconds(t){return t==null?null:new e(t*1e3)}static now(){return new e(Date.now())}constructor(e){this.ms=e}toMilliseconds(){return this.ms}toSeconds(){return this.ms/1e3}};function yv(e){if(e===null)return``;let t=e,n=t/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${t.toFixed(0).toString()}ms`}var bv=500,xv=250,Sv=class e extends Rn{static intervals=new WeakMap;startedAtMs;constructor(e){super(),this.startedAtMs=e}eq(e){return e.startedAtMs===this.startedAtMs}toDOM(){let t=document.createElement(`span`);t.className=`cm-line-timer`,t.setAttribute(`aria-hidden`,`true`);let n=()=>{let e=Date.now()-this.startedAtMs;t.textContent=e>=bv?yv(e):``};return n(),e.intervals.set(t,window.setInterval(n,xv)),t}destroy(t){let n=e.intervals.get(t);n!==void 0&&(window.clearInterval(n),e.intervals.delete(t))}ignoreEvent(){return!0}};function Cv(e,t){if(t===null||t.line<1||t.line>e.doc.lines)return Fn.none;let n=new Mn;try{let r=e.doc.line(t.line);n.add(r.from,r.from,Fn.line({class:`cm-timing-current-line`})),n.add(r.to,r.to,Fn.widget({widget:new Sv(t.startedAtMs),side:1}))}catch(e){R.debug(`Invalid timing line`,{error:e})}return n.finish()}var wv=class{unsubscribe;decorations;constructor(e,t){this.decorations=Cv(e.state,t.get()),this.unsubscribe=t.sub(t=>{this.decorations=Cv(e.state,t),e.dispatch({userEvent:`marimo.timing-line-update`})})}update(e){this.decorations=this.decorations.map(e.changes)}destroy(){this.unsubscribe()}};function Tv(e){return[Zn.define(t=>new wv(t,e),{decorations:e=>e.decorations}),Jn.theme({".cm-timing-current-line":{backgroundColor:`color-mix(in srgb, var(--grass-4) 50%, transparent)`},".cm-line-timer":{color:`var(--grass-11)`,fontSize:`0.85em`,marginLeft:`1.5ch`,pointerEvents:`none`}})]}function Ev(e,t){if(!t?.length)return Fn.none;let n=new Mn,r=e.facet(Of),i=t.filter(e=>e.kind===`cell`&&e.cellId===r).toSorted((e,t)=>e.lineNumber-t.lineNumber);for(let t of i)try{let r=e.doc.line(t.lineNumber),i=Fn.line({class:`cm-error-line`});n.add(r.from,r.from,i)}catch(e){R.debug(`Invalid line number in error decoration`,{error:e})}return n.finish()}function Dv(e,t){if(!t?.length)return;let n=e.state.facet(Of),r=t.filter(e=>e.kind===`cell`&&e.cellId===n);if(r.length===0)return;let i=Hn(e.state),a=[];for(let t of r)try{let n=e.state.doc.line(t.lineNumber);i.between(n.from,n.to,(e,t)=>{a.push(kn.of({from:e,to:t}))})}catch(e){R.debug(`Invalid line numbers`,{error:e})}a.length>0&&e.dispatch({effects:a})}var Ov=class{unsubscribe;decorations;constructor(e,t){let n=t.get();this.decorations=Ev(e.state,n),Dv(e,n),this.unsubscribe=t.sub(t=>{let n=this.decorations.size;this.decorations=Ev(e.state,t),Dv(e,t),n!==this.decorations.size&&e.dispatch({userEvent:`marimo.error-decoration-update`})})}update(e){this.decorations=this.decorations.map(e.changes)}destroy(){this.unsubscribe()}};function kv(e){return Zn.define(t=>new Ov(t,e),{decorations:e=>e.decorations})}function Av(e){return[kv(e),Jn.theme({".cm-error-line":{backgroundColor:`color-mix(in srgb, var(--red-4) 40%, transparent)`},"&.cm-focused .cm-error-line.cm-activeLine":{backgroundColor:`color-mix(in srgb, var(--red-5) 40%, transparent)`}})]}function jv({cellId:e,hotkeys:t}){let n=[];return n.push(...oe({key:t.getHotkey(`cell.run`).key,preventDefault:!0,stopPropagation:!0,run:e=>(e.state.facet(Df).onRun(),!0)}),{key:t.getHotkey(`cell.runAndNewBelow`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Df);return n.onRun(),e===`__scratch__`||(t.contentDOM.blur(),n.moveToNextCell({cellId:e,before:!1}),!0)}},...oe({key:t.getHotkey(`cell.runAndNewAbove`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Df);return n.onRun(),e===`__scratch__`||(t.contentDOM.blur(),n.moveToNextCell({cellId:e,before:!0}),!0)}}),{key:t.getHotkey(`cell.aiCompletion`).key,preventDefault:!0,stopPropagation:!0,run:e=>(e.state.facet(Df).aiCellCompletion()&&e.contentDOM.focus(),!0)}),e!==`__scratch__`&&n.push({key:t.getHotkey(`cell.goToDefinition`).key,run:e=>G_(e)},{key:t.getHotkey(`cell.delete`).key,preventDefault:!0,stopPropagation:!0,run:e=>(e.state.doc.length===0&&e.state.facet(Df).deleteCell(),!0)},{key:t.getHotkey(`cell.moveUp`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveCell({cellId:e,before:!0}),!0)},{key:t.getHotkey(`cell.moveDown`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveCell({cellId:e,before:!1}),!0)},{key:t.getHotkey(`cell.moveLeft`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveCell({cellId:e,before:!0,direction:`left`}),!0)},{key:t.getHotkey(`cell.moveRight`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveCell({cellId:e,before:!1,direction:`right`}),!0)},{key:`ArrowUp`,run:t=>Nr(t.state)?!1:b_(t)?(t.state.facet(Df).moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0):!1},{key:`ArrowDown`,run:t=>Nr(t.state)?!1:x_(t)?(t.state.facet(Df).moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0):!1},{key:t.getHotkey(`cell.focusDown`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0)},{key:t.getHotkey(`cell.focusUp`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0)},{key:t.getHotkey(`cell.sendToBottom`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).sendToBottom({cellId:e}),!0)},{key:t.getHotkey(`cell.sendToTop`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).sendToTop({cellId:e}),!0)},{key:t.getHotkey(`cell.createAbove`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.contentDOM.blur(),t.state.facet(Df).createNewCell({cellId:e,before:!0}),!0)},{key:t.getHotkey(`cell.createBelow`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.contentDOM.blur(),t.state.facet(Df).createNewCell({cellId:e,before:!1}),!0)},{key:t.getHotkey(`cell.hideCode`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Df).toggleHideCode();return Fr(t),n?(t.contentDOM.blur(),document.getElementById(Li.create(e))?.focus()):t.contentDOM.focus(),!0}},{key:t.getHotkey(`cell.splitCell`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Df);return n.splitCell({cellId:e}),n.moveToNextCell&&requestAnimationFrame(()=>{t.contentDOM.blur(),n.moveToNextCell({cellId:e,before:!1})}),!0}}),[vn.high(pn.of(n))]}function Mv(e){return[Jn.updateListener.of(e=>{if(e.docChanged){let t=e.transactions.some(e=>e.effects.some(e=>e.is(sm))),n=OA(e.view),r=e.view.state.facet(Df),i=e.view.state.facet(Of);r.updateCellCode({cellId:i,code:n,formattingChange:t}),u.get(ah).has(i)&&u.set(oh)}}),Sh(e)]}var Nv=[`input`,`delete`,`undo`,`redo`];function Pv({docChanged:e,transactions:t,predicate:n=()=>!0,hasFocus:r=!1}){return!e||!n()||t.some(e=>e.effects.some(e=>e.is(sm)))?!1:t.some(e=>e.annotation(Yn.remote)||e.annotation(dh)!==void 0?!1:Nv.some(t=>e.isUserEvent(t))||r)}function Fv({predicate:e}){return Jn.updateListener.of(t=>{Pv({docChanged:t.docChanged,transactions:t.transactions,predicate:e,hasFocus:t.view.hasFocus})&&t.view.state.facet(Df).onRun()})}function Iv({cellId:e,hotkeys:t,cellActions:n}){let r=hh(`debugger`),i=hh(`line_timing`);return[Df.of(n),Of.of(e),jv({cellId:e,hotkeys:t}),Mv(t),Av(_h(mN(e),u)),r?_v(e,_h(iv(e),u)):[],i?Tv(_h(rv(e),u)):r?dv(_h(nv(e),u)):[]]}var Lv=Cn.define(),Rv=20;function zv(e){let{state:t,anchor:n,head:r}=e;if(r<n)return!1;let i=t.doc.lineAt(r).number,a=t.doc.lineAt(n).number,o=Math.max(a,i-Rv+1),s=Math.max(n,t.doc.line(o).from),c=s>n,l=+!!c,u=t.doc.iterRange(s,r);for(;;){let{value:e,done:t}=u.next();if(t)break;for(let t of e)if(t===`(`)l++;else if(t===`)`&&(l--,c?l<=0:l<0))return!1}return!0}function Bv(e){return{...e,create:t=>{let{dom:n,...r}=e.create(t),i=document.createElement(`div`);return i.classList.add(`mo-cm-tooltip`),i.append(n),{...r,dom:i}}}}var Vv=cn.define({create:()=>null,update(e,t){for(let e of t.effects)if(e.is(Lv))return e.value;if(!e||t.selection&&!t.docChanged)return null;if(t.docChanged){let n=t.changes.mapPos(e.pos);return zv({state:t.state,anchor:n,head:t.state.selection.main.head})?{...e,pos:n}:null}return e},provide:e=>mn.from(e)});function Hv(e){return e.state.field(Vv,!1)?(e.dispatch({effects:Lv.of(null)}),!0):!1}var Uv=async e=>{let t=e.state.doc.sliceString(0,e.pos),n=document.activeElement,r=null;if(n!==null){let e=Li.findElement(n);e!==null&&(r=Li.parse(e.id))}if(r===null)return R.error(`Failed to find active cell.`),null;let i=await vg.request({document:t,cellId:r});if(!i)return e.view?.dispatch({effects:Lv.of(null)}),null;let a=bg.asHoverTooltip({position:e.pos,message:i,limitToType:`tooltip`});return a&&u.set(eg,{documentation:a.html??null}),e.view?.dispatch({effects:Lv.of(a?Bv(a):null)}),a?null:bg.asCompletionResult(e.pos,i)};function Wv(e){return t=>e.predicate(t.state)?e.completion(t):null}var Gv=async e=>{let t=e.matchBefore(/:\w*$/);if(!e.explicit&&!t)return null;let n=await Kv();return{from:t?.from??e.pos,options:n,validFor:/^[\w:]*$/}},Kv=Or(async()=>{let e=await fetch(`https://unpkg.com/emojilib@3.0.11/dist/emoji-en-US.json`).then(e=>{if(!e.ok)throw Error(`Failed to fetch emoji list`);return e.json()}).catch(()=>({}));return Object.entries(e).map(([e,t])=>({shortcode:t[0],label:t.map(e=>`:${e}`).join(` `),emoji:e,displayLabel:`${e} ${t[0].replaceAll(`_`,` `)}`,apply:e,type:`emoji`}))}),qv=async e=>{let t=e.matchBefore(/::[\w-:]*$/);if(!e.explicit&&!t)return null;let n=await Jv();return{from:t?.from??e.pos,options:n,validFor:/^[\w-:]*$/}},Jv=Or(async()=>{let e=await fetch(`https://unpkg.com/lucide-static@0.452.0/tags.json`).then(e=>{if(!e.ok)throw Error(`Failed to fetch Lucide icon list`);return e.json()}).catch(()=>({})),t=e=>`https://cdn.jsdelivr.net/npm/lucide-static@0.452.0/icons/${e}.svg`;return Object.entries(e).map(([e,n])=>({label:`::${e}`,displayLabel:e,type:`lucide-icon`,boost:10,apply:`::lucide:${e}::`,detail:n.join(`, `),info:()=>{let n=document.createElement(`img`);return n.src=t(e),n.style.width=`24px`,n.style.height=`24px`,n}}))}),Yv=e=>{let t=e.matchBefore(/\\\w*$/);return!e.explicit&&!t?null:{from:t?.from??e.pos,options:Xv(),validFor:/^[\w\\]*$/}},Xv=Or(()=>[[`alpha`,`α`,`Greek small letter alpha`],[`beta`,`β`,`Greek small letter beta`],[`gamma`,`γ`,`Greek small letter gamma`],[`delta`,`δ`,`Greek small letter delta`],[`epsilon`,`ε`,`Greek small letter epsilon`],[`zeta`,`ζ`,`Greek small letter zeta`],[`eta`,`η`,`Greek small letter eta`],[`theta`,`θ`,`Greek small letter theta`],[`iota`,`ι`,`Greek small letter iota`],[`kappa`,`κ`,`Greek small letter kappa`],[`lambda`,`λ`,`Greek small letter lambda`],[`mu`,`μ`,`Greek small letter mu`],[`nu`,`ν`,`Greek small letter nu`],[`xi`,`ξ`,`Greek small letter xi`],[`omicron`,`ο`,`Greek small letter omicron`],[`pi`,`π`,`Greek small letter pi`],[`rho`,`ρ`,`Greek small letter rho`],[`sigma`,`σ`,`Greek small letter sigma`],[`tau`,`τ`,`Greek small letter tau`],[`upsilon`,`υ`,`Greek small letter upsilon`],[`phi`,`φ`,`Greek small letter phi`],[`chi`,`χ`,`Greek small letter chi`],[`psi`,`ψ`,`Greek small letter psi`],[`omega`,`ω`,`Greek small letter omega`],[`Gamma`,`Γ`,`Greek capital letter gamma`],[`Delta`,`Δ`,`Greek capital letter delta`],[`Theta`,`Θ`,`Greek capital letter theta`],[`Lambda`,`Λ`,`Greek capital letter lambda`],[`Xi`,`Ξ`,`Greek capital letter xi`],[`Pi`,`Π`,`Greek capital letter pi`],[`Sigma`,`Σ`,`Greek capital letter sigma`],[`Phi`,`Φ`,`Greek capital letter phi`],[`Psi`,`Ψ`,`Greek capital letter psi`],[`Omega`,`Ω`,`Greek capital letter omega`],[`pm`,`±`,`Plus-minus sign`],[`mp`,`∓`,`Minus-plus sign`],[`times`,`×`,`Multiplication sign`],[`div`,`÷`,`Division sign`],[`cdot`,`⋅`,`Dot operator`],[`ast`,`∗`,`Asterisk operator`],[`star`,`⋆`,`Star operator`],[`circ`,`∘`,`Ring operator`],[`bullet`,`•`,`Bullet`],[`cap`,`∩`,`Intersection`],[`cup`,`∪`,`Union`],[`uplus`,`⊎`,`Multiset union`],[`sqcap`,`⊓`,`Square cap`],[`sqcup`,`⊔`,`Square cup`],[`vee`,`∨`,`Logical or`],[`wedge`,`∧`,`Logical and`],[`setminus`,`∖`,`Set minus`],[`oplus`,`⊕`,`Circled plus`],[`ominus`,`⊖`,`Circled minus`],[`otimes`,`⊗`,`Circled times`],[`oslash`,`⊘`,`Circled division slash`],[`odot`,`⊙`,`Circled dot operator`],[`leq`,`≤`,`Less than or equal to`],[`geq`,`≥`,`Greater than or equal to`],[`equiv`,`≡`,`Identical to`],[`prec`,`≺`,`Precedes`],[`succ`,`≻`,`Succeeds`],[`sim`,`∼`,`Tilde operator`],[`perp`,`⊥`,`Up tack`],[`mid`,`∣`,`Divides`],[`parallel`,`∥`,`Parallel to`],[`subset`,`⊂`,`Subset of`],[`supset`,`⊃`,`Superset of`],[`subseteq`,`⊆`,`Subset of or equal to`],[`supseteq`,`⊇`,`Superset of or equal to`],[`cong`,`≅`,`Approximately equal to`],[`approx`,`≈`,`Almost equal to`],[`neq`,`≠`,`Not equal to`],[`ne`,`≠`,`Not equal to`],[`propto`,`∝`,`Proportional to`],[`leftarrow`,`←`,`Leftward arrow`],[`rightarrow`,`→`,`Rightward arrow`],[`Leftarrow`,`⇐`,`Leftward double arrow`],[`Rightarrow`,`⇒`,`Rightward double arrow`],[`leftrightarrow`,`↔`,`Left right arrow`],[`Leftrightarrow`,`⇔`,`Left right double arrow`],[`uparrow`,`↑`,`Upward arrow`],[`downarrow`,`↓`,`Downward arrow`],[`Uparrow`,`⇑`,`Upward double arrow`],[`Downarrow`,`⇓`,`Downward double arrow`],[`infty`,`∞`,`Infinity`],[`nabla`,`∇`,`Nabla`],[`partial`,`∂`,`Partial differential`],[`forall`,`∀`,`For all`],[`exists`,`∃`,`There exists`],[`nexists`,`∄`,`There does not exist`],[`emptyset`,`∅`,`Empty set`],[`in`,`∈`,`Element of`],[`notin`,`∉`,`Not an element of`],[`sum`,`∑`,`N-ary summation`],[`prod`,`∏`,`N-ary product`],[`int`,`∫`,`Integral`],[`oint`,`∮`,`Contour integral`],[`sqrt`,`√`,`Square root`],[`hbar`,`ℏ`,`Planck constant over 2pi`],[`ldots`,`…`,`Horizontal ellipsis`],[`cdots`,`⋯`,`Midline horizontal ellipsis`],[`vdots`,`⋮`,`Vertical ellipsis`],[`ddots`,`⋱`,`Down right diagonal ellipsis`]].map(([e,t,n])=>({label:`\\${e} ${n}`,displayLabel:e,type:`latex-symbol`,boost:10,apply:`\\${e}`,info:()=>{let e=document.createElement(`div`);return e.textContent=`${t} ${n}`,e},detail:t}))),Zv=[Gv,qv,Yv],Qv=100;function $v(e){return!e.state.selection.main.empty}function ey({view:e,selection:t,markup:n}){let r=[],i=!0;for(let r=t.from;r<=t.to;r++)if(!e.state.doc.lineAt(r).text.startsWith(n)){i=!1;break}for(let a=t.from;a<=t.to;){let t=e.state.doc.lineAt(a),o=t.text.startsWith(n);i?r.push({from:t.from,to:t.from+n.length,insert:zn.of([``])}):(o&&r.push({from:t.from,to:t.from+n.length,insert:zn.of([``])}),r.push({from:t.from,insert:zn.of([n])})),a=t.to+1}return r}function ty({view:e,range:t,markupAfter:n,markupBefore:r}){if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}let i=e.state.sliceDoc(t.from-r.length,t.from)===r,a=e.state.sliceDoc(t.to,t.to+n.length)===n,o=[];o.push(i?{from:t.from-r.length,to:t.from,insert:zn.of([``])}:{from:t.from,insert:zn.of(r.split(`
79
+ `);if(r.maybeReset&&=(r.changes=[],!1),o){if(e.state.overwrite&&!/\n/.test(o))r.changes.push([o]);else{if(o.length>1){var s=i&&i.insertEnd&&i.insertEnd.find(),c=e.getCursor();if(s&&s.line==c.line){var l=s.ch-c.ch;l>0&&l<o.length&&(r.changes.push([o,l]),o=``)}}o&&r.changes.push(o)}}}t=t.next}}function an(e){var t=e.state.vim;if(t.insertMode){var n=P.macroModeState;if(n.isPlaying)return;var r=n.lastInsertModeChanges;r.expectCursorActivityForChange?r.expectCursorActivityForChange=!1:(r.maybeReset=!0,t.insertEnd&&t.insertEnd.clear(),t.insertEnd=e.setBookmark(e.getCursor(),{insertLeft:!0}))}else e.curOp?.isVimOp||on(e,t)}function on(t,n){var r=t.getCursor(`anchor`),i=t.getCursor(`head`);if(n.visualMode&&!t.somethingSelected()?Je(t,!1):!n.visualMode&&!n.insertMode&&t.somethingSelected()&&(n.visualMode=!0,n.visualLine=!1,e.signal(t,`vim-mode-change`,{mode:`visual`})),n.visualMode){var a=je(i,r)?0:-1,o=je(i,r)?-1:0;i=we(i,0,a),r=we(r,0,o),n.sel={anchor:r,head:i},ut(t,n,`<`,Me(i,r)),ut(t,n,`>`,Ne(i,r))}else n.insertMode||(n.lastHPos=t.getCursor().ch)}function sn(t){var n=P.macroModeState.lastInsertModeChanges,r=e.keyName?e.keyName(t):t.key;r&&(r.indexOf(`Delete`)!=-1||r.indexOf(`Backspace`)!=-1)&&(n.maybeReset&&=(n.changes=[],!1),n.changes.push(new te(r,t)))}function W(e,t,n,r){var i=P.macroModeState;i.isPlaying=!0;var a=t.lastEditActionCommand,o=t.inputState;function s(){a?V.processAction(e,t,a):V.evalInput(e,t)}function c(n){if(i.lastInsertModeChanges.changes.length>0){n=t.lastEditActionCommand?n:1;var r=i.lastInsertModeChanges;ln(e,r.changes,n)}}if(t.inputState=t.lastEditInputState,a&&a.interlaceInsertRepeat)for(var l=0;l<n;l++)s(),c(1);else r||s(),c(n);t.inputState=o,t.insertMode&&!r&&Jt(e),i.isPlaying=!1}function cn(t,n){e.lookupKey(n,`vim-insert`,function(n){return typeof n==`string`?e.commands[n](t):n(t),!0})}function ln(e,t,n){var r=e.getCursor(`head`),i=P.macroModeState.lastInsertModeChanges.visualBlock;i&&(Be(e,r,i+1),n=e.listSelections().length,e.setCursor(r));for(var a=0;a<n;a++){i&&e.setCursor(we(r,a,0));for(var o=0;o<t.length;o++){var s=t[o];if(s instanceof te)cn(e,s.keyName);else if(typeof s==`string`)e.replaceSelection(s);else{var c=e.getCursor(),l=we(c,0,s[0].length-(s[1]||0));e.replaceRange(s[0],c,s[1]?c:l),e.setCursor(l)}}}i&&e.setCursor(we(r,0,1))}function un(e){var t=new e.constructor;return Object.keys(e).forEach(function(n){if(n!=`insertEnd`){var r=e[n];Array.isArray(r)?r=r.slice():r&&typeof r==`object`&&r.constructor!=Object&&(r=un(r)),t[n]=r}}),e.sel&&(t.sel={head:e.sel.head&&ke(e.sel.head),anchor:e.sel.anchor&&ke(e.sel.anchor)}),t}function dn(e,t,n){var r=N(e),i=e,a=!1,r=re.maybeInitVimState_(i),o=r.visualBlock||r.wasInVisualBlock;if(i.state.closeVimNotification){var s=i.state.closeVimNotification;if(i.state.closeVimNotification=null,s(),t==`<CR>`)return B(i),!0}var c=i.isInMultiSelectMode();if(r.wasInVisualBlock&&!c?r.wasInVisualBlock=!1:c&&r.visualBlock&&(r.wasInVisualBlock=!0),t==`<Esc>`&&!r.insertMode&&!r.visualMode&&c&&r.status==`<Esc>`)B(i);else if(o||!c||i.inVirtualSelectionMode)a=re.handleKey(i,t,n);else{var l=un(r),u=r.inputState.changeQueueList||[];i.operation(function(){i.curOp&&(i.curOp.isVimOp=!0);var e=0;i.forEachSelection(function(){i.state.vim.inputState.changeQueue=u[e];var r=i.getCursor(`head`),o=i.getCursor(`anchor`),s=je(r,o)?0:-1,c=je(r,o)?-1:0;r=we(r,0,s),o=we(o,0,c),i.state.vim.sel.head=r,i.state.vim.sel.anchor=o,a=re.handleKey(i,t,n),i.virtualSelection&&(u[e]=i.state.vim.inputState.changeQueue,i.state.vim=un(l)),e++}),i.curOp?.cursorActivity&&!a&&(i.curOp.cursorActivity=!1),i.state.vim=r,r.inputState.changeQueueList=u,r.inputState.changeQueue=null},!0)}return a&&!r.visualMode&&!r.insertMode&&r.visualMode!=i.somethingSelected()&&on(i,r),a}return ee(),re}function Mg(e,t){var n=t.ch,r=t.line+1;r<1&&(r=1,n=0),r>e.lines&&(r=e.lines,n=Number.MAX_VALUE);var i=e.line(r);return Math.min(i.from+Math.max(0,n),i.to)}function Ng(e,t){let n=e.lineAt(t);return{line:n.number-1,ch:t-n.from}}var Pg=class{constructor(e,t){this.line=e,this.ch=t}};function Fg(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else{var r=e._handlers||={};r[t]=(r[t]||[]).concat(n)}}function Ig(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else{var r=e._handlers,i=r&&r[t];if(i){var a=i.indexOf(n);a>-1&&(r[t]=i.slice(0,a).concat(i.slice(a+1)))}}}function Lg(e,t,...n){var r=e._handlers?.[t];if(r)for(var i=0;i<r.length;++i)r[i](...n)}function Rg(e,...t){if(e)for(var n=0;n<e.length;++n)e[n](...t)}var zg;try{zg=RegExp(`[\\w\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{zg=/[\w]/}function Bg(e,t){var n=e.cm6;if(!n.state.readOnly){var r=`input.type.compose`;if(e.curOp&&(e.curOp.lastChange||(r=`input.type.compose.start`)),t.annotations)try{t.annotations.some(function(e){e.value==`input`&&(e.value=r)})}catch(e){console.error(e)}else t.userEvent=r;return n.dispatch(t)}}function Vg(e,t){e.curOp&&(e.curOp.$changeStart=void 0),(t?rr:fr)(e.cm6);let n=e.curOp?.$changeStart;n!=null&&e.cm6.dispatch({selection:{anchor:n}})}var Hg={Left:e=>xn(e.cm6,{key:`Left`},`editor`),Right:e=>xn(e.cm6,{key:`Right`},`editor`),Up:e=>xn(e.cm6,{key:`Up`},`editor`),Down:e=>xn(e.cm6,{key:`Down`},`editor`),Backspace:e=>xn(e.cm6,{key:`Backspace`},`editor`),Delete:e=>xn(e.cm6,{key:`Delete`},`editor`)},Ug=class e{openDialog(e,t,n){return Yg(this,e,t,n)}openNotification(e,t){return Kg(this,e,t)}constructor(e){this.state={},this.marks=Object.create(null),this.$mid=0,this.options={},this._handlers={},this.$lastChangeEndOffset=0,this.virtualSelection=null,this.cm6=e,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this)}on(e,t){Fg(this,e,t)}off(e,t){Ig(this,e,t)}signal(e,t,n){Lg(this,e,t,n)}indexFromPos(e){return Mg(this.cm6.state.doc,e)}posFromIndex(e){return Ng(this.cm6.state.doc,e)}foldCode(e){let t=this.cm6,n=t.state.selection.ranges,r=this.cm6.state.doc,i=Mg(r,e),a=An.create([An.range(i,i)],0).ranges;t.state.selection.ranges=a,dn(t),t.state.selection.ranges=n}firstLine(){return 0}lastLine(){return this.cm6.state.doc.lines-1}lineCount(){return this.cm6.state.doc.lines}setCursor(e,t){typeof e==`object`&&(t=e.ch,e=e.line);var n=Mg(this.cm6.state.doc,{line:e,ch:t||0});this.cm6.dispatch({selection:{anchor:n}},{scrollIntoView:!this.curOp}),this.curOp&&!this.curOp.isVimOp&&this.onBeforeEndOperation()}getCursor(e){var t=this.cm6.state.selection.main,n=e==`head`||!e?t.head:e==`anchor`?t.anchor:e==`start`?t.from:e==`end`?t.to:null;if(n==null)throw Error(`Invalid cursor type`);return this.posFromIndex(n)}listSelections(){var e=this.cm6.state.doc;return this.cm6.state.selection.ranges.map(t=>({anchor:Ng(e,t.anchor),head:Ng(e,t.head)}))}setSelections(e,t){var n=this.cm6.state.doc,r=e.map(e=>{var t=Mg(n,e.head),r=Mg(n,e.anchor);return t==r?An.cursor(t,1):An.range(r,t)});this.cm6.dispatch({selection:An.create(r,t)})}setSelection(e,t,n){this.setSelections([{anchor:e,head:t}],0),n&&n.origin==`*mouse`&&this.onBeforeEndOperation()}getLine(e){var t=this.cm6.state.doc;return e<0||e>=t.lines?``:this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||=[],{row:e,index:this.indexFromPos(new Pg(e,0))}}getLineNumber(e){var t=this.$lineHandleChanges;if(!t)return null;for(var n=e.index,r=0;r<t.length;r++)if(n=t[r].changes.mapPos(n,1,qn.TrackAfter),n==null)return null;var i=this.posFromIndex(n);return i.ch==0?i.line:null}releaseLineHandles(){this.$lineHandleChanges=void 0}getRange(e,t){var n=this.cm6.state.doc;return this.cm6.state.sliceDoc(Mg(n,e),Mg(n,t))}replaceRange(e,t,n,r){n||=t;var i=this.cm6.state.doc,a=Mg(i,t),o=Mg(i,n);Bg(this,{changes:{from:a,to:o,insert:e}})}replaceSelection(e){Bg(this,this.cm6.state.replaceSelection(e))}replaceSelections(e){var t=this.cm6.state.selection.ranges.map((t,n)=>({from:t.from,to:t.to,insert:e[n]||``}));Bg(this,{changes:t})}getSelection(){return this.getSelections().join(`
80
+ `)}getSelections(){var e=this.cm6;return e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(e=>!e.empty)}getInputField(){return this.cm6.contentDOM}clipPos(e){var t=this.cm6.state.doc,n=e.ch,r=e.line+1;r<1&&(r=1,n=0),r>t.lines&&(r=t.lines,n=Number.MAX_VALUE);var i=t.line(r);return n=Math.min(Math.max(0,n),i.to-i.from),new Pg(r-1,n)}getValue(){return this.cm6.state.doc.toString()}setValue(e){var t=this.cm6;return t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e},selection:An.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(e,t){var n=this.cm6.state,r=Mg(n.doc,e),i=er(n,r+1,-1);return i&&i.end||(i=er(n,r,1),i&&i.end)?{to:Ng(n.doc,i.end.from)}:{to:void 0}}scanForBracket(e,t,n,r){return Qg(this,e,t,n,r)}indentLine(e,t){t?this.indentMore():this.indentLess()}indentMore(){or(this.cm6)}indentLess(){cr(this.cm6)}execCommand(t){if(e.commands.hasOwnProperty(t))e.commands[t](this);else if(t==`goLineLeft`)lr(this.cm6);else if(t==`goLineRight`){br(this.cm6);let e=this.cm6.state,t=e.selection.main.head;t<e.doc.length&&e.sliceDoc(t,t+1)!==`
81
+ `&&mr(this.cm6)}else console.log(t+` is not implemented`)}setBookmark(e,t){var n=t?.insertLeft?1:-1,r=this.indexFromPos(e);return new n_(this,r,n)}addOverlay({query:e}){let t=new hr({regexp:!0,search:e.source,caseSensitive:!/i/.test(e.flags)});if(t.valid){t.forVim=!0,this.cm6Query=t;let e=gr.of(t);return this.cm6.dispatch({effects:e}),t}}removeOverlay(e){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let t=gr.of(this.cm6Query);this.cm6.dispatch({effects:t})}getSearchCursor(e,t){var n=this,r=null,i=null,a=!1;t.ch??=Number.MAX_VALUE;var o=Mg(n.cm6.state.doc,t),s=e.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,function(e,t){return t||`\\`+e});function c(t,n=0,r=t.length){return new vr(t,s,{ignoreCase:e.ignoreCase},n,r)}function l(e){var t=n.cm6.state.doc;if(e>t.length)return null;let r=c(t,e).next();return r.done?null:r.value}var u=1e4;function d(e,t){var r=n.cm6.state.doc;for(let n=1;;n++){let i=Math.max(e,t-n*u),a=c(r,i,t),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==e||o.from>i+10))return o;if(i==e)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){var t=n.cm6.state.doc;return r=e?d(0,r?a?r.to-1:r.from:o):l(r?a?r.to+1:r.to:o),i=r&&{from:Ng(t,r.from),to:Ng(t,r.to),match:r.match},a=r?r.from==r.to:!1,r&&r.match},from:function(){return i?.from},to:function(){return i?.to},replace:function(e){r&&(Bg(n,{changes:{from:r.from,to:r.to,insert:e}}),r.to=r.from+e.length,i&&(i.to=Ng(n.cm6.state.doc,r.to)))},get match(){return i&&i.match}}}findPosV(e,t,n,r){let{cm6:i}=this,a=i.state.doc,o=n==`page`?i.dom.clientHeight:0,s=Mg(a,e),c=An.cursor(s,1,void 0,r),l=Math.round(Math.abs(t));for(let e=0;e<l;e++)n==`page`?c=i.moveVertically(c,t>0,o):n==`line`&&(c=i.moveVertically(c,t>0));let u=Ng(a,c.head);return(t<0&&c.head==0&&r!=0&&e.line==0&&e.ch!=0||t>0&&c.head==a.length&&u.ch!=r&&e.line==u.line)&&(u.hitSide=!0),u}charCoords(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=Mg(this.cm6.state.doc,e),i=this.cm6.coordsAtPos(r),a=-n.top;return{left:(i?.left||0)-n.left,top:(i?.top||0)+a,bottom:(i?.bottom||0)+a}}coordsChar(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=this.cm6.posAtCoords({x:e.left+n.left,y:e.top+n.top})||0;return Ng(this.cm6.state.doc,r)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,t){e!=null&&(this.cm6.scrollDOM.scrollLeft=e),t!=null&&(this.cm6.scrollDOM.scrollTop=t)}scrollIntoView(e,t){if(e){var n=this.indexFromPos(e);this.cm6.dispatch({effects:Jn.scrollIntoView(n)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:`scroll`})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption(`mode`)}}setSize(e,t){this.cm6.dom.style.width=e+4+`px`,this.cm6.dom.style.height=t+`px`,this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){this.$lineHandleChanges&&this.$lineHandleChanges.push(e);for(let t in this.marks)this.marks[t].update(e.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(t=>t.map(e.changes)));var t=this.curOp=this.curOp||{};e.changes.iterChanges((e,n,r,i,a)=>{(t.$changeStart==null||t.$changeStart>r)&&(t.$changeStart=r),this.$lastChangeEndOffset=i;var o={text:a.toJSON()};t.lastChange?t.lastChange.next=t.lastChange=o:t.lastChange=t.change=o},!0),t.changeHandlers||=this._handlers.change&&this._handlers.change.slice()}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice(),this.curOp.cursorActivity=!0}operation(e,t){this.curOp||={$d:0},this.curOp.$d++;try{var n=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return n}onBeforeEndOperation(){var e=this.curOp,t=!1;e&&(e.change&&Rg(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(Rg(e.cursorActivityHandlers,this,null),e.isVimOp&&(t=!0)),this.curOp=null),t&&this.scrollIntoView()}moveH(e,t){if(t==`char`){var n=this.getCursor();this.setCursor(n.line,n.ch+e)}}setOption(e,t){switch(e){case`keyMap`:this.state.keyMap=t;break;case`textwidth`:this.state.textwidth=t}}getOption(e){switch(e){case`firstLineNumber`:return 1;case`tabSize`:return this.cm6.state.tabSize||4;case`readOnly`:return this.cm6.state.readOnly;case`indentWithTabs`:return this.cm6.state.facet(_n)==` `;case`indentUnit`:return this.cm6.state.facet(_n).length||2;case`textwidth`:return this.state.textwidth;case`keyMap`:return this.state.keyMap||`vim`}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(e){var t=this.indexFromPos(e),n=(In(this.cm6.state,t)?.resolve(t))?.type?.name||``;return/comment/i.test(n)?`comment`:/string/i.test(n)?`string`:``}overWriteSelection(e){var t=this.cm6.state.doc,n=this.cm6.state.selection,r=n.ranges.map(e=>{if(e.empty){var n=e.to<t.length?t.sliceString(e.from,e.to+1):``;if(n&&!/\n/.test(n))return An.range(e.from,e.to+1)}return e});this.cm6.dispatch({selection:An.create(r,n.mainIndex)}),this.replaceSelection(e)}isInMultiSelectMode(){return this.cm6.state.selection.ranges.length>1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(e){var t=this.cm6.state.selection;this.virtualSelection=An.create(t.ranges,t.mainIndex);for(var n=0;n<this.virtualSelection.ranges.length;n++){var r=this.virtualSelection.ranges[n];r&&(this.cm6.dispatch({selection:An.create([r])}),e(),this.virtualSelection.ranges[n]=this.cm6.state.selection.ranges[0])}this.cm6.dispatch({selection:this.virtualSelection}),this.virtualSelection=null}hardWrap(e){return r_(this,e)}};Ug.isMac=typeof navigator<`u`&&/Mac/.test(navigator.platform),Ug.Pos=Pg,Ug.StringStream=Wn,Ug.commands={toggleLineComment:function(e){xr(e.cm6)},cursorCharLeft:function(e){dr(e.cm6)},redo:function(e){Vg(e,!1)},undo:function(e){Vg(e,!0)},newlineAndIndent:function(e){pr({state:e.cm6.state,dispatch:t=>Bg(e,t)})},indentAuto:function(e){ar(e.cm6)},newlineAndIndentContinueComment:void 0,save:void 0},Ug.isWordChar=function(e){return zg.test(e)},Ug.keys=Hg,Ug.addClass=function(e,t){},Ug.rmClass=function(e,t){},Ug.e_preventDefault=function(e){e.preventDefault()},Ug.e_stop=function(e){var t,n;(t=e?.stopPropagation)==null||t.call(e),(n=e?.preventDefault)==null||n.call(e)},Ug.lookupKey=function(e,t,n){var r=Ug.keys[e];!r&&/^Arrow/.test(e)&&(r=Ug.keys[e.slice(5)]),r&&n(r)},Ug.on=Fg,Ug.off=Ig,Ug.signal=Lg,Ug.findMatchingTag=$g,Ug.findEnclosingTag=e_,Ug.keyName=void 0;function Wg(e,t,n){var r=document.createElement(`div`);return r.appendChild(t),r}function Gg(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}function Kg(e,t,n){Gg(e,s);var r=Wg(e,t,n&&n.bottom),i=!1,a,o=n&&n.duration!==void 0?n.duration:5e3;function s(){i||(i=!0,clearTimeout(a),r.remove(),Jg(e,r))}return r.onclick=function(e){e.preventDefault(),s()},qg(e,r),o&&(a=setTimeout(s,o)),s}function qg(e,t){var n=e.state.dialog;e.state.dialog=t,t.style.flex=`1`,t&&n!==t&&(n&&n.contains(document.activeElement)&&e.focus(),n&&n.parentElement?n.parentElement.replaceChild(t,n):n&&n.remove(),Ug.signal(e,`dialog`))}function Jg(e,t){e.state.dialog==t&&(e.state.dialog=null,Ug.signal(e,`dialog`))}function Yg(e,t,n,r){r||={},Gg(e,void 0);var i=Wg(e,t,r.bottom),a=!1;qg(e,i);function o(t){if(typeof t==`string`)s.value=t;else{if(a)return;a=!0,Jg(e,i),e.state.dialog||e.focus(),r.onClose&&r.onClose(i)}}var s=i.getElementsByTagName(`input`)[0];return s&&(r.value&&(s.value=r.value,r.selectValueOnOpen!==!1&&s.select()),r.onInput&&Ug.on(s,`input`,function(e){r.onInput(e,s.value,o)}),r.onKeyUp&&Ug.on(s,`keyup`,function(e){r.onKeyUp(e,s.value,o)}),Ug.on(s,`keydown`,function(e){r&&r.onKeyDown&&r.onKeyDown(e,s.value,o)||(e.keyCode==13&&n&&n(s.value),(e.keyCode==27||r.closeOnEnter!==!1&&e.keyCode==13)&&(s.blur(),Ug.e_stop(e),o()))}),r.closeOnBlur!==!1&&Ug.on(s,`blur`,function(){setTimeout(function(){document.activeElement!==s&&o()})}),s.focus()),o}var Xg={"(":`)>`,")":`(<`,"[":`]>`,"]":`[<`,"{":`}>`,"}":`{<`,"<":`>>`,">":`<<`};function Zg(e){return e&&e.bracketRegex||/[(){}[\]]/}function Qg(e,t,n,r,i){for(var a=i&&i.maxScanLineLength||1e4,o=i&&i.maxScanLines||1e3,s=[],c=Zg(i),l=n>0?Math.min(t.line+o,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-o),u=t.line;u!=l;u+=n){var d=e.getLine(u);if(d){var f=n>0?0:d.length-1,p=n>0?d.length:-1;if(!(d.length>a))for(u==t.line&&(f=t.ch-+(n<0));f!=p;f+=n){var m=d.charAt(f);if(c.test(m)){var h=Xg[m];if(h&&h.charAt(1)==`>`==n>0)s.push(m);else if(s.length)s.pop();else return{pos:new Pg(u,f),ch:m}}}}}return u-n!=(n>0?e.lastLine():e.firstLine())&&null}function $g(e,t){return null}function e_(e,t){var n=e.cm6.state,r=e.indexFromPos(t);r<n.doc.length&&n.sliceDoc(r,r+1)==`<`&&r++;for(var i=In(n,r)?.resolve(r)||null;i;){if(i.firstChild?.type.name==`OpenTag`&&i.lastChild?.type.name==`CloseTag`)return{open:t_(n.doc,i.firstChild),close:t_(n.doc,i.lastChild)};i=i.parent}}function t_(e,t){return{from:Ng(e,t.from),to:Ng(e,t.to)}}var n_=class{constructor(e,t,n){this.cm=e,this.id=e.$mid++,this.offset=t,this.assoc=n,e.marks[this.id]=this}clear(){delete this.cm.marks[this.id]}find(){return this.offset==null?null:this.cm.posFromIndex(this.offset)}update(e){this.offset!=null&&(this.offset=e.mapPos(this.offset,this.assoc,qn.TrackDel))}};function r_(e,t){for(var n=t.column||e.getOption(`textwidth`)||80,r=t.allowMerge!=0,i=Math.min(t.from,t.to),a=Math.max(t.from,t.to);i<=a;){var o=e.getLine(i);if(o.length>n){var s=p(o,n,5);if(s){var c=/^\s*/.exec(o)?.[0];e.replaceRange(`
82
+ `+c,new Pg(i,s.start),new Pg(i,s.end))}a++}else if(r&&/\S/.test(o)&&i!=a){var l=e.getLine(i+1);if(l&&/\S/.test(l)){var u=o.replace(/\s+$/,``),d=l.replace(/^\s+/,``),f=u+` `+d,s=p(f,n,5);s&&s.start>u.length||f.length<n?(e.replaceRange(` `,new Pg(i,u.length),new Pg(i+1,l.length-d.length)),i--,a--):u.length<o.length&&e.replaceRange(``,new Pg(i,u.length),new Pg(i,o.length))}}i++}return i;function p(e,t,n){if(!(e.length<t)){var r=e.slice(0,t),i=e.slice(t),a=/^(?:(\s+)|(\S+)(\s+))/.exec(i),o=/(?:(\s+)|(\s+)(\S+))$/.exec(r),s=0,c=0;if(o&&!o[2]&&(s=t-o[1].length,c=t),a&&!a[2]&&(s||=t,c=t+a[1].length),s)return{start:s,end:c};if(o&&o[2]&&o.index>n)return{start:o.index,end:o.index+o[2].length};if(a&&a[2])return s=t+a[2].length,{start:s,end:s+a[3].length}}}}var i_=Qn||function(){let e={cursorBlinkRate:1200};return function(){return e}}(),a_=class{constructor(e,t,n,r,i,a,o,s,c,l){this.left=e,this.top=t,this.height=n,this.fontFamily=r,this.fontSize=i,this.fontWeight=a,this.color=o,this.className=s,this.letter=c,this.partial=l}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,e.style.height=this.height+`px`,e.style.lineHeight=this.height+`px`,e.style.fontFamily=this.fontFamily,e.style.fontSize=this.fontSize,e.style.fontWeight=this.fontWeight,e.style.color=this.partial?`transparent`:this.color,e.className=this.className,e.textContent=this.letter}eq(e){return this.left==e.left&&this.top==e.top&&this.height==e.height&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.fontWeight==e.fontWeight&&this.color==e.color&&this.className==e.className&&this.letter==e.letter}},o_=class{constructor(e,t){this.view=e,this.rangePieces=[],this.cursors=[],this.cm=t,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=e.scrollDOM.appendChild(document.createElement(`div`)),this.cursorLayer.className=`cm-cursorLayer cm-vimCursorLayer`,this.cursorLayer.setAttribute(`aria-hidden`,`true`),e.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){let e=i_(this.cm.cm6.state).cursorBlinkRate;this.cursorLayer.style.animationDuration=e+`ms`}update(e){(e.selectionSet||e.geometryChanged||e.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName=this.cursorLayer.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`),s_(e)&&this.setBlinkRate()}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:e}=this.view,t=[];for(let n of e.selection.ranges){let r=n==e.selection.main,i=u_(this.cm,this.view,n,r);i&&t.push(i)}return{cursors:t}}drawSel({cursors:e}){if(e.length!=this.cursors.length||e.some((e,t)=>!e.eq(this.cursors[t]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent=``;for(let t of e)this.cursorLayer.appendChild(t.draw())}else e.forEach((e,n)=>e.adjust(t[n]));this.cursors=e}}destroy(){this.cursorLayer.remove()}};function s_(e){return i_(e.startState)!=i_(e.state)}var c_=vn.highest(Jn.theme({".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:`transparent !important`},"&::selection":{backgroundColor:`transparent !important`},caretColor:`transparent !important`},".cm-fat-cursor":{position:`absolute`,background:`#ff9696`,border:`none`,whiteSpace:`pre`},"&:not(.cm-focused) .cm-fat-cursor":{background:`none`,outline:`solid 1px #ff9696`,color:`transparent !important`}}));function l_(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Un.LTR?t.left:t.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function u_(e,t,n,r){var i;let a=n.head,o=!1,s=1,c=e.state.vim;if(c&&(!c.insertMode||e.state.overwrite)){if(o=!0,c.visualBlock&&!r)return null;n.anchor<n.head&&(a<t.state.doc.length&&t.state.sliceDoc(a,a+1))!=`
83
+ `&&a--,e.state.overwrite?s=.2:c.status&&(s=.5)}if(o){let e=a<t.state.doc.length&&t.state.sliceDoc(a,a+1);e&&/[\uDC00-\uDFFF]/.test(e)&&a>1&&(a--,e=t.state.sliceDoc(a,a+1));let n=t.coordsAtPos(a,1);if(!n)return null;let o=l_(t),c=t.domAtPos(a),u=c?c.node:t.contentDOM;for(u instanceof Text&&c.offset>=u.data.length&&u.parentElement?.nextSibling&&(u=u.parentElement?.nextSibling,c={node:u,offset:0});c&&c.node instanceof HTMLElement;)u=c.node,c={node:c.node.childNodes[c.offset],offset:0};if(!(u instanceof HTMLElement)){if(!u.parentNode)return null;u=u.parentNode}let d=getComputedStyle(u),f=n.left,p=(i=t).coordsForChar?.call(i,a);if(p&&(f=p.left),!e||e==`
84
+ `||e==`\r`)e=`\xA0`;else if(e==` `){e=`\xA0`;var l=t.coordsAtPos(a+1,-1);l&&(f=l.left-(l.left-n.left)/parseInt(d.tabSize))}else/[\uD800-\uDBFF]/.test(e)&&a<t.state.doc.length-1&&(e+=t.state.sliceDoc(a+1,a+2));let m=n.bottom-n.top;return new a_((f-o.left)/t.scaleX,(n.top-o.top+m*(1-s))/t.scaleY,m*s/t.scaleY,d.fontFamily,d.fontSize,d.fontWeight,d.color,r?`cm-fat-cursor cm-cursor-primary`:`cm-fat-cursor cm-cursor-secondary`,e,s!=1)}return null}var d_=typeof navigator<`u`&&/linux/i.test(navigator.platform)&&/ Gecko\/\d+/.exec(navigator.userAgent),f_=jg(Ug),p_=Jn.baseTheme({".cm-vimMode .cm-cursorLayer:not(.cm-vimCursorLayer)":{display:`none`},".cm-vim-panel":{padding:`0px 10px`,fontFamily:`monospace`,minHeight:`1.3em`,display:`flex`},".cm-vim-panel input":{border:`none`,outline:`none`,backgroundColor:`inherit`},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`}}),m_=Zn.fromClass(class{constructor(e){this.status=``,this.query=null,this.decorations=Fn.none,this.waitForCopy=!1,this.lastKeydown=``,this.useNextTextInput=!1,this.compositionText=``,this.view=e;let t=this.cm=new Ug(e);f_.enterVimMode(this.cm),this.view.cm=this.cm,this.cm.state.vimPlugin=this,this.blockCursor=new o_(e,t),this.updateClass(),this.cm.on(`vim-command-done`,()=>{t.state.vim&&(t.state.vim.status=``),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on(`vim-mode-change`,e=>{t.state.vim&&(t.state.vim.mode=e.mode,e.subMode&&(t.state.vim.mode+=e.subMode===`linewise`?` line`:` block`),t.state.vim.status=``,this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus())}),this.cm.on(`dialog`,()=>{this.cm.state.statusbar?this.updateStatus():e.dispatch({effects:__.of(!!this.cm.state.dialog)})}),this.dom=document.createElement(`span`),this.spacer=document.createElement(`span`),this.spacer.style.flex=`1`,this.statusButton=document.createElement(`span`),this.statusButton.onclick=e=>{f_.handleKey(this.cm,`<Esc>`,`user`),this.cm.focus()},this.statusButton.style.cssText=`cursor: pointer`}update(e){if((e.viewportChanged||e.docChanged)&&this.query&&this.highlight(this.query),e.docChanged&&this.cm.onChange(e),e.selectionSet&&this.cm.onSelectionChange(),e.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),e.transactions){for(let t of e.transactions)for(let e of t.effects)if(e.is(gr)){if(!e.value?.forVim)this.highlight(null);else{let t=e.value.create();this.highlight(t)}}}this.blockCursor.update(e)}updateClass(){let e=this.cm.state;!e.vim||e.vim.insertMode&&!e.overwrite?this.view.scrollDOM.classList.remove(`cm-vimMode`):this.view.scrollDOM.classList.add(`cm-vimMode`)}updateStatus(){let e=this.cm.state.statusbar,t=this.cm.state.vim;if(!e||!t)return;let n=this.cm.state.dialog;if(n)n.parentElement!=e&&(e.textContent=``,e.appendChild(n));else{e.textContent=``;var r=(t.mode||`normal`).toUpperCase();t.insertModeReturn&&(r+=`(C-O)`),this.statusButton.textContent=`--${r}--`,e.appendChild(this.statusButton),e.appendChild(this.spacer)}this.dom.textContent=t.status,e.appendChild(this.dom)}destroy(){f_.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(e){if(this.query=e,!e)return this.decorations=Fn.none;let{view:t}=this,n=new Mn;for(let r=0,i=t.visibleRanges,a=i.length;r<a;r++){let{from:o,to:s}=i[r];for(;r<a-1&&s>i[r+1].from-500;)s=i[++r].to;e.highlight(t.state,o,s,(e,t)=>{n.add(e,t,g_)})}return this.decorations=n.finish()}handleKey(e,t){let n=this.cm,r=n.state.vim;if(!r)return;let i=f_.vimKeyFromEvent(e,r);if(Ug.signal(this.cm,`inputEvent`,{type:`handleKey`,key:i}),!i)return;if(i==`<Esc>`&&!r.insertMode&&!r.visualMode&&this.query){let e=r.searchState_;e&&(n.removeOverlay(e.getOverlay()),e.setOverlay(null))}if(i===`<C-c>`&&!Ug.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;r.status=(r.status||``)+i;let a=f_.multiSelectHandleKey(n,i,`user`);return r=f_.maybeInitVimState_(n),!a&&r.insertMode&&n.state.overwrite&&(e.key&&e.key.length==1&&!/\n/.test(e.key)?(a=!0,n.overWriteSelection(e.key)):e.key==`Backspace`&&(a=!0,Ug.commands.cursorCharLeft(n))),a&&(Ug.signal(this.cm,`vim-keypress`,i),e.preventDefault(),e.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!a}},{eventHandlers:{copy:function(e,t){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var e=this.cm,t=e.state.vim;t&&(t.insertMode?e.setSelection(e.getCursor(),e.getCursor()):e.operation(()=>{e.curOp&&(e.curOp.isVimOp=!0),f_.handleKey(e,`<Esc>`,`user`)}))}))},compositionstart:function(e,t){this.useNextTextInput=!0,Ug.signal(this.cm,`inputEvent`,e)},compositionupdate:function(e,t){Ug.signal(this.cm,`inputEvent`,e)},compositionend:function(e,t){Ug.signal(this.cm,`inputEvent`,e)},keypress:function(e,t){Ug.signal(this.cm,`inputEvent`,e),this.lastKeydown==`Dead`&&this.handleKey(e,t)},keydown:function(e,t){Ug.signal(this.cm,`inputEvent`,e),this.lastKeydown=e.key,this.lastKeydown==`Unidentified`||this.lastKeydown==`Process`||this.lastKeydown==`Dead`?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(e,t))}},provide:()=>[Jn.inputHandler.of((e,t,n,r)=>{var i=S_(e);if(!i)return!1;var a=i.state?.vim,o=i.state.vimPlugin;if(a&&!a.insertMode&&!i.curOp?.isVimOp){if(r===`\0\0`)return!0;if(Ug.signal(i,`inputEvent`,{type:`text`,text:r,from:t,to:n}),r.length==1&&o.useNextTextInput){if(a.expectLiteralNext&&e.composing)return o.compositionText=r,!1;if(o.compositionText){var s=o.compositionText;o.compositionText=``;var c=e.state.selection.main.head;if(s===e.state.sliceDoc(c-s.length,c)){var l=i.getCursor();i.replaceRange(``,i.posFromIndex(c-s.length),l)}}return o.handleKey({key:r,preventDefault:()=>{},stopPropagation:()=>{}}),h_(e),!0}}return!1})],decorations:e=>e.decorations});function h_(e){var t=e.scrollDOM.parentElement;if(t){if(d_){e.contentDOM.textContent=`\0\0`,e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`));return}var n=e.scrollDOM.nextSibling,r=window.getSelection(),i=r&&{anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset};e.scrollDOM.remove(),t.insertBefore(e.scrollDOM,n);try{i&&r&&(r.setPosition(i.anchorNode,i.anchorOffset),i.focusNode&&r.extend(i.focusNode,i.focusOffset))}catch(e){console.error(e)}e.focus(),e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`))}}var g_=Fn.mark({class:`cm-searchMatch`}),__=Cn.define(),v_=cn.define({create:()=>!1,update(e,t){for(let n of t.effects)n.is(__)&&(e=n.value);return e},provide:e=>Sn.from(e,e=>e?y_:null)});function y_(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.dialog&&t.appendChild(n.state.dialog),{top:!1,dom:t}}function b_(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.statusbar=t,n.state.vimPlugin.updateStatus(),{dom:t}}function x_(e={}){return[p_,m_,c_,e.status?Sn.of(b_):v_]}function S_(e){return e.cm||null}function C_(e){let t=e.state.selection.main;return t.from===0&&t.to===0}function w_(e,t=!1){let n=e.state.selection.main,r=e.state.doc.length;return t&&n.from===r-1&&n.to===r-1?!0:n.from===r&&n.to===r}function T_(e){e&&e.dispatch({selection:{anchor:e.state.doc.length,head:e.state.doc.length}})}function E_(e){requestAnimationFrame(()=>{let t=e.current?.view;t&&(t.focus(),T_(t))})}function D_(e){let t=e.dom.closest(`.marimo-cell`);t&&requestAnimationFrame(()=>{t.scrollIntoView({behavior:`instant`,block:`nearest`,inline:`nearest`})})}function O_(e){return S_(e)?.state.vim!=null}function k_(e){let t=S_(e)?.state.vim;return t?!t.mode&&!t.insertMode&&!t.visualMode||t.mode===`normal`:!1}function A_(e){e&&e.dispatch({selection:{anchor:0,head:e.state.doc.length}})}var j_=new Set([Q.ClassDefinition]);function M_(e,t){requestAnimationFrame(()=>{e.focus(),e.dispatch({selection:{anchor:t,head:t},effects:Jn.scrollIntoView(t,{y:`center`})})}),D_(e)}function N_(e,t){let n=gn(e),r=null;return n.iterate({enter:n=>{if(r!==null)return!1;if(n.name===Q.VariableName&&e.doc.sliceString(n.from,n.to)===t)return r=n.from,!1;if(n.name===Q.Comment||n.name===Q.String)return!1}}),r}function P_(e,t){let n=[],r=e.resolveInner(t,0);for(;r;)ag.has(r.name)&&(n.some(e=>e.type===Q.FunctionDefinition||e.type===Q.LambdaExpression)&&r.name===Q.ClassDefinition||n.push({id:r.from,type:r.name})),r=r.parent;return n.push({id:-1,type:`global`}),n}function F_(e,t,n){e.push({scopeId:t,from:n})}function I_(e,t){if(e.firstChild())do t(e.node);while(e.nextSibling())}function L_(e,t){let{state:n,variableName:r,scopeId:i,declarations:a}=t;switch(e.name){case Q.VariableName:n.doc.sliceString(e.from,e.to)===r&&F_(a,i,e.from);break;case Q.TupleExpression:case Q.ArrayExpression:{let n=e.node.cursor();n.firstChild();do L_(n,t);while(n.nextSibling());break}}}function R_(e,t){let{state:n,variableName:r,scopeId:i,declarations:a}=t,o=e.cursor();o.firstChild();do{if(o.name!==Q.ParamList)continue;let e=o.node.cursor();e.firstChild();do e.name===Q.VariableName&&n.doc.sliceString(e.from,e.to)===r&&F_(a,i,e.from);while(e.nextSibling())}while(o.nextSibling())}function z_(e,t){let n=e.cursor();n.firstChild();let r=!1;do if(n.name===ig.For)r=!0;else if(r&&n.name===ig.In)break;else r&&L_(n,t);while(n.nextSibling())}function B_(e,t){let{state:n,variableName:r,scopeStack:i,declarations:a}=t,o=e.cursor(),s=o.name,c=o.from,l=ag.has(s)?[...i,c]:i,u=l[l.length-1]??-1;switch(s){case Q.FunctionDefinition:case Q.ClassDefinition:{let t=e.cursor();t.firstChild();do if(t.name===Q.VariableName&&n.doc.sliceString(t.from,t.to)===r){F_(a,i[i.length-1]??-1,t.from);break}while(t.nextSibling());s===Q.FunctionDefinition&&R_(e,{state:n,variableName:r,scopeId:c,declarations:a});break}case Q.LambdaExpression:R_(e,{state:n,variableName:r,scopeId:c,declarations:a});break;case Q.ArrayComprehensionExpression:case Q.DictionaryComprehensionExpression:case Q.SetComprehensionExpression:case Q.ComprehensionExpression:case Q.ForStatement:z_(e,{state:n,variableName:r,scopeId:u,declarations:a});break;case Q.AssignStatement:{let t=[],i=e.cursor();i.firstChild();do i.name===Q.AssignOp&&t.push(i.from);while(i.nextSibling());let o=t[t.length-1];if(o===void 0)break;let s=e.cursor();s.firstChild();do s.from<o&&L_(s,{state:n,variableName:r,scopeId:u,declarations:a});while(s.nextSibling());break}case Q.ImportStatement:{let t=e.cursor();t.firstChild();let i=!1,o=null,s=()=>{o?.matches&&F_(a,u,o.from),o=null};do{if(t.name===ig.Import){i=!0;continue}if(i){if(t.name===ig.As){o=null;continue}t.name===Q.VariableName?(s(),o={from:t.from,matches:n.doc.sliceString(t.from,t.to)===r}):t.name===`,`&&s()}}while(t.nextSibling());s();break}case Q.TryStatement:case Q.WithStatement:{let t=e.cursor();t.firstChild();let i=!1;do t.name===ig.As?i=!0:i&&t.name===Q.VariableName&&n.doc.sliceString(t.from,t.to)===r&&(F_(a,u,t.from),i=!1);while(t.nextSibling());break}}I_(o,e=>{B_(e,{state:n,variableName:r,scopeStack:l,declarations:a})})}function V_(e,t,n){let r=gn(e),i=[];B_(r,{state:e,variableName:t,scopeStack:[],declarations:i});let a=Math.max(0,Math.min(n,e.doc.length));for(let e of P_(r,a)){let t=i.filter(t=>t.scopeId===e.id).filter(t=>!j_.has(e.type)||t.from<=a).toSorted((e,t)=>e.from-t.from)[0];if(t)return t.from}return null}function H_(e,t,n){let{state:r}=e,i=n===void 0?N_(r,t):V_(r,t,n);return i!==null&&(M_(e,i),!0)}function U_(e,t){return M_(e,e.state.doc.line(t).from),!0}function W_(e,t){let n=u.get(re);return(n===`mac`?e.mac??e.key:n===`windows`?e.win??e.key:e.linux??e.key)===t}function G_(e){let{from:t,to:n}=e.selection.main;if(t===n){let{startToken:n,endToken:r}=Dg(e.doc,t);return{position:n,word:e.doc.sliceString(n,r)}}return{position:t,word:e.doc.sliceString(t,n)}}function K_(e,t){if(!t)return null;let n=e[t];return!n||n.declaredBy.length===0?null:n.declaredBy[0]}function q_(e){return e.startsWith(`_`)}function J_(e){let{state:t}=e,{position:n,word:r}=G_(t);return r?(Fr(e),e.dispatch({effects:Gn}),Z_(e,r,n)):!1}function Y_(e,t=u.get(F).getHotkey(`cell.goToDefinition`).key){for(let n of e.state.facet(pn).flat())if(W_(n,t)&&n.run?.(e))return!0;return!1}function X_(e){return J_(e)?!0:Y_(e)}function Z_(e,t,n){if(n!==void 0&&H_(e,t,n))return!0;let r=$_(e,t);return r?H_(r,t):!1}function Q_(e,t){let n=ev(e);return n?U_(n,t):!1}function $_(e,t){if(q_(t))return e;let n=K_(u.get(jh),t);return n?ev(n):null}function ev(e){return mN(e)??null}var tv=o(null);function nv(e){let t=u.get(tv);if(e===null){u.set(tv,null);return}(t?.cellId!==e.cellId||t.line!==e.line)&&u.set(tv,{...e,startedAtMs:Date.now()})}var rv=o(new Map),iv=new Set;function av(e){return o(t=>{let n=t(tv);return n?.cellId===e?n.line:null})}function ov(e){return o(t=>{let n=t(tv);return n?.cellId===e?{line:n.line,startedAtMs:n.startedAtMs}:null})}function sv(e){return o(t=>t(rv).get(e)??iv)}function cv(e){let t={};for(let[n,r]of e)r.size>0&&(t[n]=[...r].toSorted((e,t)=>e-t));Hr().sendSetBreakpoints({breakpoints:t}).catch(e=>{R.debug(`Failed to sync breakpoints to kernel`,{error:e})})}function lv(e){let t=u.get(rv);if(!t.has(e))return;let n=new Map(t);n.delete(e),u.set(rv,n),cv(n)}function uv(){let e=u.get(rv);e.size>0&&cv(e)}function dv(e,t){let n=u.get(rv),r=new Map(n),i=new Set(r.get(e)??[]);i.has(t)?i.delete(t):i.add(t),i.size>0?r.set(e,i):r.delete(e),u.set(rv,r),cv(r)}function fv(e,t){if(t==null||t<1||t>e.doc.lines)return Fn.none;let n=new Mn;try{let r=e.doc.line(t);n.add(r.from,r.from,Fn.line({class:`cm-debugger-current-line`}))}catch(e){R.debug(`Invalid debugger line`,{error:e})}return n.finish()}var pv=class{unsubscribe;decorations;constructor(e,t){this.decorations=fv(e.state,t.get()),this.unsubscribe=t.sub(t=>{this.decorations=fv(e.state,t),e.dispatch({userEvent:`marimo.debugger-line-update`})})}update(e){this.decorations=this.decorations.map(e.changes)}destroy(){this.unsubscribe()}};function mv(e){return[Zn.define(t=>new pv(t,e),{decorations:e=>e.decorations}),Jn.theme({".cm-debugger-current-line":{backgroundColor:`color-mix(in srgb, var(--amber-4) 50%, transparent)`}})]}var hv=new class extends Ln{toDOM(){let e=document.createElement(`div`);return e.className=`cm-breakpoint-marker`,e}},gv=Cn.define(),_v=cn.define({create:()=>new Set,update(e,t){for(let e of t.effects)if(e.is(gv))return e.value;return e}});function vv(e){let t=e.field(_v);if(t.size===0)return Nn.empty;let n=new Mn;for(let r of[...t].toSorted((e,t)=>e-t))if(r>=1&&r<=e.doc.lines){let t=e.doc.line(r);n.add(t.from,t.from,hv)}return n.finish()}var yv=class{unsubscribe;constructor(e,t){let n=t=>{e.dispatch({effects:gv.of(t)})};t.get().size>0&&queueMicrotask(()=>n(t.get())),this.unsubscribe=t.sub(n)}destroy(){this.unsubscribe()}};function bv(e,t){return[_v,Zn.define(e=>new yv(e,t)),$n({class:`cm-breakpoint-gutter`,markers:e=>vv(e.state),initialSpacer:()=>hv,domEventHandlers:{mousedown:(t,n)=>{let r=t.state.doc.lineAt(n.from).number;return dv(e,r),!0}}}),Jn.theme({".cm-breakpoint-gutter":{width:`14px`,cursor:`pointer`},".cm-breakpoint-marker":{width:`8px`,height:`8px`,borderRadius:`50%`,backgroundColor:`var(--red-9)`,margin:`4px auto`}})]}var xv=class e{ms;static fromMilliseconds(t){return t==null?null:new e(t)}static fromSeconds(t){return t==null?null:new e(t*1e3)}static now(){return new e(Date.now())}constructor(e){this.ms=e}toMilliseconds(){return this.ms}toSeconds(){return this.ms/1e3}};function Sv(e){if(e===null)return``;let t=e,n=t/1e3;return n>=60?`${Math.floor(n/60)}m${Math.floor(n%60)}s`:n>=1?`${n.toFixed(2).toString()}s`:`${t.toFixed(0).toString()}ms`}var Cv=500,wv=250,Tv=class e extends Rn{static intervals=new WeakMap;startedAtMs;constructor(e){super(),this.startedAtMs=e}eq(e){return e.startedAtMs===this.startedAtMs}toDOM(){let t=document.createElement(`span`);t.className=`cm-line-timer`,t.setAttribute(`aria-hidden`,`true`);let n=()=>{let e=Date.now()-this.startedAtMs;t.textContent=e>=Cv?Sv(e):``};return n(),e.intervals.set(t,window.setInterval(n,wv)),t}destroy(t){let n=e.intervals.get(t);n!==void 0&&(window.clearInterval(n),e.intervals.delete(t))}ignoreEvent(){return!0}};function Ev(e,t){if(t===null||t.line<1||t.line>e.doc.lines)return Fn.none;let n=new Mn;try{let r=e.doc.line(t.line);n.add(r.from,r.from,Fn.line({class:`cm-timing-current-line`})),n.add(r.to,r.to,Fn.widget({widget:new Tv(t.startedAtMs),side:1}))}catch(e){R.debug(`Invalid timing line`,{error:e})}return n.finish()}var Dv=class{unsubscribe;decorations;constructor(e,t){this.decorations=Ev(e.state,t.get()),this.unsubscribe=t.sub(t=>{this.decorations=Ev(e.state,t),e.dispatch({userEvent:`marimo.timing-line-update`})})}update(e){this.decorations=this.decorations.map(e.changes)}destroy(){this.unsubscribe()}};function Ov(e){return[Zn.define(t=>new Dv(t,e),{decorations:e=>e.decorations}),Jn.theme({".cm-timing-current-line":{backgroundColor:`color-mix(in srgb, var(--grass-4) 50%, transparent)`},".cm-line-timer":{color:`var(--grass-11)`,fontSize:`0.85em`,marginLeft:`1.5ch`,pointerEvents:`none`}})]}function kv(e,t){if(!t?.length)return Fn.none;let n=new Mn,r=e.facet(Of),i=t.filter(e=>e.kind===`cell`&&e.cellId===r).toSorted((e,t)=>e.lineNumber-t.lineNumber);for(let t of i)try{let r=e.doc.line(t.lineNumber),i=Fn.line({class:`cm-error-line`});n.add(r.from,r.from,i)}catch(e){R.debug(`Invalid line number in error decoration`,{error:e})}return n.finish()}function Av(e,t){if(!t?.length)return;let n=e.state.facet(Of),r=t.filter(e=>e.kind===`cell`&&e.cellId===n);if(r.length===0)return;let i=Hn(e.state),a=[];for(let t of r)try{let n=e.state.doc.line(t.lineNumber);i.between(n.from,n.to,(e,t)=>{a.push(kn.of({from:e,to:t}))})}catch(e){R.debug(`Invalid line numbers`,{error:e})}a.length>0&&e.dispatch({effects:a})}var jv=class{unsubscribe;decorations;constructor(e,t){let n=t.get();this.decorations=kv(e.state,n),Av(e,n),this.unsubscribe=t.sub(t=>{let n=this.decorations.size;this.decorations=kv(e.state,t),Av(e,t),n!==this.decorations.size&&e.dispatch({userEvent:`marimo.error-decoration-update`})})}update(e){this.decorations=this.decorations.map(e.changes)}destroy(){this.unsubscribe()}};function Mv(e){return Zn.define(t=>new jv(t,e),{decorations:e=>e.decorations})}function Nv(e){return[Mv(e),Jn.theme({".cm-error-line":{backgroundColor:`color-mix(in srgb, var(--red-4) 40%, transparent)`},"&.cm-focused .cm-error-line.cm-activeLine":{backgroundColor:`color-mix(in srgb, var(--red-5) 40%, transparent)`}})]}function Pv({cellId:e,hotkeys:t}){let n=[];return n.push(...oe({key:t.getHotkey(`cell.run`).key,preventDefault:!0,stopPropagation:!0,run:e=>(e.state.facet(Df).onRun(),!0)}),{key:t.getHotkey(`cell.runAndNewBelow`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Df);return n.onRun(),e===`__scratch__`||(t.contentDOM.blur(),n.moveToNextCell({cellId:e,before:!1}),!0)}},...oe({key:t.getHotkey(`cell.runAndNewAbove`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Df);return n.onRun(),e===`__scratch__`||(t.contentDOM.blur(),n.moveToNextCell({cellId:e,before:!0}),!0)}}),{key:t.getHotkey(`cell.aiCompletion`).key,preventDefault:!0,stopPropagation:!0,run:e=>(e.state.facet(Df).aiCellCompletion()&&e.contentDOM.focus(),!0)}),e!==`__scratch__`&&n.push({key:t.getHotkey(`cell.goToDefinition`).key,run:e=>J_(e)},{key:t.getHotkey(`cell.delete`).key,preventDefault:!0,stopPropagation:!0,run:e=>(e.state.doc.length===0&&e.state.facet(Df).deleteCell(),!0)},{key:t.getHotkey(`cell.moveUp`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveCell({cellId:e,before:!0}),!0)},{key:t.getHotkey(`cell.moveDown`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveCell({cellId:e,before:!1}),!0)},{key:t.getHotkey(`cell.moveLeft`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveCell({cellId:e,before:!0,direction:`left`}),!0)},{key:t.getHotkey(`cell.moveRight`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveCell({cellId:e,before:!1,direction:`right`}),!0)},{key:`ArrowUp`,run:t=>Nr(t.state)?!1:C_(t)?(t.state.facet(Df).moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0):!1},{key:`ArrowDown`,run:t=>Nr(t.state)?!1:w_(t)?(t.state.facet(Df).moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0):!1},{key:t.getHotkey(`cell.focusDown`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveToNextCell({cellId:e,before:!1,noCreate:!0}),!0)},{key:t.getHotkey(`cell.focusUp`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).moveToNextCell({cellId:e,before:!0,noCreate:!0}),!0)},{key:t.getHotkey(`cell.sendToBottom`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).sendToBottom({cellId:e}),!0)},{key:t.getHotkey(`cell.sendToTop`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.state.facet(Df).sendToTop({cellId:e}),!0)},{key:t.getHotkey(`cell.createAbove`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.contentDOM.blur(),t.state.facet(Df).createNewCell({cellId:e,before:!0}),!0)},{key:t.getHotkey(`cell.createBelow`).key,preventDefault:!0,stopPropagation:!0,run:t=>(t.contentDOM.blur(),t.state.facet(Df).createNewCell({cellId:e,before:!1}),!0)},{key:t.getHotkey(`cell.hideCode`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Df).toggleHideCode();return Fr(t),n?(t.contentDOM.blur(),document.getElementById(Li.create(e))?.focus()):t.contentDOM.focus(),!0}},{key:t.getHotkey(`cell.splitCell`).key,preventDefault:!0,stopPropagation:!0,run:t=>{let n=t.state.facet(Df);return n.splitCell({cellId:e}),n.moveToNextCell&&requestAnimationFrame(()=>{t.contentDOM.blur(),n.moveToNextCell({cellId:e,before:!1})}),!0}}),[vn.high(pn.of(n))]}function Fv(e){return[Jn.updateListener.of(e=>{if(e.docChanged){let t=e.transactions.some(e=>e.effects.some(e=>e.is(um))),n=jA(e.view),r=e.view.state.facet(Df),i=e.view.state.facet(Of);r.updateCellCode({cellId:i,code:n,formattingChange:t}),u.get(ch).has(i)&&u.set(lh)}}),Th(e)]}var Iv=[`input`,`delete`,`undo`,`redo`];function Lv({docChanged:e,transactions:t,predicate:n=()=>!0,hasFocus:r=!1}){return!e||!n()||t.some(e=>e.effects.some(e=>e.is(um)))?!1:t.some(e=>e.annotation(Yn.remote)||e.annotation(mh)!==void 0?!1:Iv.some(t=>e.isUserEvent(t))||r)}function Rv({predicate:e}){return Jn.updateListener.of(t=>{Lv({docChanged:t.docChanged,transactions:t.transactions,predicate:e,hasFocus:t.view.hasFocus})&&t.view.state.facet(Df).onRun()})}function zv({cellId:e,hotkeys:t,cellActions:n}){let r=vh(`debugger`),i=vh(`line_timing`);return[Df.of(n),Of.of(e),Pv({cellId:e,hotkeys:t}),Fv(t),Nv(bh(_N(e),u)),r?bv(e,bh(sv(e),u)):[],i?Ov(bh(ov(e),u)):r?mv(bh(av(e),u)):[]]}var Bv=Cn.define(),Vv=20;function Hv(e){let{state:t,anchor:n,head:r}=e;if(r<n)return!1;let i=t.doc.lineAt(r).number,a=t.doc.lineAt(n).number,o=Math.max(a,i-Vv+1),s=Math.max(n,t.doc.line(o).from),c=s>n,l=+!!c,u=t.doc.iterRange(s,r);for(;;){let{value:e,done:t}=u.next();if(t)break;for(let t of e)if(t===`(`)l++;else if(t===`)`&&(l--,c?l<=0:l<0))return!1}return!0}function Uv(e){return{...e,create:t=>{let{dom:n,...r}=e.create(t),i=document.createElement(`div`);return i.classList.add(`mo-cm-tooltip`),i.append(n),{...r,dom:i}}}}var Wv=cn.define({create:()=>null,update(e,t){for(let e of t.effects)if(e.is(Bv))return e.value;if(!e||t.selection&&!t.docChanged)return null;if(t.docChanged){let n=t.changes.mapPos(e.pos);return Hv({state:t.state,anchor:n,head:t.state.selection.main.head})?{...e,pos:n}:null}return e},provide:e=>mn.from(e)});function Gv(e){return e.state.field(Wv,!1)?(e.dispatch({effects:Bv.of(null)}),!0):!1}var Kv=async e=>{let t=e.state.doc.sliceString(0,e.pos),n=document.activeElement,r=null;if(n!==null){let e=Li.findElement(n);e!==null&&(r=Li.parse(e.id))}if(r===null)return R.error(`Failed to find active cell.`),null;let i=await xg.request({document:t,cellId:r});if(!i)return e.view?.dispatch({effects:Bv.of(null)}),null;let a=Cg.asHoverTooltip({position:e.pos,message:i,limitToType:`tooltip`});return a&&u.set(rg,{documentation:a.html??null}),e.view?.dispatch({effects:Bv.of(a?Uv(a):null)}),a?null:Cg.asCompletionResult(e.pos,i)};function qv(e){return t=>e.predicate(t.state)?e.completion(t):null}var Jv=async e=>{let t=e.matchBefore(/:\w*$/);if(!e.explicit&&!t)return null;let n=await Yv();return{from:t?.from??e.pos,options:n,validFor:/^[\w:]*$/}},Yv=Or(async()=>{let e=await fetch(`https://unpkg.com/emojilib@3.0.11/dist/emoji-en-US.json`).then(e=>{if(!e.ok)throw Error(`Failed to fetch emoji list`);return e.json()}).catch(()=>({}));return Object.entries(e).map(([e,t])=>({shortcode:t[0],label:t.map(e=>`:${e}`).join(` `),emoji:e,displayLabel:`${e} ${t[0].replaceAll(`_`,` `)}`,apply:e,type:`emoji`}))}),Xv=async e=>{let t=e.matchBefore(/::[\w-:]*$/);if(!e.explicit&&!t)return null;let n=await Zv();return{from:t?.from??e.pos,options:n,validFor:/^[\w-:]*$/}},Zv=Or(async()=>{let e=await fetch(`https://unpkg.com/lucide-static@0.452.0/tags.json`).then(e=>{if(!e.ok)throw Error(`Failed to fetch Lucide icon list`);return e.json()}).catch(()=>({})),t=e=>`https://cdn.jsdelivr.net/npm/lucide-static@0.452.0/icons/${e}.svg`;return Object.entries(e).map(([e,n])=>({label:`::${e}`,displayLabel:e,type:`lucide-icon`,boost:10,apply:`::lucide:${e}::`,detail:n.join(`, `),info:()=>{let n=document.createElement(`img`);return n.src=t(e),n.style.width=`24px`,n.style.height=`24px`,n}}))}),Qv=e=>{let t=e.matchBefore(/\\\w*$/);return!e.explicit&&!t?null:{from:t?.from??e.pos,options:$v(),validFor:/^[\w\\]*$/}},$v=Or(()=>[[`alpha`,`α`,`Greek small letter alpha`],[`beta`,`β`,`Greek small letter beta`],[`gamma`,`γ`,`Greek small letter gamma`],[`delta`,`δ`,`Greek small letter delta`],[`epsilon`,`ε`,`Greek small letter epsilon`],[`zeta`,`ζ`,`Greek small letter zeta`],[`eta`,`η`,`Greek small letter eta`],[`theta`,`θ`,`Greek small letter theta`],[`iota`,`ι`,`Greek small letter iota`],[`kappa`,`κ`,`Greek small letter kappa`],[`lambda`,`λ`,`Greek small letter lambda`],[`mu`,`μ`,`Greek small letter mu`],[`nu`,`ν`,`Greek small letter nu`],[`xi`,`ξ`,`Greek small letter xi`],[`omicron`,`ο`,`Greek small letter omicron`],[`pi`,`π`,`Greek small letter pi`],[`rho`,`ρ`,`Greek small letter rho`],[`sigma`,`σ`,`Greek small letter sigma`],[`tau`,`τ`,`Greek small letter tau`],[`upsilon`,`υ`,`Greek small letter upsilon`],[`phi`,`φ`,`Greek small letter phi`],[`chi`,`χ`,`Greek small letter chi`],[`psi`,`ψ`,`Greek small letter psi`],[`omega`,`ω`,`Greek small letter omega`],[`Gamma`,`Γ`,`Greek capital letter gamma`],[`Delta`,`Δ`,`Greek capital letter delta`],[`Theta`,`Θ`,`Greek capital letter theta`],[`Lambda`,`Λ`,`Greek capital letter lambda`],[`Xi`,`Ξ`,`Greek capital letter xi`],[`Pi`,`Π`,`Greek capital letter pi`],[`Sigma`,`Σ`,`Greek capital letter sigma`],[`Phi`,`Φ`,`Greek capital letter phi`],[`Psi`,`Ψ`,`Greek capital letter psi`],[`Omega`,`Ω`,`Greek capital letter omega`],[`pm`,`±`,`Plus-minus sign`],[`mp`,`∓`,`Minus-plus sign`],[`times`,`×`,`Multiplication sign`],[`div`,`÷`,`Division sign`],[`cdot`,`⋅`,`Dot operator`],[`ast`,`∗`,`Asterisk operator`],[`star`,`⋆`,`Star operator`],[`circ`,`∘`,`Ring operator`],[`bullet`,`•`,`Bullet`],[`cap`,`∩`,`Intersection`],[`cup`,`∪`,`Union`],[`uplus`,`⊎`,`Multiset union`],[`sqcap`,`⊓`,`Square cap`],[`sqcup`,`⊔`,`Square cup`],[`vee`,`∨`,`Logical or`],[`wedge`,`∧`,`Logical and`],[`setminus`,`∖`,`Set minus`],[`oplus`,`⊕`,`Circled plus`],[`ominus`,`⊖`,`Circled minus`],[`otimes`,`⊗`,`Circled times`],[`oslash`,`⊘`,`Circled division slash`],[`odot`,`⊙`,`Circled dot operator`],[`leq`,`≤`,`Less than or equal to`],[`geq`,`≥`,`Greater than or equal to`],[`equiv`,`≡`,`Identical to`],[`prec`,`≺`,`Precedes`],[`succ`,`≻`,`Succeeds`],[`sim`,`∼`,`Tilde operator`],[`perp`,`⊥`,`Up tack`],[`mid`,`∣`,`Divides`],[`parallel`,`∥`,`Parallel to`],[`subset`,`⊂`,`Subset of`],[`supset`,`⊃`,`Superset of`],[`subseteq`,`⊆`,`Subset of or equal to`],[`supseteq`,`⊇`,`Superset of or equal to`],[`cong`,`≅`,`Approximately equal to`],[`approx`,`≈`,`Almost equal to`],[`neq`,`≠`,`Not equal to`],[`ne`,`≠`,`Not equal to`],[`propto`,`∝`,`Proportional to`],[`leftarrow`,`←`,`Leftward arrow`],[`rightarrow`,`→`,`Rightward arrow`],[`Leftarrow`,`⇐`,`Leftward double arrow`],[`Rightarrow`,`⇒`,`Rightward double arrow`],[`leftrightarrow`,`↔`,`Left right arrow`],[`Leftrightarrow`,`⇔`,`Left right double arrow`],[`uparrow`,`↑`,`Upward arrow`],[`downarrow`,`↓`,`Downward arrow`],[`Uparrow`,`⇑`,`Upward double arrow`],[`Downarrow`,`⇓`,`Downward double arrow`],[`infty`,`∞`,`Infinity`],[`nabla`,`∇`,`Nabla`],[`partial`,`∂`,`Partial differential`],[`forall`,`∀`,`For all`],[`exists`,`∃`,`There exists`],[`nexists`,`∄`,`There does not exist`],[`emptyset`,`∅`,`Empty set`],[`in`,`∈`,`Element of`],[`notin`,`∉`,`Not an element of`],[`sum`,`∑`,`N-ary summation`],[`prod`,`∏`,`N-ary product`],[`int`,`∫`,`Integral`],[`oint`,`∮`,`Contour integral`],[`sqrt`,`√`,`Square root`],[`hbar`,`ℏ`,`Planck constant over 2pi`],[`ldots`,`…`,`Horizontal ellipsis`],[`cdots`,`⋯`,`Midline horizontal ellipsis`],[`vdots`,`⋮`,`Vertical ellipsis`],[`ddots`,`⋱`,`Down right diagonal ellipsis`]].map(([e,t,n])=>({label:`\\${e} ${n}`,displayLabel:e,type:`latex-symbol`,boost:10,apply:`\\${e}`,info:()=>{let e=document.createElement(`div`);return e.textContent=`${t} ${n}`,e},detail:t}))),ey=[Jv,Xv,Qv],ty=100;function ny(e){return!e.state.selection.main.empty}function ry({view:e,selection:t,markup:n}){let r=[],i=!0;for(let r=t.from;r<=t.to;r++)if(!e.state.doc.lineAt(r).text.startsWith(n)){i=!1;break}for(let a=t.from;a<=t.to;){let t=e.state.doc.lineAt(a),o=t.text.startsWith(n);i?r.push({from:t.from,to:t.from+n.length,insert:zn.of([``])}):(o&&r.push({from:t.from,to:t.from+n.length,insert:zn.of([``])}),r.push({from:t.from,insert:zn.of([n])})),a=t.to+1}return r}function iy({view:e,range:t,markupAfter:n,markupBefore:r}){if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}let i=e.state.sliceDoc(t.from-r.length,t.from)===r,a=e.state.sliceDoc(t.to,t.to+n.length)===n,o=[];o.push(i?{from:t.from-r.length,to:t.from,insert:zn.of([``])}:{from:t.from,insert:zn.of(r.split(`
85
85
  `))},a?{from:t.to,to:t.to+n.length,insert:zn.of([``])}:{from:t.to,insert:zn.of(n.split(`
86
- `))});let s=i?-r.length:r.length,c=a?-n.length:n.length;return{changes:o,range:An.range(t.from+s,t.to+c)}}function ny(e){if(!$v(e))return!1;let t=ey({view:e,selection:e.state.selection.main,markup:`> `});return t.length>0&&e.dispatch(e.state.update({changes:t,scrollIntoView:!0,userEvent:`input`})),e.focus(),!0}function ry(e){if(!$v(e))return!1;let t=e.state.changeByRange(t=>{if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}return ty({view:e,range:t,markupBefore:`**`,markupAfter:`**`})});return e.dispatch(e.state.update(t,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)})),e.focus(),!0}function iy(e){if(!$v(e))return!1;let t=e.state.changeByRange(t=>{if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}let n=e.state.doc.lineAt(t.from).number!==e.state.doc.lineAt(t.to).number;return ty({view:e,range:t,markupBefore:n?"```\n":"`",markupAfter:n?"\n```":"`"})});return e.dispatch(e.state.update(t,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)})),e.focus(),!0}function ay(e){let t=e.state.changeByRange(t=>{if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}return ty({view:e,range:t,markupBefore:`_`,markupAfter:`_`})});return e.dispatch(e.state.update(t,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)})),e.focus(),!0}function oy(e,t=`http://`){if(!$v(e))return!1;let n=e.state.changeByRange(n=>{let r=e.state.sliceDoc(n.from,n.to);return{changes:[{from:n.from,to:n.to,insert:`[${r}](${t})`}],range:n}});e.dispatch(e.state.update(n,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)}));let{to:r}=n.selection.main;try{e.dispatch({selection:An.create([An.range(r+3,r+3+t.length),An.cursor(r+3+t.length)])})}catch{}return e.focus(),!0}async function sy(e,t){let n=new FileReader,r=await new Promise(e=>{n.onload=()=>e(n.result),n.readAsDataURL(t)}),i;try{if(r.startsWith(`data:`)){let e=prompt(`We can save your image as a file. Enter a filename.`,t.name),n=t.type.split(`/`)[1];if(e===null){let e=Math.round(r.length/1024);if(e>Qv){sn({title:`Content too large`,description:`The content size is ${e} KB, which is too large to paste directly into the document.`});return}}else{e.trim()===``?e=t.name:e.endsWith(`.${n}`)||(e=`${e}.${n}`);let r=u.get(Qo),a=r?Et.dirname(r):null,o=a?`${a}/public`:`public`,s=await Hr().sendCreateFileOrFolder({path:o,type:`file`,name:e,file:t});s.success?(i=s.info?.path,i&&a&&i.startsWith(a)&&(i=Et.rest(i,a).replaceAll(`\\`,`/`)),sn({title:`Image uploaded successfully`,description:`We've uploaded your image at ${i}`})):sn({title:`Failed to upload image. Using raw base64 string.`})}}}catch{sn({title:`Failed to upload image. Using raw base64 string.`})}let a=e.state.changeByRange(t=>{let n=e.state.sliceDoc(t.from,t.to);return n.trim()===``&&(n=`alt`),{changes:[{from:t.from,to:t.to,insert:`![${n}](${i??r})`}],range:t}});e.dispatch(e.state.update(a,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)}));let{to:o}=a.selection.main;try{e.dispatch({selection:An.create([An.range(o+4,o+4+r.length),An.cursor(o+4+r.length)])})}catch{}return e.focus(),!0}async function cy(e,t){let n=await t.text(),r=e.state.changeByRange(e=>({changes:[{from:e.from,to:e.from,insert:n}],range:e}));return e.dispatch(e.state.update(r,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)})),e.focus(),!0}function ly(e){if(!$v(e))return!1;let{changes:t}=e.state.changeByRange(t=>({range:t,changes:ey({view:e,selection:t,markup:e.state.sliceDoc(t.from,t.to+2).startsWith(`* `)?`* `:`- `})}));return t.length>0&&e.dispatch(e.state.update({changes:t,scrollIntoView:!0,userEvent:`input`})),e.focus(),!0}function uy(e){if(!$v(e))return!1;let{changes:t}=e.state.changeByRange(t=>({range:t,changes:ey({view:e,selection:t,markup:`1. `})}));return t.length>0&&e.dispatch(e.state.update({changes:t,scrollIntoView:!0,userEvent:`input`})),e.focus(),!0}function dy(e){return[vn.highest(pn.of([{key:e.getHotkey(`markdown.bold`).key,stopPropagation:!0,run:ry},{key:e.getHotkey(`markdown.italic`).key,stopPropagation:!0,run:ay},{key:e.getHotkey(`markdown.link`).key,stopPropagation:!0,run:e=>oy(e)},{key:e.getHotkey(`markdown.orderedList`).key,run:uy},{key:e.getHotkey(`markdown.unorderedList`).key,run:ly},{key:e.getHotkey(`markdown.blockquote`).key,run:ny},{key:e.getHotkey(`markdown.code`).key,run:iy},{key:"`",run:iy}])),Jn.domEventHandlers({paste:(e,t)=>{if(t.state.selection.main.empty)return!1;let n=e.clipboardData?.getData(`text/plain`);n?.startsWith(`http`)&&(e.preventDefault(),oy(t,n))}}),Jn.domEventHandlers({paste:(e,t)=>{let n=e.clipboardData?.files[0];if(!n)return!1;if(n.type.startsWith(`image/`))return e.preventDefault(),sy(t,n),!0;if(n.type.startsWith(`text/`))return e.preventDefault(),cy(t,n),!0}})]}function fy(e,t,n=3,r=``){return Object.values(e).flatMap(e=>t.has(e.name)?[]:{label:`${r}${e.name}`,displayLabel:e.name,detail:e.dataType??``,boost:n,type:`variable`,apply:`${r}${e.name}`,section:`Variable`,info:()=>py(e)})}function py(e){let t=document.createElement(`div`);t.classList.add(`mo-cm-tooltip`,`docs-documentation`,`min-w-[200px]`,`flex`,`flex-col`,`gap-1`,`p-2`);let n=document.createElement(`div`);n.classList.add(`flex`,`items-center`,`gap-2`);let r=document.createElement(`span`);if(r.classList.add(`font-bold`,`text-base`),r.textContent=e.name,n.append(r),e.dataType){let t=document.createElement(`span`);t.classList.add(`text-xs`,`px-1.5`,`py-0.5`,`rounded-full`,`bg-purple-100`,`text-purple-800`,`dark:bg-purple-900`,`dark:text-purple-200`),t.textContent=e.dataType,n.append(t)}if(t.append(n),e.value){let n=document.createElement(`div`);n.classList.add(`flex`,`flex-col`,`gap-1`);let r=document.createElement(`div`);r.classList.add(`text-xs`,`text-muted-foreground`),r.textContent=`Value:`,n.append(r);let i=document.createElement(`div`);i.classList.add(`text-xs`,`font-mono`,`bg-muted`,`p-2`,`rounded`,`overflow-auto`,`max-h-40`),i.textContent=e.value,n.append(i),t.append(n)}return t}var my=`Python`,hy=123,gy=1;function _y(e,t){let n=new WeakMap;return{defineNodes:[{name:my,style:jn.emphasis},{name:`${my}Mark`,style:jn.processingInstruction}],parseInline:[{name:my,before:`Escape`,parse(r,i,a){if(!t())return-1;if(i===92&&r.char(a+1)===hy)return a+1;if(i!==hy)return-1;if(r.char(a+1)===hy)return a+2;let o=n.get(r);if(!o||a>=o.parsedTo){let t=e.parse(`rf"""${r.slice(a,r.end)}\n"""`).topNode.getChild(`ExpressionStatement`)?.getChild(`FormatString`),i=a-5,s=new Map;for(let e of t?.getChildren(`FormatReplacement`)??[])e.lastChild?.name===`}`&&s.set(i+e.from,i+e.to);o={ends:s,parsedTo:t?i+t.to:r.end},n.set(r,o)}let s=o.ends.get(a);return s===void 0?-1:r.addElement(r.elt(my,a,s,[r.elt(`${my}Mark`,a,a+1),r.elt(`${my}Mark`,s-1,s)]))}}],wrap:Vn(n=>{if(!t()||n.type.name!==my)return null;let r=n.from+gy,i=n.to-gy;return r>=i||r<0||i<0?null:{parser:e,overlay:[{from:r,to:i}],extensions:[si().support]}})}}var vy=e=>{let t=e.state.doc.sliceString(0,e.pos),n=t.lastIndexOf(`{`);if(t.at(n-1)===`{`||n===-1||t.indexOf(`}`,n)>n)return null;let r=e.matchBefore(/\w*$/);if(!r)return null;let i=fy(u.get(Oh),new Set,99);return{from:r.from,options:i,validFor:/^\w*$/}},yy=`InlineMathDollar`,by=`InlineMathBracket`,xy=`BlockMathDollar`,Sy=`BlockMathBracket`,Cy={[yy]:1,[by]:3,[xy]:2,[Sy]:3},wy={DOLLAR:36,BACKSLASH:92,OPEN_PAREN:40,CLOSE_PAREN:41,OPEN_BRACKET:91,CLOSE_BRACKET:93},Ty=Object.keys(Cy).reduce((e,t)=>(e[t]={mark:`${t}Mark`,resolve:t},e),{});function Ey(e){let t=[];return Object.keys(Cy).forEach(e=>{t.push({name:e,style:jn.emphasis},{name:`${e}Mark`,style:jn.processingInstruction})}),{defineNodes:t,parseInline:[{name:xy,parse(e,t,n){return t!==wy.DOLLAR||e.char(n+1)!==wy.DOLLAR?-1:e.addDelimiter(Ty[xy],n,n+Cy[xy],!0,!0)}},{name:yy,parse(e,t,n){return t!==wy.DOLLAR||e.char(n+1)===wy.DOLLAR?-1:e.addDelimiter(Ty[yy],n,n+Cy[yy],!0,!0)}},{name:by,before:`Escape`,parse(e,t,n){return t!==wy.BACKSLASH||e.char(n+1)!==wy.BACKSLASH||![wy.OPEN_PAREN,wy.CLOSE_PAREN].includes(e.char(n+2))?-1:e.addDelimiter(Ty[by],n,n+Cy[by],e.char(n+2)===wy.OPEN_PAREN,e.char(n+2)===wy.CLOSE_PAREN)}},{name:Sy,before:`Escape`,parse(e,t,n){return t!==wy.BACKSLASH||e.char(n+1)!==wy.BACKSLASH||![wy.OPEN_BRACKET,wy.CLOSE_BRACKET].includes(e.char(n+2))?-1:e.addDelimiter(Ty[Sy],n,n+Cy[Sy],e.char(n+2)===wy.OPEN_BRACKET,e.char(n+2)===wy.CLOSE_BRACKET)}},{name:by,before:`Escape`,parse(e,t,n){return t!==wy.BACKSLASH||![wy.OPEN_PAREN,wy.CLOSE_PAREN].includes(e.char(n+1))?-1:e.addDelimiter(Ty[by],n,n+2,e.char(n+1)===wy.OPEN_PAREN,e.char(n+1)===wy.CLOSE_PAREN)}},{name:Sy,before:`Escape`,parse(e,t,n){return t!==wy.BACKSLASH||![wy.OPEN_BRACKET,wy.CLOSE_BRACKET].includes(e.char(n+1))?-1:e.addDelimiter(Ty[Sy],n,n+2,e.char(n+1)===wy.OPEN_BRACKET,e.char(n+1)===wy.CLOSE_BRACKET)}}],wrap:Vn(t=>{let n=Cy[t.type.name];if(n){let r=t.node.firstChild?.to??t.from+n,i=t.node.lastChild?.from??t.to-n;if(r>=i||r<0||i<0)return null;let a=[],o=r;return t.node.cursor(Pn.IgnoreMounts).iterate(e=>{if(e.name===`Python`)return o<e.from&&a.push({from:o,to:e.from}),o=e.to,!1}),o<i&&a.push({from:o,to:i}),a.length?{parser:e,overlay:a}:null}return null})}}var Dy=Cn.define(),Oy=Cn.define(),ky=cn.define({create:()=>({}),update:(e,t)=>{for(let n of t.effects){if(n.is(Dy))return n.value;if(n.is(Oy))return{...e,...n.value}}return e}}),Ay=class{parser=new Ym;type=`markdown`;defaultCode=this.parser.defaultCode;defaultMetadata=this.parser.defaultMetadata;static fromMarkdown(e){return Ym.fromMarkdown(e)}transformIn(e){let t=this.parser.transformIn(e);return[t.code,t.offset,t.metadata]}transformOut(e,t){let n=this.parser.transformOut(e,t);return[n.code,n.offset]}isSupported(e){return this.parser.isSupported(e)}getExtension({hotkeys:e}){let t=ni().language.data,n,r=()=>{if(!n)return!0;let e=n?.state.field(ky);return e===void 0?!1:e.quotePrefix?.includes(`f`)??!1};return[Zn.define(e=>(n=e,{})),ni({base:ri,codeLanguages:mm,extensions:[Ey(Bn.define(li).parser),_y(ai.parser,r)]}),dy(e),Zv.map(e=>t.of({autocomplete:e})),si().language.data.of({autocomplete:Wv({completion:Uv,predicate:r})}),Lr({defaultKeymap:!1,activateOnTyping:!0}),Fv({predicate:()=>!r()})]}},jy={PREFIX:`file:///`,of(e){return`${this.PREFIX}${e}`},is(e){return e.startsWith(this.PREFIX)},parse(e){return B(this.is(e),`Invalid cell document URI: ${e}`),e.slice(this.PREFIX.length)}};function My(e){return`notify`in e&&typeof e.notify==`function`}function Ny(e){return`processNotification`in e&&typeof e.processNotification==`function`}function Py(e){return jy.is(e)?u.get(DM).inOrderIds.includes(jy.parse(e)):!1}function Fy(){return u.get(es)?.rootUri??`file:///`}function Iy(){let e=u.get(es)?.rootUri;return e?[{uri:e,name:`marimo`}]:[]}function Ly(){return u.get(es)?.documentUri??`file:///__marimo_notebook__.py`}function Ry(e){return z.filter(e,e=>e!==!1&&e!==null)}function zy(e){let t=e.map(Ry);return Object.assign({},...t)}var By=class{clients=[];documentUri;constructor(e){this.clients=e,this.documentUri=Ly()}onNotification(e){let t=[];for(let n of this.clients)t.push(n.onNotification(e));return()=>{for(let e of t)e();return!0}}get clientCapabilities(){return zy(this.clients.map(e=>{if(e.clientCapabilities)return typeof e.clientCapabilities==`function`?e.clientCapabilities({}):e.clientCapabilities}).filter(e=>e!=null))}get ready(){return this.clients.some(e=>e.ready)}set ready(e){this.clients.forEach(t=>{t.ready=e})}get capabilities(){return zy(this.clients.map(e=>e.capabilities).filter(e=>e!==null))}set capabilities(e){this.clients.forEach(t=>{t.capabilities=e})}get initializePromise(){return this.clients[0].initializePromise}set initializePromise(e){this.clients.forEach(t=>{t.initializePromise=e})}firstWithMethod(e){return this.clients.find(t=>t.hasCapability(e))}clientsWithMethod(e){return this.clients.filter(t=>t.hasCapability(e))}hasCapability(e){return this.clients.some(t=>t.hasCapability(e))}async initialize(){await Promise.all(this.clients.map(e=>e.initialize()))}async close(){await Promise.all(this.clients.map(e=>e.close()))}async textDocumentDidChange(e){await Promise.all(this.clients.map(t=>t.textDocumentDidChange(e)))}async completionItemResolve(e){let t=this.firstWithMethod(`textDocument/completion`);return t?t.completionItemResolve(e):e}async textDocumentCodeAction(e){let t=this.firstWithMethod(`textDocument/codeAction`);return t?t.textDocumentCodeAction(e):null}async codeActionResolve(e){let t=this.firstWithMethod(`textDocument/codeAction`);return t?t.codeActionResolve(e):e}async textDocumentRename(e){let t=this.firstWithMethod(`textDocument/rename`);return t?t.textDocumentRename(e):null}async textDocumentPrepareRename(e){let t=this.firstWithMethod(`textDocument/prepareRename`);return t?t.textDocumentPrepareRename(e):null}async textDocumentSignatureHelp(e){let t=this.firstWithMethod(`textDocument/signatureHelp`);return t?t.textDocumentSignatureHelp(e):null}async textDocumentCompletion(e){let t=this.clientsWithMethod(`textDocument/completion`);return Vy(await Promise.allSettled(t.map(t=>t.textDocumentCompletion(e))))}async textDocumentDefinition(e){let t=this.firstWithMethod(`textDocument/definition`);return t?t.textDocumentDefinition(e):null}async textDocumentDidOpen(e){return(await Promise.all(this.clients.map(t=>t.textDocumentDidOpen(e)))).some(e=>e!==!1)}async textDocumentDidClose(e){await Promise.all(this.clients.map(t=>t.textDocumentDidClose(e)))}async textDocumentWillSave(e){await Promise.all(this.clients.map(t=>t.textDocumentWillSave(e)))}async textDocumentWillSaveWaitUntil(e){let t=await Promise.allSettled(this.clients.map(t=>t.textDocumentWillSaveWaitUntil(e)));for(let e of t)if(e.status===`fulfilled`&&e.value?.length)return e.value;return null}async textDocumentDidSave(e){await Promise.all(this.clients.map(t=>t.textDocumentDidSave(e)))}async textDocumentHover(e){for(let t of this.clients){if(!t.hasCapability(`textDocument/hover`))continue;let n=await t.textDocumentHover(e);if(n)return n}return{contents:[]}}};function Vy(e){let t=[],n=!1;for(let r of e)if(r.status===`fulfilled`){let e=r.value;if(e==null)continue;Array.isArray(e)&&t.push(...e),`items`in e&&(t.push(...e.items),n||=e.isIncomplete)}return{items:t,isIncomplete:n}}function Hy(e){let t=ii.parse(e),n=``;return Kn(e,t,yn,(e,t)=>{let r=e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`);n+=t?`<span class="${t}">${r}</span>`:r},()=>{n+=`
87
- `}),n}function Uy(){let e=new Rr.Renderer,t=e.code.bind(e);return e.code=e=>{let{text:n,lang:r}=e;return n.trim()?r===`python`||r===`py`?`<pre><code class="language-python">${Hy(n)}</code></pre>\n`:t(e):``},t=>Rr(t,{async:!1,gfm:!0,breaks:!0,renderer:e})}function Wy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Gy(e,t){return typeof e[t]==`function`}var Ky=o(e=>{let t=e(xM);return z.fromEntries(t.cellIds.inOrderIds.map(e=>{let n=t.cellHandles[e]?.current?.editorViewOrNull;return[e,n?OA(n):t.cellData[e]?.code??``]}))});function qy(e){return[...Jy(e),e].join(`
88
- `)}function Jy(e){return Object.values(u.get(Ky)).filter(t=>t!==``&&t!==e).toSorted((e,t)=>e.startsWith(`import`)&&!t.startsWith(`import`)?-1:!e.startsWith(`import`)&&t.startsWith(`import`)?1:0)}var Yy=o(e=>e(xM).cellIds.inOrderIds),Xy=o(e=>Qy(e(Yy),e(Oh))),Zy=o(e=>({cellIds:e(Xy),codes:e(Ky)}));function Qy(e,t){let n=new Map;e.forEach(e=>n.set(e,[]));let r=new Set(e),i=new Set(e);for(let{declaredBy:e,usedBy:a}of Object.values(t))for(let t of e){r.delete(t);for(let e of a)i.delete(e),e!==t&&n.get(t)?.push(e)}let a=new Map;e.forEach(e=>a.set(e,0)),n.forEach(e=>{e.forEach(e=>{a.set(e,(a.get(e)||0)+1)})});let o=[];a.forEach((e,t)=>{e===0&&o.push(t)});let s=[];for(;o.length>0;){let e=o.shift();if(!e)break;s.push(e),n.get(e)?.forEach(e=>{a.set(e,(a.get(e)||0)-1),a.get(e)===0&&o.push(e)})}return[...s.filter(e=>!r.has(e)),...r]}function $y(e,t){let n=new Map,r=0;e.forEach(e=>{n.set(e,r),r+=t[e].split(`
86
+ `))});let s=i?-r.length:r.length,c=a?-n.length:n.length;return{changes:o,range:An.range(t.from+s,t.to+c)}}function ay(e){if(!ny(e))return!1;let t=ry({view:e,selection:e.state.selection.main,markup:`> `});return t.length>0&&e.dispatch(e.state.update({changes:t,scrollIntoView:!0,userEvent:`input`})),e.focus(),!0}function oy(e){if(!ny(e))return!1;let t=e.state.changeByRange(t=>{if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}return iy({view:e,range:t,markupBefore:`**`,markupAfter:`**`})});return e.dispatch(e.state.update(t,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)})),e.focus(),!0}function sy(e){if(!ny(e))return!1;let t=e.state.changeByRange(t=>{if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}let n=e.state.doc.lineAt(t.from).number!==e.state.doc.lineAt(t.to).number;return iy({view:e,range:t,markupBefore:n?"```\n":"`",markupAfter:n?"\n```":"`"})});return e.dispatch(e.state.update(t,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)})),e.focus(),!0}function cy(e){let t=e.state.changeByRange(t=>{if(t.empty){let n=e.state.wordAt(t.head);n&&(t=n)}return iy({view:e,range:t,markupBefore:`_`,markupAfter:`_`})});return e.dispatch(e.state.update(t,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)})),e.focus(),!0}function ly(e,t=`http://`){if(!ny(e))return!1;let n=e.state.changeByRange(n=>{let r=e.state.sliceDoc(n.from,n.to);return{changes:[{from:n.from,to:n.to,insert:`[${r}](${t})`}],range:n}});e.dispatch(e.state.update(n,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)}));let{to:r}=n.selection.main;try{e.dispatch({selection:An.create([An.range(r+3,r+3+t.length),An.cursor(r+3+t.length)])})}catch{}return e.focus(),!0}async function uy(e,t){let n=new FileReader,r=await new Promise(e=>{n.onload=()=>e(n.result),n.readAsDataURL(t)}),i;try{if(r.startsWith(`data:`)){let e=prompt(`We can save your image as a file. Enter a filename.`,t.name),n=t.type.split(`/`)[1];if(e===null){let e=Math.round(r.length/1024);if(e>ty){sn({title:`Content too large`,description:`The content size is ${e} KB, which is too large to paste directly into the document.`});return}}else{e.trim()===``?e=t.name:e.endsWith(`.${n}`)||(e=`${e}.${n}`);let r=u.get(Qo),a=r?Et.dirname(r):null,o=a?`${a}/public`:`public`,s=await Hr().sendCreateFileOrFolder({path:o,type:`file`,name:e,file:t});s.success?(i=s.info?.path,i&&a&&i.startsWith(a)&&(i=Et.rest(i,a).replaceAll(`\\`,`/`)),sn({title:`Image uploaded successfully`,description:`We've uploaded your image at ${i}`})):sn({title:`Failed to upload image. Using raw base64 string.`})}}}catch{sn({title:`Failed to upload image. Using raw base64 string.`})}let a=e.state.changeByRange(t=>{let n=e.state.sliceDoc(t.from,t.to);return n.trim()===``&&(n=`alt`),{changes:[{from:t.from,to:t.to,insert:`![${n}](${i??r})`}],range:t}});e.dispatch(e.state.update(a,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)}));let{to:o}=a.selection.main;try{e.dispatch({selection:An.create([An.range(o+4,o+4+r.length),An.cursor(o+4+r.length)])})}catch{}return e.focus(),!0}async function dy(e,t){let n=await t.text(),r=e.state.changeByRange(e=>({changes:[{from:e.from,to:e.from,insert:n}],range:e}));return e.dispatch(e.state.update(r,{scrollIntoView:!0,annotations:Yn.userEvent.of(`input`)})),e.focus(),!0}function fy(e){if(!ny(e))return!1;let{changes:t}=e.state.changeByRange(t=>({range:t,changes:ry({view:e,selection:t,markup:e.state.sliceDoc(t.from,t.to+2).startsWith(`* `)?`* `:`- `})}));return t.length>0&&e.dispatch(e.state.update({changes:t,scrollIntoView:!0,userEvent:`input`})),e.focus(),!0}function py(e){if(!ny(e))return!1;let{changes:t}=e.state.changeByRange(t=>({range:t,changes:ry({view:e,selection:t,markup:`1. `})}));return t.length>0&&e.dispatch(e.state.update({changes:t,scrollIntoView:!0,userEvent:`input`})),e.focus(),!0}function my(e){return[vn.highest(pn.of([{key:e.getHotkey(`markdown.bold`).key,stopPropagation:!0,run:oy},{key:e.getHotkey(`markdown.italic`).key,stopPropagation:!0,run:cy},{key:e.getHotkey(`markdown.link`).key,stopPropagation:!0,run:e=>ly(e)},{key:e.getHotkey(`markdown.orderedList`).key,run:py},{key:e.getHotkey(`markdown.unorderedList`).key,run:fy},{key:e.getHotkey(`markdown.blockquote`).key,run:ay},{key:e.getHotkey(`markdown.code`).key,run:sy},{key:"`",run:sy}])),Jn.domEventHandlers({paste:(e,t)=>{if(t.state.selection.main.empty)return!1;let n=e.clipboardData?.getData(`text/plain`);n?.startsWith(`http`)&&(e.preventDefault(),ly(t,n))}}),Jn.domEventHandlers({paste:(e,t)=>{let n=e.clipboardData?.files[0];if(!n)return!1;if(n.type.startsWith(`image/`))return e.preventDefault(),uy(t,n),!0;if(n.type.startsWith(`text/`))return e.preventDefault(),dy(t,n),!0}})]}function hy(e,t,n=3,r=``){return Object.values(e).flatMap(e=>t.has(e.name)?[]:{label:`${r}${e.name}`,displayLabel:e.name,detail:e.dataType??``,boost:n,type:`variable`,apply:`${r}${e.name}`,section:`Variable`,info:()=>gy(e)})}function gy(e){let t=document.createElement(`div`);t.classList.add(`mo-cm-tooltip`,`docs-documentation`,`min-w-[200px]`,`flex`,`flex-col`,`gap-1`,`p-2`);let n=document.createElement(`div`);n.classList.add(`flex`,`items-center`,`gap-2`);let r=document.createElement(`span`);if(r.classList.add(`font-bold`,`text-base`),r.textContent=e.name,n.append(r),e.dataType){let t=document.createElement(`span`);t.classList.add(`text-xs`,`px-1.5`,`py-0.5`,`rounded-full`,`bg-purple-100`,`text-purple-800`,`dark:bg-purple-900`,`dark:text-purple-200`),t.textContent=e.dataType,n.append(t)}if(t.append(n),e.value){let n=document.createElement(`div`);n.classList.add(`flex`,`flex-col`,`gap-1`);let r=document.createElement(`div`);r.classList.add(`text-xs`,`text-muted-foreground`),r.textContent=`Value:`,n.append(r);let i=document.createElement(`div`);i.classList.add(`text-xs`,`font-mono`,`bg-muted`,`p-2`,`rounded`,`overflow-auto`,`max-h-40`),i.textContent=e.value,n.append(i),t.append(n)}return t}var _y=`Python`,vy=123,yy=1;function by(e,t){let n=new WeakMap;return{defineNodes:[{name:_y,style:jn.emphasis},{name:`${_y}Mark`,style:jn.processingInstruction}],parseInline:[{name:_y,before:`Escape`,parse(r,i,a){if(!t())return-1;if(i===92&&r.char(a+1)===vy)return a+1;if(i!==vy)return-1;if(r.char(a+1)===vy)return a+2;let o=n.get(r);if(!o||a>=o.parsedTo){let t=e.parse(`rf"""${r.slice(a,r.end)}\n"""`).topNode.getChild(`ExpressionStatement`)?.getChild(`FormatString`),i=a-5,s=new Map;for(let e of t?.getChildren(`FormatReplacement`)??[])e.lastChild?.name===`}`&&s.set(i+e.from,i+e.to);o={ends:s,parsedTo:t?i+t.to:r.end},n.set(r,o)}let s=o.ends.get(a);return s===void 0?-1:r.addElement(r.elt(_y,a,s,[r.elt(`${_y}Mark`,a,a+1),r.elt(`${_y}Mark`,s-1,s)]))}}],wrap:Vn(n=>{if(!t()||n.type.name!==_y)return null;let r=n.from+yy,i=n.to-yy;return r>=i||r<0||i<0?null:{parser:e,overlay:[{from:r,to:i}],extensions:[si().support]}})}}var xy=e=>{let t=e.state.doc.sliceString(0,e.pos),n=t.lastIndexOf(`{`);if(t.at(n-1)===`{`||n===-1||t.indexOf(`}`,n)>n)return null;let r=e.matchBefore(/\w*$/);if(!r)return null;let i=hy(u.get(jh),new Set,99);return{from:r.from,options:i,validFor:/^\w*$/}},Sy=`InlineMathDollar`,Cy=`InlineMathBracket`,wy=`BlockMathDollar`,Ty=`BlockMathBracket`,Ey={[Sy]:1,[Cy]:3,[wy]:2,[Ty]:3},Dy={DOLLAR:36,BACKSLASH:92,OPEN_PAREN:40,CLOSE_PAREN:41,OPEN_BRACKET:91,CLOSE_BRACKET:93},Oy=Object.keys(Ey).reduce((e,t)=>(e[t]={mark:`${t}Mark`,resolve:t},e),{});function ky(e){let t=[];return Object.keys(Ey).forEach(e=>{t.push({name:e,style:jn.emphasis},{name:`${e}Mark`,style:jn.processingInstruction})}),{defineNodes:t,parseInline:[{name:wy,parse(e,t,n){return t!==Dy.DOLLAR||e.char(n+1)!==Dy.DOLLAR?-1:e.addDelimiter(Oy[wy],n,n+Ey[wy],!0,!0)}},{name:Sy,parse(e,t,n){return t!==Dy.DOLLAR||e.char(n+1)===Dy.DOLLAR?-1:e.addDelimiter(Oy[Sy],n,n+Ey[Sy],!0,!0)}},{name:Cy,before:`Escape`,parse(e,t,n){return t!==Dy.BACKSLASH||e.char(n+1)!==Dy.BACKSLASH||![Dy.OPEN_PAREN,Dy.CLOSE_PAREN].includes(e.char(n+2))?-1:e.addDelimiter(Oy[Cy],n,n+Ey[Cy],e.char(n+2)===Dy.OPEN_PAREN,e.char(n+2)===Dy.CLOSE_PAREN)}},{name:Ty,before:`Escape`,parse(e,t,n){return t!==Dy.BACKSLASH||e.char(n+1)!==Dy.BACKSLASH||![Dy.OPEN_BRACKET,Dy.CLOSE_BRACKET].includes(e.char(n+2))?-1:e.addDelimiter(Oy[Ty],n,n+Ey[Ty],e.char(n+2)===Dy.OPEN_BRACKET,e.char(n+2)===Dy.CLOSE_BRACKET)}},{name:Cy,before:`Escape`,parse(e,t,n){return t!==Dy.BACKSLASH||![Dy.OPEN_PAREN,Dy.CLOSE_PAREN].includes(e.char(n+1))?-1:e.addDelimiter(Oy[Cy],n,n+2,e.char(n+1)===Dy.OPEN_PAREN,e.char(n+1)===Dy.CLOSE_PAREN)}},{name:Ty,before:`Escape`,parse(e,t,n){return t!==Dy.BACKSLASH||![Dy.OPEN_BRACKET,Dy.CLOSE_BRACKET].includes(e.char(n+1))?-1:e.addDelimiter(Oy[Ty],n,n+2,e.char(n+1)===Dy.OPEN_BRACKET,e.char(n+1)===Dy.CLOSE_BRACKET)}}],wrap:Vn(t=>{let n=Ey[t.type.name];if(n){let r=t.node.firstChild?.to??t.from+n,i=t.node.lastChild?.from??t.to-n;if(r>=i||r<0||i<0)return null;let a=[],o=r;return t.node.cursor(Pn.IgnoreMounts).iterate(e=>{if(e.name===`Python`)return o<e.from&&a.push({from:o,to:e.from}),o=e.to,!1}),o<i&&a.push({from:o,to:i}),a.length?{parser:e,overlay:a}:null}return null})}}var Ay=Cn.define(),jy=Cn.define(),My=cn.define({create:()=>({}),update:(e,t)=>{for(let n of t.effects){if(n.is(Ay))return n.value;if(n.is(jy))return{...e,...n.value}}return e}}),Ny=class{parser=new Qm;type=`markdown`;defaultCode=this.parser.defaultCode;defaultMetadata=this.parser.defaultMetadata;static fromMarkdown(e){return Qm.fromMarkdown(e)}transformIn(e){let t=this.parser.transformIn(e);return[t.code,t.offset,t.metadata]}transformOut(e,t){let n=this.parser.transformOut(e,t);return[n.code,n.offset]}isSupported(e){return this.parser.isSupported(e)}getExtension({hotkeys:e}){let t=ni().language.data,n,r=()=>{if(!n)return!0;let e=n?.state.field(My);return e===void 0?!1:e.quotePrefix?.includes(`f`)??!1};return[Zn.define(e=>(n=e,{})),ni({base:ri,codeLanguages:_m,extensions:[ky(Bn.define(li).parser),by(ai.parser,r)]}),my(e),ey.map(e=>t.of({autocomplete:e})),si().language.data.of({autocomplete:qv({completion:Kv,predicate:r})}),Lr({defaultKeymap:!1,activateOnTyping:!0}),Rv({predicate:()=>!r()})]}},Py={PREFIX:`file:///`,of(e){return`${this.PREFIX}${e}`},is(e){return e.startsWith(this.PREFIX)},parse(e){return B(this.is(e),`Invalid cell document URI: ${e}`),e.slice(this.PREFIX.length)}};function Fy(e){return`notify`in e&&typeof e.notify==`function`}function Iy(e){return`processNotification`in e&&typeof e.processNotification==`function`}function Ly(e){return Py.is(e)?u.get(AM).inOrderIds.includes(Py.parse(e)):!1}function Ry(){return u.get(es)?.rootUri??`file:///`}function zy(){let e=u.get(es)?.rootUri;return e?[{uri:e,name:`marimo`}]:[]}function By(){return u.get(es)?.documentUri??`file:///__marimo_notebook__.py`}function Vy(e){return z.filter(e,e=>e!==!1&&e!==null)}function Hy(e){let t=e.map(Vy);return Object.assign({},...t)}var Uy=class{clients=[];documentUri;constructor(e){this.clients=e,this.documentUri=By()}onNotification(e){let t=[];for(let n of this.clients)t.push(n.onNotification(e));return()=>{for(let e of t)e();return!0}}get clientCapabilities(){return Hy(this.clients.map(e=>{if(e.clientCapabilities)return typeof e.clientCapabilities==`function`?e.clientCapabilities({}):e.clientCapabilities}).filter(e=>e!=null))}get ready(){return this.clients.some(e=>e.ready)}set ready(e){this.clients.forEach(t=>{t.ready=e})}get capabilities(){return Hy(this.clients.map(e=>e.capabilities).filter(e=>e!==null))}set capabilities(e){this.clients.forEach(t=>{t.capabilities=e})}get initializePromise(){return this.clients[0].initializePromise}set initializePromise(e){this.clients.forEach(t=>{t.initializePromise=e})}firstWithMethod(e){return this.clients.find(t=>t.hasCapability(e))}clientsWithMethod(e){return this.clients.filter(t=>t.hasCapability(e))}hasCapability(e){return this.clients.some(t=>t.hasCapability(e))}async initialize(){await Promise.all(this.clients.map(e=>e.initialize()))}async close(){await Promise.all(this.clients.map(e=>e.close()))}async textDocumentDidChange(e){await Promise.all(this.clients.map(t=>t.textDocumentDidChange(e)))}async completionItemResolve(e){let t=this.firstWithMethod(`textDocument/completion`);return t?t.completionItemResolve(e):e}async textDocumentCodeAction(e){let t=this.firstWithMethod(`textDocument/codeAction`);return t?t.textDocumentCodeAction(e):null}async codeActionResolve(e){let t=this.firstWithMethod(`textDocument/codeAction`);return t?t.codeActionResolve(e):e}async textDocumentRename(e){let t=this.firstWithMethod(`textDocument/rename`);return t?t.textDocumentRename(e):null}async textDocumentPrepareRename(e){let t=this.firstWithMethod(`textDocument/prepareRename`);return t?t.textDocumentPrepareRename(e):null}async textDocumentSignatureHelp(e){let t=this.firstWithMethod(`textDocument/signatureHelp`);return t?t.textDocumentSignatureHelp(e):null}async textDocumentCompletion(e){let t=this.clientsWithMethod(`textDocument/completion`);return Wy(await Promise.allSettled(t.map(t=>t.textDocumentCompletion(e))))}async textDocumentDefinition(e){let t=this.firstWithMethod(`textDocument/definition`);return t?t.textDocumentDefinition(e):null}async textDocumentDidOpen(e){return(await Promise.all(this.clients.map(t=>t.textDocumentDidOpen(e)))).some(e=>e!==!1)}async textDocumentDidClose(e){await Promise.all(this.clients.map(t=>t.textDocumentDidClose(e)))}async textDocumentWillSave(e){await Promise.all(this.clients.map(t=>t.textDocumentWillSave(e)))}async textDocumentWillSaveWaitUntil(e){let t=await Promise.allSettled(this.clients.map(t=>t.textDocumentWillSaveWaitUntil(e)));for(let e of t)if(e.status===`fulfilled`&&e.value?.length)return e.value;return null}async textDocumentDidSave(e){await Promise.all(this.clients.map(t=>t.textDocumentDidSave(e)))}async textDocumentHover(e){for(let t of this.clients){if(!t.hasCapability(`textDocument/hover`))continue;let n=await t.textDocumentHover(e);if(n)return n}return{contents:[]}}};function Wy(e){let t=[],n=!1;for(let r of e)if(r.status===`fulfilled`){let e=r.value;if(e==null)continue;Array.isArray(e)&&t.push(...e),`items`in e&&(t.push(...e.items),n||=e.isIncomplete)}return{items:t,isIncomplete:n}}function Gy(e){let t=ii.parse(e),n=``;return Kn(e,t,yn,(e,t)=>{let r=e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`);n+=t?`<span class="${t}">${r}</span>`:r},()=>{n+=`
87
+ `}),n}function Ky(){let e=new Rr.Renderer,t=e.code.bind(e);return e.code=e=>{let{text:n,lang:r}=e;return n.trim()?r===`python`||r===`py`?`<pre><code class="language-python">${Gy(n)}</code></pre>\n`:t(e):``},t=>Rr(t,{async:!1,gfm:!0,breaks:!0,renderer:e})}function qy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Jy(e,t){return typeof e[t]==`function`}var Yy=o(e=>{let t=e(wM);return z.fromEntries(t.cellIds.inOrderIds.map(e=>{let n=t.cellHandles[e]?.current?.editorViewOrNull;return[e,n?jA(n):t.cellData[e]?.code??``]}))});function Xy(e){return[...Zy(e),e].join(`
88
+ `)}function Zy(e){return Object.values(u.get(Yy)).filter(t=>t!==``&&t!==e).toSorted((e,t)=>e.startsWith(`import`)&&!t.startsWith(`import`)?-1:!e.startsWith(`import`)&&t.startsWith(`import`)?1:0)}var Qy=o(e=>e(wM).cellIds.inOrderIds),$y=o(e=>tb(e(Qy),e(jh))),eb=o(e=>({cellIds:e($y),codes:e(Yy)}));function tb(e,t){let n=new Map;e.forEach(e=>n.set(e,[]));let r=new Set(e),i=new Set(e);for(let{declaredBy:e,usedBy:a}of Object.values(t))for(let t of e){r.delete(t);for(let e of a)i.delete(e),e!==t&&n.get(t)?.push(e)}let a=new Map;e.forEach(e=>a.set(e,0)),n.forEach(e=>{e.forEach(e=>{a.set(e,(a.get(e)||0)+1)})});let o=[];a.forEach((e,t)=>{e===0&&o.push(t)});let s=[];for(;o.length>0;){let e=o.shift();if(!e)break;s.push(e),n.get(e)?.forEach(e=>{a.set(e,(a.get(e)||0)-1),a.get(e)===0&&o.push(e)})}return[...s.filter(e=>!r.has(e)),...r]}function nb(e,t){let n=new Map,r=0;e.forEach(e=>{n.set(e,r),r+=t[e].split(`
89
89
  `).length});function i(e){return n.has(e)||R.warn(`[lsp] no cell line offsets for`,e),n.get(e)??0}let a=e.map(e=>t[e]).join(`
90
- `);return{cellIds:e,mergedText:a,transformRange:(e,t)=>eb(e,i(t)),reverseRange:(e,t)=>eb(e,-i(t)),isInRange:(e,r)=>{let i=t[r].split(`
90
+ `);return{cellIds:e,mergedText:a,transformRange:(e,t)=>rb(e,i(t)),reverseRange:(e,t)=>rb(e,-i(t)),isInRange:(e,r)=>{let i=t[r].split(`
91
91
  `).length,a=n.get(r)||0,o=e.start.line-a,s=e.end.line-a,c=o>=0&&o<i,l=s>=0&&s<i;return c&&!l&&R.warn(`[lsp] Cross-cell diagnostic detected: range starts in cell but ends outside`,{cellId:r,range:e,cellLines:i,offset:a}),c&&l},getEditsForNewText:e=>{let r=e.split(`
92
92
  `),i=a.split(`
93
93
  `);if(r.length!==i.length)throw R.warn(`[lsp] cannot apply rename with new lines`,r,i),Error(`Cannot apply rename when there are new lines`);let o=[];for(let[e,i]of z.entries(t)){if(!n.has(e))continue;let t=n.get(e)??0,a=i.split(`
94
94
  `).length,s=r.slice(t,t+a);o.push({cellId:e,text:s.join(`
95
- `)})}return o},transformPosition:(e,t)=>tb(e,i(t)),reversePosition:(e,t)=>tb(e,-i(t))}}function eb(e,t){return{start:tb(e.start,t),end:tb(e.end,t)}}function tb(e,t){return{line:e.line+t,character:e.character}}var nb=/(?<!`):math:`([^\n`]+)`/g,rb=/:math:\s*<code>(.+?)<\/code>/gs,ib=/(?<!\S)\\\[(.+?)\\]/gs,ab=/\\\((.+?)\\\)/gs,ob=/(?<!\\)\$\$(.+?)(?<!\\)\$\$/gs,sb=/(?<![$\\])\$(?!\$)([^\n$]+?)(?<!\\)\$(?!\$)/g;function cb(e){return fb(e)?pb(e).map(e=>e.isFenced?e.text:mb(e.text.replaceAll(nb,(e,t)=>vb(t)).replaceAll(rb,(e,t)=>vb(t))).map(e=>e.isInlineCode?e.text:hb(e.text)).join(``)).join(`
96
- `):e}function lb(e){return e==null?e:Array.isArray(e)?e.map(e=>ub(e)):typeof e==`string`?cb(e):db(e)?e.kind===`markdown`?{...e,value:cb(e.value)}:fb(e.value)?{kind:`markdown`,value:cb(e.value)}:e:ub(e)}function ub(e){return typeof e==`string`?cb(e):e.language!==`markdown`&&e.language!==`md`?e:{...e,value:cb(e.value)}}function db(e){return typeof e==`object`&&`kind`in e&&`value`in e}function fb(e){return e.includes(`.. math::`)||e.includes(":math:`")||/(?<!\S)\\\[[\S\s]+?\\]/.test(e)||/\\\([\S\s]+?\\\)/.test(e)||/(?<!\\)\$\$[\S\s]+?(?<!\\)\$\$/.test(e)||/(?<![$\\])\$(?!\$)[^\n$]+?(?<!\\)\$(?!\$)/.test(e)||/:math:\s*<code>[\S\s]+?<\/code>/.test(e)}function pb(e){let t=e.split(`
95
+ `)})}return o},transformPosition:(e,t)=>ib(e,i(t)),reversePosition:(e,t)=>ib(e,-i(t))}}function rb(e,t){return{start:ib(e.start,t),end:ib(e.end,t)}}function ib(e,t){return{line:e.line+t,character:e.character}}var ab=/(?<!`):math:`([^\n`]+)`/g,ob=/:math:\s*<code>(.+?)<\/code>/gs,sb=/(?<!\S)\\\[(.+?)\\]/gs,cb=/\\\((.+?)\\\)/gs,lb=/(?<!\\)\$\$(.+?)(?<!\\)\$\$/gs,ub=/(?<![$\\])\$(?!\$)([^\n$]+?)(?<!\\)\$(?!\$)/g;function db(e){return hb(e)?gb(e).map(e=>e.isFenced?e.text:_b(e.text.replaceAll(ab,(e,t)=>xb(t)).replaceAll(ob,(e,t)=>xb(t))).map(e=>e.isInlineCode?e.text:vb(e.text)).join(``)).join(`
96
+ `):e}function fb(e){return e==null?e:Array.isArray(e)?e.map(e=>pb(e)):typeof e==`string`?db(e):mb(e)?e.kind===`markdown`?{...e,value:db(e.value)}:hb(e.value)?{kind:`markdown`,value:db(e.value)}:e:pb(e)}function pb(e){return typeof e==`string`?db(e):e.language!==`markdown`&&e.language!==`md`?e:{...e,value:db(e.value)}}function mb(e){return typeof e==`object`&&`kind`in e&&`value`in e}function hb(e){return e.includes(`.. math::`)||e.includes(":math:`")||/(?<!\S)\\\[[\S\s]+?\\]/.test(e)||/\\\([\S\s]+?\\\)/.test(e)||/(?<!\\)\$\$[\S\s]+?(?<!\\)\$\$/.test(e)||/(?<![$\\])\$(?!\$)[^\n$]+?(?<!\\)\$(?!\$)/.test(e)||/:math:\s*<code>[\S\s]+?<\/code>/.test(e)}function gb(e){let t=e.split(`
97
97
  `),n=[],r=[],i=!1,a=``,o=0,s=e=>{r.length!==0&&(n.push({text:r.join(`
98
- `),isFenced:e}),r=[])};for(let e of t){let t=e.match(/^[\t ]*(`{3,}|~{3,})/);if(t){let n=t[1],c=n[0],l=n.length;if(!i){s(!1),i=!0,a=c,o=l,r.push(e);continue}if(c===a&&l>=o){r.push(e),s(!0),i=!1,a=``,o=0;continue}}r.push(e)}return s(i),n}function mb(e){let t=[],n=``,r=!1,i=``,a=0;for(;a<e.length;){if(e[a]==="`"){let o=a;for(;o<e.length&&e[o]==="`";)o+=1;let s=e.slice(a,o);if(r&&s===i){n+=s,t.push({text:n,isInlineCode:!0}),n=``,r=!1,i=``,a=o;continue}if(!r){n&&=(t.push({text:n,isInlineCode:!1}),``),r=!0,i=s,n+=s,a=o;continue}}n+=e[a],a+=1}return n&&t.push({text:n,isInlineCode:r}),t}function hb(e){let t=_b(e);return t=t.replaceAll(ib,(e,t)=>yb(t)),t=t.replaceAll(ab,(e,t)=>vb(t)),t=t.replaceAll(ob,(e,t)=>yb(t)),t=t.replaceAll(sb,(e,t)=>vb(t)),t}function gb(e){return e.match(/^[\t ]*/)?.[0].replaceAll(` `,` `).length??0}function _b(e){let t=e.split(`
99
- `);if(t.length===0)return e;let n=[],r=0;for(;r<t.length;){let e=t[r],i=e.match(/^[\t ]*\.\.\s+math::(.*)$/);if(!i){n.push(e),r+=1;continue}let a=i[1]?.trim()??``,o=gb(e);r+=1;let s=[],c=a.includes(`\\begin`);if(a)s.push(a);else{for(;r<t.length;){let e=t[r];if(!e.trim()){r+=1;continue}if(!(gb(e)>o&&e.trim().startsWith(`:`)))break;r+=1}if(r<t.length){let e=t[r];c=!!e.trim()&&gb(e)<=o&&e.trimStart().startsWith(`\\`)}}if(c)for(;r<t.length&&t[r].trim();)s.push(t[r]),r+=1;else for(;r<t.length;){let e=t[r];if(!e.trim()){s.push(``),r+=1;continue}if(gb(e)<=o)break;s.push(e),r+=1}let l=s.filter(e=>!!e.trim());if(l.length===0){n.push(e);continue}let u=Math.min(...l.map(e=>gb(e))),d=s.map(e=>{if(!e)return``;let t=Math.min(u,gb(e));return e.slice(t)}).join(`
100
- `).trim();n.push(yb(d))}return n.join(`
101
- `)}function vb(e){return`<marimo-tex class="arithmatex">||(${e.trim()}||)</marimo-tex>`}function yb(e){return`<marimo-tex class="arithmatex">||[${e.trim()}||]</marimo-tex>`}function bb(e){return e.startsWith(`_`)&&!e.startsWith(`__`)}var xb=class{documentVersion=0;getNotebookCode;constructor(e){this.getNotebookCode=e}lastSnapshot=null;snapshot(){let e=this.getLens(),t=this.lastSnapshot?.mergedText!==e.mergedText;return t?(this.documentVersion++,this.lastSnapshot=e,{lens:e,didChange:t,version:this.documentVersion}):{lens:e,didChange:t,version:this.documentVersion}}getLatestSnapshot(){if(!this.lastSnapshot)throw Error(`No snapshots`);return{lens:this.lastSnapshot,version:this.documentVersion}}getLens(){let{cellIds:e,codes:t}=this.getNotebookCode();return $y(e,t)}},Sb=()=>{let e=WM().cellHandles;return z.mapValues(e,e=>e.current?.editorViewOrNull)};function Cb(e){let t=lb(e);return Array.isArray(t)?e:t}function wb(e){return{...e,documentation:Cb(e.documentation)}}function Tb(e){return e==null?null:Array.isArray(e)?e.map(e=>wb(e)):{...e,items:e.items.map(e=>wb(e))}}function Eb(e){return{...e,signatures:e.signatures.map(e=>({...e,documentation:Cb(e.documentation),parameters:e.parameters?.map(e=>({...e,documentation:Cb(e.documentation)}))}))}}function Db(e){return Wy(e)&&typeof e.line==`number`&&typeof e.character==`number`}function Ob(e){return Wy(e)&&Db(e.start)&&Db(e.end)}function kb(e){return Wy(e)&&typeof e.message==`string`&&Ob(e.range)}function Ab(e){if(e.method!==`textDocument/publishDiagnostics`||!Wy(e.params))return!1;let{uri:t,version:n,diagnostics:r}=e.params;return typeof t==`string`&&(n===void 0||typeof n==`number`)&&Array.isArray(r)&&r.every(kb)}var jb=class{documentUri;client;snapshotter;getNotebookEditors;initialSettings;seenCellDocumentUris=new Set;pruneSeenCellUris(e){for(let t of this.seenCellDocumentUris){let n=jy.parse(t);e.has(n)||this.seenCellDocumentUris.delete(t)}}completionItemCache=new bp(10);openCellDocumentCounts=new Map;latestDiagnosticsVersion=null;forwardedDiagnosticsVersion=0;constructor(e,t,n=Sb){this.documentUri=Ly(),this.getNotebookEditors=n,this.initialSettings=t,this.client=e,this.patchProcessNotification(),this.initializePromise.then(()=>{B(My(this.client),`notify is not a method on the client`),this.client.notify(`workspace/didChangeConfiguration`,{settings:t})}),this.snapshotter=new xb(this.getNotebookCode.bind(this))}onNotification(e){return this.client.onNotification(e)}get ready(){return this.client.ready}set ready(e){this.client.ready=e}get capabilities(){return this.client.capabilities}set capabilities(e){this.client.capabilities=e}get initializePromise(){return this.client.initializePromise}set initializePromise(e){this.client.initializePromise=e}get clientCapabilities(){return this.client.clientCapabilities}async initialize(){await this.client.initialize()}close(){this.openCellDocumentCounts.clear(),this.client.close()}hasCapability(e){return this.client.hasCapability(e)}async resyncAllDocuments(){B(My(this.client),`notify is not a method on the client`),await this.client.initialize(),await this.client.notify(`workspace/didChangeConfiguration`,{settings:this.initialSettings});let{lens:e,version:t}=this.snapshotter.snapshot();this.latestDiagnosticsVersion=null,this.forwardedDiagnosticsVersion=0,this.openCellDocumentCounts.size>0&&await this.client.notify(`textDocument/didOpen`,{textDocument:{languageId:`python`,text:e.mergedText,uri:this.documentUri,version:t}}),R.log(`[lsp] Document re-synchronization complete`)}getNotebookCode(){let{cellIds:e,codes:t}=u.get(Zy),n=this.getNotebookEditors();return{cellIds:e,codes:z.fromEntries(e.map(e=>{let r=n[e];return[e,r?OA(r):t[e]??``]}))}}assertCellDocumentUri(e){B(jy.is(e),`Execpted URI to be CellDocumentUri`)}async textDocumentDidOpen(e){R.debug(`[lsp] textDocumentDidOpen`,e);let t=e.textDocument.uri;this.assertCellDocumentUri(t);let{lens:n,version:r}=this.snapshotter.snapshot(),i=this.openCellDocumentCounts.get(t)??0;this.openCellDocumentCounts.set(t,i+1);try{let i=await this.client.textDocumentDidOpen({textDocument:{languageId:e.textDocument.languageId,text:n.mergedText,uri:this.documentUri,version:r}});return this.seenCellDocumentUris.add(t),i!==!1}catch(e){let n=this.openCellDocumentCounts.get(t)??0;throw n<=1?this.openCellDocumentCounts.delete(t):this.openCellDocumentCounts.set(t,n-1),e}}async textDocumentDidClose(e){let t=e.textDocument.uri;this.assertCellDocumentUri(t);let n=this.openCellDocumentCounts.get(t)??0;if(n===0){R.warn(`[lsp] textDocumentDidClose with no tracked open`,t);return}n<=1?this.openCellDocumentCounts.delete(t):this.openCellDocumentCounts.set(t,n-1),await this.client.textDocumentDidClose({textDocument:{uri:this.documentUri}})}async sync(){let{lens:e,version:t,didChange:n}=this.snapshotter.snapshot(),r={textDocument:{uri:this.documentUri,version:t},contentChanges:[{text:e.mergedText}]};return n&&await this.client.textDocumentDidChange(r),{params:r,lens:e}}async textDocumentDidChange(e){if(R.debug(`[lsp] textDocumentDidChange`,e),e.contentChanges.length===1){await this.sync();return}R.warn(`[lsp] Unhandled textDocumentDidChange`,e),await this.client.textDocumentDidChange(e)}async textDocumentWillSave(e){this.assertCellDocumentUri(e.textDocument.uri),await this.client.textDocumentWillSave({...e,textDocument:{uri:this.documentUri}})}async textDocumentWillSaveWaitUntil(e){return this.assertCellDocumentUri(e.textDocument.uri),R.debug(`[lsp] willSaveWaitUntil edits are disabled for notebook documents`),null}async textDocumentDidSave(e){this.assertCellDocumentUri(e.textDocument.uri);let{lens:t}=this.snapshotter.snapshot();await this.client.textDocumentDidSave({textDocument:{uri:this.documentUri},text:e.text===void 0?void 0:t.mergedText})}async textDocumentDefinition(e){let t=e.textDocument.uri;if(!jy.is(t))return R.warn(`Invalid cell document URI`,t),null;let{lens:n}=await this.sync(),r=jy.parse(t);return this.client.textDocumentDefinition({...e,textDocument:{uri:this.documentUri},position:n.transformPosition(e.position,r)})}async textDocumentSignatureHelp(e){let t=e.textDocument.uri;if(!jy.is(t))return R.warn(`Invalid cell document URI`,t),null;let{lens:n}=await this.sync(),r=jy.parse(t),i=await this.client.textDocumentSignatureHelp({...e,textDocument:{uri:this.documentUri},position:n.transformPosition(e.position,r)});return i?Eb(i):null}textDocumentCodeAction(e){return Promise.resolve(null)}codeActionResolve(e){return Promise.resolve(e)}reverseRelatedInformation(e,t){if(e)return e.map(e=>{if(!Wy(e)||!Wy(e.location)||e.location.uri!==this.documentUri||!Ob(e.location.range))return e;let n=t.cellIds.find(n=>t.isInRange(e.location.range,n));return n===void 0?e:{...e,location:{uri:jy.of(n),range:t.reverseRange(e.location.range,n)}}})}async textDocumentRename(e){let t=e.textDocument.uri;if(!jy.is(t))return R.warn(`Invalid cell document URI`,t),null;let n=jy.parse(t),{lens:r}=await this.sync(),i=r.transformPosition(e.position,n),a=await this.client.textDocumentRename({...e,textDocument:{uri:this.documentUri},position:i});if(!a)return null;let o=a.documentChanges?.flatMap(e=>`edits`in e?e.edits:[]);if(!o||o.length!==1)return R.warn(`Expected exactly one edit`,o),a;let s=o[0];if(!(`newText`in s))return R.warn(`Expected newText in edit`,s),a;let c=r.getEditsForNewText(s.newText),l=new Map(c.map(e=>[e.cellId,e.text])),u=this.getNotebookEditors(),d=u[n],f=!1;if(d){let t=d.state.doc.line(e.position.line+1).from+e.position.character,{startToken:n,endToken:r}=wg(d.state.doc,t),i=d.state.doc.sliceString(n,r);f=bb(i),f&&R.debug(`[lsp] Private variable rename detected, limiting to current cell`,i)}let p=[],m=0;for(let[e,t]of z.entries(u)){if(f&&e!==n)continue;let r=l.get(e);if(r==null){R.warn(`[lsp] No new code for cell during rename`,e),p.push(e);continue}if(!t){R.warn(`[lsp] No editor view for cell during rename`,e),p.push(e);continue}OA(t)!==r&&(kA(t,r),m++)}return p.length>0&&R.error(`[lsp] Rename partially failed: could not update ${p.length} cell(s)`,p),R.debug(`[lsp] Rename completed: updated ${m} cell(s)`),{...a,documentChanges:[{edits:[],textDocument:{uri:t,version:0}}]}}async completionItemResolve(e){let t=JSON.stringify(e),n=this.completionItemCache.get(t);if(n)return n;let r=this.client.completionItemResolve(e).then(e=>wb(e));return this.completionItemCache.set(t,r),r}async textDocumentPrepareRename(e){let t=e.textDocument.uri;if(!jy.is(t))return R.warn(`Invalid cell document URI`,t),null;let{lens:n}=await this.sync(),r=jy.parse(t);return this.client.textDocumentPrepareRename({...e,textDocument:{uri:this.documentUri},position:n.transformPosition(e.position,r)})}async textDocumentHover(e){R.debug(`[lsp] textDocumentHover`,e);let{lens:t}=await this.sync(),n=jy.parse(e.textDocument.uri),r=await this.client.textDocumentHover({...e,textDocument:{uri:this.documentUri},position:t.transformPosition(e.position,n)});return r?(typeof r.contents==`object`&&`kind`in r.contents&&(r.contents={kind:`markdown`,value:r.contents.value}),r.contents=lb(r.contents)??r.contents,r.contents===``?null:(r.range&&=t.reverseRange(r.range,n),r)):(R.debug(`[lsp] no hover result`),r)}async textDocumentCompletion(e){let{lens:t}=await this.sync();if(!jy.is(e.textDocument.uri))return R.error(`[lsp] Invalid cell document URI in completion request`,e.textDocument.uri),null;let n=jy.parse(e.textDocument.uri);if(!n||n===`undefined`)return R.error(`[lsp] Invalid cellId 'undefined' in completion request`,{cellId:n,uri:e.textDocument.uri,availableCellIds:t.cellIds}),null;t.cellIds.includes(n)||R.warn(`[lsp] CellId in completion request not found in current lens`,{cellId:n,uri:e.textDocument.uri,availableCellIds:t.cellIds});let r=t.transformPosition(e.position,n);return Tb(await this.client.textDocumentCompletion({...e,textDocument:{uri:this.documentUri},position:r}))}patchProcessNotification(){B(Ny(this.client),`processNotification is not a method on the client`);let e=this.client.processNotification.bind(this.client),t=t=>{if(Ab(t)){let n=t.params.version;if(n!=null){let e=this.latestDiagnosticsVersion;if(e!==null&&Number.isFinite(n)&&n<e){R.debug(`[lsp] dropping stale diagnostics notification`,t);return}this.latestDiagnosticsVersion=n}R.debug(`[lsp] handling diagnostics`,t);let r=this.snapshotter.getLatestSnapshot(),i=t.params.diagnostics,{lens:a}=r,o=++this.forwardedDiagnosticsVersion,s=new Map;for(let e of i)for(let t of a.cellIds)if(a.isInRange(e.range,t)){s.has(t)||s.set(t,[]);let n=this.reverseRelatedInformation(e.relatedInformation,a),r={...e,range:a.reverseRange(e.range,t),...n?{relatedInformation:n}:{}};s.get(t)?.push(r);break}let c=new Set(a.cellIds);this.pruneSeenCellUris(c);let l=new Set(this.seenCellDocumentUris);for(let[n,r]of s.entries()){R.debug(`[lsp] diagnostics for cell`,n,r);let i=jy.of(n);l.delete(i),e({...t,params:{...t.params,uri:i,version:o,diagnostics:r}})}if(l.size>0){R.debug(`[lsp] clearing diagnostics`,l);for(let t of l)e({method:`textDocument/publishDiagnostics`,params:{uri:t,version:o,diagnostics:[]}})}return}return e(t)};this.client.processNotification=t}},Mb=1e3,Nb=new Set([`textDocument/didOpen`,`textDocument/didChange`,`textDocument/didClose`]),Pb=new Set([`initialize`,`initialized`,`workspace/didChangeConfiguration`,`textDocument/didOpen`]),Fb=class{delegate;connectionPromise;isDelegateConnected=!1;connectionGeneration=0;restoringGeneration;isClosed=!1;hasConnectedBefore=!1;messageHandlers=new Set;pendingMessages=[];inFlightBacklog;hasLoggedQueueOverflow=!1;disposeDelegateMessage;disposeDelegateClose;options;onReconnect;constructor(e){this.options={...e,retries:e.retries??1,retryDelayMs:e.retryDelayMs??1e3},this.onReconnect=e.onReconnect}async connect(){if(this.isClosed)throw Error(`Transport is closed`);if(this.isDelegateConnected)return;if(this.connectionPromise)return this.connectionPromise;let e=++this.connectionGeneration,t=this.connectWithRetries(e).finally(()=>{this.connectionPromise===t&&(this.connectionPromise=void 0)});return this.connectionPromise=t,t}isStale(e){return this.isClosed||e!==this.connectionGeneration}send(e){if(!this.isClosed){if(this.delegate&&this.isDelegateConnected&&(this.restoringGeneration===void 0||this.canSendWhileRestoring(e))){this.delegate.send(e);return}this.pendingMessages.length<Mb?this.pendingMessages.push(e):this.hasLoggedQueueOverflow||(this.hasLoggedQueueOverflow=!0,R.error(`LSP reconnect queue is full (${Mb}); dropping messages until it drains`)),this.reconnect()}}onMessage(e){return this.messageHandlers.add(e),()=>{this.messageHandlers.delete(e)}}close(){this.isClosed||(this.isClosed=!0,this.isDelegateConnected=!1,this.restoringGeneration=void 0,this.connectionGeneration++,this.connectionPromise=void 0,this.pendingMessages=[],this.inFlightBacklog=void 0,this.messageHandlers.clear(),this.disposeDelegate(),this.delegate?.close(),this.delegate=void 0)}async connectWithRetries(e){let t;for(let n=1;n<=this.options.retries;n++)try{await this.connectDelegate(e);return}catch(r){if(t=r instanceof Error?r:Error(String(r)),this.isStale(e))throw t;this.invalidateDelegate(),R.warn(`WebSocket connection attempt ${n}/${this.options.retries} failed`,t),n<this.options.retries&&await new Promise(e=>setTimeout(e,this.options.retryDelayMs))}let n=t??Error(`WebSocket connection failed`);throw this.options.onConnectionFailure?.(n),n}async connectDelegate(e){if(await this.options.waitForConnection?.(),this.isStale(e))throw Error(`Connection attempt abandoned`);let t=this.createDelegate();if(await t.connect(),this.isStale(e)||this.delegate!==t)throw t.close(),Error(`Transport closed while connecting`);this.isDelegateConnected=!0;let n=this.hasConnectedBefore;this.hasConnectedBefore=!0;let r=this.detachPendingMessages();this.inFlightBacklog=r;try{if(n){this.restoringGeneration=e;try{await this.onReconnect?.()}finally{this.restoringGeneration===e&&(this.restoringGeneration=void 0)}}if(this.isStale(e)||this.delegate!==t||!this.isDelegateConnected)throw Error(`WebSocket closed while restoring LSP state`)}catch(t){throw this.isStale(e)||this.reclaimInFlightBacklog(),t}let i=n&&this.onReconnect?r.filter(e=>!(`method`in e&&Nb.has(e.method))):r;this.inFlightBacklog=void 0;for(let e of[...i,...this.detachPendingMessages()])t.send(e);R.log(`WebSocket transport connected successfully`)}detachPendingMessages(){let e=this.pendingMessages;return this.pendingMessages=[],this.hasLoggedQueueOverflow=!1,e}reclaimInFlightBacklog(){this.inFlightBacklog&&=(this.pendingMessages=[...this.inFlightBacklog,...this.pendingMessages].slice(0,Mb),void 0)}canSendWhileRestoring(e){return!(`method`in e)||Pb.has(e.method)}createDelegate(){this.invalidateDelegate();let e=new Od(this.options.getWsUrl());return this.delegate=e,this.disposeDelegateMessage=e.onMessage(e=>{for(let t of this.messageHandlers)try{t(e)}catch(e){R.error(`LSP message handler failed`,e)}}),this.disposeDelegateClose=e.onClose(t=>{this.delegate!==e||this.isClosed||(R.warn(`WebSocket transport connection closed`,t),this.isDelegateConnected=!1,this.disposeDelegate(),this.delegate=void 0,this.restoringGeneration=void 0,this.reclaimInFlightBacklog(),this.connectionPromise=void 0,queueMicrotask(()=>this.reconnect()))}),e}reconnect(){this.connect().catch(e=>{R.error(`WebSocket transport reconnection failed`,e)})}invalidateDelegate(){this.isDelegateConnected=!1,this.restoringGeneration=void 0,this.disposeDelegate(),this.delegate?.close(),this.delegate=void 0}disposeDelegate(){this.disposeDelegateMessage?.(),this.disposeDelegateMessage=void 0,this.disposeDelegateClose?.(),this.disposeDelegateClose=void 0}},Ib=new Set([1,2]);function Lb(e,t){if(!(`method`in t)||t.method!==`window/logMessage`)return;let n=t.params;!Wy(n)||typeof n.message!=`string`||EM({logs:[{timestamp:Date.now()/1e3,level:Ib.has(n.type)?`stderr`:`stdout`,message:n.message,source:{type:`lsp`,name:e}}]})}function Rb(e,t){let n=Se(),r=new Fb({getWsUrl:()=>n.getLSPURL(e).toString(),waitForConnection:async()=>{await ye()},onReconnect:t});return r.onMessage(t=>Lb(e,t)),r}Cn.define(),new On;function zb(e){return e.facet(hn.readOnly)}function Bb(e){return[un(e),pn.of([{key:`ArrowRight`,preventDefault:!0,run:t=>Vb(t,e)},{key:`Tab`,preventDefault:!0,run:t=>Vb(t,e)}])]}function Vb(e,t){if(zb(e.state))return!1;let n=e.state.doc.length;return n===0&&(e.dispatch({changes:{from:0,to:n,insert:t},selection:{head:t.length,anchor:t.length}}),!0)}function Hb(e){let{beforeText:t,linkText:n,afterText:r,onClick:i}=e;return[un(e=>{let a=document.createElement(`span`);a.append(document.createTextNode(t));let o=document.createElement(`span`);return o.textContent=n,o.classList.add(`cm-clickable-placeholder`),o.onclick=t=>{t.stopPropagation(),i(e)},a.append(o),a.append(document.createTextNode(r)),a}),Jn.theme({".cm-placeholder":{color:`var(--slate-8)`},".cm-clickable-placeholder":{cursor:`pointer !important`,pointerEvents:`auto`,color:`var(--slate-9)`,textDecoration:`underline`,textUnderlineOffset:`0.2em`},".cm-clickable-placeholder:hover":{color:`var(--sky-11)`}})]}var Ub=Or(e=>{let t,n={transport:Rb(`pylsp`,async()=>{await t?.()}),rootUri:Fy(),workspaceFolders:Iy()},r=e?.pylsp,i=[`D100`,`D103`],a=[`W292`,`E402`,`E302`,`E305`],o=[`B018`,`I001`],s={pylsp:{plugins:{marimo_plugin:{enabled:!0},jedi:{auto_import_modules:[`numpy`]},jedi_completion:{include_params:!0,resolve_at_most:50},flake8:{enabled:r?.enable_flake8,extendIgnore:a},pydocstyle:{enabled:r?.enable_pydocstyle,ignore:i},pylint:{enabled:r?.enable_pylint},pyflakes:{enabled:r?.enable_pyflakes},pylsp_mypy:{enabled:r?.enable_mypy,live_mode:!0},ruff:{enabled:r?.enable_ruff,extendIgnore:[...a,...i,...o]},signature:{formatter:r?.enable_ruff?`ruff`:`black`,line_length:88}}}},c=new jb(new Dd({...n}),s);return t=()=>c.resyncAllDocuments(),c}),Wb=Or(e=>{let t,n=new jb(new Dd({transport:Rb(`ty`,async()=>{await t?.()}),rootUri:Fy(),workspaceFolders:Iy(),getWorkspaceConfiguration:()=>[{disableLanguageServices:!0}]}),{});return t=()=>n.resyncAllDocuments(),n}),Gb=Or(e=>{let t,n=new jb(new Dd({transport:Rb(`pyrefly`,async()=>{await t?.()}),rootUri:Fy(),workspaceFolders:Iy(),initializationOptions:{pyrefly:{displayTypeErrors:e.diagnostics?.enabled??!1?`force-on`:`force-off`}}}),{});return t=()=>n.resyncAllDocuments(),n}),Kb=Or(e=>{let t,n=new jb(new Dd({transport:Rb(`basedpyright`,async()=>{await t?.()}),rootUri:Fy(),workspaceFolders:Iy()}),{});return t=()=>n.resyncAllDocuments(),n}),qb=class{parser=new Xm;type=`python`;defaultCode=this.parser.defaultCode;defaultMetadata=this.parser.defaultMetadata;transformIn(e){let t=this.parser.transformIn(e);return[t.code,t.offset,t.metadata]}transformOut(e,t){let n=this.parser.transformOut(e,t);return[n.code,n.offset]}isSupported(e){return this.parser.isSupported(e)}getExtension({cellId:e,completionConfig:t,hotkeys:n,placeholderType:r,lspConfig:i}){return[(()=>{let r={defaultKeymap:!1,activateOnTyping:t.activate_on_typing,closeOnBlur:!1},a={hideOnChange:!0},o=[];i?.pylsp?.enabled&&$h(`pylsp`)&&o.push(Ub(i)),i?.ty?.enabled&&$h(`ty`)&&o.push(Wb(i)),i?.pyrefly?.enabled&&$h(`pyrefly`)&&o.push(Gb(i)),i?.basedpyright?.enabled&&$h(`basedpyright`)&&o.push(Kb(i));let s=t.signature_hint_on_typing,c=s?/(\w+|\w+\.|\/)$/:/(\w+|\w+\.|\(|\/|,)$/;if(o.length>0){let t=o.length===1?o[0]:new By(o),l=e=>{R.debug(`openExternalLocation`,e),!(t.documentUri===e.uri||Py(e.uri))&&Hr().openFile({path:e.uri.replace(`file://`,``)})};return[qd({client:t,languageId:`python`,allowHTMLContent:!0,markdownRenderer:Uy(),useSnippetOnCompletion:!0,clientSideFiltering:!0,hoverConfig:a,completionConfig:r,diagnosticsEnabled:i.diagnostics?.enabled??!1,sendIncrementalChanges:!1,signatureHelpEnabled:!0,signatureActivateOnTyping:s,signatureHelpOptions:{position:`above`},keyboardShortcuts:{signatureHelp:n.getHotkey(`cell.signatureHelp`).key,goToDefinition:n.getHotkey(`cell.goToDefinition`).key,rename:n.getHotkey(`cell.renameSymbol`).key},completionMatchBefore:c,onGoToDefinition:l,onShowLocation:l}),gd.of(jy.of(e))]}return[Lr({...r,override:[Uv]}),Vv]})(),Xb(),Jb(r)]}};function Jb(e){return e===`marimo-import`?vn.highest(Bb(`import marimo as mo`)):e===`ai`?Hb({beforeText:`Start coding or `,linkText:`generate`,afterText:` with AI.`,onClick:e=>{e.state.facet(Df).aiCellCompletion()}}):[]}var Yb=ai.configure({props:[fn.add({ParenthesizedExpression:Tn,ArgList:Tn})]});function Xb(){return new Xn(Yb,[Yb.data.of({autocomplete:oi}),Yb.data.of({autocomplete:ci})])}function Zb(e){return typeof e==`object`&&!Array.isArray(e)&&!Qb(e)}function Qb(e){if(typeof e!=`object`||Array.isArray(e)||!(`self`in e)||!(`children`in e))return!1;let t=e.self;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.label==`string`}function $b(e){return Array.isArray(e)}function ex(e,t,n,r){let i=e.length;if(t===`string`||t===`completion`&&r&&$b(r))return`column`;if(t===`namespace`&&n){if($b(n))return`table`;if(Zb(n))return Object.values(n).some(e=>$b(e)||Qb(e)&&$b(e.children))?i<=1?`database`:`schema`:i===0?`database`:`namespace`}if(t===`completion`&&n)return $b(n)?`table`:(Zb(n)&&Object.values(n).some(e=>$b(e)||Qb(e)&&$b(e.children)),i<=1?`database`:`schema`);switch(i){case 0:return`database`;case 1:return`schema`;default:return`namespace`}}function tx(e,t,n={}){let{maxDepth:r=10}=n;if((typeof t==`string`?t===``:t.length===0)&&Qb(e)){let t=ex([],`completion`,e.children);return{completion:e.self,path:[],type:`completion`,semanticType:t,namespace:e.children}}let i=(typeof t==`string`?t.split(`.`):t).filter(e=>e.length>0);return i.length===0||i.length>r?null:nx(e,i,[],n)}function nx(e,t,n,r,i){if(t.length===0){if(Qb(e)){let t=ex(n,`completion`,e.children,i);return{completion:e.self,path:n,type:`completion`,semanticType:t,namespace:e.children}}return{path:n,type:`namespace`,semanticType:ex(n,`namespace`,e,i),namespace:e}}let[a,...o]=t,{caseSensitive:s=!1}=r;if(!a)return null;if(Zb(e)){let t=s?Object.keys(e).find(e=>e===a):Object.keys(e).find(e=>e.toLowerCase()===a.toLowerCase());if(t){let i=e[t];if(i)return nx(i,o,[...n,t],r,e)}}else if(Qb(e))return nx(e.children,t,n,r,e);else if($b(e)){for(let t of e)if(typeof t==`string`){if((s?t===a:t.toLowerCase()===a.toLowerCase())&&o.length===0){let r=ex([...n,t],`string`,void 0,e);return{value:t,path:[...n,t],type:`string`,semanticType:r}}}else if((s?t.label===a:t.label.toLowerCase()===a.toLowerCase())&&o.length===0){let r=ex([...n,t.label],`completion`,void 0,e);return{completion:t,path:[...n,t.label],type:`completion`,semanticType:r}}}return null}function rx(e,t,n={}){let r=[];if(t.includes(`.`)){let r=t.lastIndexOf(`.`),i=t.substring(0,r),a=t.substring(r+1),o=tx(e,i,n);if(o?.namespace)return ix(o.namespace,a,o.path,n)}else return ix(e,t,[],n);return r}function ix(e,t,n,r){let i=[],{caseSensitive:a=!1,allowPartialMatch:o=!0}=r;if(Zb(e)){for(let[r,s]of Object.entries(e))if(o?a?r.startsWith(t):r.toLowerCase().startsWith(t.toLowerCase()):a?r===t:r.toLowerCase()===t.toLowerCase()){if(Qb(s)){let t=ex([...n,r],`completion`,s.children,e);i.push({completion:s.self,path:[...n,r],type:`completion`,semanticType:t,namespace:s.children})}else{let t=ex([...n,r],`namespace`,s,e);i.push({path:[...n,r],type:`namespace`,semanticType:t,namespace:s})}}}else if(Qb(e)){if(o?a?e.self.label.startsWith(t):e.self.label.toLowerCase().startsWith(t.toLowerCase()):a?e.self.label===t:e.self.label.toLowerCase()===t.toLowerCase()){let t=ex([...n,e.self.label],`completion`,e.children);i.push({completion:e.self,path:[...n,e.self.label],type:`completion`,semanticType:t,namespace:e.children})}i.push(...ix(e.children,t,n,r))}else if($b(e)){for(let r of e)if(typeof r==`string`){if(o?a?r.startsWith(t):r.toLowerCase().startsWith(t.toLowerCase()):a?r===t:r.toLowerCase()===t.toLowerCase()){let t=ex([...n,r],`string`,void 0,e);i.push({value:r,path:[...n,r],type:`string`,semanticType:t})}}else if(o?a?r.label.startsWith(t):r.label.toLowerCase().startsWith(t.toLowerCase()):a?r.label===t:r.label.toLowerCase()===t.toLowerCase()){let t=ex([...n,r.label],`completion`,void 0,e);i.push({completion:r,path:[...n,r.label],type:`completion`,semanticType:t})}}return i}function ax(e,t,n={}){let r=[],{maxDepth:i=10}=n;ox(e,[],r,i);let{caseSensitive:a=!1}=n;return r.filter(e=>e.path.some(e=>a?e===t:e.toLowerCase()===t.toLowerCase())).sort((e,n)=>{let r=a?e.path[e.path.length-1]===t:e.path[e.path.length-1]?.toLowerCase()===t.toLowerCase(),i=a?n.path[n.path.length-1]===t:n.path[n.path.length-1]?.toLowerCase()===t.toLowerCase();return r&&!i?-1:!r&&i?1:e.path.length-n.path.length})}function ox(e,t,n,r){if(!(t.length>=r)){if(Zb(e))for(let[i,a]of Object.entries(e)){let o=[...t,i];if(Qb(a)){let t=ex(o,`completion`,a.children,e);n.push({completion:a.self,path:o,type:`completion`,semanticType:t,namespace:a.children}),ox(a.children,o,n,r)}else{let t=ex(o,`namespace`,a,e);n.push({path:o,type:`namespace`,semanticType:t,namespace:a}),ox(a,o,n,r)}}else if(Qb(e)){let i=ex(t,`completion`,e.children);n.push({completion:e.self,path:t,type:`completion`,semanticType:i,namespace:e.children}),ox(e.children,t,n,r)}else if($b(e))for(let r of e)if(typeof r==`string`){let i=ex([...t,r],`string`,void 0,e);n.push({value:r,path:[...t,r],type:`string`,semanticType:i})}else{let i=ex([...t,r.label],`completion`,void 0,e);n.push({completion:r,path:[...t,r.label],type:`completion`,semanticType:i})}}}function sx(e,t,n={}){let{enableFuzzySearch:r=!1}=n,i=tx(e,t,n);if(i)return i;let a=rx(e,t,n);if(a.length>0)return a[0]||null;if(r){let r=ax(e,t,n);if(r.length>0)return r[0]||null}return null}var cx=bn.define({combine:e=>e[0]??null});function lx(e,t){let n=e??t.state.facet(cx);return n==null?null:typeof n==`function`?n(t):n}function ux(e,t){let n=e??t.state.facet(cx);return n==null?null:typeof n==`function`?t.view?n(t.view):null:n}function dx(e){if(e==null)return null;let t=Qb(e)?e.children:e;return $b(t)?t:null}function fx(e,t){let n=dx(tx(e,t,{caseSensitive:!1})?.namespace);if(n)return n;let r=(typeof t==`string`?t.split(`.`):t).map(e=>e.toLowerCase()),i=r[r.length-1];if(!i)return null;let a=ax(e,i).filter(e=>{if(dx(e.namespace)===null||e.path.length<r.length)return!1;let t=e.path.slice(-r.length).map(e=>e.toLowerCase());return r.every((e,n)=>t[n]===e)});return a.length===1?dx(a[0]?.namespace):null}function px(e,t,n){if(typeof e==`string`)return n===void 0?{label:e,type:`property`,detail:t}:{label:e,type:`property`,detail:t,boost:n};let r={...e,type:`property`,detail:e.detail??t};return n!==void 0&&r.boost===void 0&&(r.boost=n),r}var mx=e=>{let t;return async()=>(t||=e(),await t)},hx=class{opts;parser=null;offsetRecord={};constructor(e={}){this.opts=e}getParser=mx(async()=>{if(this.parser)return this.parser;let t=await W(()=>import(`./node-sql-parser-DDkYZCP2.js`).then(t=>e(t.default,1)),__vite__mapDeps([213,1]),import.meta.url),{Parser:n}=t.default||t;return this.parser=new n,this.parser});async parse(e,t){this.offsetRecord={};let n=this.opts.getParserOptions?.(t.state),r=await this.sanitizeSql(e,n);try{let e=await this.getParser();return n?.database===`DuckDB`?this.parseWithDuckDBSupport(r,n):{success:!0,errors:[],ast:e.astify(r,n)}}catch(e){return{success:!1,errors:[this.extractErrorInfo(e,r)]}}}async sanitizeSql(e,t){if(t?.ignoreBrackets){let{sql:t,offsetRecord:n}=vx(e);return this.offsetRecord=n,t}return e}async parseWithDuckDBSupport(e,t){let n=await this.getParser(),r=gx(e).trimStart().toLowerCase();if(r.startsWith(`from`)||r.includes(`macro`))return{success:!0,errors:[]};let i=e;r.includes(`create or replace table`)&&(this.offsetRecord[e.indexOf(`create or replace table`)]=-11,i=e.replace(/create or replace table/i,`create table`));try{let e={...t,database:`PostgreSQL`};return{success:!0,errors:[],ast:n.astify(i,e)}}catch(t){return{success:!1,errors:[this.extractErrorInfo(t,e)]}}}extractErrorInfo(e,t){let n=1,r=1,i=e?.message||`SQL parsing error`,a=e;if(a?.location)n=a.location.start?.line||1,r=a.location.start?.column||1;else if(a?.hash)n=a.hash.line||1,r=a.hash.loc?.first_column||1;else{let e=i.match(/line (\d+)/i),t=i.match(/column (\d+)/i);e?.[1]&&(n=parseInt(e[1],10)),t?.[1]&&(r=parseInt(t[1],10))}let o=Object.entries(this.offsetRecord).map(([e,t])=>({position:parseInt(e,10),offset:t})).sort((e,t)=>e.position-t.position),s=0;for(let{position:e,offset:i}of o){let a=e+s;s+=i;let o=t.slice(0,a),c=(o.match(/\n/g)?.length??0)+1,l=a-o.lastIndexOf(`
102
- `);n===c&&r>l&&(r-=i)}return r>t.length&&(r=t.length),{message:this.cleanErrorMessage(i),line:Math.max(1,n),column:Math.max(1,r),severity:`error`}}cleanErrorMessage(e){return e.replace(/^Error: /,``).replace(/Expected .* but .* found\./i,e=>e.replace(/but .* found/,`found unexpected token`)).trim()}async validateSql(e,t){return(await this.parse(e,t)).errors}async extractTableReferences(e,t){let n=t?this.opts.getParserOptions?.(t.state):void 0;try{return(await this.getParser()).tableList(e,n).map(e=>{let t=e.split(`::`);return t[t.length-1]||e})}catch{return[]}}async extractColumnReferences(e,t){let n=t?.state?this.opts.getParserOptions?.(t.state):void 0;try{return(await this.getParser()).columnList(e,n).map(e=>{let t=e.split(`::`);return t[t.length-1]||e})}catch{return[]}}};function gx(e,t=[`/*`,`--`]){let n=[];if(t.includes(`/*`)&&n.push(`/\\*[\\s\\S]*?\\*/`),t.includes(`--`)&&n.push(`--[^\\n]*`),n.length===0)return e;let r=RegExp(`^\\s*(${n.join(`|`)})\\s*`,``),i=e,a=``;for(;i!==a;)a=i,i=i.replace(r,``);return i}var _x=2;function vx(e){let t={};return{sql:e.replace(/("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\{[^}]*\})/g,(e,n,r,i,a)=>n||r?e:i?(t[a]=_x,`'${i}'`):e),offsetRecord:t}}function yx(){return{tables:[],ctes:[],aliases:new Map,selectAliases:[]}}function bx(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xx(e){return Array.isArray(e)?e:[]}function Sx(e){let t=e[0],n=e[e.length-1];return e.length>=2&&(t===`"`&&n===`"`||t===`'`&&n===`'`||t==="`"&&n==="`"||t===`[`&&n===`]`)?e.slice(1,-1):e}function Cx(e){return typeof e==`string`?e:bx(e)&&typeof e.value==`string`?e.value:null}function wx(e){if(!bx(e)||e.type!==`column_ref`)return null;let t=e.column;if(typeof t==`string`)return t;if(bx(t)){let e=t.expr,n=bx(e)?e.value:t.value;if(typeof n==`string`)return n}return null}function Tx(e){let t=xx(e.columns).map(e=>Cx(e)??wx(e)??Cx(e.column)).filter(e=>typeof e==`string`);if(t.length>0)return t;let n=e.stmt,r=bx(n)?n.ast??n:null;if(!bx(r)||r.type!==`select`)return[];let i=[];for(let e of xx(r.columns))if(typeof e.as==`string`)i.push(e.as);else{let t=wx(e.expr);t&&t!==`*`&&i.push(t)}return i}function Ex(e,t){if(typeof e.table!=`string`||e.table.length===0)return;let n=[e.db??e.catalog,e.schema,e.table].filter(e=>typeof e==`string`&&e.length>0).map(Sx),r=typeof e.as==`string`?Sx(e.as):void 0,i=`${n.join(`.`).toLowerCase()}::${r?.toLowerCase()??``}`;t.seenTables.has(i)||(t.seenTables.add(i),t.tables.push({name:Sx(e.table),path:n,...r?{alias:r}:{}}))}function Dx(e,t,n){if(Array.isArray(e)){for(let r of e)Dx(r,t,n);return}if(!(!bx(e)||n.has(e))){n.add(e);for(let n of xx(e.with)){let e=Cx(n.name);e&&!t.seenCtes.has(e.toLowerCase())&&(t.seenCtes.add(e.toLowerCase()),t.ctes.push({name:Sx(e),columns:Tx(n).map(Sx),from:-1,to:-1}))}for(let n of[`from`,`table`])for(let r of xx(e[n]))Ex(r,t);for(let[r,i]of Object.entries(e))r!==`loc`&&r!==`tableList`&&r!==`columnList`&&Dx(i,t,n)}}function Ox(e,t){if(e.type===`select`)for(let n of xx(e.columns))typeof n.as==`string`&&t.selectAliases.push(Sx(n.as))}function kx(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=`(?:"${n}"|\`${n}\`|\\[${n}\\]|\\b${n})`,i=RegExp(`(${r})\\s*(?:\\([^)]*\\)\\s*)?AS\\s*\\(`,`i`).exec(e);return!i||i.index<0||!i[1]?{from:-1,to:-1}:{from:i.index,to:i.index+i[1].length}}var Ax=new Set(`as.on.using.where.join.inner.left.right.full.cross.outer.natural.lateral.group.order.limit.offset.having.union.intersect.except.select.set.values.when.then.and.or.not.in.is.asc.desc.fetch.window.qualify.returning.with`.split(`.`)),jx=String.raw`(?:[\w$]+|"[^"]+"|\`[^\`]+\`|\[[^\]]+\])`,Mx=`(?!(?:${[...Ax].join(`|`)})\\b)`,Nx=new RegExp(String.raw`\b(?:from|join)\s+(${jx}(?:\.${jx})*)(?:\s+(?:as\s+)?${Mx}(${jx}))?`,`gi`);function Px(e){let t=e.split(``),n=0;for(;n<e.length;){let r=e[n],i=e[n+1];if(r===`-`&&i===`-`){for(;n<e.length&&e[n]!==`
103
- `;)t[n]=` `,n++;continue}if(r===`/`&&i===`*`){for(t[n]=` `,t[n+1]=` `,n+=2;n<e.length&&(e[n]!==`*`||e[n+1]!==`/`);)t[n]=` `,n++;n<e.length&&(t[n]=` `,t[n+1]=` `,n+=2);continue}if(r===`"`||r==="`"||r===`[`){let t=r===`[`?`]`:r;for(n++;n<e.length&&e[n]!==t;)n++;n++;continue}if(r===`'`){for(t[n]=` `,n++;n<e.length;){if(e[n]===`'`){if(t[n]=` `,e[n+1]===`'`){t[n+1]=` `,n+=2;continue}n++;break}t[n]=` `,n++}continue}n++}return t.join(``)}function Fx(e){let t={tables:[],ctes:[],selectAliases:[],seenTables:new Set,seenCtes:new Set},n=Px(e);Ix(n,t),Nx.lastIndex=0;let r=Nx.exec(n);for(;r!==null;){let e=r[1],i=r[2];if(e){let n=e.split(`.`).map(Sx),r=n[n.length-1]??``,a=i&&!Ax.has(i.toLowerCase())?Sx(i):void 0,o=`${n.join(`.`).toLowerCase()}::${a?.toLowerCase()??``}`;r&&!t.seenTables.has(o)&&(t.seenTables.add(o),t.tables.push({name:r,path:n,...a?{alias:a}:{}}))}r=Nx.exec(n)}return zx(t)}function Ix(e,t){let n=/\bWITH\s+(?:RECURSIVE\s+)?/gi,r=new RegExp(String.raw`^(${jx})\s*(?:\(([^)]*)\)\s*)?AS\s*\(`,`i`),i=n.exec(e);for(;i!==null;){let a=i.index+i[0].length;for(;;){let n=r.exec(e.slice(a)),i=n?.[1],o=i?Sx(i):void 0;if(!n||!i||!o)break;let s=a+n[0].length,c=s,l=1;for(;c<e.length&&l>0;)e[c]===`(`?l++:e[c]===`)`&&l--,c++;if(!t.seenCtes.has(o.toLowerCase())){t.seenCtes.add(o.toLowerCase());let r=(n[2]??``).split(`,`).map(e=>Sx(e.trim())).filter(e=>e.length>0);t.ctes.push({name:o,columns:r.length>0?r:Rx(e.slice(s,Math.max(s,c-1))),from:a,to:a+i.length})}let u=/^\s*,\s*/.exec(e.slice(c));if(!u)break;a=c+u[0].length}i=n.exec(e)}}function Lx(e){let t=[],n=0,r=``;for(let i of e)i===`(`?n++:i===`)`&&(n=Math.max(0,n-1)),i===`,`&&n===0?(t.push(r),r=``):r+=i;return t.push(r),t}function Rx(e){let t=/^\s*SELECT\s+(?:DISTINCT\s+)?([\s\S]*?)\s+FROM\s/i.exec(e);if(!t||!t[1])return[];let n=[];for(let e of Lx(t[1])){let t=e.trim(),r=new RegExp(String.raw`\s+AS\s+(${jx})$`,`i`).exec(t);if(r?.[1]){n.push(Sx(r[1]));continue}if(/^(?:[\w$]+\.)*[\w$]+$/.test(t)){let e=t.split(`.`),r=e[e.length-1];r&&r!==`*`&&n.push(r)}}return n}function zx(e){let t=new Map;for(let n of e.tables)if(n.alias){let e=n.alias.toLowerCase();t.has(e)||t.set(e,n.path.join(`.`))}return{tables:e.tables,ctes:e.ctes,aliases:t,selectAliases:e.selectAliases}}async function Bx(e,t,n){if(!e.trim())return yx();let r=null;try{let i=await t.parse(e,n);i.success&&i.ast!=null&&(r=i.ast)}catch{}if(r==null)return Fx(e);try{let t={tables:[],ctes:[],selectAliases:[],seenTables:new Set,seenCtes:new Set},n=Array.isArray(r)?r:[r];for(let e of n)bx(e)&&Ox(e,t);Dx(r,t,new Set);let i=Px(e);for(let e of t.ctes){let t=kx(i,e.name);e.from=t.from,e.to=t.to}return zx(t)}catch{return Fx(e)}}var Vx=class{parser;cache=new Map;MAX_CACHE_SIZE=20;constructor(e=new hx){this.parser=e}async getContext(e,t){let n=this.cache.get(e);if(n)return n;let r=await Bx(e,this.parser,t);if(this.cache.set(e,r),this.cache.size>this.MAX_CACHE_SIZE){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}return r}clearCache(){this.cache.clear()}},Hx=class{parser;cache=new Map;MAX_CACHE_SIZE=10;constructor(e){this.parser=e}async analyzeDocument(e){let t=e.doc.toString(),n=this.cache.get(t);if(n)return n;let r=await this.extractStatements(t,e);if(this.cache.set(t,r),this.cache.size>this.MAX_CACHE_SIZE){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}return r}async getStatementAtPosition(e,t){return(await this.analyzeDocument(e)).find(e=>t>=e.from&&t<=e.to)||null}async getStatementsInRange(e,t,n){return(await this.analyzeDocument(e)).filter(e=>e.from<=n&&e.to>=t)}async extractStatements(e,t){let n=[],r=this.splitByStatementSeparators(e),i=0;for(let e of r){let r=e.trim();if(r.length===0){i+=e.length;continue}let a=i+e.indexOf(r),o=a+r.length,s=t.doc.lineAt(a),c=t.doc.lineAt(o),l=this.stripComments(r);if(l.trim().length===0||l.trim()===`;`){i+=e.length;continue}let u=await this.parser.parse(r,{state:t}),d=this.determineStatementType(l),f=l.endsWith(`;`)?l.slice(0,-1).trim():l.trim();n.push({from:a,to:o,lineFrom:s.number,lineTo:c.number,content:f,type:d,isValid:u.success,errors:u.errors??[]}),i+=e.length}return n}splitByStatementSeparators(e){let t=[],n=``,r=!1,i=``,a=!1,o=!1,s=0;for(;s<e.length;){let c=e[s],l=e[s+1];if(!r&&!o&&c===`-`&&l===`-`){a=!0,n+=c+l,s+=2;continue}if(!r&&!a&&c===`/`&&l===`*`){o=!0,n+=c+l,s+=2;continue}if(o&&c===`*`&&l===`/`){o=!1,n+=c+l,s+=2;continue}if(a&&(c===`
98
+ `),isFenced:e}),r=[])};for(let e of t){let t=e.match(/^[\t ]*(`{3,}|~{3,})/);if(t){let n=t[1],c=n[0],l=n.length;if(!i){s(!1),i=!0,a=c,o=l,r.push(e);continue}if(c===a&&l>=o){r.push(e),s(!0),i=!1,a=``,o=0;continue}}r.push(e)}return s(i),n}function _b(e){let t=[],n=``,r=!1,i=``,a=0;for(;a<e.length;){if(e[a]==="`"){let o=a;for(;o<e.length&&e[o]==="`";)o+=1;let s=e.slice(a,o);if(r&&s===i){n+=s,t.push({text:n,isInlineCode:!0}),n=``,r=!1,i=``,a=o;continue}if(!r){n&&=(t.push({text:n,isInlineCode:!1}),``),r=!0,i=s,n+=s,a=o;continue}}n+=e[a],a+=1}return n&&t.push({text:n,isInlineCode:r}),t}function vb(e){let t=bb(e);return t=t.replaceAll(sb,(e,t)=>Sb(t)),t=t.replaceAll(cb,(e,t)=>xb(t)),t=t.replaceAll(lb,(e,t)=>Sb(t)),t=t.replaceAll(ub,(e,t)=>xb(t)),t}function yb(e){return e.match(/^[\t ]*/)?.[0].replaceAll(` `,` `).length??0}function bb(e){let t=e.split(`
99
+ `);if(t.length===0)return e;let n=[],r=0;for(;r<t.length;){let e=t[r],i=e.match(/^[\t ]*\.\.\s+math::(.*)$/);if(!i){n.push(e),r+=1;continue}let a=i[1]?.trim()??``,o=yb(e);r+=1;let s=[],c=a.includes(`\\begin`);if(a)s.push(a);else{for(;r<t.length;){let e=t[r];if(!e.trim()){r+=1;continue}if(!(yb(e)>o&&e.trim().startsWith(`:`)))break;r+=1}if(r<t.length){let e=t[r];c=!!e.trim()&&yb(e)<=o&&e.trimStart().startsWith(`\\`)}}if(c)for(;r<t.length&&t[r].trim();)s.push(t[r]),r+=1;else for(;r<t.length;){let e=t[r];if(!e.trim()){s.push(``),r+=1;continue}if(yb(e)<=o)break;s.push(e),r+=1}let l=s.filter(e=>!!e.trim());if(l.length===0){n.push(e);continue}let u=Math.min(...l.map(e=>yb(e))),d=s.map(e=>{if(!e)return``;let t=Math.min(u,yb(e));return e.slice(t)}).join(`
100
+ `).trim();n.push(Sb(d))}return n.join(`
101
+ `)}function xb(e){return`<marimo-tex class="arithmatex">||(${e.trim()}||)</marimo-tex>`}function Sb(e){return`<marimo-tex class="arithmatex">||[${e.trim()}||]</marimo-tex>`}function Cb(e){return e.startsWith(`_`)&&!e.startsWith(`__`)}var wb=class{documentVersion=0;getNotebookCode;constructor(e){this.getNotebookCode=e}lastSnapshot=null;snapshot(){let e=this.getLens(),t=this.lastSnapshot?.mergedText!==e.mergedText;return t?(this.documentVersion++,this.lastSnapshot=e,{lens:e,didChange:t,version:this.documentVersion}):{lens:e,didChange:t,version:this.documentVersion}}getLatestSnapshot(){if(!this.lastSnapshot)throw Error(`No snapshots`);return{lens:this.lastSnapshot,version:this.documentVersion}}getLens(){let{cellIds:e,codes:t}=this.getNotebookCode();return nb(e,t)}},Tb=()=>{let e=qM().cellHandles;return z.mapValues(e,e=>e.current?.editorViewOrNull)};function Eb(e){let t=fb(e);return Array.isArray(t)?e:t}function Db(e){return{...e,documentation:Eb(e.documentation)}}function Ob(e){return e==null?null:Array.isArray(e)?e.map(e=>Db(e)):{...e,items:e.items.map(e=>Db(e))}}function kb(e){return{...e,signatures:e.signatures.map(e=>({...e,documentation:Eb(e.documentation),parameters:e.parameters?.map(e=>({...e,documentation:Eb(e.documentation)}))}))}}function Ab(e){return qy(e)&&typeof e.line==`number`&&typeof e.character==`number`}function jb(e){return qy(e)&&Ab(e.start)&&Ab(e.end)}function Mb(e){return qy(e)&&typeof e.message==`string`&&jb(e.range)}function Nb(e){if(e.method!==`textDocument/publishDiagnostics`||!qy(e.params))return!1;let{uri:t,version:n,diagnostics:r}=e.params;return typeof t==`string`&&(n===void 0||typeof n==`number`)&&Array.isArray(r)&&r.every(Mb)}var Pb=class{documentUri;client;snapshotter;getNotebookEditors;initialSettings;seenCellDocumentUris=new Set;pruneSeenCellUris(e){for(let t of this.seenCellDocumentUris){let n=Py.parse(t);e.has(n)||this.seenCellDocumentUris.delete(t)}}completionItemCache=new Cp(10);openCellDocumentCounts=new Map;latestDiagnosticsVersion=null;forwardedDiagnosticsVersion=0;constructor(e,t,n=Tb){this.documentUri=By(),this.getNotebookEditors=n,this.initialSettings=t,this.client=e,this.patchProcessNotification(),this.initializePromise.then(()=>{B(Fy(this.client),`notify is not a method on the client`),this.client.notify(`workspace/didChangeConfiguration`,{settings:t})}),this.snapshotter=new wb(this.getNotebookCode.bind(this))}onNotification(e){return this.client.onNotification(e)}get ready(){return this.client.ready}set ready(e){this.client.ready=e}get capabilities(){return this.client.capabilities}set capabilities(e){this.client.capabilities=e}get initializePromise(){return this.client.initializePromise}set initializePromise(e){this.client.initializePromise=e}get clientCapabilities(){return this.client.clientCapabilities}async initialize(){await this.client.initialize()}close(){this.openCellDocumentCounts.clear(),this.client.close()}hasCapability(e){return this.client.hasCapability(e)}async resyncAllDocuments(){B(Fy(this.client),`notify is not a method on the client`),await this.client.initialize(),await this.client.notify(`workspace/didChangeConfiguration`,{settings:this.initialSettings});let{lens:e,version:t}=this.snapshotter.snapshot();this.latestDiagnosticsVersion=null,this.forwardedDiagnosticsVersion=0,this.openCellDocumentCounts.size>0&&await this.client.notify(`textDocument/didOpen`,{textDocument:{languageId:`python`,text:e.mergedText,uri:this.documentUri,version:t}}),R.log(`[lsp] Document re-synchronization complete`)}getNotebookCode(){let{cellIds:e,codes:t}=u.get(eb),n=this.getNotebookEditors();return{cellIds:e,codes:z.fromEntries(e.map(e=>{let r=n[e];return[e,r?jA(r):t[e]??``]}))}}assertCellDocumentUri(e){B(Py.is(e),`Execpted URI to be CellDocumentUri`)}async textDocumentDidOpen(e){R.debug(`[lsp] textDocumentDidOpen`,e);let t=e.textDocument.uri;this.assertCellDocumentUri(t);let{lens:n,version:r}=this.snapshotter.snapshot(),i=this.openCellDocumentCounts.get(t)??0;this.openCellDocumentCounts.set(t,i+1);try{let i=await this.client.textDocumentDidOpen({textDocument:{languageId:e.textDocument.languageId,text:n.mergedText,uri:this.documentUri,version:r}});return this.seenCellDocumentUris.add(t),i!==!1}catch(e){let n=this.openCellDocumentCounts.get(t)??0;throw n<=1?this.openCellDocumentCounts.delete(t):this.openCellDocumentCounts.set(t,n-1),e}}async textDocumentDidClose(e){let t=e.textDocument.uri;this.assertCellDocumentUri(t);let n=this.openCellDocumentCounts.get(t)??0;if(n===0){R.warn(`[lsp] textDocumentDidClose with no tracked open`,t);return}n<=1?this.openCellDocumentCounts.delete(t):this.openCellDocumentCounts.set(t,n-1),await this.client.textDocumentDidClose({textDocument:{uri:this.documentUri}})}async sync(){let{lens:e,version:t,didChange:n}=this.snapshotter.snapshot(),r={textDocument:{uri:this.documentUri,version:t},contentChanges:[{text:e.mergedText}]};return n&&await this.client.textDocumentDidChange(r),{params:r,lens:e}}async textDocumentDidChange(e){if(R.debug(`[lsp] textDocumentDidChange`,e),e.contentChanges.length===1){await this.sync();return}R.warn(`[lsp] Unhandled textDocumentDidChange`,e),await this.client.textDocumentDidChange(e)}async textDocumentWillSave(e){this.assertCellDocumentUri(e.textDocument.uri),await this.client.textDocumentWillSave({...e,textDocument:{uri:this.documentUri}})}async textDocumentWillSaveWaitUntil(e){return this.assertCellDocumentUri(e.textDocument.uri),R.debug(`[lsp] willSaveWaitUntil edits are disabled for notebook documents`),null}async textDocumentDidSave(e){this.assertCellDocumentUri(e.textDocument.uri);let{lens:t}=this.snapshotter.snapshot();await this.client.textDocumentDidSave({textDocument:{uri:this.documentUri},text:e.text===void 0?void 0:t.mergedText})}async textDocumentDefinition(e){let t=e.textDocument.uri;if(!Py.is(t))return R.warn(`Invalid cell document URI`,t),null;let{lens:n}=await this.sync(),r=Py.parse(t);return this.client.textDocumentDefinition({...e,textDocument:{uri:this.documentUri},position:n.transformPosition(e.position,r)})}async textDocumentSignatureHelp(e){let t=e.textDocument.uri;if(!Py.is(t))return R.warn(`Invalid cell document URI`,t),null;let{lens:n}=await this.sync(),r=Py.parse(t),i=await this.client.textDocumentSignatureHelp({...e,textDocument:{uri:this.documentUri},position:n.transformPosition(e.position,r)});return i?kb(i):null}textDocumentCodeAction(e){return Promise.resolve(null)}codeActionResolve(e){return Promise.resolve(e)}reverseRelatedInformation(e,t){if(e)return e.map(e=>{if(!qy(e)||!qy(e.location)||e.location.uri!==this.documentUri||!jb(e.location.range))return e;let n=t.cellIds.find(n=>t.isInRange(e.location.range,n));return n===void 0?e:{...e,location:{uri:Py.of(n),range:t.reverseRange(e.location.range,n)}}})}async textDocumentRename(e){let t=e.textDocument.uri;if(!Py.is(t))return R.warn(`Invalid cell document URI`,t),null;let n=Py.parse(t),{lens:r}=await this.sync(),i=r.transformPosition(e.position,n),a=await this.client.textDocumentRename({...e,textDocument:{uri:this.documentUri},position:i});if(!a)return null;let o=a.documentChanges?.flatMap(e=>`edits`in e?e.edits:[]);if(!o||o.length!==1)return R.warn(`Expected exactly one edit`,o),a;let s=o[0];if(!(`newText`in s))return R.warn(`Expected newText in edit`,s),a;let c=r.getEditsForNewText(s.newText),l=new Map(c.map(e=>[e.cellId,e.text])),u=this.getNotebookEditors(),d=u[n],f=!1;if(d){let t=d.state.doc.line(e.position.line+1).from+e.position.character,{startToken:n,endToken:r}=Dg(d.state.doc,t),i=d.state.doc.sliceString(n,r);f=Cb(i),f&&R.debug(`[lsp] Private variable rename detected, limiting to current cell`,i)}let p=[],m=0;for(let[e,t]of z.entries(u)){if(f&&e!==n)continue;let r=l.get(e);if(r==null){R.warn(`[lsp] No new code for cell during rename`,e),p.push(e);continue}if(!t){R.warn(`[lsp] No editor view for cell during rename`,e),p.push(e);continue}jA(t)!==r&&(MA(t,r),m++)}return p.length>0&&R.error(`[lsp] Rename partially failed: could not update ${p.length} cell(s)`,p),R.debug(`[lsp] Rename completed: updated ${m} cell(s)`),{...a,documentChanges:[{edits:[],textDocument:{uri:t,version:0}}]}}async completionItemResolve(e){let t=JSON.stringify(e),n=this.completionItemCache.get(t);if(n)return n;let r=this.client.completionItemResolve(e).then(e=>Db(e));return this.completionItemCache.set(t,r),r}async textDocumentPrepareRename(e){let t=e.textDocument.uri;if(!Py.is(t))return R.warn(`Invalid cell document URI`,t),null;let{lens:n}=await this.sync(),r=Py.parse(t);return this.client.textDocumentPrepareRename({...e,textDocument:{uri:this.documentUri},position:n.transformPosition(e.position,r)})}async textDocumentHover(e){R.debug(`[lsp] textDocumentHover`,e);let{lens:t}=await this.sync(),n=Py.parse(e.textDocument.uri),r=await this.client.textDocumentHover({...e,textDocument:{uri:this.documentUri},position:t.transformPosition(e.position,n)});return r?(typeof r.contents==`object`&&`kind`in r.contents&&(r.contents={kind:`markdown`,value:r.contents.value}),r.contents=fb(r.contents)??r.contents,r.contents===``?null:(r.range&&=t.reverseRange(r.range,n),r)):(R.debug(`[lsp] no hover result`),r)}async textDocumentCompletion(e){let{lens:t}=await this.sync();if(!Py.is(e.textDocument.uri))return R.error(`[lsp] Invalid cell document URI in completion request`,e.textDocument.uri),null;let n=Py.parse(e.textDocument.uri);if(!n||n===`undefined`)return R.error(`[lsp] Invalid cellId 'undefined' in completion request`,{cellId:n,uri:e.textDocument.uri,availableCellIds:t.cellIds}),null;t.cellIds.includes(n)||R.warn(`[lsp] CellId in completion request not found in current lens`,{cellId:n,uri:e.textDocument.uri,availableCellIds:t.cellIds});let r=t.transformPosition(e.position,n);return Ob(await this.client.textDocumentCompletion({...e,textDocument:{uri:this.documentUri},position:r}))}patchProcessNotification(){B(Iy(this.client),`processNotification is not a method on the client`);let e=this.client.processNotification.bind(this.client),t=t=>{if(Nb(t)){let n=t.params.version;if(n!=null){let e=this.latestDiagnosticsVersion;if(e!==null&&Number.isFinite(n)&&n<e){R.debug(`[lsp] dropping stale diagnostics notification`,t);return}this.latestDiagnosticsVersion=n}R.debug(`[lsp] handling diagnostics`,t);let r=this.snapshotter.getLatestSnapshot(),i=t.params.diagnostics,{lens:a}=r,o=++this.forwardedDiagnosticsVersion,s=new Map;for(let e of i)for(let t of a.cellIds)if(a.isInRange(e.range,t)){s.has(t)||s.set(t,[]);let n=this.reverseRelatedInformation(e.relatedInformation,a),r={...e,range:a.reverseRange(e.range,t),...n?{relatedInformation:n}:{}};s.get(t)?.push(r);break}let c=new Set(a.cellIds);this.pruneSeenCellUris(c);let l=new Set(this.seenCellDocumentUris);for(let[n,r]of s.entries()){R.debug(`[lsp] diagnostics for cell`,n,r);let i=Py.of(n);l.delete(i),e({...t,params:{...t.params,uri:i,version:o,diagnostics:r}})}if(l.size>0){R.debug(`[lsp] clearing diagnostics`,l);for(let t of l)e({method:`textDocument/publishDiagnostics`,params:{uri:t,version:o,diagnostics:[]}})}return}return e(t)};this.client.processNotification=t}},Fb=1e3,Ib=new Set([`textDocument/didOpen`,`textDocument/didChange`,`textDocument/didClose`]),Lb=new Set([`initialize`,`initialized`,`workspace/didChangeConfiguration`,`textDocument/didOpen`]),Rb=class{delegate;connectionPromise;isDelegateConnected=!1;connectionGeneration=0;restoringGeneration;isClosed=!1;hasConnectedBefore=!1;messageHandlers=new Set;pendingMessages=[];inFlightBacklog;hasLoggedQueueOverflow=!1;disposeDelegateMessage;disposeDelegateClose;options;onReconnect;constructor(e){this.options={...e,retries:e.retries??1,retryDelayMs:e.retryDelayMs??1e3},this.onReconnect=e.onReconnect}async connect(){if(this.isClosed)throw Error(`Transport is closed`);if(this.isDelegateConnected)return;if(this.connectionPromise)return this.connectionPromise;let e=++this.connectionGeneration,t=this.connectWithRetries(e).finally(()=>{this.connectionPromise===t&&(this.connectionPromise=void 0)});return this.connectionPromise=t,t}isStale(e){return this.isClosed||e!==this.connectionGeneration}send(e){if(!this.isClosed){if(this.delegate&&this.isDelegateConnected&&(this.restoringGeneration===void 0||this.canSendWhileRestoring(e))){this.delegate.send(e);return}this.pendingMessages.length<Fb?this.pendingMessages.push(e):this.hasLoggedQueueOverflow||(this.hasLoggedQueueOverflow=!0,R.error(`LSP reconnect queue is full (${Fb}); dropping messages until it drains`)),this.reconnect()}}onMessage(e){return this.messageHandlers.add(e),()=>{this.messageHandlers.delete(e)}}close(){this.isClosed||(this.isClosed=!0,this.isDelegateConnected=!1,this.restoringGeneration=void 0,this.connectionGeneration++,this.connectionPromise=void 0,this.pendingMessages=[],this.inFlightBacklog=void 0,this.messageHandlers.clear(),this.disposeDelegate(),this.delegate?.close(),this.delegate=void 0)}async connectWithRetries(e){let t;for(let n=1;n<=this.options.retries;n++)try{await this.connectDelegate(e);return}catch(r){if(t=r instanceof Error?r:Error(String(r)),this.isStale(e))throw t;this.invalidateDelegate(),R.warn(`WebSocket connection attempt ${n}/${this.options.retries} failed`,t),n<this.options.retries&&await new Promise(e=>setTimeout(e,this.options.retryDelayMs))}let n=t??Error(`WebSocket connection failed`);throw this.options.onConnectionFailure?.(n),n}async connectDelegate(e){if(await this.options.waitForConnection?.(),this.isStale(e))throw Error(`Connection attempt abandoned`);let t=this.createDelegate();if(await t.connect(),this.isStale(e)||this.delegate!==t)throw t.close(),Error(`Transport closed while connecting`);this.isDelegateConnected=!0;let n=this.hasConnectedBefore;this.hasConnectedBefore=!0;let r=this.detachPendingMessages();this.inFlightBacklog=r;try{if(n){this.restoringGeneration=e;try{await this.onReconnect?.()}finally{this.restoringGeneration===e&&(this.restoringGeneration=void 0)}}if(this.isStale(e)||this.delegate!==t||!this.isDelegateConnected)throw Error(`WebSocket closed while restoring LSP state`)}catch(t){throw this.isStale(e)||this.reclaimInFlightBacklog(),t}let i=n&&this.onReconnect?r.filter(e=>!(`method`in e&&Ib.has(e.method))):r;this.inFlightBacklog=void 0;for(let e of[...i,...this.detachPendingMessages()])t.send(e);R.log(`WebSocket transport connected successfully`)}detachPendingMessages(){let e=this.pendingMessages;return this.pendingMessages=[],this.hasLoggedQueueOverflow=!1,e}reclaimInFlightBacklog(){this.inFlightBacklog&&=(this.pendingMessages=[...this.inFlightBacklog,...this.pendingMessages].slice(0,Fb),void 0)}canSendWhileRestoring(e){return!(`method`in e)||Lb.has(e.method)}createDelegate(){this.invalidateDelegate();let e=new Od(this.options.getWsUrl());return this.delegate=e,this.disposeDelegateMessage=e.onMessage(e=>{for(let t of this.messageHandlers)try{t(e)}catch(e){R.error(`LSP message handler failed`,e)}}),this.disposeDelegateClose=e.onClose(t=>{this.delegate!==e||this.isClosed||(R.warn(`WebSocket transport connection closed`,t),this.isDelegateConnected=!1,this.disposeDelegate(),this.delegate=void 0,this.restoringGeneration=void 0,this.reclaimInFlightBacklog(),this.connectionPromise=void 0,queueMicrotask(()=>this.reconnect()))}),e}reconnect(){this.connect().catch(e=>{R.error(`WebSocket transport reconnection failed`,e)})}invalidateDelegate(){this.isDelegateConnected=!1,this.restoringGeneration=void 0,this.disposeDelegate(),this.delegate?.close(),this.delegate=void 0}disposeDelegate(){this.disposeDelegateMessage?.(),this.disposeDelegateMessage=void 0,this.disposeDelegateClose?.(),this.disposeDelegateClose=void 0}},zb=new Set([1,2]);function Bb(e,t){if(!(`method`in t)||t.method!==`window/logMessage`)return;let n=t.params;!qy(n)||typeof n.message!=`string`||kM({logs:[{timestamp:Date.now()/1e3,level:zb.has(n.type)?`stderr`:`stdout`,message:n.message,source:{type:`lsp`,name:e}}]})}function Vb(e,t){let n=Se(),r=new Rb({getWsUrl:()=>n.getLSPURL(e).toString(),waitForConnection:async()=>{await ye()},onReconnect:t});return r.onMessage(t=>Bb(e,t)),r}Cn.define(),new On;function Hb(e){return e.facet(hn.readOnly)}function Ub(e){return[un(e),pn.of([{key:`ArrowRight`,preventDefault:!0,run:t=>Wb(t,e)},{key:`Tab`,preventDefault:!0,run:t=>Wb(t,e)}])]}function Wb(e,t){if(Hb(e.state))return!1;let n=e.state.doc.length;return n===0&&(e.dispatch({changes:{from:0,to:n,insert:t},selection:{head:t.length,anchor:t.length}}),!0)}function Gb(e){let{beforeText:t,linkText:n,afterText:r,onClick:i}=e;return[un(e=>{let a=document.createElement(`span`);a.append(document.createTextNode(t));let o=document.createElement(`span`);return o.textContent=n,o.classList.add(`cm-clickable-placeholder`),o.onclick=t=>{t.stopPropagation(),i(e)},a.append(o),a.append(document.createTextNode(r)),a}),Jn.theme({".cm-placeholder":{color:`var(--slate-8)`},".cm-clickable-placeholder":{cursor:`pointer !important`,pointerEvents:`auto`,color:`var(--slate-9)`,textDecoration:`underline`,textUnderlineOffset:`0.2em`},".cm-clickable-placeholder:hover":{color:`var(--sky-11)`}})]}var Kb=Or(e=>{let t,n={transport:Vb(`pylsp`,async()=>{await t?.()}),rootUri:Ry(),workspaceFolders:zy()},r=e?.pylsp,i=[`D100`,`D103`],a=[`W292`,`E402`,`E302`,`E305`],o=[`B018`,`I001`],s={pylsp:{plugins:{marimo_plugin:{enabled:!0},jedi:{auto_import_modules:[`numpy`]},jedi_completion:{include_params:!0,resolve_at_most:50},flake8:{enabled:r?.enable_flake8,extendIgnore:a},pydocstyle:{enabled:r?.enable_pydocstyle,ignore:i},pylint:{enabled:r?.enable_pylint},pyflakes:{enabled:r?.enable_pyflakes},pylsp_mypy:{enabled:r?.enable_mypy,live_mode:!0},ruff:{enabled:r?.enable_ruff,extendIgnore:[...a,...i,...o]},signature:{formatter:r?.enable_ruff?`ruff`:`black`,line_length:88}}}},c=new Pb(new Dd({...n}),s);return t=()=>c.resyncAllDocuments(),c}),qb=Or(e=>{let t,n=new Pb(new Dd({transport:Vb(`ty`,async()=>{await t?.()}),rootUri:Ry(),workspaceFolders:zy(),getWorkspaceConfiguration:()=>[{disableLanguageServices:!0}]}),{});return t=()=>n.resyncAllDocuments(),n}),Jb=Or(e=>{let t,n=new Pb(new Dd({transport:Vb(`pyrefly`,async()=>{await t?.()}),rootUri:Ry(),workspaceFolders:zy(),initializationOptions:{pyrefly:{displayTypeErrors:e.diagnostics?.enabled??!1?`force-on`:`force-off`}}}),{});return t=()=>n.resyncAllDocuments(),n}),Yb=Or(e=>{let t,n=new Pb(new Dd({transport:Vb(`basedpyright`,async()=>{await t?.()}),rootUri:Ry(),workspaceFolders:zy()}),{});return t=()=>n.resyncAllDocuments(),n}),Xb=class{parser=new $m;type=`python`;defaultCode=this.parser.defaultCode;defaultMetadata=this.parser.defaultMetadata;transformIn(e){let t=this.parser.transformIn(e);return[t.code,t.offset,t.metadata]}transformOut(e,t){let n=this.parser.transformOut(e,t);return[n.code,n.offset]}isSupported(e){return this.parser.isSupported(e)}getExtension({cellId:e,completionConfig:t,hotkeys:n,placeholderType:r,lspConfig:i}){return[(()=>{let r={defaultKeymap:!1,activateOnTyping:t.activate_on_typing,closeOnBlur:!1},a={hideOnChange:!0},o=[];i?.pylsp?.enabled&&ng(`pylsp`)&&o.push(Kb(i)),i?.ty?.enabled&&ng(`ty`)&&o.push(qb(i)),i?.pyrefly?.enabled&&ng(`pyrefly`)&&o.push(Jb(i)),i?.basedpyright?.enabled&&ng(`basedpyright`)&&o.push(Yb(i));let s=t.signature_hint_on_typing,c=s?/(\w+|\w+\.|\/)$/:/(\w+|\w+\.|\(|\/|,)$/;if(o.length>0){let t=o.length===1?o[0]:new Uy(o),l=e=>{R.debug(`openExternalLocation`,e),!(t.documentUri===e.uri||Ly(e.uri))&&Hr().openFile({path:e.uri.replace(`file://`,``)})};return[qd({client:t,languageId:`python`,allowHTMLContent:!0,markdownRenderer:Ky(),useSnippetOnCompletion:!0,clientSideFiltering:!0,hoverConfig:a,completionConfig:r,diagnosticsEnabled:i.diagnostics?.enabled??!1,sendIncrementalChanges:!1,signatureHelpEnabled:!0,signatureActivateOnTyping:s,signatureHelpOptions:{position:`above`},keyboardShortcuts:{signatureHelp:n.getHotkey(`cell.signatureHelp`).key,goToDefinition:n.getHotkey(`cell.goToDefinition`).key,rename:n.getHotkey(`cell.renameSymbol`).key},completionMatchBefore:c,onGoToDefinition:l,onShowLocation:l}),gd.of(Py.of(e))]}return[Lr({...r,override:[Kv]}),Wv]})(),$b(),Zb(r)]}};function Zb(e){return e===`marimo-import`?vn.highest(Ub(`import marimo as mo`)):e===`ai`?Gb({beforeText:`Start coding or `,linkText:`generate`,afterText:` with AI.`,onClick:e=>{e.state.facet(Df).aiCellCompletion()}}):[]}var Qb=ai.configure({props:[fn.add({ParenthesizedExpression:Tn,ArgList:Tn})]});function $b(){return new Xn(Qb,[Qb.data.of({autocomplete:oi}),Qb.data.of({autocomplete:ci})])}function ex(e){return typeof e==`object`&&!Array.isArray(e)&&!tx(e)}function tx(e){if(typeof e!=`object`||Array.isArray(e)||!(`self`in e)||!(`children`in e))return!1;let t=e.self;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.label==`string`}function nx(e){return Array.isArray(e)}function rx(e,t,n,r){let i=e.length;if(t===`string`||t===`completion`&&r&&nx(r))return`column`;if(t===`namespace`&&n){if(nx(n))return`table`;if(ex(n))return Object.values(n).some(e=>nx(e)||tx(e)&&nx(e.children))?i<=1?`database`:`schema`:i===0?`database`:`namespace`}if(t===`completion`&&n)return nx(n)?`table`:(ex(n)&&Object.values(n).some(e=>nx(e)||tx(e)&&nx(e.children)),i<=1?`database`:`schema`);switch(i){case 0:return`database`;case 1:return`schema`;default:return`namespace`}}function ix(e,t,n={}){let{maxDepth:r=10}=n;if((typeof t==`string`?t===``:t.length===0)&&tx(e)){let t=rx([],`completion`,e.children);return{completion:e.self,path:[],type:`completion`,semanticType:t,namespace:e.children}}let i=(typeof t==`string`?t.split(`.`):t).filter(e=>e.length>0);return i.length===0||i.length>r?null:ax(e,i,[],n)}function ax(e,t,n,r,i){if(t.length===0){if(tx(e)){let t=rx(n,`completion`,e.children,i);return{completion:e.self,path:n,type:`completion`,semanticType:t,namespace:e.children}}return{path:n,type:`namespace`,semanticType:rx(n,`namespace`,e,i),namespace:e}}let[a,...o]=t,{caseSensitive:s=!1}=r;if(!a)return null;if(ex(e)){let t=s?Object.keys(e).find(e=>e===a):Object.keys(e).find(e=>e.toLowerCase()===a.toLowerCase());if(t){let i=e[t];if(i)return ax(i,o,[...n,t],r,e)}}else if(tx(e))return ax(e.children,t,n,r,e);else if(nx(e)){for(let t of e)if(typeof t==`string`){if((s?t===a:t.toLowerCase()===a.toLowerCase())&&o.length===0){let r=rx([...n,t],`string`,void 0,e);return{value:t,path:[...n,t],type:`string`,semanticType:r}}}else if((s?t.label===a:t.label.toLowerCase()===a.toLowerCase())&&o.length===0){let r=rx([...n,t.label],`completion`,void 0,e);return{completion:t,path:[...n,t.label],type:`completion`,semanticType:r}}}return null}function ox(e,t,n={}){let r=[];if(t.includes(`.`)){let r=t.lastIndexOf(`.`),i=t.substring(0,r),a=t.substring(r+1),o=ix(e,i,n);if(o?.namespace)return sx(o.namespace,a,o.path,n)}else return sx(e,t,[],n);return r}function sx(e,t,n,r){let i=[],{caseSensitive:a=!1,allowPartialMatch:o=!0}=r;if(ex(e)){for(let[r,s]of Object.entries(e))if(o?a?r.startsWith(t):r.toLowerCase().startsWith(t.toLowerCase()):a?r===t:r.toLowerCase()===t.toLowerCase()){if(tx(s)){let t=rx([...n,r],`completion`,s.children,e);i.push({completion:s.self,path:[...n,r],type:`completion`,semanticType:t,namespace:s.children})}else{let t=rx([...n,r],`namespace`,s,e);i.push({path:[...n,r],type:`namespace`,semanticType:t,namespace:s})}}}else if(tx(e)){if(o?a?e.self.label.startsWith(t):e.self.label.toLowerCase().startsWith(t.toLowerCase()):a?e.self.label===t:e.self.label.toLowerCase()===t.toLowerCase()){let t=rx([...n,e.self.label],`completion`,e.children);i.push({completion:e.self,path:[...n,e.self.label],type:`completion`,semanticType:t,namespace:e.children})}i.push(...sx(e.children,t,n,r))}else if(nx(e)){for(let r of e)if(typeof r==`string`){if(o?a?r.startsWith(t):r.toLowerCase().startsWith(t.toLowerCase()):a?r===t:r.toLowerCase()===t.toLowerCase()){let t=rx([...n,r],`string`,void 0,e);i.push({value:r,path:[...n,r],type:`string`,semanticType:t})}}else if(o?a?r.label.startsWith(t):r.label.toLowerCase().startsWith(t.toLowerCase()):a?r.label===t:r.label.toLowerCase()===t.toLowerCase()){let t=rx([...n,r.label],`completion`,void 0,e);i.push({completion:r,path:[...n,r.label],type:`completion`,semanticType:t})}}return i}function cx(e,t,n={}){let r=[],{maxDepth:i=10}=n;lx(e,[],r,i);let{caseSensitive:a=!1}=n;return r.filter(e=>e.path.some(e=>a?e===t:e.toLowerCase()===t.toLowerCase())).sort((e,n)=>{let r=a?e.path[e.path.length-1]===t:e.path[e.path.length-1]?.toLowerCase()===t.toLowerCase(),i=a?n.path[n.path.length-1]===t:n.path[n.path.length-1]?.toLowerCase()===t.toLowerCase();return r&&!i?-1:!r&&i?1:e.path.length-n.path.length})}function lx(e,t,n,r){if(!(t.length>=r)){if(ex(e))for(let[i,a]of Object.entries(e)){let o=[...t,i];if(tx(a)){let t=rx(o,`completion`,a.children,e);n.push({completion:a.self,path:o,type:`completion`,semanticType:t,namespace:a.children}),lx(a.children,o,n,r)}else{let t=rx(o,`namespace`,a,e);n.push({path:o,type:`namespace`,semanticType:t,namespace:a}),lx(a,o,n,r)}}else if(tx(e)){let i=rx(t,`completion`,e.children);n.push({completion:e.self,path:t,type:`completion`,semanticType:i,namespace:e.children}),lx(e.children,t,n,r)}else if(nx(e))for(let r of e)if(typeof r==`string`){let i=rx([...t,r],`string`,void 0,e);n.push({value:r,path:[...t,r],type:`string`,semanticType:i})}else{let i=rx([...t,r.label],`completion`,void 0,e);n.push({completion:r,path:[...t,r.label],type:`completion`,semanticType:i})}}}function ux(e,t,n={}){let{enableFuzzySearch:r=!1}=n,i=ix(e,t,n);if(i)return i;let a=ox(e,t,n);if(a.length>0)return a[0]||null;if(r){let r=cx(e,t,n);if(r.length>0)return r[0]||null}return null}var dx=bn.define({combine:e=>e[0]??null});function fx(e,t){let n=e??t.state.facet(dx);return n==null?null:typeof n==`function`?n(t):n}function px(e,t){let n=e??t.state.facet(dx);return n==null?null:typeof n==`function`?t.view?n(t.view):null:n}function mx(e){if(e==null)return null;let t=tx(e)?e.children:e;return nx(t)?t:null}function hx(e,t){let n=mx(ix(e,t,{caseSensitive:!1})?.namespace);if(n)return n;let r=(typeof t==`string`?t.split(`.`):t).map(e=>e.toLowerCase()),i=r[r.length-1];if(!i)return null;let a=cx(e,i).filter(e=>{if(mx(e.namespace)===null||e.path.length<r.length)return!1;let t=e.path.slice(-r.length).map(e=>e.toLowerCase());return r.every((e,n)=>t[n]===e)});return a.length===1?mx(a[0]?.namespace):null}function gx(e,t,n){if(typeof e==`string`)return n===void 0?{label:e,type:`property`,detail:t}:{label:e,type:`property`,detail:t,boost:n};let r={...e,type:`property`,detail:e.detail??t};return n!==void 0&&r.boost===void 0&&(r.boost=n),r}var _x=e=>{let t;return async()=>(t||=e(),await t)},vx=class{opts;parser=null;offsetRecord={};constructor(e={}){this.opts=e}getParser=_x(async()=>{if(this.parser)return this.parser;let t=await W(()=>import(`./node-sql-parser-DDkYZCP2.js`).then(t=>e(t.default,1)),__vite__mapDeps([213,1]),import.meta.url),{Parser:n}=t.default||t;return this.parser=new n,this.parser});async parse(e,t){this.offsetRecord={};let n=this.opts.getParserOptions?.(t.state),r=await this.sanitizeSql(e,n);try{let e=await this.getParser();return n?.database===`DuckDB`?this.parseWithDuckDBSupport(r,n):{success:!0,errors:[],ast:e.astify(r,n)}}catch(e){return{success:!1,errors:[this.extractErrorInfo(e,r)]}}}async sanitizeSql(e,t){if(t?.ignoreBrackets){let{sql:t,offsetRecord:n}=xx(e);return this.offsetRecord=n,t}return e}async parseWithDuckDBSupport(e,t){let n=await this.getParser(),r=yx(e).trimStart().toLowerCase();if(r.startsWith(`from`)||r.includes(`macro`))return{success:!0,errors:[]};let i=e;r.includes(`create or replace table`)&&(this.offsetRecord[e.indexOf(`create or replace table`)]=-11,i=e.replace(/create or replace table/i,`create table`));try{let e={...t,database:`PostgreSQL`};return{success:!0,errors:[],ast:n.astify(i,e)}}catch(t){return{success:!1,errors:[this.extractErrorInfo(t,e)]}}}extractErrorInfo(e,t){let n=1,r=1,i=e?.message||`SQL parsing error`,a=e;if(a?.location)n=a.location.start?.line||1,r=a.location.start?.column||1;else if(a?.hash)n=a.hash.line||1,r=a.hash.loc?.first_column||1;else{let e=i.match(/line (\d+)/i),t=i.match(/column (\d+)/i);e?.[1]&&(n=parseInt(e[1],10)),t?.[1]&&(r=parseInt(t[1],10))}let o=Object.entries(this.offsetRecord).map(([e,t])=>({position:parseInt(e,10),offset:t})).sort((e,t)=>e.position-t.position),s=0;for(let{position:e,offset:i}of o){let a=e+s;s+=i;let o=t.slice(0,a),c=(o.match(/\n/g)?.length??0)+1,l=a-o.lastIndexOf(`
102
+ `);n===c&&r>l&&(r-=i)}return r>t.length&&(r=t.length),{message:this.cleanErrorMessage(i),line:Math.max(1,n),column:Math.max(1,r),severity:`error`}}cleanErrorMessage(e){return e.replace(/^Error: /,``).replace(/Expected .* but .* found\./i,e=>e.replace(/but .* found/,`found unexpected token`)).trim()}async validateSql(e,t){return(await this.parse(e,t)).errors}async extractTableReferences(e,t){let n=t?this.opts.getParserOptions?.(t.state):void 0;try{return(await this.getParser()).tableList(e,n).map(e=>{let t=e.split(`::`);return t[t.length-1]||e})}catch{return[]}}async extractColumnReferences(e,t){let n=t?.state?this.opts.getParserOptions?.(t.state):void 0;try{return(await this.getParser()).columnList(e,n).map(e=>{let t=e.split(`::`);return t[t.length-1]||e})}catch{return[]}}};function yx(e,t=[`/*`,`--`]){let n=[];if(t.includes(`/*`)&&n.push(`/\\*[\\s\\S]*?\\*/`),t.includes(`--`)&&n.push(`--[^\\n]*`),n.length===0)return e;let r=RegExp(`^\\s*(${n.join(`|`)})\\s*`,``),i=e,a=``;for(;i!==a;)a=i,i=i.replace(r,``);return i}var bx=2;function xx(e){let t={};return{sql:e.replace(/("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\{[^}]*\})/g,(e,n,r,i,a)=>n||r?e:i?(t[a]=bx,`'${i}'`):e),offsetRecord:t}}function Sx(){return{tables:[],ctes:[],aliases:new Map,selectAliases:[]}}function Cx(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wx(e){return Array.isArray(e)?e:[]}function Tx(e){let t=e[0],n=e[e.length-1];return e.length>=2&&(t===`"`&&n===`"`||t===`'`&&n===`'`||t==="`"&&n==="`"||t===`[`&&n===`]`)?e.slice(1,-1):e}function Ex(e){return typeof e==`string`?e:Cx(e)&&typeof e.value==`string`?e.value:null}function Dx(e){if(!Cx(e)||e.type!==`column_ref`)return null;let t=e.column;if(typeof t==`string`)return t;if(Cx(t)){let e=t.expr,n=Cx(e)?e.value:t.value;if(typeof n==`string`)return n}return null}function Ox(e){let t=wx(e.columns).map(e=>Ex(e)??Dx(e)??Ex(e.column)).filter(e=>typeof e==`string`);if(t.length>0)return t;let n=e.stmt,r=Cx(n)?n.ast??n:null;if(!Cx(r)||r.type!==`select`)return[];let i=[];for(let e of wx(r.columns))if(typeof e.as==`string`)i.push(e.as);else{let t=Dx(e.expr);t&&t!==`*`&&i.push(t)}return i}function kx(e,t){if(typeof e.table!=`string`||e.table.length===0)return;let n=[e.db??e.catalog,e.schema,e.table].filter(e=>typeof e==`string`&&e.length>0).map(Tx),r=typeof e.as==`string`?Tx(e.as):void 0,i=`${n.join(`.`).toLowerCase()}::${r?.toLowerCase()??``}`;t.seenTables.has(i)||(t.seenTables.add(i),t.tables.push({name:Tx(e.table),path:n,...r?{alias:r}:{}}))}function Ax(e,t,n){if(Array.isArray(e)){for(let r of e)Ax(r,t,n);return}if(!(!Cx(e)||n.has(e))){n.add(e);for(let n of wx(e.with)){let e=Ex(n.name);e&&!t.seenCtes.has(e.toLowerCase())&&(t.seenCtes.add(e.toLowerCase()),t.ctes.push({name:Tx(e),columns:Ox(n).map(Tx),from:-1,to:-1}))}for(let n of[`from`,`table`])for(let r of wx(e[n]))kx(r,t);for(let[r,i]of Object.entries(e))r!==`loc`&&r!==`tableList`&&r!==`columnList`&&Ax(i,t,n)}}function jx(e,t){if(e.type===`select`)for(let n of wx(e.columns))typeof n.as==`string`&&t.selectAliases.push(Tx(n.as))}function Mx(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=`(?:"${n}"|\`${n}\`|\\[${n}\\]|\\b${n})`,i=RegExp(`(${r})\\s*(?:\\([^)]*\\)\\s*)?AS\\s*\\(`,`i`).exec(e);return!i||i.index<0||!i[1]?{from:-1,to:-1}:{from:i.index,to:i.index+i[1].length}}var Nx=new Set(`as.on.using.where.join.inner.left.right.full.cross.outer.natural.lateral.group.order.limit.offset.having.union.intersect.except.select.set.values.when.then.and.or.not.in.is.asc.desc.fetch.window.qualify.returning.with`.split(`.`)),Px=String.raw`(?:[\w$]+|"[^"]+"|\`[^\`]+\`|\[[^\]]+\])`,Fx=`(?!(?:${[...Nx].join(`|`)})\\b)`,Ix=new RegExp(String.raw`\b(?:from|join)\s+(${Px}(?:\.${Px})*)(?:\s+(?:as\s+)?${Fx}(${Px}))?`,`gi`);function Lx(e){let t=e.split(``),n=0;for(;n<e.length;){let r=e[n],i=e[n+1];if(r===`-`&&i===`-`){for(;n<e.length&&e[n]!==`
103
+ `;)t[n]=` `,n++;continue}if(r===`/`&&i===`*`){for(t[n]=` `,t[n+1]=` `,n+=2;n<e.length&&(e[n]!==`*`||e[n+1]!==`/`);)t[n]=` `,n++;n<e.length&&(t[n]=` `,t[n+1]=` `,n+=2);continue}if(r===`"`||r==="`"||r===`[`){let t=r===`[`?`]`:r;for(n++;n<e.length&&e[n]!==t;)n++;n++;continue}if(r===`'`){for(t[n]=` `,n++;n<e.length;){if(e[n]===`'`){if(t[n]=` `,e[n+1]===`'`){t[n+1]=` `,n+=2;continue}n++;break}t[n]=` `,n++}continue}n++}return t.join(``)}function Rx(e){let t={tables:[],ctes:[],selectAliases:[],seenTables:new Set,seenCtes:new Set},n=Lx(e);zx(n,t),Ix.lastIndex=0;let r=Ix.exec(n);for(;r!==null;){let e=r[1],i=r[2];if(e){let n=e.split(`.`).map(Tx),r=n[n.length-1]??``,a=i&&!Nx.has(i.toLowerCase())?Tx(i):void 0,o=`${n.join(`.`).toLowerCase()}::${a?.toLowerCase()??``}`;r&&!t.seenTables.has(o)&&(t.seenTables.add(o),t.tables.push({name:r,path:n,...a?{alias:a}:{}}))}r=Ix.exec(n)}return Hx(t)}function zx(e,t){let n=/\bWITH\s+(?:RECURSIVE\s+)?/gi,r=new RegExp(String.raw`^(${Px})\s*(?:\(([^)]*)\)\s*)?AS\s*\(`,`i`),i=n.exec(e);for(;i!==null;){let a=i.index+i[0].length;for(;;){let n=r.exec(e.slice(a)),i=n?.[1],o=i?Tx(i):void 0;if(!n||!i||!o)break;let s=a+n[0].length,c=s,l=1;for(;c<e.length&&l>0;)e[c]===`(`?l++:e[c]===`)`&&l--,c++;if(!t.seenCtes.has(o.toLowerCase())){t.seenCtes.add(o.toLowerCase());let r=(n[2]??``).split(`,`).map(e=>Tx(e.trim())).filter(e=>e.length>0);t.ctes.push({name:o,columns:r.length>0?r:Vx(e.slice(s,Math.max(s,c-1))),from:a,to:a+i.length})}let u=/^\s*,\s*/.exec(e.slice(c));if(!u)break;a=c+u[0].length}i=n.exec(e)}}function Bx(e){let t=[],n=0,r=``;for(let i of e)i===`(`?n++:i===`)`&&(n=Math.max(0,n-1)),i===`,`&&n===0?(t.push(r),r=``):r+=i;return t.push(r),t}function Vx(e){let t=/^\s*SELECT\s+(?:DISTINCT\s+)?([\s\S]*?)\s+FROM\s/i.exec(e);if(!t||!t[1])return[];let n=[];for(let e of Bx(t[1])){let t=e.trim(),r=new RegExp(String.raw`\s+AS\s+(${Px})$`,`i`).exec(t);if(r?.[1]){n.push(Tx(r[1]));continue}if(/^(?:[\w$]+\.)*[\w$]+$/.test(t)){let e=t.split(`.`),r=e[e.length-1];r&&r!==`*`&&n.push(r)}}return n}function Hx(e){let t=new Map;for(let n of e.tables)if(n.alias){let e=n.alias.toLowerCase();t.has(e)||t.set(e,n.path.join(`.`))}return{tables:e.tables,ctes:e.ctes,aliases:t,selectAliases:e.selectAliases}}async function Ux(e,t,n){if(!e.trim())return Sx();let r=null;try{let i=await t.parse(e,n);i.success&&i.ast!=null&&(r=i.ast)}catch{}if(r==null)return Rx(e);try{let t={tables:[],ctes:[],selectAliases:[],seenTables:new Set,seenCtes:new Set},n=Array.isArray(r)?r:[r];for(let e of n)Cx(e)&&jx(e,t);Ax(r,t,new Set);let i=Lx(e);for(let e of t.ctes){let t=Mx(i,e.name);e.from=t.from,e.to=t.to}return Hx(t)}catch{return Rx(e)}}var Wx=class{parser;cache=new Map;MAX_CACHE_SIZE=20;constructor(e=new vx){this.parser=e}async getContext(e,t){let n=this.cache.get(e);if(n)return n;let r=await Ux(e,this.parser,t);if(this.cache.set(e,r),this.cache.size>this.MAX_CACHE_SIZE){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}return r}clearCache(){this.cache.clear()}},Gx=class{parser;cache=new Map;MAX_CACHE_SIZE=10;constructor(e){this.parser=e}async analyzeDocument(e){let t=e.doc.toString(),n=this.cache.get(t);if(n)return n;let r=await this.extractStatements(t,e);if(this.cache.set(t,r),this.cache.size>this.MAX_CACHE_SIZE){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}return r}async getStatementAtPosition(e,t){return(await this.analyzeDocument(e)).find(e=>t>=e.from&&t<=e.to)||null}async getStatementsInRange(e,t,n){return(await this.analyzeDocument(e)).filter(e=>e.from<=n&&e.to>=t)}async extractStatements(e,t){let n=[],r=this.splitByStatementSeparators(e),i=0;for(let e of r){let r=e.trim();if(r.length===0){i+=e.length;continue}let a=i+e.indexOf(r),o=a+r.length,s=t.doc.lineAt(a),c=t.doc.lineAt(o),l=this.stripComments(r);if(l.trim().length===0||l.trim()===`;`){i+=e.length;continue}let u=await this.parser.parse(r,{state:t}),d=this.determineStatementType(l),f=l.endsWith(`;`)?l.slice(0,-1).trim():l.trim();n.push({from:a,to:o,lineFrom:s.number,lineTo:c.number,content:f,type:d,isValid:u.success,errors:u.errors??[]}),i+=e.length}return n}splitByStatementSeparators(e){let t=[],n=``,r=!1,i=``,a=!1,o=!1,s=0;for(;s<e.length;){let c=e[s],l=e[s+1];if(!r&&!o&&c===`-`&&l===`-`){a=!0,n+=c+l,s+=2;continue}if(!r&&!a&&c===`/`&&l===`*`){o=!0,n+=c+l,s+=2;continue}if(o&&c===`*`&&l===`/`){o=!1,n+=c+l,s+=2;continue}if(a&&(c===`
104
104
  `||c===`\r`)){a=!1,n+=c,s++;continue}if(a||o){n+=c,s++;continue}if(!r&&(c===`'`||c===`"`||c==="`"))r=!0,i=c,n+=c;else if(r&&c===i){if(l===i){n+=c+l,s+=2;continue}r=!1,i=``,n+=c}else!r&&c===`;`?(n+=c,t.push(n),n=``):n+=c;s++}return n.trim()&&t.push(n),t}determineStatementType(e){let t=e.trim().toLowerCase();return t.startsWith(`select`)?`select`:t.startsWith(`insert`)?`insert`:t.startsWith(`update`)?`update`:t.startsWith(`delete`)?`delete`:t.startsWith(`create`)?`create`:t.startsWith(`drop`)?`drop`:t.startsWith(`alter`)?`alter`:t.startsWith(`use`)?`use`:`other`}stripComments(e){let t=``,n=!1,r=``,i=!1,a=!1,o=0;for(;o<e.length;){let s=e[o],c=e[o+1];if(!n&&!a&&s===`-`&&c===`-`){i=!0,o+=2;continue}if(!n&&!i&&s===`/`&&c===`*`){a=!0,o+=2;continue}if(a&&s===`*`&&c===`/`){a=!1,o+=2;continue}if(i&&(s===`
105
- `||s===`\r`)){i=!1,t+=s,o++;continue}if(i||a){o++;continue}if(!n&&(s===`'`||s===`"`||s==="`"))n=!0,r=s,t+=s;else if(n&&s===r){if(c===r){t+=s+c,o+=2;continue}n=!1,r=``,t+=s}else t+=s;o++}return t}clearCache(){this.cache.clear()}};function Ux(e={}){let t=e.parser??new hx,n=e.contextAnalyzer??new Vx(t),r=new Hx(t);return async t=>{let i=t.matchBefore(/(?:[\w$]+|"[^"]+"|`[^`]+`|\[[^\]]+\])\.[\w$]*/);if(!i||t.state.sliceDoc(Math.max(0,i.from-1),i.from)===`.`)return null;let a=i.text.lastIndexOf(`.`),o=Sx(i.text.slice(0,a)),s=await r.getStatementAtPosition(t.state,t.pos),c=s?t.state.sliceDoc(s.from,s.to):t.state.doc.toString(),l=await n.getContext(c,{state:t.state}),u=l.aliases.get(o.toLowerCase());if(!u)return null;let d=null,f=l.ctes.find(e=>e.name.toLowerCase()===u.toLowerCase());if(f&&f.columns.length>0)d=f.columns;else if(!f){let n=ux(e.schema,t);n!=null&&(d=fx(n,u))}if(!d||d.length===0)return null;let p=`column of ${u}`;return{from:i.from+a+1,options:d.map(e=>px(e,p)),validFor:/^[\w$]*$/}}}var Wx=1,Gx=/\b(?:from|join|into|update|table)\s+$/i,Kx=/\bfrom\s+[\w$."`[\]]+(?:\s+(?:as\s+)?[\w$"`[\]]+)?(?:\s*,\s*[\w$."`[\]]+(?:\s+(?:as\s+)?[\w$"`[\]]+)?)*\s*,\s*$/i;function qx(e={}){let t=e.parser??new hx,n=e.contextAnalyzer??new Vx(t),r=new Hx(t);return async t=>{let i=t.matchBefore(/[\w$]*/);if(!i||i.from===i.to&&!t.explicit||t.state.sliceDoc(Math.max(0,i.from-1),i.from)===`.`)return null;let a=t.state.sliceDoc(Math.max(0,i.from-256),i.from);if(Gx.test(a)||Kx.test(a))return null;let o=await r.getStatementAtPosition(t.state,t.pos),s=o?.from??0,c=o?t.state.sliceDoc(o.from,o.to):t.state.doc.toString(),l=Px(c),u=Math.max(s,i.from-1)-s,d=i.to-s;if(l.slice(u,d)!==c.slice(u,d))return null;let f=await n.getContext(c,{state:t.state});if(f.tables.length===0)return null;let p=ux(e.schema,t),m=[],h=new Set,g=new Set;for(let e of f.tables){let t=e.path.join(`.`).toLowerCase();if(g.has(t))continue;g.add(t);let n=f.ctes.find(t=>t.name.toLowerCase()===e.name.toLowerCase()),r=null;if(n?r=n.columns.length>0?n.columns:null:p!=null&&(r=fx(p,e.path)),!r)continue;let i=`column of ${e.name}`;for(let e of r){let t=(typeof e==`string`?e:e.label).toLowerCase();h.has(t)||(h.add(t),m.push(px(e,i,Wx)))}}return m.length===0?null:{from:i.from,options:m,validFor:/^[\w$]*$/}}}var Jx=/[\w$]/,Yx=/"[^"]*"|`[^`]*`|\[[^\]]*\]/g;function Xx(e,t){let n=e.doc.lineAt(t),r=n.text,i=t-n.from;Yx.lastIndex=0;let a=Yx.exec(r);for(;a!==null&&a.index<=i;){let e=a.index+a[0].length;if(i<=e)return{from:n.from+a.index,to:n.from+e,text:Sx(a[0])};a=Yx.exec(r)}let o=i,s=i;for(;o>0&&Jx.test(r[o-1]??``);)o--;for(;s<r.length&&Jx.test(r[s]??``);)s++;return o===s?null:{from:n.from+o,to:n.from+s,text:r.slice(o,s)}}async function Zx(e,t,n){let r=await e.analyzeDocument(t),i=null;for(let e of r){if(n>=e.from&&n<=e.to)return e;e.from<=n&&(i=e)}return i}function Qx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $x(e,t={}){let n=Qx(e);return`(?:"${n}"|\`${n}\`|\\[${n}\\]|${t.allowLeadingDot?`(?<![\\w$])`:`(?<![\\w$.])`}${n}(?![\\w$]))`}function eS(e,t,n={}){let r=new RegExp($x(t),`gi`),i=[],a=r.exec(e);for(;a!==null;){let t=a.index+a[0].length;(!n.followedByDot||e[t]===`.`)&&i.push({from:a.index,to:t}),a=r.exec(e)}return i}function tS(e){let t=[],n=0;for(let r=0;r<e.length;r++)e[r]===`)`&&(n=Math.max(0,n-1)),t[r]=n,e[r]===`(`&&n++;return t}var nS=/\b(select|from|where|having|qualify|on|set|values|by|join|limit|offset|union|intersect|except|window)\b/gi;function rS(e){nS.lastIndex=0;let t=null,n=nS.exec(e);for(;n!==null;)t=(n[1]??``).toLowerCase(),n=nS.exec(e);return t}function iS(e,t){let n=t-1;for(;;){for(;n>=0&&/\s/.test(e[n]??``);)n--;if(n>=0&&e[n]===`.`){for(n--;n>=0&&/\s/.test(e[n]??``);)n--;let t=e[n];if(t===`"`||t==="`"||t===`]`){let r=t===`]`?`[`:t;for(n--;n>=0&&e[n]!==r;)n--;n--}else for(;n>=0&&Jx.test(e[n]??``);)n--;continue}break}if(n<0)return!1;if(e[n]===`,`)return rS(e.slice(0,n))===`from`;let r=/([A-Za-z_]+)$/.exec(e.slice(0,n+1))?.[1]?.toLowerCase();return r===`from`||r===`join`}function aS(e){let t=new Map;for(let n of e)t.has(n.from)||t.set(n.from,n);return[...t.values()].sort((e,t)=>e.from-t.from)}function oS(e,t){return e.some(e=>e.from<=t.from&&t.to<=e.to)}function sS(e,t,n){let r=Px(e),i=n.text.toLowerCase(),a=t.selectAliases.some(e=>e.toLowerCase()===i),o=t.ctes.find(e=>e.name.toLowerCase()===i);if(o){let e=t.aliases.get(i);if(e&&e.toLowerCase()!==i||a||o.from<0)return null;let s={from:o.from,to:o.to},c=aS([s,...eS(r,o.name).filter(e=>r[e.to]===`.`||iS(r,e.from))]);return oS(c,n)?{kind:`cte`,name:o.name,definition:s,references:c}:null}if(t.aliases.has(i)){if(a)return null;let e=t.tables.filter(e=>e.alias?.toLowerCase()===i);if(e.length!==1||!e[0])return null;let o=e[0],s=o.alias??n.text,c=$x(o.name,{allowLeadingDot:!0}),l=RegExp(`${c}\\s+(?:AS\\s+)?(${$x(s)})`,`gi`),u=l.exec(r);for(;u!==null&&!iS(r,u.index);)u=l.exec(r);if(!u||u[1]==null)return null;let d={from:u.index+u[0].length-u[1].length,to:u.index+u[0].length},f=aS([d,...eS(r,s,{followedByDot:!0})]);return oS(f,n)?{kind:`table-alias`,name:s,definition:d,references:f}:null}let s=t.selectAliases.find(e=>e.toLowerCase()===i);if(s){let e=tS(r),t=t=>e[t]===0,i=cS(r,/\bFROM\b/gi,t),a=i?i.index:r.length,o=RegExp(`\\bAS\\s+(${$x(s)})`,`gi`),c=null,l=o.exec(r);for(;l!==null;){let e=l.index+l[0].length-(l[1]?.length??0);if(t(l.index)&&e<a){c={from:e,to:l.index+l[0].length};break}l=o.exec(r)}if(!c)return null;let u=dS(r,t),d=eS(r,s).filter(e=>u.some(t=>e.from>=t.from&&e.to<=t.to)),f=aS([c,...d]);return oS(f,n)?{kind:`select-alias`,name:s,definition:c,references:f}:null}return null}function cS(e,t,n){let r=t.exec(e);for(;r!==null;){if(n(r.index))return r;r=t.exec(e)}return null}var lS=/\b(?:GROUP\s+BY|ORDER\s+BY|HAVING|QUALIFY)\b/gi,uS=/\b(?:GROUP\s+BY|ORDER\s+BY|HAVING|QUALIFY|LIMIT|OFFSET|FETCH|WINDOW|UNION|INTERSECT|EXCEPT)\b/gi;function dS(e,t){let n=[];lS.lastIndex=0;let r=lS.exec(e);for(;r!==null;){if(t(r.index)){let i=r.index+r[0].length;uS.lastIndex=i;let a=e.length,o=uS.exec(e);for(;o!==null;){if(t(o.index)){a=o.index;break}o=uS.exec(e)}n.push({from:i,to:a})}r=lS.exec(e)}return n}var fS=class{structureAnalyzer;contextAnalyzer;constructor(e={}){let t=e.parser??new hx;this.structureAnalyzer=e.structureAnalyzer??new Hx(t),this.contextAnalyzer=e.contextAnalyzer??new Vx(t)}async resolve(e,t){let n=Xx(e,t);if(!n)return null;let r=await Zx(this.structureAnalyzer,e,t);if(!r||n.from<r.from||n.to>r.to)return null;let i=e.sliceDoc(r.from,r.to),a=sS(i,await this.contextAnalyzer.getContext(i,{state:e}),{from:n.from-r.from,to:n.to-r.from,text:n.text});if(!a)return null;let o=e=>({from:e.from+r.from,to:e.to+r.from});return{...a,definition:o(a.definition),references:a.references.map(o)}}},pS=/([\w$]+|"[^"]+"|`[^`]+`|\[[^\]]+\])$/;function mS(e){return/\b(?:from|join)\s+$/i.test(e)}function hS(e){return/^[A-Za-z_][\w$]*$/.test(e)}function gS(e){return{label:e.name,type:`variable`,info:`Common Table Expression: ${e.name}`,boost:10,...hS(e.name)?{}:{apply:`"${e.name}"`}}}function _S(e){return e.columns.map(t=>({label:t,type:`property`,detail:`column of ${e.name}`,boost:5,...hS(t)?{}:{apply:`"${t}"`}}))}function vS(e={}){let t=e.parser??new hx,n=e.contextAnalyzer??new Vx(t),r=e.structureAnalyzer??new Hx(t);return async e=>{let t=e.matchBefore(/[\w$]*/);if(!t)return null;let i=e.state.sliceDoc(Math.max(0,t.from-1),t.from)===`.`;if(t.from===t.to&&!e.explicit&&!i)return null;let a=await Zx(r,e.state,e.pos),o=a?e.state.sliceDoc(a.from,a.to):e.state.doc.toString(),s=await n.getContext(o,{state:e.state});if(s.ctes.length===0)return null;if(i){let n=e.state.doc.lineAt(t.from),r=e.state.sliceDoc(n.from,t.from-1),i=pS.exec(r);if(!i||!i[1]||r.slice(0,r.length-i[1].length).endsWith(`.`))return null;let a=Sx(i[1]).toLowerCase(),o=s.ctes.find(e=>e.name.toLowerCase()===a);return!o||o.columns.length===0?null:{from:t.from,options:_S(o),validFor:/^[\w$]*$/}}let c=s.ctes.map(gS);if(!mS(e.state.sliceDoc(Math.max(0,t.from-64),t.from))){let e=new Set(s.tables.map(e=>e.name.toLowerCase())),t=new Set;for(let n of s.ctes)if(e.has(n.name.toLowerCase()))for(let e of _S(n)){let n=e.label.toLowerCase();t.has(n)||(t.add(n),c.push(e))}}return{from:t.from,options:c,validFor:/^[\w$]*$/}}}var yS=750;function bS(e,t){if(t>=e.length)return e.length;let n=e.lineAt(t),r=n.text.slice(t-n.from).match(/^[\w"'`.]+/);return r?t+r[0].length:Math.min(t+1,e.length)}function xS(e,t){let n=t.line(Math.min(e.line,t.lines)),r=Math.min(n.from+Math.max(0,e.column-1),t.length);return{from:r,to:bS(t,r),severity:e.severity,message:e.message,source:`sql-parser`}}function SS(e,t,n){let r;return r=e.line<=1?t.from+Math.max(0,e.column-1):n.line(Math.min(t.lineFrom+e.line-1,n.lines)).from+Math.max(0,e.column-1),r=Math.max(t.from,Math.min(r,t.to)),{from:r,to:Math.max(r,Math.min(bS(n,r),t.to)),severity:e.severity,message:e.message,source:`sql-parser`}}function CS(e={}){return yr(wS(e),{delay:e.delay||yS})}function wS(e={}){let t=e.parser||new hx,n=e.perStatement!==!1,r=e.structureAnalyzer||new Hx(t);return async e=>{let i=e.state.doc,a=i.toString();return a.trim()?n?(await r.analyzeDocument(e.state)).flatMap(e=>e.errors.map(t=>SS(t,e,i))):(await t.validateSql(a,{state:e.state})).map(e=>xS(e,i)):[]}}function TS(e,t){if(t.size===0)return{};if(Zb(e)){let n={};for(let[r,i]of Object.entries(e))if(Array.from(t).some(e=>e.toLowerCase()===r.toLowerCase()))n[r]=i;else if(Zb(i)){let e=TS(i,t);Object.keys(e).length>0&&(n[r]=e)}return n}return e}function ES(e={}){let{schema:t,keywords:n={},enableKeywords:r=!0,enableTables:i=!0,enableColumns:a=!0,enableFuzzySearch:o=!0,parser:s=new hx,tooltipRender:c,tooltipRenderers:l={}}=e,u=new Hx(s),d=e.contextAnalyzer??new Vx(s),f=null;return async(e,s,p)=>{let{from:m,to:h,text:g}=e.state.doc.lineAt(s),_=s,v=s;f===null&&(f=typeof n==`function`?n(e):Promise.resolve(n));let y;try{y=await f}catch{f=null,y={}}for(;_>m&&/[\w.]/.test(g[_-m-1]??``);)_--;for(;v<h&&/[\w.]/.test(g[v-m]??``);)v++;if(_===s&&p<0||v===s&&p>0)return null;let b=g.slice(_-m,v-m).toLowerCase();if(!b||b.length===0)return null;let x=lx(t,e)??{},S=null;`${b}`;let C=Object.hasOwn(y,b)?y[b]:void 0;if(!S&&r&&C&&(S={word:b,view:e,pos:s,tooltipType:`keyword`,keywordData:{keyword:b,info:C}}),!S&&(i||a)&&x){let t=await u.getStatementAtPosition(e.state,s),n=t?e.state.doc.sliceString(t.from,t.to):e.state.doc.toString(),r=await d.getContext(n,{state:e.state}),[c=``,...l]=b.split(`.`),f=r.aliases.get(c),p=f?[f,...l].join(`.`).toLowerCase():b,m=new Set(r.tables.map(e=>e.name.toLowerCase())),h=TS(x,m),g=sx(h,p,{enableFuzzySearch:o});if(!g&&m.size===0&&(g=sx(x,p,{enableFuzzySearch:o})),g){let{semanticType:e}=g;(e===`table`&&!i||e===`column`&&!a)&&(g=null)}g&&(Array.from(m),S={word:b,view:e,pos:s,tooltipType:`namespace`,namespaceData:{item:g,word:b,resolvedSchema:m.size>0?h:x,...f?{aliasFor:f}:{}}})}if(!S)return null;let w=S;return{pos:_,end:v,above:!0,create(e){if(c){let t=c(b,e,s);if(t)return{dom:t}}let t=null;if(w.tooltipType===`keyword`&&w.keywordData)t=l.keyword?l.keyword(w.keywordData):jS(w.keywordData);else if(w.tooltipType===`namespace`&&w.namespaceData){let e=w.namespaceData,{semanticType:n}=e.item;n===`table`&&l.table?t=l.table(e):n===`column`&&l.column?t=l.column(e):(n===`database`||n===`schema`||n===`namespace`)&&l.namespace?t=l.namespace(e):(t=kS(e.item),e.aliasFor&&(t=`<div class="sql-hover-alias"><code>${OS(e.word.split(`.`)[0]??``)}</code> is an alias for <code>${OS(e.aliasFor)}</code></div>`+t))}if(!t)return{dom:document.createElement(`div`)};let n=document.createElement(`div`);return n.className=`cm-sql-hover-tooltip`,n.innerHTML=t,{dom:n}}}}}function DS(e={}){let{hoverTime:t=300}=e;return En(ES(e),{hoverTime:t})}function OS(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function kS(e){let t=e.path.join(`.`),n=e.completion?.label||e.value||e.path[e.path.length-1]||`unknown`,r=`<div class="sql-hover-${e.semanticType}">`;switch(r+=`<div class="sql-hover-header"><strong>${n}</strong> <span class="sql-hover-type">${e.semanticType}</span></div>`,e.semanticType){case`database`:if(r+=`<div class="sql-hover-description">Database${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,e.namespace){let t=AS(e.namespace);t>0&&(r+=`<div class="sql-hover-children">Contains ${t} schema${t===1?``:`s`}</div>`)}break;case`schema`:if(r+=`<div class="sql-hover-description">Schema${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t&&(r+=`<div class="sql-hover-path"><strong>Path:</strong> <code>${t}</code></div>`),e.namespace){let t=AS(e.namespace);t>0&&(r+=`<div class="sql-hover-children">Contains ${t} table${t===1?``:`s`}</div>`)}break;case`table`:if(r+=`<div class="sql-hover-description">Table${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t){let t=e.path;t.length>1&&(r+=`<div class="sql-hover-path"><strong>Schema:</strong> <code>${t.slice(0,-1).join(`.`)}</code></div>`)}if(e.namespace&&$b(e.namespace)){let t=e.namespace;if(t.length>0){r+=`<div class="sql-hover-columns"><strong>Columns (${t.length}):</strong><br>`;let e=t.slice(0,8).map(e=>typeof e==`string`?e:e.label);r+=e.map(e=>`<code>${e}</code>`).join(`, `),t.length>8&&(r+=`, <em>and ${t.length-8} more...</em>`),r+=`</div>`}}break;case`column`:if(r+=`<div class="sql-hover-description">Column${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t){let t=e.path;t.length>1&&(r+=`<div class="sql-hover-path"><strong>Table:</strong> <code>${t.slice(0,-1).join(`.`)}</code></div>`)}break;default:if(r+=`<div class="sql-hover-description">Namespace${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t&&(r+=`<div class="sql-hover-path"><strong>Path:</strong> <code>${t}</code></div>`),e.namespace){let t=AS(e.namespace);t>0&&(r+=`<div class="sql-hover-children">Contains ${t} item${t===1?``:`s`}</div>`)}}return e.completion?.info&&typeof e.completion.info==`string`&&(r+=`<div class="sql-hover-info">${e.completion.info}</div>`),r+=`</div>`,r}function AS(e){return Array.isArray(e)?e.length:typeof e==`object`&&e?`self`in e&&`children`in e?1+AS(e.children):Object.keys(e).length:0}function jS(e){let{keyword:t,info:n}=e,r=`<div class="sql-hover-keyword">`;if(r+=`<div class="sql-hover-header"><strong>${t.toUpperCase()}</strong> <span class="sql-hover-type">keyword</span></div>`,r+=`<div class="sql-hover-description">${n.description}</div>`,n.syntax&&(r+=`<div class="sql-hover-syntax"><strong>Syntax:</strong> <code>${n.syntax}</code></div>`),n.example&&(r+=`<div class="sql-hover-example"><strong>Example:</strong><br><code>${n.example}</code></div>`),n.metadata&&typeof n.metadata==`object`&&Object.keys(n.metadata).length>0){r+=`<div class="sql-hover-metadata">`;for(let[e,t]of Object.entries(n.metadata))r+=`<span class="sql-hover-tag" title="${e}">${t}</span> `;r+=`</div>`}return r+=`</div>`,r}function MS(e){let{tableName:t,columns:n,metadata:r}=e,i=`<div class="sql-hover-table">`;if(i+=`<div class="sql-hover-header"><strong>${t}</strong> <span class="sql-hover-type">table</span></div>`,i+=`<div class="sql-hover-description">Table with ${n.length} column${n.length===1?``:`s`}</div>`,n.length>0){i+=`<div class="sql-hover-columns"><strong>Columns:</strong><br>`;let e=n.slice(0,10);i+=e.map(e=>`<code>${e}</code>`).join(`, `),n.length>10&&(i+=`, <em>and ${n.length-10} more...</em>`),i+=`</div>`}if(r&&typeof r==`object`&&Object.keys(r).length>0){i+=`<div class="sql-hover-metadata">`;for(let[e,t]of Object.entries(r))i+=`<span class="sql-hover-tag" title="${e}">${t}</span> `;i+=`</div>`}return i+=`</div>`,i}function NS(e){let{tableName:t,columnName:n,schema:r,metadata:i}=e,a=`<div class="sql-hover-column">`;a+=`<div class="sql-hover-header"><strong>${n}</strong> <span class="sql-hover-type">column</span></div>`,a+=`<div class="sql-hover-description">Column in table <code>${t}</code></div>`;let o=r[t];if(o&&o.length>1){let e=o.filter(e=>e!==n);if(e.length>0){a+=`<div class="sql-hover-related"><strong>Other columns in ${t}:</strong><br>`;let n=e.slice(0,8);a+=n.map(e=>`<code>${e}</code>`).join(`, `),e.length>8&&(a+=`, <em>and ${e.length-8} more...</em>`),a+=`</div>`}}if(i&&typeof i==`object`&&Object.keys(i).length>0){a+=`<div class="sql-hover-metadata">`;for(let[e,t]of Object.entries(i))a+=`<span class="sql-hover-tag" title="${e}">${t}</span> `;a+=`</div>`}return a+=`</div>`,a}var PS={keyword:jS,table:MS,column:NS,namespace:kS},FS=(e=`light`)=>{let t=e===`dark`?{tooltipBg:`#1f2937`,tooltipBorder:`#374151`,tooltipText:`#f9fafb`,tooltipTypeBg:`#374151`,tooltipTypeText:`#9ca3af`,tooltipChildren:`#9ca3af`,codeBg:`#374151`,codeText:`#f3f4f6`,strong:`#ffffff`,em:`#9ca3af`,header:`#ffffff`,info:`#d1d5db`,related:`#d1d5db`,path:`#d1d5db`,example:`#d1d5db`,columns:`#d1d5db`,syntax:`#d1d5db`}:{tooltipBg:`#ffffff`,tooltipBorder:`#e5e7eb`,tooltipText:`#374151`,tooltipTypeBg:`#f3f4f6`,tooltipTypeText:`#6b7280`,tooltipChildren:`#6b7280`,codeBg:`#f9fafb`,codeText:`#1f2937`,strong:`#111827`,em:`#6b7280`,header:`#111827`,info:`#374151`,related:`#374151`,path:`#374151`,example:`#374151`,columns:`#374151`,syntax:`#374151`};return Jn.theme({".cm-sql-hover-tooltip":{padding:`8px 12px`,backgroundColor:t.tooltipBg,border:`1px solid ${t.tooltipBorder}`,borderRadius:`6px`,boxShadow:`0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)`,fontSize:`13px`,lineHeight:`1.4`,maxWidth:`320px`,fontFamily:`system-ui, -apple-system, sans-serif`,color:t.tooltipText},".cm-sql-hover-tooltip .sql-hover-header":{marginBottom:`6px`,display:`flex`,alignItems:`center`,gap:`6px`,color:t.header},".cm-sql-hover-tooltip .sql-hover-type":{fontSize:`11px`,padding:`2px 6px`,backgroundColor:t.tooltipTypeBg,color:t.tooltipTypeText,borderRadius:`4px`,fontWeight:`500`},".cm-sql-hover-tooltip .sql-hover-description":{color:t.info,marginBottom:`8px`},".cm-sql-hover-tooltip .sql-hover-syntax":{marginBottom:`8px`,color:t.syntax},".cm-sql-hover-tooltip .sql-hover-example":{marginBottom:`4px`,color:t.example},".cm-sql-hover-tooltip .sql-hover-columns":{marginBottom:`4px`,color:t.columns},".cm-sql-hover-tooltip .sql-hover-related":{marginBottom:`4px`,color:t.related},".cm-sql-hover-tooltip .sql-hover-path":{marginBottom:`4px`,color:t.path},".cm-sql-hover-tooltip .sql-hover-info":{marginBottom:`4px`,color:t.info},".cm-sql-hover-tooltip .sql-hover-alias":{marginBottom:`6px`,color:t.tooltipChildren,fontSize:`12px`},".cm-sql-hover-tooltip .sql-hover-children":{marginBottom:`4px`,color:t.tooltipChildren,fontSize:`12px`},".cm-sql-hover-tooltip code":{backgroundColor:t.codeBg,padding:`1px 4px`,borderRadius:`3px`,fontSize:`12px`,fontFamily:`ui-monospace, 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace`,color:t.codeText},".cm-sql-hover-tooltip strong":{fontWeight:`600`,color:t.strong},".cm-sql-hover-tooltip em":{fontStyle:`italic`,color:t.em}})};function IS(e){return e.resolver??new fS(e)}var LS=Jn.baseTheme({".cm-sqlReference":{backgroundColor:`rgba(96, 165, 250, 0.18)`},".cm-sqlReference.cm-sqlDefinition":{backgroundColor:`rgba(96, 165, 250, 0.35)`},".cm-sqlGotoTarget":{textDecoration:`underline`,cursor:`pointer`}}),RS=Fn.mark({class:`cm-sqlReference`}),zS=Fn.mark({class:`cm-sqlReference cm-sqlDefinition`}),BS=Fn.mark({class:`cm-sqlGotoTarget`});function VS(e){return Fn.set(e.references.map(t=>(t.from===e.definition.from?zS:RS).range(t.from,t.to)),!0)}var HS=Cn.define(),US=cn.define({create:()=>Fn.none,update(e,t){for(let e of t.effects)if(e.is(HS))return e.value;return t.docChanged?e.map(t.changes):e},provide:e=>Jn.decorations.from(e)});function WS(e={}){let t=IS(e),n=e.highlightDelay??150;return[US,Zn.fromClass(class{view;timer=null;generation=0;constructor(e){this.view=e,this.schedule()}update(e){(e.selectionSet||e.docChanged)&&this.schedule()}schedule(){this.generation++,this.timer!=null&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null,this.run()},n)}async run(){let e=this.generation,n=this.view.state,r=n.selection.main,i=Fn.none;if(r.empty)try{let e=await t.resolve(n,r.head);e&&(i=VS(e))}catch{}if(e!==this.generation)return;let a=this.view.state.field(US,!1);(i.size!==0||a!=null&&a.size!==0)&&this.view.dispatch({effects:HS.of(i)})}destroy(){this.generation++,this.timer!=null&&clearTimeout(this.timer)}}),LS]}async function GS(e,t,n={}){let r=e.state,i=t??r.selection.main.head,a=await IS(n).resolve(r,i);return!a||e.state!==r?!1:(e.dispatch({selection:{anchor:a.definition.from,head:a.definition.to},scrollIntoView:!0,userEvent:`select`}),!0)}var KS=Cn.define(),qS=cn.define({create:()=>Fn.none,update(e,t){for(let e of t.effects)if(e.is(KS))return e.value;return t.docChanged?e.map(t.changes):e},provide:e=>Jn.decorations.from(e)});function JS(e={}){let t=IS(e);return[qS,Zn.fromClass(class{view;hovered=null;constructor(e){this.view=e}update(e){e.docChanged&&(this.hovered=null)}resultAt(e){return this.hovered&&e>=this.hovered.from&&e<=this.hovered.to?this.hovered.result:null}clear(){if(this.hovered){this.hovered=null;let e=this.view.state.field(qS,!1);e&&e.size>0&&this.view.dispatch({effects:KS.of(Fn.none)})}}async hover(e){let n=Xx(this.view.state,e);if(!n){this.clear();return}if(this.hovered&&this.hovered.from===n.from&&this.hovered.to===n.to)return;let r={from:n.from,to:n.to,result:null};this.hovered=r;let i=this.view.state;try{let a=await t.resolve(i,e);if(this.hovered!==r||this.view.state!==i)return;r.result=a,this.view.dispatch({effects:KS.of(a?Fn.set([BS.range(n.from,n.to)]):Fn.none)})}catch{}}destroy(){this.hovered=null}},{eventHandlers:{mousemove(e,t){if(!(e.metaKey||e.ctrlKey)){this.clear();return}let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n==null){this.clear();return}this.hover(n)},mousedown(e,t){if(!(e.metaKey||e.ctrlKey)||e.button!==0)return!1;let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n==null)return!1;let r=this.resultAt(n);return r?(t.dispatch({selection:{anchor:r.definition.from,head:r.definition.to},scrollIntoView:!0,userEvent:`select.pointer`}),!0):!1}}}),LS]}var YS=e=>typeof window<`u`&&typeof window.prompt==`function`?window.prompt(`Rename '${e}' to:`,e):null,XS=/^[A-Za-z_][\w$]*$/,ZS=new Set(`all.and.as.asc.between.by.case.cross.delete.desc.distinct.else.end.except.exists.fetch.from.full.group.having.in.inner.insert.intersect.into.is.join.lateral.left.like.limit.natural.not.null.offset.on.or.order.outer.qualify.recursive.right.select.set.table.then.union.update.using.values.when.where.window.with`.split(`.`));async function QS(e,t={}){let n=e.state,r=await IS(t).resolve(n,n.selection.main.head);if(!r)return!1;let i=await(t.prompt??YS)(r.name);return!i||i===r.name||!XS.test(i)||ZS.has(i.toLowerCase())||e.state!==n?!1:(e.dispatch({changes:r.references.map(e=>({from:e.from,to:e.to,insert:i})),userEvent:`rename`}),!0)}function $S(e={}){let t={...e,resolver:IS(e)},n=e.gotoDefinitionKeys??[`F12`,`Mod-b`],r=e.renameKey??`F2`;return pn.of([...n.map(e=>({key:e,run:e=>(GS(e,void 0,t),!0)})),{key:r,run:e=>(QS(e,t),!0)}])}function eC(e={}){let t={...e,resolver:IS(e)},n=[WS(t),JS(t)];return e.keymap&&n.push($S(t)),n}var tC=750;function nC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&e.type===`select`}function rC(e){return Array.isArray(e)?e:[]}function iC(e){return{sources:[],columnRefs:[],selectAliases:new Set,checkUnqualified:e,hasUsingJoin:!1}}function aC(e,t,n){let r=rC(e.with);for(let e of r){let n=e.name,r=typeof n==`string`?n:n?.value;typeof r==`string`&&t.add(r.toLowerCase())}for(let e of r){let r=e.stmt,i=r?.ast??r;nC(i)&&cC(i,t,n,!1)}}function oC(e,t,n,r){e.using!=null&&(t.hasUsingJoin=!0),typeof e.join==`string`&&e.join.toLowerCase().includes(`natural`)&&(t.hasUsingJoin=!0),e.on!=null&&sC(e.on,t,n,r);let i=e.expr;if(i!=null){let a=i.ast??i;nC(a)&&cC(a,n,r,!1),t.sources.push({path:``,name:``,alias:typeof e.as==`string`?e.as:null,isCte:!1,opaque:!0});return}if(typeof e.table==`string`){let r=[e.db??e.catalog,e.schema,e.table].filter(e=>typeof e==`string`&&e.length>0);t.sources.push({path:r.join(`.`),name:e.table,alias:typeof e.as==`string`?e.as:null,isCte:r.length===1&&n.has(e.table.toLowerCase()),opaque:!1})}}function sC(e,t,n,r){if(typeof e!=`object`||!e)return;if(Array.isArray(e)){for(let i of e)sC(i,t,n,r);return}let i=e;if(i.type===`column_ref`){t.columnRefs.push(i);return}if(nC(i)){cC(i,n,r,!0);return}if(nC(i.ast)){cC(i.ast,n,r,!0);return}for(let[e,a]of Object.entries(i))e!==`loc`&&e!==`tableList`&&e!==`columnList`&&sC(a,t,n,r)}function cC(e,t,n,r){let i=new Set(t);aC(e,i,n);let a=iC(!r);n.push(a);for(let t of rC(e.from))oC(t,a,i,n);for(let t of rC(e.columns))typeof t.as==`string`&&a.selectAliases.add(t.as.toLowerCase());for(let[t,r]of Object.entries(e))t!==`with`&&t!==`from`&&t!==`loc`&&sC(r,a,i,n)}function lC(e,t){let n=new Set;switch(e.type){case`select`:cC(e,n,t,!1);return;case`update`:{aC(e,n,t);let r=iC(!0);t.push(r);for(let i of rC(e.table))oC(i,r,n,t);for(let i of rC(e.from))oC(i,r,n,t);for(let i of rC(e.set))i.column!=null&&r.columnRefs.push({type:`column_ref`,table:i.table??null,column:i.column}),sC(i.value,r,n,t);for(let[i,a]of Object.entries(e))i!==`with`&&i!==`table`&&i!==`from`&&i!==`set`&&i!==`loc`&&sC(a,r,n,t);return}case`delete`:{aC(e,n,t);let r=iC(!0);t.push(r);for(let i of rC(e.from))oC(i,r,n,t);for(let[i,a]of Object.entries(e))i!==`with`&&i!==`table`&&i!==`from`&&i!==`loc`&&sC(a,r,n,t);return}case`insert`:case`replace`:{aC(e,n,t);let r=iC(!1);t.push(r);for(let i of rC(e.table))oC(i,r,n,t);for(let[i,a]of Object.entries(e))i!==`with`&&i!==`table`&&i!==`columns`&&i!==`loc`&&(nC(a)?cC(a,n,t,!1):sC(a,r,n,t));return}case`create`:case`alter`:case`drop`:{let r=iC(!1);t.push(r);for(let[i,a]of Object.entries(e))i!==`table`&&i!==`loc`&&(nC(a)?cC(a,n,t,!1):sC(a,r,n,t));return}default:{let r=iC(!1);t.push(r);for(let[i,a]of Object.entries(e))i!==`loc`&&sC(a,r,n,t)}}}function uC(e){let t=e.column;if(typeof t==`string`)return t;if(typeof t==`object`&&t){let e=t.expr?.value??t.value;if(typeof e==`string`)return e}return null}function dC(e){return typeof e.table!=`string`||e.table.length===0?null:typeof e.db==`string`&&e.db.length>0?`${e.db}.${e.table}`:e.table}function fC(e){if(e==null)return null;let t=Qb(e)?e.children:e;return $b(t)?t.map(e=>typeof e==`string`?e:e.label):null}function pC(e,t){let n=tx(e,t,{caseSensitive:!1});if(n)return{exists:!0,columns:fC(n.namespace)};let r=t.split(`.`).map(e=>e.toLowerCase()),i=r[r.length-1];if(!i)return{exists:!1,columns:null};let a=ax(e,i).filter(e=>{if(fC(e.namespace)===null||e.path.length<r.length)return!1;let t=e.path.slice(-r.length).map(e=>e.toLowerCase());return r.every((e,n)=>t[n]===e)});return a.length===0?{exists:!1,columns:null}:{exists:!0,columns:a.length===1?fC(a[0]?.namespace):null}}function mC(e,t){let n=t.toLowerCase();return e.some(e=>e.toLowerCase()===n)}function hC(e,t){let n=[];lC(e,n);let r=new Map,i=e=>{let t=`${e.kind}::${e.identifier.toLowerCase()}`;r.has(t)||r.set(t,e)};for(let e of n){let n=e.sources.map(e=>{if(e.opaque||e.isCte)return{source:e,exists:!0,columns:null};let n=pC(t,e.path);return{source:e,exists:n.exists,columns:n.columns}});for(let{source:e,exists:t}of n)!e.opaque&&!e.isCte&&!t&&i({kind:`unknownTable`,identifier:e.name,message:`Unknown table '${e.path}'`});for(let t of e.columnRefs){let r=uC(t);if(!r||r===`*`)continue;let a=dC(t);if(a){let e=a.toLowerCase(),t=n.find(t=>t.source.alias?.toLowerCase()===e)??n.find(t=>t.source.name.toLowerCase()===e||t.source.path.toLowerCase()===e);t?.columns&&!mC(t.columns,r)&&i({kind:`unknownColumn`,identifier:r,message:`Column '${r}' not found in table '${t.source.path||a}'`});continue}if(!e.checkUnqualified||e.selectAliases.has(r.toLowerCase()))continue;let o=n.filter(e=>e.columns!==null&&mC(e.columns,r));if(o.length>=2&&!e.hasUsingJoin){i({kind:`ambiguousColumn`,identifier:r,message:`Column '${r}' is ambiguous; it exists in ${o.map(e=>e.source.name).join(`, `)}`});continue}let s=n.length===1?n[0]:void 0;s&&s.columns!==null&&o.length===0&&i({kind:`unknownColumn`,identifier:r,message:`Column '${r}' not found in table '${s.source.path}'`})}}return[...r.values()]}function gC(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),i=n.indexOf(r);for(;i!==-1;){let e=i>0?n[i-1]??``:``,t=n[i+r.length]??``;if(!/[\w$]/.test(e)&&!/[\w$]/.test(t))return i;i=n.indexOf(r,i+1)}return-1}function _C(e,t,n,r){let i=n.sliceString(t.from,t.to),a=gC(i,e.identifier),o=a===-1?t.from:t.from+a;return{from:o,to:Math.min(a===-1?t.from+(i.match(/^[\w"'`.]+/)?.[0].length??1):o+e.identifier.length,t.to),severity:r,message:e.message,source:`sql-schema`}}function vC(e){return $b(e)?e.length===0:Zb(e)?Object.keys(e).length===0:!1}function yC(e={}){let t=e.parser||new hx,n=e.structureAnalyzer||new Hx(t),r={unknownTable:e.severity?.unknownTable??`warning`,unknownColumn:e.severity?.unknownColumn??`warning`,ambiguousColumn:e.severity?.ambiguousColumn??`warning`};return async i=>{let a=lx(e.schema,i);if(a==null||vC(a))return[];let o=i.state.doc;if(!o.toString().trim())return[];let s=[],c=await n.analyzeDocument(i.state);for(let e of c){if(!e.isValid)continue;let n=await t.parse(e.content,{state:i.state});if(!n.success||n.ast==null)continue;let c=Array.isArray(n.ast)?n.ast:[n.ast];for(let t of c)for(let n of hC(t,a)){let t=r[n.kind];t!==`off`&&s.push(_C(n,e,o,t))}}return s}}function bC(e={}){return yr(yC(e),{delay:e.delay||tC})}var xC=Cn.define(),SC=cn.define({create(){return{currentStatement:null,allStatements:[],cursorPosition:0,isFocused:!0}},update(e,t){for(let e of t.effects)if(e.is(xC))return e.value;return e}});function CC(e,t){let{isCurrent:n,isValid:r,isFocused:i}=t,a=e.backgroundColor||`#3b82f6`;!r&&e.showInvalid!==!1&&(a=e.errorBackgroundColor||`#ef4444`);let o=n?`1`:(e.inactiveOpacity??.3).toString(),s;return s=i?o:e.unfocusedOpacity===void 0?e.hideWhenNotFocused?`0`:o:e.unfocusedOpacity.toString(),{backgroundColor:a,opacity:s}}var wC=class extends Ln{config;isCurrent;isValid;isFocused;constructor(e,t,n=!0,r=!0){super(),this.config=e,this.isCurrent=t,this.isValid=n,this.isFocused=r}toDOM(){let e=document.createElement(`div`);e.className=`cm-sql-gutter-marker`;let{backgroundColor:t,opacity:n}=CC(this.config,{isCurrent:this.isCurrent,isValid:this.isValid,isFocused:this.isFocused});return e.style.cssText=`
105
+ `||s===`\r`)){i=!1,t+=s,o++;continue}if(i||a){o++;continue}if(!n&&(s===`'`||s===`"`||s==="`"))n=!0,r=s,t+=s;else if(n&&s===r){if(c===r){t+=s+c,o+=2;continue}n=!1,r=``,t+=s}else t+=s;o++}return t}clearCache(){this.cache.clear()}};function Kx(e={}){let t=e.parser??new vx,n=e.contextAnalyzer??new Wx(t),r=new Gx(t);return async t=>{let i=t.matchBefore(/(?:[\w$]+|"[^"]+"|`[^`]+`|\[[^\]]+\])\.[\w$]*/);if(!i||t.state.sliceDoc(Math.max(0,i.from-1),i.from)===`.`)return null;let a=i.text.lastIndexOf(`.`),o=Tx(i.text.slice(0,a)),s=await r.getStatementAtPosition(t.state,t.pos),c=s?t.state.sliceDoc(s.from,s.to):t.state.doc.toString(),l=await n.getContext(c,{state:t.state}),u=l.aliases.get(o.toLowerCase());if(!u)return null;let d=null,f=l.ctes.find(e=>e.name.toLowerCase()===u.toLowerCase());if(f&&f.columns.length>0)d=f.columns;else if(!f){let n=px(e.schema,t);n!=null&&(d=hx(n,u))}if(!d||d.length===0)return null;let p=`column of ${u}`;return{from:i.from+a+1,options:d.map(e=>gx(e,p)),validFor:/^[\w$]*$/}}}var qx=1,Jx=/\b(?:from|join|into|update|table)\s+$/i,Yx=/\bfrom\s+[\w$."`[\]]+(?:\s+(?:as\s+)?[\w$"`[\]]+)?(?:\s*,\s*[\w$."`[\]]+(?:\s+(?:as\s+)?[\w$"`[\]]+)?)*\s*,\s*$/i;function Xx(e={}){let t=e.parser??new vx,n=e.contextAnalyzer??new Wx(t),r=new Gx(t);return async t=>{let i=t.matchBefore(/[\w$]*/);if(!i||i.from===i.to&&!t.explicit||t.state.sliceDoc(Math.max(0,i.from-1),i.from)===`.`)return null;let a=t.state.sliceDoc(Math.max(0,i.from-256),i.from);if(Jx.test(a)||Yx.test(a))return null;let o=await r.getStatementAtPosition(t.state,t.pos),s=o?.from??0,c=o?t.state.sliceDoc(o.from,o.to):t.state.doc.toString(),l=Lx(c),u=Math.max(s,i.from-1)-s,d=i.to-s;if(l.slice(u,d)!==c.slice(u,d))return null;let f=await n.getContext(c,{state:t.state});if(f.tables.length===0)return null;let p=px(e.schema,t),m=[],h=new Set,g=new Set;for(let e of f.tables){let t=e.path.join(`.`).toLowerCase();if(g.has(t))continue;g.add(t);let n=f.ctes.find(t=>t.name.toLowerCase()===e.name.toLowerCase()),r=null;if(n?r=n.columns.length>0?n.columns:null:p!=null&&(r=hx(p,e.path)),!r)continue;let i=`column of ${e.name}`;for(let e of r){let t=(typeof e==`string`?e:e.label).toLowerCase();h.has(t)||(h.add(t),m.push(gx(e,i,qx)))}}return m.length===0?null:{from:i.from,options:m,validFor:/^[\w$]*$/}}}var Zx=/[\w$]/,Qx=/"[^"]*"|`[^`]*`|\[[^\]]*\]/g;function $x(e,t){let n=e.doc.lineAt(t),r=n.text,i=t-n.from;Qx.lastIndex=0;let a=Qx.exec(r);for(;a!==null&&a.index<=i;){let e=a.index+a[0].length;if(i<=e)return{from:n.from+a.index,to:n.from+e,text:Tx(a[0])};a=Qx.exec(r)}let o=i,s=i;for(;o>0&&Zx.test(r[o-1]??``);)o--;for(;s<r.length&&Zx.test(r[s]??``);)s++;return o===s?null:{from:n.from+o,to:n.from+s,text:r.slice(o,s)}}async function eS(e,t,n){let r=await e.analyzeDocument(t),i=null;for(let e of r){if(n>=e.from&&n<=e.to)return e;e.from<=n&&(i=e)}return i}function tS(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function nS(e,t={}){let n=tS(e);return`(?:"${n}"|\`${n}\`|\\[${n}\\]|${t.allowLeadingDot?`(?<![\\w$])`:`(?<![\\w$.])`}${n}(?![\\w$]))`}function rS(e,t,n={}){let r=new RegExp(nS(t),`gi`),i=[],a=r.exec(e);for(;a!==null;){let t=a.index+a[0].length;(!n.followedByDot||e[t]===`.`)&&i.push({from:a.index,to:t}),a=r.exec(e)}return i}function iS(e){let t=[],n=0;for(let r=0;r<e.length;r++)e[r]===`)`&&(n=Math.max(0,n-1)),t[r]=n,e[r]===`(`&&n++;return t}var aS=/\b(select|from|where|having|qualify|on|set|values|by|join|limit|offset|union|intersect|except|window)\b/gi;function oS(e){aS.lastIndex=0;let t=null,n=aS.exec(e);for(;n!==null;)t=(n[1]??``).toLowerCase(),n=aS.exec(e);return t}function sS(e,t){let n=t-1;for(;;){for(;n>=0&&/\s/.test(e[n]??``);)n--;if(n>=0&&e[n]===`.`){for(n--;n>=0&&/\s/.test(e[n]??``);)n--;let t=e[n];if(t===`"`||t==="`"||t===`]`){let r=t===`]`?`[`:t;for(n--;n>=0&&e[n]!==r;)n--;n--}else for(;n>=0&&Zx.test(e[n]??``);)n--;continue}break}if(n<0)return!1;if(e[n]===`,`)return oS(e.slice(0,n))===`from`;let r=/([A-Za-z_]+)$/.exec(e.slice(0,n+1))?.[1]?.toLowerCase();return r===`from`||r===`join`}function cS(e){let t=new Map;for(let n of e)t.has(n.from)||t.set(n.from,n);return[...t.values()].sort((e,t)=>e.from-t.from)}function lS(e,t){return e.some(e=>e.from<=t.from&&t.to<=e.to)}function uS(e,t,n){let r=Lx(e),i=n.text.toLowerCase(),a=t.selectAliases.some(e=>e.toLowerCase()===i),o=t.ctes.find(e=>e.name.toLowerCase()===i);if(o){let e=t.aliases.get(i);if(e&&e.toLowerCase()!==i||a||o.from<0)return null;let s={from:o.from,to:o.to},c=cS([s,...rS(r,o.name).filter(e=>r[e.to]===`.`||sS(r,e.from))]);return lS(c,n)?{kind:`cte`,name:o.name,definition:s,references:c}:null}if(t.aliases.has(i)){if(a)return null;let e=t.tables.filter(e=>e.alias?.toLowerCase()===i);if(e.length!==1||!e[0])return null;let o=e[0],s=o.alias??n.text,c=nS(o.name,{allowLeadingDot:!0}),l=RegExp(`${c}\\s+(?:AS\\s+)?(${nS(s)})`,`gi`),u=l.exec(r);for(;u!==null&&!sS(r,u.index);)u=l.exec(r);if(!u||u[1]==null)return null;let d={from:u.index+u[0].length-u[1].length,to:u.index+u[0].length},f=cS([d,...rS(r,s,{followedByDot:!0})]);return lS(f,n)?{kind:`table-alias`,name:s,definition:d,references:f}:null}let s=t.selectAliases.find(e=>e.toLowerCase()===i);if(s){let e=iS(r),t=t=>e[t]===0,i=dS(r,/\bFROM\b/gi,t),a=i?i.index:r.length,o=RegExp(`\\bAS\\s+(${nS(s)})`,`gi`),c=null,l=o.exec(r);for(;l!==null;){let e=l.index+l[0].length-(l[1]?.length??0);if(t(l.index)&&e<a){c={from:e,to:l.index+l[0].length};break}l=o.exec(r)}if(!c)return null;let u=mS(r,t),d=rS(r,s).filter(e=>u.some(t=>e.from>=t.from&&e.to<=t.to)),f=cS([c,...d]);return lS(f,n)?{kind:`select-alias`,name:s,definition:c,references:f}:null}return null}function dS(e,t,n){let r=t.exec(e);for(;r!==null;){if(n(r.index))return r;r=t.exec(e)}return null}var fS=/\b(?:GROUP\s+BY|ORDER\s+BY|HAVING|QUALIFY)\b/gi,pS=/\b(?:GROUP\s+BY|ORDER\s+BY|HAVING|QUALIFY|LIMIT|OFFSET|FETCH|WINDOW|UNION|INTERSECT|EXCEPT)\b/gi;function mS(e,t){let n=[];fS.lastIndex=0;let r=fS.exec(e);for(;r!==null;){if(t(r.index)){let i=r.index+r[0].length;pS.lastIndex=i;let a=e.length,o=pS.exec(e);for(;o!==null;){if(t(o.index)){a=o.index;break}o=pS.exec(e)}n.push({from:i,to:a})}r=fS.exec(e)}return n}var hS=class{structureAnalyzer;contextAnalyzer;constructor(e={}){let t=e.parser??new vx;this.structureAnalyzer=e.structureAnalyzer??new Gx(t),this.contextAnalyzer=e.contextAnalyzer??new Wx(t)}async resolve(e,t){let n=$x(e,t);if(!n)return null;let r=await eS(this.structureAnalyzer,e,t);if(!r||n.from<r.from||n.to>r.to)return null;let i=e.sliceDoc(r.from,r.to),a=uS(i,await this.contextAnalyzer.getContext(i,{state:e}),{from:n.from-r.from,to:n.to-r.from,text:n.text});if(!a)return null;let o=e=>({from:e.from+r.from,to:e.to+r.from});return{...a,definition:o(a.definition),references:a.references.map(o)}}},gS=/([\w$]+|"[^"]+"|`[^`]+`|\[[^\]]+\])$/;function _S(e){return/\b(?:from|join)\s+$/i.test(e)}function vS(e){return/^[A-Za-z_][\w$]*$/.test(e)}function yS(e){return{label:e.name,type:`variable`,info:`Common Table Expression: ${e.name}`,boost:10,...vS(e.name)?{}:{apply:`"${e.name}"`}}}function bS(e){return e.columns.map(t=>({label:t,type:`property`,detail:`column of ${e.name}`,boost:5,...vS(t)?{}:{apply:`"${t}"`}}))}function xS(e={}){let t=e.parser??new vx,n=e.contextAnalyzer??new Wx(t),r=e.structureAnalyzer??new Gx(t);return async e=>{let t=e.matchBefore(/[\w$]*/);if(!t)return null;let i=e.state.sliceDoc(Math.max(0,t.from-1),t.from)===`.`;if(t.from===t.to&&!e.explicit&&!i)return null;let a=await eS(r,e.state,e.pos),o=a?e.state.sliceDoc(a.from,a.to):e.state.doc.toString(),s=await n.getContext(o,{state:e.state});if(s.ctes.length===0)return null;if(i){let n=e.state.doc.lineAt(t.from),r=e.state.sliceDoc(n.from,t.from-1),i=gS.exec(r);if(!i||!i[1]||r.slice(0,r.length-i[1].length).endsWith(`.`))return null;let a=Tx(i[1]).toLowerCase(),o=s.ctes.find(e=>e.name.toLowerCase()===a);return!o||o.columns.length===0?null:{from:t.from,options:bS(o),validFor:/^[\w$]*$/}}let c=s.ctes.map(yS);if(!_S(e.state.sliceDoc(Math.max(0,t.from-64),t.from))){let e=new Set(s.tables.map(e=>e.name.toLowerCase())),t=new Set;for(let n of s.ctes)if(e.has(n.name.toLowerCase()))for(let e of bS(n)){let n=e.label.toLowerCase();t.has(n)||(t.add(n),c.push(e))}}return{from:t.from,options:c,validFor:/^[\w$]*$/}}}var SS=750;function CS(e,t){if(t>=e.length)return e.length;let n=e.lineAt(t),r=n.text.slice(t-n.from).match(/^[\w"'`.]+/);return r?t+r[0].length:Math.min(t+1,e.length)}function wS(e,t){let n=t.line(Math.min(e.line,t.lines)),r=Math.min(n.from+Math.max(0,e.column-1),t.length);return{from:r,to:CS(t,r),severity:e.severity,message:e.message,source:`sql-parser`}}function TS(e,t,n){let r;return r=e.line<=1?t.from+Math.max(0,e.column-1):n.line(Math.min(t.lineFrom+e.line-1,n.lines)).from+Math.max(0,e.column-1),r=Math.max(t.from,Math.min(r,t.to)),{from:r,to:Math.max(r,Math.min(CS(n,r),t.to)),severity:e.severity,message:e.message,source:`sql-parser`}}function ES(e={}){return yr(DS(e),{delay:e.delay||SS})}function DS(e={}){let t=e.parser||new vx,n=e.perStatement!==!1,r=e.structureAnalyzer||new Gx(t);return async e=>{let i=e.state.doc,a=i.toString();return a.trim()?n?(await r.analyzeDocument(e.state)).flatMap(e=>e.errors.map(t=>TS(t,e,i))):(await t.validateSql(a,{state:e.state})).map(e=>wS(e,i)):[]}}function OS(e,t){if(t.size===0)return{};if(ex(e)){let n={};for(let[r,i]of Object.entries(e))if(Array.from(t).some(e=>e.toLowerCase()===r.toLowerCase()))n[r]=i;else if(ex(i)){let e=OS(i,t);Object.keys(e).length>0&&(n[r]=e)}return n}return e}function kS(e={}){let{schema:t,keywords:n={},enableKeywords:r=!0,enableTables:i=!0,enableColumns:a=!0,enableFuzzySearch:o=!0,parser:s=new vx,tooltipRender:c,tooltipRenderers:l={}}=e,u=new Gx(s),d=e.contextAnalyzer??new Wx(s),f=null;return async(e,s,p)=>{let{from:m,to:h,text:g}=e.state.doc.lineAt(s),_=s,v=s;f===null&&(f=typeof n==`function`?n(e):Promise.resolve(n));let y;try{y=await f}catch{f=null,y={}}for(;_>m&&/[\w.]/.test(g[_-m-1]??``);)_--;for(;v<h&&/[\w.]/.test(g[v-m]??``);)v++;if(_===s&&p<0||v===s&&p>0)return null;let b=g.slice(_-m,v-m).toLowerCase();if(!b||b.length===0)return null;let x=fx(t,e)??{},S=null;`${b}`;let C=Object.hasOwn(y,b)?y[b]:void 0;if(!S&&r&&C&&(S={word:b,view:e,pos:s,tooltipType:`keyword`,keywordData:{keyword:b,info:C}}),!S&&(i||a)&&x){let t=await u.getStatementAtPosition(e.state,s),n=t?e.state.doc.sliceString(t.from,t.to):e.state.doc.toString(),r=await d.getContext(n,{state:e.state}),[c=``,...l]=b.split(`.`),f=r.aliases.get(c),p=f?[f,...l].join(`.`).toLowerCase():b,m=new Set(r.tables.map(e=>e.name.toLowerCase())),h=OS(x,m),g=ux(h,p,{enableFuzzySearch:o});if(!g&&m.size===0&&(g=ux(x,p,{enableFuzzySearch:o})),g){let{semanticType:e}=g;(e===`table`&&!i||e===`column`&&!a)&&(g=null)}g&&(Array.from(m),S={word:b,view:e,pos:s,tooltipType:`namespace`,namespaceData:{item:g,word:b,resolvedSchema:m.size>0?h:x,...f?{aliasFor:f}:{}}})}if(!S)return null;let w=S;return{pos:_,end:v,above:!0,create(e){if(c){let t=c(b,e,s);if(t)return{dom:t}}let t=null;if(w.tooltipType===`keyword`&&w.keywordData)t=l.keyword?l.keyword(w.keywordData):PS(w.keywordData);else if(w.tooltipType===`namespace`&&w.namespaceData){let e=w.namespaceData,{semanticType:n}=e.item;n===`table`&&l.table?t=l.table(e):n===`column`&&l.column?t=l.column(e):(n===`database`||n===`schema`||n===`namespace`)&&l.namespace?t=l.namespace(e):(t=MS(e.item),e.aliasFor&&(t=`<div class="sql-hover-alias"><code>${jS(e.word.split(`.`)[0]??``)}</code> is an alias for <code>${jS(e.aliasFor)}</code></div>`+t))}if(!t)return{dom:document.createElement(`div`)};let n=document.createElement(`div`);return n.className=`cm-sql-hover-tooltip`,n.innerHTML=t,{dom:n}}}}}function AS(e={}){let{hoverTime:t=300}=e;return En(kS(e),{hoverTime:t})}function jS(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function MS(e){let t=e.path.join(`.`),n=e.completion?.label||e.value||e.path[e.path.length-1]||`unknown`,r=`<div class="sql-hover-${e.semanticType}">`;switch(r+=`<div class="sql-hover-header"><strong>${n}</strong> <span class="sql-hover-type">${e.semanticType}</span></div>`,e.semanticType){case`database`:if(r+=`<div class="sql-hover-description">Database${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,e.namespace){let t=NS(e.namespace);t>0&&(r+=`<div class="sql-hover-children">Contains ${t} schema${t===1?``:`s`}</div>`)}break;case`schema`:if(r+=`<div class="sql-hover-description">Schema${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t&&(r+=`<div class="sql-hover-path"><strong>Path:</strong> <code>${t}</code></div>`),e.namespace){let t=NS(e.namespace);t>0&&(r+=`<div class="sql-hover-children">Contains ${t} table${t===1?``:`s`}</div>`)}break;case`table`:if(r+=`<div class="sql-hover-description">Table${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t){let t=e.path;t.length>1&&(r+=`<div class="sql-hover-path"><strong>Schema:</strong> <code>${t.slice(0,-1).join(`.`)}</code></div>`)}if(e.namespace&&nx(e.namespace)){let t=e.namespace;if(t.length>0){r+=`<div class="sql-hover-columns"><strong>Columns (${t.length}):</strong><br>`;let e=t.slice(0,8).map(e=>typeof e==`string`?e:e.label);r+=e.map(e=>`<code>${e}</code>`).join(`, `),t.length>8&&(r+=`, <em>and ${t.length-8} more...</em>`),r+=`</div>`}}break;case`column`:if(r+=`<div class="sql-hover-description">Column${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t){let t=e.path;t.length>1&&(r+=`<div class="sql-hover-path"><strong>Table:</strong> <code>${t.slice(0,-1).join(`.`)}</code></div>`)}break;default:if(r+=`<div class="sql-hover-description">Namespace${e.completion?.detail?`: ${e.completion.detail}`:``}</div>`,t&&(r+=`<div class="sql-hover-path"><strong>Path:</strong> <code>${t}</code></div>`),e.namespace){let t=NS(e.namespace);t>0&&(r+=`<div class="sql-hover-children">Contains ${t} item${t===1?``:`s`}</div>`)}}return e.completion?.info&&typeof e.completion.info==`string`&&(r+=`<div class="sql-hover-info">${e.completion.info}</div>`),r+=`</div>`,r}function NS(e){return Array.isArray(e)?e.length:typeof e==`object`&&e?`self`in e&&`children`in e?1+NS(e.children):Object.keys(e).length:0}function PS(e){let{keyword:t,info:n}=e,r=`<div class="sql-hover-keyword">`;if(r+=`<div class="sql-hover-header"><strong>${t.toUpperCase()}</strong> <span class="sql-hover-type">keyword</span></div>`,r+=`<div class="sql-hover-description">${n.description}</div>`,n.syntax&&(r+=`<div class="sql-hover-syntax"><strong>Syntax:</strong> <code>${n.syntax}</code></div>`),n.example&&(r+=`<div class="sql-hover-example"><strong>Example:</strong><br><code>${n.example}</code></div>`),n.metadata&&typeof n.metadata==`object`&&Object.keys(n.metadata).length>0){r+=`<div class="sql-hover-metadata">`;for(let[e,t]of Object.entries(n.metadata))r+=`<span class="sql-hover-tag" title="${e}">${t}</span> `;r+=`</div>`}return r+=`</div>`,r}function FS(e){let{tableName:t,columns:n,metadata:r}=e,i=`<div class="sql-hover-table">`;if(i+=`<div class="sql-hover-header"><strong>${t}</strong> <span class="sql-hover-type">table</span></div>`,i+=`<div class="sql-hover-description">Table with ${n.length} column${n.length===1?``:`s`}</div>`,n.length>0){i+=`<div class="sql-hover-columns"><strong>Columns:</strong><br>`;let e=n.slice(0,10);i+=e.map(e=>`<code>${e}</code>`).join(`, `),n.length>10&&(i+=`, <em>and ${n.length-10} more...</em>`),i+=`</div>`}if(r&&typeof r==`object`&&Object.keys(r).length>0){i+=`<div class="sql-hover-metadata">`;for(let[e,t]of Object.entries(r))i+=`<span class="sql-hover-tag" title="${e}">${t}</span> `;i+=`</div>`}return i+=`</div>`,i}function IS(e){let{tableName:t,columnName:n,schema:r,metadata:i}=e,a=`<div class="sql-hover-column">`;a+=`<div class="sql-hover-header"><strong>${n}</strong> <span class="sql-hover-type">column</span></div>`,a+=`<div class="sql-hover-description">Column in table <code>${t}</code></div>`;let o=r[t];if(o&&o.length>1){let e=o.filter(e=>e!==n);if(e.length>0){a+=`<div class="sql-hover-related"><strong>Other columns in ${t}:</strong><br>`;let n=e.slice(0,8);a+=n.map(e=>`<code>${e}</code>`).join(`, `),e.length>8&&(a+=`, <em>and ${e.length-8} more...</em>`),a+=`</div>`}}if(i&&typeof i==`object`&&Object.keys(i).length>0){a+=`<div class="sql-hover-metadata">`;for(let[e,t]of Object.entries(i))a+=`<span class="sql-hover-tag" title="${e}">${t}</span> `;a+=`</div>`}return a+=`</div>`,a}var LS={keyword:PS,table:FS,column:IS,namespace:MS},RS=(e=`light`)=>{let t=e===`dark`?{tooltipBg:`#1f2937`,tooltipBorder:`#374151`,tooltipText:`#f9fafb`,tooltipTypeBg:`#374151`,tooltipTypeText:`#9ca3af`,tooltipChildren:`#9ca3af`,codeBg:`#374151`,codeText:`#f3f4f6`,strong:`#ffffff`,em:`#9ca3af`,header:`#ffffff`,info:`#d1d5db`,related:`#d1d5db`,path:`#d1d5db`,example:`#d1d5db`,columns:`#d1d5db`,syntax:`#d1d5db`}:{tooltipBg:`#ffffff`,tooltipBorder:`#e5e7eb`,tooltipText:`#374151`,tooltipTypeBg:`#f3f4f6`,tooltipTypeText:`#6b7280`,tooltipChildren:`#6b7280`,codeBg:`#f9fafb`,codeText:`#1f2937`,strong:`#111827`,em:`#6b7280`,header:`#111827`,info:`#374151`,related:`#374151`,path:`#374151`,example:`#374151`,columns:`#374151`,syntax:`#374151`};return Jn.theme({".cm-sql-hover-tooltip":{padding:`8px 12px`,backgroundColor:t.tooltipBg,border:`1px solid ${t.tooltipBorder}`,borderRadius:`6px`,boxShadow:`0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)`,fontSize:`13px`,lineHeight:`1.4`,maxWidth:`320px`,fontFamily:`system-ui, -apple-system, sans-serif`,color:t.tooltipText},".cm-sql-hover-tooltip .sql-hover-header":{marginBottom:`6px`,display:`flex`,alignItems:`center`,gap:`6px`,color:t.header},".cm-sql-hover-tooltip .sql-hover-type":{fontSize:`11px`,padding:`2px 6px`,backgroundColor:t.tooltipTypeBg,color:t.tooltipTypeText,borderRadius:`4px`,fontWeight:`500`},".cm-sql-hover-tooltip .sql-hover-description":{color:t.info,marginBottom:`8px`},".cm-sql-hover-tooltip .sql-hover-syntax":{marginBottom:`8px`,color:t.syntax},".cm-sql-hover-tooltip .sql-hover-example":{marginBottom:`4px`,color:t.example},".cm-sql-hover-tooltip .sql-hover-columns":{marginBottom:`4px`,color:t.columns},".cm-sql-hover-tooltip .sql-hover-related":{marginBottom:`4px`,color:t.related},".cm-sql-hover-tooltip .sql-hover-path":{marginBottom:`4px`,color:t.path},".cm-sql-hover-tooltip .sql-hover-info":{marginBottom:`4px`,color:t.info},".cm-sql-hover-tooltip .sql-hover-alias":{marginBottom:`6px`,color:t.tooltipChildren,fontSize:`12px`},".cm-sql-hover-tooltip .sql-hover-children":{marginBottom:`4px`,color:t.tooltipChildren,fontSize:`12px`},".cm-sql-hover-tooltip code":{backgroundColor:t.codeBg,padding:`1px 4px`,borderRadius:`3px`,fontSize:`12px`,fontFamily:`ui-monospace, 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace`,color:t.codeText},".cm-sql-hover-tooltip strong":{fontWeight:`600`,color:t.strong},".cm-sql-hover-tooltip em":{fontStyle:`italic`,color:t.em}})};function zS(e){return e.resolver??new hS(e)}var BS=Jn.baseTheme({".cm-sqlReference":{backgroundColor:`rgba(96, 165, 250, 0.18)`},".cm-sqlReference.cm-sqlDefinition":{backgroundColor:`rgba(96, 165, 250, 0.35)`},".cm-sqlGotoTarget":{textDecoration:`underline`,cursor:`pointer`}}),VS=Fn.mark({class:`cm-sqlReference`}),HS=Fn.mark({class:`cm-sqlReference cm-sqlDefinition`}),US=Fn.mark({class:`cm-sqlGotoTarget`});function WS(e){return Fn.set(e.references.map(t=>(t.from===e.definition.from?HS:VS).range(t.from,t.to)),!0)}var GS=Cn.define(),KS=cn.define({create:()=>Fn.none,update(e,t){for(let e of t.effects)if(e.is(GS))return e.value;return t.docChanged?e.map(t.changes):e},provide:e=>Jn.decorations.from(e)});function qS(e={}){let t=zS(e),n=e.highlightDelay??150;return[KS,Zn.fromClass(class{view;timer=null;generation=0;constructor(e){this.view=e,this.schedule()}update(e){(e.selectionSet||e.docChanged)&&this.schedule()}schedule(){this.generation++,this.timer!=null&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this.timer=null,this.run()},n)}async run(){let e=this.generation,n=this.view.state,r=n.selection.main,i=Fn.none;if(r.empty)try{let e=await t.resolve(n,r.head);e&&(i=WS(e))}catch{}if(e!==this.generation)return;let a=this.view.state.field(KS,!1);(i.size!==0||a!=null&&a.size!==0)&&this.view.dispatch({effects:GS.of(i)})}destroy(){this.generation++,this.timer!=null&&clearTimeout(this.timer)}}),BS]}async function JS(e,t,n={}){let r=e.state,i=t??r.selection.main.head,a=await zS(n).resolve(r,i);return!a||e.state!==r?!1:(e.dispatch({selection:{anchor:a.definition.from,head:a.definition.to},scrollIntoView:!0,userEvent:`select`}),!0)}var YS=Cn.define(),XS=cn.define({create:()=>Fn.none,update(e,t){for(let e of t.effects)if(e.is(YS))return e.value;return t.docChanged?e.map(t.changes):e},provide:e=>Jn.decorations.from(e)});function ZS(e={}){let t=zS(e);return[XS,Zn.fromClass(class{view;hovered=null;constructor(e){this.view=e}update(e){e.docChanged&&(this.hovered=null)}resultAt(e){return this.hovered&&e>=this.hovered.from&&e<=this.hovered.to?this.hovered.result:null}clear(){if(this.hovered){this.hovered=null;let e=this.view.state.field(XS,!1);e&&e.size>0&&this.view.dispatch({effects:YS.of(Fn.none)})}}async hover(e){let n=$x(this.view.state,e);if(!n){this.clear();return}if(this.hovered&&this.hovered.from===n.from&&this.hovered.to===n.to)return;let r={from:n.from,to:n.to,result:null};this.hovered=r;let i=this.view.state;try{let a=await t.resolve(i,e);if(this.hovered!==r||this.view.state!==i)return;r.result=a,this.view.dispatch({effects:YS.of(a?Fn.set([US.range(n.from,n.to)]):Fn.none)})}catch{}}destroy(){this.hovered=null}},{eventHandlers:{mousemove(e,t){if(!(e.metaKey||e.ctrlKey)){this.clear();return}let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n==null){this.clear();return}this.hover(n)},mousedown(e,t){if(!(e.metaKey||e.ctrlKey)||e.button!==0)return!1;let n=t.posAtCoords({x:e.clientX,y:e.clientY});if(n==null)return!1;let r=this.resultAt(n);return r?(t.dispatch({selection:{anchor:r.definition.from,head:r.definition.to},scrollIntoView:!0,userEvent:`select.pointer`}),!0):!1}}}),BS]}var QS=e=>typeof window<`u`&&typeof window.prompt==`function`?window.prompt(`Rename '${e}' to:`,e):null,$S=/^[A-Za-z_][\w$]*$/,eC=new Set(`all.and.as.asc.between.by.case.cross.delete.desc.distinct.else.end.except.exists.fetch.from.full.group.having.in.inner.insert.intersect.into.is.join.lateral.left.like.limit.natural.not.null.offset.on.or.order.outer.qualify.recursive.right.select.set.table.then.union.update.using.values.when.where.window.with`.split(`.`));async function tC(e,t={}){let n=e.state,r=await zS(t).resolve(n,n.selection.main.head);if(!r)return!1;let i=await(t.prompt??QS)(r.name);return!i||i===r.name||!$S.test(i)||eC.has(i.toLowerCase())||e.state!==n?!1:(e.dispatch({changes:r.references.map(e=>({from:e.from,to:e.to,insert:i})),userEvent:`rename`}),!0)}function nC(e={}){let t={...e,resolver:zS(e)},n=e.gotoDefinitionKeys??[`F12`,`Mod-b`],r=e.renameKey??`F2`;return pn.of([...n.map(e=>({key:e,run:e=>(JS(e,void 0,t),!0)})),{key:r,run:e=>(tC(e,t),!0)}])}function rC(e={}){let t={...e,resolver:zS(e)},n=[qS(t),ZS(t)];return e.keymap&&n.push(nC(t)),n}var iC=750;function aC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&e.type===`select`}function oC(e){return Array.isArray(e)?e:[]}function sC(e){return{sources:[],columnRefs:[],selectAliases:new Set,checkUnqualified:e,hasUsingJoin:!1}}function cC(e,t,n){let r=oC(e.with);for(let e of r){let n=e.name,r=typeof n==`string`?n:n?.value;typeof r==`string`&&t.add(r.toLowerCase())}for(let e of r){let r=e.stmt,i=r?.ast??r;aC(i)&&dC(i,t,n,!1)}}function lC(e,t,n,r){e.using!=null&&(t.hasUsingJoin=!0),typeof e.join==`string`&&e.join.toLowerCase().includes(`natural`)&&(t.hasUsingJoin=!0),e.on!=null&&uC(e.on,t,n,r);let i=e.expr;if(i!=null){let a=i.ast??i;aC(a)&&dC(a,n,r,!1),t.sources.push({path:``,name:``,alias:typeof e.as==`string`?e.as:null,isCte:!1,opaque:!0});return}if(typeof e.table==`string`){let r=[e.db??e.catalog,e.schema,e.table].filter(e=>typeof e==`string`&&e.length>0);t.sources.push({path:r.join(`.`),name:e.table,alias:typeof e.as==`string`?e.as:null,isCte:r.length===1&&n.has(e.table.toLowerCase()),opaque:!1})}}function uC(e,t,n,r){if(typeof e!=`object`||!e)return;if(Array.isArray(e)){for(let i of e)uC(i,t,n,r);return}let i=e;if(i.type===`column_ref`){t.columnRefs.push(i);return}if(aC(i)){dC(i,n,r,!0);return}if(aC(i.ast)){dC(i.ast,n,r,!0);return}for(let[e,a]of Object.entries(i))e!==`loc`&&e!==`tableList`&&e!==`columnList`&&uC(a,t,n,r)}function dC(e,t,n,r){let i=new Set(t);cC(e,i,n);let a=sC(!r);n.push(a);for(let t of oC(e.from))lC(t,a,i,n);for(let t of oC(e.columns))typeof t.as==`string`&&a.selectAliases.add(t.as.toLowerCase());for(let[t,r]of Object.entries(e))t!==`with`&&t!==`from`&&t!==`loc`&&uC(r,a,i,n)}function fC(e,t){let n=new Set;switch(e.type){case`select`:dC(e,n,t,!1);return;case`update`:{cC(e,n,t);let r=sC(!0);t.push(r);for(let i of oC(e.table))lC(i,r,n,t);for(let i of oC(e.from))lC(i,r,n,t);for(let i of oC(e.set))i.column!=null&&r.columnRefs.push({type:`column_ref`,table:i.table??null,column:i.column}),uC(i.value,r,n,t);for(let[i,a]of Object.entries(e))i!==`with`&&i!==`table`&&i!==`from`&&i!==`set`&&i!==`loc`&&uC(a,r,n,t);return}case`delete`:{cC(e,n,t);let r=sC(!0);t.push(r);for(let i of oC(e.from))lC(i,r,n,t);for(let[i,a]of Object.entries(e))i!==`with`&&i!==`table`&&i!==`from`&&i!==`loc`&&uC(a,r,n,t);return}case`insert`:case`replace`:{cC(e,n,t);let r=sC(!1);t.push(r);for(let i of oC(e.table))lC(i,r,n,t);for(let[i,a]of Object.entries(e))i!==`with`&&i!==`table`&&i!==`columns`&&i!==`loc`&&(aC(a)?dC(a,n,t,!1):uC(a,r,n,t));return}case`create`:case`alter`:case`drop`:{let r=sC(!1);t.push(r);for(let[i,a]of Object.entries(e))i!==`table`&&i!==`loc`&&(aC(a)?dC(a,n,t,!1):uC(a,r,n,t));return}default:{let r=sC(!1);t.push(r);for(let[i,a]of Object.entries(e))i!==`loc`&&uC(a,r,n,t)}}}function pC(e){let t=e.column;if(typeof t==`string`)return t;if(typeof t==`object`&&t){let e=t.expr?.value??t.value;if(typeof e==`string`)return e}return null}function mC(e){return typeof e.table!=`string`||e.table.length===0?null:typeof e.db==`string`&&e.db.length>0?`${e.db}.${e.table}`:e.table}function hC(e){if(e==null)return null;let t=tx(e)?e.children:e;return nx(t)?t.map(e=>typeof e==`string`?e:e.label):null}function gC(e,t){let n=ix(e,t,{caseSensitive:!1});if(n)return{exists:!0,columns:hC(n.namespace)};let r=t.split(`.`).map(e=>e.toLowerCase()),i=r[r.length-1];if(!i)return{exists:!1,columns:null};let a=cx(e,i).filter(e=>{if(hC(e.namespace)===null||e.path.length<r.length)return!1;let t=e.path.slice(-r.length).map(e=>e.toLowerCase());return r.every((e,n)=>t[n]===e)});return a.length===0?{exists:!1,columns:null}:{exists:!0,columns:a.length===1?hC(a[0]?.namespace):null}}function _C(e,t){let n=t.toLowerCase();return e.some(e=>e.toLowerCase()===n)}function vC(e,t){let n=[];fC(e,n);let r=new Map,i=e=>{let t=`${e.kind}::${e.identifier.toLowerCase()}`;r.has(t)||r.set(t,e)};for(let e of n){let n=e.sources.map(e=>{if(e.opaque||e.isCte)return{source:e,exists:!0,columns:null};let n=gC(t,e.path);return{source:e,exists:n.exists,columns:n.columns}});for(let{source:e,exists:t}of n)!e.opaque&&!e.isCte&&!t&&i({kind:`unknownTable`,identifier:e.name,message:`Unknown table '${e.path}'`});for(let t of e.columnRefs){let r=pC(t);if(!r||r===`*`)continue;let a=mC(t);if(a){let e=a.toLowerCase(),t=n.find(t=>t.source.alias?.toLowerCase()===e)??n.find(t=>t.source.name.toLowerCase()===e||t.source.path.toLowerCase()===e);t?.columns&&!_C(t.columns,r)&&i({kind:`unknownColumn`,identifier:r,message:`Column '${r}' not found in table '${t.source.path||a}'`});continue}if(!e.checkUnqualified||e.selectAliases.has(r.toLowerCase()))continue;let o=n.filter(e=>e.columns!==null&&_C(e.columns,r));if(o.length>=2&&!e.hasUsingJoin){i({kind:`ambiguousColumn`,identifier:r,message:`Column '${r}' is ambiguous; it exists in ${o.map(e=>e.source.name).join(`, `)}`});continue}let s=n.length===1?n[0]:void 0;s&&s.columns!==null&&o.length===0&&i({kind:`unknownColumn`,identifier:r,message:`Column '${r}' not found in table '${s.source.path}'`})}}return[...r.values()]}function yC(e,t){let n=e.toLowerCase(),r=t.toLowerCase(),i=n.indexOf(r);for(;i!==-1;){let e=i>0?n[i-1]??``:``,t=n[i+r.length]??``;if(!/[\w$]/.test(e)&&!/[\w$]/.test(t))return i;i=n.indexOf(r,i+1)}return-1}function bC(e,t,n,r){let i=n.sliceString(t.from,t.to),a=yC(i,e.identifier),o=a===-1?t.from:t.from+a;return{from:o,to:Math.min(a===-1?t.from+(i.match(/^[\w"'`.]+/)?.[0].length??1):o+e.identifier.length,t.to),severity:r,message:e.message,source:`sql-schema`}}function xC(e){return nx(e)?e.length===0:ex(e)?Object.keys(e).length===0:!1}function SC(e={}){let t=e.parser||new vx,n=e.structureAnalyzer||new Gx(t),r={unknownTable:e.severity?.unknownTable??`warning`,unknownColumn:e.severity?.unknownColumn??`warning`,ambiguousColumn:e.severity?.ambiguousColumn??`warning`};return async i=>{let a=fx(e.schema,i);if(a==null||xC(a))return[];let o=i.state.doc;if(!o.toString().trim())return[];let s=[],c=await n.analyzeDocument(i.state);for(let e of c){if(!e.isValid)continue;let n=await t.parse(e.content,{state:i.state});if(!n.success||n.ast==null)continue;let c=Array.isArray(n.ast)?n.ast:[n.ast];for(let t of c)for(let n of vC(t,a)){let t=r[n.kind];t!==`off`&&s.push(bC(n,e,o,t))}}return s}}function CC(e={}){return yr(SC(e),{delay:e.delay||iC})}var wC=Cn.define(),TC=cn.define({create(){return{currentStatement:null,allStatements:[],cursorPosition:0,isFocused:!0}},update(e,t){for(let e of t.effects)if(e.is(wC))return e.value;return e}});function EC(e,t){let{isCurrent:n,isValid:r,isFocused:i}=t,a=e.backgroundColor||`#3b82f6`;!r&&e.showInvalid!==!1&&(a=e.errorBackgroundColor||`#ef4444`);let o=n?`1`:(e.inactiveOpacity??.3).toString(),s;return s=i?o:e.unfocusedOpacity===void 0?e.hideWhenNotFocused?`0`:o:e.unfocusedOpacity.toString(),{backgroundColor:a,opacity:s}}var DC=class extends Ln{config;isCurrent;isValid;isFocused;constructor(e,t,n=!0,r=!0){super(),this.config=e,this.isCurrent=t,this.isValid=n,this.isFocused=r}toDOM(){let e=document.createElement(`div`);e.className=`cm-sql-gutter-marker`;let{backgroundColor:t,opacity:n}=EC(this.config,{isCurrent:this.isCurrent,isValid:this.isValid,isFocused:this.isFocused});return e.style.cssText=`
106
106
  background: ${t};
107
107
  height: 100%;
108
108
  width: 100%;
109
109
  opacity: ${n};
110
110
  transition: opacity 150ms ease-in-out;
111
111
  border-radius: 1px;
112
- `,e}eq(e){return this.isCurrent===e.isCurrent&&this.isValid===e.isValid&&this.isFocused===e.isFocused&&this.config===e.config}};function TC(e,t){let n=Nn.empty;if(t.whenHide?.(e))return n;let r=e.state.field(SC,!1);if(!r)return n;let{currentStatement:i,allStatements:a,isFocused:o}=r;try{let r=e.state.doc.lineAt(e.viewport.from).number,s=e.state.doc.lineAt(e.viewport.to).number;for(let c of a){if(c.lineTo<r||c.lineFrom>s)continue;let a=i?.from===c.from&&i?.to===c.to;if(!c.isValid&&t.showInvalid===!1)continue;let l=new wC(t,a,c.isValid,o),u=Math.max(c.lineFrom,r),d=Math.min(c.lineTo,s);for(let t=u;t<=d;t++)try{if(t<1||t>e.state.doc.lines)continue;let r=e.state.doc.line(t);n=n.update({add:[l.range(r.from)]})}catch(e){console.warn(`SqlGutter: Invalid line number`,t,e)}}}catch(e){console.warn(`SqlGutter: Error creating markers`,e)}return n}async function EC(e,t){let{state:n}=e,r=n.selection.main.head,i=await t.analyzeDocument(n),a={currentStatement:await t.getStatementAtPosition(n,r),allStatements:i,cursorPosition:r,isFocused:e.hasFocus};e.dispatch({effects:xC.of(a)})}function DC(e){return Zn.define(t=>(EC(t,e),{update(t){!t.docChanged&&!t.selectionSet&&!t.focusChanged||EC(t.view,e)}}))}function OC(e){let t=e.width||3;return Jn.baseTheme({".cm-sql-gutter":{width:`${t}px`,minWidth:`${t}px`},".cm-sql-gutter .cm-gutterElement":{width:`${t}px`,padding:`0`,margin:`0`},".cm-sql-gutter-marker":{width:`100%`,height:`100%`,display:`block`},".cm-lineNumbers .cm-gutterElement":{paddingLeft:`8px`,paddingRight:`8px`}})}function kC(e){return $n({class:`cm-sql-gutter ${e.className||``}`,markers:t=>TC(t,e)})}function AC(e={}){return[SC,DC(new Hx(e.parser||new hx)),OC(e),kC(e)]}function jC(e={}){let t=[],{schema:n,enableLinting:r=!0,enableSemanticLinting:i=!0,enableGutterMarkers:a=!0,enableHover:o=!0,enableNavigation:s=!0,linterConfig:c,semanticLinterConfig:l,gutterConfig:u,hoverConfig:d,navigationConfig:f}=e;if(n!=null&&t.push(cx.of(n)),r&&t.push(CS(c)),i){let e=l?.parser??c?.parser,n=l?.structureAnalyzer??(l?.parser==null?c?.structureAnalyzer:void 0);t.push(bC({...l,parser:e,structureAnalyzer:n}))}if(a&&t.push(AC(u)),o&&(t.push(DS(d)),t.push(d?.theme??FS())),s){let e=f?.parser??c?.parser,n=f?.structureAnalyzer??(f?.parser==null?c?.structureAnalyzer:void 0);t.push(...eC({...f,parser:e,structureAnalyzer:n}))}return t}var MC=class e{delegate;toKey;cache;static jsonStringifySortKeys(){return e=>typeof e!=`object`||!e?String(e):JSON.stringify(e,Object.keys(e).toSorted(),2)}constructor(t,n={}){this.delegate=t,this.toKey=n.toKey??e.jsonStringifySortKeys();let r=n.maxSize??128;this.cache=new bp(r)}request(e){let t=this.toKey(e),n=this.cache.get(t);if(n!==void 0)return n;let r=this.delegate.request(e);return this.cache.set(t,r),r.catch(e=>{throw this.cache.delete(t),e})}resolve(e,t){this.delegate.resolve(e,t)}reject(e,t){this.delegate.reject(e,t)}},NC=new Qt(`data-source-discovery-result`,async e=>{await Hr().discoverDataSources({requestId:e})}),PC=new Qt(`sql-table-preview`,async(e,t)=>{await Hr().previewSQLTable({requestId:e,...t})}),FC=new Qt(`sql-schema-list-preview`,async(e,t)=>{await Hr().previewSQLSchemaList({requestId:e,...t})}),IC=new Qt(`sql-table-list-preview`,async(e,t)=>{await Hr().previewSQLTableList({requestId:e,...t})}),LC=new MC(new Qt(`validate-sql`,async(e,t)=>{await Hr().validateSQL({requestId:e,...t})}),{maxSize:3}),RC=o(new Map),zC=e=>{let t=(0,X.c)(3),n=s(RC),r;return t[0]!==e||t[1]!==n?(r=n.get(e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r};function BC(e){let t=u.get(RC),n=new Map(t);n.delete(e),u.set(RC,n)}function VC(){u.set(RC,new Map)}function HC({cellId:e,errorMessage:t,dialect:n}){let r=u.get(RC),i=new Map(r),a=n===`DuckDB`?UC(t):WC(t);i.set(e,a),u.set(RC,i)}function UC(e){let{errorType:t,errorMessage:n}=WC(e),r=n,i,a=n.indexOf(`LINE `);return a!==-1&&(i=n.slice(Math.max(0,a)).trim(),r=n.slice(0,Math.max(0,a)).trim()),{errorType:t,errorMessage:r,codeblock:i}}function WC(e){return{errorType:e.split(`:`)[0].trim(),errorMessage:e.split(`:`).slice(1).join(`:`).trim()}}function GC(e){return e.field(ky)}function KC(){return e=>{let t=GC(e.state).engine,n=om.getCompletionSource(t);return n&&Gr(n)(e)||null}}function qC(){return e=>{let t=GC(e.state).engine,n=om.getDialect(t);return e.matchBefore(/\.\w*/)?null:ei(n,!0,(e,t)=>({label:e,type:t,info:async()=>{let t=(await JC())[e.toLocaleLowerCase()];if(!t)return null;let n=document.createElement(`div`);return n.innerHTML=PS.keyword({keyword:e,info:t}),n}}))(e)}}var JC=Or(async()=>{let e=await W(()=>import(`./common-keywords-FICkW4yv.js`),[],import.meta.url),t=await W(()=>import(`./duckdb-keywords-iJc26n2t.js`),[],import.meta.url);return{...e.default.keywords,...t.default.keywords}}),YC=ve(`marimo:notebook-sql-mode`,`default`,Nh);function XC(){let e=(0,X.c)(3),[t,n]=a(YC),r;return e[0]!==n||e[1]!==t?(r={sqlMode:t,setSQLMode:n},e[0]=n,e[1]=t,e[2]=r):r=e[2],r}function ZC(){return u.get(YC)}var QC=Mf,$C=`DuckDB`,ew=new On;function tw(){let{latestEngineSelected:e,connectionsMap:t}=u.get(pp);return e===null?[...t.values()].reverse().find(e=>!zf.has(e.name)&&e.source!==`iceberg`)?.name??`__marimo_duckdb`:e}var nw=class{parser=new Qm;type=`sql`;sqlModeEnabled;constructor(){this.sqlModeEnabled=!0}get defaultMetadata(){return{...this.parser.defaultMetadata,engine:tw()||`__marimo_duckdb`}}get defaultCode(){let e=tw();return e&&e!==`__marimo_duckdb`?`_df = mo.sql(f"""SELECT * FROM """, engine=${e})`:this.parser.defaultCode}static fromQuery=e=>Qm.fromQuery(e);transformIn(e){this.parser.defaultMetadata.engine=tw()||`__marimo_duckdb`;let t=this.parser.transformIn(e),n=t.metadata;return n.engine&&n.engine!==`__marimo_duckdb`&&_p(n.engine),[t.code,t.offset,n]}transformOut(e,t){let n=this.parser.transformOut(e,t);return[n.code,n.offset]}isSupported(e){return this.parser.isSupported(e)}getExtension({lspConfig:e}){let t=rw(),n=[ew.of(Kr({dialect:QC})),pn.of([{key:`Tab`,run:e=>Pr(e)||nr(e),preventDefault:!0}]),Lr({defaultKeymap:!1,activateOnTyping:!0,override:[KC(),vy,qC(),t.cteCompletionSource,t.aliasCompletionSource,t.columnCompletionSource]})];if(e?.diagnostics?.sql_linter??!1){let e=u.get(di),r=new sw({getParserOptions:e=>({database:hw(e)??$C})});n.push(jC({schema:pw,enableLinting:!0,linterConfig:{delay:250,parser:r,perStatement:!1},enableSemanticLinting:!0,semanticLinterConfig:{parser:t.parser,structureAnalyzer:t.structureAnalyzer,severity:{unknownTable:`off`,unknownColumn:`warning`,ambiguousColumn:`warning`}},enableGutterMarkers:!0,gutterConfig:{backgroundColor:`#3b82f6`,errorBackgroundColor:`#ef4444`,hideWhenNotFocused:!0,parser:r},hoverConfig:{hoverTime:300,enableKeywords:!0,enableTables:!0,enableColumns:!0,parser:t.parser,contextAnalyzer:t.contextAnalyzer,theme:FS(e)},enableNavigation:!0,navigationConfig:{contextAnalyzer:t.contextAnalyzer,keymap:!1,parser:t.parser,structureAnalyzer:t.structureAnalyzer}}),Jn.updateListener.of(e=>{e.focusChanged&&r.setFocusState(e.view.hasFocus)}))}return this.sqlModeEnabled&&n.push(vw()),n}};function rw(){let e=new hx({getParserOptions:e=>({database:iw(e)})}),t=new aw(e),n=new ow(e);return{parser:e,contextAnalyzer:t,structureAnalyzer:n,cteCompletionSource:vS({parser:e,contextAnalyzer:t,structureAnalyzer:n}),aliasCompletionSource:Ux({schema:pw,parser:e,contextAnalyzer:t}),columnCompletionSource:qx({schema:pw,parser:e,contextAnalyzer:t})}}function iw(e){return hw(e)??$C}var aw=class extends Vx{analyzers=new Map;analysisParser;constructor(e){super(e),this.analysisParser=e}getContext(e,t){return this.getAnalyzer(t.state).getContext(e,t)}clearCache(){for(let e of this.analyzers.values())e.clearCache()}getAnalyzer(e){let t=iw(e),n=this.analyzers.get(t);return n||(n=new Vx(this.analysisParser),this.analyzers.set(t,n)),n}},ow=class extends Hx{analyzers=new Map;analysisParser;constructor(e){super(e),this.analysisParser=e}analyzeDocument(e){return this.getAnalyzer(e).analyzeDocument(e)}getStatementAtPosition(e,t){return this.getAnalyzer(e).getStatementAtPosition(e,t)}getStatementsInRange(e,t,n){return this.getAnalyzer(e).getStatementsInRange(e,t,n)}clearCache(){for(let e of this.analyzers.values())e.clearCache()}getAnalyzer(e){let t=iw(e),n=this.analyzers.get(t);return n||(n=new Hx(this.analysisParser),this.analyzers.set(t,n)),n}},sw=class extends hx{validationTimeout=null;pendingValidationResolve=null;VALIDATION_DELAY_MS=300;isFocused=!1;setFocusState(e){this.isFocused=e}resolvePendingValidation(e){this.pendingValidationResolve?.(e),this.pendingValidationResolve=null}async validateWithDelay(e,t,n){return this.validationTimeout&&(window.clearTimeout(this.validationTimeout),this.resolvePendingValidation([])),new Promise(r=>{this.pendingValidationResolve=r,this.validationTimeout=window.setTimeout(async()=>{if(this.validationTimeout=null,!this.isFocused){this.resolvePendingValidation([]);return}try{let r=await yw(e,t,n,zf.has(t)?ZC():`default`);if(r.error){R.error(`Failed to validate SQL`,{error:r.error}),this.resolvePendingValidation([]);return}this.resolvePendingValidation(r.parse_result?.errors??[])}catch(e){R.error(`Failed to validate SQL`,{error:e}),this.resolvePendingValidation([])}},this.VALIDATION_DELAY_MS)})}async validateSql(e,t){let n=fw(t.state),r=gw(n.engine);return this.isFocused?cw(n.engine,r)?this.validateWithDelay(e,n.engine,r??$C):super.validateSql(e,t):[]}async parse(e,t){let n=fw(t.state).engine;return cw(n,gw(n))?{success:!0,errors:[]}:super.parse(e,t)}};function cw(e,t){return e===`__marimo_duckdb`||t===`DuckDB`}function lw(e,t){e.dispatch({effects:ew.reconfigure(Kr({dialect:t}))})}function uw(e,t){lw(e,om.getDialect(t))}function dw(e){let t=fw(e.state).engine;lw(e,om.getDialect(t))}function fw(e){return e.field(ky)}function pw(e){let t=fw(e.state).engine,n=om.getCompletionSource(t);if(!n?.schema)return{};let r=n.schema;if(!mw(r))return r;let i=n.defaultSchema,a=i?r[i]:void 0;return a&&!Array.isArray(a)&&typeof a==`object`&&`children`in a&&mw(a.children)?{...r,...Object.fromEntries(Object.entries(a.children).filter(([e])=>!Object.hasOwn(r,e)))}:r}function mw(e){if(Array.isArray(e))return!1;if(!(`self`in e)||!(`children`in e))return!0;let t=e.self;return!(typeof t==`object`&&t&&!Array.isArray(t)&&`label`in t&&typeof t.label==`string`)}function hw(e){let t=fw(e).engine;return gw(t)}function gw(e){let t=om.getInternalDialect(e)?.toLowerCase();if(!t||!Pf(t))return null;switch(t){case`postgresql`:case`postgres`:return`PostgreSQL`;case`db2`:case`db2i`:return`DB2`;case`mysql`:return`MySQL`;case`sqlite`:return`Sqlite`;case`mssql`:case`sqlserver`:case`microsoft sql server`:return`TransactSQL`;case`duckdb`:return`DuckDB`;case`mariadb`:return`MariaDB`;case`cassandra`:return`Noql`;case`athena`:case`awsathena`:return`Athena`;case`bigquery`:return`BigQuery`;case`hive`:return`Hive`;case`redshift`:return`Redshift`;case`snowflake`:return`Snowflake`;case`flink`:return`FlinkSQL`;case`mongodb`:case`noql`:return`Noql`;case`oracle`:case`oracledb`:case`timescaledb`:case`couchbase`:case`trino`:case`tidb`:case`singlestoredb`:case`spark`:case`databricks`:case`datafusion`:case`dremio`:return R.debug(`Unsupported dialect`,{dialect:t}),null;default:return zr(t),null}}var _w=300;function vw(){return Zn.define(e=>{let t,n=null,r=e.state.facet(Of);return{update(e){if(!e.docChanged)return;let i=ZC();if(i==="default")return;let a=fw(e.state).engine;if(!zf.has(a))return;let o=e.state.doc.toString();t&&window.clearTimeout(t),t=window.setTimeout(async()=>{if(n!==o){if(n=o,o===``){BC(r);return}try{let e=gw(a),t=(await yw(o,a,e,i)).validate_result;t?.error_message?HC({cellId:r,errorMessage:t.error_message,dialect:e}):BC(r)}catch(e){R.error(`Failed to validate SQL`,{error:e})}}},_w)},destroy(){t&&window.clearTimeout(t),BC(r)}}})}async function yw(e,t,n,r){let i=await LC.request({onlyParse:r==="default",engine:t,dialect:n,query:e});if(i.error)throw Error(i.error);return i}var bw=Or(()=>new qb),xw=Or(()=>new Ay),Sw=Or(()=>new nw),Cw={get python(){return bw()},get markdown(){return xw()},get sql(){return Sw()}};function ww(){return Object.values(Cw)}var Tw=K.forwardRef((e,t)=>{let n=(0,X.c)(13),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=H(`flex items-center justify-center text-current max-h-[14px] overflow-hidden`),n[5]=o):o=n[5];let s;n[6]===i.checked?s=n[7]:(s=(0,q.jsx)(ia,{className:o,children:i.checked===`indeterminate`?(0,q.jsx)(J,{className:`h-4 w-4`}):(0,q.jsx)(Nt,{className:`h-4 w-4`})}),n[6]=i.checked,n[7]=s);let c;return n[8]!==i||n[9]!==t||n[10]!==a||n[11]!==s?(c=(0,q.jsx)(na,{ref:t,className:a,...i,children:s}),n[8]=i,n[9]=t,n[10]=a,n[11]=s,n[12]=c):c=n[12],c});Tw.displayName=na.displayName;var Ew=new Set(`__*.marimo.app.False.None.True.__peg_parser__.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield.None.setup`.split(`.`));function Dw(e,t=!0){return e=e.trim(),e?(/^\d/.test(e)&&(e=`_${e}`),e=e.replaceAll(/\W/g,`_`),t?e.toLowerCase():e):`_`}function Ow(e,t){let n=new Set(t),r=e,i=e=>!n.has(e)&&!Ew.has(e);if(i(e))return e;let a=1;for(;!i(r);)r=`${e}_${a}`,a++;return r}function kw(e,t){return Aw(e)?`cell-${t}`:e}function Aw(e){return!e||e===`_`||e===`__`}function jw(e){let t=(0,X.c)(15),{minWidth:n,padding:r}=e,i=n===void 0?70:n,a=r===void 0?15:r,[o,s]=(0,K.useState)(50),c=(0,K.useRef)(null),l=(0,K.useRef)(null),u;t[0]===a?u=t[1]:(u=e=>{if(l.current&&c.current){let t=l.current;t.style.fontSize=window.getComputedStyle(c.current).fontSize,t.style.fontFamily=window.getComputedStyle(c.current).fontFamily,t.textContent=e;let n=t.offsetWidth;s(n+a)}},t[0]=a,t[1]=u);let d=u,f;t[2]===d?f=t[3]:(f=()=>{d(c.current?.value??``)},t[2]=d,t[3]=f),Mt(f);let p;t[4]===d?p=t[5]:(p=e=>{d(e.target.value)},t[4]=d,t[5]=p);let m=`${o}px`,h=`${i}px`,g;t[6]!==m||t[7]!==h?(g={width:m,minWidth:h},t[6]=m,t[7]=h,t[8]=g):g=t[8];let _;t[9]!==p||t[10]!==g?(_={ref:c,type:`text`,onChange:p,style:g},t[9]=p,t[10]=g,t[11]=_):_=t[11];let v=_,y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y={ref:l,style:{visibility:`hidden`,position:`absolute`,whiteSpace:`pre`}},t[12]=y):y=t[12];let b=y,x;return t[13]===v?x=t[14]:(x={inputProps:v,spanProps:b},t[13]=v,t[14]=x),x}function Mw({currentQuotePrefix:e,checked:t,prefix:n}){let r=e;return t?e===``?r=n:e!==`rf`&&n!==e&&(r=`rf`):e===n?r=``:e===`rf`&&(r=n===`r`?`f`:`r`),r}var Nw=()=>{let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsxs)(`section`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsxs)(`header`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`code`,{className:`text-xs px-1 py-0.5 bg-(--slate-2) rounded`,children:`r`}),(0,q.jsx)(`span`,{className:`font-semibold`,children:`Raw String`})]}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Write LaTeX without escaping special characters`}),(0,q.jsx)(`pre`,{className:`text-xs bg-(--slate-2) p-2 rounded`,children:`\\alpha \\beta`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,q.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[t,(0,q.jsxs)(`section`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsxs)(`header`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`code`,{className:`text-xs px-1 py-0.5 bg-(--slate-2) rounded`,children:`f`}),(0,q.jsx)(`span`,{className:`font-semibold`,children:`Format String`})]}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Interpolate Python values`}),(0,q.jsxs)(`pre`,{className:`text-xs bg-(--slate-2) p-2 rounded`,children:[`Hello `,`{name}`,`! 😁`]})]})]}),e[1]=n):n=e[1],n},Pw=`data-cell-id`;function Fw(e){return{[Pw]:e}}var Iw=`data-for-cell-id`;function Lw(e){return{[Iw]:e}}var Rw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClickHouse%3c/title%3e%3cpath%20d='M21.333%2010H24v4h-2.667ZM16%201.335h2.667v21.33H16Zm-5.333%200h2.666v21.33h-2.666ZM0%2022.665V1.335h2.667v21.33zm5.333-21.33H8v21.33H5.333Z'/%3e%3c/svg%3e`,zw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDatabricks%3c/title%3e%3cpath%20d='M.95%2014.184L12%2020.403l9.919-5.55v2.21L12%2022.662l-10.484-5.96-.565.308v.77L12%2024l11.05-6.218v-4.317l-.515-.309L12%2019.118l-9.867-5.653v-2.21L12%2016.805l11.05-6.218V6.32l-.515-.308L12%2011.974%202.647%206.681%2012%201.388l7.76%204.368.668-.411v-.566L12%200%20.95%206.27v.72L12%2013.207l9.919-5.55v2.26L12%2015.52%201.516%209.56l-.565.308Z'/%3e%3c/svg%3e`,Bw=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAGcElEQVR4nNxZa2wcVxU+99557M6+vLazj6xjO6+maWVTl0YpLU1DU9KARNqooQhFVYJUqUWgiocqIVRESPlRoEhIqYoqgSiCItqQPkAEKUWQtlGSJtAY00R5mTjZTfze94x3HvdedMdZnKgS6s7O2kk/a7R3xvY933fOd874yhhucCyYAIWA9IOH2r+35/HUnjU96sBC8fAERQLpj0+mXjdeXM6rzy/no88uK6zolHu97EX8p/f/IWHAv38i9bsH+kIPo/ozhAJBgpR9J419je437xb62Zc7n/tcf+gRsebADYQAxLW2N/ApL/vNq4AdA7Ht2/piT4q15fAp1wEYAGEALYA18TzT1TXQ09O75qPuKbWS8NW4Lan27/pM4gWrBIgFnaIDvKZIpPPKt+nlgpMTi0q5PKqoqvZR950XAREZaz/fmHmFOFijwGHkDDu5PKGs1SlQ5gAAQ+S9U9Y/xM+Wy+WxRvaeFwE770z+OBNQbmYWwPlp63BPh3q7XQaCxAi50gP7Tldf87J3ywVszEQ2bumOf5WZAAajeWoDJjYOMM5BCECEw9miefxwduaol/1b2sQdCon/8BOZX3ETYWYiODFhvrNUC6ylFgJqzl27DxV+xD3GaGkFnl6deS4G8mJqAmRrtaGkoqxiJnazPpt9gPNVa3DvqfKrXmO0rAJ3RSLrHojHd4jMMwvBSMn+d1pSVrv37oXdz50Hx79JOXgtQGsqIAEiT8V7djtVzEiQ4w+K+t9uCmn3uNmX5rL/l8ullw5c1g80E6slFXgkuuixJVKw3y5jxEzExnV7pB3k7rr3hZDBiZl3njk+9u1mY/legSgm0cfiXbtcTziYHJmovNEXC99PZzAV41KMzaLtXGBVmaQltWfCdPLNxPNdwFdii58KYykhXM2AO5MGvTSAgw9aLnUx8zlomCxTKdeHdP14s/F8tdAiIie2RpPfAPcPNYAjRumNOwLRLZwL2rPgHAGnCF6aHPuJ5869Cr5WYFs0/S0ZkTDns9SK1BltI/JicYcEcXAX8L5R+vOblanf+hHTNwFtWGr7QiT9BAPklnWoVt5/qxrZILQI7wvyjHPrjKkfeL0y9QID76Pzavhmoa3RzNdkLMcYEKCA4aJtncjIgVs4oFnbCCGASDtRVrw3Uz7sV1xfBKiAlc2RJV+vkz9vWYMZWesTa1ER5vYEgot27YPvjJ/dXGBOwY+44JeAdaHkQxpRU9QVQGDIrPz1FjV+f/3eFcaRFcdKosicsh8x6/ClBzaEu7YLoqJNDUonVKR0UCTuRT9w9wshpAzb+qmcY2b9iFlH0xVow0r81sCiz9azfdCY3rNWSzw8a5/ZZ2ItPv9UmfiFP7Tn0HQFPhlMbuKIyOKkhThjNc4rBCtRJl5jrvO5W4mSY+beMib/4A/tOTQtYCCY2kTdszmHE7X8/tWBTtf7s7S528IYELxcuviMycWZzF80baHVgdT6/00fu3oso7Tdwa5Ypt7Aw5Zx7M1K7pf+UL4WTVWgQwqnQ5LWLexTpfblEFaT7Jrsc3GMLDw7+a9tFDj1j/YcmqpAWkn06yhERaYP6ZdeHtC6tl6deYPx4q7xY5+/YFfP+kf5WniqQELp6J6hNaNdia8s4TCojkmrjOYVHGin7qsLQdYqvb976uijk455yX/ac/AkYNLKZx9Nb/kNQkAsLJNBW9+/Uk3eJzI/ZlUG36qcfv6MXf3nmtjtO/ZO/v27/tOeA/L6iyu0pfdu7/riATF93s0fffq+toGdM5zmJ+ziuRgJpWSEgy/mXlk/Zk2f8ZfytfDcxOeM828XHH04TAIJjOTgDAlIiPNEmgQTw9Xh146UBn/aavLgVUAmkLk5IkdXFh09l62NHloaWblZjFGMONjMrsTUjqV5qzjuP90Pw9MUmrKms/2x276U0pbcO2Hlh9qUzj6GMJiclk/q5/b+Ovfqg+P29LD/dD+MhnsgSMLhnlDvPQVrOrcmfufjF2cuvI0BqVlj5GDBKmQZsJbMe9+BAZP1yU3fF+tloVV3LzSfhtEbXrWhO7Ri3ULz8PwmzoRXfTqr/+ddf+k0Dk8CEGBMOWccmC8H82bgSUAmfNO6S/q5Bc8+eBUQDXWtz1VP36gCMC4xnfPrZFw2/I9uLZi6u2aXs7ZdGWkNpcbQcAU0LX2XYYxeF/YBLwIYs0twndjnY4H/BgAA//95CrBYRwImwgAAAABJRU5ErkJggg==`,Vw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDuckDB%3c/title%3e%3cpath%20d='M12%200C5.363%200%200%205.363%200%2012s5.363%2012%2012%2012%2012-5.363%2012-12S18.637%200%2012%200zM9.502%207.03a4.974%204.974%200%200%201%204.97%204.97%204.974%204.974%200%200%201-4.97%204.97A4.974%204.974%200%200%201%204.532%2012a4.974%204.974%200%200%201%204.97-4.97zm6.563%203.183h2.351c.98%200%201.787.782%201.787%201.762s-.807%201.789-1.787%201.789h-2.351v-3.551z'/%3e%3c/svg%3e`,Hw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGoogle%20BigQuery%3c/title%3e%3cpath%20d='M5.676%2010.595h2.052v5.244a5.892%205.892%200%200%201-2.052-2.088v-3.156zm18.179%2010.836a.504.504%200%200%201%200%20.708l-1.716%201.716a.504.504%200%200%201-.708%200l-4.248-4.248a.206.206%200%200%201-.007-.007c-.02-.02-.028-.045-.043-.066a10.736%2010.736%200%200%201-6.334%202.065C4.835%2021.599%200%2016.764%200%2010.799S4.835%200%2010.8%200s10.799%204.835%2010.799%2010.8c0%202.369-.772%204.553-2.066%206.333.025.017.052.028.074.05l4.248%204.248zm-5.028-10.632a8.015%208.015%200%201%200-8.028%208.028h.024a8.016%208.016%200%200%200%208.004-8.028zm-4.86%204.98a6.002%206.002%200%200%200%202.04-2.184v-1.764h-2.04v3.948zm-4.5.948c.442.057.887.08%201.332.072.4.025.8.025%201.2%200V7.692H9.468v9.035z'/%3e%3c/svg%3e`,Uw=new URL(`iceberg-COKYXo-A.png`,import.meta.url).href,Ww=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eMotherDuck%3c/title%3e%3cg%20transform='scale(0.85)%20translate(0,%202)'%3e%3cpath%20fill='%23ff9538'%20d='M1.71%2015.86s7.45%205.32%207.89%205.59c.44.27%201.08.33%201.64.11.56-.22.98-.71%201.11-1.21s1.85-9.49%201.85-9.49c.02-.12.07-.48-.13-.83-.27-.47-.86-.71-1.38-.57-.42.12-.64.44-.7.55-.09.17-.26.45-.57.7-.24.19-.47.3-.58.34-.96.38-2.02.06-2.61-.72-.38-.48-1.04-.67-1.64-.43-.6.24-.94.84-.89%201.45.11.98-.44%201.94-1.4%202.32-.51.21-1.06.21-1.54.05-.12-.03-.51-.12-.89.09-.48.26-.74.84-.61%201.37.09.39.38.62.48.69z'%20/%3e%3cpath%20fill='%23ff9538'%20d='M14.12%204.21s2.65%208.76%202.83%209.24c.19.48.66.92%201.23%201.09.58.16%201.21.03%201.62-.28.41-.31%207.25-6.39%207.25-6.39.09-.08.35-.34.4-.74.07-.53-.25-1.09-.75-1.29-.4-.16-.78-.04-.89%200-.18.08-.48.2-.88.2-.3.01-.55-.05-.67-.08-.99-.28-1.64-1.18-1.63-2.16-.01-.61-.42-1.17-1.04-1.35-.62-.18-1.26.09-1.59.6-.51.84-1.53%201.27-2.52.99-.53-.15-.96-.48-1.25-.91-.07-.09-.33-.4-.76-.48-.54-.09-1.1.22-1.32.71-.16.37-.08.72-.04.84z'%20/%3e%3c/g%3e%3c/svg%3e`,Gw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eMySQL%3c/title%3e%3cpath%20d='M16.405%205.501c-.115%200-.193.014-.274.033v.013h.014c.054.104.146.18.214.273.054.107.1.214.154.32l.014-.015c.094-.066.14-.172.14-.333-.04-.047-.046-.094-.08-.14-.04-.067-.126-.1-.18-.153zM5.77%2018.695h-.927a50.854%2050.854%200%2000-.27-4.41h-.008l-1.41%204.41H2.45l-1.4-4.41h-.01a72.892%2072.892%200%2000-.195%204.41H0c.055-1.966.192-3.81.41-5.53h1.15l1.335%204.064h.008l1.347-4.064h1.095c.242%202.015.384%203.86.428%205.53zm4.017-4.08c-.378%202.045-.876%203.533-1.492%204.46-.482.716-1.01%201.073-1.583%201.073-.153%200-.34-.046-.566-.138v-.494c.11.017.24.026.386.026.268%200%20.483-.075.647-.222.197-.18.295-.382.295-.605%200-.155-.077-.47-.23-.944L6.23%2014.615h.91l.727%202.36c.164.536.233.91.205%201.123.4-1.064.678-2.227.835-3.483zm12.325%204.08h-2.63v-5.53h.885v4.85h1.745zm-3.32.135l-1.016-.5c.09-.076.177-.158.255-.25.433-.506.648-1.258.648-2.253%200-1.83-.718-2.746-2.155-2.746-.704%200-1.254.232-1.65.697-.43.508-.646%201.256-.646%202.245%200%20.972.19%201.686.574%202.14.35.41.877.615%201.583.615.264%200%20.506-.033.725-.098l1.325.772.36-.622zM15.5%2017.588c-.225-.36-.337-.94-.337-1.736%200-1.393.424-2.09%201.27-2.09.443%200%20.77.167.977.5.224.362.336.936.336%201.723%200%201.404-.424%202.108-1.27%202.108-.445%200-.77-.167-.978-.5zm-1.658-.425c0%20.47-.172.856-.516%201.156-.344.3-.803.45-1.384.45-.543%200-1.064-.172-1.573-.515l.237-.476c.438.22.833.328%201.19.328.332%200%20.593-.073.783-.22a.754.754%200%2000.3-.615c0-.33-.23-.61-.648-.845-.388-.213-1.163-.657-1.163-.657-.422-.307-.632-.636-.632-1.177%200-.45.157-.81.47-1.085.315-.278.72-.415%201.22-.415.512%200%20.98.136%201.4.41l-.213.476a2.726%202.726%200%2000-1.064-.23c-.283%200-.502.068-.654.206a.685.685%200%2000-.248.524c0%20.328.234.61.666.85.393.215%201.187.67%201.187.67.433.305.648.63.648%201.168zm9.382-5.852c-.535-.014-.95.04-1.297.188-.1.04-.26.04-.274.167.055.053.063.14.11.214.08.134.218.313.346.407.14.11.28.216.427.31.26.16.555.255.81.416.145.094.293.213.44.313.073.05.12.14.214.172v-.02c-.046-.06-.06-.147-.105-.214-.067-.067-.134-.127-.2-.193a3.223%203.223%200%2000-.695-.675c-.214-.146-.682-.35-.77-.595l-.013-.014c.146-.013.32-.066.46-.106.227-.06.435-.047.67-.106.106-.027.213-.06.32-.094v-.06c-.12-.12-.21-.283-.334-.395a8.867%208.867%200%2000-1.104-.823c-.21-.134-.476-.22-.697-.334-.08-.04-.214-.06-.26-.127-.12-.146-.19-.34-.275-.514a17.69%2017.69%200%2001-.547-1.163c-.12-.262-.193-.523-.34-.763-.69-1.137-1.437-1.826-2.586-2.5-.247-.14-.543-.2-.856-.274-.167-.008-.334-.02-.5-.027-.11-.047-.216-.174-.31-.235-.38-.24-1.364-.76-1.644-.072-.18.434.267.862.422%201.082.115.153.26.328.34.5.047.116.06.235.107.356.106.294.207.622.347.897.073.14.153.287.247.413.054.073.146.107.167.227-.094.136-.1.334-.154.5-.24.757-.146%201.693.194%202.25.107.166.362.534.703.393.3-.12.234-.5.32-.835.02-.08.007-.133.048-.187v.015c.094.188.188.367.274.555.206.328.566.668.867.895.16.12.287.328.487.402v-.02h-.015c-.043-.058-.1-.086-.154-.133a3.445%203.445%200%2001-.35-.4%208.76%208.76%200%2001-.747-1.218c-.11-.21-.202-.436-.29-.643-.04-.08-.04-.2-.107-.24-.1.146-.247.273-.32.453-.127.288-.14.642-.188%201.01-.027.007-.014%200-.027.014-.214-.052-.287-.274-.367-.46-.2-.475-.233-1.238-.06-1.785.047-.14.247-.582.167-.716-.042-.127-.174-.2-.247-.303a2.478%202.478%200%2001-.24-.427c-.16-.374-.24-.788-.414-1.162-.08-.173-.22-.354-.334-.513-.127-.18-.267-.307-.368-.52-.033-.073-.08-.194-.027-.274.014-.054.042-.075.094-.09.088-.072.335.022.422.062.247.1.455.194.662.334.094.066.195.193.315.226h.14c.214.047.455.014.655.073.355.114.675.28.962.46a5.953%205.953%200%20012.085%202.286c.08.154.115.295.188.455.14.33.313.663.455.982.14.315.275.636.476.897.1.14.502.213.682.286.133.06.34.115.46.188.23.14.454.3.67.454.11.076.443.243.463.378z'/%3e%3c/svg%3e`,Kw=new URL(`postgresql-q8VEBKGg.svg`,import.meta.url).href,qw={sqlite:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSQLite%3c/title%3e%3cpath%20d='M21.678.521c-1.032-.92-2.28-.55-3.513.544a8.71%208.71%200%200%200-.547.535c-2.109%202.237-4.066%206.38-4.674%209.544.237.48.422%201.093.544%201.561a13.044%2013.044%200%200%201%20.164.703s-.019-.071-.096-.296l-.05-.146a1.689%201.689%200%200%200-.033-.08c-.138-.32-.518-.995-.686-1.289-.143.423-.27.818-.376%201.176.484.884.778%202.4.778%202.4s-.025-.099-.147-.442c-.107-.303-.644-1.244-.772-1.464-.217.804-.304%201.346-.226%201.478.152.256.296.698.422%201.186.286%201.1.485%202.44.485%202.44l.017.224a22.41%2022.41%200%200%200%20.056%202.748c.095%201.146.273%202.13.5%202.657l.155-.084c-.334-1.038-.47-2.399-.41-3.967.09-2.398.642-5.29%201.661-8.304%201.723-4.55%204.113-8.201%206.3-9.945-1.993%201.8-4.692%207.63-5.5%209.788-.904%202.416-1.545%204.684-1.931%206.857.666-2.037%202.821-2.912%202.821-2.912s1.057-1.304%202.292-3.166c-.74.169-1.955.458-2.362.629-.6.251-.762.337-.762.337s1.945-1.184%203.613-1.72C21.695%207.9%2024.195%202.767%2021.678.521m-18.573.543A1.842%201.842%200%200%200%201.27%202.9v16.608a1.84%201.84%200%200%200%201.835%201.834h9.418a22.953%2022.953%200%200%201-.052-2.707c-.006-.062-.011-.141-.016-.2a27.01%2027.01%200%200%200-.473-2.378c-.121-.47-.275-.898-.369-1.057-.116-.197-.098-.31-.097-.432%200-.12.015-.245.037-.386a9.98%209.98%200%200%201%20.234-1.045l.217-.028c-.017-.035-.014-.065-.031-.097l-.041-.381a32.8%2032.8%200%200%201%20.382-1.194l.2-.019c-.008-.016-.01-.038-.018-.053l-.043-.316c.63-3.28%202.587-7.443%204.8-9.791.066-.069.133-.128.198-.194Z'/%3e%3c/svg%3e`,duckdb:Vw,motherduck:Ww,postgres:Kw,postgresql:Kw,mysql:Gw,snowflake:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSnowflake%3c/title%3e%3cpath%20d='M24%203.459c0%20.646-.418%201.18-1.141%201.18-.723%200-1.142-.534-1.142-1.18%200-.647.419-1.18%201.142-1.18.723%200%201.141.533%201.141%201.18zm-.228%200c0-.533-.38-.951-.913-.951s-.913.38-.913.95c0%20.533.38.952.913.952.57%200%20.913-.419.913-.951zm-1.37-.533h.495c.266%200%20.456.152.456.38%200%20.153-.076.229-.19.305l.19.266v.038h-.266l-.19-.266h-.229v.266h-.266zm.495.228h-.229v.267h.229c.114%200%20.152-.038.152-.114.038-.077-.038-.153-.152-.153zM7.602%2012.4c.038-.151.076-.304.076-.456%200-.114-.038-.228-.038-.342-.114-.343-.304-.647-.646-.838l-4.87-2.777c-.685-.38-1.56-.152-1.94.533-.381.685-.153%201.56.532%201.94l2.701%201.56-2.701%201.56c-.685.38-.913%201.256-.533%201.94.38.685%201.256.914%201.94.533l4.832-2.777c.343-.267.571-.533.647-.876zm1.332%202.626c-.266-.038-.57.038-.837.19l-4.832%202.777c-.685.38-.913%201.256-.532%201.94.38.686%201.255.914%201.94.533l2.701-1.56v3.12c0%20.8.647%201.408%201.446%201.408.799%200%201.407-.647%201.407-1.408v-5.592c0-.761-.57-1.37-1.293-1.408zm4.946-6.088c.266.038.57-.038.837-.19l4.832-2.777c.685-.38.913-1.256.532-1.94-.38-.686-1.255-.914-1.94-.533l-2.701%201.56V1.975c0-.799-.647-1.408-1.446-1.408-.799%200-1.446.609-1.446%201.408V7.53c0%20.76.609%201.37%201.332%201.407zM3.265%205.97l4.832%202.777c.266.152.533.19.837.19.723-.038%201.331-.684%201.331-1.407V1.975c0-.799-.646-1.408-1.407-1.408-.799%200-1.446.647-1.446%201.408v3.12l-2.701-1.56c-.685-.38-1.56-.152-1.94.533-.419.646-.19%201.521.494%201.902zm9.093%206.011a.412.412%200%2000-.114-.266l-.57-.571a.346.346%200%2000-.267-.114.412.412%200%2000-.266.114l-.571.57a.411.411%200%2000-.114.267c0%20.076.038.19.114.267l.57.57a.345.345%200%2000.267.114c.076%200%20.19-.038.266-.114l.571-.57a.412.412%200%2000.114-.267zm1.598.533L11.94%2014.53c-.039.038-.153.114-.229.114h-.608a.411.411%200%2001-.267-.114L8.82%2012.514a.408.408%200%2001-.076-.229v-.608c0-.076.038-.19.114-.267l2.016-2.016a.41.41%200%2001.267-.114h.608a.41.41%200%2001.267.114l2.016%202.016a.347.347%200%2001.114.267v.608c-.076.077-.114.19-.19.229zm5.593%205.44l-4.832-2.777c-.266-.152-.57-.19-.837-.152-.723.038-1.332.684-1.332%201.408v5.554c0%20.8.647%201.408%201.408%201.408.799%200%201.446-.647%201.446-1.408v-3.12l2.7%201.56c.686.38%201.561.152%201.941-.533.419-.646.19-1.521-.494-1.94zm2.549-7.533l-2.701%201.56%202.7%201.56c.686.38.914%201.256.533%201.94-.38.685-1.255.913-1.94.533l-4.832-2.778a1.644%201.644%200%2001-.647-.798c-.037-.153-.076-.305-.076-.457%200-.114.039-.228.039-.342.114-.343.342-.647.646-.837l4.832-2.778c.685-.38%201.56-.152%201.94.533.457.609.19%201.484-.494%201.864'/%3e%3c/svg%3e`,databricks:zw,clickhouse:Rw,timeplus:`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3c!--%20Generated%20by%20Pixelmator%20Pro%203.6.17%20--%3e%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Option2SymbolB'%3e%3cg%20id='Layer1-2'%3e%3cg%20id='Group'%20opacity='0.4'%3e%3cpath%20id='Path'%20fill='%23d53c97'%20stroke='none'%20d='M%2017.016802%2012.188573%20C%2017.016802%209.607646%2015.86018%207.293022%2014.039526%205.731081%20C%2013.942595%205.70038%2013.844628%205.671406%2013.745972%205.645189%20C%2013.131133%205.809095%2012.54265%206.059378%2011.998103%206.388559%20C%2013.964327%207.575191%2015.281006%209.730104%2015.281006%2012.188573%20C%2015.279476%2014.563734%2014.033739%2016.764488%2011.998103%2017.988243%20C%2012.542634%2018.317537%2013.131119%2018.567936%2013.745972%2018.731958%20C%2013.844628%2018.705742%2013.942595%2018.67642%2014.039526%2018.645721%20C%2015.86018%2017.084126%2017.016802%2014.769501%2017.016802%2012.188573%20Z'/%3e%3cpath%20id='path1'%20fill='%23d53c97'%20stroke='none'%20d='M%2013.897406%205.609659%20L%2013.894991%205.60759%20C%2013.844973%205.619663%2013.7953%205.631737%2013.745972%205.645189%20C%2013.79599%205.631737%2013.847043%205.622078%2013.897406%205.609659%20Z'/%3e%3cpath%20id='path2'%20fill='%23d53c97'%20stroke='none'%20d='M%201.735796%2012.188573%20C%201.735796%209.164728%203.728925%206.59622%206.470945%205.729357%20C%207.554634%204.797861%208.856011%204.155121%2010.254373%203.860756%20C%209.680216%203.740549%209.095179%203.679977%208.508574%203.68%20C%203.816888%203.68%20-0%207.496887%20-0%2012.188573%20C%20-0%2016.880259%203.816888%2020.697147%208.508574%2020.697147%20C%209.0952%2020.697229%209.680255%2020.636539%2010.254373%2020.516048%20C%208.855971%2020.221794%207.554568%2019.579041%206.470945%2018.647446%20C%203.728925%2017.780582%201.735796%2015.213453%201.735796%2012.188573%20Z'/%3e%3cpath%20id='path3'%20fill='%23d53c97'%20stroke='none'%20d='M%2013.745972%2018.731958%20C%2013.7953%2018.745068%2013.844973%2018.757484%2013.894991%2018.769558%20C%2013.894991%2018.769558%2013.896715%2018.769558%2013.897406%2018.767488%20C%2013.847043%2018.754379%2013.79599%2018.745411%2013.745972%2018.731958%20Z'/%3e%3c/g%3e%3cpath%20id='path4'%20fill='%23ff3b65'%20stroke='none'%20d='M%2020.508402%2012.188573%20C%2020.508402%209.606611%2019.351088%207.290262%2017.5294%205.729357%20C%2016.301817%205.342468%2014.989366%205.313629%2013.745972%205.646223%20C%2016.636665%206.418224%2018.772606%209.058484%2018.772606%2012.189609%20C%2018.772606%2015.320732%2016.636665%2017.960991%2013.745972%2018.731958%20C%2014.98947%2019.064316%2016.301983%2019.034998%2017.5294%2018.647446%20C%2019.419907%2017.034296%2020.508638%2014.673781%2020.508402%2012.188573%20Z'/%3e%3cpath%20id='path5'%20fill='%23ff3b65'%20stroke='none'%20d='M%209.962543%2018.647446%20C%207.220525%2017.780582%205.227395%2015.213453%205.227395%2012.188573%20C%205.227395%209.163693%207.220525%206.59622%209.962543%205.729357%20C%2011.046233%204.797861%2012.34761%204.155121%2013.745972%203.860756%20C%2013.171818%203.74053%2012.586779%203.679956%2012.000173%203.68%20C%207.308832%203.68%203.491599%207.496887%203.491599%2012.188573%20C%203.491599%2016.880259%207.308487%2020.697147%2012.000173%2020.697147%20C%2012.586799%2020.697247%2013.171857%2020.636557%2013.745972%2020.516048%20C%2012.34757%2020.221794%2011.046167%2019.579041%209.962543%2018.647446%20Z'/%3e%3cpath%20id='path6'%20fill='%23383838'%20stroke='none'%20d='M%2015.491772%203.68%20C%2010.800431%203.68%206.983198%207.496887%206.983198%2012.188573%20C%206.983198%2016.880259%2010.800086%2020.697147%2015.491772%2020.697147%20C%2020.183456%2020.697147%2024%2016.880259%2024%2012.188573%20C%2024%207.496887%2020.183456%203.68%2015.491772%203.68%20Z%20M%2022.264549%2012.188573%20C%2022.264549%2015.923018%2019.226215%2018.961351%2015.491772%2018.961351%20C%2011.757326%2018.961351%208.718994%2015.923018%208.718994%2012.188573%20C%208.718994%208.454128%2011.757326%205.415796%2015.491772%205.415796%20C%2019.226215%205.415796%2022.264549%208.454128%2022.264549%2012.188573%20Z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e`,bigquery:Hw,trino:new URL(`trino-DFsJbQoT.svg`,import.meta.url).href,iceberg:Uw,datafusion:Bw,pyspark:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eApache%20Spark%3c/title%3e%3cpath%20d='M10.812%200c-.425.013-.845.215-1.196.605a3.593%203.593%200%2000-.493.722c-.355.667-.425%201.415-.556%202.143a551.9%20551.9%200%2000-.726%204.087c-.027.16-.096.227-.244.273C5.83%208.386%204.06%208.94%202.3%209.514c-.387.125-.773.289-1.114.506-1.042.665-1.196%201.753-.415%202.71.346.422.79.715%201.284.936%201.1.49%202.202.976%203.3%201.47.019.01.036.013.053.019h-.004l1.306.535c0%20.023.002.045%200%20.073-.2%202.03-.39%204.063-.58%206.095-.04.419-.012.831.134%201.23.317.87%201.065%201.148%201.881.701.372-.204.666-.497.937-.818%201.372-1.623%202.746-3.244%204.113-4.872.111-.133.205-.15.363-.098.349.117.697.231%201.045.347h.001c.02.012.045.02.073.03l.142.042c1.248.416%202.68.775%203.929%201.19.4.132.622.164%201.045.098.311-.048.592-.062.828-.236.602-.33.995-.957.988-1.682-.005-.427-.154-.813-.35-1.186-.82-1.556-1.637-3.113-2.461-4.666-.078-.148-.076-.243.037-.375%201.381-1.615%202.756-3.236%204.133-4.855.272-.32.513-.658.653-1.058.308-.878-.09-1.57-1-1.741a2.783%202.783%200%2000-1.235.069c-1.974.521-3.947%201.041-5.918%201.57-.175.047-.26.015-.355-.144a353.08%20353.08%200%2000-2.421-4.018%204.61%204.61%200%2000-.652-.849c-.371-.37-.802-.549-1.227-.536zm.172%203.703a.592.592%200%2001.189.211c.87%201.446%201.742%202.89%202.609%204.338.07.118.135.16.277.121%201.525-.41%203.052-.813%204.579-1.217.367-.098.735-.193%201.103-.289a.399.399%200%2001-.1.2c-1.259%201.48-2.516%202.962-3.779%204.438-.11.13-.12.22-.04.37.937%201.803%201.768%203.309%202.498%204.76l-3.696-1.019c-.538-.18-1.077-.358-1.615-.539-.163-.055-.25-.03-.36.1-1.248%201.488-2.504%202.97-3.759%204.454a.398.398%200%2001-.18.132c.035-.378.068-.757.104-1.136.149-1.572.297-3.144.451-4.716-.03-.318.117-.405-.322-.545-1.493-.593-3.346-1.321-4.816-1.905a.595.595%200%2001.24-.134c1.797-.57%203.595-1.14%205.394-1.705.127-.04.199-.092.211-.233.013-.148.05-.294.076-.441.241-1.363.483-2.726.726-4.088.068-.386.14-.771.21-1.157z'/%3e%3c/svg%3e`,redshift:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAmazon%20Redshift%3c/title%3e%3cpath%20d='M16.639%209.932a.822.822%200%200%201-.822-.82.823.823%200%200%201%201.645%200c0%20.452-.37.82-.823.82m-2.086%204.994a.823.823%200%200%201-.822-.822.822.822%200%200%201%201.645%200%20.822.822%200%200%201-.823.822m-5.004-.833a.822.822%200%201%201%20.002-1.644.822.822%200%200%201-.002%201.644m-2.083%204.578a.823.823%200%200%201-.823-.82.823.823%200%200%201%201.645%200c0%20.452-.37.82-.822.82m9.173-11.236a1.68%201.68%200%200%200-1.68%201.676c0%20.566.285%201.066.718%201.37l-.782%201.982a1.674%201.674%200%200%200-1.923%201.104l-1.753-.398a1.675%201.675%200%200%200-3.348.103c0%20.432.169.823.438%201.12l-.764%201.79c-.028-.001-.053-.008-.08-.008a1.68%201.68%200%200%200-1.68%201.676%201.68%201.68%200%200%200%203.36%200c0-.593-.312-1.112-.778-1.41l.674-1.579c.161.052.33.088.508.088.661%200%201.228-.386%201.502-.94l1.856.42a1.68%201.68%200%200%200%203.327-.325c0-.5-.224-.943-.574-1.25l.822-2.083c.053.005.104.016.157.016a1.68%201.68%200%200%200%201.68-1.676%201.68%201.68%200%200%200-1.68-1.676M12%2023.145c-4.17%200-7.286-1.252-7.286-2.37V4.79C6.14%205.938%209.131%206.547%2012%206.547c2.869%200%205.86-.609%207.286-1.756v15.983c0%201.12-3.116%202.37-7.286%202.37M12%20.856c4.293%200%207.286%201.274%207.286%202.419%200%201.143-2.993%202.418-7.286%202.418-4.293%200-7.286-1.275-7.286-2.418C4.714%202.129%207.707.855%2012%20.855m8.143%202.419C20.143%201.147%2015.947%200%2012%200%208.052%200%203.857%201.147%203.857%203.274l.002.01h-.002v17.49C3.857%2022.87%208.052%2024%2012%2024c3.947%200%208.143-1.13%208.143-3.226V3.284h-.002l.002-.01'/%3e%3c/svg%3e`,supabase:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSupabase%3c/title%3e%3cpath%20d='M11.9%201.036c-.015-.986-1.26-1.41-1.874-.637L.764%2012.05C-.33%2013.427.65%2015.455%202.409%2015.455h9.579l.113%207.51c.014.985%201.259%201.408%201.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z'/%3e%3c/svg%3e`},Jw=e=>{let t=(0,X.c)(11),{name:n,className:r}=e,i=qw[n.toLowerCase()];if(!i){let e;t[0]===r?e=t[1]:(e=H(`mt-0.5`,r),t[0]=r,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,q.jsx)(Tt,{className:e}),t[2]=e,t[3]=n),n}let a;t[4]!==r||t[5]!==i?(a=H(`invert-[.5] dark:invert-[.7]`,r,i.endsWith(`.png`)&&`brightness-100 dark:brightness-100 invert-0 dark:invert-0`),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==n||t[8]!==a||t[9]!==i?(o=(0,q.jsx)(`img`,{src:i,alt:n,className:a}),t[7]=n,t[8]=a,t[9]=i,t[10]=o):o=t[10],o},Yw=e=>e.type===`checkbox`,Xw=e=>e instanceof Date,Zw=e=>e==null,Qw=e=>typeof e==`object`,$w=e=>!Zw(e)&&!Array.isArray(e)&&Qw(e)&&!Xw(e),eT=e=>$w(e)&&e.target?Yw(e.target)?e.target.checked:e.target.value:e,tT=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,nT=(e,t)=>e.has(tT(t)),rT=e=>{let t=e.constructor&&e.constructor.prototype;return $w(t)&&t.hasOwnProperty(`isPrototypeOf`)},iT=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function aT(e){let t,n=Array.isArray(e),r=typeof FileList<`u`&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(iT&&(e instanceof Blob||r))&&(n||$w(e))){if(t=n?[]:{},!n&&!rT(e))t=e;else for(let n in e)e.hasOwnProperty(n)&&(t[n]=aT(e[n]))}else return e;return t}var oT=e=>Array.isArray(e)?e.filter(Boolean):[],sT=e=>e===void 0,$=(e,t,n)=>{if(!t||!$w(e))return n;let r=oT(t.split(/[,[\].]+?/)).reduce((e,t)=>Zw(e)?e:e[t],e);return sT(r)||r===e?sT(e[t])?n:e[t]:r},cT=e=>typeof e==`boolean`,lT=e=>/^\w*$/.test(e),uT=e=>oT(e.replace(/["|']|\]/g,``).split(/\.|\[/)),dT=(e,t,n)=>{let r=-1,i=lT(t)?[t]:uT(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=$w(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}return e},fT={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},pT={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},mT={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},hT=K.createContext(null),gT=()=>K.useContext(hT),_T=e=>{let{children:t,...n}=e;return K.createElement(hT.Provider,{value:n},t)},vT=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==pT.all&&(t._proxyFormState[i]=!r||pT.all),n&&(n[i]=!0),e[i]}});return i},yT=e=>$w(e)&&!Object.keys(e).length,bT=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return yT(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||pT.all))},xT=e=>Array.isArray(e)?e:[e],ST=(e,t,n)=>!e||!t||e===t||xT(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e)));function CT(e){let t=K.useRef(e);t.current=e,K.useEffect(()=>{let n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function wT(e){let t=gT(),{control:n=t.control,disabled:r,name:i,exact:a}=e||{},[o,s]=K.useState(n._formState),c=K.useRef(!0),l=K.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=K.useRef(i);return u.current=i,CT({disabled:r,next:e=>c.current&&ST(u.current,e.name,a)&&bT(e,l.current,n._updateFormState)&&s({...n._formState,...e}),subject:n._subjects.state}),K.useEffect(()=>(c.current=!0,l.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),K.useMemo(()=>vT(o,n,l.current,!1),[o,n])}var TT=e=>typeof e==`string`,ET=(e,t,n,r,i)=>TT(e)?(r&&t.watch.add(e),$(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),$(n,e))):(r&&(t.watchAll=!0),n);function DT(e){let t=gT(),{control:n=t.control,name:r,defaultValue:i,disabled:a,exact:o}=e||{},s=K.useRef(r);s.current=r,CT({disabled:a,subject:n._subjects.values,next:e=>{ST(s.current,e.name,o)&&l(aT(ET(s.current,n._names,e.values||n._formValues,!1,i)))}});let[c,l]=K.useState(n._getWatch(r,i));return K.useEffect(()=>n._removeUnmounted()),c}function OT(e){let t=gT(),{name:n,disabled:r,control:i=t.control,shouldUnregister:a}=e,o=nT(i._names.array,n),s=DT({control:i,name:n,defaultValue:$(i._formValues,n,$(i._defaultValues,n,e.defaultValue)),exact:!0}),c=wT({control:i,name:n,exact:!0}),l=K.useRef(i.register(n,{...e.rules,value:s,...cT(e.disabled)?{disabled:e.disabled}:{}})),u=K.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!$(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!$(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!$(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!$(c.validatingFields,n)},error:{enumerable:!0,get:()=>$(c.errors,n)}}),[c,n]),d=K.useMemo(()=>({name:n,value:s,...cT(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:e=>l.current.onChange({target:{value:eT(e),name:n},type:fT.CHANGE}),onBlur:()=>l.current.onBlur({target:{value:$(i._formValues,n),name:n},type:fT.BLUR}),ref:e=>{let t=$(i._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}}),[n,i._formValues,r,c.disabled,s,i._fields]);return K.useEffect(()=>{let e=i._options.shouldUnregister||a,t=(e,t)=>{let n=$(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=aT($(i._options.defaultValues,n));dT(i._defaultValues,n,e),sT($(i._formValues,n))&&dT(i._formValues,n,e)}return!o&&i.register(n),()=>{(o?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,o,a]),K.useEffect(()=>{i._updateDisabledField({disabled:r,fields:i._fields,name:n})},[r,n,i]),K.useMemo(()=>({field:d,formState:c,fieldState:u}),[d,c,u])}var kT=e=>e.render(OT(e)),AT=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},jT=()=>{let e=typeof performance>`u`?Date.now():performance.now()*1e3;return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(Math.random()*16+e)%16|0;return(t==`x`?n:n&3|8).toString(16)})},MT=(e,t,n={})=>n.shouldFocus||sT(n.shouldFocus)?n.focusName||`${e}.${sT(n.focusIndex)?t:n.focusIndex}.`:``,NT=e=>({isOnSubmit:!e||e===pT.onSubmit,isOnBlur:e===pT.onBlur,isOnChange:e===pT.onChange,isOnAll:e===pT.all,isOnTouch:e===pT.onTouched}),PT=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),FT=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=$(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(FT(a,t))break}else if($w(a)&&FT(a,t))break}}},IT=(e,t,n)=>{let r=xT($(e,n));return dT(r,`root`,t[n]),dT(e,n,r),e},LT=e=>e.type===`file`,RT=e=>typeof e==`function`,zT=e=>{if(!iT)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},BT=e=>TT(e),VT=e=>e.type===`radio`,HT=e=>e instanceof RegExp,UT={value:!1,isValid:!1},WT={value:!0,isValid:!0},GT=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!sT(e[0].attributes.value)?sT(e[0].value)||e[0].value===``?WT:{value:e[0].value,isValid:!0}:WT:UT}return UT},KT={isValid:!1,value:null},qT=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,KT):KT;function JT(e,t,n=`validate`){if(BT(e)||Array.isArray(e)&&e.every(BT)||cT(e)&&!e)return{type:n,message:BT(e)?e:``,ref:t}}var YT=e=>$w(e)&&!HT(e)?e:{value:e,message:``},XT=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=$(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(cT(e)?``:e||``),y.reportValidity())},x={},S=VT(o),C=Yw(o),w=S||C,T=(g||LT(o))&&sT(o.value)&&sT(v)||zT(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=AT.bind(null,h,r,x),D=(e,t,n,r=mT.maxLength,i=mT.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||Zw(v))||cT(v)&&!v||C&&!GT(s).isValid||S&&!qT(s).isValid)){let{value:e,message:t}=BT(c)?{value:!!c,message:c}:YT(c);if(e&&(x[h]={type:mT.required,message:t,ref:y,...E(mT.required,t)},!r))return b(t),x}if(!T&&(!Zw(d)||!Zw(f))){let e,t,n=YT(f),i=YT(d);if(!Zw(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;Zw(n.value)||(e=r>n.value),Zw(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;TT(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),TT(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,mT.max,mT.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(TT(v)||a&&Array.isArray(v))){let e=YT(l),t=YT(u),n=!Zw(e.value)&&v.length>+e.value,i=!Zw(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&TT(v)){let{value:e,message:t}=YT(p);if(HT(e)&&!v.match(e)&&(x[h]={type:mT.pattern,message:t,ref:o,...E(mT.pattern,t)},!r))return b(t),x}if(m){if(RT(m)){let e=JT(await m(v,n),y);if(e&&(x[h]={...e,...E(mT.validate,e.message)},!r))return b(e.message),x}else if($w(m)){let e={};for(let t in m){if(!yT(e)&&!r)break;let i=JT(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!yT(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},ZT=(e,t)=>[...e,...xT(t)],QT=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function $T(e,t,n){return[...e.slice(0,t),...xT(n),...e.slice(t)]}var eE=(e,t,n)=>Array.isArray(e)?(sT(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],tE=(e,t)=>[...xT(t),...xT(e)];function nE(e,t){let n=0,r=[...e];for(let e of t)r.splice(e-n,1),n++;return oT(r).length?r:[]}var rE=(e,t)=>sT(t)?[]:nE(e,xT(t).sort((e,t)=>e-t)),iE=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]};function aE(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=sT(e)?r++:e[t[r++]];return e}function oE(e){for(let t in e)if(e.hasOwnProperty(t)&&!sT(e[t]))return!1;return!0}function sE(e,t){let n=Array.isArray(t)?t:lT(t)?[t]:uT(t),r=n.length===1?e:aE(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&($w(r)&&yT(r)||Array.isArray(r)&&oE(r))&&sE(e,n.slice(0,-1)),e}var cE=(e,t,n)=>(e[t]=n,e);function lE(e){let t=gT(),{control:n=t.control,name:r,keyName:i=`id`,shouldUnregister:a,rules:o}=e,[s,c]=K.useState(n._getFieldArray(r)),l=K.useRef(n._getFieldArray(r).map(jT)),u=K.useRef(s),d=K.useRef(r),f=K.useRef(!1);d.current=r,u.current=s,n._names.array.add(r),o&&n.register(r,o),CT({next:({values:e,name:t})=>{if(t===d.current||!t){let t=$(e,d.current);Array.isArray(t)&&(c(t),l.current=t.map(jT))}},subject:n._subjects.array});let p=K.useCallback(e=>{f.current=!0,n._updateFieldArray(r,e)},[n,r]);return K.useEffect(()=>{if(n._state.action=!1,PT(r,n._names)&&n._subjects.state.next({...n._formState}),f.current&&(!NT(n._options.mode).isOnSubmit||n._formState.isSubmitted)){if(n._options.resolver)n._executeSchema([r]).then(e=>{let t=$(e.errors,r),i=$(n._formState.errors,r);(i?!t&&i.type||t&&(i.type!==t.type||i.message!==t.message):t&&t.type)&&(t?dT(n._formState.errors,r,t):sE(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let e=$(n._fields,r);e&&e._f&&!(NT(n._options.reValidateMode).isOnSubmit&&NT(n._options.mode).isOnSubmit)&&XT(e,n._names.disabled,n._formValues,n._options.criteriaMode===pT.all,n._options.shouldUseNativeValidation,!0).then(e=>!yT(e)&&n._subjects.state.next({errors:IT(n._formState.errors,e,r)}))}}n._subjects.values.next({name:r,values:{...n._formValues}}),n._names.focus&&FT(n._fields,(e,t)=>{if(n._names.focus&&t.startsWith(n._names.focus)&&e.focus)return e.focus(),1}),n._names.focus=``,n._updateValid(),f.current=!1},[s,r,n]),K.useEffect(()=>(!$(n._formValues,r)&&n._updateFieldArray(r),()=>{(n._options.shouldUnregister||a)&&n.unregister(r)}),[r,n,i,a]),{swap:K.useCallback((e,t)=>{let i=n._getFieldArray(r);iE(i,e,t),iE(l.current,e,t),p(i),c(i),n._updateFieldArray(r,i,iE,{argA:e,argB:t},!1)},[p,r,n]),move:K.useCallback((e,t)=>{let i=n._getFieldArray(r);eE(i,e,t),eE(l.current,e,t),p(i),c(i),n._updateFieldArray(r,i,eE,{argA:e,argB:t},!1)},[p,r,n]),prepend:K.useCallback((e,t)=>{let i=xT(aT(e)),a=tE(n._getFieldArray(r),i);n._names.focus=MT(r,0,t),l.current=tE(l.current,i.map(jT)),p(a),c(a),n._updateFieldArray(r,a,tE,{argA:QT(e)})},[p,r,n]),append:K.useCallback((e,t)=>{let i=xT(aT(e)),a=ZT(n._getFieldArray(r),i);n._names.focus=MT(r,a.length-1,t),l.current=ZT(l.current,i.map(jT)),p(a),c(a),n._updateFieldArray(r,a,ZT,{argA:QT(e)})},[p,r,n]),remove:K.useCallback(e=>{let t=rE(n._getFieldArray(r),e);l.current=rE(l.current,e),p(t),c(t),!Array.isArray($(n._fields,r))&&dT(n._fields,r,void 0),n._updateFieldArray(r,t,rE,{argA:e})},[p,r,n]),insert:K.useCallback((e,t,i)=>{let a=xT(aT(t)),o=$T(n._getFieldArray(r),e,a);n._names.focus=MT(r,e,i),l.current=$T(l.current,e,a.map(jT)),p(o),c(o),n._updateFieldArray(r,o,$T,{argA:e,argB:QT(t)})},[p,r,n]),update:K.useCallback((e,t)=>{let i=aT(t),a=cE(n._getFieldArray(r),e,i);l.current=[...a].map((t,n)=>!t||n===e?jT():l.current[n]),p(a),c([...a]),n._updateFieldArray(r,a,cE,{argA:e,argB:i},!0,!1)},[p,r,n]),replace:K.useCallback(e=>{let t=xT(aT(e));l.current=t.map(jT),p([...t]),c([...t]),n._updateFieldArray(r,[...t],e=>e,{},!0,!1)},[p,r,n]),fields:K.useMemo(()=>s.map((e,t)=>({...e,[i]:l.current[t]||jT()})),[s,i])}}var uE=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},dE=e=>Zw(e)||!Qw(e);function fE(e,t){if(dE(e)||dE(t))return e===t;if(Xw(e)&&Xw(t))return e.getTime()===t.getTime();let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n){let n=e[i];if(!r.includes(i))return!1;if(i!==`ref`){let e=t[i];if(Xw(n)&&Xw(e)||$w(n)&&$w(e)||Array.isArray(n)&&Array.isArray(e)?!fE(n,e):n!==e)return!1}}return!0}var pE=e=>e.type===`select-multiple`,mE=e=>VT(e)||Yw(e),hE=e=>zT(e)&&e.isConnected,gE=e=>{for(let t in e)if(RT(e[t]))return!0;return!1};function _E(e,t={}){let n=Array.isArray(e);if($w(e)||n)for(let n in e)Array.isArray(e[n])||$w(e[n])&&!gE(e[n])?(t[n]=Array.isArray(e[n])?[]:{},_E(e[n],t[n])):Zw(e[n])||(t[n]=!0);return t}function vE(e,t,n){let r=Array.isArray(e);if($w(e)||r)for(let r in e)Array.isArray(e[r])||$w(e[r])&&!gE(e[r])?sT(t)||dE(n[r])?n[r]=Array.isArray(e[r])?_E(e[r],[]):{..._E(e[r])}:vE(e[r],Zw(t)?{}:t[r],n[r]):n[r]=!fE(e[r],t[r]);return n}var yE=(e,t)=>vE(e,t,_E(t)),bE=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>sT(e)?e:t?e===``?NaN:e&&+e:n&&TT(e)?new Date(e):r?r(e):e;function xE(e){let t=e.ref;return LT(t)?t.files:VT(t)?qT(e.refs).value:pE(t)?[...t.selectedOptions].map(({value:e})=>e):Yw(t)?GT(e.refs).value:bE(sT(t.value)?e.ref.value:t.value,e)}var SE=(e,t,n,r)=>{let i={};for(let n of e){let e=$(t,n);e&&dT(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},CE=e=>sT(e)?e:HT(e)?e.source:$w(e)?HT(e.value)?e.value.source:e.value:e,wE=`AsyncFunction`,TE=e=>!!e&&!!e.validate&&!!(RT(e.validate)&&e.validate.constructor.name===wE||$w(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===wE)),EE=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function DE(e,t,n){let r=$(e,n);if(r||lT(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=$(t,r),o=$(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};i.pop()}return{name:n}}var OE=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e,kE=(e,t)=>!oT($(e,t)).length&&sE(e,t),AE={mode:pT.onSubmit,reValidateMode:pT.onChange,shouldFocusError:!0};function jE(e={}){let t={...AE,...e},n={submitCount:0,isDirty:!1,isLoading:RT(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=($w(t.defaultValues)||$w(t.values))&&aT(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:aT(i),o={action:!1,mount:!1,watch:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:uE(),array:uE(),state:uE()},f=NT(t.mode),p=NT(t.reValidateMode),m=t.criteriaMode===pT.all,h=e=>t=>{clearTimeout(l),l=setTimeout(e,t)},g=async e=>{if(!t.disabled&&(u.isValid||e)){let e=t.resolver?yT((await w()).errors):await E(r,!0);e!==n.isValid&&d.state.next({isValid:e})}},_=(e,r)=>{!t.disabled&&(u.isValidating||u.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?dT(n.validatingFields,e,r):sE(n.validatingFields,e))}),d.state.next({validatingFields:n.validatingFields,isValidating:!yT(n.validatingFields)}))},v=(e,s=[],c,l,f=!0,p=!0)=>{if(l&&c&&!t.disabled){if(o.action=!0,p&&Array.isArray($(r,e))){let t=c($(r,e),l.argA,l.argB);f&&dT(r,e,t)}if(p&&Array.isArray($(n.errors,e))){let t=c($(n.errors,e),l.argA,l.argB);f&&dT(n.errors,e,t),kE(n.errors,e)}if(u.touchedFields&&p&&Array.isArray($(n.touchedFields,e))){let t=c($(n.touchedFields,e),l.argA,l.argB);f&&dT(n.touchedFields,e,t)}u.dirtyFields&&(n.dirtyFields=yE(i,a)),d.state.next({name:e,isDirty:O(e,s),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else dT(a,e,s)},y=(e,t)=>{dT(n.errors,e,t),d.state.next({errors:n.errors})},b=e=>{n.errors=e,d.state.next({errors:n.errors,isValid:!1})},x=(e,t,n,s)=>{let c=$(r,e);if(c){let r=$(a,e,sT(n)?$(i,e):n);sT(r)||s&&s.defaultChecked||t?dT(a,e,t?r:xE(c._f)):j(e,r),o.mount&&g()}},S=(e,a,o,s,c)=>{let l=!1,f=!1,p={name:e};if(!t.disabled){let t=!!($(r,e)&&$(r,e)._f&&$(r,e)._f.disabled);if(!o||s){u.isDirty&&(f=n.isDirty,n.isDirty=p.isDirty=O(),l=f!==p.isDirty);let r=t||fE($(i,e),a);f=!!(!t&&$(n.dirtyFields,e)),r||t?sE(n.dirtyFields,e):dT(n.dirtyFields,e,!0),p.dirtyFields=n.dirtyFields,l||=u.dirtyFields&&f!==!r}if(o){let t=$(n.touchedFields,e);t||(dT(n.touchedFields,e,o),p.touchedFields=n.touchedFields,l||=u.touchedFields&&t!==o)}l&&c&&d.state.next(p)}return l?p:{}},C=(e,r,i,a)=>{let o=$(n.errors,e),s=u.isValid&&cT(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>y(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?dT(n.errors,e,i):sE(n.errors,e)),(i?!fE(o,i):o)||!yT(a)||s){let t={...a,...s&&cT(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},d.state.next(t)}},w=async e=>{_(e,!0);let n=await t.resolver(a,t.context,SE(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return _(e),n},T=async e=>{let{errors:t}=await w(e);if(e)for(let r of e){let e=$(t,r);e?dT(n.errors,r,e):sE(n.errors,r)}else n.errors=t;return t},E=async(e,r,i={valid:!0})=>{for(let o in e){let c=e[o];if(c){let{_f:e,...l}=c;if(e){let l=s.array.has(e.name),d=c._f&&TE(c._f);d&&u.validatingFields&&_([o],!0);let f=await XT(c,s.disabled,a,m,t.shouldUseNativeValidation&&!r,l);if(d&&u.validatingFields&&_([o]),f[e.name]&&(i.valid=!1,r))break;!r&&($(f,e.name)?l?IT(n.errors,f,e.name):dT(n.errors,e.name,f[e.name]):sE(n.errors,e.name))}!yT(l)&&await E(l,r,i)}}return i.valid},D=()=>{for(let e of s.unMount){let t=$(r,e);t&&(t._f.refs?t._f.refs.every(e=>!hE(e)):!hE(t._f.ref))&&ae(e)}s.unMount=new Set},O=(e,n)=>!t.disabled&&(e&&n&&dT(a,e,n),!fE(ne(),i)),k=(e,t,n)=>ET(e,s,{...o.mount?a:sT(t)?i:TT(e)?{[e]:t}:t},n,t),A=e=>oT($(o.mount?a:i,e,t.shouldUnregister?$(i,e,[]):[])),j=(e,t,n={})=>{let i=$(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&dT(a,e,bE(t,n)),o=zT(n.ref)&&Zw(t)?``:t,pE(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?Yw(n.ref)?n.refs.length>1?n.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find(t=>t===e.value):o===e.value)):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach(e=>e.checked=e.value===o):LT(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||d.values.next({name:e,values:{...a}})))}(n.shouldDirty||n.shouldTouch)&&S(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&te(e)},M=(e,t,n)=>{for(let i in t){let a=t[i],o=`${e}.${i}`,c=$(r,o);(s.array.has(e)||$w(a)||c&&!c._f)&&!Xw(a)?M(o,a,n):j(o,a,n)}},N=(e,t,c={})=>{let l=$(r,e),f=s.array.has(e),p=aT(t);dT(a,e,p),f?(d.array.next({name:e,values:{...a}}),(u.isDirty||u.dirtyFields)&&c.shouldDirty&&d.state.next({name:e,dirtyFields:yE(i,a),isDirty:O(e,p)})):l&&!l._f&&!Zw(p)?M(e,p,c):j(e,p,c),PT(e,s)&&d.state.next({...n}),d.values.next({name:o.mount?e:void 0,values:{...a}})},P=async e=>{o.mount=!0;let i=e.target,l=i.name,h=!0,v=$(r,l),y=()=>i.type?xE(v._f):eT(e),b=e=>{h=Number.isNaN(e)||Xw(e)&&isNaN(e.getTime())||fE(e,$(a,l,e))};if(v){let i,o,x=y(),T=e.type===fT.BLUR||e.type===fT.FOCUS_OUT,D=!EE(v._f)&&!t.resolver&&!$(n.errors,l)&&!v._f.deps||OE(T,$(n.touchedFields,l),n.isSubmitted,p,f),O=PT(l,s,T);dT(a,l,x),T?(v._f.onBlur&&v._f.onBlur(e),c&&c(0)):v._f.onChange&&v._f.onChange(e);let k=S(l,x,T,!1),A=!yT(k)||O;if(!T&&d.values.next({name:l,type:e.type,values:{...a}}),D)return u.isValid&&(t.mode===`onBlur`&&T?g():T||g()),A&&d.state.next({name:l,...O?{}:k});if(!T&&O&&d.state.next({...n}),t.resolver){let{errors:e}=await w([l]);if(b(x),h){let t=DE(n.errors,r,l),a=DE(e,r,t.name||l);i=a.error,l=a.name,o=yT(e)}}else _([l],!0),i=(await XT(v,s.disabled,a,m,t.shouldUseNativeValidation))[l],_([l]),b(x),h&&(i?o=!1:u.isValid&&(o=await E(r,!0)));h&&(v._f.deps&&te(v._f.deps),C(l,o,i,k))}},ee=(e,t)=>{if($(n.errors,t)&&e.focus)return e.focus(),1},te=async(e,i={})=>{let a,o,c=xT(e);if(t.resolver){let t=await T(sT(e)?e:c);a=yT(t),o=e?!c.some(e=>$(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=$(r,e);return await E(t&&t._f?{[e]:t}:t)}))).every(Boolean),!(!o&&!n.isValid)&&g()):o=a=await E(r);return d.state.next({...!TT(e)||u.isValid&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&FT(r,ee,e?c:s.mount),o},ne=e=>{let t={...o.mount?a:i};return sT(e)?t:TT(e)?$(t,e):e.map(e=>$(t,e))},re=(e,t)=>({invalid:!!$((t||n).errors,e),isDirty:!!$((t||n).dirtyFields,e),error:$((t||n).errors,e),isValidating:!!$(n.validatingFields,e),isTouched:!!$((t||n).touchedFields,e)}),F=e=>{e&&xT(e).forEach(e=>sE(n.errors,e)),d.state.next({errors:e?n.errors:{}})},ie=(e,t,i)=>{let a=($(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=$(n.errors,e)||{};dT(n.errors,e,{...l,...t,ref:a}),d.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},I=(e,t)=>RT(e)?d.values.subscribe({next:n=>e(k(void 0,t),n)}):k(e,t,!0),ae=(e,o={})=>{for(let c of e?xT(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(sE(r,c),sE(a,c)),!o.keepError&&sE(n.errors,c),!o.keepDirty&&sE(n.dirtyFields,c),!o.keepTouched&&sE(n.touchedFields,c),!o.keepIsValidating&&sE(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&sE(i,c);d.values.next({values:{...a}}),d.state.next({...n,...o.keepDirty?{isDirty:O()}:{}}),!o.keepIsValid&&g()},L=({disabled:e,name:t,field:n,fields:r})=>{(cT(e)&&o.mount||e||s.disabled.has(t))&&(e?s.disabled.add(t):s.disabled.delete(t),S(t,xE(n?n._f:$(r,t)._f),!1,!1,!0))},oe=(e,n={})=>{let a=$(r,e),c=cT(n.disabled)||cT(t.disabled);return dT(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a?L({field:a,disabled:cT(n.disabled)?n.disabled:t.disabled,name:e}):x(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:CE(n.min),max:CE(n.max),minLength:CE(n.minLength),maxLength:CE(n.maxLength),pattern:CE(n.pattern)}:{},name:e,onChange:P,onBlur:P,ref:c=>{if(c){oe(e,n),a=$(r,e);let t=sT(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=mE(t),s=a._f.refs||[];if(o?s.find(e=>e===t):t===a._f.ref)return;dT(r,e,{_f:{...a._f,...o?{refs:[...s.filter(hE),t,...Array.isArray($(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),x(e,!1,void 0,t)}else a=$(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(nT(s.array,e)&&o.action)&&s.unMount.add(e)}}},se=()=>t.shouldFocusError&&FT(r,ee,s.mount),R=e=>{cT(e)&&(d.state.next({disabled:e}),FT(r,(t,n)=>{let i=$(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},ce=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=aT(a);if(s.disabled.size)for(let e of s.disabled)dT(l,e,void 0);if(d.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await w();n.errors=e,l=t}else await E(r);if(sE(n.errors,`root`),yT(n.errors)){d.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),se(),setTimeout(se);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:yT(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},le=(e,t={})=>{$(r,e)&&(sT(t.defaultValue)?N(e,aT($(i,e))):(N(e,t.defaultValue),dT(i,e,aT(t.defaultValue))),t.keepTouched||sE(n.touchedFields,e),t.keepDirty||(sE(n.dirtyFields,e),n.isDirty=t.defaultValue?O(e,aT($(i,e))):O()),t.keepError||(sE(n.errors,e),u.isValid&&g()),d.state.next({...n}))},ue=(e,c={})=>{let l=e?aT(e):i,f=aT(l),p=yT(e),m=p?i:f;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(yE(i,a))]);for(let t of Array.from(e))$(n.dirtyFields,t)?dT(m,t,$(a,t)):N(t,$(m,t))}else{if(iT&&sT(e))for(let e of s.mount){let t=$(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(zT(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}r={}}a=t.shouldUnregister?c.keepDefaultValues?aT(i):{}:aT(m),d.array.next({values:{...m}}),d.values.next({values:{...m}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!u.isValid||!!c.keepIsValid||!!c.keepDirtyValues,o.watch=!!t.shouldUnregister,d.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:p?!1:c.keepDirty?n.isDirty:!!(c.keepDefaultValues&&!fE(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:p?{}:c.keepDirtyValues?c.keepDefaultValues&&a?yE(i,a):n.dirtyFields:c.keepDefaultValues&&e?yE(i,e):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},z=(e,t)=>ue(RT(e)?e(a):e,t);return{control:{register:oe,unregister:ae,getFieldState:re,handleSubmit:ce,setError:ie,_executeSchema:w,_getWatch:k,_getDirty:O,_updateValid:g,_removeUnmounted:D,_updateFieldArray:v,_updateDisabledField:L,_getFieldArray:A,_reset:ue,_resetDefaultValues:()=>RT(t.defaultValues)&&t.defaultValues().then(e=>{z(e,t.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:e=>{n={...n,...e}},_disableForm:R,_subjects:d,_proxyFormState:u,_setErrors:b,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},set _formState(e){n=e},get _options(){return t},set _options(e){t={...t,...e}}},trigger:te,register:oe,handleSubmit:ce,watch:I,setValue:N,getValues:ne,reset:z,resetField:le,clearErrors:F,unregister:ae,setError:ie,setFocus:(e,t={})=>{let n=$(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&(e.focus(),t.shouldSelect&&RT(e.select)&&e.select())}},getFieldState:re}}function ME(e={}){let t=K.useRef(void 0),n=K.useRef(void 0),[r,i]=K.useState({isDirty:!1,isValidating:!1,isLoading:RT(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:RT(e.defaultValues)?void 0:e.defaultValues});t.current||={...jE(e),formState:r};let a=t.current.control;return a._options=e,CT({subject:a._subjects.state,next:e=>{bT(e,a._proxyFormState,a._updateFormState,!0)&&i({...a._formState})}}),K.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),K.useEffect(()=>{if(a._proxyFormState.isDirty){let e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}},[a,r.isDirty]),K.useEffect(()=>{e.values&&!fE(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values,i(e=>({...e}))):a._resetDefaultValues()},[e.values,a]),K.useEffect(()=>{e.errors&&a._setErrors(e.errors)},[e.errors,a]),K.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),K.useEffect(()=>{e.shouldUnregister&&a._subjects.values.next({values:a._getWatch()})},[e.shouldUnregister,a]),t.current.formState=vT(r,a),t.current}var NE=(e,t,n)=>{if(e&&`reportValidity`in e){let r=$(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},PE=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?NE(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>NE(t,n,e))}},FE=(e,t)=>{t.shouldUseNativeValidation&&PE(e,t);let n={};for(let r in e){let i=$(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(IE(t.names||Object.keys(e),r)){let e=Object.assign({},$(n,r));dT(e,`root`,a),dT(n,r,e)}else dT(n,r,a)}return n},IE=(e,t)=>{let n=LE(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>LE(e).match(`^${n}\\.\\d+`))};function LE(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function RE(){return RE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RE.apply(null,arguments)}function zE(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function BE(e,t){for(var n=Object.create(null);e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(`unionErrors`in r){var s=r.unionErrors.reduce(function(e,t){return t.errors.length<e.errors.length?t:e}).errors[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=AT(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function VE(e,t){for(var n=Object.create(null),r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors.reduce(function(e,t){return t.length<e.length?t:e})[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(RE({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=AT(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function HE(e,t,n){if(n===void 0&&(n={}),function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(zE(function(){function i(e){return a.shouldUseNativeValidation&&PE({},a),{errors:{},values:n.raw?Object.assign({},r):e}}var o=e;return n.mode===`sync`?i(o.parse(r,t)):Promise.resolve(o.parseAsync(r,t)).then(i)},function(e){if(function(e){var t;return!(e==null||(t=e._zod)==null||(t=t.traits)==null||!t.has(`$ZodError`))}(e))return{values:{},errors:FE(VE(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_def`in e&&typeof e._def==`object`}(e))return function(r,i,a){try{return Promise.resolve(zE(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&PE({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:FE(BE(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var UE={of(e){return JSON.stringify(e)},parse(e){if(!e)return{};try{return JSON.parse(e)}catch{return{label:e}}}};function WE(){return Math.floor(Math.random()*1e5)}var GE=1,KE=.9,qE=.8,JE=.17,YE=.1,XE=.999,ZE=.9999,QE=.99,$E=/[\\\/_+.#"@\[\(\{&]/,eD=/[\\\/_+.#"@\[\(\{&]/g,tD=/[\s-]/,nD=/[\s-]/g;function rD(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?GE:QE;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=rD(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=GE:$E.test(e.charAt(l-1))?(d*=qE,p=e.slice(i,l-1).match(eD),p&&i>0&&(d*=XE**+p.length)):tD.test(e.charAt(l-1))?(d*=KE,m=e.slice(i,l-1).match(nD),m&&i>0&&(d*=XE**+m.length)):(d*=JE,i>0&&(d*=XE**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=ZE)),(d<YE&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=rD(e,t,n,r,l+1,a+2,o),f*YE>d&&(d=f*YE)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function iD(e){return e.toLowerCase().replace(nD,` `)}function aD(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,rD(e,t,iD(e),iD(t),0,0,{})}var oD=`[cmdk-group=""]`,sD=`[cmdk-group-items=""]`,cD=`[cmdk-group-heading=""]`,lD=`[cmdk-item=""]`,uD=`${lD}:not([aria-disabled="true"])`,dD=`cmdk-item-select`,fD=`data-value`,pD=(e,t,n)=>aD(e,t,n),mD=K.createContext(void 0),hD=()=>K.useContext(mD),gD=K.createContext(void 0),_D=()=>K.useContext(gD),vD=K.createContext(void 0),yD=K.forwardRef((e,t)=>{let n=ND(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=ND(()=>new Set),i=ND(()=>new Map),a=ND(()=>new Map),o=ND(()=>new Set),s=jD(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Ue(),y=Ue(),b=Ue(),x=K.useRef(null),S=ID();MD(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),MD(()=>{S(6,k)},[]);let C=K.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=K.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??pD;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(sD);t?t.appendChild(e.parentElement===t?e:e.closest(`${sD} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${sD} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${oD}[${fD}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(fD);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(oD)?.querySelector(cD))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${lD}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(uD)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(fD))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(fD))}function P(e){let t=A()?.closest(oD),n;for(;t&&!n;)t=e>0?kD(t,oD):AD(t,oD),n=t?.querySelector(uD);n?C.setState(`value`,n.getAttribute(fD)):N(e)}let ee=()=>M(j().length-1),te=e=>{e.preventDefault(),e.metaKey?ee():e.altKey?P(1):N(1)},ne=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return K.createElement(Ee.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&te(e);break;case`ArrowDown`:te(e);break;case`p`:case`k`:g&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),ee();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(dD);t.dispatchEvent(e)}}}}},K.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:zD},c),RD(e,e=>K.createElement(gD.Provider,{value:C},K.createElement(mD.Provider,{value:w},e))))}),bD=K.forwardRef((e,t)=>{let n=Ue(),r=K.useRef(null),i=K.useContext(vD),a=hD(),o=jD(e),s=o.current?.forceMount??i?.forceMount;MD(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=FD(n,r,[e.value,e.children,r],e.keywords),l=_D(),u=PD(e=>e.value&&e.value===c.current),d=PD(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);K.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(dD,f),()=>t.removeEventListener(dD,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return K.createElement(Ee.div,{ref:L(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),xD=K.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Ue(),s=K.useRef(null),c=K.useRef(null),l=Ue(),u=hD(),d=PD(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));MD(()=>u.group(o),[]),FD(o,s,[e.value,e.heading,c]);let f=K.useMemo(()=>({id:o,forceMount:i}),[i]);return K.createElement(Ee.div,{ref:L(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&K.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),RD(e,e=>K.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},K.createElement(vD.Provider,{value:f},e))))}),SD=K.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=K.useRef(null),a=PD(e=>!e.search);return!n&&!a?null:K.createElement(Ee.div,{ref:L(i,t),...r,"cmdk-separator":``,role:`separator`})}),CD=K.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=_D(),o=PD(e=>e.search),s=PD(e=>e.selectedItemId),c=hD();return K.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),K.createElement(Ee.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),wD=K.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=K.useRef(null),o=K.useRef(null),s=PD(e=>e.selectedItemId),c=hD();return K.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),K.createElement(Ee.div,{ref:L(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},RD(e,e=>K.createElement(`div`,{ref:L(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),TD=K.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return K.createElement(tt,{open:n,onOpenChange:r},K.createElement(rt,{container:o},K.createElement(nt,{"cmdk-overlay":``,className:i}),K.createElement(et,{"aria-label":e.label,"cmdk-dialog":``,className:a},K.createElement(yD,{ref:t,...s}))))}),ED=K.forwardRef((e,t)=>PD(e=>e.filtered.count===0)?K.createElement(Ee.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),DD=K.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return K.createElement(Ee.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},RD(e,e=>K.createElement(`div`,{"aria-hidden":!0},e)))}),OD=Object.assign(yD,{List:wD,Item:bD,Input:CD,Group:xD,Separator:SD,Dialog:TD,Empty:ED,Loading:DD});function kD(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function AD(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function jD(e){let t=K.useRef(e);return MD(()=>{t.current=e}),t}var MD=typeof window>`u`?K.useEffect:K.useLayoutEffect;function ND(e){let t=K.useRef();return t.current===void 0&&(t.current=e()),t}function PD(e){let t=_D(),n=()=>e(t.snapshot());return K.useSyncExternalStore(t.subscribe,n,n)}function FD(e,t,n,r=[]){let i=K.useRef(),a=hD();return MD(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(fD,s),i.current=s}),i}var ID=()=>{let[e,t]=K.useState(),n=ND(()=>new Map);return MD(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function LD(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function RD({asChild:e,children:t},n){return e&&K.isValidElement(t)?K.cloneElement(LD(t),{ref:t.ref},n(t.props.children)):n(t)}var zD={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function BD(e){return e.toLowerCase().match(/[\da-z]+/g)||[]}function VD(e,t){let n=BD(e);if(n.length===0)return!0;let r=Array.isArray(t)?t:[t],i=[];for(let e of r)e&&i.push(...BD(e));return n.every(e=>i.some(t=>t.startsWith(e)))}function HD(e,t,n){return VD(t,e)?1:n&&VD(t,n)?.8:0}var UD=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(OD,{ref:t,filter:HD,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});UD.displayName=OD.displayName;var WD=e=>{let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=(0,q.jsx)(tn,{className:`overflow-hidden p-0 shadow-2xl`,usePortal:!0,children:(0,q.jsx)(UD,{className:`**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 **:[[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})}),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(en,{...r,children:i}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},GD=K.forwardRef((e,t)=>{let n=(0,X.c)(19),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,icon:i,rootClassName:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]===o?s=n[6]:(s=H(`flex items-center border-b px-3`,o),n[5]=o,n[6]=s);let c;n[7]===i?c=n[8]:(c=i===null?null:(0,q.jsx)(rn,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[7]=i,n[8]=c);let l;n[9]===r?l=n[10]:(l=H(`placeholder:text-foreground-muted flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,r),n[9]=r,n[10]=l);let u;n[11]!==a||n[12]!==t||n[13]!==l?(u=(0,q.jsx)(OD.Input,{ref:t,className:l,...a}),n[11]=a,n[12]=t,n[13]=l,n[14]=u):u=n[14];let d;return n[15]!==s||n[16]!==c||n[17]!==u?(d=(0,q.jsxs)(`div`,{className:s,"cmdk-input-wrapper":``,children:[c,u]}),n[15]=s,n[16]=c,n[17]=u,n[18]=d):d=n[18],d});GD.displayName=OD.Input.displayName;var KD=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(OD.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});KD.displayName=OD.List.displayName;var qD=K.forwardRef((e,t)=>{let n=(0,X.c)(3),r;return n[0]!==e||n[1]!==t?(r=(0,q.jsx)(OD.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});qD.displayName=OD.Empty.displayName;var JD=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(OD.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});JD.displayName=OD.Group.displayName;var YD=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=Ye({className:r}),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(OD.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});YD.displayName=OD.Separator.displayName;var XD=K.forwardRef((e,t)=>{let n=(0,X.c)(16),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,variant:o,inset:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]!==r||n[6]!==i||n[7]!==o?(s=H(Ze({variant:o,inset:i}).replace(Qe,`data-[disabled=false]:pointer-events-all data-[disabled=false]:opacity-100 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`),r),n[5]=r,n[6]=i,n[7]=o,n[8]=s):s=n[8];let c;n[9]===a.value?c=n[10]:(c=Vr.htmlEscape(a.value),n[9]=a.value,n[10]=c);let l;return n[11]!==a||n[12]!==t||n[13]!==s||n[14]!==c?(l=(0,q.jsx)(OD.Item,{ref:t,className:s,...a,value:c}),n[11]=a,n[12]=t,n[13]=s,n[14]=c,n[15]=l):l=n[15],l});XD.displayName=OD.Item.displayName;var ZD=Xe,QD=va,$D=Sa,eO=Ie(Ea),tO=Pa,nO=Ae(Oa),rO=K.forwardRef((e,t)=>{let n=(0,X.c)(22),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({className:r,align:a,sideOffset:o,portal:s,scrollable:c,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l=a===void 0?`center`:a,u=o===void 0?4:o,d=s===void 0||s,f=c!==void 0&&c,p=f&&`overflow-auto`,m;n[7]!==r||n[8]!==p?(m=H(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r,p),n[7]=r,n[8]=p,n[9]=m):m=n[9];let h=f?`calc(var(--radix-popover-content-available-height) - ${Ve}px)`:void 0,g;n[10]!==i.style||n[11]!==h?(g={...i.style,maxHeight:h},n[10]=i.style,n[11]=h,n[12]=g):g=n[12];let _;n[13]!==l||n[14]!==i||n[15]!==t||n[16]!==u||n[17]!==m||n[18]!==g?(_=(0,q.jsx)(Be,{children:(0,q.jsx)(nO,{ref:t,align:l,sideOffset:u,className:m,style:g,...i})}),n[13]=l,n[14]=i,n[15]=t,n[16]=u,n[17]=m,n[18]=g,n[19]=_):_=n[19];let v=_;if(d){let e;return n[20]===v?e=n[21]:(e=(0,q.jsx)(eO,{children:v}),n[20]=v,n[21]=e),e}return v});rO.displayName=Oa.displayName;var iO=(0,K.createContext)({isSelected:()=>!1,onSelect:ae.NOOP}),aO=e=>{let t=(0,X.c)(106),n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],v=t[17],y=t[18],b=t[19],x=t[20],S=t[21],C=t[22],w=t[23],T=t[24]):({children:n,displayValue:s,className:i,placeholder:h,value:T,defaultValue:o,onValueChange:p,multiple:y,shouldFilter:b,filterFn:c,open:m,defaultOpen:a,onOpenChange:d,inputPlaceholder:x,search:v,onSearchChange:f,emptyState:S,chips:C,chipsClassName:r,keepPopoverOpenOnSelect:u,id:l,disabled:w,renderValue:g,..._}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y,t[19]=b,t[20]=x,t[21]=S,t[22]=C,t[23]=w,t[24]=T);let E=y!==void 0&&y,D=b===void 0||b,O=x===void 0?`Search...`:x,k=S===void 0?`Nothing found.`:S,A=C!==void 0&&C,j=w!==void 0&&w,M=a??!1,N;t[25]!==d||t[26]!==m||t[27]!==M?(N={prop:m,defaultProp:M,onChange:d},t[25]=d,t[26]=m,t[27]=M,t[28]=N):N=t[28];let[P,ee]=Te(N),te=P!==void 0&&P,ne;t[29]===p?ne=t[30]:(ne=e=>{p?.(e)},t[29]=p,t[30]=ne);let re;t[31]!==o||t[32]!==ne||t[33]!==T?(re={prop:T,defaultProp:o,onChange:ne},t[31]=o,t[32]=ne,t[33]=T,t[34]=re):re=t[34];let[F,ie]=Te(re),I;t[35]===F?I=t[36]:(I=e=>Array.isArray(F)?F.includes(e):F===e,t[35]=F,t[36]=I);let ae=I,L;t[37]!==u||t[38]!==E||t[39]!==ee||t[40]!==ie||t[41]!==F?(L=e=>{let t=e;if(E){if(Array.isArray(F)){if(F.includes(t)){let n=F.filter(t=>t!==e);t=n.length>0?n:[]}else t=[...F,t]}else t=[t]}else F===e&&(t=null);ie(t),(u??E)||ee(!1)},t[37]=u,t[38]=E,t[39]=ee,t[40]=ie,t[41]=F,t[42]=L):L=t[42];let oe=L,se;t[43]!==A||t[44]!==s||t[45]!==E||t[46]!==h||t[47]!==F?(se=()=>E&&A&&h?h:F==null?h??`--`:Array.isArray(F)?F.length===0?h??`--`:F.length===1&&s!==void 0?s(F[0]):`${F.length} selected`:s===void 0?h??`--`:s(F),t[43]=A,t[44]=s,t[45]=E,t[46]=h,t[47]=F,t[48]=se):se=t[48];let R=se,ce;t[49]!==oe||t[50]!==ae?(ce={isSelected:ae,onSelect:oe},t[49]=oe,t[50]=ae,t[51]=ce):ce=t[51];let le=ce,ue;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ue=H(`relative`),t[52]=ue):ue=t[52];let z;t[53]!==j||t[54]!==ee?(z=e=>{j&&e||ee(e)},t[53]=j,t[54]=ee,t[55]=z):z=t[55];let B=j&&`cursor-not-allowed opacity-50`,de;t[56]!==i||t[57]!==B?(de=H(`flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:border-primary focus-visible:shadow-md-solid`,B,i),t[56]=i,t[57]=B,t[58]=de):de=t[58];let fe;t[59]!==g||t[60]!==R||t[61]!==F?(fe=g?g(F??null):R(),t[59]=g,t[60]=R,t[61]=F,t[62]=fe):fe=t[62];let pe;t[63]===fe?pe=t[64]:(pe=(0,q.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:fe}),t[63]=fe,t[64]=pe);let me;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,q.jsx)(Pt,{className:`ml-3 w-4 h-4 opacity-50 shrink-0`}),t[65]=me):me=t[65];let he;t[66]!==j||t[67]!==l||t[68]!==te||t[69]!==de||t[70]!==pe?(he=(0,q.jsx)($D,{asChild:!0,children:(0,q.jsxs)(`button`,{id:l,type:`button`,className:de,"aria-expanded":te,"aria-disabled":j,children:[pe,me]})}),t[66]=j,t[67]=l,t[68]=te,t[69]=de,t[70]=pe,t[71]=he):he=t[71];let V;t[72]!==O||t[73]!==f||t[74]!==v?(V=(0,q.jsx)(GD,{placeholder:O,rootClassName:`px-1 h-8`,autoFocus:!0,value:v,onValueChange:f}),t[72]=O,t[73]=f,t[74]=v,t[75]=V):V=t[75];let ge;t[76]===k?ge=t[77]:(ge=(0,q.jsx)(qD,{children:k}),t[76]=k,t[77]=ge);let _e;t[78]!==n||t[79]!==le?(_e=(0,q.jsx)(iO,{value:le,children:n}),t[78]=n,t[79]=le,t[80]=_e):_e=t[80];let ve;t[81]!==ge||t[82]!==_e?(ve=(0,q.jsxs)(KD,{className:`max-h-60 py-.5`,children:[ge,_e]}),t[81]=ge,t[82]=_e,t[83]=ve):ve=t[83];let ye;t[84]!==c||t[85]!==D||t[86]!==V||t[87]!==ve?(ye=(0,q.jsx)(rO,{className:`w-full min-w-(--radix-popover-trigger-width) p-0`,align:`start`,children:(0,q.jsxs)(UD,{filter:c,shouldFilter:D,children:[V,ve]})}),t[84]=c,t[85]=D,t[86]=V,t[87]=ve,t[88]=ye):ye=t[88];let be;t[89]!==te||t[90]!==z||t[91]!==he||t[92]!==ye?(be=(0,q.jsxs)(QD,{open:te,onOpenChange:z,children:[he,ye]}),t[89]=te,t[90]=z,t[91]=he,t[92]=ye,t[93]=be):be=t[93];let xe;t[94]!==A||t[95]!==r||t[96]!==j||t[97]!==s||t[98]!==oe||t[99]!==E||t[100]!==F?(xe=E&&A&&(0,q.jsx)(`div`,{className:H(`flex flex-col gap-1 items-start`,r),children:Array.isArray(F)&&F.map(e=>e==null?null:(0,q.jsxs)(ti,{variant:`secondary`,children:[s?.(e)??String(e),(0,q.jsx)(Eo,{onClick:()=>{j||oe(e)},className:H(`w-3 h-3 opacity-50 hover:opacity-100 ml-1 cursor-pointer`,j&&`pointer-events-none`)})]},String(e)))}),t[94]=A,t[95]=r,t[96]=j,t[97]=s,t[98]=oe,t[99]=E,t[100]=F,t[101]=xe):xe=t[101];let Se;return t[102]!==_||t[103]!==be||t[104]!==xe?(Se=(0,q.jsxs)(`div`,{className:ue,..._,children:[be,xe]}),t[102]=_,t[103]=be,t[104]=xe,t[105]=Se):Se=t[105],Se},oO=K.forwardRef((e,t)=>{let n=(0,X.c)(20),{children:r,className:i,value:a,onSelect:o,disabled:s}=e,c=typeof a==`object`&&`value`in a?a.value:String(a),l=K.use(iO),u;n[0]!==l||n[1]!==a?(u=l.isSelected(a),n[0]=l,n[1]=a,n[2]=u):u=n[2];let d=u,f;n[3]===i?f=n[4]:(f=H(`pl-6 m-1 py-1`,i),n[3]=i,n[4]=f);let p;n[5]!==l||n[6]!==o||n[7]!==a?(p=()=>{l.onSelect(a),o?.(a)},n[5]=l,n[6]=o,n[7]=a,n[8]=p):p=n[8];let m;n[9]===d?m=n[10]:(m=d&&(0,q.jsx)(Nt,{className:`absolute left-1 h-4 w-4`}),n[9]=d,n[10]=m);let h;return n[11]!==r||n[12]!==s||n[13]!==d||n[14]!==t||n[15]!==f||n[16]!==p||n[17]!==m||n[18]!==c?(h=(0,q.jsxs)(XD,{ref:t,className:f,role:`option`,"aria-selected":d,value:c,disabled:s,onSelect:p,children:[m,r]}),n[11]=r,n[12]=s,n[13]=d,n[14]=t,n[15]=f,n[16]=p,n[17]=m,n[18]=c,n[19]=h):h=n[19],h});oO.displayName=`ComboboxItem`;var sO=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`grid gap-2`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(so,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});sO.displayName=so.displayName;var cO=K.forwardRef((e,t)=>{let n=(0,X.c)(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=H(`h-[16px] w-[16px] transition-shadow data-[state=unchecked]:shadow-xs-solid rounded-full border border-input text-primary ring-offset-background focus:outline-hidden focus:shadow-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:shadow-none`,i),n[4]=i,n[5]=o);let s;n[6]===r?s=n[7]:(s=r??(0,q.jsx)(ho,{className:`flex items-center justify-center`,children:(0,q.jsx)(st,{className:`h-[10px] w-[10px] fill-primary text-current`})}),n[6]=r,n[7]=s);let c;return n[8]!==a||n[9]!==t||n[10]!==o||n[11]!==s?(c=(0,q.jsx)(po,{ref:t,className:o,...a,children:s}),n[8]=a,n[9]=t,n[10]=o,n[11]=s,n[12]=c):c=n[12],c});cO.displayName=po.displayName;function lO(e){return e instanceof k}function uO(e){return e instanceof j}function dO(e){return e instanceof T}var fO=_T,pO=()=>{let e=(0,X.c)(4),t=gT().formState.errors;if(Object.keys(t).length===0)return null;let n;e[0]===t?n=e[1]:(n=Object.values(t).map(wO).filter(Boolean),e[0]=t,e[1]=n);let r=n.join(`, `),i;return e[2]===r?i=e[3]:(i=(0,q.jsx)(`div`,{className:`text-destructive p-2 rounded-md bg-red-500/10`,children:r}),e[2]=r,e[3]=i),i},mO=K.createContext({}),hO=e=>{let t=(0,X.c)(10),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i;t[4]===n?i=t[5]:(i=(0,q.jsx)(kT,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==n.name||t[7]!==r||t[8]!==i?(a=(0,q.jsx)(mO,{value:r,children:i},n.name),t[6]=n.name,t[7]=r,t[8]=i,t[9]=a):a=t[9],a},gO=()=>{let e=(0,X.c)(11),t=K.use(mO),n=K.use(_O),{getFieldState:r,formState:i}=gT(),a;e[0]!==t.name||e[1]!==i||e[2]!==r?(a=r(t.name,i),e[0]=t.name,e[1]=i,e[2]=r,e[3]=a):a=e[3];let o=a;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:s}=n,c=`${s}-form-item`,l=`${s}-form-item-description`,u=`${s}-form-item-message`,d;return e[4]!==t.name||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==l||e[9]!==u?(d={id:s,name:t.name,formItemId:c,formDescriptionId:l,formMessageId:u,...o},e[4]=t.name,e[5]=o,e[6]=s,e[7]=c,e[8]=l,e[9]=u,e[10]=d):d=e[10],d},_O=K.createContext({}),vO=K.forwardRef((e,t)=>{let n=(0,X.c)(14),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=K.useId(),o;n[3]===a?o=n[4]:(o={id:a},n[3]=a,n[4]=o);let s;n[5]===r?s=n[6]:(s=H(`flex flex-col gap-1`,r),n[5]=r,n[6]=s);let c;n[7]!==i||n[8]!==t||n[9]!==s?(c=(0,q.jsx)(`div`,{ref:t,className:s,...i}),n[7]=i,n[8]=t,n[9]=s,n[10]=c):c=n[10];let l;return n[11]!==o||n[12]!==c?(l=(0,q.jsx)(_O,{value:o,children:c}),n[11]=o,n[12]=c,n[13]=l):l=n[13],l});vO.displayName=`FormItem`;var yO=K.forwardRef((e,t)=>{let n=(0,X.c)(11),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{error:a,formItemId:o}=gO();if(!i.children)return;let s=a&&`text-destructive`,c;n[3]!==r||n[4]!==s?(c=H(s,r),n[3]=r,n[4]=s,n[5]=c):c=n[5];let l;return n[6]!==o||n[7]!==i||n[8]!==t||n[9]!==c?(l=(0,q.jsx)(ut,{ref:t,className:c,htmlFor:o,...i}),n[6]=o,n[7]=i,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});yO.displayName=`FormLabel`;var bO=K.forwardRef((e,t)=>{let n=(0,X.c)(8),r;n[0]===e?r=n[1]:({...r}=e,n[0]=e,n[1]=r);let{error:i,formItemId:a,formDescriptionId:o,formMessageId:s}=gO(),c=i?`${o} ${s}`:o,l=!!i,u;return n[2]!==a||n[3]!==r||n[4]!==t||n[5]!==c||n[6]!==l?(u=(0,q.jsx)(ce,{ref:t,id:a,"aria-describedby":c,"aria-invalid":l,...r}),n[2]=a,n[3]=r,n[4]=t,n[5]=c,n[6]=l,n[7]=u):u=n[7],u});bO.displayName=`FormControl`;var xO=K.forwardRef((e,t)=>{let n=(0,X.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{formDescriptionId:a}=gO();if(!i.children)return null;let o;n[3]===r?o=n[4]:(o=H(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,q.jsx)(`p`,{ref:t,id:a,className:o,...i}),n[5]=a,n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});xO.displayName=`FormDescription`;var SO=K.forwardRef((e,t)=>{let n=(0,X.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{error:o,formMessageId:s}=gO(),c=o?.message?String(o?.message):r;if(!c)return null;let l;n[4]===i?l=n[5]:(l=H(`text-xs font-medium text-destructive`,i),n[4]=i,n[5]=l);let u;return n[6]!==c||n[7]!==s||n[8]!==a||n[9]!==t||n[10]!==l?(u=(0,q.jsx)(`p`,{ref:t,id:s,className:l,...a,children:c}),n[6]=c,n[7]=s,n[8]=a,n[9]=t,n[10]=l,n[11]=u):u=n[11],u});SO.displayName=`FormMessage`;var CO=e=>{let t=(0,X.c)(7),{className:n}=e,{error:r}=gO(),i=r?.message?String(r?.message):null;if(!i)return null;let a;t[0]===n?a=t[1]:(a=H(`stroke-[1.8px]`,n),t[0]=n,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,q.jsx)(wo,{className:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,q.jsx)(bt,{content:i,children:o}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s};CO.displayName=`FormMessageTooltip`;function wO(e){return e?.message}function TO(e){return`unwrap`in e?e.unwrap():e}function EO(e){let t=e=>{if(e instanceof D){let t=[...e.values];return e.values.size===1?t[0]:t}if(e instanceof S){let t=e.def.defaultValue;return typeof t==`function`?t():t}if(uO(e))return t(e.in);if(dO(e))return e.def.items.map(e=>t(e));if(`unwrap`in e)return t(TO(e))};return e instanceof x||e instanceof A?t(e.options[0]):lO(e)?OO(e)?[EO(e.element)]:[]:e instanceof O?``:e instanceof N?e.options[0]:e instanceof C?Object.fromEntries(Object.entries(e.shape).map(([e,n])=>[e,t(n)])):t(e)}function DO(e){if(e instanceof D)return e;if(e instanceof C){let t=e.shape.type;if(t instanceof D)return t;throw Error(`Invalid schema`)}if(e instanceof x||e instanceof A)return DO(e.options[0]);throw R.warn(e),Error(`Invalid schema`)}function OO(e){return!e.safeParse([]).success}var kO=Ce(H(`inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,`data-[state=on]:bg-muted data-[state=on]:text-muted-foreground`),{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted hover:text-muted-foreground`},size:{default:`h-9 px-3`,xs:`h-4 w-4`,sm:`h-6 px-2`,lg:`h-10 px-5`}},defaultVariants:{variant:`default`,size:`default`}}),AO=K.forwardRef((e,t)=>{let n=(0,X.c)(13),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,variant:o,size:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]!==r||n[6]!==a||n[7]!==o?(s=H(kO({variant:o,size:a,className:r})),n[5]=r,n[6]=a,n[7]=o,n[8]=s):s=n[8];let c;return n[9]!==i||n[10]!==t||n[11]!==s?(c=(0,q.jsx)(yo,{ref:t,className:s,...i}),n[9]=i,n[10]=t,n[11]=s,n[12]=c):c=n[12],c});AO.displayName=yo.displayName;var jO=`
113
- `,MO=e=>{let t=(0,X.c)(24),{value:n,options:r,onChange:i,className:a,placeholder:o,textAreaClassName:s,comboBoxClassName:c}=e,[l,u]=(0,K.useState)(!1),d;t[0]===n?d=t[1]:(d=PO(n),t[0]=n,t[1]=d);let f=d,p;t[2]!==c||t[3]!==i||t[4]!==r||t[5]!==o||t[6]!==l||t[7]!==s||t[8]!==f?(p=()=>l?(0,q.jsx)(NO,{value:f,className:s,onChange:i,placeholder:o?`${o}: one per line`:`One value per line`}):(0,q.jsx)(aO,{placeholder:o,displayValue:FO,className:H(`w-full max-w-[400px]`,c),multiple:!0,value:f,onValueChange:i,keepPopoverOpenOnSelect:!0,chips:!0,chipsClassName:`flex-row flex-wrap min-w-[210px]`,children:r.map(IO)}),t[2]=c,t[3]=i,t[4]=r,t[5]=o,t[6]=l,t[7]=s,t[8]=f,t[9]=p):p=t[9];let m=p,h;t[10]===a?h=t[11]:(h=H(`flex gap-1`,a),t[10]=a,t[11]=h);let g;t[12]===m?g=t[13]:(g=m(),t[12]=m,t[13]=g);let _=l?`Switch to multi-select`:`Switch to textarea`,v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,q.jsx)(Wo,{className:`w-3 h-3`}),t[14]=v):v=t[14];let y;t[15]===l?y=t[16]:(y=(0,q.jsx)(AO,{size:`xs`,onPressedChange:u,pressed:l,children:v}),t[15]=l,t[16]=y);let b;t[17]!==_||t[18]!==y?(b=(0,q.jsx)(bt,{content:_,children:y}),t[17]=_,t[18]=y,t[19]=b):b=t[19];let x;return t[20]!==h||t[21]!==g||t[22]!==b?(x=(0,q.jsxs)(`div`,{className:h,children:[g,b]}),t[20]=h,t[21]=g,t[22]=b,t[23]=x):x=t[23],x},NO=e=>{let t=(0,X.c)(11),{className:n,value:r,onChange:i,placeholder:a}=e,o,s;if(t[0]!==r){let e=PO(r);o=zt,s=e.join(jO),t[0]=r,t[1]=o,t[2]=s}else o=t[1],s=t[2];let c;t[3]===i?c=t[4]:(c=e=>{if(e.target.value===``){i([]);return}i(e.target.value.split(jO))},t[3]=i,t[4]=c);let l=a?`${a}: one per line`:`One value per line`,u;return t[5]!==o||t[6]!==n||t[7]!==s||t[8]!==c||t[9]!==l?(u=(0,q.jsx)(o,{value:s,className:n,rows:4,onChange:c,placeholder:l}),t[5]=o,t[6]=n,t[7]=s,t[8]=c,t[9]=l,t[10]=u):u=t[10],u};function PO(e){return e==null?[]:Array.isArray(e)?e:[e].filter(e=>e!=null||e!==``)}function FO(e){return e}function IO(e){return(0,q.jsx)(oO,{value:e,children:e},e)}var LO=[],RO=e=>{let t=(0,X.c)(9),{schema:n,form:r,path:i,renderers:a,children:o}=e,s=i===void 0?``:i,c=a===void 0?LO:a,l;t[0]!==r||t[1]!==s||t[2]!==c||t[3]!==n?(l=zO({schema:n,form:r,path:s,renderers:c}),t[0]=r,t[1]=s,t[2]=c,t[3]=n,t[4]=l):l=t[4];let u;return t[5]!==o||t[6]!==r||t[7]!==l?(u=(0,q.jsxs)(_T,{...r,children:[o,l]}),t[5]=o,t[6]=r,t[7]=l,t[8]=u):u=t[8],u};function zO({schema:e,form:t,path:n,renderers:r}){for(let i of r){let{isMatch:r,Component:a}=i;if(r(e))return(0,q.jsx)(a,{schema:e,form:t,path:n})}let{label:i,description:a,special:o,direction:s=`column`,minLength:c}=UE.parse(e.description||``);if(e instanceof S){let i=e.unwrap();return i=!i.description&&e.description?i.describe(e.description):i,zO({schema:i,form:t,path:n,renderers:r})}if(e instanceof w){let i=e.unwrap();return i=!i.description&&e.description?i.describe(e.description):i,zO({schema:i,form:t,path:n,renderers:r})}if(e instanceof C)return(0,q.jsxs)(`div`,{className:H(`flex`,s===`row`?`flex-row gap-6 items-start`:s===`two-columns`?`grid grid-cols-2 gap-y-6`:`flex-col gap-6`),children:[(0,q.jsx)(yO,{children:i}),z.entries(e.shape).map(([e,i])=>{let a=i instanceof D,o=zO({schema:i,form:t,path:GO(n,e),renderers:r});return a?(0,q.jsx)(K.Fragment,{children:o},e):(0,q.jsx)(`div`,{className:`flex flex-row align-start`,children:o},e)})]});if(e instanceof O)return o===`time`?(0,q.jsx)(hO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{children:i}),(0,q.jsx)(xO,{children:a}),(0,q.jsx)(bO,{children:(0,q.jsx)(an,{...e,onValueChange:e.onChange,type:`time`,className:`my-0`})}),(0,q.jsx)(SO,{})]})}):(0,q.jsx)(VO,{schema:e,form:t,path:n});if(e instanceof M)return(0,q.jsx)(hO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(vO,{children:[(0,q.jsxs)(`div`,{className:H(`flex flex-row gap-2`,a?`items-start`:`items-center`),children:[(0,q.jsx)(bO,{children:(0,q.jsx)(Tw,{"data-testid":`marimo-plugin-data-frames-boolean-checkbox`,checked:e.value,onCheckedChange:e.onChange,className:a?`mt-0.5`:void 0})}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(yO,{children:i}),(0,q.jsx)(xO,{children:a})]})]}),(0,q.jsx)(SO,{})]})});if(e instanceof ee)return o===`random_number_button`?(0,q.jsx)(hO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(St,{size:`xs`,"data-testid":`marimo-plugin-data-frames-random-number-button`,variant:`secondary`,onClick:()=>{e.onChange(WE())},children:[(0,q.jsx)(zo,{className:`w-3.5 h-3.5 mr-1`}),i]})}):(0,q.jsx)(hO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{children:i}),(0,q.jsx)(xO,{children:a}),(0,q.jsx)(bO,{children:(0,q.jsx)(nn,{...e,className:`my-0`,onValueChange:e.onChange})}),(0,q.jsx)(SO,{})]})});if(e instanceof E){let e=o===`datetime`?`datetime-local`:o===`time`?`time`:`date`;return(0,q.jsx)(hO,{control:t.control,name:n,render:({field:t})=>(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{children:i}),(0,q.jsx)(xO,{children:a}),(0,q.jsx)(bO,{children:(0,q.jsx)(an,{...t,onValueChange:t.onChange,type:e,className:`my-0`})}),(0,q.jsx)(SO,{})]})})}if(e instanceof P)return(0,q.jsx)(VO,{schema:e,form:t,path:n});if(e instanceof N){let r=e.options.map(e=>e.toString());return(0,q.jsx)(UO,{schema:e,form:t,path:n,options:r})}if(e instanceof k){if(o===`text_area_multiline`)return(0,q.jsx)(HO,{schema:e,form:t,path:n});let a=e.element;if(a instanceof N){let r=a.options.map(e=>e.toString());return(0,q.jsx)(WO,{schema:e,form:t,path:n,itemLabel:i,options:r})}return(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(ut,{children:i}),(0,q.jsx)(BO,{schema:e.element,form:t,path:n,minLength:c,renderers:r},n)]})}if(e instanceof A){let a=e.def,o=a.options,s=a.discriminator,c=e=>o.find(t=>DO(t).value===e);return(0,q.jsx)(hO,{control:t.control,name:n,render:({field:e})=>{let a=e.value,l=o.map(e=>DO(e).value),u=a&&typeof a==`object`&&s in a?a[s]:l[0],d=c(u);return(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(yO,{className:`mb-2`,children:i}),(0,q.jsx)(`div`,{className:`flex border-b mb-4`,children:l.map(t=>(0,q.jsx)(`button`,{type:`button`,className:`px-4 py-2 text-sm ${u===t?`border-b-2 border-primary font-medium`:`text-muted-foreground`}`,onClick:()=>{let n=c(t);n?e.onChange(EO(n)):e.onChange({[s]:t})},children:t},t))}),(0,q.jsx)(`div`,{className:`flex flex-col`,children:d&&zO({schema:d,form:t,path:n,renderers:r})},u)]})}})}return e instanceof x?(0,q.jsx)(hO,{control:t.control,name:n,render:({field:a})=>{let o=e.options,s=a.value,c=o.map(e=>DO(e).value);s||=c[0];let l=o.find(e=>DO(e).value===s);return(0,q.jsxs)(`div`,{className:`flex flex-col mb-4 gap-1`,children:[(0,q.jsx)(yO,{children:i}),(0,q.jsx)(ft,{"data-testid":`marimo-plugin-data-frames-union-select`,...a,children:c.map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))}),l&&zO({schema:l,form:t,path:n,renderers:r})]})}}):e instanceof D?(0,q.jsx)(hO,{control:t.control,name:n,render:({field:t})=>(0,q.jsx)(`input`,{...t,type:`hidden`,value:String([...e.values][0]??``)})}):`unwrap`in e?zO({schema:TO(e),form:t,path:n,renderers:r}):uO(e)?zO({schema:e.in,form:t,path:n,renderers:r}):(0,q.jsxs)(`div`,{children:[`Unknown schema type`,` `,e==null?n:JSON.stringify(e.type??e)]})}var BO=e=>{let t=(0,X.c)(39),{schema:n,form:r,path:i,minLength:a,renderers:o}=e,s;t[0]===n.description?s=t[1]:(s=UE.parse(n.description||``),t[0]=n.description,t[1]=s);let{label:c,description:l}=s,u=r.control,d;t[2]!==u||t[3]!==i?(d={control:u,name:i},t[2]=u,t[3]=i,t[4]=d):d=t[4];let{fields:f,append:p,remove:m}=lE(d),h=a!=null&&f.length<a,g=a==null||f.length>a,_;t[5]===c?_=t[6]:(_=(0,q.jsx)(yO,{children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,q.jsx)(xO,{children:l}),t[7]=l,t[8]=v);let y;if(t[9]!==g||t[10]!==f||t[11]!==r||t[12]!==i||t[13]!==m||t[14]!==o||t[15]!==n){let e;t[17]!==g||t[18]!==r||t[19]!==i||t[20]!==m||t[21]!==o||t[22]!==n?(e=(e,t)=>(0,q.jsxs)(`div`,{className:`flex flex-row pl-2 ml-2 border-l-2 border-disabled hover-actions-parent relative pr-5 pt-1 items-center w-fit`,onKeyDown:xt.onEnter(KO),children:[zO({schema:n,form:r,path:`${i}[${t}]`,renderers:o}),g&&(0,q.jsx)(on,{className:`w-4 h-4 ml-2 my-1 text-muted-foreground hover:text-destructive cursor-pointer absolute right-0 top-5`,onClick:()=>{m(t)}})]},e.id),t[17]=g,t[18]=r,t[19]=i,t[20]=m,t[21]=o,t[22]=n,t[23]=e):e=t[23],y=f.map(e),t[9]=g,t[10]=f,t[11]=r,t[12]=i,t[13]=m,t[14]=o,t[15]=n,t[16]=y}else y=t[16];let b;t[24]!==h||t[25]!==a?(b=h&&(0,q.jsx)(`div`,{className:`text-destructive text-xs font-semibold`,children:(0,q.jsxs)(`div`,{children:[`At least `,a,` required.`]})}),t[24]=h,t[25]=a,t[26]=b):b=t[26];let x;t[27]!==p||t[28]!==n?(x=()=>{p(EO(n))},t[27]=p,t[28]=n,t[29]=x):x=t[29];let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,q.jsx)($t,{className:`w-3.5 h-3.5 mr-1`}),t[30]=S):S=t[30];let C;t[31]===x?C=t[32]:(C=(0,q.jsx)(`div`,{children:(0,q.jsxs)(St,{size:`xs`,"data-testid":`marimo-plugin-data-frames-add-array-item`,variant:`text`,className:`hover:text-accent-foreground`,onClick:x,children:[S,`Add`]})}),t[31]=x,t[32]=C);let w;return t[33]!==_||t[34]!==v||t[35]!==y||t[36]!==b||t[37]!==C?(w=(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 min-w-[220px]`,children:[_,v,y,b,C]}),t[33]=_,t[34]=v,t[35]=y,t[36]=b,t[37]=C,t[38]=w):w=t[38],w},VO=e=>{let t=(0,X.c)(21),{schema:n,form:r,path:i}=e,a;t[0]===n.description?a=t[1]:(a=UE.parse(n.description),t[0]=n.description,t[1]=a);let{label:o,description:s,placeholder:c,disabled:l,inputType:u}=a;if(u===`textarea`){let e;t[2]!==s||t[3]!==l||t[4]!==o||t[5]!==c?(e=e=>{let{field:t}=e;return(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{children:o}),(0,q.jsx)(xO,{children:s}),(0,q.jsx)(bO,{children:(0,q.jsx)(zt,{...t,value:t.value,onChange:t.onChange,className:`my-0`,placeholder:c,disabled:l})}),(0,q.jsx)(SO,{})]})},t[2]=s,t[3]=l,t[4]=o,t[5]=c,t[6]=e):e=t[6];let n;return t[7]!==r.control||t[8]!==i||t[9]!==e?(n=(0,q.jsx)(hO,{control:r.control,name:i,render:e}),t[7]=r.control,t[8]=i,t[9]=e,t[10]=n):n=t[10],n}let d;t[11]!==s||t[12]!==l||t[13]!==u||t[14]!==o||t[15]!==c?(d=e=>{let{field:t}=e;return(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{children:o}),(0,q.jsx)(xO,{children:s}),(0,q.jsx)(bO,{children:(0,q.jsx)(an,{...t,type:u,value:t.value,onValueChange:t.onChange,className:`my-0`,placeholder:c,disabled:l})}),(0,q.jsx)(SO,{})]})},t[11]=s,t[12]=l,t[13]=u,t[14]=o,t[15]=c,t[16]=d):d=t[16];let f;return t[17]!==r.control||t[18]!==i||t[19]!==d?(f=(0,q.jsx)(hO,{control:r.control,name:i,render:d}),t[17]=r.control,t[18]=i,t[19]=d,t[20]=f):f=t[20],f},HO=e=>{let t=(0,X.c)(10),{schema:n,form:r,path:i}=e,a;t[0]===n.description?a=t[1]:(a=UE.parse(n.description),t[0]=n.description,t[1]=a);let{label:o,description:s,placeholder:c}=a,l;t[2]!==s||t[3]!==o||t[4]!==c?(l=e=>{let{field:t}=e;return(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{children:o}),(0,q.jsx)(xO,{children:s}),(0,q.jsx)(bO,{children:(0,q.jsx)(NO,{...t,placeholder:c})}),(0,q.jsx)(SO,{})]})},t[2]=s,t[3]=o,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==r.control||t[7]!==i||t[8]!==l?(u=(0,q.jsx)(hO,{control:r.control,name:i,render:l}),t[6]=r.control,t[7]=i,t[8]=l,t[9]=u):u=t[9],u},UO=e=>{let t=(0,X.c)(22),{schema:n,form:r,path:i,options:a,textTransform:o}=e,s;t[0]===n.description?s=t[1]:(s=UE.parse(n.description),t[0]=n.description,t[1]=s);let{label:c,description:l,disabled:u,special:d}=s;if(d===`radio_group`){let e;t[2]!==l||t[3]!==c||t[4]!==a||t[5]!==i?(e=e=>{let{field:t}=e;return(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{children:c}),(0,q.jsx)(xO,{children:l}),(0,q.jsx)(bO,{children:(0,q.jsx)(sO,{className:`flex flex-row gap-2 pt-1 items-center`,value:t.value,onValueChange:t.onChange,children:a.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(cO,{value:e,id:`${i}-${e}`},e),(0,q.jsx)(yO,{className:`whitespace-pre`,htmlFor:`${i}-${e}`,children:Vr.startCase(e)})]},e))})}),(0,q.jsx)(SO,{})]})},t[2]=l,t[3]=c,t[4]=a,t[5]=i,t[6]=e):e=t[6];let n;return t[7]!==u||t[8]!==r.control||t[9]!==i||t[10]!==e?(n=(0,q.jsx)(hO,{control:r.control,name:i,disabled:u,render:e}),t[7]=u,t[8]=r.control,t[9]=i,t[10]=e,t[11]=n):n=t[11],n}let f;t[12]!==l||t[13]!==c||t[14]!==a||t[15]!==o?(f=e=>{let{field:t}=e;return(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{className:`whitespace-pre`,children:c}),(0,q.jsx)(xO,{children:l}),(0,q.jsx)(bO,{children:(0,q.jsxs)(_t,{"data-testid":`marimo-plugin-data-frames-select`,value:t.value,onValueChange:t.onChange,children:[(0,q.jsx)(gt,{className:`min-w-[180px]`,children:(0,q.jsx)(lt,{placeholder:`--`})}),(0,q.jsx)(pt,{children:(0,q.jsxs)(ht,{children:[a.map(e=>(0,q.jsx)(dt,{value:e,children:o?.(e)??e},e)),a.length===0&&(0,q.jsx)(dt,{disabled:!0,value:`--`,children:`No options`})]})})]})}),(0,q.jsx)(SO,{})]})},t[12]=l,t[13]=c,t[14]=a,t[15]=o,t[16]=f):f=t[16];let p;return t[17]!==u||t[18]!==r.control||t[19]!==i||t[20]!==f?(p=(0,q.jsx)(hO,{control:r.control,name:i,disabled:u,render:f}),t[17]=u,t[18]=r.control,t[19]=i,t[20]=f,t[21]=p):p=t[21],p},WO=e=>{let t=(0,X.c)(15),{schema:n,form:r,path:i,options:a,itemLabel:o,showSwitchable:s}=e,c;t[0]===n.description?c=t[1]:(c=UE.parse(n.description),t[0]=n.description,t[1]=c);let{label:l,description:u,placeholder:d}=c,f;t[2]!==o||t[3]!==d?(f=d??(o?`Select ${o?.toLowerCase()}`:void 0),t[2]=o,t[3]=d,t[4]=f):f=t[4];let p=f,m;t[5]!==u||t[6]!==l||t[7]!==a||t[8]!==p||t[9]!==s?(m=e=>{let{field:t}=e,n=PO(t.value);return(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{className:`whitespace-pre`,children:l}),(0,q.jsx)(xO,{children:u}),(0,q.jsx)(bO,{children:s?(0,q.jsx)(MO,{...t,value:n,options:a,placeholder:p}):(0,q.jsx)(aO,{className:`min-w-[180px]`,placeholder:p,displayValue:qO,multiple:!0,chips:!0,keepPopoverOpenOnSelect:!0,value:n,onValueChange:t.onChange,children:a.map(JO)})}),(0,q.jsx)(SO,{})]})},t[5]=u,t[6]=l,t[7]=a,t[8]=p,t[9]=s,t[10]=m):m=t[10];let h;return t[11]!==r.control||t[12]!==i||t[13]!==m?(h=(0,q.jsx)(hO,{control:r.control,name:i,render:m}),t[11]=r.control,t[12]=i,t[13]=m,t[14]=h):h=t[14],h};function GO(...e){return e.filter(e=>e!==``).join(`.`)}function KO(e){return e.preventDefault()}function qO(e){return Vr.startCase(e)}function JO(e){return(0,q.jsx)(oO,{value:e,children:e},e)}function YO({moduleName:e,variableName:t,onAddImport:n,appStore:r=u}){if(t in r.get(Oh))return!1;let{cellData:i,cellIds:a}=r.get(xM),o=RegExp(`import[ \t]+${e}[ \t]+as[ \t]+${t}`,`g`);for(let e of a.inOrderIds)if(o.test(i[e].code))return!1;return n(`import ${e} as ${t}`),!0}function XO({autoInstantiate:e,createNewCell:t,fromCellId:n,before:r}){let i=Hr(),a=null;return YO({moduleName:`marimo`,variableName:`mo`,onAddImport:o=>{a=Ii.create(),t({cellId:n??`__end__`,before:r??!1,code:o,lastCodeRun:e?o:void 0,newCellId:a,skipIfCodeExists:!0,autoFocus:!1}),e&&i.sendRun({cellIds:[a],codes:[o]})}})?a:null}function ZO({autoInstantiate:e,createNewCell:t,fromCellId:n}){let r=Hr(),i=null;return YO({moduleName:`altair`,variableName:`alt`,onAddImport:a=>{i=Ii.create(),t({cellId:n??`__end__`,before:!1,code:a,lastCodeRun:e?a:void 0,newCellId:i,skipIfCodeExists:!0,autoFocus:!1}),e&&r.sendRun({cellIds:[i],codes:[a]})}})?i:null}function QO(){return{focusedCellId:null,lastFocusedCellId:null}}var{reducer:$O,createActions:ek,valueAtom:tk,useActions:nk}=jr(QO,{focusCell:(e,t)=>({...e,focusedCellId:t.cellId,lastFocusedCellId:t.cellId}),toggleCell:(e,t)=>e.focusedCellId===t.cellId?{...e,focusedCellId:null}:{...e,focusedCellId:t.cellId,lastFocusedCellId:t.cellId},blurCell:e=>({...e,focusedCellId:null})}),rk=o(e=>e(tk).lastFocusedCellId);function ik(){return s(rk)}var ak=o(e=>{let t=e(rk);return!t||t===`__scratch__`?null:sk(t,e(xM))});function ok(e){return o(t=>sk(e,t(xM)))}function sk(e,t){let{cellData:n,cellHandles:r,cellRuntime:i}=t,a=n[e],o=i[e],s=r[e]?.current;return!a||!s?null:{cellId:e,name:a.name,config:a.config,status:o?o.status:`idle`,getEditorView:()=>s.editorViewOrNull,hasOutput:o?.output!=null,hasConsoleOutput:o?.consoleOutputs!=null}}function ck(e,t){if(!t)return{recommended:[],other:[...e]};let n;try{n=new RegExp(t,`i`)}catch{return{recommended:[],other:[...e]}}let r=[],i=[];for(let t of e)n.test(t)?r.push(t):i.push(t);return{recommended:r,other:i}}var lk=e=>`Use "${e}"`,uk=e=>{let t=(0,X.c)(96),{value:n,onChange:r,placeholder:i,secretsOnly:a,recommendedKeys:o,otherKeys:s,onCreateSecret:c,className:l,searchPlaceholder:u,formatCustomValueLabel:d,createSecretLabel:f,allowCustomValue:p,allowCreateSecret:m}=e,h=a!==void 0&&a,g=d===void 0?lk:d,_=f===void 0?`Create a new secret`:f,[v,y]=(0,K.useState)(!1),[b,x]=(0,K.useState)(``),S,C,w,T,E,D,O,k,A,j,M,N,P,ee,te,ne,re,F;if(t[0]!==m||t[1]!==p||t[2]!==l||t[3]!==g||t[4]!==r||t[5]!==v||t[6]!==i||t[7]!==b||t[8]!==u||t[9]!==h||t[10]!==n){F=b.trim();let e=!h&&F.length>0&&F!==n&&(p?.(F)??!0);O=m?.(F)??!0;let a;bb0:{if(!n){a=null;break bb0}if(Jt(n)){let e;t[29]===n?e=t[30]:(e=qt(n),t[29]=n,t[30]=e),a=e;break bb0}a=n}let o=a,s;t[31]===r?s=t[32]:(s=e=>{r(Ht(e)),y(!1),x(``)},t[31]=r,t[32]=s),D=s;let c;t[33]===r?c=t[34]:(c=e=>{r(e),y(!1),x(``)},t[33]=r,t[34]=c);let d=c,f;t[35]===r?f=t[36]:(f=()=>{r(``),x(``),y(!1)},t[35]=r,t[36]=f),E=f,t[37]===l?M=t[38]:(M=H(`flex w-full min-w-48 mb-1 items-center gap-1`,l),t[37]=l,t[38]=M),T=QD,re=!0,k=v,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{y(e),e||x(``)},t[39]=A):A=t[39];let _;t[40]===n?_=t[41]:(_=H(`flex h-6 min-w-0 flex-1 shadow-xs-solid items-center justify-between`,`rounded-sm border border-input bg-background px-1.5 text-sm font-code ring-offset-background placeholder:text-muted-foreground`,`hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid`,Jt(n)&&`bg-accent`),t[40]=n,t[41]=_);let ie;t[42]!==o||t[43]!==i||t[44]!==n?(ie=(0,q.jsx)(`span`,{className:`truncate flex-1 min-w-0 text-left flex items-center gap-1.5`,children:o?(0,q.jsxs)(q.Fragment,{children:[Jt(n)&&(0,q.jsx)(Bt,{className:`h-3 w-3 shrink-0 opacity-70`}),(0,q.jsx)(`span`,{className:`truncate`,children:o})]}):(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:i})}),t[42]=o,t[43]=i,t[44]=n,t[45]=ie):ie=t[45];let I;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,q.jsx)(Pt,{className:`ml-1 h-4 w-4 opacity-50 shrink-0`}),t[46]=I):I=t[46],t[47]!==v||t[48]!==_||t[49]!==ie?(j=(0,q.jsx)($D,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:_,"aria-expanded":v,children:[ie,I]})}),t[47]=v,t[48]=_,t[49]=ie,t[50]=j):j=t[50],w=rO,te=`w-(--radix-popover-trigger-width) p-0`,ne=`start`,C=UD;let ae=u??(h?`Search secrets...`:`Type a value or search secrets...`);t[51]!==b||t[52]!==ae?(ee=(0,q.jsx)(GD,{placeholder:ae,rootClassName:`px-1 h-8`,autoFocus:!0,value:b,onValueChange:x}),t[51]=b,t[52]=ae,t[53]=ee):ee=t[53],S=KD,N=`max-h-60 overscroll-contain`,P=e&&(0,q.jsx)(JD,{children:(0,q.jsx)(XD,{value:`use custom value ${F}`,onSelect:()=>d(F),children:g(F)})}),t[0]=m,t[1]=p,t[2]=l,t[3]=g,t[4]=r,t[5]=v,t[6]=i,t[7]=b,t[8]=u,t[9]=h,t[10]=n,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=E,t[16]=D,t[17]=O,t[18]=k,t[19]=A,t[20]=j,t[21]=M,t[22]=N,t[23]=P,t[24]=ee,t[25]=te,t[26]=ne,t[27]=re,t[28]=F}else S=t[11],C=t[12],w=t[13],T=t[14],E=t[15],D=t[16],O=t[17],k=t[18],A=t[19],j=t[20],M=t[21],N=t[22],P=t[23],ee=t[24],te=t[25],ne=t[26],re=t[27],F=t[28];let ie;t[54]!==_||t[55]!==c||t[56]!==O||t[57]!==F?(ie=O&&(0,q.jsx)(JD,{className:`mt-0`,children:(0,q.jsxs)(XD,{value:`create new secret ${F}`,onSelect:()=>{let e=F||void 0;y(!1),x(``),c(e)},children:[(0,q.jsx)(To,{className:`mr-2 h-3.5 w-3.5`}),_]})}),t[54]=_,t[55]=c,t[56]=O,t[57]=F,t[58]=ie):ie=t[58];let I;t[59]!==o||t[60]!==D?(I=o.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(YD,{className:`mt-0`}),(0,q.jsx)(JD,{heading:`Recommended`,children:o.map(e=>(0,q.jsxs)(XD,{value:e,onSelect:()=>D(e),children:[(0,q.jsx)(Bt,{className:`mr-2 h-3 w-3 opacity-70`}),e]},e))})]}),t[59]=o,t[60]=D,t[61]=I):I=t[61];let ae;t[62]!==s||t[63]!==o.length||t[64]!==D?(ae=s.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(YD,{className:`mt-0`}),(0,q.jsx)(JD,{heading:o.length>0?`Other`:void 0,children:s.map(e=>(0,q.jsxs)(XD,{value:e,onSelect:()=>D(e),children:[(0,q.jsx)(Bt,{className:`mr-2 h-3 w-3 opacity-70`}),e]},e))})]}),t[62]=s,t[63]=o.length,t[64]=D,t[65]=ae):ae=t[65];let L;t[66]!==S||t[67]!==ie||t[68]!==I||t[69]!==ae||t[70]!==N||t[71]!==P?(L=(0,q.jsxs)(S,{className:N,children:[P,ie,I,ae]}),t[66]=S,t[67]=ie,t[68]=I,t[69]=ae,t[70]=N,t[71]=P,t[72]=L):L=t[72];let oe;t[73]!==C||t[74]!==L||t[75]!==ee?(oe=(0,q.jsxs)(C,{children:[ee,L]}),t[73]=C,t[74]=L,t[75]=ee,t[76]=oe):oe=t[76];let se;t[77]!==w||t[78]!==oe||t[79]!==te||t[80]!==ne?(se=(0,q.jsx)(w,{className:te,align:ne,children:oe}),t[77]=w,t[78]=oe,t[79]=te,t[80]=ne,t[81]=se):se=t[81];let R;t[82]!==T||t[83]!==k||t[84]!==A||t[85]!==j||t[86]!==se||t[87]!==re?(R=(0,q.jsxs)(T,{modal:re,open:k,onOpenChange:A,children:[j,se]}),t[82]=T,t[83]=k,t[84]=A,t[85]=j,t[86]=se,t[87]=re,t[88]=R):R=t[88];let ce;t[89]!==E||t[90]!==n?(ce=n&&(0,q.jsx)(`button`,{type:`button`,"aria-label":`Clear`,className:H(`flex h-6 w-6 shrink-0 items-center justify-center rounded-sm`,`text-muted-foreground hover:bg-muted hover:text-foreground`,`focus:outline-hidden focus:ring-1 focus:ring-ring`),onClick:E,children:(0,q.jsx)(Ft,{className:`h-3.5 w-3.5`})}),t[89]=E,t[90]=n,t[91]=ce):ce=t[91];let le;return t[92]!==M||t[93]!==R||t[94]!==ce?(le=(0,q.jsxs)(`div`,{className:M,children:[R,ce]}),t[92]=M,t[93]=R,t[94]=ce,t[95]=le):le=t[95],le},dk=(0,K.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:ae.NOOP}),fk=()=>(0,K.use)(dk),pk=e=>{let t=(0,X.c)(14),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let{data:i,isPending:a,error:o,refetch:s}=fi(yk,r);i?.secretKeys,i?.providerNames;let c;t[1]===i?.secretKeys?c=t[2]:(c=i?.secretKeys||[],t[1]=i?.secretKeys,t[2]=c);let l;t[3]===i?.providerNames?l=t[4]:(l=i?.providerNames||[],t[3]=i?.providerNames,t[4]=l);let u;t[5]!==o||t[6]!==a||t[7]!==s||t[8]!==c||t[9]!==l?(u={secretKeys:c,providerNames:l,loading:a,error:o,refreshSecrets:s},t[5]=o,t[6]=a,t[7]=s,t[8]=c,t[9]=l,t[10]=u):u=t[10];let d=u,f;return t[11]!==n||t[12]!==d?(f=(0,q.jsx)(dk,{value:d,children:n}),t[11]=n,t[12]=d,t[13]=f):f=t[13],f},mk={isMatch:e=>{if(e instanceof O){let{optionRegex:t}=UE.parse(e.description||``);return!!t}return!1},Component:({schema:e,form:t,path:n})=>{let{secretKeys:r,providerNames:i,refreshSecrets:a}=fk(),{openModal:o,closeModal:s}=Vt(),{label:c,description:l,placeholder:u,optionRegex:d=``,inputType:f}=UE.parse(e.description||``),p=f===`password`,{recommended:m,other:h}=ck(r,d);return(0,q.jsx)(hO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(vO,{children:[(0,q.jsx)(yO,{children:c}),(0,q.jsx)(xO,{children:l}),(0,q.jsx)(bO,{children:(0,q.jsx)(uk,{value:e.value?String(e.value):``,onChange:e.onChange,placeholder:u,secretsOnly:p,recommendedKeys:m,otherKeys:h,onCreateSecret:t=>{o((0,q.jsx)(Yt,{providerNames:i,initialValue:t,onSuccess:t=>{a(),e.onChange(Ht(t)),s()},onClose:s}))}})}),(0,q.jsx)(SO,{})]})})}},hk={isMatch:e=>{if(e instanceof O){let{special:t}=UE.parse(e.description||``);return t===`secret_textarea`}return!1},Component:({schema:e,form:t,path:n})=>{let{secretKeys:r,providerNames:i,refreshSecrets:a}=fk(),{openModal:o,closeModal:s}=Vt(),{label:c,description:l,placeholder:u}=UE.parse(e.description||``);return(0,q.jsx)(hO,{control:t.control,name:n,render:({field:e})=>{let t=e.value?String(e.value):``,n=Xt(t)?Wt(t):t;return(0,q.jsxs)(vO,{children:[(0,q.jsxs)(yO,{className:`flex items-center gap-1`,children:[c,(0,q.jsx)(bt,{content:`Enter a path to a file on disk, or create a secret to paste JSON directly.`,delayDuration:300,children:(0,q.jsx)(`button`,{type:`button`,className:`inline-flex`,"aria-label":`Credential input help`,children:(0,q.jsx)(Mo,{className:`h-3.5 w-3.5`})})})]}),(0,q.jsx)(xO,{children:l}),(0,q.jsx)(bO,{children:(0,q.jsx)(uk,{value:n,onChange:t=>{e.onChange(!t||Jt(t)||Xt(t)?t:Ut(t))},placeholder:u,searchPlaceholder:`Type a file path or paste JSON`,formatCustomValueLabel:e=>`Use "${e}" as a file path`,createSecretLabel:`Paste JSON credentials`,allowCustomValue:e=>!Gt(e),allowCreateSecret:e=>!e||Gt(e),recommendedKeys:[],otherKeys:r,onCreateSecret:t=>{o((0,q.jsx)(Yt,{providerNames:i,initialValue:t,multiline:!0,onSuccess:t=>{a(),e.onChange(Ht(t)),s()},onClose:s}))}})}),(0,q.jsx)(SO,{})]})}})}};function gk(e){return e.provider!==`env`}function _k(e){return e.name}function vk(e){return e.keys}async function yk(){let e=await Zt.request({}),t=Kt(e.secrets).filter(gk).map(_k);return{secretKeys:e.secrets.flatMap(vk).toSorted(),providerNames:t}}var bk=[mk,hk],xk=e=>{let t=(0,X.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,q.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 gap-4`,children:n}),t[0]=n,t[1]=r),r},Sk=e=>{let t=(0,X.c)(9),{name:n,color:r,icon:i,onSelect:a}=e,o;t[0]===r?o=t[1]:(o={backgroundColor:r},t[0]=r,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,q.jsx)(`span`,{className:`text-white font-medium text-lg`,children:n}),t[2]=n,t[3]=s);let c;return t[4]!==i||t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,q.jsxs)(`button`,{type:`button`,className:`py-3 flex flex-col items-center justify-center gap-1 transition-[scale,filter,box-shadow] hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid`,style:o,onClick:a,children:[i,s]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c},Ck=e=>{let t=(0,X.c)(25),{onBack:n,isValid:r,libraries:i,preferredLibrary:a,onLibraryChange:o,displayNames:s,libraryLabel:c}=e,l=c===void 0?`Preferred library`:c,u;t[0]===n?u=t[1]:(u=(0,q.jsx)(St,{type:`button`,variant:`outline`,onClick:n,children:`Back`}),t[0]=n,t[1]=u);let d=!r,f;t[2]===d?f=t[3]:(f=(0,q.jsx)(St,{type:`submit`,disabled:d,children:`Add`}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,q.jsx)(gt,{children:(0,q.jsx)(lt,{placeholder:`Select a library`})}),t[7]=m):m=t[7];let h;t[8]===l?h=t[9]:(h=(0,q.jsxs)(`div`,{className:`flex flex-col gap-1 items-end`,children:[m,(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l})]}),t[8]=l,t[9]=h);let g;if(t[10]!==s||t[11]!==i){let e;t[13]===s?e=t[14]:(e=e=>(0,q.jsx)(dt,{value:e,children:s[e]??e},e),t[13]=s,t[14]=e),g=i.map(e),t[10]=s,t[11]=i,t[12]=g}else g=t[12];let _;t[15]===g?_=t[16]:(_=(0,q.jsx)(pt,{children:(0,q.jsx)(ht,{children:g})}),t[15]=g,t[16]=_);let v;t[17]!==o||t[18]!==a||t[19]!==h||t[20]!==_?(v=(0,q.jsx)(`div`,{children:(0,q.jsxs)(_t,{value:a,onValueChange:o,children:[h,_]})}),t[17]=o,t[18]=a,t[19]=h,t[20]=_,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==p?(y=(0,q.jsxs)(`div`,{className:`flex gap-2 justify-between`,children:[p,v]}),t[22]=v,t[23]=p,t[24]=y):y=t[24],y};function wk(){let e=(0,X.c)(4),{createNewCell:t}=hN(),n=ik(),r=s(I),i;return e[0]!==r||e[1]!==t||e[2]!==n?(i=e=>{/\bmo\./.test(e)&&XO({autoInstantiate:r,createNewCell:t,fromCellId:n}),t({code:e,before:!1,cellId:n??`__end__`,skipIfCodeExists:!0})},e[0]=r,e[1]=t,e[2]=n,e[3]=i):i=e[3],i}function Tk(e){let t=(0,X.c)(3),n=wk(),r;return t[0]!==n||t[1]!==e?(r=t=>{n(t.code),e?.()},t[0]=n,t[1]=e,t[2]=r):r=t[2],r}var Ek=e=>{let t=(0,X.c)(30),{schema:n,libraries:r,preferredLibrary:i,displayNames:a,libraryLabel:o,generateCode:s,onSubmit:c,onBack:l}=e,u;t[0]===n?u=t[1]:(u=EO(n),t[0]=n,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=HE(n),t[2]=n,t[3]=f);let p;t[4]!==d||t[5]!==f?(p={defaultValues:d,resolver:f,reValidateMode:`onChange`},t[4]=d,t[5]=f,t[6]=p):p=t[6];let m=ME(p),[h,g]=K.useState(i),_=wk(),v;t[7]!==s||t[8]!==_||t[9]!==c||t[10]!==h?(v=e=>{_(s(e,h)),c()},t[7]=s,t[8]=_,t[9]=c,t[10]=h,t[11]=v):v=t[11];let y=v,b;t[12]!==m||t[13]!==y?(b=m.handleSubmit(y),t[12]=m,t[13]=y,t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,q.jsx)(pO,{}),t[15]=x):x=t[15];let S;t[16]!==m||t[17]!==n?(S=(0,q.jsx)(pk,{children:(0,q.jsx)(RO,{schema:n,form:m,renderers:bk,children:x})}),t[16]=m,t[17]=n,t[18]=S):S=t[18];let C;t[19]!==a||t[20]!==m.formState.isValid||t[21]!==r||t[22]!==o||t[23]!==l||t[24]!==h?(C=(0,q.jsx)(Ck,{onBack:l,isValid:m.formState.isValid,libraries:r,preferredLibrary:h,onLibraryChange:g,displayNames:a,libraryLabel:o}),t[19]=a,t[20]=m.formState.isValid,t[21]=r,t[22]=o,t[23]=l,t[24]=h,t[25]=C):C=t[25];let w;return t[26]!==b||t[27]!==S||t[28]!==C?(w=(0,q.jsxs)(`form`,{onSubmit:b,className:`space-y-4`,children:[S,C]}),t[26]=b,t[27]=S,t[28]=C,t[29]=w):w=t[29],w};function Dk(e,t){return!t||e.category===`object-storage`==(t===`storage`)}function Ok(e,t){let n=e.hidesWhen;return n.kind===`dialect`?n.substrings.some(e=>t.dialects.some(t=>t.includes(e))):n.protocols.some(e=>t.storageProtocols.has(e))?!0:n.backendTypes.some(e=>t.storageBackendTypes.has(e))}var kk=o(0),Ak,jk=0;function Mk(){let e=u.get(kk);return(!Ak||jk!==e)&&(jk=e,Ak=V().then(()=>NC.request({})).then(e=>e.sources).catch(t=>{throw jk===e&&(Ak=void 0),t})),Ak}function Nk(){Ak=void 0,u.set(kk,e=>e+1)}var Pk=new Qt(`storage-list-entries`,async(e,t)=>{await Hr().listStorageEntries({requestId:e,...t})}),Fk=new Qt(`storage-download`,async(e,t)=>{await Hr().downloadStorage({requestId:e,...t})});function Ik(e,t){return`${e}::${t??``}`}function Lk(e){return`${e}::`}function Rk(){return{namespaces:[],entriesByPath:new Map,pageMetadataByPath:new Map}}var{reducer:zk,createActions:Bk,valueAtom:Vk,useActions:Hk}=jr(Rk,{setNamespaces:(e,t)=>{let n=new Map(e.namespaces.map(e=>[e.name,e]));for(let e of t.namespaces)n.set(e.name,e);return{...e,namespaces:[...n.values()]}},setEntries:(e,t)=>{let n=Ik(t.namespace,t.prefix),r=new Map(e.entriesByPath),i=t.append&&r.has(n)?[...r.get(n)??[],...t.entries]:t.entries;r.set(n,i);let a=new Map(e.pageMetadataByPath);return a.set(n,{nextPageToken:t.nextPageToken??null}),{...e,entriesByPath:r,pageMetadataByPath:a}},clearNamespaceCache:(e,t)=>{let n=new Map(e.entriesByPath),r=new Map(e.pageMetadataByPath),i=Lk(t);for(let e of n.keys())e.startsWith(i)&&n.delete(e);for(let e of r.keys())e.startsWith(i)&&r.delete(e);return{...e,entriesByPath:n,pageMetadataByPath:r}},filterFromVariables:(e,t)=>{let n=new Set(t),r=e.namespaces.filter(e=>n.has(e.name));return{...e,namespaces:r}}}),Uk=()=>s(Vk),Wk=o(e=>e(Vk).namespaces);function Gk(){return Hk()}async function Kk({namespace:e,prefix:t,pageToken:n,append:r,setEntries:i}){let a=await Pk.request({namespace:e,prefix:t??``,limit:150,...n==null?{}:{pageToken:n}});if(a.error)throw Error(a.error);return i({namespace:e,prefix:t,entries:a.entries,nextPageToken:a.next_page_token,append:r}),a}function qk(e,t){let{entriesByPath:n,pageMetadataByPath:r}=Uk(),{setEntries:i}=Gk(),a=Ik(e,t),o=n.get(a),s=r.get(a)?.nextPageToken??null,c=(0,K.useRef)(!1),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(),{isPending:p,error:m,refetch:h}=fi(async()=>{o||await Kk({namespace:e,prefix:t,setEntries:i})},[e,t,o===void 0]),g=(0,K.useCallback)(async()=>{if(!(s==null||c.current)){c.current=!0,u(!0),f(void 0);try{await Kk({namespace:e,prefix:t,pageToken:s,append:!0,setEntries:i})}catch(e){f(e instanceof Error?e:Error(String(e)))}finally{c.current=!1,u(!1)}}},[e,t,s,i]);return{entries:o??[],isPending:p&&!o,error:o?void 0:m,hasMore:s!==null,loadMore:g,isLoadingMore:l,loadMoreError:d,refetch:h}}function Jk(){let e=(0,X.c)(2),{setEntries:t}=Gk(),n;return e[0]===t?n=e[1]:(n=e=>Kk({...e,setEntries:t}),e[0]=t,e[1]=n),n}function Yk(){let e=(0,X.c)(2),t=s(kk),n;return e[0]===t?n=e[1]:(n=[t],e[0]=t,e[1]=n),fi(Mk,n)}function Xk(e){let t=(0,X.c)(6),{data:n}=Yk(),r=s(hp),i=s(Wk),a;bb0:{if(!n){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],a=e;break bb0}let o;if(t[1]!==r||t[2]!==n||t[3]!==e||t[4]!==i){let a={dialects:[...r.values()].map($k),storageProtocols:new Set(i.map(Qk)),storageBackendTypes:new Set(i.map(Zk))};o=n.filter(t=>Dk(t,e)&&!Ok(t,a)),t[1]=r,t[2]=n,t[3]=e,t[4]=i,t[5]=o}else o=t[5];a=o}return a}function Zk(e){return e.backendType.toLowerCase()}function Qk(e){return e.protocol.toLowerCase()}function $k(e){return e.dialect.toLowerCase()}function eA(){let e=(0,X.c)(1),[,t]=(0,K.useState)(0),n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t(tA)},e[0]=n):n=e[0],n}function tA(e){return e+1}var nA=e=>{let t=(0,X.c)(6),n=Xk(`database`);if(n.length===0){let r;return t[0]!==n||t[1]!==e?(r=(0,q.jsx)(iA,{...e,detectedDataSources:n}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}let r;return t[3]!==n||t[4]!==e?(r=(0,q.jsx)(rA,{...e,detectedDataSources:n}),t[3]=n,t[4]=e,t[5]=r):r=t[5],r},rA=e=>{let t=(0,X.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({detectedDataSources:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=Tk(),a;return t[3]!==i||t[4]!==n||t[5]!==r?(a=(0,q.jsx)(iA,{...r,detectedDataSources:n,addDetectedDataSource:i}),t[3]=i,t[4]=n,t[5]=r,t[6]=a):a=t[6],a},iA=e=>{let t=(0,X.c)(42),{selectedEngine:n,onChange:r,cellId:i,detectedDataSources:a,addDetectedDataSource:o}=e,c=s(hp),l=[],u=[];for(let[e,t]of c.entries())zf.has(e)?l.push(t):u.push(t);let d=eA(),f;t[0]!==c||t[1]!==n?(f=n&&!c.has(n),t[0]=c,t[1]=n,t[2]=f):f=t[2];let p=f,m;t[3]!==o||t[4]!==c||t[5]!==a||t[6]!==r||t[7]!==d?(m=e=>{if(e===aA){window.open(sA,`_blank`);return}if(e.startsWith(oA)){let t=e.slice(oA.length),n=a.find(e=>e.id===t);n&&o&&o(n);return}let t=c.get(e);t&&(d(),r(t.name),_p(t.name))},t[3]=o,t[4]=c,t[5]=a,t[6]=r,t[7]=d,t[8]=m):m=t[8];let h=m,g=fA,_=_t,v;t[9]===i?v=t[10]:(v=Lw(i),t[9]=i,t[10]=v);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,q.jsx)(lt,{placeholder:`Select an engine`}),t[11]=y):y=t[11];let b;t[12]===v?b=t[13]:(b=(0,q.jsx)(lA,{...v,children:y}),t[12]=v,t[13]=b);let x=pt,S;t[14]===i?S=t[15]:(S=Lw(i),t[14]=i,t[15]=S);let C=ht,w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,q.jsx)(ct,{children:`Database connections`}),t[16]=w):w=t[16];let T;t[17]!==p||t[18]!==n?(T=p&&(0,q.jsx)(dt,{value:n,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1 opacity-50`,children:[(0,q.jsx)(wo,{className:`h-3 w-3`}),(0,q.jsx)(`span`,{className:`truncate`,children:Sp(n)})]})},n),t[17]=p,t[18]=n,t[19]=T):T=t[19];let E=g(u),D=u.length>0&&(0,q.jsx)(mt,{}),O=g(l),k;t[20]===a?k=t[21]:(k=a.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(mt,{}),(0,q.jsx)(ct,{children:`Detected in your environment`}),a.map(pA)]}),t[20]=a,t[21]=k);let A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,q.jsx)(mt,{}),t[22]=A):A=t[22];let j;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,q.jsx)(dt,{className:`text-muted-foreground`,value:aA,children:(0,q.jsxs)(`a`,{className:`flex items-center gap-1`,href:sA,target:`_blank`,rel:`noreferrer`,children:[(0,q.jsx)(It,{className:`h-3 w-3`}),(0,q.jsx)(`span`,{children:`How to add a database connection`})]})}),t[23]=j):j=t[23];let M;t[24]!==C||t[25]!==E||t[26]!==D||t[27]!==O||t[28]!==k||t[29]!==w||t[30]!==T?(M=(0,q.jsxs)(C,{children:[w,T,E,D,O,k,A,j]}),t[24]=C,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=w,t[30]=T,t[31]=M):M=t[31];let N;t[32]!==x||t[33]!==M||t[34]!==S?(N=(0,q.jsx)(x,{...S,children:M}),t[32]=x,t[33]=M,t[34]=S,t[35]=N):N=t[35];let P;return t[36]!==_||t[37]!==h||t[38]!==n||t[39]!==N||t[40]!==b?(P=(0,q.jsx)(`div`,{className:`flex flex-row gap-1 items-center`,children:(0,q.jsxs)(_,{value:n,onValueChange:h,children:[b,N]})}),t[36]=_,t[37]=h,t[38]=n,t[39]=N,t[40]=b,t[41]=P):P=t[41],P},aA=`__help__`,oA=`__detected_source__:`,sA=`http://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database`,cA=()=>{let e=(0,X.c)(16),{sqlMode:t,setSQLMode:n}=XC(),r;e[0]!==n||e[1]!==t?(r=()=>{let e=t===`validate`?`default`:`validate`;e==="default"&&VC(),n(e)},e[0]=n,e[1]=t,e[2]=r):r=e[2];let i=r,a=mA,o=hA,s;e[3]===t?s=e[4]:(s=o(t),e[3]=t,e[4]=s);let c;e[5]===t?c=e[6]:(c=a(t),e[5]=t,e[6]=c);let l=t===`validate`?`Validate`:`Default`,u;e[7]===l?u=e[8]:(u=(0,q.jsx)(`span`,{className:`ml-1`,children:l}),e[7]=l,e[8]=u);let d;e[9]!==i||e[10]!==c||e[11]!==u?(d=(0,q.jsxs)(St,{variant:`ghost`,size:`sm`,onClick:i,className:`h-5 px-1.5 text-xs border-border shadow-none hover:bg-accent`,children:[c,u]}),e[9]=i,e[10]=c,e[11]=u,e[12]=d):d=e[12];let f;return e[13]!==s||e[14]!==d?(f=(0,q.jsx)(`div`,{className:`flex flex-row gap-1 items-center`,children:(0,q.jsx)(bt,{delayDuration:300,content:s,children:d})}),e[13]=s,e[14]=d,e[15]=f):f=e[15],f},lA=e=>{let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,q.jsx)(gt,{className:`text-xs border-border shadow-none! ring-0! h-5 px-1.5 hover:bg-accent transition-colors`,...r,children:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i};function uA(e){return e.source!==`iceberg`}function dA(e){return(0,q.jsx)(dt,{value:e.name,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Jw,{className:`h-3 w-3`,name:e.dialect}),(0,q.jsx)(`span`,{className:`truncate ml-0.5`,children:Sp(e.display_name)})]})},e.name)}function fA(e){return e=e.filter(uA),e.map(dA)}function pA(e){return(0,q.jsx)(dt,{value:`${oA}${e.id}`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Ho,{className:`h-3 w-3 text-(--blue-9)`}),(0,q.jsxs)(`span`,{className:`truncate ml-0.5`,children:[`Add `,e.displayName,` connection`]})]})},e.id)}function mA(e){return e===`validate`?(0,q.jsx)(Vo,{className:`h-3 w-3`}):(0,q.jsx)(Rt,{className:`h-3 w-3`})}function hA(e){return e===`validate`?(0,q.jsxs)(`div`,{className:`text-xs`,children:[(0,q.jsxs)(`div`,{className:`font-semibold mb-1 flex flex-row items-center gap-1`,children:[(0,q.jsx)(Vo,{className:`h-3 w-3`}),`Validate Mode`]}),(0,q.jsx)(`p`,{children:`Queries are validated as you write them`})]}):(0,q.jsxs)(`div`,{className:`text-xs`,children:[(0,q.jsxs)(`div`,{className:`font-semibold mb-1 flex flex-row items-center gap-1`,children:[(0,q.jsx)(Rt,{className:`h-3 w-3`}),`Default Mode`]}),(0,q.jsx)(`p`,{children:`Standard editing`})]})}var gA=()=>{let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(`div`,{className:`h-4 border-r border-border`}),e[0]=t):t=e[0],t},_A=e=>{let t=(0,X.c)(102),{view:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={minWidth:50},t[0]=r):r=t[0];let{spanProps:i,inputProps:a}=jw(r),o;t[1]===n.state?o=t[2]:(o=n.state.field(bA),t[1]=n.state,t[2]=o);let s=o,c;t[3]===n.state?c=t[4]:(c=n.state.facet(Of),t[3]=n.state,t[4]=c);let l=c,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(`div`,{}),t[5]=u):u=t[5];let d=u,f=!1,p;t[6]===n?p=t[7]:(p=e=>{n.dispatch({effects:Oy.of(e),changes:{from:0,to:n.state.doc.length,insert:n.state.doc.toString()}})},t[6]=n,t[7]=p);let m=p;if(s instanceof nw){let e;t[8]===n.state?e=t[9]:(e=n.state.field(ky),t[8]=n.state,t[9]=e);let r=e;f=!0;let o;t[10]===m?o=t[11]:(o=e=>{let t=Dw(e.currentTarget.value,!1);e.currentTarget.value=t,m({dataframeName:t})},t[10]=m,t[11]=o);let s=o,c;t[12]!==m||t[13]!==n?(c=e=>{m({engine:e}),uw(n,e)},t[12]=m,t[13]=n,t[14]=c):c=t[14];let u=c,p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,q.jsx)(`span`,{className:`select-none`,children:`Output variable: `}),t[15]=p):p=t[15];let h;t[16]===a?h=t[17]:(h=e=>{a.onChange?.(e)},t[16]=a,t[17]=h);let g;t[18]===s?g=t[19]:(g=e=>{e.key===`Enter`&&e.shiftKey&&s(e)},t[18]=s,t[19]=g);let _;t[20]!==a||t[21]!==r.dataframeName||t[22]!==s||t[23]!==h||t[24]!==g?(_=(0,q.jsx)(`input`,{...a,defaultValue:r.dataframeName,onChange:h,onBlur:s,onKeyDown:g,className:`min-w-14 w-auto border border-border rounded px-1 focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring`}),t[20]=a,t[21]=r.dataframeName,t[22]=s,t[23]=h,t[24]=g,t[25]=_):_=t[25];let v;t[26]===i?v=t[27]:(v=(0,q.jsx)(`span`,{...i}),t[26]=i,t[27]=v);let y;t[28]!==_||t[29]!==v?(y=(0,q.jsxs)(`label`,{className:`flex gap-2 items-center`,children:[p,_,v]}),t[28]=_,t[29]=v,t[30]=y):y=t[30];let b;t[31]!==l||t[32]!==r.engine||t[33]!==u?(b=(0,q.jsx)(nA,{selectedEngine:r.engine,onChange:u,cellId:l}),t[31]=l,t[32]=r.engine,t[33]=u,t[34]=b):b=t[34];let x;t[35]===r.engine?x=t[36]:(x=r.engine===`__marimo_duckdb`&&(0,q.jsx)(cA,{}),t[35]=r.engine,t[36]=x);let S;t[37]!==r.engine||t[38]!==n?(S=async()=>{await um(n,r.engine)},t[37]=r.engine,t[38]=n,t[39]=S):S=t[39];let C;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,q.jsx)(Ro,{className:`h-3 w-3`}),t[40]=C):C=t[40];let w;t[41]===S?w=t[42]:(w=(0,q.jsx)(bt,{content:`Format SQL`,children:(0,q.jsx)(St,{"aria-label":`Format SQL`,variant:`text`,size:`icon`,onClick:S,children:C})}),t[41]=S,t[42]=w);let T;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(gA,{}),t[43]=T):T=t[43];let E;t[44]===m?E=t[45]:(E=e=>{m({showOutput:!e.target.checked})},t[44]=m,t[45]=E);let D=!r.showOutput,O;t[46]!==E||t[47]!==D?(O=(0,q.jsx)(`input`,{type:`checkbox`,onChange:E,checked:D}),t[46]=E,t[47]=D,t[48]=O):O=t[48];let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,q.jsx)(`span`,{className:`select-none`,children:`Hide output`}),t[49]=k):k=t[49];let A;t[50]===O?A=t[51]:(A=(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[O,k]}),t[50]=O,t[51]=A);let j;t[52]!==x||t[53]!==w||t[54]!==A?(j=(0,q.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[x,w,T,A]}),t[52]=x,t[53]=w,t[54]=A,t[55]=j):j=t[55];let M;t[56]!==y||t[57]!==b||t[58]!==j?(M=(0,q.jsxs)(`div`,{className:`flex flex-1 gap-2 items-center`,children:[y,b,j]}),t[56]=y,t[57]=b,t[58]=j,t[59]=M):M=t[59],d=M}if(s instanceof Ay){f=!0;let e,r,i,a,o,s,c,l,u,p;if(t[60]!==m||t[61]!==n.state){let{quotePrefix:d}=n.state.field(ky);r=d,r===void 0&&(r=`r`,m({quotePrefix:r})),p=(e,t)=>{if(typeof t!=`boolean`)return;let n=Mw({currentQuotePrefix:r,checked:t,prefix:e});m({quotePrefix:n})},a=`flex flex-row w-full justify-end gap-1.5 items-center`,u=`flex items-center gap-1.5`,t[72]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`span`,{children:`r`}),t[72]=i):i=t[72],e=Tw,s=`Toggle raw string`,c=`w-3 h-3`,l=r.includes(`r`),o=e=>{p(`r`,e)},t[60]=m,t[61]=n.state,t[62]=e,t[63]=r,t[64]=i,t[65]=a,t[66]=o,t[67]=s,t[68]=c,t[69]=l,t[70]=u,t[71]=p}else e=t[62],r=t[63],i=t[64],a=t[65],o=t[66],s=t[67],c=t[68],l=t[69],u=t[70],p=t[71];let h;t[73]!==e||t[74]!==o||t[75]!==s||t[76]!==c||t[77]!==l?(h=(0,q.jsx)(e,{"aria-label":s,className:c,checked:l,onCheckedChange:o}),t[73]=e,t[74]=o,t[75]=s,t[76]=c,t[77]=l,t[78]=h):h=t[78];let g;t[79]!==i||t[80]!==h||t[81]!==u?(g=(0,q.jsxs)(`div`,{className:u,children:[i,h]}),t[79]=i,t[80]=h,t[81]=u,t[82]=g):g=t[82];let _;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsx)(`span`,{children:`f`}),t[83]=_):_=t[83];let v;t[84]===r?v=t[85]:(v=r.includes(`f`),t[84]=r,t[85]=v);let y;t[86]===p?y=t[87]:(y=e=>{p(`f`,e)},t[86]=p,t[87]=y);let b;t[88]!==v||t[89]!==y?(b=(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[_,(0,q.jsx)(Tw,{"aria-label":`Toggle f-string`,className:`w-3 h-3`,checked:v,onCheckedChange:y})]}),t[88]=v,t[89]=y,t[90]=b):b=t[90];let x;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,q.jsx)(bt,{content:(0,q.jsx)(Nw,{}),children:(0,q.jsx)(Mo,{className:`w-3 h-3`})}),t[91]=x):x=t[91];let S;t[92]!==a||t[93]!==g||t[94]!==b?(S=(0,q.jsxs)(`div`,{className:a,children:[g,b,x]}),t[92]=a,t[93]=g,t[94]=b,t[95]=S):S=t[95],d=S}let h;t[96]===f?h=t[97]:(h=f&&(0,q.jsx)(gA,{}),t[96]=f,t[97]=h);let g;return t[98]!==d||t[99]!==s.type||t[100]!==h?(g=(0,q.jsx)(yt,{children:(0,q.jsxs)(`div`,{className:`flex justify-between items-center gap-4 pl-2 pt-2`,children:[d,h,s.type]})}),t[98]=d,t[99]=s.type,t[100]=h,t[101]=g):g=t[101],g},vA=new On,yA=Cn.define(),bA=cn.define({create(){return Cw.python},update(e,t){for(let e of t.effects)if(e.is(yA))return e.value;return e},provide:e=>Sn.from(e,e=>e.type===`python`?null:e=>fm(e,_A))});function xA(){let e=ww(),t=(n,r)=>{let i=e[r%e.length];return i.isSupported(n)?i:t(n,r+1)};return[pn.of([{key:`F4`,preventDefault:!0,run:n=>{let r=n.state.field(bA),i=e.findIndex(e=>e.type===r.type),a=n.state.doc.toString(),o=t(a,i+1);return r!==o&&(SA({view:n,nextLanguage:o,opts:{keepCodeAsIs:!1}}),!0)}}])]}function SA({view:e,nextLanguage:t,opts:n}){let r=e.state.field(bA),i=e.state.doc.toString(),a=e.state.facet(ef),o=e.state.facet(tf),s=e.state.facet(nf),c=e.state.facet(rf),l=e.state.facet(af),u=e.state.field(ky),d=e.state.selection.main.head,f;if(n.keepCodeAsIs)f=i,r.type!==t.type&&(u={...t.defaultMetadata});else{let[e,n]=r.transformOut(i,u),[a,o,s]=t.transformIn(e);d+=n,d-=o,d=Er(d,0,a.length),f=a,u=s}e.dispatch({effects:[yA.of(t),Dy.of(u),vA.reconfigure(t.getExtension({cellId:c,completionConfig:a,hotkeys:o,placeholderType:s,lspConfig:l})),sf.reconfigure([]),sm.of(!0)],changes:n.keepCodeAsIs?void 0:{from:0,to:e.state.doc.length,insert:f},selection:n.keepCodeAsIs?void 0:An.cursor(d)}),e.dispatch({effects:[sf.reconfigure([sr()])]}),t.type===`sql`&&dw(e)}function CA(e){let{placeholderType:t,completionConfig:n,hotkeys:r,cellId:i,lspConfig:a}=e;return[xA(),vA.of(Cw.python.getExtension({cellId:i,completionConfig:n,hotkeys:r,placeholderType:t,lspConfig:a})),bA,ky]}function wA(e){return TA(OA({state:e}).trim())}function TA(e){return e?Cw.markdown.isSupported(e)?Cw.markdown:Cw.sql.isSupported(e)?Cw.sql:Cw.python:Cw.python}function EA(e,t){e.state.field(bA).type!==t.language&&SA({view:e,nextLanguage:Cw[t.language],opts:{keepCodeAsIs:t.keepCodeAsIs??!1}})}function DA(e,{completionConfig:t,hotkeysProvider:n,lspConfig:r}){let i=e.state.field(bA),a=e.state.facet(nf),o=e.state.facet(rf);return o===void 0&&R.error(`Cell ID is undefined in reconfigureLanguageEffect`),a===void 0&&R.error(`Placeholder type is undefined in reconfigureLanguageEffect`),t===void 0&&R.error(`Completion config is undefined in reconfigureLanguageEffect`),vA.reconfigure(i.getExtension({cellId:o,completionConfig:t,hotkeys:n,placeholderType:a,lspConfig:r}))}function OA(e,t,n){let r=e.state.field(bA),i=e.state.field(ky),a=e.state.doc.toString();return t===void 0?r.transformOut(a,i)[0]:r.transformOut(a.slice(t,n),i)[0]}function kA(e,t){let n=e.state.field(bA),r=TA(t);r.type!==n.type&&EA(e,{language:r.type,keepCodeAsIs:!0});let[i]=e.state.field(bA).transformIn(t);return Qd(e,i),i}function AA(e){let t=e.state.selection.main.head,n=e.state.doc.toString(),r=n.length>0&&n[t-1]===`
112
+ `,e}eq(e){return this.isCurrent===e.isCurrent&&this.isValid===e.isValid&&this.isFocused===e.isFocused&&this.config===e.config}};function OC(e,t){let n=Nn.empty;if(t.whenHide?.(e))return n;let r=e.state.field(TC,!1);if(!r)return n;let{currentStatement:i,allStatements:a,isFocused:o}=r;try{let r=e.state.doc.lineAt(e.viewport.from).number,s=e.state.doc.lineAt(e.viewport.to).number;for(let c of a){if(c.lineTo<r||c.lineFrom>s)continue;let a=i?.from===c.from&&i?.to===c.to;if(!c.isValid&&t.showInvalid===!1)continue;let l=new DC(t,a,c.isValid,o),u=Math.max(c.lineFrom,r),d=Math.min(c.lineTo,s);for(let t=u;t<=d;t++)try{if(t<1||t>e.state.doc.lines)continue;let r=e.state.doc.line(t);n=n.update({add:[l.range(r.from)]})}catch(e){console.warn(`SqlGutter: Invalid line number`,t,e)}}}catch(e){console.warn(`SqlGutter: Error creating markers`,e)}return n}async function kC(e,t){let{state:n}=e,r=n.selection.main.head,i=await t.analyzeDocument(n),a={currentStatement:await t.getStatementAtPosition(n,r),allStatements:i,cursorPosition:r,isFocused:e.hasFocus};e.dispatch({effects:wC.of(a)})}function AC(e){return Zn.define(t=>(kC(t,e),{update(t){!t.docChanged&&!t.selectionSet&&!t.focusChanged||kC(t.view,e)}}))}function jC(e){let t=e.width||3;return Jn.baseTheme({".cm-sql-gutter":{width:`${t}px`,minWidth:`${t}px`},".cm-sql-gutter .cm-gutterElement":{width:`${t}px`,padding:`0`,margin:`0`},".cm-sql-gutter-marker":{width:`100%`,height:`100%`,display:`block`},".cm-lineNumbers .cm-gutterElement":{paddingLeft:`8px`,paddingRight:`8px`}})}function MC(e){return $n({class:`cm-sql-gutter ${e.className||``}`,markers:t=>OC(t,e)})}function NC(e={}){return[TC,AC(new Gx(e.parser||new vx)),jC(e),MC(e)]}function PC(e={}){let t=[],{schema:n,enableLinting:r=!0,enableSemanticLinting:i=!0,enableGutterMarkers:a=!0,enableHover:o=!0,enableNavigation:s=!0,linterConfig:c,semanticLinterConfig:l,gutterConfig:u,hoverConfig:d,navigationConfig:f}=e;if(n!=null&&t.push(dx.of(n)),r&&t.push(ES(c)),i){let e=l?.parser??c?.parser,n=l?.structureAnalyzer??(l?.parser==null?c?.structureAnalyzer:void 0);t.push(CC({...l,parser:e,structureAnalyzer:n}))}if(a&&t.push(NC(u)),o&&(t.push(AS(d)),t.push(d?.theme??RS())),s){let e=f?.parser??c?.parser,n=f?.structureAnalyzer??(f?.parser==null?c?.structureAnalyzer:void 0);t.push(...rC({...f,parser:e,structureAnalyzer:n}))}return t}var FC=class e{delegate;toKey;cache;static jsonStringifySortKeys(){return e=>typeof e!=`object`||!e?String(e):JSON.stringify(e,Object.keys(e).toSorted(),2)}constructor(t,n={}){this.delegate=t,this.toKey=n.toKey??e.jsonStringifySortKeys();let r=n.maxSize??128;this.cache=new Cp(r)}request(e){let t=this.toKey(e),n=this.cache.get(t);if(n!==void 0)return n;let r=this.delegate.request(e);return this.cache.set(t,r),r.catch(e=>{throw this.cache.delete(t),e})}resolve(e,t){this.delegate.resolve(e,t)}reject(e,t){this.delegate.reject(e,t)}},IC=new Qt(`data-source-discovery-result`,async e=>{await Hr().discoverDataSources({requestId:e})}),LC=new Qt(`sql-table-preview`,async(e,t)=>{await Hr().previewSQLTable({requestId:e,...t})}),RC=new Qt(`sql-schema-list-preview`,async(e,t)=>{await Hr().previewSQLSchemaList({requestId:e,...t})}),zC=new Qt(`sql-table-list-preview`,async(e,t)=>{await Hr().previewSQLTableList({requestId:e,...t})}),BC=new FC(new Qt(`validate-sql`,async(e,t)=>{await Hr().validateSQL({requestId:e,...t})}),{maxSize:3}),VC=o(new Map),HC=e=>{let t=(0,X.c)(3),n=s(VC),r;return t[0]!==e||t[1]!==n?(r=n.get(e),t[0]=e,t[1]=n,t[2]=r):r=t[2],r};function UC(e){let t=u.get(VC),n=new Map(t);n.delete(e),u.set(VC,n)}function WC(){u.set(VC,new Map)}function GC({cellId:e,errorMessage:t,dialect:n}){let r=u.get(VC),i=new Map(r),a=n===`DuckDB`?KC(t):qC(t);i.set(e,a),u.set(VC,i)}function KC(e){let{errorType:t,errorMessage:n}=qC(e),r=n,i,a=n.indexOf(`LINE `);return a!==-1&&(i=n.slice(Math.max(0,a)).trim(),r=n.slice(0,Math.max(0,a)).trim()),{errorType:t,errorMessage:r,codeblock:i}}function qC(e){return{errorType:e.split(`:`)[0].trim(),errorMessage:e.split(`:`).slice(1).join(`:`).trim()}}function JC(e){return e.field(My)}function YC(){return e=>{let t=JC(e.state).engine,n=lm.getCompletionSource(t);return n&&Gr(n)(e)||null}}function XC(){return e=>{let t=JC(e.state).engine,n=lm.getDialect(t);return e.matchBefore(/\.\w*/)?null:ei(n,!0,(e,t)=>({label:e,type:t,info:async()=>{let t=(await ZC())[e.toLocaleLowerCase()];if(!t)return null;let n=document.createElement(`div`);return n.innerHTML=LS.keyword({keyword:e,info:t}),n}}))(e)}}var ZC=Or(async()=>{let e=await W(()=>import(`./common-keywords-FICkW4yv.js`),[],import.meta.url),t=await W(()=>import(`./duckdb-keywords-iJc26n2t.js`),[],import.meta.url);return{...e.default.keywords,...t.default.keywords}}),QC=ve(`marimo:notebook-sql-mode`,`default`,Ih);function $C(){let e=(0,X.c)(3),[t,n]=a(QC),r;return e[0]!==n||e[1]!==t?(r={sqlMode:t,setSQLMode:n},e[0]=n,e[1]=t,e[2]=r):r=e[2],r}function ew(){return u.get(QC)}var tw=Mf,nw=`DuckDB`,rw=new On;function iw(){let{latestEngineSelected:e,connectionsMap:t}=u.get(gp);return e===null?[...t.values()].reverse().find(e=>!zf.has(e.name)&&e.source!==`iceberg`)?.name??`__marimo_duckdb`:e}var aw=class{parser=new th;type=`sql`;sqlModeEnabled;constructor(){this.sqlModeEnabled=!0}get defaultMetadata(){return{...this.parser.defaultMetadata,engine:iw()||`__marimo_duckdb`}}get defaultCode(){let e=iw();return e&&e!==`__marimo_duckdb`?`_df = mo.sql(f"""SELECT * FROM """, engine=${e})`:this.parser.defaultCode}static fromQuery=e=>th.fromQuery(e);transformIn(e){this.parser.defaultMetadata.engine=iw()||`__marimo_duckdb`;let t=this.parser.transformIn(e),n=t.metadata;return n.engine&&n.engine!==`__marimo_duckdb`&&bp(n.engine),[t.code,t.offset,n]}transformOut(e,t){let n=this.parser.transformOut(e,t);return[n.code,n.offset]}isSupported(e){return this.parser.isSupported(e)}getExtension({lspConfig:e}){let t=ow(),n=[rw.of(Kr({dialect:tw})),pn.of([{key:`Tab`,run:e=>Pr(e)||nr(e),preventDefault:!0}]),Lr({defaultKeymap:!1,activateOnTyping:!0,override:[YC(),xy,XC(),t.cteCompletionSource,t.aliasCompletionSource,t.columnCompletionSource]})];if(e?.diagnostics?.sql_linter??!1){let e=u.get(di),r=new uw({getParserOptions:e=>({database:vw(e)??nw})});n.push(PC({schema:gw,enableLinting:!0,linterConfig:{delay:250,parser:r,perStatement:!1},enableSemanticLinting:!0,semanticLinterConfig:{parser:t.parser,structureAnalyzer:t.structureAnalyzer,severity:{unknownTable:`off`,unknownColumn:`warning`,ambiguousColumn:`warning`}},enableGutterMarkers:!0,gutterConfig:{backgroundColor:`#3b82f6`,errorBackgroundColor:`#ef4444`,hideWhenNotFocused:!0,parser:r},hoverConfig:{hoverTime:300,enableKeywords:!0,enableTables:!0,enableColumns:!0,parser:t.parser,contextAnalyzer:t.contextAnalyzer,theme:RS(e)},enableNavigation:!0,navigationConfig:{contextAnalyzer:t.contextAnalyzer,keymap:!1,parser:t.parser,structureAnalyzer:t.structureAnalyzer}}),Jn.updateListener.of(e=>{e.focusChanged&&r.setFocusState(e.view.hasFocus)}))}return this.sqlModeEnabled&&n.push(xw()),n}};function ow(){let e=new vx({getParserOptions:e=>({database:sw(e)})}),t=new cw(e),n=new lw(e);return{parser:e,contextAnalyzer:t,structureAnalyzer:n,cteCompletionSource:xS({parser:e,contextAnalyzer:t,structureAnalyzer:n}),aliasCompletionSource:Kx({schema:gw,parser:e,contextAnalyzer:t}),columnCompletionSource:Xx({schema:gw,parser:e,contextAnalyzer:t})}}function sw(e){return vw(e)??nw}var cw=class extends Wx{analyzers=new Map;analysisParser;constructor(e){super(e),this.analysisParser=e}getContext(e,t){return this.getAnalyzer(t.state).getContext(e,t)}clearCache(){for(let e of this.analyzers.values())e.clearCache()}getAnalyzer(e){let t=sw(e),n=this.analyzers.get(t);return n||(n=new Wx(this.analysisParser),this.analyzers.set(t,n)),n}},lw=class extends Gx{analyzers=new Map;analysisParser;constructor(e){super(e),this.analysisParser=e}analyzeDocument(e){return this.getAnalyzer(e).analyzeDocument(e)}getStatementAtPosition(e,t){return this.getAnalyzer(e).getStatementAtPosition(e,t)}getStatementsInRange(e,t,n){return this.getAnalyzer(e).getStatementsInRange(e,t,n)}clearCache(){for(let e of this.analyzers.values())e.clearCache()}getAnalyzer(e){let t=sw(e),n=this.analyzers.get(t);return n||(n=new Gx(this.analysisParser),this.analyzers.set(t,n)),n}},uw=class extends vx{validationTimeout=null;pendingValidationResolve=null;VALIDATION_DELAY_MS=300;isFocused=!1;setFocusState(e){this.isFocused=e}resolvePendingValidation(e){this.pendingValidationResolve?.(e),this.pendingValidationResolve=null}async validateWithDelay(e,t,n){return this.validationTimeout&&(window.clearTimeout(this.validationTimeout),this.resolvePendingValidation([])),new Promise(r=>{this.pendingValidationResolve=r,this.validationTimeout=window.setTimeout(async()=>{if(this.validationTimeout=null,!this.isFocused){this.resolvePendingValidation([]);return}try{let r=await Sw(e,t,n,zf.has(t)?ew():`default`);if(r.error){R.error(`Failed to validate SQL`,{error:r.error}),this.resolvePendingValidation([]);return}this.resolvePendingValidation(r.parse_result?.errors??[])}catch(e){R.error(`Failed to validate SQL`,{error:e}),this.resolvePendingValidation([])}},this.VALIDATION_DELAY_MS)})}async validateSql(e,t){let n=hw(t.state),r=yw(n.engine);return this.isFocused?dw(n.engine,r)?this.validateWithDelay(e,n.engine,r??nw):super.validateSql(e,t):[]}async parse(e,t){let n=hw(t.state).engine;return dw(n,yw(n))?{success:!0,errors:[]}:super.parse(e,t)}};function dw(e,t){return e===`__marimo_duckdb`||t===`DuckDB`}function fw(e,t){e.dispatch({effects:rw.reconfigure(Kr({dialect:t}))})}function pw(e,t){fw(e,lm.getDialect(t))}function mw(e){let t=hw(e.state).engine;fw(e,lm.getDialect(t))}function hw(e){return e.field(My)}function gw(e){let t=hw(e.state).engine,n=lm.getCompletionSource(t);if(!n?.schema)return{};let r=n.schema;if(!_w(r))return r;let i=n.defaultSchema,a=i?r[i]:void 0;return a&&!Array.isArray(a)&&typeof a==`object`&&`children`in a&&_w(a.children)?{...r,...Object.fromEntries(Object.entries(a.children).filter(([e])=>!Object.hasOwn(r,e)))}:r}function _w(e){if(Array.isArray(e))return!1;if(!(`self`in e)||!(`children`in e))return!0;let t=e.self;return!(typeof t==`object`&&t&&!Array.isArray(t)&&`label`in t&&typeof t.label==`string`)}function vw(e){let t=hw(e).engine;return yw(t)}function yw(e){let t=lm.getInternalDialect(e)?.toLowerCase();if(!t||!Pf(t))return null;switch(t){case`postgresql`:case`postgres`:return`PostgreSQL`;case`db2`:case`db2i`:return`DB2`;case`mysql`:return`MySQL`;case`sqlite`:return`Sqlite`;case`mssql`:case`sqlserver`:case`microsoft sql server`:return`TransactSQL`;case`duckdb`:return`DuckDB`;case`mariadb`:return`MariaDB`;case`cassandra`:return`Noql`;case`athena`:case`awsathena`:return`Athena`;case`bigquery`:return`BigQuery`;case`hive`:return`Hive`;case`redshift`:return`Redshift`;case`snowflake`:return`Snowflake`;case`flink`:return`FlinkSQL`;case`mongodb`:case`noql`:return`Noql`;case`oracle`:case`oracledb`:case`timescaledb`:case`couchbase`:case`trino`:case`tidb`:case`singlestoredb`:case`spark`:case`databricks`:case`datafusion`:case`dremio`:return R.debug(`Unsupported dialect`,{dialect:t}),null;default:return zr(t),null}}var bw=300;function xw(){return Zn.define(e=>{let t,n=null,r=e.state.facet(Of);return{update(e){if(!e.docChanged)return;let i=ew();if(i==="default")return;let a=hw(e.state).engine;if(!zf.has(a))return;let o=e.state.doc.toString();t&&window.clearTimeout(t),t=window.setTimeout(async()=>{if(n!==o){if(n=o,o===``){UC(r);return}try{let e=yw(a),t=(await Sw(o,a,e,i)).validate_result;t?.error_message?GC({cellId:r,errorMessage:t.error_message,dialect:e}):UC(r)}catch(e){R.error(`Failed to validate SQL`,{error:e})}}},bw)},destroy(){t&&window.clearTimeout(t),UC(r)}}})}async function Sw(e,t,n,r){let i=await BC.request({onlyParse:r==="default",engine:t,dialect:n,query:e});if(i.error)throw Error(i.error);return i}var Cw=Or(()=>new Xb),ww=Or(()=>new Ny),Tw=Or(()=>new aw),Ew={get python(){return Cw()},get markdown(){return ww()},get sql(){return Tw()}};function Dw(){return Object.values(Ew)}var Ow=K.forwardRef((e,t)=>{let n=(0,X.c)(13),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=H(`flex items-center justify-center text-current max-h-[14px] overflow-hidden`),n[5]=o):o=n[5];let s;n[6]===i.checked?s=n[7]:(s=(0,q.jsx)(ia,{className:o,children:i.checked===`indeterminate`?(0,q.jsx)(J,{className:`h-4 w-4`}):(0,q.jsx)(Nt,{className:`h-4 w-4`})}),n[6]=i.checked,n[7]=s);let c;return n[8]!==i||n[9]!==t||n[10]!==a||n[11]!==s?(c=(0,q.jsx)(na,{ref:t,className:a,...i,children:s}),n[8]=i,n[9]=t,n[10]=a,n[11]=s,n[12]=c):c=n[12],c});Ow.displayName=na.displayName;var kw=new Set(`__*.marimo.app.False.None.True.__peg_parser__.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield.None.setup`.split(`.`));function Aw(e,t=!0){return e=e.trim(),e?(/^\d/.test(e)&&(e=`_${e}`),e=e.replaceAll(/\W/g,`_`),t?e.toLowerCase():e):`_`}function jw(e,t){let n=new Set(t),r=e,i=e=>!n.has(e)&&!kw.has(e);if(i(e))return e;let a=1;for(;!i(r);)r=`${e}_${a}`,a++;return r}function Mw(e,t){return Nw(e)?`cell-${t}`:e}function Nw(e){return!e||e===`_`||e===`__`}function Pw(e){let t=(0,X.c)(15),{minWidth:n,padding:r}=e,i=n===void 0?70:n,a=r===void 0?15:r,[o,s]=(0,K.useState)(50),c=(0,K.useRef)(null),l=(0,K.useRef)(null),u;t[0]===a?u=t[1]:(u=e=>{if(l.current&&c.current){let t=l.current;t.style.fontSize=window.getComputedStyle(c.current).fontSize,t.style.fontFamily=window.getComputedStyle(c.current).fontFamily,t.textContent=e;let n=t.offsetWidth;s(n+a)}},t[0]=a,t[1]=u);let d=u,f;t[2]===d?f=t[3]:(f=()=>{d(c.current?.value??``)},t[2]=d,t[3]=f),Mt(f);let p;t[4]===d?p=t[5]:(p=e=>{d(e.target.value)},t[4]=d,t[5]=p);let m=`${o}px`,h=`${i}px`,g;t[6]!==m||t[7]!==h?(g={width:m,minWidth:h},t[6]=m,t[7]=h,t[8]=g):g=t[8];let _;t[9]!==p||t[10]!==g?(_={ref:c,type:`text`,onChange:p,style:g},t[9]=p,t[10]=g,t[11]=_):_=t[11];let v=_,y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y={ref:l,style:{visibility:`hidden`,position:`absolute`,whiteSpace:`pre`}},t[12]=y):y=t[12];let b=y,x;return t[13]===v?x=t[14]:(x={inputProps:v,spanProps:b},t[13]=v,t[14]=x),x}function Fw({currentQuotePrefix:e,checked:t,prefix:n}){let r=e;return t?e===``?r=n:e!==`rf`&&n!==e&&(r=`rf`):e===n?r=``:e===`rf`&&(r=n===`r`?`f`:`r`),r}var Iw=()=>{let e=(0,X.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsxs)(`section`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsxs)(`header`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`code`,{className:`text-xs px-1 py-0.5 bg-(--slate-2) rounded`,children:`r`}),(0,q.jsx)(`span`,{className:`font-semibold`,children:`Raw String`})]}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Write LaTeX without escaping special characters`}),(0,q.jsx)(`pre`,{className:`text-xs bg-(--slate-2) p-2 rounded`,children:`\\alpha \\beta`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,q.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[t,(0,q.jsxs)(`section`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsxs)(`header`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(`code`,{className:`text-xs px-1 py-0.5 bg-(--slate-2) rounded`,children:`f`}),(0,q.jsx)(`span`,{className:`font-semibold`,children:`Format String`})]}),(0,q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Interpolate Python values`}),(0,q.jsxs)(`pre`,{className:`text-xs bg-(--slate-2) p-2 rounded`,children:[`Hello `,`{name}`,`! 😁`]})]})]}),e[1]=n):n=e[1],n},Lw=`data-cell-id`;function Rw(e){return{[Lw]:e}}var zw=`data-for-cell-id`;function Bw(e){return{[zw]:e}}var Vw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClickHouse%3c/title%3e%3cpath%20d='M21.333%2010H24v4h-2.667ZM16%201.335h2.667v21.33H16Zm-5.333%200h2.666v21.33h-2.666ZM0%2022.665V1.335h2.667v21.33zm5.333-21.33H8v21.33H5.333Z'/%3e%3c/svg%3e`,Hw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDatabricks%3c/title%3e%3cpath%20d='M.95%2014.184L12%2020.403l9.919-5.55v2.21L12%2022.662l-10.484-5.96-.565.308v.77L12%2024l11.05-6.218v-4.317l-.515-.309L12%2019.118l-9.867-5.653v-2.21L12%2016.805l11.05-6.218V6.32l-.515-.308L12%2011.974%202.647%206.681%2012%201.388l7.76%204.368.668-.411v-.566L12%200%20.95%206.27v.72L12%2013.207l9.919-5.55v2.26L12%2015.52%201.516%209.56l-.565.308Z'/%3e%3c/svg%3e`,Uw=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAGcElEQVR4nNxZa2wcVxU+99557M6+vLazj6xjO6+maWVTl0YpLU1DU9KARNqooQhFVYJUqUWgiocqIVRESPlRoEhIqYoqgSiCItqQPkAEKUWQtlGSJtAY00R5mTjZTfze94x3HvdedMdZnKgS6s7O2kk/a7R3xvY933fOd874yhhucCyYAIWA9IOH2r+35/HUnjU96sBC8fAERQLpj0+mXjdeXM6rzy/no88uK6zolHu97EX8p/f/IWHAv38i9bsH+kIPo/ozhAJBgpR9J419je437xb62Zc7n/tcf+gRsebADYQAxLW2N/ApL/vNq4AdA7Ht2/piT4q15fAp1wEYAGEALYA18TzT1TXQ09O75qPuKbWS8NW4Lan27/pM4gWrBIgFnaIDvKZIpPPKt+nlgpMTi0q5PKqoqvZR950XAREZaz/fmHmFOFijwGHkDDu5PKGs1SlQ5gAAQ+S9U9Y/xM+Wy+WxRvaeFwE770z+OBNQbmYWwPlp63BPh3q7XQaCxAi50gP7Tldf87J3ywVszEQ2bumOf5WZAAajeWoDJjYOMM5BCECEw9miefxwduaol/1b2sQdCon/8BOZX3ETYWYiODFhvrNUC6ylFgJqzl27DxV+xD3GaGkFnl6deS4G8mJqAmRrtaGkoqxiJnazPpt9gPNVa3DvqfKrXmO0rAJ3RSLrHojHd4jMMwvBSMn+d1pSVrv37oXdz50Hx79JOXgtQGsqIAEiT8V7djtVzEiQ4w+K+t9uCmn3uNmX5rL/l8ullw5c1g80E6slFXgkuuixJVKw3y5jxEzExnV7pB3k7rr3hZDBiZl3njk+9u1mY/legSgm0cfiXbtcTziYHJmovNEXC99PZzAV41KMzaLtXGBVmaQltWfCdPLNxPNdwFdii58KYykhXM2AO5MGvTSAgw9aLnUx8zlomCxTKdeHdP14s/F8tdAiIie2RpPfAPcPNYAjRumNOwLRLZwL2rPgHAGnCF6aHPuJ5869Cr5WYFs0/S0ZkTDns9SK1BltI/JicYcEcXAX8L5R+vOblanf+hHTNwFtWGr7QiT9BAPklnWoVt5/qxrZILQI7wvyjHPrjKkfeL0y9QID76Pzavhmoa3RzNdkLMcYEKCA4aJtncjIgVs4oFnbCCGASDtRVrw3Uz7sV1xfBKiAlc2RJV+vkz9vWYMZWesTa1ER5vYEgot27YPvjJ/dXGBOwY+44JeAdaHkQxpRU9QVQGDIrPz1FjV+f/3eFcaRFcdKosicsh8x6/ClBzaEu7YLoqJNDUonVKR0UCTuRT9w9wshpAzb+qmcY2b9iFlH0xVow0r81sCiz9azfdCY3rNWSzw8a5/ZZ2ItPv9UmfiFP7Tn0HQFPhlMbuKIyOKkhThjNc4rBCtRJl5jrvO5W4mSY+beMib/4A/tOTQtYCCY2kTdszmHE7X8/tWBTtf7s7S528IYELxcuviMycWZzF80baHVgdT6/00fu3oso7Tdwa5Ypt7Aw5Zx7M1K7pf+UL4WTVWgQwqnQ5LWLexTpfblEFaT7Jrsc3GMLDw7+a9tFDj1j/YcmqpAWkn06yhERaYP6ZdeHtC6tl6deYPx4q7xY5+/YFfP+kf5WniqQELp6J6hNaNdia8s4TCojkmrjOYVHGin7qsLQdYqvb976uijk455yX/ac/AkYNLKZx9Nb/kNQkAsLJNBW9+/Uk3eJzI/ZlUG36qcfv6MXf3nmtjtO/ZO/v27/tOeA/L6iyu0pfdu7/riATF93s0fffq+toGdM5zmJ+ziuRgJpWSEgy/mXlk/Zk2f8ZfytfDcxOeM828XHH04TAIJjOTgDAlIiPNEmgQTw9Xh146UBn/aavLgVUAmkLk5IkdXFh09l62NHloaWblZjFGMONjMrsTUjqV5qzjuP90Pw9MUmrKms/2x276U0pbcO2Hlh9qUzj6GMJiclk/q5/b+Ovfqg+P29LD/dD+MhnsgSMLhnlDvPQVrOrcmfufjF2cuvI0BqVlj5GDBKmQZsJbMe9+BAZP1yU3fF+tloVV3LzSfhtEbXrWhO7Ri3ULz8PwmzoRXfTqr/+ddf+k0Dk8CEGBMOWccmC8H82bgSUAmfNO6S/q5Bc8+eBUQDXWtz1VP36gCMC4xnfPrZFw2/I9uLZi6u2aXs7ZdGWkNpcbQcAU0LX2XYYxeF/YBLwIYs0twndjnY4H/BgAA//95CrBYRwImwgAAAABJRU5ErkJggg==`,Ww=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eDuckDB%3c/title%3e%3cpath%20d='M12%200C5.363%200%200%205.363%200%2012s5.363%2012%2012%2012%2012-5.363%2012-12S18.637%200%2012%200zM9.502%207.03a4.974%204.974%200%200%201%204.97%204.97%204.974%204.974%200%200%201-4.97%204.97A4.974%204.974%200%200%201%204.532%2012a4.974%204.974%200%200%201%204.97-4.97zm6.563%203.183h2.351c.98%200%201.787.782%201.787%201.762s-.807%201.789-1.787%201.789h-2.351v-3.551z'/%3e%3c/svg%3e`,Gw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGoogle%20BigQuery%3c/title%3e%3cpath%20d='M5.676%2010.595h2.052v5.244a5.892%205.892%200%200%201-2.052-2.088v-3.156zm18.179%2010.836a.504.504%200%200%201%200%20.708l-1.716%201.716a.504.504%200%200%201-.708%200l-4.248-4.248a.206.206%200%200%201-.007-.007c-.02-.02-.028-.045-.043-.066a10.736%2010.736%200%200%201-6.334%202.065C4.835%2021.599%200%2016.764%200%2010.799S4.835%200%2010.8%200s10.799%204.835%2010.799%2010.8c0%202.369-.772%204.553-2.066%206.333.025.017.052.028.074.05l4.248%204.248zm-5.028-10.632a8.015%208.015%200%201%200-8.028%208.028h.024a8.016%208.016%200%200%200%208.004-8.028zm-4.86%204.98a6.002%206.002%200%200%200%202.04-2.184v-1.764h-2.04v3.948zm-4.5.948c.442.057.887.08%201.332.072.4.025.8.025%201.2%200V7.692H9.468v9.035z'/%3e%3c/svg%3e`,Kw=new URL(`iceberg-COKYXo-A.png`,import.meta.url).href,qw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eMotherDuck%3c/title%3e%3cg%20transform='scale(0.85)%20translate(0,%202)'%3e%3cpath%20fill='%23ff9538'%20d='M1.71%2015.86s7.45%205.32%207.89%205.59c.44.27%201.08.33%201.64.11.56-.22.98-.71%201.11-1.21s1.85-9.49%201.85-9.49c.02-.12.07-.48-.13-.83-.27-.47-.86-.71-1.38-.57-.42.12-.64.44-.7.55-.09.17-.26.45-.57.7-.24.19-.47.3-.58.34-.96.38-2.02.06-2.61-.72-.38-.48-1.04-.67-1.64-.43-.6.24-.94.84-.89%201.45.11.98-.44%201.94-1.4%202.32-.51.21-1.06.21-1.54.05-.12-.03-.51-.12-.89.09-.48.26-.74.84-.61%201.37.09.39.38.62.48.69z'%20/%3e%3cpath%20fill='%23ff9538'%20d='M14.12%204.21s2.65%208.76%202.83%209.24c.19.48.66.92%201.23%201.09.58.16%201.21.03%201.62-.28.41-.31%207.25-6.39%207.25-6.39.09-.08.35-.34.4-.74.07-.53-.25-1.09-.75-1.29-.4-.16-.78-.04-.89%200-.18.08-.48.2-.88.2-.3.01-.55-.05-.67-.08-.99-.28-1.64-1.18-1.63-2.16-.01-.61-.42-1.17-1.04-1.35-.62-.18-1.26.09-1.59.6-.51.84-1.53%201.27-2.52.99-.53-.15-.96-.48-1.25-.91-.07-.09-.33-.4-.76-.48-.54-.09-1.1.22-1.32.71-.16.37-.08.72-.04.84z'%20/%3e%3c/g%3e%3c/svg%3e`,Jw=`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eMySQL%3c/title%3e%3cpath%20d='M16.405%205.501c-.115%200-.193.014-.274.033v.013h.014c.054.104.146.18.214.273.054.107.1.214.154.32l.014-.015c.094-.066.14-.172.14-.333-.04-.047-.046-.094-.08-.14-.04-.067-.126-.1-.18-.153zM5.77%2018.695h-.927a50.854%2050.854%200%2000-.27-4.41h-.008l-1.41%204.41H2.45l-1.4-4.41h-.01a72.892%2072.892%200%2000-.195%204.41H0c.055-1.966.192-3.81.41-5.53h1.15l1.335%204.064h.008l1.347-4.064h1.095c.242%202.015.384%203.86.428%205.53zm4.017-4.08c-.378%202.045-.876%203.533-1.492%204.46-.482.716-1.01%201.073-1.583%201.073-.153%200-.34-.046-.566-.138v-.494c.11.017.24.026.386.026.268%200%20.483-.075.647-.222.197-.18.295-.382.295-.605%200-.155-.077-.47-.23-.944L6.23%2014.615h.91l.727%202.36c.164.536.233.91.205%201.123.4-1.064.678-2.227.835-3.483zm12.325%204.08h-2.63v-5.53h.885v4.85h1.745zm-3.32.135l-1.016-.5c.09-.076.177-.158.255-.25.433-.506.648-1.258.648-2.253%200-1.83-.718-2.746-2.155-2.746-.704%200-1.254.232-1.65.697-.43.508-.646%201.256-.646%202.245%200%20.972.19%201.686.574%202.14.35.41.877.615%201.583.615.264%200%20.506-.033.725-.098l1.325.772.36-.622zM15.5%2017.588c-.225-.36-.337-.94-.337-1.736%200-1.393.424-2.09%201.27-2.09.443%200%20.77.167.977.5.224.362.336.936.336%201.723%200%201.404-.424%202.108-1.27%202.108-.445%200-.77-.167-.978-.5zm-1.658-.425c0%20.47-.172.856-.516%201.156-.344.3-.803.45-1.384.45-.543%200-1.064-.172-1.573-.515l.237-.476c.438.22.833.328%201.19.328.332%200%20.593-.073.783-.22a.754.754%200%2000.3-.615c0-.33-.23-.61-.648-.845-.388-.213-1.163-.657-1.163-.657-.422-.307-.632-.636-.632-1.177%200-.45.157-.81.47-1.085.315-.278.72-.415%201.22-.415.512%200%20.98.136%201.4.41l-.213.476a2.726%202.726%200%2000-1.064-.23c-.283%200-.502.068-.654.206a.685.685%200%2000-.248.524c0%20.328.234.61.666.85.393.215%201.187.67%201.187.67.433.305.648.63.648%201.168zm9.382-5.852c-.535-.014-.95.04-1.297.188-.1.04-.26.04-.274.167.055.053.063.14.11.214.08.134.218.313.346.407.14.11.28.216.427.31.26.16.555.255.81.416.145.094.293.213.44.313.073.05.12.14.214.172v-.02c-.046-.06-.06-.147-.105-.214-.067-.067-.134-.127-.2-.193a3.223%203.223%200%2000-.695-.675c-.214-.146-.682-.35-.77-.595l-.013-.014c.146-.013.32-.066.46-.106.227-.06.435-.047.67-.106.106-.027.213-.06.32-.094v-.06c-.12-.12-.21-.283-.334-.395a8.867%208.867%200%2000-1.104-.823c-.21-.134-.476-.22-.697-.334-.08-.04-.214-.06-.26-.127-.12-.146-.19-.34-.275-.514a17.69%2017.69%200%2001-.547-1.163c-.12-.262-.193-.523-.34-.763-.69-1.137-1.437-1.826-2.586-2.5-.247-.14-.543-.2-.856-.274-.167-.008-.334-.02-.5-.027-.11-.047-.216-.174-.31-.235-.38-.24-1.364-.76-1.644-.072-.18.434.267.862.422%201.082.115.153.26.328.34.5.047.116.06.235.107.356.106.294.207.622.347.897.073.14.153.287.247.413.054.073.146.107.167.227-.094.136-.1.334-.154.5-.24.757-.146%201.693.194%202.25.107.166.362.534.703.393.3-.12.234-.5.32-.835.02-.08.007-.133.048-.187v.015c.094.188.188.367.274.555.206.328.566.668.867.895.16.12.287.328.487.402v-.02h-.015c-.043-.058-.1-.086-.154-.133a3.445%203.445%200%2001-.35-.4%208.76%208.76%200%2001-.747-1.218c-.11-.21-.202-.436-.29-.643-.04-.08-.04-.2-.107-.24-.1.146-.247.273-.32.453-.127.288-.14.642-.188%201.01-.027.007-.014%200-.027.014-.214-.052-.287-.274-.367-.46-.2-.475-.233-1.238-.06-1.785.047-.14.247-.582.167-.716-.042-.127-.174-.2-.247-.303a2.478%202.478%200%2001-.24-.427c-.16-.374-.24-.788-.414-1.162-.08-.173-.22-.354-.334-.513-.127-.18-.267-.307-.368-.52-.033-.073-.08-.194-.027-.274.014-.054.042-.075.094-.09.088-.072.335.022.422.062.247.1.455.194.662.334.094.066.195.193.315.226h.14c.214.047.455.014.655.073.355.114.675.28.962.46a5.953%205.953%200%20012.085%202.286c.08.154.115.295.188.455.14.33.313.663.455.982.14.315.275.636.476.897.1.14.502.213.682.286.133.06.34.115.46.188.23.14.454.3.67.454.11.076.443.243.463.378z'/%3e%3c/svg%3e`,Yw=new URL(`postgresql-q8VEBKGg.svg`,import.meta.url).href,Xw={sqlite:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSQLite%3c/title%3e%3cpath%20d='M21.678.521c-1.032-.92-2.28-.55-3.513.544a8.71%208.71%200%200%200-.547.535c-2.109%202.237-4.066%206.38-4.674%209.544.237.48.422%201.093.544%201.561a13.044%2013.044%200%200%201%20.164.703s-.019-.071-.096-.296l-.05-.146a1.689%201.689%200%200%200-.033-.08c-.138-.32-.518-.995-.686-1.289-.143.423-.27.818-.376%201.176.484.884.778%202.4.778%202.4s-.025-.099-.147-.442c-.107-.303-.644-1.244-.772-1.464-.217.804-.304%201.346-.226%201.478.152.256.296.698.422%201.186.286%201.1.485%202.44.485%202.44l.017.224a22.41%2022.41%200%200%200%20.056%202.748c.095%201.146.273%202.13.5%202.657l.155-.084c-.334-1.038-.47-2.399-.41-3.967.09-2.398.642-5.29%201.661-8.304%201.723-4.55%204.113-8.201%206.3-9.945-1.993%201.8-4.692%207.63-5.5%209.788-.904%202.416-1.545%204.684-1.931%206.857.666-2.037%202.821-2.912%202.821-2.912s1.057-1.304%202.292-3.166c-.74.169-1.955.458-2.362.629-.6.251-.762.337-.762.337s1.945-1.184%203.613-1.72C21.695%207.9%2024.195%202.767%2021.678.521m-18.573.543A1.842%201.842%200%200%200%201.27%202.9v16.608a1.84%201.84%200%200%200%201.835%201.834h9.418a22.953%2022.953%200%200%201-.052-2.707c-.006-.062-.011-.141-.016-.2a27.01%2027.01%200%200%200-.473-2.378c-.121-.47-.275-.898-.369-1.057-.116-.197-.098-.31-.097-.432%200-.12.015-.245.037-.386a9.98%209.98%200%200%201%20.234-1.045l.217-.028c-.017-.035-.014-.065-.031-.097l-.041-.381a32.8%2032.8%200%200%201%20.382-1.194l.2-.019c-.008-.016-.01-.038-.018-.053l-.043-.316c.63-3.28%202.587-7.443%204.8-9.791.066-.069.133-.128.198-.194Z'/%3e%3c/svg%3e`,duckdb:Ww,motherduck:qw,postgres:Yw,postgresql:Yw,mysql:Jw,snowflake:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSnowflake%3c/title%3e%3cpath%20d='M24%203.459c0%20.646-.418%201.18-1.141%201.18-.723%200-1.142-.534-1.142-1.18%200-.647.419-1.18%201.142-1.18.723%200%201.141.533%201.141%201.18zm-.228%200c0-.533-.38-.951-.913-.951s-.913.38-.913.95c0%20.533.38.952.913.952.57%200%20.913-.419.913-.951zm-1.37-.533h.495c.266%200%20.456.152.456.38%200%20.153-.076.229-.19.305l.19.266v.038h-.266l-.19-.266h-.229v.266h-.266zm.495.228h-.229v.267h.229c.114%200%20.152-.038.152-.114.038-.077-.038-.153-.152-.153zM7.602%2012.4c.038-.151.076-.304.076-.456%200-.114-.038-.228-.038-.342-.114-.343-.304-.647-.646-.838l-4.87-2.777c-.685-.38-1.56-.152-1.94.533-.381.685-.153%201.56.532%201.94l2.701%201.56-2.701%201.56c-.685.38-.913%201.256-.533%201.94.38.685%201.256.914%201.94.533l4.832-2.777c.343-.267.571-.533.647-.876zm1.332%202.626c-.266-.038-.57.038-.837.19l-4.832%202.777c-.685.38-.913%201.256-.532%201.94.38.686%201.255.914%201.94.533l2.701-1.56v3.12c0%20.8.647%201.408%201.446%201.408.799%200%201.407-.647%201.407-1.408v-5.592c0-.761-.57-1.37-1.293-1.408zm4.946-6.088c.266.038.57-.038.837-.19l4.832-2.777c.685-.38.913-1.256.532-1.94-.38-.686-1.255-.914-1.94-.533l-2.701%201.56V1.975c0-.799-.647-1.408-1.446-1.408-.799%200-1.446.609-1.446%201.408V7.53c0%20.76.609%201.37%201.332%201.407zM3.265%205.97l4.832%202.777c.266.152.533.19.837.19.723-.038%201.331-.684%201.331-1.407V1.975c0-.799-.646-1.408-1.407-1.408-.799%200-1.446.647-1.446%201.408v3.12l-2.701-1.56c-.685-.38-1.56-.152-1.94.533-.419.646-.19%201.521.494%201.902zm9.093%206.011a.412.412%200%2000-.114-.266l-.57-.571a.346.346%200%2000-.267-.114.412.412%200%2000-.266.114l-.571.57a.411.411%200%2000-.114.267c0%20.076.038.19.114.267l.57.57a.345.345%200%2000.267.114c.076%200%20.19-.038.266-.114l.571-.57a.412.412%200%2000.114-.267zm1.598.533L11.94%2014.53c-.039.038-.153.114-.229.114h-.608a.411.411%200%2001-.267-.114L8.82%2012.514a.408.408%200%2001-.076-.229v-.608c0-.076.038-.19.114-.267l2.016-2.016a.41.41%200%2001.267-.114h.608a.41.41%200%2001.267.114l2.016%202.016a.347.347%200%2001.114.267v.608c-.076.077-.114.19-.19.229zm5.593%205.44l-4.832-2.777c-.266-.152-.57-.19-.837-.152-.723.038-1.332.684-1.332%201.408v5.554c0%20.8.647%201.408%201.408%201.408.799%200%201.446-.647%201.446-1.408v-3.12l2.7%201.56c.686.38%201.561.152%201.941-.533.419-.646.19-1.521-.494-1.94zm2.549-7.533l-2.701%201.56%202.7%201.56c.686.38.914%201.256.533%201.94-.38.685-1.255.913-1.94.533l-4.832-2.778a1.644%201.644%200%2001-.647-.798c-.037-.153-.076-.305-.076-.457%200-.114.039-.228.039-.342.114-.343.342-.647.646-.837l4.832-2.778c.685-.38%201.56-.152%201.94.533.457.609.19%201.484-.494%201.864'/%3e%3c/svg%3e`,databricks:Hw,clickhouse:Vw,timeplus:`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3c!--%20Generated%20by%20Pixelmator%20Pro%203.6.17%20--%3e%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Option2SymbolB'%3e%3cg%20id='Layer1-2'%3e%3cg%20id='Group'%20opacity='0.4'%3e%3cpath%20id='Path'%20fill='%23d53c97'%20stroke='none'%20d='M%2017.016802%2012.188573%20C%2017.016802%209.607646%2015.86018%207.293022%2014.039526%205.731081%20C%2013.942595%205.70038%2013.844628%205.671406%2013.745972%205.645189%20C%2013.131133%205.809095%2012.54265%206.059378%2011.998103%206.388559%20C%2013.964327%207.575191%2015.281006%209.730104%2015.281006%2012.188573%20C%2015.279476%2014.563734%2014.033739%2016.764488%2011.998103%2017.988243%20C%2012.542634%2018.317537%2013.131119%2018.567936%2013.745972%2018.731958%20C%2013.844628%2018.705742%2013.942595%2018.67642%2014.039526%2018.645721%20C%2015.86018%2017.084126%2017.016802%2014.769501%2017.016802%2012.188573%20Z'/%3e%3cpath%20id='path1'%20fill='%23d53c97'%20stroke='none'%20d='M%2013.897406%205.609659%20L%2013.894991%205.60759%20C%2013.844973%205.619663%2013.7953%205.631737%2013.745972%205.645189%20C%2013.79599%205.631737%2013.847043%205.622078%2013.897406%205.609659%20Z'/%3e%3cpath%20id='path2'%20fill='%23d53c97'%20stroke='none'%20d='M%201.735796%2012.188573%20C%201.735796%209.164728%203.728925%206.59622%206.470945%205.729357%20C%207.554634%204.797861%208.856011%204.155121%2010.254373%203.860756%20C%209.680216%203.740549%209.095179%203.679977%208.508574%203.68%20C%203.816888%203.68%20-0%207.496887%20-0%2012.188573%20C%20-0%2016.880259%203.816888%2020.697147%208.508574%2020.697147%20C%209.0952%2020.697229%209.680255%2020.636539%2010.254373%2020.516048%20C%208.855971%2020.221794%207.554568%2019.579041%206.470945%2018.647446%20C%203.728925%2017.780582%201.735796%2015.213453%201.735796%2012.188573%20Z'/%3e%3cpath%20id='path3'%20fill='%23d53c97'%20stroke='none'%20d='M%2013.745972%2018.731958%20C%2013.7953%2018.745068%2013.844973%2018.757484%2013.894991%2018.769558%20C%2013.894991%2018.769558%2013.896715%2018.769558%2013.897406%2018.767488%20C%2013.847043%2018.754379%2013.79599%2018.745411%2013.745972%2018.731958%20Z'/%3e%3c/g%3e%3cpath%20id='path4'%20fill='%23ff3b65'%20stroke='none'%20d='M%2020.508402%2012.188573%20C%2020.508402%209.606611%2019.351088%207.290262%2017.5294%205.729357%20C%2016.301817%205.342468%2014.989366%205.313629%2013.745972%205.646223%20C%2016.636665%206.418224%2018.772606%209.058484%2018.772606%2012.189609%20C%2018.772606%2015.320732%2016.636665%2017.960991%2013.745972%2018.731958%20C%2014.98947%2019.064316%2016.301983%2019.034998%2017.5294%2018.647446%20C%2019.419907%2017.034296%2020.508638%2014.673781%2020.508402%2012.188573%20Z'/%3e%3cpath%20id='path5'%20fill='%23ff3b65'%20stroke='none'%20d='M%209.962543%2018.647446%20C%207.220525%2017.780582%205.227395%2015.213453%205.227395%2012.188573%20C%205.227395%209.163693%207.220525%206.59622%209.962543%205.729357%20C%2011.046233%204.797861%2012.34761%204.155121%2013.745972%203.860756%20C%2013.171818%203.74053%2012.586779%203.679956%2012.000173%203.68%20C%207.308832%203.68%203.491599%207.496887%203.491599%2012.188573%20C%203.491599%2016.880259%207.308487%2020.697147%2012.000173%2020.697147%20C%2012.586799%2020.697247%2013.171857%2020.636557%2013.745972%2020.516048%20C%2012.34757%2020.221794%2011.046167%2019.579041%209.962543%2018.647446%20Z'/%3e%3cpath%20id='path6'%20fill='%23383838'%20stroke='none'%20d='M%2015.491772%203.68%20C%2010.800431%203.68%206.983198%207.496887%206.983198%2012.188573%20C%206.983198%2016.880259%2010.800086%2020.697147%2015.491772%2020.697147%20C%2020.183456%2020.697147%2024%2016.880259%2024%2012.188573%20C%2024%207.496887%2020.183456%203.68%2015.491772%203.68%20Z%20M%2022.264549%2012.188573%20C%2022.264549%2015.923018%2019.226215%2018.961351%2015.491772%2018.961351%20C%2011.757326%2018.961351%208.718994%2015.923018%208.718994%2012.188573%20C%208.718994%208.454128%2011.757326%205.415796%2015.491772%205.415796%20C%2019.226215%205.415796%2022.264549%208.454128%2022.264549%2012.188573%20Z'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e`,bigquery:Gw,trino:new URL(`trino-DFsJbQoT.svg`,import.meta.url).href,iceberg:Kw,datafusion:Uw,pyspark:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eApache%20Spark%3c/title%3e%3cpath%20d='M10.812%200c-.425.013-.845.215-1.196.605a3.593%203.593%200%2000-.493.722c-.355.667-.425%201.415-.556%202.143a551.9%20551.9%200%2000-.726%204.087c-.027.16-.096.227-.244.273C5.83%208.386%204.06%208.94%202.3%209.514c-.387.125-.773.289-1.114.506-1.042.665-1.196%201.753-.415%202.71.346.422.79.715%201.284.936%201.1.49%202.202.976%203.3%201.47.019.01.036.013.053.019h-.004l1.306.535c0%20.023.002.045%200%20.073-.2%202.03-.39%204.063-.58%206.095-.04.419-.012.831.134%201.23.317.87%201.065%201.148%201.881.701.372-.204.666-.497.937-.818%201.372-1.623%202.746-3.244%204.113-4.872.111-.133.205-.15.363-.098.349.117.697.231%201.045.347h.001c.02.012.045.02.073.03l.142.042c1.248.416%202.68.775%203.929%201.19.4.132.622.164%201.045.098.311-.048.592-.062.828-.236.602-.33.995-.957.988-1.682-.005-.427-.154-.813-.35-1.186-.82-1.556-1.637-3.113-2.461-4.666-.078-.148-.076-.243.037-.375%201.381-1.615%202.756-3.236%204.133-4.855.272-.32.513-.658.653-1.058.308-.878-.09-1.57-1-1.741a2.783%202.783%200%2000-1.235.069c-1.974.521-3.947%201.041-5.918%201.57-.175.047-.26.015-.355-.144a353.08%20353.08%200%2000-2.421-4.018%204.61%204.61%200%2000-.652-.849c-.371-.37-.802-.549-1.227-.536zm.172%203.703a.592.592%200%2001.189.211c.87%201.446%201.742%202.89%202.609%204.338.07.118.135.16.277.121%201.525-.41%203.052-.813%204.579-1.217.367-.098.735-.193%201.103-.289a.399.399%200%2001-.1.2c-1.259%201.48-2.516%202.962-3.779%204.438-.11.13-.12.22-.04.37.937%201.803%201.768%203.309%202.498%204.76l-3.696-1.019c-.538-.18-1.077-.358-1.615-.539-.163-.055-.25-.03-.36.1-1.248%201.488-2.504%202.97-3.759%204.454a.398.398%200%2001-.18.132c.035-.378.068-.757.104-1.136.149-1.572.297-3.144.451-4.716-.03-.318.117-.405-.322-.545-1.493-.593-3.346-1.321-4.816-1.905a.595.595%200%2001.24-.134c1.797-.57%203.595-1.14%205.394-1.705.127-.04.199-.092.211-.233.013-.148.05-.294.076-.441.241-1.363.483-2.726.726-4.088.068-.386.14-.771.21-1.157z'/%3e%3c/svg%3e`,redshift:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAmazon%20Redshift%3c/title%3e%3cpath%20d='M16.639%209.932a.822.822%200%200%201-.822-.82.823.823%200%200%201%201.645%200c0%20.452-.37.82-.823.82m-2.086%204.994a.823.823%200%200%201-.822-.822.822.822%200%200%201%201.645%200%20.822.822%200%200%201-.823.822m-5.004-.833a.822.822%200%201%201%20.002-1.644.822.822%200%200%201-.002%201.644m-2.083%204.578a.823.823%200%200%201-.823-.82.823.823%200%200%201%201.645%200c0%20.452-.37.82-.822.82m9.173-11.236a1.68%201.68%200%200%200-1.68%201.676c0%20.566.285%201.066.718%201.37l-.782%201.982a1.674%201.674%200%200%200-1.923%201.104l-1.753-.398a1.675%201.675%200%200%200-3.348.103c0%20.432.169.823.438%201.12l-.764%201.79c-.028-.001-.053-.008-.08-.008a1.68%201.68%200%200%200-1.68%201.676%201.68%201.68%200%200%200%203.36%200c0-.593-.312-1.112-.778-1.41l.674-1.579c.161.052.33.088.508.088.661%200%201.228-.386%201.502-.94l1.856.42a1.68%201.68%200%200%200%203.327-.325c0-.5-.224-.943-.574-1.25l.822-2.083c.053.005.104.016.157.016a1.68%201.68%200%200%200%201.68-1.676%201.68%201.68%200%200%200-1.68-1.676M12%2023.145c-4.17%200-7.286-1.252-7.286-2.37V4.79C6.14%205.938%209.131%206.547%2012%206.547c2.869%200%205.86-.609%207.286-1.756v15.983c0%201.12-3.116%202.37-7.286%202.37M12%20.856c4.293%200%207.286%201.274%207.286%202.419%200%201.143-2.993%202.418-7.286%202.418-4.293%200-7.286-1.275-7.286-2.418C4.714%202.129%207.707.855%2012%20.855m8.143%202.419C20.143%201.147%2015.947%200%2012%200%208.052%200%203.857%201.147%203.857%203.274l.002.01h-.002v17.49C3.857%2022.87%208.052%2024%2012%2024c3.947%200%208.143-1.13%208.143-3.226V3.284h-.002l.002-.01'/%3e%3c/svg%3e`,supabase:`data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eSupabase%3c/title%3e%3cpath%20d='M11.9%201.036c-.015-.986-1.26-1.41-1.874-.637L.764%2012.05C-.33%2013.427.65%2015.455%202.409%2015.455h9.579l.113%207.51c.014.985%201.259%201.408%201.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z'/%3e%3c/svg%3e`},Zw=e=>{let t=(0,X.c)(11),{name:n,className:r}=e,i=Xw[n.toLowerCase()];if(!i){let e;t[0]===r?e=t[1]:(e=H(`mt-0.5`,r),t[0]=r,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,q.jsx)(Tt,{className:e}),t[2]=e,t[3]=n),n}let a;t[4]!==r||t[5]!==i?(a=H(`invert-[.5] dark:invert-[.7]`,r,i.endsWith(`.png`)&&`brightness-100 dark:brightness-100 invert-0 dark:invert-0`),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==n||t[8]!==a||t[9]!==i?(o=(0,q.jsx)(`img`,{src:i,alt:n,className:a}),t[7]=n,t[8]=a,t[9]=i,t[10]=o):o=t[10],o},Qw=e=>e.type===`checkbox`,$w=e=>e instanceof Date,eT=e=>e==null,tT=e=>typeof e==`object`,nT=e=>!eT(e)&&!Array.isArray(e)&&tT(e)&&!$w(e),rT=e=>nT(e)&&e.target?Qw(e.target)?e.target.checked:e.target.value:e,iT=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,aT=(e,t)=>e.has(iT(t)),oT=e=>{let t=e.constructor&&e.constructor.prototype;return nT(t)&&t.hasOwnProperty(`isPrototypeOf`)},sT=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function cT(e){let t,n=Array.isArray(e),r=typeof FileList<`u`&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(sT&&(e instanceof Blob||r))&&(n||nT(e))){if(t=n?[]:{},!n&&!oT(e))t=e;else for(let n in e)e.hasOwnProperty(n)&&(t[n]=cT(e[n]))}else return e;return t}var lT=e=>Array.isArray(e)?e.filter(Boolean):[],uT=e=>e===void 0,$=(e,t,n)=>{if(!t||!nT(e))return n;let r=lT(t.split(/[,[\].]+?/)).reduce((e,t)=>eT(e)?e:e[t],e);return uT(r)||r===e?uT(e[t])?n:e[t]:r},dT=e=>typeof e==`boolean`,fT=e=>/^\w*$/.test(e),pT=e=>lT(e.replace(/["|']|\]/g,``).split(/\.|\[/)),mT=(e,t,n)=>{let r=-1,i=fT(t)?[t]:pT(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=nT(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`||t===`constructor`||t===`prototype`)return;e[t]=a,e=e[t]}return e},hT={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},gT={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},_T={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},vT=K.createContext(null),yT=()=>K.useContext(vT),bT=e=>{let{children:t,...n}=e;return K.createElement(vT.Provider,{value:n},t)},xT=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==gT.all&&(t._proxyFormState[i]=!r||gT.all),n&&(n[i]=!0),e[i]}});return i},ST=e=>nT(e)&&!Object.keys(e).length,CT=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return ST(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||gT.all))},wT=e=>Array.isArray(e)?e:[e],TT=(e,t,n)=>!e||!t||e===t||wT(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e)));function ET(e){let t=K.useRef(e);t.current=e,K.useEffect(()=>{let n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function DT(e){let t=yT(),{control:n=t.control,disabled:r,name:i,exact:a}=e||{},[o,s]=K.useState(n._formState),c=K.useRef(!0),l=K.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=K.useRef(i);return u.current=i,ET({disabled:r,next:e=>c.current&&TT(u.current,e.name,a)&&CT(e,l.current,n._updateFormState)&&s({...n._formState,...e}),subject:n._subjects.state}),K.useEffect(()=>(c.current=!0,l.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),K.useMemo(()=>xT(o,n,l.current,!1),[o,n])}var OT=e=>typeof e==`string`,kT=(e,t,n,r,i)=>OT(e)?(r&&t.watch.add(e),$(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),$(n,e))):(r&&(t.watchAll=!0),n);function AT(e){let t=yT(),{control:n=t.control,name:r,defaultValue:i,disabled:a,exact:o}=e||{},s=K.useRef(r);s.current=r,ET({disabled:a,subject:n._subjects.values,next:e=>{TT(s.current,e.name,o)&&l(cT(kT(s.current,n._names,e.values||n._formValues,!1,i)))}});let[c,l]=K.useState(n._getWatch(r,i));return K.useEffect(()=>n._removeUnmounted()),c}function jT(e){let t=yT(),{name:n,disabled:r,control:i=t.control,shouldUnregister:a}=e,o=aT(i._names.array,n),s=AT({control:i,name:n,defaultValue:$(i._formValues,n,$(i._defaultValues,n,e.defaultValue)),exact:!0}),c=DT({control:i,name:n,exact:!0}),l=K.useRef(i.register(n,{...e.rules,value:s,...dT(e.disabled)?{disabled:e.disabled}:{}})),u=K.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!$(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!$(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!$(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!$(c.validatingFields,n)},error:{enumerable:!0,get:()=>$(c.errors,n)}}),[c,n]),d=K.useMemo(()=>({name:n,value:s,...dT(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:e=>l.current.onChange({target:{value:rT(e),name:n},type:hT.CHANGE}),onBlur:()=>l.current.onBlur({target:{value:$(i._formValues,n),name:n},type:hT.BLUR}),ref:e=>{let t=$(i._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}}),[n,i._formValues,r,c.disabled,s,i._fields]);return K.useEffect(()=>{let e=i._options.shouldUnregister||a,t=(e,t)=>{let n=$(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=cT($(i._options.defaultValues,n));mT(i._defaultValues,n,e),uT($(i._formValues,n))&&mT(i._formValues,n,e)}return!o&&i.register(n),()=>{(o?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,o,a]),K.useEffect(()=>{i._updateDisabledField({disabled:r,fields:i._fields,name:n})},[r,n,i]),K.useMemo(()=>({field:d,formState:c,fieldState:u}),[d,c,u])}var MT=e=>e.render(jT(e)),NT=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},PT=()=>{let e=typeof performance>`u`?Date.now():performance.now()*1e3;return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(Math.random()*16+e)%16|0;return(t==`x`?n:n&3|8).toString(16)})},FT=(e,t,n={})=>n.shouldFocus||uT(n.shouldFocus)?n.focusName||`${e}.${uT(n.focusIndex)?t:n.focusIndex}.`:``,IT=e=>({isOnSubmit:!e||e===gT.onSubmit,isOnBlur:e===gT.onBlur,isOnChange:e===gT.onChange,isOnAll:e===gT.all,isOnTouch:e===gT.onTouched}),LT=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),RT=(e,t,n,r)=>{for(let i of n||Object.keys(e)){let n=$(e,i);if(n){let{_f:e,...a}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(RT(a,t))break}else if(nT(a)&&RT(a,t))break}}},zT=(e,t,n)=>{let r=wT($(e,n));return mT(r,`root`,t[n]),mT(e,n,r),e},BT=e=>e.type===`file`,VT=e=>typeof e==`function`,HT=e=>{if(!sT)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},UT=e=>OT(e),WT=e=>e.type===`radio`,GT=e=>e instanceof RegExp,KT={value:!1,isValid:!1},qT={value:!0,isValid:!0},JT=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!uT(e[0].attributes.value)?uT(e[0].value)||e[0].value===``?qT:{value:e[0].value,isValid:!0}:qT:KT}return KT},YT={isValid:!1,value:null},XT=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,YT):YT;function ZT(e,t,n=`validate`){if(UT(e)||Array.isArray(e)&&e.every(UT)||dT(e)&&!e)return{type:n,message:UT(e)?e:``,ref:t}}var QT=e=>nT(e)&&!GT(e)?e:{value:e,message:``},$T=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=$(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{i&&y.reportValidity&&(y.setCustomValidity(dT(e)?``:e||``),y.reportValidity())},x={},S=WT(o),C=Qw(o),w=S||C,T=(g||BT(o))&&uT(o.value)&&uT(v)||HT(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=NT.bind(null,h,r,x),D=(e,t,n,r=_T.maxLength,i=_T.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||eT(v))||dT(v)&&!v||C&&!JT(s).isValid||S&&!XT(s).isValid)){let{value:e,message:t}=UT(c)?{value:!!c,message:c}:QT(c);if(e&&(x[h]={type:_T.required,message:t,ref:y,...E(_T.required,t)},!r))return b(t),x}if(!T&&(!eT(d)||!eT(f))){let e,t,n=QT(f),i=QT(d);if(!eT(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;eT(n.value)||(e=r>n.value),eT(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;OT(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),OT(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,_T.max,_T.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(OT(v)||a&&Array.isArray(v))){let e=QT(l),t=QT(u),n=!eT(e.value)&&v.length>+e.value,i=!eT(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&OT(v)){let{value:e,message:t}=QT(p);if(GT(e)&&!v.match(e)&&(x[h]={type:_T.pattern,message:t,ref:o,...E(_T.pattern,t)},!r))return b(t),x}if(m){if(VT(m)){let e=ZT(await m(v,n),y);if(e&&(x[h]={...e,...E(_T.validate,e.message)},!r))return b(e.message),x}else if(nT(m)){let e={};for(let t in m){if(!ST(e)&&!r)break;let i=ZT(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!ST(e)&&(x[h]={ref:y,...e},!r))return x}}return b(!0),x},eE=(e,t)=>[...e,...wT(t)],tE=e=>Array.isArray(e)?e.map(()=>void 0):void 0;function nE(e,t,n){return[...e.slice(0,t),...wT(n),...e.slice(t)]}var rE=(e,t,n)=>Array.isArray(e)?(uT(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[],iE=(e,t)=>[...wT(t),...wT(e)];function aE(e,t){let n=0,r=[...e];for(let e of t)r.splice(e-n,1),n++;return lT(r).length?r:[]}var oE=(e,t)=>uT(t)?[]:aE(e,wT(t).sort((e,t)=>e-t)),sE=(e,t,n)=>{[e[t],e[n]]=[e[n],e[t]]};function cE(e,t){let n=t.slice(0,-1).length,r=0;for(;r<n;)e=uT(e)?r++:e[t[r++]];return e}function lE(e){for(let t in e)if(e.hasOwnProperty(t)&&!uT(e[t]))return!1;return!0}function uE(e,t){let n=Array.isArray(t)?t:fT(t)?[t]:pT(t),r=n.length===1?e:cE(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(nT(r)&&ST(r)||Array.isArray(r)&&lE(r))&&uE(e,n.slice(0,-1)),e}var dE=(e,t,n)=>(e[t]=n,e);function fE(e){let t=yT(),{control:n=t.control,name:r,keyName:i=`id`,shouldUnregister:a,rules:o}=e,[s,c]=K.useState(n._getFieldArray(r)),l=K.useRef(n._getFieldArray(r).map(PT)),u=K.useRef(s),d=K.useRef(r),f=K.useRef(!1);d.current=r,u.current=s,n._names.array.add(r),o&&n.register(r,o),ET({next:({values:e,name:t})=>{if(t===d.current||!t){let t=$(e,d.current);Array.isArray(t)&&(c(t),l.current=t.map(PT))}},subject:n._subjects.array});let p=K.useCallback(e=>{f.current=!0,n._updateFieldArray(r,e)},[n,r]);return K.useEffect(()=>{if(n._state.action=!1,LT(r,n._names)&&n._subjects.state.next({...n._formState}),f.current&&(!IT(n._options.mode).isOnSubmit||n._formState.isSubmitted)){if(n._options.resolver)n._executeSchema([r]).then(e=>{let t=$(e.errors,r),i=$(n._formState.errors,r);(i?!t&&i.type||t&&(i.type!==t.type||i.message!==t.message):t&&t.type)&&(t?mT(n._formState.errors,r,t):uE(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let e=$(n._fields,r);e&&e._f&&!(IT(n._options.reValidateMode).isOnSubmit&&IT(n._options.mode).isOnSubmit)&&$T(e,n._names.disabled,n._formValues,n._options.criteriaMode===gT.all,n._options.shouldUseNativeValidation,!0).then(e=>!ST(e)&&n._subjects.state.next({errors:zT(n._formState.errors,e,r)}))}}n._subjects.values.next({name:r,values:{...n._formValues}}),n._names.focus&&RT(n._fields,(e,t)=>{if(n._names.focus&&t.startsWith(n._names.focus)&&e.focus)return e.focus(),1}),n._names.focus=``,n._updateValid(),f.current=!1},[s,r,n]),K.useEffect(()=>(!$(n._formValues,r)&&n._updateFieldArray(r),()=>{(n._options.shouldUnregister||a)&&n.unregister(r)}),[r,n,i,a]),{swap:K.useCallback((e,t)=>{let i=n._getFieldArray(r);sE(i,e,t),sE(l.current,e,t),p(i),c(i),n._updateFieldArray(r,i,sE,{argA:e,argB:t},!1)},[p,r,n]),move:K.useCallback((e,t)=>{let i=n._getFieldArray(r);rE(i,e,t),rE(l.current,e,t),p(i),c(i),n._updateFieldArray(r,i,rE,{argA:e,argB:t},!1)},[p,r,n]),prepend:K.useCallback((e,t)=>{let i=wT(cT(e)),a=iE(n._getFieldArray(r),i);n._names.focus=FT(r,0,t),l.current=iE(l.current,i.map(PT)),p(a),c(a),n._updateFieldArray(r,a,iE,{argA:tE(e)})},[p,r,n]),append:K.useCallback((e,t)=>{let i=wT(cT(e)),a=eE(n._getFieldArray(r),i);n._names.focus=FT(r,a.length-1,t),l.current=eE(l.current,i.map(PT)),p(a),c(a),n._updateFieldArray(r,a,eE,{argA:tE(e)})},[p,r,n]),remove:K.useCallback(e=>{let t=oE(n._getFieldArray(r),e);l.current=oE(l.current,e),p(t),c(t),!Array.isArray($(n._fields,r))&&mT(n._fields,r,void 0),n._updateFieldArray(r,t,oE,{argA:e})},[p,r,n]),insert:K.useCallback((e,t,i)=>{let a=wT(cT(t)),o=nE(n._getFieldArray(r),e,a);n._names.focus=FT(r,e,i),l.current=nE(l.current,e,a.map(PT)),p(o),c(o),n._updateFieldArray(r,o,nE,{argA:e,argB:tE(t)})},[p,r,n]),update:K.useCallback((e,t)=>{let i=cT(t),a=dE(n._getFieldArray(r),e,i);l.current=[...a].map((t,n)=>!t||n===e?PT():l.current[n]),p(a),c([...a]),n._updateFieldArray(r,a,dE,{argA:e,argB:i},!0,!1)},[p,r,n]),replace:K.useCallback(e=>{let t=wT(cT(e));l.current=t.map(PT),p([...t]),c([...t]),n._updateFieldArray(r,[...t],e=>e,{},!0,!1)},[p,r,n]),fields:K.useMemo(()=>s.map((e,t)=>({...e,[i]:l.current[t]||PT()})),[s,i])}}var pE=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},mE=e=>eT(e)||!tT(e);function hE(e,t){if(mE(e)||mE(t))return e===t;if($w(e)&&$w(t))return e.getTime()===t.getTime();let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n){let n=e[i];if(!r.includes(i))return!1;if(i!==`ref`){let e=t[i];if($w(n)&&$w(e)||nT(n)&&nT(e)||Array.isArray(n)&&Array.isArray(e)?!hE(n,e):n!==e)return!1}}return!0}var gE=e=>e.type===`select-multiple`,_E=e=>WT(e)||Qw(e),vE=e=>HT(e)&&e.isConnected,yE=e=>{for(let t in e)if(VT(e[t]))return!0;return!1};function bE(e,t={}){let n=Array.isArray(e);if(nT(e)||n)for(let n in e)Array.isArray(e[n])||nT(e[n])&&!yE(e[n])?(t[n]=Array.isArray(e[n])?[]:{},bE(e[n],t[n])):eT(e[n])||(t[n]=!0);return t}function xE(e,t,n){let r=Array.isArray(e);if(nT(e)||r)for(let r in e)Array.isArray(e[r])||nT(e[r])&&!yE(e[r])?uT(t)||mE(n[r])?n[r]=Array.isArray(e[r])?bE(e[r],[]):{...bE(e[r])}:xE(e[r],eT(t)?{}:t[r],n[r]):n[r]=!hE(e[r],t[r]);return n}var SE=(e,t)=>xE(e,t,bE(t)),CE=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>uT(e)?e:t?e===``?NaN:e&&+e:n&&OT(e)?new Date(e):r?r(e):e;function wE(e){let t=e.ref;return BT(t)?t.files:WT(t)?XT(e.refs).value:gE(t)?[...t.selectedOptions].map(({value:e})=>e):Qw(t)?JT(e.refs).value:CE(uT(t.value)?e.ref.value:t.value,e)}var TE=(e,t,n,r)=>{let i={};for(let n of e){let e=$(t,n);e&&mT(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},EE=e=>uT(e)?e:GT(e)?e.source:nT(e)?GT(e.value)?e.value.source:e.value:e,DE=`AsyncFunction`,OE=e=>!!e&&!!e.validate&&!!(VT(e.validate)&&e.validate.constructor.name===DE||nT(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===DE)),kE=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function AE(e,t,n){let r=$(e,n);if(r||fT(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=$(t,r),o=$(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};i.pop()}return{name:n}}var jE=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e,ME=(e,t)=>!lT($(e,t)).length&&uE(e,t),NE={mode:gT.onSubmit,reValidateMode:gT.onChange,shouldFocusError:!0};function PE(e={}){let t={...NE,...e},n={submitCount:0,isDirty:!1,isLoading:VT(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=(nT(t.defaultValues)||nT(t.values))&&cT(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:cT(i),o={action:!1,mount:!1,watch:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0,u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:pE(),array:pE(),state:pE()},f=IT(t.mode),p=IT(t.reValidateMode),m=t.criteriaMode===gT.all,h=e=>t=>{clearTimeout(l),l=setTimeout(e,t)},g=async e=>{if(!t.disabled&&(u.isValid||e)){let e=t.resolver?ST((await w()).errors):await E(r,!0);e!==n.isValid&&d.state.next({isValid:e})}},_=(e,r)=>{!t.disabled&&(u.isValidating||u.validatingFields)&&((e||Array.from(s.mount)).forEach(e=>{e&&(r?mT(n.validatingFields,e,r):uE(n.validatingFields,e))}),d.state.next({validatingFields:n.validatingFields,isValidating:!ST(n.validatingFields)}))},v=(e,s=[],c,l,f=!0,p=!0)=>{if(l&&c&&!t.disabled){if(o.action=!0,p&&Array.isArray($(r,e))){let t=c($(r,e),l.argA,l.argB);f&&mT(r,e,t)}if(p&&Array.isArray($(n.errors,e))){let t=c($(n.errors,e),l.argA,l.argB);f&&mT(n.errors,e,t),ME(n.errors,e)}if(u.touchedFields&&p&&Array.isArray($(n.touchedFields,e))){let t=c($(n.touchedFields,e),l.argA,l.argB);f&&mT(n.touchedFields,e,t)}u.dirtyFields&&(n.dirtyFields=SE(i,a)),d.state.next({name:e,isDirty:O(e,s),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else mT(a,e,s)},y=(e,t)=>{mT(n.errors,e,t),d.state.next({errors:n.errors})},b=e=>{n.errors=e,d.state.next({errors:n.errors,isValid:!1})},x=(e,t,n,s)=>{let c=$(r,e);if(c){let r=$(a,e,uT(n)?$(i,e):n);uT(r)||s&&s.defaultChecked||t?mT(a,e,t?r:wE(c._f)):j(e,r),o.mount&&g()}},S=(e,a,o,s,c)=>{let l=!1,f=!1,p={name:e};if(!t.disabled){let t=!!($(r,e)&&$(r,e)._f&&$(r,e)._f.disabled);if(!o||s){u.isDirty&&(f=n.isDirty,n.isDirty=p.isDirty=O(),l=f!==p.isDirty);let r=t||hE($(i,e),a);f=!!(!t&&$(n.dirtyFields,e)),r||t?uE(n.dirtyFields,e):mT(n.dirtyFields,e,!0),p.dirtyFields=n.dirtyFields,l||=u.dirtyFields&&f!==!r}if(o){let t=$(n.touchedFields,e);t||(mT(n.touchedFields,e,o),p.touchedFields=n.touchedFields,l||=u.touchedFields&&t!==o)}l&&c&&d.state.next(p)}return l?p:{}},C=(e,r,i,a)=>{let o=$(n.errors,e),s=u.isValid&&dT(r)&&n.isValid!==r;if(t.delayError&&i?(c=h(()=>y(e,i)),c(t.delayError)):(clearTimeout(l),c=null,i?mT(n.errors,e,i):uE(n.errors,e)),(i?!hE(o,i):o)||!ST(a)||s){let t={...a,...s&&dT(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},d.state.next(t)}},w=async e=>{_(e,!0);let n=await t.resolver(a,t.context,TE(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return _(e),n},T=async e=>{let{errors:t}=await w(e);if(e)for(let r of e){let e=$(t,r);e?mT(n.errors,r,e):uE(n.errors,r)}else n.errors=t;return t},E=async(e,r,i={valid:!0})=>{for(let o in e){let c=e[o];if(c){let{_f:e,...l}=c;if(e){let l=s.array.has(e.name),d=c._f&&OE(c._f);d&&u.validatingFields&&_([o],!0);let f=await $T(c,s.disabled,a,m,t.shouldUseNativeValidation&&!r,l);if(d&&u.validatingFields&&_([o]),f[e.name]&&(i.valid=!1,r))break;!r&&($(f,e.name)?l?zT(n.errors,f,e.name):mT(n.errors,e.name,f[e.name]):uE(n.errors,e.name))}!ST(l)&&await E(l,r,i)}}return i.valid},D=()=>{for(let e of s.unMount){let t=$(r,e);t&&(t._f.refs?t._f.refs.every(e=>!vE(e)):!vE(t._f.ref))&&ae(e)}s.unMount=new Set},O=(e,n)=>!t.disabled&&(e&&n&&mT(a,e,n),!hE(ne(),i)),k=(e,t,n)=>kT(e,s,{...o.mount?a:uT(t)?i:OT(e)?{[e]:t}:t},n,t),A=e=>lT($(o.mount?a:i,e,t.shouldUnregister?$(i,e,[]):[])),j=(e,t,n={})=>{let i=$(r,e),o=t;if(i){let n=i._f;n&&(!n.disabled&&mT(a,e,CE(t,n)),o=HT(n.ref)&&eT(t)?``:t,gE(n.ref)?[...n.ref.options].forEach(e=>e.selected=o.includes(e.value)):n.refs?Qw(n.ref)?n.refs.length>1?n.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(o)?!!o.find(t=>t===e.value):o===e.value)):n.refs[0]&&(n.refs[0].checked=!!o):n.refs.forEach(e=>e.checked=e.value===o):BT(n.ref)?n.ref.value=``:(n.ref.value=o,n.ref.type||d.values.next({name:e,values:{...a}})))}(n.shouldDirty||n.shouldTouch)&&S(e,o,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&te(e)},M=(e,t,n)=>{for(let i in t){let a=t[i],o=`${e}.${i}`,c=$(r,o);(s.array.has(e)||nT(a)||c&&!c._f)&&!$w(a)?M(o,a,n):j(o,a,n)}},N=(e,t,c={})=>{let l=$(r,e),f=s.array.has(e),p=cT(t);mT(a,e,p),f?(d.array.next({name:e,values:{...a}}),(u.isDirty||u.dirtyFields)&&c.shouldDirty&&d.state.next({name:e,dirtyFields:SE(i,a),isDirty:O(e,p)})):l&&!l._f&&!eT(p)?M(e,p,c):j(e,p,c),LT(e,s)&&d.state.next({...n}),d.values.next({name:o.mount?e:void 0,values:{...a}})},P=async e=>{o.mount=!0;let i=e.target,l=i.name,h=!0,v=$(r,l),y=()=>i.type?wE(v._f):rT(e),b=e=>{h=Number.isNaN(e)||$w(e)&&isNaN(e.getTime())||hE(e,$(a,l,e))};if(v){let i,o,x=y(),T=e.type===hT.BLUR||e.type===hT.FOCUS_OUT,D=!kE(v._f)&&!t.resolver&&!$(n.errors,l)&&!v._f.deps||jE(T,$(n.touchedFields,l),n.isSubmitted,p,f),O=LT(l,s,T);mT(a,l,x),T?(v._f.onBlur&&v._f.onBlur(e),c&&c(0)):v._f.onChange&&v._f.onChange(e);let k=S(l,x,T,!1),A=!ST(k)||O;if(!T&&d.values.next({name:l,type:e.type,values:{...a}}),D)return u.isValid&&(t.mode===`onBlur`&&T?g():T||g()),A&&d.state.next({name:l,...O?{}:k});if(!T&&O&&d.state.next({...n}),t.resolver){let{errors:e}=await w([l]);if(b(x),h){let t=AE(n.errors,r,l),a=AE(e,r,t.name||l);i=a.error,l=a.name,o=ST(e)}}else _([l],!0),i=(await $T(v,s.disabled,a,m,t.shouldUseNativeValidation))[l],_([l]),b(x),h&&(i?o=!1:u.isValid&&(o=await E(r,!0)));h&&(v._f.deps&&te(v._f.deps),C(l,o,i,k))}},ee=(e,t)=>{if($(n.errors,t)&&e.focus)return e.focus(),1},te=async(e,i={})=>{let a,o,c=wT(e);if(t.resolver){let t=await T(uT(e)?e:c);a=ST(t),o=e?!c.some(e=>$(t,e)):a}else e?(o=(await Promise.all(c.map(async e=>{let t=$(r,e);return await E(t&&t._f?{[e]:t}:t)}))).every(Boolean),!(!o&&!n.isValid)&&g()):o=a=await E(r);return d.state.next({...!OT(e)||u.isValid&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},errors:n.errors}),i.shouldFocus&&!o&&RT(r,ee,e?c:s.mount),o},ne=e=>{let t={...o.mount?a:i};return uT(e)?t:OT(e)?$(t,e):e.map(e=>$(t,e))},re=(e,t)=>({invalid:!!$((t||n).errors,e),isDirty:!!$((t||n).dirtyFields,e),error:$((t||n).errors,e),isValidating:!!$(n.validatingFields,e),isTouched:!!$((t||n).touchedFields,e)}),F=e=>{e&&wT(e).forEach(e=>uE(n.errors,e)),d.state.next({errors:e?n.errors:{}})},ie=(e,t,i)=>{let a=($(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=$(n.errors,e)||{};mT(n.errors,e,{...l,...t,ref:a}),d.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},I=(e,t)=>VT(e)?d.values.subscribe({next:n=>e(k(void 0,t),n)}):k(e,t,!0),ae=(e,o={})=>{for(let c of e?wT(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(uE(r,c),uE(a,c)),!o.keepError&&uE(n.errors,c),!o.keepDirty&&uE(n.dirtyFields,c),!o.keepTouched&&uE(n.touchedFields,c),!o.keepIsValidating&&uE(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&uE(i,c);d.values.next({values:{...a}}),d.state.next({...n,...o.keepDirty?{isDirty:O()}:{}}),!o.keepIsValid&&g()},L=({disabled:e,name:t,field:n,fields:r})=>{(dT(e)&&o.mount||e||s.disabled.has(t))&&(e?s.disabled.add(t):s.disabled.delete(t),S(t,wE(n?n._f:$(r,t)._f),!1,!1,!0))},oe=(e,n={})=>{let a=$(r,e),c=dT(n.disabled)||dT(t.disabled);return mT(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a?L({field:a,disabled:dT(n.disabled)?n.disabled:t.disabled,name:e}):x(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:EE(n.min),max:EE(n.max),minLength:EE(n.minLength),maxLength:EE(n.maxLength),pattern:EE(n.pattern)}:{},name:e,onChange:P,onBlur:P,ref:c=>{if(c){oe(e,n),a=$(r,e);let t=uT(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=_E(t),s=a._f.refs||[];if(o?s.find(e=>e===t):t===a._f.ref)return;mT(r,e,{_f:{...a._f,...o?{refs:[...s.filter(vE),t,...Array.isArray($(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),x(e,!1,void 0,t)}else a=$(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(aT(s.array,e)&&o.action)&&s.unMount.add(e)}}},se=()=>t.shouldFocusError&&RT(r,ee,s.mount),R=e=>{dT(e)&&(d.state.next({disabled:e}),RT(r,(t,n)=>{let i=$(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},ce=(e,i)=>async o=>{let c;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let l=cT(a);if(s.disabled.size)for(let e of s.disabled)mT(l,e,void 0);if(d.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await w();n.errors=e,l=t}else await E(r);if(uE(n.errors,`root`),ST(n.errors)){d.state.next({errors:{}});try{await e(l,o)}catch(e){c=e}}else i&&await i({...n.errors},o),se(),setTimeout(se);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ST(n.errors)&&!c,submitCount:n.submitCount+1,errors:n.errors}),c)throw c},le=(e,t={})=>{$(r,e)&&(uT(t.defaultValue)?N(e,cT($(i,e))):(N(e,t.defaultValue),mT(i,e,cT(t.defaultValue))),t.keepTouched||uE(n.touchedFields,e),t.keepDirty||(uE(n.dirtyFields,e),n.isDirty=t.defaultValue?O(e,cT($(i,e))):O()),t.keepError||(uE(n.errors,e),u.isValid&&g()),d.state.next({...n}))},ue=(e,c={})=>{let l=e?cT(e):i,f=cT(l),p=ST(e),m=p?i:f;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...Object.keys(SE(i,a))]);for(let t of Array.from(e))$(n.dirtyFields,t)?mT(m,t,$(a,t)):N(t,$(m,t))}else{if(sT&&uT(e))for(let e of s.mount){let t=$(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(HT(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}r={}}a=t.shouldUnregister?c.keepDefaultValues?cT(i):{}:cT(m),d.array.next({values:{...m}}),d.values.next({values:{...m}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!u.isValid||!!c.keepIsValid||!!c.keepDirtyValues,o.watch=!!t.shouldUnregister,d.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:p?!1:c.keepDirty?n.isDirty:!!(c.keepDefaultValues&&!hE(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:p?{}:c.keepDirtyValues?c.keepDefaultValues&&a?SE(i,a):n.dirtyFields:c.keepDefaultValues&&e?SE(i,e):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},z=(e,t)=>ue(VT(e)?e(a):e,t);return{control:{register:oe,unregister:ae,getFieldState:re,handleSubmit:ce,setError:ie,_executeSchema:w,_getWatch:k,_getDirty:O,_updateValid:g,_removeUnmounted:D,_updateFieldArray:v,_updateDisabledField:L,_getFieldArray:A,_reset:ue,_resetDefaultValues:()=>VT(t.defaultValues)&&t.defaultValues().then(e=>{z(e,t.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:e=>{n={...n,...e}},_disableForm:R,_subjects:d,_proxyFormState:u,_setErrors:b,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},set _formState(e){n=e},get _options(){return t},set _options(e){t={...t,...e}}},trigger:te,register:oe,handleSubmit:ce,watch:I,setValue:N,getValues:ne,reset:z,resetField:le,clearErrors:F,unregister:ae,setError:ie,setFocus:(e,t={})=>{let n=$(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&(e.focus(),t.shouldSelect&&VT(e.select)&&e.select())}},getFieldState:re}}function FE(e={}){let t=K.useRef(void 0),n=K.useRef(void 0),[r,i]=K.useState({isDirty:!1,isValidating:!1,isLoading:VT(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:VT(e.defaultValues)?void 0:e.defaultValues});t.current||={...PE(e),formState:r};let a=t.current.control;return a._options=e,ET({subject:a._subjects.state,next:e=>{CT(e,a._proxyFormState,a._updateFormState,!0)&&i({...a._formState})}}),K.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),K.useEffect(()=>{if(a._proxyFormState.isDirty){let e=a._getDirty();e!==r.isDirty&&a._subjects.state.next({isDirty:e})}},[a,r.isDirty]),K.useEffect(()=>{e.values&&!hE(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values,i(e=>({...e}))):a._resetDefaultValues()},[e.values,a]),K.useEffect(()=>{e.errors&&a._setErrors(e.errors)},[e.errors,a]),K.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),K.useEffect(()=>{e.shouldUnregister&&a._subjects.values.next({values:a._getWatch()})},[e.shouldUnregister,a]),t.current.formState=xT(r,a),t.current}var IE=(e,t,n)=>{if(e&&`reportValidity`in e){let r=$(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},LE=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?IE(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>IE(t,n,e))}},RE=(e,t)=>{t.shouldUseNativeValidation&&LE(e,t);let n={};for(let r in e){let i=$(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(zE(t.names||Object.keys(e),r)){let e=Object.assign({},$(n,r));mT(e,`root`,a),mT(n,r,e)}else mT(n,r,a)}return n},zE=(e,t)=>{let n=BE(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>BE(e).match(`^${n}\\.\\d+`))};function BE(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function VE(){return VE=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},VE.apply(null,arguments)}function HE(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function UE(e,t){for(var n=Object.create(null);e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(`unionErrors`in r){var s=r.unionErrors.reduce(function(e,t){return t.errors.length<e.errors.length?t:e}).errors[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=NT(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function WE(e,t){for(var n=Object.create(null),r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors.reduce(function(e,t){return t.length<e.length?t:e})[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(VE({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=NT(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function GE(e,t,n){if(n===void 0&&(n={}),function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(HE(function(){function i(e){return a.shouldUseNativeValidation&&LE({},a),{errors:{},values:n.raw?Object.assign({},r):e}}var o=e;return n.mode===`sync`?i(o.parse(r,t)):Promise.resolve(o.parseAsync(r,t)).then(i)},function(e){if(function(e){var t;return!(e==null||(t=e._zod)==null||(t=t.traits)==null||!t.has(`$ZodError`))}(e))return{values:{},errors:RE(WE(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_def`in e&&typeof e._def==`object`}(e))return function(r,i,a){try{return Promise.resolve(HE(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&LE({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:RE(UE(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var KE={of(e){return JSON.stringify(e)},parse(e){if(!e)return{};try{return JSON.parse(e)}catch{return{label:e}}}};function qE(){return Math.floor(Math.random()*1e5)}var JE=1,YE=.9,XE=.8,ZE=.17,QE=.1,$E=.999,eD=.9999,tD=.99,nD=/[\\\/_+.#"@\[\(\{&]/,rD=/[\\\/_+.#"@\[\(\{&]/g,iD=/[\s-]/,aD=/[\s-]/g;function oD(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?JE:tD;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=oD(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=JE:nD.test(e.charAt(l-1))?(d*=XE,p=e.slice(i,l-1).match(rD),p&&i>0&&(d*=$E**+p.length)):iD.test(e.charAt(l-1))?(d*=YE,m=e.slice(i,l-1).match(aD),m&&i>0&&(d*=$E**+m.length)):(d*=ZE,i>0&&(d*=$E**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=eD)),(d<QE&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=oD(e,t,n,r,l+1,a+2,o),f*QE>d&&(d=f*QE)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function sD(e){return e.toLowerCase().replace(aD,` `)}function cD(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,oD(e,t,sD(e),sD(t),0,0,{})}var lD=`[cmdk-group=""]`,uD=`[cmdk-group-items=""]`,dD=`[cmdk-group-heading=""]`,fD=`[cmdk-item=""]`,pD=`${fD}:not([aria-disabled="true"])`,mD=`cmdk-item-select`,hD=`data-value`,gD=(e,t,n)=>cD(e,t,n),_D=K.createContext(void 0),vD=()=>K.useContext(_D),yD=K.createContext(void 0),bD=()=>K.useContext(yD),xD=K.createContext(void 0),SD=K.forwardRef((e,t)=>{let n=ID(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=ID(()=>new Set),i=ID(()=>new Map),a=ID(()=>new Map),o=ID(()=>new Set),s=PD(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=Ue(),y=Ue(),b=Ue(),x=K.useRef(null),S=zD();FD(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),FD(()=>{S(6,k)},[]);let C=K.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=K.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??gD;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(uD);t?t.appendChild(e.parentElement===t?e:e.closest(`${uD} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${uD} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${lD}[${hD}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(hD);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(lD)?.querySelector(dD))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${fD}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(pD)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(hD))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(hD))}function P(e){let t=A()?.closest(lD),n;for(;t&&!n;)t=e>0?MD(t,lD):ND(t,lD),n=t?.querySelector(pD);n?C.setState(`value`,n.getAttribute(hD)):N(e)}let ee=()=>M(j().length-1),te=e=>{e.preventDefault(),e.metaKey?ee():e.altKey?P(1):N(1)},ne=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return K.createElement(Ee.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&te(e);break;case`ArrowDown`:te(e);break;case`p`:case`k`:g&&e.ctrlKey&&ne(e);break;case`ArrowUp`:ne(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),ee();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(mD);t.dispatchEvent(e)}}}}},K.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:HD},c),VD(e,e=>K.createElement(yD.Provider,{value:C},K.createElement(_D.Provider,{value:w},e))))}),CD=K.forwardRef((e,t)=>{let n=Ue(),r=K.useRef(null),i=K.useContext(xD),a=vD(),o=PD(e),s=o.current?.forceMount??i?.forceMount;FD(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=RD(n,r,[e.value,e.children,r],e.keywords),l=bD(),u=LD(e=>e.value&&e.value===c.current),d=LD(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);K.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(mD,f),()=>t.removeEventListener(mD,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return K.createElement(Ee.div,{ref:L(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),wD=K.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Ue(),s=K.useRef(null),c=K.useRef(null),l=Ue(),u=vD(),d=LD(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));FD(()=>u.group(o),[]),RD(o,s,[e.value,e.heading,c]);let f=K.useMemo(()=>({id:o,forceMount:i}),[i]);return K.createElement(Ee.div,{ref:L(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&K.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),VD(e,e=>K.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},K.createElement(xD.Provider,{value:f},e))))}),TD=K.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=K.useRef(null),a=LD(e=>!e.search);return!n&&!a?null:K.createElement(Ee.div,{ref:L(i,t),...r,"cmdk-separator":``,role:`separator`})}),ED=K.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=bD(),o=LD(e=>e.search),s=LD(e=>e.selectedItemId),c=vD();return K.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),K.createElement(Ee.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),DD=K.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=K.useRef(null),o=K.useRef(null),s=LD(e=>e.selectedItemId),c=vD();return K.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),K.createElement(Ee.div,{ref:L(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},VD(e,e=>K.createElement(`div`,{ref:L(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),OD=K.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return K.createElement(tt,{open:n,onOpenChange:r},K.createElement(rt,{container:o},K.createElement(nt,{"cmdk-overlay":``,className:i}),K.createElement(et,{"aria-label":e.label,"cmdk-dialog":``,className:a},K.createElement(SD,{ref:t,...s}))))}),kD=K.forwardRef((e,t)=>LD(e=>e.filtered.count===0)?K.createElement(Ee.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),AD=K.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return K.createElement(Ee.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},VD(e,e=>K.createElement(`div`,{"aria-hidden":!0},e)))}),jD=Object.assign(SD,{List:DD,Item:CD,Input:ED,Group:wD,Separator:TD,Dialog:OD,Empty:kD,Loading:AD});function MD(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ND(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function PD(e){let t=K.useRef(e);return FD(()=>{t.current=e}),t}var FD=typeof window>`u`?K.useEffect:K.useLayoutEffect;function ID(e){let t=K.useRef();return t.current===void 0&&(t.current=e()),t}function LD(e){let t=bD(),n=()=>e(t.snapshot());return K.useSyncExternalStore(t.subscribe,n,n)}function RD(e,t,n,r=[]){let i=K.useRef(),a=vD();return FD(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(hD,s),i.current=s}),i}var zD=()=>{let[e,t]=K.useState(),n=ID(()=>new Map);return FD(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function BD(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function VD({asChild:e,children:t},n){return e&&K.isValidElement(t)?K.cloneElement(BD(t),{ref:t.ref},n(t.props.children)):n(t)}var HD={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function UD(e){return e.toLowerCase().match(/[\da-z]+/g)||[]}function WD(e,t){let n=UD(e);if(n.length===0)return!0;let r=Array.isArray(t)?t:[t],i=[];for(let e of r)e&&i.push(...UD(e));return n.every(e=>i.some(t=>t.startsWith(e)))}function GD(e,t,n){return WD(t,e)?1:n&&WD(t,n)?.8:0}var KD=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(jD,{ref:t,filter:GD,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});KD.displayName=jD.displayName;var qD=e=>{let t=(0,X.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=(0,q.jsx)(tn,{className:`overflow-hidden p-0 shadow-2xl`,usePortal:!0,children:(0,q.jsx)(KD,{className:`**:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 **:[[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5`,children:n})}),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(en,{...r,children:i}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},JD=K.forwardRef((e,t)=>{let n=(0,X.c)(19),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,icon:i,rootClassName:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]===o?s=n[6]:(s=H(`flex items-center border-b px-3`,o),n[5]=o,n[6]=s);let c;n[7]===i?c=n[8]:(c=i===null?null:(0,q.jsx)(rn,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[7]=i,n[8]=c);let l;n[9]===r?l=n[10]:(l=H(`placeholder:text-foreground-muted flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,r),n[9]=r,n[10]=l);let u;n[11]!==a||n[12]!==t||n[13]!==l?(u=(0,q.jsx)(jD.Input,{ref:t,className:l,...a}),n[11]=a,n[12]=t,n[13]=l,n[14]=u):u=n[14];let d;return n[15]!==s||n[16]!==c||n[17]!==u?(d=(0,q.jsxs)(`div`,{className:s,"cmdk-input-wrapper":``,children:[c,u]}),n[15]=s,n[16]=c,n[17]=u,n[18]=d):d=n[18],d});JD.displayName=jD.Input.displayName;var YD=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(jD.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});YD.displayName=jD.List.displayName;var XD=K.forwardRef((e,t)=>{let n=(0,X.c)(3),r;return n[0]!==e||n[1]!==t?(r=(0,q.jsx)(jD.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});XD.displayName=jD.Empty.displayName;var ZD=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(jD.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ZD.displayName=jD.Group.displayName;var QD=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=Ye({className:r}),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(jD.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});QD.displayName=jD.Separator.displayName;var $D=K.forwardRef((e,t)=>{let n=(0,X.c)(16),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,variant:o,inset:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]!==r||n[6]!==i||n[7]!==o?(s=H(Ze({variant:o,inset:i}).replace(Qe,`data-[disabled=false]:pointer-events-all data-[disabled=false]:opacity-100 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`),r),n[5]=r,n[6]=i,n[7]=o,n[8]=s):s=n[8];let c;n[9]===a.value?c=n[10]:(c=Vr.htmlEscape(a.value),n[9]=a.value,n[10]=c);let l;return n[11]!==a||n[12]!==t||n[13]!==s||n[14]!==c?(l=(0,q.jsx)(jD.Item,{ref:t,className:s,...a,value:c}),n[11]=a,n[12]=t,n[13]=s,n[14]=c,n[15]=l):l=n[15],l});$D.displayName=jD.Item.displayName;var eO=Xe,tO=va,nO=Sa,rO=Ie(Ea),iO=Pa,aO=Ae(Oa),oO=K.forwardRef((e,t)=>{let n=(0,X.c)(22),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({className:r,align:a,sideOffset:o,portal:s,scrollable:c,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l=a===void 0?`center`:a,u=o===void 0?4:o,d=s===void 0||s,f=c!==void 0&&c,p=f&&`overflow-auto`,m;n[7]!==r||n[8]!==p?(m=H(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden animate-in data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r,p),n[7]=r,n[8]=p,n[9]=m):m=n[9];let h=f?`calc(var(--radix-popover-content-available-height) - ${Ve}px)`:void 0,g;n[10]!==i.style||n[11]!==h?(g={...i.style,maxHeight:h},n[10]=i.style,n[11]=h,n[12]=g):g=n[12];let _;n[13]!==l||n[14]!==i||n[15]!==t||n[16]!==u||n[17]!==m||n[18]!==g?(_=(0,q.jsx)(Be,{children:(0,q.jsx)(aO,{ref:t,align:l,sideOffset:u,className:m,style:g,...i})}),n[13]=l,n[14]=i,n[15]=t,n[16]=u,n[17]=m,n[18]=g,n[19]=_):_=n[19];let v=_;if(d){let e;return n[20]===v?e=n[21]:(e=(0,q.jsx)(rO,{children:v}),n[20]=v,n[21]=e),e}return v});oO.displayName=Oa.displayName;var sO=(0,K.createContext)({isSelected:()=>!1,onSelect:ae.NOOP}),cO=e=>{let t=(0,X.c)(106),n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],v=t[17],y=t[18],b=t[19],x=t[20],S=t[21],C=t[22],w=t[23],T=t[24]):({children:n,displayValue:s,className:i,placeholder:h,value:T,defaultValue:o,onValueChange:p,multiple:y,shouldFilter:b,filterFn:c,open:m,defaultOpen:a,onOpenChange:d,inputPlaceholder:x,search:v,onSearchChange:f,emptyState:S,chips:C,chipsClassName:r,keepPopoverOpenOnSelect:u,id:l,disabled:w,renderValue:g,..._}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y,t[19]=b,t[20]=x,t[21]=S,t[22]=C,t[23]=w,t[24]=T);let E=y!==void 0&&y,D=b===void 0||b,O=x===void 0?`Search...`:x,k=S===void 0?`Nothing found.`:S,A=C!==void 0&&C,j=w!==void 0&&w,M=a??!1,N;t[25]!==d||t[26]!==m||t[27]!==M?(N={prop:m,defaultProp:M,onChange:d},t[25]=d,t[26]=m,t[27]=M,t[28]=N):N=t[28];let[P,ee]=Te(N),te=P!==void 0&&P,ne;t[29]===p?ne=t[30]:(ne=e=>{p?.(e)},t[29]=p,t[30]=ne);let re;t[31]!==o||t[32]!==ne||t[33]!==T?(re={prop:T,defaultProp:o,onChange:ne},t[31]=o,t[32]=ne,t[33]=T,t[34]=re):re=t[34];let[F,ie]=Te(re),I;t[35]===F?I=t[36]:(I=e=>Array.isArray(F)?F.includes(e):F===e,t[35]=F,t[36]=I);let ae=I,L;t[37]!==u||t[38]!==E||t[39]!==ee||t[40]!==ie||t[41]!==F?(L=e=>{let t=e;if(E){if(Array.isArray(F)){if(F.includes(t)){let n=F.filter(t=>t!==e);t=n.length>0?n:[]}else t=[...F,t]}else t=[t]}else F===e&&(t=null);ie(t),(u??E)||ee(!1)},t[37]=u,t[38]=E,t[39]=ee,t[40]=ie,t[41]=F,t[42]=L):L=t[42];let oe=L,se;t[43]!==A||t[44]!==s||t[45]!==E||t[46]!==h||t[47]!==F?(se=()=>E&&A&&h?h:F==null?h??`--`:Array.isArray(F)?F.length===0?h??`--`:F.length===1&&s!==void 0?s(F[0]):`${F.length} selected`:s===void 0?h??`--`:s(F),t[43]=A,t[44]=s,t[45]=E,t[46]=h,t[47]=F,t[48]=se):se=t[48];let R=se,ce;t[49]!==oe||t[50]!==ae?(ce={isSelected:ae,onSelect:oe},t[49]=oe,t[50]=ae,t[51]=ce):ce=t[51];let le=ce,ue;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ue=H(`relative`),t[52]=ue):ue=t[52];let z;t[53]!==j||t[54]!==ee?(z=e=>{j&&e||ee(e)},t[53]=j,t[54]=ee,t[55]=z):z=t[55];let B=j&&`cursor-not-allowed opacity-50`,de;t[56]!==i||t[57]!==B?(de=H(`flex h-6 w-fit mb-1 shadow-xs-solid items-center justify-between rounded-sm border border-input bg-transparent px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground hover:shadow-sm-solid focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:border-primary focus-visible:shadow-md-solid`,B,i),t[56]=i,t[57]=B,t[58]=de):de=t[58];let fe;t[59]!==g||t[60]!==R||t[61]!==F?(fe=g?g(F??null):R(),t[59]=g,t[60]=R,t[61]=F,t[62]=fe):fe=t[62];let pe;t[63]===fe?pe=t[64]:(pe=(0,q.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:fe}),t[63]=fe,t[64]=pe);let me;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,q.jsx)(Pt,{className:`ml-3 w-4 h-4 opacity-50 shrink-0`}),t[65]=me):me=t[65];let he;t[66]!==j||t[67]!==l||t[68]!==te||t[69]!==de||t[70]!==pe?(he=(0,q.jsx)(nO,{asChild:!0,children:(0,q.jsxs)(`button`,{id:l,type:`button`,className:de,"aria-expanded":te,"aria-disabled":j,children:[pe,me]})}),t[66]=j,t[67]=l,t[68]=te,t[69]=de,t[70]=pe,t[71]=he):he=t[71];let V;t[72]!==O||t[73]!==f||t[74]!==v?(V=(0,q.jsx)(JD,{placeholder:O,rootClassName:`px-1 h-8`,autoFocus:!0,value:v,onValueChange:f}),t[72]=O,t[73]=f,t[74]=v,t[75]=V):V=t[75];let ge;t[76]===k?ge=t[77]:(ge=(0,q.jsx)(XD,{children:k}),t[76]=k,t[77]=ge);let _e;t[78]!==n||t[79]!==le?(_e=(0,q.jsx)(sO,{value:le,children:n}),t[78]=n,t[79]=le,t[80]=_e):_e=t[80];let ve;t[81]!==ge||t[82]!==_e?(ve=(0,q.jsxs)(YD,{className:`max-h-60 py-.5`,children:[ge,_e]}),t[81]=ge,t[82]=_e,t[83]=ve):ve=t[83];let ye;t[84]!==c||t[85]!==D||t[86]!==V||t[87]!==ve?(ye=(0,q.jsx)(oO,{className:`w-full min-w-(--radix-popover-trigger-width) p-0`,align:`start`,children:(0,q.jsxs)(KD,{filter:c,shouldFilter:D,children:[V,ve]})}),t[84]=c,t[85]=D,t[86]=V,t[87]=ve,t[88]=ye):ye=t[88];let be;t[89]!==te||t[90]!==z||t[91]!==he||t[92]!==ye?(be=(0,q.jsxs)(tO,{open:te,onOpenChange:z,children:[he,ye]}),t[89]=te,t[90]=z,t[91]=he,t[92]=ye,t[93]=be):be=t[93];let xe;t[94]!==A||t[95]!==r||t[96]!==j||t[97]!==s||t[98]!==oe||t[99]!==E||t[100]!==F?(xe=E&&A&&(0,q.jsx)(`div`,{className:H(`flex flex-col gap-1 items-start`,r),children:Array.isArray(F)&&F.map(e=>e==null?null:(0,q.jsxs)(ti,{variant:`secondary`,children:[s?.(e)??String(e),(0,q.jsx)(Eo,{onClick:()=>{j||oe(e)},className:H(`w-3 h-3 opacity-50 hover:opacity-100 ml-1 cursor-pointer`,j&&`pointer-events-none`)})]},String(e)))}),t[94]=A,t[95]=r,t[96]=j,t[97]=s,t[98]=oe,t[99]=E,t[100]=F,t[101]=xe):xe=t[101];let Se;return t[102]!==_||t[103]!==be||t[104]!==xe?(Se=(0,q.jsxs)(`div`,{className:ue,..._,children:[be,xe]}),t[102]=_,t[103]=be,t[104]=xe,t[105]=Se):Se=t[105],Se},lO=K.forwardRef((e,t)=>{let n=(0,X.c)(20),{children:r,className:i,value:a,onSelect:o,disabled:s}=e,c=typeof a==`object`&&`value`in a?a.value:String(a),l=K.use(sO),u;n[0]!==l||n[1]!==a?(u=l.isSelected(a),n[0]=l,n[1]=a,n[2]=u):u=n[2];let d=u,f;n[3]===i?f=n[4]:(f=H(`pl-6 m-1 py-1`,i),n[3]=i,n[4]=f);let p;n[5]!==l||n[6]!==o||n[7]!==a?(p=()=>{l.onSelect(a),o?.(a)},n[5]=l,n[6]=o,n[7]=a,n[8]=p):p=n[8];let m;n[9]===d?m=n[10]:(m=d&&(0,q.jsx)(Nt,{className:`absolute left-1 h-4 w-4`}),n[9]=d,n[10]=m);let h;return n[11]!==r||n[12]!==s||n[13]!==d||n[14]!==t||n[15]!==f||n[16]!==p||n[17]!==m||n[18]!==c?(h=(0,q.jsxs)($D,{ref:t,className:f,role:`option`,"aria-selected":d,value:c,disabled:s,onSelect:p,children:[m,r]}),n[11]=r,n[12]=s,n[13]=d,n[14]=t,n[15]=f,n[16]=p,n[17]=m,n[18]=c,n[19]=h):h=n[19],h});lO.displayName=`ComboboxItem`;var uO=K.forwardRef((e,t)=>{let n=(0,X.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=H(`grid gap-2`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(so,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});uO.displayName=so.displayName;var dO=K.forwardRef((e,t)=>{let n=(0,X.c)(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=H(`h-[16px] w-[16px] transition-shadow data-[state=unchecked]:shadow-xs-solid rounded-full border border-input text-primary ring-offset-background focus:outline-hidden focus:shadow-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:shadow-none`,i),n[4]=i,n[5]=o);let s;n[6]===r?s=n[7]:(s=r??(0,q.jsx)(ho,{className:`flex items-center justify-center`,children:(0,q.jsx)(st,{className:`h-[10px] w-[10px] fill-primary text-current`})}),n[6]=r,n[7]=s);let c;return n[8]!==a||n[9]!==t||n[10]!==o||n[11]!==s?(c=(0,q.jsx)(po,{ref:t,className:o,...a,children:s}),n[8]=a,n[9]=t,n[10]=o,n[11]=s,n[12]=c):c=n[12],c});dO.displayName=po.displayName;function fO(e){return e instanceof k}function pO(e){return e instanceof j}function mO(e){return e instanceof T}var hO=bT,gO=()=>{let e=(0,X.c)(4),t=yT().formState.errors;if(Object.keys(t).length===0)return null;let n;e[0]===t?n=e[1]:(n=Object.values(t).map(DO).filter(Boolean),e[0]=t,e[1]=n);let r=n.join(`, `),i;return e[2]===r?i=e[3]:(i=(0,q.jsx)(`div`,{className:`text-destructive p-2 rounded-md bg-red-500/10`,children:r}),e[2]=r,e[3]=i),i},_O=K.createContext({}),vO=e=>{let t=(0,X.c)(10),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i;t[4]===n?i=t[5]:(i=(0,q.jsx)(MT,{...n}),t[4]=n,t[5]=i);let a;return t[6]!==n.name||t[7]!==r||t[8]!==i?(a=(0,q.jsx)(_O,{value:r,children:i},n.name),t[6]=n.name,t[7]=r,t[8]=i,t[9]=a):a=t[9],a},yO=()=>{let e=(0,X.c)(11),t=K.use(_O),n=K.use(bO),{getFieldState:r,formState:i}=yT(),a;e[0]!==t.name||e[1]!==i||e[2]!==r?(a=r(t.name,i),e[0]=t.name,e[1]=i,e[2]=r,e[3]=a):a=e[3];let o=a;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:s}=n,c=`${s}-form-item`,l=`${s}-form-item-description`,u=`${s}-form-item-message`,d;return e[4]!==t.name||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==l||e[9]!==u?(d={id:s,name:t.name,formItemId:c,formDescriptionId:l,formMessageId:u,...o},e[4]=t.name,e[5]=o,e[6]=s,e[7]=c,e[8]=l,e[9]=u,e[10]=d):d=e[10],d},bO=K.createContext({}),xO=K.forwardRef((e,t)=>{let n=(0,X.c)(14),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=K.useId(),o;n[3]===a?o=n[4]:(o={id:a},n[3]=a,n[4]=o);let s;n[5]===r?s=n[6]:(s=H(`flex flex-col gap-1`,r),n[5]=r,n[6]=s);let c;n[7]!==i||n[8]!==t||n[9]!==s?(c=(0,q.jsx)(`div`,{ref:t,className:s,...i}),n[7]=i,n[8]=t,n[9]=s,n[10]=c):c=n[10];let l;return n[11]!==o||n[12]!==c?(l=(0,q.jsx)(bO,{value:o,children:c}),n[11]=o,n[12]=c,n[13]=l):l=n[13],l});xO.displayName=`FormItem`;var SO=K.forwardRef((e,t)=>{let n=(0,X.c)(11),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{error:a,formItemId:o}=yO();if(!i.children)return;let s=a&&`text-destructive`,c;n[3]!==r||n[4]!==s?(c=H(s,r),n[3]=r,n[4]=s,n[5]=c):c=n[5];let l;return n[6]!==o||n[7]!==i||n[8]!==t||n[9]!==c?(l=(0,q.jsx)(ut,{ref:t,className:c,htmlFor:o,...i}),n[6]=o,n[7]=i,n[8]=t,n[9]=c,n[10]=l):l=n[10],l});SO.displayName=`FormLabel`;var CO=K.forwardRef((e,t)=>{let n=(0,X.c)(8),r;n[0]===e?r=n[1]:({...r}=e,n[0]=e,n[1]=r);let{error:i,formItemId:a,formDescriptionId:o,formMessageId:s}=yO(),c=i?`${o} ${s}`:o,l=!!i,u;return n[2]!==a||n[3]!==r||n[4]!==t||n[5]!==c||n[6]!==l?(u=(0,q.jsx)(ce,{ref:t,id:a,"aria-describedby":c,"aria-invalid":l,...r}),n[2]=a,n[3]=r,n[4]=t,n[5]=c,n[6]=l,n[7]=u):u=n[7],u});CO.displayName=`FormControl`;var wO=K.forwardRef((e,t)=>{let n=(0,X.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{formDescriptionId:a}=yO();if(!i.children)return null;let o;n[3]===r?o=n[4]:(o=H(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,q.jsx)(`p`,{ref:t,id:a,className:o,...i}),n[5]=a,n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});wO.displayName=`FormDescription`;var TO=K.forwardRef((e,t)=>{let n=(0,X.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{error:o,formMessageId:s}=yO(),c=o?.message?String(o?.message):r;if(!c)return null;let l;n[4]===i?l=n[5]:(l=H(`text-xs font-medium text-destructive`,i),n[4]=i,n[5]=l);let u;return n[6]!==c||n[7]!==s||n[8]!==a||n[9]!==t||n[10]!==l?(u=(0,q.jsx)(`p`,{ref:t,id:s,className:l,...a,children:c}),n[6]=c,n[7]=s,n[8]=a,n[9]=t,n[10]=l,n[11]=u):u=n[11],u});TO.displayName=`FormMessage`;var EO=e=>{let t=(0,X.c)(7),{className:n}=e,{error:r}=yO(),i=r?.message?String(r?.message):null;if(!i)return null;let a;t[0]===n?a=t[1]:(a=H(`stroke-[1.8px]`,n),t[0]=n,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,q.jsx)(wo,{className:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,q.jsx)(bt,{content:i,children:o}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s};EO.displayName=`FormMessageTooltip`;function DO(e){return e?.message}function OO(e){return`unwrap`in e?e.unwrap():e}function kO(e){let t=e=>{if(e instanceof D){let t=[...e.values];return e.values.size===1?t[0]:t}if(e instanceof S){let t=e.def.defaultValue;return typeof t==`function`?t():t}if(pO(e))return t(e.in);if(mO(e))return e.def.items.map(e=>t(e));if(`unwrap`in e)return t(OO(e))};return e instanceof x||e instanceof A?t(e.options[0]):fO(e)?jO(e)?[kO(e.element)]:[]:e instanceof O?``:e instanceof N?e.options[0]:e instanceof C?Object.fromEntries(Object.entries(e.shape).map(([e,n])=>[e,t(n)])):t(e)}function AO(e){if(e instanceof D)return e;if(e instanceof C){let t=e.shape.type;if(t instanceof D)return t;throw Error(`Invalid schema`)}if(e instanceof x||e instanceof A)return AO(e.options[0]);throw R.warn(e),Error(`Invalid schema`)}function jO(e){return!e.safeParse([]).success}var MO=Ce(H(`inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,`data-[state=on]:bg-muted data-[state=on]:text-muted-foreground`),{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted hover:text-muted-foreground`},size:{default:`h-9 px-3`,xs:`h-4 w-4`,sm:`h-6 px-2`,lg:`h-10 px-5`}},defaultVariants:{variant:`default`,size:`default`}}),NO=K.forwardRef((e,t)=>{let n=(0,X.c)(13),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,variant:o,size:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s;n[5]!==r||n[6]!==a||n[7]!==o?(s=H(MO({variant:o,size:a,className:r})),n[5]=r,n[6]=a,n[7]=o,n[8]=s):s=n[8];let c;return n[9]!==i||n[10]!==t||n[11]!==s?(c=(0,q.jsx)(yo,{ref:t,className:s,...i}),n[9]=i,n[10]=t,n[11]=s,n[12]=c):c=n[12],c});NO.displayName=yo.displayName;var PO=`
113
+ `,FO=e=>{let t=(0,X.c)(24),{value:n,options:r,onChange:i,className:a,placeholder:o,textAreaClassName:s,comboBoxClassName:c}=e,[l,u]=(0,K.useState)(!1),d;t[0]===n?d=t[1]:(d=LO(n),t[0]=n,t[1]=d);let f=d,p;t[2]!==c||t[3]!==i||t[4]!==r||t[5]!==o||t[6]!==l||t[7]!==s||t[8]!==f?(p=()=>l?(0,q.jsx)(IO,{value:f,className:s,onChange:i,placeholder:o?`${o}: one per line`:`One value per line`}):(0,q.jsx)(cO,{placeholder:o,displayValue:RO,className:H(`w-full max-w-[400px]`,c),multiple:!0,value:f,onValueChange:i,keepPopoverOpenOnSelect:!0,chips:!0,chipsClassName:`flex-row flex-wrap min-w-[210px]`,children:r.map(zO)}),t[2]=c,t[3]=i,t[4]=r,t[5]=o,t[6]=l,t[7]=s,t[8]=f,t[9]=p):p=t[9];let m=p,h;t[10]===a?h=t[11]:(h=H(`flex gap-1`,a),t[10]=a,t[11]=h);let g;t[12]===m?g=t[13]:(g=m(),t[12]=m,t[13]=g);let _=l?`Switch to multi-select`:`Switch to textarea`,v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,q.jsx)(Wo,{className:`w-3 h-3`}),t[14]=v):v=t[14];let y;t[15]===l?y=t[16]:(y=(0,q.jsx)(NO,{size:`xs`,onPressedChange:u,pressed:l,children:v}),t[15]=l,t[16]=y);let b;t[17]!==_||t[18]!==y?(b=(0,q.jsx)(bt,{content:_,children:y}),t[17]=_,t[18]=y,t[19]=b):b=t[19];let x;return t[20]!==h||t[21]!==g||t[22]!==b?(x=(0,q.jsxs)(`div`,{className:h,children:[g,b]}),t[20]=h,t[21]=g,t[22]=b,t[23]=x):x=t[23],x},IO=e=>{let t=(0,X.c)(11),{className:n,value:r,onChange:i,placeholder:a}=e,o,s;if(t[0]!==r){let e=LO(r);o=zt,s=e.join(PO),t[0]=r,t[1]=o,t[2]=s}else o=t[1],s=t[2];let c;t[3]===i?c=t[4]:(c=e=>{if(e.target.value===``){i([]);return}i(e.target.value.split(PO))},t[3]=i,t[4]=c);let l=a?`${a}: one per line`:`One value per line`,u;return t[5]!==o||t[6]!==n||t[7]!==s||t[8]!==c||t[9]!==l?(u=(0,q.jsx)(o,{value:s,className:n,rows:4,onChange:c,placeholder:l}),t[5]=o,t[6]=n,t[7]=s,t[8]=c,t[9]=l,t[10]=u):u=t[10],u};function LO(e){return e==null?[]:Array.isArray(e)?e:[e].filter(e=>e!=null||e!==``)}function RO(e){return e}function zO(e){return(0,q.jsx)(lO,{value:e,children:e},e)}var BO=[],VO=e=>{let t=(0,X.c)(9),{schema:n,form:r,path:i,renderers:a,children:o}=e,s=i===void 0?``:i,c=a===void 0?BO:a,l;t[0]!==r||t[1]!==s||t[2]!==c||t[3]!==n?(l=HO({schema:n,form:r,path:s,renderers:c}),t[0]=r,t[1]=s,t[2]=c,t[3]=n,t[4]=l):l=t[4];let u;return t[5]!==o||t[6]!==r||t[7]!==l?(u=(0,q.jsxs)(bT,{...r,children:[o,l]}),t[5]=o,t[6]=r,t[7]=l,t[8]=u):u=t[8],u};function HO({schema:e,form:t,path:n,renderers:r}){for(let i of r){let{isMatch:r,Component:a}=i;if(r(e))return(0,q.jsx)(a,{schema:e,form:t,path:n})}let{label:i,description:a,special:o,direction:s=`column`,minLength:c}=KE.parse(e.description||``);if(e instanceof S){let i=e.unwrap();return i=!i.description&&e.description?i.describe(e.description):i,HO({schema:i,form:t,path:n,renderers:r})}if(e instanceof w){let i=e.unwrap();return i=!i.description&&e.description?i.describe(e.description):i,HO({schema:i,form:t,path:n,renderers:r})}if(e instanceof C)return(0,q.jsxs)(`div`,{className:H(`flex`,s===`row`?`flex-row gap-6 items-start`:s===`two-columns`?`grid grid-cols-2 gap-y-6`:`flex-col gap-6`),children:[(0,q.jsx)(SO,{children:i}),z.entries(e.shape).map(([e,i])=>{let a=i instanceof D,o=HO({schema:i,form:t,path:JO(n,e),renderers:r});return a?(0,q.jsx)(K.Fragment,{children:o},e):(0,q.jsx)(`div`,{className:`flex flex-row align-start`,children:o},e)})]});if(e instanceof O)return o===`time`?(0,q.jsx)(vO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{children:i}),(0,q.jsx)(wO,{children:a}),(0,q.jsx)(CO,{children:(0,q.jsx)(an,{...e,onValueChange:e.onChange,type:`time`,className:`my-0`})}),(0,q.jsx)(TO,{})]})}):(0,q.jsx)(WO,{schema:e,form:t,path:n});if(e instanceof M)return(0,q.jsx)(vO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(xO,{children:[(0,q.jsxs)(`div`,{className:H(`flex flex-row gap-2`,a?`items-start`:`items-center`),children:[(0,q.jsx)(CO,{children:(0,q.jsx)(Ow,{"data-testid":`marimo-plugin-data-frames-boolean-checkbox`,checked:e.value,onCheckedChange:e.onChange,className:a?`mt-0.5`:void 0})}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(SO,{children:i}),(0,q.jsx)(wO,{children:a})]})]}),(0,q.jsx)(TO,{})]})});if(e instanceof ee)return o===`random_number_button`?(0,q.jsx)(vO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(St,{size:`xs`,"data-testid":`marimo-plugin-data-frames-random-number-button`,variant:`secondary`,onClick:()=>{e.onChange(qE())},children:[(0,q.jsx)(zo,{className:`w-3.5 h-3.5 mr-1`}),i]})}):(0,q.jsx)(vO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{children:i}),(0,q.jsx)(wO,{children:a}),(0,q.jsx)(CO,{children:(0,q.jsx)(nn,{...e,className:`my-0`,onValueChange:e.onChange})}),(0,q.jsx)(TO,{})]})});if(e instanceof E){let e=o===`datetime`?`datetime-local`:o===`time`?`time`:`date`;return(0,q.jsx)(vO,{control:t.control,name:n,render:({field:t})=>(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{children:i}),(0,q.jsx)(wO,{children:a}),(0,q.jsx)(CO,{children:(0,q.jsx)(an,{...t,onValueChange:t.onChange,type:e,className:`my-0`})}),(0,q.jsx)(TO,{})]})})}if(e instanceof P)return(0,q.jsx)(WO,{schema:e,form:t,path:n});if(e instanceof N){let r=e.options.map(e=>e.toString());return(0,q.jsx)(KO,{schema:e,form:t,path:n,options:r})}if(e instanceof k){if(o===`text_area_multiline`)return(0,q.jsx)(GO,{schema:e,form:t,path:n});let a=e.element;if(a instanceof N){let r=a.options.map(e=>e.toString());return(0,q.jsx)(qO,{schema:e,form:t,path:n,itemLabel:i,options:r})}return(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(ut,{children:i}),(0,q.jsx)(UO,{schema:e.element,form:t,path:n,minLength:c,renderers:r},n)]})}if(e instanceof A){let a=e.def,o=a.options,s=a.discriminator,c=e=>o.find(t=>AO(t).value===e);return(0,q.jsx)(vO,{control:t.control,name:n,render:({field:e})=>{let a=e.value,l=o.map(e=>AO(e).value),u=a&&typeof a==`object`&&s in a?a[s]:l[0],d=c(u);return(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(SO,{className:`mb-2`,children:i}),(0,q.jsx)(`div`,{className:`flex border-b mb-4`,children:l.map(t=>(0,q.jsx)(`button`,{type:`button`,className:`px-4 py-2 text-sm ${u===t?`border-b-2 border-primary font-medium`:`text-muted-foreground`}`,onClick:()=>{let n=c(t);n?e.onChange(kO(n)):e.onChange({[s]:t})},children:t},t))}),(0,q.jsx)(`div`,{className:`flex flex-col`,children:d&&HO({schema:d,form:t,path:n,renderers:r})},u)]})}})}return e instanceof x?(0,q.jsx)(vO,{control:t.control,name:n,render:({field:a})=>{let o=e.options,s=a.value,c=o.map(e=>AO(e).value);s||=c[0];let l=o.find(e=>AO(e).value===s);return(0,q.jsxs)(`div`,{className:`flex flex-col mb-4 gap-1`,children:[(0,q.jsx)(SO,{children:i}),(0,q.jsx)(ft,{"data-testid":`marimo-plugin-data-frames-union-select`,...a,children:c.map(e=>(0,q.jsx)(`option`,{value:e,children:e},e))}),l&&HO({schema:l,form:t,path:n,renderers:r})]})}}):e instanceof D?(0,q.jsx)(vO,{control:t.control,name:n,render:({field:t})=>(0,q.jsx)(`input`,{...t,type:`hidden`,value:String([...e.values][0]??``)})}):`unwrap`in e?HO({schema:OO(e),form:t,path:n,renderers:r}):pO(e)?HO({schema:e.in,form:t,path:n,renderers:r}):(0,q.jsxs)(`div`,{children:[`Unknown schema type`,` `,e==null?n:JSON.stringify(e.type??e)]})}var UO=e=>{let t=(0,X.c)(39),{schema:n,form:r,path:i,minLength:a,renderers:o}=e,s;t[0]===n.description?s=t[1]:(s=KE.parse(n.description||``),t[0]=n.description,t[1]=s);let{label:c,description:l}=s,u=r.control,d;t[2]!==u||t[3]!==i?(d={control:u,name:i},t[2]=u,t[3]=i,t[4]=d):d=t[4];let{fields:f,append:p,remove:m}=fE(d),h=a!=null&&f.length<a,g=a==null||f.length>a,_;t[5]===c?_=t[6]:(_=(0,q.jsx)(SO,{children:c}),t[5]=c,t[6]=_);let v;t[7]===l?v=t[8]:(v=(0,q.jsx)(wO,{children:l}),t[7]=l,t[8]=v);let y;if(t[9]!==g||t[10]!==f||t[11]!==r||t[12]!==i||t[13]!==m||t[14]!==o||t[15]!==n){let e;t[17]!==g||t[18]!==r||t[19]!==i||t[20]!==m||t[21]!==o||t[22]!==n?(e=(e,t)=>(0,q.jsxs)(`div`,{className:`flex flex-row pl-2 ml-2 border-l-2 border-disabled hover-actions-parent relative pr-5 pt-1 items-center w-fit`,onKeyDown:xt.onEnter(YO),children:[HO({schema:n,form:r,path:`${i}[${t}]`,renderers:o}),g&&(0,q.jsx)(on,{className:`w-4 h-4 ml-2 my-1 text-muted-foreground hover:text-destructive cursor-pointer absolute right-0 top-5`,onClick:()=>{m(t)}})]},e.id),t[17]=g,t[18]=r,t[19]=i,t[20]=m,t[21]=o,t[22]=n,t[23]=e):e=t[23],y=f.map(e),t[9]=g,t[10]=f,t[11]=r,t[12]=i,t[13]=m,t[14]=o,t[15]=n,t[16]=y}else y=t[16];let b;t[24]!==h||t[25]!==a?(b=h&&(0,q.jsx)(`div`,{className:`text-destructive text-xs font-semibold`,children:(0,q.jsxs)(`div`,{children:[`At least `,a,` required.`]})}),t[24]=h,t[25]=a,t[26]=b):b=t[26];let x;t[27]!==p||t[28]!==n?(x=()=>{p(kO(n))},t[27]=p,t[28]=n,t[29]=x):x=t[29];let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,q.jsx)($t,{className:`w-3.5 h-3.5 mr-1`}),t[30]=S):S=t[30];let C;t[31]===x?C=t[32]:(C=(0,q.jsx)(`div`,{children:(0,q.jsxs)(St,{size:`xs`,"data-testid":`marimo-plugin-data-frames-add-array-item`,variant:`text`,className:`hover:text-accent-foreground`,onClick:x,children:[S,`Add`]})}),t[31]=x,t[32]=C);let w;return t[33]!==_||t[34]!==v||t[35]!==y||t[36]!==b||t[37]!==C?(w=(0,q.jsxs)(`div`,{className:`flex flex-col gap-2 min-w-[220px]`,children:[_,v,y,b,C]}),t[33]=_,t[34]=v,t[35]=y,t[36]=b,t[37]=C,t[38]=w):w=t[38],w},WO=e=>{let t=(0,X.c)(21),{schema:n,form:r,path:i}=e,a;t[0]===n.description?a=t[1]:(a=KE.parse(n.description),t[0]=n.description,t[1]=a);let{label:o,description:s,placeholder:c,disabled:l,inputType:u}=a;if(u===`textarea`){let e;t[2]!==s||t[3]!==l||t[4]!==o||t[5]!==c?(e=e=>{let{field:t}=e;return(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{children:o}),(0,q.jsx)(wO,{children:s}),(0,q.jsx)(CO,{children:(0,q.jsx)(zt,{...t,value:t.value,onChange:t.onChange,className:`my-0`,placeholder:c,disabled:l})}),(0,q.jsx)(TO,{})]})},t[2]=s,t[3]=l,t[4]=o,t[5]=c,t[6]=e):e=t[6];let n;return t[7]!==r.control||t[8]!==i||t[9]!==e?(n=(0,q.jsx)(vO,{control:r.control,name:i,render:e}),t[7]=r.control,t[8]=i,t[9]=e,t[10]=n):n=t[10],n}let d;t[11]!==s||t[12]!==l||t[13]!==u||t[14]!==o||t[15]!==c?(d=e=>{let{field:t}=e;return(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{children:o}),(0,q.jsx)(wO,{children:s}),(0,q.jsx)(CO,{children:(0,q.jsx)(an,{...t,type:u,value:t.value,onValueChange:t.onChange,className:`my-0`,placeholder:c,disabled:l})}),(0,q.jsx)(TO,{})]})},t[11]=s,t[12]=l,t[13]=u,t[14]=o,t[15]=c,t[16]=d):d=t[16];let f;return t[17]!==r.control||t[18]!==i||t[19]!==d?(f=(0,q.jsx)(vO,{control:r.control,name:i,render:d}),t[17]=r.control,t[18]=i,t[19]=d,t[20]=f):f=t[20],f},GO=e=>{let t=(0,X.c)(10),{schema:n,form:r,path:i}=e,a;t[0]===n.description?a=t[1]:(a=KE.parse(n.description),t[0]=n.description,t[1]=a);let{label:o,description:s,placeholder:c}=a,l;t[2]!==s||t[3]!==o||t[4]!==c?(l=e=>{let{field:t}=e;return(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{children:o}),(0,q.jsx)(wO,{children:s}),(0,q.jsx)(CO,{children:(0,q.jsx)(IO,{...t,placeholder:c})}),(0,q.jsx)(TO,{})]})},t[2]=s,t[3]=o,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==r.control||t[7]!==i||t[8]!==l?(u=(0,q.jsx)(vO,{control:r.control,name:i,render:l}),t[6]=r.control,t[7]=i,t[8]=l,t[9]=u):u=t[9],u},KO=e=>{let t=(0,X.c)(22),{schema:n,form:r,path:i,options:a,textTransform:o}=e,s;t[0]===n.description?s=t[1]:(s=KE.parse(n.description),t[0]=n.description,t[1]=s);let{label:c,description:l,disabled:u,special:d}=s;if(d===`radio_group`){let e;t[2]!==l||t[3]!==c||t[4]!==a||t[5]!==i?(e=e=>{let{field:t}=e;return(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{children:c}),(0,q.jsx)(wO,{children:l}),(0,q.jsx)(CO,{children:(0,q.jsx)(uO,{className:`flex flex-row gap-2 pt-1 items-center`,value:t.value,onValueChange:t.onChange,children:a.map(e=>(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(dO,{value:e,id:`${i}-${e}`},e),(0,q.jsx)(SO,{className:`whitespace-pre`,htmlFor:`${i}-${e}`,children:Vr.startCase(e)})]},e))})}),(0,q.jsx)(TO,{})]})},t[2]=l,t[3]=c,t[4]=a,t[5]=i,t[6]=e):e=t[6];let n;return t[7]!==u||t[8]!==r.control||t[9]!==i||t[10]!==e?(n=(0,q.jsx)(vO,{control:r.control,name:i,disabled:u,render:e}),t[7]=u,t[8]=r.control,t[9]=i,t[10]=e,t[11]=n):n=t[11],n}let f;t[12]!==l||t[13]!==c||t[14]!==a||t[15]!==o?(f=e=>{let{field:t}=e;return(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{className:`whitespace-pre`,children:c}),(0,q.jsx)(wO,{children:l}),(0,q.jsx)(CO,{children:(0,q.jsxs)(_t,{"data-testid":`marimo-plugin-data-frames-select`,value:t.value,onValueChange:t.onChange,children:[(0,q.jsx)(gt,{className:`min-w-[180px]`,children:(0,q.jsx)(lt,{placeholder:`--`})}),(0,q.jsx)(pt,{children:(0,q.jsxs)(ht,{children:[a.map(e=>(0,q.jsx)(dt,{value:e,children:o?.(e)??e},e)),a.length===0&&(0,q.jsx)(dt,{disabled:!0,value:`--`,children:`No options`})]})})]})}),(0,q.jsx)(TO,{})]})},t[12]=l,t[13]=c,t[14]=a,t[15]=o,t[16]=f):f=t[16];let p;return t[17]!==u||t[18]!==r.control||t[19]!==i||t[20]!==f?(p=(0,q.jsx)(vO,{control:r.control,name:i,disabled:u,render:f}),t[17]=u,t[18]=r.control,t[19]=i,t[20]=f,t[21]=p):p=t[21],p},qO=e=>{let t=(0,X.c)(15),{schema:n,form:r,path:i,options:a,itemLabel:o,showSwitchable:s}=e,c;t[0]===n.description?c=t[1]:(c=KE.parse(n.description),t[0]=n.description,t[1]=c);let{label:l,description:u,placeholder:d}=c,f;t[2]!==o||t[3]!==d?(f=d??(o?`Select ${o?.toLowerCase()}`:void 0),t[2]=o,t[3]=d,t[4]=f):f=t[4];let p=f,m;t[5]!==u||t[6]!==l||t[7]!==a||t[8]!==p||t[9]!==s?(m=e=>{let{field:t}=e,n=LO(t.value);return(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{className:`whitespace-pre`,children:l}),(0,q.jsx)(wO,{children:u}),(0,q.jsx)(CO,{children:s?(0,q.jsx)(FO,{...t,value:n,options:a,placeholder:p}):(0,q.jsx)(cO,{className:`min-w-[180px]`,placeholder:p,displayValue:XO,multiple:!0,chips:!0,keepPopoverOpenOnSelect:!0,value:n,onValueChange:t.onChange,children:a.map(ZO)})}),(0,q.jsx)(TO,{})]})},t[5]=u,t[6]=l,t[7]=a,t[8]=p,t[9]=s,t[10]=m):m=t[10];let h;return t[11]!==r.control||t[12]!==i||t[13]!==m?(h=(0,q.jsx)(vO,{control:r.control,name:i,render:m}),t[11]=r.control,t[12]=i,t[13]=m,t[14]=h):h=t[14],h};function JO(...e){return e.filter(e=>e!==``).join(`.`)}function YO(e){return e.preventDefault()}function XO(e){return Vr.startCase(e)}function ZO(e){return(0,q.jsx)(lO,{value:e,children:e},e)}function QO({moduleName:e,variableName:t,onAddImport:n,appStore:r=u}){if(t in r.get(jh))return!1;let{cellData:i,cellIds:a}=r.get(wM),o=RegExp(`import[ \t]+${e}[ \t]+as[ \t]+${t}`,`g`);for(let e of a.inOrderIds)if(o.test(i[e].code))return!1;return n(`import ${e} as ${t}`),!0}function $O({autoInstantiate:e,createNewCell:t,fromCellId:n,before:r}){let i=Hr(),a=null;return QO({moduleName:`marimo`,variableName:`mo`,onAddImport:o=>{a=Ii.create(),t({cellId:n??`__end__`,before:r??!1,code:o,lastCodeRun:e?o:void 0,newCellId:a,skipIfCodeExists:!0,autoFocus:!1}),e&&i.sendRun({cellIds:[a],codes:[o]})}})?a:null}function ek({autoInstantiate:e,createNewCell:t,fromCellId:n}){let r=Hr(),i=null;return QO({moduleName:`altair`,variableName:`alt`,onAddImport:a=>{i=Ii.create(),t({cellId:n??`__end__`,before:!1,code:a,lastCodeRun:e?a:void 0,newCellId:i,skipIfCodeExists:!0,autoFocus:!1}),e&&r.sendRun({cellIds:[i],codes:[a]})}})?i:null}function tk(){return{focusedCellId:null,lastFocusedCellId:null}}var{reducer:nk,createActions:rk,valueAtom:ik,useActions:ak}=jr(tk,{focusCell:(e,t)=>({...e,focusedCellId:t.cellId,lastFocusedCellId:t.cellId}),toggleCell:(e,t)=>e.focusedCellId===t.cellId?{...e,focusedCellId:null}:{...e,focusedCellId:t.cellId,lastFocusedCellId:t.cellId},blurCell:e=>({...e,focusedCellId:null})}),ok=o(e=>e(ik).lastFocusedCellId);function sk(){return s(ok)}var ck=o(e=>{let t=e(ok);return!t||t===`__scratch__`?null:uk(t,e(wM))});function lk(e){return o(t=>uk(e,t(wM)))}function uk(e,t){let{cellData:n,cellHandles:r,cellRuntime:i}=t,a=n[e],o=i[e],s=r[e]?.current;return!a||!s?null:{cellId:e,name:a.name,config:a.config,status:o?o.status:`idle`,getEditorView:()=>s.editorViewOrNull,hasOutput:o?.output!=null,hasConsoleOutput:o?.consoleOutputs!=null}}function dk(e,t){if(!t)return{recommended:[],other:[...e]};let n;try{n=new RegExp(t,`i`)}catch{return{recommended:[],other:[...e]}}let r=[],i=[];for(let t of e)n.test(t)?r.push(t):i.push(t);return{recommended:r,other:i}}var fk=e=>`Use "${e}"`,pk=e=>{let t=(0,X.c)(96),{value:n,onChange:r,placeholder:i,secretsOnly:a,recommendedKeys:o,otherKeys:s,onCreateSecret:c,className:l,searchPlaceholder:u,formatCustomValueLabel:d,createSecretLabel:f,allowCustomValue:p,allowCreateSecret:m}=e,h=a!==void 0&&a,g=d===void 0?fk:d,_=f===void 0?`Create a new secret`:f,[v,y]=(0,K.useState)(!1),[b,x]=(0,K.useState)(``),S,C,w,T,E,D,O,k,A,j,M,N,P,ee,te,ne,re,F;if(t[0]!==m||t[1]!==p||t[2]!==l||t[3]!==g||t[4]!==r||t[5]!==v||t[6]!==i||t[7]!==b||t[8]!==u||t[9]!==h||t[10]!==n){F=b.trim();let e=!h&&F.length>0&&F!==n&&(p?.(F)??!0);O=m?.(F)??!0;let a;bb0:{if(!n){a=null;break bb0}if(Jt(n)){let e;t[29]===n?e=t[30]:(e=qt(n),t[29]=n,t[30]=e),a=e;break bb0}a=n}let o=a,s;t[31]===r?s=t[32]:(s=e=>{r(Ht(e)),y(!1),x(``)},t[31]=r,t[32]=s),D=s;let c;t[33]===r?c=t[34]:(c=e=>{r(e),y(!1),x(``)},t[33]=r,t[34]=c);let d=c,f;t[35]===r?f=t[36]:(f=()=>{r(``),x(``),y(!1)},t[35]=r,t[36]=f),E=f,t[37]===l?M=t[38]:(M=H(`flex w-full min-w-48 mb-1 items-center gap-1`,l),t[37]=l,t[38]=M),T=tO,re=!0,k=v,t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{y(e),e||x(``)},t[39]=A):A=t[39];let _;t[40]===n?_=t[41]:(_=H(`flex h-6 min-w-0 flex-1 shadow-xs-solid items-center justify-between`,`rounded-sm border border-input bg-background px-1.5 text-sm font-code ring-offset-background placeholder:text-muted-foreground`,`hover:shadow-sm-solid focus:outline-hidden focus:ring-1 focus:ring-ring focus:border-primary focus:shadow-md-solid`,Jt(n)&&`bg-accent`),t[40]=n,t[41]=_);let ie;t[42]!==o||t[43]!==i||t[44]!==n?(ie=(0,q.jsx)(`span`,{className:`truncate flex-1 min-w-0 text-left flex items-center gap-1.5`,children:o?(0,q.jsxs)(q.Fragment,{children:[Jt(n)&&(0,q.jsx)(Bt,{className:`h-3 w-3 shrink-0 opacity-70`}),(0,q.jsx)(`span`,{className:`truncate`,children:o})]}):(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:i})}),t[42]=o,t[43]=i,t[44]=n,t[45]=ie):ie=t[45];let I;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,q.jsx)(Pt,{className:`ml-1 h-4 w-4 opacity-50 shrink-0`}),t[46]=I):I=t[46],t[47]!==v||t[48]!==_||t[49]!==ie?(j=(0,q.jsx)(nO,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:_,"aria-expanded":v,children:[ie,I]})}),t[47]=v,t[48]=_,t[49]=ie,t[50]=j):j=t[50],w=oO,te=`w-(--radix-popover-trigger-width) p-0`,ne=`start`,C=KD;let ae=u??(h?`Search secrets...`:`Type a value or search secrets...`);t[51]!==b||t[52]!==ae?(ee=(0,q.jsx)(JD,{placeholder:ae,rootClassName:`px-1 h-8`,autoFocus:!0,value:b,onValueChange:x}),t[51]=b,t[52]=ae,t[53]=ee):ee=t[53],S=YD,N=`max-h-60 overscroll-contain`,P=e&&(0,q.jsx)(ZD,{children:(0,q.jsx)($D,{value:`use custom value ${F}`,onSelect:()=>d(F),children:g(F)})}),t[0]=m,t[1]=p,t[2]=l,t[3]=g,t[4]=r,t[5]=v,t[6]=i,t[7]=b,t[8]=u,t[9]=h,t[10]=n,t[11]=S,t[12]=C,t[13]=w,t[14]=T,t[15]=E,t[16]=D,t[17]=O,t[18]=k,t[19]=A,t[20]=j,t[21]=M,t[22]=N,t[23]=P,t[24]=ee,t[25]=te,t[26]=ne,t[27]=re,t[28]=F}else S=t[11],C=t[12],w=t[13],T=t[14],E=t[15],D=t[16],O=t[17],k=t[18],A=t[19],j=t[20],M=t[21],N=t[22],P=t[23],ee=t[24],te=t[25],ne=t[26],re=t[27],F=t[28];let ie;t[54]!==_||t[55]!==c||t[56]!==O||t[57]!==F?(ie=O&&(0,q.jsx)(ZD,{className:`mt-0`,children:(0,q.jsxs)($D,{value:`create new secret ${F}`,onSelect:()=>{let e=F||void 0;y(!1),x(``),c(e)},children:[(0,q.jsx)(To,{className:`mr-2 h-3.5 w-3.5`}),_]})}),t[54]=_,t[55]=c,t[56]=O,t[57]=F,t[58]=ie):ie=t[58];let I;t[59]!==o||t[60]!==D?(I=o.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(QD,{className:`mt-0`}),(0,q.jsx)(ZD,{heading:`Recommended`,children:o.map(e=>(0,q.jsxs)($D,{value:e,onSelect:()=>D(e),children:[(0,q.jsx)(Bt,{className:`mr-2 h-3 w-3 opacity-70`}),e]},e))})]}),t[59]=o,t[60]=D,t[61]=I):I=t[61];let ae;t[62]!==s||t[63]!==o.length||t[64]!==D?(ae=s.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(QD,{className:`mt-0`}),(0,q.jsx)(ZD,{heading:o.length>0?`Other`:void 0,children:s.map(e=>(0,q.jsxs)($D,{value:e,onSelect:()=>D(e),children:[(0,q.jsx)(Bt,{className:`mr-2 h-3 w-3 opacity-70`}),e]},e))})]}),t[62]=s,t[63]=o.length,t[64]=D,t[65]=ae):ae=t[65];let L;t[66]!==S||t[67]!==ie||t[68]!==I||t[69]!==ae||t[70]!==N||t[71]!==P?(L=(0,q.jsxs)(S,{className:N,children:[P,ie,I,ae]}),t[66]=S,t[67]=ie,t[68]=I,t[69]=ae,t[70]=N,t[71]=P,t[72]=L):L=t[72];let oe;t[73]!==C||t[74]!==L||t[75]!==ee?(oe=(0,q.jsxs)(C,{children:[ee,L]}),t[73]=C,t[74]=L,t[75]=ee,t[76]=oe):oe=t[76];let se;t[77]!==w||t[78]!==oe||t[79]!==te||t[80]!==ne?(se=(0,q.jsx)(w,{className:te,align:ne,children:oe}),t[77]=w,t[78]=oe,t[79]=te,t[80]=ne,t[81]=se):se=t[81];let R;t[82]!==T||t[83]!==k||t[84]!==A||t[85]!==j||t[86]!==se||t[87]!==re?(R=(0,q.jsxs)(T,{modal:re,open:k,onOpenChange:A,children:[j,se]}),t[82]=T,t[83]=k,t[84]=A,t[85]=j,t[86]=se,t[87]=re,t[88]=R):R=t[88];let ce;t[89]!==E||t[90]!==n?(ce=n&&(0,q.jsx)(`button`,{type:`button`,"aria-label":`Clear`,className:H(`flex h-6 w-6 shrink-0 items-center justify-center rounded-sm`,`text-muted-foreground hover:bg-muted hover:text-foreground`,`focus:outline-hidden focus:ring-1 focus:ring-ring`),onClick:E,children:(0,q.jsx)(Ft,{className:`h-3.5 w-3.5`})}),t[89]=E,t[90]=n,t[91]=ce):ce=t[91];let le;return t[92]!==M||t[93]!==R||t[94]!==ce?(le=(0,q.jsxs)(`div`,{className:M,children:[R,ce]}),t[92]=M,t[93]=R,t[94]=ce,t[95]=le):le=t[95],le},mk=(0,K.createContext)({providerNames:[],secretKeys:[],loading:!1,error:void 0,refreshSecrets:ae.NOOP}),hk=()=>(0,K.use)(mk),gk=e=>{let t=(0,X.c)(14),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let{data:i,isPending:a,error:o,refetch:s}=fi(Sk,r);i?.secretKeys,i?.providerNames;let c;t[1]===i?.secretKeys?c=t[2]:(c=i?.secretKeys||[],t[1]=i?.secretKeys,t[2]=c);let l;t[3]===i?.providerNames?l=t[4]:(l=i?.providerNames||[],t[3]=i?.providerNames,t[4]=l);let u;t[5]!==o||t[6]!==a||t[7]!==s||t[8]!==c||t[9]!==l?(u={secretKeys:c,providerNames:l,loading:a,error:o,refreshSecrets:s},t[5]=o,t[6]=a,t[7]=s,t[8]=c,t[9]=l,t[10]=u):u=t[10];let d=u,f;return t[11]!==n||t[12]!==d?(f=(0,q.jsx)(mk,{value:d,children:n}),t[11]=n,t[12]=d,t[13]=f):f=t[13],f},_k={isMatch:e=>{if(e instanceof O){let{optionRegex:t}=KE.parse(e.description||``);return!!t}return!1},Component:({schema:e,form:t,path:n})=>{let{secretKeys:r,providerNames:i,refreshSecrets:a}=hk(),{openModal:o,closeModal:s}=Vt(),{label:c,description:l,placeholder:u,optionRegex:d=``,inputType:f}=KE.parse(e.description||``),p=f===`password`,{recommended:m,other:h}=dk(r,d);return(0,q.jsx)(vO,{control:t.control,name:n,render:({field:e})=>(0,q.jsxs)(xO,{children:[(0,q.jsx)(SO,{children:c}),(0,q.jsx)(wO,{children:l}),(0,q.jsx)(CO,{children:(0,q.jsx)(pk,{value:e.value?String(e.value):``,onChange:e.onChange,placeholder:u,secretsOnly:p,recommendedKeys:m,otherKeys:h,onCreateSecret:t=>{o((0,q.jsx)(Yt,{providerNames:i,initialValue:t,onSuccess:t=>{a(),e.onChange(Ht(t)),s()},onClose:s}))}})}),(0,q.jsx)(TO,{})]})})}},vk={isMatch:e=>{if(e instanceof O){let{special:t}=KE.parse(e.description||``);return t===`secret_textarea`}return!1},Component:({schema:e,form:t,path:n})=>{let{secretKeys:r,providerNames:i,refreshSecrets:a}=hk(),{openModal:o,closeModal:s}=Vt(),{label:c,description:l,placeholder:u}=KE.parse(e.description||``);return(0,q.jsx)(vO,{control:t.control,name:n,render:({field:e})=>{let t=e.value?String(e.value):``,n=Xt(t)?Wt(t):t;return(0,q.jsxs)(xO,{children:[(0,q.jsxs)(SO,{className:`flex items-center gap-1`,children:[c,(0,q.jsx)(bt,{content:`Enter a path to a file on disk, or create a secret to paste JSON directly.`,delayDuration:300,children:(0,q.jsx)(`button`,{type:`button`,className:`inline-flex`,"aria-label":`Credential input help`,children:(0,q.jsx)(Mo,{className:`h-3.5 w-3.5`})})})]}),(0,q.jsx)(wO,{children:l}),(0,q.jsx)(CO,{children:(0,q.jsx)(pk,{value:n,onChange:t=>{e.onChange(!t||Jt(t)||Xt(t)?t:Ut(t))},placeholder:u,searchPlaceholder:`Type a file path or paste JSON`,formatCustomValueLabel:e=>`Use "${e}" as a file path`,createSecretLabel:`Paste JSON credentials`,allowCustomValue:e=>!Gt(e),allowCreateSecret:e=>!e||Gt(e),recommendedKeys:[],otherKeys:r,onCreateSecret:t=>{o((0,q.jsx)(Yt,{providerNames:i,initialValue:t,multiline:!0,onSuccess:t=>{a(),e.onChange(Ht(t)),s()},onClose:s}))}})}),(0,q.jsx)(TO,{})]})}})}};function yk(e){return e.provider!==`env`}function bk(e){return e.name}function xk(e){return e.keys}async function Sk(){let e=await Zt.request({}),t=Kt(e.secrets).filter(yk).map(bk);return{secretKeys:e.secrets.flatMap(xk).toSorted(),providerNames:t}}var Ck=[_k,vk],wk=e=>{let t=(0,X.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,q.jsx)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 gap-4`,children:n}),t[0]=n,t[1]=r),r},Tk=e=>{let t=(0,X.c)(9),{name:n,color:r,icon:i,onSelect:a}=e,o;t[0]===r?o=t[1]:(o={backgroundColor:r},t[0]=r,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,q.jsx)(`span`,{className:`text-white font-medium text-lg`,children:n}),t[2]=n,t[3]=s);let c;return t[4]!==i||t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,q.jsxs)(`button`,{type:`button`,className:`py-3 flex flex-col items-center justify-center gap-1 transition-[scale,filter,box-shadow] hover:scale-105 hover:brightness-110 rounded shadow-sm-solid hover:shadow-md-solid`,style:o,onClick:a,children:[i,s]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c},Ek=e=>{let t=(0,X.c)(25),{onBack:n,isValid:r,libraries:i,preferredLibrary:a,onLibraryChange:o,displayNames:s,libraryLabel:c}=e,l=c===void 0?`Preferred library`:c,u;t[0]===n?u=t[1]:(u=(0,q.jsx)(St,{type:`button`,variant:`outline`,onClick:n,children:`Back`}),t[0]=n,t[1]=u);let d=!r,f;t[2]===d?f=t[3]:(f=(0,q.jsx)(St,{type:`submit`,disabled:d,children:`Add`}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,q.jsx)(gt,{children:(0,q.jsx)(lt,{placeholder:`Select a library`})}),t[7]=m):m=t[7];let h;t[8]===l?h=t[9]:(h=(0,q.jsxs)(`div`,{className:`flex flex-col gap-1 items-end`,children:[m,(0,q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l})]}),t[8]=l,t[9]=h);let g;if(t[10]!==s||t[11]!==i){let e;t[13]===s?e=t[14]:(e=e=>(0,q.jsx)(dt,{value:e,children:s[e]??e},e),t[13]=s,t[14]=e),g=i.map(e),t[10]=s,t[11]=i,t[12]=g}else g=t[12];let _;t[15]===g?_=t[16]:(_=(0,q.jsx)(pt,{children:(0,q.jsx)(ht,{children:g})}),t[15]=g,t[16]=_);let v;t[17]!==o||t[18]!==a||t[19]!==h||t[20]!==_?(v=(0,q.jsx)(`div`,{children:(0,q.jsxs)(_t,{value:a,onValueChange:o,children:[h,_]})}),t[17]=o,t[18]=a,t[19]=h,t[20]=_,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==p?(y=(0,q.jsxs)(`div`,{className:`flex gap-2 justify-between`,children:[p,v]}),t[22]=v,t[23]=p,t[24]=y):y=t[24],y};function Dk(){let e=(0,X.c)(4),{createNewCell:t}=vN(),n=sk(),r=s(I),i;return e[0]!==r||e[1]!==t||e[2]!==n?(i=e=>{/\bmo\./.test(e)&&$O({autoInstantiate:r,createNewCell:t,fromCellId:n}),t({code:e,before:!1,cellId:n??`__end__`,skipIfCodeExists:!0})},e[0]=r,e[1]=t,e[2]=n,e[3]=i):i=e[3],i}function Ok(e){let t=(0,X.c)(3),n=Dk(),r;return t[0]!==n||t[1]!==e?(r=t=>{n(t.code),e?.()},t[0]=n,t[1]=e,t[2]=r):r=t[2],r}var kk=e=>{let t=(0,X.c)(30),{schema:n,libraries:r,preferredLibrary:i,displayNames:a,libraryLabel:o,generateCode:s,onSubmit:c,onBack:l}=e,u;t[0]===n?u=t[1]:(u=kO(n),t[0]=n,t[1]=u);let d=u,f;t[2]===n?f=t[3]:(f=GE(n),t[2]=n,t[3]=f);let p;t[4]!==d||t[5]!==f?(p={defaultValues:d,resolver:f,reValidateMode:`onChange`},t[4]=d,t[5]=f,t[6]=p):p=t[6];let m=FE(p),[h,g]=K.useState(i),_=Dk(),v;t[7]!==s||t[8]!==_||t[9]!==c||t[10]!==h?(v=e=>{_(s(e,h)),c()},t[7]=s,t[8]=_,t[9]=c,t[10]=h,t[11]=v):v=t[11];let y=v,b;t[12]!==m||t[13]!==y?(b=m.handleSubmit(y),t[12]=m,t[13]=y,t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,q.jsx)(gO,{}),t[15]=x):x=t[15];let S;t[16]!==m||t[17]!==n?(S=(0,q.jsx)(gk,{children:(0,q.jsx)(VO,{schema:n,form:m,renderers:Ck,children:x})}),t[16]=m,t[17]=n,t[18]=S):S=t[18];let C;t[19]!==a||t[20]!==m.formState.isValid||t[21]!==r||t[22]!==o||t[23]!==l||t[24]!==h?(C=(0,q.jsx)(Ek,{onBack:l,isValid:m.formState.isValid,libraries:r,preferredLibrary:h,onLibraryChange:g,displayNames:a,libraryLabel:o}),t[19]=a,t[20]=m.formState.isValid,t[21]=r,t[22]=o,t[23]=l,t[24]=h,t[25]=C):C=t[25];let w;return t[26]!==b||t[27]!==S||t[28]!==C?(w=(0,q.jsxs)(`form`,{onSubmit:b,className:`space-y-4`,children:[S,C]}),t[26]=b,t[27]=S,t[28]=C,t[29]=w):w=t[29],w};function Ak(e,t){return!t||e.category===`object-storage`==(t===`storage`)}function jk(e,t){let n=e.hidesWhen;return n.kind===`dialect`?n.substrings.some(e=>t.dialects.some(t=>t.includes(e))):n.protocols.some(e=>t.storageProtocols.has(e))?!0:n.backendTypes.some(e=>t.storageBackendTypes.has(e))}var Mk=o(0),Nk,Pk=0;function Fk(){let e=u.get(Mk);return(!Nk||Pk!==e)&&(Pk=e,Nk=V().then(()=>IC.request({})).then(e=>e.sources).catch(t=>{throw Pk===e&&(Nk=void 0),t})),Nk}function Ik(){Nk=void 0,u.set(Mk,e=>e+1)}var Lk=new Qt(`storage-list-entries`,async(e,t)=>{await Hr().listStorageEntries({requestId:e,...t})}),Rk=new Qt(`storage-download`,async(e,t)=>{await Hr().downloadStorage({requestId:e,...t})});function zk(e,t){return`${e}::${t??``}`}function Bk(e){return`${e}::`}function Vk(){return{namespaces:[],entriesByPath:new Map,pageMetadataByPath:new Map}}var{reducer:Hk,createActions:Uk,valueAtom:Wk,useActions:Gk}=jr(Vk,{setNamespaces:(e,t)=>{let n=new Map(e.namespaces.map(e=>[e.name,e]));for(let e of t.namespaces)n.set(e.name,e);return{...e,namespaces:[...n.values()]}},setEntries:(e,t)=>{let n=zk(t.namespace,t.prefix),r=new Map(e.entriesByPath),i=t.append&&r.has(n)?[...r.get(n)??[],...t.entries]:t.entries;r.set(n,i);let a=new Map(e.pageMetadataByPath);return a.set(n,{nextPageToken:t.nextPageToken??null}),{...e,entriesByPath:r,pageMetadataByPath:a}},clearNamespaceCache:(e,t)=>{let n=new Map(e.entriesByPath),r=new Map(e.pageMetadataByPath),i=Bk(t);for(let e of n.keys())e.startsWith(i)&&n.delete(e);for(let e of r.keys())e.startsWith(i)&&r.delete(e);return{...e,entriesByPath:n,pageMetadataByPath:r}},filterFromVariables:(e,t)=>{let n=new Set(t),r=e.namespaces.filter(e=>n.has(e.name));return{...e,namespaces:r}}}),Kk=()=>s(Wk),qk=o(e=>e(Wk).namespaces);function Jk(){return Gk()}async function Yk({namespace:e,prefix:t,pageToken:n,append:r,setEntries:i}){let a=await Lk.request({namespace:e,prefix:t??``,limit:150,...n==null?{}:{pageToken:n}});if(a.error)throw Error(a.error);return i({namespace:e,prefix:t,entries:a.entries,nextPageToken:a.next_page_token,append:r}),a}function Xk(e,t){let{entriesByPath:n,pageMetadataByPath:r}=Kk(),{setEntries:i}=Jk(),a=zk(e,t),o=n.get(a),s=r.get(a)?.nextPageToken??null,c=(0,K.useRef)(!1),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(),{isPending:p,error:m,refetch:h}=fi(async()=>{o||await Yk({namespace:e,prefix:t,setEntries:i})},[e,t,o===void 0]),g=(0,K.useCallback)(async()=>{if(!(s==null||c.current)){c.current=!0,u(!0),f(void 0);try{await Yk({namespace:e,prefix:t,pageToken:s,append:!0,setEntries:i})}catch(e){f(e instanceof Error?e:Error(String(e)))}finally{c.current=!1,u(!1)}}},[e,t,s,i]);return{entries:o??[],isPending:p&&!o,error:o?void 0:m,hasMore:s!==null,loadMore:g,isLoadingMore:l,loadMoreError:d,refetch:h}}function Zk(){let e=(0,X.c)(2),{setEntries:t}=Jk(),n;return e[0]===t?n=e[1]:(n=e=>Yk({...e,setEntries:t}),e[0]=t,e[1]=n),n}function Qk(){let e=(0,X.c)(2),t=s(Mk),n;return e[0]===t?n=e[1]:(n=[t],e[0]=t,e[1]=n),fi(Fk,n)}function $k(e){let t=(0,X.c)(6),{data:n}=Qk(),r=s(vp),i=s(qk),a;bb0:{if(!n){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],a=e;break bb0}let o;if(t[1]!==r||t[2]!==n||t[3]!==e||t[4]!==i){let a={dialects:[...r.values()].map(nA),storageProtocols:new Set(i.map(tA)),storageBackendTypes:new Set(i.map(eA))};o=n.filter(t=>Ak(t,e)&&!jk(t,a)),t[1]=r,t[2]=n,t[3]=e,t[4]=i,t[5]=o}else o=t[5];a=o}return a}function eA(e){return e.backendType.toLowerCase()}function tA(e){return e.protocol.toLowerCase()}function nA(e){return e.dialect.toLowerCase()}function rA(){let e=(0,X.c)(1),[,t]=(0,K.useState)(0),n;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t(iA)},e[0]=n):n=e[0],n}function iA(e){return e+1}var aA=e=>{let t=(0,X.c)(6),n=$k(`database`);if(n.length===0){let r;return t[0]!==n||t[1]!==e?(r=(0,q.jsx)(sA,{...e,detectedDataSources:n}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r}let r;return t[3]!==n||t[4]!==e?(r=(0,q.jsx)(oA,{...e,detectedDataSources:n}),t[3]=n,t[4]=e,t[5]=r):r=t[5],r},oA=e=>{let t=(0,X.c)(7),n,r;t[0]===e?(n=t[1],r=t[2]):({detectedDataSources:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=Ok(),a;return t[3]!==i||t[4]!==n||t[5]!==r?(a=(0,q.jsx)(sA,{...r,detectedDataSources:n,addDetectedDataSource:i}),t[3]=i,t[4]=n,t[5]=r,t[6]=a):a=t[6],a},sA=e=>{let t=(0,X.c)(42),{selectedEngine:n,onChange:r,cellId:i,detectedDataSources:a,addDetectedDataSource:o}=e,c=s(vp),l=[],u=[];for(let[e,t]of c.entries())zf.has(e)?l.push(t):u.push(t);let d=rA(),f;t[0]!==c||t[1]!==n?(f=n&&!c.has(n),t[0]=c,t[1]=n,t[2]=f):f=t[2];let p=f,m;t[3]!==o||t[4]!==c||t[5]!==a||t[6]!==r||t[7]!==d?(m=e=>{if(e===cA){window.open(uA,`_blank`);return}if(e.startsWith(lA)){let t=e.slice(lA.length),n=a.find(e=>e.id===t);n&&o&&o(n);return}let t=c.get(e);t&&(d(),r(t.name),bp(t.name))},t[3]=o,t[4]=c,t[5]=a,t[6]=r,t[7]=d,t[8]=m):m=t[8];let h=m,g=hA,_=_t,v;t[9]===i?v=t[10]:(v=Bw(i),t[9]=i,t[10]=v);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,q.jsx)(lt,{placeholder:`Select an engine`}),t[11]=y):y=t[11];let b;t[12]===v?b=t[13]:(b=(0,q.jsx)(fA,{...v,children:y}),t[12]=v,t[13]=b);let x=pt,S;t[14]===i?S=t[15]:(S=Bw(i),t[14]=i,t[15]=S);let C=ht,w;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,q.jsx)(ct,{children:`Database connections`}),t[16]=w):w=t[16];let T;t[17]!==p||t[18]!==n?(T=p&&(0,q.jsx)(dt,{value:n,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1 opacity-50`,children:[(0,q.jsx)(wo,{className:`h-3 w-3`}),(0,q.jsx)(`span`,{className:`truncate`,children:Tp(n)})]})},n),t[17]=p,t[18]=n,t[19]=T):T=t[19];let E=g(u),D=u.length>0&&(0,q.jsx)(mt,{}),O=g(l),k;t[20]===a?k=t[21]:(k=a.length>0&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(mt,{}),(0,q.jsx)(ct,{children:`Detected in your environment`}),a.map(gA)]}),t[20]=a,t[21]=k);let A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,q.jsx)(mt,{}),t[22]=A):A=t[22];let j;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,q.jsx)(dt,{className:`text-muted-foreground`,value:cA,children:(0,q.jsxs)(`a`,{className:`flex items-center gap-1`,href:uA,target:`_blank`,rel:`noreferrer`,children:[(0,q.jsx)(It,{className:`h-3 w-3`}),(0,q.jsx)(`span`,{children:`How to add a database connection`})]})}),t[23]=j):j=t[23];let M;t[24]!==C||t[25]!==E||t[26]!==D||t[27]!==O||t[28]!==k||t[29]!==w||t[30]!==T?(M=(0,q.jsxs)(C,{children:[w,T,E,D,O,k,A,j]}),t[24]=C,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=w,t[30]=T,t[31]=M):M=t[31];let N;t[32]!==x||t[33]!==M||t[34]!==S?(N=(0,q.jsx)(x,{...S,children:M}),t[32]=x,t[33]=M,t[34]=S,t[35]=N):N=t[35];let P;return t[36]!==_||t[37]!==h||t[38]!==n||t[39]!==N||t[40]!==b?(P=(0,q.jsx)(`div`,{className:`flex flex-row gap-1 items-center`,children:(0,q.jsxs)(_,{value:n,onValueChange:h,children:[b,N]})}),t[36]=_,t[37]=h,t[38]=n,t[39]=N,t[40]=b,t[41]=P):P=t[41],P},cA=`__help__`,lA=`__detected_source__:`,uA=`http://docs.marimo.io/guides/working_with_data/sql/#connecting-to-a-custom-database`,dA=()=>{let e=(0,X.c)(16),{sqlMode:t,setSQLMode:n}=$C(),r;e[0]!==n||e[1]!==t?(r=()=>{let e=t===`validate`?`default`:`validate`;e==="default"&&WC(),n(e)},e[0]=n,e[1]=t,e[2]=r):r=e[2];let i=r,a=_A,o=vA,s;e[3]===t?s=e[4]:(s=o(t),e[3]=t,e[4]=s);let c;e[5]===t?c=e[6]:(c=a(t),e[5]=t,e[6]=c);let l=t===`validate`?`Validate`:`Default`,u;e[7]===l?u=e[8]:(u=(0,q.jsx)(`span`,{className:`ml-1`,children:l}),e[7]=l,e[8]=u);let d;e[9]!==i||e[10]!==c||e[11]!==u?(d=(0,q.jsxs)(St,{variant:`ghost`,size:`sm`,onClick:i,className:`h-5 px-1.5 text-xs border-border shadow-none hover:bg-accent`,children:[c,u]}),e[9]=i,e[10]=c,e[11]=u,e[12]=d):d=e[12];let f;return e[13]!==s||e[14]!==d?(f=(0,q.jsx)(`div`,{className:`flex flex-row gap-1 items-center`,children:(0,q.jsx)(bt,{delayDuration:300,content:s,children:d})}),e[13]=s,e[14]=d,e[15]=f):f=e[15],f},fA=e=>{let t=(0,X.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,q.jsx)(gt,{className:`text-xs border-border shadow-none! ring-0! h-5 px-1.5 hover:bg-accent transition-colors`,...r,children:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i};function pA(e){return e.source!==`iceberg`}function mA(e){return(0,q.jsx)(dt,{value:e.name,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Zw,{className:`h-3 w-3`,name:e.dialect}),(0,q.jsx)(`span`,{className:`truncate ml-0.5`,children:Tp(e.display_name)})]})},e.name)}function hA(e){return e=e.filter(pA),e.map(mA)}function gA(e){return(0,q.jsx)(dt,{value:`${lA}${e.id}`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Ho,{className:`h-3 w-3 text-(--blue-9)`}),(0,q.jsxs)(`span`,{className:`truncate ml-0.5`,children:[`Add `,e.displayName,` connection`]})]})},e.id)}function _A(e){return e===`validate`?(0,q.jsx)(Vo,{className:`h-3 w-3`}):(0,q.jsx)(Rt,{className:`h-3 w-3`})}function vA(e){return e===`validate`?(0,q.jsxs)(`div`,{className:`text-xs`,children:[(0,q.jsxs)(`div`,{className:`font-semibold mb-1 flex flex-row items-center gap-1`,children:[(0,q.jsx)(Vo,{className:`h-3 w-3`}),`Validate Mode`]}),(0,q.jsx)(`p`,{children:`Queries are validated as you write them`})]}):(0,q.jsxs)(`div`,{className:`text-xs`,children:[(0,q.jsxs)(`div`,{className:`font-semibold mb-1 flex flex-row items-center gap-1`,children:[(0,q.jsx)(Rt,{className:`h-3 w-3`}),`Default Mode`]}),(0,q.jsx)(`p`,{children:`Standard editing`})]})}var yA=()=>{let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(`div`,{className:`h-4 border-r border-border`}),e[0]=t):t=e[0],t},bA=e=>{let t=(0,X.c)(102),{view:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={minWidth:50},t[0]=r):r=t[0];let{spanProps:i,inputProps:a}=Pw(r),o;t[1]===n.state?o=t[2]:(o=n.state.field(CA),t[1]=n.state,t[2]=o);let s=o,c;t[3]===n.state?c=t[4]:(c=n.state.facet(Of),t[3]=n.state,t[4]=c);let l=c,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(`div`,{}),t[5]=u):u=t[5];let d=u,f=!1,p;t[6]===n?p=t[7]:(p=e=>{n.dispatch({effects:jy.of(e),changes:{from:0,to:n.state.doc.length,insert:n.state.doc.toString()}})},t[6]=n,t[7]=p);let m=p;if(s instanceof aw){let e;t[8]===n.state?e=t[9]:(e=n.state.field(My),t[8]=n.state,t[9]=e);let r=e;f=!0;let o;t[10]===m?o=t[11]:(o=e=>{let t=Aw(e.currentTarget.value,!1);e.currentTarget.value=t,m({dataframeName:t})},t[10]=m,t[11]=o);let s=o,c;t[12]!==m||t[13]!==n?(c=e=>{m({engine:e}),pw(n,e)},t[12]=m,t[13]=n,t[14]=c):c=t[14];let u=c,p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,q.jsx)(`span`,{className:`select-none`,children:`Output variable: `}),t[15]=p):p=t[15];let h;t[16]===a?h=t[17]:(h=e=>{a.onChange?.(e)},t[16]=a,t[17]=h);let g;t[18]===s?g=t[19]:(g=e=>{e.key===`Enter`&&e.shiftKey&&s(e)},t[18]=s,t[19]=g);let _;t[20]!==a||t[21]!==r.dataframeName||t[22]!==s||t[23]!==h||t[24]!==g?(_=(0,q.jsx)(`input`,{...a,defaultValue:r.dataframeName,onChange:h,onBlur:s,onKeyDown:g,className:`min-w-14 w-auto border border-border rounded px-1 focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring`}),t[20]=a,t[21]=r.dataframeName,t[22]=s,t[23]=h,t[24]=g,t[25]=_):_=t[25];let v;t[26]===i?v=t[27]:(v=(0,q.jsx)(`span`,{...i}),t[26]=i,t[27]=v);let y;t[28]!==_||t[29]!==v?(y=(0,q.jsxs)(`label`,{className:`flex gap-2 items-center`,children:[p,_,v]}),t[28]=_,t[29]=v,t[30]=y):y=t[30];let b;t[31]!==l||t[32]!==r.engine||t[33]!==u?(b=(0,q.jsx)(aA,{selectedEngine:r.engine,onChange:u,cellId:l}),t[31]=l,t[32]=r.engine,t[33]=u,t[34]=b):b=t[34];let x;t[35]===r.engine?x=t[36]:(x=r.engine===`__marimo_duckdb`&&(0,q.jsx)(dA,{}),t[35]=r.engine,t[36]=x);let S;t[37]!==r.engine||t[38]!==n?(S=async()=>{await pm(n,r.engine)},t[37]=r.engine,t[38]=n,t[39]=S):S=t[39];let C;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,q.jsx)(Ro,{className:`h-3 w-3`}),t[40]=C):C=t[40];let w;t[41]===S?w=t[42]:(w=(0,q.jsx)(bt,{content:`Format SQL`,children:(0,q.jsx)(St,{"aria-label":`Format SQL`,variant:`text`,size:`icon`,onClick:S,children:C})}),t[41]=S,t[42]=w);let T;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(yA,{}),t[43]=T):T=t[43];let E;t[44]===m?E=t[45]:(E=e=>{m({showOutput:!e.target.checked})},t[44]=m,t[45]=E);let D=!r.showOutput,O;t[46]!==E||t[47]!==D?(O=(0,q.jsx)(`input`,{type:`checkbox`,onChange:E,checked:D}),t[46]=E,t[47]=D,t[48]=O):O=t[48];let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,q.jsx)(`span`,{className:`select-none`,children:`Hide output`}),t[49]=k):k=t[49];let A;t[50]===O?A=t[51]:(A=(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[O,k]}),t[50]=O,t[51]=A);let j;t[52]!==x||t[53]!==w||t[54]!==A?(j=(0,q.jsxs)(`div`,{className:`flex items-center gap-2 ml-auto`,children:[x,w,T,A]}),t[52]=x,t[53]=w,t[54]=A,t[55]=j):j=t[55];let M;t[56]!==y||t[57]!==b||t[58]!==j?(M=(0,q.jsxs)(`div`,{className:`flex flex-1 gap-2 items-center`,children:[y,b,j]}),t[56]=y,t[57]=b,t[58]=j,t[59]=M):M=t[59],d=M}if(s instanceof Ny){f=!0;let e,r,i,a,o,s,c,l,u,p;if(t[60]!==m||t[61]!==n.state){let{quotePrefix:d}=n.state.field(My);r=d,r===void 0&&(r=`r`,m({quotePrefix:r})),p=(e,t)=>{if(typeof t!=`boolean`)return;let n=Fw({currentQuotePrefix:r,checked:t,prefix:e});m({quotePrefix:n})},a=`flex flex-row w-full justify-end gap-1.5 items-center`,u=`flex items-center gap-1.5`,t[72]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`span`,{children:`r`}),t[72]=i):i=t[72],e=Ow,s=`Toggle raw string`,c=`w-3 h-3`,l=r.includes(`r`),o=e=>{p(`r`,e)},t[60]=m,t[61]=n.state,t[62]=e,t[63]=r,t[64]=i,t[65]=a,t[66]=o,t[67]=s,t[68]=c,t[69]=l,t[70]=u,t[71]=p}else e=t[62],r=t[63],i=t[64],a=t[65],o=t[66],s=t[67],c=t[68],l=t[69],u=t[70],p=t[71];let h;t[73]!==e||t[74]!==o||t[75]!==s||t[76]!==c||t[77]!==l?(h=(0,q.jsx)(e,{"aria-label":s,className:c,checked:l,onCheckedChange:o}),t[73]=e,t[74]=o,t[75]=s,t[76]=c,t[77]=l,t[78]=h):h=t[78];let g;t[79]!==i||t[80]!==h||t[81]!==u?(g=(0,q.jsxs)(`div`,{className:u,children:[i,h]}),t[79]=i,t[80]=h,t[81]=u,t[82]=g):g=t[82];let _;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsx)(`span`,{children:`f`}),t[83]=_):_=t[83];let v;t[84]===r?v=t[85]:(v=r.includes(`f`),t[84]=r,t[85]=v);let y;t[86]===p?y=t[87]:(y=e=>{p(`f`,e)},t[86]=p,t[87]=y);let b;t[88]!==v||t[89]!==y?(b=(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[_,(0,q.jsx)(Ow,{"aria-label":`Toggle f-string`,className:`w-3 h-3`,checked:v,onCheckedChange:y})]}),t[88]=v,t[89]=y,t[90]=b):b=t[90];let x;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,q.jsx)(bt,{content:(0,q.jsx)(Iw,{}),children:(0,q.jsx)(Mo,{className:`w-3 h-3`})}),t[91]=x):x=t[91];let S;t[92]!==a||t[93]!==g||t[94]!==b?(S=(0,q.jsxs)(`div`,{className:a,children:[g,b,x]}),t[92]=a,t[93]=g,t[94]=b,t[95]=S):S=t[95],d=S}let h;t[96]===f?h=t[97]:(h=f&&(0,q.jsx)(yA,{}),t[96]=f,t[97]=h);let g;return t[98]!==d||t[99]!==s.type||t[100]!==h?(g=(0,q.jsx)(yt,{children:(0,q.jsxs)(`div`,{className:`flex justify-between items-center gap-4 pl-2 pt-2`,children:[d,h,s.type]})}),t[98]=d,t[99]=s.type,t[100]=h,t[101]=g):g=t[101],g},xA=new On,SA=Cn.define(),CA=cn.define({create(){return Ew.python},update(e,t){for(let e of t.effects)if(e.is(SA))return e.value;return e},provide:e=>Sn.from(e,e=>e.type===`python`?null:e=>hm(e,bA))});function wA(){let e=Dw(),t=(n,r)=>{let i=e[r%e.length];return i.isSupported(n)?i:t(n,r+1)};return[pn.of([{key:`F4`,preventDefault:!0,run:n=>{let r=n.state.field(CA),i=e.findIndex(e=>e.type===r.type),a=n.state.doc.toString(),o=t(a,i+1);return r!==o&&(TA({view:n,nextLanguage:o,opts:{keepCodeAsIs:!1}}),!0)}}])]}function TA({view:e,nextLanguage:t,opts:n}){let r=e.state.field(CA),i=e.state.doc.toString(),a=e.state.facet(ef),o=e.state.facet(tf),s=e.state.facet(nf),c=e.state.facet(rf),l=e.state.facet(af),u=e.state.field(My),d=e.state.selection.main.head,f;if(n.keepCodeAsIs)f=i,r.type!==t.type&&(u={...t.defaultMetadata});else{let[e,n]=r.transformOut(i,u),[a,o,s]=t.transformIn(e);d+=n,d-=o,d=Er(d,0,a.length),f=a,u=s}e.dispatch({effects:[SA.of(t),Ay.of(u),xA.reconfigure(t.getExtension({cellId:c,completionConfig:a,hotkeys:o,placeholderType:s,lspConfig:l})),sf.reconfigure([]),um.of(!0)],changes:n.keepCodeAsIs?void 0:{from:0,to:e.state.doc.length,insert:f},selection:n.keepCodeAsIs?void 0:An.cursor(d)}),e.dispatch({effects:[sf.reconfigure([sr()])]}),t.type===`sql`&&mw(e)}function EA(e){let{placeholderType:t,completionConfig:n,hotkeys:r,cellId:i,lspConfig:a}=e;return[wA(),xA.of(Ew.python.getExtension({cellId:i,completionConfig:n,hotkeys:r,placeholderType:t,lspConfig:a})),CA,My]}function DA(e){return OA(jA({state:e}).trim())}function OA(e){return e?Ew.markdown.isSupported(e)?Ew.markdown:Ew.sql.isSupported(e)?Ew.sql:Ew.python:Ew.python}function kA(e,t){e.state.field(CA).type!==t.language&&TA({view:e,nextLanguage:Ew[t.language],opts:{keepCodeAsIs:t.keepCodeAsIs??!1}})}function AA(e,{completionConfig:t,hotkeysProvider:n,lspConfig:r}){let i=e.state.field(CA),a=e.state.facet(nf),o=e.state.facet(rf);return o===void 0&&R.error(`Cell ID is undefined in reconfigureLanguageEffect`),a===void 0&&R.error(`Placeholder type is undefined in reconfigureLanguageEffect`),t===void 0&&R.error(`Completion config is undefined in reconfigureLanguageEffect`),xA.reconfigure(i.getExtension({cellId:o,completionConfig:t,hotkeys:n,placeholderType:a,lspConfig:r}))}function jA(e,t,n){let r=e.state.field(CA),i=e.state.field(My),a=e.state.doc.toString();return t===void 0?r.transformOut(a,i)[0]:r.transformOut(a.slice(t,n),i)[0]}function MA(e,t){let n=e.state.field(CA),r=OA(t);r.type!==n.type&&kA(e,{language:r.type,keepCodeAsIs:!0});let[i]=e.state.field(CA).transformIn(t);return Qd(e,i),i}function NA(e){let t=e.state.selection.main.head,n=e.state.doc.toString(),r=n.length>0&&n[t-1]===`
114
114
  `,i=n.length>0&&n[t]===`
115
- `,a=r?t-1:t,o=i?t+1:t;return{beforeCursorCode:OA(e,0,a),afterCursorCode:OA(e,o)}}if(typeof document<`u`){let e=`data-temp-href-target`;pi.addHook(`beforeSanitizeAttributes`,t=>{t.tagName===`A`&&(t.hasAttribute(`target`)||t.setAttribute(`target`,`_self`),t.hasAttribute(`target`)&&t.setAttribute(e,t.getAttribute(`target`)||``))}),pi.addHook(`afterSanitizeAttributes`,t=>{t.tagName===`A`&&t.hasAttribute(e)&&(t.setAttribute(`target`,t.getAttribute(e)||``),t.removeAttribute(e),t.getAttribute(`target`)===`_blank`&&t.setAttribute(`rel`,`noopener noreferrer`))})}function jA(e){let t={USE_PROFILES:{html:!0,svg:!0,mathMl:!0},ADD_TAGS:[`use`],ADD_ATTR:[`href`,`xlink:href`],FORCE_BODY:!0,CUSTOM_ELEMENT_HANDLING:{tagNameCheck:/^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,attributeNameCheck:/^[A-Za-z][\w-]*$/},SAFE_FOR_XML:!e.includes(`marimo-mermaid`)};return pi.sanitize(e,t)}var MA=[`marimo-carousel`,`marimo-tabs`,`marimo-accordion`,`marimo-sidebar`],NA=`h1, h2, h3, h4, h5, h6`;function PA(e){if(typeof DOMParser>`u`)return null;let t=[],n=new DOMParser().parseFromString(e,`text/html`).querySelectorAll(NA);for(let e of Array.from(n)){let n=e.textContent;if(MA.some(t=>e.closest(t))||!n)continue;let r=Number.parseInt(e.tagName[1],10),i=e.innerHTML,a={name:n,level:r,by:IA(e)};i!==n&&(a.html=jA(i)),t.push(a)}return{items:t}}function FA(e){if(!e.includes(`"`))return`"${e}"`;if(!e.includes(`'`))return`'${e}'`;let t=e.split(`"`),n=[];for(let[e,r]of t.entries())r&&n.push(`"${r}"`),e<t.length-1&&n.push(`'"'`);return`concat(${n.join(`, `)})`}function IA(e){let t=e.id;if(t)return{id:t};let n=e.textContent??``;return{path:`//${e.tagName}[contains(., ${FA(n)})]`}}function LA(e){return{items:e.filter(Boolean).flatMap(e=>e.items)}}function RA(e){if(e==null||e.mimetype!==`text/html`&&e.mimetype!==`text/markdown`||e.data==null)return null;try{return B(typeof e.data==`string`,`expected string`),PA(e.data)}catch{return R.error(`Failed to parse outline`),null}}function zA(e){return e!=null&&e.items.some(e=>e.level<=3)}function BA(e,t){let n=e=>e.items.length===0?7:Math.min(...e.items.map(e=>e.level)),r=t[e];if(r==null||r.items.length===0)return R.warn(`Failed to find a starting outline`),null;let i=n(r),a=e+1;for(;a<t.length;){let r=t[a];if(r&&n(r)<=i)return[e,a-1];a++}return[e,t.length-1]}var VA=ve(`marimo:rtc:username`,``,Nh),HA=Or(()=>hh(`rtc_v2`));function UA(e){return e!==Pi}var WA=class e{lines=[``];cursor={row:0,col:0};static ESCAPE_REGEX=new RegExp(String.raw`\u001B\[([0-9;]*)([A-DJKH])`,`u`);ensureLine(e){for(;this.lines.length<=e;)this.lines.push(``)}moveCursor(e,t){this.cursor.row=Math.max(0,this.cursor.row+e),this.cursor.col=Math.max(0,this.cursor.col+t),this.ensureLine(this.cursor.row)}setCursor(e,t){this.cursor.row=Math.max(0,e),this.cursor.col=Math.max(0,t),this.ensureLine(this.cursor.row)}writeChar(e){this.ensureLine(this.cursor.row);let t=this.lines[this.cursor.row].padEnd(this.cursor.col,` `);this.lines[this.cursor.row]=t.slice(0,this.cursor.col)+e+t.slice(this.cursor.col+1),this.cursor.col++}writeString(e){if(e.length===0)return;this.ensureLine(this.cursor.row);let t=this.lines[this.cursor.row].padEnd(this.cursor.col,` `);this.lines[this.cursor.row]=t.slice(0,this.cursor.col)+e+t.slice(this.cursor.col+e.length),this.cursor.col+=e.length}control(e){switch(e){case`
115
+ `,a=r?t-1:t,o=i?t+1:t;return{beforeCursorCode:jA(e,0,a),afterCursorCode:jA(e,o)}}if(typeof document<`u`){let e=`data-temp-href-target`;pi.addHook(`beforeSanitizeAttributes`,t=>{t.tagName===`A`&&(t.hasAttribute(`target`)||t.setAttribute(`target`,`_self`),t.hasAttribute(`target`)&&t.setAttribute(e,t.getAttribute(`target`)||``))}),pi.addHook(`afterSanitizeAttributes`,t=>{t.tagName===`A`&&t.hasAttribute(e)&&(t.setAttribute(`target`,t.getAttribute(e)||``),t.removeAttribute(e),t.getAttribute(`target`)===`_blank`&&t.setAttribute(`rel`,`noopener noreferrer`))})}function PA(e){let t={USE_PROFILES:{html:!0,svg:!0,mathMl:!0},ADD_TAGS:[`use`],ADD_ATTR:[`href`,`xlink:href`],FORCE_BODY:!0,CUSTOM_ELEMENT_HANDLING:{tagNameCheck:/^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,attributeNameCheck:/^[A-Za-z][\w-]*$/},SAFE_FOR_XML:!e.includes(`marimo-mermaid`)};return pi.sanitize(e,t)}var FA=[`marimo-carousel`,`marimo-tabs`,`marimo-accordion`,`marimo-sidebar`],IA=`h1, h2, h3, h4, h5, h6`;function LA(e){if(typeof DOMParser>`u`)return null;let t=[],n=new DOMParser().parseFromString(e,`text/html`).querySelectorAll(IA);for(let e of Array.from(n)){let n=e.textContent;if(FA.some(t=>e.closest(t))||!n)continue;let r=Number.parseInt(e.tagName[1],10),i=e.innerHTML,a={name:n,level:r,by:zA(e)};i!==n&&(a.html=PA(i)),t.push(a)}return{items:t}}function RA(e){if(!e.includes(`"`))return`"${e}"`;if(!e.includes(`'`))return`'${e}'`;let t=e.split(`"`),n=[];for(let[e,r]of t.entries())r&&n.push(`"${r}"`),e<t.length-1&&n.push(`'"'`);return`concat(${n.join(`, `)})`}function zA(e){let t=e.id;if(t)return{id:t};let n=e.textContent??``;return{path:`//${e.tagName}[contains(., ${RA(n)})]`}}function BA(e){return{items:e.filter(Boolean).flatMap(e=>e.items)}}function VA(e){if(e==null||e.mimetype!==`text/html`&&e.mimetype!==`text/markdown`||e.data==null)return null;try{return B(typeof e.data==`string`,`expected string`),LA(e.data)}catch{return R.error(`Failed to parse outline`),null}}function HA(e){return e!=null&&e.items.some(e=>e.level<=3)}function UA(e,t){let n=e=>e.items.length===0?7:Math.min(...e.items.map(e=>e.level)),r=t[e];if(r==null||r.items.length===0)return R.warn(`Failed to find a starting outline`),null;let i=n(r),a=e+1;for(;a<t.length;){let r=t[a];if(r&&n(r)<=i)return[e,a-1];a++}return[e,t.length-1]}var WA=ve(`marimo:rtc:username`,``,Ih),GA=Or(()=>vh(`rtc_v2`));function KA(e){return e!==Pi}var qA=class e{lines=[``];cursor={row:0,col:0};static ESCAPE_REGEX=new RegExp(String.raw`\u001B\[([0-9;]*)([A-DJKH])`,`u`);ensureLine(e){for(;this.lines.length<=e;)this.lines.push(``)}moveCursor(e,t){this.cursor.row=Math.max(0,this.cursor.row+e),this.cursor.col=Math.max(0,this.cursor.col+t),this.ensureLine(this.cursor.row)}setCursor(e,t){this.cursor.row=Math.max(0,e),this.cursor.col=Math.max(0,t),this.ensureLine(this.cursor.row)}writeChar(e){this.ensureLine(this.cursor.row);let t=this.lines[this.cursor.row].padEnd(this.cursor.col,` `);this.lines[this.cursor.row]=t.slice(0,this.cursor.col)+e+t.slice(this.cursor.col+1),this.cursor.col++}writeString(e){if(e.length===0)return;this.ensureLine(this.cursor.row);let t=this.lines[this.cursor.row].padEnd(this.cursor.col,` `);this.lines[this.cursor.row]=t.slice(0,this.cursor.col)+e+t.slice(this.cursor.col+e.length),this.cursor.col+=e.length}control(e){switch(e){case`
116
116
  `:this.cursor.row++,this.cursor.col=0,this.ensureLine(this.cursor.row);break;case`\r`:this.cursor.col=0;break;case` `:this.writeChar(` `);break;case`\b`:this.cursor.col=Math.max(0,this.cursor.col-1);break;case`\v`:this.cursor.row++,this.ensureLine(this.cursor.row)}}handleEscape(t){let n=e.ESCAPE_REGEX.exec(t);if(!n){this.writeString(t);return}let r=n[1].split(`;`).map(e=>e===``?1:Number.parseInt(e,10));switch(n[2]){case`A`:this.moveCursor(-r[0],0);break;case`B`:this.moveCursor(r[0],0);break;case`C`:this.moveCursor(0,r[0]);break;case`D`:this.moveCursor(0,-r[0]);break;case`H`:this.setCursor(r[0]-1||0,r[1]-1||0);break;case`J`:r[0]===2&&(this.lines=[``],this.setCursor(0,0));break;case`K`:switch(this.ensureLine(this.cursor.row),r[0]){case 0:this.lines[this.cursor.row]=this.lines[this.cursor.row].slice(0,this.cursor.col);break;case 1:{let e=this.lines[this.cursor.row].length;this.lines[this.cursor.row]=` `.repeat(this.cursor.col)+this.lines[this.cursor.row].slice(this.cursor.col,e);break}case 2:this.lines[this.cursor.row]=``}break;default:this.writeString(t)}}render(){return this.lines.join(`
117
- `)}},GA=class{ESC_REGEX=new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`,`gu`);parse(e){let t=[],n=0;for(let r of e.matchAll(this.ESC_REGEX)){let i=r.index??0;i>n&&t.push({type:`text`,value:e.slice(n,i)}),t.push({type:`escape`,value:r[0]}),n=i+r[0].length}return n<e.length&&t.push({type:`text`,value:e.slice(n)}),t}},KA=class{parser=new GA;buffer=new WA;reduce(e){return this.reset(),this.append(e),this.render()}append(e){let t=this.parser.parse(e);if(t.length===1&&t[0].type===`text`){let e=t[0].value;if(!this.hasControlChars(e)){this.buffer.writeString(e);return}}for(let e of t)e.type===`text`?this.processText(e.value):this.buffer.handleEscape(e.value)}reset(){this.buffer=new WA}render(){return this.buffer.render()}hasControlChars(e){for(let t of e)if(t<` `)return!0;return!1}processText(e){let t=0,n=e.length;for(let r=0;r<n;r++){let n=e[r];if(n===`
118
- `||n===`\r`||n===` `||n===`\b`||n===`\v`){if(r>t){let n=e.slice(t,r),i=this.filterControlChars(n);i.length>0&&this.buffer.writeString(i)}this.buffer.control(n),t=r+1}else if(n<` `){if(r>t){let n=e.slice(t,r);n.length>0&&this.buffer.writeString(n)}t=r+1}}if(t<n){let n=e.slice(t),r=this.filterControlChars(n);r.length>0&&this.buffer.writeString(r)}}filterControlChars(e){let t=!1;for(let n of e)if(n<` `){t=!0;break}if(!t)return e;let n=``;for(let t of e)t>=` `&&(n+=t);return n}},qA=class e{mimetype;channel;timestamp;code;id;ansiReducer=new KA;_data;get data(){return this._data}static create(t){let n=new KA;return n.append(t.data),new e({mimetype:t.mimetype,channel:t.channel,timestamp:t.timestamp,ansiReducer:n,code:t.code,id:t.id})}constructor({mimetype:e,channel:t,timestamp:n,ansiReducer:r,code:i,id:a}){this.mimetype=e,this.channel=t,this.timestamp=n,this.code=i,this.id=a,this.ansiReducer=r,this._data=this.ansiReducer.render()}appendData(t){return this.ansiReducer.append(t),new e({mimetype:this.mimetype,channel:this.channel,timestamp:this.timestamp,ansiReducer:this.ansiReducer,code:this.code,id:this.id})}toJSON(){return{mimetype:this.mimetype,channel:this.channel,timestamp:this.timestamp,data:this.data,...this.code===void 0?{}:{code:this.code}}}};function JA(e,t=5e3){let n=[...e];if(n.length<2)return $A(n.map(XA),t);let r=n[n.length-1],i=n[n.length-2];return YA(r,i)&&(QA(r),QA(i),n[n.length-2]=ZA(i,r),n.pop()),$A(n,t)}function YA(e,t){let n=e.mimetype===`text/plain`&&t.mimetype===`text/plain`;if(!n)return!1;let r=e.channel===t.channel,i=e.channel!==`stdin`;return n&&r&&i}function XA(e){return e instanceof qA?e:typeof e.data==`string`?qA.create(e):e}function ZA(e,t){return e instanceof qA?e.appendData(t.data):qA.create(e).appendData(t.data)}function QA(e){B(typeof e.data==`string`,`expected string output`)}function $A(e,t){let n=0,r;for(r=e.length-1;r>=0&&n<t;r--){let t=e[r];t.mimetype===`text/plain`?(B(typeof t.data==`string`,`expected string`),n+=t.data.split(`
117
+ `)}},JA=class{ESC_REGEX=new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`,`gu`);parse(e){let t=[],n=0;for(let r of e.matchAll(this.ESC_REGEX)){let i=r.index??0;i>n&&t.push({type:`text`,value:e.slice(n,i)}),t.push({type:`escape`,value:r[0]}),n=i+r[0].length}return n<e.length&&t.push({type:`text`,value:e.slice(n)}),t}},YA=class{parser=new JA;buffer=new qA;reduce(e){return this.reset(),this.append(e),this.render()}append(e){let t=this.parser.parse(e);if(t.length===1&&t[0].type===`text`){let e=t[0].value;if(!this.hasControlChars(e)){this.buffer.writeString(e);return}}for(let e of t)e.type===`text`?this.processText(e.value):this.buffer.handleEscape(e.value)}reset(){this.buffer=new qA}render(){return this.buffer.render()}hasControlChars(e){for(let t of e)if(t<` `)return!0;return!1}processText(e){let t=0,n=e.length;for(let r=0;r<n;r++){let n=e[r];if(n===`
118
+ `||n===`\r`||n===` `||n===`\b`||n===`\v`){if(r>t){let n=e.slice(t,r),i=this.filterControlChars(n);i.length>0&&this.buffer.writeString(i)}this.buffer.control(n),t=r+1}else if(n<` `){if(r>t){let n=e.slice(t,r);n.length>0&&this.buffer.writeString(n)}t=r+1}}if(t<n){let n=e.slice(t),r=this.filterControlChars(n);r.length>0&&this.buffer.writeString(r)}}filterControlChars(e){let t=!1;for(let n of e)if(n<` `){t=!0;break}if(!t)return e;let n=``;for(let t of e)t>=` `&&(n+=t);return n}},XA=class e{mimetype;channel;timestamp;code;id;ansiReducer=new YA;_data;get data(){return this._data}static create(t){let n=new YA;return n.append(t.data),new e({mimetype:t.mimetype,channel:t.channel,timestamp:t.timestamp,ansiReducer:n,code:t.code,id:t.id})}constructor({mimetype:e,channel:t,timestamp:n,ansiReducer:r,code:i,id:a}){this.mimetype=e,this.channel=t,this.timestamp=n,this.code=i,this.id=a,this.ansiReducer=r,this._data=this.ansiReducer.render()}appendData(t){return this.ansiReducer.append(t),new e({mimetype:this.mimetype,channel:this.channel,timestamp:this.timestamp,ansiReducer:this.ansiReducer,code:this.code,id:this.id})}toJSON(){return{mimetype:this.mimetype,channel:this.channel,timestamp:this.timestamp,data:this.data,...this.code===void 0?{}:{code:this.code}}}};function ZA(e,t=5e3){let n=[...e];if(n.length<2)return nj(n.map($A),t);let r=n[n.length-1],i=n[n.length-2];return QA(r,i)&&(tj(r),tj(i),n[n.length-2]=ej(i,r),n.pop()),nj(n,t)}function QA(e,t){let n=e.mimetype===`text/plain`&&t.mimetype===`text/plain`;if(!n)return!1;let r=e.channel===t.channel,i=e.channel!==`stdin`;return n&&r&&i}function $A(e){return e instanceof XA?e:typeof e.data==`string`?XA.create(e):e}function ej(e,t){return e instanceof XA?e.appendData(t.data):XA.create(e).appendData(t.data)}function tj(e){B(typeof e.data==`string`,`expected string output`)}function nj(e,t){let n=0,r;for(r=e.length-1;r>=0&&n<t;r--){let t=e[r];t.mimetype===`text/plain`?(B(typeof t.data==`string`,`expected string`),n+=t.data.split(`
119
119
  `).length):n++}if(n<t)return e;let i=r+1,a={channel:`stderr`,mimetype:`text/html`,data:`<pre>Streaming output truncated to last ${t} lines.\n</pre>`,timestamp:-1},o=e[i];if(o==null)return[a,...e.slice(i+1)];if(o.mimetype===`text/plain`){B(typeof o.data==`string`,`expected string`);let r=o.data.split(`
120
120
  `),s=t-(n-r.length);return[a,{...o,data:r.slice(-s).join(`
121
- `)},...e.slice(i+1)]}return[a,...e.slice(i+1)]}function ej(e){return(e.at(-1)?.id??0)+1}function tj(e,t){let n={...e};switch(t.status){case`queued`:n.interrupted=!1,n.errored=!1,n.runElapsedTimeMs=null,n.debuggerActive=!1;break;case`running`:n.interrupted=!1,e.stopped&&(n.output=null),n.status===`queued`&&(n.consoleOutputs=[]),n.stopped=!1,n.runStartTimestamp=t.timestamp,n.lastRunStartTimestamp=t.timestamp;break;case`idle`:e.runStartTimestamp&&(n.runElapsedTimeMs=vv.fromSeconds((t.timestamp??0)-e.runStartTimestamp).toMilliseconds(),n.runStartTimestamp=null,n.staleInputs=!1),!e.lastRunStartTimestamp&&t.timestamp&&(n.lastRunStartTimestamp=t.timestamp),n.debuggerActive=!1;break;case null:break;case`disabled-transitively`:break;case void 0:break;default:zr(t.status)}n.output=t.output??n.output,n.staleInputs=t.stale_inputs??n.staleInputs,n.status=t.status??n.status,t.serialization!==void 0&&(n.serialization=t.serialization);let r=!1;t.output!=null&&t.output.mimetype===`application/vnd.marimo+error`&&((n.status===`queued`||n.status===`running`)&&(n.status=`idle`),B(Array.isArray(t.output.data),`Expected error output data to be an array`),t.output.data.some(e=>e.type===`interruption`)?(n.interrupted=!0,r=!0):t.output.data.some(e=>e.type.includes(`ancestor`))?n.stopped=!0:n.errored=!0);let i=e.consoleOutputs;(r||t.status===`idle`)&&(n.debuggerActive=!1,i=i.map(e=>e.channel===`stdin`?{channel:e.channel,mimetype:e.mimetype,data:e.data,timestamp:e.timestamp,id:e.id,response:e.response??``}:e));let a=t.console;a!=null&&(i=JA(Array.isArray(a)?a.map((e,t)=>({...e,id:t+1})):[...i,{...a,id:ej(i)}])),n.consoleOutputs=i,n.outline=RA(n.output);let o=[t.console].flat().filter(Boolean).filter(e=>e.channel===`pdb`);return o.length>0&&o.some(e=>e.data===`start`)&&(n.debuggerActive=!0),n}function nj(e){let t={...e};return e.status!==`disabled-transitively`&&(t.status=`queued`),t.interrupted=!1,t.errored=!1,t.runElapsedTimeMs=null,t.debuggerActive=!1,t}function rj(e){return e===`running`||e===`queued`}function ij(e,t){let{status:n,output:r,runStartTimestamp:i,interrupted:a,staleInputs:o}=e;if(a)return!1;if(t)return!0;let s=rj(n),c=n===`running`&&r!==null&&i!==null&&(r.timestamp??0)>i;return s&&!c?!0:o}function aj(e,t){if(!e){R.warn(`getCell: cellId is undefined`);return}let n=t.cellData[e];if(!n){R.warn(`getCell: cell ${e} not found in state`);return}return n}function oj(e,t){let n=t.cellIds.inOrderIds,r=n.indexOf(e);if(r>0)return{after:n[r-1]};if(r===0&&n.length>1)return{before:n[1]}}function sj(e){let t=new Map,n=e.cellIds.getColumns();for(let[e,r]of n.entries())for(let n of r.inOrderIds)t.set(n,e);return t}function cj(e,t){let n=new Set(e.cellIds.inOrderIds),r=[];for(let e of t.cellIds.inOrderIds)if(!n.has(e)){let n=aj(e,t);n&&r.push({type:`create-cell`,cellId:n.id,code:n.code,name:n.name,config:n.config,...oj(n.id,t)})}return r}function lj(e,t){let n=new Set(t.cellIds.inOrderIds),r=[];for(let t of e.cellIds.inOrderIds)n.has(t)||r.push({type:`delete-cell`,cellId:t});return r}function uj(e,t){let n=sj(e),r=sj(t),i=[];for(let[e,a]of r)if(n.get(e)!==a){let n=aj(e,t);i.push({type:`set-config`,cellId:e,column:a,disabled:n?.config.disabled??!1,hideCode:n?.config.hide_code??!1,expandOutput:n?.config.expand_output??!1})}return i.push({type:`reorder-cells`,cellIds:t.cellIds.inOrderIds}),i}function dj(e,t,n){switch(n.type){case`createNewCell`:return cj(e,t);case`deleteCell`:return[{type:`delete-cell`,cellId:n.payload.cellId}];case`moveCell`:case`sendToTop`:case`sendToBottom`:{let{cellId:e}=n.payload;return[{type:`move-cell`,cellId:e,...oj(e,t)}]}case`dropCellOverCell`:case`dropCellOverColumn`:case`moveCellToIndex`:case`moveCellsRelativeTo`:return uj(e,t);case`updateCellCode`:{let e=aj(n.payload.cellId,t);return e?[{type:`set-code`,cellId:e.id,code:e.code}]:[]}case`updateCellName`:{let e=aj(n.payload.cellId,t);return e?[{type:`set-name`,cellId:e.id,name:e.name}]:[]}case`updateCellConfig`:{let{cellId:e}=n.payload,r=aj(e,t);return r?[{type:`set-config`,cellId:e,column:r.config.column??null,disabled:r.config.disabled??!1,hideCode:r.config.hide_code??!1,expandOutput:r.config.expand_output??!1}]:[]}case`dropOverNewColumn`:case`moveColumn`:case`addColumnBreakpoint`:case`deleteColumn`:case`mergeAllColumns`:case`compactColumns`:return uj(e,t);case`addColumn`:return[...cj(e,t),...uj(e,t)];case`undoDeleteCell`:{let n=cj(e,t),r=uj(e,t);return n.length===0?r:r.length>1?[...n,...r]:n}case`splitCell`:{let{cellId:r}=n.payload,i=aj(r,t);return i?[{type:`set-code`,cellId:r,code:i.code},...cj(e,t)]:[]}case`undoSplitCell`:{let{cellId:r}=n.payload,i=aj(r,t);return i?[{type:`set-code`,cellId:r,code:i.code},...lj(e,t)]:[]}case`moveToNextCell`:return cj(e,t);case`addSetupCellIfDoesntExist`:return cj(e,t);case`focusCell`:case`focusTopCell`:case`focusBottomCell`:case`scrollToTarget`:case`showCellIfHidden`:case`markTouched`:case`markUntouched`:return[];case`prepareForRun`:case`handleCellMessage`:case`setCellIds`:case`rebuildCellColumns`:case`setCellCodes`:case`setCells`:case`setStdinResponse`:case`clearSerializedEditorState`:case`clearCellOutput`:case`clearCellConsoleOutput`:case`clearAllCellOutputs`:case`clearLogs`:case`addLogs`:return[];case`foldAll`:case`unfoldAll`:case`collapseCell`:case`expandCell`:case`collapseAllCells`:case`expandAllCells`:return[];default:Br(n)}}function fj(e){let t=new Set,n=new Set;for(let r of e)r.type===`create-cell`?t.add(r.cellId):r.type===`delete-cell`&&n.add(r.cellId);return t.intersection(n)}function pj(e,t){let n=[];for(let r of e)switch(r.type){case`create-cell`:{let e=`__end__`,t=!1;r.after?(e=r.after,t=!1):r.before&&(e=r.before,t=!0),n.push({type:`createNewCell`,payload:{cellId:e,before:t,code:r.code,newCellId:r.cellId,autoFocus:!1,hideCode:r.config?.hide_code??!1}}),r.name&&n.push({type:`updateCellName`,payload:{cellId:r.cellId,name:r.name}}),(r.config?.disabled!=null||r.config?.column!=null||r.config?.expand_output!=null)&&n.push({type:`updateCellConfig`,payload:{cellId:r.cellId,config:{...r.config.disabled!=null&&{disabled:r.config.disabled},...r.config.column!=null&&{column:r.config.column},...r.config.expand_output!=null&&{expand_output:r.config.expand_output}}}});break}case`delete-cell`:n.push({type:`deleteCell`,payload:{cellId:r.cellId}});break;case`move-cell`:{let e=[...t()],i=r.cellId,a=e.indexOf(i);if(a<0)break;if(e.splice(a,1),r.after){let t=e.indexOf(r.after);t>=0?e.splice(t+1,0,i):e.push(i)}else if(r.before){let t=e.indexOf(r.before);t>=0?e.splice(t,0,i):e.unshift(i)}else e.push(i);n.push({type:`setCellIds`,payload:{cellIds:e}});break}case`reorder-cells`:n.push({type:`setCellIds`,payload:{cellIds:r.cellIds}});break;case`set-code`:n.push({type:`setCellCodes`,payload:{ids:[r.cellId],codes:[r.code],codeIsStale:!0}});break;case`set-name`:n.push({type:`updateCellName`,payload:{cellId:r.cellId,name:r.name}});break;case`set-config`:n.push({type:`updateCellConfig`,payload:{cellId:r.cellId,config:{column:r.column,disabled:r.disabled,hide_code:r.hideCode,expand_output:r.expandOutput}}})}return n}var mj=new Set([`set-code`,`set-name`,`set-config`]),hj=new Set([`set-code`,`set-name`,`set-config`,`move-cell`]);function gj(e){let t=new Set;for(let n of e)n.type===`delete-cell`&&t.add(n.cellId);let n=e.filter(e=>!(hj.has(e.type)&&`cellId`in e&&t.has(e.cellId))),r=new Map;return n.forEach((e,t)=>{mj.has(e.type)&&`cellId`in e&&r.set(`${e.type}:${e.cellId}`,t)}),n.filter((e,t)=>mj.has(e.type)&&`cellId`in e?r.get(`${e.type}:${e.cellId}`)===t:!0)}var _j=[],vj=[],yj=Promise.resolve(),bj=0,xj=null,Sj={status:`synchronized`};function Cj(){if(Sj.status===`failed`)return;let e=gj(_j);_j=[],e.length>0&&vj.push(e)}async function wj(e){if(e===bj){if(Sj.status===`failed`)throw Sj.error;for(;vj.length>0;){let t=vj[0];try{await Hr().sendDocumentTransaction({changes:t})}catch(t){if(e!==bj)return;throw Sj={status:`failed`,error:t},vj=vj.slice(1),t}if(e!==bj)return;vj.shift()}}}function Tj(){let e=bj,t=xj?.promise??Promise.resolve(),n=Promise.all([yj.catch(()=>void 0),t]).then(()=>wj(e));return yj=n,n}var Ej=ne(()=>{Cj(),Tj().catch(()=>void 0)},400);async function Dj(){if(Sj.status===`failed`)throw Sj.error;Ej.cancel(),Cj();let e=Tj();for(;;){if(await e,Ej.cancel(),Cj(),_j.length===0&&vj.length===0&&yj===e)return;e=yj===e?Tj():yj}}function Oj(){if(Sj.status!==`failed`)return null;Ej.cancel();let e=_j,t=vj;return _j=[],vj=[],{failure:Sj,includedChanges:e,includedTransactions:t}}function kj(e){e!==null&&Sj===e.failure&&(_j=[...e.includedChanges,..._j],vj=[...e.includedTransactions,...vj])}async function Aj(e){e!==null&&(await yj.catch(()=>void 0),Sj===e.failure&&(Sj={status:`synchronized`},yj=Promise.resolve(),_j.length>0&&Ej()))}function jj(e){xj===e&&(xj=null),e.resolve()}async function Mj(e){let t=null;try{await Dj()}catch(e){if(t=Oj(),t===null)throw e}let n=new ui;xj=n;try{let r=await e();return jj(n),await Aj(t),r}catch(e){throw kj(t),jj(n),e}}function Nj(e){return`cellId`in e&&e.cellId===`__scratch__`}function Pj(e){u.get(pe)||Nj(e)||(_j.push(e),Sj.status===`synchronized`&&Ej())}function Fj(e,t,n){for(let r of dj(e,t,n))Pj(r)}function Ij(e,t,n){let r=fj(e),i=[...e.filter(e=>e.type!==`set-config`),...e.filter(e=>e.type===`set-config`)],a=!1,o=null;for(let e of i)if(!(r.size>0&&`cellId`in e&&r.has(e.cellId))){e.type===`set-config`&&(a=!0),e.type===`create-cell`&&e.config?.column!=null&&(a=!0),e.type===`reorder-cells`&&(o=e.cellIds);for(let r of pj([e],n))t[r.type](r.payload)}a&&t.rebuildCellColumns({cellIds:o??n()})}function Lj(e,t){return Lt(e*1e3,t?.in)}var Rj=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},zj;(function(e){e[e.EOS=0]=`EOS`,e[e.Text=1]=`Text`,e[e.Incomplete=2]=`Incomplete`,e[e.ESC=3]=`ESC`,e[e.Unknown=4]=`Unknown`,e[e.SGR=5]=`SGR`,e[e.OSCURL=6]=`OSCURL`})(zj||={});var Bj=class{constructor(){this.VERSION=`6.0.6`,this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1,this.fg=this.bg=null,this._buffer=``,this._url_allowlist={http:1,https:1},this._escape_html=!0,this.boldStyle=`font-weight:bold`,this.faintStyle=`opacity:0.7`,this.italicStyle=`font-style:italic`,this.underlineStyle=`text-decoration:underline`}set use_classes(e){this._use_classes=e}get use_classes(){return this._use_classes}set url_allowlist(e){this._url_allowlist=e}get url_allowlist(){return this._url_allowlist}set escape_html(e){this._escape_html=e}get escape_html(){return this._escape_html}set boldStyle(e){this._boldStyle=e}get boldStyle(){return this._boldStyle}set faintStyle(e){this._faintStyle=e}get faintStyle(){return this._faintStyle}set italicStyle(e){this._italicStyle=e}get italicStyle(){return this._italicStyle}set underlineStyle(e){this._underlineStyle=e}get underlineStyle(){return this._underlineStyle}setup_palettes(){this.ansi_colors=[[{rgb:[0,0,0],class_name:`ansi-black`},{rgb:[187,0,0],class_name:`ansi-red`},{rgb:[0,187,0],class_name:`ansi-green`},{rgb:[187,187,0],class_name:`ansi-yellow`},{rgb:[0,0,187],class_name:`ansi-blue`},{rgb:[187,0,187],class_name:`ansi-magenta`},{rgb:[0,187,187],class_name:`ansi-cyan`},{rgb:[255,255,255],class_name:`ansi-white`}],[{rgb:[85,85,85],class_name:`ansi-bright-black`},{rgb:[255,85,85],class_name:`ansi-bright-red`},{rgb:[0,255,0],class_name:`ansi-bright-green`},{rgb:[255,255,85],class_name:`ansi-bright-yellow`},{rgb:[85,85,255],class_name:`ansi-bright-blue`},{rgb:[255,85,255],class_name:`ansi-bright-magenta`},{rgb:[85,255,255],class_name:`ansi-bright-cyan`},{rgb:[255,255,255],class_name:`ansi-bright-white`}]],this.palette_256=[],this.ansi_colors.forEach(e=>{e.forEach(e=>{this.palette_256.push(e)})});let e=[0,95,135,175,215,255];for(let t=0;t<6;++t)for(let n=0;n<6;++n)for(let r=0;r<6;++r){let i={rgb:[e[t],e[n],e[r]],class_name:`truecolor`};this.palette_256.push(i)}let t=8;for(let e=0;e<24;++e,t+=10){let e={rgb:[t,t,t],class_name:`truecolor`};this.palette_256.push(e)}}escape_txt_for_html(e){return this._escape_html?e.replace(/[&<>"']/gm,e=>{if(e===`&`)return`&amp;`;if(e===`<`)return`&lt;`;if(e===`>`)return`&gt;`;if(e===`"`)return`&quot;`;if(e===`'`)return`&#x27;`}):e}append_buffer(e){var t=this._buffer+e;this._buffer=t}get_next_packet(){var e={kind:zj.EOS,text:``,url:``},t=this._buffer.length;if(t==0)return e;var n=this._buffer.indexOf(`\x1B`);if(n==-1)return e.kind=zj.Text,e.text=this._buffer,this._buffer=``,e;if(n>0)return e.kind=zj.Text,e.text=this._buffer.slice(0,n),this._buffer=this._buffer.slice(n),e;if(n==0){if(t<3)return e.kind=zj.Incomplete,e;var r=this._buffer.charAt(1);if(r!=`[`&&r!=`]`&&r!=`(`)return e.kind=zj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if(r==`[`){this._csi_regex||=Vj(Uj||=Rj([`
121
+ `)},...e.slice(i+1)]}return[a,...e.slice(i+1)]}function rj(e){return(e.at(-1)?.id??0)+1}function ij(e,t){let n={...e};switch(t.status){case`queued`:n.interrupted=!1,n.errored=!1,n.runElapsedTimeMs=null,n.debuggerActive=!1;break;case`running`:n.interrupted=!1,e.stopped&&(n.output=null),n.status===`queued`&&(n.consoleOutputs=[]),n.stopped=!1,n.runStartTimestamp=t.timestamp,n.lastRunStartTimestamp=t.timestamp;break;case`idle`:e.runStartTimestamp&&(n.runElapsedTimeMs=xv.fromSeconds((t.timestamp??0)-e.runStartTimestamp).toMilliseconds(),n.runStartTimestamp=null,n.staleInputs=!1),!e.lastRunStartTimestamp&&t.timestamp&&(n.lastRunStartTimestamp=t.timestamp),n.debuggerActive=!1;break;case null:break;case`disabled-transitively`:break;case void 0:break;default:zr(t.status)}n.output=t.output??n.output,n.staleInputs=t.stale_inputs??n.staleInputs,n.status=t.status??n.status,t.serialization!==void 0&&(n.serialization=t.serialization);let r=!1;t.output!=null&&t.output.mimetype===`application/vnd.marimo+error`&&((n.status===`queued`||n.status===`running`)&&(n.status=`idle`),B(Array.isArray(t.output.data),`Expected error output data to be an array`),t.output.data.some(e=>e.type===`interruption`)?(n.interrupted=!0,r=!0):t.output.data.some(e=>e.type.includes(`ancestor`))?n.stopped=!0:n.errored=!0);let i=e.consoleOutputs;(r||t.status===`idle`)&&(n.debuggerActive=!1,i=i.map(e=>e.channel===`stdin`?{channel:e.channel,mimetype:e.mimetype,data:e.data,timestamp:e.timestamp,id:e.id,response:e.response??``}:e));let a=t.console;a!=null&&(i=ZA(Array.isArray(a)?a.map((e,t)=>({...e,id:t+1})):[...i,{...a,id:rj(i)}])),n.consoleOutputs=i,n.outline=VA(n.output);let o=[t.console].flat().filter(Boolean).filter(e=>e.channel===`pdb`);return o.length>0&&o.some(e=>e.data===`start`)&&(n.debuggerActive=!0),n}function aj(e){let t={...e};return e.status!==`disabled-transitively`&&(t.status=`queued`),t.interrupted=!1,t.errored=!1,t.runElapsedTimeMs=null,t.debuggerActive=!1,t}function oj(e){return e===`running`||e===`queued`}function sj(e,t){let{status:n,output:r,runStartTimestamp:i,interrupted:a,staleInputs:o}=e;if(a)return!1;if(t)return!0;let s=oj(n),c=n===`running`&&r!==null&&i!==null&&(r.timestamp??0)>i;return s&&!c?!0:o}function cj(e,t){if(!e){R.warn(`getCell: cellId is undefined`);return}let n=t.cellData[e];if(!n){R.warn(`getCell: cell ${e} not found in state`);return}return n}function lj(e,t){let n=t.cellIds.inOrderIds,r=n.indexOf(e);if(r>0)return{after:n[r-1]};if(r===0&&n.length>1)return{before:n[1]}}function uj(e){let t=new Map,n=e.cellIds.getColumns();for(let[e,r]of n.entries())for(let n of r.inOrderIds)t.set(n,e);return t}function dj(e,t){let n=new Set(e.cellIds.inOrderIds),r=[];for(let e of t.cellIds.inOrderIds)if(!n.has(e)){let n=cj(e,t);n&&r.push({type:`create-cell`,cellId:n.id,code:n.code,name:n.name,config:n.config,...lj(n.id,t)})}return r}function fj(e,t){let n=new Set(t.cellIds.inOrderIds),r=[];for(let t of e.cellIds.inOrderIds)n.has(t)||r.push({type:`delete-cell`,cellId:t});return r}function pj(e,t){let n=uj(e),r=uj(t),i=[];for(let[e,a]of r)if(n.get(e)!==a){let n=cj(e,t);i.push({type:`set-config`,cellId:e,column:a,disabled:n?.config.disabled??!1,hideCode:n?.config.hide_code??!1,expandOutput:n?.config.expand_output??!1})}return i.push({type:`reorder-cells`,cellIds:t.cellIds.inOrderIds}),i}function mj(e,t,n){switch(n.type){case`createNewCell`:return dj(e,t);case`deleteCell`:return[{type:`delete-cell`,cellId:n.payload.cellId}];case`moveCell`:case`sendToTop`:case`sendToBottom`:{let{cellId:e}=n.payload;return[{type:`move-cell`,cellId:e,...lj(e,t)}]}case`dropCellOverCell`:case`dropCellOverColumn`:case`moveCellToIndex`:case`moveCellsRelativeTo`:return pj(e,t);case`updateCellCode`:{let e=cj(n.payload.cellId,t);return e?[{type:`set-code`,cellId:e.id,code:e.code}]:[]}case`updateCellName`:{let e=cj(n.payload.cellId,t);return e?[{type:`set-name`,cellId:e.id,name:e.name}]:[]}case`updateCellConfig`:{let{cellId:e}=n.payload,r=cj(e,t);return r?[{type:`set-config`,cellId:e,column:r.config.column??null,disabled:r.config.disabled??!1,hideCode:r.config.hide_code??!1,expandOutput:r.config.expand_output??!1}]:[]}case`dropOverNewColumn`:case`moveColumn`:case`addColumnBreakpoint`:case`deleteColumn`:case`mergeAllColumns`:case`compactColumns`:return pj(e,t);case`addColumn`:return[...dj(e,t),...pj(e,t)];case`undoDeleteCell`:{let n=dj(e,t),r=pj(e,t);return n.length===0?r:r.length>1?[...n,...r]:n}case`splitCell`:{let{cellId:r}=n.payload,i=cj(r,t);return i?[{type:`set-code`,cellId:r,code:i.code},...dj(e,t)]:[]}case`undoSplitCell`:{let{cellId:r}=n.payload,i=cj(r,t);return i?[{type:`set-code`,cellId:r,code:i.code},...fj(e,t)]:[]}case`moveToNextCell`:return dj(e,t);case`addSetupCellIfDoesntExist`:return dj(e,t);case`focusCell`:case`focusTopCell`:case`focusBottomCell`:case`scrollToTarget`:case`showCellIfHidden`:case`markTouched`:case`markUntouched`:return[];case`prepareForRun`:case`handleCellMessage`:case`setCellIds`:case`rebuildCellColumns`:case`setCellCodes`:case`setCells`:case`setStdinResponse`:case`clearSerializedEditorState`:case`clearCellOutput`:case`clearCellConsoleOutput`:case`clearAllCellOutputs`:case`clearLogs`:case`addLogs`:return[];case`foldAll`:case`unfoldAll`:case`collapseCell`:case`expandCell`:case`collapseAllCells`:case`expandAllCells`:return[];default:Br(n)}}function hj(e){let t=new Set,n=new Set;for(let r of e)r.type===`create-cell`?t.add(r.cellId):r.type===`delete-cell`&&n.add(r.cellId);return t.intersection(n)}function gj(e,t){let n=[];for(let r of e)switch(r.type){case`create-cell`:{let e=`__end__`,t=!1;r.after?(e=r.after,t=!1):r.before&&(e=r.before,t=!0),n.push({type:`createNewCell`,payload:{cellId:e,before:t,code:r.code,newCellId:r.cellId,autoFocus:!1,hideCode:r.config?.hide_code??!1}}),r.name&&n.push({type:`updateCellName`,payload:{cellId:r.cellId,name:r.name}}),(r.config?.disabled!=null||r.config?.column!=null||r.config?.expand_output!=null)&&n.push({type:`updateCellConfig`,payload:{cellId:r.cellId,config:{...r.config.disabled!=null&&{disabled:r.config.disabled},...r.config.column!=null&&{column:r.config.column},...r.config.expand_output!=null&&{expand_output:r.config.expand_output}}}});break}case`delete-cell`:n.push({type:`deleteCell`,payload:{cellId:r.cellId}});break;case`move-cell`:{let e=[...t()],i=r.cellId,a=e.indexOf(i);if(a<0)break;if(e.splice(a,1),r.after){let t=e.indexOf(r.after);t>=0?e.splice(t+1,0,i):e.push(i)}else if(r.before){let t=e.indexOf(r.before);t>=0?e.splice(t,0,i):e.unshift(i)}else e.push(i);n.push({type:`setCellIds`,payload:{cellIds:e}});break}case`reorder-cells`:n.push({type:`setCellIds`,payload:{cellIds:r.cellIds}});break;case`set-code`:n.push({type:`setCellCodes`,payload:{ids:[r.cellId],codes:[r.code],codeIsStale:!0}});break;case`set-name`:n.push({type:`updateCellName`,payload:{cellId:r.cellId,name:r.name}});break;case`set-config`:n.push({type:`updateCellConfig`,payload:{cellId:r.cellId,config:{column:r.column,disabled:r.disabled,hide_code:r.hideCode,expand_output:r.expandOutput}}})}return n}var _j=new Set([`set-code`,`set-name`,`set-config`]),vj=new Set([`set-code`,`set-name`,`set-config`,`move-cell`]);function yj(e){let t=new Set;for(let n of e)n.type===`delete-cell`&&t.add(n.cellId);let n=e.filter(e=>!(vj.has(e.type)&&`cellId`in e&&t.has(e.cellId))),r=new Map;return n.forEach((e,t)=>{_j.has(e.type)&&`cellId`in e&&r.set(`${e.type}:${e.cellId}`,t)}),n.filter((e,t)=>_j.has(e.type)&&`cellId`in e?r.get(`${e.type}:${e.cellId}`)===t:!0)}var bj=[],xj=[],Sj=Promise.resolve(),Cj=0,wj=null,Tj={status:`synchronized`};function Ej(){if(Tj.status===`failed`)return;let e=yj(bj);bj=[],e.length>0&&xj.push(e)}async function Dj(e){if(e===Cj){if(Tj.status===`failed`)throw Tj.error;for(;xj.length>0;){let t=xj[0];try{await Hr().sendDocumentTransaction({changes:t})}catch(t){if(e!==Cj)return;throw Tj={status:`failed`,error:t},xj=xj.slice(1),t}if(e!==Cj)return;xj.shift()}}}function Oj(){let e=Cj,t=wj?.promise??Promise.resolve(),n=Promise.all([Sj.catch(()=>void 0),t]).then(()=>Dj(e));return Sj=n,n}var kj=ne(()=>{Ej(),Oj().catch(()=>void 0)},400);async function Aj(){if(Tj.status===`failed`)throw Tj.error;kj.cancel(),Ej();let e=Oj();for(;;){if(await e,kj.cancel(),Ej(),bj.length===0&&xj.length===0&&Sj===e)return;e=Sj===e?Oj():Sj}}function jj(){if(Tj.status!==`failed`)return null;kj.cancel();let e=bj,t=xj;return bj=[],xj=[],{failure:Tj,includedChanges:e,includedTransactions:t}}function Mj(e){e!==null&&Tj===e.failure&&(bj=[...e.includedChanges,...bj],xj=[...e.includedTransactions,...xj])}async function Nj(e){e!==null&&(await Sj.catch(()=>void 0),Tj===e.failure&&(Tj={status:`synchronized`},Sj=Promise.resolve(),bj.length>0&&kj()))}function Pj(e){wj===e&&(wj=null),e.resolve()}async function Fj(e){let t=null;try{await Aj()}catch(e){if(t=jj(),t===null)throw e}let n=new ui;wj=n;try{let r=await e();return Pj(n),await Nj(t),r}catch(e){throw Mj(t),Pj(n),e}}function Ij(e){return`cellId`in e&&e.cellId===`__scratch__`}function Lj(e){u.get(pe)||Ij(e)||(bj.push(e),Tj.status===`synchronized`&&kj())}function Rj(e,t,n){for(let r of mj(e,t,n))Lj(r)}function zj(e,t,n){let r=hj(e),i=[...e.filter(e=>e.type!==`set-config`),...e.filter(e=>e.type===`set-config`)],a=!1,o=null;for(let e of i)if(!(r.size>0&&`cellId`in e&&r.has(e.cellId))){e.type===`set-config`&&(a=!0),e.type===`create-cell`&&e.config?.column!=null&&(a=!0),e.type===`reorder-cells`&&(o=e.cellIds);for(let r of gj([e],n))t[r.type](r.payload)}a&&t.rebuildCellColumns({cellIds:o??n()})}function Bj(e,t){return Lt(e*1e3,t?.in)}var Vj=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Hj;(function(e){e[e.EOS=0]=`EOS`,e[e.Text=1]=`Text`,e[e.Incomplete=2]=`Incomplete`,e[e.ESC=3]=`ESC`,e[e.Unknown=4]=`Unknown`,e[e.SGR=5]=`SGR`,e[e.OSCURL=6]=`OSCURL`})(Hj||={});var Uj=class{constructor(){this.VERSION=`6.0.6`,this.setup_palettes(),this._use_classes=!1,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1,this.fg=this.bg=null,this._buffer=``,this._url_allowlist={http:1,https:1},this._escape_html=!0,this.boldStyle=`font-weight:bold`,this.faintStyle=`opacity:0.7`,this.italicStyle=`font-style:italic`,this.underlineStyle=`text-decoration:underline`}set use_classes(e){this._use_classes=e}get use_classes(){return this._use_classes}set url_allowlist(e){this._url_allowlist=e}get url_allowlist(){return this._url_allowlist}set escape_html(e){this._escape_html=e}get escape_html(){return this._escape_html}set boldStyle(e){this._boldStyle=e}get boldStyle(){return this._boldStyle}set faintStyle(e){this._faintStyle=e}get faintStyle(){return this._faintStyle}set italicStyle(e){this._italicStyle=e}get italicStyle(){return this._italicStyle}set underlineStyle(e){this._underlineStyle=e}get underlineStyle(){return this._underlineStyle}setup_palettes(){this.ansi_colors=[[{rgb:[0,0,0],class_name:`ansi-black`},{rgb:[187,0,0],class_name:`ansi-red`},{rgb:[0,187,0],class_name:`ansi-green`},{rgb:[187,187,0],class_name:`ansi-yellow`},{rgb:[0,0,187],class_name:`ansi-blue`},{rgb:[187,0,187],class_name:`ansi-magenta`},{rgb:[0,187,187],class_name:`ansi-cyan`},{rgb:[255,255,255],class_name:`ansi-white`}],[{rgb:[85,85,85],class_name:`ansi-bright-black`},{rgb:[255,85,85],class_name:`ansi-bright-red`},{rgb:[0,255,0],class_name:`ansi-bright-green`},{rgb:[255,255,85],class_name:`ansi-bright-yellow`},{rgb:[85,85,255],class_name:`ansi-bright-blue`},{rgb:[255,85,255],class_name:`ansi-bright-magenta`},{rgb:[85,255,255],class_name:`ansi-bright-cyan`},{rgb:[255,255,255],class_name:`ansi-bright-white`}]],this.palette_256=[],this.ansi_colors.forEach(e=>{e.forEach(e=>{this.palette_256.push(e)})});let e=[0,95,135,175,215,255];for(let t=0;t<6;++t)for(let n=0;n<6;++n)for(let r=0;r<6;++r){let i={rgb:[e[t],e[n],e[r]],class_name:`truecolor`};this.palette_256.push(i)}let t=8;for(let e=0;e<24;++e,t+=10){let e={rgb:[t,t,t],class_name:`truecolor`};this.palette_256.push(e)}}escape_txt_for_html(e){return this._escape_html?e.replace(/[&<>"']/gm,e=>{if(e===`&`)return`&amp;`;if(e===`<`)return`&lt;`;if(e===`>`)return`&gt;`;if(e===`"`)return`&quot;`;if(e===`'`)return`&#x27;`}):e}append_buffer(e){var t=this._buffer+e;this._buffer=t}get_next_packet(){var e={kind:Hj.EOS,text:``,url:``},t=this._buffer.length;if(t==0)return e;var n=this._buffer.indexOf(`\x1B`);if(n==-1)return e.kind=Hj.Text,e.text=this._buffer,this._buffer=``,e;if(n>0)return e.kind=Hj.Text,e.text=this._buffer.slice(0,n),this._buffer=this._buffer.slice(n),e;if(n==0){if(t<3)return e.kind=Hj.Incomplete,e;var r=this._buffer.charAt(1);if(r!=`[`&&r!=`]`&&r!=`(`)return e.kind=Hj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if(r==`[`){this._csi_regex||=Wj(Kj||=Vj([`
122
122
  ^ # beginning of line
123
123
  #
124
124
  # First attempt
@@ -152,7 +152,7 @@ mark line col
152
152
  [\\x20-\\x7e]* # anything legal
153
153
  ([\\x00-\\x1f:]) # anything illegal
154
154
  )
155
- `]));let t=this._buffer.match(this._csi_regex);if(t===null)return e.kind=zj.Incomplete,e;if(t[4])return e.kind=zj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=t[1]!=``||t[3]!=`m`?zj.Unknown:zj.SGR,e.text=t[2];var i=t[0].length;return this._buffer=this._buffer.slice(i),e}if(r==`]`){if(t<4)return e.kind=zj.Incomplete,e;if(this._buffer.charAt(2)!=`8`||this._buffer.charAt(3)!=`;`)return e.kind=zj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;this._osc_st||=Hj(Wj||=Rj([`
155
+ `]));let t=this._buffer.match(this._csi_regex);if(t===null)return e.kind=Hj.Incomplete,e;if(t[4])return e.kind=Hj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=t[1]!=``||t[3]!=`m`?Hj.Unknown:Hj.SGR,e.text=t[2];var i=t[0].length;return this._buffer=this._buffer.slice(i),e}if(r==`]`){if(t<4)return e.kind=Hj.Incomplete,e;if(this._buffer.charAt(2)!=`8`||this._buffer.charAt(3)!=`;`)return e.kind=Hj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;this._osc_st||=Gj(qj||=Vj([`
156
156
  (?: # legal sequence
157
157
  (\x1B\\) # ESC | # alternate
158
158
  (\x07) # BEL (what xterm did)
@@ -179,7 +179,7 @@ mark line col
179
179
  | # alternate
180
180
  [\\x1c-\\x1f] # anything illegal
181
181
  )
182
- `])),this._osc_st.lastIndex=0;{let t=this._osc_st.exec(this._buffer);if(t===null)return e.kind=zj.Incomplete,e;if(t[3])return e.kind=zj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e}{let t=this._osc_st.exec(this._buffer);if(t===null)return e.kind=zj.Incomplete,e;if(t[3])return e.kind=zj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e}this._osc_regex||=Vj(Gj||=Rj([`
182
+ `])),this._osc_st.lastIndex=0;{let t=this._osc_st.exec(this._buffer);if(t===null)return e.kind=Hj.Incomplete,e;if(t[3])return e.kind=Hj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e}{let t=this._osc_st.exec(this._buffer);if(t===null)return e.kind=Hj.Incomplete,e;if(t[3])return e.kind=Hj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e}this._osc_regex||=Wj(Jj||=Vj([`
183
183
  ^ # beginning of line
184
184
  #
185
185
  \x1B]8; # OSC Hyperlink
@@ -215,6 +215,6 @@ mark line col
215
215
  | # alternate
216
216
  (?:\\x07) # BEL (what xterm did)
217
217
  )
218
- `]));let n=this._buffer.match(this._osc_regex);if(n===null)return e.kind=zj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=zj.OSCURL,e.url=n[1],e.text=n[2];var i=n[0].length;return this._buffer=this._buffer.slice(i),e}if(r==`(`)return e.kind=zj.Unknown,this._buffer=this._buffer.slice(3),e}}ansi_to_html(e){this.append_buffer(e);for(var t=[];;){var n=this.get_next_packet();if(n.kind==zj.EOS||n.kind==zj.Incomplete)break;n.kind!=zj.ESC&&n.kind!=zj.Unknown&&(n.kind==zj.Text?t.push(this.transform_to_html(this.with_state(n))):n.kind==zj.SGR?this.process_ansi(n):n.kind==zj.OSCURL&&t.push(this.process_hyperlink(n)))}return t.join(``)}with_state(e){return{bold:this.bold,faint:this.faint,italic:this.italic,underline:this.underline,fg:this.fg,bg:this.bg,text:e.text}}process_ansi(e){let t=e.text.split(`;`);for(;t.length>0;){let e=t.shift(),n=parseInt(e,10);if(isNaN(n)||n===0)this.fg=null,this.bg=null,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1;else if(n===1)this.bold=!0;else if(n===2)this.faint=!0;else if(n===3)this.italic=!0;else if(n===4)this.underline=!0;else if(n===21)this.bold=!1;else if(n===22)this.faint=!1,this.bold=!1;else if(n===23)this.italic=!1;else if(n===24)this.underline=!1;else if(n===39)this.fg=null;else if(n===49)this.bg=null;else if(n>=30&&n<38)this.fg=this.ansi_colors[0][n-30];else if(n>=40&&n<48)this.bg=this.ansi_colors[0][n-40];else if(n>=90&&n<98)this.fg=this.ansi_colors[1][n-90];else if(n>=100&&n<108)this.bg=this.ansi_colors[1][n-100];else if((n===38||n===48)&&t.length>0){let e=n===38,r=t.shift();if(r===`5`&&t.length>0){let n=parseInt(t.shift(),10);n>=0&&n<=255&&(e?this.fg=this.palette_256[n]:this.bg=this.palette_256[n])}if(r===`2`&&t.length>2){let n=parseInt(t.shift(),10),r=parseInt(t.shift(),10),i=parseInt(t.shift(),10);if(n>=0&&n<=255&&r>=0&&r<=255&&i>=0&&i<=255){let t={rgb:[n,r,i],class_name:`truecolor`};e?this.fg=t:this.bg=t}}}}}transform_to_html(e){let t=e.text;if(t.length===0||(t=this.escape_txt_for_html(t),!e.bold&&!e.italic&&!e.faint&&!e.underline&&e.fg===null&&e.bg===null))return t;let n=[],r=[],i=e.fg,a=e.bg;e.bold&&n.push(this._boldStyle),e.faint&&n.push(this._faintStyle),e.italic&&n.push(this._italicStyle),e.underline&&n.push(this._underlineStyle),this._use_classes?(i&&(i.class_name===`truecolor`?n.push(`color:rgb(${i.rgb.join(`,`)})`):r.push(`${i.class_name}-fg`)),a&&(a.class_name===`truecolor`?n.push(`background-color:rgb(${a.rgb.join(`,`)})`):r.push(`${a.class_name}-bg`))):(i&&n.push(`color:rgb(${i.rgb.join(`,`)})`),a&&n.push(`background-color:rgb(${a.rgb})`));let o=``,s=``;return r.length&&(o=` class="${r.join(` `)}"`),n.length&&(s=` style="${n.join(`;`)}"`),`<span${s}${o}>${t}</span>`}process_hyperlink(e){let t=e.url.split(`:`);return t.length<1||!this._url_allowlist[t[0]]?``:`<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`}};function Vj(e,...t){let n=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,``);return new RegExp(n)}function Hj(e,...t){let n=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,``);return new RegExp(n,`g`)}var Uj,Wj,Gj,Kj=new Bj;function qj(e){try{let t=document.createElement(`div`);return t.innerHTML=e,(t.textContent||t.innerText||``).split(`
218
+ `]));let n=this._buffer.match(this._osc_regex);if(n===null)return e.kind=Hj.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=Hj.OSCURL,e.url=n[1],e.text=n[2];var i=n[0].length;return this._buffer=this._buffer.slice(i),e}if(r==`(`)return e.kind=Hj.Unknown,this._buffer=this._buffer.slice(3),e}}ansi_to_html(e){this.append_buffer(e);for(var t=[];;){var n=this.get_next_packet();if(n.kind==Hj.EOS||n.kind==Hj.Incomplete)break;n.kind!=Hj.ESC&&n.kind!=Hj.Unknown&&(n.kind==Hj.Text?t.push(this.transform_to_html(this.with_state(n))):n.kind==Hj.SGR?this.process_ansi(n):n.kind==Hj.OSCURL&&t.push(this.process_hyperlink(n)))}return t.join(``)}with_state(e){return{bold:this.bold,faint:this.faint,italic:this.italic,underline:this.underline,fg:this.fg,bg:this.bg,text:e.text}}process_ansi(e){let t=e.text.split(`;`);for(;t.length>0;){let e=t.shift(),n=parseInt(e,10);if(isNaN(n)||n===0)this.fg=null,this.bg=null,this.bold=!1,this.faint=!1,this.italic=!1,this.underline=!1;else if(n===1)this.bold=!0;else if(n===2)this.faint=!0;else if(n===3)this.italic=!0;else if(n===4)this.underline=!0;else if(n===21)this.bold=!1;else if(n===22)this.faint=!1,this.bold=!1;else if(n===23)this.italic=!1;else if(n===24)this.underline=!1;else if(n===39)this.fg=null;else if(n===49)this.bg=null;else if(n>=30&&n<38)this.fg=this.ansi_colors[0][n-30];else if(n>=40&&n<48)this.bg=this.ansi_colors[0][n-40];else if(n>=90&&n<98)this.fg=this.ansi_colors[1][n-90];else if(n>=100&&n<108)this.bg=this.ansi_colors[1][n-100];else if((n===38||n===48)&&t.length>0){let e=n===38,r=t.shift();if(r===`5`&&t.length>0){let n=parseInt(t.shift(),10);n>=0&&n<=255&&(e?this.fg=this.palette_256[n]:this.bg=this.palette_256[n])}if(r===`2`&&t.length>2){let n=parseInt(t.shift(),10),r=parseInt(t.shift(),10),i=parseInt(t.shift(),10);if(n>=0&&n<=255&&r>=0&&r<=255&&i>=0&&i<=255){let t={rgb:[n,r,i],class_name:`truecolor`};e?this.fg=t:this.bg=t}}}}}transform_to_html(e){let t=e.text;if(t.length===0||(t=this.escape_txt_for_html(t),!e.bold&&!e.italic&&!e.faint&&!e.underline&&e.fg===null&&e.bg===null))return t;let n=[],r=[],i=e.fg,a=e.bg;e.bold&&n.push(this._boldStyle),e.faint&&n.push(this._faintStyle),e.italic&&n.push(this._italicStyle),e.underline&&n.push(this._underlineStyle),this._use_classes?(i&&(i.class_name===`truecolor`?n.push(`color:rgb(${i.rgb.join(`,`)})`):r.push(`${i.class_name}-fg`)),a&&(a.class_name===`truecolor`?n.push(`background-color:rgb(${a.rgb.join(`,`)})`):r.push(`${a.class_name}-bg`))):(i&&n.push(`color:rgb(${i.rgb.join(`,`)})`),a&&n.push(`background-color:rgb(${a.rgb})`));let o=``,s=``;return r.length&&(o=` class="${r.join(` `)}"`),n.length&&(s=` style="${n.join(`;`)}"`),`<span${s}${o}>${t}</span>`}process_hyperlink(e){let t=e.url.split(`:`);return t.length<1||!this._url_allowlist[t[0]]?``:`<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`}};function Wj(e,...t){let n=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,``);return new RegExp(n)}function Gj(e,...t){let n=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,``);return new RegExp(n,`g`)}var Kj,qj,Jj,Yj=new Uj;function Xj(e){try{let t=document.createElement(`div`);return t.innerHTML=e,(t.textContent||t.innerText||``).split(`
219
219
  `).map(e=>e.trimEnd()).join(`
220
- `)}catch(t){return R.error(`Error parsing HTML content:`,t),e}}function Jj(e){if(!e)return``;try{return qj(Kj.ansi_to_html(e))}catch(t){return R.error(`Error converting ANSI to plain text:`,t),e}}var Yj=o(null);function Xj(e){return e.type===`cell`?e.cellId:`lsp:${e.name}`}var Zj=!1;function Qj(e){let t=[],n=[e.console].filter(Boolean).flat();for(let r of n){let n=r.mimetype===`text/plain`,i=r.mimetype===`text/html`||r.mimetype===`application/vnd.marimo+traceback`;if(n||i){let n=r.channel===`stderr`||r.channel===`marimo-error`;switch(r.channel){case`stdout`:case`stderr`:case`marimo-error`:{let a=Vr.asString(r.data),o=i?qj(a):a;t.push({timestamp:r.timestamp||Date.now(),level:n?`stderr`:`stdout`,message:o,source:{type:`cell`,cellId:e.cell_id}});break}}}}if(t.forEach($j.log),n.length===0&&uf(e.output?.mimetype)&&Array.isArray(e.output.data)){e.output.data.forEach(t=>{$j.log({level:`stderr`,source:{type:`cell`,cellId:e.cell_id},timestamp:e.timestamp??0,message:JSON.stringify(t)})});let t=e.output.data.filter(e=>`type`in e&&e.type===`exception`||e.type===`internal`),n=u.get(fe)===`read`;if(t.length>0&&!Zj&&n){Zj=!0;let e=t.find(e=>e.traceback);sn(e?{title:`An internal error occurred`,description:e.msg||`Click 'View' to see traceback`,variant:`danger`,action:K.createElement(vt,{altText:`View traceback`,onClick:()=>{u.set(Yj,{traceback:e.traceback,errorMessage:e.msg||`An internal error occurred`})}},`View`)}:{title:`An internal error occurred`,description:`See console for details.`,variant:`danger`})}}return t}var $j={log:e=>{let t=e.level===`stdout`?`gray`:e.level===`stderr`?`red`:`orange`,n=e.level.toUpperCase();console.log(`%c[${n}]`,`color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`,`[${eM(e.timestamp)}]`,`(${Xj(e.source)}) ${e.message}`)}};function eM(e){try{return Lj(e).toLocaleTimeString(void 0,{hour12:!0,hour:`numeric`,minute:`numeric`,second:`numeric`})}catch{return``}}function tM(e,t){let n=uN(t);n?n.focus():R.warn(`[CellFocusManager] focusCellEditor: element not found: ${t}`)}function nM(e,t){let n=document.getElementById(Li.create(e));n?aM(n,t):R.warn(`[CellFocusManager] focusCell: element not found: ${e}`)}function rM(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function iM(){return document.activeElement instanceof HTMLElement&&document.activeElement.classList.contains(`marimo-cell`)}function aM(e,t){try{e.focus(t)}catch{R.warn(`[CellFocusManager] element may not be focusable`,e)}}function oM(e,t){let{retries:n,delay:r,initialDelay:i=0}=t,a=0,o=()=>{if(a<n){try{if(e())return}catch(e){R.error(`Error executing function on attempt ${a+1}, retrying`,{error:e})}a++,setTimeout(o,r)}};i>0?setTimeout(o,i):o()}function sM({cellId:e,cell:t,isCodeHidden:n,codeFocus:r,variableName:i}){if(!t)return;let a=document.getElementById(Li.create(e));if(!a){R.warn(`scrollCellIntoView: element not found`);return}if(iM()){aM(a);return}if(n)aM(a);else{Hs.promote(e);let n=t.current?.editorView;if(!n){R.warn(`scrollCellIntoView: editor not found`,e);return}if(n.hasFocus||!document.hasFocus())return;if(oM(()=>(n.focus(),n.hasFocus),{retries:5,delay:20}),r===`top`)n.dispatch({selection:{anchor:0,head:0}});else if(r===`bottom`){let e=n.state.doc.line(n.state.doc.lines);n.dispatch({selection:{anchor:e.from,head:e.from}})}else i&&z_(n,i)}a.scrollIntoView({behavior:`smooth`,block:`nearest`})}function cM(e){let t=document.getElementById(Li.create(e));if(!t){R.warn(`scrollCellIntoView: element not found`);return}t.classList.add(`focus-outline`),setTimeout(()=>{t.classList.remove(`focus-outline`)},2e3),t.scrollIntoView({behavior:`smooth`,block:`center`})}function lM(){let e=document.getElementById(`App`);e?.scrollTo({top:e.scrollHeight,behavior:`smooth`})}function uM(){document.getElementById(`App`)?.scrollTo({top:0,behavior:`smooth`})}function dM(e){let t=uN(e);if(t?.hasFocus){wh(t,{behavior:`instant`});return}let n=document.getElementById(Li.create(e));n?n.scrollIntoView({behavior:`instant`,block:`nearest`}):R.warn(`[CellFocusManager] scrollCellIntoView: element not found: ${e}`)}function fM({id:e,name:t=`_`,code:n=``,lastCodeRun:r=null,lastExecutionTime:i=null,edited:a=!1,config:o,serializedEditorState:s=null}){return{id:e,config:o||{hide_code:!1,disabled:!1,column:null,expand_output:!1},name:t,code:n,edited:a,lastCodeRun:r,lastExecutionTime:i,serializedEditorState:s}}function pM(e){return{hide_code:!1,disabled:!1,column:null,expand_output:!1,...e}}function mM(e){return{outline:null,output:null,consoleOutputs:[],status:`idle`,staleInputs:!1,interrupted:!1,errored:!1,stopped:!1,runElapsedTimeMs:null,runStartTimestamp:null,lastRunStartTimestamp:null,debuggerActive:!1,...e}}function hM(e){let t={column:0,hide_code:!1,disabled:!1,expand_output:!1};return{...e,cellData:{[Pi]:fM({id:Pi,config:t}),...e.cellData},cellRuntime:{[Pi]:mM(),...e.cellRuntime},cellHandles:{[Pi]:(0,K.createRef)(),...e.cellHandles}}}function gM(){return hM({cellIds:_s.from([]),cellData:{},cellRuntime:{},cellHandles:{},history:[],scrollKey:null,cellLogs:[],untouchedNewCells:new Set})}var{reducer:_M,addMiddleware:vM,createActions:yM,useActions:bM,valueAtom:xM}=jr(gM,{createNewCell:(e,t)=>{let{cellId:n,before:r,code:i,name:a,config:o,lastCodeRun:s=null,lastExecutionTime:c=null,autoFocus:l=!0,skipIfCodeExists:u=!1,hideCode:d=void 0}=t,f,p;if(u){for(let t of e.cellIds.inOrderIds)if(e.cellData[t]?.code===i)return e}if(n===`__end__`){let t=e.cellIds.atOrThrow(0);f=t.id,p=t.length}else if(typeof n==`string`){let t=e.cellIds.findWithId(n);f=t.id,p=t.topLevelIds.indexOf(n)}else if(n.type===`__end__`){let t=e.cellIds.get(n.columnId)||e.cellIds.atOrThrow(0);f=t.id,p=t.length}else throw Error(`Invalid cellId`);let m=t.newCellId||Ii.create(),h=r?p:p+1;return{...e,cellIds:e.cellIds.insertId(m,f,h),cellData:{...e.cellData,[m]:fM({id:m,code:i,name:a,lastCodeRun:s,config:pM({...o,...d!=null&&{hide_code:d}}),lastExecutionTime:c,edited:!!i&&i!==s})},cellRuntime:{...e.cellRuntime,[m]:mM()},cellHandles:{...e.cellHandles,[m]:(0,K.createRef)()},scrollKey:l?m:null,untouchedNewCells:d&&l?new Set([...e.untouchedNewCells,m]):e.untouchedNewCells}},moveCell:(e,t)=>{let{cellId:n,before:r,direction:i}=t;if(r!==void 0&&i!==void 0&&R.warn(`Both before and direction specified for moveCell. Ignoring one.`),i){let t=e.cellIds.findWithId(n),r=e.cellIds.indexOf(t),a=i===`left`?r-1:r+1,o=e.cellIds.at(a);return o?{...e,cellIds:e.cellIds.moveAcrossColumns(t.id,n,o.id,void 0),scrollKey:n}:e}let a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n);return r&&o===0?{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,0),scrollKey:n}:!r&&o===a.length-1?{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,a.length-1),scrollKey:n}:r?{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,o-1),scrollKey:n}:{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,o+1),scrollKey:n}},moveCellToIndex:(e,t)=>{let{cellId:n,columnId:r,index:i}=t,a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n),s=e.cellIds.get(r);if(!s)return e;let c=Math.max(0,Math.min(i,s.length)),l=a.id===r&&o<c?c-1:c;if(a.id===r&&o===l)return e;let u=e.cellIds.deleteById(n),d=u.get(r);return d?{...e,cellIds:u.insertId(n,r,Math.max(0,Math.min(l,d.length))),scrollKey:null}:e},dropCellOverCell:(e,t)=>{let{cellId:n,overCellId:r}=t,i=e.cellIds.findWithId(n),a=e.cellIds.findWithId(r),o=i.indexOfOrThrow(n),s=a.indexOfOrThrow(r);return i.id===a.id?o===s?e:{...e,cellIds:e.cellIds.moveWithinColumn(i.id,o,s),scrollKey:null}:{...e,cellIds:e.cellIds.moveAcrossColumns(i.id,n,a.id,r),scrollKey:null}},moveCellsRelativeTo:(e,t)=>{let{cellIds:n,targetCellId:r,position:i,previousPlacements:a}=t;if(n.length===0)return e;let o=e.cellIds.moveCellsRelativeTo(n,r,i),s=a&&a.length===n.length?[...e.history,{type:`move`,cellIds:n,placements:a}]:e.history;return{...e,cellIds:o,history:s,scrollKey:null}},dropCellOverColumn:(e,t)=>{let{cellId:n,columnId:r}=t,i=e.cellIds.findWithId(n);return{...e,cellIds:e.cellIds.moveAcrossColumns(i.id,n,r,void 0)}},dropOverNewColumn:(e,t)=>{let{cellId:n}=t;return{...e,cellIds:e.cellIds.moveToNewColumn(n)}},moveColumn:(e,t)=>t.column===t.overColumn?e:{...e,cellIds:e.cellIds.moveColumn(t.column,t.overColumn)},focusCell:(e,t)=>{let n=e.cellIds.findWithId(t.cellId);if(n.length===0)return e;let{cellId:r,where:i}=t,a=n.indexOfOrThrow(r),o;o=i===`before`?Er(a-1,0,n.length-1):i===`after`?Er(a+1,0,n.length-1):a;let s=n.atOrThrow(o);return sM({cellId:s,cell:e.cellHandles[s],isCodeHidden:SM(e,s),codeFocus:i===`after`?`top`:`bottom`,variableName:void 0}),e},focusTopCell:e=>{let t=e.cellIds.getColumns().at(0);if(t===void 0||t.length===0)return e;let n=t.first();return sM({cellId:n,cell:e.cellHandles[n],isCodeHidden:SM(e,n),codeFocus:void 0,variableName:void 0}),uM(),e},focusBottomCell:e=>{let t=e.cellIds.getColumns().at(-1);if(t===void 0||t.length===0)return e;let n=t.last();return sM({cellId:n,cell:e.cellHandles[n],isCodeHidden:SM(e,n),codeFocus:void 0,variableName:void 0}),lM(),e},sendToTop:(e,t)=>{let n=e.cellIds.findWithId(t.cellId);if(n.length===0)return e;let{cellId:r,scroll:i=!0}=t,a=n.indexOfOrThrow(r);return a===0?e:{...e,cellIds:e.cellIds.moveWithinColumn(n.id,a,0),scrollKey:i?r:null}},sendToBottom:(e,t)=>{let n=e.cellIds.findWithId(t.cellId);if(n.length===0)return e;let{cellId:r,scroll:i=!0}=t,a=n.indexOfOrThrow(r),o=n.length-1;return a===o?e:{...e,cellIds:e.cellIds.moveWithinColumn(n.id,a,o),scrollKey:i?r:null}},addColumn:(e,t)=>{let n=Ii.create();return{...e,cellIds:e.cellIds.addColumn(t.columnId,[n]),cellData:{...e.cellData,[n]:fM({id:n})},cellRuntime:{...e.cellRuntime,[n]:mM()},cellHandles:{...e.cellHandles,[n]:(0,K.createRef)()},scrollKey:n}},addColumnBreakpoint:(e,t)=>{let{cellId:n}=t;return e.cellIds.getColumns()[0].inOrderIds[0]===n?e:{...e,cellIds:e.cellIds.insertBreakpoint(n)}},deleteColumn:(e,t)=>{let{columnId:n}=t;return{...e,cellIds:e.cellIds.delete(n)}},mergeAllColumns:e=>({...e,cellIds:e.cellIds.mergeAllColumns()}),compactColumns:e=>({...e,cellIds:e.cellIds.compact()}),deleteCell:(e,t)=>{let n=t.cellId;if(e.cellIds.hasOnlyOneId())return e;let r;try{r=e.cellIds.findWithId(n)}catch(t){return R.warn(`Skipping delete for missing cellId`,{cellId:n,error:t}),e}let i=r.indexOfOrThrow(n),a=i===0?1:i-1,o=null;r.length>1&&(o=r.atOrThrow(a));let s=(e.cellHandles[n].current?.editorView)?.state.toJSON({history:ir});s&&(s.doc=e.cellData[n].code),aN(n);let c=e.cellData[n];return{...e,cellIds:e.cellIds.deleteById(n),history:[...e.history,{type:`delete`,name:c.name,serializedEditorState:s,column:r.id,index:i,isSetupCell:n===Fi,config:c.config}],scrollKey:o}},undoDeleteCell:e=>{if(e.history.length===0)return e;let t=e.history[e.history.length-1];if(t.type===`move`){let{cellIds:n,placements:r}=t;if(n.length===0||r.length!==n.length||n.some(t=>!e.cellData[t]))return{...e,history:e.history.slice(0,-1)};let i=n.map((e,t)=>({id:e,columnId:r[t].columnId,index:r[t].index}));return{...e,cellIds:e.cellIds.placeCells(i),history:e.history.slice(0,-1),scrollKey:n[0]??null}}let{name:n,serializedEditorState:r={doc:``},column:i,index:a,isSetupCell:o,config:s}=t,c=o?Fi:Ii.create(),l=fM({id:c,name:n,code:r.doc,edited:r.doc.trim().length>0,serializedEditorState:r,config:s});return{...e,cellIds:e.cellIds.insertId(c,i,a),cellData:{...e.cellData,[c]:l},cellRuntime:{...e.cellRuntime,[c]:mM()},cellHandles:{...e.cellHandles,[c]:(0,K.createRef)()},history:e.history.slice(0,-1),scrollKey:c}},clearSerializedEditorState:(e,t)=>{let{cellId:n}=t;return wM({state:e,cellId:n,cellReducer:e=>({...e,serializedEditorState:null})})},updateCellCode:(e,t)=>{let{cellId:n,code:r,formattingChange:i}=t;return e.cellData[n]?wM({state:e,cellId:n,cellReducer:e=>i?{...e,code:r,lastCodeRun:e.edited?e.lastCodeRun:r}:{...e,code:r,edited:r.trim()!==e.lastCodeRun}}):e},updateCellName:(e,t)=>{let{cellId:n,name:r}=t;return wM({state:e,cellId:n,cellReducer:e=>({...e,name:r})})},updateCellConfig:(e,t)=>{let{cellId:n,config:r}=t;return wM({state:e,cellId:n,cellReducer:e=>({...e,config:pM({...e.config,...r})})})},prepareForRun:(e,t)=>wM({state:CM({state:e,cellId:t.cellId,cellReducer:e=>nj(e)}),cellId:t.cellId,cellReducer:e=>({...e,edited:!1,lastCodeRun:e.code.trim()})}),handleCellMessage:(e,t)=>{let n=t.cell_id,r=CM({state:e,cellId:n,cellReducer:e=>tj(e,t)});return t.status===`queued`&&(r=wM({state:r,cellId:n,cellReducer:e=>({...e,lastCodeRun:e.code.trim(),edited:!1})})),{...r,cellLogs:[...r.cellLogs,...Qj(t)]}},addLogs:(e,t)=>({...e,cellLogs:[...e.cellLogs,...t.logs]}),setCellIds:(e,t)=>{if(l(e.cellIds.inOrderIds,t.cellIds))return e;let n={...e.cellData},r={...e.cellRuntime},i={...e.cellHandles};for(let a of t.cellIds)a in e.cellData||(n[a]=fM({id:a})),a in e.cellRuntime||(r[a]=mM()),a in e.cellHandles||(i[a]=(0,K.createRef)());return{...e,cellIds:_s.fromWithPreviousShape(t.cellIds,e.cellIds),cellData:n,cellRuntime:r,cellHandles:i}},rebuildCellColumns:(e,t)=>{let n=_s.fromIdsAndColumns(t.cellIds.map(t=>[t,e.cellData[t]?.config.column??null]));return{...e,cellIds:n}},setCellCodes:(e,t)=>{B(t.codes.length===t.ids.length,`Expected codes and ids to have the same length`);let n={...e},r=({cell:e,code:r,cellId:i,name:a,config:o})=>{if(!e)return fM({id:i,code:r,name:a,config:o,lastCodeRun:t.codeIsStale?null:r,edited:t.codeIsStale&&r.trim().length>0});let s=t.codeIsStale?e.lastCodeRun:r,c=s?s.trim()!==r.trim():!!r;if(e.code.trim()===r.trim())return{...e,code:r,edited:c,lastCodeRun:s,...a!==void 0&&{name:a},...o!==void 0&&{config:o}};if(!HA()||!UA(i)){let e=n.cellHandles[i].current;e?.editorViewOrNull&&kA(e.editorViewOrNull,r)}return{...e,code:r,edited:c,lastCodeRun:s,...a!==void 0&&{name:a},...o!==void 0&&{config:o}}};for(let e=0;e<t.ids.length;e++){let i=t.ids[e],a=t.codes[e];if(i===void 0||a===void 0)continue;let o=t.names?.[e],s=t.configs?.[e];n={...n,cellData:{...n.cellData,[i]:r({cell:n.cellData[i],code:a,cellId:i,name:o,config:s})}}}return n},setStdinResponse:(e,t)=>{let{cellId:n,response:r,outputIndex:i}=t;return CM({state:e,cellId:n,cellReducer:e=>{let t=[...e.consoleOutputs],n=t[i];return n==null||n.channel!==`stdin`?(R.warn(`Expected stdin output`),e):(t[i]={channel:`stdin`,mimetype:n.mimetype,data:n.data,timestamp:n.timestamp,id:n.id,response:n.mimetype===`text/password`?``:r},{...e,interrupted:!1,consoleOutputs:t})}})},setCells:(e,t)=>{let n=Object.fromEntries(t.map(e=>[e.id,e])),r=_e(),i=t=>{if(!r)return mM();let n=e.cellRuntime[t];return n&&(n.output!=null||n.consoleOutputs.length>0)?n:mM()},a=Object.fromEntries(t.map(e=>[e.id,i(e.id)]));return hM({...e,cellIds:_s.fromIdsAndColumns(t.map(e=>[e.id,e.config.column])),cellData:n,cellRuntime:a,cellHandles:Object.fromEntries(t.map(e=>[e.id,(0,K.createRef)()]))})},moveToNextCell:(e,t)=>{let{cellId:n,before:r,noCreate:i=!1}=t;if(n===`__scratch__`)return e;let a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n),s=r?o-1:o+1,c=s===a.length,l=s===-1;if(c&&!i){let t=Ii.create();return{...e,cellIds:e.cellIds.insertId(t,a.id,s),cellData:{...e.cellData,[t]:fM({id:t})},cellRuntime:{...e.cellRuntime,[t]:mM()},cellHandles:{...e.cellHandles,[t]:(0,K.createRef)()},scrollKey:t}}if(l&&!i){let t=Ii.create();return{...e,cellIds:e.cellIds.insertId(t,a.id,0),cellData:{...e.cellData,[t]:fM({id:t})},cellRuntime:{...e.cellRuntime,[t]:mM()},cellHandles:{...e.cellHandles,[t]:(0,K.createRef)()},scrollKey:t}}if((c||l)&&i)return e;if(s>=0&&s<a.length){let t=a.atOrThrow(s);sM({cellId:t,cell:e.cellHandles[t],isCodeHidden:SM(e,t),codeFocus:r?`bottom`:`top`,variableName:void 0})}return e},markTouched:(e,t)=>{let{cellId:n}=t;if(e.untouchedNewCells.has(n)){let t=new Set(e.untouchedNewCells);return t.delete(n),{...e,untouchedNewCells:t}}return e},markUntouched:(e,t)=>{let{cellId:n}=t;if(!e.untouchedNewCells.has(n)){let t=new Set(e.untouchedNewCells);return t.add(n),{...e,untouchedNewCells:t}}return e},scrollToTarget:e=>{let t=e.scrollKey;if(t===null)return e;let n=e.cellIds.findWithId(t),r=n.indexOfOrThrow(t),i=r===n.length-1?n.last():n.atOrThrow(r);return sM({cellId:i,cell:e.cellHandles[i],isCodeHidden:SM(e,i),codeFocus:void 0,variableName:void 0}),{...e,scrollKey:null}},foldAll:e=>(Ls(Object.values(e.cellHandles).map(e=>e.current?.editorView)),e),unfoldAll:e=>(Rs(Object.values(e.cellHandles).map(e=>e.current?.editorView)),e),clearLogs:e=>({...e,cellLogs:[]}),collapseCell:(e,t)=>{let{cellId:n}=t,r=e.cellIds.findWithId(n),i=r.topLevelIds.map(t=>e.cellRuntime[t].outline),a=BA(r.indexOfOrThrow(n),i);if(!a)return e;let o=r.atOrThrow(a[1]);return{...e,cellIds:e.cellIds.transformWithCellId(n,e=>e.collapse(n,o)),scrollKey:n}},expandCell:(e,t)=>{let{cellId:n}=t;return{...e,cellIds:e.cellIds.transformWithCellId(n,e=>e.expand(n)),scrollKey:n}},collapseAllCells:e=>({...e,cellIds:e.cellIds.transformAll(t=>{let n=t.topLevelIds.map(t=>e.cellRuntime[t].outline),r=[...t.nodes],i=new Map,a=[],o=r.length-1;for(;o>=0;){let e=BA(o,n);if(e){let n=o,r=e[1],s=i.get(r)??r;i.set(r,n);let c=t.atOrThrow(n),l=t.atOrThrow(s);a.push({id:c,until:l})}else a.push(null);o--}let s=a.toReversed();return t.collapseAll(s)})}),expandAllCells:e=>({...e,cellIds:e.cellIds.transformAll(e=>e.expandAll())}),showCellIfHidden:(e,t)=>{let{cellId:n}=t,r=e.cellIds.findWithId(n),i=r,a=r.findAndExpandDeep(n);return a.equals(i)?e:{...e,cellIds:e.cellIds.transformWithCellId(n,()=>a)}},splitCell:(e,t)=>{let{cellId:n}=t,r=e.cellIds.findWithId(n),i=r.indexOfOrThrow(n),a=e.cellData[n],o=e.cellHandles[n].current;if(o?.editorView==null)return e;let{beforeCursorCode:s,afterCursorCode:c}=AA(o.editorView);kA(o.editorView,s);let l=Ii.create();return{...e,cellIds:e.cellIds.insertId(l,r.id,i+1),cellData:{...e.cellData,[n]:{...a,code:s,edited:!!s&&s.trim()!==a.lastCodeRun?.trim()},[l]:fM({id:l,code:c,edited:!!c})},cellRuntime:{...e.cellRuntime,[n]:{...e.cellRuntime[n],output:null,consoleOutputs:[]},[l]:mM()},cellHandles:{...e.cellHandles,[l]:(0,K.createRef)()},scrollKey:l}},undoSplitCell:(e,t)=>{let{cellId:n,snapshot:r}=t,i=e.cellData[n],a=e.cellHandles[n].current;return a?.editorView==null?e:(kA(a.editorView,r),{...e,cellIds:e.cellIds.transformWithCellId(n,e=>{let t=e.indexOfOrThrow(n)+1;return e.deleteAtIndex(t)}),cellData:{...e.cellData,[n]:{...i,code:r,edited:!!r&&r?.trim()!==i.lastCodeRun?.trim()}},cellRuntime:{...e.cellRuntime,[n]:{...e.cellRuntime[n],output:null,consoleOutputs:[]}},cellHandles:{...e.cellHandles}})},clearCellOutput:(e,t)=>{let{cellId:n}=t;return CM({state:e,cellId:n,cellReducer:e=>({...e,output:null,consoleOutputs:[]})})},clearCellConsoleOutput:(e,t)=>{let{cellId:n}=t;return CM({state:e,cellId:n,cellReducer:e=>({...e,consoleOutputs:e.consoleOutputs.filter(e=>e.channel===`stdin`&&e.response==null)})})},clearAllCellOutputs:e=>{let t={...e.cellRuntime};for(let n of e.cellIds.inOrderIds)t[n]={...t[n],output:null,consoleOutputs:[]};return{...e,cellRuntime:t}},addSetupCellIfDoesntExist:(e,t)=>{let{code:n}=t;return e.cellIds.setupCellExists()?{...e,scrollKey:Fi}:{...e,cellIds:e.cellIds.insertId(Fi,e.cellIds.atOrThrow(0).id,0),cellData:{...e.cellData,[Fi]:fM({id:Fi,name:Fi,code:n,edited:!!n})},cellRuntime:{...e.cellRuntime,[Fi]:mM()},cellHandles:{...e.cellHandles,[Fi]:(0,K.createRef)()},scrollKey:Fi}}});vM(Fj);function SM(e,t){return!!e.cellData[t].config.hide_code&&!e.untouchedNewCells.has(t)}function CM({state:e,cellId:t,cellReducer:n}){return t in e.cellRuntime?{...e,cellRuntime:{...e.cellRuntime,[t]:n(e.cellRuntime[t])}}:(R.warn(`Cell ${t} not found in state`),e)}function wM({state:e,cellId:t,cellReducer:n}){return t in e.cellData?{...e,cellData:{...e.cellData,[t]:n(e.cellData[t])}}:(R.warn(`Cell ${t} not found in state`),e)}function TM(e){let t=e.cellData,n={column:null};return e.cellIds.getColumns().length>1?e.cellIds.getColumns().flatMap((e,r)=>e.inOrderIds.map((e,i)=>{let a={...n};return i===0&&(a.column=r),{...t[e].config,...a}})):e.cellIds.getColumns().flatMap(e=>e.inOrderIds.map(e=>({...t[e].config,...n})))}var EM=yM(e=>{u.set(xM,t=>_M(t,e))}).addLogs,DM=o(e=>e(xM).cellIds),OM=o(e=>e(DM).hasOnlyOneId()),kM=o(e=>gf(e(xM)).length>0);o(e=>_f(e(xM)).length>0);var AM=o(e=>vf(e(xM))),jM=o(e=>yf(e(xM))),MM=o(e=>pf(e(xM))),NM=o(e=>{let{cellIds:t,cellRuntime:n,cellData:r}=e(xM);return t.inOrderIds.map(e=>{let t=n[e],{name:i}=r[e];if(uf(t.output?.mimetype)){B(Array.isArray(t.output.data),`Expected array data`);let n=t.output.data.filter(e=>!e.type.includes(`ancestor`));if(n.length>0)return{output:{...t.output,data:n},cellId:e,cellName:i}}return null}).filter(Boolean)}),PM=o(e=>{let t=e(DM),n=e(YM);return LA(t.inOrderIds.map(e=>n[e].outline))}),FM=o(e=>e(NM).length),IM=c(o(e=>{let{cellIds:t,cellData:n}=e(xM);return z.fromEntries(t.inOrderIds.map(e=>[e,n[e]?.name]))})),LM=o(e=>e(xM).scrollKey),RM=()=>s(xM),zM=()=>s(DM),BM=()=>s(IM),VM=()=>s(NM),HM=()=>s(xM).cellLogs,UM=()=>s(LM),WM=()=>u.get(xM),GM=()=>u.get(xM).cellIds,KM=()=>{let{cellIds:e,cellData:t}=u.get(xM);return e.inOrderIds.map(e=>t[e]?.name).filter(Boolean)},qM=be(he(xM,e=>e.cellIds.inOrderIds.map(t=>e.cellData[t]))),JM=()=>a(qM),YM=o(e=>e(xM).cellRuntime),XM=o(e=>df(e(xM))),ZM=o(e=>{let{cellRuntime:t}=e(xM);return Object.entries(t).every(([e,t])=>t.status!==`running`||e===`__scratch__`)}),QM=o(e=>ff(e(xM))),$M=o(e=>e(xM).cellIds.colLength),eN=o(e=>e(xM).cellIds.idLength>0),tN=o(e=>e(xM).cellIds.getColumnIds()),nN=ge(e=>o(t=>t(xM).cellData[e])),rN=ge(e=>o(t=>t(xM).cellRuntime[e])),iN=ge(e=>o(t=>t(xM).cellHandles[e]));function aN(e){nN.remove(e),rN.remove(e),iN.remove(e)}var oN=e=>{let t=(0,X.c)(2),n;return t[0]===e?n=t[1]:(n=nN(e),t[0]=e,t[1]=n),s(n)},sN=e=>{let t=(0,X.c)(2),n;return t[0]===e?n=t[1]:(n=rN(e),t[0]=e,t[1]=n),s(n)},cN=e=>{let t=(0,X.c)(2),n;return t[0]===e?n=t[1]:(n=iN(e),t[0]=e,t[1]=n),s(n)},lN=()=>{let{cellIds:e,cellHandles:t}=u.get(xM);return e.inOrderIds.map(e=>t[e]?.current?.editorViewOrNull).filter(Boolean)},uN=e=>{let{cellHandles:t}=u.get(xM);return t[e].current?.editorView},dN=e=>(Hs.promote(e),uN(e));function fN(e){let{cellIds:t,cellData:n,cellRuntime:r}=e;return t.getColumns().flatMap(e=>e.topLevelIds.map(e=>({...n[e],...r[e]})))}function pN(e){return o(t=>t(xM).untouchedNewCells.has(e))}function mN(e){let t=rN(e);return o(n=>{let r=n(t);if(!r||r.status===`queued`||r.status===`running`)return;let i=[],a=r.consoleOutputs;if(a&&a.length>0){let e=a.find(e=>e.mimetype===`application/vnd.marimo+traceback`);if(e){let t=e.data;i.push(...Fs(t))}}let o=r.output;if(o?.mimetype===`application/vnd.marimo+error`){let t=o.data;if(Array.isArray(t))for(let n of t)n.type===`syntax`&&n.lineno!=null&&i.push({kind:`cell`,cellId:e,lineNumber:n.lineno}),n.type===`import-star`&&n.lineno!=null&&i.push({kind:`cell`,cellId:e,lineNumber:n.lineno})}return i.length>0?i:void 0})}function hN(e){let t=(0,X.c)(2),n;return t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n),bM(n)}export{Ij as $,J as $a,Df as $i,Wy as $n,Ah as $r,hO as $t,VM as A,_s as Aa,xp as Ai,DT as An,Si as Ao,v_ as Ar,Sk as At,cM as B,es as Ba,np as Bi,Tw as Bn,ng as Br,XO as Bt,QM as C,du as Ca,Xp as Ci,wD as Cn,Fi as Co,T_ as Cr,qk as Ct,hN as D,Ps as Da,Cp as Di,lE as Dn,Ai as Do,D_ as Dr,Pk as Dt,jM as E,Fs as Ea,Dp as Ei,HE as En,ki as Eo,w_ as Er,Fk as Et,sN as F,os as Fa,yp as Fi,Lw as Fn,mg as Fr,ak as Ft,iM as G,Go as Ga,Xf as Gi,FC as Gn,Bh as Gr,PO as Gt,oM as H,Jo as Ha,Wf as Hi,nw as Hn,Qh as Hr,zO as Ht,RM as I,is as Ia,mp as Ii,kw as In,cg as Ir,rk as It,Xj as J,Bo as Ja,Kf as Ji,LC as Jn,Ph as Jr,DO as Jt,rM as K,Wo as Ka,Vf as Ki,PC as Kn,Xh as Kr,AO as Kt,UM as L,ts as La,ap as Li,Ow as Ln,rg as Lr,nk as Lt,zM as M,ds as Ma,gp as Mi,Pw as Mn,vg as Mr,Tk as Mt,HM as N,ss as Na,hp as Ni,Iw as Nn,dg as Nr,tk as Nt,oN as O,js as Oa,Tp as Oi,ME as On,wi as Oo,l_ as Or,Nk as Ot,BM as P,as as Pa,pp as Pi,Fw as Pn,gg as Pr,ok as Pt,Bj as Q,Io as Qa,zf as Qi,Gy as Qn,Nh as Qr,pO as Qt,fM as R,$o as Ra,rp as Ri,Aw as Rn,tg as Rr,ik as Rt,PM as S,Dd as Sa,Yp as Si,HD as Sn,Pi as So,b_ as Sr,Gk as St,ZM as T,Ns as Ta,Ep as Ti,WE as Tn,Ri as To,S_ as Tr,Ik as Tt,nM as U,qo as Ua,Hf as Ui,zC as Un,qh as Ur,MO as Ut,dM as V,Yo as Va,op as Vi,Cw as Vn,eg as Vr,RO as Vt,tM as W,Ko as Wa,Uf as Wi,NC as Wn,Zh as Wr,NO as Wt,Jj as X,Ro as Xa,Bf as Xi,Fb as Xn,Ih as Xr,bO as Xt,Yj as Y,zo as Ya,Yf as Yi,Xb as Yn,Fh as Yr,fO as Yt,qj as Z,Lo as Za,Rf as Zi,qy as Zn,Mh as Zr,xO as Zt,kM as _,$d as _a,lm as _i,XD as _n,Wi as _o,G_ as _r,yA as _t,YM as a,bf as aa,hh as ai,cO as an,Do as ao,sy as ar,HA as at,xM as b,zd as ba,Rp as bi,ZD as bn,Bi as bo,C_ as br,Wk as bt,dN as c,mf as ca,uh as ci,QD as cn,wo as co,Vv as cr,IA as ct,TM as d,xf as da,ch as di,$D as dn,bo as do,yv as dr,OA as dt,Of as ea,jh as ei,vO as en,Fo as eo,Ay as er,Dj as et,uN as f,uf as fa,sh as fi,UD as fn,ba as fo,ov as fr,kA as ft,eN as g,of as ga,Em as gi,GD as gn,Ui as go,Y_ as gr,DA as gt,WM as h,sf as ha,Ym as hi,JD as hn,Hi as ho,cv as hr,bA as ht,DM as i,_f as ia,xh as ii,sO as in,ko as io,py as ir,UA as it,cN as j,ps as ja,vp as ji,Jw as jn,_i as jo,Sg as jr,xk as jt,JM as k,As as ka,wp as ki,gT as kn,Ti as ko,y_ as kr,Ek as kt,fN as l,Tf as la,oh as li,tO as ln,So as lo,Iv as lr,RA as lt,GM as m,lf as ma,Qm as mi,qD as mn,Gi as mo,$_ as mr,wA as mt,nN as n,wf as na,Ch as ni,SO as nn,Mo as no,Dy as nr,rj as nt,tN as o,Sf as oa,ph as oi,aO as on,Eo as oo,cy as or,VA as ot,KM as p,cf as pa,lh as pi,WD as pn,Pa as po,sv as pr,CA as pt,eM as q,Ho as qa,Gf as qi,IC as qn,Yh as qr,EO as qt,FM as r,gf as ra,yh as ri,CO as rn,Ao as ro,Oy as rr,ij as rt,pN as s,hf as sa,dh as si,oO as sn,To as so,Hv as sr,zA as st,AM as t,Cf as ta,Oh as ti,yO as tn,Po as to,ky as tr,Mj as tt,lN as u,Ef as ua,ah as ui,rO as un,xo as uo,vv as ur,jA as ut,OM as v,Qd as va,cm as vi,KD as vn,Vi as vo,q_ as vr,EA as vt,$M as w,Hs as wa,Hp as wi,UE as wn,zi as wo,E_ as wr,Jk as wt,XM as x,Bd as xa,Lp as xi,VD as xn,Li as xo,x_ as xr,Uk as xt,MM as y,qd as ya,jp as yi,YD as yn,Ii as yo,z_ as yr,Xk as yt,mM as z,Qo as za,ip as zi,Dw as zn,Q as zr,ZO as zt};
220
+ `)}catch(t){return R.error(`Error parsing HTML content:`,t),e}}function Zj(e){if(!e)return``;try{return Xj(Yj.ansi_to_html(e))}catch(t){return R.error(`Error converting ANSI to plain text:`,t),e}}var Qj=o(null);function $j(e){return e.type===`cell`?e.cellId:`lsp:${e.name}`}var eM=!1;function tM(e){let t=[],n=[e.console].filter(Boolean).flat();for(let r of n){let n=r.mimetype===`text/plain`,i=r.mimetype===`text/html`||r.mimetype===`application/vnd.marimo+traceback`;if(n||i){let n=r.channel===`stderr`||r.channel===`marimo-error`;switch(r.channel){case`stdout`:case`stderr`:case`marimo-error`:{let a=Vr.asString(r.data),o=i?Xj(a):a;t.push({timestamp:r.timestamp||Date.now(),level:n?`stderr`:`stdout`,message:o,source:{type:`cell`,cellId:e.cell_id}});break}}}}if(t.forEach(nM.log),n.length===0&&uf(e.output?.mimetype)&&Array.isArray(e.output.data)){e.output.data.forEach(t=>{nM.log({level:`stderr`,source:{type:`cell`,cellId:e.cell_id},timestamp:e.timestamp??0,message:JSON.stringify(t)})});let t=e.output.data.filter(e=>`type`in e&&e.type===`exception`||e.type===`internal`),n=u.get(fe)===`read`;if(t.length>0&&!eM&&n){eM=!0;let e=t.find(e=>e.traceback);sn(e?{title:`An internal error occurred`,description:e.msg||`Click 'View' to see traceback`,variant:`danger`,action:K.createElement(vt,{altText:`View traceback`,onClick:()=>{u.set(Qj,{traceback:e.traceback,errorMessage:e.msg||`An internal error occurred`})}},`View`)}:{title:`An internal error occurred`,description:`See console for details.`,variant:`danger`})}}return t}var nM={log:e=>{let t=e.level===`stdout`?`gray`:e.level===`stderr`?`red`:`orange`,n=e.level.toUpperCase();console.log(`%c[${n}]`,`color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`,`[${rM(e.timestamp)}]`,`(${$j(e.source)}) ${e.message}`)}};function rM(e){try{return Bj(e).toLocaleTimeString(void 0,{hour12:!0,hour:`numeric`,minute:`numeric`,second:`numeric`})}catch{return``}}function iM(e,t){let n=pN(t);n?n.focus():R.warn(`[CellFocusManager] focusCellEditor: element not found: ${t}`)}function aM(e,t){let n=document.getElementById(Li.create(e));n?cM(n,t):R.warn(`[CellFocusManager] focusCell: element not found: ${e}`)}function oM(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function sM(){return document.activeElement instanceof HTMLElement&&document.activeElement.classList.contains(`marimo-cell`)}function cM(e,t){try{e.focus(t)}catch{R.warn(`[CellFocusManager] element may not be focusable`,e)}}function lM(e,t){let{retries:n,delay:r,initialDelay:i=0}=t,a=0,o=()=>{if(a<n){try{if(e())return}catch(e){R.error(`Error executing function on attempt ${a+1}, retrying`,{error:e})}a++,setTimeout(o,r)}};i>0?setTimeout(o,i):o()}function uM({cellId:e,cell:t,isCodeHidden:n,codeFocus:r,variableName:i}){if(!t)return;let a=document.getElementById(Li.create(e));if(!a){R.warn(`scrollCellIntoView: element not found`);return}if(sM()){cM(a);return}if(n)cM(a);else{Hs.promote(e);let n=t.current?.editorView;if(!n){R.warn(`scrollCellIntoView: editor not found`,e);return}if(n.hasFocus||!document.hasFocus())return;if(lM(()=>(n.focus(),n.hasFocus),{retries:5,delay:20}),r===`top`)n.dispatch({selection:{anchor:0,head:0}});else if(r===`bottom`){let e=n.state.doc.line(n.state.doc.lines);n.dispatch({selection:{anchor:e.from,head:e.from}})}else i&&H_(n,i)}a.scrollIntoView({behavior:`smooth`,block:`nearest`})}function dM(e){let t=document.getElementById(Li.create(e));if(!t){R.warn(`scrollCellIntoView: element not found`);return}t.classList.add(`focus-outline`),setTimeout(()=>{t.classList.remove(`focus-outline`)},2e3),t.scrollIntoView({behavior:`smooth`,block:`center`})}function fM(){let e=document.getElementById(`App`);e?.scrollTo({top:e.scrollHeight,behavior:`smooth`})}function pM(){document.getElementById(`App`)?.scrollTo({top:0,behavior:`smooth`})}function mM(e){let t=pN(e);if(t?.hasFocus){Dh(t,{behavior:`instant`});return}let n=document.getElementById(Li.create(e));n?n.scrollIntoView({behavior:`instant`,block:`nearest`}):R.warn(`[CellFocusManager] scrollCellIntoView: element not found: ${e}`)}function hM({id:e,name:t=`_`,code:n=``,lastCodeRun:r=null,lastExecutionTime:i=null,edited:a=!1,config:o,serializedEditorState:s=null}){return{id:e,config:o||{hide_code:!1,disabled:!1,column:null,expand_output:!1},name:t,code:n,edited:a,lastCodeRun:r,lastExecutionTime:i,serializedEditorState:s}}function gM(e){return{hide_code:!1,disabled:!1,column:null,expand_output:!1,...e}}function _M(e){return{outline:null,output:null,consoleOutputs:[],status:`idle`,staleInputs:!1,interrupted:!1,errored:!1,stopped:!1,runElapsedTimeMs:null,runStartTimestamp:null,lastRunStartTimestamp:null,debuggerActive:!1,...e}}function vM(e){let t={column:0,hide_code:!1,disabled:!1,expand_output:!1};return{...e,cellData:{[Pi]:hM({id:Pi,config:t}),...e.cellData},cellRuntime:{[Pi]:_M(),...e.cellRuntime},cellHandles:{[Pi]:(0,K.createRef)(),...e.cellHandles}}}function yM(){return vM({cellIds:_s.from([]),cellData:{},cellRuntime:{},cellHandles:{},history:[],scrollKey:null,cellLogs:[],untouchedNewCells:new Set})}var{reducer:bM,addMiddleware:xM,createActions:SM,useActions:CM,valueAtom:wM}=jr(yM,{createNewCell:(e,t)=>{let{cellId:n,before:r,code:i,name:a,config:o,lastCodeRun:s=null,lastExecutionTime:c=null,autoFocus:l=!0,skipIfCodeExists:u=!1,hideCode:d=void 0}=t,f,p;if(u){for(let t of e.cellIds.inOrderIds)if(e.cellData[t]?.code===i)return e}if(n===`__end__`){let t=e.cellIds.atOrThrow(0);f=t.id,p=t.length}else if(typeof n==`string`){let t=e.cellIds.findWithId(n);f=t.id,p=t.topLevelIds.indexOf(n)}else if(n.type===`__end__`){let t=e.cellIds.get(n.columnId)||e.cellIds.atOrThrow(0);f=t.id,p=t.length}else throw Error(`Invalid cellId`);let m=t.newCellId||Ii.create(),h=r?p:p+1;return{...e,cellIds:e.cellIds.insertId(m,f,h),cellData:{...e.cellData,[m]:hM({id:m,code:i,name:a,lastCodeRun:s,config:gM({...o,...d!=null&&{hide_code:d}}),lastExecutionTime:c,edited:!!i&&i!==s})},cellRuntime:{...e.cellRuntime,[m]:_M()},cellHandles:{...e.cellHandles,[m]:(0,K.createRef)()},scrollKey:l?m:null,untouchedNewCells:d&&l?new Set([...e.untouchedNewCells,m]):e.untouchedNewCells}},moveCell:(e,t)=>{let{cellId:n,before:r,direction:i}=t;if(r!==void 0&&i!==void 0&&R.warn(`Both before and direction specified for moveCell. Ignoring one.`),i){let t=e.cellIds.findWithId(n),r=e.cellIds.indexOf(t),a=i===`left`?r-1:r+1,o=e.cellIds.at(a);return o?{...e,cellIds:e.cellIds.moveAcrossColumns(t.id,n,o.id,void 0),scrollKey:n}:e}let a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n);return r&&o===0?{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,0),scrollKey:n}:!r&&o===a.length-1?{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,a.length-1),scrollKey:n}:r?{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,o-1),scrollKey:n}:{...e,cellIds:e.cellIds.moveWithinColumn(a.id,o,o+1),scrollKey:n}},moveCellToIndex:(e,t)=>{let{cellId:n,columnId:r,index:i}=t,a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n),s=e.cellIds.get(r);if(!s)return e;let c=Math.max(0,Math.min(i,s.length)),l=a.id===r&&o<c?c-1:c;if(a.id===r&&o===l)return e;let u=e.cellIds.deleteById(n),d=u.get(r);return d?{...e,cellIds:u.insertId(n,r,Math.max(0,Math.min(l,d.length))),scrollKey:null}:e},dropCellOverCell:(e,t)=>{let{cellId:n,overCellId:r}=t,i=e.cellIds.findWithId(n),a=e.cellIds.findWithId(r),o=i.indexOfOrThrow(n),s=a.indexOfOrThrow(r);return i.id===a.id?o===s?e:{...e,cellIds:e.cellIds.moveWithinColumn(i.id,o,s),scrollKey:null}:{...e,cellIds:e.cellIds.moveAcrossColumns(i.id,n,a.id,r),scrollKey:null}},moveCellsRelativeTo:(e,t)=>{let{cellIds:n,targetCellId:r,position:i,previousPlacements:a}=t;if(n.length===0)return e;let o=e.cellIds.moveCellsRelativeTo(n,r,i),s=a&&a.length===n.length?[...e.history,{type:`move`,cellIds:n,placements:a}]:e.history;return{...e,cellIds:o,history:s,scrollKey:null}},dropCellOverColumn:(e,t)=>{let{cellId:n,columnId:r}=t,i=e.cellIds.findWithId(n);return{...e,cellIds:e.cellIds.moveAcrossColumns(i.id,n,r,void 0)}},dropOverNewColumn:(e,t)=>{let{cellId:n}=t;return{...e,cellIds:e.cellIds.moveToNewColumn(n)}},moveColumn:(e,t)=>t.column===t.overColumn?e:{...e,cellIds:e.cellIds.moveColumn(t.column,t.overColumn)},focusCell:(e,t)=>{let n=e.cellIds.findWithId(t.cellId);if(n.length===0)return e;let{cellId:r,where:i}=t,a=n.indexOfOrThrow(r),o;o=i===`before`?Er(a-1,0,n.length-1):i===`after`?Er(a+1,0,n.length-1):a;let s=n.atOrThrow(o);return uM({cellId:s,cell:e.cellHandles[s],isCodeHidden:TM(e,s),codeFocus:i===`after`?`top`:`bottom`,variableName:void 0}),e},focusTopCell:e=>{let t=e.cellIds.getColumns().at(0);if(t===void 0||t.length===0)return e;let n=t.first();return uM({cellId:n,cell:e.cellHandles[n],isCodeHidden:TM(e,n),codeFocus:void 0,variableName:void 0}),pM(),e},focusBottomCell:e=>{let t=e.cellIds.getColumns().at(-1);if(t===void 0||t.length===0)return e;let n=t.last();return uM({cellId:n,cell:e.cellHandles[n],isCodeHidden:TM(e,n),codeFocus:void 0,variableName:void 0}),fM(),e},sendToTop:(e,t)=>{let n=e.cellIds.findWithId(t.cellId);if(n.length===0)return e;let{cellId:r,scroll:i=!0}=t,a=n.indexOfOrThrow(r);return a===0?e:{...e,cellIds:e.cellIds.moveWithinColumn(n.id,a,0),scrollKey:i?r:null}},sendToBottom:(e,t)=>{let n=e.cellIds.findWithId(t.cellId);if(n.length===0)return e;let{cellId:r,scroll:i=!0}=t,a=n.indexOfOrThrow(r),o=n.length-1;return a===o?e:{...e,cellIds:e.cellIds.moveWithinColumn(n.id,a,o),scrollKey:i?r:null}},addColumn:(e,t)=>{let n=Ii.create();return{...e,cellIds:e.cellIds.addColumn(t.columnId,[n]),cellData:{...e.cellData,[n]:hM({id:n})},cellRuntime:{...e.cellRuntime,[n]:_M()},cellHandles:{...e.cellHandles,[n]:(0,K.createRef)()},scrollKey:n}},addColumnBreakpoint:(e,t)=>{let{cellId:n}=t;return e.cellIds.getColumns()[0].inOrderIds[0]===n?e:{...e,cellIds:e.cellIds.insertBreakpoint(n)}},deleteColumn:(e,t)=>{let{columnId:n}=t;return{...e,cellIds:e.cellIds.delete(n)}},mergeAllColumns:e=>({...e,cellIds:e.cellIds.mergeAllColumns()}),compactColumns:e=>({...e,cellIds:e.cellIds.compact()}),deleteCell:(e,t)=>{let n=t.cellId;if(e.cellIds.hasOnlyOneId())return e;let r;try{r=e.cellIds.findWithId(n)}catch(t){return R.warn(`Skipping delete for missing cellId`,{cellId:n,error:t}),e}let i=r.indexOfOrThrow(n),a=i===0?1:i-1,o=null;r.length>1&&(o=r.atOrThrow(a));let s=(e.cellHandles[n].current?.editorView)?.state.toJSON({history:ir});s&&(s.doc=e.cellData[n].code),cN(n);let c=e.cellData[n];return{...e,cellIds:e.cellIds.deleteById(n),history:[...e.history,{type:`delete`,name:c.name,serializedEditorState:s,column:r.id,index:i,isSetupCell:n===Fi,config:c.config}],scrollKey:o}},undoDeleteCell:e=>{if(e.history.length===0)return e;let t=e.history[e.history.length-1];if(t.type===`move`){let{cellIds:n,placements:r}=t;if(n.length===0||r.length!==n.length||n.some(t=>!e.cellData[t]))return{...e,history:e.history.slice(0,-1)};let i=n.map((e,t)=>({id:e,columnId:r[t].columnId,index:r[t].index}));return{...e,cellIds:e.cellIds.placeCells(i),history:e.history.slice(0,-1),scrollKey:n[0]??null}}let{name:n,serializedEditorState:r={doc:``},column:i,index:a,isSetupCell:o,config:s}=t,c=o?Fi:Ii.create(),l=hM({id:c,name:n,code:r.doc,edited:r.doc.trim().length>0,serializedEditorState:r,config:s});return{...e,cellIds:e.cellIds.insertId(c,i,a),cellData:{...e.cellData,[c]:l},cellRuntime:{...e.cellRuntime,[c]:_M()},cellHandles:{...e.cellHandles,[c]:(0,K.createRef)()},history:e.history.slice(0,-1),scrollKey:c}},clearSerializedEditorState:(e,t)=>{let{cellId:n}=t;return DM({state:e,cellId:n,cellReducer:e=>({...e,serializedEditorState:null})})},updateCellCode:(e,t)=>{let{cellId:n,code:r,formattingChange:i}=t;return e.cellData[n]?DM({state:e,cellId:n,cellReducer:e=>i?{...e,code:r,lastCodeRun:e.edited?e.lastCodeRun:r}:{...e,code:r,edited:r.trim()!==e.lastCodeRun}}):e},updateCellName:(e,t)=>{let{cellId:n,name:r}=t;return DM({state:e,cellId:n,cellReducer:e=>({...e,name:r})})},updateCellConfig:(e,t)=>{let{cellId:n,config:r}=t;return DM({state:e,cellId:n,cellReducer:e=>({...e,config:gM({...e.config,...r})})})},prepareForRun:(e,t)=>DM({state:EM({state:e,cellId:t.cellId,cellReducer:e=>aj(e)}),cellId:t.cellId,cellReducer:e=>({...e,edited:!1,lastCodeRun:e.code.trim()})}),handleCellMessage:(e,t)=>{let n=t.cell_id,r=EM({state:e,cellId:n,cellReducer:e=>ij(e,t)});return t.status===`queued`&&(r=DM({state:r,cellId:n,cellReducer:e=>({...e,lastCodeRun:e.code.trim(),edited:!1})})),{...r,cellLogs:[...r.cellLogs,...tM(t)]}},addLogs:(e,t)=>({...e,cellLogs:[...e.cellLogs,...t.logs]}),setCellIds:(e,t)=>{if(l(e.cellIds.inOrderIds,t.cellIds))return e;let n={...e.cellData},r={...e.cellRuntime},i={...e.cellHandles};for(let a of t.cellIds)a in e.cellData||(n[a]=hM({id:a})),a in e.cellRuntime||(r[a]=_M()),a in e.cellHandles||(i[a]=(0,K.createRef)());return{...e,cellIds:_s.fromWithPreviousShape(t.cellIds,e.cellIds),cellData:n,cellRuntime:r,cellHandles:i}},rebuildCellColumns:(e,t)=>{let n=_s.fromIdsAndColumns(t.cellIds.map(t=>[t,e.cellData[t]?.config.column??null]));return{...e,cellIds:n}},setCellCodes:(e,t)=>{B(t.codes.length===t.ids.length,`Expected codes and ids to have the same length`);let n={...e},r=({cell:e,code:r,cellId:i,name:a,config:o})=>{if(!e)return hM({id:i,code:r,name:a,config:o,lastCodeRun:t.codeIsStale?null:r,edited:t.codeIsStale&&r.trim().length>0});let s=t.codeIsStale?e.lastCodeRun:r,c=s?s.trim()!==r.trim():!!r;if(e.code.trim()===r.trim())return{...e,code:r,edited:c,lastCodeRun:s,...a!==void 0&&{name:a},...o!==void 0&&{config:o}};if(!GA()||!KA(i)){let e=n.cellHandles[i].current;e?.editorViewOrNull&&MA(e.editorViewOrNull,r)}return{...e,code:r,edited:c,lastCodeRun:s,...a!==void 0&&{name:a},...o!==void 0&&{config:o}}};for(let e=0;e<t.ids.length;e++){let i=t.ids[e],a=t.codes[e];if(i===void 0||a===void 0)continue;let o=t.names?.[e],s=t.configs?.[e];n={...n,cellData:{...n.cellData,[i]:r({cell:n.cellData[i],code:a,cellId:i,name:o,config:s})}}}return n},setStdinResponse:(e,t)=>{let{cellId:n,response:r,outputIndex:i}=t;return EM({state:e,cellId:n,cellReducer:e=>{let t=[...e.consoleOutputs],n=t[i];return n==null||n.channel!==`stdin`?(R.warn(`Expected stdin output`),e):(t[i]={channel:`stdin`,mimetype:n.mimetype,data:n.data,timestamp:n.timestamp,id:n.id,response:n.mimetype===`text/password`?``:r},{...e,interrupted:!1,consoleOutputs:t})}})},setCells:(e,t)=>{let n=Object.fromEntries(t.map(e=>[e.id,e])),r=_e(),i=t=>{if(!r)return _M();let n=e.cellRuntime[t];return n&&(n.output!=null||n.consoleOutputs.length>0)?n:_M()},a=Object.fromEntries(t.map(e=>[e.id,i(e.id)]));return vM({...e,cellIds:_s.fromIdsAndColumns(t.map(e=>[e.id,e.config.column])),cellData:n,cellRuntime:a,cellHandles:Object.fromEntries(t.map(e=>[e.id,(0,K.createRef)()]))})},moveToNextCell:(e,t)=>{let{cellId:n,before:r,noCreate:i=!1}=t;if(n===`__scratch__`)return e;let a=e.cellIds.findWithId(n),o=a.indexOfOrThrow(n),s=r?o-1:o+1,c=s===a.length,l=s===-1;if(c&&!i){let t=Ii.create();return{...e,cellIds:e.cellIds.insertId(t,a.id,s),cellData:{...e.cellData,[t]:hM({id:t})},cellRuntime:{...e.cellRuntime,[t]:_M()},cellHandles:{...e.cellHandles,[t]:(0,K.createRef)()},scrollKey:t}}if(l&&!i){let t=Ii.create();return{...e,cellIds:e.cellIds.insertId(t,a.id,0),cellData:{...e.cellData,[t]:hM({id:t})},cellRuntime:{...e.cellRuntime,[t]:_M()},cellHandles:{...e.cellHandles,[t]:(0,K.createRef)()},scrollKey:t}}if((c||l)&&i)return e;if(s>=0&&s<a.length){let t=a.atOrThrow(s);uM({cellId:t,cell:e.cellHandles[t],isCodeHidden:TM(e,t),codeFocus:r?`bottom`:`top`,variableName:void 0})}return e},markTouched:(e,t)=>{let{cellId:n}=t;if(e.untouchedNewCells.has(n)){let t=new Set(e.untouchedNewCells);return t.delete(n),{...e,untouchedNewCells:t}}return e},markUntouched:(e,t)=>{let{cellId:n}=t;if(!e.untouchedNewCells.has(n)){let t=new Set(e.untouchedNewCells);return t.add(n),{...e,untouchedNewCells:t}}return e},scrollToTarget:e=>{let t=e.scrollKey;if(t===null)return e;let n=e.cellIds.findWithId(t),r=n.indexOfOrThrow(t),i=r===n.length-1?n.last():n.atOrThrow(r);return uM({cellId:i,cell:e.cellHandles[i],isCodeHidden:TM(e,i),codeFocus:void 0,variableName:void 0}),{...e,scrollKey:null}},foldAll:e=>(Ls(Object.values(e.cellHandles).map(e=>e.current?.editorView)),e),unfoldAll:e=>(Rs(Object.values(e.cellHandles).map(e=>e.current?.editorView)),e),clearLogs:e=>({...e,cellLogs:[]}),collapseCell:(e,t)=>{let{cellId:n}=t,r=e.cellIds.findWithId(n),i=r.topLevelIds.map(t=>e.cellRuntime[t].outline),a=UA(r.indexOfOrThrow(n),i);if(!a)return e;let o=r.atOrThrow(a[1]);return{...e,cellIds:e.cellIds.transformWithCellId(n,e=>e.collapse(n,o)),scrollKey:n}},expandCell:(e,t)=>{let{cellId:n}=t;return{...e,cellIds:e.cellIds.transformWithCellId(n,e=>e.expand(n)),scrollKey:n}},collapseAllCells:e=>({...e,cellIds:e.cellIds.transformAll(t=>{let n=t.topLevelIds.map(t=>e.cellRuntime[t].outline),r=[...t.nodes],i=new Map,a=[],o=r.length-1;for(;o>=0;){let e=UA(o,n);if(e){let n=o,r=e[1],s=i.get(r)??r;i.set(r,n);let c=t.atOrThrow(n),l=t.atOrThrow(s);a.push({id:c,until:l})}else a.push(null);o--}let s=a.toReversed();return t.collapseAll(s)})}),expandAllCells:e=>({...e,cellIds:e.cellIds.transformAll(e=>e.expandAll())}),showCellIfHidden:(e,t)=>{let{cellId:n}=t,r=e.cellIds.findWithId(n),i=r,a=r.findAndExpandDeep(n);return a.equals(i)?e:{...e,cellIds:e.cellIds.transformWithCellId(n,()=>a)}},splitCell:(e,t)=>{let{cellId:n}=t,r=e.cellIds.findWithId(n),i=r.indexOfOrThrow(n),a=e.cellData[n],o=e.cellHandles[n].current;if(o?.editorView==null)return e;let{beforeCursorCode:s,afterCursorCode:c}=NA(o.editorView);MA(o.editorView,s);let l=Ii.create();return{...e,cellIds:e.cellIds.insertId(l,r.id,i+1),cellData:{...e.cellData,[n]:{...a,code:s,edited:!!s&&s.trim()!==a.lastCodeRun?.trim()},[l]:hM({id:l,code:c,edited:!!c})},cellRuntime:{...e.cellRuntime,[n]:{...e.cellRuntime[n],output:null,consoleOutputs:[]},[l]:_M()},cellHandles:{...e.cellHandles,[l]:(0,K.createRef)()},scrollKey:l}},undoSplitCell:(e,t)=>{let{cellId:n,snapshot:r}=t,i=e.cellData[n],a=e.cellHandles[n].current;return a?.editorView==null?e:(MA(a.editorView,r),{...e,cellIds:e.cellIds.transformWithCellId(n,e=>{let t=e.indexOfOrThrow(n)+1;return e.deleteAtIndex(t)}),cellData:{...e.cellData,[n]:{...i,code:r,edited:!!r&&r?.trim()!==i.lastCodeRun?.trim()}},cellRuntime:{...e.cellRuntime,[n]:{...e.cellRuntime[n],output:null,consoleOutputs:[]}},cellHandles:{...e.cellHandles}})},clearCellOutput:(e,t)=>{let{cellId:n}=t;return EM({state:e,cellId:n,cellReducer:e=>({...e,output:null,consoleOutputs:[]})})},clearCellConsoleOutput:(e,t)=>{let{cellId:n}=t;return EM({state:e,cellId:n,cellReducer:e=>({...e,consoleOutputs:e.consoleOutputs.filter(e=>e.channel===`stdin`&&e.response==null)})})},clearAllCellOutputs:e=>{let t={...e.cellRuntime};for(let n of e.cellIds.inOrderIds)t[n]={...t[n],output:null,consoleOutputs:[]};return{...e,cellRuntime:t}},addSetupCellIfDoesntExist:(e,t)=>{let{code:n}=t;return e.cellIds.setupCellExists()?{...e,scrollKey:Fi}:{...e,cellIds:e.cellIds.insertId(Fi,e.cellIds.atOrThrow(0).id,0),cellData:{...e.cellData,[Fi]:hM({id:Fi,name:Fi,code:n,edited:!!n})},cellRuntime:{...e.cellRuntime,[Fi]:_M()},cellHandles:{...e.cellHandles,[Fi]:(0,K.createRef)()},scrollKey:Fi}}});xM(Rj);function TM(e,t){return!!e.cellData[t].config.hide_code&&!e.untouchedNewCells.has(t)}function EM({state:e,cellId:t,cellReducer:n}){return t in e.cellRuntime?{...e,cellRuntime:{...e.cellRuntime,[t]:n(e.cellRuntime[t])}}:(R.warn(`Cell ${t} not found in state`),e)}function DM({state:e,cellId:t,cellReducer:n}){return t in e.cellData?{...e,cellData:{...e.cellData,[t]:n(e.cellData[t])}}:(R.warn(`Cell ${t} not found in state`),e)}function OM(e){let t=e.cellData,n={column:null};return e.cellIds.getColumns().length>1?e.cellIds.getColumns().flatMap((e,r)=>e.inOrderIds.map((e,i)=>{let a={...n};return i===0&&(a.column=r),{...t[e].config,...a}})):e.cellIds.getColumns().flatMap(e=>e.inOrderIds.map(e=>({...t[e].config,...n})))}var kM=SM(e=>{u.set(wM,t=>bM(t,e))}).addLogs,AM=o(e=>e(wM).cellIds),jM=o(e=>e(AM).hasOnlyOneId()),MM=o(e=>gf(e(wM)).length>0);o(e=>_f(e(wM)).length>0);var NM=o(e=>vf(e(wM))),PM=o(e=>yf(e(wM))),FM=o(e=>pf(e(wM))),IM=o(e=>{let{cellIds:t,cellRuntime:n,cellData:r}=e(wM);return t.inOrderIds.map(e=>{let t=n[e],{name:i}=r[e];if(uf(t.output?.mimetype)){B(Array.isArray(t.output.data),`Expected array data`);let n=t.output.data.filter(e=>!e.type.includes(`ancestor`));if(n.length>0)return{output:{...t.output,data:n},cellId:e,cellName:i}}return null}).filter(Boolean)}),LM=o(e=>{let t=e(AM),n=e(QM);return BA(t.inOrderIds.map(e=>n[e].outline))}),RM=o(e=>e(IM).length),zM=c(o(e=>{let{cellIds:t,cellData:n}=e(wM);return z.fromEntries(t.inOrderIds.map(e=>[e,n[e]?.name]))})),BM=o(e=>e(wM).scrollKey),VM=()=>s(wM),HM=()=>s(AM),UM=()=>s(zM),WM=()=>s(IM),GM=()=>s(wM).cellLogs,KM=()=>s(BM),qM=()=>u.get(wM),JM=()=>u.get(wM).cellIds,YM=()=>{let{cellIds:e,cellData:t}=u.get(wM);return e.inOrderIds.map(e=>t[e]?.name).filter(Boolean)},XM=be(he(wM,e=>e.cellIds.inOrderIds.map(t=>e.cellData[t]))),ZM=()=>a(XM),QM=o(e=>e(wM).cellRuntime),$M=o(e=>df(e(wM))),eN=o(e=>{let{cellRuntime:t}=e(wM);return Object.entries(t).every(([e,t])=>t.status!==`running`||e===`__scratch__`)}),tN=o(e=>ff(e(wM))),nN=o(e=>e(wM).cellIds.colLength),rN=o(e=>e(wM).cellIds.idLength>0),iN=o(e=>e(wM).cellIds.getColumnIds()),aN=ge(e=>o(t=>t(wM).cellData[e])),oN=ge(e=>o(t=>t(wM).cellRuntime[e])),sN=ge(e=>o(t=>t(wM).cellHandles[e]));function cN(e){aN.remove(e),oN.remove(e),sN.remove(e)}var lN=e=>{let t=(0,X.c)(2),n;return t[0]===e?n=t[1]:(n=aN(e),t[0]=e,t[1]=n),s(n)},uN=e=>{let t=(0,X.c)(2),n;return t[0]===e?n=t[1]:(n=oN(e),t[0]=e,t[1]=n),s(n)},dN=e=>{let t=(0,X.c)(2),n;return t[0]===e?n=t[1]:(n=sN(e),t[0]=e,t[1]=n),s(n)},fN=()=>{let{cellIds:e,cellHandles:t}=u.get(wM);return e.inOrderIds.map(e=>t[e]?.current?.editorViewOrNull).filter(Boolean)},pN=e=>{let{cellHandles:t}=u.get(wM);return t[e].current?.editorView},mN=e=>(Hs.promote(e),pN(e));function hN(e){let{cellIds:t,cellData:n,cellRuntime:r}=e;return t.getColumns().flatMap(e=>e.topLevelIds.map(e=>({...n[e],...r[e]})))}function gN(e){return o(t=>t(wM).untouchedNewCells.has(e))}function _N(e){let t=oN(e);return o(n=>{let r=n(t);if(!r||r.status===`queued`||r.status===`running`)return;let i=[],a=r.consoleOutputs;if(a&&a.length>0){let e=a.find(e=>e.mimetype===`application/vnd.marimo+traceback`);if(e){let t=e.data;i.push(...Fs(t))}}let o=r.output;if(o?.mimetype===`application/vnd.marimo+error`){let t=o.data;if(Array.isArray(t))for(let n of t)n.type===`syntax`&&n.lineno!=null&&i.push({kind:`cell`,cellId:e,lineNumber:n.lineno}),n.type===`import-star`&&n.lineno!=null&&i.push({kind:`cell`,cellId:e,lineNumber:n.lineno})}return i.length>0?i:void 0})}function vN(e){let t=(0,X.c)(2),n;return t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n),CM(n)}export{zj as $,Io as $a,zf as $i,qy as $n,Nh as $r,vO as $t,WM as A,As as Aa,wp as Ai,AT as An,Ti as Ao,x_ as Ar,Tk as At,dM as B,Qo as Ba,ap as Bi,Ow as Bn,ag as Br,$O as Bt,tN as C,Dd as Ca,$p as Ci,DD as Cn,Pi as Co,O_ as Cr,Xk as Ct,vN as D,Fs as Da,Ep as Di,fE as Dn,ki as Do,A_ as Dr,Lk as Dt,PM as E,Ns as Ea,Ap as Ei,GE as En,Ri as Eo,D_ as Er,Rk as Et,uN as F,as as Fa,Sp as Fi,Bw as Fn,_g as Fr,ck as Ft,sM as G,Ko as Ga,$f as Gi,RC as Gn,Uh as Gr,LO as Gt,lM as H,Yo as Ha,Kf as Hi,aw as Hn,tg as Hr,HO as Ht,VM as I,os as Ia,_p as Ii,Mw as In,dg as Ir,ok as It,$j as J,Ho as Ja,qf as Ji,BC as Jn,Lh as Jr,AO as Jt,oM as K,Go as Ka,Hf as Ki,LC as Kn,$h as Kr,NO as Kt,KM as L,is as La,cp as Li,jw as Ln,og as Lr,ak as Lt,HM as M,ps as Ma,yp as Mi,Lw as Mn,_i as Mo,xg as Mr,Ok as Mt,GM as N,ds as Na,vp as Ni,zw as Nn,mg as Nr,ik as Nt,lN as O,Ps as Oa,Op as Oi,FE as On,Ai as Oo,f_ as Or,Ik as Ot,UM as P,ss as Pa,gp as Pi,Rw as Pn,yg as Pr,lk as Pt,Uj as Q,Lo as Qa,Rf as Qi,Jy as Qn,Ih as Qr,gO as Qt,hM as R,ts as Ra,op as Ri,Nw as Rn,ig as Rr,sk as Rt,LM as S,Bd as Sa,Qp as Si,GD as Sn,Li as So,C_ as Sr,Jk as St,eN as T,Hs as Ta,kp as Ti,qE as Tn,zi as To,T_ as Tr,zk as Tt,aM as U,Jo as Ua,Wf as Ui,HC as Un,Xh as Ur,FO as Ut,mM as V,es as Va,lp as Vi,Ew as Vn,rg as Vr,VO as Vt,iM as W,qo as Wa,Gf as Wi,IC as Wn,eg as Wr,IO as Wt,Zj as X,zo as Xa,Qf as Xi,Rb as Xn,zh as Xr,CO as Xt,Qj as Y,Bo as Ya,Jf as Yi,$b as Yn,Rh as Yr,hO as Yt,Xj as Z,Ro as Za,Vf as Zi,Xy as Zn,Fh as Zr,wO as Zt,MM as _,of as _a,fm as _i,$D as _n,Ui as _o,J_ as _r,SA as _t,QM as a,_f as aa,vh as ai,dO as an,ko as ao,uy as ar,GA as at,wM as b,qd as ba,Vp as bi,eO as bn,Ii as bo,E_ as br,qk as bt,mN as c,hf as ca,ph as ci,tO as cn,To as co,Wv as cr,zA as ct,OM as d,Ef as da,dh as di,nO as dn,xo as do,Sv as dr,jA as dt,Df as ea,Ph as ei,xO as en,J as eo,Ny as er,Aj as et,pN as f,xf as fa,uh as fi,KD as fn,bo as fo,lv as fr,MA as ft,rN as g,sf as ga,km as gi,JD as gn,Hi as go,Q_ as gr,AA as gt,qM as h,lf as ha,Qm as hi,ZD as hn,Gi as ho,dv as hr,CA as ht,AM as i,gf as ia,wh as ii,uO as in,Ao as io,gy as ir,KA as it,dN as j,_s as ja,xp as ji,Zw as jn,Si as jo,Tg as jr,wk as jt,ZM as k,js as ka,Dp as ki,yT as kn,wi as ko,S_ as kr,kk as kt,hN as l,mf as la,lh as li,iO as ln,wo as lo,zv as lr,VA as lt,JM as m,cf as ma,th as mi,XD as mn,Pa as mo,nv as mr,DA as mt,aN as n,Cf as na,Eh as ni,TO as nn,Po as no,Ay as nr,oj as nt,iN as o,bf as oa,gh as oi,cO as on,Do as oo,dy as or,WA as ot,YM as p,uf as pa,fh as pi,qD as pn,ba as po,uv as pr,EA as pt,rM as q,Wo as qa,Uf as qi,zC as qn,Qh as qr,kO as qt,RM as r,wf as ra,Sh as ri,EO as rn,Mo as ro,jy as rr,sj as rt,gN as s,Sf as sa,mh as si,lO as sn,Eo as so,Gv as sr,HA as st,NM as t,Of as ta,jh as ti,SO as tn,Fo as to,My as tr,Fj as tt,fN as u,Tf as ua,ch as ui,oO as un,So as uo,xv as ur,PA as ut,jM as v,$d as va,dm as vi,YD as vn,Wi as vo,X_ as vr,kA as vt,nN as w,du as wa,Gp as wi,KE as wn,Fi as wo,k_ as wr,Zk as wt,$M as x,zd as xa,Bp as xi,WD as xn,Bi as xo,w_ as xr,Kk as xt,FM as y,Qd as ya,Pp as yi,QD as yn,Vi as yo,H_ as yr,$k as yt,_M as z,$o as za,sp as zi,Aw as zn,Q as zr,ek as zt};