<commit_before>(function() {

var blip = {};
var ctx = new AudioContext();

/**
 * Generates a GUID string.
 * @returns {String} The generated GUID.
 * @example af8a8416-6e18-a307-bd9c-f2c947bbb3aa
 * @author Slavik Meltser (slavik@meltser.info).
 * @link http://slavik.meltser.info/?p=142
 */
function guid() {
    function _p8(s) {
        var p = (Math.random().toString(16)+"000000000").substr(2,8);
        return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p ;
    }
    return _p8() + _p8(true) + _p8(true) + _p8();
}

// the associated functions will be used by the `createNode` function below
var nodeTypes = {
  'gain': ctx.createGain,
  'delay': ctx.createDelay,
  'panner': ctx.createPanner,
  'convolver': ctx.createConvolver,
  'analyser': ctx.createAnalyser,
  'channelSplitter': ctx.createChannelSplitter,
  'channelMerger': ctx.createChannelMerger,
  'dynamicsCompressor': ctx.createDynamicsCompressor,
  'biquadFilter': ctx.createBiquadFilter,
  'waveShaper': ctx.createWaveShaper,
  'oscillator': ctx.createOscillator,
  'periodicWave': ctx.createPeriodicWave,
  'bufferSource': ctx.createBufferSource,
  'audioBufferSource': ctx.createBufferSource, // alias

  // USER SHOULD NOT USE THESE DIRECTLY
  // use `blip.listener` and `blip.destination` instead
  'listener': function() { return ctx.listener; },
  'destination': function() { return ctx.destination; }
};

blip.node = function(type) {

  var other_args = Array.prototype.slice.call(arguments, 1);

  var reference = createNode(type);

  var id = guid();

  function node() {}

  function createNode(t) {
    return nodeTypes[t].apply(ctx, other_args);
  }

  node.connect = function(blipnode) {
    reference.connect(blipnode.node())
    return node;
  };
  node.param = function(name, f) {
    if (arguments.length < 2) return reference[name];
    if (typeof f !== 'function') {
      reference[name].value = f;
    } else {
      f.call(reference[name]);
    }
    return node;
  };
  node.node = function() {
    return reference;
  };
  node.id = function() {
    return id;
  };

  return node;

}

// special nodes
blip.destination = blip.node('destination');
blip.listener = blip.node('listener');

/*
 Precise scheduling for audio events is
 based on the method described in this article by Chris Wilson:
   http://www.html5rocks.com/en/tutorials/audio/scheduling/
*/

blip.loop = function() {

  var lookahead = 25.0, // ms
      scheduleAheadTime = 0.1; // s

  var tempo; // ticks per minute

  var data = [];

  var currentTick = 0,
      nextTickTime = 0;

  var tick = function(t, d, i) {};

  var iterations = 0,
      limit = 0;

  var timer;

  function loop() {}

  function nextTick() {
    var secondsPerTick = 60 / tempo;
    nextTickTime += secondsPerTick;

    // cycle through ticks
    if (++currentTick >= data.length) {
      currentTick = 0;
      iterations += 1;
    }

  }

  function scheduleTick(tickNum, time) {
    tick.call(loop, time, data[tickNum], tickNum);
  }

  function scheduler() {
    while (nextTickTime < ctx.currentTime + scheduleAheadTime) {
      scheduleTick(currentTick, nextTickTime);
      nextTick();
    }
    timer = window.setTimeout(scheduler, lookahead);
    if (limit && iterations >= limit) {
      loop.stop().reset();
    }
  }

  loop.tempo = function(bpm) {
    if (!arguments.length) return tempo;
    tempo = bpm;
    return loop;
  };
  loop.data = function(a) {
    if (!arguments.length) return data;
    data = a;
    return loop;
  };
  loop.lookahead = function(ms) {
    if (!arguments.length) return lookahead;
    lookahead = ms;
    return loop;
  };
  loop.scheduleAheadTime = function(s) {
    if (!arguments.length) return scheduleAheadTime;
    scheduleAheadTime = s;
    return loop;
  };
  loop.limit = function(n) {
    if (!arguments.length) return limit;
    limit = n;
    return loop;
  };
  loop.tick = function(f) {
    if (!arguments.length) return tick;
    tick = f;
    return loop;
  };
  loop.start = function(t) {
    nextTickTime = t || ctx.currentTime;
    scheduler();
    return loop;
  };
  loop.stop = function() {
    window.clearTimeout(timer);
    return loop;
  };
  loop.reset = function() {
    currentTick = 0;
    iterations = 0;
    return loop;
  };

  return loop;

};

var loadedSamples = {};

blip.sampleLoader = function() {

  var samples = {};

  var each = function() {},
      done = function() {};

  function loader() {
    var names = Object.keys(samples);
    var i = 0;
    next();
    function next() {
      if (i < names.length) {
        var name = names[i];
        i++;
        loadSample(name, samples[name]);
      } else {
        done();
      }
    }
    function loadSample(name, url) {
      var request = new XMLHttpRequest();
      request.open('GET', url, true);
      request.responseType = 'arraybuffer';
      request.addEventListener('load', loaded, false);
      request.send();
      function loaded(event) {
        var req = event.target;
        var arrayBuffer = req.response;
        ctx.decodeAudioData(arrayBuffer, decoded);
      }
      function decoded(buffer) {
        loadedSamples[name] = buffer;
        each(name);
        next();
      }
    }
  }

  loader.samples = function(o) {
    if (!arguments.length) return samples;
    samples = o;
    return loader;
  }
  loader.each = function(f) {
    if (!arguments.length) return each;
    each = f;
    return loader;
  };
  loader.done = function(f) {
    if (!arguments.length) return done;
    done = f;
    return loader;
  };
  loader.load = function() {
    return loader();
  };

  return loader;
}

blip.clip = function() {

  var sample,
      rate = 1,
      gain = 1;

  var gain = blip.node('gain').node()

  function clip() {}

  clip.sample = function(name) {
    if (!arguments.length) return sample;
    sample = loadedSamples[name];
    return clip;
  };
  clip.defaultRate = function(number) {
    if (!arguments.length) return defaultRate;
    defaultRate = number;
    return clip;
  };
  clip.rate = function(number) {
    if (!arguments.length) return rate;
    rate = number;
    return clip;
  };
  clip.gain = function(number) {
    if (!arguments.length) return gain;
    gain = number;
    return clip;
  };
  clip.play = function(time) {
    var source = blip.node('bufferSource').node()
    source.buffer = sample;
    source.playbackRate.value = rate;
    source.connect(outputGain);
    outputGain.gain.value = gain;
    source.start(time);
  };

  return clip;
}

blip.getContext = function() { return ctx; };
blip.getLoadedSamples = function() { return loadedSamples; };

window.blip = blip;

})()
<commit_msg>update to latest build<commit_after>(function() {

var blip = {};
var ctx = new AudioContext();

/**
 * Generates a GUID string.
 * @returns {String} The generated GUID.
 * @example af8a8416-6e18-a307-bd9c-f2c947bbb3aa
 * @author Slavik Meltser (slavik@meltser.info).
 * @link http://slavik.meltser.info/?p=142
 */
function guid() {
    function _p8(s) {
        var p = (Math.random().toString(16)+"000000000").substr(2,8);
        return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p ;
    }
    return _p8() + _p8(true) + _p8(true) + _p8();
}

function BlipNodeCollection(nodes) {
  this.nodes = nodes || [];
}

BlipNodeCollection.prototype = {

  each: function(f) {
    for (var i = 0; i < this.nodes.length; i++) {
      f.call(this, this.nodes[i], i, this.nodes);
    }
  },

  contains: function(node) {
    for (var i = 0; i < this.nodes.length; i++) {
      if (this.nodes[i] === node) return true;
    }
    return false;
  },

  add: function(node) {
    if (this.nodes.indexOf(node) === -1) this.nodes.push(node);
  },

  remove: function(node) {
    var index = this.nodes.indexOf(node);
    if (index !== -1) this.nodes.splice(index, 1);
  },

  removeAll: function() {
    this.nodes = [];
  }

};

// the associated functions will be used by the `createNode` function within `blip.node`
var nodeTypes = {
  'gain': ctx.createGain,
  'delay': ctx.createDelay,
  'panner': ctx.createPanner,
  'convolver': ctx.createConvolver,
  'analyser': ctx.createAnalyser,
  'channelSplitter': ctx.createChannelSplitter,
  'channelMerger': ctx.createChannelMerger,
  'dynamicsCompressor': ctx.createDynamicsCompressor,
  'biquadFilter': ctx.createBiquadFilter,
  'waveShaper': ctx.createWaveShaper,
  'oscillator': ctx.createOscillator,
  'periodicWave': ctx.createPeriodicWave,
  'bufferSource': ctx.createBufferSource,
  'audioBufferSource': ctx.createBufferSource, // alias
};

function BlipNode() {
  return this;
};

BlipNode.prototype = {

  inputs: new BlipNodeCollection(),

  outputs: new BlipNodeCollection(),

  connect: function(blipnode) {
    if (this.node().numberOfOutputs > 0 && blipnode.node().numberOfInputs > 0) {
      this.node().connect(blipnode.node());
      this.outputs.add(blipnode);
      blipnode.inputs.add(this);
    }
    return this;
  },

  disconnect: function(blipnode) {
    // disconnect all
    this.node().disconnect();

    if (blipnode) {
      this.outputs.remove(blipnode);
      blipnode.inputs.remove(this);

      // reconnect to remaining outputs
      this.outputs.each(function(d) { this.connect(d); })
    } else {
      this.outputs.each(function(d) {
        d.inputs.remove(this);
      });
      this.outputs.removeAll();
    }

    return this;
  },

  prop: function(name, value) {
    if (arguments.length < 2) {
      if (typeof name === 'object') {
        for (var p in name) {
          this.node()[p] = name[p];
        }
        return this;
      } else {
        return this.node()[name];
      }
    }
    this.node()[name] = value;
    return this;
  },

  param: function(name, f) {
    if (arguments.length < 2) return this.node()[name];
    if (typeof f !== 'function') {
      this.node()[name].value = f;
    } else {
      f.call(this.node()[name]);
    }
    return this;
  },

  start: function(t) {
    this.node().start.call(this.node(), t);
  },

  stop: function(t) {
    this.node().stop.call(this.node(), t);
  },

  node: function() {
    return this.node();
  },

  toString: function() {
    return '[object BlipNode]';
  },

  valueOf: function() {
    return this.id();
  }

};

blip.node = function(type) {

  var other_args = Array.prototype.slice.call(arguments, 1);

  var reference = createNode(type);

  var id = guid();

  var node = new BlipNode();

  function createNode(t) {
    return nodeTypes[t].apply(ctx, other_args);
  }

  node.node = function() {
    return reference;
  };

  node.id = function() {
    return id;
  };

  return node;

}

var specialBlipNode = function(ref) {
  var node = new BlipNode();
  var id = guid();
  node.node = function() { return ref; };
  node.id = function() { return id; };
  return node;
}

// special nodes
blip.destination = specialBlipNode(ctx.destination);
blip.listener = specialBlipNode(ctx.listener);
blip.chain = function(nodes) {

  nodes = nodes || [];

  wire();

  function chain() {}

  function wire() {
    for (var i = 0; i < nodes.length-1; i++) {
      nodes[i].connect(nodes[i+1]);
    }
  }

  chain.node = function(blipnode) {
    nodes.push(blipnode);
    wire();
    return chain;
  };
  chain.start = function() {
    var a = nodes.slice(0,1);
    return a.length ? a[0] : null;
  };
  chain.end = function() {
    var a = nodes.slice(-1);
    console.log(a);
    return a.length ? a[0] : null;
  };
  chain.from = function(blipnode) {
    blipnode.connect(chain.start());
    return chain;
  };
  chain.to = function(blipnode) {
    chain.end().connect(blipnode);
    return chain;
  };
  chain.wire = function() {
    wire();
    return chain;
  }

  return chain;
}

/*
 Precise scheduling for audio events is
 based on the method described in this article by Chris Wilson:
   http://www.html5rocks.com/en/tutorials/audio/scheduling/
*/

blip.loop = function() {

  var lookahead = 25.0, // ms
      scheduleAheadTime = 0.1; // s

  var tempo; // ticks per minute

  var data = [];

  var currentTick = 0,
      nextTickTime = 0;

  var tick = function(t, d, i) {};

  var iterations = 0,
      limit = 0;

  var timer;

  function loop() {}

  function nextTick() {
    var secondsPerTick = 60 / tempo;
    nextTickTime += secondsPerTick;

    // cycle through ticks
    if (++currentTick >= data.length) {
      currentTick = 0;
      iterations += 1;
    }

  }

  function scheduleTick(tickNum, time) {
    tick.call(loop, time, data[tickNum], tickNum);
  }

  function scheduler() {
    while (nextTickTime < ctx.currentTime + scheduleAheadTime) {
      scheduleTick(currentTick, nextTickTime);
      nextTick();
      if (limit && iterations >= limit) {
        loop.reset();
        return;
      }
    }
    timer = window.setTimeout(scheduler, lookahead);
  }

  loop.tempo = function(bpm) {
    if (!arguments.length) return tempo;
    tempo = bpm;
    return loop;
  };
  loop.data = function(a) {
    if (!arguments.length) return data;
    data = a;
    return loop;
  };
  loop.lookahead = function(ms) {
    if (!arguments.length) return lookahead;
    lookahead = ms;
    return loop;
  };
  loop.scheduleAheadTime = function(s) {
    if (!arguments.length) return scheduleAheadTime;
    scheduleAheadTime = s;
    return loop;
  };
  loop.limit = function(n) {
    if (!arguments.length) return limit;
    limit = n;
    return loop;
  };
  loop.tick = function(f) {
    if (!arguments.length) return tick;
    tick = f;
    return loop;
  };
  loop.start = function(t) {
    nextTickTime = t || ctx.currentTime;
    scheduler();
    return loop;
  };
  loop.stop = function() {
    window.clearTimeout(timer);
    return loop;
  };
  loop.reset = function() {
    currentTick = 0;
    iterations = 0;
    return loop;
  };

  return loop;

};

var loadedSamples = {};

blip.sampleLoader = function() {

  var samples = {};

  var each = function() {},
      done = function() {};

  function loader() {
    var names = Object.keys(samples);
    var i = 0;
    next();
    function next() {
      if (i < names.length) {
        var name = names[i];
        i++;
        loadSample(name, samples[name]);
      } else {
        done();
      }
    }
    function loadSample(name, url) {
      var request = new XMLHttpRequest();
      request.open('GET', url, true);
      request.responseType = 'arraybuffer';
      request.addEventListener('load', loaded, false);
      request.send();
      function loaded(event) {
        var req = event.target;
        var arrayBuffer = req.response;
        ctx.decodeAudioData(arrayBuffer, decoded);
      }
      function decoded(buffer) {
        loadedSamples[name] = buffer;
        each(name);
        next();
      }
    }
  }

  loader.samples = function(o) {
    if (!arguments.length) return samples;
    samples = o;
    return loader;
  };
  loader.each = function(f) {
    if (!arguments.length) return each;
    each = f;
    return loader;
  };
  loader.done = function(f) {
    if (!arguments.length) return done;
    done = f;
    return loader;
  };
  loader.load = function() {
    return loader();
  };

  return loader;
}

blip.clip = function() {

  var sample,
      rate = 1,
      gain = 1;

  var chain = null;

  var output_gain = blip.node('gain').connect(blip.destination);

  function clip() {}

  clip.sample = function(name) {
    if (!arguments.length) return sample;
    sample = loadedSamples[name];
    return clip;
  };
  clip.defaultRate = function(number) {
    if (!arguments.length) return defaultRate;
    defaultRate = number;
    return clip;
  };
  clip.rate = function(number) {
    if (!arguments.length) return rate;
    rate = number;
    return clip;
  };
  clip.gain = function(number) {
    if (!arguments.length) return gain;
    gain = number;
    return clip;
  };
  clip.chain = function(c) {
    if (!arguments.length) return chain;
    chain = c;
    output_gain.disconnect(blip.destination);
    chain.from(output_gain).to(blip.destination);
    return clip;
  };
  clip.play = function(time, params) {
    var source = ctx.createBufferSource();
    source.buffer = sample;

    if (params) {
      if (typeof params.gain !== 'undefined') {
        if (typeof params.gain === 'function') {
          output_gain.param('gain', params.gain)
        } else {
          output_gain.param('gain', function() {
            this.setValueAtTime(params.gain, time)
          })
        }
      }
      if (typeof params.rate !== 'undefined') {
        if (typeof params.rate === 'function') {
          BlipNode.prototype.param.call(specialBlipNode(source), 'playbackRate', params.rate)
        } else {
          source.playbackRate.setValueAtTime(params.rate, time)
        }
      }
    }

    source.connect(output_gain.node());
    source.start(time);
  };

  return clip;
}

blip.getContext = function() { return ctx; };
blip.getLoadedSamples = function() { return loadedSamples; };
blip.sample = function(name) {
  return loadedSamples[name];
}

window.blip = blip;

})()
<|endoftext|>


<commit_before>import Transform from '../Transform';
import {id, ingest} from '../Tuple';
import {error, inherits} from 'vega-util';
import {map} from 'd3-collection';

/**
 * Joins a set of data elements against a set of visual items.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): object} [params.item] - An item generator function.
 * @param {function(object): *} [params.key] - The key field associating data and visual items.
 */
export default function DataJoin(params) {
  Transform.call(this, map(), params);
}

var prototype = inherits(DataJoin, Transform);

function defaultItemCreate() {
  return ingest({});
}

prototype.transform = function(_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE),
      item = _.item || defaultItemCreate,
      key = _.key || id,
      lut = this.value;

  if (_.modified('key') || pulse.modified(key)) {
    // TODO: support re-keying?
    error('DataJoin does not support modified key function or fields.');
  }

  pulse.visit(pulse.ADD, function(t) {
    var k = key(t),
        x = lut.get(k);

    if (x) {
      out.mod.push(x);
    } else {
      lut.set(k, x = item(t));
      out.add.push(x);
    }

    x.datum = t;
  });

  pulse.visit(pulse.MOD, function(t) {
    var k = key(t),
        x = lut.get(k);

    if (x) {
      out.mod.push(x);
    }
  });

  pulse.visit(pulse.REM, function(t) {
    var k = key(t),
        x = lut.get(k);

    if (t === x.datum) {
      lut.remove(k);
      out.rem.push(x);
    }
  });

  return out;
};
<commit_msg>DataJoin should reuse item instances.<commit_after>import Transform from '../Transform';
import {id, ingest} from '../Tuple';
import {error, inherits} from 'vega-util';
import {map} from 'd3-collection';

/**
 * Joins a set of data elements against a set of visual items.
 * @constructor
 * @param {object} params - The parameters for this operator.
 * @param {function(object): object} [params.item] - An item generator function.
 * @param {function(object): *} [params.key] - The key field associating data and visual items.
 */
export default function DataJoin(params) {
  Transform.call(this, map(), params);
}

var prototype = inherits(DataJoin, Transform);

function defaultItemCreate() {
  return ingest({});
}

prototype.transform = function(_, pulse) {
  var out = pulse.fork(pulse.NO_SOURCE),
      item = _.item || defaultItemCreate,
      key = _.key || id,
      lut = this.value;

  if (_.modified('key') || pulse.modified(key)) {
    // TODO: support re-keying?
    error('DataJoin does not support modified key function or fields.');
  }

  pulse.visit(pulse.ADD, function(t) {
    var k = key(t),
        x = lut.get(k);

    if (x) {
      (x.exit ? out.add : out.mod).push(x);
    } else {
      lut.set(k, x = item(t));
      out.add.push(x);
    }

    x.datum = t;
    x.exit = false;
  });

  pulse.visit(pulse.MOD, function(t) {
    var k = key(t),
        x = lut.get(k);

    if (x) {
      out.mod.push(x);
    }
  });

  pulse.visit(pulse.REM, function(t) {
    var k = key(t),
        x = lut.get(k);

    if (t === x.datum) {
      out.rem.push(x);
      x.exit = true;
    }
  });

  return out;
};
<|endoftext|>


<commit_before>/*global define*/
define([
        'Core/defaultValue',
        'Core/FeatureDetection'
    ], function(
        defaultValue,
        FeatureDetection) {
    'use strict';

    function createMouseEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var view = defaultValue(options.view, window);
        var detail = defaultValue(options.detail, 0);
        var screenX = defaultValue(options.screenX, 0);
        var screenY = defaultValue(options.screenY, 0);
        var clientX = defaultValue(options.clientX, 0);
        var clientY = defaultValue(options.clientY, 0);
        var ctrlKey = defaultValue(options.ctrlKey, false);
        var altKey = defaultValue(options.altKey, false);
        var shiftKey = defaultValue(options.shiftKey, false);
        var metaKey = defaultValue(options.metaKey, false);
        var button = defaultValue(options.button, 0);
        var relatedTarget = defaultValue(options.relatedTarget, null);

        var event = document.createEvent('MouseEvent');
        event.initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);
        return event;
    }

    function createModifiersList(ctrlKey, altKey, shiftKey, metaKey) {
        var modifiers = [];
        if (ctrlKey) {
            modifiers.push('Control');
        }
        if (altKey) {
            modifiers.push('Alt');
        }
        if (shiftKey) {
            modifiers.push('Shift');
        }
        if (metaKey) {
            modifiers.push('Meta');
        }
        return modifiers.join(' ');
    }

    // MouseWheelEvent is legacy
    function createMouseWheelEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var view = defaultValue(options.view, window);
        var detail = defaultValue(options.detail, 0);
        var screenX = defaultValue(options.screenX, 0);
        var screenY = defaultValue(options.screenY, 0);
        var clientX = defaultValue(options.clientX, 0);
        var clientY = defaultValue(options.clientY, 0);
        var button = defaultValue(options.button, 0);
        var relatedTarget = defaultValue(options.relatedTarget, null);
        var ctrlKey = defaultValue(options.ctrlKey, false);
        var altKey = defaultValue(options.altKey, false);
        var shiftKey = defaultValue(options.shiftKey, false);
        var metaKey = defaultValue(options.metaKey, false);
        var wheelDelta = defaultValue(options.wheelDelta, 0);

        var event = document.createEvent('MouseWheelEvent');
        var modifiersList = createModifiersList(ctrlKey, altKey, shiftKey, metaKey);
        event.initMouseWheelEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, button, relatedTarget, modifiersList, wheelDelta);
        return event;
    }

    function createWheelEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var view = defaultValue(options.view, window);
        var detail = defaultValue(options.detail, 0);
        var screenX = defaultValue(options.screenX, 0);
        var screenY = defaultValue(options.screenY, 0);
        var clientX = defaultValue(options.clientX, 0);
        var clientY = defaultValue(options.clientY, 0);
        var button = defaultValue(options.button, 0);
        var relatedTarget = defaultValue(options.relatedTarget, null);
        var ctrlKey = defaultValue(options.ctrlKey, false);
        var altKey = defaultValue(options.altKey, false);
        var shiftKey = defaultValue(options.shiftKey, false);
        var metaKey = defaultValue(options.metaKey, false);
        var deltaX = defaultValue(options.deltaX, 0);
        var deltaY = defaultValue(options.deltaY, 0);
        var deltaZ = defaultValue(options.deltaZ, 0);
        var deltaMode = defaultValue(options.deltaMode, 0);

        try {
            /*global WheelEvent*/
            return new WheelEvent(type, {
                view : view,
                detail : detail,
                screenX : screenX,
                screenY : screenY,
                clientX : clientX,
                clientY : clientY,
                button : button,
                relatedTarget : relatedTarget,
                ctrlKey : ctrlKey,
                altKey : altKey,
                shiftKey : shiftKey,
                metaKey : metaKey,
                deltaX : deltaX,
                deltaY : deltaY,
                deltaZ : deltaZ,
                deltaMode : deltaMode
            });
        } catch (e) {
            var event = document.createEvent('WheelEvent');
            var modifiersList = createModifiersList(ctrlKey, altKey, shiftKey, metaKey);
            event.initWheelEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, button, relatedTarget, modifiersList, deltaX, deltaY, deltaZ, deltaMode);
            return event;
        }
    }

    function createTouchEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var view = defaultValue(options.view, window);
        var detail = defaultValue(options.detail, 0);

        var event = document.createEvent('UIEvent');
        event.initUIEvent(type, canBubble, cancelable, view, detail);

        event.touches = defaultValue(options.touches, []);
        event.targetTouches = defaultValue(options.targetTouches, []);
        event.changedTouches = defaultValue(options.changedTouches, []);

        return event;
    }

    function createPointerEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var event;

        if (FeatureDetection.isInternetExplorer()) {
            var canBubble = defaultValue(options.canBubble, true);
            var cancelable = defaultValue(options.cancelable, true);
            var view = defaultValue(options.view, window);
            var detail = defaultValue(options.detail, 0);
            var screenX = defaultValue(options.screenX, 0);
            var screenY = defaultValue(options.screenY, 0);
            var clientX = defaultValue(options.clientX, 0);
            var clientY = defaultValue(options.clientY, 0);
            var ctrlKey = defaultValue(options.ctrlKey, false);
            var altKey = defaultValue(options.altKey, false);
            var shiftKey = defaultValue(options.shiftKey, false);
            var metaKey = defaultValue(options.metaKey, false);
            var button = defaultValue(options.button, 0);
            var relatedTarget = defaultValue(options.relatedTarget, null);
            var offsetX = defaultValue(options.offsetX, 0);
            var offsetY = defaultValue(options.offsetY, 0);
            var width = defaultValue(options.width, 0);
            var height = defaultValue(options.height, 0);
            var pressure = defaultValue(options.pressure, 0);
            var rotation = defaultValue(options.rotation, 0);
            var tiltX = defaultValue(options.tiltX, 0);
            var tiltY = defaultValue(options.tiltY, 0);
            var pointerId = defaultValue(options.pointerId, 1);
            var pointerType = defaultValue(options.pointerType, 0);
            var hwTimestamp = defaultValue(options.hwTimestamp, 0);
            var isPrimary = defaultValue(options.isPrimary, 0);

            event = document.createEvent('PointerEvent');
            event.initPointerEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY,
                    ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, offsetX, offsetY, width, height,
                    pressure, rotation, tiltX, tiltY, pointerId, pointerType, hwTimestamp, isPrimary);
        } else {
            event = new window.PointerEvent(type, {
                canBubble : defaultValue(options.canBubble, true),
                cancelable : defaultValue(options.cancelable, true),
                view : defaultValue(options.view, window),
                detail : defaultValue(options.detail, 0),
                screenX : defaultValue(options.screenX, 0),
                screenY : defaultValue(options.screenY, 0),
                clientX : defaultValue(options.clientX, 0),
                clientY : defaultValue(options.clientY, 0),
                ctrlKey : defaultValue(options.ctrlKey, false),
                altKey : defaultValue(options.altKey, false),
                shiftKey : defaultValue(options.shiftKey, false),
                metaKey : defaultValue(options.metaKey, false),
                button : defaultValue(options.button, 0),
                relatedTarget : defaultValue(options.relatedTarget, null),
                offsetX : defaultValue(options.offsetX, 0),
                offsetY : defaultValue(options.offsetY, 0),
                width : defaultValue(options.width, 0),
                height : defaultValue(options.height, 0),
                pressure : defaultValue(options.pressure, 0),
                rotation : defaultValue(options.rotation, 0),
                tiltX : defaultValue(options.tiltX, 0),
                tiltY : defaultValue(options.tiltY, 0),
                pointerId : defaultValue(options.pointerId, 1),
                pointerType : defaultValue(options.pointerType, 0),
                hwTimestamp : defaultValue(options.hwTimestamp, 0),
                isPrimary : defaultValue(options.isPrimary, 0)
            });
        }
        return event;
    }

    function createDeviceOrientationEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var alpha = defaultValue(options.alpha, 0.0);
        var beta = defaultValue(options.beta, 0.0);
        var gamma = defaultValue(options.gamma, 0.0);
        var absolute = defaultValue(options.absolute, false);

        var event = document.createEvent('DeviceOrientationEvent');
        event.initDeviceOrientationEvent(type, canBubble, cancelable, alpha, beta, gamma, absolute);
        return event;
    }

    var DomEventSimulator = {
        fireMouseDown : function(element, options) {
            element.dispatchEvent(createMouseEvent('mousedown', options));
        },
        fireMouseUp : function(element, options) {
            element.dispatchEvent(createMouseEvent('mouseup', options));
        },
        fireMouseMove : function(element, options) {
            element.dispatchEvent(createMouseEvent('mousemove', options));
        },
        fireClick : function(element, options) {
            element.dispatchEvent(createMouseEvent('click', options));
        },
        fireDoubleClick : function(element, options) {
            element.dispatchEvent(createMouseEvent('dblclick', options));
        },
        fireMouseWheel : function(element, options) {
            element.dispatchEvent(createMouseWheelEvent('mousewheel', options));
        },
        fireWheel : function(element, options) {
            element.dispatchEvent(createWheelEvent('wheel', options));
        },
        fireTouchStart : function(element, options) {
            element.dispatchEvent(createTouchEvent('touchstart', options));
        },
        fireTouchMove : function(element, options) {
            element.dispatchEvent(createTouchEvent('touchmove', options));
        },
        fireTouchEnd : function(element, options) {
            element.dispatchEvent(createTouchEvent('touchend', options));
        },
        fireTouchCancel : function(element, options) {
            element.dispatchEvent(createTouchEvent('touchcancel', options));
        },
        firePointerDown : function(element, options) {
            element.dispatchEvent(createPointerEvent('pointerdown', options));
        },
        firePointerUp : function(element, options) {
            element.dispatchEvent(createPointerEvent('pointerup', options));
        },
        firePointerMove : function(element, options) {
            element.dispatchEvent(createPointerEvent('pointermove', options));
        },
        firePointerCancel : function(element, options) {
            element.dispatchEvent(createPointerEvent('pointercancel', options));
        },
        fireDeviceOrientation : function(element, options) {
            element.dispatchEvent(createDeviceOrientationEvent('deviceorientation', options));
        },
        fireMockEvent : function(eventHandler, event) {
            eventHandler.call(window, event);
        }
    };

    return DomEventSimulator;
});
<commit_msg>Use new DomOrientationEvent constructor when available.<commit_after>/*global define*/
define([
        'Core/defaultValue',
        'Core/FeatureDetection'
    ], function(
        defaultValue,
        FeatureDetection) {
    'use strict';

    function createMouseEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var view = defaultValue(options.view, window);
        var detail = defaultValue(options.detail, 0);
        var screenX = defaultValue(options.screenX, 0);
        var screenY = defaultValue(options.screenY, 0);
        var clientX = defaultValue(options.clientX, 0);
        var clientY = defaultValue(options.clientY, 0);
        var ctrlKey = defaultValue(options.ctrlKey, false);
        var altKey = defaultValue(options.altKey, false);
        var shiftKey = defaultValue(options.shiftKey, false);
        var metaKey = defaultValue(options.metaKey, false);
        var button = defaultValue(options.button, 0);
        var relatedTarget = defaultValue(options.relatedTarget, null);

        var event = document.createEvent('MouseEvent');
        event.initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);
        return event;
    }

    function createModifiersList(ctrlKey, altKey, shiftKey, metaKey) {
        var modifiers = [];
        if (ctrlKey) {
            modifiers.push('Control');
        }
        if (altKey) {
            modifiers.push('Alt');
        }
        if (shiftKey) {
            modifiers.push('Shift');
        }
        if (metaKey) {
            modifiers.push('Meta');
        }
        return modifiers.join(' ');
    }

    // MouseWheelEvent is legacy
    function createMouseWheelEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var view = defaultValue(options.view, window);
        var detail = defaultValue(options.detail, 0);
        var screenX = defaultValue(options.screenX, 0);
        var screenY = defaultValue(options.screenY, 0);
        var clientX = defaultValue(options.clientX, 0);
        var clientY = defaultValue(options.clientY, 0);
        var button = defaultValue(options.button, 0);
        var relatedTarget = defaultValue(options.relatedTarget, null);
        var ctrlKey = defaultValue(options.ctrlKey, false);
        var altKey = defaultValue(options.altKey, false);
        var shiftKey = defaultValue(options.shiftKey, false);
        var metaKey = defaultValue(options.metaKey, false);
        var wheelDelta = defaultValue(options.wheelDelta, 0);

        var event = document.createEvent('MouseWheelEvent');
        var modifiersList = createModifiersList(ctrlKey, altKey, shiftKey, metaKey);
        event.initMouseWheelEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, button, relatedTarget, modifiersList, wheelDelta);
        return event;
    }

    function createWheelEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var view = defaultValue(options.view, window);
        var detail = defaultValue(options.detail, 0);
        var screenX = defaultValue(options.screenX, 0);
        var screenY = defaultValue(options.screenY, 0);
        var clientX = defaultValue(options.clientX, 0);
        var clientY = defaultValue(options.clientY, 0);
        var button = defaultValue(options.button, 0);
        var relatedTarget = defaultValue(options.relatedTarget, null);
        var ctrlKey = defaultValue(options.ctrlKey, false);
        var altKey = defaultValue(options.altKey, false);
        var shiftKey = defaultValue(options.shiftKey, false);
        var metaKey = defaultValue(options.metaKey, false);
        var deltaX = defaultValue(options.deltaX, 0);
        var deltaY = defaultValue(options.deltaY, 0);
        var deltaZ = defaultValue(options.deltaZ, 0);
        var deltaMode = defaultValue(options.deltaMode, 0);

        try {
            /*global WheelEvent*/
            return new WheelEvent(type, {
                view : view,
                detail : detail,
                screenX : screenX,
                screenY : screenY,
                clientX : clientX,
                clientY : clientY,
                button : button,
                relatedTarget : relatedTarget,
                ctrlKey : ctrlKey,
                altKey : altKey,
                shiftKey : shiftKey,
                metaKey : metaKey,
                deltaX : deltaX,
                deltaY : deltaY,
                deltaZ : deltaZ,
                deltaMode : deltaMode
            });
        } catch (e) {
            var event = document.createEvent('WheelEvent');
            var modifiersList = createModifiersList(ctrlKey, altKey, shiftKey, metaKey);
            event.initWheelEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, button, relatedTarget, modifiersList, deltaX, deltaY, deltaZ, deltaMode);
            return event;
        }
    }

    function createTouchEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var view = defaultValue(options.view, window);
        var detail = defaultValue(options.detail, 0);

        var event = document.createEvent('UIEvent');
        event.initUIEvent(type, canBubble, cancelable, view, detail);

        event.touches = defaultValue(options.touches, []);
        event.targetTouches = defaultValue(options.targetTouches, []);
        event.changedTouches = defaultValue(options.changedTouches, []);

        return event;
    }

    function createPointerEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var event;

        if (FeatureDetection.isInternetExplorer()) {
            var canBubble = defaultValue(options.canBubble, true);
            var cancelable = defaultValue(options.cancelable, true);
            var view = defaultValue(options.view, window);
            var detail = defaultValue(options.detail, 0);
            var screenX = defaultValue(options.screenX, 0);
            var screenY = defaultValue(options.screenY, 0);
            var clientX = defaultValue(options.clientX, 0);
            var clientY = defaultValue(options.clientY, 0);
            var ctrlKey = defaultValue(options.ctrlKey, false);
            var altKey = defaultValue(options.altKey, false);
            var shiftKey = defaultValue(options.shiftKey, false);
            var metaKey = defaultValue(options.metaKey, false);
            var button = defaultValue(options.button, 0);
            var relatedTarget = defaultValue(options.relatedTarget, null);
            var offsetX = defaultValue(options.offsetX, 0);
            var offsetY = defaultValue(options.offsetY, 0);
            var width = defaultValue(options.width, 0);
            var height = defaultValue(options.height, 0);
            var pressure = defaultValue(options.pressure, 0);
            var rotation = defaultValue(options.rotation, 0);
            var tiltX = defaultValue(options.tiltX, 0);
            var tiltY = defaultValue(options.tiltY, 0);
            var pointerId = defaultValue(options.pointerId, 1);
            var pointerType = defaultValue(options.pointerType, 0);
            var hwTimestamp = defaultValue(options.hwTimestamp, 0);
            var isPrimary = defaultValue(options.isPrimary, 0);

            event = document.createEvent('PointerEvent');
            event.initPointerEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY,
                    ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, offsetX, offsetY, width, height,
                    pressure, rotation, tiltX, tiltY, pointerId, pointerType, hwTimestamp, isPrimary);
        } else {
            event = new window.PointerEvent(type, {
                canBubble : defaultValue(options.canBubble, true),
                cancelable : defaultValue(options.cancelable, true),
                view : defaultValue(options.view, window),
                detail : defaultValue(options.detail, 0),
                screenX : defaultValue(options.screenX, 0),
                screenY : defaultValue(options.screenY, 0),
                clientX : defaultValue(options.clientX, 0),
                clientY : defaultValue(options.clientY, 0),
                ctrlKey : defaultValue(options.ctrlKey, false),
                altKey : defaultValue(options.altKey, false),
                shiftKey : defaultValue(options.shiftKey, false),
                metaKey : defaultValue(options.metaKey, false),
                button : defaultValue(options.button, 0),
                relatedTarget : defaultValue(options.relatedTarget, null),
                offsetX : defaultValue(options.offsetX, 0),
                offsetY : defaultValue(options.offsetY, 0),
                width : defaultValue(options.width, 0),
                height : defaultValue(options.height, 0),
                pressure : defaultValue(options.pressure, 0),
                rotation : defaultValue(options.rotation, 0),
                tiltX : defaultValue(options.tiltX, 0),
                tiltY : defaultValue(options.tiltY, 0),
                pointerId : defaultValue(options.pointerId, 1),
                pointerType : defaultValue(options.pointerType, 0),
                hwTimestamp : defaultValue(options.hwTimestamp, 0),
                isPrimary : defaultValue(options.isPrimary, 0)
            });
        }
        return event;
    }

    function createDeviceOrientationEvent(type, options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);
        var canBubble = defaultValue(options.canBubble, true);
        var cancelable = defaultValue(options.cancelable, true);
        var alpha = defaultValue(options.alpha, 0.0);
        var beta = defaultValue(options.beta, 0.0);
        var gamma = defaultValue(options.gamma, 0.0);
        var absolute = defaultValue(options.absolute, false);

        var event;
        event = document.createEvent('DeviceOrientationEvent');
        if (typeof event.initDeviceOrientationEvent === 'function') {
            event.initDeviceOrientationEvent(type, canBubble, cancelable, alpha, beta, gamma, absolute);
        } else {
            event = new DeviceOrientationEvent('deviceorientation', {
                alpha : alpha,
                beta : beta,
                gamma : gamma,
                absolute : absolute
            });
        }
        return event;
    }

    var DomEventSimulator = {
        fireMouseDown : function(element, options) {
            element.dispatchEvent(createMouseEvent('mousedown', options));
        },
        fireMouseUp : function(element, options) {
            element.dispatchEvent(createMouseEvent('mouseup', options));
        },
        fireMouseMove : function(element, options) {
            element.dispatchEvent(createMouseEvent('mousemove', options));
        },
        fireClick : function(element, options) {
            element.dispatchEvent(createMouseEvent('click', options));
        },
        fireDoubleClick : function(element, options) {
            element.dispatchEvent(createMouseEvent('dblclick', options));
        },
        fireMouseWheel : function(element, options) {
            element.dispatchEvent(createMouseWheelEvent('mousewheel', options));
        },
        fireWheel : function(element, options) {
            element.dispatchEvent(createWheelEvent('wheel', options));
        },
        fireTouchStart : function(element, options) {
            element.dispatchEvent(createTouchEvent('touchstart', options));
        },
        fireTouchMove : function(element, options) {
            element.dispatchEvent(createTouchEvent('touchmove', options));
        },
        fireTouchEnd : function(element, options) {
            element.dispatchEvent(createTouchEvent('touchend', options));
        },
        fireTouchCancel : function(element, options) {
            element.dispatchEvent(createTouchEvent('touchcancel', options));
        },
        firePointerDown : function(element, options) {
            element.dispatchEvent(createPointerEvent('pointerdown', options));
        },
        firePointerUp : function(element, options) {
            element.dispatchEvent(createPointerEvent('pointerup', options));
        },
        firePointerMove : function(element, options) {
            element.dispatchEvent(createPointerEvent('pointermove', options));
        },
        firePointerCancel : function(element, options) {
            element.dispatchEvent(createPointerEvent('pointercancel', options));
        },
        fireDeviceOrientation : function(element, options) {
            element.dispatchEvent(createDeviceOrientationEvent('deviceorientation', options));
        },
        fireMockEvent : function(eventHandler, event) {
            eventHandler.call(window, event);
        }
    };

    return DomEventSimulator;
});
<|endoftext|>


<commit_before>import template from '/app/template.js';

export default [
    {
        path: '/musicians',
        format: 'text/csv',
        query: template`
SELECT ?voornaam ?achternaam ?email ?telefoon ?instrument ?straat ?nummer ?postcode ?gemeente WHERE {
  ?s a <http://mu.semte.ch/vocabularies/ext/bravoer/Musician> ;
     <http://www.w3.org/2006/vcard/ns#hasGivenName> ?voornaam ;
     <http://www.w3.org/2006/vcard/ns#hasFamilyName> ?achternaam ;
     ^<http://www.w3.org/2006/vcard/ns#hasMember> ${['group', 'uri']} .

  OPTIONAL {
    ?s <http://www.w3.org/2006/vcard/ns#hasEmail> ?emailUri .
    BIND(STRAFTER(STR(?emailUri), "mailto:") as ?email)
  }
  OPTIONAL {
    ?s <http://www.w3.org/2006/vcard/ns#hasTelephone>/<http://www.w3.org/1999/02/22-rdf-syntax-ns#value> ?telUri
    BIND(STRAFTER(STR(?telUri), "tel:") as ?telefoon)
  }
  OPTIONAL { ?s <http://mu.semte.ch/vocabularies/ext/music/instrument> ?instrument }
  OPTIONAL {
    ?s <http://www.w3.org/ns/locn#address> ?address .
    ?address <http://www.w3.org/ns/locn#thoroughfare> ?straat .
    ?address <http://www.w3.org/ns/locn#poBox> ?nummer .
    ?address <http://www.w3.org/ns/locn#postCode> ?postcode .
    ?address <http://www.w3.org/ns/locn#postName> ?gemeente .
  }
} ORDER BY ?achternaam ?voornaam`
    },
    {
        path: '/sympathizers',
        format: 'text/csv',
        query: `
SELECT ?organizatie ?aanspreking ?voornaam ?achternaam ?email ?telefoon ?straat ?nummer ?postcode ?gemeente ?uitnodiging WHERE {
  ?s a <http://mu.semte.ch/vocabularies/ext/bravoer/Sympathizer> .

  OPTIONAL {
     ?s <http://www.w3.org/2006/vcard/ns#hasOrganizationName> ?organizatie .
  }

  OPTIONAL {
     ?s <http://www.w3.org/2006/vcard/ns#hasHonorificPrefix> ?aanspreking .
  }

  OPTIONAL {
     ?s <http://www.w3.org/2006/vcard/ns#hasGivenName> ?voornaam .
  }

  OPTIONAL {
     ?s <http://www.w3.org/2006/vcard/ns#hasFamilyName> ?achterNaam .
  }

  OPTIONAL {
    ?s <http://www.w3.org/2006/vcard/ns#hasEmail> ?emailUri .
    BIND(STRAFTER(STR(?emailUri), "mailto:") as ?email)
  }

  OPTIONAL {
    ?s <http://www.w3.org/2006/vcard/ns#hasTelephone>/<http://www.w3.org/1999/02/22-rdf-syntax-ns#value> ?telUri
    BIND(STRAFTER(STR(?telUri), "tel:") as ?telefoon)
  }

  OPTIONAL {
    ?s <http://www.w3.org/ns/locn#address> ?address .
    ?address <http://www.w3.org/ns/locn#thoroughfare> ?straat .
    ?address <http://www.w3.org/ns/locn#poBox> ?nummer .
    ?address <http://www.w3.org/ns/locn#postCode> ?postcode .
    ?address <http://www.w3.org/ns/locn#postName> ?gemeente .
  }

  OPTIONAL {
    ?s <http://mu.semte.ch/vocabularies/ext/bravoer/communicationsMedium> ?communication .
    BIND(IF(?communication = "paper", "Papier", "E-mail") as ?uitnodiging)
  }

} ORDER BY ?achternaam ?voornaam`
    }
];
<commit_msg>Fix typo in sympathizers export<commit_after>import template from '/app/template.js';

export default [
    {
        path: '/musicians',
        format: 'text/csv',
        query: template`
SELECT ?voornaam ?achternaam ?email ?telefoon ?instrument ?straat ?nummer ?postcode ?gemeente WHERE {
  ?s a <http://mu.semte.ch/vocabularies/ext/bravoer/Musician> ;
     <http://www.w3.org/2006/vcard/ns#hasGivenName> ?voornaam ;
     <http://www.w3.org/2006/vcard/ns#hasFamilyName> ?achternaam ;
     ^<http://www.w3.org/2006/vcard/ns#hasMember> ${['group', 'uri']} .

  OPTIONAL {
    ?s <http://www.w3.org/2006/vcard/ns#hasEmail> ?emailUri .
    BIND(STRAFTER(STR(?emailUri), "mailto:") as ?email)
  }
  OPTIONAL {
    ?s <http://www.w3.org/2006/vcard/ns#hasTelephone>/<http://www.w3.org/1999/02/22-rdf-syntax-ns#value> ?telUri
    BIND(STRAFTER(STR(?telUri), "tel:") as ?telefoon)
  }
  OPTIONAL { ?s <http://mu.semte.ch/vocabularies/ext/music/instrument> ?instrument }
  OPTIONAL {
    ?s <http://www.w3.org/ns/locn#address> ?address .
    ?address <http://www.w3.org/ns/locn#thoroughfare> ?straat .
    ?address <http://www.w3.org/ns/locn#poBox> ?nummer .
    ?address <http://www.w3.org/ns/locn#postCode> ?postcode .
    ?address <http://www.w3.org/ns/locn#postName> ?gemeente .
  }
} ORDER BY ?achternaam ?voornaam`
    },
    {
        path: '/sympathizers',
        format: 'text/csv',
        query: `
SELECT ?organizatie ?aanspreking ?voornaam ?achternaam ?email ?telefoon ?straat ?nummer ?postcode ?gemeente ?uitnodiging WHERE {
  ?s a <http://mu.semte.ch/vocabularies/ext/bravoer/Sympathizer> .

  OPTIONAL {
     ?s <http://www.w3.org/2006/vcard/ns#hasOrganizationName> ?organizatie .
  }

  OPTIONAL {
     ?s <http://www.w3.org/2006/vcard/ns#hasHonorificPrefix> ?aanspreking .
  }

  OPTIONAL {
     ?s <http://www.w3.org/2006/vcard/ns#hasGivenName> ?voornaam .
  }

  OPTIONAL {
     ?s <http://www.w3.org/2006/vcard/ns#hasFamilyName> ?achternaam .
  }

  OPTIONAL {
    ?s <http://www.w3.org/2006/vcard/ns#hasEmail> ?emailUri .
    BIND(STRAFTER(STR(?emailUri), "mailto:") as ?email)
  }

  OPTIONAL {
    ?s <http://www.w3.org/2006/vcard/ns#hasTelephone>/<http://www.w3.org/1999/02/22-rdf-syntax-ns#value> ?telUri
    BIND(STRAFTER(STR(?telUri), "tel:") as ?telefoon)
  }

  OPTIONAL {
    ?s <http://www.w3.org/ns/locn#address> ?address .
    ?address <http://www.w3.org/ns/locn#thoroughfare> ?straat .
    ?address <http://www.w3.org/ns/locn#poBox> ?nummer .
    ?address <http://www.w3.org/ns/locn#postCode> ?postcode .
    ?address <http://www.w3.org/ns/locn#postName> ?gemeente .
  }

  OPTIONAL {
    ?s <http://mu.semte.ch/vocabularies/ext/bravoer/communicationsMedium> ?communication .
    BIND(IF(?communication = "paper", "Papier", "E-mail") as ?uitnodiging)
  }

} ORDER BY ?achternaam ?voornaam`
    }
];
<|endoftext|>


<commit_before>////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

/**
 * A Realm instance represents a Realm database.
 * ```js
 * const Realm = require('realm');
 * ```
 */
class Realm {
    /**
     * Create a new `Realm` instance using the provided `config`. If a Realm does not yet exist
     * at `config.path` (or {@link Realm.defaultPath} if not provided), then this constructor
     * will create it with the provided `config.schema` (which is _required_ in this case).
     * Otherwise, the instance will access the existing Realm from the file at that path.
     * In this case, `config.schema` is _optional_ or not have changed, unless
     * `config.schemaVersion` is incremented, in which case the Realm will be automatically
     * migrated to use the new schema.
     * @param {Realm~Configuration} [config] - **Required** when first creating the Realm.
     * @throws {Error} If anything in the provided `config` is invalid.
     */
    constructor(config) {}

    /**
     * Create a new Realm object of the given type and with the specified properties.
     * @param {Realm~ObjectType} type - The type of Realm object to create.
     * @param {Object} properties - Property values for all required properties without a
     *   default value.
     * @param {boolean} [update=false] - Signals that an existing object with matching primary key
     *   should be updated. Only the primary key property and properties which should be updated
     *   need to be specified. All missing property values will remain unchanged.
     * @returns {Realm.Object}
     */
    create(type, properties, update) {}

    /**
     * Deletes the provided Realm object, or each one inside the provided collection.
     * @param {Realm.Object|Realm.Object[]|Realm.List|Realm.Results} object
     */
    delete(object) {}

    /**
     * **WARNING:** This will delete **all** objects in the Realm!
     */
    deleteAll() {}

    /**
     * Returns all objects of the given `type` in the Realm.
     * @param {Realm~ObjectType} type - The type of Realm objects to retrieve.
     * @throws {Error} If type passed into this method is invalid.
     * @returns {Realm.Results} that will live-update as objects are created and destroyed.
     */
    objects(type) {}

    /**
     * Add a listener `callback` for the specified event `name`.
     * @param {string} name - The name of event that should cause the callback to be called.
     *   _Currently, only the "change" event supported_.
     * @param {function(Realm, string)} callback - Function to be called when the event occurs.
     *   Each callback will only be called once per event, regardless of the number of times
     *   it was added.
     * @throws {Error} If an invalid event `name` is supplied, or if `callback` is not a function.
     */
    addListener(name, callback) {}

   /**
    * Remove the listener `callback` for the specfied event `name`.
    * @param {string} name - The event name.
    *   _Currently, only the "change" event supported_.
    * @param {function(Realm, string)} callback - Function that was previously added as a
    *   listener for this event through the {@link Realm#addListener addListener} method.
    * @throws {Error} If an invalid event `name` is supplied, or if `callback` is not a function.
    */
    removeListener(name, callback) {}

   /**
    * Remove all event listeners (restricted to the event `name`, if provided).
    * @param {string} [name] - The name of the event whose listeners should be removed.
    *   _Currently, only the "change" event supported_.
    * @throws {Error} When invalid event `name` is supplied
    */
    removeAllListeners(name) {}

   /**
    * Synchronously call the provided `callback` inside a write transaction.
    * @param {function()} callback
    */
    write(callback) {}
}

/**
 * Get the current schema version of the Realm at the given path.
 * @param {string} path - The path to the file where the
 *   Realm database is stored.
 * @param {string} encryptionKey - Optional encryption key.
 * @throws {Error} When passing an invalid or non-matching encryption key.
 * @returns {number} version of the schema, or `-1` if no Realm exists at `path`.
 */
Realm.schemaVersion = function(path, encryptionKey) {};

/**
 * The default path where to create and access the Realm file.
 * @type {string}
 */
Realm.defaultPath;

/**
 * This describes the different options used to create a {@link Realm} instance.
 * @typedef Realm~Configuration
 * @type {Object}
 * @property {ArrayBuffer|ArrayBufferView} [encryptionKey] - The 512-bit (64-byte) encryption
 *   key used to encrypt and decrypt all data in the Realm.
 * @property {string} [path={@link Realm.defaultPath}] - The path to the file where the
 *   Realm database should be stored.
 * @property {Array<Realm~ObjectClass|Realm~ObjectSchema>} [schema] - Specifies all the
 *   object types in this Realm. **Required** when first creating a Realm at this `path`.
 * @property {number} [schemaVersion] - **Required** (and must be incremented) after
 *   changing the `schema`.
 */

/**
 * Realm objects will inherit methods, getters, and setters from the `prototype` of this
 * constructor.
 * @typedef Realm~ObjectClass
 * @type {Class}
 * @property {Realm~ObjectSchema} schema - Static property specifying object schema information.
 */

/**
 * @typedef Realm~ObjectSchema
 * @type {Object}
 * @property {string} name - Represents the object type.
 * @property {string} [primaryKey] - The name of a `"string"` or `"int"` property
 *   that must be unique across all objects of this type within the same Realm.
 * @property {Object<string, (Realm~PropertyType|Realm~ObjectSchemaProperty)>} properties -
 *   An object where the keys are property names and the values represent the property type.
 */

/**
 * @typedef Realm~ObjectSchemaProperty
 * @type {Object}
 * @property {Realm~PropertyType} type - The type of this property.
 * @property {string} [objectType] - **Required**  when `type` is `"list"`, and must match the
 *   type of an object in the same schema.
 * @property {any} [default] - The default value for this property on creation when not
 *   otherwise specified.
 * @property {boolean} [optional] - Signals if this property may be assigned `null` or `undefined`.
 * @property {boolean} [indexed] - Signals if this property should be indexed. Only supported for
 *   `"string"`, `"int"`, and `"bool"` properties.
 */

/**
 * The type of an object may either be specified as a string equal to the `name` in a
 * {@link Realm~ObjectSchema ObjectSchema} definition, **or** a constructor that was specified
 * in the {@link Realm~Configuration configuration} `schema`.
 * @typedef Realm~ObjectType
 * @type {string|Realm~ObjectClass}
 */

/**
 * A property type may be specified as one of the standard builtin types, or as an object type
 * inside the same schema.
 * @typedef Realm~PropertyType
 * @type {("bool"|"int"|"float"|"double"|"string"|"date"|"data"|"list"|"<ObjectType>")}
 * @property {boolean} "bool" - Property value may either be `true` or `false`.
 * @property {number} "int" - Property may be assigned any number, but will be stored as a
 *   round integer, meaning anything after the decimal will be truncated.
 * @property {number} "float" - Property may be assigned any number, but will be stored as a
 *   `float`, which may result in a loss of precision.
 * @property {number} "double" - Property may be assigned any number, and will have no loss
 *   of precision.
 * @property {string} "string" - Property value may be any arbitrary string.
 * @property {Date} "date" - Property may be assigned any `Date` instance, but will be stored
 *   with second-level precision (a fix for this is in progress).
 * @property {ArrayBuffer} "data" - Property may either be assigned an `ArrayBuffer`
 *   or `ArrayBufferView` (e.g. `DataView`, `Int8Array`, `Float32Array`, etc.) instance,
 *   but will always be returned as an `ArrayBuffer`.
 * @property {Realm.List} "list" - Property may be assigned any ordered collection
 *   (e.g. `Array`, {@link Realm.List}, {@link Realm.Results}) of objects all matching the
 *   `objectType` specified in the {@link Realm~ObjectSchemaProperty ObjectSchemaProperty}.
 * @property {Realm.Object} "<ObjectType>" - A string that matches the `name` of an object in the
 *   same schema (see {@link Realm~ObjectSchema ObjectSchema}) – this property may be assigned
 *   any object of this type from inside the same Realm, and will always be _optional_
 *   (meaning it may also be assigned `null` or `undefined`).
 */
<commit_msg>tweak docs<commit_after>////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

/**
 * A Realm instance represents a Realm database.
 * ```js
 * const Realm = require('realm');
 * ```
 */
class Realm {
    /**
     * Create a new `Realm` instance using the provided `config`. If a Realm does not yet exist
     * at `config.path` (or {@link Realm.defaultPath} if not provided), then this constructor
     * will create it with the provided `config.schema` (which is _required_ in this case).
     * Otherwise, the instance will access the existing Realm from the file at that path.
     * In this case, `config.schema` is _optional_ or not have changed, unless
     * `config.schemaVersion` is incremented, in which case the Realm will be automatically
     * migrated to use the new schema.
     * @param {Realm~Configuration} [config] - **Required** when first creating the Realm.
     * @throws {Error} If anything in the provided `config` is invalid.
     */
    constructor(config) {}

    /**
     * Create a new Realm object of the given type and with the specified properties.
     * @param {Realm~ObjectType} type - The type of Realm object to create.
     * @param {Object} properties - Property values for all required properties without a
     *   default value.
     * @param {boolean} [update=false] - Signals that an existing object with matching primary key
     *   should be updated. Only the primary key property and properties which should be updated
     *   need to be specified. All missing property values will remain unchanged.
     * @returns {Realm.Object}
     */
    create(type, properties, update) {}

    /**
     * Deletes the provided Realm object, or each one inside the provided collection.
     * @param {Realm.Object|Realm.Object[]|Realm.List|Realm.Results} object
     */
    delete(object) {}

    /**
     * **WARNING:** This will delete **all** objects in the Realm!
     */
    deleteAll() {}

    /**
     * Returns all objects of the given `type` in the Realm.
     * @param {Realm~ObjectType} type - The type of Realm objects to retrieve.
     * @throws {Error} If type passed into this method is invalid.
     * @returns {Realm.Results} that will live-update as objects are created and destroyed.
     */
    objects(type) {}

    /**
     * Add a listener `callback` for the specified event `name`.
     * @param {string} name - The name of event that should cause the callback to be called.
     *   _Currently, only the "change" event supported_.
     * @param {function(Realm, string)} callback - Function to be called when the event occurs.
     *   Each callback will only be called once per event, regardless of the number of times
     *   it was added.
     * @throws {Error} If an invalid event `name` is supplied, or if `callback` is not a function.
     */
    addListener(name, callback) {}

   /**
    * Remove the listener `callback` for the specfied event `name`.
    * @param {string} name - The event name.
    *   _Currently, only the "change" event supported_.
    * @param {function(Realm, string)} callback - Function that was previously added as a
    *   listener for this event through the {@link Realm#addListener addListener} method.
    * @throws {Error} If an invalid event `name` is supplied, or if `callback` is not a function.
    */
    removeListener(name, callback) {}

   /**
    * Remove all event listeners (restricted to the event `name`, if provided).
    * @param {string} [name] - The name of the event whose listeners should be removed.
    *   _Currently, only the "change" event supported_.
    * @throws {Error} When invalid event `name` is supplied
    */
    removeAllListeners(name) {}

   /**
    * Synchronously call the provided `callback` inside a write transaction.
    * @param {function()} callback
    */
    write(callback) {}
}

/**
 * Get the current schema version of the Realm at the given path.
 * @param {string} path - The path to the file where the
 *   Realm database is stored.
 * @param {ArrayBuffer|ArrayBufferView} [encryptionKey] - Required only when
 *   accessing encrypted Realms.
 * @throws {Error} When passing an invalid or non-matching encryption key.
 * @returns {number} version of the schema, or `-1` if no Realm exists at `path`.
 */
Realm.schemaVersion = function(path, encryptionKey) {};

/**
 * The default path where to create and access the Realm file.
 * @type {string}
 */
Realm.defaultPath;

/**
 * This describes the different options used to create a {@link Realm} instance.
 * @typedef Realm~Configuration
 * @type {Object}
 * @property {ArrayBuffer|ArrayBufferView} [encryptionKey] - The 512-bit (64-byte) encryption
 *   key used to encrypt and decrypt all data in the Realm.
 * @property {string} [path={@link Realm.defaultPath}] - The path to the file where the
 *   Realm database should be stored.
 * @property {Array<Realm~ObjectClass|Realm~ObjectSchema>} [schema] - Specifies all the
 *   object types in this Realm. **Required** when first creating a Realm at this `path`.
 * @property {number} [schemaVersion] - **Required** (and must be incremented) after
 *   changing the `schema`.
 */

/**
 * Realm objects will inherit methods, getters, and setters from the `prototype` of this
 * constructor.
 * @typedef Realm~ObjectClass
 * @type {Class}
 * @property {Realm~ObjectSchema} schema - Static property specifying object schema information.
 */

/**
 * @typedef Realm~ObjectSchema
 * @type {Object}
 * @property {string} name - Represents the object type.
 * @property {string} [primaryKey] - The name of a `"string"` or `"int"` property
 *   that must be unique across all objects of this type within the same Realm.
 * @property {Object<string, (Realm~PropertyType|Realm~ObjectSchemaProperty)>} properties -
 *   An object where the keys are property names and the values represent the property type.
 */

/**
 * @typedef Realm~ObjectSchemaProperty
 * @type {Object}
 * @property {Realm~PropertyType} type - The type of this property.
 * @property {string} [objectType] - **Required**  when `type` is `"list"`, and must match the
 *   type of an object in the same schema.
 * @property {any} [default] - The default value for this property on creation when not
 *   otherwise specified.
 * @property {boolean} [optional] - Signals if this property may be assigned `null` or `undefined`.
 * @property {boolean} [indexed] - Signals if this property should be indexed. Only supported for
 *   `"string"`, `"int"`, and `"bool"` properties.
 */

/**
 * The type of an object may either be specified as a string equal to the `name` in a
 * {@link Realm~ObjectSchema ObjectSchema} definition, **or** a constructor that was specified
 * in the {@link Realm~Configuration configuration} `schema`.
 * @typedef Realm~ObjectType
 * @type {string|Realm~ObjectClass}
 */

/**
 * A property type may be specified as one of the standard builtin types, or as an object type
 * inside the same schema.
 * @typedef Realm~PropertyType
 * @type {("bool"|"int"|"float"|"double"|"string"|"date"|"data"|"list"|"<ObjectType>")}
 * @property {boolean} "bool" - Property value may either be `true` or `false`.
 * @property {number} "int" - Property may be assigned any number, but will be stored as a
 *   round integer, meaning anything after the decimal will be truncated.
 * @property {number} "float" - Property may be assigned any number, but will be stored as a
 *   `float`, which may result in a loss of precision.
 * @property {number} "double" - Property may be assigned any number, and will have no loss
 *   of precision.
 * @property {string} "string" - Property value may be any arbitrary string.
 * @property {Date} "date" - Property may be assigned any `Date` instance, but will be stored
 *   with second-level precision (a fix for this is in progress).
 * @property {ArrayBuffer} "data" - Property may either be assigned an `ArrayBuffer`
 *   or `ArrayBufferView` (e.g. `DataView`, `Int8Array`, `Float32Array`, etc.) instance,
 *   but will always be returned as an `ArrayBuffer`.
 * @property {Realm.List} "list" - Property may be assigned any ordered collection
 *   (e.g. `Array`, {@link Realm.List}, {@link Realm.Results}) of objects all matching the
 *   `objectType` specified in the {@link Realm~ObjectSchemaProperty ObjectSchemaProperty}.
 * @property {Realm.Object} "<ObjectType>" - A string that matches the `name` of an object in the
 *   same schema (see {@link Realm~ObjectSchema ObjectSchema}) – this property may be assigned
 *   any object of this type from inside the same Realm, and will always be _optional_
 *   (meaning it may also be assigned `null` or `undefined`).
 */
<|endoftext|>


<commit_before>exports.encode = function encode(plaintext) {
	return plaintext.replace(/([\w\s])\1*/g, function(match) {
		return match.length > 1 ? match.length + match[0] : match[0]
	});
}

exports.decode = function decode(cypher) {
	return cypher.replace(/(\d+)(\w|\s)/g, function(match, repeats, char) {
		return new Array(+repeats + 1).join(char)
	});
}<commit_msg>rle: added missing semicolons<commit_after>exports.encode = function encode(plaintext) {
	return plaintext.replace(/([\w\s])\1*/g, function(match) {
		return match.length > 1 ? match.length + match[0] : match[0];
	});
};

exports.decode = function decode(cypher) {
	return cypher.replace(/(\d+)(\w|\s)/g, function(match, repeats, char) {
		return new Array(+repeats + 1).join(char);
	});
};
<|endoftext|>


<commit_before>/* Copyright 2010 Palm, Inc. All rights reserved. */
var SlideshowTimer;

(function() {
const SLIDE_DURATION = 5000;

SlideshowTimer = function(controller, next) {
    this.controller = controller;
    this.showNext = next;
};

SlideshowTimer.prototype = {
    start: function(fullIter) {
        // Short circuit autotransitions
        if (this.disableAutoTransition) {
            return;
        }

        // Make sure that we don't have multiple queued timers
        this.stop();

        var self = this,
            timeout = SLIDE_DURATION;
        if (!fullIter && this.timerStart) {
            // Wait the remainder of the timeout, but if we have a short time left
            // then add some more time so the user has a chance to interact with the app
            // some more before the UI disappears.
            timeout = Math.max(timeout - this.timeElapsed, 1000);
        } else {
            this.timeElapsed = 0;
        }
        this.showEntryTimeout = this.controller.window.setTimeout(
                function() {
                    self.showNext();
                }, timeout);
        this.timerStart = Date.now();
        Mojo.Log.info("Init dock timer: timeout: %d time: %d elapsed: %d", timeout, this.timerStart, this.timeElapsed);
    },
    stop: function() {
        if (this.showEntryTimeout) {
            this.controller.window.clearTimeout(this.showEntryTimeout);
            delete this.showEntryTimeout;

            var now = Date.now();
            this.timeElapsed += now - this.timerStart;
            Mojo.Log.info("Stop dock timer: now: %d time: %d elapsed: %d", now, this.timerStart, this.timeElapsed);
        }
    },
    toggleDisabledFlag: function() {
        this.disableAutoTransition = !this.disableAutoTransition;
        if (this.disableAutoTransition) {
            this.stop();
        } else {
            this.start(true);
        }
    }
};
})();
<commit_msg>SlideshowTimer comments<commit_after>/* Copyright 2010 Palm, Inc. All rights reserved. */
var SlideshowTimer;

(function() {
const SLIDE_DURATION = 5000;

/**
 * Utility class that manages the slideshow interval.
 *
 * @oaram contoller SceneController Scene controller that the slideshow is displayed in.
 * @param next function Callback function that is executed when the slideshow interval elapses.
 */
SlideshowTimer = function(controller, next) {
    this.controller = controller;
    this.showNext = next;
};

SlideshowTimer.prototype = {
    /**
     * Begin waiting for the next interval.
     *
     * @param fullIter boolean Truthy to reset the total wait time counter and wait for a complete interval.
     */
    start: function(fullIter) {
        // Short circuit autotransitions
        if (this.disableAutoTransition) {
            return;
        }

        // Make sure that we don't have multiple queued timers
        this.stop();

        var self = this,
            timeout = SLIDE_DURATION;
        if (!fullIter && this.timerStart) {
            // Wait the remainder of the timeout, but if we have a short time left
            // then add some more time so the user has a chance to interact with the app
            // some more before the UI disappears.
            timeout = Math.max(timeout - this.timeElapsed, 1000);
        } else {
            this.timeElapsed = 0;
        }
        this.showEntryTimeout = this.controller.window.setTimeout(
                function() {
                    self.showNext();
                }, timeout);
        this.timerStart = Date.now();
        Mojo.Log.info("Init dock timer: timeout: %d time: %d elapsed: %d", timeout, this.timerStart, this.timeElapsed);
    },
    /**
     * Stop the current interval execution.
     */
    stop: function() {
        if (this.showEntryTimeout) {
            this.controller.window.clearTimeout(this.showEntryTimeout);
            delete this.showEntryTimeout;

            var now = Date.now();
            this.timeElapsed += now - this.timerStart;
            Mojo.Log.info("Stop dock timer: now: %d time: %d elapsed: %d", now, this.timerStart, this.timeElapsed);
        }
    },
    /**
     * Enable or disable the slideshow. When disabled the start function is ignored.
     */
    toggleDisabledFlag: function() {
        this.disableAutoTransition = !this.disableAutoTransition;
        if (this.disableAutoTransition) {
            this.stop();
        } else {
            this.start(true);
        }
    }
};
})();
<|endoftext|>