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AP,EAAgB,EAAK,CAAC,GAAe,kBAAsB,IAAP,GAAgB,EAClM,IAEA,GAAc,EAAS,IAAI,cAAc,WAEzC,SACM,EAAS,QAAQ,WAAW,YAAa,CAC3C,YAAY,GAGxB,KAEA,EAAS,CACT,MAAM,EAAW,sBACjB,CAAC,WAAW,SAAU,WAAW,aAAa,SAAQ,IAClD,EAAQ,QAAQ,CAAE,UAAS,YAAW,GAE9C,CACA,OAAO,CAAO,iBAGP,CAAC,QAAS","file":"/npm/jupyterlab-rise@0.43.1/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/jupyterlab-rise@0.43.1/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { ILayoutRestorer } from '@jupyterlab/application';\nimport { CommandToolbarButton, ICommandPalette, showDialog, WidgetTracker } from '@jupyterlab/apputils';\nimport { INotebookTracker } from '@jupyterlab/notebook';\nimport { ISettingRegistry } from '@jupyterlab/settingregistry';\nimport { ITranslator, nullTranslator } from '@jupyterlab/translation';\nimport { toArray } from '@lumino/algorithm';\nimport { fullScreenIcon, RISEIcon } from './icons';\nimport { RisePreview } from './preview';\nimport { IRisePreviewFactory, IRisePreviewTracker } from './tokens';\nexport { IRisePreviewFactory, IRisePreviewTracker } from './tokens';\n/**\n * Command IDs namespace for JupyterLab RISE extension\n */\nvar CommandIDs;\n(function (CommandIDs) {\n    /**\n     * Open the current notebook in a new browser tab\n     */\n    CommandIDs.openRise = 'RISE:slideshow';\n    CommandIDs.riseFullScreen = 'RISE:fullscreen-plugin';\n    /**\n     * Open the current notebook in a IFrame within JupyterLab\n     */\n    CommandIDs.risePreview = 'RISE:preview';\n    /**\n     * Set the slide attribute of a cell\n     */\n    CommandIDs.riseSetSlideType = 'RISE:set-slide-type';\n})(CommandIDs || (CommandIDs = {}));\nconst factory = {\n    id: 'jupyterlab-rise:factory',\n    provides: IRisePreviewFactory,\n    optional: [ITranslator],\n    activate: (app, translator) => {\n        const { commands, docRegistry } = app;\n        return new RisePreview.FactoryToken({\n            commands,\n            docRegistry,\n            translator: translator !== null && translator !== void 0 ? translator : undefined\n        });\n    }\n};\n/**\n * Open the notebook with RISE.\n */\nconst plugin = {\n    id: 'jupyterlab-rise:plugin',\n    autoStart: true,\n    requires: [IRisePreviewFactory],\n    optional: [\n        INotebookTracker,\n        ICommandPalette,\n        ILayoutRestorer,\n        ISettingRegistry,\n        ITranslator\n    ],\n    provides: IRisePreviewTracker,\n    activate: (app, factory, notebookTracker, palette, restorer, settingRegistry, translator) => {\n        console.log('JupyterLab extension jupyterlab-rise is activated!');\n        // Create a widget tracker for Rise Previews.\n        const tracker = new WidgetTracker({\n            namespace: 'rise'\n        });\n        if (!notebookTracker) {\n            return tracker;\n        }\n        const { commands, shell } = app;\n        const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('rise');\n        let settings = null;\n        if (settingRegistry) {\n            settingRegistry.load(plugin.id).then(config => {\n                settings = config;\n            });\n        }\n        if (restorer) {\n            restorer.restore(tracker, {\n                // Need to modify to handle auto full screen\n                command: 'docmanager:open',\n                args: panel => ({\n                    path: panel.context.path,\n                    factory: RisePreview.FACTORY_NAME\n                }),\n                name: panel => panel.context.path,\n                when: app.serviceManager.ready\n            });\n        }\n        function getCurrent(args) {\n            var _a;\n            const widget = (_a = notebookTracker === null || notebookTracker === void 0 ? void 0 : notebookTracker.currentWidget) !== null && _a !== void 0 ? _a : null;\n            const activate = args['activate'] !== false;\n            if (activate && widget) {\n                shell.activateById(widget.id);\n            }\n            return widget;\n        }\n        function isEnabled() {\n            return ((notebookTracker === null || notebookTracker === void 0 ? void 0 : notebookTracker.currentWidget) !== null &&\n                (notebookTracker === null || notebookTracker === void 0 ? void 0 : notebookTracker.currentWidget) === shell.currentWidget);\n        }\n        factory.widgetCreated.connect((sender, widget) => {\n            // Notify the widget tracker if restore data needs to update.\n            widget.context.pathChanged.connect(() => {\n                void tracker.save(widget);\n            });\n            // Add the notebook panel to the tracker.\n            void tracker.add(widget);\n        });\n        tracker.widgetAdded.connect((sender, widget) => {\n            widget.ready.then(() => { var _a; return (_a = widget.iframe) === null || _a === void 0 ? void 0 : _a.focus(); });\n        });\n        commands.addCommand(CommandIDs.openRise, {\n            label: args => (args.toolbar ? '' : trans.__('Open as Reveal Slideshow')),\n            caption: trans.__('Open the current notebook in a new browser tab as an RevealJS slideshow.'),\n            execute: async () => {\n                const current = notebookTracker.currentWidget;\n                if (!current) {\n                    return;\n                }\n                await current.context.save();\n                window.open(RisePreview.getRiseUrl(current.context.path, current.content.activeCellIndex));\n            },\n            isEnabled\n        });\n        commands.addCommand(CommandIDs.risePreview, {\n            label: args => args.toolbar ? '' : trans.__('Render as Reveal Slideshow'),\n            caption: trans.__('Render the current notebook as Reveal Slideshow'),\n            icon: RISEIcon,\n            execute: async (args) => {\n                const current = getCurrent(args);\n                let context;\n                if (current) {\n                    context = current.context;\n                    await context.save();\n                    const widget = await commands.execute('docmanager:open', {\n                        path: context.path,\n                        factory: RisePreview.FACTORY_NAME,\n                        options: {\n                            mode: 'split-right'\n                        }\n                    });\n                    const updateActiveIndex = (notebook) => {\n                        widget.setActiveCellIndex(notebook.activeCellIndex, false);\n                    };\n                    widget.setActiveCellIndex(current.content.activeCellIndex);\n                    current.content.activeCellChanged.connect(updateActiveIndex);\n                    widget.disposed.connect(() => {\n                        current.content.activeCellChanged.disconnect(updateActiveIndex);\n                    });\n                    if (args['fullscreen'] === true) {\n                        widget.ready\n                            .then(() => {\n                            showDialog({\n                                title: trans.__('Switch to full screen'),\n                                body: trans.__('The slideshow is set to automatically open in full screen. Your web browser requires your confirmation to do so.')\n                            }).then(result => {\n                                if (result.button.accept) {\n                                    commands.execute(CommandIDs.riseFullScreen, {\n                                        id: widget.id\n                                    });\n                                }\n                            });\n                        })\n                            .catch(reason => {\n                            console.log(reason);\n                        });\n                    }\n                }\n            },\n            isEnabled\n        });\n        commands.addCommand(CommandIDs.riseFullScreen, {\n            label: trans.__('Full screen slideshow'),\n            caption: trans.__('Toggle full screen the current active slideshow'),\n            icon: fullScreenIcon,\n            execute: async (args) => {\n                var _a;\n                if (args['id']) {\n                    app.shell.activateById(args['id']);\n                }\n                const current = args['id']\n                    ? toArray(app.shell.widgets('main')).find(widget => widget.id === args['id'])\n                    : app.shell.currentWidget;\n                if (current && tracker.has(current)) {\n                    const iframe = current.iframe;\n                    if (iframe) {\n                        if (!document.fullscreenElement &&\n                            !((_a = iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.fullscreenElement)) {\n                            current.ready.then(() => {\n                                var _a, _b;\n                                (_b = (_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document.querySelector('div.reveal')) === null || _b === void 0 ? void 0 : _b.requestFullscreen();\n                            });\n                        }\n                        else {\n                            if (document.exitFullscreen) {\n                                await document.exitFullscreen();\n                            }\n                        }\n                        iframe.focus();\n                    }\n                }\n            },\n            isEnabled: () => !!app.shell.currentWidget && tracker.has(app.shell.currentWidget)\n        });\n        commands.addCommand(CommandIDs.riseSetSlideType, {\n            label: args => trans.__('Toggle slideshow %1 type', args['type']),\n            caption: args => trans.__('(Un)set active cell as a %1 cell', args['type']),\n            execute: args => {\n                var _a, _b;\n                const value = args['type'];\n                const current = app.shell.currentWidget;\n                if (current && notebookTracker.has(current)) {\n                    const cellModel = (_a = current.content.activeCell) === null || _a === void 0 ? void 0 : _a.model;\n                    if (cellModel) {\n                        const currentValue = (_b = cellModel.getMetadata('slideshow')) !== null && _b !== void 0 ? _b : {};\n                        if (value !== currentValue['slide_type']) {\n                            const newValue = { ...currentValue };\n                            if (value) {\n                                newValue['slide_type'] = value;\n                            }\n                            else {\n                                delete newValue['slide_type'];\n                            }\n                            if (Object.keys(newValue).length > 0) {\n                                cellModel.setMetadata('slideshow', newValue);\n                            }\n                            else {\n                                cellModel.deleteMetadata('slideshow');\n                            }\n                        }\n                    }\n                }\n            },\n            isToggled: args => {\n                var _a, _b;\n                const value = args['type'];\n                const current = app.shell.currentWidget;\n                if (current && notebookTracker.has(current)) {\n                    const cellModel = (_a = current.content.activeCell) === null || _a === void 0 ? void 0 : _a.model;\n                    if (cellModel) {\n                        const currentValue = (_b = cellModel.getMetadata('slideshow')) !== null && _b !== void 0 ? _b : {};\n                        return currentValue['slide_type'] === value && !!value;\n                    }\n                }\n                return false;\n            },\n            isEnabled: args => {\n                var _a;\n                return ['slide', 'subslide', 'fragment', 'skip', 'notes'].includes((_a = args['type']) !== null && _a !== void 0 ? _a : '');\n            }\n        });\n        notebookTracker.widgetAdded.connect(async (sender, panel) => {\n            var _a, _b, _c;\n            panel.toolbar.insertBefore('kernelName', 'RISE-button', new CommandToolbarButton({\n                commands,\n                id: CommandIDs.risePreview,\n                args: { toolbar: true }\n            }));\n            // Don't trigger auto launch in stand-alone Rise application.\n            if (app.name !== 'Rise') {\n                await panel.context.ready;\n                let autolaunch = (_c = ((_b = (_a = panel.content.model) === null || _a === void 0 ? void 0 : _a.getMetadata('rise')) !== null && _b !== void 0 ? _b : {})['autolaunch']) !== null && _c !== void 0 ? _c : false;\n                if (settings) {\n                    // @ts-expect-error unknown type\n                    autolaunch |= settings.get('autolaunch').composite;\n                }\n                if (autolaunch) {\n                    await commands.execute(CommandIDs.risePreview, {\n                        fullscreen: true\n                    });\n                }\n            }\n        });\n        if (palette) {\n            const category = 'Notebook Operations';\n            [CommandIDs.openRise, CommandIDs.risePreview].forEach(command => {\n                palette.addItem({ command, category });\n            });\n        }\n        return tracker;\n    }\n};\nexport default [factory, plugin];\n"]}