@marimo-team/frontend 0.25.3-dev134 → 0.25.3-dev136
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.
- package/dist/assets/{CellStatus-DC6FFQOg.js → CellStatus-B9hoYYSq.js} +1 -1
- package/dist/assets/{ErrorBoundary-Ce-Ujlwj.js → ErrorBoundary-DIoi62xQ.js} +2 -2
- package/dist/assets/{JsonOutput-CfEBzaqW.js → JsonOutput-f0zvWw7g.js} +5 -5
- package/dist/assets/{MarimoErrorOutput-Bh6o9zle.js → MarimoErrorOutput-DFCWAXPj.js} +4 -4
- package/dist/assets/{RenderHTML-COGZsXQV.js → RenderHTML-CJOIsfDF.js} +2 -2
- package/dist/assets/{RunButton-DQ51plUv.js → RunButton-BhbOSnBI.js} +1 -1
- package/dist/assets/{add-cell-with-ai-D7gtGUsg.js → add-cell-with-ai-xzt8ZIZY.js} +26 -26
- package/dist/assets/{add-connection-dialog-CpMCc97S.js → add-connection-dialog-CLcZdzEt.js} +51 -51
- package/dist/assets/{agent-panel-BSFYqJ9B.js → agent-panel-x_kvcauj.js} +3 -3
- package/dist/assets/ai-model-dropdown-DcOMJlL4.js +13 -0
- package/dist/assets/{app-config-button-Cfcg_5Bz.js → app-config-button-gr-9epH3.js} +1 -1
- package/dist/assets/{blob-CszMu60N.js → blob-B25C4ORK.js} +1 -1
- package/dist/assets/{cache-panel-DuBsA6oO.js → cache-panel-BK4-1NJC.js} +1 -1
- package/dist/assets/cell-editor-CO_2xdmY.js +42 -0
- package/dist/assets/{cell-link-Cj0gGaMV.js → cell-link-DBP_BcJY.js} +1 -1
- package/dist/assets/{cells-SvbLY10y.js → cells-B9RIIuYa.js} +42 -42
- package/dist/assets/{chat-display-D43_g3TX.js → chat-display-CvnF2GaH.js} +1 -1
- package/dist/assets/{chat-panel-B_HAJMwx.js → chat-panel-CJFHiZ2R.js} +2 -2
- package/dist/assets/{chat-ui-BEcYCphu.js → chat-ui-DbPlwime.js} +1 -1
- package/dist/assets/{column-preview-CrzaJKk8.js → column-preview-j0kenrsq.js} +1 -1
- package/dist/assets/{command-palette-Bm9yIVcD.js → command-palette-CQ1DPGNl.js} +1 -1
- package/dist/assets/{common-BJyUxCzv.js → common-C9Gvbmz5.js} +1 -1
- package/dist/assets/{components-D1f_Cz4i.js → components-CMj235gS.js} +1 -1
- package/dist/assets/{datasource-C8KSVfSD.js → datasource-BsklC6tp.js} +2 -2
- package/dist/assets/{dependency-graph-panel-BhmyJbUl.js → dependency-graph-panel-BNqY5al9.js} +3 -3
- package/dist/assets/{documentation-panel-DcVG0Q0d.js → documentation-panel-UrRQcsOB.js} +1 -1
- package/dist/assets/{download-Bx52VRE4.js → download-BRqw2JzE.js} +1 -1
- package/dist/assets/{edit-page-DUrwOHR-.js → edit-page-Dqkmdmfj.js} +6 -6
- package/dist/assets/{error-entries-11OuHzUF.js → error-entries-CuIzi5P7.js} +1 -1
- package/dist/assets/{error-panel-XJy5S25F.js → error-panel-CFCs0M8e.js} +1 -1
- package/dist/assets/{feedback-button-B7jh_B4w.js → feedback-button-DZVOiUEf.js} +2 -2
- package/dist/assets/feedback-button-J9hRaX_K.js +1 -0
- package/dist/assets/{file-explorer-panel-CnVxbF4A.js → file-explorer-panel-Cqey5tMY.js} +1 -1
- package/dist/assets/{file-name-input-BJuqjQqH.js → file-name-input-khW7mtt2.js} +1 -1
- package/dist/assets/{floating-outline-8yyZ-MOJ.js → floating-outline-CSwtWNm9.js} +1 -1
- package/dist/assets/{formatting-DW2u7HXI.js → formatting-CMgDQsM2.js} +1 -1
- package/dist/assets/{gallery-page-DJvGHePf.js → gallery-page-CcG0Msi3.js} +1 -1
- package/dist/assets/{glide-data-editor-Cyc8DHZx.js → glide-data-editor-B46-8C6x.js} +1 -1
- package/dist/assets/{home-page-tRZJmSU6.js → home-page-C5qcnnak.js} +1 -1
- package/dist/assets/{hooks-CxGwybGw.js → hooks-CiNPyjez.js} +1 -1
- package/dist/assets/index-D1hW_v1v.js +30 -0
- package/dist/assets/{input-DLA5Dhn3.js → input-BQBy_25D.js} +1 -1
- package/dist/assets/{layout-DvXJxBiL.js → layout-DSsztKhq.js} +5 -5
- package/dist/assets/{logs-panel-KtsY7TrR.js → logs-panel-DZ8zJWNT.js} +1 -1
- package/dist/assets/{markdown-renderer-DUgV7_fm.js → markdown-renderer-DszNRkaL.js} +1 -1
- package/dist/assets/{name-cell-input-C3-Cj-Ek.js → name-cell-input-BIpvW2kg.js} +1 -1
- package/dist/assets/numbers-BB-lSqeY.js +1 -0
- package/dist/assets/{outline-panel-BzyY4JA6.js → outline-panel-CHwFhhFo.js} +1 -1
- package/dist/assets/{packages-panel-DxosbWko.js → packages-panel-qT6TuHGP.js} +1 -1
- package/dist/assets/{panel-accordion-state-BRbTib2B.js → panel-accordion-state-DROYE5RR.js} +1 -1
- package/dist/assets/panels-3HImHlAU.js +1 -0
- package/dist/assets/{process-output-CSwx7rvo.js → process-output-CPh21qjo.js} +1 -1
- package/dist/assets/{readonly-code-display-B9y9423Y.js → readonly-code-display-DKoAsBb-.js} +1 -1
- package/dist/assets/{readonly-python-code-Dgw6trlk.js → readonly-python-code-QqiDzhYb.js} +1 -1
- package/dist/assets/{reveal-component-B9A4wkG-.js → reveal-component-Dd29QoYx.js} +2 -2
- package/dist/assets/{run-page-C1MQ5b_A.js → run-page-J_1gGmPH.js} +1 -1
- package/dist/assets/{runtime-details-state-D_hOQL9T.js → runtime-details-state-BlarRoM1.js} +1 -1
- package/dist/assets/{scratchpad-panel-CBCsPmMW.js → scratchpad-panel-BPw7VxO6.js} +1 -1
- package/dist/assets/{secrets-panel-ConQpchl.js → secrets-panel-j7vcP2r2.js} +1 -1
- package/dist/assets/session-panel-BnszHmkW.js +1 -0
- package/dist/assets/{snippets-panel-C0VDE_4i.js → snippets-panel-a-A15D0n.js} +1 -1
- package/dist/assets/{state-DvU2AiFx.js → state-2U7LSUNv.js} +4 -4
- package/dist/assets/{state-DrraMmqz.js → state-B_SxQGvw.js} +1 -1
- package/dist/assets/{switch-D2gdC_ep.js → switch-DLzvDOLo.js} +1 -1
- package/dist/assets/{tracing-C5d51Nmi.js → tracing-CpbvZwxP.js} +1 -1
- package/dist/assets/{tracing-panel-B89R8dWE.js → tracing-panel-Dxtm4-GJ.js} +2 -2
- package/dist/assets/{tree-actions-Cph8FVzh.js → tree-actions-CIBdpNC-.js} +1 -1
- package/dist/assets/{useAddCell-VPkB72pn.js → useAddCell-B6my967m.js} +1 -1
- package/dist/assets/{useCellActionButton--zI3GFnt.js → useCellActionButton-BwBEO8zi.js} +1 -1
- package/dist/assets/{useDeleteCell-CjewKeSr.js → useDeleteCell-DYRsSrAa.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-Bt_ka-wl.js → useDependencyPanelTab-lNbBYJZs.js} +1 -1
- package/dist/assets/{useInstallPackage-BfNKN33w.js → useInstallPackage-Q9agSKO7.js} +1 -1
- package/dist/assets/useNotebookActions-CmG2irDr.js +1 -0
- package/dist/assets/{useRunCells-BupCZpzk.js → useRunCells-Bl702L84.js} +1 -1
- package/dist/assets/{useSplitCell-CaLIR0TS.js → useSplitCell-DQRIXpFK.js} +1 -1
- package/dist/assets/{write-secret-modal-CBi2vNK_.js → write-secret-modal-BujVAO67.js} +1 -1
- package/dist/index.html +25 -25
- package/package.json +1 -1
- package/src/components/datasources/__tests__/column-preview.test.tsx +35 -3
- package/src/components/datasources/__tests__/datasources-interactions.test.tsx +181 -0
- package/src/components/datasources/__tests__/utils.test.ts +57 -6
- package/src/components/datasources/column-preview.tsx +5 -2
- package/src/components/datasources/datasources.tsx +3 -4
- package/src/components/datasources/utils.ts +32 -23
- package/src/components/ui/__tests__/range-slider.test.tsx +165 -0
- package/src/components/ui/range-slider.tsx +22 -9
- package/src/plugins/impl/RangeSliderPlugin.tsx +17 -2
- package/src/plugins/impl/__tests__/RangeSliderPlugin.test.tsx +109 -0
- package/src/utils/__tests__/numbers.test.ts +57 -0
- package/src/utils/numbers.ts +59 -9
- package/dist/assets/ai-model-dropdown-D575Vid8.js +0 -13
- package/dist/assets/cell-editor-BLpOlLnM.js +0 -42
- package/dist/assets/feedback-button-C-eKtxXE.js +0 -1
- package/dist/assets/index-CoxbqhGH.js +0 -30
- package/dist/assets/numbers-DJK15_4S.js +0 -1
- package/dist/assets/panels-Da3071Q4.js +0 -1
- package/dist/assets/session-panel-CiHCKPlx.js +0 -1
- package/dist/assets/useNotebookActions-DV2S6KaG.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./useEvent-BDjgaBtz.js";import{$n as t,
|
|
1
|
+
import{r as e}from"./useEvent-BDjgaBtz.js";import{$n as t,Ba as n,Fa as r,Qn as i,Ra as a,oi as o,vo as s,x as c,yo as l}from"./cells-B9RIIuYa.js";import{C as u,E as d,F as f,I as p,K as m,M as h,N as g,O as _,R as v,S as y,b,c as ee,v as x,z as S}from"./schemas-ChRqMOTL.js";import{t as te}from"./get-DjNf4SIX.js";import{t as ne}from"./debounce-aFmHgJZY.js";import{E as re}from"./config-CXnC3MRv.js";import{t as ie}from"./_baseSet-Bpdo9AvU.js";import{g as C,v as w}from"./useEventListener-DPOTkksd.js";import{t as ae}from"./invariant-Ci2dTZ72.js";import{s as oe}from"./config-BC32AAdw.js";import{d as se,v as ce}from"./session-BHgGkjDm.js";import{D as le,M as ue,c as T,l as de,n as fe}from"./config-7IjqNuVp.js";import{c as pe,o as E}from"./state-ClBFtZxn.js";import{c as me,o as he}from"./markdown-renderer-DszNRkaL.js";import{w as ge}from"./write-secret-modal-BujVAO67.js";import{t as _e}from"./use-toast-Wu434mLr.js";import{t as ve}from"./preload-helper-uBIymjUX.js";import{r as ye}from"./strings-3lNX212T.js";import{t as D}from"./requests-BIFR-h4M.js";import{t as be}from"./Deferred-CrTnjj37.js";import{t as xe}from"./uuid-k9DpjH68.js";import{n as Se}from"./RenderHTML-CJOIsfDF.js";import{t as Ce}from"./useRunCells-Bl702L84.js";import{r as we,t as Te}from"./blob-B25C4ORK.js";import{f as Ee}from"./useInstallPackage-Q9agSKO7.js";import{n as De,t as Oe}from"./share-BZW3tzEX.js";import{i as ke,r as Ae,t as je}from"./events-CbeVJ6OD.js";function O(e){return m(ee,e)}function k(e,t,n){return e==null?e:ie(e,t,n)}var A=p().min(1).describe(`Identifies a project. Unique within the host and unchanged while the project exists.`),j=p().min(1).describe(`Identifies a notebook. Unique within the host and unchanged while the notebook exists.`),Me=p().min(1).describe(`Identifies a runtime. Unique within the host; every start and restart creates a new id.`),Ne=p().min(1).describe(`Identifies an attachment. Unique within the host.`),Pe=p().min(1).describe("Identifies a run independently of the request's `Idempotency-Key`. Events carry the key in `request_id`."),M=p().min(1).describe(`Identifies an execution. Unique within the host.`),N=p().min(1).describe(`Identifies a console, display, or variable item. Unique within the host; sending an item again with the same id replaces it.`),P=p().min(1).describe("Identifies a cell within its notebook. Stable while the host serves the notebook; whether it survives a reload of the store depends on the format. `setup` is the setup cell."),Fe=g({pid:d().min(1).describe(`The process id.`),started_at:O({offset:!0}).describe(`When the process started.`)}).describe("The process that wrote a record. A client checks that a process\nwith this `pid` that started at `started_at` still exists. If it\ndoes not, the record is stale and may be removed.\n");g({version:_(1).describe(`The version of this record's format. This document describes version 1.`),process:Fe,name:p().describe("A label for the host to show people, such as `VS Code` or `marimo`. Two hosts can share a name; the filename is the identity."),url:p().describe("Where the host's API is. The scheme is `http`, and the host part is `127.0.0.1` or `[::1]`, written exactly that way."),token:p().min(1).describe(`The secret a client sends to prove it read the record.`)}).describe(`A host record is the file a host writes so that clients can find
|
|
2
2
|
it. A host writes \`<marimo-state-dir>/hosts-v1/<id>.json\` once its API
|
|
3
3
|
is serving at \`url\`, where \`<id>\` is an identifier the host makes
|
|
4
4
|
up each time it starts. The record does not change while the host
|
|
@@ -102,6 +102,6 @@ The data is decoded JSON. Snapshot records and reset events omit
|
|
|
102
102
|
the cursor; ready and live events carry it. Unknown event names
|
|
103
103
|
belong to later versions or host extensions.
|
|
104
104
|
`),Qt=g({id:p().describe(`Identifies this answer.`),label:p().describe(`Text to show a person.`)}).describe(`One possible answer to a decision.`),$t=g({id:p().describe(`Identifies the question when the client answers it.`),prompt:p().describe(`The question, worded for a person.`),options:y(Qt).describe(`The possible answers.`)}).describe("A question the host needs answered before it can carry out a\nrequest. The client answers by repeating the request with\n`decisions` in the body, mapping this `id` to the `id` of an\noption.\n"),en=g({change:d().min(0).describe("The index of the stale change in the request's `changes`, or of the stale cell in a run's `cells`. `0` for a save with a stale `If-Match`."),cell:v([ct,b()]).describe(`The cell the change named, as it now is. Null when the document does not have it, or when the change named the order.`),document:z}).describe(`The first stale change of an edit or run, and the state the host holds.`),tn=g({type:p().describe("What kind of problem this is, as a URI. The kinds this\nprotocol defines all start with `tag:marimo.io,2026:host/` and\nend with one of `invalid-request` (400), `unauthorized` (401),\n`forbidden` (403), `not-found` (404), `method-not-allowed`\n(405), `not-acceptable` (406), `conflict` (409), `no-runtime`\n(409), `decision-required` (409), `internal` (500), or\n`unsupported-operation` (501). A client that sees a kind it\ndoes not recognize falls back to `status`.\n"),title:p().describe(`A short, human-readable name for the kind of problem.`),status:d().min(400).max(599).describe(`The HTTP status code of the response.`),detail:p().optional().describe(`A human-readable explanation of what went wrong this time.`),decisions:y($t).optional().describe("The choices the client has to make before the host can carry out the request. Only present for `decision-required`."),edit:en.optional().describe("Which change was stale and what the host holds instead. Only present for a `conflict` answering an edit, a save, or a run of cells.")}).describe("An error. Every error response has this one shape, following RFC\n9457, and is served as `application/problem+json`. `status`\nrepeats the HTTP status, and `type` says more precisely what went\nwrong. `decisions` appears only when `type` is\n`tag:marimo.io,2026:host/decision-required`. A client ignores\nmembers it does not recognize. An error never contains a token.\n"),nn=g({project_id:A,path:p().optional().describe(`Where to put the file, relative to the project root and written the way the host's operating system writes paths.`),name:p().optional().describe(`A label to show people. In a project with a root it defaults to the filename.`)}).describe("The notebook's own fields, minus what the host assigns. A project with a root requires `path`; one without requires `name`."),rn=g({path:p().optional().describe(`The new location, relative to the project root and written the way the host's operating system writes paths.`),name:p().optional().describe(`The new label to show people.`)}).describe(`The fields to change. At least one is present.`),an=g({url:p().describe(`The URL the host used to show the notebook. It never contains the host's token.`)}),on=g({decisions:f(p(),p()).optional().describe("Answers to the questions in a `decision-required` problem.\nEach key is a decision's `id` and each value is the `id` of\nthe chosen option. A client that already knows its choices can\nsend them the first time.\n")}),sn=g({column:d().nullish().default(null),disabled:u().default(!1),hide_code:u().default(!1),expand_output:u().default(!1)}).describe(`A cell's settings as a client writes them. A field left out takes its default.`),cn=g({id:P.describe(`The cell's id. A client chooses the id of a cell it creates.`),code:p().describe(`The cell's source code.`),name:p().default(`_`).describe("The cell's name. `_` for an anonymous cell."),config:sn.optional()}).describe(`A cell as a client writes it. Code must be a string, even when the host withholds source in cell records. Null is not an edit or a request to preserve existing source. The host derives the etags.`),ln=g({kind:x([`put_cell`]),base_etag:p().nullable().describe("The cell's etag as last read, `*` to skip the check, or null to create the cell. Null when the cell exists, or an etag when it does not, is a `conflict`."),cell:cn,after:P.optional().describe(`The cell a created cell goes after. Ignored for an existing cell.`),before:P.optional().describe("The cell a created cell goes before. Ignored for an existing cell. With neither `after` nor `before`, a created cell goes at the end.")}).describe(`Replaces a whole cell, or creates one.`),un=g({kind:x([`delete_cell`]),id:P.describe(`The cell to remove.`),base_etag:p().describe("The cell's etag as last read, or `*`.")}).describe(`Removes a cell.`),dn=g({kind:x([`set_order`]),base_etag:p().describe("The document's `order_etag` as last read, or `*`."),order:y(P).describe(`Every cell id exactly once, in the new order, counting cells this edit creates and leaving out cells it deletes.`)}).describe(`Replaces the cell order.`),fn=v([ln,un,dn]).describe("One change to the document, tagged on `kind`."),pn=g({changes:y(fn).describe(`The changes, applied in order as one unit.`)}),mn=g({etag:R,code_hash:R,version:d().min(1).describe(`The cell's version after the edit.`)}).describe(`A cell's etags and version after an edit.`),hn=g({document:z,cells:f(p(),v([mn,b()])).describe(`The version of each cell the request created or changed, by id, and null for each cell it deleted.`)}).describe(`The document as an edit or save left it, or at a later revision, and the cells it touched.`),gn=g({decisions:f(p(),p()).optional().describe("Answers to the questions in a `decision-required` problem, as for `runtime.start`.")}).describe("What a save needs from the client, which is nothing until the host asks a question. `{}` is the usual body."),_n=g({id:P,code_hash:R.optional().describe("The cell's `code_hash` as last read. A cell whose code differs is a `conflict`. Absent, the cell runs as it is.")}),vn=g({code:p().optional().describe(`Python code to run as scratch code.`),cells:y(_n).min(1).optional().describe(`Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.`)}).describe("What to run, exactly one of `code` and `cells`."),yn=Ie.options.filter(e=>e!==`host`&&e!==`project`),V=class extends Error{name=`StreamStopped`},bn={events:{method:`GET`,path:`/events`,query:{types:!1},headers:{"Last-Event-ID":!1},body:null,responses:{200:`text/event-stream`},problems:[400,401,403,404,405,500]},"notebook.create":{method:`POST`,path:`/notebooks`,query:{},headers:{"Idempotency-Key":!0},body:nn,responses:{201:F},problems:[400,401,403,404,405,409,500,501]},"notebook.update":{method:`PATCH`,path:`/notebooks/{notebook_id}`,query:{},headers:{"Idempotency-Key":!0},body:rn,responses:{200:F},problems:[400,401,403,404,405,409,500,501]},"notebook.delete":{method:`DELETE`,path:`/notebooks/{notebook_id}`,query:{},headers:{"Idempotency-Key":!0},body:null,responses:{204:null},problems:[400,401,403,404,405,409,500,501]},"notebook.events":{method:`GET`,path:`/notebooks/{notebook_id}/events`,query:{types:!1,run_id:!1},headers:{"Last-Event-ID":!1,"Marimo-Attachment-Identity":!1,"Marimo-Attachment-Kind":!1,"Marimo-Attachment-Name":!1},body:null,responses:{200:`text/event-stream`},problems:[400,401,403,404,405,500]},"notebook.edit":{method:`POST`,path:`/notebooks/{notebook_id}/edits`,query:{},headers:{"Idempotency-Key":!0},body:pn,responses:{200:hn},problems:[400,401,403,404,405,409,500,501]},"notebook.save":{method:`POST`,path:`/notebooks/{notebook_id}/save`,query:{},headers:{"Idempotency-Key":!0,"If-Match":!1},body:gn,responses:{200:hn},problems:[400,401,403,404,405,409,500,501]},"notebook.open":{method:`POST`,path:`/notebooks/{notebook_id}/open`,query:{},headers:{"Idempotency-Key":!0},body:null,responses:{200:an},problems:[400,401,403,404,405,409,500,501]},"runtime.start":{method:`PUT`,path:`/notebooks/{notebook_id}/runtime`,query:{},headers:{"Idempotency-Key":!0},body:on,responses:{200:I,202:I},problems:[400,401,403,404,405,409,500,501]},"runtime.stop":{method:`DELETE`,path:`/notebooks/{notebook_id}/runtime`,query:{},headers:{"Idempotency-Key":!0},body:null,responses:{202:I},problems:[400,401,403,404,405,409,500,501]},"runtime.restart":{method:`POST`,path:`/notebooks/{notebook_id}/runtime/restart`,query:{},headers:{"Idempotency-Key":!0},body:null,responses:{202:I},problems:[400,401,403,404,405,409,500,501]},"runtime.run":{method:`POST`,path:`/notebooks/{notebook_id}/runtime/runs`,query:{},headers:{"Idempotency-Key":!0},body:vn,responses:{202:L},problems:[400,401,403,404,405,409,500,501]},"runtime.interrupt":{method:`DELETE`,path:`/notebooks/{notebook_id}/runtime/runs/{run_id}`,query:{},headers:{"Idempotency-Key":!0},body:null,responses:{202:L},problems:[400,401,403,404,405,409,500,501]}};function xn(){if(typeof globalThis.crypto.randomUUID==`function`)return globalThis.crypto.randomUUID();let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`));return[t.slice(0,4),t.slice(4,6),t.slice(6,8),t.slice(8,10),t.slice(10)].map(e=>e.join(``)).join(`-`)}function Sn(e,t){return e?.split(`;`,1)[0].trim().toLowerCase()===t}function Cn(e,t){let n=new URL(e);return n.pathname=e.pathname.replace(/\/$/,``)+t,n}function wn(e,t,n){let r=t.slice(e.prefix.length).replace(/\{(\w+)\}/g,(e,r)=>{let i=n[r];if(i===void 0||i===``||i===`.`||i===`..`)throw Error(`${t} needs a valid ${r}`);return encodeURIComponent(i)});return Cn(e.url,r)}var Tn=g({status:h().int(),body:S()});async function En(e,t,{params:n={},body:r,headers:i={},options:a={}}){let o=bn[t],s={};`Idempotency-Key`in o.headers&&(s[`Idempotency-Key`]=a.idempotencyKey??xn());for(let[e,t]of Object.entries(i))t!==void 0&&(s[e]=t);let c=o.body===null?void 0:o.body.parse(r),l=`send`in e?await On(e,{operation:t,params:{...e.params,...n},headers:Object.fromEntries(Object.entries(s).map(([e,t])=>[e.toLowerCase(),t])),body:c},a.signal):await Dn(e,o,n,s,c,a.signal),u=l.status,d=o.responses[u];if(d===null)return{ok:!0,status:u,data:void 0};if(d!==void 0&&d!==`text/event-stream`)return{ok:!0,status:u,data:d.parse(await l.json())};if((u<200||u>=300)&&l.problem)return{ok:!1,status:u,problem:tn.parse(await l.json())};throw Error(`Unexpected ${u} response to ${t}`)}async function Dn(e,t,n,r,i,a){let o=new Headers(r);o.set(`Accept`,`application/json, application/problem+json`),e.client.token!==void 0&&o.set(`Authorization`,`Bearer ${e.client.token}`),i!==void 0&&o.set(`Content-Type`,`application/json`);let s=await(e.client.fetch??globalThis.fetch)(wn(e,t.path,n),{method:t.method,headers:o,body:i===void 0?void 0:JSON.stringify(i),signal:a});return{status:s.status,problem:Sn(s.headers.get(`Content-Type`),`application/problem+json`),json:()=>s.json()}}async function On(e,t,n){n?.throwIfAborted();let r=e.send(t),i=Tn.parse(n===void 0?await r:await new Promise((e,t)=>{let i=()=>t(n.reason);n.addEventListener(`abort`,i,{once:!0}),r.then(e,t).finally(()=>n.removeEventListener(`abort`,i))}));return{status:i.status,problem:!0,json:async()=>i.body}}var kn=45e3,An=class extends TransformStream{constructor(e=JSON.parse){let t=``,n=``,r=[],i,a=t=>{if(r.length>0){let a=r.join(`
|
|
105
|
-
`),o=a;try{o=e(a)}catch{}t.enqueue({event:n||`message`,data:o,...i===void 0?{}:{id:i}})}n=``,r=[],i=void 0};super({transform(e,o){t+=e;let s=t.endsWith(`\r`)?`\r`:``,c=t.slice(0,t.length-s.length).split(/\r\n|\r|\n/);t=(c.pop()??``)+s;for(let e of c){if(e===``){a(o);continue}if(e.startsWith(`:`))continue;let t=e.indexOf(`:`),s=t===-1?e:e.slice(0,t),c=t===-1?``:e.slice(t+1);c.startsWith(` `)&&(c=c.slice(1)),s===`event`?n=c:s===`data`?r.push(c):s===`id`&&!c.includes(`\0`)&&(i=c)}}})}},jn=new Set([408,429]);function Mn(e,t={}){return async({cursor:n,signal:r},{open:i,message:a})=>{let o=new Headers;o.set(`Accept`,`text/event-stream`),t.token!==void 0&&o.set(`Authorization`,`Bearer ${t.token}`),n!==null&&o.set(`Last-Event-ID`,n);let s=new AbortController,c=()=>s.abort();r.addEventListener(`abort`,c,{once:!0});let l,u,d=()=>{clearTimeout(l),l=setTimeout(c,kn)};try{let n=new URL(typeof e==`function`?await e():e),r=t.fetch??globalThis.fetch;d();let c=await r(n,{headers:o,signal:s.signal}),{status:l}=c;if(l>=400&&l<500&&!jn.has(l)){let e=tn.safeParse(await c.json().catch(()=>void 0));throw new V(`The host refused the stream (${l})`,{cause:e.success?e.data:void 0})}if(!c.ok||c.body===null){await c.body?.cancel();return}if(!Sn(c.headers.get(`Content-Type`),`text/event-stream`))throw await c.body.cancel(),new V(`The host did not answer with an event stream`);i();let f=new TransformStream({transform(e,t){d(),t.enqueue(e)}}),p=c.body.pipeThrough(f).pipeThrough(new TextDecoderStream).pipeThrough(new An(t.parseData)).getReader();for(s.signal.addEventListener(`abort`,()=>void p.cancel(),{once:!0});;){let{done:e,value:n}=await p.read();if(e)return;if(u=t.stop?.(n),u!==void 0)throw u;a(n)}}catch(e){if(e instanceof V||e===u)throw e}finally{clearTimeout(l),r.removeEventListener(`abort`,c)}}}var Nn=new Set(Zt.options.flatMap(e=>e.shape.event.options)),Pn=g({event:p().min(1),data:S(),id:p().optional()});function H(e){queueMicrotask(()=>{throw e})}var Fn=class{#e;#t=!1;#n;#r=new Set;constructor(e,t){this.#e=e.cursor??null,this.#n=new Set([`ready`,`reset`,...(e.types??t).flatMap(e=>{let t=`${e}.removed`;return Nn.has(t)?[e,t]:[e]})])}get cursor(){return this.#e}subscribe(e){return this.#r.add(e),()=>this.#r.delete(e)}resume(){return this.#e===null&&this.#t&&this.#i({event:`reset`,data:{}}),this.#e}receive(e){let t=Pn.safeParse(e);if(!t.success)throw new V(`The host sent a message that is not an event`,{cause:t.error});this.#i(t.data)}#i(e){let t;if(Nn.has(e.event)){let n=Zt.safeParse(e);if(!n.success)throw new V(`The host sent an invalid ${e.event} event`,{cause:n.error});t=n.data}else t=e;if(e.id!==void 0&&(this.#e=e.id),t.event===`reset`?(this.#e=null,this.#t=!1):this.#e===null&&(this.#t=!0),this.#n.has(t.event))for(let e of this.#r)try{e(t)}catch(e){H(e)}}},In=10,Ln=5e3;function Rn(e){return Math.min(1e3*1.5**(e-1),15e3)*(.75+Math.random()/2)}function zn(e,t){return new Promise(n=>{let r=setTimeout(i,e);t.addEventListener(`abort`,i,{once:!0});function i(){clearTimeout(r),t.removeEventListener(`abort`,i),n()}})}var Bn=class{closed;#e;#t=`connecting`;#n=new AbortController;#r;#i;#a;#o=new Set;constructor(e,t,n){let r;if(typeof e==`function`)r=e;else{let n=new URL(e);t.types!==void 0&&n.searchParams.set(`types`,t.types.join(`,`)),r=Mn(n,t)}if(this.#e=new Fn({types:t.types,cursor:t.cursor},n),this.#r=t.onStatus,this.closed=new Promise((e,t)=>{this.#i={resolve:e,reject:t}}),this.closed.catch(()=>void 0),t.signal?.aborted){this.close();return}let i=t.signal;if(i!==void 0){let e=()=>this.close();i.addEventListener(`abort`,e,{once:!0}),this.#a=()=>i.removeEventListener(`abort`,e)}this.#s(r)}get status(){return this.#t}get cursor(){return this.#e.cursor}subscribe(e,t){let n=!0,r=this.#e.subscribe(t=>{n&&e(t)}),i=e=>{n&&t?.(e)};return t!==void 0&&this.#i!==void 0&&this.#o.add(i),()=>{n=!1,this.#o.delete(i),r()}}close(){this.#l()?.resolve()}[Symbol.asyncIterator](){let e=[],t=[],n=()=>t.splice(0).forEach(e=>e()),r,i=this.subscribe(t=>{e.push(t),n()});this.closed.then(()=>{r={},n()},e=>{r={error:e},n()});let a=()=>(i(),this.close(),{done:!0,value:void 0});return{next:async()=>{for(;;){let n=e.shift();if(n!==void 0)return{done:!1,value:n};if(r!==void 0){if(r.error!==void 0)throw i(),r.error;return a()}await new Promise(e=>t.push(e))}},return:async()=>a()}}async#s(e){await Promise.resolve();let{signal:t}=this.#n,n=0;for(;!t.aborted;){let r=!0,i=!1,a;try{await e({cursor:this.#e.resume(),signal:t},{open:()=>{r&&this.#i!==void 0&&this.#c(`connected`)},message:e=>{if(!(!r||this.#i===void 0)){a??=setTimeout(()=>{i=!0},Ln);try{this.#e.receive(e)}catch(e){this.#l()?.reject(e)}}}})}catch(e){this.#l()?.reject(e);return}finally{r=!1,clearTimeout(a)}if(t.aborted)return;if(this.#c(`connecting`),n=i?1:n+1,n>In){this.#l()?.reject(new V(`The host could not be reached`));return}await zn(Rn(n),t)}}#c(e){if(this.#t!==e){this.#t=e;try{this.#r?.(e)}catch(e){H(e)}}}#l(){let e=this.#i;if(e===void 0)return;this.#i=void 0;let t=[...this.#o];return this.#o.clear(),this.#a?.(),this.#n.abort(),this.#c(`closed`),{resolve:e.resolve,reject:n=>{e.reject(n);for(let e of t)try{e(n)}catch(e){H(e)}}}}},Vn=class extends Bn{constructor(e,t={}){typeof e!=`function`&&t.runId!==void 0&&(e=new URL(e),e.searchParams.set(`run_id`,t.runId)),super(e,t,yn)}},Hn=class{#e;constructor(e){this.#e=e}update(e,t){return this.#t(`notebook.update`,{body:e,options:t})}delete(e){return this.#t(`notebook.delete`,{options:e})}open(e){return this.#t(`notebook.open`,{options:e})}edit(e,t){return this.#t(`notebook.edit`,{body:{changes:[...e]},options:t})}save(e){return this.#t(`notebook.save`,{body:{decisions:e?.decisions},headers:{"If-Match":e?.ifMatch},options:e})}start(e){return this.#t(`runtime.start`,{body:{decisions:e?.decisions},options:e})}stop(e){return this.#t(`runtime.stop`,{options:e})}restart(e){return this.#t(`runtime.restart`,{options:e})}run(e,t){return this.#t(`runtime.run`,{body:e,options:t})}interrupt(e,t){return this.#t(`runtime.interrupt`,{params:{run_id:e},options:t})}#t(e,t){return En(this.#e,e,t)}},Un=class extends Hn{#e;#t;constructor(e,t={}){let n=new URL(e);super({url:n,prefix:`/notebooks/{notebook_id}`,client:t}),this.#e=n,this.#t=t}static unstable_over(e,{notebookId:t}){return new Hn({send:t=>e(t),prefix:`/notebooks/{notebook_id}`,params:{notebook_id:t}})}get url(){return new URL(this.#e)}events(e={}){return new Vn(Cn(this.#e,`/events`),{...this.#t,...e})}};function Wn(e,t){return t?(t.throwIfAborted(),new Promise((n,r)=>{let i=()=>r(t.reason);t.addEventListener(`abort`,i,{once:!0}),e().then(n,r).finally(()=>t.removeEventListener(`abort`,i))})):e()}function Gn(e){let t=Un.unstable_over(t=>e.call(t),{notebookId:e.notebookId});return{transport:async({cursor:t,signal:n},{open:r,message:i})=>{if(n.aborted)return;let a,o,s=new Promise(e=>{o=e}),c=()=>{a?.(),o()};n.addEventListener(`abort`,c,{once:!0});try{r(),await Wn(()=>e.subscribe(t,e=>{n.aborted||i(e)}).then(e=>{a=e,n.aborted&&e()}),n),await s}catch(e){if(!n.aborted)throw a?.(),new V(`Could not follow the WASM notebook`,{cause:e})}finally{n.removeEventListener(`abort`,c)}},notebook:n=>{if(n!==e.notebookId)throw Error(`The worker serves notebook ${e.notebookId}, not ${n}`);return t}}}function Kn(e,t){if(e.origin===globalThis.origin)return new Worker(e.href,{...t,type:`module`});let n=`import ${JSON.stringify(e.href)}`,r=globalThis.origin===`null`?`data:application/javascript,${encodeURIComponent(n)}`:URL.createObjectURL(new Blob([n],{type:`application/javascript`}));try{return new Worker(r,{...t,type:`module`})}finally{r.startsWith(`blob:`)&&URL.revokeObjectURL(r)}}function qn(e){return e.assetUrl,e}var Jn=1e10,Yn=1e3;function U(e,t){let n=e.map(e=>`"${e}"`).join(`, `);return Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function Xn(e={}){let t={};function n(e){t=e}let r={};function i(e){r.unregisterHandler&&r.unregisterHandler(),r=e,r.registerHandler?.(x)}let a;function o(e){if(typeof e==`function`){a=e;return}a=(t,n)=>{let r=e[t];if(r)return r(n);let i=e._;if(!i)throw Error(`The requested method has no handler: ${t}`);return i(t,n)}}let{maxRequestTime:s=Yn}=e;e.transport&&i(e.transport),e.requestHandler&&o(e.requestHandler),e._debugHooks&&n(e._debugHooks);let c=0;function l(){return c<=Jn?++c:c=0}let u=new Map,d=new Map;function f(e,...n){let i=n[0];return new Promise((n,a)=>{if(!r.send)throw U([`send`],`make requests`);let o=l(),c={type:`request`,id:o,method:e,params:i};u.set(o,{resolve:n,reject:a}),s!==1/0&&d.set(o,setTimeout(()=>{d.delete(o),a(Error(`RPC request timed out.`))},s)),t.onSend?.(c),r.send(c)})}let p=new Proxy(f,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>f(t,e)}),m=p;function h(e,...n){let i=n[0];if(!r.send)throw U([`send`],`send messages`);let a={type:`message`,id:e,payload:i};t.onSend?.(a),r.send(a)}let g=new Proxy(h,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>h(t,e)}),_=g,v=new Map,y=new Set;function b(e,t){if(!r.registerHandler)throw U([`registerHandler`],`register message listeners`);if(e===`*`){y.add(t);return}v.has(e)||v.set(e,new Set),v.get(e)?.add(t)}function ee(e,t){if(e===`*`){y.delete(t);return}v.get(e)?.delete(t),v.get(e)?.size===0&&v.delete(e)}async function x(e){if(t.onReceive?.(e),!(`type`in e))throw Error(`Message does not contain a type.`);if(e.type===`request`){if(!r.send||!a)throw U([`send`,`requestHandler`],`handle requests`);let{id:n,method:i,params:o}=e,s;try{s={type:`response`,id:n,success:!0,payload:await a(i,o)}}catch(e){if(!(e instanceof Error))throw e;s={type:`response`,id:n,success:!1,error:e.message}}t.onSend?.(s),r.send(s);return}if(e.type===`response`){let t=d.get(e.id);t!=null&&clearTimeout(t);let{resolve:n,reject:r}=u.get(e.id)??{};e.success?n?.(e.payload):r?.(Error(e.error));return}if(e.type===`message`){for(let t of y)t(e.id,e.payload);let t=v.get(e.id);if(!t)return;for(let n of t)n(e.payload);return}throw Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:i,setRequestHandler:o,request:p,requestProxy:m,send:g,sendProxy:_,addMessageListener:b,removeMessageListener:ee,proxy:{send:_,request:m},_setDebugHooks:n}}function Zn(e){return Xn(e)}var Qn=`[transport-id]`;function $n(e,t){let{transportId:n}=t;return n==null?e:{[Qn]:n,data:e}}function er(e,t){let{transportId:n,filter:r}=t,i=r?.();if(n!=null&&i!=null)throw Error("Cannot use both `transportId` and `filter` at the same time");let a=e;if(n){if(e[Qn]!==n)return[!0];a=e.data}return i===!1?[!0]:[!1,a]}function tr(e,t={}){let{transportId:n,filter:r,remotePort:i}=t,a=e,o=i??e,s;return{send(e){o.postMessage($n(e,{transportId:n}))},registerHandler(e){s=t=>{let i=t.data,[a,o]=er(i,{transportId:n,filter:()=>r?.(t)});a||e(o)},a.addEventListener(`message`,s)},unregisterHandler(){s&&a.removeEventListener(`message`,s)}}}function nr(e,t){return tr(e,t)}var rr=`::controller`,ir=`marimo-transport`;function ar(e){return Zn({transport:nr(e,{transportId:ir}),maxRequestTime:2e4,_debugHooks:{onSend:e=>{C.debug(`[rpc] Parent -> Worker`,e)},onReceive:e=>{C.debug(`[rpc] Worker -> Parent`,e)}}})}function or(){let e=document.querySelector(`marimo-wasm`),t=e=>{try{return e?new URL(e,document.baseURI).href:void 0}catch{return}};return{version:pe(),pyodideIndexUrl:t(e?.dataset.pyodideIndexUrl),pyodideLockfileUrl:t(e?.dataset.pyodideLockfileUrl),pypiIndexUrl:t(e?.dataset.pypiIndexUrl)?.replaceAll(`%7Bpackage_name%7D`,`{package_name}`)}}var sr=De(),cr=`marimo:file`,lr=new r(null),ur={saveFile(e){lr.set(cr,e)},readFile(){return lr.get(cr)}},dr={saveFile(e){s.setCodeForHash((0,sr.compressToEncodedURIComponent)(e))},readFile(){let e=s.getCodeFromHash()||s.getCodeFromSearchParam();return e?(0,sr.decompressFromEncodedURIComponent)(e):null}},fr={saveFile(e){},readFile(){let e=document.querySelector(`marimo-code`);return e?decodeURIComponent(e.textContent||``).trim():null}},pr={saveFile(e){},readFile(){if(window.location.hostname!==`marimo.app`)return null;let e=new URL(`export_demos/wasm-intro.py`,document.baseURI);return fetch(e.toString()).then(e=>e.ok?e.text():null).catch(()=>null)}},mr={saveFile(e){},readFile(){return e.get(n)??null}},hr={saveFile(e){},readFile(){return[`import marimo`,`app = marimo.App()`,``,`@app.cell`,`def __():`,` return`,``,`if __name__ == "__main__":`,` app.run()`].join(`
|
|
106
|
-
`)}},gr=class{stores;constructor(e){this.stores=e}insert(e,t){this.stores.splice(e,0,t)}saveFile(e){this.stores.forEach(t=>t.saveFile(e))}readFile(){for(let e of this.stores){let t=e.readFile();if(t)return t}return null}},W=new gr([mr,fr,dr]),G=new gr([ur,pr,hr]),_r=new URL(`save-worker-UwdGcNK5.js`,import.meta.url).href,vr=new URL(`worker-jm2VC7pS.js`,import.meta.url).href,yr=class t{static get INSTANCE(){let e=`_marimo_private_PyodideBridge`;return window[e]||(window[e]=new t),window[e]}rpc;saveRpc;pendingSessionSave=Promise.resolve();notebookConsumers=new Map;interruptBuffer;messageConsumer;initialized=new be;getSaveWorker(){if(se()===`read`)return C.debug(`Using partially disabled SaveWorker in read-mode`),{readFile:w,readNotebook:async()=>await W.readFile()??``,saveNotebook:w};let e=or(),t=ar(Kn(new URL(_r,import.meta.url),{name:br()}));return t.send.bootstrap(e),t.proxy.request}constructor(){if(!ue())return;let t=or(),n=Kn(new URL(vr,import.meta.url),{name:br()});this.rpc=ar(n),this.rpc.send.bootstrap(t),this.rpc.addMessageListener(`notebookEvent`,({id:e,event:t})=>{this.notebookConsumers.get(e)?.(JSON.parse(t))}),this.rpc.addMessageListener(`ready`,()=>{this.startSession()}),this.rpc.addMessageListener(`initialized`,()=>{this.saveRpc=this.getSaveWorker(),this.setInterruptBuffer(),e.set(E,{kind:`ready`}),this.initialized.resolve()}),this.rpc.addMessageListener(`initializingMessage`,({message:t})=>{e.get(E).kind===`loading`&&e.set(E,{kind:`loading`,message:t})}),this.rpc.addMessageListener(`initializedError`,({error:t})=>{if(this.initialized.status===`resolved`){C.error(t),_e({title:`Error initializing`,description:t,variant:`danger`});return}e.set(E,{kind:`error`,message:t}),this.initialized.reject(Error(t))}),this.rpc.addMessageListener(`kernelMessage`,({message:e})=>{this.messageConsumer?.(new MessageEvent(`message`,{data:e}))})}async startSession(){let t=await W.readFile(),
|
|
107
|
-
`)),await this.putControlRequest({type:`execute-cells`,...e}),null);sendRunScratchpad=async e=>(await this.rpc.proxy.request.loadPackages(e.code),await this.putControlRequest({type:`execute-scratchpad`,...e}),null);sendInterrupt=async()=>(this.interruptBuffer!==void 0&&(this.interruptBuffer[0]=2),null);sendShutdown=async()=>(window.close(),null);sendFormat=async e=>await this.rpc.proxy.request.bridge({functionName:`format`,payload:e});sendDeleteCell=async e=>(await this.putControlRequest({type:`delete-cell`,...e}),null);sendInstallMissingPackages=async e=>(this.putControlRequest({type:`install-packages`,...e}),null);sendCodeCompletionRequest=async t=>(e.get(c)||await this.rpc.proxy.request.bridge({functionName:`code_complete`,payload:t}),null);saveUserConfig=async e=>(await this.rpc.proxy.request.bridge({functionName:`save_user_config`,payload:e}),oe.post(`/kernel/save_user_config`,e,{baseUrl:`/`}).catch(e=>(C.error(e),null)));saveAppConfig=async e=>(await this.rpc.proxy.request.bridge({functionName:`save_app_config`,payload:e}),null);saveCellConfig=async e=>(await this.putControlRequest({type:`update-cell-config`,...e}),null);sendRestart=async()=>{let e=await this.readCode();return e.contents&&(W.saveFile(e.contents),G.saveFile(e.contents)),Ee(),null};readCode=async()=>this.saveRpc?{contents:await this.saveRpc.readNotebook()}:(C.warn(`Save RPC not initialized`),{contents:``});readSnippets=async()=>await this.rpc.proxy.request.bridge({functionName:`read_snippets`,payload:void 0});openFile=async()=>{let e=Oe({code:null,baseUrl:window.location.origin});return window.open(e,`_blank`),null};sendListFiles=async e=>await this.rpc.proxy.request.bridge({functionName:`list_files`,payload:e});getFileRoots=async()=>await this.rpc.proxy.request.bridge({functionName:`file_roots`,payload:void 0});sendSearchFiles=async e=>await this.rpc.proxy.request.bridge({functionName:`search_files`,payload:e});sendComponentValues=async e=>(await this.putControlRequest({type:`update-ui-element`,...e,token:xe()}),null);sendInstantiate=async()=>null;sendFunctionRequest=async e=>(await this.putControlRequest({type:`invoke-function`,...e}),null);sendCreateFileOrFolder=async e=>{let t=null;return e.file&&(t=(await we(e.file)).split(`,`)[1]??``),await this.rpc.proxy.request.bridge({functionName:`create_file_or_directory`,payload:{path:e.path,type:e.type,name:e.name,contents:t}})};sendDeleteFileOrFolder=async e=>await this.rpc.proxy.request.bridge({functionName:`delete_file_or_directory`,payload:e});sendCopyFileOrFolder=async e=>await this.rpc.proxy.request.bridge({functionName:`copy_file_or_directory`,payload:e});sendRenameFileOrFolder=async e=>await this.rpc.proxy.request.bridge({functionName:`move_file_or_directory`,payload:e});sendUpdateFile=async e=>await this.rpc.proxy.request.bridge({functionName:`update_file`,payload:e});sendFileDetails=async e=>await this.rpc.proxy.request.bridge({functionName:`file_details`,payload:e});exportAsHTML=async e=>(await this.pendingSessionSave,await this.rpc.proxy.request.bridge({functionName:`export_html`,payload:qn(e)}));exportAsMarkdown=async e=>(await this.pendingSessionSave,await this.rpc.proxy.request.bridge({functionName:`export_markdown`,payload:e}));exportAsScript=async e=>(await this.pendingSessionSave,await this.rpc.proxy.request.bridge({functionName:`export_script`,payload:e}));previewDatasetColumn=async e=>(await this.putControlRequest({type:`preview-dataset-column`,...e}),null);previewSQLTable=async e=>(await this.putControlRequest({type:`preview-sql-table`,...e}),null);previewSQLTableList=async e=>(await this.putControlRequest({type:`list-sql-tables`,...e}),null);previewSQLSchemaList=async e=>(await this.putControlRequest({type:`list-sql-schemas`,...e}),null);previewDataSourceConnection=async e=>(await this.putControlRequest({type:`list-data-source-connection`,...e}),null);validateSQL=async e=>(await this.putControlRequest({type:`validate-sql`,...e}),null);sendModelValue=async e=>(await this.putControlRequest({type:`model`,...e}),null);sendDocumentTransaction=()=>Promise.resolve(null);addPackage=async e=>this.rpc.proxy.request.addPackage(e);removePackage=async e=>this.rpc.proxy.request.removePackage(e);getPackageList=async()=>await this.rpc.proxy.request.listPackages();getSandbox=async()=>({backend:null,manifest:null,filename:null});updateManifest=async()=>{throw Error(`Sandboxes are not supported in WebAssembly`)};syncSandbox=async()=>{throw Error(`Sandboxes are not supported in WebAssembly`)};getDependencyTree=async()=>({tree:{dependencies:[],name:``,tags:[],version:null},context:{kind:`package-manager`,name:`micropip`}});listSecretKeys=async e=>(await this.putControlRequest({type:`list-secret-keys`,...e}),null);discoverDataSources=async e=>(await this.putControlRequest({type:`discover-data-sources`,...e}),null);getUsageStats=w;getEnvironmentInfo=async()=>await this.rpc.proxy.request.bridge({functionName:`get_environment_info`,payload:void 0});openTutorial=w;getRecentFiles=w;getWorkspaceFiles=w;getRunningNotebooks=w;shutdownSession=w;getExportAvailability=w;installExportRequirements=w;exportAsIPYNB=w;exportAsPDF=w;autoExportAsHTML=w;autoExportAsMarkdown=w;autoExportAsIPYNB=w;updateCellOutputs=w;writeSecret=w;invokeAiTool=w;clearCache=w;getCacheInfo=w;listStorageEntries=w;downloadStorage=w;async putControlRequest(e){await this.rpc.proxy.request.bridge({functionName:`put_control_request`,payload:e})}};function br(){return`marimo${typeof window<`u`&&window.__MARIMO_HAS_WASM_CONTROLLER__===!0?rr:``}`}function xr(e=T()){let t=window.fetch;return window.fetch=async(n,r)=>{let i=n instanceof Request?n.url:n.toString();if(i.startsWith(`data:`))return t(n,r);try{let a=K(i,e);if(a){let e=await(await t(a)).arrayBuffer();return new Response(e,{headers:{"Content-Type":Sr(i)}})}return t(n,r)}catch(e){return C.error(`Error parsing URL`,e),t(n,r)}},()=>{window.fetch=t}}function Sr(e){return e.endsWith(`.csv`)?`text/csv`:e.endsWith(`.json`)?`application/json`:e.endsWith(`.txt`)?`text/plain`:`application/octet-stream`}function Cr(e,t=T()){let n=e.http.bind(e),r=e.load.bind(e);return e.http=async e=>{let r=K(e,t);if(r)return await window.fetch(r).then(e=>e.text());try{return await n(e)}catch(t){if(e.startsWith(`data:`))return await window.fetch(e).then(e=>e.text());throw t}},e.load=async e=>{let n=K(e,t);if(n)return await window.fetch(n).then(e=>e.text());try{return await r(e)}catch(t){if(e.startsWith(`data:`))return await window.fetch(e).then(e=>e.text());throw t}},()=>{e.http=n,e.load=r}}function wr(e){return e.startsWith(`.`)?e.slice(1):e}function Tr(e,t=T()){let n=K(e,t);if(!n)return e;let r=Te(n);return URL.createObjectURL(r)}function K(e,t){let n=document.baseURI;n.startsWith(`blob:`)&&(n=n.replace(`blob:`,``));let r=new URL(e,n).pathname,i=Er(e),a=Er(r);return t[e]||t[wr(e)]||t[r]||t[wr(r)]||i&&t[i]||a&&t[a]}function Er(e){let t=e.indexOf(`/@file/`);return t===-1?null:e.slice(t)}function q(e,t){return{get(t){return e.get(t)},set(t,n){e.set(t,n)},save_changes(){e.save_changes()},send:e.send.bind(e),on(n,r){t.aborted||(e.on(n,r),t.addEventListener(`abort`,()=>e.off(n,r),{once:!0}))},off(t,n){e.off(t??null,n??null)},widget_manager:{async get_model(n){return q(await e.widget_manager.get_model(n),t)}}}}function J(e){return typeof e==`string`&&e.length>0}function Dr(e){if(typeof e==`string`&&e.startsWith(`anywidget:`)){let t=e.slice(10);if(J(t))return t}throw Error(`[anywidget] Invalid widget reference: ${JSON.stringify(e)}`)}function Or(e,t){return{async getModel(n){let r=Dr(n);return q(await e.getModel(r),t)},async getWidget(n){let r=Dr(n),i=await e.getWidget(r);return{exports:i.exports,async render({el:e,signal:n}){await i.render({el:e,signal:n??t})}}}}}var kr=Symbol(`marimo`);function Y(e){return e[kr]}var Ar=class e{#e=`change`;#t;#n;#r;#i={};static _modelManager;constructor(e,t,n){this.#n=e,this.#r=t,this.#t=new Set,n&&n.addEventListener(`abort`,()=>{C.debug(`[Model] Signal aborted, clearing all listeners`),this.#i={}})}[kr]={updateAndEmitDiffs:e=>this.#o(e),emitCustomMessage:(e,t)=>this.#s(e,t)};off(e,t){if(!e){this.#i={};return}if(!t){this.#i[e]=new Set;return}this.#i[e]?.delete(t)}send(e,t,n){let r=(n??[]).map(e=>e instanceof ArrayBuffer?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength));return this.#r.sendCustomMessage(e,r).then(()=>t?.())}widget_manager={async get_model(t){let n=await e._modelManager.getModel(t);if(!n)throw Error(`Model not found with id: ${t}. This is likely because the model was not registered.`);return n}};get(e){return this.#n[e]}set(e,t){this.#n={...this.#n,[e]:t},this.#t.add(e),this.#a(`change:${e}`,t),this.#c()}save_changes(){if(this.#t.size===0)return;let e=Object.fromEntries([...this.#t].map(e=>[e,this.#n[e]]));this.#t.clear(),this.#r.sendUpdate(e)}on(e,t,n){let r=n?.signal;r?.aborted||(this.#i[e]||(this.#i[e]=new Set),this.#i[e].add(t),r?.addEventListener(`abort`,()=>this.off(e,t),{once:!0}))}#a(e,t){let n=this.#i[e];if(n)for(let e of[...n])try{e(t)}catch(e){C.error(`Error emitting event`,e)}}#o(e){e!=null&&Object.keys(e).forEach(t=>{let n=t;this.#t.delete(n),this.#n[n]!==e[n]&&(this.#n={...this.#n,[n]:e[n]},this.#a(`change:${n}`,e[n]),this.#c())})}#s(e,t=[]){let n=this.#i[`msg:custom`];if(n)for(let r of[...n])try{r(e.content,t)}catch(e){C.error(`Error emitting event`,e)}}#c=ne(()=>{let e=this.#i[this.#e];if(e)for(let t of[...e])try{t()}catch(e){C.error(`Error emitting event`,e)}},0)};function jr(e){return typeof e==`function`}function Mr(e){return typeof e==`function`}function Nr(e){return t(e)&&(jr(e.render)||Mr(e.initialize))}function Pr(e){return typeof e==`function`||Nr(e)}function Fr(e){return t(e)&&Pr(e.default)}var Ir=new Set,Lr=new WeakMap;function Rr(e,n){if(Fr(e))return e.default;if(!t(e)||e.default!==void 0)return null;let r=jr(e.render)?e.render:void 0,i=Mr(e.initialize)?e.initialize:void 0;if(r===void 0&&i===void 0)return null;let a=Lr.get(e);if(a)return a;Ir.has(n)||(Ir.add(n),C.warn(`Anywidget module at ${n} uses deprecated top-level named exports (\`render\`/\`initialize\`). Per the AFM spec, use a default export instead: \`export default { render }\`. See https://anywidget.dev/en/afm/`));let o={render:r,initialize:i};return Lr.set(e,o),o}function zr(e,n){let r=`https://anywidget.dev/en/afm/`,a=t(e)&&i(e,`render`),o=t(e)&&i(e,`initialize`);if(t(e)&&e.default!==void 0)return Error(`Anywidget module at ${n} has an invalid default export. Expected a factory function or an object with \`render\` or \`initialize\`. See ${r}`);if(a||o){let e=[a?"`render`":null,o?"`initialize`":null].filter(Boolean).join(` and `),t=[a?`render`:null,o?`initialize`:null].filter(e=>e!==null),i=`export default { ${t.join(`, `)} }`,s=t.length===1?`export function ${t[0]}`:`named export function ...`;return Error(`Anywidget module at ${n} uses named exports (${e}). Per the AFM spec, use a default export instead: \`${i}\` (not \`${s}\`). See ${r}`)}return Error(`Anywidget module at ${n} is missing a default export. Per the AFM spec, use \`export default { render }\` or \`export default async () => ({ render })\`. See ${r}`)}function Br(e){return typeof e!=`string`||e.length===0?!1:!!(/^(\.?\/)?@file\/[^?#]+$/.test(e)||Hr(e))}function Vr(){return e.get(Ce)||Se()}function Hr(e){return e.startsWith(`data:text/javascript;base64,`)||e.startsWith(`data:application/javascript;base64,`)||e.startsWith(`data:text/css;base64,`)?Vr():!1}var Ur={invoke:async()=>{let e=`anywidget.invoke not supported in marimo. Please file an issue at https://github.com/marimo-team/marimo/issues`;throw C.warn(e),Error(e)}};function Wr(e){if(typeof AbortSignal.any==`function`)return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(n.reason),t.signal;n.addEventListener(`abort`,()=>t.abort(n.reason),{once:!0})}return t.signal}var Gr=class{#e=new Map;getModule(e){let{jsUrl:t,jsHash:n,kernelAuthored:r=!1,lifetime:i}=e,a=this.#e.get(n);if(!a){let e={references:0,dispose:()=>void 0,promise:this.#t(t,{kernelAuthored:r}).then(({module:t,dispose:n})=>(e.dispose=n,t),t=>{throw this.#e.get(n)===e&&this.#e.delete(n),t})};this.#e.set(n,e),a=e}let o=a;o.references+=1;let s=()=>{--o.references,o.references===0&&o.promise.then(()=>{o.dispose(),o.dispose=()=>void 0},()=>void 0)};return i?.aborted?s():i?.addEventListener(`abort`,s,{once:!0}),o.promise}invalidate(e){this.#e.delete(e)}async#t(e,t={}){if(!(Br(e)||t.kernelAuthored===!0&&/^(https?:|data:)/.test(e)))throw Error(`Refusing to load anywidget module from untrusted URL: ${String(e)}`);let n=fe(e).toString(),r=de()?Tr(n):n,i=()=>{r!==n&&URL.revokeObjectURL(r)};try{return{module:await ve(()=>import(r),[],import.meta.url),dispose:i}}catch(e){throw i(),e}}};function X(e){return typeof e==`function`}async function Kr(e,t){try{await e()}catch(e){C.warn(`[WidgetBinding] ${t} cleanup failed`,e)}}var qr=class e{#e;#t;#n;#r;#i;#a=new Set;#o=new Set;#s;constructor(e){this.#t=e.widget,this.#n=e.model,this.#r=e.exports,this.#e=e.controller,this.#i=e.createHost,this.#s=e.onDestroy}static async create({widgetDef:t,model:n,createHost:r,controller:i=new AbortController,onDestroy:a}){let o=i.signal,s;try{let c=typeof t==`function`?await t():t;if(o.aborted)throw Error(`[anywidget] binding destroyed`);let l=Promise.resolve(c.initialize?.({model:q(n,o),experimental:Ur,signal:o}));s=l.then(async e=>{o.aborted&&X(e)&&await Kr(e,`late initialize`)}).catch(()=>void 0);let u=await Promise.race([l,new Promise((e,t)=>{let n=()=>t(Error(`[anywidget] binding destroyed`));if(o.aborted){n();return}o.addEventListener(`abort`,n,{once:!0})})]);if(o.aborted)throw Error(`[anywidget] binding destroyed`);let d,f;X(u)?(f=u,d=void 0):d=typeof u==`object`&&u?u:void 0;let p=new e({widget:c,model:n,exports:d,controller:i,createHost:r,onDestroy:a});return f&&o.addEventListener(`abort`,()=>void p.#l(f,`initialize`),{once:!0}),p}catch(e){throw s?s.then(()=>a?.()):a?.(),e}}get exports(){return this.#r}async createView(e,t){let n=this.#c(e,t);this.#o.add(n);try{await n}finally{this.#o.delete(n)}}async#c(e,t){let n=this.#t;if(!n.render)return;let r=Wr([t.signal,this.#e.signal]);if(r.aborted)return;e.el.innerHTML=``;let i=this.#i(r),a=await n.render({model:q(this.#n,r),el:e.el,experimental:Ur,signal:r,host:i});if(X(a)){let e=()=>{let e=t.signal.aborted?`view unmount`:`binding destroyed`;return C.debug(`[WidgetBinding] Render cleanup triggered (reason: ${e})`),this.#l(a,`render`)};if(r.aborted){await e();return}r.addEventListener(`abort`,()=>void e(),{once:!0})}}#l(e,t){let n=Kr(e,t);return this.#a.add(n),n.finally(()=>this.#a.delete(n)),n}async destroy(){for(C.debug(`[WidgetBinding] Destroying binding generation`),this.#e.abort(),await Promise.allSettled(this.#o);this.#a.size>0;)await Promise.all(this.#a);this.#s?.(),this.#s=void 0}},Jr=new Gr,Yr=class{#e;#t;#n;#r;#i;#a=new AbortController;#o=new be;#s=new Set;#c=new Map;#l;#u;#d;#f=Promise.resolve();#p=``;constructor(e,t){this.#e=e,this.#t=t.timeout,this.#n=t.isEditMode,this.#r=t.createHost,this.#i=t.onModelTimeout}getModel(){return this.#o.status===`pending`&&!this.#l&&(this.#l=setTimeout(()=>{this.#o.status===`pending`&&(this.#l=void 0,this.#o.reject(Error(`Model not found for key: ${this.#e}`)),this.#i())},this.#t)),this.#o.promise}getModelSync(){return this.#o.status===`resolved`?this.#o.value:void 0}createModel(e){this.#o.status===`pending`&&this.#m(e(this.#a.signal))}setModel(e){this.#o.status===`pending`&&this.#m(e)}#m(e){this.#l&&=(clearTimeout(this.#l),void 0),this.#o.resolve(e);let t=e.get(`_css`);this.#p=typeof t==`string`?t:``,e.on(`change:_css`,e=>{this.#p=typeof e==`string`?e:``;for(let e of this.#c.values())e.update(this.#p)},{signal:this.#a.signal})}setSpec(e){if(!this.#u){this.#u=e;return}this.#n()&&(this.#u=e,this.#d&&this.#d.hash!==e.hash&&this.#v(e))}async getWidget(){return{exports:(await this.#h()).exports,render:async({el:e,signal:t})=>{await this.createView({el:e,signal:t??this.#a.signal})}}}async createView(e){if(e.signal.aborted||this.#a.signal.aborted)return;let t={el:e.el,signal:e.signal};this.#s.add(t),this.#x(t),e.signal.addEventListener(`abort`,()=>this.#s.delete(t),{once:!0}),await this.#b(t)}async#h(){for(;!this.#a.signal.aborted;){let e=await this.getModel(),t=this.#d;if(!t){let n=this.#u;if(!n)throw Error(`[anywidget] No ESM spec for model ${this.#e}: nothing ever provided this widget's code`);t=this.#_(n,e)}try{let e=await t.promise;if(t===this.#d)return e}catch(e){if(!this.#d||t===this.#d)throw e}}throw Error(`[anywidget] widget runtime destroyed`)}async#g(e){let{spec:t,model:n,controller:r}=e,i=new AbortController,a;try{let e=await Jr.getModule({jsUrl:t.url,jsHash:t.hash,kernelAuthored:!0,lifetime:i.signal}),n=Rr(e,t.url);if(!n)throw Jr.invalidate(t.hash),zr(e,t.url);a=n}catch(e){throw i.abort(),e}return qr.create({widgetDef:a,model:n,createHost:this.#r,controller:r,onDestroy:()=>i.abort()})}#_(e,t){let n=new AbortController,r={hash:e.hash,controller:n,promise:this.#g({spec:e,model:t,controller:n})};return r.promise.catch(()=>{this.#d===r&&(this.#d=void 0)}),this.#d=r,r}#v(e){let t=this.#d;if(!t)return;C.debug(`[WidgetRuntime] Hot-swapping generation for model=${this.#e}`);let n=this.#y(t),r=this.getModelSync();if(!r)return;let i=this.#_(e,r);for(let e of this.#s)e.generation=void 0,n.then(()=>this.#b(e,i)).catch(e=>{C.error(`[WidgetRuntime] Error replacing widget view`,e)})}#y(e){e.controller.abort();let t=this.#f.then(async()=>{try{await(await e.promise).destroy()}catch{}});return this.#f=t,t}async#b(e,t){if(e.signal.aborted||this.#a.signal.aborted)return;let n=t??this.#d,r=n?await n.promise:await this.#h(),i=this.#d;if(!(!i||i!==(n??i))&&e.generation!==i){e.generation=i;try{await r.createView({el:e.el},{signal:e.signal})}catch(t){if(i!==this.#d){e.generation=void 0;return}throw t}}}#x(e){let t=e.el.getRootNode();if(!Z(t)&&!Xr(t))return;let n=this.#c.get(t);n||(n=Zr(t,this.#p),this.#c.set(t,n)),n.references+=1;let r=!1;e.signal.addEventListener(`abort`,()=>{if(r)return;r=!0;let e=this.#c.get(t);e&&(--e.references,e.references===0&&(e.dispose(),this.#c.delete(t)))},{once:!0})}dispose(){if(!this.#a.signal.aborted){C.debug(`[WidgetRuntime] Disposing model=${this.#e}`),this.#l&&=(clearTimeout(this.#l),void 0),this.#o.status===`pending`&&(this.#o.promise.catch(()=>void 0),this.#o.reject(Error(`[anywidget] widget runtime destroyed`))),this.#d&&this.#y(this.#d),this.#a.abort(),this.#s.clear();for(let e of this.#c.values())e.dispose();this.#c.clear()}}};function Z(e){return e.nodeType===Node.DOCUMENT_NODE}function Xr(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function Zr(e,t){let n=Z(e)?e:e.ownerDocument??document,r=n.defaultView??window;if(`adoptedStyleSheets`in e&&r.CSSStyleSheet!==void 0&&typeof r.CSSStyleSheet.prototype.replaceSync==`function`)try{let n=new r.CSSStyleSheet;return n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],{references:0,update(e){n.replaceSync(e)},dispose(){e.adoptedStyleSheets=e.adoptedStyleSheets.filter(e=>e!==n)}}}catch{}let i=n.createElement(`style`);return i.textContent=t,Z(e)?n.head.append(i):e.append(i),{references:0,update(e){i.textContent=e},dispose(){i.remove()}}}function Q(e,t=[]){let n=[];if(e instanceof DataView)n.push(t);else if(Array.isArray(e))for(let[r,i]of e.entries())n.push(...Q(i,[...t,r]));else if(typeof e==`object`&&e)for(let[r,i]of Object.entries(e))n.push(...Q(i,[...t,r]));return n}function Qr(e){let t=Q(e);if(t.length===0)return{state:e,buffers:[],bufferPaths:[]};let n=structuredClone(e),r=[],i=[];for(let a of t){let t=te(e,a);if(t instanceof DataView){let e=me(t);r.push(e),i.push(a),k(n,a,e)}}return{state:n,buffers:r,bufferPaths:i}}function $r(e){let{state:t,bufferPaths:n,buffers:r}=e;if(!n||n.length===0)return t;r&&ae(r.length===n.length,`Buffers and buffer paths not the same length`);let i=t;for(let[e,t]of n.entries()){let n=r?.[e];if(n==null){C.warn(`[anywidget] Could not find buffer at path`,t);continue}typeof n==`string`?k(i,t,he(n)):k(i,t,n)}return i}function ei(){let t=e.get(ce).mode;return t===`edit`||t===`present`}var $=new class{#e=new Map;#t;#n;constructor(e=1e4,t=ei){this.#t=e,this.#n=t}#r(e){let t=this.#e.get(e);if(!t){let n=new Yr(e,{timeout:this.#t,isEditMode:this.#n,createHost:e=>Or(this,e),onModelTimeout:()=>{this.#e.get(e)===n&&(n.dispose(),this.#e.delete(e))}});t=n,this.#e.set(e,t)}return t}getModel(e){return this.#r(e).getModel()}getModelSync(e){return this.#e.get(e)?.getModelSync()}createModel(e,t){this.#r(e).createModel(t)}setModel(e,t){this.#r(e).setModel(t)}setSpec(e,t){this.#r(e).setSpec(t)}getWidget(e){return this.#r(e).getWidget()}createView(e){return this.#r(e.modelId).createView(e)}delete(e){let t=this.#e.get(e);t&&(t.dispose(),this.#e.delete(e))}};Ar._modelManager=$;async function ti(e,t){let n=t.model_id;if(!J(n))throw Error(`[anywidget] Invalid model id: ${String(n)}`);let r=t.message,i=(`buffers`in r?r.buffers:[]).map(he);switch(r.method){case`open`:{let{state:t,buffer_paths:a=[]}=r;r.esm_spec&&e.setSpec(n,r.esm_spec);let o=$r({state:t,bufferPaths:a,buffers:i}),s=e.getModelSync(n);if(s){Y(s).updateAndEmitDiffs(o);return}e.createModel(n,e=>{let t=de()?{sendUpdate:async()=>void 0,sendCustomMessage:async()=>void 0}:{async sendUpdate(t){if(e.aborted){C.debug(`[Model] sendUpdate suppressed for model=${n} (signal aborted)`);return}let{state:r,buffers:i,bufferPaths:a}=Qr(t);await D().sendModelValue({modelId:n,message:{method:`update`,state:r,bufferPaths:a},buffers:i})},async sendCustomMessage(t,r){if(e.aborted){C.debug(`[Model] sendCustomMessage suppressed for model=${n} (signal aborted)`);return}await D().sendModelValue({modelId:n,message:{method:`custom`,content:t},buffers:r.map(me)})}};return new Ar(o,t,e)});return}case`custom`:Y(await e.getModel(n)).emitCustomMessage({method:`custom`,content:r.content},i);return;case`close`:e.delete(n);return;case`update`:{let{state:t,buffer_paths:a=[]}=r;r.esm_spec&&e.setSpec(n,r.esm_spec);let o=$r({state:t,bufferPaths:a,buffers:i});Y(await e.getModel(n)).updateAndEmitDiffs(o);return}default:ye(r)}}o($,`WIDGET_REGISTRY`);function ni(e){return typeof e!=`object`||!e?!1:`type`in e&&e.type===`marimo-ui-value-update`}var ri=class e{entries;static get INSTANCE(){let t=`_marimo_private_UIElementRegistry`;return window[t]||(window[t]=new e),window[t]}constructor(){this.entries=new Map}has(e){return this.entries.has(e)}set(e,t){this.entries.has(e)&&C.debug(`UIElementRegistry overwriting entry for objectId.`,e),this.entries.set(e,{objectId:e,value:t,elements:new Set})}registerInstance(e,t){let n=this.entries.get(e);n===void 0?this.entries.set(e,{objectId:e,value:a(t,this),elements:new Set([t])}):n.elements.add(t)}removeInstance(e,t){let n=this.entries.get(e);n?.elements.has(t)&&n.elements.delete(t)}removeElementsByCell(e){[...this.entries.keys()].filter(t=>t.startsWith(`${e}-`)).forEach(e=>{this.entries.delete(e)})}lookupValue(e){let t=this.entries.get(e);return t===void 0?void 0:t.value}broadcastMessage(e,t,n){let r=this.entries.get(e);if(r===void 0){C.warn(`UIElementRegistry missing entry`,e);return}if(ni(t)){r.value=t.value,r.elements.forEach(e=>{e.dispatchEvent(ke.create({bubbles:!1,composed:!0,detail:{value:t.value,element:e}}))});return}r.elements.forEach(r=>{r.dispatchEvent(je.create({bubbles:!1,composed:!0,detail:{objectId:e,message:t,buffers:n}}))})}broadcastValueUpdate(e,t,n){let r=this.entries.get(t);r===void 0?C.warn(`UIElementRegistry missing entry`,t):(r.value=n,r.elements.forEach(t=>{t!==e&&t.dispatchEvent(ke.create({bubbles:!1,composed:!0,detail:{value:n,element:t}}))}),document.dispatchEvent(Ae.create({bubbles:!0,composed:!0,detail:{objectId:t}})))}},ii=ri.INSTANCE,ai=new ge(`function-call-result`,async(e,t)=>{await D().sendFunctionRequest({functionCallId:e,...t})}),oi=`68px`,si=`288px`,ci=e=>e?/^\d+$/.test(e)?`${e}px`:e:si,li=le({isOpen:!0},(e,t)=>{if(!t)return e;switch(t.type){case`toggle`:return{...e,isOpen:t.isOpen??e.isOpen};case`setWidth`:return{...e,width:t.width};default:return e}});export{Vn as _,ri as a,k as b,ti as c,xr as d,Cr as f,Un as g,qn as h,ai as i,Br as l,W as m,ci as n,ii as o,yr as p,li as r,$ as s,oi as t,J as u,Mn as v,V as y};
|
|
105
|
+
`),o=a;try{o=e(a)}catch{}t.enqueue({event:n||`message`,data:o,...i===void 0?{}:{id:i}})}n=``,r=[],i=void 0};super({transform(e,o){t+=e;let s=t.endsWith(`\r`)?`\r`:``,c=t.slice(0,t.length-s.length).split(/\r\n|\r|\n/);t=(c.pop()??``)+s;for(let e of c){if(e===``){a(o);continue}if(e.startsWith(`:`))continue;let t=e.indexOf(`:`),s=t===-1?e:e.slice(0,t),c=t===-1?``:e.slice(t+1);c.startsWith(` `)&&(c=c.slice(1)),s===`event`?n=c:s===`data`?r.push(c):s===`id`&&!c.includes(`\0`)&&(i=c)}}})}},jn=new Set([408,429]);function Mn(e,t={}){return async({cursor:n,signal:r},{open:i,message:a})=>{let o=new Headers;o.set(`Accept`,`text/event-stream`),t.token!==void 0&&o.set(`Authorization`,`Bearer ${t.token}`),n!==null&&o.set(`Last-Event-ID`,n);let s=new AbortController,c=()=>s.abort();r.addEventListener(`abort`,c,{once:!0});let l,u,d=()=>{clearTimeout(l),l=setTimeout(c,kn)};try{let n=new URL(typeof e==`function`?await e():e),r=t.fetch??globalThis.fetch;d();let c=await r(n,{headers:o,signal:s.signal}),{status:l}=c;if(l>=400&&l<500&&!jn.has(l)){let e=tn.safeParse(await c.json().catch(()=>void 0));throw new V(`The host refused the stream (${l})`,{cause:e.success?e.data:void 0})}if(!c.ok||c.body===null){await c.body?.cancel();return}if(!Sn(c.headers.get(`Content-Type`),`text/event-stream`))throw await c.body.cancel(),new V(`The host did not answer with an event stream`);i();let f=new TransformStream({transform(e,t){d(),t.enqueue(e)}}),p=c.body.pipeThrough(f).pipeThrough(new TextDecoderStream).pipeThrough(new An(t.parseData)).getReader();for(s.signal.addEventListener(`abort`,()=>void p.cancel(),{once:!0});;){let{done:e,value:n}=await p.read();if(e)return;if(u=t.stop?.(n),u!==void 0)throw u;a(n)}}catch(e){if(e instanceof V||e===u)throw e}finally{clearTimeout(l),r.removeEventListener(`abort`,c)}}}var Nn=new Set(Zt.options.flatMap(e=>e.shape.event.options)),Pn=g({event:p().min(1),data:S(),id:p().optional()});function H(e){queueMicrotask(()=>{throw e})}var Fn=class{#e;#t=!1;#n;#r=new Set;constructor(e,t){this.#e=e.cursor??null,this.#n=new Set([`ready`,`reset`,...(e.types??t).flatMap(e=>{let t=`${e}.removed`;return Nn.has(t)?[e,t]:[e]})])}get cursor(){return this.#e}subscribe(e){return this.#r.add(e),()=>this.#r.delete(e)}resume(){return this.#e===null&&this.#t&&this.#i({event:`reset`,data:{}}),this.#e}receive(e){let t=Pn.safeParse(e);if(!t.success)throw new V(`The host sent a message that is not an event`,{cause:t.error});this.#i(t.data)}#i(e){let t;if(Nn.has(e.event)){let n=Zt.safeParse(e);if(!n.success)throw new V(`The host sent an invalid ${e.event} event`,{cause:n.error});t=n.data}else t=e;if(e.id!==void 0&&(this.#e=e.id),t.event===`reset`?(this.#e=null,this.#t=!1):this.#e===null&&(this.#t=!0),this.#n.has(t.event))for(let e of this.#r)try{e(t)}catch(e){H(e)}}},In=10,Ln=5e3;function Rn(e){return Math.min(1e3*1.5**(e-1),15e3)*(.75+Math.random()/2)}function zn(e,t){return new Promise(n=>{let r=setTimeout(i,e);t.addEventListener(`abort`,i,{once:!0});function i(){clearTimeout(r),t.removeEventListener(`abort`,i),n()}})}var Bn=class{closed;#e;#t=`connecting`;#n=new AbortController;#r;#i;#a;#o=new Set;constructor(e,t,n){let r;if(typeof e==`function`)r=e;else{let n=new URL(e);t.types!==void 0&&n.searchParams.set(`types`,t.types.join(`,`)),r=Mn(n,t)}if(this.#e=new Fn({types:t.types,cursor:t.cursor},n),this.#r=t.onStatus,this.closed=new Promise((e,t)=>{this.#i={resolve:e,reject:t}}),this.closed.catch(()=>void 0),t.signal?.aborted){this.close();return}let i=t.signal;if(i!==void 0){let e=()=>this.close();i.addEventListener(`abort`,e,{once:!0}),this.#a=()=>i.removeEventListener(`abort`,e)}this.#s(r)}get status(){return this.#t}get cursor(){return this.#e.cursor}subscribe(e,t){let n=!0,r=this.#e.subscribe(t=>{n&&e(t)}),i=e=>{n&&t?.(e)};return t!==void 0&&this.#i!==void 0&&this.#o.add(i),()=>{n=!1,this.#o.delete(i),r()}}close(){this.#l()?.resolve()}[Symbol.asyncIterator](){let e=[],t=[],n=()=>t.splice(0).forEach(e=>e()),r,i=this.subscribe(t=>{e.push(t),n()});this.closed.then(()=>{r={},n()},e=>{r={error:e},n()});let a=()=>(i(),this.close(),{done:!0,value:void 0});return{next:async()=>{for(;;){let n=e.shift();if(n!==void 0)return{done:!1,value:n};if(r!==void 0){if(r.error!==void 0)throw i(),r.error;return a()}await new Promise(e=>t.push(e))}},return:async()=>a()}}async#s(e){await Promise.resolve();let{signal:t}=this.#n,n=0;for(;!t.aborted;){let r=!0,i=!1,a;try{await e({cursor:this.#e.resume(),signal:t},{open:()=>{r&&this.#i!==void 0&&this.#c(`connected`)},message:e=>{if(!(!r||this.#i===void 0)){a??=setTimeout(()=>{i=!0},Ln);try{this.#e.receive(e)}catch(e){this.#l()?.reject(e)}}}})}catch(e){this.#l()?.reject(e);return}finally{r=!1,clearTimeout(a)}if(t.aborted)return;if(this.#c(`connecting`),n=i?1:n+1,n>In){this.#l()?.reject(new V(`The host could not be reached`));return}await zn(Rn(n),t)}}#c(e){if(this.#t!==e){this.#t=e;try{this.#r?.(e)}catch(e){H(e)}}}#l(){let e=this.#i;if(e===void 0)return;this.#i=void 0;let t=[...this.#o];return this.#o.clear(),this.#a?.(),this.#n.abort(),this.#c(`closed`),{resolve:e.resolve,reject:n=>{e.reject(n);for(let e of t)try{e(n)}catch(e){H(e)}}}}},Vn=class extends Bn{constructor(e,t={}){typeof e!=`function`&&t.runId!==void 0&&(e=new URL(e),e.searchParams.set(`run_id`,t.runId)),super(e,t,yn)}},Hn=class{#e;constructor(e){this.#e=e}update(e,t){return this.#t(`notebook.update`,{body:e,options:t})}delete(e){return this.#t(`notebook.delete`,{options:e})}open(e){return this.#t(`notebook.open`,{options:e})}edit(e,t){return this.#t(`notebook.edit`,{body:{changes:[...e]},options:t})}save(e){return this.#t(`notebook.save`,{body:{decisions:e?.decisions},headers:{"If-Match":e?.ifMatch},options:e})}start(e){return this.#t(`runtime.start`,{body:{decisions:e?.decisions},options:e})}stop(e){return this.#t(`runtime.stop`,{options:e})}restart(e){return this.#t(`runtime.restart`,{options:e})}run(e,t){return this.#t(`runtime.run`,{body:e,options:t})}interrupt(e,t){return this.#t(`runtime.interrupt`,{params:{run_id:e},options:t})}#t(e,t){return En(this.#e,e,t)}},Un=class extends Hn{#e;#t;constructor(e,t={}){let n=new URL(e);super({url:n,prefix:`/notebooks/{notebook_id}`,client:t}),this.#e=n,this.#t=t}static unstable_over(e,{notebookId:t}){return new Hn({send:t=>e(t),prefix:`/notebooks/{notebook_id}`,params:{notebook_id:t}})}get url(){return new URL(this.#e)}events(e={}){return new Vn(Cn(this.#e,`/events`),{...this.#t,...e})}};function Wn(e,t){return t?(t.throwIfAborted(),new Promise((n,r)=>{let i=()=>r(t.reason);t.addEventListener(`abort`,i,{once:!0}),e().then(n,r).finally(()=>t.removeEventListener(`abort`,i))})):e()}function Gn(e){let t=Un.unstable_over(t=>e.call(t),{notebookId:e.notebookId});return{transport:async({cursor:t,signal:n},{open:r,message:i})=>{if(n.aborted)return;let a,o,s=new Promise(e=>{o=e}),c=()=>{a?.(),o()};n.addEventListener(`abort`,c,{once:!0});try{r(),await Wn(()=>e.subscribe(t,e=>{n.aborted||i(e)}).then(e=>{a=e,n.aborted&&e()}),n),await s}catch(e){if(!n.aborted)throw a?.(),new V(`Could not follow the WASM notebook`,{cause:e})}finally{n.removeEventListener(`abort`,c)}},notebook:n=>{if(n!==e.notebookId)throw Error(`The worker serves notebook ${e.notebookId}, not ${n}`);return t}}}function Kn(e,t){if(e.origin===globalThis.origin)return new Worker(e.href,{...t,type:`module`});let n=`import ${JSON.stringify(e.href)}`,r=globalThis.origin===`null`?`data:application/javascript,${encodeURIComponent(n)}`:URL.createObjectURL(new Blob([n],{type:`application/javascript`}));try{return new Worker(r,{...t,type:`module`})}finally{r.startsWith(`blob:`)&&URL.revokeObjectURL(r)}}function qn(e){return e.assetUrl,e}var Jn=1e10,Yn=1e3;function U(e,t){let n=e.map(e=>`"${e}"`).join(`, `);return Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function Xn(e={}){let t={};function n(e){t=e}let r={};function i(e){r.unregisterHandler&&r.unregisterHandler(),r=e,r.registerHandler?.(x)}let a;function o(e){if(typeof e==`function`){a=e;return}a=(t,n)=>{let r=e[t];if(r)return r(n);let i=e._;if(!i)throw Error(`The requested method has no handler: ${t}`);return i(t,n)}}let{maxRequestTime:s=Yn}=e;e.transport&&i(e.transport),e.requestHandler&&o(e.requestHandler),e._debugHooks&&n(e._debugHooks);let c=0;function l(){return c<=Jn?++c:c=0}let u=new Map,d=new Map;function f(e,...n){let i=n[0];return new Promise((n,a)=>{if(!r.send)throw U([`send`],`make requests`);let o=l(),c={type:`request`,id:o,method:e,params:i};u.set(o,{resolve:n,reject:a}),s!==1/0&&d.set(o,setTimeout(()=>{d.delete(o),a(Error(`RPC request timed out.`))},s)),t.onSend?.(c),r.send(c)})}let p=new Proxy(f,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>f(t,e)}),m=p;function h(e,...n){let i=n[0];if(!r.send)throw U([`send`],`send messages`);let a={type:`message`,id:e,payload:i};t.onSend?.(a),r.send(a)}let g=new Proxy(h,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>h(t,e)}),_=g,v=new Map,y=new Set;function b(e,t){if(!r.registerHandler)throw U([`registerHandler`],`register message listeners`);if(e===`*`){y.add(t);return}v.has(e)||v.set(e,new Set),v.get(e)?.add(t)}function ee(e,t){if(e===`*`){y.delete(t);return}v.get(e)?.delete(t),v.get(e)?.size===0&&v.delete(e)}async function x(e){if(t.onReceive?.(e),!(`type`in e))throw Error(`Message does not contain a type.`);if(e.type===`request`){if(!r.send||!a)throw U([`send`,`requestHandler`],`handle requests`);let{id:n,method:i,params:o}=e,s;try{s={type:`response`,id:n,success:!0,payload:await a(i,o)}}catch(e){if(!(e instanceof Error))throw e;s={type:`response`,id:n,success:!1,error:e.message}}t.onSend?.(s),r.send(s);return}if(e.type===`response`){let t=d.get(e.id);t!=null&&clearTimeout(t);let{resolve:n,reject:r}=u.get(e.id)??{};e.success?n?.(e.payload):r?.(Error(e.error));return}if(e.type===`message`){for(let t of y)t(e.id,e.payload);let t=v.get(e.id);if(!t)return;for(let n of t)n(e.payload);return}throw Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:i,setRequestHandler:o,request:p,requestProxy:m,send:g,sendProxy:_,addMessageListener:b,removeMessageListener:ee,proxy:{send:_,request:m},_setDebugHooks:n}}function Zn(e){return Xn(e)}var Qn=`[transport-id]`;function $n(e,t){let{transportId:n}=t;return n==null?e:{[Qn]:n,data:e}}function er(e,t){let{transportId:n,filter:r}=t,i=r?.();if(n!=null&&i!=null)throw Error("Cannot use both `transportId` and `filter` at the same time");let a=e;if(n){if(e[Qn]!==n)return[!0];a=e.data}return i===!1?[!0]:[!1,a]}function tr(e,t={}){let{transportId:n,filter:r,remotePort:i}=t,a=e,o=i??e,s;return{send(e){o.postMessage($n(e,{transportId:n}))},registerHandler(e){s=t=>{let i=t.data,[a,o]=er(i,{transportId:n,filter:()=>r?.(t)});a||e(o)},a.addEventListener(`message`,s)},unregisterHandler(){s&&a.removeEventListener(`message`,s)}}}function nr(e,t){return tr(e,t)}var rr=`::controller`,ir=`marimo-transport`;function ar(e){return Zn({transport:nr(e,{transportId:ir}),maxRequestTime:2e4,_debugHooks:{onSend:e=>{C.debug(`[rpc] Parent -> Worker`,e)},onReceive:e=>{C.debug(`[rpc] Worker -> Parent`,e)}}})}function or(){let e=document.querySelector(`marimo-wasm`),t=e=>{try{return e?new URL(e,document.baseURI).href:void 0}catch{return}};return{version:pe(),pyodideIndexUrl:t(e?.dataset.pyodideIndexUrl),pyodideLockfileUrl:t(e?.dataset.pyodideLockfileUrl),pypiIndexUrl:t(e?.dataset.pypiIndexUrl)?.replaceAll(`%7Bpackage_name%7D`,`{package_name}`)}}var sr=De(),cr=`marimo:file`,lr=new r(null),ur={saveFile(e){lr.set(cr,e)},readFile(){return lr.get(cr)}},dr={saveFile(e){l.setCodeForHash((0,sr.compressToEncodedURIComponent)(e))},readFile(){let e=l.getCodeFromHash()||l.getCodeFromSearchParam();return e?(0,sr.decompressFromEncodedURIComponent)(e):null}},fr={saveFile(e){},readFile(){let e=document.querySelector(`marimo-code`);return e?decodeURIComponent(e.textContent||``).trim():null}},pr={saveFile(e){},readFile(){if(window.location.hostname!==`marimo.app`)return null;let e=new URL(`export_demos/wasm-intro.py`,document.baseURI);return fetch(e.toString()).then(e=>e.ok?e.text():null).catch(()=>null)}},mr={saveFile(e){},readFile(){return e.get(a)??null}},hr={saveFile(e){},readFile(){return[`import marimo`,`app = marimo.App()`,``,`@app.cell`,`def __():`,` return`,``,`if __name__ == "__main__":`,` app.run()`].join(`
|
|
106
|
+
`)}},gr=class{stores;constructor(e){this.stores=e}insert(e,t){this.stores.splice(e,0,t)}saveFile(e){this.stores.forEach(t=>t.saveFile(e))}readFile(){for(let e of this.stores){let t=e.readFile();if(t)return t}return null}},W=new gr([mr,fr,dr]),G=new gr([ur,pr,hr]),_r=new URL(`save-worker-UwdGcNK5.js`,import.meta.url).href,vr=new URL(`worker-jm2VC7pS.js`,import.meta.url).href,yr=class t{static get INSTANCE(){let e=`_marimo_private_PyodideBridge`;return window[e]||(window[e]=new t),window[e]}rpc;saveRpc;pendingSessionSave=Promise.resolve();notebookConsumers=new Map;interruptBuffer;messageConsumer;initialized=new be;getSaveWorker(){if(se()===`read`)return C.debug(`Using partially disabled SaveWorker in read-mode`),{readFile:w,readNotebook:async()=>await W.readFile()??``,saveNotebook:w};let e=or(),t=ar(Kn(new URL(_r,import.meta.url),{name:br()}));return t.send.bootstrap(e),t.proxy.request}constructor(){if(!ue())return;let t=or(),n=Kn(new URL(vr,import.meta.url),{name:br()});this.rpc=ar(n),this.rpc.send.bootstrap(t),this.rpc.addMessageListener(`notebookEvent`,({id:e,event:t})=>{this.notebookConsumers.get(e)?.(JSON.parse(t))}),this.rpc.addMessageListener(`ready`,()=>{this.startSession()}),this.rpc.addMessageListener(`initialized`,()=>{this.saveRpc=this.getSaveWorker(),this.setInterruptBuffer(),e.set(E,{kind:`ready`}),this.initialized.resolve()}),this.rpc.addMessageListener(`initializingMessage`,({message:t})=>{e.get(E).kind===`loading`&&e.set(E,{kind:`loading`,message:t})}),this.rpc.addMessageListener(`initializedError`,({error:t})=>{if(this.initialized.status===`resolved`){C.error(t),_e({title:`Error initializing`,description:t,variant:`danger`});return}e.set(E,{kind:`error`,message:t}),this.initialized.reject(Error(t))}),this.rpc.addMessageListener(`kernelMessage`,({message:e})=>{this.messageConsumer?.(new MessageEvent(`message`,{data:e}))})}async startSession(){let t=await W.readFile(),r=await G.readFile(),i=e.get(n)??l.getFilename(),a=e.get(re),o={},s=new URLSearchParams(window.location.search);for(let e of s.keys()){let t=s.getAll(e);o[e]=t.length===1?t[0]:t}await this.rpc.proxy.request.startSession({queryParameters:o,code:t||r||``,filename:i,userConfig:{...a,runtime:{...a.runtime,auto_instantiate:se()===`read`||a.runtime.auto_instantiate}}})}setInterruptBuffer(){crossOriginIsolated?(this.interruptBuffer=new Uint8Array(new SharedArrayBuffer(1)),this.rpc.proxy.request.setInterruptBuffer(this.interruptBuffer)):C.warn(`Not running in a secure context; interrupts are not available.`)}attachMessageConsumer(e){this.messageConsumer=e,this.rpc.proxy.send.consumerReady({})}async createNotebookBackend(){await this.initialized.promise;let{id:e}=await this.rpc.proxy.request.notebookInfo();return Gn({notebookId:e,subscribe:async(e,t)=>{await this.initialized.promise;let n=xe();this.notebookConsumers.set(n,t);let r=()=>{this.notebookConsumers.delete(n),this.rpc.proxy.request.notebookUnsubscribe(n).catch(C.error)};try{return await this.rpc.proxy.request.notebookSubscribe({id:n,cursor:e}),r}catch(e){throw r(),e}},call:async e=>(await this.initialized.promise,this.rpc.proxy.request.notebookCall(e))})}sendRename=async({filename:e})=>e===null?null:(l.setFilename(e),await this.rpc.proxy.request.bridge({functionName:`rename_file`,payload:e}),null);sendSave=async e=>{if(!this.saveRpc)return C.warn(`Save RPC not initialized`),null;let t=this.saveRpc.saveNotebook(e);this.pendingSessionSave=this.pendingSessionSave.catch(()=>void 0).then(async()=>{await t,await this.rpc.proxy.request.saveNotebook(e)}),this.pendingSessionSave.catch(e=>{C.error(e)}),await t;let n=await this.readCode();return n.contents&&(W.saveFile(n.contents),G.saveFile(n.contents)),null};sendCopy=async()=>{w()};sendStdin=async e=>(await this.rpc.proxy.request.bridge({functionName:`put_input`,payload:e.text}),null);sendPdb=async()=>{w()};sendSetBreakpoints=async()=>{w()};sendRun=async e=>(await this.rpc.proxy.request.loadPackages(e.codes.join(`
|
|
107
|
+
`)),await this.putControlRequest({type:`execute-cells`,...e}),null);sendRunScratchpad=async e=>(await this.rpc.proxy.request.loadPackages(e.code),await this.putControlRequest({type:`execute-scratchpad`,...e}),null);sendInterrupt=async()=>(this.interruptBuffer!==void 0&&(this.interruptBuffer[0]=2),null);sendShutdown=async()=>(window.close(),null);sendFormat=async e=>await this.rpc.proxy.request.bridge({functionName:`format`,payload:e});sendDeleteCell=async e=>(await this.putControlRequest({type:`delete-cell`,...e}),null);sendInstallMissingPackages=async e=>(this.putControlRequest({type:`install-packages`,...e}),null);sendCodeCompletionRequest=async t=>(e.get(c)||await this.rpc.proxy.request.bridge({functionName:`code_complete`,payload:t}),null);saveUserConfig=async e=>(await this.rpc.proxy.request.bridge({functionName:`save_user_config`,payload:e}),oe.post(`/kernel/save_user_config`,e,{baseUrl:`/`}).catch(e=>(C.error(e),null)));saveAppConfig=async e=>(await this.rpc.proxy.request.bridge({functionName:`save_app_config`,payload:e}),null);saveCellConfig=async e=>(await this.putControlRequest({type:`update-cell-config`,...e}),null);sendRestart=async()=>{let e=await this.readCode();return e.contents&&(W.saveFile(e.contents),G.saveFile(e.contents)),Ee(),null};readCode=async()=>this.saveRpc?{contents:await this.saveRpc.readNotebook()}:(C.warn(`Save RPC not initialized`),{contents:``});readSnippets=async()=>await this.rpc.proxy.request.bridge({functionName:`read_snippets`,payload:void 0});openFile=async()=>{let e=Oe({code:null,baseUrl:window.location.origin});return window.open(e,`_blank`),null};sendListFiles=async e=>await this.rpc.proxy.request.bridge({functionName:`list_files`,payload:e});getFileRoots=async()=>await this.rpc.proxy.request.bridge({functionName:`file_roots`,payload:void 0});sendSearchFiles=async e=>await this.rpc.proxy.request.bridge({functionName:`search_files`,payload:e});sendComponentValues=async e=>(await this.putControlRequest({type:`update-ui-element`,...e,token:xe()}),null);sendInstantiate=async()=>null;sendFunctionRequest=async e=>(await this.putControlRequest({type:`invoke-function`,...e}),null);sendCreateFileOrFolder=async e=>{let t=null;return e.file&&(t=(await we(e.file)).split(`,`)[1]??``),await this.rpc.proxy.request.bridge({functionName:`create_file_or_directory`,payload:{path:e.path,type:e.type,name:e.name,contents:t}})};sendDeleteFileOrFolder=async e=>await this.rpc.proxy.request.bridge({functionName:`delete_file_or_directory`,payload:e});sendCopyFileOrFolder=async e=>await this.rpc.proxy.request.bridge({functionName:`copy_file_or_directory`,payload:e});sendRenameFileOrFolder=async e=>await this.rpc.proxy.request.bridge({functionName:`move_file_or_directory`,payload:e});sendUpdateFile=async e=>await this.rpc.proxy.request.bridge({functionName:`update_file`,payload:e});sendFileDetails=async e=>await this.rpc.proxy.request.bridge({functionName:`file_details`,payload:e});exportAsHTML=async e=>(await this.pendingSessionSave,await this.rpc.proxy.request.bridge({functionName:`export_html`,payload:qn(e)}));exportAsMarkdown=async e=>(await this.pendingSessionSave,await this.rpc.proxy.request.bridge({functionName:`export_markdown`,payload:e}));exportAsScript=async e=>(await this.pendingSessionSave,await this.rpc.proxy.request.bridge({functionName:`export_script`,payload:e}));previewDatasetColumn=async e=>(await this.putControlRequest({type:`preview-dataset-column`,...e}),null);previewSQLTable=async e=>(await this.putControlRequest({type:`preview-sql-table`,...e}),null);previewSQLTableList=async e=>(await this.putControlRequest({type:`list-sql-tables`,...e}),null);previewSQLSchemaList=async e=>(await this.putControlRequest({type:`list-sql-schemas`,...e}),null);previewDataSourceConnection=async e=>(await this.putControlRequest({type:`list-data-source-connection`,...e}),null);validateSQL=async e=>(await this.putControlRequest({type:`validate-sql`,...e}),null);sendModelValue=async e=>(await this.putControlRequest({type:`model`,...e}),null);sendDocumentTransaction=()=>Promise.resolve(null);addPackage=async e=>this.rpc.proxy.request.addPackage(e);removePackage=async e=>this.rpc.proxy.request.removePackage(e);getPackageList=async()=>await this.rpc.proxy.request.listPackages();getSandbox=async()=>({backend:null,manifest:null,filename:null});updateManifest=async()=>{throw Error(`Sandboxes are not supported in WebAssembly`)};syncSandbox=async()=>{throw Error(`Sandboxes are not supported in WebAssembly`)};getDependencyTree=async()=>({tree:{dependencies:[],name:``,tags:[],version:null},context:{kind:`package-manager`,name:`micropip`}});listSecretKeys=async e=>(await this.putControlRequest({type:`list-secret-keys`,...e}),null);discoverDataSources=async e=>(await this.putControlRequest({type:`discover-data-sources`,...e}),null);getUsageStats=w;getEnvironmentInfo=async()=>await this.rpc.proxy.request.bridge({functionName:`get_environment_info`,payload:void 0});openTutorial=w;getRecentFiles=w;getWorkspaceFiles=w;getRunningNotebooks=w;shutdownSession=w;getExportAvailability=w;installExportRequirements=w;exportAsIPYNB=w;exportAsPDF=w;autoExportAsHTML=w;autoExportAsMarkdown=w;autoExportAsIPYNB=w;updateCellOutputs=w;writeSecret=w;invokeAiTool=w;clearCache=w;getCacheInfo=w;listStorageEntries=w;downloadStorage=w;async putControlRequest(e){await this.rpc.proxy.request.bridge({functionName:`put_control_request`,payload:e})}};function br(){return`marimo${typeof window<`u`&&window.__MARIMO_HAS_WASM_CONTROLLER__===!0?rr:``}`}function xr(e=T()){let t=window.fetch;return window.fetch=async(n,r)=>{let i=n instanceof Request?n.url:n.toString();if(i.startsWith(`data:`))return t(n,r);try{let a=K(i,e);if(a){let e=await(await t(a)).arrayBuffer();return new Response(e,{headers:{"Content-Type":Sr(i)}})}return t(n,r)}catch(e){return C.error(`Error parsing URL`,e),t(n,r)}},()=>{window.fetch=t}}function Sr(e){return e.endsWith(`.csv`)?`text/csv`:e.endsWith(`.json`)?`application/json`:e.endsWith(`.txt`)?`text/plain`:`application/octet-stream`}function Cr(e,t=T()){let n=e.http.bind(e),r=e.load.bind(e);return e.http=async e=>{let r=K(e,t);if(r)return await window.fetch(r).then(e=>e.text());try{return await n(e)}catch(t){if(e.startsWith(`data:`))return await window.fetch(e).then(e=>e.text());throw t}},e.load=async e=>{let n=K(e,t);if(n)return await window.fetch(n).then(e=>e.text());try{return await r(e)}catch(t){if(e.startsWith(`data:`))return await window.fetch(e).then(e=>e.text());throw t}},()=>{e.http=n,e.load=r}}function wr(e){return e.startsWith(`.`)?e.slice(1):e}function Tr(e,t=T()){let n=K(e,t);if(!n)return e;let r=Te(n);return URL.createObjectURL(r)}function K(e,t){let n=document.baseURI;n.startsWith(`blob:`)&&(n=n.replace(`blob:`,``));let r=new URL(e,n).pathname,i=Er(e),a=Er(r);return t[e]||t[wr(e)]||t[r]||t[wr(r)]||i&&t[i]||a&&t[a]}function Er(e){let t=e.indexOf(`/@file/`);return t===-1?null:e.slice(t)}function q(e,t){return{get(t){return e.get(t)},set(t,n){e.set(t,n)},save_changes(){e.save_changes()},send:e.send.bind(e),on(n,r){t.aborted||(e.on(n,r),t.addEventListener(`abort`,()=>e.off(n,r),{once:!0}))},off(t,n){e.off(t??null,n??null)},widget_manager:{async get_model(n){return q(await e.widget_manager.get_model(n),t)}}}}function J(e){return typeof e==`string`&&e.length>0}function Dr(e){if(typeof e==`string`&&e.startsWith(`anywidget:`)){let t=e.slice(10);if(J(t))return t}throw Error(`[anywidget] Invalid widget reference: ${JSON.stringify(e)}`)}function Or(e,t){return{async getModel(n){let r=Dr(n);return q(await e.getModel(r),t)},async getWidget(n){let r=Dr(n),i=await e.getWidget(r);return{exports:i.exports,async render({el:e,signal:n}){await i.render({el:e,signal:n??t})}}}}}var kr=Symbol(`marimo`);function Y(e){return e[kr]}var Ar=class e{#e=`change`;#t;#n;#r;#i={};static _modelManager;constructor(e,t,n){this.#n=e,this.#r=t,this.#t=new Set,n&&n.addEventListener(`abort`,()=>{C.debug(`[Model] Signal aborted, clearing all listeners`),this.#i={}})}[kr]={updateAndEmitDiffs:e=>this.#o(e),emitCustomMessage:(e,t)=>this.#s(e,t)};off(e,t){if(!e){this.#i={};return}if(!t){this.#i[e]=new Set;return}this.#i[e]?.delete(t)}send(e,t,n){let r=(n??[]).map(e=>e instanceof ArrayBuffer?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength));return this.#r.sendCustomMessage(e,r).then(()=>t?.())}widget_manager={async get_model(t){let n=await e._modelManager.getModel(t);if(!n)throw Error(`Model not found with id: ${t}. This is likely because the model was not registered.`);return n}};get(e){return this.#n[e]}set(e,t){this.#n={...this.#n,[e]:t},this.#t.add(e),this.#a(`change:${e}`,t),this.#c()}save_changes(){if(this.#t.size===0)return;let e=Object.fromEntries([...this.#t].map(e=>[e,this.#n[e]]));this.#t.clear(),this.#r.sendUpdate(e)}on(e,t,n){let r=n?.signal;r?.aborted||(this.#i[e]||(this.#i[e]=new Set),this.#i[e].add(t),r?.addEventListener(`abort`,()=>this.off(e,t),{once:!0}))}#a(e,t){let n=this.#i[e];if(n)for(let e of[...n])try{e(t)}catch(e){C.error(`Error emitting event`,e)}}#o(e){e!=null&&Object.keys(e).forEach(t=>{let n=t;this.#t.delete(n),this.#n[n]!==e[n]&&(this.#n={...this.#n,[n]:e[n]},this.#a(`change:${n}`,e[n]),this.#c())})}#s(e,t=[]){let n=this.#i[`msg:custom`];if(n)for(let r of[...n])try{r(e.content,t)}catch(e){C.error(`Error emitting event`,e)}}#c=ne(()=>{let e=this.#i[this.#e];if(e)for(let t of[...e])try{t()}catch(e){C.error(`Error emitting event`,e)}},0)};function jr(e){return typeof e==`function`}function Mr(e){return typeof e==`function`}function Nr(e){return t(e)&&(jr(e.render)||Mr(e.initialize))}function Pr(e){return typeof e==`function`||Nr(e)}function Fr(e){return t(e)&&Pr(e.default)}var Ir=new Set,Lr=new WeakMap;function Rr(e,n){if(Fr(e))return e.default;if(!t(e)||e.default!==void 0)return null;let r=jr(e.render)?e.render:void 0,i=Mr(e.initialize)?e.initialize:void 0;if(r===void 0&&i===void 0)return null;let a=Lr.get(e);if(a)return a;Ir.has(n)||(Ir.add(n),C.warn(`Anywidget module at ${n} uses deprecated top-level named exports (\`render\`/\`initialize\`). Per the AFM spec, use a default export instead: \`export default { render }\`. See https://anywidget.dev/en/afm/`));let o={render:r,initialize:i};return Lr.set(e,o),o}function zr(e,n){let r=`https://anywidget.dev/en/afm/`,a=t(e)&&i(e,`render`),o=t(e)&&i(e,`initialize`);if(t(e)&&e.default!==void 0)return Error(`Anywidget module at ${n} has an invalid default export. Expected a factory function or an object with \`render\` or \`initialize\`. See ${r}`);if(a||o){let e=[a?"`render`":null,o?"`initialize`":null].filter(Boolean).join(` and `),t=[a?`render`:null,o?`initialize`:null].filter(e=>e!==null),i=`export default { ${t.join(`, `)} }`,s=t.length===1?`export function ${t[0]}`:`named export function ...`;return Error(`Anywidget module at ${n} uses named exports (${e}). Per the AFM spec, use a default export instead: \`${i}\` (not \`${s}\`). See ${r}`)}return Error(`Anywidget module at ${n} is missing a default export. Per the AFM spec, use \`export default { render }\` or \`export default async () => ({ render })\`. See ${r}`)}function Br(e){return typeof e!=`string`||e.length===0?!1:!!(/^(\.?\/)?@file\/[^?#]+$/.test(e)||Hr(e))}function Vr(){return e.get(Ce)||Se()}function Hr(e){return e.startsWith(`data:text/javascript;base64,`)||e.startsWith(`data:application/javascript;base64,`)||e.startsWith(`data:text/css;base64,`)?Vr():!1}var Ur={invoke:async()=>{let e=`anywidget.invoke not supported in marimo. Please file an issue at https://github.com/marimo-team/marimo/issues`;throw C.warn(e),Error(e)}};function Wr(e){if(typeof AbortSignal.any==`function`)return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(n.reason),t.signal;n.addEventListener(`abort`,()=>t.abort(n.reason),{once:!0})}return t.signal}var Gr=class{#e=new Map;getModule(e){let{jsUrl:t,jsHash:n,kernelAuthored:r=!1,lifetime:i}=e,a=this.#e.get(n);if(!a){let e={references:0,dispose:()=>void 0,promise:this.#t(t,{kernelAuthored:r}).then(({module:t,dispose:n})=>(e.dispose=n,t),t=>{throw this.#e.get(n)===e&&this.#e.delete(n),t})};this.#e.set(n,e),a=e}let o=a;o.references+=1;let s=()=>{--o.references,o.references===0&&o.promise.then(()=>{o.dispose(),o.dispose=()=>void 0},()=>void 0)};return i?.aborted?s():i?.addEventListener(`abort`,s,{once:!0}),o.promise}invalidate(e){this.#e.delete(e)}async#t(e,t={}){if(!(Br(e)||t.kernelAuthored===!0&&/^(https?:|data:)/.test(e)))throw Error(`Refusing to load anywidget module from untrusted URL: ${String(e)}`);let n=fe(e).toString(),r=de()?Tr(n):n,i=()=>{r!==n&&URL.revokeObjectURL(r)};try{return{module:await ve(()=>import(r),[],import.meta.url),dispose:i}}catch(e){throw i(),e}}};function X(e){return typeof e==`function`}async function Kr(e,t){try{await e()}catch(e){C.warn(`[WidgetBinding] ${t} cleanup failed`,e)}}var qr=class e{#e;#t;#n;#r;#i;#a=new Set;#o=new Set;#s;constructor(e){this.#t=e.widget,this.#n=e.model,this.#r=e.exports,this.#e=e.controller,this.#i=e.createHost,this.#s=e.onDestroy}static async create({widgetDef:t,model:n,createHost:r,controller:i=new AbortController,onDestroy:a}){let o=i.signal,s;try{let c=typeof t==`function`?await t():t;if(o.aborted)throw Error(`[anywidget] binding destroyed`);let l=Promise.resolve(c.initialize?.({model:q(n,o),experimental:Ur,signal:o}));s=l.then(async e=>{o.aborted&&X(e)&&await Kr(e,`late initialize`)}).catch(()=>void 0);let u=await Promise.race([l,new Promise((e,t)=>{let n=()=>t(Error(`[anywidget] binding destroyed`));if(o.aborted){n();return}o.addEventListener(`abort`,n,{once:!0})})]);if(o.aborted)throw Error(`[anywidget] binding destroyed`);let d,f;X(u)?(f=u,d=void 0):d=typeof u==`object`&&u?u:void 0;let p=new e({widget:c,model:n,exports:d,controller:i,createHost:r,onDestroy:a});return f&&o.addEventListener(`abort`,()=>void p.#l(f,`initialize`),{once:!0}),p}catch(e){throw s?s.then(()=>a?.()):a?.(),e}}get exports(){return this.#r}async createView(e,t){let n=this.#c(e,t);this.#o.add(n);try{await n}finally{this.#o.delete(n)}}async#c(e,t){let n=this.#t;if(!n.render)return;let r=Wr([t.signal,this.#e.signal]);if(r.aborted)return;e.el.innerHTML=``;let i=this.#i(r),a=await n.render({model:q(this.#n,r),el:e.el,experimental:Ur,signal:r,host:i});if(X(a)){let e=()=>{let e=t.signal.aborted?`view unmount`:`binding destroyed`;return C.debug(`[WidgetBinding] Render cleanup triggered (reason: ${e})`),this.#l(a,`render`)};if(r.aborted){await e();return}r.addEventListener(`abort`,()=>void e(),{once:!0})}}#l(e,t){let n=Kr(e,t);return this.#a.add(n),n.finally(()=>this.#a.delete(n)),n}async destroy(){for(C.debug(`[WidgetBinding] Destroying binding generation`),this.#e.abort(),await Promise.allSettled(this.#o);this.#a.size>0;)await Promise.all(this.#a);this.#s?.(),this.#s=void 0}},Jr=new Gr,Yr=class{#e;#t;#n;#r;#i;#a=new AbortController;#o=new be;#s=new Set;#c=new Map;#l;#u;#d;#f=Promise.resolve();#p=``;constructor(e,t){this.#e=e,this.#t=t.timeout,this.#n=t.isEditMode,this.#r=t.createHost,this.#i=t.onModelTimeout}getModel(){return this.#o.status===`pending`&&!this.#l&&(this.#l=setTimeout(()=>{this.#o.status===`pending`&&(this.#l=void 0,this.#o.reject(Error(`Model not found for key: ${this.#e}`)),this.#i())},this.#t)),this.#o.promise}getModelSync(){return this.#o.status===`resolved`?this.#o.value:void 0}createModel(e){this.#o.status===`pending`&&this.#m(e(this.#a.signal))}setModel(e){this.#o.status===`pending`&&this.#m(e)}#m(e){this.#l&&=(clearTimeout(this.#l),void 0),this.#o.resolve(e);let t=e.get(`_css`);this.#p=typeof t==`string`?t:``,e.on(`change:_css`,e=>{this.#p=typeof e==`string`?e:``;for(let e of this.#c.values())e.update(this.#p)},{signal:this.#a.signal})}setSpec(e){if(!this.#u){this.#u=e;return}this.#n()&&(this.#u=e,this.#d&&this.#d.hash!==e.hash&&this.#v(e))}async getWidget(){return{exports:(await this.#h()).exports,render:async({el:e,signal:t})=>{await this.createView({el:e,signal:t??this.#a.signal})}}}async createView(e){if(e.signal.aborted||this.#a.signal.aborted)return;let t={el:e.el,signal:e.signal};this.#s.add(t),this.#x(t),e.signal.addEventListener(`abort`,()=>this.#s.delete(t),{once:!0}),await this.#b(t)}async#h(){for(;!this.#a.signal.aborted;){let e=await this.getModel(),t=this.#d;if(!t){let n=this.#u;if(!n)throw Error(`[anywidget] No ESM spec for model ${this.#e}: nothing ever provided this widget's code`);t=this.#_(n,e)}try{let e=await t.promise;if(t===this.#d)return e}catch(e){if(!this.#d||t===this.#d)throw e}}throw Error(`[anywidget] widget runtime destroyed`)}async#g(e){let{spec:t,model:n,controller:r}=e,i=new AbortController,a;try{let e=await Jr.getModule({jsUrl:t.url,jsHash:t.hash,kernelAuthored:!0,lifetime:i.signal}),n=Rr(e,t.url);if(!n)throw Jr.invalidate(t.hash),zr(e,t.url);a=n}catch(e){throw i.abort(),e}return qr.create({widgetDef:a,model:n,createHost:this.#r,controller:r,onDestroy:()=>i.abort()})}#_(e,t){let n=new AbortController,r={hash:e.hash,controller:n,promise:this.#g({spec:e,model:t,controller:n})};return r.promise.catch(()=>{this.#d===r&&(this.#d=void 0)}),this.#d=r,r}#v(e){let t=this.#d;if(!t)return;C.debug(`[WidgetRuntime] Hot-swapping generation for model=${this.#e}`);let n=this.#y(t),r=this.getModelSync();if(!r)return;let i=this.#_(e,r);for(let e of this.#s)e.generation=void 0,n.then(()=>this.#b(e,i)).catch(e=>{C.error(`[WidgetRuntime] Error replacing widget view`,e)})}#y(e){e.controller.abort();let t=this.#f.then(async()=>{try{await(await e.promise).destroy()}catch{}});return this.#f=t,t}async#b(e,t){if(e.signal.aborted||this.#a.signal.aborted)return;let n=t??this.#d,r=n?await n.promise:await this.#h(),i=this.#d;if(!(!i||i!==(n??i))&&e.generation!==i){e.generation=i;try{await r.createView({el:e.el},{signal:e.signal})}catch(t){if(i!==this.#d){e.generation=void 0;return}throw t}}}#x(e){let t=e.el.getRootNode();if(!Z(t)&&!Xr(t))return;let n=this.#c.get(t);n||(n=Zr(t,this.#p),this.#c.set(t,n)),n.references+=1;let r=!1;e.signal.addEventListener(`abort`,()=>{if(r)return;r=!0;let e=this.#c.get(t);e&&(--e.references,e.references===0&&(e.dispose(),this.#c.delete(t)))},{once:!0})}dispose(){if(!this.#a.signal.aborted){C.debug(`[WidgetRuntime] Disposing model=${this.#e}`),this.#l&&=(clearTimeout(this.#l),void 0),this.#o.status===`pending`&&(this.#o.promise.catch(()=>void 0),this.#o.reject(Error(`[anywidget] widget runtime destroyed`))),this.#d&&this.#y(this.#d),this.#a.abort(),this.#s.clear();for(let e of this.#c.values())e.dispose();this.#c.clear()}}};function Z(e){return e.nodeType===Node.DOCUMENT_NODE}function Xr(e){return e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&`host`in e}function Zr(e,t){let n=Z(e)?e:e.ownerDocument??document,r=n.defaultView??window;if(`adoptedStyleSheets`in e&&r.CSSStyleSheet!==void 0&&typeof r.CSSStyleSheet.prototype.replaceSync==`function`)try{let n=new r.CSSStyleSheet;return n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n],{references:0,update(e){n.replaceSync(e)},dispose(){e.adoptedStyleSheets=e.adoptedStyleSheets.filter(e=>e!==n)}}}catch{}let i=n.createElement(`style`);return i.textContent=t,Z(e)?n.head.append(i):e.append(i),{references:0,update(e){i.textContent=e},dispose(){i.remove()}}}function Q(e,t=[]){let n=[];if(e instanceof DataView)n.push(t);else if(Array.isArray(e))for(let[r,i]of e.entries())n.push(...Q(i,[...t,r]));else if(typeof e==`object`&&e)for(let[r,i]of Object.entries(e))n.push(...Q(i,[...t,r]));return n}function Qr(e){let t=Q(e);if(t.length===0)return{state:e,buffers:[],bufferPaths:[]};let n=structuredClone(e),r=[],i=[];for(let a of t){let t=te(e,a);if(t instanceof DataView){let e=me(t);r.push(e),i.push(a),k(n,a,e)}}return{state:n,buffers:r,bufferPaths:i}}function $r(e){let{state:t,bufferPaths:n,buffers:r}=e;if(!n||n.length===0)return t;r&&ae(r.length===n.length,`Buffers and buffer paths not the same length`);let i=t;for(let[e,t]of n.entries()){let n=r?.[e];if(n==null){C.warn(`[anywidget] Could not find buffer at path`,t);continue}typeof n==`string`?k(i,t,he(n)):k(i,t,n)}return i}function ei(){let t=e.get(ce).mode;return t===`edit`||t===`present`}var $=new class{#e=new Map;#t;#n;constructor(e=1e4,t=ei){this.#t=e,this.#n=t}#r(e){let t=this.#e.get(e);if(!t){let n=new Yr(e,{timeout:this.#t,isEditMode:this.#n,createHost:e=>Or(this,e),onModelTimeout:()=>{this.#e.get(e)===n&&(n.dispose(),this.#e.delete(e))}});t=n,this.#e.set(e,t)}return t}getModel(e){return this.#r(e).getModel()}getModelSync(e){return this.#e.get(e)?.getModelSync()}createModel(e,t){this.#r(e).createModel(t)}setModel(e,t){this.#r(e).setModel(t)}setSpec(e,t){this.#r(e).setSpec(t)}getWidget(e){return this.#r(e).getWidget()}createView(e){return this.#r(e.modelId).createView(e)}delete(e){let t=this.#e.get(e);t&&(t.dispose(),this.#e.delete(e))}};Ar._modelManager=$;async function ti(e,t){let n=t.model_id;if(!J(n))throw Error(`[anywidget] Invalid model id: ${String(n)}`);let r=t.message,i=(`buffers`in r?r.buffers:[]).map(he);switch(r.method){case`open`:{let{state:t,buffer_paths:a=[]}=r;r.esm_spec&&e.setSpec(n,r.esm_spec);let o=$r({state:t,bufferPaths:a,buffers:i}),s=e.getModelSync(n);if(s){Y(s).updateAndEmitDiffs(o);return}e.createModel(n,e=>{let t=de()?{sendUpdate:async()=>void 0,sendCustomMessage:async()=>void 0}:{async sendUpdate(t){if(e.aborted){C.debug(`[Model] sendUpdate suppressed for model=${n} (signal aborted)`);return}let{state:r,buffers:i,bufferPaths:a}=Qr(t);await D().sendModelValue({modelId:n,message:{method:`update`,state:r,bufferPaths:a},buffers:i})},async sendCustomMessage(t,r){if(e.aborted){C.debug(`[Model] sendCustomMessage suppressed for model=${n} (signal aborted)`);return}await D().sendModelValue({modelId:n,message:{method:`custom`,content:t},buffers:r.map(me)})}};return new Ar(o,t,e)});return}case`custom`:Y(await e.getModel(n)).emitCustomMessage({method:`custom`,content:r.content},i);return;case`close`:e.delete(n);return;case`update`:{let{state:t,buffer_paths:a=[]}=r;r.esm_spec&&e.setSpec(n,r.esm_spec);let o=$r({state:t,bufferPaths:a,buffers:i});Y(await e.getModel(n)).updateAndEmitDiffs(o);return}default:ye(r)}}o($,`WIDGET_REGISTRY`);function ni(e){return typeof e!=`object`||!e?!1:`type`in e&&e.type===`marimo-ui-value-update`}var ri=class e{entries;static get INSTANCE(){let t=`_marimo_private_UIElementRegistry`;return window[t]||(window[t]=new e),window[t]}constructor(){this.entries=new Map}has(e){return this.entries.has(e)}set(e,t){this.entries.has(e)&&C.debug(`UIElementRegistry overwriting entry for objectId.`,e),this.entries.set(e,{objectId:e,value:t,elements:new Set})}registerInstance(e,t){let n=this.entries.get(e);n===void 0?this.entries.set(e,{objectId:e,value:s(t,this),elements:new Set([t])}):n.elements.add(t)}removeInstance(e,t){let n=this.entries.get(e);n?.elements.has(t)&&n.elements.delete(t)}removeElementsByCell(e){[...this.entries.keys()].filter(t=>t.startsWith(`${e}-`)).forEach(e=>{this.entries.delete(e)})}lookupValue(e){let t=this.entries.get(e);return t===void 0?void 0:t.value}broadcastMessage(e,t,n){let r=this.entries.get(e);if(r===void 0){C.warn(`UIElementRegistry missing entry`,e);return}if(ni(t)){r.value=t.value,r.elements.forEach(e=>{e.dispatchEvent(ke.create({bubbles:!1,composed:!0,detail:{value:t.value,element:e}}))});return}r.elements.forEach(r=>{r.dispatchEvent(je.create({bubbles:!1,composed:!0,detail:{objectId:e,message:t,buffers:n}}))})}broadcastValueUpdate(e,t,n){let r=this.entries.get(t);r===void 0?C.warn(`UIElementRegistry missing entry`,t):(r.value=n,r.elements.forEach(t=>{t!==e&&t.dispatchEvent(ke.create({bubbles:!1,composed:!0,detail:{value:n,element:t}}))}),document.dispatchEvent(Ae.create({bubbles:!0,composed:!0,detail:{objectId:t}})))}},ii=ri.INSTANCE,ai=new ge(`function-call-result`,async(e,t)=>{await D().sendFunctionRequest({functionCallId:e,...t})}),oi=`68px`,si=`288px`,ci=e=>e?/^\d+$/.test(e)?`${e}px`:e:si,li=le({isOpen:!0},(e,t)=>{if(!t)return e;switch(t.type){case`toggle`:return{...e,isOpen:t.isOpen??e.isOpen};case`setWidth`:return{...e,width:t.width};default:return e}});export{Vn as _,ri as a,k as b,ti as c,xr as d,Cr as f,Un as g,qn as h,ai as i,Br as l,W as m,ci as n,ii as o,yr as p,li as r,$ as s,oi as t,J as u,Mn as v,V as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"./useEvent-BDjgaBtz.js";import{Qr as t,Zr as n}from"./cells-
|
|
1
|
+
import{f as e}from"./useEvent-BDjgaBtz.js";import{Qr as t,Zr as n}from"./cells-B9RIIuYa.js";import{g as r}from"./useEventListener-DPOTkksd.js";import{O as i}from"./config-7IjqNuVp.js";import{t as a}from"./use-toast-Wu434mLr.js";import{d as o}from"./arrays-0R2reF2y.js";var s=`marimo:ai:chatState:v5`,c=e(null),l=e(null),u=i(`marimo:ai:chatOptions`,{webSearch:!1},t),d=i(`marimo:ai:includeOtherCells`,!0,t);function f(e){let t=new Map;for(let[n,r]of e.entries()){if(r.messages.length===0)continue;let e=o(r.messages,e=>e.id);t.set(n,{...r,messages:e})}return t}var p=n({toSerializable:e=>({chats:[...f(e.chats).entries()],activeChatId:e.activeChatId}),fromSerializable:e=>({chats:new Map(e.chats),activeChatId:e.activeChatId})}),m=i(s,{chats:new Map,activeChatId:null},{...p,setItem:(e,t)=>{try{f(t.chats).size===0?p.removeItem(e):p.setItem(e,t)}catch(e){r.warn(`Could not save chat history`,e),a({id:`chat-storage-error`,once:!0,title:`Chat history couldn't be saved`,description:`Try deleting old chats. New messages may be lost when you reload.`,variant:`danger`})}}}),h=e(e=>{let t=e(m);return t.activeChatId?t.chats.get(t.activeChatId):null},(e,t,n)=>{t(m,e=>({...e,activeChatId:n}))});export{d as a,m as i,c as n,l as o,u as r,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{t as n}from"./compiler-runtime-BrajqUja.js";import{o as r}from"./useEventListener-DPOTkksd.js";import{n as i,t as a}from"./cn-ldLVeaqm.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{C as s,D as c,E as l,w as u}from"./fullscreen-D-ldV-19.js";import{a as d}from"./dist-gaK_BThd.js";import{At as f,Dt as p,Et as m,I as h,Kt as g,St as _,Ut as v,bt as y,ft as b,gt as x,ht as S,jt as C,nt as w,pt as ee,q as T,tt as te,vt as ne,wt as E,yt as re}from"./input-DLA5Dhn3.js";import{t as D}from"./I18nProvider-Cg2I_s1_.js";var O=e(t(),1),k=o(),A=Object.defineProperty,j=(e,t)=>A(e,`name`,{value:t,configurable:!0}),M=`Switch`,[N,ie]=l(M),[P,F]=N(M);function I(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:c,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=s({prop:n,defaultProp:i??!1,onChange:l,caller:M}),[h,g]=O.useState(null),[_,v]=O.useState(null),[y,b]=O.useState(null),x={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:c,form:o,value:d,userClick:y,onUserClick:b,required:u,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,k.jsx)(P,{scope:t,...x,children:le(f)?f(x):r})}j(I,`SwitchProvider`);var L=`SwitchTrigger`,R=O.forwardRef(j(function({__scopeSwitch:e,onClick:t,...n},i){let{control:a,form:o,value:s,disabled:l,checked:d,required:f,setControl:p,setChecked:m,onUserClick:h,isFormControl:g,bubbleInput:_}=F(L,e),v=r(i,p),y=O.useRef(d);return O.useEffect(()=>{let e=o?a?.ownerDocument.getElementById(o):a?.form;if(e instanceof HTMLFormElement){let t=j(()=>m(y.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,o,m]),(0,k.jsx)(c.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":f,"data-state":B(d),"data-disabled":l?``:void 0,disabled:l,value:s,...n,ref:v,onClick:u(t,e=>{let t=e.isPropagationStopped();h({requestedChecked:!d,hasConsumerStoppedPropagation:t}),m(e=>!e),_&&g&&(t||e.stopPropagation())})})},`SwitchTrigger`)),z=O.forwardRef(j(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,k.jsx)(I,{__scopeSwitch: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,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(R,{...d,ref:t,__scopeSwitch:n}),e&&(0,k.jsx)(ce,{__scopeSwitch:n})]})})},`Switch`)),ae=`SwitchThumb`,oe=O.forwardRef(j(function(e,t){let{__scopeSwitch:n,...r}=e,i=F(ae,n);return(0,k.jsx)(c.span,{"data-state":B(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),se=`SwitchBubbleInput`,ce=O.forwardRef(j(function({__scopeSwitch:e,onClick:t,...n},i){let{control:a,userClick:o,checked:s,defaultChecked:l,required:f,disabled:p,name:m,value:h,form:g,bubbleInput:_,setBubbleInput:v}=F(se,e),y=r(i,v),b=d(a),x=O.useRef(!1),S=O.useRef(s),C=O.useRef(o),w=O.useRef(null);O.useEffect(()=>{let e=_;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=S.current!==s;S.current=s;let i=o!==null&&o!==C.current;if(C.current=o,i)w.current=r?null:o,r&&n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!o.hasConsumerStoppedPropagation}));else if(r){let t=w.current;w.current=null;let r=t?.requestedChecked===s;x.current=!0,n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),x.current=!1}},[_,s,o]);let ee=O.useRef(s);return(0,k.jsx)(c.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:l??ee.current,required:f,disabled:p,name:m,value:h,form:g,...n,tabIndex:-1,ref:y,onClick:u(t,e=>{x.current&&e.stopPropagation()}),style:{...n.style,...b,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function le(e){return typeof e==`function`}j(le,`isFunction`);function B(e){return e?`checked`:`unchecked`}j(B,`getState`);function ue(e){return S()?e.metaKey:e.ctrlKey}var de=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function fe(e){return e instanceof HTMLInputElement&&!de.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function pe(e,t){let n=(0,O.useRef)(!0),r=(0,O.useRef)(null),i=te(e);(0,O.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]),(0,O.useEffect)(()=>{let e=r.current;n.current?n.current=!1:(!e||t.some((t,n)=>!Object.is(t,e[n])))&&i(),r.current=t},t)}function V(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function me(e,t){let n=e;for(V(n,t)&&(n=n.parentElement);n&&!V(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}function H(e,t){let n=[],r=document.scrollingElement||document.documentElement;for(;e&&(V(e,t)&&n.push(e),e!==r);)e=e.parentElement;return n}function U(e,t,n={}){e!==t&&he(e,t,t.getBoundingClientRect(),n)}function he(e,t,n,r={}){let{block:i=`nearest`,inline:a=`nearest`}=r,o=e.scrollTop,s=e.scrollLeft,c=e.getBoundingClientRect(),l=window.getComputedStyle(t),u=window.getComputedStyle(e),d=document.scrollingElement||document.documentElement,f=e===d,p=e===d?0:c.top,m=e===d?e.clientHeight:c.bottom,h=e===d?0:c.left,g=e===d?e.clientWidth:c.right,_=parseFloat(l.scrollMarginTop)||0,v=parseFloat(l.scrollMarginBottom)||0,y=parseFloat(l.scrollMarginLeft)||0,b=parseFloat(l.scrollMarginRight)||0,x=parseFloat(u.scrollPaddingTop)||0,S=parseFloat(u.scrollPaddingBottom)||0,C=parseFloat(u.scrollPaddingLeft)||0,w=parseFloat(u.scrollPaddingRight)||0,T=parseFloat(u.borderTopWidth)||0,te=parseFloat(u.borderBottomWidth)||0,E=parseFloat(u.borderLeftWidth)||0,re=parseFloat(u.borderRightWidth)||0,D=n.top-_,O=n.bottom+v,k=n.left-y,A=n.right+b,j=e===d?0:E+re,M=e===d?0:T+te,N=e===d?0:e.offsetWidth-e.clientWidth-j,ie=e===d?0:e.offsetHeight-e.clientHeight-M,P=p+(f?0:T)+x,F=m-(f?0:te)-S-ie,I=h+(f?0:E)+C,L=g-(f?0:re)-w;ne()&&ee()||u.direction===`ltr`?L-=N:u.direction===`rtl`&&(I+=N);let R=D<P||O>F,z=k<I||A>L;if(R&&i===`start`)o+=D-P;else if(R&&i===`center`)o+=(D+O)/2-(P+F)/2;else if(R&&i===`end`)o+=O-F;else if(R&&i===`nearest`){let e=D-P,t=O-F;o+=Math.abs(e)<=Math.abs(t)?e:t}if(z&&a===`start`)s+=k-I;else if(z&&a===`center`)s+=(k+A)/2-(I+L)/2;else if(z&&a===`end`)s+=A-L;else if(z&&a===`nearest`){let e=k-I,t=A-L;s+=Math.abs(e)<=Math.abs(t)?e:t}e.scrollTo({left:s,top:o})}function ge(e,t={}){let{containingElement:n}=t;if(e&&e.isConnected){let t=document.scrollingElement||document.documentElement;if(window.getComputedStyle(t).overflow!==`hidden`){let{left:t,top:r}=e.getBoundingClientRect();e?.scrollIntoView?.({block:`nearest`});let{left:i,top:a}=e.getBoundingClientRect();(Math.abs(t-i)>1||Math.abs(r-a)>1)&&(n?.scrollIntoView?.({block:`center`,inline:`center`}),e.scrollIntoView?.({block:`nearest`}))}else{let{left:t,top:r}=e.getBoundingClientRect(),i=H(e,!0);for(let t of i)U(t,e);let{left:a,top:o}=e.getBoundingClientRect();if(Math.abs(t-a)>1||Math.abs(r-o)>1){i=n?H(n,!0):[];for(let e of i)U(e,n,{block:`center`,inline:`center`});for(let t of H(e,!0))U(t,e)}}}}var _e=0,W=new Map;function ve(e){let[t,n]=(0,O.useState)();return g(()=>{if(!e)return;let t=W.get(e);if(t)n(t.element.id);else{let r=`react-aria-description-${_e++}`;n(r);let i=document.createElement(`div`);i.id=r,i.style.display=`none`,i.textContent=e,document.body.appendChild(i),t={refCount:0,element:i},W.set(e,t)}return t.refCount++,()=>{t&&--t.refCount===0&&(t.element.remove(),W.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}var ye={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function be(e={}){let{style:t,isFocusable:n}=e,[r,i]=(0,O.useState)(!1),{focusWithinProps:a}=h({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=(0,O.useMemo)(()=>r?t:t?{...ye,...t}:ye,[r]);return{visuallyHiddenProps:{...a,style:o}}}function xe(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=be(e);return O.createElement(n,v(a,o),t)}var Se=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}if(typeof this.filter==`function`)return this.filter(e);if(this.filter?.acceptNode)return this.filter.acceptNode(e);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(e){if(!_(this.root,e))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let t=[],n=e,r=e;for(this._currentNode=e;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=n,i=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),n=r=e.host}else n=n.parentNode;let i=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return _(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e)){if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}return null}return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function Ce(e,t,n,r){return p()?new Se(e,t,n,r):e.createTreeWalker(t,n,r)}var we=O.createContext(null),Te=`react-aria-focus-scope-restore`,G=null;function Ee(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,a=(0,O.useRef)(null),o=(0,O.useRef)(null),s=(0,O.useRef)([]),{parentNode:c}=(0,O.useContext)(we)||{},l=(0,O.useMemo)(()=>new Ue({scopeRef:s}),[s]);g(()=>{let e=c||$.root;if($.getTreeNode(e.scopeRef)&&G&&!X(G,e.scopeRef)){let t=$.getTreeNode(G);t&&(e=t)}e.addChild(l),$.addNode(l)},[l,c]),g(()=>{let e=$.getTreeNode(s);e&&(e.contain=!!n)},[n]),g(()=>{let e=a.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==o.current;)t.push(e),e.addEventListener(Te,n),e=e.nextSibling;return s.current=t,()=>{for(let e of t)e.removeEventListener(Te,n)}},[t]),Ie(s,r,n),Ae(s,n),Re(s,r,n),Fe(s,i),(0,O.useEffect)(()=>{let e=E(f(s.current?s.current[0]:void 0)),t=null;if(J(e,s.current)){for(let n of $.traverse())n.scopeRef&&J(e,n.scopeRef.current)&&(t=n);t===$.getTreeNode(s)&&(G=t.scopeRef)}},[s]),g(()=>()=>{let e=$.getTreeNode(s)?.parent?.scopeRef??null;(s===G||X(s,G))&&(!e||$.getTreeNode(e))&&(G=e),$.removeTreeNode(s)},[s]);let u=(0,O.useMemo)(()=>De(s),[]),d=(0,O.useMemo)(()=>({focusManager:u,parentNode:l}),[l,u]);return O.createElement(we.Provider,{value:d},O.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:a}),t,O.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:o}))}function De(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||E(f(n[0]??void 0)),c=n[0].previousElementSibling,l=Q(K(n),{tabbable:i,accept:o},n);l.currentNode=J(s,n)?s:c;let u=l.nextNode();return!u&&a&&(l.currentNode=c,u=l.nextNode()),u&&Z(u,!0),u},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||E(f(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=Q(K(n),{tabbable:i,accept:o},n);l.currentNode=J(s,n)?s:c;let u=l.previousNode();return!u&&a&&(l.currentNode=c,u=l.previousNode()),u&&Z(u,!0),u},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=Q(K(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&Z(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=Q(K(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&Z(o,!0),o}}}function K(e){return e[0].parentElement}function q(e){let t=$.getTreeNode(G);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Oe(e){if(!e.form)return Array.from(f(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=C(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function ke(e){if(e.checked)return!0;let t=Oe(e);return t.length>0&&!t.some(e=>e.checked)}function Ae(e,t){let n=(0,O.useRef)(void 0),r=(0,O.useRef)(void 0);g(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let a=f(i?i[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!q(e)||t.isComposing)return;let n=E(a),r=e.current;if(!r||!J(n,r))return;let i=Q(K(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let o=t.shiftKey?i.previousNode():i.nextNode();o||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),o&&(Z(o,!0),o instanceof C(o).HTMLInputElement&&o.select())},s=t=>{(!G||X(G,e))&&J(m(t),e.current)?(G=e,n.current=m(t)):q(e)&&!Y(m(t),e)?n.current?Z(n.current):G&&G.current&&Pe(G.current):q(e)&&(n.current=m(t))},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=w(),i=(r===`virtual`||r===null)&&x()&&b(),o=E(a);if(!i&&o&&q(e)&&!Y(o,e)){G=e;let r=m(t);r&&r.isConnected?(n.current=r,Z(n.current)):G.current&&Pe(G.current)}})};return a.addEventListener(`keydown`,o,!1),a.addEventListener(`focusin`,s,!1),i?.forEach(e=>e.addEventListener(`focusin`,s,!1)),i?.forEach(e=>e.addEventListener(`focusout`,c,!1)),()=>{a.removeEventListener(`keydown`,o,!1),a.removeEventListener(`focusin`,s,!1),i?.forEach(e=>e.removeEventListener(`focusin`,s,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,c,!1))}},[e,t]),g(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function je(e){return Y(e)}function J(e,t){return!e||!t?!1:t.some(t=>_(t,e))}function Y(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of $.traverse($.getTreeNode(t)))if(n&&J(e,n.current))return!0;return!1}function Me(e){return Y(e,G)}function X(e,t){let n=$.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function Z(e,t=!1){if(e!=null&&!t)try{T(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Ne(e,t=!0){let n=e[0].previousElementSibling,r=K(e),i=Q(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=K(e),i=Q(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function Pe(e,t=!0){Z(Ne(e,t))}function Fe(e,t){let n=O.useRef(t);(0,O.useEffect)(()=>{if(n.current){G=e;let t=f(e.current?e.current[0]:void 0);!J(E(t),G.current)&&e.current&&Pe(e.current)}n.current=!1},[e])}function Ie(e,t,n){g(()=>{if(t||n)return;let r=e.current,i=f(r?r[0]:void 0),a=t=>{let n=m(t);J(n,e.current)?G=e:je(n)||(G=null)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,n])}function Le(e){let t=$.getTreeNode(G);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Re(e,t,n){let r=(0,O.useRef)(typeof document<`u`?E(f(e.current?e.current[0]:void 0)):null);g(()=>{let r=e.current,i=f(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!G||X(G,e))&&J(E(i),e.current)&&(G=e)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,n]),g(()=>{let r=f(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!q(e)||t.isComposing)return;let n=r.activeElement;if(!Y(n,e)||!Le(e))return;let i=$.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=Q(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!Y(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(Y(s,e));t.preventDefault(),t.stopPropagation(),s?Z(s,!0):je(a)?Z(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),g(()=>{let n=f(e.current?e.current[0]:void 0);if(!t)return;let i=$.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=$.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=E(n);if(t&&i&&(a&&Y(a,e)||a===n.body&&Le(e))){let t=$.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){ze(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&$.getTreeNode(n.scopeRef)){let e=Ne(n.scopeRef.current,!0);if(e){ze(e);return}}n=n.parent}}})}}},[e,t])}function ze(e){e.dispatchEvent(new CustomEvent(Te,{bubbles:!0,cancelable:!0}))&&Z(e)}function Q(e,t,n){let r=t?.tabbable?y:re,i=e?.nodeType===Node.ELEMENT_NODE?e:null,a=f(i),o=Ce(a,e||a,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return _(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!ke(e)||o.currentNode.tagName===`INPUT`&&o.currentNode.type===`radio`&&o.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||J(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(o.currentNode=t.from),o}function Be(e,t={}){return{focusNext(n={}){let r=e.current;if(!r)return null;let{from:i,tabbable:a=t.tabbable,wrap:o=t.wrap,accept:s=t.accept}=n,c=i||E(f(r)),l=Q(r,{tabbable:a,accept:s});_(r,c)&&(l.currentNode=c);let u=l.nextNode();return!u&&o&&(l.currentNode=r,u=l.nextNode()),u&&Z(u,!0),u},focusPrevious(n=t){let r=e.current;if(!r)return null;let{from:i,tabbable:a=t.tabbable,wrap:o=t.wrap,accept:s=t.accept}=n,c=i||E(f(r)),l=Q(r,{tabbable:a,accept:s});if(_(r,c))l.currentNode=c;else{let e=Ve(l);return e&&Z(e,!0),e??null}let u=l.previousNode();if(!u&&o){l.currentNode=r;let e=Ve(l);if(!e)return null;u=e}return u&&Z(u,!0),u??null},focusFirst(n=t){let r=e.current;if(!r)return null;let{tabbable:i=t.tabbable,accept:a=t.accept}=n,o=Q(r,{tabbable:i,accept:a}).nextNode();return o&&Z(o,!0),o},focusLast(n=t){let r=e.current;if(!r)return null;let{tabbable:i=t.tabbable,accept:a=t.accept}=n,o=Ve(Q(r,{tabbable:i,accept:a}));return o&&Z(o,!0),o??null}}}function Ve(e){let t,n;do n=e.lastChild(),n&&(t=n);while(n);return t}var He=class e{constructor(){this.fastMap=new Map,this.root=new Ue({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new Ue({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&J(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},Ue=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}},$=new He,We=new Map;function Ge(e){let{locale:t}=D(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():``);if(We.has(n))return We.get(n);let r=new Intl.Collator(t,e);return We.set(n,r),r}var Ke=n(),qe=i(`peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,{variants:{size:{default:`h-6 w-11 mb-1`,sm:`h-4.5 w-8.5`,xs:`h-4 w-7`}},defaultVariants:{size:`default`}}),Je=i(`pointer-events-none block rounded-full bg-background shadow-xs ring-0 transition-transform`,{variants:{size:{default:`h-5 w-5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`,sm:`h-3.5 w-3.5 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`,xs:`h-3 w-3 data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0`}},defaultVariants:{size:`default`}}),Ye=O.forwardRef((e,t)=>{let n=(0,Ke.c)(16),r,i,o;n[0]===e?(r=n[1],i=n[2],o=n[3]):({className:r,size:o,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o);let s;n[4]!==r||n[5]!==o?(s=a(qe({size:o}),r),n[4]=r,n[5]=o,n[6]=s):s=n[6];let c;n[7]===o?c=n[8]:(c=a(Je({size:o})),n[7]=o,n[8]=c);let l;n[9]===c?l=n[10]:(l=(0,k.jsx)(oe,{className:c}),n[9]=c,n[10]=l);let u;return n[11]!==i||n[12]!==t||n[13]!==s||n[14]!==l?(u=(0,k.jsx)(z,{className:s,...i,ref:t,children:l}),n[11]=i,n[12]=t,n[13]=s,n[14]=l,n[15]=u):u=n[15],u});Ye.displayName=z.displayName;export{fe as _,Q as a,xe as c,U as d,ge as f,ue as g,pe as h,Ee as i,be as l,V as m,Ge as n,Be as o,me as p,Me as r,Ce as s,Ye as t,ve as u};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{t as n}from"./compiler-runtime-BrajqUja.js";import{o as r}from"./useEventListener-DPOTkksd.js";import{n as i,t as a}from"./cn-ldLVeaqm.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{C as s,D as c,E as l,w as u}from"./fullscreen-D-ldV-19.js";import{a as d}from"./dist-gaK_BThd.js";import{At as f,Dt as p,Et as m,I as h,Kt as g,St as _,Ut as v,bt as y,ft as b,gt as x,ht as S,jt as C,nt as w,pt as ee,q as T,tt as te,vt as ne,wt as E,yt as re}from"./input-BQBy_25D.js";import{t as D}from"./I18nProvider-Cg2I_s1_.js";var O=e(t(),1),k=o(),A=Object.defineProperty,j=(e,t)=>A(e,`name`,{value:t,configurable:!0}),M=`Switch`,[N,ie]=l(M),[P,F]=N(M);function I(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:c,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=s({prop:n,defaultProp:i??!1,onChange:l,caller:M}),[h,g]=O.useState(null),[_,v]=O.useState(null),[y,b]=O.useState(null),x={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:c,form:o,value:d,userClick:y,onUserClick:b,required:u,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,k.jsx)(P,{scope:t,...x,children:le(f)?f(x):r})}j(I,`SwitchProvider`);var L=`SwitchTrigger`,R=O.forwardRef(j(function({__scopeSwitch:e,onClick:t,...n},i){let{control:a,form:o,value:s,disabled:l,checked:d,required:f,setControl:p,setChecked:m,onUserClick:h,isFormControl:g,bubbleInput:_}=F(L,e),v=r(i,p),y=O.useRef(d);return O.useEffect(()=>{let e=o?a?.ownerDocument.getElementById(o):a?.form;if(e instanceof HTMLFormElement){let t=j(()=>m(y.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,o,m]),(0,k.jsx)(c.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":f,"data-state":B(d),"data-disabled":l?``:void 0,disabled:l,value:s,...n,ref:v,onClick:u(t,e=>{let t=e.isPropagationStopped();h({requestedChecked:!d,hasConsumerStoppedPropagation:t}),m(e=>!e),_&&g&&(t||e.stopPropagation())})})},`SwitchTrigger`)),z=O.forwardRef(j(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,k.jsx)(I,{__scopeSwitch: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,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(R,{...d,ref:t,__scopeSwitch:n}),e&&(0,k.jsx)(ce,{__scopeSwitch:n})]})})},`Switch`)),ae=`SwitchThumb`,oe=O.forwardRef(j(function(e,t){let{__scopeSwitch:n,...r}=e,i=F(ae,n);return(0,k.jsx)(c.span,{"data-state":B(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),se=`SwitchBubbleInput`,ce=O.forwardRef(j(function({__scopeSwitch:e,onClick:t,...n},i){let{control:a,userClick:o,checked:s,defaultChecked:l,required:f,disabled:p,name:m,value:h,form:g,bubbleInput:_,setBubbleInput:v}=F(se,e),y=r(i,v),b=d(a),x=O.useRef(!1),S=O.useRef(s),C=O.useRef(o),w=O.useRef(null);O.useEffect(()=>{let e=_;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=S.current!==s;S.current=s;let i=o!==null&&o!==C.current;if(C.current=o,i)w.current=r?null:o,r&&n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!o.hasConsumerStoppedPropagation}));else if(r){let t=w.current;w.current=null;let r=t?.requestedChecked===s;x.current=!0,n.call(e,s),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),x.current=!1}},[_,s,o]);let ee=O.useRef(s);return(0,k.jsx)(c.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:l??ee.current,required:f,disabled:p,name:m,value:h,form:g,...n,tabIndex:-1,ref:y,onClick:u(t,e=>{x.current&&e.stopPropagation()}),style:{...n.style,...b,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function le(e){return typeof e==`function`}j(le,`isFunction`);function B(e){return e?`checked`:`unchecked`}j(B,`getState`);function ue(e){return S()?e.metaKey:e.ctrlKey}var de=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function fe(e){return e instanceof HTMLInputElement&&!de.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function pe(e,t){let n=(0,O.useRef)(!0),r=(0,O.useRef)(null),i=te(e);(0,O.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]),(0,O.useEffect)(()=>{let e=r.current;n.current?n.current=!1:(!e||t.some((t,n)=>!Object.is(t,e[n])))&&i(),r.current=t},t)}function V(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function me(e,t){let n=e;for(V(n,t)&&(n=n.parentElement);n&&!V(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}function H(e,t){let n=[],r=document.scrollingElement||document.documentElement;for(;e&&(V(e,t)&&n.push(e),e!==r);)e=e.parentElement;return n}function U(e,t,n={}){e!==t&&he(e,t,t.getBoundingClientRect(),n)}function he(e,t,n,r={}){let{block:i=`nearest`,inline:a=`nearest`}=r,o=e.scrollTop,s=e.scrollLeft,c=e.getBoundingClientRect(),l=window.getComputedStyle(t),u=window.getComputedStyle(e),d=document.scrollingElement||document.documentElement,f=e===d,p=e===d?0:c.top,m=e===d?e.clientHeight:c.bottom,h=e===d?0:c.left,g=e===d?e.clientWidth:c.right,_=parseFloat(l.scrollMarginTop)||0,v=parseFloat(l.scrollMarginBottom)||0,y=parseFloat(l.scrollMarginLeft)||0,b=parseFloat(l.scrollMarginRight)||0,x=parseFloat(u.scrollPaddingTop)||0,S=parseFloat(u.scrollPaddingBottom)||0,C=parseFloat(u.scrollPaddingLeft)||0,w=parseFloat(u.scrollPaddingRight)||0,T=parseFloat(u.borderTopWidth)||0,te=parseFloat(u.borderBottomWidth)||0,E=parseFloat(u.borderLeftWidth)||0,re=parseFloat(u.borderRightWidth)||0,D=n.top-_,O=n.bottom+v,k=n.left-y,A=n.right+b,j=e===d?0:E+re,M=e===d?0:T+te,N=e===d?0:e.offsetWidth-e.clientWidth-j,ie=e===d?0:e.offsetHeight-e.clientHeight-M,P=p+(f?0:T)+x,F=m-(f?0:te)-S-ie,I=h+(f?0:E)+C,L=g-(f?0:re)-w;ne()&&ee()||u.direction===`ltr`?L-=N:u.direction===`rtl`&&(I+=N);let R=D<P||O>F,z=k<I||A>L;if(R&&i===`start`)o+=D-P;else if(R&&i===`center`)o+=(D+O)/2-(P+F)/2;else if(R&&i===`end`)o+=O-F;else if(R&&i===`nearest`){let e=D-P,t=O-F;o+=Math.abs(e)<=Math.abs(t)?e:t}if(z&&a===`start`)s+=k-I;else if(z&&a===`center`)s+=(k+A)/2-(I+L)/2;else if(z&&a===`end`)s+=A-L;else if(z&&a===`nearest`){let e=k-I,t=A-L;s+=Math.abs(e)<=Math.abs(t)?e:t}e.scrollTo({left:s,top:o})}function ge(e,t={}){let{containingElement:n}=t;if(e&&e.isConnected){let t=document.scrollingElement||document.documentElement;if(window.getComputedStyle(t).overflow!==`hidden`){let{left:t,top:r}=e.getBoundingClientRect();e?.scrollIntoView?.({block:`nearest`});let{left:i,top:a}=e.getBoundingClientRect();(Math.abs(t-i)>1||Math.abs(r-a)>1)&&(n?.scrollIntoView?.({block:`center`,inline:`center`}),e.scrollIntoView?.({block:`nearest`}))}else{let{left:t,top:r}=e.getBoundingClientRect(),i=H(e,!0);for(let t of i)U(t,e);let{left:a,top:o}=e.getBoundingClientRect();if(Math.abs(t-a)>1||Math.abs(r-o)>1){i=n?H(n,!0):[];for(let e of i)U(e,n,{block:`center`,inline:`center`});for(let t of H(e,!0))U(t,e)}}}}var _e=0,W=new Map;function ve(e){let[t,n]=(0,O.useState)();return g(()=>{if(!e)return;let t=W.get(e);if(t)n(t.element.id);else{let r=`react-aria-description-${_e++}`;n(r);let i=document.createElement(`div`);i.id=r,i.style.display=`none`,i.textContent=e,document.body.appendChild(i),t={refCount:0,element:i},W.set(e,t)}return t.refCount++,()=>{t&&--t.refCount===0&&(t.element.remove(),W.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}var ye={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function be(e={}){let{style:t,isFocusable:n}=e,[r,i]=(0,O.useState)(!1),{focusWithinProps:a}=h({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=(0,O.useMemo)(()=>r?t:t?{...ye,...t}:ye,[r]);return{visuallyHiddenProps:{...a,style:o}}}function xe(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=be(e);return O.createElement(n,v(a,o),t)}var Se=class{constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}if(typeof this.filter==`function`)return this.filter(e);if(this.filter?.acceptNode)return this.filter.acceptNode(e);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}get currentNode(){return this._currentNode}set currentNode(e){if(!_(this.root,e))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let t=[],n=e,r=e;for(this._currentNode=e;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=n,i=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),n=r=e.host}else n=n.parentNode;let i=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return _(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e)){if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}return null}return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}};function Ce(e,t,n,r){return p()?new Se(e,t,n,r):e.createTreeWalker(t,n,r)}var we=O.createContext(null),Te=`react-aria-focus-scope-restore`,G=null;function Ee(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,a=(0,O.useRef)(null),o=(0,O.useRef)(null),s=(0,O.useRef)([]),{parentNode:c}=(0,O.useContext)(we)||{},l=(0,O.useMemo)(()=>new Ue({scopeRef:s}),[s]);g(()=>{let e=c||$.root;if($.getTreeNode(e.scopeRef)&&G&&!X(G,e.scopeRef)){let t=$.getTreeNode(G);t&&(e=t)}e.addChild(l),$.addNode(l)},[l,c]),g(()=>{let e=$.getTreeNode(s);e&&(e.contain=!!n)},[n]),g(()=>{let e=a.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==o.current;)t.push(e),e.addEventListener(Te,n),e=e.nextSibling;return s.current=t,()=>{for(let e of t)e.removeEventListener(Te,n)}},[t]),Ie(s,r,n),Ae(s,n),Re(s,r,n),Fe(s,i),(0,O.useEffect)(()=>{let e=E(f(s.current?s.current[0]:void 0)),t=null;if(J(e,s.current)){for(let n of $.traverse())n.scopeRef&&J(e,n.scopeRef.current)&&(t=n);t===$.getTreeNode(s)&&(G=t.scopeRef)}},[s]),g(()=>()=>{let e=$.getTreeNode(s)?.parent?.scopeRef??null;(s===G||X(s,G))&&(!e||$.getTreeNode(e))&&(G=e),$.removeTreeNode(s)},[s]);let u=(0,O.useMemo)(()=>De(s),[]),d=(0,O.useMemo)(()=>({focusManager:u,parentNode:l}),[l,u]);return O.createElement(we.Provider,{value:d},O.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:a}),t,O.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:o}))}function De(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||E(f(n[0]??void 0)),c=n[0].previousElementSibling,l=Q(K(n),{tabbable:i,accept:o},n);l.currentNode=J(s,n)?s:c;let u=l.nextNode();return!u&&a&&(l.currentNode=c,u=l.nextNode()),u&&Z(u,!0),u},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||E(f(n[0]??void 0)),c=n[n.length-1].nextElementSibling,l=Q(K(n),{tabbable:i,accept:o},n);l.currentNode=J(s,n)?s:c;let u=l.previousNode();return!u&&a&&(l.currentNode=c,u=l.previousNode()),u&&Z(u,!0),u},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=Q(K(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&Z(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=Q(K(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&Z(o,!0),o}}}function K(e){return e[0].parentElement}function q(e){let t=$.getTreeNode(G);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function Oe(e){if(!e.form)return Array.from(f(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=C(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function ke(e){if(e.checked)return!0;let t=Oe(e);return t.length>0&&!t.some(e=>e.checked)}function Ae(e,t){let n=(0,O.useRef)(void 0),r=(0,O.useRef)(void 0);g(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let a=f(i?i[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!q(e)||t.isComposing)return;let n=E(a),r=e.current;if(!r||!J(n,r))return;let i=Q(K(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let o=t.shiftKey?i.previousNode():i.nextNode();o||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),o&&(Z(o,!0),o instanceof C(o).HTMLInputElement&&o.select())},s=t=>{(!G||X(G,e))&&J(m(t),e.current)?(G=e,n.current=m(t)):q(e)&&!Y(m(t),e)?n.current?Z(n.current):G&&G.current&&Pe(G.current):q(e)&&(n.current=m(t))},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{let r=w(),i=(r===`virtual`||r===null)&&x()&&b(),o=E(a);if(!i&&o&&q(e)&&!Y(o,e)){G=e;let r=m(t);r&&r.isConnected?(n.current=r,Z(n.current)):G.current&&Pe(G.current)}})};return a.addEventListener(`keydown`,o,!1),a.addEventListener(`focusin`,s,!1),i?.forEach(e=>e.addEventListener(`focusin`,s,!1)),i?.forEach(e=>e.addEventListener(`focusout`,c,!1)),()=>{a.removeEventListener(`keydown`,o,!1),a.removeEventListener(`focusin`,s,!1),i?.forEach(e=>e.removeEventListener(`focusin`,s,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,c,!1))}},[e,t]),g(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function je(e){return Y(e)}function J(e,t){return!e||!t?!1:t.some(t=>_(t,e))}function Y(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of $.traverse($.getTreeNode(t)))if(n&&J(e,n.current))return!0;return!1}function Me(e){return Y(e,G)}function X(e,t){let n=$.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function Z(e,t=!1){if(e!=null&&!t)try{T(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function Ne(e,t=!0){let n=e[0].previousElementSibling,r=K(e),i=Q(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=K(e),i=Q(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function Pe(e,t=!0){Z(Ne(e,t))}function Fe(e,t){let n=O.useRef(t);(0,O.useEffect)(()=>{if(n.current){G=e;let t=f(e.current?e.current[0]:void 0);!J(E(t),G.current)&&e.current&&Pe(e.current)}n.current=!1},[e])}function Ie(e,t,n){g(()=>{if(t||n)return;let r=e.current,i=f(r?r[0]:void 0),a=t=>{let n=m(t);J(n,e.current)?G=e:je(n)||(G=null)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,n])}function Le(e){let t=$.getTreeNode(G);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function Re(e,t,n){let r=(0,O.useRef)(typeof document<`u`?E(f(e.current?e.current[0]:void 0)):null);g(()=>{let r=e.current,i=f(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!G||X(G,e))&&J(E(i),e.current)&&(G=e)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,n]),g(()=>{let r=f(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!q(e)||t.isComposing)return;let n=r.activeElement;if(!Y(n,e)||!Le(e))return;let i=$.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=Q(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!Y(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(Y(s,e));t.preventDefault(),t.stopPropagation(),s?Z(s,!0):je(a)?Z(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),g(()=>{let n=f(e.current?e.current[0]:void 0);if(!t)return;let i=$.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=$.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,a=E(n);if(t&&i&&(a&&Y(a,e)||a===n.body&&Le(e))){let t=$.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){ze(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&$.getTreeNode(n.scopeRef)){let e=Ne(n.scopeRef.current,!0);if(e){ze(e);return}}n=n.parent}}})}}},[e,t])}function ze(e){e.dispatchEvent(new CustomEvent(Te,{bubbles:!0,cancelable:!0}))&&Z(e)}function Q(e,t,n){let r=t?.tabbable?y:re,i=e?.nodeType===Node.ELEMENT_NODE?e:null,a=f(i),o=Ce(a,e||a,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return _(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!ke(e)||o.currentNode.tagName===`INPUT`&&o.currentNode.type===`radio`&&o.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||J(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(o.currentNode=t.from),o}function Be(e,t={}){return{focusNext(n={}){let r=e.current;if(!r)return null;let{from:i,tabbable:a=t.tabbable,wrap:o=t.wrap,accept:s=t.accept}=n,c=i||E(f(r)),l=Q(r,{tabbable:a,accept:s});_(r,c)&&(l.currentNode=c);let u=l.nextNode();return!u&&o&&(l.currentNode=r,u=l.nextNode()),u&&Z(u,!0),u},focusPrevious(n=t){let r=e.current;if(!r)return null;let{from:i,tabbable:a=t.tabbable,wrap:o=t.wrap,accept:s=t.accept}=n,c=i||E(f(r)),l=Q(r,{tabbable:a,accept:s});if(_(r,c))l.currentNode=c;else{let e=Ve(l);return e&&Z(e,!0),e??null}let u=l.previousNode();if(!u&&o){l.currentNode=r;let e=Ve(l);if(!e)return null;u=e}return u&&Z(u,!0),u??null},focusFirst(n=t){let r=e.current;if(!r)return null;let{tabbable:i=t.tabbable,accept:a=t.accept}=n,o=Q(r,{tabbable:i,accept:a}).nextNode();return o&&Z(o,!0),o},focusLast(n=t){let r=e.current;if(!r)return null;let{tabbable:i=t.tabbable,accept:a=t.accept}=n,o=Ve(Q(r,{tabbable:i,accept:a}));return o&&Z(o,!0),o??null}}}function Ve(e){let t,n;do n=e.lastChild(),n&&(t=n);while(n);return t}var He=class e{constructor(){this.fastMap=new Map,this.root=new Ue({scopeRef:null}),this.fastMap.set(null,this.root)}get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new Ue({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&J(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}},Ue=class{constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}},$=new He,We=new Map;function Ge(e){let{locale:t}=D(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():``);if(We.has(n))return We.get(n);let r=new Intl.Collator(t,e);return We.set(n,r),r}var Ke=n(),qe=i(`peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,{variants:{size:{default:`h-6 w-11 mb-1`,sm:`h-4.5 w-8.5`,xs:`h-4 w-7`}},defaultVariants:{size:`default`}}),Je=i(`pointer-events-none block rounded-full bg-background shadow-xs ring-0 transition-transform`,{variants:{size:{default:`h-5 w-5 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`,sm:`h-3.5 w-3.5 data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0`,xs:`h-3 w-3 data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0`}},defaultVariants:{size:`default`}}),Ye=O.forwardRef((e,t)=>{let n=(0,Ke.c)(16),r,i,o;n[0]===e?(r=n[1],i=n[2],o=n[3]):({className:r,size:o,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o);let s;n[4]!==r||n[5]!==o?(s=a(qe({size:o}),r),n[4]=r,n[5]=o,n[6]=s):s=n[6];let c;n[7]===o?c=n[8]:(c=a(Je({size:o})),n[7]=o,n[8]=c);let l;n[9]===c?l=n[10]:(l=(0,k.jsx)(oe,{className:c}),n[9]=c,n[10]=l);let u;return n[11]!==i||n[12]!==t||n[13]!==s||n[14]!==l?(u=(0,k.jsx)(z,{className:s,...i,ref:t,children:l}),n[11]=i,n[12]=t,n[13]=s,n[14]=l,n[15]=u):u=n[15],u});Ye.displayName=z.displayName;export{fe as _,Q as a,xe as c,U as d,ge as f,ue as g,pe as h,Ee as i,be as l,V as m,Ge as n,Be as o,me as p,Me as r,Ce as s,Ye as t,ve as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./useEvent-BDjgaBtz.js";import{t as i}from"./react-DVplv7_D.js";import{M as a,dr as o,oo as s,q as c}from"./cells-SvbLY10y.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{t as u}from"./cn-ldLVeaqm.js";import{t as d}from"./jsx-runtime-B74pBk57.js";import{t as f}from"./tooltip-B5lAA_jn.js";import{t as p}from"./createLucideIcon-DfJ2oMlA.js";import{o as m}from"./paths-bkIFVj8h.js";import{a as h}from"./useNumberFormatter-D7O_26UI.js";import{t as g}from"./chevron-right-eAtVhbNZ.js";import{t as _}from"./circle-check-BCurAHEb.js";import{r as v}from"./useTheme-C2dnh2vM.js";import{n as y}from"./CellStatus-DC6FFQOg.js";import{r as b,t as x}from"./react-vega-BTNeboR2.js";import{t as S}from"./cell-link-Cj0gGaMV.js";import{n as C,r as w,t as T}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{t as E}from"./bundle.esm-D3tw5rqW.js";import{t as D}from"./empty-state-BaCKb7o3.js";import{r as O}from"./panel-context-C2QXpKfx.js";import{t as k}from"./clear-button-p6YcvzLy.js";import{n as A,t as j}from"./runs-C8uOPNAW.js";var M=p(`circle-ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M17 12h.01`,key:`1m0b6t`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M7 12h.01`,key:`eqddd0`}]]),N=p(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),P=e(i(),1),F=l(),I=`hoveredCellId`,L=`cellHover`,R=`cellNum`,z=`cell`,B=`startTimestamp`,V=`endTimestamp`,H=`status`;function U(e,t,n,r){let i=`hoursminutessecondsmilliseconds`;return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,background:r===`dark`?`black`:void 0,mark:{type:`bar`,cornerRadius:2},params:[{name:I,bind:{element:`#${t}`}},{name:L,select:{type:`point`,on:`mouseover`,fields:[z],clear:`mouseout`}}],height:{step:n===`sideBySide`?26:21},encoding:{y:{field:R,scale:{paddingInner:.2},sort:{field:`sortPriority`},title:`cell`,axis:n===`sideBySide`?null:void 0},x:{field:B,type:`temporal`,axis:{orient:`top`,title:null}},x2:{field:V,type:`temporal`},tooltip:[{field:B,type:`temporal`,timeUnit:i,title:`Start`},{field:V,type:`temporal`,timeUnit:i,title:`End`}],size:{value:{expr:`${I} == toString(datum.${z}) ? 19.5 : 18`}},color:{field:H,scale:{domain:[`success`,`error`],range:[`#37BE5F`,`red`]},legend:null}},data:{values:e},transform:[{calculate:`datum.${H} === 'queued' ? 9999999999999 : datum.${B}`,as:`sortPriority`}],config:{view:{stroke:`transparent`}}}}function W(e){try{let t=new Date(e*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}catch{return``}}var G=d(),K=t(new Map),q=()=>{let e=(0,F.c)(39),{runIds:t,runMap:r}=n(j),i=n(K),{clearRuns:a}=A(),{theme:o}=v(),[s,c]=(0,P.useState)(`above`),l=P.useId(),u=O(),d;e[0]===s?d=e[1]:(d=()=>{c(s===`above`?`sideBySide`:`above`)},e[0]=s,e[1]=d);let f=d;if(t.length===0){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(D,{title:`No traces`,description:(0,G.jsx)(`span`,{children:`Cells that have ran will appear here.`}),icon:(0,G.jsx)(m,{})}),e[2]=t):t=e[2],t}let p;e[3]===l?p=e[4]:(p=(0,G.jsx)(`label`,{htmlFor:l,className:`text-xs`,children:`Inline chart`}),e[3]=l,e[4]=p);let h=s===`sideBySide`,g;e[5]!==l||e[6]!==h||e[7]!==f?(g=(0,G.jsx)(`input`,{type:`checkbox`,id:l,name:`chartPosition`,"data-testid":`chartPosition`,onClick:f,defaultChecked:h,className:`h-3 cursor-pointer`}),e[5]=l,e[6]=h,e[7]=f,e[8]=g):g=e[8];let _;e[9]!==p||e[10]!==g?(_=(0,G.jsxs)(`div`,{className:`flex flex-row gap-1 items-center`,children:[p,g]}),e[9]=p,e[10]=g,e[11]=_):_=e[11];let y;e[12]===a?y=e[13]:(y=(0,G.jsx)(k,{dataTestId:`clear-traces-button`,onClick:a}),e[12]=a,e[13]=y);let b;e[14]!==_||e[15]!==y?(b=(0,G.jsxs)(`div`,{className:`flex flex-row justify-start gap-3`,children:[_,y]}),e[14]=_,e[15]=y,e[16]=b):b=e[16];let x;if(e[17]!==s||e[18]!==i||e[19]!==t||e[20]!==r||e[21]!==o){let n;e[23]!==s||e[24]!==i||e[25]!==r||e[26]!==o?(n=(e,t)=>{let n=r.get(e);return n?(0,G.jsx)(J,{run:n,isExpanded:i.get(n.runId),isMostRecentRun:t===0,chartPosition:s,theme:o},n.runId):null},e[23]=s,e[24]=i,e[25]=r,e[26]=o,e[27]=n):n=e[27],x=t.map(n),e[17]=s,e[18]=i,e[19]=t,e[20]=r,e[21]=o,e[22]=x}else x=e[22];let S;e[28]===x?S=e[29]:(S=(0,G.jsx)(`div`,{className:`flex flex-col gap-3`,children:x}),e[28]=x,e[29]=S);let E;e[30]!==b||e[31]!==S?(E=(0,G.jsxs)(`div`,{className:`py-1 px-2 overflow-y-scroll h-full`,children:[b,S]}),e[30]=b,e[31]=S,e[32]=E):E=e[32];let M=E;if(u===`sidebar`)return M;let N;e[33]===M?N=e[34]:(N=(0,G.jsx)(T,{defaultSize:50,minSize:30,maxSize:80,children:M}),e[33]=M,e[34]=N);let I;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,G.jsx)(w,{className:`w-1 bg-border hover:bg-primary/50 transition-colors`}),e[35]=I):I=e[35];let L;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,G.jsx)(T,{defaultSize:50,children:(0,G.jsx)(`div`,{})}),e[36]=L):L=e[36];let R;return e[37]===N?R=e[38]:(R=(0,G.jsxs)(C,{direction:`horizontal`,className:`h-full`,children:[N,I,L]}),e[37]=N,e[38]=R),R},J=e=>{let t=(0,F.c)(26),{run:n,isMostRecentRun:i,chartPosition:a,isExpanded:o,theme:s}=e,l=r(K),d=o??i,f;t[0]!==d||t[1]!==n.runId||t[2]!==l?(f=()=>{l(e=>{let t=new Map(e);return t.set(n.runId,!d),t})},t[0]=d,t[1]=n.runId,t[2]=l,t[3]=f):f=t[3];let p=f,m=d?h:g,_;t[4]===m?_=t[5]:(_=(0,G.jsx)(m,{height:16,className:`inline`}),t[4]=m,t[5]=_);let v=_,y;t[6]===n.runStartTime?y=t[7]:(y=c(n.runStartTime),t[6]=n.runStartTime,t[7]=y);let b;t[8]!==v||t[9]!==d||t[10]!==p||t[11]!==y?(b=(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`text-sm cursor-pointer`,onClick:p,children:[`Run - `,y,v]}),t[8]=v,t[9]=d,t[10]=p,t[11]=y,t[12]=b):b=t[12];let x=b,S=d&&a===`sideBySide`&&`grid-cols-[auto_minmax(0,1fr)] grid-rows-[auto_1fr]`,C;t[13]===S?C=t[14]:(C=u(`grid grid-cols-1`,S),t[13]=S,t[14]=C);let w;t[15]===x?w=t[16]:(w=(0,G.jsx)(`pre`,{className:`font-mono font-semibold`,children:x}),t[15]=x,t[16]=w);let T;t[17]!==a||t[18]!==d||t[19]!==n||t[20]!==s?(T=d&&(0,G.jsx)(Y,{run:n,chartPosition:a,theme:s}),t[17]=a,t[18]=d,t[19]=n,t[20]=s,t[21]=T):T=t[21];let E;return t[22]!==C||t[23]!==w||t[24]!==T?(E=(0,G.jsxs)(`div`,{className:C,children:[w,T]}),t[22]=C,t[23]=w,t[24]=T,t[25]=E):E=t[25],E},Y=e=>{let t=(0,F.c)(32),{run:n,chartPosition:r,theme:i}=e,[s,c]=(0,P.useState)(),l=(0,P.useRef)(null),{ref:u,width:d}=E(),f=d===void 0?300:d,p=a(),m,h;if(t[0]!==p||t[1]!==r||t[2]!==n.cellRuns||t[3]!==n.runId||t[4]!==i){let e=[...n.cellRuns.values()].map(e=>{let t=e.elapsedTime??0;return{cell:e.cellId,cellNum:p.inOrderIds.indexOf(e.cellId),startTimestamp:W(e.startTime),endTimestamp:W(e.startTime+t),elapsedTime:o(t*1e3),status:e.status}});m=`hiddenInputElement-${n.runId}`,h=b(U(e,m,r,i)),t[0]=p,t[1]=r,t[2]=n.cellRuns,t[3]=n.runId,t[4]=i,t[5]=m,t[6]=h}else m=t[5],h=t[6];let g=h.spec,_=i===`dark`?`dark`:void 0,v=f-50,y=r===`above`?120:100,S;t[7]!==_||t[8]!==v||t[9]!==y?(S={theme:_,width:v,height:y,actions:!1,mode:`vega`,renderer:`canvas`},t[7]=_,t[8]=v,t[9]=y,t[10]=S):S=t[10];let C;t[11]!==S||t[12]!==g?(C={ref:l,spec:g,options:S},t[11]=S,t[12]=g,t[13]=C):C=t[13];let w=x(C),T;t[14]===w?.view?T=t[15]:(T=()=>{let e=[{signalName:L,handler:(e,t)=>{let n=t.cell?.[0]??void 0;c(n??null)}}];return e.forEach(e=>{let{signalName:t,handler:n}=e;w?.view.addSignalListener(t,n)}),()=>{e.forEach(e=>{let{signalName:t,handler:n}=e;w?.view.removeSignalListener(t,n)})}},t[14]=w?.view,t[15]=T);let D;t[16]===w?D=t[17]:(D=[w],t[16]=w,t[17]=D),(0,P.useEffect)(T,D);let O;t[18]!==m||t[19]!==s||t[20]!==n?(O=(0,G.jsx)(`div`,{className:`font-mono font-semibold`,children:(0,G.jsx)(X,{run:n,hoveredCellId:s,hiddenInputElementId:m})}),t[18]=m,t[19]=s,t[20]=n,t[21]=O):O=t[21];let k=O,A=r===`sideBySide`?`-mt-0.5 col-start-2 row-start-1 row-span-2 min-w-0`:`min-w-0`,j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,G.jsx)(P.Suspense,{children:(0,G.jsx)(`div`,{ref:l})}),t[22]=j):j=t[22];let M;t[23]!==u||t[24]!==A?(M=(0,G.jsx)(`div`,{className:A,ref:u,children:j}),t[23]=u,t[24]=A,t[25]=M):M=t[25];let N=M;if(r===`above`){let e;return t[26]!==N||t[27]!==k?(e=(0,G.jsxs)(G.Fragment,{children:[N,k]}),t[26]=N,t[27]=k,t[28]=e):e=t[28],e}let I;return t[29]!==N||t[30]!==k?(I=(0,G.jsxs)(G.Fragment,{children:[k,N]}),t[29]=N,t[30]=k,t[31]=I):I=t[31],I},X=e=>{let t=(0,F.c)(12),{run:n,hoveredCellId:r,hiddenInputElementId:i}=e,a=(0,P.useRef)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{a.current&&(a.current.value=String(e),a.current.dispatchEvent(new Event(`input`,{bubbles:!0})))},t[0]=o):o=t[0];let s=o,c=r||``,l;t[1]!==i||t[2]!==c?(l=(0,G.jsx)(`input`,{type:`text`,id:i,defaultValue:c,hidden:!0,ref:a}),t[1]=i,t[2]=c,t[3]=l):l=t[3];let u;t[4]===n.cellRuns?u=t[5]:(u=[...n.cellRuns.values()],t[4]=n.cellRuns,t[5]=u);let d;t[6]!==r||t[7]!==u?(d=u.map(e=>(0,G.jsx)(Q,{cellRun:e,hovered:e.cellId===r,dispatchHoverEvent:s},e.cellId)),t[6]=r,t[7]=u,t[8]=d):d=t[8];let f;return t[9]!==l||t[10]!==d?(f=(0,G.jsxs)(`div`,{className:`text-xs mt-0.5 ml-3 flex flex-col gap-0.5`,children:[l,d]}),t[9]=l,t[10]=d,t[11]=f):f=t[11],f},Z={success:(0,G.jsx)(_,{color:`green`,size:14}),running:(0,G.jsx)(N,{color:`var(--blue-10)`,size:14}),error:(0,G.jsx)(s,{color:`red`,size:14}),queued:(0,G.jsx)(M,{color:`grey`,size:14})},Q=e=>{let t=(0,F.c)(39),{cellRun:n,hovered:r,dispatchHoverEvent:i}=e,a;t[0]===n.elapsedTime?a=t[1]:(a=n.elapsedTime?o(n.elapsedTime*1e3):`-`,t[0]=n.elapsedTime,t[1]=a);let s=a,l;t[2]!==n.elapsedTime||t[3]!==s?(l=n.elapsedTime?(0,G.jsxs)(`span`,{children:[`This cell took `,(0,G.jsx)(y,{elapsedTime:s}),` to run`]}):(0,G.jsx)(`span`,{children:`This cell has not been run`}),t[2]=n.elapsedTime,t[3]=s,t[4]=l):l=t[4];let d=l,p;t[5]!==n.cellId||t[6]!==i?(p=()=>{i(n.cellId)},t[5]=n.cellId,t[6]=i,t[7]=p):p=t[7];let m=p,h;t[8]===i?h=t[9]:(h=()=>{i(null)},t[8]=i,t[9]=h);let g=h,_=r&&`bg-(--gray-3) opacity-100`,v;t[10]===_?v=t[11]:(v=u(`flex flex-row gap-2 py-1 px-1 opacity-70 hover:bg-(--gray-3) hover:opacity-100`,_),t[10]=_,t[11]=v);let b;t[12]===n.startTime?b=t[13]:(b=c(n.startTime),t[12]=n.startTime,t[13]=b);let x;t[14]===b?x=t[15]:(x=(0,G.jsxs)(`span`,{className:`text-(--gray-10) dark:text-(--gray-11)`,children:[`[`,b,`]`]}),t[14]=b,t[15]=x);let C;t[16]===n.cellId?C=t[17]:(C=(0,G.jsxs)(`span`,{className:`text-(--gray-10) w-16 overflow-hidden`,children:[`(`,(0,G.jsx)(S,{cellId:n.cellId}),`)`]}),t[16]=n.cellId,t[17]=C);let w;t[18]===n.code?w=t[19]:(w=(0,G.jsx)(`span`,{className:`w-40 truncate -ml-1`,children:n.code}),t[18]=n.code,t[19]=w);let T;t[20]===s?T=t[21]:(T=(0,G.jsx)(`span`,{className:`text-(--gray-10) dark:text-(--gray-11)`,children:s}),t[20]=s,t[21]=T);let E;t[22]!==d||t[23]!==T?(E=(0,G.jsx)(f,{content:d,children:T}),t[22]=d,t[23]=T,t[24]=E):E=t[24];let D=Z[n.status],O;t[25]!==n.status||t[26]!==D?(O=(0,G.jsx)(f,{content:n.status,children:D}),t[25]=n.status,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==E||t[29]!==O?(k=(0,G.jsxs)(`div`,{className:`flex flex-row gap-1 w-16 justify-end -ml-2`,children:[E,O]}),t[28]=E,t[29]=O,t[30]=k):k=t[30];let A;return t[31]!==m||t[32]!==g||t[33]!==w||t[34]!==k||t[35]!==v||t[36]!==x||t[37]!==C?(A=(0,G.jsxs)(`div`,{className:v,onMouseEnter:m,onMouseLeave:g,children:[x,C,w,k]}),t[31]=m,t[32]=g,t[33]=w,t[34]=k,t[35]=v,t[36]=x,t[37]=C,t[38]=A):A=t[38],A};export{q as Tracing};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./useEvent-BDjgaBtz.js";import{t as i}from"./react-DVplv7_D.js";import{M as a,dr as o,q as s,so as c}from"./cells-B9RIIuYa.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{t as u}from"./cn-ldLVeaqm.js";import{t as d}from"./jsx-runtime-B74pBk57.js";import{t as f}from"./tooltip-B5lAA_jn.js";import{t as p}from"./createLucideIcon-DfJ2oMlA.js";import{o as m}from"./paths-bkIFVj8h.js";import{a as h}from"./useNumberFormatter-D7O_26UI.js";import{t as g}from"./chevron-right-eAtVhbNZ.js";import{t as _}from"./circle-check-BCurAHEb.js";import{r as v}from"./useTheme-C2dnh2vM.js";import{n as y}from"./CellStatus-B9hoYYSq.js";import{r as b,t as x}from"./react-vega-BTNeboR2.js";import{t as S}from"./cell-link-DBP_BcJY.js";import{n as C,r as w,t as T}from"./react-resizable-panels.browser.esm-Dbe0MrFr.js";import{t as E}from"./bundle.esm-D3tw5rqW.js";import{t as D}from"./empty-state-BaCKb7o3.js";import{r as O}from"./panel-context-C2QXpKfx.js";import{t as k}from"./clear-button-p6YcvzLy.js";import{n as A,t as j}from"./runs-C8uOPNAW.js";var M=p(`circle-ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M17 12h.01`,key:`1m0b6t`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M7 12h.01`,key:`eqddd0`}]]),N=p(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),P=e(i(),1),F=l(),I=`hoveredCellId`,L=`cellHover`,R=`cellNum`,z=`cell`,B=`startTimestamp`,V=`endTimestamp`,H=`status`;function U(e,t,n,r){let i=`hoursminutessecondsmilliseconds`;return{$schema:`https://vega.github.io/schema/vega-lite/v6.json`,background:r===`dark`?`black`:void 0,mark:{type:`bar`,cornerRadius:2},params:[{name:I,bind:{element:`#${t}`}},{name:L,select:{type:`point`,on:`mouseover`,fields:[z],clear:`mouseout`}}],height:{step:n===`sideBySide`?26:21},encoding:{y:{field:R,scale:{paddingInner:.2},sort:{field:`sortPriority`},title:`cell`,axis:n===`sideBySide`?null:void 0},x:{field:B,type:`temporal`,axis:{orient:`top`,title:null}},x2:{field:V,type:`temporal`},tooltip:[{field:B,type:`temporal`,timeUnit:i,title:`Start`},{field:V,type:`temporal`,timeUnit:i,title:`End`}],size:{value:{expr:`${I} == toString(datum.${z}) ? 19.5 : 18`}},color:{field:H,scale:{domain:[`success`,`error`],range:[`#37BE5F`,`red`]},legend:null}},data:{values:e},transform:[{calculate:`datum.${H} === 'queued' ? 9999999999999 : datum.${B}`,as:`sortPriority`}],config:{view:{stroke:`transparent`}}}}function W(e){try{let t=new Date(e*1e3);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}.${String(t.getMilliseconds()).padStart(3,`0`)}`}catch{return``}}var G=d(),K=t(new Map),q=()=>{let e=(0,F.c)(39),{runIds:t,runMap:r}=n(j),i=n(K),{clearRuns:a}=A(),{theme:o}=v(),[s,c]=(0,P.useState)(`above`),l=P.useId(),u=O(),d;e[0]===s?d=e[1]:(d=()=>{c(s===`above`?`sideBySide`:`above`)},e[0]=s,e[1]=d);let f=d;if(t.length===0){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(D,{title:`No traces`,description:(0,G.jsx)(`span`,{children:`Cells that have ran will appear here.`}),icon:(0,G.jsx)(m,{})}),e[2]=t):t=e[2],t}let p;e[3]===l?p=e[4]:(p=(0,G.jsx)(`label`,{htmlFor:l,className:`text-xs`,children:`Inline chart`}),e[3]=l,e[4]=p);let h=s===`sideBySide`,g;e[5]!==l||e[6]!==h||e[7]!==f?(g=(0,G.jsx)(`input`,{type:`checkbox`,id:l,name:`chartPosition`,"data-testid":`chartPosition`,onClick:f,defaultChecked:h,className:`h-3 cursor-pointer`}),e[5]=l,e[6]=h,e[7]=f,e[8]=g):g=e[8];let _;e[9]!==p||e[10]!==g?(_=(0,G.jsxs)(`div`,{className:`flex flex-row gap-1 items-center`,children:[p,g]}),e[9]=p,e[10]=g,e[11]=_):_=e[11];let y;e[12]===a?y=e[13]:(y=(0,G.jsx)(k,{dataTestId:`clear-traces-button`,onClick:a}),e[12]=a,e[13]=y);let b;e[14]!==_||e[15]!==y?(b=(0,G.jsxs)(`div`,{className:`flex flex-row justify-start gap-3`,children:[_,y]}),e[14]=_,e[15]=y,e[16]=b):b=e[16];let x;if(e[17]!==s||e[18]!==i||e[19]!==t||e[20]!==r||e[21]!==o){let n;e[23]!==s||e[24]!==i||e[25]!==r||e[26]!==o?(n=(e,t)=>{let n=r.get(e);return n?(0,G.jsx)(J,{run:n,isExpanded:i.get(n.runId),isMostRecentRun:t===0,chartPosition:s,theme:o},n.runId):null},e[23]=s,e[24]=i,e[25]=r,e[26]=o,e[27]=n):n=e[27],x=t.map(n),e[17]=s,e[18]=i,e[19]=t,e[20]=r,e[21]=o,e[22]=x}else x=e[22];let S;e[28]===x?S=e[29]:(S=(0,G.jsx)(`div`,{className:`flex flex-col gap-3`,children:x}),e[28]=x,e[29]=S);let E;e[30]!==b||e[31]!==S?(E=(0,G.jsxs)(`div`,{className:`py-1 px-2 overflow-y-scroll h-full`,children:[b,S]}),e[30]=b,e[31]=S,e[32]=E):E=e[32];let M=E;if(u===`sidebar`)return M;let N;e[33]===M?N=e[34]:(N=(0,G.jsx)(T,{defaultSize:50,minSize:30,maxSize:80,children:M}),e[33]=M,e[34]=N);let I;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,G.jsx)(w,{className:`w-1 bg-border hover:bg-primary/50 transition-colors`}),e[35]=I):I=e[35];let L;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,G.jsx)(T,{defaultSize:50,children:(0,G.jsx)(`div`,{})}),e[36]=L):L=e[36];let R;return e[37]===N?R=e[38]:(R=(0,G.jsxs)(C,{direction:`horizontal`,className:`h-full`,children:[N,I,L]}),e[37]=N,e[38]=R),R},J=e=>{let t=(0,F.c)(26),{run:n,isMostRecentRun:i,chartPosition:a,isExpanded:o,theme:c}=e,l=r(K),d=o??i,f;t[0]!==d||t[1]!==n.runId||t[2]!==l?(f=()=>{l(e=>{let t=new Map(e);return t.set(n.runId,!d),t})},t[0]=d,t[1]=n.runId,t[2]=l,t[3]=f):f=t[3];let p=f,m=d?h:g,_;t[4]===m?_=t[5]:(_=(0,G.jsx)(m,{height:16,className:`inline`}),t[4]=m,t[5]=_);let v=_,y;t[6]===n.runStartTime?y=t[7]:(y=s(n.runStartTime),t[6]=n.runStartTime,t[7]=y);let b;t[8]!==v||t[9]!==d||t[10]!==p||t[11]!==y?(b=(0,G.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`text-sm cursor-pointer`,onClick:p,children:[`Run - `,y,v]}),t[8]=v,t[9]=d,t[10]=p,t[11]=y,t[12]=b):b=t[12];let x=b,S=d&&a===`sideBySide`&&`grid-cols-[auto_minmax(0,1fr)] grid-rows-[auto_1fr]`,C;t[13]===S?C=t[14]:(C=u(`grid grid-cols-1`,S),t[13]=S,t[14]=C);let w;t[15]===x?w=t[16]:(w=(0,G.jsx)(`pre`,{className:`font-mono font-semibold`,children:x}),t[15]=x,t[16]=w);let T;t[17]!==a||t[18]!==d||t[19]!==n||t[20]!==c?(T=d&&(0,G.jsx)(Y,{run:n,chartPosition:a,theme:c}),t[17]=a,t[18]=d,t[19]=n,t[20]=c,t[21]=T):T=t[21];let E;return t[22]!==C||t[23]!==w||t[24]!==T?(E=(0,G.jsxs)(`div`,{className:C,children:[w,T]}),t[22]=C,t[23]=w,t[24]=T,t[25]=E):E=t[25],E},Y=e=>{let t=(0,F.c)(32),{run:n,chartPosition:r,theme:i}=e,[s,c]=(0,P.useState)(),l=(0,P.useRef)(null),{ref:u,width:d}=E(),f=d===void 0?300:d,p=a(),m,h;if(t[0]!==p||t[1]!==r||t[2]!==n.cellRuns||t[3]!==n.runId||t[4]!==i){let e=[...n.cellRuns.values()].map(e=>{let t=e.elapsedTime??0;return{cell:e.cellId,cellNum:p.inOrderIds.indexOf(e.cellId),startTimestamp:W(e.startTime),endTimestamp:W(e.startTime+t),elapsedTime:o(t*1e3),status:e.status}});m=`hiddenInputElement-${n.runId}`,h=b(U(e,m,r,i)),t[0]=p,t[1]=r,t[2]=n.cellRuns,t[3]=n.runId,t[4]=i,t[5]=m,t[6]=h}else m=t[5],h=t[6];let g=h.spec,_=i===`dark`?`dark`:void 0,v=f-50,y=r===`above`?120:100,S;t[7]!==_||t[8]!==v||t[9]!==y?(S={theme:_,width:v,height:y,actions:!1,mode:`vega`,renderer:`canvas`},t[7]=_,t[8]=v,t[9]=y,t[10]=S):S=t[10];let C;t[11]!==S||t[12]!==g?(C={ref:l,spec:g,options:S},t[11]=S,t[12]=g,t[13]=C):C=t[13];let w=x(C),T;t[14]===w?.view?T=t[15]:(T=()=>{let e=[{signalName:L,handler:(e,t)=>{let n=t.cell?.[0]??void 0;c(n??null)}}];return e.forEach(e=>{let{signalName:t,handler:n}=e;w?.view.addSignalListener(t,n)}),()=>{e.forEach(e=>{let{signalName:t,handler:n}=e;w?.view.removeSignalListener(t,n)})}},t[14]=w?.view,t[15]=T);let D;t[16]===w?D=t[17]:(D=[w],t[16]=w,t[17]=D),(0,P.useEffect)(T,D);let O;t[18]!==m||t[19]!==s||t[20]!==n?(O=(0,G.jsx)(`div`,{className:`font-mono font-semibold`,children:(0,G.jsx)(X,{run:n,hoveredCellId:s,hiddenInputElementId:m})}),t[18]=m,t[19]=s,t[20]=n,t[21]=O):O=t[21];let k=O,A=r===`sideBySide`?`-mt-0.5 col-start-2 row-start-1 row-span-2 min-w-0`:`min-w-0`,j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,G.jsx)(P.Suspense,{children:(0,G.jsx)(`div`,{ref:l})}),t[22]=j):j=t[22];let M;t[23]!==u||t[24]!==A?(M=(0,G.jsx)(`div`,{className:A,ref:u,children:j}),t[23]=u,t[24]=A,t[25]=M):M=t[25];let N=M;if(r===`above`){let e;return t[26]!==N||t[27]!==k?(e=(0,G.jsxs)(G.Fragment,{children:[N,k]}),t[26]=N,t[27]=k,t[28]=e):e=t[28],e}let I;return t[29]!==N||t[30]!==k?(I=(0,G.jsxs)(G.Fragment,{children:[k,N]}),t[29]=N,t[30]=k,t[31]=I):I=t[31],I},X=e=>{let t=(0,F.c)(12),{run:n,hoveredCellId:r,hiddenInputElementId:i}=e,a=(0,P.useRef)(null),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{a.current&&(a.current.value=String(e),a.current.dispatchEvent(new Event(`input`,{bubbles:!0})))},t[0]=o):o=t[0];let s=o,c=r||``,l;t[1]!==i||t[2]!==c?(l=(0,G.jsx)(`input`,{type:`text`,id:i,defaultValue:c,hidden:!0,ref:a}),t[1]=i,t[2]=c,t[3]=l):l=t[3];let u;t[4]===n.cellRuns?u=t[5]:(u=[...n.cellRuns.values()],t[4]=n.cellRuns,t[5]=u);let d;t[6]!==r||t[7]!==u?(d=u.map(e=>(0,G.jsx)(Q,{cellRun:e,hovered:e.cellId===r,dispatchHoverEvent:s},e.cellId)),t[6]=r,t[7]=u,t[8]=d):d=t[8];let f;return t[9]!==l||t[10]!==d?(f=(0,G.jsxs)(`div`,{className:`text-xs mt-0.5 ml-3 flex flex-col gap-0.5`,children:[l,d]}),t[9]=l,t[10]=d,t[11]=f):f=t[11],f},Z={success:(0,G.jsx)(_,{color:`green`,size:14}),running:(0,G.jsx)(N,{color:`var(--blue-10)`,size:14}),error:(0,G.jsx)(c,{color:`red`,size:14}),queued:(0,G.jsx)(M,{color:`grey`,size:14})},Q=e=>{let t=(0,F.c)(39),{cellRun:n,hovered:r,dispatchHoverEvent:i}=e,a;t[0]===n.elapsedTime?a=t[1]:(a=n.elapsedTime?o(n.elapsedTime*1e3):`-`,t[0]=n.elapsedTime,t[1]=a);let c=a,l;t[2]!==n.elapsedTime||t[3]!==c?(l=n.elapsedTime?(0,G.jsxs)(`span`,{children:[`This cell took `,(0,G.jsx)(y,{elapsedTime:c}),` to run`]}):(0,G.jsx)(`span`,{children:`This cell has not been run`}),t[2]=n.elapsedTime,t[3]=c,t[4]=l):l=t[4];let d=l,p;t[5]!==n.cellId||t[6]!==i?(p=()=>{i(n.cellId)},t[5]=n.cellId,t[6]=i,t[7]=p):p=t[7];let m=p,h;t[8]===i?h=t[9]:(h=()=>{i(null)},t[8]=i,t[9]=h);let g=h,_=r&&`bg-(--gray-3) opacity-100`,v;t[10]===_?v=t[11]:(v=u(`flex flex-row gap-2 py-1 px-1 opacity-70 hover:bg-(--gray-3) hover:opacity-100`,_),t[10]=_,t[11]=v);let b;t[12]===n.startTime?b=t[13]:(b=s(n.startTime),t[12]=n.startTime,t[13]=b);let x;t[14]===b?x=t[15]:(x=(0,G.jsxs)(`span`,{className:`text-(--gray-10) dark:text-(--gray-11)`,children:[`[`,b,`]`]}),t[14]=b,t[15]=x);let C;t[16]===n.cellId?C=t[17]:(C=(0,G.jsxs)(`span`,{className:`text-(--gray-10) w-16 overflow-hidden`,children:[`(`,(0,G.jsx)(S,{cellId:n.cellId}),`)`]}),t[16]=n.cellId,t[17]=C);let w;t[18]===n.code?w=t[19]:(w=(0,G.jsx)(`span`,{className:`w-40 truncate -ml-1`,children:n.code}),t[18]=n.code,t[19]=w);let T;t[20]===c?T=t[21]:(T=(0,G.jsx)(`span`,{className:`text-(--gray-10) dark:text-(--gray-11)`,children:c}),t[20]=c,t[21]=T);let E;t[22]!==d||t[23]!==T?(E=(0,G.jsx)(f,{content:d,children:T}),t[22]=d,t[23]=T,t[24]=E):E=t[24];let D=Z[n.status],O;t[25]!==n.status||t[26]!==D?(O=(0,G.jsx)(f,{content:n.status,children:D}),t[25]=n.status,t[26]=D,t[27]=O):O=t[27];let k;t[28]!==E||t[29]!==O?(k=(0,G.jsxs)(`div`,{className:`flex flex-row gap-1 w-16 justify-end -ml-2`,children:[E,O]}),t[28]=E,t[29]=O,t[30]=k):k=t[30];let A;return t[31]!==m||t[32]!==g||t[33]!==w||t[34]!==k||t[35]!==v||t[36]!==x||t[37]!==C?(A=(0,G.jsxs)(`div`,{className:v,onMouseEnter:m,onMouseLeave:g,children:[x,C,w,k]}),t[31]=m,t[32]=g,t[33]=w,t[34]=k,t[35]=v,t[36]=x,t[37]=C,t[38]=A):A=t[38],A};export{q as Tracing};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{t as n}from"./compiler-runtime-BrajqUja.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./spinner-DyNE-o8o.js";import{t as a}from"./preload-helper-uBIymjUX.js";var o=n(),s=e(t(),1),c=r(),l=s.lazy(()=>a(()=>import(`./tracing-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./tracing-CpbvZwxP.js","./rolldown-runtime-B0Z9INg1.js","./useEvent-BDjgaBtz.js","./react-DVplv7_D.js","./compiler-runtime-BrajqUja.js","./cells-B9RIIuYa.js","./react-dom-_LrxgvjW.js","./schemas-ChRqMOTL.js","./debounce-aFmHgJZY.js","./isObject-BCaOs5rp.js","./now-Cmx0b_zA.js","./isSymbol-oX0TOjjx.js","./config-CXnC3MRv.js","./_baseMerge-CQpUq7ep.js","./isArrayLikeObject-DnwgSs_Z.js","./useEventListener-DPOTkksd.js","./objects-rLPlQ3X_.js","./invariant-Ci2dTZ72.js","./utils-B4K466FK.js","./session-BHgGkjDm.js","./config-7IjqNuVp.js","./Deferred-CrTnjj37.js","./cn-ldLVeaqm.js","./clsx-DB0hHKMi.js","./jsx-runtime-B74pBk57.js","./fullscreen-D-ldV-19.js","./dist-gaK_BThd.js","./menu-items-yD7IV3V4.js","./use-restore-focus-DMSzeuUr.js","./circle-B0vOU-Dh.js","./createLucideIcon-DfJ2oMlA.js","./select-CgWQvW1F.js","./button-Cl7haVNh.js","./check-BQNapYaf.js","./useNumberFormatter-D7O_26UI.js","./I18nProvider-Cg2I_s1_.js","./toast-trUlkvx3.js","./tooltip-B5lAA_jn.js","./paths-bkIFVj8h.js","./useLifecycle-Mq4gc5kS.js","./toDate-DOj9Q6uC.js","./database-zap-B_PMVg8T.js","./write-secret-modal-BujVAO67.js","./alert-dialog-8YiYLrfr.js","./input-BQBy_25D.js","./numbers-BB-lSqeY.js","./once-6KNTRW0u.js","./arrays-0R2reF2y.js","./useDebounce-DwTQ_1Pu.js","./use-toast-Wu434mLr.js","./requests-BIFR-h4M.js","./uuid-k9DpjH68.js","./plus-C5silF6g.js","./trash-2-DcgaW8fn.js","./preload-helper-uBIymjUX.js","./dist-Cny7_yZb.js","./dist-DBMV4gqt.js","./capabilities-DcB-Dd0T.js","./cjs-C49f7GXV.js","./createReducer-B04CIO-e.js","./dist-qhAY4L2r.js","./marked.esm-B_3iMIUq.js","./strings-3lNX212T.js","./dist-BOfh4hMd.js","./badge-crT3E0Rm.js","./dist-LSsCJjA3.js","./dist-1tmpVXyz.js","./dist-DtH-7lot.js","./dist-BmExfiwX.js","./dist-DusFODSa.js","./stex-Dc5bKD4z.js","./useTheme-C2dnh2vM.js","./useAsyncData-qvoPYHtx.js","./purify.es--06brOip.js","./cells-0PFKL3SH.css","./chevron-right-eAtVhbNZ.js","./circle-check-BCurAHEb.js","./CellStatus-B9hoYYSq.js","./ban-YzvUro5I.js","./ellipsis-63DyBLHQ.js","./refresh-cw-Qw1f8Jhy.js","./workflow-cw-0b9g5.js","./useDateFormatter-DA-62E-Y.js","./en-US-Buu61juQ.js","./multi-icon-DL465pPF.js","./multi-icon-D129IBvu.css","./CellStatus-2Psjnl5F.css","./react-vega-BTNeboR2.js","./vega-loader.browser-Bu25TKax.js","./precisionRound-BxlUs8G4.js","./defaultLocale-CNPGWpMu.js","./defaultLocale-D5bOh7g6.js","./linear-Bma8J3iM.js","./init-ZlXS9mIS.js","./cubic-DELhj3Tx.js","./ordinal-BdBDtYTt.js","./time-DswSXBDk.js","./range-EplFIxc7.js","./path-BCdg30Y0.js","./math-Bi_r_ZWc.js","./arc-Yxk2k_uq.js","./array-BifhSqXX.js","./step-CqgdNM3U.js","./line-io_go0HI.js","./colors-Cg5Vh3br.js","./treemap-BfjIY-m6.js","./cell-link-DBP_BcJY.js","./react-resizable-panels.browser.esm-Dbe0MrFr.js","./bundle.esm-D3tw5rqW.js","./empty-state-BaCKb7o3.js","./panel-context-C2QXpKfx.js","./clear-button-p6YcvzLy.js","./runs-C8uOPNAW.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{t as n}from"./compiler-runtime-BrajqUja.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./spinner-DyNE-o8o.js";import{t as a}from"./preload-helper-uBIymjUX.js";var o=n(),s=e(t(),1),c=r(),l=s.lazy(()=>a(()=>import(`./tracing-CpbvZwxP.js`).then(e=>({default:e.Tracing})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112]),import.meta.url)),u=()=>{let e=(0,o.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(d,{}),children:(0,c.jsx)(l,{})}),e[0]=t):t=e[0],t},d=()=>{let e=(0,o.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,c.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full`,children:(0,c.jsx)(i,{})}),e[0]=t):t=e[0],t};export{u as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{io as n}from"./cells-B9RIIuYa.js";import{t as r}from"./compiler-runtime-BrajqUja.js";import{g as i}from"./useEventListener-DPOTkksd.js";import{t as a}from"./cn-ldLVeaqm.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{t as s}from"./tooltip-B5lAA_jn.js";import{t as c}from"./button-Cl7haVNh.js";import{t as l}from"./createLucideIcon-DfJ2oMlA.js";import{t as u}from"./chevron-right-eAtVhbNZ.js";import{n as d,t as f}from"./eye-off-CxVozGAC.js";import{t as p}from"./refresh-cw-Qw1f8Jhy.js";var m=l(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),h={keyBy(e,t){let n=new Map,r=new Set;for(let i of e){let e=t(i);n.has(e)&&r.add(e),n.set(e,i)}return r.size>0&&i.trace(`Duplicate keys: ${[...r].join(`, `)}`),n},collect(e,t,n){return h.mapValues(h.keyBy(e,t),n)},filterMap(e,t){let n=new Map;for(let[r,i]of e)t(i,r)&&n.set(r,i);return n},mapValues(e,t){let n=new Map;for(let[r,i]of e)n.set(r,t(i,r));return n}},g=r(),_=e(t(),1),v=o(),y=e=>{let t=(0,g.c)(5),{isExpanded:n,className:r}=e,i=n&&`rotate-90`,o;t[0]!==r||t[1]!==i?(o=a(`shrink-0 transition-transform`,i,r),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;return t[3]===o?s=t[4]:(s=(0,v.jsx)(u,{className:o}),t[3]=o,t[4]=s),s},b=({onClick:e,tooltip:t=`Refresh`,className:n,iconClassName:r})=>{let[i,o]=(0,_.useState)(!1),l=(0,v.jsx)(c,{variant:`text`,size:`xs`,className:n,onClick:async t=>{o(!0);let n=new Promise(e=>setTimeout(e,500));try{await Promise.all([e(t),n])}finally{o(!1)}},children:(0,v.jsx)(p,{className:a(`h-4 w-4`,r,i&&`animate-[spin_0.5s]`)})});return(0,v.jsx)(s,{content:t,children:l})},x=e=>{let t=(0,g.c)(15),{isVisible:r,onToggle:i,showTooltip:o,hideTooltip:l,size:u,className:d,iconClassName:p,"data-testid":m}=e,h=u===void 0?`xs`:u,_=r?n:f,y=r?l:o,b=r&&`text-primary`,x;t[0]!==p||t[1]!==b?(x=a(`h-4 w-4`,b,p),t[0]=p,t[1]=b,t[2]=x):x=t[2];let S;t[3]!==_||t[4]!==x?(S=(0,v.jsx)(_,{className:x}),t[3]=_,t[4]=x,t[5]=S):S=t[5];let C;t[6]!==d||t[7]!==m||t[8]!==i||t[9]!==h||t[10]!==S?(C=(0,v.jsx)(c,{"data-testid":m,variant:`text`,size:h,className:d,onClick:i,children:S}),t[6]=d,t[7]=m,t[8]=i,t[9]=h,t[10]=S,t[11]=C):C=t[11];let w;return t[12]!==y||t[13]!==C?(w=(0,v.jsx)(s,{content:y,children:C}),t[12]=y,t[13]=C,t[14]=w):w=t[14],w},S=_.forwardRef((e,t)=>{let n=(0,g.c)(15),r,i,o;n[0]===e?(r=n[1],i=n[2],o=n[3]):({className:r,iconClassName:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o);let s;n[4]===r?s=n[5]:(s=a(`mb-0 opacity-0 group-hover:opacity-100 transition-opacity`,r),n[4]=r,n[5]=s);let l;n[6]===i?l=n[7]:(l=a(`w-4 h-4`,i),n[6]=i,n[7]=l);let u;n[8]===l?u=n[9]:(u=(0,v.jsx)(d,{className:l}),n[8]=l,n[9]=u);let f;return n[10]!==o||n[11]!==t||n[12]!==s||n[13]!==u?(f=(0,v.jsx)(c,{ref:t,variant:`text`,tabIndex:-1,size:`xs`,className:s,"aria-label":`More options`,...o,children:u}),n[10]=o,n[11]=t,n[12]=s,n[13]=u,n[14]=f):f=n[14],f});S.displayName=`MoreActionsButton`;var C=`h-3.5 w-3.5 mr-2`;export{x as a,y as i,S as n,h as o,b as r,m as s,C as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e}from"./useEvent-BDjgaBtz.js";import{D as t,Rt as n,zt as r}from"./cells-
|
|
1
|
+
import{l as e}from"./useEvent-BDjgaBtz.js";import{D as t,Rt as n,zt as r}from"./cells-B9RIIuYa.js";import{t as i}from"./compiler-runtime-BrajqUja.js";import{s as a}from"./config-CXnC3MRv.js";var o=i();function s(){let i=(0,o.c)(4),s=e(a),c=n(),{createNewCell:l}=t(),u;return i[0]!==s||i[1]!==l||i[2]!==c?(u=e=>{e.includes(`alt`)&&r({autoInstantiate:s,createNewCell:l,fromCellId:c}),l({code:e,before:!1,cellId:c??`__end__`})},i[0]=s,i[1]=l,i[2]=c,i[3]=u):u=i[3],u}export{s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e,u as t}from"./useEvent-BDjgaBtz.js";import{Bt as ee,
|
|
1
|
+
import{l as e,u as t}from"./useEvent-BDjgaBtz.js";import{Bt as ee,D as te,Ja as ne,ao as re,co as n,ii as ie,io as ae,ri as oe,so as se,v as ce,vi as le,vt as r,wo as ue}from"./cells-B9RIIuYa.js";import{t as i}from"./compiler-runtime-BrajqUja.js";import{o as de,r as fe,s as pe}from"./config-CXnC3MRv.js";import{m as me}from"./session-BHgGkjDm.js";import{t as a}from"./jsx-runtime-B74pBk57.js";import{d as he}from"./select-CgWQvW1F.js";import{i as ge,p as _e}from"./download-BRqw2JzE.js";import{t as o}from"./createLucideIcon-DfJ2oMlA.js";import{i as ve}from"./paths-bkIFVj8h.js";import{a as ye,i as s}from"./useNumberFormatter-D7O_26UI.js";import{t as be}from"./chevron-right-eAtVhbNZ.js";import{t as xe}from"./code-xml-SQaZqvcO.js";import{t as Se}from"./eye-off-CxVozGAC.js";import{t as Ce}from"./image-wZvTj8WY.js";import{b as we}from"./write-secret-modal-BujVAO67.js";import{i as Te,t as Ee}from"./useDeleteCell-DYRsSrAa.js";import{Qt as De,Yt as Oe,tn as ke}from"./input-BQBy_25D.js";import{t as Ae}from"./trash-2-DcgaW8fn.js";import{n as je}from"./copy-74EjuZso.js";import{t as Me}from"./use-toast-Wu434mLr.js";import{r as Ne}from"./requests-BIFR-h4M.js";import{i as Pe}from"./useRunCells-Bl702L84.js";import{n as Fe}from"./state-B_SxQGvw.js";import{n as Ie,t as Le}from"./icons-CiZ_8zS-.js";import{n as c}from"./name-cell-input-BIpvW2kg.js";import{t as l}from"./multi-icon-DL465pPF.js";import{t as Re}from"./useSplitCell-DQRIXpFK.js";var u=o(`chevrons-down`,[[`path`,{d:`m7 6 5 5 5-5`,key:`1lc07p`}],[`path`,{d:`m7 13 5 5 5-5`,key:`1d48rs`}]]),d=o(`chevrons-up`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),f=o(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),p=o(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),ze=o(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),m=o(`zap-off`,[[`path`,{d:`M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317`,key:`193nxd`}],[`path`,{d:`M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773`,key:`27a7lr`}],[`path`,{d:`M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643`,key:`1e0qe9`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),h=o(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Be=i();function Ve(e){let t=new URL(window.location.href);return t.hash=`scrollTo=${encodeURIComponent(e)}`,t.toString()}function g(e){let t=e.match(/scrollTo=([^&]+)/)?.[1];return t?decodeURIComponent(t.split(`&`)[0]):null}function _(e){return e!==`_`&&!!(e&&e.trim().length>0)}var v=a();function y(i){let a=(0,Be.c)(47),{cell:o,closePopover:g}=i,{createNewCell:y,updateCellConfig:b,updateCellName:x,moveCell:S,sendToTop:C,sendToBottom:w,addColumnBreakpoint:T,clearCellOutput:E,markUntouched:D}=te(),O=Re(),k=Pe(o?.cellId),A=!e(ce),j=Ee(),{openModal:M}=we(),N=t(Fe),P=e(fe),F=e(pe),Ge=e(me),I=e(de),{saveCellConfig:L}=Ne();if(!o||Ge){let e;return a[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],a[0]=e):e=a[0],e}let{cellId:R,config:z,getEditorView:B,name:V,hasOutput:H,hasConsoleOutput:U,status:W}=o,G;a[1]!==R||a[2]!==z.disabled||a[3]!==L||a[4]!==b?(G=async()=>{let e={disabled:!z.disabled};await L({configs:{[R]:e}}),b({cellId:R,config:e})},a[1]=R,a[2]=z.disabled,a[3]=L,a[4]=b,a[5]=G):G=a[5];let K=G,q;a[6]!==R||a[7]!==z.hide_code||a[8]!==B||a[9]!==L||a[10]!==b?(q=async()=>{let e={hide_code:!z.hide_code};await L({configs:{[R]:e}}),b({cellId:R,config:e});let t=B();t&&(e.hide_code?t.contentDOM.blur():t.focus())},a[6]=R,a[7]=z.hide_code,a[8]=B,a[9]=L,a[10]=b,a[11]=q):q=a[11];let J=q,Y=R===ue,X;a[12]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,v.jsx)(Te,{size:13,strokeWidth:1.5}),a[12]=X):X=a[12];let Z=W===`running`||W===`queued`||W===`disabled-transitively`||z.disabled,Q;a[13]===k?Q=a[14]:(Q=()=>k(),a[13]=k,a[14]=Q);let $;return a[15]!==T||a[16]!==P||a[17]!==I||a[18]!==F||a[19]!==A||a[20]!==R||a[21]!==E||a[22]!==g||a[23]!==z.disabled||a[24]!==z.hide_code||a[25]!==y||a[26]!==j||a[27]!==B||a[28]!==U||a[29]!==H||a[30]!==Y||a[31]!==D||a[32]!==S||a[33]!==V||a[34]!==M||a[35]!==L||a[36]!==w||a[37]!==C||a[38]!==N||a[39]!==O||a[40]!==Z||a[41]!==Q||a[42]!==K||a[43]!==J||a[44]!==b||a[45]!==x?($=[[{icon:X,label:`Run cell`,hotkey:`cell.run`,hidden:Z,redundant:!0,handle:Q},{icon:(0,v.jsx)(ne,{size:13,strokeWidth:1.5}),label:`Refactor with AI`,hidden:!P,handle:()=>{N(e=>e?.cellId===R?null:{cellId:R})},hotkey:`cell.aiCompletion`},{icon:(0,v.jsx)(p,{size:13,strokeWidth:1.5}),label:`Split`,hotkey:`cell.splitCell`,handle:()=>O({cellId:R})},{icon:(0,v.jsx)(xe,{size:13,strokeWidth:1.5}),label:`Format`,hotkey:`cell.format`,handle:()=>{let e=B();e&&le({[R]:e})}},{icon:z.hide_code?(0,v.jsx)(ae,{size:13,strokeWidth:1.5}):(0,v.jsx)(Se,{size:13,strokeWidth:1.5}),label:z.hide_code?`Show code`:`Hide code`,handle:J,hotkey:`cell.hideCode`},{icon:z.disabled?(0,v.jsx)(m,{size:13,strokeWidth:1.5}):(0,v.jsx)(h,{size:13,strokeWidth:1.5}),label:z.disabled?`Enable execution`:`Disable execution`,handle:K,hidden:Y}],[{icon:(0,v.jsx)(Le,{}),label:`Convert to Markdown`,hotkey:`cell.viewAsMarkdown`,handle:async()=>{let e=B();e&&(ee({autoInstantiate:F,createNewCell:y}),r(e,{language:`markdown`,keepCodeAsIs:!1}),z.hide_code||(await L({configs:{[R]:{hide_code:!0}}}),b({cellId:R,config:{hide_code:!0}}),D({cellId:R})))},hidden:Y},oe(B())===`sql`?{icon:(0,v.jsx)(Ie,{}),label:`View as Python`,hotkey:`cell.viewAsSQL`,handle:()=>{let e=B();e&&ie(e,`python`,{force:!0})},hidden:Y}:{icon:(0,v.jsx)(ve,{size:13,strokeWidth:1.5}),label:`Convert to SQL`,hotkey:`cell.viewAsSQL`,handle:()=>{let e=B();e&&(ee({autoInstantiate:F,createNewCell:y}),r(e,{language:`sql`,keepCodeAsIs:!1}))},hidden:Y}],[{icon:(0,v.jsxs)(l,{children:[(0,v.jsx)(n,{size:13,strokeWidth:1.5}),(0,v.jsx)(s,{size:8,strokeWidth:2})]}),label:`Create cell above`,hotkey:`cell.createAbove`,handle:()=>y({cellId:R,before:!0}),hidden:Y,redundant:!0},{icon:(0,v.jsxs)(l,{children:[(0,v.jsx)(n,{size:13,strokeWidth:1.5}),(0,v.jsx)(ye,{size:8,strokeWidth:2})]}),label:`Create cell below`,hotkey:`cell.createBelow`,handle:()=>y({cellId:R,before:!1}),redundant:!0},{icon:(0,v.jsx)(s,{size:13,strokeWidth:1.5}),label:`Move cell up`,hotkey:`cell.moveUp`,handle:()=>S({cellId:R,before:!0}),hidden:Y},{icon:(0,v.jsx)(ye,{size:13,strokeWidth:1.5}),label:`Move cell down`,hotkey:`cell.moveDown`,handle:()=>S({cellId:R,before:!1}),hidden:Y},{icon:(0,v.jsx)(_e,{size:13,strokeWidth:1.5}),label:`Move cell left`,hotkey:`cell.moveLeft`,handle:()=>S({cellId:R,direction:`left`}),hidden:I!==`columns`||Y},{icon:(0,v.jsx)(be,{size:13,strokeWidth:1.5}),label:`Move cell right`,hotkey:`cell.moveRight`,handle:()=>S({cellId:R,direction:`right`}),hidden:I!==`columns`||Y},{icon:(0,v.jsx)(d,{size:13,strokeWidth:1.5}),label:`Send to top`,hotkey:`cell.sendToTop`,handle:()=>C({cellId:R,scroll:!1}),hidden:Y},{icon:(0,v.jsx)(u,{size:13,strokeWidth:1.5}),label:`Send to bottom`,hotkey:`cell.sendToBottom`,handle:()=>w({cellId:R,scroll:!1}),hidden:Y},{icon:(0,v.jsx)(re,{size:13,strokeWidth:1.5}),label:`Break into new column`,hotkey:`cell.addColumnBreakpoint`,handle:()=>T({cellId:R}),hidden:I!==`columns`||Y}],[{icon:(0,v.jsx)(Ce,{size:13,strokeWidth:1.5}),label:`Export output as PNG`,hidden:!H,handle:()=>ge(R,`result`)},{icon:(0,v.jsx)(se,{size:13,strokeWidth:1.5}),label:`Clear output`,hidden:!(H||U),handle:()=>{E({cellId:R})}}],[{icon:(0,v.jsx)(ze,{size:13,strokeWidth:1.5}),label:`Name`,disableClick:!0,handle:We,handleHeadless:()=>{M((0,v.jsxs)(Oe,{children:[(0,v.jsx)(De,{children:(0,v.jsx)(ke,{children:`Rename cell`})}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,v.jsx)(he,{htmlFor:`cell-name`,children:`Cell name`}),(0,v.jsx)(c,{placeholder:`cell name`,value:V,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.stopPropagation(),M(null))},onChange:e=>x({cellId:R,name:e})})]})]}))},rightElement:(0,v.jsx)(c,{placeholder:`cell name`,value:V,onChange:e=>x({cellId:R,name:e}),onEnterKey:()=>g?.()}),hidden:Y},{icon:(0,v.jsx)(f,{size:13,strokeWidth:1.5}),label:`Copy link to cell`,disabled:!_(V),tooltip:_(V)?void 0:`Only named cells can be linked to`,handle:async()=>{await je(Ve(V)),Me({description:`Link copied to clipboard`})}}],[{label:`Delete`,hidden:!A,variant:`danger`,icon:(0,v.jsx)(Ae,{size:13,strokeWidth:1.5}),handle:()=>{j({cellId:R})}}]].map(Ue).filter(He),a[15]=T,a[16]=P,a[17]=I,a[18]=F,a[19]=A,a[20]=R,a[21]=E,a[22]=g,a[23]=z.disabled,a[24]=z.hide_code,a[25]=y,a[26]=j,a[27]=B,a[28]=U,a[29]=H,a[30]=Y,a[31]=D,a[32]=S,a[33]=V,a[34]=M,a[35]=L,a[36]=w,a[37]=C,a[38]=N,a[39]=O,a[40]=Z,a[41]=Q,a[42]=K,a[43]=J,a[44]=b,a[45]=x,a[46]=$):$=a[46],$}function He(e){return e.length>0}function Ue(e){return e.filter(b)}function b(e){return!e.hidden}function We(e){e?.stopPropagation(),e?.preventDefault()}export{p as a,u as c,m as i,g as n,f as o,h as r,d as s,y as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,t}from"./useEvent-BDjgaBtz.js";import{D as n,b as r,v as i}from"./cells-
|
|
1
|
+
import{r as e,t}from"./useEvent-BDjgaBtz.js";import{D as n,b as r,v as i}from"./cells-B9RIIuYa.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{t as o}from"./useEventListener-DPOTkksd.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{t as c}from"./button-Cl7haVNh.js";import{t as l}from"./createLucideIcon-DfJ2oMlA.js";import{t as u}from"./use-toast-Wu434mLr.js";import{r as d}from"./requests-BIFR-h4M.js";import{n as f}from"./renderShortcut-Bxv9ZLnD.js";var p=l(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),m=a(),h=s(),g=e=>{let t=(0,m.c)(7),n;t[0]===e?n=t[1]:(n=t=>{(t.ctrlKey||t.metaKey)&&t.key===`z`&&(t.preventDefault(),t.stopPropagation(),e.onClick?.(t))},t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={capture:!0},t[2]=r):r=t[2],o(window,`keydown`,n,r);let i=e.children??`Undo`,a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,h.jsx)(f,{className:`ml-2`,shortcut:`cmd-z`}),t[3]=a):a=t[3];let s;return t[4]!==i||t[5]!==e?(s=(0,h.jsxs)(c,{"data-testid":`undo-button`,size:`sm`,variant:`outline`,...e,children:[i,` `,a]}),t[4]=i,t[5]=e,t[6]=s):s=t[6],s};function _(){let a=(0,m.c)(4),{deleteCell:o,undoDeleteCell:s}=n(),{sendDeleteCell:c}=d(),l;return a[0]!==o||a[1]!==c||a[2]!==s?(l=t=>{if(e.get(i))return;let{cellId:n}=t,a=(e.get(r).cellData[n]?.code??``).trim()===``;if(o({cellId:n}),c({cellId:n}).catch(()=>{s()}),!a){let{dismiss:e}=u({title:`Cell deleted`,description:`You can bring it back by clicking undo or through the command palette.`,action:(0,h.jsx)(g,{"data-testid":`undo-delete-button`,onClick:()=>{s(),t()}})}),t=e}},a[0]=o,a[1]=c,a[2]=s,a[3]=l):l=a[3],t(l)}function v(){let r=(0,m.c)(4),{deleteCell:a,undoDeleteCell:o}=n(),{sendDeleteCell:s}=d(),c;return r[0]!==a||r[1]!==s||r[2]!==o?(c=async t=>{if(e.get(i))return;let{cellIds:n}=t;for(let e of n)await s({cellId:e}).then(()=>{a({cellId:e})});let{dismiss:r}=u({title:`Cells deleted`,action:(0,h.jsx)(g,{"data-testid":`undo-delete-button`,onClick:()=>{for(let e of n)o();c()}})}),c=r},r[0]=a,r[1]=s,r[2]=o,r[3]=c):c=r[3],t(c)}export{p as i,v as n,g as r,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,t as i,u as a}from"./useEvent-BDjgaBtz.js";import{t as o}from"./react-DVplv7_D.js";import{Cn as s,Fn as c,K as ee,Pt as l,_n as u,cn as d,dn as f,fn as p,gn as m,hn as h,mn as g,un as _,yn as v}from"./cells-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,t as i,u as a}from"./useEvent-BDjgaBtz.js";import{t as o}from"./react-DVplv7_D.js";import{Cn as s,Fn as c,K as ee,Pt as l,_n as u,cn as d,dn as f,fn as p,gn as m,hn as h,mn as g,un as _,yn as v}from"./cells-B9RIIuYa.js";import{t as y}from"./compiler-runtime-BrajqUja.js";import{t as b}from"./cn-ldLVeaqm.js";import{t as x}from"./jsx-runtime-B74pBk57.js";import{t as te}from"./use-restore-focus-DMSzeuUr.js";import{a as ne,n as re,o as ie,t as ae}from"./tooltip-B5lAA_jn.js";import{t as oe}from"./useCellActionButton-BwBEO8zi.js";import{a as se,i as ce}from"./renderShortcut-Bxv9ZLnD.js";var S=y(),C=e(o(),1),w=x(),T=C.memo(C.forwardRef((e,t)=>{let n=(0,S.c)(39),{children:r,showTooltip:a,...o}=e,l=a===void 0||a,[y,x]=(0,C.useState)(!1),T;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>x(!1),n[0]=T):T=n[0];let E=T,D=(0,C.useRef)(null),j=oe({cell:o,closePopover:E}).map(O).filter(k),M=te(),N;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{ee(()=>{D.current&&D.current.scrollIntoView({behavior:`auto`,block:`nearest`})})},n[1]=N):N=n[1];let P=i(N),F;n[2]===P?F=n[3]:(F=e=>{x(t=>{let n=typeof e==`function`?e(t):e;return n&&P(),n})},n[2]=P,n[3]=F);let I=i(F),L;n[4]===I?L=n[5]:(L=()=>({toggle:()=>I(A)}),n[4]=I,n[5]=L),(0,C.useImperativeHandle)(t,L);let R=_,z=p,B=c(o.cellId),V;n[6]===B?V=n[7]:(V=(0,w.jsx)(m,{placeholder:`Search actions...`,className:`h-6 m-1`,...B}),n[6]=B,n[7]=V);let H=s,U;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,w.jsx)(g,{children:`No results`}),n[8]=U):U=n[8];let W=j.map((e,t)=>(0,w.jsxs)(C.Fragment,{children:[(0,w.jsx)(h,{children:e.map(e=>{let t=(0,w.jsxs)(`div`,{className:`flex items-center flex-1`,children:[e.icon&&(0,w.jsx)(`div`,{className:`mr-2 w-5 text-muted-foreground`,children:e.icon}),(0,w.jsx)(`div`,{className:`flex-1`,children:e.label}),(0,w.jsxs)(`div`,{className:`shrink-0 text-sm`,children:[e.hotkey&&ce(e.hotkey),e.rightElement]})]});return e.tooltip&&(t=(0,w.jsx)(ae,{content:e.tooltip,delayDuration:100,children:t})),(0,w.jsx)(u,{className:b(e.disabled&&`opacity-50!`),onSelect:()=>{e.disableClick||e.disabled||(e.handle(),x(!1))},variant:e.variant,children:t},e.label)})},t),t<j.length-1&&(0,w.jsx)(v,{})]},t)),G;n[9]!==H||n[10]!==U||n[11]!==W?(G=(0,w.jsxs)(H,{children:[U,W]}),n[9]=H,n[10]=U,n[11]=W,n[12]=G):G=n[12];let K;n[13]!==z||n[14]!==G||n[15]!==V?(K=(0,w.jsxs)(z,{children:[V,G]}),n[13]=z,n[14]=G,n[15]=V,n[16]=K):K=n[16];let q;n[17]!==R||n[18]!==M||n[19]!==K?(q=(0,w.jsx)(R,{className:`w-[300px] p-0 pt-1 overflow-auto`,scrollable:!0,...M,children:K}),n[17]=R,n[18]=M,n[19]=K,n[20]=q):q=n[20];let J=q;if(!l){let e;n[21]===r?e=n[22]:(e=(0,w.jsx)(f,{asChild:!0,children:r}),n[21]=r,n[22]=e);let t;return n[23]!==J||n[24]!==I||n[25]!==y||n[26]!==e?(t=(0,w.jsxs)(d,{open:y,onOpenChange:I,children:[e,J]}),n[23]=J,n[24]=I,n[25]=y,n[26]=e,n[27]=t):t=n[27],t}let Y;n[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,w.jsx)(re,{tabIndex:-1,children:se(`cell.cellActions`)}),n[28]=Y):Y=n[28];let X=!y&&Y,Z;n[29]===r?Z=n[30]:(Z=(0,w.jsx)(ie,{ref:D,children:(0,w.jsx)(f,{className:`flex`,children:r})}),n[29]=r,n[30]=Z);let Q;n[31]!==X||n[32]!==Z?(Q=(0,w.jsxs)(ne,{delayDuration:200,disableHoverableContent:!0,children:[X,Z]}),n[31]=X,n[32]=Z,n[33]=Q):Q=n[33];let $;return n[34]!==J||n[35]!==I||n[36]!==y||n[37]!==Q?($=(0,w.jsxs)(d,{open:y,onOpenChange:I,children:[Q,J]}),n[34]=J,n[35]=I,n[36]=y,n[37]=Q,n[38]=$):$=n[38],$})),E=C.memo(e=>{let t=(0,S.c)(5),{children:n,cellId:i}=e,a;t[0]===i?a=t[1]:(a=l(i),t[0]=i,t[1]=a);let o=r(a);if(!o)return null;let s;return t[2]!==n||t[3]!==o?(s=(0,w.jsx)(T,{showTooltip:!1,...o,children:n}),t[2]=n,t[3]=o,t[4]=s):s=t[4],s});E.displayName=`ConnectionCellActionsDropdown`;function D(e){return!e.redundant}function O(e){return e.filter(D)}function k(e){return e.length>0}function A(e){return!e}var j=n(`minimap`);function M(){let e=(0,S.c)(3),[n,r]=t(j),i;return e[0]!==n||e[1]!==r?(i={dependencyPanelTab:n,setDependencyPanelTab:r},e[0]=n,e[1]=r,e[2]=i):i=e[2],i}function N(){return a(j)}export{E as i,N as n,T as r,M as t};
|