"enable aexpr";

System.register(['active-expression-rewriting', 'reactive-jsx', 'src/components/widgets/lively-morph.js', 'systemjs-babel-build', 'utils'], function (_export, _context) {
  "use strict";

  var _setMember, _getAndCallMember, _setLocal, _getLocal, _getMember, _getGlobal, _traceMember, _children, _attributeExpression, _attributes, _element, _addSourceLocation, Morph, babelDefault, promisedEvent, through, generateUUID;

  return {
    setters: [function (_activeExpressionRewriting) {
      _setMember = _activeExpressionRewriting.setMember;
      _getAndCallMember = _activeExpressionRewriting.getAndCallMember;
      _setLocal = _activeExpressionRewriting.setLocal;
      _getLocal = _activeExpressionRewriting.getLocal;
      _getMember = _activeExpressionRewriting.getMember;
      _getGlobal = _activeExpressionRewriting.getGlobal;
      _traceMember = _activeExpressionRewriting.traceMember;
    }, function (_reactiveJsx) {
      _children = _reactiveJsx.children;
      _attributeExpression = _reactiveJsx.attributeExpression;
      _attributes = _reactiveJsx.attributes;
      _element = _reactiveJsx.element;
      _addSourceLocation = _reactiveJsx.addSourceLocation;
    }, function (_srcComponentsWidgetsLivelyMorphJs) {
      Morph = _srcComponentsWidgetsLivelyMorphJs.default;
    }, function (_systemjsBabelBuild) {
      babelDefault = _systemjsBabelBuild.default;
    }, function (_utils) {
      promisedEvent = _utils.promisedEvent;
      through = _utils.through;
      generateUUID = _utils.uuid;
    }],
    execute: function () {
      const __SystemJSRewritingHack = {};
      _recorder_._src_components_widgets_lively_code_mirror_widget_import_js = _recorder_._src_components_widgets_lively_code_mirror_widget_import_js || {};
      let _scope = {
        isScope: true
      };
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'Morph', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'Morph', Morph) : void 0, Morph;
        },

        set(thisIsVererySecretVariableName) {
          let _scope2 = {
            isScope: true
          };
          Morph = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope2, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'Morph', Morph, {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 12,
              line: 3
            },
            start: {
              column: 7,
              line: 3
            },
            source: ''
          }) : void 0, Morph;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'babelDefault', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'babelDefault', babelDefault) : void 0, babelDefault;
        },

        set(thisIsVererySecretVariableName) {
          let _scope3 = {
            isScope: true
          };
          babelDefault = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope3, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'babelDefault', babelDefault, {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 19,
              line: 4
            },
            start: {
              column: 7,
              line: 4
            },
            source: ''
          }) : void 0, babelDefault;
          return true;
        },

        enumerable: true,
        configurable: true
      });

      const babel = _getMember((self.__expressionAnalysisMode__ ? _getLocal(_scope, 'babelDefault', babelDefault) : void 0, babelDefault), 'babel');
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'babel', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'babel', babel) : void 0, babel;
        },

        set(thisIsVererySecretVariableName) {
          let _scope4 = {
            isScope: true
          };
          babel = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope4, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'babel', babel, {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 11,
              line: 5
            },
            start: {
              column: 6,
              line: 5
            },
            source: ''
          }) : void 0, babel;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'generateUUID', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'generateUUID', generateUUID) : void 0, generateUUID;
        },

        set(thisIsVererySecretVariableName) {
          let _scope5 = {
            isScope: true
          };
          generateUUID = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope5, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'generateUUID', generateUUID, {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 53,
              line: 6
            },
            start: {
              column: 41,
              line: 6
            },
            source: ''
          }) : void 0, generateUUID;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'through', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'through', through) : void 0, through;
        },

        set(thisIsVererySecretVariableName) {
          let _scope6 = {
            isScope: true
          };
          through = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope6, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'through', through, {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 31,
              line: 6
            },
            start: {
              column: 24,
              line: 6
            },
            source: ''
          }) : void 0, through;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'promisedEvent', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'promisedEvent', promisedEvent) : void 0, promisedEvent;
        },

        set(thisIsVererySecretVariableName) {
          let _scope7 = {
            isScope: true
          };
          promisedEvent = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope7, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'promisedEvent', promisedEvent, {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 22,
              line: 6
            },
            start: {
              column: 9,
              line: 6
            },
            source: ''
          }) : void 0, promisedEvent;
          return true;
        },

        enumerable: true,
        configurable: true
      });


      const filesPromise = new (self.__expressionAnalysisMode__ ? _getGlobal('Promise') : void 0, Promise)(resolve => {
        let _scope11 = {
          isScope: true
        };

        return _getAndCallMember(_getAndCallMember(_getAndCallMember(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively), 'files'), 'walkDir', [(self.__expressionAnalysisMode__ ? _getGlobal('lively4url') : void 0, lively4url)]), 'then', [files => {
          let _scope8 = {
            isScope: true
          };
          return _getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(Object, 'keys') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).keys(_getMember(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('SystemJS') : void 0, SystemJS), '@@loader-config'), 'map'))), 'concat', [_getAndCallMember((self.__expressionAnalysisMode__ ? _traceMember(files, 'filter') : void 0, (files === Object(files) ? self.__expressionAnalysisMode__ ? _getLocal(_scope8, 'files', files) : void 0 : files, files).filter(file => {
            let _scope9 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(file, 'endsWith') : void 0, (file === Object(file) ? self.__expressionAnalysisMode__ ? _getLocal(_scope9, 'file', file) : void 0 : file, file).endsWith('.js');
          })), 'map', [file => {
            let _scope10 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(file, 'replace') : void 0, (file === Object(file) ? self.__expressionAnalysisMode__ ? _getLocal(_scope10, 'file', file) : void 0 : file, file).replace((self.__expressionAnalysisMode__ ? _getGlobal('lively4url') : void 0, lively4url), '');
          }])]);
        }]), 'then', [(resolve === Object(resolve) ? self.__expressionAnalysisMode__ ? _getLocal(_scope11, 'resolve', resolve) : void 0 : resolve, resolve)]);
      });

      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'filesPromise', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'filesPromise', filesPromise) : void 0, filesPromise;
        },

        set(thisIsVererySecretVariableName) {
          let _scope12 = {
            isScope: true
          };
          filesPromise = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope12, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, 'filesPromise', filesPromise, {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 18,
              line: 8
            },
            start: {
              column: 6,
              line: 8
            },
            source: ''
          }) : void 0, filesPromise;
          return true;
        },

        enumerable: true,
        configurable: true
      });
      class LivelyCodeMirrorWidgetImport extends Morph {

        static getAST(src) {
          let _scope13 = {
            isScope: true
          },
              _scope14 = {
            isScope: true
          };

          try {
            const filename = "tempfile.js";
            // get pure ast
            return _getMember((self.__expressionAnalysisMode__ ? _traceMember(babel, 'transform') : void 0, (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'babel', babel) : void 0, babel).transform((src === Object(src) ? self.__expressionAnalysisMode__ ? _getLocal(_scope13, 'src', src) : void 0 : src, src), {
              babelrc: false,
              plugins: [], // no need for any syntax plugins (other than the SystemJS internal) as we only parse import statements
              presets: [],
              filename: filename,
              sourceFileName: filename,
              moduleIds: false,
              sourceMaps: false,
              // inputSourceMap: load.metadata.sourceMap,
              compact: false,
              comments: false,
              code: false,
              ast: true,
              resolveModuleSource: undefined
            })), 'ast');
          } catch (e) {
            if (self.__expressionAnalysisMode__) _traceMember(lively, 'warn');

            (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).warn('could not get ast for import statement', (e === Object(e) ? self.__expressionAnalysisMode__ ? _getLocal(_scope14, 'e', e) : void 0 : e, e));
          }
        }

        static createWidgetContainer() {
          let _scope15 = {
            isScope: true
          };

          var widget = _addSourceLocation((self.__expressionAnalysisMode__ ? _traceMember(document, 'createElement') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('document') : void 0, document).createElement("span")), {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 47,
              line: 47
            },
            start: {
              column: 17,
              line: 47
            }
          });
          if (self.__expressionAnalysisMode__) _traceMember(Object, 'assign');
          (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).assign(_getMember((widget === Object(widget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, 'widget', widget) : void 0 : widget, widget), 'style'), {
            whiteSpace: "normal"
          });
          return widget === Object(widget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope15, 'widget', widget) : void 0 : widget, widget;
        }

        static async importWidgetForRange(cm, m) {
          let _scope16 = {
            isScope: true
          };

          const ast = (self.__expressionAnalysisMode__ ? _traceMember(this, 'getAST') : void 0, this.getAST(_getMember((m === Object(m) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0 : m, m), 0)));
          if (!(ast === Object(ast) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'ast', ast) : void 0 : ast, ast)) {
            return;
          }

          const from = _getAndCallMember(_getMember((cm === Object(cm) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0 : cm, cm), 'editor'), 'posFromIndex', [_getMember((m === Object(m) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0 : m, m), 'index')]);
          const to = _getAndCallMember(_getMember((cm === Object(cm) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0 : cm, cm), 'editor'), 'posFromIndex', [_getMember((m === Object(m) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0 : m, m), 'index') + _getMember(_getMember((m === Object(m) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0 : m, m), 0), 'length')]);

          let marks = _getAndCallMember(_getMember((cm === Object(cm) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0 : cm, cm), 'editor'), 'findMarks', [(from === Object(from) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'from', from) : void 0 : from, from), (to === Object(to) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'to', to) : void 0 : to, to)]);
          let existingMarker = (self.__expressionAnalysisMode__ ? _traceMember(marks, 'find') : void 0, (marks === Object(marks) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'marks', marks) : void 0 : marks, marks).find(ea => {
            let _scope17 = {
              isScope: true
            };
            return _getMember((ea === Object(ea) ? self.__expressionAnalysisMode__ ? _getLocal(_scope17, 'ea', ea) : void 0 : ea, ea), 'importWidget');
          }));
          if (existingMarker === Object(existingMarker) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'existingMarker', existingMarker) : void 0 : existingMarker, existingMarker) {
            if (self.__expressionAnalysisMode__) _traceMember(lively, 'notify');

            (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).notify("found import widget"
            // do we have to update it?
            );return;
          }

          var container = (self.__expressionAnalysisMode__ ? _traceMember(this, 'createWidgetContainer') : void 0, this.createWidgetContainer());
          // #TODO, we assume that it will keep the first widget, and further replacements do not work.... and get therefore thrown away
          var marker = _getAndCallMember(_getMember(_getMember((cm === Object(cm) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0 : cm, cm), 'editor'), 'doc'), 'markText', [(from === Object(from) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'from', from) : void 0 : from, from), (to === Object(to) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'to', to) : void 0 : to, to), {
            replacedWith: container
          }]);
          _setMember((marker === Object(marker) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'marker', marker) : void 0 : marker, marker), 'importWidget', (container === Object(container) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'container', container) : void 0 : container, container), {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 35,
              line: 74
            },
            start: {
              column: 4,
              line: 74
            },
            source: ''
          });
          // lively.warn('return after container replacement')
          // return;
          await _getAndCallMember(_addSourceLocation((self.__expressionAnalysisMode__ ? _traceMember(lively, 'create') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).create('lively-code-mirror-widget-import', (container === Object(container) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'container', container) : void 0 : container, container))), {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 70,
              line: 77
            },
            start: {
              column: 10,
              line: 77
            }
          }), 'then', [importWidget => {
            let _scope18 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(importWidget, 'initWidget') : void 0, (importWidget === Object(importWidget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope18, 'importWidget', importWidget) : void 0 : importWidget, importWidget).initWidget((cm === Object(cm) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'cm', cm) : void 0 : cm, cm), (m === Object(m) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'm', m) : void 0 : m, m), (ast === Object(ast) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'ast', ast) : void 0 : ast, ast), (marker === Object(marker) ? self.__expressionAnalysisMode__ ? _getLocal(_scope16, 'marker', marker) : void 0 : marker, marker));
          }]);
        }

        async initialize() {
          _setMember(this, 'windowTitle', "LivelyCodeMirrorWidgetImport", {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 53,
              line: 82
            },
            start: {
              column: 4,
              line: 82
            },
            source: ''
          });

          _getAndCallMember(_getMember(this, 'modulePath'), 'addEventListener', ["keydown", evt => {
            let _scope19 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(this, 'onModulePathKeyDown') : void 0, this.onModulePathKeyDown((evt === Object(evt) ? self.__expressionAnalysisMode__ ? _getLocal(_scope19, 'evt', evt) : void 0 : evt, evt));
          }]);

          _setMember(this, '__classFilePath__', 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js', (self.__expressionAnalysisMode__ ? _getGlobal('undefined') : void 0, undefined));
        }

        get fileList() {
          return self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#fileList');
        }

        get modulePath() {
          return self.__expressionAnalysisMode__ ? _traceMember(this, 'get') : void 0, this.get('#modulePath');
        }

        prepareFileList() {
          if (self.__expressionAnalysisMode__) _traceMember(filesPromise, 'then');

          (self.__expressionAnalysisMode__ ? _getLocal(_scope, 'filesPromise', filesPromise) : void 0, filesPromise).then(files => {
            let _scope20 = {
              isScope: true
            };

            const fileList = _getMember(this, 'fileList');
            if (self.__expressionAnalysisMode__) _traceMember(files, 'forEach');
            (files === Object(files) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, 'files', files) : void 0 : files, files).forEach(file => {
              let _scope21 = {
                isScope: true
              };
              if (self.__expressionAnalysisMode__) _traceMember(fileList, 'appendChild');

              (fileList === Object(fileList) ? self.__expressionAnalysisMode__ ? _getLocal(_scope20, 'fileList', fileList) : void 0 : fileList, fileList).appendChild(_element('option', _attributes(_attributeExpression('value', (file === Object(file) ? self.__expressionAnalysisMode__ ? _getLocal(_scope21, 'file', file) : void 0 : file, file))), _children(), {
                file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
                end: {
                  column: 59,
                  line: 95
                },
                start: {
                  column: 29,
                  line: 95
                }
              }));
            });
          });
        }

        onFileChanged() {
          if (self.__expressionAnalysisMode__) _traceMember(lively, 'success');

          (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).success('file changed to', _getMember(_getMember(this, 'modulePath'), 'value'));
        }

        onModulePathKeyDown(evt) {
          let _scope22 = {
            isScope: true
          };

          var input = _getMember(this, 'modulePath');
          var range = _getAndCallMember(_getMember(this, 'marker'), 'find', []);
          if (_getMember((evt === Object(evt) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'evt', evt) : void 0 : evt, evt), 'keyCode') == 13) {// ENTER
            // #TODO how to replace // update text without replacing widgets
            // this.cm.editor.replaceRange(input.value, range.from, range.to) // @Stefan, your welcome! ;-)
            // this.wrapLinks() // don't wait and do what you can now
          }
          if (_getMember((evt === Object(evt) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'evt', evt) : void 0 : evt, evt), 'keyCode') == 37) {
            // Left
            if (_getMember((input === Object(input) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'input', input) : void 0 : input, input), 'selectionStart') == 0) {
              _getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'setSelection', [_getMember((range === Object(range) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'range', range) : void 0 : range, range), 'from'), _getMember((range === Object(range) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'range', range) : void 0 : range, range), 'from')]);
              _getAndCallMember(_getMember(this, 'cm'), 'focus', []);
            }
          }

          if (_getMember((evt === Object(evt) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'evt', evt) : void 0 : evt, evt), 'keyCode') == 39) {
            // Right
            if (_getMember((input === Object(input) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'input', input) : void 0 : input, input), 'selectionStart') == _getMember(_getMember((input === Object(input) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'input', input) : void 0 : input, input), 'value'), 'length')) {
              _getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'setSelection', [_getMember((range === Object(range) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'range', range) : void 0 : range, range), 'to'), _getMember((range === Object(range) ? self.__expressionAnalysisMode__ ? _getLocal(_scope22, 'range', range) : void 0 : range, range), 'to')]);
              _getAndCallMember(_getMember(this, 'cm'), 'focus', []);
            }
          }
        }

        async initWidget(cm, m, ast, marker) {
          let _scope23 = {
            isScope: true
          };

          _setMember(this, 'cm', (cm === Object(cm) ? self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'cm', cm) : void 0 : cm, cm), {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 16,
              line: 128
            },
            start: {
              column: 4,
              line: 128
            },
            source: ''
          });
          _setMember(this, 'ast', (ast === Object(ast) ? self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'ast', ast) : void 0 : ast, ast), {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 18,
              line: 129
            },
            start: {
              column: 4,
              line: 129
            },
            source: ''
          });
          _setMember(this, 'marker', (marker === Object(marker) ? self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'marker', marker) : void 0 : marker, marker), {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 24,
              line: 130
            },
            start: {
              column: 4,
              line: 130
            },
            source: ''
          });

          // this.modulePath.onfocus= e => lively.notify('FOCUSSED')
          // this.modulePath.onblur = e =>{
          //   lively.notify('BLURRED')
          // } 

          if (self.__expressionAnalysisMode__) _traceMember(this, 'prepareFileList');
          this.prepareFileList();

          if (self.__expressionAnalysisMode__) _traceMember(CodeMirror, 'on');
          (self.__expressionAnalysisMode__ ? _getGlobal('CodeMirror') : void 0, CodeMirror).on((marker === Object(marker) ? self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'marker', marker) : void 0 : marker, marker), "beforeCursorEnter", e => {
            let _scope25 = {
              isScope: true
            };

            function posEq(a, b) {
              let _scope24 = {
                isScope: true
              };
              return _getMember((a === Object(a) ? self.__expressionAnalysisMode__ ? _getLocal(_scope24, 'a', a) : void 0 : a, a), 'line') == _getMember((b === Object(b) ? self.__expressionAnalysisMode__ ? _getLocal(_scope24, 'b', b) : void 0 : b, b), 'line') && _getMember((a === Object(a) ? self.__expressionAnalysisMode__ ? _getLocal(_scope24, 'a', a) : void 0 : a, a), 'ch') == _getMember((b === Object(b) ? self.__expressionAnalysisMode__ ? _getLocal(_scope24, 'b', b) : void 0 : b, b), 'ch');
            }
            var direction = (posEq === Object(posEq) ? self.__expressionAnalysisMode__ ? _getLocal(_scope25, 'posEq', posEq) : void 0 : posEq, posEq)(_getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'getCursor', []), _getMember(_getAndCallMember(_getMember(this, 'marker'), 'find', []), 'from')) ? 'left' : 'right';
            _setMember(_getMember(_getMember(this, 'cm'), 'editor'), 'widgetEnter', () => {
              return self.__expressionAnalysisMode__ ? _traceMember(this, 'onEnter') : void 0, this.onEnter((direction === Object(direction) ? self.__expressionAnalysisMode__ ? _getLocal(_scope25, 'direction', direction) : void 0 : direction, direction));
            }, {
              file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
              end: {
                column: 64,
                line: 142
              },
              start: {
                column: 6,
                line: 142
              },
              source: ''
            });
          });

          await _getAndCallMember(_getAndCallMember(_addSourceLocation((self.__expressionAnalysisMode__ ? _traceMember(lively, 'create') : void 0, (self.__expressionAnalysisMode__ ? _getGlobal('lively') : void 0, lively).create('lively-inspector', this)), {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 49,
              line: 145
            },
            start: {
              column: 10,
              line: 145
            }
          }), 'through', [inspector => {
            let _scope26 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(inspector, 'inspect') : void 0, (inspector === Object(inspector) ? self.__expressionAnalysisMode__ ? _getLocal(_scope26, 'inspector', inspector) : void 0 : inspector, inspector).inspect((ast === Object(ast) ? self.__expressionAnalysisMode__ ? _getLocal(_scope23, 'ast', ast) : void 0 : ast, ast));
          }]), 'through', [inspector => {
            let _scope27 = {
              isScope: true
            };
            return self.__expressionAnalysisMode__ ? _traceMember(inspector, 'hideWorkspace') : void 0, (inspector === Object(inspector) ? self.__expressionAnalysisMode__ ? _getLocal(_scope27, 'inspector', inspector) : void 0 : inspector, inspector).hideWorkspace();
          }]);
          _getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'refresh', []);
        }

        onEnter(direction) {
          let _scope28 = {
            isScope: true
          };

          // lively.success('ENTER FROM ' + direction)
          if (!_getAndCallMember(_getMember(this, 'marker'), 'find', [])) {
            _getAndCallMember(_getMember(_getMember(this, 'cm'), 'editor'), 'refresh', []);
          } else {
            if (self.__expressionAnalysisMode__) _traceMember(this, 'enter');

            // setTimeout(() => {
            this.enter((direction === Object(direction) ? self.__expressionAnalysisMode__ ? _getLocal(_scope28, 'direction', direction) : void 0 : direction, direction));
            // }, 50);
          }
        }

        enter(direction) {
          let _scope29 = {
            isScope: true
          };

          var module = _getMember(this, 'modulePath');
          // this.focus()
          if (self.__expressionAnalysisMode__) _traceMember(module, 'focus');
          (module === Object(module) ? self.__expressionAnalysisMode__ ? _getLocal(_scope29, 'module', module) : void 0 : module, module).focus();
          (self.__expressionAnalysisMode__ ? _getGlobal('setTimeout') : void 0, setTimeout)(() => {
            if (self.__expressionAnalysisMode__) _traceMember(module, 'focus');

            (module === Object(module) ? self.__expressionAnalysisMode__ ? _getLocal(_scope29, 'module', module) : void 0 : module, module).focus(); // #Hack, code mirror itself (match-highlighter, etc will snatch the focus... ok, make thatt that the body has it
          }, 101);
          // const position = direction === 'left' ? 0 : module.value.length;
          // module.setSelectionRange(position, position);
        }
      }

      _export('default', LivelyCodeMirrorWidgetImport);

      if (self.__expressionAnalysisMode__) _traceMember(Object, 'defineProperty');
      (self.__expressionAnalysisMode__ ? _getGlobal('Object') : void 0, Object).defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal('_recorder_') : void 0, _recorder_), '_src_components_widgets_lively_code_mirror_widget_import_js'), 'LivelyCodeMirrorWidgetImport', {
        get() {
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, 'LivelyCodeMirrorWidgetImport', LivelyCodeMirrorWidgetImport) : void 0, LivelyCodeMirrorWidgetImport;
        },

        set(thisIsVererySecretVariableName) {
          let _scope30 = {
            isScope: true
          };
          _export('default', LivelyCodeMirrorWidgetImport = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope30, 'thisIsVererySecretVariableName', thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName)), true ? _setLocal(_scope, 'LivelyCodeMirrorWidgetImport', LivelyCodeMirrorWidgetImport, {
            file: 'https://lively-kernel.org/lively4/composed-offset/src/components/widgets/lively-code-mirror-widget-import.js',
            end: {
              column: 49,
              line: 19
            },
            start: {
              column: 21,
              line: 19
            },
            source: ''
          }) : void 0, LivelyCodeMirrorWidgetImport;
          return true;
        },

        enumerable: true,
        configurable: true
      });
    }
  };
});