@datalayer/agent-runtimes 1.3.103 → 1.3.105
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-embed/chunks/{AgentDetails-CO9iM59C.js → AgentDetails-eWkEnFI1.js} +1 -1
- package/dist-embed/chunks/{AgentDetailsDialog-DmD6xm6k.js → AgentDetailsDialog-BXJek5nf.js} +1 -1
- package/dist-embed/chunks/{AgentInspector-kDMuvh45.js → AgentInspector-B1wLMu4Z.js} +1 -1
- package/dist-embed/chunks/{AgentInspectorDialog-fT96Pb4Z.js → AgentInspectorDialog-DcLrhdWo.js} +1 -1
- package/dist-embed/chunks/Avatar-BrPfm89P.js +1 -0
- package/dist-embed/chunks/{CellSidebarExtension-B-vao30u.js → CellSidebarExtension-BWsHtuqs.js} +2 -2
- package/dist-embed/chunks/ChatView-ef0jot57.js +32 -0
- package/dist-embed/chunks/DatalayerAgentBridge-DvlGUOdE.js +1 -0
- package/dist-embed/chunks/{DeckComponent-Fp6Vw8vN.js → DeckComponent-BfOXdQhk.js} +1 -1
- package/dist-embed/chunks/{DocumentView-DKUbyyJg.js → DocumentView-DCgaQoOU.js} +1 -1
- package/dist-embed/chunks/{EphemeralDocument-CgYPEfGC.js → EphemeralDocument-DVAfnQWS.js} +1 -1
- package/dist-embed/chunks/{EphemeralNotebook-DvDbCKnr.js → EphemeralNotebook-C1ANS_1u.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawComponent-BehqBpwC.js → ExcalidrawComponent-0e3KqmKJ.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-B2sXbVJB.js → ExcalidrawModal-C5Or1sZ5.js} +1 -1
- package/dist-embed/chunks/{Flash-DdFxPtBI.js → Flash-C3nF3s4G.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-CUsjvchq.js → JupyterLexicalExtension-CEjN8cLT.js} +7 -7
- package/dist-embed/chunks/{KernelVariables-BUmOt4yF.js → KernelVariables-DyYN9sSS.js} +1 -1
- package/dist-embed/chunks/{NotebookSkeleton-D9WNoiWD.js → NotebookSkeleton-z8GKB7Tb.js} +1 -1
- package/dist-embed/chunks/{NotebookToolbar-C2_ZC9Ej.js → NotebookToolbar-Dv7QkxKA.js} +1 -1
- package/dist-embed/chunks/{NotebookView-BActuABH.js → NotebookView-CNHzc28A.js} +1 -1
- package/dist-embed/chunks/{SandboxDetailsDialog-C0afmOA7.js → SandboxDetailsDialog-D4HA7PZA.js} +1 -1
- package/dist-embed/chunks/{SchemaForm-B351kd79.js → SchemaForm-bWlj1cVy.js} +1 -1
- package/dist-embed/chunks/{Toolbar-B6ROXJ-2.js → Toolbar-BxAi9T92.js} +1 -1
- package/dist-embed/chunks/{YouTubePlugin-CqA-IwCx.js → YouTubePlugin-ZawlUPsx.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-DhQlC4AZ.js → ar-SA-G6X2FPQ2-DqE6ftcU.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-CDvJeI6H.js → az-AZ-76LH7QW2-8y_pqJhn.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-B_2t7dwS.js → bg-BG-XCXSNQG7-4NX5jouU.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-B7nTDj-4.js → bn-BD-2XOGV67Q-BB87_pS6.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-llJD_i9l.js → ca-ES-6MX7JW3Y-B9gyglRE.js} +1 -1
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-Cm_uiYT0.js → cs-CZ-2BRQDIVT-CmZhtHam.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-B0lo6-wZ.js → da-DK-5WZEPLOC-CU6rP6vm.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-DZrN-mJo.js → de-DE-XR44H4JA-wk6_Fx0e.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-C4D5ZbOc.js → el-GR-BZB4AONW-Cy5yeukb.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-D1yiS-ZI.js → es-ES-U4NZUMDT-Ccr3g95I.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4-Zm3lJsL6.js → eu-ES-A7QVB2H4-u0DKk40F.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-Dhv2lg_O.js → fa-IR-HGAKTJCU-BYSSU2Gx.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-QeFFEfyg.js → fi-FI-Z5N7JZ37-98vDI-0h.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-DjbRpOS6.js → fr-FR-RHASNOE6-D2BvErn0.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-C-ev9dqC.js → gl-ES-HMX3MZ6V-DP7FRXtT.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-DHoNpuA6.js → he-IL-6SHJWFNN-B92ZDKBK.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-JZJZPoWj.js → hi-IN-IWLTKZ5I-Dw2EhOq2.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-RzCikyBW.js → hu-HU-A5ZG7DT2-CVh5JW9n.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-Bn08nS9B.js → id-ID-SAP4L64H-CaKn7Yw0.js} +1 -1
- package/dist-embed/chunks/{index-DIHzcHI1.js → index-5Mm_lDnH.js} +1 -1
- package/dist-embed/chunks/{index-B1StFYI5.js → index-B46RcdCt.js} +1 -1
- package/dist-embed/chunks/{index-qzUKNibz.js → index-B6RMWdb4.js} +1 -1
- package/dist-embed/chunks/{index-88CEdMmU.js → index-BI_ojvKX.js} +1 -1
- package/dist-embed/chunks/{index-uutAM7NJ.js → index-BWxQD9cP.js} +1 -1
- package/dist-embed/chunks/{index-DCX_IqLg.js → index-B_WAs-60.js} +1 -1
- package/dist-embed/chunks/{index-BYofH50G.js → index-BaEB7wmN.js} +1 -1
- package/dist-embed/chunks/{index-C0iUgNwj.js → index-BmSB4k4X.js} +1 -1
- package/dist-embed/chunks/{index-KWzHwvvN.js → index-BsGIdntV.js} +4 -4
- package/dist-embed/chunks/{index-DgnVcOqG.js → index-BsP7mWx7.js} +1 -1
- package/dist-embed/chunks/{index-aX9x7qni.js → index-BzZvBTsd.js} +1 -1
- package/dist-embed/chunks/{index-BA2STD4N.js → index-C0ac25cM.js} +2 -2
- package/dist-embed/chunks/{index-DLk6Znxv.js → index-C0fJQ9v3.js} +1 -1
- package/dist-embed/chunks/{index-Bs1pVq7E.js → index-C0p6TrSH.js} +1 -1
- package/dist-embed/chunks/{index-DZN9JYOE.js → index-C9mAUugR.js} +1 -1
- package/dist-embed/chunks/{index-B1Egld01.js → index-CNBMan5A.js} +1 -1
- package/dist-embed/chunks/{index-1Ekpl0uC.js → index-CawAyW3R.js} +1 -1
- package/dist-embed/chunks/{index-DeYQGrTz.js → index-Cb-91zWU.js} +1 -1
- package/dist-embed/chunks/{index-B2dtLxcg.js → index-CkMGJGPw.js} +1 -1
- package/dist-embed/chunks/{index-Cqur_rhw.js → index-CsbfZWj5.js} +1 -1
- package/dist-embed/chunks/{index-DsX9nIHt.js → index-D1HhRyAi.js} +1 -1
- package/dist-embed/chunks/{index-C5xKtdLU.js → index-D3ml5vHy.js} +1 -1
- package/dist-embed/chunks/{index-CqKV027P.js → index-D7SzNRox.js} +1 -1
- package/dist-embed/chunks/{index-BUbwVG__.js → index-DAwoO3Uu.js} +1 -1
- package/dist-embed/chunks/{index-DHVYKZ44.js → index-DQaxtq0S.js} +1 -1
- package/dist-embed/chunks/{index-BbsUSk_Q.js → index-DbPtsB38.js} +1 -1
- package/dist-embed/chunks/{index-DJomc4za.js → index-DoYPeIKg.js} +1 -1
- package/dist-embed/chunks/{index-hqa_ODOD.js → index-Dr_NppDz.js} +1 -1
- package/dist-embed/chunks/{index-D7rnWGLu.js → index-DuDsMDnx.js} +3 -3
- package/dist-embed/chunks/{index-B5MiaXUV.js → index-IIxS-G5t.js} +1 -1
- package/dist-embed/chunks/{index-90Ss7516.js → index-W7nq_bBb.js} +1 -1
- package/dist-embed/chunks/{index-Cjx6uk6z.js → index-r_7Z9Uyr.js} +1 -1
- package/dist-embed/chunks/{index.esm-DlPZAW-m.js → index.esm-D5bfliIL.js} +1 -1
- package/dist-embed/chunks/{it-IT-JPQ66NNP-C2vJMuKM.js → it-IT-JPQ66NNP-CJGzhajv.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-C8KOKQt9.js → ja-JP-DBVTYXUO-Jm7LgxUu.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-CvxJbmMB.js → kaa-6HZHGXH3-DH21E_2q.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-CQJhf9Nn.js → kab-KAB-ZGHBKWFO-2Cx_3mmx.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-Dl6YC0GH.js → kk-KZ-P5N5QNE5-C2v01t5f.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-QYB-tJ4i.js → km-KH-HSX4SM5Z-WL_JAugw.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-D6yzBqJ5.js → ko-KR-MTYHY66A-DWjrj8WD.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-C43l2362.js → ku-TR-6OUDTVRD-CwTRLeeu.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-BG1v5NwF.js → lt-LT-XHIRWOB4-GVGjjS1d.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-CAwm1y_0.js → lv-LV-5QDEKY6T-C29ftTES.js} +1 -1
- package/dist-embed/chunks/{markdown-CH2i4TVR.js → markdown-Bf4-A1yl.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-DSk6q1fp.js → mr-IN-CRQNXWMA-Cyym_1yB.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-BRiKXulk.js → my-MM-5M5IBNSE-BOkGbWeI.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-CCDnctVd.js → nb-NO-T6EIAALU-BjaVTNUf.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-DwStD_Ch.js → nl-NL-IS3SIHDZ-DSVCFPQj.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-DNcfjETk.js → nn-NO-6E72VCQL-D5-_rRv0.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-BOjjS12P.js → oc-FR-POXYY2M6-CxKcn1R4.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-B4y5cv2_.js → pa-IN-N4M65BXN-D9r6O5PP.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-BpahO1D1.js → percentages-BXMCSKIN-917PkDRT.js} +3 -3
- package/dist-embed/chunks/{pl-PL-T2D74RX3-CfuLoYHB.js → pl-PL-T2D74RX3-CFXCTA5m.js} +1 -1
- package/dist-embed/chunks/{plugin-BMH63P5M.js → plugin-CA_0EWiO.js} +1 -1
- package/dist-embed/chunks/plugin-LDJjixuG.js +1 -0
- package/dist-embed/chunks/{pt-BR-5N22H2LF-Fk60PfdA.js → pt-BR-5N22H2LF-7A-3KOon.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-SNAgJ5Vr.js → pt-PT-UZXXM6DQ-BJLo5w79.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-YkxpKkWn.js → ro-RO-JPDTUUEW-DtvOR1_K.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-CaI1rtvc.js → ru-RU-B4JR7IUQ-CGQ0z7l6.js} +1 -1
- package/dist-embed/chunks/{sessions-ZDYLkdi_.js → sessions-By2lggFS.js} +2 -2
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-CQz29xmh.js → si-LK-N5RQ5JYF-D13wg56d.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-CZg7PVzd.js → sk-SK-C5VTKIMK-BqAZ0R3f.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-D-EjMWyZ.js → sl-SI-NN7IZMDC-BjPUGdws.js} +1 -1
- package/dist-embed/chunks/{standalone-oyxre9MX.js → standalone-DyCMuq_1.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-BIvvzzX2.js → subset-shared.chunk-D-GUkcCO.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-DGgI6iRY.js → subset-worker.chunk-Bz8aK3Nt.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-D8CsNMON.js → sv-SE-XGPEYMSR-DrXTnEWd.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-CvuxKO7t.js → ta-IN-2NMHFXQM-bK104VxM.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-NgQJigwq.js → th-TH-HPSO5L25-BSo6r7L4.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-eu9-qLmi.js → tr-TR-DEFEU3FU-pYKvN-ro.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-CbjmuLVL.js → uk-UA-QMV73CPH-DFR0z9gx.js} +1 -1
- package/dist-embed/chunks/{usePrimerThemeBridge-LgREOVgz.js → usePrimerThemeBridge-CuRRiOcg.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-u84yOuJ-.js → vi-VN-M7AON7JQ-BwMeNi1s.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-ojkSgl-t.js → zh-CN-LNUGB5OW-QC_JIHYo.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-C6M89-Da.js → zh-HK-E62DVLB3-BHs8J1Gl.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-BaTtFORh.js → zh-TW-RAJ6MFWO-DpqpYlIS.js} +1 -1
- package/dist-embed/datalayer-app-main.js +330 -59
- package/lib/apps/apps/AppBrowserSandbox.d.ts +7 -0
- package/lib/apps/apps/AppBrowserSandbox.js +52 -0
- package/lib/apps/apps/AppRenderer.js +11 -2
- package/lib/apps/apps/appspec.js +31 -0
- package/lib/apps/apps/browserSandbox.d.ts +69 -0
- package/lib/apps/apps/browserSandbox.js +159 -0
- package/lib/apps/apps/index.d.ts +2 -0
- package/lib/apps/apps/index.js +2 -0
- package/lib/apps/plugins/chat/ChatView.js +59 -7
- package/lib/components/inspector/a2aSpans.js +5 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/pap/index.d.ts +42 -0
- package/lib/pap/index.js +57 -0
- package/lib/specs/apps.js +345 -8
- package/lib/specs/appspecSchema.js +79 -0
- package/lib/types/agentspecs.d.ts +28 -0
- package/package.json +2 -1
- package/scripts/codegen/generate_apps.py +3 -2
- package/dist-embed/chunks/Avatar-Dqz3ZWjZ.js +0 -1
- package/dist-embed/chunks/ChatView-CubqJum2.js +0 -288
- package/dist-embed/chunks/DatalayerAgentBridge-BmJbZ2Lk.js +0 -1
- package/dist-embed/chunks/plugin-DZPXm2dP.js +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import{y as _,ft as eo,r as o,j as t,fu as to,fv as no,cg as mn,B as f,H as lt,T as W,c as G,cQ as Rt,fa as Lt,fw as ae,cL as ct,e as oo,fx as so,fy as ao,eJ as io,fz as ro,aP as lo,ez as En,ex as co,eA as Ft,fA as uo,fB as fo,fC as go,fD as po,fE as hn,fF as mo,fG as ho,fH as bo,du as xo,bd as So,fI as vo,fJ as yo,fK as Co,fL as wo,fM as ko,fN as jo,q as At,fO as Eo,fP as Io,fQ as To,fR as Ro,fS as Ao,fT as Po,fU as Mo,fV as $o,fW as Uo,fX as Oo,fY as Lo,fZ as Fo,f_ as zo,f$ as No,g0 as _o,g1 as Bo,g2 as Ho,g3 as Wo,g4 as Vo,g5 as De,g6 as Do,g7 as Go,g8 as Ko,g9 as Yo,ga as bn,gb as qo,gc as Ie,gd as Jo,ge as Qo,be as dt,gf as Xo,gg as Zo,gh as xn,gi as es,gj as ts,fi as ns,gk as Pt,gl as Te,gm as os,gn as ss,go as as,gp as is,gq as rs,gr as ls,gs as cs,gt as ds,gu as us,gv as fs,gw as gs,gx as ps,gy as Mt,gz as ms,gA as hs,I as bs,gB as xs,gC as Ss,gD as Sn,gE as vs,gF as ys,gG as Cs,gH as zt,gI as ws,gJ as ks,e$ as $t,gK as js,gL as Es}from"../datalayer-app-main.js";import{S as Is,E as Ts,a as Rs}from"./SignInIcon-4HkE48mS.js";import{F as As,a as Ps,b as Ms}from"./LinkedInGreyIcon-BoWXE-HS.js";function $s(){const n=_(eo);return o.useMemo(()=>n.map(s=>s.value),[n])}const Ut={github:{name:"github",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/github/callback"},google:{name:"google",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/google/callback"},linkedin:{name:"linkedin",oauth2CallbackServerRoute:"jupyter_iam/oauth2/callback",oauth2CallbackUIRoute:"/iam/oauth2/linkedin/callback"}},vn=()=>{if(typeof document>"u")return"";const n=document.getElementById("datalayer-config-data");if(!n?.textContent)return"";try{const s=JSON.parse(n.textContent);return String(s?.iamUrl||"").replace(/\/$/,"")}catch{return""}},Us=(n,s="Unable to start social sign-in.")=>{if(n instanceof Error&&n.message)return n.message;if(typeof n=="string"&&n.trim())return n;if(n&&typeof n=="object"&&"message"in n){const c=n.message;if(typeof c=="string"&&c.trim())return c}return s},Os=ro`
|
|
2
|
+
.signin-input-theme-scope input:-webkit-autofill,
|
|
3
|
+
.signin-input-theme-scope input:-webkit-autofill:hover,
|
|
4
|
+
.signin-input-theme-scope input:-webkit-autofill:focus,
|
|
5
|
+
.signin-input-theme-scope input:-webkit-autofill:active,
|
|
6
|
+
.signin-input-theme-scope input:-webkit-autofill:disabled,
|
|
7
|
+
.signin-input-theme-scope textarea:-webkit-autofill,
|
|
8
|
+
.signin-input-theme-scope textarea:-webkit-autofill:hover,
|
|
9
|
+
.signin-input-theme-scope textarea:-webkit-autofill:focus,
|
|
10
|
+
.signin-input-theme-scope textarea:-webkit-autofill:active,
|
|
11
|
+
.signin-input-theme-scope textarea:-webkit-autofill:disabled {
|
|
12
|
+
-webkit-text-fill-color: var(--fgColor-default) !important;
|
|
13
|
+
caret-color: var(--fgColor-default) !important;
|
|
14
|
+
-webkit-box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
15
|
+
box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
16
|
+
background-color: var(--bgColor-default) !important;
|
|
17
|
+
transition: background-color 9999s ease-in-out 0s !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.signin-input-theme-scope input:disabled,
|
|
21
|
+
.signin-input-theme-scope textarea:disabled {
|
|
22
|
+
-webkit-text-fill-color: var(--fgColor-muted) !important;
|
|
23
|
+
-webkit-box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
24
|
+
box-shadow: 0 0 0 1000px var(--bgColor-default) inset !important;
|
|
25
|
+
background-color: var(--bgColor-default) !important;
|
|
26
|
+
opacity: 1 !important;
|
|
27
|
+
}
|
|
28
|
+
`,Ls=({onSignIn:n,onApiKeySignIn:s,loginUrl:c,name:a,title:d="Datalayer OTEL",description:h="Sign in to access the observability dashboard.",icon:x,leadingIcon:C=t.jsx(io,{size:24}),github:g=!1,google:K=!1,linkedin:B=!1,apiKey:Ge=!1,signUp:L=!0,socialSignInNavigationTarget:Z,asDoc:S=!1,fillHeight:I=!0,hideHero:ee=!1,calloutTitle:Re,calloutDescription:Ke,passwordToggleLabel:ie="Sign in with a password",signUpTitle:Nt="Don't have an account?",signUpDescription:Y="Create a free Datalayer account with your email address.",signUpLabel:ut="Sign up with email",signUpHref:Ae="https://datalayer.ai/signup",onSignUp:H,forgotPasswordHref:q="/password",forgotPasswordLabel:Pe="Forgot password?",showForgotPassword:ft=!0,socialButtonMarginTop:v=3,actionButtonMaxWidth:J=320})=>{const te=S&&!ee,Ye=a??(S&&d==="Datalayer OTEL"?"Datalayer Sign In":d),gt=x??(S?t.jsx(Is,{size:24}):C),F=o.useMemo(()=>{if(c)return c;const i=vn();return i?`${i}/api/iam/v1/login`:"/api/iam/v1/login"},[c]),[V,Se]=o.useState(""),[re,pt]=o.useState(""),[qe,le]=o.useState(!1),[ce,Je]=o.useState(!1),[k,ve]=o.useState(!1),[de,Me]=o.useState(!1),[$e,Qe]=o.useState(null),[z,ye]=o.useState(null),[ne,Xe]=o.useState(""),[ue,Ze]=o.useState(null),[Ue,M]=o.useState(null),{enqueueToast:fe}=to(),[ge,E]=o.useState(!1),[Q,oe]=o.useState(""),D=o.useRef(null),Oe=o.useCallback(i=>no()?mn.URLExt.join(mn.PageConfig.getBaseUrl(),i.oauth2CallbackServerRoute):`${window.location.protocol}//${window.location.hostname}${window.location.port?`:${window.location.port}`:""}${i.oauth2CallbackUIRoute}`,[]),pe=o.useMemo(()=>{if(typeof window>"u")return"/";const i=`${window.location.pathname}${window.location.search}${window.location.hash}`;return i.startsWith("/")?i:"/"},[]),Ce=o.useCallback(async i=>{if(!de){M(null),Qe(i.name),Me(!0);try{const m=vn(),p=new URLSearchParams({provider:i.name,callback_uri:Oe(i)}),T=Z===void 0?void 0:String(Z||"").trim(),y=T===void 0?pe&&pe!=="/"?pe:void 0:T&&T.startsWith("/")&&!T.startsWith("//")?T:void 0;y&&p.set("post_auth_redirect",y);const Fe=`${m||""}/api/iam/v1/oauth2/authz/url?${p.toString()}`,j=await fetch(Fe),se=await j.json(),ze=se?.autorization_url;if(!j.ok||!ze)throw new Error(se?.message||"Unable to start social sign-in.");window.location.assign(ze)}catch(m){const p=Us(m);M(p),fe(p,{variant:"error"}),Qe(null),Me(!1)}}},[Oe,pe,fe,de,Z]);o.useEffect(()=>{ge&&D.current?.focus()},[ge]);const $=o.useCallback(()=>{E(!1),oe("")},[]),mt=o.useCallback(()=>{!Q.trim()||!s||(s(Q.trim()),$())},[Q,s,$]),ht=o.useCallback(()=>{if(H){H();return}window.location.assign(Ae)},[H,Ae]),bt=o.useCallback(()=>{if(q){if(q.startsWith("http://")||q.startsWith("https://")){window.open(q,"_blank","noopener,noreferrer");return}window.location.assign(q)}},[q]),Le=o.useCallback(async()=>{if(!(S||!V||!re||k)){ve(!0),M(null);try{const i=await fetch(F,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({handle:V,password:re})});if(!i.ok)throw new Error(`HTTP ${i.status}`);const m=await i.json();if(m.success&&m.token){const p=String(m?.user?.id||m?.user?.uid||"").trim();if(!!m?.user?.mfaUrl&&p){ye(p),Ze(m.token),M(null);return}n&&n(m.token,V)}else M(m.message||"Invalid username or password.")}catch(i){M(i instanceof Error?i.message:String(i))}finally{ve(!1)}}},[S,V,re,k,F,n]),me=o.useCallback(async()=>{if(!(S||k||!z||!ne.trim()||!ue)){ve(!0),M(null);try{const i=new URL(F,window.location.origin),m=i.pathname.endsWith("/api/iam/v1/login")?i.href.replace(/\/api\/iam\/v1\/login$/,""):`${i.origin}`,p=await fetch(`${m}/api/iam/v1/users/${z}/mfa/validate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userUid:z,code:ne.trim()})}),T=await p.json();if(!p.ok||!T?.success)throw new Error(T?.message||"Failed to validate your MFA code.");n&&n(ue,V)}catch(i){const m=i instanceof Error?i.message:String(i);M(m),fe(m,{variant:"error"})}finally{ve(!1)}}},[S,fe,V,k,F,ne,ue,z,n]),we=o.useCallback(i=>{i.key==="Enter"&&(z?me():Le())},[z,Le,me]),he=de||k||S;return t.jsxs(f,{className:"signin-input-theme-scope",display:"flex",alignItems:ee||te||!I?"flex-start":"center",justifyContent:"center",minHeight:ee||te||!I?"auto":"100vh",bg:ee?"transparent":"canvas.default",color:"fg.default",py:ee?0:te?2:4,children:[t.jsx(Os,{}),t.jsxs(f,{width:"100%",maxWidth:440,p:0,children:[!ee&&t.jsxs(t.Fragment,{children:[t.jsxs(f,{display:"flex",alignItems:"center",gap:2,mb:te?2:3,justifyContent:"center",children:[gt,t.jsx(lt,{sx:{fontSize:3},children:Ye})]}),t.jsx(W,{as:"p",sx:{fontSize:1,color:"fg.muted",mb:te?2:3,textAlign:"center"},children:h})]}),(Re||Ke)&&t.jsxs(f,{mb:3,textAlign:"center",children:[Re&&t.jsx(lt,{as:"h3",sx:{fontSize:2,mb:1},children:Re}),Ke&&t.jsx(W,{sx:{color:"fg.muted",fontSize:1},children:Ke})]}),!z&&(g||K||B)&&t.jsxs(t.Fragment,{children:[g&&t.jsx(G,{block:!0,size:"large",leadingVisual:$e==="github"?()=>t.jsx(Rt,{size:"small"}):As,disabled:he,onClick:()=>Ce(Ut.github),sx:{mt:v,maxWidth:J,mx:"auto"},children:"Sign in with GitHub"}),K&&t.jsx(G,{block:!0,size:"large",leadingVisual:$e==="google"?()=>t.jsx(Rt,{size:"small"}):Ps,disabled:he,onClick:()=>Ce(Ut.google),sx:{mt:v,maxWidth:J,mx:"auto"},children:"Sign in with Google"}),B&&t.jsx(G,{block:!0,size:"large",leadingVisual:$e==="linkedin"?()=>t.jsx(Rt,{size:"small"}):Ms,disabled:he,onClick:()=>Ce(Ut.linkedin),sx:{mt:v,maxWidth:J,mx:"auto"},children:"Sign in with LinkedIn"})]}),!z&&!qe&&t.jsx(f,{mt:3,display:"flex",justifyContent:"center",children:t.jsx(G,{leadingVisual:Lt,size:"large",block:!0,disabled:S||k||de,onClick:()=>le(!0),sx:{maxWidth:J,mx:"auto"},children:ie})}),!z&&qe&&t.jsxs(f,{mt:4,children:[t.jsxs(ae,{required:!0,sx:{mb:3},children:[t.jsx(ae.Label,{children:"Username"}),t.jsx(ct,{autoFocus:!0,block:!0,placeholder:"Your username",value:V,disabled:k||S,onChange:i=>Se(i.target.value),onKeyDown:we})]}),t.jsxs(ae,{required:!0,sx:{mb:3},children:[t.jsx(ae.Label,{children:"Password"}),t.jsx(ct,{block:!0,placeholder:"Your password",type:ce?"text":"password",value:re,disabled:k||S,onChange:i=>pt(i.target.value),onKeyDown:we,trailingAction:t.jsx(ct.Action,{onClick:()=>Je(!ce),disabled:k||S,icon:ce?Ts:Rs,"aria-label":ce?"Hide password":"Show password",sx:{color:"var(--fgColor-muted)"}})})]}),t.jsxs(f,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:3,children:[t.jsx(G,{variant:"primary",disabled:k||S||!V||!re,onClick:Le,children:k?"Signing in…":"Sign In"}),ft&&t.jsx(oo,{as:"button",sx:{fontSize:1,cursor:S?"not-allowed":"pointer",background:"none",border:"none",opacity:S?.6:1},onClick:()=>{S||k||bt()},children:Pe})]})]}),z&&t.jsxs(t.Fragment,{children:[t.jsxs(ae,{required:!0,sx:{mb:3,mt:2},children:[t.jsx(ae.Label,{children:"MFA Code"}),t.jsx(ct,{autoFocus:!0,block:!0,placeholder:"Your MFA code",value:ne,disabled:k||S,onChange:i=>Xe(i.target.value),onKeyDown:we})]}),t.jsx(G,{variant:"primary",block:!0,disabled:k||S||!ne.trim(),onClick:me,sx:{maxWidth:J,mx:"auto"},children:k?"Validating…":"Validate MFA Code"})]}),Ue&&t.jsx(W,{sx:{color:"danger.fg",fontSize:1,mt:3,display:"block"},children:Ue}),L&&t.jsxs(f,{mt:4,pt:4,textAlign:"center",borderTop:"1px solid",borderColor:"border.muted",children:[t.jsx(lt,{as:"h3",sx:{fontSize:2,mb:2},children:Nt}),t.jsx(W,{as:"p",sx:{color:"fg.muted",fontSize:1,mb:3},children:Y}),t.jsx(f,{display:"flex",justifyContent:"center",children:t.jsx(G,{variant:"primary",size:"large",leadingVisual:so,disabled:S||k,onClick:ht,children:ut})})]}),Ge&&s&&t.jsxs(t.Fragment,{children:[t.jsxs(f,{display:"flex",alignItems:"center",gap:2,my:3,children:[t.jsx(f,{flex:1,height:"1px",bg:"border.default"}),t.jsx(W,{sx:{fontSize:0,color:"fg.muted"},children:"or"}),t.jsx(f,{flex:1,height:"1px",bg:"border.default"})]}),t.jsx(G,{block:!0,leadingVisual:Lt,disabled:S||k||de,onClick:()=>E(!0),sx:{maxWidth:J,mx:"auto"},children:"Sign in with an API Key"}),ge&&t.jsx(f,{role:"dialog","aria-modal":"true","aria-labelledby":"signin-api-key-title",onKeyDown:i=>{i.key==="Escape"&&$()},onClick:$,position:"fixed",inset:0,zIndex:200,p:3,bg:"canvas.backdrop",display:"flex",alignItems:"center",justifyContent:"center",children:t.jsxs(f,{as:"form",onClick:i=>i.stopPropagation(),onSubmit:i=>{i.preventDefault(),mt()},width:"min(560px, 100%)",p:3,borderRadius:2,border:"1px solid",borderColor:"border.default",bg:"canvas.overlay",color:"fg.default",boxShadow:"shadow.large",children:[t.jsx(lt,{id:"signin-api-key-title",sx:{fontSize:2,mb:2},children:"Enter your API Key"}),t.jsxs(ae,{required:!0,children:[t.jsx(ae.Label,{children:"API Key"}),t.jsx(ao,{block:!0,required:!0,autoFocus:!0,placeholder:"Paste your API key here",value:Q,onInput:i=>oe(i.currentTarget.value),ref:D})]}),t.jsxs(f,{mt:3,display:"flex",justifyContent:"flex-end",gap:2,children:[t.jsx(G,{type:"button",onClick:$,children:"Cancel"}),t.jsx(G,{type:"submit",variant:"primary",disabled:!Q.trim(),children:"Authenticate"})]})]})})]})]})]})};function Fs(n){const{agentId:s,instructions:c,model:a,frontendTools:d,inference:h,subagents:x,sharing:C,onSubagentEvent:g,modeEffect:K}=n;return{type:"browser-vercel-ai",endpoint:"",agentId:s,enableConfigQuery:!1,options:{instructions:c,model:a,frontendTools:d,inference:h,subagents:x,sharing:C,onSubagentEvent:g,modeEffect:K}}}const yn=lo((n,s)=>({pending:void 0,suggest:(c,a)=>{const d=c.trim();d&&n({pending:{text:d,submit:a?.submit??!1,nonce:(s().pending?.nonce??0)+1}})},consume:()=>n({pending:void 0})}));function zs({agentName:n,sandboxStillRuns:s=!1,temporary:c=!0,onSignedIn:a,onSignUp:d}){const{configuration:h}=En(),x=o.useCallback(C=>{co.getState().checkIAMToken(C),a?.()},[a]);return t.jsx(f,{height:"100%",minHeight:0,overflowY:"auto",bg:"canvas.default",px:4,py:4,children:t.jsxs(f,{maxWidth:440,mx:"auto",children:[t.jsxs(f,{display:"flex",alignItems:"center",justifyContent:"center",gap:2,color:"attention.fg",mb:2,children:[t.jsx(Lt,{size:20}),t.jsx(W,{sx:{fontSize:2,fontWeight:"semibold",color:"fg.default"},children:c?"This demo runs on a shared key":"Your key has expired"})]}),t.jsxs(W,{as:"p",sx:{fontSize:1,color:"fg.muted",textAlign:"center",mb:3},children:[c?`${n??"The agent"} has used the time this key allows. Sign in to point your own agent at it, use your own data, and drop the time limit.`:`${n??"The agent"} stopped because your session ran out.`,s?" Your notebook is still running in this page.":""]}),t.jsx(Ls,{hideHero:!0,fillHeight:!1,calloutTitle:"Sign in to keep going",github:!0,google:!0,linkedin:!0,socialSignInNavigationTarget:typeof window>"u"?void 0:`${window.location.pathname}${window.location.search}`,loginUrl:h?.iamUrl?`${h.iamUrl}/api/iam/v1/login`:void 0,onSignIn:x,onSignUp:d})]})})}const Ns="https://r1.datalayer.run";function _s(n=!0){const{configuration:s}=En(),c=Ft(C=>C.token),a=s?.aiInferenceUrl||Ns,d=uo(a,n&&!c),h=c||d.token,x=o.useMemo(()=>({inferenceUrl:a,token:h||void 0}),[a,h]);return{inference:x,needsSignIn:fo(x),anonymous:d,inferenceUrl:a}}const Bs={name:"general-purpose",description:"A capable generalist for a task none of the specialists covers: research, reasoning, drafting, checking.",instructions:"You are a capable general-purpose assistant. Carry out the task you are given completely and report the result plainly, saying what you could not do."};function Cn(n){const s=n?.subagents;if(!s)return[];const c=(s.subagents??[]).map(a=>{const d=a.ref?go(a.ref):void 0;return{name:a.name,description:a.description||d?.description||a.name,instructions:a.instructions??d?.systemPrompt,model:a.model??d?.model??s.defaultModel,icon:d?.icon}});return s.includeGeneralPurpose?[...c,Bs]:c}function Hs(n){return n.replace(/^datalayer_/,"").replace(/_lexical$/,"")}function Ws(n){const s=Hs(n);return/^executeCodeIn(Notebook|Document)$/.test(s)||/^(read|list)[A-Z]/.test(s)}function Vs(n,s){return n.filter(c=>s?.has(c.name)||Ws(c.name))}function Ds(n,s){const c=a=>s&&a.value.id===`${s}-tools`?0:a.value.id==="notebook-tools"?1:2;return n.map((a,d)=>({entry:a,index:d,rank:c(a)})).sort((a,d)=>a.rank-d.rank||a.index-d.index).map(a=>a.entry)}function Gs(n,s,c){if(!c||!n.endsWith("-tools"))return!1;const a=n.slice(0,-6);return s.has(a)&&a!==c}const Ks={type:"object",properties:{}};function Ys(n,s){const c=new Set(n.toolset);return n.commands.filter(a=>c.has(a.name)).map(a=>({name:a.name,description:a.description,parameters:a.parameters??Ks,location:"frontend",handler:async d=>{if(!s)throw new Error(`${a.name}: the ${n.plugin??n.id} plugin is not mounted on this page.`);const h=Object.keys(d??{}).length>0?d:void 0,x=await s.executeCommand(a.command,h);return x===void 0?{ok:!0,command:a.command,argument:h}:x}}))}function qs(n,s){return n.flatMap(c=>Ys(c,s))}function Js(){const n=po(),s=$s();return o.useMemo(()=>qs(s,n),[s,n])}const wn={opening:"Opening your conversation…",notOpened:n=>`Your conversation could not be opened, so this is a new one: ${n}`};function Qs(n){let s;for(const c of n.split(/\r?\n\r?\n/)){const a=c.split(/\r?\n/).filter(d=>d.startsWith("data:")).map(d=>d.slice(5).trim()).join("");if(a)try{const d=JSON.parse(a);d.type==="MESSAGES_SNAPSHOT"&&Array.isArray(d.messages)&&(s=d.messages)}catch{}}return s}async function kn(n){try{const s=await n.json();if(typeof s.detail=="string"&&s.detail)return s.detail}catch{}return`${n.status}`}async function Xs({agentBaseUrl:n,agentId:s,uid:c,token:a,fetcher:d=fetch}){const h=`${n.replace(/\/+$/,"")}/api/v1/apps/sessions/${encodeURIComponent(c)}`,x=a?{Authorization:`Bearer ${a}`}:{},C=await d(`${h}/messages`,{headers:x});if(C.ok){const B=await C.json();return hn(B.messages)}if(C.status!==404)throw new Error(await kn(C));const g=await d(`${h}/resume`,{method:"POST",headers:{"Content-Type":"application/json",...x},body:JSON.stringify({agent:s})});if(!g.ok)throw new Error(await kn(g));const K=Qs(await g.text());if(!K)throw new Error(`The runtime said nothing of session ${c}.`);return hn(K)}const Zs="var(--theme-accent)";function In({face:n,size:s}){return typeof n=="string"?t.jsx(mo,{emoji:n,size:s,label:""}):t.jsx(t.Fragment,{children:n})}function ea({face:n,size:s,state:c}){const a=c==="thinking"||c==="working",d=c==="paused";return t.jsxs(f,{as:"span","aria-hidden":!0,"data-presence":c,position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:s+8,height:s+8,flexShrink:0,fontSize:s,lineHeight:1,children:[t.jsx(f,{as:"span",position:"absolute",inset:0,borderRadius:"50%",boxShadow:d?"none":`0 0 0 2px ${Zs}`,border:d?"2px dashed":"none",borderColor:"border.default",opacity:a||c==="waiting"||d?.9:0,transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",animation:a?"loopPresenceBreath 1.8s ease-in-out infinite":"none",reducedMotion:{animation:"none"},sx:{"@keyframes loopPresenceBreath":{"0%, 100%":{transform:"scale(0.92)",opacity:.35},"50%":{transform:"scale(1.06)",opacity:.9}}}}),t.jsx(f,{as:"span",display:"inline-flex",opacity:d?.55:1,filter:d?"grayscale(0.6)":"none",transition:"opacity var(--theme-motion-status, 0ms) var(--theme-motion-easing, ease)",children:t.jsx(In,{face:n,size:s})})]})}function ta({state:n}){return t.jsx(W,{role:"status","aria-live":"polite","data-presence-line":n,sx:{fontSize:0,color:n==="waiting"?"fg.default":"fg.muted",fontWeight:n==="waiting"?"semibold":"normal",whiteSpace:"nowrap",flexShrink:0},children:ho[n]})}const na=zt(void 0),oa=zt(""),sa=zt({}),X="",aa=1400,jn=parseInt(js["--loop-face-large"],10);function da({workspace:n}){const s=bo(),c=xo(),a=o.useRef(null),{setViewControls:d}=n,[h,x]=o.useState(null),C=So(),g=C.getConfig(vo),K=g?.placeholder||s.placeholder,B=g?.defaultSurface??"notebook",Ge=C.getConfig(yo),[L,Z]=o.useState(X),S=o.useRef(!1),I=_(Co),ee=_(wo),Re=_(ko),ie=_(jo)[0]?.value,Y=At(ie?.promptStance??na)??ie?.prompt,ut=_(Eo),Ae=Io(ut[0]?.value),H=o.useRef(Ae);H.current=Ae;const q=o.useRef(""),Pe=_(To),ft=o.useMemo(()=>Ro(()=>Pe.reduce((e,r)=>({...e,...r.value.extras.value}),{})),[Pe]),v=At(Pe.length>0?ft:sa),J=o.useRef(new Set),te=Ao(ws,n),Ye=!te.allowed,gt=Ye?te.reason??"Chat is unavailable for this sandbox":void 0,[F,V]=o.useState(!1),[Se,re]=o.useState(!1),[pt,qe]=o.useState({open:!1,pendingApproval:!1}),le=Po(F,pt,g?.presence?.paused===!0),ce=g?.presence?.onPresence;o.useEffect(()=>{ce?.(le),H.current?.setPresence(le)},[ce,le]);const Je=o.useRef(g?.presence?.onSaying);Je.current=g?.presence?.onSaying;const k=o.useRef({answering:!1}),ve=o.useCallback(e=>{a.current=e,re(!!e)},[]),de=o.useCallback(e=>{const{open:r,pendingApproval:l}=Mo(e);qe(xe=>xe.open===r&&xe.pendingApproval===l?xe:{open:r,pendingApproval:l});const b={saying:Uo(e),answering:$o(e)},u=k.current;(u.saying?.id!==b.saying?.id||u.saying?.text!==b.saying?.text||u.answering!==b.answering)&&(k.current=b,Je.current?.(b));const O=H.current;if(!O)return;O.items(e);const P=new Set(["complete","completed","done","error","failed","cancelled","canceled","rejected","denied","stopped"]),R={insertcell:"adding a cell",updatecell:"editing a cell",runcell:"running a cell",deletecells:"removing cells",readallcells:"reading the notebook",readcell:"reading a cell",executecode:"running code",insertblock:"adding a block",updateblock:"editing a block",runblock:"running a block",readdocument:"reading the document"};let w;for(let xe=e.length-1;xe>=0;xe-=1){const rt=e[xe];if(typeof rt.toolName=="string"&&rt.toolCallId){P.has(String(rt.status).toLowerCase())||(w=rt);break}}if(!w){O.activity(void 0);return}const Tt=w.toolName.toLowerCase().replace(/^datalayer_/,"").replace(/_lexical$/,"").replace(/[^a-z]/g,""),Zn=R[Tt]??`using ${w.toolName}`;O.activity(`${q.current||"The agent"} is ${Zn}…`)},[]),Me=o.useRef(v);Me.current=v;const $e=o.useCallback(e=>{Ln(e),H.current?.usage(e),Me.current.onUsage?.(e)},[]),Qe=o.useCallback(e=>{V(e),e||H.current?.end("done")},[]),z=o.useCallback(e=>{const r=H.current;if(!r)return;let l=-1;for(let u=e.length-1;u>=0;u-=1)if(e[u].role==="user"){l=u;break}const b=e.slice(l+1).filter(u=>u.role==="assistant").map(Oo).filter(u=>u.trim().length>0).join(`
|
|
29
|
+
|
|
30
|
+
`);r.assistant(b)},[]),ye=o.useRef([]),ne=o.useRef(!1),Xe=o.useRef(void 0),ue=o.useRef(void 0),Ze=_(Lo),Ue=o.useRef(Ze);Ue.current=Ze;const M=o.useCallback((e,r)=>{if(ue.current)return ue.current;const l=Fo(Ue.current.map(O=>O.value),r),b=l?.loop;if(ne.current&&b?.files&&b.files.length>0){const O=Xe.current;if(!O)return"A file is given to an application running on a runtime: run it on Datalayer or on your machine to give it one.";let P;try{P=b.files.map(R=>({file:No(String(R.name??"")),base64:zo(String(R.data_url??""))}))}catch(R){return R instanceof Error?R.message:String(R)}O.execute(_o(P)).then(R=>{if(!R.success){x(`The files could not be put in the sandbox: ${R.error??"it failed"}.`);return}M(`${e}
|
|
31
|
+
|
|
32
|
+
${Bo(P.map(w=>w.file))}`,{...l,loop:Object.fromEntries(Object.entries(b).filter(([w])=>w!=="files"))})});return}H.current?.begin(e,a.current?.thread());const u=a.current?.send;if(!u){ye.current.push([e,l]);return}u(e,l)},[]);o.useEffect(()=>{d(Se?{busy:F,stop:a.current?.stop,newChat:a.current?.newChat,send:M}:null)},[F,Se,d,M]),o.useEffect(()=>()=>d(null),[d]),o.useEffect(()=>n.prompts.subscribe(M),[n.prompts,M]),o.useEffect(()=>{if(!Se||ye.current.length===0)return;const e=ye.current.splice(0,ye.current.length);for(const[r,l]of e)a.current?.send(r,l)},[Se]);const fe=o.useRef(!1),ge=o.useCallback(async e=>{fe.current||(fe.current=!0,Ge?.firstPromptHook?.()),x(null);const r=await n.submit(e);if(!r.handled){x(r.reason??null);return}jt(""),r.result?.content&&x(r.result.content)},[n,Ge?.firstPromptHook]),E=o.useMemo(()=>I.find(e=>e.value.surfaceId===L)?.value,[I,L]),Q=o.useCallback(e=>{S.current=!0,Z(e)},[]);o.useEffect(()=>Ho(Q),[Q]),o.useEffect(()=>{Wo(I.map(e=>e.value.surfaceId))},[I]),o.useEffect(()=>{Vo(L&&L!==X?L:Es)},[L]);const oe=o.useMemo(()=>B===X||B==="none"?void 0:I.find(e=>e.value.surfaceId===B),[I,B]);o.useEffect(()=>{S.current||!oe||De(oe.value,n)&&Z(B)},[oe,n,B]);const[D,Oe]=o.useState(null),pe=o.useRef(null),Ce=g?.fullScreenTopOffset??0,{fullScreen:$,usingApi:mt,toggle:ht,topOffsetPx:bt}=Do(pe,{forceOverlay:!!Ce,topOffset:Ce}),[Le,me]=o.useState(!1),we=o.useRef(!1);o.useEffect(()=>{!F||we.current||$||(we.current=!0,me(!0))},[F,$]),o.useEffect(()=>{$&&me(!1)},[$]),o.useEffect(()=>{E&&!De(E,n)&&(Oe(E.surfaceId),Z(X))},[E,n]);const he=o.useMemo(()=>{if(D)return I.find(e=>e.value.surfaceId===D)?.value;if(!S.current&&L===X)return oe?.value},[I,D,L,oe]);o.useEffect(()=>{if(!D||L!==X)return;const e=I.find(r=>r.value.surfaceId===D);e&&De(e.value,n)&&(Oe(null),Z(D))},[I,L,D,n]);const i=n.agentId?.trim()||"default",m=Go(n.sandbox.target??"local");ne.current=m;const p=Ko(),T=At(p?.selected??oa),y=p?.members.find(e=>e.id===T),xt=_(Yo)[0]?.value,Fe=xt?.specId,j=bn(y?.specId??i)??(Fe?bn(Fe):void 0),se=y?void 0:xt,ze=m&&!y?Cs(Fe,j):void 0;q.current=y?.name??j?.name??i;const _t=_(qo),Bt=v.hiddenOpeners,Ht=v.hideOpeners,St=v.openers,vt=o.useMemo(()=>{if(Ht)return[];const e=new Set(Bt??[]),r=w=>e.size===0?w:w.filter(Tt=>!e.has(Tt.text));if(St)return r(St);const l=_t.flatMap(w=>w.value.suggestions);if(l.length>0)return r(l);const b=r(j?.suggestions??[]),u=r(p?.team.suggestions??[]);if(u.length===0)return b;const O=new Set(u.map(w=>w.text)),P=p?.team.name??"Team",R=y?.name??j?.name??i;return[...u.map(w=>({...w,group:P})),...b.filter(w=>!O.has(w.text)).map(w=>({...w,group:R}))]},[_t,p,j,y,i,Bt,Ht,St]),et=o.useMemo(()=>vt.map(e=>({title:e.summary??e.text,message:e.message??e.text,group:e.group})),[vt]),yt=Ie(j?.icon),N=g?.presence,Tn=Ie(p?.team.icon),Wt=_(Jo),tt=o.useMemo(()=>{const e=[],r=new Map,l=new Set,b=new Set(I.map(u=>u.value.surfaceId));for(const u of Ds(Wt,E?.surfaceId)){if(Gs(u.value.id,b,E?.surfaceId))continue;let O;try{O=u.value.tools(n)}catch(P){console.warn(`[loop] frontend tools from '${u.plugin}' failed:`,P);continue}for(const P of O){const R=r.get(P.name);if(R){console.warn(`[loop] frontend tool '${P.name}' from '${u.plugin}' is shadowed by the one from '${R}'.`);continue}r.set(P.name,u.plugin),e.push(P),u.value.chatView&&l.add(P.name)}}for(const u of v.frontendTools??[])r.has(u.name)||(r.set(u.name,"chat-extras"),e.push(u),l.add(u.name));return E?e:Vs(e,l)},[Wt,n.surfaceId,n.agentId,v.frontendTools,E?.surfaceId,I]),Ct=Js(),Ne=o.useMemo(()=>{if(Ct.length===0)return tt;const e=new Set(tt.map(r=>r.name));return[...tt,...Ct.filter(r=>!e.has(r.name))]},[tt,Ct]);Xe.current=m&&Ne.some(e=>e.name===Qo)?C.getOutput(dt)?.sandbox:void 0;const A=Xo(n.sandbox,n.serverUrl),Vt=_(Zo),Rn=o.useMemo(()=>Vt.filter(e=>e.value.composer).map(e=>({name:e.value.name,description:e.value.description})),[Vt]),An=o.useMemo(()=>{if(!p||!y)return Cn(j).map(l=>({name:l.name,description:l.description,icon:Ie(l.icon)}));const e=p.members.map(l=>({name:l.name,description:l.description,emoji:l.emoji,icon:Ie(l.icon),disabled:l.id===y.id,disabledReason:l.id===y.id?`You are already talking to ${l.name}`:void 0})),r=xn(p.team,y.id).filter(l=>!p.members.some(b=>b.name===l.name)).map(l=>({name:l.name,description:l.description,icon:Ie(l.icon)}));return[...e,...r]},[p,y,j]),{inference:Dt,anonymous:Pn}=_s(m),Mn=Ft(e=>e.user),wt=m&&Pn.status==="expired",Gt=!Mn,_e=es();ue.current=_e.disabled?_e.disableReason||"This conversation is closed here.":void 0;const kt=A===void 0?ts(n.sandbox,s):void 0,nt=Ye||wt||!!ze||!!kt||_e.disabled,Kt=wt?Gt?s.demoKeyExpired:s.keyExpired:ze??kt??gt??(_e.disabled?_e.disableReason:void 0),[Yt,jt]=o.useState(""),[$n,qt]=o.useState(),ot=$n??se?.model??j?.model??n.model??"",ke=ns(),Jt=o.useRef(ke),Qt=o.useRef(T),Xt=o.useRef(ke);Xt.current=ke,o.useEffect(()=>{Qt.current!==T&&(Qt.current=T,Jt.current=Xt.current,qt(void 0))},[T]);const Un=ke&&ke!==Jt.current?ke:null,[On,Ln]=o.useState(),Fn=Un??On??null,zn=Pt(Te.inpromptMenu),Nn=Pt(Te.promptAction),_n=Pt(Te.chatHeader),Bn=o.useMemo(()=>p?.members.map(e=>({id:e.id,name:e.name,description:e.description,icon:Ie(e.icon)}))??[],[p]),be=yn(e=>e.pending),[Zt,Hn]=o.useState(0);o.useEffect(()=>os(()=>Hn(e=>e+1)),[]),o.useEffect(()=>{be&&(jt(be.text),yn.getState().consume(),be.submit&&ge(be.text))},[be]);const Be=!!(se?.createPayload?.app_spec||C.getConfig(dt)?.datalayerCreatePayload?.app_spec),Wn=Ft(e=>e.token),en=C.getConfig(dt)?.datalayerVisitors,Vn=ss(en),Dn=C.getConfig(dt)?.embedToken,He=en?Vn.token:Dn||Wn,U=g?.thread,[je,tn]=o.useState(null),Gn=!!(U?.fromRuntime&&je?.given!==U.id);o.useEffect(()=>{if(!U?.fromRuntime||!Be||!A)return;let e=!0;return(async()=>{let r="";for(let l=0;l<4&&e;l+=1)try{const b=await Xs({agentBaseUrl:A,agentId:i,uid:U.id,token:He});e&&tn({given:U.id,thread:{...U,fromRuntime:!1,messages:b}});return}catch(b){r=b instanceof Error?b.message:String(b),await new Promise(u=>setTimeout(u,1500))}e&&tn({given:U.id,thread:{id:as(),messages:[],onStarted:U.onStarted},said:wn.notOpened(r)})})(),()=>{e=!1}},[U?.id,U?.fromRuntime,Be,A,i,He]);const nn=U?.fromRuntime?je?.given===U.id?je.thread:void 0:U,Et=o.useMemo(()=>m?Fs({agentId:y?.specId??i,instructions:is(j,se?.instructions),model:ot||void 0,inference:Dt,frontendTools:Ne,subagents:p&&y?xn(p.team,y.id):Cn(j),sharing:p?.sharing,onSubagentEvent:e=>ks.getState().appendSubagentEvent(e),modeEffect:se?.modeEffect}):A!==void 0?{type:"ag-ui",endpoint:Be?`${A}/api/v1/apps/agents/${encodeURIComponent(i)}/ag-ui/`:`${A}/api/v1/ag-ui/${i}/`,...Be&&He?{authToken:He}:{},agentId:i,configEndpoint:`${A}/api/v1/configure`,enableConfigQuery:!0}:void 0,[i,m,Dt,y,Ne,p,j,se,ot,A,Be,He]),st=rs(!m,Et?.type==="ag-ui"?Et.configEndpoint:void 0,void 0,i),We=ls(),at=cs(i),[on,sn]=o.useState(void 0),[Kn,Yn]=o.useState(void 0);o.useEffect(()=>{if(m||A===void 0)return;let e=!1;return fetch(`${A}/api/v1/configure/models?agent_id=${encodeURIComponent(i)}`).then(r=>r.ok?r.json():null).then(r=>{e||(sn(r?ds(r):[]),Yn(r?us(r):void 0))}).catch(()=>{e||sn([])}),()=>{e=!0}},[A,i,m]);const qn=o.useMemo(()=>fs(on,()=>Object.values(gs).filter(e=>e.available&&ps(e)).map(e=>({id:e.id,name:e.name,provider:e.provider}))),[on]),an=o.useMemo(()=>{const e=st.data?.builtinTools??[],r=new Set(e.map(l=>l.name));return{runtime:e,frontend:Ne.filter(l=>!r.has(l.name)).map(l=>({id:l.name,name:l.name}))}},[st.data?.builtinTools,Ne]),rn=o.useMemo(()=>new Set((We.data?.skills??[]).filter(e=>e.status==="enabled"||e.status==="loaded").map(e=>e.id)),[We.data]),Jn=o.useCallback(async e=>{qt(e),!(m||A===void 0)&&await fetch(`${A}/api/v1/configure/inference/provider`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({model:e})}).catch(()=>{})},[A,m]),ln=g?.promptPlacement==="bottom-chat",Qn=g?.promptPlacement==="floating",Ee=g?.promptPlacement==="top",Ve=g?.hidePrompt===!0||v.hidePrompt===!0,Xn={onSend:()=>{ge(Yt)},input:Yt,setInput:jt,focusTrigger:be||Zt?(be?.nonce??0)+Zt:void 0,placement:Qn||Y==="floating"||Y==="floating-top"||Y==="floating-bottom"?"floating":"docked",floatingAnchor:Y==="floating-top"?"top":"bottom",isLoading:F,onStop:()=>n.viewControls.stop?.(),placeholder:Kt??K,typingSuggestions:vt.map(e=>e.text),suggestions:et,disableInputPrompt:nt,connectionConfirmed:!nt,padding:Ee||Y==="floating-top"||Y==="floating-bottom"||Y==="docked-top"?2:3,promptVariant:"lexical",autoFocus:g?.autoFocusPrompt??!0,mentionableAgents:An,promptCommands:Rn,headerContent:zn.length>0?t.jsx(Mt,{slot:Te.inpromptMenu,props:{workspace:n}}):void 0,footerExtras:Nn.length>0?t.jsx(Mt,{slot:Te.promptAction,props:{workspace:n}}):void 0,showAgentsMenu:!N,showInlineAgentsMenu:!1,agents:Bn,selectedAgentId:T,onSelectAgent:e=>p?.select(e),showTokenUsage:v.showTokenUsage??g?.showTokenUsage??!0,showContextRing:!0,agentUsage:Fn??void 0,showModelSelector:!N,models:qn,decisions:Kn,selectedModel:ot,onModelSelect:e=>{Jn(e)},showToolsMenu:!N,availableTools:an.runtime,availableFrontendTools:an.frontend,mcpServers:st.data?.mcpServers??[],mcpStatusData:v.mcpStatusData??void 0,showSkillsMenu:!N,skills:We.data?.skills??[],skillsLoading:We.isLoading,enabledSkills:rn,onToggleSkill:e=>rn.has(e)?at.disableSkill(e):at.enableSkill(e),onToggleAllSkills:(e,r)=>e.forEach(l=>r?at.enableSkill(l):at.disableSkill(l)),codemodeEnabled:v.codemodeEnabled??!1,onToggleCodemode:v.onToggleCodemode,isA2AProtocol:!1,hasConfigData:!!st.data,hasSkillsData:!!We.data},cn=ee[0]?.value.Component,It=Re[0]?.value.Component,it=cn?t.jsx(cn,{workspace:n,composer:Xn}):null,dn=I.length>0&&g?.showSurfaceSelector!==!1?t.jsx(ia,{surfaces:I.map(e=>e.value),active:E?.surfaceId??he?.surfaceId??X,onChange:Q,workspace:n}):null,un=t.jsxs(t.Fragment,{children:[I.map(e=>{const r=e.value,l=E?.surfaceId===r.surfaceId;return l||J.current.has(r.surfaceId)||De(r,n)?(J.current.add(r.surfaceId),t.jsx(f,{sx:l?{flex:"1 1 0",minWidth:0,minHeight:0}:{position:"absolute",inset:0,visibility:"hidden",pointerEvents:"none",zIndex:-1},children:t.jsx(ms,{load:r.load,props:{surfaceId:r.surfaceId,workspace:n},fallback:t.jsxs(Ot,{children:["Loading ",r.title,"…"]}),errorFallback:u=>t.jsxs(Ot,{children:[r.title," failed to load: ",u.message]})})},r.surfaceId)):null}),!E&&he?t.jsx(f,{flex:"1 1 0",minWidth:0,minHeight:0,children:t.jsxs(Ot,{children:["Starting ",he.title,"…"]})}):null]}),fn=t.jsx(t.Fragment,{children:t.jsxs(f,{flex:Ee&&E?"0 0 34%":"1 1 0",maxWidth:Ee&&E?460:void 0,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",borderLeft:E?"1px solid":void 0,borderColor:"border.default",position:"relative",children:[v.errorBanner?t.jsx(f,{flexShrink:0,px:3,py:2,fontSize:1,borderBottom:"1px solid",bg:v.errorBanner.variant==="warning"?"attention.subtle":"danger.subtle",color:v.errorBanner.variant==="warning"?"attention.fg":"danger.fg",borderColor:v.errorBanner.variant==="warning"?"attention.muted":"danger.muted",children:v.errorBanner.message}):null,je?.said&&je.given===U?.id?t.jsx(W,{as:"p",role:"status",sx:{m:0,px:3,py:2,fontSize:1,color:"fg.muted"},children:je.said}):null,t.jsx(f,{flex:"1 1 auto",minHeight:0,display:"flex",children:Gn?t.jsx(W,{as:"p",role:"status",sx:{m:0,p:3,fontSize:1,color:"fg.muted"},children:wn.opening}):t.jsx(hs,{themeVariant:g?.themeVariant,themeOverrides:g?.themeOverrides,colorMode:g?.colorMode,thread:nn,disabled:nt,disableReason:Kt,protocol:Et,frontendTools:m?void 0:v.frontendTools,initialModel:ot||void 0,title:N?.name??y?.name??j?.name??i,description:N?.welcome??j?.description,brandIcon:N?.face?t.jsx(ea,{face:N.face,size:20,state:le}):t.jsx(yt,{size:20}),headerContent:N&&!kt?t.jsx(ta,{state:le}):void 0,emptyState:{icon:N?.face?t.jsx("span",{"aria-hidden":!0,style:{fontSize:jn,lineHeight:1},children:t.jsx(In,{face:N.face,size:jn})}):t.jsx(yt,{size:48}),title:N?.name??y?.name??j?.name??i,...p&&y?{sections:[{group:p.team.name,icon:t.jsx(Tn,{size:48}),title:p.team.name,subtitle:p.team.description},{group:y.name,icon:t.jsx(yt,{size:32}),title:y.name,subtitle:j?.description}]}:null},suggestions:Ee||ie||g?.suggestionLabels===!1?[]:et,showHeader:!g?.hideHeader&&!!It,headerButtons:{showNewChat:g?.headerButtons?.newChat??!1,showClear:g?.headerButtons?.clear??!1},renderHeader:It?e=>t.jsx(It,{workspace:n,header:e}):void 0,showInformation:!0,headerActions:t.jsxs(f,{display:"inline-flex",alignItems:"center",gap:2,children:[n.chatHeaderActions,_n.length>0?t.jsx(Mt,{slot:Te.chatHeader,props:{workspace:n}}):null,t.jsx(bs,{icon:$?xs:Ss,"aria-label":$?"Exit full screen":"Enter full screen",variant:"invisible",size:"small",onClick:()=>{me(!1),ht()},sx:Le?{"@keyframes dla-fullscreen-hint":{"0%, 100%":{opacity:1},"50%":{opacity:.4}},"&&":{bg:`color-mix(in srgb, ${c.primary} 16%, transparent)`,boxShadow:`inset 0 0 0 1.5px ${c.primary}`,animation:`dla-fullscreen-hint ${aa}ms ease-in-out infinite`},"@media (prefers-reduced-motion: reduce)":{"&&":{animation:"none"}}}:void 0})]}),showInput:!1,onSendReady:ve,notebookToolSurfacesId:E?void 0:n.surfaceId,renderToolResult:v.renderToolResult,showTurnFooter:v.showTokenUsage??g?.showTokenUsage??!0,onContextSnapshot:$e,onLoadingChange:Qe,onItemsChange:z,onDisplayItemsChange:de,enableStreaming:!0},nn?.id)}),ln&&!Ve?it:null]})}),gn=g?.suggestionLabels!==!1&&et.length>0?t.jsx(f,{"aria-label":s.suggestedPrompts,display:"flex",flexWrap:"wrap",gap:2,px:2,pb:"6px",children:et.map(e=>t.jsx(f,{as:"button",type:"button",title:e.message,disabled:F||nt,onClick:()=>{ge(e.message)},appearance:"none",font:"inherit",fontSize:0,fontWeight:"semibold",lineHeight:1.25,px:"10px",py:"5px",width:Sn,flex:`0 0 ${Sn}px`,borderRadius:"999px",border:"1px solid",bg:"canvas.subtle",whiteSpace:"nowrap",sx:{borderColor:"border.default",color:"fg.default",cursor:"pointer","&:hover:not(:disabled)":{borderColor:"accent.fg",color:"accent.fg"},"&:disabled":{opacity:.5,cursor:"default"}},children:t.jsx(vs,{title:e.title,maxWidth:"100%",sx:{minWidth:0},children:e.title})},e.title))}):null,pn=h?t.jsx(f,{flex:"0 0 auto",px:3,py:2,borderTop:"1px solid",borderColor:"border.default",bg:"canvas.subtle",fontSize:1,maxHeight:"40%",overflowY:"auto",children:h}):null;return t.jsxs(f,{ref:pe,sx:{height:"100%",minHeight:0,display:"flex",flexDirection:"column",position:"relative",...$?{bg:"canvas.default"}:null,...$&&!mt.current?{position:"fixed",top:bt,right:0,bottom:0,left:0,height:"auto",zIndex:1e3}:null},children:[ie?t.jsx(ie.Component,{workspace:n,editors:un,hasEditor:!!E,transcript:fn,prompt:Ve?null:it,chips:Ve?null:gn,picker:dn,transient:pn}):t.jsxs(t.Fragment,{children:[Ee&&!Ve?t.jsxs(f,{flex:"0 0 auto",borderBottom:"1px solid",borderColor:"border.default",children:[it,gn]}):null,dn,t.jsxs(f,{flex:"1 1 auto",minHeight:0,display:"flex",position:"relative",children:[un,fn]}),pn,ln||Ve||Ee?null:it]}),wt?t.jsx(f,{position:"absolute",inset:0,zIndex:5,bg:"canvas.default",display:"flex",flexDirection:"column",minHeight:0,children:t.jsx(zs,{agentName:y?.name??j?.name,sandboxStillRuns:m,temporary:Gt,onSignedIn:()=>ys.getState().clear()})}):null]})}function ia({surfaces:n,active:s,onChange:c,workspace:a}){const d=[...n].sort((h,x)=>(h.order??100)-(x.order??100));return t.jsxs(f,{flex:"0 0 auto",display:"flex",alignItems:"center",gap:2,px:3,py:2,borderBottom:"1px solid",borderColor:"border.default",children:[t.jsx(W,{sx:{fontSize:0,color:"fg.muted"},children:"Beside the chat"}),t.jsxs($t,{"aria-label":"Editor beside the chat",size:"small",children:[t.jsx($t.Button,{selected:s===X,onClick:()=>c(X),children:"Chat"}),d.map(h=>{const x=De(h,a),C=x?void 0:h.unavailableReason?.(a)??"Not available right now";return t.jsx($t.Button,{selected:s===h.surfaceId,"aria-disabled":!x,title:C??h.title,leadingIcon:h.icon,onClick:()=>{x&&c(h.surfaceId)},children:h.title},h.surfaceId)})]})]})}function Ot({children:n}){return t.jsx(f,{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.muted",fontSize:1,px:3,textAlign:"center",children:n})}export{da as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bd as N,be as U,bf as j,q as C,bg as I,r as u,bh as L,bi as v,bj as T}from"../datalayer-app-main.js";function h(l){const n=l?.app_spec;if(!n||typeof n!="object")return;const t=l?.app_instance??{},e=typeof t.app_uid=="string"&&t.app_uid?t.app_uid:void 0,r=typeof t.deployment_uid=="string"&&t.deployment_uid?t.deployment_uid:void 0;return{appSpec:n,...e?{appUid:e}:{},...r?{deploymentUid:r}:{}}}const B="jupyter-tutor";function k(){const n=N().getConfig(U),t=n?.datalayerAgentSpecId??B,e=n?.datalayerCreatePayload,r=n?.datalayerVisitors,E=n?.datalayerKept,i=r?.url??E?.url,a=j(),s=C(a?.target??I)==="datalayer",p=e?.app_spec?.id,[c,d]=u.useState({});u.useEffect(()=>{if(d({}),!r||!s)return;if(typeof p!="string"||!p){d({error:"A conversation without an account runs an application: none was given."});return}let y=!0;return L(r,p).then(()=>{y&&d({ready:!0})}).catch(_=>{y&&d({error:_ instanceof Error?_.message:String(_)})}),()=>{y=!1}},[r?.url,r?.app,r?.inferenceUrl,p,s]);const A=typeof e?.name=="string"?e.name:t,g=e?.transport==="ag-ui"||e?.transport==="vercel-ai"?e.transport:void 0,b=u.useMemo(()=>({name:A,...g?{protocol:g}:{},agentSpecId:t,model:v[t]?.model,description:v[t]?.description,...e?{createPayload:e}:{}}),[t,A,g,e]),S=u.useMemo(()=>h(e),[e]),{runtime:o,status:m,error:f}=T({agentSpecId:t,agentConfig:b,...S?{appLaunch:S}:{},variant:"cloud-pydanticai",autoStart:s&&!i,autoCreateAgent:s&&!i});return u.useEffect(()=>{if(!(!a||!s)){if(r){if(c.error){a.setState("error",c.error);return}if(!c.ready){a.setState("starting");return}}if(i){a.report({variant:"datalayer",sandbox_running:!1,agent_base_url:i});return}if(f){a.setState("error",f);return}if(!o?.jupyterBaseUrl){a.setState(m==="error"?"error":"starting");return}a.report({variant:"datalayer",sandbox_running:!!o.serviceManager,jupyter_url:o.jupyterBaseUrl,jupyter_token:o.serviceManager?.serverSettings?.token,kernel_id:o.kernelId,agent_base_url:o.agentBaseUrl})}},[a,s,o,m,f,i,r,c]),null}export{k as DatalayerAgentBridge,k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jR as je,jS as We,jT as Qe,jU as Ke,jV as Xe,jW as Ze,jX as Je,jY as et,jZ as xe,r as Q,j as S,az as br,_ as fr,j_ as Tr,G as vr,cc as Cr,I as yr,cd as Rr,D as Nr,fQ as Or,bp as da,T as Ar}from"../datalayer-app-main.js";import{x as Ir,B as xr,N as Dr}from"./JupyterLexicalExtension-CUsjvchq.js";import"./NotebookSkeleton-D9WNoiWD.js";import"./Avatar-Dqz3ZWjZ.js";import"./url-DEeTWrO-.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./VideoIcon-BjP_LDa4.js";import"./LinkIcon-DUI0jw25.js";import"./Toolbar-B6ROXJ-2.js";import"./ArrowUpIcon-BUCpIXDR.js";import"./SortDescIcon-CS4EzHeS.js";import"./PrismCss-u5utqjht.js";import"./LexicalToolRegistry-DoZIM1lF.js";const _a={datalayer:{light:{primary:xe.greenAccent,secondary:xe.greenText,textColor:xe.gray,primaryGradient:[xe.greenAccent,xe.greenBrand],secondaryGradient:[xe.greenHover,xe.greenBrand]},dark:{primary:xe.greenBright,secondary:xe.greenAccent,textColor:xe.gray,primaryGradient:[xe.greenAccent,xe.greenBrand],secondaryGradient:[xe.greenHover,xe.greenText]}},spatial:{light:{primary:et.indigoBrand,secondary:et.indigoText,textColor:et.gray,primaryGradient:[et.indigoBright,et.indigoBrand],secondaryGradient:[et.indigoHover,et.indigoAccent]},dark:{primary:et.indigoBright,secondary:et.indigoAccent,textColor:et.gray,primaryGradient:[et.indigoBright,et.indigoBrand],secondaryGradient:[et.indigoHover,et.indigoAccent]}},lovely:{light:{primary:Je.roseBrand,secondary:Je.roseText,textColor:Je.gray,primaryGradient:[Je.roseBright,Je.roseBrand],secondaryGradient:[Je.roseHover,Je.roseAccent]},dark:{primary:Je.roseBright,secondary:Je.roseAccent,textColor:Je.gray,primaryGradient:[Je.roseBright,Je.roseBrand],secondaryGradient:[Je.roseHover,Je.roseAccent]}},matrix:{light:{primary:Ze.greenBrand,secondary:Ze.greenText,textColor:Ze.gray,primaryGradient:[Ze.greenGlow,Ze.greenBrand],secondaryGradient:[Ze.greenHover,Ze.greenAccent]},dark:{primary:Ze.greenGlow,secondary:Ze.greenPhosphor,textColor:Ze.gray,primaryGradient:[Ze.greenGlow,Ze.greenBrand],secondaryGradient:[Ze.greenHover,Ze.greenAccent]}},earth:{light:{primary:Xe.oceanBrand,secondary:Xe.oceanText,textColor:Xe.gray,primaryGradient:[Xe.oceanAccent,Xe.oceanBrand],secondaryGradient:[Xe.oceanHover,Xe.oceanText]},dark:{primary:Xe.oceanBright,secondary:Xe.oceanAccent,textColor:Xe.gray,primaryGradient:[Xe.oceanBright,Xe.oceanBrand],secondaryGradient:[Xe.oceanHover,Xe.oceanAccent]}},sand:{light:{primary:Ke.sandBrand,secondary:Ke.sandText,textColor:Ke.gray,primaryGradient:[Ke.sandAccent,Ke.sandBrand],secondaryGradient:[Ke.sandHover,Ke.sandText]},dark:{primary:Ke.sandBright,secondary:Ke.sandAccent,textColor:Ke.gray,primaryGradient:[Ke.sandBright,Ke.sandBrand],secondaryGradient:[Ke.sandHover,Ke.sandAccent]}},ivory:{light:{primary:Qe.ivoryBrand,secondary:Qe.ivoryText,textColor:Qe.gray,primaryGradient:[Qe.ivoryAccent,Qe.ivoryBrand],secondaryGradient:[Qe.ivoryHover,Qe.ivoryText]},dark:{primary:Qe.ivoryBright,secondary:Qe.ivoryAccent,textColor:Qe.gray,primaryGradient:[Qe.ivoryBright,Qe.ivoryBrand],secondaryGradient:[Qe.ivoryHover,Qe.ivoryAccent]}},sun:{light:{primary:We.sunBrand,secondary:We.sunText,textColor:We.gray,primaryGradient:[We.sunAccent,We.sunBrand],secondaryGradient:[We.sunHover,We.sunText]},dark:{primary:We.sunBright,secondary:We.sunAccent,textColor:We.gray,primaryGradient:[We.sunBright,We.sunBrand],secondaryGradient:[We.sunHover,We.sunAccent]}},loop:{light:{primary:je.loopAccent,secondary:je.ink,textColor:je.gray,primaryGradient:[je.loopAccent,je.loopAccent],secondaryGradient:[je.ink,je.ink]},dark:{primary:je.loopBrand,secondary:je.inkDark,textColor:je.grayDark,primaryGradient:[je.loopBrand,je.loopBrand],secondaryGradient:[je.inkDark,je.inkDark]}}};function Ya(i="datalayer",t="light"){const n=t==="auto"?"light":t;return _a[i]?.[n]??_a.datalayer.light}const ua=25,wr=[{y:0,secondaryWidth:30,primaryWidth:70},{y:37.5,secondaryWidth:50,primaryWidth:50},{y:75,secondaryWidth:70,primaryWidth:30}];Q.forwardRef(function({size:t=16,variant:n="datalayer",colorMode:e="light",primaryColor:a,secondaryColor:r,primaryGradient:s,secondaryGradient:o,gradient:l=!0,...c},d){const _=Ya(n,e),u=a??_.primary,m=r??_.secondary,p=Q.useId().replace(/:/g,""),[g,b]=s??_.primaryGradient,[C,y]=o??_.secondaryGradient;return S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",width:t,height:t,"aria-hidden":"true",ref:d,...c,children:[l&&S.jsxs("defs",{children:[S.jsxs("linearGradient",{id:`${p}-p`,x1:"0",y1:"0",x2:"1",y2:"0",children:[S.jsx("stop",{offset:"0",stopColor:g}),S.jsx("stop",{offset:"1",stopColor:b})]}),S.jsxs("linearGradient",{id:`${p}-s`,x1:"0",y1:"0",x2:"1",y2:"0",children:[S.jsx("stop",{offset:"0",stopColor:C}),S.jsx("stop",{offset:"1",stopColor:y})]})]}),wr.map(({y:N,secondaryWidth:O,primaryWidth:v})=>S.jsxs("g",{children:[S.jsx("rect",{x:0,y:N,width:O,height:ua,fill:l?`url(#${p}-p)`:u}),S.jsx("rect",{x:O,y:N,width:v,height:ua,fill:l?`url(#${p}-s)`:m})]},N))]})});const Ha=new Map,On=i=>Ha.get(i),an=i=>Ha.has(i),kr=/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\([^)]+\)|==[^=]+==)/g,ie=i=>i.split(kr).map((t,n)=>{const e=`${n}-${t}`;if(t.startsWith("**")&&t.endsWith("**"))return S.jsx("strong",{children:ie(t.slice(2,-2))},e);if(t.startsWith("`")&&t.endsWith("`"))return S.jsx("code",{children:t.slice(1,-1)},e);if(t.startsWith("==")&&t.endsWith("=="))return S.jsx("mark",{className:"dla-alert",children:t.slice(2,-2)},e);const a=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(t);return a?S.jsx("a",{href:a[2],target:"_blank",rel:"noopener noreferrer",children:a[1]},e):t}),Mr=i=>i.trim().split(/\n\s*\n/).map((t,n)=>S.jsx("p",{children:ie(t.trim())},`${n}-${t.slice(0,24)}`)),Lr=()=>{const{theme:i,colorMode:t}=br();return{theme:i,colorMode:t}},Pr={useTheme:Lr},Fr=Q.createContext(Pr),Va=()=>Q.useContext(Fr),za=()=>{const{useTheme:i}=Va();return i()},An=({footer:i,theme:t,index:n,total:e})=>{const{colorMode:a,theme:r}=za(),{Logo:s}=Va(),o=a==="auto"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a,l=Ya(r,o),c=new Date().getFullYear(),d=i.since&&i.since<c?`${i.since}–${c}`:`${c}`;return S.jsxs("div",{className:"dla-slide-footer",children:[i.logo&&S.jsx("a",{className:"dla-slide-footer-logo",href:i.href,target:"_blank",rel:"noopener noreferrer","aria-label":`${i.holder} — ${i.href}`,children:s?S.jsx(s,{height:26,variant:r,colorMode:a,inverse:t.logo.inverse,colored:t.logo.colored,primaryColor:t.logo.primaryColor??l.primary,secondaryColor:t.logo.secondaryColor??l.secondary,textColor:t.logo.textColor??l.textColor}):S.jsx("span",{className:"dla-slide-footer-holder",children:i.holder})}),i.note&&S.jsx("div",{className:"dla-slide-footer-note",children:i.note}),S.jsxs("div",{className:"dla-slide-footer-legal",children:[S.jsx("a",{href:i.href,target:"_blank",rel:"noopener noreferrer",children:i.href.replace(/^https?:\/\//,"")}),S.jsxs("span",{children:["© ",d," ",i.holder]}),i.slideNumbers&&S.jsxs("span",{className:"dla-slide-footer-number",children:[n," / ",e]})]})]})},In=({name:i})=>{if(!i)return null;const t=On(i);return t?S.jsx("div",{className:"dla-slide-backdrop","aria-hidden":!0,children:S.jsx(t,{})}):null},Le=({theme:i,footer:t,index:n,total:e,eyebrow:a,title:r,subtitle:s,layout:o,variant:l,backdrop:c,children:d})=>{const _=["dla-slide"];return l&&_.push(`dla-slide--${l}`),(o==="centered"||o==="full-bleed")&&_.push(`dla-slide--${o}`),S.jsxs("div",{className:_.join(" "),children:[S.jsx(In,{name:c}),S.jsxs("div",{className:"dla-slide-head",children:[a&&S.jsx("div",{className:"dla-slide-eyebrow",children:a}),r&&S.jsx("h2",{className:"dla-slide-title",children:ie(r)}),s&&S.jsx("p",{className:"dla-slide-subtitle",children:ie(s)})]}),S.jsx("div",{className:"dla-slide-body",children:d}),t&&S.jsx(An,{footer:t,theme:i,index:n,total:e})]})};var jt=(i,t)=>{for(let n in t)i[n]=t[n];return i},j=(i,t)=>Array.from(i.querySelectorAll(t)),Mn=(i,t,n)=>{n?i.classList.add(t):i.classList.remove(t)},$t=i=>{if(typeof i=="string"){if(i==="null")return null;if(i==="true")return!0;if(i==="false")return!1;if(i.match(/^-?[\d\.]+$/))return parseFloat(i)}return i},Rt=(i,t)=>{i.style.transform=t},Cn=(i,t)=>{let n=i.matches||i.matchesSelector||i.msMatchesSelector;return!!(n&&n.call(i,t))},De=(i,t)=>{if(i&&typeof i.closest=="function")return i.closest(t);for(;i;){if(Cn(i,t))return i;i=i.parentElement}return null},qa=i=>{i=i||document.documentElement;let t=i.requestFullscreen||i.webkitRequestFullscreen||i.webkitRequestFullScreen||i.mozRequestFullScreen||i.msRequestFullscreen;t&&t.apply(i)},Ur=(i,t,n,e="")=>{let a=i.querySelectorAll("."+n);for(let s=0;s<a.length;s++){let o=a[s];if(o.parentNode===i)return o}let r=document.createElement(t);return r.className=n,r.innerHTML=e,i.appendChild(r),r},Hn=i=>{let t=document.createElement("style");return i&&i.length>0&&t.appendChild(document.createTextNode(i)),document.head.appendChild(t),t},pa=()=>{let i={};location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,t=>{let n=t.split("=").shift(),e=t.split("=").pop();return n&&e!==void 0&&(i[n]=e),t});for(let t in i){let n=i[t];i[t]=$t(unescape(n))}return i.dependencies!==void 0&&delete i.dependencies,i},Br=(i,t=0)=>{if(i){var n;let e,a=i.style.height;return i.style.height="0px",i.parentElement&&(i.parentElement.style.height="auto"),e=t-(((n=i.parentElement)==null?void 0:n.offsetHeight)||0),i.style.height=a+"px",i.parentElement&&i.parentElement.style.removeProperty("height"),e}return t},Gr={mp4:"video/mp4",m4a:"video/mp4",ogv:"video/ogg",mpeg:"video/mpeg",webm:"video/webm"},Yr=(i="")=>{let t=i.split(".").pop();return t?Gr[t]:void 0},Hr=(i="")=>encodeURI(i).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),$a=navigator.userAgent,Lt=/(iphone|ipod|ipad|android)/gi.test($a)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,ja=/android/gi.test($a),Vr=(function(i){if(i){var t=function(R){return[].slice.call(R)},n=0,e=1,a=2,r=3,s=[],o=null,l="requestAnimationFrame"in i?function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};i.cancelAnimationFrame(o);var U=function(){return d(s.filter((function(z){return z.dirty&&z.active})))};if(R.sync)return U();o=i.requestAnimationFrame(U)}:function(){},c=function(R){return function(U){s.forEach((function(z){return z.dirty=R})),l(U)}},d=function(R){R.filter((function(z){return!z.styleComputed})).forEach((function(z){z.styleComputed=p(z)})),R.filter(g).forEach(b);var U=R.filter(m);U.forEach(u),U.forEach((function(z){b(z),_(z)})),U.forEach(C)},_=function(R){return R.dirty=n},u=function(R){R.availableWidth=R.element.parentNode.clientWidth,R.currentWidth=R.element.scrollWidth,R.previousFontSize=R.currentFontSize,R.currentFontSize=Math.min(Math.max(R.minSize,R.availableWidth/R.currentWidth*R.previousFontSize),R.maxSize),R.whiteSpace=R.multiLine&&R.currentFontSize===R.minSize?"normal":"nowrap"},m=function(R){return R.dirty!==a||R.dirty===a&&R.element.parentNode.clientWidth!==R.availableWidth},p=function(R){var U=i.getComputedStyle(R.element,null);return R.currentFontSize=parseFloat(U.getPropertyValue("font-size")),R.display=U.getPropertyValue("display"),R.whiteSpace=U.getPropertyValue("white-space"),!0},g=function(R){var U=!1;return!R.preStyleTestCompleted&&(/inline-/.test(R.display)||(U=!0,R.display="inline-block"),R.whiteSpace!=="nowrap"&&(U=!0,R.whiteSpace="nowrap"),R.preStyleTestCompleted=!0,U)},b=function(R){R.element.style.whiteSpace=R.whiteSpace,R.element.style.display=R.display,R.element.style.fontSize=R.currentFontSize+"px"},C=function(R){R.element.dispatchEvent(new CustomEvent("fit",{detail:{oldValue:R.previousFontSize,newValue:R.currentFontSize,scaleFactor:R.currentFontSize/R.previousFontSize}}))},y=function(R,U){return function(z){R.dirty=U,R.active&&l(z)}},N=function(R){return function(){s=s.filter((function(U){return U.element!==R.element})),R.observeMutations&&R.observer.disconnect(),R.element.style.whiteSpace=R.originalStyle.whiteSpace,R.element.style.display=R.originalStyle.display,R.element.style.fontSize=R.originalStyle.fontSize}},O=function(R){return function(){R.active||(R.active=!0,l())}},v=function(R){return function(){return R.active=!1}},A=function(R){R.observeMutations&&(R.observer=new MutationObserver(y(R,e)),R.observer.observe(R.element,R.observeMutations))},M={minSize:16,maxSize:512,multiLine:!0,observeMutations:"MutationObserver"in i&&{subtree:!0,childList:!0,characterData:!0}},F=null,Y=function(){i.clearTimeout(F),F=i.setTimeout(c(a),B.observeWindowDelay)},x=["resize","orientationchange"];return Object.defineProperty(B,"observeWindow",{set:function(R){var U=`${R?"add":"remove"}EventListener`;x.forEach((function(z){i[U](z,Y)}))}}),B.observeWindow=!0,B.observeWindowDelay=100,B.fitAll=c(r),B}function K(R,U){var z=Object.assign({},M,U),Z=R.map((function(te){var se=Object.assign({},z,{element:te,active:!0});return(function(ae){ae.originalStyle={whiteSpace:ae.element.style.whiteSpace,display:ae.element.style.display,fontSize:ae.element.style.fontSize},A(ae),ae.newbie=!0,ae.dirty=!0,s.push(ae)})(se),{element:te,fit:y(se,r),unfreeze:O(se),freeze:v(se),unsubscribe:N(se)}}));return l(),Z}function B(R){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof R=="string"?K(t(document.querySelectorAll(R)),U):K([R],U)[0]}})(typeof window>"u"?null:window);function ln(i){"@babel/helpers - typeof";return ln=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ln(i)}function zr(i,t){if(ln(i)!="object"||!i)return i;var n=i[Symbol.toPrimitive];if(n!==void 0){var e=n.call(i,t);if(ln(e)!="object")return e;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function qr(i){var t=zr(i,"string");return ln(t)=="symbol"?t:t+""}function Kn(i,t,n){return(t=qr(t))in i?Object.defineProperty(i,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):i[t]=n,i}var $r=class{constructor(t){Kn(this,"allowedToPlayAudio",null),this.Reveal=t,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement("button"),this.mediaPlayButton.className="r-overlay-button r-media-play-button",this.mediaPlayButton.addEventListener("click",()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(t=>{this.startEmbeddedMedia({target:t})}),this.clearMediaPlaybackErrors()})}shouldPreload(t){if(this.Reveal.isScrollView())return!0;let n=this.Reveal.getConfig().preloadIframes;return typeof n!="boolean"&&(n=t.hasAttribute("data-preload")),n}load(t,n={}){let e=this.Reveal.getConfig().display;if(e.includes("!important")){let r=e.replace(/\s*!important\s*$/,"").trim();t.style.setProperty("display",r,"important")}else t.style.display=e;j(t,"img[data-src], video[data-src], audio[data-src], iframe[data-src]").forEach(r=>{let s=r.tagName==="IFRAME";(!s||this.shouldPreload(r))&&(r.setAttribute("src",r.getAttribute("data-src")),r.setAttribute("data-lazy-loaded",""),r.removeAttribute("data-src"),s&&r.addEventListener("load",this.preventIframeAutoFocus))}),j(t,"video, audio").forEach(r=>{let s=0;j(r,"source[data-src]").forEach(o=>{o.setAttribute("src",o.getAttribute("data-src")),o.removeAttribute("data-src"),o.setAttribute("data-lazy-loaded",""),s+=1}),Lt&&r.tagName==="VIDEO"&&r.setAttribute("playsinline",""),s>0&&r.load()});let a=t.slideBackgroundElement;if(a){a.style.display="block";let r=t.slideBackgroundContentElement,s=t.getAttribute("data-background-iframe");if(a.hasAttribute("data-loaded")===!1){a.setAttribute("data-loaded","true");let l=t.getAttribute("data-background-image"),c=t.getAttribute("data-background-video"),d=t.hasAttribute("data-background-video-loop"),_=t.hasAttribute("data-background-video-muted");if(l)/^data:/.test(l.trim())?r.style.backgroundImage=`url(${l.trim()})`:r.style.backgroundImage=l.split(",").map(u=>`url(${Hr(decodeURI(u.trim()))})`).join(",");else if(c){let u=document.createElement("video");d&&u.setAttribute("loop",""),(_||this.Reveal.isSpeakerNotes())&&(u.muted=!0),Lt&&u.setAttribute("playsinline",""),c.split(",").forEach(m=>{let p=document.createElement("source");p.setAttribute("src",m);let g=Yr(m);g&&p.setAttribute("type",g),u.appendChild(p)}),r.appendChild(u)}else if(s&&n.excludeIframes!==!0){let u=document.createElement("iframe");u.setAttribute("allowfullscreen",""),u.setAttribute("mozallowfullscreen",""),u.setAttribute("webkitallowfullscreen",""),u.setAttribute("allow","autoplay"),u.setAttribute("data-src",s),u.style.width="100%",u.style.height="100%",u.style.maxHeight="100%",u.style.maxWidth="100%",r.appendChild(u)}}let o=r.querySelector("iframe[data-src]");o&&this.shouldPreload(a)&&!/autoplay=(1|true|yes)/gi.test(s)&&o.getAttribute("src")!==s&&o.setAttribute("src",s)}this.layout(t)}layout(t){Array.from(t.querySelectorAll(".r-fit-text")).forEach(n=>{Vr(n,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(t){t.style.display="none";let n=this.Reveal.getSlideBackground(t);n&&(n.style.display="none",j(n,"iframe[src]").forEach(e=>{e.removeAttribute("src")})),j(t,"video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]").forEach(e=>{e.setAttribute("data-src",e.getAttribute("src")),e.removeAttribute("src")}),j(t,"video[data-lazy-loaded] source[src], audio source[src]").forEach(e=>{e.setAttribute("data-src",e.getAttribute("src")),e.removeAttribute("src")})}formatEmbeddedContent(){let t=(n,e,a)=>{j(this.Reveal.getSlidesElement(),"iframe["+n+'*="'+e+'"]').forEach(r=>{let s=r.getAttribute(n);s&&s.indexOf(a)===-1&&r.setAttribute(n,s+(/\?/.test(s)?"&":"?")+a)})};t("src","youtube.com/embed/","enablejsapi=1"),t("data-src","youtube.com/embed/","enablejsapi=1"),t("src","player.vimeo.com/","api=1"),t("data-src","player.vimeo.com/","api=1")}startEmbeddedContent(t){if(t){let n=this.Reveal.isSpeakerNotes();j(t,'img[src$=".gif"]').forEach(e=>{e.setAttribute("src",e.getAttribute("src"))}),j(t,"video, audio").forEach(e=>{if(De(e,".fragment")&&!De(e,".fragment.visible"))return;let a=this.Reveal.getConfig().autoPlayMedia;if(typeof a!="boolean"&&(a=e.hasAttribute("data-autoplay")||!!De(e,".slide-background")),a&&typeof e.play=="function"){if(n&&!e.muted)return;e.readyState>1?this.startEmbeddedMedia({target:e}):Lt?(e.addEventListener("canplay",this.ensureMobileMediaPlaying),this.playMediaElement(e)):(e.removeEventListener("loadeddata",this.startEmbeddedMedia),e.addEventListener("loadeddata",this.startEmbeddedMedia))}}),n||(j(t,"iframe[src]").forEach(e=>{De(e,".fragment")&&!De(e,".fragment.visible")||this.startEmbeddedIframe({target:e})}),j(t,"iframe[data-src]").forEach(e=>{De(e,".fragment")&&!De(e,".fragment.visible")||e.getAttribute("src")!==e.getAttribute("data-src")&&(e.removeEventListener("load",this.startEmbeddedIframe),e.addEventListener("load",this.startEmbeddedIframe),e.setAttribute("src",e.getAttribute("data-src")))}))}}ensureMobileMediaPlaying(t){let n=t.target;typeof n.getVideoPlaybackQuality=="function"&&setTimeout(()=>{let e=n.paused===!1,a=n.getVideoPlaybackQuality().totalVideoFrames;e&&a===0&&(n.load(),n.play())},1e3)}startEmbeddedMedia(t){let n=!!De(t.target,"html"),e=!!De(t.target,".present");n&&e&&(t.target.paused||t.target.ended)&&(t.target.currentTime=0,this.playMediaElement(t.target)),t.target.removeEventListener("loadeddata",this.startEmbeddedMedia)}playMediaElement(t){let n=t.play();n&&typeof n.catch=="function"&&n.then(()=>{t.muted||(this.allowedToPlayAudio=!0)}).catch(e=>{if(e.name==="NotAllowedError")if(this.allowedToPlayAudio=!1,t.tagName==="VIDEO"){this.onVideoPlaybackNotAllowed(t);let a=!!De(t,"html"),r=!!De(t,".present"),s=t.muted;a&&r&&!s&&(t.setAttribute("data-muted-by-reveal","true"),t.muted=!0,t.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(t)}))}else t.tagName==="AUDIO"&&this.onAudioPlaybackNotAllowed(t)})}startEmbeddedIframe(t){let n=t.target;if(this.preventIframeAutoFocus(t),n&&n.contentWindow){let e=!!De(t.target,"html"),a=!!De(t.target,".present");if(e&&a){let r=this.Reveal.getConfig().autoPlayMedia;typeof r!="boolean"&&(r=n.hasAttribute("data-autoplay")||!!De(n,".slide-background")),/youtube\.com\/embed\//.test(n.getAttribute("src"))&&r?n.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*"):/player\.vimeo\.com\//.test(n.getAttribute("src"))&&r?n.contentWindow.postMessage('{"method":"play"}',"*"):n.contentWindow.postMessage("slide:start","*")}}}stopEmbeddedContent(t,n={}){n=jt({unloadIframes:!0},n),t&&t.parentNode&&(j(t,"video, audio").forEach(e=>{!e.hasAttribute("data-ignore")&&typeof e.pause=="function"&&(e.setAttribute("data-paused-by-reveal",""),e.pause(),Lt&&e.removeEventListener("canplay",this.ensureMobileMediaPlaying))}),j(t,"iframe").forEach(e=>{e.contentWindow&&e.contentWindow.postMessage("slide:stop","*"),e.removeEventListener("load",this.preventIframeAutoFocus),e.removeEventListener("load",this.startEmbeddedIframe)}),j(t,'iframe[src*="youtube.com/embed/"]').forEach(e=>{!e.hasAttribute("data-ignore")&&e.contentWindow&&typeof e.contentWindow.postMessage=="function"&&e.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}),j(t,'iframe[src*="player.vimeo.com/"]').forEach(e=>{!e.hasAttribute("data-ignore")&&e.contentWindow&&typeof e.contentWindow.postMessage=="function"&&e.contentWindow.postMessage('{"method":"pause"}',"*")}),n.unloadIframes===!0&&j(t,"iframe[data-src]").forEach(e=>{e.setAttribute("src","about:blank"),e.removeAttribute("src")}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let t=this.failedAudioPlaybackTargets.size,n=this.failedVideoPlaybackTargets.size,e=this.failedMutedVideoPlaybackTargets.size,a="Play media";e>0?a="Play video":n>0?a="Unmute video":t>0&&(a="Play audio"),this.mediaPlayButton.textContent=a,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(t){this.failedAudioPlaybackTargets.add(t),this.showPlayOrUnmuteButton(t)}onVideoPlaybackNotAllowed(t){this.failedVideoPlaybackTargets.add(t),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(t){this.failedMutedVideoPlaybackTargets.add(t),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(t=>{t.hasAttribute("data-muted-by-reveal")&&(t.muted=!1,t.removeAttribute("data-muted-by-reveal"))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton&&this.mediaPlayButton.parentNode&&this.mediaPlayButton.remove()}preventIframeAutoFocus(t){let n=t.target;if(n&&this.Reveal.getConfig().preventIframeAutoFocus){let e=0,a=()=>{document.activeElement===n?document.activeElement.blur():e<1e3&&(e+=100,setTimeout(a,100))};setTimeout(a,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},Nt=".slides section",ht=".slides>section",Ln=".slides>section.present>section",jr=".backgrounds>.slide-background",Wr=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview|previewIframe/,Qr=class{constructor(t){this.Reveal=t}render(){this.element=document.createElement("div"),this.element.className="slide-number",this.Reveal.getRevealElement().appendChild(this.element)}configure(t,n){let e="none";t.slideNumber&&!this.Reveal.isPrintView()&&(t.showSlideNumber==="all"||t.showSlideNumber==="speaker"&&this.Reveal.isSpeakerNotes())&&(e="block"),this.element.style.display=e}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(t=this.Reveal.getCurrentSlide()){let n=this.Reveal.getConfig(),e,a="h.v";if(typeof n.slideNumber=="function")e=n.slideNumber(t);else{typeof n.slideNumber=="string"&&(a=n.slideNumber),!/c/.test(a)&&this.Reveal.getHorizontalSlides().length===1&&(a="c");let s=t&&t.dataset.visibility==="uncounted"?0:1;switch(e=[],a){case"c":e.push(this.Reveal.getSlidePastCount(t)+s);break;case"c/t":e.push(this.Reveal.getSlidePastCount(t)+s,"/",this.Reveal.getTotalSlides());break;default:let o=this.Reveal.getIndices(t);e.push(o.h+s);let l=a==="h/v"?"/":".";this.Reveal.isVerticalSlide(t)&&e.push(l,o.v+1)}}let r="#"+this.Reveal.location.getHash(t);return this.formatNumber(e[0],e[1],e[2],r)}formatNumber(t,n,e,a="#"+this.Reveal.location.getHash()){return typeof e=="number"&&!isNaN(e)?`<a href="${a}">
|
|
1
|
+
import{jR as je,jS as We,jT as Qe,jU as Ke,jV as Xe,jW as Ze,jX as Je,jY as et,jZ as xe,r as Q,j as S,az as br,_ as fr,j_ as Tr,G as vr,cc as Cr,I as yr,cd as Rr,D as Nr,fy as Or,bw as da,T as Ar}from"../datalayer-app-main.js";import{x as Ir,B as xr,N as Dr}from"./JupyterLexicalExtension-CEjN8cLT.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./url-DEeTWrO-.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./VideoIcon-BjP_LDa4.js";import"./LinkIcon-DUI0jw25.js";import"./Toolbar-BxAi9T92.js";import"./ArrowUpIcon-BUCpIXDR.js";import"./SortDescIcon-CS4EzHeS.js";import"./PrismCss-u5utqjht.js";import"./LexicalToolRegistry-DoZIM1lF.js";const _a={datalayer:{light:{primary:xe.greenAccent,secondary:xe.greenText,textColor:xe.gray,primaryGradient:[xe.greenAccent,xe.greenBrand],secondaryGradient:[xe.greenHover,xe.greenBrand]},dark:{primary:xe.greenBright,secondary:xe.greenAccent,textColor:xe.gray,primaryGradient:[xe.greenAccent,xe.greenBrand],secondaryGradient:[xe.greenHover,xe.greenText]}},spatial:{light:{primary:et.indigoBrand,secondary:et.indigoText,textColor:et.gray,primaryGradient:[et.indigoBright,et.indigoBrand],secondaryGradient:[et.indigoHover,et.indigoAccent]},dark:{primary:et.indigoBright,secondary:et.indigoAccent,textColor:et.gray,primaryGradient:[et.indigoBright,et.indigoBrand],secondaryGradient:[et.indigoHover,et.indigoAccent]}},lovely:{light:{primary:Je.roseBrand,secondary:Je.roseText,textColor:Je.gray,primaryGradient:[Je.roseBright,Je.roseBrand],secondaryGradient:[Je.roseHover,Je.roseAccent]},dark:{primary:Je.roseBright,secondary:Je.roseAccent,textColor:Je.gray,primaryGradient:[Je.roseBright,Je.roseBrand],secondaryGradient:[Je.roseHover,Je.roseAccent]}},matrix:{light:{primary:Ze.greenBrand,secondary:Ze.greenText,textColor:Ze.gray,primaryGradient:[Ze.greenGlow,Ze.greenBrand],secondaryGradient:[Ze.greenHover,Ze.greenAccent]},dark:{primary:Ze.greenGlow,secondary:Ze.greenPhosphor,textColor:Ze.gray,primaryGradient:[Ze.greenGlow,Ze.greenBrand],secondaryGradient:[Ze.greenHover,Ze.greenAccent]}},earth:{light:{primary:Xe.oceanBrand,secondary:Xe.oceanText,textColor:Xe.gray,primaryGradient:[Xe.oceanAccent,Xe.oceanBrand],secondaryGradient:[Xe.oceanHover,Xe.oceanText]},dark:{primary:Xe.oceanBright,secondary:Xe.oceanAccent,textColor:Xe.gray,primaryGradient:[Xe.oceanBright,Xe.oceanBrand],secondaryGradient:[Xe.oceanHover,Xe.oceanAccent]}},sand:{light:{primary:Ke.sandBrand,secondary:Ke.sandText,textColor:Ke.gray,primaryGradient:[Ke.sandAccent,Ke.sandBrand],secondaryGradient:[Ke.sandHover,Ke.sandText]},dark:{primary:Ke.sandBright,secondary:Ke.sandAccent,textColor:Ke.gray,primaryGradient:[Ke.sandBright,Ke.sandBrand],secondaryGradient:[Ke.sandHover,Ke.sandAccent]}},ivory:{light:{primary:Qe.ivoryBrand,secondary:Qe.ivoryText,textColor:Qe.gray,primaryGradient:[Qe.ivoryAccent,Qe.ivoryBrand],secondaryGradient:[Qe.ivoryHover,Qe.ivoryText]},dark:{primary:Qe.ivoryBright,secondary:Qe.ivoryAccent,textColor:Qe.gray,primaryGradient:[Qe.ivoryBright,Qe.ivoryBrand],secondaryGradient:[Qe.ivoryHover,Qe.ivoryAccent]}},sun:{light:{primary:We.sunBrand,secondary:We.sunText,textColor:We.gray,primaryGradient:[We.sunAccent,We.sunBrand],secondaryGradient:[We.sunHover,We.sunText]},dark:{primary:We.sunBright,secondary:We.sunAccent,textColor:We.gray,primaryGradient:[We.sunBright,We.sunBrand],secondaryGradient:[We.sunHover,We.sunAccent]}},loop:{light:{primary:je.loopAccent,secondary:je.ink,textColor:je.gray,primaryGradient:[je.loopAccent,je.loopAccent],secondaryGradient:[je.ink,je.ink]},dark:{primary:je.loopBrand,secondary:je.inkDark,textColor:je.grayDark,primaryGradient:[je.loopBrand,je.loopBrand],secondaryGradient:[je.inkDark,je.inkDark]}}};function Ya(i="datalayer",t="light"){const n=t==="auto"?"light":t;return _a[i]?.[n]??_a.datalayer.light}const ua=25,wr=[{y:0,secondaryWidth:30,primaryWidth:70},{y:37.5,secondaryWidth:50,primaryWidth:50},{y:75,secondaryWidth:70,primaryWidth:30}];Q.forwardRef(function({size:t=16,variant:n="datalayer",colorMode:e="light",primaryColor:a,secondaryColor:r,primaryGradient:s,secondaryGradient:o,gradient:l=!0,...c},d){const _=Ya(n,e),u=a??_.primary,m=r??_.secondary,p=Q.useId().replace(/:/g,""),[g,b]=s??_.primaryGradient,[C,y]=o??_.secondaryGradient;return S.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100",width:t,height:t,"aria-hidden":"true",ref:d,...c,children:[l&&S.jsxs("defs",{children:[S.jsxs("linearGradient",{id:`${p}-p`,x1:"0",y1:"0",x2:"1",y2:"0",children:[S.jsx("stop",{offset:"0",stopColor:g}),S.jsx("stop",{offset:"1",stopColor:b})]}),S.jsxs("linearGradient",{id:`${p}-s`,x1:"0",y1:"0",x2:"1",y2:"0",children:[S.jsx("stop",{offset:"0",stopColor:C}),S.jsx("stop",{offset:"1",stopColor:y})]})]}),wr.map(({y:N,secondaryWidth:O,primaryWidth:v})=>S.jsxs("g",{children:[S.jsx("rect",{x:0,y:N,width:O,height:ua,fill:l?`url(#${p}-p)`:u}),S.jsx("rect",{x:O,y:N,width:v,height:ua,fill:l?`url(#${p}-s)`:m})]},N))]})});const Ha=new Map,On=i=>Ha.get(i),an=i=>Ha.has(i),kr=/(\*\*[^*]+\*\*|`[^`]+`|\[[^\]]+\]\([^)]+\)|==[^=]+==)/g,ie=i=>i.split(kr).map((t,n)=>{const e=`${n}-${t}`;if(t.startsWith("**")&&t.endsWith("**"))return S.jsx("strong",{children:ie(t.slice(2,-2))},e);if(t.startsWith("`")&&t.endsWith("`"))return S.jsx("code",{children:t.slice(1,-1)},e);if(t.startsWith("==")&&t.endsWith("=="))return S.jsx("mark",{className:"dla-alert",children:t.slice(2,-2)},e);const a=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(t);return a?S.jsx("a",{href:a[2],target:"_blank",rel:"noopener noreferrer",children:a[1]},e):t}),Mr=i=>i.trim().split(/\n\s*\n/).map((t,n)=>S.jsx("p",{children:ie(t.trim())},`${n}-${t.slice(0,24)}`)),Lr=()=>{const{theme:i,colorMode:t}=br();return{theme:i,colorMode:t}},Pr={useTheme:Lr},Fr=Q.createContext(Pr),Va=()=>Q.useContext(Fr),za=()=>{const{useTheme:i}=Va();return i()},An=({footer:i,theme:t,index:n,total:e})=>{const{colorMode:a,theme:r}=za(),{Logo:s}=Va(),o=a==="auto"?typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a,l=Ya(r,o),c=new Date().getFullYear(),d=i.since&&i.since<c?`${i.since}–${c}`:`${c}`;return S.jsxs("div",{className:"dla-slide-footer",children:[i.logo&&S.jsx("a",{className:"dla-slide-footer-logo",href:i.href,target:"_blank",rel:"noopener noreferrer","aria-label":`${i.holder} — ${i.href}`,children:s?S.jsx(s,{height:26,variant:r,colorMode:a,inverse:t.logo.inverse,colored:t.logo.colored,primaryColor:t.logo.primaryColor??l.primary,secondaryColor:t.logo.secondaryColor??l.secondary,textColor:t.logo.textColor??l.textColor}):S.jsx("span",{className:"dla-slide-footer-holder",children:i.holder})}),i.note&&S.jsx("div",{className:"dla-slide-footer-note",children:i.note}),S.jsxs("div",{className:"dla-slide-footer-legal",children:[S.jsx("a",{href:i.href,target:"_blank",rel:"noopener noreferrer",children:i.href.replace(/^https?:\/\//,"")}),S.jsxs("span",{children:["© ",d," ",i.holder]}),i.slideNumbers&&S.jsxs("span",{className:"dla-slide-footer-number",children:[n," / ",e]})]})]})},In=({name:i})=>{if(!i)return null;const t=On(i);return t?S.jsx("div",{className:"dla-slide-backdrop","aria-hidden":!0,children:S.jsx(t,{})}):null},Le=({theme:i,footer:t,index:n,total:e,eyebrow:a,title:r,subtitle:s,layout:o,variant:l,backdrop:c,children:d})=>{const _=["dla-slide"];return l&&_.push(`dla-slide--${l}`),(o==="centered"||o==="full-bleed")&&_.push(`dla-slide--${o}`),S.jsxs("div",{className:_.join(" "),children:[S.jsx(In,{name:c}),S.jsxs("div",{className:"dla-slide-head",children:[a&&S.jsx("div",{className:"dla-slide-eyebrow",children:a}),r&&S.jsx("h2",{className:"dla-slide-title",children:ie(r)}),s&&S.jsx("p",{className:"dla-slide-subtitle",children:ie(s)})]}),S.jsx("div",{className:"dla-slide-body",children:d}),t&&S.jsx(An,{footer:t,theme:i,index:n,total:e})]})};var jt=(i,t)=>{for(let n in t)i[n]=t[n];return i},j=(i,t)=>Array.from(i.querySelectorAll(t)),Mn=(i,t,n)=>{n?i.classList.add(t):i.classList.remove(t)},$t=i=>{if(typeof i=="string"){if(i==="null")return null;if(i==="true")return!0;if(i==="false")return!1;if(i.match(/^-?[\d\.]+$/))return parseFloat(i)}return i},Rt=(i,t)=>{i.style.transform=t},Cn=(i,t)=>{let n=i.matches||i.matchesSelector||i.msMatchesSelector;return!!(n&&n.call(i,t))},De=(i,t)=>{if(i&&typeof i.closest=="function")return i.closest(t);for(;i;){if(Cn(i,t))return i;i=i.parentElement}return null},qa=i=>{i=i||document.documentElement;let t=i.requestFullscreen||i.webkitRequestFullscreen||i.webkitRequestFullScreen||i.mozRequestFullScreen||i.msRequestFullscreen;t&&t.apply(i)},Ur=(i,t,n,e="")=>{let a=i.querySelectorAll("."+n);for(let s=0;s<a.length;s++){let o=a[s];if(o.parentNode===i)return o}let r=document.createElement(t);return r.className=n,r.innerHTML=e,i.appendChild(r),r},Hn=i=>{let t=document.createElement("style");return i&&i.length>0&&t.appendChild(document.createTextNode(i)),document.head.appendChild(t),t},pa=()=>{let i={};location.search.replace(/[A-Z0-9]+?=([\w\.%-]*)/gi,t=>{let n=t.split("=").shift(),e=t.split("=").pop();return n&&e!==void 0&&(i[n]=e),t});for(let t in i){let n=i[t];i[t]=$t(unescape(n))}return i.dependencies!==void 0&&delete i.dependencies,i},Br=(i,t=0)=>{if(i){var n;let e,a=i.style.height;return i.style.height="0px",i.parentElement&&(i.parentElement.style.height="auto"),e=t-(((n=i.parentElement)==null?void 0:n.offsetHeight)||0),i.style.height=a+"px",i.parentElement&&i.parentElement.style.removeProperty("height"),e}return t},Gr={mp4:"video/mp4",m4a:"video/mp4",ogv:"video/ogg",mpeg:"video/mpeg",webm:"video/webm"},Yr=(i="")=>{let t=i.split(".").pop();return t?Gr[t]:void 0},Hr=(i="")=>encodeURI(i).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),$a=navigator.userAgent,Lt=/(iphone|ipod|ipad|android)/gi.test($a)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,ja=/android/gi.test($a),Vr=(function(i){if(i){var t=function(R){return[].slice.call(R)},n=0,e=1,a=2,r=3,s=[],o=null,l="requestAnimationFrame"in i?function(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{sync:!1};i.cancelAnimationFrame(o);var U=function(){return d(s.filter((function(z){return z.dirty&&z.active})))};if(R.sync)return U();o=i.requestAnimationFrame(U)}:function(){},c=function(R){return function(U){s.forEach((function(z){return z.dirty=R})),l(U)}},d=function(R){R.filter((function(z){return!z.styleComputed})).forEach((function(z){z.styleComputed=p(z)})),R.filter(g).forEach(b);var U=R.filter(m);U.forEach(u),U.forEach((function(z){b(z),_(z)})),U.forEach(C)},_=function(R){return R.dirty=n},u=function(R){R.availableWidth=R.element.parentNode.clientWidth,R.currentWidth=R.element.scrollWidth,R.previousFontSize=R.currentFontSize,R.currentFontSize=Math.min(Math.max(R.minSize,R.availableWidth/R.currentWidth*R.previousFontSize),R.maxSize),R.whiteSpace=R.multiLine&&R.currentFontSize===R.minSize?"normal":"nowrap"},m=function(R){return R.dirty!==a||R.dirty===a&&R.element.parentNode.clientWidth!==R.availableWidth},p=function(R){var U=i.getComputedStyle(R.element,null);return R.currentFontSize=parseFloat(U.getPropertyValue("font-size")),R.display=U.getPropertyValue("display"),R.whiteSpace=U.getPropertyValue("white-space"),!0},g=function(R){var U=!1;return!R.preStyleTestCompleted&&(/inline-/.test(R.display)||(U=!0,R.display="inline-block"),R.whiteSpace!=="nowrap"&&(U=!0,R.whiteSpace="nowrap"),R.preStyleTestCompleted=!0,U)},b=function(R){R.element.style.whiteSpace=R.whiteSpace,R.element.style.display=R.display,R.element.style.fontSize=R.currentFontSize+"px"},C=function(R){R.element.dispatchEvent(new CustomEvent("fit",{detail:{oldValue:R.previousFontSize,newValue:R.currentFontSize,scaleFactor:R.currentFontSize/R.previousFontSize}}))},y=function(R,U){return function(z){R.dirty=U,R.active&&l(z)}},N=function(R){return function(){s=s.filter((function(U){return U.element!==R.element})),R.observeMutations&&R.observer.disconnect(),R.element.style.whiteSpace=R.originalStyle.whiteSpace,R.element.style.display=R.originalStyle.display,R.element.style.fontSize=R.originalStyle.fontSize}},O=function(R){return function(){R.active||(R.active=!0,l())}},v=function(R){return function(){return R.active=!1}},A=function(R){R.observeMutations&&(R.observer=new MutationObserver(y(R,e)),R.observer.observe(R.element,R.observeMutations))},M={minSize:16,maxSize:512,multiLine:!0,observeMutations:"MutationObserver"in i&&{subtree:!0,childList:!0,characterData:!0}},F=null,Y=function(){i.clearTimeout(F),F=i.setTimeout(c(a),B.observeWindowDelay)},x=["resize","orientationchange"];return Object.defineProperty(B,"observeWindow",{set:function(R){var U=`${R?"add":"remove"}EventListener`;x.forEach((function(z){i[U](z,Y)}))}}),B.observeWindow=!0,B.observeWindowDelay=100,B.fitAll=c(r),B}function K(R,U){var z=Object.assign({},M,U),Z=R.map((function(te){var se=Object.assign({},z,{element:te,active:!0});return(function(ae){ae.originalStyle={whiteSpace:ae.element.style.whiteSpace,display:ae.element.style.display,fontSize:ae.element.style.fontSize},A(ae),ae.newbie=!0,ae.dirty=!0,s.push(ae)})(se),{element:te,fit:y(se,r),unfreeze:O(se),freeze:v(se),unsubscribe:N(se)}}));return l(),Z}function B(R){var U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return typeof R=="string"?K(t(document.querySelectorAll(R)),U):K([R],U)[0]}})(typeof window>"u"?null:window);function ln(i){"@babel/helpers - typeof";return ln=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ln(i)}function zr(i,t){if(ln(i)!="object"||!i)return i;var n=i[Symbol.toPrimitive];if(n!==void 0){var e=n.call(i,t);if(ln(e)!="object")return e;throw TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}function qr(i){var t=zr(i,"string");return ln(t)=="symbol"?t:t+""}function Kn(i,t,n){return(t=qr(t))in i?Object.defineProperty(i,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):i[t]=n,i}var $r=class{constructor(t){Kn(this,"allowedToPlayAudio",null),this.Reveal=t,this.startEmbeddedMedia=this.startEmbeddedMedia.bind(this),this.startEmbeddedIframe=this.startEmbeddedIframe.bind(this),this.preventIframeAutoFocus=this.preventIframeAutoFocus.bind(this),this.ensureMobileMediaPlaying=this.ensureMobileMediaPlaying.bind(this),this.failedAudioPlaybackTargets=new Set,this.failedVideoPlaybackTargets=new Set,this.failedMutedVideoPlaybackTargets=new Set,this.renderMediaPlayButton()}renderMediaPlayButton(){this.mediaPlayButton=document.createElement("button"),this.mediaPlayButton.className="r-overlay-button r-media-play-button",this.mediaPlayButton.addEventListener("click",()=>{this.resetTemporarilyMutedMedia(),new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(t=>{this.startEmbeddedMedia({target:t})}),this.clearMediaPlaybackErrors()})}shouldPreload(t){if(this.Reveal.isScrollView())return!0;let n=this.Reveal.getConfig().preloadIframes;return typeof n!="boolean"&&(n=t.hasAttribute("data-preload")),n}load(t,n={}){let e=this.Reveal.getConfig().display;if(e.includes("!important")){let r=e.replace(/\s*!important\s*$/,"").trim();t.style.setProperty("display",r,"important")}else t.style.display=e;j(t,"img[data-src], video[data-src], audio[data-src], iframe[data-src]").forEach(r=>{let s=r.tagName==="IFRAME";(!s||this.shouldPreload(r))&&(r.setAttribute("src",r.getAttribute("data-src")),r.setAttribute("data-lazy-loaded",""),r.removeAttribute("data-src"),s&&r.addEventListener("load",this.preventIframeAutoFocus))}),j(t,"video, audio").forEach(r=>{let s=0;j(r,"source[data-src]").forEach(o=>{o.setAttribute("src",o.getAttribute("data-src")),o.removeAttribute("data-src"),o.setAttribute("data-lazy-loaded",""),s+=1}),Lt&&r.tagName==="VIDEO"&&r.setAttribute("playsinline",""),s>0&&r.load()});let a=t.slideBackgroundElement;if(a){a.style.display="block";let r=t.slideBackgroundContentElement,s=t.getAttribute("data-background-iframe");if(a.hasAttribute("data-loaded")===!1){a.setAttribute("data-loaded","true");let l=t.getAttribute("data-background-image"),c=t.getAttribute("data-background-video"),d=t.hasAttribute("data-background-video-loop"),_=t.hasAttribute("data-background-video-muted");if(l)/^data:/.test(l.trim())?r.style.backgroundImage=`url(${l.trim()})`:r.style.backgroundImage=l.split(",").map(u=>`url(${Hr(decodeURI(u.trim()))})`).join(",");else if(c){let u=document.createElement("video");d&&u.setAttribute("loop",""),(_||this.Reveal.isSpeakerNotes())&&(u.muted=!0),Lt&&u.setAttribute("playsinline",""),c.split(",").forEach(m=>{let p=document.createElement("source");p.setAttribute("src",m);let g=Yr(m);g&&p.setAttribute("type",g),u.appendChild(p)}),r.appendChild(u)}else if(s&&n.excludeIframes!==!0){let u=document.createElement("iframe");u.setAttribute("allowfullscreen",""),u.setAttribute("mozallowfullscreen",""),u.setAttribute("webkitallowfullscreen",""),u.setAttribute("allow","autoplay"),u.setAttribute("data-src",s),u.style.width="100%",u.style.height="100%",u.style.maxHeight="100%",u.style.maxWidth="100%",r.appendChild(u)}}let o=r.querySelector("iframe[data-src]");o&&this.shouldPreload(a)&&!/autoplay=(1|true|yes)/gi.test(s)&&o.getAttribute("src")!==s&&o.setAttribute("src",s)}this.layout(t)}layout(t){Array.from(t.querySelectorAll(".r-fit-text")).forEach(n=>{Vr(n,{minSize:24,maxSize:this.Reveal.getConfig().height*.8,observeMutations:!1,observeWindow:!1})})}unload(t){t.style.display="none";let n=this.Reveal.getSlideBackground(t);n&&(n.style.display="none",j(n,"iframe[src]").forEach(e=>{e.removeAttribute("src")})),j(t,"video[data-lazy-loaded][src], audio[data-lazy-loaded][src], iframe[data-lazy-loaded][src]").forEach(e=>{e.setAttribute("data-src",e.getAttribute("src")),e.removeAttribute("src")}),j(t,"video[data-lazy-loaded] source[src], audio source[src]").forEach(e=>{e.setAttribute("data-src",e.getAttribute("src")),e.removeAttribute("src")})}formatEmbeddedContent(){let t=(n,e,a)=>{j(this.Reveal.getSlidesElement(),"iframe["+n+'*="'+e+'"]').forEach(r=>{let s=r.getAttribute(n);s&&s.indexOf(a)===-1&&r.setAttribute(n,s+(/\?/.test(s)?"&":"?")+a)})};t("src","youtube.com/embed/","enablejsapi=1"),t("data-src","youtube.com/embed/","enablejsapi=1"),t("src","player.vimeo.com/","api=1"),t("data-src","player.vimeo.com/","api=1")}startEmbeddedContent(t){if(t){let n=this.Reveal.isSpeakerNotes();j(t,'img[src$=".gif"]').forEach(e=>{e.setAttribute("src",e.getAttribute("src"))}),j(t,"video, audio").forEach(e=>{if(De(e,".fragment")&&!De(e,".fragment.visible"))return;let a=this.Reveal.getConfig().autoPlayMedia;if(typeof a!="boolean"&&(a=e.hasAttribute("data-autoplay")||!!De(e,".slide-background")),a&&typeof e.play=="function"){if(n&&!e.muted)return;e.readyState>1?this.startEmbeddedMedia({target:e}):Lt?(e.addEventListener("canplay",this.ensureMobileMediaPlaying),this.playMediaElement(e)):(e.removeEventListener("loadeddata",this.startEmbeddedMedia),e.addEventListener("loadeddata",this.startEmbeddedMedia))}}),n||(j(t,"iframe[src]").forEach(e=>{De(e,".fragment")&&!De(e,".fragment.visible")||this.startEmbeddedIframe({target:e})}),j(t,"iframe[data-src]").forEach(e=>{De(e,".fragment")&&!De(e,".fragment.visible")||e.getAttribute("src")!==e.getAttribute("data-src")&&(e.removeEventListener("load",this.startEmbeddedIframe),e.addEventListener("load",this.startEmbeddedIframe),e.setAttribute("src",e.getAttribute("data-src")))}))}}ensureMobileMediaPlaying(t){let n=t.target;typeof n.getVideoPlaybackQuality=="function"&&setTimeout(()=>{let e=n.paused===!1,a=n.getVideoPlaybackQuality().totalVideoFrames;e&&a===0&&(n.load(),n.play())},1e3)}startEmbeddedMedia(t){let n=!!De(t.target,"html"),e=!!De(t.target,".present");n&&e&&(t.target.paused||t.target.ended)&&(t.target.currentTime=0,this.playMediaElement(t.target)),t.target.removeEventListener("loadeddata",this.startEmbeddedMedia)}playMediaElement(t){let n=t.play();n&&typeof n.catch=="function"&&n.then(()=>{t.muted||(this.allowedToPlayAudio=!0)}).catch(e=>{if(e.name==="NotAllowedError")if(this.allowedToPlayAudio=!1,t.tagName==="VIDEO"){this.onVideoPlaybackNotAllowed(t);let a=!!De(t,"html"),r=!!De(t,".present"),s=t.muted;a&&r&&!s&&(t.setAttribute("data-muted-by-reveal","true"),t.muted=!0,t.play().catch(()=>{this.onMutedVideoPlaybackNotAllowed(t)}))}else t.tagName==="AUDIO"&&this.onAudioPlaybackNotAllowed(t)})}startEmbeddedIframe(t){let n=t.target;if(this.preventIframeAutoFocus(t),n&&n.contentWindow){let e=!!De(t.target,"html"),a=!!De(t.target,".present");if(e&&a){let r=this.Reveal.getConfig().autoPlayMedia;typeof r!="boolean"&&(r=n.hasAttribute("data-autoplay")||!!De(n,".slide-background")),/youtube\.com\/embed\//.test(n.getAttribute("src"))&&r?n.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*"):/player\.vimeo\.com\//.test(n.getAttribute("src"))&&r?n.contentWindow.postMessage('{"method":"play"}',"*"):n.contentWindow.postMessage("slide:start","*")}}}stopEmbeddedContent(t,n={}){n=jt({unloadIframes:!0},n),t&&t.parentNode&&(j(t,"video, audio").forEach(e=>{!e.hasAttribute("data-ignore")&&typeof e.pause=="function"&&(e.setAttribute("data-paused-by-reveal",""),e.pause(),Lt&&e.removeEventListener("canplay",this.ensureMobileMediaPlaying))}),j(t,"iframe").forEach(e=>{e.contentWindow&&e.contentWindow.postMessage("slide:stop","*"),e.removeEventListener("load",this.preventIframeAutoFocus),e.removeEventListener("load",this.startEmbeddedIframe)}),j(t,'iframe[src*="youtube.com/embed/"]').forEach(e=>{!e.hasAttribute("data-ignore")&&e.contentWindow&&typeof e.contentWindow.postMessage=="function"&&e.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}),j(t,'iframe[src*="player.vimeo.com/"]').forEach(e=>{!e.hasAttribute("data-ignore")&&e.contentWindow&&typeof e.contentWindow.postMessage=="function"&&e.contentWindow.postMessage('{"method":"pause"}',"*")}),n.unloadIframes===!0&&j(t,"iframe[data-src]").forEach(e=>{e.setAttribute("src","about:blank"),e.removeAttribute("src")}))}isAllowedToPlayAudio(){return this.allowedToPlayAudio}showPlayOrUnmuteButton(){let t=this.failedAudioPlaybackTargets.size,n=this.failedVideoPlaybackTargets.size,e=this.failedMutedVideoPlaybackTargets.size,a="Play media";e>0?a="Play video":n>0?a="Unmute video":t>0&&(a="Play audio"),this.mediaPlayButton.textContent=a,this.Reveal.getRevealElement().appendChild(this.mediaPlayButton)}onAudioPlaybackNotAllowed(t){this.failedAudioPlaybackTargets.add(t),this.showPlayOrUnmuteButton(t)}onVideoPlaybackNotAllowed(t){this.failedVideoPlaybackTargets.add(t),this.showPlayOrUnmuteButton()}onMutedVideoPlaybackNotAllowed(t){this.failedMutedVideoPlaybackTargets.add(t),this.showPlayOrUnmuteButton()}resetTemporarilyMutedMedia(){new Set([...this.failedAudioPlaybackTargets,...this.failedVideoPlaybackTargets,...this.failedMutedVideoPlaybackTargets]).forEach(t=>{t.hasAttribute("data-muted-by-reveal")&&(t.muted=!1,t.removeAttribute("data-muted-by-reveal"))})}clearMediaPlaybackErrors(){this.resetTemporarilyMutedMedia(),this.failedAudioPlaybackTargets.clear(),this.failedVideoPlaybackTargets.clear(),this.failedMutedVideoPlaybackTargets.clear(),this.mediaPlayButton&&this.mediaPlayButton.parentNode&&this.mediaPlayButton.remove()}preventIframeAutoFocus(t){let n=t.target;if(n&&this.Reveal.getConfig().preventIframeAutoFocus){let e=0,a=()=>{document.activeElement===n?document.activeElement.blur():e<1e3&&(e+=100,setTimeout(a,100))};setTimeout(a,100)}}afterSlideChanged(){this.clearMediaPlaybackErrors()}},Nt=".slides section",ht=".slides>section",Ln=".slides>section.present>section",jr=".backgrounds>.slide-background",Wr=/registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview|previewIframe/,Qr=class{constructor(t){this.Reveal=t}render(){this.element=document.createElement("div"),this.element.className="slide-number",this.Reveal.getRevealElement().appendChild(this.element)}configure(t,n){let e="none";t.slideNumber&&!this.Reveal.isPrintView()&&(t.showSlideNumber==="all"||t.showSlideNumber==="speaker"&&this.Reveal.isSpeakerNotes())&&(e="block"),this.element.style.display=e}update(){this.Reveal.getConfig().slideNumber&&this.element&&(this.element.innerHTML=this.getSlideNumber())}getSlideNumber(t=this.Reveal.getCurrentSlide()){let n=this.Reveal.getConfig(),e,a="h.v";if(typeof n.slideNumber=="function")e=n.slideNumber(t);else{typeof n.slideNumber=="string"&&(a=n.slideNumber),!/c/.test(a)&&this.Reveal.getHorizontalSlides().length===1&&(a="c");let s=t&&t.dataset.visibility==="uncounted"?0:1;switch(e=[],a){case"c":e.push(this.Reveal.getSlidePastCount(t)+s);break;case"c/t":e.push(this.Reveal.getSlidePastCount(t)+s,"/",this.Reveal.getTotalSlides());break;default:let o=this.Reveal.getIndices(t);e.push(o.h+s);let l=a==="h/v"?"/":".";this.Reveal.isVerticalSlide(t)&&e.push(l,o.v+1)}}let r="#"+this.Reveal.location.getHash(t);return this.formatNumber(e[0],e[1],e[2],r)}formatNumber(t,n,e,a="#"+this.Reveal.location.getHash()){return typeof e=="number"&&!isNaN(e)?`<a href="${a}">
|
|
2
2
|
<span class="slide-number-a">${t}</span>
|
|
3
3
|
<span class="slide-number-delimiter">${n}</span>
|
|
4
4
|
<span class="slide-number-b">${e}</span>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{p as b,q as v,y as E,r as I,j as i,B as m,T as N,
|
|
1
|
+
import{p as b,q as v,y as E,r as I,j as i,B as m,T as N,b$ as j,c0 as T,c1 as U}from"../datalayer-app-main.js";import{EphemeralDocument as O}from"./EphemeralDocument-DVAfnQWS.js";import{O as _,b as P,u as D}from"./openingNotebook-Dz1CMX0P.js";import{P as d}from"./PrismCss-u5utqjht.js";import"./lexicalHooks-PS_v7JyS.js";import"./LexicalToolRegistry-DoZIM1lF.js";import"./useProgressTask-DDbgXluG.js";import"./JupyterLexicalExtension-CEjN8cLT.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./url-DEeTWrO-.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./VideoIcon-BjP_LDa4.js";import"./LinkIcon-DUI0jw25.js";import"./Toolbar-BxAi9T92.js";import"./ArrowUpIcon-BUCpIXDR.js";import"./SortDescIcon-CS4EzHeS.js";const M="Quarterly revenue by region",S="Six rows of revenue, two quarters, three regions. The cell below loads them and shows the frame; run it, change it, or ask an agent to take it further — the code and its output live in this document, beside the words about them.",l="opening-document-input",w="opening-document-output",g=e=>({detail:0,format:0,mode:"normal",style:"",text:e,type:"text",version:1}),p=(e,o,t={})=>({children:o,direction:"ltr",format:"",indent:0,type:e,version:1,...t}),h={type:"linebreak",version:1},s=(e,o)=>({detail:0,format:0,mode:"normal",style:"",text:e,type:"jupyter-input-highlight",version:1,highlightType:o}),f=e=>e.flatMap(o=>{if(typeof o=="string")return o.split(`
|
|
2
2
|
`).flatMap((r,c)=>[...c>0?[h]:[],...r.length>0?[s(r)]:[]]);const{content:t,type:n}=o;return typeof t=="string"?[s(t,n)]:Array.isArray(t)?t.length===1&&typeof t[0]=="string"?[s(t[0],n)]:f(t):[]}),k=e=>{const o=d.languages.python;return o?f(d.tokenize(e,o)):e.split(`
|
|
3
3
|
`).flatMap((t,n)=>[...n>0?[h]:[],...t.length>0?[s(t)]:[]])};function A(){const e=_.join("");return{root:{children:[p("heading",[g(M)],{tag:"h1"}),p("paragraph",[g(S)],{textFormat:0,textStyle:""}),p("jupyter-input",k(e),{language:"python",jupyterInputNodeUuid:l}),{type:"jupyter-output",version:1,format:"",source:e,outputs:[{output_type:"execute_result",execution_count:1,data:{"text/plain":P},metadata:{}}],jupyterInputNodeUuid:l,jupyterOutputNodeUuid:w}],direction:"ltr",format:"",indent:0,type:"root",version:1}}}function tt({workspace:e}){const o=b(),t=v(o.snapshot),n=e.surfaceId,r=D(T,j,{workspace:e,editorId:n}),a=E(U)[0]?.value,y=I.useMemo(()=>JSON.stringify((a?.document??A)()),[a]),x=a?.autoFocus??!0;if(t.state!=="running")return i.jsx(m,{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.muted",fontSize:1,px:4,textAlign:"center",children:i.jsx(N,{children:"The document needs a running sandbox for its code blocks. Open the Sandbox view to see what it is doing."})});const u=o.getServiceManager()??void 0;return i.jsx(m,{height:"100%",minHeight:0,children:i.jsx(O,{inheritTheme:!0,documentId:n,content:y,autoFocus:x,serviceManager:u,showToolbar:r.present,toolbarExtraItems:r.items,kernelId:u?t.kernelId:void 0,runtimeOverride:!u&&t.jupyterUrl?{baseUrl:t.jupyterUrl,token:t.jupyterToken}:void 0})})}export{tt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,ax as ke,ay as Se,az as je,aA as we,aB as ve,j as e,B as M,aC as Ce,aD as Ee,aE as be,aF as Re,aG as V,l as G,aH as Me,aI as Te,aJ as Ne,G as T,aK as Pe,aL as K,aM as $,aN as De,aO as Ue}from"../datalayer-app-main.js";import{useLexicalTools as He}from"./lexicalHooks-PS_v7JyS.js";import{u as Be}from"./useProgressTask-DDbgXluG.js";import{L as Ie,j as Le,T as Ae,k as We,l as Fe,m as Je,D as q,n as _e,o as ze,p as Ve,q as Ge,J as Ke,s as $e,F as qe,t as Ye,u as Qe,v as Xe,w as Ze}from"./JupyterLexicalExtension-
|
|
1
|
+
import{r,ax as ke,ay as Se,az as je,aA as we,aB as ve,j as e,B as M,aC as Ce,aD as Ee,aE as be,aF as Re,aG as V,l as G,aH as Me,aI as Te,aJ as Ne,G as T,aK as Pe,aL as K,aM as $,aN as De,aO as Ue}from"../datalayer-app-main.js";import{useLexicalTools as He}from"./lexicalHooks-PS_v7JyS.js";import{u as Be}from"./useProgressTask-DDbgXluG.js";import{L as Ie,j as Le,T as Ae,k as We,l as Fe,m as Je,D as q,n as _e,o as ze,p as Ve,q as Ge,J as Ke,s as $e,F as qe,t as Ye,u as Qe,v as Xe,w as Ze}from"./JupyterLexicalExtension-CEjN8cLT.js";import"./LexicalToolRegistry-DoZIM1lF.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./url-DEeTWrO-.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./VideoIcon-BjP_LDa4.js";import"./LinkIcon-DUI0jw25.js";import"./Toolbar-BxAi9T92.js";import"./ArrowUpIcon-BUCpIXDR.js";import"./SortDescIcon-CS4EzHeS.js";import"./PrismCss-u5utqjht.js";function Oe({content:s}){const[i]=T(),l=r.useRef(!0);return r.useEffect(()=>{if(l.current){if(l.current=!1,!s){i.update(()=>{const t=K();t.getChildrenSize()===0&&t.append($())},{tag:"history-merge"});return}try{const t=JSON.parse(s);if(t&&typeof t=="object"&&t.root){const m=i.parseEditorState(s);i.setEditorState(m,{tag:"history-merge"})}else throw new Error("Invalid Lexical editor state format")}catch{i.update(()=>{const t=K();t.clear(),t.append($())},{tag:"history-merge"})}}},[s,i]),null}function et({disabled:s}){const[i]=T();return r.useEffect(()=>{Pe(i,De).output.disabled.value=s},[i,s]),null}function tt({setIsLinkEditMode:s,extraItems:i}){const[l]=T(),[t,m]=r.useState(l);return e.jsx(Ze,{editor:l,activeEditor:t,setActiveEditor:m,setIsLinkEditMode:s,extraItems:i})}function Y({inherit:s,colorMode:i,themeConfig:l,children:t}){return s?e.jsx(e.Fragment,{children:t}):e.jsx(Te,{colorMode:i,theme:l.primerTheme,themeStyles:l.themeStyles,children:t})}function St({documentId:s,runtimeName:i,runtimeOverride:l,serviceManager:t,kernelId:m,themeVariant:Q,colorMode:X,content:N,onContentChange:w,onToolsReady:P,onKernelChange:v,collaboration:n,toolbarExtraItems:Z,showToolbar:O=!0,inheritTheme:D=!1,autoFocus:U=!0}){const h=!!(n?.websocketUrl&&n?.roomId),ee=n?.identity?.displayName||n?.identity?.handle||n?.identity?.userId,te=n?.identity?.color,ne=r.useMemo(()=>({user:{id:n?.identity?.userId,username:n?.identity?.userId||n?.identity?.handle||n?.identity?.displayName,name:n?.identity?.handle||n?.identity?.displayName,display_name:n?.identity?.displayName||n?.identity?.handle,initials:n?.identity?.initials,color:n?.identity?.color,avatar_url:n?.identity?.avatarUrl,handle:n?.identity?.handle}}),[n?.identity]),H=r.useRef(N),B=r.useRef(s);B.current!==s&&(B.current=s,H.current=N);const I=H.current,L=r.useRef(I??""),A=He(s);r.useEffect(()=>{P?.(A)},[A,P]);const{runtimes:W,refetchRuntimes:C}=ke(),d=r.useMemo(()=>{const o=String(l?.baseUrl||"").trim();if(o)return{url:o,wsUrl:String(l?.wsUrl||"").trim()||void 0,token:String(l?.token||"").trim(),runtime_name:String(l?.runtimeName||"").trim()||"agent-node-proxy"};const a=String(i||"").trim();if(a)return W.find(j=>String(j?.runtime_name||"")===a)},[l,i,W]),F=!!(!l?.baseUrl&&String(i||"").trim()&&!d);r.useEffect(()=>{if(!F)return;C();const o=window.setInterval(()=>{C()},1e3);return()=>{window.clearInterval(o)}},[F,C]);const[re,g]=r.useState(null),[x,f]=r.useState(void 0);r.useEffect(()=>{let o=!1,a=null,j=null;return(async()=>{if(t){try{await t.ready;const u=m?t.kernels.connectTo({model:{id:m,name:"python"}}):await t.kernels.startNew();o||(g(t),f(new V({kernelName:u.model.name,kernelSpecName:u.model.name,kernelModel:u.model,kernelManager:t.kernels,kernelspecsManager:t.kernelspecs,sessionManager:t.sessions})))}catch(u){console.error("[agent-runtimes] The document could not reach the kernel of the sandbox it was given.",u),o||(g(null),f(void 0))}return}const b=String(d?.url||"").trim();if(!b){o||(g(null),f(void 0));return}try{const u=String(d?.token||"").trim(),xe=String(d?.wsUrl||"").trim()||b.replace(/^http/,"ws"),pe=G.ServerConnection.makeSettings({baseUrl:b,wsUrl:xe,token:u,appendToken:!0});a=new G.ServiceManager({serverSettings:pe}),j=Me(String(d?.runtime_name||""),a),await a.ready;const R=await a.kernels.startNew();if(!o){const ye=new V({kernelName:R.model.name,kernelSpecName:R.model.name,kernelModel:R.model,kernelManager:a.kernels,kernelspecsManager:a.kernelspecs,sessionManager:a.sessions});g(a),f(ye)}}catch{o||(g(null),f(void 0))}})(),()=>{o=!0,j?.(),a&&Ue(a)}},[t,m,d?.runtime_name,d?.url,d?.token]),r.useEffect(()=>(v?.(x?.connection??null),()=>{v?.(null)}),[x,v]);const E=re,J=!!((String(i||"").trim()||String(l?.baseUrl||"").trim()||t)&&!E);Be(`ephemeral-document-start-${s}`,J);const se=r.useMemo(()=>Se({name:"@datalayer/agent-runtimes/EphemeralDocument",namespace:`ephemeral-document-${s}`,theme:Xe,dependencies:[Qe,...U?[Ne]:[]],onError(o){console.error("[EphemeralDocument]",o)}}),[s,U]),oe=r.useCallback(o=>{if(!w)return;const a=JSON.stringify(o.toJSON());a!==L.current&&(L.current=a,w(a))},[w]),[p,ie]=r.useState(null),[,_]=r.useState(!1),y=h?n?.roomId:void 0,[ae,le]=r.useState(),ce=y===void 0||ae===y,de=r.useCallback(o=>le(o?y:void 0),[y]),me=o=>{o!==null&&ie(o)},{colorMode:ue,theme:he}=je(),k=X??ue,ge=Q??he,fe=we(),S=ve(ge),z=k==="auto"?fe:k,c=(z==="dark"?S.themeStyles.dark:S.themeStyles.light).backgroundColor??"";return e.jsx(M,{flex:1,minHeight:0,height:"100%",position:"relative",overflow:"hidden",bg:"canvas.default",children:E?e.jsx(Y,{inherit:D,colorMode:k,themeConfig:S,children:e.jsx(Ce,{colormode:z,backgroundColor:c,children:e.jsx(M,{sx:{position:"absolute",inset:0,display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden",overscrollBehaviorY:"contain",padding:2,backgroundColor:c,"--bgColor-default":c,"& .editor-shell":{backgroundColor:c,borderRadius:2,display:"flex",flexDirection:"column",minHeight:0,flex:1,maxWidth:"none",width:"100%",margin:0},"& .editor-container":{backgroundColor:c,display:"flex",flexDirection:"column",minHeight:0,flex:1,width:"100%",maxWidth:"none",margin:0},"& .editor-inner":{backgroundColor:c,display:"flex",flexDirection:"column",minHeight:0,flex:1,width:"100%",maxWidth:"none"},"& .editor-scroller":{minHeight:0,flex:1,overflow:"auto",width:"100%",maxWidth:"none"},"& .editor":{minHeight:"100%",width:"100%",maxWidth:"none",margin:0},"& .editor-input":{backgroundColor:c,width:"100%",maxWidth:"none",margin:0},"& .ContentEditable__root":{width:"100%",maxWidth:"none",margin:0},'& [role="toolbar"][aria-label="Editor toolbar"]':{backgroundColor:c}},children:e.jsx(Ie,{lexicalId:s,serviceManager:E,children:e.jsx(Ee,{extension:se,contentEditable:null,children:e.jsx(Le,{children:e.jsx(Ae,{children:e.jsxs("div",{className:"editor-shell",children:[O?e.jsx(tt,{setIsLinkEditMode:_,extraItems:Z}):null,e.jsx("div",{className:"editor-container",children:e.jsxs("div",{className:"editor-inner",children:[h&&n?e.jsx(We,{id:n.roomId,providerFactory:Fe,websocketUrl:n.websocketUrl,shouldBootstrap:!0,showCollaborators:!0,username:ee,cursorColor:te,awarenessData:ne,onInitialization:de}):null,e.jsx(Je,{}),ce?e.jsx("div",{className:"editor-scroller",children:e.jsx("div",{className:"editor",ref:me,children:e.jsx(be,{className:"editor-input","aria-label":"Ephemeral document editor"})})}):e.jsx(q,{maxWidth:"100%"}),!h&&e.jsx(Re,{onChange:oe}),e.jsx(et,{disabled:h}),!h&&e.jsx(Oe,{content:I}),e.jsx(_e,{}),e.jsx(ze,{}),e.jsx(Ve,{}),e.jsx(Ge,{kernel:x}),e.jsx(Ke,{kernel:x}),p&&e.jsxs(e.Fragment,{children:[e.jsx($e,{anchorElem:p}),e.jsx(qe,{anchorElem:p,setIsLinkEditMode:_}),e.jsx(Ye,{anchorElem:p})]})]})})]})})})})})})})}):J?e.jsx(Y,{inherit:D,colorMode:k,themeConfig:S,children:e.jsx(M,{position:"absolute",inset:0,display:"flex",flexDirection:"column",padding:2,backgroundColor:c,children:e.jsx(q,{label:"Starting the document",maxWidth:"100%"})})}):null})}export{St as EphemeralDocument,St as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cj as O,b9 as Ee,l as x,cg as N,b8 as be,eE as _e,eF as Ce,eG as Re,r as f,eH as ne,ax as Me,eI as Ue,j as v,az as je,aA as qe,aB as Te,B as Q,aC as Ae,aH as Ie,aI as Ne,aO as Oe}from"../datalayer-app-main.js";import{u as Le}from"./useProgressTask-DDbgXluG.js";import{a as Be}from"./NotebookToolbar-
|
|
1
|
+
import{cj as O,b9 as Ee,l as x,cg as N,b8 as be,eE as _e,eF as Ce,eG as Re,r as f,eH as ne,ax as Me,eI as Ue,j as v,az as je,aA as qe,aB as Te,B as Q,aC as Ae,aH as Ie,aI as Ne,aO as Oe}from"../datalayer-app-main.js";import{u as Le}from"./useProgressTask-DDbgXluG.js";import{a as Be}from"./NotebookToolbar-Dv7QkxKA.js";import{C as De,a as Je,N as Pe}from"./CellSidebarExtension-BWsHtuqs.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-BxAi9T92.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./renderer-jz0zn1Az.js";import"./SquareIcon-e3ygcjpv.js";const H="jupyter_server_nbmodel",$e=new WeakSet;function We(e){return $e.has(e)}function re(e){const n=e.model.getMetadata(H);return n?.kernelId&&n.requestId&&n.requestUrl?n:void 0}function oe(e,n){e.model.setMetadata(H,n)}function Z(e){e.model.deleteMetadata(H)}function se(e){return(typeof e=="string"?JSON.parse(e):e).reduce((r,t)=>{const o=r[r.length-1];if(t.output_type==="stream"&&o?.output_type==="stream"&&o.name===t.name){const s=Array.isArray(o.text)?o.text.join(""):o.text??"",a=Array.isArray(t.text)?t.text.join(""):t.text??"";o.text=s+a}else r.push(t);return r},[])}function j(e){return Array.isArray(e.text)?e.text.join(""):e.text??""}function Ke(e,n){return e?.output_type==="stream"&&n?.output_type==="stream"&&e.name===n.name&&j(n).startsWith(j(e))}function He(e,n){return e.length>n.length?!1:e.every((r,t)=>O.deepEqual(r,n[t])||t===e.length-1&&Ke(r,n[t]))}function Fe(e,n){const r=Math.min(e.length,n.length);for(let t=0;t<r;t+=1){const o=e[t],s=n[t];if(O.deepEqual(o,s))continue;if(!(o?.output_type==="stream"&&s?.output_type==="stream"&&o.name===s.name))return-1;const i=j(o),u=j(s);if(!u.startsWith(i)&&!i.startsWith(u)||t<r-1)return-1}return r}function Ge(e,n,r){let t=n.length;if(n.length>0&&r.length>=n.length){const o=n.length-1,s=n[o],a=r[o];if(!O.deepEqual(s,a)){const i=j(a).slice(j(s).length);i&&e.outputArea.model.add({...a,text:i})}}for(;t<r.length;)e.outputArea.model.add(r[t]),t+=1}function ae(e,n,r){const t=e.model.sharedModel,o=t.getOutputs();if(O.deepEqual(o,n))return;if(n.length===0){r?.length&&o.length&&e.outputArea.model.clear();return}if(He(n,o))return;console.debug("[jupyter-server-nbmodel] Applying pending output snapshot",{cellId:t.getId(),outputCount:n.length});const s=Fe(o,n);s>=0?Ge(e,o.slice(0,s),n):t.setOutputs(n)}const ze=1e3;async function Ve(e,n,r){let t;try{t=await n.json()}catch{return}if(t.request_id&&t.kernel_id){const a=n.headers.get("Location")??t.request_url;a&&(r.requestUrl=a),a&&r.recoverOutputs&&oe(e,{kernelId:t.kernel_id,requestId:t.request_id,requestUrl:a}),r.accepted||(r.accepted=!0,r.onAccepted?.())}if(t.outputs===void 0||!r.recoverOutputs)return;const o=se(t.outputs),s=r.serverOutputs;r.serverOutputs=o,ae(e,o,s)}async function K(e,n,r,t,o,s=100,a={}){const i=new Ee;return x.ServerConnection.makeRequest(n,r,t).then(async u=>{if(u.ok)if(u.status===202){await Ve(e,u,a);let c=u.headers.get("Location")||a.requestUrl||n;c.startsWith(t.baseUrl)||(c=N.URLExt.join(t.baseUrl,c)),setTimeout(async(_,w,m,M,k,U,p)=>{try{const h=await K(_,w,m,M,k,U,p);i.resolve(h)}catch(h){i.reject(h)}},s,e,c,{method:"GET"},t,o,Math.min(ze,s*2),a)}else i.resolve(u);else if(u.status===300){let c=u.headers.get("Location")||"";if(!c){const p=n.match(/^(.*\/api\/kernels\/[^/?]+)/);c=p?`${p[1]}/input`:""}if(!c){i.reject(new Error(`The kernel asked for an input, and where to send it could not be determined: no Location header, and the polled URL names no kernel (${n}).`));return}c.startsWith(t.baseUrl)||(c=N.URLExt.join(t.baseUrl,c));const{parent_header:_,input_request:w}=await u.json(),m=new be;m.addClass("jp-OutputArea-child"),m.addClass("jp-OutputArea-stdin-item");const M=new _e;M.addClass("jp-OutputArea-prompt"),m.addWidget(M);const k=new Ce({future:Object.freeze({sendInputReply:(p,h)=>{x.ServerConnection.makeRequest(c,{method:"POST",body:JSON.stringify({input:p.value})},t).catch(E=>{console.error(`Failed to set input to ${JSON.stringify(p)}.`,E)})}}),parent_header:_,password:w.password,prompt:w.prompt,translator:o});k.addClass("jp-OutputArea-output"),m.addWidget(k);const U=k.node.getElementsByTagName("input")[0];k.value.then(p=>{m.addClass("jp-OutputArea-stdin-hiding"),e.outputArea.model.add({output_type:"stream",name:"stdin",text:p+`
|
|
2
2
|
`}),U.focus(),window.setTimeout(async()=>{const h=document.activeElement;m.dispose(),h&&h instanceof HTMLElement&&h.focus();try{const E=await K(e,n,r,t,o,100,a);i.resolve(E)}catch(E){i.reject(E)}},500)}),e.outputArea.layout.addWidget(m)}else i.reject(await x.ServerConnection.ResponseError.create(u))}).catch(u=>{i.reject(new x.ServerConnection.NetworkError(u))}),i.promise}async function Ye(e,n,r,t,o,s=100,a,i=!1){return K(e,n,r,t,o,s,{onAccepted:a,recoverOutputs:i})}async function Xe(e,n,r){const t=e.model.sharedModel;t.executionState="running";try{const s=await(await Ye(e,n,{method:"GET"},r,void 0,100,void 0,!0)).json(),a=se(s.outputs??"[]");return ae(e,a),t.execution_count=s.execution_count??null,t.executionState="idle",Z(e),s.status==="ok"}catch(o){if(o instanceof x.ServerConnection.ResponseError&&o.response.status===404)return Z(e),t.executionState="idle",!1;throw o}}const I=new Set;function Qe(e,n){if(e.startsWith(n.baseUrl))return e;const r=e.startsWith("http")?new URL(e).pathname:e;return N.URLExt.join(n.baseUrl,r)}function Ze(e,n){if(We(e))return!1;const r=re(e);if(!r||I.has(r.requestId)||e.isDisposed||!e.model)return!1;I.add(r.requestId);const t=Qe(r.requestUrl,n);return console.info("[agent-runtimes] Resuming a server execution",{cellId:e.model.sharedModel.getId(),requestId:r.requestId,requestUrl:t}),Xe(e,t,n).catch(o=>{if(e.isDisposed){I.delete(r.requestId);return}console.warn(`[agent-runtimes] Failed to resume the execution ${r.requestId}.`,o)}),!0}const W=new Set;async function et(e,n,r){const t=`${r.baseUrl}#${n.id}`;if(W.has(t))return 0;const o=await x.ServerConnection.makeRequest(N.URLExt.join(r.baseUrl,`api/kernels/${n.id}/execute`),{method:"GET"},r);if(o.status===404)return W.add(t),0;if(!o.ok)throw await x.ServerConnection.ResponseError.create(o).catch(()=>new Error(`Invalid response: ${o.status} ${o.statusText}`.trim()));W.add(t);const s=await o.json();let a=0;for(const i of s.requests??[]){if(!i.cell_id||I.has(i.request_id))continue;const u=e.find(c=>c.model?.sharedModel.getId()===i.cell_id);!u||u.isDisposed||re(u)||(oe(u,{kernelId:i.kernel_id,requestId:i.request_id,requestUrl:i.request_url}),a+=1)}return a}async function tt(e){if(e.isDisposed)return 0;const n=e.sessionContext?.session?.kernel,r=n?.serverSettings;if(!n||!r)return 0;const t=e.content.widgets.filter(s=>s instanceof Re);if(t.length===0)return 0;try{await et(t,n,r)}catch(s){console.warn("[agent-runtimes] Failed to discover the active executions of the kernel.",s)}let o=0;for(const s of t)Ze(s,r)&&(o+=1);return o}const ee=1e3,nt=3e4;function rt(e,n){f.useEffect(()=>{if(!e||!n)return;let r=0;const t=()=>{const a=ne.getState().selectNotebook(e)?.adapter?.panel;!a||a.isDisposed||tt(a)};t();const o=window.setInterval(()=>{if(r+=ee,r>=nt){window.clearInterval(o);return}t()},ee);return()=>{window.clearInterval(o)}},[e,n])}const te={cells:[{cell_type:"code",source:[""],metadata:{},outputs:[],execution_count:null}],metadata:{kernelspec:{display_name:"Python 3",language:"python",name:"python3"},language_info:{name:"python"}},nbformat:4,nbformat_minor:5};function ot({inherit:e,colorMode:n,themeConfig:r,children:t}){return e?v.jsx(v.Fragment,{children:t}):v.jsx(Ne,{colorMode:n,theme:r.primerTheme,themeStyles:r.themeStyles,children:t})}function gt({notebookId:e,runtimeName:n,runtimeOverride:r,serviceManager:t,inheritTheme:o=!1,kernelId:s,cellSidebarMargin:a=120,nbformat:i,onNbformatChange:u,toolbarComponent:c,toolbarExtraItems:_,showToolbar:w=!0,showSaveItem:m=!1,themeVariant:M,colorMode:k,collaborationProvider:U}){const p=f.useRef(i??te),h=f.useRef(e);h.current!==e&&(h.current=e,p.current=i??te);const E=p.current,F=f.useRef(JSON.stringify(E)),{runtimes:G,refetchRuntimes:L}=Me(void 0,{enabled:!!String(n||"").trim()&&!t&&!String(r?.baseUrl||"").trim()}),z=f.useMemo(()=>{const l=String(n||"").trim();if(l)return G.find(d=>String(d?.runtime_name||"")===l)},[n,G]),S=f.useMemo(()=>{const l=String(r?.baseUrl||"").trim();return l?{url:l,wsUrl:String(r?.wsUrl||"").trim()||void 0,token:String(r?.token||"").trim(),runtime_name:String(r?.runtimeName||"").trim()||"agent-node-proxy"}:z},[r,z]),V=!!(!r?.baseUrl&&String(n||"").trim()&&!S);f.useEffect(()=>{if(!V)return;L();const l=window.setInterval(()=>{L()},1e3);return()=>{window.clearInterval(l)}},[V,L]);const[ie,B]=f.useState(null),[ue,D]=f.useState(void 0),[le,J]=f.useState(!1);f.useEffect(()=>{let l=!1,d=null,b=null;const y=async()=>{const C=String(S?.url||"").trim();if(!C){l||(B(null),D(void 0),J(!1));return}try{const A=String(S?.token||"").trim(),we=String(S?.wsUrl||"").trim()||C.replace(/^http/,"ws"),ke=x.ServerConnection.makeSettings({baseUrl:C,wsUrl:we,token:A,appendToken:!0}),R=new x.ServiceManager({serverSettings:ke});if(d=R,b=Ie(String(S?.runtime_name||""),d),l){g(R);return}await R.ready,await R.kernels.refreshRunning();const X=[...R.kernels.running()][0];if(l){g(R);return}B(R),D(X?.id),J(!X)}catch(A){d&&(g(d),d=null),l||(console.warn(`[agent-runtimes] Could not reach the sandbox at ${C}.`,A),B(null),D(void 0),J(!1))}},g=C=>{b?.(),b=null,Oe(C)};return y(),()=>{l=!0,d?(g(d),d=null):(b?.(),b=null)}},[S?.runtime_name,S?.url,S?.token,S?.wsUrl]);const q=t??ie,ce=Ue(),de=s??ue,fe=t?!s:le,me=f.useMemo(()=>{if(!w)return;const l=c||Be,d=m?void 0:["notebook-save","notebook-divider-file"];return!_?.length&&!d?l:function(y){return v.jsx(l,{...y,extraItems:_,hiddenItems:d})}},[w,m,c,_]),pe=!!((String(n||"").trim()||String(r?.baseUrl||"").trim())&&!q);Le(`ephemeral-notebook-start-${e}`,pe),rt(e,q??void 0),f.useEffect(()=>{if(U)return;const l=()=>{const g=ne.getState().selectNotebook(e)?.adapter;return(g?.notebook?.model??g?.panel?.content?.model??null)?.toJSON?.()??null},d=()=>{const y=l();if(!y||!Array.isArray(y.cells))return;const g=JSON.stringify(y);g!==F.current&&(F.current=g,u?.(y))},b=window.setInterval(d,500);return()=>{window.clearInterval(b),d()}},[q,e,u]);const{colorMode:he,theme:ge}=je(),P=k??he,Se=M??ge,ye=qe(),$=Te(Se),Y=P==="auto"?ye:P,T=(Y==="dark"?$.themeStyles.dark:$.themeStyles.light).backgroundColor??"",ve=f.useMemo(()=>[new De({factory:Je})],[]),xe=f.useMemo(()=>`.datalayer/${e}.ipynb`,[e]);return v.jsx(Q,{flex:1,minHeight:0,height:"100%",position:"relative",overflow:"hidden",bg:"canvas.default",children:q&&ce?v.jsx(ot,{inherit:o,colorMode:P,themeConfig:$,children:v.jsx(Ae,{colormode:Y,backgroundColor:T,children:v.jsx(Q,{sx:{position:"absolute",inset:0,display:"flex",flexDirection:"column",overflow:"hidden",overscrollBehaviorY:"contain",overflowAnchor:"none",padding:2,backgroundColor:T,"& #dla-Jupyter-Notebook":{display:"flex",flexDirection:"column"},...w?{"& #dla-Jupyter-Notebook > :first-of-type":{position:"sticky",top:0,zIndex:2,flex:"0 0 auto",backgroundColor:T}}:{"& .datalayer-NotebookPanel-header":{display:"none",minHeight:0}},"& #dla-Jupyter-Notebook > .dla-Box-Notebook":{flex:"1 1 auto",minHeight:0},'& [role="toolbar"][aria-label="Notebook toolbar"]':{backgroundColor:T}},children:v.jsx(Pe,{nbformat:E,id:e,path:xe,serviceManager:q,startDefaultKernel:fe,kernelId:de,height:"100%",cellSidebarMargin:a,extensions:ve,Toolbar:me,collaborationProvider:U})})})}):null})}export{gt as EphemeralNotebook,gt as default};
|
package/dist-embed/chunks/{ExcalidrawComponent-BehqBpwC.js → ExcalidrawComponent-0e3KqmKJ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as p,G as N,c8 as z,c9 as L,ca as T,cb as F,cc as R,I as O,cd as _}from"../datalayer-app-main.js";import{x as U,y as W,z as $,A as M}from"./JupyterLexicalExtension-
|
|
1
|
+
import{r as s,j as p,G as N,c8 as z,c9 as L,ca as T,cb as F,cc as R,I as O,cd as _}from"../datalayer-app-main.js";import{x as U,y as W,z as $,A as M}from"./JupyterLexicalExtension-CEjN8cLT.js";import H from"./ExcalidrawModal-C5Or1sZ5.js";import{r as X}from"./percentages-BXMCSKIN-917PkDRT.js";import{u as J}from"./ThemeContext-D9ztCaU3.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./url-DEeTWrO-.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./VideoIcon-BjP_LDa4.js";import"./LinkIcon-DUI0jw25.js";import"./Toolbar-BxAi9T92.js";import"./ArrowUpIcon-BUCpIXDR.js";import"./SortDescIcon-CS4EzHeS.js";import"./PrismCss-u5utqjht.js";import"./LexicalToolRegistry-DoZIM1lF.js";import"./extends-CF3RwP-h.js";import"./index-BxurLo3u.js";import"./index-DoBkwclg.js";const P=e=>{const i=e?.firstElementChild?.firstElementChild,g=e.getAttribute("viewBox");if(g!=null){const a=g.split(" ");e.setAttribute("width",a[2]),e.setAttribute("height",a[3])}i&&i.tagName==="style"&&i.remove()};function V({elements:e,files:i,imageContainerRef:g,appState:a,rootClassName:o=null,width:c="inherit",height:C="inherit"}){const[b,S]=s.useState(null),{theme:E}=J(b),[B,u]=s.useState(null),[v,w]=s.useState(0);s.useEffect(()=>{const n=new MutationObserver(x=>{for(const h of x)if(h.type==="attributes"&&(h.attributeName==="style"||h.attributeName==="class")){w(l=>l+1);break}});return n.observe(document.documentElement,{attributes:!0,attributeFilter:["style","class"]}),n.observe(document.body,{attributes:!0,attributeFilter:["style","class"]}),()=>n.disconnect()},[]),s.useEffect(()=>{(async()=>{await new Promise(D=>setTimeout(D,150));const x=["#ffffff","#000000","transparent",""],h=a?.viewBackgroundColor||"transparent",l=x.includes(h.toLowerCase()),A={...a,viewBackgroundColor:l?"transparent":a?.viewBackgroundColor,exportBackground:!l,exportWithDarkMode:E==="dark"},d=await X({appState:A,elements:e,files:i});P(d),d.setAttribute("width","100%"),d.setAttribute("height","100%"),d.setAttribute("display","block"),u(d)})()},[e,i,a,E,v]);const f={};c!=="inherit"&&(f.width=`${c}px`),C!=="inherit"&&(f.height=`${C}px`);const k=a?.viewBackgroundColor||"transparent";if(["#ffffff","#000000","transparent",""].includes(k.toLowerCase())){const n=E==="dark"?"#1e1e1e":"#ffffff";f.backgroundColor=`var(--bgColor-default, var(--jp-layout-color0, var(--vscode-editor-background, ${n})))`}return p.jsx("div",{ref:n=>{S(n),n&&g&&(g.current=n)},className:o??"",style:f,dangerouslySetInnerHTML:{__html:B?.outerHTML??""}})}function pt({nodeKey:e,data:i,width:g,height:a}){const[o]=N(),c=U(),[C,b]=s.useState(i==="[]"&&o.isEditable()),S=s.useRef(null),E=s.useRef(null),B=s.useRef(null),[u,v,w]=W(e),[f,k]=s.useState(!1);s.useEffect(()=>{if(!c){u&&w();return}return z(o.registerCommand(L,t=>{const m=E.current,r=t.target;return f?!0:m!==null&&T(r)&&m.contains(r)?(t.shiftKey||w(),v(!u),t.detail>1&&b(!0),!0):!1},F))},[w,o,u,f,v,c]);const j=s.useCallback(()=>(b(!1),o.update(()=>{const t=R(e);t&&t.remove()})),[o,e]),I=(t,m,r)=>o.update(()=>{const y=R(e);M(y)&&(t&&t.length>0||Object.keys(r).length>0?y.setData(JSON.stringify({appState:m,elements:t,files:r})):y.remove())}),n=()=>{k(!0)},x=(t,m)=>{setTimeout(()=>{k(!1)},200),o.update(()=>{const r=R(e);M(r)&&(r.setWidth(t),r.setHeight(m))})},h=s.useCallback(()=>{b(!0)},[]),{elements:l=[],files:A={},appState:d={}}=s.useMemo(()=>JSON.parse(i),[i]),D=s.useCallback(()=>{b(!1),l.length===0&&o.update(()=>{const t=R(e);t&&t.remove()})},[o,e,l.length]);return p.jsxs(p.Fragment,{children:[c&&C&&p.jsx(H,{initialElements:l,initialFiles:A,initialAppState:d,isShown:C,onDelete:j,onClose:D,onSave:(t,m,r)=>{I(t,m,r),b(!1)},closeOnClickOutside:!1}),l.length>0&&p.jsxs("button",{ref:E,className:`excalidraw-button ${u?"selected":""}`,children:[p.jsx(V,{imageContainerRef:S,className:"image",elements:l,files:A,appState:d,width:g,height:a}),u&&c&&p.jsx(O,{icon:_,"aria-label":"Edit the drawing",size:"small",variant:"default",sx:{position:"absolute",top:8,right:8,zIndex:10},onMouseDown:t=>t.preventDefault(),onClick:h}),(u||f)&&c&&p.jsx($,{buttonRef:B,showCaption:!0,setShowCaption:()=>null,imageRef:S,editor:o,onResizeStart:n,onResizeEnd:x})]})]})}export{pt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,j as o,D as u,
|
|
1
|
+
import{r as t,j as o,D as u,bw as h,c as f}from"../datalayer-app-main.js";import{I as T}from"./percentages-BXMCSKIN-917PkDRT.js";import{u as z}from"./ThemeContext-D9ztCaU3.js";import"./JupyterLexicalExtension-CEjN8cLT.js";import"./NotebookSkeleton-z8GKB7Tb.js";import"./Avatar-BrPfm89P.js";import"./url-DEeTWrO-.js";import"./isSymbol-BLtK9CV6.js";import"./toNumber-B1wj8-wx.js";import"./VideoIcon-BjP_LDa4.js";import"./LinkIcon-DUI0jw25.js";import"./Toolbar-BxAi9T92.js";import"./ArrowUpIcon-BUCpIXDR.js";import"./SortDescIcon-CS4EzHeS.js";import"./PrismCss-u5utqjht.js";import"./LexicalToolRegistry-DoZIM1lF.js";import"./extends-CF3RwP-h.js";import"./index-BxurLo3u.js";import"./index-DoBkwclg.js";function $({closeOnClickOutside:I=!1,onSave:x,initialElements:l,initialAppState:g,initialFiles:d,isShown:n=!1,onDelete:v,onClose:c}){const[w,C]=t.useState(null),{theme:b}=z(w),m=t.useRef(null),E=t.useCallback(e=>{m.current=e,C(e)},[]),[a,k]=t.useState(null),[j,r]=t.useState(!1),[p,M]=t.useState(l),[D,S]=t.useState(d);t.useEffect(()=>{m.current?.focus()},[]),t.useEffect(()=>{if(!a||!n)return;const e=()=>a.refresh(),i=requestAnimationFrame(e),s=setTimeout(e,300);return window.addEventListener("resize",e),()=>{cancelAnimationFrame(i),clearTimeout(s),window.removeEventListener("resize",e)}},[a,n]);const A=()=>{if(p?.some(e=>!e.isDeleted)){const e=a?.getAppState(),i={exportBackground:e?.exportBackground,exportScale:e?.exportScale,exportWithDarkMode:e?.theme==="dark",isBindingEnabled:e?.isBindingEnabled,isLoading:e?.isLoading,name:e?.name,theme:e?.theme,viewBackgroundColor:e?.viewBackgroundColor,viewModeEnabled:e?.viewModeEnabled,zenModeEnabled:e?.zenModeEnabled,zoom:e?.zoom};x(p,i,D)}else v()},B=()=>{r(!0)};if(n===!1)return null;const y=(e,i,s)=>{M(e),S(s)};return o.jsxs(o.Fragment,{children:[o.jsxs(u,{title:"Excalidraw",onClose:()=>c(),width:"xlarge",height:"auto",sx:{width:"80vw !important",maxWidth:"80vw !important",height:"80vh !important",maxHeight:"80vh !important"},children:[o.jsx(h,{ref:E,tabIndex:-1,sx:{height:"calc(80vh - 140px)",position:"relative",overflow:"hidden"},children:o.jsx(T,{onChange:y,excalidrawAPI:e=>k(e),initialData:{appState:g||{isLoading:!1},elements:l,files:d},theme:b})}),o.jsxs(h,{sx:{display:"flex",gap:2,justifyContent:"flex-end",p:2,borderTop:"1px solid",borderColor:"var(--borderColor-default)"},children:[o.jsx(f,{variant:"invisible",onClick:B,children:"Discard"}),o.jsx(f,{variant:"primary",onClick:A,children:"Save"})]})]}),j&&o.jsx(u,{title:"Discard",onClose:()=>r(!1),width:"small",height:"auto",footerButtons:[{buttonType:"danger",content:"Discard",onClick:()=>{r(!1),c()}},{buttonType:"default",content:"Cancel",onClick:()=>r(!1)}],children:"Are you sure you want to discard the changes?"})]})}export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{v as F,
|
|
1
|
+
import{v as F,bl as d,cE as h,j as u,bn as m}from"../datalayer-app-main.js";var p={Flash:"prc-Flash-Flash-3q4Aj"};const E=F.forwardRef(function(n,f){const s=d.c(17);let a,t,i,l,e,c;s[0]!==n?({as:a,className:t,variant:c,full:i,sx:e,...l}=n,s[0]=n,s[1]=a,s[2]=t,s[3]=i,s[4]=l,s[5]=e,s[6]=c):(a=s[1],t=s[2],i=s[3],l=s[4],e=s[5],c=s[6]);const v=c===void 0?"default":c;let o;s[7]!==t?(o=h(p.Flash,t),s[7]=t,s[8]=o):o=s[8];const x=i?"":void 0;let r;return s[9]!==a||s[10]!==f||s[11]!==l||s[12]!==e||s[13]!==o||s[14]!==x||s[15]!==v?(r=u.jsx(m,{...l,ref:f,as:a,className:o,"data-full":x,"data-variant":v,sx:e}),s[9]=a,s[10]=f,s[11]=l,s[12]=e,s[13]=o,s[14]=x,s[15]=v,s[16]=r):r=s[16],r});export{E as F};
|