@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
1,515 lines (1,482 loc) • 5.73 MB
JavaScript
#!/usr/bin/env node
process.noDeprecation = true;
import { createRequire as __createRequire } from 'node:module';
import { fileURLToPath as __fileURLToPath } from 'node:url';
import { dirname as __pathDirname } from 'node:path';
const require = __createRequire(import.meta.url);
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod2) => function __require2() {
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
};
var __export = (target, all3) => {
for (var name in all3)
__defProp(target, name, { get: all3[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
mod2
));
// src/app/ICreatorToolsData.ts
var init_ICreatorToolsData = __esm({
"src/app/ICreatorToolsData.ts"() {
"use strict";
}
});
// src/storage/IFile.ts
var init_IFile = __esm({
"src/storage/IFile.ts"() {
"use strict";
}
});
// src/app/IProjectData.ts
var init_IProjectData = __esm({
"src/app/IProjectData.ts"() {
"use strict";
}
});
// src/app/IProjectItemData.ts
var MaxItemTypes;
var init_IProjectItemData = __esm({
"src/app/IProjectItemData.ts"() {
"use strict";
MaxItemTypes = 166;
}
});
// node_modules/ste-core/dist/dispatching/DispatcherBase.js
var require_DispatcherBase = __commonJS({
"node_modules/ste-core/dist/dispatching/DispatcherBase.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DispatcherBase = void 0;
var __1 = require_dist();
var DispatcherBase = class {
constructor() {
this._subscriptions = new Array();
}
/**
* Returns the number of subscriptions.
*
* @readonly
* @type {number}
* @memberOf DispatcherBase
*/
get count() {
return this._subscriptions.length;
}
/**
* Triggered when subscriptions are changed (added or removed).
*
* @readonly
* @type {ISubscribable<SubscriptionChangeEventHandler>}
* @memberOf DispatcherBase
*/
get onSubscriptionChange() {
if (this._onSubscriptionChange == null) {
this._onSubscriptionChange = new __1.SubscriptionChangeEventDispatcher();
}
return this._onSubscriptionChange.asEvent();
}
/**
* Subscribe to the event dispatcher.
*
* @param {TEventHandler} fn The event handler that is called when the event is dispatched.
* @returns A function that unsubscribes the event handler from the event.
*
* @memberOf DispatcherBase
*/
subscribe(fn) {
if (fn) {
this._subscriptions.push(this.createSubscription(fn, false));
this.triggerSubscriptionChange();
}
return () => {
this.unsubscribe(fn);
};
}
/**
* Subscribe to the event dispatcher.
*
* @param {TEventHandler} fn The event handler that is called when the event is dispatched.
* @returns A function that unsubscribes the event handler from the event.
*
* @memberOf DispatcherBase
*/
sub(fn) {
return this.subscribe(fn);
}
/**
* Subscribe once to the event with the specified name.
*
* @param {TEventHandler} fn The event handler that is called when the event is dispatched.
* @returns A function that unsubscribes the event handler from the event.
*
* @memberOf DispatcherBase
*/
one(fn) {
if (fn) {
this._subscriptions.push(this.createSubscription(fn, true));
this.triggerSubscriptionChange();
}
return () => {
this.unsubscribe(fn);
};
}
/**
* Checks it the event has a subscription for the specified handler.
*
* @param {TEventHandler} fn The event handler.
*
* @memberOf DispatcherBase
*/
has(fn) {
if (!fn)
return false;
return this._subscriptions.some((sub) => sub.handler == fn);
}
/**
* Unsubscribes the handler from the dispatcher.
*
* @param {TEventHandler} fn The event handler.
*
* @memberOf DispatcherBase
*/
unsubscribe(fn) {
if (!fn)
return;
let changes = false;
for (let i = 0; i < this._subscriptions.length; i++) {
if (this._subscriptions[i].handler == fn) {
this._subscriptions.splice(i, 1);
changes = true;
break;
}
}
if (changes) {
this.triggerSubscriptionChange();
}
}
/**
* Unsubscribes the handler from the dispatcher.
*
* @param {TEventHandler} fn The event handler.
*
* @memberOf DispatcherBase
*/
unsub(fn) {
this.unsubscribe(fn);
}
/**
* Generic dispatch will dispatch the handlers with the given arguments.
*
* @protected
* @param {boolean} executeAsync `True` if the even should be executed async.
* @param {*} scope The scope of the event. The scope becomes the `this` for handler.
* @param {IArguments} args The arguments for the event.
* @returns {(IPropagationStatus | null)} The propagation status, or if an `executeAsync` is used `null`.
*
* @memberOf DispatcherBase
*/
_dispatch(executeAsync, scope, args) {
for (let sub of [...this._subscriptions]) {
let ev = new __1.EventManagement(() => this.unsub(sub.handler));
let nargs = Array.prototype.slice.call(args);
nargs.push(ev);
let s = sub;
s.execute(executeAsync, scope, nargs);
this.cleanup(sub);
if (!executeAsync && ev.propagationStopped) {
return { propagationStopped: true };
}
}
if (executeAsync) {
return null;
}
return { propagationStopped: false };
}
/**
* Creates a subscription.
*
* @protected
* @param {TEventHandler} handler The handler.
* @param {boolean} isOnce True if the handler should run only one.
* @returns {ISubscription<TEventHandler>} The subscription.
*
* @memberOf DispatcherBase
*/
createSubscription(handler2, isOnce) {
return new __1.Subscription(handler2, isOnce);
}
/**
* Cleans up subs that ran and should run only once.
*
* @protected
* @param {ISubscription<TEventHandler>} sub The subscription.
*
* @memberOf DispatcherBase
*/
cleanup(sub) {
let changes = false;
if (sub.isOnce && sub.isExecuted) {
let i = this._subscriptions.indexOf(sub);
if (i > -1) {
this._subscriptions.splice(i, 1);
changes = true;
}
}
if (changes) {
this.triggerSubscriptionChange();
}
}
/**
* Creates an event from the dispatcher. Will return the dispatcher
* in a wrapper. This will prevent exposure of any dispatcher methods.
*
* @returns {ISubscribable<TEventHandler>}
*
* @memberOf DispatcherBase
*/
asEvent() {
if (this._wrap == null) {
this._wrap = new __1.DispatcherWrapper(this);
}
return this._wrap;
}
/**
* Clears the subscriptions.
*
* @memberOf DispatcherBase
*/
clear() {
if (this._subscriptions.length != 0) {
this._subscriptions.splice(0, this._subscriptions.length);
this.triggerSubscriptionChange();
}
}
/**
* Triggers the subscription change event.
*
* @private
*
* @memberOf DispatcherBase
*/
triggerSubscriptionChange() {
if (this._onSubscriptionChange != null) {
this._onSubscriptionChange.dispatch(this.count);
}
}
};
exports.DispatcherBase = DispatcherBase;
}
});
// node_modules/ste-core/dist/dispatching/DispatchError.js
var require_DispatchError = __commonJS({
"node_modules/ste-core/dist/dispatching/DispatchError.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DispatchError = void 0;
var DispatchError = class extends Error {
/**
* Creates an instance of DispatchError.
* @param {string} message The message.
*
* @memberOf DispatchError
*/
constructor(message) {
super(message);
}
};
exports.DispatchError = DispatchError;
}
});
// node_modules/ste-core/dist/dispatching/DispatcherWrapper.js
var require_DispatcherWrapper = __commonJS({
"node_modules/ste-core/dist/dispatching/DispatcherWrapper.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DispatcherWrapper = void 0;
var DispatcherWrapper = class {
/**
* Creates an instance of DispatcherWrapper.
* @param {ISubscribable<TEventHandler>} dispatcher
*
* @memberOf DispatcherWrapper
*/
constructor(dispatcher) {
this._subscribe = (fn) => dispatcher.subscribe(fn);
this._unsubscribe = (fn) => dispatcher.unsubscribe(fn);
this._one = (fn) => dispatcher.one(fn);
this._has = (fn) => dispatcher.has(fn);
this._clear = () => dispatcher.clear();
this._count = () => dispatcher.count;
this._onSubscriptionChange = () => dispatcher.onSubscriptionChange;
}
/**
* Triggered when subscriptions are changed (added or removed).
*
* @readonly
* @type {ISubscribable<SubscriptionChangeEventHandler>}
* @memberOf DispatcherWrapper
*/
get onSubscriptionChange() {
return this._onSubscriptionChange();
}
/**
* Returns the number of subscriptions.
*
* @readonly
* @type {number}
* @memberOf DispatcherWrapper
*/
get count() {
return this._count();
}
/**
* Subscribe to the event dispatcher.
*
* @param {TEventHandler} fn The event handler that is called when the event is dispatched.
* @returns {() => void} A function that unsubscribes the event handler from the event.
*
* @memberOf DispatcherWrapper
*/
subscribe(fn) {
return this._subscribe(fn);
}
/**
* Subscribe to the event dispatcher.
*
* @param {TEventHandler} fn The event handler that is called when the event is dispatched.
* @returns {() => void} A function that unsubscribes the event handler from the event.
*
* @memberOf DispatcherWrapper
*/
sub(fn) {
return this.subscribe(fn);
}
/**
* Unsubscribe from the event dispatcher.
*
* @param {TEventHandler} fn The event handler that is called when the event is dispatched.
*
* @memberOf DispatcherWrapper
*/
unsubscribe(fn) {
this._unsubscribe(fn);
}
/**
* Unsubscribe from the event dispatcher.
*
* @param {TEventHandler} fn The event handler that is called when the event is dispatched.
*
* @memberOf DispatcherWrapper
*/
unsub(fn) {
this.unsubscribe(fn);
}
/**
* Subscribe once to the event with the specified name.
*
* @returns {() => void} A function that unsubscribes the event handler from the event.
*
* @memberOf DispatcherWrapper
*/
one(fn) {
return this._one(fn);
}
/**
* Checks it the event has a subscription for the specified handler.
*
* @param {TEventHandler} fn The event handler that is called when the event is dispatched.
*
* @memberOf DispatcherWrapper
*/
has(fn) {
return this._has(fn);
}
/**
* Clears all the subscriptions.
*
* @memberOf DispatcherWrapper
*/
clear() {
this._clear();
}
};
exports.DispatcherWrapper = DispatcherWrapper;
}
});
// node_modules/ste-core/dist/dispatching/EventListBase.js
var require_EventListBase = __commonJS({
"node_modules/ste-core/dist/dispatching/EventListBase.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventListBase = void 0;
var EventListBase = class {
constructor() {
this._events = {};
}
/**
* Gets the dispatcher associated with the name.
*
* @param {string} name The name of the event.
* @returns {TEventDispatcher} The disptacher.
*
* @memberOf EventListBase
*/
get(name) {
let event = this._events[name];
if (event) {
return event;
}
event = this.createDispatcher();
this._events[name] = event;
return event;
}
/**
* Removes the dispatcher associated with the name.
*
* @param {string} name
*
* @memberOf EventListBase
*/
remove(name) {
delete this._events[name];
}
};
exports.EventListBase = EventListBase;
}
});
// node_modules/ste-core/dist/management/EventManagement.js
var require_EventManagement = __commonJS({
"node_modules/ste-core/dist/management/EventManagement.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventManagement = void 0;
var EventManagement = class {
/**
* Creates an instance of EventManagement.
* @param {() => void} unsub An unsubscribe handler.
*
* @memberOf EventManagement
*/
constructor(unsub) {
this.unsub = unsub;
this.propagationStopped = false;
}
/**
* Stops the propagation of the event.
* Cannot be used when async dispatch is done.
*
* @memberOf EventManagement
*/
stopPropagation() {
this.propagationStopped = true;
}
};
exports.EventManagement = EventManagement;
}
});
// node_modules/ste-core/dist/handling/HandlingBase.js
var require_HandlingBase = __commonJS({
"node_modules/ste-core/dist/handling/HandlingBase.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HandlingBase = void 0;
var HandlingBase = class {
/**
* Creates an instance of HandlingBase.
* @param {TList} events The event list. Used for event management.
*
* @memberOf HandlingBase
*/
constructor(events) {
this.events = events;
}
/**
* Subscribes once to the event with the specified name.
* @param {string} name The name of the event.
* @param {TEventHandler} fn The event handler.
*
* @memberOf HandlingBase
*/
one(name, fn) {
this.events.get(name).one(fn);
}
/**
* Checks it the event has a subscription for the specified handler.
* @param {string} name The name of the event.
* @param {TEventHandler} fn The event handler.
*
* @memberOf HandlingBase
*/
has(name, fn) {
return this.events.get(name).has(fn);
}
/**
* Subscribes to the event with the specified name.
* @param {string} name The name of the event.
* @param {TEventHandler} fn The event handler.
*
* @memberOf HandlingBase
*/
subscribe(name, fn) {
this.events.get(name).subscribe(fn);
}
/**
* Subscribes to the event with the specified name.
* @param {string} name The name of the event.
* @param {TEventHandler} fn The event handler.
*
* @memberOf HandlingBase
*/
sub(name, fn) {
this.subscribe(name, fn);
}
/**
* Unsubscribes from the event with the specified name.
* @param {string} name The name of the event.
* @param {TEventHandler} fn The event handler.
*
* @memberOf HandlingBase
*/
unsubscribe(name, fn) {
this.events.get(name).unsubscribe(fn);
}
/**
* Unsubscribes from the event with the specified name.
* @param {string} name The name of the event.
* @param {TEventHandler} fn The event handler.
*
* @memberOf HandlingBase
*/
unsub(name, fn) {
this.unsubscribe(name, fn);
}
};
exports.HandlingBase = HandlingBase;
}
});
// node_modules/ste-core/dist/dispatching/PromiseDispatcherBase.js
var require_PromiseDispatcherBase = __commonJS({
"node_modules/ste-core/dist/dispatching/PromiseDispatcherBase.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PromiseDispatcherBase = void 0;
var __1 = require_dist();
var PromiseDispatcherBase = class extends __1.DispatcherBase {
/**
* The normal dispatch cannot be used in this class.
*
* @protected
* @param {boolean} executeAsync `True` if the even should be executed async.
* @param {*} scope The scope of the event. The scope becomes the `this` for handler.
* @param {IArguments} args The arguments for the event.
* @returns {(IPropagationStatus | null)} The propagation status, or if an `executeAsync` is used `null`.
*
* @memberOf DispatcherBase
*/
_dispatch(executeAsync, scope, args) {
throw new __1.DispatchError("_dispatch not supported. Use _dispatchAsPromise.");
}
/**
* Crates a new subscription.
*
* @protected
* @param {TEventHandler} handler The handler.
* @param {boolean} isOnce Indicates if the handler should only run once.
* @returns {ISubscription<TEventHandler>} The subscription.
*
* @memberOf PromiseDispatcherBase
*/
createSubscription(handler2, isOnce) {
return new __1.PromiseSubscription(handler2, isOnce);
}
/**
* Generic dispatch will dispatch the handlers with the given arguments.
*
* @protected
* @param {boolean} executeAsync `True` if the even should be executed async.
* @param {*} scope The scope of the event. The scope becomes the `this` for handler.
* @param {IArguments} args The arguments for the event.
* @returns {(IPropagationStatus | null)} The propagation status, or if an `executeAsync` is used `null`.
*
* @memberOf DispatcherBase
*/
async _dispatchAsPromise(executeAsync, scope, args) {
for (let sub of [...this._subscriptions]) {
let ev = new __1.EventManagement(() => this.unsub(sub.handler));
let nargs = Array.prototype.slice.call(args);
nargs.push(ev);
let ps = sub;
await ps.execute(executeAsync, scope, nargs);
this.cleanup(sub);
if (!executeAsync && ev.propagationStopped) {
return { propagationStopped: true };
}
}
if (executeAsync) {
return null;
}
return { propagationStopped: false };
}
};
exports.PromiseDispatcherBase = PromiseDispatcherBase;
}
});
// node_modules/ste-core/dist/events/PromiseSubscription.js
var require_PromiseSubscription = __commonJS({
"node_modules/ste-core/dist/events/PromiseSubscription.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PromiseSubscription = void 0;
var PromiseSubscription = class {
/**
* Creates an instance of PromiseSubscription.
* @param {TEventHandler} handler The handler for the subscription.
* @param {boolean} isOnce Indicates if the handler should only be executed once.
*
* @memberOf PromiseSubscription
*/
constructor(handler2, isOnce) {
this.handler = handler2;
this.isOnce = isOnce;
this.isExecuted = false;
}
/**
* Executes the handler.
*
* @param {boolean} executeAsync True if the even should be executed async.
* @param {*} scope The scope the scope of the event.
* @param {IArguments} args The arguments for the event.
*
* @memberOf PromiseSubscription
*/
async execute(executeAsync, scope, args) {
if (!this.isOnce || !this.isExecuted) {
this.isExecuted = true;
var fn = this.handler;
if (executeAsync) {
setTimeout(() => {
fn.apply(scope, args);
}, 1);
return;
}
let result = fn.apply(scope, args);
await result;
}
}
};
exports.PromiseSubscription = PromiseSubscription;
}
});
// node_modules/ste-core/dist/events/Subscription.js
var require_Subscription = __commonJS({
"node_modules/ste-core/dist/events/Subscription.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Subscription = void 0;
var Subscription = class {
/**
* Creates an instance of Subscription.
*
* @param {TEventHandler} handler The handler for the subscription.
* @param {boolean} isOnce Indicates if the handler should only be executed once.
*/
constructor(handler2, isOnce) {
this.handler = handler2;
this.isOnce = isOnce;
this.isExecuted = false;
}
/**
* Executes the handler.
*
* @param {boolean} executeAsync True if the even should be executed async.
* @param {*} scope The scope the scope of the event.
* @param {IArguments} args The arguments for the event.
*/
execute(executeAsync, scope, args) {
if (!this.isOnce || !this.isExecuted) {
this.isExecuted = true;
var fn = this.handler;
if (executeAsync) {
setTimeout(() => {
fn.apply(scope, args);
}, 1);
} else {
fn.apply(scope, args);
}
}
}
};
exports.Subscription = Subscription;
}
});
// node_modules/ste-core/dist/dispatching/SubscriptionChangeEventHandler.js
var require_SubscriptionChangeEventHandler = __commonJS({
"node_modules/ste-core/dist/dispatching/SubscriptionChangeEventHandler.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubscriptionChangeEventDispatcher = void 0;
var __1 = require_dist();
var SubscriptionChangeEventDispatcher = class extends __1.DispatcherBase {
/**
* Dispatches the event.
*
* @param {number} count The currrent number of subscriptions.
*
* @memberOf SubscriptionChangeEventDispatcher
*/
dispatch(count) {
this._dispatch(false, this, arguments);
}
};
exports.SubscriptionChangeEventDispatcher = SubscriptionChangeEventDispatcher;
}
});
// node_modules/ste-core/dist/index.js
var require_dist = __commonJS({
"node_modules/ste-core/dist/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubscriptionChangeEventDispatcher = exports.HandlingBase = exports.PromiseDispatcherBase = exports.PromiseSubscription = exports.DispatchError = exports.EventManagement = exports.EventListBase = exports.DispatcherWrapper = exports.DispatcherBase = exports.Subscription = void 0;
var DispatcherBase_1 = require_DispatcherBase();
Object.defineProperty(exports, "DispatcherBase", { enumerable: true, get: function() {
return DispatcherBase_1.DispatcherBase;
} });
var DispatchError_1 = require_DispatchError();
Object.defineProperty(exports, "DispatchError", { enumerable: true, get: function() {
return DispatchError_1.DispatchError;
} });
var DispatcherWrapper_1 = require_DispatcherWrapper();
Object.defineProperty(exports, "DispatcherWrapper", { enumerable: true, get: function() {
return DispatcherWrapper_1.DispatcherWrapper;
} });
var EventListBase_1 = require_EventListBase();
Object.defineProperty(exports, "EventListBase", { enumerable: true, get: function() {
return EventListBase_1.EventListBase;
} });
var EventManagement_1 = require_EventManagement();
Object.defineProperty(exports, "EventManagement", { enumerable: true, get: function() {
return EventManagement_1.EventManagement;
} });
var HandlingBase_1 = require_HandlingBase();
Object.defineProperty(exports, "HandlingBase", { enumerable: true, get: function() {
return HandlingBase_1.HandlingBase;
} });
var PromiseDispatcherBase_1 = require_PromiseDispatcherBase();
Object.defineProperty(exports, "PromiseDispatcherBase", { enumerable: true, get: function() {
return PromiseDispatcherBase_1.PromiseDispatcherBase;
} });
var PromiseSubscription_1 = require_PromiseSubscription();
Object.defineProperty(exports, "PromiseSubscription", { enumerable: true, get: function() {
return PromiseSubscription_1.PromiseSubscription;
} });
var Subscription_1 = require_Subscription();
Object.defineProperty(exports, "Subscription", { enumerable: true, get: function() {
return Subscription_1.Subscription;
} });
var SubscriptionChangeEventHandler_1 = require_SubscriptionChangeEventHandler();
Object.defineProperty(exports, "SubscriptionChangeEventDispatcher", { enumerable: true, get: function() {
return SubscriptionChangeEventHandler_1.SubscriptionChangeEventDispatcher;
} });
}
});
// node_modules/ste-events/dist/EventDispatcher.js
var require_EventDispatcher = __commonJS({
"node_modules/ste-events/dist/EventDispatcher.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventDispatcher = void 0;
var ste_core_1 = require_dist();
var EventDispatcher84 = class extends ste_core_1.DispatcherBase {
/**
* Creates an instance of EventDispatcher.
*
* @memberOf EventDispatcher
*/
constructor() {
super();
}
/**
* Dispatches the event.
*
* @param {TSender} sender The sender object.
* @param {TArgs} args The arguments object.
* @returns {IPropagationStatus} The event status.
*
* @memberOf EventDispatcher
*/
dispatch(sender, args) {
const result = this._dispatch(false, this, arguments);
if (result == null) {
throw new ste_core_1.DispatchError("Got `null` back from dispatch.");
}
return result;
}
/**
* Dispatches the events thread.
* @param sender The sender.
* @param args The arguments object.
*/
dispatchAsync(sender, args) {
this._dispatch(true, this, arguments);
}
/**
* Creates an event from the dispatcher. Will return the dispatcher
* in a wrapper. This will prevent exposure of any dispatcher methods.
*
* @returns {IEvent<TSender, TArgs>} The event.
*
* @memberOf EventDispatcher
*/
asEvent() {
return super.asEvent();
}
};
exports.EventDispatcher = EventDispatcher84;
}
});
// node_modules/ste-events/dist/EventList.js
var require_EventList = __commonJS({
"node_modules/ste-events/dist/EventList.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventList = void 0;
var ste_core_1 = require_dist();
var EventDispatcher_1 = require_EventDispatcher();
var EventList = class extends ste_core_1.EventListBase {
/**
* Creates a new EventList instance.
*/
constructor() {
super();
}
/**
* Creates a new dispatcher instance.
*/
createDispatcher() {
return new EventDispatcher_1.EventDispatcher();
}
};
exports.EventList = EventList;
}
});
// node_modules/ste-events/dist/EventHandlingBase.js
var require_EventHandlingBase = __commonJS({
"node_modules/ste-events/dist/EventHandlingBase.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventHandlingBase = void 0;
var ste_core_1 = require_dist();
var EventList_1 = require_EventList();
var EventHandlingBase = class extends ste_core_1.HandlingBase {
constructor() {
super(new EventList_1.EventList());
}
};
exports.EventHandlingBase = EventHandlingBase;
}
});
// node_modules/ste-events/dist/NonUniformEventList.js
var require_NonUniformEventList = __commonJS({
"node_modules/ste-events/dist/NonUniformEventList.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NonUniformEventList = void 0;
var EventDispatcher_1 = require_EventDispatcher();
var NonUniformEventList = class {
constructor() {
this._events = {};
}
/**
* Gets the dispatcher associated with the name.
* @param name The name of the event.
*/
get(name) {
if (this._events[name]) {
return this._events[name];
}
const event = this.createDispatcher();
this._events[name] = event;
return event;
}
/**
* Removes the dispatcher associated with the name.
* @param name The name of the event.
*/
remove(name) {
delete this._events[name];
}
/**
* Creates a new dispatcher instance.
*/
createDispatcher() {
return new EventDispatcher_1.EventDispatcher();
}
};
exports.NonUniformEventList = NonUniformEventList;
}
});
// node_modules/ste-events/dist/index.js
var require_dist2 = __commonJS({
"node_modules/ste-events/dist/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NonUniformEventList = exports.EventList = exports.EventHandlingBase = exports.EventDispatcher = void 0;
var EventDispatcher_1 = require_EventDispatcher();
Object.defineProperty(exports, "EventDispatcher", { enumerable: true, get: function() {
return EventDispatcher_1.EventDispatcher;
} });
var EventHandlingBase_1 = require_EventHandlingBase();
Object.defineProperty(exports, "EventHandlingBase", { enumerable: true, get: function() {
return EventHandlingBase_1.EventHandlingBase;
} });
var EventList_1 = require_EventList();
Object.defineProperty(exports, "EventList", { enumerable: true, get: function() {
return EventList_1.EventList;
} });
var NonUniformEventList_1 = require_NonUniformEventList();
Object.defineProperty(exports, "NonUniformEventList", { enumerable: true, get: function() {
return NonUniformEventList_1.NonUniformEventList;
} });
}
});
// src/storage/IFileDifference.ts
var init_IFileDifference = __esm({
"src/storage/IFileDifference.ts"() {
"use strict";
}
});
// src/storage/IFolderDifference.ts
var init_IFolderDifference = __esm({
"src/storage/IFolderDifference.ts"() {
"use strict";
}
});
// node_modules/process-nextick-args/index.js
var require_process_nextick_args = __commonJS({
"node_modules/process-nextick-args/index.js"(exports, module) {
"use strict";
if (typeof process === "undefined" || !process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) {
module.exports = { nextTick };
} else {
module.exports = process;
}
function nextTick(fn, arg1, arg2, arg3) {
if (typeof fn !== "function") {
throw new TypeError('"callback" argument must be a function');
}
var len = arguments.length;
var args, i;
switch (len) {
case 0:
case 1:
return process.nextTick(fn);
case 2:
return process.nextTick(function afterTickOne() {
fn.call(null, arg1);
});
case 3:
return process.nextTick(function afterTickTwo() {
fn.call(null, arg1, arg2);
});
case 4:
return process.nextTick(function afterTickThree() {
fn.call(null, arg1, arg2, arg3);
});
default:
args = new Array(len - 1);
i = 0;
while (i < args.length) {
args[i++] = arguments[i];
}
return process.nextTick(function afterTick() {
fn.apply(null, args);
});
}
}
}
});
// node_modules/readable-stream/node_modules/isarray/index.js
var require_isarray = __commonJS({
"node_modules/readable-stream/node_modules/isarray/index.js"(exports, module) {
var toString4 = {}.toString;
module.exports = Array.isArray || function(arr) {
return toString4.call(arr) == "[object Array]";
};
}
});
// node_modules/readable-stream/lib/internal/streams/stream.js
var require_stream = __commonJS({
"node_modules/readable-stream/lib/internal/streams/stream.js"(exports, module) {
module.exports = __require("stream");
}
});
// node_modules/readable-stream/node_modules/safe-buffer/index.js
var require_safe_buffer = __commonJS({
"node_modules/readable-stream/node_modules/safe-buffer/index.js"(exports, module) {
var buffer = __require("buffer");
var Buffer2 = buffer.Buffer;
function copyProps(src, dst) {
for (var key in src) {
dst[key] = src[key];
}
}
if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
module.exports = buffer;
} else {
copyProps(buffer, exports);
exports.Buffer = SafeBuffer;
}
function SafeBuffer(arg, encodingOrOffset, length) {
return Buffer2(arg, encodingOrOffset, length);
}
copyProps(Buffer2, SafeBuffer);
SafeBuffer.from = function(arg, encodingOrOffset, length) {
if (typeof arg === "number") {
throw new TypeError("Argument must not be a number");
}
return Buffer2(arg, encodingOrOffset, length);
};
SafeBuffer.alloc = function(size, fill, encoding) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
var buf = Buffer2(size);
if (fill !== void 0) {
if (typeof encoding === "string") {
buf.fill(fill, encoding);
} else {
buf.fill(fill);
}
} else {
buf.fill(0);
}
return buf;
};
SafeBuffer.allocUnsafe = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return Buffer2(size);
};
SafeBuffer.allocUnsafeSlow = function(size) {
if (typeof size !== "number") {
throw new TypeError("Argument must be a number");
}
return buffer.SlowBuffer(size);
};
}
});
// node_modules/core-util-is/lib/util.js
var require_util = __commonJS({
"node_modules/core-util-is/lib/util.js"(exports) {
function isArray2(arg) {
if (Array.isArray) {
return Array.isArray(arg);
}
return objectToString(arg) === "[object Array]";
}
exports.isArray = isArray2;
function isBoolean2(arg) {
return typeof arg === "boolean";
}
exports.isBoolean = isBoolean2;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber2(arg) {
return typeof arg === "number";
}
exports.isNumber = isNumber2;
function isString2(arg) {
return typeof arg === "string";
}
exports.isString = isString2;
function isSymbol(arg) {
return typeof arg === "symbol";
}
exports.isSymbol = isSymbol;
function isUndefined2(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined2;
function isRegExp2(re) {
return objectToString(re) === "[object RegExp]";
}
exports.isRegExp = isRegExp2;
function isObject2(arg) {
return typeof arg === "object" && arg !== null;
}
exports.isObject = isObject2;
function isDate2(d) {
return objectToString(d) === "[object Date]";
}
exports.isDate = isDate2;
function isError(e) {
return objectToString(e) === "[object Error]" || e instanceof Error;
}
exports.isError = isError;
function isFunction3(arg) {
return typeof arg === "function";
}
exports.isFunction = isFunction3;
function isPrimitive(arg) {
return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
typeof arg === "undefined";
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = __require("buffer").Buffer.isBuffer;
function objectToString(o) {
return Object.prototype.toString.call(o);
}
}
});
// node_modules/inherits/inherits_browser.js
var require_inherits_browser = __commonJS({
"node_modules/inherits/inherits_browser.js"(exports, module) {
if (typeof Object.create === "function") {
module.exports = function inherits2(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
});
}
};
} else {
module.exports = function inherits2(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor;
var TempCtor = function() {
};
TempCtor.prototype = superCtor.prototype;
ctor.prototype = new TempCtor();
ctor.prototype.constructor = ctor;
}
};
}
}
});
// node_modules/inherits/inherits.js
var require_inherits = __commonJS({
"node_modules/inherits/inherits.js"(exports, module) {
try {
util4 = __require("util");
if (typeof util4.inherits !== "function") throw "";
module.exports = util4.inherits;
} catch (e) {
module.exports = require_inherits_browser();
}
var util4;
}
});
// node_modules/readable-stream/lib/internal/streams/BufferList.js
var require_BufferList = __commonJS({
"node_modules/readable-stream/lib/internal/streams/BufferList.js"(exports, module) {
"use strict";
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var Buffer2 = require_safe_buffer().Buffer;
var util4 = __require("util");
function copyBuffer(src, target, offset) {
src.copy(target, offset);
}
module.exports = (function() {
function BufferList() {
_classCallCheck(this, BufferList);
this.head = null;
this.tail = null;
this.length = 0;
}
BufferList.prototype.push = function push(v) {
var entry = { data: v, next: null };
if (this.length > 0) this.tail.next = entry;
else this.head = entry;
this.tail = entry;
++this.length;
};
BufferList.prototype.unshift = function unshift(v) {
var entry = { data: v, next: this.head };
if (this.length === 0) this.tail = entry;
this.head = entry;
++this.length;
};
BufferList.prototype.shift = function shift() {
if (this.length === 0) return;
var ret = this.head.data;
if (this.length === 1) this.head = this.tail = null;
else this.head = this.head.next;
--this.length;
return ret;
};
BufferList.prototype.clear = function clear() {
this.head = this.tail = null;
this.length = 0;
};
BufferList.prototype.join = function join4(s) {
if (this.length === 0) return "";
var p = this.head;
var ret = "" + p.data;
while (p = p.next) {
ret += s + p.data;
}
return ret;
};
BufferList.prototype.concat = function concat(n) {
if (this.length === 0) return Buffer2.alloc(0);
var ret = Buffer2.allocUnsafe(n >>> 0);
var p = this.head;
var i = 0;
while (p) {
copyBuffer(p.data, ret, i);
i += p.data.length;
p = p.next;
}
return ret;
};
return BufferList;
})();
if (util4 && util4.inspect && util4.inspect.custom) {
module.exports.prototype[util4.inspect.custom] = function() {
var obj = util4.inspect({ length: this.length });
return this.constructor.name + " " + obj;
};
}
}
});
// node_modules/readable-stream/lib/internal/streams/destroy.js
var require_destroy = __commonJS({
"node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) {
"use strict";
var pna = require_process_nextick_args();
function destroy(err2, cb) {
var _this = this;
var readableDestroyed = this._readableState && this._readableState.destroyed;
var writableDestroyed = this._writableState && this._writableState.destroyed;
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err2);
} else if (err2) {
if (!this._writableState) {
pna.nextTick(emitErrorNT, this, err2);
} else if (!this._writableState.errorEmitted) {
this._writableState.errorEmitted = true;
pna.nextTick(emitErrorNT, this, err2);
}
}
return this;
}
if (this._readableState) {
this._readableState.destroyed = true;
}
if (this._writableState) {
this._writableState.destroyed = true;
}
this._destroy(err2 || null, function(err3) {
if (!cb && err3) {
if (!_this._writableState) {
pna.nextTick(emitErrorNT, _this, err3);
} else if (!_this._writableState.errorEmitted) {
_this._writableState.errorEmitted = true;
pna.nextTick(emitErrorNT, _this, err3);
}
} else if (cb) {
cb(err3);
}
});
return this;
}
function undestroy() {
if (this._readableState) {
this._readableState.destroyed = false;
this._readableState.reading = false;
this._readableState.ended = false;
this._readableState.endEmitted = false;
}
if (this._writableState) {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
this._writableState.finalCalled = false;
this._writableState.prefinished = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
}
function emitErrorNT(self2, err2) {
self2.emit("error", err2);
}
module.exports = {
destroy,
undestroy
};
}
});
// node_modules/util-deprecate/node.js
var require_node = __commonJS({
"node_modules/util-deprecate/node.js"(exports, module) {
module.exports = __require("util").deprecate;
}
});
// node_modules/readable-stream/lib/_stream_writable.js
var require_stream_writable = __commonJS({
"node_modules/readable-stream/lib/_stream_writable.js"(exports, module) {
"use strict";
var pna = require_process_nextick_args();
module.exports = Writable;
function CorkedRequest(state) {
var _this = this;
this.next = null;
this.entry = null;
this.finish = function() {
onCorkedFinish(_this, state);
};
}
var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
var Duplex;
Writable.WritableState = WritableState;
var util4 = Object.create(require_util());
util4.inherits = require_inherits();
var internalUtil = {
deprecate: require_node()
};
var Stream = require_stream();
var Buffer2 = require_safe_buffer().Buffer;
var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
};
function _uint8ArrayToBuffer(chunk) {
return Buffer2.from(chunk);
}
function _isUint8Array(obj) {
return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
}
var destroyImpl = require_destroy();
util4.inherits(Writable, Stream);
function nop() {
}
function WritableState(options, stream4) {
Duplex = Duplex || require_stream_duplex();
options = options || {};
var isDuplex = stream4 instanceof Duplex;
this.objectMode = !!options.objectMode;
if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
var hwm = options.highWaterMark;
var writableHwm = options.writableHighWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
if (hwm || hwm === 0) this.highWaterMark = hwm;
else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;
else this.highWaterMark = defaultHwm;
this.highWaterMark = Math.floor(this.highWaterMark);
this.finalCalled = false;
this.needDrain = false;
this.ending = false;
this.ended = false;
this.finished = false;
this.destroyed = false;
var noDecode = options.decodeStrings === false;
this.decodeStrings = !noDecode;
this.defaultEncoding = options.defaultEncoding || "utf8";
this.length = 0;
this.writing = false;
this.corked = 0;
this.sync = true;
this.bufferProcessing = false;
this.onwrite = function(er) {
onwrite(stream4, er);
};
this.writecb = null;
this.writelen = 0;
this.bufferedRequest = null;
this.lastBufferedRequest = null;
this.pendingcb = 0;
this.prefinished = false;
this.errorEmitted = false;
this.bufferedRequestCount = 0;
this.corkedRequestsFree = new CorkedRequest(this);
}
WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function() {
try {
Object.defineProperty(WritableState.prototype, "buffer", {
get: internalUtil.deprecate(function() {
return this.getBuffer();
}, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
});
} catch (_) {
}
})();
var realHasInstance;
if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
realHasInstance = Function.prototype[Symbol.hasInstance];
Object.defineProperty(Writable, Symbol.hasInstance, {
value: function(object) {
if (realHasInstance.call(this, object)) return true;
if (this !== Writable) return false;
return object && object._writableState instanceof WritableState;
}
});
} else {
realHasInstance = function(object) {
return object instanceof this;
};
}
function Writable(options) {
Duplex = Duplex || require_stream_duplex();
if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
return new Writable(options);
}
this._writableState = new WritableState(options, this);
this.writable = true;
if (options) {
if (typeof options.write === "function") this._write = options.write;
if (typeof options.writev === "function") this._writev = options.writev;
if (typeof options.destroy