Macro.add('either', {
	skipArgs : true,
	tags     : ['or'],
	handler  : function () {
		try {
            let weightedPayloads = [];
			for (var i = 0, len = this.payload.length; i < len; ++i) {
                let weight = this.payload[i].args.raw ? parseInt(this.payload[i].args.raw) : 1;
				if(Number.isNaN(weight))
					weight = Scripting.evalJavaScript(this.payload[i].args.full);
                weightedPayloads.push({
                    contents:   this.payload[i].contents,
                    weight:     weight
                });
			}
            jQuery(this.output).wiki((weightedPayloads.getRandomWeighted()).contents);
		}
		catch (ex) {
			return this.error('ERROR in either-widget: ' + ex.message);
		}
	}
});
