System.register(["src/client/poid.js", "src/external/focalStorage.js", "utils"], function (_export, _context) {
  "use strict";

  var Scheme, PolymorphicIdentifier, focalStorage, parseQuery, getDeepProperty, TmpScheme, __SystemJSRewritingHack;
  _export("TmpScheme", void 0);
  return {
    setters: [function (_srcClientPoidJs) {
      Scheme = _srcClientPoidJs.Scheme;
      PolymorphicIdentifier = _srcClientPoidJs.default;
    }, function (_srcExternalFocalStorageJs) {
      focalStorage = _srcExternalFocalStorageJs.default;
    }, function (_utils) {
      parseQuery = _utils.parseQuery;
      getDeepProperty = _utils.getDeepProperty;
    }],
    execute: function () {
      __SystemJSRewritingHack = {};
      _recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_protocols_tmp_js = _recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_protocols_tmp_js || {};
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_protocols_tmp_js, "Scheme", {
        get() {
          return Scheme;
        },
        set(thisIsVererySecretVariableName) {
          Scheme = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_protocols_tmp_js, "PolymorphicIdentifier", {
        get() {
          return PolymorphicIdentifier;
        },
        set(thisIsVererySecretVariableName) {
          PolymorphicIdentifier = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_protocols_tmp_js, "focalStorage", {
        get() {
          return focalStorage;
        },
        set(thisIsVererySecretVariableName) {
          focalStorage = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_protocols_tmp_js, "getDeepProperty", {
        get() {
          return getDeepProperty;
        },
        set(thisIsVererySecretVariableName) {
          getDeepProperty = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_protocols_tmp_js, "parseQuery", {
        get() {
          return parseQuery;
        },
        set(thisIsVererySecretVariableName) {
          parseQuery = thisIsVererySecretVariableName;
          return true;
        },
        enumerable: true,
        configurable: true
      });
      _export("TmpScheme", TmpScheme = class TmpScheme extends Scheme {
        get scheme() {
          return "tmp";
        }
        tmpFiles() {
          if (!window.lively4tmpFiles) {
            window.lively4tmpFiles = new Map();
          }
          return window.lively4tmpFiles;
        }
        resolve() {
          return true;
        }
        get path() {
          return this.url.replace(/tmp\:\/\//, "/");
        }
        async GET(options) {
          var path = this.path;
          var content = this.tmpFiles().get(path);
          if (!content) {
            return new Response(path + " not found", {
              status: 404
            });
          }
          return new Response(content, {
            status: 200
          });
        }
        async PUT(options) {
          var path = this.path;
          this.tmpFiles().set(path, options.body);
          return new Response("wrote " + path, {
            status: 200
          });
        }
        async DELETE(options) {
          var path = this.path;
          this.tmpFiles().set(path, null);
          return new Response("deleted " + path, {
            status: 200
          });
        }
        async OPTIONS(options) {
          var path = this.path();
          var content = this.tmpFiles().get(path);
          if (!content) {
            return new Response(JSON.stringify({
              error: "File not found!"
            }), {
              status: 200
            });
          }
          return new Response(JSON.stringify({
            name: path
          }), {
            status: 200
          });
        }
      });
      Object.defineProperty(_recorder_._https__lively_kernel_org_lively4_lively4_ansgar_src_client_protocols_tmp_js, "TmpScheme", {
        get() {
          return TmpScheme;
        },
        set(thisIsVererySecretVariableName) {
          _export("TmpScheme", TmpScheme = thisIsVererySecretVariableName);
          return true;
        },
        enumerable: true,
        configurable: true
      });
      PolymorphicIdentifier.register(TmpScheme);
    }
  };
});