"enable aexpr";

System.register(["active-expression-rewriting", "src/components/halo/lively-halo-item.js", "src/client/vivide/scripts/saving.js"], function (_export, _context) {
  "use strict";

  var _getAndCallMember, _setMember, _setLocal, _getLocal, _getGlobal, _getMember, _traceMember, HaloItem, getName, writeFile, LivelyHaloVivideSaveScriptItem, __SystemJSRewritingHack, _scope;
  _export("default", void 0);
  return {
    setters: [function (_activeExpressionRewriting) {
      _getAndCallMember = _activeExpressionRewriting.getAndCallMember;
      _setMember = _activeExpressionRewriting.setMember;
      _setLocal = _activeExpressionRewriting.setLocal;
      _getLocal = _activeExpressionRewriting.getLocal;
      _getGlobal = _activeExpressionRewriting.getGlobal;
      _getMember = _activeExpressionRewriting.getMember;
      _traceMember = _activeExpressionRewriting.traceMember;
    }, function (_srcComponentsHaloLivelyHaloItemJs) {
      HaloItem = _srcComponentsHaloLivelyHaloItemJs.default;
    }, function (_srcClientVivideScriptsSavingJs) {
      getName = _srcClientVivideScriptsSavingJs.getName;
      writeFile = _srcClientVivideScriptsSavingJs.writeFile;
    }],
    execute: function () {
      __SystemJSRewritingHack = {};
      _recorder_._src_components_halo_lively_halo_vivide_save_script_item_js = _recorder_._src_components_halo_lively_halo_vivide_save_script_item_js || {};
      _scope = {
        isScope: true
      };
      if (self.__expressionAnalysisMode__) _traceMember(Object, "defineProperty");
      Object.defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal("_recorder_") : void 0, _recorder_), "_src_components_halo_lively_halo_vivide_save_script_item_js"), "HaloItem", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, "HaloItem", HaloItem) : void 0, HaloItem;
        },
        set(thisIsVererySecretVariableName) {
          let _scope2 = {
            isScope: true
          };
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          HaloItem = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope2, "thisIsVererySecretVariableName", thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, "HaloItem", HaloItem, {
            file: 'https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js',
            end: {
              column: 15,
              line: 3
            },
            start: {
              column: 7,
              line: 3
            },
            source: ''
          }) : void 0, HaloItem;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, "defineProperty");
      Object.defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal("_recorder_") : void 0, _recorder_), "_src_components_halo_lively_halo_vivide_save_script_item_js"), "writeFile", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, "writeFile", writeFile) : void 0, writeFile;
        },
        set(thisIsVererySecretVariableName) {
          let _scope3 = {
            isScope: true
          };
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          writeFile = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope3, "thisIsVererySecretVariableName", thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, "writeFile", writeFile, {
            file: 'https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js',
            end: {
              column: 26,
              line: 4
            },
            start: {
              column: 17,
              line: 4
            },
            source: ''
          }) : void 0, writeFile;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, "defineProperty");
      Object.defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal("_recorder_") : void 0, _recorder_), "_src_components_halo_lively_halo_vivide_save_script_item_js"), "getName", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, "getName", getName) : void 0, getName;
        },
        set(thisIsVererySecretVariableName) {
          let _scope4 = {
            isScope: true
          };
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          getName = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope4, "thisIsVererySecretVariableName", thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName), true ? _setLocal(_scope, "getName", getName, {
            file: 'https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js',
            end: {
              column: 15,
              line: 4
            },
            start: {
              column: 8,
              line: 4
            },
            source: ''
          }) : void 0, getName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("default", LivelyHaloVivideSaveScriptItem = class LivelyHaloVivideSaveScriptItem extends HaloItem {
        constructor(...args) {
          let _scope5 = {
            isScope: true
          };
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          super(...(args === Object(args) ? self.__expressionAnalysisMode__ ? _getLocal(_scope5, "args", args) : void 0 : args, args));
          _setMember(this, "__classFilePath__", "https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js", (self.__expressionAnalysisMode__ ? _getGlobal("undefined") : void 0, undefined));
        }
        async onClick() {
          let _scope6 = {
            isScope: true
          };
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          const saveTarget = _getMember((self.__expressionAnalysisMode__ ? _getGlobal("window") : void 0, window), "that");
          const {
            name,
            description,
            url
          } = await (self.__expressionAnalysisMode__ ? _getLocal(_scope, "getName", getName) : void 0, getName)((saveTarget === Object(saveTarget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope6, "saveTarget", saveTarget) : void 0 : saveTarget, saveTarget), "script");
          const content = (self.__expressionAnalysisMode__ ? _traceMember(JSON, "stringify") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("JSON") : void 0, JSON).stringify((self.__expressionAnalysisMode__ ? _traceMember(this, "createJSON") : void 0, this.createJSON((saveTarget === Object(saveTarget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope6, "saveTarget", saveTarget) : void 0 : saveTarget, saveTarget), (name === Object(name) ? self.__expressionAnalysisMode__ ? _getLocal(_scope6, "name", name) : void 0 : name, name), (description === Object(description) ? self.__expressionAnalysisMode__ ? _getLocal(_scope6, "description", description) : void 0 : description, description)))));
          (self.__expressionAnalysisMode__ ? _getLocal(_scope, "writeFile", writeFile) : void 0, writeFile)((url === Object(url) ? self.__expressionAnalysisMode__ ? _getLocal(_scope6, "url", url) : void 0 : url, url), (content === Object(content) ? self.__expressionAnalysisMode__ ? _getLocal(_scope6, "content", content) : void 0 : content, content));
        }
        createJSON(saveTarget, name, description) {
          let _scope7 = {
            isScope: true
          };
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          if ((name === Object(name) ? self.__expressionAnalysisMode__ ? _getLocal(_scope7, "name", name) : void 0 : name, name) === (self.__expressionAnalysisMode__ ? _getGlobal("undefined") : void 0, undefined)) {
            globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
            return;
          }
          /*
          We have to save a multitude of things:
          inputData
          scriptStepson
          And for applications:
          input targets
          output targets
          */
          // We also want to save a description for scripts so we can suggest with more info
          // Additionally we want to safe the shape of the in and out object with types for later suggestion
          const script = _getAndCallMember(_getMember((saveTarget === Object(saveTarget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope7, "saveTarget", saveTarget) : void 0 : saveTarget, saveTarget), "myCurrentScript"), "toJSON", []);
          const stringToSave = {
            script,
            description,
            widget: _getAndCallMember(_getMember(_getMember((saveTarget === Object(saveTarget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope7, "saveTarget", saveTarget) : void 0 : saveTarget, saveTarget), "widget"), "tagName"), "toLowerCase", []),
            inputs: (self.__expressionAnalysisMode__ ? _traceMember(JSON, "stringify") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("JSON") : void 0, JSON).stringify(_getMember((saveTarget === Object(saveTarget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope7, "saveTarget", saveTarget) : void 0 : saveTarget, saveTarget), "input"))),
            inScheme: (self.__expressionAnalysisMode__ ? _traceMember(JSON, "stringify") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("JSON") : void 0, JSON).stringify(_getMember(_getMember((saveTarget === Object(saveTarget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope7, "saveTarget", saveTarget) : void 0 : saveTarget, saveTarget), "input"), 0), (_, value) => {
              let _scope8 = {
                isScope: true
              };
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
              return typeof (value === Object(value) ? self.__expressionAnalysisMode__ ? _getLocal(_scope8, "value", value) : void 0 : value, value) === "object" ? (value === Object(value) ? self.__expressionAnalysisMode__ ? _getLocal(_scope8, "value", value) : void 0 : value, value) : typeof (value === Object(value) ? self.__expressionAnalysisMode__ ? _getLocal(_scope8, "value", value) : void 0 : value, value);
            })),
            outScheme: (self.__expressionAnalysisMode__ ? _traceMember(JSON, "stringify") : void 0, (self.__expressionAnalysisMode__ ? _getGlobal("JSON") : void 0, JSON).stringify(_getMember((self.__expressionAnalysisMode__ ? _traceMember(saveTarget, "getDataToTransmit") : void 0, (saveTarget === Object(saveTarget) ? self.__expressionAnalysisMode__ ? _getLocal(_scope7, "saveTarget", saveTarget) : void 0 : saveTarget, saveTarget).getDataToTransmit()), 0), (_, value) => {
              let _scope9 = {
                isScope: true
              };
              globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
              return typeof (value === Object(value) ? self.__expressionAnalysisMode__ ? _getLocal(_scope9, "value", value) : void 0 : value, value) === "object" ? (value === Object(value) ? self.__expressionAnalysisMode__ ? _getLocal(_scope9, "value", value) : void 0 : value, value) : typeof (value === Object(value) ? self.__expressionAnalysisMode__ ? _getLocal(_scope9, "value", value) : void 0 : value, value);
            }))
          };
          return stringToSave === Object(stringToSave) ? self.__expressionAnalysisMode__ ? _getLocal(_scope7, "stringToSave", stringToSave) : void 0 : stringToSave, stringToSave;
        }
      });
      if (self.__expressionAnalysisMode__) _traceMember(Object, "defineProperty");
      Object.defineProperty(_getMember((self.__expressionAnalysisMode__ ? _getGlobal("_recorder_") : void 0, _recorder_), "_src_components_halo_lively_halo_vivide_save_script_item_js"), "LivelyHaloVivideSaveScriptItem", {
        get() {
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          return self.__expressionAnalysisMode__ ? _getLocal(_scope, "LivelyHaloVivideSaveScriptItem", LivelyHaloVivideSaveScriptItem) : void 0, LivelyHaloVivideSaveScriptItem;
        },
        set(thisIsVererySecretVariableName) {
          let _scope10 = {
            isScope: true
          };
          globalThis.systemActivity["https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js"]++;
          _export("default", LivelyHaloVivideSaveScriptItem = (thisIsVererySecretVariableName === Object(thisIsVererySecretVariableName) ? self.__expressionAnalysisMode__ ? _getLocal(_scope10, "thisIsVererySecretVariableName", thisIsVererySecretVariableName) : void 0 : thisIsVererySecretVariableName, thisIsVererySecretVariableName)), true ? _setLocal(_scope, "LivelyHaloVivideSaveScriptItem", LivelyHaloVivideSaveScriptItem, {
            file: 'https://lively-kernel.org/lively4/lively4-ansgar/src/components/halo/lively-halo-vivide-save-script-item.js',
            end: {
              column: 51,
              line: 6
            },
            start: {
              column: 21,
              line: 6
            },
            source: ''
          }) : void 0, LivelyHaloVivideSaveScriptItem;
          return true;
        },
        enumerable: true,
        configurable: true
      });
    }
  };
});